summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-01 22:22:57 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-01 22:22:57 +0000
commit9e169c4bf36a38689550c059570c57efbf00a6fb (patch)
tree95e6800f7ac2a49ff7f799d96f04172320e70ac0
parent6170dfb6edfb7b19f8ae5209b8f948fe0076a4ad (diff)
downloadgcc-vect256.tar.gz
Merged trunk at revision 161680 into branch.vect256
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/vect256@161681 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog245
-rw-r--r--MAINTAINERS1
-rw-r--r--Makefile.def2
-rw-r--r--Makefile.in16
-rw-r--r--boehm-gc/ChangeLog7
-rwxr-xr-xboehm-gc/configure11
-rw-r--r--boehm-gc/configure.ac12
-rw-r--r--config/ChangeLog23
-rw-r--r--config/bootstrap-lto.mk8
-rw-r--r--config/override.m4264
-rw-r--r--config/tls.m411
-rw-r--r--contrib/ChangeLog13
-rwxr-xr-xcontrib/compare-debug24
-rwxr-xr-xcontrib/gcc_update31
-rwxr-xr-xcontrib/test_summary6
-rw-r--r--fixincludes/ChangeLog14
-rwxr-xr-xfixincludes/configure19
-rw-r--r--fixincludes/configure.ac3
-rw-r--r--fixincludes/fixincl.x96
-rw-r--r--fixincludes/inclhack.def34
-rw-r--r--fixincludes/tests/base/complex.h10
-rw-r--r--fixincludes/tests/base/sys/feature_tests.h18
-rw-r--r--gcc/ChangeLog4831
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in529
-rw-r--r--gcc/ada/ChangeLog3140
-rw-r--r--gcc/ada/Makefile.rtl8
-rw-r--r--gcc/ada/a-coinve.adb2036
-rw-r--r--gcc/ada/a-comlin.ads5
-rw-r--r--gcc/ada/a-convec.adb1650
-rwxr-xr-xgcc/ada/a-envvar.ads2
-rw-r--r--gcc/ada/a-excpol-abort.adb4
-rw-r--r--gcc/ada/a-ngcoty.adb32
-rw-r--r--gcc/ada/a-nudira.adb235
-rw-r--r--gcc/ada/a-nudira.ads57
-rw-r--r--gcc/ada/a-nuflra.adb255
-rw-r--r--gcc/ada/a-nuflra.ads45
-rw-r--r--gcc/ada/a-reatim.adb10
-rw-r--r--gcc/ada/a-retide.adb8
-rw-r--r--gcc/ada/a-strunb-shared.adb2086
-rw-r--r--gcc/ada/a-strunb-shared.ads481
-rw-r--r--gcc/ada/a-strunb.adb21
-rw-r--r--gcc/ada/a-stunau-shared.adb62
-rw-r--r--gcc/ada/a-stunau.adb18
-rw-r--r--gcc/ada/a-stunau.ads23
-rw-r--r--gcc/ada/a-stuten.adb209
-rw-r--r--gcc/ada/a-stuten.ads146
-rw-r--r--gcc/ada/a-stwiun-shared.adb2104
-rw-r--r--gcc/ada/a-stwiun-shared.ads483
-rw-r--r--gcc/ada/a-stzunb-shared.adb2118
-rw-r--r--gcc/ada/a-stzunb-shared.ads501
-rwxr-xr-xgcc/ada/a-suenco.adb390
-rwxr-xr-xgcc/ada/a-suenco.ads61
-rwxr-xr-xgcc/ada/a-suewen.adb371
-rwxr-xr-xgcc/ada/a-suewen.ads67
-rwxr-xr-xgcc/ada/a-suezen.adb431
-rwxr-xr-xgcc/ada/a-suezen.ads64
-rw-r--r--gcc/ada/a-suteio-shared.adb132
-rw-r--r--gcc/ada/a-swunau-shared.adb65
-rw-r--r--gcc/ada/a-swunau.adb21
-rw-r--r--gcc/ada/a-swunau.ads11
-rw-r--r--gcc/ada/a-swuwti-shared.adb134
-rw-r--r--gcc/ada/a-szunau-shared.adb65
-rw-r--r--gcc/ada/a-szunau.adb29
-rw-r--r--gcc/ada/a-szunau.ads11
-rw-r--r--gcc/ada/a-szuzti-shared.adb135
-rw-r--r--gcc/ada/a-tags.ads4
-rw-r--r--gcc/ada/a-tifiio.adb14
-rw-r--r--gcc/ada/adaint.c220
-rw-r--r--gcc/ada/ali-util.adb22
-rw-r--r--gcc/ada/ali-util.ads17
-rw-r--r--gcc/ada/ali.adb85
-rw-r--r--gcc/ada/ali.ads75
-rw-r--r--gcc/ada/alloc.ads3
-rw-r--r--gcc/ada/atree.adb261
-rw-r--r--gcc/ada/atree.ads98
-rw-r--r--gcc/ada/back_end.adb103
-rw-r--r--gcc/ada/back_end.ads2
-rw-r--r--gcc/ada/binde.adb271
-rw-r--r--gcc/ada/bindgen.adb289
-rw-r--r--gcc/ada/bindgen.ads4
-rw-r--r--gcc/ada/bindusg.adb17
-rw-r--r--gcc/ada/checks.adb271
-rw-r--r--gcc/ada/clean.adb7
-rw-r--r--gcc/ada/csets.adb16
-rw-r--r--gcc/ada/cstand.adb55
-rw-r--r--gcc/ada/cstreams.c20
-rw-r--r--gcc/ada/debug.adb39
-rw-r--r--gcc/ada/einfo.adb610
-rw-r--r--gcc/ada/einfo.ads111
-rw-r--r--gcc/ada/env.c6
-rw-r--r--gcc/ada/errout.adb297
-rw-r--r--gcc/ada/errout.ads18
-rw-r--r--gcc/ada/erroutc.ads7
-rw-r--r--gcc/ada/exp_aggr.adb158
-rw-r--r--gcc/ada/exp_atag.adb12
-rw-r--r--gcc/ada/exp_attr.adb134
-rw-r--r--gcc/ada/exp_cg.adb602
-rw-r--r--gcc/ada/exp_cg.ads (renamed from gcc/ada/g-sttsne-dummy.ads)44
-rw-r--r--gcc/ada/exp_ch11.adb31
-rw-r--r--gcc/ada/exp_ch13.adb20
-rw-r--r--gcc/ada/exp_ch3.adb142
-rw-r--r--gcc/ada/exp_ch3.ads8
-rw-r--r--gcc/ada/exp_ch4.adb1074
-rw-r--r--gcc/ada/exp_ch4.ads5
-rw-r--r--gcc/ada/exp_ch5.adb104
-rw-r--r--gcc/ada/exp_ch6.adb209
-rw-r--r--gcc/ada/exp_ch7.adb33
-rw-r--r--gcc/ada/exp_ch7.ads4
-rw-r--r--gcc/ada/exp_ch9.adb275
-rw-r--r--gcc/ada/exp_ch9.ads10
-rw-r--r--gcc/ada/exp_dbug.adb11
-rw-r--r--gcc/ada/exp_disp.adb381
-rw-r--r--gcc/ada/exp_dist.adb307
-rw-r--r--gcc/ada/exp_fixd.adb18
-rw-r--r--gcc/ada/exp_imgv.adb67
-rw-r--r--gcc/ada/exp_intr.adb69
-rw-r--r--gcc/ada/exp_pakd.adb215
-rw-r--r--gcc/ada/exp_pakd.ads7
-rw-r--r--gcc/ada/exp_prag.adb21
-rw-r--r--gcc/ada/exp_sel.adb40
-rw-r--r--gcc/ada/exp_smem.adb7
-rw-r--r--gcc/ada/exp_strm.adb4
-rw-r--r--gcc/ada/exp_util.adb258
-rw-r--r--gcc/ada/exp_util.ads5
-rw-r--r--gcc/ada/expander.adb6
-rw-r--r--gcc/ada/fmap.adb5
-rw-r--r--gcc/ada/freeze.adb392
-rw-r--r--gcc/ada/frontend.adb7
-rw-r--r--gcc/ada/g-comlin.ads135
-rw-r--r--gcc/ada/g-dirope.ads6
-rw-r--r--gcc/ada/g-expect-vms.adb239
-rw-r--r--gcc/ada/g-expect.adb238
-rw-r--r--gcc/ada/g-expect.ads118
-rw-r--r--gcc/ada/g-mbdira.adb282
-rw-r--r--gcc/ada/g-mbdira.ads123
-rw-r--r--gcc/ada/g-mbflra.adb314
-rw-r--r--gcc/ada/g-mbflra.ads103
-rw-r--r--gcc/ada/g-pehage.adb242
-rw-r--r--gcc/ada/g-pehage.ads25
-rw-r--r--gcc/ada/g-sercom-linux.adb11
-rw-r--r--gcc/ada/g-socket.adb265
-rw-r--r--gcc/ada/g-socket.ads91
-rw-r--r--gcc/ada/g-socthi-mingw.adb143
-rw-r--r--gcc/ada/g-socthi-mingw.ads10
-rw-r--r--gcc/ada/g-socthi-vms.adb8
-rw-r--r--gcc/ada/g-socthi-vms.ads10
-rw-r--r--gcc/ada/g-socthi-vxworks.adb8
-rw-r--r--gcc/ada/g-socthi-vxworks.ads10
-rw-r--r--gcc/ada/g-socthi.adb16
-rw-r--r--gcc/ada/g-socthi.ads10
-rw-r--r--gcc/ada/g-sothco.ads152
-rw-r--r--gcc/ada/g-spipat.adb89
-rw-r--r--gcc/ada/g-spitbo.adb20
-rw-r--r--gcc/ada/g-sttsne-locking.adb460
-rw-r--r--gcc/ada/g-sttsne-locking.ads75
-rw-r--r--gcc/ada/g-sttsne-vxworks.adb204
-rw-r--r--gcc/ada/g-sttsne.ads83
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in1390
-rw-r--r--gcc/ada/gcc-interface/Makefile.in126
-rw-r--r--gcc/ada/gcc-interface/ada-tree.h36
-rw-r--r--gcc/ada/gcc-interface/decl.c253
-rw-r--r--gcc/ada/gcc-interface/gigi.h4
-rw-r--r--gcc/ada/gcc-interface/lang-specs.h5
-rw-r--r--gcc/ada/gcc-interface/misc.c8
-rw-r--r--gcc/ada/gcc-interface/trans.c331
-rw-r--r--gcc/ada/gcc-interface/utils.c162
-rw-r--r--gcc/ada/gcc-interface/utils2.c77
-rw-r--r--gcc/ada/get_scos.adb172
-rw-r--r--gcc/ada/gnat-style.texi2
-rw-r--r--gcc/ada/gnat1drv.adb82
-rw-r--r--gcc/ada/gnat_rm.texi1281
-rw-r--r--gcc/ada/gnat_ugn.texi6154
-rw-r--r--gcc/ada/gnatbind.adb161
-rw-r--r--gcc/ada/gnatcmd.adb192
-rw-r--r--gcc/ada/gnatlink.adb11
-rw-r--r--gcc/ada/gnatname.adb17
-rw-r--r--gcc/ada/gnatsym.adb55
-rw-r--r--gcc/ada/gnatvsn.ads2
-rw-r--r--gcc/ada/gnatxref.adb91
-rw-r--r--gcc/ada/gsocket.h45
-rw-r--r--gcc/ada/i-cstrea.ads8
-rw-r--r--gcc/ada/i-forbla-darwin.adb4
-rw-r--r--gcc/ada/impunit.adb34
-rw-r--r--gcc/ada/init.c216
-rw-r--r--gcc/ada/initialize.c11
-rw-r--r--gcc/ada/inline.adb3
-rw-r--r--gcc/ada/inline.ads7
-rw-r--r--gcc/ada/itypes.ads4
-rw-r--r--gcc/ada/layout.adb15
-rw-r--r--gcc/ada/lib-util.adb97
-rw-r--r--gcc/ada/lib-util.ads13
-rw-r--r--gcc/ada/lib-writ.adb94
-rw-r--r--gcc/ada/lib-writ.ads85
-rw-r--r--gcc/ada/lib-xref.adb23
-rw-r--r--gcc/ada/lib-xref.ads9
-rw-r--r--gcc/ada/lib.adb14
-rw-r--r--gcc/ada/lib.ads19
-rw-r--r--gcc/ada/make.adb99
-rw-r--r--gcc/ada/makeusg.adb15
-rw-r--r--gcc/ada/makeutl.adb15
-rw-r--r--gcc/ada/makeutl.ads7
-rw-r--r--gcc/ada/mlib-prj.adb7
-rw-r--r--gcc/ada/mlib-utl.adb31
-rw-r--r--gcc/ada/nlists.adb71
-rw-r--r--gcc/ada/nlists.ads8
-rw-r--r--gcc/ada/opt.adb2
-rw-r--r--gcc/ada/opt.ads70
-rw-r--r--gcc/ada/osint-b.adb38
-rw-r--r--gcc/ada/osint-b.ads20
-rw-r--r--gcc/ada/osint.adb33
-rw-r--r--gcc/ada/osint.ads18
-rw-r--r--gcc/ada/output.adb29
-rw-r--r--gcc/ada/output.ads88
-rw-r--r--gcc/ada/par-ch10.adb20
-rw-r--r--gcc/ada/par-ch11.adb5
-rw-r--r--gcc/ada/par-ch12.adb7
-rw-r--r--gcc/ada/par-ch2.adb4
-rw-r--r--gcc/ada/par-ch3.adb72
-rw-r--r--gcc/ada/par-ch4.adb171
-rw-r--r--gcc/ada/par-ch5.adb26
-rw-r--r--gcc/ada/par-ch6.adb49
-rw-r--r--gcc/ada/par-ch7.adb13
-rw-r--r--gcc/ada/par-ch9.adb34
-rw-r--r--gcc/ada/par-endh.adb2
-rw-r--r--gcc/ada/par-labl.adb16
-rw-r--r--gcc/ada/par-prag.adb27
-rw-r--r--gcc/ada/par-tchk.adb89
-rw-r--r--gcc/ada/par-util.adb32
-rw-r--r--gcc/ada/par.adb21
-rw-r--r--gcc/ada/par_sco.adb593
-rw-r--r--gcc/ada/par_sco.ads166
-rw-r--r--gcc/ada/prep.adb25
-rw-r--r--gcc/ada/prepcomp.adb8
-rw-r--r--gcc/ada/prj-attr.adb3
-rw-r--r--gcc/ada/prj-conf.adb42
-rw-r--r--gcc/ada/prj-env.adb57
-rw-r--r--gcc/ada/prj-env.ads4
-rw-r--r--gcc/ada/prj-ext.adb3
-rw-r--r--gcc/ada/prj-nmsc.adb906
-rw-r--r--gcc/ada/prj-part.adb15
-rw-r--r--gcc/ada/prj-proc.adb221
-rw-r--r--gcc/ada/prj.adb25
-rw-r--r--gcc/ada/prj.ads51
-rw-r--r--gcc/ada/projects.texi3889
-rw-r--r--gcc/ada/put_scos.adb139
-rw-r--r--gcc/ada/raise.h11
-rw-r--r--gcc/ada/repinfo.adb3
-rw-r--r--gcc/ada/restrict.adb10
-rw-r--r--gcc/ada/rtsfind.adb6
-rw-r--r--gcc/ada/s-auxdec-vms-alpha.adb809
-rw-r--r--gcc/ada/s-auxdec-vms_64.ads46
-rw-r--r--gcc/ada/s-crtl.ads7
-rw-r--r--gcc/ada/s-fileio.adb4
-rw-r--r--gcc/ada/s-filofl.ads2
-rw-r--r--gcc/ada/s-finimp.adb4
-rw-r--r--gcc/ada/s-interr.adb18
-rw-r--r--gcc/ada/s-intman-vxworks.ads7
-rwxr-xr-xgcc/ada/s-os_lib.adb14
-rw-r--r--gcc/ada/s-oscons-tmplt.c36
-rw-r--r--gcc/ada/s-osinte-hpux-dce.ads2
-rw-r--r--gcc/ada/s-osinte-linux.ads2
-rw-r--r--gcc/ada/s-osinte-vxworks.ads5
-rw-r--r--gcc/ada/s-rannum.adb369
-rw-r--r--gcc/ada/s-rannum.ads27
-rwxr-xr-xgcc/ada/s-regpat.adb805
-rw-r--r--gcc/ada/s-shasto.adb8
-rw-r--r--gcc/ada/s-stchop.adb20
-rw-r--r--gcc/ada/s-stoele.adb45
-rw-r--r--gcc/ada/s-taprop-vxworks.adb52
-rw-r--r--gcc/ada/s-tasdeb.adb5
-rw-r--r--gcc/ada/s-tpoben.adb10
-rw-r--r--gcc/ada/s-vxwext-kernel.ads4
-rw-r--r--gcc/ada/s-vxwext-rtp.ads4
-rw-r--r--gcc/ada/s-vxwext.ads5
-rw-r--r--gcc/ada/scil_ll.adb144
-rw-r--r--gcc/ada/scil_ll.ads48
-rw-r--r--gcc/ada/scng.adb58
-rw-r--r--gcc/ada/scng.ads8
-rw-r--r--gcc/ada/scos.ads129
-rw-r--r--gcc/ada/sem.adb417
-rw-r--r--gcc/ada/sem_aggr.adb113
-rw-r--r--gcc/ada/sem_attr.adb114
-rwxr-xr-xgcc/ada/sem_aux.adb23
-rwxr-xr-xgcc/ada/sem_aux.ads7
-rw-r--r--gcc/ada/sem_case.adb2
-rw-r--r--gcc/ada/sem_case.ads18
-rw-r--r--gcc/ada/sem_cat.adb59
-rw-r--r--gcc/ada/sem_ch10.adb86
-rw-r--r--gcc/ada/sem_ch11.adb2
-rw-r--r--gcc/ada/sem_ch12.adb308
-rw-r--r--gcc/ada/sem_ch13.adb1646
-rw-r--r--gcc/ada/sem_ch13.ads14
-rw-r--r--gcc/ada/sem_ch3.adb533
-rw-r--r--gcc/ada/sem_ch3.ads12
-rw-r--r--gcc/ada/sem_ch4.adb375
-rw-r--r--gcc/ada/sem_ch4.ads4
-rw-r--r--gcc/ada/sem_ch5.adb68
-rw-r--r--gcc/ada/sem_ch6.adb354
-rw-r--r--gcc/ada/sem_ch7.adb13
-rw-r--r--gcc/ada/sem_ch8.adb380
-rw-r--r--gcc/ada/sem_ch9.adb118
-rw-r--r--gcc/ada/sem_disp.adb67
-rw-r--r--gcc/ada/sem_disp.ads9
-rw-r--r--gcc/ada/sem_dist.adb10
-rw-r--r--gcc/ada/sem_elab.adb41
-rw-r--r--gcc/ada/sem_elim.adb122
-rw-r--r--gcc/ada/sem_eval.adb869
-rw-r--r--gcc/ada/sem_eval.ads3
-rw-r--r--gcc/ada/sem_intr.adb35
-rw-r--r--gcc/ada/sem_mech.adb5
-rw-r--r--gcc/ada/sem_prag.adb356
-rw-r--r--gcc/ada/sem_res.adb574
-rw-r--r--gcc/ada/sem_scil.adb709
-rw-r--r--gcc/ada/sem_scil.ads12
-rw-r--r--gcc/ada/sem_type.adb39
-rw-r--r--gcc/ada/sem_util.adb561
-rw-r--r--gcc/ada/sem_util.ads314
-rw-r--r--gcc/ada/sem_warn.adb256
-rw-r--r--gcc/ada/sem_warn.ads3
-rw-r--r--gcc/ada/sfn_scan.adb13
-rw-r--r--gcc/ada/sinfo.adb113
-rw-r--r--gcc/ada/sinfo.ads233
-rw-r--r--gcc/ada/sinput-c.adb5
-rw-r--r--gcc/ada/snames.ads-tmpl15
-rw-r--r--gcc/ada/socket.c316
-rw-r--r--gcc/ada/sprint.adb64
-rw-r--r--gcc/ada/sprint.ads6
-rw-r--r--gcc/ada/style.adb16
-rw-r--r--gcc/ada/styleg.adb54
-rw-r--r--gcc/ada/switch-b.adb89
-rw-r--r--gcc/ada/switch-c.adb145
-rw-r--r--gcc/ada/switch-c.ads15
-rw-r--r--gcc/ada/switch-m.adb172
-rw-r--r--gcc/ada/switch-m.ads6
-rw-r--r--gcc/ada/sysdep.c28
-rw-r--r--gcc/ada/system-vms-ia64.ads7
-rw-r--r--gcc/ada/system-vms-zcx.ads232
-rw-r--r--gcc/ada/system-vms.ads237
-rw-r--r--gcc/ada/system-vms_64.ads7
-rw-r--r--gcc/ada/tbuild.adb9
-rw-r--r--gcc/ada/tbuild.ads22
-rw-r--r--gcc/ada/tempdir.ads4
-rw-r--r--gcc/ada/tree_io.ads9
-rw-r--r--gcc/ada/treepr.adb19
-rw-r--r--gcc/ada/types.ads98
-rw-r--r--gcc/ada/ug_words1
-rw-r--r--gcc/ada/uintp.adb86
-rw-r--r--gcc/ada/uintp.ads13
-rw-r--r--gcc/ada/usage.adb71
-rw-r--r--gcc/ada/vms_conv.adb12
-rw-r--r--gcc/ada/vms_data.ads277
-rw-r--r--gcc/ada/xr_tabls.adb13
-rw-r--r--gcc/ada/xref_lib.adb34
-rw-r--r--gcc/alias.c50
-rw-r--r--gcc/alloc-pool.c18
-rw-r--r--gcc/auto-inc-dec.c7
-rw-r--r--gcc/basic-block.h14
-rw-r--r--gcc/bitmap.c90
-rw-r--r--gcc/bitmap.h41
-rw-r--r--gcc/bt-load.c3
-rw-r--r--gcc/builtins.c237
-rw-r--r--gcc/c-config-lang.in2
-rw-r--r--gcc/c-convert.c2
-rw-r--r--gcc/c-decl.c37
-rw-r--r--gcc/c-family/ChangeLog162
-rw-r--r--gcc/c-family/c-ada-spec.c (renamed from gcc/c-ada-spec.c)104
-rw-r--r--gcc/c-family/c-ada-spec.h (renamed from gcc/c-ada-spec.h)0
-rw-r--r--gcc/c-family/c-common.c (renamed from gcc/c-common.c)273
-rw-r--r--gcc/c-family/c-common.def (renamed from gcc/c-common.def)0
-rw-r--r--gcc/c-family/c-common.h (renamed from gcc/c-common.h)188
-rw-r--r--gcc/c-family/c-cppbuiltin.c (renamed from gcc/c-cppbuiltin.c)76
-rw-r--r--gcc/c-family/c-dump.c (renamed from gcc/c-dump.c)0
-rw-r--r--gcc/c-family/c-format.c (renamed from gcc/c-format.c)28
-rw-r--r--gcc/c-family/c-format.h (renamed from gcc/c-format.h)0
-rw-r--r--gcc/c-family/c-gimplify.c (renamed from gcc/c-gimplify.c)1
-rw-r--r--gcc/c-family/c-lex.c (renamed from gcc/c-lex.c)0
-rw-r--r--gcc/c-family/c-omp.c (renamed from gcc/c-omp.c)0
-rw-r--r--gcc/c-family/c-opts.c (renamed from gcc/c-opts.c)161
-rw-r--r--gcc/c-family/c-pch.c (renamed from gcc/c-pch.c)0
-rw-r--r--gcc/c-family/c-ppoutput.c (renamed from gcc/c-ppoutput.c)0
-rw-r--r--gcc/c-family/c-pragma.c (renamed from gcc/c-pragma.c)26
-rw-r--r--gcc/c-family/c-pragma.h (renamed from gcc/c-pragma.h)0
-rw-r--r--gcc/c-family/c-pretty-print.c (renamed from gcc/c-pretty-print.c)41
-rw-r--r--gcc/c-family/c-pretty-print.h (renamed from gcc/c-pretty-print.h)1
-rw-r--r--gcc/c-family/c-semantics.c (renamed from gcc/c-semantics.c)0
-rw-r--r--gcc/c-family/c.opt (renamed from gcc/c.opt)85
-rw-r--r--gcc/c-family/stub-objc.c (renamed from gcc/stub-objc.c)0
-rw-r--r--gcc/c-lang.c4
-rw-r--r--gcc/c-lang.h2
-rw-r--r--gcc/c-objc-common.c29
-rw-r--r--gcc/c-parser.c89
-rw-r--r--gcc/c-tree.h7
-rw-r--r--gcc/c-typeck.c159
-rw-r--r--gcc/caller-save.c4
-rw-r--r--gcc/calls.c74
-rw-r--r--gcc/cfg.c10
-rw-r--r--gcc/cfganal.c13
-rw-r--r--gcc/cfgexpand.c33
-rw-r--r--gcc/cfgloop.c14
-rw-r--r--gcc/cfgrtl.c5
-rw-r--r--gcc/cgraph.c16
-rw-r--r--gcc/cgraph.h11
-rw-r--r--gcc/cgraphbuild.c4
-rw-r--r--gcc/cgraphunit.c44
-rw-r--r--gcc/collect2.c11
-rw-r--r--gcc/combine-stack-adj.c2
-rw-r--r--gcc/combine.c30
-rw-r--r--gcc/common.opt30
-rw-r--r--gcc/config.gcc4
-rw-r--r--gcc/config.in6
-rw-r--r--gcc/config/alpha/alpha.c36
-rw-r--r--gcc/config/alpha/alpha.h9
-rw-r--r--gcc/config/arc/arc.h8
-rw-r--r--gcc/config/arm/arm-c.c2
-rw-r--r--gcc/config/arm/arm-cores.def1
-rw-r--r--gcc/config/arm/arm-protos.h2
-rw-r--r--gcc/config/arm/arm-tune.md2
-rw-r--r--gcc/config/arm/arm.c435
-rw-r--r--gcc/config/arm/arm.h147
-rw-r--r--gcc/config/arm/arm.md48
-rw-r--r--gcc/config/arm/constraints.md12
-rw-r--r--gcc/config/arm/thumb2.md164
-rw-r--r--gcc/config/avr/avr-c.c2
-rw-r--r--gcc/config/avr/avr.c3
-rw-r--r--gcc/config/avr/avr.h2
-rw-r--r--gcc/config/bfin/bfin.c11
-rw-r--r--gcc/config/bfin/bfin.h2
-rw-r--r--gcc/config/cris/cris-protos.h2
-rw-r--r--gcc/config/cris/cris.c29
-rw-r--r--gcc/config/cris/cris.h12
-rw-r--r--gcc/config/crx/crx.h2
-rw-r--r--gcc/config/darwin-c.c4
-rw-r--r--gcc/config/darwin-driver.c5
-rw-r--r--gcc/config/darwin-protos.h2
-rw-r--r--gcc/config/darwin.c20
-rw-r--r--gcc/config/darwin.h10
-rw-r--r--gcc/config/fr30/fr30.h35
-rw-r--r--gcc/config/frv/frv-protos.h2
-rw-r--r--gcc/config/frv/frv.c58
-rw-r--r--gcc/config/frv/frv.h81
-rw-r--r--gcc/config/h8300/h8300.c2
-rw-r--r--gcc/config/h8300/h8300.h11
-rw-r--r--gcc/config/i386/atom.md7
-rw-r--r--gcc/config/i386/cygming.h2
-rw-r--r--gcc/config/i386/i386-c.c4
-rw-r--r--gcc/config/i386/i386-protos.h11
-rw-r--r--gcc/config/i386/i386.c431
-rw-r--r--gcc/config/i386/i386.h133
-rw-r--r--gcc/config/i386/i386.md3477
-rw-r--r--gcc/config/i386/msformat-c.c4
-rw-r--r--gcc/config/i386/ppro.md8
-rw-r--r--gcc/config/i386/predicates.md43
-rw-r--r--gcc/config/i386/sol2.h2
-rw-r--r--gcc/config/i386/sse.md421
-rw-r--r--gcc/config/i386/winnt.c4
-rw-r--r--gcc/config/ia64/ia64-c.c4
-rw-r--r--gcc/config/ia64/ia64-protos.h6
-rw-r--r--gcc/config/ia64/ia64.c85
-rw-r--r--gcc/config/ia64/ia64.h36
-rw-r--r--gcc/config/ia64/sysv4.h9
-rw-r--r--gcc/config/ia64/t-ia642
-rw-r--r--gcc/config/ia64/vms.h16
-rw-r--r--gcc/config/iq2000/iq2000-protos.h2
-rw-r--r--gcc/config/iq2000/iq2000.c39
-rw-r--r--gcc/config/iq2000/iq2000.h12
-rw-r--r--gcc/config/lm32/lm32.h2
-rw-r--r--gcc/config/m32c/m32c-pragma.c41
-rw-r--r--gcc/config/m32c/m32c-protos.h3
-rw-r--r--gcc/config/m32c/m32c.c119
-rw-r--r--gcc/config/m32c/m32c.h8
-rw-r--r--gcc/config/m32c/predicates.md10
-rw-r--r--gcc/config/m32r/m32r-protos.h2
-rw-r--r--gcc/config/m32r/m32r.c24
-rw-r--r--gcc/config/m32r/m32r.h26
-rw-r--r--gcc/config/m68hc11/m68hc11-protos.h5
-rw-r--r--gcc/config/m68hc11/m68hc11.c17
-rw-r--r--gcc/config/m68hc11/m68hc11.h22
-rw-r--r--gcc/config/m68k/m68k.c52
-rw-r--r--gcc/config/m68k/m68k.h15
-rw-r--r--gcc/config/mcore/mcore-protos.h2
-rw-r--r--gcc/config/mcore/mcore.c21
-rw-r--r--gcc/config/mcore/mcore.h21
-rw-r--r--gcc/config/mep/mep-pragma.c2
-rw-r--r--gcc/config/mep/mep.c12
-rw-r--r--gcc/config/mep/mep.h2
-rw-r--r--gcc/config/mep/t-mep2
-rw-r--r--gcc/config/mips/crtfastmath.c53
-rw-r--r--gcc/config/mips/linux.h6
-rw-r--r--gcc/config/mips/linux64.h4
-rw-r--r--gcc/config/mips/loongson.md25
-rw-r--r--gcc/config/mips/loongson2ef.md7
-rw-r--r--gcc/config/mips/mips-dsp.md72
-rw-r--r--gcc/config/mips/mips-dspr2.md52
-rw-r--r--gcc/config/mips/mips-protos.h2
-rw-r--r--gcc/config/mips/mips-ps-3d.md24
-rw-r--r--gcc/config/mips/mips.c47
-rw-r--r--gcc/config/mips/mips.h64
-rw-r--r--gcc/config/mips/mips.md405
-rw-r--r--gcc/config/mips/sync.md12
-rw-r--r--gcc/config/mmix/mmix.c2
-rw-r--r--gcc/config/mmix/mmix.h2
-rw-r--r--gcc/config/mn10300/mn10300.h9
-rw-r--r--gcc/config/moxie/moxie-protos.h5
-rw-r--r--gcc/config/moxie/moxie.c29
-rw-r--r--gcc/config/moxie/moxie.h18
-rw-r--r--gcc/config/pa/pa.c38
-rw-r--r--gcc/config/pa/pa.h19
-rw-r--r--gcc/config/pdp11/pdp11.c46
-rw-r--r--gcc/config/pdp11/pdp11.h35
-rw-r--r--gcc/config/picochip/picochip-protos.h4
-rw-r--r--gcc/config/picochip/picochip.c22
-rw-r--r--gcc/config/picochip/picochip.h3
-rw-r--r--gcc/config/rs6000/altivec.h2
-rw-r--r--gcc/config/rs6000/altivec.md84
-rw-r--r--gcc/config/rs6000/constraints.md2
-rw-r--r--gcc/config/rs6000/e500.h9
-rw-r--r--gcc/config/rs6000/linux64.h32
-rw-r--r--gcc/config/rs6000/linux64.opt4
-rw-r--r--gcc/config/rs6000/predicates.md2
-rw-r--r--gcc/config/rs6000/rs6000-builtin.def11
-rw-r--r--gcc/config/rs6000/rs6000-c.c26
-rw-r--r--gcc/config/rs6000/rs6000-protos.h9
-rw-r--r--gcc/config/rs6000/rs6000.c1489
-rw-r--r--gcc/config/rs6000/rs6000.h64
-rw-r--r--gcc/config/rs6000/rs6000.md354
-rw-r--r--gcc/config/rs6000/rs6000.opt12
-rw-r--r--gcc/config/rs6000/t-rs60002
-rw-r--r--gcc/config/rs6000/titan.md171
-rw-r--r--gcc/config/rs6000/vector.md14
-rw-r--r--gcc/config/rs6000/vsx.md20
-rw-r--r--gcc/config/rx/constraints.md7
-rw-r--r--gcc/config/rx/predicates.md4
-rw-r--r--gcc/config/rx/rx-modes.def26
-rw-r--r--gcc/config/rx/rx-protos.h3
-rw-r--r--gcc/config/rx/rx.c366
-rw-r--r--gcc/config/rx/rx.h34
-rw-r--r--gcc/config/rx/rx.md609
-rw-r--r--gcc/config/s390/s390.c8
-rw-r--r--gcc/config/s390/s390.h3
-rw-r--r--gcc/config/s390/s390.md4
-rw-r--r--gcc/config/score/score.h2
-rw-r--r--gcc/config/score/score3.c2
-rw-r--r--gcc/config/score/score7.c2
-rw-r--r--gcc/config/sh/sh-protos.h8
-rw-r--r--gcc/config/sh/sh.c61
-rw-r--r--gcc/config/sh/sh.h25
-rw-r--r--gcc/config/sol2-c.c6
-rw-r--r--gcc/config/sol2.h3
-rw-r--r--gcc/config/sparc/sparc-protos.h2
-rw-r--r--gcc/config/sparc/sparc.c14
-rw-r--r--gcc/config/sparc/sparc.h9
-rw-r--r--gcc/config/spu/spu-c.c4
-rw-r--r--gcc/config/spu/spu-protos.h2
-rw-r--r--gcc/config/spu/spu.c70
-rw-r--r--gcc/config/spu/spu.h53
-rw-r--r--gcc/config/stormy16/stormy16.h2
-rw-r--r--gcc/config/t-darwin2
-rw-r--r--gcc/config/t-sol24
-rw-r--r--gcc/config/v850/t-v8502
-rw-r--r--gcc/config/v850/t-v850e2
-rw-r--r--gcc/config/v850/v850-c.c2
-rw-r--r--gcc/config/v850/v850-protos.h2
-rw-r--r--gcc/config/v850/v850.c42
-rw-r--r--gcc/config/v850/v850.h22
-rw-r--r--gcc/config/vax/vax.c18
-rw-r--r--gcc/config/vax/vax.h12
-rw-r--r--gcc/config/xtensa/xtensa-protos.h6
-rw-r--r--gcc/config/xtensa/xtensa.c8
-rw-r--r--gcc/config/xtensa/xtensa.h3
-rwxr-xr-xgcc/configure45
-rw-r--r--gcc/configure.ac38
-rw-r--r--gcc/convert.c3
-rw-r--r--gcc/coretypes.h17
-rw-r--r--gcc/cp/ChangeLog563
-rw-r--r--gcc/cp/Make-lang.in30
-rw-r--r--gcc/cp/call.c203
-rw-r--r--gcc/cp/class.c513
-rw-r--r--gcc/cp/config-lang.in2
-rw-r--r--gcc/cp/cp-gimplify.c6
-rw-r--r--gcc/cp/cp-lang.c3
-rw-r--r--gcc/cp/cp-objcp-common.c4
-rw-r--r--gcc/cp/cp-objcp-common.h3
-rw-r--r--gcc/cp/cp-tree.def1
-rw-r--r--gcc/cp/cp-tree.h163
-rw-r--r--gcc/cp/cvt.c8
-rw-r--r--gcc/cp/cxx-pretty-print.c20
-rw-r--r--gcc/cp/cxx-pretty-print.h2
-rw-r--r--gcc/cp/decl.c330
-rw-r--r--gcc/cp/decl2.c28
-rw-r--r--gcc/cp/error.c28
-rw-r--r--gcc/cp/except.c206
-rw-r--r--gcc/cp/expr.c4
-rw-r--r--gcc/cp/g++spec.c2
-rw-r--r--gcc/cp/init.c21
-rw-r--r--gcc/cp/lang-specs.h8
-rw-r--r--gcc/cp/lex.c13
-rw-r--r--gcc/cp/method.c779
-rw-r--r--gcc/cp/name-lookup.c50
-rw-r--r--gcc/cp/name-lookup.h2
-rw-r--r--gcc/cp/parser.c153
-rw-r--r--gcc/cp/pt.c187
-rw-r--r--gcc/cp/ptree.c6
-rw-r--r--gcc/cp/repo.c12
-rw-r--r--gcc/cp/rtti.c18
-rw-r--r--gcc/cp/search.c30
-rw-r--r--gcc/cp/semantics.c126
-rw-r--r--gcc/cp/tree.c81
-rw-r--r--gcc/cp/typeck.c225
-rw-r--r--gcc/cp/typeck2.c44
-rw-r--r--gcc/cppspec.c2
-rw-r--r--gcc/cse.c24
-rw-r--r--gcc/cselib.c15
-rw-r--r--gcc/cselib.h2
-rw-r--r--gcc/dbgcnt.def2
-rw-r--r--gcc/dbxout.c6
-rw-r--r--gcc/dce.c43
-rw-r--r--gcc/ddg.c6
-rw-r--r--gcc/debug.c3
-rw-r--r--gcc/debug.h7
-rw-r--r--gcc/defaults.h225
-rw-r--r--gcc/df-core.c257
-rw-r--r--gcc/df-problems.c1046
-rw-r--r--gcc/df-scan.c290
-rw-r--r--gcc/df.h103
-rw-r--r--gcc/diagnostic-core.h5
-rw-r--r--gcc/diagnostic.c91
-rw-r--r--gcc/diagnostic.h29
-rw-r--r--gcc/doc/cpp.texi2
-rw-r--r--gcc/doc/extend.texi70
-rw-r--r--gcc/doc/gcc.texi8
-rw-r--r--gcc/doc/gccint.texi2
-rw-r--r--gcc/doc/gcov.texi10
-rw-r--r--gcc/doc/generic.texi8
-rw-r--r--gcc/doc/gimple.texi42
-rw-r--r--gcc/doc/gty.texi37
-rw-r--r--gcc/doc/include/fdl.texi85
-rw-r--r--gcc/doc/install.texi13
-rw-r--r--gcc/doc/invoke.texi167
-rw-r--r--gcc/doc/md.texi177
-rw-r--r--gcc/doc/plugins.texi6
-rw-r--r--gcc/doc/sourcebuild.texi3
-rw-r--r--gcc/doc/tm.texi218
-rw-r--r--gcc/doc/tm.texi.in11168
-rw-r--r--gcc/double-int.c202
-rw-r--r--gcc/double-int.h64
-rw-r--r--gcc/dse.c8
-rw-r--r--gcc/dse.h2
-rw-r--r--gcc/dwarf2asm.c33
-rw-r--r--gcc/dwarf2asm.h7
-rw-r--r--gcc/dwarf2out.c628
-rw-r--r--gcc/dwarf2out.h7
-rw-r--r--gcc/emit-rtl.c52
-rw-r--r--gcc/emit-rtl.h4
-rw-r--r--gcc/except.c48
-rw-r--r--gcc/except.h63
-rw-r--r--gcc/expmed.c86
-rw-r--r--gcc/expr.c364
-rw-r--r--gcc/expr.h136
-rw-r--r--gcc/final.c31
-rw-r--r--gcc/flags.h23
-rw-r--r--gcc/fold-const.c530
-rw-r--r--gcc/fortran/ChangeLog479
-rw-r--r--gcc/fortran/Make-lang.in2
-rw-r--r--gcc/fortran/array.c2
-rw-r--r--gcc/fortran/check.c166
-rw-r--r--gcc/fortran/cpp.c124
-rw-r--r--gcc/fortran/cpp.h6
-rw-r--r--gcc/fortran/decl.c360
-rw-r--r--gcc/fortran/dependency.c1
-rw-r--r--gcc/fortran/dependency.h1
-rw-r--r--gcc/fortran/dump-parse-tree.c32
-rw-r--r--gcc/fortran/error.c2
-rw-r--r--gcc/fortran/expr.c102
-rw-r--r--gcc/fortran/f95-lang.c10
-rw-r--r--gcc/fortran/gfc-internals.texi4
-rw-r--r--gcc/fortran/gfortran.h57
-rw-r--r--gcc/fortran/gfortran.texi37
-rw-r--r--gcc/fortran/gfortranspec.c33
-rw-r--r--gcc/fortran/interface.c88
-rw-r--r--gcc/fortran/intrinsic.c124
-rw-r--r--gcc/fortran/intrinsic.h8
-rw-r--r--gcc/fortran/intrinsic.texi88
-rw-r--r--gcc/fortran/invoke.texi8
-rw-r--r--gcc/fortran/io.c2
-rw-r--r--gcc/fortran/lang-specs.h2
-rw-r--r--gcc/fortran/lang.opt38
-rw-r--r--gcc/fortran/libgfortran.h19
-rw-r--r--gcc/fortran/match.c150
-rw-r--r--gcc/fortran/match.h2
-rw-r--r--gcc/fortran/mathbuiltins.def17
-rw-r--r--gcc/fortran/module.c14
-rw-r--r--gcc/fortran/openmp.c38
-rw-r--r--gcc/fortran/options.c19
-rw-r--r--gcc/fortran/parse.c120
-rw-r--r--gcc/fortran/parse.h2
-rw-r--r--gcc/fortran/primary.c6
-rw-r--r--gcc/fortran/resolve.c406
-rw-r--r--gcc/fortran/scanner.c39
-rw-r--r--gcc/fortran/simplify.c46
-rw-r--r--gcc/fortran/st.c15
-rw-r--r--gcc/fortran/symbol.c29
-rw-r--r--gcc/fortran/trans-array.c67
-rw-r--r--gcc/fortran/trans-decl.c24
-rw-r--r--gcc/fortran/trans-expr.c98
-rw-r--r--gcc/fortran/trans-intrinsic.c512
-rw-r--r--gcc/fortran/trans-openmp.c52
-rw-r--r--gcc/fortran/trans-stmt.c51
-rw-r--r--gcc/fortran/trans-types.c35
-rw-r--r--gcc/fortran/trans.h15
-rw-r--r--gcc/function.c56
-rw-r--r--gcc/function.h6
-rw-r--r--gcc/fwprop.c4
-rw-r--r--gcc/gcc-plugin.h27
-rw-r--r--gcc/gcc.c722
-rw-r--r--gcc/genattr.c147
-rw-r--r--gcc/genattrtab.c696
-rw-r--r--gcc/genautomata.c219
-rw-r--r--gcc/gencodes.c2
-rw-r--r--gcc/genconditions.c5
-rw-r--r--gcc/genconfig.c2
-rw-r--r--gcc/genconstants.c46
-rw-r--r--gcc/genemit.c15
-rw-r--r--gcc/genenums.c66
-rw-r--r--gcc/genextract.c3
-rw-r--r--gcc/genflags.c3
-rw-r--r--gcc/gengtype.c257
-rw-r--r--gcc/genhooks.c343
-rw-r--r--gcc/genmddeps.c8
-rw-r--r--gcc/genopinit.c2
-rw-r--r--gcc/genoutput.c118
-rw-r--r--gcc/genpeep.c2
-rw-r--r--gcc/genpreds.c101
-rw-r--r--gcc/genrecog.c92
-rw-r--r--gcc/gensupport.c404
-rw-r--r--gcc/gensupport.h15
-rw-r--r--gcc/ggc-common.c38
-rw-r--r--gcc/ggc-internal.h121
-rw-r--r--gcc/ggc-none.c15
-rw-r--r--gcc/ggc-page.c38
-rw-r--r--gcc/ggc-zone.c69
-rw-r--r--gcc/ggc.h292
-rw-r--r--gcc/gimple-fold.c1661
-rw-r--r--gcc/gimple-iterator.c8
-rw-r--r--gcc/gimple-pretty-print.c30
-rw-r--r--gcc/gimple.c126
-rw-r--r--gcc/gimple.h252
-rw-r--r--gcc/gimplify.c170
-rw-r--r--gcc/graphite-clast-to-gimple.c63
-rw-r--r--gcc/graphite-poly.h1
-rw-r--r--gcc/graphite-sese-to-poly.c53
-rw-r--r--gcc/haifa-sched.c28
-rw-r--r--gcc/implicit-zee.c2
-rw-r--r--gcc/integrate.c4
-rw-r--r--gcc/ipa-cp.c37
-rw-r--r--gcc/ipa-inline.c21
-rw-r--r--gcc/ipa-prop.c391
-rw-r--r--gcc/ipa-prop.h21
-rw-r--r--gcc/ipa-pure-const.c502
-rw-r--r--gcc/ipa-ref.c8
-rw-r--r--gcc/ipa-ref.h1
-rw-r--r--gcc/ipa-reference.c330
-rw-r--r--gcc/ipa-split.c1112
-rw-r--r--gcc/ipa-struct-reorg.c29
-rw-r--r--gcc/ipa.c20
-rw-r--r--gcc/ira-build.c256
-rw-r--r--gcc/ira-color.c16
-rw-r--r--gcc/ira-conflicts.c74
-rw-r--r--gcc/ira-costs.c35
-rw-r--r--gcc/ira-emit.c2
-rw-r--r--gcc/ira-int.h102
-rw-r--r--gcc/ira-lives.c373
-rw-r--r--gcc/ira.c53
-rw-r--r--gcc/ira.h3
-rw-r--r--gcc/java/ChangeLog72
-rw-r--r--gcc/java/Make-lang.in4
-rw-r--r--gcc/java/boehm.c49
-rw-r--r--gcc/java/class.c50
-rw-r--r--gcc/java/constants.c9
-rw-r--r--gcc/java/decl.c16
-rw-r--r--gcc/java/except.c34
-rw-r--r--gcc/java/expr.c2
-rw-r--r--gcc/java/gcj.texi4
-rw-r--r--gcc/java/java-tree.h24
-rw-r--r--gcc/java/jcf-parse.c9
-rw-r--r--gcc/java/jcf-reader.c4
-rw-r--r--gcc/java/jcf.h2
-rw-r--r--gcc/java/jvspec.c8
-rw-r--r--gcc/java/lang.c1
-rw-r--r--gcc/lambda-code.c4
-rw-r--r--gcc/lambda.h2
-rw-r--r--gcc/langhooks-def.h4
-rw-r--r--gcc/langhooks.h12
-rw-r--r--gcc/loop-init.c2
-rw-r--r--gcc/loop-iv.c2
-rw-r--r--gcc/loop-unswitch.c2
-rw-r--r--gcc/lto-cgraph.c208
-rw-r--r--gcc/lto-section-in.c6
-rw-r--r--gcc/lto-streamer-in.c128
-rw-r--r--gcc/lto-streamer-out.c95
-rw-r--r--gcc/lto-streamer.c148
-rw-r--r--gcc/lto-streamer.h112
-rw-r--r--gcc/lto-symtab.c39
-rw-r--r--gcc/lto-wrapper.c2
-rw-r--r--gcc/lto/ChangeLog27
-rw-r--r--gcc/lto/lto-coff.c14
-rw-r--r--gcc/lto/lto-lang.c12
-rw-r--r--gcc/lto/lto.c18
-rw-r--r--gcc/matrix-reorg.c80
-rw-r--r--gcc/mkconfig.sh22
-rw-r--r--gcc/objc/ChangeLog23
-rw-r--r--gcc/objc/config-lang.in2
-rw-r--r--gcc/objc/objc-act.c23
-rw-r--r--gcc/objc/objc-act.h3
-rw-r--r--gcc/objc/objc-lang.c2
-rw-r--r--gcc/objcp/ChangeLog19
-rw-r--r--gcc/objcp/Make-lang.in2
-rw-r--r--gcc/objcp/config-lang.in2
-rw-r--r--gcc/objcp/lang-specs.h10
-rw-r--r--gcc/objcp/objcp-decl.h4
-rw-r--r--gcc/objcp/objcp-lang.c3
-rw-r--r--gcc/omp-low.c79
-rw-r--r--gcc/optabs.c29
-rw-r--r--gcc/opth-gen.awk5
-rw-r--r--gcc/opts-common.c229
-rw-r--r--gcc/opts.c275
-rw-r--r--gcc/opts.h48
-rw-r--r--gcc/output.h10
-rw-r--r--gcc/params.def10
-rw-r--r--gcc/passes.c31
-rw-r--r--gcc/po/ChangeLog5
-rw-r--r--gcc/po/EXCLUDES1
-rw-r--r--gcc/po/exgettext2
-rw-r--r--gcc/postreload.c6
-rw-r--r--gcc/predict.c30
-rw-r--r--gcc/predict.h1
-rw-r--r--gcc/pretty-print.c3
-rw-r--r--gcc/print-rtl.c15
-rw-r--r--gcc/read-md.c1139
-rw-r--r--gcc/read-md.h140
-rw-r--r--gcc/read-rtl.c1022
-rw-r--r--gcc/recog.c555
-rw-r--r--gcc/recog.h7
-rw-r--r--gcc/reg-stack.c3
-rw-r--r--gcc/reginfo.c42
-rw-r--r--gcc/regrename.c3
-rw-r--r--gcc/reload.c16
-rw-r--r--gcc/reload.h15
-rw-r--r--gcc/reload1.c688
-rw-r--r--gcc/rtl-error.c3
-rw-r--r--gcc/rtl-error.h24
-rw-r--r--gcc/rtl.c9
-rw-r--r--gcc/rtl.def9
-rw-r--r--gcc/rtl.h30
-rw-r--r--gcc/rtlanal.c2
-rw-r--r--gcc/sched-deps.c5
-rw-r--r--gcc/sdbout.c4
-rw-r--r--gcc/sel-sched-dump.c24
-rw-r--r--gcc/sel-sched-dump.h23
-rw-r--r--gcc/sel-sched.c24
-rw-r--r--gcc/sese.c2
-rw-r--r--gcc/simplify-rtx.c137
-rw-r--r--gcc/stmt.c4
-rw-r--r--gcc/stor-layout.c27
-rw-r--r--gcc/stringpool.c19
-rw-r--r--gcc/system.h30
-rw-r--r--gcc/target-def.h968
-rw-r--r--gcc/target.def2358
-rw-r--r--gcc/target.h1173
-rw-r--r--gcc/targhooks.c174
-rw-r--r--gcc/targhooks.h27
-rw-r--r--gcc/testsuite/ChangeLog1074
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-10.c68
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-11.c12
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-9.c80
-rw-r--r--gcc/testsuite/c-c++-common/pr20000.c32
-rw-r--r--gcc/testsuite/c-c++-common/torture/pr42834.c23
-rw-r--r--gcc/testsuite/c-c++-common/uninit-17.c25
-rw-r--r--gcc/testsuite/c-c++-common/warn-ommitted-condop.c29
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype4.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted10.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted13.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted17.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted18.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted19.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted3.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/explicit5.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit-copy.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit1.C26
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit2.C33
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit3.C56
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit4.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit5.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist15.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist19.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist39.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist40.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist9.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept01.C83
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept02.C52
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept03.C68
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept04.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept05.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept06.C30
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept07.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept08.C56
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/not_special.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr01.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr02.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr03.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr04.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr05.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr06.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr07.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr08.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr09.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr10.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr11.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr12.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr13.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr14.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr15.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr16.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr17.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr18.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr20.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr21.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr22.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv1n.C34
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv1p.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv2n.C110
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv2p.C112
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv3n.C202
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv3p.C224
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv4n.C230
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv4p.C280
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv5n.C170
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv5p.C224
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv6n.C74
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv6p.C112
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv7n.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv7p.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv8p.C4
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C24
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C34
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/typedef3.C19
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/method1.C20
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/parm1.C11
-rw-r--r--gcc/testsuite/g++.dg/eh/new1.C2
-rw-r--r--gcc/testsuite/g++.dg/eh/spec8.C4
-rw-r--r--gcc/testsuite/g++.dg/expr/cond8.C4
-rw-r--r--gcc/testsuite/g++.dg/expr/string-1.C4
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-alias-1.C37
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-alias-2.C37
-rw-r--r--gcc/testsuite/g++.dg/ext/has_virtual_destructor.C6
-rw-r--r--gcc/testsuite/g++.dg/ext/label13.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C24
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr26690-1.C2
-rw-r--r--gcc/testsuite/g++.dg/inherit/virtual5.C29
-rw-r--r--gcc/testsuite/g++.dg/init/ctor4.C4
-rw-r--r--gcc/testsuite/g++.dg/init/new5.C4
-rw-r--r--gcc/testsuite/g++.dg/init/pr44086.C15
-rw-r--r--gcc/testsuite/g++.dg/init/synth2.C4
-rw-r--r--gcc/testsuite/g++.dg/ipa/iinline-2.C61
-rw-r--r--gcc/testsuite/g++.dg/ipa/iinline-3.C64
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118_1.C1
-rw-r--r--gcc/testsuite/g++.dg/lto/20100603-1_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20100603-1_1.c2
-rw-r--r--gcc/testsuite/g++.dg/other/arm-neon-1.C18
-rw-r--r--gcc/testsuite/g++.dg/other/error13.C4
-rw-r--r--gcc/testsuite/g++.dg/other/error20.C2
-rw-r--r--gcc/testsuite/g++.dg/other/error31.C2
-rw-r--r--gcc/testsuite/g++.dg/other/pr25632.C6
-rw-r--r--gcc/testsuite/g++.dg/other/typedef4.C7
-rw-r--r--gcc/testsuite/g++.dg/other/unused1.C2
-rw-r--r--gcc/testsuite/g++.dg/overload/arg3.C3
-rw-r--r--gcc/testsuite/g++.dg/overload/copy1.C3
-rw-r--r--gcc/testsuite/g++.dg/parse/error19.C2
-rw-r--r--gcc/testsuite/g++.dg/plugin/attribute_plugin.c2
-rw-r--r--gcc/testsuite/g++.dg/plugin/dumb_plugin.c3
-rw-r--r--gcc/testsuite/g++.dg/plugin/header_plugin.c4
-rw-r--r--gcc/testsuite/g++.dg/plugin/pragma_plugin.c3
-rw-r--r--gcc/testsuite/g++.dg/plugin/selfassign.c35
-rw-r--r--gcc/testsuite/g++.dg/pr44486.C10
-rw-r--r--gcc/testsuite/g++.dg/tc1/dr147.C10
-rw-r--r--gcc/testsuite/g++.dg/tc1/dr152.C6
-rw-r--r--gcc/testsuite/g++.dg/template/crash100.C24
-rw-r--r--gcc/testsuite/g++.dg/template/error23.C4
-rw-r--r--gcc/testsuite/g++.dg/template/incomplete4.C4
-rw-r--r--gcc/testsuite/g++.dg/template/incomplete5.C4
-rw-r--r--gcc/testsuite/g++.dg/template/qualified-id2.C27
-rw-r--r--gcc/testsuite/g++.dg/template/qualified-id3.C14
-rw-r--r--gcc/testsuite/g++.dg/template/qualttp5.C2
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43801.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43905.C13
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44357.C228
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44492.C31
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44535.C34
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C4
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr31146.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr33604.C12
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-10.C42
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-11.C33
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-12.C36
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-13.C22
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-14.C17
-rw-r--r--gcc/testsuite/g++.dg/warn/incomplete2.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.bob/inherit2.C7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.bugs/900205_04.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/new.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/opeq3.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/ctors17.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/ctors5.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/operators27.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p755.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.oliva/delete1.C3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C1
-rw-r--r--gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C1
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/delete3.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/init19.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/new.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/assign1.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/auto_ptr.C3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash20.C5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash9.C4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20100609-1.c8
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pc44485.c46
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr44686.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr44687.c32
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20100316-1.c24
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/960321-1.x15
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/frame-address.c3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr44468.c60
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr44555.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr44575.c49
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr44683.c18
-rw-r--r--gcc/testsuite/gcc.dg/assign-warn-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/assign-warn-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/c90-const-expr-10.c2
-rw-r--r--gcc/testsuite/gcc.dg/c99-array-lval-8.c6
-rw-r--r--gcc/testsuite/gcc.dg/c99-arraydecl-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/c99-const-expr-10.c2
-rw-r--r--gcc/testsuite/gcc.dg/c99-restrict-4.c17
-rw-r--r--gcc/testsuite/gcc.dg/cast-qual-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/compound-literal-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/line3.c8
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_diag-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/funroll-loops-all.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr44391.c7
-rw-r--r--gcc/testsuite/gcc.dg/init-bad-7.c11
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c32
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modif-1.c41
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pure-const-1.c80
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pure-const-2.c28
-rw-r--r--gcc/testsuite/gcc.dg/lto/20091216-1_0.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/20100603-1_0.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20100603-2_0.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20100603-3_0.c4
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/990416-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr44517.c18
-rw-r--r--gcc/testsuite/gcc.dg/noreturn-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/noreturn-7.c6
-rw-r--r--gcc/testsuite/gcc.dg/opts-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/opts-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/opts-3.c7
-rw-r--r--gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/one_time_plugin.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/selfassign.c35
-rw-r--r--gcc/testsuite/gcc.dg/pr32370.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr36902.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr37561.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr39874.c29
-rw-r--r--gcc/testsuite/gcc.dg/pr41340.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr41551.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr42461.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr44393.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr44404.c35
-rw-r--r--gcc/testsuite/gcc.dg/pr44509.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr44539.c29
-rw-r--r--gcc/testsuite/gcc.dg/pr44674.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr44699.c157
-rw-r--r--gcc/testsuite/gcc.dg/pragma-diag-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/struct/w_prof_global_array.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/w_prof_global_var.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/w_prof_local_array.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/w_prof_local_var.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c2
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr43781.c45
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/stringop-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-split-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-split-2.c41
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-split-3.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-split-4.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ltrans-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ltrans-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ltrans-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ltrans-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ltrans-6.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21086.c9
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr44258.c43
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr44423.c47
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr44483.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp47.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-10.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-11.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-13.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-14.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-15.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-17.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-18.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-19.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-20.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-21.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-22.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-23.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-4.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr44507.c55
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-perm-5.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-perm-6.c3
-rw-r--r--gcc/testsuite/gcc.dg/volatile2.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/eliminate.c19
-rw-r--r--gcc/testsuite/gcc.target/arm/pr40900.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-2.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-3.c18
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-4.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/abi-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/aes-avx-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/aes-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/amd64-abi-3.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vextractf128-256-3.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vextractf128-256-4.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/extract-1.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/extract-2.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/extract-3.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/extract-4.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/extract-5.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/extract-6.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/fma4-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/mmx-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/mod-1.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/pclmul-avx-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/pclmul-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr27971.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr39139.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr39315-check.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr44481.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr44546.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-vec-2a.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/sse3-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_2-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4a-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/ssse3-check.h9
-rw-r--r--gcc/testsuite/gcc.target/i386/umod-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/umod-2.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/umod-3.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/vararg-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/vararg-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/volatile-bitfields-1.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/volatile-bitfields-2.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/xop-check.h9
-rw-r--r--gcc/testsuite/gcc.target/mips/madd-9.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-1.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-2.c21
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-3.c22
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-4.c36
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-5.c94
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-6.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-7.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-test.h149
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-test2.h432
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c11
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c25
-rw-r--r--gcc/testsuite/gfortran.dg/abstract_type_8.f0329
-rw-r--r--gcc/testsuite/gfortran.dg/actual_rank_check_1.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/aliasing_array_result_1.f90164
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_class_1.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_alloc_opt_10.f9046
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_alloc_opt_11.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_alloc_opt_7.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_alloc_opt_8.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_alloc_opt_9.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/array_constructor_23.f4
-rw-r--r--gcc/testsuite/gfortran.dg/array_memcpy_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/array_memcpy_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/associate_1.f0349
-rw-r--r--gcc/testsuite/gfortran.dg/associate_2.f9512
-rw-r--r--gcc/testsuite/gfortran.dg/associate_3.f0341
-rw-r--r--gcc/testsuite/gfortran.dg/associate_4.f0812
-rw-r--r--gcc/testsuite/gfortran.dg/associated_target_4.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/asynchronous_3.f0315
-rw-r--r--gcc/testsuite/gfortran.dg/atan2_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/btest_1.f907
-rw-r--r--gcc/testsuite/gfortran.dg/class_23.f0324
-rw-r--r--gcc/testsuite/gfortran.dg/class_allocate_2.f034
-rw-r--r--gcc/testsuite/gfortran.dg/contiguous_1.f90177
-rw-r--r--gcc/testsuite/gfortran.dg/contiguous_2.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/contiguous_3.f9065
-rw-r--r--gcc/testsuite/gfortran.dg/data_namelist_conflict.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/end_subroutine_1.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/end_subroutine_2.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/endfile_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/endfile_3.f909
-rw-r--r--gcc/testsuite/gfortran.dg/endfile_4.f908
-rw-r--r--gcc/testsuite/gfortran.dg/entry_19.f909
-rw-r--r--gcc/testsuite/gfortran.dg/eof_3.f901
-rw-r--r--gcc/testsuite/gfortran.dg/generic_23.f0367
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr44536.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/sharing-3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/ibclr_1.f907
-rw-r--r--gcc/testsuite/gfortran.dg/ibits_1.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/ibset_1.f907
-rw-r--r--gcc/testsuite/gfortran.dg/import8.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/interface_proc_end.f905
-rw-r--r--gcc/testsuite/gfortran.dg/ltrans-7.f901
-rw-r--r--gcc/testsuite/gfortran.dg/mvbits_9.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/nan_6.f9099
-rw-r--r--gcc/testsuite/gfortran.dg/pr43688.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/pr43866.f9044
-rw-r--r--gcc/testsuite/gfortran.dg/pr44592.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_27.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_28.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/read_infnan_1.f9031
-rw-r--r--gcc/testsuite/gfortran.dg/selected_char_kind_4.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/selected_real_kind_1.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/selected_real_kind_2.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/selected_real_kind_3.f906
-rw-r--r--gcc/testsuite/gfortran.dg/semicolon_fixed.f8
-rw-r--r--gcc/testsuite/gfortran.dg/semicolon_fixed_2.f12
-rw-r--r--gcc/testsuite/gfortran.dg/semicolon_free.f901
-rw-r--r--gcc/testsuite/gfortran.dg/semicolon_free_2.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/type_decl_1.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/type_decl_2.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_14.f0329
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_15.f0325
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_14.f0333
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_15.f0334
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_16.f0358
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_4.f036
-rw-r--r--[-rwxr-xr-x]gcc/testsuite/gfortran.dg/unpack_bounds_1.f900
-rw-r--r--[-rwxr-xr-x]gcc/testsuite/gfortran.dg/unpack_bounds_2.f900
-rw-r--r--[-rwxr-xr-x]gcc/testsuite/gfortran.dg/unpack_bounds_3.f900
-rw-r--r--gcc/testsuite/gfortran.dg/warn_conversion.f901
-rw-r--r--gcc/testsuite/gfortran.dg/warn_conversion_2.f907
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_18.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_20.f0333
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f9015
-rw-r--r--gcc/testsuite/gnat.dg/class_wide2.adb2
-rw-r--r--gcc/testsuite/gnat.dg/noreturn3.adb27
-rw-r--r--gcc/testsuite/gnat.dg/noreturn3.ads12
-rw-r--r--gcc/testsuite/gnat.dg/not_null.adb2
-rw-r--r--gcc/testsuite/lib/lto.exp11
-rw-r--r--gcc/testsuite/lib/target-supports.exp50
-rw-r--r--gcc/timevar.def1
-rw-r--r--gcc/toplev.c116
-rw-r--r--gcc/toplev.h36
-rw-r--r--gcc/tree-affine.c28
-rw-r--r--gcc/tree-browser.c12
-rw-r--r--gcc/tree-cfg.c256
-rw-r--r--gcc/tree-cfgcleanup.c27
-rw-r--r--gcc/tree-chrec.c6
-rw-r--r--gcc/tree-complex.c2
-rw-r--r--gcc/tree-data-ref.c46
-rw-r--r--gcc/tree-dfa.c136
-rw-r--r--gcc/tree-eh.c22
-rw-r--r--gcc/tree-flow-inline.h57
-rw-r--r--gcc/tree-flow.h36
-rw-r--r--gcc/tree-if-conv.c274
-rw-r--r--gcc/tree-inline.c234
-rw-r--r--gcc/tree-into-ssa.c25
-rw-r--r--gcc/tree-iterator.c6
-rw-r--r--gcc/tree-loop-distribution.c36
-rw-r--r--gcc/tree-mudflap.c15
-rw-r--r--gcc/tree-nested.c44
-rw-r--r--gcc/tree-object-size.c51
-rw-r--r--gcc/tree-parloops.c13
-rw-r--r--gcc/tree-pass.h1
-rw-r--r--gcc/tree-phinodes.c2
-rw-r--r--gcc/tree-predcom.c10
-rw-r--r--gcc/tree-pretty-print.c98
-rw-r--r--gcc/tree-profile.c4
-rw-r--r--gcc/tree-scalar-evolution.c45
-rw-r--r--gcc/tree-sra.c190
-rw-r--r--gcc/tree-ssa-alias.c287
-rw-r--r--gcc/tree-ssa-ccp.c216
-rw-r--r--gcc/tree-ssa-copy.c2
-rw-r--r--gcc/tree-ssa-dce.c66
-rw-r--r--gcc/tree-ssa-dom.c118
-rw-r--r--gcc/tree-ssa-forwprop.c327
-rw-r--r--gcc/tree-ssa-ifcombine.c40
-rw-r--r--gcc/tree-ssa-live.h22
-rw-r--r--gcc/tree-ssa-loop-im.c14
-rw-r--r--gcc/tree-ssa-loop-ivopts.c36
-rw-r--r--gcc/tree-ssa-loop-manip.c4
-rw-r--r--gcc/tree-ssa-loop-niter.c15
-rw-r--r--gcc/tree-ssa-loop-prefetch.c49
-rw-r--r--gcc/tree-ssa-loop-unswitch.c130
-rw-r--r--gcc/tree-ssa-loop.c2
-rw-r--r--gcc/tree-ssa-math-opts.c275
-rw-r--r--gcc/tree-ssa-operands.c52
-rw-r--r--gcc/tree-ssa-operands.h2
-rw-r--r--gcc/tree-ssa-phiopt.c21
-rw-r--r--gcc/tree-ssa-phiprop.c7
-rw-r--r--gcc/tree-ssa-pre.c212
-rw-r--r--gcc/tree-ssa-propagate.c13
-rw-r--r--gcc/tree-ssa-propagate.h4
-rw-r--r--gcc/tree-ssa-reassoc.c30
-rw-r--r--gcc/tree-ssa-sccvn.c334
-rw-r--r--gcc/tree-ssa-sccvn.h4
-rw-r--r--gcc/tree-ssa-sink.c5
-rw-r--r--gcc/tree-ssa-structalias.c25
-rw-r--r--gcc/tree-ssa-ter.c18
-rw-r--r--gcc/tree-ssa-threadedge.c15
-rw-r--r--gcc/tree-ssa.c208
-rw-r--r--gcc/tree-ssanames.c2
-rw-r--r--gcc/tree-stdarg.c3
-rw-r--r--gcc/tree-vect-data-refs.c31
-rw-r--r--gcc/tree-vect-loop.c54
-rw-r--r--gcc/tree-vect-patterns.c2
-rw-r--r--gcc/tree-vect-slp.c9
-rw-r--r--gcc/tree-vect-stmts.c56
-rw-r--r--gcc/tree-vectorizer.h73
-rw-r--r--gcc/tree-vrp.c81
-rw-r--r--gcc/tree.c185
-rw-r--r--gcc/tree.def22
-rw-r--r--gcc/tree.h50
-rw-r--r--gcc/var-tracking.c88
-rw-r--r--gcc/varasm.c100
-rw-r--r--gcc/varpool.c4
-rw-r--r--gcc/vec.h3
-rw-r--r--gcc/vmsdbg.h5
-rw-r--r--gcc/vmsdbgout.c269
-rw-r--r--include/ChangeLog42
-rw-r--r--include/dwarf2.h47
-rw-r--r--include/hashtab.h5
-rw-r--r--include/plugin-api.h14
-rw-r--r--include/splay-tree.h15
-rw-r--r--libcpp/ChangeLog38
-rw-r--r--libcpp/config.in4
-rwxr-xr-xlibcpp/configure65
-rw-r--r--libcpp/configure.ac8
-rw-r--r--libcpp/include/cpplib.h14
-rw-r--r--libcpp/include/symtab.h1
-rw-r--r--libcpp/init.c3
-rw-r--r--libcpp/macro.c31
-rw-r--r--libcpp/pch.c10
-rw-r--r--libgcc/ChangeLog6
-rw-r--r--libgcc/config.host4
-rw-r--r--libgcc/config/mips/t-crtfm3
-rw-r--r--libgfortran/ChangeLog114
-rw-r--r--libgfortran/gfortran.map1
-rw-r--r--libgfortran/intrinsics/cpu_time.c8
-rw-r--r--libgfortran/intrinsics/date_and_time.c6
-rw-r--r--libgfortran/intrinsics/random.c10
-rw-r--r--libgfortran/intrinsics/selected_char_kind.c2
-rw-r--r--libgfortran/intrinsics/selected_real_kind.f9057
-rw-r--r--libgfortran/intrinsics/system_clock.c2
-rw-r--r--libgfortran/io/file_pos.c57
-rw-r--r--libgfortran/io/list_read.c31
-rw-r--r--libgfortran/io/read.c60
-rw-r--r--libgfortran/io/transfer.c38
-rwxr-xr-xlibgfortran/mk-kinds-h.sh6
-rwxr-xr-xlibgfortran/mk-srk-inc.sh2
-rw-r--r--libgfortran/runtime/compile_options.c6
-rw-r--r--libgomp/ChangeLog9
-rwxr-xr-xlibgomp/configure6
-rw-r--r--libgomp/libgomp.texi4
-rw-r--r--libiberty/ChangeLog38
-rwxr-xr-xlibiberty/configure22
-rw-r--r--libiberty/configure.ac4
-rw-r--r--libiberty/cp-demangle.c12
-rw-r--r--libiberty/functions.texi39
-rw-r--r--libiberty/hashtab.c67
-rw-r--r--libiberty/libiberty.texi18
-rw-r--r--libiberty/splay-tree.c55
-rw-r--r--libiberty/testsuite/demangle-expected3
-rw-r--r--libjava/ChangeLog19
-rw-r--r--libjava/classpath/ChangeLog9
-rw-r--r--libjava/classpath/ChangeLog.gcj5
-rwxr-xr-xlibjava/classpath/configure30
-rw-r--r--libjava/classpath/doc/Makefile.am2
-rw-r--r--libjava/classpath/doc/Makefile.in2
-rw-r--r--libjava/classpath/scripts/check_jni_methods.sh.in12
-rwxr-xr-xlibjava/configure28
-rw-r--r--libjava/configure.ac2
-rw-r--r--libjava/libtool-version2
-rw-r--r--libmudflap/ChangeLog5
-rwxr-xr-xlibmudflap/configure6
-rw-r--r--libstdc++-v3/ChangeLog1344
-rw-r--r--libstdc++-v3/config/locale/generic/c_locale.cc11
-rw-r--r--libstdc++-v3/config/locale/generic/c_locale.h7
-rw-r--r--libstdc++-v3/config/locale/generic/codecvt_members.cc4
-rw-r--r--libstdc++-v3/config/locale/generic/time_members.cc4
-rw-r--r--libstdc++-v3/config/locale/generic/time_members.h7
-rw-r--r--libstdc++-v3/config/locale/gnu/c_locale.h7
-rw-r--r--libstdc++-v3/config/locale/gnu/codecvt_members.cc4
-rw-r--r--libstdc++-v3/config/locale/gnu/messages_members.cc6
-rw-r--r--libstdc++-v3/config/locale/gnu/messages_members.h4
-rw-r--r--libstdc++-v3/config/locale/gnu/monetary_members.cc4
-rw-r--r--libstdc++-v3/config/locale/gnu/time_members.cc4
-rw-r--r--libstdc++-v3/config/locale/gnu/time_members.h11
-rw-r--r--libstdc++-v3/config/os/djgpp/error_constants.h124
-rwxr-xr-xlibstdc++-v3/configure18
-rw-r--r--libstdc++-v3/configure.host1
-rw-r--r--libstdc++-v3/doc/Makefile.am1
-rw-r--r--libstdc++-v3/doc/Makefile.in1
-rw-r--r--libstdc++-v3/doc/html/api.html2
-rw-r--r--libstdc++-v3/doc/html/faq.html6
-rw-r--r--libstdc++-v3/doc/html/manual/abi.html31
-rw-r--r--libstdc++-v3/doc/html/manual/algorithms.html2
-rw-r--r--libstdc++-v3/doc/html/manual/api.html4
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_contributing.html4
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_free.html2
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_gfdl.html484
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_gpl.html4
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_porting.html2
-rw-r--r--libstdc++-v3/doc/html/manual/atomics.html2
-rw-r--r--libstdc++-v3/doc/html/manual/backwards.html48
-rw-r--r--libstdc++-v3/doc/html/manual/bitmap_allocator.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html4
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt03pr01.html2
-rw-r--r--libstdc++-v3/doc/html/manual/concurrency.html2
-rw-r--r--libstdc++-v3/doc/html/manual/configure.html3
-rw-r--r--libstdc++-v3/doc/html/manual/containers.html2
-rw-r--r--libstdc++-v3/doc/html/manual/diagnostics.html2
-rw-r--r--libstdc++-v3/doc/html/manual/documentation_style.html6
-rw-r--r--libstdc++-v3/doc/html/manual/extensions.html2
-rw-r--r--libstdc++-v3/doc/html/manual/facets.html54
-rw-r--r--libstdc++-v3/doc/html/manual/intro.html2
-rw-r--r--libstdc++-v3/doc/html/manual/io.html2
-rw-r--r--libstdc++-v3/doc/html/manual/iterators.html2
-rw-r--r--libstdc++-v3/doc/html/manual/license.html2
-rw-r--r--libstdc++-v3/doc/html/manual/localization.html16
-rw-r--r--libstdc++-v3/doc/html/manual/memory.html42
-rw-r--r--libstdc++-v3/doc/html/manual/numerics.html2
-rw-r--r--libstdc++-v3/doc/html/manual/parallel_mode.html4
-rw-r--r--libstdc++-v3/doc/html/manual/profile_mode.html2
-rw-r--r--libstdc++-v3/doc/html/manual/setup.html10
-rw-r--r--libstdc++-v3/doc/html/manual/source_code_style.html394
-rw-r--r--libstdc++-v3/doc/html/manual/spine.html4
-rw-r--r--libstdc++-v3/doc/html/manual/status.html14
-rw-r--r--libstdc++-v3/doc/html/manual/strings.html2
-rw-r--r--libstdc++-v3/doc/html/manual/support.html2
-rw-r--r--libstdc++-v3/doc/html/manual/test.html2
-rw-r--r--libstdc++-v3/doc/html/manual/using.html2
-rw-r--r--libstdc++-v3/doc/html/manual/using_exceptions.html16
-rw-r--r--libstdc++-v3/doc/html/manual/using_headers.html12
-rw-r--r--libstdc++-v3/doc/html/manual/utilities.html2
-rw-r--r--libstdc++-v3/doc/xml/faq.xml2
-rw-r--r--libstdc++-v3/doc/xml/gnu/fdl-1.3.xml560
-rw-r--r--libstdc++-v3/doc/xml/manual/abi.xml25
-rw-r--r--libstdc++-v3/doc/xml/manual/appendix_contributing.xml396
-rw-r--r--libstdc++-v3/doc/xml/manual/intro.xml4
-rw-r--r--libstdc++-v3/doc/xml/manual/spine.xml2
-rw-r--r--libstdc++-v3/doc/xml/manual/status_cxx200x.xml9
-rw-r--r--libstdc++-v3/include/Makefile.am9
-rw-r--r--libstdc++-v3/include/Makefile.in9
-rw-r--r--libstdc++-v3/include/backward/hash_fun.h2
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc4
-rw-r--r--libstdc++-v3/include/bits/boost_concept_check.h5
-rw-r--r--libstdc++-v3/include/bits/c++config17
-rw-r--r--libstdc++-v3/include/bits/deque.tcc56
-rw-r--r--libstdc++-v3/include/bits/forward_list.h12
-rw-r--r--libstdc++-v3/include/bits/forward_list.tcc31
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc16
-rw-r--r--libstdc++-v3/include/bits/functional_hash.h2
-rw-r--r--libstdc++-v3/include/bits/list.tcc51
-rw-r--r--libstdc++-v3/include/bits/locale_facets.h20
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc4
-rw-r--r--libstdc++-v3/include/bits/locale_facets_nonio.h47
-rw-r--r--libstdc++-v3/include/bits/locale_facets_nonio.tcc2
-rw-r--r--libstdc++-v3/include/bits/move.h1
-rw-r--r--libstdc++-v3/include/bits/random.tcc68
-rw-r--r--libstdc++-v3/include/bits/regex.h2428
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.h1115
-rw-r--r--libstdc++-v3/include/bits/regex_constants.h299
-rw-r--r--libstdc++-v3/include/bits/regex_cursor.h92
-rw-r--r--libstdc++-v3/include/bits/regex_error.h160
-rw-r--r--libstdc++-v3/include/bits/regex_grep_matcher.h131
-rw-r--r--libstdc++-v3/include/bits/regex_grep_matcher.tcc177
-rw-r--r--libstdc++-v3/include/bits/regex_nfa.h403
-rw-r--r--libstdc++-v3/include/bits/regex_nfa.tcc170
-rw-r--r--libstdc++-v3/include/bits/shared_ptr.h53
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_base.h41
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h5
-rw-r--r--libstdc++-v3/include/bits/stl_construct.h14
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h104
-rw-r--r--libstdc++-v3/include/bits/stl_iterator_base_types.h1
-rw-r--r--libstdc++-v3/include/bits/stl_list.h69
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h8
-rw-r--r--libstdc++-v3/include/bits/stl_tempbuf.h69
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h4
-rw-r--r--libstdc++-v3/include/bits/stl_uninitialized.h271
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h97
-rw-r--r--libstdc++-v3/include/bits/unique_ptr.h41
-rw-r--r--libstdc++-v3/include/bits/unordered_map.h14
-rw-r--r--libstdc++-v3/include/bits/unordered_set.h14
-rw-r--r--libstdc++-v3/include/bits/valarray_array.h14
-rw-r--r--libstdc++-v3/include/bits/vector.tcc53
-rw-r--r--libstdc++-v3/include/c_global/cstddef12
-rw-r--r--libstdc++-v3/include/c_global/cstdio7
-rw-r--r--libstdc++-v3/include/c_global/cstdlib1
-rw-r--r--libstdc++-v3/include/c_global/cstring1
-rw-r--r--libstdc++-v3/include/c_global/ctime2
-rw-r--r--libstdc++-v3/include/c_global/cwchar1
-rw-r--r--libstdc++-v3/include/c_global/cwctype8
-rw-r--r--libstdc++-v3/include/c_std/cstddef7
-rw-r--r--libstdc++-v3/include/c_std/cstdio8
-rw-r--r--libstdc++-v3/include/c_std/cstdlib1
-rw-r--r--libstdc++-v3/include/c_std/cstring1
-rw-r--r--libstdc++-v3/include/c_std/ctime2
-rw-r--r--libstdc++-v3/include/c_std/cwchar1
-rw-r--r--libstdc++-v3/include/c_std/cwctype8
-rw-r--r--libstdc++-v3/include/debug/deque52
-rw-r--r--libstdc++-v3/include/debug/formatter.h20
-rw-r--r--libstdc++-v3/include/debug/functions.h3
-rw-r--r--libstdc++-v3/include/debug/list76
-rw-r--r--libstdc++-v3/include/debug/vector44
-rw-r--r--libstdc++-v3/include/ext/algorithm4
-rw-r--r--libstdc++-v3/include/ext/array_allocator.h6
-rw-r--r--libstdc++-v3/include/ext/bitmap_allocator.h3
-rw-r--r--libstdc++-v3/include/ext/codecvt_specializations.h7
-rw-r--r--libstdc++-v3/include/ext/functional3
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h14
-rw-r--r--libstdc++-v3/include/ext/new_allocator.h1
-rw-r--r--libstdc++-v3/include/ext/pb_ds/assoc_container.hpp1
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp20
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp32
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp18
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp22
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp42
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp36
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp52
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp28
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp18
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp18
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp24
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp24
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp24
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp54
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp26
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp20
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp22
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp28
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp30
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp26
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp18
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp5
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp22
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp18
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp32
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp70
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/exception.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/hash_policy.hpp21
-rw-r--r--libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp9
-rw-r--r--libstdc++-v3/include/ext/pb_ds/priority_queue.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp3
-rw-r--r--libstdc++-v3/include/ext/pb_ds/tree_policy.hpp3
-rw-r--r--libstdc++-v3/include/ext/pb_ds/trie_policy.hpp3
-rw-r--r--libstdc++-v3/include/ext/pointer.h4
-rw-r--r--libstdc++-v3/include/ext/rc_string_base.h2
-rw-r--r--libstdc++-v3/include/ext/sso_string_base.h2
-rw-r--r--libstdc++-v3/include/ext/string_conversions.h4
-rw-r--r--libstdc++-v3/include/ext/throw_allocator.h2
-rw-r--r--libstdc++-v3/include/parallel/base.h16
-rw-r--r--libstdc++-v3/include/parallel/basic_iterator.h3
-rw-r--r--libstdc++-v3/include/parallel/find.h18
-rw-r--r--libstdc++-v3/include/parallel/multiseq_selection.h10
-rw-r--r--libstdc++-v3/include/parallel/multiway_merge.h4
-rw-r--r--libstdc++-v3/include/parallel/multiway_mergesort.h2
-rw-r--r--libstdc++-v3/include/parallel/partial_sum.h9
-rw-r--r--libstdc++-v3/include/parallel/partition.h2
-rw-r--r--libstdc++-v3/include/parallel/set_operations.h6
-rw-r--r--libstdc++-v3/include/parallel/settings.h6
-rw-r--r--libstdc++-v3/include/profile/base.h2
-rw-r--r--libstdc++-v3/include/profile/deque32
-rw-r--r--libstdc++-v3/include/profile/impl/profiler.h53
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_container_size.h366
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_hash_func.h260
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_hashtable_size.h97
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_list_to_slist.h285
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_list_to_vector.h518
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_map_to_unordered_map.h435
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_node.h215
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_state.h43
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_trace.h1073
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_vector_size.h94
-rw-r--r--libstdc++-v3/include/profile/impl/profiler_vector_to_list.h564
-rw-r--r--libstdc++-v3/include/profile/iterator_tracker.h465
-rw-r--r--libstdc++-v3/include/profile/list36
-rw-r--r--libstdc++-v3/include/profile/map.h30
-rw-r--r--libstdc++-v3/include/profile/vector44
-rw-r--r--libstdc++-v3/include/std/atomic2
-rw-r--r--libstdc++-v3/include/std/bitset1
-rw-r--r--libstdc++-v3/include/std/fstream6
-rw-r--r--libstdc++-v3/include/std/functional21
-rw-r--r--libstdc++-v3/include/std/iterator3
-rw-r--r--libstdc++-v3/include/std/mutex1
-rw-r--r--libstdc++-v3/include/std/regex35
-rw-r--r--libstdc++-v3/include/std/thread1
-rw-r--r--libstdc++-v3/include/std/tuple19
-rw-r--r--libstdc++-v3/include/std/type_traits36
-rw-r--r--libstdc++-v3/include/std/valarray3
-rw-r--r--libstdc++-v3/include/tr1/type_traits5
-rw-r--r--libstdc++-v3/libsupc++/eh_arm.cc12
-rw-r--r--libstdc++-v3/libsupc++/eh_ptr.cc9
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h27
-rw-r--r--libstdc++-v3/libsupc++/initializer_list4
-rw-r--r--libstdc++-v3/libsupc++/new2
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py9
-rw-r--r--libstdc++-v3/src/chrono.cc4
-rw-r--r--libstdc++-v3/src/compatibility.cc6
-rw-r--r--libstdc++-v3/src/condition_variable.cc4
-rw-r--r--libstdc++-v3/src/localename.cc2
-rw-r--r--libstdc++-v3/src/mt_allocator.cc36
-rw-r--r--libstdc++-v3/src/thread.cc4
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c16
-rw-r--r--libstdc++-v3/testsuite/18_support/exception/38732.cc9
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc2
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/requirements.cc60
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/requirements_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/18_support/new_delete_placement.cc4
-rw-r--r--libstdc++-v3/testsuite/18_support/pthread_guard.cc8
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc8
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc5
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc5
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc5
-rw-r--r--libstdc++-v3/testsuite/20_util/clocks/1.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc1
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc1
-rw-r--r--libstdc++-v3/testsuite/20_util/function/cmp/cmp_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/explicit_instantiation.cc30
-rw-r--r--libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/value.cc57
-rw-r--r--libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/explicit_instantiation.cc30
-rw-r--r--libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc57
-rw-r--r--libstdc++-v3/testsuite/20_util/headers/type_traits/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/explicit_instantiation.cc31
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc78
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/20_util/pair/44487.cc51
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc1
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc6
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/nullptr.cc93
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/hash/1.cc48
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/cons/44487.cc51
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc18
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/assign/nullptr.cc54
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/cons/nullptr.cc52
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/cons/pointer_array_convertible.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/hash/1.cc48
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc10
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc4
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc4
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/operations/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/operations/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc10
-rw-r--r--libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc5
-rw-r--r--libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc6
-rw-r--r--libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc5
-rw-r--r--libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc5
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc7
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc7
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype_base/mask.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc6
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc6
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/2.cc9
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/29217.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/14071.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc6
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc15
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/12971.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc13
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc11
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc15
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/12971.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc13
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc11
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc5
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/char/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/char/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/char/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/5.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc12
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc12
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc12
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc13
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc11
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc11
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc11
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc11
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc15
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc4
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc15
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc16
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc17
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc14
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc13
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc13
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc14
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/capacity/resize_size.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/cons/cons_size.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc (renamed from libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc)19
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc (renamed from libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc)19
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/23781.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/pthread1.cc16
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/pthread5.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/23781.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/dr130.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/pthread6.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/23781.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/23781.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/23781.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/dr130.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc (renamed from libstdc++-v3/testsuite/23_containers/vector/resize/1.cc)0
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc (renamed from libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc)37
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc4
-rw-r--r--libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc3
-rw-r--r--libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc4
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc4
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/minmax/3.cc5
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/complex_value.cc16
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc4
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc3
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc3
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc10
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/12790-3.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-2.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-3.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-4.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/12790-4.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/12875-2.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/2-io.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-2.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc10
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/cons/3.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc13
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc12
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc7
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/1.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/1.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/read/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/8348-2.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/8348.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc7
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/ws/wchar_t/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/cons/2020.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/sentry/pod/1.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/wchar_t/1.cc14
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc14
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/wchar_t/1.cc14
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/wchar_t/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc7
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc7
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/wchar_t/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc27
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/wchar_t/1.cc27
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/wchar_t/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/wchar_t/1057.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc35
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/wchar_t/1.cc35
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/mbstate_t/2.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc3
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/mbstate_t/5.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/10.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5268.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/9.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/types/2.cc3
-rw-r--r--libstdc++-v3/testsuite/28_regex/03_requirements/typedefs.cc38
-rw-r--r--libstdc++-v3/testsuite/28_regex/04_header/regex/std_c++0x_neg.cc23
-rw-r--r--libstdc++-v3/testsuite/28_regex/05_constants/error_type.cc54
-rw-r--r--libstdc++-v3/testsuite/28_regex/05_constants/match_flag_type.cc53
-rw-r--r--libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc51
-rw-r--r--libstdc++-v3/testsuite/28_regex/06_exception_type/regex_error.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/ctor.cc50
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/isctype.cc48
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/length.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_classname.cc54
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_collatename.cc50
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/transform.cc51
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/transform_primary.cc55
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/translate.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/translate_nocase.cc46
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/char/value.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/ctor.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/length.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/transform.cc51
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate_nocase.cc46
-rw-r--r--libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/value.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring_op.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/moveable.cc50
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/pstring.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/range.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string_op.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring_op.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/pstring.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/range.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string.cc45
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string_op.cc45
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/cstring.cc37
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_char.cc42
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_wchar_t.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/string_range_01_02_03.cc52
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring.cc42
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_awk.cc37
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_ecma.cc37
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_egrep.cc37
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_grep.cc39
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/default.cc47
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/range.cc42
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/copy_char.cc45
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/cstring.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/string_range_01_02_03.cc52
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/move_char.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_char.cc54
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_wchar_t.cc56
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/cstring.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/default.cc48
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/range.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/08_basic_regex/regex.cc37
-rw-r--r--libstdc++-v3/testsuite/28_regex/09_sub_match/cast_char.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/09_sub_match/cast_wchar_t.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/09_sub_match/length.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/09_sub_match/typedefs.cc38
-rw-r--r--libstdc++-v3/testsuite/28_regex/10_match_results/ctors/char/default.cc52
-rw-r--r--libstdc++-v3/testsuite/28_regex/10_match_results/ctors/wchar_t/default.cc52
-rw-r--r--libstdc++-v3/testsuite/28_regex/10_match_results/typedefs.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_01.cc63
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_00_03.cc60
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_01_03.cc60
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_02_03.cc61
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_plus.cc65
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_questionmark.cc65
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_any.cc60
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_00_03.cc60
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_01_03.cc60
-rw-r--r--libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_02_03.cc61
-rw-r--r--libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/char/default.cc35
-rw-r--r--libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t/default.cc35
-rw-r--r--libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/typedefs.cc40
-rw-r--r--libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char/default.cc35
-rw-r--r--libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t/default.cc35
-rw-r--r--libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/typedefs.cc40
-rw-r--r--libstdc++-v3/testsuite/28_regex/headers/regex/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc19
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc19
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc5
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc4
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc4
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc13
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc13
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/future/cons/assign_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/future/cons/copy_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/headers/future/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/headers/mutex/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/headers/thread/std_c++0x_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/cons/copy_neg.cc12
-rw-r--r--libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc7
-rw-r--r--libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc11
-rw-r--r--libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc6
-rw-r--r--libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc1
-rw-r--r--libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc1
-rw-r--r--libstdc++-v3/testsuite/ext/rope/44708.cc31
-rw-r--r--libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc6
-rw-r--r--libstdc++-v3/testsuite/ext/slist/23781.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/stdio_filebuf/char/10063-2.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/1.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc1
-rw-r--r--libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc1
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp6
-rw-r--r--libstdc++-v3/testsuite/lib/prune.exp31
-rw-r--r--libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/shared_ptr_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc2
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc8
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc6
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc9
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc4
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc3
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc10
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc14
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc3
-rw-r--r--libstdc++-v3/testsuite/util/exception/safety.h2
-rw-r--r--libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc52
-rw-r--r--libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp4
-rw-r--r--libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc18
-rw-r--r--libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp4
-rw-r--r--libstdc++-v3/testsuite/util/replacement_memory_operators.h6
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_abi.h4
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_allocator.h11
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_api.h24
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_common_types.h5
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_hooks.cc7
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_hooks.h5
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_io.h38
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_iterators.h26
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_performance.h20
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_tr1.h34
-rw-r--r--maintainer-scripts/ChangeLog5
-rwxr-xr-xmaintainer-scripts/update_web_docs_svn10
2258 files changed, 117312 insertions, 48635 deletions
diff --git a/ChangeLog b/ChangeLog
index e0410e9ecc0..44d4510ee28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,21 @@
-2010-05-25 Sterling Augustine <sterling@tensilica.com>
+2010-06-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * Makefile.def (configure-gcc): Depend on all-libelf.
+ * Makefile.in: Rebuild.
+
+2010-06-05 Fabien Chêne <fabien@gcc.gnu.org>
+
+ * MAINTAINERS (Write After Approval): Add myself in the right place.
+
+2010-06-04 Fabien Chêne <fabien@gcc.gnu.org>
+
+ * MAINTAINERS (Write After Approval): Add myself.
+
+2010-05-25 Sterling Augustine <sterling@tensilica.com>
* MAINTAINERS (CPU Port Maintainers): Add myself for xtensa port.
-
- 2010-05-25 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+2010-05-25 Maxim Kuvyrkov <maxim@codesourcery.com>
* config.sub: Update to version 2010-05-21.
* config.guess: Update to version 2010-04-03.
@@ -138,7 +151,7 @@
* config.sub: Update to version 2010-03-22.
* config.guess: Update to version 2009-12-30.
-2010-03-19 Jack Howarth <howarth@bromo.med.uc.edu>
+2010-03-19 Jack Howarth <howarth@bromo.med.uc.edu>
PR ada/42554
* configure.ac: Only pass -c to ranlib for darwin9 and earlier.
@@ -191,7 +204,7 @@
(RANLIB_FOR_TARGET): Remove superfluous : argument.
* configure: Regenerate.
-2010-02-17 Rafael Ãvila de Espíndola <espindola@google.com>
+2010-02-17 Rafael Ãvila de Espíndola <espindola@google.com>
* MAINTAINERS (Plugin, LTO, LTO plugin): Remove myself.
(Write After Approval): Update my email address.
@@ -412,7 +425,7 @@
* MAINTAINERS (Write After Approval): Add myself.
-2009-11-09 Jon Beniston <jon@beniston.com>
+2009-11-09 Jon Beniston <jon@beniston.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -422,7 +435,7 @@
paths for *-w64-mingw* and x86_64-*mingw*.
* configure: Regenerated.
-2009-11-05 Joern Rennecke <amylaar@spamcop.net>
+2009-11-05 Joern Rennecke <amylaar@spamcop.net>
* MAINTAINERS (Write After Approval): Add entry for my INRIA work.
@@ -441,7 +454,7 @@
* MAINTAINERS: Add myself as a maintainer for the RX port.
-2009-10-26 Johannes Singler <singler@kit.edu>
+2009-10-26 Johannes Singler <singler@kit.edu>
* MAINTAINERS (Write After Approval): Update my e-mail address.
@@ -476,7 +489,7 @@
COPYING.
Refer to http://gcc.gnu.org/bugs/ for bug reporting instructions.
-2009-10-07 Rafael Avila de Espindola <espindola@google.com>
+2009-10-07 Rafael Avila de Espindola <espindola@google.com>
* MAINTAINERS: Change my email address. Change plugi-in to plugin.
@@ -528,14 +541,14 @@
pass --with-system-zlib to subdir configure scripts.
* configure: Regenerate.
-2009-10-01 Loren J. Rittle <ljrittle@acm.org>
+2009-10-01 Loren J. Rittle <ljrittle@acm.org>
Paolo Bonzini <bonzini@gnu.org>
* Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Use $$s rather than
$(srcdir).
* Makefile.in: Rebuilt.
-2009-09-26 Gary Funck <gary@intrepid.com>
+2009-09-26 Gary Funck <gary@intrepid.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -554,7 +567,7 @@
* config.sub, config.guess: Update from upstream sources.
-2009-09-22 Loren J. Rittle <ljrittle@acm.org>
+2009-09-22 Loren J. Rittle <ljrittle@acm.org>
* Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Remove stray $$r/.
* Makefile.in: Rebuilt.
@@ -590,7 +603,7 @@
* configure.ac: Disable java and boehm-gc for bfin-*-*.
* configure: Regenerate.
-2009-09-12 Joern Rennecke <joern.rennecke@embecosm.com>
+2009-09-12 Joern Rennecke <joern.rennecke@embecosm.com>
* MAINTAINERS (Write After Approval): Update my e-mail address,
and move from from here...
@@ -722,7 +735,7 @@
* MAINTAINERS: Add my name to Write After Approval list.
-2009-08-06 Michael Eager <eager@eagercon.com>
+2009-08-06 Michael Eager <eager@eagercon.com>
* configure.ac: Add Microblaze target.
* configure: Regenerate.
@@ -732,7 +745,7 @@
* configure.ac (sh*-*-elf): Don't add target-libgloss to noconfigdirs.
* configure: Regenerate.
-2009-07-28 Rask Ingemann Lambertsen <ccc94453@vip.cybercity.dk>
+2009-07-28 Rask Ingemann Lambertsen <ccc94453@vip.cybercity.dk>
* MAINTAINERS (Write After Approval): Update my e-mail address.
@@ -994,7 +1007,7 @@
* Makefile.tpl (check-gcc-*): New generic target.
* Makefile.in: Regenerate.
-2009-03-25 Erven Rohou <erven.rohou@inria.fr>
+2009-03-25 Erven Rohou <erven.rohou@inria.fr>
* MAINTAINERS: Update my email address.
@@ -1016,7 +1029,7 @@
* configure.ac (--with-host-libstdcxx): New option.
* configure: Regenerate.
-2009-03-12 Joern Rennecke <joern.rennecke@arc.com>
+2009-03-12 Joern Rennecke <joern.rennecke@arc.com>
* MAINTAINERS: Move myself into the write after approval list.
@@ -1028,7 +1041,7 @@
* MAINTAINERS: Remove myself as auto-vectorizer maintainer.
-2009-03-10 Ira Rosen <irar@il.ibm.com>
+2009-03-10 Ira Rosen <irar@il.ibm.com>
* MAINTAINERS: Add myself as auto-vectorizer maintainer.
@@ -1094,7 +1107,7 @@
* MAINTAINERS: Add myself to reviewers (Fortran).
-2009-01-12 Sebastian Pop <sebastian.pop@amd.com>
+2009-01-12 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/38515
* configure.ac (cloog-polylib): Removed.
@@ -1134,7 +1147,7 @@
* config.sub, config.guess: Update from upstream sources.
-2008-12-12 Sebastian Pop <sebastian.pop@amd.com>
+2008-12-12 Sebastian Pop <sebastian.pop@amd.com>
* configure.ac (ppllibs): Add by default the lib flags.
* configure: Regenerate.
@@ -1184,11 +1197,11 @@
* MAINTAINERS: Update my email address in WAA section.
-2008-11-29 Chen Liqin <liqin@sunnorth.com.cn>
+2008-11-29 Chen Liqin <liqin@sunnorth.com.cn>
* MAINTAINERS: Update e-mail address.
-2008-11-27 Toon Moene <toon@moene.org>
+2008-11-27 Toon Moene <toon@moene.org>
* MAINTAINERS: Change e-mail address.
@@ -1197,7 +1210,7 @@
* configure.ac: Build gdb for i?86-*-darwin*
* configure: Regenerated.
-2008-11-24 Hariharan Sandanagobalane <hariharan@picochip.com>
+2008-11-24 Hariharan Sandanagobalane <hariharan@picochip.com>
* MAINTAINERS: Added my full name.
@@ -1231,7 +1244,7 @@
* configure.ac: Set CPPFLAGS_FOR_TARGET, LDFLAGS_FOR_TARGET,
and CPPFLAGS_FOR_BUILD.
-2008-11-06 Jeff Law <law@redhat.com>
+2008-11-06 Jeff Law <law@redhat.com>
* MAINTAINERS: Add myself as middle end maintainer.
@@ -1303,7 +1316,7 @@
* configure.ac: Set CPPFLAGS_FOR_TARGET, LDFLAGS_FOR_TARGET,
and CPPFLAGS_FOR_BUILD.
-2008-10-20 Sebastian Pop <sebastian.pop@amd.com>
+2008-10-20 Sebastian Pop <sebastian.pop@amd.com>
* MAINTAINERS (Graphite Reviewers): Added Daniel Berlin and
Sebastian Pop.
@@ -1453,7 +1466,7 @@
* configure.ac (mips*-*-*linux*, mips*-*-gnu*): Use mt-mips-gnu.
* configure: Regenerate.
-2008-07-30 Paolo Bonzini <bonzini@gnu.org>
+2008-07-30 Paolo Bonzini <bonzini@gnu.org>
* configure.ac: Add makefile fragments for hpux.
* Makefile.def (flags_to_pass): Add ADA_CFLAGS.
@@ -1461,11 +1474,11 @@
* configure: Regenerate.
* Makefile.in: Regenerate.
-2008-07-28 Aldy Hernandez <aldyh@redhat.com>
+2008-07-28 Aldy Hernandez <aldyh@redhat.com>
* MAINTAINERS: Add Jakub and myself as gimple maintainers.
-2008-07-11 Dodji Seketeli <dseketel@redhat.com>
+2008-07-11 Dodji Seketeli <dseketel@redhat.com>
* MAINTAINERS (Write after Approval): Add myself.
@@ -1532,11 +1545,11 @@
of libobjc for ARM EABI Linux.
* configure: Regenerate.
-2008-05-18 Xinliang David Li <davidxl@google.com>
+2008-05-18 Xinliang David Li <davidxl@google.com>
* ChangeLog: Remove wrong ChangeLog entry.
-2008-05-17 Xinliang David Li <davidxl@google.com>
+2008-05-17 Xinliang David Li <davidxl@google.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -1564,7 +1577,7 @@
* MAINTAINERS (Write After Approval): Add myself.
-2008-04-25 Pompapathi V Gadad <Pompapathi.V.Gadad@nsc.com>
+2008-04-25 Pompapathi V Gadad <Pompapathi.V.Gadad@nsc.com>
* MAINTAINERS (crx): Add myself.
@@ -1587,7 +1600,7 @@
* Makefile.tpl (restrap): Call `make all' using double-colon rules.
* Makefile.in: Regenerate.
-2008-04-18 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
+2008-04-18 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* configure.ac (cr16-*-*): Add case for cr16 target and include gdb
as nonconfigurable directories list.
@@ -1633,7 +1646,7 @@
* MAINTAINERS (Write After Approval): Add myself.
-2008-04-01 Seongbae Park <seongbae.park@gmail.com>
+2008-04-01 Seongbae Park <seongbae.park@gmail.com>
* Makefile.tpl (.NOTPARALLEL): Revert previous change.
* Makefile.in (.NOTPARALLEL): Ditto.
@@ -1642,7 +1655,7 @@
* MAINTAINERS (Write After Approval): Add myself.
-2008-03-31 Seongbae Park <seongbae.park@gmail.com>
+2008-03-31 Seongbae Park <seongbae.park@gmail.com>
* Makefile.tpl (.NOTPARALLEL): Serialize stageprofile libiberty.
* Makefile.in (.NOTPARALLEL): Regenerate.
@@ -1830,7 +1843,7 @@
(CXXFLAGS_FOR_TARGET): Add -O2 -g.
* Makefile.in: Regenerate.
-2007-12-10 Mark Heffernan <meheff@google.com>
+2007-12-10 Mark Heffernan <meheff@google.com>
* MAINTAINERS (Write After Approval): Add myself and alphabetize two
misplaced entries.
@@ -1840,7 +1853,7 @@
* configure.ac: Enable libjava for x86_64-*-darwin9.
* configure: Regenerate.
-2007-12-07 Bill Maddox <maddox@google.com>
+2007-12-07 Bill Maddox <maddox@google.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -1872,7 +1885,7 @@
* MAINTAINERS (Write After Approval): Add myself.
-2007-11-06 Doug Kwan <dougkwan@google.com>
+2007-11-06 Doug Kwan <dougkwan@google.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -1891,7 +1904,7 @@
* MAINTAINERS (Fortran maintainer): Remove myself.
-2007-10-15 Patrick Mansfield <patmans@us.ibm.com>
+2007-10-15 Patrick Mansfield <patmans@us.ibm.com>
* Makefile.def: To avoid problems running with parallel makes,
build newlib before libgloss so that target specific header
@@ -1915,7 +1928,7 @@
LDFLAGS_FOR_BUILD to LDFLAGS, not CFLAGS.
* configure: Regenerate.
-2006-10-04 Seongbae Park <seongbae.park@gmail.com>
+2006-10-04 Seongbae Park <seongbae.park@gmail.com>
* MAINTAINERS (Register allocation reviewer): Add myself.
@@ -1931,11 +1944,11 @@
* configure: Regenerate.
* Makefile.in: Regenerate.
-2006-09-24 Peter Bergner <bergner@vnet.ibm.com>
+2006-09-24 Peter Bergner <bergner@vnet.ibm.com>
* MAINTAINERS (Register allocation reviewer): Add myself.
-2006-09-24 Kenneth Zadeck <zadeck@naturalbridge.com>
+2006-09-24 Kenneth Zadeck <zadeck@naturalbridge.com>
* MAINTAINERS (Register allocation reviewer): Add myself.
@@ -1967,7 +1980,7 @@
* configure.ac: Raise minimum makeinfo version to 4.6.
* configure: Regenerate.
-2007-09-17 Johannes Singler <singler@ira.uka.de>
+2007-09-17 Johannes Singler <singler@ira.uka.de>
* MAINTAINERS (write-after-approval) add myself
@@ -2489,7 +2502,7 @@
* Makefile.in: Regenerated.
* configure: Regenerated with autoconf 2.59.
-2007-02-07 Roman Zippel <zippel@linux-m68k.org>
+2007-02-07 Roman Zippel <zippel@linux-m68k.org>
* MAINTAINERS (Write After Approval): Add myself.
@@ -2498,7 +2511,7 @@
* Makefile.tpl (LDFLAGS): Substitute it.
* Makefile.in: Regenerate.
-2007-01-30 Andrey Belevantsev <abel@ispras.ru>
+2007-01-30 Andrey Belevantsev <abel@ispras.ru>
* MAINTAINERS (Write After Approval): Add myself.
@@ -2542,7 +2555,7 @@
(gcc): Remove target.
* Makefile.tpl (build_os, build_vendor, host_os, host_vendor,
target_os, target_vendor): New.
- (configure): Add host_alias/target_alias arguments. Adjust invocations.
+ (configure): Add host_alias/target_alias arguments; adjust invocations.
* configure: Regenerate.
* Makefile.in: Regenerate.
@@ -2574,7 +2587,7 @@
2007-01-04 Paolo Bonzini <bonzini@gnu.org>
- * configure.in: Use DEV-PHASE to detect the default for --enable-werror.
+ * configure.in: Use DEV-PHASE to detect default for --enable-werror.
* configure: Regenerate.
2007-01-03 Daniel Jacobowitz <dan@codesourcery.com>
@@ -2661,7 +2674,7 @@
* MAINTAINERS: Add myself as libgcc and fp-bit maintainer.
-2006-12-11 Joern Rennecke <joern.rennecke@arc.com>
+2006-12-11 Joern Rennecke <joern.rennecke@arc.com>
MAINTAINERS: Update my entry.
@@ -2741,7 +2754,7 @@
* MAINTAINERS (Write After Approval): Add myself.
-2006-11-22 Philipp Thomas <pth@suse.de>
+2006-11-22 Philipp Thomas <pth@suse.de>
* MAINTAINERS (i18n): Update e-mail address.
@@ -2764,12 +2777,12 @@
* MAINTAINERS (Write After Approval): Add myself.
-2006-11-20 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+2006-11-20 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
* configure.in (skipdirs) : Don't build target-libiberty for SPU.
* configure : Rebuilt.
-2006-11-20 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+2006-11-20 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -2789,7 +2802,8 @@
(unstage): Test for stage_last presence.
PR bootstrap/29802
- * Makefile.tpl (POSTSTAGE1_FLAGS_TO_PASS): Add HOST_SUBDIR in STAGE_PREFIX.
+ * Makefile.tpl (POSTSTAGE1_FLAGS_TO_PASS): Add HOST_SUBDIR in
+ STAGE_PREFIX.
* Makefile.in: Regenerate.
2003-11-16 Zdenek Dvorak <dvorakz@suse.cz>
@@ -2825,11 +2839,11 @@
* configure: Regenerate.
-2006-10-31 Stephen M. Webb <stephen.webb@bregmasoft.com>
+2006-10-31 Stephen M. Webb <stephen.webb@bregmasoft.com>
* MAINTAINERS (Write After Approval): Add myself.
-2006-10-30 Uros Bizjak <ubizjak@gmail.com>
+2006-10-30 Uros Bizjak <ubizjak@gmail.com>
* MAINTAINERS: Change email address.
@@ -2883,8 +2897,8 @@
2006-09-27 Dave Brolley <brolley@redhat.com>
- * configure.in (RUNTEST): Look for 'runtest' in the source tree by using
- $s instead of $r.
+ * configure.in (RUNTEST): Look for 'runtest' in the source tree by
+ using $s instead of $r.
* configure: Regenerated.
2006-09-26 Thiemo Seufer <ths@mips.com>
@@ -2893,7 +2907,7 @@
for mipstx39-*-*. Disable libgloss for mips64*-*-linux*.
* configure: Regenerate.
-2006-09-24 Graeme Peterson <gridly@gmail.com>
+2006-09-24 Graeme Peterson <gridly@gmail.com>
* MAINTAINERS (Write After Approval): Remove myself.
@@ -2905,7 +2919,7 @@
* MAINTAINERS: Add self as soft-fp maintainer.
-2006-09-09 Anatoly Sokolov <aesok@post.ru>
+2006-09-09 Anatoly Sokolov <aesok@post.ru>
* MAINTAINERS: Add myself as avr maintainer.
Remove Marek Michalkiewicz as avr maintainer.
@@ -3039,7 +3053,7 @@
${libgcj} is specified.
* configure: Regenerate.
-2006-06-06 Carlos O'Donell <carlos@codesourcery.com>
+2006-06-06 Carlos O'Donell <carlos@codesourcery.com>
Sync from src:
@@ -3134,7 +3148,7 @@
* configure.in: Enable libgcj for hppa*-hp-hpux11*.
* configure: Rebuilt.
-2006-05-12 Sandra Loosemore <sandra@codesourcery.com>
+2006-05-12 Sandra Loosemore <sandra@codesourcery.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -3148,7 +3162,7 @@
* MAINTAINERS (Various Maintainers): Add myself as libgcc-math
maintainer.
-2006-04-30 Kenneth Zadeck <zadeck@naturalbridge.com>
+2006-04-30 Kenneth Zadeck <zadeck@naturalbridge.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -3207,7 +3221,7 @@
* MAINTAINERS (Write After Approval): Remove myself.
(Language Front End Maintainers): Add myself as fortran 95 maintainer.
-2006-02-21 Rafael Ãvila de Espíndola <rafael.espindola@gmail.com>
+2006-02-21 Rafael Ãvila de Espíndola <rafael.espindola@gmail.com>
* Makefile.tpl (BUILD_CONFIGDIRS): Remove.
(TARGET_CONFIGDIRS): Remove.
@@ -3454,7 +3468,7 @@
(multilib.out): Remove.
* Makefile.in: Regenerated.
-2005-12-12 Carlos O'Donell <carlos@codesourcery.com>
+2005-12-12 Carlos O'Donell <carlos@codesourcery.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -4047,7 +4061,7 @@
* MAINTAINERS: Move John Carr to Write After Approval.
-2005-03-30 J"orn Rennecke <joern.rennecke@st.com>
+2005-03-30 J"orn Rennecke <joern.rennecke@st.com>
* config/mh-mingw32: Delete.
* configure.in: Don't use it.
@@ -4057,7 +4071,7 @@
* Makefile.def (bfd, opcodes, libstdc++-v3, libmudflap): Set lib_path.
* Makefile.tpl (SET_LIB_PATH, REALLY_SET_LIB_PATH): Remove.
- (HOST_EXPORTS, STAGE_HOST_EXPORTS, TARGET_EXPORTS): Set $(RPATH_ENVVAR).
+ (HOST_EXPORTS, STAGE_HOST_EXPORTS, TARGET_EXPORTS): Set RPATH_ENVVAR.
(HOST_LIB_PATH): Generate from Makefile.def.
(TARGET_LIB_PATH): Likewise.
(Old bootstrap targets): Include TARGET_LIB_PATH into RPATH_ENVVAR.
@@ -4093,7 +4107,7 @@
* configure: Regenerate.
2005-03-16 Manfred Hollstein <manfred.h@gmx.net>
- Andrew Pinski <pinskia@physics.uc.edu>
+ Andrew Pinski <pinskia@physics.uc.edu>
* Makefile.tpl (check-[+module+]): Fix shell statement inside if ... fi.
* Makefile.in: Regenerate.
@@ -4447,7 +4461,7 @@
* configure.in (*-*-cygwin*): Supress warning if newlib not present.
* configure: Regenerate.
-2004-10-07 J"orn Rennecke <joern.rennecke@st.com>
+2004-10-07 J"orn Rennecke <joern.rennecke@st.com>
* MAINTAINERS: Update my email address.
@@ -4502,7 +4516,7 @@
* configure.in (--without-headers): Add missing double quotes.
* configure: Regenerate.
-2004-09-24 Kelley Cook <kcook@gcc.gnu.org>
+2004-09-24 Kelley Cook <kcook@gcc.gnu.org>
* ylwrap: Revert to previous version.
@@ -4680,7 +4694,7 @@
* configure.in: Fix indentation.
* configure: Regenerate.
-2004-08-31 Robert Bowdidge <bowdidge@apple.com>
+2004-08-31 Robert Bowdidge <bowdidge@apple.com>
* Makefile.in: Move BOOT_CFLAGS above host makefile fragment include.
* configure.in: add test for powerpc-*-darwin* to specify makefile frag
@@ -4688,7 +4702,6 @@
* config/mh-ppc-darwin: create file, override BOOT_CFLAGS for
-mdynamic-no-pic
-
2004-08-31 Paolo Bonzini <bonzini@gnu.org>
* Makefile.def (build_modules): Add fixincludes.
@@ -4816,7 +4829,7 @@
libmudflap for all GNU-based systems (with Glibc).
* configure: Regenerate.
-2004-08-03 Paolo Bonzini <bonzini@gnu.org>
+2004-08-03 Paolo Bonzini <bonzini@gnu.org>
* Makefile.def (host-modules): Add gcc.
* Makefile.in: Regenerate.
@@ -4860,7 +4873,7 @@
* gcc/gccbug.in: Updated because of libf2c removal.
* maintainer-scripts/gcc_release: Ditto.
-2004-07-09 Loren J. Rittle <ljrittle@acm.org>
+2004-07-09 Loren J. Rittle <ljrittle@acm.org>
* configure.in: Build libmudflap by default on FreeBSD.
* configure: Regenerated.
@@ -4871,7 +4884,7 @@
systems.
* configure: Regenerated.
-2004-07-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+2004-07-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/16344
* Makefile.tpl (profiledbootstrap): Build runtime libraries with
@@ -4999,7 +5012,7 @@
* Makefile.tpl: Fix typo.
* Makefile.in: Regenerate.
-2004-06-01 Paolo Bonzini <bonzini@gnu.org>
+2004-06-01 Paolo Bonzini <bonzini@gnu.org>
* configure.in: Remove new- prefix from toplevel
bootstrap targets.
@@ -5030,7 +5043,7 @@
* configure: Regenerate.
2004-05-30 Andreas Jaeger <aj@suse.de>
- Jim Wilson <wilson@specifixinc.com>
+ Jim Wilson <wilson@specifixinc.com>
* config-ml.in: Pass FFLAGS and ADAFLAGS for multilibs, handle F77
like CC.
@@ -5048,7 +5061,7 @@
targets.
* Makefile.in: Regenerate.
-2004-05-24 Paolo Bonzini <bonzini@gnu.org>
+2004-05-24 Paolo Bonzini <bonzini@gnu.org>
* configure.in: Test the ability to symlink directories.
* configure: Regenerate.
@@ -5528,7 +5541,7 @@
* MAINTAINERS: Update my email address.
-2004-01-14 Loren J. Rittle <ljrittle@acm.org>
+2004-01-14 Loren J. Rittle <ljrittle@acm.org>
* Makefile.def (target_modules) [libtermcap, libiberty, zlib]: Stage.
* Makefile.tpl (configure-target-[+module+]): Support stage.
@@ -5603,7 +5616,7 @@
* MAINTAINERS: Move myself from 'Bug database only accounts' to
'Write After Approval' section. Update email.
-2003-12-01 James Lemke <jim@wasabisystems.com>
+2003-12-01 James Lemke <jim@wasabisystems.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -5646,7 +5659,7 @@
* configure.in (*-*-vxworks): Add target-libiberty to noconfdirs.
* configure: Regenerate.
-2003-10-20 Nicolas Pitre <nico@cam.org>
+2003-10-20 Nicolas Pitre <nico@cam.org>
* MAINTAINERS: Add myself to 'Write After Approval' section.
@@ -5662,7 +5675,7 @@
* config-ml.in (multi-do): Pass MULTIFLAGS to subdir makes.
-2003-10-17 Ralph Loader <rcl@ihug.co.nz>
+2003-10-17 Ralph Loader <rcl@ihug.co.nz>
* MAINTAINERS: Add myself to 'Write After Approval' section.
@@ -5671,7 +5684,7 @@
* config.guess: Update to 2003-10-16 version.
* config.sub: Update to 2003-10-16 version.
-2003-10-15 David Daney <ddaney@avtrex.com>
+2003-10-15 David Daney <ddaney@avtrex.com>
* MAINTAINERS: Added myself to 'Write After Approval' section.
@@ -5949,7 +5962,7 @@
* Makefile.tpl (all-bootstrap): Depend on maybe-all-intl.
* Makefile.in: Regenerate.
-2003-07-04 H.J. Lu <hongjiu.lu@intel.com>
+2003-07-04 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.tpl: Replace PWD with PWD_COMMAND.
* Makefile.in: Regenerated.
@@ -6008,16 +6021,16 @@
* MAINTAINERS (Write After Approval): Remove Andrew Haley.
-2003-06-16 Graeme Peterson <gp@qnx.com>
+2003-06-16 Graeme Peterson <gp@qnx.com>
* MAINTAINERS (Write After Approval): Add myself.
-2003-06-14 H.J. Lu <hongjiu.lu@intel.com>
+2003-06-14 H.J. Lu <hongjiu.lu@intel.com>
* config.guess: Update to 2003-06-12 version.
* config.sub: Update to 2003-06-13 version.
-2003-06-12 H.J. Lu <hongjiu.lu@intel.com>
+2003-06-12 H.J. Lu <hongjiu.lu@intel.com>
* config.guess: Update to 2003-06-06 version.
* config.sub: Update to 2003-06-06 version.
@@ -6138,7 +6151,7 @@
* config.guess: Update to 2003-05-09 version.
* config.sub: Update to 2003-05-09 version.
-2003-05-13 Michael Eager <eager@mvista.com>
+2003-05-13 Michael Eager <eager@mvista.com>
* configure.in: Correct sed script so that options in quotes are not
deleted.
@@ -6185,7 +6198,7 @@
* MAINTAINERS (Write After Approval): Upgrade myself from
GNATS only to write-after-approval. Update my mail address.
-2003-04-25 Loren J. Rittle <ljrittle@acm.org>
+2003-04-25 Loren J. Rittle <ljrittle@acm.org>
(OS Port Maintainers: freebsd): Add myself.
@@ -6317,7 +6330,7 @@
* Makefile.tpl: Rearrange.
* Makefile.in: Regenerate.
-2003-02-25 Uwe Stieber <uwe@wwws.de>
+2003-02-25 Uwe Stieber <uwe@wwws.de>
* configure.in: Add support for kaOS as cross build target system.
* configure: Regenerated.
@@ -6512,10 +6525,10 @@
gdb/gdbtk directory being present.
* configure: Regenerate.
-2003-01-04 John David Anglin <dave.anglin@nrc.ca>
+2003-01-04 John David Anglin <dave.anglin@nrc.ca>
- * configure.in (LD): Improve test for gcc. Try to set LD to the ld used
- by gcc if LD is not defined and we are not doing a Canadian Cross.
+ * configure.in (LD): Improve test for gcc. Try to set LD to the ld
+ used by gcc if LD is not defined and we are not doing a Canadian Cross.
* configure: Rebuilt.
2002-12-31 Tom Tromey <tromey@redhat.com>
@@ -6634,7 +6647,7 @@
* Makefile.tpl, configure.in: Substitute libstdcxx_incdir.
* Makefile.in: Regenerate.
-2002-12-18 H.J. Lu <hjl@gnu.org>
+2002-12-18 H.J. Lu <hjl@gnu.org>
* Makefile.tpl: Add @build_prefix@ before $(BUILD_SUBDIR).
* Makefile.in: Regenerated.
@@ -6858,7 +6871,7 @@
* Makefile.tpl: syntactic cleanup
-2002-11-13 Stuart Hastings <stuart@apple.com>
+2002-11-13 Stuart Hastings <stuart@apple.com>
* MAINTAINERS: Add myself to write-after-approval list.
@@ -7073,7 +7086,7 @@
* MAINTAINERS (Write After Approval): Remove myself.
(Various Maintainers: c++ runtime libs): Add myself.
-2002-08-20 Loren J. Rittle <ljrittle@acm.org>
+2002-08-20 Loren J. Rittle <ljrittle@acm.org>
* MAINTAINERS (Write After Approval): Remove myself.
(Various Maintainers: c++ runtime libs): Add myself.
@@ -7114,7 +7127,7 @@
* ltconfig (shlibpath_*, dynamic_linker, library_names_spec,
soname_spec, sys_lib_search_path_spec): Ditto.
-2002-08-06 Federico G. Schwindt <fgsch@olimpo.com.br>
+2002-08-06 Federico G. Schwindt <fgsch@olimpo.com.br>
* configure.in (hppa*-*-openbsd*): Treat like hppa*-*-*elf*.
@@ -7197,7 +7210,7 @@
(all-opcodes): Do not depend on all-cgen.
(all-sim): Likewise.
-2002-07-01 Nathanael Nerode <neroden@gcc.gnu.org>
+2002-07-01 Nathanael Nerode <neroden@gcc.gnu.org>
* Makefile.in: Eliminate 'apache' targets.
* configure.in: Eliminate 'apache' targets.
@@ -7366,7 +7379,7 @@ Tue Jun 18 22:37:35 2002 Denis Chertykov <denisc@overta.ru>
* MAINTAINERS: Add self.
-2002-05-06 Loren J. Rittle <ljrittle@acm.org>
+2002-05-06 Loren J. Rittle <ljrittle@acm.org>
* ltmain.sh: Detect and handle object name conflicts
while piecewise linking a static library.
@@ -7414,7 +7427,7 @@ Tue Jun 18 22:37:35 2002 Denis Chertykov <denisc@overta.ru>
for Dan Berlin, Chris Demetriou and Michael Matz. Remove
entry for a29k port maintainer.
-2002-04-26 Joel Sherrill <joel@OARcorp.com>
+2002-04-26 Joel Sherrill <joel@OARcorp.com>
* configure.in (h8300*-*-rtems*): Disable libf2c and libgcj.
(sparc-*-elf*, sparc64-*-elf*): Disable libgcj.
@@ -7518,7 +7531,7 @@ Fri Jun 8 11:14:02 2001 Andrew Cagney <cagney@b1.cygnus.com>
* Makefile.in (VER): When present, extract the version number from
the file version.in.
-2001-05-24 Tom Rix <trix@redhat.com>
+2001-05-24 Tom Rix <trix@redhat.com>
* configure.in : enable ld for aix
@@ -7554,7 +7567,7 @@ Fri Jun 8 11:14:02 2001 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in (host_tools): Add cgen.
Only configure cgen if --enable-cgen-maint.
-2002-04-09 Loren J. Rittle <ljrittle@acm.org>
+2002-04-09 Loren J. Rittle <ljrittle@acm.org>
* configure.in: Add *-*-freebsd* configurations.
@@ -7571,7 +7584,7 @@ Fri Jun 8 11:14:02 2001 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in (alpha*-dec-osf*): Enable libgcj.
-2003-03-27 Matthew Gingell <gingell@gnat.com>
+2003-03-27 Matthew Gingell <gingell@gnat.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -7585,7 +7598,7 @@ Fri Jun 8 11:14:02 2001 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in: Enable libgcj for xscale-elf target.
-Tue Mar 19 09:05:08 2002 J"orn Rennecke <joern.rennecke@superh.com>
+Tue Mar 19 09:05:08 2002 J"orn Rennecke <joern.rennecke@superh.com>
* MAINTAINERS: Update my email address.
@@ -7640,7 +7653,7 @@ Tue Mar 19 09:05:08 2002 J"orn Rennecke <joern.rennecke@superh.com>
* configure.in (CXX_FOR_TARGET): Add -shared-libgcc for
libstdc++-v3 and libjava.
-2002-02-11 Adam Megacz <adam@xwt.org>
+2002-02-11 Adam Megacz <adam@xwt.org>
* gcc/Makefile.in: Removed libstdc++-v3 dependancy for libjava and
boehm-gc
@@ -7691,7 +7704,7 @@ Thu Feb 7 12:40:58 CET 2002 Jan Hubicka <jh@suse.cz>
* MAINTAINERS (Write After Approval): Add myself.
-2002-01-17 H.J. Lu <hjl@gnu.org>
+2002-01-17 H.J. Lu <hjl@gnu.org>
* Makefile.in (all-fastjar): Also depend on all-libiberty.
(all-target-fastjar): Also depend on all-target-libiberty.
@@ -7745,7 +7758,7 @@ Wed Dec 5 07:33:45 2001 Douglas B. Rupp <rupp@gnat.com>
* MAINTAINERS: Update mail address for config.* patches.
-2001-11-27 DJ Delorie <dj@redhat.com>
+2001-11-27 DJ Delorie <dj@redhat.com>
Zack Weinberg <zack@codesourcery.com>
When build != host, create libiberty for the build machine.
@@ -7840,7 +7853,7 @@ Wed Dec 5 07:33:45 2001 Douglas B. Rupp <rupp@gnat.com>
* MAINTAINERS: Tweak my address.
-Thu Oct 11 21:50:15 2001 J"orn Rennecke <amylaar@onetel.net.uk>
+Thu Oct 11 21:50:15 2001 J"orn Rennecke <amylaar@onetel.net.uk>
* MAINTAINERS: Update my email address.
@@ -7854,7 +7867,7 @@ Thu Oct 11 21:50:15 2001 J"orn Rennecke <amylaar@onetel.net.uk>
* MAINTAINERS (Various maintainers: Ada front end):
Added Robert Dewar.
-2001-10-03 David Billinghurst <David.Billinghurst@riotinto.com>
+2001-10-03 David Billinghurst <David.Billinghurst@riotinto.com>
* MAINTAINERS (Write After Approval): Added self
@@ -7870,7 +7883,7 @@ Thu Oct 11 21:50:15 2001 J"orn Rennecke <amylaar@onetel.net.uk>
* Makefile.in (configure-target-gperf): Depend on $(ALL_GCC_CXX).
-2001-09-26 Will Cohen <wcohen@redhat.com>
+2001-09-26 Will Cohen <wcohen@redhat.com>
* configure.in (*-*-linux*): Disable configuration of target-newlib
and target-libgloss.
@@ -8035,7 +8048,7 @@ Fri Jun 1 18:55:19 2001 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* MAINTAINERS (Write After Approval): Add myself.
-2001-05-28 Simon Patarin <simon.patarin@inria.fr>
+2001-05-28 Simon Patarin <simon.patarin@inria.fr>
* ltcf-cxx.sh (osf3/osf4/osf5): Support creation of C++ shared
libraries when using g++ with native linker.
@@ -8215,7 +8228,7 @@ Mon Apr 23 09:15:03 2001 Anthony Green <green@redhat.com>
* MAINTAINERS: Added Stan Shebs as new maintainer for Objective-C.
-2001-03-09 Nicola Pero <n.pero@mi.flashnet.it>
+2001-03-09 Nicola Pero <n.pero@mi.flashnet.it>
* configure.in: Only use `lang_requires' for languages athat are
actually enabled.
@@ -8296,7 +8309,7 @@ Mon Apr 23 09:15:03 2001 Anthony Green <green@redhat.com>
* config.guess: Add linux target for S/390.
* config.sub: Likewise.
-2001-02-08 Chandrakala Chavva <cchavva@redhat.com>
+2001-02-08 Chandrakala Chavva <cchavva@redhat.com>
* configure.in: for *-chorusos, don't config target-newlib and
target-libgloss.
@@ -8594,7 +8607,7 @@ Mon Apr 23 09:15:03 2001 Anthony Green <green@redhat.com>
* ltconfig (aix4): Define library and soname specs appropriate for
AIX. Define command to create export symbols list.
-Mon Nov 6 14:19:35 2000 Christopher Faylor <cgf@cygnus.com>
+Mon Nov 6 14:19:35 2000 Christopher Faylor <cgf@cygnus.com>
* config.sub: Add support for Sun Chorus
@@ -8654,7 +8667,7 @@ Mon 25-Sep-2000 19:46:09 BST Neil Booth <neilb@earthling.net>
* INSTALL/README: egcs -> GCC update.
-Sun Sep 17 16:55:59 CEST 2000 Marc Espie <espie@cvs.openbsd.org>
+Sun Sep 17 16:55:59 CEST 2000 Marc Espie <espie@cvs.openbsd.org>
* MAINTAINERS: Add myself to Write After Approval list.
@@ -9087,7 +9100,7 @@ Thu Feb 24 16:15:56 2000 Andrew Cagney <cagney@b1.cygnus.com>
* config.guess, config.sub: Updated to match config's 2000-02-15
version.
-2000-02-23 Linas Vepstas <linas@linas.org>
+2000-02-23 Linas Vepstas <linas@linas.org>
* config.sub: Add support for Linux/IBM 370.
* configure.in: Likewise.
@@ -9096,7 +9109,7 @@ Thu Feb 24 16:15:56 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in: Add mips-pe, sh-pe and arm-wince-pe targets.
-2000-02-20 Christopher Faylor <cgf@cygnus.com>
+2000-02-20 Christopher Faylor <cgf@cygnus.com>
* config.guess: Guess "cygwin" rather than "cygwin32".
@@ -9121,7 +9134,7 @@ Tue Feb 1 00:07:46 2000 Hans-Peter Nilsson <hp@bitrange.com>
* MAINTAINERS: Pair cccp with cpplib maintainership.
-2000-01-27 Christopher Faylor <cgf@redhat.com>
+2000-01-27 Christopher Faylor <cgf@redhat.com>
* Makefile.in (CC_FOR_TARGET): Add new winsup directory
structure stuff to -L library search.
@@ -9174,7 +9187,7 @@ Tue Nov 23 00:57:41 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config-ml.in (sparc*-*-*): Disable sparcv9 support if the
necessary libraries are missing.
-Fri Nov 19 11:22:31 MST 1999 Diego Novillo <dnovillo@cygnus.com>
+Fri Nov 19 11:22:31 MST 1999 Diego Novillo <dnovillo@cygnus.com>
* MAINTAINERS: Add new 'write after approval' maintainer.
diff --git a/MAINTAINERS b/MAINTAINERS
index f28ebc42cdb..c01d6a3cadb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -314,6 +314,7 @@ Christian Bruel christian.bruel@st.com
Kevin Buettner kevinb@redhat.com
Andrew Cagney cagney@redhat.com
Chandra Chavva cchavva@redhat.com
+Fabien Chêne fabien@gcc.gnu.org
William Cohen wcohen@redhat.com
Josh Conner jconner@apple.com
R. Kelley Cook kcook@gcc.gnu.org
diff --git a/Makefile.def b/Makefile.def
index 325d845f3a5..ccc23f6d938 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -322,6 +322,7 @@ dependencies = { module=configure-gcc; on=all-binutils; };
dependencies = { module=configure-gcc; on=all-gas; };
dependencies = { module=configure-gcc; on=all-ld; };
dependencies = { module=configure-gcc; on=all-gold; };
+dependencies = { module=configure-gcc; on=all-libelf; };
dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
dependencies = { module=all-gcc; on=all-gmp; };
dependencies = { module=all-gcc; on=all-intl; };
@@ -329,7 +330,6 @@ dependencies = { module=all-gcc; on=all-mpfr; };
dependencies = { module=all-gcc; on=all-mpc; };
dependencies = { module=all-gcc; on=all-ppl; };
dependencies = { module=all-gcc; on=all-cloog; };
-dependencies = { module=all-gcc; on=all-libelf; };
dependencies = { module=all-gcc; on=all-build-texinfo; };
dependencies = { module=all-gcc; on=all-build-bison; };
dependencies = { module=all-gcc; on=all-build-byacc; };
diff --git a/Makefile.in b/Makefile.in
index d1d8b323ba3..22a77d261aa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -57763,6 +57763,14 @@ configure-stage3-gcc: maybe-all-stage3-gold
configure-stage4-gcc: maybe-all-stage4-gold
configure-stageprofile-gcc: maybe-all-stageprofile-gold
configure-stagefeedback-gcc: maybe-all-stagefeedback-gold
+configure-gcc: maybe-all-libelf
+
+configure-stage1-gcc: maybe-all-stage1-libelf
+configure-stage2-gcc: maybe-all-stage2-libelf
+configure-stage3-gcc: maybe-all-stage3-libelf
+configure-stage4-gcc: maybe-all-stage4-libelf
+configure-stageprofile-gcc: maybe-all-stageprofile-libelf
+configure-stagefeedback-gcc: maybe-all-stagefeedback-libelf
all-gcc: all-libiberty
all-stage1-gcc: all-stage1-libiberty
@@ -57819,14 +57827,6 @@ all-stage3-gcc: maybe-all-stage3-cloog
all-stage4-gcc: maybe-all-stage4-cloog
all-stageprofile-gcc: maybe-all-stageprofile-cloog
all-stagefeedback-gcc: maybe-all-stagefeedback-cloog
-all-gcc: maybe-all-libelf
-
-all-stage1-gcc: maybe-all-stage1-libelf
-all-stage2-gcc: maybe-all-stage2-libelf
-all-stage3-gcc: maybe-all-stage3-libelf
-all-stage4-gcc: maybe-all-stage4-libelf
-all-stageprofile-gcc: maybe-all-stageprofile-libelf
-all-stagefeedback-gcc: maybe-all-stagefeedback-libelf
all-gcc: maybe-all-build-texinfo
all-stage1-gcc: maybe-all-build-texinfo
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 780d70f29ff..d9cda96895e 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,10 @@
+2010-06-15 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac (*-*-solaris2.8*): Only usr alternate thread
+ library on Solaris 8.
+ (*-*-solaris2*): Use regular thread library otherwise.
+ * configure: Regenerate.
+
2010-05-13 Uros Bizjak <ubizjak@gmail.com>
* tests/leak_test.c (main): Declare as int. Return 0.
diff --git a/boehm-gc/configure b/boehm-gc/configure
index 0bcfb592af3..557d30583ac 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -14893,7 +14893,7 @@ $as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
THREADLIBS=-pthread
;;
- *-*-solaris*)
+ *-*-solaris2.8*)
$as_echo "#define GC_SOLARIS_PTHREADS 1" >>confdefs.h
@@ -14903,6 +14903,15 @@ $as_echo "#define GC_SOLARIS_PTHREADS 1" >>confdefs.h
THREADLIBS="-L/usr/lib/lwp/$multi_os_directory \
-R/usr/lib/lwp/$multi_os_directory -lpthread -lthread -lrt"
;;
+ *-*-solaris2*)
+
+$as_echo "#define GC_SOLARIS_PTHREADS 1" >>confdefs.h
+
+ # The alternate thread library was only introduced in Solaris 8 and
+ # became the default in Solaris 9, so no need for the special code
+ # above otherwise.
+ THREADLIBS=-lpthread
+ ;;
*-*-irix*)
$as_echo "#define GC_IRIX_THREADS 1" >>confdefs.h
diff --git a/boehm-gc/configure.ac b/boehm-gc/configure.ac
index 363263ec277..32c627524a7 100644
--- a/boehm-gc/configure.ac
+++ b/boehm-gc/configure.ac
@@ -1,4 +1,5 @@
-# Copyright (c) 1999, 2000, 2001, 2002, 2003, 2006 by Red Hat, Inc. All rights reserved.
+# Copyright (c) 1999, 2000, 2001, 2002, 2003, 2006, 2010 by Red Hat, Inc.
+# All rights reserved.
# Copyright 2004 Nathanael Nerode
#
# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
@@ -179,7 +180,7 @@ case "$THREADS" in
AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
THREADLIBS=-pthread
;;
- *-*-solaris*)
+ *-*-solaris2.8*)
AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
# Need to use alternate thread library, otherwise gctest hangs
# on Solaris 8.
@@ -187,6 +188,13 @@ case "$THREADS" in
THREADLIBS="-L/usr/lib/lwp/$multi_os_directory \
-R/usr/lib/lwp/$multi_os_directory -lpthread -lthread -lrt"
;;
+ *-*-solaris2*)
+ AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
+ # The alternate thread library was only introduced in Solaris 8 and
+ # became the default in Solaris 9, so no need for the special code
+ # above otherwise.
+ THREADLIBS=-lpthread
+ ;;
*-*-irix*)
AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads])
;;
diff --git a/config/ChangeLog b/config/ChangeLog
index e0ce47425a3..9d18d75f2a7 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,26 @@
+2010-06-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * bootstrap-lto.mk: New.
+
+2010-06-10 Paolo Bonzini <bonzini@gnu.org>
+
+ * override.m4: Remove obsolete (<2.64) definitions.
+
+2010-06-09 Iain Sandoe <iains@gcc.gnu.org>
+
+ PR bootstrap/43170
+ * tls.m4 (GCC_CHECK_TLS): Add volatile qualifier to the test
+ references. Move the main () test reference ahead of
+ pthread_create(). Add a comment to explain the requirements
+ of the test.
+
+2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com>
+ Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ PR bootstrap/42798
+ * override.m4 (_AC_CHECK_DECL_BODY, _AC_CHECK_DECLS): Import
+ definitions from git Autoconf.
+
2010-04-13 Steve Ellcey <sje@cup.hp.com>
* elf.m4: Add hppa[12]*-*-hpux* to list of non-elf platforms.
diff --git a/config/bootstrap-lto.mk b/config/bootstrap-lto.mk
new file mode 100644
index 00000000000..14099a08b8d
--- /dev/null
+++ b/config/bootstrap-lto.mk
@@ -0,0 +1,8 @@
+# This option enables LTO for stage2 and stage3. It requires lto to
+# be enabled for stage1 with --enable-stage1-languages.
+
+STAGE2_CFLAGS += -flto
+STAGE3_CFLAGS += -flto
+
+# Ada fails to build with LTO, turn it off for now.
+BOOT_ADAFLAGS += -fno-lto
diff --git a/config/override.m4 b/config/override.m4
index cfa225a339c..fc2d5272d74 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -1,9 +1,5 @@
-dnl Fix Autoconf-2.59 bugs: by overriding broken internal
-dnl Autoconf macros with backports of the 2.60+ fix.
-dnl - AC_CONFIG_SUBDIRS whitespace mangling,
-dnl - more lenient precious variable checks
-dnl - better configure error message
-dnl - reliance on non-Posix m4wrap (M4 1.6 or newer implement FIFO)
+dnl Fix Autoconf bugs by overriding broken internal Autoconf
+dnl macros with backports of fixes from newer releases.
dnl
dnl The override bits of this file should be a no-op for the newest
dnl Autoconf version, which means they can be removed once the complete
@@ -12,6 +8,9 @@ dnl
dnl The _GCC_AUTOCONF_VERSION_TEST ensures that exactly the desired
dnl Autoconf version is used. It should be kept for consistency.
+dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
+ifdef([m4_PACKAGE_VERSION], [
+
dnl Provide m4_copy_force and m4_rename_force for old Autoconf versions.
m4_ifndef([m4_copy_force],
@@ -22,17 +21,7 @@ m4_ifndef([m4_rename_force],
[m4_define([m4_rename_force],
[m4_ifdef([$2], [m4_undefine([$2])])m4_rename($@)])])
-dnl m4_PACKAGE_VERSION is an undocumented Autoconf macro.
-dnl We use it because this fix is intended for 2.59 only.
-dnl A feature test for the broken AC_CONFIG_SUBDIRS instead
-dnl would be better but is tricky.
-dnl
-dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
-dnl Redefine AC_CONFIG_SUBDIRS so aclocal pulls in this file
-dnl when needed.
-
-ifdef([m4_PACKAGE_VERSION],
-[dnl AC_DEFUN a commonly used macro so this file is picked up.
+dnl AC_DEFUN a commonly used macro so this file is picked up.
m4_copy([AC_PREREQ], [_AC_PREREQ])
AC_DEFUN([AC_PREREQ], [frob])
m4_copy_force([_AC_PREREQ], [AC_PREREQ])
@@ -59,216 +48,51 @@ _GCC_AUTOCONF_VERSION_CHECK
])
-dnl Turn AC_DISABLE_OPTION_CHECKING into a no-op if not defined.
-m4_ifndef([AC_DISABLE_OPTION_CHECKING],
- [m4_define([AC_DISABLE_OPTION_CHECKING])])
-
-
dnl Fix 2.64 cross compile detection for AVR and RTEMS
dnl by not trying to compile fopen.
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64],
[m4_foreach([_GCC_LANG], [C, C++, Fortran, Fortran 77],
[m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])])
+m4_version_prereq([2.66],, [
+dnl We need AC_CHECK_DECL which works for overloaded C++ functions.
+
+# _AC_CHECK_DECL_BODY
+# -------------------
+# Shell function body for AC_CHECK_DECL.
+m4_define([_AC_CHECK_DECL_BODY],
+[ AS_LINENO_PUSH([$[]1])
+ [as_decl_name=`echo $][2|sed 's/ *(.*//'`]
+ [as_decl_use=`echo $][2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`]
+ AC_CACHE_CHECK([whether $as_decl_name is declared], [$[]3],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4],
+[@%:@ifndef $[]as_decl_name
+@%:@ifdef __cplusplus
+ (void) $[]as_decl_use;
+@%:@else
+ (void) $[]as_decl_name;
+@%:@endif
+@%:@endif
+])],
+ [AS_VAR_SET([$[]3], [yes])],
+ [AS_VAR_SET([$[]3], [no])])])
+ AS_LINENO_POP
+])# _AC_CHECK_DECL_BODY
+
+# _AC_CHECK_DECLS(SYMBOL, ACTION-IF_FOUND, ACTION-IF-NOT-FOUND,
+# INCLUDES)
+# -------------------------------------------------------------
+# Helper to AC_CHECK_DECLS, which generates the check for a single
+# SYMBOL with INCLUDES, performs the AC_DEFINE, then expands
+# ACTION-IF-FOUND or ACTION-IF-NOT-FOUND.
+m4_define([_AC_CHECK_DECLS],
+[AC_CHECK_DECL([$1], [ac_have_decl=1], [ac_have_decl=0], [$4])]dnl
+[AC_DEFINE_UNQUOTED(AS_TR_CPP(m4_bpatsubst(HAVE_DECL_[$1],[ *(.*])),
+ [$ac_have_decl],
+ [Define to 1 if you have the declaration of `$1',
+ and to 0 if you don't.])]dnl
+[m4_ifvaln([$2$3], [AS_IF([test $ac_have_decl = 1], [$2], [$3])])])
-m4_version_prereq([2.60],, [
-dnl We use $ac_pwd in some of the overrides below; ensure its definition
-m4_divert_push([PARSE_ARGS])dnl
-ac_pwd=`pwd`
-m4_divert_pop([PARSE_ARGS])dnl
-])
-
-
-m4_version_prereq([2.60],, [
-
-# _AC_OUTPUT_SUBDIRS
-# ------------------
-# This is a subroutine of AC_OUTPUT, but it does not go into
-# config.status, rather, it is called after running config.status.
-m4_define([_AC_OUTPUT_SUBDIRS],
-[
-#
-# CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
-#
-if test "$no_recursion" != yes; then
-
- # Remove --cache-file and --srcdir arguments so they do not pile up.
- ac_sub_configure_args=
- ac_prev=
- eval "set x $ac_configure_args"
- shift
- for ac_arg
- do
- if test -n "$ac_prev"; then
- ac_prev=
- continue
- fi
- case $ac_arg in
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
- | --c=*)
- ;;
- --config-cache | -C)
- ;;
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- ;;
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- ;;
- *)
- case $ac_arg in
- *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
- esac
- done
-
- # Always prepend --prefix to ensure using the same prefix
- # in subdir configurations.
- ac_arg="--prefix=$prefix"
- case $ac_arg in
- *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
-
- ac_popdir=`pwd`
- for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
-
- # Do not complain, so a configure script can configure whichever
- # parts of a large source tree are present.
- test -d "$srcdir/$ac_dir" || continue
-
- AC_MSG_NOTICE([configuring in $ac_dir])
- AS_MKDIR_P(["$ac_dir"])
- _AC_SRCPATHS(["$ac_dir"])
-
- cd "$ac_dir"
-
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f "$ac_srcdir/configure.gnu"; then
- ac_sub_configure=$ac_srcdir/configure.gnu
- elif test -f "$ac_srcdir/configure"; then
- ac_sub_configure=$ac_srcdir/configure
- elif test -f "$ac_srcdir/configure.in"; then
- # This should be Cygnus configure.
- ac_sub_configure=$ac_aux_dir/configure
- else
- AC_MSG_WARN([no configuration information is in $ac_dir])
- ac_sub_configure=
- fi
-
- # The recursion is here.
- if test -n "$ac_sub_configure"; then
- # Make the cache file name correct relative to the subdirectory.
- case $cache_file in
- [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
- *) # Relative path.
- ac_sub_cache_file=$ac_top_builddir$cache_file ;;
- esac
-
- AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
- # The eval makes quoting arguments work.
- eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
- --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
- AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
- fi
-
- cd "$ac_popdir"
- done
-fi
-])# _AC_OUTPUT_SUBDIRS
-])
-
-m4_version_prereq([2.63],, [
-
-# _AC_ARG_VAR_VALIDATE
-# --------------------
-# The code is the same as autoconf 2.59, but with a more lenient check
-# on precious variables and an output of pwd that have been added in
-# autoconf 2.62.
-m4_define([_AC_ARG_VAR_VALIDATE],
-[m4_divert_text([INIT_PREPARE],
-[# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([[a-zA-Z_0-9]]*\)_set=.*/\1/p'`; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
- case $ac_old_set,$ac_new_set in
- set,)
- AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous run], 2)
- ac_cache_corrupted=: ;;
- ,set)
- AS_MESSAGE([error: `$ac_var' was not set in the previous run], 2)
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- # differences in whitespace do not lead to failure.
- ac_old_val_w=`echo x $ac_old_val`
- ac_new_val_w=`echo x $ac_new_val`
- if test "$ac_old_val_w" != "$ac_new_val_w"; then
- AS_MESSAGE([error: `$ac_var' has changed since the previous run:], 2)
- ac_cache_corrupted=:
- else
- AS_MESSAGE([warning: ignoring whitespace changes in `$ac_var' since the previous run:], 2)
- eval $ac_var=\$ac_old_val
- fi
- AS_MESSAGE([ former value: `$ac_old_val'], 2)
- AS_MESSAGE([ current value: `$ac_new_val'], 2)
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
-dnl If you change this globbing pattern, test it on an old shell --
-dnl it's sensitive. Putting any kind of quote in it causes syntax errors.
-[ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- AS_MESSAGE([error: in `$ac_pwd':], 2)
- AS_MESSAGE([error: changes in the environment can compromise the build], 2)
- AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over])
-fi])dnl
-])# _AC_ARG_VAR_VALIDATE
-])
-
-m4_version_prereq([2.63],, [
-
-# AC_MSG_FAILURE(ERROR, [EXIT-STATUS = 1])
-# ----------------------------------------
-# This is the same code as in 2.59 and 2.61, except it also outputs pwd.
-m4_define([AC_MSG_FAILURE],
-[{ AS_MESSAGE([error: in `$ac_pwd':], 2)
-AC_MSG_ERROR([$1
-See `config.log' for more details.], [$2]); }])
-])
])
-m4_version_prereq([2.60],, [
-dnl M4 1.6 and newer implement m4wrap using FIFO semantics, as required
-dnl by Posix; earlier versions used LIFO semantics. Unfortunately,
-dnl Autoconf versions before 2.60 require those LIFO semantics, so
-dnl make sure to give it to them.
-m4_define([m4_wrap], [m4_ifdef([_$0_text],
- [m4_define([_$0_text], [$1]m4_defn([_$0_text]))],
- [m4_define([_$0_text], [$1])m4_builtin([m4wrap],
- [m4_default(m4_defn([_$0_text])m4_undefine([_$0_text]))])])])
])
diff --git a/config/tls.m4 b/config/tls.m4
index ef7e6d0b555..4e170c8d6ae 100644
--- a/config/tls.m4
+++ b/config/tls.m4
@@ -38,11 +38,16 @@ AC_DEFUN([GCC_CHECK_TLS], [
CFLAGS="$chktls_save_CFLAGS"
if test "X$thread_CFLAGS" != Xfailed; then
CFLAGS="$thread_CFLAGS $chktls_save_CFLAGS"
+ dnl Test for an old glibc bug that violated the __thread property.
+ dnl Use volatile to ensure the compiler won't optimize away pointer
+ dnl accesses it might otherwise assume to be redundant, or reorder
+ dnl them and reuse storage, which might lead to them pointing to
+ dnl the same location.
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[#include <pthread.h>
__thread int a;
- static int *a_in_other_thread;
+ static int *volatile a_in_other_thread;
static void *
thread_func (void *arg)
{
@@ -51,11 +56,11 @@ AC_DEFUN([GCC_CHECK_TLS], [
}],
[pthread_t thread;
void *thread_retval;
- int *a_in_main_thread;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
if (pthread_create (&thread, (pthread_attr_t *)0,
thread_func, (void *)0))
return 0;
- a_in_main_thread = &a;
if (pthread_join (thread, &thread_retval))
return 0;
return (a_in_other_thread == a_in_main_thread);])],
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index ee039071bf1..12271531ddf 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,16 @@
+2010-06-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * compare-debug: Drop LTO sections.
+
+2010-06-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
+
+ * gcc_update: Support updating a git clone.
+
+2010-06-04 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * test_summary: Don't use diff -u.
+ Adapt egrep regex.
+
2010-06-02 Andrew Haley <aph@redhat.com>
* download_prerequisites: New script.
diff --git a/contrib/compare-debug b/contrib/compare-debug
index 98c80f93e98..820721cd971 100755
--- a/contrib/compare-debug
+++ b/contrib/compare-debug
@@ -100,9 +100,11 @@ else
done
# If we found .eh_frame in one but not the other, or if we could not
- # find a command to tell, try to strip off the .eh_frame section
- # from both.
- if test "x$cmp1" != "x$cmp2" || test "x$cmd" = "x"; then
+ # find a command to tell, or if there are LTO sections, try to strip
+ # off the .eh_frame and LTO sections from both.
+ if test "x$cmp1" != "x$cmp2" || test "x$cmd" = "x" ||
+ $cmd --section-headers "$1.$suf1" | grep '.gnu.lto_' > /dev/null ||
+ $cmd --section-headers "$2.$suf2" | grep '.gnu.lto_' > /dev/null ; then
suf3=$suf1.
while test -f "$1.$suf3"; do
suf3=$suf3.
@@ -115,21 +117,27 @@ else
trap 'rm -f "$1.$suf1" "$2.$suf2" "$1.$suf3" "$2.$suf4"' 0 1 2 15
- echo stripping off .eh_frame, then retrying >&2
+ echo stripping off .eh_frame and LTO sections, then retrying >&2
+
+ seclist=".eh_frame .rel.eh_frame .rela.eh_frame"
+ if test "x$cmd" != "x"; then
+ seclist="$seclist "`{ $cmd --section-headers "$1.$suf1"; $cmd --section-headers "$2.$suf2"; } | sed -n 's,.* \(\.gnu\.lto_[^ ]*\).*,\1,p' | sort -u`
+ fi
+ rsopts=`for sec in $seclist; do echo " --remove-section $sec"; done`
if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null; then
- objcopy --remove-section .eh_frame --remove-section .rel.eh_frame --remove-section .rela.eh_frame "$1.$suf1" "$1.$suf3"
+ objcopy $rsopts "$1.$suf1" "$1.$suf3"
mv "$1.$suf3" "$1.$suf1"
- objcopy --remove-section .eh_frame --remove-section .rel.eh_frame --remove-section .rela.eh_frame "$2.$suf2" "$2.$suf4"
+ objcopy $rsopts "$2.$suf2" "$2.$suf4"
mv "$2.$suf4" "$2.$suf2"
elif (strip --help) 2>&1 | grep ' --remove-section' > /dev/null; then
cp "$1.$suf1" "$1.$suf3"
- strip --remove-section .eh_frame --remove-section .rel.eh_frame --remove-section .rela.eh_frame "$1.$suf3"
+ strip $rsopts "$1.$suf3"
mv "$1.$suf3" "$1.$suf1"
cp "$2.$suf2" "$2.$suf4"
- strip --remove-section .eh_frame --remove-section .rel.eh_frame --remove-section .rela.eh_frame "$2.$suf4"
+ strip $rsopts "$2.$suf4"
mv "$2.$suf4" "$2.$suf2"
else
echo failed to strip off .eh_frame >&2
diff --git a/contrib/gcc_update b/contrib/gcc_update
index 37e65af59c4..cfae86a50c6 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -245,8 +245,13 @@ p
esac
+is_git=0
# Check whether this indeed looks like a local SVN tree.
-if [ ! -d .svn ]; then
+if [ -d .git ]; then
+ GCC_GIT=${GCC_GIT-${GIT-git}}
+ GCC_SVN="true -"
+ is_git=1
+elif [ ! -d .svn ]; then
echo "This does not seem to be a GCC SVN tree!"
exit
fi
@@ -258,6 +263,7 @@ else
set -- $UPDATE_OPTIONS ${1+"$@"}
fi
+if [ $is_git -eq 0 ]; then
chat "Updating SVN tree"
$GCC_SVN ${silent+-q} --non-interactive update ${1+"$@"}
@@ -283,4 +289,27 @@ p
echo "[$branch revision $revision]" > gcc/REVISION
+else
+ chat "Updating GIT tree"
+ $GCC_GIT diff --quiet --exit-code HEAD
+ if [ $? -ne 0 ]; then
+ echo "Attempting to update a dirty git tree!" >&2
+ echo "Commit or stash your changes first and retry." >&2
+ exit 1
+ fi
+ $GCC_GIT pull ${silent+-q} --rebase ${1+"$@"}
+ if [ $? -ne 0 ]; then
+ (touch_files_reexec)
+ echo "git pull of full tree failed." >&2
+ exit 1
+ fi
+ rm -f LAST_UPDATED gcc/REVISION
+ revision=`$GCC_GIT log -n1 --pretty=%p:%t:%H`
+ branch=`$GCC_GIT name-rev --name-only HEAD || :`
+ {
+ date
+ echo "`TZ=UTC date` (revision $revision)"
+ } > LAST_UPDATED
+ echo "[$branch revision $revision]" > gcc/REVISION
+fi
touch_files_reexec
diff --git a/contrib/test_summary b/contrib/test_summary
index c4b3c2c9369..5fc49f52bda 100755
--- a/contrib/test_summary
+++ b/contrib/test_summary
@@ -1,6 +1,6 @@
#! /bin/sh
-# (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2009
+# (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2009, 2010
# Free Software Foundation
# Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
@@ -75,9 +75,9 @@ for file in $files; do
[ -f $file ] &&
anyfile=true &&
{ $anychange ||
- anychange=`diff -u $file.sent $file 2>/dev/null |
+ anychange=`diff $file.sent $file 2>/dev/null |
if test ! -f $file.sent ||
- egrep '^[-+](XPASS|FAIL)' >/dev/null; then
+ egrep '^[<>] (XPASS|FAIL)' >/dev/null; then
echo true
else
echo false
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index b0b26dfe3fd..11c4e695ea1 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,17 @@
+2010-06-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * inclhack.def (solaris__restrict, solaris_complex_cxx): New fixes
+ * fixincl.x: Regenerate.
+ * tests/base/complex.h [SOLARIS_COMPLEX_CXX_CHECK]: New test.
+ * tests/base/sys/feature_tests.h: New file.
+
+2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com>
+ Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ PR bootstrap/42798
+ * configure.ac: Check for declaration of 'basename(char *)'.
+ * configure: Regenerate.
+
2010-04-12 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* inclhack.def (alpha_wchar): Remove.
diff --git a/fixincludes/configure b/fixincludes/configure
index 52821e47144..7b7109a9301 100755
--- a/fixincludes/configure
+++ b/fixincludes/configure
@@ -1743,8 +1743,10 @@ $as_echo "$ac_res" >&6; }
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
@@ -1754,8 +1756,12 @@ $4
int
main ()
{
-#ifndef $2
- (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
#endif
;
@@ -4725,8 +4731,8 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_ASPRINTF $ac_have_decl
_ACEOF
-ac_fn_c_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default"
-if test "x$ac_cv_have_decl_basename" = x""yes; then :
+ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
+if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
ac_have_decl=1
else
ac_have_decl=0
@@ -4755,6 +4761,7 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_VASPRINTF $ac_have_decl
_ACEOF
+
ac_fn_c_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default"
if test "x$ac_cv_have_decl_clearerr_unlocked" = x""yes; then :
ac_have_decl=1
diff --git a/fixincludes/configure.ac b/fixincludes/configure.ac
index f30a6427658..2c488e70338 100644
--- a/fixincludes/configure.ac
+++ b/fixincludes/configure.ac
@@ -87,7 +87,8 @@ define(fixincludes_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
putchar_unlocked putc_unlocked)
AC_CHECK_FUNCS(fixincludes_UNLOCKED_FUNCS)
-AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno vasprintf fixincludes_UNLOCKED_FUNCS)))
+AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, vasprintf])
+AC_CHECK_DECLS(m4_split(m4_normalize(fixincludes_UNLOCKED_FUNCS)))
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index e80d50c5adc..88ad8434020 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
- * It has been AutoGen-ed Wednesday April 7, 2010 at 05:11:50 PM MEST
+ * It has been AutoGen-ed Friday May 7, 2010 at 02:41:29 PM MEST
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Apr 7 17:11:50 MEST 2010
+/* DO NOT SVN-MERGE THIS FILE, EITHER Fri May 7 14:41:29 MEST 2010
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -15,7 +15,7 @@
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
- * This file contains 205 fixup descriptions.
+ * This file contains 207 fixup descriptions.
*
* See README for more information.
*
@@ -6116,6 +6116,47 @@ static const char* apzRs6000_ParamPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris___Restrict fix
+ */
+tSCC zSolaris___RestrictName[] =
+ "solaris___restrict";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris___RestrictList[] =
+ "sys/feature_tests.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris___RestrictMachs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris___RestrictSelect0[] =
+ "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
+
+#define SOLARIS___RESTRICT_TEST_CT 1
+static tTestDesc aSolaris___RestrictTests[] = {
+ { TT_EGREP, zSolaris___RestrictSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris___Restrict
+ */
+static const char* apzSolaris___RestrictPatch[] = {
+ "format",
+ "#ifdef __cplusplus\n\
+#define\t_RESTRICT_KYWD\t__restrict\n\
+#else\n\
+%0\n\
+#endif",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Solaris_Complex fix
*/
tSCC zSolaris_ComplexName[] =
@@ -6155,6 +6196,39 @@ static const char* apzSolaris_ComplexPatch[] = { sed_cmd_z,
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris_Complex_Cxx fix
+ */
+tSCC zSolaris_Complex_CxxName[] =
+ "solaris_complex_cxx";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Complex_CxxList[] =
+ "complex.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Complex_CxxMachs[] = {
+ "*-*-solaris2.*",
+ (const char*)NULL };
+#define SOLARIS_COMPLEX_CXX_TEST_CT 0
+#define aSolaris_Complex_CxxTests (tTestDesc*)NULL
+
+/*
+ * Fix Command Arguments for Solaris_Complex_Cxx
+ */
+static const char* apzSolaris_Complex_CxxPatch[] = { sed_cmd_z,
+ "-e", "/#if[ \t]*!defined(__cplusplus)/c#ifdef\t__cplusplus\\\n\
+extern \"C\" {\\\n\
+#endif",
+ "-e", "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c#ifdef\t__cplusplus\\\n\
+}\\\n\
+#endif",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Solaris_Math_1 fix
*/
tSCC zSolaris_Math_1Name[] =
@@ -8358,9 +8432,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 245
+#define REGEX_COUNT 246
#define MACH_LIST_SIZE_LIMIT 181
-#define FIX_COUNT 205
+#define FIX_COUNT 207
/*
* Enumerate the fixes
@@ -8516,7 +8590,9 @@ typedef enum {
RS6000_DOUBLE_FIXIDX,
RS6000_FCHMOD_FIXIDX,
RS6000_PARAM_FIXIDX,
+ SOLARIS___RESTRICT_FIXIDX,
SOLARIS_COMPLEX_FIXIDX,
+ SOLARIS_COMPLEX_CXX_FIXIDX,
SOLARIS_MATH_1_FIXIDX,
SOLARIS_MATH_2_FIXIDX,
SOLARIS_MATH_3_FIXIDX,
@@ -9324,11 +9400,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
RS6000_PARAM_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aRs6000_ParamTests, apzRs6000_ParamPatch, 0 },
+ { zSolaris___RestrictName, zSolaris___RestrictList,
+ apzSolaris___RestrictMachs,
+ SOLARIS___RESTRICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris___RestrictTests, apzSolaris___RestrictPatch, 0 },
+
{ zSolaris_ComplexName, zSolaris_ComplexList,
apzSolaris_ComplexMachs,
SOLARIS_COMPLEX_TEST_CT, FD_MACH_ONLY,
aSolaris_ComplexTests, apzSolaris_ComplexPatch, 0 },
+ { zSolaris_Complex_CxxName, zSolaris_Complex_CxxList,
+ apzSolaris_Complex_CxxMachs,
+ SOLARIS_COMPLEX_CXX_TEST_CT, FD_MACH_ONLY,
+ aSolaris_Complex_CxxTests, apzSolaris_Complex_CxxPatch, 0 },
+
{ zSolaris_Math_1Name, zSolaris_Math_1List,
apzSolaris_Math_1Machs,
SOLARIS_MATH_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 4f70a9f3a64..16f36a1e74a 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -3249,6 +3249,23 @@ fix = {
/*
+ * Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
+ * for C99. This is wrong for C++, which needs many C99 features, but
+ * only supports __restrict.
+ */
+fix = {
+ hackname = solaris___restrict;
+ files = sys/feature_tests.h;
+ select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
+ mach = "*-*-solaris2*";
+ c_fix = format;
+ c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
+ "#else\n%0\n#endif";
+ test_text = "#define _RESTRICT_KYWD restrict";
+};
+
+
+/*
* Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
* themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
* and imaginary definitions which are not supported by GCC.
@@ -3273,6 +3290,23 @@ fix = {
/*
+ * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
+ * extern "C" instead so libstdc++ can use it.
+ */
+fix = {
+ hackname = solaris_complex_cxx;
+ mach = "*-*-solaris2.*";
+ files = complex.h;
+ sed = "/#if[ \t]*!defined(__cplusplus)/c"
+ "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
+ sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c"
+ "#ifdef\t__cplusplus\\\n}\\\n#endif";
+ test_text = "#if !defined(__cplusplus)\n"
+ "#endif /* !defined(__cplusplus) */";
+};
+
+
+/*
* Sun Solaris 10 defines several C99 math macros in terms of
* builtins specific to the Studio compiler, in particular not
* compatible with the GNU compiler.
diff --git a/fixincludes/tests/base/complex.h b/fixincludes/tests/base/complex.h
index 9a54e8c0bda..b3fe27aca2e 100644
--- a/fixincludes/tests/base/complex.h
+++ b/fixincludes/tests/base/complex.h
@@ -33,3 +33,13 @@
#undef I
#define I _Complex_I
#endif /* SOLARIS_COMPLEX_CHECK */
+
+
+#if defined( SOLARIS_COMPLEX_CXX_CHECK )
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef __cplusplus
+}
+#endif
+#endif /* SOLARIS_COMPLEX_CXX_CHECK */
diff --git a/fixincludes/tests/base/sys/feature_tests.h b/fixincludes/tests/base/sys/feature_tests.h
new file mode 100644
index 00000000000..3bb803c288d
--- /dev/null
+++ b/fixincludes/tests/base/sys/feature_tests.h
@@ -0,0 +1,18 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/sys/feature_tests.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( SOLARIS___RESTRICT_CHECK )
+#ifdef __cplusplus
+#define _RESTRICT_KYWD __restrict
+#else
+#define _RESTRICT_KYWD restrict
+#endif
+#endif /* SOLARIS___RESTRICT_CHECK */
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 261b202b35e..40522695b58 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,4735 @@
+2010-07-01 López-Ibáñez <manu@gcc.gnu.org>
+
+ * reload.c: Include toplev.h.
+ * recog.c: Likewise.
+ * Makefile.in: Adjust dependencies.
+
+2010-07-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/44694
+ * dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
+ or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.
+
+2010-07-01 Richard Guenther <rguenther@suse.de>
+
+ * emit-rtl.c (set_mem_attributes_minus_bitpos): Use unsigned
+ types for offsets.
+
+2010-07-01 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR target/44732
+ * config/ia64/ia64.c (ia64_register_move_cost): Remove stray '{'.
+
+ * config/ia64/ia64.c (ia64_register_move_cost): Fix argument types.
+
+2010-07-01 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR target/44727
+ * config/i386/i386.md (peephole2 for arithmetic ops with memory):
+ Make sure operand 0 dies.
+
+2010-07-01 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/42834
+ PR middle-end/44468
+ * doc/gimple.texi (is_gimple_mem_ref_addr): Document.
+ * doc/generic.texi (References to storage): Document MEM_REF.
+ * tree-pretty-print.c (dump_generic_node): Handle MEM_REF.
+ (print_call_name): Likewise.
+ * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF.
+ (build_simple_mem_ref_loc): New function.
+ (mem_ref_offset): Likewise.
+ * tree.h (build_simple_mem_ref_loc): Declare.
+ (build_simple_mem_ref): Define.
+ (mem_ref_offset): Declare.
+ * fold-const.c: Include tree-flow.h.
+ (operand_equal_p): Handle MEM_REF.
+ (build_fold_addr_expr_with_type_loc): Likewise.
+ (fold_comparison): Likewise.
+ (fold_unary_loc): Fold
+ VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>.
+ (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2],
+ fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2].
+ * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF.
+ (ptr_deref_may_alias_ref_p_1): Likewise.
+ (ao_ref_base_alias_set): Properly differentiate base object for
+ offset and TBAA.
+ (ao_ref_init_from_ptr_and_size): Use MEM_REF.
+ (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly.
+ (indirect_refs_may_alias_p): Likewise.
+ (refs_may_alias_p_1): Likewise. Remove pointer SSA name def
+ chasing code.
+ (ref_maybe_used_by_call_p_1): Handle MEM_REF.
+ (call_may_clobber_ref_p_1): Likewise.
+ * dwarf2out.c (loc_list_from_tree): Handle MEM_REF.
+ * expr.c (expand_assignment): Handle MEM_REF.
+ (store_expr): Handle MEM_REFs from STRING_CSTs.
+ (store_field): If expanding a MEM_REF of a non-addressable
+ decl use bitfield operations.
+ (get_inner_reference): Handle MEM_REF.
+ (expand_expr_addr_expr_1): Likewise.
+ (expand_expr_real_1): Likewise.
+ * tree-eh.c (tree_could_trap_p): Handle MEM_REF.
+ * alias.c (ao_ref_from_mem): Handle MEM_REF.
+ (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs.
+ * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF.
+ (dr_analyze_indices): Likewise.
+ (dr_analyze_alias): Likewise.
+ (object_address_invariant_in_loop_p): Likewise.
+ * gimplify.c (mark_addressable): Handle MEM_REF.
+ (gimplify_cond_expr): Build MEM_REFs.
+ (gimplify_modify_expr_to_memcpy): Likewise.
+ (gimplify_init_ctor_preeval_1): Handle MEM_REF.
+ (gimple_fold_indirect_ref): Adjust.
+ (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF.
+ * tree.def (MEM_REF): New tree code.
+ * tree-dfa.c: Include toplev.h.
+ (get_ref_base_and_extent): Handle MEM_REF.
+ (get_addr_base_and_unit_offset): New function.
+ * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF.
+ * gimple-fold.c (may_propagate_address_into_dereference): Handle
+ MEM_REF.
+ (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds
+ accesses if the array has just one dimension. Remove always true
+ parameter. Do not require type compatibility here.
+ (maybe_fold_offset_to_component_ref): Remove.
+ (maybe_fold_stmt_indirect): Remove.
+ (maybe_fold_reference): Remove INDIRECT_REF handling.
+ Fold back to non-MEM_REF.
+ (maybe_fold_offset_to_address): Simplify. Deal with type
+ mismatches here.
+ (maybe_fold_reference): Likewise.
+ (maybe_fold_stmt_addition): Likewise. Also handle
+ &ARRAY + I in addition to &ARRAY[0] + I.
+ (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs.
+ (gimple_get_relevant_ref_binfo): Handle MEM_REF.
+ * cfgexpand.c (expand_debug_expr): Handle MEM_REF.
+ * tree-ssa.c (useless_type_conversion_p): Make most pointer
+ conversions useless.
+ (warn_uninitialized_var): Handle MEM_REF.
+ (maybe_rewrite_mem_ref_base): New function.
+ (execute_update_addresses_taken): Implement re-writing of MEM_REFs
+ to SSA form.
+ * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove
+ INDIRECT_REF handling.
+ (copy_tree_body_r): Handle MEM_REF.
+ * gimple.c (is_gimple_addressable): Adjust.
+ (is_gimple_address): Likewise.
+ (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with
+ invariant base are invariant.
+ (is_gimple_min_lval): Adjust.
+ (is_gimple_mem_ref_addr): New function.
+ (get_base_address): Handle MEM_REF.
+ (count_ptr_derefs): Likewise.
+ (get_base_loadstore): Likewise.
+ * gimple.h (is_gimple_mem_ref_addr): Declare.
+ (gimple_call_fndecl): Handle invariant MEM_REF addresses.
+ * tree-cfg.c (verify_address): New function, split out from ...
+ (verify_expr): ... here. Use for verifying ADDR_EXPRs and
+ the address operand of MEM_REFs. Verify MEM_REFs. Reject
+ INDIRECT_REFs.
+ (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow
+ INDIRECT_REF. Allow conversions.
+ (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of
+ a register does not change its size.
+ (verify_types_in_gimple_reference): Verify MEM_REF.
+ (verify_gimple_assign_single): Disallow INDIRECT_REF.
+ Handle MEM_REF.
+ * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable):
+ New.
+ (mark_address_taken): Handle MEM_REF.
+ (get_indirect_ref_operands): Pass through opf_not_non_addressable.
+ (get_asm_expr_operands): Pass opf_not_non_addressable.
+ (get_expr_operands): Handle opf_[not_]non_addressable.
+ Handle MEM_REF. Remove INDIRECT_REF handling.
+ * tree-vrp.c: (check_array_ref): Handle MEM_REF.
+ (search_for_addr_array): Likewise.
+ (check_array_bounds): Likewise.
+ (vrp_stmt_computes_nonzero): Adjust for MEM_REF.
+ * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF.
+ (ref_always_accessed_p): Likewise.
+ (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR.
+ * tree-complex.c (extract_component): Do not handle INDIRECT_REF.
+ Handle MEM_REF.
+ * cgraphbuild.c (mark_load): Properly check for NULL result
+ from get_base_address.
+ (mark_store): Likewise.
+ * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF.
+ * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF
+ handling for MEM_REF.
+ * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle
+ &MEM[ptr + CST] similar to POINTER_PLUS_EXPR.
+ * builtins.c (stabilize_va_list_loc): Use the function ABI
+ valist type if we couldn't canonicalize the argument type.
+ Always dereference with the canonical va-list type.
+ (maybe_emit_free_warning): Handle MEM_REF.
+ (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding
+ memmove to memcpy.
+ * builtins.c (fold_builtin_memory_op): Use ref-all types
+ for all memcpy foldings.
+ * omp-low.c (build_receiver_ref): Adjust for MEM_REF.
+ (build_outer_var_ref): Likewise.
+ (scan_omp_1_op): Likewise.
+ (lower_rec_input_clauses): Likewise.
+ (lower_lastprivate_clauses): Likewise.
+ (lower_reduction_clauses): Likewise.
+ (lower_copyprivate_clauses): Likewise.
+ (expand_omp_atomic_pipeline): Likewise.
+ (expand_omp_atomic_mutex): Likewise.
+ (create_task_copyfn): Likewise.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF.
+ Remove old union trick. Initialize constant offsets.
+ (ao_ref_init_from_vn_reference): Likewise. Do not handle
+ INDIRECT_REF. Init base_alias_set properly.
+ (vn_reference_lookup_3): Replace INDIRECT_REF handling with
+ MEM_REF.
+ (vn_reference_fold_indirect): Adjust for MEM_REFs.
+ (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset
+ for ARRAY_REFs.
+ (may_insert): Remove.
+ (visit_reference_op_load): Do not test may_insert.
+ (run_scc_vn): Remove parameter, do not fiddle with may_insert.
+ * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add
+ a field to store the constant offset this op applies.
+ (run_scc_vn): Adjust prototype.
+ * cgraphunit.c (thunk_adjust): Adjust for MEM_REF.
+ * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with
+ MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not
+ bother about volatile qualifiers on pointers.
+ (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF.
+ * tree-ssa-loop-ivopts.c
+ * tree-ssa-loop-ivopts.c (determine_base_object): Adjust
+ for MEM_REF.
+ (strip_offset_1): Likewise.
+ (find_interesting_uses_address): Replace INDIRECT_REF handling with
+ MEM_REF handling.
+ (get_computation_cost_at): Likewise.
+ * ipa-pure-const.c (check_op): Handle MEM_REF.
+ * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF.
+ * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF
+ and constants.
+ * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF.
+ * tree-parloops.c (take_address_of): Adjust for MEM_REF.
+ (eliminate_local_variables_1): Likewise.
+ (create_call_for_reduction_1): Likewise.
+ (create_loads_for_reductions): Likewise.
+ (create_loads_and_stores_for_name): Likewise.
+ * matrix-reorg.c (may_flatten_matrices_1): Sanitize.
+ (ssa_accessed_in_tree): Handle MEM_REF.
+ (ssa_accessed_in_assign_rhs): Likewise.
+ (update_type_size): Likewise.
+ (analyze_accesses_for_call_stmt): Likewise.
+ (analyze_accesses_for_assign_stmt): Likewise.
+ (transform_access_sites): Likewise.
+ (transform_allocation_sites): Likewise.
+ * tree-affine.c (tree_to_aff_combination): Handle MEM_REF.
+ * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do
+ not handle INDIRECT_REF.
+ * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF.
+ (cond_store_replacement): Likewise.
+ * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle
+ MEM_REF, no not handle INDIRECT_REFs.
+ (insert_into_preds_of_block): Properly initialize avail.
+ (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset
+ for ARRAY_REFs. Properly handle reference lookups that
+ require a bit re-interpretation.
+ (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF.
+ * tree-sra.c
+ * tree-sra.c (build_access_from_expr_1): Handle MEM_REF.
+ (build_ref_for_offset_1): Remove.
+ (build_ref_for_offset): Build MEM_REFs.
+ (gate_intra_sra): Disable for now.
+ (sra_ipa_modify_expr): Handle MEM_REF.
+ (ipa_early_sra_gate): Disable for now.
+ * tree-sra.c (create_access): Swap INDIRECT_REF handling for
+ MEM_REF handling.
+ (disqualify_base_of_expr): Likewise.
+ (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for
+ MEM_REF handling.
+ (sra_ipa_modify_expr): Remove INDIRECT_REF handling.
+ Use mem_ref_offset. Remove bogus folding.
+ (build_access_from_expr_1): Properly handle MEM_REF for
+ non IPA-SRA.
+ (make_fancy_name_1): Add support for MEM_REF.
+ * tree-predcom.c (ref_at_iteration): Handle MEM_REFs.
+ * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF.
+ * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF.
+ (compute_complex_ancestor_jump_func): Likewise.
+ (ipa_analyze_virtual_call_uses): Likewise.
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace
+ INDIRECT_REF folding with more generalized MEM_REF folding.
+ (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly.
+ (forward_propagate_addr_into_variable_array_index): Also handle
+ &ARRAY + I in addition to &ARRAY[0] + I.
+ * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF.
+ * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that
+ creates assignments with overlap.
+ * tree-nested.c (get_static_chain): Adjust for MEM_REF.
+ (get_frame_field): Likewise.
+ (get_nonlocal_debug_decl): Likewise.
+ (convert_nonlocal_reference_op): Likewise.
+ (struct nesting_info): Add mem_refs pointer-set.
+ (create_nesting_tree): Allocate it.
+ (convert_local_reference_op): Insert to be folded mem-refs.
+ (fold_mem_refs): New function.
+ (finalize_nesting_tree_1): Perform defered folding of mem-refs
+ (free_nesting_tree): Free the pointer-set.
+ * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF.
+ (vectorizable_load): Likewise.
+ * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF.
+ (propagate_with_phi): Likewise.
+ * tree-object-size.c (addr_object_size): Handle MEM_REFs
+ instead of INDIRECT_REFs.
+ (compute_object_offset): Handle MEM_REF.
+ (plus_stmt_object_size): Handle MEM_REF.
+ (collect_object_sizes_for): Dispatch to plus_stmt_object_size
+ for &MEM_REF.
+ * tree-flow.h (get_addr_base_and_unit_offset): Declare.
+ (symbol_marked_for_renaming): Likewise.
+ * Makefile.in (tree-dfa.o): Add $(TOPLEV_H).
+ (fold-const.o): Add $(TREE_FLOW_H).
+ * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF.
+ (find_func_clobbers): Likewise.
+ * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF.
+ (decompose_access): Likewise.
+ (replace_field_acc): Likewise.
+ (replace_field_access_stmt): Likewise.
+ (insert_new_var_in_stmt): Likewise.
+ (get_stmt_accesses): Likewise.
+ (reorg_structs_drive): Disable.
+ * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF.
+ (ix86_canonical_va_list_type): Likewise.
+
+2010-06-30 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR other/44566
+ * coretypes.h [!USED_FOR_TARGET] (reg_class_t): Define.
+ * target.def (struct gcc_target): Replace enum reg_class with
+ reg_class_t in hook argument / return types.
+ * doc/tm.texi.in (TARGET_SECONDARY_RELOAD): Likewise.
+ (TARGET_IRA_COVER_CLASSES, TARGET_MEMORY_MOVE_COST): Likewise.
+ (TARGET_BRANCH_TARGET_REGISTER_CLASS): Likewise.
+ * targhooks.h (default_branch_target_register_class): Likewise.
+ (default_ira_cover_classes, default_secondary_reload): Likewise.
+ (default_memory_move_cost, default_register_move_cost): Likewise.
+ * targhooks.c (default_branch_target_register_class): Likewise.
+ (default_ira_cover_classes, default_secondary_reload): Likewise.
+ (default_memory_move_cost, default_register_move_cost): Likewise.
+ * reload.c (push_secondary_reload, secondary_reload_class): Likewise.
+ * bt-load.c (branch_target_load_optimize): Likewise.
+ * ira.c (setup_cover_and_important_classes): Likewise.
+ * ira-costs.c (copy_cost): Likewise.
+ * reload1.c (emit_input_reload_insns): Likewise.
+ * config/alpha/alpha.c (alpha_secondary_reload): Likewise.
+ * config/frv/frv.c (frv_secondary_reload): Likewise.
+ * config/s390/s390.c (s390_secondary_reload): Likewise.
+ * config/i386/i386.c (i386_ira_cover_classes): Likewise.
+ (ix86_secondary_reload, ix86_memory_move_cost): Likewise.
+ (ix86_register_move_cost): Likewise.
+ * config/sh/sh-protos.h (sh_secondary_reload): Likewise.
+ * config/sh/sh.c (sh_target_reg_class, sh_secondary_reload): Likewise.
+ * config/xtensa/xtensa.c (xtensa_secondary_reload): Likewise.
+ * config/xtensa/xtensa-protos.h (xtensa_secondary_reload): Likewise.
+ * config/rs6000/rs6000.c (rs6000_secondary_reload): Likewise.
+ (rs6000_ira_cover_classes): Likewise.
+ * config/picochip/picochip.c (picochip_secondary_reload): Likewise.
+ * config/picochip/picochip-protos.h (picochip_secondary_reload):
+ Likewise.
+ * config/pa/pa.c (pa_secondary_reload): Likewise.
+ * config/mips/mips.c (mips_ira_cover_classes): Likewise.
+ * config/bfin/bfin.c (bfin_secondary_reload): Likewise.
+ * config/ia64/ia64.c (ia64_register_move_cost): Likewise.
+ * doc/tm.texi: Regenerate.
+
+2010-06-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR bootstrrap/44726
+ * graphite-sese-to-poly.c (build_poly_dr): Avoid uninitialized
+ use.
+ (build_alias_set_optimal_p): Likewise.
+ (build_base_obj_set_for_drs): Likewise.
+
+2010-06-30 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * target.def: Remove comment about licensing problems of function
+ declarations.
+
+ * target.def (declare_constant_name): Change exp to expr. Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_ASM_DECLARE_CONSTANT_NAME): Use @hook.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (builtin_reciprocal): Change tm_fn to md_fn. Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_BUILTIN_RECIPROCAL): Use @hook.
+
+ * target.def (enum_va_list_p): Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_ENUM_VA_LIST_P): Use @hook.
+ Rename ptype to ptree.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (fold_builtin): Rename nargs to n_args. Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_FOLD_BUILTIN): Use @hook.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (memory_move_cost): Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_MEMORY_MOVE_COST): Use @hook.
+ Rename regclass AKA class to rclass.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (pragma_parse): Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_OPTION_PRAGMA_PARSE): Use @hook.
+ s/TARGET_VALID_OPTION_ATTRIBUTE_P/TARGET_OPTION_VALID_ATRIBUTE_P/ .
+ * doc/tm.texi: Regenerate.
+
+ * target.def (pass_by_reference): Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_PASS_BY_REFERENCE): Use @hook.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (resolve_overloaded_builtin): Rename params to arglist.
+ Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_RESOLVE_OVERLOADED_BUILTIN): Use @hook.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (return_pops_args): Use DEFHOOK.
+ * doc/tm.texi.in (TARGET_RETURN_POPS_ARGS): Use @hook.
+ Rename stack-size to size.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (dfa_new_cycle): Use DEFHOOK. Rename dump_file to dump,
+ last-sched_cycle to last_clock, cur_cycle to clock.
+ * doc/tm.texi.in: Use @hook.
+ * doc/tm.texi: Regenerate.
+
+ * target.def (print_operand, print_operand_address): Update comment.
+ (print_operand_punct_valid_p): Likewise.
+
+2010-06-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * toplev.h (_fatal_insn_not_found, _fatal_insn): Move declarations
+ to rtl.h.
+ (error_for_asm, warning_for_asm): Move declarations to rtl-error.h.
+ * rtl.h (_fatal_insn_not_found, _fatal_insn): Move declarations
+ here.
+ * rtl-error.h: New.
+ * regrename.c: Do not include toplev.h. Include rtl-error.h.
+ * rtl-error.c: Likewise.
+ * reload.c: Likewise.
+ * recog.c: Likewise.
+ * sel-sched.c: Likewise.
+ * function.c: Likewise.
+ * reg-stack.c: Likewise.
+ * cfgrtl.c: Likewise.
+ * reload1.c: Likewise.
+ * final.c: Include rtl-error.
+ * Makefile.in: Adjust dependencies.
+
+2010-06-30 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/PR44706
+ * ipa-split (split_function): Refine conditions when to use DECL_RESULT
+ to return the value.
+
+2010-06-30 Michael Matz <matz@suse.de>
+
+ PR bootstrap/44699
+ * tree-vrp.c (vrp_finalize): Deal with changing num_ssa_names.
+ * gimple-fold.c (gimplify_and_update_call_from_tree): If LHS is
+ a gimple reg, attach the original VDEF to the last store in the
+ sequence.
+
+2010-06-30 Iain Sandoe <iains@gcc.gnu.org>
+
+ PR other/44034
+ * config/darwin.c (darwin_override_options): Use renamed
+ targetm.asm_out.emit_unwind_label.
+
+2010-06-30 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR tree-optimization/39799
+ * tree-inline.c (remap_ssa_name): Initialize variable only if
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
+
+2010-06-30 Nathan Froyd <froydnj@codesourcery.com>
+
+ * c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block.
+
+2010-06-30 Richard Guenther <rguenther@suse.de>
+
+ PR target/44722
+ * config/i386/i386.md (peephole2 for fix:SSEMODEI24): Guard
+ against oscillation with reverse peephole2.
+
+2010-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44721
+ * config/i386/i386.md (peephole2 for arithmetic ops with memory):
+ Fix last commit.
+
+2010-06-30 Nick Clifton <nickc@redhat.com>
+
+ * config/rx/rx-modes.def: New file.
+ * config/rx/rx.h (FIRST_PSEUDO_REGISTER): Increase to 17.
+ (CC_REGNUM): Define.
+ (FIXED_REGISTERS, CALL_USED_REGISTERS, REGISTER_NAMES): Add cc
+ register.
+ (CC_NO_CARRY, NOTICE_UPDATE_CC): Delete.
+ (SELECT_CC_MODE): Define.
+ * config/rx/rx.md (CC_REG): Define. Update all patterns to use
+ (reg:CC CC_REG) instead of (cc0).
+ (attr "cc"): Delete.
+ (cbranchsi4): Do not split compare and branch here. Instead move
+ it to...
+ (cbranchsi4_<code>): ... here. New patterns.
+ (cmpsi): Call rx-compare_redundant to find out if it is necessary
+ to emit the compare instruction.
+ * config/rx/rx.c (rx_gen-cond_branch_template): Remove tests of
+ cc_status flags.
+ (rx_get_stack_layout): Iterate up to before CC_REGNUM not
+ FIRST_PSEUDO_REGNUM.
+ (rx_expand_prologue, rx_expand_epilogue): Likewise.
+ (rx_notice_update_cc): Delete.
+ (rx_cc_modes_compatible): New function.
+ (flags_needed_for_conditional): New function.
+ (flags_from_mode): New function.
+ (rx_compare_redundant): New function - scans backwards through
+ insn list to find out if condition flags are already set
+ correctly.
+ (TARGET_CC_MODES_COMPATIBLE): Define.
+ * config/rx/rx-protos.h (rx_compare_redundant): Prototype.
+
+ * config/rx/rx.h (BRANCH_COST): Define.
+ (REGISTER_MOVE_COST): Define.
+ * config/rx/predicates (rx_source_operand): Allow all constant
+ types.
+ * config/rx/rx.md (addsi3): Add alternative for swapped operands.
+ (tstsi4): New pattern.
+ * config/rx/rx.c (rx_memory_move_cost): Define.
+ (TARGET_MEMORY_MOVE_COST): Define.
+
+2010-06-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * tree.h (block_may_fallthru): Declare here.
+ * tree-flow.h (block_may_fallthru): Do not declare here.
+ * c-typeck.c: Do not include tree-flow.h. Include gimple.h and
+ bitmap.h
+ * Makefile.in (c-typeck.o): Update dependencies.
+
+2010-06-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/44694
+ * cselib.h (cselib_preserve_cfa_base_value): Add regno argument.
+ * cselib.c (cfa_base_preserved_regno): New static variable.
+ (cselib_reset_table): Don't reset cfa_base_preserved_regno instead
+ of REGNO (cfa_base_preserved_val->locs->loc).
+ (cselib_preserve_cfa_base_value): Add regno argument, set
+ cfa_base_preserved_regno to it.
+ (cselib_invalidate_regno): Allow removal of registers other than
+ cfa_base_preserved_regno from cfa_base_preserved_val.
+ (cselib_finish): Set cfa_base_preserved_regno to INVALID_REGNUM.
+ * var-tracking.c (adjust_mems): Replace sp or hfp even outside
+ of MEM addresses, if not on LHS.
+ (reverse_op): Don't add reverse ops for cfa_base_rtx.
+ (vt_init_cfa_base): Adjust cselib_preserve_cfa_base_value caller.
+
+2010-06-30 Bernd Schmidt <bernds@codesourcery.com>
+
+ * recog.c (peep2_do_rebuild_jump_labels, peep2_do_cleanup_cfg): New
+ static variables.
+ (peep2_buf_position): New static function.
+ (peep2_regno_dead_p, peep2_reg_dead_p, peep2_find_free_register,
+ peephole2_optimize): Use it.
+ (peep2_attempt, peep2_update_life): New static functions, broken out
+ of peephole2_optimize.
+ (peep2_fill_buffer): New static function.
+ (peephole2_optimize): Change the main loop to try to fill the buffer
+ with the maximum number of insns before matching them against
+ peepholes. Use a forward scan. Remove special case for targets with
+ conditional execution.
+ * genrecog.c (change_state): Delete dead code.
+ * config/i386/i386.md (peephole2 for arithmetic ops with memory):
+ Rewrite so as not to expect the second insn to have had a peephole
+ applied yet.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * genhooks.c (emit_findices): Cast field precision to int.
+ (emit_documentation): Likewise.
+
+2010-06-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/43801
+ * cgraph.c (cgraph_create_virtual_clone): Clear DECL_SECTION_NAME
+ if old_decl was DECL_ONE_ONLY.
+
+ PR debug/44668
+ * dwarf2out.c (add_accessibility_attribute): New function.
+ (gen_subprogram_die, gen_variable_die, gen_field_die): Use it
+ instead of adding DW_AT_accessibility manually.
+ (gen_enumeration_type_die, gen_struct_or_union_type_die,
+ gen_typedef_die): Use it.
+
+2010-06-29 Douglas B Rupp <rupp@gnat.com>
+
+ * vmsdbgout.c (full_name): Just output the file name if not native.
+
+2010-06-29 Douglas B Rupp <rupp@gnat.com>
+
+ * vmsdbgout.c (func_table): Replace with VEC func{nam,num}_tables.
+ (funcnam_table): New static table.
+ (funcnum_table): New static table.
+ (write_rtnbeg): Write value saved in funcnum_table.
+ (write_rtnend): Write value saved in funcnum_table.
+ (vmsdbgout_begin_function): Save current function info in
+ (vmsdbgout_init): Initialize func{nam,num}_tables. Minor reformatting.
+ (vmsdbgout_finish): Iterate over funcnum_table.
+
+2010-06-29 Douglas B Rupp <rupp@gnat.com>
+
+ * vmsdbgout.c (vmsdbgout_begin_epilogue): Declare
+ (vmsdbgout_type_decl): Declare
+ (vmsdbg_debug_hooks): Add entry for type_decl and begin_epilogue.
+ (FUNC_EPILOGUE_LABEL): New macro
+ (vmsdbgout_begin_epilogue): New function.
+ (vmsdbgout_type_decl): New function.
+
+2010-06-29 Douglas B Rupp <rupp@gnat.com>
+
+ * vmsdbg.h: Update copyright.
+
+2010-06-29 Douglas B Rupp <rupp@gnat.com>
+
+ * vmsdbg.h (DST_K_TBG): New DST constant.
+ * vmsdbgout.c (addr_const_to_string): Removed, not referenced.
+ (write_modbeg): Cast module_language to avoid warning.
+ (write_rtnbeg): Use DST_K_TBG vice magic mystery number.
+
+2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR other/44034
+ * target.def, doc/tm.texi.in, genhooks.c: New files.
+ * target.h: Instead of defining individual hook members,
+ define DEFHOOKPOD / DEFHOOK / DEFHOOK_UNDOC / HOOKSTRUCT and
+ include target.def.
+ * target-def.h: Instead of defining individual hook initializers,
+ include target-hooks-def.h.
+ * df-scan.c, haifa-sched.c, sel-sched.c: Rename targetm members:
+ targetm.live_on_entry -> targetm.extra_live_on_entry
+ targetm.sched.md_finish ->targetm.sched.finish
+ targetm.sched.md_init -> targetm.sched.init
+ targetm.sched.md_init_global -> targetm.sched.init_global
+ targetm.asm_out.unwind_label -> targetm.asm_out.emit_unwind_label
+ targetm.asm_out.except_table_label ->
+ targetm.asm_out.emit_except_table_label
+ targetm.asm_out.visibility -> targetm.asm_out.assemble_visibility
+ targetm.target_help -> targetm.help
+ targetm.vectorize.builtin_support_vector_misalignment ->
+ targetm.vectorize.support_vector_misalignment
+ targetm.file_start_app_off -> targetm.asm_file_start_app_off
+ targetm.file_start_file_directive ->
+ targetm.asm_file_start_file_directive
+ * dwarf2out.c, opts.c, tree-vect-data-refs.c, except.c: Likewise.
+ * varasm.c, config/alpha/alpha.c, config/cris/cris.c: Likewise.
+ * gcc/config/spu/spu.c, config/ia64/ia64.c: Rename target macros:
+ TARGET_VECTOR_ALIGNMENT_REACHABLE ->
+ TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
+ TARGET_SUPPORT_VECTOR_MISALIGNMENT ->
+ TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
+ TARGET_UNWIND_EMIT -> TARGET_ASM_UNWIND_EMIT
+ * config/rs6000/rs6000.c, config/arm/arm.c: Likewise.
+ * Makefile.in (TARGET_H): Depend on target.def.
+ (TARGET_DEF_H): Depend on target-hooks-def.h.
+ (target-hooks-def.h, tm.texi, s-target-hooks-def-h): New rules.
+ (s-tm-texi, build/genhooks.o, build/genhooks): Likewise.
+ * doc/tm.texi: Regenerate.
+
+ * Makefile.in (s-tm-texi): Remove stray tab / rule.
+
+ * config/m68k/m68k.c (targetm.sched.init_global): Update comment.
+ (targetm.sched.init): Likewise.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ PR bootstrap/44713
+ * config/i386/i386.c (type_natural_mode): Const-ify CUM parameter.
+ (function_arg_advance_32): Const-ify TYPE parameter.
+ (function_arg_advance_64): Likewise. Change type of NAMED to bool.
+ (ix86_function_arg_advance): Change type of NAMED to bool.
+ (function_arg_32): Const-ify CUM and TYPE parameters.
+ (function_arg_64): Likewise. Change type of NAMED to bool.
+ (function_arg_ms_64): Const-ify CUM parameter. Change type of NAMED
+ to bool.
+ (ix86_function_arg): Change type of NAMED to bool.
+ (ix86_setup_incoming_varargs): Call ix86_function_arg_advance. Pass
+ last argument as a bool.
+
+2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * doc/tm.texi (TARGET_OPTION_OVERRIDE): Document.
+ (OVERRIDE_OPTIONS): Add note of obsolescence.
+ Replace references with references to TARGET_OPTION_OVERRIDE.
+ (Except for C_COMMON_OVERRIDE_OPTIONS, which remains similar to
+ the macro).
+ * targhooks.c (default_target_option_override): New function.
+ * targhooks.h (default_target_option_override): Declare.
+ * target.h (struct gcc_target): Add override member to
+ target_option member.
+ * toplev.c (process_options): Replace OVERRIDE_OPTIONS use with
+ targetm.target_option.override call.
+ * target-def.h (TARGET_OPTION_OVERRIDE): Define.
+ (TARGET_OPTION_HOOKS): Add TARGET_OPTION_OVERRIDE.
+
+2010-06-29 Jan Hubicka <jh@suse.cz>
+
+ * tree-inline.c: Replace incomming by incomin and clonning by cloning.
+
+2010-06-29 Jan Hubicka <jh@suse.cz>
+
+ * predict.c (propagate_freq): Clear EXIT_BLOCK_PTR frequency if it is
+ unreachable.
+ (rebuild_frequencies): New function.
+ * predict.h (rebuild_frequencies): Declare.
+ * tree-inline.c (copy_cfg_body): Compute properly count & frequency of
+ entry block and edge reaching new_entry.
+ (tree_function_versioning): When doing partial cloning, rebuild frequencies
+ when done.
+ * passes.c (execute_function_todo): Use rebild_frequencies.
+
+2010-06-29 Richard Guenther <rguenther@suse.de>
+
+ * tree-dfa.c (dump_variable): Remove noalias_state dumping.
+ * tree-flow.h (enum noalias_state): Remove.
+ (struct var_ann_d): Remove noalias_state member.
+
+2010-06-29 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR target/43902
+ * config/arm/arm.md (maddsidi4, umaddsidi4): New expanders.
+ (maddhisi4): Renamed from mulhisi3addsi. Operands renumbered.
+ (maddhidi4): Likewise.
+
+ Revert parts of the change for PR25130.
+ * cse.c (exp_equiv_p): For MEMs, if for_gcse, only compare
+ MEM_ALIAS_SET.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * calls.c, dse.c, expr.c, function.c: Call targetm.calls.function_arg,
+ targetm.calls.function_incoming_arg, and
+ targetm.calls.function_arg_advance instead of FUNCTION_ARG,
+ FUNCTION_INCOMING_ARG, and FUNCTION_ARG_ADVANCE, respectively.
+ * target.h (struct gcc_target): Add function_arg_advance,
+ function_arg, and function_incoming_arg fields.
+ * target-def.h (TARGET_FUNCTION_ARG_ADVANCE, TARGET_FUNCTION_ARG):
+ (TARGET_FUNCTION_INCOMING_ARG): Define.
+ (TARGET_CALLS): Add TARGET_FUNCTION_ARG_ADVANCE, TARGET_FUNCTION_ARG,
+ and TARGET_FUNCTION_INCOMING_ARG.
+ * targhooks.h (default_function_arg_advance): Declare.
+ (default_function_arg, default_function_incoming_arg): Declare.
+ * targhooks.c (default_function_arg_advance): New function.
+ (default_function_arg, default_function_incoming_arg): New function.
+ * config/i386/i386.c (function_arg_advance): Rename to...
+ (ix86_function_arg_advance): ...this. Make static.
+ (function_arg): Rename to...
+ (ix86_function_arg): ...this. Make static.
+ (TARGET_FUNCTION_ARG_ADVANCE): Define.
+ (TARGET_FUNCTION_ARG): Define.
+ * config/i386/i386.h (FUNCTION_ARG_ADVANCE): Delete.
+ (FUNCTION_ARG): Delete.
+ * config/i386/i386-protos.h (function_arg_advance): Delete prototype.
+ (function_arg): Delete prototype.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * reginfo.c (init_reg_sets_1): Adjust comments.
+ * combine-stack-adj.c (rest_of_handle_stack_adjustments): Likewise.
+ * calls.c (prepare_call_address): Likewise.
+ (emit_call_1): Use targetm.calls.return_pops_args.
+ (expand_call): Likewise.
+ * function.c (assign_parms): Likewise.
+ * system.h (RETURN_POPS_ARGS): Add to #pragma poison list.
+ * target.h (struct gcc_target) [struct calls]: Add
+ return_pops_args field.
+ * targhooks.h (default_return_pops_args): Declare.
+ * targhooks.c (default_return_pops_args): Define.
+ * target-def.h (TARGET_RETURN_POPS_ARGS): Define.
+ (TARGET_CALLS): Add TARGET_RETURN_POPS_ARGS.
+ * doc/tm.texi (RETURN_POPS_ARGS): Rename to...
+ (TARGET_RETURN_POPS_ARGS): ...this. Use deftypefn. Adjust
+ documentation.
+ * config/alpha/alpha.h (RETURN_POPS_ARGS): Delete.
+ * config/arc/arc.h (RETURN_POPS_ARGS): Likewise.
+ * config/arm/arm.h (RETURN_POPS_ARGS): Likewise.
+ * config/avr/avr.h (RETURN_POPS_ARGS): Likewise.
+ * config/bfin/bfin.h (RETURN_POPS_ARGS): Likewise.
+ * config/cris/cris.h (RETURN_POPS_ARGS): Likewise.
+ * config/crx/crx.h (RETURN_POPS_ARGS): Likewise.
+ * config/fr30/fr30.h (RETURN_POPS_ARGS): Likewise.
+ * config/frv/frv.h (RETURN_POPS_ARGS): Likewise.
+ * config/h8300/h8300.h (RETURN_POPS_ARGS): Likewise.
+ * config/ia64/ia64.h (RETURN_POPS_ARGS): Likewise.
+ * config/iq2000/iq2000.h (RETURN_POPS_ARGS): Likewise.
+ * config/lm32/lm32.h (RETURN_POPS_ARGS): Likewise.
+ * config/m32c/m32c.h (RETURN_POPS_ARGS): Likewise.
+ * config/m32r/m32r.h (RETURN_POPS_ARGS): Likewise.
+ * config/m68hc11/m68hc11.h (RETURN_POPS_ARGS): Likewise.
+ * config/mcore/mcore.h (RETURN_POPS_ARGS): Likewise.
+ * config/mep/mep.h (RETURN_POPS_ARGS): Likewise.
+ * config/mips/mips.h (RETURN_POPS_ARGS): Likewise.
+ * config/mmix/mmix.h (RETURN_POPS_ARGS): Likewise.
+ * config/mn10300/mn10300.h (RETURN_POPS_ARGS): Likewise.
+ * config/moxie/moxie.h (RETURN_POPS_ARGS): Likewise.
+ * config/pa/pa.h (RETURN_POPS_ARGS): Likewise.
+ * config/pdp11/pdp11.h (RETURN_POPS_ARGS): Likewise.
+ * config/picochip/picochip.h (RETURN_POPS_ARGS): Likewise.
+ * config/rs6000/rs6000.h (RETURN_POPS_ARGS): Likewise.
+ * config/rx/rx.h (RETURN_POPS_ARGS): Likewise.
+ * config/s390/s390.h (RETURN_POPS_ARGS): Likewise.
+ * config/score/score.h (RETURN_POPS_ARGS): Likewise.
+ * config/sh/sh.h (RETURN_POPS_ARGS): Likewise.
+ * config/sparc/sparc.h (RETURN_POPS_ARGS): Likewise.
+ * config/spu/spu.h (RETURN_POPS_ARGS): Likewise.
+ * config/stormy16/stormy16.h (RETURN_POPS_ARGS): Likewise.
+ * config/v850/v850.h (RETURN_POPS_ARGS): Likewise.
+ * config/xtensa/xtensa.h (RETURN_POPS_ARGS): Likewise.
+ * config/i386/i386-protos.h (ix86_return_pops_args): Delete.
+ * config/i386/i386.h (RETURN_POPS_ARGS): Delete.
+ * config/i386/i386.c (ix86_return_pops_args): Make static.
+ Constify arguments.
+ (TARGET_RETURN_POPS_ARGS): Define.
+ * config/m68k/m68k.h (RETURN_POPS_ARGS): Move to...
+ * config/m68k/m68k.c (m68k_return_pops_args): ...here. New function.
+ (TARGET_RETURN_POPS_ARGS): Define.
+ * config/vax/vax.h (RETURN_POPS_ARGS): Move to...
+ * config/vax/vax.c (vax_return_pops_args): ...here. New function.
+ (TARGET_RETURN_POPS_ARGS): Define.
+
+2010-06-29 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/44667
+ * tree-inline.c (initialize_inlined_parameters): Make sure
+ to remap the inlined parameter variable substitutions types.
+
+2010-06-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/44659
+ * combine.c (make_compound_operation) <SUBREG>: Do not return the
+ result of force_to_mode if it partially re-expanded the compound.
+
+2010-06-28 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/44671
+ * ipa-split.c (test_nonssa_use, mark_nonssa_use): Check also uses of
+ RESULT_DECL.
+
+2010-06-28 Anatoly Sokolov <aesok@post.ru>
+
+ * double-int.h (force_fit_type_double): Remove declaration.
+ * double-int.c (force_fit_type_double): Move to tree.c.
+ * tree.h (force_fit_type_double): Declare.
+ * tree.h (force_fit_type_double): Moved from double-int.c. Use
+ double_int type for 'cst' argument. Use double_int_fits_to_tree_p and
+ double_int_to_tree instead of fit_double_type and build_int_cst_wide.
+ * convert.c (convert_to_pointer): Adjust call to
+ force_fit_type_double.
+ * tree-vrp.c (extract_range_from_assert,
+ extract_range_from_unary_expr): Adjust call to force_fit_type_double.
+ * fold-const.c: Update comment.
+ (int_const_binop, fold_convert_const_int_from_int,
+ fold_convert_const_int_from_real, fold_convert_const_int_from_fixed,
+ extract_muldiv_1, fold_div_compare, fold_sign_changed_comparison,
+ fold_unary_loc, fold_negate_const, fold_abs_const, fold_not_const,
+ round_up_loc): Adjust call to force_fit_type_double.
+
+2010-06-28 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
+
+ * config/rs6000/rs6000.h (PROCESSOR_TITAN): Declare.
+
+2010-06-28 Martin Jambor <mjambor@suse.cz>
+
+ * tree-sra.c (convert_callers): New parameter, change fndecls of
+ recursive calls.
+ (modify_function): Pass the old decl to convert_callers.
+
+2010-06-28 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-cp.c (ipcp_init_cloned_node): Replace calls to
+ ipa_check_create_node_params and ipa_initialize_node_params with
+ checking asserts they are not necessary.
+
+2010-06-28 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimization/44687
+ * ipa-split.c (split_function): Use DECL_RESULT to store return value.
+
+2010-06-28 Martin Jambor <mjambor@suse.cz>
+
+ PR c++/44535
+ * gimple-fold.c (get_first_base_binfo_with_virtuals): New function.
+ (gimple_get_relevant_ref_binfo): Use get_first_base_binfo_with_virtuals
+ instead of BINFO_BASE_BINFO.
+
+2010-06-28 Michael Matz <matz@suse.de>
+
+ PR middle-end/44592
+ * gimple-fold.c (gimplify_and_update_call_from_tree): Maintain
+ proper VDEF chain for intermediate stores in the sequence.
+
+2010-06-28 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimization/44357
+ * ipa-inline.c (add_new_edges_to_heap): Do not add edges to uninlinable
+ functions.
+
+2010-06-28 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
+
+ * config.gcc (powerpc*-*-*): Handle titan.
+ * config/rs6000/rs6000.c (titan_cost): New costs.
+ (rs6000_override_options): Add "titan" to processor_target_table.
+ Add Titan to branch alignment logic.
+ Correctly set rs6000_cost for titan.
+ * config/rs6000/rs6000.md (cpu): Add titan. Include "titan.md".
+ * config/rs6000/titan.md: New file.
+ * doc/invoke.texi (RS/6000 and PowerPC Options): Document -mcpu=titan.
+
+2010-06-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * tree-browser.c (TB_history_stack): Convert to a VEC.
+ (TB_SET_HEAD): Adjust for new type of TB_history_stack.
+ (TB_history_prev): Likewise.
+
+2010-06-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * vec.h (vec_heap_free): Add parentheses around free.
+
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * system.h: Poison GCC_EXCEPT_H for front-end files.
+
+ * langhooks.h (struct lang_hooks): Add eh_protect_cleanup_actions
+ langhook.
+ * langhooks-def.h (LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS) New.
+ Define to NULL by default.
+ * except.h: Define GCC_EXCEPT_H.
+ (doing_eh): Remove prototype.
+ (init_eh, init_eh_for_function): Move prototypes to toplev.h.
+ (lang_protect_cleanup_actions): Remove.
+ * except.c (lang_protect_cleanup_actions): Remove.
+ (doing_eh): Remove.
+ (gen_eh_region): Don't check doing_eh here.
+ * toplev.h (init_eh, init_eh_for_function_): Moved from except.h.
+ * tree-eh.c (honor_protect_cleanup_actions): Use new langhook
+ instead of lang_protect_cleanup_actions.
+ * omp-low.c (maybe_catch_exception): Likewise.
+ * Makefile.in: Update dependencies.
+
+2010-06-28 Bingfeng Mei <bmei@broadcom.com>
+
+ * cgraph.h (struct varpool_node): new used_from_object_file flag.
+ (struct cgraph_local_info): new used_from_object_file flag.
+ * cgraph.c (dump_cgraph_node): dump used_from_object_file flag.
+ (cgraph_clone_node): initialize used_from_object_file.
+ (cgraph_create_virtual_clone): initialize used_from_object_file.
+ * lto-symbtab.c (lto_symtab_merge_decls_1): Set
+ used_from_object_file flags for symbols of LDPR_PREVAILING_DEF
+ when compiling with -fwhole-program.
+ (lto_symtab_resolve_symbols) Use LDPR_PREVAILING_DEF_IRONLY for
+ internal resolver.
+ * ipa.c (function_and_variable_visibility): Set externally_visible
+ flag of varpool_node if used_from_object_file flag is set.
+ (cgraph_externally_visible_p): check used_from_object_file flag.
+ * doc/invoke.texi (-fwhole-program option): Change description of
+ externally_visible attribute accordingly.
+ * doc/extend.texi (externally_visible): Ditto.
+
+2010-06-27 Jan Hubicka <jh@suse.cz>
+
+ * params.def (max-inline-insns-auto): Default to 40.
+ * doc/invoke.texi (max-inline-insns-auto): Document the change.
+
+2010-06-27 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/44671
+ PR middle-end/44686
+ * tree.c (build_function_decl_skip_args): Clear DECL_BUILT_IN on
+ signature change.
+ * ipa-split.c (split_function): Always clear DECL_BUILT_IN.
+ * ipa-prop.c (ipa_modify_formal_parameters): Likewise.
+
+2010-06-27 Anatoly Sokolov <aesok@post.ru>
+
+ * target.h (struct gcc_target): Add register_move_cost field.
+ * target-def.h (TARGET_REGISTER_MOVE_COST): New.
+ (TARGET_INITIALIZER): Use TARGET_REGISTER_MOVE_COST.
+ * targhooks.c (default_register_move_cost): New function.
+ * targhooks.h (default_register_move_cost): Declare function.
+ * defaults.h (REGISTER_MOVE_COST): Delete.
+ * ira-int.h (ira_register_move_cost): Update comment.
+ * ira.c: (ira_register_move_cost): Update comment.
+ * reload.h (register_move_cost): Declare.
+ * reginfo.c (register_move_cost): New function.
+ (move_cost): Update comment.
+ (init_move_cost, memory_move_secondary_cost): Replace
+ REGISTER_MOVE_COST with register_move_cost.
+ * postreload.c (reload_cse_simplify_set): (Ditto.).
+ * reload.c (find_valid_class, find_reloads): (Ditto.).
+ * reload1.c (choose_reload_regs): (Ditto.).
+ * doc/tm.texi (TARGET_REGISTER_MOVE_COST): New.
+ (REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Update documentation.
+ * doc/md.texi (can_create_pseudo_p): Update documentation.
+
+ * config/i386/i386.h (MEMORY_MOVE_COST): Remove macro.
+ * config/i386/i386-protos.h (int ix86_memory_move_cost): Remove.
+ * config/i386/i386.h (ix86_memory_move_cost): Make static.
+ (TARGET_MEMORY_MOVE_COST): Define.
+
+ * config/ia64/ia64.h (MEMORY_MOVE_COST): Remove macro.
+ * config/ia64/ia64-protos.h (int ia64_memory_move_cost): Remove.
+ * config/ia64/ia64.h (ia64_memory_move_cost): Make static.
+ (TARGET_MEMORY_MOVE_COST): Define.
+
+2010-06-27 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44683
+ * tree-ssa-dom.c (record_edge_info): Record equivalences for the
+ false edge from the inverted condition.
+
+2010-06-27 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/44684
+ * tree-ssa-alias.c (refs_may_alias_p_1): Allow SSA name refs.
+ (stmt_may_clobber_ref_p_1): Do not bother to call the oracle
+ for register LHS. Or non-store assignments.
+
+2010-06-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/sparc/sparc.c (sparc_emit_set_const32): Make static.
+ (sparc_emit_set_const64): Likewise. Remove disabled code.
+ * config/sparc/sparc-protos.h (sparc_emit_set_const32): Delete.
+ (sparc_emit_set_const64): Likewise.
+
+2010-06-26 Catherine Moore <clm@codesourcery.com>
+
+ * config/mips/mips.md (alu_type): New attribute.
+ (type): Infer type from alu_type.
+ (*add<mode>3, *add<mode>3_mips16, *addsi3_extended,
+ *baddu_si_eb, *baddu_si_el, *baddu_di, sub<mode>3,
+ *subsi3_extended, negsi2, negdi2, *low<mode>,
+ *low<mode>_mips16, *ior<mode>3, *ior<mode>3_mips16,
+ xor<mode>3, *nor<mode>3,
+ *zero_extend<GPR:mode>_trunc<SHORT:mode>,
+ *zero_extendhi_truncqi): Set alu_type instead of type.
+
+2010-06-26 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (alpha_need_linkage): Adjust
+ splay_tree_new_ggc call.
+ (alpha_use_linkage): Likewise.
+
+2010-06-26 Joseph Myers <joseph@codesourcery.com>
+
+ * collect2.c (main): Remove SWITCHES_NEED_SPACES conditional.
+ * doc/tm.texi (SWITCHES_NEED_SPACES): Don't document.
+ * gcc.c (SWITCHES_NEED_SPACES, switches_need_spaces): Remove.
+ (static_specs): Remove switches_need_spaces.
+ (process_command, do_self_spec): Hardcode handling "-o" instead of
+ checking switches_need_spaces.
+ * system.h (SWITCHES_NEED_SPACES): Poison.
+
+2010-06-26 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44393
+ * tree-loop-distribution.c (generate_loops_for_partition): Fix
+ stmt removal and VOP renaming.
+ (generate_memset_zero): Remove redundant stmt updating.
+ * tree-flow.h (mark_virtual_ops_in_bb): Remove.
+ * tree-cfg.c (mark_virtual_ops_in_bb): Likewise.
+
+2010-06-26 Jan Hubicka <jh@suse.cz>
+
+ * ipa-split.c (consider_split): PHI in entry block is OK as long as all
+ edges comming from header are equivalent.
+ (visit_bb): Handle PHIs correctly.
+ * tree-inline.c (copy_phis_for_bb): Be able to copy
+ PHI from entry edge.
+ (copy_cfg_body): Produce edge from entry BB before copying
+ PHIs.
+
+2010-06-26 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/44674
+ * tree-ssa-alias.c (refs_may_alias_p_1): Allow all kind of
+ decls. Handle LABEL_DECLs like FUNCTION_DECLs.
+
+2010-06-26 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.c (n_switches_alloc, n_infiles_alloc, alloc_infile,
+ add_infile, alloc_switch): New.
+ (process_command): Remove variable lang_n_infiles. Process
+ options in a single pass. Use new functions for allocating
+ infiles and switches arrays. Properly skip operands of
+ -Xpreprocessor and -Xassembler.
+
+2010-06-26 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/44671
+ * cgraphunit.c (cgraph_function_versioning): Remove wrong
+ cgraph_make_decl_local call; fix typo copying RTL data.
+
+2010-06-25 DJ Delorie <dj@redhat.com>
+
+ * config/m32c/m32c-protos.h (m32c_note_pragma_address): Declare.
+ (m32c_output_aligned_common): Likewise.
+ * config/m32c/m32c.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): New.
+ (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.
+ * config/m32c/m32c-pragma.c (m32c_pragma_address): New.
+ (m32c_register_pragmas): Register it.
+ * config/m32c/m32c.c (m32c_get_pragma_address): New.
+ (m32c_insert_attributes): Set #pragma address decls volatile.
+ (pragma_entry_eq): New.
+ (pragma_entry_hash): New.
+ (m32c_note_pragma_address): New.
+ (m32c_get_pragma_address): New.
+ (m32c_output_aligned_common): New.
+ * doc/extend.texi: Document the new pragma.
+
+ * config/m32c/m32c.c (m32c_illegal_subreg_p): Reject illegal MEMs
+ also.
+ * config/m32c/predicates.md (m32c_any_operand): Check the code
+ instead of memory_operand so as to allow matching volatile MEMs.
+ (m32c_nonimmediate_operand): Likewise.
+ (mra_operand): Allow volatiles.
+
+2010-06-25 Alexandre Oliva <aoliva@redhat.com>
+
+ PR debug/44610
+ * simplify-rtx.c (delegitimize_mem_from_attrs): Don't use a base
+ address if the offset is unknown.
+
+2010-06-25 Douglas B Rupp <rupp@gnat.com>
+
+ * dwarf2out.c (dwarf2out_vms_debug_main_pointer): New function.
+ * dwarf2out.h (dwarf2out_vms_debug_main_pointer): Declare new function.
+ * config/ia64/ia64-protos.h (ia64_start_function): Declare.
+ * config/ia64/sysv4.h (ASM_DECLARE_FUNCTION_NAME): Move contents
+ to ia64_start_function. Invoke it.
+ * config/ia64/ia64.c (ia64_start_function): Call new function
+ dwarf2out_vms_debug_main_pointer.
+
+2010-06-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-if-conv.c (insert_gimplified_predicates): Do not insert
+ statements computing the true predicate.
+
+2010-06-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-if-conv.c (init_bb_predicate): Initialize the predicate
+ to boolean_true_node.
+ (reset_bb_predicate): New.
+ (predicate_bbs): Call reset_bb_predicate.
+
+2010-06-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-if-conv.c (combine_blocks): Remove FIXME comment.
+ (tree_if_conversion): Returns true when something has been changed.
+ (main_tree_if_conversion): Return TODO_cleanup_cfg when if-conversion
+ changed something.
+
+2010-06-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in (tree-if-conv.o): Depends on DBGCNT_H.
+ * dbgcnt.def (if_conversion_tree): New DEBUG_COUNTER.
+ * tree-if-conv.c: Include dbgcnt.h.
+ (tree_if_conversion): Use if_conversion_tree to count the number of
+ if-convertible loops.
+
+2010-06-25 Changpeng Fang <changpeng.fang@amd.com>
+
+ * common.opt (fprefetch-loop-arrays): Re-define
+ -fprefetch-loop-arrays as a tri-state option with the initial
+ value of -1.
+ * tree-ssa-loop.c (gate_tree_ssa_loop_prefetch): Invoke prefetch
+ pass only when flag_prefetch_loop_arrays > 0.
+ * toplev.c (process_options): Note that, with tri-states,
+ flag_prefetch_loop_arrays>0 means prefetching is enabled.
+ * config/i386/i386.c (override_options): Enable prefetching at -O3
+ for a set of CPUs that sw prefetching is helpful.
+ (software_prefetching_beneficial_p): New. Return TRUE if software
+ prefetching is beneficial for the given CPU.
+
+2010-06-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR rtl-optimization/44326
+ * implicit-zee.c (find_removable_zero_extends): Replace
+ INSN_P with NONDEBUG_INSN_P.
+
+2010-06-25 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.h (struct ipa_param_descriptor): Removed the modified flag.
+ (struct ipa_node_params): Removed the modification_analysis_done flag.
+ (ipa_is_param_modified): Removed.
+ (ipa_analyze_node): Declare.
+ (ipa_compute_jump_functions): Remove declaration.
+ (ipa_count_arguments): Likewise.
+ (ipa_detect_param_modifications): Likewise.
+ (ipa_analyze_params_uses): Likewise.
+ * ipa-prop.c (struct param_analysis_info): New type.
+ (visit_store_addr_for_mod_analysis): Removed.
+ (visit_load_for_mod_analysis): Renamed to visit_ref_for_mod_analysis,
+ moved down in the file.
+ (ipa_detect_param_modifications): Merged into ipa_analyze_params_uses.
+ (ipa_count_arguments): Made static.
+ (mark_modified): New function.
+ (is_parm_modified_before_call): New function.
+ (compute_pass_through_member_ptrs): New parameter parms_info, call
+ is_parm_modified_before_call instead of ipa_is_param_modified.
+ (ipa_compute_jump_functions_for_edge): New parameter parms_info, pass
+ it to compute_pass_through_member_ptrs.
+ (ipa_compute_jump_functions): New parameter parms_info, pass it to
+ ipa_compute_jump_functions_for_edge. Call ipa_initialize_node_params
+ on the callee if it is analyzed. Made static.
+ (ipa_analyze_indirect_call_uses): New parameter parms_info, call
+ is_parm_modified_before_call instead of ipa_is_param_modified.
+ (ipa_analyze_call_uses): New parameter parms_info, pass it to
+ ipa_analyze_indirect_call_uses.
+ (ipa_analyze_stmt_uses): New parameter parms_info, pass it to
+ ipa_analyze_call_uses.
+ (ipa_analyze_params_uses): New parameter parms_info, pass it to
+ ipa_analyze_stmt_uses. Also perform the used analysis. Made static.
+ (ipa_analyze_node): New function.
+ (ipa_print_node_params): Do not dump the modified flag.
+ (ipa_write_node_info): Assert uses_analysis_done rather than streaming
+ it. Do not stream the modified parameter flag.
+ (ipa_read_node_info): Set uses_analysis_done to 1 instead of streaming
+ it. Do not stream the modified parameter flag.
+ * ipa-cp.c (ipcp_analyze_node): Removed.
+ (ipcp_init_stage): Iterate only once over the nodes, analyze each one
+ with only a call to ipa_analyze_node.
+ * ipa-inline.c (inline_indirect_intraprocedural_analysis): Analyze the
+ node with only a call to ipa_analyze_node.
+
+2010-06-25 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * doc/invoke.texi (-Wsuggest-attribute): Add item for noreturn.
+
+2010-06-25 Jan Hubicka <jh@suse.cz>
+
+ * tree-pass.h (pass_split_functions): Declare.
+ * opts.c (decode_options): Enable function splitting at -O2
+ * timevar.def (TV_IPA_FNSPLIT): New macro.
+ * ipa-split.c: New file.
+ * common.opt (-fpartial-inlining): New flag.
+ * Makefile.in (ipa-split.o): New object file.
+ * passes.c (init_optimization_passes): Add ipa-split.
+ * params.def (partial-inlining-entry-probability): New parameters.
+ * doc/invoke.texi (-fpartial-inlining): New.
+
+2010-06-25 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR 44665
+ * tree-inline.c (gimple_expand_calls_inline): Fix typo in comment.
+ * gimplify.c (is_gimple_reg_rhs_or_call): Likewise.
+ (gimplify_expr): Likewise.
+
+2010-06-25 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.c (determine_cst_member_ptr): Ignore non-clobbering
+ statements instead of bailing out on them.
+ (ipa_analyze_indirect_call_uses): Do not require that loads from the
+ parameter are in the same BB as the condition. Update comments.
+
+2010-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/43866
+ * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): If stmt is always
+ true or always false, return NULL_TREE.
+ (tree_unswitch_single_loop): Optimize conditions even when reaching
+ max-unswitch-level parameter. If num > 0, optimize first all conditions
+ using entry checks, then do still reachable block discovery and consider
+ only conditions in still reachable basic blocks in the loop.
+
+ PR tree-optimization/44539
+ * tree-cfgcleanup.c (fixup_noreturn_call): Call update_stmt even when
+ the call doesn't have LHS, but has VDEF.
+
+2010-06-25 Joseph Myers <joseph@codesourcery.com>
+
+ * config/pa/pa.h (MODIFY_TARGET_NAME): Remove.
+ * doc/tm.texi (MODIFY_TARGET_NAME): Don't document.
+ * gcc.c (enum add_del, struct modify_target, modify_target):
+ Remove.
+ (process_command): Remove code conditional on MODIFY_TARGET_NAME.
+ * system.h (MODIFY_TARGET_NAME): Poison.
+
+2010-06-25 Alan Modra <amodra@gmail.com>
+
+ * doc/invoke.texi: Delete mcmodel=medium from powerpc options.
+ * config/rs6000/rs6000.h (enum rs6000_cmodel): Delete CMODEL_MEDIUM.
+ * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Set
+ CMODEL_LARGE as default.
+ * config/rs6000/rs6000.c (rs6000_handle_option): Remove mcmodel=medium.
+ (offsettable_ok_by_alignment): Delete.
+ (rs6000_emit_move): Remove mcmodel=medium optimization.
+
+2010-06-25 Bernd Schmidt <bernds@codesourcery.com>
+
+ With large parts from Jim Wilson:
+ PR target/43902
+ * tree-pretty-print.c (dump_generic_node, op_code_prio): Add
+ WIDEN_MULT_PLUS_EXPR and WIDEN_MULT_MINUS_EXPR.
+ * optabs.c (optab_for_tree_code): Likewise.
+ (expand_widen_pattern_expr): Likewise.
+ * tree-ssa-math-opts.c (convert_mult_to_widen): New function, broken
+ out of execute_optimize_widening_mul.
+ (convert_plusminus_to_widen): New function.
+ (execute_optimize_widening_mul): Use the two new functions.
+ * expr.c (expand_expr_real_2): Add support for GIMPLE_TERNARY_RHS.
+ Remove code to generate widening multiply-accumulate. Add support
+ for WIDEN_MULT_PLUS_EXPR and WIDEN_MULT_MINUS_EXPR.
+ * gimple-pretty-print.c (dump_ternary_rhs): New function.
+ (dump_gimple_assign): Call it when appropriate.
+ * tree.def (WIDEN_MULT_PLUS_EXPR, WIDEN_MULT_MINUS_EXPR): New codes.
+ * cfgexpand.c (gimple_assign_rhs_to_tree): Likewise.
+ (expand_gimple_stmt_1): Likewise.
+ (expand_debug_expr): Support WIDEN_MULT_PLUS_EXPR and
+ WIDEN_MULT_MINUS_EXPR.
+ * tree-ssa-operands.c (get_expr_operands): Likewise.
+ * tree-inline.c (estimate_operator_cost): Likewise.
+ * gimple.c (extract_ops_from_tree_1): Renamed from
+ extract_ops_from_tree. Add new arg for a third operand; fill it.
+ (gimple_build_assign_stat): Support operations with three operands.
+ (gimple_build_assign_with_ops_stat): Likewise.
+ (gimple_assign_set_rhs_from_tree): Likewise.
+ (gimple_assign_set_rhs_with_ops_1): Renamed from
+ gimple_assign_set_rhs_with_ops. Add new arg for a third operand.
+ (get_gimple_rhs_num_ops): Support GIMPLE_TERNARY_RHS.
+ (get_gimple_rhs_num_ops): Handle WIDEN_MULT_PLUS_EXPR and
+ WIDEN_MULT_MINUS_EXPR.
+ * gimple.h (enum gimple_rhs_class): Add GIMPLE_TERNARY_RHS.
+ (extract_ops_from_tree_1): Adjust declaration.
+ (gimple_assign_set_rhs_with_ops_1): Likewise.
+ (gimple_build_assign_with_ops): Pass NULL for last operand.
+ (gimple_build_assign_with_ops3): New macro.
+ (gimple_assign_rhs3, gimple_assign_rhs3_ptr, gimple_assign_set_rhs3,
+ gimple_assign_set_rhs_with_ops, extract_ops_from_tree): New inline
+ functions.
+ * tree-cfg.c (verify_gimple_assign_ternary): New static function.
+ (verify_gimple_assign): Call it.
+ * doc/gimple.texi (Manipulating operands): Document GIMPLE_TERNARY_RHS.
+ (Tuple specific accessors, subsection GIMPLE_ASSIGN): Document new
+ functions for dealing with three-operand statements.
+ * tree.c (commutative_ternary_tree_code): New function.
+ * tree.h (commutative_ternary_tree_code): Declare it.
+ * tree-vrp.c (gimple_assign_nonnegative_warnv_p): Return false for
+ ternary statements.
+ (gimple_assign_nonzero_warnv_p): Likewise.
+ * tree-ssa-sccvn.c (stmt_has_constants): Handle GIMPLE_TERNARY_RHS.
+ * tree-ssa-ccp.c (get_rhs_assign_op_for_ccp): New static function.
+ (ccp_fold): Use it. Handle GIMPLE_TERNARY_RHS.
+ * tree-ssa-dom.c (enum expr_kind): Add EXPR_TERNARY.
+ (struct hashtable_expr): New member ternary in the union.
+ (initialize_hash_element): Handle GIMPLE_TERNARY_RHS.
+ (hashable_expr_equal_p): Fix indentation. Handle EXPR_TERNARY.
+ (iterative_hash_hashable_expr): Likewise.
+ (print_expr_hash_elt): Handle EXPR_TERNARY.
+ * gimple-fold.c (fold_gimple_assign): Handle GIMPLE_TERNARY_RHS.
+ * tree-ssa-threadedge.c (fold_assignment_stmt): Remove useless break
+ statements. Handle GIMPLE_TERNARY_RHS.
+
+2010-06-25 Jan Hubicka <jh@suse.cz>
+
+ * doc/invoke.texi (-Wsuggest-attribute): Add noreturn.
+
+2010-06-25 Shujing Zhao <pearly.zhao@oracle.com>
+
+ PR c/44517
+ * c-parser.c (c_parser_parms_list_declarator): Return NULL if one of
+ parameters are not good.
+ (c_parser_parameter_declaration): Error unknown type name if the type
+ name can't start declaration specifiers.
+
+2010-06-25 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.c (translate_options): Don't mention +e in comment.
+ (process_command): Don't handle +e specially.
+
+2010-06-25 Bernd Schmidt <bernds@codesourcery.com>
+
+ * ira.c (allocno_pool, copy_pool, allocno_live_range_pool): Delete.
+
+ * ira-build.c (merge_hard_reg_conflicts): New function.
+ (create_cap_allocno, copy_info_to_removed_store_destinations,
+ propagate_some_info_from_allocno, propagate_allocno_info): Use it.
+ (move_allocno_live_ranges, copy_allocno_live_ranges): New functions.
+ (remove_unnecessary_allocnos, remove_low_level_allocnos)
+ copy_nifo_to_removed_store_destination): Use them.
+ * ira-lives.c (make_hard_regno_born): New function, split out of
+ make_regno_born.
+ (make_allocno_born): Likewise.
+ (make_hard_regno_dead): New function, split out of make_regno_dead.
+ (make_allocno_dead): Likewise.
+ (inc_register_pressure): New function, split out of set_allocno_live.
+ (dec_register_pressure): New function, split out of clear_allocno_live.
+ (mark_pseudo_regno_live): New function, split out of mark_reg_live.
+ (mark_hard_reg_live): Likewise. Use inc_register_pressure.
+ (mark_pseudo_regno_dead): New function, split out of mark_reg_dead.
+ (mark_hard_reg_dead): Likewise. Use dec_register_pressure.
+ (make_pseudo_conflict): Use mark_pseudo_regno_dead and
+ mark_pseudo_regno_live.
+ (process_bb_node_lives): Use mark_pseudo_regno_live,
+ make_hard_regno_born and make_allocno_dead.
+ (make_regno_born, make_regno_dead, mark_reg_live, mark_reg_dead,
+ set_allocno_live, clear_allocno_live): Delete functions.
+
+ * ira-int.h (ira_parent_allocno, ira_parent_or_cap_allocno): Declare.
+ * ira-build.c (ira_parent_allocno, ira_parent_or_cap_allocno): New
+ functions.
+ (ira_flattening): Use ira_parent_allocno.
+ * ira-conflicts.c (process_regs_for_copy, propagate_copies)
+ build_allocno_conflicts): Use ira_parent_or_cap_allocno.
+
+ * ira-color.c (assign_hard_reg): Improve formatting of multi-line for
+ statement.
+
+ * ira-int.h (SET_MINMAX_SET_BIT, CLEAR_MINMAX_SET_BIT,
+ TEST_MINMAX_SET_BIT, minmax_set_iterator, minmax_set_iter_init,
+ minmax_set_iter_cond, minmax_set_iter_next,
+ FOR_EACH_BIT_IN_MINMAX_SET): Renamed from SET_ALLOCNO_SET_BIT,
+ CLEAR_ALLOCNO_SET_BIT, TEST_ALLOCNO_SET_BIT, ira_allocno_set_iterator,
+ ira_allocno_set_iter_init, ira_allocno_set_iter_cond,
+ ira_allocno_set_iter_Next and FOR_EACH_ALLOCNO_IN_ALLOCNO_SET. All
+ uses changed.
+
+ * ira-int.h (struct live_range, live_range_t): Renamed from struct
+ ira_allocno_live_range and allocno_live_range_t; all uses changed.
+ * ira-build.c (live_range_pool): Renamed from allocno_live_range_pool.
+ All uses changed.
+
+2010-06-24 Richard Earnshaw <rearnsha@arm.com>
+
+ * thumb2.md (thumb2_tlobits_cbranch): Delete.
+ (peephole2 to convert zero_extract/compare of single bit to
+ lshift/compare): New.
+
+2010-06-24 Anatoly Sokolov <aesok@post.ru>
+
+ * fold-const.c (const_binop): Remove 'notrunc' argement. Adjust
+ recursive call and call to 'int_const_binop'.
+ (build_range_check, fold_cond_expr_with_comparison, unextend,
+ fold_truthop, extract_muldiv_1, fold_comparison, fold_binary_loc,
+ multiple_of_p): Adjust call to const_binop.
+
+2010-06-24 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (XFmode push splitter): Use GET_MODE_SIZE to
+ determine size of XFmode operand.
+ (XFmode extended DFmode push splitter): Ditto.
+ (XFmode extended SFmode push splitter): Ditto.
+
+2010-06-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44588
+ * config/i386/i386.md (extract_code): New.
+ (<u>divmodqi4): Likewise.
+ (divmodhiqi3): Likewise.
+ (udivmodhiqi3): Likewise.
+ (<u>divqi3): Remvoved.
+
+2010-06-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/44492
+ * recog.h (struct recog_data): Add is_asm field.
+ * recog.c (asm_operand_ok, constrain_operands): If neither < nor > is
+ present in constraints of inline-asm operand and memory operand
+ contains {PRE,POST}_{INC,DEC,MODIFY}, return 0.
+ (extract_insn): Initialize recog_data.is_asm.
+ * doc/md.texi (Constraints): Document operand side-effect rules.
+
+2010-06-24 Andi Kleen <ak@linux.intel.com>
+
+ * c-parser.c (c_parser_conditional_expression): Call
+ warn_for_omitted_condop.
+ * doc/invoke.texi: Document omitted condop warning.
+
+2010-06-24 Nick Clifton<nickc@redhat.com>
+
+ * loop-unswitch.c (compare_and_jump_seq): Assert that the last
+ insn in the sequence is a jump insn before setting its label.
+
+2010-06-24 Alan Modra <amodra@gmail.com>
+
+ * collect2.c (main): Match exactly --version and --help.
+
+2010-06-24 DJ Delorie <dj@redhat.com>
+
+ * config/m32c/m32c-pragma.c: Don't include rtl.h.
+
+2010-06-23 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (mov<mode>): Macroize expander from mov{sf,df,xf}
+ using X87MODEF mode iterator.
+ (pushsf splitter): Macroize splitter using P mode iterator.
+ (*swap<mode>): Macroize insn from *swap{sf,df} using MODEF
+ mode iterator.
+
+ (*movxf_internal): Rename from *movxf_integer.
+ (*movxf_internal_nointeger): Rename from *movxf_nointeger.
+ (*movdf_internal_rex64): Rename from *movdf_integer_rex64.
+ (*movdf_internal): Rename from *movdf_integer.
+ (*movdf_internal_nointeger): Rename from *movdf_nointeger.
+ (*movsf_internal): Rename from *movdf_1.
+
+2010-06-23 Basile Starynkevitch <basile@starynkevitch.net>
+
+ * coretypes.h: (gimple_seq_node_d, gimple_seq_node)
+ (const_gimple_seq_node): Removed typedefs.
+
+ * gimple.h: (gimple_seq_node_d, gimple_seq_node)
+ (const_gimple_seq_node): Added typedefs moved from coretypes.h.
+
+2010-06-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (bdesc_args): Replace CODE_FOR_avx_si_si256,
+ CODE_FOR_avx_ps_ps256 and CODE_FOR_avx_pd_pd256 with
+ CODE_FOR_vec_extract_lo_v8si, CODE_FOR_vec_extract_lo_v8sf
+ and CODE_FOR_vec_extract_lo_v4df.
+
+ * config/i386/sse.md (vec_extract_lo_<AVX256MODE4P:mode>):
+ Changed to define_insn_and_split.
+ (vec_extract_lo_<AVX256MODE8P:mode>): Likewise.
+ (vec_extract_lo_v16hi): Likewise.
+ (vec_extract_lo_v32qi): Likewise.
+ (avx_<avxmodesuffixp><avxmodesuffix>_<avxmodesuffixp>): Likewise.
+ (avx_<avxmodesuffixp>_<avxmodesuffixp><avxmodesuffix>): Removed.
+
+2010-06-23 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR target/44640
+ * config/spu/spu-protos.h (spu_expand_epilogue) Use bool.
+ * config/spu/spu.c (spu_scalar_mode_supported_p): Declare with bool.
+ (spu_vector_mode_supported_p, spu_handle_fndecl_attribute): Likewise.
+ (spu_handle_vector_attribute, spu_pass_by_reference): Likewise.
+ (spu_rtx_costs, spu_function_ok_for_sibcall): Likewise.
+
+ PR target/44640
+ * config/spu/spu.c (ea_load_store_inline): Use add_reg_note.
+
+ PR other/44644
+ * df-core.c (struct df): Rename to df_d.
+ * df.h (struct df): Likewise.
+ * dse.h (struct df): Remove forward declaration.
+ * recog.h (struct insn_data): Rename to:
+ (struct_insn_data_d). Adjusted all users.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com
+
+ PR ada/22220
+ * doc/install.texi: Update requirements to build GNAT.
+
+2010-06-22 Andreas Schwab <schwab@linux-m68k.org>
+
+ * config/m68k/m68k.c (m68k_output_addr_const_extra): Add cast to
+ enum type.
+ (m68k_sched_attr_opx_type): Remove unreachable return.
+ (m68k_sched_attr_opy_type): Likewise.
+ (m68k_sched_attr_size): Likewise.
+ (sched_get_opxy_mem_type): Likewise.
+ (m68k_sched_attr_op_mem): Likewise.
+
+2010-06-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Chain the
+ new statement and adjust VDEF only if necessary. Remove superfluous
+ call to maybe_clean_or_replace_eh_stmt.
+ * gimple.c (gimple_call_copy_skip_args): Use gimple_call_copy_flags to
+ copy the flags.
+ * gimple-iterator.c (gsi_replace): Clear BB of old statement here...
+ * tree-inline.c (copy_bb): ...and not there.
+
+2010-06-22 Cary Coutant <ccoutant@google.com>
+
+ * dwarf2out.c (is_nested_in_subprogram): New function.
+ (should_move_die_to_comdat): Use it.
+ (copy_ancestor_tree): Don't mark DIEs here.
+ (copy_decls_walk): Start walk from root of newly-added tree;
+ mark DIEs here instead.
+
+2010-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.md (unit): Also check sseishft1.
+
+2010-06-22 Jan Hubicka <jh@suse.cz>
+
+ * gimple.h (gimple_expr_code): Do checking on when gimple checking is
+ enabled.
+
+2010-06-22 Jan Hubicka <jh@suse.cz>
+
+ * df-problems.c (df_rd_confluence_n, df_lr_confluence_n,
+ df_live_confluence_n, df_byte_lr_confluence_n, df_md_confluence_n):
+ Return true if something changed.
+ * df.h (df_confluence_function_n): Return bool.
+ * df-core.c (df_worklist_propagate_forward,
+ df_worklist_propagate_backward): Track changes and ages.
+ (df_worklist_dataflow_doublequeue): Use bitmap iterator for main walk;
+ track ages.
+ * dse.c (dse_confluence_n): Return always true.
+
+2010-06-22 Jan Hubicka <jh@suse.cz>
+
+ * bitmap.c (bitmap_clear_bit): Micro optimize.
+
+2010-06-22 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (SWI1248x): New mode iterator.
+ (SWI48x): Ditto.
+ (SWI12): Ditto.
+ (SWI24): Ditto.
+
+ (mov<mode>): Macroize expander from mov{qi,hi,si,di} using
+ SWI1248x mode iterator.
+ (*push<mode>2_rex64): Macroize insn from *push{qi,hi,si}_rex64
+ using SWI124 mode iterator.
+ (*push<mode>2): Macroize insn from *push{qi,hi} using SWI12
+ mode iterator.
+ (*push<mode>2_prologue): Macroize insn from *pushsi2_prologue and
+ *pushdi2_prologue_rex64 using P mode iterator.
+ (*mov<mode>_xor): Macroize insn from *movsi_xor and *movdi_xor_rex64
+ using SWI48 mode iterator.
+ (*mov<mode>_or): Ditto from *movsi_or and *movdi_or_rex64.
+ (*movabs<mode>_1): Macroize insn from *movabs{qi,hi,si,di}_1_rex64
+ using SWI1248x mode iterator.
+ (*movabs<mode>_2): Ditto from *movabs{qi,hi,si,di}_1_rex64.
+ (*swap<mode>): Macroize insn from *swapsi and *swapdi_rex64 using
+ SWI48 mode iterator.
+ (*swap<mode>_1): Macroize insn from *swap{qi,hi}_1 using SWI12 mode
+ iterator.
+ (*swap<mode>_2): Ditto from *swap{qi,hi}_2.
+ (movstrict<mode>): Macroize expander from movstrict{qi,hi} using
+ SWI12 mode iterator.
+ (*movstrict<mode>_1): Macroize insn from *movstrict{qi,hi}_1 using
+ SWI12 mode iterator.
+ (*movstrict<mode>_xor): Ditto from *movstrict{qi,hi}_xor.
+ (*mov<mode>_extv_1): Macroize insn from *mov{hi,si}_extv_1 using
+ SWI24 mode iterator.
+ (*mov<mode>_extzv_1): Macroize insn from *mov{si,di}_extzv_1 using
+ SWI48 mode iterator.
+ (mov<mode>_insn_1): New expander.
+ (*mov<mode>_insv_1_rex64): Macroize insn from *mov{si,di}_insv_1_rex64
+ using SWI48x mode iterator.
+
+ (*movoi_internal_avx): Rename from *movoi_internal.
+ (*movti_internal_rex64): Rename from *movti_rex64.
+ (*movti_internal_sse): Rename from *movti_sse.
+ (*movdi_internal_rex64): Rename from *movdi_1_rex64.
+ (*movdi_internal): Rename from *movdi_2.
+ (*movsi_internal): Rename from *movsi_1.
+ (*movhi_internal): Rename from *movhi_1.
+ (*movqi_internal): Rename from *movqi_1.
+
+ (insv): Update the call to gen_movsi_insv_1 for rename.
+ * config/i386/i386.c (promote_duplicated_reg): Ditto.
+
+2010-06-22 Jan Hubicka <jh@suse.cz>
+
+ * passes.c (execute_function_todo): Move call of statistics_fini_pass
+ to ...
+ (execute_todo) ... this one.
+
+2010-06-22 Alan Modra <amodra@gmail.com>
+
+ PR target/44364
+ * config/rs6000/e500.h (HARD_REGNO_CALLER_SAVE_MODE): Define.
+ * caller-save.c (insert_restore, insert_save): Use non-validate
+ form of adjust_address.
+
+2010-06-21 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR target/39690
+ * config/pa/pa.c (override_options): Disable
+ -freorder-blocks-and-partition.
+
+2010-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44615
+ * config/i386/atom.md (atom_sseishft_2): Also check sseishft1.
+
+ * config/i386/i386.md (type): Add sseishft1
+
+ * config/i386/ppro_insn (ppro_insn): Also check sseishft1.
+ (ppro_insn_load): Likewise.
+ (ppro_insn_store): Likewise.
+ (ppro_insn_both): Likewise.
+
+ * config/i386/sse.md (sse2_lshrv1ti3): Add atom_unit.
+ (*vec_extractv2di_1_rex64_avx): Replace sseishft with sseishft1
+ for type.
+ (*vec_extractv2di_1_avx): Likewise.
+ (*vec_extractv2di_1_rex64): Replace sseishft with sseishft1 for
+ type. Remove atom_unit.
+ (*vec_extractv2di_1_sse2): Likewise.
+
+2010-06-21 DJ Delorie <dj@redhat.com>
+
+ * diagnostic.h (diagnostic_classification_change_t): New.
+ (diagnostic_context): Add history and push/pop list.
+ (diagnostic_push_diagnostics): Declare.
+ (diagnostic_pop_diagnostics): Declare.
+ * diagnostic.c (diagnostic_classify_diagnostic): Store changes
+ from pragmas in a history chain instead of the global table.
+ (diagnostic_push_diagnostics): New.
+ (diagnostic_pop_diagnostics): New.
+ (diagnostic_report_diagnostic): Scan history chain to find state
+ of diagnostics as of the diagnostic location.
+ * opts.c (set_option): Pass UNKNOWN_LOCATION to
+ diagnostic_classify_diagnostic.
+ (enable_warning_as_error): Likewise.
+ * diagnostic-core.h (DK_POP): Add after "real" diagnostics, for
+ use in the history chain.
+ * c-family/c-pragma.c (handle_pragma_diagnostic): Add push/pop,
+ allow these pragmas anywhere.
+ * doc/extend.texi: Document pragma GCC diagnostic changes.
+
+2010-06-21 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (add_linkage_name): New function. Don't add
+ anything to DW_TAG_member DIEs.
+ (add_name_and_src_coords_attributes): Use it.
+ (gen_variable_die): Call it for C++ static data members if
+ specification is DW_TAG_member.
+
+ * dwarf2out.c (base_type_die): Use DW_ATE_UTF for
+ C++ char16_t and char32_t.
+
+ * Makefile.in (build/genattrtab.o): Depend on vecprim.h.
+ * genattrtab.c: Include vecprim.h.
+ (cached_attrs, cached_attr_count, attrs_seen_once,
+ attrs_seen_more_than_once, attrs_to_cache, attrs_cached_inside,
+ attrs_cached_after): New variables.
+ (find_attrs_to_cache): New function.
+ (FLG_BITWISE, FLG_AFTER, FLG_INSIDE, FLG_OUTSIDE_AND): Define.
+ (write_test_expr): Add attrs_cached argument, return it too,
+ attempt to cache non-const attributes used more than once in
+ a single case handling.
+ (write_attr_get): Use find_attrs_to_cache, for caching candidates
+ emit cached_* variables. Adjust write_attr_set callers.
+ (write_attr_set): Add attrs_cached attribute, use find_attrs_to_cache
+ to find attributes that should be cached in this block. Adjust
+ write_test_expr callers.
+ (write_attr_case): Clear attrs_to_cache. Adjust write_attr_set
+ callers.
+ (make_automaton_attrs): Adjust write_test_expr caller.
+
+ * Makefile.in (cfgexpand.o): Depend on $(INSN_ATTR_H).
+ * genattrtab.c (check_tune_attr, find_tune_attr): New functions.
+ (make_automaton_attrs): If find_tune_attr returns non-NULL,
+ write separate internal_dfa_insn_code_* and insn_default_latency_*
+ functions for each attribute's value and emit init_sched_attrs
+ function and function pointers.
+ * genattr.c (const_attrs, reservations): New variables.
+ (gen_attr): Add const attributes to const_attrs vector.
+ (check_tune_attr, find_tune_attr): New functions.
+ (main): Add reservations to reservations vector. If find_tune_attr
+ returns true, add prototype for init_sched_attrs and make
+ internal_dfa_insn_code and insn_default_latency function pointers,
+ otherwise define init_sched_attrs as dummy macro.
+ * cfgexpand.c: Include insn-attr.h.
+ (gimple_expand_cfg): Call init_sched_attrs.
+
+ * stmt.c (resolve_asm_operand_names): Fix handling of %%.
+
+ PR target/44575
+ * config/i386/i386.c (ix86_gimplify_va_arg): When copying
+ va_arg from a set of register save slots into a temporary,
+ if the container is bigger than type size, do the copying
+ using smaller mode or using memcpy.
+
+ PR bootstrap/44426
+ * sel-sched-dump.h (sel_prepare_string_for_dot_label): Remove
+ prototype.
+ (sel_print_to_dot): Remove macro.
+ (sel_print): Likewise. New prototype.
+ * sel-sched-dump.c (sel_prepare_string_for_dot_label): Make static.
+ (sel_print): New function.
+
+2010-06-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * config/sol2.h (TARGET_OS_CPP_BUILTINS): Define
+ __STDC_VERSION__=199901L, _XOPEN_SOURCE=600 for C++.
+
+2010-06-21 Nick Clifton <nickc@redhat.com>
+
+ * config/rx/rx.h (PTRDIFF_TYPE): Define.
+ (SMALL_REGISTER_CLASS): Define (to zero).
+ (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/rx/rx-protos.h (rx_print_operand): Delete prototype.
+ (rx_print_operand_address): Delete prototype.
+ * config/rx/rx.c (rx_print_operand): Make static.
+ Allow %H and %L to handle CONST_DOUBLEs.
+ (rx_print_operand_address): Make static.
+ (rx_gen_move_template): Rename local variable 'template' to
+ out_template.
+ (rx_function_arg): Do not pass unknown sized objects in registers.
+ (TARGET_PRINT_OPERAND): Define.
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+
+2010-06-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * Makefile.in (POD2MAN): Provide --date from $(DATESTAMP).
+
+2010-06-21 Kai Tietz <kai.tietz@onevision.com>
+
+ * config/i386/i386.c (ix86_compute_frame_layout): Avoid
+ stack-alignment for simple leaf-functions.
+
+2010-06-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * doc/install.texi: Document bootstrap-lto.
+
+2010-06-20 Alexandre Oliva <aoliva@redhat.com>
+
+ PR debug/44248
+ * lto-streamer-in.c (input_bb): Leave debug stmts alone.
+ (input_function): Drop them here, if VTA is disabled.
+
+2010-06-20 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/44546
+ * config/i386/predicates.md (ix86_swapped_fp_comparsion_operator):
+ New predicate.
+ * config/i386/i386.md (*fp_jcc_8<mode>_387 and splitters): Use
+ ix86_swapped_fp_comparsion_operator instead of
+ ix86_fp_comparison_operator.
+
+ (*fp_jcc_1_387): Rename from *fp_jcc_3_387.
+ (*fp_jcc_1r_387): Rename from *fp_jcc_4_387.
+ (*fp_jcc_2_387): Rename from *fp_jcc_5_387.
+ (*fp_jcc_2r_387): Rename from *fp_jcc_6_387.
+ (*fp_jcc_3_387): Rename from *fp_jcc_7_387.
+ (*fp_jcc_4_<mode>_387): Rename from *fp_jcc_8<mode>_387.
+
+2010-06-20 Joseph Myers <joseph@codesourcery.com>
+
+ PR other/32998
+ * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown,
+ OPT_SPECIAL_program_name and OPT_SPECIAL_input_file.
+ * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure.
+ (decode_cmdline_option): Update for this return value. Set
+ orig_option_with_args_text field. Set arg field for unknown
+ options. Make static.
+ (decode_cmdline_options_to_array): New.
+ (prune_options): Update handling of find_opt return value.
+ * opts.c (read_cmdline_option): Take decoded option. Return void.
+ (read_cmdline_options): Take decoded options.
+ (decode_options): Add parameters for decoded options. Use
+ decode_cmdline_options_to_array. Use decoded options for -O
+ scan. Use integral_argument for -O parameters. Update call to
+ read_cmdline_options.
+ (enable_warning_as_error): Update handling of find_opt return value.
+ * opts.h: Update comment on unknown options.
+ (struct cl_decoded_option): Update comments on opt_index and arg.
+ Add orig_option_with_args_text.
+ (decode_cmdline_option): Remove.
+ (decode_cmdline_options_to_array): Declare.
+ (decode_options): Update prototype.
+ * toplev.c (save_argv): Remove.
+ (save_decoded_options, save_decoded_options_count): New.
+ (read_integral_parameter): Remove.
+ (print_switch_values): Use decoded options.
+ (toplev_main): Don't set save_argv. Update call to decode_options.
+ * toplev.h (read_integral_parameter): Remove.
+ * varasm.c (elf_record_gcc_switches): Don't handle holding back names.
+
+2010-06-19 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/44072
+ * arm.md (cmpsi2_addneg): Prefer emitting adds to subs with a negative
+ immediate.
+ * constraints.md (Pw, Px): New constraints.
+ * thumb2.md (cmpsi2_addneg peephole2): New peepholes.
+
+2010-06-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/sse.md (fma4modesuffixf4): Removed.
+ (ssemodesuffixf2s): Likewise.
+ (ssemodesuffixf4): Likewise.
+ (ssemodesuffixf2c): Likewise.
+ (ssescalarmodesuffix2s): Likewise.
+ (avxmodesuffixf2c): Likewise.
+ (ssemodesuffix): New.
+ (ssescalarmodesuffix): Likewise.
+ Update patterns with ssemodesuffix and ssescalarmodesuffix.
+
+2010-06-19 Philip Herron <herron.philip@googlemail.com>
+
+ * c-decl.c (c_write_global_declarations): Don't check flag_syntax_only.
+
+2010-06-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * stor-layout.c (debug_rli): Remove unused local variables.
+
+2010-06-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/40900
+ * expr.c (expand_expr_real_1) <SSA_NAME>: Fix long line. Save the
+ original expression for later reuse.
+ <expand_decl_rtl>: Use promote_function_mode to compute the signedness
+ of the promoted RTL for a SSA_NAME on the LHS of a call statement.
+
+2010-06-18 Anatoly Sokolov <aesok@post.ru>
+
+ * double-int.h (double_int_to_shwi, double_int_to_uhwi,
+ double_int_fits_in_uhwi_p): Implement as static inline.
+ (double_int_xor): New inline function.
+ (double_int_lrotate, double_int_rrotate, double_int_max,
+ double_int_umax, double_int_smax, double_int_min, double_int_umin,
+ double_int_smin): Declare.
+ (lrotate_double, rrotate_double): Remove declaration.
+ * double-int.c (double_int_fits_in_uhwi_p, double_int_to_shwi,
+ double_int_to_uhwi, lrotate_double, rrotate_double): Remove function.
+ (double_int_lrotate, double_int_rrotate, double_int_max,
+ double_int_umax, double_int_smax, double_int_min, double_int_umin,
+ double_int_smin): New function.
+ * fold-const.c (int_const_binop): Clean up, use double_int_*
+ functions.
+ * simplify-rtx.c (simplify_const_binary_operation): Clean up, use
+ double_int_* and immed_double_int_const functions.
+
+2010-06-18 Nathan Froyd <froydnj@codesourcery.com>
+
+ * function.h (types_used_by_cur_var_decl): Change type to a VEC.
+ * function.c (types_used_by_cur_var_decl): Likewise.
+ (used_types_insert): Adjust for new type of types_used_by_cur_var_decl.
+
+2010-06-18 Nathan Froyd <froydnj@codesourcery.com>
+
+ * tree.h (record_layout_info): Change type of pending_statics field
+ to a VEC.
+ * stor-layout.c (start_record_layout): Store NULL into
+ pending_statics.
+ (debug_rli): Call debug_vec_tree instead of debug_tree.
+ (place_field): Likewise.
+ (finish_record_layout): Likewise.
+
+2010-06-18 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/linux64.h (SET_CMODEL): Don't expand to empty.
+
+2010-06-17 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR target/43740
+ * config/pa/pa.c (emit_move_sequence): Don't infer REG_POINTER flag
+ for SET source operand from SET destination operand.
+
+2010-06-17 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR rtl-optimization/39871
+ * reload1.c (init_eliminable_invariants): For flag_pic, disable
+ equivalences only for constants that aren't LEGITIMATE_PIC_OPERAND_P.
+ (function_invariant_p): Rule out a plus of frame or arg pointer with
+ a SYMBOL_REF.
+ * ira.c (find_reg_equiv_invariant_const): Likewise.
+
+2010-06-17 Gunther Nikl <gnikl@users.sourceforge.net>
+
+ * config/rs6000/rs6000.c (print_operand) <'K'>: Also use
+ print_operand_address and puts to output the operand for CONST.
+
+2010-06-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/44572
+ * dwarf2out.c (dwarf2out_debug_hooks): Add entry for begin_epilogue
+ hook.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * v850-protos.h (print_operand): Delete.
+ (print_operand_address): Delete.
+ * v850.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * v850.c (print_operand_address): Rename to...
+ (v850_print_operand_address): ...this. Make static. Call
+ v850_print_operand.
+ (print_operand): Rename to...
+ (v850_print_operand): ...this. Make static. Call
+ v850_print_operand_address.
+ (v850_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
+ (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/sh/sh-protos.h (print_operand): Delete.
+ (print_operand_address): Delete.
+ * config/sh/sh.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/sh/sh.c (sh_print_operand_address): Make static.
+ (sh_print_operand): Make static. Call sh_print_operand_address
+ and sh_print_operand.
+ (sh_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
+ (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/mcore/mcore-protos.h (mcore_print_operand): Delete.
+ (mcore_print_operand_address): Delete.
+ * config/mcore/mcore.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/mcore/mcore.c (mcore_print_operand_address): Make static.
+ (mcore_print_operand): Make static.
+ (mcore_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define
+ (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/m68hc11/m68hc11-protos.h (print_operand): Delete.
+ (print_operand_address): Delete.
+ * config/m68hc11/m68hc11.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/m68hc11/m68hc11.c (m68hc11_print_operand_address): Make
+ static.
+ (m68hc11_print_operand): Make static.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/m32r/m32r-protos.h (m32r_print_operand): Delete.
+ (m32r_print_operand_address): Delete.
+ * config/m32r/m32r.h (m32r_punct_chars): Delete.
+ (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/m32r/m32r.c (m32r_punct_chars): Make static.
+ (m32r_print_operand_address): Make static.
+ (m32r_print_operand): Make static.
+ (m32r_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS):
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/iq2000/iq2000-protos.h (print_operand): Delete.
+ (print_operand_address): Delete.
+ * config/iq2000/iq2000.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ (iq2000_print_operand_punct): Delete.
+ * config/iq2000/iq2000.c (iq2000_print_operand_punct): Make static.
+ (iq2000_print_operand_address): Make static.
+ (iq2000_print_operand): Make static.
+ (iq2000_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS):
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/frv/frv-protos.h (frv_print_operand): Delete.
+ (frv_print_operand_address): Delete.
+ * config/frv/frv.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/frv/frv.c (frv_print_operand_address): Make static.
+ (frv_print_operand): Make static.
+ (frv_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS):
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * tree.h (vec_member): Declare.
+ * tree.c (vec_member): Define.
+
+2010-06-17 Richard Guenther <rguenther@suse.de>
+
+ * tree-flow-inline.h (array_ref_contains_indirect_ref): Remove.
+ * tree-flow.h (array_ref_contains_indirect_ref): Likewise.
+
+2010-06-17 Richard Guenther <rguenther@suse.de>
+
+ * tree-inline.c (declare_return_variable): Remove bogus code.
+
+2010-06-17 Richard Guenther <rguenther@suse.de>
+
+ * gimplify.c (gimplify_bind_expr): Always promote complex
+ and vector variables to registers if possible.
+
+2010-06-17 Richard Guenther <rguenther@suse.de>
+
+ * expr.c (get_inner_reference): Use double_int for bit_offset
+ calculation.
+
+2010-06-16 DJ Delorie <dj@redhat.com>
+
+ * common.opt (-fstrict-volatile-bitfields): new.
+ * doc/invoke.texi: Document it.
+ * fold-const.c (optimize_bit_field_compare): For volatile
+ bitfields, use the field's type to determine the mode, not the
+ field's size.
+ * expr.c (expand_assignment): Likewise.
+ (get_inner_reference): Likewise.
+ (expand_expr_real_1): Likewise.
+ * expmed.c (store_fixed_bit_field): Likewise.
+ (extract_bit_field_1): Likewise.
+ (extract_fixed_bit_field): Likewise.
+
+2010-06-16 Richard Guenther <rguenther@suse.de>
+
+ * tree-inline.c (remap_gimple_op_r): Recurse using remap_gimple_op_r.
+
+2010-06-16 Douglas B Rupp <rupp@gnat.com>
+
+ * config/ia64/vms.h (ASM_OUTPUT_DWARF_DELTA_UNITS): Remove.
+ (ASM_OUTPUT_DWARF_VMS_DELTA: Define new macro.
+ * dbxout.c (gcc_debug_hooks): New entry begin_epilogue.
+ * debug.c: Likewise.
+ * sdbout.c: Likewise.
+ * vmsdbgout.c: Likewise.
+ * debug.h: Likewise. (dwarf2out_vms_{begin,end}_prologue): Declare.
+ * doc/tm.texi (ASM_OUTPUT_DWARF_VMS_DELTA): Document.
+ * dwarf2asm.c (dw2_asm_output_vms_delta): New function.
+ (ASM_OUTPUT_DWARF_VMS_DELTA): Call it.
+ * dwarf2asm.h (dw2_asm_output_vms_delta): Declare.
+ * dwarf2out.c (dw_fde_struct): New fields
+ dw_fde_vms_{end,begin}_prologue.
+ (PROLOGUE_END_LABEL, EPILOGUE_BEGIN_LABEL): New macros.
+ (dwarf2out_begin_prologue): Set dw_fde_struct defaults for above.
+ (dwarf2out_vms_end_prologue): New function.
+ (dwarf2out_vms_begin_epilogue): New function.
+ (dw_val_struct): New value dw_val_class_vms_delta.
+ (gcc_debug_hooks): New entry begin_epilogue. Set end_prologue,
+ begin_epilogue for VMS.
+ (AT_vms_delta1, AT_vms_delta2, add_AT_vms_delta): Declare
+ new static functions.
+ (dwarf_attr_name): New cases DW_AT_HP_{prologue,epilogue}.
+ (AT_vms_delta1, AT_vms_delta2, add_AT_vms_delta): New
+ static functions.
+ (print_die): New case dw_val_class_vms_delta.
+ (attr_checksum): Likewise.
+ (same_dw_val_p: Likewise.
+ (size_of_die): Likewise.
+ (value_format): Likewise.
+ (output_die): Likewise.
+ (gen_subprogram_die): Call add_AT_vms_delta on VMS.
+ (dwarf2out_begin_epilogue): Rename to dwarf2out_cfi_begin_epilogue
+ * dwarf2out.h (dwarf2out_begin_epilogue): Rename to
+ dwarf2out_cfi_begin_epilogue
+ * final.c (final_scan_insn): Likewise. Call begin_epilogue.
+
+2010-06-16 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/cris/cris-protos.h (cris_print_operand): Delete.
+ (cris_print_operand_address): Delete.
+ * config/cris/cris.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/cris/cris.c (cris_print_operand_address): Make static.
+ (cris_print_operand): Make static.
+ (cris_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS):
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+
+2010-06-16 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/arm/arm-protos.h (arm_print_operand): Delete.
+ (arm_print_operand_address): Delete.
+ * config/arm/arm.h (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS, ARM_PRINT_OPERAND_ADDRESS):
+ (THUMB_PRINT_OPERAND_ADDRESS): Delete and move code to...
+ * config/arm/arm.c (arm_print_operand_address): ...here. New function.
+ (arm_print_operand): Make static.
+ (arm_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS):
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+
+2010-06-16 Nick Clifton <nickc@redhat.com>
+
+ * config/rx/constraints.md (NEGint4): New constraint.
+ * config/rx/rx.md (attr cc): Add set_zsc.
+ (cbranchsf4): Only test for -fnon-call-exceptions if cfun has been
+ initialised.
+ (cmpsf): Likewise.
+ (call_internal): Clobber the cc0 register.
+ (call_value_internal): Likewise.
+ (cstoresi4): Likewise.
+ (movsieq): Likewise.
+ (movsine): Likewise.
+ (addsi3): Add alternative to handle small negative constants.
+ (sunsi3): Likewise.
+ (addsi3): Do not set the O bit in the cc0 register.
+ (adddi3): Likewise.
+ (subsi3): Likewise.
+ (subdi3): Likewise.
+ (andsi3): Reorder alternatives to prefer shorter forms.
+ (mulsi3): Likewise.
+ (iorsi3): Likewise.
+ (negsi2): Note that the cc0 flags are set.
+ (rotlsi3): Note that only the Z and S bits are set in cc0.
+ (lshrsi3): Likewise.
+ (ashlsi3): Likewise.
+ (subsf3): Use %Q for the MEM operand.
+ (fix_truncsfsi2): Likewise.
+ (floatsisf2): Likewise.
+ (bitset): Remove early clobber from destination.
+ (bitset_in_memory): Likewise.
+ (lrintsf2): Clobber the cc0 register.
+ * config/rx/rx.c (rx_notice_update_cc): Handle CC_SET_ZSC.
+ (rx_print_operand): Handle %N.
+
+2010-06-16 Jan Hubicka <jh@suse.cz>
+
+ * df-core.c (df_compact_blocks): Free problem_temps vector.
+
+2010-06-16 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/43905
+ * tree-sra.c: Include tree-inline.h.
+ (create_abstract_origin): Removed.
+ (modify_function): Version the call graph node instead of creating
+ abstract origins and dealing with same_body aliases.
+ * tree-sra.c (ipa_sra_preliminary_function_checks): Check whether the
+ function is versionable.
+ * Makefile.in (tree-sra.o): Add TREE_INLINE_H to dependencies.
+
+2010-06-16 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * config/mips/linux64.h (BIONIC_DYNAMIC_LINKERN32): Define.
+ (CHOOSE_DYNAMIC_LINKER): Update.
+
+2010-06-15 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (*prefetch_sse_<mode>): Macroize insn from
+ *prefetch_sse and *prefetch_sse_rex using P mode iterator.
+ (*prefetch_3dnow_<mode>): Ditto from *prefetch_3dnow and
+ *prefetch_3dnow_rex.
+
+2010-06-15 Anatoly Sokolov <aesok@post.ru>
+
+ * target.h (struct asm_out):Add declare_constant_name field.
+ * target-def.h (TARGET_ASM_DECLARE_CONSTANT_NAME): Define.
+ (TARGET_INITIALIZER): Use TARGET_ASM_DECLARE_CONSTANT_NAME.
+ * output.h (default_asm_declare_constant_name): Declare.
+ (assemble_label): Update prototype.
+ * varasm.c (assemble_constant_contents): Use
+ targetm.asm_out.declare_constant_name target hook.
+ (assemble_label): Add 'file' argument.
+ (default_asm_declare_constant_name): New function.
+ * system.h (ASM_DECLARE_CONSTANT_NAME): Poison.
+ * doc/tm.texi (ASM_DECLARE_CONSTANT_NAME): Remove.
+ (TARGET_ASM_DECLARE_CONSTANT_NAME): Document it.
+
+ * config/darwin-protos.h (darwin_asm_declare_constant_name): Declare.
+ * config/darwin.c (darwin_asm_declare_constant_name): New function.
+ (machopic_output_indirection): Update assemble_label argument list.
+ * config/darwin.h (ASM_DECLARE_CONSTANT_NAME): Remove.
+ (TARGET_ASM_DECLARE_CONSTANT_NAME): Define.
+
+2010-06-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/44391
+ * graphite-clast-to-gimple.c (graphite_create_new_loop_guard): Use
+ size_one_node for pointer types. Do not call gmp_cst_to_tree.
+
+2010-06-15 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-pre.c (eliminate): Handle PHI elimination to constants.
+
+2010-06-15 Paul Brook <paul@codesourcery.com>
+
+ * config/arm/arm.c (use_vfp_abi): Add sorry() for Thumb-1
+ hard-float ABI.
+
+2010-06-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * tree-vect-patterns.c (vect_pattern_recog_1): Bail out if we
+ don't get a vector type for output.
+
+2010-06-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/44536
+ * langhooks.h (struct lang_hooks_for_decls): Add omp_report_decl.
+ * langhooks-def.h (LANG_HOOKS_OMP_REPORT_DECL): Define.
+ (LANG_HOOKS_DECLS): Add it.
+ * gimplify.c (omp_notice_variable): Call
+ lang_hooks.decls.omp_report_decl.
+
+2010-06-15 Martin Jambor <mjambor@suse.cz>
+
+ PR lto/44464
+ * tree-sra.c (replace_removed_params_ssa_names): Call release_ssa_name
+ on the newly dead SSA name.
+
+2010-06-15 Alan Modra <amodra@gmail.com>
+
+ * doc/invoke.texi: Add mcmodel to powerpc options.
+ * configure.ac: Add HAVE_LD_LARGE_TOC test.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * config/rs6000/linux64.opt (mcmodel): New.
+ * config/rs6000/linux64.h (TARGET_USES_LINUX64_OPT): Define.
+ (TARGET_CMODEL, SET_CMODEL): Define.
+ (SUBSUBTARGET_OVERRIDE_OPTIONS): Check user -mcmodel choice,
+ select CMODEL_MEDIUM default.
+ * config/rs6000/rs6000.h (enum rs6000_cmodel): New.
+ (TARGET_CMODEL): Define default.
+ * config/rs6000/rs6000.c (cmodel): New variable.
+ (rs6000_explicit_options): Add cmodel field.
+ (rs6000_handle_option): Handle -mcmodel.
+ (create_TOC_reference): Add largetoc_reg param. Generate high,
+ lo_sum rtl for CMODEL_MEDIUM and CMODEL_LARGE. Update all callers.
+ (rs6000_delegitimize_address): Recognise new toc reference rtl
+ and minimal-toc rtl.
+ (rs6000_legitimize_reload_address): Handle new toc references.
+ (print_operand_address): Handle legitimate_constant_pool_address_p
+ match before lo_sum.
+ (rs6000_eliminate_indexed_memrefs): Tidy.
+ (rs6000_emit_move): Tweak threshold for inlining constants.
+ Keep rs6000_emit_allocate_stack large stack frame offsets
+ loaded into r0 inline.
+ (rs6000_generate_compare <cmptf_internal2>): One more clobber.
+ (tocrel_base, tocrel_offset): New variables.
+ (toc_relative_expr_p): Set them here.
+ (print_operand_address): Skip over any offset on constant pool address.
+ (rs6000_output_addr_const_extra): Print tocrel_offset before @toc.
+ (rs6000_mode_dependent_address <LO_SUM>): False for new toc refs.
+ (offsettable_ok_by_alignment): New function.
+ (rs6000_emit_move): Address suitably aligned local symbol_refs
+ relative to the toc pointer for -mcmodel=medium.
+ (legitimate_constant_pool_address_p): Make param const_rtx. Add
+ strict param. Allow lo_sum version of addressing. Verify reg
+ used for -mminimal-toc and -mcmodel != small. Update all callers.
+ * config/rs6000/constraints.md: Update for above change.
+ * config/rs6000/predicates.md: Likewise.
+ * config/rs6000/rs6000.md (tls_gd_aix): Generate -mcmodel=medium/large
+ code.
+ (tls_gd): Split for -mcmodel=medium/large.
+ (tls_gd_high, tls_gd_low): New.
+ (tls_ld_aix, tls_ld, tls_ld_high, tls_ld_low): Similarly.
+ (tls_got_dtprel, tls_got_dtprel_high, tls_got_dtprel_low): Similarly.
+ (tls_got_tprel, tls_got_tprel_high, tls_got_tprel_low): Similarly.
+ (largetoc_high, largetoc_low): New.
+ (cmptf_internal2): Add clobber.
+ * config/rs6000/rs6000-protos.h: Update.
+
+2010-06-14 Changpeng Fang <changpeng.fang@amd.com>
+
+ * tree-ssa-loop-prefetch.c (nothing_to_prefetch_p): New. Return
+ true if no prefetch is going to be generated for a given group.
+ (estimate_prefetch_count): Use prefetch_mod and unroll_factor to
+ estimate the prefetch_count.
+ (loop_prefetch_arrays): Call nothing_to_prefetch_p; estimate the
+ prefetch count by considering the unroll_factor and prefetch_mod
+ for is_loop_prefetching_profitable.
+
+2010-06-14 Andreas Schwab <schwab@linux-m68k.org>
+
+ * config/m68k/m68k.c (m68k_delegitimize_address): Don't do
+ anything if the argument is not a MEM.
+
+2010-06-14 Alexandre Oliva <aoliva@redhat.com>
+
+ PR debug/43650
+ PR debug/44181
+ PR debug/44247
+ * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Skip
+ debug stmts.
+ (canonicalize_loop_ivs): Likewise.
+
+2010-06-14 Alexandre Oliva <aoliva@redhat.com>
+
+ PR debug/43656
+ * haifa-sched.c (setup_insn_reg_pressure_info,
+ update_register_pressure): Reject debug insns.
+ (ready_sort): Don't setup reg pressure for debug insns.
+ (schedule_insn): Don't update reg pressure for debug insns.
+
+2010-06-14 Richard Guenther <rguenther@suse.de>
+
+ * lto-streamer.c (cached_bp): Remove.
+ (bitpack_delete): Likewise.
+ (bitpack_create): Likewise.
+ (bp_get_next_word): Likewise.
+ (bp_pack_value, bp_unpack_value): Move ...
+ * lto-streamer.h (bp_pack_value, bp_unpack_value): ... here.
+ Re-implement.
+ (struct bitpack_d): Likewise.
+ (bitpack_create, lto_output_bitpack, lto_input_bitpack):
+ New inline functions.
+ * lto-streamer-out.c (lto_output_bitpack): Remove.
+ (pack_ts_base_value_fields): Adjust. Avoid conditional bitpacking.
+ (pack_value_fields): Adjust.
+ (lto_write_tree): Likewise.
+ (output_gimple_stmt): Likewise.
+ (output_function): Likewise.
+ * lto-streamer-in.c (input_gimple_stmt): Adjust.
+ (input_function): Likewise.
+ (unpack_ts_base_value_fields): Adjust. Avoid conditional bitpacking.
+ (lto_input_bitpack): Remove.
+ (lto_materialize_tree): Adjust.
+ * Makefile.in (ipa-prop.o): Add $(LTO_STREAMER_H) dependency.
+ * lto-cgraph.c (lto_output_edge): Adjust.
+ (lto_output_node): Likewise.
+ (lto_output_varpool_node): Likewise.
+ (lto_output_ref): Likewise.
+ (input_node): Likewise.
+ (input_varpool_node): Likewise.
+ (input_ref): Likewise.
+ (input_edge): Likewise.
+ (output_node_opt_summary): Likewise.
+ (input_node_opt_summary): Likewise.
+ * ipa-pure-const.c (pure_const_write_summary): Likewise.
+ (pure_const_read_summary): Likewise.
+ * ipa-prop.c (ipa_write_indirect_edge_info): Likewise.
+ (ipa_read_indirect_edge_info): Likewise.
+ (ipa_write_node_info): Likewise.
+ (ipa_read_node_info): Likewise.
+
+2010-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44534
+ * config/i386/sse.md (vec_extract_lo_<mode>): Replace 0x1 with 0x0.
+ (vec_extract_lo_v16hi): Likewise.
+ (vec_extract_lo_v32qi): Likewise.
+
+2010-06-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/44426
+ * tree.h (build_call_expr): Don't define as vararg macro, instead
+ add a prototype.
+ * builtins.c (build_call_nofold): Remove.
+ (expand_builtin_int_roundingfn, expand_builtin_pow,
+ expand_builtin_mempcpy_args, expand_builtin_stpcpy,
+ expand_builtin_memset_args, expand_builtin_strcmp,
+ expand_builtin_strncmp, expand_builtin_memory_chk): Use
+ build_call_nofold_loc instead of build_call_nofold.
+ (build_call_expr): New function.
+
+ PR tree-optimization/44508
+ * tree-ssa-propagate.h (substitute_and_fold): Add DO_DCE argument.
+ * tree-ssa-propagate.c (substitute_and_fold): If !DO_DCE,
+ don't eliminate trivially dead stmts.
+ * tree-vrp.c (vrp_finalize): Pass false as last argument
+ to substitute_and_fold.
+ * tree-ssa-copy.c (fini_copy_prop): Pass true as last argument
+ to substitute_and_fold.
+ * tree-ssa-ccp.c (ccp_finalize): Likewise.
+
+ PR bootstrap/44509
+ * c-config-lang.in (gtfiles): Add c-family/c-cppbuiltin.c.
+ * c-family/c-cppbuiltin.c: Include gt-c-family-c-cppbuiltin.h.
+ (lazy_hex_fp_values, lazy_hex_fp_value_count): Add GTY(()) markers.
+ (lazy_hex_fp_value, builtin_define_with_hex_fp_value): Use
+ ggc_strdup instead of xstrdup.
+
+2010-06-14 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/44507
+ * tree-vect-loop.c (get_initial_def_for_reduction): Use -1
+ to build initial vector for BIT_AND_EXPR.
+ * tree-vect-slp.c (vect_get_constant_vectors): Likewise.
+
+2010-06-14 Jakub Jelinek <jakub@redhat.com>
+
+ * config/s390/s390.md (*mov<mode>_64 DD_DF, mov<mode>): Properly
+ adjust z10prop set_attr.
+
+2010-06-13 Jan Hubicka <jh@suse.cz>
+
+ * bitmap.c (bitmap_and, bitmap_and_into, bitmap_and_compl,
+ bitmap_and_compl_into, bitmap_compl_and_into, bitmap_ior,
+ bitmap_ior_into, bitmap_xor, bitmap_xor_into,
+ bitmap_ior_and_compl, bitmap_ior_and_compl): Turn internal
+ datastructure checks into checking asserts.
+ * rtlanal.c (find_reg_note): Use gcc_checking_assert.
+ * tree-ssa-sccvn.c (VN_INFO): Likewise.
+ * df-scan.c (df_reorganize_refs_by_reg_by_reg, df_install_ref,
+ df_ref_create_structure): Likewise.
+ * alloc-pool.c (create_alloc_pool, empty_alloc_pool, pool_alloc,
+ pool_free): Use gcc_checking_assert.
+ * alias.c (get_alias_set): Likewise.
+ * var-tracking.c (variable_htab_free, shared_hash_copy,
+ canonicalize_values_mark, variable_merge_over_cur): Likewise.
+ * lto-streamer.c (bp_unpack_value): Likewise.
+
+2010-06-13 Richard Guenther <rguenther@suse.de>
+
+ * lto-streamer-in.c (lto_input_ts_type_tree_pointers):
+ Do not stream but initialize TYPE_CANONICAL to NULL.
+ (lto_output_ts_type_tree_pointers): Do not stream TYPE_CANONICAL.
+ * gimple.c (gimple_types_compatible_p): Disregard
+ TYPE_STRUCTURAL_EQUALITY_P.
+ (gimple_register_type): Use TYPE_CANONICAL as cache.
+ * lto-streamer.c (lto_record_common_node): Zero TYPE_CANONICAL
+ before registering common types.
+ * config/i386/i386.c (ix86_function_arg_boundary): Do not
+ use TYPE_CANONICAL, instead use TYPE_MAIN_VARIANT.
+ * tree.h (TYPE_CANONICAL): Clarify documentation.
+
+2010-06-13 Anatoly Sokolov <aesok@post.ru>
+
+ * config/ia64/ia64.h (FUNCTION_VALUE_REGNO_P, FUNCTION_VALUE,
+ LIBCALL_VALUE): Remove macros.
+ * config/ia64/ia64-protos.h (ia64_function_value): Remove.
+ * config/ia64/ia64.c (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE,
+ TARGET_FUNCTION_VALUE_REGNO_P): Define.
+ (ia64_libcall_value, ia64_function_value_regno_p): New functions.
+ (ia64_function_value): Make static. Handle receiving the function
+ type in 'fn_decl_or_type' argunent. Add 'outgoing' argument.
+
+2010-06-12 Jan Hubicka <jh@suse.cz>
+
+ * cse.c (cse_extended_basic_block): Move optimize_bb_for_speed_p
+ at correct place.
+
+2010-06-12 Bernd Schmidt <bernds@codesourcery.com>
+
+ * config/arm/arm.c (thumb2_reorg): Fix errors in previous change.
+
+2010-06-12 Jan Hubicka <jh@suse.cz>
+
+ * df-core.c (df_clear_bb_info): New function.
+ (df_set_blocks): bb_info is always allocated.
+ (df_get_bb_info): Use block_info_elt_size.
+ (df_set_bb_info): Likewise.
+ (df_compact_blocks): Update for new block_info.
+ (grow_bb_info): New function.
+ * df-problems.c (df_grow_bb_info): Move to df-core.c
+ (df_rd_set_bb_info): Remove.
+ (df_rd_free_bb_info): Do not free block pool.
+ (df_rd_alloc): Do not create pool, use check for
+ obstack presence instead of NULL pointer for new blocks.
+ (df_rd_free): DO not free alloc pool; clear block_info.
+ (problem_RD): Add size of block info structure.
+ (df_lr_set_bb_info): Remove.
+ (df_lr_free_bb_info): Do not free block pool.
+ (df_lr_alloc): Do not create pool, use check for
+ obstack presence instead of NULL pointer for new blocks.
+ (df_lr_free): DO not free alloc pool; clear block_info.
+ (problem_LR): Add size of block info structure.
+ (df_live_set_bb_info): Remove.
+ (df_live_free_bb_info): Do not free block pool.
+ (df_live_alloc): Do not create pool, use check for
+ obstack presence instead of NULL pointer for new blocks.
+ (df_live_free): DO not free alloc pool; clear block_info.
+ (problem_LIVE): Add size of block info structure.
+ (problem_CHAIN): Add size of block info structure.
+ (df_byte_lr_set_bb_info): Remove.
+ (df_byte_lr_free_bb_info): Do not free block pool.
+ (df_byte_lr_alloc): Do not create pool, use check for
+ obstack presence instead of NULL pointer for new blocks.
+ (df_byte_lr_free): DO not free alloc pool; clear block_info.
+ (problem_BYTE_LR): Add size of block info structure.
+ (problem_NOTE): Add size of block info structure.
+ (df_byte_MD_set_bb_info): Remove.
+ (df_byte_MD_free_bb_info): Do not free block pool.
+ (df_byte_MD_alloc): Do not create pool, use check for
+ obstack presence instead of NULL pointer for new blocks.
+ (df_byte_MD_free): DO not free alloc pool; clear block_info.
+ (problem_BD): Add size of block info structure.
+ * df-scan.c (df_scan_free_internal): Free block pool.
+ (df_scan_set_bb_info): Remove.
+ (df_scan_free_bb_info): Check for artificial_defs instead
+ of bb_info being non-NULL.
+ (df_scan_alloc): DO not create df_scan_block pool.
+ (problem_SCAN): Set size of block info.
+ (df_bb_refs_record): Do not allocate bb_info.
+ * df.h (df_problem): Add block_info_elt_size.
+ (struct dataflow): Change block_info to void *.
+ (df_scan_get_bb_info, df_rd_get_bb_info, df_lr_get_bb_info,
+ df_md_get_bb_info, df_live_get_bb_info, df_byte_lr_get_bb_info): Return
+ in-line structures.
+
+2010-06-12 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimize/44485
+ * tree-cfgcleanup.c (fixup_noreturn_call): Remove basic blocks
+ containing use of return value of noreturn function.
+
+2010-06-12 Anatoly Sokolov <aesok@post.ru>
+
+ * targhooks.c (default_function_value): Don't use
+ FUNCTION_OUTGOING_VALUE.
+ * system.h (FUNCTION_OUTGOING_VALUE): Poison.
+ * doc/tm.texi (FUNCTION_OUTGOING_VALUE): Removed.
+
+2010-06-12 Kazu Hirata <kazu@codesourcery.com>
+
+ * config.gcc (mips64*-*-linux*, mipsisa64*-*-linux*, mips*-*-linux*):
+ Add crtfastmath.o to extra_parts.
+ * config/mips/crtfastmath.c: New.
+ * config/mips/linux.h (ENDFILE_SPEC): New.
+
+2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (gcc_type_for_interval): Do not pass
+ old_type in parameter.
+ (gcc_type_for_value): Update call to gcc_type_for_interval.
+ (compute_type_for_level_1): Renamed compute_type_for_level.
+ Update call to gcc_type_for_interval.
+
+2010-06-11 Joseph Myers <joseph@codesourcery.com>
+
+ * common.opt (Wstrict-aliasing=, Wstrict-overflow=, fabi-version=,
+ flto-compression-level=, ftree-parallelize-loops=): Add RejectNegative.
+
+2010-06-11 Joseph Myers <joseph@codesourcery.com>
+
+ * opts-common.c: Include options.h.
+ (integral_argument): Move from opts.c.
+ (decode_cmdline_option): New. Based on read_cmdline_option.
+ * opts.c (integral_argument): Move to opts-common.c.
+ (read_cmdline_option): Move most contents to
+ decode_cmdline_option. Use %qs in diagnostics.
+ * opts.h (CL_ERR_DISABLED, CL_ERR_MISSING_ARG, CL_ERR_WRONG_LANG,
+ CL_ERR_UINT_ARG, struct cl_decoded_option, integral_argument,
+ decode_cmdline_option): New.
+
+2010-06-11 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/44481
+ * config/i386/i386.md (UNSPEC_PARITY): New unspec.
+ (paritydi2_cmp): Use UNSPEC_PARITY unspec instead of parity RTX.
+ (partiysi2_cmp): Ditto.
+ (*partiyhi2_cmp): Ditto.
+ (*parityqi2_cmp): Remove.
+
+2010-06-11 Jan Hubicka <jh@suse.cz>
+
+ * bitmap.h (bmp_iter_next_bit): New.
+ (bmp_iter_set, bmp_iter_and, bmp_iter_and_compl): Use it.
+
+2010-06-11 Sandra Loosemore <sandra@codesourcery.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-ssa-loop-ivopts.c (get_computation_cost_at): Return again the
+ computed cost.
+
+2010-06-11 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (unspec): New define_c_enum.
+ (unspecv): Ditto.
+
+2010-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ * c-family/c-cppbuiltin.c: Include cpp-id-data.h.
+ (lazy_hex_fp_values, lazy_hex_fp_value_count): New variables.
+ (lazy_hex_fp_value): New function.
+ (builtin_define_with_hex_fp_value): Provide definitions lazily.
+ * Makefile.in (c-family/c-cppbuiltin.o): Depend on $(CPP_ID_DATA_H).
+
+2010-06-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/44483
+ * tree-if-conv.c (bb_predicate_s): New struct.
+ (bb_predicate_p): New.
+ (bb_has_predicate): New.
+ (bb_predicate): New.
+ (set_bb_predicate): New.
+ (bb_predicate_gimplified_stmts): New.
+ (set_bb_predicate_gimplified_stmts): New.
+ (add_bb_predicate_gimplified_stmts): New.
+ (init_bb_predicate): New.
+ (free_bb_predicate): New.
+ (is_predicated): Use bb_predicate.
+ (add_to_predicate_list): Use bb_predicate and set_bb_predicate.
+ (predicate_bbs): Same. Gimplify the condition of the basic blocks
+ before processing their successors.
+ (clean_predicate_lists): Removed.
+ (find_phi_replacement_condition): Use bb_predicate.
+ (process_phi_nodes): Renamed ifconvert_phi_nodes. Avoid useless
+ computations.
+ (insert_gimplified_predicates): New.
+ (combine_blocks): Call insert_gimplified_predicates.
+ (tree_if_conversion): Call free_bb_predicate instead of
+ clean_predicate_lists.
+
+2010-10-11 Paul Brook <paul@codesourcery.com>
+
+ * doc/invoke.texi: Document ARM -mcpu=cortex-m4.
+ * config/arm/arm.c (all_architectures): Change v7e-m default to
+ cortexm4.
+ * config/arm/arm-cores.def: Add cortex-m4.
+ * config/arm/arm-tune.md: Regenerate.
+
+2010-06-11 Jan Hubicka <jh@suse.cz>
+
+ * ipa-pure-const.c (special_builtlin_state): New function.
+ (check_call): Use it instead of special casign BUILT_IN_RETURN.
+ (propagate_pure_const): Use it.
+
+2010-06-11 Jan Hubicka <jh@suse.cz>
+
+ * df-problems.c (df_live_scratch): Convert to bitmap_head.
+ (df_live_alloc): Initialize df_live_scratch when initializing
+ problem_data.
+ (df_live_transfer_function): Update uses of df_live_scratch.
+ (df_live_free): Free problem_data; clear df_live_scratch before
+ releasing the obstack.
+ (df_md_free): Free problem data.
+
+2010-06-11 Jan Hubicka <jh@suse.cz>
+
+ * doc/invoke.texi (Wsuggest-attribute): Document.
+ (Wmissing-noreturn): Remove.
+ * ipa-pure-const.c (warn_function_noreturn): New function.
+ * opts.c (decode_options): Set warn_suggest_attribute_noreturn on
+ warn_missing_noreturn.
+ * common.opt (Wsuggest-attribute=noreturn): New.
+ * tree-flow.h (warn_function_noreturn): Declare.
+ * tree-cfg.c (execute_warn_function_noreturn): Use
+ warn_function_noreturn.
+ (gate_warn_function_noreturn): New.
+ (pass_warn_function_noreturn): Update.
+
+2010-06-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * c-typeck.c (handle_warn_cast_qual): Add loc
+ parameter. Improve warning message.
+ (build_c_cast): Pass location to handle_warn_cast_qual.
+
+2010-06-11 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (pro_epilogue_adjust_stack_1) <TYPE_ALU>: Assert
+ that operand 0 == operand 1. Use x86_maybe_negate_const_int to output
+ insn mnemonic.
+ (pro_epilogue_adjust_stack_rex64) <TYPE_ALU>: Ditto.
+
+2010-06-10 Dodji Seketeli <dodji@redhat.com>
+
+ Fix bootstap on mips
+ * dwarf2out.c (is_naming_typedef_dec): Built-in TYPE_DECLs cannot
+ be naming typedefs.
+
+2010-06-11 Kai Tietz <kai.tietz@onevision.com>
+
+ * system.h (helper_const_non_const_cast): New inline for
+ gcc version <= 4.0.
+ (CONST_CAST2): For gcc version <= 4.0 use
+ new helper to do const/non-const casting.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * doc/md.texi: Document the "unspec" and "unspecv" enum names.
+ * Makefile.in (OBJS-common): Include insn-enums.o.
+ (insn-enums.o): New rule.
+ (simple_generated_c): Add insn-enums.c.
+ (build/genenums.o): New rule.
+ (genprogmd): Add "enums".
+ * genconstants.c (print_enum_type): Declare a C string array
+ for each enum.
+ * genenums.c: New file.
+ * print-rtl.c (print_rtx): If defined, use the "unspecv" enum
+ for UNSPEC_VOLATILE. If defined, use the "unspec" enum for both
+ UNSPEC and (as a fallback) for UNSPEC_VOLATILE.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * doc/md.texi (define_enum_attr): Document.
+ * rtl.def (DEFINE_ENUM_ATTR): New rtx.
+ * read-md.h (lookup_enum_type): Declare.
+ * read-md.c (lookup_enum_type): New function.
+ * genattr.c (gen_attr, main): Handle DEFINE_ENUM_ATTR.
+ * genattrtab.c (attr_desc): Add an enum_name field.
+ (evaluate_eq_attr): Take the associated attribute as argument.
+ Get the enum prefix from the enum_name field, if defined.
+ Use ACONCAT rather than a fixed-length buffer. Update recursive calls.
+ (simplify_test_exp): Pass attr to evaluate_eq_attr.
+ (add_attr_value): New function, split out from...
+ (gen_attr): ...here. Handle DEFINE_ENUM_ATTR.
+ (write_test_expr): Pass attr to evaluate_eq_attr.
+ (write_attr_get): Use the enum_name as the enum tag, if defined.
+ (write_attr_valueq): Use the enum_name as a prefix, if defined.
+ (find_attr): Initialize enum_name.
+ (main): Handle DEFINE_ENUM_ATTR.
+ * gensupport.c (process_rtx): Likewise.
+ * config/mips/mips.h (mips_tune_attr): Delete.
+ * config/mips/mips.md (cpu): Use define_attr_enum.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * doc/md.texi (define_c_enum, define_enum): Document.
+ * read-md.h (md_constant): Add a parent_enum field.
+ (enum_value, enum_type): New structures.
+ (upcase_string, traverse_enum_types): Declare.
+ * read-md.c (enum_types): New variable.
+ (upcase_string, add_constant): New functions.
+ (handle_constants): Don't create the hash table here.
+ Use add_constant.
+ (traverse_md_constants): Don't check for a null md_constants.
+ (decimal_string, handle_enum, traverse_enum_types): New functions.
+ (read_md_files): Initialize md_constants and md_enums.
+ * genconstants.c (print_md_constant): Ignore info argument.
+ Only print constants that belong to no enum.
+ (print_enum_type): New function.
+ (main): Don't pass stdout to print_md_constant. Call print_enum_type
+ for each defined enum type.
+ * config/mips/mips.md (processor): New define_enum.
+ (unspec): New define_c_enum.
+ (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12)
+ (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12)
+ (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12)
+ (UNSPEC_MEMORY_BARRIER): Moved to sync.md.
+ (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC)
+ (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S)
+ (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W)
+ (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR)
+ (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA)
+ (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR)
+ (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL)
+ (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R)
+ (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH)
+ (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL)
+ (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR)
+ (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH)
+ (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL)
+ (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR)
+ (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH)
+ (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB)
+ (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH)
+ (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H)
+ (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP)
+ (UNSPEC_RDDSP): Move to mips-dsp.md.
+ (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB)
+ (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB)
+ (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH)
+ (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU)
+ (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH)
+ (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU)
+ (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W)
+ (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH)
+ (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB)
+ (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W)
+ (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W)
+ (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH)
+ (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH):
+ Moved to mips-dspr2.md.
+ (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS)
+ (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS)
+ (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1)
+ (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Move from mips-ps-3d.md.
+ (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT)
+ (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0)
+ (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2)
+ (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD)
+ (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU)
+ (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU)
+ (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD,
+ UNSPEC_LOONGSON_PSADBH)
+ (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH)
+ (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD)
+ (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md.
+ (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Move to mips-loongson2ef.md.
+ (cpu): Update comment.
+ * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP)
+ (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP)
+ (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE)
+ (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md.
+ * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG,
+ UNSPEC_LOONGSON_PCMPEQ)
+ (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR,
+ UNSPEC_LOONGSON_PINSR_0)
+ (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2)
+ (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD)
+ (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU)
+ (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU)
+ (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD,
+ UNSPEC_LOONGSON_PSADBH)
+ (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH)
+ (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD)
+ (UNSPEC_LOONGSON_PSUBD): Moved from mips.md
+ * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md
+ * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ)
+ (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB)
+ (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH)
+ (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH)
+ (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL)
+ (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA)
+ (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA)
+ (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB)
+ (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL)
+ (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL)
+ (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR)
+ (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH)
+ (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W)
+ (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR)
+ (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV)
+ (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT)
+ (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB)
+ (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W)
+ (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP)
+ (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP)
+ (UNSPEC_RDDSP): Moved from mips.md.
+ * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH)
+ (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND)
+ (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB)
+ (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD)
+ (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH)
+ (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W)
+ (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH)
+ (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND)
+ (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH)
+ (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH)
+ (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH)
+ (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH)
+ (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH)
+ (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md.
+ * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C)
+ (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS)
+ (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1)
+ (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC)
+ (UNSPEC_SCC): Moved from mips.md.
+ * config/mips/mips.c (mips_arch, mips_tune): Change enum from
+ "processor_type" to "processor".
+ (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES.
+ * config/mips/mips.h (processor_type): Delete.
+ (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from
+ "processor_type" to "processor".
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * configure.ac (tm_include_list): Add insn-constants.h.
+ * configure: Regenerate.
+ * Makefile.in (GTM_H): Move insn-constants.h here from...
+ (TM_H): ...here.
+ * mkconfig.sh: Remove special handling for insn-constants.h.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * Makefile.in (BUILD_RTL): Move build/read-md.o to...
+ (BUILD_MD): ...this new variable.
+ (simple_generated_rtl_h, simple_generated_rtl_c): New variables
+ that include the old contents of simple_generated_h and
+ simple_generated_c.
+ (simple_generated_h, simple_generated_c): Include them. Add
+ insn-constants.h.
+ (s-%): Make simple_generated_{h,c} stamps depend on $(MD_DEPS)
+ and simple_generated_rtl_{h,c} stamps depend on insn-conditions.md.
+ Remove these dependencies from the main rule and include
+ insn-conditions.md in the command line only if it appears
+ in the dependency list.
+ (insn-constants.h, s-constants): Delete.
+ (build/genconstants.o): Don't depend on $(RTL_BASE_H), $(GTM_H)
+ or gensupport.h.
+ (build/genmddeps.o): Likewise.
+ (genprogrtl): New variable that contains everything from genprogmd
+ except mddeps and constants.
+ (genprogmd): Redefine in terms of genprogrtl. Make these programs
+ depend on $(BUILD_MD)
+ (genprog): New variable. Make these programs depend on
+ $(BUILD_ERRORS).
+ * genmddeps.c: Don't include tm.h, rtl.h or gensupport.h.
+ (main): Use read_md_files instead of init_rtx_reader_args.
+ * genconstants.c: As for genmddeps.c.
+ * read-md.h (read_skip_construct): Declare.
+ * read-md.c (read_skip_construct): New function.
+ (handle_file): Allow a null handle_directive, skipping the
+ construct if so.
+ (parse_include): Update the comment accordingly.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H).
+ * genmddeps.c: Include read-md.h.
+ (main): Call init_rtx_reader_args instead of init_md_reader_args.
+ * genattr.c (main): Likewise.
+ * genattrtab.c (main): Likewise.
+ * genautomata.c (main): Likewise.
+ * gencodes.c (main): Likewise.
+ * genconditions.c (main): Likewise.
+ * genconfig.c (main): Likewise.
+ * genconstants.c (main): Likewise.
+ * genemit.c (main): Likewise.
+ * genextract.c (main): Likewise.
+ * genflags.c (main): Likewise.
+ * genopinit.c (main): Likewise.
+ * genoutput.c (main): Likewise.
+ * genpeep.c (main): Likewise.
+ * genrecog.c (main): Likewise.
+ * genpreds.c (main): Likewise.
+ * gensupport.h (in_fname): Move to read-md.h.
+ (init_md_reader_args_cb): Rename to...
+ (init_rtx_reader_args_cb): ...this and return a bool.
+ (init_md_reader_args): Rename to...
+ (init_rtx_reader_args): ...this and return a bool.
+ (include_callback): Move to read-md.h.
+ * gensupport.c (in_fname, include_callback, base_dir, max_include_len)
+ (file_name_list, first_dir_md_include): Move to read-md.c
+ (first_bracket_include): Delete unused variable.
+ (last_dir_md_include): Move to read-md.c.
+ (process_include): Delete, moving code to read-md.c:handle_include.
+ (process_rtx): Don't handle INCLUDE.
+ (save_string): Delete.
+ (rtx_handle_directive): New function.
+ (init_md_reader_args_cb): Rename to...
+ (init_rtx_reader_args_cb): ...this and return a boolean success value.
+ Use read_md_args.
+ (init_md_reader_args): Rename to...
+ (init_rtx_reader_args): ...this and return a boolean success value.
+ * rtl.def (INCLUDE): Delete.
+ * rtl.h (read_rtx): Remove "int *" argument. Add "const char *"
+ argument.
+ * read-rtl.c (read_conditions): Don't gobble ')' here.
+ (read_mapping): Likewise.
+ (read_rtx): Remove LINENO argument. Add RTX_NAME argument.
+ Handle top-level non-rtx constructs here rather than in read_rtx_1.
+ Store the whole queue in *X. Remove call to init_md_reader.
+ (read_rtx_1): Rename to...
+ (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes.
+ Don't handle top-level non-rtx constructs here. Don't handle (nil)
+ here.
+ (read_nested_rtx): New function. Handle (nil) here rather than
+ in read_rtx_code.
+ (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't
+ gobble ')' here.
+ * read-md.h (directive_handler_t): New type.
+ (in_fname, include_callback): Moved from read-md.h.
+ (read_constants, init_md_reader): Delete.
+ (read_md_files): Declare.
+ * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include)
+ (last_dir_md_include_ptr, include_callback, max_include_len): Moved
+ from gensupport.c.
+ (read_constants): Rename to...
+ (handle_constants): ...this. Don't gobble ')' here.
+ (handle_include, handle_file, handle_toplevel_file)
+ (parse_include): New functions, mostly taken from gensupport.c.
+ (init_md_reader): Subsume into...
+ (read_md_files): ...this new function.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * read-md.h (read_char): Increment read_md_lineno after reading '\n'.
+ (unread_char): Decrement read_md_lineno after putting back '\n'.
+ * read-md.c (fatal_with_file_and_line): Push back any characters
+ that we decide not to add to the context.
+ (read_skip_spaces): Don't increment read_md_lineno here. Avoid using
+ fatal_expected_char in cases where '/' ends a line (for example).
+ (read_name): Don't increment read_md_lineno here.
+ (read_escape): Likewise.
+ (read_quoted_string): Likewise.
+ (read_braced_string): Likewise.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * Makefile.in (READ_MD_H): Add $(HASHTAB_H).
+ (build/genconstants.o): Depend on $(READ_MD_H) gensupport.h.
+ * genconstants.c: Include read-md.h.
+ * read-rtl.c (md_constants): Move to read-md.c.
+ (md_name): Move to read-md.h.
+ (initialize_iterators): Use leading_string_hash instead of def_hash
+ and leading_string_eq_p instead of def_name_eq_p.
+ (read_name): Move to read-md.c.
+ (def_hash, def_name_eq_p): Delete.
+ (read_constants, traverse_md_constants): Move to read-md.c.
+ * rtl.h (md_constant, traverse_md_constants): Move to read-md.h.
+ * read-md.h: Include hashtab.h.
+ (md_name): Moved from read-rtl.c.
+ (md_constant): Moved from read-md.h.
+ (leading_string_hash, leading_string_eq_p, read_name)
+ (read_constants, traverse_md_constants): Declare.
+ * read-md.c (md_constants): Moved from read-rtl.c.
+ (leading_string_hash, leading_string_eq_p): New functions.
+ (read_name, read_constants, traverse_md_constants): Moved from
+ read-rtl.c.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * read-rtl.c (md_name): New structure.
+ (read_name): Take an md_name instead of a buffer pointer.
+ Use the "string" field instead of strcpy when expanding constants.
+ (read_constants): Remove the tmp_char argument. Update the calls
+ to read_name, using two local name buffers instead of the tmp_char
+ argument. Merge the constant-creation code.
+ (read_conditions): Remove the tmp_char argument. Update the calls
+ to read_name, using a local name buffer instead of the tmp_char
+ argument.
+ (read_mapping): Replace tmp_char variable with a local name buffer.
+ Update the calls to read_name.
+ (read_rtx_1): Likewise. Update the calls to read_constants and
+ read_conditions.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * Makefile.in (build/read-md.o): Depend on errors.h.
+ * read-md.h (error_with_line): Declare.
+ * read-md.c: Include errors.h.
+ (message_with_line_1): New function, extracted from...
+ (message_with_line): ...here.
+ (error_with_line): New function.
+ * genattrtab.c: If a call to message_with_line is followed by
+ "have_error = 1;", replace both statements with a call to
+ error_with_line.
+ * genoutput.c: Likewise.
+ * genpreds.c: Likewise.
+ * genrecog.c: If a call to message_with_line is followed by
+ "error_count++;", replace both statements with a call to
+ error_with_line.
+ (errorcount): Delete.
+ (main): Don't check it.
+ * gensupport.c: If a call to message_with_line is followed by
+ "errors = 1;", replace both statements with a call to error_with_line.
+ (errors): Delete.
+ (process_define_cond_exec): Check have_error instead of errors.
+ (init_md_reader_args_cb): Likewise. Don't set errors.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * read-md.h (read_md_file): Declare.
+ (read_char, unread_char): New functions.
+ (fatal_with_file_and_line, fatal_expected_char, read_skip_spaces)
+ (read_quoted_string, read_string): Remove FILE * argument.
+ * read-md.c (read_md_file): New variable.
+ (read_md_filename, read_md_lineno): Update comments and remove
+ unnecessary initialization.
+ (fatal_with_file_and_line, fatal_expected_char, read_skip_spaces)
+ (read_escape, read_quoted_string, read_braced_string, read_string):
+ Remove FILE * argument. Update calls accordingly, using read_char
+ and unread_char instead of getc and ungetc.
+ * rtl.h (read_rtx): Remove FILE * argument.
+ * read-rtl.c (iterator_group): Remove FILE * argument from
+ "find_builtin".
+ (iterator_traverse_data): Remove "infile" field.
+ (find_mode, find_code, apply_mode_maps, apply_iterator_to_rtx)
+ (add_mapping, read_name, read_constants, read_conditions)
+ (validate_const_int, find_iterator, read_mapping, check_code_iterator)
+ (read_rtx, read_rtx_1, read_rtx_variadic): Remove FILE * argument.
+ Remove file arguments from all calls, using read_char and unread_char
+ instead of getc and ungetc.
+ * gensupport.c (process_include): Preserve read_md_file around
+ the include. Set read_md_file to the handle of the included file.
+ Update call to read_rtx.
+ (init_md_reader_args_cb): Set read_md_file to the handle of the file
+ and remove local FILE *. Update calls to read_rtx.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * read-md.h (read_rtx_lineno): Rename to...
+ (read_md_lineno): ...this.
+ (read_rtx_filename): Rename to...
+ (read_md_filename): ...this.
+ (copy_rtx_ptr_loc): Rename to...
+ (copy_md_ptr_loc): ...this.
+ (print_rtx_ptr_loc): Rename to...
+ (print_md_ptr_loc): ...this.
+ * read-md.c: Likewise. Update references after renaming.
+ (string_obstack): Replace RTL with MD in comment.
+ (set_rtx_ptr_loc): Rename to...
+ (set_md_ptr_loc): ...this.
+ (get_rtx_ptr_loc): Rename to...
+ (get_md_ptr_loc): ...this.
+ * genconditions.c: Update references after renaming.
+ * genemit.c: Likewise.
+ * genoutput.c: Likewise.
+ * genpreds.c: Likewise.
+ * gensupport.c: Likewise.
+ * read-rtl.c: Likewise.
+
+2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * Makefile.in (READ_MD_H): New variable.
+ (BUILD_RTL): Add build/read-md.o.
+ (lto-wrapper.o): Depend on coretypes.h instead of defaults.h.
+ (build/gensupport.o, build/read-rtl.o, build/genattr.o)
+ (build/genattrtab.o, build/genconditions.o build/genemit.o)
+ (build/genextract.o, build/genflags.o, build/genoutput.o)
+ (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H).
+ (build/read-md.o): New rule.
+ * defaults.h (obstack_chunk_alloc, obstack_chunk_free)
+ (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to...
+ * coretypes.h: ...here.
+ * lto-wrapper.c: Include coretypes.h instead of defaults.h.
+ * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete.
+ * genattr.c: Include read-md.h.
+ * genattrtab.c: Likewise.
+ * genconditions.c: Likewise.
+ * genemit.c: Likewise.
+ * genextract.c: Likewise.
+ * genflags.c: Likewise.
+ * genoutput.c: Likewise.
+ * genpreds.c: Likewise.
+ * genrecog.c: Likewise.
+ * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc)
+ (join_c_conditions, print_c_condition, read_rtx_filename)
+ (read_rtx_lineno): Move to read-md.h.
+ * read-rtl.c: Include read-md.h.
+ (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack)
+ (joined_conditions, joined_conditions_obstack, read_rtx_lineno)
+ (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char)
+ (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc)
+ (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions)
+ (print_c_condition, read_skip_spaces, read_escape, read_quoted_string)
+ (read_braced_string, read_string): Move to read-md.c.
+ (read_rtx): Move some initialization to init_md_reader and call
+ init_md_reader here.
+ * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt):
+ Move to read-md.h.
+ * gensupport.c: Include read-md.h.
+ (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c.
+ * read-md.h, read-md.c: New files.
+
+2010-06-10 Anatoly Sokolov <aesok@post.ru>
+
+ * config/moxie/moxie.h (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
+ LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove macros.
+ * config/moxie/moxie-protos.h (moxie_function_value): Remove.
+ * config/moxie/moxie.c (moxie_function_value): Make static.
+ (moxie_libcall_value, moxie_function_value_regno_p): New functions.
+ (TARGET_LIBCALL_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define.
+
+2010-06-10 Martin Jambor <mjambor@suse.cz>
+
+ * Makefile.in (tree-sra.o): Add DBGCNT_H to dependencies.
+ * dbgcnt.def (tree_sra): New counter.
+ * tree-sra.c: Include dbgcnt.h.
+ (gate_intra_sra): Check tree_sra debug counter.
+
+2010-06-10 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/44258
+ * tree-sra.c (build_access_subtree): Return false iff there is a
+ partial overlap.
+ (build_access_trees): Likewise.
+ (analyze_all_variable_accesses): Disqualify candidates if
+ build_access_trees returns true for them.
+
+2010-06-10 Alexandre Oliva <aoliva@redhat.com>
+
+ PR debug/41371
+ * var-tracking.c (find_loc_in_1pdv): Remove recursion, only
+ tail-recurse into canonical node. Fast-forward over
+ non-canonical VALUEs.
+
+2010-06-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR boostrap/44470
+ * config/i386/i386.md (*add<mode>_1): Revert revision 160394.
+ (*addsi_1_zext) <TYPE_LEA>: Likewise.
+ (add lea splitter): Likewise.
+ (add_zext lea splitter): Likewise.
+
+2010-06-10 Joseph Myers <joseph@codesourcery.com>
+
+ * common.opt (fshow-column): Don't mark as C ObjC C++ ObjC++.
+
+2010-06-10 Jan Hubicka <jh@suse.cz>
+
+ * df-problems.c (df_live_problem_data): Add live_bitmaps.
+ (df_live_alloc): Initialize problem data and live_osbtacks.
+ (df_live_finalize): Remove obstack, problem data; do not
+ clear all bitmaps.
+ (df_live_top_dump, df_live_bottom_dump): Do not dump old
+ data when not allocated.
+ (df_live_verify_solution_start): Do not allocate problem data.
+ (df_live_verify_solution_end): Check if out is allocated.
+ (struct df_md_problem_data): New structure.
+ (df_md_alloc): Allocate problem data.
+ (df_md_free): Free problem data; do not clear bitmaps.
+
+2010-06-10 Jan Beulich <jbeulich@novell.com>
+
+ PR bootstrap/37304
+ * configure.ac: Replace $() with ${} when intending to expand
+ variables rather than invoking commands.
+ * configure: Re-generate.
+
+2010-06-10 Jan Hubicka <jh@suse.cz>
+
+ PR rtl-optimization/44460
+ * emit-rtl.c (set_mem_attributes_minus_bitpos): Remove
+ TYPE_NEEDS_CONSTRUCTING sanity check.
+
+2010-06-10 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * doc/include/fdl.texi: Move to GFDL version 1.3.
+
+ * doc/cpp.texi: Move to GFDL version 1.3.
+ * doc/gcc.texi: Move to GFDL version 1.3. Fix copyright years.
+ * doc/gccint.texi: Move to GFDL version 1.3.
+ * doc/gcov.texi: Move to GFDL version 1.3. Update copyright years.
+ * doc/install.texi: Move to GFDL version 1.3. Fix copyright years.
+ * doc/invoke.texi: Move to GFDL version 1.3.
+
+2010-06-09 Jan Hubicka <jh@suse.cz>
+
+ * ipa-pure-const.c (propagate_pure_const, propagate_noreturn):
+ Break out from ...
+ (propagate) ... here; swap the order.
+
+2010-06-09 Jan Hubicka <jh@suse.cz>
+
+ * bitmap.c (bitmap_elt_insert_after, bitmap_first_set_bit,
+ bitmap_first_set_bit, bitmap_last_set_bit, bitmap_last_set_bit,
+ bitmap_and_into, bitmap_and_compl_into, bitmap_set_range,
+ bitmap_compl_and_into, bitmap_elt_ior): Use checking asserts.
+
+2010-06-09 Changpeng Fang <changpeng.fang@amd.com>
+
+ * tree-ssa-loop-prefetch.c (gather_memory_references_ref):
+ Do not the gather memory reference in the outer loop if the step
+ is not a constant.
+
+2010-06-09 Changpeng Fang <changpeng.fang@amd.com>
+
+ * tree-ssa-loop-prefetch.c (PREFETCH_MOD_TO_UNROLL_FACTOR_RATIO) :
+ Change the PREFETCH_MOD_TO_UNROLL_FACTOR_RATIO threshold value from
+ 8 to 4. Minor change of the related comments.
+
+2010-06-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-scalar-evolution.c (instantiate_scev_name): Do not fail
+ the scev analysis when the variable is not used outside the loop
+ in a close phi node: call compute_overall_effect_of_inner_loop.
+
+2010-06-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (single_pred_cond): Renamed
+ single_pred_cond_non_loop_exit. Return NULL for loop exit edges.
+ (build_sese_conditions_before): Renamed call to single_pred_cond.
+ (build_sese_conditions_after): Same.
+
+2010-06-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.h: Fix comments and indentation.
+ * graphite-sese-to-poly.c: Same.
+ (build_sese_conditions_before): Compute stmt and gbb only when needed.
+ * tree-chrec.c: Fix comments and indentation.
+ (tree-ssa-loop-niter.c): Same.
+
+2010-06-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/42461
+ * dce.c (deletable_insn_p): Return true for const or pure calls again.
+ * except.c (insn_could_throw_p): Return false if !flag_exceptions.
+
+2010-06-09 Jan Hubicka <jh@suse.cz>
+
+ * bitmap.c (bitmap_and): Walk array forward.
+ (bitmap_and_compl_into): Likewise.
+ (bitmap_xor): Likewise.
+ (bitmap_xor_into): Likewise.
+ (bitmap_equal_p): Likewise.
+ (bitmap_intersect_p): Likewise.
+ (bitmap_intersect_compl_p): Likewise.
+ (bitmap_ior_and_into): Likewise.
+ (bitmap_elt_copy): Likewise.
+ (bitmap_and_compl): Likewise.
+ (bitmap_elt_ior): Likewise.
+
+2010-06-09 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * opts-common.c (prune_options): Ensure replacement argv array
+ is correctly terminated by a NULL entry.
+
+2010-06-09 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.h (varpool_first_static_initializer,
+ varpool_next_static_initializer): Make checking only when
+ checking enabled.
+ * tree-vectorizer.h (vinfo_for_stmt): Remove check.
+ (set_vinfo_for_stmt, get_earlier_stmt, is_loop_header_bb_p): Change
+ gcc_assert to gcc_checking_assert.
+ * tree-flow-inline.h (gimple_vop, get_var_ann, relink_imm_use,
+ phi_nodes, set_phi_nodes, phi_arg_index_from_use, op_iter_next_use,
+ op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_init_use,
+ op_iter_init_phiuse, op_iter_init_phidef,
+ array_ref_contains_indirect_ref, ref_contains_array_ref): Use
+ gcc_checking_assert.
+ * emit-rtl.h (set_first_insn, set_last_insn): Likewise.
+ * tree-ssa-live.h (var_to_partition, var_to_partition_to_var,
+ partition_is_global, live_on_entry, live_on_exit,
+ live_merge_and_clear): Likewise.
+ * system.h (gcc_checking_assert): New macro.
+ * gimple.h (set_bb_seq): Use gcc_checking_assert.
+
+2010-06-09 Jason Merrill <jason@redhat.com>
+
+ * Makefile.in (TAGS): Collect tags info from c-family.
+
+2010-06-09 Jan Hubicka <jh@suse.cz>
+
+ * gimple.h (gcc_gimple_checking_assert): New macro.
+ (gimple_set_def_ops, gimple_set_use_ops,
+ gimple_set_vuse, gimple_set_vdef,
+ gimple_omp_subcode, gimple_omp_set_subcode, gimple_ops, gimple_op,
+ gimple_op_ptr, gimple_op_ptr, gimple_set_op, gimple_bind_set_block,
+ gimple_asm_input_op, gimple_asm_input_op_ptr, gimple_asm_set_input_op,
+ gimple_asm_output_op, gimple_asm_output_op_ptr,
+ gimple_asm_set_output_op, gimple_asm_clobber_op,
+ gimple_asm_set_clobber_op, gimple_asm_label_op,
+ gimple_asm_set_label_op, gimple_try_set_kind,
+ gimple_try_catch_is_cleanup, gimple_try_set_catch_is_cleanup,
+ gimple_phi_arg, gimple_switch_num_labels, gimple_switch_set_index,
+ gimple_switch_label, gimple_switch_set_label, gimple_omp_for_index,
+ gimple_omp_for_index_ptr, gimple_omp_for_set_index,
+ gimple_omp_for_initial, gimple_omp_for_initial_ptr,
+ gimple_omp_for_set_initial, gimple_omp_for_final,
+ gimple_omp_for_final_ptr, gimple_omp_for_set_final,
+ gimple_omp_for_incr, gimple_omp_for_incr_ptr, gimple_omp_for_set_incr,
+ gimple_omp_for_set_cond, gimple_omp_for_cond): Make checking
+ conditional with ENABLE_GIMPLE_CHECKING.
+ (gimple_phi_set_arg): Likewise; replace memcpy by assignment.
+
+2010-06-09 Sandra Loosemore <sandra@codesourcery.com>
+
+ * tree-ssa-loop-ivopts.c (adjust_setup_cost): New function.
+ (get_computation_cost_at): Use it.
+ (determine_use_iv_cost_condition): Likewise.
+ (determine_iv_cost): Likewise.
+
+2010-06-09 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-loop-niter.c (simplify_replace_tree): Do not
+ replace constants.
+
+2010-06-09 Kai Tietz <kai.tietz@onevision.com>
+
+ * c-objc-common.c (c_tree_printer): Pre-intialize t by NULL_TREE.
+
+2010-06-09 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/44423
+ * tree-sra.c (dump_access): Dump also grp_assignment_read.
+ (analyze_access_subtree): Pass negative allow_replacements to children
+ if the current type is scalar.
+
+2010-06-09 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR testsuite/42843
+ * gcc-plugin.h (int plugin_is_GPL_compatible): Declare as extern "C".
+ * doc/plugins.texi (Plugin license check): Update information
+ on type of plugin_is_GPL_compatible.
+ * Makefile.in (PLUGINCC): Define as $(COMPILER).
+ (PLUGINCFLAGS): Define as $(COMPILER_FLAGS).
+
+2010-06-09 Bernd Schmidt <bernds@codesourcery.com>
+
+ * config/arm/arm.c (thumb2_reorg): New function.
+ (arm_reorg): Call it.
+ * config/arm/thumb2.md (define_peephole2 for flag clobbering
+ arithmetic operations): Delete.
+
+2010-06-09 Edmar Wienskoski <edmar@freescale.com>
+
+ PR target/44067
+ * config/rs6000/rs6000.md (DIFD): Do not split dpfp values for
+ e500v2 target.
+
+2010-06-09 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR plugins/44459
+ * gcc-plugin.h: Encapsulate all declarations in extern "C".
+
+2010-06-08 Jan Hubicka <jh@suse.cz>
+
+ * basic-block.h (single_succ_edge, single_pred_edge, ei_container,
+ ei_next, ei_prev): Do sanity checking with ENABLE_CHECKING only.
+
+2010-06-08 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR tree-optimization/39874
+ PR middle-end/28685
+ * gimple.h (maybe_fold_and_comparisons, maybe_fold_or_comparisons):
+ Declare.
+ * gimple-fold.c (canonicalize_bool, same_bool_comparison_p,
+ same_bool_result_p): New.
+ (and_var_with_comparison, and_var_with_comparison_1,
+ and_comparisons_1, and_comparisons, maybe_fold_and_comparisons): New.
+ (or_var_with_comparison, or_var_with_comparison_1,
+ or_comparisons_1, or_comparisons, maybe_fold_or_comparisons): New.
+ * tree-ssa-reassoc.c (eliminate_redundant_comparison): Use
+ maybe_fold_and_comparisons or maybe_fold_or_comparisons instead
+ of combine_comparisons.
+ * tree-ssa-ifcombine.c (ifcombine_ifandif, ifcombine_iforif): Likewise.
+
+2010-06-08 Anatoly Sokolov <aesok@post.ru>
+
+ * config/pdp11/pdp11.h (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
+ LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove macros.
+ * config/pdp11/pdp11.c (pdp11_function_value, pdp11_libcall_value,
+ pdp11_function_value_regno_p): New functions.
+ (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE,
+ TARGET_FUNCTION_VALUE_REGNO_P): Define.
+
+2010-06-08 Kazu Hirata <kazu@codesourcery.com>
+
+ * config/arm/arm.c (arm_rtx_costs_1): Don't special case for
+ Thumb-2 in the MINUS case.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * doc/tm.texi (Per-Function Data): Do not reference ggc_alloc.
+
+ * doc/gty.texi (GTY Options): Document typed GC allocation and
+ variable_size GTY option.
+
+ * ggc-internal.h: New.
+
+ * ggc.h: Update copyright year.
+ (digit_string): Move to stringpool.c.
+ (ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots)
+ (gt_pch_save_stringpool, gt_pch_fixup_stringpool)
+ (gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object)
+ (init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size)
+ (ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write)
+ (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read)
+ (ggc_force_collect, ggc_get_size, ggc_statistics)
+ (ggc_print_common_statistics): Move to ggc-internal.h.
+ (digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat)
+ (ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW)
+ (GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec)
+ (ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic)
+ (ggc_min_heapsize_heuristic, ggc_alloc_zone)
+ (ggc_alloc_zone_pass_stat): Remove.
+ (ggc_internal_alloc_stat, ggc_internal_alloc)
+ (ggc_internal_cleared_alloc_stat): New.
+ (GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine.
+ (ggc_internal_vec_alloc_stat)
+ (ggc_internal_cleared_vec_alloc_stat)
+ (ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc)
+ (ggc_alloc_atomic_stat, ggc_alloc_atomic)
+ (ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args)
+ (ggc_cleared_alloc_ptr_array_two_args): New.
+ (htab_create_ggc, splay_tree_new_ggc): Redefine.
+ (ggc_splay_alloc): Change the type of the first argument to
+ enum gt_types_enum.
+ (ggc_alloc_string): Make macro.
+ (ggc_alloc_string_stat): New.
+ (ggc_strdup): Redefine.
+ (rtl_zone, tree_zone, tree_id_zone): Declare unconditionally.
+ (ggc_alloc_rtvec_sized): New.
+ (ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat.
+ (ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat)
+ (ggc_internal_cleared_alloc_zone_stat)
+ (ggc_internal_zone_alloc_stat)
+ (ggc_internal_zone_cleared_alloc_stat)
+ (ggc_internal_zone_vec_alloc_stat)
+ (ggc_alloc_zone_rtx_def_stat)
+ (ggc_alloc_zone_tree_node_stat)
+ (ggc_alloc_zone_cleared_tree_node_stat)
+ (ggc_alloc_cleared_gimple_statement_d_stat): New.
+
+ * ggc-common.c: Include ggc-internal.h.
+ (ggc_internal_cleared_alloc_stat): Rename from
+ ggc_alloc_cleared_stat.
+ (ggc_realloc_stat): Use ggc_internal_alloc_stat.
+ (ggc_calloc): Remove.
+ (ggc_cleared_alloc_htab_ignore_args): New.
+ (ggc_cleared_alloc_ptr_array_two_args): New.
+ (ggc_splay_alloc): Add obj_type parameter.
+ (init_ggc_heuristics): Formatting fixes.
+
+ * ggc-none.c: Update copyright year.
+ (ggc_alloc_stat): Rename to ggc_alloc_stat.
+ (ggc_alloc_cleared_stat): Rename to
+ ggc_internal_cleared_alloc_stat.
+ (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
+
+ * ggc-page.c: Update copyright year. Include ggc-internal.h.
+ Remove references to ggc_alloc in comments.
+ (ggc_alloc_typed_stat): Call ggc_internal_alloc_stat.
+ (ggc_alloc_stat): Rename to ggc_internal_alloc_stat.
+ (new_ggc_zone, destroy_ggc_zone): Remove.
+ (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
+
+ * ggc-zone.c: Include ggc-internal.h. Remove references to
+ ggc_alloc in comments.
+ (ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat.
+ (ggc_internal_alloc_zone_pass_stat): New.
+ (ggc_internal_cleared_alloc_zone_stat): New.
+ (ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat.
+ (ggc_alloc_stat): Rename ggc_internal_alloc_stat.
+ (new_ggc_zone, destroy_ggc_zone): Remove.
+
+ * stringpool.c: Update copyright year. Include ggc-internal.h
+ (digit_vector): Make static.
+ (digit_string): Moved from ggc.h.
+ (stringpool_ggc_alloc): Use ggc_alloc_atomic.
+ (ggc_alloc_string): Rename to ggc_alloc_string_stat.
+
+ * Makefile.in (GGC_INTERNAL_H): New.
+ (ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add
+ $(GGC_INTERNAL_H) to dependencies.
+
+ * gentype.c: Update copyright year.
+ (walk_type): Accept variable_size GTY option.
+ (USED_BY_TYPED_GC_P): New macro.
+ (write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output
+ whitespace at the end of strings.
+ (get_type_specifier, variable_size_p): New functions.
+ (alloc_quantity, alloc_zone): New enums.
+ (write_typed_alloc_def): New function.
+ (write_typed_struct_alloc_def): Likewise.
+ (write_typed_typed_typedef_alloc_def): Likewise.
+ (write_typed_alloc_defns): Likewise.
+ (output_typename, write_splay_tree_allocator_def): Likewise.
+ (write_splay_tree_allocators): Likewise.
+ (main): Call write_typed_alloc_defns and
+ write_splay_tree_allocators.
+
+ * lto-streamer.h (lto_file_decl_data_ptr): New.
+
+ * passes.c (order): Define using cgraph_node_ptr.
+
+ * strinpool.c (struct string_pool_data): Declare nested_ptr using
+ ht_identifier_ptr.
+
+ * gimple.h (union gimple_statement_d): Likewise.
+
+ * rtl.h (struct rtx_def): Likewise.
+ (struct rtvec_def): Likewise.
+
+ * tree.h (union tree_node): Likewise.
+
+ * tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise.
+
+ * cfgloop.c (record_loop_exits): Use htab_create_ggc.
+
+ * tree-scalar-evolution.c (scev_initialize): Likewise.
+
+ * alias.c (record_alias_subset): Update splay_tree_new_ggc call.
+
+ * dwarf2asm.c (dw2_force_const_mem): Likewise.
+
+ * omp-low.c (lower_omp_critical): Likewise.
+
+ * bitmap.h (struct bitmap_head_def): Update comment to not
+ reference ggc_alloc.
+
+ * config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC.
+
+ * ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC.
+
+ * ipa-prop.c (duplicate_ggc_array): Rename to
+ duplicate_ipa_jump_func_array. Use typed GC allocation.
+ (ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array.
+
+ * gimple.c (gimple_alloc_stat): Use
+ ggc_alloc_cleared_gimple_statement_d_stat.
+
+ * varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def.
+
+ * tree.c (make_node_stat): Use
+ ggc_alloc_zone_cleared_tree_node_stat.
+ (make_tree_vec_stat): Likewise.
+ (build_vl_exp_stat): Likewise.
+ (copy_node_stat): Use ggc_alloc_zone_tree_node_stat.
+ (make_tree_binfo_stat): Likewise.
+ (tree_cons_stat): Likewise.
+
+ * rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat.
+ (shallow_copy_rtx_stat): Likewise.
+ (make_node_stat): Likewise.
+
+ * lto-symtab.c: Fix comment.
+
+ * tree-cfg.c (create_bb): Update comment to not reference
+ ggc_alloc_cleared.
+ * tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is value.
+
+ * varpool.c (varpool_node): Use typed GC allocation.
+ (varpool_extra_name_alias): Likewise.
+
+ * varasm.c (emutls_decl): Likewise.
+ (get_unnamed_section): Likewise.
+ (get_noswitch_section): Likewise.
+ (get_section): Likewise.
+ (get_block_for_section): Likewise.
+ (build_constant_desc): Likewise.
+ (create_constant_pool): Likewise.
+ (force_const_mem): Likewise.
+
+ * tree.c (build_vl_exp_stat): Likewise.
+ (build_real): Likewise.
+ (build_string): Likewise.
+ (decl_debug_expr_insert): Likewise.
+ (decl_value_expr_insert): Likewise.
+ (type_hash_add): Likewise.
+ (build_omp_clause): Likewise.
+
+ * tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise.
+
+ * tree-ssa.c (init_tree_ssa): Likewise.
+
+ * tree-ssa-structalias.c (heapvar_insert): Likewise.
+
+ * tree-ssa-operands.c (ssa_operand_alloc): Likewise.
+
+ * tree-ssa-loop-niter.c (record_estimate): Likewise.
+
+ * tree-ssa-alias.c (get_ptr_info): Likewise.
+
+ * tree-scalar-evolution.c (new_scev_info_str): Likewise.
+
+ * tree-phinodes.c (allocate_phi_node): Likewise.
+
+ * tree-iterator.c (tsi_link_before): Likewise.
+ (tsi_link_after): Likewise.
+
+ * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise.
+
+ * tree-dfa.c (create_var_ann): Likewise.
+
+ * tree-cfg.c (create_bb): Likewise.
+
+ * toplev.c (alloc_for_identifier_to_locale): Likewise.
+ (general_init): Likewise.
+
+ * stringpool.c (stringpool_ggc_alloc): Likewise.
+ (gt_pch_save_stringpool): Likewise.
+
+ * sese.c (if_region_set_false_region): Likewise.
+
+ * passes.c (do_per_function_toporder): Likewise.
+
+ * optabs.c (set_optab_libfunc): Likewise.
+ (set_conv_libfunc): Likewise.
+
+ * lto-symtab.c (lto_symtab_register_decl): Likewise.
+
+ * lto-streamer-in.c (lto_input_eh_catch_list): Likewise.
+ (input_eh_region): Likewise.
+ (input_eh_lp): Likewise.
+ (make_new_block): Likewise.
+ (unpack_ts_real_cst_value_fields): Likewise.
+
+ * lto-section-in.c (lto_new_in_decl_state): Likewise.
+
+ * lto-cgraph.c (input_node_opt_summary): Likewise.
+
+ * loop-init.c (loop_optimizer_init): Likewise.
+
+ * lambda.h (lambda_vector_new): Likewise.
+
+ * lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise.
+
+ * ira.c (update_equiv_regs): Likewise.
+
+ * ipa.c (cgraph_node_set_new): Likewise.
+ (cgraph_node_set_add): Likewise.
+ (varpool_node_set_new): Likewise.
+ (varpool_node_set_add): Likewise.
+
+ * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
+ (duplicate_ipa_jump_func_array): Likewise.
+ (ipa_read_node_info): Likewise.
+
+ * ipa-cp.c (ipcp_create_replace_map): Likewise.
+
+ * integrate.c (get_hard_reg_initial_val): Likewise.
+
+ * gimple.c (gimple_alloc_stat): Likewise.
+ (gimple_build_omp_for): Likewise.
+ (gimple_seq_alloc): Likewise.
+ (gimple_copy): Likewise.
+
+ * gimple-iterator.c (gsi_insert_before_without_update): Likewise.
+ (gsi_insert_after_without_update): Likewise.
+
+ * function.c (add_frame_space): Likewise.
+ (insert_temp_slot_address): Likewise.
+ (assign_stack_temp_for_type): Likewise.
+ (allocate_struct_function): Likewise.
+ (types_used_by_var_decl_insert): Likewise.
+
+ * except.c (init_eh_for_function): Likewise.
+ (gen_eh_region): Likewise.
+ (gen_eh_region_catch): Likewise.
+ (gen_eh_landing_pad): Likewise.
+ (add_call_site): Likewise.
+
+ * emit-rtl.c (get_mem_attrs): Likewise.
+ (get_reg_attrs): Likewise.
+ (start_sequence): Likewise.
+ (init_emit): Likewise.
+
+ * dwarf2out.c (new_cfi): Likewise.
+ (queue_reg_save): Likewise.
+ (dwarf2out_frame_init): Likewise.
+ (new_loc_descr): Likewise.
+ (find_AT_string): Likewise.
+ (new_die): Likewise.
+ (add_var_loc_to_decl): Likewise.
+ (clone_die): Likewise.
+ (clone_as_declaration): Likewise.
+ (break_out_comdat_types): Likewise.
+ (new_loc_list): Likewise.
+ (loc_descriptor): Likewise.
+ (add_loc_descr_to_each): Likewise.
+ (add_const_value_attribute): Likewise.
+ (tree_add_const_value_attribute): Likewise.
+ (add_comp_dir_attribute): Likewise.
+ (add_name_and_src_coords_attributes): Likewise.
+ (lookup_filename): Likewise.
+ (store_vcall_insn): Likewise.
+ (dwarf2out_init): Likewise.
+
+ * dbxout.c (dbxout_init): Likewise.
+
+ * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise.
+
+ * config/sparc/sparc.c (sparc_init_machine_status): Likewise.
+
+ * config/score/score7.c (score7_output_external): Likewise.
+
+ * config/score/score3.c (score3_output_external): Likewise.
+
+ * config/s390/s390.c (s390_init_machine_status): Likewise.
+
+ * config/rs6000/rs6000.c (builtin_function_type): Likewise.
+ (rs6000_init_machine_status): Likewise.
+ (output_toc): Likewise.
+
+ * config/pa/pa.c (pa_init_machine_status): Likewise.
+ (get_deferred_plabel): Likewise.
+
+ * config/moxie/moxie.c (moxie_init_machine_status): Likewise.
+
+ * config/mmix/mmix.c (mmix_init_machine_status): Likewise.
+
+ * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise.
+
+ * config/mep/mep.c (mep_init_machine_status): Likewise.
+ (mep_note_pragma_flag): Likewise.
+
+ * config/m32c/m32c.c (m32c_init_machine_status): Likewise.
+
+ * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise.
+
+ * config/ia64/ia64.c (ia64_init_machine_status): Likewise.
+
+ * config/i386/winnt.c (i386_pe_record_external_function): Likewise.
+ (i386_pe_maybe_record_exported_symbol): Likewise.
+
+ * config/i386/i386.c (get_dllimport_decl): Likewise.
+ (ix86_init_machine_status): Likewise.
+ (assign_386_stack_local): Likewise.
+
+ * config/frv/frv.c (frv_init_machine_status): Likewise.
+
+ * config/darwin.c (machopic_indirection_name): Likewise.
+
+ * config/cris/cris.c (cris_init_machine_status): Likewise.
+
+ * config/bfin/bfin.c (bfin_init_machine_status): Likewise.
+
+ * config/avr/avr.c (avr_init_machine_status): Likewise.
+
+ * config/arm/arm.c (arm_init_machine_status): Likewise.
+
+ * config/alpha/alpha.c (alpha_init_machine_status): Likewise.
+ (alpha_need_linkage): Likewise.
+ (alpha_use_linkage): Likewise.
+
+ * cgraph.c (cgraph_allocate_node): Likewise.
+ (cgraph_create_edge_1): Likewise.
+ (cgraph_create_indirect_edge): Likewise.
+ (cgraph_add_asm_node): Likewise.
+
+ * cfgrtl.c (init_rtl_bb_info): Likewise.
+
+ * cfgloop.c (alloc_loop): Likewise.
+ (rescan_loop_exit): Likewise.
+
+ * cfg.c (init_flow): Likewise.
+ (alloc_block): Likewise.
+ (unchecked_make_edge): Likewise.
+
+ * c-parser.c (c_parse_init): Likewise.
+ (c_parse_file): Likewise.
+
+ * c-decl.c (bind): Likewise.
+ (record_inline_static): Likewise.
+ (push_scope): Likewise.
+ (make_label): Likewise.
+ (lookup_label_for_goto): Likewise.
+ (finish_struct): Likewise.
+ (finish_enum): Likewise.
+ (c_push_function_context): Likewise.
+
+ * bitmap.c (bitmap_element_allocate): Likewise.
+ (bitmap_gc_alloc_stat): Likewise.
+
+ * alias.c (record_alias_subset): Likewise.
+ (init_alias_analysis): Likewise.
+
+2010-06-08 Shujing Zhao <pearly.zhao@oracle.com>
+
+ * fold-const.c (fold_comparison): Remove redundant parenthesis.
+ * tree-inline.c (expand_call_inline): Pass translated return value of
+ cgraph_inline_failed_string to diagnostic function.
+
+2010-06-08 Andrew Pinski <pinskia@gmail.com>
+ Shujing Zhao <pearly.zhao@oracle.com>
+
+ PR c/37724
+ * c-typeck.c (convert_for_assignment): Call pedwarn_init if the
+ implicit bad conversions is initialization.
+ (error_init): Use gmsgid instead of msgid for argument name and change
+ the call for error.
+ (pedwarn_init): Use gmsgid instead of msgid for argument name and
+ change the call for pedwarn.
+ (warning_init): Use gmsgid instead of msgid for argument name and
+ change the call for warning.
+
+2010-06-07 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/mips/mips-protos.h (mips_print_operand): Delete.
+ (mips_print_operand_address): Delete.
+ * config/mips/mips.h (mips_print_operand_punct): Delete.
+ (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/mips/mips.c (mips_print_operand_punct): Make static.
+ (mips_print_operand_address): Make static.
+ (mips_print_operand): Make static. Call
+ mips_print_operand_punct_valid_p.
+ (mips_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
+ (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
+
+2010-06-07 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/44454
+ (df_lr_top_dump, df_lr_bottom_dump): Check that in/out bitmaps
+ are allocated.
+
+2010-06-07 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (sh_build_builtin_va_list): Set tree type
+ name of RECORD.
+
+2010-06-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * doc/sourcebuild.texi (Effective-Target Keywords, Other
+ attributes): Document gas.
+
+2010-06-07 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (*add<mode>_1): Remove alternative 2.
+ <TYPE_LEA>: Split instruction.
+ <default>: Remove alternative 2 handling.
+ (*addsi_1_zext) <TYPE_LEA>: Split instruction.
+ (add lea splitter): Generate SImode lea for mode sizes <= SImode.
+ (add_zext lea splitter): Use ix86_lea_for_add_ok in insn predicate.
+
+ (*movsi_1) <TYPE_LEA>: Use %a modifier to output operand 1.
+ (ashift_zext lea splitter): Use DImode for multiplication.
+
+ * config/i386/i386.c (ix86_expand_epilogue): Do not use ix86_gen_add
+ to generate addition.
+
+2010-06-07 Joseph Myers <joseph@codesourcery.com>
+
+ * common.opt (fira-verbose): Use Var.
+ (fpcc-struct-return): Use Init instead of VarExists.
+ * defaults.h (DEFAULT_PCC_STRUCT_RETURN): Move definition from
+ toplev.c.
+ * flags.h (flag_signed_char, flag_short_enums,
+ flag_pcc_struct_return, flag_ira_verbose,
+ flag_detailed_statistics, flag_remove_unreachable_functions): Remove.
+ * toplev.c (flag_detailed_statistics, flag_signed_char,
+ flag_short_enums, flag_pcc_struct_return, flag_ira_verbose): Remove.
+ (DEFAULT_PCC_STRUCT_RETURN): Move definition to defaults.h.
+ * toplev.h (flag_crossjumping, flag_if_conversion,
+ flag_if_conversion2, flag_keep_static_consts, flag_peel_loops,
+ flag_rerun_cse_after_loop, flag_thread_jumps, flag_tracer,
+ flag_unroll_loops, flag_unroll_all_loops, flag_unswitch_loops,
+ flag_cprop_registers, time_report, flag_ira_loop_pressure,
+ flag_ira_coalesce, flag_ira_move_spills,
+ flag_ira_share_save_slots, flag_ira_share_spill_slots): Remove.
+
+2010-06-07 Jan Hubicka <jh@suse.cz>
+
+ * df-core.c (df_analyze_problem): Do verification after allocation.
+
+ * df-problems.c (df_lr_problem_data): Add lr_bitmaps.
+ (df_lr_alloc): Initialize problem data; move bitmaps to
+ lr_bitmaps obstack.
+ (df_lr_finalize): Free problem data; do not bother to free bitmaps.
+ (df_lr_verify_solution_start): Do not initialize problem data;
+ allocate bitmaps in lr_bitmaps.
+ (df_lr_verify_solution_end): Do not free problem data.
+
+2010-06-07 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.c (cgraph_edge_cannot_lead_to_return): Also check
+ if caller is noreturn.
+ * ipa-reference.c (analyze_function): Use ipa_ref_cannot_lead_to_return
+ * ipa-ref.h (ipa_ref_cannot_lead_to_return): New function.
+ * ipa-ref.c (ipa_ref_cannot_lead_to_return): New function.
+ * ipa-pure-const.c (check_decl): Add IPA parameter.
+ (state_from_flags): New function.
+ (better_state, worse_state): New functions.
+ (check_call): When in IPA mode, do not care about callees.
+ (check_load, check_store): Update.
+ (check_ipa_load, check_ipa_store): New.
+ (check_stmt): When in IPA mode, use IPA checkers.
+ (analyze_function): Use state_from_flags.
+ (propagate): Check indirect edges and references.
+
+2010-06-07 Kazu Hirata <kazu@codesourcery.com>
+
+ PR rtl-optimization/44404
+ * auto-inc-dec.c (find_inc): Use reg_overlap_mentioned_p instead
+ of count_occurrences to see if it's safe to modify mem_insn.
+
+2010-06-07 Richard Guenther <rguenther@suse.de>
+
+ * gimplify.c (gimplify_cleanup_point_expr): For empty body
+ and EH-only cleanup drop the cleanup instead of inserting it
+ unconditionally.
+
+2010-06-07 Ira Rosen <irar@il.ibm.com>
+
+ * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Update
+ documentation.
+ * targhooks.c (default_builtin_vectorization_cost): New function.
+ * targhooks.h (default_builtin_vectorization_cost): Declare.
+ * target.h (enum vect_cost_for_stmt): Define.
+ (builtin_vectorization_cost): Change argument and comment.
+ * tree-vectorizer.h: Remove cost model macros.
+ * tree-vect-loop.c: Include target.h.
+ (vect_get_cost): New function.
+ (vect_estimate_min_profitable_iters): Replace cost model macros with
+ calls to vect_get_cost.
+ (vect_model_reduction_cost, vect_model_induction_cost): Likewise.
+ * target-def.h (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Add
+ default implementation.
+ * tree-vect-stmts.c (cost_for_stmt): Replace cost model macros with
+ calls to target hook builtin_vectorization_cost.
+ (vect_model_simple_cost, vect_model_store_cost, vect_model_load_cost):
+ Likewise.
+ * Makefile.in (tree-vect-loop.o): Add dependency on TARGET_H.
+ * config/spu/spu.c (spu_builtin_vectorization_cost): Replace with new
+ implementation to return costs.
+ * config/i386/i386.c (ix86_builtin_vectorization_cost): Likewise.
+ * config/spu/spu.h: Remove vectorizer cost model macros.
+ * config/i386/i386.h: Likewise.
+ * tree-vect-slp.c (vect_build_slp_tree): Replace cost model macro with
+ a call to target hook builtin_vectorization_cost.
+
+2010-06-06 Sriraman Tallam <tmsriram@google.com>
+
+ PR target/44319
+ * config/i386/i386.c (override_options): Turn zee pass on for level 2
+ and above and defer till target is known.
+ (optimization_options): Turn on zee pass if TARGET_64BIT is set and
+ turn off otherwise.
+
+2010-05-25 Jan Hubicka <jh@suse.cz>
+
+ * df-core.c (df_set_blocks): Use bitmap_head instead of bitmap.
+ (df_compact_blocks): Likewise.
+ * df.h (struct df): Turn hardware_regs_used,
+ regular_block_artificial_uses, eh_block_artificial_uses,
+ insns_to_delete, insns_to_rescan, insns_to_notes_rescan into
+ bitmap_head.
+ * df-problems.c (df_lr_local_compute, df_lr_confluence_0,
+ df_byte_lr_alloc, df_simulate_fixup_sets): Update.
+ * df-scan.c (df_scan_free_internal, df_scan_alloc, df_scan_start_dump,
+ df_scan_blocks, df_insn_delete, df_insn_rescan,
+ df_insn_rescan_debug_internal, df_insn_rescan_all,
+ df_process_deferred_rescans, df_process_deferred_rescans,
+ df_notes_rescan, df_get_call_refs, df_get_call_refs,
+ regs_invalidated_by_call_regset, df_get_call_refs, df_bb_refs_collect,
+ df_record_entry_block_defs, df_record_exit_block_uses,
+ df_update_exit_block_uses, df_bb_verify, df_entry_block_bitmap_verify,
+ df_scan_verify): Update.
+
+2010-05-25 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/44188
+ * c-common.c (is_typedef_decl): Move this definition ...
+ * tree.c (is_typedef_decl): ... here.
+ (typdef_variant_p): Move definition here from gcc/cp/tree.c.
+ * c-common.h (is_typedef_decl): Move this declaration ...
+ * tree.h (is_typedef_decl): ... here.
+ (typedef_variant_p): Move declaration here from gcc/cp/cp-tree.h
+ * dwarf2out.c (is_naming_typedef_decl): New function.
+ (gen_tagged_type_die): Split out of ...
+ (gen_type_die_with_usage): ... this function. When an anonymous
+ tagged type is named by a typedef, make sure a DW_TAG_typedef DIE
+ is emitted for the typedef.
+ (gen_typedef_die): Emit DW_TAG_typedef also for typedefs naming
+ anonymous tagged types.
+
+2010-06-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/20000
+ * c-decl.c (grokdeclarator): Delete warning.
+
+2010-06-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * stor-layout.c (self_referential_size): Set UNKNOWN_LOCATION on the
+ newly built CALL_EXPR.
+ * tree-profile.c (tree_profiling): Don't profile functions produced
+ for built-in stuff.
+
+2010-06-06 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR bootstrap/44427
+ PR bootstrap/44428
+ * genautomata.c (SET_BIT, CLEAR_BIT, TEST_BIT): Make these macros
+ endianness-independent.
+
+2010-06-05 Steven Bosscher <steven@gcc.gnu.org>
+
+ * c-common.c: Move to c-family/.
+ * c-common.def: Likewise.
+ * c-common.h: Likewise.
+ * c-cppbuiltin.c: Likewise.
+ * c-dump.c: Likewise.
+ * c-format.c: Likewise.
+ * c-format.h : Likewise.
+ * c-gimplify.c: Likewise.
+ * c-lex.c: Likewise.
+ * c-omp.c: Likewise.
+ * c.opt: Likewise.
+ * c-opts.c: Likewise.
+ * c-pch.c: Likewise.
+ * c-ppoutput.c: Likewise.
+ * c-pragma.c: Likewise.
+ * c-pragma.h: Likewise.
+ * c-pretty-print.c: Likewise.
+ * c-pretty-print.h: Likewise.
+ * c-semantics.c: Likewise.
+ * stub-objc.c: Likewise.
+
+ * gengtype.c (get_file_langdir): Special-case files in c-family/.
+ (get_output_file_with_visibility): Fix name for c-common.h.
+ * c-config-lang.in: Update paths in gtfiles for files in c-family/.
+
+ * c-tree.h: Update include path for moved files.
+ * c-lang.c: Likewise.
+ * c-lang.h: Likewise.
+ * c-parser.c: Likewise.
+ * c-convert.c: Likewise.
+ * c-decl.c: Likewise.
+ * c-objc-common.c: Likewise.
+ * configure.ac: Make sure c-family/ exists in the build directory.
+ * configure: Regenerate.
+ * Makefile.in: Update paths for moved files. Regroup files per
+ location and update dependencies. Move generated_files down after
+ ALL_GTFILES_H.
+
+ * config/spu/spu-c.c: Update paths for moved files.
+ * config/mep/mep-pragma.c: Likewise.
+ * config/darwin-c.c: Likewise.
+ * config/i386/msformat-c.c: Likewise.
+ * config/i386/i386-c.c: Likewise.
+ * config/avr/avr-c.c: Likewise.
+ * config/sol2-c.c: Likewise.
+ * config/ia64/ia64-c.c: Likewise.
+ * config/rs6000/rs6000-c.c: Likewise.
+ * config/arm/arm.c: Likewise.
+ * config/arm/arm-c.c: Likewise.
+ * config/h8300/h8300.c: Likewise.
+ * config/v850/v850-c.c: Likewise.
+
+ * config/t-darwin: Fix dependencies for moved files.
+ * config/t-sol2: Fix dependencies for moved files.
+ * config/mep/t-mep: Fix dependencies for moved files.
+ * config/ia64/t-ia64: Fix dependencies for moved files.
+ * config/rs6000/t-rs6000: Fix dependencies for moved files.
+ * config/v850/t-v850: Fix dependencies for moved files.
+ * config/v850/t-v850e: Fix dependencies for moved files.
+
+ * config/m32c/m32c-pragma.c
+
+ * po/exgettext: Look in c-family/ also.
+
+2010-06-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-ssa-dce.c (mark_last_stmt_necessary): New function.
+ (mark_control_dependent_edges_necessary): Call it instead of marking
+ the last statement manually.
+ (propagate_necessity): Likewise.
+
+2010-06-05 Jan Hubicka <jh@suse.cz>
+
+ * basic-block.h (compute_dominance_frontiers): Updated.
+ (compute_idf): Likewise.
+
+ * tree-into-ssa.c (insert_phi_nodes): Use bitmap heads
+ for dominance frontiers.
+ (rewrite_into_ssa): Update for bitmap heads in dominance frontiers.
+ (insert_updated_phi_nodes_for): Likewise.
+ (update_ssa): Likewise.
+ * cfganal.c (compute_dominance_frontiers_1): Likewise.
+ (compute_dominance_frontiers): Likewise.
+ (compute_idf): Likewise.
+ * df-problems.c (df_md_local_compute): Likewise.
+
+2010-06-05 Anatoly Sokolov <aesok@post.ru>
+
+ * target.h (struct gcc_target): Add memory_move_cost field.
+ * target-def.h (TARGET_MEMORY_MOVE_COST): New.
+ (TARGET_INITIALIZER): Use TARGET_MEMORY_MOVE_COST.
+ * targhooks.c (default_memory_move_cost): New function.
+ * targhooks.h (default_memory_move_cost): Declare function.
+ * reload.h (memory_move_cost): Declare.
+ (memory_move_secondary_cost): Change type of 'in' argument to bool.
+ * reginfo.c (memory_move_cost): New function.
+ (memory_move_secondary_cost): Change type of 'in' argument to bool.
+ * ira.h (ira_memory_move_cost): Update comment.
+ * ira.c: (ira_memory_move_cost): Update comment.
+ (setup_class_subset_and_memory_move_costs): Replace MEMORY_MOVE_COST
+ with memory_move_cost.
+ * postreload.c (reload_cse_simplify_set): (Ditto.).
+ * reload1.c (choose_reload_regs): (Ditto.).
+ * doc/tm.texi (TARGET_MEMORY_MOVE_COST): New.
+ (MEMORY_MOVE_COST): Revise documentation.
+
+ * config/i386/i386.h (MEMORY_MOVE_COST): Remove macro.
+ * config/i386/i386-protos.h (int ix86_memory_move_cost): Remove.
+ * config/i386/i386.h (ix86_memory_move_cost): Make static. Change
+ type of 'in' argument to bool.
+ (TARGET_MEMORY_MOVE_COST): Define.
+
+2010-06-05 Jan Hubicka <jh@suse.cz>
+
+ * ipa-pure-const.c (propagate): Fix typo in handling of functions
+ that cannot return. Be more careful when merging the results with
+ previously known ones.
+
+2010-06-05 Matthias Klose <doko@ubuntu.com>
+
+ * gcc.c (cc1_options, cpp_unique_options): Use find-plugindir spec
+ function to add the -iplugindir option.
+ (find_plugindir_spec_function): Add new declaration and function.
+ (static_spec_func): Use it for "find-plugindir".
+
+2010-06-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44361
+ * c-typeck.c (mark_exp_read): Handle C_MAYBE_CONST_EXPR.
+ * c-parser.c (c_parser_postfix_expression): Call mark_exp_read on
+ statement expression.
+
+2010-06-05 Jan Hubicka <jh@suse.cz>
+
+ * df-problems.c (seen_in_block, seen_in_insn): Convert to bitmap_head.
+ (df_rd_problem_data): Convert sparse_invalidated_by_call,
+ dense_invalidated_by_call to bitmap head.
+ (df_rd_alloc, df_rd_bb_local_compute_process_def,
+ df_rd_bb_local_compute, df_rd_confluence_n, df_rd_transfer_function,
+ df_rd_start_dump, df_lr_verify_transfer_functions,
+ df_live_verify_transfer_functions, df_chain_create_bb,
+ df_chain_add_problem, df_byte_lr_check_regs, df_byte_lr_alloc,
+ df_byte_lr_confluence_0, df_byte_lr_confluence_n, df_note_compute,
+ df_simulate_one_insn_forwards, df_md_alloc,
+ df_md_bb_local_compute_process_def,
+ df_md_bb_local_compute_process_def, df_md_local_compute,
+ df_md_transfer_function df_md_free): Update.
+
+2010-06-05 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/44322
+ * c-typeck.c (build_unary_op): Merge qualifiers into pointer
+ target type for ADDR_EXPR; require no changes to qualifiers except
+ for function types.
+ * c-tree.h (c_build_type_variant): Remove.
+
+2010-06-05 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * genautomata.c (get_excl_set): Do work per element, not per char.
+ (check_presence_pattern_sets): Similar.
+ (check_absence_pattern_sets): Similar.
+
+2010-06-05 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * genautomata.c (curr_state_pass_num): Delete.
+ (min_issue_delay_pass_states): Delete.
+ (min_issue_delay): Delete.
+ (initiate_min_issue_delay_pass_states): Delete.
+ (output_min_issue_delay_table): Compute min_issue_delay_vect
+ using a breadth-first search variant.
+ (output_tables): Don't call initiate_min_issue_delay_pass_states.
+
+2010-06-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR boostrap/44421
+ * df-problems.c (df_lr_bb_local_compute): Updated for embedded bitmaps.
+ (df_byte_lr_bb_local_compute): Likewise.
+
+2010-06-03 Jason Merrill <jason@redhat.com>
+
+ Implement noexcept operator (5.3.7)
+ * c-common.c (c_common_reswords): Add noexcept.
+ * c-common.h (enum rid): Add RID_NOEXCEPT.
+
+2010-06-04 Joseph Myers <joseph@codesourcery.com>
+
+ * config/darwin-driver.c (darwin_default_min_version): Use
+ GCC-specific formats in diagnostics.
+ * cppspec.c (lang_specific_driver): Use GCC-specific formats in
+ diagnostics.
+ * gcc.c (translate_options, read_specs, add_sysrooted_prefix,
+ execute, process_command, end_going_arg, do_self_spec, do_spec_1,
+ eval_spec_function, handle_braces, process_brace_body, main,
+ perror_with_name, used_arg, set_multilib_dir, print_multilib_info,
+ getenv_spec_function, compare_version_strings,
+ version_compare_spec_function): Use GCC-specific formats in
+ diagnostics.
+
+2010-06-04 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (*addhi_1_lea) <TYPE_INCDEC, default>: Assert
+ that operand 0 and operand 1 are equal.
+ (*addqi_1_lea) <TYPE_INCDEC, default>: Ditto.
+ (*add<mode>_2) <TYPE_INCDEC>: Remove assert that operand 0
+ and operand 1 are equal.
+ <default>: Ditto. Remove ??? comment.
+ (*add<mode>_3) <TYPE_INCDEC>: Remove assert that operand 0
+ and operand 1 are equal.
+ <default>: Ditto. Remove ??? comment.
+ (*adddi_4) <default>: Remove assert that operand 0 and operand 1
+ are equal.
+ (*add<mode>_4) <default>: Ditto.
+ (*add<mode>_5) <TYPE_INCDEC, default>: Ditto.
+
+2010-06-04 Nathan Froyd <froydnj@codesourcery.com>
+
+ * config/i386/i386-protos.h (ix86_print_operand): Declare.
+ * config/i386/i386.c (ix86_print_operand): Make non-static.
+ * config/i386/sol2.h (ASM_OUTPUT_CALL): Call ix86_print_operand.
+ * output.h (output_operand): Declare.
+ * final.c (output_operand): Make non-static.
+
+2010-06-04 Alexandre Oliva <aoliva@redhat.com>
+
+ PR rtl-optimization/44013
+ * sched-deps.c (add_dependence_list_and_free): Don't free lists
+ when processing debug insns.
+
+ PR debug/41371
+ * var-tracking.c (find_loc_in_1pdv): Mark initial value before
+ recursing. Check that recursion is bounded. Rename inner var
+ to avoid hiding incoming argument.
+
+2010-06-04 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (*addqi_2) <TYPE_INCDEC>: Do not assert that
+ operands[2] == 255.
+ (*addqi_3): Ditto.
+ (*addqi_4): Ditto.
+ (*addqi_5): Ditto.
+ (*addqi_ext_1_rex64): Ditto.
+ (*addqi_ext_1): Ditto.
+
+ (*addqi_4): Check for incdec_operand in QImode.
+
+ (*add<mode>_2): Macroize insn from *add<mode>_2 and *add{qi,hi}_2
+ using SWI mode iterator.
+ (*add<mode>_3): Ditto from *add<mode>_3 and *add{qi,hi}_3.
+ (*add<mode>_4): Macroize insn from *add{qi,hi,si}_4 using SWI124
+ mode iterator.
+ (*add<mode>_5): Macroize insn from *add<mode>_5 and *add{qi,hi}_5
+ using SWI mode iterator.
+
+2010-06-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/25880
+ * c-objc-common.c (c_tree_printer): Handle %V, %v and %#v.
+ * c-format.c (gcc_diag_flag_specs): Add hash.
+ (gcc_cxxdiag_flag_specs): Use gcc_diag_flag_specs directly.
+ (gcc_tdiag_char_table,gcc_cdiag_char_table): Handle %V and %v.
+ * c-pretty-print.c (pp_c_cv_qualifier): Rename as
+ pp_c_cv_qualifiers. Handle qualifiers spelling here.
+ (pp_c_type_qualifier_list): Call the function above.
+ * c-pretty-print.h (pp_c_cv_qualifiers): Declare.
+ * c-typeck.c (handle_warn_cast_qual): Print qualifiers.
+ (WARN_FOR_QUALIFIERS): New macro.
+ (convert_for_assignment): Use it.
+
+2010-06-04 Kai Tietz <kai.tietz@onevision.com>
+
+ * config/i386/cygming.h (ASM_GENERATE_INTERNAL_LABEL): Prefix by '*'.
+
+2010-06-04 Jan Hubicka <jh@suse.cz>
+
+ * df.h (df_rd_bb_info, df_md_bb_info, df_lr_bb_info, df_live_bb_info,
+ df_byte_lr_bb_info): Embedd bitmap_head into the structure.
+ (DF_LIVE_IN, DF_LIVE_OUT, DF_LR_IN, DF_LR_OUT, DF_BYTE_LR_IN,
+ DF_BYTE_LR_OUT): Update for embedded bitmaps.
+ * fwprop.c (single_def_use_enter_block): Likewise.
+ * ddg.c (create_ddg_dep_from_intra_loop_link,
+ add_cross_iteration_register_deps, build_inter_loop_deps): Likewise.
+ * loop-iv.c (latch_dominating_def): Likewise.
+ * df-problems.c (df_rd_free_bb_info, df_rd_alloc,
+ df_rd_bb_local_compute_process_def, df_rd_bb_local_compute_process_def,
+ df_rd_init_solution, df_rd_init_solution, df_rd_transfer_function,
+ df_rd_transfer_function, df_rd_top_dump,
+ df_rd_bottom_dump): Update.
+ (df_lr_free_bb_info, df_lr_alloc, df_lr_reset, df_lr_bb_local_compute,
+ df_lr_bb_local_compute, df_lr_bb_local_compute, df_lr_bb_local_compute,
+ df_lr_bb_local_compute, df_lr_local_compute, df_lr_init, df_lr_init,
+ df_lr_confluence_0, df_lr_free, df_lr_top_dump, df_lr_bottom_dump,
+ df_lr_verify_solution_start, df_lr_verify_solution_end,
+ df_lr_verify_transfer_functions, df_lr_verify_transfer_functions,
+ df_live_free_bb_info, df_live_alloc, df_live_reset,
+ df_live_bb_local_compute, df_live_init, df_live_transfer_function,
+ df_live_finalize, df_live_free, df_live_top_dump, df_live_bottom_dump,
+ df_live_verify_solution_start, df_live_verify_solution_end,
+ df_live_verify_transfer_functions, df_chain_create_bb,
+ df_byte_lr_free_bb_info, df_byte_lr_alloc, df_byte_lr_reset,
+ df_byte_lr_bb_local_compute, df_byte_lr_bb_local_compute,
+ df_byte_lr_bb_local_compute, df_byte_lr_bb_local_compute,
+ df_byte_lr_bb_local_compute, df_byte_lr_local_compute, df_byte_lr_init,
+ df_byte_lr_confluence_0, df_byte_lr_confluence_n,
+ df_byte_lr_transfer_function, df_byte_lr_top_dump,
+ df_byte_lr_bottom_dump, df_create_unused_note,
+ df_note_bb_compute, df_md_free_bb_info, df_md_alloc,
+ df_md_bb_local_compute_process_def, df_md_local_compute, df_md_reset,
+ df_md_transfer_function, df_md_init, df_md_confluence_0,
+ df_md_confluence_n,
+ df_md_top_dump, df_md_bottom_dump): Update.
+ (struct df_lr_problem_data): Embedd bitmap headers.
+
+2010-06-04 Jan Hubicka <jh@suse.cz>
+
+ * dce.c (dce_process_block): Do not re-scan already marked
+ instructions.
+
+2010-06-04 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR rtl-optimization/39871
+ PR rtl-optimization/40615
+ PR rtl-optimization/42500
+ PR rtl-optimization/42502
+ * ira.c (init_reg_equiv_memory_loc: New function.
+ (ira): Call it twice.
+ * reload.h (calculate_elim_costs_all_insns): Declare.
+ * ira-costs.c: Include "reload.h".
+ (regno_equiv_gains): New static variable.
+ (init_costs): Allocate it.
+ (finish_costs): Free it.
+ (ira_costs): Call calculate_elim_costs_all_insns.
+ (find_costs_and_classes): Take estimated elimination costs
+ into account.
+ (ira_adjust_equiv_reg_cost): New function.
+ * ira.h (ira_adjust_equiv_reg_cost): Declare it.
+ * reload1.c (init_eliminable_invariants, free_reg_equiv,
+ elimination_costs_in_insn, note_reg_elim_costly): New static functions.
+ (elim_bb): New static variable.
+ (reload): Move code out of here into init_eliminable_invariants and
+ free_reg_equiv. Call them.
+ (calculate_elim_costs_all_insns): New function.
+ (eliminate_regs_1): Declare. Add extra arg FOR_COSTS;
+ all callers changed. If FOR_COSTS is true, don't call alter_reg,
+ but call note_reg_elim_costly if we turned a valid memory address
+ into an invalid one.
+ * Makefile.in (ira-costs.o): Depend on reload.h.
+
+2010-06-04 Julian Brown <julian@codesourcery.com>
+
+ * config/arm/thumb2.md (*thumb2_movdf_soft_insn): Fix alternatives
+ for pool ranges.
+
+2010-06-04 Richard Guenther <rguenther@suse.de>
+
+ PR lto/41584
+ * cgraph.h (struct varpool_node): Add lto_file_data field.
+ * lto-cgraph.c (input_varpool_node): Initialize it.
+
+2010-06-04 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/predicates.md (pic_symbolic_operand): Remove predicate.
+ * config/i386/i386.md (*add<mode>_1): Do not use pic_symbolic_operand
+ predicate in "type" attribute calculation.
+ (*addsi_1_zext): Ditto.
+ (*add<mode>_2): Do not use pic_symbolic_operand in insn predicate.
+ (*addsi_2_zext): Ditto.
+ (*add<mode>_3): Ditto.
+ (*addsi_3_zext): Ditto.
+ (*add<mode>_5): Ditto.
+
+2010-06-03 Jan Hubicka <jh@suse.cz>
+
+ * tree-into-ssa.c (mark_block_for_update): Avoid redundant call
+ of bitmap_bit_p.
+ * cfganal.c (compute_dominance_frontiers_1): Likewise.
+
+2010-06-03 Jan Hubicka <jh@suse.cz>
+
+ * df-problems.c (df_create_unused_note, df_note_bb_compute):
+ micro-optimize the checks when to add new note.
+
+2010-06-03 Nathan Froyd <froydnj@codesourcery.com>
+
+ * final.c (output_asm_insn): Call
+ targetm.asm_out.print_operand_punct_valid_p. Update comments.
+ (output_operand): Call targetm.asm_out.print_operand. Update comments.
+ (output_address): Call targetm.asm_out.print_operand_address.
+ Update comments.
+ * target.h (struct gcc_target): Add print_operand,
+ print_operand_address, and print_operand_punct_valid_p fields.
+ * targhooks.h (default_print_operand): Declare.
+ (default_print_operand_address): Declare.
+ (default_print_operand_punct_valid_p): Declare.
+ * targhooks.c (default_print_operand): Define.
+ (default_print_operand_address): Define.
+ (default_print_operand_punct_valid_p): Define.
+ * target-def.h (TARGET_PRINT_OPERAND): Define if not defined.
+ (TARGET_PRINT_OPERAND_ADDRESS): Likewise.
+ (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Likewise.
+ (TARGET_ASM_OUT): Add TARGET_PRINT_OPERAND,
+ TARGET_PRINT_OPERAND_ADDRESS, and TARGET_PRINT_OPERAND_PUNCT_VALID_P.
+ * vmsdbgout.c (addr_const_to_string): Update comment.
+ * config/i386/i386.c (print_operand): Rename to...
+ (ix86_print_operand): ...this. Make static.
+ (print_operand_address): Rename to...
+ (ix86_print_operand_address): ...this. Make static. Call
+ ix86_print_operand instead of PRINT_OPERAND.
+ (ix86_print_operand_punct_valid_p): New function.
+ (TARGET_PRINT_OPERAND): Define.
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+ (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
+ * config/i386/i386.h (HI_REGISTER_NAMES): Update comment.
+ (PRINT_OPERAND_PUNCT_VALID_P): Delete.
+ (PRINT_OPERAND): Delete.
+ (PRINT_OPERAND_ADDRESS): Delete.
+ * config/i386/i386-protos.h (print_operand): Delete prototype.
+ (print_operand_address): Delete prototype.
+
+2010-06-03 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44403
+ * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref):
+ Preserve pointer qualifiers.
+ (vect_create_data_ref_ptr): Likewise.
+
+2010-06-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c++/44294
+ * defaults.h (MAX_FIXED_MODE_SIZE): New.
+
+ * stor-layout.c (MAX_FIXED_MODE_SIZE): Removed.
+
+2010-06-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/44375
+ * tree-cfg.c (gimple_can_merge_blocks_p): For -O0
+ return false if merging the bbs would lead to goto_locus
+ location being lost from the IL.
+
+2010-06-03 Jan Hubicka <jh@suse.cz>
+ Jakub Jelinek <jakub@redhat.com>
+
+ * var-tracking.c (dataflow_set_equiv_regs): Shortcut the loop if
+ set->regs[i] is NULL or has just one entry.
+
+2010-06-03 Jan Hubicka <jh@suse.cz>
+
+ * lto-cgraph.c (lto_varpool_encoder_size): Remove.
+ * lto-streamer.h (lto_varpool_encoder_size): New inline function.
+
+2010-06-03 Paul Brook <paul@codesourcery.com>
+
+ * config/arm/arm.c (FL_TUNE): Define.
+ (arm_default_cpu, arm_cpu_select): Remove.
+ (all_cores): Populate core field.
+ (arm_selected_arch, arm_selected_cpu, arm_selected_tune): New.
+ (arm_find_cpu): New function.
+ (arm_handle_option): Lookup cpu/architecture names.
+ (arm_override_options): Cleanup mcpu/march/mtune handling.
+ (arm_file_start): Ditto.
+
+2010-06-03 Alan Modra <amodra@gmail.com>
+
+ PR target/44169
+ * config/rs6000/rs6000.md (load_toc_v4_PIC_1b): Add label operand.
+ * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Pass label
+ rtx to gen_load_toc_v4_PIC_1b. Tidy.
+ (rs6000_emit_load_toc_table): Likewise.
+
+2010-06-02 Jan Hubicka <jh@suse.cz>
+
+ * passes.c (init_optimization_passes): Put ipa reference
+ after ipa pure-const.
+
+2010-06-02 Jan Hubicka <jh@suse.cz>
+
+ * ipa-reference.c (ipa_reference_local_vars_info_d): Remove
+ calls_read_all and calls_write_all.
+ (get_reference_optimization_summary): Fix formatting.
+ (is_proper_for_analysis): Check that decl is not readonly.
+ (propagate_bits): Check CONST/PURE/noreturn flags.
+ (ipa_init): Move all_module_statics to optimization_summary_obstack.
+ (analyze_function): Ignore indirect edges.
+ (copy_global_bitmap): For all module statics, do nothing.
+ (generate_summary): Do not print calls_read_all/calls_write_all.
+ (read_write_all_from_decl): Take node as argument; check
+ cgraph_node_cannot_return.
+ (propagate): Reorganize read_all/write_all computation;
+ check indirect edges; check ecf flags; use all_module_statics
+ in the results; do not free all_module_statics.
+ (stream_out_bitmap): Handle all_module_statics.
+ (ipa_reference_write_optimization_summary): Likewise; use
+ varpool/cgraph encoders to get boundaries.
+ (ipa_reference_read_optimization_summary): Read in all_module_statics;
+ use it when possible.
+
+2010-06-02 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/44218
+ * doc/invoke.texi (RS/6000 and PowerPC Options): Delete obsolete
+ -mswdiv option. Add -mrecip, -mrecip=<xxx>, -mrecip-precision options.
+
+ * doc/extend.texi (powerpc builtins): Document vec_recip,
+ vec_rsqrt, vec_rsqrte altivec/vsx builtins.
+
+ * config/rs6000/rs60000-protos.h (rs6000_emit_swdiv): New function.
+ (rs6000_emit_swrsqrt): Ditto.
+ (rs6000_emit_swdivsf): Delete.
+ (rs6000_emit_swdivdf): Ditto.
+ (rs6000_emit_swrsqrtsf): Ditto.
+
+ * config/rs6000/rs6000.c (rs6000_recip_bits): New global to
+ describe the reciprocal estimate support for each type.
+ (recip_options): Map -mrecip=<opt> into option bits.
+ (gen_2arg_fn_t): New typedef for binary rtx gen function.
+ (rs6000_debug_reg_global): If -mdebug=reg, print the state of the
+ reciprocal estimate instructions.
+ (rs6000_init_hard_regno_mode_ok): Key ws constraint off of the
+ debug -mvsx-scalar-memory switch instead of -mvsx-scalar-double.
+ Set up rs6000_recip_bits based on the -mrecip* options. Print the
+ cost information if -mdebug=cost or -mdebug=reg.
+ (rs6000_override_options): Set -mrecip-precision for power6, and
+ power7 machines. If -mvsx or -mdfp, enable various options that
+ came in previous instruction set ISAs, unless the option was
+ explicitly disabled by the command line option. Parse
+ -mrecip=<opt> options.
+ (rs6000_builtin_vectorized_function): Add support for vectorizing
+ the reciprocal estimate builtins and expansions.
+ (rs6000_handle_option): Add -mrecip, -mrecip=<opt> support.
+ (bdesc_2arg): Add reciprocal estimate builtins.
+ (bdesc_1arg): Add reciprocal square root estimate builtins.
+ (rs6000_expand_builtin): Rewrite to use a switch statement,
+ instead of multiple if/then/elses. Add reciprocal estimate builtins.
+ (rs6000_init_builtins): Create declarations for reciprocal
+ estimate builtins.
+ (rs6000_preferred_reload_class): Simplify VSX preferences, if scalar
+ sized, prefer traditional floating point registers, if integer
+ vector types, prefer altivec registers. Don't actually look at
+ the memory address any more.
+ (rs6000_builtin_reciprocal): Add new builtin reciprocal estimate
+ builtins.
+ (rs6000_load_constant_and_splat): New helper function to load up
+ the constant for reciprocal estimate instructions.
+ (rs6000_emit_madd): New helper function for generating
+ multiply/add type instructions, based on the current switches.
+ (rs6000_emit_msub): Ditto.
+ (rs6000_emit_mnsub): Ditto.
+ (rs6000_emit_swdiv_high_precision): Replace rs6000_emit_swdivsf to
+ replace a divide with a reciprocal estimate and fixup, adding
+ support for machines with high precision and vectors.
+ (rs6000_emit_swdiv_low_precision): Rewrite rs6000_emit_swdivdf for
+ low precision machines.
+ (rs6000_emit_swdiv): New common function to be called to replace a
+ division with reciprocal estimate and fixup.
+ (rs6000_emit_swrsqrt): Replace rs6000_emit_swrsqrtsf. Add support
+ for double and vector types. Add support for high precision machines.
+
+ * config/rs6000/rs6000.h (TARGET_FRES): New macro to say whether
+ the reciprocal estimate instructions can be generated.
+ (TARGET_FRE): Ditto.
+ (TARGET_FRSQRTES): Ditto.
+ (TARGET_FRSQRTE): Ditto.
+ (RS6000_RECIP_*): New macros for reciprocal estimate support.
+
+ * config/rs6000/vector.md (rsqrte<mode>2): New insn for reciprocal
+ square root estimate on vectors.
+ (re<mode>2): New insn for reciprocal division estimate on vectors.
+
+ * config/rs6000/rs6000-buitlins.def (ALTIVEC_BUILTIN_VRSQRTFP):
+ New builtin.
+ (ALTIVEC_BUILTIN_VRECIPFP): Ditto.
+ (ALTIVEC_BUITLIN_VEC_RE): Ditto.
+ (ALTIVEC_BUILTIN_VEC_RSQRT): Ditto.
+ (VSX_BUILTIN_RSQRT_V4SF): Ditto.
+ (VSX_BUITLIN_RSQRT_V2DF): Ditto.
+ (RS6000_BUILTIN_RSQRT): Ditto.
+ (ALTIVEC_BUILTIN_VEC_RSQRTE): Denote that the builtin is a
+ floating point builtin.
+
+ * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define
+ macros __RECIP__, __RECIPF__, __RSQRTE__, __RSQRTEF__,
+ __RECIP_PRECISION__ based on the command line switches.
+ (altivec_overloaded_builtins): Add reciprocal estimate builtins.
+
+ * config/rs6000/rs6000.opt (-mrecip): Document add support for
+ replacing division instructions with reciprocal estimate and fixup.
+ (-mrecip=<opt>): New option.
+ (-mrecip-precision): Ditto.
+
+ * config/rs6000/vsx.md (UNSPEC_VSX_RSQRTE): Delete.
+ (vsx_rsqrte<mode>2): Use UNSPEC_RSQRT not UNSPEC_VSX_RSQRTE.
+ (vsx_copysignsf3): If -mvsx, use double precision cpsign on single
+ precision scalar.
+
+ * config/rs6000/altivec.md (UNSPEC_RSQRTEFP): Delete.
+ (UNSPEC_VREFP): Ditto.
+ (altivec_vnmsubfp*): Make altivec nmsub mirror the scalar and VSX
+ conterparts with regard to support of -mno-fused-madd and -ffast-math.
+ (altivec_vrsqrtefp): Use common UNSPEC to allow scalar/vector
+ reciprocal estimate instructions to be generated.
+ (altivec_vrefp): Ditto.
+
+ * config/rs6000/rs6000.md (RECIPF): New iterator for reciprocal
+ estimate support.
+ (rreg): New mode attribute for reciprocal estimate support.
+ (recip<mode>3): New insn for division using reciprocal estimate
+ and fixup builtins.
+ (divide define_split): New define_split to convert floating point
+ division to use reciprocal estimate if the user used the
+ appropriate options and the split is run when we can add new
+ pseudo registers for the fixup.
+ (rsqrt<mode>2): New insn for reciprocal square root support.
+ (recipsf3): Move into recip<mode>3.
+ (recipdf3): Ditto.
+ (fres): Use TARGET_FRES.
+ (rsqrtsf2): Move into rsqrt<mode>2.
+ (rsqrtsf_internal1): Use TARGET_FRSQRTSES.
+ (copysignsf3): Add support for VSX.
+ (fred): Use TARGET_FRE.
+ (fred_fpr): Ditto.
+ (rsqrtdf_internal1): New function for frsqrte instruciton.
+
+ * config/rs6000/altivec.h (vec_recipdiv): Define new vector builtin.
+ (vec_rsqrt): Ditto.
+
+2010-06-03 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/44291
+ * optabs.c (init_one_libfunc): Use IDENTIFIER_HASH_VALUE.
+ (set_user_assembler_libfunc): Likewise.
+
+2010-06-02 Steven Bosscher <steven@gcc.gnu.org>
+
+ * mkconfig.sh: Include insn-flags.h and insn-constants.h before
+ defaults.h.
+ * except.h: Move MUST_USE_SJLJ_EXCEPTIONS and USING_SJLJ_EXCEPTIONS
+ to defaults.h
+ * expr.h (BRANCH_COST, MOVE_RATIO, CLEAR_RATIO, SET_RATIO,
+ DEFAULT_FUNCTION_ARG_PADDING, FUNCTION_ARG_PADDING,
+ FUNCTION_ARG_BOUNDARY, STACK_SAVEAREA_MODE, STACK_SIZE_MODE,
+ STACK_CHECK_BUILTIN, STACK_CHECK_STATIC_BUILTIN,
+ STACK_CHECK_PROBE_INTERVAL_EXP, STACK_CHECK_MOVING_SP,
+ STACK_OLD_CHECK_PROTECT, STACK_CHECK_PROTECT,
+ STACK_CHECK_MAX_FRAME_SIZE, STACK_CHECK_FIXED_FRAME_SIZE,
+ STACK_CHECK_MAX_VAR_SIZE): Move target macro defaults to defaults.h.
+ * defaults.h: Updated for above mentioned changes.
+
2010-06-02 Kai Tietz <kai.tietz@onevision.com>
* c-common.c: Remove header include of tm_p.h.
@@ -80,8 +4812,7 @@
(*mov<mode>_64 TD_TF, *mov<mode>_31 TD_TF, *mov<mode>_64dfp DD_DF,
*mov<mode>_64 DD_DF, *mov<mode>_31, mov<mode>): Remove load zero
instruction.
- * config/s390/s390.c: Don't accept fp zeros as valid constants
- anymore.
+ * config/s390/s390.c: Don't accept fp zeros as valid constants anymore.
2010-06-02 Jan Hubicka <jh@suse.cz>
@@ -194,8 +4925,7 @@
Include rtl.h.
(copy_decl_for_dup_finish): Do not use NULL_RTX.
- * tree-loop-linear.c: Do not include diagnostic.h, expr.h,
- and optabs.h.
+ * tree-loop-linear.c: Do not include diagnostic.h, expr.h and optabs.h.
* tree-loop-distribution.c: Likewise.
2010-06-01 Jan Hubicka <jh@suse.cz>
@@ -234,25 +4964,26 @@
* emit-rtl.c: (first_insn, last_insn): Remove defines.
(get_insns, set_first_insn, get_last_insn, set_last_insn, get_max_uid):
Move to emit-rtl.h.
- (set_new_first_and_last_insn, get_last_insn_anywhere, get_first_nonnote_insn,
- get_last_nonnote_insn, try_split, make_call_insn_raw, add_insn_after,
- add_insn_before, remove_insn, delete_insns_since, reorder_insns_nobb,
- emit_insn_after_1, emit_debug_insn_before, emit_insn, start_sequence,
- push_to_sequence, push_to_sequence2, push_topmost_sequence, end_sequence,
- copy_insn): Use accessor functions.
+ (set_new_first_and_last_insn, get_last_insn_anywhere,
+ get_first_nonnote_insn, get_last_nonnote_insn, try_split,
+ make_call_insn_raw, add_insn_after, add_insn_before, remove_insn,
+ delete_insns_since, reorder_insns_nobb, emit_insn_after_1,
+ emit_debug_insn_before, emit_insn, start_sequence, push_to_sequence,
+ push_to_sequence2, push_topmost_sequence, end_sequence, copy_insn):
+ Use accessor functions.
* emit-rtl.h (gen_blockage, gen_rtvec, copy_insn_1, copy_insn,
gen_int_mode, emit_copy_of_insn_after, set_reg_attrs_from_value,
set_reg_attrs_for_parm, set_reg_attrs_for_decl_rtl, adjust_reg_mode,
- mem_expr_equal_p): Move here from rtl.h
+ mem_expr_equal_p): Move here from rtl.h.
(get_insns, set_first-insn, get_last_insn, set_last_insn, get_max_uid):
Move here from emit-rtl.c; make inline.
- * cfglayout.h: Include emit-rtl.h
+ * cfglayout.h: Include emit-rtl.h.
* rtl.h (gen_blockage, gen_rtvec, copy_insn_1, copy_insn,
gen_int_mode, emit_copy_of_insn_after, set_reg_attrs_from_value,
set_reg_attrs_for_parm, set_reg_attrs_for_decl_rtl, adjust_reg_mode,
- mem_expr_equal_p, get_insns, set_first-insn, get_last_insn, set_last_insn,
- get_max_uid): Move to emit-rtl.h.
- * reg-stack.c: Include emit-rtl.h
+ mem_expr_equal_p, get_insns, set_first-insn,
+ get_last_insn, set_last_insn, get_max_uid): Move to emit-rtl.h.
+ * reg-stack.c: Include emit-rtl.h.
* dce.c: Likewise.
2010-06-01 Jan Hubicka <jh@suse.cz>
@@ -261,11 +4992,11 @@
(cgraph_function_versioning): Update prototype.
* cgraphunit.c (cgraph_copy_node_for_versioning): Accept bbs_to_copy
bitmap.
- (cgraph_function_versioning): Accept new_entry_block and bbs_to_copy.
+ (cgraph_function_versioning): Accept new_entry_block and bbs_to_copy.
(cgraph_materialize_clone, save_inline_function_body): Update use of
tree_function_versioning.
- * tree-inline.c (copy_bb): Look for previous copied block to link after;
- fix debug output.
+ * tree-inline.c (copy_bb): Look for previous copied block to link
+ after; fix debug output.
(copy_cfg_body): Accept new_entry_block and bbs_to_copy.
(copy_body): Likewise.
(expand_call_inline): Update use of copy_body.
@@ -293,7 +5024,7 @@
* c-opts.c (c_common_handle_option): Likewise.
2010-06-01 Arnaud Charlet <charlet@adacore.com>
- Matthew Gingell <gingell@adacore.com>
+ Matthew Gingell <gingell@adacore.com>
* doc/invoke.texi: Mention -fdump-ada-spec.
* tree-dump.c (dump_files): Add ada-spec.
@@ -330,23 +5061,22 @@
2010-06-01 Maxim Kuvyrkov <maxim@codesourcery.com>
* config/arm/t-linux-androideabi: New.
- * config.gcc (arm*-*-linux-androideabi): Include multilib configuration.
+ * config.gcc (arm*-*-linux-androideabi): Include multilib config.
2010-06-01 Jan Hubicka <jh@suse.cz>
* tree-inline.c (estimate_num_insns): For stdarg functions look
into call statement to count cost of argument passing.
-2010-06-01 Kai Tietz
+2010-06-01 Kai Tietz <kai.tietz@onevision.com>
- * config/i386.c (ix86_output_addr_vec_elt): Make LPREFIX
- argument for fprintf.
- (ix86_output_addr_diff_elt): Likewise.
- (x86_function_profiler): Likewise.
- * config/cygming.h (LOCAL_LABEL_PREFIX): Fix
- for x64 no-underscore.
- (LPREFIX): Likewise.
- (ASM_GENERATE_INTERNAL_LABEL): Likewise.
+ * config/i386.c (ix86_output_addr_vec_elt): Make LPREFIX
+ argument for fprintf.
+ (ix86_output_addr_diff_elt): Likewise.
+ (x86_function_profiler): Likewise.
+ * config/cygming.h (LOCAL_LABEL_PREFIX): Fix for x64 no-underscore.
+ (LPREFIX): Likewise.
+ (ASM_GENERATE_INTERNAL_LABEL): Likewise.
2010-05-31 Jakub Jelinek <jakub@redhat.com>
@@ -394,8 +5124,7 @@
2010-05-31 Kai Tietz <kai.tietz@onevision.com>
PR target/44161
- * config/i386/cygming.h (SUBTARGET_OVERRIDE_OPTIONS): Handle
- flag_pic.
+ * config/i386/cygming.h (SUBTARGET_OVERRIDE_OPTIONS): Handle flag_pic.
2010-05-31 Eric Botcazou <ebotcazou@adacore.com>
@@ -404,8 +5133,7 @@
2010-05-31 Richard Guenther <rguenther@suse.de>
- * tree-ssa-structalias.c (find_func_aliases): Handle
- BUILT_IN_RETURN.
+ * tree-ssa-structalias.c (find_func_aliases): Handle BUILT_IN_RETURN.
2010-05-30 Jan Hubicka <jh@suse.cz>
@@ -429,7 +5157,7 @@
* config/rs6000/darwin.h (ASM_OUTPUT_COMMON): Ditto.
* config/darwin.h (GLOBAL_ASM_OP): Ditto.
* config/darwin9.h (ASM_OUTPUT_ALIGNED_COMMON): Ditto.
-
+
2010-05-30 Eric Botcazou <ebotcazou@adacore.com>
* config/rs6000/rs6000.c (rs6000_output_function_entry): Use
@@ -450,8 +5178,7 @@
* cgraph.h (cgraph_dump_file): Declare.
* cgraphunit.c (cgraph_dump_file): Export.
- * ipa.c (dump_cgraph_node_set, dump_varpool_node_set): Be less
- verbose.
+ * ipa.c (dump_cgraph_node_set, dump_varpool_node_set): Be less verbose.
2010-05-30 Jan Hubicka <jh@suse.cz>
@@ -468,9 +5195,8 @@
* ipa-pure-const.c (pure_const_names): New static var.
(check_call): Handle calls not leading to return.
(pure_const_read_summary): Dump info read.
- (propagate): Dump info about propagation process; ignore side
- effects of functions not leading to exit; fix handling of
- pure functions.
+ (propagate): Dump info about propagation process; ignore side effects
+ of functions not leading to exit; fix handling of pure functions.
2010-05-30 Jan Hubicka <jh@suse.cz>
@@ -504,7 +5230,7 @@
debug_asserts_for, debug_all_asserts): Annotate with DEBUG_FUNCTION.
* tree-into-ssa.c (debug_decl_set, debug_defs_stack, debug_currdefs,
debug_tree_ssa, debug_tree_ssa_stats, debug_def_blocks,
- debug_names_replaced_by, debug_update_ssa): Likewise.
+ debug_names_replaced_by, debug_update_ssa): Likewise.
* sbitmap.c (debug_sbitmap): Likewise.
* genrecog.c (debug_decision, debug_decision_list): Likewise.
* tree-pretty-print.c (debug_generic_expr, debug_generic_stmt,
@@ -690,8 +5416,7 @@
2010-05-29 Jan Hubicka <jh@suse.cz>
* cgraphunit.c (cgraph_materialize_clone): Only remove calles,
- refs and body; not the whole node for masters of materialized
- clones.
+ refs and body; not the whole node for masters of materialized clones.
2010-05-29 Mike Stump <mikestump@comcast.net>
@@ -702,7 +5427,7 @@
* cgraph.c (clone_function_name): Take SUFFIX argument; export.
(cgraph_create_virtual_clone): Take SUFFIX argument; udpate
use of clone_function_name.
- * cgraph.h (cgraph_create_virtual_clone,
+ * cgraph.h (cgraph_create_virtual_clone,
cgraph_function_versioning): update prototypes.
(clone_function_name): Declare.
* ipa-cp.c (ipcp_insert_stage): Update call of
@@ -721,10 +5446,10 @@
2010-05-29 Steven Bosscher <steven@gcc.gnu.org>
- * c-lex.c: Do not include c-tree.h.
- * c-pretty-print.c: Likewise.
- * c-opts.c: Likewise.
- * c-gimplify.c: Likewise.
+ * c-lex.c: Do not include c-tree.h.
+ * c-pretty-print.c: Likewise.
+ * c-opts.c: Likewise.
+ * c-gimplify.c: Likewise.
* c-common.c: Likewise.
* c-dump.c: Likewise. Include c-common.h.
@@ -831,8 +5556,7 @@
* gcc.c (inform, warning, inform): New functions.
(fatal_ice): Rename to internal_error; change cmsgid parameter to
gmsgid. All callers changed.
- (notice): Rename to fnotice; add parameter fp. All callers
- changed.
+ (notice): Rename to fnotice; add parameter fp. All callers changed.
(fatal_error): Rename to fatal_signal. All users changed.
(fatal): Rename to fatal_error; change cmsgid parameter to
gmsgid. All callers changed.
@@ -847,8 +5571,7 @@
(warning): Declare.
* config/darwin-driver.c (darwin_default_min_version): Use warning
instead of fprintf for warnings.
- * cppspec.c (lang_specific_driver): Use fatal_error instead of
- fatal.
+ * cppspec.c (lang_specific_driver): Use fatal_error instead of fatal.
2010-05-28 Julian Brown <julian@codesourcery.com>
@@ -868,7 +5591,7 @@
2010-05-28 Iain Sandoe <iains@gcc.gnu.org>
- * config.gcc (*-*-darwin*): Adjust t-make fragments for Darwin.
+ * config.gcc (*-*-darwin*): Adjust t-make fragments for Darwin.
2010-05-28 Maxim Kuvyrkov <maxim@codesourcery.com>
@@ -1149,7 +5872,7 @@
2010-05-27 Jon Beniston <jon@beniston.com>
PR 43726
- * config/lm32/lm32.h: Remove definition of
+ * config/lm32/lm32.h: Remove definition of
GO_IF_MODE_DEPENDENT_ADDRESS. Update copyright year.
2010-05-27 Eric Botcazou <ebotcazou@adacore.com>
@@ -6149,7 +10872,7 @@
(next_operand_entry_id): New static variable.
(sort_by_operand_rank): Stabilize qsort comparator by using unique IDs.
(add_to_ops_vec): Assigned unique ID to operand entry.
- (struct oecount_s): New field ID.
+ (struct oecount_s): New field ID.
(oecount_cmp): Stabilize qsort comparotor by using unique IDs.
(undistribute_ops_list): Assign unique IDs to oecounts.
(init_reassoc): reset next_operand_entry_id.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 99c116de7b5..b5fc066d57c 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20100602
+20100701
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index a5eca3ef682..ed53a79ddfc 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -261,7 +261,7 @@ TEXI2DVI = texi2dvi
TEXI2PDF = texi2pdf
TEXI2HTML = $(MAKEINFO) --html
TEXI2POD = perl $(srcdir)/../contrib/texi2pod.pl
-POD2MAN = pod2man --center="GNU" --release="gcc-$(version)"
+POD2MAN = pod2man --center="GNU" --release="gcc-$(version)" --date=$(shell sed 's/\(....\)\(..\)\(..\)/\1-\2-\3/' <$(DATESTAMP))
# Some versions of `touch' (such as the version on Solaris 2.8)
# do not correctly set the timestamp due to buggy versions of `utime'
# in the kernel. So, we use `echo' instead.
@@ -331,10 +331,10 @@ LTO_BINARY_READER = @LTO_BINARY_READER@
LTO_USE_LIBELF = @LTO_USE_LIBELF@
# Compiler needed for plugin support
-PLUGINCC = @CC@
+PLUGINCC = $(COMPILER)
# Flags needed for plugin support
-PLUGINCFLAGS = @CFLAGS@
+PLUGINCFLAGS = $(COMPILER_FLAGS)
# Libs and linker options needed for plugin support
PLUGINLIBS = @pluginlibs@
@@ -502,7 +502,7 @@ check_gcc_parallelize=execute.exp=execute/2* \
compile.exp dg.exp \
dg-torture.exp,builtins.exp \
struct-layout-1.exp,unsorted.exp,stackalign.exp,i386.exp
-lang_opt_files=@lang_opt_files@ $(srcdir)/c.opt $(srcdir)/common.opt
+lang_opt_files=@lang_opt_files@ $(srcdir)/c-family/c.opt $(srcdir)/common.opt
lang_specs_files=@lang_specs_files@
lang_tree_files=@lang_tree_files@
target_cpu_default=@target_cpu_default@
@@ -816,8 +816,8 @@ BCONFIG_H = bconfig.h $(build_xm_file_list)
CONFIG_H = config.h $(host_xm_file_list)
TCONFIG_H = tconfig.h $(xm_file_list)
TM_P_H = tm_p.h $(tm_p_file_list)
-GTM_H = tm.h $(tm_file_list)
-TM_H = $(GTM_H) insn-constants.h insn-flags.h options.h
+GTM_H = tm.h $(tm_file_list) insn-constants.h
+TM_H = $(GTM_H) insn-flags.h options.h
# Variables for version information.
BASEVER := $(srcdir)/BASE-VER # 4.x.y
@@ -861,23 +861,25 @@ endif
VEC_H = vec.h statistics.h
EXCEPT_H = except.h $(HASHTAB_H) vecprim.h vecir.h
TOPLEV_H = toplev.h $(INPUT_H) bversion.h $(DIAGNOSTIC_CORE_H)
-TARGET_H = $(TM_H) target.h insn-modes.h
+TARGET_H = $(TM_H) target.h target.def insn-modes.h
MACHMODE_H = machmode.h mode-classes.def insn-modes.h
HOOKS_H = hooks.h $(MACHMODE_H)
HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
-TARGET_DEF_H = target-def.h $(HOOKS_H) targhooks.h
+TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h
RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
$(INPUT_H) $(REAL_H) statistics.h $(VEC_H) $(FIXED_VALUE_H) alias.h
FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
RTL_H = $(RTL_BASE_H) genrtl.h vecir.h
+RTL_ERROR_H = $(RTL_H) $(DIAGNOSTIC_CORE_H)
+READ_MD_H = $(OBSTACK_H) $(HASHTAB_H) read-md.h
PARAMS_H = params.h params.def
BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
-TREE_H = tree.h all-tree.def tree.def c-common.def $(lang_tree_files) \
- $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
- $(INPUT_H) statistics.h $(VEC_H) treestruct.def $(HASHTAB_H) \
- double-int.h alias.h $(SYMTAB_H) options.h vecir.h \
- $(REAL_H) $(FIXED_VALUE_H)
+TREE_H = tree.h all-tree.def tree.def c-family/c-common.def \
+ $(lang_tree_files) $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
+ $(INPUT_H) statistics.h $(VEC_H) treestruct.def $(HASHTAB_H) \
+ double-int.h alias.h $(SYMTAB_H) options.h vecir.h \
+ $(REAL_H) $(FIXED_VALUE_H)
REGSET_H = regset.h $(BITMAP_H) hard-reg-set.h
BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) cfghooks.h
GIMPLE_H = gimple.h gimple.def gsstruct.def pointer-set.h $(VEC_H) \
@@ -914,11 +916,13 @@ RESOURCE_H = resource.h hard-reg-set.h $(DF_H)
DDG_H = ddg.h sbitmap.h $(DF_H)
GCC_H = gcc.h version.h $(DIAGNOSTIC_CORE_H)
GGC_H = ggc.h gtype-desc.h statistics.h
+GGC_INTERNAL_H = ggc-internal.h $(GGC_H)
TIMEVAR_H = timevar.h timevar.def
INSN_ATTR_H = insn-attr.h $(INSN_ADDR_H)
INSN_ADDR_H = $(srcdir)/insn-addr.h vecprim.h
-C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) $(DIAGNOSTIC_CORE_H)
-C_PRAGMA_H = c-pragma.h $(CPPLIB_H)
+C_COMMON_H = c-family/c-common.h c-family/c-common.def \
+ $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) $(DIAGNOSTIC_CORE_H)
+C_PRAGMA_H = c-family/c-pragma.h $(CPPLIB_H)
C_TREE_H = c-tree.h $(C_COMMON_H) $(TOPLEV_H) $(DIAGNOSTIC_H)
SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
$(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
@@ -945,7 +949,8 @@ SSAEXPAND_H = ssaexpand.h $(TREE_SSA_LIVE_H)
PRETTY_PRINT_H = pretty-print.h $(INPUT_H) $(OBSTACK_H)
DIAGNOSTIC_CORE_H = diagnostic-core.h input.h diagnostic.def
DIAGNOSTIC_H = diagnostic.h $(DIAGNOSTIC_CORE_H) $(PRETTY_PRINT_H)
-C_PRETTY_PRINT_H = c-pretty-print.h $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
+C_PRETTY_PRINT_H = c-family/c-pretty-print.h $(PRETTY_PRINT_H) \
+ $(C_COMMON_H) $(TREE_H)
SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h $(PARAMS_H)
LAMBDA_H = lambda.h $(TREE_H) $(VEC_H) $(GGC_H)
TREE_DATA_REF_H = tree-data-ref.h $(LAMBDA_H) omega.h graphds.h $(SCEV_H)
@@ -1033,8 +1038,10 @@ LDEXP_LIB = @LDEXP_LIB@
# even if we are cross-building GCC.
BUILD_LIBS = $(BUILD_LIBIBERTY)
-BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o build/vec.o \
- build/min-insn-modes.o build/gensupport.o build/print-rtl.o
+BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \
+ build/vec.o build/min-insn-modes.o build/gensupport.o \
+ build/print-rtl.o
+BUILD_MD = build/read-md.o
BUILD_ERRORS = build/errors.o
# Specify the directories to be searched for header files.
@@ -1128,15 +1135,20 @@ FORTRAN_TARGET_OBJS=@fortran_target_objs@
GCC_OBJS = gcc.o opts-common.o gcc-options.o diagnostic.o pretty-print.o \
input.o
+# Language-specific object files shared by all C-family front ends.
+C_COMMON_OBJS = c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o \
+ c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o \
+ c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o \
+ c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o \
+ c-family/c-semantics.o c-family/c-ada-spec.o
+
# Language-specific object files for C and Objective C.
-C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \
- c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \
- c-ppoutput.o c-cppbuiltin.o \
- c-objc-common.o c-dump.o c-pch.o c-parser.o $(C_TARGET_OBJS) \
- c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o c-ada-spec.o
+C_AND_OBJC_OBJS = attribs.o c-errors.o c-decl.o c-typeck.o \
+ c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.o \
+ $(C_COMMON_OBJS) $(C_TARGET_OBJS)
# Language-specific object files for C.
-C_OBJS = c-lang.o stub-objc.o $(C_AND_OBJC_OBJS)
+C_OBJS = c-lang.o c-family/stub-objc.o $(C_AND_OBJC_OBJS)
# Language-independent object files.
# We put the insn-*.o files first so that a parallel make will build
@@ -1153,6 +1165,7 @@ OBJS-common = \
insn-peep.o \
insn-preds.o \
insn-recog.o \
+ insn-enums.o \
$(GGC) \
alias.o \
alloc-pool.o \
@@ -1429,6 +1442,7 @@ OBJS-archive = \
cppdefault.o \
incpath.o \
ipa-cp.o \
+ ipa-split.o \
ipa-inline.o \
ipa-prop.o \
ipa-pure-const.o \
@@ -1571,7 +1585,7 @@ s-alltree: Makefile
rm -f tmp-all-tree.def
echo '#include "tree.def"' > tmp-all-tree.def
echo 'END_OF_BASE_TREE_CODES' >> tmp-all-tree.def
- echo '#include "c-common.def"' >> tmp-all-tree.def
+ echo '#include "c-family/c-common.def"' >> tmp-all-tree.def
ltf="$(lang_tree_files)"; for f in $$ltf; do \
echo "#include \"$$f\""; \
done | sed 's|$(srcdir)/||' >> tmp-all-tree.def
@@ -1970,62 +1984,58 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
# Note that dependencies on obstack.h are not written
# because that file is not part of GCC.
-# C language specific files.
-
-c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) $(TM_P_H)
-c-parser.o : c-parser.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(GGC_H) $(TIMEVAR_H) $(C_TREE_H) $(INPUT_H) $(FLAGS_H) $(TOPLEV_H) output.h \
- $(CPPLIB_H) gt-c-parser.h $(RTL_H) langhooks.h $(C_COMMON_H) $(C_PRAGMA_H) \
- $(VEC_H) $(TARGET_H) $(CGRAPH_H) $(PLUGIN_H)
-
srcextra: gcc.srcextra lang.srcextra
gcc.srcextra: gengtype-lex.c
-cp -p $^ $(srcdir)
-incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
- intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
- $(MACHMODE_H)
+# C language specific files.
+c-aux-info.o : c-aux-info.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(C_TREE_H) $(TREE_H) $(FLAGS_H) $(TOPLEV_H)
-c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
- debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) $(TIMEVAR_H) \
- opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) $(HASHTAB_H) libfuncs.h \
- $(EXCEPT_H) $(LANGHOOKS_DEF_H) $(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) \
- $(DIAGNOSTIC_CORE_H) $(INPUT_H) langhooks.h tree-mudflap.h \
- pointer-set.h tree-iterator.h c-lang.h $(PLUGIN_H) c-ada-spec.h
-c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(C_TREE_H) $(TARGET_H) $(FLAGS_H) intl.h output.h $(EXPR_H) \
- $(TOPLEV_H) langhooks.h $(TREE_FLOW_H) tree-iterator.h c-lang.h
-c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(DIAGNOSTIC_CORE_H) \
- langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \
- c-objc-common.h $(C_PRAGMA_H) c-common.def $(TREE_INLINE_H)
-stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(C_COMMON_H)
-c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(FIXED_VALUE_H) debug.h $(C_TREE_H) $(C_COMMON_H) $(SPLAY_TREE_H) \
- $(C_PRAGMA_H) $(INPUT_H) intl.h $(FLAGS_H) $(TOPLEV_H) output.h \
- $(CPPLIB_H) $(TARGET_H) $(TIMEVAR_H)
-c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(CPP_INTERNAL_H) $(C_PRAGMA_H)
-c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
- langhooks.h $(GGC_H) $(C_PRETTY_PRINT_H) c-objc-common.h intl.h \
- tree-pretty-print.h
-c-aux-info.o : c-aux-info.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(FLAGS_H) $(TOPLEV_H)
c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) $(TOPLEV_H) $(C_COMMON_H) convert.h $(C_TREE_H) \
- langhooks.h $(TARGET_H)
-c-pragma.o: c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) $(TOPLEV_H) output.h $(TM_P_H) \
- $(C_COMMON_H) $(TARGET_H) gt-c-pragma.h $(CPPLIB_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
- opts.h $(PLUGINS_H)
+ $(TREE_H) $(C_TREE_H) $(FLAGS_H) $(TOPLEV_H) $(C_COMMON_H) convert.h \
+ langhooks.h $(TARGET_H)
+
+c-decl.o : c-decl.c c-lang.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(TREE_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) \
+ output.h debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) $(TIMEVAR_H) \
+ opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) $(HASHTAB_H) libfuncs.h \
+ $(EXCEPT_H) $(LANGHOOKS_DEF_H) $(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) \
+ $(DIAGNOSTIC_CORE_H) $(INPUT_H) langhooks.h tree-mudflap.h \
+ pointer-set.h tree-iterator.h $(PLUGIN_H) c-family/c-ada-spec.h
+
+c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) $(TM_P_H)
+
+c-lang.o : c-lang.c c-objc-common.h \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(C_TREE_H) $(DIAGNOSTIC_CORE_H) \
+ langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \
+ $(C_PRAGMA_H) $(TREE_INLINE_H)
+
+c-objc-common.o : c-objc-common.c c-objc-common.h \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TREE_H) $(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
+ langhooks.h $(GGC_H) $(C_PRETTY_PRINT_H) intl.h \
+ tree-pretty-print.h
+
+c-parser.o : c-parser.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) $(C_TREE_H) $(C_COMMON_H) $(C_PRAGMA_H) $(CPPLIB_H) \
+ $(GGC_H) $(TIMEVAR_H) $(INPUT_H) $(FLAGS_H) $(TOPLEV_H) output.h \
+ gt-c-parser.h langhooks.h \
+ $(VEC_H) $(TARGET_H) $(CGRAPH_H) $(PLUGIN_H)
+
+c-typeck.o : c-typeck.c c-lang.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(TREE_H) $(C_TREE_H) $(TARGET_H) $(FLAGS_H) intl.h output.h $(EXPR_H) \
+ $(TOPLEV_H) langhooks.h tree-iterator.h $(BITMAP_H) $(GIMPLE_H)
+
+
+
graph.o: graph.c $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) $(FLAGS_H) output.h \
$(RTL_H) $(FUNCTION_H) hard-reg-set.h $(BASIC_BLOCK_H) graph.h $(OBSTACK_H) \
$(CONFIG_H) $(EMIT_RTL_H)
+
sbitmap.o: sbitmap.c sbitmap.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(BASIC_BLOCK_H)
ebitmap.o: ebitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(EBITMAP_H) $(RTL_H) $(FLAGS_H) $(OBSTACK_H)
@@ -2055,65 +2065,107 @@ lto-wrapper$(exeext): lto-wrapper.o intl.o $(LIBDEPS)
$(COMPILER) $(ALL_COMPILERFLAGS) $(LDFLAGS) -o T$@ lto-wrapper.o intl.o $(LIBS)
mv -f T$@ $@
-lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) defaults.h intl.h \
+lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h \
$(OBSTACK_H)
-# A file used by all variants of C.
-
-c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+# Files used by all variants of C.
+c-family/c-common.o : c-family/c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) \
$(OBSTACK_H) $(C_COMMON_H) $(FLAGS_H) $(TOPLEV_H) output.h $(C_PRAGMA_H) \
- $(GGC_H) $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def \
- $(DIAGNOSTIC_H) gt-c-common.h langhooks.h $(RTL_H) \
- $(TARGET_H) $(C_TREE_H) tree-iterator.h langhooks.h tree-mudflap.h \
+ $(GGC_H) $(EXPR_H) builtin-types.def builtin-attrs.def \
+ $(DIAGNOSTIC_H) langhooks.h $(RTL_H) \
+ $(TARGET_H) tree-iterator.h langhooks.h tree-mudflap.h \
intl.h opts.h $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \
$(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) \
- libfuncs.h
+ libfuncs.h \
+ gt-c-family-c-common.h
-c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \
- $(C_TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(DIAGNOSTIC_H) tree-iterator.h intl.h tree-pretty-print.h
+c-family/c-cppbuiltin.o : c-family/c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h $(TM_H) $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) \
+ $(FLAGS_H) $(TOPLEV_H) output.h $(TREE_H) $(TARGET_H) \
+ $(TM_P_H) $(BASEVER) debug.h $(CPP_ID_DATA_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
+ -DBASEVER=$(BASEVER_s) $< $(OUTPUT_OPTION)
+
+c-family/c-dump.o : c-family/c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) $(TREE_DUMP_H)
+
+c-family/c-format.o : c-family/c-format.c c-family/c-format.h \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
+ $(C_COMMON_H) $(FLAGS_H) $(TOPLEV_H) intl.h \
+ $(DIAGNOSTIC_CORE_H) alloc-pool.h
+
+c-family/c-gimplify.o : c-family/c-gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
+ $(C_COMMON_H) $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) \
+ $(FLAGS_H) langhooks.h $(TOPLEV_H) $(LANGHOOKS_DEF_H) \
+ $(TM_H) coretypes.h $(C_PRETTY_PRINT_H) $(CGRAPH_H) $(BASIC_BLOCK_H) \
+ hard-reg-set.h $(TREE_DUMP_H) $(TREE_INLINE_H)
+
+c-family/c-lex.o : c-family/c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) $(FIXED_VALUE_H) debug.h $(C_COMMON_H) $(SPLAY_TREE_H) \
+ $(C_PRAGMA_H) $(INPUT_H) intl.h $(FLAGS_H) $(TOPLEV_H) output.h \
+ $(CPPLIB_H) $(TARGET_H) $(TIMEVAR_H)
-c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+c-family/c-omp.o : c-family/c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TREE_H) $(C_COMMON_H) $(TOPLEV_H) $(GIMPLE_H) langhooks.h
+
+c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) langhooks.h \
$(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) \
- opts.h options.h $(MKDEPS_H) incpath.h cppdefault.h $(C_TREE_H)
+ opts.h options.h $(MKDEPS_H) incpath.h cppdefault.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
-c-cppbuiltin.o : c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) $(FLAGS_H) \
- $(TOPLEV_H) output.h $(EXCEPT_H) $(TREE_H) $(TARGET_H) $(TM_P_H) \
- $(BASEVER) debug.h
+c-family/c-pch.o : c-family/c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(CPPLIB_H) $(TREE_H) $(C_COMMON_H) output.h $(TOPLEV_H) $(C_PRAGMA_H) \
+ $(GGC_H) debug.h langhooks.h $(FLAGS_H) hosthooks.h version.h \
+ $(TARGET_H) opts.h $(TIMEVAR_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- -DBASEVER=$(BASEVER_s) $< $(OUTPUT_OPTION)
+ -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
+ $< $(OUTPUT_OPTION)
-# A file used by all variants of C and some other languages.
+c-family/c-ppoutput.o : c-family/c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(CPP_INTERNAL_H) \
+ $(C_PRAGMA_H)
-attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(FLAGS_H) $(TOPLEV_H) output.h $(GGC_H) $(TM_P_H) \
- $(TARGET_H) langhooks.h $(CPPLIB_H) $(PLUGIN_H)
+c-family/c-pragma.o: c-family/c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) $(TOPLEV_H) output.h \
+ $(TM_P_H) $(C_COMMON_H) $(TARGET_H) $(CPPLIB_H) $(FLAGS_H) \
+ $(DIAGNOSTIC_H) opts.h $(PLUGINS_H) \
+ gt-c-family-c-pragma.h
-c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
- $(C_COMMON_H) $(FLAGS_H) $(TOPLEV_H) intl.h $(DIAGNOSTIC_CORE_H) alloc-pool.h \
- c-format.h
+c-family/c-pretty-print.o : c-family/c-pretty-print.c $(C_PRETTY_PRINT_H) \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(DIAGNOSTIC_H) tree-iterator.h intl.h tree-pretty-print.h
-c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) $(TOPLEV_H) output.h $(C_COMMON_H) $(FUNCTION_H) \
- langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) tree-iterator.h
+c-family/c-semantics.o : c-family/c-semantics.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h $(TM_H) $(TREE_H) $(FLAGS_H) $(TOPLEV_H) output.h \
+ $(C_COMMON_H) $(FUNCTION_H) langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) \
+ tree-iterator.h
-c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(TREE_DUMP_H)
+c-family/c-ada-spec.o : c-family/c-ada-spec.c c-family/c-ada-spec.h \
+ $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPP_ID_DATA_H) $(TM_H) \
+ coretypes.h tree-iterator.h tree-pass.h output.h
-c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) $(TREE_H) \
- $(C_COMMON_H) output.h $(TOPLEV_H) $(C_PRAGMA_H) $(GGC_H) debug.h \
- langhooks.h $(FLAGS_H) hosthooks.h version.h $(TARGET_H) opts.h \
- $(TIMEVAR_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
- $< $(OUTPUT_OPTION)
+c-family/stub-objc.o : c-family/stub-objc.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h $(TREE_H) $(C_COMMON_H)
-c-omp.o : c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(C_COMMON_H) $(TOPLEV_H) $(GIMPLE_H) langhooks.h
+
+# Files used by all variants of C and some other languages.
+
+attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(FLAGS_H) $(TOPLEV_H) output.h $(GGC_H) $(TM_P_H) \
+ $(TARGET_H) langhooks.h $(CPPLIB_H) $(PLUGIN_H)
+
+incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
+ intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
+ $(MACHMODE_H)
+
+prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) prefix.h \
+ Makefile $(BASEVER)
+ $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
+ -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s) \
+ -c $(srcdir)/prefix.c $(OUTPUT_OPTION)
# Language-independent files.
@@ -2201,26 +2253,21 @@ gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(GGC_H) $(HASHTAB_H) $(TOPLEV_H) $(PARAMS_H) hosthooks.h \
- $(HOSTHOOKS_DEF_H) $(VEC_H) $(PLUGIN_H) $(TIMEVAR_H)
+ $(HOSTHOOKS_DEF_H) $(VEC_H) $(PLUGIN_H) $(GGC_INTERNAL_H) $(TIMEVAR_H)
ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
- $(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) $(TREE_FLOW_H) $(PLUGIN_H)
+ $(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) \
+ $(TREE_FLOW_H) $(PLUGIN_H) $(GGC_INTERNAL_H)
ggc-zone.o: ggc-zone.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) \
- $(PARAMS_H) $(BITMAP_H) $(PLUGIN_H)
+ $(PARAMS_H) $(BITMAP_H) $(PLUGIN_H) $(GGC_INTERNAL_H)
ggc-none.o: ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
$(BCONFIG_H)
stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(GGC_H) gt-stringpool.h $(CPPLIB_H) $(SYMTAB_H)
-
-prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) prefix.h \
- Makefile $(BASEVER)
- $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s) \
- -c $(srcdir)/prefix.c $(OUTPUT_OPTION)
+ $(TREE_H) $(GGC_H) $(GGC_INTERNAL_H) gt-stringpool.h $(CPPLIB_H) $(SYMTAB_H)
convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(FLAGS_H) convert.h $(TOPLEV_H) langhooks.h
@@ -2237,26 +2284,26 @@ lto-cgraph.o: lto-cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TOPLEV_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \
$(HASHTAB_H) langhooks.h $(BASIC_BLOCK_H) \
$(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_CORE_H) \
- except.h $(TIMEVAR_H) output.h pointer-set.h $(LTO_STREAMER_H) $(GCOV_IO_H)
+ $(EXCEPT_H) $(TIMEVAR_H) output.h pointer-set.h $(LTO_STREAMER_H) $(GCOV_IO_H)
lto-streamer-in.o: lto-streamer-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TOPLEV_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \
$(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) $(CGRAPH_H) \
$(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_H) libfuncs.h $(EXCEPT_H) debug.h \
- $(TIMEVAR_H) output.h $(IPA_UTILS_H) $(LTO_STREAMER_H)
+ $(TIMEVAR_H) output.h $(IPA_UTILS_H) $(LTO_STREAMER_H) toplev.h
lto-streamer-out.o : lto-streamer-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TOPLEV_H) $(TREE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \
$(HASHTAB_H) $(BASIC_BLOCK_H) tree-iterator.h \
$(TREE_FLOW_H) $(TREE_PASS_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) \
- $(DIAGNOSTIC_CORE_H) except.h $(LTO_STREAMER_H) $(TOPLEV_H)
+ $(DIAGNOSTIC_CORE_H) $(EXCEPT_H) $(LTO_STREAMER_H) $(TOPLEV_H)
lto-section-in.o: lto-section-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TOPLEV_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \
$(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) except.h $(TIMEVAR_H) output.h \
+ $(GGC_H) $(DIAGNOSTIC_CORE_H) $(EXCEPT_H) $(TIMEVAR_H) output.h \
$(LTO_STREAMER_H) lto-compress.h
lto-section-out.o : lto-section-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TOPLEV_H) $(TREE_H) $(EXPR_H) $(PARAMS_H) input.h \
$(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
- $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) except.h pointer-set.h \
+ $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(EXCEPT_H) pointer-set.h \
$(BITMAP_H) langhooks.h $(LTO_STREAMER_H) lto-compress.h
lto-symtab.o: lto-symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
toplev.h $(TREE_H) $(GIMPLE_H) $(GGC_H) $(LAMBDA_H) $(HASHTAB_H) \
@@ -2455,7 +2502,7 @@ tree-nested.o: tree-nested.c $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TREE_H) \
tree-if-conv.o: tree-if-conv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FLAGS_H) $(TIMEVAR_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
$(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) $(DIAGNOSTIC_H) \
- $(TREE_DUMP_H) tree-pretty-print.h gimple-pretty-print.h
+ $(TREE_DUMP_H) $(DBGCNT_H) tree-pretty-print.h gimple-pretty-print.h
tree-iterator.o : tree-iterator.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
coretypes.h $(GGC_H) tree-iterator.h $(GIMPLE_H) gt-tree-iterator.h
tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
@@ -2463,7 +2510,7 @@ tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(TREE_INLINE_H) $(HASHTAB_H) pointer-set.h $(FLAGS_H) $(FUNCTION_H) \
$(TIMEVAR_H) convert.h $(TM_H) coretypes.h langhooks.h $(TREE_DUMP_H) \
$(TREE_PASS_H) $(PARAMS_H) $(CGRAPH_H) $(BASIC_BLOCK_H) $(GIMPLE_H) \
- tree-pretty-print.h
+ tree-pretty-print.h $(TOPLEV_H)
tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
$(FLAGS_H) $(FUNCTION_H) $(TM_H) $(TIMEVAR_H) $(TREE_PASS_H) $(TOPLEV_H) \
@@ -2560,11 +2607,6 @@ tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(TREE_INLINE_H) tree-mudflap.h $(GGC_H) graph.h $(CGRAPH_H) \
$(TREE_PASS_H) $(CFGLOOP_H) $(EXCEPT_H) $(REGSET_H)
-c-gimplify.o : c-gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(C_TREE_H) $(C_COMMON_H) $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) \
- $(FLAGS_H) langhooks.h $(TOPLEV_H) $(RTL_H) $(TREE_FLOW_H) $(LANGHOOKS_DEF_H) \
- $(TM_H) coretypes.h $(C_PRETTY_PRINT_H) $(CGRAPH_H) $(BASIC_BLOCK_H) \
- hard-reg-set.h $(TREE_DUMP_H) $(TREE_INLINE_H)
gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \
$(DIAGNOSTIC_H) $(GIMPLE_H) $(TREE_INLINE_H) langhooks.h \
$(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(CGRAPH_H) $(TIMEVAR_H) $(TM_H) \
@@ -2670,7 +2712,7 @@ tree-vect-loop.o: tree-vect-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) \
$(TREE_DUMP_H) $(CFGLOOP_H) $(CFGLAYOUT_H) $(EXPR_H) $(RECOG_H) $(OPTABS_H) \
$(TOPLEV_H) $(SCEV_H) $(TREE_VECTORIZER_H) tree-pretty-print.h \
- gimple-pretty-print.h
+ gimple-pretty-print.h $(TARGET_H)
tree-vect-loop-manip.o: tree-vect-loop-manip.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(CFGLAYOUT_H) $(EXPR_H) $(TOPLEV_H) \
@@ -2744,14 +2786,10 @@ tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
$(TREE_PASS_H) value-prof.h output.h tree-pretty-print.h
tree-diagnostic.o : tree-diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_H) $(DIAGNOSTIC_H) tree-diagnostic.h langhooks.h $(LANGHOOKS_DEF_H)
-c-ada-spec.o : c-ada-spec.c c-ada-spec.h $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \
- $(CPP_ID_DATA_H) $(TM_H) coretypes.h tree-iterator.h tree-pass.h \
- value-prof.h fixed-value.h output.h
fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FLAGS_H) $(TOPLEV_H) $(HASHTAB_H) $(EXPR_H) $(RTL_H) \
$(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h $(TARGET_H) \
- $(GIMPLE_H) realmpfr.h
+ $(GIMPLE_H) realmpfr.h $(TREE_FLOW_H)
diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
version.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) diagnostic.def
opts.o : opts.c opts.h options.h $(TOPLEV_H) $(CONFIG_H) $(SYSTEM_H) \
@@ -2811,8 +2849,8 @@ main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H)
host-default.o : host-default.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
hosthooks.h $(HOSTHOOKS_DEF_H)
-rtl-error.o: rtl-error.c $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(INSN_ATTR_H) insn-config.h $(INPUT_H) $(TOPLEV_H) intl.h $(DIAGNOSTIC_H) \
+rtl-error.o: rtl-error.c $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
+ $(INSN_ATTR_H) insn-config.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) \
$(CONFIG_H)
rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
@@ -2832,10 +2870,10 @@ varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(HASHTAB_H) $(TARGET_H) langhooks.h gt-varasm.h $(BASIC_BLOCK_H) \
$(CFGLAYOUT_H) $(CGRAPH_H) targhooks.h tree-mudflap.h \
tree-iterator.h
-function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
$(TREE_H) $(CFGLAYOUT_H) $(GIMPLE_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) \
$(OPTABS_H) libfuncs.h $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \
- output.h $(TOPLEV_H) $(EXCEPT_H) $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \
+ output.h $(EXCEPT_H) $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \
gt-function.h $(TARGET_H) $(BASIC_BLOCK_H) $(INTEGRATE_H) $(PREDICT_H) \
$(TREE_PASS_H) $(DF_H) $(TIMEVAR_H) vecprim.h
statistics.o : statistics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -2959,7 +2997,7 @@ ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) \
$(TREE_INLINE_H) $(GIMPLE_H) $(GIMPLE_FOLD_H) $(TIMEVAR_H) \
- tree-pretty-print.h gimple-pretty-print.h
+ tree-pretty-print.h gimple-pretty-print.h $(LTO_STREAMER_H)
ipa-ref.o : ipa-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(TREE_H) $(TARGET_H) \
$(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) $(GGC_H)
@@ -2967,6 +3005,10 @@ ipa-cp.o : ipa-cp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(TREE_FLOW_H) \
$(TREE_PASS_H) $(FLAGS_H) $(TIMEVAR_H) $(DIAGNOSTIC_H) $(TREE_DUMP_H) \
$(TREE_INLINE_H) $(FIBHEAP_H) $(PARAMS_H) tree-pretty-print.h
+ipa-split.o : ipa-split.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TREE_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(TREE_FLOW_H) \
+ $(TREE_PASS_H) $(FLAGS_H) $(TIMEVAR_H) $(DIAGNOSTIC_H) $(TREE_DUMP_H) \
+ $(TREE_INLINE_H) $(FIBHEAP_H) $(PARAMS_H)
matrix-reorg.o : matrix-reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(RTL_H) $(TREE_INLINE_H) $(TREE_FLOW_H) \
tree-flow-inline.h langhooks.h $(HASHTAB_H) $(TOPLEV_H) $(FLAGS_H) $(GGC_H) \
@@ -3082,7 +3124,8 @@ tree-ssa-ccp.o : tree-ssa-ccp.c $(TREE_FLOW_H) $(CONFIG_H) \
tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) coretypes.h alloc-pool.h \
$(TM_H) $(TREE_H) $(GIMPLE_H) $(CGRAPH_H) $(TREE_FLOW_H) $(IPA_PROP_H) \
$(DIAGNOSTIC_H) statistics.h $(TREE_DUMP_H) $(TIMEVAR_H) $(PARAMS_H) \
- $(TARGET_H) $(FLAGS_H) $(EXPR_H) tree-pretty-print.h
+ $(TARGET_H) $(FLAGS_H) $(EXPR_H) tree-pretty-print.h $(DBGCNT_H) \
+ $(TREE_INLINE_H)
tree-switch-conversion.o : tree-switch-conversion.c $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \
@@ -3156,10 +3199,10 @@ cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TREE_DUMP_H) $(EXCEPT_H) langhooks.h $(TREE_PASS_H) $(RTL_H) \
$(DIAGNOSTIC_H) $(TOPLEV_H) $(BASIC_BLOCK_H) $(FLAGS_H) debug.h $(PARAMS_H) \
value-prof.h $(TREE_INLINE_H) $(TARGET_H) $(SSAEXPAND_H) \
- tree-pretty-print.h gimple-pretty-print.h $(BITMAP_H) sbitmap.h
-cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+ tree-pretty-print.h gimple-pretty-print.h $(BITMAP_H) sbitmap.h $(INSN_ATTR_H)
+cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
$(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
- output.h $(TOPLEV_H) $(FUNCTION_H) $(EXCEPT_H) $(TM_P_H) $(INSN_ATTR_H) \
+ output.h $(FUNCTION_H) $(EXCEPT_H) $(TM_P_H) $(INSN_ATTR_H) \
insn-config.h $(EXPR_H) \
$(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \
$(TREE_PASS_H) $(DF_H) $(GGC_H)
@@ -3223,13 +3266,13 @@ bitmap.o : bitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) $(GGC_H) gt-bitmap.h $(BITMAP_H) $(OBSTACK_H) $(HASHTAB_H)
vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(VEC_H) $(GGC_H) \
$(TOPLEV_H) $(HASHTAB_H)
-reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
$(FLAGS_H) output.h $(EXPR_H) $(OPTABS_H) reload.h $(RECOG_H) \
- hard-reg-set.h insn-config.h $(REGS_H) $(FUNCTION_H) real.h $(TOPLEV_H) \
- addresses.h $(TM_P_H) $(PARAMS_H) $(TARGET_H) $(DF_H) ira.h
-reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+ hard-reg-set.h insn-config.h $(REGS_H) $(FUNCTION_H) real.h \
+ addresses.h $(TM_P_H) $(PARAMS_H) $(TARGET_H) $(DF_H) ira.h $(TOPLEV_H)
+reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
$(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.h \
- $(BASIC_BLOCK_H) $(RECOG_H) output.h $(FUNCTION_H) $(TOPLEV_H) $(TM_P_H) \
+ $(BASIC_BLOCK_H) $(RECOG_H) output.h $(FUNCTION_H) $(TM_P_H) \
addresses.h $(EXCEPT_H) $(TREE_H) $(FLAGS_H) $(MACHMODE_H) \
$(OBSTACK_H) $(DF_H) $(TARGET_H) $(EMIT_RTL_H) ira.h
rtlhooks.o : rtlhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
@@ -3276,7 +3319,7 @@ ira-build.o: ira-build.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
ira-costs.o: ira-costs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
hard-reg-set.h $(RTL_H) $(EXPR_H) $(TM_P_H) $(FLAGS_H) $(BASIC_BLOCK_H) \
$(REGS_H) addresses.h insn-config.h $(RECOG_H) $(TOPLEV_H) $(TARGET_H) \
- $(PARAMS_H) $(IRA_INT_H)
+ $(PARAMS_H) $(IRA_INT_H) reload.h
ira-conflicts.o: ira-conflicts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TARGET_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) $(TOPLEV_H) $(TM_P_H) $(PARAMS_H) \
@@ -3338,8 +3381,8 @@ sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(SCHED_INT_H) hard-reg-set.h $(BASIC_BLOCK_H) $(OBSTACK_H) \
$(TREE_PASS_H) $(INSN_ATTR_H)
sel-sched.o : sel-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
+ $(RTL_ERROR_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
+ $(FUNCTION_H) $(INSN_ATTR_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
$(TM_P_H) output.h $(TARGET_H) $(TIMEVAR_H) $(TREE_PASS_H) \
$(SCHED_INT_H) $(GGC_H) $(TREE_H) langhooks.h rtlhooks-def.h \
$(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) sel-sched.h $(DBGCNT_H) $(EMIT_RTL_H)
@@ -3355,21 +3398,21 @@ sel-sched-ir.o : sel-sched-ir.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TM_P_H) $(TARGET_H) $(TIMEVAR_H) $(TREE_PASS_H) $(SCHED_INT_H) $(GGC_H) \
$(TREE_H) langhooks.h rtlhooks-def.h $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) \
$(EMIT_RTL_H)
-final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
$(TREE_H) $(FLAGS_H) intl.h $(REGS_H) $(RECOG_H) conditions.h \
insn-config.h $(INSN_ATTR_H) $(FUNCTION_H) output.h hard-reg-set.h \
$(EXCEPT_H) debug.h xcoffout.h $(TOPLEV_H) reload.h dwarf2out.h \
$(TREE_PASS_H) $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) \
$(CFGLAYOUT_H) dbxout.h $(TIMEVAR_H) $(CGRAPH_H) $(COVERAGE_H) \
$(DF_H) vecprim.h $(GGC_H) $(CFGLOOP_H) $(PARAMS_H) $(TREE_FLOW_H)
-recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
$(FUNCTION_H) $(BASIC_BLOCK_H) $(REGS_H) $(RECOG_H) $(EXPR_H) \
- $(FLAGS_H) insn-config.h $(INSN_ATTR_H) $(TOPLEV_H) output.h reload.h \
+ $(FLAGS_H) insn-config.h $(INSN_ATTR_H) output.h reload.h \
addresses.h $(TM_P_H) $(TIMEVAR_H) $(TREE_PASS_H) hard-reg-set.h \
- $(DF_H) $(DBGCNT_H) $(TARGET_H)
+ $(DF_H) $(DBGCNT_H) $(TARGET_H) $(TOPLEV_H)
reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
- insn-config.h $(TOPLEV_H) reload.h $(FUNCTION_H) $(TM_P_H) $(GGC_H) \
+ $(RTL_ERROR_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
+ insn-config.h reload.h $(FUNCTION_H) $(TM_P_H) $(GGC_H) \
$(BASIC_BLOCK_H) $(CFGLAYOUT_H) output.h $(TIMEVAR_H) \
$(TREE_PASS_H) $(TARGET_H) vecprim.h $(DF_H) $(EMIT_RTL_H)
sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) sreal.h
@@ -3401,9 +3444,9 @@ regcprop.o : regcprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
output.h $(RECOG_H) $(FUNCTION_H) $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \
addresses.h reload.h $(TOPLEV_H) $(TIMEVAR_H) $(TREE_PASS_H) $(DF_H)
regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
+ $(RTL_ERROR_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
output.h $(RECOG_H) $(FUNCTION_H) $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \
- addresses.h reload.h $(TOPLEV_H) $(TIMEVAR_H) $(TREE_PASS_H) $(DF_H)
+ addresses.h reload.h $(TIMEVAR_H) $(TREE_PASS_H) $(DF_H)
ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) $(TOPLEV_H) $(FLAGS_H) insn-config.h $(FUNCTION_H) $(RECOG_H) \
$(TARGET_H) $(BASIC_BLOCK_H) $(EXPR_H) output.h $(EXCEPT_H) $(TM_P_H) \
@@ -3499,6 +3542,7 @@ insn-emit.o : insn-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
dfp.h $(FLAGS_H) output.h insn-config.h hard-reg-set.h $(RECOG_H) \
$(RESOURCE_H) reload.h $(TOPLEV_H) $(REGS_H) tm-constrs.h $(GGC_H) \
$(BASIC_BLOCK_H) $(INTEGRATE_H)
+insn-enums.o : insn-enums.c $(CONFIG_H) $(SYSTEM_H)
insn-extract.o : insn-extract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TOPLEV_H) insn-config.h $(RECOG_H)
insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
@@ -3524,54 +3568,43 @@ insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
reload.h $(REGS_H) tm-constrs.h
# For each of the files generated by running a generator program over
-# the machine description, the following pair of static pattern rules
-# runs the generator program only if the machine description has changed,
-# but touches the target file only when its contents actually change.
-# The "; @true" construct forces Make to recheck the timestamp on the
-# target file.
+# the machine description, the following static pattern rules run the
+# generator program only if the machine description has changed,
+# but touch the target file only when its contents actually change.
+# The "; @true" construct forces Make to recheck the timestamp on
+# the target file.
-simple_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h
+simple_rtl_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h
-simple_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
- insn-extract.c insn-opinit.c insn-output.c \
- insn-peep.c insn-recog.c
+simple_rtl_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
+ insn-extract.c insn-opinit.c insn-output.c \
+ insn-peep.c insn-recog.c
+
+simple_generated_h = $(simple_rtl_generated_h) insn-constants.h
+
+simple_generated_c = $(simple_rtl_generated_c) insn-enums.c
+
+$(simple_generated_h:insn-%.h=s-%) \
+$(simple_generated_c:insn-%.c=s-%): s-%: $(MD_DEPS)
+
+$(simple_rtl_generated_h:insn-%.h=s-%) \
+$(simple_rtl_generated_c:insn-%.c=s-%): s-%: insn-conditions.md
$(simple_generated_h): insn-%.h: s-%; @true
-$(simple_generated_h:insn-%.h=s-%): s-%: build/gen%$(build_exeext) \
- $(MD_DEPS) insn-conditions.md
+$(simple_generated_h:insn-%.h=s-%): s-%: build/gen%$(build_exeext)
$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
- insn-conditions.md > tmp-$*.h
+ $(filter insn-conditions.md,$^) > tmp-$*.h
$(SHELL) $(srcdir)/../move-if-change tmp-$*.h insn-$*.h
$(STAMP) s-$*
$(simple_generated_c): insn-%.c: s-%; @true
-$(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) \
- $(MD_DEPS) insn-conditions.md
+$(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
- insn-conditions.md > tmp-$*.c
+ $(filter insn-conditions.md,$^) > tmp-$*.c
$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
$(STAMP) s-$*
-generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
- $(simple_generated_h) specs.h \
- tree-check.h genrtl.h insn-modes.h tm-preds.h tm-constrs.h \
- $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h
-
-# In order for parallel make to really start compiling the expensive
-# objects from $(OBJS-common) as early as possible, build all their
-# prerequisites strictly before all objects.
-$(ALL_HOST_OBJS) : | $(generated_files)
-
-# genconstants needs to run before insn-conditions.md is available
-# (because the constants may be used in the conditions).
-insn-constants.h: s-constants; @true
-s-constants: build/genconstants$(build_exeext) $(MD_DEPS)
- $(RUN_GEN) build/genconstants$(build_exeext) $(md_file) \
- > tmp-constants.h
- $(SHELL) $(srcdir)/../move-if-change tmp-constants.h insn-constants.h
- $(STAMP) s-constants
-
# gencheck doesn't read the machine description, and the file produced
# doesn't use the insn-* convention.
tree-check.h: s-check ; @true
@@ -3642,6 +3675,36 @@ s-constrs-h: $(MD_DEPS) build/genpreds$(build_exeext)
$(SHELL) $(srcdir)/../move-if-change tmp-constrs.h tm-constrs.h
$(STAMP) s-constrs-h
+target-hooks-def.h: s-target-hooks-def-h; @true
+tm.texi: s-tm-texi; @true
+
+s-target-hooks-def-h: build/genhooks$(build_exeext)
+ $(RUN_GEN) build/genhooks$(build_exeext) > tmp-target-hooks-def.h
+ $(SHELL) $(srcdir)/../move-if-change tmp-target-hooks-def.h \
+ target-hooks-def.h
+ $(STAMP) s-target-hooks-def-h
+
+# check if someone mistakenly only changed tm.texi.
+s-tm-texi: $(srcdir)/doc/tm.texi
+
+s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
+ $(RUN_GEN) build/genhooks$(build_exeext) \
+ $(srcdir)/doc/tm.texi.in > tmp-tm.texi
+ $(SHELL) $(srcdir)/../move-if-change tmp-tm.texi tm.texi
+ @if cmp -s $(srcdir)/doc/tm.texi tm.texi; then \
+ $(STAMP) $@; \
+ elif test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/tm.texi.in \
+ && test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/target.def; then \
+ echo >&2 ; \
+ echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \
+ false; \
+ else \
+ echo >&2 ; \
+ echo Verify that you have permission to grant a GFDL license for all >&2 ; \
+ echo new text in tm.texi, then copy it to $(srcdir)/doc/tm.texi. >&2 ; \
+ false; \
+ fi
+
GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/vecprim.h $(srcdir)/vecir.h \
$(host_xm_file_list) \
@@ -3721,6 +3784,16 @@ s-gtype: build/gengtype$(build_exeext) $(filter-out [%], $(GTFILES)) \
$(RUN_GEN) build/gengtype$(build_exeext) $(srcdir) gtyp-input.list
$(STAMP) s-gtype
+generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
+ $(simple_generated_h) specs.h \
+ tree-check.h genrtl.h insn-modes.h tm-preds.h tm-constrs.h \
+ $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h
+
+# In order for parallel make to really start compiling the expensive
+# objects from $(OBJS-common) as early as possible, build all their
+# prerequisites strictly before all objects.
+$(ALL_HOST_OBJS) : | $(generated_files)
+
#
# How to compile object files to run on the build machine.
@@ -3733,15 +3806,18 @@ build/%.o : # dependencies provided by explicit rule later
build/errors.o : errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h
build/gensupport.o: gensupport.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) errors.h $(HASHTAB_H) \
- gensupport.h
+ $(READ_MD_H) gensupport.h
build/ggc-none.o : ggc-none.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(GGC_H)
build/min-insn-modes.o : min-insn-modes.c $(BCONFIG_H) $(SYSTEM_H) \
$(MACHMODE_H)
build/print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(GTM_H) $(RTL_BASE_H)
+build/read-md.o: read-md.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(HASHTAB_H) errors.h $(READ_MD_H)
build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
- $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H) gensupport.h
+ $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H) $(READ_MD_H) \
+ gensupport.h
build/rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) \
$(RTL_H) $(GGC_H) errors.h
build/vec.o : vec.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(VEC_H) \
@@ -3759,10 +3835,10 @@ build/gencondmd.o : \
# ...these are the programs themselves.
build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GTM_H) errors.h gensupport.h
+ coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
build/genattrtab.o : genattrtab.c $(RTL_BASE_H) $(OBSTACK_H) \
$(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(GGC_H) \
- gensupport.h
+ $(READ_MD_H) gensupport.h vecprim.h
build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H) \
$(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(VEC_H) \
$(HASHTAB_H) gensupport.h
@@ -3772,17 +3848,21 @@ build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H)
build/gencodes.o : gencodes.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
build/genconditions.o : genconditions.c $(RTL_BASE_H) $(BCONFIG_H) \
- $(SYSTEM_H) coretypes.h $(GTM_H) errors.h
+ $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(HASHTAB_H) $(READ_MD_H) \
+ gensupport.h
build/genconfig.o : genconfig.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
-build/genconstants.o : genconstants.c $(RTL_BASE_H) $(BCONFIG_H) \
- $(SYSTEM_H) coretypes.h $(GTM_H) errors.h
+build/genconstants.o : genconstants.c $(BCONFIG_H) $(SYSTEM_H) \
+ coretypes.h errors.h $(READ_MD_H)
build/genemit.o : genemit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GTM_H) errors.h gensupport.h
+ coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
+build/genenums.o : genenums.c $(BCONFIG_H) $(SYSTEM_H) \
+ coretypes.h errors.h $(READ_MD_H)
build/genextract.o : genextract.c $(RTL_BASE_H) $(BCONFIG_H) \
- $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h vecprim.h
+ $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h \
+ vecprim.h
build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H) \
- $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
+ $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
build/gengtype-lex.o : gengtype-lex.c gengtype.h $(BCONFIG_H) $(SYSTEM_H)
build/gengtype-parse.o : gengtype-parse.c gengtype.h $(BCONFIG_H) \
@@ -3790,19 +3870,20 @@ build/gengtype-parse.o : gengtype-parse.c gengtype.h $(BCONFIG_H) \
build/gengtype.o : gengtype.c $(BCONFIG_H) $(SYSTEM_H) gengtype.h \
rtl.def insn-notes.def errors.h double-int.h $(HASHTAB_H)
build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
- $(GTM_H) $(RTL_BASE_H) errors.h gensupport.h
+ errors.h $(READ_MD_H)
build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h \
$(HASHTAB_H) machmode.def $(extra_modes_file)
build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GTM_H) errors.h gensupport.h
+ coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
build/genpeep.o : genpeep.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h $(TOPLEV_H)
build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GTM_H) errors.h gensupport.h $(OBSTACK_H)
+ coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h $(OBSTACK_H)
build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GTM_H) errors.h gensupport.h
+ coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
+build/genhooks.o : genhooks.c target.def $(BCONFIG_H) $(SYSTEM_H) errors.h
# Compile the programs that generate insn-* from the machine description.
# They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
@@ -3814,19 +3895,25 @@ build/gen%$(build_exeext): build/gen%.o $(BUILD_LIBDEPS)
$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
$(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
-# All these programs use the MD reader ($(BUILD_RTL)).
-genprogmd = attr attrtab automata codes conditions config constants emit \
- extract flags mddeps opinit output peep preds recog
-$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_ERRORS)
+# All these programs use the RTL reader ($(BUILD_RTL)).
+genprogrtl = attr attrtab automata codes conditions config emit \
+ extract flags opinit output peep preds recog
+$(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)
+
+# All these programs use the MD reader ($(BUILD_MD)).
+genprogmd = $(genprogrtl) mddeps constants enums
+$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_MD)
+
+# All generator programs need to report errors
+genprog = $(genprogmd) genrtl modes gtype
+$(genprog:%=build/gen%$(build_exeext)): $(BUILD_ERRORS)
# These programs need libs over and above what they get from the above list.
build/genautomata$(build_exeext) : BUILD_LIBS += -lm
# These programs are not linked with the MD reader.
-build/gengenrtl$(build_exeext) : $(BUILD_ERRORS)
-build/genmodes$(build_exeext) : $(BUILD_ERRORS)
-build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o \
- $(BUILD_ERRORS)
+build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o
+build/genhooks$(build_exeext) : $(BUILD_ERRORS)
# Generated source files for gengtype.
gengtype-lex.c : gengtype-lex.l
@@ -4365,7 +4452,7 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(host_xm_file_list) $(host_xm_include_list) $(xm_include_list) \
intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) $(C_COMMON_H) $(C_PRETTY_PRINT_H) \
tree-iterator.h $(PLUGIN_H) $(TREE_FLOW_H) langhooks.h incpath.h debug.h \
- except.h tree-ssa-sccvn.h real.h output.h $(IPA_UTILS_H) \
+ $(EXCEPT_H) tree-ssa-sccvn.h real.h output.h $(IPA_UTILS_H) \
$(C_PRAGMA_H) $(CPPLIB_H) $(FUNCTION_H) \
cppdefault.h flags.h $(MD5_H) params.def params.h prefix.h tree-inline.h \
$(IPA_PROP_H) $(RTL_H) $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) version.h
@@ -4967,7 +5054,7 @@ TAGS: lang.tags
incs="$$incs --include $$dir/TAGS.sub"; \
fi; \
done; \
- etags -o TAGS.sub *.h *.c; \
+ etags -o TAGS.sub c-family/*.h c-family/*.c *.h *.c; \
etags --include TAGS.sub $$incs)
# -----------------------------------------------------
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3340a4e6997..98680a8ab03 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,3143 @@
+2010-06-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * gcc-interface/trans.c: Do not include tree-flow.h.
+ * gcc-interface/Make-lang.in: Adjust dependencies.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * gcc-interface/gigi.h (gnat_build_constructor): Take a VEC instead
+ of a TREE_LIST. Update comment.
+ * gcc-interface/trans.c (gigi): Build a VEC instead of a TREE_LIST.
+ Adjust call to gnat_build_constructor.
+ (Attribute_to_gnu): Likewise.
+ (gnat_to_gnu): Likewise.
+ (pos_to_constructor): Likewise.
+ (extract_values): Likewise.
+ * gcc-interface/utils.c (build_template): Likewise.
+ (convert_vms_descriptor64): Likewise.
+ (convert_vms_descriptor32): Likewise.
+ (convert_to_fat_pointer): Likewise.
+ (convert): Likewise.
+ (unchecked_convert): Likewise.
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise.
+ * gcc-interface/utils2.c (build_allocator): Likewise.
+ (fill_vms_descriptor): Likewise.
+ (gnat_build_constructor): Take a VEC instead of a TREE_LIST.
+ (compare_elmt_bitpos): Adjust for parameters being constructor_elts
+ instead of TREE_LISTs.
+
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * gcc-interface/misc.c: Do not include except.h.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c: Include tree-flow.h.
+ (gnu_switch_label_stack): Delete.
+ (Case_Statement_to_gnu): Do not emit the goto at the end of a case if
+ its associated block cannot fall through. Do not emit the final label
+ if no cases branch to it.
+ * gcc-interface/Make-lang.in (ada/trans.o): Add $(TREE_FLOW_H).
+
+2010-06-23 Thomas Quinot <quinot@adacore.com>
+
+ * exp_attr.adb (Expand_Access_To_Protected_Op): When rewriting a
+ reference to a protected subprogram outside of the protected's scope,
+ ensure the corresponding external subprogram is frozen before the
+ reference.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb: Fix typo in error message.
+ * sem.adb: Refine previous change.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * impunit.adb, a-suewen.adb, a-suewen.ads, a-suenco.adb, a-suenco.ads,
+ a-suezen.adb, a-suezen.ads, a-stuten.adb, a-stuten.ads, Makefile.rtl:
+ Implement Ada 2012 string encoding packages.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * a-stwiun-shared.adb, a-stwiun-shared.ads, a-stzunb-shared.adb,
+ a-stzunb-shared.ads, a-swunau-shared.adb, a-swuwti-shared.adb,
+ a-szunau-shared.adb, a-szuzti-shared.adb, a-strunb-shared.adb,
+ a-strunb-shared.ads, a-stunau-shared.adb, a-suteio-shared.adb: New
+ files.
+ * gcc-interface/Makefile.in: Enable use of above files.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch13.adb (Check_Constant_Address_Clauses): Do not check legality
+ of address clauses if if Ignore_Rep_Clauses is active.
+ * freeze.adb (Check_Address_Clause): If Ignore_Rep_Clauses is active,
+ remove address clause from tree so that it does not reach the backend.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Valid]): Do not
+ expand 'Valid from user code in CodePeer mode, will be handled by the
+ back-end directly.
+
+2010-06-23 Bob Duff <duff@adacore.com>
+
+ * g-comlin.ads: Minor comment improvements.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Uses_SS): The expression that initializes a controlled
+ component of a record type may be a user-defined operator that is
+ rewritten as a function call.
+
+2010-06-23 Bob Duff <duff@adacore.com>
+
+ * g-comlin.ads, sem_ch13.adb: Minor comment fix.
+
+2010-06-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch11.adb (Expand_Local_Exception_Handlers): Propagate the end
+ label to the new sequence of statements. Set the sloc of the raise
+ statement onto the new goto statements.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * a-stuten.ads, a-stuten.adb: New files.
+ * impunit.adb: Add engtry for Ada.Strings.UTF_Encoding (a-stuten.ads)
+ * Makefile.rtl: Add entry for a-stuten (Ada.Strings.UTF_Encoding)
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Add documentation of -gnat12 switch
+ Add documentation of -gnatX switch.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * inline.ads: Include the current Ada_Version in the info for pending
+ instance bodies, so that declaration and body are compiled with the
+ same Ada_Version.
+ * inline.adb: Move with_clause for Opt to spec.
+ * sem_ch12.adb (Analyze_Package_Instantiation,
+ Analyze_Subprogram_Instantiation): Save current Ada_Version in
+ Pending_Instantiation information.
+ (Instantiate_Package_Body, Instantiate_Subprogram_Body,
+ Inline_Package_Body): Use the Ada_Version present in the body
+ information.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * usage.adb: Add documentation for -gnat12 switch.
+ * errout.ads: Add VMS alias entry for -gnat12 switch
+ * gnat_rm.texi: Add documentation for pragma Ada_12 and Ada_2012
+ Add documentation for pragma Extensions_Allowed.
+ * opt.ads: Add entry for Ada 2012 mode.
+ * sem_ch4.adb, par-ch3.adb, par-ch4.adb: Use new Ada 2012 mode for 2012
+ features.
+ * sem_prag.adb, par-prag.adb: Add processing for pragma Ada_12 and
+ Ada_2012.
+ * sem_ch13.adb: Add handling for Ada 2012 mode.
+ * snames.ads-tmpl: Add entries for pragma Ada_2012 and Ada_12.
+ * switch-c.adb: Add handling for -gnat12 switch.
+ Implement -gnat2005 and -gnat2012.
+ * usage.adb: Add documentation for -gnat12 switch.
+ * vms_data.ads: Add /12 switch for Ada 2012 mode.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Allocator): Fix potential crash when using
+ No_Task_Hierarchy restriction. Add comment.
+ * exp_ch9.adb, exp_ch3.adb: Update comments.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch5.adb (Process_Bounds): Remove some junk initializations.
+ * sem_res.adb: Add comments.
+ * sem_util.adb: Minor reformatting. Add comments.
+ Change increment on Actuals_In_Call table.
+ * opt.ads: Minor: add 'constant'.
+
+2010-06-23 Javier Miranda <miranda@adacore.com>
+
+ * exp_disp.adb (Make_DT): Initialize the Size_Func component of the
+ TSD to Null_Address if No_Dispatching_Calls is active.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ * a-comlin.ads: Indicate that use of this package is not supported
+ during the elaboration of an auto-initialized Stand-Alone Library.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_util.adb (Is_Possibly_Misaligned_Object): Do not rely on an
+ alignment clause on a record type to determine if a component may be
+ misaligned. The decision must be taken in the back-end where target
+ alignment information is known.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat1drv.adb (Adjust_Global_Switches): Enable some restrictions
+ systematically in CodePeer mode to simplify generated code.
+ * restrict.adb (Check_Restriction): Do nothing in CodePeer mode.
+ * exp_ch4.adb (Expand_N_Allocator): Generate proper code when
+ No_Task_Hierarchy is set instead of crasshing.
+
+2010-06-23 Thomas Quinot <quinot@adacore.com>
+
+ * sem_util.adb: Minor code cleanup: test for proper entity instead of
+ testing just Chars attribute when checking whether a given scope is
+ System.
+ * exp_ch4.adb, einfo.adb: Minor reformatting.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ PR ada/44633
+ * switch-m.adb (Normalize_Compiler_Switches): Take into account
+ switches -gnatB, -gnatD=nn, -gnatG (incuding -gnatG=nn), -gnatI,
+ -gnatl=file, -gnatS, -gnatjnn, -gnateI=nn and -gnatWx.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Membership_Op): If left operand is a mixed mode
+ operation with a universal real operand, and the right operand is a
+ range with universal bounds, find unique fixed point that may be
+ candidate, and warn appropriately.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Intrinsic_Operator): Add guards to handle
+ properly the rare cases where VMS operators are visible through
+ Extend_System, but the default System is being used and Address is a
+ private type.
+ * sem_util.adb: Widen predicate Is_VMS_Operator.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ * switch-m.adb (Normalize_Compiler_Switches): Take into account -gnatC
+ and -gnateS.
+
+2010-06-23 Olivier Hainque <hainque@adacore.com>
+
+ * einfo.adb (Has_Foreign_Convention): Consider Intrinsic with
+ Interface_Name as foreign. These are GCC builtin imports for
+ which Ada specific processing doesn't apply.
+
+2010-06-23 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch12.adb: Minor reformatting.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Is_VMS_Operator): Use scope of system extension to
+ determine whether an intrinsic subprogram is VMS specific.
+
+2010-06-23 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * treepr.adb (Print_Entity_Info): Output the contents of Field28 if it
+ is present in the entity.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * xr_tabls.adb, xref_lib.adb: Update to latest lib-xref.ads
+ Fix handling of parameters.
+ Add protection against unexpected cases.
+ * sem_ch6.adb (Create_Extra_Formals): Use suffix "L" instead of "A" for
+ access level, since "A" suffix is already used elsewhere. Similarly,
+ use suffix "O" instead of "C" for 'Constrained since "C" suffix is used
+ for xxx'Class.
+
+2010-06-23 Thomas Quinot <quinot@adacore.com>
+
+ * sem_util.adb, sem_util.ads: Minor reformatting.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ * prj.ads (Gprclean_Flags.Missing_Source_Files): Set to Error to keep
+ the previous behavior of gprclean when there are missing files.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Load_Body_Of_Generic): In CodePeer mode, a missing
+ generic body is not a fatal error.
+ (Mark_Context): Handle properly names of child units.
+ * sem.adb (Walk_Library_Items.Do_Action): Remove assertion on
+ instantiations.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ * ali.adb (Scan_ALI): When ignoring R lines, do not skip the next
+ non-empty line.
+
+2010-06-23 Bob Duff <duff@adacore.com>
+
+ * g-pehage.ads, g-pehage.adb: Switch default optimization mode to
+ Memory_Space, because CPU_Time doesn't seem to provide any significant
+ speed advantage in practice. Cleanup: Get rid of constant
+ Default_Optimization; doesn't seem to add anything. Use case
+ statements instead of if statements; seems cleaner.
+
+2010-06-23 Olivier Hainque <hainque@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Procedure>: Use
+ Wshadow instead of Wextra to guard warning on absence of internal
+ builtin decl for an import. Fix use of quote in warning text.
+ (intrin_arglists_compatible_p): Remove processing of integer trailing
+ args on the Ada side. Fix use of literal > in warning text.
+ (intrin_return_compatible_p): Never warn on "function imported as
+ procedure". Defer the void/void case to the common type compatibility
+ check.
+ (gnat_to_gnu_param): Use void_ptr GCC type for System.Address argument
+ of GCC builtin imports.
+
+2010-06-23 Olivier Hainque <hainque@adacore.com>
+
+ * gcc-interface/decl.c (intrin_types_incompatible_p): New function,
+ helper for ...
+ (intrin_arglists_compatible_p, intrin_return_compatible_p): New
+ functions, helpers for ...
+ (intrin_profiles_compatible_p): New function, replacement for ...
+ (compatible_signatures_p): Removed.
+ (gnat_to_gnu_entity) <case E_Procedure>: If -Wextra, warn on
+ attempt to bind an unregistered builtin function. When we have
+ one, use it and warn on profile incompatibilities.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Mark_Coextensions): If the expression in the allocator
+ for a coextension in an object declaration is a concatenation, treat
+ coextension as dynamic.
+
+2010-06-23 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Add_Internal_Interface_Entities): Ensure that the
+ internal entities are added to the scope of the tagged type.
+ (Derive_Subprograms): Do not stop derivation when we find the first
+ internal entity that has attribute Interface_Alias. After the change
+ done to Override_Dispatching_Operations it is no longer true that
+ these primirives are always located at the end of the list of
+ primitives.
+ * einfo.ads (Primitive_Operations): Add documentation.
+ * exp_disp.adb (Write_DT): Improve output adding to the name of the
+ primitive a prefix indicating its corresponding tagged type.
+ * sem_disp.adb (Override_Dispatching_Operations): If the overridden
+ entity covers the primitive of an interface that is not an ancestor of
+ this tagged type then the new primitive is added at the end of the list
+ of primitives. Required to fulfill the C++ ABI.
+
+2010-06-23 Javier Miranda <miranda@adacore.com>
+
+ * atree.ads (Set_Reporting_Proc): New subprogram.
+ * atree.adb: Remove dependency on packages Opt and SCIL_LL.
+ (Allocate_Initialize_Node, Replace, Rewrite): Replace direct calls
+ to routines of package Scil_ll by indirect call to the registered
+ subprogram.
+ (Set_Reporting_Proc): New subprogram. Used to register a subprogram
+ that is invoked when a node is allocated, replaced or rewritten.
+ * scil_ll.adb (Copy_SCIL_Node): New routine that takes care of copying
+ the SCIL node. Used as argument for Set_Reporting_Proc.
+ (Initialize): Register Copy_SCIL_Node as the reporting routine that
+ is invoked by atree.
+
+2010-06-23 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.ads: Minor reformatting.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Analyze_Package_Instantiation): In CodePeer mode,
+ always analyze the generic body and instance, because it may be needed
+ downstream.
+ (Mark_Context): Prepend the with clauses for needed generic units, so
+ they appear in a better order for CodePeer.
+ * sem_util.adb, sem_util.ads: Prototype code for AI05-0144.
+
+2010-06-23 Emmanuel Briot <briot@adacore.com>
+
+ * prj.ads, prj-nmsc.adb (Error_Or_Warning): New subprogram.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * g-pehage.adb, exp_ch13.adb: Minor reformatting.
+
+2010-06-23 Thomas Quinot <quinot@adacore.com>
+
+ * a-tags.ads: Fix description of TSD structure.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Mark_Context): When indicating that the body of a
+ generic unit is needed prior to the unit containing an instantiation,
+ search recursively the context of the generic to add other generic
+ bodies that may be instantiated indirectly through the current instance.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb: Minor reformatting.
+
+2010-06-23 Bob Duff <duff@adacore.com>
+
+ * g-pehage.adb (Trim_Trailing_Nuls): Fix the code to match the comment.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Compile_Sources): Complete previous change.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Add_Extra_Formal): Use suffix "C" in the name of the
+ Constrained extra formal.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch13.adb (Expand_Freeze_Actions): If validity checks and
+ Initialize_Scalars are enabled, compile the generated equality function
+ for a composite type with full checks enabled, so that validity checks
+ are performed on individual components.
+
+2010-06-23 Emmanuel Briot <briot@adacore.com>
+
+ * prj.adb, prj.ads, prj-nmsc.adb (Processing_Flags): New flag
+ Missing_Source_Files.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch3.adb, exp_util.adb: Minor reformatting.
+
+2010-06-23 Jose Ruiz <ruiz@adacore.com>
+
+ * a-reatim.adb, a-retide.adb: Move the initialization of the tasking
+ run time from Ada.Real_Time.Delays to Ada.Real_Time. This way, calls to
+ Clock (without delays) use a run time which is properly initialized.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ * make.adb: Do not set Check_Readonly_Files when setting Must_Compile,
+ when -f -u and a main is specified on the command line. However,
+ attempt to compile even when the ALI file is read-only when
+ Must_Compile is True.
+
+2010-06-23 Thomas Quinot <quinot@adacore.com>
+
+ * checks.adb, g-pehage.adb, cstand.adb: Minor code factorization.
+
+2010-06-23 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Add_Internal_Interface_Entities): Generate internal
+ entities for parent types that are interfaces. Needed in generics to
+ handle formals that implement interfaces.
+ (Derive_Subprograms): Add assertion for derivation of tagged types that
+ do not cover interfaces. For generics, complete code that handles
+ derivation of type that covers interfaces because the previous
+ condition was weak (it required only name consistency; arguments were
+ not checked). Add new code to locate primitives covering interfaces
+ defined in generic units or instantiatons.
+ * sem_util.adb (Has_Interfaces): Add missing support for derived types.
+ * sem_ch6.adb (Check_Overriding_Indicator): Minor code cleanups.
+ * exp_disp.adb (Make_Select_Specific_Data_Table): Skip primitives of
+ interfaces that are parents of the type because they share the primary
+ dispatch table.
+ (Register_Primitive): Do not register primitives of interfaces that
+ are parents of the type.
+ * sem_ch13.adb (Analyze_Freeze_Entity): Add documentation.
+ * exp_cg.adb (Write_Type_Info): When displaying overriding of interface
+ primitives skip primitives of interfaces that are parents of the type.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Eval_Attribute): If the prefix is an array, the
+ attribute cannot be constant-folded if an index type is a formal type,
+ or is derived from one.
+ * checks.adb (Determine_Range): ditto.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat_ugn.texi, gnatxref.adb: Add support for --ext switch.
+
+2010-06-23 Bob Duff <duff@adacore.com>
+
+ * g-pehage.ads, g-pehage.adb (Put): Fix off-by-one bug.
+ (Insert): Disallow nul characters.
+ (misc output routines): Assert no nul characters.
+
+2010-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb: Use predefined unsigned type in all cases.
+
+2010-06-23 Bob Duff <duff@adacore.com>
+
+ * s-rannum.adb (Reset): Avoid overflow in calculation of Initiator.
+ * g-pehage.ads: Minor comment fixes.
+ * g-pehage.adb: Minor: Add some additional debugging printouts under
+ Verbose flag.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * binde.adb (Better_Choice): Always prefer Pure/Preelab.
+ (Worse_Choice): Always prefer Pure/Preelab.
+
+2010-06-23 Vincent Celier <celier@adacore.com>
+
+ * a-reatim.adb: Call System.OS_Primitives.Initialize during elaboration
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Properly handle
+ checking returns in generic case.
+ (Check_Missing_Return): New procedure.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * bindgen.adb, switch-b.adb: Minor reformatting.
+
+2010-06-23 Javier Miranda <miranda@adacore.com>
+
+ * frontend.adb (Frontend): Add call to initialize the new package
+ SCIL_LL.
+ * exp_ch7.adb (Wrap_Transient_Expression): Remove call to
+ Adjust_SCIL_Node.
+ (Wrap_Transient_Statement): Remove call to Adjust_SCIL_Node.
+ * sem_ch5.adb (Analyze_Iteration_Scheme.Process_Bounds): Remove call to
+ Adjust_SCIL_Node.
+ * exp_util.adb (Insert_Actions): Remove code for
+ N_SCIL_Dispatch_Table_Object_Init and N_SCIL_Tag_Init nodes.
+ (Remove_Side_Effects): Remove calls to Adjust_SCIL_Node.
+ * sinfo.adb (SCIL_Entity, SCIL_Tag_Value): Remove checks on
+ N_SCIL_Tag_Init and N_SCIL_Dispatch_Table_Object_Init in the assertion.
+ (SCIL_Related_Node, Set_SCIL_Related_Node): Removed.
+ * sinfo.ads (SCIL_Related_Node): Field removed.
+ (N_SCIL_Dispatch_Table_Object_Init): Node removed.
+ (N_SCIL_Tag_Init): Node removed.
+ * sem_scil.ads, sem_scil.adb (Adjust_SCIL_Node): Removed.
+ (Check_SCIL_Node): New implementation.
+ (Find_SCIL_Node): Removed.
+ * sem.adb (Analyze): Remove management of
+ N_SCIL_Dispatch_Table_Object_Init and N_SCIL_Tag_Init nodes.
+ * sem_util.adb (Insert_Explicit_Dereference): Remove call to
+ Adjust_SCIL_Node.
+ * exp_ch4.adb (Expand_N_In): Code cleanup: remove call to
+ Set_SCIL_Related_Node and avoid adding the SCIL node before the
+ referenced node using Insert_Action because this is not longer required.
+ (Expand_Short_Circuit_Operator): Remove call to SCIL node.
+ * exp_ch6.adb (Expand_Call): Remove call to Adjust_SCIL_Node.
+ * sem_ch4.adb (Analyze_Type_Conversion): Remove call to Adjust_SCIL_Node
+ * exp_disp.adb (Expand_Dispatching_Call): Minor code reorganization
+ because we no longer require to generate the SCIL node before the call.
+ (Make_DT): Remove generation of SCI_Dispatch_Table_Object_Init node.
+ Remove calls to Set_SCIL_Related_Node and avoid adding the SCIL
+ nodes before the referenced node using Insert_Action because this
+ is not longer required.
+ * atree.adb (Allocate_Initialize_Node, Replace, Rewrite): Add call to
+ update the SCIL_Node field.
+ * sprint.adb (Sprint_Node_Actual): Remove code for
+ N_SCIL_Dispatch_Table_Object_Init and N_SCIL_Tag_Init nodes.
+ * treepr.adb (Print_Node): Print the SCIL node field (if available).
+ * exp_ch3.adb (Build_Init_Procedure): Remove generation of
+ SCIL_Tag_Init nodes.
+ * scil_ll.ads, scil_ll.adb: New files.
+ * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Update
+ dependencies.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb: Minor reformatting.
+
+2010-06-23 Doug Rupp <rupp@adacore.com>
+
+ * bindusg.adb (Display): Write -Hnn line.
+ * bindgen.adb (Gen_Adainit_Ada): Write Heap_Size to binder file as
+ necessary.
+ * init.c (__gl_heap_size): Rename from __gl_no_malloc_64 and change
+ valid values to 32 and 64.
+ (GNAT$NO_MALLOC_64): Recognize TRUE, 1, FALSE, and 0 in addition to
+ ENABLE, DISABLE as valid settings.
+ * switch-b.adb (Scan_Binder_Switches): Process -Hnn switch.
+ * opt.ads (Heap_Size): New global variable.
+ * gcc-interface/utils2.c (maybe_wrap_malloc): Remove mostly redundant
+ TARGET_MALLOC64 check. Fix comment.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb, exp_ch4.adb, s-rannum.ads, sem.adb, sem_ch12.adb: Minor
+ reformatting. Add comments.
+ * errout.adb (Finalize): Properly adjust warning count when deleting
+ continuations.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * errout.adb (Finalize): Set Prev pointers.
+ (Finalize): Delete continuations for deletion by warnings off(str).
+ * erroutc.ads: Add Prev pointer to error message structure.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem.adb (Do_Unit_And_Dependents): If the spec of the main unit is a
+ child unit, examine context of parent units to locate instantiated
+ generics whose bodies may be needed.
+ * sem_ch12.adb: (Mark_Context): if the enclosing unit does not have a
+ with_clause for the instantiated generic, examine the context of its
+ parents, to set Withed_Body flag, so that it can be visited earlier.
+ * exp_ch4.adb (Expand_N_Op_Not): If this is a VMS operator applied to
+ an unsigned type, use a type of the proper size for the intermediate
+ value, to prevent alignment problems on unchecked conversion.
+
+2010-06-22 Geert Bosch <bosch@adacore.com>
+
+ * s-rannum.ads Change Generator type to be self-referential to allow
+ Random to update its argument. Use "in" mode for the generator in the
+ Reset procedures to allow them to be called from the Ada.Numerics
+ packages without tricks.
+ * s-rannum.adb: Use the self-referencing argument to get write access
+ to the internal state of the random generator.
+ * a-nudira.ads: Make Generator a derived type of
+ System.Random_Numbers.Generator.
+ * a-nudira.adb: Remove use of 'Unrestricted_Access.
+ Put subprograms in alpha order and add headers.
+ * g-mbdira.ads: Change Generator type to be self-referential.
+ * g-mbdira.adb: Remove use of 'Unrestricted_Access.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb: Minor reformatting
+ Minor code reorganization (use Nkind_In and Ekind_In).
+
+2010-06-22 Bob Duff <duff@adacore.com>
+
+ * gnat1drv.adb (Gnat1drv): Remove the messages that recommend using
+ -gnatc when a file is compiled that we cannot generate code for, not
+ helpful and confusing.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * switch-m.adb (Normalize_Compiler_Switches): Process correctly
+ switches -gnatknn.
+
+2010-06-22 Paul Hilfinger <hilfinger@adacore.com>
+
+ * s-rannum.adb: Replace constants with commented symbols.
+ * s-rannum.ads: Explain significance of the initial value of the data
+ structure.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * a-ngcoty.adb: Clarify comment.
+
+2010-06-22 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Return without
+ expansion for indexing packed arrays with small power-of-2 component
+ sizes when the target is AAMP.
+ (Expand_Packed_Element_Reference): Return without expansion for
+ indexing packed arrays with small power-of-2 component sizes when the
+ target is AAMP.
+
+2010-06-22 Geert Bosch <bosch@adacore.com>
+
+ * exp_ch4.adb (Expand_N_In): Do not substitute a valid check for X in
+ Float'Range.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * g-mbdira.adb, g-mbflra.adb, a-nuflra.adb, a-nudira.adb: Minor comment
+ updates.
+
+2010-06-22 Doug Rupp <rupp@adacore.com>
+
+ * system-vms.ads, system-vms-zcx.ads: Remove old unused VMS system
+ packages.
+ * system-vms_64.ads, system-vms-ia64.ads: Minor reformatting.
+ (pragma Ident): Add a default ident string in the private part.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * cstand.adb: Minor reformatting.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Build_And_Analyze_Renamed_Body): For expansion purposes,
+ recognize the Shift and Rotation intrinsics that are known to the
+ compiler but have no interface name.
+
+2010-06-22 Geert Bosch <bosch@adacore.com>
+
+ * a-ngcoty.adb ("*"): Rewrite complex multiplication to use proper
+ scaling in case of overflow or NaN results.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * cstand.adb: Complete previous change.
+ * g-dirope.ads: Add comment.
+ * s-stchop.adb, sfn_scan.adb: Minor reformatting.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * cstand.adb: Add tree nodes for pragma Pack on string types.
+
+2010-06-22 Javier Miranda <miranda@adacore.com>
+
+ * einfo.ads, einfo.adb (Last_Formal): New synthesized attribute.
+ * exp_util.adb (Find_Prim_Op): Use new attribute to locate the last
+ formal of a primitive.
+ * exp_disp.adb (Is_Predefined_Dispatching_Operation,
+ Is_Predefined_Dispatching_Alias): Use new attribute to locate the last
+ formal of a primitive.
+ * exp_cg.adb (Is_Predefined_Dispatching_Operation): Use new attribute
+ to obtain the last formal of a primitive.
+
+2010-06-22 Geert Bosch <bosch@adacore.com>
+
+ * sysdep.c, init.c, adaint.c, cstreams.c: Remove conditional code
+ depending on __EMX__ or MSDOS being defined.
+ * i-cstrea.ads, gnat_rm.texi: Remove mentions of OS/2, DOS and Xenix.
+ * a-excpol-abort.adb: Update comment indicating users of the file.
+ * xref_lib.adb, sfn_scan.adb: Remove mention of OS/2, replace NT by
+ Windows.
+ * env.c: Remove empty conditional for MSDOS.
+ * s-stchop.adb, g-dirope.ads, s-fileio.adb, osint.ads: Remove mention
+ of OS/2 in comment.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * s-rannum.adb: Minor reformatting.
+
+2010-06-22 Javier Miranda <miranda@adacore.com>
+
+ * sem_aux.adb, sem_aux.ads, sem_util.adb, sem_util.ads, sem_elim.adb,
+ exp_cg.adb: Minor code reorganization: Move routine Ultimate_Alias from
+ package Sem_Util to package Sem_Aux.
+
+2010-06-22 Javier Miranda <miranda@adacore.com>
+
+ * exp_disp.adb (Make_Secondary_DT, Make_DT): Minor code cleanup:
+ remove useless restriction on imported routines when building the
+ dispatch tables.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * cstand.adb (Create_Standard): Set Has_Pragma_Pack for standard string
+ types.
+
+2010-06-22 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch4.adb (Collect_Generic_Type_Ops): Protect code that handles
+ generic subprogram declarations to ensure proper context. Add missing
+ support for generic actuals.
+ (Try_Primitive_Operation): Add missing support for concurrent types that
+ have no Corresponding_Record_Type. Required to diagnose errors compiling
+ generics or when compiling with no code generation (-gnatc).
+ * sem_ch9.adb (Analyze_Protected_Type, Analyze_Task_Type): Do not build
+ the corresponding record type.
+ * sem_disp.ads, sem_disp.adb (Check_Dispatching_Operation): Complete
+ documentation. Do minimum decoration when processing a primitive of a
+ concurrent tagged type that covers interfaces. Required to diagnose
+ errors in the Object.Operation notation compiling generics or under
+ -gnatc.
+ * exp_ch9.ads, exp_ch9.adb (Build_Corresponding_Record): Add missing
+ propagation of attribute Interface_List to the corresponding record.
+ (Expand_N_Task_Type_Declaration): Code cleanup.
+ (Expand_N_Protected_Type_Declaration): Code cleanup.
+
+2010-06-22 Matthew Heaney <heaney@adacore.com>
+
+ * a-convec.adb, a-coinve.adb: Removed 64-bit types Int and UInt.
+
+2010-06-22 Paul Hilfinger <hilfinger@adacore.com>
+
+ * s-rannum.adb (Random_Float_Template): Replace with unbiased version
+ that is able to produce all representable floating-point numbers in the
+ unit interval. Remove template parameter Shift_Right, no longer used.
+ * gnat_rm.texi: Document the period of the pseudo-random number
+ generator under the description of its algorithm.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * exp_aggr.adb (Rewrite_Discriminant): Fix predicate used to identify
+ reference to discriminant (can be an expanded name as well as an
+ identifier).
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb: Clarify comment.
+
+2010-06-22 Geert Bosch <bosch@adacore.com>
+
+ * exp_imgv.adb (Expand_Image_Attribute): Treat ordinary fixed point
+ with decimal small as decimal types, avoiding floating-point arithmetic.
+ (Has_Decimal_Small): New function.
+ * einfo.ads, einfo.adb (Aft_Value): New synthesized attributed for
+ fixed point types.
+ * sem_attr.adb (Eval_Attribute): Remove Aft_Value function and update
+ callers to call the new function in Einfo that takes the entity as
+ parameter.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb, sem_ch8.adb: Minor reformatting.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_elab.adb: Minor reformatting.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * gnatsym.adb: Put the object files in the table in increasing
+ aphabetical order of base names.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Set_Entity_Or_Discriminal): New procedure used by
+ Find_Direct_Name and Find_Expanded_Name, to replace a discriminant with
+ the corresponding discriminal within a record declaration.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * exp_aggr.adb (Rewrite_Discriminant): Rewriting must occur only for an
+ expression referring to a discriminal of the type of the aggregate (not
+ a discriminal of some other unrelated type), and the prefix in the
+ generated selected component must come from Lhs, not Obj.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Record_Type): Fix predicate determining
+ when to freeze the parent type.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * s-rannum.adb, a-nudira.adb, types.ads, freeze.adb, sem_aggr.adb,
+ exp_aggr.adb: Minor reformatting.
+ * gnat_rm.texi: Document GNAT.MBBS_Discrete_Random and
+ GNAT.MBSS_Float_Random.
+ * g-mbdira.adb, g-mbflra.adb, g-mbdira.ads, g-mbflra.ads: Fix header.
+
+2010-06-22 Paul Hilfinger <hilfinger@adacore.com>
+
+ * a-nudira.adb, a-nudira.ads, a-nuflra.adb, a-nuflra.ads,
+ gnat_rm.texi, impunit.adb, Makefile.rtl, s-rannum.adb
+ (Random_Float_Template, Random): New method of creating
+ uniform floating-point variables that allow the creation of all machine
+ values in [0 .. 1).
+
+ * g-mbdira.adb, g-mbflra.adb, g-mbdira.ads, g-mbflra.ads: New file.
+
+2010-06-22 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch5.adb (Analyze_Assignment): Revise test for illegal assignment
+ to abstract targets to check that the type is tagged and comes from
+ source, rather than only testing for targets of interface types. Remove
+ premature return.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * vms_data.ads: Modify the declarations of qualifiers
+ /UNCHECKED_SHARED_LIB_IMPORTS to allow the generation of gnat.hlp
+ without error.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Is_Build_In_Place_Function): Predicate is false if
+ expansion is disabled.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * makeusg.adb: Minor reformatting.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * types.ads: (Dint): Removed, no longer used anywhere.
+ * uintp.adb (UI_From_CC): Use UI_From_Int, range is sufficient.
+ (UI_Mul): Avoid use of UI_From_Dint.
+ (UI_From_Dint): Removed, not used.
+ * uintp.ads (UI_From_Dint): Removed, not used.
+ (Uint_Min/Max_Simple_Mul): New constants.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * clean.adb (Parse_Cmd_Line): Recognize switch
+ --unchecked-shared-lib-imports.
+ (Usage): Add line for switch --unchecked-shared-lib-imports
+ * makeusg.adb: Add line for switch --unchecked-shared-lib-imports
+ * makeutl.ads: (Unchecked_Shared_Lib_Imports): New constant string
+ moved from GPR_Util.
+ * switch-m.adb (Scan_Make_Switches): Recognize switch
+ --unchecked-shared-lib-imports.
+ * vms_data.ads: Add VMS qualifiers /UNCHECKED_SHARED_LIB_IMPORTS.
+ * gnat_ugn.texi: Add documentation for new switch
+ --unchecked-shared-lib-imports. Add also documentation for --subdirs.
+
+2010-06-22 Javier Miranda <miranda@adacore.com>
+
+ * sem_prag.adb, sem_util.adb, sem_util.ads, sem_attr.adb, exp_ch6.adb,
+ exp_disp.adb, sem_eval.adb, exp_dist.adb lib-xref.adb: Code cleanup,
+ this patch replaces duplication of code that traverses the chain of
+ aliased primitives by a call to routine Ultimate_Alias that
+ provides this functionality.
+
+2010-06-22 Arnaud Charlet <charlet@adacore.com>
+
+ * fmap.adb, opt.ads, osint.adb, osint.ads, output.ads, scng.adb,
+ sinput-c.adb, switch-m.ads, tree_io.ads: Use simpler form of
+ Warnings Off/On.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * einfo.ads: Minor reformatting.
+
+2010-06-22 Javier Miranda <miranda@adacore.com>
+
+ * exp_disp.adb (Expand_Interface_Thunk): Do not generate thunk of
+ eliminated primitives.
+ (Make_DT): Avoid referencing eliminated primitives.
+ (Register_Primitive): Do not register eliminated primitives in the
+ dispatch table. Required to add this functionality when the program is
+ compiled without static dispatch tables (-gnatd.t)
+
+2010-06-22 Emmanuel Briot <briot@adacore.com>
+
+ * fmap.adb, scng.adb, switch-m.ads, sinput-c.adb, opt.ads, output.ads,
+ tree_io.ads, osint.adb, osint.ads: Use configuration pragmas to prevent
+ warnings on use of internal GNAT units.
+
+2010-06-22 Jose Ruiz <ruiz@adacore.com>
+
+ * s-taprop-vxworks.adb (Set_Priority): Update comments.
+
+2010-06-22 Paul Hilfinger <hilfinger@adacore.com>
+
+ * s-rannum.adb: Make stylistic change to remove mystery constant in
+ Extract_Value. Image_Numeral_Length: new symbolic constant.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * einfo.ads, einfo.adb: Make Is_Protected_Interface,
+ Is_Synchronized_Interface, Is_Task_Interface into computable
+ predicates, to free three flags in entity nodes.
+ * sem_ch3.adb: Remove setting of these flags.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * uintp.adb, osint.adb, prj-conf.adb, prj-part.adb, prj.adb: Minor
+ reformatting.
+ * s-taprop-vxworks.adb: Add comment for Set_Priority.
+ * impunit.adb (Map_Array): Add entries for s-htable.ads and s-crc32.ads
+ * projects.texi: Move @cindex to the left margin, since otherwise we
+ are missing entries in the index.
+
+2010-06-22 Emmanuel Briot <briot@adacore.com>
+
+ * prj-part.adb, prj.adb, tempdir.ads, makeutl.adb: Use
+ packages from the GNAT hierarchy instead of System when possible.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-22 Jose Ruiz <ruiz@adacore.com>
+
+ * s-taprop-vxworks.adb (Set_Priority): Remove the code that was
+ previously in place to reorder the ready queue when a task drops its
+ priority due to the loss of inherited priority.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * projects.texi: Minor spelling error fixes.
+ Minor reformatting.
+
+2010-06-22 Emmanuel Briot <briot@adacore.com>
+
+ * prj-part.adb, prj-ext.adb, prj.adb, makeutl.adb, prj-conf.adb: Remove
+ warnings for some with clauses.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * errout.adb (Unwind_Internal_Type): Improve handling of First_Subtype
+ test to catch more cases where first subtype is the results we want.
+ * sem_res.adb (Make_Call_Into_Operator): Don't go to First_Subtype in
+ error case, since Errout will now handle this correctly.
+ * gcc-interface/Make-lang.in: Add Sem_Aux to list of GNATBIND objects.
+ Update dependencies.
+
+2010-06-22 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch4.adb (Expand_Allocator_Expression): Set Related_Node properly
+ when calling Make_Temporary.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Subprogram_Declaration): An anonymous access to
+ subprogram can be associated with an entry body.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * scos.ads: Add note on membership test handling.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * projects.texi: Minor spelling fixes.
+ Minor reformatting.
+
+2010-06-22 Paul Hilfinger <hilfinger@adacore.com>
+
+ * s-rannum.adb: Correct off-by-one error in Extract_Value.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * mlib-prj.adb (Display): In non verbose mode, truncate after fourth
+ argument.
+ * mlib-utl.adb (Gcc): In non verbose mode, truncate the display of the
+ gcc command if it is too long.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * errout.adb (Set_Msg_Node): Fix incorrect reference to node.
+
+2010-06-22 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch6.adb (Expand_Actuals): Use Actual as the related node when
+ calling Make_Temporary.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_res.adb, sem_aux.adb, errout.adb: Minor reformatting.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb: Additional special-case for VMS.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * gnatsym.adb: Minor comment fix.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Process_Naming_Scheme): Initialize table Lib_Data_Table.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * par-ch4.adb (P_Name): Recognize 'Mod attribute in Ada 95 mode
+ * sem_attr.adb (Attribute_05): Add Name_Mod so that 'Mod recognized in
+ Ada 95 mode as an implementation defined attribute.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * bindusg.adb (Display): Update line for -R
+ * switch-b.adb (Scan_Binder_Switches): Allow generation of the binder
+ generated files when -R is used.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Lib_Data_Table): New table.
+ (Check_Library_Attributes): Check if the same library name is used in
+ two different projects that do not extend each other.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * lib-writ.ads, errout.adb, einfo.adb, einfo.ads: Minor reformatting.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * adaint.c (__gnat_locate_regular_file): If a directory in the path is
+ empty, make it the current working directory.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Record_Type): When deriving a tagged
+ private type with discriminants, make sure the parent type is frozen.
+
+2010-06-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Bit>: Deal
+ with packed array references specially.
+ * exp_ch4.adb (Expand_N_Indexed_Component): Do not convert a reference
+ to a component of a bit packed array if it is the prefix of 'Bit.
+ * exp_pakd.ads (Expand_Packed_Bit_Reference): Declare.
+ * exp_pakd.adb (Expand_Packed_Bit_Reference): New procedure. Expand a
+ 'Bit reference, where the prefix involves a packed array reference.
+ (Get_Base_And_Bit_Offset): New helper, extracted from...
+ (Expand_Packed_Address_Reference): ...here. Call above procedure to
+ get the outer object and offset expression.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * exp_attr.adb, lib-writ.ads, bindgen.adb: Minor reformatting.
+ * einfo.adb (Related_Expression, Set_Related_Expression): Add
+ assertions.
+
+2010-06-22 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Add_Internal_Interface_Entities): Minor code
+ reorganization to properly check if the operation has been inherited as
+ an abstract operation.
+
+2010-06-22 Ed Falis <falis@adacore.com>
+
+ * s-osinte-vxworks.ads: Complete previous change.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb: Add comment.
+ * projects.texi, gnat_ugn.texi: Remove macro.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * prj-attr.adb: Remove project level attribute Main_Language.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * switch-b.adb, osint-b.adb: Minor reformatting.
+
+2010-06-22 Pascal Obry <obry@adacore.com>
+
+ * g-socthi-mingw.adb (C_Sendmsg): Do not attempt to send data from a
+ vector if previous send was not fully successful. If only part of
+ the vector data was sent, we exit the loop.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb (Make_Call_Into_Operator): Use First_Subtype for better
+ error reporting with generic types.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * bindgen.adb, bindusg.adb, gnatbind.adb, gnat_ugn.texi, opt.ads,
+ osint-b.adb, osint-b.ads, output.adb, output.ads, switch-b.adb,
+ vms_data.ads: Add a new command line switch -A to gnatbind to output
+ the list of all ALI files for the partition.
+
+2010-06-22 Arnaud Charlet <charlet@adacore.com>
+
+ * s-osinte-vxworks.ads: Fix casing.
+ * s-vxwext-kernel.ads, s-vxwext-rtp.ads: Complete previous
+ change: Interfaces.C does not provide a long_long type.
+
+2010-06-22 Emmanuel Briot <briot@adacore.com>
+
+ * gnat_ugn.texi, projects.texi: Preprocess projects.texi for VMS and
+ native user's guide, since this document contains the two versions.
+ * gcc-interface/Make-lang.in: Update doc dependencies.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb: Minor reformatting. Minor code reorganization.
+
+2010-06-22 Emmanuel Briot <briot@adacore.com>
+
+ * gnat_ugn.texi, projects.texi: Remove toplevel menu, since we should
+ not build this file on its own (only through gnat_ugn.texi).
+ Remove macro definitions and insert simpler version in gnat_ugn.texi.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * ali-util.ads: Minor comment update.
+ * g-socthi-mingw.adb: Minor reformatting.
+
+2010-06-22 Ed Falis <falis@adacore.com>
+
+ * s-osinte-vxworks.ads: take sigset_t definition from System.VxWorks.Ext
+ * s-vxwext.ads, s-vxwext-kernel.ads, s-vxwext-rtp.ads: Define sigset_t
+ for specific versions of VxWorks.
+
+2010-06-22 Emmanuel Briot <briot@adacore.com>
+
+ * gnat_rm.texi, gnat_ugn.texi, projects.texi: Remove all project files
+ related sections from user's guide and reference manual, since they
+ have now been merged together into a separate document (projects.texi).
+ This removes a lot of duplication where attributes where described
+ in several places.
+ The grammar for the project files is now in each of the sections
+ (packages,expressions,...) instead of being duplicates in two other
+ sections (one in the user's guide that contained the full grammar,
+ and various sections in the rm that contained extracts of the same
+ grammar).
+ Added the full list of all supported attributes, since existing lists
+ were incomplete
+ Rename "associative array" into "indexed attribute"
+ Remove sections that were duplicates ("External References in
+ Project Files" and "External Values", and "Project Extensions"
+ for instance). The list of valid packages in project files is now in
+ a single place.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Add_Internal_Interface_Entities): If
+ Find_Primitive_Covering_Interface does not find the operation, it may
+ be because of a name conflict between the inherited operation and a
+ local non-overloadable name. In that case look for the operation among
+ the primitive operations of the type. This search must succeed
+ regardless of visibility.
+
+2010-06-22 Pascal Obry <obry@adacore.com>
+
+ * g-socthi-mingw.adb: Properly honor MSG_WAITALL in recvmsg.
+ (C_Recvmsg): Propely honor the MSG_WAITALL flag in Windows
+ recvmsg emulation.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch4.adb (Analyze_Conditional_Expression): Defend against
+ malformed tree.
+ * sprint.adb (Sprint_Node_Actual, case N_Conditional_Expression): Ditto.
+
+2010-06-22 Arnaud Charlet <charlet@adacore.com>
+
+ * s-intman-vxworks.ads: Code clean up.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb (Resolve_Slice): When the prefix is an explicit
+ dereference, construct actual subtype of designated object to generate
+ proper bounds checks.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * ali-util.adb, ali-util.ads, gnatbind.adb (Read_ALI): Rename to
+ Read_Withed_ALIs, which is more descriptive.
+
+2010-06-22 Pascal Obry <obry@adacore.com>
+
+ * g-sothco.ads: Minor reformatting.
+ * g-socthi-mingw.adb: Remove part of work on the C_Recvmsg and
+ C_Sendmsg implementation.
+ (C_Sendmsg): Do not use lock (not needed).
+ (C_Recvmsg): Likewise and also do not wait for incoming data.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * uintp.adb: Fix scope error in operator call.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * makeutl.adb (Executable_Prefix_Path): on VMS, return "/gnu/".
+ * prj-conf.adb (Get_Or_Create_Configuration_File): On VMS, if
+ autoconfiguration is needed, fail indicating that no config project
+ file can be found, as there is no autoconfiguration on VMS.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Make_Call_Into_Operator): Diagnose an incorrect scope
+ for an operator in a functional notation, when operands are universal.
+
+2010-06-22 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_aggr.adb (Resolve_Record_Aggregate): Do style check on component
+ name.
+ * sem_ch10.adb (Analyze_Subunit): Do style check on parent unit name.
+ * sem_ch8.adb (Find_Direct_Name): For non-overloadable entities, do
+ style check.
+ * sem_res.adb (Resolve_Entity_Name): Do style check for enumeration
+ literals.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Scan_Make_Arg): No longer pass -nostdlib to the compiler as
+ it has no effect. Always pass -nostdlib to gnatlink, even on VMS.
+
+2010-06-22 Pascal Obry <obry@adacore.com>
+
+ * g-socthi-mingw.adb: Fix implementation of the vectored sockets on
+ Windows.
+ (C_Recvmsg): Make sure the routine is atomic. Also fully
+ fill vectors in the proper order.
+ (C_Sendmsg): Make sure the routine is atomic.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch8.adb: Update comment.
+ * sem_res.adb: Minor code reorganization (use Ekind_In).
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Add_Implicit_Operator): If the context of the expanded
+ name is a call, use the number of actuals to determine whether this is
+ a binary or unary operator, rather than relying on later information
+ to resolve the overload.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch10.adb, sem_aggr.adb: Minor reformatting.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb, sem_disp.adb: Minor code fixes.
+ * sem_eval.adb: Minor reformatting.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Scan_Make_Arg): When invoked with -nostdlib, pass -nostdlib
+ to gnatlink, except on Open VMS.
+ * osint.adb (Add_Default_Search_Dirs): Do not suppress the default
+ object directories if -nostdlib is used.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_util.adb (Is_Delegate): Put in proper alpha order.
+ * sem_eval.adb: Minor reformatting.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * g-expect-vms.adb, sem_res.adb: Minor reformatting.
+ * exp_aggr.adb: Minor comment changes and reformatting.
+ * sem_eval.adb (Find_Universal_Operator_Type): Put in proper alpha order
+ * sem_util.ads: Add some missing pragma Inline's (efficiency issue only)
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_util.adb (Build_Actual_Subtype): Record original expression in
+ Related_Expression attribute of the constructed subtype.
+ * einfo.adb, einfo.ads (Underlying_View): Move to Node28 to free up
+ Node24 on types for...
+ (Related_Expression): Make attribute available on types as well.
+
+2010-06-22 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_util.adb (Find_Interface_ADT): Retrieve Designated_Type instead of
+ Directly_Designated_Type when the type argument is an access type.
+ (Find_Interface_Tag): Retrieve Designated_Type instead of
+ Directly_Designated_Type when the type argument is an access type.
+ (Has_Controlled_Coextensions): Retrieve Designated_Type instead of
+ Directly_Designated_Type of each access discriminant.
+ * sem_res.adb (Resolve_Type_Conversion): Retrieve Designated_Type
+ instead of Directly_Designated_Type when the operand and target types
+ are access types.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * exp_aggr.adb (Flatten): Return False if one choice is statically
+ known to be out of bounds.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Call): If the call is rewritten as an indexed of
+ a parameterless function call, preserve parentheses of original
+ expression, for proper handling by pretty printer.
+ * sem_attr.adb (Analyze_Attribute, case 'Old): Add guard to Process
+ procedure, to handle quietly identifiers that have no entity names.
+ * exp_util.adb (Get_Current_Value_Condition): If the parent of an
+ elsif_part is missing, it has been rewritten as a nested if, and there
+ is no useful information on the current value of the variable.
+
+2010-06-22 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch3.adb (Build_Discriminal): Set default scopes for newly created
+ discriminals to the current scope.
+ * sem_util.adb (Find_Body_Discriminal): Remove setting of discriminal's
+ scope, which could overwrite a different already set value.
+
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Valid_Conversion): If expression is a predefined
+ operator, use sloc of type of interpretation to improve error message
+ when operand is of some derived type.
+ * sem_eval.adb (Is_Mixed_Mode_Operand): New function, use it.
+
+2010-06-22 Emmanuel Briot <briot@adacore.com>
+
+ * g-expect-vms.adb (Expect_Internal): No longer raises an exception, so
+ that it can set out parameters as well. When a process has died, reset
+ its Input_Fd to Invalid_Fd, so that when using multiple processes we
+ can find out which process has died.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_eval.adb (Find_Universal_Operator_Type): New
+ subprogram to identify the operand type of an operator on universal
+ operands, when an explicit scope indication is present. Diagnose the
+ case where such a call is ambiguous.
+ (Eval_Arithmetic_Op, Eval_Relational_Op, Eval_Unary_Op):
+ Use the above to identify the operand type so it can be properly frozen.
+ * sem_res.adb (Make_Call_Into_Operator): Remove bogus freeze of operand
+ type, done in an arbitrary, possibly incorrect type (the presence of
+ some numeric type in the scope is checked for legality, but when more
+ than one such type is in the scope, we just pick a random one, not
+ necessarily the expected one).
+ * sem_utils.ads, sem_utils.adb (Is_Universal_Numeric_Type): New utility
+ subprogram.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_eval.adb: Minor reformatting.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Conditional_Expression): Use
+ Expression_With_Actions to clean up the code generated when folding
+ constant expressions.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * g-expect-vms.adb: Add new subprograms Free, First_Dead_Process and
+ Has_Process.
+
+2010-06-22 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Find_Sources): When a source from a multi-unit file is
+ found, check if it's path has aready been found, whatever its index.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * atree.adb, gnatbind.adb: Minor reformatting.
+ Minor code reorganization.
+
+2010-06-21 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Conditional_Expression): Fold if condition
+ known at compile time.
+
+2010-06-21 Gary Dismukes <dismukes@adacore.com>
+
+ * atree.adb: Fix comment typo.
+
+2010-06-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_eval.adb (Test_Ambiguous_Operator): New procedure to check
+ whether a universal arithmetic expression in a conversion, which is
+ rewritten from a function call with an expanded name, is ambiguous.
+
+2010-06-21 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Name_Location): New Boolean component Listed, to record
+ source files in specified list of sources.
+ (Check_Package_Naming): Remove out parameters Bodies and Specs, as they
+ are never used.
+ (Add_Source): Set the Location of the new source
+ (Process_Exceptions_File_Based): Call Add_Source with the Location
+ (Get_Sources_From_File): If an exception is found, set its Listed to
+ True
+ (Find_Sources): When Source_Files is specified, if an exception is
+ found, set its Listed to True. Remove any exception that is not in a
+ specified list of sources.
+ * prj.ads (Source_Data): New component Location
+
+2010-06-21 Vincent Celier <celier@adacore.com>
+
+ * gnatbind.adb (Closure_Sources): Global table, moved from block.
+
+2010-06-21 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb: Minor reformatting.
+ * atree.adb: New debugging hook "rr" for node rewrites.
+
+2010-06-21 Robert Dewar <dewar@adacore.com>
+
+ * g-expect.ads, g-expect.adb: Minor reformatting.
+
+2010-06-21 Emmanuel Briot <briot@adacore.com>
+
+ * s-regpat.adb (Next_Pointer_Bytes): New named constant. Code clean up.
+
+2010-06-21 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-21 Thomas Quinot <quinot@adacore.com>
+
+ * bindgen.ads: Update comments.
+
+2010-06-21 Vincent Celier <celier@adacore.com>
+
+ * gnatbind.adb: Suppress dupicates when listing the sources in the
+ closure (switch -R).
+
+2010-06-21 Emmanuel Briot <briot@adacore.com>
+
+ * s-regpat.adb (Link_Tail): Fix error when size of the pattern matcher
+ is too small.
+
+2010-06-21 Emmanuel Briot <briot@adacore.com>
+
+ * g-expect.adb, g-expect.ads (First_Dead_Process, Free, Has_Process):
+ New subprograms.
+ (Expect_Internal): No longer raises an exception, so that it can set
+ out parameters as well. When a process has died, reset its Input_Fd
+ to Invalid_Fd, so that when using multiple processes we can find out
+ which process has died.
+
+2010-06-21 Robert Dewar <dewar@adacore.com>
+
+ * s-regpat.adb, s-tpoben.adb, sem_attr.adb, sem_util.adb, sem_util.ads,
+ checks.adb, sem_res.adb: Minor reformatting. Add comments.
+
+2010-06-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (New_Overloaded_Entity): If the new entity is a
+ rederivation associated with a full declaration in a private part, and
+ there is a partial view that derives the same parent subprogram, the
+ new entity does not become visible. This check must be applied to
+ interface operations as well.
+
+2010-06-21 Thomas Quinot <quinot@adacore.com>
+
+ * checks.adb: Add comments.
+ * prj-nmsc.adb: Minor reformatting.
+
+2010-06-21 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch9.adb, checks.adb, sem_util.adb, sem_util.ads, sem_res.adb,
+ sem_attr.adb (Get_E_First_Or_Last): Use attribute references on E to
+ extract bounds, to ensure that we get the proper captured values,
+ rather than an expression that may have changed value since the point
+ where the subtype was elaborated.
+ (Find_Body_Discriminal): New utility subprogram to share code between...
+ (Eval_Attribute): For the case of a subtype bound that references a
+ discriminant of the current concurrent type, insert appropriate
+ discriminal reference.
+ (Resolve_Entry.Actual_Index_Type.Actual_Discriminant_Ref): For a
+ requeue to an entry in a family in the current task, use corresponding
+ body discriminal.
+ (Analyze_Accept_Statement): Rely on expansion of attribute references
+ to insert proper discriminal references in range check for entry in
+ family.
+
+2010-06-21 Emmanuel Briot <briot@adacore.com>
+
+ * s-regpat.adb (Compile): Fix handling of big patterns.
+
+2010-06-21 Robert Dewar <dewar@adacore.com>
+
+ * a-tifiio.adb: Minor reformatting.
+
+2010-06-21 Pascal Obry <obry@adacore.com>
+
+ * prj-nmsc.adb (Search_Directories): Use the non-translated directory
+ path to open it.
+
+2010-06-21 Javier Miranda <miranda@adacore.com>
+
+ * exp_cg.adb (Write_Call_Info): Fill the component sourcename using the
+ external name.
+
+2010-06-21 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb (Expand_Concatenate): If an object declaration is created
+ to hold the result, indicate that the target of the declaration does
+ not need an initialization, to prevent spurious errors when
+ Initialize_Scalars is enabled.
+
+2010-06-21 Ed Schonberg <schonberg@adacore.com>
+
+ * a-tifiio.adb (Put): In the procedure that performs I/O on a String,
+ Fore is not bound by line length. The Fore parameter of the internal
+ procedure that performs the operation is an integer.
+
+2010-06-21 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb, checks.adb: Minor reformatting.
+
+2010-06-21 Emmanuel Briot <briot@adacore.com>
+
+ * s-regpat.adb (Next_Instruction, Get_Next_Offset): Removed, merged
+ into Get_Next.
+ (Insert_Operator_Before): New subprogram, avoids duplicated code
+ (Compile): Avoid doing two compilations when the pattern matcher ends
+ up being small.
+
+2010-06-21 Emmanuel Briot <briot@adacore.com>
+
+ * s-regpat.adb: Improve debug traces
+ (Dump): Change output format to keep it smaller.
+
+2010-06-21 Javier Miranda <miranda@adacore.com>
+
+ * exp_cg.adb (Generate_CG_Output): Disable redirection of standard
+ output to the output file when this routine completes its work.
+
+2010-06-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Use while instead of
+ for loop. Call build_constructor_from_list directly in the CICO case.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Build_And_Analyze_Renamed_Body): If the renaming
+ declaration appears in the same unit and ealier than the renamed
+ entity, retain generated body to prevent order-of-elaboration issues in
+ gigi.
+
+2010-06-18 Arnaud Charlet <charlet@adacore.com>
+
+ * s-tpoben.adb: Update comments.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * debug.adb: Minor comment change.
+
+2010-06-18 Javier Miranda <miranda@adacore.com>
+
+ * exp_cg.adb: Code clean up.
+ * debug.adb: Complete documentation of switch -gnatd.Z.
+ * gcc-interface/misc.c (callgraph_info_file): Declare.
+
+2010-06-18 Javier Miranda <miranda@adacore.com>
+
+ * exp_cg.adb (Homonym_Suffix_Length): Minor code reorganization.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * sprint.ads: Minor reformatting.
+ * output.ads: Update obsolete comment.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Build_And_Analyze_Renamed_Body): if the renamed entity is
+ an external intrinsic operation (e.g. a GCC numeric function) indicate
+ that the renaming entity has the same characteristics, so a call to it
+ is properly expanded.
+
+2010-06-18 Javier Miranda <miranda@adacore.com>
+
+ * exp_cg.adb, exp_cg.ads, exp_disp.adb, gnat1drv.adb: Add initial
+ support for dispatch table/callgraph info generation.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch6.adb: Minor reformatting.
+ * gnatname.adb: Add comment.
+
+2010-06-18 Vincent Celier <celier@adacore.com>
+
+ * gnatname.adb (Scan_Args): When --and is used, make sure that the
+ dynamic tables in the newly allocated Argument_Data are properly
+ initialized.
+
+2010-06-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat1drv.adb: Fix comment.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Expand_Inlined_Call): If the inlined subprogram is a
+ renaming, re-expand the call with the renamed subprogram if that one
+ is marked inlined as well.
+
+2010-06-18 Gary Dismukes <dismukes@adacore.com>
+
+ * gnat1drv.adb (Adjust_Global_Switches): Enable
+ Use_Expression_With_Actions for AAMP and VM targets.
+
+2010-06-18 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Process_Linker): Recognize response file format GCC.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch4.adb: Minor reformatting.
+
+2010-06-18 Javier Miranda <miranda@adacore.com>
+
+ * debug.ads Add documentation on -gnatd.Z.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_elim.adb: Proper error message on improperly eliminated instances
+
+2010-06-18 Vincent Celier <celier@adacore.com>
+
+ * prj.ads (Response_File_Format): New value GCC.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * gnat1drv.adb: Minor reformatting.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * make.adb, sem_cat.adb: Minor reformatting.
+ * sem_eval.adb: Fix typos.
+
+2010-06-18 Pascal Obry <obry@adacore.com>
+
+ * prj-nmsc.adb: Fix source filenames casing in debug output.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * gnatcmd.adb: Minor reformatting.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * sem_eval.adb (Eval_Conditional_Expression): Result is static if
+ condition and both sub-expressions are static (and result is selected
+ expression).
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * g-pehage.adb: Minor reformatting
+
+2010-06-18 Pascal Obry <obry@adacore.com>
+
+ * prj-nmsc.adb (Search_Directories): Insert canonical filenames into
+ source hash table.
+
+2010-06-18 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Update
+ dependencies. Fix target pairs on darwin.
+ (gnatlib-sjlj, gnatlib-zcx): Pass THREAD_KIND.
+
+2010-06-18 Pascal Obry <obry@adacore.com>
+
+ * make.adb, prj-nmsc.adb: Fix source filenames casing in debug output.
+
+2010-06-18 Vincent Celier <celier@adacore.com>
+
+ * gnatcmd.adb: For gnatcheck, add -gnatec= switch for a global
+ configuration pragmas file and, if -U is not used, for a local one.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_elim.adb (Check_Eliminated): Use full information on entity name
+ when it is given in the pragma by a selected component.
+ (Check_For_Eliminated_Subprogram): Do no emit error if within a
+ instance body that is itself within a generic unit.
+ * sem_ch12.adb (Analyze_Subprogram_Instance): If the subprogram is
+ eliminated, mark as well the anonymous subprogram that is its alias
+ and appears within the wrapper package.
+
+2010-06-18 Bob Duff <duff@adacore.com>
+
+ * g-pehage.ads, g-pehage.adb (Produce): Clean up some of the code.
+ Raise an exception if the output file cannot be opened. Add comments.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * sem_cat.adb (Validate_Object_Declaration): A variable declaration is
+ not illegal per E.2.2(7) if it occurs in the private part of a
+ Remote_Types unit.
+
+2010-06-18 Arnaud Charlet <charlet@adacore.com>
+
+ * par-ch9.adb, sem_aggr.adb, sem_ch3.adb, layout.adb, sem_ch4.adb,
+ sem_ch5.adb, sem_mech.adb, exp_util.adb, par-ch10.adb, sem_ch6.adb,
+ par-ch11.adb, sem_ch7.adb, par-prag.adb, exp_disp.adb, par-ch12.adb,
+ sem_ch8.adb, style.adb, sem_ch9.adb, sem_ch10.adb, prep.adb,
+ sem_warn.adb, par-util.adb, scng.adb, sem_eval.adb, checks.adb,
+ sem_prag.adb, sem_ch12.adb, styleg.adb, sem_ch13.adb, par-ch3.adb,
+ par-tchk.adb, freeze.adb, sfn_scan.adb, par-ch4.adb, sem_util.adb,
+ sem_res.adb, par-ch5.adb, lib-xref.adb, sem_attr.adb, par-ch6.adb,
+ sem_disp.adb, prepcomp.adb, par-ch7.adb, sem_elab.adb, exp_ch4.adb,
+ errout.ads: Update comments. Minor reformatting.
+
+ * g-spipat.adb, a-swunau.adb, a-swunau.ads, g-spitbo.adb,
+ a-szunau.adb, a-szunau.ads, a-stunau.adb, a-stunau.ads,
+ a-strunb.adb (Big_String. Big_String_Access): New type.
+
+ * par-labl.adb, restrict.adb, s-osinte-hpux-dce.ads, sem_ch11.adb,
+ exp_pakd.adb, s-filofl.ads, par-endh.adb, exp_intr.adb, sem_cat.adb,
+ sem_case.adb, exp_ch11.adb, s-osinte-linux.ads: Fix copyright notices.
+
+2010-06-18 Geert Bosch <bosch@adacore.com>
+
+ * i-forbla-darwin.adb: Include -lgnala and -lm in linker options for
+ Darwin.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * gnat1drv.adb (Adjust_Global_Switches): Set Use_Expression_With_Actions
+ true for gcc.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * sprint.adb: Minor format change for N_Expression_With_Actions.
+ * repinfo.adb: Minor reformatting.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_elim.adb (Check_Eliminated): If within a subunit, use
+ Defining_Entity to obtain the name of the entity in the proper body, to
+ properly handle both separate packages and subprograms.
+
+2010-06-18 Emmanuel Briot <briot@adacore.com>
+
+ * prj-nmsc.adb (Check_File): New parameter Display_Path.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * g-socket.adb, g-socket.ads (Null_Selector): New object.
+
+2010-06-18 Pascal Obry <obry@adacore.com>
+
+ * gnat_ugn.texi: Minor clarification.
+
+2010-06-18 Emmanuel Briot <briot@adacore.com>
+
+ * prj-nmsc.adb (Find_Source_Dirs): Minor refactoring to avoid duplicate
+ code when using the project dir as the source dir.
+ (Search_Directories): use the normalized name for the source directory,
+ where symbolic names have potentially been resolved.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Conditional_Expression): Clear Actions field
+ when we create N_Expression_With_Actions node.
+ (Expand_Short_Circuit): Ditto.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * exp_util.adb: Minor reformatting.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * types.ads: Clean up obsolete comments
+ * tbuild.adb: Minor reformatting.
+ * exp_ch5.adb, sem_intr.adb, sem_ch10.adb, rtsfind.adb, s-shasto.adb,
+ exp_strm.adb, aa_drive.adb: Minor reformatting.
+ * sem_res.adb (Is_Predefined_Operator): An operator that is an imported
+ intrinsic with an Interface_Name denotes an imported back-end builtin,
+ and must be rewritten into a call, not left in the tree as an operator,
+ so return False in that case.
+
+2010-06-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_util.adb (Remove_Side_Effects): Make a copy for an allocator.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * scos.ads: Add proposed output for case expression
+
+2010-06-18 Jose Ruiz <ruiz@adacore.com>
+
+ * gnat_ugn.texi: Document that, when using the RTX compiler to generate
+ RTSS modules, we need to use the Microsoft linker.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * checks.adb (Safe_To_Capture_In_Parameter_Value): Deal with case
+ expression (cannot count on a particular branch being executed).
+ * exp_ch4.adb (Expand_N_Case_Expression): New procedure.
+ * exp_ch4.ads (Expand_N_Case_Expression): New procedure.
+ * exp_util.adb (Insert_Actions): Deal with proper insertion of actions
+ within case expression.
+ * expander.adb (Expand): Add call to Expand_N_Case_Expression
+ * par-ch4.adb Add calls to P_Case_Expression at appropriate points
+ (P_Case_Expression): New procedure
+ (P_Case_Expression_Alternative): New procedure
+ * par.adb (P_Case_Expression): New procedure
+ * par_sco.adb (Process_Decisions): Add dummy place holder entry for
+ N_Case_Expression.
+ * sem.adb (Analyze): Add call to Analyze_Case_Expression
+ * sem_case.ads (Analyze_Choices): Also used for case expressions now,
+ this is a documentation change only.
+ * sem_ch4.ads, sem_ch4.adb (Analyze_Case_Expression): New procedure.
+ * sem_ch6.adb (Fully_Conformant_Expressions): Add handling of case
+ expressions.
+ * sem_eval.ads, sem_eval.adb (Eval_Case_Expression): New procedure.
+ * sem_res.adb (Resolve_Case_Expression): New procedure.
+ * sem_scil.adb (Find_SCIL_Node): Add processing for
+ N_Case_Expression_Alternative.
+ * sinfo.ads, sinfo.adb (N_Case_Expression): New node.
+ (N_Case_Expression_Alternative): New node.
+ * sprint.adb (Sprint_Node_Actual): Add processing for new nodes
+ N_Case_Expression and N_Case_Expression_Alternative.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * par-ch7.adb, sem_warn.adb, types.ads, par-ch3.adb: Minor reformatting.
+ * gnat1drv.adb: Fix typo.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * par-prag.adb (Prag, case Style_Checks): All_Checks sets gnat style
+ for -gnatg.
+ * sem_prag.adb (Analyze_Pragma, case Style_Checks): All_Checks sets
+ gnat style for -gnatg.
+ * gnat_rm.texi: Add documentation for ALL_CHECKS in GNAT mode.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * sem_eval.adb (Test_In_Range): New subprogram, factoring duplicated
+ code between...
+ (Is_In_Range, Is_Out_Of_Range): Reimplement in terms of call to
+ Test_In_Range.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * sprint.adb: Minor change in output format for expression wi actions.
+ * par-ch3.adb: Minor code reorganization. Minor reformatting.
+ * sem_ch5.adb: Minor comment fix.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * debug.adb: New debug flag -gnatd.L to control
+ Back_End_Handles_Limited_Types.
+ * exp_ch4.adb (Expand_N_Conditional_Expression): Let back end handle
+ limited case if Back_End_Handles_Limited_Types is True.
+ (Expand_N_Conditional_Expression): Use N_Expression_With_Actions to
+ simplify expansion if Use_Expression_With_Actions is True.
+ * gnat1drv.adb (Adjust_Global_Switches): Set
+ Back_End_Handles_Limited_Types.
+ * opt.ads (Back_End_Handles_Limited_Types): New flag.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Rewrite_Operator_As_Call): Do not rewrite user-defined
+ intrinsic operator if expansion is not enabled, because in an
+ instantiation the original operator must be present to verify the
+ legality of the operation.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * exp_disp.adb, sem_ch12.adb: Minor reformatting
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_util.adb (Make_Subtype_From_Expr): If the unconstrained type is
+ the class-wide type for a private extension, and the completion is a
+ subtype, set the type of the class-wide type to the base type of the
+ full view.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * g-socket.ads, sem_aggr.adb, einfo.ads, sem_elim.adb,
+ sem_intr.adb, sem_eval.adb: Minor reformatting
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_type.adb (Is_Ancestor): If either type is private, examine full
+ view.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * g-socket.adb, g-socket.ads (Check_Selector): Make Selector an IN
+ parameter rather than IN OUT.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb: Add extra guard.
+
+2010-06-18 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_util.adb (Object_Access_Level): For Ada 2005, determine the
+ accessibility level of a function call from the level of the innermost
+ enclosing dynamic scope.
+ (Innermost_Master_Scope_Depth): New function to find the depth of the
+ nearest dynamic scope enclosing a node.
+
+2010-06-18 Tristan Gingold <gingold@adacore.com>
+
+ * adaint.c: Make ATTR_UNSET static as it is not used outside this file.
+
+2010-06-18 Thomas Quinot <quinot@adacore.com>
+
+ * g-socket.ads: Minor reformatting.
+
+2010-06-18 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Must_Compile): New Boolean global variable
+ (Main_On_Command_Line): New Boolean global variable
+ (Collect_Arguments_And_Compile): Do compile if Must_Compile is True,
+ even when the project is externally built.
+ (Start_Compile_If_Possible): Compile in -aL directories if
+ Check_Readonly_Files is True. Do compile if Must_Compile is True, even
+ when the project is externally built.
+ (Gnatmake): Set Must_Compile and Check_Readonly_Files to True when
+ invoked with -f -u and one or several mains on the command line.
+ (Scan_Make_Arg): Set Main_On_Command_Line to True when at least one main
+ is specified on the command line.
+
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Build_Body_For_Inline): Handle extended_return_statements
+ * exp_ch6.adb (Expand_Inlined_Call): when possible, inline a body
+ containing extented_return statements.
+ * exp_util.adb (Make_CW_Equivalent_Type): If the root type is already
+ constrained, do not build subtype declaration.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * sem_res.adb (Analyze_Indexed_Component, Analyze_Selected_Component):
+ Warn on assigning to packed atomic component.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * sem_util.ads: Minor reformatting
+ * einfo.ads, einfo.adb: Minor doc clarification (scope of decls in
+ Expression_With_Actions).
+ * snames.ads-tmpl: Minor comment fix
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb (Diagnose_Multiple_Pragmas): New procedure
+ (Set_Imported): Use Import_Interface_Present to control message output
+ * sinfo.ads, sinfo.adb (Import_Interface_Present): New flag
+ * gnat_rm.texi: Document that we can have pragma Import and pragma
+ Interface for the same subprogram.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * lib-xref.adb (Generate_Reference): Fix bad reference to
+ Has_Pragma_Unreferenced (clients should always use Has_Unreferenced).
+
+2010-06-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (set_gnu_expr_location_from_node): New static
+ function.
+ (gnat_to_gnu) <N_Expression_With_Actions>: New case.
+ Use set_gnu_expr_location_from_node to set location information on the
+ result.
+
+2010-06-17 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Is_Atomic_Object): Predicate does not apply to
+ subprograms.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * gnat_rm.texi, gnat_ugn.texi: Clean up documentation on warning and
+ style check messages.
+ * sem_res.adb (Resolve_Call): Don't call
+ Check_For_Eliminated_Subprogram if we are analyzing within a spec
+ expression.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * debug.adb: Add documentation for debug flags .X and .Y
+ * exp_ch4.adb (Expand_Short_Circuit_Operator): Use
+ Use_Expression_With_Actions.
+ * gnat1drv.adb (Adjust_Global_Switches): Set
+ Use_Expression_With_Actions.
+ * opt.ads (Use_Expression_With_Actions): New switch.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * exp_intr.adb: Minor code reorganization (use UI_Max)
+ * sem_intr.adb: use underlying type to check legality.
+ * einfo.adb (Known_Static_Esize): False for generic types
+ (Known_Static_RM_Size): False for generic types
+ * einfo.ads (Known_Static_Esize): False for generic types
+ (Known_Static_RM_Size): False for generic types
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.ads: Minor code reorganization (specs in alpha order).
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * debug.adb: New debug flag -gnatd.X to use Expression_With_Actions
+ node when expanding short circuit form with actions present for right
+ opnd.
+ * exp_ch4.adb: Minor reformatting
+ (Expand_Short_Circuit_Operator): Use new Expression_With_Actions node if
+ right opeand has actions present, and debug flag -gnatd.X is set.
+ * exp_util.adb (Insert_Actions): Handle case of Expression_With_Actions
+ node.
+ * nlists.adb (Prepend_List): New procedure
+ (Prepend_List_To): New procedure
+ * nlists.ads (Prepend_List): New procedure
+ (Prepend_List_To): New procedure
+ * sem.adb: Add processing for Expression_With_Actions
+ * sem_ch4.adb (Analyze_Expression_With_Actions): New procedure
+ * sem_ch4.ads (Analyze_Expression_With_Actions): New procedure
+ * sem_res.adb: Add processing for Expression_With_Actions.
+ * sem_scil.adb: Add processing for Expression_With_Actions
+ * sinfo.ads, sinfo.adb (N_Expression_With_Actions): New node.
+ * sprint.ads, sprint.adb: Add processing for Expression_With_Actions
+
+2010-06-17 Doug Rupp <rupp@adacore.com>
+
+ * sem_intr.adb (Check_Intrinsic_Operator): Check that the types
+ involved both have underlying integer types.
+ * exp_intr.adb (Expand_Binary_Operator) New subprogram to expand a call
+ to an intrinsic operator when the operand types or sizes are not
+ identical.
+ * s-auxdec-vms_64.ads: Revert "+" "-" ops back to Address now that
+ 64/32 Address/Integer works.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Mark_Context): Refine placement of Withed_Body flag, so
+ that it marks a unit as needed by a spec only if the corresponding
+ instantiation appears in that spec (and not in the corresponding body).
+ * sem_elim.adb (Check_Eliminated): If we are within a subunit, the name
+ in the pragma Eliminate has been parsed as a child unit, but the
+ current compilation unit is in fact the parent in which the subunit is
+ embedded.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * gnat_rm.texi: Fix typo
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * sem_util.adb: Minor reformatting
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem.adb (Do_Withed_Unit): if the unit in the with_clause is a generic
+ instance, the clause now denotes the instance body. Traverse the
+ corresponding spec because there may be no other dependence that will
+ force the traversal of its own context.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch10.adb (Is_Ancestor_Unit): Subsidiary to
+ Install_Limited_Context_Clauses, to determine whether a limited_with in
+ some parent of the current unit designates some other parent, in which
+ case the limited_with clause must not be installed.
+ (In_Context): Refine test.
+
+2010-06-17 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_util.adb (Collect_Primitive_Operations): In the of an untagged
+ type with a dispatching equality operator that is overridden (for a
+ tagged full type), don't include the overridden equality in the list of
+ primitives. The overridden equality is detected by testing for an
+ Aliased field that references the overriding equality.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb: Minor reformatting.
+
+2010-06-17 Joel Brobecker <brobecker@adacore.com brobecker>
+
+ * gnat_ugn.texi: Add a section introducing gdbserver.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb, sem_ch4.adb, s-stoele.adb, par-labl.adb: Minor
+ reformatting.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Valid_Ancestor_Type): handle properly the case of a
+ constrained discriminated parent that is a private type.
+ (Analyze_Record_Aggregate): when collecting inherited discriminants,
+ handle properly an ancestor type that is a constrained private type.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Enclosing_Subprogram): If the called subprogram is
+ protected, use the protected_subprogram_body only if the original
+ subprogram has not been eliminated.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Freeze_Expression): The designated type of an
+ access_to_suprogram type can only be frozen if all types in its profile
+ are fully defined.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * par.adb: Minor comment fix
+ * sem_aggr.adb, sem_ch3.adb: Minor reformatting
+
+2010-06-17 Doug Rupp <rupp@adacore.com>
+
+ * s-auxdec-vms_64.ads: Revert Integer to Long_Integer change, instead
+ change Address to Short_Address in functions where both must be the
+ same size for intrinsics to work.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch4.adb (Analyze_Selected_Component): A selected component may
+ not denote a (private) component of a protected object.
+
+2010-06-17 Bob Duff <duff@adacore.com>
+
+ * par-labl.adb (Try_Loop): Test whether the label and the goto are in
+ the same list.
+
+2010-06-17 Joel Brobecker <brobecker@adacore.com brobecker>
+
+ * gnat_ugn.texi: Update the documentation about GDB re: exception
+ catchpoints.
+
+2010-06-17 Arnaud Charlet <charlet@adacore.com>
+
+ * gnatvsn.ads: Bump to 4.6 version.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): The
+ designated type of the generated pointer is the type of the original
+ expression, not that of the function call itself, because the return
+ type may be an untagged derived type and the function may be an
+ inherited operation.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb: Minor reformatting.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sinfo.ads, sinfo.adb (Inherited_Discriminant): New flag on
+ N_Component_Association nodes, to indicate that a component association
+ of an extension aggregate denotes the value of a discriminant of an
+ ancestor type that has been constrained by the derivation.
+ * sem_aggr.adb (Discr_Present): use Inherited_Discriminant to prevent a
+ double expansion of the aggregate appearing in a context that delays
+ expansion, to prevent double insertion of discriminant values when the
+ aggregate is reanalyzed.
+
+2010-06-17 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Do not use
+ Allocator as the Related_Node of Return_Obj_Access in call to
+ Make_Temporary below as this would create a sort of infinite
+ "recursion".
+
+2010-06-17 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_ugn.texi: Update gnatcheck doc.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Build_Incomplete_Type_Declaration): If there is an
+ incomplete view of the type that is not tagged, and the full type is a
+ tagged extension, create class_wide type now, and warn that the
+ incomplete view should be tagged as well.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * gnatcmd.adb (Non_VMS_Usage): Do not issue usage for gnat sync.
+ Update the last line of the usage, indicating what commands do not
+ accept project file switches.
+ * vms_conv.adb: Do not issue usage line for GNAT SYNC
+ * vms_data.ads: Fix errors in the qualifiers /LOGFILE and /MAIN of
+ GNAT ELIM.
+ * gnat_ugn.texi: Document the relaxed rules for library directories in
+ externally built library projects.
+
+2010-06-17 Doug Rupp <rupp@adacore.com>
+
+ * s-auxdec-vms_64.ads: Make boolean and arithmetic operations intrinsic
+ where possible.
+ * s-auxdec-vms-alpha.adb: Remove kludges for aforemention.
+ * gcc-interface/Makefile.in: Update VMS target pairs.
+
+2010-06-17 Vasiliy Fofanov <fofanov@adacore.com>
+
+ * adaint.c: Reorganized in order to avoid use of GetProcessId to stay
+ compatible with Windows NT 4.0 which doesn't provide this function.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * ali-util.adb (Time_Stamp_Mismatch): In Verbose mode, if there is
+ different timestamps but the checksum is the same, issue a short
+ message saying so.
+
+2010-06-17 Arnaud Charlet <charlet@adacore.com>
+
+ * s-interr.adb (Finalize): If the Abort_Task signal is set to system,
+ it means that we cannot reset interrupt handlers since this would
+ require potentially sending the abort signal to the Server_Task.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb: expand NOT for VMS types.
+ * sem_util.adb: Use OpenVMS_On_Target for IS_VMS_Operator.
+
+2010-06-17 Sergey Rybin <rybin@adacore.com>
+
+ * vms_data.ads: Add qualifier for '--no-elim-dispatch' gnatelim option.
+ * gnat_ugn.texi (gnatelim): add description for --no-elim-dispatch
+ option.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Expand_Call): Do not expand a call to an internal
+ protected operation if the subprogram has been eliminated.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Check_Library_Attributes): Allow the different
+ directories associated with a library to be any directory when the
+ library project is externally built.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Check): If switch -m is used, deallocate the memory that
+ may be allocated when computing the checksum.
+
+2010-06-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g-socthi-mingw.adb (C_Recvmsg): Add 'use type' clause for C.size_t;
+ (C_Sendmsg): Likewise.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb: Update comments.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * back_end.adb (Scan_Compiler_Arguments): Process last argument
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch3.adb, exp_ch6.adb, exp_smem.adb, exp_util.adb: Use Ekind_In.
+ * layout.adb, freeze.adb: Use Make_Temporary.
+
+2010-06-17 Jerome Lambourg <lambourg@adacore.com>
+
+ * exp_ch11.adb (Expand_N_Raise_Statement): Expand raise statements in
+ .NET/JVM normally as this is now perfectly supported by the backend.
+
+2010-06-17 Pascal Obry <obry@adacore.com>
+
+ * gnat_rm.texi: Fix minor typo, remove duplicate blank lines.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Collect_Arguments_And_Compile): Create include path file
+ only when -x is specified.
+ (Gnatmake): Ditto
+ * opt.ads (Use_Include_Path_File): New Boolean flag, initialized to
+ False.
+ * prj-env.adb (Set_Ada_Paths): New Boolean parameters Include_Path and
+ Objects_Path, defaulted to True. Only create include path file if
+ Include_Path is True, only create objects path file if Objects_Path is
+ True.
+ * prj-env.ads (Set_Ada_Paths): New Boolean parameters Include_Path and
+ Objects_Path, defaulted to True.
+ * switch-m.adb (Scan_Make_Switches): Set Use_Include_Path_File to True
+ when -x is used.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_disp.adb (Build_Interface_Thunk): Use base type of formal to
+ determine whether it has the controlling type, when the formal is an
+ access parameter.
+
+2010-06-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * s-crtl.ads (ssize_t): New type.
+ (read): Fix signature.
+ (write): Likewise.
+ * g-socthi.ads: Add 'with System.CRTL' clause. Remove ssize_t and
+ 'use type' directive for C.size_t, add one for System.CRTL.ssize_t.
+ (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t.
+ (C_Sendmsg): Likewise.
+ * g-socthi.adb (Syscall_Recvmsg): Likewise.
+ (Syscall_Sendmsg): Likewise.
+ (C_Recvmsg): Likewise.
+ (C_Sendmsg): Likewise.
+ * g-socthi-mingw.ads: Add 'with System.CRTL' clause. Remove ssize_t
+ and 'use type' directive for C.size_t, add one for System.CRTL.ssize_t.
+ (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t.
+ (C_Sendmsg): Likewise.
+ * g-socthi-mingw.adb (C_Recvmsg): Likewise.
+ (C_Sendmsg): Likewise.
+ * g-socthi-vms.ads: Add 'with System.CRTL' clause. Remove ssize_t and
+ 'use type' directive for C.size_t, add one for System.CRTL.ssize_t.
+ (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t.
+ (C_Sendmsg): Likewise.
+ * g-socthi-vms.adb (C_Recvmsg): Likewise.
+ (C_Sendmsg): Likewise.
+ * g-socthi-vxworks.ads Add 'with System.CRTL' clause. Remove ssize_t
+ and 'use type' directive for C.size_t, add one for System.CRTL.ssize_t.
+ (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t.
+ (C_Sendmsg): Likewise.
+ * g-socthi-vxworks.adb (C_Recvmsg): Likewise.
+ (C_Sendmsg): Likewise.
+ * g-sercom-linux.adb (Read): Use correct types to call 'read'.
+ (Write): Likewise to call 'write'.
+ * s-os_lib.adb (Read): Use correct type to call System.CRTL.read.
+ (Write): Use correct type to call System.CRTL.write.
+ * s-tasdeb.adb (Write): Likewise.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * prj-proc.adb (Copy_Package_Declarations): Change argument name
+ Naming_Restricted to Restricted. If Restricted is True, do not copy the
+ value of attribute Linker_Options.
+
+2010-06-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (push_stack, pop_stack): Delete.
+ (Case_Statement_to_gnu): Adjust.
+ (Loop_Statement_to_gnu): Likewise.
+ (Subprogram_Body_to_gnu): Likewise.
+ (Handled_Sequence_Of_Statements_to_gnu): Likewise.
+ (Compilation_Unit_to_gnu): Likewise.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * exp_fixd.adb, exp_imgv.adb, exp_intr.adb, exp_pakd.adb, exp_prag.adb,
+ exp_sel.adb, exp_util.adb, sem_ch10.adb, sem_ch12.adb, sem_ch13.adb,
+ sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch8.adb, sem_ch9.adb,
+ sem_dist.adb, sem_util.adb: Use Make_Temporary
+ * itypes.ads, tbuild.ads: Minor comment update
+ * exp_ch9.adb, exp_dist.adb: Minor reformatting
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * exp_imgv.adb, exp_ch7.ads: Minor reformatting.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch9.adb, exp_disp.adb, exp_dist.adb: Use Make_Temporary.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * sprint.adb (pg): Set Dump_Freeze_Null, to be consistent with -gnatdg.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch6.adb, exp_ch7.adb, exp_ch5.adb: Use Make_Temporary
+ * tbuild.ads (Make_Temporary): More comment updates
+ * tbuild.adb: Minor reformatting
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * checks.adb, exp_aggr.adb, exp_atag.adb, exp_attr.adb, exp_ch11.adb,
+ exp_ch3.adb, exp_ch4.adb: Minor code reorganization.
+ Use Make_Temporary.
+ * tbuild.ads, tbuild.adb (Make_Temporary): Clean up, use Entity_Id
+ instead of Node_Id.
+ (Make_Temporary): Add more extensive documentation
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * sem_intr.adb, sem_prag.adb, sem_res.adb, sem_type.adb, sem_util.adb,
+ sem_warn.adb, sem_eval.adb: Minor reformatting. Use Ekind_In.
+ (Set_Slice_Subtype): Explicitly freeze the slice's itype at the point
+ where the slice's actions are inserted.
+ (Decompose_Expr): Account for possible rewriting of slice bounds
+ resulting from side effects suppression caused by the above freezing,
+ so that folding of bounds is preserved by such rewriting.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * einfo.ads, einfo.adb (Get_Record_Representation_Clause): New function.
+ * freeze.adb (Freeze_Record_Type): Add call to
+ Check_Record_Representation_Clause.
+ * sem_ch13.adb (Check_Record_Representation_Clause): New function
+ (Analyze_Record_Representation_Clause): Split out overlap code into this
+ new function.
+ (Check_Component_Overlap): Moved inside
+ Check_Record_Representation_Clause.
+ * sem_ch13.ads (Check_Record_Representation_Clause): New function.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * back_end.adb, sem_res.adb, switch-c.adb, sem_scil.adb: Minor
+ reformatting.
+ * sem_attr.adb, sem_cat.adb, sem_disp.adb, sem_elab.adb, sem_elim.adb,
+ sem_eval.adb: Use Ekind_In
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb: better error message for illegal inherited discriminant
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * bindusg.adb: Remove lines for -A and -C
+ * gnat_ugn.texi: Remove all documentation and examples of switches -A
+ and -C for gnatbind and gnatlink.
+ * gnatlink.adb (Usage): Remove lines for -A and -C
+ * switch-b.adb (Scan_Binder_Switches): Issue warning when switch -C is
+ specified.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * back_end.adb (Scan_Compiler_Arguments): Put all arguments in new
+ local Argument_List variable Args.
+ * switch-c.adb (Scan_Front_End_Switches): New Argument_List argument
+ Args.
+ (Switch_Subsequently_Cancelled): New Argument_List argument Args. Look
+ for subsequent switches in Args.
+ * switch-c.ads (Scan_Front_End_Switches): New Argument_List argument
+ Args.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * einfo.adb: Minor code fix, allow E_Class_Wide_Type for
+ Equivalent_Type to match documentation.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb, sem_ch7.adb: Minor reformatting.
+ * sem_ch3.adb, sem_ch5.adb, sem_ch9.adb, sem_ch10.adb, sem_ch12.adb,
+ sem_ch4.adb, sem_ch8.adb, sem_ch13.adb: Make use of Ekind_In.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb (Set_Slice_Subtype): Always freeze the slice's itype.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * freeze.adb (Freeze_Expression): Short circuit operators are valid
+ freeze node insertion points.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * switch-c.ads, switch-c.adb, sem_ch13.adb: Minor reformatting.
+ * sem_ch12.adb: Add pragmas Assert and Check to previous change.
+
+2010-06-17 Gary Dismukes <dismukes@adacore.com>
+
+ * layout.adb (Layout_Type): Broaden test for setting an array type's
+ Component_Size to include all scalar types, not just discrete types
+ (components of real types were missed).
+ * sem_ch3.adb (Constrain_Index): Add missing setting of First_Literal
+ on the itype created for an index (consistent with Make_Index and
+ avoids possible Assert_Failures).
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * atree.ads, atree.adb: Add 6-parameter version of Ekind_In
+ * einfo.adb: Minor code reformatting (use Ekind_In)
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb (Test_Ref): Abandon scan if access subprogram parameter
+ found.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * back_end.adb: Minor comment updates
+ * switch-c.adb: Remove dependencies on gcc C sources
+ * gcc-interface/Make-lang.in: Add a-comlin.o to the object file list
+ for the compiler.
+
+2010-06-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb: propagate Pragma_Enabled flag to generic.
+ * get_scos.adb: Set C2 flag in decision entry of pragma to 'e' (enabled)
+ * par_sco.ads, par_sco.adb (Set_SCO_Pragma_Enabled): New procedure
+ Remove use of Node field in SCOs table
+ (Output_Header): Set 'd' to initially disable pragma entry
+ * put_scos.adb (Put_SCOs): New flag indicating if pragma is enabled
+ * scos.ads, scos.adb: Remove Node field from internal SCOs table.
+ Use C2 field of pragma decision header to indicate enabled.
+ * sem_prag.adb: Add calls to Set_SCO_Pragma_Enabled.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-17 Vincent Celier <celier@adacore.com>
+
+ * back_end.adb (Next_Arg): Moved to procedure Scan_Compiler_Arguments
+ (Scan_Compiler_Arguments): Call Scan_Front_End_Switches with Next_Arg
+ (Switch_Subsequently_Cancelled): Function moved to the body of Switch.C
+ * back_end.ads (Scan_Front_End_Switches): Function moved to the body of
+ Switch.C.
+ * switch-c.adb: Copied a number of global declarations from back_end.adb
+ (Len_Arg): New function copied from back_end.adb
+ (Switch_Subsequently_Cancelled): New function moved from back_end.adb
+ (Scan_Front_End_Switches): New parameter Arg_Rank used to call
+ Switch_Subsequently_Cancelled.
+ * switch-c.ads (Scan_Front_End_Switches): New parameter Arg_Rank.
+ * gcc-interface/Makefile.in: Add line so that shared libgnat is linked
+ with -lexc on Tru64.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * prj.ads, prj.adb: Minor reformatting
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * put_scos.adb: Do not generate a blank line in SCOs when omitting the
+ CP line for a disabled pragma.
+
+2010-06-17 Emmanuel Briot <briot@adacore.com>
+
+ * prj-proc.adb, prj.adb, prj.ads (Check_Or_Set_Typed_Variable): New
+ subprogram.
+ (Process_Declarative_Item): An invalid value in an typed variable
+ declaration is no longer always fatal.
+
+2010-06-16 Arnaud Charlet <charlet@adacore.com>
+
+ * get_scos.adb, par_sco.adb, par_sco.ads, put_scos.adb, scos.adb,
+ scos.ads, exp_ch4.adb, sem_warn.adb: Code clean up, update
+ documentation.
+
+2010-06-16 Javier Miranda <miranda@adacore.com>
+
+ * exp_disp.adb (Expand_Dispatching_Call): Adjust the decoration of the
+ node referenced by the SCIL node of dispatching "=" to skip the tags
+ comparison.
+
+2010-06-16 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch5.adb (Analyze_Exit_Statement): Return if no enclosing loop,
+ to prevent cascaded errors and compilation aborts.
+
+2010-06-16 Robert Dewar <dewar@adacore.com>
+
+ * back_end.adb (Switch_Subsequently_Cancelled): New function
+ Move declarations to package body level to support this change
+ * back_end.ads (Switch_Subsequently_Cancelled): New function
+ * gnat_ugn.texi: Document -gnat-p switch
+ * switch-c.adb (Scan_Front_End_Switches): Implement -gnat-p switch
+ * ug_words: Add entry for -gnat-p (UNSUPPRESS_ALL)
+ * usage.adb: Add line for -gnat-p switch
+ * vms_data.ads: Add entry for UNSUPPRESS_ALL (-gnat-p)
+
+2010-06-16 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb (Check_Infinite_Loop_Warning): Declaration counts as
+ modification.
+
+2010-06-16 Robert Dewar <dewar@adacore.com>
+
+ * exp_disp.adb: Minor reformatting
+
+2010-06-16 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Complete_Private_Subtype): Inherit class_wide type from
+ base type only if it was not previously created for the partial view.
+
+2010-06-16 Thomas Quinot <quinot@adacore.com>
+
+ * tbuild.ads: Minor comment fix
+
+2010-06-15 Nathan Froyd <froydnj@codesourcery.com>
+
+ * gcc-interface/trans.c (gnu_stack_free_list): Delete.
+ (gnu_except_ptr_stack): Change type to VEC. Update comment.
+ (gnu_elab_proc_stack): Likewise.
+ (gnu_return_label_stack): Likewise.
+ (gnu_loop_label_stack): Likewise.
+ (gnu_switch_label_stack): Likewise.
+ (gnu_constraint_label_stack): Likewise.
+ (gnu_storage_error_label_stack): Likewise.
+ (gnu_program_error_label_stack): Likewise.
+ (push_exception_label_stack): Take a VEC ** instead of a tree *.
+ (push_stack): Likewise. Remove unused second parameter. Update
+ callers.
+ (pop_stack): Take a VEC * instead of a tree *. Update callers.
+ (gigi): Initialize stacks as VECs.
+ (Identifier_to_gnu): Use VEC_last instead of TREE_VALUE.
+ (Case_Statement_to_gnu): Likewise.
+ (Subprogram_Body_to_gnu): Likewise.
+ (call_to_gnu): Likewise.
+ (Exception_Handler_to_gnu_sjlj): Likewise.
+ (gnat_to_gnu): Likewise.
+ (get_exception_label): Likewise.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Record_Type): if derived type is an
+ anonymous base generated when the parent is a constrained discriminated
+ type, propagate interface list to first subtype because it may appear
+ in a current instance within the extension part of the derived type
+ declaration, and its own subtype declaration has not been elaborated
+ yet.
+ * exp_disp.adb (Build_Interface_Thunk): Use base type of formal to
+ determine whether it has the controlling type.
+
+2010-06-14 Jerome Lambourg <lambourg@adacore.com>
+
+ * exp_ch11.adb (Expand_N_Raise_Statement): Make sure that the explicit
+ raise of CE, SE and PE have the reason correctly set and are properly
+ expanded before stopping the expansions of .NET/JVM exceptions.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * opt.ads (Check_Policy_List): Add some clarifying comments
+ * sem_prag.adb (Analyze_Pragma, case Check): Set Pragma_Enabled flag
+ on rewritten Assert pragma.
+
+2010-06-14 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch6.adb (Check_Overriding_Indicator): Add a special check for
+ controlled operations, so that they will be treated as overriding even
+ if the overridden subprogram is marked Is_Hidden, as long as the
+ overridden subprogram's parent subprogram is not hidden.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * debug.adb: Entry for gnatw.d no longer specific for while loops
+ * einfo.adb (First_Exit_Statement): New attribute for E_Loop
+ * einfo.ads (First_Exit_Statement): New attribute for E_Loop
+ * sem_ch5.adb (Analyze_Loop_Statement): Check_Infinite_Loop_Warning has
+ new calling sequence to include test for EXIT WHEN.
+ (Analyze_Exit_Statement): Chain EXIT statement into exit statement chain
+ * sem_warn.ads, sem_warn.adb (Check_Infinite_Loop_Warning): Now handles
+ EXIT WHEN case.
+ * sinfo.adb (Next_Exit_Statement): New attribute of N_Exit_Statement
+ node.
+ * sinfo.ads (N_Pragma): Correct comment on Sloc field (points to
+ PRAGMA, not to pragma identifier).
+ (Next_Exit_Statement): New attribute of N_Exit_Statement node
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * sem_res.adb (Resolve_Short_Circuit): Fix sloc of "assertion/check
+ would fail" msg.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * par-ch2.adb (Scan_Pragma_Argument_Association): Clarify message for
+ missing pragma argument identifier.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * atree.ads, atree.adb (Ekind_In): New functions.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Op_Expon): Optimize 2**N in stand alone context
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * usage.adb (Usage): Redo documentation of -gnatwa.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Find_Type): The attribute 'class cannot be applied to
+ an untagged incomplete type that is a limited view.
+
+2010-06-14 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi: Add description of '-cargs gcc_switches' to gnatstub
+ and gnatppa.
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch4.adb (Expand_Short_Circuit_Operator): New subprogram,
+ factoring duplicated code between...
+ (Expand_N_And_Than, Expand_N_Or_Else): Remove duplicated code.
+ * a-envvar.ads: Minor reformatting
+
+2010-06-14 Arnaud Charlet <charlet@adacore.com>
+
+ * ali.adb, ali.ads, lib-xref.ads: Document new '+' letter for C/C++
+ static entities.
+ (Scan_ALI): Take into account new Visibility field.
+ (Visibility_Kind): New type.
+ (Xref_Entity_Record): Replace Lib field by Visibility.
+
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-14 Pascal Obry <obry@adacore.com>
+
+ * raise.h: Remove unused defintions.
+
+2010-06-14 Bob Duff <duff@adacore.com>
+
+ * par-ch10.adb (P_Subunit): If the next token after "separate(X)" is
+ Tok_Not or Tok_Overriding, call P_Subprogram. We had previously given
+ the incorrect error "proper body expected".
+ * par-ch6.adb (P_Subprogram): Suppress "overriding indicator not
+ allowed here" error in case of subunits, which was triggered by the
+ above change to P_Subunit.
+
+2010-06-14 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi, vms_data.ads: Update gnatelim doc.
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * lib-util.adb: Minor code reorganization.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * ali.adb (Scan_ALI): Implement reading and storing of N lines
+ (Known_ALI_Lines): Add entry for 'N' (notes)
+ * ali.ads (Notes): New table to store Notes information
+ * alloc.ads: Add entries for Notes table
+ * lib-util.adb (Write_Info_Int): New procedure
+ (Write_Info_Slit): New procedure
+ (Write_Info_Uint): New procedure
+ * lib-util.ads (Write_Info_Int): New procedure
+ (Write_Info_Slit): New procedure
+ (Write_Info_Uint): New procedure
+ * lib-writ.adb (Write_Unit_Information): Output N (notes) lines
+ * lib-writ.ads: Update documentation for N (Notes) lines
+ * lib.adb (Store_Note): New procedure
+ * lib.ads (Notes): New table
+ (Store_Note): New procedure
+ * sem_prag.adb: Call Store_Note for affected pragmas
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * socket.c: Fix wrong condition in #ifdef
+ * g-socket.adb, g-sothco.ads: Functions imported from socket.c that
+ take or return char* values can't use Interfaces.C.Strings.chars_ptr,
+ because on VMS this type is a 32-bit pointer which is not compatible
+ with the default for C pointers for code compiled with gcc on that
+ platform.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util (Is_VMS_Operator): New predicate to determine whether an
+ operator is an intrinsic operator declared in the DEC system extension.
+ * sem_res.adb (Resolve_Logical_Op): operation is legal on signed types
+ if the operator is a VMS intrinsic.
+ * sem_eval.adb (Eval_Logical_Op): Operation is legal and be
+ constant-folded if the operands are signed and the operator is a VMS
+ intrinsic.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * g-socket.adb, gnatcmd.adb: Minor reformatting.
+
+2010-06-14 Pascal Obry <obry@adacore.com>
+
+ * s-finimp.adb: Fix typo.
+ * raise.h: Remove duplicate blank line.
+
+2010-06-14 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Add_Sources): Always set the object file and the
+ switches file names, as the configuration of the language may change
+ in an extending project.
+ (Process_Naming_Scheme): For sources of projects that are extended, set
+ the configuration of the language from the highest extending project
+ where the language is declared.
+
+2010-06-14 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_res.adb (Resolve_Call): For infinite recursion check, test
+ whether the called subprogram is inherited from a containing subprogram.
+ (Same_Or_Aliased_Subprograms): New function
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (End_Use_Type): Before indicating that an operator is not
+ use-visible, check whether it is a primitive for more than one type.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb (Copy_And_Swap): Copy Has_Pragma_Unmodified flag.
+
+ * sem_ch7.adb (Preserve_Full_Attributes): Preserve
+ Has_Pragma_Unmodified flag.
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * g-sttsne-locking.adb, g-sttsne-locking.ads, g-sttsne.ads,
+ g-sttsne-vxworks.adb, g-sttsne-dummy.ads: Removed. Mutual exclusion is
+ now done in GNAT.Sockets if necessary.
+ * gsocket.h, g-socket.adb, g-sothco.ads (GNAT.Sockets.Get_XXX_By_YYY):
+ Ensure mutual exclusion for netdb operations if the target platform
+ requires it.
+ (GNAT.Sockets.Thin_Common): New binding for getXXXbyYYY, treating struct
+ hostent as an opaque type to improve portability.
+ * s-oscons-tmplt.c, socket.c: For the case of Vxworks, emulate
+ gethostbyYYY using proprietary VxWorks API so that a uniform interface
+ is available for the Ada side.
+ * gcc-interface/Makefile.in: Remove g-sttsne-*
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-14 Vincent Celier <celier@adacore.com>
+
+ * gnatcmd.adb (Mapping_File): New function.
+
+2010-06-14 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Derive_Subprograms): Remove over-restrictive assertion.
+
+2010-06-14 Arnaud Charlet <charlet@adacore.com>
+
+ * ali.adb: Fix typo.
+ * s-auxdec-vms-alpha.adb, scng.ads: Minor reformatting.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb: Make Mark_Context transitive, and apply to subprogram
+ instances.
+
+ * sem_ch8.adb (Find_Expanded_Name): If a candidate compilation unit in
+ the context does not have a homonym of the selector, emit default
+ error message.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * sem.adb, sem_ch12.adb, sem_util.adb: Minor reformatting and
+ comment addition.
+
+2010-06-14 Arnaud Charlet <charlet@adacore.com>
+
+ * lib-xref.ads: Doc updates:
+ - Allocate 'Q' for #include entity kind
+ - Free 'Z'
+ - Allocate 'g' for regular macros
+ - Allocate 'G' for function-like macros
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sinfo.ads, sinfo.adb (Withed_Body): New attribute of a with_clause.
+ Indicates that there is an instantiation in the current unit that
+ loaded the body of the unit denoted by the with_clause.
+ * sem_ch12.adb (Mark_Context): When instanting a generic body, check
+ whether a with_clause in the current context denotes the unit that
+ holds the generic declaration, and mark the with_clause accordingly.
+ (Instantiate_Package_Body): call Mark_Context.
+ * sem.adb (Process_Bodies_In_Context): Use Withed_Body to determine
+ whether a given body should be traversed before the spec of the main
+ unit.
+
+2010-06-14 Ed Falis <falis@adacore.com>
+
+ * sysdep.c: Fix 653 build against vThreads headers.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * sinfo.ads: Minor reformatting.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Analyze_Subprogram_Body): Do not check conformance when
+ the spec has been generated for a body without spec that carries an
+ Inline_Always pragma.
+
+2010-06-14 Arnaud Charlet <charlet@adacore.com>
+
+ * lib-xref.ads: Documentation change: allocate 'Z' letter to C/C++
+ macro.
+
+2010-06-14 Jerome Lambourg <lambourg@adacore.com>
+
+ * exp_dbug.adb (Debug_Renaming_Declaration): Do not output any debug
+ declaration for VMs, as those are useless and might lead to duplicated
+ local variable names in the generated code.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * opt.ads, sem.adb, sem_elab.adb: Minor reformatting
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * exp_aggr.adb (Has_Address_Clause): Moved to Exp_Util, and there it
+ is renamed as Has_Following_Address_Clause.
+ * exp_ch3.adb (Needs_Simple_Initialization): Add Consider_IS argument
+ to allow the caller to avoid Initialize_Scalars having an effect.
+ (Expand_N_Object_Declaration): Do not do Initialize_Scalars stuff for
+ scalars with an address clause specified.
+ * exp_ch3.ads (Needs_Simple_Initialization): Add Consider_IS argument
+ to allow the caller to avoid Initialize_Scalars having an effect.
+ * exp_util.adb (Has_Following_Address_Clause): Moved here from Exp_Aggr
+ (where it was called Has_Address_Clause).
+ * exp_util.ads (Has_Following_Address_Clause): Moved here from Exp_Aggr
+ (where it was called Has_Address_Clause).
+ * freeze.adb (Warn_Overlay): Suppress message about overlaying causing
+ problems for Initialize_Scalars (since we no longer initialize objects
+ with an address clause.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * exp_prag.adb (Expand_Pragma_Check): Set Loc of generated code from
+ condition.
+
+2010-06-14 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Set Debug_Info_Needed
+ on the entity of an implicitly generated postcondition procedure.
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch7.adb (Preserve_Full_Attributes): Propagate
+ Discriminant_Constraint elist from full view to private view.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * sem_res.adb: Minor reformatting.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem.adb: New version of unit traversal.
+
+ * sem_elab.adb (Check_Internal_Call): Do not place a call appearing
+ within a generic unit in the table of delayed calls.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * gnatcmd.adb, sem_util.adb, exp_ch3.adb: Minor reformatting
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Save_References): If an identifier has been rewritten
+ during analysis as an explicit dereference, keep the reference implicit
+ in the generic, but preserve the entity if global. This prevents
+ malformed generic trees in the presence of some nested generics.
+
+2010-06-14 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi: For the GNAT driver, clarify the effect of calling the
+ tool with '-files=' option. Also fix some small errors (wrong brackets)
+
+2010-06-14 Vincent Celier <celier@adacore.com>
+
+ * gnatbind.adb: Call Scan_ALI with Directly_Scanned set to True for all
+ the ALI files on the command line.
+
+ * ali.adb (Scan_ALI): Set component Directly_Scanned of the unit(s) to
+ the same value as the parameter of the same name.
+ * ali.ads (Scan_ALI): New Boolean parameter Directly_Scanned, defaulted
+ to False.
+ * bindgen.adb (Gen_Versions_Ada): Never emit version symbols for
+ Stand-Alone Library interfaces. When binding Stand-Alone Libraries,
+ emit version symbols only for the units of the library.
+ (Gen_Versions_C): Ditto.
+
+2010-06-14 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch4.adb: Fix typo.
+
+2010-06-14 Vasiliy Fofanov <fofanov@adacore.com>
+
+ * s-oscons-tmplt.c (IOV_MAX): redefine on Tru64 and VMS since the
+ vector IO doesn't work at default value properly.
+
+2010-06-14 Doug Rupp <rupp@adacore.com>
+
+ * s-stoele.adb: Remove unnecessary qualification of To_Address for VMS.
+
+2010-06-14 Vincent Celier <celier@adacore.com>
+
+ * gnatcmd.adb (Check_Files): Do not invoke the tool with all the
+ sources of the project if a switch -files= is used.
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * exp_attr.adb: Minor reformatting.
+
+2010-06-14 Gary Dismukes <dismukes@adacore.com>
+
+ * gnat_ugn.texi: Minor typo fixes and wording changes.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Analyze_One_Call): If the call has been rewritten from a
+ prefixed form, do not re-analyze first actual, which may need an
+ implicit dereference.
+ * sem_ch6.adb (Analyze_Procedure_Call): If the call is given in
+ prefixed notation, the analysis will rewrite the node, and possible
+ errors appear in the rewritten name of the node.
+ * sem_res.adb: If a call is ambiguous because its first parameter is
+ an overloaded call, report list of candidates, to clarify ambiguity of
+ enclosing call.
+
+2010-06-14 Doug Rupp <rupp@adacore.com>
+
+ * s-auxdec-vms-alpha.adb: New package body implementing legacy
+ VAX instructions with Asm insertions.
+ * s-auxdec-vms_64.ads: Inline VAX queue functions
+ * s-stoele.adb: Resolve some ambiguities in To_Addresss with s-suxdec
+ that show up only on VMS.
+ * gcc-interface/Makefile.in: Provide translation for
+ s-auxdec-vms-alpha.adb.
+
+2010-06-14 Olivier Hainque <hainque@adacore.com>
+
+ * initialize.c (VxWorks section): Update comments.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * a-convec.adb, sem_prag.adb, checks.adb: Minor reformatting.
+
+2010-06-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * init.c: Code clean up.
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case Address): Do
+ not insert address clause in table for later validation if type of
+ entity is generic, to prevent possible spurious errors.
+
+ * sem_ch8.adb: Code clean up.
+
+2010-06-14 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_ugn.texi: Expanded @ovar macro inline to solve problem with
+ texi2pdf and texi2html.
+ Document how to change scheduling properties on HP-UX.
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * g-socket.ads: Remove misleading comments.
+
+2010-06-14 Jerome Lambourg <lambourg@adacore.com>
+
+ * sem_prag.adb (Check_Duplicated_Export_Name): Remove check for
+ CLI_Target as this prevents proper detection of exported names
+ duplicates when the exported language is different to CIL.
+ (Process_Interface_Name): Add check for CIL convention exports,
+ replacing the old one from Check_Duplicated_Export_Name.
+
+2010-06-14 Matthew Heaney <heaney@adacore.com>
+
+ * a-coinve.adb, a-convec.adb (operator "&"): Check both that new length
+ and new last satisfy constraints.
+ (Delete_Last): prevent overflow for subtraction of index values
+ (To_Vector): prevent overflow for addition of index values
+
+2010-06-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Complete_Object_Operation): After analyzing the
+ rewritten call, preserve the resulting type to prevent spurious errors,
+ when the call is implicitly dereferenced in the context of an in-out
+ actual.
+
+ * checks.adb (Apply_Discriminant_Check): If the target of the
+ assignment is a renaming of a heap object, create constrained type for
+ it to apply check.
+
+2010-06-14 Pascal Obry <obry@adacore.com>
+
+ * prj-proc.adb: Fix copy of object directory for extending projects.
+
+2010-06-14 Jose Ruiz <ruiz@adacore.com>
+
+ * init.c (__gnat_alternate_stack): Define this space for PowerPC linux
+ (__gnat_install_handler, PowerPC linux): Activate the alternative
+ signal stack.
+
+2010-06-13 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * gnat_rm.texi: Move to GFDL version 1.3.
+ * gnat-style.texi: Ditto.
+ * gnat_ugn.texi: Ditto.
+
+2010-06-12 Kai Tietz
+
+ PR ada/43731
+ * gcc-interface/Makefile.in: Add rules for multilib x86/x64
+ mingw targets.
+
+2010-06-11 Alexandre Oliva <aoliva@redhat.com>
+
+ * gcc-interface/utils.c (update_pointer_to): Initialize last.
+
+2010-06-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/ada-tree.h: Fix formatting nits.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC
+ allocation.
+ (init_dummy_type): Likewise.
+ (gnat_pushlevel): Likewise.
+
+ * gcc-interface/trans.c (Attribute_to_gnu): Likewise.
+ (Subprogram_Body_to_gnu): Likewise.
+ (Compilation_Unit_to_gnu): Likewise.
+ (start_stmt_group): Likewise.
+ (extract_encoding): Likewise.
+ (decode_name): Likewise.
+
+ * gcc-interface/misc.c (gnat_printable_name): Likewise.
+
+ * gcc-interface/decl.c (annotate_value): Likewise.
+
+ * gcc-interface/ada-tree.h (struct lang_type): Add variable_size
+ GTY option.
+ (struct lang_decl): Likewise.
+ (SET_TYPE_LANG_SPECIFIC): Use typed GC allocation.
+ (SET_DECL_LANG_SPECIFIC): Likewise.
+
+2010-06-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnatlink.adb (gnatlink): Remove support for -fsjlj switch.
+ * gcc-interface/lang-specs.h: Likewise.
+
+2010-06-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c++/44294
+ * gcc-interface/decl.c (MAX_FIXED_MODE_SIZE): Removed.
+
2010-06-01 Arnaud Charlet <charlet@adacore.com>
* gnat_ugn.texi: Improve doc on -fdump-ada-spec, mention limitations.
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index f101a52e025..6e7d4eba44a 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1,5 +1,5 @@
# Makefile.rtl for GNU Ada Compiler (GNAT).
-# Copyright (C) 2003-2008, Free Software Foundation, Inc.
+# Copyright (C) 2003-2010, Free Software Foundation, Inc.
#This file is part of GCC.
@@ -211,6 +211,7 @@ GNATRTL_NONTASKING_OBJS= \
a-ststio$(objext) \
a-stunau$(objext) \
a-stunha$(objext) \
+ a-stuten$(objext) \
a-stwibo$(objext) \
a-stwifi$(objext) \
a-stwiha$(objext) \
@@ -225,6 +226,9 @@ GNATRTL_NONTASKING_OBJS= \
a-stzsea$(objext) \
a-stzsup$(objext) \
a-stzunb$(objext) \
+ a-suenco$(objext) \
+ a-suewen$(objext) \
+ a-suezen$(objext) \
a-suteio$(objext) \
a-swbwha$(objext) \
a-swfwha$(objext) \
@@ -359,6 +363,8 @@ GNATRTL_NONTASKING_OBJS= \
g-io$(objext) \
g-io_aux$(objext) \
g-locfil$(objext) \
+ g-mbdira$(objext) \
+ g-mbflra$(objext) \
g-md5$(objext) \
g-memdum$(objext) \
g-moreex$(objext) \
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 84ad22ec1f9..6443644b4f6 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2010, 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- --
@@ -33,9 +33,6 @@ with System; use type System.Address;
package body Ada.Containers.Indefinite_Vectors is
- type Int is range System.Min_Int .. System.Max_Int;
- type UInt is mod System.Max_Binary_Modulus;
-
procedure Free is
new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access);
@@ -47,10 +44,22 @@ package body Ada.Containers.Indefinite_Vectors is
---------
function "&" (Left, Right : Vector) return Vector is
- LN : constant Count_Type := Length (Left);
- RN : constant Count_Type := Length (Right);
+ LN : constant Count_Type := Length (Left);
+ RN : constant Count_Type := Length (Right);
+ N : Count_Type'Base; -- length of result
+ J : Count_Type'Base; -- for computing intermediate values
+ Last : Index_Type'Base; -- Last index of result
begin
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the vector parameters. We could decide to make it larger, but we
+ -- have no basis for knowing how much larger, so we just allocate the
+ -- minimum amount of storage.
+
+ -- Here we handle the easy cases first, when one of the vector
+ -- parameters is empty. (We say "easy" because there's nothing to
+ -- compute, that can potentially overflow.)
+
if LN = 0 then
if RN = 0 then
return Empty_Vector;
@@ -64,6 +73,11 @@ package body Ada.Containers.Indefinite_Vectors is
new Elements_Type (Right.Last);
begin
+ -- Elements of an indefinite vector are allocated, so we cannot
+ -- use simple slice assignment to give a value to our result.
+ -- Hence we must walk the array of the Right vector, and copy
+ -- each source element individually.
+
for I in Elements.EA'Range loop
begin
if RE (I) /= null then
@@ -95,6 +109,11 @@ package body Ada.Containers.Indefinite_Vectors is
new Elements_Type (Left.Last);
begin
+ -- Elements of an indefinite vector are allocated, so we cannot
+ -- use simple slice assignment to give a value to our result.
+ -- Hence we must walk the array of the Left vector, and copy
+ -- each source element individually.
+
for I in Elements.EA'Range loop
begin
if LE (I) /= null then
@@ -116,83 +135,162 @@ package body Ada.Containers.Indefinite_Vectors is
end;
end if;
- declare
- N : constant Int'Base := Int (LN) + Int (RN);
- Last_As_Int : Int'Base;
+ -- Neither of the vector parameters is empty, so we must compute the
+ -- length of the result vector and its last index. (This is the harder
+ -- case, because our computations must avoid overflow.)
- begin
- if Int (No_Index) > Int'Last - N then
+ -- There are two constraints we need to satisfy. The first constraint is
+ -- that a container cannot have more than Count_Type'Last elements, so
+ -- we must check the sum of the combined lengths. Note that we cannot
+ -- simply add the lengths, because of the possibilty of overflow.
+
+ if LN > Count_Type'Last - RN then
+ raise Constraint_Error with "new length is out of range";
+ end if;
+
+ -- It is now safe compute the length of the new vector.
+
+ N := LN + RN;
+
+ -- The second constraint is that the new Last index value cannot
+ -- exceed Index_Type'Last. We use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate values.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (N) < No_Index then
raise Constraint_Error with "new length is out of range";
end if;
- Last_As_Int := Int (No_Index) + N;
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
+
+ Last := No_Index + Index_Type'Base (N);
- if Last_As_Int > Int (Index_Type'Last) then
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
+
+ if Last > Index_Type'Last then
raise Constraint_Error with "new length is out of range";
end if;
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ elsif Index_Type'First <= 0 then
- LE : Elements_Array renames
- Left.Elements.EA (Index_Type'First .. Left.Last);
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of length.
- RE : Elements_Array renames
- Right.Elements.EA (Index_Type'First .. Right.Last);
+ J := Count_Type'Base (No_Index) + N; -- Last
- Elements : Elements_Access := new Elements_Type (Last);
+ if J > Count_Type'Base (Index_Type'Last) then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- I : Index_Type'Base := No_Index;
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
- begin
- for LI in LE'Range loop
- I := I + 1;
+ Last := Index_Type'Base (J);
- begin
- if LE (LI) /= null then
- Elements.EA (I) := new Element_Type'(LE (LI).all);
- end if;
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
- exception
- when others =>
- for J in Index_Type'First .. I - 1 loop
- Free (Elements.EA (J));
- end loop;
+ J := Count_Type'Base (Index_Type'Last) - N; -- No_Index
- Free (Elements);
- raise;
- end;
- end loop;
+ if J < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- for RI in RE'Range loop
- I := I + 1;
+ -- We have determined that the result length would not create a Last
+ -- index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
- begin
- if RE (RI) /= null then
- Elements.EA (I) := new Element_Type'(RE (RI).all);
- end if;
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + N);
+ end if;
- exception
- when others =>
- for J in Index_Type'First .. I - 1 loop
- Free (Elements.EA (J));
- end loop;
+ declare
+ LE : Elements_Array renames
+ Left.Elements.EA (Index_Type'First .. Left.Last);
- Free (Elements);
- raise;
- end;
- end loop;
+ RE : Elements_Array renames
+ Right.Elements.EA (Index_Type'First .. Right.Last);
- return (Controlled with Elements, Last, 0, 0);
- end;
+ Elements : Elements_Access := new Elements_Type (Last);
+
+ I : Index_Type'Base := No_Index;
+
+ begin
+ -- Elements of an indefinite vector are allocated, so we cannot use
+ -- simple slice assignment to give a value to our result. Hence we
+ -- must walk the array of each vector parameter, and copy each source
+ -- element individually.
+
+ for LI in LE'Range loop
+ I := I + 1;
+
+ begin
+ if LE (LI) /= null then
+ Elements.EA (I) := new Element_Type'(LE (LI).all);
+ end if;
+
+ exception
+ when others =>
+ for J in Index_Type'First .. I - 1 loop
+ Free (Elements.EA (J));
+ end loop;
+
+ Free (Elements);
+ raise;
+ end;
+ end loop;
+
+ for RI in RE'Range loop
+ I := I + 1;
+
+ begin
+ if RE (RI) /= null then
+ Elements.EA (I) := new Element_Type'(RE (RI).all);
+ end if;
+
+ exception
+ when others =>
+ for J in Index_Type'First .. I - 1 loop
+ Free (Elements.EA (J));
+ end loop;
+
+ Free (Elements);
+ raise;
+ end;
+ end loop;
+
+ return (Controlled with Elements, Last, 0, 0);
end;
end "&";
function "&" (Left : Vector; Right : Element_Type) return Vector is
- LN : constant Count_Type := Length (Left);
-
begin
- if LN = 0 then
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the parameters. We could decide to make it larger, but we have no
+ -- basis for knowing how much larger, so we just allocate the minimum
+ -- amount of storage.
+
+ -- Here we handle the easy case first, when the vector parameter (Left)
+ -- is empty.
+
+ if Left.Is_Empty then
declare
Elements : Elements_Access := new Elements_Type (Index_Type'First);
@@ -209,70 +307,75 @@ package body Ada.Containers.Indefinite_Vectors is
end;
end if;
- declare
- Last_As_Int : Int'Base;
-
- begin
- if Int (Index_Type'First) > Int'Last - Int (LN) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ -- The vector parameter is not empty, so we must compute the length of
+ -- the result vector and its last index, but in such a way that overflow
+ -- is avoided. We must satisfy two constraints: the new length cannot
+ -- exceed Count_Type'Last, and the new Last index cannot exceed
+ -- Index_Type'Last.
- Last_As_Int := Int (Index_Type'First) + Int (LN);
-
- if Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
-
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
-
- LE : Elements_Array renames
- Left.Elements.EA (Index_Type'First .. Left.Last);
+ if Left.Length = Count_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- Elements : Elements_Access :=
- new Elements_Type (Last);
+ if Left.Last >= Index_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- begin
- for I in LE'Range loop
- begin
- if LE (I) /= null then
- Elements.EA (I) := new Element_Type'(LE (I).all);
- end if;
+ declare
+ Last : constant Index_Type := Left.Last + 1;
- exception
- when others =>
- for J in Index_Type'First .. I - 1 loop
- Free (Elements.EA (J));
- end loop;
+ LE : Elements_Array renames
+ Left.Elements.EA (Index_Type'First .. Left.Last);
- Free (Elements);
- raise;
- end;
- end loop;
+ Elements : Elements_Access :=
+ new Elements_Type (Last);
+ begin
+ for I in LE'Range loop
begin
- Elements.EA (Last) := new Element_Type'(Right);
+ if LE (I) /= null then
+ Elements.EA (I) := new Element_Type'(LE (I).all);
+ end if;
exception
when others =>
- for J in Index_Type'First .. Last - 1 loop
+ for J in Index_Type'First .. I - 1 loop
Free (Elements.EA (J));
end loop;
Free (Elements);
raise;
end;
+ end loop;
+
+ begin
+ Elements.EA (Last) := new Element_Type'(Right);
+
+ exception
+ when others =>
+ for J in Index_Type'First .. Last - 1 loop
+ Free (Elements.EA (J));
+ end loop;
- return (Controlled with Elements, Last, 0, 0);
+ Free (Elements);
+ raise;
end;
+
+ return (Controlled with Elements, Last, 0, 0);
end;
end "&";
function "&" (Left : Element_Type; Right : Vector) return Vector is
- RN : constant Count_Type := Length (Right);
-
begin
- if RN = 0 then
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the parameters. We could decide to make it larger, but we have no
+ -- basis for knowing how much larger, so we just allocate the minimum
+ -- amount of storage.
+
+ -- Here we handle the easy case first, when the vector parameter (Right)
+ -- is empty.
+
+ if Right.Is_Empty then
declare
Elements : Elements_Access := new Elements_Type (Index_Type'First);
@@ -289,66 +392,76 @@ package body Ada.Containers.Indefinite_Vectors is
end;
end if;
- declare
- Last_As_Int : Int'Base;
-
- begin
- if Int (Index_Type'First) > Int'Last - Int (RN) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ -- The vector parameter is not empty, so we must compute the length of
+ -- the result vector and its last index, but in such a way that overflow
+ -- is avoided. We must satisfy two constraints: the new length cannot
+ -- exceed Count_Type'Last, and the new Last index cannot exceed
+ -- Index_Type'Last.
- Last_As_Int := Int (Index_Type'First) + Int (RN);
+ if Right.Length = Count_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- if Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ if Right.Last >= Index_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ declare
+ Last : constant Index_Type := Right.Last + 1;
- RE : Elements_Array renames
- Right.Elements.EA (Index_Type'First .. Right.Last);
+ RE : Elements_Array renames
+ Right.Elements.EA (Index_Type'First .. Right.Last);
- Elements : Elements_Access :=
- new Elements_Type (Last);
+ Elements : Elements_Access :=
+ new Elements_Type (Last);
- I : Index_Type'Base := Index_Type'First;
+ I : Index_Type'Base := Index_Type'First;
+ begin
begin
+ Elements.EA (I) := new Element_Type'(Left);
+ exception
+ when others =>
+ Free (Elements);
+ raise;
+ end;
+
+ for RI in RE'Range loop
+ I := I + 1;
+
begin
- Elements.EA (I) := new Element_Type'(Left);
+ if RE (RI) /= null then
+ Elements.EA (I) := new Element_Type'(RE (RI).all);
+ end if;
+
exception
when others =>
+ for J in Index_Type'First .. I - 1 loop
+ Free (Elements.EA (J));
+ end loop;
+
Free (Elements);
raise;
end;
+ end loop;
- for RI in RE'Range loop
- I := I + 1;
-
- begin
- if RE (RI) /= null then
- Elements.EA (I) := new Element_Type'(RE (RI).all);
- end if;
-
- exception
- when others =>
- for J in Index_Type'First .. I - 1 loop
- Free (Elements.EA (J));
- end loop;
-
- Free (Elements);
- raise;
- end;
- end loop;
-
- return (Controlled with Elements, Last, 0, 0);
- end;
+ return (Controlled with Elements, Last, 0, 0);
end;
end "&";
function "&" (Left, Right : Element_Type) return Vector is
begin
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the parameters. We could decide to make it larger, but we have no
+ -- basis for knowing how much larger, so we just allocate the minimum
+ -- amount of storage.
+
+ -- We must compute the length of the result vector and its last index,
+ -- but in such a way that overflow is avoided. We must satisfy two
+ -- constraints: the new length cannot exceed Count_Type'Last (here, we
+ -- know that that condition is satisfied), and the new Last index cannot
+ -- exceed Index_Type'Last.
+
if Index_Type'First >= Index_Type'Last then
raise Constraint_Error with "new length is out of range";
end if;
@@ -541,75 +654,177 @@ package body Ada.Containers.Indefinite_Vectors is
Index : Extended_Index;
Count : Count_Type := 1)
is
- begin
+ Old_Last : constant Index_Type'Base := Container.Last;
+ New_Last : Index_Type'Base;
+ Count2 : Count_Type'Base; -- count of items from Index to Old_Last
+ J : Index_Type'Base; -- first index of items that slide down
+
+ begin
+ -- Delete removes items from the vector, the number of which is the
+ -- minimum of the specified Count and the items (if any) that exist from
+ -- Index to Container.Last. There are no constraints on the specified
+ -- value of Count (it can be larger than what's available at this
+ -- position in the vector, for example), but there are constraints on
+ -- the allowed values of the Index.
+
+ -- As a precondition on the generic actual Index_Type, the base type
+ -- must include Index_Type'Pred (Index_Type'First); this is the value
+ -- that Container.Last assumes when the vector is empty. However, we do
+ -- not allow that as the value for Index when specifying which items
+ -- should be deleted, so we must manually check. (That the user is
+ -- allowed to specify the value at all here is a consequence of the
+ -- declaration of the Extended_Index subtype, which includes the values
+ -- in the base range that immediately precede and immediately follow the
+ -- values in the Index_Type.)
+
if Index < Index_Type'First then
raise Constraint_Error with "Index is out of range (too small)";
end if;
- if Index > Container.Last then
- if Index > Container.Last + 1 then
+ -- We do allow a value greater than Container.Last to be specified as
+ -- the Index, but only if it's immediately greater. This allows the
+ -- corner case of deleting no items from the back end of the vector to
+ -- be treated as a no-op. (It is assumed that specifying an index value
+ -- greater than Last + 1 indicates some deeper flaw in the caller's
+ -- algorithm, so that case is treated as a proper error.)
+
+ if Index > Old_Last then
+ if Index > Old_Last + 1 then
raise Constraint_Error with "Index is out of range (too large)";
end if;
return;
end if;
+ -- Here and elsewhere we treat deleting 0 items from the container as a
+ -- no-op, even when the container is busy, so we simply return.
+
if Count = 0 then
return;
end if;
+ -- The internal elements array isn't guaranteed to exist unless we have
+ -- elements, so we handle that case here in order to avoid having to
+ -- check it later. (Note that an empty vector can never be busy, so
+ -- there's no semantic harm in returning early.)
+
+ if Container.Is_Empty then
+ return;
+ end if;
+
+ -- The tampering bits exist to prevent an item from being deleted (or
+ -- otherwise harmfully manipulated) while it is being visited. Query,
+ -- Update, and Iterate increment the busy count on entry, and decrement
+ -- the count on exit. Delete checks the count to determine whether it is
+ -- being called while the associated callback procedure is executing.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
- declare
- Index_As_Int : constant Int := Int (Index);
- Old_Last_As_Int : constant Int := Int (Container.Last);
+ -- We first calculate what's available for deletion starting at
+ -- Index. Here and elsewhere we use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate values. (See function
+ -- Length for more information.)
+
+ if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then
+ Count2 := Count_Type'Base (Old_Last) - Count_Type'Base (Index) + 1;
- Count1 : constant Int'Base := Int (Count);
- Count2 : constant Int'Base := Old_Last_As_Int - Index_As_Int + 1;
- N : constant Int'Base := Int'Min (Count1, Count2);
+ else
+ Count2 := Count_Type'Base (Old_Last - Index + 1);
+ end if;
- J_As_Int : constant Int'Base := Index_As_Int + N;
- E : Elements_Array renames Container.Elements.EA;
+ -- If the number of elements requested (Count) for deletion is equal to
+ -- (or greater than) the number of elements available (Count2) for
+ -- deletion beginning at Index, then everything from Index to
+ -- Container.Last is deleted (this is equivalent to Delete_Last).
- begin
- if J_As_Int > Old_Last_As_Int then
+ if Count >= Count2 then
+ -- Elements in an indefinite vector are allocated, so we must iterate
+ -- over the loop and deallocate elements one-at-a-time. We work from
+ -- back to front, deleting the last element during each pass, in
+ -- order to gracefully handle deallocation failures.
+
+ declare
+ EA : Elements_Array renames Container.Elements.EA;
+
+ begin
while Container.Last >= Index loop
declare
K : constant Index_Type := Container.Last;
- X : Element_Access := E (K);
+ X : Element_Access := EA (K);
begin
- E (K) := null;
+ -- We first isolate the element we're deleting, removing it
+ -- from the vector before we attempt to deallocate it, in
+ -- case the deallocation fails.
+
+ EA (K) := null;
Container.Last := K - 1;
+
+ -- Container invariants have been restored, so it is now
+ -- safe to attempt to deallocate the element.
+
Free (X);
end;
end loop;
+ end;
- else
- declare
- J : constant Index_Type := Index_Type (J_As_Int);
+ return;
+ end if;
- New_Last_As_Int : constant Int'Base := Old_Last_As_Int - N;
- New_Last : constant Index_Type :=
- Index_Type (New_Last_As_Int);
+ -- There are some elements that aren't being deleted (the requested
+ -- count was less than the available count), so we must slide them down
+ -- to Index. We first calculate the index values of the respective array
+ -- slices, using the wider of Index_Type'Base and Count_Type'Base as the
+ -- type for intermediate calculations. For the elements that slide down,
+ -- index value New_Last is the last index value of their new home, and
+ -- index value J is the first index of their old home.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ New_Last := Old_Last - Index_Type'Base (Count);
+ J := Index + Index_Type'Base (Count);
+
+ else
+ New_Last := Index_Type'Base (Count_Type'Base (Old_Last) - Count);
+ J := Index_Type'Base (Count_Type'Base (Index) + Count);
+ end if;
+
+ -- The internal elements array isn't guaranteed to exist unless we have
+ -- elements, but we have that guarantee here because we know we have
+ -- elements to slide. The array index values for each slice have
+ -- already been determined, so what remains to be done is to first
+ -- deallocate the elements that are being deleted, and then slide down
+ -- to Index the elements that aren't being deleted.
+
+ declare
+ EA : Elements_Array renames Container.Elements.EA;
+
+ begin
+ -- Before we can slide down the elements that aren't being deleted,
+ -- we need to deallocate the elements that are being deleted.
+
+ for K in Index .. J - 1 loop
+ declare
+ X : Element_Access := EA (K);
begin
- for K in Index .. J - 1 loop
- declare
- X : Element_Access := E (K);
- begin
- E (K) := null;
- Free (X);
- end;
- end loop;
+ -- First we remove the element we're about to deallocate from
+ -- the vector, in case the deallocation fails, in order to
+ -- preserve representation invariants.
- E (Index .. New_Last) := E (J .. Container.Last);
- Container.Last := New_Last;
+ EA (K) := null;
+
+ -- The element has been removed from the vector, so it is now
+ -- safe to attempt to deallocate it.
+
+ Free (X);
end;
- end if;
+ end loop;
+
+ EA (Index .. New_Last) := EA (J .. Old_Last);
+ Container.Last := New_Last;
end;
end Delete;
@@ -667,32 +882,64 @@ package body Ada.Containers.Indefinite_Vectors is
(Container : in out Vector;
Count : Count_Type := 1)
is
- N : constant Count_Type := Length (Container);
-
begin
- if Count = 0
- or else N = 0
- then
+ -- It is not permitted to delete items while the container is busy (for
+ -- example, we're in the middle of a passive iteration). However, we
+ -- always treat deleting 0 items as a no-op, even when we're busy, so we
+ -- simply return without checking.
+
+ if Count = 0 then
return;
end if;
+ -- We cannot simply subsume the empty case into the loop below (the loop
+ -- would iterate 0 times), because we rename the internal array object
+ -- (which is allocated), but an empty vector isn't guaranteed to have
+ -- actually allocated an array. (Note that an empty vector can never be
+ -- busy, so there's no semantic harm in returning early here.)
+
+ if Container.Is_Empty then
+ return;
+ end if;
+
+ -- The tampering bits exist to prevent an item from being deleted (or
+ -- otherwise harmfully manipulated) while it is being visited. Query,
+ -- Update, and Iterate increment the busy count on entry, and decrement
+ -- the count on exit. Delete_Last checks the count to determine whether
+ -- it is being called while the associated callback procedure is
+ -- executing.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
+ -- Elements in an indefinite vector are allocated, so we must iterate
+ -- over the loop and deallocate elements one-at-a-time. We work from
+ -- back to front, deleting the last element during each pass, in order
+ -- to gracefully handle deallocation failures.
+
declare
E : Elements_Array renames Container.Elements.EA;
begin
- for Indx in 1 .. Count_Type'Min (Count, N) loop
+ for Indx in 1 .. Count_Type'Min (Count, Container.Length) loop
declare
J : constant Index_Type := Container.Last;
X : Element_Access := E (J);
begin
+ -- Note that we first isolate the element we're deleting,
+ -- removing it from the vector, before we actually deallocate
+ -- it, in order to preserve representation invariants even if
+ -- the deallocation fails.
+
E (J) := null;
Container.Last := J - 1;
+
+ -- Container invariants have been restored, so it is now safe
+ -- to deallocate the element.
+
Free (X);
end;
end loop;
@@ -1042,22 +1289,42 @@ package body Ada.Containers.Indefinite_Vectors is
New_Item : Element_Type;
Count : Count_Type := 1)
is
- N : constant Int := Int (Count);
+ Old_Length : constant Count_Type := Container.Length;
- First : constant Int := Int (Index_Type'First);
- New_Last_As_Int : Int'Base;
- New_Last : Index_Type;
- New_Length : UInt;
- Max_Length : constant UInt := UInt (Count_Type'Last);
+ Max_Length : Count_Type'Base; -- determined from range of Index_Type
+ New_Length : Count_Type'Base; -- sum of current length and Count
+ New_Last : Index_Type'Base; -- last index of vector after insertion
- Dst : Elements_Access;
+ Index : Index_Type'Base; -- scratch for intermediate values
+ J : Count_Type'Base; -- scratch
+
+ New_Capacity : Count_Type'Base; -- length of new, expanded array
+ Dst_Last : Index_Type'Base; -- last index of new, expanded array
+ Dst : Elements_Access; -- new, expanded internal array
begin
+ -- As a precondition on the generic actual Index_Type, the base type
+ -- must include Index_Type'Pred (Index_Type'First); this is the value
+ -- that Container.Last assumes when the vector is empty. However, we do
+ -- not allow that as the value for Index when specifying where the new
+ -- items should be inserted, so we must manually check. (That the user
+ -- is allowed to specify the value at all here is a consequence of the
+ -- declaration of the Extended_Index subtype, which includes the values
+ -- in the base range that immediately precede and immediately follow the
+ -- values in the Index_Type.)
+
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
+ -- We do allow a value greater than Container.Last to be specified as
+ -- the Index, but only if it's immediately greater. This allows for the
+ -- case of appending items to the back end of the vector. (It is assumed
+ -- that specifying an index value greater than Last + 1 indicates some
+ -- deeper flaw in the caller's algorithm, so that case is treated as a
+ -- proper error.)
+
if Before > Container.Last
and then Before > Container.Last + 1
then
@@ -1065,197 +1332,371 @@ package body Ada.Containers.Indefinite_Vectors is
"Before index is out of range (too large)";
end if;
+ -- We treat inserting 0 items into the container as a no-op, even when
+ -- the container is busy, so we simply return.
+
if Count = 0 then
return;
end if;
- declare
- Old_Last_As_Int : constant Int := Int (Container.Last);
+ -- There are two constraints we need to satisfy. The first constraint is
+ -- that a container cannot have more than Count_Type'Last elements, so
+ -- we must check the sum of the current length and the insertion
+ -- count. Note that we cannot simply add these values, because of the
+ -- possibilty of overflow.
- begin
- if Old_Last_As_Int > Int'Last - N then
- raise Constraint_Error with "new length is out of range";
- end if;
+ if Old_Length > Count_Type'Last - Count then
+ raise Constraint_Error with "Count is out of range";
+ end if;
- New_Last_As_Int := Old_Last_As_Int + N;
+ -- It is now safe compute the length of the new vector, without fear of
+ -- overflow.
- if New_Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
+ New_Length := Old_Length + Count;
+
+ -- The second constraint is that the new Last index value cannot exceed
+ -- Index_Type'Last. In each branch below, we calculate the maximum
+ -- length (computed from the range of values in Index_Type), and then
+ -- compare the new length to the maximum length. If the new length is
+ -- acceptable, then we compute the new last index from that.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We have to handle the case when there might be more values in the
+ -- range of Index_Type than in the range of Count_Type.
+
+ if Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is
+ -- less than 0, so it is safe to compute the following sum without
+ -- fear of overflow.
+
+ Index := No_Index + Index_Type'Base (Count_Type'Last);
+
+ if Index <= Index_Type'Last then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the
+ -- maximum number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than in Count_Type,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
+ end if;
+
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute
+ -- the difference without fear of overflow (which we would have to
+ -- worry about if No_Index were less than 0, but that case is
+ -- handled above).
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
- New_Length := UInt (New_Last_As_Int - First + 1);
+ elsif Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is less
+ -- than 0, so it is safe to compute the following sum without fear of
+ -- overflow.
- if New_Length > Max_Length then
- raise Constraint_Error with "new length is out of range";
+ J := Count_Type'Base (No_Index) + Count_Type'Last;
+
+ if J <= Count_Type'Base (Index_Type'Last) then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the maximum
+ -- number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than Count_Type does,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
- New_Last := Index_Type (New_Last_As_Int);
- end;
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute the
+ -- difference without fear of overflow (which we would have to worry
+ -- about if No_Index were less than 0, but that case is handled
+ -- above).
- if Container.Busy > 0 then
- raise Program_Error with
- "attempt to tamper with elements (vector is busy)";
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
+ end if;
+
+ -- We have just computed the maximum length (number of items). We must
+ -- now compare the requested length to the maximum length, as we do not
+ -- allow a vector expand beyond the maximum (because that would create
+ -- an internal array with a last index value greater than
+ -- Index_Type'Last, with no way to index those elements).
+
+ if New_Length > Max_Length then
+ raise Constraint_Error with "Count is out of range";
+ end if;
+
+ -- New_Last is the last index value of the items in the container after
+ -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to
+ -- compute its value from the New_Length.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ New_Last := No_Index + Index_Type'Base (New_Length);
+
+ else
+ New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length);
end if;
if Container.Elements = null then
+ pragma Assert (Container.Last = No_Index);
+
+ -- This is the simplest case, with which we must always begin: we're
+ -- inserting items into an empty vector that hasn't allocated an
+ -- internal array yet. Note that we don't need to check the busy bit
+ -- here, because an empty container cannot be busy.
+
+ -- In an indefinite vector, elements are allocated individually, and
+ -- stored as access values on the internal array (the length of which
+ -- represents the vector "capacity"), which is separately allocated.
+
Container.Elements := new Elements_Type (New_Last);
- Container.Last := No_Index;
- for J in Container.Elements.EA'Range loop
- Container.Elements.EA (J) := new Element_Type'(New_Item);
- Container.Last := J;
+ -- The element backbone has been successfully allocated, so now we
+ -- allocate the elements.
+
+ for Idx in Container.Elements.EA'Range loop
+ -- In order to preserve container invariants, we always attempt
+ -- the element allocation first, before setting the Last index
+ -- value, in case the allocation fails (either because there is no
+ -- storage available, or because element initialization fails).
+
+ Container.Elements.EA (Idx) := new Element_Type'(New_Item);
+
+ -- The allocation of the element succeeded, so it is now safe to
+ -- update the Last index, restoring container invariants.
+
+ Container.Last := Idx;
end loop;
return;
end if;
- if New_Last <= Container.Elements.Last then
+ -- The tampering bits exist to prevent an item from being harmfully
+ -- manipulated while it is being visited. Query, Update, and Iterate
+ -- increment the busy count on entry, and decrement the count on
+ -- exit. Insert checks the count to determine whether it is being called
+ -- while the associated callback procedure is executing.
+
+ if Container.Busy > 0 then
+ raise Program_Error with
+ "attempt to tamper with elements (vector is busy)";
+ end if;
+
+ if New_Length <= Container.Elements.EA'Length then
+ -- In this case, we're inserting elements into a vector that has
+ -- already allocated an internal array, and the existing array has
+ -- enough unused storage for the new items.
+
declare
E : Elements_Array renames Container.Elements.EA;
+ K : Index_Type'Base;
begin
- if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ if Before > Container.Last then
+ -- The new items are being appended to the vector, so no
+ -- sliding of existing elements is required.
+
+ for Idx in Before .. New_Last loop
+ -- In order to preserve container invariants, we always
+ -- attempt the element allocation first, before setting the
+ -- Last index value, in case the allocation fails (either
+ -- because there is no storage available, or because element
+ -- initialization fails).
+
+ E (Idx) := new Element_Type'(New_Item);
+
+ -- The allocation of the element succeeded, so it is now
+ -- safe to update the Last index, restoring container
+ -- invariants.
+
+ Container.Last := Idx;
+ end loop;
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ else
+ -- The new items are being inserted before some existing
+ -- elements, so we must slide the existing elements up to their
+ -- new home. We use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate index values.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
+
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
- J : Index_Type'Base;
+ -- The new items are being inserted in the middle of the array,
+ -- in the range [Before, Index). Copy the existing elements to
+ -- the end of the array, to make room for the new items.
+ E (Index .. New_Last) := E (Before .. Container.Last);
+ Container.Last := New_Last;
+
+ -- We have copied the existing items up to the end of the
+ -- array, to make room for the new items in the middle of
+ -- the array. Now we actually allocate the new items.
+
+ -- Note: initialize K outside loop to make it clear that
+ -- K always has a value if the exception handler triggers.
+
+ K := Before;
begin
- -- The new items are being inserted in the middle of the
- -- array, in the range [Before, Index). Copy the existing
- -- elements to the end of the array, to make room for the
- -- new items.
-
- E (Index .. New_Last) := E (Before .. Container.Last);
- Container.Last := New_Last;
-
- -- We have copied the existing items up to the end of the
- -- array, to make room for the new items in the middle of
- -- the array. Now we actually allocate the new items.
-
- -- Note: initialize J outside loop to make it clear that
- -- J always has a value if the exception handler triggers.
-
- J := Before;
- begin
- while J < Index loop
- E (J) := new Element_Type'(New_Item);
- J := J + 1;
- end loop;
+ while K < Index loop
+ E (K) := new Element_Type'(New_Item);
+ K := K + 1;
+ end loop;
- exception
- when others =>
+ exception
+ when others =>
- -- Values in the range [Before, J) were successfully
- -- allocated, but values in the range [J, Index) are
- -- stale (these array positions contain copies of the
- -- old items, that did not get assigned a new item,
- -- because the allocation failed). We must finish what
- -- we started by clearing out all of the stale values,
- -- leaving a "hole" in the middle of the array.
+ -- Values in the range [Before, K) were successfully
+ -- allocated, but values in the range [K, Index) are
+ -- stale (these array positions contain copies of the
+ -- old items, that did not get assigned a new item,
+ -- because the allocation failed). We must finish what
+ -- we started by clearing out all of the stale values,
+ -- leaving a "hole" in the middle of the array.
- E (J .. Index - 1) := (others => null);
- raise;
- end;
+ E (K .. Index - 1) := (others => null);
+ raise;
end;
-
- else
- for J in Before .. New_Last loop
- E (J) := new Element_Type'(New_Item);
- Container.Last := J;
- end loop;
end if;
end;
return;
end if;
- -- There follows LOTS of code completely devoid of comments ???
- -- This is not our general style ???
+ -- In this case, we're inserting elements into a vector that has already
+ -- allocated an internal array, but the existing array does not have
+ -- enough storage, so we must allocate a new, longer array. In order to
+ -- guarantee that the amortized insertion cost is O(1), we always
+ -- allocate an array whose length is some power-of-two factor of the
+ -- current array length. (The new array cannot have a length less than
+ -- the New_Length of the container, but its last index value cannot be
+ -- greater than Index_Type'Last.)
+
+ New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length);
+ while New_Capacity < New_Length loop
+ if New_Capacity > Count_Type'Last / 2 then
+ New_Capacity := Count_Type'Last;
+ exit;
+ end if;
- declare
- C, CC : UInt;
+ New_Capacity := 2 * New_Capacity;
+ end loop;
- begin
- C := UInt'Max (1, Container.Elements.EA'Length); -- ???
- while C < New_Length loop
- if C > UInt'Last / 2 then
- C := UInt'Last;
- exit;
- end if;
+ if New_Capacity > Max_Length then
+ -- We have reached the limit of capacity, so no further expansion
+ -- will occur. (This is not a problem, as there is never a need to
+ -- have more capacity than the maximum container length.)
- C := 2 * C;
- end loop;
+ New_Capacity := Max_Length;
+ end if;
- if C > Max_Length then
- C := Max_Length;
- end if;
+ -- We have computed the length of the new internal array (and this is
+ -- what "vector capacity" means), so use that to compute its last index.
- if Index_Type'First <= 0
- and then Index_Type'Last >= 0
- then
- CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
- else
- CC := UInt (Int (Index_Type'Last) - First + 1);
- end if;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Dst_Last := No_Index + Index_Type'Base (New_Capacity);
- if C > CC then
- C := CC;
- end if;
+ else
+ Dst_Last :=
+ Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity);
+ end if;
- declare
- Dst_Last : constant Index_Type :=
- Index_Type (First + UInt'Pos (C) - Int'(1));
+ -- Now we allocate the new, longer internal array. If the allocation
+ -- fails, we have not changed any container state, so no side-effect
+ -- will occur as a result of propagating the exception.
- begin
- Dst := new Elements_Type (Dst_Last);
- end;
- end;
+ Dst := new Elements_Type (Dst_Last);
- if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ -- We have our new internal array. All that needs to be done now is to
+ -- copy the existing items (if any) from the old array (the "source"
+ -- array) to the new array (the "destination" array), and then
+ -- deallocate the old array.
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ declare
+ Src : Elements_Access := Container.Elements;
- Src : Elements_Access := Container.Elements;
+ begin
+ Dst.EA (Index_Type'First .. Before - 1) :=
+ Src.EA (Index_Type'First .. Before - 1);
- begin
- Dst.EA (Index_Type'First .. Before - 1) :=
- Src.EA (Index_Type'First .. Before - 1);
+ if Before > Container.Last then
+ -- The new items are being appended to the vector, so no
+ -- sliding of existing elements is required.
- Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last);
+ -- We have copied the elements from to the old, source array to
+ -- the new, destination array, so we can now deallocate the old
+ -- array.
Container.Elements := Dst;
- Container.Last := New_Last;
Free (Src);
- for J in Before .. Index - 1 loop
- Dst.EA (J) := new Element_Type'(New_Item);
+ -- Now we append the new items.
+
+ for Idx in Before .. New_Last loop
+ -- In order to preserve container invariants, we always
+ -- attempt the element allocation first, before setting the
+ -- Last index value, in case the allocation fails (either
+ -- because there is no storage available, or because element
+ -- initialization fails).
+
+ Dst.EA (Idx) := new Element_Type'(New_Item);
+
+ -- The allocation of the element succeeded, so it is now safe
+ -- to update the Last index, restoring container invariants.
+
+ Container.Last := Idx;
end loop;
- end;
- else
- declare
- Src : Elements_Access := Container.Elements;
+ else
+ -- The new items are being inserted before some existing elements,
+ -- so we must slide the existing elements up to their new home.
- begin
- Dst.EA (Index_Type'First .. Container.Last) :=
- Src.EA (Index_Type'First .. Container.Last);
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
+
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
+
+ Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last);
+
+ -- We have copied the elements from to the old, source array to
+ -- the new, destination array, so we can now deallocate the old
+ -- array.
Container.Elements := Dst;
+ Container.Last := New_Last;
Free (Src);
- for J in Before .. New_Last loop
- Dst.EA (J) := new Element_Type'(New_Item);
- Container.Last := J;
+ -- The new array has a range in the middle containing null access
+ -- values. We now fill in that partion of the array with the new
+ -- items.
+
+ for Idx in Before .. Index - 1 loop
+ -- Note that container invariants have already been satisfied
+ -- (in particular, the Last index value of the vector has
+ -- already been updated), so if this allocation fails we simply
+ -- let it propagate.
+
+ Dst.EA (Idx) := new Element_Type'(New_Item);
end loop;
- end;
- end if;
+ end if;
+ end;
end Insert;
procedure Insert
@@ -1264,67 +1705,40 @@ package body Ada.Containers.Indefinite_Vectors is
New_Item : Vector)
is
N : constant Count_Type := Length (New_Item);
+ J : Index_Type'Base;
begin
- if Before < Index_Type'First then
- raise Constraint_Error with
- "Before index is out of range (too small)";
- end if;
+ -- Use Insert_Space to create the "hole" (the destination slice) into
+ -- which we copy the source items.
- if Before > Container.Last
- and then Before > Container.Last + 1
- then
- raise Constraint_Error with
- "Before index is out of range (too large)";
- end if;
+ Insert_Space (Container, Before, Count => N);
if N = 0 then
+ -- There's nothing else to do here (vetting of parameters was
+ -- performed already in Insert_Space), so we simply return.
+
return;
end if;
- Insert_Space (Container, Before, Count => N);
-
- declare
- Dst_Last_As_Int : constant Int'Base :=
- Int'Base (Before) + Int'Base (N) - 1;
-
- Dst_Last : constant Index_Type := Index_Type (Dst_Last_As_Int);
-
- Dst : Elements_Array renames
- Container.Elements.EA (Before .. Dst_Last);
-
- Dst_Index : Index_Type'Base := Before - 1;
-
- begin
- if Container'Address /= New_Item'Address then
- declare
- subtype Src_Index_Subtype is Index_Type'Base range
- Index_Type'First .. New_Item.Last;
-
- Src : Elements_Array renames
- New_Item.Elements.EA (Src_Index_Subtype);
-
- begin
- for Src_Index in Src'Range loop
- Dst_Index := Dst_Index + 1;
-
- if Src (Src_Index) /= null then
- Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
- end if;
- end loop;
- end;
-
- return;
- end if;
+ if Container'Address /= New_Item'Address then
+ -- This is the simple case. New_Item denotes an object different
+ -- from Container, so there's nothing special we need to do to copy
+ -- the source items to their destination, because all of the source
+ -- items are contiguous.
declare
subtype Src_Index_Subtype is Index_Type'Base range
- Index_Type'First .. Before - 1;
+ Index_Type'First .. New_Item.Last;
Src : Elements_Array renames
- Container.Elements.EA (Src_Index_Subtype);
+ New_Item.Elements.EA (Src_Index_Subtype);
+
+ Dst : Elements_Array renames Container.Elements.EA;
+
+ Dst_Index : Index_Type'Base;
begin
+ Dst_Index := Before - 1;
for Src_Index in Src'Range loop
Dst_Index := Dst_Index + 1;
@@ -1334,26 +1748,104 @@ package body Ada.Containers.Indefinite_Vectors is
end loop;
end;
- if Dst_Last = Container.Last then
+ return;
+ end if;
+
+ -- New_Item denotes the same object as Container, so an insertion has
+ -- potentially split the source items. The first source slice is
+ -- [Index_Type'First, Before), and the second source slice is
+ -- [J, Container.Last], where index value J is the first index of the
+ -- second slice. (J gets computed below, but only after we have
+ -- determined that the second source slice is non-empty.) The
+ -- destination slice is always the range [Before, J). We perform the
+ -- copy in two steps, using each of the two slices of the source items.
+
+ declare
+ L : constant Index_Type'Base := Before - 1;
+
+ subtype Src_Index_Subtype is Index_Type'Base range
+ Index_Type'First .. L;
+
+ Src : Elements_Array renames
+ Container.Elements.EA (Src_Index_Subtype);
+
+ Dst : Elements_Array renames Container.Elements.EA;
+
+ Dst_Index : Index_Type'Base;
+
+ begin
+ -- We first copy the source items that precede the space we
+ -- inserted. (If Before equals Index_Type'First, then this first
+ -- source slice will be empty, which is harmless.)
+
+ Dst_Index := Before - 1;
+ for Src_Index in Src'Range loop
+ Dst_Index := Dst_Index + 1;
+
+ if Src (Src_Index) /= null then
+ Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
+ end if;
+ end loop;
+
+ if Src'Length = N then
+ -- The new items were effectively appended to the container, so we
+ -- have already copied all of the items that need to be copied.
+ -- We return early here, even though the source slice below is
+ -- empty (so the assignment would be harmless), because we want to
+ -- avoid computing J, which will overflow if J is greater than
+ -- Index_Type'Base'Last.
+
return;
end if;
+ end;
- declare
- subtype Src_Index_Subtype is Index_Type'Base range
- Dst_Last + 1 .. Container.Last;
+ -- Index value J is the first index of the second source slice. (It is
+ -- also 1 greater than the last index of the destination slice.) Note
+ -- that we want to avoid computing J, if J is greater than
+ -- Index_Type'Base'Last, in order to avoid overflow. We prevent that by
+ -- returning early above, immediately after copying the first slice of
+ -- the source, and determining that this second slice of the source is
+ -- empty.
- Src : Elements_Array renames
- Container.Elements.EA (Src_Index_Subtype);
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ J := Before + Index_Type'Base (N);
- begin
- for Src_Index in Src'Range loop
- Dst_Index := Dst_Index + 1;
+ else
+ J := Index_Type'Base (Count_Type'Base (Before) + N);
+ end if;
- if Src (Src_Index) /= null then
- Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
- end if;
- end loop;
- end;
+ declare
+ subtype Src_Index_Subtype is Index_Type'Base range
+ J .. Container.Last;
+
+ Src : Elements_Array renames
+ Container.Elements.EA (Src_Index_Subtype);
+
+ Dst : Elements_Array renames Container.Elements.EA;
+
+ Dst_Index : Index_Type'Base;
+
+ begin
+ -- We next copy the source items that follow the space we
+ -- inserted. Index value Dst_Index is the first index of that portion
+ -- of the destination that receives this slice of the source. (For
+ -- the reasons given above, this slice is guaranteed to be
+ -- non-empty.)
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Dst_Index := J - Index_Type'Base (Src'Length);
+
+ else
+ Dst_Index := Index_Type'Base (Count_Type'Base (J) - Src'Length);
+ end if;
+
+ for Src_Index in Src'Range loop
+ if Src (Src_Index) /= null then
+ Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
+ end if;
+
+ Dst_Index := Dst_Index + 1;
+ end loop;
end;
end Insert;
@@ -1530,22 +2022,42 @@ package body Ada.Containers.Indefinite_Vectors is
Before : Extended_Index;
Count : Count_Type := 1)
is
- N : constant Int := Int (Count);
+ Old_Length : constant Count_Type := Container.Length;
+
+ Max_Length : Count_Type'Base; -- determined from range of Index_Type
+ New_Length : Count_Type'Base; -- sum of current length and Count
+ New_Last : Index_Type'Base; -- last index of vector after insertion
- First : constant Int := Int (Index_Type'First);
- New_Last_As_Int : Int'Base;
- New_Last : Index_Type;
- New_Length : UInt;
- Max_Length : constant UInt := UInt (Count_Type'Last);
+ Index : Index_Type'Base; -- scratch for intermediate values
+ J : Count_Type'Base; -- scratch
- Dst : Elements_Access;
+ New_Capacity : Count_Type'Base; -- length of new, expanded array
+ Dst_Last : Index_Type'Base; -- last index of new, expanded array
+ Dst : Elements_Access; -- new, expanded internal array
begin
+ -- As a precondition on the generic actual Index_Type, the base type
+ -- must include Index_Type'Pred (Index_Type'First); this is the value
+ -- that Container.Last assumes when the vector is empty. However, we do
+ -- not allow that as the value for Index when specifying where the new
+ -- items should be inserted, so we must manually check. (That the user
+ -- is allowed to specify the value at all here is a consequence of the
+ -- declaration of the Extended_Index subtype, which includes the values
+ -- in the base range that immediately precede and immediately follow the
+ -- values in the Index_Type.)
+
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
+ -- We do allow a value greater than Container.Last to be specified as
+ -- the Index, but only if it's immediately greater. This allows for the
+ -- case of appending items to the back end of the vector. (It is assumed
+ -- that specifying an index value greater than Last + 1 indicates some
+ -- deeper flaw in the caller's algorithm, so that case is treated as a
+ -- proper error.)
+
if Before > Container.Last
and then Before > Container.Last + 1
then
@@ -1553,60 +2065,178 @@ package body Ada.Containers.Indefinite_Vectors is
"Before index is out of range (too large)";
end if;
+ -- We treat inserting 0 items into the container as a no-op, even when
+ -- the container is busy, so we simply return.
+
if Count = 0 then
return;
end if;
- declare
- Old_Last_As_Int : constant Int := Int (Container.Last);
+ -- There are two constraints we need to satisfy. The first constraint is
+ -- that a container cannot have more than Count_Type'Last elements, so
+ -- we must check the sum of the current length and the insertion
+ -- count. Note that we cannot simply add these values, because of the
+ -- possibilty of overflow.
- begin
- if Old_Last_As_Int > Int'Last - N then
- raise Constraint_Error with "new length is out of range";
- end if;
+ if Old_Length > Count_Type'Last - Count then
+ raise Constraint_Error with "Count is out of range";
+ end if;
- New_Last_As_Int := Old_Last_As_Int + N;
+ -- It is now safe compute the length of the new vector, without fear of
+ -- overflow.
- if New_Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
+ New_Length := Old_Length + Count;
+
+ -- The second constraint is that the new Last index value cannot exceed
+ -- Index_Type'Last. In each branch below, we calculate the maximum
+ -- length (computed from the range of values in Index_Type), and then
+ -- compare the new length to the maximum length. If the new length is
+ -- acceptable, then we compute the new last index from that.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We have to handle the case when there might be more values in the
+ -- range of Index_Type than in the range of Count_Type.
+
+ if Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is
+ -- less than 0, so it is safe to compute the following sum without
+ -- fear of overflow.
+
+ Index := No_Index + Index_Type'Base (Count_Type'Last);
+
+ if Index <= Index_Type'Last then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the
+ -- maximum number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than in Count_Type,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
+ end if;
+
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute
+ -- the difference without fear of overflow (which we would have to
+ -- worry about if No_Index were less than 0, but that case is
+ -- handled above).
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
- New_Length := UInt (New_Last_As_Int - First + 1);
+ elsif Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is less
+ -- than 0, so it is safe to compute the following sum without fear of
+ -- overflow.
- if New_Length > Max_Length then
- raise Constraint_Error with "new length is out of range";
+ J := Count_Type'Base (No_Index) + Count_Type'Last;
+
+ if J <= Count_Type'Base (Index_Type'Last) then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the maximum
+ -- number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than Count_Type does,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
- New_Last := Index_Type (New_Last_As_Int);
- end;
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute the
+ -- difference without fear of overflow (which we would have to worry
+ -- about if No_Index were less than 0, but that case is handled
+ -- above).
- if Container.Busy > 0 then
- raise Program_Error with
- "attempt to tamper with elements (vector is busy)";
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
+ end if;
+
+ -- We have just computed the maximum length (number of items). We must
+ -- now compare the requested length to the maximum length, as we do not
+ -- allow a vector expand beyond the maximum (because that would create
+ -- an internal array with a last index value greater than
+ -- Index_Type'Last, with no way to index those elements).
+
+ if New_Length > Max_Length then
+ raise Constraint_Error with "Count is out of range";
+ end if;
+
+ -- New_Last is the last index value of the items in the container after
+ -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to
+ -- compute its value from the New_Length.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ New_Last := No_Index + Index_Type'Base (New_Length);
+
+ else
+ New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length);
end if;
if Container.Elements = null then
+ pragma Assert (Container.Last = No_Index);
+
+ -- This is the simplest case, with which we must always begin: we're
+ -- inserting items into an empty vector that hasn't allocated an
+ -- internal array yet. Note that we don't need to check the busy bit
+ -- here, because an empty container cannot be busy.
+
+ -- In an indefinite vector, elements are allocated individually, and
+ -- stored as access values on the internal array (the length of which
+ -- represents the vector "capacity"), which is separately
+ -- allocated. We have no elements here (because we're inserting
+ -- "space"), so all we need to do is allocate the backbone.
+
Container.Elements := new Elements_Type (New_Last);
Container.Last := New_Last;
+
return;
end if;
- if New_Last <= Container.Elements.Last then
+ -- The tampering bits exist to prevent an item from being harmfully
+ -- manipulated while it is being visited. Query, Update, and Iterate
+ -- increment the busy count on entry, and decrement the count on
+ -- exit. Insert checks the count to determine whether it is being called
+ -- while the associated callback procedure is executing.
+
+ if Container.Busy > 0 then
+ raise Program_Error with
+ "attempt to tamper with elements (vector is busy)";
+ end if;
+
+ if New_Length <= Container.Elements.EA'Length then
+ -- In this case, we're inserting elements into a vector that has
+ -- already allocated an internal array, and the existing array has
+ -- enough unused storage for the new items.
+
declare
E : Elements_Array renames Container.Elements.EA;
begin
if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ -- The new space is being inserted before some existing
+ -- elements, so we must slide the existing elements up to their
+ -- new home. We use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate index values.
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
- begin
- E (Index .. New_Last) := E (Before .. Container.Last);
- E (Before .. Index - 1) := (others => null);
- end;
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
+
+ E (Index .. New_Last) := E (Before .. Container.Last);
+ E (Before .. Index - 1) := (others => null);
end if;
end;
@@ -1614,68 +2244,80 @@ package body Ada.Containers.Indefinite_Vectors is
return;
end if;
- declare
- C, CC : UInt;
+ -- In this case, we're inserting elements into a vector that has already
+ -- allocated an internal array, but the existing array does not have
+ -- enough storage, so we must allocate a new, longer array. In order to
+ -- guarantee that the amortized insertion cost is O(1), we always
+ -- allocate an array whose length is some power-of-two factor of the
+ -- current array length. (The new array cannot have a length less than
+ -- the New_Length of the container, but its last index value cannot be
+ -- greater than Index_Type'Last.)
+
+ New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length);
+ while New_Capacity < New_Length loop
+ if New_Capacity > Count_Type'Last / 2 then
+ New_Capacity := Count_Type'Last;
+ exit;
+ end if;
- begin
- C := UInt'Max (1, Container.Elements.EA'Length); -- ???
- while C < New_Length loop
- if C > UInt'Last / 2 then
- C := UInt'Last;
- exit;
- end if;
+ New_Capacity := 2 * New_Capacity;
+ end loop;
- C := 2 * C;
- end loop;
+ if New_Capacity > Max_Length then
+ -- We have reached the limit of capacity, so no further expansion
+ -- will occur. (This is not a problem, as there is never a need to
+ -- have more capacity than the maximum container length.)
- if C > Max_Length then
- C := Max_Length;
- end if;
+ New_Capacity := Max_Length;
+ end if;
- if Index_Type'First <= 0
- and then Index_Type'Last >= 0
- then
- CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
- else
- CC := UInt (Int (Index_Type'Last) - First + 1);
- end if;
+ -- We have computed the length of the new internal array (and this is
+ -- what "vector capacity" means), so use that to compute its last index.
- if C > CC then
- C := CC;
- end if;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Dst_Last := No_Index + Index_Type'Base (New_Capacity);
- declare
- Dst_Last : constant Index_Type :=
- Index_Type (First + UInt'Pos (C) - 1);
+ else
+ Dst_Last :=
+ Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity);
+ end if;
- begin
- Dst := new Elements_Type (Dst_Last);
- end;
- end;
+ -- Now we allocate the new, longer internal array. If the allocation
+ -- fails, we have not changed any container state, so no side-effect
+ -- will occur as a result of propagating the exception.
+
+ Dst := new Elements_Type (Dst_Last);
+
+ -- We have our new internal array. All that needs to be done now is to
+ -- copy the existing items (if any) from the old array (the "source"
+ -- array) to the new array (the "destination" array), and then
+ -- deallocate the old array.
declare
Src : Elements_Access := Container.Elements;
begin
- if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ Dst.EA (Index_Type'First .. Before - 1) :=
+ Src.EA (Index_Type'First .. Before - 1);
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ if Before <= Container.Last then
+ -- The new items are being inserted before some existing elements,
+ -- so we must slide the existing elements up to their new home.
- begin
- Dst.EA (Index_Type'First .. Before - 1) :=
- Src.EA (Index_Type'First .. Before - 1);
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
- Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last);
- end;
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
- else
- Dst.EA (Index_Type'First .. Container.Last) :=
- Src.EA (Index_Type'First .. Container.Last);
+ Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last);
end if;
+ -- We have copied the elements from to the old, source array to the
+ -- new, destination array, so we can now restore invariants, and
+ -- deallocate the old array.
+
Container.Elements := Dst;
Container.Last := New_Last;
Free (Src);
@@ -1777,7 +2419,7 @@ package body Ada.Containers.Indefinite_Vectors is
return (Container'Unchecked_Access, Container.Last);
end Last;
- ------------------
+ -----------------
-- Last_Element --
------------------
@@ -1814,12 +2456,33 @@ package body Ada.Containers.Indefinite_Vectors is
------------
function Length (Container : Vector) return Count_Type is
- L : constant Int := Int (Container.Last);
- F : constant Int := Int (Index_Type'First);
- N : constant Int'Base := L - F + 1;
-
- begin
- return Count_Type (N);
+ L : constant Index_Type'Base := Container.Last;
+ F : constant Index_Type := Index_Type'First;
+
+ begin
+ -- The base range of the index type (Index_Type'Base) might not include
+ -- all values for length (Count_Type). Contrariwise, the index type
+ -- might include values outside the range of length. Hence we use
+ -- whatever type is wider for intermediate values when calculating
+ -- length. Note that no matter what the index type is, the maximum
+ -- length to which a vector is allowed to grow is always the minimum
+ -- of Count_Type'Last and (IT'Last - IT'First + 1).
+
+ -- For example, an Index_Type with range -127 .. 127 is only guaranteed
+ -- to have a base range of -128 .. 127, but the corresponding vector
+ -- would have lengths in the range 0 .. 255. In this case we would need
+ -- to use Count_Type'Base for intermediate values.
+
+ -- Another case would be the index range -2**63 + 1 .. -2**63 + 10. The
+ -- vector would have a maximum length of 10, but the index values lie
+ -- outside the range of Count_Type (which is only 32 bits). In this
+ -- case we would need to use Index_Type'Base for intermediate values.
+
+ if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then
+ return Count_Type'Base (L) - Count_Type'Base (F) + 1;
+ else
+ return Count_Type (L - F + 1);
+ end if;
end Length;
----------
@@ -2100,17 +2763,53 @@ package body Ada.Containers.Indefinite_Vectors is
is
N : constant Count_Type := Length (Container);
+ Index : Count_Type'Base;
+ Last : Index_Type'Base;
+
begin
+ -- Reserve_Capacity can be used to either expand the storage available
+ -- for elements (this would be its typical use, in anticipation of
+ -- future insertion), or to trim back storage. In the latter case,
+ -- storage can only be trimmed back to the limit of the container
+ -- length. Note that Reserve_Capacity neither deletes (active) elements
+ -- nor inserts elements; it only affects container capacity, never
+ -- container length.
+
if Capacity = 0 then
+ -- This is a request to trim back storage, to the minimum amount
+ -- possible given the current state of the container.
+
if N = 0 then
+ -- The container is empty, so in this unique case we can
+ -- deallocate the entire internal array. Note that an empty
+ -- container can never be busy, so there's no need to check the
+ -- tampering bits.
+
declare
X : Elements_Access := Container.Elements;
begin
+ -- First we remove the internal array from the container, to
+ -- handle the case when the deallocation raises an exception
+ -- (although that's unlikely, since this is simply an array of
+ -- access values, all of which are null).
+
Container.Elements := null;
+
+ -- Container invariants have been restored, so it is now safe
+ -- to attempt to deallocate the internal array.
+
Free (X);
end;
elsif N < Container.Elements.EA'Length then
+ -- The container is not empty, and the current length is less than
+ -- the current capacity, so there's storage available to trim. In
+ -- this case, we allocate a new internal array having a length
+ -- that exactly matches the number of items in the
+ -- container. (Reserve_Capacity does not delete active elements,
+ -- so this is the best we can do with respect to minimizing
+ -- storage).
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
@@ -2126,7 +2825,19 @@ package body Ada.Containers.Indefinite_Vectors is
X : Elements_Access := Container.Elements;
begin
+ -- Although we have isolated the old internal array that we're
+ -- going to deallocate, we don't deallocate it until we have
+ -- successfully allocated a new one. If there is an exception
+ -- during allocation (because there is not enough storage), we
+ -- let it propagate without causing any side-effect.
+
Container.Elements := new Elements_Type'(Container.Last, Src);
+
+ -- We have succesfully allocated a new internal array (with a
+ -- smaller length than the old one, and containing a copy of
+ -- just the active elements in the container), so we can
+ -- deallocate the old array.
+
Free (X);
end;
end if;
@@ -2134,29 +2845,102 @@ package body Ada.Containers.Indefinite_Vectors is
return;
end if;
- if Container.Elements = null then
- declare
- Last_As_Int : constant Int'Base :=
- Int (Index_Type'First) + Int (Capacity) - 1;
+ -- Reserve_Capacity can be used to expand the storage available for
+ -- elements, but we do not let the capacity grow beyond the number of
+ -- values in Index_Type'Range. (Were it otherwise, there would be no way
+ -- to refer to the elements with index values greater than
+ -- Index_Type'Last, so that storage would be wasted.) Here we compute
+ -- the Last index value of the new internal array, in a way that avoids
+ -- any possibility of overflow.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (Capacity) < No_Index then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
- begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ Last := No_Index + Index_Type'Base (Capacity);
- begin
- Container.Elements := new Elements_Type (Last);
- end;
- end;
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
+
+ if Last > Index_Type'Last then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
+
+ elsif Index_Type'First <= 0 then
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of Capacity.
+
+ Index := Count_Type'Base (No_Index) + Capacity; -- Last
+
+ if Index > Count_Type'Base (Index_Type'Last) then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
+
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
+ Last := Index_Type'Base (Index);
+
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
+
+ Index := Count_Type'Base (Index_Type'Last) - Capacity; -- No_Index
+
+ if Index < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
+
+ -- We have determined that the value of Capacity would not create a
+ -- Last index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
+
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + Capacity);
+ end if;
+
+ -- The requested capacity is non-zero, but we don't know yet whether
+ -- this is a request for expansion or contraction of storage.
+
+ if Container.Elements = null then
+ -- The container is empty (it doesn't even have an internal array),
+ -- so this represents a request to allocate storage having the given
+ -- capacity.
+
+ Container.Elements := new Elements_Type (Last);
return;
end if;
if Capacity <= N then
+ -- This is a request to trim back storage, but only to the limit of
+ -- what's already in the container. (Reserve_Capacity never deletes
+ -- active elements, it only reclaims excess storage.)
+
if N < Container.Elements.EA'Length then
+ -- The container is not empty (because the requested capacity is
+ -- positive, and less than or equal to the container length), and
+ -- the current length is less than the current capacity, so
+ -- there's storage available to trim. In this case, we allocate a
+ -- new internal array having a length that exactly matches the
+ -- number of items in the container.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
@@ -2172,7 +2956,19 @@ package body Ada.Containers.Indefinite_Vectors is
X : Elements_Access := Container.Elements;
begin
+ -- Although we have isolated the old internal array that we're
+ -- going to deallocate, we don't deallocate it until we have
+ -- successfully allocated a new one. If there is an exception
+ -- during allocation (because there is not enough storage), we
+ -- let it propagate without causing any side-effect.
+
Container.Elements := new Elements_Type'(Container.Last, Src);
+
+ -- We have succesfully allocated a new internal array (with a
+ -- smaller length than the old one, and containing a copy of
+ -- just the active elements in the container), so it is now
+ -- safe to deallocate the old array.
+
Free (X);
end;
end if;
@@ -2180,47 +2976,57 @@ package body Ada.Containers.Indefinite_Vectors is
return;
end if;
+ -- The requested capacity is larger than the container length (the
+ -- number of active elements). Whether this represents a request for
+ -- expansion or contraction of the current capacity depends on what the
+ -- current capacity is.
+
if Capacity = Container.Elements.EA'Length then
+ -- The requested capacity matches the existing capacity, so there's
+ -- nothing to do here. We treat this case as a no-op, and simply
+ -- return without checking the busy bit.
+
return;
end if;
+ -- There is a change in the capacity of a non-empty container, so a new
+ -- internal array will be allocated. (The length of the new internal
+ -- array could be less or greater than the old internal array. We know
+ -- only that the length of the new internal array is greater than the
+ -- number of active elements in the container.) We must check whether
+ -- the container is busy before doing anything else.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
- declare
- Last_As_Int : constant Int'Base :=
- Int (Index_Type'First) + Int (Capacity) - 1;
+ -- We now allocate a new internal array, having a length different from
+ -- its current value.
- begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ declare
+ X : Elements_Access := Container.Elements;
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
- X : Elements_Access := Container.Elements;
+ subtype Index_Subtype is Index_Type'Base range
+ Index_Type'First .. Container.Last;
- subtype Index_Subtype is Index_Type'Base range
- Index_Type'First .. Container.Last;
+ begin
+ -- We now allocate a new internal array, having a length different
+ -- from its current value.
- begin
- Container.Elements := new Elements_Type (Last);
+ Container.Elements := new Elements_Type (Last);
- declare
- Src : Elements_Array renames
- X.EA (Index_Subtype);
+ -- We have successfully allocated the new internal array, so now we
+ -- move the existing elements from the existing the old internal
+ -- array onto the new one. Note that we're just copying access
+ -- values, to this should not raise any exceptions.
- Tgt : Elements_Array renames
- Container.Elements.EA (Index_Subtype);
+ Container.Elements.EA (Index_Subtype) := X.EA (Index_Subtype);
- begin
- Tgt := Src;
- end;
+ -- We have moved the elements from the old interal array, so now we
+ -- can deallocate it.
- Free (X);
- end;
+ Free (X);
end;
end Reserve_Capacity;
@@ -2357,45 +3163,25 @@ package body Ada.Containers.Indefinite_Vectors is
(Container : in out Vector;
Length : Count_Type)
is
- N : constant Count_Type := Indefinite_Vectors.Length (Container);
+ Count : constant Count_Type'Base := Container.Length - Length;
begin
- if Length = N then
- return;
- end if;
-
- if Container.Busy > 0 then
- raise Program_Error with
- "attempt to tamper with elements (vector is busy)";
- end if;
-
- if Length < N then
- for Index in 1 .. N - Length loop
- declare
- J : constant Index_Type := Container.Last;
- X : Element_Access := Container.Elements.EA (J);
+ -- Set_Length allows the user to set the length explicitly, instead of
+ -- implicitly as a side-effect of deletion or insertion. If the
+ -- requested length is less than the current length, this is equivalent
+ -- to deleting items from the back end of the vector. If the requested
+ -- length is greater than the current length, then this is equivalent to
+ -- inserting "space" (nonce items) at the end.
- begin
- Container.Elements.EA (J) := null;
- Container.Last := J - 1;
- Free (X);
- end;
- end loop;
+ if Count >= 0 then
+ Container.Delete_Last (Count);
- return;
- end if;
+ elsif Container.Last >= Index_Type'Last then
+ raise Constraint_Error with "vector is already at its maximum length";
- if Length > Capacity (Container) then
- Reserve_Capacity (Container, Capacity => Length);
+ else
+ Container.Insert_Space (Container.Last + 1, -Count);
end if;
-
- declare
- Last_As_Int : constant Int'Base :=
- Int (Index_Type'First) + Int (Length) - 1;
-
- begin
- Container.Last := Index_Type (Last_As_Int);
- end;
end Set_Length;
----------
@@ -2498,73 +3284,205 @@ package body Ada.Containers.Indefinite_Vectors is
---------------
function To_Vector (Length : Count_Type) return Vector is
+ Index : Count_Type'Base;
+ Last : Index_Type'Base;
+ Elements : Elements_Access;
+
begin
if Length = 0 then
return Empty_Vector;
end if;
- declare
- First : constant Int := Int (Index_Type'First);
- Last_As_Int : constant Int'Base := First + Int (Length) - 1;
- Last : Index_Type;
- Elements : Elements_Access;
+ -- We create a vector object with a capacity that matches the specified
+ -- Length, but we do not allow the vector capacity (the length of the
+ -- internal array) to exceed the number of values in Index_Type'Range
+ -- (otherwise, there would be no way to refer to those components via an
+ -- index). We must therefore check whether the specified Length would
+ -- create a Last index value greater than Index_Type'Last.
- begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then
raise Constraint_Error with "Length is out of range";
end if;
- Last := Index_Type (Last_As_Int);
- Elements := new Elements_Type (Last);
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
- return (Controlled with Elements, Last, 0, 0);
- end;
+ Last := No_Index + Index_Type'Base (Length);
+
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
+
+ if Last > Index_Type'Last then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ elsif Index_Type'First <= 0 then
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of Length.
+
+ Index := Count_Type'Base (No_Index) + Length; -- Last
+
+ if Index > Count_Type'Base (Index_Type'Last) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
+
+ Last := Index_Type'Base (Index);
+
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
+
+ Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index
+
+ if Index < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We have determined that the value of Length would not create a
+ -- Last index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
+
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + Length);
+ end if;
+
+ Elements := new Elements_Type (Last);
+
+ return Vector'(Controlled with Elements, Last, 0, 0);
end To_Vector;
function To_Vector
(New_Item : Element_Type;
Length : Count_Type) return Vector
is
+ Index : Count_Type'Base;
+ Last : Index_Type'Base;
+ Elements : Elements_Access;
+
begin
if Length = 0 then
return Empty_Vector;
end if;
- declare
- First : constant Int := Int (Index_Type'First);
- Last_As_Int : constant Int'Base := First + Int (Length) - 1;
- Last : Index_Type'Base;
- Elements : Elements_Access;
+ -- We create a vector object with a capacity that matches the specified
+ -- Length, but we do not allow the vector capacity (the length of the
+ -- internal array) to exceed the number of values in Index_Type'Range
+ -- (otherwise, there would be no way to refer to those components via an
+ -- index). We must therefore check whether the specified Length would
+ -- create a Last index value greater than Index_Type'Last.
- begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then
raise Constraint_Error with "Length is out of range";
end if;
- Last := Index_Type (Last_As_Int);
- Elements := new Elements_Type (Last);
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
- Last := Index_Type'First;
+ Last := No_Index + Index_Type'Base (Length);
- begin
- loop
- Elements.EA (Last) := new Element_Type'(New_Item);
- exit when Last = Elements.Last;
- Last := Last + 1;
- end loop;
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
- exception
- when others =>
- for J in Index_Type'First .. Last - 1 loop
- Free (Elements.EA (J));
- end loop;
+ if Last > Index_Type'Last then
+ raise Constraint_Error with "Length is out of range";
+ end if;
- Free (Elements);
- raise;
- end;
+ elsif Index_Type'First <= 0 then
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of Length.
- return (Controlled with Elements, Last, 0, 0);
+ Index := Count_Type'Base (No_Index) + Length; -- Last
+
+ if Index > Count_Type'Base (Index_Type'Last) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
+
+ Last := Index_Type'Base (Index);
+
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
+
+ Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index
+
+ if Index < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We have determined that the value of Length would not create a
+ -- Last index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
+
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + Length);
+ end if;
+
+ Elements := new Elements_Type (Last);
+
+ -- We use Last as the index of the loop used to populate the internal
+ -- array with items. In general, we prefer to initialize the loop index
+ -- immediately prior to entering the loop. However, Last is also used in
+ -- the exception handler (to reclaim elements that have been allocated,
+ -- before propagating the exception), and the initialization of Last
+ -- after entering the block containing the handler confuses some static
+ -- analysis tools, with respect to whether Last has been properly
+ -- initialized when the handler executes. So here we initialize our loop
+ -- variable earlier than we prefer, before entering the block, so there
+ -- is no ambiguity.
+ Last := Index_Type'First;
+
+ begin
+ loop
+ Elements.EA (Last) := new Element_Type'(New_Item);
+ exit when Last = Elements.Last;
+ Last := Last + 1;
+ end loop;
+
+ exception
+ when others =>
+ for J in Index_Type'First .. Last - 1 loop
+ Free (Elements.EA (J));
+ end loop;
+
+ Free (Elements);
+ raise;
end;
+
+ return (Controlled with Elements, Last, 0, 0);
end To_Vector;
--------------------
diff --git a/gcc/ada/a-comlin.ads b/gcc/ada/a-comlin.ads
index 8d66e1542b9..55d0a500525 100644
--- a/gcc/ada/a-comlin.ads
+++ b/gcc/ada/a-comlin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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 --
@@ -73,6 +73,9 @@ package Ada.Command_Line is
-- Note on Interface Requirements --
------------------------------------
+ -- Services in this package are not supported during the elaboration of an
+ -- auto-initialized Stand-Alone Library.
+
-- If the main program is in Ada, this package works as specified without
-- any other work than the normal steps of WITH'ing the package and then
-- calling the desired routines.
diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb
index 64b1b07d927..501128b9d89 100644
--- a/gcc/ada/a-convec.adb
+++ b/gcc/ada/a-convec.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2010, 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- --
@@ -34,9 +34,6 @@ with System; use type System.Address;
package body Ada.Containers.Vectors is
- type Int is range System.Min_Int .. System.Max_Int;
- type UInt is mod System.Max_Binary_Modulus;
-
procedure Free is
new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access);
@@ -45,10 +42,22 @@ package body Ada.Containers.Vectors is
---------
function "&" (Left, Right : Vector) return Vector is
- LN : constant Count_Type := Length (Left);
- RN : constant Count_Type := Length (Right);
+ LN : constant Count_Type := Length (Left);
+ RN : constant Count_Type := Length (Right);
+ N : Count_Type'Base; -- length of result
+ J : Count_Type'Base; -- for computing intermediate index values
+ Last : Index_Type'Base; -- Last index of result
begin
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the vector parameters. We could decide to make it larger, but we
+ -- have no basis for knowing how much larger, so we just allocate the
+ -- minimum amount of storage.
+
+ -- Here we handle the easy cases first, when one of the vector
+ -- parameters is empty. (We say "easy" because there's nothing to
+ -- compute, that can potentially overflow.)
+
if LN = 0 then
if RN = 0 then
return Empty_Vector;
@@ -80,44 +89,117 @@ package body Ada.Containers.Vectors is
end if;
- declare
- N : constant Int'Base := Int (LN) + Int (RN);
- Last_As_Int : Int'Base;
+ -- Neither of the vector parameters is empty, so must compute the length
+ -- of the result vector and its last index. (This is the harder case,
+ -- because our computations must avoid overflow.)
- begin
- if Int (No_Index) > Int'Last - N then
+ -- There are two constraints we need to satisfy. The first constraint is
+ -- that a container cannot have more than Count_Type'Last elements, so
+ -- we must check the sum of the combined lengths. Note that we cannot
+ -- simply add the lengths, because of the possibilty of overflow.
+
+ if LN > Count_Type'Last - RN then
+ raise Constraint_Error with "new length is out of range";
+ end if;
+
+ -- It is now safe compute the length of the new vector, without fear of
+ -- overflow.
+
+ N := LN + RN;
+
+ -- The second constraint is that the new Last index value cannot
+ -- exceed Index_Type'Last. We use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate values.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (N) < No_Index then
+ raise Constraint_Error with "new length is out of range";
+ end if;
+
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
+
+ Last := No_Index + Index_Type'Base (N);
+
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
+
+ if Last > Index_Type'Last then
raise Constraint_Error with "new length is out of range";
end if;
- Last_As_Int := Int (No_Index) + N;
+ elsif Index_Type'First <= 0 then
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of length.
- if Last_As_Int > Int (Index_Type'Last) then
+ J := Count_Type'Base (No_Index) + N; -- Last
+
+ if J > Count_Type'Base (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
- LE : Elements_Array renames
- Left.Elements.EA (Index_Type'First .. Left.Last);
+ Last := Index_Type'Base (J);
- RE : Elements_Array renames
- Right.Elements.EA (Index_Type'First .. Right.Last);
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
- Elements : constant Elements_Access :=
- new Elements_Type'(Last, LE & RE);
+ J := Count_Type'Base (Index_Type'Last) - N; -- No_Index
- begin
- return (Controlled with Elements, Last, 0, 0);
- end;
+ if J < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "new length is out of range";
+ end if;
+
+ -- We have determined that the result length would not create a Last
+ -- index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
+
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + N);
+ end if;
+
+ declare
+ LE : Elements_Array renames
+ Left.Elements.EA (Index_Type'First .. Left.Last);
+
+ RE : Elements_Array renames
+ Right.Elements.EA (Index_Type'First .. Right.Last);
+
+ Elements : constant Elements_Access :=
+ new Elements_Type'(Last, LE & RE);
+
+ begin
+ return (Controlled with Elements, Last, 0, 0);
end;
end "&";
function "&" (Left : Vector; Right : Element_Type) return Vector is
- LN : constant Count_Type := Length (Left);
-
begin
- if LN = 0 then
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the parameters. We could decide to make it larger, but we have no
+ -- basis for knowing how much larger, so we just allocate the minimum
+ -- amount of storage.
+
+ -- Here we handle the easy case first, when the vector parameter (Left)
+ -- is empty.
+
+ if Left.Is_Empty then
declare
Elements : constant Elements_Access :=
new Elements_Type'
@@ -129,42 +211,47 @@ package body Ada.Containers.Vectors is
end;
end if;
- declare
- Last_As_Int : Int'Base;
-
- begin
- if Int (Index_Type'First) > Int'Last - Int (LN) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ -- The vector parameter is not empty, so we must compute the length of
+ -- the result vector and its last index, but in such a way that overflow
+ -- is avoided. We must satisfy two constraints: the new length cannot
+ -- exceed Count_Type'Last, and the new Last index cannot exceed
+ -- Index_Type'Last.
- Last_As_Int := Int (Index_Type'First) + Int (LN);
+ if Left.Length = Count_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- if Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ if Left.Last >= Index_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ declare
+ Last : constant Index_Type := Left.Last + 1;
- LE : Elements_Array renames
- Left.Elements.EA (Index_Type'First .. Left.Last);
+ LE : Elements_Array renames
+ Left.Elements.EA (Index_Type'First .. Left.Last);
- Elements : constant Elements_Access :=
- new Elements_Type'
- (Last => Last,
- EA => LE & Right);
+ Elements : constant Elements_Access :=
+ new Elements_Type'
+ (Last => Last,
+ EA => LE & Right);
- begin
- return (Controlled with Elements, Last, 0, 0);
- end;
+ begin
+ return (Controlled with Elements, Last, 0, 0);
end;
end "&";
function "&" (Left : Element_Type; Right : Vector) return Vector is
- RN : constant Count_Type := Length (Right);
-
begin
- if RN = 0 then
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the parameters. We could decide to make it larger, but we have no
+ -- basis for knowing how much larger, so we just allocate the minimum
+ -- amount of storage.
+
+ -- Here we handle the easy case first, when the vector parameter (Right)
+ -- is empty.
+
+ if Right.Is_Empty then
declare
Elements : constant Elements_Access :=
new Elements_Type'
@@ -176,39 +263,49 @@ package body Ada.Containers.Vectors is
end;
end if;
- declare
- Last_As_Int : Int'Base;
-
- begin
- if Int (Index_Type'First) > Int'Last - Int (RN) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ -- The vector parameter is not empty, so we must compute the length of
+ -- the result vector and its last index, but in such a way that overflow
+ -- is avoided. We must satisfy two constraints: the new length cannot
+ -- exceed Count_Type'Last, and the new Last index cannot exceed
+ -- Index_Type'Last.
- Last_As_Int := Int (Index_Type'First) + Int (RN);
+ if Right.Length = Count_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- if Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ if Right.Last >= Index_Type'Last then
+ raise Constraint_Error with "new length is out of range";
+ end if;
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ declare
+ Last : constant Index_Type := Right.Last + 1;
- RE : Elements_Array renames
- Right.Elements.EA (Index_Type'First .. Right.Last);
+ RE : Elements_Array renames
+ Right.Elements.EA (Index_Type'First .. Right.Last);
- Elements : constant Elements_Access :=
- new Elements_Type'
- (Last => Last,
- EA => Left & RE);
+ Elements : constant Elements_Access :=
+ new Elements_Type'
+ (Last => Last,
+ EA => Left & RE);
- begin
- return (Controlled with Elements, Last, 0, 0);
- end;
+ begin
+ return (Controlled with Elements, Last, 0, 0);
end;
end "&";
function "&" (Left, Right : Element_Type) return Vector is
begin
+ -- We decide that the capacity of the result is the sum of the lengths
+ -- of the parameters. We could decide to make it larger, but we have no
+ -- basis for knowing how much larger, so we just allocate the minimum
+ -- amount of storage.
+
+ -- We must compute the length of the result vector and its last index,
+ -- but in such a way that overflow is avoided. We must satisfy two
+ -- constraints: the new length cannot exceed Count_Type'Last (here, we
+ -- know that that condition is satisfied), and the new Last index cannot
+ -- exceed Index_Type'Last.
+
if Index_Type'First >= Index_Type'Last then
raise Constraint_Error with "new length is out of range";
end if;
@@ -370,56 +467,117 @@ package body Ada.Containers.Vectors is
Index : Extended_Index;
Count : Count_Type := 1)
is
- begin
+ Old_Last : constant Index_Type'Base := Container.Last;
+ New_Last : Index_Type'Base;
+ Count2 : Count_Type'Base; -- count of items from Index to Old_Last
+ J : Index_Type'Base; -- first index of items that slide down
+
+ begin
+ -- Delete removes items from the vector, the number of which is the
+ -- minimum of the specified Count and the items (if any) that exist from
+ -- Index to Container.Last. There are no constraints on the specified
+ -- value of Count (it can be larger than what's available at this
+ -- position in the vector, for example), but there are constraints on
+ -- the allowed values of the Index.
+
+ -- As a precondition on the generic actual Index_Type, the base type
+ -- must include Index_Type'Pred (Index_Type'First); this is the value
+ -- that Container.Last assumes when the vector is empty. However, we do
+ -- not allow that as the value for Index when specifying which items
+ -- should be deleted, so we must manually check. (That the user is
+ -- allowed to specify the value at all here is a consequence of the
+ -- declaration of the Extended_Index subtype, which includes the values
+ -- in the base range that immediately precede and immediately follow the
+ -- values in the Index_Type.)
+
if Index < Index_Type'First then
raise Constraint_Error with "Index is out of range (too small)";
end if;
- if Index > Container.Last then
- if Index > Container.Last + 1 then
+ -- We do allow a value greater than Container.Last to be specified as
+ -- the Index, but only if it's immediately greater. This allows the
+ -- corner case of deleting no items from the back end of the vector to
+ -- be treated as a no-op. (It is assumed that specifying an index value
+ -- greater than Last + 1 indicates some deeper flaw in the caller's
+ -- algorithm, so that case is treated as a proper error.)
+
+ if Index > Old_Last then
+ if Index > Old_Last + 1 then
raise Constraint_Error with "Index is out of range (too large)";
end if;
return;
end if;
+ -- Here and elsewhere we treat deleting 0 items from the container as a
+ -- no-op, even when the container is busy, so we simply return.
+
if Count = 0 then
return;
end if;
+ -- The tampering bits exist to prevent an item from being deleted (or
+ -- otherwise harmfully manipulated) while it is being visited. Query,
+ -- Update, and Iterate increment the busy count on entry, and decrement
+ -- the count on exit. Delete checks the count to determine whether it is
+ -- being called while the associated callback procedure is executing.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
- declare
- I_As_Int : constant Int := Int (Index);
- Old_Last_As_Int : constant Int := Index_Type'Pos (Container.Last);
+ -- We first calculate what's available for deletion starting at
+ -- Index. Here and elsewhere we use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate values. (See function
+ -- Length for more information.)
- Count1 : constant Int'Base := Count_Type'Pos (Count);
- Count2 : constant Int'Base := Old_Last_As_Int - I_As_Int + 1;
- N : constant Int'Base := Int'Min (Count1, Count2);
+ if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then
+ Count2 := Count_Type'Base (Old_Last) - Count_Type'Base (Index) + 1;
- J_As_Int : constant Int'Base := I_As_Int + N;
+ else
+ Count2 := Count_Type'Base (Old_Last - Index + 1);
+ end if;
- begin
- if J_As_Int > Old_Last_As_Int then
- Container.Last := Index - 1;
+ -- If more elements are requested (Count) for deletion than are
+ -- available (Count2) for deletion beginning at Index, then everything
+ -- from Index is deleted. There are no elements to slide down, and so
+ -- all we need to do is set the value of Container.Last.
- else
- declare
- J : constant Index_Type := Index_Type (J_As_Int);
- EA : Elements_Array renames Container.Elements.EA;
+ if Count >= Count2 then
+ Container.Last := Index - 1;
+ return;
+ end if;
- New_Last_As_Int : constant Int'Base := Old_Last_As_Int - N;
- New_Last : constant Index_Type :=
- Index_Type (New_Last_As_Int);
+ -- There are some elements aren't being deleted (the requested count was
+ -- less than the available count), so we must slide them down to
+ -- Index. We first calculate the index values of the respective array
+ -- slices, using the wider of Index_Type'Base and Count_Type'Base as the
+ -- type for intermediate calculations. For the elements that slide down,
+ -- index value New_Last is the last index value of their new home, and
+ -- index value J is the first index of their old home.
- begin
- EA (Index .. New_Last) := EA (J .. Container.Last);
- Container.Last := New_Last;
- end;
- end if;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ New_Last := Old_Last - Index_Type'Base (Count);
+ J := Index + Index_Type'Base (Count);
+
+ else
+ New_Last := Index_Type'Base (Count_Type'Base (Old_Last) - Count);
+ J := Index_Type'Base (Count_Type'Base (Index) + Count);
+ end if;
+
+ -- The internal elements array isn't guaranteed to exist unless we have
+ -- elements, but we have that guarantee here because we know we have
+ -- elements to slide. The array index values for each slice have
+ -- already been determined, so we just slide down to Index the elements
+ -- that weren't deleted.
+
+ declare
+ EA : Elements_Array renames Container.Elements.EA;
+
+ begin
+ EA (Index .. New_Last) := EA (J .. Old_Last);
+ Container.Last := New_Last;
end;
end Delete;
@@ -476,24 +634,48 @@ package body Ada.Containers.Vectors is
(Container : in out Vector;
Count : Count_Type := 1)
is
- Index : Int'Base;
-
begin
+ -- It is not permitted to delete items while the container is busy (for
+ -- example, we're in the middle of a passive iteration). However, we
+ -- always treat deleting 0 items as a no-op, even when we're busy, so we
+ -- simply return without checking.
+
if Count = 0 then
return;
end if;
+ -- The tampering bits exist to prevent an item from being deleted (or
+ -- otherwise harmfully manipulated) while it is being visited. Query,
+ -- Update, and Iterate increment the busy count on entry, and decrement
+ -- the count on exit. Delete_Last checks the count to determine whether
+ -- it is being called while the associated callback procedure is
+ -- executing.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
- Index := Int'Base (Container.Last) - Int'Base (Count);
+ -- There is no restriction on how large Count can be when deleting
+ -- items. If it is equal or greater than the current length, then this
+ -- is equivalent to clearing the vector. (In particular, there's no need
+ -- for us to actually calculate the new value for Last.)
+
+ -- If the requested count is less than the current length, then we must
+ -- calculate the new value for Last. For the type we use the widest of
+ -- Index_Type'Base and Count_Type'Base for the intermediate values of
+ -- our calculation. (See the comments in Length for more information.)
- Container.Last :=
- (if Index < Index_Type'Pos (Index_Type'First)
- then No_Index
- else Index_Type (Index));
+ if Count >= Container.Length then
+ Container.Last := No_Index;
+
+ elsif Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Container.Last := Container.Last - Index_Type'Base (Count);
+
+ else
+ Container.Last :=
+ Index_Type'Base (Count_Type'Base (Container.Last) - Count);
+ end if;
end Delete_Last;
-------------
@@ -772,22 +954,42 @@ package body Ada.Containers.Vectors is
New_Item : Element_Type;
Count : Count_Type := 1)
is
- N : constant Int := Count_Type'Pos (Count);
+ Old_Length : constant Count_Type := Container.Length;
+
+ Max_Length : Count_Type'Base; -- determined from range of Index_Type
+ New_Length : Count_Type'Base; -- sum of current length and Count
+ New_Last : Index_Type'Base; -- last index of vector after insertion
- First : constant Int := Int (Index_Type'First);
- New_Last_As_Int : Int'Base;
- New_Last : Index_Type;
- New_Length : UInt;
- Max_Length : constant UInt := UInt (Count_Type'Last);
+ Index : Index_Type'Base; -- scratch for intermediate values
+ J : Count_Type'Base; -- scratch
- Dst : Elements_Access;
+ New_Capacity : Count_Type'Base; -- length of new, expanded array
+ Dst_Last : Index_Type'Base; -- last index of new, expanded array
+ Dst : Elements_Access; -- new, expanded internal array
begin
+ -- As a precondition on the generic actual Index_Type, the base type
+ -- must include Index_Type'Pred (Index_Type'First); this is the value
+ -- that Container.Last assumes when the vector is empty. However, we do
+ -- not allow that as the value for Index when specifying where the new
+ -- items should be inserted, so we must manually check. (That the user
+ -- is allowed to specify the value at all here is a consequence of the
+ -- declaration of the Extended_Index subtype, which includes the values
+ -- in the base range that immediately precede and immediately follow the
+ -- values in the Index_Type.)
+
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
+ -- We do allow a value greater than Container.Last to be specified as
+ -- the Index, but only if it's immediately greater. This allows for the
+ -- case of appending items to the back end of the vector. (It is assumed
+ -- that specifying an index value greater than Last + 1 indicates some
+ -- deeper flaw in the caller's algorithm, so that case is treated as a
+ -- proper error.)
+
if Before > Container.Last
and then Before > Container.Last + 1
then
@@ -795,67 +997,192 @@ package body Ada.Containers.Vectors is
"Before index is out of range (too large)";
end if;
+ -- We treat inserting 0 items into the container as a no-op, even when
+ -- the container is busy, so we simply return.
+
if Count = 0 then
return;
end if;
- declare
- Old_Last_As_Int : constant Int := Int (Container.Last);
+ -- There are two constraints we need to satisfy. The first constraint is
+ -- that a container cannot have more than Count_Type'Last elements, so
+ -- we must check the sum of the current length and the insertion
+ -- count. Note that we cannot simply add these values, because of the
+ -- possibilty of overflow.
- begin
- if Old_Last_As_Int > Int'Last - N then
- raise Constraint_Error with "new length is out of range";
- end if;
+ if Old_Length > Count_Type'Last - Count then
+ raise Constraint_Error with "Count is out of range";
+ end if;
- New_Last_As_Int := Old_Last_As_Int + N;
+ -- It is now safe compute the length of the new vector, without fear of
+ -- overflow.
- if New_Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
+ New_Length := Old_Length + Count;
+
+ -- The second constraint is that the new Last index value cannot exceed
+ -- Index_Type'Last. In each branch below, we calculate the maximum
+ -- length (computed from the range of values in Index_Type), and then
+ -- compare the new length to the maximum length. If the new length is
+ -- acceptable, then we compute the new last index from that.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We have to handle the case when there might be more values in the
+ -- range of Index_Type than in the range of Count_Type.
+
+ if Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is
+ -- less than 0, so it is safe to compute the following sum without
+ -- fear of overflow.
+
+ Index := No_Index + Index_Type'Base (Count_Type'Last);
+
+ if Index <= Index_Type'Last then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the
+ -- maximum number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than in Count_Type,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
+ end if;
+
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute
+ -- the difference without fear of overflow (which we would have to
+ -- worry about if No_Index were less than 0, but that case is
+ -- handled above).
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
- New_Length := UInt (New_Last_As_Int - First + Int'(1));
+ elsif Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is less
+ -- than 0, so it is safe to compute the following sum without fear of
+ -- overflow.
- if New_Length > Max_Length then
- raise Constraint_Error with "new length is out of range";
+ J := Count_Type'Base (No_Index) + Count_Type'Last;
+
+ if J <= Count_Type'Base (Index_Type'Last) then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the maximum
+ -- number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than Count_Type does,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
- New_Last := Index_Type (New_Last_As_Int);
- end;
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute the
+ -- difference without fear of overflow (which we would have to worry
+ -- about if No_Index were less than 0, but that case is handled
+ -- above).
- if Container.Busy > 0 then
- raise Program_Error with
- "attempt to tamper with elements (vector is busy)";
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
+ end if;
+
+ -- We have just computed the maximum length (number of items). We must
+ -- now compare the requested length to the maximum length, as we do not
+ -- allow a vector expand beyond the maximum (because that would create
+ -- an internal array with a last index value greater than
+ -- Index_Type'Last, with no way to index those elements).
+
+ if New_Length > Max_Length then
+ raise Constraint_Error with "Count is out of range";
+ end if;
+
+ -- New_Last is the last index value of the items in the container after
+ -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to
+ -- compute its value from the New_Length.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ New_Last := No_Index + Index_Type'Base (New_Length);
+
+ else
+ New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length);
end if;
if Container.Elements = null then
+ pragma Assert (Container.Last = No_Index);
+
+ -- This is the simplest case, with which we must always begin: we're
+ -- inserting items into an empty vector that hasn't allocated an
+ -- internal array yet. Note that we don't need to check the busy bit
+ -- here, because an empty container cannot be busy.
+
+ -- In order to preserve container invariants, we allocate the new
+ -- internal array first, before setting the Last index value, in case
+ -- the allocation fails (which can happen either because there is no
+ -- storage available, or because element initialization fails).
+
Container.Elements := new Elements_Type'
(Last => New_Last,
EA => (others => New_Item));
+
+ -- The allocation of the new, internal array succeeded, so it is now
+ -- safe to update the Last index, restoring container invariants.
+
Container.Last := New_Last;
+
return;
end if;
- if New_Last <= Container.Elements.Last then
+ -- The tampering bits exist to prevent an item from being harmfully
+ -- manipulated while it is being visited. Query, Update, and Iterate
+ -- increment the busy count on entry, and decrement the count on
+ -- exit. Insert checks the count to determine whether it is being called
+ -- while the associated callback procedure is executing.
+
+ if Container.Busy > 0 then
+ raise Program_Error with
+ "attempt to tamper with elements (vector is busy)";
+ end if;
+
+ -- An internal array has already been allocated, so we must determine
+ -- whether there is enough unused storage for the new items.
+
+ if New_Length <= Container.Elements.EA'Length then
+ -- In this case, we're inserting elements into a vector that has
+ -- already allocated an internal array, and the existing array has
+ -- enough unused storage for the new items.
+
declare
EA : Elements_Array renames Container.Elements.EA;
begin
- if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ if Before > Container.Last then
+ -- The new items are being appended to the vector, so no
+ -- sliding of existing elements is required.
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ EA (Before .. New_Last) := (others => New_Item);
- begin
- EA (Index .. New_Last) := EA (Before .. Container.Last);
+ else
+ -- The new items are being inserted before some existing
+ -- elements, so we must slide the existing elements up to their
+ -- new home. We use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate index values.
- EA (Before .. Index_Type'Pred (Index)) :=
- (others => New_Item);
- end;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
- else
- EA (Before .. New_Last) := (others => New_Item);
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
+
+ EA (Index .. New_Last) := EA (Before .. Container.Last);
+ EA (Before .. Index - 1) := (others => New_Item);
end if;
end;
@@ -863,67 +1190,79 @@ package body Ada.Containers.Vectors is
return;
end if;
- declare
- C, CC : UInt;
+ -- In this case, we're inserting elements into a vector that has already
+ -- allocated an internal array, but the existing array does not have
+ -- enough storage, so we must allocate a new, longer array. In order to
+ -- guarantee that the amortized insertion cost is O(1), we always
+ -- allocate an array whose length is some power-of-two factor of the
+ -- current array length. (The new array cannot have a length less than
+ -- the New_Length of the container, but its last index value cannot be
+ -- greater than Index_Type'Last.)
+
+ New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length);
+ while New_Capacity < New_Length loop
+ if New_Capacity > Count_Type'Last / 2 then
+ New_Capacity := Count_Type'Last;
+ exit;
+ end if;
- begin
- C := UInt'Max (1, Container.Elements.EA'Length); -- ???
- while C < New_Length loop
- if C > UInt'Last / 2 then
- C := UInt'Last;
- exit;
- end if;
+ New_Capacity := 2 * New_Capacity;
+ end loop;
- C := 2 * C;
- end loop;
+ if New_Capacity > Max_Length then
+ -- We have reached the limit of capacity, so no further expansion
+ -- will occur. (This is not a problem, as there is never a need to
+ -- have more capacity than the maximum container length.)
- if C > Max_Length then
- C := Max_Length;
- end if;
+ New_Capacity := Max_Length;
+ end if;
- if Index_Type'First <= 0
- and then Index_Type'Last >= 0
- then
- CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
- else
- CC := UInt (Int (Index_Type'Last) - First + 1);
- end if;
+ -- We have computed the length of the new internal array (and this is
+ -- what "vector capacity" means), so use that to compute its last index.
- if C > CC then
- C := CC;
- end if;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Dst_Last := No_Index + Index_Type'Base (New_Capacity);
- declare
- Dst_Last : constant Index_Type :=
- Index_Type (First + UInt'Pos (C) - 1);
+ else
+ Dst_Last :=
+ Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity);
+ end if;
- begin
- Dst := new Elements_Type (Dst_Last);
- end;
- end;
+ -- Now we allocate the new, longer internal array. If the allocation
+ -- fails, we have not changed any container state, so no side-effect
+ -- will occur as a result of propagating the exception.
+
+ Dst := new Elements_Type (Dst_Last);
+
+ -- We have our new internal array. All that needs to be done now is to
+ -- copy the existing items (if any) from the old array (the "source"
+ -- array, object SA below) to the new array (the "destination" array,
+ -- object DA below), and then deallocate the old array.
declare
- SA : Elements_Array renames Container.Elements.EA;
- DA : Elements_Array renames Dst.EA;
+ SA : Elements_Array renames Container.Elements.EA; -- source
+ DA : Elements_Array renames Dst.EA; -- destination
begin
- DA (Index_Type'First .. Index_Type'Pred (Before)) :=
- SA (Index_Type'First .. Index_Type'Pred (Before));
+ DA (Index_Type'First .. Before - 1) :=
+ SA (Index_Type'First .. Before - 1);
- if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ if Before > Container.Last then
+ DA (Before .. New_Last) := (others => New_Item);
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ else
+ -- The new items are being inserted before some existing elements,
+ -- so we must slide the existing elements up to their new home.
- begin
- DA (Before .. Index_Type'Pred (Index)) := (others => New_Item);
- DA (Index .. New_Last) := SA (Before .. Container.Last);
- end;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
- else
- DA (Before .. New_Last) := (others => New_Item);
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
+
+ DA (Before .. Index - 1) := (others => New_Item);
+ DA (Index .. New_Last) := SA (Before .. Container.Last);
end if;
exception
when others =>
@@ -931,11 +1270,23 @@ package body Ada.Containers.Vectors is
raise;
end;
+ -- We have successfully copied the items onto the new array, so the
+ -- final thing to do is deallocate the old array.
+
declare
X : Elements_Access := Container.Elements;
begin
+ -- We first isolate the old internal array, removing it from the
+ -- container and replacing it with the new internal array, before we
+ -- deallocate the old array (which can fail if finalization of
+ -- elements propagates an exception).
+
Container.Elements := Dst;
Container.Last := New_Last;
+
+ -- The container invariants have been restored, so it is now safe to
+ -- attempt to deallocate the old array.
+
Free (X);
end;
end Insert;
@@ -946,83 +1297,118 @@ package body Ada.Containers.Vectors is
New_Item : Vector)
is
N : constant Count_Type := Length (New_Item);
+ J : Index_Type'Base;
begin
- if Before < Index_Type'First then
- raise Constraint_Error with
- "Before index is out of range (too small)";
+ -- Use Insert_Space to create the "hole" (the destination slice) into
+ -- which we copy the source items.
+
+ Insert_Space (Container, Before, Count => N);
+
+ if N = 0 then
+ -- There's nothing else to do here (vetting of parameters was
+ -- performed already in Insert_Space), so we simply return.
+
+ return;
end if;
- if Before > Container.Last
- and then Before > Container.Last + 1
- then
- raise Constraint_Error with
- "Before index is out of range (too large)";
+ -- We calculate the last index value of the destination slice using the
+ -- wider of Index_Type'Base and count_Type'Base.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ J := (Before - 1) + Index_Type'Base (N);
+
+ else
+ J := Index_Type'Base (Count_Type'Base (Before - 1) + N);
end if;
- if N = 0 then
+ if Container'Address /= New_Item'Address then
+ -- This is the simple case. New_Item denotes an object different
+ -- from Container, so there's nothing special we need to do to copy
+ -- the source items to their destination, because all of the source
+ -- items are contiguous.
+
+ Container.Elements.EA (Before .. J) :=
+ New_Item.Elements.EA (Index_Type'First .. New_Item.Last);
+
return;
end if;
- Insert_Space (Container, Before, Count => N);
+ -- New_Item denotes the same object as Container, so an insertion has
+ -- potentially split the source items. The destination is always the
+ -- range [Before, J], but the source is [Index_Type'First, Before) and
+ -- (J, Container.Last]. We perform the copy in two steps, using each of
+ -- the two slices of the source items.
declare
- Dst_Last_As_Int : constant Int'Base :=
- Int'Base (Before) + Int'Base (N) - 1;
-
- Dst_Last : constant Index_Type := Index_Type (Dst_Last_As_Int);
+ L : constant Index_Type'Base := Before - 1;
- begin
- if Container'Address /= New_Item'Address then
- Container.Elements.EA (Before .. Dst_Last) :=
- New_Item.Elements.EA (Index_Type'First .. New_Item.Last);
+ subtype Src_Index_Subtype is Index_Type'Base range
+ Index_Type'First .. L;
- return;
- end if;
+ Src : Elements_Array renames
+ Container.Elements.EA (Src_Index_Subtype);
- declare
- subtype Src_Index_Subtype is Index_Type'Base range
- Index_Type'First .. Before - 1;
+ K : Index_Type'Base;
- Src : Elements_Array renames
- Container.Elements.EA (Src_Index_Subtype);
+ begin
+ -- We first copy the source items that precede the space we
+ -- inserted. Index value K is the last index of that portion
+ -- destination that receives this slice of the source. (If Before
+ -- equals Index_Type'First, then this first source slice will be
+ -- empty, which is harmless.)
- Index_As_Int : constant Int'Base :=
- Int (Before) + Src'Length - 1;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ K := L + Index_Type'Base (Src'Length);
- Index : constant Index_Type'Base :=
- Index_Type'Base (Index_As_Int);
+ else
+ K := Index_Type'Base (Count_Type'Base (L) + Src'Length);
+ end if;
- Dst : Elements_Array renames
- Container.Elements.EA (Before .. Index);
+ Container.Elements.EA (Before .. K) := Src;
- begin
- Dst := Src;
- end;
+ if Src'Length = N then
+ -- The new items were effectively appended to the container, so we
+ -- have already copied all of the items that need to be copied.
+ -- We return early here, even though the source slice below is
+ -- empty (so the assignment would be harmless), because we want to
+ -- avoid computing J + 1, which will overflow if J equals
+ -- Index_Type'Base'Last.
- if Dst_Last = Container.Last then
return;
end if;
+ end;
- declare
- subtype Src_Index_Subtype is Index_Type'Base range
- Dst_Last + 1 .. Container.Last;
+ declare
+ -- Note that we want to avoid computing J + 1 here, in case J equals
+ -- Index_Type'Base'Last. We prevent that by returning early above,
+ -- immediately after copying the first slice of the source, and
+ -- determining that this second slice of the source is empty.
- Src : Elements_Array renames
- Container.Elements.EA (Src_Index_Subtype);
+ F : constant Index_Type'Base := J + 1;
- Index_As_Int : constant Int'Base :=
- Dst_Last_As_Int - Src'Length + 1;
+ subtype Src_Index_Subtype is Index_Type'Base range
+ F .. Container.Last;
- Index : constant Index_Type :=
- Index_Type (Index_As_Int);
+ Src : Elements_Array renames
+ Container.Elements.EA (Src_Index_Subtype);
- Dst : Elements_Array renames
- Container.Elements.EA (Index .. Dst_Last);
+ K : Index_Type'Base;
- begin
- Dst := Src;
- end;
+ begin
+ -- We next copy the source items that follow the space we
+ -- inserted. Index value K is the first index of that portion of the
+ -- destination that receives this slice of the source. (For the
+ -- reasons given above, this slice is guaranteed to be non-empty.)
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ K := F - Index_Type'Base (Src'Length);
+
+ else
+ K := Index_Type'Base (Count_Type'Base (F) - Src'Length);
+ end if;
+
+ Container.Elements.EA (K .. J) := Src;
end;
end Insert;
@@ -1224,22 +1610,42 @@ package body Ada.Containers.Vectors is
Before : Extended_Index;
Count : Count_Type := 1)
is
- N : constant Int := Count_Type'Pos (Count);
+ Old_Length : constant Count_Type := Container.Length;
- First : constant Int := Int (Index_Type'First);
- New_Last_As_Int : Int'Base;
- New_Last : Index_Type;
- New_Length : UInt;
- Max_Length : constant UInt := UInt (Count_Type'Last);
+ Max_Length : Count_Type'Base; -- determined from range of Index_Type
+ New_Length : Count_Type'Base; -- sum of current length and Count
+ New_Last : Index_Type'Base; -- last index of vector after insertion
- Dst : Elements_Access;
+ Index : Index_Type'Base; -- scratch for intermediate values
+ J : Count_Type'Base; -- scratch
+
+ New_Capacity : Count_Type'Base; -- length of new, expanded array
+ Dst_Last : Index_Type'Base; -- last index of new, expanded array
+ Dst : Elements_Access; -- new, expanded internal array
begin
+ -- As a precondition on the generic actual Index_Type, the base type
+ -- must include Index_Type'Pred (Index_Type'First); this is the value
+ -- that Container.Last assumes when the vector is empty. However, we do
+ -- not allow that as the value for Index when specifying where the new
+ -- items should be inserted, so we must manually check. (That the user
+ -- is allowed to specify the value at all here is a consequence of the
+ -- declaration of the Extended_Index subtype, which includes the values
+ -- in the base range that immediately precede and immediately follow the
+ -- values in the Index_Type.)
+
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
+ -- We do allow a value greater than Container.Last to be specified as
+ -- the Index, but only if it's immediately greater. This allows for the
+ -- case of appending items to the back end of the vector. (It is assumed
+ -- that specifying an index value greater than Last + 1 indicates some
+ -- deeper flaw in the caller's algorithm, so that case is treated as a
+ -- proper error.)
+
if Before > Container.Last
and then Before > Container.Last + 1
then
@@ -1247,58 +1653,184 @@ package body Ada.Containers.Vectors is
"Before index is out of range (too large)";
end if;
+ -- We treat inserting 0 items into the container as a no-op, even when
+ -- the container is busy, so we simply return.
+
if Count = 0 then
return;
end if;
- declare
- Old_Last_As_Int : constant Int := Int (Container.Last);
+ -- There are two constraints we need to satisfy. The first constraint is
+ -- that a container cannot have more than Count_Type'Last elements, so
+ -- we must check the sum of the current length and the insertion
+ -- count. Note that we cannot simply add these values, because of the
+ -- possibilty of overflow.
- begin
- if Old_Last_As_Int > Int'Last - N then
- raise Constraint_Error with "new length is out of range";
- end if;
+ if Old_Length > Count_Type'Last - Count then
+ raise Constraint_Error with "Count is out of range";
+ end if;
- New_Last_As_Int := Old_Last_As_Int + N;
+ -- It is now safe compute the length of the new vector, without fear of
+ -- overflow.
- if New_Last_As_Int > Int (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
+ New_Length := Old_Length + Count;
+
+ -- The second constraint is that the new Last index value cannot exceed
+ -- Index_Type'Last. In each branch below, we calculate the maximum
+ -- length (computed from the range of values in Index_Type), and then
+ -- compare the new length to the maximum length. If the new length is
+ -- acceptable, then we compute the new last index from that.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We have to handle the case when there might be more values in the
+ -- range of Index_Type than in the range of Count_Type.
+
+ if Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is
+ -- less than 0, so it is safe to compute the following sum without
+ -- fear of overflow.
+
+ Index := No_Index + Index_Type'Base (Count_Type'Last);
+
+ if Index <= Index_Type'Last then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the
+ -- maximum number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than in Count_Type,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
+ end if;
+
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute
+ -- the difference without fear of overflow (which we would have to
+ -- worry about if No_Index were less than 0, but that case is
+ -- handled above).
+
+ Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
- New_Length := UInt (New_Last_As_Int - First + Int'(1));
+ elsif Index_Type'First <= 0 then
+ -- We know that No_Index (the same as Index_Type'First - 1) is less
+ -- than 0, so it is safe to compute the following sum without fear of
+ -- overflow.
- if New_Length > Max_Length then
- raise Constraint_Error with "new length is out of range";
+ J := Count_Type'Base (No_Index) + Count_Type'Last;
+
+ if J <= Count_Type'Base (Index_Type'Last) then
+ -- We have determined that range of Index_Type has at least as
+ -- many values as in Count_Type, so Count_Type'Last is the maximum
+ -- number of items that are allowed.
+
+ Max_Length := Count_Type'Last;
+
+ else
+ -- The range of Index_Type has fewer values than Count_Type does,
+ -- so the maximum number of items is computed from the range of
+ -- the Index_Type.
+
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
- New_Last := Index_Type (New_Last_As_Int);
- end;
+ else
+ -- No_Index is equal or greater than 0, so we can safely compute the
+ -- difference without fear of overflow (which we would have to worry
+ -- about if No_Index were less than 0, but that case is handled
+ -- above).
- if Container.Busy > 0 then
- raise Program_Error with
- "attempt to tamper with elements (vector is busy)";
+ Max_Length :=
+ Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
+ end if;
+
+ -- We have just computed the maximum length (number of items). We must
+ -- now compare the requested length to the maximum length, as we do not
+ -- allow a vector expand beyond the maximum (because that would create
+ -- an internal array with a last index value greater than
+ -- Index_Type'Last, with no way to index those elements).
+
+ if New_Length > Max_Length then
+ raise Constraint_Error with "Count is out of range";
+ end if;
+
+ -- New_Last is the last index value of the items in the container after
+ -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to
+ -- compute its value from the New_Length.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ New_Last := No_Index + Index_Type'Base (New_Length);
+
+ else
+ New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length);
end if;
if Container.Elements = null then
+ pragma Assert (Container.Last = No_Index);
+
+ -- This is the simplest case, with which we must always begin: we're
+ -- inserting items into an empty vector that hasn't allocated an
+ -- internal array yet. Note that we don't need to check the busy bit
+ -- here, because an empty container cannot be busy.
+
+ -- In order to preserve container invariants, we allocate the new
+ -- internal array first, before setting the Last index value, in case
+ -- the allocation fails (which can happen either because there is no
+ -- storage available, or because default-valued element
+ -- initialization fails).
+
Container.Elements := new Elements_Type (New_Last);
+
+ -- The allocation of the new, internal array succeeded, so it is now
+ -- safe to update the Last index, restoring container invariants.
+
Container.Last := New_Last;
+
return;
end if;
+ -- The tampering bits exist to prevent an item from being harmfully
+ -- manipulated while it is being visited. Query, Update, and Iterate
+ -- increment the busy count on entry, and decrement the count on
+ -- exit. Insert checks the count to determine whether it is being called
+ -- while the associated callback procedure is executing.
+
+ if Container.Busy > 0 then
+ raise Program_Error with
+ "attempt to tamper with elements (vector is busy)";
+ end if;
+
+ -- An internal array has already been allocated, so we must determine
+ -- whether there is enough unused storage for the new items.
+
if New_Last <= Container.Elements.Last then
+ -- In this case, we're inserting space into a vector that has already
+ -- allocated an internal array, and the existing array has enough
+ -- unused storage for the new items.
+
declare
EA : Elements_Array renames Container.Elements.EA;
+
begin
if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ -- The space is being inserted before some existing elements,
+ -- so we must slide the existing elements up to their new
+ -- home. We use the wider of Index_Type'Base and
+ -- Count_Type'Base as the type for intermediate index values.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
- begin
- EA (Index .. New_Last) := EA (Before .. Container.Last);
- end;
+ EA (Index .. New_Last) := EA (Before .. Container.Last);
end if;
end;
@@ -1306,63 +1838,75 @@ package body Ada.Containers.Vectors is
return;
end if;
- declare
- C, CC : UInt;
+ -- In this case, we're inserting space into a vector that has already
+ -- allocated an internal array, but the existing array does not have
+ -- enough storage, so we must allocate a new, longer array. In order to
+ -- guarantee that the amortized insertion cost is O(1), we always
+ -- allocate an array whose length is some power-of-two factor of the
+ -- current array length. (The new array cannot have a length less than
+ -- the New_Length of the container, but its last index value cannot be
+ -- greater than Index_Type'Last.)
+
+ New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length);
+ while New_Capacity < New_Length loop
+ if New_Capacity > Count_Type'Last / 2 then
+ New_Capacity := Count_Type'Last;
+ exit;
+ end if;
- begin
- C := UInt'Max (1, Container.Elements.EA'Length); -- ???
- while C < New_Length loop
- if C > UInt'Last / 2 then
- C := UInt'Last;
- exit;
- end if;
+ New_Capacity := 2 * New_Capacity;
+ end loop;
- C := 2 * C;
- end loop;
+ if New_Capacity > Max_Length then
+ -- We have reached the limit of capacity, so no further expansion
+ -- will occur. (This is not a problem, as there is never a need to
+ -- have more capacity than the maximum container length.)
- if C > Max_Length then
- C := Max_Length;
- end if;
+ New_Capacity := Max_Length;
+ end if;
- if Index_Type'First <= 0
- and then Index_Type'Last >= 0
- then
- CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
- else
- CC := UInt (Int (Index_Type'Last) - First + 1);
- end if;
+ -- We have computed the length of the new internal array (and this is
+ -- what "vector capacity" means), so use that to compute its last index.
- if C > CC then
- C := CC;
- end if;
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Dst_Last := No_Index + Index_Type'Base (New_Capacity);
- declare
- Dst_Last : constant Index_Type :=
- Index_Type (First + UInt'Pos (C) - 1);
+ else
+ Dst_Last :=
+ Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity);
+ end if;
- begin
- Dst := new Elements_Type (Dst_Last);
- end;
- end;
+ -- Now we allocate the new, longer internal array. If the allocation
+ -- fails, we have not changed any container state, so no side-effect
+ -- will occur as a result of propagating the exception.
+
+ Dst := new Elements_Type (Dst_Last);
+
+ -- We have our new internal array. All that needs to be done now is to
+ -- copy the existing items (if any) from the old array (the "source"
+ -- array, object SA below) to the new array (the "destination" array,
+ -- object DA below), and then deallocate the old array.
declare
- SA : Elements_Array renames Container.Elements.EA;
- DA : Elements_Array renames Dst.EA;
+ SA : Elements_Array renames Container.Elements.EA; -- source
+ DA : Elements_Array renames Dst.EA; -- destination
begin
- DA (Index_Type'First .. Index_Type'Pred (Before)) :=
- SA (Index_Type'First .. Index_Type'Pred (Before));
+ DA (Index_Type'First .. Before - 1) :=
+ SA (Index_Type'First .. Before - 1);
if Before <= Container.Last then
- declare
- Index_As_Int : constant Int'Base :=
- Index_Type'Pos (Before) + N;
+ -- The space is being inserted before some existing elements, so
+ -- we must slide the existing elements up to their new home.
- Index : constant Index_Type := Index_Type (Index_As_Int);
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ Index := Before + Index_Type'Base (Count);
- begin
- DA (Index .. New_Last) := SA (Before .. Container.Last);
- end;
+ else
+ Index := Index_Type'Base (Count_Type'Base (Before) + Count);
+ end if;
+
+ DA (Index .. New_Last) := SA (Before .. Container.Last);
end if;
exception
when others =>
@@ -1370,11 +1914,24 @@ package body Ada.Containers.Vectors is
raise;
end;
+ -- We have successfully copied the items onto the new array, so the
+ -- final thing to do is restore invariants, and deallocate the old
+ -- array.
+
declare
X : Elements_Access := Container.Elements;
begin
+ -- We first isolate the old internal array, removing it from the
+ -- container and replacing it with the new internal array, before we
+ -- deallocate the old array (which can fail if finalization of
+ -- elements propagates an exception).
+
Container.Elements := Dst;
Container.Last := New_Last;
+
+ -- The container invariants have been restored, so it is now safe to
+ -- attempt to deallocate the old array.
+
Free (X);
end;
end Insert_Space;
@@ -1501,12 +2058,33 @@ package body Ada.Containers.Vectors is
------------
function Length (Container : Vector) return Count_Type is
- L : constant Int := Int (Container.Last);
- F : constant Int := Int (Index_Type'First);
- N : constant Int'Base := L - F + 1;
-
- begin
- return Count_Type (N);
+ L : constant Index_Type'Base := Container.Last;
+ F : constant Index_Type := Index_Type'First;
+
+ begin
+ -- The base range of the index type (Index_Type'Base) might not include
+ -- all values for length (Count_Type). Contrariwise, the index type
+ -- might include values outside the range of length. Hence we use
+ -- whatever type is wider for intermediate values when calculating
+ -- length. Note that no matter what the index type is, the maximum
+ -- length to which a vector is allowed to grow is always the minimum
+ -- of Count_Type'Last and (IT'Last - IT'First + 1).
+
+ -- For example, an Index_Type with range -127 .. 127 is only guaranteed
+ -- to have a base range of -128 .. 127, but the corresponding vector
+ -- would have lengths in the range 0 .. 255. In this case we would need
+ -- to use Count_Type'Base for intermediate values.
+
+ -- Another case would be the index range -2**63 + 1 .. -2**63 + 10. The
+ -- vector would have a maximum length of 10, but the index values lie
+ -- outside the range of Count_Type (which is only 32 bits). In this
+ -- case we would need to use Index_Type'Base for intermediate values.
+
+ if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then
+ return Count_Type'Base (L) - Count_Type'Base (F) + 1;
+ else
+ return Count_Type (L - F + 1);
+ end if;
end Length;
----------
@@ -1767,17 +2345,51 @@ package body Ada.Containers.Vectors is
is
N : constant Count_Type := Length (Container);
+ Index : Count_Type'Base;
+ Last : Index_Type'Base;
+
begin
+ -- Reserve_Capacity can be used to either expand the storage available
+ -- for elements (this would be its typical use, in anticipation of
+ -- future insertion), or to trim back storage. In the latter case,
+ -- storage can only be trimmed back to the limit of the container
+ -- length. Note that Reserve_Capacity neither deletes (active) elements
+ -- nor inserts elements; it only affects container capacity, never
+ -- container length.
+
if Capacity = 0 then
+ -- This is a request to trim back storage, to the minimum amount
+ -- possible given the current state of the container.
+
if N = 0 then
+ -- The container is empty, so in this unique case we can
+ -- deallocate the entire internal array. Note that an empty
+ -- container can never be busy, so there's no need to check the
+ -- tampering bits.
+
declare
X : Elements_Access := Container.Elements;
begin
+ -- First we remove the internal array from the container, to
+ -- handle the case when the deallocation raises an exception.
+
Container.Elements := null;
+
+ -- Container invariants have been restored, so it is now safe
+ -- to attempt to deallocate the internal array.
+
Free (X);
end;
elsif N < Container.Elements.EA'Length then
+ -- The container is not empty, and the current length is less than
+ -- the current capacity, so there's storage available to trim. In
+ -- this case, we allocate a new internal array having a length
+ -- that exactly matches the number of items in the
+ -- container. (Reserve_Capacity does not delete active elements,
+ -- so this is the best we can do with respect to minimizing
+ -- storage).
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
@@ -1793,7 +2405,23 @@ package body Ada.Containers.Vectors is
X : Elements_Access := Container.Elements;
begin
+ -- Although we have isolated the old internal array that we're
+ -- going to deallocate, we don't deallocate it until we have
+ -- successfully allocated a new one. If there is an exception
+ -- during allocation (either because there is not enough
+ -- storage, or because initialization of the elements fails),
+ -- we let it propagate without causing any side-effect.
+
Container.Elements := new Elements_Type'(Container.Last, Src);
+
+ -- We have succesfully allocated a new internal array (with a
+ -- smaller length than the old one, and containing a copy of
+ -- just the active elements in the container), so it is now
+ -- safe to attempt to deallocate the old array. The old array
+ -- has been isolated, and container invariants have been
+ -- restored, so if the deallocation fails (because finalization
+ -- of the elements fails), we simply let it propagate.
+
Free (X);
end;
end if;
@@ -1801,29 +2429,102 @@ package body Ada.Containers.Vectors is
return;
end if;
- if Container.Elements = null then
- declare
- Last_As_Int : constant Int'Base :=
- Int (Index_Type'First) + Int (Capacity) - 1;
+ -- Reserve_Capacity can be used to expand the storage available for
+ -- elements, but we do not let the capacity grow beyond the number of
+ -- values in Index_Type'Range. (Were it otherwise, there would be no way
+ -- to refer to the elements with an index value greater than
+ -- Index_Type'Last, so that storage would be wasted.) Here we compute
+ -- the Last index value of the new internal array, in a way that avoids
+ -- any possibility of overflow.
+
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (Capacity) < No_Index then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
- begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
- declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ Last := No_Index + Index_Type'Base (Capacity);
- begin
- Container.Elements := new Elements_Type (Last);
- end;
- end;
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
+
+ if Last > Index_Type'Last then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
+
+ elsif Index_Type'First <= 0 then
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of Capacity.
+
+ Index := Count_Type'Base (No_Index) + Capacity; -- Last
+
+ if Index > Count_Type'Base (Index_Type'Last) then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
+
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
+
+ Last := Index_Type'Base (Index);
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
+
+ Index := Count_Type'Base (Index_Type'Last) - Capacity; -- No_Index
+
+ if Index < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "Capacity is out of range";
+ end if;
+
+ -- We have determined that the value of Capacity would not create a
+ -- Last index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
+
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + Capacity);
+ end if;
+
+ -- The requested capacity is non-zero, but we don't know yet whether
+ -- this is a request for expansion or contraction of storage.
+
+ if Container.Elements = null then
+ -- The container is empty (it doesn't even have an internal array),
+ -- so this represents a request to allocate (expand) storage having
+ -- the given capacity.
+
+ Container.Elements := new Elements_Type (Last);
return;
end if;
if Capacity <= N then
+ -- This is a request to trim back storage, but only to the limit of
+ -- what's already in the container. (Reserve_Capacity never deletes
+ -- active elements, it only reclaims excess storage.)
+
if N < Container.Elements.EA'Length then
+ -- The container is not empty (because the requested capacity is
+ -- positive, and less than or equal to the container length), and
+ -- the current length is less than the current capacity, so
+ -- there's storage available to trim. In this case, we allocate a
+ -- new internal array having a length that exactly matches the
+ -- number of items in the container.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
@@ -1839,63 +2540,99 @@ package body Ada.Containers.Vectors is
X : Elements_Access := Container.Elements;
begin
+ -- Although we have isolated the old internal array that we're
+ -- going to deallocate, we don't deallocate it until we have
+ -- successfully allocated a new one. If there is an exception
+ -- during allocation (either because there is not enough
+ -- storage, or because initialization of the elements fails),
+ -- we let it propagate without causing any side-effect.
+
Container.Elements := new Elements_Type'(Container.Last, Src);
+
+ -- We have succesfully allocated a new internal array (with a
+ -- smaller length than the old one, and containing a copy of
+ -- just the active elements in the container), so it is now
+ -- safe to attempt to deallocate the old array. The old array
+ -- has been isolated, and container invariants have been
+ -- restored, so if the deallocation fails (because finalization
+ -- of the elements fails), we simply let it propagate.
+
Free (X);
end;
-
end if;
return;
end if;
+ -- The requested capacity is larger than the container length (the
+ -- number of active elements). Whether this represents a request for
+ -- expansion or contraction of the current capacity depends on what the
+ -- current capacity is.
+
if Capacity = Container.Elements.EA'Length then
+ -- The requested capacity matches the existing capacity, so there's
+ -- nothing to do here. We treat this case as a no-op, and simply
+ -- return without checking the busy bit.
+
return;
end if;
+ -- There is a change in the capacity of a non-empty container, so a new
+ -- internal array will be allocated. (The length of the new internal
+ -- array could be less or greater than the old internal array. We know
+ -- only that the length of the new internal array is greater than the
+ -- number of active elements in the container.) We must check whether
+ -- the container is busy before doing anything else.
+
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
+ -- We now allocate a new internal array, having a length different from
+ -- its current value.
+
declare
- Last_As_Int : constant Int'Base :=
- Int (Index_Type'First) + Int (Capacity) - 1;
+ E : Elements_Access := new Elements_Type (Last);
begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
- raise Constraint_Error with "new length is out of range";
- end if;
+ -- We have successfully allocated the new internal array. We first
+ -- attempt to copy the existing elements from the old internal array
+ -- ("src" elements) onto the new internal array ("tgt" elements).
declare
- Last : constant Index_Type := Index_Type (Last_As_Int);
+ subtype Index_Subtype is Index_Type'Base range
+ Index_Type'First .. Container.Last;
+
+ Src : Elements_Array renames
+ Container.Elements.EA (Index_Subtype);
- E : Elements_Access := new Elements_Type (Last);
+ Tgt : Elements_Array renames E.EA (Index_Subtype);
begin
- declare
- subtype Index_Subtype is Index_Type'Base range
- Index_Type'First .. Container.Last;
+ Tgt := Src;
- Src : Elements_Array renames
- Container.Elements.EA (Index_Subtype);
+ exception
+ when others =>
+ Free (E);
+ raise;
+ end;
- Tgt : Elements_Array renames E.EA (Index_Subtype);
+ -- We have successfully copied the existing elements onto the new
+ -- internal array, so now we can attempt to deallocate the old one.
- begin
- Tgt := Src;
+ declare
+ X : Elements_Access := Container.Elements;
+ begin
+ -- First we isolate the old internal array, and replace it in the
+ -- container with the new internal array.
- exception
- when others =>
- Free (E);
- raise;
- end;
+ Container.Elements := E;
- declare
- X : Elements_Access := Container.Elements;
- begin
- Container.Elements := E;
- Free (X);
- end;
+ -- Container invariants have been restored, so it is now safe to
+ -- attempt to deallocate the old internal array.
+
+ Free (X);
end;
end;
end Reserve_Capacity;
@@ -2023,26 +2760,25 @@ package body Ada.Containers.Vectors is
----------------
procedure Set_Length (Container : in out Vector; Length : Count_Type) is
+ Count : constant Count_Type'Base := Container.Length - Length;
+
begin
- if Length = Vectors.Length (Container) then
- return;
- end if;
+ -- Set_Length allows the user to set the length explicitly, instead of
+ -- implicitly as a side-effect of deletion or insertion. If the
+ -- requested length is less then the current length, this is equivalent
+ -- to deleting items from the back end of the vector. If the requested
+ -- length is greater than the current length, then this is equivalent to
+ -- inserting "space" (nonce items) at the end.
- if Container.Busy > 0 then
- raise Program_Error with
- "attempt to tamper with elements (vector is busy)";
- end if;
+ if Count >= 0 then
+ Container.Delete_Last (Count);
- if Length > Capacity (Container) then
- Reserve_Capacity (Container, Capacity => Length);
- end if;
+ elsif Container.Last >= Index_Type'Last then
+ raise Constraint_Error with "vector is already at its maximum length";
- declare
- Last_As_Int : constant Int'Base :=
- Int (Index_Type'First) + Int (Length) - 1;
- begin
- Container.Last := Index_Type'Base (Last_As_Int);
- end;
+ else
+ Container.Insert_Space (Container.Last + 1, -Count);
+ end if;
end Set_Length;
----------
@@ -2135,54 +2871,176 @@ package body Ada.Containers.Vectors is
---------------
function To_Vector (Length : Count_Type) return Vector is
+ Index : Count_Type'Base;
+ Last : Index_Type'Base;
+ Elements : Elements_Access;
+
begin
if Length = 0 then
return Empty_Vector;
end if;
- declare
- First : constant Int := Int (Index_Type'First);
- Last_As_Int : constant Int'Base := First + Int (Length) - 1;
- Last : Index_Type;
- Elements : Elements_Access;
+ -- We create a vector object with a capacity that matches the specified
+ -- Length, but we do not allow the vector capacity (the length of the
+ -- internal array) to exceed the number of values in Index_Type'Range
+ -- (otherwise, there would be no way to refer to those components via an
+ -- index). We must therefore check whether the specified Length would
+ -- create a Last index value greater than Index_Type'Last.
- begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then
raise Constraint_Error with "Length is out of range";
end if;
- Last := Index_Type (Last_As_Int);
- Elements := new Elements_Type (Last);
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
- return Vector'(Controlled with Elements, Last, 0, 0);
- end;
+ Last := No_Index + Index_Type'Base (Length);
+
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
+
+ if Last > Index_Type'Last then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ elsif Index_Type'First <= 0 then
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of Length.
+
+ Index := Count_Type'Base (No_Index) + Length; -- Last
+
+ if Index > Count_Type'Base (Index_Type'Last) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
+
+ Last := Index_Type'Base (Index);
+
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
+
+ Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index
+
+ if Index < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We have determined that the value of Length would not create a
+ -- Last index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
+
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + Length);
+ end if;
+
+ Elements := new Elements_Type (Last);
+
+ return Vector'(Controlled with Elements, Last, 0, 0);
end To_Vector;
function To_Vector
(New_Item : Element_Type;
Length : Count_Type) return Vector
is
+ Index : Count_Type'Base;
+ Last : Index_Type'Base;
+ Elements : Elements_Access;
+
begin
if Length = 0 then
return Empty_Vector;
end if;
- declare
- First : constant Int := Int (Index_Type'First);
- Last_As_Int : constant Int'Base := First + Int (Length) - 1;
- Last : Index_Type;
- Elements : Elements_Access;
+ -- We create a vector object with a capacity that matches the specified
+ -- Length, but we do not allow the vector capacity (the length of the
+ -- internal array) to exceed the number of values in Index_Type'Range
+ -- (otherwise, there would be no way to refer to those components via an
+ -- index). We must therefore check whether the specified Length would
+ -- create a Last index value greater than Index_Type'Last.
- begin
- if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
+ if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then
+ -- We perform a two-part test. First we determine whether the
+ -- computed Last value lies in the base range of the type, and then
+ -- determine whether it lies in the range of the index (sub)type.
+
+ -- Last must satisfy this relation:
+ -- First + Length - 1 <= Last
+ -- We regroup terms:
+ -- First - 1 <= Last - Length
+ -- Which can rewrite as:
+ -- No_Index <= Last - Length
+
+ if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then
raise Constraint_Error with "Length is out of range";
end if;
- Last := Index_Type (Last_As_Int);
- Elements := new Elements_Type'(Last, EA => (others => New_Item));
+ -- We now know that the computed value of Last is within the base
+ -- range of the type, so it is safe to compute its value:
- return Vector'(Controlled with Elements, Last, 0, 0);
- end;
+ Last := No_Index + Index_Type'Base (Length);
+
+ -- Finally we test whether the value is within the range of the
+ -- generic actual index subtype:
+
+ if Last > Index_Type'Last then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ elsif Index_Type'First <= 0 then
+ -- Here we can compute Last directly, in the normal way. We know that
+ -- No_Index is less than 0, so there is no danger of overflow when
+ -- adding the (positive) value of Length.
+
+ Index := Count_Type'Base (No_Index) + Length; -- same value as V.Last
+
+ if Index > Count_Type'Base (Index_Type'Last) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We know that the computed value (having type Count_Type) of Last
+ -- is within the range of the generic actual index subtype, so it is
+ -- safe to convert to Index_Type:
+
+ Last := Index_Type'Base (Index);
+
+ else
+ -- Here Index_Type'First (and Index_Type'Last) is positive, so we
+ -- must test the length indirectly (by working backwards from the
+ -- largest possible value of Last), in order to prevent overflow.
+
+ Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index
+
+ if Index < Count_Type'Base (No_Index) then
+ raise Constraint_Error with "Length is out of range";
+ end if;
+
+ -- We have determined that the value of Length would not create a
+ -- Last index value outside of the range of Index_Type, so we can now
+ -- safely compute its value.
+
+ Last := Index_Type'Base (Count_Type'Base (No_Index) + Length);
+ end if;
+
+ Elements := new Elements_Type'(Last, EA => (others => New_Item));
+
+ return Vector'(Controlled with Elements, Last, 0, 0);
end To_Vector;
--------------------
diff --git a/gcc/ada/a-envvar.ads b/gcc/ada/a-envvar.ads
index a2415603e4e..9769c9bb1ee 100755
--- a/gcc/ada/a-envvar.ads
+++ b/gcc/ada/a-envvar.ads
@@ -37,7 +37,7 @@ package Ada.Environment_Variables is
-- environment variable with the given name and value, then
-- Constraint_Error is propagated.
-- It is implementation defined whether there exist values for which the
- -- call Set(Name, Value) has the same effect as Clear (Name).
+ -- call Set (Name, Value) has the same effect as Clear (Name).
procedure Clear (Name : String);
-- If the external execution environment supports environment variables,
diff --git a/gcc/ada/a-excpol-abort.adb b/gcc/ada/a-excpol-abort.adb
index daea6fb80da..94acae6a10b 100644
--- a/gcc/ada/a-excpol-abort.adb
+++ b/gcc/ada/a-excpol-abort.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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,7 +35,7 @@
-- that activates periodic polling. Then in the body of the polling routine
-- we test for asynchronous abort.
--- NT, OS/2, HPUX/DCE and SCO currently use this file
+-- Windows, HPUX 10 and VMS currently use this file
pragma Warnings (Off);
-- Allow withing of non-Preelaborated units in Ada 2005 mode where this
diff --git a/gcc/ada/a-ngcoty.adb b/gcc/ada/a-ngcoty.adb
index 81cc68a718a..7cf48713a6b 100644
--- a/gcc/ada/a-ngcoty.adb
+++ b/gcc/ada/a-ngcoty.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -43,6 +43,12 @@ package body Ada.Numerics.Generic_Complex_Types is
---------
function "*" (Left, Right : Complex) return Complex is
+
+ Scale : constant R := R (R'Machine_Radix) ** ((R'Machine_Emax - 1) / 2);
+ -- In case of overflow, scale the operands by the largest power of the
+ -- radix (to avoid rounding error), so that the square of the scale does
+ -- not overflow itself.
+
X : R;
Y : R;
@@ -53,14 +59,20 @@ package body Ada.Numerics.Generic_Complex_Types is
-- If either component overflows, try to scale (skip in fast math mode)
if not Standard'Fast_Math then
- if abs (X) > R'Last then
- X := R'(4.0) * (R'(Left.Re / 2.0) * R'(Right.Re / 2.0)
- - R'(Left.Im / 2.0) * R'(Right.Im / 2.0));
+
+ -- Note that the test below is written as a negation. This is to
+ -- account for the fact that X and Y may be NaNs, because both of
+ -- their operands could overflow. Given that all operations on NaNs
+ -- return false, the test can only be written thus.
+
+ if not (abs (X) <= R'Last) then
+ X := Scale**2 * ((Left.Re / Scale) * (Right.Re / Scale) -
+ (Left.Im / Scale) * (Right.Im / Scale));
end if;
- if abs (Y) > R'Last then
- Y := R'(4.0) * (R'(Left.Re / 2.0) * R'(Right.Im / 2.0)
- - R'(Left.Im / 2.0) * R'(Right.Re / 2.0));
+ if not (abs (Y) <= R'Last) then
+ Y := Scale**2 * ((Left.Re / Scale) * (Right.Im / Scale)
+ + (Left.Im / Scale) * (Right.Re / Scale));
end if;
end if;
@@ -569,7 +581,8 @@ package body Ada.Numerics.Generic_Complex_Types is
-- in order to prevent inaccuracies on machines where not all
-- immediate expressions are rounded, such as PowerPC.
- if Re2 > R'Last then
+ -- ??? same weird test, why not Re2 > R'Last ???
+ if not (Re2 <= R'Last) then
raise Constraint_Error;
end if;
@@ -582,7 +595,8 @@ package body Ada.Numerics.Generic_Complex_Types is
begin
Im2 := X.Im ** 2;
- if Im2 > R'Last then
+ -- ??? same weird test
+ if not (Im2 <= R'Last) then
raise Constraint_Error;
end if;
diff --git a/gcc/ada/a-nudira.adb b/gcc/ada/a-nudira.adb
index 87abcd8f100..ca81ba51895 100644
--- a/gcc/ada/a-nudira.adb
+++ b/gcc/ada/a-nudira.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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,64 +29,10 @@
-- --
------------------------------------------------------------------------------
-with Ada.Calendar;
-
-with Interfaces; use Interfaces;
-
package body Ada.Numerics.Discrete_Random is
- -------------------------
- -- Implementation Note --
- -------------------------
-
- -- The design of this spec is very awkward, as a result of Ada 95 not
- -- permitting in-out parameters for function formals (most naturally
- -- Generator values would be passed this way). In pure Ada 95, the only
- -- solution is to use the heap and pointers, and, to avoid memory leaks,
- -- controlled types.
-
- -- This is awfully heavy, so what we do is to use Unrestricted_Access to
- -- get a pointer to the state in the passed Generator. This works because
- -- Generator is a limited type and will thus always be passed by reference.
-
- type Pointer is access all State;
-
- Fits_In_32_Bits : constant Boolean :=
- Rst'Size < 31
- or else (Rst'Size = 31
- and then Rst'Pos (Rst'First) < 0);
- -- This is set True if we do not need more than 32 bits in the result. If
- -- we need 64-bits, we will only use the meaningful 48 bits of any 64-bit
- -- number generated, since if more than 48 bits are required, we split the
- -- computation into two separate parts, since the algorithm does not behave
- -- above 48 bits.
-
- -- The way this expression works is that obviously if the size is 31 bits,
- -- it fits in 32 bits. In the 32-bit case, it fits in 32-bit signed if the
- -- range has negative values. It is too conservative in the case that the
- -- programmer has set a size greater than the default, e.g. a size of 33
- -- for an integer type with a range of 1..10, but an over-conservative
- -- result is OK. The important thing is that the value is only True if
- -- we know the result will fit in 32-bits signed. If the value is False
- -- when it could be True, the behavior will be correct, just a bit less
- -- efficient than it could have been in some unusual cases.
- --
- -- One might assume that we could get a more accurate result by testing
- -- the lower and upper bounds of the type Rst against the bounds of 32-bit
- -- Integer. However, there is no easy way to do that. Why? Because in the
- -- relatively rare case where this expresion has to be evaluated at run
- -- time rather than compile time (when the bounds are dynamic), we need a
- -- type to use for the computation. But the possible range of upper bound
- -- values for Rst (remembering the possibility of 64-bit modular types) is
- -- from -2**63 to 2**64-1, and no run-time type has a big enough range.
-
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- function Square_Mod_N (X, N : Int) return Int;
- pragma Inline (Square_Mod_N);
- -- Computes X**2 mod N avoiding intermediate overflow
+ package SRN renames System.Random_Numbers;
+ use SRN;
-----------
-- Image --
@@ -94,204 +40,55 @@ package body Ada.Numerics.Discrete_Random is
function Image (Of_State : State) return String is
begin
- return Int'Image (Of_State.X1) &
- ',' &
- Int'Image (Of_State.X2) &
- ',' &
- Int'Image (Of_State.Q);
+ return Image (SRN.State (Of_State));
end Image;
------------
-- Random --
------------
- function Random (Gen : Generator) return Rst is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
- Temp : Int;
- TF : Flt;
-
+ function Random (Gen : Generator) return Result_Subtype is
+ function Random is
+ new SRN.Random_Discrete (Result_Subtype, Result_Subtype'First);
begin
- -- Check for flat range here, since we are typically run with checks
- -- off, note that in practice, this condition will usually be static
- -- so we will not actually generate any code for the normal case.
-
- if Rst'Last < Rst'First then
- raise Constraint_Error;
- end if;
-
- -- Continue with computation if non-flat range
-
- Genp.X1 := Square_Mod_N (Genp.X1, Genp.P);
- Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q);
- Temp := Genp.X2 - Genp.X1;
-
- -- Following duplication is not an error, it is a loop unwinding!
-
- if Temp < 0 then
- Temp := Temp + Genp.Q;
- end if;
-
- if Temp < 0 then
- Temp := Temp + Genp.Q;
- end if;
-
- TF := Offs + (Flt (Temp) * Flt (Genp.P) + Flt (Genp.X1)) * Genp.Scl;
-
- -- Pathological, but there do exist cases where the rounding implicit
- -- in calculating the scale factor will cause rounding to 'Last + 1.
- -- In those cases, returning 'First results in the least bias.
-
- if TF >= Flt (Rst'Pos (Rst'Last)) + 0.5 then
- return Rst'First;
-
- elsif not Fits_In_32_Bits then
- return Rst'Val (Interfaces.Integer_64 (TF));
-
- else
- return Rst'Val (Int (TF));
- end if;
+ return Random (SRN.Generator (Gen));
end Random;
-----------
-- Reset --
-----------
- procedure Reset (Gen : Generator; Initiator : Integer) is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
- X1, X2 : Int;
-
+ procedure Reset (Gen : Generator) is
begin
- X1 := 2 + Int (Initiator) mod (K1 - 3);
- X2 := 2 + Int (Initiator) mod (K2 - 3);
-
- for J in 1 .. 5 loop
- X1 := Square_Mod_N (X1, K1);
- X2 := Square_Mod_N (X2, K2);
- end loop;
-
- -- Eliminate effects of small Initiators
-
- Genp.all :=
- (X1 => X1,
- X2 => X2,
- P => K1,
- Q => K2,
- FP => K1F,
- Scl => Scal);
+ Reset (SRN.Generator (Gen));
end Reset;
- -----------
- -- Reset --
- -----------
-
- procedure Reset (Gen : Generator) is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
- Now : constant Calendar.Time := Calendar.Clock;
- X1 : Int;
- X2 : Int;
-
+ procedure Reset (Gen : Generator; Initiator : Integer) is
begin
- X1 := Int (Calendar.Year (Now)) * 12 * 31 +
- Int (Calendar.Month (Now) * 31) +
- Int (Calendar.Day (Now));
-
- X2 := Int (Calendar.Seconds (Now) * Duration (1000.0));
-
- X1 := 2 + X1 mod (K1 - 3);
- X2 := 2 + X2 mod (K2 - 3);
-
- -- Eliminate visible effects of same day starts
-
- for J in 1 .. 5 loop
- X1 := Square_Mod_N (X1, K1);
- X2 := Square_Mod_N (X2, K2);
- end loop;
-
- Genp.all :=
- (X1 => X1,
- X2 => X2,
- P => K1,
- Q => K2,
- FP => K1F,
- Scl => Scal);
-
+ Reset (SRN.Generator (Gen), Initiator);
end Reset;
- -----------
- -- Reset --
- -----------
-
procedure Reset (Gen : Generator; From_State : State) is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
begin
- Genp.all := From_State;
+ Reset (SRN.Generator (Gen), SRN.State (From_State));
end Reset;
----------
-- Save --
----------
- procedure Save (Gen : Generator; To_State : out State) is
+ procedure Save (Gen : Generator; To_State : out State) is
begin
- To_State := Gen.Gen_State;
+ Save (SRN.Generator (Gen), SRN.State (To_State));
end Save;
- ------------------
- -- Square_Mod_N --
- ------------------
-
- function Square_Mod_N (X, N : Int) return Int is
- begin
- return Int ((Integer_64 (X) ** 2) mod (Integer_64 (N)));
- end Square_Mod_N;
-
-----------
-- Value --
-----------
function Value (Coded_State : String) return State is
- Last : constant Natural := Coded_State'Last;
- Start : Positive := Coded_State'First;
- Stop : Positive := Coded_State'First;
- Outs : State;
-
begin
- while Stop <= Last and then Coded_State (Stop) /= ',' loop
- Stop := Stop + 1;
- end loop;
-
- if Stop > Last then
- raise Constraint_Error;
- end if;
-
- Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1));
- Start := Stop + 1;
-
- loop
- Stop := Stop + 1;
- exit when Stop > Last or else Coded_State (Stop) = ',';
- end loop;
-
- if Stop > Last then
- raise Constraint_Error;
- end if;
-
- Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1));
- Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last));
- Outs.P := Outs.Q * 2 + 1;
- Outs.FP := Flt (Outs.P);
- Outs.Scl := (RstL - RstF + 1.0) / (Flt (Outs.P) * Flt (Outs.Q));
-
- -- Now do *some* sanity checks
-
- if Outs.Q < 31
- or else Outs.X1 not in 2 .. Outs.P - 1
- or else Outs.X2 not in 2 .. Outs.Q - 1
- then
- raise Constraint_Error;
- end if;
-
- return Outs;
+ return State (SRN.State'(Value (Coded_State)));
end Value;
end Ada.Numerics.Discrete_Random;
diff --git a/gcc/ada/a-nudira.ads b/gcc/ada/a-nudira.ads
index 425aa6f9bc9..385f33619f3 100644
--- a/gcc/ada/a-nudira.ads
+++ b/gcc/ada/a-nudira.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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 --
@@ -33,39 +33,24 @@
-- --
------------------------------------------------------------------------------
--- Note: the implementation used in this package was contributed by Robert
--- Eachus. It is based on the work of L. Blum, M. Blum, and M. Shub, SIAM
--- Journal of Computing, Vol 15. No 2, May 1986. The particular choices for P
--- and Q chosen here guarantee a period of 562,085,314,430,582 (about 2**49),
--- and the generated sequence has excellent randomness properties. For further
--- details, see the paper "Fast Generation of Trustworthy Random Numbers", by
--- Robert Eachus, which describes both the algorithm and the efficient
--- implementation approach used here.
+-- Note: the implementation used in this package is a version of the
+-- Mersenne Twister. See s-rannum.adb for details and references.
-with Interfaces;
+with System.Random_Numbers;
generic
type Result_Subtype is (<>);
package Ada.Numerics.Discrete_Random is
- -- The algorithm used here is reliable from a required statistical point of
- -- view only up to 48 bits. We try to behave reasonably in the case of
- -- larger types, but we can't guarantee the required properties. So
- -- generate a warning for these (slightly) dubious cases.
-
- pragma Compile_Time_Warning
- (Result_Subtype'Size > 48,
- "statistical properties not guaranteed for size > 48");
-
-- Basic facilities
type Generator is limited private;
function Random (Gen : Generator) return Result_Subtype;
- procedure Reset (Gen : Generator);
procedure Reset (Gen : Generator; Initiator : Integer);
+ procedure Reset (Gen : Generator);
-- Advanced facilities
@@ -74,41 +59,15 @@ package Ada.Numerics.Discrete_Random is
procedure Save (Gen : Generator; To_State : out State);
procedure Reset (Gen : Generator; From_State : State);
- Max_Image_Width : constant := 80;
+ Max_Image_Width : constant := System.Random_Numbers.Max_Image_Width;
function Image (Of_State : State) return String;
function Value (Coded_State : String) return State;
private
- subtype Int is Interfaces.Integer_32;
- subtype Rst is Result_Subtype;
-
- -- We prefer to use 14 digits for Flt, but some targets are more limited
-
- type Flt is digits Positive'Min (14, Long_Long_Float'Digits);
-
- RstF : constant Flt := Flt (Rst'Pos (Rst'First));
- RstL : constant Flt := Flt (Rst'Pos (Rst'Last));
-
- Offs : constant Flt := RstF - 0.5;
-
- K1 : constant := 94_833_359;
- K1F : constant := 94_833_359.0;
- K2 : constant := 47_416_679;
- K2F : constant := 47_416_679.0;
- Scal : constant Flt := (RstL - RstF + 1.0) / (K1F * K2F);
- type State is record
- X1 : Int := Int (2999 ** 2);
- X2 : Int := Int (1439 ** 2);
- P : Int := K1;
- Q : Int := K2;
- FP : Flt := K1F;
- Scl : Flt := Scal;
- end record;
+ type Generator is new System.Random_Numbers.Generator;
- type Generator is limited record
- Gen_State : State;
- end record;
+ type State is new System.Random_Numbers.State;
end Ada.Numerics.Discrete_Random;
diff --git a/gcc/ada/a-nuflra.adb b/gcc/ada/a-nuflra.adb
index 7e6323b8e8d..2c6fbc47f6d 100644
--- a/gcc/ada/a-nuflra.adb
+++ b/gcc/ada/a-nuflra.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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,97 +29,10 @@
-- --
------------------------------------------------------------------------------
-with Ada.Calendar;
-
package body Ada.Numerics.Float_Random is
- -------------------------
- -- Implementation Note --
- -------------------------
-
- -- The design of this spec is very awkward, as a result of Ada 95 not
- -- permitting in-out parameters for function formals (most naturally
- -- Generator values would be passed this way). In pure Ada 95, the only
- -- solution is to use the heap and pointers, and, to avoid memory leaks,
- -- controlled types.
-
- -- This is awfully heavy, so what we do is to use Unrestricted_Access to
- -- get a pointer to the state in the passed Generator. This works because
- -- Generator is a limited type and will thus always be passed by reference.
-
- type Pointer is access all State;
-
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int);
-
- function Euclid (P, Q : Int) return Int;
-
- function Square_Mod_N (X, N : Int) return Int;
-
- ------------
- -- Euclid --
- ------------
-
- procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int) is
-
- XT : Int := 1;
- YT : Int := 0;
-
- procedure Recur
- (P, Q : Int; -- a (i-1), a (i)
- X, Y : Int; -- x (i), y (i)
- XP, YP : in out Int; -- x (i-1), y (i-1)
- GCD : out Int);
-
- procedure Recur
- (P, Q : Int;
- X, Y : Int;
- XP, YP : in out Int;
- GCD : out Int)
- is
- Quo : Int := P / Q; -- q <-- |_ a (i-1) / a (i) _|
- XT : Int := X; -- x (i)
- YT : Int := Y; -- y (i)
-
- begin
- if P rem Q = 0 then -- while does not divide
- GCD := Q;
- XP := X;
- YP := Y;
- else
- Recur (Q, P - Q * Quo, XP - Quo * X, YP - Quo * Y, XT, YT, Quo);
-
- -- a (i) <== a (i)
- -- a (i+1) <-- a (i-1) - q*a (i)
- -- x (i+1) <-- x (i-1) - q*x (i)
- -- y (i+1) <-- y (i-1) - q*y (i)
- -- x (i) <== x (i)
- -- y (i) <== y (i)
-
- XP := XT;
- YP := YT;
- GCD := Quo;
- end if;
- end Recur;
-
- -- Start of processing for Euclid
-
- begin
- Recur (P, Q, 0, 1, XT, YT, GCD);
- X := XT;
- Y := YT;
- end Euclid;
-
- function Euclid (P, Q : Int) return Int is
- X, Y, GCD : Int;
- pragma Unreferenced (Y, GCD);
- begin
- Euclid (P, Q, X, Y, GCD);
- return X;
- end Euclid;
+ package SRN renames System.Random_Numbers;
+ use SRN;
-----------
-- Image --
@@ -127,185 +40,63 @@ package body Ada.Numerics.Float_Random is
function Image (Of_State : State) return String is
begin
- return Int'Image (Of_State.X1) & ',' & Int'Image (Of_State.X2)
- & ',' &
- Int'Image (Of_State.P) & ',' & Int'Image (Of_State.Q);
+ return Image (SRN.State (Of_State));
end Image;
------------
-- Random --
------------
- function Random (Gen : Generator) return Uniformly_Distributed is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
-
+ function Random (Gen : Generator) return Uniformly_Distributed is
begin
- Genp.X1 := Square_Mod_N (Genp.X1, Genp.P);
- Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q);
- return
- Float ((Flt (((Genp.X2 - Genp.X1) * Genp.X)
- mod Genp.Q) * Flt (Genp.P)
- + Flt (Genp.X1)) * Genp.Scl);
+ return Random (SRN.Generator (Gen));
end Random;
-----------
-- Reset --
-----------
- -- Version that works from given initiator value
-
- procedure Reset (Gen : Generator; Initiator : Integer) is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
- X1, X2 : Int;
+ -- Version that works from calendar
+ procedure Reset (Gen : Generator) is
begin
- X1 := 2 + Int (Initiator) mod (K1 - 3);
- X2 := 2 + Int (Initiator) mod (K2 - 3);
-
- -- Eliminate effects of small initiators
-
- for J in 1 .. 5 loop
- X1 := Square_Mod_N (X1, K1);
- X2 := Square_Mod_N (X2, K2);
- end loop;
-
- Genp.all :=
- (X1 => X1,
- X2 => X2,
- P => K1,
- Q => K2,
- X => 1,
- Scl => Scal);
+ Reset (SRN.Generator (Gen));
end Reset;
- -- Version that works from specific saved state
-
- procedure Reset (Gen : Generator; From_State : State) is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
+ -- Version that works from given initiator value
+ procedure Reset (Gen : Generator; Initiator : Integer) is
begin
- Genp.all := From_State;
+ Reset (SRN.Generator (Gen), Initiator);
end Reset;
- -- Version that works from calendar
-
- procedure Reset (Gen : Generator) is
- Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
- Now : constant Calendar.Time := Calendar.Clock;
- X1, X2 : Int;
+ -- Version that works from specific saved state
+ procedure Reset (Gen : Generator; From_State : State) is
begin
- X1 := Int (Calendar.Year (Now)) * 12 * 31 +
- Int (Calendar.Month (Now)) * 31 +
- Int (Calendar.Day (Now));
-
- X2 := Int (Calendar.Seconds (Now) * Duration (1000.0));
-
- X1 := 2 + X1 mod (K1 - 3);
- X2 := 2 + X2 mod (K2 - 3);
-
- -- Eliminate visible effects of same day starts
-
- for J in 1 .. 5 loop
- X1 := Square_Mod_N (X1, K1);
- X2 := Square_Mod_N (X2, K2);
- end loop;
-
- Genp.all :=
- (X1 => X1,
- X2 => X2,
- P => K1,
- Q => K2,
- X => 1,
- Scl => Scal);
-
+ Reset (SRN.Generator (Gen), From_State);
end Reset;
----------
-- Save --
----------
- procedure Save (Gen : Generator; To_State : out State) is
+ procedure Save (Gen : Generator; To_State : out State) is
begin
- To_State := Gen.Gen_State;
+ Save (SRN.Generator (Gen), To_State);
end Save;
- ------------------
- -- Square_Mod_N --
- ------------------
-
- function Square_Mod_N (X, N : Int) return Int is
- Temp : constant Flt := Flt (X) * Flt (X);
- Div : Int;
-
- begin
- Div := Int (Temp / Flt (N));
- Div := Int (Temp - Flt (Div) * Flt (N));
-
- if Div < 0 then
- return Div + N;
- else
- return Div;
- end if;
- end Square_Mod_N;
-
-----------
-- Value --
-----------
function Value (Coded_State : String) return State is
- Last : constant Natural := Coded_State'Last;
- Start : Positive := Coded_State'First;
- Stop : Positive := Coded_State'First;
- Outs : State;
-
+ G : SRN.Generator;
+ S : SRN.State;
begin
- while Stop <= Last and then Coded_State (Stop) /= ',' loop
- Stop := Stop + 1;
- end loop;
-
- if Stop > Last then
- raise Constraint_Error;
- end if;
-
- Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1));
- Start := Stop + 1;
-
- loop
- Stop := Stop + 1;
- exit when Stop > Last or else Coded_State (Stop) = ',';
- end loop;
-
- if Stop > Last then
- raise Constraint_Error;
- end if;
-
- Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1));
- Start := Stop + 1;
-
- loop
- Stop := Stop + 1;
- exit when Stop > Last or else Coded_State (Stop) = ',';
- end loop;
-
- if Stop > Last then
- raise Constraint_Error;
- end if;
-
- Outs.P := Int'Value (Coded_State (Start .. Stop - 1));
- Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last));
- Outs.X := Euclid (Outs.P, Outs.Q);
- Outs.Scl := 1.0 / (Flt (Outs.P) * Flt (Outs.Q));
-
- -- Now do *some* sanity checks
-
- if Outs.Q < 31 or else Outs.P < 31
- or else Outs.X1 not in 2 .. Outs.P - 1
- or else Outs.X2 not in 2 .. Outs.Q - 1
- then
- raise Constraint_Error;
- end if;
-
- return Outs;
+ Reset (G, Coded_State);
+ Save (G, S);
+ return State (S);
end Value;
+
end Ada.Numerics.Float_Random;
diff --git a/gcc/ada/a-nuflra.ads b/gcc/ada/a-nuflra.ads
index e81842e23d8..5a448a7811e 100644
--- a/gcc/ada/a-nuflra.ads
+++ b/gcc/ada/a-nuflra.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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 --
@@ -33,17 +33,10 @@
-- --
------------------------------------------------------------------------------
--- Note: the implementation used in this package was contributed by
--- Robert Eachus. It is based on the work of L. Blum, M. Blum, and
--- M. Shub, SIAM Journal of Computing, Vol 15. No 2, May 1986. The
--- particular choices for P and Q chosen here guarantee a period of
--- 562,085,314,430,582 (about 2**49), and the generated sequence has
--- excellent randomness properties. For further details, see the
--- paper "Fast Generation of Trustworthy Random Numbers", by Robert
--- Eachus, which describes both the algorithm and the efficient
--- implementation approach used here.
+-- Note: the implementation used in this package is a version of the
+-- Mersenne Twister. See s-rannum.adb for details and references.
-with Interfaces;
+with System.Random_Numbers;
package Ada.Numerics.Float_Random is
@@ -65,35 +58,15 @@ package Ada.Numerics.Float_Random is
procedure Save (Gen : Generator; To_State : out State);
procedure Reset (Gen : Generator; From_State : State);
- Max_Image_Width : constant := 80;
+ Max_Image_Width : constant := System.Random_Numbers.Max_Image_Width;
function Image (Of_State : State) return String;
function Value (Coded_State : String) return State;
private
- type Int is new Interfaces.Integer_32;
-
- -- We prefer to use 14 digits for Flt, but some targets are more limited
-
- type Flt is digits Positive'Min (14, Long_Long_Float'Digits);
-
- K1 : constant := 94_833_359;
- K1F : constant := 94_833_359.0;
- K2 : constant := 47_416_679;
- K2F : constant := 47_416_679.0;
- Scal : constant := 1.0 / (K1F * K2F);
-
- type State is record
- X1 : Int := 2999 ** 2; -- Square mod p
- X2 : Int := 1439 ** 2; -- Square mod q
- P : Int := K1;
- Q : Int := K2;
- X : Int := 1;
- Scl : Flt := Scal;
- end record;
-
- type Generator is limited record
- Gen_State : State;
- end record;
+
+ type Generator is new System.Random_Numbers.Generator;
+
+ type State is new System.Random_Numbers.State;
end Ada.Numerics.Float_Random;
diff --git a/gcc/ada/a-reatim.adb b/gcc/ada/a-reatim.adb
index c3cbec69ddc..026c28941a0 100644
--- a/gcc/ada/a-reatim.adb
+++ b/gcc/ada/a-reatim.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2009, AdaCore --
+-- Copyright (C) 1995-2010, AdaCore --
-- --
-- GNARL 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,6 +32,8 @@
-- --
------------------------------------------------------------------------------
+with System.Tasking;
+
package body Ada.Real_Time is
---------
@@ -242,4 +244,10 @@ package body Ada.Real_Time is
return Time_Span (D);
end To_Time_Span;
+begin
+ -- Ensure that the tasking run time is initialized when using clock and/or
+ -- delay operations. The initialization routine has the required machinery
+ -- to prevent multiple calls to Initialize.
+
+ System.Tasking.Initialize;
end Ada.Real_Time;
diff --git a/gcc/ada/a-retide.adb b/gcc/ada/a-retide.adb
index f159ed6fc33..ecc61f6913a 100644
--- a/gcc/ada/a-retide.adb
+++ b/gcc/ada/a-retide.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -75,10 +75,4 @@ package body Ada.Real_Time.Delays is
return To_Duration (Time_Span (T));
end To_Duration;
-begin
- -- Ensure that the tasking run time is initialized when using delay
- -- operations. The initialization routine has the required machinery to
- -- prevent multiple calls to Initialize.
-
- System.Tasking.Initialize;
end Ada.Real_Time.Delays;
diff --git a/gcc/ada/a-strunb-shared.adb b/gcc/ada/a-strunb-shared.adb
new file mode 100644
index 00000000000..f4083b59e93
--- /dev/null
+++ b/gcc/ada/a-strunb-shared.adb
@@ -0,0 +1,2086 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . U N B O U N D E D --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Search;
+with Ada.Unchecked_Deallocation;
+
+package body Ada.Strings.Unbounded is
+
+ use Ada.Strings.Maps;
+
+ Growth_Factor : constant := 32;
+ -- The growth factor controls how much extra space is allocated when
+ -- we have to increase the size of an allocated unbounded string. By
+ -- allocating extra space, we avoid the need to reallocate on every
+ -- append, particularly important when a string is built up by repeated
+ -- append operations of small pieces. This is expressed as a factor so
+ -- 32 means add 1/32 of the length of the string as growth space.
+
+ Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
+ -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes
+ -- no memory loss as most (all?) malloc implementations are obliged to
+ -- align the returned memory on the maximum alignment as malloc does not
+ -- know the target alignment.
+
+ procedure Sync_Add_And_Fetch
+ (Ptr : access Interfaces.Unsigned_32;
+ Value : Interfaces.Unsigned_32);
+ pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4");
+
+ function Sync_Sub_And_Fetch
+ (Ptr : access Interfaces.Unsigned_32;
+ Value : Interfaces.Unsigned_32) return Interfaces.Unsigned_32;
+ pragma Import (Intrinsic, Sync_Sub_And_Fetch, "__sync_sub_and_fetch_4");
+
+ function Aligned_Max_Length (Max_Length : Natural) return Natural;
+ -- Returns recommended length of the shared string which is greater or
+ -- equal to specified length. Calculation take in sense alignment of the
+ -- allocated memory segments to use memory effectively by Append/Insert/etc
+ -- operations.
+
+ ---------
+ -- "&" --
+ ---------
+
+ function "&"
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Unbounded_String
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ RR : constant Shared_String_Access := Right.Reference;
+ DL : constant Natural := LR.Last + RR.Last;
+ DR : Shared_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Left string is empty, return Rigth string
+
+ elsif LR.Last = 0 then
+ Reference (RR);
+ DR := RR;
+
+ -- Right string is empty, return Left string
+
+ elsif RR.Last = 0 then
+ Reference (LR);
+ DR := LR;
+
+ -- Overwise, allocate new shared string and fill data
+
+ else
+ DR := Allocate (LR.Last + RR.Last);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (LR.Last + 1 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Unbounded_String;
+ Right : String) return Unbounded_String
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ DL : constant Natural := LR.Last + Right'Length;
+ DR : Shared_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Right is an empty string, return Left string
+
+ elsif Right'Length = 0 then
+ Reference (LR);
+ DR := LR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (LR.Last + 1 .. DL) := Right;
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : String;
+ Right : Unbounded_String) return Unbounded_String
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ DL : constant Natural := Left'Length + RR.Last;
+ DR : Shared_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared one
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Left is empty string, return Right string
+
+ elsif Left'Length = 0 then
+ Reference (RR);
+ DR := RR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Left'Length) := Left;
+ DR.Data (Left'Length + 1 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Unbounded_String;
+ Right : Character) return Unbounded_String
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ DL : constant Natural := LR.Last + 1;
+ DR : Shared_String_Access;
+
+ begin
+ DR := Allocate (DL);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (DL) := Right;
+ DR.Last := DL;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Character;
+ Right : Unbounded_String) return Unbounded_String
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ DL : constant Natural := 1 + RR.Last;
+ DR : Shared_String_Access;
+
+ begin
+ DR := Allocate (DL);
+ DR.Data (1) := Left;
+ DR.Data (2 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ ---------
+ -- "*" --
+ ---------
+
+ function "*"
+ (Left : Natural;
+ Right : Character) return Unbounded_String
+ is
+ DR : Shared_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string
+
+ if Left = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (Left);
+
+ for J in 1 .. Left loop
+ DR.Data (J) := Right;
+ end loop;
+
+ DR.Last := Left;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ function "*"
+ (Left : Natural;
+ Right : String) return Unbounded_String
+ is
+ DL : constant Natural := Left * Right'Length;
+ DR : Shared_String_Access;
+ K : Positive;
+
+ begin
+ -- Result is an empty string, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ K := 1;
+
+ for J in 1 .. Left loop
+ DR.Data (K .. K + Right'Length - 1) := Right;
+ K := K + Right'Length;
+ end loop;
+
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ function "*"
+ (Left : Natural;
+ Right : Unbounded_String) return Unbounded_String
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ DL : constant Natural := Left * RR.Last;
+ DR : Shared_String_Access;
+ K : Positive;
+
+ begin
+ -- Result is an empty string, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Coefficient is one, just return string itself
+
+ elsif Left = 1 then
+ Reference (RR);
+ DR := RR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ K := 1;
+
+ for J in 1 .. Left loop
+ DR.Data (K .. K + RR.Last - 1) := RR.Data (1 .. RR.Last);
+ K := K + RR.Last;
+ end loop;
+
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ ---------
+ -- "<" --
+ ---------
+
+ function "<"
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ RR : constant Shared_String_Access := Right.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) < RR.Data (1 .. RR.Last);
+ end "<";
+
+ function "<"
+ (Left : Unbounded_String;
+ Right : String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) < Right;
+ end "<";
+
+ function "<"
+ (Left : String;
+ Right : Unbounded_String) return Boolean
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ begin
+ return Left < RR.Data (1 .. RR.Last);
+ end "<";
+
+ ----------
+ -- "<=" --
+ ----------
+
+ function "<="
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ RR : constant Shared_String_Access := Right.Reference;
+
+ begin
+ -- LR = RR means two strings shares shared string, thus they are equal
+
+ return LR = RR or else LR.Data (1 .. LR.Last) <= RR.Data (1 .. RR.Last);
+ end "<=";
+
+ function "<="
+ (Left : Unbounded_String;
+ Right : String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) <= Right;
+ end "<=";
+
+ function "<="
+ (Left : String;
+ Right : Unbounded_String) return Boolean
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ begin
+ return Left <= RR.Data (1 .. RR.Last);
+ end "<=";
+
+ ---------
+ -- "=" --
+ ---------
+
+ function "="
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ RR : constant Shared_String_Access := Right.Reference;
+
+ begin
+ return LR = RR or else LR.Data (1 .. LR.Last) = RR.Data (1 .. RR.Last);
+ -- LR = RR means two strings shares shared string, thus they are equal
+ end "=";
+
+ function "="
+ (Left : Unbounded_String;
+ Right : String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) = Right;
+ end "=";
+
+ function "="
+ (Left : String;
+ Right : Unbounded_String) return Boolean
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ begin
+ return Left = RR.Data (1 .. RR.Last);
+ end "=";
+
+ ---------
+ -- ">" --
+ ---------
+
+ function ">"
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ RR : constant Shared_String_Access := Right.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) > RR.Data (1 .. RR.Last);
+ end ">";
+
+ function ">"
+ (Left : Unbounded_String;
+ Right : String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) > Right;
+ end ">";
+
+ function ">"
+ (Left : String;
+ Right : Unbounded_String) return Boolean
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ begin
+ return Left > RR.Data (1 .. RR.Last);
+ end ">";
+
+ ----------
+ -- ">=" --
+ ----------
+
+ function ">="
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ RR : constant Shared_String_Access := Right.Reference;
+
+ begin
+ -- LR = RR means two strings shares shared string, thus they are equal
+
+ return LR = RR or else LR.Data (1 .. LR.Last) >= RR.Data (1 .. RR.Last);
+ end ">=";
+
+ function ">="
+ (Left : Unbounded_String;
+ Right : String) return Boolean
+ is
+ LR : constant Shared_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) >= Right;
+ end ">=";
+
+ function ">="
+ (Left : String;
+ Right : Unbounded_String) return Boolean
+ is
+ RR : constant Shared_String_Access := Right.Reference;
+ begin
+ return Left >= RR.Data (1 .. RR.Last);
+ end ">=";
+
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Object : in out Unbounded_String) is
+ begin
+ Reference (Object.Reference);
+ end Adjust;
+
+ ------------------------
+ -- Aligned_Max_Length --
+ ------------------------
+
+ function Aligned_Max_Length (Max_Length : Natural) return Natural is
+ Static_Size : constant Natural :=
+ Empty_Shared_String'Size / Standard'Storage_Unit;
+ -- Total size of all static components
+
+ begin
+ return
+ ((Static_Size + Max_Length - 1) / Min_Mul_Alloc + 2) * Min_Mul_Alloc
+ - Static_Size;
+ end Aligned_Max_Length;
+
+ --------------
+ -- Allocate --
+ --------------
+
+ function Allocate (Max_Length : Natural) return Shared_String_Access is
+ begin
+ -- Empty string requested, return shared empty string
+
+ if Max_Length = 0 then
+ Reference (Empty_Shared_String'Access);
+ return Empty_Shared_String'Access;
+
+ -- Otherwise, allocate requested space (and probably some more room)
+
+ else
+ return new Shared_String (Aligned_Max_Length (Max_Length));
+ end if;
+ end Allocate;
+
+ ------------
+ -- Append --
+ ------------
+
+ procedure Append
+ (Source : in out Unbounded_String;
+ New_Item : Unbounded_String)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ NR : constant Shared_String_Access := New_Item.Reference;
+ DL : constant Natural := SR.Last + NR.Last;
+ DR : Shared_String_Access;
+
+ begin
+ -- Source is an empty string, reuse New_Item data
+
+ if SR.Last = 0 then
+ Reference (NR);
+ Source.Reference := NR;
+ Unreference (SR);
+
+ -- New_Item is empty string, nothing to do
+
+ elsif NR.Last = 0 then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ procedure Append
+ (Source : in out Unbounded_String;
+ New_Item : String)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_String_Access;
+
+ begin
+ -- New_Item is an empty string, nothing to do
+
+ if New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (SR.Last + 1 .. DL) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (SR.Last + 1 .. DL) := New_Item;
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ procedure Append
+ (Source : in out Unbounded_String;
+ New_Item : Character)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + 1;
+ DR : Shared_String_Access;
+
+ begin
+ -- Try to reuse existing shared string
+
+ if Can_Be_Reused (SR, SR.Last + 1) then
+ SR.Data (SR.Last + 1) := New_Item;
+ SR.Last := SR.Last + 1;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (DL) := New_Item;
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ -------------------
+ -- Can_Be_Reused --
+ -------------------
+
+ function Can_Be_Reused
+ (Item : Shared_String_Access;
+ Length : Natural) return Boolean
+ is
+ use Interfaces;
+ begin
+ return
+ Item.Counter = 1
+ and then Item.Max_Length >= Length
+ and then Item.Max_Length <=
+ Aligned_Max_Length (Length + Length / Growth_Factor);
+ end Can_Be_Reused;
+
+ -----------
+ -- Count --
+ -----------
+
+ function Count
+ (Source : Unbounded_String;
+ Pattern : String;
+ Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping);
+ end Count;
+
+ function Count
+ (Source : Unbounded_String;
+ Pattern : String;
+ Mapping : Maps.Character_Mapping_Function) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping);
+ end Count;
+
+ function Count
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Count (SR.Data (1 .. SR.Last), Set);
+ end Count;
+
+ ------------
+ -- Delete --
+ ------------
+
+ function Delete
+ (Source : Unbounded_String;
+ From : Positive;
+ Through : Natural) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Empty slice is deleted, use the same shared string
+
+ if From > Through then
+ Reference (SR);
+ DR := SR;
+
+ -- Index is out of range
+
+ elsif Through > SR.Last then
+ raise Index_Error;
+
+ -- Compute size of the result
+
+ else
+ DL := SR.Last - (Through - From + 1);
+
+ -- Result is an empty string, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1);
+ DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Delete;
+
+ procedure Delete
+ (Source : in out Unbounded_String;
+ From : Positive;
+ Through : Natural)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Nothing changed, return
+
+ if From > Through then
+ null;
+
+ -- Through is outside of the range
+
+ elsif Through > SR.Last then
+ raise Index_Error;
+
+ else
+ DL := SR.Last - (Through - From + 1);
+
+ -- Result is empty, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1);
+ DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Delete;
+
+ -------------
+ -- Element --
+ -------------
+
+ function Element
+ (Source : Unbounded_String;
+ Index : Positive) return Character
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ if Index <= SR.Last then
+ return SR.Data (Index);
+ else
+ raise Index_Error;
+ end if;
+ end Element;
+
+ --------------
+ -- Finalize --
+ --------------
+
+ procedure Finalize (Object : in out Unbounded_String) is
+ SR : constant Shared_String_Access := Object.Reference;
+
+ begin
+ if SR /= null then
+
+ -- The same controlled object can be finalized several times for
+ -- some reason. As per 7.6.1(24) this should have no ill effect,
+ -- so we need to add a guard for the case of finalizing the same
+ -- object twice.
+
+ Object.Reference := null;
+ Unreference (SR);
+ end if;
+ end Finalize;
+
+ ----------------
+ -- Find_Token --
+ ----------------
+
+ procedure Find_Token
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set;
+ Test : Strings.Membership;
+ First : out Positive;
+ Last : out Natural)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ Search.Find_Token (SR.Data (1 .. SR.Last), Set, Test, First, Last);
+ end Find_Token;
+
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (X : in out String_Access) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (String, String_Access);
+ begin
+ Deallocate (X);
+ end Free;
+
+ ----------
+ -- Head --
+ ----------
+
+ function Head
+ (Source : Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- Result is empty, reuse shared empty string
+
+ if Count = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Length of the string is the same as requested, reuse source shared
+ -- string.
+
+ elsif Count = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ -- Length of the source string is more than requested, copy
+ -- corresponding slice.
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (1 .. Count);
+
+ -- Length of the source string is less then requested, copy all
+ -- contents and fill others by Pad character.
+
+ else
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+
+ for J in SR.Last + 1 .. Count loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Head;
+
+ procedure Head
+ (Source : in out Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- Result is empty, reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ -- Result is same as source string, reuse source shared string
+
+ elsif Count = SR.Last then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, Count) then
+ if Count > SR.Last then
+ for J in SR.Last + 1 .. Count loop
+ SR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ SR.Last := Count;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ -- Length of the source string is greater then requested, copy
+ -- corresponding slice.
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (1 .. Count);
+
+ -- Length of the source string is less the requested, copy all
+ -- existing data and fill remaining positions with Pad characters.
+
+ else
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+
+ for J in SR.Last + 1 .. Count loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Head;
+
+ -----------
+ -- Index --
+ -----------
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ Going : Strings.Direction := Strings.Forward;
+ Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index (SR.Data (1 .. SR.Last), Pattern, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ Going : Direction := Forward;
+ Mapping : Maps.Character_Mapping_Function) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index (SR.Data (1 .. SR.Last), Pattern, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set;
+ Test : Strings.Membership := Strings.Inside;
+ Going : Strings.Direction := Strings.Forward) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index (SR.Data (1 .. SR.Last), Set, Test, Going);
+ end Index;
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Maps.Character_Mapping_Function) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set;
+ From : Positive;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index (SR.Data (1 .. SR.Last), Set, From, Test, Going);
+ end Index;
+
+ ---------------------
+ -- Index_Non_Blank --
+ ---------------------
+
+ function Index_Non_Blank
+ (Source : Unbounded_String;
+ Going : Strings.Direction := Strings.Forward) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index_Non_Blank (SR.Data (1 .. SR.Last), Going);
+ end Index_Non_Blank;
+
+ function Index_Non_Blank
+ (Source : Unbounded_String;
+ From : Positive;
+ Going : Direction := Forward) return Natural
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ begin
+ return Search.Index_Non_Blank (SR.Data (1 .. SR.Last), From, Going);
+ end Index_Non_Blank;
+
+ ----------------
+ -- Initialize --
+ ----------------
+
+ procedure Initialize (Object : in out Unbounded_String) is
+ begin
+ Reference (Object.Reference);
+ end Initialize;
+
+ ------------
+ -- Insert --
+ ------------
+
+ function Insert
+ (Source : Unbounded_String;
+ Before : Positive;
+ New_Item : String) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_String_Access;
+
+ begin
+ -- Check index first
+
+ if Before > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Result is empty, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Inserted string is empty, reuse source shared string
+
+ elsif New_Item'Length = 0 then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL + DL /Growth_Factor);
+ DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1);
+ DR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ DR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Insert;
+
+ procedure Insert
+ (Source : in out Unbounded_String;
+ Before : Positive;
+ New_Item : String)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Before > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ -- Inserted string is empty, nothing to do
+
+ elsif New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existing shared string first
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ SR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1);
+ DR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ DR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Insert;
+
+ ------------
+ -- Length --
+ ------------
+
+ function Length (Source : Unbounded_String) return Natural is
+ begin
+ return Source.Reference.Last;
+ end Length;
+
+ ---------------
+ -- Overwrite --
+ ---------------
+
+ function Overwrite
+ (Source : Unbounded_String;
+ Position : Positive;
+ New_Item : String) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Position > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ DL := Integer'Max (SR.Last, Position + New_Item'Length - 1);
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Result is same as source string, reuse source shared string
+
+ elsif New_Item'Length = 0 then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1);
+ DR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ DR.Data (Position + New_Item'Length .. DL) :=
+ SR.Data (Position + New_Item'Length .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Overwrite;
+
+ procedure Overwrite
+ (Source : in out Unbounded_String;
+ Position : Positive;
+ New_Item : String)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Bounds check
+
+ if Position > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ DL := Integer'Max (SR.Last, Position + New_Item'Length - 1);
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ -- String unchanged, nothing to do
+
+ elsif New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1);
+ DR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ DR.Data (Position + New_Item'Length .. DL) :=
+ SR.Data (Position + New_Item'Length .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Overwrite;
+
+ ---------------
+ -- Reference --
+ ---------------
+
+ procedure Reference (Item : not null Shared_String_Access) is
+ begin
+ Sync_Add_And_Fetch (Item.Counter'Access, 1);
+ end Reference;
+
+ ---------------------
+ -- Replace_Element --
+ ---------------------
+
+ procedure Replace_Element
+ (Source : in out Unbounded_String;
+ Index : Positive;
+ By : Character)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- Bounds check.
+
+ if Index <= SR.Last then
+
+ -- Try to reuse existing shared string
+
+ if Can_Be_Reused (SR, SR.Last) then
+ SR.Data (Index) := By;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (Index) := By;
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ else
+ raise Index_Error;
+ end if;
+ end Replace_Element;
+
+ -------------------
+ -- Replace_Slice --
+ -------------------
+
+ function Replace_Slice
+ (Source : Unbounded_String;
+ Low : Positive;
+ High : Natural;
+ By : String) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Do replace operation when removed slice is not empty
+
+ if High >= Low then
+ DL := By'Length + SR.Last + Low - High - 1;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1);
+ DR.Data (Low .. Low + By'Length - 1) := By;
+ DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+
+ -- Otherwise just insert string
+
+ else
+ return Insert (Source, Low, By);
+ end if;
+ end Replace_Slice;
+
+ procedure Replace_Slice
+ (Source : in out Unbounded_String;
+ Low : Positive;
+ High : Natural;
+ By : String)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Bounds check
+
+ if Low > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Do replace operation only when replaced slice is not empty
+
+ if High >= Low then
+ DL := By'Length + SR.Last + Low - High - 1;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ SR.Data (Low .. Low + By'Length - 1) := By;
+ SR.Last := DL;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1);
+ DR.Data (Low .. Low + By'Length - 1) := By;
+ DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ -- Otherwise just insert item
+
+ else
+ Insert (Source, Low, By);
+ end if;
+ end Replace_Slice;
+
+ --------------------------
+ -- Set_Unbounded_String --
+ --------------------------
+
+ procedure Set_Unbounded_String
+ (Target : out Unbounded_String;
+ Source : String)
+ is
+ TR : constant Shared_String_Access := Target.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- In case of empty string, reuse empty shared string
+
+ if Source'Length = 0 then
+ Reference (Empty_Shared_String'Access);
+ Target.Reference := Empty_Shared_String'Access;
+
+ else
+ -- Try to reuse existing shared string
+
+ if Can_Be_Reused (TR, Source'Length) then
+ Reference (TR);
+ DR := TR;
+
+ -- Otherwise allocate new shared string
+
+ else
+ DR := Allocate (Source'Length);
+ Target.Reference := DR;
+ end if;
+
+ DR.Data (1 .. Source'Length) := Source;
+ DR.Last := Source'Length;
+ end if;
+
+ Unreference (TR);
+ end Set_Unbounded_String;
+
+ -----------
+ -- Slice --
+ -----------
+
+ function Slice
+ (Source : Unbounded_String;
+ Low : Positive;
+ High : Natural) return String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+
+ begin
+ -- Note: test of High > Length is in accordance with AI95-00128
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ else
+ return SR.Data (Low .. High);
+ end if;
+ end Slice;
+
+ ----------
+ -- Tail --
+ ----------
+
+ function Tail
+ (Source : Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- For empty result reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Result is whole source string, reuse source shared string
+
+ elsif Count = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last);
+
+ else
+ for J in 1 .. Count - SR.Last loop
+ DR.Data (J) := Pad;
+ end loop;
+
+ DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last);
+ end if;
+
+ DR.Last := Count;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Tail;
+
+ procedure Tail
+ (Source : in out Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ procedure Common
+ (SR : Shared_String_Access;
+ DR : Shared_String_Access;
+ Count : Natural);
+ -- Common code of tail computation. SR/DR can point to the same object
+
+ ------------
+ -- Common --
+ ------------
+
+ procedure Common
+ (SR : Shared_String_Access;
+ DR : Shared_String_Access;
+ Count : Natural) is
+ begin
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last);
+
+ else
+ DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last);
+
+ for J in 1 .. Count - SR.Last loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ end Common;
+
+ begin
+ -- Result is empty string, reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ -- Length of the result is the same as length of the source string,
+ -- reuse source shared string.
+
+ elsif Count = SR.Last then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, Count) then
+ Common (SR, SR, Count);
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+ Common (SR, DR, Count);
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Tail;
+
+ ---------------
+ -- To_String --
+ ---------------
+
+ function To_String (Source : Unbounded_String) return String is
+ begin
+ return Source.Reference.Data (1 .. Source.Reference.Last);
+ end To_String;
+
+ -------------------------
+ -- To_Unbounded_String --
+ -------------------------
+
+ function To_Unbounded_String (Source : String) return Unbounded_String is
+ DR : constant Shared_String_Access := Allocate (Source'Length);
+ begin
+ DR.Data (1 .. Source'Length) := Source;
+ DR.Last := Source'Length;
+ return (AF.Controlled with Reference => DR);
+ end To_Unbounded_String;
+
+ function To_Unbounded_String (Length : Natural) return Unbounded_String is
+ DR : constant Shared_String_Access := Allocate (Length);
+ begin
+ DR.Last := Length;
+ return (AF.Controlled with Reference => DR);
+ end To_Unbounded_String;
+
+ ---------------
+ -- Translate --
+ ---------------
+
+ function Translate
+ (Source : Unbounded_String;
+ Mapping : Maps.Character_Mapping) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- Nothing to translate, reuse empty shared string
+
+ if SR.Last = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Translate;
+
+ procedure Translate
+ (Source : in out Unbounded_String;
+ Mapping : Maps.Character_Mapping)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- Nothing to translate
+
+ if SR.Last = 0 then
+ null;
+
+ -- Try to reuse shared string
+
+ elsif Can_Be_Reused (SR, SR.Last) then
+ for J in 1 .. SR.Last loop
+ SR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Translate;
+
+ function Translate
+ (Source : Unbounded_String;
+ Mapping : Maps.Character_Mapping_Function) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- Nothing to translate, reuse empty shared string
+
+ if SR.Last = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+
+ exception
+ when others =>
+ Unreference (DR);
+
+ raise;
+ end Translate;
+
+ procedure Translate
+ (Source : in out Unbounded_String;
+ Mapping : Maps.Character_Mapping_Function)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DR : Shared_String_Access;
+
+ begin
+ -- Nothing to translate
+
+ if SR.Last = 0 then
+ null;
+
+ -- Try to reuse shared string
+
+ elsif Can_Be_Reused (SR, SR.Last) then
+ for J in 1 .. SR.Last loop
+ SR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ exception
+ when others =>
+ if DR /= null then
+ Unreference (DR);
+ end if;
+
+ raise;
+ end Translate;
+
+ ----------
+ -- Trim --
+ ----------
+
+ function Trim
+ (Source : Unbounded_String;
+ Side : Trim_End) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index_Non_Blank (Source, Forward);
+
+ -- All blanks, reuse empty shared string
+
+ if Low = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ else
+ case Side is
+ when Left =>
+ High := SR.Last;
+ DL := SR.Last - Low + 1;
+
+ when Right =>
+ Low := 1;
+ High := Index_Non_Blank (Source, Backward);
+ DL := High;
+
+ when Both =>
+ High := Index_Non_Blank (Source, Backward);
+ DL := High - Low + 1;
+ end case;
+
+ -- Length of the result is the same as length of the source string,
+ -- reuse source shared string.
+
+ if DL = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Trim;
+
+ procedure Trim
+ (Source : in out Unbounded_String;
+ Side : Trim_End)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index_Non_Blank (Source, Forward);
+
+ -- All blanks, reuse empty shared string
+
+ if Low = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ else
+ case Side is
+ when Left =>
+ High := SR.Last;
+ DL := SR.Last - Low + 1;
+
+ when Right =>
+ Low := 1;
+ High := Index_Non_Blank (Source, Backward);
+ DL := High;
+
+ when Both =>
+ High := Index_Non_Blank (Source, Backward);
+ DL := High - Low + 1;
+ end case;
+
+ -- Length of the result is the same as length of the source string,
+ -- nothing to do.
+
+ if DL = SR.Last then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (1 .. DL) := SR.Data (Low .. High);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Trim;
+
+ function Trim
+ (Source : Unbounded_String;
+ Left : Maps.Character_Set;
+ Right : Maps.Character_Set) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index (Source, Left, Outside, Forward);
+
+ -- Source includes only characters from Left set, reuse empty shared
+ -- string.
+
+ if Low = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ else
+ High := Index (Source, Right, Outside, Backward);
+ DL := Integer'Max (0, High - Low + 1);
+
+ -- Source includes only characters from Right set or result string
+ -- is empty, reuse empty shared string.
+
+ if High = 0 or else DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Trim;
+
+ procedure Trim
+ (Source : in out Unbounded_String;
+ Left : Maps.Character_Set;
+ Right : Maps.Character_Set)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index (Source, Left, Outside, Forward);
+
+ -- Source includes only characters from Left set, reuse empty shared
+ -- string.
+
+ if Low = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ else
+ High := Index (Source, Right, Outside, Backward);
+ DL := Integer'Max (0, High - Low + 1);
+
+ -- Source includes only characters from Right set or result string
+ -- is empty, reuse empty shared string.
+
+ if High = 0 or else DL = 0 then
+ Reference (Empty_Shared_String'Access);
+ Source.Reference := Empty_Shared_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (1 .. DL) := SR.Data (Low .. High);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Trim;
+
+ ---------------------
+ -- Unbounded_Slice --
+ ---------------------
+
+ function Unbounded_Slice
+ (Source : Unbounded_String;
+ Low : Positive;
+ High : Natural) return Unbounded_String
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ -- Result is empty slice, reuse empty shared string
+
+ elsif Low > High then
+ Reference (Empty_Shared_String'Access);
+ DR := Empty_Shared_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DL := High - Low + 1;
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Unbounded_Slice;
+
+ procedure Unbounded_Slice
+ (Source : Unbounded_String;
+ Target : out Unbounded_String;
+ Low : Positive;
+ High : Natural)
+ is
+ SR : constant Shared_String_Access := Source.Reference;
+ TR : constant Shared_String_Access := Target.Reference;
+ DL : Natural;
+ DR : Shared_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ -- Result is empty slice, reuse empty shared string
+
+ elsif Low > High then
+ Reference (Empty_Shared_String'Access);
+ Target.Reference := Empty_Shared_String'Access;
+ Unreference (TR);
+
+ else
+ DL := High - Low + 1;
+
+ -- Try to reuse existing shared string
+
+ if Can_Be_Reused (TR, DL) then
+ TR.Data (1 .. DL) := SR.Data (Low .. High);
+ TR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Target.Reference := DR;
+ Unreference (TR);
+ end if;
+ end if;
+ end Unbounded_Slice;
+
+ -----------------
+ -- Unreference --
+ -----------------
+
+ procedure Unreference (Item : not null Shared_String_Access) is
+ use Interfaces;
+
+ procedure Free is
+ new Ada.Unchecked_Deallocation (Shared_String, Shared_String_Access);
+
+ Aux : Shared_String_Access := Item;
+
+ begin
+ if Sync_Sub_And_Fetch (Aux.Counter'Access, 1) = 0 then
+
+ -- Reference counter of Empty_Shared_String must never reach zero
+
+ pragma Assert (Aux /= Empty_Shared_String'Access);
+
+ Free (Aux);
+ end if;
+ end Unreference;
+
+end Ada.Strings.Unbounded;
diff --git a/gcc/ada/a-strunb-shared.ads b/gcc/ada/a-strunb-shared.ads
new file mode 100644
index 00000000000..b4b7c622759
--- /dev/null
+++ b/gcc/ada/a-strunb-shared.ads
@@ -0,0 +1,481 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . U N B O U N D E D --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2010, 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides an implementation of Ada.Strings.Unbounded that uses
+-- reference counts to implement copy on modification (rather than copy on
+-- assignment). This is significantly more efficient on many targets.
+
+-- This version is supported on:
+-- - all Alpha platforms
+-- - all ia64 platforms
+-- - all PowerPC platforms
+-- - all SPARC V9 platforms
+-- - all x86_64 platforms
+
+ -- This package uses several techniques to increase speed:
+
+ -- - Implicit sharing or copy-on-write. An Unbounded_String contains only
+ -- the reference to the data which is shared between several instances.
+ -- The shared data is reallocated only when its value is changed and
+ -- the object mutation can't be used or it is unefficient to use it.
+
+ -- - Object mutation. Shared data object can be reused without memory
+ -- reallocation when all of the following requirements are met:
+ -- - shared data object is no longer used by anyone else.
+ -- - the size is sufficient to store new value.
+ -- - the gap after reuse is less then a defined threashold.
+
+ -- - Memory preallocation. Most of used memory allocation algorithms
+ -- allign allocated segments on the some boundary, thus some amount of
+ -- additional memory can be preallocated without any impact. Such
+ -- preallocated memory can used later by Append/Insert operations
+ -- without reallocation.
+
+ -- Reference counting uses GCC builtin atomic operations, which allows to
+ -- safely share internal data between Ada tasks. Nevertheless, this not
+ -- make objects of Unbounded_String thread-safe, so each instance can't be
+ -- accessed by several tasks simulatenously.
+
+with Ada.Strings.Maps;
+private with Ada.Finalization;
+private with Interfaces;
+
+package Ada.Strings.Unbounded is
+ pragma Preelaborate;
+
+ type Unbounded_String is private;
+ pragma Preelaborable_Initialization (Unbounded_String);
+
+ Null_Unbounded_String : constant Unbounded_String;
+
+ function Length (Source : Unbounded_String) return Natural;
+
+ type String_Access is access all String;
+
+ procedure Free (X : in out String_Access);
+
+ --------------------------------------------------------
+ -- Conversion, Concatenation, and Selection Functions --
+ --------------------------------------------------------
+
+ function To_Unbounded_String
+ (Source : String) return Unbounded_String;
+
+ function To_Unbounded_String
+ (Length : Natural) return Unbounded_String;
+
+ function To_String (Source : Unbounded_String) return String;
+
+ procedure Set_Unbounded_String
+ (Target : out Unbounded_String;
+ Source : String);
+ pragma Ada_05 (Set_Unbounded_String);
+
+ procedure Append
+ (Source : in out Unbounded_String;
+ New_Item : Unbounded_String);
+
+ procedure Append
+ (Source : in out Unbounded_String;
+ New_Item : String);
+
+ procedure Append
+ (Source : in out Unbounded_String;
+ New_Item : Character);
+
+ function "&"
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Unbounded_String;
+
+ function "&"
+ (Left : Unbounded_String;
+ Right : String) return Unbounded_String;
+
+ function "&"
+ (Left : String;
+ Right : Unbounded_String) return Unbounded_String;
+
+ function "&"
+ (Left : Unbounded_String;
+ Right : Character) return Unbounded_String;
+
+ function "&"
+ (Left : Character;
+ Right : Unbounded_String) return Unbounded_String;
+
+ function Element
+ (Source : Unbounded_String;
+ Index : Positive) return Character;
+
+ procedure Replace_Element
+ (Source : in out Unbounded_String;
+ Index : Positive;
+ By : Character);
+
+ function Slice
+ (Source : Unbounded_String;
+ Low : Positive;
+ High : Natural) return String;
+
+ function Unbounded_Slice
+ (Source : Unbounded_String;
+ Low : Positive;
+ High : Natural) return Unbounded_String;
+ pragma Ada_05 (Unbounded_Slice);
+
+ procedure Unbounded_Slice
+ (Source : Unbounded_String;
+ Target : out Unbounded_String;
+ Low : Positive;
+ High : Natural);
+ pragma Ada_05 (Unbounded_Slice);
+
+ function "="
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean;
+
+ function "="
+ (Left : Unbounded_String;
+ Right : String) return Boolean;
+
+ function "="
+ (Left : String;
+ Right : Unbounded_String) return Boolean;
+
+ function "<"
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean;
+
+ function "<"
+ (Left : Unbounded_String;
+ Right : String) return Boolean;
+
+ function "<"
+ (Left : String;
+ Right : Unbounded_String) return Boolean;
+
+ function "<="
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean;
+
+ function "<="
+ (Left : Unbounded_String;
+ Right : String) return Boolean;
+
+ function "<="
+ (Left : String;
+ Right : Unbounded_String) return Boolean;
+
+ function ">"
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean;
+
+ function ">"
+ (Left : Unbounded_String;
+ Right : String) return Boolean;
+
+ function ">"
+ (Left : String;
+ Right : Unbounded_String) return Boolean;
+
+ function ">="
+ (Left : Unbounded_String;
+ Right : Unbounded_String) return Boolean;
+
+ function ">="
+ (Left : Unbounded_String;
+ Right : String) return Boolean;
+
+ function ">="
+ (Left : String;
+ Right : Unbounded_String) return Boolean;
+
+ ------------------------
+ -- Search Subprograms --
+ ------------------------
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ Going : Direction := Forward;
+ Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ Going : Direction := Forward;
+ Mapping : Maps.Character_Mapping_Function) return Natural;
+
+ function Index
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural;
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
+ pragma Ada_05 (Index);
+
+ function Index
+ (Source : Unbounded_String;
+ Pattern : String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Maps.Character_Mapping_Function) return Natural;
+ pragma Ada_05 (Index);
+
+ function Index
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set;
+ From : Positive;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural;
+ pragma Ada_05 (Index);
+
+ function Index_Non_Blank
+ (Source : Unbounded_String;
+ Going : Direction := Forward) return Natural;
+
+ function Index_Non_Blank
+ (Source : Unbounded_String;
+ From : Positive;
+ Going : Direction := Forward) return Natural;
+ pragma Ada_05 (Index_Non_Blank);
+
+ function Count
+ (Source : Unbounded_String;
+ Pattern : String;
+ Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
+
+ function Count
+ (Source : Unbounded_String;
+ Pattern : String;
+ Mapping : Maps.Character_Mapping_Function) return Natural;
+
+ function Count
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set) return Natural;
+
+ procedure Find_Token
+ (Source : Unbounded_String;
+ Set : Maps.Character_Set;
+ Test : Membership;
+ First : out Positive;
+ Last : out Natural);
+
+ ------------------------------------
+ -- String Translation Subprograms --
+ ------------------------------------
+
+ function Translate
+ (Source : Unbounded_String;
+ Mapping : Maps.Character_Mapping) return Unbounded_String;
+
+ procedure Translate
+ (Source : in out Unbounded_String;
+ Mapping : Maps.Character_Mapping);
+
+ function Translate
+ (Source : Unbounded_String;
+ Mapping : Maps.Character_Mapping_Function) return Unbounded_String;
+
+ procedure Translate
+ (Source : in out Unbounded_String;
+ Mapping : Maps.Character_Mapping_Function);
+
+ ---------------------------------------
+ -- String Transformation Subprograms --
+ ---------------------------------------
+
+ function Replace_Slice
+ (Source : Unbounded_String;
+ Low : Positive;
+ High : Natural;
+ By : String) return Unbounded_String;
+
+ procedure Replace_Slice
+ (Source : in out Unbounded_String;
+ Low : Positive;
+ High : Natural;
+ By : String);
+
+ function Insert
+ (Source : Unbounded_String;
+ Before : Positive;
+ New_Item : String) return Unbounded_String;
+
+ procedure Insert
+ (Source : in out Unbounded_String;
+ Before : Positive;
+ New_Item : String);
+
+ function Overwrite
+ (Source : Unbounded_String;
+ Position : Positive;
+ New_Item : String) return Unbounded_String;
+
+ procedure Overwrite
+ (Source : in out Unbounded_String;
+ Position : Positive;
+ New_Item : String);
+
+ function Delete
+ (Source : Unbounded_String;
+ From : Positive;
+ Through : Natural) return Unbounded_String;
+
+ procedure Delete
+ (Source : in out Unbounded_String;
+ From : Positive;
+ Through : Natural);
+
+ function Trim
+ (Source : Unbounded_String;
+ Side : Trim_End) return Unbounded_String;
+
+ procedure Trim
+ (Source : in out Unbounded_String;
+ Side : Trim_End);
+
+ function Trim
+ (Source : Unbounded_String;
+ Left : Maps.Character_Set;
+ Right : Maps.Character_Set) return Unbounded_String;
+
+ procedure Trim
+ (Source : in out Unbounded_String;
+ Left : Maps.Character_Set;
+ Right : Maps.Character_Set);
+
+ function Head
+ (Source : Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space) return Unbounded_String;
+
+ procedure Head
+ (Source : in out Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space);
+
+ function Tail
+ (Source : Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space) return Unbounded_String;
+
+ procedure Tail
+ (Source : in out Unbounded_String;
+ Count : Natural;
+ Pad : Character := Space);
+
+ function "*"
+ (Left : Natural;
+ Right : Character) return Unbounded_String;
+
+ function "*"
+ (Left : Natural;
+ Right : String) return Unbounded_String;
+
+ function "*"
+ (Left : Natural;
+ Right : Unbounded_String) return Unbounded_String;
+
+private
+ pragma Inline (Length);
+
+ package AF renames Ada.Finalization;
+
+ type Shared_String (Max_Length : Natural) is limited record
+ Counter : aliased Interfaces.Unsigned_32 := 1;
+ -- Reference counter
+
+ Last : Natural := 0;
+ Data : String (1 .. Max_Length);
+ -- Last is the index of last significant element of the Data. All
+ -- elements with larger indexes are currently insignificant.
+ end record;
+
+ type Shared_String_Access is access all Shared_String;
+
+ procedure Reference (Item : not null Shared_String_Access);
+ -- Increment reference counter
+
+ procedure Unreference (Item : not null Shared_String_Access);
+ -- Decrement reference counter, deallocate Item when counter goes to zero
+
+ function Can_Be_Reused
+ (Item : Shared_String_Access;
+ Length : Natural) return Boolean;
+ -- Returns True if Shared_String can be reused. There are two criteria when
+ -- Shared_String can be reused: its reference counter must be one (thus
+ -- Shared_String is owned exclusively) and its size is sufficient to
+ -- store string with specified length effectively.
+
+ function Allocate (Max_Length : Natural) return Shared_String_Access;
+ -- Allocates new Shared_String with at least specified maximum length.
+ -- Actual maximum length of the allocated Shared_String can be sligtly
+ -- greater. Returns reference to Empty_Shared_String when requested length
+ -- is zero.
+
+ Empty_Shared_String : aliased Shared_String (0);
+
+ function To_Unbounded (S : String) return Unbounded_String
+ renames To_Unbounded_String;
+ -- This renames are here only to be used in the pragma Stream_Convert
+
+ type Unbounded_String is new AF.Controlled with record
+ Reference : Shared_String_Access := Empty_Shared_String'Access;
+ end record;
+
+ pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String);
+ -- Provide stream routines without dragging in Ada.Streams
+
+ pragma Finalize_Storage_Only (Unbounded_String);
+ -- Finalization is required only for freeing storage
+
+ overriding procedure Initialize (Object : in out Unbounded_String);
+ overriding procedure Adjust (Object : in out Unbounded_String);
+ overriding procedure Finalize (Object : in out Unbounded_String);
+
+ Null_Unbounded_String : constant Unbounded_String :=
+ (AF.Controlled with
+ Reference => Empty_Shared_String'Access);
+
+end Ada.Strings.Unbounded;
diff --git a/gcc/ada/a-strunb.adb b/gcc/ada/a-strunb.adb
index 7634e65f6d2..cc5b92bfc43 100644
--- a/gcc/ada/a-strunb.adb
+++ b/gcc/ada/a-strunb.adb
@@ -914,9 +914,14 @@ package body Ada.Strings.Unbounded is
function To_Unbounded_String (Source : String) return Unbounded_String is
Result : Unbounded_String;
begin
- Result.Last := Source'Length;
- Result.Reference := new String (1 .. Source'Length);
- Result.Reference.all := Source;
+ -- Do not allocate an empty string: keep the default
+
+ if Source'Length > 0 then
+ Result.Last := Source'Length;
+ Result.Reference := new String (1 .. Source'Length);
+ Result.Reference.all := Source;
+ end if;
+
return Result;
end To_Unbounded_String;
@@ -924,9 +929,15 @@ package body Ada.Strings.Unbounded is
(Length : Natural) return Unbounded_String
is
Result : Unbounded_String;
+
begin
- Result.Last := Length;
- Result.Reference := new String (1 .. Length);
+ -- Do not allocate an empty string: keep the default
+
+ if Length > 0 then
+ Result.Last := Length;
+ Result.Reference := new String (1 .. Length);
+ end if;
+
return Result;
end To_Unbounded_String;
diff --git a/gcc/ada/a-stunau-shared.adb b/gcc/ada/a-stunau-shared.adb
new file mode 100644
index 00000000000..6ca416243b7
--- /dev/null
+++ b/gcc/ada/a-stunau-shared.adb
@@ -0,0 +1,62 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . U N B O U N D E D . A U X --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body Ada.Strings.Unbounded.Aux is
+
+ ----------------
+ -- Get_String --
+ ----------------
+
+ procedure Get_String
+ (U : Unbounded_String;
+ S : out Big_String_Access;
+ L : out Natural)
+ is
+ X : aliased Big_String;
+ for X'Address use U.Reference.Data'Address;
+ begin
+ S := X'Unchecked_Access;
+ L := U.Reference.Last;
+ end Get_String;
+
+ ----------------
+ -- Set_String --
+ ----------------
+
+ procedure Set_String (UP : in out Unbounded_String; S : String_Access) is
+ X : String_Access := S;
+
+ begin
+ Set_Unbounded_String (UP, S.all);
+ Free (X);
+ end Set_String;
+
+end Ada.Strings.Unbounded.Aux;
diff --git a/gcc/ada/a-stunau.adb b/gcc/ada/a-stunau.adb
index e77f71c12b1..c6d2bc43ac3 100644
--- a/gcc/ada/a-stunau.adb
+++ b/gcc/ada/a-stunau.adb
@@ -37,11 +37,14 @@ package body Ada.Strings.Unbounded.Aux is
procedure Get_String
(U : Unbounded_String;
- S : out String_Access;
+ S : out Big_String_Access;
L : out Natural)
is
+ X : aliased Big_String;
+ for X'Address use U.Reference.all'Address;
+
begin
- S := U.Reference;
+ S := X'Unchecked_Access;
L := U.Last;
end Get_String;
@@ -49,17 +52,6 @@ package body Ada.Strings.Unbounded.Aux is
-- Set_String --
----------------
- procedure Set_String (UP : in out Unbounded_String; S : String) is
- begin
- if S'Length > UP.Last then
- Finalize (UP);
- UP.Reference := new String (1 .. S'Length);
- end if;
-
- UP.Reference (1 .. S'Length) := S;
- UP.Last := S'Length;
- end Set_String;
-
procedure Set_String (UP : in out Unbounded_String; S : String_Access) is
begin
Finalize (UP);
diff --git a/gcc/ada/a-stunau.ads b/gcc/ada/a-stunau.ads
index c2d0ec855c0..8cff44f7151 100644
--- a/gcc/ada/a-stunau.ads
+++ b/gcc/ada/a-stunau.ads
@@ -37,9 +37,12 @@
package Ada.Strings.Unbounded.Aux is
pragma Preelaborate;
+ subtype Big_String is String (1 .. Positive'Last);
+ type Big_String_Access is access all Big_String;
+
procedure Get_String
(U : Unbounded_String;
- S : out String_Access;
+ S : out Big_String_Access;
L : out Natural);
pragma Inline (Get_String);
-- This procedure returns the internal string pointer used in the
@@ -54,18 +57,16 @@ package Ada.Strings.Unbounded.Aux is
-- referenced string returned by this call is always one, so the actual
-- string data is always accessible as S (1 .. L).
- procedure Set_String (UP : in out Unbounded_String; S : String);
- pragma Inline (Set_String);
- -- This function sets the string contents of the referenced unbounded
- -- string to the given string value. It is significantly more efficient
- -- than the use of To_Unbounded_String with an assignment, since it
- -- avoids the necessity of messing with finalization chains. The lower
- -- bound of the string S is not required to be one.
+ procedure Set_String (UP : out Unbounded_String; S : String)
+ renames Set_Unbounded_String;
+ -- This function is simply a renaming of the new Ada 2005 function as shown
+ -- above. It is provided for historical reasons, but should be removed at
+ -- this stage???
procedure Set_String (UP : in out Unbounded_String; S : String_Access);
pragma Inline (Set_String);
- -- This version of Set_String takes a string access value, rather than a
- -- string. The lower bound of the string value is required to be one, and
- -- this requirement is not checked.
+ -- This version of Set_Unbounded_String takes a string access value, rather
+ -- than a string. The lower bound of the string value is required to be
+ -- one, and this requirement is not checked.
end Ada.Strings.Unbounded.Aux;
diff --git a/gcc/ada/a-stuten.adb b/gcc/ada/a-stuten.adb
new file mode 100644
index 00000000000..fc669b56ee4
--- /dev/null
+++ b/gcc/ada/a-stuten.adb
@@ -0,0 +1,209 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . U T F _ E N C O D I N G --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body Ada.Strings.UTF_Encoding is
+ use Interfaces;
+
+ --------------
+ -- Encoding --
+ --------------
+
+ function Encoding
+ (Item : UTF_String;
+ Default : Encoding_Scheme := UTF_8) return Encoding_Scheme
+ is
+ begin
+ if Item'Length >= 2 then
+ if Item (Item'First .. Item'First + 1) = BOM_16BE then
+ return UTF_16BE;
+
+ elsif Item (Item'First .. Item'First + 1) = BOM_16LE then
+ return UTF_16LE;
+
+ elsif Item'Length >= 3
+ and then Item (Item'First .. Item'First + 2) = BOM_8
+ then
+ return UTF_8;
+ end if;
+ end if;
+
+ return Default;
+ end Encoding;
+
+ -----------------
+ -- From_UTF_16 --
+ -----------------
+
+ function From_UTF_16
+ (Item : UTF_16_Wide_String;
+ Output_Scheme : UTF_XE_Encoding;
+ Output_BOM : Boolean := False) return UTF_String
+ is
+ BSpace : constant Natural := 2 * Boolean'Pos (Output_BOM);
+ Result : UTF_String (1 .. 2 * Item'Length + BSpace);
+ Len : Natural;
+ C : Unsigned_16;
+ Iptr : Natural;
+
+ begin
+ if Output_BOM then
+ Result (1 .. 2) :=
+ (if Output_Scheme = UTF_16BE then BOM_16BE else BOM_16LE);
+ Len := 2;
+ else
+ Len := 0;
+ end if;
+
+ -- Skip input BOM
+
+ Iptr := Item'First;
+
+ if Iptr <= Item'Last and then Item (Iptr) = BOM_16 (1) then
+ Iptr := Iptr + 1;
+ end if;
+
+ -- UTF-16BE case
+
+ if Output_Scheme = UTF_16BE then
+ while Iptr <= Item'Last loop
+ C := To_Unsigned_16 (Item (Iptr));
+ Result (Len + 1) := Character'Val (Shift_Right (C, 8));
+ Result (Len + 2) := Character'Val (C and 16#00_FF#);
+ Len := Len + 2;
+ Iptr := Iptr + 1;
+ end loop;
+
+ -- UTF-16LE case
+
+ else
+ while Iptr <= Item'Last loop
+ C := To_Unsigned_16 (Item (Iptr));
+ Result (Len + 1) := Character'Val (C and 16#00_FF#);
+ Result (Len + 2) := Character'Val (Shift_Right (C, 8));
+ Len := Len + 2;
+ Iptr := Iptr + 1;
+ end loop;
+ end if;
+
+ return Result (1 .. Len);
+ end From_UTF_16;
+
+ --------------------------
+ -- Raise_Encoding_Error --
+ --------------------------
+
+ procedure Raise_Encoding_Error (Index : Natural) is
+ Val : constant String := Index'Img;
+ begin
+ raise Encoding_Error with
+ "bad input at Item (" & Val (Val'First + 1 .. Val'Last) & ')';
+ end Raise_Encoding_Error;
+
+ ---------------
+ -- To_UTF_16 --
+ ---------------
+
+ function To_UTF_16
+ (Item : UTF_String;
+ Input_Scheme : UTF_XE_Encoding;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String
+ is
+ Result : UTF_16_Wide_String (1 .. Item'Length / 2 + 1);
+ Len : Natural;
+ Iptr : Natural;
+
+ begin
+ if Item'Length mod 2 /= 0 then
+ raise Encoding_Error with "UTF-16BE/LE string has odd length";
+ end if;
+
+ -- Deal with input BOM, skip if OK, error if bad BOM
+
+ Iptr := Item'First;
+
+ if Item'Length >= 2 then
+ if Item (Iptr .. Iptr + 1) = BOM_16BE then
+ if Input_Scheme = UTF_16BE then
+ Iptr := Iptr + 2;
+ else
+ Raise_Encoding_Error (Iptr);
+ end if;
+
+ elsif Item (Iptr .. Iptr + 1) = BOM_16LE then
+ if Input_Scheme = UTF_16LE then
+ Iptr := Iptr + 2;
+ else
+ Raise_Encoding_Error (Iptr);
+ end if;
+
+ elsif Item'Length >= 3 and then Item (Iptr .. Iptr + 2) = BOM_8 then
+ Raise_Encoding_Error (Iptr);
+ end if;
+ end if;
+
+ -- Output BOM if specified
+
+ if Output_BOM then
+ Result (1) := BOM_16 (1);
+ Len := 1;
+ else
+ Len := 0;
+ end if;
+
+ -- UTF-16BE case
+
+ if Input_Scheme = UTF_16BE then
+ while Iptr < Item'Last loop
+ Len := Len + 1;
+ Result (Len) :=
+ Wide_Character'Val
+ (Character'Pos (Item (Iptr)) * 256 +
+ Character'Pos (Item (Iptr + 1)));
+ Iptr := Iptr + 2;
+ end loop;
+
+ -- UTF-16LE case
+
+ else
+ while Iptr < Item'Last loop
+ Len := Len + 1;
+ Result (Len) :=
+ Wide_Character'Val
+ (Character'Pos (Item (Iptr)) +
+ Character'Pos (Item (Iptr + 1)) * 256);
+ Iptr := Iptr + 2;
+ end loop;
+ end if;
+
+ return Result (1 .. Len);
+ end To_UTF_16;
+
+end Ada.Strings.UTF_Encoding;
diff --git a/gcc/ada/a-stuten.ads b/gcc/ada/a-stuten.ads
new file mode 100644
index 00000000000..5299c6f88e2
--- /dev/null
+++ b/gcc/ada/a-stuten.ads
@@ -0,0 +1,146 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . U T F _ E N C O D I N G --
+-- --
+-- S p e c --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is one of the Ada 2012 package defined in AI05-0137-1. It is a parent
+-- package that contains declarations used in the child packages for handling
+-- UTF encoded strings. Note: this package is consistent with Ada 95, and may
+-- be used in Ada 95 or Ada 2005 mode.
+
+with Interfaces;
+with Unchecked_Conversion;
+
+package Ada.Strings.UTF_Encoding is
+ pragma Pure (UTF_Encoding);
+
+ subtype UTF_String is String;
+ -- Used to represent a string of 8-bit values containing a sequence of
+ -- values encoded in one of three ways (UTF-8, UTF-16BE, or UTF-16LE).
+ -- Typically used in connection with a Scheme parameter indicating which
+ -- of the encodings applies. This is not strictly a String value in the
+ -- sense defined in the Ada RM, but in practice type String accomodates
+ -- all possible 256 codes, and can be used to hold any sequence of 8-bit
+ -- codes. We use String directly rather than create a new type so that
+ -- all existing facilities for manipulating type String (e.g. the child
+ -- packages of Ada.Strings) are available for manipulation of UTF_Strings.
+
+ type Encoding_Scheme is (UTF_8, UTF_16BE, UTF_16LE);
+ -- Used to specify which of three possible encodings apply to a UTF_String
+
+ subtype UTF_8_String is String;
+ -- Similar to UTF_String but specifically represents a UTF-8 encoded string
+
+ subtype UTF_16_Wide_String is Wide_String;
+ -- This is similar to UTF_8_String but is used to represent a Wide_String
+ -- value which is a sequence of 16-bit values encoded using UTF-16. Again
+ -- this is not strictly a Wide_String in the sense of the Ada RM, but the
+ -- type Wide_String can be used to represent a sequence of arbitrary 16-bit
+ -- values, and it is more convenient to use Wide_String than a new type.
+
+ Encoding_Error : exception;
+ -- This exception is raised in the following situations:
+ -- a) A UTF encoded string contains an invalid encoding sequence
+ -- b) A UTF-16BE or UTF-16LE input string has an odd length
+ -- c) An incorrect character value is present in the Input string
+ -- d) The result for a Wide_Character output exceeds 16#FFFF#
+ -- The exception message has the index value where the error occurred.
+
+ -- The BOM (BYTE_ORDER_MARK) values defined here are used at the start of
+ -- a string to indicate the encoding. The convention in this package is
+ -- that on input a correct BOM is ignored and an incorrect BOM causes an
+ -- Encoding_Error exception. On output, the output string may or may not
+ -- include a BOM depending on the setting of Output_BOM.
+
+ BOM_8 : constant UTF_8_String :=
+ Character'Val (16#EF#) &
+ Character'Val (16#BB#) &
+ Character'Val (16#BF#);
+
+ BOM_16BE : constant UTF_String :=
+ Character'Val (16#FE#) &
+ Character'Val (16#FF#);
+
+ BOM_16LE : constant UTF_String :=
+ Character'Val (16#FF#) &
+ Character'Val (16#FE#);
+
+ BOM_16 : constant UTF_16_Wide_String :=
+ (1 => Wide_Character'Val (16#FEFF#));
+
+ function Encoding
+ (Item : UTF_String;
+ Default : Encoding_Scheme := UTF_8) return Encoding_Scheme;
+ -- This function inspects a UTF_String value to determine whether it
+ -- starts with a BOM for UTF-8, UTF-16BE, or UTF_16LE. If so, the result
+ -- is the scheme corresponding to the BOM. If no valid BOM is present
+ -- then the result is the specified Default value.
+
+private
+ function To_Unsigned_8 is new
+ Unchecked_Conversion (Character, Interfaces.Unsigned_8);
+
+ function To_Unsigned_16 is new
+ Unchecked_Conversion (Wide_Character, Interfaces.Unsigned_16);
+
+ function To_Unsigned_32 is new
+ Unchecked_Conversion (Wide_Wide_Character, Interfaces.Unsigned_32);
+
+ subtype UTF_XE_Encoding is Encoding_Scheme range UTF_16BE .. UTF_16LE;
+ -- Subtype containing only UTF_16BE and UTF_16LE entries
+
+ -- Utility routines for converting between UTF-16 and UTF-16LE/BE
+
+ function From_UTF_16
+ (Item : UTF_16_Wide_String;
+ Output_Scheme : UTF_XE_Encoding;
+ Output_BOM : Boolean := False) return UTF_String;
+ -- The input string Item is encoded in UTF-16. The output is encoded using
+ -- Output_Scheme (which is either UTF-16LE or UTF-16BE). There are no error
+ -- cases. The output starts with BOM_16BE/LE if Output_BOM is True.
+
+ function To_UTF_16
+ (Item : UTF_String;
+ Input_Scheme : UTF_XE_Encoding;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String;
+ -- The input string Item is encoded using Input_Scheme which is either
+ -- UTF-16LE or UTF-16BE. The output is the corresponding UTF_16 wide
+ -- string. Encoding error is raised if the length of the input is odd.
+ -- The output starts with BOM_16 if Output_BOM is True.
+
+ procedure Raise_Encoding_Error (Index : Natural);
+ pragma No_Return (Raise_Encoding_Error);
+ -- Raise Encoding_Error exception for bad encoding in input item. The
+ -- parameter Index is the index of the location in Item for the error.
+
+end Ada.Strings.UTF_Encoding;
diff --git a/gcc/ada/a-stwiun-shared.adb b/gcc/ada/a-stwiun-shared.adb
new file mode 100644
index 00000000000..0f61c7130e6
--- /dev/null
+++ b/gcc/ada/a-stwiun-shared.adb
@@ -0,0 +1,2104 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Wide_Search;
+with Ada.Unchecked_Deallocation;
+
+package body Ada.Strings.Wide_Unbounded is
+
+ use Ada.Strings.Wide_Maps;
+
+ Growth_Factor : constant := 32;
+ -- The growth factor controls how much extra space is allocated when
+ -- we have to increase the size of an allocated unbounded string. By
+ -- allocating extra space, we avoid the need to reallocate on every
+ -- append, particularly important when a string is built up by repeated
+ -- append operations of small pieces. This is expressed as a factor so
+ -- 32 means add 1/32 of the length of the string as growth space.
+
+ Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
+ -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes
+ -- no memory loss as most (all?) malloc implementations are obliged to
+ -- align the returned memory on the maximum alignment as malloc does not
+ -- know the target alignment.
+
+ procedure Sync_Add_And_Fetch
+ (Ptr : access Interfaces.Unsigned_32;
+ Value : Interfaces.Unsigned_32);
+ pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4");
+
+ function Sync_Sub_And_Fetch
+ (Ptr : access Interfaces.Unsigned_32;
+ Value : Interfaces.Unsigned_32) return Interfaces.Unsigned_32;
+ pragma Import (Intrinsic, Sync_Sub_And_Fetch, "__sync_sub_and_fetch_4");
+
+ function Aligned_Max_Length (Max_Length : Natural) return Natural;
+ -- Returns recommended length of the shared string which is greater or
+ -- equal to specified length. Calculation take in sense alignment of
+ -- the allocated memory segments to use memory effectively by
+ -- Append/Insert/etc operations.
+
+ ---------
+ -- "&" --
+ ---------
+
+ function "&"
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ DL : constant Natural := LR.Last + RR.Last;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Left string is empty, return Rigth string.
+
+ elsif LR.Last = 0 then
+ Reference (RR);
+ DR := RR;
+
+ -- Right string is empty, return Left string.
+
+ elsif RR.Last = 0 then
+ Reference (LR);
+ DR := LR;
+
+ -- Overwise, allocate new shared string and fill data.
+
+ else
+ DR := Allocate (LR.Last + RR.Last);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (LR.Last + 1 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Unbounded_Wide_String
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ DL : constant Natural := LR.Last + Right'Length;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Right is an empty string, return Left string.
+
+ elsif Right'Length = 0 then
+ Reference (LR);
+ DR := LR;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (LR.Last + 1 .. DL) := Right;
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ DL : constant Natural := Left'Length + RR.Last;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared one.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Left is empty string, return Right string.
+
+ elsif Left'Length = 0 then
+ Reference (RR);
+ DR := RR;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Left'Length) := Left;
+ DR.Data (Left'Length + 1 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_Character) return Unbounded_Wide_String
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ DL : constant Natural := LR.Last + 1;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ DR := Allocate (DL);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (DL) := Right;
+ DR.Last := DL;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Wide_Character;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ DL : constant Natural := 1 + RR.Last;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ DR := Allocate (DL);
+ DR.Data (1) := Left;
+ DR.Data (2 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ ---------
+ -- "*" --
+ ---------
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_Character) return Unbounded_Wide_String
+ is
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if Left = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (Left);
+
+ for J in 1 .. Left loop
+ DR.Data (J) := Right;
+ end loop;
+
+ DR.Last := Left;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_String) return Unbounded_Wide_String
+ is
+ DL : constant Natural := Left * Right'Length;
+ DR : Shared_Wide_String_Access;
+ K : Positive;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ K := 1;
+
+ for J in 1 .. Left loop
+ DR.Data (K .. K + Right'Length - 1) := Right;
+ K := K + Right'Length;
+ end loop;
+
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ function "*"
+ (Left : Natural;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ DL : constant Natural := Left * RR.Last;
+ DR : Shared_Wide_String_Access;
+ K : Positive;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Coefficient is one, just return string itself.
+
+ elsif Left = 1 then
+ Reference (RR);
+ DR := RR;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ K := 1;
+
+ for J in 1 .. Left loop
+ DR.Data (K .. K + RR.Last - 1) := RR.Data (1 .. RR.Last);
+ K := K + RR.Last;
+ end loop;
+
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ ---------
+ -- "<" --
+ ---------
+
+ function "<"
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) < RR.Data (1 .. RR.Last);
+ end "<";
+
+ function "<"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) < Right;
+ end "<";
+
+ function "<"
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ begin
+ return Left < RR.Data (1 .. RR.Last);
+ end "<";
+
+ ----------
+ -- "<=" --
+ ----------
+
+ function "<="
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+
+ begin
+ -- LR = RR means two strings shares shared string, thus they are equal
+
+ return LR = RR or else LR.Data (1 .. LR.Last) <= RR.Data (1 .. RR.Last);
+ end "<=";
+
+ function "<="
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) <= Right;
+ end "<=";
+
+ function "<="
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ begin
+ return Left <= RR.Data (1 .. RR.Last);
+ end "<=";
+
+ ---------
+ -- "=" --
+ ---------
+
+ function "="
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+
+ begin
+ return LR = RR or else LR.Data (1 .. LR.Last) = RR.Data (1 .. RR.Last);
+ -- LR = RR means two strings shares shared string, thus they are equal.
+ end "=";
+
+ function "="
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) = Right;
+ end "=";
+
+ function "="
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ begin
+ return Left = RR.Data (1 .. RR.Last);
+ end "=";
+
+ ---------
+ -- ">" --
+ ---------
+
+ function ">"
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) > RR.Data (1 .. RR.Last);
+ end ">";
+
+ function ">"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) > Right;
+ end ">";
+
+ function ">"
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ begin
+ return Left > RR.Data (1 .. RR.Last);
+ end ">";
+
+ ----------
+ -- ">=" --
+ ----------
+
+ function ">="
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+
+ begin
+ -- LR = RR means two strings shares shared string, thus they are equal
+
+ return LR = RR or else LR.Data (1 .. LR.Last) >= RR.Data (1 .. RR.Last);
+ end ">=";
+
+ function ">="
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) >= Right;
+ end ">=";
+
+ function ">="
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_String_Access := Right.Reference;
+ begin
+ return Left >= RR.Data (1 .. RR.Last);
+ end ">=";
+
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Object : in out Unbounded_Wide_String) is
+ begin
+ Reference (Object.Reference);
+ end Adjust;
+
+ ------------------------
+ -- Aligned_Max_Length --
+ ------------------------
+
+ function Aligned_Max_Length (Max_Length : Natural) return Natural is
+ Static_Size : constant Natural :=
+ Empty_Shared_Wide_String'Size / Standard'Storage_Unit;
+ -- Total size of all static components
+
+ Element_Size : constant Natural :=
+ Wide_Character'Size / Standard'Storage_Unit;
+
+ begin
+ return
+ (((Static_Size + Max_Length * Element_Size - 1) / Min_Mul_Alloc + 2)
+ * Min_Mul_Alloc - Static_Size) / Element_Size;
+ end Aligned_Max_Length;
+
+ --------------
+ -- Allocate --
+ --------------
+
+ function Allocate (Max_Length : Natural) return Shared_Wide_String_Access is
+ begin
+ -- Empty string requested, return shared empty string
+
+ if Max_Length = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ return Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate requested space (and probably some more room)
+
+ else
+ return new Shared_Wide_String (Aligned_Max_Length (Max_Length));
+ end if;
+ end Allocate;
+
+ ------------
+ -- Append --
+ ------------
+
+ procedure Append
+ (Source : in out Unbounded_Wide_String;
+ New_Item : Unbounded_Wide_String)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ NR : constant Shared_Wide_String_Access := New_Item.Reference;
+ DL : constant Natural := SR.Last + NR.Last;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Source is an empty string, reuse New_Item data
+
+ if SR.Last = 0 then
+ Reference (NR);
+ Source.Reference := NR;
+ Unreference (SR);
+
+ -- New_Item is empty string, nothing to do
+
+ elsif NR.Last = 0 then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ procedure Append
+ (Source : in out Unbounded_Wide_String;
+ New_Item : Wide_String)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- New_Item is an empty string, nothing to do
+
+ if New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (SR.Last + 1 .. DL) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (SR.Last + 1 .. DL) := New_Item;
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ procedure Append
+ (Source : in out Unbounded_Wide_String;
+ New_Item : Wide_Character)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + 1;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Try to reuse existing shared string
+
+ if Can_Be_Reused (SR, SR.Last + 1) then
+ SR.Data (SR.Last + 1) := New_Item;
+ SR.Last := SR.Last + 1;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (DL) := New_Item;
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ -------------------
+ -- Can_Be_Reused --
+ -------------------
+
+ function Can_Be_Reused
+ (Item : Shared_Wide_String_Access;
+ Length : Natural) return Boolean
+ is
+ use Interfaces;
+ begin
+ return
+ Item.Counter = 1
+ and then Item.Max_Length >= Length
+ and then Item.Max_Length <=
+ Aligned_Max_Length (Length + Length / Growth_Factor);
+ end Can_Be_Reused;
+
+ -----------
+ -- Count --
+ -----------
+
+ function Count
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
+ return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping);
+ end Count;
+
+ function Count
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping);
+ end Count;
+
+ function Count
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Count (SR.Data (1 .. SR.Last), Set);
+ end Count;
+
+ ------------
+ -- Delete --
+ ------------
+
+ function Delete
+ (Source : Unbounded_Wide_String;
+ From : Positive;
+ Through : Natural) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Empty slice is deleted, use the same shared string
+
+ if From > Through then
+ Reference (SR);
+ DR := SR;
+
+ -- Index is out of range
+
+ elsif Through > SR.Last then
+ raise Index_Error;
+
+ -- Compute size of the result
+
+ else
+ DL := SR.Last - (Through - From + 1);
+
+ -- Result is an empty string, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1);
+ DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Delete;
+
+ procedure Delete
+ (Source : in out Unbounded_Wide_String;
+ From : Positive;
+ Through : Natural)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Nothing changed, return
+
+ if From > Through then
+ null;
+
+ -- Through is outside of the range
+
+ elsif Through > SR.Last then
+ raise Index_Error;
+
+ else
+ DL := SR.Last - (Through - From + 1);
+
+ -- Result is empty, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1);
+ DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Delete;
+
+ -------------
+ -- Element --
+ -------------
+
+ function Element
+ (Source : Unbounded_Wide_String;
+ Index : Positive) return Wide_Character
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ if Index <= SR.Last then
+ return SR.Data (Index);
+ else
+ raise Index_Error;
+ end if;
+ end Element;
+
+ --------------
+ -- Finalize --
+ --------------
+
+ procedure Finalize (Object : in out Unbounded_Wide_String) is
+ SR : constant Shared_Wide_String_Access := Object.Reference;
+
+ begin
+ if SR /= null then
+
+ -- The same controlled object can be finalized several times for
+ -- some reason. As per 7.6.1(24) this should have no ill effect,
+ -- so we need to add a guard for the case of finalizing the same
+ -- object twice.
+
+ Object.Reference := null;
+ Unreference (SR);
+ end if;
+ end Finalize;
+
+ ----------------
+ -- Find_Token --
+ ----------------
+
+ procedure Find_Token
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set;
+ Test : Strings.Membership;
+ First : out Positive;
+ Last : out Natural)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ Wide_Search.Find_Token (SR.Data (1 .. SR.Last), Set, Test, First, Last);
+ end Find_Token;
+
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (X : in out Wide_String_Access) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access);
+ begin
+ Deallocate (X);
+ end Free;
+
+ ----------
+ -- Head --
+ ----------
+
+ function Head
+ (Source : Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Result is empty, reuse shared empty string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Length of the string is the same as requested, reuse source shared
+ -- string.
+
+ elsif Count = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ -- Length of the source string is more than requested, copy
+ -- corresponding slice.
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (1 .. Count);
+
+ -- Length of the source string is less then requested, copy all
+ -- contents and fill others by Pad character.
+
+ else
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+
+ for J in SR.Last + 1 .. Count loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Head;
+
+ procedure Head
+ (Source : in out Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Result is empty, reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ -- Result is same with source string, reuse source shared string
+
+ elsif Count = SR.Last then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, Count) then
+ if Count > SR.Last then
+ for J in SR.Last + 1 .. Count loop
+ SR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ SR.Last := Count;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ -- Length of the source string is greater then requested, copy
+ -- corresponding slice.
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (1 .. Count);
+
+ -- Length of the source string is less the requested, copy all
+ -- exists data and fill others by Pad character.
+
+ else
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+
+ for J in SR.Last + 1 .. Count loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Head;
+
+ -----------
+ -- Index --
+ -----------
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Going : Strings.Direction := Strings.Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
+ return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Going : Direction := Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set;
+ Test : Strings.Membership := Strings.Inside;
+ Going : Strings.Direction := Strings.Forward) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index (SR.Data (1 .. SR.Last), Set, Test, Going);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
+ return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set;
+ From : Positive;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Set, From, Test, Going);
+ end Index;
+
+ ---------------------
+ -- Index_Non_Blank --
+ ---------------------
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_String;
+ Going : Strings.Direction := Strings.Forward) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index_Non_Blank (SR.Data (1 .. SR.Last), Going);
+ end Index_Non_Blank;
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_String;
+ From : Positive;
+ Going : Direction := Forward) return Natural
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Search.Index_Non_Blank
+ (SR.Data (1 .. SR.Last), From, Going);
+ end Index_Non_Blank;
+
+ ----------------
+ -- Initialize --
+ ----------------
+
+ procedure Initialize (Object : in out Unbounded_Wide_String) is
+ begin
+ Reference (Object.Reference);
+ end Initialize;
+
+ ------------
+ -- Insert --
+ ------------
+
+ function Insert
+ (Source : Unbounded_Wide_String;
+ Before : Positive;
+ New_Item : Wide_String) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Check index first
+
+ if Before > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Result is empty, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Inserted string is empty, reuse source shared string
+
+ elsif New_Item'Length = 0 then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1);
+ DR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ DR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Insert;
+
+ procedure Insert
+ (Source : in out Unbounded_Wide_String;
+ Before : Positive;
+ New_Item : Wide_String)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Before > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ -- Inserted string is empty, nothing to do
+
+ elsif New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existent shared string first
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ SR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1);
+ DR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ DR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Insert;
+
+ ------------
+ -- Length --
+ ------------
+
+ function Length (Source : Unbounded_Wide_String) return Natural is
+ begin
+ return Source.Reference.Last;
+ end Length;
+
+ ---------------
+ -- Overwrite --
+ ---------------
+
+ function Overwrite
+ (Source : Unbounded_Wide_String;
+ Position : Positive;
+ New_Item : Wide_String) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Position > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ DL := Integer'Max (SR.Last, Position + New_Item'Length - 1);
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Result is same with source string, reuse source shared string
+
+ elsif New_Item'Length = 0 then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1);
+ DR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ DR.Data (Position + New_Item'Length .. DL) :=
+ SR.Data (Position + New_Item'Length .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Overwrite;
+
+ procedure Overwrite
+ (Source : in out Unbounded_Wide_String;
+ Position : Positive;
+ New_Item : Wide_String)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Bounds check
+
+ if Position > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ DL := Integer'Max (SR.Last, Position + New_Item'Length - 1);
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ -- String unchanged, nothing to do
+
+ elsif New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1);
+ DR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ DR.Data (Position + New_Item'Length .. DL) :=
+ SR.Data (Position + New_Item'Length .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Overwrite;
+
+ ---------------
+ -- Reference --
+ ---------------
+
+ procedure Reference (Item : not null Shared_Wide_String_Access) is
+ begin
+ Sync_Add_And_Fetch (Item.Counter'Access, 1);
+ end Reference;
+
+ ---------------------
+ -- Replace_Element --
+ ---------------------
+
+ procedure Replace_Element
+ (Source : in out Unbounded_Wide_String;
+ Index : Positive;
+ By : Wide_Character)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Bounds check.
+
+ if Index <= SR.Last then
+
+ -- Try to reuse existent shared string
+
+ if Can_Be_Reused (SR, SR.Last) then
+ SR.Data (Index) := By;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (Index) := By;
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ else
+ raise Index_Error;
+ end if;
+ end Replace_Element;
+
+ -------------------
+ -- Replace_Slice --
+ -------------------
+
+ function Replace_Slice
+ (Source : Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_String) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Do replace operation when removed slice is not empty
+
+ if High >= Low then
+ DL := By'Length + SR.Last + Low - High - 1;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1);
+ DR.Data (Low .. Low + By'Length - 1) := By;
+ DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+
+ -- Otherwise just insert string
+
+ else
+ return Insert (Source, Low, By);
+ end if;
+ end Replace_Slice;
+
+ procedure Replace_Slice
+ (Source : in out Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_String)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Bounds check
+
+ if Low > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Do replace operation only when replaced slice is not empty
+
+ if High >= Low then
+ DL := By'Length + SR.Last + Low - High - 1;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ SR.Data (Low .. Low + By'Length - 1) := By;
+ SR.Last := DL;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1);
+ DR.Data (Low .. Low + By'Length - 1) := By;
+ DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ -- Otherwise just insert item
+
+ else
+ Insert (Source, Low, By);
+ end if;
+ end Replace_Slice;
+
+ -------------------------------
+ -- Set_Unbounded_Wide_String --
+ -------------------------------
+
+ procedure Set_Unbounded_Wide_String
+ (Target : out Unbounded_Wide_String;
+ Source : Wide_String)
+ is
+ TR : constant Shared_Wide_String_Access := Target.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- In case of empty string, reuse empty shared string
+
+ if Source'Length = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Target.Reference := Empty_Shared_Wide_String'Access;
+
+ else
+ -- Try to reuse existent shared string
+
+ if Can_Be_Reused (TR, Source'Length) then
+ Reference (TR);
+ DR := TR;
+
+ -- Otherwise allocate new shared string
+
+ else
+ DR := Allocate (Source'Length);
+ Target.Reference := DR;
+ end if;
+
+ DR.Data (1 .. Source'Length) := Source;
+ DR.Last := Source'Length;
+ end if;
+
+ Unreference (TR);
+ end Set_Unbounded_Wide_String;
+
+ -----------
+ -- Slice --
+ -----------
+
+ function Slice
+ (Source : Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural) return Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+
+ begin
+ -- Note: test of High > Length is in accordance with AI95-00128
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ else
+ return SR.Data (Low .. High);
+ end if;
+ end Slice;
+
+ ----------
+ -- Tail --
+ ----------
+
+ function Tail
+ (Source : Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- For empty result reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Result is hole source string, reuse source shared string
+
+ elsif Count = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last);
+
+ else
+ for J in 1 .. Count - SR.Last loop
+ DR.Data (J) := Pad;
+ end loop;
+
+ DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last);
+ end if;
+
+ DR.Last := Count;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Tail;
+
+ procedure Tail
+ (Source : in out Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ procedure Common
+ (SR : Shared_Wide_String_Access;
+ DR : Shared_Wide_String_Access;
+ Count : Natural);
+ -- Common code of tail computation. SR/DR can point to the same object
+
+ ------------
+ -- Common --
+ ------------
+
+ procedure Common
+ (SR : Shared_Wide_String_Access;
+ DR : Shared_Wide_String_Access;
+ Count : Natural) is
+ begin
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last);
+
+ else
+ DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last);
+
+ for J in 1 .. Count - SR.Last loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ end Common;
+
+ begin
+ -- Result is empty string, reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ -- Length of the result is the same with length of the source string,
+ -- reuse source shared string.
+
+ elsif Count = SR.Last then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, Count) then
+ Common (SR, SR, Count);
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+ Common (SR, DR, Count);
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Tail;
+
+ --------------------
+ -- To_Wide_String --
+ --------------------
+
+ function To_Wide_String
+ (Source : Unbounded_Wide_String) return Wide_String is
+ begin
+ return Source.Reference.Data (1 .. Source.Reference.Last);
+ end To_Wide_String;
+
+ ------------------------------
+ -- To_Unbounded_Wide_String --
+ ------------------------------
+
+ function To_Unbounded_Wide_String
+ (Source : Wide_String) return Unbounded_Wide_String
+ is
+ DR : constant Shared_Wide_String_Access := Allocate (Source'Length);
+ begin
+ DR.Data (1 .. Source'Length) := Source;
+ DR.Last := Source'Length;
+ return (AF.Controlled with Reference => DR);
+ end To_Unbounded_Wide_String;
+
+ function To_Unbounded_Wide_String
+ (Length : Natural) return Unbounded_Wide_String
+ is
+ DR : constant Shared_Wide_String_Access := Allocate (Length);
+ begin
+ DR.Last := Length;
+ return (AF.Controlled with Reference => DR);
+ end To_Unbounded_Wide_String;
+
+ ---------------
+ -- Translate --
+ ---------------
+
+ function Translate
+ (Source : Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Nothing to translate, reuse empty shared string
+
+ if SR.Last = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Translate;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Nothing to translate
+
+ if SR.Last = 0 then
+ null;
+
+ -- Try to reuse shared string
+
+ elsif Can_Be_Reused (SR, SR.Last) then
+ for J in 1 .. SR.Last loop
+ SR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Translate;
+
+ function Translate
+ (Source : Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function)
+ return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Nothing to translate, reuse empty shared string
+
+ if SR.Last = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+
+ exception
+ when others =>
+ Unreference (DR);
+
+ raise;
+ end Translate;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Nothing to translate
+
+ if SR.Last = 0 then
+ null;
+
+ -- Try to reuse shared string
+
+ elsif Can_Be_Reused (SR, SR.Last) then
+ for J in 1 .. SR.Last loop
+ SR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ exception
+ when others =>
+ if DR /= null then
+ Unreference (DR);
+ end if;
+
+ raise;
+ end Translate;
+
+ ----------
+ -- Trim --
+ ----------
+
+ function Trim
+ (Source : Unbounded_Wide_String;
+ Side : Trim_End) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index_Non_Blank (Source, Forward);
+
+ -- All blanks, reuse empty shared string
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ else
+ case Side is
+ when Left =>
+ High := SR.Last;
+ DL := SR.Last - Low + 1;
+
+ when Right =>
+ Low := 1;
+ High := Index_Non_Blank (Source, Backward);
+ DL := High;
+
+ when Both =>
+ High := Index_Non_Blank (Source, Backward);
+ DL := High - Low + 1;
+ end case;
+
+ -- Length of the result is the same as length of the source string,
+ -- reuse source shared string.
+
+ if DL = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Trim;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_String;
+ Side : Trim_End)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index_Non_Blank (Source, Forward);
+
+ -- All blanks, reuse empty shared string
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ else
+ case Side is
+ when Left =>
+ High := SR.Last;
+ DL := SR.Last - Low + 1;
+
+ when Right =>
+ Low := 1;
+ High := Index_Non_Blank (Source, Backward);
+ DL := High;
+
+ when Both =>
+ High := Index_Non_Blank (Source, Backward);
+ DL := High - Low + 1;
+ end case;
+
+ -- Length of the result is the same as length of the source string,
+ -- nothing to do.
+
+ if DL = SR.Last then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (1 .. DL) := SR.Data (Low .. High);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Trim;
+
+ function Trim
+ (Source : Unbounded_Wide_String;
+ Left : Wide_Maps.Wide_Character_Set;
+ Right : Wide_Maps.Wide_Character_Set) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index (Source, Left, Outside, Forward);
+
+ -- Source includes only characters from Left set, reuse empty shared
+ -- string.
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ else
+ High := Index (Source, Right, Outside, Backward);
+ DL := Integer'Max (0, High - Low + 1);
+
+ -- Source includes only characters from Right set or result string
+ -- is empty, reuse empty shared string.
+
+ if High = 0 or else DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Trim;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_String;
+ Left : Wide_Maps.Wide_Character_Set;
+ Right : Wide_Maps.Wide_Character_Set)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index (Source, Left, Outside, Forward);
+
+ -- Source includes only characters from Left set, reuse empty shared
+ -- string.
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ else
+ High := Index (Source, Right, Outside, Backward);
+ DL := Integer'Max (0, High - Low + 1);
+
+ -- Source includes only characters from Right set or result string
+ -- is empty, reuse empty shared string.
+
+ if High = 0 or else DL = 0 then
+ Reference (Empty_Shared_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (1 .. DL) := SR.Data (Low .. High);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Trim;
+
+ ---------------------
+ -- Unbounded_Slice --
+ ---------------------
+
+ function Unbounded_Slice
+ (Source : Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural) return Unbounded_Wide_String
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ -- Result is empty slice, reuse empty shared string
+
+ elsif Low > High then
+ Reference (Empty_Shared_Wide_String'Access);
+ DR := Empty_Shared_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DL := High - Low + 1;
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Unbounded_Slice;
+
+ procedure Unbounded_Slice
+ (Source : Unbounded_Wide_String;
+ Target : out Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural)
+ is
+ SR : constant Shared_Wide_String_Access := Source.Reference;
+ TR : constant Shared_Wide_String_Access := Target.Reference;
+ DL : Natural;
+ DR : Shared_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ -- Result is empty slice, reuse empty shared string
+
+ elsif Low > High then
+ Reference (Empty_Shared_Wide_String'Access);
+ Target.Reference := Empty_Shared_Wide_String'Access;
+ Unreference (TR);
+
+ else
+ DL := High - Low + 1;
+
+ -- Try to reuse existent shared string
+
+ if Can_Be_Reused (TR, DL) then
+ TR.Data (1 .. DL) := SR.Data (Low .. High);
+ TR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Target.Reference := DR;
+ Unreference (TR);
+ end if;
+ end if;
+ end Unbounded_Slice;
+
+ -----------------
+ -- Unreference --
+ -----------------
+
+ procedure Unreference (Item : not null Shared_Wide_String_Access) is
+ use Interfaces;
+
+ procedure Free is
+ new Ada.Unchecked_Deallocation
+ (Shared_Wide_String, Shared_Wide_String_Access);
+
+ Aux : Shared_Wide_String_Access := Item;
+
+ begin
+ if Sync_Sub_And_Fetch (Aux.Counter'Access, 1) = 0 then
+
+ -- Reference counter of Empty_Shared_Wide_String must never reach
+ -- zero.
+
+ pragma Assert (Aux /= Empty_Shared_Wide_String'Access);
+
+ Free (Aux);
+ end if;
+ end Unreference;
+
+end Ada.Strings.Wide_Unbounded;
diff --git a/gcc/ada/a-stwiun-shared.ads b/gcc/ada/a-stwiun-shared.ads
new file mode 100644
index 00000000000..a438258c908
--- /dev/null
+++ b/gcc/ada/a-stwiun-shared.ads
@@ -0,0 +1,483 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2009, 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This version is supported on:
+-- - all Alpha platforms
+-- - all ia64 platforms
+-- - all PowerPC platforms
+-- - all SPARC V9 platforms
+-- - all x86_64 platforms
+
+with Ada.Strings.Wide_Maps;
+private with Ada.Finalization;
+private with Interfaces;
+
+package Ada.Strings.Wide_Unbounded is
+ pragma Preelaborate;
+
+ type Unbounded_Wide_String is private;
+ pragma Preelaborable_Initialization (Unbounded_Wide_String);
+
+ Null_Unbounded_Wide_String : constant Unbounded_Wide_String;
+
+ function Length (Source : Unbounded_Wide_String) return Natural;
+
+ type Wide_String_Access is access all Wide_String;
+
+ procedure Free (X : in out Wide_String_Access);
+
+ --------------------------------------------------------
+ -- Conversion, Concatenation, and Selection Functions --
+ --------------------------------------------------------
+
+ function To_Unbounded_Wide_String
+ (Source : Wide_String) return Unbounded_Wide_String;
+
+ function To_Unbounded_Wide_String
+ (Length : Natural) return Unbounded_Wide_String;
+
+ function To_Wide_String
+ (Source : Unbounded_Wide_String) return Wide_String;
+
+ procedure Set_Unbounded_Wide_String
+ (Target : out Unbounded_Wide_String;
+ Source : Wide_String);
+ pragma Ada_05 (Set_Unbounded_Wide_String);
+
+ procedure Append
+ (Source : in out Unbounded_Wide_String;
+ New_Item : Unbounded_Wide_String);
+
+ procedure Append
+ (Source : in out Unbounded_Wide_String;
+ New_Item : Wide_String);
+
+ procedure Append
+ (Source : in out Unbounded_Wide_String;
+ New_Item : Wide_Character);
+
+ function "&"
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String;
+
+ function "&"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Unbounded_Wide_String;
+
+ function "&"
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String;
+
+ function "&"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_Character) return Unbounded_Wide_String;
+
+ function "&"
+ (Left : Wide_Character;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String;
+
+ function Element
+ (Source : Unbounded_Wide_String;
+ Index : Positive) return Wide_Character;
+
+ procedure Replace_Element
+ (Source : in out Unbounded_Wide_String;
+ Index : Positive;
+ By : Wide_Character);
+
+ function Slice
+ (Source : Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural) return Wide_String;
+
+ function Unbounded_Slice
+ (Source : Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural) return Unbounded_Wide_String;
+ pragma Ada_05 (Unbounded_Slice);
+
+ procedure Unbounded_Slice
+ (Source : Unbounded_Wide_String;
+ Target : out Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural);
+ pragma Ada_05 (Unbounded_Slice);
+
+ function "="
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function "="
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean;
+
+ function "="
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function "<"
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function "<"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean;
+
+ function "<"
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function "<="
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function "<="
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean;
+
+ function "<="
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function ">"
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function ">"
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean;
+
+ function ">"
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function ">="
+ (Left : Unbounded_Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ function ">="
+ (Left : Unbounded_Wide_String;
+ Right : Wide_String) return Boolean;
+
+ function ">="
+ (Left : Wide_String;
+ Right : Unbounded_Wide_String) return Boolean;
+
+ ------------------------
+ -- Search Subprograms --
+ ------------------------
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Going : Direction := Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
+ return Natural;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Going : Direction := Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural;
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
+ return Natural;
+ pragma Ada_05 (Index);
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
+ pragma Ada_05 (Index);
+
+ function Index
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set;
+ From : Positive;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural;
+ pragma Ada_05 (Index);
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_String;
+ Going : Direction := Forward) return Natural;
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_String;
+ From : Positive;
+ Going : Direction := Forward) return Natural;
+ pragma Ada_05 (Index_Non_Blank);
+
+ function Count
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
+ return Natural;
+
+ function Count
+ (Source : Unbounded_Wide_String;
+ Pattern : Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
+
+ function Count
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set) return Natural;
+
+ procedure Find_Token
+ (Source : Unbounded_Wide_String;
+ Set : Wide_Maps.Wide_Character_Set;
+ Test : Membership;
+ First : out Positive;
+ Last : out Natural);
+
+ ------------------------------------
+ -- String Translation Subprograms --
+ ------------------------------------
+
+ function Translate
+ (Source : Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping)
+ return Unbounded_Wide_String;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping);
+
+ function Translate
+ (Source : Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function)
+ return Unbounded_Wide_String;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_String;
+ Mapping : Wide_Maps.Wide_Character_Mapping_Function);
+
+ ---------------------------------------
+ -- String Transformation Subprograms --
+ ---------------------------------------
+
+ function Replace_Slice
+ (Source : Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_String) return Unbounded_Wide_String;
+
+ procedure Replace_Slice
+ (Source : in out Unbounded_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_String);
+
+ function Insert
+ (Source : Unbounded_Wide_String;
+ Before : Positive;
+ New_Item : Wide_String) return Unbounded_Wide_String;
+
+ procedure Insert
+ (Source : in out Unbounded_Wide_String;
+ Before : Positive;
+ New_Item : Wide_String);
+
+ function Overwrite
+ (Source : Unbounded_Wide_String;
+ Position : Positive;
+ New_Item : Wide_String) return Unbounded_Wide_String;
+
+ procedure Overwrite
+ (Source : in out Unbounded_Wide_String;
+ Position : Positive;
+ New_Item : Wide_String);
+
+ function Delete
+ (Source : Unbounded_Wide_String;
+ From : Positive;
+ Through : Natural) return Unbounded_Wide_String;
+
+ procedure Delete
+ (Source : in out Unbounded_Wide_String;
+ From : Positive;
+ Through : Natural);
+
+ function Trim
+ (Source : Unbounded_Wide_String;
+ Side : Trim_End) return Unbounded_Wide_String;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_String;
+ Side : Trim_End);
+
+ function Trim
+ (Source : Unbounded_Wide_String;
+ Left : Wide_Maps.Wide_Character_Set;
+ Right : Wide_Maps.Wide_Character_Set) return Unbounded_Wide_String;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_String;
+ Left : Wide_Maps.Wide_Character_Set;
+ Right : Wide_Maps.Wide_Character_Set);
+
+ function Head
+ (Source : Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String;
+
+ procedure Head
+ (Source : in out Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space);
+
+ function Tail
+ (Source : Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String;
+
+ procedure Tail
+ (Source : in out Unbounded_Wide_String;
+ Count : Natural;
+ Pad : Wide_Character := Wide_Space);
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_Character) return Unbounded_Wide_String;
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_String) return Unbounded_Wide_String;
+
+ function "*"
+ (Left : Natural;
+ Right : Unbounded_Wide_String) return Unbounded_Wide_String;
+
+private
+ pragma Inline (Length);
+
+ package AF renames Ada.Finalization;
+
+ type Shared_Wide_String (Max_Length : Natural) is limited record
+ Counter : aliased Interfaces.Unsigned_32 := 1;
+ -- Reference counter.
+
+ Last : Natural := 0;
+ Data : Wide_String (1 .. Max_Length);
+ -- Last is the index of last significant element of the Data. All
+ -- elements with larger indecies are just an extra room.
+ end record;
+
+ type Shared_Wide_String_Access is access all Shared_Wide_String;
+
+ procedure Reference (Item : not null Shared_Wide_String_Access);
+ -- Increment reference counter.
+
+ procedure Unreference (Item : not null Shared_Wide_String_Access);
+ -- Decrement reference counter. Deallocate Item when reference counter is
+ -- zero.
+
+ function Can_Be_Reused
+ (Item : Shared_Wide_String_Access;
+ Length : Natural) return Boolean;
+ -- Returns True if Shared_Wide_String can be reused. There are two criteria
+ -- when Shared_Wide_String can be reused: its reference counter must be one
+ -- (thus Shared_Wide_String is owned exclusively) and its size is
+ -- sufficient to store string with specified length effectively.
+
+ function Allocate (Max_Length : Natural) return Shared_Wide_String_Access;
+ -- Allocates new Shared_Wide_String with at least specified maximum length.
+ -- Actual maximum length of the allocated Shared_Wide_String can be sligtly
+ -- greater. Returns reference to Empty_Shared_Wide_String when requested
+ -- length is zero.
+
+ Empty_Shared_Wide_String : aliased Shared_Wide_String (0);
+
+ function To_Unbounded (S : Wide_String) return Unbounded_Wide_String
+ renames To_Unbounded_Wide_String;
+ -- This renames are here only to be used in the pragma Stream_Convert.
+
+ type Unbounded_Wide_String is new AF.Controlled with record
+ Reference : Shared_Wide_String_Access := Empty_Shared_Wide_String'Access;
+ end record;
+
+ -- The Unbounded_Wide_String uses several techniques to increasy speed of
+ -- the application:
+ -- - implicit sharing or copy-on-write. Unbounded_Wide_String contains
+ -- only the reference to the data which is shared between several
+ -- instances. The shared data is reallocated only when its value is
+ -- changed and the object mutation can't be used or it is unefficient to
+ -- use it;
+ -- - object mutation. Shared data object can be reused without memory
+ -- reallocation when all of the following requirements are meat:
+ -- - shared data object don't used anywhere longer;
+ -- - its size is sufficient to store new value;
+ -- - the gap after reuse is less then some threashold.
+ -- - memory preallocation. Most of used memory allocation algorithms
+ -- alligns allocated segment on the some boundary, thus some amount of
+ -- additional memory can be preallocated without any impact. Such
+ -- preallocated memory can used later by Append/Insert operations
+ -- without reallocation.
+ --
+ -- Reference counting uses GCC builtin atomic operations, which allows to
+ -- safely share internal data between Ada tasks. Nevertheless, this not
+ -- make objects of Unbounded_Wide_String thread-safe, so each instance
+ -- can't be accessed by several tasks simulatenously.
+
+ pragma Stream_Convert (Unbounded_Wide_String, To_Unbounded, To_Wide_String);
+ -- Provide stream routines without dragging in Ada.Streams
+
+ pragma Finalize_Storage_Only (Unbounded_Wide_String);
+ -- Finalization is required only for freeing storage
+
+ overriding procedure Initialize (Object : in out Unbounded_Wide_String);
+ overriding procedure Adjust (Object : in out Unbounded_Wide_String);
+ overriding procedure Finalize (Object : in out Unbounded_Wide_String);
+
+ Null_Unbounded_Wide_String : constant Unbounded_Wide_String :=
+ (AF.Controlled with
+ Reference => Empty_Shared_Wide_String'Access);
+
+end Ada.Strings.Wide_Unbounded;
diff --git a/gcc/ada/a-stzunb-shared.adb b/gcc/ada/a-stzunb-shared.adb
new file mode 100644
index 00000000000..e20cd98e8a0
--- /dev/null
+++ b/gcc/ada/a-stzunb-shared.adb
@@ -0,0 +1,2118 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Wide_Wide_Search;
+with Ada.Unchecked_Deallocation;
+
+package body Ada.Strings.Wide_Wide_Unbounded is
+
+ use Ada.Strings.Wide_Wide_Maps;
+
+ Growth_Factor : constant := 32;
+ -- The growth factor controls how much extra space is allocated when
+ -- we have to increase the size of an allocated unbounded string. By
+ -- allocating extra space, we avoid the need to reallocate on every
+ -- append, particularly important when a string is built up by repeated
+ -- append operations of small pieces. This is expressed as a factor so
+ -- 32 means add 1/32 of the length of the string as growth space.
+
+ Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
+ -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes
+ -- no memory loss as most (all?) malloc implementations are obliged to
+ -- align the returned memory on the maximum alignment as malloc does not
+ -- know the target alignment.
+
+ procedure Sync_Add_And_Fetch
+ (Ptr : access Interfaces.Unsigned_32;
+ Value : Interfaces.Unsigned_32);
+ pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4");
+
+ function Sync_Sub_And_Fetch
+ (Ptr : access Interfaces.Unsigned_32;
+ Value : Interfaces.Unsigned_32) return Interfaces.Unsigned_32;
+ pragma Import (Intrinsic, Sync_Sub_And_Fetch, "__sync_sub_and_fetch_4");
+
+ function Aligned_Max_Length (Max_Length : Natural) return Natural;
+ -- Returns recommended length of the shared string which is greater or
+ -- equal to specified length. Calculation take in sense alignment of
+ -- the allocated memory segments to use memory effectively by
+ -- Append/Insert/etc operations.
+
+ ---------
+ -- "&" --
+ ---------
+
+ function "&"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ DL : constant Natural := LR.Last + RR.Last;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Left string is empty, return Rigth string.
+
+ elsif LR.Last = 0 then
+ Reference (RR);
+ DR := RR;
+
+ -- Right string is empty, return Left string.
+
+ elsif RR.Last = 0 then
+ Reference (LR);
+ DR := LR;
+
+ -- Overwise, allocate new shared string and fill data.
+
+ else
+ DR := Allocate (LR.Last + RR.Last);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (LR.Last + 1 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ DL : constant Natural := LR.Last + Right'Length;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Right is an empty string, return Left string.
+
+ elsif Right'Length = 0 then
+ Reference (LR);
+ DR := LR;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (LR.Last + 1 .. DL) := Right;
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ DL : constant Natural := Left'Length + RR.Last;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared one.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Left is empty string, return Right string.
+
+ elsif Left'Length = 0 then
+ Reference (RR);
+ DR := RR;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Left'Length) := Left;
+ DR.Data (Left'Length + 1 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ DL : constant Natural := LR.Last + 1;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ DR := Allocate (DL);
+ DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last);
+ DR.Data (DL) := Right;
+ DR.Last := DL;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ function "&"
+ (Left : Wide_Wide_Character;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ DL : constant Natural := 1 + RR.Last;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ DR := Allocate (DL);
+ DR.Data (1) := Left;
+ DR.Data (2 .. DL) := RR.Data (1 .. RR.Last);
+ DR.Last := DL;
+
+ return (AF.Controlled with Reference => DR);
+ end "&";
+
+ ---------
+ -- "*" --
+ ---------
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String
+ is
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if Left = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (Left);
+
+ for J in 1 .. Left loop
+ DR.Data (J) := Right;
+ end loop;
+
+ DR.Last := Left;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ DL : constant Natural := Left * Right'Length;
+ DR : Shared_Wide_Wide_String_Access;
+ K : Positive;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ K := 1;
+
+ for J in 1 .. Left loop
+ DR.Data (K .. K + Right'Length - 1) := Right;
+ K := K + Right'Length;
+ end loop;
+
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ function "*"
+ (Left : Natural;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ DL : constant Natural := Left * RR.Last;
+ DR : Shared_Wide_Wide_String_Access;
+ K : Positive;
+
+ begin
+ -- Result is an empty string, reuse shared empty string.
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Coefficient is one, just return string itself.
+
+ elsif Left = 1 then
+ Reference (RR);
+ DR := RR;
+
+ -- Otherwise, allocate new shared string and fill it.
+
+ else
+ DR := Allocate (DL);
+ K := 1;
+
+ for J in 1 .. Left loop
+ DR.Data (K .. K + RR.Last - 1) := RR.Data (1 .. RR.Last);
+ K := K + RR.Last;
+ end loop;
+
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end "*";
+
+ ---------
+ -- "<" --
+ ---------
+
+ function "<"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) < RR.Data (1 .. RR.Last);
+ end "<";
+
+ function "<"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) < Right;
+ end "<";
+
+ function "<"
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ begin
+ return Left < RR.Data (1 .. RR.Last);
+ end "<";
+
+ ----------
+ -- "<=" --
+ ----------
+
+ function "<="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+
+ begin
+ -- LR = RR means two strings shares shared string, thus they are equal
+
+ return LR = RR or else LR.Data (1 .. LR.Last) <= RR.Data (1 .. RR.Last);
+ end "<=";
+
+ function "<="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) <= Right;
+ end "<=";
+
+ function "<="
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ begin
+ return Left <= RR.Data (1 .. RR.Last);
+ end "<=";
+
+ ---------
+ -- "=" --
+ ---------
+
+ function "="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+
+ begin
+ return LR = RR or else LR.Data (1 .. LR.Last) = RR.Data (1 .. RR.Last);
+ -- LR = RR means two strings shares shared string, thus they are equal.
+ end "=";
+
+ function "="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) = Right;
+ end "=";
+
+ function "="
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ begin
+ return Left = RR.Data (1 .. RR.Last);
+ end "=";
+
+ ---------
+ -- ">" --
+ ---------
+
+ function ">"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) > RR.Data (1 .. RR.Last);
+ end ">";
+
+ function ">"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) > Right;
+ end ">";
+
+ function ">"
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ begin
+ return Left > RR.Data (1 .. RR.Last);
+ end ">";
+
+ ----------
+ -- ">=" --
+ ----------
+
+ function ">="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+
+ begin
+ -- LR = RR means two strings shares shared string, thus they are equal
+
+ return LR = RR or else LR.Data (1 .. LR.Last) >= RR.Data (1 .. RR.Last);
+ end ">=";
+
+ function ">="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean
+ is
+ LR : constant Shared_Wide_Wide_String_Access := Left.Reference;
+ begin
+ return LR.Data (1 .. LR.Last) >= Right;
+ end ">=";
+
+ function ">="
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean
+ is
+ RR : constant Shared_Wide_Wide_String_Access := Right.Reference;
+ begin
+ return Left >= RR.Data (1 .. RR.Last);
+ end ">=";
+
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Object : in out Unbounded_Wide_Wide_String) is
+ begin
+ Reference (Object.Reference);
+ end Adjust;
+
+ ------------------------
+ -- Aligned_Max_Length --
+ ------------------------
+
+ function Aligned_Max_Length (Max_Length : Natural) return Natural is
+ Static_Size : constant Natural :=
+ Empty_Shared_Wide_Wide_String'Size
+ / Standard'Storage_Unit;
+ -- Total size of all static components
+
+ Element_Size : constant Natural :=
+ Wide_Wide_Character'Size / Standard'Storage_Unit;
+
+ begin
+ return
+ (((Static_Size + Max_Length * Element_Size - 1) / Min_Mul_Alloc + 2)
+ * Min_Mul_Alloc - Static_Size) / Element_Size;
+ end Aligned_Max_Length;
+
+ --------------
+ -- Allocate --
+ --------------
+
+ function Allocate
+ (Max_Length : Natural) return Shared_Wide_Wide_String_Access is
+ begin
+ -- Empty string requested, return shared empty string
+
+ if Max_Length = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ return Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate requested space (and probably some more room)
+
+ else
+ return new Shared_Wide_Wide_String (Aligned_Max_Length (Max_Length));
+ end if;
+ end Allocate;
+
+ ------------
+ -- Append --
+ ------------
+
+ procedure Append
+ (Source : in out Unbounded_Wide_Wide_String;
+ New_Item : Unbounded_Wide_Wide_String)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ NR : constant Shared_Wide_Wide_String_Access := New_Item.Reference;
+ DL : constant Natural := SR.Last + NR.Last;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Source is an empty string, reuse New_Item data
+
+ if SR.Last = 0 then
+ Reference (NR);
+ Source.Reference := NR;
+ Unreference (SR);
+
+ -- New_Item is empty string, nothing to do
+
+ elsif NR.Last = 0 then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ procedure Append
+ (Source : in out Unbounded_Wide_Wide_String;
+ New_Item : Wide_Wide_String)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- New_Item is an empty string, nothing to do
+
+ if New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existing shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (SR.Last + 1 .. DL) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (SR.Last + 1 .. DL) := New_Item;
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ procedure Append
+ (Source : in out Unbounded_Wide_Wide_String;
+ New_Item : Wide_Wide_Character)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + 1;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Try to reuse existing shared string
+
+ if Can_Be_Reused (SR, SR.Last + 1) then
+ SR.Data (SR.Last + 1) := New_Item;
+ SR.Last := SR.Last + 1;
+
+ -- Otherwise, allocate new one and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (DL) := New_Item;
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Append;
+
+ -------------------
+ -- Can_Be_Reused --
+ -------------------
+
+ function Can_Be_Reused
+ (Item : Shared_Wide_Wide_String_Access;
+ Length : Natural) return Boolean
+ is
+ use Interfaces;
+ begin
+ return
+ Item.Counter = 1
+ and then Item.Max_Length >= Length
+ and then Item.Max_Length <=
+ Aligned_Max_Length (Length + Length / Growth_Factor);
+ end Can_Be_Reused;
+
+ -----------
+ -- Count --
+ -----------
+
+ function Count
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
+ Wide_Wide_Maps.Identity)
+ return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping);
+ end Count;
+
+ function Count
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping);
+ end Count;
+
+ function Count
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Count (SR.Data (1 .. SR.Last), Set);
+ end Count;
+
+ ------------
+ -- Delete --
+ ------------
+
+ function Delete
+ (Source : Unbounded_Wide_Wide_String;
+ From : Positive;
+ Through : Natural) return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Empty slice is deleted, use the same shared string
+
+ if From > Through then
+ Reference (SR);
+ DR := SR;
+
+ -- Index is out of range
+
+ elsif Through > SR.Last then
+ raise Index_Error;
+
+ -- Compute size of the result
+
+ else
+ DL := SR.Last - (Through - From + 1);
+
+ -- Result is an empty string, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1);
+ DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Delete;
+
+ procedure Delete
+ (Source : in out Unbounded_Wide_Wide_String;
+ From : Positive;
+ Through : Natural)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Nothing changed, return
+
+ if From > Through then
+ null;
+
+ -- Through is outside of the range
+
+ elsif Through > SR.Last then
+ raise Index_Error;
+
+ else
+ DL := SR.Last - (Through - From + 1);
+
+ -- Result is empty, reuse shared empty string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1);
+ DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Delete;
+
+ -------------
+ -- Element --
+ -------------
+
+ function Element
+ (Source : Unbounded_Wide_Wide_String;
+ Index : Positive) return Wide_Wide_Character
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ if Index <= SR.Last then
+ return SR.Data (Index);
+ else
+ raise Index_Error;
+ end if;
+ end Element;
+
+ --------------
+ -- Finalize --
+ --------------
+
+ procedure Finalize (Object : in out Unbounded_Wide_Wide_String) is
+ SR : constant Shared_Wide_Wide_String_Access := Object.Reference;
+
+ begin
+ if SR /= null then
+
+ -- The same controlled object can be finalized several times for
+ -- some reason. As per 7.6.1(24) this should have no ill effect,
+ -- so we need to add a guard for the case of finalizing the same
+ -- object twice.
+
+ Object.Reference := null;
+ Unreference (SR);
+ end if;
+ end Finalize;
+
+ ----------------
+ -- Find_Token --
+ ----------------
+
+ procedure Find_Token
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Test : Strings.Membership;
+ First : out Positive;
+ Last : out Natural)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ Wide_Wide_Search.Find_Token
+ (SR.Data (1 .. SR.Last), Set, Test, First, Last);
+ end Find_Token;
+
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (X : in out Wide_Wide_String_Access) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation
+ (Wide_Wide_String, Wide_Wide_String_Access);
+ begin
+ Deallocate (X);
+ end Free;
+
+ ----------
+ -- Head --
+ ----------
+
+ function Head
+ (Source : Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space)
+ return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Result is empty, reuse shared empty string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Length of the string is the same as requested, reuse source shared
+ -- string.
+
+ elsif Count = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ -- Length of the source string is more than requested, copy
+ -- corresponding slice.
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (1 .. Count);
+
+ -- Length of the source string is less then requested, copy all
+ -- contents and fill others by Pad character.
+
+ else
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+
+ for J in SR.Last + 1 .. Count loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Head;
+
+ procedure Head
+ (Source : in out Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Result is empty, reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ -- Result is same with source string, reuse source shared string
+
+ elsif Count = SR.Last then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, Count) then
+ if Count > SR.Last then
+ for J in SR.Last + 1 .. Count loop
+ SR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ SR.Last := Count;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ -- Length of the source string is greater then requested, copy
+ -- corresponding slice.
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (1 .. Count);
+
+ -- Length of the source string is less the requested, copy all
+ -- exists data and fill others by Pad character.
+
+ else
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+
+ for J in SR.Last + 1 .. Count loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Head;
+
+ -----------
+ -- Index --
+ -----------
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Going : Strings.Direction := Strings.Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
+ Wide_Wide_Maps.Identity)
+ return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Going : Direction := Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Test : Strings.Membership := Strings.Inside;
+ Going : Strings.Direction := Strings.Forward) return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index (SR.Data (1 .. SR.Last), Set, Test, Going);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
+ Wide_Wide_Maps.Identity)
+ return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping);
+ end Index;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ From : Positive;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index
+ (SR.Data (1 .. SR.Last), Set, From, Test, Going);
+ end Index;
+
+ ---------------------
+ -- Index_Non_Blank --
+ ---------------------
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_Wide_String;
+ Going : Strings.Direction := Strings.Forward) return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index_Non_Blank (SR.Data (1 .. SR.Last), Going);
+ end Index_Non_Blank;
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_Wide_String;
+ From : Positive;
+ Going : Direction := Forward) return Natural
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ begin
+ return Wide_Wide_Search.Index_Non_Blank
+ (SR.Data (1 .. SR.Last), From, Going);
+ end Index_Non_Blank;
+
+ ----------------
+ -- Initialize --
+ ----------------
+
+ procedure Initialize (Object : in out Unbounded_Wide_Wide_String) is
+ begin
+ Reference (Object.Reference);
+ end Initialize;
+
+ ------------
+ -- Insert --
+ ------------
+
+ function Insert
+ (Source : Unbounded_Wide_Wide_String;
+ Before : Positive;
+ New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Check index first
+
+ if Before > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Result is empty, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Inserted string is empty, reuse source shared string
+
+ elsif New_Item'Length = 0 then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1);
+ DR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ DR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Insert;
+
+ procedure Insert
+ (Source : in out Unbounded_Wide_Wide_String;
+ Before : Positive;
+ New_Item : Wide_Wide_String)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : constant Natural := SR.Last + New_Item'Length;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Before > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ -- Inserted string is empty, nothing to do
+
+ elsif New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existent shared string first
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ SR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL + DL / Growth_Factor);
+ DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1);
+ DR.Data (Before .. Before + New_Item'Length - 1) := New_Item;
+ DR.Data (Before + New_Item'Length .. DL) :=
+ SR.Data (Before .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Insert;
+
+ ------------
+ -- Length --
+ ------------
+
+ function Length (Source : Unbounded_Wide_Wide_String) return Natural is
+ begin
+ return Source.Reference.Last;
+ end Length;
+
+ ---------------
+ -- Overwrite --
+ ---------------
+
+ function Overwrite
+ (Source : Unbounded_Wide_Wide_String;
+ Position : Positive;
+ New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Position > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ DL := Integer'Max (SR.Last, Position + New_Item'Length - 1);
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Result is same with source string, reuse source shared string
+
+ elsif New_Item'Length = 0 then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1);
+ DR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ DR.Data (Position + New_Item'Length .. DL) :=
+ SR.Data (Position + New_Item'Length .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Overwrite;
+
+ procedure Overwrite
+ (Source : in out Unbounded_Wide_Wide_String;
+ Position : Positive;
+ New_Item : Wide_Wide_String)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Bounds check
+
+ if Position > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ DL := Integer'Max (SR.Last, Position + New_Item'Length - 1);
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ -- String unchanged, nothing to do
+
+ elsif New_Item'Length = 0 then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ SR.Last := DL;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1);
+ DR.Data (Position .. Position + New_Item'Length - 1) := New_Item;
+ DR.Data (Position + New_Item'Length .. DL) :=
+ SR.Data (Position + New_Item'Length .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Overwrite;
+
+ ---------------
+ -- Reference --
+ ---------------
+
+ procedure Reference (Item : not null Shared_Wide_Wide_String_Access) is
+ begin
+ Sync_Add_And_Fetch (Item.Counter'Access, 1);
+ end Reference;
+
+ ---------------------
+ -- Replace_Element --
+ ---------------------
+
+ procedure Replace_Element
+ (Source : in out Unbounded_Wide_Wide_String;
+ Index : Positive;
+ By : Wide_Wide_Character)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Bounds check.
+
+ if Index <= SR.Last then
+
+ -- Try to reuse existent shared string
+
+ if Can_Be_Reused (SR, SR.Last) then
+ SR.Data (Index) := By;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+ DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last);
+ DR.Data (Index) := By;
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ else
+ raise Index_Error;
+ end if;
+ end Replace_Element;
+
+ -------------------
+ -- Replace_Slice --
+ -------------------
+
+ function Replace_Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Do replace operation when removed slice is not empty
+
+ if High >= Low then
+ DL := By'Length + SR.Last + Low - High - 1;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1);
+ DR.Data (Low .. Low + By'Length - 1) := By;
+ DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+
+ -- Otherwise just insert string
+
+ else
+ return Insert (Source, Low, By);
+ end if;
+ end Replace_Slice;
+
+ procedure Replace_Slice
+ (Source : in out Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_Wide_String)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Bounds check
+
+ if Low > SR.Last + 1 then
+ raise Index_Error;
+ end if;
+
+ -- Do replace operation only when replaced slice is not empty
+
+ if High >= Low then
+ DL := By'Length + SR.Last + Low - High - 1;
+
+ -- Result is empty string, reuse empty shared string
+
+ if DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ SR.Data (Low .. Low + By'Length - 1) := By;
+ SR.Last := DL;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1);
+ DR.Data (Low .. Low + By'Length - 1) := By;
+ DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ -- Otherwise just insert item
+
+ else
+ Insert (Source, Low, By);
+ end if;
+ end Replace_Slice;
+
+ -------------------------------
+ -- Set_Unbounded_Wide_Wide_String --
+ -------------------------------
+
+ procedure Set_Unbounded_Wide_Wide_String
+ (Target : out Unbounded_Wide_Wide_String;
+ Source : Wide_Wide_String)
+ is
+ TR : constant Shared_Wide_Wide_String_Access := Target.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- In case of empty string, reuse empty shared string
+
+ if Source'Length = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Target.Reference := Empty_Shared_Wide_Wide_String'Access;
+
+ else
+ -- Try to reuse existent shared string
+
+ if Can_Be_Reused (TR, Source'Length) then
+ Reference (TR);
+ DR := TR;
+
+ -- Otherwise allocate new shared string
+
+ else
+ DR := Allocate (Source'Length);
+ Target.Reference := DR;
+ end if;
+
+ DR.Data (1 .. Source'Length) := Source;
+ DR.Last := Source'Length;
+ end if;
+
+ Unreference (TR);
+ end Set_Unbounded_Wide_Wide_String;
+
+ -----------
+ -- Slice --
+ -----------
+
+ function Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural) return Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+
+ begin
+ -- Note: test of High > Length is in accordance with AI95-00128
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ else
+ return SR.Data (Low .. High);
+ end if;
+ end Slice;
+
+ ----------
+ -- Tail --
+ ----------
+
+ function Tail
+ (Source : Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space)
+ return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- For empty result reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Result is hole source string, reuse source shared string
+
+ elsif Count = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last);
+
+ else
+ for J in 1 .. Count - SR.Last loop
+ DR.Data (J) := Pad;
+ end loop;
+
+ DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last);
+ end if;
+
+ DR.Last := Count;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Tail;
+
+ procedure Tail
+ (Source : in out Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ procedure Common
+ (SR : Shared_Wide_Wide_String_Access;
+ DR : Shared_Wide_Wide_String_Access;
+ Count : Natural);
+ -- Common code of tail computation. SR/DR can point to the same object
+
+ ------------
+ -- Common --
+ ------------
+
+ procedure Common
+ (SR : Shared_Wide_Wide_String_Access;
+ DR : Shared_Wide_Wide_String_Access;
+ Count : Natural) is
+ begin
+ if Count < SR.Last then
+ DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last);
+
+ else
+ DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last);
+
+ for J in 1 .. Count - SR.Last loop
+ DR.Data (J) := Pad;
+ end loop;
+ end if;
+
+ DR.Last := Count;
+ end Common;
+
+ begin
+ -- Result is empty string, reuse empty shared string
+
+ if Count = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ -- Length of the result is the same with length of the source string,
+ -- reuse source shared string.
+
+ elsif Count = SR.Last then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, Count) then
+ Common (SR, SR, Count);
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (Count);
+ Common (SR, DR, Count);
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Tail;
+
+ --------------------
+ -- To_Wide_Wide_String --
+ --------------------
+
+ function To_Wide_Wide_String
+ (Source : Unbounded_Wide_Wide_String) return Wide_Wide_String is
+ begin
+ return Source.Reference.Data (1 .. Source.Reference.Last);
+ end To_Wide_Wide_String;
+
+ ------------------------------
+ -- To_Unbounded_Wide_Wide_String --
+ ------------------------------
+
+ function To_Unbounded_Wide_Wide_String
+ (Source : Wide_Wide_String) return Unbounded_Wide_Wide_String
+ is
+ DR : constant Shared_Wide_Wide_String_Access := Allocate (Source'Length);
+ begin
+ DR.Data (1 .. Source'Length) := Source;
+ DR.Last := Source'Length;
+ return (AF.Controlled with Reference => DR);
+ end To_Unbounded_Wide_Wide_String;
+
+ function To_Unbounded_Wide_Wide_String
+ (Length : Natural) return Unbounded_Wide_Wide_String
+ is
+ DR : constant Shared_Wide_Wide_String_Access := Allocate (Length);
+ begin
+ DR.Last := Length;
+ return (AF.Controlled with Reference => DR);
+ end To_Unbounded_Wide_Wide_String;
+
+ ---------------
+ -- Translate --
+ ---------------
+
+ function Translate
+ (Source : Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
+ return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Nothing to translate, reuse empty shared string
+
+ if SR.Last = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Translate;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Nothing to translate
+
+ if SR.Last = 0 then
+ null;
+
+ -- Try to reuse shared string
+
+ elsif Can_Be_Reused (SR, SR.Last) then
+ for J in 1 .. SR.Last loop
+ SR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Value (Mapping, SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end Translate;
+
+ function Translate
+ (Source : Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Nothing to translate, reuse empty shared string
+
+ if SR.Last = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+
+ exception
+ when others =>
+ Unreference (DR);
+
+ raise;
+ end Translate;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Nothing to translate
+
+ if SR.Last = 0 then
+ null;
+
+ -- Try to reuse shared string
+
+ elsif Can_Be_Reused (SR, SR.Last) then
+ for J in 1 .. SR.Last loop
+ SR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ -- Otherwise allocate new shared string and fill it
+
+ else
+ DR := Allocate (SR.Last);
+
+ for J in 1 .. SR.Last loop
+ DR.Data (J) := Mapping.all (SR.Data (J));
+ end loop;
+
+ DR.Last := SR.Last;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+
+ exception
+ when others =>
+ if DR /= null then
+ Unreference (DR);
+ end if;
+
+ raise;
+ end Translate;
+
+ ----------
+ -- Trim --
+ ----------
+
+ function Trim
+ (Source : Unbounded_Wide_Wide_String;
+ Side : Trim_End) return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index_Non_Blank (Source, Forward);
+
+ -- All blanks, reuse empty shared string
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ else
+ case Side is
+ when Left =>
+ High := SR.Last;
+ DL := SR.Last - Low + 1;
+
+ when Right =>
+ Low := 1;
+ High := Index_Non_Blank (Source, Backward);
+ DL := High;
+
+ when Both =>
+ High := Index_Non_Blank (Source, Backward);
+ DL := High - Low + 1;
+ end case;
+
+ -- Length of the result is the same as length of the source string,
+ -- reuse source shared string.
+
+ if DL = SR.Last then
+ Reference (SR);
+ DR := SR;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Trim;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_Wide_String;
+ Side : Trim_End)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index_Non_Blank (Source, Forward);
+
+ -- All blanks, reuse empty shared string
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ else
+ case Side is
+ when Left =>
+ High := SR.Last;
+ DL := SR.Last - Low + 1;
+
+ when Right =>
+ Low := 1;
+ High := Index_Non_Blank (Source, Backward);
+ DL := High;
+
+ when Both =>
+ High := Index_Non_Blank (Source, Backward);
+ DL := High - Low + 1;
+ end case;
+
+ -- Length of the result is the same as length of the source string,
+ -- nothing to do.
+
+ if DL = SR.Last then
+ null;
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (1 .. DL) := SR.Data (Low .. High);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Trim;
+
+ function Trim
+ (Source : Unbounded_Wide_Wide_String;
+ Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Right : Wide_Wide_Maps.Wide_Wide_Character_Set)
+ return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index (Source, Left, Outside, Forward);
+
+ -- Source includes only characters from Left set, reuse empty shared
+ -- string.
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ else
+ High := Index (Source, Right, Outside, Backward);
+ DL := Integer'Max (0, High - Low + 1);
+
+ -- Source includes only characters from Right set or result string
+ -- is empty, reuse empty shared string.
+
+ if High = 0 or else DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Trim;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_Wide_String;
+ Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Right : Wide_Wide_Maps.Wide_Wide_Character_Set)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+ Low : Natural;
+ High : Natural;
+
+ begin
+ Low := Index (Source, Left, Outside, Forward);
+
+ -- Source includes only characters from Left set, reuse empty shared
+ -- string.
+
+ if Low = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ else
+ High := Index (Source, Right, Outside, Backward);
+ DL := Integer'Max (0, High - Low + 1);
+
+ -- Source includes only characters from Right set or result string
+ -- is empty, reuse empty shared string.
+
+ if High = 0 or else DL = 0 then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Source.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (SR);
+
+ -- Try to reuse existent shared string
+
+ elsif Can_Be_Reused (SR, DL) then
+ SR.Data (1 .. DL) := SR.Data (Low .. High);
+ SR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Source.Reference := DR;
+ Unreference (SR);
+ end if;
+ end if;
+ end Trim;
+
+ ---------------------
+ -- Unbounded_Slice --
+ ---------------------
+
+ function Unbounded_Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural) return Unbounded_Wide_Wide_String
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ -- Result is empty slice, reuse empty shared string
+
+ elsif Low > High then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ DR := Empty_Shared_Wide_Wide_String'Access;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DL := High - Low + 1;
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ end if;
+
+ return (AF.Controlled with Reference => DR);
+ end Unbounded_Slice;
+
+ procedure Unbounded_Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Target : out Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural)
+ is
+ SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+ TR : constant Shared_Wide_Wide_String_Access := Target.Reference;
+ DL : Natural;
+ DR : Shared_Wide_Wide_String_Access;
+
+ begin
+ -- Check bounds
+
+ if Low > SR.Last + 1 or else High > SR.Last then
+ raise Index_Error;
+
+ -- Result is empty slice, reuse empty shared string
+
+ elsif Low > High then
+ Reference (Empty_Shared_Wide_Wide_String'Access);
+ Target.Reference := Empty_Shared_Wide_Wide_String'Access;
+ Unreference (TR);
+
+ else
+ DL := High - Low + 1;
+
+ -- Try to reuse existent shared string
+
+ if Can_Be_Reused (TR, DL) then
+ TR.Data (1 .. DL) := SR.Data (Low .. High);
+ TR.Last := DL;
+
+ -- Otherwise, allocate new shared string and fill it
+
+ else
+ DR := Allocate (DL);
+ DR.Data (1 .. DL) := SR.Data (Low .. High);
+ DR.Last := DL;
+ Target.Reference := DR;
+ Unreference (TR);
+ end if;
+ end if;
+ end Unbounded_Slice;
+
+ -----------------
+ -- Unreference --
+ -----------------
+
+ procedure Unreference (Item : not null Shared_Wide_Wide_String_Access) is
+ use Interfaces;
+
+ procedure Free is
+ new Ada.Unchecked_Deallocation
+ (Shared_Wide_Wide_String, Shared_Wide_Wide_String_Access);
+
+ Aux : Shared_Wide_Wide_String_Access := Item;
+
+ begin
+ if Sync_Sub_And_Fetch (Aux.Counter'Access, 1) = 0 then
+
+ -- Reference counter of Empty_Shared_Wide_Wide_String must never
+ -- reach zero.
+
+ pragma Assert (Aux /= Empty_Shared_Wide_Wide_String'Access);
+
+ Free (Aux);
+ end if;
+ end Unreference;
+
+end Ada.Strings.Wide_Wide_Unbounded;
diff --git a/gcc/ada/a-stzunb-shared.ads b/gcc/ada/a-stzunb-shared.ads
new file mode 100644
index 00000000000..4617f56fdc2
--- /dev/null
+++ b/gcc/ada/a-stzunb-shared.ads
@@ -0,0 +1,501 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2009, 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This version is supported on:
+-- - all Alpha platforms
+-- - all ia64 platforms
+-- - all PowerPC platforms
+-- - all SPARC V9 platforms
+-- - all x86_64 platforms
+
+with Ada.Strings.Wide_Wide_Maps;
+private with Ada.Finalization;
+private with Interfaces;
+
+package Ada.Strings.Wide_Wide_Unbounded is
+ pragma Preelaborate;
+
+ type Unbounded_Wide_Wide_String is private;
+ pragma Preelaborable_Initialization (Unbounded_Wide_Wide_String);
+
+ Null_Unbounded_Wide_Wide_String : constant Unbounded_Wide_Wide_String;
+
+ function Length (Source : Unbounded_Wide_Wide_String) return Natural;
+
+ type Wide_Wide_String_Access is access all Wide_Wide_String;
+
+ procedure Free (X : in out Wide_Wide_String_Access);
+
+ --------------------------------------------------------
+ -- Conversion, Concatenation, and Selection Functions --
+ --------------------------------------------------------
+
+ function To_Unbounded_Wide_Wide_String
+ (Source : Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ function To_Unbounded_Wide_Wide_String
+ (Length : Natural) return Unbounded_Wide_Wide_String;
+
+ function To_Wide_Wide_String
+ (Source : Unbounded_Wide_Wide_String) return Wide_Wide_String;
+
+ procedure Set_Unbounded_Wide_Wide_String
+ (Target : out Unbounded_Wide_Wide_String;
+ Source : Wide_Wide_String);
+ pragma Ada_05 (Set_Unbounded_Wide_Wide_String);
+
+ procedure Append
+ (Source : in out Unbounded_Wide_Wide_String;
+ New_Item : Unbounded_Wide_Wide_String);
+
+ procedure Append
+ (Source : in out Unbounded_Wide_Wide_String;
+ New_Item : Wide_Wide_String);
+
+ procedure Append
+ (Source : in out Unbounded_Wide_Wide_String;
+ New_Item : Wide_Wide_Character);
+
+ function "&"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ function "&"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ function "&"
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ function "&"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String;
+
+ function "&"
+ (Left : Wide_Wide_Character;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ function Element
+ (Source : Unbounded_Wide_Wide_String;
+ Index : Positive) return Wide_Wide_Character;
+
+ procedure Replace_Element
+ (Source : in out Unbounded_Wide_Wide_String;
+ Index : Positive;
+ By : Wide_Wide_Character);
+
+ function Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural) return Wide_Wide_String;
+
+ function Unbounded_Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural) return Unbounded_Wide_Wide_String;
+ pragma Ada_05 (Unbounded_Slice);
+
+ procedure Unbounded_Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Target : out Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural);
+ pragma Ada_05 (Unbounded_Slice);
+
+ function "="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function "="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean;
+
+ function "="
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function "<"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function "<"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean;
+
+ function "<"
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function "<="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function "<="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean;
+
+ function "<="
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function ">"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function ">"
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean;
+
+ function ">"
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function ">="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ function ">="
+ (Left : Unbounded_Wide_Wide_String;
+ Right : Wide_Wide_String) return Boolean;
+
+ function ">="
+ (Left : Wide_Wide_String;
+ Right : Unbounded_Wide_Wide_String) return Boolean;
+
+ ------------------------
+ -- Search Subprograms --
+ ------------------------
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Going : Direction := Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
+ Wide_Wide_Maps.Identity)
+ return Natural;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Going : Direction := Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Natural;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural;
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
+ Wide_Wide_Maps.Identity)
+ return Natural;
+ pragma Ada_05 (Index);
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ From : Positive;
+ Going : Direction := Forward;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Natural;
+ pragma Ada_05 (Index);
+
+ function Index
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ From : Positive;
+ Test : Membership := Inside;
+ Going : Direction := Forward) return Natural;
+ pragma Ada_05 (Index);
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_Wide_String;
+ Going : Direction := Forward) return Natural;
+
+ function Index_Non_Blank
+ (Source : Unbounded_Wide_Wide_String;
+ From : Positive;
+ Going : Direction := Forward) return Natural;
+ pragma Ada_05 (Index_Non_Blank);
+
+ function Count
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
+ Wide_Wide_Maps.Identity)
+ return Natural;
+
+ function Count
+ (Source : Unbounded_Wide_Wide_String;
+ Pattern : Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Natural;
+
+ function Count
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
+
+ procedure Find_Token
+ (Source : Unbounded_Wide_Wide_String;
+ Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Test : Membership;
+ First : out Positive;
+ Last : out Natural);
+
+ ------------------------------------
+ -- String Translation Subprograms --
+ ------------------------------------
+
+ function Translate
+ (Source : Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
+ return Unbounded_Wide_Wide_String;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping);
+
+ function Translate
+ (Source : Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
+ return Unbounded_Wide_Wide_String;
+
+ procedure Translate
+ (Source : in out Unbounded_Wide_Wide_String;
+ Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function);
+
+ ---------------------------------------
+ -- String Transformation Subprograms --
+ ---------------------------------------
+
+ function Replace_Slice
+ (Source : Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ procedure Replace_Slice
+ (Source : in out Unbounded_Wide_Wide_String;
+ Low : Positive;
+ High : Natural;
+ By : Wide_Wide_String);
+
+ function Insert
+ (Source : Unbounded_Wide_Wide_String;
+ Before : Positive;
+ New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ procedure Insert
+ (Source : in out Unbounded_Wide_Wide_String;
+ Before : Positive;
+ New_Item : Wide_Wide_String);
+
+ function Overwrite
+ (Source : Unbounded_Wide_Wide_String;
+ Position : Positive;
+ New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ procedure Overwrite
+ (Source : in out Unbounded_Wide_Wide_String;
+ Position : Positive;
+ New_Item : Wide_Wide_String);
+
+ function Delete
+ (Source : Unbounded_Wide_Wide_String;
+ From : Positive;
+ Through : Natural) return Unbounded_Wide_Wide_String;
+
+ procedure Delete
+ (Source : in out Unbounded_Wide_Wide_String;
+ From : Positive;
+ Through : Natural);
+
+ function Trim
+ (Source : Unbounded_Wide_Wide_String;
+ Side : Trim_End) return Unbounded_Wide_Wide_String;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_Wide_String;
+ Side : Trim_End);
+
+ function Trim
+ (Source : Unbounded_Wide_Wide_String;
+ Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Right : Wide_Wide_Maps.Wide_Wide_Character_Set)
+ return Unbounded_Wide_Wide_String;
+
+ procedure Trim
+ (Source : in out Unbounded_Wide_Wide_String;
+ Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
+ Right : Wide_Wide_Maps.Wide_Wide_Character_Set);
+
+ function Head
+ (Source : Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space)
+ return Unbounded_Wide_Wide_String;
+
+ procedure Head
+ (Source : in out Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space);
+
+ function Tail
+ (Source : Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space)
+ return Unbounded_Wide_Wide_String;
+
+ procedure Tail
+ (Source : in out Unbounded_Wide_Wide_String;
+ Count : Natural;
+ Pad : Wide_Wide_Character := Wide_Wide_Space);
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String;
+
+ function "*"
+ (Left : Natural;
+ Right : Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+ function "*"
+ (Left : Natural;
+ Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String;
+
+private
+ pragma Inline (Length);
+
+ package AF renames Ada.Finalization;
+
+ type Shared_Wide_Wide_String (Max_Length : Natural) is limited record
+ Counter : aliased Interfaces.Unsigned_32 := 1;
+ -- Reference counter.
+
+ Last : Natural := 0;
+ Data : Wide_Wide_String (1 .. Max_Length);
+ -- Last is the index of last significant element of the Data. All
+ -- elements with larger indecies are just an extra room.
+ end record;
+
+ type Shared_Wide_Wide_String_Access is access all Shared_Wide_Wide_String;
+
+ procedure Reference (Item : not null Shared_Wide_Wide_String_Access);
+ -- Increment reference counter.
+
+ procedure Unreference (Item : not null Shared_Wide_Wide_String_Access);
+ -- Decrement reference counter. Deallocate Item when reference counter is
+ -- zero.
+
+ function Can_Be_Reused
+ (Item : Shared_Wide_Wide_String_Access;
+ Length : Natural) return Boolean;
+ -- Returns True if Shared_Wide_Wide_String can be reused. There are two
+ -- criteria when Shared_Wide_Wide_String can be reused: its reference
+ -- counter must be one (thus Shared_Wide_Wide_String is owned exclusively)
+ -- and its size is sufficient to store string with specified length
+ -- effectively.
+
+ function Allocate
+ (Max_Length : Natural) return Shared_Wide_Wide_String_Access;
+ -- Allocates new Shared_Wide_Wide_String with at least specified maximum
+ -- length. Actual maximum length of the allocated Shared_Wide_Wide_String
+ -- can be sligtly greater. Returns reference to
+ -- Empty_Shared_Wide_Wide_String when requested length is zero.
+
+ Empty_Shared_Wide_Wide_String : aliased Shared_Wide_Wide_String (0);
+
+ function To_Unbounded
+ (S : Wide_Wide_String) return Unbounded_Wide_Wide_String
+ renames To_Unbounded_Wide_Wide_String;
+ -- This renames are here only to be used in the pragma Stream_Convert.
+
+ type Unbounded_Wide_Wide_String is new AF.Controlled with record
+ Reference : Shared_Wide_Wide_String_Access :=
+ Empty_Shared_Wide_Wide_String'Access;
+ end record;
+
+ -- The Unbounded_Wide_Wide_String uses several techniques to increasy speed
+ -- of the application:
+ -- - implicit sharing or copy-on-write. Unbounded_Wide_Wide_String
+ -- contains only the reference to the data which is shared between
+ -- several instances. The shared data is reallocated only when its value
+ -- is changed and the object mutation can't be used or it is unefficient
+ -- to use it;
+ -- - object mutation. Shared data object can be reused without memory
+ -- reallocation when all of the following requirements are meat:
+ -- - shared data object don't used anywhere longer;
+ -- - its size is sufficient to store new value;
+ -- - the gap after reuse is less then some threashold.
+ -- - memory preallocation. Most of used memory allocation algorithms
+ -- alligns allocated segment on the some boundary, thus some amount of
+ -- additional memory can be preallocated without any impact. Such
+ -- preallocated memory can used later by Append/Insert operations
+ -- without reallocation.
+ --
+ -- Reference counting uses GCC builtin atomic operations, which allows to
+ -- safely share internal data between Ada tasks. Nevertheless, this not
+ -- make objects of Unbounded_Wide_Wide_String thread-safe, so each instance
+ -- can't be accessed by several tasks simulatenously.
+
+ pragma Stream_Convert
+ (Unbounded_Wide_Wide_String, To_Unbounded, To_Wide_Wide_String);
+ -- Provide stream routines without dragging in Ada.Streams
+
+ pragma Finalize_Storage_Only (Unbounded_Wide_Wide_String);
+ -- Finalization is required only for freeing storage
+
+ overriding procedure Initialize
+ (Object : in out Unbounded_Wide_Wide_String);
+ overriding procedure Adjust
+ (Object : in out Unbounded_Wide_Wide_String);
+ overriding procedure Finalize
+ (Object : in out Unbounded_Wide_Wide_String);
+
+ Null_Unbounded_Wide_Wide_String : constant Unbounded_Wide_Wide_String :=
+ (AF.Controlled with
+ Reference =>
+ Empty_Shared_Wide_Wide_String'Access);
+
+end Ada.Strings.Wide_Wide_Unbounded;
diff --git a/gcc/ada/a-suenco.adb b/gcc/ada/a-suenco.adb
new file mode 100755
index 00000000000..42b7f719a5b
--- /dev/null
+++ b/gcc/ada/a-suenco.adb
@@ -0,0 +1,390 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.UTF_ENCODING.CONVERSIONS --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2010, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body Ada.Strings.UTF_Encoding.Conversions is
+ use Interfaces;
+
+ -- Version convertion from UTF-8/UTF-16BE/LE to UTF-8/UTF-16BE/LE
+
+ function Convert
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String
+ is
+ begin
+ -- Nothing to do if identical schemes
+
+ if Input_Scheme = Output_Scheme then
+ return Item;
+
+ -- For remaining cases, one or other of the operands is UTF-16BE/LE
+ -- encoded, so go through UTF-16 intermediate.
+
+ else
+ return Convert (UTF_16_Wide_String'(Convert (Item, Input_Scheme)),
+ Output_Scheme, Output_BOM);
+ end if;
+ end Convert;
+
+ -- Version converting UTF-8/UTF-16BE/LE to UTF-16
+
+ function Convert
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String
+ is
+ begin
+ if Input_Scheme = UTF_8 then
+ return Convert (Item, Output_BOM);
+ else
+ return To_UTF_16 (Item, Input_Scheme, Output_BOM);
+ end if;
+ end Convert;
+
+ -- Version converting UTF-8 to UTF-16
+
+ function Convert
+ (Item : UTF_8_String;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String
+ is
+ Result : UTF_16_Wide_String (1 .. Item'Length + 1);
+ -- Maximum length of result, including possible BOM
+
+ Len : Natural := 0;
+ -- Number of characters stored so far in Result
+
+ Iptr : Natural;
+ -- Next character to process in Item
+
+ C : Unsigned_8;
+ -- Input UTF-8 code
+
+ R : Unsigned_16;
+ -- Output UTF-16 code
+
+ procedure Get_Continuation;
+ -- Reads a continuation byte of the form 10xxxxxx, shifts R left
+ -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On
+ -- return Ptr is incremented. Raises exceptioon if continuation
+ -- byte does not exist or is invalid.
+
+ ----------------------
+ -- Get_Continuation --
+ ----------------------
+
+ procedure Get_Continuation is
+ begin
+ if Iptr > Item'Last then
+ Raise_Encoding_Error (Iptr - 1);
+
+ else
+ C := To_Unsigned_8 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ if C < 2#10_000000# or else C > 2#10_111111# then
+ Raise_Encoding_Error (Iptr - 1);
+
+ else
+ R := Shift_Left (R, 6) or
+ Unsigned_16 (C and 2#00_111111#);
+ end if;
+ end if;
+ end Get_Continuation;
+
+ -- Start of processing for Convert
+
+ begin
+ -- Output BOM if required
+
+ if Output_BOM then
+ Len := Len + 1;
+ Result (Len) := BOM_16 (1);
+ end if;
+
+ -- Skip OK BOM
+
+ Iptr := Item'First;
+
+ if Item'Length >= 3 and then Item (Iptr .. Iptr + 2) = BOM_8 then
+ Iptr := Iptr + 3;
+
+ -- Error if bad BOM
+
+ elsif Item'Length >= 2
+ and then (Item (Iptr .. Iptr + 1) = BOM_16BE
+ or else
+ Item (Iptr .. Iptr + 1) = BOM_16LE)
+ then
+ Raise_Encoding_Error (Iptr);
+
+ -- No BOM present
+
+ else
+ Iptr := Item'First;
+ end if;
+
+ while Iptr <= Item'Last loop
+ C := To_Unsigned_8 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ -- Codes in the range 16#00# - 16#7F#
+ -- UTF-8: 0xxxxxxx
+ -- UTF-16: 00000000_0xxxxxxx
+
+ if C <= 16#7F# then
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (C);
+
+ -- No initial code can be of the form 10xxxxxx. Such codes are used
+ -- only for continuations.
+
+ elsif C <= 2#10_111111# then
+ Raise_Encoding_Error (Iptr - 1);
+
+ -- Codes in the range 16#80# - 16#7FF#
+ -- UTF-8: 110yyyxx 10xxxxxx
+ -- UTF-16: 00000yyy_xxxxxxxx
+
+ elsif C <= 2#110_11111# then
+ R := Unsigned_16 (C and 2#000_11111#);
+ Get_Continuation;
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (R);
+
+ -- Codes in the range 16#800# - 16#FFFF#
+ -- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx
+ -- UTF-16: yyyyyyyy_xxxxxxxx
+
+ elsif C <= 2#1110_1111# then
+ R := Unsigned_16 (C and 2#0000_1111#);
+ Get_Continuation;
+ Get_Continuation;
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (R);
+
+ -- Make sure that we don't have a result in the forbidden range
+ -- reserved for UTF-16 surrogate characters.
+
+ if R in 16#D800# .. 16#DF00# then
+ Raise_Encoding_Error (Iptr - 3);
+ end if;
+
+ -- Codes in the range 16#10000# - 16#10FFFF#
+ -- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
+ -- UTF-16: 110110zz_zzyyyyyy 110111yy_xxxxxxxx
+ -- Note: zzzz in the output is input zzzzz - 1
+
+ elsif C <= 2#11110_111# then
+ R := Unsigned_16 (C and 2#00000_111#);
+ Get_Continuation;
+
+ -- R now has zzzzzyyyy
+
+ R := R - 2#0000_1_0000#;
+
+ -- R now has zzzzyyyy (zzzz minus one for the output)
+
+ Get_Continuation;
+
+ -- R now has zzzzyyyyyyyyxx
+
+ Len := Len + 1;
+ Result (Len) :=
+ Wide_Character'Val
+ (2#110110_00_0000_0000# or Shift_Right (R, 4));
+
+ R := R and 2#1111#;
+ Get_Continuation;
+ Len := Len + 1;
+ Result (Len) :=
+ Wide_Character'Val (2#110111_00_0000_0000# or R);
+
+ -- Any other code is an error
+
+ else
+ Raise_Encoding_Error (Iptr - 1);
+ end if;
+ end loop;
+
+ return Result (1 .. Len);
+ end Convert;
+
+ -- Convert from UTF-16 to UTF-8/UTF-16-BE/LE
+
+ function Convert
+ (Item : UTF_16_Wide_String;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String
+ is
+ begin
+ if Output_Scheme = UTF_8 then
+ return Convert (Item, Output_BOM);
+ else
+ return From_UTF_16 (Item, Output_Scheme, Output_BOM);
+ end if;
+ end Convert;
+
+ -- Convert from UTF-16 to UTF-8
+
+ function Convert
+ (Item : UTF_16_Wide_String;
+ Output_BOM : Boolean := False) return UTF_8_String
+ is
+ Result : UTF_8_String (1 .. 3 * Item'Length + 3);
+ -- Worst case is 3 output codes for each input code + BOM space
+
+ Len : Natural;
+ -- Number of result codes stored
+
+ Iptr : Natural;
+ -- Pointer to next input character
+
+ C1, C2 : Unsigned_16;
+
+ zzzzz : Unsigned_16;
+ yyyyyyyy : Unsigned_16;
+ xxxxxxxx : Unsigned_16;
+ -- Components of double length case
+
+ begin
+ Iptr := Item'First;
+
+ -- Skip BOM at start of input
+
+ if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then
+ Iptr := Iptr + 1;
+ end if;
+
+ -- Generate output BOM if required
+
+ if Output_BOM then
+ Result (1 .. 3) := BOM_8;
+ Len := 3;
+ else
+ Len := 0;
+ end if;
+
+ -- Loop through input
+
+ while Iptr <= Item'Last loop
+ C1 := To_Unsigned_16 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ -- Codes in the range 16#0000# - 16#007F#
+ -- UTF-16: 000000000xxxxxxx
+ -- UTF-8: 0xxxxxxx
+
+ if C1 <= 16#007F# then
+ Result (Len + 1) := Character'Val (C1);
+ Len := Len + 1;
+
+ -- Codes in the range 16#80# - 16#7FF#
+ -- UTF-16: 00000yyyxxxxxxxx
+ -- UTF-8: 110yyyxx 10xxxxxx
+
+ elsif C1 <= 16#07FF# then
+ Result (Len + 1) :=
+ Character'Val
+ (2#110_000000# or Shift_Right (C1, 6));
+ Result (Len + 2) :=
+ Character'Val
+ (2#10_000000# or (C1 and 2#00_111111#));
+ Len := Len + 2;
+
+ -- Codes in the range 16#800# - 16#D7FF# or 16#E000# - 16#FFFF#
+ -- UTF-16: yyyyyyyyxxxxxxxx
+ -- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx
+
+ elsif C1 <= 16#D7FF# or else C1 >= 16#E000# then
+ Result (Len + 1) :=
+ Character'Val
+ (2#1110_0000# or Shift_Right (C1, 12));
+ Result (Len + 2) :=
+ Character'Val
+ (2#10_000000# or (Shift_Right (C1, 6) and 2#00_111111#));
+ Result (Len + 3) :=
+ Character'Val
+ (2#10_000000# or (C1 and 2#00_111111#));
+ Len := Len + 3;
+
+ -- Codes in the range 16#10000# - 16#10FFFF#
+ -- UTF-16: 110110zzzzyyyyyy 110111yyxxxxxxxx
+ -- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
+ -- Note: zzzzz in the output is input zzzz + 1
+
+ elsif C1 <= 2#110110_11_11111111# then
+ if Iptr > Item'Last then
+ Raise_Encoding_Error (Iptr - 1);
+ else
+ C2 := To_Unsigned_16 (Item (Iptr));
+ Iptr := Iptr + 1;
+ end if;
+
+ if (C2 and 2#111111_00_00000000#) /= 2#110111_00_00000000# then
+ Raise_Encoding_Error (Iptr - 1);
+ end if;
+
+ zzzzz := (Shift_Right (C1, 6) and 2#1111#) + 1;
+ yyyyyyyy := ((Shift_Left (C1, 2) and 2#111111_00#)
+ or
+ (Shift_Right (C2, 8) and 2#000000_11#));
+ xxxxxxxx := C2 and 2#11111111#;
+
+ Result (Len + 1) :=
+ Character'Val
+ (2#11110_000# or (Shift_Right (zzzzz, 2)));
+ Result (Len + 2) :=
+ Character'Val
+ (2#10_000000# or Shift_Left (zzzzz and 2#11#, 4)
+ or Shift_Right (yyyyyyyy, 4));
+ Result (Len + 3) :=
+ Character'Val
+ (2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 4)
+ or Shift_Right (xxxxxxxx, 6));
+ Result (Len + 4) :=
+ Character'Val
+ (2#10_000000# or (xxxxxxxx and 2#00_111111#));
+ Len := Len + 4;
+
+ -- Error if input in 16#DC00# - 16#DFFF# (2nd surrogate with no 1st)
+
+ else
+ Raise_Encoding_Error (Iptr - 2);
+ end if;
+ end loop;
+
+ return Result (1 .. Len);
+ end Convert;
+
+end Ada.Strings.UTF_Encoding.Conversions;
diff --git a/gcc/ada/a-suenco.ads b/gcc/ada/a-suenco.ads
new file mode 100755
index 00000000000..0aa4f88b20f
--- /dev/null
+++ b/gcc/ada/a-suenco.ads
@@ -0,0 +1,61 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.UTF_ENCODING.CONVERSIONS --
+-- --
+-- S p e c --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification, provided that if you redistribute a --
+-- modified version, any changes that you have made are clearly indicated. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is an Ada 2012 package defined in AI05-0137-1. It provides conversions
+-- from one UTF encoding method to another. Note: this package is consistent
+-- with Ada 95, and may be used in Ada 95 or Ada 2005 mode.
+
+package Ada.Strings.UTF_Encoding.Conversions is
+ pragma Pure (Conversions);
+
+ -- In the following conversion routines, a BOM in the input that matches
+ -- the encoding scheme is ignored, an incorrect BOM causes Encoding_Error
+ -- to be raised. A BOM is present in the output if the Output_BOM parameter
+ -- is set to True.
+
+ function Convert
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String;
+ -- Convert from input encoded in UTF-8, UTF-16LE, or UTF-16BE as specified
+ -- by the Input_Scheme argument, and generate an output encoded in one of
+ -- these three schemes as specified by the Output_Scheme argument.
+
+ function Convert
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String;
+ -- Convert from input encoded in UTF-8, UTF-16LE, or UTF-16BE as specified
+ -- by the Input_Scheme argument, and generate an output encoded in UTF-16.
+
+ function Convert
+ (Item : UTF_8_String;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String;
+ -- Convert from UTF-8 to UTF-16
+
+ function Convert
+ (Item : UTF_16_Wide_String;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String;
+ -- Convert from UTF-16 to UTF-8, UTF-16LE, or UTF-16BE as specified by
+ -- the Output_Scheme argument.
+
+ function Convert
+ (Item : UTF_16_Wide_String;
+ Output_BOM : Boolean := False) return UTF_8_String;
+ -- Convert from UTF-16 to UTF-8
+
+end Ada.Strings.UTF_Encoding.Conversions;
diff --git a/gcc/ada/a-suewen.adb b/gcc/ada/a-suewen.adb
new file mode 100755
index 00000000000..3cbebc83d3a
--- /dev/null
+++ b/gcc/ada/a-suewen.adb
@@ -0,0 +1,371 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_ENCODING --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2010, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body Ada.Strings.UTF_Encoding.Wide_Encoding is
+ use Interfaces;
+
+ ------------
+ -- Decode --
+ ------------
+
+ -- Version to decode UTF-8/UTF-16BE/UTF-16LE input to Wide_String
+
+ function Decode
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme) return Wide_String
+ is
+ begin
+ if Input_Scheme = UTF_8 then
+ return Decode (Item);
+ else
+ return Decode (To_UTF_16 (Item, Input_Scheme));
+ end if;
+ end Decode;
+
+ -- Decode UTF-8 input to Wide_String
+
+ function Decode (Item : UTF_8_String) return Wide_String is
+ Result : Wide_String (1 .. Item'Length);
+ -- Result string (worst case is same length as input)
+
+ Len : Natural := 0;
+ -- Length of result stored so far
+
+ Iptr : Natural;
+ -- Input Item pointer
+
+ C : Unsigned_8;
+ R : Unsigned_16;
+
+ procedure Get_Continuation;
+ -- Reads a continuation byte of the form 10xxxxxx, shifts R left
+ -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On
+ -- return Ptr is incremented. Raises exceptioon if continuation
+ -- byte does not exist or is invalid.
+
+ ----------------------
+ -- Get_Continuation --
+ ----------------------
+
+ procedure Get_Continuation is
+ begin
+ if Iptr > Item'Last then
+ Raise_Encoding_Error (Iptr - 1);
+
+ else
+ C := To_Unsigned_8 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ if C not in 2#10_000000# .. 2#10_111111# then
+ Raise_Encoding_Error (Iptr - 1);
+ else
+ R := Shift_Left (R, 6) or Unsigned_16 (C and 2#00_111111#);
+ end if;
+ end if;
+ end Get_Continuation;
+
+ -- Start of processing for Decode
+
+ begin
+ Iptr := Item'First;
+
+ -- Skip BOM at start
+
+ if Item'Length >= 3
+ and then Item (Iptr .. Iptr + 2) = BOM_8
+ then
+ Iptr := Iptr + 3;
+
+ -- Error if bad BOM
+
+ elsif Item'Length >= 2
+ and then (Item (Iptr .. Iptr + 1) = BOM_16BE
+ or else
+ Item (Iptr .. Iptr + 1) = BOM_16LE)
+ then
+ Raise_Encoding_Error (Iptr);
+ end if;
+
+ while Iptr <= Item'Last loop
+ C := To_Unsigned_8 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ -- Codes in the range 16#00# - 16#7F# are represented as
+ -- 0xxxxxxx
+
+ if C <= 16#7F# then
+ R := Unsigned_16 (C);
+
+ -- No initial code can be of the form 10xxxxxx. Such codes are used
+ -- only for continuations.
+
+ elsif C <= 2#10_111111# then
+ Raise_Encoding_Error (Iptr - 1);
+
+ -- Codes in the range 16#80# - 16#7FF# are represented as
+ -- 110yyyxx 10xxxxxx
+
+ elsif C <= 2#110_11111# then
+ R := Unsigned_16 (C and 2#000_11111#);
+ Get_Continuation;
+
+ -- Codes in the range 16#800# - 16#FFFF# are represented as
+ -- 1110yyyy 10yyyyxx 10xxxxxx
+
+ elsif C <= 2#1110_1111# then
+ R := Unsigned_16 (C and 2#0000_1111#);
+ Get_Continuation;
+ Get_Continuation;
+
+ -- Codes in the range 16#10000# - 16#10FFFF# are represented as
+ -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
+
+ -- Such codes are out of range for Wide_String output
+
+ else
+ Raise_Encoding_Error (Iptr - 1);
+ end if;
+
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (R);
+ end loop;
+
+ return Result (1 .. Len);
+ end Decode;
+
+ -- Decode UTF-16 input to Wide_String
+
+ function Decode (Item : UTF_16_Wide_String) return Wide_String is
+ Result : Wide_String (1 .. Item'Length);
+ -- Result is same length as input (possibly minus 1 if BOM present)
+
+ Len : Natural := 0;
+ -- Length of result
+
+ Iptr : Natural;
+ -- Index of next Item element
+
+ C : Unsigned_16;
+
+ begin
+ -- Skip UTF-16 BOM at start
+
+ Iptr := Item'First;
+
+ if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then
+ Iptr := Iptr + 1;
+ end if;
+
+ -- Loop through input characters
+
+ while Iptr <= Item'Last loop
+ C := To_Unsigned_16 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ -- Codes in the range 16#0000#..16#D7FF# or 16#E000#..16#FFFD#
+ -- represent their own value.
+
+ if C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (C);
+
+ -- Codes in the range 16#D800#..16#DBFF# represent the first of the
+ -- two surrogates used to encode the range 16#01_000#..16#10_FFFF".
+ -- Such codes are out of range for 16-bit output.
+
+ -- The case of input in the range 16#DC00#..16#DFFF# must never
+ -- occur, since it means we have a second surrogate character with
+ -- no corresponding first surrogate.
+
+ -- Codes in the range 16#FFFE# .. 16#FFFF# are also invalid since
+ -- they conflict with codes used for BOM values.
+
+ -- Thus all remaining codes are invalid
+
+ else
+ Raise_Encoding_Error (Iptr - 1);
+ end if;
+ end loop;
+
+ return Result (1 .. Len);
+ end Decode;
+
+ ------------
+ -- Encode --
+ ------------
+
+ -- Encode Wide_String in UTF-8, UTF-16BE or UTF-16LE
+
+ function Encode
+ (Item : Wide_String;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String
+ is
+ begin
+ -- Case of UTF_8
+
+ if Output_Scheme = UTF_8 then
+ return Encode (Item, Output_BOM);
+
+ -- Case of UTF_16LE or UTF_16BE, use UTF-16 intermediary
+
+ else
+ return From_UTF_16 (UTF_16_Wide_String'(Encode (Item)),
+ Output_Scheme, Output_BOM);
+ end if;
+ end Encode;
+
+ -- Encode Wide_String in UTF-8
+
+ function Encode
+ (Item : Wide_String;
+ Output_BOM : Boolean := False) return UTF_8_String
+ is
+ Result : UTF_8_String (1 .. 3 * Item'Length + 3);
+ -- Worst case is three bytes per input byte + space for BOM
+
+ Len : Natural;
+ -- Number of output codes stored in Result
+
+ C : Unsigned_16;
+ -- Single input character
+
+ procedure Store (C : Unsigned_16);
+ pragma Inline (Store);
+ -- Store one output code, C is in the range 0 .. 255
+
+ -----------
+ -- Store --
+ -----------
+
+ procedure Store (C : Unsigned_16) is
+ begin
+ Len := Len + 1;
+ Result (Len) := Character'Val (C);
+ end Store;
+
+ -- Start of processing for UTF8_Encode
+
+ begin
+ -- Output BOM if required
+
+ if Output_BOM then
+ Result (1 .. 3) := BOM_8;
+ Len := 3;
+ else
+ Len := 0;
+ end if;
+
+ -- Loop through characters of input
+
+ for J in Item'Range loop
+ C := To_Unsigned_16 (Item (J));
+
+ -- Codes in the range 16#00# - 16#7F# are represented as
+ -- 0xxxxxxx
+
+ if C <= 16#7F# then
+ Store (C);
+
+ -- Codes in the range 16#80# - 16#7FF# are represented as
+ -- 110yyyxx 10xxxxxx
+
+ elsif C <= 16#7FF# then
+ Store (2#110_00000# or Shift_Right (C, 6));
+ Store (2#10_000000# or (C and 2#00_111111#));
+
+ -- Codes in the range 16#800# - 16#FFFF# are represented as
+ -- 1110yyyy 10yyyyxx 10xxxxxx
+
+ else
+ Store (2#1110_0000# or Shift_Right (C, 12));
+ Store (2#10_000000# or
+ Shift_Right (C and 2#111111_000000#, 6));
+ Store (2#10_000000# or (C and 2#00_111111#));
+ end if;
+ end loop;
+
+ return Result (1 .. Len);
+ end Encode;
+
+ -- Encode Wide_String in UTF-16
+
+ function Encode
+ (Item : Wide_String;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String
+ is
+ Result : Wide_String (1 .. Item'Length + Boolean'Pos (Output_BOM));
+ -- Output is same length as input + possible BOM
+
+ Len : Integer;
+ -- Length of output string
+
+ C : Unsigned_16;
+
+ begin
+ -- Output BOM if required
+
+ if Output_BOM then
+ Result (1) := BOM_16 (1);
+ Len := 1;
+ else
+ Len := 0;
+ end if;
+
+ -- Loop through input characters encoding them
+
+ for Iptr in Item'Range loop
+ C := To_Unsigned_16 (Item (Iptr));
+
+ -- Codes in the range 16#0000#..16#D7FF# or 16#E000#..16#FFFD# are
+ -- output unchaned.
+
+ if C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (C);
+
+ -- Codes in tne range 16#D800#..16#DFFF# should never appear in the
+ -- input, since no valid Unicode characters are in this range (which
+ -- would conflict with the UTF-16 surrogate encodings). Similarly
+ -- codes in the range 16#FFFE#..16#FFFF conflict with BOM codes.
+ -- Thus all remaining codes are illegal.
+
+ else
+ Raise_Encoding_Error (Iptr);
+ end if;
+ end loop;
+
+ return Result;
+ end Encode;
+
+end Ada.Strings.UTF_Encoding.Wide_Encoding;
diff --git a/gcc/ada/a-suewen.ads b/gcc/ada/a-suewen.ads
new file mode 100755
index 00000000000..bae9e148447
--- /dev/null
+++ b/gcc/ada/a-suewen.ads
@@ -0,0 +1,67 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_ENCODING --
+-- --
+-- S p e c --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification, provided that if you redistribute a --
+-- modified version, any changes that you have made are clearly indicated. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding
+-- and decoding Wide_String values using UTF encodings. Note: this package is
+-- consistent with Ada 95, and may be included in Ada 95 implementations.
+
+package Ada.Strings.UTF_Encoding.Wide_Encoding is
+ pragma Pure (Wide_Encoding);
+
+ -- The encoding routines take a Wide_String as input and encode the result
+ -- using the specified UTF encoding method. The result includes a BOM if
+ -- the Output_BOM argument is set to True. Encoding_Error is raised if an
+ -- invalid character appears in the input. In particular the characters
+ -- in the range 16#D800# .. 16#DFFF# are invalid because they conflict
+ -- with UTF-16 surrogate encodings, and the characters 16#FFFE# and
+ -- 16#FFFF# are also invalid because they conflict with BOM codes.
+
+ function Encode
+ (Item : Wide_String;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String;
+ -- Encode Wide_String using UTF-8, UTF-16LE or UTF-16BE encoding as
+ -- specified by the Output_Scheme parameter.
+
+ function Encode
+ (Item : Wide_String;
+ Output_BOM : Boolean := False) return UTF_8_String;
+ -- Encode Wide_String using UTF-8 encoding
+
+ function Encode
+ (Item : Wide_String;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String;
+ -- Encode Wide_String using UTF_16 encoding
+
+ -- The decoding routines take a UTF String as input, and return a decoded
+ -- Wide_String. If the UTF String starts with a BOM that matches the
+ -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error.
+
+ function Decode
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme) return Wide_String;
+ -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the
+ -- Input_Scheme parameter. It is decoded and returned as a Wide_String
+ -- value. Note: a convenient form for scheme may be Encoding (UTF_String).
+
+ function Decode
+ (Item : UTF_8_String) return Wide_String;
+ -- The input is encoded in UTF-8 and returned as a Wide_String value
+
+ function Decode
+ (Item : UTF_16_Wide_String) return Wide_String;
+ -- The input is encoded in UTF-16 and returned as a Wide_String value
+
+end Ada.Strings.UTF_Encoding.Wide_Encoding;
diff --git a/gcc/ada/a-suezen.adb b/gcc/ada/a-suezen.adb
new file mode 100755
index 00000000000..972fbf061e8
--- /dev/null
+++ b/gcc/ada/a-suezen.adb
@@ -0,0 +1,431 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_ENCODING --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2010, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body Ada.Strings.UTF_Encoding.Wide_Wide_Encoding is
+ use Interfaces;
+
+ ------------
+ -- Decode --
+ ------------
+
+ -- Version to decode UTF-8/UTF-16BE/UTF-16LE input to Wide_Wide_String
+
+ function Decode
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme) return Wide_Wide_String
+ is
+ begin
+ if Input_Scheme = UTF_8 then
+ return Decode (Item);
+ else
+ return Decode (To_UTF_16 (Item, Input_Scheme));
+ end if;
+ end Decode;
+
+ -- Decode UTF-8 input to Wide_Wide_String
+
+ function Decode (Item : UTF_8_String) return Wide_Wide_String is
+ Result : Wide_Wide_String (1 .. Item'Length);
+ -- Result string (worst case is same length as input)
+
+ Len : Natural := 0;
+ -- Length of result stored so far
+
+ Iptr : Natural;
+ -- Input string pointer
+
+ C : Unsigned_8;
+ R : Unsigned_32;
+
+ procedure Get_Continuation;
+ -- Reads a continuation byte of the form 10xxxxxx, shifts R left
+ -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On
+ -- return Ptr is incremented. Raises exceptioon if continuation
+ -- byte does not exist or is invalid.
+
+ ----------------------
+ -- Get_Continuation --
+ ----------------------
+
+ procedure Get_Continuation is
+ begin
+ if Iptr > Item'Last then
+ Raise_Encoding_Error (Iptr - 1);
+
+ else
+ C := To_Unsigned_8 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ if C not in 2#10_000000# .. 2#10_111111# then
+ Raise_Encoding_Error (Iptr - 1);
+ else
+ R := Shift_Left (R, 6) or Unsigned_32 (C and 2#00_111111#);
+ end if;
+ end if;
+ end Get_Continuation;
+
+ -- Start of processing for Decode
+
+ begin
+ Iptr := Item'First;
+
+ -- Skip BOM at start
+
+ if Item'Length >= 3
+ and then Item (Iptr .. Iptr + 2) = BOM_8
+ then
+ Iptr := Iptr + 3;
+
+ -- Error if bad BOM
+
+ elsif Item'Length >= 2
+ and then (Item (Iptr .. Iptr + 1) = BOM_16BE
+ or else
+ Item (Iptr .. Iptr + 1) = BOM_16LE)
+ then
+ Raise_Encoding_Error (Iptr);
+ end if;
+
+ -- Loop through input characters
+
+ while Iptr <= Item'Last loop
+ C := To_Unsigned_8 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ -- Codes in the range 16#00# - 16#7F# are represented as
+ -- 0xxxxxxx
+
+ if C <= 16#7F# then
+ R := Unsigned_32 (C);
+
+ -- No initial code can be of the form 10xxxxxx. Such codes are used
+ -- only for continuations.
+
+ elsif C <= 2#10_111111# then
+ Raise_Encoding_Error (Iptr - 1);
+
+ -- Codes in the range 16#80# - 16#7FF# are represented as
+ -- 110yyyxx 10xxxxxx
+
+ elsif C <= 2#110_11111# then
+ R := Unsigned_32 (C and 2#000_11111#);
+ Get_Continuation;
+
+ -- Codes in the range 16#800# - 16#FFFF# are represented as
+ -- 1110yyyy 10yyyyxx 10xxxxxx
+
+ elsif C <= 2#1110_1111# then
+ R := Unsigned_32 (C and 2#0000_1111#);
+ Get_Continuation;
+ Get_Continuation;
+
+ -- Codes in the range 16#10000# - 16#10FFFF# are represented as
+ -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
+
+ elsif C <= 2#11110_111# then
+ R := Unsigned_32 (C and 2#00000_111#);
+ Get_Continuation;
+ Get_Continuation;
+ Get_Continuation;
+
+ -- Any other code is an error
+
+ else
+ Raise_Encoding_Error (Iptr - 1);
+ end if;
+
+ Len := Len + 1;
+ Result (Len) := Wide_Wide_Character'Val (R);
+ end loop;
+
+ return Result (1 .. Len);
+ end Decode;
+
+ -- Decode UTF-16 input to Wide_Wide_String
+
+ function Decode (Item : UTF_16_Wide_String) return Wide_Wide_String is
+ Result : Wide_Wide_String (1 .. Item'Length);
+ -- Result cannot be longer than the input string
+
+ Len : Natural := 0;
+ -- Length of result
+
+ Iptr : Natural;
+ -- Pointer to next element in Item
+
+ C : Unsigned_16;
+ R : Unsigned_32;
+
+ begin
+ -- Skip UTF-16 BOM at start
+
+ Iptr := Item'First;
+
+ if Iptr <= Item'Last and then Item (Iptr) = BOM_16 (1) then
+ Iptr := Iptr + 1;
+ end if;
+
+ -- Loop through input characters
+
+ while Iptr <= Item'Last loop
+ C := To_Unsigned_16 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ -- Codes in the range 16#0000#..16#D7FF# or 16#E000#..16#FFFD#
+ -- represent their own value.
+
+ if C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then
+ Len := Len + 1;
+ Result (Len) := Wide_Wide_Character'Val (C);
+
+ -- Codes in the range 16#D800#..16#DBFF# represent the first of the
+ -- two surrogates used to encode the range 16#01_000#..16#10_FFFF".
+ -- The first surrogate provides 10 high order bits of the result.
+
+ elsif C <= 16#DBFF# then
+ R := Shift_Left ((Unsigned_32 (C) - 16#D800#), 10);
+
+ -- Error if at end of string
+
+ if Iptr > Item'Last then
+ Raise_Encoding_Error (Iptr - 1);
+
+ -- Otherwise next character must be valid low order surrogate
+ -- which provides the low 10 order bits of the result.
+
+ else
+ C := To_Unsigned_16 (Item (Iptr));
+ Iptr := Iptr + 1;
+
+ if C not in 16#DC00# .. 16#DFFF# then
+ Raise_Encoding_Error (Iptr - 1);
+
+ else
+ R := R or (Unsigned_32 (C) mod 2 ** 10);
+
+ -- The final adjustment is to add 16#01_0000 to get the
+ -- result back in the required 21 bit range.
+
+ R := R + 16#01_0000#;
+ Len := Len + 1;
+ Result (Len) := Wide_Wide_Character'Val (R);
+ end if;
+ end if;
+
+ -- Remaining codes are invalid
+
+ else
+ Raise_Encoding_Error (Iptr - 1);
+ end if;
+ end loop;
+
+ return Result (1 .. Len);
+ end Decode;
+
+ ------------
+ -- Encode --
+ ------------
+
+ -- Encode Wide_Wide_String in UTF-8, UTF-16BE or UTF-16LE
+
+ function Encode
+ (Item : Wide_Wide_String;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String
+ is
+ begin
+ if Output_Scheme = UTF_8 then
+ return Encode (Item, Output_BOM);
+ else
+ return From_UTF_16 (Encode (Item), Output_Scheme, Output_BOM);
+ end if;
+ end Encode;
+
+ -- Encode Wide_Wide_String in UTF-8
+
+ function Encode
+ (Item : Wide_Wide_String;
+ Output_BOM : Boolean := False) return UTF_8_String
+ is
+ Result : String (1 .. 4 * Item'Length + 3);
+ -- Worst case is four bytes per input byte + space for BOM
+
+ Len : Natural;
+ -- Number of output codes stored in Result
+
+ C : Unsigned_32;
+ -- Single input character
+
+ procedure Store (C : Unsigned_32);
+ pragma Inline (Store);
+ -- Store one output code (input is in range 0 .. 255)
+
+ -----------
+ -- Store --
+ -----------
+
+ procedure Store (C : Unsigned_32) is
+ begin
+ Len := Len + 1;
+ Result (Len) := Character'Val (C);
+ end Store;
+
+ -- Start of processing for Encode
+
+ begin
+ -- Output BOM if required
+
+ if Output_BOM then
+ Result (1 .. 3) := BOM_8;
+ Len := 3;
+ else
+ Len := 0;
+ end if;
+
+ -- Loop through characters of input
+
+ for Iptr in Item'Range loop
+ C := To_Unsigned_32 (Item (Iptr));
+
+ -- Codes in the range 16#00#..16#7F# are represented as
+ -- 0xxxxxxx
+
+ if C <= 16#7F# then
+ Store (C);
+
+ -- Codes in the range 16#80#..16#7FF# are represented as
+ -- 110yyyxx 10xxxxxx
+
+ elsif C <= 16#7FF# then
+ Store (2#110_00000# or Shift_Right (C, 6));
+ Store (2#10_000000# or (C and 2#00_111111#));
+
+ -- Codes in the range 16#800#..16#D7FF# or 16#E000#..16#FFFD# are
+ -- represented as
+ -- 1110yyyy 10yyyyxx 10xxxxxx
+
+ elsif C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then
+ Store (2#1110_0000# or Shift_Right (C, 12));
+ Store (2#10_000000# or
+ Shift_Right (C and 2#111111_000000#, 6));
+ Store (2#10_000000# or (C and 2#00_111111#));
+
+ -- Codes in the range 16#10000# - 16#10FFFF# are represented as
+ -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
+
+ elsif C in 16#1_0000# .. 16#10_FFFF# then
+ Store (2#11110_000# or
+ Shift_Right (C, 18));
+ Store (2#10_000000# or
+ Shift_Right (C and 2#111111_000000_000000#, 12));
+ Store (2#10_000000# or
+ Shift_Right (C and 2#111111_000000#, 6));
+ Store (2#10_000000# or
+ (C and 2#00_111111#));
+
+ -- All other codes are invalid
+
+ else
+ Raise_Encoding_Error (Iptr);
+ end if;
+ end loop;
+
+ return Result (1 .. Len);
+ end Encode;
+
+ -- Encode Wide_Wide_String in UTF-16
+
+ function Encode
+ (Item : Wide_Wide_String;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String
+ is
+ Result : Wide_String (1 .. 2 * Item'Length + 1);
+ -- Worst case is each input character generates two output characters
+ -- plus one for possible BOM.
+
+ Len : Integer;
+ -- Length of output string
+
+ C : Unsigned_32;
+
+ begin
+ -- Output BOM if needed
+
+ if Output_BOM then
+ Result (1) := BOM_16 (1);
+ Len := 1;
+ else
+ Len := 0;
+ end if;
+
+ -- Loop through input characters encoding them
+
+ for Iptr in Item'Range loop
+ C := To_Unsigned_32 (Item (Iptr));
+
+ -- Codes in the range 16#00_0000#..16#00_D7FF# or 16#E000#..16#FFFD#
+ -- are output unchanged
+
+ if C <= 16#00_D7FF# or else C in 16#E000# .. 16#FFFD# then
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (C);
+
+ -- Codes in the range 16#01_0000#..16#10_FFFF# are output using two
+ -- surrogate characters. First 16#1_0000# is subtracted from the code
+ -- point to give a 20-bit value. This is then split into two separate
+ -- 10-bit values each of which is represented as a surrogate with the
+ -- most significant half placed in the first surrogate. The ranges of
+ -- values used for the two surrogates are 16#D800#-16#DBFF# for the
+ -- first, most significant surrogate and 16#DC00#-16#DFFF# for the
+ -- second, least significant surrogate.
+
+ elsif C in 16#1_0000# .. 16#10_FFFF# then
+ C := C - 16#1_0000#;
+
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (16#D800# + C / 2 ** 10);
+
+ Len := Len + 1;
+ Result (Len) := Wide_Character'Val (16#DC00# + C mod 2 ** 10);
+
+ -- All other codes are invalid
+
+ else
+ Raise_Encoding_Error (Iptr);
+ end if;
+ end loop;
+
+ return Result (1 .. Len);
+ end Encode;
+
+end Ada.Strings.UTF_Encoding.Wide_Wide_Encoding;
diff --git a/gcc/ada/a-suezen.ads b/gcc/ada/a-suezen.ads
new file mode 100755
index 00000000000..7d2a91d2b25
--- /dev/null
+++ b/gcc/ada/a-suezen.ads
@@ -0,0 +1,64 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_ENCODING --
+-- --
+-- S p e c --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification, provided that if you redistribute a --
+-- modified version, any changes that you have made are clearly indicated. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding
+-- and decoding Wide_String values using UTF encodings. Note: this package is
+-- consistent with Ada 2005, and may be used in Ada 2005 mode, but cannot be
+-- used in Ada 95 mode, since Wide_Wide_Character is an Ada 2005 feature.
+
+package Ada.Strings.UTF_Encoding.Wide_Wide_Encoding is
+ pragma Pure (Wide_Wide_Encoding);
+
+ -- The encoding routines take a Wide_Wide_String as input and encode the
+ -- result using the specified UTF encoding method. The result includes a
+ -- BOM if the Output_BOM parameter is set to True.
+
+ function Encode
+ (Item : Wide_Wide_String;
+ Output_Scheme : Encoding_Scheme;
+ Output_BOM : Boolean := False) return UTF_String;
+ -- Encode Wide_Wide_String using UTF-8, UTF-16LE or UTF-16BE encoding as
+ -- specified by the Output_Scheme parameter.
+
+ function Encode
+ (Item : Wide_Wide_String;
+ Output_BOM : Boolean := False) return UTF_8_String;
+ -- Encode Wide_Wide_String using UTF-8 encoding
+
+ function Encode
+ (Item : Wide_Wide_String;
+ Output_BOM : Boolean := False) return UTF_16_Wide_String;
+ -- Encode Wide_Wide_String using UTF_16 encoding
+
+ -- The decoding routines take a UTF String as input, and return a decoded
+ -- Wide_String. If the UTF String starts with a BOM that matches the
+ -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error.
+
+ function Decode
+ (Item : UTF_String;
+ Input_Scheme : Encoding_Scheme) return Wide_Wide_String;
+ -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the
+ -- Input_Scheme parameter. It is decoded and returned as a Wide_Wide_String
+ -- value. Note: a convenient form for Scheme may be Encoding (UTF_String).
+
+ function Decode
+ (Item : UTF_8_String) return Wide_Wide_String;
+ -- The input is encoded in UTF-8 and returned as a Wide_Wide_String value
+
+ function Decode
+ (Item : UTF_16_Wide_String) return Wide_Wide_String;
+ -- The input is encoded in UTF-16 and returned as a Wide_String value
+
+end Ada.Strings.UTF_Encoding.Wide_Wide_Encoding;
diff --git a/gcc/ada/a-suteio-shared.adb b/gcc/ada/a-suteio-shared.adb
new file mode 100644
index 00000000000..d50ed776775
--- /dev/null
+++ b/gcc/ada/a-suteio-shared.adb
@@ -0,0 +1,132 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . U N B O U N D E D . T E X T _ I O --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1997-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Text_IO; use Ada.Text_IO;
+
+package body Ada.Strings.Unbounded.Text_IO is
+
+ --------------
+ -- Get_Line --
+ --------------
+
+ function Get_Line return Unbounded_String is
+ Buffer : String (1 .. 1000);
+ Last : Natural;
+ Result : Unbounded_String;
+
+ begin
+ Get_Line (Buffer, Last);
+ Set_Unbounded_String (Result, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (Buffer, Last);
+ Append (Result, Buffer (1 .. Last));
+ end loop;
+
+ return Result;
+ end Get_Line;
+
+ function Get_Line (File : Ada.Text_IO.File_Type) return Unbounded_String is
+ Buffer : String (1 .. 1000);
+ Last : Natural;
+ Result : Unbounded_String;
+
+ begin
+ Get_Line (File, Buffer, Last);
+ Set_Unbounded_String (Result, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (File, Buffer, Last);
+ Append (Result, Buffer (1 .. Last));
+ end loop;
+
+ return Result;
+ end Get_Line;
+
+ procedure Get_Line (Item : out Unbounded_String) is
+ begin
+ Get_Line (Current_Input, Item);
+ end Get_Line;
+
+ procedure Get_Line
+ (File : Ada.Text_IO.File_Type;
+ Item : out Unbounded_String)
+ is
+ Buffer : String (1 .. 1000);
+ Last : Natural;
+
+ begin
+ Get_Line (File, Buffer, Last);
+ Set_Unbounded_String (Item, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (File, Buffer, Last);
+ Append (Item, Buffer (1 .. Last));
+ end loop;
+ end Get_Line;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put (U : Unbounded_String) is
+ UR : constant Shared_String_Access := U.Reference;
+
+ begin
+ Put (UR.Data (1 .. UR.Last));
+ end Put;
+
+ procedure Put (File : File_Type; U : Unbounded_String) is
+ UR : constant Shared_String_Access := U.Reference;
+
+ begin
+ Put (File, UR.Data (1 .. UR.Last));
+ end Put;
+
+ --------------
+ -- Put_Line --
+ --------------
+
+ procedure Put_Line (U : Unbounded_String) is
+ UR : constant Shared_String_Access := U.Reference;
+
+ begin
+ Put_Line (UR.Data (1 .. UR.Last));
+ end Put_Line;
+
+ procedure Put_Line (File : File_Type; U : Unbounded_String) is
+ UR : constant Shared_String_Access := U.Reference;
+
+ begin
+ Put_Line (File, UR.Data (1 .. UR.Last));
+ end Put_Line;
+
+end Ada.Strings.Unbounded.Text_IO;
diff --git a/gcc/ada/a-swunau-shared.adb b/gcc/ada/a-swunau-shared.adb
new file mode 100644
index 00000000000..ad397b8c5b3
--- /dev/null
+++ b/gcc/ada/a-swunau-shared.adb
@@ -0,0 +1,65 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . W I D E _ U N B O U N D E D . A U X --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body Ada.Strings.Wide_Unbounded.Aux is
+
+ ---------------------
+ -- Get_Wide_String --
+ ---------------------
+
+ procedure Get_Wide_String
+ (U : Unbounded_Wide_String;
+ S : out Big_Wide_String_Access;
+ L : out Natural)
+ is
+ X : aliased Big_Wide_String;
+ for X'Address use U.Reference.Data'Address;
+ begin
+ S := X'Unchecked_Access;
+ L := U.Reference.Last;
+ end Get_Wide_String;
+
+ ---------------------
+ -- Set_Wide_String --
+ ---------------------
+
+ procedure Set_Wide_String
+ (UP : in out Unbounded_Wide_String;
+ S : Wide_String_Access)
+ is
+ X : Wide_String_Access := S;
+
+ begin
+ Set_Unbounded_Wide_String (UP, S.all);
+ Free (X);
+ end Set_Wide_String;
+
+end Ada.Strings.Wide_Unbounded.Aux;
diff --git a/gcc/ada/a-swunau.adb b/gcc/ada/a-swunau.adb
index 59eb3f6cf22..004a5d4ac1a 100644
--- a/gcc/ada/a-swunau.adb
+++ b/gcc/ada/a-swunau.adb
@@ -37,11 +37,14 @@ package body Ada.Strings.Wide_Unbounded.Aux is
procedure Get_Wide_String
(U : Unbounded_Wide_String;
- S : out Wide_String_Access;
+ S : out Big_Wide_String_Access;
L : out Natural)
is
+ X : aliased Big_Wide_String;
+ for X'Address use U.Reference.all'Address;
+
begin
- S := U.Reference;
+ S := X'Unchecked_Access;
L := U.Last;
end Get_Wide_String;
@@ -51,20 +54,6 @@ package body Ada.Strings.Wide_Unbounded.Aux is
procedure Set_Wide_String
(UP : in out Unbounded_Wide_String;
- S : Wide_String)
- is
- begin
- if S'Length > UP.Last then
- Finalize (UP);
- UP.Reference := new Wide_String (1 .. S'Length);
- end if;
-
- UP.Reference (1 .. S'Length) := S;
- UP.Last := S'Length;
- end Set_Wide_String;
-
- procedure Set_Wide_String
- (UP : in out Unbounded_Wide_String;
S : Wide_String_Access)
is
begin
diff --git a/gcc/ada/a-swunau.ads b/gcc/ada/a-swunau.ads
index 6df205c0293..78fa5dbb865 100644
--- a/gcc/ada/a-swunau.ads
+++ b/gcc/ada/a-swunau.ads
@@ -37,9 +37,12 @@
package Ada.Strings.Wide_Unbounded.Aux is
pragma Preelaborate;
+ subtype Big_Wide_String is Wide_String (Positive'Range);
+ type Big_Wide_String_Access is access all Big_Wide_String;
+
procedure Get_Wide_String
(U : Unbounded_Wide_String;
- S : out Wide_String_Access;
+ S : out Big_Wide_String_Access;
L : out Natural);
pragma Inline (Get_Wide_String);
-- This procedure returns the internal string pointer used in the
@@ -54,10 +57,8 @@ package Ada.Strings.Wide_Unbounded.Aux is
-- referenced string returned by this call is always one, so the actual
-- string data is always accessible as S (1 .. L).
- procedure Set_Wide_String
- (UP : in out Unbounded_Wide_String;
- S : Wide_String);
- pragma Inline (Set_Wide_String);
+ procedure Set_Wide_String (UP : out Unbounded_Wide_String; S : Wide_String)
+ renames Set_Unbounded_Wide_String;
-- This function sets the string contents of the referenced unbounded
-- string to the given string value. It is significantly more efficient
-- than the use of To_Unbounded_Wide_String with an assignment, since it
diff --git a/gcc/ada/a-swuwti-shared.adb b/gcc/ada/a-swuwti-shared.adb
new file mode 100644
index 00000000000..9cf7c0ad559
--- /dev/null
+++ b/gcc/ada/a-swuwti-shared.adb
@@ -0,0 +1,134 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.WIDE_UNBOUNDED.WIDE_TEXT_IO --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1997-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Text_IO; use Ada.Wide_Text_IO;
+
+package body Ada.Strings.Wide_Unbounded.Wide_Text_IO is
+
+ --------------
+ -- Get_Line --
+ --------------
+
+ function Get_Line return Unbounded_Wide_String is
+ Buffer : Wide_String (1 .. 1000);
+ Last : Natural;
+ Result : Unbounded_Wide_String;
+
+ begin
+ Get_Line (Buffer, Last);
+ Set_Unbounded_Wide_String (Result, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (Buffer, Last);
+ Append (Result, Buffer (1 .. Last));
+ end loop;
+
+ return Result;
+ end Get_Line;
+
+ function Get_Line
+ (File : Ada.Wide_Text_IO.File_Type) return Unbounded_Wide_String
+ is
+ Buffer : Wide_String (1 .. 1000);
+ Last : Natural;
+ Result : Unbounded_Wide_String;
+
+ begin
+ Get_Line (File, Buffer, Last);
+ Set_Unbounded_Wide_String (Result, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (File, Buffer, Last);
+ Append (Result, Buffer (1 .. Last));
+ end loop;
+
+ return Result;
+ end Get_Line;
+
+ procedure Get_Line (Item : out Unbounded_Wide_String) is
+ begin
+ Get_Line (Current_Input, Item);
+ end Get_Line;
+
+ procedure Get_Line
+ (File : Ada.Wide_Text_IO.File_Type;
+ Item : out Unbounded_Wide_String)
+ is
+ Buffer : Wide_String (1 .. 1000);
+ Last : Natural;
+
+ begin
+ Get_Line (File, Buffer, Last);
+ Set_Unbounded_Wide_String (Item, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (File, Buffer, Last);
+ Append (Item, Buffer (1 .. Last));
+ end loop;
+ end Get_Line;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put (U : Unbounded_Wide_String) is
+ UR : constant Shared_Wide_String_Access := U.Reference;
+
+ begin
+ Put (UR.Data (1 .. UR.Last));
+ end Put;
+
+ procedure Put (File : File_Type; U : Unbounded_Wide_String) is
+ UR : constant Shared_Wide_String_Access := U.Reference;
+
+ begin
+ Put (File, UR.Data (1 .. UR.Last));
+ end Put;
+
+ --------------
+ -- Put_Line --
+ --------------
+
+ procedure Put_Line (U : Unbounded_Wide_String) is
+ UR : constant Shared_Wide_String_Access := U.Reference;
+
+ begin
+ Put_Line (UR.Data (1 .. UR.Last));
+ end Put_Line;
+
+ procedure Put_Line (File : File_Type; U : Unbounded_Wide_String) is
+ UR : constant Shared_Wide_String_Access := U.Reference;
+
+ begin
+ Put_Line (File, UR.Data (1 .. UR.Last));
+ end Put_Line;
+
+end Ada.Strings.Wide_Unbounded.Wide_Text_IO;
diff --git a/gcc/ada/a-szunau-shared.adb b/gcc/ada/a-szunau-shared.adb
new file mode 100644
index 00000000000..87b2cb40d15
--- /dev/null
+++ b/gcc/ada/a-szunau-shared.adb
@@ -0,0 +1,65 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D . A U X --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body Ada.Strings.Wide_Wide_Unbounded.Aux is
+
+ --------------------------
+ -- Get_Wide_Wide_String --
+ --------------------------
+
+ procedure Get_Wide_Wide_String
+ (U : Unbounded_Wide_Wide_String;
+ S : out Big_Wide_Wide_String_Access;
+ L : out Natural)
+ is
+ X : aliased Big_Wide_Wide_String;
+ for X'Address use U.Reference.Data'Address;
+ begin
+ S := X'Unchecked_Access;
+ L := U.Reference.Last;
+ end Get_Wide_Wide_String;
+
+ --------------------------
+ -- Set_Wide_Wide_String --
+ --------------------------
+
+ procedure Set_Wide_Wide_String
+ (UP : in out Unbounded_Wide_Wide_String;
+ S : Wide_Wide_String_Access)
+ is
+ X : Wide_Wide_String_Access := S;
+
+ begin
+ Set_Unbounded_Wide_Wide_String (UP, S.all);
+ Free (X);
+ end Set_Wide_Wide_String;
+
+end Ada.Strings.Wide_Wide_Unbounded.Aux;
diff --git a/gcc/ada/a-szunau.adb b/gcc/ada/a-szunau.adb
index 64e52507ce7..7ab9cc5acd4 100644
--- a/gcc/ada/a-szunau.adb
+++ b/gcc/ada/a-szunau.adb
@@ -31,37 +31,26 @@
package body Ada.Strings.Wide_Wide_Unbounded.Aux is
- --------------------
+ --------------------------
-- Get_Wide_Wide_String --
- ---------------------
+ --------------------------
procedure Get_Wide_Wide_String
(U : Unbounded_Wide_Wide_String;
- S : out Wide_Wide_String_Access;
+ S : out Big_Wide_Wide_String_Access;
L : out Natural)
is
+ X : aliased Big_Wide_Wide_String;
+ for X'Address use U.Reference.all'Address;
+
begin
- S := U.Reference;
+ S := X'Unchecked_Access;
L := U.Last;
end Get_Wide_Wide_String;
- ---------------------
+ --------------------------
-- Set_Wide_Wide_String --
- ---------------------
-
- procedure Set_Wide_Wide_String
- (UP : in out Unbounded_Wide_Wide_String;
- S : Wide_Wide_String)
- is
- begin
- if S'Length > UP.Last then
- Finalize (UP);
- UP.Reference := new Wide_Wide_String (1 .. S'Length);
- end if;
-
- UP.Reference (1 .. S'Length) := S;
- UP.Last := S'Length;
- end Set_Wide_Wide_String;
+ --------------------------
procedure Set_Wide_Wide_String
(UP : in out Unbounded_Wide_Wide_String;
diff --git a/gcc/ada/a-szunau.ads b/gcc/ada/a-szunau.ads
index 913c0e136d7..6115330d94b 100644
--- a/gcc/ada/a-szunau.ads
+++ b/gcc/ada/a-szunau.ads
@@ -37,9 +37,12 @@
package Ada.Strings.Wide_Wide_Unbounded.Aux is
pragma Preelaborate;
+ subtype Big_Wide_Wide_String is Wide_Wide_String (Positive);
+ type Big_Wide_Wide_String_Access is access all Big_Wide_Wide_String;
+
procedure Get_Wide_Wide_String
(U : Unbounded_Wide_Wide_String;
- S : out Wide_Wide_String_Access;
+ S : out Big_Wide_Wide_String_Access;
L : out Natural);
pragma Inline (Get_Wide_Wide_String);
-- This procedure returns the internal string pointer used in the
@@ -55,9 +58,9 @@ package Ada.Strings.Wide_Wide_Unbounded.Aux is
-- string data is always accessible as S (1 .. L).
procedure Set_Wide_Wide_String
- (UP : in out Unbounded_Wide_Wide_String;
- S : Wide_Wide_String);
- pragma Inline (Set_Wide_Wide_String);
+ (UP : out Unbounded_Wide_Wide_String;
+ S : Wide_Wide_String)
+ renames Set_Unbounded_Wide_Wide_String;
-- This function sets the string contents of the referenced unbounded
-- string to the given string value. It is significantly more efficient
-- than the use of To_Unbounded_Wide_Wide_String with an assignment, since
diff --git a/gcc/ada/a-szuzti-shared.adb b/gcc/ada/a-szuzti-shared.adb
new file mode 100644
index 00000000000..247ccb2bcd5
--- /dev/null
+++ b/gcc/ada/a-szuzti-shared.adb
@@ -0,0 +1,135 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- ADA.STRINGS.WIDE_UNBOUNDED.WIDE_TEXT_IO --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1997-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;
+
+package body Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO is
+
+ --------------
+ -- Get_Line --
+ --------------
+
+ function Get_Line return Unbounded_Wide_Wide_String is
+ Buffer : Wide_Wide_String (1 .. 1000);
+ Last : Natural;
+ Result : Unbounded_Wide_Wide_String;
+
+ begin
+ Get_Line (Buffer, Last);
+ Set_Unbounded_Wide_Wide_String (Result, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (Buffer, Last);
+ Append (Result, Buffer (1 .. Last));
+ end loop;
+
+ return Result;
+ end Get_Line;
+
+ function Get_Line
+ (File : Ada.Wide_Wide_Text_IO.File_Type)
+ return Unbounded_Wide_Wide_String
+ is
+ Buffer : Wide_Wide_String (1 .. 1000);
+ Last : Natural;
+ Result : Unbounded_Wide_Wide_String;
+
+ begin
+ Get_Line (File, Buffer, Last);
+ Set_Unbounded_Wide_Wide_String (Result, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (File, Buffer, Last);
+ Append (Result, Buffer (1 .. Last));
+ end loop;
+
+ return Result;
+ end Get_Line;
+
+ procedure Get_Line (Item : out Unbounded_Wide_Wide_String) is
+ begin
+ Get_Line (Current_Input, Item);
+ end Get_Line;
+
+ procedure Get_Line
+ (File : Ada.Wide_Wide_Text_IO.File_Type;
+ Item : out Unbounded_Wide_Wide_String)
+ is
+ Buffer : Wide_Wide_String (1 .. 1000);
+ Last : Natural;
+
+ begin
+ Get_Line (File, Buffer, Last);
+ Set_Unbounded_Wide_Wide_String (Item, Buffer (1 .. Last));
+
+ while Last = Buffer'Last loop
+ Get_Line (File, Buffer, Last);
+ Append (Item, Buffer (1 .. Last));
+ end loop;
+ end Get_Line;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put (U : Unbounded_Wide_Wide_String) is
+ UR : constant Shared_Wide_Wide_String_Access := U.Reference;
+
+ begin
+ Put (UR.Data (1 .. UR.Last));
+ end Put;
+
+ procedure Put (File : File_Type; U : Unbounded_Wide_Wide_String) is
+ UR : constant Shared_Wide_Wide_String_Access := U.Reference;
+
+ begin
+ Put (File, UR.Data (1 .. UR.Last));
+ end Put;
+
+ --------------
+ -- Put_Line --
+ --------------
+
+ procedure Put_Line (U : Unbounded_Wide_Wide_String) is
+ UR : constant Shared_Wide_Wide_String_Access := U.Reference;
+
+ begin
+ Put_Line (UR.Data (1 .. UR.Last));
+ end Put_Line;
+
+ procedure Put_Line (File : File_Type; U : Unbounded_Wide_Wide_String) is
+ UR : constant Shared_Wide_Wide_String_Access := U.Reference;
+
+ begin
+ Put_Line (File, UR.Data (1 .. UR.Last));
+ end Put_Line;
+
+end Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO;
diff --git a/gcc/ada/a-tags.ads b/gcc/ada/a-tags.ads
index 63d694e87a6..7ef214bf83c 100644
--- a/gcc/ada/a-tags.ads
+++ b/gcc/ada/a-tags.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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 --
@@ -101,7 +101,7 @@ private
-- +-------------------+
-- | hash table link |
-- +-------------------+
- -- | remotely callable |
+ -- | transportable |
-- +-------------------+
-- | rec ctrler offset |
-- +-------------------+
diff --git a/gcc/ada/a-tifiio.adb b/gcc/ada/a-tifiio.adb
index 73ebc006251..82aeb8a83e6 100644
--- a/gcc/ada/a-tifiio.adb
+++ b/gcc/ada/a-tifiio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -301,10 +301,14 @@ package body Ada.Text_IO.Fixed_IO is
(To : out String;
Last : out Natural;
Item : Num;
- Fore : Field;
+ Fore : Integer;
Aft : Field;
Exp : Field);
- -- Actual output function, used internally by all other Put routines
+ -- Actual output function, used internally by all other Put routines.
+ -- The formal Fore is an Integer, not a Field, because the routine is
+ -- also called from the version of Put that performs I/O to a string,
+ -- where the starting position depends on the size of the String, and
+ -- bears no relation to the bounds of Field.
---------
-- Get --
@@ -392,7 +396,7 @@ package body Ada.Text_IO.Fixed_IO is
Last : Natural;
begin
- if Fore - Boolean'Pos (Item < 0.0) < 1 or else Fore > Field'Last then
+ if Fore - Boolean'Pos (Item < 0.0) < 1 then
raise Layout_Error;
end if;
@@ -407,7 +411,7 @@ package body Ada.Text_IO.Fixed_IO is
(To : out String;
Last : out Natural;
Item : Num;
- Fore : Field;
+ Fore : Integer;
Aft : Field;
Exp : Field)
is
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 54b32232bb8..9b814e945d0 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2009, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2010, 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- *
@@ -132,7 +132,7 @@ UINT CurrentCodePage;
#include <sys/wait.h>
#endif
-#if defined (__EMX__) || defined (MSDOS) || defined (_WIN32)
+#if defined (_WIN32)
#elif defined (VMS)
/* Header files and definitions for __gnat_set_file_time_name. */
@@ -183,7 +183,7 @@ struct vstring
#include <utime.h>
#endif
-#if defined (__EMX__) || defined (MSDOS) || defined (_WIN32)
+#if defined (_WIN32)
#include <process.h>
#endif
@@ -205,14 +205,6 @@ struct vstring
external file mapped to LF in internal file), but in Unix-like systems,
no text translation is required, so these flags have no effect. */
-#if defined (__EMX__)
-#include <os2.h>
-#endif
-
-#if defined (MSDOS)
-#include <dos.h>
-#endif
-
#ifndef O_BINARY
#define O_BINARY 0
#endif
@@ -275,9 +267,7 @@ char __gnat_path_separator = PATH_SEPARATOR;
as well. This is only a temporary work-around for 3.11b. */
#ifndef GNAT_LIBRARY_TEMPLATE
-#if defined (__EMX__)
-#define GNAT_LIBRARY_TEMPLATE "*.a"
-#elif defined (VMS)
+#if defined (VMS)
#define GNAT_LIBRARY_TEMPLATE "*.olb"
#else
#define GNAT_LIBRARY_TEMPLATE "lib*.a"
@@ -294,10 +284,7 @@ const int __gnat_vmsp = 1;
const int __gnat_vmsp = 0;
#endif
-#ifdef __EMX__
-#define GNAT_MAX_PATH_LEN MAX_PATH
-
-#elif defined (VMS)
+#if defined (VMS)
#define GNAT_MAX_PATH_LEN 256 /* PATH_MAX */
#elif defined (__vxworks) || defined (__OPENNT) || defined(__nucleus__)
@@ -377,7 +364,7 @@ to_ptr32 (char **ptr64)
#define MAYBE_TO_PTR32(argv) argv
#endif
-const char ATTR_UNSET = 127;
+static const char ATTR_UNSET = 127;
void
__gnat_reset_attributes
@@ -478,8 +465,8 @@ __gnat_readlink (char *path ATTRIBUTE_UNUSED,
char *buf ATTRIBUTE_UNUSED,
size_t bufsiz ATTRIBUTE_UNUSED)
{
-#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \
- || defined (VMS) || defined(__vxworks) || defined (__nucleus__)
+#if defined (_WIN32) || defined (VMS) \
+ || defined(__vxworks) || defined (__nucleus__)
return -1;
#else
return readlink (path, buf, bufsiz);
@@ -494,8 +481,8 @@ int
__gnat_symlink (char *oldpath ATTRIBUTE_UNUSED,
char *newpath ATTRIBUTE_UNUSED)
{
-#if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \
- || defined (VMS) || defined(__vxworks) || defined (__nucleus__)
+#if defined (_WIN32) || defined (VMS) \
+ || defined(__vxworks) || defined (__nucleus__)
return -1;
#else
return symlink (oldpath, newpath);
@@ -504,8 +491,8 @@ __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED,
/* Try to lock a file, return 1 if success. */
-#if defined (__vxworks) || defined (__nucleus__) || defined (MSDOS) \
- || defined (_WIN32) || defined (__EMX__) || defined (VMS)
+#if defined (__vxworks) || defined (__nucleus__) \
+ || defined (_WIN32) || defined (VMS)
/* Version that does not use link. */
@@ -577,9 +564,7 @@ __gnat_try_lock (char *dir, char *file)
int
__gnat_get_maximum_file_name_length (void)
{
-#if defined (MSDOS)
- return 8;
-#elif defined (VMS)
+#if defined (VMS)
if (getenv ("GNAT$EXTENDED_FILE_SPECIFICATIONS"))
return -1;
else
@@ -594,7 +579,7 @@ __gnat_get_maximum_file_name_length (void)
int
__gnat_get_file_names_case_sensitive (void)
{
-#if defined (__EMX__) || defined (MSDOS) || defined (VMS) || defined (WINNT)
+#if defined (VMS) || defined (WINNT)
return 0;
#else
return 1;
@@ -604,11 +589,7 @@ __gnat_get_file_names_case_sensitive (void)
char
__gnat_get_default_identifier_character_set (void)
{
-#if defined (__EMX__) || defined (MSDOS)
- return 'p';
-#else
return '1';
-#endif
}
/* Return the current working directory. */
@@ -675,12 +656,7 @@ __gnat_get_executable_suffix_ptr (int *len, const char **value)
void
__gnat_get_debuggable_suffix_ptr (int *len, const char **value)
{
-#ifndef MSDOS
*value = HOST_EXECUTABLE_SUFFIX;
-#else
- /* On DOS, the extensionless COFF file is what gdb likes. */
- *value = "";
-#endif
if (*value == 0)
*len = 0;
@@ -859,7 +835,7 @@ __gnat_open_read (char *path, int fmode)
return fd < 0 ? -1 : fd;
}
-#if defined (__EMX__) || defined (__MINGW32__)
+#if defined (__MINGW32__)
#define PERM (S_IREAD | S_IWRITE)
#elif defined (VMS)
/* Excerpt from DECC C RTL Reference Manual:
@@ -1101,7 +1077,7 @@ __gnat_stat_to_attr (int fd, char* name, struct file_attributes* attr)
attr->executable = (!ret && (statbuf.st_mode & S_IXUSR));
#endif
-#if !defined (__EMX__) && !defined (MSDOS) && (!defined (_WIN32) || defined (RTX))
+#if !defined (_WIN32) || defined (RTX)
/* on Windows requires extra system call, see __gnat_file_time_name_attr */
if (ret != 0) {
attr->timestamp = (OS_Time)-1;
@@ -1342,13 +1318,7 @@ OS_Time
__gnat_file_time_name_attr (char* name, struct file_attributes* attr)
{
if (attr->timestamp == (OS_Time)-2) {
-#if defined (__EMX__) || defined (MSDOS)
- int fd = open (name, O_RDONLY | O_BINARY);
- time_t ret = __gnat_file_time_fd (fd);
- close (fd);
- attr->timestamp = (OS_Time)ret;
-
-#elif defined (_WIN32) && !defined (RTX)
+#if defined (_WIN32) && !defined (RTX)
time_t ret = -1;
TCHAR wname[GNAT_MAX_PATH_LEN];
S2WSC (wname, name, GNAT_MAX_PATH_LEN);
@@ -1383,74 +1353,7 @@ OS_Time
__gnat_file_time_fd_attr (int fd, struct file_attributes* attr)
{
if (attr->timestamp == (OS_Time)-2) {
- /* The following workaround code is due to the fact that under EMX and
- DJGPP fstat attempts to convert time values to GMT rather than keep the
- actual OS timestamp of the file. By using the OS2/DOS functions directly
- the GNAT timestamp are independent of this behavior, which is desired to
- facilitate the distribution of GNAT compiled libraries. */
-
-#if defined (__EMX__) || defined (MSDOS)
-#ifdef __EMX__
-
- FILESTATUS fs;
- int ret = DosQueryFileInfo (fd, 1, (unsigned char *) &fs,
- sizeof (FILESTATUS));
-
- unsigned file_year = fs.fdateLastWrite.year;
- unsigned file_month = fs.fdateLastWrite.month;
- unsigned file_day = fs.fdateLastWrite.day;
- unsigned file_hour = fs.ftimeLastWrite.hours;
- unsigned file_min = fs.ftimeLastWrite.minutes;
- unsigned file_tsec = fs.ftimeLastWrite.twosecs;
-
-#else
- struct ftime fs;
- int ret = getftime (fd, &fs);
-
- unsigned file_year = fs.ft_year;
- unsigned file_month = fs.ft_month;
- unsigned file_day = fs.ft_day;
- unsigned file_hour = fs.ft_hour;
- unsigned file_min = fs.ft_min;
- unsigned file_tsec = fs.ft_tsec;
-#endif
-
- /* Calculate the seconds since epoch from the time components. First count
- the whole days passed. The value for years returned by the DOS and OS2
- functions count years from 1980, so to compensate for the UNIX epoch which
- begins in 1970 start with 10 years worth of days and add days for each
- four year period since then. */
-
- time_t tot_secs;
- int cum_days[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
- int days_passed = 3652 + (file_year / 4) * 1461;
- int years_since_leap = file_year % 4;
-
- if (years_since_leap == 1)
- days_passed += 366;
- else if (years_since_leap == 2)
- days_passed += 731;
- else if (years_since_leap == 3)
- days_passed += 1096;
-
- if (file_year > 20)
- days_passed -= 1;
-
- days_passed += cum_days[file_month - 1];
- if (years_since_leap == 0 && file_year != 20 && file_month > 2)
- days_passed++;
-
- days_passed += file_day - 1;
-
- /* OK - have whole days. Multiply -- then add in other parts. */
-
- tot_secs = days_passed * 86400;
- tot_secs += file_hour * 3600;
- tot_secs += file_min * 60;
- tot_secs += file_tsec * 2;
- attr->timestamp = (OS_Time) tot_secs;
-
-#elif defined (_WIN32) && !defined (RTX)
+#if defined (_WIN32) && !defined (RTX)
HANDLE h = (HANDLE) _get_osfhandle (fd);
time_t ret = win32_filetime (h);
attr->timestamp = (OS_Time) ret;
@@ -1476,7 +1379,7 @@ __gnat_file_time_fd (int fd)
void
__gnat_set_file_time_name (char *name, time_t time_stamp)
{
-#if defined (__EMX__) || defined (MSDOS) || defined (__vxworks)
+#if defined (__vxworks)
/* Code to implement __gnat_set_file_time_name for these systems. */
@@ -1857,7 +1760,7 @@ __gnat_is_absolute_path (char *name, int length)
#else
return (length != 0) &&
(*name == '/' || *name == DIR_SEPARATOR
-#if defined (__EMX__) || defined (MSDOS) || defined (WINNT)
+#if defined (WINNT)
|| (length > 1 && ISALPHA (name[0]) && name[1] == ':')
#endif
);
@@ -2358,7 +2261,7 @@ __gnat_portable_spawn (char *args[])
#if defined (__vxworks) || defined(__nucleus__) || defined(RTX)
return -1;
-#elif defined (MSDOS) || defined (_WIN32)
+#elif defined (_WIN32)
/* args[0] must be quotes as it could contain a full pathname with spaces */
char *args_0 = args[0];
args[0] = (char *)xmalloc (strlen (args_0) + 3);
@@ -2379,12 +2282,6 @@ __gnat_portable_spawn (char *args[])
#else
-#ifdef __EMX__
- pid = spawnvp (P_NOWAIT, args[0], args);
- if (pid == -1)
- return -1;
-
-#else
pid = fork ();
if (pid < 0)
return -1;
@@ -2399,7 +2296,6 @@ __gnat_portable_spawn (char *args[])
_exit (1);
#endif
}
-#endif
/* The parent. */
finished = waitpid (pid, &status, 0);
@@ -2474,7 +2370,7 @@ static HANDLE *HANDLES_LIST = NULL;
static int *PID_LIST = NULL, plist_length = 0, plist_max_length = 0;
static void
-add_handle (HANDLE h)
+add_handle (HANDLE h, int pid)
{
/* -------------------- critical section -------------------- */
@@ -2490,7 +2386,7 @@ add_handle (HANDLE h)
}
HANDLES_LIST[plist_length] = h;
- PID_LIST[plist_length] = GetProcessId (h);
+ PID_LIST[plist_length] = pid;
++plist_length;
(*Unlock_Task) ();
@@ -2521,8 +2417,8 @@ __gnat_win32_remove_handle (HANDLE h, int pid)
/* -------------------- critical section -------------------- */
}
-static HANDLE
-win32_no_block_spawn (char *command, char *args[])
+static void
+win32_no_block_spawn (char *command, char *args[], HANDLE *h, int *pid)
{
BOOL result;
STARTUPINFO SI;
@@ -2587,10 +2483,14 @@ win32_no_block_spawn (char *command, char *args[])
if (result == TRUE)
{
CloseHandle (PI.hThread);
- return PI.hProcess;
+ *h = PI.hProcess;
+ *pid = PI.dwProcessId;
}
else
- return NULL;
+ {
+ *h = NULL;
+ *pid = 0;
+ }
}
static int
@@ -2627,7 +2527,7 @@ win32_wait (int *status)
h = hl[res - WAIT_OBJECT_0];
GetExitCodeProcess (h, &exitcode);
- pid = GetProcessId (h);
+ pid = PID_LIST [res - WAIT_OBJECT_0];
__gnat_win32_remove_handle (h, -1);
free (hl);
@@ -2645,28 +2545,16 @@ __gnat_portable_no_block_spawn (char *args[])
#if defined (__vxworks) || defined (__nucleus__) || defined (RTX)
return -1;
-#elif defined (__EMX__) || defined (MSDOS)
-
- /* ??? For PC machines I (Franco) don't know the system calls to implement
- this routine. So I'll fake it as follows. This routine will behave
- exactly like the blocking portable_spawn and will systematically return
- a pid of 0 unless the spawned task did not complete successfully, in
- which case we return a pid of -1. To synchronize with this the
- portable_wait below systematically returns a pid of 0 and reports that
- the subprocess terminated successfully. */
-
- if (spawnvp (P_WAIT, args[0], args) != 0)
- return -1;
-
#elif defined (_WIN32)
HANDLE h = NULL;
+ int pid;
- h = win32_no_block_spawn (args[0], args);
+ win32_no_block_spawn (args[0], args, &h, &pid);
if (h != NULL)
{
- add_handle (h);
- return GetProcessId (h);
+ add_handle (h, pid);
+ return pid;
}
else
return -1;
@@ -2698,16 +2586,12 @@ __gnat_portable_wait (int *process_status)
int pid = 0;
#if defined (__vxworks) || defined (__nucleus__) || defined (RTX)
- /* Not sure what to do here, so do same as __EMX__ case, i.e., nothing but
- return zero. */
+ /* Not sure what to do here, so do nothing but return zero. */
#elif defined (_WIN32)
pid = win32_wait (&status);
-#elif defined (__EMX__) || defined (MSDOS)
- /* ??? See corresponding comment in portable_no_block_spawn. */
-
#else
pid = waitpid (-1, &status, 0);
@@ -2783,12 +2667,6 @@ __gnat_locate_regular_file (char *file_name, char *path_val)
for (;;)
{
- for (; *path_val == PATH_SEPARATOR; path_val++)
- ;
-
- if (*path_val == 0)
- return 0;
-
/* Skip the starting quote */
if (*path_val == '"')
@@ -2797,7 +2675,14 @@ __gnat_locate_regular_file (char *file_name, char *path_val)
for (ptr = file_path; *path_val && *path_val != PATH_SEPARATOR; )
*ptr++ = *path_val++;
- ptr--;
+ /* If directory is empty, it is the current directory*/
+
+ if (ptr == file_path)
+ {
+ *ptr = '.';
+ }
+ else
+ ptr--;
/* Skip the ending quote */
@@ -2811,6 +2696,13 @@ __gnat_locate_regular_file (char *file_name, char *path_val)
if (__gnat_is_regular_file (file_path))
return xstrdup (file_path);
+
+ if (*path_val == 0)
+ return 0;
+
+ /* Skip path separator */
+
+ path_val++;
}
}
@@ -3445,14 +3337,6 @@ __gnat_adjust_os_resource_limits (void)
#endif
-/* For EMX, we cannot include dummy in libgcc, since it is too difficult
- to coordinate this with the EMX distribution. Consequently, we put the
- definition of dummy which is used for exception handling, here. */
-
-#if defined (__EMX__)
-void __dummy () {}
-#endif
-
#if defined (__mips_vxworks)
int
_flush_cache()
diff --git a/gcc/ada/ali-util.adb b/gcc/ada/ali-util.adb
index e996611c327..001d654ff1d 100644
--- a/gcc/ada/ali-util.adb
+++ b/gcc/ada/ali-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -220,11 +220,11 @@ package body ALI.Util is
null;
end Post_Scan;
- --------------
- -- Read_ALI --
- --------------
+ ----------------------
+ -- Read_Withed_ALIs --
+ ----------------------
- procedure Read_ALI (Id : ALI_Id) is
+ procedure Read_Withed_ALIs (Id : ALI_Id) is
Afile : File_Name_Type;
Text : Text_Buffer_Ptr;
Idread : ALI_Id;
@@ -298,7 +298,7 @@ package body ALI.Util is
else
-- Otherwise, recurse to get new dependents
- Read_ALI (Idread);
+ Read_Withed_ALIs (Idread);
end if;
-- If the ALI file has already been processed and is an interface,
@@ -309,7 +309,7 @@ package body ALI.Util is
end if;
end loop;
end loop;
- end Read_ALI;
+ end Read_Withed_ALIs;
----------------------
-- Set_Source_Table --
@@ -481,6 +481,14 @@ package body ALI.Util is
(Get_File_Checksum (Sdep.Table (D).Sfile),
Source.Table (Src).Checksum)
then
+ if Verbose_Mode then
+ Write_Str (" ");
+ Write_Str (Get_Name_String (Sdep.Table (D).Sfile));
+ Write_Str (": up to date, different timestamps " &
+ "but same checksum");
+ Write_Eol;
+ end if;
+
Sdep.Table (D).Stamp := Source.Table (Src).Stamp;
end if;
diff --git a/gcc/ada/ali-util.ads b/gcc/ada/ali-util.ads
index d28ad40d54d..cbdb14f7075 100644
--- a/gcc/ada/ali-util.ads
+++ b/gcc/ada/ali-util.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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,9 +32,8 @@ package ALI.Util is
-- Source File Table --
-----------------------
- -- A source file table entry is built for every source file that is
- -- in the source dependency table of any of the ALI files that make
- -- up the current program.
+ -- A table entry is built for every source file that is in the source
+ -- dependency table of any ALI file that is part of the current program.
No_Source_Id : constant Source_Id := Source_Id'First;
-- Special value indicating no Source table entry
@@ -101,11 +100,11 @@ package ALI.Util is
-- Subprograms for Manipulating ALI Information --
--------------------------------------------------
- procedure Read_ALI (Id : ALI_Id);
- -- Process an ALI file which has been read and scanned by looping
- -- through all withed units in the ALI file, checking if they have
- -- been processed. Each unit that has not yet been processed will
- -- be read, scanned, and processed recursively.
+ procedure Read_Withed_ALIs (Id : ALI_Id);
+ -- Process an ALI file which has been read and scanned by looping through
+ -- all withed units in the ALI file, checking if they have been processed.
+ -- Each unit that has not yet been processed will be read, scanned, and
+ -- processed recursively.
procedure Set_Source_Table (A : ALI_Id);
-- Build source table entry corresponding to the ALI file whose id is A
diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index 20438cf66e6..eb45dcaca50 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -49,6 +49,7 @@ package body ALI is
'U' => True, -- unit
'W' => True, -- with
'L' => True, -- linker option
+ 'N' => True, -- notes
'E' => True, -- external
'D' => True, -- dependency
'X' => True, -- xref
@@ -89,14 +90,16 @@ package body ALI is
Withs.Init;
Sdep.Init;
Linker_Options.Init;
+ Notes.Init;
Xref_Section.Init;
Xref_Entity.Init;
Xref.Init;
Version_Ref.Reset;
- -- Add dummy zero'th item in Linker_Options for the sort function
+ -- Add dummy zero'th item in Linker_Options and Notes for sort calls
Linker_Options.Increment_Last;
+ Notes.Increment_Last;
-- Initialize global variables recording cumulative options in all
-- ALI files that are read for a given processing run in gnatbind.
@@ -119,14 +122,15 @@ package body ALI is
--------------
function Scan_ALI
- (F : File_Name_Type;
- T : Text_Buffer_Ptr;
- Ignore_ED : Boolean;
- Err : Boolean;
- Read_Xref : Boolean := False;
- Read_Lines : String := "";
- Ignore_Lines : String := "X";
- Ignore_Errors : Boolean := False) return ALI_Id
+ (F : File_Name_Type;
+ T : Text_Buffer_Ptr;
+ Ignore_ED : Boolean;
+ Err : Boolean;
+ Read_Xref : Boolean := False;
+ Read_Lines : String := "";
+ Ignore_Lines : String := "X";
+ Ignore_Errors : Boolean := False;
+ Directly_Scanned : Boolean := False) return ALI_Id
is
P : Text_Ptr := T'First;
Line : Logical_Line_Number := 1;
@@ -204,7 +208,7 @@ package body ALI is
--
-- If Ignore_Special is False (normal case), the scan is terminated by
-- a typeref bracket or an equal sign except for the special case of
- -- an operator name starting with a double quite which is terminated
+ -- an operator name starting with a double quote which is terminated
-- by another double quote.
--
-- It is an error to set both Ignore_Spaces and Ignore_Special to True.
@@ -1291,9 +1295,9 @@ package body ALI is
else
Skip_Space;
No_Deps.Append ((Id, Get_Name));
+ Skip_Eol;
end if;
- Skip_Eol;
C := Getc;
end loop;
@@ -1415,6 +1419,7 @@ package body ALI is
UL.First_Arg := First_Arg;
UL.Elab_Position := 0;
UL.SAL_Interface := ALIs.Table (Id).SAL_Interface;
+ UL.Directly_Scanned := Directly_Scanned;
UL.Body_Needed_For_SAL := False;
UL.Elaborate_Body_Desirable := False;
UL.Optimize_Alignment := 'O';
@@ -1860,6 +1865,45 @@ package body ALI is
Linker_Options.Table (Linker_Options.Last).Original_Pos :=
Linker_Options.Last;
end if;
+
+ -- If there are notes present, scan them
+
+ Notes_Loop : loop
+ Check_Unknown_Line;
+ exit Notes_Loop when C /= 'N';
+
+ if Ignore ('N') then
+ Skip_Line;
+
+ else
+ Checkc (' ');
+
+ Notes.Increment_Last;
+ Notes.Table (Notes.Last).Pragma_Type := Getc;
+ Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
+ Checkc (':');
+ Notes.Table (Notes.Last).Pragma_Col := Get_Nat;
+ Notes.Table (Notes.Last).Unit := Units.Last;
+
+ if At_Eol then
+ Notes.Table (Notes.Last).Pragma_Args := No_Name;
+
+ else
+ Checkc (' ');
+
+ Name_Len := 0;
+ while not At_Eol loop
+ Add_Char_To_Name_Buffer (Getc);
+ end loop;
+
+ Notes.Table (Notes.Last).Pragma_Args := Name_Enter;
+ end if;
+
+ Skip_Eol;
+ end if;
+
+ C := Getc;
+ end loop Notes_Loop;
end loop U_Loop;
-- End loop through units for one ALI file
@@ -2146,10 +2190,19 @@ package body ALI is
-- Start of processing for Read_Refs_For_One_Entity
begin
- XE.Line := Get_Nat;
- XE.Etype := Getc;
- XE.Col := Get_Nat;
- XE.Lib := (Getc = '*');
+ XE.Line := Get_Nat;
+ XE.Etype := Getc;
+ XE.Col := Get_Nat;
+
+ case Getc is
+ when '*' =>
+ XE.Visibility := Global;
+ when '+' =>
+ XE.Visibility := Static;
+ when others =>
+ XE.Visibility := Other;
+ end case;
+
XE.Entity := Get_Name;
-- Handle the information about generic instantiations
diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads
index 9e8da30a22f..74aeaed026d 100644
--- a/gcc/ada/ali.ads
+++ b/gcc/ada/ali.ads
@@ -342,6 +342,9 @@ package ALI is
SAL_Interface : Boolean;
-- Set True when this is an interface to a standalone library
+ Directly_Scanned : Boolean;
+ -- True iff it is a unit from an ALI file specified to gnatbind
+
Body_Needed_For_SAL : Boolean;
-- Indicates that the source for the body of the unit (subprogram,
-- package, or generic unit) must be included in a standalone library.
@@ -602,8 +605,6 @@ package ALI is
-- table.
end record;
- -- Declare the Linker_Options Table
-
-- The indexes of active entries in this table range from 1 to the
-- value of Linker_Options.Last. The zero'th element is for sort call.
@@ -615,6 +616,44 @@ package ALI is
Table_Increment => 400,
Table_Name => "Linker_Options");
+ -----------------
+ -- Notes Table --
+ -----------------
+
+ -- The notes table records entries from N lines
+
+ type Notes_Record is record
+ Pragma_Type : Character;
+ -- 'A', 'C', 'I', 'S', 'T' for Annotate/Comment/Ident/Subtitle/Title
+
+ Pragma_Line : Nat;
+ -- Line number of pragma
+
+ Pragma_Col : Nat;
+ -- Column number of pragma
+
+ Unit : Unit_Id;
+ -- Unit_Id for the entry
+
+ Pragma_Args : Name_Id;
+ -- Pragma arguments. No_Name if no arguments, otherwise a single
+ -- name table entry consisting of all the characters on the notes
+ -- line from the first non-blank character following the source
+ -- location to the last character on the line.
+ end record;
+
+ -- The indexes of active entries in this table range from 1 to the
+ -- value of Linker_Options.Last. The zero'th element is for convenience
+ -- if the table needs to be sorted.
+
+ package Notes is new Table.Table (
+ Table_Component_Type => Notes_Record,
+ Table_Index_Type => Integer,
+ Table_Low_Bound => 0,
+ Table_Initial => 200,
+ Table_Increment => 400,
+ Table_Name => "Notes");
+
-------------------------------------------
-- External Version Reference Hash Table --
-------------------------------------------
@@ -772,6 +811,11 @@ package ALI is
Tref_Derived, -- Derived type typeref (points to parent type)
Tref_Type); -- All other cases
+ type Visibility_Kind is
+ (Global, -- Library level entity
+ Static, -- Static C/C++ entity
+ Other); -- Local and other entity
+
-- The following table records entities for which xrefs are recorded
type Xref_Entity_Record is record
@@ -785,8 +829,8 @@ package ALI is
Col : Pos;
-- Column number of definition
- Lib : Boolean;
- -- True if entity is library level entity
+ Visibility : Visibility_Kind;
+ -- Visiblity of entity
Entity : Name_Id;
-- Name of entity
@@ -933,14 +977,15 @@ package ALI is
-- Initialize the ALI tables. Also resets all switch values to defaults
function Scan_ALI
- (F : File_Name_Type;
- T : Text_Buffer_Ptr;
- Ignore_ED : Boolean;
- Err : Boolean;
- Read_Xref : Boolean := False;
- Read_Lines : String := "";
- Ignore_Lines : String := "X";
- Ignore_Errors : Boolean := False) return ALI_Id;
+ (F : File_Name_Type;
+ T : Text_Buffer_Ptr;
+ Ignore_ED : Boolean;
+ Err : Boolean;
+ Read_Xref : Boolean := False;
+ Read_Lines : String := "";
+ Ignore_Lines : String := "X";
+ Ignore_Errors : Boolean := False;
+ Directly_Scanned : Boolean := False) return ALI_Id;
-- Given the text, T, of an ALI file, F, scan and store the information
-- from the file, and return the Id of the resulting entry in the ALI
-- table. Switch settings may be modified as described above in the
@@ -986,5 +1031,11 @@ package ALI is
-- Scan_ALI was completely unable to process the file (e.g. it did not
-- look like an ALI file at all). Ignore_Errors is intended to improve
-- the downward compatibility of new compilers with old tools.
+ --
+ -- Directly_Scanned is normally False. If it is set to True, then the
+ -- units (spec and/or body) corresponding to the ALI file are marked as
+ -- such. It is used to decide for what units gnatbind should generate
+ -- the symbols corresponding to 'Version or 'Body_Version in
+ -- Stand-Alone Libraries.
end ALI;
diff --git a/gcc/ada/alloc.ads b/gcc/ada/alloc.ads
index fa6c9d123f5..c5cad729652 100644
--- a/gcc/ada/alloc.ads
+++ b/gcc/ada/alloc.ads
@@ -100,6 +100,9 @@ package Alloc is
Nodes_Initial : constant := 50_000; -- Atree
Nodes_Increment : constant := 100;
+ Notes_Initial : constant := 100; -- Lib
+ Notes_Increment : constant := 200;
+
Obsolescent_Warnings_Initial : constant := 50; -- Sem_Prag
Obsolescent_Warnings_Increment : constant := 200;
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index b22732668a5..807527230af 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -44,6 +44,9 @@ with Tree_IO; use Tree_IO;
package body Atree is
+ Reporting_Proc : Report_Proc := null;
+ -- Record argument to last call to Set_Reporting_Proc
+
---------------
-- Debugging --
---------------
@@ -63,13 +66,15 @@ package body Atree is
-- Either way, gnat1 will stop when node 12345 is created
- -- The second method is faster
+ -- The second method is much faster
+
+ -- Similarly, rr and rrd allow breaking on rewriting of a given node
ww : Node_Id'Base := Node_Id'First - 1;
pragma Export (Ada, ww); -- trick the optimizer
Watch_Node : Node_Id'Base renames ww;
- -- Node to "watch"; that is, whenever a node is created, we check if it is
- -- equal to Watch_Node, and if so, call New_Node_Breakpoint. You have
+ -- Node to "watch"; that is, whenever a node is created, we check if it
+ -- is equal to Watch_Node, and if so, call New_Node_Breakpoint. You have
-- presumably set a breakpoint on New_Node_Breakpoint. Note that the
-- initial value of Node_Id'First - 1 ensures that by default, no node
-- will be equal to Watch_Node.
@@ -89,6 +94,25 @@ package body Atree is
-- If Node = Watch_Node, this prints out the new node and calls
-- New_Node_Breakpoint. Otherwise, does nothing.
+ procedure rr;
+ pragma Export (Ada, rr);
+ procedure Rewrite_Breakpoint renames rr;
+ -- This doesn't do anything interesting; it's just for setting breakpoint
+ -- on as explained above.
+
+ procedure rrd (Old_Node, New_Node : Node_Id);
+ pragma Export (Ada, rrd);
+ procedure Rewrite_Debugging_Output
+ (Old_Node, New_Node : Node_Id) renames rrd;
+ -- For debugging. If debugging is turned on, Rewrite calls this. If debug
+ -- flag N is turned on, this prints out the new node.
+ --
+ -- If Old_Node = Watch_Node, this prints out the old and new nodes and
+ -- calls Rewrite_Breakpoint. Otherwise, does nothing.
+
+ procedure Node_Debug_Output (Op : String; N : Node_Id);
+ -- Common code for nnd and rrd, writes Op followed by information about N
+
-----------------------------
-- Local Objects and Types --
-----------------------------
@@ -510,6 +534,13 @@ package body Atree is
Orig_Nodes.Set_Last (Nodes.Last);
Allocate_List_Tables (Nodes.Last);
+
+ -- Invoke the reporting procedure (if available)
+
+ if Reporting_Proc /= null then
+ Reporting_Proc.all (Target => New_Id, Source => Src);
+ end if;
+
return New_Id;
end Allocate_Initialize_Node;
@@ -766,6 +797,145 @@ package body Atree is
return N_To_E (Nodes.Table (E + 1).Nkind);
end Ekind;
+ --------------
+ -- Ekind_In --
+ --------------
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind) return Boolean
+ is
+ begin
+ return T = V1 or else
+ T = V2;
+ end Ekind_In;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind) return Boolean
+ is
+ begin
+ return T = V1 or else
+ T = V2 or else
+ T = V3;
+ end Ekind_In;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind) return Boolean
+ is
+ begin
+ return T = V1 or else
+ T = V2 or else
+ T = V3 or else
+ T = V4;
+ end Ekind_In;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind) return Boolean
+ is
+ begin
+ return T = V1 or else
+ T = V2 or else
+ T = V3 or else
+ T = V4 or else
+ T = V5;
+ end Ekind_In;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind;
+ V6 : Entity_Kind) return Boolean
+ is
+ begin
+ return T = V1 or else
+ T = V2 or else
+ T = V3 or else
+ T = V4 or else
+ T = V5 or else
+ T = V6;
+ end Ekind_In;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind) return Boolean
+ is
+ begin
+ return Ekind_In (Ekind (E), V1, V2);
+ end Ekind_In;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind) return Boolean
+ is
+ begin
+ return Ekind_In (Ekind (E), V1, V2, V3);
+ end Ekind_In;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind) return Boolean
+ is
+ begin
+ return Ekind_In (Ekind (E), V1, V2, V3, V4);
+ end Ekind_In;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind) return Boolean
+ is
+ begin
+ return Ekind_In (Ekind (E), V1, V2, V3, V4, V5);
+ end Ekind_In;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind;
+ V6 : Entity_Kind) return Boolean
+ is
+ begin
+ return Ekind_In (Ekind (E), V1, V2, V3, V4, V5, V6);
+ end Ekind_In;
+
+ ------------------------
+ -- Set_Reporting_Proc --
+ ------------------------
+
+ procedure Set_Reporting_Proc (P : Report_Proc) is
+ begin
+ pragma Assert (Reporting_Proc = null);
+ Reporting_Proc := P;
+ end Set_Reporting_Proc;
+
------------------
-- Error_Posted --
------------------
@@ -1108,21 +1278,7 @@ package body Atree is
begin
if Debug_Flag_N or else Node_Is_Watched then
- Write_Str ("Allocate ");
-
- if Nkind (N) in N_Entity then
- Write_Str ("entity");
- else
- Write_Str ("node");
- end if;
-
- Write_Str (", Id = ");
- Write_Int (Int (N));
- Write_Str (" ");
- Write_Location (Sloc (N));
- Write_Str (" ");
- Write_Str (Node_Kind'Image (Nkind (N)));
- Write_Eol;
+ Node_Debug_Output ("Allocate", N);
if Node_Is_Watched then
New_Node_Breakpoint;
@@ -1242,6 +1398,7 @@ package body Atree is
begin
return Nkind_In (Nkind (N), V1, V2, V3, V4, V5, V6, V7, V8, V9);
end Nkind_In;
+
--------
-- No --
--------
@@ -1251,6 +1408,29 @@ package body Atree is
return N = Empty;
end No;
+ -----------------------
+ -- Node_Debug_Output --
+ -----------------------
+
+ procedure Node_Debug_Output (Op : String; N : Node_Id) is
+ begin
+ Write_Str (Op);
+
+ if Nkind (N) in N_Entity then
+ Write_Str (" entity");
+ else
+ Write_Str (" node");
+ end if;
+
+ Write_Str (" Id = ");
+ Write_Int (Int (N));
+ Write_Str (" ");
+ Write_Location (Sloc (N));
+ Write_Str (" ");
+ Write_Str (Node_Kind'Image (Nkind (N)));
+ Write_Eol;
+ end Node_Debug_Output;
+
-------------------
-- Nodes_Address --
-------------------
@@ -1410,6 +1590,12 @@ package body Atree is
-- to Rewrite if there were an intention to save the original node.
Orig_Nodes.Table (Old_Node) := Old_Node;
+
+ -- Invoke the reporting procedure (if available)
+
+ if Reporting_Proc /= null then
+ Reporting_Proc.all (Target => Old_Node, Source => New_Node);
+ end if;
end Replace;
-------------
@@ -1435,6 +1621,7 @@ package body Atree is
(not Has_Extension (Old_Node)
and not Has_Extension (New_Node)
and not Nodes.Table (New_Node).In_List);
+ pragma Debug (Rewrite_Debugging_Output (Old_Node, New_Node));
if Nkind (Old_Node) in N_Subexpr then
Old_Paren_Count := Paren_Count (Old_Node);
@@ -1467,8 +1654,44 @@ package body Atree is
end if;
Fix_Parents (Ref_Node => New_Node, Fix_Node => Old_Node);
+
+ -- Invoke the reporting procedure (if available)
+
+ if Reporting_Proc /= null then
+ Reporting_Proc.all (Target => Old_Node, Source => New_Node);
+ end if;
end Rewrite;
+ -------------------------
+ -- Rewrite_Breakpoint --
+ -------------------------
+
+ procedure rr is -- Rewrite_Breakpoint
+ begin
+ Write_Str ("Watched node ");
+ Write_Int (Int (Watch_Node));
+ Write_Str (" rewritten");
+ Write_Eol;
+ end rr;
+
+ ------------------------------
+ -- Rewrite_Debugging_Output --
+ ------------------------------
+
+ procedure rrd (Old_Node, New_Node : Node_Id) is -- Rewrite_Debugging_Output
+ Node_Is_Watched : constant Boolean := Old_Node = Watch_Node;
+
+ begin
+ if Debug_Flag_N or else Node_Is_Watched then
+ Node_Debug_Output ("Rewrite", Old_Node);
+ Node_Debug_Output ("into", New_Node);
+
+ if Node_Is_Watched then
+ Rewrite_Breakpoint;
+ end if;
+ end if;
+ end rrd;
+
------------------
-- Set_Analyzed --
------------------
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads
index da0b28874c6..11787bc116e 100644
--- a/gcc/ada/atree.ads
+++ b/gcc/ada/atree.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -461,6 +461,12 @@ package Atree is
-- function is used only by Sinfo.CN to change nodes into their
-- corresponding entities.
+ type Report_Proc is access procedure (Target : Node_Id; Source : Node_Id);
+
+ procedure Set_Reporting_Proc (P : Report_Proc);
+ -- Register a procedure that is invoked when a node is allocated, replaced
+ -- or rewritten.
+
type Traverse_Result is (Abandon, OK, OK_Orig, Skip);
-- This is the type of the result returned by the Process function passed
-- to Traverse_Func and Traverse_Proc. See below for details.
@@ -543,8 +549,12 @@ package Atree is
-- Tests given Id for inequality with the Empty node. This allows notations
-- like "if Present (Statement)" as opposed to "if Statement /= Empty".
- -- Node_Kind tests, like the functions in Sinfo, but the first argument is
- -- a Node_Id, and the tested field is Nkind (N).
+ ---------------------
+ -- Node_Kind Tests --
+ ---------------------
+
+ -- These are like the functions in Sinfo, but the first argument is a
+ -- Node_Id, and the tested field is Nkind (N).
function Nkind_In
(N : Node_Id;
@@ -617,6 +627,88 @@ package Atree is
pragma Inline (Nkind_In);
-- Inline all above functions
+ -----------------------
+ -- Entity_Kind_Tests --
+ -----------------------
+
+ -- Utility functions to test whether an Entity_Kind value, either given
+ -- directly as the first argument, or the Ekind field of an Entity give
+ -- as the first argument, matches any of the given list of Entity_Kind
+ -- values. Return True if any match, False if no match.
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (E : Entity_Id;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind;
+ V6 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind) return Boolean;
+
+ function Ekind_In
+ (T : Entity_Kind;
+ V1 : Entity_Kind;
+ V2 : Entity_Kind;
+ V3 : Entity_Kind;
+ V4 : Entity_Kind;
+ V5 : Entity_Kind;
+ V6 : Entity_Kind) return Boolean;
+
+ pragma Inline (Ekind_In);
+ -- Inline all above functions
+
-----------------------------
-- Entity Access Functions --
-----------------------------
diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb
index f23a320d1ae..ee93f140796 100644
--- a/gcc/ada/back_end.adb
+++ b/gcc/ada/back_end.adb
@@ -40,8 +40,29 @@ with Switch.C; use Switch.C;
with System; use System;
with Types; use Types;
+with System.OS_Lib; use System.OS_Lib;
+
package body Back_End is
+ type Arg_Array is array (Nat) of Big_String_Ptr;
+ type Arg_Array_Ptr is access Arg_Array;
+ -- Types to access compiler arguments
+
+ flag_stack_check : Int;
+ pragma Import (C, flag_stack_check);
+ -- Indicates if stack checking is enabled, imported from decl.c
+
+ save_argc : Nat;
+ pragma Import (C, save_argc);
+ -- Saved value of argc (number of arguments), imported from misc.c
+
+ save_argv : Arg_Array_Ptr;
+ pragma Import (C, save_argv);
+ -- Saved value of argv (argument pointers), imported from misc.c
+
+ function Len_Arg (Arg : Pos) return Nat;
+ -- Determine length of argument number Arg on original gnat1 command line
+
-------------------
-- Call_Back_End --
-------------------
@@ -122,37 +143,33 @@ package body Back_End is
gigi_operating_mode => Mode);
end Call_Back_End;
+ -------------
+ -- Len_Arg --
+ -------------
+
+ function Len_Arg (Arg : Pos) return Nat is
+ begin
+ for J in 1 .. Nat'Last loop
+ if save_argv (Arg).all (Natural (J)) = ASCII.NUL then
+ return J - 1;
+ end if;
+ end loop;
+
+ raise Program_Error;
+ end Len_Arg;
+
-----------------------------
-- Scan_Compiler_Arguments --
-----------------------------
procedure Scan_Compiler_Arguments is
- Next_Arg : Pos := 1;
-
- type Arg_Array is array (Nat) of Big_String_Ptr;
- type Arg_Array_Ptr is access Arg_Array;
- flag_stack_check : Int;
- pragma Import (C, flag_stack_check);
- -- Import from toplev.c
-
- save_argc : Nat;
- pragma Import (C, save_argc);
- -- Import from toplev.c
-
- save_argv : Arg_Array_Ptr;
- pragma Import (C, save_argv);
- -- Import from toplev.c
+ Next_Arg : Positive;
+ -- Next argument to be scanned
Output_File_Name_Seen : Boolean := False;
-- Set to True after having scanned file_name for switch "-gnatO file"
- -- Local functions
-
- function Len_Arg (Arg : Pos) return Nat;
- -- Determine length of argument number Arg on the original command line
- -- from gnat1.
-
procedure Scan_Back_End_Switches (Switch_Chars : String);
-- Procedure to scan out switches stored in Switch_Chars. The first
-- character is known to be a valid switch character, and there are no
@@ -165,21 +182,6 @@ package body Back_End is
-- switches must still be scanned to skip "-o" or internal GCC switches
-- with their argument.
- -------------
- -- Len_Arg --
- -------------
-
- function Len_Arg (Arg : Pos) return Nat is
- begin
- for J in 1 .. Nat'Last loop
- if save_argv (Arg).all (Natural (J)) = ASCII.NUL then
- return J - 1;
- end if;
- end loop;
-
- raise Program_Error;
- end Len_Arg;
-
----------------------------
-- Scan_Back_End_Switches --
----------------------------
@@ -222,6 +224,11 @@ package body Back_End is
end if;
end Scan_Back_End_Switches;
+ -- Local variables
+
+ Arg_Count : constant Natural := Natural (save_argc - 1);
+ Args : Argument_List (1 .. Arg_Count);
+
-- Start of processing for Scan_Compiler_Arguments
begin
@@ -229,14 +236,25 @@ package body Back_End is
Opt.Stack_Checking_Enabled := (flag_stack_check /= 0);
- -- Loop through command line arguments, storing them for later access
+ -- Put the arguments in Args
- while Next_Arg < save_argc loop
- Look_At_Arg : declare
- Argv_Ptr : constant Big_String_Ptr := save_argv (Next_Arg);
- Argv_Len : constant Nat := Len_Arg (Next_Arg);
+ for Arg in Pos range 1 .. save_argc - 1 loop
+ declare
+ Argv_Ptr : constant Big_String_Ptr := save_argv (Arg);
+ Argv_Len : constant Nat := Len_Arg (Arg);
Argv : constant String :=
Argv_Ptr (1 .. Natural (Argv_Len));
+ begin
+ Args (Positive (Arg)) := new String'(Argv);
+ end;
+ end loop;
+
+ -- Loop through command line arguments, storing them for later access
+
+ Next_Arg := 1;
+ while Next_Arg <= Args'Last loop
+ Look_At_Arg : declare
+ Argv : constant String := Args (Next_Arg).all;
begin
-- If the previous switch has set the Output_File_Name_Present
@@ -283,7 +301,7 @@ package body Back_End is
Opt.No_Stdlib := True;
elsif Is_Front_End_Switch (Argv) then
- Scan_Front_End_Switches (Argv);
+ Scan_Front_End_Switches (Argv, Args, Next_Arg);
-- All non-front-end switches are back-end switches
@@ -295,5 +313,4 @@ package body Back_End is
Next_Arg := Next_Arg + 1;
end loop;
end Scan_Compiler_Arguments;
-
end Back_End;
diff --git a/gcc/ada/back_end.ads b/gcc/ada/back_end.ads
index 19144a1128d..fb11939a064 100644
--- a/gcc/ada/back_end.ads
+++ b/gcc/ada/back_end.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
diff --git a/gcc/ada/binde.adb b/gcc/ada/binde.adb
index 3a85ae85e11..f4681906df1 100644
--- a/gcc/ada/binde.adb
+++ b/gcc/ada/binde.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -224,25 +224,25 @@ package body Binde is
After : Unit_Id;
R : Succ_Reason;
Ea_Id : Elab_All_Id := No_Elab_All_Link);
- -- Establish a successor link, Before must be elaborated before After,
- -- and the reason for the link is R. Ea_Id is the contents to be placed
- -- in the Elab_All_Link of the entry.
+ -- Establish a successor link, Before must be elaborated before After, and
+ -- the reason for the link is R. Ea_Id is the contents to be placed in the
+ -- Elab_All_Link of the entry.
procedure Choose (Chosen : Unit_Id);
- -- Chosen is the next entry chosen in the elaboration order. This
- -- procedure updates all data structures appropriately.
+ -- Chosen is the next entry chosen in the elaboration order. This procedure
+ -- updates all data structures appropriately.
function Corresponding_Body (U : Unit_Id) return Unit_Id;
pragma Inline (Corresponding_Body);
- -- Given a unit which is a spec for which there is a separate body,
- -- return the unit id of the body. It is an error to call this routine
- -- with a unit that is not a spec, or which does not have a separate body.
+ -- Given a unit which is a spec for which there is a separate body, return
+ -- the unit id of the body. It is an error to call this routine with a unit
+ -- that is not a spec, or which does not have a separate body.
function Corresponding_Spec (U : Unit_Id) return Unit_Id;
pragma Inline (Corresponding_Spec);
- -- Given a unit which is a body for which there is a separate spec,
- -- return the unit id of the spec. It is an error to call this routine
- -- with a unit that is not a body, or which does not have a separate spec.
+ -- Given a unit which is a body for which there is a separate spec, return
+ -- the unit id of the spec. It is an error to call this routine with a unit
+ -- that is not a body, or which does not have a separate spec.
procedure Diagnose_Elaboration_Problem;
-- Called when no elaboration order can be found. Outputs an appropriate
@@ -276,6 +276,10 @@ package body Binde is
pragma Inline (Is_Body_Unit);
-- Determines if given unit is a body
+ function Is_Pure_Or_Preelab_Unit (U : Unit_Id) return Boolean;
+ -- Returns True if corresponding unit is Pure or Preelaborate. Includes
+ -- dealing with testing flags on spec if it is given a body.
+
function Is_Waiting_Body (U : Unit_Id) return Boolean;
pragma Inline (Is_Waiting_Body);
-- Determines if U is a waiting body, defined as a body which has
@@ -286,16 +290,16 @@ package body Binde is
Link : Elab_All_Id) return Elab_All_Id;
-- Make an Elab_All_Entries table entry with the given Unam and Link
- function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id;
- -- This function uses the Info field set in the names table to obtain
- -- the unit Id of a unit, given its name id value.
-
- function Worse_Choice (U1, U2 : Unit_Id) return Boolean;
+ function Pessimistic_Better_Choice (U1, U2 : Unit_Id) return Boolean;
-- This is like Better_Choice, and has the same interface, but returns
- -- true if U1 is a worse choice than U2 in the sense of the -h (horrible
+ -- true if U1 is a worse choice than U2 in the sense of the -p (pessimistic
-- elaboration order) switch. We still have to obey Ada rules, so it is
-- not quite the direct inverse of Better_Choice.
+ function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id;
+ -- This function uses the Info field set in the names table to obtain
+ -- the unit Id of a unit, given its name id value.
+
procedure Write_Dependencies;
-- Write out dependencies (called only if appropriate option is set)
@@ -323,7 +327,7 @@ package body Binde is
-- Note: the checks here are applied in sequence, and the ordering is
-- significant (i.e. the more important criteria are applied first).
- -- Prefer a waiting body to any other case
+ -- Prefer a waiting body to one that is not a waiting body
if Is_Waiting_Body (U1) and then not Is_Waiting_Body (U2) then
if Debug_Flag_B then
@@ -370,6 +374,28 @@ package body Binde is
return False;
+ -- Prefer a pure or preelaborable unit to one that is not
+
+ elsif Is_Pure_Or_Preelab_Unit (U1)
+ and then not
+ Is_Pure_Or_Preelab_Unit (U2)
+ then
+ if Debug_Flag_B then
+ Write_Line (" True: u1 is pure/preelab, u2 is not");
+ end if;
+
+ return True;
+
+ elsif Is_Pure_Or_Preelab_Unit (U2)
+ and then not
+ Is_Pure_Or_Preelab_Unit (U1)
+ then
+ if Debug_Flag_B then
+ Write_Line (" False: u2 is pure/preelab, u1 is not");
+ end if;
+
+ return False;
+
-- Prefer a body to a spec
elsif Is_Body_Unit (U1) and then not Is_Body_Unit (U2) then
@@ -1141,7 +1167,7 @@ package body Binde is
or else ((not Pessimistic_Elab_Order)
and then Better_Choice (U, Best_So_Far))
or else (Pessimistic_Elab_Order
- and then Worse_Choice (U, Best_So_Far))
+ and then Pessimistic_Better_Choice (U, Best_So_Far))
then
if Debug_Flag_N then
Write_Str (" tentatively chosen (best so far)");
@@ -1321,6 +1347,28 @@ package body Binde is
or else Units.Table (U).Utype = Is_Body_Only;
end Is_Body_Unit;
+ -----------------------------
+ -- Is_Pure_Or_Preelab_Unit --
+ -----------------------------
+
+ function Is_Pure_Or_Preelab_Unit (U : Unit_Id) return Boolean is
+ begin
+ -- If we have a body with separate spec, test flags on the spec
+
+ if Units.Table (U).Utype = Is_Body then
+ return Units.Table (U + 1).Preelab
+ or else
+ Units.Table (U + 1).Pure;
+
+ -- Otherwise we have a spec or body acting as spec, test flags on unit
+
+ else
+ return Units.Table (U).Preelab
+ or else
+ Units.Table (U).Pure;
+ end if;
+ end Is_Pure_Or_Preelab_Unit;
+
---------------------
-- Is_Waiting_Body --
---------------------
@@ -1346,51 +1394,115 @@ package body Binde is
return Elab_All_Entries.Last;
end Make_Elab_Entry;
- ----------------
- -- Unit_Id_Of --
- ----------------
-
- function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id is
- Info : constant Int := Get_Name_Table_Info (Uname);
- begin
- pragma Assert (Info /= 0 and then Unit_Id (Info) /= No_Unit_Id);
- return Unit_Id (Info);
- end Unit_Id_Of;
-
- ------------------
- -- Worse_Choice --
- ------------------
+ -------------------------------
+ -- Pessimistic_Better_Choice --
+ -------------------------------
- function Worse_Choice (U1, U2 : Unit_Id) return Boolean is
+ function Pessimistic_Better_Choice (U1, U2 : Unit_Id) return Boolean is
UT1 : Unit_Record renames Units.Table (U1);
UT2 : Unit_Record renames Units.Table (U2);
begin
+ if Debug_Flag_B then
+ Write_Str ("Pessimistic_Better_Choice (");
+ Write_Unit_Name (UT1.Uname);
+ Write_Str (", ");
+ Write_Unit_Name (UT2.Uname);
+ Write_Line (")");
+ end if;
+
-- Note: the checks here are applied in sequence, and the ordering is
-- significant (i.e. the more important criteria are applied first).
- -- If either unit is internal, then use Better_Choice, since the
- -- language requires that predefined units not mess up in the choice
- -- of elaboration order, and for internal units, any problems are
- -- ours and not the programmers.
+ -- If either unit is predefined or internal, then we use the normal
+ -- Better_Choice rule, since we don't want to disturb the elaboration
+ -- rules of the language with -p, same treatment for Pure/Preelab.
+
+ -- Prefer a predefined unit to a non-predefined unit
- if UT1.Internal or else UT2.Internal then
- return Better_Choice (U1, U2);
+ if UT1.Predefined and then not UT2.Predefined then
+ if Debug_Flag_B then
+ Write_Line (" True: u1 is predefined, u2 is not");
+ end if;
- -- Prefer anything else to a waiting body (!)
+ return True;
+
+ elsif UT2.Predefined and then not UT1.Predefined then
+ if Debug_Flag_B then
+ Write_Line (" False: u2 is predefined, u1 is not");
+ end if;
+
+ return False;
+
+ -- Prefer an internal unit to a non-internal unit
+
+ elsif UT1.Internal and then not UT2.Internal then
+ if Debug_Flag_B then
+ Write_Line (" True: u1 is internal, u2 is not");
+ end if;
+
+ return True;
+
+ elsif UT2.Internal and then not UT1.Internal then
+ if Debug_Flag_B then
+ Write_Line (" False: u2 is internal, u1 is not");
+ end if;
+
+ return False;
+
+ -- Prefer a pure or preelaborable unit to one that is not
+
+ elsif Is_Pure_Or_Preelab_Unit (U1)
+ and then not
+ Is_Pure_Or_Preelab_Unit (U2)
+ then
+ if Debug_Flag_B then
+ Write_Line (" True: u1 is pure/preelab, u2 is not");
+ end if;
+
+ return True;
+
+ elsif Is_Pure_Or_Preelab_Unit (U2)
+ and then not
+ Is_Pure_Or_Preelab_Unit (U1)
+ then
+ if Debug_Flag_B then
+ Write_Line (" False: u2 is pure/preelab, u1 is not");
+ end if;
+
+ return False;
+
+ -- Prefer anything else to a waiting body. We want to make bodies wait
+ -- as long as possible, till we are forced to choose them!
elsif Is_Waiting_Body (U1) and then not Is_Waiting_Body (U2) then
+ if Debug_Flag_B then
+ Write_Line (" False: u1 is waiting body, u2 is not");
+ end if;
+
return False;
elsif Is_Waiting_Body (U2) and then not Is_Waiting_Body (U1) then
+ if Debug_Flag_B then
+ Write_Line (" True: u2 is waiting body, u1 is not");
+ end if;
+
return True;
-- Prefer a spec to a body (!)
elsif Is_Body_Unit (U1) and then not Is_Body_Unit (U2) then
+ if Debug_Flag_B then
+ Write_Line (" False: u1 is body, u2 is not");
+ end if;
+
return False;
elsif Is_Body_Unit (U2) and then not Is_Body_Unit (U1) then
+ if Debug_Flag_B then
+ Write_Line (" True: u2 is body, u1 is not");
+ end if;
+
return True;
-- If both are waiting bodies, then prefer the one whose spec is
@@ -1404,12 +1516,24 @@ package body Binde is
-- A before the spec of B if it could. Since it could not, there it
-- must be the case that A depends on B. It is therefore a good idea
-- to put the body of B last so that if there is an elaboration order
- -- problem, we will find it (that's what horrible order is about)
+ -- problem, we will find it (that's what pssimistic order is about)
elsif Is_Waiting_Body (U1) and then Is_Waiting_Body (U2) then
- return
- UNR.Table (Corresponding_Spec (U1)).Elab_Position <
- UNR.Table (Corresponding_Spec (U2)).Elab_Position;
+ declare
+ Result : constant Boolean :=
+ UNR.Table (Corresponding_Spec (U1)).Elab_Position <
+ UNR.Table (Corresponding_Spec (U2)).Elab_Position;
+ begin
+ if Debug_Flag_B then
+ if Result then
+ Write_Line (" True: based on waiting body elab positions");
+ else
+ Write_Line (" False: based on waiting body elab positions");
+ end if;
+ end if;
+
+ return Result;
+ end;
end if;
-- Remaining choice rules are disabled by Debug flag -do
@@ -1420,44 +1544,81 @@ package body Binde is
-- as Elaborate_Body_Desirable. In the normal case, we generally want
-- to delay the elaboration of these specs as long as possible, so
-- that bodies have better chance of being elaborated closer to the
- -- specs. Worse_Choice as usual wants to do the opposite and
- -- elaborate such specs as early as possible.
+ -- specs. Pessimistic_Better_Choice as usual wants to do the opposite
+ -- and elaborate such specs as early as possible.
-- If we have two units, one of which is a spec for which this flag
-- is set, and the other is not, we normally prefer to delay the spec
- -- for which the flag is set, and so Worse_Choice does the opposite.
+ -- for which the flag is set, so again Pessimistic_Better_Choice does
+ -- the opposite.
if not UT1.Elaborate_Body_Desirable
and then UT2.Elaborate_Body_Desirable
then
+ if Debug_Flag_B then
+ Write_Line (" False: u1 is elab body desirable, u2 is not");
+ end if;
+
return False;
elsif not UT2.Elaborate_Body_Desirable
and then UT1.Elaborate_Body_Desirable
then
+ if Debug_Flag_B then
+ Write_Line (" True: u1 is elab body desirable, u2 is not");
+ end if;
+
return True;
-- If we have two specs that are both marked as Elaborate_Body
-- desirable, we normally prefer the one whose body is nearer to
-- being able to be elaborated, based on the Num_Pred count. This
-- helps to ensure bodies are as close to specs as possible. As
- -- usual, Worse_Choice does the opposite.
+ -- usual, Pessimistic_Better_Choice does the opposite.
elsif UT1.Elaborate_Body_Desirable
and then UT2.Elaborate_Body_Desirable
then
- return UNR.Table (Corresponding_Body (U1)).Num_Pred >=
- UNR.Table (Corresponding_Body (U2)).Num_Pred;
+ declare
+ Result : constant Boolean :=
+ UNR.Table (Corresponding_Body (U1)).Num_Pred >=
+ UNR.Table (Corresponding_Body (U2)).Num_Pred;
+ begin
+ if Debug_Flag_B then
+ if Result then
+ Write_Line (" True based on Num_Pred compare");
+ else
+ Write_Line (" False based on Num_Pred compare");
+ end if;
+ end if;
+
+ return Result;
+ end;
end if;
end if;
-- If we fall through, it means that no preference rule applies, so we
-- use alphabetical order to at least give a deterministic result. Since
- -- Worse_Choice is in the business of stirring up the order, we will
- -- use reverse alphabetical ordering.
+ -- Pessimistic_Better_Choice is in the business of stirring up the
+ -- order, we will use reverse alphabetical ordering.
+
+ if Debug_Flag_B then
+ Write_Line (" choose on reverse alpha order");
+ end if;
return Uname_Less (UT2.Uname, UT1.Uname);
- end Worse_Choice;
+ end Pessimistic_Better_Choice;
+
+ ----------------
+ -- Unit_Id_Of --
+ ----------------
+
+ function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id is
+ Info : constant Int := Get_Name_Table_Info (Uname);
+ begin
+ pragma Assert (Info /= 0 and then Unit_Id (Info) /= No_Unit_Id);
+ return Unit_Id (Info);
+ end Unit_Id_Of;
------------------------
-- Write_Dependencies --
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index 182586133ae..3d120161789 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -111,6 +111,7 @@ package body Bindgen is
-- Main_Priority : Integer;
-- Time_Slice_Value : Integer;
+ -- Heap_Size : Natural;
-- WC_Encoding : Character;
-- Locking_Policy : Character;
-- Queuing_Policy : Character;
@@ -136,6 +137,10 @@ package body Bindgen is
-- A value of zero indicates that time slicing should be suppressed. If no
-- pragma is present, and no -T switch was used, the value is -1.
+ -- Heap_Size is the heap to use for memory allocations set by use of a
+ -- -Hnn parameter for the binder or by the GNAT$NO_MALLOC_64 logical.
+ -- Valid values are 32 and 64. This switch is only available on VMS.
+
-- WC_Encoding shows the wide character encoding method used for the main
-- program. This is one of the encoding letters defined in
-- System.WCh_Con.WC_Encoding_Letters.
@@ -615,6 +620,15 @@ package body Bindgen is
WBI (" Features_Set : Integer;");
WBI (" pragma Import (C, Features_Set, " &
"""__gnat_features_set"");");
+
+ if Opt.Heap_Size /= 0 then
+ WBI ("");
+ WBI (" Heap_Size : Integer;");
+ WBI (" pragma Import (C, Heap_Size, " &
+ """__gl_heap_size"");");
+
+ Write_Statement_Buffer;
+ end if;
end if;
-- Initialize stack limit variable of the environment task if the
@@ -786,6 +800,16 @@ package body Bindgen is
WBI (" if Features_Set = 0 then");
WBI (" Set_Features;");
WBI (" end if;");
+
+ -- Features_Set may twiddle the heap size according to a logical
+ -- name, but the binder switch must override.
+
+ if Opt.Heap_Size /= 0 then
+ Set_String (" Heap_Size := ");
+ Set_Int (Opt.Heap_Size);
+ Set_Char (';');
+ Write_Statement_Buffer;
+ end if;
end if;
end if;
@@ -1936,10 +1960,14 @@ package body Bindgen is
WBI ("");
Write_Info_Ada_C ("-- ", "/* ", " BEGIN Object file/option list");
+ if Object_List_Filename /= null then
+ Set_List_File (Object_List_Filename.all);
+ end if;
+
for E in Elab_Order.First .. Elab_Order.Last loop
- -- If not spec that has an associated body, then generate a
- -- comment giving the name of the corresponding object file.
+ -- If not spec that has an associated body, then generate a comment
+ -- giving the name of the corresponding object file.
if (not Units.Table (Elab_Order.Table (E)).SAL_Interface)
and then Units.Table (Elab_Order.Table (E)).Utype /= Is_Spec
@@ -1948,8 +1976,8 @@ package body Bindgen is
(ALIs.Table
(Units.Table (Elab_Order.Table (E)).My_ALI).Ofile_Full_Name);
- -- If the presence of an object file is necessary or if it
- -- exists, then use it.
+ -- If the presence of an object file is necessary or if it exists,
+ -- then use it.
if not Hostparm.Exclude_Missing_Objects
or else
@@ -1971,8 +1999,7 @@ package body Bindgen is
(ALIs.Table
(Units.Table (Elab_Order.Table (E)).My_ALI).Sfile)
then
- -- Special case for g-trasym.obj, which is not included
- -- in libgnat.
+ -- Special case for g-trasym.obj (not included in libgnat)
Get_Name_String (ALIs.Table
(Units.Table (Elab_Order.Table (E)).My_ALI).Sfile);
@@ -1985,6 +2012,10 @@ package body Bindgen is
end if;
end loop;
+ if Object_List_Filename /= null then
+ Close_List_File;
+ end if;
+
-- Add a "-Ldir" for each directory in the object path
for J in 1 .. Nb_Dir_In_Obj_Search_Path loop
@@ -2002,38 +2033,36 @@ package body Bindgen is
-- This sort accomplishes two important purposes:
- -- a) All application files are sorted to the front, and all
- -- GNAT internal files are sorted to the end. This results
- -- in a well defined dividing line between the two sets of
- -- files, for the purpose of inserting certain standard
- -- library references into the linker arguments list.
-
- -- b) Given two different units, we sort the linker options so
- -- that those from a unit earlier in the elaboration order
- -- comes later in the list. This is a heuristic designed
- -- to create a more friendly order of linker options when
- -- the operations appear in separate units. The idea is that
- -- if unit A must be elaborated before unit B, then it is
- -- more likely that B references libraries included by A,
- -- than vice versa, so we want the libraries included by
- -- A to come after the libraries included by B.
-
- -- These two criteria are implemented by function Lt_Linker_Option.
- -- Note that a special case of b) is that specs are elaborated before
- -- bodies, so linker options from specs come after linker options
- -- for bodies, and again, the assumption is that libraries used by
- -- the body are more likely to reference libraries used by the spec,
- -- than vice versa.
+ -- a) All application files are sorted to the front, and all GNAT
+ -- internal files are sorted to the end. This results in a well
+ -- defined dividing line between the two sets of files, for the
+ -- purpose of inserting certain standard library references into
+ -- the linker arguments list.
+
+ -- b) Given two different units, we sort the linker options so that
+ -- those from a unit earlier in the elaboration order comes later
+ -- in the list. This is a heuristic designed to create a more
+ -- friendly order of linker options when the operations appear in
+ -- separate units. The idea is that if unit A must be elaborated
+ -- before unit B, then it is more likely that B references
+ -- libraries included by A, than vice versa, so we want libraries
+ -- included by A to come after libraries included by B.
+
+ -- These two criteria are implemented by function Lt_Linker_Option. Note
+ -- that a special case of b) is that specs are elaborated before bodies,
+ -- so linker options from specs come after linker options for bodies,
+ -- and again, the assumption is that libraries used by the body are more
+ -- likely to reference libraries used by the spec, than vice versa.
Sort
(Linker_Options.Last,
Move_Linker_Option'Access,
Lt_Linker_Option'Access);
- -- Write user linker options, i.e. the set of linker options that
- -- come from all files other than GNAT internal files, Lgnat is
- -- left set to point to the first entry from a GNAT internal file,
- -- or past the end of the entriers if there are no internal files.
+ -- Write user linker options, i.e. the set of linker options that come
+ -- from all files other than GNAT internal files, Lgnat is left set to
+ -- point to the first entry from a GNAT internal file, or past the end
+ -- of the entriers if there are no internal files.
Lgnat := Linker_Options.Last + 1;
@@ -2137,9 +2166,9 @@ package body Bindgen is
Set_PSD_Pragma_Table;
- -- Override Ada_Bind_File and Bind_Main_Program for VMs since
- -- JGNAT only supports Ada code, and the main program is already
- -- generated by the compiler.
+ -- Override Ada_Bind_File and Bind_Main_Program for VMs since JGNAT only
+ -- supports Ada code, and the main program is already generated by the
+ -- compiler.
if VM_Target /= No_VM then
Ada_Bind_File := True;
@@ -2271,8 +2300,7 @@ package body Bindgen is
WBI (" gnat_envp : System.Address;");
-- If the standard library is not suppressed, these variables
- -- are in the runtime data area for easy access from the
- -- runtime.
+ -- are in the run-time data area for easy run time access.
if not Suppress_Standard_Library_On_Target then
WBI ("");
@@ -2467,8 +2495,8 @@ package body Bindgen is
if not Cumulative_Restrictions.Set (No_Finalization) then
- -- In the Java case, pragma Import C cannot be used, so the
- -- standard Ada constructs will be used instead.
+ -- In the Java case, pragma Import C cannot be used, so the standard
+ -- Ada constructs will be used instead.
if VM_Target = No_VM then
WBI ("");
@@ -2623,8 +2651,8 @@ package body Bindgen is
WBI ("extern void __gnat_stack_usage_initialize (int size);");
end if;
- -- Initialize stack limit for the environment task if the stack
- -- check method is stack limit and stack check is enabled.
+ -- Initialize stack limit for the environment task if the stack check
+ -- method is stack limit and stack check is enabled.
if Stack_Check_Limits_On_Target
and then (Stack_Check_Default_On_Target or Stack_Check_Switch_Set)
@@ -2658,8 +2686,8 @@ package body Bindgen is
if Bind_Main_Program then
- -- First deal with argc/argv/envp. In the normal case they
- -- are in the run-time library.
+ -- First deal with argc/argv/envp. In the normal case they are in the
+ -- run-time library.
if not Configurable_Run_Time_On_Target then
WBI ("extern int gnat_argc;");
@@ -2672,8 +2700,8 @@ package body Bindgen is
elsif not Command_Line_Args_On_Target then
null;
- -- Otherwise, in the configurable run-time case they are right in
- -- the binder file.
+ -- Otherwise, in the configurable run-time case they are right in the
+ -- binder file.
else
WBI ("int gnat_argc;");
@@ -2686,8 +2714,8 @@ package body Bindgen is
if not Configurable_Run_Time_On_Target then
WBI ("extern int gnat_exit_status;");
- -- If configurable run time and no exit status on target, then
- -- the generation of this variables is entirely suppressed.
+ -- If configurable run time and no exit status on target, then the
+ -- generation of this variables is entirely suppressed.
elsif not Exit_Status_Supported_On_Target then
null;
@@ -2702,9 +2730,8 @@ package body Bindgen is
WBI ("");
end if;
- -- When suppressing the standard library, the __gnat_break_start
- -- routine (for the debugger to get initial control) is defined in
- -- this file.
+ -- When suppressing the standard library, the __gnat_break_start routine
+ -- (for the debugger to get initial control) is defined in this file.
if Suppress_Standard_Library_On_Target then
WBI ("");
@@ -2728,8 +2755,8 @@ package body Bindgen is
Write_Statement_Buffer;
end if;
- -- Generate the adafinal routine. In no runtime mode, this is
- -- not needed, since there is no finalization to do.
+ -- Generate the adafinal routine. In no runtime mode, this is not
+ -- needed, since there is no finalization to do.
if not Cumulative_Restrictions.Set (No_Finalization) then
Gen_Adafinal_C;
@@ -2969,17 +2996,14 @@ package body Bindgen is
-- Gen_Versions_Ada --
----------------------
- -- This routine generates two sets of lines. The first set has the form:
+ -- This routine generates lines such as:
-- unnnnn : constant Integer := 16#hhhhhhhh#;
-
- -- The second set has the form
-
-- pragma Export (C, unnnnn, unam);
- -- for each unit, where unam is the unit name suffixed by either B or
- -- S for body or spec, with dots replaced by double underscores, and
- -- hhhhhhhh is the version number, and nnnnn is a 5-digits serial number.
+ -- for each unit, where unam is the unit name suffixed by either B or S for
+ -- body or spec, with dots replaced by double underscores, and hhhhhhhh is
+ -- the version number, and nnnnn is a 5-digits serial number.
procedure Gen_Versions_Ada is
Ubuf : String (1 .. 6) := "u00000";
@@ -2999,57 +3023,44 @@ package body Bindgen is
-- Start of processing for Gen_Versions_Ada
begin
- if Bind_For_Library then
-
- -- When building libraries, the version number of each unit can
- -- not be computed, since the binder does not know the full list
- -- of units. Therefore, the 'Version and 'Body_Version
- -- attributes cannot supported in this case.
-
- return;
- end if;
-
WBI ("");
WBI (" type Version_32 is mod 2 ** 32;");
for U in Units.First .. Units.Last loop
- Increment_Ubuf;
- WBI (" " & Ubuf & " : constant Version_32 := 16#" &
- Units.Table (U).Version & "#;");
- end loop;
-
- WBI ("");
- Ubuf := "u00000";
+ if not Units.Table (U).SAL_Interface and then
+ ((not Bind_For_Library) or else Units.Table (U).Directly_Scanned)
+ then
+ Increment_Ubuf;
+ WBI (" " & Ubuf & " : constant Version_32 := 16#" &
+ Units.Table (U).Version & "#;");
+ Set_String (" pragma Export (C, ");
+ Set_String (Ubuf);
+ Set_String (", """);
- for U in Units.First .. Units.Last loop
- Increment_Ubuf;
- Set_String (" pragma Export (C, ");
- Set_String (Ubuf);
- Set_String (", """);
+ Get_Name_String (Units.Table (U).Uname);
- Get_Name_String (Units.Table (U).Uname);
+ for K in 1 .. Name_Len loop
+ if Name_Buffer (K) = '.' then
+ Set_Char ('_');
+ Set_Char ('_');
- for K in 1 .. Name_Len loop
- if Name_Buffer (K) = '.' then
- Set_Char ('_');
- Set_Char ('_');
+ elsif Name_Buffer (K) = '%' then
+ exit;
- elsif Name_Buffer (K) = '%' then
- exit;
+ else
+ Set_Char (Name_Buffer (K));
+ end if;
+ end loop;
+ if Name_Buffer (Name_Len) = 's' then
+ Set_Char ('S');
else
- Set_Char (Name_Buffer (K));
+ Set_Char ('B');
end if;
- end loop;
- if Name_Buffer (Name_Len) = 's' then
- Set_Char ('S');
- else
- Set_Char ('B');
+ Set_String (""");");
+ Write_Statement_Buffer;
end if;
-
- Set_String (""");");
- Write_Statement_Buffer;
end loop;
end Gen_Versions_Ada;
@@ -3062,48 +3073,42 @@ package body Bindgen is
-- unsigned unam = 0xhhhhhhhh;
- -- for each unit, where unam is the unit name suffixed by either B or
- -- S for body or spec, with dots replaced by double underscores.
+ -- for each unit, where unam is the unit name suffixed by either B or S for
+ -- body or spec, with dots replaced by double underscores.
procedure Gen_Versions_C is
begin
- if Bind_For_Library then
-
- -- When building libraries, the version number of each unit can
- -- not be computed, since the binder does not know the full list
- -- of units. Therefore, the 'Version and 'Body_Version
- -- attributes cannot supported.
-
- return;
- end if;
-
for U in Units.First .. Units.Last loop
- Set_String ("unsigned ");
+ if not Units.Table (U).SAL_Interface and then
+ ((not Bind_For_Library) or else Units.Table (U).Directly_Scanned)
+ then
+ Set_String ("unsigned ");
- Get_Name_String (Units.Table (U).Uname);
+ Get_Name_String (Units.Table (U).Uname);
- for K in 1 .. Name_Len loop
- if Name_Buffer (K) = '.' then
- Set_String ("__");
+ for K in 1 .. Name_Len loop
+ if Name_Buffer (K) = '.' then
+ Set_String ("__");
- elsif Name_Buffer (K) = '%' then
- exit;
+ elsif Name_Buffer (K) = '%' then
+ exit;
+ else
+ Set_Char (Name_Buffer (K));
+ end if;
+ end loop;
+
+ if Name_Buffer (Name_Len) = 's' then
+ Set_Char ('S');
else
- Set_Char (Name_Buffer (K));
+ Set_Char ('B');
end if;
- end loop;
- if Name_Buffer (Name_Len) = 's' then
- Set_Char ('S');
- else
- Set_Char ('B');
+ Set_String (" = 0x");
+ Set_String (Units.Table (U).Version);
+ Set_Char (';');
+ Write_Statement_Buffer;
end if;
-
- Set_String (" = 0x");
- Set_String (Units.Table (U).Version);
- Set_Char (';');
- Write_Statement_Buffer;
end loop;
end Gen_Versions_C;
@@ -3207,9 +3212,9 @@ package body Bindgen is
Get_Name_String (Units.Table (First_Unit_Entry).Uname);
- -- If this is a child name, return only the name of the child,
- -- since we can't have dots in a nested program name. Note that
- -- we do not include the %b at the end of the unit name.
+ -- If this is a child name, return only the name of the child, since
+ -- we can't have dots in a nested program name. Note that we do not
+ -- include the %b at the end of the unit name.
for J in reverse 1 .. Name_Len - 2 loop
if J = 1 or else Name_Buffer (J - 1) = '.' then
@@ -3241,12 +3246,12 @@ package body Bindgen is
-- no better choice. If some other encoding is required when there is
-- no main, it must be set explicitly using -Wx.
- -- Note: if the ALI file always passed the wide character encoding
- -- of every file, then we could use the encoding of the initial
- -- specified file, but this information is passed only for potential
- -- main programs. We could fix this sometime, but it is a very minor
- -- point (wide character default encoding for [Wide_[Wide_]Text_IO
- -- when there is no main program).
+ -- Note: if the ALI file always passed the wide character encoding of
+ -- every file, then we could use the encoding of the initial specified
+ -- file, but this information is passed only for potential main
+ -- programs. We could fix this sometime, but it is a very minor point
+ -- (wide character default encoding for [Wide_[Wide_]Text_IO when there
+ -- is no main program).
elsif No_Main_Subprogram then
return 'b';
@@ -3277,8 +3282,8 @@ package body Bindgen is
Linker_Options.Table (Op2).Internal_File;
-- If both internal or both non-internal, sort according to the
- -- elaboration position. A unit that is elaborated later should
- -- come earlier in the linker options list.
+ -- elaboration position. A unit that is elaborated later should come
+ -- earlier in the linker options list.
else
return Units.Table (Linker_Options.Table (Op1).Unit).Elab_Position
@@ -3307,9 +3312,9 @@ package body Bindgen is
Get_Name_String (Units.Table (Elab_Order.Table (E)).Uname);
-- This is not a perfect approach, but is the current protocol
- -- between the run-time and the binder to indicate that tasking
- -- is used: system.os_interface should always be used by any
- -- tasking application.
+ -- between the run-time and the binder to indicate that tasking is
+ -- used: system.os_interface should always be used by any tasking
+ -- application.
if Name_Buffer (1 .. 19) = "system.os_interface" then
With_GNARL := True;
diff --git a/gcc/ada/bindgen.ads b/gcc/ada/bindgen.ads
index 1bce36d4bb2..96d2e306888 100644
--- a/gcc/ada/bindgen.ads
+++ b/gcc/ada/bindgen.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -24,7 +24,7 @@
------------------------------------------------------------------------------
-- This package contains the routines to output the binder file. This is
--- a C program which contains the following:
+-- an Ada or C program which contains the following:
-- initialization for main program case
-- sequence of calls to elaboration routines in appropriate order
diff --git a/gcc/ada/bindusg.adb b/gcc/ada/bindusg.adb
index 2529c351cf1..06fa354d414 100644
--- a/gcc/ada/bindusg.adb
+++ b/gcc/ada/bindusg.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -73,9 +73,9 @@ package body Bindusg is
Write_Line (" -a Automatically initialize elaboration " &
"procedure");
- -- Line for A switch
+ -- Line for -A switch
- Write_Line (" -A Generate binder program in Ada (default)");
+ Write_Line (" -A Give list of ALI files in partition");
-- Line for -b switch
@@ -87,10 +87,6 @@ package body Bindusg is
Write_Line (" -c Check only, no generation of " &
"binder output file");
- -- Line for C switch
-
- Write_Line (" -C Generate binder program in C");
-
-- Line for -d switch
Write_Line (" -dnn[k|m] Default primary stack " &
@@ -120,6 +116,11 @@ package body Bindusg is
Write_Line (" -h Output this usage (help) information");
+ -- Line for -H switch
+
+ Write_Line (" -Hnn Use nn bit heap where nn is 32 or 64 " &
+ "(VMS Only)");
+
-- Lines for -I switch
Write_Line (" -Idir Specify library and source files search path");
@@ -185,7 +186,7 @@ package body Bindusg is
-- Line for -R switch
Write_Line
- (" -R List sources referenced in closure (implies -c)");
+ (" -R List sources referenced in closure");
-- Line for -s switch
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index ff511665b73..59270e875a9 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -1084,6 +1084,11 @@ package body Checks is
Cond : Node_Id;
T_Typ : Entity_Id;
+ function Denotes_Explicit_Dereference (Obj : Node_Id) return Boolean;
+ -- A heap object with an indefinite subtype is constrained by its
+ -- initial value, and assigning to it requires a constraint_check.
+ -- The target may be an explicit dereference, or a renaming of one.
+
function Is_Aliased_Unconstrained_Component return Boolean;
-- It is possible for an aliased component to have a nominal
-- unconstrained subtype (through instantiation). If this is a
@@ -1091,6 +1096,21 @@ package body Checks is
-- in an initialization, the check must be suppressed. This unusual
-- situation requires a predicate of its own.
+ ----------------------------------
+ -- Denotes_Explicit_Dereference --
+ ----------------------------------
+
+ function Denotes_Explicit_Dereference (Obj : Node_Id) return Boolean is
+ begin
+ return
+ Nkind (Obj) = N_Explicit_Dereference
+ or else
+ (Is_Entity_Name (Obj)
+ and then Present (Renamed_Object (Entity (Obj)))
+ and then Nkind (Renamed_Object (Entity (Obj))) =
+ N_Explicit_Dereference);
+ end Denotes_Explicit_Dereference;
+
----------------------------------------
-- Is_Aliased_Unconstrained_Component --
----------------------------------------
@@ -1164,7 +1184,7 @@ package body Checks is
-- Ada 2005 (AI-363): For Ada 2005, we limit the building of the actual
-- subtype to the parameter and dereference cases, since other aliased
-- objects are unconstrained (unless the nominal subtype is explicitly
- -- constrained). (But we also need to test for renamings???)
+ -- constrained).
if Present (Lhs)
and then (Present (Param_Entity (Lhs))
@@ -1174,7 +1194,7 @@ package body Checks is
and then not Is_Aliased_Unconstrained_Component)
or else (Ada_Version >= Ada_05
and then not Is_Constrained (T_Typ)
- and then Nkind (Lhs) = N_Explicit_Dereference
+ and then Denotes_Explicit_Dereference (Lhs)
and then Nkind (Original_Node (Lhs)) /=
N_Function_Call))
then
@@ -1564,9 +1584,7 @@ package body Checks is
pragma Assert (Target_Base /= Target_Typ);
- Temp : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Temp : constant Entity_Id := Make_Temporary (Loc, 'T', Par);
begin
Apply_Float_Conversion_Check (Ck_Node, Target_Base);
@@ -2723,9 +2741,11 @@ package body Checks is
end case;
if K = N_Op_And then
- Error_Msg_N ("use `AND THEN` instead of AND?", P);
+ Error_Msg_N -- CODEFIX
+ ("use `AND THEN` instead of AND?", P);
else
- Error_Msg_N ("use `OR ELSE` instead of OR?", P);
+ Error_Msg_N -- CODEFIX
+ ("use `OR ELSE` instead of OR?", P);
end if;
-- If not short-circuited, we need the ckeck
@@ -3331,6 +3351,14 @@ package body Checks is
Indx := Next_Index (Indx);
end loop;
+ -- If the index type is a formal type or derived from
+ -- one, the bounds are not static.
+
+ if Is_Generic_Type (Root_Type (Etype (Indx))) then
+ OK := False;
+ return;
+ end if;
+
Determine_Range
(Type_Low_Bound (Etype (Indx)), OK1, LL, LU,
Assume_Valid);
@@ -3350,8 +3378,8 @@ package body Checks is
-- For constrained arrays, the minimum value for
-- Length is taken from the actual value of the
- -- bounds, since the index will be exactly of
- -- this subtype.
+ -- bounds, since the index will be exactly of this
+ -- subtype.
if Is_Constrained (Atyp) then
Lor := UI_Max (Uint_0, UL - LU + 1);
@@ -3367,7 +3395,7 @@ package body Checks is
end;
-- No special handling for other attributes
- -- Probably more opportunities exist here ???
+ -- Probably more opportunities exist here???
when others =>
OK1 := False;
@@ -3388,33 +3416,31 @@ package body Checks is
Hir := No_Uint;
end case;
- -- At this stage, if OK1 is true, then we know that the actual
- -- result of the computed expression is in the range Lor .. Hir.
- -- We can use this to restrict the possible range of results.
+ -- At this stage, if OK1 is true, then we know that the actual result of
+ -- the computed expression is in the range Lor .. Hir. We can use this
+ -- to restrict the possible range of results.
if OK1 then
- -- If the refined value of the low bound is greater than the
- -- type high bound, then reset it to the more restrictive
- -- value. However, we do NOT do this for the case of a modular
- -- type where the possible upper bound on the value is above the
- -- base type high bound, because that means the result could wrap.
+ -- If the refined value of the low bound is greater than the type
+ -- high bound, then reset it to the more restrictive value. However,
+ -- we do NOT do this for the case of a modular type where the
+ -- possible upper bound on the value is above the base type high
+ -- bound, because that means the result could wrap.
if Lor > Lo
- and then not (Is_Modular_Integer_Type (Typ)
- and then Hir > Hbound)
+ and then not (Is_Modular_Integer_Type (Typ) and then Hir > Hbound)
then
Lo := Lor;
end if;
- -- Similarly, if the refined value of the high bound is less
- -- than the value so far, then reset it to the more restrictive
- -- value. Again, we do not do this if the refined low bound is
- -- negative for a modular type, since this would wrap.
+ -- Similarly, if the refined value of the high bound is less than the
+ -- value so far, then reset it to the more restrictive value. Again,
+ -- we do not do this if the refined low bound is negative for a
+ -- modular type, since this would wrap.
if Hir < Hi
- and then not (Is_Modular_Integer_Type (Typ)
- and then Lor < Uint_0)
+ and then not (Is_Modular_Integer_Type (Typ) and then Lor < Uint_0)
then
Hi := Hir;
end if;
@@ -3428,8 +3454,8 @@ package body Checks is
Determine_Range_Cache_Hi (Cindex) := Hi;
return;
- -- If any exception occurs, it means that we have some bug in the compiler
- -- possibly triggered by a previous error, or by some unforseen peculiar
+ -- If any exception occurs, it means that we have some bug in the compiler,
+ -- possibly triggered by a previous error, or by some unforeseen peculiar
-- occurrence. However, this is only an optimization attempt, so there is
-- really no point in crashing the compiler. Instead we just decide, too
-- bad, we can't figure out a range in this case after all.
@@ -4687,9 +4713,7 @@ package body Checks is
-- Then the conversion itself is replaced by an occurrence of Tnn
declare
- Tnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', N);
begin
Insert_Actions (N, New_List (
@@ -4840,9 +4864,7 @@ package body Checks is
-- the value is non-negative
declare
- Tnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', N);
begin
Insert_Actions (N, New_List (
@@ -5279,6 +5301,16 @@ package body Checks is
return False;
end if;
+ -- If we are in a case eexpression, and not part of the
+ -- expression, then we return False, since a particular
+ -- branch may not always be elaborated
+
+ if Nkind (P) = N_Case_Expression
+ and then N /= Expression (P)
+ then
+ return False;
+ end if;
+
-- While traversing the parent chain, we find that N
-- belongs to a statement, thus it may never appear in
-- a declarative region.
@@ -6223,11 +6255,18 @@ package body Checks is
-- Expr > Typ'Last
function Get_E_First_Or_Last
- (E : Entity_Id;
+ (Loc : Source_Ptr;
+ E : Entity_Id;
Indx : Nat;
Nam : Name_Id) return Node_Id;
- -- Returns expression to compute:
+ -- Returns an attribute reference
-- E'First or E'Last
+ -- with a source location of Loc.
+ --
+ -- Nam is Name_First or Name_Last, according to which attribute is
+ -- desired. If Indx is non-zero, it is passed as a literal in the
+ -- Expressions of the attribute reference (identifying the desired
+ -- array dimension).
function Get_N_First (N : Node_Id; Indx : Nat) return Node_Id;
function Get_N_Last (N : Node_Id; Indx : Nat) return Node_Id;
@@ -6294,7 +6333,7 @@ package body Checks is
Duplicate_Subexpr_No_Checks (Expr)),
Right_Opnd =>
Convert_To (Base_Type (Typ),
- Get_E_First_Or_Last (Typ, 0, Name_First))),
+ Get_E_First_Or_Last (Loc, Typ, 0, Name_First))),
Right_Opnd =>
Make_Op_Gt (Loc,
@@ -6304,7 +6343,7 @@ package body Checks is
Right_Opnd =>
Convert_To
(Base_Type (Typ),
- Get_E_First_Or_Last (Typ, 0, Name_Last))));
+ Get_E_First_Or_Last (Loc, Typ, 0, Name_Last))));
end Discrete_Expr_Cond;
-------------------------
@@ -6342,7 +6381,8 @@ package body Checks is
Right_Opnd =>
Convert_To
- (Base_Type (Typ), Get_E_First_Or_Last (Typ, 0, Name_First)));
+ (Base_Type (Typ),
+ Get_E_First_Or_Last (Loc, Typ, 0, Name_First)));
if Base_Type (Typ) = Typ then
return Left_Opnd;
@@ -6377,7 +6417,7 @@ package body Checks is
Right_Opnd =>
Convert_To
(Base_Type (Typ),
- Get_E_First_Or_Last (Typ, 0, Name_Last)));
+ Get_E_First_Or_Last (Loc, Typ, 0, Name_Last)));
return Make_Or_Else (Loc, Left_Opnd, Right_Opnd);
end Discrete_Range_Cond;
@@ -6387,115 +6427,23 @@ package body Checks is
-------------------------
function Get_E_First_Or_Last
- (E : Entity_Id;
+ (Loc : Source_Ptr;
+ E : Entity_Id;
Indx : Nat;
Nam : Name_Id) return Node_Id
is
- N : Node_Id;
- LB : Node_Id;
- HB : Node_Id;
- Bound : Node_Id;
-
+ Exprs : List_Id;
begin
- if Is_Array_Type (E) then
- N := First_Index (E);
-
- for J in 2 .. Indx loop
- Next_Index (N);
- end loop;
-
- else
- N := Scalar_Range (E);
- end if;
-
- if Nkind (N) = N_Subtype_Indication then
- LB := Low_Bound (Range_Expression (Constraint (N)));
- HB := High_Bound (Range_Expression (Constraint (N)));
-
- elsif Is_Entity_Name (N) then
- LB := Type_Low_Bound (Etype (N));
- HB := Type_High_Bound (Etype (N));
-
- else
- LB := Low_Bound (N);
- HB := High_Bound (N);
- end if;
-
- if Nam = Name_First then
- Bound := LB;
+ if Indx > 0 then
+ Exprs := New_List (Make_Integer_Literal (Loc, UI_From_Int (Indx)));
else
- Bound := HB;
+ Exprs := No_List;
end if;
- if Nkind (Bound) = N_Identifier
- and then Ekind (Entity (Bound)) = E_Discriminant
- then
- -- If this is a task discriminant, and we are the body, we must
- -- retrieve the corresponding body discriminal. This is another
- -- consequence of the early creation of discriminals, and the
- -- need to generate constraint checks before their declarations
- -- are made visible.
-
- if Is_Concurrent_Record_Type (Scope (Entity (Bound))) then
- declare
- Tsk : constant Entity_Id :=
- Corresponding_Concurrent_Type
- (Scope (Entity (Bound)));
- Disc : Entity_Id;
-
- begin
- if In_Open_Scopes (Tsk)
- and then Has_Completion (Tsk)
- then
- -- Find discriminant of original task, and use its
- -- current discriminal, which is the renaming within
- -- the task body.
-
- Disc := First_Discriminant (Tsk);
- while Present (Disc) loop
- if Chars (Disc) = Chars (Entity (Bound)) then
- Set_Scope (Discriminal (Disc), Tsk);
- return New_Occurrence_Of (Discriminal (Disc), Loc);
- end if;
-
- Next_Discriminant (Disc);
- end loop;
-
- -- That loop should always succeed in finding a matching
- -- entry and returning. Fatal error if not.
-
- raise Program_Error;
-
- else
- return
- New_Occurrence_Of (Discriminal (Entity (Bound)), Loc);
- end if;
- end;
- else
- return New_Occurrence_Of (Discriminal (Entity (Bound)), Loc);
- end if;
-
- elsif Nkind (Bound) = N_Identifier
- and then Ekind (Entity (Bound)) = E_In_Parameter
- and then not Inside_Init_Proc
- then
- return Get_Discriminal (E, Bound);
-
- elsif Nkind (Bound) = N_Integer_Literal then
- return Make_Integer_Literal (Loc, Intval (Bound));
-
- -- Case of a bound rewritten to an N_Raise_Constraint_Error node
- -- because it is an out-of-range value. Duplicate_Subexpr cannot be
- -- called on this node because an N_Raise_Constraint_Error is not
- -- side effect free, and we may not assume that we are in the proper
- -- context to remove side effects on it at the point of reference.
-
- elsif Nkind (Bound) = N_Raise_Constraint_Error then
- return New_Copy_Tree (Bound);
-
- else
- return Duplicate_Subexpr_No_Checks (Bound);
- end if;
+ return Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (E, Loc),
+ Attribute_Name => Nam,
+ Expressions => Exprs);
end Get_E_First_Or_Last;
-----------------
@@ -6542,13 +6490,17 @@ package body Checks is
Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Lt (Loc,
- Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_First),
- Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_First)),
+ Left_Opnd =>
+ Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_First),
+ Right_Opnd =>
+ Get_E_First_Or_Last (Loc, Typ, Indx, Name_First)),
Right_Opnd =>
Make_Op_Gt (Loc,
- Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_Last),
- Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_Last)));
+ Left_Opnd =>
+ Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_Last),
+ Right_Opnd =>
+ Get_E_First_Or_Last (Loc, Typ, Indx, Name_Last)));
end Range_E_Cond;
------------------------
@@ -6565,12 +6517,17 @@ package body Checks is
Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Ne (Loc,
- Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_First),
- Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_First)),
+ Left_Opnd =>
+ Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_First),
+ Right_Opnd =>
+ Get_E_First_Or_Last (Loc, Typ, Indx, Name_First)),
+
Right_Opnd =>
Make_Op_Ne (Loc,
- Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_Last),
- Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_Last)));
+ Left_Opnd =>
+ Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_Last),
+ Right_Opnd =>
+ Get_E_First_Or_Last (Loc, Typ, Indx, Name_Last)));
end Range_Equal_E_Cond;
------------------
@@ -6587,13 +6544,17 @@ package body Checks is
Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Lt (Loc,
- Left_Opnd => Get_N_First (Expr, Indx),
- Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_First)),
+ Left_Opnd =>
+ Get_N_First (Expr, Indx),
+ Right_Opnd =>
+ Get_E_First_Or_Last (Loc, Typ, Indx, Name_First)),
Right_Opnd =>
Make_Op_Gt (Loc,
- Left_Opnd => Get_N_Last (Expr, Indx),
- Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_Last)));
+ Left_Opnd =>
+ Get_N_Last (Expr, Indx),
+ Right_Opnd =>
+ Get_E_First_Or_Last (Loc, Typ, Indx, Name_Last)));
end Range_N_Cond;
-- Start of processing for Selected_Range_Checks
diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb
index 978a5e7006f..54497274f2d 100644
--- a/gcc/ada/clean.adb
+++ b/gcc/ada/clean.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2010, 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- --
@@ -1677,6 +1677,9 @@ package body Clean is
new String'
(Arg (Subdirs_Option'Length + 1 .. Arg'Last));
+ elsif Arg = Makeutl.Unchecked_Shared_Lib_Imports then
+ Opt.Unchecked_Shared_Lib_Imports := True;
+
else
Bad_Argument;
end if;
@@ -1957,6 +1960,8 @@ package body Clean is
New_Line;
Put_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs");
+ Put_Line (" " & Makeutl.Unchecked_Shared_Lib_Imports);
+ Put_Line (" Allow shared libraries to import static libraries");
New_Line;
Put_Line (" -c Only delete compiler generated files");
diff --git a/gcc/ada/csets.adb b/gcc/ada/csets.adb
index cd3e0b55a3f..771affc3be0 100644
--- a/gcc/ada/csets.adb
+++ b/gcc/ada/csets.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -618,9 +618,9 @@ package body Csets is
-- Definitions for IBM PC (Code Page 437) --
--------------------------------------------
- -- Note: Code page 437 is the typical default in DOS, Windows and OS/2
- -- for PC's in the US, it corresponds to the original PC character set.
- -- See also the definitions for code page 850.
+ -- Note: Code page 437 is the typical default in Windows for PC's in the
+ -- US, it corresponds to the original PC character set. See also the
+ -- definitions for code page 850.
Fold_IBM_PC_437 : constant Translate_Table := Translate_Table'(
@@ -752,10 +752,10 @@ package body Csets is
-- Definitions for IBM PC (Code Page 850) --
--------------------------------------------
- -- Note: Code page 850 is the typical default in DOS, Windows and OS/2
- -- for PC's in Europe, it is an extension of the original PC character
- -- set to include the additional characters defined in ISO Latin-1.
- -- See also the definitions for code page 437.
+ -- Note: Code page 850 is the typical default in Windows for PC's in
+ -- Europe, it is an extension of the original PC character set to include
+ -- the additional characters defined in ISO Latin-1. See also the
+ -- definitions for code page 437.
Fold_IBM_PC_850 : constant Translate_Table := Translate_Table'(
diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb
index d6f0ff09cea..9f9332b7241 100644
--- a/gcc/ada/cstand.adb
+++ b/gcc/ada/cstand.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -287,11 +287,10 @@ package body CStand is
Set_Etype (Last_Entity (Standard_Op_Concatw), Standard_Wide_String);
Set_Etype (First_Entity (Standard_Op_Concatww),
- Standard_Wide_Wide_String);
+ Standard_Wide_Wide_String);
Set_Etype (Last_Entity (Standard_Op_Concatww),
- Standard_Wide_Wide_String);
-
+ Standard_Wide_Wide_String);
end Create_Operators;
---------------------
@@ -324,6 +323,10 @@ package body CStand is
procedure Build_Exception (S : Standard_Entity_Type);
-- Procedure to declare given entity as an exception
+ procedure Pack_String_Type (String_Type : Entity_Id);
+ -- Generate proper tree for pragma Pack that applies to given type, and
+ -- mark type as having the pragma.
+
---------------------
-- Build_Exception --
---------------------
@@ -341,6 +344,25 @@ package body CStand is
Append (Decl, Decl_S);
end Build_Exception;
+ ----------------------
+ -- Pack_String_Type --
+ ----------------------
+
+ procedure Pack_String_Type (String_Type : Entity_Id) is
+ Prag : constant Node_Id :=
+ Make_Pragma (Stloc,
+ Chars => Name_Pack,
+ Pragma_Argument_Associations =>
+ New_List (
+ Make_Pragma_Argument_Association (Stloc,
+ Expression =>
+ New_Occurrence_Of (String_Type, Stloc))));
+ begin
+ Append (Prag, Decl_S);
+ Record_Rep_Item (String_Type, Prag);
+ Set_Has_Pragma_Pack (String_Type, True);
+ end Pack_String_Type;
+
-- Start of processing for Create_Standard
begin
@@ -688,12 +710,13 @@ package body CStand is
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_String), Tdef_Node);
- Set_Ekind (Standard_String, E_String_Type);
- Set_Etype (Standard_String, Standard_String);
- Set_Component_Type (Standard_String, Standard_Character);
- Set_Component_Size (Standard_String, Uint_8);
- Init_Size_Align (Standard_String);
- Set_Alignment (Standard_String, Uint_1);
+ Set_Ekind (Standard_String, E_String_Type);
+ Set_Etype (Standard_String, Standard_String);
+ Set_Component_Type (Standard_String, Standard_Character);
+ Set_Component_Size (Standard_String, Uint_8);
+ Init_Size_Align (Standard_String);
+ Set_Alignment (Standard_String, Uint_1);
+ Pack_String_Type (Standard_String);
-- On targets where a storage unit is larger than a byte (such as AAMP),
-- pragma Pack has a real effect on the representation of type String,
@@ -731,11 +754,12 @@ package body CStand is
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_Wide_String), Tdef_Node);
- Set_Ekind (Standard_Wide_String, E_String_Type);
- Set_Etype (Standard_Wide_String, Standard_Wide_String);
- Set_Component_Type (Standard_Wide_String, Standard_Wide_Character);
- Set_Component_Size (Standard_Wide_String, Uint_16);
- Init_Size_Align (Standard_Wide_String);
+ Set_Ekind (Standard_Wide_String, E_String_Type);
+ Set_Etype (Standard_Wide_String, Standard_Wide_String);
+ Set_Component_Type (Standard_Wide_String, Standard_Wide_Character);
+ Set_Component_Size (Standard_Wide_String, Uint_16);
+ Init_Size_Align (Standard_Wide_String);
+ Pack_String_Type (Standard_Wide_String);
-- Set index type of Wide_String
@@ -772,6 +796,7 @@ package body CStand is
Set_Component_Size (Standard_Wide_Wide_String, Uint_32);
Init_Size_Align (Standard_Wide_Wide_String);
Set_Is_Ada_2005_Only (Standard_Wide_Wide_String);
+ Pack_String_Type (Standard_Wide_Wide_String);
-- Set index type of Wide_Wide_String
diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c
index d57b382a7fb..9dea9a4f13e 100644
--- a/gcc/ada/cstreams.c
+++ b/gcc/ada/cstreams.c
@@ -6,7 +6,7 @@
* *
* Auxiliary C functions for Interfaces.C.Streams *
* *
- * Copyright (C) 1992-2009, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2010, 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- *
@@ -98,15 +98,6 @@ __gnat_is_regular_file_fd (int fd)
int ret;
GNAT_STRUCT_STAT statbuf;
-#ifdef __EMX__
- /* Programs using screen I/O may need to reset the FPU after
- initialization of screen-handling related DLL's, so force
- DLL initialization by doing a null-write and then reset the FPU */
-
- DosWrite (0, &ret, 0, &ret);
- __gnat_init_float();
-#endif
-
ret = GNAT_FSTAT (fd, &statbuf);
return (!ret && S_ISREG (statbuf.st_mode));
}
@@ -166,9 +157,9 @@ __gnat_full_name (char *nam, char *buffer)
else
buffer[0] = '\0';
-#elif defined(__EMX__) || defined (__MINGW32__)
- /* If this is a device file return it as is; under Windows NT and
- OS/2 a device file end with ":". */
+#elif defined (__MINGW32__)
+ /* If this is a device file return it as is;
+ under Windows NT a device file ends with ":". */
if (nam[strlen (nam) - 1] == ':')
strcpy (buffer, nam);
else
@@ -182,9 +173,6 @@ __gnat_full_name (char *nam, char *buffer)
*p = '\\';
}
-#elif defined (MSDOS)
- _fixpath (nam, buffer);
-
#elif defined (sgi) || defined (__FreeBSD__)
/* Use realpath function which resolves links and references to . and ..
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index ca207b2e4d8..b7f750d506f 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -76,7 +76,7 @@ package body Debug is
-- dJ Output debugging trace info for JGNAT (Java VM version of GNAT)
-- dK Kill all error messages
-- dL Output trace information on elaboration checking
- -- dM Asssume all variables are modified (no current values)
+ -- dM Assume all variables are modified (no current values)
-- dN No file name information in exception messages
-- dO Output immediate error messages
-- dP Do not check for controlled objects in preelaborable packages
@@ -113,7 +113,7 @@ package body Debug is
-- d.t Disable static allocation of library level dispatch tables
-- d.u
-- d.v Enable OK_To_Reorder_Components in variant records
- -- d.w Do not check for infinite while loops
+ -- d.w Do not check for infinite loops
-- d.x No exception handlers
-- d.y
-- d.z
@@ -129,7 +129,7 @@ package body Debug is
-- d.I SCIL generation mode
-- d.J Parallel SCIL generation mode
-- d.K
- -- d.L
+ -- d.L Depend on back end for limited types in conditional expressions
-- d.M
-- d.N
-- d.O Dump internal SCO tables
@@ -141,9 +141,9 @@ package body Debug is
-- d.U
-- d.V
-- d.W Print out debugging information for Walk_Library_Items
- -- d.X
- -- d.Y
- -- d.Z
+ -- d.X Use Expression_With_Actions
+ -- d.Y Do not use Expression_With_Actions
+ -- d.Z Generate call-graph information
-- d1 Error msgs have node numbers where possible
-- d2 Eliminate error flags in verbose form error messages
@@ -548,7 +548,7 @@ package body Debug is
-- d.v Forces the flag OK_To_Reorder_Components to be set in all record
-- base types that have at least one discriminant (v = variant).
- -- d.w This flag turns off the scanning of while loops to detect possible
+ -- d.w This flag turns off the scanning of loops to detect possible
-- infinite loops.
-- d.x No exception handlers in generated code. This causes exception
@@ -567,6 +567,11 @@ package body Debug is
-- This means in particular not writing the same files under the
-- same directory.
+ -- d.L Normally the front end generates special expansion for conditional
+ -- expressions of a limited type. This debug flag removes this special
+ -- case expansion, leaving it up to the back end to handle conditional
+ -- expressions correctly.
+
-- d.O Dump internal SCO tables. Before outputting the SCO information to
-- the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table)
-- are dumped for debugging purposes.
@@ -579,6 +584,24 @@ package body Debug is
-- the order in which units are walked. This is primarily for SofCheck
-- Inspector.
+ -- d.X By default, the compiler uses an elaborate rewriting framework for
+ -- short-circuited forms where the right hand condition generates
+ -- actions to be inserted. With the gcc backend, we now use the new
+ -- N_Expression_With_Actions node for this expansion, but we still use
+ -- the old method for other backends and in SCIL mode. This debug flag
+ -- forces use of the new N_Expression_With_Actions node in these other
+ -- cases and is intended for transitional use.
+
+ -- d.Y Prevents the use of the N_Expression_With_Actions node even in the
+ -- case of the gcc back end. Provided as a back up in case the new
+ -- scheme has problems.
+
+ -- d.Z This flag enables the frontend call-graph output associated with
+ -- dispatching calls. This is a temporary debug flag to be used during
+ -- development of this output. Once it works, it will always be output
+ -- (as part of the standard call-graph output) by default, and this
+ -- flag will be removed.
+
-- d1 Error messages have node numbers where possible. Normally error
-- messages have only source locations. This option is useful when
-- debugging errors caused by expanded code, where the source location
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index fdc9d276c6a..f1145a1ac07 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -79,6 +79,7 @@ package body Einfo is
-- Normalized_First_Bit Uint8
-- Postcondition_Proc Node8
-- Return_Applies_To Node8
+ -- First_Exit_Statement Node8
-- Class_Wide_Type Node9
-- Current_Value Node9
@@ -207,7 +208,6 @@ package body Einfo is
-- Related_Expression Node24
-- Spec_PPC_List Node24
- -- Underlying_Record_View Node24
-- Interface_Alias Node25
-- Interfaces Elist25
@@ -227,6 +227,7 @@ package body Einfo is
-- Wrapped_Entity Node27
-- Extra_Formals Node28
+ -- Underlying_Record_View Node28
---------------------------------------------
-- Usage of Flags in Defining Entity Nodes --
@@ -454,9 +455,6 @@ package body Einfo is
-- Is_Primitive_Wrapper Flag195
-- Was_Hidden Flag196
-- Is_Limited_Interface Flag197
- -- Is_Protected_Interface Flag198
- -- Is_Synchronized_Interface Flag199
- -- Is_Task_Interface Flag200
-- Has_Anon_Block_Suffix Flag201
-- Itype_Printed Flag202
@@ -510,6 +508,10 @@ package body Einfo is
-- Is_Underlying_Record_View Flag246
-- OK_To_Rename Flag247
+ -- (unused) Flag198
+ -- (unused) Flag199
+ -- (unused) Flag200
+
-----------------------
-- Local subprograms --
-----------------------
@@ -558,9 +560,7 @@ package body Einfo is
function Actual_Subtype (Id : E) return E is
begin
pragma Assert
- (Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable
- or else Ekind (Id) = E_Generic_In_Out_Parameter
+ (Ekind_In (Id, E_Constant, E_Variable, E_Generic_In_Out_Parameter)
or else Is_Formal (Id));
return Node17 (Id);
end Actual_Subtype;
@@ -570,6 +570,18 @@ package body Einfo is
return Flag104 (Id);
end Address_Taken;
+ function Aft_Value (Id : E) return U is
+ Result : Nat := 1;
+ Delta_Val : Ureal := Delta_Value (Id);
+ begin
+ while Delta_Val < Ureal_Tenth loop
+ Delta_Val := Delta_Val * Ureal_10;
+ Result := Result + 1;
+ end loop;
+
+ return UI_From_Int (Result);
+ end Aft_Value;
+
function Alias (Id : E) return E is
begin
pragma Assert
@@ -581,10 +593,10 @@ package body Einfo is
begin
pragma Assert (Is_Type (Id)
or else Is_Formal (Id)
- or else Ekind (Id) = E_Loop_Parameter
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Exception
- or else Ekind (Id) = E_Variable);
+ or else Ekind_In (Id, E_Loop_Parameter,
+ E_Constant,
+ E_Exception,
+ E_Variable));
return Uint14 (Id);
end Alignment;
@@ -625,8 +637,7 @@ package body Einfo is
function Body_Entity (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package);
+ pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package));
return Node19 (Id);
end Body_Entity;
@@ -663,24 +674,19 @@ package body Einfo is
function Cloned_Subtype (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Record_Subtype
- or else
- Ekind (Id) = E_Class_Wide_Subtype);
+ pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Class_Wide_Subtype));
return Node16 (Id);
end Cloned_Subtype;
function Component_Bit_Offset (Id : E) return U is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
return Uint11 (Id);
end Component_Bit_Offset;
function Component_Clause (Id : E) return N is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
return Node13 (Id);
end Component_Clause;
@@ -874,17 +880,14 @@ package body Einfo is
function DT_Position (Id : E) return U is
begin
- pragma Assert
- ((Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure)
- and then Present (DTC_Entity (Id)));
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure)
+ and then Present (DTC_Entity (Id)));
return Uint15 (Id);
end DT_Position;
function DTC_Entity (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
return Node16 (Id);
end DTC_Entity;
@@ -985,11 +988,12 @@ package body Einfo is
function Equivalent_Type (Id : E) return E is
begin
pragma Assert
- (Ekind (Id) = E_Class_Wide_Subtype or else
- Ekind (Id) = E_Access_Protected_Subprogram_Type or else
- Ekind (Id) = E_Anonymous_Access_Protected_Subprogram_Type or else
- Ekind (Id) = E_Access_Subprogram_Type or else
- Ekind (Id) = E_Exception_Type);
+ (Ekind_In (Id, E_Class_Wide_Type,
+ E_Class_Wide_Subtype,
+ E_Access_Protected_Subprogram_Type,
+ E_Anonymous_Access_Protected_Subprogram_Type,
+ E_Access_Subprogram_Type,
+ E_Exception_Type));
return Node18 (Id);
end Equivalent_Type;
@@ -1025,9 +1029,9 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Entry_Family
- or else Ekind (Id) = E_Subprogram_Body
- or else Ekind (Id) = E_Subprogram_Type);
+ or else Ekind_In (Id, E_Entry_Family,
+ E_Subprogram_Body,
+ E_Subprogram_Type));
return Node28 (Id);
end Extra_Formals;
@@ -1053,6 +1057,12 @@ package body Einfo is
return Node17 (Id);
end First_Entity;
+ function First_Exit_Statement (Id : E) return N is
+ begin
+ pragma Assert (Ekind (Id) = E_Loop);
+ return Node8 (Id);
+ end First_Exit_Statement;
+
function First_Index (Id : E) return N is
begin
pragma Assert (Is_Array_Type (Id) or else Is_String_Type (Id));
@@ -1067,15 +1077,13 @@ package body Einfo is
function First_Optional_Parameter (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
return Node14 (Id);
end First_Optional_Parameter;
function First_Private_Entity (Id : E) return E is
begin
- pragma Assert (Ekind (Id) = E_Package
- or else Ekind (Id) = E_Generic_Package
+ pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)
or else Ekind (Id) in Concurrent_Kind);
return Node16 (Id);
end First_Private_Entity;
@@ -1271,8 +1279,7 @@ package body Einfo is
function Has_Missing_Return (Id : E) return B is
begin
- pragma Assert
- (Ekind (Id) = E_Function or else Ekind (Id) = E_Generic_Function);
+ pragma Assert (Ekind_In (Id, E_Function, E_Generic_Function));
return Flag142 (Id);
end Has_Missing_Return;
@@ -1492,9 +1499,7 @@ package body Einfo is
function Has_Up_Level_Access (Id : E) return B is
begin
pragma Assert
- (Ekind (Id) = E_Variable
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Loop_Parameter);
+ (Ekind_In (Id, E_Variable, E_Constant, E_Loop_Parameter));
return Flag215 (Id);
end Has_Up_Level_Access;
@@ -1521,9 +1526,7 @@ package body Einfo is
function Implemented_By_Entry (Id : E) return B is
begin
- pragma Assert
- (Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
return Flag232 (Id);
end Implemented_By_Entry;
@@ -1608,8 +1611,7 @@ package body Einfo is
function Is_Asynchronous (Id : E) return B is
begin
- pragma Assert
- (Ekind (Id) = E_Procedure or else Is_Type (Id));
+ pragma Assert (Ekind (Id) = E_Procedure or else Is_Type (Id));
return Flag81 (Id);
end Is_Asynchronous;
@@ -1625,8 +1627,7 @@ package body Einfo is
function Is_Called (Id : E) return B is
begin
- pragma Assert
- (Ekind (Id) = E_Procedure or else Ekind (Id) = E_Function);
+ pragma Assert (Ekind_In (Id, E_Procedure, E_Function));
return Flag102 (Id);
end Is_Called;
@@ -1737,10 +1738,7 @@ package body Einfo is
function Is_For_Access_Subtype (Id : E) return B is
begin
- pragma Assert
- (Ekind (Id) = E_Record_Subtype
- or else
- Ekind (Id) = E_Private_Subtype);
+ pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Private_Subtype));
return Flag118 (Id);
end Is_For_Access_Subtype;
@@ -1930,15 +1928,13 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Generic_Function
- or else Ekind (Id) = E_Generic_Procedure);
+ or else Ekind_In (Id, E_Generic_Function, E_Generic_Procedure));
return Flag218 (Id);
end Is_Primitive;
function Is_Primitive_Wrapper (Id : E) return B is
begin
- pragma Assert (Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
return Flag195 (Id);
end Is_Primitive_Wrapper;
@@ -1955,17 +1951,10 @@ package body Einfo is
function Is_Private_Primitive (Id : E) return B is
begin
- pragma Assert (Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
return Flag245 (Id);
end Is_Private_Primitive;
- function Is_Protected_Interface (Id : E) return B is
- begin
- pragma Assert (Is_Interface (Id));
- return Flag198 (Id);
- end Is_Protected_Interface;
-
function Is_Public (Id : E) return B is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -2025,12 +2014,6 @@ package body Einfo is
return Flag28 (Id);
end Is_Statically_Allocated;
- function Is_Synchronized_Interface (Id : E) return B is
- begin
- pragma Assert (Is_Interface (Id));
- return Flag199 (Id);
- end Is_Synchronized_Interface;
-
function Is_Tag (Id : E) return B is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -2042,12 +2025,6 @@ package body Einfo is
return Flag55 (Id);
end Is_Tagged_Type;
- function Is_Task_Interface (Id : E) return B is
- begin
- pragma Assert (Is_Interface (Id));
- return Flag200 (Id);
- end Is_Task_Interface;
-
function Is_Thunk (Id : E) return B is
begin
pragma Assert (Is_Subprogram (Id));
@@ -2224,8 +2201,7 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Subprogram_Type
- or else Ekind (Id) = E_Entry_Family);
+ or else Ekind_In (Id, E_Subprogram_Type, E_Entry_Family));
return Flag22 (Id);
end Needs_No_Actuals;
@@ -2276,22 +2252,19 @@ package body Einfo is
function Normalized_First_Bit (Id : E) return U is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
return Uint8 (Id);
end Normalized_First_Bit;
function Normalized_Position (Id : E) return U is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
return Uint14 (Id);
end Normalized_Position;
function Normalized_Position_Max (Id : E) return U is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
return Uint10 (Id);
end Normalized_Position_Max;
@@ -2310,18 +2283,14 @@ package body Einfo is
function Optimize_Alignment_Space (Id : E) return B is
begin
pragma Assert
- (Is_Type (Id)
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable);
+ (Is_Type (Id) or else Ekind_In (Id, E_Constant, E_Variable));
return Flag241 (Id);
end Optimize_Alignment_Space;
function Optimize_Alignment_Time (Id : E) return B is
begin
pragma Assert
- (Is_Type (Id)
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable);
+ (Is_Type (Id) or else Ekind_In (Id, E_Constant, E_Variable));
return Flag242 (Id);
end Optimize_Alignment_Time;
@@ -2333,10 +2302,7 @@ package body Einfo is
function Original_Record_Component (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Void
- or else Ekind (Id) = E_Component
- or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Void, E_Component, E_Discriminant));
return Node22 (Id);
end Original_Record_Component;
@@ -2352,10 +2318,7 @@ package body Einfo is
function Package_Instantiation (Id : E) return N is
begin
- pragma Assert
- (False
- or else Ekind (Id) = E_Generic_Package
- or else Ekind (Id) = E_Package);
+ pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package));
return Node26 (Id);
end Package_Instantiation;
@@ -2391,8 +2354,7 @@ package body Einfo is
function Prival_Link (Id : E) return E is
begin
- pragma Assert (Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable);
+ pragma Assert (Ekind_In (Id, E_Constant, E_Variable));
return Node20 (Id);
end Prival_Link;
@@ -2422,10 +2384,8 @@ package body Einfo is
function Protection_Object (Id : E) return E is
begin
- pragma Assert (Ekind (Id) = E_Entry
- or else Ekind (Id) = E_Entry_Family
- or else Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert
+ (Ekind_In (Id, E_Entry, E_Entry_Family, E_Function, E_Procedure));
return Node23 (Id);
end Protection_Object;
@@ -2469,21 +2429,20 @@ package body Einfo is
function Related_Expression (Id : E) return N is
begin
- pragma Assert (Ekind (Id) = E_Constant or else Ekind (Id) = E_Variable);
+ pragma Assert (Ekind (Id) in Type_Kind
+ or else Ekind_In (Id, E_Constant, E_Variable));
return Node24 (Id);
end Related_Expression;
function Related_Instance (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Package or else Ekind (Id) = E_Package_Body);
+ pragma Assert (Ekind_In (Id, E_Package, E_Package_Body));
return Node15 (Id);
end Related_Instance;
function Related_Type (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Constant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Constant));
return Node26 (Id);
end Related_Type;
@@ -2569,8 +2528,7 @@ package body Einfo is
function Shadow_Entities (Id : E) return S is
begin
- pragma Assert
- (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package);
+ pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package));
return List14 (Id);
end Shadow_Entities;
@@ -2582,7 +2540,7 @@ package body Einfo is
function Size_Check_Code (Id : E) return N is
begin
- pragma Assert (Ekind (Id) = E_Constant or else Ekind (Id) = E_Variable);
+ pragma Assert (Ekind_In (Id, E_Constant, E_Variable));
return Node19 (Id);
end Size_Check_Code;
@@ -2604,8 +2562,7 @@ package body Einfo is
function Spec_Entity (Id : E) return E is
begin
- pragma Assert
- (Ekind (Id) = E_Package_Body or else Is_Formal (Id));
+ pragma Assert (Ekind (Id) = E_Package_Body or else Is_Formal (Id));
return Node19 (Id);
end Spec_Entity;
@@ -2695,7 +2652,7 @@ package body Einfo is
function Underlying_Record_View (Id : E) return E is
begin
- return Node24 (Id);
+ return Node28 (Id);
end Underlying_Record_View;
function Universal_Aliasing (Id : E) return B is
@@ -2746,9 +2703,8 @@ package body Einfo is
function Wrapped_Entity (Id : E) return E is
begin
- pragma Assert ((Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure)
- and then Is_Primitive_Wrapper (Id));
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure)
+ and then Is_Primitive_Wrapper (Id));
return Node27 (Id);
end Wrapped_Entity;
@@ -2956,8 +2912,7 @@ package body Einfo is
function Is_Signed_Integer_Type (Id : E) return B is
begin
- return Ekind (Id) in
- Signed_Integer_Kind;
+ return Ekind (Id) in Signed_Integer_Kind;
end Is_Signed_Integer_Type;
function Is_Subprogram (Id : E) return B is
@@ -2979,6 +2934,12 @@ package body Einfo is
-- Attribute Set Procedures --
------------------------------
+ -- Note: in many of these set procedures an "obvious" assertion is missing.
+ -- The reason for this is that in many cases, a field is set before the
+ -- Ekind field is set, so that the field is set when Ekind = E_Void. It
+ -- it is possible to add assertions that specifically include the E_Void
+ -- possibility, but in some cases, we just omit the assertions.
+
procedure Set_Accept_Address (Id : E; V : L) is
begin
Set_Elist21 (Id, V);
@@ -3015,9 +2976,7 @@ package body Einfo is
procedure Set_Actual_Subtype (Id : E; V : E) is
begin
pragma Assert
- (Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable
- or else Ekind (Id) = E_Generic_In_Out_Parameter
+ (Ekind_In (Id, E_Constant, E_Variable, E_Generic_In_Out_Parameter)
or else Is_Formal (Id));
Set_Node17 (Id, V);
end Set_Actual_Subtype;
@@ -3037,11 +2996,11 @@ package body Einfo is
procedure Set_Alignment (Id : E; V : U) is
begin
pragma Assert (Is_Type (Id)
- or else Is_Formal (Id)
- or else Ekind (Id) = E_Loop_Parameter
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Exception
- or else Ekind (Id) = E_Variable);
+ or else Is_Formal (Id)
+ or else Ekind_In (Id, E_Loop_Parameter,
+ E_Constant,
+ E_Exception,
+ E_Variable));
Set_Uint14 (Id, V);
end Set_Alignment;
@@ -3059,8 +3018,7 @@ package body Einfo is
procedure Set_Body_Entity (Id : E; V : E) is
begin
- pragma Assert
- (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package);
+ pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package));
Set_Node19 (Id, V);
end Set_Body_Entity;
@@ -3068,8 +3026,8 @@ package body Einfo is
begin
pragma Assert
(Ekind (Id) = E_Package
- or else Is_Subprogram (Id)
- or else Is_Generic_Unit (Id));
+ or else Is_Subprogram (Id)
+ or else Is_Generic_Unit (Id));
Set_Flag40 (Id, V);
end Set_Body_Needed_For_SAL;
@@ -3097,23 +3055,19 @@ package body Einfo is
procedure Set_Cloned_Subtype (Id : E; V : E) is
begin
- pragma Assert
- (Ekind (Id) = E_Record_Subtype
- or else Ekind (Id) = E_Class_Wide_Subtype);
+ pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Class_Wide_Subtype));
Set_Node16 (Id, V);
end Set_Cloned_Subtype;
procedure Set_Component_Bit_Offset (Id : E; V : U) is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
Set_Uint11 (Id, V);
end Set_Component_Bit_Offset;
procedure Set_Component_Clause (Id : E; V : N) is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
Set_Node13 (Id, V);
end Set_Component_Clause;
@@ -3218,9 +3172,7 @@ package body Einfo is
procedure Set_Delay_Subprogram_Descriptors (Id : E; V : B := True) is
begin
pragma Assert
- (Is_Subprogram (Id)
- or else Ekind (Id) = E_Package
- or else Ekind (Id) = E_Package_Body);
+ (Is_Subprogram (Id) or else Ekind_In (Id, E_Package, E_Package_Body));
Set_Flag50 (Id, V);
end Set_Delay_Subprogram_Descriptors;
@@ -3313,14 +3265,13 @@ package body Einfo is
procedure Set_DT_Position (Id : E; V : U) is
begin
- pragma Assert (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
Set_Uint15 (Id, V);
end Set_DT_Position;
procedure Set_DTC_Entity (Id : E; V : E) is
begin
- pragma Assert
- (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
Set_Node16 (Id, V);
end Set_DTC_Entity;
@@ -3421,12 +3372,12 @@ package body Einfo is
procedure Set_Equivalent_Type (Id : E; V : E) is
begin
pragma Assert
- (Ekind (Id) = E_Class_Wide_Type or else
- Ekind (Id) = E_Class_Wide_Subtype or else
- Ekind (Id) = E_Access_Protected_Subprogram_Type or else
- Ekind (Id) = E_Anonymous_Access_Protected_Subprogram_Type or else
- Ekind (Id) = E_Access_Subprogram_Type or else
- Ekind (Id) = E_Exception_Type);
+ (Ekind_In (Id, E_Class_Wide_Type,
+ E_Class_Wide_Subtype,
+ E_Access_Protected_Subprogram_Type,
+ E_Anonymous_Access_Protected_Subprogram_Type,
+ E_Access_Subprogram_Type,
+ E_Exception_Type));
Set_Node18 (Id, V);
end Set_Equivalent_Type;
@@ -3462,9 +3413,9 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Entry_Family
- or else Ekind (Id) = E_Subprogram_Body
- or else Ekind (Id) = E_Subprogram_Type);
+ or else Ekind_In (Id, E_Entry_Family,
+ E_Subprogram_Body,
+ E_Subprogram_Type));
Set_Node28 (Id, V);
end Set_Extra_Formals;
@@ -3492,6 +3443,12 @@ package body Einfo is
Set_Node17 (Id, V);
end Set_First_Entity;
+ procedure Set_First_Exit_Statement (Id : E; V : N) is
+ begin
+ pragma Assert (Ekind (Id) = E_Loop);
+ Set_Node8 (Id, V);
+ end Set_First_Exit_Statement;
+
procedure Set_First_Index (Id : E; V : N) is
begin
pragma Assert (Is_Array_Type (Id) or else Is_String_Type (Id));
@@ -3506,16 +3463,14 @@ package body Einfo is
procedure Set_First_Optional_Parameter (Id : E; V : E) is
begin
- pragma Assert
- (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
Set_Node14 (Id, V);
end Set_First_Optional_Parameter;
procedure Set_First_Private_Entity (Id : E; V : E) is
begin
- pragma Assert (Ekind (Id) = E_Package
- or else Ekind (Id) = E_Generic_Package
- or else Ekind (Id) in Concurrent_Kind);
+ pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)
+ or else Ekind (Id) in Concurrent_Kind);
Set_Node16 (Id, V);
end Set_First_Private_Entity;
@@ -3533,7 +3488,7 @@ package body Einfo is
begin
pragma Assert
(Is_Type (Id)
- or else Ekind (Id) = E_Package);
+ or else Ekind (Id) = E_Package);
Set_Flag159 (Id, V);
end Set_From_With_Type;
@@ -3700,8 +3655,7 @@ package body Einfo is
procedure Set_Has_Initial_Value (Id : E; V : B := True) is
begin
- pragma Assert
- (Ekind (Id) = E_Variable or else Ekind (Id) = E_Out_Parameter);
+ pragma Assert (Ekind_In (Id, E_Variable, E_Out_Parameter));
Set_Flag219 (Id, V);
end Set_Has_Initial_Value;
@@ -3718,8 +3672,7 @@ package body Einfo is
procedure Set_Has_Missing_Return (Id : E; V : B := True) is
begin
- pragma Assert
- (Ekind (Id) = E_Function or else Ekind (Id) = E_Generic_Function);
+ pragma Assert (Ekind_In (Id, E_Function, E_Generic_Function));
Set_Flag142 (Id, V);
end Set_Has_Missing_Return;
@@ -3730,10 +3683,7 @@ package body Einfo is
procedure Set_Has_Up_Level_Access (Id : E; V : B := True) is
begin
- pragma Assert
- (Ekind (Id) = E_Variable
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Loop_Parameter);
+ pragma Assert (Ekind_In (Id, E_Variable, E_Constant, E_Loop_Parameter));
Set_Flag215 (Id, V);
end Set_Has_Up_Level_Access;
@@ -3976,9 +3926,7 @@ package body Einfo is
procedure Set_Implemented_By_Entry (Id : E; V : B := True) is
begin
- pragma Assert
- (Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
Set_Flag232 (Id, V);
end Set_Implemented_By_Entry;
@@ -3993,8 +3941,7 @@ package body Einfo is
pragma Assert
(Is_Internal (Id)
and then Is_Hidden (Id)
- and then (Ekind (Id) = E_Procedure
- or else Ekind (Id) = E_Function));
+ and then (Ekind_In (Id, E_Procedure, E_Function)));
Set_Node25 (Id, V);
end Set_Interface_Alias;
@@ -4087,8 +4034,7 @@ package body Einfo is
procedure Set_Is_Called (Id : E; V : B := True) is
begin
- pragma Assert
- (Ekind (Id) = E_Procedure or else Ekind (Id) = E_Function);
+ pragma Assert (Ekind_In (Id, E_Procedure, E_Function));
Set_Flag102 (Id, V);
end Set_Is_Called;
@@ -4211,10 +4157,7 @@ package body Einfo is
procedure Set_Is_For_Access_Subtype (Id : E; V : B := True) is
begin
- pragma Assert
- (Ekind (Id) = E_Record_Subtype
- or else
- Ekind (Id) = E_Private_Subtype);
+ pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Private_Subtype));
Set_Flag118 (Id, V);
end Set_Is_For_Access_Subtype;
@@ -4275,12 +4218,12 @@ package body Einfo is
procedure Set_Is_Interface (Id : E; V : B := True) is
begin
pragma Assert
- (Ekind (Id) = E_Record_Type
- or else Ekind (Id) = E_Record_Subtype
- or else Ekind (Id) = E_Record_Type_With_Private
- or else Ekind (Id) = E_Record_Subtype_With_Private
- or else Ekind (Id) = E_Class_Wide_Type
- or else Ekind (Id) = E_Class_Wide_Subtype);
+ (Ekind_In (Id, E_Record_Type,
+ E_Record_Subtype,
+ E_Record_Type_With_Private,
+ E_Record_Subtype_With_Private,
+ E_Class_Wide_Type,
+ E_Class_Wide_Subtype));
Set_Flag186 (Id, V);
end Set_Is_Interface;
@@ -4415,15 +4358,13 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Generic_Function
- or else Ekind (Id) = E_Generic_Procedure);
+ or else Ekind_In (Id, E_Generic_Function, E_Generic_Procedure));
Set_Flag218 (Id, V);
end Set_Is_Primitive;
procedure Set_Is_Primitive_Wrapper (Id : E; V : B := True) is
begin
- pragma Assert (Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
Set_Flag195 (Id, V);
end Set_Is_Primitive_Wrapper;
@@ -4440,17 +4381,10 @@ package body Einfo is
procedure Set_Is_Private_Primitive (Id : E; V : B := True) is
begin
- pragma Assert (Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure));
Set_Flag245 (Id, V);
end Set_Is_Private_Primitive;
- procedure Set_Is_Protected_Interface (Id : E; V : B := True) is
- begin
- pragma Assert (Is_Interface (Id));
- Set_Flag198 (Id, V);
- end Set_Is_Protected_Interface;
-
procedure Set_Is_Public (Id : E; V : B := True) is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -4508,25 +4442,17 @@ package body Einfo is
procedure Set_Is_Statically_Allocated (Id : E; V : B := True) is
begin
pragma Assert
- (Ekind (Id) = E_Exception
- or else Ekind (Id) = E_Variable
- or else Ekind (Id) = E_Constant
- or else Is_Type (Id)
- or else Ekind (Id) = E_Void);
+ (Is_Type (Id)
+ or else Ekind_In (Id, E_Exception,
+ E_Variable,
+ E_Constant,
+ E_Void));
Set_Flag28 (Id, V);
end Set_Is_Statically_Allocated;
- procedure Set_Is_Synchronized_Interface (Id : E; V : B := True) is
- begin
- pragma Assert (Is_Interface (Id));
- Set_Flag199 (Id, V);
- end Set_Is_Synchronized_Interface;
-
procedure Set_Is_Tag (Id : E; V : B := True) is
begin
- pragma Assert
- (Ekind (Id) = E_Component
- or else Ekind (Id) = E_Constant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Constant));
Set_Flag78 (Id, V);
end Set_Is_Tag;
@@ -4535,12 +4461,6 @@ package body Einfo is
Set_Flag55 (Id, V);
end Set_Is_Tagged_Type;
- procedure Set_Is_Task_Interface (Id : E; V : B := True) is
- begin
- pragma Assert (Is_Interface (Id));
- Set_Flag200 (Id, V);
- end Set_Is_Task_Interface;
-
procedure Set_Is_Thunk (Id : E; V : B := True) is
begin
Set_Flag225 (Id, V);
@@ -4715,8 +4635,7 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Subprogram_Type
- or else Ekind (Id) = E_Entry_Family);
+ or else Ekind_In (Id, E_Subprogram_Type, E_Entry_Family));
Set_Flag22 (Id, V);
end Set_Needs_No_Actuals;
@@ -4739,9 +4658,7 @@ package body Einfo is
procedure Set_No_Return (Id : E; V : B := True) is
begin
pragma Assert
- (V = False
- or else Ekind (Id) = E_Procedure
- or else Ekind (Id) = E_Generic_Procedure);
+ (V = False or else Ekind_In (Id, E_Procedure, E_Generic_Procedure));
Set_Flag113 (Id, V);
end Set_No_Return;
@@ -4773,22 +4690,19 @@ package body Einfo is
procedure Set_Normalized_First_Bit (Id : E; V : U) is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
Set_Uint8 (Id, V);
end Set_Normalized_First_Bit;
procedure Set_Normalized_Position (Id : E; V : U) is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
Set_Uint14 (Id, V);
end Set_Normalized_Position;
procedure Set_Normalized_Position_Max (Id : E; V : U) is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Discriminant));
Set_Uint10 (Id, V);
end Set_Normalized_Position_Max;
@@ -4808,18 +4722,14 @@ package body Einfo is
procedure Set_Optimize_Alignment_Space (Id : E; V : B := True) is
begin
pragma Assert
- (Is_Type (Id)
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable);
+ (Is_Type (Id) or else Ekind_In (Id, E_Constant, E_Variable));
Set_Flag241 (Id, V);
end Set_Optimize_Alignment_Space;
procedure Set_Optimize_Alignment_Time (Id : E; V : B := True) is
begin
pragma Assert
- (Is_Type (Id)
- or else Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable);
+ (Is_Type (Id) or else Ekind_In (Id, E_Constant, E_Variable));
Set_Flag242 (Id, V);
end Set_Optimize_Alignment_Time;
@@ -4831,10 +4741,7 @@ package body Einfo is
procedure Set_Original_Record_Component (Id : E; V : E) is
begin
- pragma Assert
- (Ekind (Id) = E_Void
- or else Ekind (Id) = E_Component
- or else Ekind (Id) = E_Discriminant);
+ pragma Assert (Ekind_In (Id, E_Void, E_Component, E_Discriminant));
Set_Node22 (Id, V);
end Set_Original_Record_Component;
@@ -4850,10 +4757,7 @@ package body Einfo is
procedure Set_Package_Instantiation (Id : E; V : N) is
begin
- pragma Assert
- (Ekind (Id) = E_Void
- or else Ekind (Id) = E_Generic_Package
- or else Ekind (Id) = E_Package);
+ pragma Assert (Ekind_In (Id, E_Void, E_Generic_Package, E_Package));
Set_Node26 (Id, V);
end Set_Package_Instantiation;
@@ -4889,8 +4793,7 @@ package body Einfo is
procedure Set_Prival_Link (Id : E; V : E) is
begin
- pragma Assert (Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable);
+ pragma Assert (Ekind_In (Id, E_Constant, E_Variable));
Set_Node20 (Id, V);
end Set_Prival_Link;
@@ -4920,10 +4823,10 @@ package body Einfo is
procedure Set_Protection_Object (Id : E; V : E) is
begin
- pragma Assert (Ekind (Id) = E_Entry
- or else Ekind (Id) = E_Entry_Family
- or else Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure);
+ pragma Assert (Ekind_In (Id, E_Entry,
+ E_Entry_Family,
+ E_Function,
+ E_Procedure));
Set_Node23 (Id, V);
end Set_Protection_Object;
@@ -4967,20 +4870,20 @@ package body Einfo is
procedure Set_Related_Expression (Id : E; V : N) is
begin
+ pragma Assert (Ekind (Id) in Type_Kind
+ or else Ekind_In (Id, E_Constant, E_Variable, E_Void));
Set_Node24 (Id, V);
end Set_Related_Expression;
procedure Set_Related_Instance (Id : E; V : E) is
begin
- pragma Assert
- (Ekind (Id) = E_Package or else Ekind (Id) = E_Package_Body);
+ pragma Assert (Ekind_In (Id, E_Package, E_Package_Body));
Set_Node15 (Id, V);
end Set_Related_Instance;
procedure Set_Related_Type (Id : E; V : E) is
begin
- pragma Assert
- (Ekind (Id) = E_Component or else Ekind (Id) = E_Constant);
+ pragma Assert (Ekind_In (Id, E_Component, E_Constant));
Set_Node26 (Id, V);
end Set_Related_Type;
@@ -5068,8 +4971,7 @@ package body Einfo is
procedure Set_Shadow_Entities (Id : E; V : S) is
begin
- pragma Assert
- (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package);
+ pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package));
Set_List14 (Id, V);
end Set_Shadow_Entities;
@@ -5081,7 +4983,7 @@ package body Einfo is
procedure Set_Size_Check_Code (Id : E; V : N) is
begin
- pragma Assert (Ekind (Id) = E_Constant or else Ekind (Id) = E_Variable);
+ pragma Assert (Ekind_In (Id, E_Constant, E_Variable));
Set_Node19 (Id, V);
end Set_Size_Check_Code;
@@ -5198,7 +5100,7 @@ package body Einfo is
procedure Set_Underlying_Record_View (Id : E; V : E) is
begin
pragma Assert (Ekind (Id) = E_Record_Type);
- Set_Node24 (Id, V);
+ Set_Node28 (Id, V);
end Set_Underlying_Record_View;
procedure Set_Universal_Aliasing (Id : E; V : B := True) is
@@ -5255,9 +5157,8 @@ package body Einfo is
procedure Set_Wrapped_Entity (Id : E; V : E) is
begin
- pragma Assert ((Ekind (Id) = E_Function
- or else Ekind (Id) = E_Procedure)
- and then Is_Primitive_Wrapper (Id));
+ pragma Assert (Ekind_In (Id, E_Function, E_Procedure)
+ and then Is_Primitive_Wrapper (Id));
Set_Node27 (Id, V);
end Set_Wrapped_Entity;
@@ -5452,7 +5353,8 @@ package body Einfo is
function Known_Static_Esize (E : Entity_Id) return B is
begin
- return Uint12 (E) > Uint_0;
+ return Uint12 (E) > Uint_0
+ and then not Is_Generic_Type (E);
end Known_Static_Esize;
function Known_Static_Normalized_First_Bit (E : Entity_Id) return B is
@@ -5475,9 +5377,10 @@ package body Einfo is
function Known_Static_RM_Size (E : Entity_Id) return B is
begin
- return Uint13 (E) > Uint_0
- or else Is_Discrete_Type (E)
- or else Is_Fixed_Point_Type (E);
+ return (Uint13 (E) > Uint_0
+ or else Is_Discrete_Type (E)
+ or else Is_Fixed_Point_Type (E))
+ and then not Is_Generic_Type (E);
end Known_Static_RM_Size;
function Unknown_Alignment (E : Entity_Id) return B is
@@ -5752,9 +5655,9 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Entry_Family
- or else Ekind (Id) = E_Subprogram_Body
- or else Ekind (Id) = E_Subprogram_Type);
+ or else Ekind_In (Id, E_Entry_Family,
+ E_Subprogram_Body,
+ E_Subprogram_Type));
if Ekind (Id) = E_Enumeration_Literal then
return Empty;
@@ -5780,9 +5683,9 @@ package body Einfo is
begin
pragma Assert
(Is_Overloadable (Id)
- or else Ekind (Id) = E_Entry_Family
- or else Ekind (Id) = E_Subprogram_Body
- or else Ekind (Id) = E_Subprogram_Type);
+ or else Ekind_In (Id, E_Entry_Family,
+ E_Subprogram_Body,
+ E_Subprogram_Type));
if Ekind (Id) = E_Enumeration_Literal then
return Empty;
@@ -5829,9 +5732,7 @@ package body Einfo is
function Get_Full_View (T : Entity_Id) return Entity_Id is
begin
- if Ekind (T) = E_Incomplete_Type
- and then Present (Full_View (T))
- then
+ if Ekind (T) = E_Incomplete_Type and then Present (Full_View (T)) then
return Full_View (T);
elsif Is_Class_Wide_Type (T)
@@ -5845,6 +5746,26 @@ package body Einfo is
end if;
end Get_Full_View;
+ --------------------------------------
+ -- Get_Record_Representation_Clause --
+ --------------------------------------
+
+ function Get_Record_Representation_Clause (E : Entity_Id) return Node_Id is
+ N : Node_Id;
+
+ begin
+ N := First_Rep_Item (E);
+ while Present (N) loop
+ if Nkind (N) = N_Record_Representation_Clause then
+ return N;
+ end if;
+
+ Next_Rep_Item (N);
+ end loop;
+
+ return Empty;
+ end Get_Record_Representation_Clause;
+
--------------------
-- Get_Rep_Pragma --
--------------------
@@ -5929,7 +5850,13 @@ package body Einfo is
function Has_Foreign_Convention (Id : E) return B is
begin
- return Convention (Id) in Foreign_Convention;
+ -- While regular Intrinsics such as the Standard operators fit in the
+ -- "Ada" convention, those with an Interface_Name materialize GCC
+ -- builtin imports for which Ada special treatments shouldn't apply.
+
+ return Convention (Id) in Foreign_Convention
+ or else (Convention (Id) = Convention_Intrinsic
+ and then Present (Interface_Name (Id)));
end Has_Foreign_Convention;
---------------------------
@@ -6085,10 +6012,8 @@ package body Einfo is
function Is_Discriminal (Id : E) return B is
begin
- return
- (Ekind (Id) = E_Constant
- or else Ekind (Id) = E_In_Parameter)
- and then Present (Discriminal_Link (Id));
+ return (Ekind_In (Id, E_Constant, E_In_Parameter)
+ and then Present (Discriminal_Link (Id)));
end Is_Discriminal;
----------------------
@@ -6156,10 +6081,8 @@ package body Einfo is
function Is_Prival (Id : E) return B is
begin
- return
- (Ekind (Id) = E_Constant
- or else Ekind (Id) = E_Variable)
- and then Present (Prival_Link (Id));
+ return (Ekind_In (Id, E_Constant, E_Variable)
+ and then Present (Prival_Link (Id)));
end Is_Prival;
----------------------------
@@ -6172,6 +6095,22 @@ package body Einfo is
and then Is_Protected_Type (Scope (Id));
end Is_Protected_Component;
+ ----------------------------
+ -- Is_Protected_Interface --
+ ----------------------------
+
+ function Is_Protected_Interface (Id : E) return B is
+ Typ : constant Entity_Id := Base_Type (Id);
+ begin
+ if not Is_Interface (Typ) then
+ return False;
+ elsif Is_Class_Wide_Type (Typ) then
+ return Is_Protected_Interface (Etype (Typ));
+ else
+ return Protected_Present (Type_Definition (Parent (Typ)));
+ end if;
+ end Is_Protected_Interface;
+
------------------------------
-- Is_Protected_Record_Type --
------------------------------
@@ -6214,10 +6153,47 @@ package body Einfo is
begin
return Ekind (Id) in String_Kind
or else (Is_Array_Type (Id)
- and then Number_Dimensions (Id) = 1
- and then Is_Character_Type (Component_Type (Id)));
+ and then Number_Dimensions (Id) = 1
+ and then Is_Character_Type (Component_Type (Id)));
end Is_String_Type;
+ -------------------------------
+ -- Is_Synchronized_Interface --
+ -------------------------------
+
+ function Is_Synchronized_Interface (Id : E) return B is
+ Typ : constant Entity_Id := Base_Type (Id);
+
+ begin
+ if not Is_Interface (Typ) then
+ return False;
+
+ elsif Is_Class_Wide_Type (Typ) then
+ return Is_Synchronized_Interface (Etype (Typ));
+
+ else
+ return Protected_Present (Type_Definition (Parent (Typ)))
+ or else Synchronized_Present (Type_Definition (Parent (Typ)))
+ or else Task_Present (Type_Definition (Parent (Typ)));
+ end if;
+ end Is_Synchronized_Interface;
+
+ -----------------------
+ -- Is_Task_Interface --
+ -----------------------
+
+ function Is_Task_Interface (Id : E) return B is
+ Typ : constant Entity_Id := Base_Type (Id);
+ begin
+ if not Is_Interface (Typ) then
+ return False;
+ elsif Is_Class_Wide_Type (Typ) then
+ return Is_Task_Interface (Etype (Typ));
+ else
+ return Task_Present (Type_Definition (Parent (Typ)));
+ end if;
+ end Is_Task_Interface;
+
-------------------------
-- Is_Task_Record_Type --
-------------------------
@@ -6236,9 +6212,39 @@ package body Einfo is
function Is_Wrapper_Package (Id : E) return B is
begin
return (Ekind (Id) = E_Package
- and then Present (Related_Instance (Id)));
+ and then Present (Related_Instance (Id)));
end Is_Wrapper_Package;
+ -----------------
+ -- Last_Formal --
+ -----------------
+
+ function Last_Formal (Id : E) return E is
+ Formal : E;
+
+ begin
+ pragma Assert
+ (Is_Overloadable (Id)
+ or else Ekind_In (Id, E_Entry_Family,
+ E_Subprogram_Body,
+ E_Subprogram_Type));
+
+ if Ekind (Id) = E_Enumeration_Literal then
+ return Empty;
+
+ else
+ Formal := First_Formal (Id);
+
+ if Present (Formal) then
+ while Present (Next_Formal (Formal)) loop
+ Formal := Next_Formal (Formal);
+ end loop;
+ end if;
+
+ return Formal;
+ end if;
+ end Last_Formal;
+
--------------------
-- Next_Component --
--------------------
@@ -6266,9 +6272,7 @@ package body Einfo is
begin
Comp_Id := Next_Entity (Id);
while Present (Comp_Id) loop
- exit when Ekind (Comp_Id) = E_Component
- or else
- Ekind (Comp_Id) = E_Discriminant;
+ exit when Ekind_In (Comp_Id, E_Component, E_Discriminant);
Comp_Id := Next_Entity (Comp_Id);
end loop;
@@ -6305,7 +6309,7 @@ package body Einfo is
D := Next_Entity (D);
if No (D)
or else (Ekind (D) /= E_Discriminant
- and then not Is_Itype (D))
+ and then not Is_Itype (D))
then
return Empty;
end if;
@@ -6989,7 +6993,6 @@ package body Einfo is
W ("Is_Private_Composite", Flag107 (Id));
W ("Is_Private_Descendant", Flag53 (Id));
W ("Is_Private_Primitive", Flag245 (Id));
- W ("Is_Protected_Interface", Flag198 (Id));
W ("Is_Public", Flag10 (Id));
W ("Is_Pure", Flag44 (Id));
W ("Is_Pure_Unit_Access_Type", Flag189 (Id));
@@ -7000,11 +7003,9 @@ package body Einfo is
W ("Is_Renaming_Of_Object", Flag112 (Id));
W ("Is_Return_Object", Flag209 (Id));
W ("Is_Shared_Passive", Flag60 (Id));
- W ("Is_Synchronized_Interface", Flag199 (Id));
W ("Is_Statically_Allocated", Flag28 (Id));
W ("Is_Tag", Flag78 (Id));
W ("Is_Tagged_Type", Flag55 (Id));
- W ("Is_Task_Interface", Flag200 (Id));
W ("Is_Thunk", Flag225 (Id));
W ("Is_Trivial_Subprogram", Flag235 (Id));
W ("Is_True_Constant", Flag163 (Id));
@@ -7236,6 +7237,9 @@ package body Einfo is
when Type_Kind =>
Write_Str ("Associated_Node_For_Itype");
+ when E_Loop =>
+ Write_Str ("First_Exit_Statement");
+
when E_Package =>
Write_Str ("Dependent_Instances");
@@ -7960,14 +7964,11 @@ package body Einfo is
when Subprogram_Kind =>
Write_Str ("Spec_PPC_List");
- when E_Record_Type =>
- Write_Str ("Underlying record view");
-
- when E_Variable | E_Constant =>
- Write_Str ("Related expression");
+ when E_Variable | E_Constant | Type_Kind =>
+ Write_Str ("Related_Expression");
when others =>
- Write_Str ("???");
+ Write_Str ("Field24???");
end case;
end Write_Field24_Name;
@@ -8071,6 +8072,9 @@ package body Einfo is
when E_Procedure | E_Function | E_Entry =>
Write_Str ("Extra_Formals");
+ when E_Record_Type =>
+ Write_Str ("Underlying_Record_View");
+
when others =>
Write_Str ("Field28??");
end case;
@@ -8089,9 +8093,7 @@ package body Einfo is
begin
N := Next_Entity (N);
while Present (N) loop
- exit when Ekind (N) = E_Component
- or else
- Ekind (N) = E_Discriminant;
+ exit when Ekind_In (N, E_Component, E_Discriminant);
N := Next_Entity (N);
end loop;
end Proc_Next_Component_Or_Discriminant;
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index d4294728563..a3bff056113 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -350,6 +350,10 @@ package Einfo is
-- make sure that the address can be meaningfully taken, and also in
-- the case of subprograms to control output of certain warnings.
+-- Aft_Value (synthesized)
+-- Applies to fixed and decimal types. Computes a universal integer
+-- that holds value of the Aft attribute for the type.
+
-- Alias (Node18)
-- Present in overloaded entities (literals, subprograms, entries) and
-- subprograms that cover a primitive operation of an abstract interface
@@ -1116,6 +1120,13 @@ package Einfo is
-- Points to a list of associated entities using the Next_Entity field
-- as a chain pointer with Empty marking the end of the list.
+-- First_Exit_Statement (Node8)
+-- Present in E_Loop entity. The exit statements for a loop are chained
+-- (in reverse order of appearence) using this field to point to the
+-- first entry in the chain (last exit statement in the loop). The
+-- entries are chained through the Next_Exit_Statement field of the
+-- N_Exit_Statement node with Empty marking the end of the list.
+
-- First_Formal (synthesized)
-- Applies to subprograms and subprogram types, and also in entries
-- and entry families. Returns first formal of the subprogram or entry.
@@ -2470,7 +2481,7 @@ package Einfo is
-- Applicable to all entities, true if the entity denotes a private
-- component of a protected type.
--- Is_Protected_Interface (Flag198)
+-- Is_Protected_Interface (synthesized)
-- Present in types that are interfaces. True if interface is declared
-- protected, or is derived from protected interfaces.
@@ -2577,7 +2588,7 @@ package Einfo is
-- Applies to all entities, true for function, procedure and operator
-- entities.
--- Is_Synchronized_Interface (Flag199)
+-- Is_Synchronized_Interface (synthesized)
-- Present in types that are interfaces. True if interface is declared
-- synchronized, task, or protected, or is derived from a synchronized
-- interface.
@@ -2591,7 +2602,7 @@ package Einfo is
-- Is_Tagged_Type (Flag55)
-- Present in all entities. Set for an entity for a tagged type.
--- Is_Task_Interface (Flag200)
+-- Is_Task_Interface (synthesized)
-- Present in types that are interfaces. True if interface is declared as
-- a task interface, or if it is derived from task interfaces.
@@ -2745,6 +2756,13 @@ package Einfo is
-- Points to the last entry in the list of associated entities chained
-- through the Next_Entity field. Empty if no entities are chained.
+-- Last_Formal (synthesized)
+-- Applies to subprograms and subprogram types, and also in entries
+-- and entry families. Returns last formal of the subprogram or entry.
+-- The formals are the first entities declared in a subprogram or in
+-- a subprogram type (the designated type of an Access_To_Subprogram
+-- definition) or in an entry.
+
-- Limited_View (Node23)
-- Present in non-generic package entities that are not instances. Bona
-- fide package with the limited-view list through the first_entity and
@@ -3134,7 +3152,9 @@ package Einfo is
-- types. Points to an element list of entities for primitive operations
-- for the tagged type. Not present (and not set) in untagged types (it
-- is an error to reference the primitive operations field of a type
--- that is not tagged).
+-- that is not tagged). In order to fulfill the C++ ABI, entities of
+-- primitives that come from source must be stored in this list following
+-- their order of occurrence in the sources.
-- Prival (Node17)
-- Present in private components of protected types. Refers to the entity
@@ -3237,9 +3257,13 @@ package Einfo is
-- only for type-related error messages.
-- Related_Expression (Node24)
--- Present in variables generated internally. Denotes the source
--- expression whose elaboration created the variable declaration.
--- Used for clearer messages from CodePeer.
+-- Present in variables and types. Set only for internally generated
+-- entities, where it may be used to denote the source expression whose
+-- elaboration created the variable declaration. If set, it is used
+-- for generating clearer messages from CodePeer.
+--
+-- Shouldn't it also be used for the same purpose in errout? It seems
+-- odd to have two mechanisms here???
-- Related_Instance (Node15)
-- Present in the wrapper packages created for subprogram instances.
@@ -3532,12 +3556,13 @@ package Einfo is
-- value may be passed around, and if used, may clobber a local variable.
-- Task_Body_Procedure (Node25)
--- Present in task types and subtypes. Points to the entity for
--- the task body procedure (as further described in Exp_Ch9, task
--- bodies are expanded into procedures). A convenient function to
--- retrieve this field is Sem_Util.Get_Task_Body_Procedure.
--- The last sentence is odd ??? Why not have Task_Body_Procedure
--- go to the Underlying_Type of the Root_Type???
+-- Present in task types and subtypes. Points to the entity for the task
+-- task body procedure (as further described in Exp_Ch9, task bodies are
+-- expanded into procedures). A convenient function to retrieve this
+-- field is Sem_Util.Get_Task_Body_Procedure.
+--
+-- The last sentence is odd??? Why not have Task_Body_Procedure go to the
+-- Underlying_Type of the Root_Type???
-- Treat_As_Volatile (Flag41)
-- Present in all type entities, and also in constants, components and
@@ -3584,7 +3609,7 @@ package Einfo is
-- private completion. If Td is already constrained, then its full view
-- can serve directly as the full view of T.
--- Underlying_Record_View (Node24)
+-- Underlying_Record_View (Node28)
-- Present in record types. Set for record types that are extensions of
-- types with unknown discriminants, and also set for internally built
-- underlying record views to reference its original record type. Record
@@ -4592,6 +4617,7 @@ package Einfo is
-- Esize (Uint12)
-- RM_Size (Uint13)
-- Alignment (Uint14)
+ -- Related_Expression (Node24)
-- Depends_On_Private (Flag14)
-- Discard_Names (Flag88)
@@ -4628,10 +4654,7 @@ package Einfo is
-- Is_Eliminated (Flag124)
-- Is_Frozen (Flag4)
-- Is_Generic_Actual_Type (Flag94)
- -- Is_Protected_Interface (Flag198)
-- Is_RACW_Stub_Type (Flag244)
- -- Is_Synchronized_Interface (Flag199)
- -- Is_Task_Interface (Flag200)
-- Is_Non_Static_Subtype (Flag109)
-- Is_Packed (Flag51) (base type only)
-- Is_Private_Composite (Flag107)
@@ -4822,6 +4845,7 @@ package Einfo is
-- Small_Value (Ureal21)
-- Has_Machine_Radix_Clause (Flag83)
-- Machine_Radix_10 (Flag84)
+ -- Aft_Value (synth)
-- Type_Low_Bound (synth)
-- Type_High_Bound (synth)
-- (plus type attributes)
@@ -4866,9 +4890,10 @@ package Einfo is
-- Sec_Stack_Needed_For_Return (Flag167)
-- Uses_Sec_Stack (Flag95)
-- Address_Clause (synth)
+ -- Entry_Index_Type (synth)
-- First_Formal (synth)
-- First_Formal_With_Extras (synth)
- -- Entry_Index_Type (synth)
+ -- Last_Formal (synth)
-- Number_Formals (synth)
-- Scope_Depth (synth)
@@ -4987,6 +5012,7 @@ package Einfo is
-- Address_Clause (synth)
-- First_Formal (synth)
-- First_Formal_With_Extras (synth)
+ -- Last_Formal (synth)
-- Number_Formals (synth)
-- Scope_Depth (synth)
@@ -5063,6 +5089,7 @@ package Einfo is
-- (plus type attributes)
-- E_Loop
+ -- First_Exit_Statement (Node8)
-- Has_Exit (Flag47)
-- Has_Master_Entity (Flag21)
-- Has_Nested_Block_With_Handler (Flag101)
@@ -5103,6 +5130,7 @@ package Einfo is
-- Scalar_Range (Node20)
-- Small_Value (Ureal21)
-- Has_Small_Clause (Flag67)
+ -- Aft_Value (synth)
-- Type_Low_Bound (synth)
-- Type_High_Bound (synth)
-- (plus type attributes)
@@ -5201,7 +5229,7 @@ package Einfo is
-- Spec_PPC_List (Node24)
-- Interface_Alias (Node25)
-- Static_Initialization (Node26) (init_proc only)
- -- Overridden_Operation (Node26)
+ -- Overridden_Operation (Node26) (never for init proc)
-- Wrapped_Entity (Node27) (non-generic case only)
-- Extra_Formals (Node28)
-- Body_Needed_For_SAL (Flag40)
@@ -5244,6 +5272,7 @@ package Einfo is
-- Address_Clause (synth)
-- First_Formal (synth)
-- First_Formal_With_Extras (synth)
+ -- Last_Formal (synth)
-- Number_Formals (synth)
-- E_Protected_Body
@@ -5282,8 +5311,8 @@ package Einfo is
-- Discriminant_Constraint (Elist21)
-- Corresponding_Remote_Type (Node22)
-- Stored_Constraint (Elist23)
- -- Underlying_Record_View (Node24) (base type only)
-- Interfaces (Elist25)
+ -- Underlying_Record_View (Node28) (base type only)
-- Component_Alignment (special) (base type only)
-- C_Pass_By_Copy (Flag125) (base type only)
-- Has_Dispatch_Table (Flag220) (base tagged type only)
@@ -5368,6 +5397,7 @@ package Einfo is
-- Directly_Designated_Type (Node20)
-- First_Formal (synth)
-- First_Formal_With_Extras (synth)
+ -- Last_Formal (synth)
-- Number_Formals (synth)
-- (plus type attributes)
@@ -5743,6 +5773,7 @@ package Einfo is
function Finalization_Chain_Entity (Id : E) return E;
function Finalize_Storage_Only (Id : E) return B;
function First_Entity (Id : E) return E;
+ function First_Exit_Statement (Id : E) return N;
function First_Index (Id : E) return N;
function First_Literal (Id : E) return E;
function First_Optional_Parameter (Id : E) return E;
@@ -5900,7 +5931,6 @@ package Einfo is
function Is_Private_Composite (Id : E) return B;
function Is_Private_Descendant (Id : E) return B;
function Is_Private_Primitive (Id : E) return B;
- function Is_Protected_Interface (Id : E) return B;
function Is_Public (Id : E) return B;
function Is_Pure (Id : E) return B;
function Is_Pure_Unit_Access_Type (Id : E) return B;
@@ -5912,10 +5942,8 @@ package Einfo is
function Is_Return_Object (Id : E) return B;
function Is_Shared_Passive (Id : E) return B;
function Is_Statically_Allocated (Id : E) return B;
- function Is_Synchronized_Interface (Id : E) return B;
function Is_Tag (Id : E) return B;
function Is_Tagged_Type (Id : E) return B;
- function Is_Task_Interface (Id : E) return B;
function Is_Thunk (Id : E) return B;
function Is_Trivial_Subprogram (Id : E) return B;
function Is_True_Constant (Id : E) return B;
@@ -6104,6 +6132,7 @@ package Einfo is
-- so they do not correspond to defined fields in the entity itself.
function Address_Clause (Id : E) return N;
+ function Aft_Value (Id : E) return U;
function Alignment_Clause (Id : E) return N;
function Base_Type (Id : E) return E;
function Declaration_Node (Id : E) return N;
@@ -6125,11 +6154,15 @@ package Einfo is
function Is_Package_Or_Generic_Package (Id : E) return B;
function Is_Prival (Id : E) return B;
function Is_Protected_Component (Id : E) return B;
+ function Is_Protected_Interface (Id : E) return B;
function Is_Protected_Record_Type (Id : E) return B;
function Is_Standard_Character_Type (Id : E) return B;
function Is_String_Type (Id : E) return B;
+ function Is_Synchronized_Interface (Id : E) return B;
+ function Is_Task_Interface (Id : E) return B;
function Is_Task_Record_Type (Id : E) return B;
function Is_Wrapper_Package (Id : E) return B;
+ function Last_Formal (Id : E) return E;
function Next_Component (Id : E) return E;
function Next_Component_Or_Discriminant (Id : E) return E;
function Next_Discriminant (Id : E) return E;
@@ -6179,6 +6212,13 @@ package Einfo is
-- value is always known static for discrete types (and no other types can
-- have an RM_Size value of zero).
+ -- In two cases, Known_Static_Esize and Known_Static_RM_Size, there is one
+ -- more consideration, which is that we always return False for generic
+ -- types. Within a template, the size can look known, because of the fake
+ -- size values we put in template types, but they are not really known and
+ -- anyone testing if they are known within the template should get False as
+ -- a result to prevent incorrect assumptions.
+
function Known_Alignment (E : Entity_Id) return B;
function Known_Component_Bit_Offset (E : Entity_Id) return B;
function Known_Component_Size (E : Entity_Id) return B;
@@ -6291,6 +6331,7 @@ package Einfo is
procedure Set_Finalization_Chain_Entity (Id : E; V : E);
procedure Set_Finalize_Storage_Only (Id : E; V : B := True);
procedure Set_First_Entity (Id : E; V : E);
+ procedure Set_First_Exit_Statement (Id : E; V : N);
procedure Set_First_Index (Id : E; V : N);
procedure Set_First_Literal (Id : E; V : E);
procedure Set_First_Optional_Parameter (Id : E; V : E);
@@ -6455,7 +6496,6 @@ package Einfo is
procedure Set_Is_Private_Composite (Id : E; V : B := True);
procedure Set_Is_Private_Descendant (Id : E; V : B := True);
procedure Set_Is_Private_Primitive (Id : E; V : B := True);
- procedure Set_Is_Protected_Interface (Id : E; V : B := True);
procedure Set_Is_Public (Id : E; V : B := True);
procedure Set_Is_Pure (Id : E; V : B := True);
procedure Set_Is_Pure_Unit_Access_Type (Id : E; V : B := True);
@@ -6467,10 +6507,8 @@ package Einfo is
procedure Set_Is_Return_Object (Id : E; V : B := True);
procedure Set_Is_Shared_Passive (Id : E; V : B := True);
procedure Set_Is_Statically_Allocated (Id : E; V : B := True);
- procedure Set_Is_Synchronized_Interface (Id : E; V : B := True);
procedure Set_Is_Tag (Id : E; V : B := True);
procedure Set_Is_Tagged_Type (Id : E; V : B := True);
- procedure Set_Is_Task_Interface (Id : E; V : B := True);
procedure Set_Is_Thunk (Id : E; V : B := True);
procedure Set_Is_Trivial_Subprogram (Id : E; V : B := True);
procedure Set_Is_True_Constant (Id : E; V : B := True);
@@ -6757,6 +6795,11 @@ package Einfo is
-- value returned is the N_Attribute_Definition_Clause node, otherwise
-- Empty is returned.
+ function Get_Record_Representation_Clause (E : Entity_Id) return Node_Id;
+ -- Searches the Rep_Item chain for a given entyt E, for a record
+ -- representation clause, and if found, returns it. Returns Empty
+ -- if no such clause is found.
+
function Get_Rep_Pragma (E : Entity_Id; Nam : Name_Id) return Node_Id;
-- Searches the Rep_Item chain for the given entity E, for an instance
-- a representation pragma with the given name Nam. If found then the
@@ -6793,9 +6836,9 @@ package Einfo is
-- Add an entity to the list of entities declared in the scope V
function Get_Full_View (T : Entity_Id) return Entity_Id;
- -- If T is an incomplete type and the full declaration has been
- -- seen, or is the name of a class_wide type whose root is incomplete.
- -- return the corresponding full declaration.
+ -- If T is an incomplete type and the full declaration has been seen, or
+ -- is the name of a class_wide type whose root is incomplete, return the
+ -- corresponding full declaration, else return T itself.
function Is_Entity_Name (N : Node_Id) return Boolean;
-- Test if the node N is the name of an entity (i.e. is an identifier,
@@ -6945,6 +6988,7 @@ package Einfo is
pragma Inline (Can_Use_Internal_Rep);
pragma Inline (Finalization_Chain_Entity);
pragma Inline (First_Entity);
+ pragma Inline (First_Exit_Statement);
pragma Inline (First_Index);
pragma Inline (First_Literal);
pragma Inline (First_Optional_Parameter);
@@ -7141,7 +7185,6 @@ package Einfo is
pragma Inline (Is_Private_Descendant);
pragma Inline (Is_Private_Primitive);
pragma Inline (Is_Private_Type);
- pragma Inline (Is_Protected_Interface);
pragma Inline (Is_Protected_Type);
pragma Inline (Is_Public);
pragma Inline (Is_Pure);
@@ -7159,10 +7202,8 @@ package Einfo is
pragma Inline (Is_Signed_Integer_Type);
pragma Inline (Is_Statically_Allocated);
pragma Inline (Is_Subprogram);
- pragma Inline (Is_Synchronized_Interface);
pragma Inline (Is_Tag);
pragma Inline (Is_Tagged_Type);
- pragma Inline (Is_Task_Interface);
pragma Inline (Is_True_Constant);
pragma Inline (Is_Task_Type);
pragma Inline (Is_Thunk);
@@ -7376,6 +7417,7 @@ package Einfo is
pragma Inline (Set_Can_Use_Internal_Rep);
pragma Inline (Set_Finalization_Chain_Entity);
pragma Inline (Set_First_Entity);
+ pragma Inline (Set_First_Exit_Statement);
pragma Inline (Set_First_Index);
pragma Inline (Set_First_Literal);
pragma Inline (Set_First_Optional_Parameter);
@@ -7540,7 +7582,6 @@ package Einfo is
pragma Inline (Set_Is_Private_Composite);
pragma Inline (Set_Is_Private_Descendant);
pragma Inline (Set_Is_Private_Primitive);
- pragma Inline (Set_Is_Protected_Interface);
pragma Inline (Set_Is_Public);
pragma Inline (Set_Is_Pure);
pragma Inline (Set_Is_Pure_Unit_Access_Type);
@@ -7552,10 +7593,8 @@ package Einfo is
pragma Inline (Set_Is_Return_Object);
pragma Inline (Set_Is_Shared_Passive);
pragma Inline (Set_Is_Statically_Allocated);
- pragma Inline (Set_Is_Synchronized_Interface);
pragma Inline (Set_Is_Tag);
pragma Inline (Set_Is_Tagged_Type);
- pragma Inline (Set_Is_Task_Interface);
pragma Inline (Set_Is_Thunk);
pragma Inline (Set_Is_Trivial_Subprogram);
pragma Inline (Set_Is_True_Constant);
diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index c8b49ebe122..c53678ab831 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2005-2009, Free Software Foundation, Inc. *
+ * Copyright (C) 2005-2010, 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- *
@@ -107,9 +107,7 @@ typedef struct _ile3
void
__gnat_setenv (char *name, char *value)
{
-#ifdef MSDOS
-
-#elif defined (VMS)
+#if defined (VMS)
struct descriptor_s name_desc;
/* Put in JOB table for now, so that the project stuff at least works. */
struct descriptor_s table_desc = {7, 0, "LNM$JOB"};
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 651b43d1122..e307ce7e44d 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -43,6 +43,7 @@ with Opt; use Opt;
with Nlists; use Nlists;
with Output; use Output;
with Scans; use Scans;
+with Sem_Aux; use Sem_Aux;
with Sinput; use Sinput;
with Sinfo; use Sinfo;
with Snames; use Snames;
@@ -176,25 +177,24 @@ package body Errout is
-- If the message should be generated (the normal case) False is returned.
procedure Unwind_Internal_Type (Ent : in out Entity_Id);
- -- This procedure is given an entity id for an internal type, i.e.
- -- a type with an internal name. It unwinds the type to try to get
- -- to something reasonably printable, generating prefixes like
- -- "subtype of", "access to", etc along the way in the buffer. The
- -- value in Ent on return is the final name to be printed. Hopefully
- -- this is not an internal name, but in some internal name cases, it
- -- is an internal name, and has to be printed anyway (although in this
- -- case the message has been killed if possible). The global variable
- -- Class_Flag is set to True if the resulting entity should have
- -- 'Class appended to its name (see Add_Class procedure), and is
- -- otherwise unchanged.
+ -- This procedure is given an entity id for an internal type, i.e. a type
+ -- with an internal name. It unwinds the type to try to get to something
+ -- reasonably printable, generating prefixes like "subtype of", "access
+ -- to", etc along the way in the buffer. The value in Ent on return is the
+ -- final name to be printed. Hopefully this is not an internal name, but in
+ -- some internal name cases, it is an internal name, and has to be printed
+ -- anyway (although in this case the message has been killed if possible).
+ -- The global variable Class_Flag is set to True if the resulting entity
+ -- should have 'Class appended to its name (see Add_Class procedure), and
+ -- is otherwise unchanged.
procedure VMS_Convert;
- -- This procedure has no effect if called when the host is not OpenVMS.
- -- If the host is indeed OpenVMS, then the error message stored in
- -- Msg_Buffer is scanned for appearances of switch names which need
- -- converting to corresponding VMS qualifier names. See Gnames/Vnames
- -- table in Errout spec for precise definition of the conversion that
- -- is performed by this routine in OpenVMS mode.
+ -- This procedure has no effect if called when the host is not OpenVMS. If
+ -- the host is indeed OpenVMS, then the error message stored in Msg_Buffer
+ -- is scanned for appearances of switch names which need converting to
+ -- corresponding VMS qualifier names. See Gnames/Vnames table in Errout
+ -- spec for precise definition of the conversion that is performed by this
+ -- routine in OpenVMS mode.
-----------------------
-- Change_Error_Text --
@@ -242,10 +242,10 @@ package body Errout is
---------------
-- Error_Msg posts a flag at the given location, except that if the
- -- Flag_Location points within a generic template and corresponds
- -- to an instantiation of this generic template, then the actual
- -- message will be posted on the generic instantiation, along with
- -- additional messages referencing the generic declaration.
+ -- Flag_Location points within a generic template and corresponds to an
+ -- instantiation of this generic template, then the actual message will be
+ -- posted on the generic instantiation, along with additional messages
+ -- referencing the generic declaration.
procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr) is
Sindex : Source_File_Index;
@@ -256,8 +256,8 @@ package body Errout is
-- template in instantiation case, otherwise unchanged).
begin
- -- It is a fatal error to issue an error message when scanning from
- -- the internal source buffer (see Sinput for further documentation)
+ -- It is a fatal error to issue an error message when scanning from the
+ -- internal source buffer (see Sinput for further documentation)
pragma Assert (Sinput.Source /= Internal_Source_Ptr);
@@ -267,8 +267,8 @@ package body Errout is
return;
end if;
- -- If we already have messages, and we are trying to place a message
- -- at No_Location or in package Standard, then just ignore the attempt
+ -- If we already have messages, and we are trying to place a message at
+ -- No_Location or in package Standard, then just ignore the attempt
-- since we assume that what is happening is some cascaded junk. Note
-- that this is safe in the sense that proceeding will surely bomb.
@@ -284,24 +284,23 @@ package body Errout is
Test_Style_Warning_Serious_Msg (Msg);
Orig_Loc := Original_Location (Flag_Location);
- -- If the current location is in an instantiation, the issue arises
- -- of whether to post the message on the template or the instantiation.
+ -- If the current location is in an instantiation, the issue arises of
+ -- whether to post the message on the template or the instantiation.
- -- The way we decide is to see if we have posted the same message
- -- on the template when we compiled the template (the template is
- -- always compiled before any instantiations). For this purpose,
- -- we use a separate table of messages. The reason we do this is
- -- twofold:
+ -- The way we decide is to see if we have posted the same message on
+ -- the template when we compiled the template (the template is always
+ -- compiled before any instantiations). For this purpose, we use a
+ -- separate table of messages. The reason we do this is twofold:
-- First, the messages can get changed by various processing
-- including the insertion of tokens etc, making it hard to
-- do the comparison.
- -- Second, we will suppress a warning on a template if it is
- -- not in the current extended source unit. That's reasonable
- -- and means we don't want the warning on the instantiation
- -- here either, but it does mean that the main error table
- -- would not in any case include the message.
+ -- Second, we will suppress a warning on a template if it is not in
+ -- the current extended source unit. That's reasonable and means we
+ -- don't want the warning on the instantiation here either, but it
+ -- does mean that the main error table would not in any case include
+ -- the message.
if Flag_Location = Orig_Loc then
Non_Instance_Msgs.Append ((new String'(Msg), Flag_Location));
@@ -310,8 +309,8 @@ package body Errout is
-- Here we have an instance message
else
- -- Delete if debug flag off, and this message duplicates a
- -- message already posted on the corresponding template
+ -- Delete if debug flag off, and this message duplicates a message
+ -- already posted on the corresponding template
if not Debug_Flag_GG then
for J in Non_Instance_Msgs.First .. Non_Instance_Msgs.Last loop
@@ -373,9 +372,9 @@ package body Errout is
-- instantiation error message can be repeated, pointing to each
-- of the relevant instantiations.
- -- Note: the instantiation mechanism is also shared for inlining
- -- of subprogram bodies when front end inlining is done. In this
- -- case the messages have the form:
+ -- Note: the instantiation mechanism is also shared for inlining of
+ -- subprogram bodies when front end inlining is done. In this case the
+ -- messages have the form:
-- in inlined body at ...
-- original error message
@@ -385,9 +384,8 @@ package body Errout is
-- warning: in inlined body at
-- warning: original warning message
- -- OK, this is the case where we have an instantiation error, and
- -- we need to generate the error on the instantiation, rather than
- -- on the template.
+ -- OK, here we have an instantiation error, and we need to generate the
+ -- error on the instantiation, rather than on the template.
declare
Actual_Error_Loc : Source_Ptr;
@@ -396,9 +394,9 @@ package body Errout is
-- location where all error messages will actually be posted.
Save_Error_Msg_Sloc : constant Source_Ptr := Error_Msg_Sloc;
- -- Save possible location set for caller's message. We need to
- -- use Error_Msg_Sloc for the location of the instantiation error
- -- but we have to preserve a possible original value.
+ -- Save possible location set for caller's message. We need to use
+ -- Error_Msg_Sloc for the location of the instantiation error but we
+ -- have to preserve a possible original value.
X : Source_File_Index;
@@ -417,10 +415,9 @@ package body Errout is
exit when Instantiation (X) = No_Location;
end loop;
- -- Since we are generating the messages at the instantiation
- -- point in any case, we do not want the references to the
- -- bad lines in the instance to be annotated with the location
- -- of the instantiation.
+ -- Since we are generating the messages at the instantiation point in
+ -- any case, we do not want the references to the bad lines in the
+ -- instance to be annotated with the location of the instantiation.
Suppress_Instance_Location := True;
Msg_Cont_Status := False;
@@ -679,10 +676,10 @@ package body Errout is
Expander_Active := False;
end if;
- -- Set the fatal error flag in the unit table unless we are
- -- in Try_Semantics mode. This stops the semantics from being
- -- performed if we find a serious error. This is skipped if we
- -- are currently dealing with the configuration pragma file.
+ -- Set the fatal error flag in the unit table unless we are in
+ -- Try_Semantics mode. This stops the semantics from being performed
+ -- if we find a serious error. This is skipped if we are currently
+ -- dealing with the configuration pragma file.
if not Try_Semantics and then Current_Source_Unit /= No_Unit then
Set_Fatal_Error (Get_Source_Unit (Sptr));
@@ -722,10 +719,10 @@ package body Errout is
return;
end if;
- -- Return without doing anything if message is killed and this
- -- is not the first error message. The philosophy is that if we
- -- get a weird error message and we already have had a message,
- -- then we hope the weird message is a junk cascaded message
+ -- Return without doing anything if message is killed and this is not
+ -- the first error message. The philosophy is that if we get a weird
+ -- error message and we already have had a message, then we hope the
+ -- weird message is a junk cascaded message
if Kill_Message
and then not All_Errors_Mode
@@ -749,15 +746,15 @@ package body Errout is
return;
end if;
- -- If the flag location is in the main extended source unit
- -- then for sure we want the warning since it definitely belongs
+ -- If the flag location is in the main extended source unit then for
+ -- sure we want the warning since it definitely belongs
if In_Extended_Main_Source_Unit (Sptr) then
null;
- -- If the flag location is not in the main extended source unit,
- -- then we want to eliminate the warning, unless it is in the
- -- extended main code unit and we want warnings on the instance.
+ -- If the flag location is not in the main extended source unit, then
+ -- we want to eliminate the warning, unless it is in the extended
+ -- main code unit and we want warnings on the instance.
elsif In_Extended_Main_Code_Unit (Sptr) and then Warn_On_Instance then
null;
@@ -884,6 +881,7 @@ package body Errout is
Errors.Append
((Text => new String'(Msg_Buffer (1 .. Msglen)),
Next => No_Error_Msg,
+ Prev => No_Error_Msg,
Sptr => Sptr,
Optr => Optr,
Sfile => Get_Source_File_Index (Sptr),
@@ -1217,7 +1215,34 @@ package body Errout is
Nxt : Error_Msg_Id;
F : Error_Msg_Id;
+ procedure Delete_Warning (E : Error_Msg_Id);
+ -- Delete a message if not already deleted and adjust warning count
+
+ --------------------
+ -- Delete_Warning --
+ --------------------
+
+ procedure Delete_Warning (E : Error_Msg_Id) is
+ begin
+ if not Errors.Table (E).Deleted then
+ Errors.Table (E).Deleted := True;
+ Warnings_Detected := Warnings_Detected - 1;
+ end if;
+ end Delete_Warning;
+
+ -- Start of message for Finalize
+
begin
+ -- Set Prev pointers
+
+ Cur := First_Error_Msg;
+ while Cur /= No_Error_Msg loop
+ Nxt := Errors.Table (Cur).Next;
+ exit when Nxt = No_Error_Msg;
+ Errors.Table (Nxt).Prev := Cur;
+ Cur := Nxt;
+ end loop;
+
-- Eliminate any duplicated error messages from the list. This is
-- done after the fact to avoid problems with Change_Error_Text.
@@ -1242,11 +1267,27 @@ package body Errout is
while Cur /= No_Error_Msg loop
if not Errors.Table (Cur).Deleted
and then Warning_Specifically_Suppressed
- (Errors.Table (Cur).Sptr,
- Errors.Table (Cur).Text)
+ (Errors.Table (Cur).Sptr, Errors.Table (Cur).Text)
then
- Errors.Table (Cur).Deleted := True;
- Warnings_Detected := Warnings_Detected - 1;
+ Delete_Warning (Cur);
+
+ -- If this is a continuation, delete previous messages
+
+ F := Cur;
+ while Errors.Table (F).Msg_Cont loop
+ F := Errors.Table (F).Prev;
+ Delete_Warning (F);
+ end loop;
+
+ -- Delete any following continuations
+
+ F := Cur;
+ loop
+ F := Errors.Table (F).Next;
+ exit when F = No_Error_Msg;
+ exit when not Errors.Table (F).Msg_Cont;
+ Delete_Warning (F);
+ end loop;
end if;
Cur := Errors.Table (Cur).Next;
@@ -1325,13 +1366,12 @@ package body Errout is
S := Sloc (F);
-- The following circuit is a bit subtle. When we have parenthesized
- -- expressions, then the Sloc will not record the location of the
- -- paren, but we would like to post the flag on the paren. So what
- -- we do is to crawl up the tree from the First_Node, adjusting the
- -- Sloc value for any parentheses we know are present. Yes, we know
- -- this circuit is not 100% reliable (e.g. because we don't record
- -- all possible paren level values), but this is only for an error
- -- message so it is good enough.
+ -- expressions, then the Sloc will not record the location of the paren,
+ -- but we would like to post the flag on the paren. So what we do is to
+ -- crawl up the tree from the First_Node, adjusting the Sloc value for
+ -- any parentheses we know are present. Yes, we know this circuit is not
+ -- 100% reliable (e.g. because we don't record all possible paren level
+ -- values), but this is only for an error message so it is good enough.
Node_Loop : loop
Paren_Loop : for J in 1 .. Paren_Count (F) loop
@@ -1378,8 +1418,8 @@ package body Errout is
Cur_Msg := No_Error_Msg;
List_Pragmas.Init;
- -- Initialize warnings table, if all warnings are suppressed, supply
- -- an initial dummy entry covering all possible source locations.
+ -- Initialize warnings table, if all warnings are suppressed, supply an
+ -- initial dummy entry covering all possible source locations.
Warnings.Init;
Specific_Warnings.Init;
@@ -2100,12 +2140,12 @@ package body Errout is
Flen := Flen + 1;
end loop;
- -- Loop through file names to find matching one. This is a bit slow,
- -- but we only do it in error situations so it is not so terrible.
- -- Note that if the loop does not exit, then the desired case will
- -- be left set to Mixed_Case, this can happen if the name was not
- -- in canonical form, and gets canonicalized on VMS. Possibly we
- -- could fix this by unconditinally canonicalizing these names ???
+ -- Loop through file names to find matching one. This is a bit slow, but
+ -- we only do it in error situations so it is not so terrible. Note that
+ -- if the loop does not exit, then the desired case will be left set to
+ -- Mixed_Case, this can happen if the name was not in canonical form,
+ -- and gets canonicalized on VMS. Possibly we could fix this by
+ -- unconditinally canonicalizing these names ???
for J in 1 .. Last_Source_File loop
Get_Name_String (Full_Debug_Name (J));
@@ -2185,9 +2225,9 @@ package body Errout is
K := Nkind (Error_Msg_Node_1);
-- If we have operator case, skip quotes since name of operator
- -- itself will supply the required quotations. An operator can be
- -- an applied use in an expression or an explicit operator symbol,
- -- or an identifier whose name indicates it is an operator.
+ -- itself will supply the required quotations. An operator can be an
+ -- applied use in an expression or an explicit operator symbol, or an
+ -- identifier whose name indicates it is an operator.
if K in N_Op
or else K = N_Operator_Symbol
@@ -2333,8 +2373,8 @@ package body Errout is
Set_Msg_Node (Ent);
Add_Class;
- -- If Ent is an anonymous subprogram type, there is no name
- -- to print, so remove enclosing quotes.
+ -- If Ent is an anonymous subprogram type, there is no name to print,
+ -- so remove enclosing quotes.
if Buffer_Ends_With ("""") then
Buffer_Remove ("""");
@@ -2343,8 +2383,8 @@ package body Errout is
end if;
end if;
- -- If the original type did not come from a predefined
- -- file, add the location where the type was defined.
+ -- If the original type did not come from a predefined file, add the
+ -- location where the type was defined.
if Sloc (Error_Msg_Node_1) > Standard_Location
and then
@@ -2504,7 +2544,7 @@ package body Errout is
-- in case, which is the case when we can copy from the source.
declare
- Src_Loc : constant Source_Ptr := Sloc (Error_Msg_Node_1);
+ Src_Loc : constant Source_Ptr := Sloc (Node);
Sbuffer : Source_Buffer_Ptr;
Ref_Ptr : Integer;
Src_Ptr : Source_Ptr;
@@ -2521,9 +2561,9 @@ package body Errout is
Set_Casing (Mixed_Case);
else
- -- Determine if the reference we are dealing with corresponds
- -- to text at the point of the error reference. This will often
- -- be the case for simple identifier references, and is the case
+ -- Determine if the reference we are dealing with corresponds to
+ -- text at the point of the error reference. This will often be
+ -- the case for simple identifier references, and is the case
-- where we can copy the spelling from the source.
Sbuffer := Source_Text (Get_Source_File_Index (Src_Loc));
@@ -2536,8 +2576,8 @@ package body Errout is
Src_Ptr := Src_Ptr + 1;
end loop;
- -- If we get through the loop without a mismatch, then output
- -- the name the way it is spelled in the source program
+ -- If we get through the loop without a mismatch, then output the
+ -- name the way it is spelled in the source program
if Ref_Ptr > Name_Len then
Src_Ptr := Src_Loc;
@@ -2572,8 +2612,8 @@ package body Errout is
Is_Unconditional_Msg := False;
Msglen := 0;
Flag_Source := Get_Source_File_Index (Flag);
- P := Text'First;
+ P := Text'First;
while P <= Text'Last loop
C := Text (P);
P := P + 1;
@@ -2829,7 +2869,7 @@ package body Errout is
-- "type derived from" message more than once in the case where we climb
-- up multiple levels.
- loop
+ Find : loop
Old_Ent := Ent;
-- Implicit access type, use directly designated type In Ada 2005,
@@ -2877,7 +2917,7 @@ package body Errout is
Set_Msg_Str ("access to procedure ");
end if;
- exit;
+ exit Find;
-- Type is access to object, named or anonymous
@@ -2915,51 +2955,54 @@ package body Errout is
-- itself an internal name. This avoids the obvious loop (subtype ->
-- basetype -> subtype) which would otherwise occur!)
- elsif Present (Freeze_Node (Ent))
- and then Present (First_Subtype_Link (Freeze_Node (Ent)))
- and then
- not Is_Internal_Name
- (Chars (First_Subtype_Link (Freeze_Node (Ent))))
- then
- Ent := First_Subtype_Link (Freeze_Node (Ent));
+ else
+ declare
+ FST : constant Entity_Id := First_Subtype (Ent);
- -- Otherwise use root type
+ begin
+ if not Is_Internal_Name (Chars (FST)) then
+ Ent := FST;
+ exit Find;
- else
- if not Derived then
- Buffer_Remove ("type ");
+ -- Otherwise use root type
- -- Test for "subtype of type derived from" which seems
- -- excessive and is replaced by simply "type derived from"
+ else
+ if not Derived then
+ Buffer_Remove ("type ");
- Buffer_Remove ("subtype of");
+ -- Test for "subtype of type derived from" which seems
+ -- excessive and is replaced by "type derived from".
- -- Avoid duplication "type derived from type derived from"
+ Buffer_Remove ("subtype of");
- if not Buffer_Ends_With ("type derived from ") then
- Set_Msg_Str ("type derived from ");
- end if;
+ -- Avoid duplicated "type derived from type derived from"
- Derived := True;
- end if;
+ if not Buffer_Ends_With ("type derived from ") then
+ Set_Msg_Str ("type derived from ");
+ end if;
+
+ Derived := True;
+ end if;
+ end if;
+ end;
Ent := Etype (Ent);
end if;
-- If we are stuck in a loop, get out and settle for the internal
- -- name after all. In this case we set to kill the message if it
- -- is not the first error message (we really try hard not to show
- -- the dirty laundry of the implementation to the poor user!)
+ -- name after all. In this case we set to kill the message if it is
+ -- not the first error message (we really try hard not to show the
+ -- dirty laundry of the implementation to the poor user!)
if Ent = Old_Ent then
Kill_Message := True;
- exit;
+ exit Find;
end if;
-- Get out if we finally found a non-internal name to use
- exit when not Is_Internal_Name (Chars (Ent));
- end loop;
+ exit Find when not Is_Internal_Name (Chars (Ent));
+ end loop Find;
if Mchar = '"' then
Set_Msg_Char ('"');
diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads
index e4d8a62e6dc..8251126f341 100644
--- a/gcc/ada/errout.ads
+++ b/gcc/ada/errout.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -376,6 +376,9 @@ package Errout is
Gname5 : aliased constant String := "gnat05";
Vname5 : aliased constant String := "05";
+ Gname6 : aliased constant String := "gnat12";
+ Vname6 : aliased constant String := "12";
+
type Cstring_Ptr is access constant String;
Gnames : array (Nat range <>) of Cstring_Ptr :=
@@ -383,14 +386,16 @@ package Errout is
Gname2'Access,
Gname3'Access,
Gname4'Access,
- Gname5'Access);
+ Gname5'Access,
+ Gname6'Access);
Vnames : array (Nat range <>) of Cstring_Ptr :=
(Vname1'Access,
Vname2'Access,
Vname3'Access,
Vname4'Access,
- Vname5'Access);
+ Vname5'Access,
+ Vname6'Access);
-----------------------------------------------------
-- Global Values Used for Error Message Insertions --
@@ -601,13 +606,6 @@ package Errout is
-- without appropriate coordination. If new messages are added which may
-- be susceptible to automatic codefix action, they are marked using:
- -- Error_Msg -- CODEFIX???
- -- (parameters)
-
- -- And subsequently either the appropriate code is added to codefix and the
- -- ??? are removed, or it is determined that this is not an appropriate
- -- case for codefix action, and the comment is removed.
-
------------------------------
-- Error Output Subprograms --
------------------------------
diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads
index f2127deaa39..d7628ed01ca 100644
--- a/gcc/ada/erroutc.ads
+++ b/gcc/ada/erroutc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -147,6 +147,11 @@ package Erroutc is
-- Pointer to next message in error chain. A value of No_Error_Msg
-- indicates the end of the chain.
+ Prev : Error_Msg_Id;
+ -- Pointer to previous message in error chain. Only set during the
+ -- Finalize procedure. A value of No_Error_Msg indicates the first
+ -- message in the chain.
+
Sfile : Source_File_Index;
-- Source table index of source file. In the case of an error that
-- refers to a template, always references the original template
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 6e3edc192b9..36045190d53 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -93,7 +93,7 @@ package body Exp_Aggr is
function Has_Default_Init_Comps (N : Node_Id) return Boolean;
-- N is an aggregate (record or array). Checks the presence of default
- -- initialization (<>) in any component (Ada 2005: AI-287)
+ -- initialization (<>) in any component (Ada 2005: AI-287).
function Is_Static_Dispatch_Table_Aggregate (N : Node_Id) return Boolean;
-- Returns true if N is an aggregate used to initialize the components
@@ -173,14 +173,15 @@ package body Exp_Aggr is
-----------------------------------------------------
function Aggr_Size_OK (N : Node_Id; Typ : Entity_Id) return Boolean;
- -- Very large static aggregates present problems to the back-end, and
- -- are transformed into assignments and loops. This function verifies
- -- that the total number of components of an aggregate is acceptable
- -- for transformation into a purely positional static form. It is called
- -- prior to calling Flatten.
- -- This function also detects and warns about one-component aggregates
- -- that appear in a non-static context. Even if the component value is
- -- static, such an aggregate must be expanded into an assignment.
+ -- Very large static aggregates present problems to the back-end, and are
+ -- transformed into assignments and loops. This function verifies that the
+ -- total number of components of an aggregate is acceptable for rewriting
+ -- into a purely positional static form. Aggr_Size_OK must be called before
+ -- calling Flatten.
+ --
+ -- This function also detects and warns about one-component aggregates that
+ -- appear in a non-static context. Even if the component value is static,
+ -- such an aggregate must be expanded into an assignment.
procedure Convert_Array_Aggr_In_Allocator
(Decl : Node_Id;
@@ -1347,7 +1348,7 @@ package body Exp_Aggr is
-- Otherwise construct the loop, starting with the loop index L_J
- L_J := Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
+ L_J := Make_Temporary (Loc, 'J', L);
-- Construct "L .. H" in Index_Base. We use a qualified expression
-- for the bound to convert to the index base, but we don't need
@@ -1455,7 +1456,7 @@ package body Exp_Aggr is
-- Build the decl of W_J
- W_J := Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
+ W_J := Make_Temporary (Loc, 'J', L);
W_Decl :=
Make_Object_Declaration
(Loc,
@@ -2426,14 +2427,16 @@ package body Exp_Aggr is
function Rewrite_Discriminant (Expr : Node_Id) return Traverse_Result is
begin
- if Nkind (Expr) = N_Identifier
+ if Is_Entity_Name (Expr)
and then Present (Entity (Expr))
and then Ekind (Entity (Expr)) = E_In_Parameter
and then Present (Discriminal_Link (Entity (Expr)))
+ and then Scope (Discriminal_Link (Entity (Expr)))
+ = Base_Type (Etype (N))
then
Rewrite (Expr,
Make_Selected_Component (Loc,
- Prefix => New_Occurrence_Of (Obj, Loc),
+ Prefix => New_Copy_Tree (Lhs),
Selector_Name => Make_Identifier (Loc, Chars (Expr))));
end if;
return OK;
@@ -2860,14 +2863,14 @@ package body Exp_Aggr is
if Is_CPP_Constructor_Call (Expression (Comp)) then
Append_List_To (L,
Build_Initialization_Call (Loc,
- Id_Ref => Make_Selected_Component (Loc,
- Prefix => New_Copy_Tree (Target),
- Selector_Name => New_Occurrence_Of (Selector,
- Loc)),
- Typ => Etype (Selector),
- Enclos_Type => Typ,
+ Id_Ref => Make_Selected_Component (Loc,
+ Prefix => New_Copy_Tree (Target),
+ Selector_Name =>
+ New_Occurrence_Of (Selector, Loc)),
+ Typ => Etype (Selector),
+ Enclos_Type => Typ,
With_Default_Init => True,
- Constructor_Ref => Expression (Comp)));
+ Constructor_Ref => Expression (Comp)));
-- Ada 2005 (AI-287): For each default-initialized component generate
-- a call to the corresponding IP subprogram if available.
@@ -2886,8 +2889,8 @@ package body Exp_Aggr is
declare
Ctype : constant Entity_Id := Etype (Selector);
- Inside_Allocator : Boolean := False;
- P : Node_Id := Parent (N);
+ Inside_Allocator : Boolean := False;
+ P : Node_Id := Parent (N);
begin
if Is_Task_Type (Ctype) or else Has_Task (Ctype) then
@@ -2908,12 +2911,12 @@ package body Exp_Aggr is
Append_List_To (L,
Build_Initialization_Call (Loc,
- Id_Ref => Make_Selected_Component (Loc,
- Prefix => New_Copy_Tree (Target),
- Selector_Name => New_Occurrence_Of (Selector,
- Loc)),
- Typ => Etype (Selector),
- Enclos_Type => Typ,
+ Id_Ref => Make_Selected_Component (Loc,
+ Prefix => New_Copy_Tree (Target),
+ Selector_Name =>
+ New_Occurrence_Of (Selector, Loc)),
+ Typ => Etype (Selector),
+ Enclos_Type => Typ,
With_Default_Init => True));
-- Prepare for component assignment
@@ -3008,9 +3011,7 @@ package body Exp_Aggr is
-- the corresponding aggregate.
declare
- SubE : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ SubE : constant Entity_Id := Make_Temporary (Loc, 'T');
SubD : constant Node_Id :=
Make_Subtype_Declaration (Loc,
@@ -3784,10 +3785,11 @@ package body Exp_Aggr is
Rep_Count : Nat;
-- Used to validate Max_Others_Replicate limit
- Elmt : Node_Id;
- Num : Int := UI_To_Int (Lov);
- Choice : Node_Id;
- Lo, Hi : Node_Id;
+ Elmt : Node_Id;
+ Num : Int := UI_To_Int (Lov);
+ Choice_Index : Int;
+ Choice : Node_Id;
+ Lo, Hi : Node_Id;
begin
if Present (Expressions (N)) then
@@ -3913,9 +3915,18 @@ package body Exp_Aggr is
return False;
else
- Vals (UI_To_Int (Expr_Value (Choice))) :=
- New_Copy_Tree (Expression (Elmt));
- goto Continue;
+ Choice_Index := UI_To_Int (Expr_Value (Choice));
+ if Choice_Index in Vals'Range then
+ Vals (Choice_Index) :=
+ New_Copy_Tree (Expression (Elmt));
+ goto Continue;
+
+ else
+ -- Choice is statically out-of-range, will be
+ -- rewritten to raise Constraint_Error.
+
+ return False;
+ end if;
end if;
end if;
@@ -4122,12 +4133,6 @@ package body Exp_Aggr is
-- array sub-aggregate we start the computation from. Dim is the
-- dimension corresponding to the sub-aggregate.
- function Has_Address_Clause (D : Node_Id) return Boolean;
- -- If the aggregate is the expression in an object declaration, it
- -- cannot be expanded in place. This function does a lookahead in the
- -- current declarative part to find an address clause for the object
- -- being declared.
-
function In_Place_Assign_OK return Boolean;
-- Simple predicate to determine whether an aggregate assignment can
-- be done in place, because none of the new values can depend on the
@@ -4145,7 +4150,7 @@ package body Exp_Aggr is
procedure Build_Constrained_Type (Positional : Boolean) is
Loc : constant Source_Ptr := Sloc (N);
- Agg_Type : Entity_Id;
+ Agg_Type : constant Entity_Id := Make_Temporary (Loc, 'A');
Comp : Node_Id;
Decl : Node_Id;
Typ : constant Entity_Id := Etype (N);
@@ -4154,10 +4159,6 @@ package body Exp_Aggr is
Sub_Agg : Node_Id;
begin
- Agg_Type :=
- Make_Defining_Identifier (
- Loc, New_Internal_Name ('A'));
-
-- If the aggregate is purely positional, all its subaggregates
-- have the same size. We collect the dimensions from the first
-- subaggregate at each level.
@@ -4175,19 +4176,16 @@ package body Exp_Aggr is
Next (Comp);
end loop;
- Append (
+ Append_To (Indices,
Make_Range (Loc,
- Low_Bound => Make_Integer_Literal (Loc, 1),
- High_Bound =>
- Make_Integer_Literal (Loc, Num)),
- Indices);
+ Low_Bound => Make_Integer_Literal (Loc, 1),
+ High_Bound => Make_Integer_Literal (Loc, Num)));
end loop;
else
-- We know the aggregate type is unconstrained and the aggregate
-- is not processable by the back end, therefore not necessarily
-- positional. Retrieve each dimension bounds (computed earlier).
- -- earlier.
for D in 1 .. Number_Dimensions (Typ) loop
Append (
@@ -4435,35 +4433,6 @@ package body Exp_Aggr is
end Compute_Others_Present;
------------------------
- -- Has_Address_Clause --
- ------------------------
-
- function Has_Address_Clause (D : Node_Id) return Boolean is
- Id : constant Entity_Id := Defining_Identifier (D);
- Decl : Node_Id;
-
- begin
- Decl := Next (D);
- while Present (Decl) loop
- if Nkind (Decl) = N_At_Clause
- and then Chars (Identifier (Decl)) = Chars (Id)
- then
- return True;
-
- elsif Nkind (Decl) = N_Attribute_Definition_Clause
- and then Chars (Decl) = Name_Address
- and then Chars (Name (Decl)) = Chars (Id)
- then
- return True;
- end if;
-
- Next (Decl);
- end loop;
-
- return False;
- end Has_Address_Clause;
-
- ------------------------
-- In_Place_Assign_OK --
------------------------
@@ -5162,6 +5131,8 @@ package body Exp_Aggr is
Build_Activation_Chain_Entity (N);
end if;
+ -- Should document these individual tests ???
+
if not Has_Default_Init_Comps (N)
and then Comes_From_Source (Parent (N))
and then Nkind (Parent (N)) = N_Object_Declaration
@@ -5170,7 +5141,13 @@ package body Exp_Aggr is
and then N = Expression (Parent (N))
and then not Is_Bit_Packed_Array (Typ)
and then not Has_Controlled_Component (Typ)
- and then not Has_Address_Clause (Parent (N))
+
+ -- If the aggregate is the expression in an object declaration, it
+ -- cannot be expanded in place. Lookahead in the current declarative
+ -- part to find an address clause for the object being declared. If
+ -- one is present, we cannot build in place. Unclear comment???
+
+ and then not Has_Following_Address_Clause (Parent (N))
then
Tmp := Defining_Identifier (Parent (N));
Set_No_Initialization (Parent (N));
@@ -5720,9 +5697,7 @@ package body Exp_Aggr is
Decl :=
Make_Subtype_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('T')),
+ Defining_Identifier => Make_Temporary (Loc, 'T'),
Subtype_Indication =>
Make_Subtype_Indication (Loc,
Subtype_Mark =>
@@ -6411,9 +6386,8 @@ package body Exp_Aggr is
and then Nkind (First (Choices (First (Component_Associations (N)))))
= N_Others_Choice
then
- Expr :=
- Expression (First (Component_Associations (N)));
- L_J := Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
+ Expr := Expression (First (Component_Associations (N)));
+ L_J := Make_Temporary (Loc, 'J');
L_Iter :=
Make_Iteration_Scheme (Loc,
diff --git a/gcc/ada/exp_atag.adb b/gcc/ada/exp_atag.adb
index d5cdf0b79b7..23a9202c372 100644
--- a/gcc/ada/exp_atag.adb
+++ b/gcc/ada/exp_atag.adb
@@ -150,14 +150,10 @@ package body Exp_Atag is
Related_Nod : Node_Id;
New_Node : out Node_Id)
is
- Tag_Addr : constant Entity_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('D'));
- Obj_TSD : constant Entity_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('D'));
- Typ_TSD : constant Entity_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('D'));
- Index : constant Entity_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('D'));
+ Tag_Addr : constant Entity_Id := Make_Temporary (Loc, 'D', Obj_Tag_Node);
+ Obj_TSD : constant Entity_Id := Make_Temporary (Loc, 'D');
+ Typ_TSD : constant Entity_Id := Make_Temporary (Loc, 'D');
+ Index : constant Entity_Id := Make_Temporary (Loc, 'D');
begin
-- Generate:
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 48bd566b38b..5126e5a1730 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -280,16 +280,14 @@ package body Exp_Attr is
-- Start of processing for Expand_Access_To_Protected_Op
begin
- -- Within the body of the protected type, the prefix
- -- designates a local operation, and the object is the first
- -- parameter of the corresponding protected body of the
- -- current enclosing operation.
+ -- Within the body of the protected type, the prefix designates a local
+ -- operation, and the object is the first parameter of the corresponding
+ -- protected body of the current enclosing operation.
if Is_Entity_Name (Pref) then
if May_Be_External_Call then
Sub :=
- New_Occurrence_Of
- (External_Subprogram (Entity (Pref)), Loc);
+ New_Occurrence_Of (External_Subprogram (Entity (Pref)), Loc);
else
Sub :=
New_Occurrence_Of
@@ -372,6 +370,7 @@ package body Exp_Attr is
Make_Aggregate (Loc,
Expressions => New_List (Obj_Ref, Sub_Ref));
+ Freeze_Before (N, Entity (Sub));
Rewrite (N, Agg);
Analyze_And_Resolve (N, E_T);
@@ -530,9 +529,7 @@ package body Exp_Attr is
and then Is_Written
then
declare
- Temp : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, New_Internal_Name ('V'));
+ Temp : constant Entity_Id := Make_Temporary (Loc, 'V');
Decl : Node_Id;
Assn : Node_Id;
@@ -1208,6 +1205,20 @@ package body Exp_Attr is
Analyze_And_Resolve (N, RTE (RE_AST_Handler));
end AST_Entry;
+ ---------
+ -- Bit --
+ ---------
+
+ -- We compute this if a packed array reference was present, otherwise we
+ -- leave the computation up to the back end.
+
+ when Attribute_Bit =>
+ if Involves_Packed_Array_Reference (Pref) then
+ Expand_Packed_Bit_Reference (N);
+ else
+ Apply_Universal_Integer_Attribute_Checks (N);
+ end if;
+
------------------
-- Bit_Position --
------------------
@@ -1220,8 +1231,7 @@ package body Exp_Attr is
-- in generated code (i.e. the prefix is an identifier that
-- references the component or discriminant entity).
- when Attribute_Bit_Position => Bit_Position :
- declare
+ when Attribute_Bit_Position => Bit_Position : declare
CE : Entity_Id;
begin
@@ -1259,12 +1269,11 @@ package body Exp_Attr is
-- subprogram spec or package. This sequence of code references the
-- the unsigned constant created in the main program by the binder.
- -- A special exception occurs for Standard, where the string
- -- returned is a copy of the library string in gnatvsn.ads.
+ -- A special exception occurs for Standard, where the string returned
+ -- is a copy of the library string in gnatvsn.ads.
when Attribute_Body_Version | Attribute_Version => Version : declare
- E : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('V'));
+ E : constant Entity_Id := Make_Temporary (Loc, 'V');
Pent : Entity_Id;
S : String_Id;
@@ -1777,9 +1786,7 @@ package body Exp_Attr is
Attribute_Elab_Spec =>
Elab_Body : declare
- Ent : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('E'));
+ Ent : constant Entity_Id := Make_Temporary (Loc, 'E');
Str : String_Id;
Lang : Node_Id;
@@ -2389,13 +2396,14 @@ package body Exp_Attr is
Rtyp : constant Entity_Id := Root_Type (P_Type);
Dnn : Entity_Id;
Decl : Node_Id;
+ Expr : Node_Id;
begin
-- Read the internal tag (RM 13.13.2(34)) and use it to
-- initialize a dummy tag object:
- -- Dnn : Ada.Tags.Tag
- -- := Descendant_Tag (String'Input (Strm), P_Type);
+ -- Dnn : Ada.Tags.Tag :=
+ -- Descendant_Tag (String'Input (Strm), P_Type);
-- This dummy object is used only to provide a controlling
-- argument for the eventual _Input call. Descendant_Tag is
@@ -2406,30 +2414,28 @@ package body Exp_Attr is
-- required for Ada 2005 because tagged types can be
-- extended in nested scopes (AI-344).
- Dnn :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('D'));
+ Expr :=
+ Make_Function_Call (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Descendant_Tag), Loc),
+ Parameter_Associations => New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Standard_String, Loc),
+ Attribute_Name => Name_Input,
+ Expressions => New_List (
+ Relocate_Node (Duplicate_Subexpr (Strm)))),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (P_Type, Loc),
+ Attribute_Name => Name_Tag)));
+
+ Dnn := Make_Temporary (Loc, 'D', Expr);
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Dnn,
- Object_Definition =>
+ Object_Definition =>
New_Occurrence_Of (RTE (RE_Tag), Loc),
- Expression =>
- Make_Function_Call (Loc,
- Name =>
- New_Occurrence_Of (RTE (RE_Descendant_Tag), Loc),
- Parameter_Associations => New_List (
- Make_Attribute_Reference (Loc,
- Prefix =>
- New_Occurrence_Of (Standard_String, Loc),
- Attribute_Name => Name_Input,
- Expressions => New_List (
- Relocate_Node
- (Duplicate_Subexpr (Strm)))),
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (P_Type, Loc),
- Attribute_Name => Name_Tag))));
+ Expression => Expr);
Insert_Action (N, Decl);
@@ -2440,8 +2446,9 @@ package body Exp_Attr is
-- tagged object).
Fname := Find_Prim_Op (Rtyp, TSS_Stream_Input);
- Cntrl := Unchecked_Convert_To (P_Type,
- New_Occurrence_Of (Dnn, Loc));
+ Cntrl :=
+ Unchecked_Convert_To (P_Type,
+ New_Occurrence_Of (Dnn, Loc));
Set_Etype (Cntrl, P_Type);
Set_Parent (Cntrl, N);
end;
@@ -2987,9 +2994,7 @@ package body Exp_Attr is
---------
when Attribute_Old => Old : declare
- Tnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', Pref);
Subp : Node_Id;
Asn_Stm : Node_Id;
@@ -3239,9 +3244,9 @@ package body Exp_Attr is
-- For enumeration types with a standard representation, Pos is
-- handled by the back end.
- -- For enumeration types, with a non-standard representation we
- -- generate a call to the _Rep_To_Pos function created when the
- -- type was frozen. The call has the form
+ -- For enumeration types, with a non-standard representation we generate
+ -- a call to the _Rep_To_Pos function created when the type was frozen.
+ -- The call has the form
-- _rep_to_pos (expr, flag)
@@ -3548,6 +3553,7 @@ package body Exp_Attr is
------------------
when Attribute_Range_Length => Range_Length : begin
+
-- The only special processing required is for the case where
-- Range_Length is applied to an enumeration type with holes.
-- In this case we transform
@@ -3586,8 +3592,7 @@ package body Exp_Attr is
Attribute_Name => Name_First,
Prefix => New_Occurrence_Of (Ptyp, Loc))))),
- Right_Opnd =>
- Make_Integer_Literal (Loc, 1)));
+ Right_Opnd => Make_Integer_Literal (Loc, 1)));
Analyze_And_Resolve (N, Typ);
@@ -3707,7 +3712,7 @@ package body Exp_Attr is
Rewrite (N,
Make_Assignment_Statement (Loc,
- Name => Lhs,
+ Name => Lhs,
Expression => Rhs));
Analyze (N);
@@ -3785,9 +3790,7 @@ package body Exp_Attr is
-- the context of a _Postcondition function with a _Result parameter.
when Attribute_Result =>
- Rewrite (N,
- Make_Identifier (Loc,
- Chars => Name_uResult));
+ Rewrite (N, Make_Identifier (Loc, Chars => Name_uResult));
Analyze_And_Resolve (N, Typ);
-----------
@@ -4267,8 +4270,7 @@ package body Exp_Attr is
-- 2. For floating-point, generate call to attribute function
-- 3. For other cases, deal with constraint checking
- when Attribute_Succ => Succ :
- declare
+ when Attribute_Succ => Succ : declare
Etyp : constant Entity_Id := Base_Type (Ptyp);
begin
@@ -4360,8 +4362,7 @@ package body Exp_Attr is
-- Transforms X'Tag into a direct reference to the tag of X
- when Attribute_Tag => Tag :
- declare
+ when Attribute_Tag => Tag : declare
Ttyp : Entity_Id;
Prefix_Is_Type : Boolean;
@@ -4555,8 +4556,7 @@ package body Exp_Attr is
-----------------
when Attribute_UET_Address => UET_Address : declare
- Ent : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ Ent : constant Entity_Id := Make_Temporary (Loc, 'T');
begin
Insert_Action (N,
@@ -4609,8 +4609,7 @@ package body Exp_Attr is
-- with a non-standard representation we use the _Pos_To_Rep array that
-- was created when the type was frozen.
- when Attribute_Val => Val :
- declare
+ when Attribute_Val => Val : declare
Etyp : constant Entity_Id := Base_Type (Entity (Pref));
begin
@@ -4673,8 +4672,7 @@ package body Exp_Attr is
-- The code for valid is dependent on the particular types involved.
-- See separate sections below for the generated code in each case.
- when Attribute_Valid => Valid :
- declare
+ when Attribute_Valid => Valid : declare
Btyp : Entity_Id := Base_Type (Ptyp);
Tst : Node_Id;
@@ -4734,6 +4732,13 @@ package body Exp_Attr is
-- Start of processing for Attribute_Valid
begin
+ -- Do not expand sourced code 'Valid reference in CodePeer mode,
+ -- will be handled by the back-end directly.
+
+ if CodePeer_Mode and then Comes_From_Source (N) then
+ return;
+ end if;
+
-- Turn off validity checks. We do not want any implicit validity
-- checks to intefere with the explicit check from the attribute
@@ -5278,7 +5283,6 @@ package body Exp_Attr is
-- that the result is in range.
when Attribute_Aft |
- Attribute_Bit |
Attribute_Max_Size_In_Storage_Elements
=>
Apply_Universal_Integer_Attribute_Checks (N);
diff --git a/gcc/ada/exp_cg.adb b/gcc/ada/exp_cg.adb
new file mode 100644
index 00000000000..e7decc8f1e7
--- /dev/null
+++ b/gcc/ada/exp_cg.adb
@@ -0,0 +1,602 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- E X P _ C G --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Atree; use Atree;
+with Debug; use Debug;
+with Einfo; use Einfo;
+with Elists; use Elists;
+with Exp_Disp; use Exp_Disp;
+with Exp_Dbug; use Exp_Dbug;
+with Exp_Tss; use Exp_Tss;
+with Lib; use Lib;
+with Namet; use Namet;
+with Opt; use Opt;
+with Output; use Output;
+with Sem_Aux; use Sem_Aux;
+with Sem_Disp; use Sem_Disp;
+with Sem_Type; use Sem_Type;
+with Sem_Util; use Sem_Util;
+with Sinfo; use Sinfo;
+with Sinput; use Sinput;
+with Snames; use Snames;
+with System; use System;
+with Table;
+with Uintp; use Uintp;
+
+package body Exp_CG is
+
+ -- We duplicate here some declarations from packages Interfaces.C and
+ -- Interfaces.C_Streams because adding their dependence to the frontend
+ -- causes bootstrapping problems with old versions of the compiler.
+
+ subtype FILEs is System.Address;
+ -- Corresponds to the C type FILE*
+
+ subtype C_chars is System.Address;
+ -- Pointer to null-terminated array of characters
+
+ function fputs (Strng : C_chars; Stream : FILEs) return Integer;
+ pragma Import (C, fputs, "fputs");
+
+ -- Import the file stream associated with the "ci" output file. Done to
+ -- generate the output in the file created and left opened by routine
+ -- toplev.c before calling gnat1drv.
+
+ Callgraph_Info_File : FILEs;
+ pragma Import (C, Callgraph_Info_File);
+
+ package Call_Graph_Nodes is new Table.Table (
+ Table_Component_Type => Node_Id,
+ Table_Index_Type => Natural,
+ Table_Low_Bound => 1,
+ Table_Initial => 50,
+ Table_Increment => 100,
+ Table_Name => "Call_Graph_Nodes");
+ -- This table records nodes associated with dispatching calls and tagged
+ -- type declarations found in the main compilation unit. Used as an
+ -- auxiliary storage because the call-graph output requires fully qualified
+ -- names and they are not available until the backend is called.
+
+ function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean;
+ -- Determines if E is a predefined primitive operation.
+ -- Note: This routine should replace the routine with the same name that is
+ -- currently available in exp_disp because it extends its functionality to
+ -- handle fully qualified names ???
+
+ function Slot_Number (Prim : Entity_Id) return Uint;
+ -- Returns the slot number associated with Prim. For predefined primitives
+ -- the slot is returned as a negative number.
+
+ procedure Write_Output (Str : String);
+ -- Used to print a line in the output file (this is used as the
+ -- argument for a call to Set_Special_Output in package Output).
+
+ procedure Write_Call_Info (Call : Node_Id);
+ -- Subsidiary of Generate_CG_Output that generates the output associated
+ -- with a dispatching call.
+
+ procedure Write_Type_Info (Typ : Entity_Id);
+ -- Subsidiary of Generate_CG_Output that generates the output associated
+ -- with a tagged type declaration.
+
+ ------------------------
+ -- Generate_CG_Output --
+ ------------------------
+
+ procedure Generate_CG_Output is
+ N : Node_Id;
+
+ begin
+ -- No output if the "ci" output file has not been previously opened
+ -- by toplev.c. Temporarily the output is also disabled with -gnatd.Z
+
+ if Callgraph_Info_File = Null_Address
+ or else not Debug_Flag_Dot_ZZ
+ then
+ return;
+ end if;
+
+ -- Setup write routine, create the output file and generate the output
+
+ Set_Special_Output (Write_Output'Access);
+
+ for J in Call_Graph_Nodes.First .. Call_Graph_Nodes.Last loop
+ N := Call_Graph_Nodes.Table (J);
+
+ if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) then
+ Write_Call_Info (N);
+
+ else pragma Assert (Nkind (N) = N_Defining_Identifier);
+ pragma Assert (Is_Tagged_Type (N));
+
+ Write_Type_Info (N);
+ end if;
+ end loop;
+
+ Set_Special_Output (null);
+ end Generate_CG_Output;
+
+ ----------------
+ -- Initialize --
+ ----------------
+
+ procedure Initialize is
+ begin
+ Call_Graph_Nodes.Init;
+ end Initialize;
+
+ -----------------------------------------
+ -- Is_Predefined_Dispatching_Operation --
+ -----------------------------------------
+
+ function Is_Predefined_Dispatching_Operation
+ (E : Entity_Id) return Boolean
+ is
+ function Homonym_Suffix_Length (E : Entity_Id) return Natural;
+ -- Returns the length of the homonym suffix corresponding to E.
+ -- Note: This routine relies on the functionality provided by routines
+ -- of Exp_Dbug. Further work needed here to decide if it should be
+ -- located in that package???
+
+ ---------------------------
+ -- Homonym_Suffix_Length --
+ ---------------------------
+
+ function Homonym_Suffix_Length (E : Entity_Id) return Natural is
+ Prefix_Length : constant := 2; -- Length of prefix "__"
+
+ H : Entity_Id;
+ Nr : Nat := 1;
+
+ begin
+ if not Has_Homonym (E) then
+ return 0;
+
+ else
+ H := Homonym (E);
+ while Present (H) loop
+ if Scope (H) = Scope (E) then
+ Nr := Nr + 1;
+ end if;
+
+ H := Homonym (H);
+ end loop;
+
+ if Nr = 1 then
+ return 0;
+
+ -- Prefix "__" followed by number
+
+ else
+ declare
+ Result : Natural := Prefix_Length + 1;
+ begin
+ while Nr > 10 loop
+ Result := Result + 1;
+ Nr := Nr / 10;
+ end loop;
+ return Result;
+ end;
+ end if;
+ end if;
+ end Homonym_Suffix_Length;
+
+ -- Local variables
+
+ Full_Name : constant String := Get_Name_String (Chars (E));
+ TSS_Name : TSS_Name_Type;
+
+ -- Start of processing for Is_Predefined_Dispatching_Operation
+
+ begin
+ if not Is_Dispatching_Operation (E) then
+ return False;
+ end if;
+
+ -- Most predefined primitives have internally generated names. Equality
+ -- must be treated differently; the predefined operation is recognized
+ -- as a homogeneous binary operator that returns Boolean.
+
+ if Full_Name'Length > TSS_Name_Type'Length then
+ TSS_Name :=
+ TSS_Name_Type (Full_Name (Full_Name'Last - TSS_Name'Length + 1
+ .. Full_Name'Last));
+
+ if TSS_Name = TSS_Stream_Read
+ or else TSS_Name = TSS_Stream_Write
+ or else TSS_Name = TSS_Stream_Input
+ or else TSS_Name = TSS_Stream_Output
+ or else TSS_Name = TSS_Deep_Adjust
+ or else TSS_Name = TSS_Deep_Finalize
+ then
+ return True;
+
+ elsif not Has_Fully_Qualified_Name (E) then
+ if Chars (E) = Name_uSize
+ or else Chars (E) = Name_uAlignment
+ or else
+ (Chars (E) = Name_Op_Eq
+ and then Etype (First_Formal (E)) = Etype (Last_Formal (E)))
+ or else Chars (E) = Name_uAssign
+ or else Is_Predefined_Interface_Primitive (E)
+ then
+ return True;
+ end if;
+
+ -- Handle fully qualified names
+
+ else
+ declare
+ type Names_Table is array (Positive range <>) of Name_Id;
+
+ Predef_Names_95 : constant Names_Table :=
+ (Name_uSize,
+ Name_uAlignment,
+ Name_Op_Eq,
+ Name_uAssign);
+
+ Predef_Names_05 : constant Names_Table :=
+ (Name_uDisp_Asynchronous_Select,
+ Name_uDisp_Conditional_Select,
+ Name_uDisp_Get_Prim_Op_Kind,
+ Name_uDisp_Get_Task_Id,
+ Name_uDisp_Requeue,
+ Name_uDisp_Timed_Select);
+
+ Suffix_Length : constant Natural := Homonym_Suffix_Length (E);
+
+ begin
+ for J in Predef_Names_95'Range loop
+ Get_Name_String (Predef_Names_95 (J));
+
+ if Full_Name'Last - Suffix_Length > Name_Len
+ and then
+ Full_Name
+ (Full_Name'Last - Name_Len - Suffix_Length + 1
+ .. Full_Name'Last - Suffix_Length) =
+ Name_Buffer (1 .. Name_Len)
+ then
+ -- For the equality operator the type of the two operands
+ -- must also match.
+
+ return Predef_Names_95 (J) /= Name_Op_Eq
+ or else
+ Etype (First_Formal (E)) = Etype (Last_Formal (E));
+ end if;
+ end loop;
+
+ if Ada_Version >= Ada_05 then
+ for J in Predef_Names_05'Range loop
+ Get_Name_String (Predef_Names_05 (J));
+
+ if Full_Name'Last - Suffix_Length > Name_Len
+ and then
+ Full_Name
+ (Full_Name'Last - Name_Len - Suffix_Length + 1
+ .. Full_Name'Last - Suffix_Length) =
+ Name_Buffer (1 .. Name_Len)
+ then
+ return True;
+ end if;
+ end loop;
+ end if;
+ end;
+ end if;
+ end if;
+
+ return False;
+ end Is_Predefined_Dispatching_Operation;
+
+ ----------------------
+ -- Register_CG_Node --
+ ----------------------
+
+ procedure Register_CG_Node (N : Node_Id) is
+ begin
+ if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) then
+ if Current_Scope = Main_Unit_Entity
+ or else Entity_Is_In_Main_Unit (Current_Scope)
+ then
+ -- Register a copy of the dispatching call node. Needed since the
+ -- node containing a dispatching call is rewriten by the expander.
+
+ declare
+ Copy : constant Node_Id := New_Copy (N);
+
+ begin
+ -- Copy the link to the parent to allow climbing up the tree
+ -- when the call-graph information is generated
+
+ Set_Parent (Copy, Parent (N));
+ Call_Graph_Nodes.Append (Copy);
+ end;
+ end if;
+
+ else pragma Assert (Nkind (N) = N_Defining_Identifier);
+ if Entity_Is_In_Main_Unit (N) then
+ Call_Graph_Nodes.Append (N);
+ end if;
+ end if;
+ end Register_CG_Node;
+
+ -----------------
+ -- Slot_Number --
+ -----------------
+
+ function Slot_Number (Prim : Entity_Id) return Uint is
+ begin
+ if Is_Predefined_Dispatching_Operation (Prim) then
+ return -DT_Position (Prim);
+ else
+ return DT_Position (Prim);
+ end if;
+ end Slot_Number;
+
+ ------------------
+ -- Write_Output --
+ ------------------
+
+ procedure Write_Output (Str : String) is
+ Nul : constant Character := Character'First;
+ Line : String (Str'First .. Str'Last + 1);
+ Errno : Integer;
+ begin
+ -- Add the null character to the string as required by fputs
+
+ Line := Str & Nul;
+ Errno := fputs (Line'Address, Callgraph_Info_File);
+ pragma Assert (Errno >= 0);
+ end Write_Output;
+
+ ---------------------
+ -- Write_Call_Info --
+ ---------------------
+
+ procedure Write_Call_Info (Call : Node_Id) is
+ Ctrl_Arg : constant Node_Id := Controlling_Argument (Call);
+ Ctrl_Typ : constant Entity_Id := Base_Type (Etype (Ctrl_Arg));
+ Prim : constant Entity_Id := Entity (Sinfo.Name (Call));
+ P : Node_Id;
+
+ begin
+ -- Locate the enclosing context: a subprogram (if available) or the
+ -- enclosing library-level package
+
+ P := Parent (Call);
+ while Nkind (P) /= N_Subprogram_Body
+ and then Nkind (Parent (P)) /= N_Compilation_Unit
+ loop
+ P := Parent (P);
+ pragma Assert (Present (P));
+ end loop;
+
+ Write_Str ("edge: { sourcename: ");
+ Write_Char ('"');
+ Get_External_Name (Defining_Entity (P), Has_Suffix => False);
+ Write_Str (Name_Buffer (1 .. Name_Len));
+
+ if Nkind (P) = N_Package_Declaration then
+ Write_Str ("___elabs");
+
+ elsif Nkind (P) = N_Package_Body then
+ Write_Str ("___elabb");
+ end if;
+
+ Write_Char ('"');
+ Write_Eol;
+
+ -- The targetname is a triple:
+ -- N: the index in a vtable used for dispatch
+ -- V: the type who's vtable is used
+ -- S: the static type of the expression
+
+ Write_Str (" targetname: ");
+ Write_Char ('"');
+
+ pragma Assert (No (Interface_Alias (Prim)));
+
+ -- The check on Is_Ancestor is done here to avoid problems with
+ -- renamings of primitives. For example:
+
+ -- type Root is tagged ...
+ -- procedure Base (Obj : Root);
+ -- procedure Base2 (Obj : Root) renames Base;
+
+ if Present (Alias (Prim))
+ and then
+ Is_Ancestor
+ (Find_Dispatching_Type (Ultimate_Alias (Prim)),
+ Root_Type (Ctrl_Typ))
+ then
+ Write_Int (UI_To_Int (Slot_Number (Ultimate_Alias (Prim))));
+ Write_Char (':');
+ Write_Name
+ (Chars (Find_Dispatching_Type (Ultimate_Alias (Prim))));
+ else
+ Write_Int (UI_To_Int (Slot_Number (Prim)));
+ Write_Char (':');
+ Write_Name (Chars (Root_Type (Ctrl_Typ)));
+ end if;
+
+ Write_Char (',');
+ Write_Name (Chars (Root_Type (Ctrl_Typ)));
+
+ Write_Char ('"');
+ Write_Eol;
+
+ Write_Str (" label: ");
+ Write_Char ('"');
+ Write_Location (Sloc (Call));
+ Write_Char ('"');
+ Write_Eol;
+
+ Write_Char ('}');
+ Write_Eol;
+ end Write_Call_Info;
+
+ ---------------------
+ -- Write_Type_Info --
+ ---------------------
+
+ procedure Write_Type_Info (Typ : Entity_Id) is
+ Elmt : Elmt_Id;
+ Prim : Node_Id;
+
+ Parent_Typ : Entity_Id;
+ Separator_Needed : Boolean := False;
+
+ begin
+ -- Initialize Parent_Typ handling private types
+
+ Parent_Typ := Etype (Typ);
+
+ if Present (Full_View (Parent_Typ)) then
+ Parent_Typ := Full_View (Parent_Typ);
+ end if;
+
+ Write_Str ("class {");
+ Write_Eol;
+
+ Write_Str (" classname: ");
+ Write_Char ('"');
+ Write_Name (Chars (Typ));
+ Write_Char ('"');
+ Write_Eol;
+
+ Write_Str (" label: ");
+ Write_Char ('"');
+ Write_Name (Chars (Typ));
+ Write_Char ('\');
+ Write_Location (Sloc (Typ));
+ Write_Char ('"');
+ Write_Eol;
+
+ if Parent_Typ /= Typ then
+ Write_Str (" parent: ");
+ Write_Char ('"');
+ Write_Name (Chars (Parent_Typ));
+
+ -- Note: Einfo prefix not needed if this routine is moved to
+ -- exp_disp???
+
+ if Present (Einfo.Interfaces (Typ))
+ and then not Is_Empty_Elmt_List (Einfo.Interfaces (Typ))
+ then
+ Elmt := First_Elmt (Einfo.Interfaces (Typ));
+ while Present (Elmt) loop
+ Write_Str (", ");
+ Write_Name (Chars (Node (Elmt)));
+ Next_Elmt (Elmt);
+ end loop;
+ end if;
+
+ Write_Char ('"');
+ Write_Eol;
+ end if;
+
+ Write_Str (" virtuals: ");
+ Write_Char ('"');
+
+ Elmt := First_Elmt (Primitive_Operations (Typ));
+ while Present (Elmt) loop
+ Prim := Node (Elmt);
+
+ -- Display only primitives overriden or defined
+
+ if Present (Alias (Prim)) then
+ goto Continue;
+ end if;
+
+ -- Do not generate separator for output of first primitive
+
+ if Separator_Needed then
+ Write_Str ("\n");
+ Write_Eol;
+ Write_Str (" ");
+ else
+ Separator_Needed := True;
+ end if;
+
+ Write_Int (UI_To_Int (Slot_Number (Prim)));
+ Write_Char (':');
+ Write_Name (Chars (Prim));
+
+ -- Display overriding of parent primitives
+
+ if Present (Overridden_Operation (Prim))
+ and then
+ Is_Ancestor
+ (Find_Dispatching_Type (Overridden_Operation (Prim)), Typ)
+ then
+ Write_Char (',');
+ Write_Int
+ (UI_To_Int (Slot_Number (Overridden_Operation (Prim))));
+ Write_Char (':');
+ Write_Name
+ (Chars (Find_Dispatching_Type (Overridden_Operation (Prim))));
+ end if;
+
+ -- Display overriding of interface primitives
+
+ if Has_Interfaces (Typ) then
+ declare
+ Prim_Elmt : Elmt_Id;
+ Prim_Op : Node_Id;
+ Int_Alias : Entity_Id;
+
+ begin
+ Prim_Elmt := First_Elmt (Primitive_Operations (Typ));
+ while Present (Prim_Elmt) loop
+ Prim_Op := Node (Prim_Elmt);
+ Int_Alias := Interface_Alias (Prim_Op);
+
+ if Present (Int_Alias)
+ and then not Is_Ancestor
+ (Find_Dispatching_Type (Int_Alias), Typ)
+ and then (Alias (Prim_Op)) = Prim
+ then
+ Write_Char (',');
+ Write_Int (UI_To_Int (Slot_Number (Int_Alias)));
+ Write_Char (':');
+ Write_Name (Chars (Find_Dispatching_Type (Int_Alias)));
+ end if;
+
+ Next_Elmt (Prim_Elmt);
+ end loop;
+ end;
+ end if;
+
+ <<Continue>>
+ Next_Elmt (Elmt);
+ end loop;
+
+ Write_Char ('"');
+ Write_Eol;
+
+ Write_Char ('}');
+ Write_Eol;
+ end Write_Type_Info;
+
+end Exp_CG;
diff --git a/gcc/ada/g-sttsne-dummy.ads b/gcc/ada/exp_cg.ads
index 9cb25898dfa..5c2458d8408 100644
--- a/gcc/ada/g-sttsne-dummy.ads
+++ b/gcc/ada/exp_cg.ads
@@ -2,38 +2,46 @@
-- --
-- GNAT COMPILER COMPONENTS --
-- --
--- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B --
+-- E X P _ C G --
-- --
-- S p e c --
-- --
--- Copyright (C) 2007-2008, AdaCore --
+-- Copyright (C) 2010, 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- Public License distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
--- This package is a placeholder for the sockets binding for platforms where
--- it is not implemented.
+-- This package contains routines used to store and handle nodes required
+-- to generate call graph information of dispatching calls.
+
+with Types; use Types;
+
+package Exp_CG is
+
+ procedure Generate_CG_Output;
+ -- Generate in the standard output the information associated with tagged
+ -- types declaration and dispatching calls
+
+ procedure Initialize;
+ -- Called at the start of compilation to initialize the table that stores
+ -- the tree nodes used by Generate_Output. This table is required because
+ -- the format of the output requires fully qualified names (and hence the
+ -- output must be generated after the source program has been compiled).
+
+ procedure Register_CG_Node (N : Node_Id);
+ -- Register a dispatching call node or the defining entity of a tagged
+ -- type declaration
-package GNAT.Sockets.Thin.Task_Safe_NetDB is
- pragma Unimplemented_Unit;
-end GNAT.Sockets.Thin.Task_Safe_NetDB;
+end Exp_CG;
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index 21f878b579a..111bc182fe7 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -469,9 +469,7 @@ package body Exp_Ch11 is
Local_Expansion_Required := True;
declare
- L : constant Entity_Id :=
- Make_Defining_Identifier (Sloc (H),
- Chars => New_Internal_Name ('L'));
+ L : constant Entity_Id := Make_Temporary (Sloc (H), 'L');
begin
Set_Exception_Label (H, L);
Add_Label_Declaration (L);
@@ -646,9 +644,7 @@ package body Exp_Ch11 is
declare
-- L3 is the label to exit the HSS
- L3_Dent : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
+ L3_Dent : constant Entity_Id := Make_Temporary (Loc, 'L');
Labl_L3 : constant Node_Id :=
Make_Label (Loc,
@@ -670,7 +666,8 @@ package body Exp_Ch11 is
Rewrite (HSS,
Make_Handled_Sequence_Of_Statements (Loc,
- Statements => New_List (Blk_Stm)));
+ Statements => New_List (Blk_Stm),
+ End_Label => Relocate_Node (End_Label (HSS))));
-- Set block statement as analyzed, we don't want to actually call
-- Analyze on this block, it would cause a recursion in exception
@@ -745,13 +742,12 @@ package body Exp_Ch11 is
Relmt := First_Elmt (Local_Raise_Statements (Handler));
while Present (Relmt) loop
declare
- Raise_S : constant Node_Id := Node (Relmt);
-
+ Raise_S : constant Node_Id := Node (Relmt);
+ RLoc : constant Source_Ptr := Sloc (Raise_S);
Name_L1 : constant Node_Id :=
New_Occurrence_Of (L1_Dent, Loc);
-
Goto_L1 : constant Node_Id :=
- Make_Goto_Statement (Loc,
+ Make_Goto_Statement (RLoc,
Name => Name_L1);
begin
@@ -1516,15 +1512,6 @@ package body Exp_Ch11 is
-- Remaining processing is for the case where no string expression
-- is present.
- -- There is no expansion needed for statement "raise <exception>;" when
- -- compiling for the JVM since the JVM has a built-in exception
- -- mechanism. However we need to keep the expansion for "raise;"
- -- statements. See 4jexcept.ads for details.
-
- if Present (Name (N)) and then VM_Target /= No_VM then
- return;
- end if;
-
-- Don't expand a raise statement that does not come from source
-- if we have already had configurable run-time violations, since
-- most likely it will be junk cascaded nonsense.
@@ -1686,7 +1673,7 @@ package body Exp_Ch11 is
-- be referencing this entity by normal visibility methods.
if No (Choice_Parameter (Ehand)) then
- E := Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ E := Make_Temporary (Loc, 'E');
Set_Choice_Parameter (Ehand, E);
Set_Ekind (E, E_Variable);
Set_Etype (E, RTE (RE_Exception_Occurrence));
diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb
index 3b682cf04ae..d0004f473a0 100644
--- a/gcc/ada/exp_ch13.adb
+++ b/gcc/ada/exp_ch13.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -46,6 +46,7 @@ with Snames; use Snames;
with Stand; use Stand;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
+with Validsw; use Validsw;
package body Exp_Ch13 is
@@ -346,6 +347,23 @@ package body Exp_Ch13 is
Analyze (Decl, Suppress => All_Checks);
Pop_Scope;
+ -- We treat generated equality specially, if validity checks are
+ -- enabled, in order to detect components default-initialized
+ -- with invalid values.
+
+ elsif Nkind (Decl) = N_Subprogram_Body
+ and then Chars (Defining_Entity (Decl)) = Name_Op_Eq
+ and then Validity_Checks_On
+ and then Initialize_Scalars
+ then
+ declare
+ Save_Force : constant Boolean := Force_Validity_Checks;
+ begin
+ Force_Validity_Checks := True;
+ Analyze (Decl);
+ Force_Validity_Checks := Save_Force;
+ end;
+
else
Analyze (Decl, Suppress => All_Checks);
end if;
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 9420558b9fd..e2263f3ab8f 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -504,7 +504,7 @@ package body Exp_Ch3 is
-- And insert this declaration into the tree. The type of the
-- discriminant is then reset to this more restricted subtype.
- Tnn := Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ Tnn := Make_Temporary (Loc, 'T');
Insert_Action (Declaration_Node (Rtype),
Make_Subtype_Declaration (Loc,
@@ -593,7 +593,7 @@ package body Exp_Ch3 is
------------------------
function Init_One_Dimension (N : Int) return List_Id is
- Index : Entity_Id;
+ Index : Entity_Id;
begin
-- If the component does not need initializing, then there is nothing
@@ -1465,8 +1465,8 @@ package body Exp_Ch3 is
if Has_Task (Full_Type) then
if Restriction_Active (No_Task_Hierarchy) then
- -- See comments in System.Tasking.Initialization.Init_RTS
- -- for the value 3 (should be rtsfindable constant ???)
+ -- 3 is System.Tasking.Library_Task_Level
+ -- (should be rtsfindable constant ???)
Append_To (Args, Make_Integer_Literal (Loc, 3));
@@ -2020,8 +2020,7 @@ package body Exp_Ch3 is
if Has_Task (Rec_Type) then
if Restriction_Active (No_Task_Hierarchy) then
- -- See comments in System.Tasking.Initialization.Init_RTS
- -- for the value 3.
+ -- 3 is System.Tasking.Library_Task_Level
Append_To (Args, Make_Integer_Literal (Loc, 3));
else
@@ -2115,10 +2114,7 @@ package body Exp_Ch3 is
Spec_Node : Node_Id;
begin
- Func_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('F'));
-
+ Func_Id := Make_Temporary (Loc, 'F');
Set_DT_Offset_To_Top_Func (Iface_Comp, Func_Id);
-- Generate
@@ -2246,9 +2242,7 @@ package body Exp_Ch3 is
if Is_Tagged_Type (Rec_Type)
and then not Is_CPP_Class (Rec_Type)
then
- Set_Tag :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Set_Tag := Make_Temporary (Loc, 'P');
Append_To (Parameters,
Make_Parameter_Specification (Loc,
@@ -2336,22 +2330,6 @@ package body Exp_Ch3 is
New_Reference_To
(Node (First_Elmt (Access_Disp_Table (Rec_Type))), Loc)));
- -- Generate the SCIL node associated with the initialization of
- -- the tag component.
-
- if Generate_SCIL then
- declare
- New_Node : Node_Id;
-
- begin
- New_Node :=
- Make_SCIL_Tag_Init (Sloc (First (Init_Tags_List)));
- Set_SCIL_Related_Node (New_Node, First (Init_Tags_List));
- Set_SCIL_Entity (New_Node, Rec_Type);
- Prepend_To (Init_Tags_List, New_Node);
- end;
- end if;
-
-- Ada 2005 (AI-251): Initialize the secondary tags components
-- located at fixed positions (tags whose position depends on
-- variable size components are initialized later ---see below).
@@ -3404,37 +3382,21 @@ package body Exp_Ch3 is
Loc : constant Source_Ptr := Sloc (Typ);
Index : constant Entity_Id := Base_Type (Etype (First_Index (Typ)));
- -- Build formal parameters of procedure
-
- Larray : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, Chars => New_Internal_Name ('A'));
- Rarray : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, Chars => New_Internal_Name ('R'));
- Left_Lo : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, Chars => New_Internal_Name ('L'));
- Left_Hi : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, Chars => New_Internal_Name ('L'));
- Right_Lo : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, Chars => New_Internal_Name ('R'));
- Right_Hi : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, Chars => New_Internal_Name ('R'));
- Rev : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, Chars => New_Internal_Name ('D'));
+ Larray : constant Entity_Id := Make_Temporary (Loc, 'A');
+ Rarray : constant Entity_Id := Make_Temporary (Loc, 'R');
+ Left_Lo : constant Entity_Id := Make_Temporary (Loc, 'L');
+ Left_Hi : constant Entity_Id := Make_Temporary (Loc, 'L');
+ Right_Lo : constant Entity_Id := Make_Temporary (Loc, 'R');
+ Right_Hi : constant Entity_Id := Make_Temporary (Loc, 'R');
+ Rev : constant Entity_Id := Make_Temporary (Loc, 'D');
+ -- Formal parameters of procedure
+
Proc_Name : constant Entity_Id :=
Make_Defining_Identifier (Loc,
Chars => Make_TSS_Name (Typ, TSS_Slice_Assign));
- Lnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('L'));
- Rnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Lnn : constant Entity_Id := Make_Temporary (Loc, 'L');
+ Rnn : constant Entity_Id := Make_Temporary (Loc, 'R');
-- Subscripts for left and right sides
Decls : List_Id;
@@ -4466,7 +4428,10 @@ package body Exp_Ch3 is
-- it will be assigned subsequently. In particular, there is no point
-- in applying Initialize_Scalars to such a temporary.
- elsif Needs_Simple_Initialization (Typ)
+ elsif Needs_Simple_Initialization
+ (Typ,
+ Initialize_Scalars
+ and then not Has_Following_Address_Clause (N))
and then not Is_Internal (Def_Id)
and then not Has_Init_Expression (N)
then
@@ -4617,8 +4582,7 @@ package body Exp_Ch3 is
Decl_1 :=
Make_Object_Declaration (Loc,
Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('D')),
+ Make_Temporary (Loc, 'D', Expr_N),
Object_Definition =>
New_Occurrence_Of (Expr_Typ, Loc),
Expression =>
@@ -4630,12 +4594,9 @@ package body Exp_Ch3 is
Decl_2 :=
Make_Object_Renaming_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('D')),
- Subtype_Mark =>
- New_Occurrence_Of (Typ, Loc),
- Name =>
+ Defining_Identifier => Make_Temporary (Loc, 'D'),
+ Subtype_Mark => New_Occurrence_Of (Typ, Loc),
+ Name =>
Unchecked_Convert_To (Typ,
Make_Selected_Component (Loc,
Prefix =>
@@ -4679,23 +4640,19 @@ package body Exp_Ch3 is
Decl_1 :=
Make_Object_Declaration (Loc,
Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('D')),
- Object_Definition =>
+ Make_Temporary (Loc, 'D', New_Expr),
+ Object_Definition =>
New_Occurrence_Of
(Etype (Object_Definition (N)), Loc),
- Expression =>
+ Expression =>
Unchecked_Convert_To
(Etype (Object_Definition (N)), New_Expr));
Decl_2 :=
Make_Object_Renaming_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('D')),
- Subtype_Mark =>
- New_Occurrence_Of (Typ, Loc),
- Name =>
+ Defining_Identifier => Make_Temporary (Loc, 'D'),
+ Subtype_Mark => New_Occurrence_Of (Typ, Loc),
+ Name =>
Unchecked_Convert_To (Typ,
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Tag_Ptr),
@@ -5969,8 +5926,8 @@ package body Exp_Ch3 is
and then Has_Discriminants (Def_Id)
then
declare
- Ctyp : constant Entity_Id :=
- Corresponding_Concurrent_Type (Def_Id);
+ Ctyp : constant Entity_Id :=
+ Corresponding_Concurrent_Type (Def_Id);
Conc_Discr : Entity_Id;
Rec_Discr : Entity_Id;
Temp : Entity_Id;
@@ -5978,7 +5935,6 @@ package body Exp_Ch3 is
begin
Conc_Discr := First_Discriminant (Ctyp);
Rec_Discr := First_Discriminant (Def_Id);
-
while Present (Conc_Discr) loop
Temp := Discriminal (Conc_Discr);
Set_Discriminal (Conc_Discr, Discriminal (Rec_Discr));
@@ -6247,9 +6203,7 @@ package body Exp_Ch3 is
-- See GNAT Pool packages in the Run-Time for more details
- elsif Ekind (Def_Id) = E_Access_Type
- or else Ekind (Def_Id) = E_General_Access_Type
- then
+ elsif Ekind_In (Def_Id, E_Access_Type, E_General_Access_Type) then
declare
Loc : constant Source_Ptr := Sloc (N);
Desig_Type : constant Entity_Id := Designated_Type (Def_Id);
@@ -7865,12 +7819,11 @@ package body Exp_Ch3 is
-- If a primitive is encountered that renames the predefined
-- equality operator before reaching any explicit equality
- -- primitive, then we still need to create a predefined
- -- equality function, because calls to it can occur via
- -- the renaming. A new name is created for the equality
- -- to avoid conflicting with any user-defined equality.
- -- (Note that this doesn't account for renamings of
- -- equality nested within subpackages???)
+ -- primitive, then we still need to create a predefined equality
+ -- function, because calls to it can occur via the renaming. A new
+ -- name is created for the equality to avoid conflicting with any
+ -- user-defined equality. (Note that this doesn't account for
+ -- renamings of equality nested within subpackages???)
if Is_Predefined_Eq_Renaming (Node (Prim)) then
Eq_Name := New_External_Name (Chars (Node (Prim)), 'E');
@@ -8145,7 +8098,14 @@ package body Exp_Ch3 is
-- Needs_Simple_Initialization --
---------------------------------
- function Needs_Simple_Initialization (T : Entity_Id) return Boolean is
+ function Needs_Simple_Initialization
+ (T : Entity_Id;
+ Consider_IS : Boolean := True) return Boolean
+ is
+ Consider_IS_NS : constant Boolean :=
+ Normalize_Scalars
+ or (Initialize_Scalars and Consider_IS);
+
begin
-- Check for private type, in which case test applies to the underlying
-- type of the private type.
@@ -8167,7 +8127,7 @@ package body Exp_Ch3 is
-- types.
elsif Is_Access_Type (T)
- or else (Init_Or_Norm_Scalars and then (Is_Scalar_Type (T)))
+ or else (Consider_IS_NS and then (Is_Scalar_Type (T)))
then
return True;
@@ -8176,7 +8136,7 @@ package body Exp_Ch3 is
-- expanding an aggregate (since in the latter case they will be
-- filled with appropriate initializing values before they are used).
- elsif Init_Or_Norm_Scalars
+ elsif Consider_IS_NS
and then
(Root_Type (T) = Standard_String
or else Root_Type (T) = Standard_Wide_String
diff --git a/gcc/ada/exp_ch3.ads b/gcc/ada/exp_ch3.ads
index 6738ae958f9..9b838b0b652 100644
--- a/gcc/ada/exp_ch3.ads
+++ b/gcc/ada/exp_ch3.ads
@@ -126,14 +126,18 @@ package Exp_Ch3 is
-- then tags components located at variable positions of Target are
-- initialized.
- function Needs_Simple_Initialization (T : Entity_Id) return Boolean;
+ function Needs_Simple_Initialization
+ (T : Entity_Id;
+ Consider_IS : Boolean := True) return Boolean;
-- Certain types need initialization even though there is no specific
-- initialization routine. In this category are access types (which need
-- initializing to null), packed array types whose implementation is a
-- modular type, and all scalar types if Normalize_Scalars is set, as well
-- as private types whose underlying type is present and meets any of these
-- criteria. Finally, descendants of String and Wide_String also need
- -- initialization in Initialize/Normalize_Scalars mode.
+ -- initialization in Initialize/Normalize_Scalars mode. Consider_IS is
+ -- normally True. If it is False, the Initialize_Scalars is not considered
+ -- in determining whether simple initialization is needed.
function Get_Simple_Init_Val
(T : Entity_Id;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 096abbde9c9..7588ae3cc03 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -47,6 +47,7 @@ with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
+with Par_SCO; use Par_SCO;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
@@ -58,13 +59,13 @@ with Sem_Ch8; use Sem_Ch8;
with Sem_Ch13; use Sem_Ch13;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
-with Sem_SCIL; use Sem_SCIL;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
+with SCIL_LL; use SCIL_LL;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
@@ -127,6 +128,9 @@ package body Exp_Ch4 is
-- Common expansion processing for Boolean operators (And, Or, Xor) for the
-- case of array type arguments.
+ procedure Expand_Short_Circuit_Operator (N : Node_Id);
+ -- Common expansion processing for short-circuit boolean operators
+
function Expand_Composite_Equality
(Nod : Node_Id;
Typ : Entity_Id;
@@ -319,10 +323,8 @@ package body Exp_Ch4 is
if Nkind (Op1) = N_Op_Not then
if Kind = N_Op_And then
Proc_Name := RTE (RE_Vector_Nor);
-
elsif Kind = N_Op_Or then
Proc_Name := RTE (RE_Vector_Nand);
-
else
Proc_Name := RTE (RE_Vector_Xor);
end if;
@@ -330,14 +332,11 @@ package body Exp_Ch4 is
else
if Kind = N_Op_And then
Proc_Name := RTE (RE_Vector_And);
-
elsif Kind = N_Op_Or then
Proc_Name := RTE (RE_Vector_Or);
-
elsif Nkind (Op2) = N_Op_Not then
Proc_Name := RTE (RE_Vector_Nxor);
Arg2 := Right_Opnd (Op2);
-
else
Proc_Name := RTE (RE_Vector_Xor);
end if;
@@ -348,15 +347,15 @@ package body Exp_Ch4 is
Name => New_Occurrence_Of (Proc_Name, Loc),
Parameter_Associations => New_List (
Target,
- Make_Attribute_Reference (Loc,
- Prefix => Arg1,
- Attribute_Name => Name_Address),
- Make_Attribute_Reference (Loc,
- Prefix => Arg2,
- Attribute_Name => Name_Address),
- Make_Attribute_Reference (Loc,
- Prefix => Op1,
- Attribute_Name => Name_Length)));
+ Make_Attribute_Reference (Loc,
+ Prefix => Arg1,
+ Attribute_Name => Name_Address),
+ Make_Attribute_Reference (Loc,
+ Prefix => Arg2,
+ Attribute_Name => Name_Address),
+ Make_Attribute_Reference (Loc,
+ Prefix => Op1,
+ Attribute_Name => Name_Length)));
end if;
Rewrite (N, Call_Node);
@@ -591,7 +590,7 @@ package body Exp_Ch4 is
Set_Analyzed (Node);
- Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Temp := Make_Temporary (Loc, 'P', N);
Insert_Action (N,
Make_Object_Declaration (Loc,
@@ -660,8 +659,7 @@ package body Exp_Ch4 is
Remove_Side_Effects (Exp);
end if;
- Temp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Temp := Make_Temporary (Loc, 'P', N);
-- For a class wide allocation generate the following code:
@@ -751,9 +749,7 @@ package body Exp_Ch4 is
else
declare
- Def_Id : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('T'));
+ Def_Id : constant Entity_Id := Make_Temporary (Loc, 'T');
New_Decl : Node_Id;
begin
@@ -830,8 +826,7 @@ package body Exp_Ch4 is
New_Decl :=
Make_Object_Declaration (Loc,
- Defining_Identifier => Make_Defining_Identifier (Loc,
- New_Internal_Name ('P')),
+ Defining_Identifier => Make_Temporary (Loc, 'P'),
Object_Definition => New_Reference_To (PtrT, Loc),
Expression => Unchecked_Convert_To (PtrT,
New_Reference_To (Temp, Loc)));
@@ -912,16 +907,13 @@ package body Exp_Ch4 is
if Is_RTE (Apool, RE_SS_Pool) then
declare
- F : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('F'));
+ F : constant Entity_Id := Make_Temporary (Loc, 'F');
begin
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier => F,
- Object_Definition => New_Reference_To (RTE
- (RE_Finalizable_Ptr), Loc)));
-
+ Object_Definition =>
+ New_Reference_To (RTE (RE_Finalizable_Ptr), Loc)));
Flist := New_Reference_To (F, Loc);
Attach := Make_Integer_Literal (Loc, 1);
end;
@@ -987,8 +979,7 @@ package body Exp_Ch4 is
end if;
elsif Aggr_In_Place then
- Temp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Temp := Make_Temporary (Loc, 'P', N);
Tmp_Node :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
@@ -1072,9 +1063,7 @@ package body Exp_Ch4 is
and then Is_Packed (T)
then
declare
- ConstrT : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ ConstrT : constant Entity_Id := Make_Temporary (Loc, 'A');
Internal_Exp : constant Node_Id := Relocate_Node (Exp);
begin
Insert_Action (Exp,
@@ -1594,8 +1583,7 @@ package body Exp_Ch4 is
-- constrained types, then we can use the same index for both
-- of the arrays.
- An : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ An : constant Entity_Id := Make_Temporary (Loc, 'A');
Bn : Entity_Id;
Index_T : Entity_Id;
@@ -1612,9 +1600,7 @@ package body Exp_Ch4 is
Index_T := Base_Type (Etype (Index));
if Need_Separate_Indexes then
- Bn :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('B'));
+ Bn := Make_Temporary (Loc, 'B');
else
Bn := An;
end if;
@@ -1801,7 +1787,7 @@ package body Exp_Ch4 is
Defining_Identifier => B,
Parameter_Type => New_Reference_To (Rtyp, Loc)));
- Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ Func_Name := Make_Temporary (Loc, 'E');
-- Build statement sequence for function
@@ -2621,9 +2607,7 @@ package body Exp_Ch4 is
Operands (NN) := Opnd;
Is_Fixed_Length (NN) := False;
- Var_Length (NN) :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
+ Var_Length (NN) := Make_Temporary (Loc, 'L');
Append_To (Actions,
Make_Object_Declaration (Loc,
@@ -2670,9 +2654,7 @@ package body Exp_Ch4 is
-- create an entity initialized to this length.
else
- Ent :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
+ Ent := Make_Temporary (Loc, 'L');
if Is_Fixed_Length (NN) then
Clen := Make_Integer_Literal (Loc, Fixed_Length (NN));
@@ -2790,8 +2772,7 @@ package body Exp_Ch4 is
end Get_Known_Bound;
begin
- Ent :=
- Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('L'));
+ Ent := Make_Temporary (Loc, 'L');
Append_To (Actions,
Make_Object_Declaration (Loc,
@@ -2845,11 +2826,12 @@ package body Exp_Ch4 is
Insert_Actions (Cnode, Actions, Suppress => All_Checks);
- -- Now we construct an array object with appropriate bounds
+ -- Now we construct an array object with appropriate bounds. We mark
+ -- the target as internal to prevent useless initialization when
+ -- Initialize_Scalars is enabled.
- Ent :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Ent := Make_Temporary (Loc, 'S');
+ Set_Is_Internal (Ent);
-- If the bound is statically known to be out of range, we do not want
-- to abort, we want a warning and a runtime constraint error. Note that
@@ -3173,9 +3155,10 @@ package body Exp_Ch4 is
declare
Decl : Node_Id;
Outer_S : Entity_Id;
- S : Entity_Id := Current_Scope;
+ S : Entity_Id;
begin
+ S := Current_Scope;
while Present (S) and then S /= Standard_Standard loop
if Ekind (S) = E_Function then
Outer_S := Scope (S);
@@ -3273,9 +3256,7 @@ package body Exp_Ch4 is
-------------------------
procedure Rewrite_Coextension (N : Node_Id) is
- Temp : constant Node_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('C'));
+ Temp : constant Node_Id := Make_Temporary (Loc, 'C');
-- Generate:
-- Cnn : aliased Etyp;
@@ -3428,9 +3409,7 @@ package body Exp_Ch4 is
-- and replace the allocator by Tnn'Unrestricted_Access. Tnn is
-- marked as requiring static allocation.
- Temp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
-
+ Temp := Make_Temporary (Loc, 'T', Expression (Expression (N)));
Desig := Subtype_Mark (Expression (N));
-- If context is constrained, use constrained subtype directly,
@@ -3593,7 +3572,7 @@ package body Exp_Ch4 is
if not Restriction_Active (No_Default_Initialization) then
Init := Base_Init_Proc (T);
Nod := N;
- Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Temp := Make_Temporary (Loc, 'P');
-- Construct argument list for the initialization routine call
@@ -3665,9 +3644,11 @@ package body Exp_Ch4 is
-- The designated type was an incomplete type, and the
-- access type did not get expanded. Salvage it now.
- pragma Assert (Present (Parent (Base_Type (PtrT))));
- Expand_N_Full_Type_Declaration
- (Parent (Base_Type (PtrT)));
+ if not Restriction_Active (No_Task_Hierarchy) then
+ pragma Assert (Present (Parent (Base_Type (PtrT))));
+ Expand_N_Full_Type_Declaration
+ (Parent (Base_Type (PtrT)));
+ end if;
end if;
-- If the context of the allocator is a declaration or an
@@ -3710,16 +3691,22 @@ package body Exp_Ch4 is
Decls := Build_Task_Image_Decls (Loc, T, T);
end if;
- Append_To (Args,
- New_Reference_To
- (Master_Id (Base_Type (Root_Type (PtrT))), Loc));
+ if Restriction_Active (No_Task_Hierarchy) then
+ -- 3 is System.Tasking.Library_Task_Level
+ Append_To (Args, Make_Integer_Literal (Loc, 3));
+ else
+ Append_To (Args,
+ New_Reference_To
+ (Master_Id (Base_Type (Root_Type (PtrT))), Loc));
+ end if;
+
Append_To (Args, Make_Identifier (Loc, Name_uChain));
Decl := Last (Decls);
Append_To (Args,
New_Occurrence_Of (Defining_Identifier (Decl), Loc));
- -- Has_Task is false, Decls not used
+ -- Has_Task is false, Decls not used
else
Decls := No_List;
@@ -3900,119 +3887,145 @@ package body Exp_Ch4 is
-- Expand_N_And_Then --
-----------------------
- -- Expand into conditional expression if Actions present, and also deal
- -- with optimizing case of arguments being True or False.
+ procedure Expand_N_And_Then (N : Node_Id)
+ renames Expand_Short_Circuit_Operator;
+
+ ------------------------------
+ -- Expand_N_Case_Expression --
+ ------------------------------
- procedure Expand_N_And_Then (N : Node_Id) is
+ procedure Expand_N_Case_Expression (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
- Left : constant Node_Id := Left_Opnd (N);
- Right : constant Node_Id := Right_Opnd (N);
- Actlist : List_Id;
+ Cstmt : Node_Id;
+ Tnn : Entity_Id;
+ Pnn : Entity_Id;
+ Actions : List_Id;
+ Ttyp : Entity_Id;
+ Alt : Node_Id;
+ Fexp : Node_Id;
begin
- -- Deal with non-standard booleans
+ -- We expand
+
+ -- case X is when A => AX, when B => BX ...
+
+ -- to
+
+ -- do
+ -- Tnn : typ;
+ -- case X is
+ -- when A =>
+ -- Tnn := AX;
+ -- when B =>
+ -- Tnn := BX;
+ -- ...
+ -- end case;
+ -- in Tnn end;
+
+ -- However, this expansion is wrong for limited types, and also
+ -- wrong for unconstrained types (since the bounds may not be the
+ -- same in all branches). Furthermore it involves an extra copy
+ -- for large objects. So we take care of this by using the following
+ -- modified expansion for non-scalar types:
+
+ -- do
+ -- type Pnn is access all typ;
+ -- Tnn : Pnn;
+ -- case X is
+ -- when A =>
+ -- T := AX'Unrestricted_Access;
+ -- when B =>
+ -- T := BX'Unrestricted_Access;
+ -- ...
+ -- end case;
+ -- in Tnn.all end;
+
+ Cstmt :=
+ Make_Case_Statement (Loc,
+ Expression => Expression (N),
+ Alternatives => New_List);
+
+ Actions := New_List;
+
+ -- Scalar case
+
+ if Is_Scalar_Type (Typ) then
+ Ttyp := Typ;
- if Is_Boolean_Type (Typ) then
- Adjust_Condition (Left);
- Adjust_Condition (Right);
- Set_Etype (N, Standard_Boolean);
+ else
+ Pnn := Make_Temporary (Loc, 'P');
+ Append_To (Actions,
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Pnn,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ All_Present => True,
+ Subtype_Indication =>
+ New_Reference_To (Typ, Loc))));
+ Ttyp := Pnn;
end if;
- -- Check for cases where left argument is known to be True or False
+ Tnn := Make_Temporary (Loc, 'T');
+ Append_To (Actions,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Tnn,
+ Object_Definition => New_Occurrence_Of (Ttyp, Loc)));
- if Compile_Time_Known_Value (Left) then
+ -- Now process the alternatives
- -- If left argument is True, change (True and then Right) to Right.
- -- Any actions associated with Right will be executed unconditionally
- -- and can thus be inserted into the tree unconditionally.
+ Alt := First (Alternatives (N));
+ while Present (Alt) loop
+ declare
+ Aexp : Node_Id := Expression (Alt);
+ Aloc : constant Source_Ptr := Sloc (Aexp);
- if Expr_Value_E (Left) = Standard_True then
- if Present (Actions (N)) then
- Insert_Actions (N, Actions (N));
+ begin
+ if not Is_Scalar_Type (Typ) then
+ Aexp :=
+ Make_Attribute_Reference (Aloc,
+ Prefix => Relocate_Node (Aexp),
+ Attribute_Name => Name_Unrestricted_Access);
end if;
- Rewrite (N, Right);
-
- -- If left argument is False, change (False and then Right) to False.
- -- In this case we can forget the actions associated with Right,
- -- since they will never be executed.
-
- else pragma Assert (Expr_Value_E (Left) = Standard_False);
- Kill_Dead_Code (Right);
- Kill_Dead_Code (Actions (N));
- Rewrite (N, New_Occurrence_Of (Standard_False, Loc));
- end if;
-
- Adjust_Result_Type (N, Typ);
- return;
- end if;
-
- -- If Actions are present, we expand
-
- -- left and then right
-
- -- into
+ Append_To
+ (Alternatives (Cstmt),
+ Make_Case_Statement_Alternative (Sloc (Alt),
+ Discrete_Choices => Discrete_Choices (Alt),
+ Statements => New_List (
+ Make_Assignment_Statement (Aloc,
+ Name => New_Occurrence_Of (Tnn, Loc),
+ Expression => Aexp))));
+ end;
- -- if left then right else false end
+ Next (Alt);
+ end loop;
- -- with the actions becoming the Then_Actions of the conditional
- -- expression. This conditional expression is then further expanded
- -- (and will eventually disappear)
+ Append_To (Actions, Cstmt);
- if Present (Actions (N)) then
- Actlist := Actions (N);
- Rewrite (N,
- Make_Conditional_Expression (Loc,
- Expressions => New_List (
- Left,
- Right,
- New_Occurrence_Of (Standard_False, Loc))));
-
- -- If the right part of the expression is a function call then it can
- -- be part of the expansion of the predefined equality operator of a
- -- tagged type and we may need to adjust its SCIL dispatching node.
-
- if Generate_SCIL
- and then Nkind (Right) = N_Function_Call
- then
- Adjust_SCIL_Node (N, Right);
- end if;
+ -- Construct and return final expression with actions
- Set_Then_Actions (N, Actlist);
- Analyze_And_Resolve (N, Standard_Boolean);
- Adjust_Result_Type (N, Typ);
- return;
+ if Is_Scalar_Type (Typ) then
+ Fexp := New_Occurrence_Of (Tnn, Loc);
+ else
+ Fexp :=
+ Make_Explicit_Dereference (Loc,
+ Prefix => New_Occurrence_Of (Tnn, Loc));
end if;
- -- No actions present, check for cases of right argument True/False
-
- if Compile_Time_Known_Value (Right) then
-
- -- Change (Left and then True) to Left. Note that we know there are
- -- no actions associated with the True operand, since we just checked
- -- for this case above.
-
- if Expr_Value_E (Right) = Standard_True then
- Rewrite (N, Left);
-
- -- Change (Left and then False) to False, making sure to preserve any
- -- side effects associated with the Left operand.
-
- else pragma Assert (Expr_Value_E (Right) = Standard_False);
- Remove_Side_Effects (Left);
- Rewrite (N, New_Occurrence_Of (Standard_False, Loc));
- end if;
- end if;
+ Rewrite (N,
+ Make_Expression_With_Actions (Loc,
+ Expression => Fexp,
+ Actions => Actions));
- Adjust_Result_Type (N, Typ);
- end Expand_N_And_Then;
+ Analyze_And_Resolve (N, Typ);
+ end Expand_N_Case_Expression;
-------------------------------------
-- Expand_N_Conditional_Expression --
-------------------------------------
- -- Expand into expression actions if then/else actions present
+ -- Deal with limited types and expression actions
procedure Expand_N_Conditional_Expression (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
@@ -4021,33 +4034,68 @@ package body Exp_Ch4 is
Elsex : constant Node_Id := Next (Thenx);
Typ : constant Entity_Id := Etype (N);
- Cnn : Entity_Id;
- Decl : Node_Id;
- New_If : Node_Id;
- New_N : Node_Id;
- P_Decl : Node_Id;
+ Cnn : Entity_Id;
+ Decl : Node_Id;
+ New_If : Node_Id;
+ New_N : Node_Id;
+ P_Decl : Node_Id;
+ Expr : Node_Id;
+ Actions : List_Id;
begin
- -- If either then or else actions are present, then given:
+ -- Fold at compile time if condition known. We have already folded
+ -- static conditional expressions, but it is possible to fold any
+ -- case in which the condition is known at compile time, even though
+ -- the result is non-static.
+
+ -- Note that we don't do the fold of such cases in Sem_Elab because
+ -- it can cause infinite loops with the expander adding a conditional
+ -- expression, and Sem_Elab circuitry removing it repeatedly.
+
+ if Compile_Time_Known_Value (Cond) then
+ if Is_True (Expr_Value (Cond)) then
+ Expr := Thenx;
+ Actions := Then_Actions (N);
+ else
+ Expr := Elsex;
+ Actions := Else_Actions (N);
+ end if;
- -- if cond then then-expr else else-expr end
+ Remove (Expr);
- -- we insert the following sequence of actions (using Insert_Actions):
+ if Present (Actions) then
- -- Cnn : typ;
- -- if cond then
- -- <<then actions>>
- -- Cnn := then-expr;
- -- else
- -- <<else actions>>
- -- Cnn := else-expr
- -- end if;
+ -- If we are not allowed to use Expression_With_Actions, just
+ -- skip the optimization, it is not critical for correctness.
+
+ if not Use_Expression_With_Actions then
+ goto Skip_Optimization;
+ end if;
+
+ Rewrite (N,
+ Make_Expression_With_Actions (Loc,
+ Expression => Relocate_Node (Expr),
+ Actions => Actions));
+ Analyze_And_Resolve (N, Typ);
+
+ else
+ Rewrite (N, Relocate_Node (Expr));
+ end if;
+
+ -- Note that the result is never static (legitimate cases of static
+ -- conditional expressions were folded in Sem_Eval).
- -- and replace the conditional expression by a reference to Cnn
+ Set_Is_Static_Expression (N, False);
+ return;
+ end if;
+
+ <<Skip_Optimization>>
- -- If the type is limited or unconstrained, the above expansion is
- -- not legal, because it involves either an uninitialized object
- -- or an illegal assignment. Instead, we generate:
+ -- If the type is limited or unconstrained, we expand as follows to
+ -- avoid any possibility of improper copies.
+
+ -- Note: it may be possible to avoid this special processing if the
+ -- back end uses its own mechanisms for handling by-reference types ???
-- type Ptr is access all Typ;
-- Cnn : Ptr;
@@ -4061,13 +4109,17 @@ package body Exp_Ch4 is
-- and replace the conditional expresion by a reference to Cnn.all.
- if Is_By_Reference_Type (Typ) then
+ -- This special case can be skipped if the back end handles limited
+ -- types properly and ensures that no incorrect copies are made.
+
+ if Is_By_Reference_Type (Typ)
+ and then not Back_End_Handles_Limited_Types
+ then
Cnn := Make_Temporary (Loc, 'C', N);
P_Decl :=
Make_Full_Type_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('A')),
+ Defining_Identifier => Make_Temporary (Loc, 'A'),
Type_Definition =>
Make_Access_To_Object_Definition (Loc,
All_Present => True,
@@ -4110,40 +4162,84 @@ package body Exp_Ch4 is
-- associated with either branch.
elsif Present (Then_Actions (N)) or else Present (Else_Actions (N)) then
- Cnn := Make_Temporary (Loc, 'C', N);
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Cnn,
- Object_Definition => New_Occurrence_Of (Typ, Loc));
+ -- We have two approaches to handling this. If we are allowed to use
+ -- N_Expression_With_Actions, then we can just wrap the actions into
+ -- the appropriate expression.
+
+ if Use_Expression_With_Actions then
+ if Present (Then_Actions (N)) then
+ Rewrite (Thenx,
+ Make_Expression_With_Actions (Sloc (Thenx),
+ Actions => Then_Actions (N),
+ Expression => Relocate_Node (Thenx)));
+ Set_Then_Actions (N, No_List);
+ Analyze_And_Resolve (Thenx, Typ);
+ end if;
- New_If :=
- Make_Implicit_If_Statement (N,
- Condition => Relocate_Node (Cond),
+ if Present (Else_Actions (N)) then
+ Rewrite (Elsex,
+ Make_Expression_With_Actions (Sloc (Elsex),
+ Actions => Else_Actions (N),
+ Expression => Relocate_Node (Elsex)));
+ Set_Else_Actions (N, No_List);
+ Analyze_And_Resolve (Elsex, Typ);
+ end if;
- Then_Statements => New_List (
- Make_Assignment_Statement (Sloc (Thenx),
- Name => New_Occurrence_Of (Cnn, Sloc (Thenx)),
- Expression => Relocate_Node (Thenx))),
+ return;
- Else_Statements => New_List (
- Make_Assignment_Statement (Sloc (Elsex),
- Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
- Expression => Relocate_Node (Elsex))));
+ -- if we can't use N_Expression_With_Actions nodes, then we insert
+ -- the following sequence of actions (using Insert_Actions):
- Set_Assignment_OK (Name (First (Then_Statements (New_If))));
- Set_Assignment_OK (Name (First (Else_Statements (New_If))));
+ -- Cnn : typ;
+ -- if cond then
+ -- <<then actions>>
+ -- Cnn := then-expr;
+ -- else
+ -- <<else actions>>
+ -- Cnn := else-expr
+ -- end if;
- New_N := New_Occurrence_Of (Cnn, Loc);
+ -- and replace the conditional expression by a reference to Cnn
- else
- -- No expansion needed, gigi handles it like a C conditional
- -- expression.
+ else
+ Cnn := Make_Temporary (Loc, 'C', N);
+
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Cnn,
+ Object_Definition => New_Occurrence_Of (Typ, Loc));
+
+ New_If :=
+ Make_Implicit_If_Statement (N,
+ Condition => Relocate_Node (Cond),
+
+ Then_Statements => New_List (
+ Make_Assignment_Statement (Sloc (Thenx),
+ Name => New_Occurrence_Of (Cnn, Sloc (Thenx)),
+ Expression => Relocate_Node (Thenx))),
+
+ Else_Statements => New_List (
+ Make_Assignment_Statement (Sloc (Elsex),
+ Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
+ Expression => Relocate_Node (Elsex))));
+ Set_Assignment_OK (Name (First (Then_Statements (New_If))));
+ Set_Assignment_OK (Name (First (Else_Statements (New_If))));
+
+ New_N := New_Occurrence_Of (Cnn, Loc);
+ end if;
+
+ -- If no actions then no expansion needed, gigi will handle it using
+ -- the same approach as a C conditional expression.
+
+ else
return;
end if;
- -- Move the SLOC of the parent If statement to the newly created one and
+ -- Fall through here for either the limited expansion, or the case of
+ -- inserting actions for non-limited types. In both these cases, we must
+ -- move the SLOC of the parent If statement to the newly created one and
-- change it to the SLOC of the expression which, after expansion, will
-- correspond to what is being evaluated.
@@ -4274,14 +4370,14 @@ package body Exp_Ch4 is
Analyze_And_Resolve (N, Rtyp);
Error_Msg_N ("?explicit membership test may be optimized away", N);
- Error_Msg_N ("\?use ''Valid attribute instead", N);
+ Error_Msg_N -- CODEFIX
+ ("\?use ''Valid attribute instead", N);
return;
end Substitute_Valid_Check;
-- Start of processing for Expand_N_In
begin
-
if Present (Alternatives (N)) then
Remove_Side_Effects (Lop);
Expand_Set_Membership;
@@ -4290,9 +4386,12 @@ package body Exp_Ch4 is
-- Check case of explicit test for an expression in range of its
-- subtype. This is suspicious usage and we replace it with a 'Valid
- -- test and give a warning.
+ -- test and give a warning. For floating point types however, this is a
+ -- standard way to check for finite numbers, and using 'Valid vould
+ -- typically be a pessimization.
if Is_Scalar_Type (Etype (Lop))
+ and then not Is_Floating_Point_Type (Etype (Lop))
and then Nkind (Rop) in N_Has_Entity
and then Etype (Lop) = Entity (Rop)
and then Comes_From_Source (N)
@@ -4329,9 +4428,9 @@ package body Exp_Ch4 is
and then Comes_From_Source (N)
and then not In_Instance;
-- This must be true for any of the optimization warnings, we
- -- clearly want to give them only for source with the flag on.
- -- We also skip these warnings in an instance since it may be
- -- the case that different instantiations have different ranges.
+ -- clearly want to give them only for source with the flag on. We
+ -- also skip these warnings in an instance since it may be the
+ -- case that different instantiations have different ranges.
Warn2 : constant Boolean :=
Warn1
@@ -4340,8 +4439,8 @@ package body Exp_Ch4 is
-- For the case where only one bound warning is elided, we also
-- insist on an explicit range and an integer type. The reason is
-- that the use of enumeration ranges including an end point is
- -- common, as is the use of a subtype name, one of whose bounds
- -- is the same as the type of the expression.
+ -- common, as is the use of a subtype name, one of whose bounds is
+ -- the same as the type of the expression.
begin
-- If test is explicit x'first .. x'last, replace by valid check
@@ -4386,8 +4485,8 @@ package body Exp_Ch4 is
return;
end if;
- -- If we have an explicit range, do a bit of optimization based
- -- on range analysis (we may be able to kill one or both checks).
+ -- If we have an explicit range, do a bit of optimization based on
+ -- range analysis (we may be able to kill one or both checks).
Lcheck := Compile_Time_Compare (Lop, Lo, Assume_Valid => False);
Ucheck := Compile_Time_Compare (Lop, Hi, Assume_Valid => False);
@@ -4402,8 +4501,7 @@ package body Exp_Ch4 is
Error_Msg_N ("\?value is known to be out of range", N);
end if;
- Rewrite (N,
- New_Reference_To (Standard_False, Loc));
+ Rewrite (N, New_Reference_To (Standard_False, Loc));
Analyze_And_Resolve (N, Rtyp);
Set_Is_Static_Expression (N, Static);
@@ -4418,8 +4516,7 @@ package body Exp_Ch4 is
Error_Msg_N ("\?value is known to be in range", N);
end if;
- Rewrite (N,
- New_Reference_To (Standard_True, Loc));
+ Rewrite (N, New_Reference_To (Standard_True, Loc));
Analyze_And_Resolve (N, Rtyp);
Set_Is_Static_Expression (N, Static);
@@ -4533,11 +4630,8 @@ package body Exp_Ch4 is
-- Update decoration of relocated node referenced by the
-- SCIL node.
- if Generate_SCIL
- and then Present (SCIL_Node)
- then
- Set_SCIL_Related_Node (SCIL_Node, N);
- Insert_Action (N, SCIL_Node);
+ if Generate_SCIL and then Present (SCIL_Node) then
+ Set_SCIL_Node (N, SCIL_Node);
end if;
end if;
@@ -4576,12 +4670,10 @@ package body Exp_Ch4 is
Make_Raise_Program_Error (Loc,
Reason => PE_Unchecked_Union_Restriction));
- -- Prevent Gigi from generating incorrect code by rewriting
- -- the test as a standard False.
-
- Rewrite (N,
- New_Occurrence_Of (Standard_False, Loc));
+ -- Prevent Gigi from generating incorrect code by rewriting the
+ -- test as False.
+ Rewrite (N, New_Occurrence_Of (Standard_False, Loc));
return;
end if;
@@ -4592,8 +4684,7 @@ package body Exp_Ch4 is
end if;
if not Is_Constrained (Typ) then
- Rewrite (N,
- New_Reference_To (Standard_True, Loc));
+ Rewrite (N, New_Reference_To (Standard_True, Loc));
Analyze_And_Resolve (N, Rtyp);
-- For the constrained array case, we have to check the subscripts
@@ -4601,19 +4692,18 @@ package body Exp_Ch4 is
-- must match in any case).
elsif Is_Array_Type (Typ) then
-
Check_Subscripts : declare
- function Construct_Attribute_Reference
+ function Build_Attribute_Reference
(E : Node_Id;
Nam : Name_Id;
Dim : Nat) return Node_Id;
- -- Build attribute reference E'Nam(Dim)
+ -- Build attribute reference E'Nam (Dim)
- -----------------------------------
- -- Construct_Attribute_Reference --
- -----------------------------------
+ -------------------------------
+ -- Build_Attribute_Reference --
+ -------------------------------
- function Construct_Attribute_Reference
+ function Build_Attribute_Reference
(E : Node_Id;
Nam : Name_Id;
Dim : Nat) return Node_Id
@@ -4621,11 +4711,11 @@ package body Exp_Ch4 is
begin
return
Make_Attribute_Reference (Loc,
- Prefix => E,
+ Prefix => E,
Attribute_Name => Nam,
- Expressions => New_List (
+ Expressions => New_List (
Make_Integer_Literal (Loc, Dim)));
- end Construct_Attribute_Reference;
+ end Build_Attribute_Reference;
-- Start of processing for Check_Subscripts
@@ -4634,21 +4724,21 @@ package body Exp_Ch4 is
Evolve_And_Then (Cond,
Make_Op_Eq (Loc,
Left_Opnd =>
- Construct_Attribute_Reference
+ Build_Attribute_Reference
(Duplicate_Subexpr_No_Checks (Obj),
Name_First, J),
Right_Opnd =>
- Construct_Attribute_Reference
+ Build_Attribute_Reference
(New_Occurrence_Of (Typ, Loc), Name_First, J)));
Evolve_And_Then (Cond,
Make_Op_Eq (Loc,
Left_Opnd =>
- Construct_Attribute_Reference
+ Build_Attribute_Reference
(Duplicate_Subexpr_No_Checks (Obj),
Name_Last, J),
Right_Opnd =>
- Construct_Attribute_Reference
+ Build_Attribute_Reference
(New_Occurrence_Of (Typ, Loc), Name_Last, J)));
end loop;
@@ -4795,7 +4885,7 @@ package body Exp_Ch4 is
-- The second expression in a 'Read attribute reference
- -- The prefix of an address or size attribute reference
+ -- The prefix of an address or bit or size attribute reference
-- The following circuit detects these exceptions
@@ -4819,6 +4909,8 @@ package body Exp_Ch4 is
elsif Nkind (Parnt) = N_Attribute_Reference
and then (Attribute_Name (Parnt) = Name_Address
or else
+ Attribute_Name (Parnt) = Name_Bit
+ or else
Attribute_Name (Parnt) = Name_Size)
and then Prefix (Parnt) = Child
then
@@ -5168,7 +5260,7 @@ package body Exp_Ch4 is
and then Is_Power_Of_2_For_Shift (Ropnd)
-- We cannot do this transformation in configurable run time mode if we
- -- have 64-bit -- integers and long shifts are not available.
+ -- have 64-bit integers and long shifts are not available.
and then
(Esize (Ltyp) <= 32
@@ -5983,8 +6075,7 @@ package body Exp_Ch4 is
-- En * En
else -- Expv = 4
- Temp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ Temp := Make_Temporary (Loc, 'E', Base);
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
@@ -6014,6 +6105,9 @@ package body Exp_Ch4 is
-- the flag Is_Natural_Power_Of_2_for_Shift set, then the expansion
-- of the higher level node converts it into a shift.
+ -- Another case is 2 ** N in any other context. We simply convert
+ -- this to 1 * 2 ** N, and then the above transformation applies.
+
-- Note: this transformation is not applicable for a modular type with
-- a non-binary modulus in the multiplication case, since we get a wrong
-- result if the shift causes an overflow before the modular reduction.
@@ -6024,33 +6118,45 @@ package body Exp_Ch4 is
and then Esize (Root_Type (Exptyp)) <= Esize (Standard_Integer)
and then Is_Unsigned_Type (Exptyp)
and then not Ovflo
- and then Nkind (Parent (N)) in N_Binary_Op
then
- declare
- P : constant Node_Id := Parent (N);
- L : constant Node_Id := Left_Opnd (P);
- R : constant Node_Id := Right_Opnd (P);
+ -- First the multiply and divide cases
- begin
- if (Nkind (P) = N_Op_Multiply
- and then not Non_Binary_Modulus (Typ)
- and then
- ((Is_Integer_Type (Etype (L)) and then R = N)
- or else
- (Is_Integer_Type (Etype (R)) and then L = N))
- and then not Do_Overflow_Check (P))
-
- or else
- (Nkind (P) = N_Op_Divide
- and then Is_Integer_Type (Etype (L))
- and then Is_Unsigned_Type (Etype (L))
- and then R = N
- and then not Do_Overflow_Check (P))
- then
- Set_Is_Power_Of_2_For_Shift (N);
- return;
- end if;
- end;
+ if Nkind_In (Parent (N), N_Op_Divide, N_Op_Multiply) then
+ declare
+ P : constant Node_Id := Parent (N);
+ L : constant Node_Id := Left_Opnd (P);
+ R : constant Node_Id := Right_Opnd (P);
+
+ begin
+ if (Nkind (P) = N_Op_Multiply
+ and then not Non_Binary_Modulus (Typ)
+ and then
+ ((Is_Integer_Type (Etype (L)) and then R = N)
+ or else
+ (Is_Integer_Type (Etype (R)) and then L = N))
+ and then not Do_Overflow_Check (P))
+ or else
+ (Nkind (P) = N_Op_Divide
+ and then Is_Integer_Type (Etype (L))
+ and then Is_Unsigned_Type (Etype (L))
+ and then R = N
+ and then not Do_Overflow_Check (P))
+ then
+ Set_Is_Power_Of_2_For_Shift (N);
+ return;
+ end if;
+ end;
+
+ -- Now the other cases
+
+ elsif not Non_Binary_Modulus (Typ) then
+ Rewrite (N,
+ Make_Op_Multiply (Loc,
+ Left_Opnd => Make_Integer_Literal (Loc, 1),
+ Right_Opnd => Relocate_Node (N)));
+ Analyze_And_Resolve (N, Typ);
+ return;
+ end if;
end if;
-- Fall through if exponentiation must be done using a runtime routine
@@ -6743,7 +6849,7 @@ package body Exp_Ch4 is
---------------------
-- If the argument is other than a Boolean array type, there is no special
- -- expansion required.
+ -- expansion required, except for VMS operations on signed integers.
-- For the packed case, we call the special routine in Exp_Pakd, except
-- that if the component size is greater than one, we use the standard
@@ -6793,6 +6899,49 @@ package body Exp_Ch4 is
return;
end if;
+ -- For the VMS "not" on signed integer types, use conversion to and
+ -- from a predefined modular type.
+
+ if Is_VMS_Operator (Entity (N)) then
+ declare
+ Rtyp : Entity_Id;
+ Utyp : Entity_Id;
+
+ begin
+ -- If this is a derived type, retrieve original VMS type so that
+ -- the proper sized type is used for intermediate values.
+
+ if Is_Derived_Type (Typ) then
+ Rtyp := First_Subtype (Etype (Typ));
+ else
+ Rtyp := Typ;
+ end if;
+
+ -- The proper unsigned type must have a size compatible with
+ -- the operand, to prevent misalignment..
+
+ if RM_Size (Rtyp) <= 8 then
+ Utyp := RTE (RE_Unsigned_8);
+
+ elsif RM_Size (Rtyp) <= 16 then
+ Utyp := RTE (RE_Unsigned_16);
+
+ elsif RM_Size (Rtyp) = RM_Size (Standard_Unsigned) then
+ Utyp := RTE (RE_Unsigned_32);
+
+ else
+ Utyp := RTE (RE_Long_Long_Unsigned);
+ end if;
+
+ Rewrite (N,
+ Unchecked_Convert_To (Typ,
+ Make_Op_Not (Loc,
+ Unchecked_Convert_To (Utyp, Right_Opnd (N)))));
+ Analyze_And_Resolve (N, Typ);
+ return;
+ end;
+ end if;
+
-- Only array types need any other processing
if not Is_Array_Type (Typ) then
@@ -6897,7 +7046,7 @@ package body Exp_Ch4 is
Name => B_J,
Expression => Make_Op_Not (Loc, A_J))));
- Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('N'));
+ Func_Name := Make_Temporary (Loc, 'N');
Set_Is_Inlined (Func_Name);
Insert_Action (N,
@@ -7168,104 +7317,8 @@ package body Exp_Ch4 is
-- Expand_N_Or_Else --
----------------------
- -- Expand into conditional expression if Actions present, and also
- -- deal with optimizing case of arguments being True or False.
-
- procedure Expand_N_Or_Else (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Typ : constant Entity_Id := Etype (N);
- Left : constant Node_Id := Left_Opnd (N);
- Right : constant Node_Id := Right_Opnd (N);
- Actlist : List_Id;
-
- begin
- -- Deal with non-standard booleans
-
- if Is_Boolean_Type (Typ) then
- Adjust_Condition (Left);
- Adjust_Condition (Right);
- Set_Etype (N, Standard_Boolean);
- end if;
-
- -- Check for cases where left argument is known to be True or False
-
- if Compile_Time_Known_Value (Left) then
-
- -- If left argument is False, change (False or else Right) to Right.
- -- Any actions associated with Right will be executed unconditionally
- -- and can thus be inserted into the tree unconditionally.
-
- if Expr_Value_E (Left) = Standard_False then
- if Present (Actions (N)) then
- Insert_Actions (N, Actions (N));
- end if;
-
- Rewrite (N, Right);
-
- -- If left argument is True, change (True and then Right) to True. In
- -- this case we can forget the actions associated with Right, since
- -- they will never be executed.
-
- else pragma Assert (Expr_Value_E (Left) = Standard_True);
- Kill_Dead_Code (Right);
- Kill_Dead_Code (Actions (N));
- Rewrite (N, New_Occurrence_Of (Standard_True, Loc));
- end if;
-
- Adjust_Result_Type (N, Typ);
- return;
- end if;
-
- -- If Actions are present, we expand
-
- -- left or else right
-
- -- into
-
- -- if left then True else right end
-
- -- with the actions becoming the Else_Actions of the conditional
- -- expression. This conditional expression is then further expanded
- -- (and will eventually disappear)
-
- if Present (Actions (N)) then
- Actlist := Actions (N);
- Rewrite (N,
- Make_Conditional_Expression (Loc,
- Expressions => New_List (
- Left,
- New_Occurrence_Of (Standard_True, Loc),
- Right)));
-
- Set_Else_Actions (N, Actlist);
- Analyze_And_Resolve (N, Standard_Boolean);
- Adjust_Result_Type (N, Typ);
- return;
- end if;
-
- -- No actions present, check for cases of right argument True/False
-
- if Compile_Time_Known_Value (Right) then
-
- -- Change (Left or else False) to Left. Note that we know there are
- -- no actions associated with the True operand, since we just checked
- -- for this case above.
-
- if Expr_Value_E (Right) = Standard_False then
- Rewrite (N, Left);
-
- -- Change (Left or else True) to True, making sure to preserve any
- -- side effects associated with the Left operand.
-
- else pragma Assert (Expr_Value_E (Right) = Standard_True);
- Remove_Side_Effects (Left);
- Rewrite
- (N, New_Occurrence_Of (Standard_True, Loc));
- end if;
- end if;
-
- Adjust_Result_Type (N, Typ);
- end Expand_N_Or_Else;
+ procedure Expand_N_Or_Else (N : Node_Id)
+ renames Expand_Short_Circuit_Operator;
-----------------------------------
-- Expand_N_Qualified_Expression --
@@ -7604,6 +7657,7 @@ package body Exp_Ch4 is
procedure Make_Temporary_For_Slice is
Decl : Node_Id;
Ent : constant Entity_Id := Make_Temporary (Loc, 'T', N);
+
begin
Decl :=
Make_Object_Declaration (Loc,
@@ -7739,7 +7793,6 @@ package body Exp_Ch4 is
Cons : List_Id;
begin
-
-- Nothing else to do if no change of representation
if Same_Representation (Operand_Type, Target_Type) then
@@ -7828,7 +7881,7 @@ package body Exp_Ch4 is
Constraints => Cons));
end if;
- Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
+ Temp := Make_Temporary (Loc, 'C');
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
@@ -7990,9 +8043,7 @@ package body Exp_Ch4 is
Enable_Overflow_Check (Conv);
end if;
- Tnn :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Tnn := Make_Temporary (Loc, 'T', Conv);
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
@@ -8223,15 +8274,13 @@ package body Exp_Ch4 is
-- renaming, since this is an error situation which will be caught by
-- Sem_Ch8, and the expansion can interfere with this error check.
- if Is_Access_Type (Target_Type)
- and then Is_Renamed_Object (N)
- then
+ if Is_Access_Type (Target_Type) and then Is_Renamed_Object (N) then
return;
end if;
-- Otherwise, proceed with processing tagged conversion
- declare
+ Tagged_Conversion : declare
Actual_Op_Typ : Entity_Id;
Actual_Targ_Typ : Entity_Id;
Make_Conversion : Boolean := False;
@@ -8286,7 +8335,7 @@ package body Exp_Ch4 is
Reason => CE_Tag_Check_Failed));
end Make_Tag_Check;
- -- Start of processing
+ -- Start of processing for Tagged_Conversion
begin
if Is_Access_Type (Target_Type) then
@@ -8383,7 +8432,7 @@ package body Exp_Ch4 is
end;
end if;
end if;
- end;
+ end Tagged_Conversion;
-- Case of other access type conversions
@@ -8420,9 +8469,9 @@ package body Exp_Ch4 is
end if;
-- Otherwise do correct fixed-conversion, but skip these if the
- -- Conversion_OK flag is set, because from a semantic point of
- -- view these are simple integer conversions needing no further
- -- processing (the backend will simply treat them as integers)
+ -- Conversion_OK flag is set, because from a semantic point of view
+ -- these are simple integer conversions needing no further processing
+ -- (the backend will simply treat them as integers).
if not Conversion_OK (N) then
if Is_Fixed_Point_Type (Etype (N)) then
@@ -8476,7 +8525,7 @@ package body Exp_Ch4 is
-- with the end-point. But that can lose precision in some cases, and
-- give a wrong result. Converting the operand to Universal_Real is
-- helpful, but still does not catch all cases with 64-bit integers
- -- on targets with only 64-bit floats
+ -- on targets with only 64-bit floats.
-- The above comment seems obsoleted by Apply_Float_Conversion_Check
-- Can this code be removed ???
@@ -8559,7 +8608,7 @@ package body Exp_Ch4 is
elsif Is_Enumeration_Type (Target_Type) then
-- Special processing is required if there is a change of
- -- representation (from enumeration representation clauses)
+ -- representation (from enumeration representation clauses).
if not Same_Representation (Target_Type, Operand_Type) then
@@ -8585,9 +8634,8 @@ package body Exp_Ch4 is
end if;
-- At this stage, either the conversion node has been transformed into
- -- some other equivalent expression, or left as a conversion that can
- -- be handled by Gigi. The conversions that Gigi can handle are the
- -- following:
+ -- some other equivalent expression, or left as a conversion that can be
+ -- handled by Gigi, in the following cases:
-- Conversions with no change of representation or type
@@ -8640,7 +8688,7 @@ package body Exp_Ch4 is
end if;
-- Reset overflow flag, since the range check will include
- -- dealing with possible overflow, and generate the check If
+ -- dealing with possible overflow, and generate the check. If
-- Address is either a source type or target type, suppress
-- range check to avoid typing anomalies when it is a visible
-- integer type.
@@ -8671,16 +8719,15 @@ package body Exp_Ch4 is
-- Expand_N_Unchecked_Expression --
-----------------------------------
- -- Remove the unchecked expression node from the tree. It's job was simply
+ -- Remove the unchecked expression node from the tree. Its job was simply
-- to make sure that its constituent expression was handled with checks
-- off, and now that that is done, we can remove it from the tree, and
- -- indeed must, since gigi does not expect to see these nodes.
+ -- indeed must, since Gigi does not expect to see these nodes.
procedure Expand_N_Unchecked_Expression (N : Node_Id) is
Exp : constant Node_Id := Expression (N);
-
begin
- Set_Assignment_OK (Exp, Assignment_OK (N) or Assignment_OK (Exp));
+ Set_Assignment_OK (Exp, Assignment_OK (N) or else Assignment_OK (Exp));
Rewrite (N, Exp);
end Expand_N_Unchecked_Expression;
@@ -8699,9 +8746,12 @@ package body Exp_Ch4 is
begin
-- Nothing at all to do if conversion is to the identical type so remove
-- the conversion completely, it is useless, except that it may carry
- -- an Assignment_OK indication which must be proprgated to the operand.
+ -- an Assignment_OK indication which must be propagated to the operand.
if Operand_Type = Target_Type then
+
+ -- Code duplicates Expand_N_Unchecked_Expression above, factor???
+
if Assignment_OK (N) then
Set_Assignment_OK (Operand);
end if;
@@ -8859,7 +8909,6 @@ package body Exp_Ch4 is
Result := New_Reference_To (Standard_True, Loc);
C := Suitable_Element (First_Entity (Typ));
-
while Present (C) loop
declare
New_Lhs : Node_Id;
@@ -8909,6 +8958,206 @@ package body Exp_Ch4 is
return Result;
end Expand_Record_Equality;
+ -----------------------------------
+ -- Expand_Short_Circuit_Operator --
+ -----------------------------------
+
+ -- Deal with special expansion if actions are present for the right operand
+ -- and deal with optimizing case of arguments being True or False. We also
+ -- deal with the special case of non-standard boolean values.
+
+ procedure Expand_Short_Circuit_Operator (N : Node_Id) is
+ Loc : constant Source_Ptr := Sloc (N);
+ Typ : constant Entity_Id := Etype (N);
+ Left : constant Node_Id := Left_Opnd (N);
+ Right : constant Node_Id := Right_Opnd (N);
+ LocR : constant Source_Ptr := Sloc (Right);
+ Actlist : List_Id;
+
+ Shortcut_Value : constant Boolean := Nkind (N) = N_Or_Else;
+ Shortcut_Ent : constant Entity_Id := Boolean_Literals (Shortcut_Value);
+ -- If Left = Shortcut_Value then Right need not be evaluated
+
+ function Make_Test_Expr (Opnd : Node_Id) return Node_Id;
+ -- For Opnd a boolean expression, return a Boolean expression equivalent
+ -- to Opnd /= Shortcut_Value.
+
+ --------------------
+ -- Make_Test_Expr --
+ --------------------
+
+ function Make_Test_Expr (Opnd : Node_Id) return Node_Id is
+ begin
+ if Shortcut_Value then
+ return Make_Op_Not (Sloc (Opnd), Opnd);
+ else
+ return Opnd;
+ end if;
+ end Make_Test_Expr;
+
+ Op_Var : Entity_Id;
+ -- Entity for a temporary variable holding the value of the operator,
+ -- used for expansion in the case where actions are present.
+
+ -- Start of processing for Expand_Short_Circuit_Operator
+
+ begin
+ -- Deal with non-standard booleans
+
+ if Is_Boolean_Type (Typ) then
+ Adjust_Condition (Left);
+ Adjust_Condition (Right);
+ Set_Etype (N, Standard_Boolean);
+ end if;
+
+ -- Check for cases where left argument is known to be True or False
+
+ if Compile_Time_Known_Value (Left) then
+
+ -- Mark SCO for left condition as compile time known
+
+ if Generate_SCO and then Comes_From_Source (Left) then
+ Set_SCO_Condition (Left, Expr_Value_E (Left) = Standard_True);
+ end if;
+
+ -- Rewrite True AND THEN Right / False OR ELSE Right to Right.
+ -- Any actions associated with Right will be executed unconditionally
+ -- and can thus be inserted into the tree unconditionally.
+
+ if Expr_Value_E (Left) /= Shortcut_Ent then
+ if Present (Actions (N)) then
+ Insert_Actions (N, Actions (N));
+ end if;
+
+ Rewrite (N, Right);
+
+ -- Rewrite False AND THEN Right / True OR ELSE Right to Left.
+ -- In this case we can forget the actions associated with Right,
+ -- since they will never be executed.
+
+ else
+ Kill_Dead_Code (Right);
+ Kill_Dead_Code (Actions (N));
+ Rewrite (N, New_Occurrence_Of (Shortcut_Ent, Loc));
+ end if;
+
+ Adjust_Result_Type (N, Typ);
+ return;
+ end if;
+
+ -- If Actions are present for the right operand, we have to do some
+ -- special processing. We can't just let these actions filter back into
+ -- code preceding the short circuit (which is what would have happened
+ -- if we had not trapped them in the short-circuit form), since they
+ -- must only be executed if the right operand of the short circuit is
+ -- executed and not otherwise.
+
+ -- the temporary variable C.
+
+ if Present (Actions (N)) then
+ Actlist := Actions (N);
+
+ -- The old approach is to expand:
+
+ -- left AND THEN right
+
+ -- into
+
+ -- C : Boolean := False;
+ -- IF left THEN
+ -- Actions;
+ -- IF right THEN
+ -- C := True;
+ -- END IF;
+ -- END IF;
+
+ -- and finally rewrite the operator into a reference to C. Similarly
+ -- for left OR ELSE right, with negated values. Note that this
+ -- rewrite causes some difficulties for coverage analysis because
+ -- of the introduction of the new variable C, which obscures the
+ -- structure of the test.
+
+ -- We use this "old approach" if use of N_Expression_With_Actions
+ -- is False (see description in Opt of when this is or is not set).
+
+ if not Use_Expression_With_Actions then
+ Op_Var := Make_Temporary (Loc, 'C', Related_Node => N);
+
+ Insert_Action (N,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier =>
+ Op_Var,
+ Object_Definition =>
+ New_Occurrence_Of (Standard_Boolean, Loc),
+ Expression =>
+ New_Occurrence_Of (Shortcut_Ent, Loc)));
+
+ Append_To (Actlist,
+ Make_Implicit_If_Statement (Right,
+ Condition => Make_Test_Expr (Right),
+ Then_Statements => New_List (
+ Make_Assignment_Statement (LocR,
+ Name => New_Occurrence_Of (Op_Var, LocR),
+ Expression =>
+ New_Occurrence_Of
+ (Boolean_Literals (not Shortcut_Value), LocR)))));
+
+ Insert_Action (N,
+ Make_Implicit_If_Statement (Left,
+ Condition => Make_Test_Expr (Left),
+ Then_Statements => Actlist));
+
+ Rewrite (N, New_Occurrence_Of (Op_Var, Loc));
+ Analyze_And_Resolve (N, Standard_Boolean);
+
+ -- The new approach, activated for now by the use of debug flag
+ -- -gnatd.X is to use the new Expression_With_Actions node for the
+ -- right operand of the short-circuit form. This should solve the
+ -- traceability problems for coverage analysis.
+
+ else
+ Rewrite (Right,
+ Make_Expression_With_Actions (LocR,
+ Expression => Relocate_Node (Right),
+ Actions => Actlist));
+ Set_Actions (N, No_List);
+ Analyze_And_Resolve (Right, Standard_Boolean);
+ end if;
+
+ Adjust_Result_Type (N, Typ);
+ return;
+ end if;
+
+ -- No actions present, check for cases of right argument True/False
+
+ if Compile_Time_Known_Value (Right) then
+
+ -- Mark SCO for left condition as compile time known
+
+ if Generate_SCO and then Comes_From_Source (Right) then
+ Set_SCO_Condition (Right, Expr_Value_E (Right) = Standard_True);
+ end if;
+
+ -- Change (Left and then True), (Left or else False) to Left.
+ -- Note that we know there are no actions associated with the right
+ -- operand, since we just checked for this case above.
+
+ if Expr_Value_E (Right) /= Shortcut_Ent then
+ Rewrite (N, Left);
+
+ -- Change (Left and then False), (Left or else True) to Right,
+ -- making sure to preserve any side effects associated with the Left
+ -- operand.
+
+ else
+ Remove_Side_Effects (Left);
+ Rewrite (N, New_Occurrence_Of (Shortcut_Ent, Loc));
+ end if;
+ end if;
+
+ Adjust_Result_Type (N, Typ);
+ end Expand_Short_Circuit_Operator;
+
-------------------------------------
-- Fixup_Universal_Fixed_Operation --
-------------------------------------
@@ -8975,7 +9224,7 @@ package body Exp_Ch4 is
PtrT /=
Etype (Defining_Unit_Name (Associated_Node_For_Itype (PtrT)))
then
- Owner := Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
+ Owner := Make_Temporary (Loc, 'J');
Insert_Action (N,
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Owner,
@@ -8999,7 +9248,7 @@ package body Exp_Ch4 is
then
Owner := Scope (Return_Applies_To (Scope (PtrT)));
- -- Case of an access discriminant, or (Ada 2005), of an anonymous
+ -- Case of an access discriminant, or (Ada 2005) of an anonymous
-- access component or anonymous access function result: find the
-- final list associated with the scope of the type. (In the
-- anonymous access component kind, a list controller will have
@@ -9466,7 +9715,7 @@ package body Exp_Ch4 is
-- if ... end if;
-- end Gnnn;
- Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('G'));
+ Func_Name := Make_Temporary (Loc, 'G');
Func_Body :=
Make_Subprogram_Body (Loc,
@@ -9594,8 +9843,7 @@ package body Exp_Ch4 is
Defining_Identifier => B,
Parameter_Type => New_Reference_To (Typ, Loc)));
- Func_Name :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Func_Name := Make_Temporary (Loc, 'A');
Set_Is_Inlined (Func_Name);
Func_Body :=
@@ -9647,7 +9895,7 @@ package body Exp_Ch4 is
-- in the call to Compile_Time_Compare. If this call results in a
-- clear result of always True or Always False, that's decisive and
-- we are done. Otherwise we repeat the processing with Assume_Valid
- -- set to True to generate additional warnings. We can stil that step
+ -- set to True to generate additional warnings. We can skip that step
-- if Constant_Condition_Warnings is False.
for AV in False .. True loop
@@ -9736,9 +9984,9 @@ package body Exp_Ch4 is
end if;
-- If this is the second iteration (AV = True), and the original
- -- node comes from source and we are not in an instance, then
- -- give a warning if we know result would be True or False. Note
- -- we know Constant_Condition_Warnings is set if we get here.
+ -- node comes from source and we are not in an instance, then give
+ -- a warning if we know result would be True or False. Note: we
+ -- know Constant_Condition_Warnings is set if we get here.
elsif Comes_From_Source (Original_Node (N))
and then not In_Instance
@@ -9756,9 +10004,9 @@ package body Exp_Ch4 is
end;
-- Skip second iteration if not warning on constant conditions or
- -- if the first iteration already generated a warning of some kind
- -- or if we are in any case assuming all values are valid (so that
- -- the first iteration took care of the valid case).
+ -- if the first iteration already generated a warning of some kind or
+ -- if we are in any case assuming all values are valid (so that the
+ -- first iteration took care of the valid case).
exit when not Constant_Condition_Warnings;
exit when Warning_Generated;
@@ -9825,7 +10073,7 @@ package body Exp_Ch4 is
end if;
end Is_Safe_Operand;
- -- Start of processing for Is_Safe_In_Place_Array_Op
+ -- Start of processing for Is_Safe_In_Place_Array_Op
begin
-- Skip this processing if the component size is different from system
@@ -9846,12 +10094,10 @@ package body Exp_Ch4 is
elsif not Is_Unaliased (Lhs) then
return False;
+
else
Target := Entity (Lhs);
-
- return
- Is_Safe_Operand (Op1)
- and then Is_Safe_Operand (Op2);
+ return Is_Safe_Operand (Op1) and then Is_Safe_Operand (Op2);
end if;
end Safe_In_Place_Array_Op;
diff --git a/gcc/ada/exp_ch4.ads b/gcc/ada/exp_ch4.ads
index fad8c15eea1..745ce294d6a 100644
--- a/gcc/ada/exp_ch4.ads
+++ b/gcc/ada/exp_ch4.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -31,9 +31,10 @@ package Exp_Ch4 is
procedure Expand_N_Allocator (N : Node_Id);
procedure Expand_N_And_Then (N : Node_Id);
+ procedure Expand_N_Case_Expression (N : Node_Id);
procedure Expand_N_Conditional_Expression (N : Node_Id);
- procedure Expand_N_In (N : Node_Id);
procedure Expand_N_Explicit_Dereference (N : Node_Id);
+ procedure Expand_N_In (N : Node_Id);
procedure Expand_N_Indexed_Component (N : Node_Id);
procedure Expand_N_Not_In (N : Node_Id);
procedure Expand_N_Null (N : Node_Id);
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 021afbf5282..71b58ae358e 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -516,8 +516,7 @@ package body Exp_Ch5 is
if Nkind (Rhs) = N_String_Literal then
declare
- Temp : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ Temp : constant Entity_Id := Make_Temporary (Loc, 'T', Rhs);
Decl : Node_Id;
begin
@@ -1028,13 +1027,8 @@ package body Exp_Ch5 is
R_Index := First_Index (R_Type);
for J in 1 .. Ndim loop
- Lnn (J) :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
-
- Rnn (J) :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
+ Lnn (J) := Make_Temporary (Loc, 'L');
+ Rnn (J) := Make_Temporary (Loc, 'R');
L_Index_Type (J) := Etype (L_Index);
R_Index_Type (J) := Etype (R_Index);
@@ -1624,8 +1618,7 @@ package body Exp_Ch5 is
BPAR_Expr : constant Node_Id := Relocate_Node (Prefix (Lhs));
BPAR_Typ : constant Entity_Id := Etype (BPAR_Expr);
Tnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Make_Temporary (Loc, 'T', BPAR_Expr);
begin
-- Insert the post assignment first, because we want to copy the
@@ -2848,8 +2841,7 @@ package body Exp_Ch5 is
-- Create an access type designating the function's
-- result subtype.
- Ref_Type :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Ref_Type := Make_Temporary (Loc, 'A');
Ptr_Type_Decl :=
Make_Full_Type_Declaration (Loc,
@@ -2867,9 +2859,7 @@ package body Exp_Ch5 is
-- from an implicit access value passed in by the caller
-- or from the result of an allocator.
- Alloc_Obj_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
+ Alloc_Obj_Id := Make_Temporary (Loc, 'R');
Set_Etype (Alloc_Obj_Id, Ref_Type);
Alloc_Obj_Decl :=
@@ -3854,8 +3844,7 @@ package body Exp_Ch5 is
then
declare
Return_Object_Entity : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('R'));
+ Make_Temporary (Loc, 'R', Exp);
Obj_Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Return_Object_Entity,
@@ -4009,13 +3998,9 @@ package body Exp_Ch5 is
elsif CW_Or_Has_Controlled_Part (Utyp) then
declare
Loc : constant Source_Ptr := Sloc (N);
- Temp : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
- Acc_Typ : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Acc_Typ : constant Entity_Id := Make_Temporary (Loc, 'A');
Alloc_Node : Node_Id;
+ Temp : Entity_Id;
begin
Set_Ekind (Acc_Typ, E_Access_Type);
@@ -4031,13 +4016,15 @@ package body Exp_Ch5 is
Expression =>
Make_Qualified_Expression (Loc,
Subtype_Mark => New_Reference_To (Etype (Exp), Loc),
- Expression => Relocate_Node (Exp)));
+ Expression => Relocate_Node (Exp)));
-- We do not want discriminant checks on the declaration,
-- given that it gets its value from the allocator.
Set_No_Initialization (Alloc_Node);
+ Temp := Make_Temporary (Loc, 'R', Alloc_Node);
+
Insert_List_Before_And_Analyze (N, New_List (
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Acc_Typ,
@@ -4118,18 +4105,18 @@ package body Exp_Ch5 is
else
declare
+ ExpR : constant Node_Id := Relocate_Node (Exp);
Result_Id : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
- Result_Exp : constant Node_Id :=
+ Make_Temporary (Loc, 'R', ExpR);
+ Result_Exp : constant Node_Id :=
New_Reference_To (Result_Id, Loc);
- Result_Obj : constant Node_Id :=
+ Result_Obj : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Result_Id,
Object_Definition =>
New_Reference_To (R_Type, Loc),
Constant_Present => True,
- Expression => Relocate_Node (Exp));
+ Expression => ExpR);
begin
Set_Assignment_OK (Result_Obj);
@@ -4205,24 +4192,24 @@ package body Exp_Ch5 is
end;
end if;
- -- If we are returning an object that may not be bit-aligned, then
- -- copy the value into a temporary first. This copy may need to expand
- -- to a loop of component operations..
+ -- If we are returning an object that may not be bit-aligned, then copy
+ -- the value into a temporary first. This copy may need to expand to a
+ -- loop of component operations.
if Is_Possibly_Unaligned_Slice (Exp)
or else Is_Possibly_Unaligned_Object (Exp)
then
declare
- Tnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ ExpR : constant Node_Id := Relocate_Node (Exp);
+ Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR);
begin
Insert_Action (Exp,
Make_Object_Declaration (Loc,
Defining_Identifier => Tnn,
Constant_Present => True,
Object_Definition => New_Occurrence_Of (R_Type, Loc),
- Expression => Relocate_Node (Exp)),
- Suppress => All_Checks);
+ Expression => ExpR),
+ Suppress => All_Checks);
Rewrite (Exp, New_Occurrence_Of (Tnn, Loc));
end;
end if;
@@ -4255,8 +4242,8 @@ package body Exp_Ch5 is
else
declare
- Tnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ ExpR : constant Node_Id := Relocate_Node (Exp);
+ Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR);
begin
-- For a complex expression of an elementary type, capture
@@ -4268,7 +4255,7 @@ package body Exp_Ch5 is
Defining_Identifier => Tnn,
Constant_Present => True,
Object_Definition => New_Occurrence_Of (R_Type, Loc),
- Expression => Relocate_Node (Exp)),
+ Expression => ExpR),
Suppress => All_Checks);
Rewrite (Exp, New_Occurrence_Of (Tnn, Loc));
@@ -4281,7 +4268,7 @@ package body Exp_Ch5 is
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Tnn,
Subtype_Mark => New_Occurrence_Of (R_Type, Loc),
- Name => Relocate_Node (Exp)),
+ Name => ExpR),
Suppress => All_Checks);
Rewrite (Exp, New_Occurrence_Of (Tnn, Loc));
@@ -4421,8 +4408,7 @@ package body Exp_Ch5 is
-- Save the Tag in a local variable Tag_Tmp
if Save_Tag then
- Tag_Tmp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Tag_Tmp := Make_Temporary (Loc, 'A');
Append_To (Res,
Make_Object_Declaration (Loc,
@@ -4461,8 +4447,7 @@ package body Exp_Ch5 is
New_Reference_To (Controller_Component (T), Loc));
end if;
- Prev_Tmp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('B'));
+ Prev_Tmp := Make_Temporary (Loc, 'B');
Append_To (Res,
Make_Object_Declaration (Loc,
@@ -4477,9 +4462,7 @@ package body Exp_Ch5 is
Unchecked_Convert_To (RTE (RE_Finalizable), Ctrl_Ref),
Selector_Name => Make_Identifier (Loc, Name_Prev))));
- Next_Tmp :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('C'));
+ Next_Tmp := Make_Temporary (Loc, 'C');
Append_To (Res,
Make_Object_Declaration (Loc,
@@ -4638,9 +4621,7 @@ package body Exp_Ch5 is
Make_Integer_Literal (Loc,
Intval => System_Storage_Unit));
- Range_Type :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('G'));
+ Range_Type := Make_Temporary (Loc, 'G');
Append_To (Res,
Make_Subtype_Declaration (Loc,
@@ -4659,9 +4640,7 @@ package body Exp_Ch5 is
Append_To (Res,
Make_Subtype_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S')),
+ Defining_Identifier => Make_Temporary (Loc, 'S'),
Subtype_Indication =>
Make_Subtype_Indication (Loc,
Subtype_Mark =>
@@ -4673,9 +4652,7 @@ package body Exp_Ch5 is
-- type A is access S
- Opaque_Type :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Opaque_Type := Make_Temporary (Loc, 'A');
Append_To (Res,
Make_Full_Type_Declaration (Loc,
@@ -4721,9 +4698,7 @@ package body Exp_Ch5 is
-- Last index before hole: determined by position of the
-- _Controller.Prev component.
- Last_Before_Hole :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('L'));
+ Last_Before_Hole := Make_Temporary (Loc, 'L');
Append_To (Res,
Make_Object_Declaration (Loc,
@@ -4731,7 +4706,8 @@ package body Exp_Ch5 is
Object_Definition => New_Occurrence_Of (
RTE (RE_Storage_Offset), Loc),
Constant_Present => True,
- Expression => Make_Op_Add (Loc,
+ Expression =>
+ Make_Op_Add (Loc,
Make_Attribute_Reference (Loc,
Prefix => Prev_Ref,
Attribute_Name => Name_Position),
@@ -4756,9 +4732,7 @@ package body Exp_Ch5 is
-- First index after hole
- First_After_Hole :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('F'));
+ First_After_Hole := Make_Temporary (Loc, 'F');
Append_To (Res,
Make_Object_Declaration (Loc,
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 4ab2df7b878..9ddb278417c 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -808,9 +808,7 @@ package body Exp_Ch6 is
Elm := First_Elmt (Var_List);
while Present (Elm) loop
Var := Node (Elm);
- Ent :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Ent := Make_Temporary (Loc, 'S');
Append_Elmt (Ent, Shad_List);
-- Insert a declaration for this temporary at the start of the
@@ -966,9 +964,7 @@ package body Exp_Ch6 is
return;
end if;
- Temp :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Temp := Make_Temporary (Loc, 'T', Actual);
-- Use formal type for temp, unless formal type is an unconstrained
-- array, in which case we don't have to worry about bounds checks,
@@ -1220,9 +1216,7 @@ package body Exp_Ch6 is
Reset_Packed_Prefix;
- Temp :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Temp := Make_Temporary (Loc, 'T', Actual);
Incod := Relocate_Node (Actual);
Outcod := New_Copy_Tree (Incod);
@@ -1387,9 +1381,7 @@ package body Exp_Ch6 is
return Entity (Actual);
else
- Var :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Var := Make_Temporary (Loc, 'T', Actual);
N_Node :=
Make_Object_Renaming_Declaration (Loc,
@@ -2676,9 +2668,7 @@ package body Exp_Ch6 is
if Present (Inherited_From_Formal (Subp)) then
Parent_Subp := Inherited_From_Formal (Subp);
else
- while Present (Alias (Parent_Subp)) loop
- Parent_Subp := Alias (Parent_Subp);
- end loop;
+ Parent_Subp := Ultimate_Alias (Parent_Subp);
end if;
-- The below setting of Entity is suspect, see F109-018 discussion???
@@ -2778,20 +2768,6 @@ package body Exp_Ch6 is
Rewrite (Actual,
Unchecked_Convert_To (Parent_Typ,
Relocate_Node (Actual)));
-
- -- If the relocated node is a function call then it
- -- can be part of the expansion of the predefined
- -- equality operator of a tagged type and we may
- -- need to adjust its SCIL dispatching node.
-
- if Generate_SCIL
- and then Nkind (Actual) /= N_Null
- and then Nkind (Expression (Actual))
- = N_Function_Call
- then
- Adjust_SCIL_Node (Actual, Expression (Actual));
- end if;
-
Analyze (Actual);
Resolve (Actual, Parent_Typ);
end if;
@@ -2949,9 +2925,8 @@ package body Exp_Ch6 is
return;
end if;
- if Ekind (Subp) = E_Function
- or else Ekind (Subp) = E_Procedure
- then
+ if Ekind_In (Subp, E_Function, E_Procedure) then
+
-- We perform two simple optimization on calls:
-- a) replace calls to null procedures unconditionally;
@@ -3104,12 +3079,14 @@ package body Exp_Ch6 is
-- In Ada 2005, this may be an indirect call to an access parameter that
-- is an access_to_subprogram. In that case the anonymous type has a
-- scope that is a protected operation, but the call is a regular one.
+ -- In either case do not expand call if subprogram is eliminated.
Scop := Scope (Subp);
if Nkind (N) /= N_Entry_Call_Statement
and then Is_Protected_Type (Scop)
and then Ekind (Subp) /= E_Subprogram_Type
+ and then not Is_Eliminated (Subp)
then
-- If the call is an internal one, it is rewritten as a call to the
-- corresponding unprotected subprogram.
@@ -3304,6 +3281,9 @@ package body Exp_Ch6 is
Temp : Entity_Id;
Temp_Typ : Entity_Id;
+ Return_Object : Entity_Id := Empty;
+ -- Entity in declaration in an extended_return_statement
+
Is_Unc : constant Boolean :=
Is_Array_Type (Etype (Subp))
and then not Is_Constrained (Etype (Subp));
@@ -3312,8 +3292,8 @@ package body Exp_Ch6 is
procedure Make_Exit_Label;
-- Build declaration for exit label to be used in Return statements,
- -- sets Exit_Lab (the label node) and Lab_Decl (corresponding implcit
- -- declaration).
+ -- sets Exit_Lab (the label node) and Lab_Decl (corresponding implicit
+ -- declaration). Does nothing if Exit_Lab already set.
function Process_Formals (N : Node_Id) return Traverse_Result;
-- Replace occurrence of a formal with the corresponding actual, or the
@@ -3343,20 +3323,15 @@ package body Exp_Ch6 is
---------------------
procedure Make_Exit_Label is
+ Lab_Ent : Entity_Id;
begin
- -- Create exit label for subprogram if one does not exist yet
-
if No (Exit_Lab) then
- Lab_Id :=
- Make_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
- Set_Entity (Lab_Id,
- Make_Defining_Identifier (Loc, Chars (Lab_Id)));
+ Lab_Ent := Make_Temporary (Loc, 'L');
+ Lab_Id := New_Reference_To (Lab_Ent, Loc);
Exit_Lab := Make_Label (Loc, Lab_Id);
-
Lab_Decl :=
Make_Implicit_Label_Declaration (Loc,
- Defining_Identifier => Entity (Lab_Id),
+ Defining_Identifier => Lab_Ent,
Label_Construct => Exit_Lab);
end if;
end Make_Exit_Label;
@@ -3402,6 +3377,22 @@ package body Exp_Ch6 is
Rewrite (N, New_Copy (A));
end if;
end if;
+ return Skip;
+
+ elsif Is_Entity_Name (N)
+ and then Present (Return_Object)
+ and then Chars (N) = Chars (Return_Object)
+ then
+ -- Occurrence within an extended return statement. The return
+ -- object is local to the body been inlined, and thus the generic
+ -- copy is not analyzed yet, so we match by name, and replace it
+ -- with target of call.
+
+ if Nkind (Targ) = N_Defining_Identifier then
+ Rewrite (N, New_Occurrence_Of (Targ, Loc));
+ else
+ Rewrite (N, New_Copy_Tree (Targ));
+ end if;
return Skip;
@@ -3409,8 +3400,7 @@ package body Exp_Ch6 is
if No (Expression (N)) then
Make_Exit_Label;
Rewrite (N,
- Make_Goto_Statement (Loc,
- Name => New_Copy (Lab_Id)));
+ Make_Goto_Statement (Loc, Name => New_Copy (Lab_Id)));
else
if Nkind (Parent (N)) = N_Handled_Sequence_Of_Statements
@@ -3468,6 +3458,46 @@ package body Exp_Ch6 is
return OK;
+ elsif Nkind (N) = N_Extended_Return_Statement then
+
+ -- An extended return becomes a block whose first statement is
+ -- the assignment of the initial expression of the return object
+ -- to the target of the call itself.
+
+ declare
+ Return_Decl : constant Entity_Id :=
+ First (Return_Object_Declarations (N));
+ Assign : Node_Id;
+
+ begin
+ Return_Object := Defining_Identifier (Return_Decl);
+
+ if Present (Expression (Return_Decl)) then
+ if Nkind (Targ) = N_Defining_Identifier then
+ Assign :=
+ Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Targ, Loc),
+ Expression => Expression (Return_Decl));
+ else
+ Assign :=
+ Make_Assignment_Statement (Loc,
+ Name => New_Copy (Targ),
+ Expression => Expression (Return_Decl));
+ end if;
+
+ Set_Assignment_OK (Name (Assign));
+ Prepend (Assign,
+ Statements (Handled_Statement_Sequence (N)));
+ end if;
+
+ Rewrite (N,
+ Make_Block_Statement (Loc,
+ Handled_Statement_Sequence =>
+ Handled_Statement_Sequence (N)));
+
+ return OK;
+ end;
+
-- Remove pragma Unreferenced since it may refer to formals that
-- are not visible in the inlined body, and in any case we will
-- not be posting warnings on the inlined body so it is unneeded.
@@ -3674,15 +3704,18 @@ package body Exp_Ch6 is
if Nkind (Orig_Bod) = N_Defining_Identifier
or else Nkind (Orig_Bod) = N_Defining_Operator_Symbol
then
- -- Subprogram is a renaming_as_body. Calls appearing after the
- -- renaming can be replaced with calls to the renamed entity
- -- directly, because the subprograms are subtype conformant. If
- -- the renamed subprogram is an inherited operation, we must redo
- -- the expansion because implicit conversions may be needed.
+ -- Subprogram is renaming_as_body. Calls occurring after the renaming
+ -- can be replaced with calls to the renamed entity directly, because
+ -- the subprograms are subtype conformant. If the renamed subprogram
+ -- is an inherited operation, we must redo the expansion because
+ -- implicit conversions may be needed. Similarly, if the renamed
+ -- entity is inlined, expand the call for further optimizations.
Set_Name (N, New_Occurrence_Of (Orig_Bod, Loc));
- if Present (Alias (Orig_Bod)) then
+ if Present (Alias (Orig_Bod))
+ or else Is_Inlined (Orig_Bod)
+ then
Expand_Call (N);
end if;
@@ -3793,9 +3826,7 @@ package body Exp_Ch6 is
end if;
else
- Temp :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('C'));
+ Temp := Make_Temporary (Loc, 'C');
-- If the actual for an in/in-out parameter is a view conversion,
-- make it into an unchecked conversion, given that an untagged
@@ -3880,11 +3911,15 @@ package body Exp_Ch6 is
then
Targ := Name (Parent (N));
+ elsif Nkind (Parent (N)) = N_Object_Declaration
+ and then Is_Limited_Type (Etype (Subp))
+ then
+ Targ := Defining_Identifier (Parent (N));
+
else
-- Replace call with temporary and create its declaration
- Temp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
+ Temp := Make_Temporary (Loc, 'C');
Set_Is_Internal (Temp);
-- For the unconstrained case, the generated temporary has the
@@ -4354,9 +4389,7 @@ package body Exp_Ch6 is
-- For a procedure, we add a return for all possible syntactic ends of
-- the subprogram.
- if Ekind (Spec_Id) = E_Procedure
- or else Ekind (Spec_Id) = E_Generic_Procedure
- then
+ if Ekind_In (Spec_Id, E_Procedure, E_Generic_Procedure) then
Add_Return (Statements (H));
if Present (Exception_Handlers (H)) then
@@ -4610,10 +4643,8 @@ package body Exp_Ch6 is
-- define _object later on.
declare
- Decls : List_Id;
- Obj_Ptr : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars =>
- New_Internal_Name ('T'));
+ Decls : List_Id;
+ Obj_Ptr : constant Entity_Id := Make_Temporary (Loc, 'T');
begin
Decls := New_List (
@@ -4623,7 +4654,7 @@ package body Exp_Ch6 is
Make_Access_To_Object_Definition (Loc,
Subtype_Indication =>
New_Reference_To
- (Corresponding_Record_Type (Scop), Loc))));
+ (Corresponding_Record_Type (Scop), Loc))));
Insert_Actions (N, Decls);
Insert_Actions (N, Freeze_Entity (Obj_Ptr, Sloc (N)));
@@ -4719,14 +4750,21 @@ package body Exp_Ch6 is
function Is_Build_In_Place_Function (E : Entity_Id) return Boolean is
begin
+ -- This function is called from Expand_Subtype_From_Expr during
+ -- semantic analysis, even when expansion is off. In those cases
+ -- the build_in_place expansion will not take place.
+
+ if not Expander_Active then
+ return False;
+ end if;
+
-- For now we test whether E denotes a function or access-to-function
-- type whose result subtype is inherently limited. Later this test may
-- be revised to allow composite nonlimited types. Functions with a
-- foreign convention or whose result type has a foreign convention
-- never qualify.
- if Ekind (E) = E_Function
- or else Ekind (E) = E_Generic_Function
+ if Ekind_In (E, E_Function, E_Generic_Function)
or else (Ekind (E) = E_Subprogram_Type
and then Etype (E) /= Standard_Void_Type)
then
@@ -5115,10 +5153,11 @@ package body Exp_Ch6 is
Rewrite (Allocator, New_Allocator);
-- Create a new access object and initialize it to the result of the
- -- new uninitialized allocator.
+ -- new uninitialized allocator. Note: we do not use Allocator as the
+ -- Related_Node of Return_Obj_Access in call to Make_Temporary below
+ -- as this would create a sort of infinite "recursion".
- Return_Obj_Access :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Return_Obj_Access := Make_Temporary (Loc, 'R');
Set_Etype (Return_Obj_Access, Acc_Type);
Insert_Action (Allocator,
@@ -5251,9 +5290,7 @@ package body Exp_Ch6 is
-- Create a temporary object to hold the function result
- Return_Obj_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
+ Return_Obj_Id := Make_Temporary (Loc, 'R');
Set_Etype (Return_Obj_Id, Result_Subt);
Return_Obj_Decl :=
@@ -5406,8 +5443,7 @@ package body Exp_Ch6 is
-- Create an access type designating the function's result subtype
- Ptr_Typ :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Ptr_Typ := Make_Temporary (Loc, 'A');
Ptr_Typ_Decl :=
Make_Full_Type_Declaration (Loc,
@@ -5422,7 +5458,7 @@ package body Exp_Ch6 is
-- Finally, create an access object initialized to a reference to the
-- function call.
- Obj_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Obj_Id := Make_Temporary (Loc, 'R');
Set_Etype (Obj_Id, Ptr_Typ);
Obj_Decl :=
@@ -5682,10 +5718,12 @@ package body Exp_Ch6 is
Add_Access_Actual_To_Build_In_Place_Call
(Func_Call, Function_Id, Caller_Object, Is_Access => Pass_Caller_Acc);
- -- Create an access type designating the function's result subtype
+ -- Create an access type designating the function's result subtype. We
+ -- use the type of the original expression because it may be a call to
+ -- an inherited operation, which the expansion has replaced with the
+ -- parent operation that yields the parent type.
- Ref_Type :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Ref_Type := Make_Temporary (Loc, 'A');
Ptr_Typ_Decl :=
Make_Full_Type_Declaration (Loc,
@@ -5694,7 +5732,7 @@ package body Exp_Ch6 is
Make_Access_To_Object_Definition (Loc,
All_Present => True,
Subtype_Indication =>
- New_Reference_To (Result_Subt, Loc)));
+ New_Reference_To (Etype (Function_Call), Loc)));
-- The access type and its accompanying object must be inserted after
-- the object declaration in the constrained case, so that the function
@@ -5712,15 +5750,13 @@ package body Exp_Ch6 is
-- Finally, create an access object initialized to a reference to the
-- function call.
- Def_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
- Set_Etype (Def_Id, Ref_Type);
-
New_Expr :=
Make_Reference (Loc,
Prefix => Relocate_Node (Func_Call));
+ Def_Id := Make_Temporary (Loc, 'R', New_Expr);
+ Set_Etype (Def_Id, Ref_Type);
+
Insert_After_And_Analyze (Ptr_Typ_Decl,
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
@@ -5744,8 +5780,7 @@ package body Exp_Ch6 is
Rewrite (Object_Decl,
Make_Object_Renaming_Declaration (Loc,
- Defining_Identifier => Make_Defining_Identifier (Loc,
- New_Internal_Name ('D')),
+ Defining_Identifier => Make_Temporary (Loc, 'D'),
Access_Definition => Empty,
Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc),
Name => Call_Deref));
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 880ae4e4cb9..308021472c2 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -54,7 +54,6 @@ with Sem_Ch3; use Sem_Ch3;
with Sem_Ch7; use Sem_Ch7;
with Sem_Ch8; use Sem_Ch8;
with Sem_Res; use Sem_Res;
-with Sem_SCIL; use Sem_SCIL;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Snames; use Snames;
@@ -586,9 +585,7 @@ package body Exp_Ch7 is
-- Here we generate the required loop
else
- Index :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
-
+ Index := Make_Temporary (Loc, 'J');
Append (New_Reference_To (Index, Loc), Index_List);
return New_List (
@@ -1162,7 +1159,7 @@ package body Exp_Ch7 is
and then not Sec_Stack_Needed_For_Return (Current_Scope)
and then VM_Target = No_VM
then
- Mark := Make_Defining_Identifier (Loc, New_Internal_Name ('M'));
+ Mark := Make_Temporary (Loc, 'M');
Append_To (New_Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Mark,
@@ -1785,9 +1782,7 @@ package body Exp_Ch7 is
end if;
end if;
- Id :=
- Make_Defining_Identifier (Flist_Loc,
- Chars => New_Internal_Name ('F'));
+ Id := Make_Temporary (Flist_Loc, 'F');
end;
Set_Finalization_Chain_Entity (S, Id);
@@ -3438,7 +3433,7 @@ package body Exp_Ch7 is
-- Fxxx : Finalizable_Ptr renames Lxxx.F;
if Present (Finalization_Chain_Entity (S)) then
- LC := Make_Defining_Identifier (Loc, New_Internal_Name ('L'));
+ LC := Make_Temporary (Loc, 'L');
-- Use the Sloc of the first declaration of N's containing list, to
-- maintain monotonicity of source-line stepping during debugging.
@@ -3570,15 +3565,6 @@ package body Exp_Ch7 is
Expr : constant Node_Id := Relocate_Node (N);
begin
- -- If the relocated node is a function call then check if some SCIL
- -- node references it and needs readjustment.
-
- if Generate_SCIL
- and then Nkind (N) = N_Function_Call
- then
- Adjust_SCIL_Node (N, Expr);
- end if;
-
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => E,
@@ -3626,15 +3612,6 @@ package body Exp_Ch7 is
New_Statement : constant Node_Id := Relocate_Node (N);
begin
- -- If the relocated node is a procedure call then check if some SCIL
- -- node references it and needs readjustment.
-
- if Generate_SCIL
- and then Nkind (New_Statement) = N_Procedure_Call_Statement
- then
- Adjust_SCIL_Node (N, New_Statement);
- end if;
-
Rewrite (N, Make_Transient_Block (Loc, New_Statement));
-- With the scope stack back to normal, we can call analyze on the
diff --git a/gcc/ada/exp_ch7.ads b/gcc/ada/exp_ch7.ads
index a7c5cd7ba5a..669f998c402 100644
--- a/gcc/ada/exp_ch7.ads
+++ b/gcc/ada/exp_ch7.ads
@@ -229,11 +229,11 @@ package Exp_Ch7 is
procedure Store_Before_Actions_In_Scope (L : List_Id);
-- Append the list L of actions to the end of the before-actions store in
- -- the top of the scope stack
+ -- the top of the scope stack.
procedure Store_After_Actions_In_Scope (L : List_Id);
-- Append the list L of actions to the beginning of the after-actions store
- -- in the top of the scope stack
+ -- in the top of the scope stack.
procedure Wrap_Transient_Declaration (N : Node_Id);
-- N is an object declaration. Expand the finalization calls after the
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index ac439917107..2aec546e91a 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -128,6 +128,14 @@ package body Exp_Ch9 is
-- Build a specification for a function implementing the protected entry
-- barrier of the specified entry body.
+ function Build_Corresponding_Record
+ (N : Node_Id;
+ Ctyp : Node_Id;
+ Loc : Source_Ptr) return Node_Id;
+ -- Common to tasks and protected types. Copy discriminant specifications,
+ -- build record declaration. N is the type declaration, Ctyp is the
+ -- concurrent entity (task type or protected type).
+
function Build_Entry_Count_Expression
(Concurrent_Type : Node_Id;
Component_List : List_Id;
@@ -1037,8 +1045,9 @@ package body Exp_Ch9 is
-- record is "limited tagged". It is "limited" to reflect the underlying
-- limitedness of the task or protected object that it represents, and
-- ensuring for example that it is properly passed by reference. It is
- -- "tagged" to give support to dispatching calls through interfaces (Ada
- -- 2005: AI-345)
+ -- "tagged" to give support to dispatching calls through interfaces. We
+ -- propagate here the list of interfaces covered by the concurrent type
+ -- (Ada 2005: AI-345).
return
Make_Full_Type_Declaration (Loc,
@@ -1051,6 +1060,7 @@ package body Exp_Ch9 is
Component_Items => Cdecls),
Tagged_Present =>
Ada_Version >= Ada_05 and then Is_Tagged_Type (Ctyp),
+ Interface_List => Interface_List (N),
Limited_Present => True));
end Build_Corresponding_Record;
@@ -1168,8 +1178,7 @@ package body Exp_Ch9 is
procedure Build_Entry_Family_Name (Id : Entity_Id) is
Def : constant Node_Id :=
Discrete_Subtype_Definition (Parent (Id));
- L_Id : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('L'));
+ L_Id : constant Entity_Id := Make_Temporary (Loc, 'L');
L_Stmts : constant List_Id := New_List;
Val : Node_Id;
@@ -1265,9 +1274,8 @@ package body Exp_Ch9 is
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
- Defining_Identifier => L_Id,
- Discrete_Subtype_Definition =>
- Build_Range (Def))),
+ Defining_Identifier => L_Id,
+ Discrete_Subtype_Definition => Build_Range (Def))),
Statements => L_Stmts,
End_Label => Empty));
end Build_Entry_Family_Name;
@@ -1411,7 +1419,7 @@ package body Exp_Ch9 is
return Empty;
end if;
- Index := Make_Defining_Identifier (Loc, New_Internal_Name ('I'));
+ Index := Make_Temporary (Loc, 'I');
-- Step 1: Generate the declaration of the index variable:
-- Inn : Protected_Entry_Index := 0;
@@ -1428,10 +1436,8 @@ package body Exp_Ch9 is
Append_To (B_Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Index,
- Object_Definition =>
- New_Reference_To (RTE (Index_Typ), Loc),
- Expression =>
- Make_Integer_Literal (Loc, 0)));
+ Object_Definition => New_Reference_To (RTE (Index_Typ), Loc),
+ Expression => Make_Integer_Literal (Loc, 0)));
B_Stmts := New_List;
@@ -1488,19 +1494,15 @@ package body Exp_Ch9 is
-- Generate:
-- type Ann is access all <actual-type>
- Comp_Nam :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Comp_Nam := Make_Temporary (Loc, 'A');
Append_To (Decls,
Make_Full_Type_Declaration (Loc,
- Defining_Identifier =>
- Comp_Nam,
- Type_Definition =>
+ Defining_Identifier => Comp_Nam,
+ Type_Definition =>
Make_Access_To_Object_Definition (Loc,
- All_Present =>
- True,
- Constant_Present =>
- Ekind (Formal) = E_In_Parameter,
+ All_Present => True,
+ Constant_Present => Ekind (Formal) = E_In_Parameter,
Subtype_Indication =>
New_Reference_To (Etype (Actual), Loc))));
@@ -1525,8 +1527,7 @@ package body Exp_Ch9 is
Next_Formal_With_Extras (Formal);
end loop;
- Rec_Nam :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Rec_Nam := Make_Temporary (Loc, 'P');
if Has_Comp then
@@ -2141,7 +2142,6 @@ package body Exp_Ch9 is
-- record type, so mark the spec accordingly.
if Ekind (Subp_Id) = E_Function then
-
declare
Res_Def : Node_Id;
@@ -2397,12 +2397,10 @@ package body Exp_Ch9 is
Add_Object_Pointer (Loc, Typ, Decls);
while Present (Ent) loop
-
if Ekind (Ent) = E_Entry then
Add_If_Clause (Make_Integer_Literal (Loc, 1));
elsif Ekind (Ent) = E_Entry_Family then
-
E_Typ := Etype (Discrete_Subtype_Definition (Parent (Ent)));
Hi := Convert_Discriminant_Ref (Type_High_Bound (E_Typ));
Lo := Convert_Discriminant_Ref (Type_Low_Bound (E_Typ));
@@ -3104,7 +3102,7 @@ package body Exp_Ch9 is
if Nkind (Op_Spec) = N_Function_Specification then
if Exc_Safe then
- R := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ R := Make_Temporary (Loc, 'R');
Unprot_Call :=
Make_Object_Declaration (Loc,
Defining_Identifier => R,
@@ -3115,8 +3113,10 @@ package body Exp_Ch9 is
Name => Make_Identifier (Loc,
Chars (Defining_Unit_Name (N_Op_Spec))),
Parameter_Associations => Uactuals));
- Return_Stmt := Make_Simple_Return_Statement (Loc,
- Expression => New_Reference_To (R, Loc));
+
+ Return_Stmt :=
+ Make_Simple_Return_Statement (Loc,
+ Expression => New_Reference_To (R, Loc));
else
Unprot_Call := Make_Simple_Return_Statement (Loc,
@@ -3489,8 +3489,8 @@ package body Exp_Ch9 is
and then Ada_Version >= Ada_05
then
declare
- Obj : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('F'));
+ ExpR : constant Node_Id := Relocate_Node (Concval);
+ Obj : constant Entity_Id := Make_Temporary (Loc, 'F', ExpR);
Decl : Node_Id;
begin
@@ -3498,7 +3498,7 @@ package body Exp_Ch9 is
Make_Object_Declaration (Loc,
Defining_Identifier => Obj,
Object_Definition => New_Occurrence_Of (Conctyp, Loc),
- Expression => Relocate_Node (Concval));
+ Expression => ExpR);
Set_Etype (Obj, Conctyp);
Decls := New_List (Decl);
Rewrite (Concval, New_Occurrence_Of (Obj, Loc));
@@ -3568,11 +3568,9 @@ package body Exp_Ch9 is
if Is_By_Copy_Type (Etype (Actual)) then
N_Node :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('J')),
- Aliased_Present => True,
- Object_Definition =>
+ Defining_Identifier => Make_Temporary (Loc, 'J'),
+ Aliased_Present => True,
+ Object_Definition =>
New_Reference_To (Etype (Formal), Loc));
-- Mark the object as not needing initialization since the
@@ -3683,13 +3681,12 @@ package body Exp_Ch9 is
-- Bnn : Communications_Block;
- Comm_Name :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('B'));
+ Comm_Name := Make_Temporary (Loc, 'B');
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Comm_Name,
- Object_Definition =>
+ Object_Definition =>
New_Reference_To (RTE (RE_Communication_Block), Loc)));
-- Some additional statements for protected entry calls
@@ -3941,16 +3938,13 @@ package body Exp_Ch9 is
Loc : constant Source_Ptr := Sloc (N);
Chain : constant Entity_Id :=
Make_Defining_Identifier (Loc, Name_uChain);
-
- Blkent : Entity_Id;
+ Blkent : constant Entity_Id := Make_Temporary (Loc, 'A');
Block : Node_Id;
begin
- Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
-
Block :=
Make_Block_Statement (Loc,
- Identifier => New_Reference_To (Blkent, Loc),
+ Identifier => New_Reference_To (Blkent, Loc),
Declarations => New_List (
-- _Chain : Activation_Chain;
@@ -4006,12 +4000,10 @@ package body Exp_Ch9 is
Loc : constant Source_Ptr := Sloc (N);
Chain : constant Entity_Id :=
Make_Defining_Identifier (Loc, Name_uChain);
- Blkent : Entity_Id;
+ Blkent : constant Entity_Id := Make_Temporary (Loc, 'A');
Block : Node_Id;
begin
- Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
-
Append_To (Init_Stmts,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_Activate_Tasks), Loc),
@@ -4141,9 +4133,7 @@ package body Exp_Ch9 is
Efam := First_Entity (Conctyp);
while Present (Efam) loop
if Ekind (Efam) = E_Entry_Family then
- Efam_Type :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('F'));
+ Efam_Type := Make_Temporary (Loc, 'F');
declare
Bas : Entity_Id :=
@@ -4158,9 +4148,7 @@ package body Exp_Ch9 is
(Discrete_Subtype_Definition (Parent (Efam)), Lo, Hi);
if Is_Potentially_Large_Family (Bas, Conctyp, Lo, Hi) then
- Bas :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('B'));
+ Bas := Make_Temporary (Loc, 'B');
Bas_Decl :=
Make_Subtype_Declaration (Loc,
@@ -4397,20 +4385,19 @@ package body Exp_Ch9 is
else
declare
Decl : Node_Id;
- T_Self : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ T_Self : constant Entity_Id := Make_Temporary (Loc, 'T');
T_Body : constant Node_Id :=
Parent (Corresponding_Body (Parent (Entity (N))));
begin
- Decl := Make_Object_Declaration (Loc,
- Defining_Identifier => T_Self,
- Object_Definition =>
- New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc),
- Expression =>
- Make_Function_Call (Loc,
- Name => New_Reference_To (RTE (RE_Self), Loc)));
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => T_Self,
+ Object_Definition =>
+ New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc),
+ Expression =>
+ Make_Function_Call (Loc,
+ Name => New_Reference_To (RTE (RE_Self), Loc)));
Prepend (Decl, Declarations (T_Body));
Analyze (Decl);
Set_Scope (T_Self, Entity (N));
@@ -4707,25 +4694,28 @@ package body Exp_Ch9 is
-- completes in the middle of the accept body.
if Present (Handled_Statement_Sequence (N)) then
- Lab_Id := Make_Identifier (Loc, New_Internal_Name ('L'));
- Set_Entity (Lab_Id,
- Make_Defining_Identifier (Loc, Chars (Lab_Id)));
- Lab := Make_Label (Loc, Lab_Id);
- Ldecl :=
- Make_Implicit_Label_Declaration (Loc,
- Defining_Identifier => Entity (Lab_Id),
- Label_Construct => Lab);
- Append (Lab, Statements (Handled_Statement_Sequence (N)));
-
- Lab_Id := Make_Identifier (Loc, New_Internal_Name ('L'));
- Set_Entity (Lab_Id,
- Make_Defining_Identifier (Loc, Chars (Lab_Id)));
- Lab := Make_Label (Loc, Lab_Id);
- Ldecl2 :=
- Make_Implicit_Label_Declaration (Loc,
- Defining_Identifier => Entity (Lab_Id),
- Label_Construct => Lab);
- Append (Lab, Statements (Handled_Statement_Sequence (N)));
+ declare
+ Ent : Entity_Id;
+
+ begin
+ Ent := Make_Temporary (Loc, 'L');
+ Lab_Id := New_Reference_To (Ent, Loc);
+ Lab := Make_Label (Loc, Lab_Id);
+ Ldecl :=
+ Make_Implicit_Label_Declaration (Loc,
+ Defining_Identifier => Ent,
+ Label_Construct => Lab);
+ Append (Lab, Statements (Handled_Statement_Sequence (N)));
+
+ Ent := Make_Temporary (Loc, 'L');
+ Lab_Id := New_Reference_To (Ent, Loc);
+ Lab := Make_Label (Loc, Lab_Id);
+ Ldecl2 :=
+ Make_Implicit_Label_Declaration (Loc,
+ Defining_Identifier => Ent,
+ Label_Construct => Lab);
+ Append (Lab, Statements (Handled_Statement_Sequence (N)));
+ end;
else
Ldecl := Empty;
@@ -4737,9 +4727,7 @@ package body Exp_Ch9 is
if Is_List_Member (N) then
if Present (Handled_Statement_Sequence (N)) then
- Ann :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Ann := Make_Temporary (Loc, 'A');
Adecl :=
Make_Object_Declaration (Loc,
@@ -4796,9 +4784,7 @@ package body Exp_Ch9 is
-- label for requeue expansion must be declared.
if N = Accept_Statement (Alt) then
- Ann :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
-
+ Ann := Make_Temporary (Loc, 'A');
Adecl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Ann,
@@ -4911,10 +4897,8 @@ package body Exp_Ch9 is
Comps : List_Id;
T : constant Entity_Id := Defining_Identifier (N);
D_T : constant Entity_Id := Designated_Type (T);
- D_T2 : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('D'));
- E_T : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('E'));
+ D_T2 : constant Entity_Id := Make_Temporary (Loc, 'D');
+ E_T : constant Entity_Id := Make_Temporary (Loc, 'E');
P_List : constant List_Id := Build_Protected_Spec
(N, RTE (RE_Address), D_T, False);
Decl1 : Node_Id;
@@ -4950,8 +4934,7 @@ package body Exp_Ch9 is
Comps := New_List (
Make_Component_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('P')),
+ Defining_Identifier => Make_Temporary (Loc, 'P'),
Component_Definition =>
Make_Component_Definition (Loc,
Aliased_Present => False,
@@ -4959,11 +4942,10 @@ package body Exp_Ch9 is
New_Occurrence_Of (RTE (RE_Address), Loc))),
Make_Component_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('S')),
+ Defining_Identifier => Make_Temporary (Loc, 'S'),
Component_Definition =>
Make_Component_Definition (Loc,
- Aliased_Present => False,
+ Aliased_Present => False,
Subtype_Indication => New_Occurrence_Of (D_T2, Loc))));
Decl2 :=
@@ -5291,7 +5273,7 @@ package body Exp_Ch9 is
-- Construct the block, using the declarations from the accept
-- statement if any to initialize the declarations of the block.
- Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Blkent := Make_Temporary (Loc, 'A');
Set_Ekind (Blkent, E_Block);
Set_Etype (Blkent, Standard_Void_Type);
Set_Scope (Blkent, Current_Scope);
@@ -5676,7 +5658,7 @@ package body Exp_Ch9 is
T : Entity_Id; -- Additional status flag
begin
- Blk_Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Blk_Ent := Make_Temporary (Loc, 'A');
Ecall := Triggering_Statement (Trig);
-- The arguments in the call may require dynamic allocation, and the
@@ -5717,13 +5699,11 @@ package body Exp_Ch9 is
-- Communication block processing, generate:
-- Bnn : Communication_Block;
- Bnn := Make_Defining_Identifier (Loc, New_Internal_Name ('B'));
-
+ Bnn := Make_Temporary (Loc, 'B');
Append_To (Decls,
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Bnn,
- Object_Definition =>
+ Defining_Identifier => Bnn,
+ Object_Definition =>
New_Reference_To (RTE (RE_Communication_Block), Loc)));
-- Call kind processing, generate:
@@ -5761,14 +5741,13 @@ package body Exp_Ch9 is
S := Build_S (Loc, Decls);
-- Additional status flag processing, generate:
+ -- Tnn : Boolean;
- T := Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
-
+ T := Make_Temporary (Loc, 'T');
Append_To (Decls,
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- T,
- Object_Definition =>
+ Defining_Identifier => T,
+ Object_Definition =>
New_Reference_To (Standard_Boolean, Loc)));
------------------------------
@@ -5853,9 +5832,7 @@ package body Exp_Ch9 is
-- _clean;
-- end;
- Cleanup_Block_Ent :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
-
+ Cleanup_Block_Ent := Make_Temporary (Loc, 'C');
Cleanup_Block :=
Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, Bnn);
@@ -5868,9 +5845,7 @@ package body Exp_Ch9 is
-- when Abort_Signal => Abort_Undefer;
-- end;
- Abort_Block_Ent :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
-
+ Abort_Block_Ent := Make_Temporary (Loc, 'A');
ProtE_Stmts :=
New_List (
Make_Implicit_Label_Declaration (Loc,
@@ -5985,9 +5960,7 @@ package body Exp_Ch9 is
-- _clean;
-- end;
- Cleanup_Block_Ent :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
-
+ Cleanup_Block_Ent := Make_Temporary (Loc, 'C');
Cleanup_Block :=
Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, T);
@@ -6000,13 +5973,11 @@ package body Exp_Ch9 is
-- when Abort_Signal => Abort_Undefer;
-- end;
- Abort_Block_Ent :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Abort_Block_Ent := Make_Temporary (Loc, 'A');
Append_To (TaskE_Stmts,
Make_Implicit_Label_Declaration (Loc,
- Defining_Identifier =>
- Abort_Block_Ent));
+ Defining_Identifier => Abort_Block_Ent));
Append_To (TaskE_Stmts,
Build_Abort_Block
@@ -6143,8 +6114,7 @@ package body Exp_Ch9 is
-- Add a Delay_Block object to the parameter list of the delay
-- procedure to form the parameter list of the Wait entry call.
- Dblock_Ent :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
+ Dblock_Ent := Make_Temporary (Loc, 'D');
Pdef := Entity (Name (Ecall));
@@ -7092,8 +7062,7 @@ package body Exp_Ch9 is
-- Declare new access type and then append
- Ctype :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Ctype := Make_Temporary (Loc, 'A');
Decl :=
Make_Full_Type_Declaration (Loc,
@@ -7120,8 +7089,7 @@ package body Exp_Ch9 is
-- Create the Entry_Parameter_Record declaration
- Rec_Ent :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Rec_Ent := Make_Temporary (Loc, 'P');
Decl :=
Make_Full_Type_Declaration (Loc,
@@ -7137,8 +7105,7 @@ package body Exp_Ch9 is
-- Construct and link in the corresponding access type
- Acc_Ent :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Acc_Ent := Make_Temporary (Loc, 'A');
Set_Entry_Parameters_Type (Entry_Ent, Acc_Ent);
@@ -7725,11 +7692,6 @@ package body Exp_Ch9 is
Cdecls := Component_Items (Component_List (Type_Definition (Rec_Decl)));
- -- Ada 2005 (AI-345): Propagate the attribute that contains the list
- -- of implemented interfaces.
-
- Set_Interface_List (Type_Definition (Rec_Decl), Interface_List (N));
-
Qualify_Entity_Names (N);
-- If the type has discriminants, their occurrences in the declaration
@@ -8751,8 +8713,7 @@ package body Exp_Ch9 is
function Accept_Or_Raise return List_Id is
Cond : Node_Id;
Stats : List_Id;
- J : constant Entity_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('J'));
+ J : constant Entity_Id := Make_Temporary (Loc, 'J');
begin
-- We generate the following:
@@ -9344,8 +9305,8 @@ package body Exp_Ch9 is
-- Create Duration and Delay_Mode objects used for passing a delay
-- value to RTS
- D := Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
- M := Make_Defining_Identifier (Loc, New_Internal_Name ('M'));
+ D := Make_Temporary (Loc, 'D');
+ M := Make_Temporary (Loc, 'M');
declare
Discr : Entity_Id;
@@ -9990,11 +9951,6 @@ package body Exp_Ch9 is
Rec_Decl := Build_Corresponding_Record (N, Tasktyp, Loc);
- -- Ada 2005 (AI-345): Propagate the attribute that contains the list
- -- of implemented interfaces.
-
- Set_Interface_List (Type_Definition (Rec_Decl), Interface_List (N));
-
Rec_Ent := Defining_Identifier (Rec_Decl);
Cdecls := Component_Items (Component_List
(Type_Definition (Rec_Decl)));
@@ -10579,7 +10535,7 @@ package body Exp_Ch9 is
New_List (New_Copy (Expression (D_Stat))));
end if;
- D := Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
+ D := Make_Temporary (Loc, 'D');
-- Generate:
-- D : Duration;
@@ -10591,7 +10547,7 @@ package body Exp_Ch9 is
Object_Definition =>
New_Reference_To (Standard_Duration, Loc)));
- M := Make_Defining_Identifier (Loc, New_Internal_Name ('M'));
+ M := Make_Temporary (Loc, 'M');
-- Generate:
-- M : Integer := (0 | 1 | 2);
@@ -11370,9 +11326,7 @@ package body Exp_Ch9 is
if Is_Protected then
declare
- Prot_Ent : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('R'));
+ Prot_Ent : constant Entity_Id := Make_Temporary (Loc, 'R');
Prot_Typ : RE_Id;
begin
@@ -11561,8 +11515,7 @@ package body Exp_Ch9 is
High := Replace_Bound (High);
Low := Replace_Bound (Low);
- Index_Typ :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
+ Index_Typ := Make_Temporary (Loc, 'J');
-- Generate:
-- subtype Jnn is <Etype of Index> range Low .. High;
@@ -11790,9 +11743,7 @@ package body Exp_Ch9 is
-- Interrupt_Priority).
else
- Temp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
-
+ Temp := Make_Temporary (Loc, 'R', Prio);
Append_To (L,
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
@@ -11800,7 +11751,7 @@ package body Exp_Ch9 is
New_Occurrence_Of (RTE (RE_Any_Priority), Loc),
Expression => Relocate_Node (Prio)));
- Append_To (Args, New_Occurrence_Of (Temp, Loc));
+ Append_To (Args, New_Occurrence_Of (Temp, Loc));
end if;
end;
@@ -12170,9 +12121,8 @@ package body Exp_Ch9 is
-- Master parameter. This is a reference to the _Master parameter of
-- the initialization procedure, except in the case of the pragma
- -- Restrictions (No_Task_Hierarchy) where the value is fixed to 3.
- -- See comments in System.Tasking.Initialization.Init_RTS for the
- -- value 3.
+ -- Restrictions (No_Task_Hierarchy) where the value is fixed to 3
+ -- (3 is System.Tasking.Library_Task_Level).
if Restriction_Active (No_Task_Hierarchy) = False then
Append_To (Args, Make_Identifier (Loc, Name_uMaster));
@@ -12380,8 +12330,7 @@ package body Exp_Ch9 is
-- Generate:
-- Jnn : aliased <formal-type>
- Temp_Nam :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
+ Temp_Nam := Make_Temporary (Loc, 'J');
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -12447,7 +12396,7 @@ package body Exp_Ch9 is
-- <actual2>'reference;
-- ...);
- P := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ P := Make_Temporary (Loc, 'P');
Append_To (Decls,
Make_Object_Declaration (Loc,
diff --git a/gcc/ada/exp_ch9.ads b/gcc/ada/exp_ch9.ads
index 22a27d6422e..80d870ad8a1 100644
--- a/gcc/ada/exp_ch9.ads
+++ b/gcc/ada/exp_ch9.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -50,14 +50,6 @@ package Exp_Ch9 is
-- Task_Id of the associated task as the parameter. The caller is
-- responsible for analyzing and resolving the resulting tree.
- function Build_Corresponding_Record
- (N : Node_Id;
- Ctyp : Node_Id;
- Loc : Source_Ptr) return Node_Id;
- -- Common to tasks and protected types. Copy discriminant specifications,
- -- build record declaration. N is the type declaration, Ctyp is the
- -- concurrent entity (task type or protected type).
-
function Build_Entry_Names (Conc_Typ : Entity_Id) return Node_Id;
-- Create the statements which populate the entry names array of a task or
-- protected type. The statements are wrapped inside a block due to a local
diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb
index 34ae7e2b652..610ac0e5520 100644
--- a/gcc/ada/exp_dbug.adb
+++ b/gcc/ada/exp_dbug.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2009, 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- --
@@ -38,6 +38,7 @@ with Sinfo; use Sinfo;
with Stand; use Stand;
with Stringt; use Stringt;
with Table;
+with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Urealp; use Urealp;
@@ -341,6 +342,14 @@ package body Exp_Dbug is
return Empty;
end if;
+ -- Do not output those local variables in VM case, as this does not
+ -- help debugging (they are just unused), and might lead to duplicated
+ -- local variable names.
+
+ if VM_Target /= No_VM then
+ return Empty;
+ end if;
+
-- Get renamed entity and compute suffix
Name_Len := 0;
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index b7f31c36c4a..7599a25dc73 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -31,6 +31,7 @@ with Elists; use Elists;
with Errout; use Errout;
with Exp_Atag; use Exp_Atag;
with Exp_Ch7; use Exp_Ch7;
+with Exp_CG; use Exp_CG;
with Exp_Dbug; use Exp_Dbug;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
@@ -59,6 +60,7 @@ with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
+with SCIL_LL; use SCIL_LL;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
@@ -577,8 +579,9 @@ package body Exp_Disp is
-- Local variables
- New_Node : Node_Id;
- SCIL_Node : Node_Id;
+ New_Node : Node_Id;
+ SCIL_Node : Node_Id;
+ SCIL_Related_Node : Node_Id := Call_Node;
-- Start of processing for Expand_Dispatching_Call
@@ -648,19 +651,6 @@ package body Exp_Disp is
Typ := Non_Limited_View (Typ);
end if;
- -- Generate the SCIL node for this dispatching call. The SCIL node for a
- -- dispatching call is inserted in the tree before the call is rewriten
- -- and expanded because the SCIL node must be found by the SCIL backend
- -- BEFORE the expanded nodes associated with the call node are found.
-
- if Generate_SCIL then
- SCIL_Node := Make_SCIL_Dispatching_Call (Sloc (Call_Node));
- Set_SCIL_Related_Node (SCIL_Node, Call_Node);
- Set_SCIL_Entity (SCIL_Node, Typ);
- Set_SCIL_Target_Prim (SCIL_Node, Subp);
- Insert_Action (Call_Node, SCIL_Node);
- end if;
-
if not Is_Limited_Type (Typ) then
Eq_Prim_Op := Find_Prim_Op (Typ, Name_Op_Eq);
end if;
@@ -840,12 +830,16 @@ package body Exp_Disp is
New_Call_Name :=
Unchecked_Convert_To (Subp_Ptr_Typ, New_Node);
- -- Complete decoration of SCIL dispatching node. It must be done after
- -- the new call name is built to reference the nodes that will see the
- -- SCIL backend (because Build_Get_Prim_Op_Address generates an
- -- unchecked type conversion which relocates the controlling tag node).
+ -- Generate the SCIL node for this dispatching call. Done now because
+ -- attribute SCIL_Controlling_Tag must be set after the new call name
+ -- is built to reference the nodes that will see the SCIL backend
+ -- (because Build_Get_Prim_Op_Address generates an unchecked type
+ -- conversion which relocates the controlling tag node).
if Generate_SCIL then
+ SCIL_Node := Make_SCIL_Dispatching_Call (Sloc (Call_Node));
+ Set_SCIL_Entity (SCIL_Node, Typ);
+ Set_SCIL_Target_Prim (SCIL_Node, Subp);
-- Common case: the controlling tag is the tag of an object
-- (for example, obj.tag)
@@ -943,6 +937,8 @@ package body Exp_Disp is
New_Reference_To
(First_Tag_Component (Typ), Loc))),
Right_Opnd => New_Call);
+
+ SCIL_Related_Node := Right_Opnd (New_Call);
end if;
else
@@ -952,8 +948,18 @@ package body Exp_Disp is
Parameter_Associations => New_Params);
end if;
+ -- Register the dispatching call in the call graph nodes table
+
+ Register_CG_Node (Call_Node);
+
Rewrite (Call_Node, New_Call);
+ -- Associate the SCIL node of this dispatching call
+
+ if Generate_SCIL then
+ Set_SCIL_Node (SCIL_Related_Node, SCIL_Node);
+ end if;
+
-- Suppress all checks during the analysis of the expanded code
-- to avoid the generation of spurious warnings under ZFP run-time.
@@ -1148,8 +1154,7 @@ package body Exp_Disp is
New_Typ_Decl :=
Make_Full_Type_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('T')),
+ Defining_Identifier => Make_Temporary (Loc, 'T'),
Type_Definition =>
Make_Access_To_Object_Definition (Loc,
All_Present => True,
@@ -1190,10 +1195,7 @@ package body Exp_Disp is
Else_Statements => Stats));
end if;
- Fent :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('F'));
-
+ Fent := Make_Temporary (Loc, 'F');
Func :=
Make_Subprogram_Body (Loc,
Specification =>
@@ -1464,10 +1466,15 @@ package body Exp_Disp is
Thunk_Id := Empty;
Thunk_Code := Empty;
+ -- No thunk needed if the primitive has been eliminated
+
+ if Is_Eliminated (Ultimate_Alias (Prim)) then
+ return;
+
-- In case of primitives that are functions without formals and a
-- controlling result there is no need to build the thunk.
- if not Present (First_Formal (Target)) then
+ elsif not Present (First_Formal (Target)) then
pragma Assert (Ekind (Target) = E_Function
and then Has_Controlling_Result (Target));
return;
@@ -1528,16 +1535,22 @@ package body Exp_Disp is
Formal := First (Formals);
while Present (Formal) loop
- -- Handle concurrent types
+ -- If the parent is a constrained discriminated type, then the
+ -- primitive operation will have been defined on a first subtype.
+ -- For proper matching with controlling type, use base type.
if Ekind (Target_Formal) = E_In_Parameter
and then Ekind (Etype (Target_Formal)) = E_Anonymous_Access_Type
then
- Ftyp := Directly_Designated_Type (Etype (Target_Formal));
+ Ftyp :=
+ Base_Type (Directly_Designated_Type (Etype (Target_Formal)));
else
- Ftyp := Etype (Target_Formal);
+ Ftyp := Base_Type (Etype (Target_Formal));
end if;
+ -- For concurrent types, the relevant information is found in the
+ -- Corresponding_Record_Type, rather than the type entity itself.
+
if Is_Concurrent_Type (Ftyp) then
Ftyp := Corresponding_Record_Type (Ftyp);
end if;
@@ -1553,9 +1566,7 @@ package body Exp_Disp is
Decl_2 :=
Make_Full_Type_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('T')),
+ Defining_Identifier => Make_Temporary (Loc, 'T'),
Type_Definition =>
Make_Access_To_Object_Definition (Loc,
All_Present => True,
@@ -1580,9 +1591,7 @@ package body Exp_Disp is
Decl_1 :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S')),
+ Defining_Identifier => Make_Temporary (Loc, 'S'),
Constant_Present => True,
Object_Definition =>
New_Reference_To (RTE (RE_Storage_Offset), Loc),
@@ -1632,8 +1641,7 @@ package body Exp_Disp is
Decl_1 :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('S')),
+ Defining_Identifier => Make_Temporary (Loc, 'S'),
Constant_Present => True,
Object_Definition =>
New_Reference_To (RTE (RE_Storage_Offset), Loc),
@@ -1652,11 +1660,11 @@ package body Exp_Disp is
Decl_2 :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('S')),
- Constant_Present => True,
- Object_Definition => New_Reference_To (RTE (RE_Addr_Ptr), Loc),
- Expression =>
+ Defining_Identifier => Make_Temporary (Loc, 'S'),
+ Constant_Present => True,
+ Object_Definition =>
+ New_Reference_To (RTE (RE_Addr_Ptr), Loc),
+ Expression =>
Unchecked_Convert_To
(RTE (RE_Addr_Ptr),
New_Reference_To (Defining_Identifier (Decl_1), Loc)));
@@ -1664,7 +1672,7 @@ package body Exp_Disp is
Append_To (Decl, Decl_1);
Append_To (Decl, Decl_2);
- -- Reference the new actual. Generate:
+ -- Reference the new actual, generate:
-- Target_Formal (S2.all)
Append_To (Actuals,
@@ -1683,10 +1691,7 @@ package body Exp_Disp is
Next (Formal);
end loop;
- Thunk_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
-
+ Thunk_Id := Make_Temporary (Loc, 'T');
Set_Is_Thunk (Thunk_Id);
-- Procedure case
@@ -1769,7 +1774,7 @@ package body Exp_Disp is
or else TSS_Name = TSS_Stream_Output
or else
(Chars (E) = Name_Op_Eq
- and then Etype (First_Entity (E)) = Etype (Last_Entity (E)))
+ and then Etype (First_Formal (E)) = Etype (Last_Formal (E)))
or else Chars (E) = Name_uAssign
or else TSS_Name = TSS_Deep_Adjust
or else TSS_Name = TSS_Deep_Finalize
@@ -1811,7 +1816,7 @@ package body Exp_Disp is
or else Chars (E) = Name_uAlignment
or else
(Chars (E) = Name_Op_Eq
- and then Etype (First_Entity (E)) = Etype (Last_Entity (E)))
+ and then Etype (First_Formal (E)) = Etype (Last_Formal (E)))
or else Chars (E) = Name_uAssign
or else TSS_Name = TSS_Deep_Adjust
or else TSS_Name = TSS_Deep_Finalize
@@ -1830,23 +1835,10 @@ package body Exp_Disp is
function Is_Predefined_Dispatching_Alias (Prim : Entity_Id) return Boolean
is
- E : Entity_Id;
-
begin
- if not Is_Predefined_Dispatching_Operation (Prim)
+ return not Is_Predefined_Dispatching_Operation (Prim)
and then Present (Alias (Prim))
- then
- E := Prim;
- while Present (Alias (E)) loop
- E := Alias (E);
- end loop;
-
- if Is_Predefined_Dispatching_Operation (E) then
- return True;
- end if;
- end if;
-
- return False;
+ and then Is_Predefined_Dispatching_Operation (Ultimate_Alias (Prim));
end Is_Predefined_Dispatching_Alias;
---------------------------------------
@@ -1985,9 +1977,7 @@ package body Exp_Disp is
-- Generate:
-- Bnn : Communication_Block;
- Com_Block :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('B'));
-
+ Com_Block := Make_Temporary (Loc, 'B');
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier =>
@@ -2338,8 +2328,7 @@ package body Exp_Disp is
-- where Bnn is the name of the communication block used in the
-- call to Protected_Entry_Call.
- Blk_Nam := Make_Defining_Identifier (Loc, New_Internal_Name ('B'));
-
+ Blk_Nam := Make_Temporary (Loc, 'B');
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier =>
@@ -3584,13 +3573,8 @@ package body Exp_Disp is
Exporting_Table : constant Boolean :=
Building_Static_DT (Typ)
and then Suffix_Index > 0;
- Iface_DT : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
- Name_Predef_Prims : constant Name_Id := New_Internal_Name ('R');
- Predef_Prims : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => Name_Predef_Prims);
+ Iface_DT : constant Entity_Id := Make_Temporary (Loc, 'T');
+ Predef_Prims : constant Entity_Id := Make_Temporary (Loc, 'R');
DT_Constr_List : List_Id;
DT_Aggr_List : List_Id;
Empty_DT : Boolean := False;
@@ -3689,6 +3673,7 @@ package body Exp_Disp is
if Is_Predefined_Dispatching_Operation (Prim)
and then not Is_Abstract_Subprogram (Prim)
+ and then not Is_Eliminated (Prim)
and then not Present (Prim_Table
(UI_To_Int (DT_Position (Prim))))
then
@@ -3697,11 +3682,8 @@ package body Exp_Disp is
Alias (Prim);
else
- while Present (Alias (Prim)) loop
- Prim := Alias (Prim);
- end loop;
-
- Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code);
+ Expand_Interface_Thunk
+ (Ultimate_Alias (Prim), Thunk_Id, Thunk_Code);
if Present (Thunk_Id) then
Append_To (Result, Thunk_Code);
@@ -3739,10 +3721,8 @@ package body Exp_Disp is
Decl :=
Make_Subtype_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S')),
- Subtype_Indication =>
+ Defining_Identifier => Make_Temporary (Loc, 'S'),
+ Subtype_Indication =>
New_Reference_To (RTE (RE_Address_Array), Loc));
Append_To (Result, Decl);
@@ -3870,12 +3850,7 @@ package body Exp_Disp is
(Interface_Alias (Prim)) = Iface
then
Prim_Alias := Interface_Alias (Prim);
-
- E := Prim;
- while Present (Alias (E)) loop
- E := Alias (E);
- end loop;
-
+ E := Ultimate_Alias (Prim);
Pos := UI_To_Int (DT_Position (Prim_Alias));
if Present (Prim_Table (Pos)) then
@@ -3903,7 +3878,7 @@ package body Exp_Disp is
pragma Assert (Count = Nb_Prim);
end;
- OSD := Make_Defining_Identifier (Loc, New_Internal_Name ('I'));
+ OSD := Make_Temporary (Loc, 'I');
Append_To (Result,
Make_Object_Declaration (Loc,
@@ -3916,21 +3891,23 @@ package body Exp_Disp is
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => New_List (
Make_Integer_Literal (Loc, Nb_Prim)))),
- Expression => Make_Aggregate (Loc,
- Component_Associations => New_List (
- Make_Component_Association (Loc,
- Choices => New_List (
- New_Occurrence_Of
- (RTE_Record_Component (RE_OSD_Num_Prims), Loc)),
- Expression =>
- Make_Integer_Literal (Loc, Nb_Prim)),
- Make_Component_Association (Loc,
- Choices => New_List (
- New_Occurrence_Of
- (RTE_Record_Component (RE_OSD_Table), Loc)),
- Expression => Make_Aggregate (Loc,
- Component_Associations => OSD_Aggr_List))))));
+ Expression =>
+ Make_Aggregate (Loc,
+ Component_Associations => New_List (
+ Make_Component_Association (Loc,
+ Choices => New_List (
+ New_Occurrence_Of
+ (RTE_Record_Component (RE_OSD_Num_Prims), Loc)),
+ Expression =>
+ Make_Integer_Literal (Loc, Nb_Prim)),
+
+ Make_Component_Association (Loc,
+ Choices => New_List (
+ New_Occurrence_Of
+ (RTE_Record_Component (RE_OSD_Table), Loc)),
+ Expression => Make_Aggregate (Loc,
+ Component_Associations => OSD_Aggr_List))))));
Append_To (Result,
Make_Attribute_Definition_Clause (Loc,
@@ -3979,10 +3956,14 @@ package body Exp_Disp is
while Present (Prim_Elmt) loop
Prim := Node (Prim_Elmt);
+ -- Do not reference predefined primitives because they
+ -- are located in a separate dispatch table; skip also
+ -- abstract and eliminated primitives.
+
if not Is_Predefined_Dispatching_Operation (Prim)
and then Present (Interface_Alias (Prim))
and then not Is_Abstract_Subprogram (Alias (Prim))
- and then not Is_Imported (Alias (Prim))
+ and then not Is_Eliminated (Alias (Prim))
and then Find_Dispatching_Type
(Interface_Alias (Prim)) = Iface
@@ -4395,17 +4376,6 @@ package body Exp_Disp is
New_Reference_To
(RTE (RE_No_Dispatch_Table_Wrapper), Loc)));
- -- Generate a SCIL node for the previous object declaration
- -- because it has a null dispatch table.
-
- if Generate_SCIL then
- New_Node :=
- Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
- Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
- end if;
-
Append_To (Result,
Make_Attribute_Definition_Clause (Loc,
Name => New_Reference_To (DT, Loc),
@@ -4438,9 +4408,8 @@ package body Exp_Disp is
if Generate_SCIL then
New_Node :=
Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
+ Set_SCIL_Node (Last (Result), New_Node);
end if;
-- Generate:
@@ -4472,17 +4441,6 @@ package body Exp_Disp is
Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => DT_Constr_List))));
- -- Generate the SCIL node for the previous object declaration
- -- because it contains a dispatch table.
-
- if Generate_SCIL then
- New_Node :=
- Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
- Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
- end if;
-
Append_To (Result,
Make_Attribute_Definition_Clause (Loc,
Name => New_Reference_To (DT, Loc),
@@ -4515,9 +4473,8 @@ package body Exp_Disp is
if Generate_SCIL then
New_Node :=
Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
+ Set_SCIL_Node (Last (Result), New_Node);
end if;
Append_To (Result,
@@ -4902,9 +4859,14 @@ package body Exp_Disp is
-- Size_Func
if RTE_Record_Component_Available (RE_Size_Func) then
- if not Building_Static_DT (Typ)
- or else Is_Interface (Typ)
- then
+
+ -- Initialize this field to Null_Address if we are not building
+ -- static dispatch tables static or if the size function is not
+ -- available. In the former case we cannot initialize this field
+ -- until the function is frozen and registered in the dispatch
+ -- table (see Register_Primitive).
+
+ if not Building_Static_DT (Typ) or else not Has_DT (Typ) then
Append_To (TSD_Aggr_List,
Unchecked_Convert_To (RTE (RE_Size_Ptr),
New_Reference_To (RTE (RE_Null_Address), Loc)));
@@ -4920,9 +4882,7 @@ package body Exp_Disp is
Prim := Node (Prim_Elmt);
if Chars (Prim) = Name_uSize then
- while Present (Alias (Prim)) loop
- Prim := Alias (Prim);
- end loop;
+ Prim := Ultimate_Alias (Prim);
if Is_Abstract_Subprogram (Prim) then
Append_To (TSD_Aggr_List,
@@ -5287,17 +5247,6 @@ package body Exp_Disp is
Expression => Make_Aggregate (Loc,
Expressions => DT_Aggr_List)));
- -- Generate the SCIL node for the previous object declaration
- -- because it has a null dispatch table.
-
- if Generate_SCIL then
- New_Node :=
- Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
- Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
- end if;
-
Append_To (Result,
Make_Attribute_Definition_Clause (Loc,
Name => New_Reference_To (DT, Loc),
@@ -5379,14 +5328,11 @@ package body Exp_Disp is
if Is_Predefined_Dispatching_Operation (Prim)
and then not Is_Abstract_Subprogram (Prim)
+ and then not Is_Eliminated (Prim)
and then not Present (Prim_Table
(UI_To_Int (DT_Position (Prim))))
then
- E := Prim;
- while Present (Alias (E)) loop
- E := Alias (E);
- end loop;
-
+ E := Ultimate_Alias (Prim);
pragma Assert (not Is_Abstract_Subprogram (E));
Prim_Table (UI_To_Int (DT_Position (Prim))) := E;
end if;
@@ -5415,10 +5361,8 @@ package body Exp_Disp is
Decl :=
Make_Subtype_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S')),
- Subtype_Indication =>
+ Defining_Identifier => Make_Temporary (Loc, 'S'),
+ Subtype_Indication =>
New_Reference_To (RTE (RE_Address_Array), Loc));
Append_To (Result, Decl);
@@ -5527,23 +5471,22 @@ package body Exp_Disp is
E := Ultimate_Alias (Prim);
- if Is_Imported (Prim)
- or else Present (Interface_Alias (Prim))
- or else Is_Predefined_Dispatching_Operation (Prim)
- or else Is_Eliminated (E)
- then
- null;
+ -- Do not reference predefined primitives because they are
+ -- located in a separate dispatch table; skip entities with
+ -- attribute Interface_Alias because they are only required
+ -- to build secondary dispatch tables; skip also abstract
+ -- and eliminated primitives.
- else
- if not Is_Predefined_Dispatching_Operation (E)
- and then not Is_Abstract_Subprogram (E)
- and then not Present (Interface_Alias (E))
- then
- pragma Assert
- (UI_To_Int (DT_Position (Prim)) <= Nb_Prim);
+ if not Is_Predefined_Dispatching_Operation (Prim)
+ and then not Is_Predefined_Dispatching_Operation (E)
+ and then not Present (Interface_Alias (Prim))
+ and then not Is_Abstract_Subprogram (E)
+ and then not Is_Eliminated (E)
+ then
+ pragma Assert
+ (UI_To_Int (DT_Position (Prim)) <= Nb_Prim);
- Prim_Table (UI_To_Int (DT_Position (Prim))) := E;
- end if;
+ Prim_Table (UI_To_Int (DT_Position (Prim))) := E;
end if;
Next_Elmt (Prim_Elmt);
@@ -5604,17 +5547,6 @@ package body Exp_Disp is
Expression => Make_Aggregate (Loc,
Expressions => DT_Aggr_List)));
- -- Generate the SCIL node for the previous object declaration
- -- because it contains a dispatch table.
-
- if Generate_SCIL then
- New_Node :=
- Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
- Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
- end if;
-
Append_To (Result,
Make_Attribute_Definition_Clause (Loc,
Name => New_Reference_To (DT, Loc),
@@ -5944,7 +5876,7 @@ package body Exp_Disp is
-- Mark entities containing dispatch tables. Required by the backend to
-- handle them properly.
- if not Is_Interface (Typ) then
+ if Has_DT (Typ) then
declare
Elmt : Elmt_Id;
@@ -5976,6 +5908,10 @@ package body Exp_Disp is
end;
end if;
+ -- Register the tagged type in the call graph nodes table
+
+ Register_CG_Node (Typ);
+
return Result;
end Make_DT;
@@ -6083,6 +6019,9 @@ package body Exp_Disp is
-- Look for primitive overriding an abstract interface subprogram
if Present (Interface_Alias (Prim))
+ and then not
+ Is_Ancestor
+ (Find_Dispatching_Type (Interface_Alias (Prim)), Typ)
and then not Examined (UI_To_Int (DT_Position (Alias (Prim))))
then
Prim_Pos := DT_Position (Alias (Prim));
@@ -6103,10 +6042,7 @@ package body Exp_Disp is
-- Retrieve the root of the alias chain
- Prim_Als := Prim;
- while Present (Alias (Prim_Als)) loop
- Prim_Als := Alias (Prim_Als);
- end loop;
+ Prim_Als := Ultimate_Alias (Prim);
-- In the case of an entry wrapper, set the entry index
@@ -6312,9 +6248,8 @@ package body Exp_Disp is
if Generate_SCIL then
New_Node :=
Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
+ Set_SCIL_Node (Last (Result), New_Node);
end if;
Append_To (Result,
@@ -6351,17 +6286,6 @@ package body Exp_Disp is
New_Occurrence_Of
(RTE_Record_Component (RE_NDT_Prims_Ptr), Loc)),
Attribute_Name => Name_Address))));
-
- -- Generate the SCIL node for the previous object declaration
- -- because it has a tag initialization.
-
- if Generate_SCIL then
- New_Node :=
- Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result)));
- Set_SCIL_Related_Node (New_Node, Last (Result));
- Set_SCIL_Entity (New_Node, Typ);
- Insert_Before (Last (Result), New_Node);
- end if;
end if;
Set_Is_True_Constant (DT_Ptr);
@@ -6638,10 +6562,7 @@ package body Exp_Disp is
begin
-- Retrieve the original primitive operation
- Prim_Op := Prim;
- while Present (Alias (Prim_Op)) loop
- Prim_Op := Alias (Prim_Op);
- end loop;
+ Prim_Op := Ultimate_Alias (Prim);
if Ekind (Typ) = E_Record_Type
and then Present (Corresponding_Concurrent_Type (Typ))
@@ -6739,7 +6660,11 @@ package body Exp_Disp is
begin
pragma Assert (not Restriction_Active (No_Dispatching_Calls));
- if not RTE_Available (RE_Tag) then
+ -- Do not register in the dispatch table eliminated primitives
+
+ if not RTE_Available (RE_Tag)
+ or else Is_Eliminated (Ultimate_Alias (Prim))
+ then
return L;
end if;
@@ -6804,6 +6729,13 @@ package body Exp_Disp is
pragma Assert (Is_Interface (Iface_Typ));
+ -- No action needed for interfaces that are ancestors of Typ because
+ -- their primitives are located in the primary dispatch table.
+
+ if Is_Ancestor (Iface_Typ, Tag_Typ) then
+ return L;
+ end if;
+
Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code);
if not Is_Ancestor (Iface_Typ, Tag_Typ)
@@ -7157,12 +7089,8 @@ package body Exp_Disp is
Set_DT_Position (Prim, Default_Prim_Op_Position (Prim));
elsif Is_Predefined_Dispatching_Alias (Prim) then
- E := Alias (Prim);
- while Present (Alias (E)) loop
- E := Alias (E);
- end loop;
-
- Set_DT_Position (Prim, Default_Prim_Op_Position (E));
+ Set_DT_Position (Prim,
+ Default_Prim_Op_Position (Ultimate_Alias (Prim)));
-- Overriding primitives of ancestor abstract interfaces
@@ -7204,7 +7132,7 @@ package body Exp_Disp is
Next_Elmt (Prim_Elmt);
end loop;
- -- Third stage: Fix the position of all the new primitives
+ -- Third stage: Fix the position of all the new primitives.
-- Entries associated with primitives covering interfaces
-- are handled in a latter round.
@@ -7324,11 +7252,11 @@ package body Exp_Disp is
Adjusted := True;
end if;
- -- An abstract operation cannot be declared in the private part
- -- for a visible abstract type, because it could never be over-
- -- ridden. For explicit declarations this is checked at the
- -- point of declaration, but for inherited operations it must
- -- be done when building the dispatch table.
+ -- An abstract operation cannot be declared in the private part for a
+ -- visible abstract type, because it can't be overridden outside this
+ -- package hierarchy. For explicit declarations this is checked at
+ -- the point of declaration, but for inherited operations it must be
+ -- done when building the dispatch table.
-- Ada 2005 (AI-251): Primitives associated with interfaces are
-- excluded from this check because interfaces must be visible in
@@ -7592,6 +7520,17 @@ package body Exp_Disp is
Write_Str ("(predefined) ");
end if;
+ -- Prefix the name of the primitive with its corresponding tagged
+ -- type to facilitate seeing inherited primitives.
+
+ if Present (Alias (Prim)) then
+ Write_Name
+ (Chars (Find_Dispatching_Type (Ultimate_Alias (Prim))));
+ else
+ Write_Name (Chars (Typ));
+ end if;
+
+ Write_Str (".");
Write_Name (Chars (Prim));
-- Indicate if this primitive has an aliased primitive
diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb
index 6a653654800..5817d7ac73e 100644
--- a/gcc/ada/exp_dist.adb
+++ b/gcc/ada/exp_dist.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -975,10 +975,10 @@ package body Exp_Dist is
Defining_Unit_Name (Specification (Current_Declaration))),
Asynchronous =>
Nkind (Specification (Current_Declaration)) =
- N_Procedure_Specification
- and then
- Is_Asynchronous (Defining_Unit_Name (Specification
- (Current_Declaration))));
+ N_Procedure_Specification
+ and then
+ Is_Asynchronous (Defining_Unit_Name (Specification
+ (Current_Declaration))));
Append_To (Decls, Subp_Stubs);
Analyze (Subp_Stubs);
@@ -1293,9 +1293,7 @@ package body Exp_Dist is
end if;
if not Is_RAS then
- RPC_Receiver :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ RPC_Receiver := Make_Temporary (Loc, 'P');
Specific_Build_RPC_Receiver_Body
(RPC_Receiver => RPC_Receiver,
@@ -1348,13 +1346,7 @@ package body Exp_Dist is
-- primitive may have been inherited, go back the alias chain
-- until the real primitive has been found.
- Current_Primitive_Alias := Current_Primitive;
- while Present (Alias (Current_Primitive_Alias)) loop
- pragma Assert
- (Current_Primitive_Alias
- /= Alias (Current_Primitive_Alias));
- Current_Primitive_Alias := Alias (Current_Primitive_Alias);
- end loop;
+ Current_Primitive_Alias := Ultimate_Alias (Current_Primitive);
-- Copy the spec from the original declaration for the purpose
-- of declaring an overriding subprogram: we need to replace
@@ -1529,9 +1521,7 @@ package body Exp_Dist is
Param_Assoc : constant List_Id := New_List;
Stmts : constant List_Id := New_List;
- RAS_Parameter : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ RAS_Parameter : constant Entity_Id := Make_Temporary (Loc, 'P');
Is_Function : constant Boolean :=
Nkind (Type_Def) = N_Access_Function_Definition;
@@ -1897,8 +1887,7 @@ package body Exp_Dist is
end if;
Existing := False;
- Stub_Type :=
- Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('S'));
+ Stub_Type := Make_Temporary (Loc, 'S');
Set_Ekind (Stub_Type, E_Record_Type);
Set_Is_RACW_Stub_Type (Stub_Type);
Stub_Type_Access :=
@@ -2058,8 +2047,8 @@ package body Exp_Dist is
declare
Constant_Object : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('P'));
+ Make_Temporary (Loc, 'P');
+
begin
Set_Defining_Identifier
(Last (Decls), Constant_Object);
@@ -2429,9 +2418,10 @@ package body Exp_Dist is
-- Start of processing for Build_Subprogram_Calling_Stubs
begin
- Subp_Spec := Copy_Specification (Loc,
- Spec => Specification (Vis_Decl),
- New_Name => New_Name);
+ Subp_Spec :=
+ Copy_Specification (Loc,
+ Spec => Specification (Vis_Decl),
+ New_Name => New_Name);
if Locator = Empty then
RCI_Locator := RCI_Cache;
@@ -3019,9 +3009,7 @@ package body Exp_Dist is
Remote_Statements : List_Id;
-- Various parts of the procedure
- Pnam : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, New_Internal_Name ('R'));
+ Pnam : constant Entity_Id := Make_Temporary (Loc, 'R');
Asynchronous_Flag : constant Entity_Id :=
Asynchronous_Flags_Table.Get (RACW_Type);
pragma Assert (Present (Asynchronous_Flag));
@@ -3063,16 +3051,11 @@ package body Exp_Dist is
-- Prepare local identifiers
- Source_Partition :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
- Source_Receiver :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
- Source_Address :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
- Local_Stub :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('L'));
- Stubbed_Result :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
+ Source_Partition := Make_Temporary (Loc, 'P');
+ Source_Receiver := Make_Temporary (Loc, 'S');
+ Source_Address := Make_Temporary (Loc, 'P');
+ Local_Stub := Make_Temporary (Loc, 'L');
+ Stubbed_Result := Make_Temporary (Loc, 'S');
-- Generate object declarations
@@ -3274,8 +3257,7 @@ package body Exp_Dist is
Remote_Statements : List_Id;
Null_Statements : List_Id;
- Pnam : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Pnam : constant Entity_Id := Make_Temporary (Loc, 'R');
begin
Build_Stream_Procedure
@@ -3455,25 +3437,16 @@ package body Exp_Dist is
Proc_Decls : List_Id;
Proc_Statements : List_Id;
- Origin : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Origin : constant Entity_Id := Make_Temporary (Loc, 'P');
-- Additional local variables for the local case
- Proxy_Addr : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Proxy_Addr : constant Entity_Id := Make_Temporary (Loc, 'P');
-- Additional local variables for the remote case
- Local_Stub : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
-
- Stub_Ptr : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Local_Stub : constant Entity_Id := Make_Temporary (Loc, 'L');
+ Stub_Ptr : constant Entity_Id := Make_Temporary (Loc, 'S');
function Set_Field
(Field_Name : Name_Id;
@@ -3699,18 +3672,15 @@ package body Exp_Dist is
Request_Parameter : Node_Id;
Pkg_RPC_Receiver : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('H'));
+ Make_Temporary (Loc, 'H');
Pkg_RPC_Receiver_Statements : List_Id;
Pkg_RPC_Receiver_Cases : constant List_Id := New_List;
Pkg_RPC_Receiver_Body : Node_Id;
-- A Pkg_RPC_Receiver is built to decode the request
- Lookup_RAS_Info : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
- -- A remote subprogram is created to allow peers to look up
- -- RAS information using subprogram ids.
+ Lookup_RAS_Info : constant Entity_Id := Make_Temporary (Loc, 'R');
+ -- A remote subprogram is created to allow peers to look up RAS
+ -- information using subprogram ids.
Subp_Id : Entity_Id;
Subp_Index : Entity_Id;
@@ -3720,11 +3690,8 @@ package body Exp_Dist is
Current_Subprogram_Number : Int := First_RCI_Subprogram_Id;
Current_Stubs : Node_Id;
- Subp_Info_Array : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('I'));
-
- Subp_Info_List : constant List_Id := New_List;
+ Subp_Info_Array : constant Entity_Id := Make_Temporary (Loc, 'I');
+ Subp_Info_List : constant List_Id := New_List;
Register_Pkg_Actuals : constant List_Id := New_List;
@@ -4165,8 +4132,7 @@ package body Exp_Dist is
-- well as the declaration of Result. For a function call, 'Input is
-- always used to read the result even if it is constrained.
- Stream_Parameter :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
+ Stream_Parameter := Make_Temporary (Loc, 'S');
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -4182,8 +4148,7 @@ package body Exp_Dist is
New_List (Make_Integer_Literal (Loc, 0))))));
if not Is_Known_Asynchronous then
- Result_Parameter :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Result_Parameter := Make_Temporary (Loc, 'R');
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -4198,8 +4163,7 @@ package body Exp_Dist is
Constraints =>
New_List (Make_Integer_Literal (Loc, 0))))));
- Exception_Return_Parameter :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ Exception_Return_Parameter := Make_Temporary (Loc, 'E');
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -4318,8 +4282,7 @@ package body Exp_Dist is
-- type and push it in the stream after the regular
-- parameters.
- Extra_Parameter := Make_Defining_Identifier
- (Loc, New_Internal_Name ('P'));
+ Extra_Parameter := Make_Temporary (Loc, 'P');
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -4556,7 +4519,7 @@ package body Exp_Dist is
(RPC_Receiver => RPC_Receiver,
Request_Parameter => Request);
- Subp_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Subp_Id := Make_Temporary (Loc, 'P');
Subp_Index := Subp_Id;
-- Subp_Id may not be a constant, because in the case of the RPC
@@ -4600,9 +4563,10 @@ package body Exp_Dist is
Controlling_Parameter : Entity_Id) return RPC_Target
is
Target_Info : RPC_Target (PCS_Kind => Name_GARLIC_DSA);
+
begin
- Target_Info.Partition :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Target_Info.Partition := Make_Temporary (Loc, 'P');
+
if Present (Controlling_Parameter) then
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -4707,10 +4671,9 @@ package body Exp_Dist is
begin
RPC_Receiver_Decl :=
Make_Subprogram_Declaration (Loc,
- Build_RPC_Receiver_Specification (
- RPC_Receiver => Make_Defining_Identifier (Loc,
- New_Internal_Name ('R')),
- Request_Parameter => RPC_Receiver_Request));
+ Build_RPC_Receiver_Specification
+ (RPC_Receiver => Make_Temporary (Loc, 'R'),
+ Request_Parameter => RPC_Receiver_Request));
end;
end if;
end Build_Stub_Type;
@@ -4729,9 +4692,7 @@ package body Exp_Dist is
is
Loc : constant Source_Ptr := Sloc (Vis_Decl);
- Request_Parameter : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('R'));
+ Request_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R');
-- Formal parameter for receiving stubs: a descriptor for an incoming
-- request.
@@ -4784,8 +4745,7 @@ package body Exp_Dist is
end if;
if Dynamically_Asynchronous then
- Dynamic_Async :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
+ Dynamic_Async := Make_Temporary (Loc, 'S');
else
Dynamic_Async := Empty;
end if;
@@ -4830,9 +4790,7 @@ package body Exp_Dist is
Need_Extra_Constrained : Boolean;
-- True when an Extra_Constrained actual is required
- Object : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('P'));
+ Object : constant Entity_Id := Make_Temporary (Loc, 'P');
Expr : Node_Id := Empty;
@@ -5051,9 +5009,8 @@ package body Exp_Dist is
declare
Etyp : constant Entity_Id :=
Etype (Result_Definition (Specification (Vis_Decl)));
- Result : constant Node_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('R'));
+ Result : constant Node_Id := Make_Temporary (Loc, 'R');
+
begin
Inner_Decls := New_List (
Make_Object_Declaration (Loc,
@@ -5139,8 +5096,7 @@ package body Exp_Dist is
-- exception occurrence is copied into the output stream and
-- no other output parameter is written.
- Excep_Choice :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ Excep_Choice := Make_Temporary (Loc, 'E');
Excep_Code := New_List (
Make_Attribute_Reference (Loc,
@@ -5171,8 +5127,7 @@ package body Exp_Dist is
Subp_Spec :=
Make_Procedure_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('F')),
+ Defining_Unit_Name => Make_Temporary (Loc, 'F'),
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
@@ -5308,10 +5263,10 @@ package body Exp_Dist is
begin
return
Make_Subprogram_Body (Loc,
- Specification => Make_Function_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('S')),
- Result_Definition => New_Occurrence_Of (Var_Type, Loc)),
+ Specification =>
+ Make_Function_Specification (Loc,
+ Defining_Unit_Name => Make_Temporary (Loc, 'S'),
+ Result_Definition => New_Occurrence_Of (Var_Type, Loc)),
Declarations => No_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc, New_List (
@@ -5394,8 +5349,7 @@ package body Exp_Dist is
--------------------
function Make_Tag_Check (Loc : Source_Ptr; N : Node_Id) return Node_Id is
- Occ : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ Occ : constant Entity_Id := Make_Temporary (Loc, 'E');
begin
return Make_Block_Statement (Loc,
@@ -5762,8 +5716,7 @@ package body Exp_Dist is
Make_Defining_Identifier (Loc, Name_R);
-- Various parts of the procedure
- Pnam : constant Entity_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('R'));
+ Pnam : constant Entity_Id := Make_Temporary (Loc, 'R');
Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type);
@@ -5882,10 +5835,8 @@ package body Exp_Dist is
RACW_Parameter : constant Entity_Id :=
Make_Defining_Identifier (Loc, Name_R);
- Reference : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
- Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Reference : constant Entity_Id := Make_Temporary (Loc, 'R');
+ Any : constant Entity_Id := Make_Temporary (Loc, 'A');
begin
Func_Spec :=
@@ -6074,8 +6025,7 @@ package body Exp_Dist is
Attr_Decl : Node_Id;
Statements : constant List_Id := New_List;
- Pnam : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Pnam : constant Entity_Id := Make_Temporary (Loc, 'R');
function Stream_Parameter return Node_Id;
function Object return Node_Id;
@@ -6233,16 +6183,10 @@ package body Exp_Dist is
Make_Defining_Identifier (Loc, Name_A);
-- For the call to Get_Local_Address
+ Local_Stub : constant Entity_Id := Make_Temporary (Loc, 'L');
+ Stub_Ptr : constant Entity_Id := Make_Temporary (Loc, 'S');
-- Additional local variables for the remote case
- Local_Stub : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
-
- Stub_Ptr : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
-
function Set_Field
(Field_Name : Name_Id;
Value : Node_Id) return Node_Id;
@@ -6554,12 +6498,8 @@ package body Exp_Dist is
Func_Spec : Node_Id;
- Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
- RAS_Parameter : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
+ Any : constant Entity_Id := Make_Temporary (Loc, 'A');
+ RAS_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R');
RACW_Parameter : constant Node_Id :=
Make_Selected_Component (Loc,
Prefix => RAS_Parameter,
@@ -6675,8 +6615,7 @@ package body Exp_Dist is
Loc : constant Source_Ptr := Sloc (Pkg_Spec);
Pkg_RPC_Receiver : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('H'));
+ Make_Temporary (Loc, 'H');
Pkg_RPC_Receiver_Object : Node_Id;
Pkg_RPC_Receiver_Body : Node_Id;
Pkg_RPC_Receiver_Decls : List_Id;
@@ -6697,13 +6636,9 @@ package body Exp_Dist is
-- from the request structure, or the local subprogram address (in
-- case of a RAS).
- Is_Local : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
+ Is_Local : constant Entity_Id := Make_Temporary (Loc, 'L');
- Local_Address : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Local_Address : constant Entity_Id := Make_Temporary (Loc, 'A');
-- Address of a local subprogram designated by a reference
-- corresponding to a RAS.
@@ -6714,9 +6649,7 @@ package body Exp_Dist is
Current_Stubs : Node_Id;
Current_Subprogram_Number : Int := First_RCI_Subprogram_Id;
- Subp_Info_Array : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('I'));
+ Subp_Info_Array : constant Entity_Id := Make_Temporary (Loc, 'I');
Subp_Info_List : constant List_Id := New_List;
@@ -7073,8 +7006,7 @@ package body Exp_Dist is
Pkg_RPC_Receiver_Object :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('R')),
+ Defining_Identifier => Make_Temporary (Loc, 'R'),
Aliased_Present => True,
Object_Definition => New_Occurrence_Of (RTE (RE_Servant), Loc));
Append_To (Decls, Pkg_RPC_Receiver_Object);
@@ -7163,8 +7095,7 @@ package body Exp_Dist is
is
Loc : constant Source_Ptr := Sloc (Nod);
- Request : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Request : constant Entity_Id := Make_Temporary (Loc, 'R');
-- The request object constructed by these stubs
-- Could we use Name_R instead??? (see GLADE client stubs)
@@ -7247,9 +7178,7 @@ package body Exp_Dist is
Object_Definition =>
New_Occurrence_Of (RTE (RE_Request_Access), Loc)));
- Result :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
+ Result := Make_Temporary (Loc, 'R');
if Is_Function then
Result_TC :=
@@ -7285,8 +7214,7 @@ package body Exp_Dist is
Expression => Make_Integer_Literal (Loc, 0))))));
if not Is_Known_Asynchronous then
- Exception_Return_Parameter :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ Exception_Return_Parameter := Make_Temporary (Loc, 'E');
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -7300,8 +7228,7 @@ package body Exp_Dist is
-- Initialize and fill in arguments list
- Arguments :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Arguments := Make_Temporary (Loc, 'A');
Declare_Create_NVList (Loc, Arguments, Decls, Statements);
Current_Parameter := First (Ordered_Parameters_List);
@@ -7336,9 +7263,7 @@ package body Exp_Dist is
Is_Constrained (Etyp)
or else Is_Elementary_Type (Etyp);
- Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('A'));
+ Any : constant Entity_Id := Make_Temporary (Loc, 'A');
Actual_Parameter : Node_Id :=
New_Occurrence_Of (
@@ -7447,8 +7372,7 @@ package body Exp_Dist is
declare
Extra_Any_Parameter : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, New_Internal_Name ('P'));
+ Make_Temporary (Loc, 'P');
Parameter_Exp : constant Node_Id :=
Make_Attribute_Reference (Loc,
@@ -7595,9 +7519,8 @@ package body Exp_Dist is
Controlling_Parameter : Entity_Id) return RPC_Target
is
Target_Info : RPC_Target (PCS_Kind => Name_PolyORB_DSA);
- Target_Reference : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('T'));
+ Target_Reference : constant Entity_Id := Make_Temporary (Loc, 'T');
+
begin
if Present (Controlling_Parameter) then
Append_To (Decls,
@@ -7666,8 +7589,7 @@ package body Exp_Dist is
RPC_Receiver_Decl :=
Make_Object_Declaration (Loc,
- Defining_Identifier => Make_Defining_Identifier (Loc,
- New_Internal_Name ('R')),
+ Defining_Identifier => Make_Temporary (Loc, 'R'),
Aliased_Present => True,
Object_Definition =>
New_Occurrence_Of (RTE (RE_Servant), Loc));
@@ -7747,9 +7669,7 @@ package body Exp_Dist is
is
Loc : constant Source_Ptr := Sloc (Vis_Decl);
- Request_Parameter : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('R'));
+ Request_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R');
-- Formal parameter for receiving stubs: a descriptor for an incoming
-- request.
@@ -7793,9 +7713,7 @@ package body Exp_Dist is
Build_Ordered_Parameters_List
(Specification (Vis_Decl));
- Arguments : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('A'));
+ Arguments : constant Entity_Id := Make_Temporary (Loc, 'A');
-- Name of the named values list used to retrieve parameters
Subp_Spec : Node_Id;
@@ -7825,11 +7743,9 @@ package body Exp_Dist is
declare
Etyp : Entity_Id;
Constrained : Boolean;
- Any : Entity_Id := Empty;
- Object : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
- Expr : Node_Id := Empty;
+ Any : Entity_Id := Empty;
+ Object : constant Entity_Id := Make_Temporary (Loc, 'P');
+ Expr : Node_Id := Empty;
Is_Controlling_Formal : constant Boolean :=
Is_RACW_Controlling_Formal
@@ -7865,9 +7781,7 @@ package body Exp_Dist is
Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp);
if not Is_First_Controlling_Formal then
- Any :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Any := Make_Temporary (Loc, 'A');
Append_To (Outer_Decls,
Make_Object_Declaration (Loc,
@@ -7891,13 +7805,10 @@ package body Exp_Dist is
if Is_First_Controlling_Formal then
declare
- Addr : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Addr : constant Entity_Id := Make_Temporary (Loc, 'A');
Is_Local : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('L'));
+ Make_Temporary (Loc, 'L');
begin
-- Special case: obtain the first controlling formal
@@ -8067,8 +7978,7 @@ package body Exp_Dist is
(Current_Parameter));
Extra_Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Make_Temporary (Loc, 'A');
Formal_Entity : constant Entity_Id :=
Make_Defining_Identifier (Loc,
@@ -8139,9 +8049,7 @@ package body Exp_Dist is
declare
Etyp : constant Entity_Id :=
Etype (Result_Definition (Specification (Vis_Decl)));
- Result : constant Node_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R'));
+ Result : constant Node_Id := Make_Temporary (Loc, 'R');
begin
Inner_Decls := New_List (
@@ -8209,8 +8117,7 @@ package body Exp_Dist is
Subp_Spec :=
Make_Procedure_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('F')),
+ Defining_Unit_Name => Make_Temporary (Loc, 'F'),
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
@@ -8396,9 +8303,7 @@ package body Exp_Dist is
N : Node_Id;
Target : Entity_Id)
is
- Strm : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Strm : constant Entity_Id := Make_Temporary (Loc, 'S');
Expr : Node_Id;
Read_Call_List : List_Id;
@@ -8456,9 +8361,7 @@ package body Exp_Dist is
else
declare
- Temp : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, New_Internal_Name ('R'));
+ Temp : constant Entity_Id := Make_Temporary (Loc, 'R');
begin
Read_Call_List := New_List;
@@ -8659,9 +8562,7 @@ package body Exp_Dist is
Decls : constant List_Id := New_List;
Stms : constant List_Id := New_List;
- Any_Parameter : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('A'));
+ Any_Parameter : constant Entity_Id := Make_Temporary (Loc, 'A');
Use_Opaque_Representation : Boolean;
@@ -8744,9 +8645,7 @@ package body Exp_Dist is
-- The returned object
- Res : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('R'));
+ Res : constant Entity_Id := Make_Temporary (Loc, 'R');
Res_Definition : Node_Id := New_Occurrence_Of (Typ, Loc);
@@ -8813,8 +8712,7 @@ package body Exp_Dist is
Choice_List : List_Id;
Struct_Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S'));
+ Make_Temporary (Loc, 'S');
begin
Append_To (Decls,
@@ -9454,7 +9352,7 @@ package body Exp_Dist is
-- that the expected type of its parameter is U_Type.
if Ekind (Fnam) = E_Function
- and then Present (First_Formal (Fnam))
+ and then Present (First_Formal (Fnam))
then
C_Type := Etype (First_Formal (Fnam));
else
@@ -9641,12 +9539,10 @@ package body Exp_Dist is
Choice_List : List_Id;
Union_Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('V'));
+ Make_Temporary (Loc, 'V');
Struct_Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S'));
+ Make_Temporary (Loc, 'S');
function Make_Discriminant_Reference
return Node_Id;
@@ -9865,8 +9761,7 @@ package body Exp_Dist is
declare
Dummy_Any : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
+ Make_Temporary (Loc, 'A');
begin
Append_To (Decls,
@@ -10016,9 +9911,7 @@ package body Exp_Dist is
if Use_Opaque_Representation then
declare
- Strm : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Strm : constant Entity_Id := Make_Temporary (Loc, 'S');
-- Stream used to store data representation produced by
-- stream attribute.
@@ -11192,9 +11085,7 @@ package body Exp_Dist is
Pkg_Name := String_From_Name_Buffer;
Inst :=
Make_Package_Instantiation (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('R')),
+ Defining_Unit_Name => Make_Temporary (Loc, 'R'),
Name =>
New_Occurrence_Of (RTE (RE_RCI_Locator), Loc),
diff --git a/gcc/ada/exp_fixd.adb b/gcc/ada/exp_fixd.adb
index fa878c2bf78..28b93b5f8a5 100644
--- a/gcc/ada/exp_fixd.adb
+++ b/gcc/ada/exp_fixd.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -505,8 +505,8 @@ package body Exp_Fixd is
-- Define quotient and remainder, and set their Etypes, so
-- that they can be picked up by Build_xxx routines.
- Qnn := Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
- Rnn := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Qnn := Make_Temporary (Loc, 'S');
+ Rnn := Make_Temporary (Loc, 'R');
Set_Etype (Qnn, QR_Typ);
Set_Etype (Rnn, QR_Typ);
@@ -518,8 +518,8 @@ package body Exp_Fixd is
-- Create temporaries for numerator and denominator and set Etypes,
-- so that New_Occurrence_Of picks them up for Build_xxx calls.
- Nnn := Make_Defining_Identifier (Loc, New_Internal_Name ('N'));
- Dnn := Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
+ Nnn := Make_Temporary (Loc, 'N');
+ Dnn := Make_Temporary (Loc, 'D');
Set_Etype (Nnn, QR_Typ);
Set_Etype (Dnn, QR_Typ);
@@ -882,8 +882,8 @@ package body Exp_Fixd is
-- Define quotient and remainder, and set their Etypes, so
-- that they can be picked up by Build_xxx routines.
- Qnn := Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
- Rnn := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Qnn := Make_Temporary (Loc, 'S');
+ Rnn := Make_Temporary (Loc, 'R');
Set_Etype (Qnn, QR_Typ);
Set_Etype (Rnn, QR_Typ);
@@ -891,8 +891,8 @@ package body Exp_Fixd is
-- Case that we can compute the numerator in 64 bits
if QR_Siz <= 64 then
- Nnn := Make_Defining_Identifier (Loc, New_Internal_Name ('N'));
- Dnn := Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
+ Nnn := Make_Temporary (Loc, 'N');
+ Dnn := Make_Temporary (Loc, 'D');
-- Set Etypes, so that they can be picked up by New_Occurrence_Of
diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb
index cf4a9c02a80..9c0be21634e 100644
--- a/gcc/ada/exp_imgv.adb
+++ b/gcc/ada/exp_imgv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -43,9 +43,15 @@ with Stringt; use Stringt;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
with Uintp; use Uintp;
+with Urealp; use Urealp;
package body Exp_Imgv is
+ function Has_Decimal_Small (E : Entity_Id) return Boolean;
+ -- Applies to all entities. True for a Decimal_Fixed_Point_Type, or an
+ -- Ordinary_Fixed_Point_Type with a small that is a negative power of ten.
+ -- Shouldn't this be in einfo.adb or sem_aux.adb???
+
------------------------------------
-- Build_Enumeration_Image_Tables --
------------------------------------
@@ -260,13 +266,8 @@ package body Exp_Imgv is
Ins_List : List_Id;
-- List of actions to be inserted
- Snn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
-
- Pnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Snn : constant Entity_Id := Make_Temporary (Loc, 'S');
+ Pnn : constant Entity_Id := Make_Temporary (Loc, 'P');
begin
-- Build declarations of Snn and Pnn to be inserted
@@ -335,7 +336,7 @@ package body Exp_Imgv is
Tent := RTE (RE_Long_Long_Unsigned);
end if;
- elsif Is_Decimal_Fixed_Point_Type (Rtyp) then
+ elsif Is_Fixed_Point_Type (Rtyp) and then Has_Decimal_Small (Rtyp) then
if UI_To_Int (Esize (Rtyp)) <= Standard_Integer_Size then
Imid := RE_Image_Decimal;
Tent := Standard_Integer;
@@ -358,8 +359,8 @@ package body Exp_Imgv is
if Discard_Names (First_Subtype (Ptyp))
or else No (Lit_Strings (Root_Type (Ptyp)))
then
- -- When pragma Discard_Names applies to the first subtype,
- -- then build (Pref'Pos)'Img.
+ -- When pragma Discard_Names applies to the first subtype, build
+ -- (Pref'Pos)'Img.
Rewrite (N,
Make_Attribute_Reference (Loc,
@@ -380,8 +381,10 @@ package body Exp_Imgv is
if Ttyp = Standard_Integer_8 then
Imid := RE_Image_Enumeration_8;
- elsif Ttyp = Standard_Integer_16 then
+
+ elsif Ttyp = Standard_Integer_16 then
Imid := RE_Image_Enumeration_16;
+
else
Imid := RE_Image_Enumeration_32;
end if;
@@ -454,18 +457,23 @@ package body Exp_Imgv is
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Aft));
+ if Has_Decimal_Small (Rtyp) then
+ Set_Conversion_OK (First (Arg_List));
+ Set_Etype (First (Arg_List), Tent);
+ end if;
+
-- For decimal, append Scale and also set to do literal conversion
elsif Is_Decimal_Fixed_Point_Type (Rtyp) then
Append_To (Arg_List,
Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Ptyp, Loc),
+ Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Scale));
Set_Conversion_OK (First (Arg_List));
Set_Etype (First (Arg_List), Tent);
- -- For Wide_Character, append Ada 2005 indication
+ -- For Wide_Character, append Ada 2005 indication
elsif Rtyp = Standard_Wide_Character then
Append_To (Arg_List,
@@ -771,14 +779,8 @@ package body Exp_Imgv is
procedure Expand_Wide_Image_Attribute (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Rtyp : constant Entity_Id := Root_Type (Entity (Prefix (N)));
-
- Rnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
-
- Lnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Rnn : constant Entity_Id := Make_Temporary (Loc, 'S');
+ Lnn : constant Entity_Id := Make_Temporary (Loc, 'P');
begin
Insert_Actions (N, New_List (
@@ -869,13 +871,8 @@ package body Exp_Imgv is
Loc : constant Source_Ptr := Sloc (N);
Rtyp : constant Entity_Id := Root_Type (Entity (Prefix (N)));
- Rnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
-
- Lnn : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Rnn : constant Entity_Id := Make_Temporary (Loc, 'S');
+ Lnn : constant Entity_Id := Make_Temporary (Loc, 'P');
begin
Insert_Actions (N, New_List (
@@ -1254,4 +1251,16 @@ package body Exp_Imgv is
Analyze_And_Resolve (N, Typ);
end Expand_Width_Attribute;
+ -----------------------
+ -- Has_Decimal_Small --
+ -----------------------
+
+ function Has_Decimal_Small (E : Entity_Id) return Boolean is
+ begin
+ return Is_Decimal_Fixed_Point_Type (E)
+ or else
+ (Is_Ordinary_Fixed_Point_Type (E)
+ and then Ureal_10**Aft_Value (E) * Small_Value (E) = Ureal_1);
+ end Has_Decimal_Small;
+
end Exp_Imgv;
diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb
index da6cf5a988c..0c4a67cb684 100644
--- a/gcc/ada/exp_intr.adb
+++ b/gcc/ada/exp_intr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -63,6 +63,10 @@ package body Exp_Intr is
-- Local Subprograms --
-----------------------
+ procedure Expand_Binary_Operator_Call (N : Node_Id);
+ -- Expand a call to an intrinsic arithmetic operator when the operand
+ -- types or sizes are not identical.
+
procedure Expand_Is_Negative (N : Node_Id);
-- Expand a call to the intrinsic Is_Negative function
@@ -108,6 +112,49 @@ package body Exp_Intr is
-- Name_Source_Location - expand string of form file:line
-- Name_Enclosing_Entity - expand string with name of enclosing entity
+ ---------------------------------
+ -- Expand_Binary_Operator_Call --
+ ---------------------------------
+
+ procedure Expand_Binary_Operator_Call (N : Node_Id) is
+ T1 : constant Entity_Id := Underlying_Type (Left_Opnd (N));
+ T2 : constant Entity_Id := Underlying_Type (Right_Opnd (N));
+ TR : constant Entity_Id := Etype (N);
+ T3 : Entity_Id;
+ Res : Node_Id;
+
+ Siz : constant Uint := UI_Max (Esize (T1), Esize (T2));
+ -- Maximum of operand sizes
+
+ begin
+ -- Use Unsigned_32 for sizes of 32 or below, else Unsigned_64
+
+ if Siz > 32 then
+ T3 := RTE (RE_Unsigned_64);
+ else
+ T3 := RTE (RE_Unsigned_32);
+ end if;
+
+ -- Copy operator node, and reset type and entity fields, for
+ -- subsequent reanalysis.
+
+ Res := New_Copy (N);
+ Set_Etype (Res, Empty);
+ Set_Entity (Res, Empty);
+
+ -- Convert operands to large enough intermediate type
+
+ Set_Left_Opnd (Res,
+ Unchecked_Convert_To (T3, Relocate_Node (Left_Opnd (N))));
+ Set_Right_Opnd (Res,
+ Unchecked_Convert_To (T3, Relocate_Node (Right_Opnd (N))));
+
+ -- Analyze and resolve result formed by conversion to target type
+
+ Rewrite (N, Unchecked_Convert_To (TR, Res));
+ Analyze_And_Resolve (N, TR);
+ end Expand_Binary_Operator_Call;
+
-----------------------------------------
-- Expand_Dispatching_Constructor_Call --
-----------------------------------------
@@ -171,11 +218,10 @@ package body Exp_Intr is
Iface_Tag :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('V')),
- Object_Definition =>
+ Defining_Identifier => Make_Temporary (Loc, 'V'),
+ Object_Definition =>
New_Reference_To (RTE (RE_Tag), Loc),
- Expression =>
+ Expression =>
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (RE_Secondary_Tag), Loc),
Parameter_Associations => New_List (
@@ -325,7 +371,7 @@ package body Exp_Intr is
-- be referencing it by normal visibility methods.
if No (Choice_Parameter (P)) then
- E := Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
+ E := Make_Temporary (Loc, 'E');
Set_Choice_Parameter (P, E);
Set_Ekind (E, E_Variable);
Set_Etype (E, RTE (RE_Exception_Occurrence));
@@ -362,11 +408,9 @@ package body Exp_Intr is
Loc : constant Source_Ptr := Sloc (N);
Ent : constant Entity_Id := Entity (Name (N));
Str : constant Node_Id := First_Actual (N);
- Dum : Entity_Id;
+ Dum : constant Entity_Id := Make_Temporary (Loc, 'D');
begin
- Dum := Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
-
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Dum,
@@ -490,6 +534,9 @@ package body Exp_Intr is
elsif Present (Alias (E)) then
Expand_Intrinsic_Call (N, Alias (E));
+ elsif Nkind (N) in N_Binary_Op then
+ Expand_Binary_Operator_Call (N);
+
-- The only other case is where an external name was specified,
-- since this is the only way that an otherwise unrecognized
-- name could escape the checking in Sem_Prag. Nothing needs
@@ -1025,13 +1072,11 @@ package body Exp_Intr is
D_Type := Entity (D_Subtyp);
else
- D_Type := Make_Defining_Identifier (Loc,
- New_Internal_Name ('A'));
+ D_Type := Make_Temporary (Loc, 'A');
Insert_Action (Deref,
Make_Subtype_Declaration (Loc,
Defining_Identifier => D_Type,
Subtype_Indication => D_Subtyp));
-
end if;
-- Force freezing at the point of the dereference. For the
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index c1d25c2d68f..bd8a69771a4 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -455,6 +455,15 @@ package body Exp_Pakd is
-- expression whose type is the implementation type used to represent
-- the packed array. Aexp is analyzed and resolved on entry and on exit.
+ procedure Get_Base_And_Bit_Offset
+ (N : Node_Id;
+ Base : out Node_Id;
+ Offset : out Node_Id);
+ -- Given a node N for a name which involves a packed array reference,
+ -- return the base object of the reference and build an expression of
+ -- type Standard.Integer representing the zero-based offset in bits
+ -- from Base'Address to the first bit of the reference.
+
function Known_Aligned_Enough (Obj : Node_Id; Csiz : Nat) return Boolean;
-- There are two versions of the Set routines, the ones used when the
-- object is known to be sufficiently well aligned given the number of
@@ -1347,10 +1356,9 @@ package body Exp_Pakd is
begin
Decl :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('T')),
- Object_Definition => New_Occurrence_Of (Ctyp, Loc),
- Expression => New_Copy_Tree (Rhs));
+ Defining_Identifier => Make_Temporary (Loc, 'T', Rhs),
+ Object_Definition => New_Occurrence_Of (Ctyp, Loc),
+ Expression => New_Copy_Tree (Rhs));
Insert_Actions (N, New_List (Decl));
Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc);
@@ -1373,6 +1381,19 @@ package body Exp_Pakd is
Analyze_And_Resolve (Rhs, Ctyp);
end if;
+ -- For the AAMP target, indexing of certain packed array is passed
+ -- through to the back end without expansion, because the expansion
+ -- results in very inefficient code on that target. This allows the
+ -- GNAAMP back end to generate specialized macros that support more
+ -- efficient indexing of packed arrays with components having sizes
+ -- that are small powers of two.
+
+ if AAMP_On_Target
+ and then (Csiz = 1 or else Csiz = 2 or else Csiz = 4)
+ then
+ return;
+ end if;
+
-- Case of component size 1,2,4 or any component size for the modular
-- case. These are the cases for which we can inline the code.
@@ -1664,18 +1685,11 @@ package body Exp_Pakd is
procedure Expand_Packed_Address_Reference (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
- Ploc : Source_Ptr;
- Pref : Node_Id;
- Expr : Node_Id;
- Term : Node_Id;
- Atyp : Entity_Id;
- Subscr : Node_Id;
+ Base : Node_Id;
+ Offset : Node_Id;
begin
- Pref := Prefix (N);
- Expr := Empty;
-
- -- We build up an expression serially that has the form
+ -- We build an expression that has the form
-- outer_object'Address
-- + (linear-subscript * component_size for each array reference
@@ -1683,49 +1697,7 @@ package body Exp_Pakd is
-- + ...
-- + ...) / Storage_Unit;
- -- Some additional conversions are required to deal with the addition
- -- operation, which is not normally visible to generated code.
-
- loop
- Ploc := Sloc (Pref);
-
- if Nkind (Pref) = N_Indexed_Component then
- Convert_To_Actual_Subtype (Prefix (Pref));
- Atyp := Etype (Prefix (Pref));
- Compute_Linear_Subscript (Atyp, Pref, Subscr);
-
- Term :=
- Make_Op_Multiply (Ploc,
- Left_Opnd => Subscr,
- Right_Opnd =>
- Make_Attribute_Reference (Ploc,
- Prefix => New_Occurrence_Of (Atyp, Ploc),
- Attribute_Name => Name_Component_Size));
-
- elsif Nkind (Pref) = N_Selected_Component then
- Term :=
- Make_Attribute_Reference (Ploc,
- Prefix => Selector_Name (Pref),
- Attribute_Name => Name_Bit_Position);
-
- else
- exit;
- end if;
-
- Term := Convert_To (RTE (RE_Integer_Address), Term);
-
- if No (Expr) then
- Expr := Term;
-
- else
- Expr :=
- Make_Op_Add (Ploc,
- Left_Opnd => Expr,
- Right_Opnd => Term);
- end if;
-
- Pref := Prefix (Pref);
- end loop;
+ Get_Base_And_Bit_Offset (Prefix (N), Base, Offset);
Rewrite (N,
Unchecked_Convert_To (RTE (RE_Address),
@@ -1733,18 +1705,47 @@ package body Exp_Pakd is
Left_Opnd =>
Unchecked_Convert_To (RTE (RE_Integer_Address),
Make_Attribute_Reference (Loc,
- Prefix => Pref,
+ Prefix => Base,
Attribute_Name => Name_Address)),
Right_Opnd =>
- Make_Op_Divide (Loc,
- Left_Opnd => Expr,
- Right_Opnd =>
- Make_Integer_Literal (Loc, System_Storage_Unit)))));
+ Unchecked_Convert_To (RTE (RE_Integer_Address),
+ Make_Op_Divide (Loc,
+ Left_Opnd => Offset,
+ Right_Opnd =>
+ Make_Integer_Literal (Loc, System_Storage_Unit))))));
Analyze_And_Resolve (N, RTE (RE_Address));
end Expand_Packed_Address_Reference;
+ ---------------------------------
+ -- Expand_Packed_Bit_Reference --
+ ---------------------------------
+
+ procedure Expand_Packed_Bit_Reference (N : Node_Id) is
+ Loc : constant Source_Ptr := Sloc (N);
+ Base : Node_Id;
+ Offset : Node_Id;
+
+ begin
+ -- We build an expression that has the form
+
+ -- (linear-subscript * component_size for each array reference
+ -- + field'Bit_Position for each record field
+ -- + ...
+ -- + ...) mod Storage_Unit;
+
+ Get_Base_And_Bit_Offset (Prefix (N), Base, Offset);
+
+ Rewrite (N,
+ Unchecked_Convert_To (Universal_Integer,
+ Make_Op_Mod (Loc,
+ Left_Opnd => Offset,
+ Right_Opnd => Make_Integer_Literal (Loc, System_Storage_Unit))));
+
+ Analyze_And_Resolve (N, Universal_Integer);
+ end Expand_Packed_Bit_Reference;
+
------------------------------------
-- Expand_Packed_Boolean_Operator --
------------------------------------
@@ -1841,11 +1842,8 @@ package body Exp_Pakd is
else
declare
- Result_Ent : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
-
- E_Id : RE_Id;
+ Result_Ent : constant Entity_Id := Make_Temporary (Loc, 'T');
+ E_Id : RE_Id;
begin
if Nkind (N) = N_Op_And then
@@ -1948,6 +1946,19 @@ package body Exp_Pakd is
Ctyp := Component_Type (Atyp);
Csiz := UI_To_Int (Component_Size (Atyp));
+ -- For the AAMP target, indexing of certain packed array is passed
+ -- through to the back end without expansion, because the expansion
+ -- results in very inefficient code on that target. This allows the
+ -- GNAAMP back end to generate specialized macros that support more
+ -- efficient indexing of packed arrays with components having sizes
+ -- that are small powers of two.
+
+ if AAMP_On_Target
+ and then (Csiz = 1 or else Csiz = 2 or else Csiz = 4)
+ then
+ return;
+ end if;
+
-- Case of component size 1,2,4 or any component size for the modular
-- case. These are the cases for which we can inline the code.
@@ -2192,9 +2203,7 @@ package body Exp_Pakd is
else
declare
- Result_Ent : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Result_Ent : constant Entity_Id := Make_Temporary (Loc, 'T');
begin
Insert_Actions (N, New_List (
@@ -2235,6 +2244,70 @@ package body Exp_Pakd is
end Expand_Packed_Not;
+ -----------------------------
+ -- Get_Base_And_Bit_Offset --
+ -----------------------------
+
+ procedure Get_Base_And_Bit_Offset
+ (N : Node_Id;
+ Base : out Node_Id;
+ Offset : out Node_Id)
+ is
+ Loc : Source_Ptr;
+ Term : Node_Id;
+ Atyp : Entity_Id;
+ Subscr : Node_Id;
+
+ begin
+ Base := N;
+ Offset := Empty;
+
+ -- We build up an expression serially that has the form
+
+ -- linear-subscript * component_size for each array reference
+ -- + field'Bit_Position for each record field
+ -- + ...
+
+ loop
+ Loc := Sloc (Base);
+
+ if Nkind (Base) = N_Indexed_Component then
+ Convert_To_Actual_Subtype (Prefix (Base));
+ Atyp := Etype (Prefix (Base));
+ Compute_Linear_Subscript (Atyp, Base, Subscr);
+
+ Term :=
+ Make_Op_Multiply (Loc,
+ Left_Opnd => Subscr,
+ Right_Opnd =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Atyp, Loc),
+ Attribute_Name => Name_Component_Size));
+
+ elsif Nkind (Base) = N_Selected_Component then
+ Term :=
+ Make_Attribute_Reference (Loc,
+ Prefix => Selector_Name (Base),
+ Attribute_Name => Name_Bit_Position);
+
+ else
+ return;
+ end if;
+
+ if No (Offset) then
+ Offset := Term;
+
+ else
+ Offset :=
+ Make_Op_Add (Loc,
+ Left_Opnd => Offset,
+ Right_Opnd => Term);
+ end if;
+
+ Base := Prefix (Base);
+ end loop;
+ end Get_Base_And_Bit_Offset;
+
-------------------------------------
-- Involves_Packed_Array_Reference --
-------------------------------------
diff --git a/gcc/ada/exp_pakd.ads b/gcc/ada/exp_pakd.ads
index 0c2e815e2ff..bd21a30effe 100644
--- a/gcc/ada/exp_pakd.ads
+++ b/gcc/ada/exp_pakd.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -272,4 +272,9 @@ package Exp_Pakd is
-- the prefix involves a packed array reference. This routine expands the
-- necessary code for performing the address reference in this case.
+ procedure Expand_Packed_Bit_Reference (N : Node_Id);
+ -- The node N is an attribute reference for the 'Bit reference, where the
+ -- prefix involves a packed array reference. This routine expands the
+ -- necessary code for performing the bit reference in this case.
+
end Exp_Pakd;
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index 6bddf9670b9..987cddc0bbd 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -269,8 +269,8 @@ package body Exp_Prag is
--------------------------
procedure Expand_Pragma_Check (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
Cond : constant Node_Id := Arg2 (N);
+ Loc : constant Source_Ptr := Sloc (Cond);
Nam : constant Name_Id := Chars (Arg1 (N));
Msg : Node_Id;
@@ -536,17 +536,14 @@ package body Exp_Prag is
begin
if Present (Call) then
declare
- Excep_Internal : constant Node_Id :=
- Make_Defining_Identifier
- (Loc, New_Internal_Name ('V'));
-
- Export_Pragma : Node_Id;
- Excep_Alias : Node_Id;
- Excep_Object : Node_Id;
- Excep_Image : String_Id;
- Exdata : List_Id;
- Lang_Char : Node_Id;
- Code : Node_Id;
+ Excep_Internal : constant Node_Id := Make_Temporary (Loc, 'V');
+ Export_Pragma : Node_Id;
+ Excep_Alias : Node_Id;
+ Excep_Object : Node_Id;
+ Excep_Image : String_Id;
+ Exdata : List_Id;
+ Lang_Char : Node_Id;
+ Code : Node_Id;
begin
if Present (Interface_Name (Id)) then
diff --git a/gcc/ada/exp_sel.adb b/gcc/ada/exp_sel.adb
index 25d1a32b4c9..8250516a04f 100644
--- a/gcc/ada/exp_sel.adb
+++ b/gcc/ada/exp_sel.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -83,19 +83,13 @@ package body Exp_Sel is
(Loc : Source_Ptr;
Decls : List_Id) return Entity_Id
is
- B : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('B'));
-
+ B : constant Entity_Id := Make_Temporary (Loc, 'B');
begin
Append_To (Decls,
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- B,
- Object_Definition =>
- New_Reference_To (Standard_Boolean, Loc),
- Expression =>
- New_Reference_To (Standard_False, Loc)));
-
+ Defining_Identifier => B,
+ Object_Definition => New_Reference_To (Standard_Boolean, Loc),
+ Expression => New_Reference_To (Standard_False, Loc)));
return B;
end Build_B;
@@ -107,17 +101,12 @@ package body Exp_Sel is
(Loc : Source_Ptr;
Decls : List_Id) return Entity_Id
is
- C : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('C'));
-
+ C : constant Entity_Id := Make_Temporary (Loc, 'C');
begin
Append_To (Decls,
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- C,
- Object_Definition =>
- New_Reference_To (RTE (RE_Prim_Op_Kind), Loc)));
-
+ Defining_Identifier => C,
+ Object_Definition => New_Reference_To (RTE (RE_Prim_Op_Kind), Loc)));
return C;
end Build_C;
@@ -155,9 +144,7 @@ package body Exp_Sel is
Decls : List_Id;
Obj : Entity_Id) return Entity_Id
is
- K : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('K'));
-
+ K : constant Entity_Id := Make_Temporary (Loc, 'K');
begin
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -169,7 +156,6 @@ package body Exp_Sel is
Name => New_Reference_To (RTE (RE_Get_Tagged_Kind), Loc),
Parameter_Associations => New_List (
Unchecked_Convert_To (RTE (RE_Tag), Obj)))));
-
return K;
end Build_K;
@@ -181,16 +167,12 @@ package body Exp_Sel is
(Loc : Source_Ptr;
Decls : List_Id) return Entity_Id
is
- S : constant Entity_Id := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
-
+ S : constant Entity_Id := Make_Temporary (Loc, 'S');
begin
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => S,
- Object_Definition =>
- New_Reference_To (Standard_Integer, Loc)));
-
+ Object_Definition => New_Reference_To (Standard_Integer, Loc)));
return S;
end Build_S;
diff --git a/gcc/ada/exp_smem.adb b/gcc/ada/exp_smem.adb
index 6cbca26e0a8..f2cbfd083c9 100644
--- a/gcc/ada/exp_smem.adb
+++ b/gcc/ada/exp_smem.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2010, 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- --
@@ -270,10 +270,7 @@ package body Exp_Smem is
return False;
else
- if Ekind (Formal) = E_Out_Parameter
- or else
- Ekind (Formal) = E_In_Out_Parameter
- then
+ if Ekind_In (Formal, E_Out_Parameter, E_In_Out_Parameter) then
Insert_Node := Call;
return True;
else
diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb
index 42c34a8487e..ddb1064c475 100644
--- a/gcc/ada/exp_strm.adb
+++ b/gcc/ada/exp_strm.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -1396,7 +1396,7 @@ package body Exp_Strm is
-- If the enclosing record is an unchecked_union, we use the
-- default expressions for the discriminant (it must exist)
-- because we cannot generate a reference to it, given that
- -- it is not stored..
+ -- it is not stored.
if Is_Unchecked_Union (Scope (Entity (Name (VP)))) then
D_Ref :=
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index c450b677faf..b9e5d389fce 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -43,7 +43,6 @@ with Rident; use Rident;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Ch8; use Sem_Ch8;
-with Sem_SCIL; use Sem_SCIL;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
@@ -306,11 +305,9 @@ package body Exp_Util is
else
if No (Actions (Fnode)) then
Set_Actions (Fnode, L);
-
else
Append_List (L, Actions (Fnode));
end if;
-
end if;
end Append_Freeze_Actions;
@@ -398,7 +395,7 @@ package body Exp_Util is
Pos : Entity_Id;
-- Running index for substring assignments
- Pref : Entity_Id;
+ Pref : constant Entity_Id := Make_Temporary (Loc, 'P');
-- Name of enclosing variable, prefix of resulting name
Res : Entity_Id;
@@ -417,8 +414,6 @@ package body Exp_Util is
Stats : constant List_Id := New_List;
begin
- Pref := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
-
-- For a dynamic task, the name comes from the target variable.
-- For a static one it is a formal of the enclosing init proc.
@@ -444,7 +439,7 @@ package body Exp_Util is
Val := First (Expressions (Id_Ref));
for J in 1 .. Dims loop
- T := Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ T := Make_Temporary (Loc, 'T');
Temps (J) := T;
Append_To (Decls,
@@ -454,10 +449,8 @@ package body Exp_Util is
Expression =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Image,
- Prefix =>
- New_Occurrence_Of (Etype (Indx), Loc),
- Expressions => New_List (
- New_Copy_Tree (Val)))));
+ Prefix => New_Occurrence_Of (Etype (Indx), Loc),
+ Expressions => New_List (New_Copy_Tree (Val)))));
Next_Index (Indx);
Next (Val);
@@ -613,7 +606,7 @@ package body Exp_Util is
if Restriction_Active (No_Implicit_Heap_Allocations)
or else Global_Discard_Names
then
- T_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
+ T_Id := Make_Temporary (Loc, 'J');
Name_Len := 0;
return
@@ -697,9 +690,8 @@ package body Exp_Util is
Expression => New_Occurrence_Of (Res, Loc)));
Spec := Make_Function_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('F')),
- Result_Definition => New_Occurrence_Of (Standard_String, Loc));
+ Defining_Unit_Name => Make_Temporary (Loc, 'F'),
+ Result_Definition => New_Occurrence_Of (Standard_String, Loc));
-- Calls to 'Image use the secondary stack, which must be cleaned
-- up after the task name is built.
@@ -726,15 +718,15 @@ package body Exp_Util is
Stats : List_Id)
is
begin
- Len := Make_Defining_Identifier (Loc, New_Internal_Name ('L'));
+ Len := Make_Temporary (Loc, 'L', Sum);
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Len,
- Object_Definition => New_Occurrence_Of (Standard_Integer, Loc),
- Expression => Sum));
+ Object_Definition => New_Occurrence_Of (Standard_Integer, Loc),
+ Expression => Sum));
- Res := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Res := Make_Temporary (Loc, 'R');
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -750,12 +742,12 @@ package body Exp_Util is
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => New_Occurrence_Of (Len, Loc)))))));
- Pos := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Pos := Make_Temporary (Loc, 'P');
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Pos,
- Object_Definition => New_Occurrence_Of (Standard_Integer, Loc)));
+ Object_Definition => New_Occurrence_Of (Standard_Integer, Loc)));
-- Pos := Prefix'Length;
@@ -765,29 +757,29 @@ package body Exp_Util is
Expression =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
- Prefix => New_Occurrence_Of (Prefix, Loc),
- Expressions =>
- New_List (Make_Integer_Literal (Loc, 1)))));
+ Prefix => New_Occurrence_Of (Prefix, Loc),
+ Expressions => New_List (Make_Integer_Literal (Loc, 1)))));
-- Res (1 .. Pos) := Prefix;
Append_To (Stats,
- Make_Assignment_Statement (Loc,
- Name => Make_Slice (Loc,
- Prefix => New_Occurrence_Of (Res, Loc),
+ Make_Assignment_Statement (Loc,
+ Name =>
+ Make_Slice (Loc,
+ Prefix => New_Occurrence_Of (Res, Loc),
Discrete_Range =>
Make_Range (Loc,
- Low_Bound => Make_Integer_Literal (Loc, 1),
+ Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => New_Occurrence_Of (Pos, Loc))),
- Expression => New_Occurrence_Of (Prefix, Loc)));
+ Expression => New_Occurrence_Of (Prefix, Loc)));
Append_To (Stats,
Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Pos, Loc),
+ Name => New_Occurrence_Of (Pos, Loc),
Expression =>
Make_Op_Add (Loc,
- Left_Opnd => New_Occurrence_Of (Pos, Loc),
+ Left_Opnd => New_Occurrence_Of (Pos, Loc),
Right_Opnd => Make_Integer_Literal (Loc, 1))));
end Build_Task_Image_Prefix;
@@ -809,7 +801,7 @@ package body Exp_Util is
Res : Entity_Id;
-- String to hold result
- Pref : Entity_Id;
+ Pref : constant Entity_Id := Make_Temporary (Loc, 'P');
-- Name of enclosing variable, prefix of resulting name
Sum : Node_Id;
@@ -822,8 +814,6 @@ package body Exp_Util is
Stats : constant List_Id := New_List;
begin
- Pref := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
-
-- For a dynamic task, the name comes from the target variable.
-- For a static one it is a formal of the enclosing init proc.
@@ -845,15 +835,15 @@ package body Exp_Util is
Name => Make_Identifier (Loc, Name_uTask_Name)));
end if;
- Sel := Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
+ Sel := Make_Temporary (Loc, 'S');
Get_Name_String (Chars (Selector_Name (Id_Ref)));
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Sel,
- Object_Definition => New_Occurrence_Of (Standard_String, Loc),
- Expression =>
+ Object_Definition => New_Occurrence_Of (Standard_String, Loc),
+ Expression =>
Make_String_Literal (Loc,
Strval => String_From_Name_Buffer)));
@@ -1300,9 +1290,7 @@ package body Exp_Util is
end if;
else
- T :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ T := Make_Temporary (Loc, 'T');
Insert_Action (N,
Make_Subtype_Declaration (Loc,
@@ -1496,7 +1484,7 @@ package body Exp_Util is
-- Handle access types
if Is_Access_Type (Typ) then
- Typ := Directly_Designated_Type (Typ);
+ Typ := Designated_Type (Typ);
end if;
-- Handle task and protected types implementing interfaces
@@ -1603,7 +1591,7 @@ package body Exp_Util is
-- Handle access types
if Is_Access_Type (Typ) then
- Typ := Directly_Designated_Type (Typ);
+ Typ := Designated_Type (Typ);
end if;
-- Handle class-wide types
@@ -1679,7 +1667,7 @@ package body Exp_Util is
exit when Chars (Op) = Name
and then
(Name /= Name_Op_Eq
- or else Etype (First_Entity (Op)) = Etype (Last_Entity (Op)));
+ or else Etype (First_Formal (Op)) = Etype (Last_Formal (Op)));
Next_Elmt (Prim);
@@ -2016,6 +2004,17 @@ package body Exp_Util is
-- unknown before the ELSE part or after the IF statement.
elsif Nkind (CV) = N_Elsif_Part then
+
+ -- if the Elsif_Part had condition_actions, the elsif has been
+ -- rewritten as a nested if, and the original elsif_part is
+ -- detached from the tree, so there is no way to obtain useful
+ -- information on the current value of the variable.
+ -- Can this be improved ???
+
+ if No (Parent (CV)) then
+ return;
+ end if;
+
Stm := Parent (CV);
-- Before start of ELSIF part
@@ -2116,9 +2115,7 @@ package body Exp_Util is
begin
-- Only consider record types
- if Ekind (Typ) /= E_Record_Type
- and then Ekind (Typ) /= E_Record_Subtype
- then
+ if not Ekind_In (Typ, E_Record_Type, E_Record_Subtype) then
return False;
end if;
@@ -2129,9 +2126,9 @@ package body Exp_Util is
if Ekind (D_Typ) = E_Anonymous_Access_Type
and then
- (Is_Controlled (Directly_Designated_Type (D_Typ))
+ (Is_Controlled (Designated_Type (D_Typ))
or else
- Is_Concurrent_Type (Directly_Designated_Type (D_Typ)))
+ Is_Concurrent_Type (Designated_Type (D_Typ)))
then
return True;
end if;
@@ -2143,6 +2140,37 @@ package body Exp_Util is
return False;
end Has_Controlled_Coextensions;
+ ------------------------
+ -- Has_Address_Clause --
+ ------------------------
+
+ -- Should this function check the private part in a package ???
+
+ function Has_Following_Address_Clause (D : Node_Id) return Boolean is
+ Id : constant Entity_Id := Defining_Identifier (D);
+ Decl : Node_Id;
+
+ begin
+ Decl := Next (D);
+ while Present (Decl) loop
+ if Nkind (Decl) = N_At_Clause
+ and then Chars (Identifier (Decl)) = Chars (Id)
+ then
+ return True;
+
+ elsif Nkind (Decl) = N_Attribute_Definition_Clause
+ and then Chars (Decl) = Name_Address
+ and then Chars (Name (Decl)) = Chars (Id)
+ then
+ return True;
+ end if;
+
+ Next (Decl);
+ end loop;
+
+ return False;
+ end Has_Following_Address_Clause;
+
--------------------
-- Homonym_Number --
--------------------
@@ -2397,6 +2425,28 @@ package body Exp_Util is
end if;
end;
+ -- Alternative of case expression, we place the action in
+ -- the Actions field of the case expression alternative, this
+ -- will be handled when the case expression is expanded.
+
+ when N_Case_Expression_Alternative =>
+ if Present (Actions (P)) then
+ Insert_List_After_And_Analyze
+ (Last (Actions (P)), Ins_Actions);
+ else
+ Set_Actions (P, Ins_Actions);
+ Analyze_List (Then_Actions (P));
+ end if;
+
+ return;
+
+ -- Case of appearing within an Expressions_With_Actions node. We
+ -- prepend the actions to the list of actions already there.
+
+ when N_Expression_With_Actions =>
+ Prepend_List (Ins_Actions, Actions (P));
+ return;
+
-- Case of appearing in the condition of a while expression or
-- elsif. We insert the actions into the Condition_Actions field.
-- They will be moved further out when the while loop or elsif
@@ -2652,6 +2702,7 @@ package body Exp_Util is
N_Access_To_Object_Definition |
N_Aggregate |
N_Allocator |
+ N_Case_Expression |
N_Case_Statement_Alternative |
N_Character_Literal |
N_Compilation_Unit |
@@ -2758,11 +2809,9 @@ package body Exp_Util is
N_Real_Range_Specification |
N_Record_Definition |
N_Reference |
- N_SCIL_Dispatch_Table_Object_Init |
N_SCIL_Dispatch_Table_Tag_Init |
N_SCIL_Dispatching_Call |
N_SCIL_Membership_Test |
- N_SCIL_Tag_Init |
N_Selected_Component |
N_Signed_Integer_Type_Definition |
N_Single_Protected_Declaration |
@@ -3093,16 +3142,23 @@ package body Exp_Util is
end if;
end if;
+ -- The following code is historical, it used to be present but it
+ -- is too cautious, because the front-end does not know the proper
+ -- default alignments for the target. Also, if the alignment is
+ -- not known, the front end can't know in any case! If a copy is
+ -- needed, the back-end will take care of it. This whole section
+ -- including this comment can be removed later ???
+
-- If the component reference is for a record that has a specified
-- alignment, and we either know it is too small, or cannot tell,
- -- then the component may be unaligned
+ -- then the component may be unaligned.
- if Known_Alignment (Etype (P))
- and then Alignment (Etype (P)) < Ttypes.Maximum_Alignment
- and then M > Alignment (Etype (P))
- then
- return True;
- end if;
+ -- if Known_Alignment (Etype (P))
+ -- and then Alignment (Etype (P)) < Ttypes.Maximum_Alignment
+ -- and then M > Alignment (Etype (P))
+ -- then
+ -- return True;
+ -- end if;
-- Case of component clause present which may specify an
-- unaligned position.
@@ -3724,24 +3780,27 @@ package body Exp_Util is
Sizexpr : Node_Id;
begin
- if not Has_Discriminants (Root_Typ) then
+ -- If the root type is already constrained, there are no discriminants
+ -- in the expression.
+
+ if not Has_Discriminants (Root_Typ)
+ or else Is_Constrained (Root_Typ)
+ then
Constr_Root := Root_Typ;
else
- Constr_Root :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Constr_Root := Make_Temporary (Loc, 'R');
-- subtype cstr__n is T (List of discr constraints taken from Exp)
Append_To (List_Def,
Make_Subtype_Declaration (Loc,
Defining_Identifier => Constr_Root,
- Subtype_Indication =>
- Make_Subtype_From_Expr (E, Root_Typ)));
+ Subtype_Indication => Make_Subtype_From_Expr (E, Root_Typ)));
end if;
-- Generate the range subtype declaration
- Range_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('G'));
+ Range_Type := Make_Temporary (Loc, 'G');
if not Is_Interface (Root_Typ) then
@@ -3790,7 +3849,7 @@ package body Exp_Util is
-- subtype str__nn is Storage_Array (rg__x);
- Str_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
+ Str_Type := Make_Temporary (Loc, 'S');
Append_To (List_Def,
Make_Subtype_Declaration (Loc,
Defining_Identifier => Str_Type,
@@ -3807,7 +3866,7 @@ package body Exp_Util is
-- E : Str_Type;
-- end Equiv_T;
- Equiv_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ Equiv_Type := Make_Temporary (Loc, 'T');
Set_Ekind (Equiv_Type, E_Record_Type);
Set_Parent_Subtype (Equiv_Type, Constr_Root);
@@ -3832,9 +3891,7 @@ package body Exp_Util is
Append_To (Comp_List,
Make_Component_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('C')),
+ Defining_Identifier => Make_Temporary (Loc, 'C'),
Component_Definition =>
Make_Component_Definition (Loc,
Aliased_Present => False,
@@ -3960,15 +4017,12 @@ package body Exp_Util is
-- actual or an explicit subtype.
Utyp := Underlying_Type (Base_Type (Unc_Typ));
- Full_Subtyp := Make_Defining_Identifier (Loc,
- New_Internal_Name ('C'));
+ Full_Subtyp := Make_Temporary (Loc, 'C');
Full_Exp :=
- Unchecked_Convert_To
- (Utyp, Duplicate_Subexpr_No_Checks (E));
+ Unchecked_Convert_To (Utyp, Duplicate_Subexpr_No_Checks (E));
Set_Parent (Full_Exp, Parent (E));
- Priv_Subtyp :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ Priv_Subtyp := Make_Temporary (Loc, 'P');
Insert_Action (E,
Make_Subtype_Declaration (Loc,
@@ -4027,6 +4081,20 @@ package body Exp_Util is
-- additional intermediate type to handle the assignment).
if Expander_Active and then Tagged_Type_Expansion then
+
+ -- If this is the class_wide type of a completion that is
+ -- a record subtype, set the type of the class_wide type
+ -- to be the full base type, for use in the expanded code
+ -- for the equivalent type. Should this be done earlier when
+ -- the completion is analyzed ???
+
+ if Is_Private_Type (Etype (Unc_Typ))
+ and then
+ Ekind (Full_View (Etype (Unc_Typ))) = E_Record_Subtype
+ then
+ Set_Etype (Unc_Typ, Base_Type (Full_View (Etype (Unc_Typ))));
+ end if;
+
EQ_Typ := Make_CW_Equivalent_Type (Unc_Typ, E);
end if;
@@ -4391,9 +4459,7 @@ package body Exp_Util is
-- already rewritten a variable node with a constant as
-- a result of an earlier Force_Evaluation call.
- if Ekind (Entity (N)) = E_Constant
- or else Ekind (Entity (N)) = E_In_Parameter
- then
+ if Ekind_In (Entity (N), E_Constant, E_In_Parameter) then
return True;
-- Functions are not side effect free
@@ -4631,14 +4697,15 @@ package body Exp_Util is
Scope_Suppress := (others => True);
-- If it is a scalar type and we need to capture the value, just make
- -- a copy. Likewise for a function call, an attribute reference or an
- -- operator. And if we have a volatile reference and Name_Req is not
- -- set (see comments above for Side_Effect_Free).
+ -- a copy. Likewise for a function call, an attribute reference, an
+ -- allocator, or an operator. And if we have a volatile reference and
+ -- Name_Req is not set (see comments above for Side_Effect_Free).
if Is_Elementary_Type (Exp_Type)
and then (Variable_Ref
or else Nkind (Exp) = N_Function_Call
or else Nkind (Exp) = N_Attribute_Reference
+ or else Nkind (Exp) = N_Allocator
or else Nkind (Exp) in N_Op
or else (not Name_Req and then Is_Volatile_Reference (Exp)))
then
@@ -4653,15 +4720,6 @@ package body Exp_Util is
Constant_Present => True,
Expression => Relocate_Node (Exp));
- -- Check if the previous node relocation requires readjustment of
- -- some SCIL Dispatching node.
-
- if Generate_SCIL
- and then Nkind (Exp) = N_Function_Call
- then
- Adjust_SCIL_Node (Exp, Expression (E));
- end if;
-
Set_Assignment_OK (E);
Insert_Action (Exp, E);
@@ -4823,15 +4881,6 @@ package body Exp_Util is
Object_Definition => New_Occurrence_Of (Exp_Type, Loc),
Expression => Relocate_Node (Exp));
- -- Check if the previous node relocation requires readjustment
- -- of some SCIL Dispatching node.
-
- if Generate_SCIL
- and then Nkind (Exp) = N_Function_Call
- then
- Adjust_SCIL_Node (Exp, Expression (Decl));
- end if;
-
Insert_Action (Exp, Decl);
Set_Etype (Obj, Exp_Type);
Rewrite (Exp, New_Occurrence_Of (Obj, Loc));
@@ -4839,7 +4888,7 @@ package body Exp_Util is
end;
end if;
- Ref_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Ref_Type := Make_Temporary (Loc, 'A');
Ptr_Typ_Decl :=
Make_Full_Type_Declaration (Loc,
@@ -4891,15 +4940,6 @@ package body Exp_Util is
Defining_Identifier => Def_Id,
Object_Definition => New_Reference_To (Ref_Type, Loc),
Expression => New_Exp));
-
- -- Check if the previous node relocation requires readjustment
- -- of some SCIL Dispatching node.
-
- if Generate_SCIL
- and then Nkind (Exp) = N_Function_Call
- then
- Adjust_SCIL_Node (Exp, Prefix (New_Exp));
- end if;
end if;
-- Preserve the Assignment_OK flag in all copies, since at least
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 1f3c9e8a211..b036338da97 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -444,6 +444,11 @@ package Exp_Util is
-- Determine whether a record type has anonymous access discriminants with
-- a controlled designated type.
+ function Has_Following_Address_Clause (D : Node_Id) return Boolean;
+ -- D is the node for an object declaration. This function searches the
+ -- current declarative part to look for an address clause for the object
+ -- being declared, and returns True if one is found.
+
function Homonym_Number (Subp : Entity_Id) return Nat;
-- Here subp is the entity for a subprogram. This routine returns the
-- homonym number used to disambiguate overloaded subprograms in the same
diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb
index 674137df1da..cc2122dd6e6 100644
--- a/gcc/ada/expander.adb
+++ b/gcc/ada/expander.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -163,6 +163,9 @@ package body Expander is
when N_Block_Statement =>
Expand_N_Block_Statement (N);
+ when N_Case_Expression =>
+ Expand_N_Case_Expression (N);
+
when N_Case_Statement =>
Expand_N_Case_Statement (N);
@@ -470,7 +473,6 @@ package body Expander is
Debug_A_Exit ("expanding ", N, " (done)");
end if;
-
end Expand;
---------------------------
diff --git a/gcc/ada/fmap.adb b/gcc/ada/fmap.adb
index 8de27ec6b7e..171f7a18e7d 100644
--- a/gcc/ada/fmap.adb
+++ b/gcc/ada/fmap.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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,7 +29,10 @@ with Output; use Output;
with Table;
with Types; use Types;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.OS_Lib; use System.OS_Lib;
+pragma Warnings (On);
with Unchecked_Conversion;
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index c9639361ec0..584ec944058 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -36,6 +36,7 @@ with Exp_Pakd; use Exp_Pakd;
with Exp_Util; use Exp_Util;
with Exp_Tss; use Exp_Tss;
with Layout; use Layout;
+with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
@@ -203,12 +204,64 @@ package body Freeze is
New_S : Entity_Id;
After : in out Node_Id)
is
- Body_Node : constant Node_Id := Build_Renamed_Body (Decl, New_S);
+ Body_Decl : constant Node_Id := Unit_Declaration_Node (New_S);
+ Ent : constant Entity_Id := Defining_Entity (Decl);
+ Body_Node : Node_Id;
+ Renamed_Subp : Entity_Id;
+
begin
- Insert_After (After, Body_Node);
- Mark_Rewrite_Insertion (Body_Node);
- Analyze (Body_Node);
- After := Body_Node;
+ -- If the renamed subprogram is intrinsic, there is no need for a
+ -- wrapper body: we set the alias that will be called and expanded which
+ -- completes the declaration. This transformation is only legal if the
+ -- renamed entity has already been elaborated.
+
+ -- Note that it is legal for a renaming_as_body to rename an intrinsic
+ -- subprogram, as long as the renaming occurs before the new entity
+ -- is frozen. See RM 8.5.4 (5).
+
+ if Nkind (Body_Decl) = N_Subprogram_Renaming_Declaration
+ and then Is_Entity_Name (Name (Body_Decl))
+ then
+ Renamed_Subp := Entity (Name (Body_Decl));
+ else
+ Renamed_Subp := Empty;
+ end if;
+
+ if Present (Renamed_Subp)
+ and then Is_Intrinsic_Subprogram (Renamed_Subp)
+ and then
+ (not In_Same_Source_Unit (Renamed_Subp, Ent)
+ or else Sloc (Renamed_Subp) < Sloc (Ent))
+
+ -- We can make the renaming entity intrisic if the renamed function
+ -- has an interface name, or if it is one of the shift/rotate
+ -- operations known to the compiler.
+
+ and then (Present (Interface_Name (Renamed_Subp))
+ or else Chars (Renamed_Subp) = Name_Rotate_Left
+ or else Chars (Renamed_Subp) = Name_Rotate_Right
+ or else Chars (Renamed_Subp) = Name_Shift_Left
+ or else Chars (Renamed_Subp) = Name_Shift_Right
+ or else Chars (Renamed_Subp) = Name_Shift_Right_Arithmetic)
+ then
+ Set_Interface_Name (Ent, Interface_Name (Renamed_Subp));
+
+ if Present (Alias (Renamed_Subp)) then
+ Set_Alias (Ent, Alias (Renamed_Subp));
+ else
+ Set_Alias (Ent, Renamed_Subp);
+ end if;
+
+ Set_Is_Intrinsic_Subprogram (Ent);
+ Set_Has_Completion (Ent);
+
+ else
+ Body_Node := Build_Renamed_Body (Decl, New_S);
+ Insert_After (After, Body_Node);
+ Mark_Rewrite_Insertion (Body_Node);
+ Analyze (Body_Node);
+ After := Body_Node;
+ end if;
end Build_And_Analyze_Renamed_Body;
------------------------
@@ -220,12 +273,12 @@ package body Freeze is
New_S : Entity_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (New_S);
- -- We use for the source location of the renamed body, the location
- -- of the spec entity. It might seem more natural to use the location
- -- of the renaming declaration itself, but that would be wrong, since
- -- then the body we create would look as though it was created far
- -- too late, and this could cause problems with elaboration order
- -- analysis, particularly in connection with instantiations.
+ -- We use for the source location of the renamed body, the location of
+ -- the spec entity. It might seem more natural to use the location of
+ -- the renaming declaration itself, but that would be wrong, since then
+ -- the body we create would look as though it was created far too late,
+ -- and this could cause problems with elaboration order analysis,
+ -- particularly in connection with instantiations.
N : constant Node_Id := Unit_Declaration_Node (New_S);
Nam : constant Node_Id := Name (N);
@@ -301,18 +354,16 @@ package body Freeze is
Call_Name := New_Copy (Name (N));
end if;
- -- The original name may have been overloaded, but
- -- is fully resolved now.
+ -- Original name may have been overloaded, but is fully resolved now
Set_Is_Overloaded (Call_Name, False);
end if;
-- For simple renamings, subsequent calls can be expanded directly as
- -- called to the renamed entity. The body must be generated in any case
- -- for calls they may appear elsewhere.
+ -- calls to the renamed entity. The body must be generated in any case
+ -- for calls that may appear elsewhere.
- if (Ekind (Old_S) = E_Function
- or else Ekind (Old_S) = E_Procedure)
+ if Ekind_In (Old_S, E_Function, E_Procedure)
and then Nkind (Decl) = N_Subprogram_Declaration
then
Set_Body_To_Inline (Decl, Old_S);
@@ -331,7 +382,6 @@ package body Freeze is
Form_Type : constant Entity_Id := Etype (First_Formal (Old_S));
begin
-
-- The controlling formal may be an access parameter, or the
-- actual may be an access value, so adjust accordingly.
@@ -380,10 +430,8 @@ package body Freeze is
if Present (Formal) then
O_Formal := First_Formal (Old_S);
Param_Spec := First (Parameter_Specifications (Spec));
-
while Present (Formal) loop
if Is_Entry (Old_S) then
-
if Nkind (Parameter_Type (Param_Spec)) /=
N_Access_Definition
then
@@ -446,7 +494,6 @@ package body Freeze is
Make_Defining_Identifier (Loc, Chars => Chars (New_S)));
Param_Spec := First (Parameter_Specifications (Spec));
-
while Present (Param_Spec) loop
Set_Defining_Identifier (Param_Spec,
Make_Defining_Identifier (Loc,
@@ -515,27 +562,20 @@ package body Freeze is
if (No (Expression (Decl))
and then not Needs_Finalization (Typ)
- and then
- (not Has_Non_Null_Base_Init_Proc (Typ)
- or else Is_Imported (E)))
-
- or else
- (Present (Expression (Decl))
- and then Is_Scalar_Type (Typ))
-
- or else
- Is_Access_Type (Typ)
-
+ and then (not Has_Non_Null_Base_Init_Proc (Typ)
+ or else Is_Imported (E)))
+ or else (Present (Expression (Decl)) and then Is_Scalar_Type (Typ))
+ or else Is_Access_Type (Typ)
or else
(Is_Bit_Packed_Array (Typ)
- and then
- Is_Modular_Integer_Type (Packed_Array_Type (Typ)))
+ and then Is_Modular_Integer_Type (Packed_Array_Type (Typ)))
then
null;
-- Otherwise, we require the address clause to be constant because
-- the call to the initialization procedure (or the attach code) has
-- to happen at the point of the declaration.
+
-- Actually the IP call has been moved to the freeze actions
-- anyway, so maybe we can relax this restriction???
@@ -551,7 +591,36 @@ package body Freeze is
end if;
end if;
- if not Error_Posted (Expr)
+ -- If Rep_Clauses are to be ignored, remove address clause from
+ -- list attached to entity, because it may be illegal for gigi,
+ -- for example by breaking order of elaboration..
+
+ if Ignore_Rep_Clauses then
+ declare
+ Rep : Node_Id;
+
+ begin
+ Rep := First_Rep_Item (E);
+
+ if Rep = Addr then
+ Set_First_Rep_Item (E, Next_Rep_Item (Addr));
+
+ else
+ while Present (Rep)
+ and then Next_Rep_Item (Rep) /= Addr
+ loop
+ Rep := Next_Rep_Item (Rep);
+ end loop;
+ end if;
+
+ if Present (Rep) then
+ Set_Next_Rep_Item (Rep, Next_Rep_Item (Addr));
+ end if;
+ end;
+
+ Rewrite (Addr, Make_Null_Statement (Sloc (E)));
+
+ elsif not Error_Posted (Expr)
and then not Needs_Finalization (Typ)
then
Warn_Overlay (Expr, Typ, Name (Addr));
@@ -789,7 +858,7 @@ package body Freeze is
and then Present (Parent (T))
and then Nkind (Parent (T)) = N_Full_Type_Declaration
and then Nkind (Type_Definition (Parent (T))) =
- N_Record_Definition
+ N_Record_Definition
and then not Null_Present (Type_Definition (Parent (T)))
and then Present (Variant_Part
(Component_List (Type_Definition (Parent (T)))))
@@ -801,8 +870,7 @@ package body Freeze is
if not Is_Constrained (T)
and then
- No (Discriminant_Default_Value
- (First_Discriminant (T)))
+ No (Discriminant_Default_Value (First_Discriminant (T)))
and then Unknown_Esize (T)
then
return False;
@@ -1145,10 +1213,7 @@ package body Freeze is
if Nkind_In (Par, N_Object_Declaration, N_Assignment_Statement)
and then Comes_From_Source (Par)
then
- Temp :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('T'));
-
+ Temp := Make_Temporary (Loc, 'T', E);
New_N :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
@@ -1191,10 +1256,7 @@ package body Freeze is
-- Freeze_All_Ent --
--------------------
- procedure Freeze_All_Ent
- (From : Entity_Id;
- After : in out Node_Id)
- is
+ procedure Freeze_All_Ent (From : Entity_Id; After : in out Node_Id) is
E : Entity_Id;
Flist : List_Id;
Lastn : Node_Id;
@@ -1277,7 +1339,6 @@ package body Freeze is
begin
Prim := First_Elmt (Prim_List);
-
while Present (Prim) loop
Subp := Node (Prim);
@@ -1312,11 +1373,11 @@ package body Freeze is
Bod : constant Node_Id := Next (After);
begin
- if (Nkind (Bod) = N_Subprogram_Body
- or else Nkind (Bod) = N_Entry_Body
- or else Nkind (Bod) = N_Package_Body
- or else Nkind (Bod) = N_Protected_Body
- or else Nkind (Bod) = N_Task_Body
+ if (Nkind_In (Bod, N_Subprogram_Body,
+ N_Entry_Body,
+ N_Package_Body,
+ N_Protected_Body,
+ N_Task_Body)
or else Nkind (Bod) in N_Body_Stub)
and then
List_Containing (After) = List_Containing (Parent (E))
@@ -1343,6 +1404,9 @@ package body Freeze is
-- point at which such functions are constructed (after all types that
-- might be used in such expressions have been frozen).
+ -- For subprograms that are renaming_as_body, we create the wrapper
+ -- bodies as needed.
+
-- We also add finalization chains to access types whose designated
-- types are controlled. This is normally done when freezing the type,
-- but this misses recursive type definitions where the later members
@@ -1383,11 +1447,10 @@ package body Freeze is
then
declare
Ent : Entity_Id;
+
begin
Ent := First_Entity (E);
-
while Present (Ent) loop
-
if Is_Entry (Ent)
and then not Default_Expressions_Processed (Ent)
then
@@ -1776,7 +1839,7 @@ package body Freeze is
Prev := Empty;
while Present (Comp) loop
- -- First handle the (real) component case
+ -- First handle the component case
if Ekind (Comp) = E_Component
or else Ekind (Comp) = E_Discriminant
@@ -1847,129 +1910,12 @@ package body Freeze is
Component_Name (Component_Clause (Comp)));
end if;
end if;
-
- -- If component clause is present, then deal with the non-
- -- default bit order case for Ada 95 mode. The required
- -- processing for Ada 2005 mode is handled separately after
- -- processing all components.
-
- -- We only do this processing for the base type, and in
- -- fact that's important, since otherwise if there are
- -- record subtypes, we could reverse the bits once for
- -- each subtype, which would be incorrect.
-
- if Present (CC)
- and then Reverse_Bit_Order (Rec)
- and then Ekind (E) = E_Record_Type
- and then Ada_Version <= Ada_95
- then
- declare
- CFB : constant Uint := Component_Bit_Offset (Comp);
- CSZ : constant Uint := Esize (Comp);
- CLC : constant Node_Id := Component_Clause (Comp);
- Pos : constant Node_Id := Position (CLC);
- FB : constant Node_Id := First_Bit (CLC);
-
- Storage_Unit_Offset : constant Uint :=
- CFB / System_Storage_Unit;
-
- Start_Bit : constant Uint :=
- CFB mod System_Storage_Unit;
-
- begin
- -- Cases where field goes over storage unit boundary
-
- if Start_Bit + CSZ > System_Storage_Unit then
-
- -- Allow multi-byte field but generate warning
-
- if Start_Bit mod System_Storage_Unit = 0
- and then CSZ mod System_Storage_Unit = 0
- then
- Error_Msg_N
- ("multi-byte field specified with non-standard"
- & " Bit_Order?", CLC);
-
- if Bytes_Big_Endian then
- Error_Msg_N
- ("bytes are not reversed "
- & "(component is big-endian)?", CLC);
- else
- Error_Msg_N
- ("bytes are not reversed "
- & "(component is little-endian)?", CLC);
- end if;
-
- -- Do not allow non-contiguous field
-
- else
- Error_Msg_N
- ("attempt to specify non-contiguous field "
- & "not permitted", CLC);
- Error_Msg_N
- ("\caused by non-standard Bit_Order "
- & "specified", CLC);
- Error_Msg_N
- ("\consider possibility of using "
- & "Ada 2005 mode here", CLC);
- end if;
-
- -- Case where field fits in one storage unit
-
- else
- -- Give warning if suspicious component clause
-
- if Intval (FB) >= System_Storage_Unit
- and then Warn_On_Reverse_Bit_Order
- then
- Error_Msg_N
- ("?Bit_Order clause does not affect " &
- "byte ordering", Pos);
- Error_Msg_Uint_1 :=
- Intval (Pos) + Intval (FB) /
- System_Storage_Unit;
- Error_Msg_N
- ("?position normalized to ^ before bit " &
- "order interpreted", Pos);
- end if;
-
- -- Here is where we fix up the Component_Bit_Offset
- -- value to account for the reverse bit order.
- -- Some examples of what needs to be done are:
-
- -- First_Bit .. Last_Bit Component_Bit_Offset
- -- old new old new
-
- -- 0 .. 0 7 .. 7 0 7
- -- 0 .. 1 6 .. 7 0 6
- -- 0 .. 2 5 .. 7 0 5
- -- 0 .. 7 0 .. 7 0 4
-
- -- 1 .. 1 6 .. 6 1 6
- -- 1 .. 4 3 .. 6 1 3
- -- 4 .. 7 0 .. 3 4 0
-
- -- The general rule is that the first bit is
- -- is obtained by subtracting the old ending bit
- -- from storage_unit - 1.
-
- Set_Component_Bit_Offset
- (Comp,
- (Storage_Unit_Offset * System_Storage_Unit) +
- (System_Storage_Unit - 1) -
- (Start_Bit + CSZ - 1));
-
- Set_Normalized_First_Bit
- (Comp,
- Component_Bit_Offset (Comp) mod
- System_Storage_Unit);
- end if;
- end;
- end if;
end;
end if;
- -- Gather data for possible Implicit_Packing later
+ -- Gather data for possible Implicit_Packing later. Note that at
+ -- this stage we might be dealing with a real component, or with
+ -- an implicit subtype declaration.
if not Is_Scalar_Type (Etype (Comp)) then
All_Scalar_Components := False;
@@ -1982,12 +1928,12 @@ package body Freeze is
-- If the component is an Itype with Delayed_Freeze and is either
-- a record or array subtype and its base type has not yet been
- -- frozen, we must remove this from the entity list of this
- -- record and put it on the entity list of the scope of its base
- -- type. Note that we know that this is not the type of a
- -- component since we cleared Has_Delayed_Freeze for it in the
- -- previous loop. Thus this must be the Designated_Type of an
- -- access type, which is the type of a component.
+ -- frozen, we must remove this from the entity list of this record
+ -- and put it on the entity list of the scope of its base type.
+ -- Note that we know that this is not the type of a component
+ -- since we cleared Has_Delayed_Freeze for it in the previous
+ -- loop. Thus this must be the Designated_Type of an access type,
+ -- which is the type of a component.
if Is_Itype (Comp)
and then Is_Type (Scope (Comp))
@@ -2118,25 +2064,35 @@ package body Freeze is
Next_Entity (Comp);
end loop;
- -- Deal with pragma Bit_Order
+ -- Deal with pragma Bit_Order setting non-standard bit order
if Reverse_Bit_Order (Rec) and then Base_Type (Rec) = Rec then
if not Placed_Component then
ADC :=
Get_Attribute_Definition_Clause (Rec, Attribute_Bit_Order);
- 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);
- -- Here is where we do Ada 2005 processing for bit order (the Ada
- -- 95 case was already taken care of above).
+ -- Here is where we do the processing for reversed bit order
- elsif Ada_Version >= Ada_05 then
+ else
Adjust_Record_For_Reverse_Bit_Order (Rec);
end if;
end if;
+ -- Complete error checking on record representation clause (e.g.
+ -- overlap of components). This is called after adjusting the
+ -- record for reverse bit order.
+
+ declare
+ RRC : constant Node_Id := Get_Record_Representation_Clause (Rec);
+ begin
+ if Present (RRC) then
+ Check_Record_Representation_Clause (RRC);
+ end if;
+ end;
+
-- Set OK_To_Reorder_Components depending on debug flags
if Rec = Base_Type (Rec)
@@ -2172,7 +2128,7 @@ package body Freeze is
-- Give warning if redundant constructs warnings on
if Warn_On_Redundant_Constructs then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?pragma Pack has no effect, no unplaced components",
Get_Rep_Pragma (Rec, Name_Pack));
end if;
@@ -2341,9 +2297,9 @@ package body Freeze is
declare
Sz : constant Node_Id := Size_Clause (Rec);
begin
- Error_Msg_NE -- CODEFIX
+ Error_Msg_NE -- CODEFIX
("size given for& too small", Sz, Rec);
- Error_Msg_N -- CODEFIX
+ Error_Msg_N -- CODEFIX
("\use explicit pragma Pack "
& "or use pragma Implicit_Packing", Sz);
end;
@@ -2400,6 +2356,7 @@ package body Freeze is
S : Entity_Id := Current_Scope;
begin
+
while Present (S) loop
if Is_Overloadable (S) then
if Comes_From_Source (S)
@@ -2461,8 +2418,8 @@ package body Freeze is
-- Skip this if the entity is stubbed, since we don't need a name
-- for any stubbed routine. For the case on intrinsics, if no
-- external name is specified, then calls will be handled in
- -- Exp_Intr.Expand_Intrinsic_Call, and no name is needed; if
- -- an external name is provided, then Expand_Intrinsic_Call leaves
+ -- Exp_Intr.Expand_Intrinsic_Call, and no name is needed. If an
+ -- external name is provided, then Expand_Intrinsic_Call leaves
-- calls in place for expansion by GIGI.
if (Is_Imported (E) or else Is_Exported (E))
@@ -2572,8 +2529,7 @@ 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?", Formal);
Error_Msg_N
("\use appropriate corresponding type in C "
& "(e.g. char)?", Formal);
@@ -2840,7 +2796,8 @@ package body Freeze is
Object_Definition (Parent (E)));
if Is_CPP_Class (Etype (E)) then
- Error_Msg_NE ("\} may need a cpp_constructor",
+ Error_Msg_NE
+ ("\} may need a cpp_constructor",
Object_Definition (Parent (E)), Etype (E));
end if;
end if;
@@ -3120,7 +3077,7 @@ package body Freeze is
else
Error_Msg_NE
("size given for& too small", SZ, E);
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\use explicit pragma Pack "
& "or use pragma Implicit_Packing", SZ);
end if;
@@ -4244,8 +4201,8 @@ package body Freeze is
-- exiting from the loop when it is appropriate to insert the freeze
-- node before the current node P.
- -- Also checks som special exceptions to the freezing rules. These cases
- -- result in a direct return, bypassing the freeze action.
+ -- Also checks some special exceptions to the freezing rules. These
+ -- cases result in a direct return, bypassing the freeze action.
P := N;
loop
@@ -4422,6 +4379,8 @@ package body Freeze is
N_Entry_Call_Alternative |
N_Triggering_Alternative |
N_Abortable_Part |
+ N_And_Then |
+ N_Or_Else |
N_Freeze_Entity =>
exit when Is_List_Member (P);
@@ -4510,8 +4469,8 @@ package body Freeze is
Scope_Stack.Table (Pos).Pending_Freeze_Actions :=
Freeze_Nodes;
else
- Append_List (Freeze_Nodes, Scope_Stack.Table
- (Pos).Pending_Freeze_Actions);
+ Append_List (Freeze_Nodes,
+ Scope_Stack.Table (Pos).Pending_Freeze_Actions);
end if;
end if;
end;
@@ -5413,6 +5372,26 @@ package body Freeze is
return True;
end;
+ -- For the designated type of an access to subprogram, all types in
+ -- the profile must be fully defined.
+
+ elsif Ekind (T) = E_Subprogram_Type then
+ declare
+ F : Entity_Id;
+
+ begin
+ F := First_Formal (T);
+ while Present (F) loop
+ if not Is_Fully_Defined (Etype (F)) then
+ return False;
+ end if;
+
+ Next_Formal (F);
+ end loop;
+
+ return Is_Fully_Defined (Etype (T));
+ end;
+
else
return not Is_Private_Type (T)
or else Present (Full_View (Base_Type (T)));
@@ -5523,8 +5502,7 @@ package body Freeze is
-- involve secondary stack expansion.
else
- Dnam :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
+ Dnam := Make_Temporary (Loc, 'D');
Dbody :=
Make_Subprogram_Body (Loc,
@@ -5659,16 +5637,18 @@ package body Freeze is
-- We only give the warning for non-imported entities of a type for
-- which a non-null base init proc is defined, or for objects of access
- -- types with implicit null initialization, or when Initialize_Scalars
+ -- types with implicit null initialization, or when Normalize_Scalars
-- applies and the type is scalar or a string type (the latter being
-- tested for because predefined String types are initialized by inline
- -- code rather than by an init_proc).
+ -- code rather than by an init_proc). Note that we do not give the
+ -- warning for Initialize_Scalars, since we suppressed initialization
+ -- in this case.
if Present (Expr)
and then not Is_Imported (Ent)
and then (Has_Non_Null_Base_Init_Proc (Typ)
or else Is_Access_Type (Typ)
- or else (Init_Or_Norm_Scalars
+ or else (Normalize_Scalars
and then (Is_Scalar_Type (Typ)
or else Is_String_Type (Typ))))
then
diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
index 89746b88035..fb5eb4319f1 100644
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -60,6 +60,7 @@ with Sem_Warn; use Sem_Warn;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Sinput.L; use Sinput.L;
+with SCIL_LL; use SCIL_LL;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Types; use Types;
@@ -89,6 +90,10 @@ begin
Sem_Warn.Initialize;
Prep.Initialize;
+ if Generate_SCIL then
+ SCIL_LL.Initialize;
+ end if;
+
-- Create package Standard
CStand.Create_Standard;
diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads
index 8752ddcff5f..cea2e7b12e8 100644
--- a/gcc/ada/g-comlin.ads
+++ b/gcc/ada/g-comlin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2009, AdaCore --
+-- Copyright (C) 1999-2010, AdaCore --
-- --
-- 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- --
@@ -106,12 +106,12 @@
-- end loop;
-- end;
--- The example above have shown how to parse the command line when the
--- arguments are read directly from Ada.Command_Line. However, these arguments
--- can also be read from a list of strings. This can be useful in several
--- contexts, either because your system does not support Ada.Command_Line, or
--- because you are manipulating other tools and creating their command line by
--- hand, or for any other reason.
+-- The examples above show how to parse the command line when the arguments
+-- are read directly from Ada.Command_Line. However, these arguments can also
+-- be read from a list of strings. This can be useful in several contexts,
+-- either because your system does not support Ada.Command_Line, or because
+-- you are manipulating other tools and creating their command lines by hand,
+-- or for any other reason.
-- To create the list of strings, it is recommended to use
-- GNAT.OS_Lib.Argument_String_To_List.
@@ -140,10 +140,10 @@
-- adding or removing arguments from them. The resulting command line is kept
-- as short as possible by coalescing arguments whenever possible.
--- Complex command lines can thus be constructed, for example from an GUI
+-- Complex command lines can thus be constructed, for example from a GUI
-- (although this package does not by itself depend upon any specific GUI
--- toolkit). For instance, if you are configuring the command line to use
--- when spawning a tool with the following characteristics:
+-- toolkit). For instance, if you are configuring the command line to use when
+-- spawning a tool with the following characteristics:
-- * Specifying -gnatwa is the same as specifying -gnatwu -gnatwv, but
-- shorter and more readable
@@ -298,7 +298,7 @@ package GNAT.Command_Line is
-- as a switch (returned by getopt), otherwise it will be considered
-- as a normal argument (returned by Get_Argument).
--
- -- If SECTION_DELIMITERS is set, then every following subprogram
+ -- If Section_Delimiters is set, then every following subprogram
-- (Getopt and Get_Argument) will only operate within a section, which
-- is delimited by any of these delimiters or the end of the command line.
--
@@ -306,9 +306,9 @@ package GNAT.Command_Line is
-- Initialize_Option_Scan (Section_Delimiters => "largs bargs cargs");
--
-- Arguments on command line : my_application -c -bargs -d -e -largs -f
- -- This line is made of three section, the first one is the default one
+ -- This line contains three sections, the first one is the default one
-- and includes only the '-c' switch, the second one is between -bargs
- -- and -largs and includes '-d -e' and the last one includes '-f'
+ -- and -largs and includes '-d -e' and the last one includes '-f'.
procedure Free (Parser : in out Opt_Parser);
-- Free the memory used by the parser. Calling this is not mandatory for
@@ -317,16 +317,18 @@ package GNAT.Command_Line is
procedure Goto_Section
(Name : String := "";
Parser : Opt_Parser := Command_Line_Parser);
- -- Change the current section. The next Getopt of Get_Argument will start
+ -- Change the current section. The next Getopt or Get_Argument will start
-- looking at the beginning of the section. An empty name ("") refers to
-- the first section between the program name and the first section
- -- delimiter. If the section does not exist, then Invalid_Section is
- -- raised.
+ -- delimiter. If the section does not exist in Section_Delimiters, then
+ -- Invalid_Section is raised. If the section does not appear on the command
+ -- line, then it is treated as an empty section.
function Full_Switch
(Parser : Opt_Parser := Command_Line_Parser) return String;
- -- Returns the full name of the last switch found (Getopt only returns
- -- the first character)
+ -- Returns the full name of the last switch found (Getopt only returns the
+ -- first character). Does not include the Switch_Char ('-' by default),
+ -- unless the "*" option of Getopt is used (see below).
function Getopt
(Switches : String;
@@ -336,13 +338,13 @@ package GNAT.Command_Line is
-- switch character followed by a character within Switches, casing being
-- significant). The result returned is the first character of the switch
-- that is located. If there are no more switches in the current section,
- -- returns ASCII.NUL. If Concatenate is True (by default), the switches
- -- does not need to be separated by spaces (they can be concatenated if
- -- they do not require an argument, e.g. -ab is the same as two separate
- -- arguments -a -b).
+ -- returns ASCII.NUL. If Concatenate is True (the default), the switches do
+ -- not need to be separated by spaces (they can be concatenated if they do
+ -- not require an argument, e.g. -ab is the same as two separate arguments
+ -- -a -b).
--
- -- Switches is a string of all the possible switches, separated by a
- -- space. A switch can be followed by one of the following characters:
+ -- Switches is a string of all the possible switches, separated by
+ -- spaces. A switch can be followed by one of the following characters:
--
-- ':' The switch requires a parameter. There can optionally be a space
-- on the command line between the switch and its parameter.
@@ -389,14 +391,14 @@ package GNAT.Command_Line is
-- Example
-- Getopt ("* a b")
-- If the command line is '-a -c toto.o -b', Getopt will return
- -- successively 'a', '*', '*' and 'b'. When '*' is returned,
- -- Full_Switch returns the corresponding item on the command line.
+ -- successively 'a', '*', '*' and 'b', with Full_Switch returning
+ -- "a", "-c", "toto.o", and "b".
--
-- When Getopt encounters an invalid switch, it raises the exception
-- Invalid_Switch and sets Full_Switch to return the invalid switch.
-- When Getopt cannot find the parameter associated with a switch, it
-- raises Invalid_Parameter, and sets Full_Switch to return the invalid
- -- switch character.
+ -- switch.
--
-- Note: in case of ambiguity, e.g. switches a ab abc, then the longest
-- matching switch is returned.
@@ -416,33 +418,31 @@ package GNAT.Command_Line is
function Get_Argument
(Do_Expansion : Boolean := False;
Parser : Opt_Parser := Command_Line_Parser) return String;
- -- Returns the next element on the command line which is not a switch.
- -- This function should not be called before Getopt has returned
- -- ASCII.NUL.
+ -- Returns the next element on the command line that is not a switch. This
+ -- function should not be called before Getopt has returned ASCII.NUL.
--
- -- If Expansion is True, then the parameter on the command line will be
- -- considered as a filename with wild cards, and will be expanded. The
- -- matching file names will be returned one at a time. When there are no
- -- more arguments on the command line, this function returns an empty
- -- string. This is useful in non-Unix systems for obtaining normal
- -- expansion of wild card references.
+ -- If Do_Expansion is True, then the parameter on the command line will
+ -- be considered as a filename with wild cards, and will be expanded. The
+ -- matching file names will be returned one at a time. This is useful in
+ -- non-Unix systems for obtaining normal expansion of wild card references.
+ -- When there are no more arguments on the command line, this function
+ -- returns an empty string.
function Parameter
(Parser : Opt_Parser := Command_Line_Parser) return String;
- -- Returns the parameter associated with the last switch returned by
- -- Getopt. If no parameter was associated with the last switch, or no
- -- previous call has been made to Get_Argument, raises Invalid_Parameter.
- -- If the last switch was associated with an optional argument and this
- -- argument was not found on the command line, Parameter returns an empty
- -- string.
+ -- Returns parameter associated with the last switch returned by Getopt.
+ -- If no parameter was associated with the last switch, or no previous call
+ -- has been made to Get_Argument, raises Invalid_Parameter. If the last
+ -- switch was associated with an optional argument and this argument was
+ -- not found on the command line, Parameter returns an empty string.
function Separator
(Parser : Opt_Parser := Command_Line_Parser) return Character;
-- The separator that was between the switch and its parameter. This is
- -- of little use in general, only if you want to know exactly what was on
- -- the command line. This is in general a single character, set to
- -- ASCII.NUL if the switch and the parameter were concatenated. A space is
- -- returned if the switch and its argument were in two separate arguments.
+ -- useful if you want to know exactly what was on the command line. This
+ -- is in general a single character, set to ASCII.NUL if the switch and
+ -- the parameter were concatenated. A space is returned if the switch and
+ -- its argument were in two separate arguments.
type Expansion_Iterator is limited private;
-- Type used during expansion of file names
@@ -462,16 +462,15 @@ package GNAT.Command_Line is
-- Subdirectories of Directory will also be searched, up to one
-- hundred levels deep.
--
- -- When Start_Expansion has been called, function Expansion should be
- -- called repeatedly until it returns an empty string, before
+ -- When Start_Expansion has been called, function Expansion should
+ -- be called repeatedly until it returns an empty string, before
-- Start_Expansion can be called again with the same Expansion_Iterator
-- variable.
function Expansion (Iterator : Expansion_Iterator) return String;
-- Returns the next file in the directory matching the parameters given
-- to Start_Expansion and updates Iterator to point to the next entry.
- -- Returns an empty string when there is no more file in the directory
- -- and its subdirectories.
+ -- Returns an empty string when there are no more files.
--
-- If Expansion is called again after an empty string has been returned,
-- then the exception GNAT.Directory_Operations.Directory_Error is raised.
@@ -508,31 +507,31 @@ package GNAT.Command_Line is
(Config : in out Command_Line_Configuration;
Prefix : String);
-- Indicates that all switches starting with the given prefix should be
- -- grouped. For instance, for the GNAT compiler we would define "-gnatw"
- -- as a prefix, so that "-gnatwu -gnatwv" can be grouped into "-gnatwuv"
- -- It is assume that the remaining of the switch ("uv") is a set of
- -- characters whose order is irrelevant. In fact, this package will sort
- -- them alphabetically.
+ -- grouped. For instance, for the GNAT compiler we would define "-gnatw" as
+ -- a prefix, so that "-gnatwu -gnatwv" can be grouped into "-gnatwuv" It is
+ -- assumed that the remainder of the switch ("uv") is a set of characters
+ -- whose order is irrelevant. In fact, this package will sort them
+ -- alphabetically.
procedure Define_Switch
(Config : in out Command_Line_Configuration;
Switch : String);
-- Indicates a new switch. The format of this switch follows the getopt
-- format (trailing ':', '?', etc for defining a switch with parameters).
- -- The switches defined in the command_line_configuration object are used
+ -- The switches defined in the Command_Line_Configuration object are used
-- when ungrouping switches with more that one character after the prefix.
procedure Define_Section
(Config : in out Command_Line_Configuration;
Section : String);
- -- Indicates a new switch section. Every switch belonging to the same
+ -- Indicates a new switch section. All switches belonging to the same
-- section are ordered together, preceded by the section. They are placed
- -- at the end of the command line (as in 'gnatmake somefile.adb -cargs -g')
+ -- at the end of the command line (as in "gnatmake somefile.adb -cargs -g")
function Get_Switches
(Config : Command_Line_Configuration;
Switch_Char : Character) return String;
- -- Get the switches list as expected by getopt. This list is built using
+ -- Get the switches list as expected by Getopt. This list is built using
-- all switches defined previously via Define_Switch above.
procedure Free (Config : in out Command_Line_Configuration);
@@ -562,7 +561,7 @@ package GNAT.Command_Line is
-- version with Switches.
--
-- The parsing of Switches is done through calls to Getopt, by passing
- -- Getopt_Description as an argument. (a "*" is automatically prepended so
+ -- Getopt_Description as an argument. (A "*" is automatically prepended so
-- that all switches and command line arguments are accepted).
--
-- To properly handle switches that take parameters, you should document
@@ -571,8 +570,8 @@ package GNAT.Command_Line is
-- Command_Line_Iterator (which might be fine depending on your
-- application).
--
- -- If the command line has sections (such as -bargs -largs -cargs), then
- -- they should be listed in the Sections parameter (as "-bargs -cargs")
+ -- If the command line has sections (such as -bargs -cargs), then they
+ -- should be listed in the Sections parameter (as "-bargs -cargs").
--
-- This function can be used to reset Cmd by passing an empty string.
@@ -600,16 +599,16 @@ package GNAT.Command_Line is
-- to pass "--check=full" to Remove_Switch as well.
--
-- A Switch with a parameter will never be grouped with another switch to
- -- avoid ambiguities as to who the parameter applies to.
+ -- avoid ambiguities as to what the parameter applies to.
--
-- Separator is the character that goes between the switches and its
-- parameter on the command line. If it is set to ASCII.NUL, then no
- -- separator is applied, and they are concatenated
+ -- separator is applied, and they are concatenated.
--
-- If the switch is part of a section, then it should be specified so that
-- the switch is correctly placed in the command line, and the section
-- added if not already present. For example, to add the -g switch into the
- -- -cargs section, you need to call (Cmd, "-g", Section => "-cargs")
+ -- -cargs section, you need to pass (Cmd, "-g", Section => "-cargs").
--
-- Add_Before allows insertion of the switch at the beginning of the
-- command line.
@@ -667,6 +666,9 @@ package GNAT.Command_Line is
-- Remove a switch with a specific parameter. If Parameter is the empty
-- string, then only a switch with no parameter will be removed.
+ procedure Free (Cmd : in out Command_Line);
+ -- Free the memory used by Cmd
+
---------------
-- Iteration --
---------------
@@ -703,9 +705,6 @@ package GNAT.Command_Line is
procedure Next (Iter : in out Command_Line_Iterator);
-- Move to the next switch
- procedure Free (Cmd : in out Command_Line);
- -- Free the memory used by Cmd
-
private
Max_Depth : constant := 100;
diff --git a/gcc/ada/g-dirope.ads b/gcc/ada/g-dirope.ads
index 7ef84726dc3..32b914bdfe8 100644
--- a/gcc/ada/g-dirope.ads
+++ b/gcc/ada/g-dirope.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2008, AdaCore --
+-- Copyright (C) 1998-2010, AdaCore --
-- --
-- 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- --
@@ -209,8 +209,8 @@ package GNAT.Directory_Operations is
-- Recognize both forms described above.
--
-- System_Default
- -- Uses either UNIX on Unix and OpenVMS systems, or DOS on Windows and
- -- OS/2 depending on the running environment.
+ -- Uses either UNIX on Unix and OpenVMS systems, or DOS on Windows,
+ -- depending on the running environment. What about other OS's???
---------------
-- Iterators --
diff --git a/gcc/ada/g-expect-vms.adb b/gcc/ada/g-expect-vms.adb
index cc413f7248d..4d1a770822a 100644
--- a/gcc/ada/g-expect-vms.adb
+++ b/gcc/ada/g-expect-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2009, AdaCore --
+-- Copyright (C) 2002-2010, AdaCore --
-- --
-- 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- --
@@ -50,6 +50,11 @@ package body GNAT.Expect is
Save_Output : File_Descriptor;
Save_Error : File_Descriptor;
+ Expect_Process_Died : constant Expect_Match := -100;
+ Expect_Internal_Error : constant Expect_Match := -101;
+ -- Additional possible outputs of Expect_Internal. These are not visible in
+ -- the spec because the user will never see them.
+
procedure Expect_Internal
(Descriptors : in out Array_Of_Pd;
Result : out Expect_Match;
@@ -57,11 +62,14 @@ package body GNAT.Expect is
Full_Buffer : Boolean);
-- Internal function used to read from the process Descriptor.
--
- -- Three outputs are possible:
+ -- Several outputs are possible:
-- Result=Expect_Timeout, if no output was available before the timeout
-- expired.
-- Result=Expect_Full_Buffer, if Full_Buffer is True and some characters
-- had to be discarded from the internal buffer of Descriptor.
+ -- Result=Express_Process_Died if one of the processes was terminated.
+ -- That process's Input_Fd is set to Invalid_FD
+ -- Result=Express_Internal_Error
-- Result=<integer>, indicates how many characters were added to the
-- internal buffer. These characters are from indexes
-- Descriptor.Buffer_Index - Result + 1 .. Descriptor.Buffer_Index
@@ -209,7 +217,9 @@ package body GNAT.Expect is
Status : out Integer)
is
begin
- Close (Descriptor.Input_Fd);
+ if Descriptor.Input_Fd /= Invalid_FD then
+ Close (Descriptor.Input_Fd);
+ end if;
if Descriptor.Error_Fd /= Descriptor.Output_Fd then
Close (Descriptor.Error_Fd);
@@ -331,10 +341,17 @@ package body GNAT.Expect is
Expect_Internal (Descriptors, N, Timeout_Tmp, Full_Buffer);
- if N = Expect_Timeout or else N = Expect_Full_Buffer then
- Result := N;
- return;
- end if;
+ case N is
+ when Expect_Internal_Error | Expect_Process_Died =>
+ raise Process_Died;
+
+ when Expect_Timeout | Expect_Full_Buffer =>
+ Result := N;
+ return;
+
+ when others =>
+ null; -- See below
+ end case;
-- Calculate the timeout for the next turn
@@ -478,10 +495,17 @@ package body GNAT.Expect is
Expect_Internal (Descriptors, N, Timeout, Full_Buffer);
- if N = Expect_Timeout or else N = Expect_Full_Buffer then
- Result := N;
- return;
- end if;
+ case N is
+ when Expect_Internal_Error | Expect_Process_Died =>
+ raise Process_Died;
+
+ when Expect_Timeout | Expect_Full_Buffer =>
+ Result := N;
+ return;
+
+ when others =>
+ null; -- Continue
+ end case;
end loop;
end Expect;
@@ -500,7 +524,10 @@ package body GNAT.Expect is
for J in Descriptors'Range loop
Descriptors (J) := Regexps (J).Descriptor;
- Reinitialize_Buffer (Regexps (J).Descriptor.all);
+
+ if Descriptors (J) /= null then
+ Reinitialize_Buffer (Regexps (J).Descriptor.all);
+ end if;
end loop;
loop
@@ -511,25 +538,36 @@ package body GNAT.Expect is
-- checking the regexps).
for J in Regexps'Range loop
- Match (Regexps (J).Regexp.all,
- Regexps (J).Descriptor.Buffer
- (1 .. Regexps (J).Descriptor.Buffer_Index),
- Matched);
-
- if Matched (0) /= No_Match then
- Result := Expect_Match (J);
- Regexps (J).Descriptor.Last_Match_Start := Matched (0).First;
- Regexps (J).Descriptor.Last_Match_End := Matched (0).Last;
- return;
+ if Regexps (J).Regexp /= null
+ and then Regexps (J).Descriptor /= null
+ then
+ Match (Regexps (J).Regexp.all,
+ Regexps (J).Descriptor.Buffer
+ (1 .. Regexps (J).Descriptor.Buffer_Index),
+ Matched);
+
+ if Matched (0) /= No_Match then
+ Result := Expect_Match (J);
+ Regexps (J).Descriptor.Last_Match_Start := Matched (0).First;
+ Regexps (J).Descriptor.Last_Match_End := Matched (0).Last;
+ return;
+ end if;
end if;
end loop;
Expect_Internal (Descriptors, N, Timeout, Full_Buffer);
- if N = Expect_Timeout or else N = Expect_Full_Buffer then
- Result := N;
- return;
- end if;
+ case N is
+ when Expect_Internal_Error | Expect_Process_Died =>
+ raise Process_Died;
+
+ when Expect_Timeout | Expect_Full_Buffer =>
+ Result := N;
+ return;
+
+ when others =>
+ null; -- Continue
+ end case;
end loop;
end Expect;
@@ -549,21 +587,30 @@ package body GNAT.Expect is
N : Integer;
type File_Descriptor_Array is
- array (Descriptors'Range) of File_Descriptor;
+ array (0 .. Descriptors'Length - 1) of File_Descriptor;
Fds : aliased File_Descriptor_Array;
+ Fds_Count : Natural := 0;
+
+ Fds_To_Descriptor : array (Fds'Range) of Integer;
+ -- Maps file descriptor entries from Fds to entries in Descriptors.
+ -- They do not have the same index when entries in Descriptors are null.
- type Integer_Array is array (Descriptors'Range) of Integer;
+ type Integer_Array is array (Fds'Range) of Integer;
Is_Set : aliased Integer_Array;
begin
for J in Descriptors'Range loop
- Fds (J) := Descriptors (J).Output_Fd;
+ if Descriptors (J) /= null then
+ Fds (Fds'First + Fds_Count) := Descriptors (J).Output_Fd;
+ Fds_To_Descriptor (Fds'First + Fds_Count) := J;
+ Fds_Count := Fds_Count + 1;
- if Descriptors (J).Buffer_Size = 0 then
- Buffer_Size := Integer'Max (Buffer_Size, 4096);
- else
- Buffer_Size :=
- Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size);
+ if Descriptors (J).Buffer_Size = 0 then
+ Buffer_Size := Integer'Max (Buffer_Size, 4096);
+ else
+ Buffer_Size :=
+ Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size);
+ end if;
end if;
end loop;
@@ -572,19 +619,23 @@ package body GNAT.Expect is
-- Buffer used for input. This is allocated only once, not for
-- every iteration of the loop
+ D : Integer;
+ -- Index in Descriptors
+
begin
-- Loop until we match or we have a timeout
loop
Num_Descriptors :=
- Poll (Fds'Address, Fds'Length, Timeout, Is_Set'Address);
+ Poll (Fds'Address, Fds_Count, Timeout, Is_Set'Address);
case Num_Descriptors is
-- Error?
when -1 =>
- raise Process_Died;
+ Result := Expect_Internal_Error;
+ return;
-- Timeout?
@@ -595,15 +646,17 @@ package body GNAT.Expect is
-- Some input
when others =>
- for J in Descriptors'Range loop
- if Is_Set (J) = 1 then
- Buffer_Size := Descriptors (J).Buffer_Size;
+ for F in Fds'Range loop
+ if Is_Set (F) = 1 then
+ D := Fds_To_Descriptor (F);
+
+ Buffer_Size := Descriptors (D).Buffer_Size;
if Buffer_Size = 0 then
Buffer_Size := 4096;
end if;
- N := Read (Descriptors (J).Output_Fd, Buffer'Address,
+ N := Read (Descriptors (D).Output_Fd, Buffer'Address,
Buffer_Size);
-- Error or End of file
@@ -611,43 +664,46 @@ package body GNAT.Expect is
if N <= 0 then
-- ??? Note that ddd tries again up to three times
-- in that case. See LiterateA.C:174
- raise Process_Died;
+
+ Descriptors (D).Input_Fd := Invalid_FD;
+ Result := Expect_Process_Died;
+ return;
else
-- If there is no limit to the buffer size
- if Descriptors (J).Buffer_Size = 0 then
+ if Descriptors (D).Buffer_Size = 0 then
declare
- Tmp : String_Access := Descriptors (J).Buffer;
+ Tmp : String_Access := Descriptors (D).Buffer;
begin
if Tmp /= null then
- Descriptors (J).Buffer :=
+ Descriptors (D).Buffer :=
new String (1 .. Tmp'Length + N);
- Descriptors (J).Buffer (1 .. Tmp'Length) :=
+ Descriptors (D).Buffer (1 .. Tmp'Length) :=
Tmp.all;
- Descriptors (J).Buffer
+ Descriptors (D).Buffer
(Tmp'Length + 1 .. Tmp'Length + N) :=
Buffer (1 .. N);
Free (Tmp);
- Descriptors (J).Buffer_Index :=
- Descriptors (J).Buffer'Last;
+ Descriptors (D).Buffer_Index :=
+ Descriptors (D).Buffer'Last;
else
- Descriptors (J).Buffer :=
+ Descriptors (D).Buffer :=
new String (1 .. N);
- Descriptors (J).Buffer.all :=
+ Descriptors (D).Buffer.all :=
Buffer (1 .. N);
- Descriptors (J).Buffer_Index := N;
+ Descriptors (D).Buffer_Index := N;
end if;
end;
else
-- Add what we read to the buffer
- if Descriptors (J).Buffer_Index + N >
- Descriptors (J).Buffer_Size
+ if Descriptors (D).Buffer_Index + N >
+ Descriptors (D).Buffer_Size
then
-- If the user wants to know when we have
-- read more than the buffer can contain.
@@ -660,33 +716,33 @@ package body GNAT.Expect is
-- Keep as much as possible from the buffer,
-- and forget old characters.
- Descriptors (J).Buffer
- (1 .. Descriptors (J).Buffer_Size - N) :=
- Descriptors (J).Buffer
- (N - Descriptors (J).Buffer_Size +
- Descriptors (J).Buffer_Index + 1 ..
- Descriptors (J).Buffer_Index);
- Descriptors (J).Buffer_Index :=
- Descriptors (J).Buffer_Size - N;
+ Descriptors (D).Buffer
+ (1 .. Descriptors (D).Buffer_Size - N) :=
+ Descriptors (D).Buffer
+ (N - Descriptors (D).Buffer_Size +
+ Descriptors (D).Buffer_Index + 1 ..
+ Descriptors (D).Buffer_Index);
+ Descriptors (D).Buffer_Index :=
+ Descriptors (D).Buffer_Size - N;
end if;
-- Keep what we read in the buffer
- Descriptors (J).Buffer
- (Descriptors (J).Buffer_Index + 1 ..
- Descriptors (J).Buffer_Index + N) :=
+ Descriptors (D).Buffer
+ (Descriptors (D).Buffer_Index + 1 ..
+ Descriptors (D).Buffer_Index + N) :=
Buffer (1 .. N);
- Descriptors (J).Buffer_Index :=
- Descriptors (J).Buffer_Index + N;
+ Descriptors (D).Buffer_Index :=
+ Descriptors (D).Buffer_Index + N;
end if;
-- Call each of the output filter with what we
-- read.
Call_Filters
- (Descriptors (J).all, Buffer (1 .. N), Output);
+ (Descriptors (D).all, Buffer (1 .. N), Output);
- Result := Expect_Match (N);
+ Result := Expect_Match (D);
return;
end if;
end if;
@@ -715,6 +771,25 @@ package body GNAT.Expect is
(Descriptor.Last_Match_Start .. Descriptor.Last_Match_End);
end Expect_Out_Match;
+ ------------------------
+ -- First_Dead_Process --
+ ------------------------
+
+ function First_Dead_Process
+ (Regexp : Multiprocess_Regexp_Array) return Natural
+ is
+ begin
+ for R in Regexp'Range loop
+ if Regexp (R).Descriptor /= null
+ and then Regexp (R).Descriptor.Input_Fd = GNAT.OS_Lib.Invalid_FD
+ then
+ return R;
+ end if;
+ end loop;
+
+ return 0;
+ end First_Dead_Process;
+
-----------
-- Flush --
-----------
@@ -770,6 +845,18 @@ package body GNAT.Expect is
end loop;
end Flush;
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (Regexp : in out Multiprocess_Regexp) is
+ procedure Unchecked_Free is new Ada.Unchecked_Deallocation
+ (Process_Descriptor'Class, Process_Descriptor_Access);
+ begin
+ Unchecked_Free (Regexp.Descriptor);
+ Free (Regexp.Regexp);
+ end Free;
+
------------------------
-- Get_Command_Output --
------------------------
@@ -897,6 +984,15 @@ package body GNAT.Expect is
return Descriptor.Pid;
end Get_Pid;
+ -----------------
+ -- Has_Process --
+ -----------------
+
+ function Has_Process (Regexp : Multiprocess_Regexp_Array) return Boolean is
+ begin
+ return Regexp /= (Regexp'Range => (null, null));
+ end Has_Process;
+
---------------
-- Interrupt --
---------------
@@ -1023,6 +1119,13 @@ package body GNAT.Expect is
Expect_Internal (Descriptors, Result,
Timeout => 0, Full_Buffer => False);
+
+ if Result = Expect_Internal_Error
+ or else Result = Expect_Process_Died
+ then
+ raise Process_Died;
+ end if;
+
Descriptor.Last_Match_End := Descriptor.Buffer_Index;
-- Empty the buffer
diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb
index 6510c310813..c8b368fc58a 100644
--- a/gcc/ada/g-expect.adb
+++ b/gcc/ada/g-expect.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2009, AdaCore --
+-- Copyright (C) 2000-2010, AdaCore --
-- --
-- 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- --
@@ -45,6 +45,11 @@ package body GNAT.Expect is
type Array_Of_Pd is array (Positive range <>) of Process_Descriptor_Access;
+ Expect_Process_Died : constant Expect_Match := -100;
+ Expect_Internal_Error : constant Expect_Match := -101;
+ -- Additional possible outputs of Expect_Internal. These are not visible in
+ -- the spec because the user will never see them.
+
procedure Expect_Internal
(Descriptors : in out Array_Of_Pd;
Result : out Expect_Match;
@@ -52,11 +57,14 @@ package body GNAT.Expect is
Full_Buffer : Boolean);
-- Internal function used to read from the process Descriptor.
--
- -- Three outputs are possible:
+ -- Several outputs are possible:
-- Result=Expect_Timeout, if no output was available before the timeout
-- expired.
-- Result=Expect_Full_Buffer, if Full_Buffer is True and some characters
-- had to be discarded from the internal buffer of Descriptor.
+ -- Result=Express_Process_Died if one of the processes was terminated.
+ -- That process's Input_Fd is set to Invalid_FD
+ -- Result=Express_Internal_Error
-- Result=<integer>, indicates how many characters were added to the
-- internal buffer. These characters are from indexes
-- Descriptor.Buffer_Index - Result + 1 .. Descriptor.Buffer_Index
@@ -211,7 +219,9 @@ package body GNAT.Expect is
Next_Filter : Filter_List;
begin
- Close (Descriptor.Input_Fd);
+ if Descriptor.Input_Fd /= Invalid_FD then
+ Close (Descriptor.Input_Fd);
+ end if;
if Descriptor.Error_Fd /= Descriptor.Output_Fd then
Close (Descriptor.Error_Fd);
@@ -344,10 +354,17 @@ package body GNAT.Expect is
Expect_Internal (Descriptors, N, Timeout_Tmp, Full_Buffer);
- if N = Expect_Timeout or else N = Expect_Full_Buffer then
- Result := N;
- return;
- end if;
+ case N is
+ when Expect_Internal_Error | Expect_Process_Died =>
+ raise Process_Died;
+
+ when Expect_Timeout | Expect_Full_Buffer =>
+ Result := N;
+ return;
+
+ when others =>
+ null; -- See below
+ end case;
-- Calculate the timeout for the next turn
@@ -493,10 +510,17 @@ package body GNAT.Expect is
Expect_Internal (Descriptors, N, Timeout, Full_Buffer);
- if N = Expect_Timeout or else N = Expect_Full_Buffer then
- Result := N;
- return;
- end if;
+ case N is
+ when Expect_Internal_Error | Expect_Process_Died =>
+ raise Process_Died;
+
+ when Expect_Timeout | Expect_Full_Buffer =>
+ Result := N;
+ return;
+
+ when others =>
+ null; -- Continue
+ end case;
end loop;
end Expect;
@@ -515,7 +539,10 @@ package body GNAT.Expect is
for J in Descriptors'Range loop
Descriptors (J) := Regexps (J).Descriptor;
- Reinitialize_Buffer (Regexps (J).Descriptor.all);
+
+ if Descriptors (J) /= null then
+ Reinitialize_Buffer (Regexps (J).Descriptor.all);
+ end if;
end loop;
loop
@@ -526,25 +553,36 @@ package body GNAT.Expect is
-- checking the regexps).
for J in Regexps'Range loop
- Match (Regexps (J).Regexp.all,
- Regexps (J).Descriptor.Buffer
- (1 .. Regexps (J).Descriptor.Buffer_Index),
- Matched);
-
- if Matched (0) /= No_Match then
- Result := Expect_Match (J);
- Regexps (J).Descriptor.Last_Match_Start := Matched (0).First;
- Regexps (J).Descriptor.Last_Match_End := Matched (0).Last;
- return;
+ if Regexps (J).Regexp /= null
+ and then Regexps (J).Descriptor /= null
+ then
+ Match (Regexps (J).Regexp.all,
+ Regexps (J).Descriptor.Buffer
+ (1 .. Regexps (J).Descriptor.Buffer_Index),
+ Matched);
+
+ if Matched (0) /= No_Match then
+ Result := Expect_Match (J);
+ Regexps (J).Descriptor.Last_Match_Start := Matched (0).First;
+ Regexps (J).Descriptor.Last_Match_End := Matched (0).Last;
+ return;
+ end if;
end if;
end loop;
Expect_Internal (Descriptors, N, Timeout, Full_Buffer);
- if N = Expect_Timeout or else N = Expect_Full_Buffer then
- Result := N;
- return;
- end if;
+ case N is
+ when Expect_Internal_Error | Expect_Process_Died =>
+ raise Process_Died;
+
+ when Expect_Timeout | Expect_Full_Buffer =>
+ Result := N;
+ return;
+
+ when others =>
+ null; -- Continue
+ end case;
end loop;
end Expect;
@@ -564,21 +602,30 @@ package body GNAT.Expect is
N : Integer;
type File_Descriptor_Array is
- array (Descriptors'Range) of File_Descriptor;
+ array (0 .. Descriptors'Length - 1) of File_Descriptor;
Fds : aliased File_Descriptor_Array;
+ Fds_Count : Natural := 0;
- type Integer_Array is array (Descriptors'Range) of Integer;
+ Fds_To_Descriptor : array (Fds'Range) of Integer;
+ -- Maps file descriptor entries from Fds to entries in Descriptors.
+ -- They do not have the same index when entries in Descriptors are null.
+
+ type Integer_Array is array (Fds'Range) of Integer;
Is_Set : aliased Integer_Array;
begin
for J in Descriptors'Range loop
- Fds (J) := Descriptors (J).Output_Fd;
+ if Descriptors (J) /= null then
+ Fds (Fds'First + Fds_Count) := Descriptors (J).Output_Fd;
+ Fds_To_Descriptor (Fds'First + Fds_Count) := J;
+ Fds_Count := Fds_Count + 1;
- if Descriptors (J).Buffer_Size = 0 then
- Buffer_Size := Integer'Max (Buffer_Size, 4096);
- else
- Buffer_Size :=
- Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size);
+ if Descriptors (J).Buffer_Size = 0 then
+ Buffer_Size := Integer'Max (Buffer_Size, 4096);
+ else
+ Buffer_Size :=
+ Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size);
+ end if;
end if;
end loop;
@@ -587,19 +634,23 @@ package body GNAT.Expect is
-- Buffer used for input. This is allocated only once, not for
-- every iteration of the loop
+ D : Integer;
+ -- Index in Descriptors
+
begin
-- Loop until we match or we have a timeout
loop
Num_Descriptors :=
- Poll (Fds'Address, Fds'Length, Timeout, Is_Set'Address);
+ Poll (Fds'Address, Fds_Count, Timeout, Is_Set'Address);
case Num_Descriptors is
-- Error?
when -1 =>
- raise Process_Died;
+ Result := Expect_Internal_Error;
+ return;
-- Timeout?
@@ -610,15 +661,17 @@ package body GNAT.Expect is
-- Some input
when others =>
- for J in Descriptors'Range loop
- if Is_Set (J) = 1 then
- Buffer_Size := Descriptors (J).Buffer_Size;
+ for F in Fds'Range loop
+ if Is_Set (F) = 1 then
+ D := Fds_To_Descriptor (F);
+
+ Buffer_Size := Descriptors (D).Buffer_Size;
if Buffer_Size = 0 then
Buffer_Size := 4096;
end if;
- N := Read (Descriptors (J).Output_Fd, Buffer'Address,
+ N := Read (Descriptors (D).Output_Fd, Buffer'Address,
Buffer_Size);
-- Error or End of file
@@ -626,43 +679,46 @@ package body GNAT.Expect is
if N <= 0 then
-- ??? Note that ddd tries again up to three times
-- in that case. See LiterateA.C:174
- raise Process_Died;
+
+ Descriptors (D).Input_Fd := Invalid_FD;
+ Result := Expect_Process_Died;
+ return;
else
-- If there is no limit to the buffer size
- if Descriptors (J).Buffer_Size = 0 then
+ if Descriptors (D).Buffer_Size = 0 then
declare
- Tmp : String_Access := Descriptors (J).Buffer;
+ Tmp : String_Access := Descriptors (D).Buffer;
begin
if Tmp /= null then
- Descriptors (J).Buffer :=
+ Descriptors (D).Buffer :=
new String (1 .. Tmp'Length + N);
- Descriptors (J).Buffer (1 .. Tmp'Length) :=
+ Descriptors (D).Buffer (1 .. Tmp'Length) :=
Tmp.all;
- Descriptors (J).Buffer
+ Descriptors (D).Buffer
(Tmp'Length + 1 .. Tmp'Length + N) :=
Buffer (1 .. N);
Free (Tmp);
- Descriptors (J).Buffer_Index :=
- Descriptors (J).Buffer'Last;
+ Descriptors (D).Buffer_Index :=
+ Descriptors (D).Buffer'Last;
else
- Descriptors (J).Buffer :=
+ Descriptors (D).Buffer :=
new String (1 .. N);
- Descriptors (J).Buffer.all :=
+ Descriptors (D).Buffer.all :=
Buffer (1 .. N);
- Descriptors (J).Buffer_Index := N;
+ Descriptors (D).Buffer_Index := N;
end if;
end;
else
-- Add what we read to the buffer
- if Descriptors (J).Buffer_Index + N >
- Descriptors (J).Buffer_Size
+ if Descriptors (D).Buffer_Index + N >
+ Descriptors (D).Buffer_Size
then
-- If the user wants to know when we have
-- read more than the buffer can contain.
@@ -675,33 +731,33 @@ package body GNAT.Expect is
-- Keep as much as possible from the buffer,
-- and forget old characters.
- Descriptors (J).Buffer
- (1 .. Descriptors (J).Buffer_Size - N) :=
- Descriptors (J).Buffer
- (N - Descriptors (J).Buffer_Size +
- Descriptors (J).Buffer_Index + 1 ..
- Descriptors (J).Buffer_Index);
- Descriptors (J).Buffer_Index :=
- Descriptors (J).Buffer_Size - N;
+ Descriptors (D).Buffer
+ (1 .. Descriptors (D).Buffer_Size - N) :=
+ Descriptors (D).Buffer
+ (N - Descriptors (D).Buffer_Size +
+ Descriptors (D).Buffer_Index + 1 ..
+ Descriptors (D).Buffer_Index);
+ Descriptors (D).Buffer_Index :=
+ Descriptors (D).Buffer_Size - N;
end if;
-- Keep what we read in the buffer
- Descriptors (J).Buffer
- (Descriptors (J).Buffer_Index + 1 ..
- Descriptors (J).Buffer_Index + N) :=
+ Descriptors (D).Buffer
+ (Descriptors (D).Buffer_Index + 1 ..
+ Descriptors (D).Buffer_Index + N) :=
Buffer (1 .. N);
- Descriptors (J).Buffer_Index :=
- Descriptors (J).Buffer_Index + N;
+ Descriptors (D).Buffer_Index :=
+ Descriptors (D).Buffer_Index + N;
end if;
-- Call each of the output filter with what we
-- read.
Call_Filters
- (Descriptors (J).all, Buffer (1 .. N), Output);
+ (Descriptors (D).all, Buffer (1 .. N), Output);
- Result := Expect_Match (N);
+ Result := Expect_Match (D);
return;
end if;
end if;
@@ -730,6 +786,24 @@ package body GNAT.Expect is
(Descriptor.Last_Match_Start .. Descriptor.Last_Match_End);
end Expect_Out_Match;
+ ------------------------
+ -- First_Dead_Process --
+ ------------------------
+
+ function First_Dead_Process
+ (Regexp : Multiprocess_Regexp_Array) return Natural is
+ begin
+ for R in Regexp'Range loop
+ if Regexp (R).Descriptor /= null
+ and then Regexp (R).Descriptor.Input_Fd = GNAT.OS_Lib.Invalid_FD
+ then
+ return R;
+ end if;
+ end loop;
+
+ return 0;
+ end First_Dead_Process;
+
-----------
-- Flush --
-----------
@@ -785,6 +859,18 @@ package body GNAT.Expect is
end loop;
end Flush;
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (Regexp : in out Multiprocess_Regexp) is
+ procedure Unchecked_Free is new Ada.Unchecked_Deallocation
+ (Process_Descriptor'Class, Process_Descriptor_Access);
+ begin
+ Unchecked_Free (Regexp.Descriptor);
+ Free (Regexp.Regexp);
+ end Free;
+
------------------------
-- Get_Command_Output --
------------------------
@@ -915,6 +1001,15 @@ package body GNAT.Expect is
return Descriptor.Pid;
end Get_Pid;
+ -----------------
+ -- Has_Process --
+ -----------------
+
+ function Has_Process (Regexp : Multiprocess_Regexp_Array) return Boolean is
+ begin
+ return Regexp /= (Regexp'Range => (null, null));
+ end Has_Process;
+
---------------
-- Interrupt --
---------------
@@ -1136,6 +1231,13 @@ package body GNAT.Expect is
Expect_Internal
(Descriptors, Result, Timeout => 0, Full_Buffer => False);
+
+ if Result = Expect_Internal_Error
+ or else Result = Expect_Process_Died
+ then
+ raise Process_Died;
+ end if;
+
Descriptor.Last_Match_End := Descriptor.Buffer_Index;
-- Empty the buffer
diff --git a/gcc/ada/g-expect.ads b/gcc/ada/g-expect.ads
index 1e50852522a..9a00cf0571e 100644
--- a/gcc/ada/g-expect.ads
+++ b/gcc/ada/g-expect.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2009, AdaCore --
+-- Copyright (C) 2000-2010, AdaCore --
-- --
-- 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- --
@@ -180,16 +180,16 @@ package GNAT.Expect is
-- till Expect matches), but this is slower.
--
-- If Err_To_Out is True, then the standard error of the spawned process is
- -- connected to the standard output. This is the only way to get the
- -- Except subprograms to also match on output on standard error.
+ -- connected to the standard output. This is the only way to get the Except
+ -- subprograms to also match on output on standard error.
--
-- Invalid_Process is raised if the process could not be spawned.
procedure Close (Descriptor : in out Process_Descriptor);
- -- Terminate the process and close the pipes to it. It implicitly
- -- does the 'wait' command required to clean up the process table.
- -- This also frees the buffer associated with the process id. Raise
- -- Invalid_Process if the process id is invalid.
+ -- Terminate the process and close the pipes to it. It implicitly does the
+ -- 'wait' command required to clean up the process table. This also frees
+ -- the buffer associated with the process id. Raise Invalid_Process if the
+ -- process id is invalid.
procedure Close
(Descriptor : in out Process_Descriptor;
@@ -247,8 +247,8 @@ package GNAT.Expect is
(Descriptor : Process_Descriptor'Class;
Str : String;
User_Data : System.Address := System.Null_Address);
- -- Function called every time new characters are read from or written
- -- to the process.
+ -- Function called every time new characters are read from or written to
+ -- the process.
--
-- Str is a string of all these characters.
--
@@ -301,9 +301,9 @@ package GNAT.Expect is
Empty_Buffer : Boolean := False);
-- Send a string to the file descriptor.
--
- -- The string is not formatted in any way, except if Add_LF is True,
- -- in which case an ASCII.LF is added at the end, so that Str is
- -- recognized as a command by the external process.
+ -- The string is not formatted in any way, except if Add_LF is True, in
+ -- which case an ASCII.LF is added at the end, so that Str is recognized
+ -- as a command by the external process.
--
-- If Empty_Buffer is True, any input waiting from the process (or in the
-- buffer) is first discarded before the command is sent. The output
@@ -330,8 +330,8 @@ package GNAT.Expect is
Regexp : String;
Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
- -- Wait till a string matching Fd can be read from Fd, and return 1
- -- if a match was found.
+ -- Wait till a string matching Fd can be read from Fd, and return 1 if a
+ -- match was found.
--
-- It consumes all the characters read from Fd until a match found, and
-- then sets the return values for the subprograms Expect_Out and
@@ -402,15 +402,13 @@ package GNAT.Expect is
type Regexp_Array is array (Positive range <>) of GNAT.OS_Lib.String_Access;
type Pattern_Matcher_Access is access all GNAT.Regpat.Pattern_Matcher;
- type Compiled_Regexp_Array is array (Positive range <>)
- of Pattern_Matcher_Access;
+ type Compiled_Regexp_Array is
+ array (Positive range <>) of Pattern_Matcher_Access;
function "+"
- (P : GNAT.Regpat.Pattern_Matcher)
- return Pattern_Matcher_Access;
- -- Allocate some memory for the pattern matcher.
- -- This is only a convenience function to help create the array of
- -- compiled regular expressions.
+ (P : GNAT.Regpat.Pattern_Matcher) return Pattern_Matcher_Access;
+ -- Allocate some memory for the pattern matcher. This is only a convenience
+ -- function to help create the array of compiled regular expressions.
procedure Expect
(Descriptor : in out Process_Descriptor;
@@ -441,6 +439,7 @@ package GNAT.Expect is
Full_Buffer : Boolean := False);
-- Same as above, except that you can also access the parenthesis
-- groups inside the matching regular expression.
+ --
-- The first index in Matched must be 0, or Constraint_Error will be
-- raised. The index 0 contains the indexes for the whole string that was
-- matched, the index 1 contains the indexes for the first parentheses
@@ -453,9 +452,8 @@ package GNAT.Expect is
Matched : out GNAT.Regpat.Match_Array;
Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
- -- Same as above, but with precompiled regular expressions.
- -- The first index in Matched must be 0, or Constraint_Error will be
- -- raised.
+ -- Same as above, but with precompiled regular expressions. The first index
+ -- in Matched must be 0, or Constraint_Error will be raised.
-------------------------------------------
-- Working on the output (multi-process) --
@@ -465,8 +463,23 @@ package GNAT.Expect is
Descriptor : Process_Descriptor_Access;
Regexp : Pattern_Matcher_Access;
end record;
- type Multiprocess_Regexp_Array is array (Positive range <>)
- of Multiprocess_Regexp;
+
+ type Multiprocess_Regexp_Array is
+ array (Positive range <>) of Multiprocess_Regexp;
+
+ procedure Free (Regexp : in out Multiprocess_Regexp);
+ -- Free the memory occupied by Regexp
+
+ function Has_Process (Regexp : Multiprocess_Regexp_Array) return Boolean;
+ -- Return True if at least one entry in Regexp is non-null, ie there is
+ -- still at least one process to monitor
+
+ function First_Dead_Process
+ (Regexp : Multiprocess_Regexp_Array) return Natural;
+ -- Find the first entry in Regexp that corresponds to a dead process that
+ -- wasn't Free-d yet. This function is called in general when Expect
+ -- (below) raises the exception Process_Died. This returns 0 if no process
+ -- has died yet.
procedure Expect
(Result : out Expect_Match;
@@ -474,15 +487,37 @@ package GNAT.Expect is
Matched : out GNAT.Regpat.Match_Array;
Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
- -- Same as above, but for multi processes
+ -- Same as above, but for multi processes. Any of the entries in
+ -- Regexps can have a null Descriptor or Regexp. Such entries will
+ -- simply be ignored. Therefore when a process terminates, you can
+ -- simply reset its entry.
+ --
+ -- The expect loop would therefore look like:
+ --
+ -- Processes : Multiprocess_Regexp_Array (...) := ...;
+ -- R : Natural;
+ --
+ -- while Has_Process (Processes) loop
+ -- begin
+ -- Expect (Result, Processes, Timeout => -1);
+ -- ... process output of process Result (output, full buffer,...)
+ --
+ -- exception
+ -- when Process_Died =>
+ -- -- Free memory
+ -- R := First_Dead_Process (Processes);
+ -- Close (Processes (R).Descriptor.all, Status);
+ -- Free (Processes (R));
+ -- end;
+ -- end loop;
procedure Expect
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
- -- Same as the previous one, but for multiple processes.
- -- This procedure finds the first regexp that match the associated process.
+ -- Same as the previous one, but for multiple processes. This procedure
+ -- finds the first regexp that match the associated process.
------------------------
-- Getting the output --
@@ -494,8 +529,8 @@ package GNAT.Expect is
-- Discard all output waiting from the process.
--
-- This output is simply discarded, and no filter is called. This output
- -- will also not be visible by the next call to Expect, nor will any
- -- output currently buffered.
+ -- will also not be visible by the next call to Expect, nor will any output
+ -- currently buffered.
--
-- Timeout is the delay for which we wait for output to be available from
-- the process. If 0, we only get what is immediately available.
@@ -503,13 +538,13 @@ package GNAT.Expect is
function Expect_Out (Descriptor : Process_Descriptor) return String;
-- Return the string matched by the last Expect call.
--
- -- The returned string is in fact the concatenation of all the strings
- -- read from the file descriptor up to, and including, the characters
- -- that matched the regular expression.
+ -- The returned string is in fact the concatenation of all the strings read
+ -- from the file descriptor up to, and including, the characters that
+ -- matched the regular expression.
--
- -- For instance, with an input "philosophic", and a regular expression
- -- "hi" in the call to expect, the strings returned the first and second
- -- time would be respectively "phi" and "losophi".
+ -- For instance, with an input "philosophic", and a regular expression "hi"
+ -- in the call to expect, the strings returned the first and second time
+ -- would be respectively "phi" and "losophi".
function Expect_Out_Match (Descriptor : Process_Descriptor) return String;
-- Return the string matched by the last Expect call.
@@ -573,10 +608,9 @@ private
Pipe3 : in out Pipe_Type;
Cmd : String;
Args : System.Address);
- -- Finish the set up of the pipes while in the child process
- -- This also spawns the child process (based on Cmd).
- -- On systems that support fork, this procedure is executed inside the
- -- newly created process.
+ -- Finish the set up of the pipes while in the child process This also
+ -- spawns the child process (based on Cmd). On systems that support fork,
+ -- this procedure is executed inside the newly created process.
type Process_Descriptor is tagged record
Pid : aliased Process_Id := Invalid_Pid;
@@ -604,7 +638,7 @@ private
Args : System.Address);
pragma Import (C, Portable_Execvp, "__gnat_expect_portable_execvp");
-- Executes, in a portable way, the command Cmd (full path must be
- -- specified), with the given Args. Args must be an array of string
+ -- specified), with the given Args, which must be an array of string
-- pointers. Note that the first element in Args must be the executable
-- name, and the last element must be a null pointer. The returned value
-- in Pid is the process ID, or zero if not supported on the platform.
diff --git a/gcc/ada/g-mbdira.adb b/gcc/ada/g-mbdira.adb
new file mode 100644
index 00000000000..f5fd4dce60d
--- /dev/null
+++ b/gcc/ada/g-mbdira.adb
@@ -0,0 +1,282 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- G N A T . M B B S _ D I S C R E T E _ R A N D O M --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Calendar;
+
+with Interfaces; use Interfaces;
+
+package body GNAT.MBBS_Discrete_Random is
+
+ package Calendar renames Ada.Calendar;
+
+ Fits_In_32_Bits : constant Boolean :=
+ Rst'Size < 31
+ or else (Rst'Size = 31
+ and then Rst'Pos (Rst'First) < 0);
+ -- This is set True if we do not need more than 32 bits in the result. If
+ -- we need 64-bits, we will only use the meaningful 48 bits of any 64-bit
+ -- number generated, since if more than 48 bits are required, we split the
+ -- computation into two separate parts, since the algorithm does not behave
+ -- above 48 bits.
+
+ -- The way this expression works is that obviously if the size is 31 bits,
+ -- it fits in 32 bits. In the 32-bit case, it fits in 32-bit signed if the
+ -- range has negative values. It is too conservative in the case that the
+ -- programmer has set a size greater than the default, e.g. a size of 33
+ -- for an integer type with a range of 1..10, but an over-conservative
+ -- result is OK. The important thing is that the value is only True if
+ -- we know the result will fit in 32-bits signed. If the value is False
+ -- when it could be True, the behavior will be correct, just a bit less
+ -- efficient than it could have been in some unusual cases.
+ --
+ -- One might assume that we could get a more accurate result by testing
+ -- the lower and upper bounds of the type Rst against the bounds of 32-bit
+ -- Integer. However, there is no easy way to do that. Why? Because in the
+ -- relatively rare case where this expresion has to be evaluated at run
+ -- time rather than compile time (when the bounds are dynamic), we need a
+ -- type to use for the computation. But the possible range of upper bound
+ -- values for Rst (remembering the possibility of 64-bit modular types) is
+ -- from -2**63 to 2**64-1, and no run-time type has a big enough range.
+
+ -----------------------
+ -- Local Subprograms --
+ -----------------------
+
+ function Square_Mod_N (X, N : Int) return Int;
+ pragma Inline (Square_Mod_N);
+ -- Computes X**2 mod N avoiding intermediate overflow
+
+ -----------
+ -- Image --
+ -----------
+
+ function Image (Of_State : State) return String is
+ begin
+ return Int'Image (Of_State.X1) &
+ ',' &
+ Int'Image (Of_State.X2) &
+ ',' &
+ Int'Image (Of_State.Q);
+ end Image;
+
+ ------------
+ -- Random --
+ ------------
+
+ function Random (Gen : Generator) return Rst is
+ S : State renames Gen.Writable.Self.Gen_State;
+ Temp : Int;
+ TF : Flt;
+
+ begin
+ -- Check for flat range here, since we are typically run with checks
+ -- off, note that in practice, this condition will usually be static
+ -- so we will not actually generate any code for the normal case.
+
+ if Rst'Last < Rst'First then
+ raise Constraint_Error;
+ end if;
+
+ -- Continue with computation if non-flat range
+
+ S.X1 := Square_Mod_N (S.X1, S.P);
+ S.X2 := Square_Mod_N (S.X2, S.Q);
+ Temp := S.X2 - S.X1;
+
+ -- Following duplication is not an error, it is a loop unwinding!
+
+ if Temp < 0 then
+ Temp := Temp + S.Q;
+ end if;
+
+ if Temp < 0 then
+ Temp := Temp + S.Q;
+ end if;
+
+ TF := Offs + (Flt (Temp) * Flt (S.P) + Flt (S.X1)) * S.Scl;
+
+ -- Pathological, but there do exist cases where the rounding implicit
+ -- in calculating the scale factor will cause rounding to 'Last + 1.
+ -- In those cases, returning 'First results in the least bias.
+
+ if TF >= Flt (Rst'Pos (Rst'Last)) + 0.5 then
+ return Rst'First;
+
+ elsif not Fits_In_32_Bits then
+ return Rst'Val (Interfaces.Integer_64 (TF));
+
+ else
+ return Rst'Val (Int (TF));
+ end if;
+ end Random;
+
+ -----------
+ -- Reset --
+ -----------
+
+ procedure Reset (Gen : Generator; Initiator : Integer) is
+ S : State renames Gen.Writable.Self.Gen_State;
+ X1, X2 : Int;
+
+ begin
+ X1 := 2 + Int (Initiator) mod (K1 - 3);
+ X2 := 2 + Int (Initiator) mod (K2 - 3);
+
+ for J in 1 .. 5 loop
+ X1 := Square_Mod_N (X1, K1);
+ X2 := Square_Mod_N (X2, K2);
+ end loop;
+
+ -- Eliminate effects of small Initiators
+
+ S :=
+ (X1 => X1,
+ X2 => X2,
+ P => K1,
+ Q => K2,
+ FP => K1F,
+ Scl => Scal);
+ end Reset;
+
+ -----------
+ -- Reset --
+ -----------
+
+ procedure Reset (Gen : Generator) is
+ S : State renames Gen.Writable.Self.Gen_State;
+ Now : constant Calendar.Time := Calendar.Clock;
+ X1 : Int;
+ X2 : Int;
+
+ begin
+ X1 := Int (Calendar.Year (Now)) * 12 * 31 +
+ Int (Calendar.Month (Now) * 31) +
+ Int (Calendar.Day (Now));
+
+ X2 := Int (Calendar.Seconds (Now) * Duration (1000.0));
+
+ X1 := 2 + X1 mod (K1 - 3);
+ X2 := 2 + X2 mod (K2 - 3);
+
+ -- Eliminate visible effects of same day starts
+
+ for J in 1 .. 5 loop
+ X1 := Square_Mod_N (X1, K1);
+ X2 := Square_Mod_N (X2, K2);
+ end loop;
+
+ S :=
+ (X1 => X1,
+ X2 => X2,
+ P => K1,
+ Q => K2,
+ FP => K1F,
+ Scl => Scal);
+
+ end Reset;
+
+ -----------
+ -- Reset --
+ -----------
+
+ procedure Reset (Gen : Generator; From_State : State) is
+ begin
+ Gen.Writable.Self.Gen_State := From_State;
+ end Reset;
+
+ ----------
+ -- Save --
+ ----------
+
+ procedure Save (Gen : Generator; To_State : out State) is
+ begin
+ To_State := Gen.Gen_State;
+ end Save;
+
+ ------------------
+ -- Square_Mod_N --
+ ------------------
+
+ function Square_Mod_N (X, N : Int) return Int is
+ begin
+ return Int ((Integer_64 (X) ** 2) mod (Integer_64 (N)));
+ end Square_Mod_N;
+
+ -----------
+ -- Value --
+ -----------
+
+ function Value (Coded_State : String) return State is
+ Last : constant Natural := Coded_State'Last;
+ Start : Positive := Coded_State'First;
+ Stop : Positive := Coded_State'First;
+ Outs : State;
+
+ begin
+ while Stop <= Last and then Coded_State (Stop) /= ',' loop
+ Stop := Stop + 1;
+ end loop;
+
+ if Stop > Last then
+ raise Constraint_Error;
+ end if;
+
+ Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1));
+ Start := Stop + 1;
+
+ loop
+ Stop := Stop + 1;
+ exit when Stop > Last or else Coded_State (Stop) = ',';
+ end loop;
+
+ if Stop > Last then
+ raise Constraint_Error;
+ end if;
+
+ Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1));
+ Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last));
+ Outs.P := Outs.Q * 2 + 1;
+ Outs.FP := Flt (Outs.P);
+ Outs.Scl := (RstL - RstF + 1.0) / (Flt (Outs.P) * Flt (Outs.Q));
+
+ -- Now do *some* sanity checks
+
+ if Outs.Q < 31
+ or else Outs.X1 not in 2 .. Outs.P - 1
+ or else Outs.X2 not in 2 .. Outs.Q - 1
+ then
+ raise Constraint_Error;
+ end if;
+
+ return Outs;
+ end Value;
+
+end GNAT.MBBS_Discrete_Random;
diff --git a/gcc/ada/g-mbdira.ads b/gcc/ada/g-mbdira.ads
new file mode 100644
index 00000000000..c415a24cfcf
--- /dev/null
+++ b/gcc/ada/g-mbdira.ads
@@ -0,0 +1,123 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- G N A T . M B B S _ D I S C R E T E _ R A N D O M --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2010, 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- The implementation used in this package was contributed by Robert
+-- Eachus. It is based on the work of L. Blum, M. Blum, and M. Shub, SIAM
+-- Journal of Computing, Vol 15. No 2, May 1986. The particular choices for P
+-- and Q chosen here guarantee a period of 562,085,314,430,582 (about 2**49),
+-- and the generated sequence has excellent randomness properties. For further
+-- details, see the paper "Fast Generation of Trustworthy Random Numbers", by
+-- Robert Eachus, which describes both the algorithm and the efficient
+-- implementation approach used here.
+
+-- Formerly, this package was Ada.Numerics.Discrete_Random. It is retained
+-- here in part to allow users to reconstruct number sequences generated
+-- by previous versions.
+
+with Interfaces;
+
+generic
+ type Result_Subtype is (<>);
+
+package GNAT.MBBS_Discrete_Random is
+
+ -- The algorithm used here is reliable from a required statistical point of
+ -- view only up to 48 bits. We try to behave reasonably in the case of
+ -- larger types, but we can't guarantee the required properties. So
+ -- generate a warning for these (slightly) dubious cases.
+
+ pragma Compile_Time_Warning
+ (Result_Subtype'Size > 48,
+ "statistical properties not guaranteed for size > 48");
+
+ -- Basic facilities
+
+ type Generator is limited private;
+
+ function Random (Gen : Generator) return Result_Subtype;
+
+ procedure Reset (Gen : Generator);
+ procedure Reset (Gen : Generator; Initiator : Integer);
+
+ -- Advanced facilities
+
+ type State is private;
+
+ procedure Save (Gen : Generator; To_State : out State);
+ procedure Reset (Gen : Generator; From_State : State);
+
+ Max_Image_Width : constant := 80;
+
+ function Image (Of_State : State) return String;
+ function Value (Coded_State : String) return State;
+
+private
+ subtype Int is Interfaces.Integer_32;
+ subtype Rst is Result_Subtype;
+
+ -- We prefer to use 14 digits for Flt, but some targets are more limited
+
+ type Flt is digits Positive'Min (14, Long_Long_Float'Digits);
+
+ RstF : constant Flt := Flt (Rst'Pos (Rst'First));
+ RstL : constant Flt := Flt (Rst'Pos (Rst'Last));
+
+ Offs : constant Flt := RstF - 0.5;
+
+ K1 : constant := 94_833_359;
+ K1F : constant := 94_833_359.0;
+ K2 : constant := 47_416_679;
+ K2F : constant := 47_416_679.0;
+ Scal : constant Flt := (RstL - RstF + 1.0) / (K1F * K2F);
+
+ type State is record
+ X1 : Int := Int (2999 ** 2);
+ X2 : Int := Int (1439 ** 2);
+ P : Int := K1;
+ Q : Int := K2;
+ FP : Flt := K1F;
+ Scl : Flt := Scal;
+ end record;
+
+ type Writable_Access (Self : access Generator) is limited null record;
+ -- Auxiliary type to make Generator a self-referential type
+
+ type Generator is limited record
+ Writable : Writable_Access (Generator'Access);
+ -- This self reference allows functions to modify Generator arguments
+ Gen_State : State;
+ end record;
+
+end GNAT.MBBS_Discrete_Random;
diff --git a/gcc/ada/g-mbflra.adb b/gcc/ada/g-mbflra.adb
new file mode 100644
index 00000000000..1d59069d112
--- /dev/null
+++ b/gcc/ada/g-mbflra.adb
@@ -0,0 +1,314 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- G N A T . M B B S _ F L O A T _ R A N D O M --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Calendar;
+
+package body GNAT.MBBS_Float_Random is
+
+ -------------------------
+ -- Implementation Note --
+ -------------------------
+
+ -- The design of this spec is a bit awkward, as a result of Ada 95 not
+ -- permitting in-out parameters for function formals (most naturally
+ -- Generator values would be passed this way). In pure Ada 95, the only
+ -- solution would be to add a self-referential component to the generator
+ -- allowing access to the generator object from inside the function. This
+ -- would work because the generator is limited, which prevents any copy.
+
+ -- This is a bit heavy, so what we do is to use Unrestricted_Access to
+ -- get a pointer to the state in the passed Generator. This works because
+ -- Generator is a limited type and will thus always be passed by reference.
+
+ package Calendar renames Ada.Calendar;
+
+ type Pointer is access all State;
+
+ -----------------------
+ -- Local Subprograms --
+ -----------------------
+
+ procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int);
+
+ function Euclid (P, Q : Int) return Int;
+
+ function Square_Mod_N (X, N : Int) return Int;
+
+ ------------
+ -- Euclid --
+ ------------
+
+ procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int) is
+
+ XT : Int := 1;
+ YT : Int := 0;
+
+ procedure Recur
+ (P, Q : Int; -- a (i-1), a (i)
+ X, Y : Int; -- x (i), y (i)
+ XP, YP : in out Int; -- x (i-1), y (i-1)
+ GCD : out Int);
+
+ procedure Recur
+ (P, Q : Int;
+ X, Y : Int;
+ XP, YP : in out Int;
+ GCD : out Int)
+ is
+ Quo : Int := P / Q; -- q <-- |_ a (i-1) / a (i) _|
+ XT : Int := X; -- x (i)
+ YT : Int := Y; -- y (i)
+
+ begin
+ if P rem Q = 0 then -- while does not divide
+ GCD := Q;
+ XP := X;
+ YP := Y;
+ else
+ Recur (Q, P - Q * Quo, XP - Quo * X, YP - Quo * Y, XT, YT, Quo);
+
+ -- a (i) <== a (i)
+ -- a (i+1) <-- a (i-1) - q*a (i)
+ -- x (i+1) <-- x (i-1) - q*x (i)
+ -- y (i+1) <-- y (i-1) - q*y (i)
+ -- x (i) <== x (i)
+ -- y (i) <== y (i)
+
+ XP := XT;
+ YP := YT;
+ GCD := Quo;
+ end if;
+ end Recur;
+
+ -- Start of processing for Euclid
+
+ begin
+ Recur (P, Q, 0, 1, XT, YT, GCD);
+ X := XT;
+ Y := YT;
+ end Euclid;
+
+ function Euclid (P, Q : Int) return Int is
+ X, Y, GCD : Int;
+ pragma Unreferenced (Y, GCD);
+ begin
+ Euclid (P, Q, X, Y, GCD);
+ return X;
+ end Euclid;
+
+ -----------
+ -- Image --
+ -----------
+
+ function Image (Of_State : State) return String is
+ begin
+ return Int'Image (Of_State.X1) & ',' & Int'Image (Of_State.X2)
+ & ',' &
+ Int'Image (Of_State.P) & ',' & Int'Image (Of_State.Q);
+ end Image;
+
+ ------------
+ -- Random --
+ ------------
+
+ function Random (Gen : Generator) return Uniformly_Distributed is
+ Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
+
+ begin
+ Genp.X1 := Square_Mod_N (Genp.X1, Genp.P);
+ Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q);
+ return
+ Float ((Flt (((Genp.X2 - Genp.X1) * Genp.X)
+ mod Genp.Q) * Flt (Genp.P)
+ + Flt (Genp.X1)) * Genp.Scl);
+ end Random;
+
+ -----------
+ -- Reset --
+ -----------
+
+ -- Version that works from given initiator value
+
+ procedure Reset (Gen : Generator; Initiator : Integer) is
+ Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
+ X1, X2 : Int;
+
+ begin
+ X1 := 2 + Int (Initiator) mod (K1 - 3);
+ X2 := 2 + Int (Initiator) mod (K2 - 3);
+
+ -- Eliminate effects of small initiators
+
+ for J in 1 .. 5 loop
+ X1 := Square_Mod_N (X1, K1);
+ X2 := Square_Mod_N (X2, K2);
+ end loop;
+
+ Genp.all :=
+ (X1 => X1,
+ X2 => X2,
+ P => K1,
+ Q => K2,
+ X => 1,
+ Scl => Scal);
+ end Reset;
+
+ -- Version that works from specific saved state
+
+ procedure Reset (Gen : Generator; From_State : State) is
+ Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
+
+ begin
+ Genp.all := From_State;
+ end Reset;
+
+ -- Version that works from calendar
+
+ procedure Reset (Gen : Generator) is
+ Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
+ Now : constant Calendar.Time := Calendar.Clock;
+ X1, X2 : Int;
+
+ begin
+ X1 := Int (Calendar.Year (Now)) * 12 * 31 +
+ Int (Calendar.Month (Now)) * 31 +
+ Int (Calendar.Day (Now));
+
+ X2 := Int (Calendar.Seconds (Now) * Duration (1000.0));
+
+ X1 := 2 + X1 mod (K1 - 3);
+ X2 := 2 + X2 mod (K2 - 3);
+
+ -- Eliminate visible effects of same day starts
+
+ for J in 1 .. 5 loop
+ X1 := Square_Mod_N (X1, K1);
+ X2 := Square_Mod_N (X2, K2);
+ end loop;
+
+ Genp.all :=
+ (X1 => X1,
+ X2 => X2,
+ P => K1,
+ Q => K2,
+ X => 1,
+ Scl => Scal);
+
+ end Reset;
+
+ ----------
+ -- Save --
+ ----------
+
+ procedure Save (Gen : Generator; To_State : out State) is
+ begin
+ To_State := Gen.Gen_State;
+ end Save;
+
+ ------------------
+ -- Square_Mod_N --
+ ------------------
+
+ function Square_Mod_N (X, N : Int) return Int is
+ Temp : constant Flt := Flt (X) * Flt (X);
+ Div : Int;
+
+ begin
+ Div := Int (Temp / Flt (N));
+ Div := Int (Temp - Flt (Div) * Flt (N));
+
+ if Div < 0 then
+ return Div + N;
+ else
+ return Div;
+ end if;
+ end Square_Mod_N;
+
+ -----------
+ -- Value --
+ -----------
+
+ function Value (Coded_State : String) return State is
+ Last : constant Natural := Coded_State'Last;
+ Start : Positive := Coded_State'First;
+ Stop : Positive := Coded_State'First;
+ Outs : State;
+
+ begin
+ while Stop <= Last and then Coded_State (Stop) /= ',' loop
+ Stop := Stop + 1;
+ end loop;
+
+ if Stop > Last then
+ raise Constraint_Error;
+ end if;
+
+ Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1));
+ Start := Stop + 1;
+
+ loop
+ Stop := Stop + 1;
+ exit when Stop > Last or else Coded_State (Stop) = ',';
+ end loop;
+
+ if Stop > Last then
+ raise Constraint_Error;
+ end if;
+
+ Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1));
+ Start := Stop + 1;
+
+ loop
+ Stop := Stop + 1;
+ exit when Stop > Last or else Coded_State (Stop) = ',';
+ end loop;
+
+ if Stop > Last then
+ raise Constraint_Error;
+ end if;
+
+ Outs.P := Int'Value (Coded_State (Start .. Stop - 1));
+ Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last));
+ Outs.X := Euclid (Outs.P, Outs.Q);
+ Outs.Scl := 1.0 / (Flt (Outs.P) * Flt (Outs.Q));
+
+ -- Now do *some* sanity checks
+
+ if Outs.Q < 31 or else Outs.P < 31
+ or else Outs.X1 not in 2 .. Outs.P - 1
+ or else Outs.X2 not in 2 .. Outs.Q - 1
+ then
+ raise Constraint_Error;
+ end if;
+
+ return Outs;
+ end Value;
+end GNAT.MBBS_Float_Random;
diff --git a/gcc/ada/g-mbflra.ads b/gcc/ada/g-mbflra.ads
new file mode 100644
index 00000000000..4deac482b52
--- /dev/null
+++ b/gcc/ada/g-mbflra.ads
@@ -0,0 +1,103 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- G N A T . M B B S _ F L O A T _ R A N D O M --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2010, 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- The implementation used in this package was contributed by
+-- Robert Eachus. It is based on the work of L. Blum, M. Blum, and
+-- M. Shub, SIAM Journal of Computing, Vol 15. No 2, May 1986. The
+-- particular choices for P and Q chosen here guarantee a period of
+-- 562,085,314,430,582 (about 2**49), and the generated sequence has
+-- excellent randomness properties. For further details, see the
+-- paper "Fast Generation of Trustworthy Random Numbers", by Robert
+-- Eachus, which describes both the algorithm and the efficient
+-- implementation approach used here.
+
+-- Formerly, this package was Ada.Numerics.Float_Random. It is retained
+-- here in part to allow users to reconstruct number sequences generated
+-- by previous versions.
+
+with Interfaces;
+
+package GNAT.MBBS_Float_Random is
+
+ -- Basic facilities
+
+ type Generator is limited private;
+
+ subtype Uniformly_Distributed is Float range 0.0 .. 1.0;
+
+ function Random (Gen : Generator) return Uniformly_Distributed;
+
+ procedure Reset (Gen : Generator);
+ procedure Reset (Gen : Generator; Initiator : Integer);
+
+ -- Advanced facilities
+
+ type State is private;
+
+ procedure Save (Gen : Generator; To_State : out State);
+ procedure Reset (Gen : Generator; From_State : State);
+
+ Max_Image_Width : constant := 80;
+
+ function Image (Of_State : State) return String;
+ function Value (Coded_State : String) return State;
+
+private
+ type Int is new Interfaces.Integer_32;
+
+ -- We prefer to use 14 digits for Flt, but some targets are more limited
+
+ type Flt is digits Positive'Min (14, Long_Long_Float'Digits);
+
+ K1 : constant := 94_833_359;
+ K1F : constant := 94_833_359.0;
+ K2 : constant := 47_416_679;
+ K2F : constant := 47_416_679.0;
+ Scal : constant := 1.0 / (K1F * K2F);
+
+ type State is record
+ X1 : Int := 2999 ** 2; -- Square mod p
+ X2 : Int := 1439 ** 2; -- Square mod q
+ P : Int := K1;
+ Q : Int := K2;
+ X : Int := 1;
+ Scl : Flt := Scal;
+ end record;
+
+ type Generator is limited record
+ Gen_State : State;
+ end record;
+
+end GNAT.MBBS_Float_Random;
diff --git a/gcc/ada/g-pehage.adb b/gcc/ada/g-pehage.adb
index e96b9cc0c58..b59e1ecec98 100644
--- a/gcc/ada/g-pehage.adb
+++ b/gcc/ada/g-pehage.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2009, AdaCore --
+-- Copyright (C) 2002-2010, AdaCore --
-- --
-- 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- --
@@ -31,7 +31,9 @@
-- --
------------------------------------------------------------------------------
-with Ada.IO_Exceptions; use Ada.IO_Exceptions;
+with Ada.IO_Exceptions; use Ada.IO_Exceptions;
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Ada.Directories;
with GNAT.Heap_Sort_G;
with GNAT.OS_Lib; use GNAT.OS_Lib;
@@ -143,6 +145,9 @@ package body GNAT.Perfect_Hash_Generators is
-- Return a string which includes string Str or integer Int preceded by
-- leading spaces if required by width W.
+ function Trim_Trailing_Nuls (Str : String) return String;
+ -- Return Str with trailing NUL characters removed
+
Output : File_Descriptor renames GNAT.OS_Lib.Standout;
-- Shortcuts
@@ -213,6 +218,12 @@ package body GNAT.Perfect_Hash_Generators is
procedure Put_Vertex_Table (File : File_Descriptor; Title : String);
-- Output a title and a vertex table
+ function Ada_File_Base_Name (Pkg_Name : String) return String;
+ -- Return the base file name (i.e. without .ads/.adb extension) for an
+ -- Ada source file containing the named package, using the standard GNAT
+ -- file-naming convention. For example, if Pkg_Name is "Parent.Child", we
+ -- return "parent-child".
+
----------------------------------
-- Character Position Selection --
----------------------------------
@@ -494,11 +505,29 @@ package body GNAT.Perfect_Hash_Generators is
return True;
end Acyclic;
+ ------------------------
+ -- Ada_File_Base_Name --
+ ------------------------
+
+ function Ada_File_Base_Name (Pkg_Name : String) return String is
+ begin
+ -- Convert to lower case, then replace '.' with '-'
+
+ return Result : String := To_Lower (Pkg_Name) do
+ for J in Result'Range loop
+ if Result (J) = '.' then
+ Result (J) := '-';
+ end if;
+ end loop;
+ end return;
+ end Ada_File_Base_Name;
+
---------
-- Add --
---------
procedure Add (C : Character) is
+ pragma Assert (C /= ASCII.NUL);
begin
Line (Last + 1) := C;
Last := Last + 1;
@@ -511,6 +540,11 @@ package body GNAT.Perfect_Hash_Generators is
procedure Add (S : String) is
Len : constant Natural := S'Length;
begin
+ for J in S'Range loop
+ pragma Assert (S (J) /= ASCII.NUL);
+ null;
+ end loop;
+
Line (Last + 1 .. Last + Len) := S;
Last := Last + Len;
end Add;
@@ -864,6 +898,11 @@ package body GNAT.Perfect_Hash_Generators is
procedure Finalize is
begin
+ if Verbose then
+ Put (Output, "Finalize");
+ New_Line (Output);
+ end if;
+
-- Deallocate all the WT components (both initial and reduced
-- ones) to avoid memory leaks.
@@ -1137,10 +1176,15 @@ package body GNAT.Perfect_Hash_Generators is
procedure Initialize
(Seed : Natural;
K_To_V : Float := Default_K_To_V;
- Optim : Optimization := CPU_Time;
+ Optim : Optimization := Memory_Space;
Tries : Positive := Default_Tries)
is
begin
+ if Verbose then
+ Put (Output, "Initialize");
+ New_Line (Output);
+ end if;
+
-- Deallocate the part of the table concerning the reduced words.
-- Initial words are already present in the table. We may have reduced
-- words already there because a previous computation failed. We are
@@ -1221,6 +1265,16 @@ package body GNAT.Perfect_Hash_Generators is
Len : constant Natural := Value'Length;
begin
+ if Verbose then
+ Put (Output, "Inserting """ & Value & """");
+ New_Line (Output);
+ end if;
+
+ for J in Value'Range loop
+ pragma Assert (Value (J) /= ASCII.NUL);
+ null;
+ end loop;
+
WT.Set_Last (NK);
WT.Table (NK) := New_Word (Value);
NK := NK + 1;
@@ -1369,7 +1423,7 @@ package body GNAT.Perfect_Hash_Generators is
-- Produce --
-------------
- procedure Produce (Pkg_Name : String := Default_Pkg_Name) is
+ procedure Produce (Pkg_Name : String := Default_Pkg_Name) is
File : File_Descriptor;
Status : Boolean;
@@ -1462,28 +1516,26 @@ package body GNAT.Perfect_Hash_Generators is
L : Natural;
P : Natural;
- PLen : constant Natural := Pkg_Name'Length;
- FName : String (1 .. PLen + 4);
+ FName : String := Ada_File_Base_Name (Pkg_Name) & ".ads";
+ -- Initially, the name of the spec file; then modified to be the name of
+ -- the body file.
-- Start of processing for Produce
begin
- FName (1 .. PLen) := Pkg_Name;
- for J in 1 .. PLen loop
- if FName (J) in 'A' .. 'Z' then
- FName (J) := Character'Val (Character'Pos (FName (J))
- - Character'Pos ('A')
- + Character'Pos ('a'));
-
- elsif FName (J) = '.' then
- FName (J) := '-';
- end if;
- end loop;
- FName (PLen + 1 .. PLen + 4) := ".ads";
+ if Verbose then
+ Put (Output,
+ "Producing " & Ada.Directories.Current_Directory & "/" & FName);
+ New_Line (Output);
+ end if;
File := Create_File (FName, Binary);
+ if File = Invalid_FD then
+ raise Program_Error with "cannot create: " & FName;
+ end if;
+
Put (File, "package ");
Put (File, Pkg_Name);
Put (File, " is");
@@ -1500,10 +1552,14 @@ package body GNAT.Perfect_Hash_Generators is
raise Device_Error;
end if;
- FName (PLen + 4) := 'b';
+ FName (FName'Last) := 'b'; -- Set to body file name
File := Create_File (FName, Binary);
+ if File = Invalid_FD then
+ raise Program_Error with "cannot create: " & FName;
+ end if;
+
Put (File, "with Interfaces; use Interfaces;");
New_Line (File);
New_Line (File);
@@ -1540,39 +1596,41 @@ package body GNAT.Perfect_Hash_Generators is
New_Line (File);
- if Opt = CPU_Time then
- Put_Int_Matrix
- (File,
- Array_Img ("T1", Type_Img (NV),
- Range_Img (0, T1_Len - 1),
- Range_Img (0, T2_Len - 1, Type_Img (256))),
- T1, T1_Len, T2_Len);
-
- else
- Put_Int_Matrix
- (File,
- Array_Img ("T1", Type_Img (NV),
- Range_Img (0, T1_Len - 1)),
- T1, T1_Len, 0);
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T1", Type_Img (NV),
+ Range_Img (0, T1_Len - 1),
+ Range_Img (0, T2_Len - 1, Type_Img (256))),
+ T1, T1_Len, T2_Len);
+
+ when Memory_Space =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T1", Type_Img (NV),
+ Range_Img (0, T1_Len - 1)),
+ T1, T1_Len, 0);
+ end case;
New_Line (File);
- if Opt = CPU_Time then
- Put_Int_Matrix
- (File,
- Array_Img ("T2", Type_Img (NV),
- Range_Img (0, T1_Len - 1),
- Range_Img (0, T2_Len - 1, Type_Img (256))),
- T2, T1_Len, T2_Len);
-
- else
- Put_Int_Matrix
- (File,
- Array_Img ("T2", Type_Img (NV),
- Range_Img (0, T1_Len - 1)),
- T2, T1_Len, 0);
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T2", Type_Img (NV),
+ Range_Img (0, T1_Len - 1),
+ Range_Img (0, T2_Len - 1, Type_Img (256))),
+ T2, T1_Len, T2_Len);
+
+ when Memory_Space =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T2", Type_Img (NV),
+ Range_Img (0, T1_Len - 1)),
+ T2, T1_Len, 0);
+ end case;
New_Line (File);
@@ -1594,11 +1652,12 @@ package body GNAT.Perfect_Hash_Generators is
Put (File, " J : ");
- if Opt = CPU_Time then
- Put (File, Type_Img (256));
- else
- Put (File, "Natural");
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put (File, Type_Img (256));
+ when Memory_Space =>
+ Put (File, "Natural");
+ end case;
Put (File, ";");
New_Line (File);
@@ -1611,11 +1670,12 @@ package body GNAT.Perfect_Hash_Generators is
New_Line (File);
Put (File, " J := ");
- if Opt = CPU_Time then
- Put (File, "C");
- else
- Put (File, "Character'Pos");
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put (File, "C");
+ when Memory_Space =>
+ Put (File, "Character'Pos");
+ end case;
Put (File, " (S (P (K) + F));");
New_Line (File);
@@ -1684,6 +1744,11 @@ package body GNAT.Perfect_Hash_Generators is
procedure Put (File : File_Descriptor; Str : String) is
Len : constant Natural := Str'Length;
begin
+ for J in Str'Range loop
+ pragma Assert (Str (J) /= ASCII.NUL);
+ null;
+ end loop;
+
if Write (File, Str'Address, Len) /= Len then
raise Program_Error;
end if;
@@ -1726,13 +1791,12 @@ package body GNAT.Perfect_Hash_Generators is
Last := 0;
end if;
- if Last + Len + 3 > Max then
+ if Last + Len + 3 >= Max then
Flush;
end if;
if Last = 0 then
- Line (Last + 1 .. Last + 5) := " ";
- Last := Last + 5;
+ Add (" ");
if F1 <= L1 then
if C1 = F1 and then C2 = F2 then
@@ -1759,8 +1823,7 @@ package body GNAT.Perfect_Hash_Generators is
Add (' ');
end if;
- Line (Last + 1 .. Last + Len) := S;
- Last := Last + Len;
+ Add (S);
if C2 = L2 then
Add (')');
@@ -1827,7 +1890,8 @@ package body GNAT.Perfect_Hash_Generators is
K := Get_Key (J);
Put (File, Image (J, M), F1, L1, J, 1, 3, 1);
Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2);
- Put (File, WT.Table (Initial (J)).all, F1, L1, J, 1, 3, 3);
+ Put (File, Trim_Trailing_Nuls (WT.Table (Initial (J)).all),
+ F1, L1, J, 1, 3, 3);
end loop;
end Put_Initial_Keys;
@@ -1908,7 +1972,8 @@ package body GNAT.Perfect_Hash_Generators is
K := Get_Key (J);
Put (File, Image (J, M), F1, L1, J, 1, 3, 1);
Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2);
- Put (File, WT.Table (Reduced (J)).all, F1, L1, J, 1, 3, 3);
+ Put (File, Trim_Trailing_Nuls (WT.Table (Reduced (J)).all),
+ F1, L1, J, 1, 3, 3);
end loop;
end Put_Reduced_Keys;
@@ -2295,7 +2360,8 @@ package body GNAT.Perfect_Hash_Generators is
Same_Keys_Sets_Table (J).First ..
Same_Keys_Sets_Table (J).Last
loop
- Put (Output, WT.Table (Reduced (K)).all);
+ Put (Output,
+ Trim_Trailing_Nuls (WT.Table (Reduced (K)).all));
New_Line (Output);
end loop;
Put (Output, "--");
@@ -2428,24 +2494,40 @@ package body GNAT.Perfect_Hash_Generators is
R : Natural;
begin
- if Opt = CPU_Time then
- for J in 0 .. T1_Len - 1 loop
- exit when Word (J + 1) = ASCII.NUL;
- R := Get_Table (Table, J, Get_Used_Char (Word (J + 1)));
- S := (S + R) mod NV;
- end loop;
+ case Opt is
+ when CPU_Time =>
+ for J in 0 .. T1_Len - 1 loop
+ exit when Word (J + 1) = ASCII.NUL;
+ R := Get_Table (Table, J, Get_Used_Char (Word (J + 1)));
+ S := (S + R) mod NV;
+ end loop;
- else
- for J in 0 .. T1_Len - 1 loop
- exit when Word (J + 1) = ASCII.NUL;
- R := Get_Table (Table, J, 0);
- S := (S + R * Character'Pos (Word (J + 1))) mod NV;
- end loop;
- end if;
+ when Memory_Space =>
+ for J in 0 .. T1_Len - 1 loop
+ exit when Word (J + 1) = ASCII.NUL;
+ R := Get_Table (Table, J, 0);
+ S := (S + R * Character'Pos (Word (J + 1))) mod NV;
+ end loop;
+ end case;
return S;
end Sum;
+ ------------------------
+ -- Trim_Trailing_Nuls --
+ ------------------------
+
+ function Trim_Trailing_Nuls (Str : String) return String is
+ begin
+ for J in reverse Str'Range loop
+ if Str (J) /= ASCII.NUL then
+ return Str (Str'First .. J);
+ end if;
+ end loop;
+
+ return Str;
+ end Trim_Trailing_Nuls;
+
---------------
-- Type_Size --
---------------
diff --git a/gcc/ada/g-pehage.ads b/gcc/ada/g-pehage.ads
index e4d0e902df9..dfe926ef782 100644
--- a/gcc/ada/g-pehage.ads
+++ b/gcc/ada/g-pehage.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2008, AdaCore --
+-- Copyright (C) 2002-2010, AdaCore --
-- --
-- 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- --
@@ -86,8 +86,9 @@ package GNAT.Perfect_Hash_Generators is
-- number of tries.
type Optimization is (Memory_Space, CPU_Time);
- Default_Optimization : constant Optimization := CPU_Time;
- -- Optimize either the memory space or the execution time
+ -- Optimize either the memory space or the execution time. Note: in
+ -- practice, the optimization mode has little effect on speed. The tables
+ -- are somewhat smaller with Memory_Space.
Verbose : Boolean := False;
-- Output the status of the algorithm. For instance, the tables, the random
@@ -97,7 +98,7 @@ package GNAT.Perfect_Hash_Generators is
procedure Initialize
(Seed : Natural;
K_To_V : Float := Default_K_To_V;
- Optim : Optimization := CPU_Time;
+ Optim : Optimization := Memory_Space;
Tries : Positive := Default_Tries);
-- Initialize the generator and its internal structures. Set the ratio of
-- vertices over keys in the random graphs. This value has to be greater
@@ -116,7 +117,7 @@ package GNAT.Perfect_Hash_Generators is
-- Deallocate the internal structures and the words table
procedure Insert (Value : String);
- -- Insert a new word in the table
+ -- Insert a new word into the table. ASCII.NUL characters are not allowed.
Too_Many_Tries : exception;
-- Raised after Tries unsuccessful runs
@@ -124,15 +125,19 @@ package GNAT.Perfect_Hash_Generators is
procedure Compute (Position : String := Default_Position);
-- Compute the hash function. Position allows to define selection of
-- character positions used in the word hash function. Positions can be
- -- separated by commas and range like x-y may be used. Character '$'
+ -- separated by commas and ranges like x-y may be used. Character '$'
-- represents the final character of a word. With an empty position, the
-- generator automatically produces positions to reduce the memory usage.
- -- Raise Too_Many_Tries in case that the algorithm does not succeed in less
- -- than Tries attempts (see Initialize).
+ -- Raise Too_Many_Tries if the algorithm does not succeed within Tries
+ -- attempts (see Initialize).
- procedure Produce (Pkg_Name : String := Default_Pkg_Name);
+ procedure Produce (Pkg_Name : String := Default_Pkg_Name);
-- Generate the hash function package Pkg_Name. This package includes the
- -- minimal perfect Hash function.
+ -- minimal perfect Hash function. The output is placed in the current
+ -- directory, in files X.ads and X.adb, where X is the standard GNAT file
+ -- name for a package named Pkg_Name.
+
+ ----------------------------------------------------------------
-- The routines and structures defined below allow producing the hash
-- function using a different way from the procedure above. The procedure
diff --git a/gcc/ada/g-sercom-linux.adb b/gcc/ada/g-sercom-linux.adb
index a89b09b8d08..3432f86b3d9 100644
--- a/gcc/ada/g-sercom-linux.adb
+++ b/gcc/ada/g-sercom-linux.adb
@@ -158,8 +158,8 @@ package body GNAT.Serial_Communications is
Buffer : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
- Len : constant int := Buffer'Length;
- Res : int;
+ Len : constant size_t := Buffer'Length;
+ Res : ssize_t;
begin
if Port.H = null then
@@ -264,8 +264,8 @@ package body GNAT.Serial_Communications is
(Port : in out Serial_Port;
Buffer : Stream_Element_Array)
is
- Len : constant int := Buffer'Length;
- Res : int;
+ Len : constant size_t := Buffer'Length;
+ Res : ssize_t;
begin
if Port.H = null then
@@ -273,11 +273,12 @@ package body GNAT.Serial_Communications is
end if;
Res := write (int (Port.H.all), Buffer'Address, Len);
- pragma Assert (Res = Len);
if Res = -1 then
Raise_Error ("write failed");
end if;
+
+ pragma Assert (size_t (Res) = Len);
end Write;
-----------
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index bbfaecf89c3..b75c525202f 100644
--- a/gcc/ada/g-socket.adb
+++ b/gcc/ada/g-socket.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, AdaCore --
+-- Copyright (C) 2001-2010, AdaCore --
-- --
-- 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- --
@@ -40,7 +40,6 @@ with Interfaces.C.Strings;
with GNAT.Sockets.Thin_Common; use GNAT.Sockets.Thin_Common;
with GNAT.Sockets.Thin; use GNAT.Sockets.Thin;
-with GNAT.Sockets.Thin.Task_Safe_NetDB; use GNAT.Sockets.Thin.Task_Safe_NetDB;
with GNAT.Sockets.Linker_Options;
pragma Warnings (Off, GNAT.Sockets.Linker_Options);
@@ -49,6 +48,7 @@ pragma Warnings (Off, GNAT.Sockets.Linker_Options);
with System; use System;
with System.Communication; use System.Communication;
with System.CRTL; use System.CRTL;
+with System.Task_Lock;
package body GNAT.Sockets is
@@ -59,6 +59,7 @@ package body GNAT.Sockets is
ENOERROR : constant := 0;
Netdb_Buffer_Size : constant := SOSC.Need_Netdb_Buffer * 1024;
+ Need_Netdb_Lock : constant Boolean := SOSC.Need_Netdb_Lock /= 0;
-- The network database functions gethostbyname, gethostbyaddr,
-- getservbyname and getservbyport can either be guaranteed task safe by
-- the operating system, or else return data through a user-provided buffer
@@ -155,18 +156,29 @@ package body GNAT.Sockets is
function Is_IP_Address (Name : String) return Boolean;
-- Return true when Name is an IP address in standard dot notation
+ procedure Netdb_Lock;
+ pragma Inline (Netdb_Lock);
+ procedure Netdb_Unlock;
+ pragma Inline (Netdb_Unlock);
+ -- Lock/unlock operation used to protect netdb access for platforms that
+ -- require such protection.
+
function To_In_Addr (Addr : Inet_Addr_Type) return In_Addr;
procedure To_Inet_Addr
(Addr : In_Addr;
Result : out Inet_Addr_Type);
-- Conversion functions
- function To_Host_Entry (E : Hostent) return Host_Entry_Type;
+ function To_Host_Entry (E : Hostent_Access) return Host_Entry_Type;
-- Conversion function
function To_Service_Entry (E : Servent_Access) return Service_Entry_Type;
-- Conversion function
+ function Value (S : System.Address) return String;
+ -- Same as Interfaces.C.Strings.Value but taking a System.Address (on VMS,
+ -- chars_ptr is a 32-bit pointer, and here we need a 64-bit version).
+
function To_Timeval (Val : Timeval_Duration) return Timeval;
-- Separate Val in seconds and microseconds
@@ -261,7 +273,8 @@ package body GNAT.Sockets is
function Is_Open (S : Selector_Type) return Boolean;
-- Return True for an "open" Selector_Type object, i.e. one for which
- -- Create_Selector has been called and Close_Selector has not been called.
+ -- Create_Selector has been called and Close_Selector has not been called,
+ -- or the null selector.
---------
-- "+" --
@@ -282,6 +295,10 @@ package body GNAT.Sockets is
begin
if not Is_Open (Selector) then
raise Program_Error with "closed selector";
+
+ elsif Selector.Is_Null then
+ raise Program_Error with "null selector";
+
end if;
-- Send one byte to unblock select system call
@@ -453,7 +470,7 @@ package body GNAT.Sockets is
--------------------
procedure Check_Selector
- (Selector : in out Selector_Type;
+ (Selector : Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
W_Socket_Set : in out Socket_Set_Type;
Status : out Selector_Status;
@@ -470,7 +487,7 @@ package body GNAT.Sockets is
--------------------
procedure Check_Selector
- (Selector : in out Selector_Type;
+ (Selector : Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
W_Socket_Set : in out Socket_Set_Type;
E_Socket_Set : in out Socket_Set_Type;
@@ -479,7 +496,7 @@ package body GNAT.Sockets is
is
Res : C.int;
Last : C.int;
- RSig : constant Socket_Type := Selector.R_Sig_Socket;
+ RSig : Socket_Type := No_Socket;
TVal : aliased Timeval;
TPtr : Timeval_Access;
@@ -499,9 +516,12 @@ package body GNAT.Sockets is
TPtr := TVal'Unchecked_Access;
end if;
- -- Add read signalling socket
+ -- Add read signalling socket, if present
- Set (R_Socket_Set, RSig);
+ if not Selector.Is_Null then
+ RSig := Selector.R_Sig_Socket;
+ Set (R_Socket_Set, RSig);
+ end if;
Last := C.int'Max (C.int'Max (C.int (R_Socket_Set.Last),
C.int (W_Socket_Set.Last)),
@@ -528,7 +548,7 @@ package body GNAT.Sockets is
-- If Select was resumed because of read signalling socket, read this
-- data and remove socket from set.
- if Is_Set (R_Socket_Set, RSig) then
+ if RSig /= No_Socket and then Is_Set (R_Socket_Set, RSig) then
Clear (R_Socket_Set, RSig);
Res := Signalling_Fds.Read (C.int (RSig));
@@ -573,10 +593,9 @@ package body GNAT.Sockets is
procedure Close_Selector (Selector : in out Selector_Type) is
begin
- if not Is_Open (Selector) then
-
- -- Selector already in closed state: nothing to do
+ -- Nothing to do if selector already in closed state
+ if Selector.Is_Null or else not Is_Open (Selector) then
return;
end if;
@@ -891,13 +910,20 @@ package body GNAT.Sockets is
Err : aliased C.int;
begin
- if Safe_Gethostbyaddr (HA'Address, HA'Size / 8, SOSC.AF_INET,
+ Netdb_Lock;
+
+ if C_Gethostbyaddr (HA'Address, HA'Size / 8, SOSC.AF_INET,
Res'Access, Buf'Address, Buflen, Err'Access) /= 0
then
+ Netdb_Unlock;
Raise_Host_Error (Integer (Err));
end if;
- return To_Host_Entry (Res);
+ return H : constant Host_Entry_Type :=
+ To_Host_Entry (Res'Unchecked_Access)
+ do
+ Netdb_Unlock;
+ end return;
end Get_Host_By_Address;
----------------------
@@ -920,13 +946,20 @@ package body GNAT.Sockets is
Err : aliased C.int;
begin
- if Safe_Gethostbyname
+ Netdb_Lock;
+
+ if C_Gethostbyname
(HN, Res'Access, Buf'Address, Buflen, Err'Access) /= 0
then
+ Netdb_Unlock;
Raise_Host_Error (Integer (Err));
end if;
- return To_Host_Entry (Res);
+ return H : constant Host_Entry_Type :=
+ To_Host_Entry (Res'Unchecked_Access)
+ do
+ Netdb_Unlock;
+ end return;
end;
end Get_Host_By_Name;
@@ -965,13 +998,20 @@ package body GNAT.Sockets is
Res : aliased Servent;
begin
- if Safe_Getservbyname (SN, SP, Res'Access, Buf'Address, Buflen) /= 0 then
+ Netdb_Lock;
+
+ if C_Getservbyname (SN, SP, Res'Access, Buf'Address, Buflen) /= 0 then
+ Netdb_Unlock;
raise Service_Error with "Service not found";
end if;
-- Translate from the C format to the API format
- return To_Service_Entry (Res'Unchecked_Access);
+ return S : constant Service_Entry_Type :=
+ To_Service_Entry (Res'Unchecked_Access)
+ do
+ Netdb_Unlock;
+ end return;
end Get_Service_By_Name;
-------------------------
@@ -988,16 +1028,23 @@ package body GNAT.Sockets is
Res : aliased Servent;
begin
- if Safe_Getservbyport
+ Netdb_Lock;
+
+ if C_Getservbyport
(C.int (Short_To_Network (C.unsigned_short (Port))), SP,
Res'Access, Buf'Address, Buflen) /= 0
then
+ Netdb_Unlock;
raise Service_Error with "Service not found";
end if;
-- Translate from the C format to the API format
- return To_Service_Entry (Res'Unchecked_Access);
+ return S : constant Service_Entry_Type :=
+ To_Service_Entry (Res'Unchecked_Access)
+ do
+ Netdb_Unlock;
+ end return;
end Get_Service_By_Port;
---------------------
@@ -1282,7 +1329,6 @@ package body GNAT.Sockets is
use Interfaces.C.Strings;
Img : aliased char_array := To_C (Image);
- Cp : constant chars_ptr := To_Chars_Ptr (Img'Unchecked_Access);
Addr : aliased C.int;
Res : C.int;
Result : Inet_Addr_Type;
@@ -1295,7 +1341,7 @@ package body GNAT.Sockets is
Raise_Socket_Error (SOSC.EINVAL);
end if;
- Res := Inet_Pton (SOSC.AF_INET, Cp, Addr'Address);
+ Res := Inet_Pton (SOSC.AF_INET, Img'Address, Addr'Address);
if Res < 0 then
Raise_Socket_Error (Socket_Errno);
@@ -1386,14 +1432,19 @@ package body GNAT.Sockets is
function Is_Open (S : Selector_Type) return Boolean is
begin
- -- Either both controlling socket descriptors are valid (case of an
- -- open selector) or neither (case of a closed selector).
+ if S.Is_Null then
+ return True;
- pragma Assert ((S.R_Sig_Socket /= No_Socket)
- =
- (S.W_Sig_Socket /= No_Socket));
+ else
+ -- Either both controlling socket descriptors are valid (case of an
+ -- open selector) or neither (case of a closed selector).
+
+ pragma Assert ((S.R_Sig_Socket /= No_Socket)
+ =
+ (S.W_Sig_Socket /= No_Socket));
- return S.R_Sig_Socket /= No_Socket;
+ return S.R_Sig_Socket /= No_Socket;
+ end if;
end Is_Open;
------------
@@ -1438,6 +1489,28 @@ package body GNAT.Sockets is
end if;
end Narrow;
+ ----------------
+ -- Netdb_Lock --
+ ----------------
+
+ procedure Netdb_Lock is
+ begin
+ if Need_Netdb_Lock then
+ System.Task_Lock.Lock;
+ end if;
+ end Netdb_Lock;
+
+ ------------------
+ -- Netdb_Unlock --
+ ------------------
+
+ procedure Netdb_Unlock is
+ begin
+ if Need_Netdb_Lock then
+ System.Task_Lock.Unlock;
+ end if;
+ end Netdb_Unlock;
+
--------------------------------
-- Normalize_Empty_Socket_Set --
--------------------------------
@@ -2273,54 +2346,49 @@ package body GNAT.Sockets is
-- To_Host_Entry --
-------------------
- function To_Host_Entry (E : Hostent) return Host_Entry_Type is
+ function To_Host_Entry (E : Hostent_Access) return Host_Entry_Type is
use type C.size_t;
+ use C.Strings;
- Official : constant String :=
- C.Strings.Value (E.H_Name);
-
- Aliases : constant Chars_Ptr_Array :=
- Chars_Ptr_Pointers.Value (E.H_Aliases);
- -- H_Aliases points to a list of name aliases. The list is terminated by
- -- a NULL pointer.
+ Aliases_Count, Addresses_Count : Natural;
- Addresses : constant In_Addr_Access_Array :=
- In_Addr_Access_Pointers.Value (E.H_Addr_List);
- -- H_Addr_List points to a list of binary addresses (in network byte
- -- order). The list is terminated by a NULL pointer.
- --
- -- H_Length is not used because it is currently only set to 4.
+ -- H_Length is not used because it is currently only set to 4
-- H_Addrtype is always AF_INET
- Result : Host_Entry_Type
- (Aliases_Length => Aliases'Length - 1,
- Addresses_Length => Addresses'Length - 1);
- -- The last element is a null pointer
-
- Source : C.size_t;
- Target : Natural;
-
begin
- Result.Official := To_Name (Official);
-
- Source := Aliases'First;
- Target := Result.Aliases'First;
- while Target <= Result.Aliases_Length loop
- Result.Aliases (Target) :=
- To_Name (C.Strings.Value (Aliases (Source)));
- Source := Source + 1;
- Target := Target + 1;
+ Aliases_Count := 0;
+ while Hostent_H_Alias (E, C.int (Aliases_Count)) /= Null_Address loop
+ Aliases_Count := Aliases_Count + 1;
end loop;
- Source := Addresses'First;
- Target := Result.Addresses'First;
- while Target <= Result.Addresses_Length loop
- To_Inet_Addr (Addresses (Source).all, Result.Addresses (Target));
- Source := Source + 1;
- Target := Target + 1;
+ Addresses_Count := 0;
+ while Hostent_H_Addr (E, C.int (Addresses_Count)) /= Null_Address loop
+ Addresses_Count := Addresses_Count + 1;
end loop;
- return Result;
+ return Result : Host_Entry_Type
+ (Aliases_Length => Aliases_Count,
+ Addresses_Length => Addresses_Count)
+ do
+ Result.Official := To_Name (Value (Hostent_H_Name (E)));
+
+ for J in Result.Aliases'Range loop
+ Result.Aliases (J) :=
+ To_Name (Value (Hostent_H_Alias
+ (E, C.int (J - Result.Aliases'First))));
+ end loop;
+
+ for J in Result.Addresses'Range loop
+ declare
+ Addr : In_Addr;
+ for Addr'Address use
+ Hostent_H_Addr (E, C.int (J - Result.Addresses'First));
+ pragma Import (Ada, Addr);
+ begin
+ To_Inet_Addr (Addr, Result.Addresses (J));
+ end;
+ end loop;
+ end return;
end To_Host_Entry;
----------------
@@ -2394,40 +2462,30 @@ package body GNAT.Sockets is
----------------------
function To_Service_Entry (E : Servent_Access) return Service_Entry_Type is
+ use C.Strings;
use type C.size_t;
- Official : constant String := C.Strings.Value (Servent_S_Name (E));
-
- Aliases : constant Chars_Ptr_Array :=
- Chars_Ptr_Pointers.Value (Servent_S_Aliases (E));
- -- S_Aliases points to a list of name aliases. The list is
- -- terminated by a NULL pointer.
-
- Protocol : constant String := C.Strings.Value (Servent_S_Proto (E));
-
- Result : Service_Entry_Type (Aliases_Length => Aliases'Length - 1);
- -- The last element is a null pointer
-
- Source : C.size_t;
- Target : Natural;
+ Aliases_Count : Natural;
begin
- Result.Official := To_Name (Official);
-
- Source := Aliases'First;
- Target := Result.Aliases'First;
- while Target <= Result.Aliases_Length loop
- Result.Aliases (Target) :=
- To_Name (C.Strings.Value (Aliases (Source)));
- Source := Source + 1;
- Target := Target + 1;
+ Aliases_Count := 0;
+ while Servent_S_Alias (E, C.int (Aliases_Count)) /= Null_Address loop
+ Aliases_Count := Aliases_Count + 1;
end loop;
- Result.Port :=
- Port_Type (Network_To_Short (C.unsigned_short (Servent_S_Port (E))));
+ return Result : Service_Entry_Type (Aliases_Length => Aliases_Count) do
+ Result.Official := To_Name (Value (Servent_S_Name (E)));
- Result.Protocol := To_Name (Protocol);
- return Result;
+ for J in Result.Aliases'Range loop
+ Result.Aliases (J) :=
+ To_Name (Value (Servent_S_Alias
+ (E, C.int (J - Result.Aliases'First))));
+ end loop;
+
+ Result.Protocol := To_Name (Value (Servent_S_Proto (E)));
+ Result.Port :=
+ Port_Type (Network_To_Short (Servent_S_Port (E)));
+ end return;
end To_Service_Entry;
---------------
@@ -2465,6 +2523,25 @@ package body GNAT.Sockets is
end To_Timeval;
-----------
+ -- Value --
+ -----------
+
+ function Value (S : System.Address) return String is
+ Str : String (1 .. Positive'Last);
+ for Str'Address use S;
+ pragma Import (Ada, Str);
+
+ Terminator : Positive := Str'First;
+
+ begin
+ while Str (Terminator) /= ASCII.NUL loop
+ Terminator := Terminator + 1;
+ end loop;
+
+ return Str (1 .. Terminator - 1);
+ end Value;
+
+ -----------
-- Write --
-----------
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 8d3138e65d6..55330bd784a 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2009, AdaCore --
+-- Copyright (C) 2001-2010, AdaCore --
-- --
-- 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- --
@@ -422,6 +422,11 @@ package GNAT.Sockets is
type Selector_Access is access all Selector_Type;
-- Selector objects are used to wait for i/o events to occur on sockets
+ Null_Selector : constant Selector_Type;
+ -- The Null_Selector can be used in place of a normal selector without
+ -- having to call Create_Selector if the use of Abort_Selector is not
+ -- required.
+
-- Timeval_Duration is a subtype of Standard.Duration because the full
-- range of Standard.Duration cannot be represented in the equivalent C
-- structure. Moreover, negative values are not allowed to avoid system
@@ -459,8 +464,7 @@ package GNAT.Sockets is
type Family_Type is (Family_Inet, Family_Inet6);
-- Address family (or protocol family) identifies the communication domain
- -- and groups protocols with similar address formats. IPv6 will soon be
- -- supported.
+ -- and groups protocols with similar address formats.
type Mode_Type is (Socket_Stream, Socket_Datagram);
-- Stream sockets provide connection-oriented byte streams. Datagram
@@ -665,33 +669,33 @@ package GNAT.Sockets is
-- with a socket. Options may exist at multiple protocol levels in the
-- communication stack. Socket_Level is the uppermost socket level.
- type Level_Type is (
- Socket_Level,
- IP_Protocol_For_IP_Level,
- IP_Protocol_For_UDP_Level,
- IP_Protocol_For_TCP_Level);
+ type Level_Type is
+ (Socket_Level,
+ IP_Protocol_For_IP_Level,
+ IP_Protocol_For_UDP_Level,
+ IP_Protocol_For_TCP_Level);
-- There are several options available to manipulate sockets. Each option
-- has a name and several values available. Most of the time, the value is
-- a boolean to enable or disable this option.
- type Option_Name is (
- Keep_Alive, -- Enable sending of keep-alive messages
- Reuse_Address, -- Allow bind to reuse local address
- Broadcast, -- Enable datagram sockets to recv/send broadcasts
- Send_Buffer, -- Set/get the maximum socket send buffer in bytes
- Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
- Linger, -- Shutdown wait for msg to be sent or timeout occur
- Error, -- Get and clear the pending socket error
- No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY)
- Add_Membership, -- Join a multicast group
- Drop_Membership, -- Leave a multicast group
- Multicast_If, -- Set default out interface for multicast packets
- Multicast_TTL, -- Set the time-to-live of sent multicast packets
- Multicast_Loop, -- Sent multicast packets are looped to local socket
- Receive_Packet_Info, -- Receive low level packet info as ancillary data
- Send_Timeout, -- Set timeout value for output
- Receive_Timeout); -- Set timeout value for input
+ type Option_Name is
+ (Keep_Alive, -- Enable sending of keep-alive messages
+ Reuse_Address, -- Allow bind to reuse local address
+ Broadcast, -- Enable datagram sockets to recv/send broadcasts
+ Send_Buffer, -- Set/get the maximum socket send buffer in bytes
+ Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
+ Linger, -- Shutdown wait for msg to be sent or timeout occur
+ Error, -- Get and clear the pending socket error
+ No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY)
+ Add_Membership, -- Join a multicast group
+ Drop_Membership, -- Leave a multicast group
+ Multicast_If, -- Set default out interface for multicast packets
+ Multicast_TTL, -- Set the time-to-live of sent multicast packets
+ Multicast_Loop, -- Sent multicast packets are looped to local socket
+ Receive_Packet_Info, -- Receive low level packet info as ancillary data
+ Send_Timeout, -- Set timeout value for output
+ Receive_Timeout); -- Set timeout value for input
type Option_Type (Name : Option_Name := Keep_Alive) is record
case Name is
@@ -741,8 +745,8 @@ package GNAT.Sockets is
-- socket options in that they are not specific to sockets but are
-- available for any device.
- type Request_Name is (
- Non_Blocking_IO, -- Cause a caller not to wait on blocking operations.
+ type Request_Name is
+ (Non_Blocking_IO, -- Cause a caller not to wait on blocking operations
N_Bytes_To_Read); -- Return the number of bytes available to read
type Request_Type (Name : Request_Name := Non_Blocking_IO) is record
@@ -1068,7 +1072,7 @@ package GNAT.Sockets is
-- the situation where a change to the monitored sockets set must be made.
procedure Create_Selector (Selector : out Selector_Type);
- -- Create a new selector
+ -- Initialize (open) a new selector
procedure Close_Selector (Selector : in out Selector_Type);
-- Close Selector and all internal descriptors associated; deallocate any
@@ -1078,7 +1082,7 @@ package GNAT.Sockets is
-- already closed.
procedure Check_Selector
- (Selector : in out Selector_Type;
+ (Selector : Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
W_Socket_Set : in out Socket_Set_Type;
Status : out Selector_Status;
@@ -1089,15 +1093,17 @@ package GNAT.Sockets is
-- R_Socket_Set or W_Socket_Set. Status is set to Expired if no socket was
-- ready after a Timeout expiration. Status is set to Aborted if an abort
-- signal has been received while checking socket status.
+ --
-- Note that two different Socket_Set_Type objects must be passed as
-- R_Socket_Set and W_Socket_Set (even if they denote the same set of
-- Sockets), or some event may be lost.
+ --
-- Socket_Error is raised when the select(2) system call returns an
-- error condition, or when a read error occurs on the signalling socket
-- used for the implementation of Abort_Selector.
procedure Check_Selector
- (Selector : in out Selector_Type;
+ (Selector : Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
W_Socket_Set : in out Socket_Set_Type;
E_Socket_Set : in out Socket_Set_Type;
@@ -1109,7 +1115,8 @@ package GNAT.Sockets is
-- different objects.
procedure Abort_Selector (Selector : Selector_Type);
- -- Send an abort signal to the selector
+ -- Send an abort signal to the selector. The Selector may not be the
+ -- Null_Selector.
type Fd_Set is private;
-- ??? This type must not be used directly, it needs to be visible because
@@ -1125,14 +1132,28 @@ private
type Socket_Type is new Integer;
No_Socket : constant Socket_Type := -1;
- type Selector_Type is limited record
- R_Sig_Socket : Socket_Type := No_Socket;
- W_Sig_Socket : Socket_Type := No_Socket;
- -- Signalling sockets used to abort a select operation
+ -- A selector is either a null selector, which is always "open" and can
+ -- never be aborted, or a regular selector, which is created "closed",
+ -- becomes "open" when Create_Selector is called, and "closed" again when
+ -- Close_Selector is called.
+
+ type Selector_Type (Is_Null : Boolean := False) is limited record
+ case Is_Null is
+ when True =>
+ null;
+
+ when False =>
+ R_Sig_Socket : Socket_Type := No_Socket;
+ W_Sig_Socket : Socket_Type := No_Socket;
+ -- Signalling sockets used to abort a select operation
+
+ end case;
end record;
pragma Volatile (Selector_Type);
+ Null_Selector : constant Selector_Type := (Is_Null => True);
+
type Fd_Set is
new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_fd_set);
for Fd_Set'Alignment use Interfaces.C.long'Alignment;
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index 49df16363b3..727a69ddba9 100644
--- a/gcc/ada/g-socthi-mingw.adb
+++ b/gcc/ada/g-socthi-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, AdaCore --
+-- Copyright (C) 2001-2010, AdaCore --
-- --
-- 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- --
@@ -37,8 +37,11 @@
-- This version is for NT
-with Interfaces.C.Strings; use Interfaces.C.Strings;
-with System; use System;
+with Ada.Streams; use Ada.Streams;
+with Ada.Unchecked_Conversion;
+with Interfaces.C.Strings; use Interfaces.C.Strings;
+with System; use System;
+with System.Storage_Elements; use System.Storage_Elements;
package body GNAT.Sockets.Thin is
@@ -269,8 +272,14 @@ package body GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
+ use type C.size_t;
+
+ Fill : constant Boolean :=
+ (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
+ -- Is the MSG_WAITALL flag set? If so we need to fully fill all vectors
+
Res : C.int;
Count : C.int := 0;
@@ -281,25 +290,81 @@ package body GNAT.Sockets.Thin is
for Iovec'Address use MH.Msg_Iov;
pragma Import (Ada, Iovec);
+ Iov_Index : Integer;
+ Current_Iovec : Vector_Element;
+
+ function To_Access is new Ada.Unchecked_Conversion
+ (System.Address, Stream_Element_Reference);
+ pragma Warnings (Off, Stream_Element_Reference);
+
+ Req : Request_Type (Name => N_Bytes_To_Read);
+
begin
-- Windows does not provide an implementation of recvmsg(). The spec for
-- WSARecvMsg() is incompatible with the data types we define, and is
- -- not available in all versions of Windows. So, we use C_Recv instead.
+ -- available starting with Windows Vista and Server 2008 only. So,
+ -- we use C_Recv instead.
- for J in Iovec'Range loop
- Res := C_Recv
- (S,
- Iovec (J).Base.all'Address,
- C.int (Iovec (J).Length),
- Flags);
+ -- Check how much data are available
+
+ Control_Socket (Socket_Type (S), Req);
+
+ -- Fill the vectors
+
+ Iov_Index := -1;
+ Current_Iovec := (Base => null, Length => 0);
+
+ loop
+ if Current_Iovec.Length = 0 then
+ Iov_Index := Iov_Index + 1;
+ exit when Iov_Index > Integer (Iovec'Last);
+ Current_Iovec := Iovec (SOSC.Msg_Iovlen_T (Iov_Index));
+ end if;
+
+ Res :=
+ C_Recv
+ (S,
+ Current_Iovec.Base.all'Address,
+ C.int (Current_Iovec.Length),
+ Flags);
if Res < 0 then
- return ssize_t (Res);
+ return System.CRTL.ssize_t (Res);
+
+ elsif Res = 0 and then not Fill then
+ exit;
+
else
+ pragma Assert (Stream_Element_Count (Res) <= Current_Iovec.Length);
+
Count := Count + Res;
+ Current_Iovec.Length :=
+ Current_Iovec.Length - Stream_Element_Count (Res);
+ Current_Iovec.Base :=
+ To_Access (Current_Iovec.Base.all'Address
+ + Storage_Offset (Res));
+
+ -- If all the data that was initially available read, do not
+ -- attempt to receive more, since this might block, or merge data
+ -- from successive datagrams for a datagram-oriented socket. We
+ -- still try to receive more if we need to fill all vectors
+ -- (MSG_WAITALL flag is set).
+
+ exit when Natural (Count) >= Req.Size
+ and then
+
+ -- Either we are not in fill mode
+
+ (not Fill
+
+ -- Or else last vector filled
+
+ or else (Interfaces.C.size_t (Iov_Index) = Iovec'Last
+ and then Current_Iovec.Length = 0));
end if;
end loop;
- return ssize_t (Count);
+
+ return System.CRTL.ssize_t (Count);
end C_Recvmsg;
--------------
@@ -322,8 +387,8 @@ package body GNAT.Sockets.Thin is
Last : aliased C.int;
begin
- -- Asynchronous connection failures are notified in the exception fd set
- -- instead of the write fd set. To ensure POSIX compatibility, copy
+ -- Asynchronous connection failures are notified in the exception fd
+ -- set instead of the write fd set. To ensure POSIX compatibility, copy
-- write fd set into exception fd set. Once select() returns, check any
-- socket present in the exception fd set and peek at incoming
-- out-of-band data. If the test is not successful, and the socket is
@@ -369,10 +434,11 @@ package body GNAT.Sockets.Thin is
-- Check out-of-band data
- Length := C_Recvfrom
- (S, Buffer'Address, 1, Flag,
- From => System.Null_Address,
- Fromlen => Fromlen'Unchecked_Access);
+ Length :=
+ C_Recvfrom
+ (S, Buffer'Address, 1, Flag,
+ From => System.Null_Address,
+ Fromlen => Fromlen'Unchecked_Access);
-- Is Fromlen necessary if From is Null_Address???
-- If the signal is not an out-of-band data, then it
@@ -404,8 +470,10 @@ package body GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
+ use type C.size_t;
+
Res : C.int;
Count : C.int := 0;
@@ -419,25 +487,31 @@ package body GNAT.Sockets.Thin is
begin
-- Windows does not provide an implementation of sendmsg(). The spec for
-- WSASendMsg() is incompatible with the data types we define, and is
- -- not available in all versions of Windows. So, we'll use C_Sendto
- -- instead.
+ -- available starting with Windows Vista and Server 2008 only. So
+ -- use C_Sendto instead.
for J in Iovec'Range loop
- Res := C_Sendto
- (S,
- Iovec (J).Base.all'Address,
- C.int (Iovec (J).Length),
- Flags => Flags,
- To => MH.Msg_Name,
- Tolen => C.int (MH.Msg_Namelen));
+ Res :=
+ C_Sendto
+ (S,
+ Iovec (J).Base.all'Address,
+ C.int (Iovec (J).Length),
+ Flags => Flags,
+ To => MH.Msg_Name,
+ Tolen => C.int (MH.Msg_Namelen));
if Res < 0 then
- return ssize_t (Res);
+ return System.CRTL.ssize_t (Res);
else
Count := Count + Res;
end if;
+
+ -- Exit now if the buffer is not fully transmitted
+
+ exit when Stream_Element_Count (Res) < Iovec (J).Length;
end loop;
- return ssize_t (Count);
+
+ return System.CRTL.ssize_t (Count);
end C_Sendmsg;
--------------
@@ -459,13 +533,12 @@ package body GNAT.Sockets.Thin is
package body Host_Error_Messages is
-- On Windows, socket and host errors share the same code space, and
- -- error messages are provided by Socket_Error_Message. The default
- -- separate body for Host_Error_Messages is therefore not used in
- -- this case.
+ -- error messages are provided by Socket_Error_Message, so the default
+ -- separate body for Host_Error_Messages is not used in this case.
function Host_Error_Message
(H_Errno : Integer) return C.Strings.chars_ptr
- renames Socket_Error_Message;
+ renames Socket_Error_Message;
end Host_Error_Messages;
diff --git a/gcc/ada/g-socthi-mingw.ads b/gcc/ada/g-socthi-mingw.ads
index 6d851e17cb4..bc1f256497e 100644
--- a/gcc/ada/g-socthi-mingw.ads
+++ b/gcc/ada/g-socthi-mingw.ads
@@ -42,6 +42,7 @@ with Interfaces.C.Strings;
with GNAT.Sockets.Thin_Common;
with System;
+with System.CRTL;
package GNAT.Sockets.Thin is
@@ -49,10 +50,7 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
- use type C.size_t;
- type ssize_t is range -(2 ** (C.size_t'Size - 1))
- .. +(2 ** (C.size_t'Size - 1) - 1);
- -- Signed type of the same size as size_t
+ use type System.CRTL.ssize_t;
function Socket_Errno return Integer;
-- Returns last socket error number
@@ -146,7 +144,7 @@ package GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Select
(Nfds : C.int;
@@ -158,7 +156,7 @@ package GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Sendto
(S : C.int;
diff --git a/gcc/ada/g-socthi-vms.adb b/gcc/ada/g-socthi-vms.adb
index b9e23ecbfb5..1331821446f 100644
--- a/gcc/ada/g-socthi-vms.adb
+++ b/gcc/ada/g-socthi-vms.adb
@@ -292,7 +292,7 @@ package body GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
Res : C.int;
@@ -314,7 +314,7 @@ package body GNAT.Sockets.Thin is
GNAT_Msg := Msghdr (VMS_Msg);
- return ssize_t (Res);
+ return System.CRTL.ssize_t (Res);
end C_Recvmsg;
---------------
@@ -324,7 +324,7 @@ package body GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
Res : C.int;
@@ -346,7 +346,7 @@ package body GNAT.Sockets.Thin is
GNAT_Msg := Msghdr (VMS_Msg);
- return ssize_t (Res);
+ return System.CRTL.ssize_t (Res);
end C_Sendmsg;
--------------
diff --git a/gcc/ada/g-socthi-vms.ads b/gcc/ada/g-socthi-vms.ads
index a1bb487e136..3a443ac652d 100644
--- a/gcc/ada/g-socthi-vms.ads
+++ b/gcc/ada/g-socthi-vms.ads
@@ -43,6 +43,7 @@ with GNAT.OS_Lib;
with GNAT.Sockets.Thin_Common;
with System;
+with System.CRTL;
package GNAT.Sockets.Thin is
@@ -52,10 +53,7 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
- use type C.size_t;
- type ssize_t is range -(2 ** (C.size_t'Size - 1))
- .. +(2 ** (C.size_t'Size - 1) - 1);
- -- Signed type of the same size as size_t
+ use type System.CRTL.ssize_t;
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@@ -149,7 +147,7 @@ package GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Select
(Nfds : C.int;
@@ -161,7 +159,7 @@ package GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Sendto
(S : C.int;
diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb
index e6a8ee60644..8c119661ed4 100644
--- a/gcc/ada/g-socthi-vxworks.adb
+++ b/gcc/ada/g-socthi-vxworks.adb
@@ -309,7 +309,7 @@ package body GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
Res : C.int;
@@ -323,7 +323,7 @@ package body GNAT.Sockets.Thin is
delay Quantum;
end loop;
- return ssize_t (Res);
+ return System.CRTL.ssize_t (Res);
end C_Recvmsg;
---------------
@@ -333,7 +333,7 @@ package body GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
Res : C.int;
@@ -347,7 +347,7 @@ package body GNAT.Sockets.Thin is
delay Quantum;
end loop;
- return ssize_t (Res);
+ return System.CRTL.ssize_t (Res);
end C_Sendmsg;
--------------
diff --git a/gcc/ada/g-socthi-vxworks.ads b/gcc/ada/g-socthi-vxworks.ads
index 4f92b3a8143..64cc87668ce 100644
--- a/gcc/ada/g-socthi-vxworks.ads
+++ b/gcc/ada/g-socthi-vxworks.ads
@@ -43,6 +43,7 @@ with GNAT.OS_Lib;
with GNAT.Sockets.Thin_Common;
with System;
+with System.CRTL;
package GNAT.Sockets.Thin is
@@ -50,10 +51,7 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
- use type C.size_t;
- type ssize_t is range -(2 ** (C.size_t'Size - 1))
- .. +(2 ** (C.size_t'Size - 1) - 1);
- -- Signed type of the same size as size_t
+ use type System.CRTL.ssize_t;
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@@ -147,7 +145,7 @@ package GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Select
(Nfds : C.int;
@@ -159,7 +157,7 @@ package GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Sendto
(S : C.int;
diff --git a/gcc/ada/g-socthi.adb b/gcc/ada/g-socthi.adb
index ca797631b08..301d8be45d4 100644
--- a/gcc/ada/g-socthi.adb
+++ b/gcc/ada/g-socthi.adb
@@ -95,13 +95,13 @@ package body GNAT.Sockets.Thin is
function Syscall_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
pragma Import (C, Syscall_Recvmsg, "recvmsg");
function Syscall_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
pragma Import (C, Syscall_Sendmsg, "sendmsg");
function Syscall_Sendto
@@ -307,15 +307,15 @@ package body GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
- Res : ssize_t;
+ Res : System.CRTL.ssize_t;
begin
loop
Res := Syscall_Recvmsg (S, Msg, Flags);
exit when SOSC.Thread_Blocking_IO
- or else Res /= ssize_t (Failure)
+ or else Res /= System.CRTL.ssize_t (Failure)
or else Non_Blocking_Socket (S)
or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
@@ -331,15 +331,15 @@ package body GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t
+ Flags : C.int) return System.CRTL.ssize_t
is
- Res : ssize_t;
+ Res : System.CRTL.ssize_t;
begin
loop
Res := Syscall_Sendmsg (S, Msg, Flags);
exit when SOSC.Thread_Blocking_IO
- or else Res /= ssize_t (Failure)
+ or else Res /= System.CRTL.ssize_t (Failure)
or else Non_Blocking_Socket (S)
or else Errno /= SOSC.EWOULDBLOCK;
delay Quantum;
diff --git a/gcc/ada/g-socthi.ads b/gcc/ada/g-socthi.ads
index 1f103e89a74..32013c35e7f 100644
--- a/gcc/ada/g-socthi.ads
+++ b/gcc/ada/g-socthi.ads
@@ -43,6 +43,7 @@ with GNAT.OS_Lib;
with GNAT.Sockets.Thin_Common;
with System;
+with System.CRTL;
package GNAT.Sockets.Thin is
@@ -54,10 +55,7 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
- use type C.size_t;
- type ssize_t is range -(2 ** (C.size_t'Size - 1))
- .. +(2 ** (C.size_t'Size - 1) - 1);
- -- Signed type of the same size as size_t
+ use type System.CRTL.ssize_t;
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@@ -148,7 +146,7 @@ package GNAT.Sockets.Thin is
function C_Recvmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Select
(Nfds : C.int;
@@ -160,7 +158,7 @@ package GNAT.Sockets.Thin is
function C_Sendmsg
(S : C.int;
Msg : System.Address;
- Flags : C.int) return ssize_t;
+ Flags : C.int) return System.CRTL.ssize_t;
function C_Sendto
(S : C.int;
diff --git a/gcc/ada/g-sothco.ads b/gcc/ada/g-sothco.ads
index 82003e2ffd5..6ffd06631e7 100644
--- a/gcc/ada/g-sothco.ads
+++ b/gcc/ada/g-sothco.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2008-2009, AdaCore --
+-- Copyright (C) 2008-2010, AdaCore --
-- --
-- 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- --
@@ -38,7 +38,6 @@ with Ada.Unchecked_Conversion;
with Interfaces.C;
with Interfaces.C.Pointers;
-with Interfaces.C.Strings;
package GNAT.Sockets.Thin_Common is
@@ -200,18 +199,45 @@ package GNAT.Sockets.Thin_Common is
pragma Inline (Set_Address);
-- Set Sin.Sin_Addr to Address
+ ------------------
+ -- Host entries --
+ ------------------
+
+ type Hostent is new
+ System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_hostent);
+ for Hostent'Alignment use 8;
+ -- Host entry. This is an opaque type used only via the following
+ -- accessor functions, because 'struct hostent' has different layouts on
+ -- different platforms.
+
+ type Hostent_Access is access all Hostent;
+ pragma Convention (C, Hostent_Access);
+ -- Access to host entry
+
+ -- Note: the hostent and servent accessors that return char*
+ -- values are compiled with GCC, and on VMS they always return
+ -- 64-bit pointers, so we can't use C.Strings.chars_ptr, which
+ -- on VMS is 32 bits.
+
+ function Hostent_H_Name
+ (E : Hostent_Access) return System.Address;
+
+ function Hostent_H_Alias
+ (E : Hostent_Access; I : C.int) return System.Address;
+
+ function Hostent_H_Addrtype
+ (E : Hostent_Access) return C.int;
+
+ function Hostent_H_Length
+ (E : Hostent_Access) return C.int;
+
+ function Hostent_H_Addr
+ (E : Hostent_Access; Index : C.int) return System.Address;
+
---------------------
-- Service entries --
---------------------
- type Chars_Ptr_Array is array (C.size_t range <>) of
- aliased C.Strings.chars_ptr;
-
- package Chars_Ptr_Pointers is
- new C.Pointers (C.size_t, C.Strings.chars_ptr, Chars_Ptr_Array,
- C.Strings.Null_Ptr);
- -- Arrays of C (char *)
-
type Servent is new
System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_servent);
for Servent'Alignment use 8;
@@ -224,50 +250,62 @@ package GNAT.Sockets.Thin_Common is
-- Access to service entry
function Servent_S_Name
- (E : Servent_Access) return C.Strings.chars_ptr;
+ (E : Servent_Access) return System.Address;
- function Servent_S_Aliases
- (E : Servent_Access) return Chars_Ptr_Pointers.Pointer;
+ function Servent_S_Alias
+ (E : Servent_Access; Index : C.int) return System.Address;
function Servent_S_Port
- (E : Servent_Access) return C.int;
+ (E : Servent_Access) return C.unsigned_short;
function Servent_S_Proto
- (E : Servent_Access) return C.Strings.chars_ptr;
-
- procedure Servent_Set_S_Name
- (E : Servent_Access;
- S_Name : C.Strings.chars_ptr);
-
- procedure Servent_Set_S_Aliases
- (E : Servent_Access;
- S_Aliases : Chars_Ptr_Pointers.Pointer);
-
- procedure Servent_Set_S_Port
- (E : Servent_Access;
- S_Port : C.int);
-
- procedure Servent_Set_S_Proto
- (E : Servent_Access;
- S_Proto : C.Strings.chars_ptr);
+ (E : Servent_Access) return System.Address;
------------------
- -- Host entries --
+ -- NetDB access --
------------------
- type Hostent is record
- H_Name : C.Strings.chars_ptr;
- H_Aliases : Chars_Ptr_Pointers.Pointer;
- H_Addrtype : SOSC.H_Addrtype_T;
- H_Length : SOSC.H_Length_T;
- H_Addr_List : In_Addr_Access_Pointers.Pointer;
- end record;
- pragma Convention (C, Hostent);
- -- Host entry
-
- type Hostent_Access is access all Hostent;
- pragma Convention (C, Hostent_Access);
- -- Access to host entry
+ -- There are three possible situations for the following NetDB access
+ -- functions:
+ -- - inherently thread safe (case of data returned in a thread specific
+ -- buffer);
+ -- - thread safe using user-provided buffer;
+ -- - thread unsafe.
+ --
+ -- In the first and third cases, the Buf and Buflen are ignored. In the
+ -- second case, the caller must provide a buffer large enough to accomodate
+ -- the returned data. In the third case, the caller must ensure that these
+ -- functions are called within a critical section.
+
+ function C_Gethostbyname
+ (Name : C.char_array;
+ Ret : not null access Hostent;
+ Buf : System.Address;
+ Buflen : C.int;
+ H_Errnop : not null access C.int) return C.int;
+
+ function C_Gethostbyaddr
+ (Addr : System.Address;
+ Addr_Len : C.int;
+ Addr_Type : C.int;
+ Ret : not null access Hostent;
+ Buf : System.Address;
+ Buflen : C.int;
+ H_Errnop : not null access C.int) return C.int;
+
+ function C_Getservbyname
+ (Name : C.char_array;
+ Proto : C.char_array;
+ Ret : not null access Servent;
+ Buf : System.Address;
+ Buflen : C.int) return C.int;
+
+ function C_Getservbyport
+ (Port : C.int;
+ Proto : C.char_array;
+ Ret : not null access Servent;
+ Buf : System.Address;
+ Buflen : C.int) return C.int;
------------------------------------
-- Scatter/gather vector handling --
@@ -344,7 +382,7 @@ package GNAT.Sockets.Thin_Common is
function Inet_Pton
(Af : C.int;
- Cp : C.Strings.chars_ptr;
+ Cp : System.Address;
Inp : System.Address) return C.int;
function C_Ioctl
@@ -362,12 +400,20 @@ private
pragma Import (C, C_Ioctl, "__gnat_socket_ioctl");
pragma Import (C, Inet_Pton, SOSC.Inet_Pton_Linkname);
- pragma Import (C, Servent_S_Name, "__gnat_servent_s_name");
- pragma Import (C, Servent_S_Aliases, "__gnat_servent_s_aliases");
- pragma Import (C, Servent_S_Port, "__gnat_servent_s_port");
+ pragma Import (C, C_Gethostbyname, "__gnat_gethostbyname");
+ pragma Import (C, C_Gethostbyaddr, "__gnat_gethostbyaddr");
+ pragma Import (C, C_Getservbyname, "__gnat_getservbyname");
+ pragma Import (C, C_Getservbyport, "__gnat_getservbyport");
+
+ pragma Import (C, Servent_S_Name, "__gnat_servent_s_name");
+ pragma Import (C, Servent_S_Alias, "__gnat_servent_s_alias");
+ pragma Import (C, Servent_S_Port, "__gnat_servent_s_port");
pragma Import (C, Servent_S_Proto, "__gnat_servent_s_proto");
- pragma Import (C, Servent_Set_S_Name, "__gnat_servent_set_s_name");
- pragma Import (C, Servent_Set_S_Aliases, "__gnat_servent_set_s_aliases");
- pragma Import (C, Servent_Set_S_Port, "__gnat_servent_set_s_port");
- pragma Import (C, Servent_Set_S_Proto, "__gnat_servent_set_s_proto");
+
+ pragma Import (C, Hostent_H_Name, "__gnat_hostent_h_name");
+ pragma Import (C, Hostent_H_Alias, "__gnat_hostent_h_alias");
+ pragma Import (C, Hostent_H_Addrtype, "__gnat_hostent_h_addrtype");
+ pragma Import (C, Hostent_H_Length, "__gnat_hostent_h_length");
+ pragma Import (C, Hostent_H_Addr, "__gnat_hostent_h_addr");
+
end GNAT.Sockets.Thin_Common;
diff --git a/gcc/ada/g-spipat.adb b/gcc/ada/g-spipat.adb
index c5c07f105e2..a85697507f3 100644
--- a/gcc/ada/g-spipat.adb
+++ b/gcc/ada/g-spipat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2008, AdaCore --
+-- Copyright (C) 1998-2009, AdaCore --
-- --
-- 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- --
@@ -2793,9 +2793,8 @@ package body GNAT.Spitbol.Patterns is
(Subject : VString;
Pat : Pattern) return Boolean
is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
-
Start : Natural;
Stop : Natural;
pragma Unreferenced (Stop);
@@ -2838,7 +2837,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -2867,7 +2866,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -2892,7 +2891,7 @@ package body GNAT.Spitbol.Patterns is
(Subject : VString;
Pat : Pattern)
is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
Start : Natural;
@@ -2933,7 +2932,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -2958,7 +2957,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -2980,7 +2979,7 @@ package body GNAT.Spitbol.Patterns is
Pat : PString) return Boolean
is
Pat_Len : constant Natural := Pat'Length;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3038,7 +3037,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3067,7 +3066,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3092,7 +3091,7 @@ package body GNAT.Spitbol.Patterns is
(Subject : VString;
Pat : PString)
is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
Start : Natural;
@@ -3133,7 +3132,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3158,7 +3157,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3182,7 +3181,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3213,7 +3212,7 @@ package body GNAT.Spitbol.Patterns is
is
Start : Natural;
Stop : Natural;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3362,7 +3361,7 @@ package body GNAT.Spitbol.Patterns is
(Result : in out Match_Result;
Replace : VString)
is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3955,7 +3954,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Any_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -3975,7 +3974,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Any_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4142,7 +4141,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Break_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4163,7 +4162,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Break_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4210,7 +4209,7 @@ package body GNAT.Spitbol.Patterns is
when PC_BreakX_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4231,7 +4230,7 @@ package body GNAT.Spitbol.Patterns is
when PC_BreakX_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4376,7 +4375,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NotAny_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4397,7 +4396,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NotAny_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4440,7 +4439,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NSpan_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4459,7 +4458,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NSpan_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4682,7 +4681,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Span_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
P : Natural;
@@ -4708,7 +4707,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Span_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
P : Natural;
@@ -4809,7 +4808,7 @@ package body GNAT.Spitbol.Patterns is
when PC_String_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -4829,7 +4828,7 @@ package body GNAT.Spitbol.Patterns is
when PC_String_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5354,7 +5353,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Any_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5376,7 +5375,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Any_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5563,7 +5562,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Break_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5585,7 +5584,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Break_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5637,7 +5636,7 @@ package body GNAT.Spitbol.Patterns is
when PC_BreakX_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5659,7 +5658,7 @@ package body GNAT.Spitbol.Patterns is
when PC_BreakX_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5826,7 +5825,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NotAny_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5848,7 +5847,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NotAny_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5896,7 +5895,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NSpan_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -5916,7 +5915,7 @@ package body GNAT.Spitbol.Patterns is
when PC_NSpan_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -6172,7 +6171,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Span_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
P : Natural;
@@ -6199,7 +6198,7 @@ package body GNAT.Spitbol.Patterns is
when PC_Span_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
P : Natural;
@@ -6314,7 +6313,7 @@ package body GNAT.Spitbol.Patterns is
when PC_String_VF => declare
U : constant VString := Node.VF.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -6335,7 +6334,7 @@ package body GNAT.Spitbol.Patterns is
when PC_String_VP => declare
U : constant VString := Node.VP.all;
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
diff --git a/gcc/ada/g-spitbo.adb b/gcc/ada/g-spitbo.adb
index 5b5e2a78e04..4769fa3025d 100644
--- a/gcc/ada/g-spitbo.adb
+++ b/gcc/ada/g-spitbo.adb
@@ -135,7 +135,7 @@ package body GNAT.Spitbol is
-------
function N (Str : VString) return Integer is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
Get_String (Str, S, L);
@@ -147,7 +147,7 @@ package body GNAT.Spitbol is
--------------------
function Reverse_String (Str : VString) return VString is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -177,7 +177,7 @@ package body GNAT.Spitbol is
end Reverse_String;
procedure Reverse_String (Str : in out VString) is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -191,7 +191,7 @@ package body GNAT.Spitbol is
Result (J) := S (L + 1 - J);
end loop;
- Set_String (Str, Result);
+ Set_Unbounded_String (Str, Result);
end;
end Reverse_String;
@@ -284,7 +284,7 @@ package body GNAT.Spitbol is
Start : Positive;
Len : Natural) return VString
is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
@@ -413,7 +413,7 @@ package body GNAT.Spitbol is
if Elmt.Name /= null then
loop
- Set_String (TA (P).Name, Elmt.Name.all);
+ Set_Unbounded_String (TA (P).Name, Elmt.Name.all);
TA (P).Value := Elmt.Value;
P := P + 1;
Elmt := Elmt.Next;
@@ -458,7 +458,7 @@ package body GNAT.Spitbol is
end Delete;
procedure Delete (T : in out Table; Name : VString) is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
@@ -584,7 +584,7 @@ package body GNAT.Spitbol is
end Get;
function Get (T : Table; Name : VString) return Value_Type is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
@@ -625,7 +625,7 @@ package body GNAT.Spitbol is
end Present;
function Present (T : Table; Name : VString) return Boolean is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
@@ -661,7 +661,7 @@ package body GNAT.Spitbol is
---------
procedure Set (T : in out Table; Name : VString; Value : Value_Type) is
- S : String_Access;
+ S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
diff --git a/gcc/ada/g-sttsne-locking.adb b/gcc/ada/g-sttsne-locking.adb
deleted file mode 100644
index c5e39b734b9..00000000000
--- a/gcc/ada/g-sttsne-locking.adb
+++ /dev/null
@@ -1,460 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B --
--- --
--- B o d y --
--- --
--- Copyright (C) 2007-2009, AdaCore --
--- --
--- 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT 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 distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This version is used on VMS and LynxOS
-
-with GNAT.Task_Lock;
-
-with Interfaces.C; use Interfaces.C;
-
-package body GNAT.Sockets.Thin.Task_Safe_NetDB is
-
- -- The Safe_GetXXXbyYYY routines wrap the Nonreentrant_ versions using the
- -- task lock, and copy the relevant data structures (under the lock) into
- -- the result. The Nonreentrant_ versions are expected to be in the parent
- -- package GNAT.Sockets.Thin (on platforms that use this version of
- -- Task_Safe_NetDB).
-
- procedure Copy_Host_Entry
- (Source_Hostent : Hostent;
- Target_Hostent : out Hostent;
- Target_Buffer : System.Address;
- Target_Buffer_Length : C.int;
- Result : out C.int);
- -- Copy all the information from Source_Hostent into Target_Hostent,
- -- using Target_Buffer to store associated data.
- -- 0 is returned on success, -1 on failure (in case the provided buffer
- -- is too small for the associated data).
-
- procedure Copy_Service_Entry
- (Source_Servent : Servent_Access;
- Target_Servent : Servent_Access;
- Target_Buffer : System.Address;
- Target_Buffer_Length : C.int;
- Result : out C.int);
- -- Copy all the information from Source_Servent into Target_Servent,
- -- using Target_Buffer to store associated data.
- -- 0 is returned on success, -1 on failure (in case the provided buffer
- -- is too small for the associated data).
-
- procedure Store_Name
- (Name : char_array;
- Storage : in out char_array;
- Storage_Index : in out size_t;
- Stored_Name : out C.Strings.chars_ptr);
- -- Store the given Name at the first available location in Storage
- -- (indicated by Storage_Index, which is updated afterwards), and return
- -- the address of that location in Stored_Name.
- -- (Supporting routine for the two below).
-
- ---------------------
- -- Copy_Host_Entry --
- ---------------------
-
- procedure Copy_Host_Entry
- (Source_Hostent : Hostent;
- Target_Hostent : out Hostent;
- Target_Buffer : System.Address;
- Target_Buffer_Length : C.int;
- Result : out C.int)
- is
- use type C.Strings.chars_ptr;
-
- Names_Length : size_t;
-
- Source_Aliases : Chars_Ptr_Array
- renames Chars_Ptr_Pointers.Value
- (Source_Hostent.H_Aliases, Terminator => C.Strings.Null_Ptr);
- -- Null-terminated list of aliases (last element of this array is
- -- Null_Ptr).
-
- Source_Addresses : In_Addr_Access_Array
- renames In_Addr_Access_Pointers.Value
- (Source_Hostent.H_Addr_List, Terminator => null);
-
- begin
- Result := -1;
- Names_Length := C.Strings.Strlen (Source_Hostent.H_Name) + 1;
-
- for J in Source_Aliases'Range loop
- if Source_Aliases (J) /= C.Strings.Null_Ptr then
- Names_Length :=
- Names_Length + C.Strings.Strlen (Source_Aliases (J)) + 1;
- end if;
- end loop;
-
- declare
- type In_Addr_Array is array (Source_Addresses'Range)
- of aliased In_Addr;
-
- type Netdb_Host_Data is record
- Aliases_List : aliased Chars_Ptr_Array (Source_Aliases'Range);
- Names : aliased char_array (1 .. Names_Length);
-
- Addresses_List : aliased In_Addr_Access_Array
- (In_Addr_Array'Range);
- Addresses : In_Addr_Array;
- -- ??? This assumes support only for Inet family
-
- end record;
-
- Netdb_Data : Netdb_Host_Data;
- pragma Import (Ada, Netdb_Data);
- for Netdb_Data'Address use Target_Buffer;
-
- Names_Index : size_t := Netdb_Data.Names'First;
- -- Index of first available location in Netdb_Data.Names
-
- begin
- if Netdb_Data'Size / 8 > Target_Buffer_Length then
- return;
- end if;
-
- -- Copy host name
-
- Store_Name
- (C.Strings.Value (Source_Hostent.H_Name),
- Netdb_Data.Names, Names_Index,
- Target_Hostent.H_Name);
-
- -- Copy aliases (null-terminated string pointer array)
-
- Target_Hostent.H_Aliases :=
- Netdb_Data.Aliases_List
- (Netdb_Data.Aliases_List'First)'Unchecked_Access;
- for J in Netdb_Data.Aliases_List'Range loop
- if J = Netdb_Data.Aliases_List'Last then
- Netdb_Data.Aliases_List (J) := C.Strings.Null_Ptr;
- else
- Store_Name
- (C.Strings.Value (Source_Aliases (J)),
- Netdb_Data.Names, Names_Index,
- Netdb_Data.Aliases_List (J));
- end if;
- end loop;
-
- -- Copy address type and length
-
- Target_Hostent.H_Addrtype := Source_Hostent.H_Addrtype;
- Target_Hostent.H_Length := Source_Hostent.H_Length;
-
- -- Copy addresses
-
- Target_Hostent.H_Addr_List :=
- Netdb_Data.Addresses_List
- (Netdb_Data.Addresses_List'First)'Unchecked_Access;
-
- for J in Netdb_Data.Addresses'Range loop
- if J = Netdb_Data.Addresses'Last then
- Netdb_Data.Addresses_List (J) := null;
- else
- Netdb_Data.Addresses_List (J) :=
- Netdb_Data.Addresses (J)'Unchecked_Access;
-
- Netdb_Data.Addresses (J) := Source_Addresses (J).all;
- end if;
- end loop;
- end;
-
- Result := 0;
- end Copy_Host_Entry;
-
- ------------------------
- -- Copy_Service_Entry --
- ------------------------
-
- procedure Copy_Service_Entry
- (Source_Servent : Servent_Access;
- Target_Servent : Servent_Access;
- Target_Buffer : System.Address;
- Target_Buffer_Length : C.int;
- Result : out C.int)
- is
- use type C.Strings.chars_ptr;
-
- Names_Length : size_t;
-
- Source_Aliases : Chars_Ptr_Array
- renames Chars_Ptr_Pointers.Value
- (Servent_S_Aliases (Source_Servent),
- Terminator => C.Strings.Null_Ptr);
- -- Null-terminated list of aliases (last element of this array is
- -- Null_Ptr).
-
- begin
- Result := -1;
- Names_Length := C.Strings.Strlen (Servent_S_Name (Source_Servent)) + 1 +
- C.Strings.Strlen (Servent_S_Proto (Source_Servent)) + 1;
-
- for J in Source_Aliases'Range loop
- if Source_Aliases (J) /= C.Strings.Null_Ptr then
- Names_Length :=
- Names_Length + C.Strings.Strlen (Source_Aliases (J)) + 1;
- end if;
- end loop;
-
- declare
- type Netdb_Service_Data is record
- Aliases_List : aliased Chars_Ptr_Array (Source_Aliases'Range);
- Names : aliased char_array (1 .. Names_Length);
- end record;
-
- Netdb_Data : Netdb_Service_Data;
- pragma Import (Ada, Netdb_Data);
- for Netdb_Data'Address use Target_Buffer;
-
- Names_Index : size_t := Netdb_Data.Names'First;
- -- Index of first available location in Netdb_Data.Names
-
- Stored_Name : C.Strings.chars_ptr;
-
- begin
- if Netdb_Data'Size / 8 > Target_Buffer_Length then
- return;
- end if;
-
- -- Copy service name
-
- Store_Name
- (C.Strings.Value (Servent_S_Name (Source_Servent)),
- Netdb_Data.Names, Names_Index,
- Stored_Name);
- Servent_Set_S_Name (Target_Servent, Stored_Name);
-
- -- Copy aliases (null-terminated string pointer array)
-
- Servent_Set_S_Aliases
- (Target_Servent,
- Netdb_Data.Aliases_List
- (Netdb_Data.Aliases_List'First)'Unchecked_Access);
-
- -- Copy port number
-
- Servent_Set_S_Port (Target_Servent, Servent_S_Port (Source_Servent));
-
- -- Copy protocol name
-
- Store_Name
- (C.Strings.Value (Servent_S_Proto (Source_Servent)),
- Netdb_Data.Names, Names_Index,
- Stored_Name);
- Servent_Set_S_Proto (Target_Servent, Stored_Name);
-
- for J in Netdb_Data.Aliases_List'Range loop
- if J = Netdb_Data.Aliases_List'Last then
- Netdb_Data.Aliases_List (J) := C.Strings.Null_Ptr;
- else
- Store_Name
- (C.Strings.Value (Source_Aliases (J)),
- Netdb_Data.Names, Names_Index,
- Netdb_Data.Aliases_List (J));
- end if;
- end loop;
- end;
-
- Result := 0;
- end Copy_Service_Entry;
-
- ------------------------
- -- Safe_Gethostbyaddr --
- ------------------------
-
- function Safe_Gethostbyaddr
- (Addr : System.Address;
- Addr_Len : C.int;
- Addr_Type : C.int;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int
- is
- HE : Hostent_Access;
- Result : C.int;
- begin
- Result := -1;
- GNAT.Task_Lock.Lock;
- HE := Nonreentrant_Gethostbyaddr (Addr, Addr_Len, Addr_Type);
-
- if HE = null then
- H_Errnop.all := C.int (Host_Errno);
- goto Unlock_Return;
- end if;
-
- -- Now copy the data to the user-provided buffer
-
- Copy_Host_Entry
- (Source_Hostent => HE.all,
- Target_Hostent => Ret.all,
- Target_Buffer => Buf,
- Target_Buffer_Length => Buflen,
- Result => Result);
-
- <<Unlock_Return>>
- GNAT.Task_Lock.Unlock;
- return Result;
- end Safe_Gethostbyaddr;
-
- ------------------------
- -- Safe_Gethostbyname --
- ------------------------
-
- function Safe_Gethostbyname
- (Name : C.char_array;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int
- is
- HE : Hostent_Access;
- Result : C.int;
- begin
- Result := -1;
- GNAT.Task_Lock.Lock;
- HE := Nonreentrant_Gethostbyname (Name);
-
- if HE = null then
- H_Errnop.all := C.int (Host_Errno);
- goto Unlock_Return;
- end if;
-
- -- Now copy the data to the user-provided buffer
-
- Copy_Host_Entry
- (Source_Hostent => HE.all,
- Target_Hostent => Ret.all,
- Target_Buffer => Buf,
- Target_Buffer_Length => Buflen,
- Result => Result);
-
- <<Unlock_Return>>
- GNAT.Task_Lock.Unlock;
- return Result;
- end Safe_Gethostbyname;
-
- ------------------------
- -- Safe_Getservbyname --
- ------------------------
-
- function Safe_Getservbyname
- (Name : C.char_array;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int
- is
- SE : Servent_Access;
- Result : C.int;
- begin
- Result := -1;
- GNAT.Task_Lock.Lock;
- SE := Nonreentrant_Getservbyname (Name, Proto);
-
- if SE = null then
- goto Unlock_Return;
- end if;
-
- -- Now copy the data to the user-provided buffer. We convert Ret to
- -- type Servent_Access using the .all'Unchecked_Access trick to avoid
- -- an accessibility check. Ret could be pointing to a nested variable,
- -- and we don't want to raise an exception in that case.
-
- Copy_Service_Entry
- (Source_Servent => SE,
- Target_Servent => Ret.all'Unchecked_Access,
- Target_Buffer => Buf,
- Target_Buffer_Length => Buflen,
- Result => Result);
-
- <<Unlock_Return>>
- GNAT.Task_Lock.Unlock;
- return Result;
- end Safe_Getservbyname;
-
- ------------------------
- -- Safe_Getservbyport --
- ------------------------
-
- function Safe_Getservbyport
- (Port : C.int;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int
- is
- SE : Servent_Access;
- Result : C.int;
-
- begin
- Result := -1;
- GNAT.Task_Lock.Lock;
- SE := Nonreentrant_Getservbyport (Port, Proto);
-
- if SE = null then
- goto Unlock_Return;
- end if;
-
- -- Now copy the data to the user-provided buffer. See Safe_Getservbyname
- -- for comment regarding .all'Unchecked_Access.
-
- Copy_Service_Entry
- (Source_Servent => SE,
- Target_Servent => Ret.all'Unchecked_Access,
- Target_Buffer => Buf,
- Target_Buffer_Length => Buflen,
- Result => Result);
-
- <<Unlock_Return>>
- GNAT.Task_Lock.Unlock;
- return Result;
- end Safe_Getservbyport;
-
- ----------------
- -- Store_Name --
- ----------------
-
- procedure Store_Name
- (Name : char_array;
- Storage : in out char_array;
- Storage_Index : in out size_t;
- Stored_Name : out C.Strings.chars_ptr)
- is
- First : constant C.size_t := Storage_Index;
- Last : constant C.size_t := Storage_Index + Name'Length - 1;
- begin
- Storage (First .. Last) := Name;
- Stored_Name := C.Strings.To_Chars_Ptr
- (Storage (First .. Last)'Unrestricted_Access);
- Storage_Index := Last + 1;
- end Store_Name;
-
-end GNAT.Sockets.Thin.Task_Safe_NetDB;
diff --git a/gcc/ada/g-sttsne-locking.ads b/gcc/ada/g-sttsne-locking.ads
deleted file mode 100644
index 0032d8066a1..00000000000
--- a/gcc/ada/g-sttsne-locking.ads
+++ /dev/null
@@ -1,75 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B --
--- --
--- S p e c --
--- --
--- Copyright (C) 2007, AdaCore --
--- --
--- 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT 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 distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This version is used on VMS, LynxOS, and VxWorks. There are two versions of
--- the body: one for VMS and LynxOS, the other for VxWorks.
-
--- This package should not be directly with'ed by an application
-
-package GNAT.Sockets.Thin.Task_Safe_NetDB is
-
- ----------------------------------------
- -- Reentrant network databases access --
- ----------------------------------------
-
- function Safe_Gethostbyname
- (Name : C.char_array;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int;
-
- function Safe_Gethostbyaddr
- (Addr : System.Address;
- Addr_Len : C.int;
- Addr_Type : C.int;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int;
-
- function Safe_Getservbyname
- (Name : C.char_array;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int;
-
- function Safe_Getservbyport
- (Port : C.int;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int;
-
-end GNAT.Sockets.Thin.Task_Safe_NetDB;
diff --git a/gcc/ada/g-sttsne-vxworks.adb b/gcc/ada/g-sttsne-vxworks.adb
deleted file mode 100644
index a91cd873c3b..00000000000
--- a/gcc/ada/g-sttsne-vxworks.adb
+++ /dev/null
@@ -1,204 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B --
--- --
--- B o d y --
--- --
--- Copyright (C) 2007-2008, AdaCore --
--- --
--- 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT 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 distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This version is used on VxWorks. Note that the corresponding spec is in
--- g-sttsne-locking.ads.
-
-with Ada.Unchecked_Conversion;
-with Interfaces.C; use Interfaces.C;
-
-package body GNAT.Sockets.Thin.Task_Safe_NetDB is
-
- -- The following additional data is returned by Safe_Gethostbyname
- -- and Safe_Getostbyaddr in the user provided buffer.
-
- type Netdb_Host_Data (Name_Length : C.size_t) is record
- Address : aliased In_Addr;
- Addr_List : aliased In_Addr_Access_Array (0 .. 1);
- Name : aliased C.char_array (0 .. Name_Length);
- end record;
-
- Alias_Access : constant Chars_Ptr_Pointers.Pointer :=
- new C.Strings.chars_ptr'(C.Strings.Null_Ptr);
- -- Constant used to create a Hostent record manually
-
- ------------------------
- -- Safe_Gethostbyaddr --
- ------------------------
-
- function Safe_Gethostbyaddr
- (Addr : System.Address;
- Addr_Len : C.int;
- Addr_Type : C.int;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int
- is
- type int_Access is access int;
- function To_Pointer is
- new Ada.Unchecked_Conversion (System.Address, int_Access);
-
- function VxWorks_hostGetByAddr
- (Addr : C.int; Buf : System.Address) return C.int;
- pragma Import (C, VxWorks_hostGetByAddr, "hostGetByAddr");
-
- Netdb_Data : Netdb_Host_Data (Name_Length => Max_Name_Length);
- pragma Import (Ada, Netdb_Data);
- for Netdb_Data'Address use Buf;
-
- begin
- pragma Assert (Addr_Type = SOSC.AF_INET);
- pragma Assert (Addr_Len = In_Addr'Size / 8);
-
- -- Check that provided buffer is sufficiently large to hold the
- -- data we want to return.
-
- if Netdb_Data'Size / 8 > Buflen then
- H_Errnop.all := SOSC.ERANGE;
- return -1;
- end if;
-
- if VxWorks_hostGetByAddr (To_Pointer (Addr).all,
- Netdb_Data.Name'Address)
- /= SOSC.OK
- then
- H_Errnop.all := C.int (Host_Errno);
- return -1;
- end if;
-
- Netdb_Data.Address := To_In_Addr (To_Pointer (Addr).all);
- Netdb_Data.Addr_List :=
- (0 => Netdb_Data.Address'Unchecked_Access,
- 1 => null);
-
- Ret.H_Name := C.Strings.To_Chars_Ptr
- (Netdb_Data.Name'Unrestricted_Access);
- Ret.H_Aliases := Alias_Access;
- Ret.H_Addrtype := SOSC.AF_INET;
- Ret.H_Length := 4;
- Ret.H_Addr_List :=
- Netdb_Data.Addr_List (Netdb_Data.Addr_List'First)'Unchecked_Access;
- return 0;
- end Safe_Gethostbyaddr;
-
- ------------------------
- -- Safe_Gethostbyname --
- ------------------------
-
- function Safe_Gethostbyname
- (Name : C.char_array;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int
- is
- function VxWorks_hostGetByName
- (Name : C.char_array) return C.int;
- pragma Import (C, VxWorks_hostGetByName, "hostGetByName");
-
- Addr : C.int;
-
- begin
- Addr := VxWorks_hostGetByName (Name);
- if Addr = SOSC.ERROR then
- H_Errnop.all := C.int (Host_Errno);
- return -1;
- end if;
-
- declare
- Netdb_Data : Netdb_Host_Data (Name_Length => Name'Length);
- pragma Import (Ada, Netdb_Data);
- for Netdb_Data'Address use Buf;
-
- begin
- -- Check that provided buffer is sufficiently large to hold the
- -- data we want to return.
-
- if Netdb_Data'Size / 8 > Buflen then
- H_Errnop.all := SOSC.ERANGE;
- return -1;
- end if;
-
- Netdb_Data.Address := To_In_Addr (Addr);
- Netdb_Data.Addr_List :=
- (0 => Netdb_Data.Address'Unchecked_Access,
- 1 => null);
- Netdb_Data.Name (Netdb_Data.Name'First .. Name'Length - 1) := Name;
-
- Ret.H_Name := C.Strings.To_Chars_Ptr
- (Netdb_Data.Name'Unrestricted_Access);
- Ret.H_Aliases := Alias_Access;
- Ret.H_Addrtype := SOSC.AF_INET;
- Ret.H_Length := 4;
- Ret.H_Addr_List :=
- Netdb_Data.Addr_List (Netdb_Data.Addr_List'First)'Unchecked_Access;
- end;
- return 0;
- end Safe_Gethostbyname;
-
- ------------------------
- -- Safe_Getservbyname --
- ------------------------
-
- function Safe_Getservbyname
- (Name : C.char_array;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int
- is
- pragma Unreferenced (Name, Proto, Ret, Buf, Buflen);
- begin
- -- Not available under VxWorks
- return -1;
- end Safe_Getservbyname;
-
- ------------------------
- -- Safe_Getservbyport --
- ------------------------
-
- function Safe_Getservbyport
- (Port : C.int;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int
- is
- pragma Unreferenced (Port, Proto, Ret, Buf, Buflen);
- begin
- -- Not available under VxWorks
- return -1;
- end Safe_Getservbyport;
-
-end GNAT.Sockets.Thin.Task_Safe_NetDB;
diff --git a/gcc/ada/g-sttsne.ads b/gcc/ada/g-sttsne.ads
deleted file mode 100644
index f438a0aea47..00000000000
--- a/gcc/ada/g-sttsne.ads
+++ /dev/null
@@ -1,83 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT COMPILER COMPONENTS --
--- --
--- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B --
--- --
--- S p e c --
--- --
--- Copyright (C) 2007, AdaCore --
--- --
--- 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT 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 distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package exports reentrant NetDB subprograms. This is the default
--- version, used on most platforms. The routines are implemented by importing
--- from C; see gsocket.h for details. Different versions are provided on
--- platforms where this functionality is implemented in Ada.
-
--- This package should not be directly with'ed by an application
-
-package GNAT.Sockets.Thin.Task_Safe_NetDB is
-
- ----------------------------------------
- -- Reentrant network databases access --
- ----------------------------------------
-
- function Safe_Gethostbyname
- (Name : C.char_array;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int;
-
- function Safe_Gethostbyaddr
- (Addr : System.Address;
- Addr_Len : C.int;
- Addr_Type : C.int;
- Ret : not null access Hostent;
- Buf : System.Address;
- Buflen : C.int;
- H_Errnop : not null access C.int) return C.int;
-
- function Safe_Getservbyname
- (Name : C.char_array;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int;
-
- function Safe_Getservbyport
- (Port : C.int;
- Proto : C.char_array;
- Ret : not null access Servent;
- Buf : System.Address;
- Buflen : C.int) return C.int;
-
-private
- pragma Import (C, Safe_Gethostbyname, "__gnat_safe_gethostbyname");
- pragma Import (C, Safe_Gethostbyaddr, "__gnat_safe_gethostbyaddr");
- pragma Import (C, Safe_Getservbyname, "__gnat_safe_getservbyname");
- pragma Import (C, Safe_Getservbyport, "__gnat_safe_getservbyport");
-
-end GNAT.Sockets.Thin.Task_Safe_NetDB;
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index b81952377a3..8db581098dc 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -144,6 +144,7 @@ GNAT_ADA_OBJS = \
ada/exp_aggr.o \
ada/exp_atag.o \
ada/exp_attr.o \
+ ada/exp_cg.o \
ada/exp_ch11.o \
ada/exp_ch12.o \
ada/exp_ch13.o \
@@ -188,6 +189,8 @@ GNAT_ADA_OBJS = \
ada/gnatvsn.o \
ada/hlo.o \
ada/hostparm.o \
+ ada/i-c.o \
+ ada/i-cstrea.o \
ada/impunit.o \
ada/inline.o \
ada/interfac.o \
@@ -263,6 +266,7 @@ GNAT_ADA_OBJS = \
ada/s-wchcon.o \
ada/s-wchjis.o \
ada/scans.o \
+ ada/scil_ll.o \
ada/scn.o \
ada/scng.o \
ada/scos.o \
@@ -439,7 +443,9 @@ GNATBIND_OBJS = \
ada/s-wchjis.o \
ada/scng.o \
ada/scans.o \
+ ada/scil_ll.o \
ada/sdefault.o \
+ ada/sem_aux.o \
ada/sinfo.o \
ada/sinput.o \
ada/sinput-c.o \
@@ -561,15 +567,19 @@ ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
$(CP) $^ ada/doctools
cd ada/doctools && $(GNATMAKE) -q xgnatugn
-# Note that doc/gnat_ugn.texi does not depend on xgnatugn
-# being built so we can distribute a pregenerated doc/gnat_ugn.info
+# Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on
+# xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info
doc/gnat_ugn.texi: $(srcdir)/ada/gnat_ugn.texi $(srcdir)/ada/ug_words \
- $(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
- $(MAKE) ada/doctools/xgnatugn$(build_exeext)
+ doc/projects.texi $(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
ada/doctools/xgnatugn unw $(srcdir)/ada/gnat_ugn.texi \
$(srcdir)/ada/ug_words doc/gnat_ugn.texi
+doc/projects.texi: $(srcdir)/ada/projects.texi
+ $(MAKE) ada/doctools/xgnatugn$(build_exeext)
+ ada/doctools/xgnatugn unw $(srcdir)/ada/projects.texi \
+ $(srcdir)/ada/ug_words doc/projects.texi
+
doc/gnat_ugn.info: doc/gnat_ugn.texi \
$(gcc_docdir)/include/fdl.texi $(gcc_docdir)/include/gcc-common.texi \
gcc-vers.texi
@@ -1234,7 +1244,7 @@ ada/decl.o : ada/gcc-interface/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(FUNCTION_H) \
- $(FLAGS_H) debug.h toplev.h $(EXCEPT_H) langhooks.h \
+ $(FLAGS_H) debug.h toplev.h langhooks.h \
$(LANGHOOKS_DEF_H) opts.h options.h $(TREE_INLINE_H) $(PLUGIN_H) \
ada/gcc-interface/ada.h ada/adadecode.h ada/types.h ada/atree.h \
ada/elists.h ada/namet.h ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h \
@@ -1250,7 +1260,7 @@ ada/targtyps.o : ada/gcc-interface/targtyps.c $(CONFIG_H) $(SYSTEM_H) \
$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(FLAGS_H) output.h tree-iterator.h \
+ $(TM_H) $(TREE_H) $(FLAGS_H) output.h tree-iterator.h \
$(GIMPLE_H) ada/gcc-interface/ada.h ada/adadecode.h ada/types.h \
ada/atree.h ada/elists.h ada/namet.h ada/nlists.h ada/snames.h \
ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h ada/einfo.h \
@@ -1263,8 +1273,9 @@ ada/utils.o : ada/gcc-interface/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TARGET_H) function.h langhooks.h $(CGRAPH_H) \
$(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h \
ada/gcc-interface/ada.h ada/types.h ada/atree.h ada/elists.h ada/namet.h \
- ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h ada/einfo.h \
- $(ADA_TREE_H) ada/gcc-interface/gigi.h gt-ada-utils.h gtype-ada.h
+ ada/nlists.h ada/snames.h ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h \
+ ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h gt-ada-utils.h \
+ gtype-ada.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
ada/utils2.o : ada/gcc-interface/utils2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -1464,29 +1475,33 @@ ada/checks.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \
- ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_dist.ads ada/exp_pakd.ads \
- ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
- ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/inline.ads \
- ada/itypes.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/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/rtsfind.adb ada/sem.ads ada/sem_aux.ads ada/sem_cat.ads \
- ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
+ ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_dist.ads \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
+ ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \
+ ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads \
+ ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \
ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
- ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
- ada/s-soflin.ads ada/s-stache.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/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/validsw.ads
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
+ ada/widechar.ads
ada/comperr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1522,20 +1537,19 @@ ada/cstand.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_mech.ads \
- ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/ttypef.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/widechar.ads
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
+ ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
+ ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypef.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/widechar.ads
ada/debug.o : ada/debug.ads ada/debug.adb ada/system.ads
@@ -1561,7 +1575,8 @@ ada/einfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/urealp.adb
ada/elists.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/elists.ads \
@@ -1588,16 +1603,16 @@ ada/errout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/fname.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/lib.adb \
ada/lib-list.adb ada/lib-sort.adb ada/namet.ads ada/nlists.ads \
- ada/nlists.adb ada/opt.ads ada/output.ads ada/scans.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/stand.ads ada/stringt.ads ada/stylesw.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.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/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/scans.ads ada/sem_aux.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stylesw.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.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/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1650,18 +1665,18 @@ ada/exp_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads \
ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \
ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-exctab.adb ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb \
+ ada/s-htable.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-soflin.ads \
+ ada/s-stache.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-utf_32.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
@@ -1705,20 +1720,36 @@ ada/exp_attr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch6.ads \
ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \
- ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
+
+ada/exp_cg.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
+ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
+ ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
+ ada/elists.adb ada/exp_cg.ads ada/exp_cg.adb ada/exp_dbug.ads \
+ ada/exp_disp.ads ada/exp_tss.ads ada/gnat.ads ada/g-htable.ads \
+ ada/hostparm.ads ada/lib.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/sem_aux.ads \
+ ada/sem_aux.adb ada/sem_disp.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.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/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/exp_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1773,7 +1804,7 @@ ada/exp_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/tbuild.ads ada/tree_io.ads \
ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_ch2.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1807,24 +1838,25 @@ ada/exp_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/sem.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads \
- ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \
- ada/sem_mech.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads \
+ ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
+ ada/sem_eval.ads ada/sem_mech.ads ada/sem_res.ads ada/sem_scil.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
+ ada/stand.ads ada/stringt.ads ada/system.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/validsw.ads
ada/exp_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
- ada/casing.ads ada/checks.ads ada/checks.adb ada/debug.ads \
- ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
+ ada/casing.ads ada/checks.ads ada/checks.adb ada/csets.ads \
+ ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
ada/exp_aggr.ads ada/exp_atag.ads ada/exp_ch11.ads ada/exp_ch2.ads \
ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch4.adb ada/exp_ch6.ads \
@@ -1832,23 +1864,28 @@ ada/exp_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
ada/exp_vfpt.ads ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \
- ada/inline.ads ada/itypes.ads ada/lib.ads ada/namet.ads ada/nlists.ads \
+ ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/sem.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \
- ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_eval.ads \
- ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
+ ada/par_sco.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/scil_ll.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb \
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
+ ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads \
- ada/s-stache.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/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads
+ ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
+ ada/validsw.ads ada/widechar.ads
ada/exp_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1868,20 +1905,19 @@ ada/exp_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \
ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads \
ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/exp_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1901,21 +1937,21 @@ ada/exp_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \
ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch12.ads ada/sem_ch13.ads \
- ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_mech.ads \
- ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch12.ads \
+ ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads \
+ ada/sem_mech.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
@@ -1933,17 +1969,16 @@ ada/exp_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/sem.ads \
ada/sem_aux.ads ada/sem_ch3.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.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-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads \
- ada/s-stache.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/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.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-htable.ads \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1956,16 +1991,15 @@ ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
ada/rtsfind.ads ada/sem.ads ada/sem_aux.ads ada/sem_ch8.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.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-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.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/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/validsw.ads
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.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-htable.ads \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-rident.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/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -1982,9 +2016,9 @@ ada/exp_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_attr.ads \
- ada/sem_aux.ads ada/sem_ch11.ads ada/sem_ch6.ads ada/sem_ch8.ads \
- ada/sem_disp.ads ada/sem_elab.ads ada/sem_eval.ads ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch11.ads ada/sem_ch6.ads \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_elab.ads ada/sem_eval.ads \
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
@@ -2012,9 +2046,9 @@ ada/exp_code.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
@@ -2033,13 +2067,14 @@ ada/exp_dbug.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/exp_dbug.ads ada/exp_dbug.adb ada/gnat.ads ada/g-htable.ads \
ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/namet.adb \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/sem_aux.ads ada/sem_eval.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-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.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/output.ads ada/rident.ads ada/sem_aux.ads ada/sem_eval.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-htable.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-soflin.ads ada/s-stache.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/targparm.ads \
ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
ada/urealp.adb ada/widechar.ads
@@ -2049,31 +2084,31 @@ ada/exp_disp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \
ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_atag.ads \
- ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_dbug.ads \
- ada/exp_disp.ads ada/exp_disp.adb ada/exp_tss.ads ada/exp_tss.adb \
- ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
- ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
- ada/layout.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
- ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch6.ads \
+ ada/exp_cg.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \
+ ada/exp_dbug.ads ada/exp_disp.ads ada/exp_disp.adb ada/exp_tss.ads \
+ ada/exp_tss.adb ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
+ ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
+ ada/itypes.ads ada/layout.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/scil_ll.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch6.ads \
ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \
- ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/exp_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2085,9 +2120,9 @@ ada/exp_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/lib-list.adb ada/lib-sort.adb ada/namet.ads ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/sem.ads \
- ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch8.ads \
- ada/sem_dist.ads ada/sem_eval.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads ada/sem_ch3.ads \
+ ada/sem_ch8.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_util.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb 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-rident.ads ada/s-secsta.ads \
@@ -2100,23 +2135,31 @@ ada/exp_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/exp_fixd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
- ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
- ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/eval_fat.ads ada/exp_fixd.ads ada/exp_fixd.adb ada/exp_tss.ads \
- ada/exp_util.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \
- ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/rtsfind.ads ada/sem.ads \
- ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
+ ada/einfo.adb ada/elists.ads ada/err_vars.ads ada/errout.ads \
+ ada/erroutc.ads ada/eval_fat.ads ada/exp_ch11.ads ada/exp_disp.ads \
+ ada/exp_fixd.ads ada/exp_fixd.adb ada/exp_tss.ads ada/exp_util.ads \
+ ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-htable.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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/tbuild.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
+ ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
+ ada/widechar.ads
ada/exp_imgv.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2139,7 +2182,7 @@ ada/exp_imgv.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
ada/exp_intr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2155,18 +2198,17 @@ ada/exp_intr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/sem.ads \
ada/sem_aux.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.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-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-soflin.ads \
- ada/s-stache.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/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
- ada/widechar.ads
+ ada/sem_type.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-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-soflin.ads ada/s-stache.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/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/urealp.adb ada/validsw.ads ada/widechar.ads
ada/exp_pakd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2181,18 +2223,17 @@ ada/exp_pakd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
ada/sem.ads ada/sem_aux.ads ada/sem_ch13.ads ada/sem_ch3.ads \
- ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
- ada/stand.ads ada/stringt.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/validsw.ads
+ ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
+ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2286,29 +2327,34 @@ ada/exp_tss.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/exp_util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
- ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
- ada/elists.ads ada/elists.adb ada/err_vars.ads ada/errout.ads \
- ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch6.ads \
- ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
- ada/fname.ads ada/fname-uf.ads ada/get_targ.ads ada/gnat.ads \
+ ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
+ ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \
+ ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads \
+ ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads \
+ ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
+ ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/inline.ads \
- ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/sem.ads \
- ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \
+ ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/restrict.adb \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/urealp.adb ada/validsw.ads
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
+ ada/validsw.ads ada/widechar.ads
ada/exp_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2384,29 +2430,30 @@ ada/freeze.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/exp_ch7.ads ada/exp_disp.ads ada/exp_pakd.ads ada/exp_tss.ads \
ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \
ada/freeze.ads ada/freeze.adb ada/get_targ.ads ada/gnat.ads \
- ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
- ada/itypes.ads ada/layout.ads ada/lib.ads ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
- ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
- ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch4.ads \
- ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
- ada/sem_intr.ads ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads \
- ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
+ ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/inline.ads \
+ ada/interfac.ads ada/itypes.ads ada/layout.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \
+ ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
+ ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch4.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
+ ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_intr.ads \
+ ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_res.adb \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-exctab.adb ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
+ ada/widechar.ads
ada/frontend.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2421,20 +2468,21 @@ ada/frontend.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
ada/osint.ads ada/output.ads ada/par.ads ada/prep.ads ada/prepcomp.ads \
ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_aux.ads ada/sem_ch8.ads ada/sem_elab.ads ada/sem_prag.ads \
- ada/sem_scil.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/sinput.adb ada/sinput-l.ads ada/snames.ads \
- ada/sprint.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
- ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/scans.ads ada/scil_ll.ads ada/scn.ads ada/scng.ads ada/scng.adb \
+ ada/sem.ads ada/sem_aux.ads ada/sem_ch8.ads ada/sem_elab.ads \
+ ada/sem_prag.ads ada/sem_scil.ads ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/sinput-l.ads \
+ ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/g-byorma.o : ada/gnat.ads ada/g-byorma.ads ada/g-byorma.adb \
ada/system.ads
@@ -2472,32 +2520,33 @@ ada/gnat1drv.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/back_end.ads ada/casing.ads ada/comperr.ads ada/csets.ads \
ada/debug.ads ada/debug_a.ads 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/fmap.ads \
- ada/fname.ads ada/fname-uf.ads ada/frontend.ads ada/get_targ.ads \
- ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/g-table.ads \
- ada/g-table.adb ada/gnat1drv.ads ada/gnat1drv.adb ada/gnatvsn.ads \
- ada/hlo.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/lib-writ.ads \
- ada/lib-xref.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/opt.ads ada/osint.ads ada/output.ads ada/par_sco.ads \
- ada/prepcomp.ads ada/repinfo.ads ada/restrict.ads ada/rident.ads \
- ada/rtsfind.ads ada/scos.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
- ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \
- ada/sem_ch2.ads 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_elim.ads ada/sem_eval.ads ada/sem_prag.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/sinput-l.ads ada/snames.ads ada/sprint.ads \
- ada/stand.ads ada/stringt.ads ada/stylesw.ads ada/system.ads \
- ada/s-assert.ads ada/s-bitops.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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/targparm.ads ada/tree_gen.ads ada/tree_io.ads \
- ada/treepr.ads ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/usage.ads ada/validsw.ads ada/widechar.ads
+ ada/erroutc.ads ada/exp_cg.ads ada/exp_tss.ads ada/expander.ads \
+ ada/fmap.ads ada/fname.ads ada/fname-uf.ads ada/frontend.ads \
+ ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \
+ ada/g-table.ads ada/g-table.adb ada/gnat1drv.ads ada/gnat1drv.adb \
+ ada/gnatvsn.ads ada/hlo.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/lib-writ.ads ada/lib-xref.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/osint.ads ada/output.ads \
+ ada/par_sco.ads ada/prepcomp.ads ada/repinfo.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scos.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
+ ada/sem_ch13.ads ada/sem_ch2.ads 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_elim.ads ada/sem_eval.ads ada/sem_prag.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/sinput.adb ada/sinput-l.ads ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stylesw.ads \
+ ada/system.ads ada/s-assert.ads ada/s-bitops.ads ada/s-exctab.ads \
+ ada/s-htable.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-soflin.ads \
+ ada/s-stache.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/targparm.ads ada/tree_gen.ads \
+ ada/tree_io.ads ada/treepr.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/usage.ads ada/validsw.ads \
+ ada/widechar.ads
ada/gnatbind.o : ada/ada.ads ada/a-comlin.ads ada/a-clrefi.ads \
ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads ada/ali.ads \
@@ -2520,15 +2569,25 @@ ada/gnatvsn.o : ada/ada.ads ada/a-unccon.ads ada/gnatvsn.ads \
ada/gnatvsn.adb ada/system.ads ada/s-secsta.ads ada/s-stoele.ads \
ada/s-stoele.adb
-ada/hlo.o : ada/ada.ads ada/a-unccon.ads ada/hlo.ads ada/hlo.adb \
- ada/hostparm.ads ada/output.ads ada/system.ads ada/s-exctab.ads \
- ada/s-stalib.ads ada/s-unstyp.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads
+ada/hlo.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads ada/hlo.ads \
+ ada/hlo.adb ada/hostparm.ads ada/output.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-os_lib.ads ada/s-stalib.ads ada/s-string.ads \
+ ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/hostparm.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \
ada/system.ads ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads \
ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ada/i-c.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/interfac.ads \
+ ada/i-c.ads ada/i-c.adb ada/system.ads ada/s-exctab.ads \
+ ada/s-exctab.adb ada/s-htable.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads
+
+ada/i-cstrea.o : ada/ada.ads ada/a-unccon.ads ada/interfac.ads \
+ ada/i-cstrea.ads ada/i-cstrea.adb ada/system.ads ada/s-crtl.ads \
+ ada/s-parame.ads
+
ada/impunit.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -2614,8 +2673,8 @@ ada/layout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch13.ads \
ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
@@ -2652,12 +2711,13 @@ ada/lib-load.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/lib-util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/hostparm.ads \
ada/lib.ads ada/lib-util.ads ada/lib-util.adb ada/namet.ads ada/opt.ads \
- ada/osint.ads ada/osint-c.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-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/unchconv.ads \
- ada/unchdeal.ads
+ ada/osint.ads ada/osint-c.ads ada/output.ads ada/stringt.ads \
+ ada/stringt.adb ada/system.ads ada/s-carun8.ads ada/s-exctab.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.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/types.adb ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads
ada/lib-writ.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/ali.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2673,15 +2733,15 @@ ada/lib-writ.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_aux.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-casuti.ads ada/s-carun8.ads \
- ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/stylesw.ads ada/system.ads ada/s-casuti.ads ada/s-crc32.ads \
+ ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/lib-xref.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2692,15 +2752,16 @@ ada/lib-xref.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/lib-util.adb ada/lib-xref.ads ada/lib-xref.adb ada/namet.ads \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/osint.ads \
ada/osint-c.ads ada/output.ads ada/restrict.ads ada/rident.ads \
- ada/sem.ads ada/sem_aux.ads ada/sem_prag.ads ada/sem_util.ads \
- ada/sem_warn.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-imenne.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.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/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/sem.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_prag.ads \
+ ada/sem_util.ads ada/sem_warn.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-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-rident.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/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/widechar.ads
ada/lib.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/alloc.ads ada/atree.ads ada/atree.adb ada/casing.ads ada/debug.ads \
@@ -3128,6 +3189,18 @@ ada/scans.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ada/scil_ll.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
+ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
+ ada/casing.ads ada/debug.ads ada/einfo.ads ada/hostparm.ads \
+ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
+ ada/scil_ll.ads ada/scil_ll.adb ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.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-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/urealp.ads
+
ada/scn.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/alloc.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 \
@@ -3205,9 +3278,9 @@ ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_aggr.adb \
ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \
ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
@@ -3231,27 +3304,29 @@ ada/sem_attr.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \
ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/expander.ads \
ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/itypes.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/sdefault.ads ada/sem.ads ada/sem_aggr.ads \
- ada/sem_attr.ads ada/sem_attr.adb ada/sem_aux.ads ada/sem_cat.ads \
- ada/sem_ch10.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \
- ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/snames.adb ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-exctab.ads \
- ada/s-exctab.adb ada/s-htable.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-soflin.ads ada/s-stache.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/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypef.ads \
- ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sdefault.ads ada/sem.ads ada/sem_aggr.ads \
+ ada/sem_attr.ads ada/sem_attr.adb ada/sem_aux.ads ada/sem_aux.adb \
+ ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch13.ads ada/sem_ch3.ads \
+ ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
+ ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/snames.adb ada/sprint.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypef.ads ada/ttypes.ads \
+ ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
ada/validsw.ads ada/widechar.ads
@@ -3299,19 +3374,18 @@ ada/sem_cat.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/output.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads \
ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_cat.ads ada/sem_cat.adb ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
+ ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch10.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3329,20 +3403,19 @@ ada/sem_ch10.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_ch10.ads ada/sem_ch10.adb ada/sem_ch3.ads ada/sem_ch6.ads \
ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
+ ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3382,20 +3455,20 @@ ada/sem_ch12.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_ch12.adb ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads \
ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \
- ada/sinput.ads ada/sinput-l.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-exctab.adb 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-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/widechar.ads
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
+ ada/sinput-l.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb \
+ 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-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/urealp.adb ada/widechar.ads
ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3452,11 +3525,11 @@ ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_case.ads ada/sem_case.adb \
- ada/sem_cat.ads ada/sem_cat.adb ada/sem_ch13.ads ada/sem_ch3.ads \
- ada/sem_ch3.adb ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads ada/sem_eval.ads \
- ada/sem_eval.adb ada/sem_mech.ads ada/sem_res.ads ada/sem_scil.ads \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_case.ads \
+ ada/sem_case.adb ada/sem_cat.ads ada/sem_cat.adb ada/sem_ch13.ads \
+ ada/sem_ch3.ads ada/sem_ch3.adb ada/sem_ch6.ads ada/sem_ch7.ads \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_mech.ads ada/sem_res.ads \
ada/sem_smem.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
@@ -3477,31 +3550,32 @@ ada/sem_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads \
- ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads \
- ada/g-htable.ads ada/hostparm.ads ada/interfac.ads ada/itypes.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/namet-sp.ads \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \
+ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \
+ ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.ads \
+ ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.ads \
+ ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
+ ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/namet-sp.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
+ ada/sem_aux.ads ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads \
ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch4.adb \
ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_intr.ads \
- ada/sem_res.ads ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads \
+ ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \
+ ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \
ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
@@ -3523,20 +3597,20 @@ ada/sem_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch5.adb \
ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \
- ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
- ada/sem_warn.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
+ ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/sem_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3552,11 +3626,11 @@ ada/sem_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
ada/output.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
- ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \
- ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch6.adb ada/sem_ch8.ads \
- ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads ada/sem_eval.ads \
- ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_scil.ads \
+ ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb \
+ ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch3.ads \
+ ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch6.adb \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads \
+ ada/sem_eval.ads ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads \
ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/snames.adb ada/stand.ads \
@@ -3588,19 +3662,19 @@ ada/sem_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch3.ads \
ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch7.adb ada/sem_ch8.ads \
ada/sem_disp.ads ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/snames.adb ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.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-soflin.ads \
- ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/snames.adb ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3621,18 +3695,18 @@ ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads \
ada/sem_ch8.ads ada/sem_ch8.adb ada/sem_disp.ads ada/sem_dist.ads \
ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_intr.ads \
- ada/sem_res.ads ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
@@ -3654,50 +3728,49 @@ ada/sem_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_ch9.ads \
ada/sem_ch9.adb ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
ada/sem_elim.ads ada/sem_eval.ads ada/sem_intr.ads ada/sem_res.ads \
- ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/sinput.adb ada/snames.ads ada/sprint.ads \
- ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/sinput.adb ada/snames.ads ada/sprint.ads ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.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-soflin.ads \
+ ada/s-stache.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-utf_32.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/sem_disp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \
ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_atag.ads \
- ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_dbug.ads \
- ada/exp_disp.ads ada/exp_disp.adb ada/exp_tss.ads ada/exp_util.ads \
- ada/exp_util.adb ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
- ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \
- ada/inline.ads ada/interfac.ads ada/itypes.ads ada/layout.ads \
- ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch3.ads ada/sem_ch6.ads \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_disp.adb \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/validsw.ads ada/widechar.ads
+ ada/exp_cg.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \
+ ada/exp_dbug.ads ada/exp_disp.ads ada/exp_disp.adb ada/exp_tss.ads \
+ ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \
+ ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
+ ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
+ ada/layout.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/scil_ll.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_aux.adb ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_disp.adb ada/sem_eval.ads \
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.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-soflin.ads \
+ ada/s-stache.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-utf_32.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/sem_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3732,18 +3805,18 @@ ada/sem_elab.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \
ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_elab.ads \
- ada/sem_elab.adb ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/sem_elab.adb ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.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-soflin.ads \
+ ada/s-stache.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-utf_32.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
@@ -3753,15 +3826,16 @@ ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
- ada/sem.ads ada/sem_elim.ads ada/sem_elim.adb ada/sem_prag.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-stalib.ads 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/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/sem.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_elim.ads \
+ ada/sem_elim.adb ada/sem_prag.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-stalib.ads 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/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/sem_eval.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3776,11 +3850,11 @@ ada/sem_eval.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \
- ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
- ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads \
+ ada/sem_ch13.ads ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads \
+ ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
@@ -3840,30 +3914,30 @@ ada/sem_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
ada/lib-writ.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
ada/namet-sp.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
- ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch12.ads \
- ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads \
- ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
- ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads \
- ada/sem_mech.ads ada/sem_prag.ads ada/sem_prag.adb ada/sem_res.ads \
- ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_vfpt.ads ada/sem_warn.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/snames.adb ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
- ada/widechar.ads
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads \
+ ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb \
+ ada/sem_cat.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch3.ads \
+ ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
+ ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_intr.ads ada/sem_mech.ads ada/sem_prag.ads \
+ ada/sem_prag.adb ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_vfpt.ads ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
+ ada/sinput.adb ada/snames.ads ada/snames.adb ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
+ ada/validsw.ads ada/widechar.ads
ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3886,35 +3960,34 @@ ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads \
ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \
- ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_scil.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/urealp.adb ada/validsw.ads ada/widechar.ads
+ ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.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-soflin.ads \
+ ada/s-stache.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-utf_32.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
+ ada/validsw.ads ada/widechar.ads
ada/sem_scil.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/gnat.ads \
ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rtsfind.ads \
- ada/sem.ads ada/sem_aux.ads ada/sem_scil.ads ada/sem_scil.adb \
- ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imenne.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/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/rtsfind.ads \
+ ada/scil_ll.ads ada/sem_aux.ads ada/sem_scil.ads ada/sem_scil.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.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/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/sem_smem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3944,49 +4017,50 @@ ada/sem_type.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_ch12.ads ada/sem_ch6.ads ada/sem_ch8.ads \
ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_type.adb ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/sem_type.ads ada/sem_type.adb ada/sem_util.ads ada/sem_util.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.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-soflin.ads \
+ ada/s-stache.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-utf_32.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/casing.adb ada/checks.ads ada/csets.ads \
ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_ch11.ads ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads \
- ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/exp_ch11.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_tss.ads \
+ ada/exp_util.ads ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
+ ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \
+ ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads \
ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_attr.ads \
- ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads \
- ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \
- ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \
- ada/s-crc32.adb 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-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.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-utf_32.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/widechar.ads
+ ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch7.ads \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-crc32.adb 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-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
+ ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/urealp.adb ada/widechar.ads
ada/sem_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -4015,18 +4089,18 @@ ada/sem_warn.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/output.ads ada/par_sco.ads ada/rident.ads ada/rtsfind.ads \
ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.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-soflin.ads ada/s-stache.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-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sinfo-cn.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
@@ -4290,16 +4364,16 @@ ada/treepr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/lib.ads \
ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \
ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads ada/output.adb \
- ada/sem_mech.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-imenne.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-soflin.ads \
- ada/s-stache.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/treepr.ads \
- ada/treepr.adb ada/treeprs.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/scil_ll.ads ada/sem_mech.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-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-soflin.ads ada/s-stache.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/treepr.ads ada/treepr.adb ada/treeprs.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/treeprs.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/hostparm.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 236903d48b9..ee65cb2fdd1 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -309,7 +309,7 @@ GNATMAKE_OBJS = a-except.o ali.o ali-util.o s-casuti.o \
scans.o scng.o sdefault.o sfn_scan.o s-purexc.o s-htable.o sinfo.o sinput.o \
sinput-c.o sinput-p.o snames.o stand.o stringt.o styleg.o stylesw.o system.o \
validsw.o switch.o switch-m.o table.o targparm.o tempdir.o tree_io.o types.o \
- uintp.o uname.o urealp.o usage.o widechar.o \
+ uintp.o uname.o urealp.o usage.o widechar.o scil_ll.o \
$(EXTRA_GNATMAKE_OBJS)
# Convert the target variable into a space separated list of architecture,
@@ -380,7 +380,7 @@ MLIB_TGT = mlib-tgt
# to LIBGNAT_TARGET_PAIRS.
GNATRTL_SOCKETS_OBJS = g-soccon$(objext) g-socket$(objext) g-socthi$(objext) \
- g-soliop$(objext) g-sothco$(objext) g-sttsne$(objext)
+ g-soliop$(objext) g-sothco$(objext)
DUMMY_SOCKETS_TARGET_PAIRS = \
g-socket.adb<g-socket-dummy.adb \
@@ -388,8 +388,24 @@ DUMMY_SOCKETS_TARGET_PAIRS = \
g-socthi.adb<g-socthi-dummy.adb \
g-socthi.ads<g-socthi-dummy.ads \
g-sothco.adb<g-sothco-dummy.adb \
- g-sothco.ads<g-sothco-dummy.ads \
- g-sttsne.ads<g-sttsne-dummy.ads
+ g-sothco.ads<g-sothco-dummy.ads
+
+# On platform where atomic increment/decrement operations are supported
+# special version of Ada.Strings.Unbounded package can be used.
+
+ATOMICS_TARGET_PAIRS += \
+ a-stunau.adb<a-stunau-shared.adb \
+ a-suteio.adb<a-suteio-shared.adb \
+ a-strunb.ads<a-strunb-shared.ads \
+ a-strunb.adb<a-strunb-shared.adb \
+ a-stwiun.adb<a-stwiun-shared.adb \
+ a-stwiun.ads<a-stwiun-shared.ads \
+ a-swunau.adb<a-swunau-shared.adb \
+ a-swuwti.adb<a-swuwti-shared.adb \
+ a-stzunb.adb<a-stzunb-shared.adb \
+ a-stzunb.ads<a-stzunb-shared.ads \
+ a-szunau.adb<a-szunau-shared.adb \
+ a-szuzti.adb<a-szuzti-shared.adb
LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(fsrcpfx)ada/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
@@ -420,8 +436,6 @@ ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
system.ads<system-vxworks-m68k.ads
@@ -465,10 +479,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
- g-trasym.adb<g-trasym-unimplemented.adb
+ g-trasym.adb<g-trasym-unimplemented.adb \
+ $(ATOMICS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS=\
mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
@@ -563,7 +576,8 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(targ))),)
s-vxwork.ads<s-vxwork-ppc.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
- system.ads<system-vxworks-ppc-vthread.ads
+ system.ads<system-vxworks-ppc-vthread.ads \
+ $(ATOMICS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS=\
mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
@@ -584,9 +598,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(targ))),)
LIBGNAT_TARGET_PAIRS += \
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads
+ g-stsifd.adb<g-stsifd-sockets.adb
endif
ifeq ($(strip $(filter-out yes,$(TRACE))),)
@@ -627,6 +639,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksmils,$(targ))),)
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
system.ads<system-vxworks-ppc.ads \
+ $(ATOMICS_TARGET_PAIRS) \
$(DUMMY_SOCKETS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS=\
@@ -701,9 +714,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
LIBGNAT_TARGET_PAIRS += \
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
- g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads
+ g-stsifd.adb<g-stsifd-sockets.adb
endif
ifeq ($(strip $(filter-out yes,$(TRACE))),)
@@ -739,8 +750,6 @@ ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),)
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
system.ads<system-vxworks-sparcv9.ads \
@@ -780,8 +789,6 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb
@@ -873,8 +880,6 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
system.ads<system-vxworks-arm.ads
@@ -913,8 +918,6 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
g-socthi.ads<g-socthi-vxworks.ads \
g-socthi.adb<g-socthi-vxworks.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-vxworks.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
system.ads<system-vxworks-mips.ads
@@ -949,7 +952,8 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
system.ads<system-solaris-sparc.ads
LIBGNAT_TARGET_PAIRS_64 = \
- system.ads<system-solaris-sparcv9.ads
+ system.ads<system-solaris-sparcv9.ads \
+ $(ATOMICS_TARGET_PAIRS)
ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
ifeq ($(strip $(MULTISUBDIR)),/sparcv9)
@@ -1334,7 +1338,8 @@ ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
s-osprim.adb<s-osprim-posix.adb \
s-taprop.adb<s-taprop-posix.adb \
s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb
+ s-tpopsp.adb<s-tpopsp-posix.adb \
+ $(ATOMICS_TARGET_PAIRS)
LIBGNAT_TARGET_PAIRS_32 = \
system.ads<system-aix.ads
@@ -1373,8 +1378,6 @@ ifeq ($(strip $(filter-out lynxos,$(osys))),)
a-numaux.ads<a-numaux-x86.ads \
a-intnam.ads<a-intnam-lynxos.ads \
g-bytswa.adb<g-bytswa-x86.adb \
- g-sttsne.adb<g-sttsne-locking.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
s-osinte.adb<s-osinte-lynxos.adb \
@@ -1391,8 +1394,6 @@ ifeq ($(strip $(filter-out lynxos,$(osys))),)
else
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-lynxos.ads \
- g-sttsne.adb<g-sttsne-locking.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
s-osinte.adb<s-osinte-lynxos.adb \
@@ -1440,12 +1441,14 @@ ifeq ($(strip $(filter-out alpha% dec osf%,$(targ))),)
s-taspri.ads<s-taspri-tru64.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
s-traceb.adb<s-traceb-mastop.adb \
- system.ads<system-tru64.ads
+ system.ads<system-tru64.ads \
+ $(ATOMICS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-tru64.adb
EH_MECHANISM=-gcc
GMEM_LIB=gmemlib
+ MISCLIB = -lexc
THREADSLIB = -lpthread -lmach -lexc -lrt
GNATLIB_SHARED = gnatlib-shared-default
LIBRARY_VERSION := $(LIB_VERSION)
@@ -1470,25 +1473,26 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
g-enblsp.adb<g-enblsp-vms-ia64.adb \
g-trasym.adb<g-trasym-vms-ia64.adb \
s-asthan.adb<s-asthan-vms-ia64.adb \
+ s-auxdec.adb<s-auxdec-vms-ia64.adb \
s-osinte.adb<s-osinte-vms-ia64.adb \
s-osinte.ads<s-osinte-vms-ia64.ads \
s-vaflop.adb<s-vaflop-vms-ia64.adb \
- g-trasym.ads<g-trasym-unimplemented.ads \
- g-trasym.adb<g-trasym-unimplemented.adb \
system.ads<system-vms-ia64.ads
LIBGNAT_TARGET_PAIRS_AUX2 = \
- s-parame.ads<s-parame-vms-ia64.ads
+ s-parame.ads<s-parame-vms-ia64.ads \
+ $(ATOMICS_TARGET_PAIRS)
else
ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
LIBGNAT_TARGET_PAIRS_AUX1 = \
g-enblsp.adb<g-enblsp-vms-alpha.adb \
g-trasym.adb<g-trasym-vms-alpha.adb \
- s-traent.adb<s-traent-vms.adb \
- s-traent.ads<s-traent-vms.ads \
s-asthan.adb<s-asthan-vms-alpha.adb \
+ s-auxdec.adb<s-auxdec-vms-alpha.adb \
s-osinte.adb<s-osinte-vms.adb \
s-osinte.ads<s-osinte-vms.ads \
+ s-traent.adb<s-traent-vms.adb \
+ s-traent.ads<s-traent-vms.ads \
s-vaflop.adb<s-vaflop-vms-alpha.adb \
system.ads<system-vms_64.ads
@@ -1497,7 +1501,8 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
s-parame.ads<s-parame-vms-restrict.ads
else
LIBGNAT_TARGET_PAIRS_AUX2 = \
- s-parame.ads<s-parame-vms-alpha.ads
+ s-parame.ads<s-parame-vms-alpha.ads \
+ $(ATOMICS_TARGET_PAIRS)
endif
endif
endif
@@ -1514,8 +1519,6 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
g-socthi.ads<g-socthi-vms.ads \
g-socthi.adb<g-socthi-vms.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
- g-sttsne.adb<g-sttsne-locking.adb \
- g-sttsne.ads<g-sttsne-locking.ads \
i-c.ads<i-c-vms_64.ads \
i-cstrin.ads<i-cstrin-vms_64.ads \
i-cstrin.adb<i-cstrin-vms_64.adb \
@@ -1637,11 +1640,21 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
s-taprop.adb<s-taprop-mingw.adb
ifeq ($(strip $(filter-out x86_64%,$(arch))),)
- LIBGNAT_TARGET_PAIRS += \
- system.ads<system-mingw-x86_64.ads
+ ifeq ($(strip $(MULTISUBDIR)),/32)
+ LIBGNAT_TARGET_PAIRS += \
+ system.ads<system-mingw.ads
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ system.ads<system-mingw-x86_64.ads
+ endif
else
- LIBGNAT_TARGET_PAIRS += \
- system.ads<system-mingw.ads
+ ifeq ($(strip $(MULTISUBDIR)),/64)
+ LIBGNAT_TARGET_PAIRS += \
+ system.ads<system-mingw-x86_64.ads
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ system.ads<system-mingw.ads
+ endif
endif
EXTRA_GNATRTL_NONTASKING_OBJS = \
@@ -1787,7 +1800,8 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
s-tasinf.adb<s-tasinf-linux.adb \
s-taspri.ads<s-taspri-posix-noaltstack.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-sercom.adb<g-sercom-linux.adb
+ g-sercom.adb<g-sercom-linux.adb \
+ $(ATOMICS_TARGET_PAIRS)
LIBGNAT_TARGET_PAIRS_32 = \
system.ads<system-linux-ppc.ads
@@ -1986,7 +2000,8 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
s-taspri.ads<s-taspri-posix-noaltstack.ads \
g-sercom.adb<g-sercom-linux.adb \
- system.ads<system-linux-ia64.ads
+ system.ads<system-linux-ia64.ads \
+ $(ATOMICS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS = \
mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
@@ -2012,7 +2027,8 @@ ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
s-taprop.adb<s-taprop-posix.adb \
s-taspri.ads<s-taspri-posix-noaltstack.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-hpux-ia64.ads
+ system.ads<system-hpux-ia64.ads \
+ $(ATOMICS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS = \
mlib-tgt-specific.adb<mlib-tgt-specific-ia64-hpux.adb
@@ -2042,7 +2058,8 @@ ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
s-taspri.ads<s-taspri-posix-noaltstack.ads \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
- system.ads<system-linux-alpha.ads
+ system.ads<system-linux-alpha.ads \
+ $(ATOMICS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS = \
mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
@@ -2073,7 +2090,8 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
s-taspri.ads<s-taspri-posix.ads \
g-sercom.adb<g-sercom-linux.adb \
- system.ads<system-linux-x86_64.ads
+ system.ads<system-linux-x86_64.ads \
+ $(ATOMICS_TARGET_PAIRS)
TOOLS_TARGET_PAIRS = \
mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
@@ -2092,6 +2110,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
ifeq ($(strip $(filter-out %86,$(arch))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-darwin.ads \
+ i-forbla.adb<i-forbla-darwin.adb \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-susv3.adb \
s-osinte.adb<s-osinte-darwin.adb \
@@ -2116,6 +2135,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
ifeq ($(strip $(filter-out %x86_64,$(arch))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-darwin.ads \
+ i-forbla.adb<i-forbla-darwin.adb \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-susv3.adb \
s-osinte.adb<s-osinte-darwin.adb \
@@ -2128,12 +2148,14 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
a-numaux.adb<a-numaux-x86.adb \
g-trasym.ads<g-trasym-unimplemented.ads \
g-trasym.adb<g-trasym-unimplemented.adb \
- system.ads<system-darwin-x86_64.ads
+ system.ads<system-darwin-x86_64.ads \
+ $(ATOMICS_TARGET_PAIRS)
endif
ifeq ($(strip $(filter-out powerpc%,$(arch))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-darwin.ads \
+ i-forbla.adb<i-forbla-darwin.adb \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
s-osinte.adb<s-osinte-darwin.adb \
@@ -2615,7 +2637,8 @@ gnatlib-shared:
$(GNATLIB_SHARED)
gnatlib-sjlj:
- $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" ../stamp-gnatlib1-$(RTSDIR)
+ $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" \
+ THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
$(MAKE) $(FLAGS_TO_PASS) \
@@ -2628,7 +2651,8 @@ gnatlib-sjlj:
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
gnatlib-zcx:
- $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" ../stamp-gnatlib1-$(RTSDIR)
+ $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \
+ THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
$(MAKE) $(FLAGS_TO_PASS) \
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h
index 60a5595fe22..5092ff31b78 100644
--- a/gcc/ada/gcc-interface/ada-tree.h
+++ b/gcc/ada/gcc-interface/ada-tree.h
@@ -32,32 +32,38 @@ union GTY((desc ("0"),
desc ("tree_node_structure (&%h)"))) generic;
};
-/* Ada uses the lang_decl and lang_type fields to hold a tree. */
-struct GTY(()) lang_type { tree t; };
-struct GTY(()) lang_decl { tree t; };
+/* Ada uses the lang_decl and lang_type fields to hold a tree.
+
+ FIXME: the variable_size annotation here is needed because these types are
+ variable-sized in some other front-ends. Due to gengtype deficiency, the
+ GTY options of such types have to agree across all front-ends. */
+struct GTY((variable_size)) lang_type { tree t; };
+struct GTY((variable_size)) lang_decl { tree t; };
/* Macros to get and set the tree in TYPE_LANG_SPECIFIC. */
#define GET_TYPE_LANG_SPECIFIC(NODE) \
(TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE)
-#define SET_TYPE_LANG_SPECIFIC(NODE, X) \
-do { \
- tree tmp = (X); \
- if (!TYPE_LANG_SPECIFIC (NODE)) \
- TYPE_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_type); \
- TYPE_LANG_SPECIFIC (NODE)->t = tmp; \
+#define SET_TYPE_LANG_SPECIFIC(NODE, X) \
+do { \
+ tree tmp = (X); \
+ if (!TYPE_LANG_SPECIFIC (NODE)) \
+ TYPE_LANG_SPECIFIC (NODE) \
+ = ggc_alloc_lang_type (sizeof (struct lang_type)); \
+ TYPE_LANG_SPECIFIC (NODE)->t = tmp; \
} while (0)
/* Macros to get and set the tree in DECL_LANG_SPECIFIC. */
#define GET_DECL_LANG_SPECIFIC(NODE) \
(DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE)
-#define SET_DECL_LANG_SPECIFIC(NODE, X) \
-do { \
- tree tmp = (X); \
- if (!DECL_LANG_SPECIFIC (NODE)) \
- DECL_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_decl); \
- DECL_LANG_SPECIFIC (NODE)->t = tmp; \
+#define SET_DECL_LANG_SPECIFIC(NODE, X) \
+do { \
+ tree tmp = (X); \
+ if (!DECL_LANG_SPECIFIC (NODE)) \
+ DECL_LANG_SPECIFIC (NODE) \
+ = ggc_alloc_lang_decl (sizeof (struct lang_decl)); \
+ DECL_LANG_SPECIFIC (NODE)->t = tmp; \
} while (0)
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 0fd7753e1ae..6952060259d 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -55,10 +55,6 @@
#include "ada-tree.h"
#include "gigi.h"
-#ifndef MAX_FIXED_MODE_SIZE
-#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode)
-#endif
-
/* Convention_Stdcall should be processed in a specific way on Windows targets
only. The macro below is a helper to avoid having to check for a Windows
specific attribute throughout this unit. */
@@ -158,13 +154,24 @@ static tree make_type_from_size (tree, tree, bool);
static unsigned int validate_alignment (Uint, Entity_Id, unsigned int);
static unsigned int ceil_alignment (unsigned HOST_WIDE_INT);
static void check_ok_for_atomic (tree, Entity_Id, bool);
-static int compatible_signatures_p (tree, tree);
static tree create_field_decl_from (tree, tree, tree, tree, tree, tree);
static tree get_rep_part (tree);
static tree get_variant_part (tree);
static tree create_variant_part_from (tree, tree, tree, tree, tree);
static void copy_and_substitute_in_size (tree, tree, tree);
static void rest_of_type_decl_compilation_no_defer (tree);
+
+/* The relevant constituents of a subprogram binding to a GCC builtin. Used
+ to pass around calls performing profile compatibilty checks. */
+
+typedef struct {
+ Entity_Id gnat_entity; /* The Ada subprogram entity. */
+ tree ada_fntype; /* The corresponding GCC type node. */
+ tree btin_fntype; /* The GCC builtin function type node. */
+} intrin_binding_t;
+
+static bool intrin_profiles_compatible_p (intrin_binding_t *);
+
/* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada
entity, return the equivalent GCC tree for that entity (a ..._DECL node)
@@ -1040,15 +1047,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
= TYPE_PADDING_P (gnu_type)
? TYPE_FIELDS (TREE_TYPE (TYPE_FIELDS (gnu_type)))
: TYPE_FIELDS (gnu_type);
- gnu_expr
- = gnat_build_constructor
- (gnu_type,
- tree_cons
- (template_field,
- build_template (TREE_TYPE (template_field),
- TREE_TYPE (TREE_CHAIN (template_field)),
- NULL_TREE),
- NULL_TREE));
+ VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 1);
+ tree t = build_template (TREE_TYPE (template_field),
+ TREE_TYPE (TREE_CHAIN (template_field)),
+ NULL_TREE);
+ CONSTRUCTOR_APPEND_ELT (v, template_field, t);
+ gnu_expr = gnat_build_constructor (gnu_type, v);
}
/* Convert the expression to the type of the object except in the
@@ -3905,14 +3909,23 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
}
/* If this subprogram is expectedly bound to a GCC builtin, fetch the
- corresponding DECL node.
+ corresponding DECL node. Proper generation of calls later on need
+ proper parameter associations so we don't "break;" here. */
+ if (Convention (gnat_entity) == Convention_Intrinsic
+ && Present (Interface_Name (gnat_entity)))
+ {
+ gnu_builtin_decl = builtin_decl_for (gnu_ext_name);
- We still want the parameter associations to take place because the
- proper generation of calls depends on it (a GNAT parameter without
- a corresponding GCC tree has a very specific meaning), so we don't
- just break here. */
- if (Convention (gnat_entity) == Convention_Intrinsic)
- gnu_builtin_decl = builtin_decl_for (gnu_ext_name);
+ /* Unability to find the builtin decl most often indicates a
+ genuine mistake, but imports of unregistered intrinsics are
+ sometimes issued on purpose to allow hooking in alternate
+ bodies. We post a warning conditioned on Wshadow in this case,
+ to let developers be notified on demand without risking false
+ positives with common default sets of options. */
+
+ if (gnu_builtin_decl == NULL_TREE && warn_shadow)
+ post_error ("?gcc intrinsic not found for&!", gnat_entity);
+ }
/* ??? What if we don't find the builtin node above ? warn ? err ?
In the current state we neither warn nor err, and calls will just
@@ -4208,21 +4221,25 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
| (TYPE_QUAL_CONST * const_flag)
| (TYPE_QUAL_VOLATILE * volatile_flag));
- /* If we have a builtin decl for that function, check the signatures
- compatibilities. If the signatures are compatible, use the builtin
- decl. If they are not, we expect the checker predicate to have
- posted the appropriate errors, and just continue with what we have
- so far. */
+ /* If we have a builtin decl for that function, use it. Check if the
+ profiles are compatible and warn if they are not. The checker is
+ expected to post extra diagnostics in this case. */
if (gnu_builtin_decl)
{
- tree gnu_builtin_type = TREE_TYPE (gnu_builtin_decl);
+ intrin_binding_t inb;
- if (compatible_signatures_p (gnu_type, gnu_builtin_type))
- {
- gnu_decl = gnu_builtin_decl;
- gnu_type = gnu_builtin_type;
- break;
- }
+ inb.gnat_entity = gnat_entity;
+ inb.ada_fntype = gnu_type;
+ inb.btin_fntype = TREE_TYPE (gnu_builtin_decl);
+
+ if (!intrin_profiles_compatible_p (&inb))
+ post_error
+ ("?profile of& doesn''t match the builtin it binds!",
+ gnat_entity);
+
+ gnu_decl = gnu_builtin_decl;
+ gnu_type = TREE_TYPE (gnu_builtin_decl);
+ break;
}
/* If there was no specified Interface_Name and the external and
@@ -5244,6 +5261,12 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
gnu_param_type
= TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_param_type))));
+ /* For GCC builtins, pass Address integer types as (void *) */
+ if (Convention (gnat_subprog) == Convention_Intrinsic
+ && Present (Interface_Name (gnat_subprog))
+ && Is_Descendent_Of_Address (Etype (gnat_param)))
+ gnu_param_type = ptr_void_type_node;
+
/* VMS descriptors are themselves passed by reference. */
if (mech == By_Short_Descriptor ||
(mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64))
@@ -7300,7 +7323,7 @@ annotate_value (tree gnu_size)
/* Save the result in the cache. */
if (h)
{
- *h = GGC_NEW (struct tree_int_map);
+ *h = ggc_alloc_tree_int_map ();
(*h)->base.from = gnu_size;
(*h)->to = ret;
}
@@ -8040,32 +8063,154 @@ check_ok_for_atomic (tree object, Entity_Id gnat_entity, bool comp_p)
gnat_error_point, gnat_entity);
}
-/* Check if FTYPE1 and FTYPE2, two potentially different function type nodes,
- have compatible signatures so that a call using one type may be safely
- issued if the actual target function type is the other. Return 1 if it is
- the case, 0 otherwise, and post errors on the incompatibilities.
- This is used when an Ada subprogram is mapped onto a GCC builtin, to ensure
- that calls to the subprogram will have arguments suitable for the later
- underlying builtin expansion. */
+/* Helper for the intrin compatibility checks family. Evaluate whether
+ two types are definitely incompatible. */
-static int
-compatible_signatures_p (tree ftype1, tree ftype2)
+static bool
+intrin_types_incompatible_p (tree t1, tree t2)
{
- /* As of now, we only perform very trivial tests and consider it's the
- programmer's responsibility to ensure the type correctness in the Ada
- declaration, as in the regular Import cases.
+ enum tree_code code;
+
+ if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
+ return false;
+
+ if (TYPE_MODE (t1) != TYPE_MODE (t2))
+ return true;
+
+ if (TREE_CODE (t1) != TREE_CODE (t2))
+ return true;
+
+ code = TREE_CODE (t1);
+
+ switch (code)
+ {
+ case INTEGER_TYPE:
+ case REAL_TYPE:
+ return TYPE_PRECISION (t1) != TYPE_PRECISION (t2);
+
+ case POINTER_TYPE:
+ case REFERENCE_TYPE:
+ /* Assume designated types are ok. We'd need to account for char * and
+ void * variants to do better, which could rapidly get messy and isn't
+ clearly worth the effort. */
+ return false;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+/* Helper for intrin_profiles_compatible_p, to perform compatibility checks
+ on the Ada/builtin argument lists for the INB binding. */
+
+static bool
+intrin_arglists_compatible_p (intrin_binding_t * inb)
+{
+ tree ada_args = TYPE_ARG_TYPES (inb->ada_fntype);
+ tree btin_args = TYPE_ARG_TYPES (inb->btin_fntype);
+
+ /* Sequence position of the last argument we checked. */
+ int argpos = 0;
+
+ while (ada_args != 0 || btin_args != 0)
+ {
+ tree ada_type, btin_type;
+
+ /* If one list is shorter than the other, they fail to match. */
+ if (ada_args == 0 || btin_args == 0)
+ return false;
+
+ ada_type = TREE_VALUE (ada_args);
+ btin_type = TREE_VALUE (btin_args);
+
+ /* If we're done with the Ada args and not with the internal builtin
+ args, or the other way around, complain. */
+ if (ada_type == void_type_node
+ && btin_type != void_type_node)
+ {
+ post_error ("?Ada arguments list too short!", inb->gnat_entity);
+ return false;
+ }
+
+ if (btin_type == void_type_node
+ && ada_type != void_type_node)
+ {
+ post_error_ne_num ("?Ada arguments list too long ('> ^)!",
+ inb->gnat_entity, inb->gnat_entity, argpos);
+ return false;
+ }
+
+ /* Otherwise, check that types match for the current argument. */
+ argpos ++;
+ if (intrin_types_incompatible_p (ada_type, btin_type))
+ {
+ post_error_ne_num ("?intrinsic binding type mismatch on argument ^!",
+ inb->gnat_entity, inb->gnat_entity, argpos);
+ return false;
+ }
+
+ ada_args = TREE_CHAIN (ada_args);
+ btin_args = TREE_CHAIN (btin_args);
+ }
+
+ return true;
+}
+
+/* Helper for intrin_profiles_compatible_p, to perform compatibility checks
+ on the Ada/builtin return values for the INB binding. */
+
+static bool
+intrin_return_compatible_p (intrin_binding_t * inb)
+{
+ tree ada_return_type = TREE_TYPE (inb->ada_fntype);
+ tree btin_return_type = TREE_TYPE (inb->btin_fntype);
+
+ /* Accept function imported as procedure, common and convenient. */
+ if (VOID_TYPE_P (ada_return_type)
+ && !VOID_TYPE_P (btin_return_type))
+ return true;
+
+ /* Check return types compatibility otherwise. Note that this
+ handles void/void as well. */
+ if (intrin_types_incompatible_p (btin_return_type, ada_return_type))
+ {
+ post_error ("?intrinsic binding type mismatch on return value!",
+ inb->gnat_entity);
+ return false;
+ }
+
+ return true;
+}
+
+/* Check and return whether the Ada and gcc builtin profiles bound by INB are
+ compatible. Issue relevant warnings when they are not.
+
+ This is intended as a light check to diagnose the most obvious cases, not
+ as a full fledged type compatiblity predicate. It is the programmer's
+ responsibility to ensure correctness of the Ada declarations in Imports,
+ especially when binding straight to a compiler internal. */
+
+static bool
+intrin_profiles_compatible_p (intrin_binding_t * inb)
+{
+ /* Check compatibility on return values and argument lists, each responsible
+ for posting warnings as appropriate. Ensure use of the proper sloc for
+ this purpose. */
+
+ bool arglists_compatible_p, return_compatible_p;
+ location_t saved_location = input_location;
+
+ Sloc_to_locus (Sloc (inb->gnat_entity), &input_location);
- Mismatches typically result in either error messages from the builtin
- expander, internal compiler errors, or in a real call sequence. This
- should be refined to issue diagnostics helping error detection and
- correction. */
+ return_compatible_p = intrin_return_compatible_p (inb);
+ arglists_compatible_p = intrin_arglists_compatible_p (inb);
- /* Almost fake test, ensuring a use of each argument. */
- if (ftype1 == ftype2)
- return 1;
+ input_location = saved_location;
- return 1;
+ return return_compatible_p && arglists_compatible_p;
}
/* Return a FIELD_DECL node modeled on OLD_FIELD. FIELD_TYPE is its type
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 74a94d73261..767700f6f76 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -785,9 +785,9 @@ extern tree build_call_0_expr (tree fundecl);
(N_Raise_{Constraint,Storage,Program}_Error). */
extern tree build_call_raise (int msg, Node_Id gnat_node, char kind);
-/* Return a CONSTRUCTOR of TYPE whose list is LIST. This is not the
+/* Return a CONSTRUCTOR of TYPE whose elements are V. This is not the
same as build_constructor in the language-independent tree.c. */
-extern tree gnat_build_constructor (tree type, tree list);
+extern tree gnat_build_constructor (tree type, VEC(constructor_elt,gc) *v);
/* Return a COMPONENT_REF to access a field that is given by COMPONENT,
an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL,
diff --git a/gcc/ada/gcc-interface/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h
index e0c1be9e103..7f37ef58611 100644
--- a/gcc/ada/gcc-interface/lang-specs.h
+++ b/gcc/ada/gcc-interface/lang-specs.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 1992-2009, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2010, 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- *
@@ -38,9 +38,6 @@
%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} \
%{O*} %{W*} %{w} %{p} %{pg:-p} %{a} %{d*} %{f*}\
%{coverage:-fprofile-arcs -ftest-coverage} "
-#if CONFIG_DUAL_EXCEPTIONS
- "%{fRTS=sjlj:-fsjlj} "
-#endif
"%{gnatea:-gnatez} %{g*&m*} "
#if defined(TARGET_VXWORKS_RTP)
"%{fRTS=rtp:-mrtp} "
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index a80afbdc80e..4033173d782 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -25,7 +25,7 @@
/* This file contains parts of the compiler that are required for interfacing
with GCC but otherwise do nothing and parts of Gigi that need to know
- about RTL. */
+ about GIMPLE. */
#include "config.h"
#include "system.h"
@@ -44,7 +44,6 @@
#include "options.h"
#include "plugin.h"
#include "function.h" /* For pass_by_reference. */
-#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
#include "ada.h"
#include "adadecode.h"
@@ -135,6 +134,9 @@ static tree gnat_eh_personality (void);
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+/* This symbol needs to be defined for the front-end. */
+void *callgraph_info_file = NULL;
+
/* How much we want of our DWARF extensions. Some of our dwarf+ extensions
are incompatible with regular GDB versions, so we must make sure to only
produce them on explicit request. This is eventually reflected into the
@@ -574,7 +576,7 @@ static const char *
gnat_printable_name (tree decl, int verbosity)
{
const char *coded_name = IDENTIFIER_POINTER (DECL_NAME (decl));
- char *ada_name = (char *) ggc_alloc (strlen (coded_name) * 2 + 60);
+ char *ada_name = (char *) ggc_alloc_atomic (strlen (coded_name) * 2 + 60);
__gnat_decode (coded_name, ada_name, 0);
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 1732069b699..46848f230f7 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -153,35 +153,25 @@ struct GTY((chain_next ("%h.next"))) elab_info {
static GTY(()) struct elab_info *elab_info_list;
-/* Free list of TREE_LIST nodes used for stacks. */
-static GTY((deletable)) tree gnu_stack_free_list;
+/* Stack of exception pointer variables. Each entry is the VAR_DECL
+ that stores the address of the raised exception. Nonzero means we
+ are in an exception handler. Not used in the zero-cost case. */
+static GTY(()) VEC(tree,gc) *gnu_except_ptr_stack;
-/* List of TREE_LIST nodes representing a stack of exception pointer
- variables. TREE_VALUE is the VAR_DECL that stores the address of
- the raised exception. Nonzero means we are in an exception
- handler. Not used in the zero-cost case. */
-static GTY(()) tree gnu_except_ptr_stack;
+/* Stack for storing the current elaboration procedure decl. */
+static GTY(()) VEC(tree,gc) *gnu_elab_proc_stack;
-/* List of TREE_LIST nodes used to store the current elaboration procedure
- decl. TREE_VALUE is the decl. */
-static GTY(()) tree gnu_elab_proc_stack;
+/* Stack of labels to be used as a goto target instead of a return in
+ some functions. See processing for N_Subprogram_Body. */
+static GTY(()) VEC(tree,gc) *gnu_return_label_stack;
-/* Variable that stores a list of labels to be used as a goto target instead of
- a return in some functions. See processing for N_Subprogram_Body. */
-static GTY(()) tree gnu_return_label_stack;
+/* Stack of LOOP_STMT nodes. */
+static GTY(()) VEC(tree,gc) *gnu_loop_label_stack;
-/* List of TREE_LIST nodes representing a stack of LOOP_STMT nodes.
- TREE_VALUE of each entry is the label of the corresponding LOOP_STMT. */
-static GTY(()) tree gnu_loop_label_stack;
-
-/* List of TREE_LIST nodes representing labels for switch statements.
- TREE_VALUE of each entry is the label at the end of the switch. */
-static GTY(()) tree gnu_switch_label_stack;
-
-/* List of TREE_LIST nodes containing the stacks for N_{Push,Pop}_*_Label. */
-static GTY(()) tree gnu_constraint_error_label_stack;
-static GTY(()) tree gnu_storage_error_label_stack;
-static GTY(()) tree gnu_program_error_label_stack;
+/* The stacks for N_{Push,Pop}_*_Label. */
+static GTY(()) VEC(tree,gc) *gnu_constraint_error_label_stack;
+static GTY(()) VEC(tree,gc) *gnu_storage_error_label_stack;
+static GTY(()) VEC(tree,gc) *gnu_program_error_label_stack;
/* Map GNAT tree codes to GCC tree codes for simple expressions. */
static enum tree_code gnu_codes[Number_Node_Kinds];
@@ -192,10 +182,8 @@ static void record_code_position (Node_Id);
static void insert_code_for (Node_Id);
static void add_cleanup (tree, Node_Id);
static void add_stmt_list (List_Id);
-static void push_exception_label_stack (tree *, Entity_Id);
+static void push_exception_label_stack (VEC(tree,gc) **, Entity_Id);
static tree build_stmt_group (List_Id, bool);
-static void push_stack (tree *, tree, tree);
-static void pop_stack (tree *);
static enum gimplify_status gnat_gimplify_stmt (tree *);
static void elaborate_all_entities (Node_Id);
static void process_freeze_entity (Node_Id);
@@ -213,6 +201,7 @@ static tree extract_values (tree, tree);
static tree pos_to_constructor (Node_Id, tree, Entity_Id);
static tree maybe_implicit_deref (tree);
static void set_expr_location_from_node (tree, Node_Id);
+static void set_gnu_expr_location_from_node (tree, Node_Id);
static int lvalue_required_p (Node_Id, tree, bool, bool, bool);
/* Hooks for debug info back-ends, only supported and used in a restricted set
@@ -555,10 +544,16 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
if (TARGET_VTABLE_USES_DESCRIPTORS)
{
tree null_node = fold_convert (ptr_void_ftype, null_pointer_node);
- tree field_list = NULL_TREE, null_list = NULL_TREE;
+ tree field_list = NULL_TREE;
int j;
+ VEC(constructor_elt,gc) *null_vec = NULL;
+ constructor_elt *elt;
fdesc_type_node = make_node (RECORD_TYPE);
+ VEC_safe_grow (constructor_elt, gc, null_vec,
+ TARGET_VTABLE_USES_DESCRIPTORS);
+ elt = (VEC_address (constructor_elt,null_vec)
+ + TARGET_VTABLE_USES_DESCRIPTORS - 1);
for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; j++)
{
@@ -567,12 +562,14 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
NULL_TREE, NULL_TREE, 0, 1);
TREE_CHAIN (field) = field_list;
field_list = field;
- null_list = tree_cons (field, null_node, null_list);
+ elt->index = field;
+ elt->value = null_node;
+ elt--;
}
finish_record_type (fdesc_type_node, nreverse (field_list), 0, false);
record_builtin_type ("descriptor", fdesc_type_node);
- null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_list);
+ null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_vec);
}
long_long_float_type
@@ -609,11 +606,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
user available facilities for Intrinsic imports. */
gnat_install_builtins ();
- gnu_except_ptr_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
- gnu_constraint_error_label_stack
- = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
- gnu_storage_error_label_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
- gnu_program_error_label_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
+ VEC_safe_push (tree, gc, gnu_except_ptr_stack, NULL_TREE);
+ VEC_safe_push (tree, gc, gnu_constraint_error_label_stack, NULL_TREE);
+ VEC_safe_push (tree, gc, gnu_storage_error_label_stack, NULL_TREE);
+ VEC_safe_push (tree, gc, gnu_program_error_label_stack, NULL_TREE);
/* Process any Pragma Ident for the main unit. */
#ifdef ASM_OUTPUT_IDENT
@@ -973,7 +969,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
variables of non-constant size because they are automatically allocated
to memory. There might be no way of allocating a proper temporary for
them in any case. We only do this for SJLJ though. */
- if (TREE_VALUE (gnu_except_ptr_stack)
+ if (VEC_last (tree, gnu_except_ptr_stack)
&& TREE_CODE (gnu_result) == VAR_DECL
&& TREE_CODE (DECL_SIZE_UNIT (gnu_result)) == INTEGER_CST)
TREE_THIS_VOLATILE (gnu_result) = TREE_SIDE_EFFECTS (gnu_result) = 1;
@@ -1242,10 +1238,12 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
else if (TARGET_VTABLE_USES_DESCRIPTORS
&& Is_Dispatch_Table_Entity (Etype (gnat_node)))
{
- tree gnu_field, gnu_list = NULL_TREE, t;
+ tree gnu_field, t;
/* Descriptors can only be built here for top-level functions. */
bool build_descriptor = (global_bindings_p () != 0);
int i;
+ VEC(constructor_elt,gc) *gnu_vec = NULL;
+ constructor_elt *elt;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
@@ -1260,6 +1258,10 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
gnu_result = build1 (INDIRECT_REF, gnu_result_type, gnu_result);
}
+ VEC_safe_grow (constructor_elt, gc, gnu_vec,
+ TARGET_VTABLE_USES_DESCRIPTORS);
+ elt = (VEC_address (constructor_elt, gnu_vec)
+ + TARGET_VTABLE_USES_DESCRIPTORS - 1);
for (gnu_field = TYPE_FIELDS (gnu_result_type), i = 0;
i < TARGET_VTABLE_USES_DESCRIPTORS;
gnu_field = TREE_CHAIN (gnu_field), i++)
@@ -1274,10 +1276,12 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
t = build3 (COMPONENT_REF, ptr_void_ftype, gnu_result,
gnu_field, NULL_TREE);
- gnu_list = tree_cons (gnu_field, t, gnu_list);
+ elt->index = gnu_field;
+ elt->value = t;
+ elt--;
}
- gnu_result = gnat_build_constructor (gnu_result_type, gnu_list);
+ gnu_result = gnat_build_constructor (gnu_result_type, gnu_vec);
break;
}
@@ -1605,7 +1609,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
if (!pa)
{
- pa = GGC_CNEW (struct parm_attr_d);
+ pa = ggc_alloc_cleared_parm_attr_d ();
pa->id = gnat_param;
pa->dim = Dimension;
VEC_safe_push (parm_attr, gc, f_parm_attr_cache, pa);
@@ -1917,9 +1921,9 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
static tree
Case_Statement_to_gnu (Node_Id gnat_node)
{
- tree gnu_result;
- tree gnu_expr;
+ tree gnu_result, gnu_expr, gnu_label;
Node_Id gnat_when;
+ bool may_fallthru = false;
gnu_expr = gnat_to_gnu (Expression (gnat_node));
gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
@@ -1942,10 +1946,9 @@ Case_Statement_to_gnu (Node_Id gnat_node)
/* We build a SWITCH_EXPR that contains the code with interspersed
CASE_LABEL_EXPRs for each label. */
-
- push_stack (&gnu_switch_label_stack, NULL_TREE,
- create_artificial_label (input_location));
+ gnu_label = create_artificial_label (input_location);
start_stmt_group ();
+
for (gnat_when = First_Non_Pragma (Alternatives (gnat_node));
Present (gnat_when);
gnat_when = Next_Non_Pragma (gnat_when))
@@ -2023,18 +2026,22 @@ Case_Statement_to_gnu (Node_Id gnat_node)
containing the Case statement. */
if (choices_added_p)
{
- add_stmt (build_stmt_group (Statements (gnat_when), true));
- add_stmt (build1 (GOTO_EXPR, void_type_node,
- TREE_VALUE (gnu_switch_label_stack)));
+ tree group = build_stmt_group (Statements (gnat_when), true);
+ bool group_may_fallthru = block_may_fallthru (group);
+ add_stmt (group);
+ if (group_may_fallthru)
+ {
+ add_stmt (build1 (GOTO_EXPR, void_type_node, gnu_label));
+ may_fallthru = true;
+ }
}
}
- /* Now emit a definition of the label all the cases branched to. */
- add_stmt (build1 (LABEL_EXPR, void_type_node,
- TREE_VALUE (gnu_switch_label_stack)));
+ /* Now emit a definition of the label the cases branch to, if any. */
+ if (may_fallthru)
+ add_stmt (build1 (LABEL_EXPR, void_type_node, gnu_label));
gnu_result = build3 (SWITCH_EXPR, TREE_TYPE (gnu_expr), gnu_expr,
end_stmt_group (), NULL_TREE);
- pop_stack (&gnu_switch_label_stack);
return gnu_result;
}
@@ -2100,7 +2107,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node)
/* Save the end label of this LOOP_STMT in a stack so that a corresponding
N_Exit_Statement can find it. */
- push_stack (&gnu_loop_label_stack, NULL_TREE, gnu_loop_label);
+ VEC_safe_push (tree, gc, gnu_loop_label_stack, gnu_loop_label);
/* Set the condition under which the loop must keep going.
For the case "LOOP .... END LOOP;" the condition is always true. */
@@ -2317,7 +2324,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node)
else
gnu_result = gnu_loop_stmt;
- pop_stack (&gnu_loop_label_stack);
+ VEC_pop (tree, gnu_loop_label_stack);
return gnu_result;
}
@@ -2441,7 +2448,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
/* Initialize the information structure for the function. */
allocate_struct_function (gnu_subprog_decl, false);
DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language
- = GGC_CNEW (struct language_function);
+ = ggc_alloc_cleared_language_function ();
set_cfun (NULL);
begin_subprog_body (gnu_subprog_decl);
@@ -2450,9 +2457,10 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
properly copies them out. We do this by making a new block and converting
any inner return into a goto to a label at the end of the block. */
gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type);
- push_stack (&gnu_return_label_stack, NULL_TREE,
- gnu_cico_list ? create_artificial_label (input_location)
- : NULL_TREE);
+ VEC_safe_push (tree, gc, gnu_return_label_stack,
+ gnu_cico_list
+ ? create_artificial_label (input_location)
+ : NULL_TREE);
/* Get a tree corresponding to the code for the subprogram. */
start_stmt_group ();
@@ -2470,9 +2478,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
{
/* Skip any entries that have been already filled in; they must
correspond to In Out parameters. */
- for (; gnu_cico_list && TREE_VALUE (gnu_cico_list);
- gnu_cico_list = TREE_CHAIN (gnu_cico_list))
- ;
+ while (gnu_cico_list && TREE_VALUE (gnu_cico_list))
+ gnu_cico_list = TREE_CHAIN (gnu_cico_list);
/* Do any needed references for padded types. */
TREE_VALUE (gnu_cico_list)
@@ -2540,7 +2547,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
We need to make a block that contains the definition of that label and
the copying of the return value. It first contains the function, then
the label and copy statement. */
- if (TREE_VALUE (gnu_return_label_stack))
+ if (VEC_last (tree, gnu_return_label_stack))
{
tree gnu_retval;
@@ -2548,14 +2555,14 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnat_pushlevel ();
add_stmt (gnu_result);
add_stmt (build1 (LABEL_EXPR, void_type_node,
- TREE_VALUE (gnu_return_label_stack)));
+ VEC_last (tree, gnu_return_label_stack)));
gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type);
if (list_length (gnu_cico_list) == 1)
gnu_retval = TREE_VALUE (gnu_cico_list);
else
- gnu_retval = gnat_build_constructor (TREE_TYPE (gnu_subprog_type),
- gnu_cico_list);
+ gnu_retval = build_constructor_from_list (TREE_TYPE (gnu_subprog_type),
+ gnu_cico_list);
add_stmt_with_node (build_return_expr (gnu_result_decl, gnu_retval),
End_Label (Handled_Statement_Sequence (gnat_node)));
@@ -2563,7 +2570,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnu_result = end_stmt_group ();
}
- pop_stack (&gnu_return_label_stack);
+ VEC_pop (tree, gnu_return_label_stack);
/* Set the end location. */
Sloc_to_locus
@@ -2666,7 +2673,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
so we can give them the scope of the elaboration routine at top level. */
else if (!current_function_decl)
{
- current_function_decl = TREE_VALUE (gnu_elab_proc_stack);
+ current_function_decl = VEC_last (tree, gnu_elab_proc_stack);
went_into_elab_proc = true;
}
@@ -3260,12 +3267,13 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node)
start_stmt_group ();
gnat_pushlevel ();
- push_stack (&gnu_except_ptr_stack, NULL_TREE,
- create_var_decl (get_identifier ("EXCEPT_PTR"),
- NULL_TREE,
- build_pointer_type (except_type_node),
- build_call_0_expr (get_excptr_decl), false,
- false, false, false, NULL, gnat_node));
+ VEC_safe_push (tree, gc, gnu_except_ptr_stack,
+ create_var_decl (get_identifier ("EXCEPT_PTR"),
+ NULL_TREE,
+ build_pointer_type (except_type_node),
+ build_call_0_expr (get_excptr_decl),
+ false,
+ false, false, false, NULL, gnat_node));
/* Generate code for each handler. The N_Exception_Handler case does the
real work and returns a COND_EXPR for each handler, which we chain
@@ -3289,7 +3297,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node)
/* If none of the exception handlers did anything, re-raise but do not
defer abortion. */
gnu_expr = build_call_1_expr (raise_nodefer_decl,
- TREE_VALUE (gnu_except_ptr_stack));
+ VEC_last (tree, gnu_except_ptr_stack));
set_expr_location_from_node
(gnu_expr,
Present (End_Label (gnat_node)) ? End_Label (gnat_node) : gnat_node);
@@ -3301,7 +3309,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node)
/* End the binding level dedicated to the exception handlers and get the
whole statement group. */
- pop_stack (&gnu_except_ptr_stack);
+ VEC_pop (tree, gnu_except_ptr_stack);
gnat_poplevel ();
gnu_handler = end_stmt_group ();
@@ -3385,7 +3393,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node)
build_component_ref
(build_unary_op
(INDIRECT_REF, NULL_TREE,
- TREE_VALUE (gnu_except_ptr_stack)),
+ VEC_last (tree, gnu_except_ptr_stack)),
get_identifier ("not_handled_by_others"), NULL_TREE,
false)),
integer_zero_node);
@@ -3406,8 +3414,9 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node)
this_choice
= build_binary_op
- (EQ_EXPR, boolean_type_node, TREE_VALUE (gnu_except_ptr_stack),
- convert (TREE_TYPE (TREE_VALUE (gnu_except_ptr_stack)),
+ (EQ_EXPR, boolean_type_node,
+ VEC_last (tree, gnu_except_ptr_stack),
+ convert (TREE_TYPE (VEC_last (tree, gnu_except_ptr_stack)),
build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr)));
/* If this is the distinguished exception "Non_Ada_Error" (and we are
@@ -3418,7 +3427,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node)
tree gnu_comp
= build_component_ref
(build_unary_op (INDIRECT_REF, NULL_TREE,
- TREE_VALUE (gnu_except_ptr_stack)),
+ VEC_last (tree, gnu_except_ptr_stack)),
get_identifier ("lang"), NULL_TREE, false);
this_choice
@@ -3555,7 +3564,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
NULL_TREE, void_ftype, NULL_TREE, false, true, false, NULL, gnat_unit);
struct elab_info *info;
- push_stack (&gnu_elab_proc_stack, NULL_TREE, gnu_elab_proc_decl);
+ VEC_safe_push (tree, gc, gnu_elab_proc_stack, gnu_elab_proc_decl);
DECL_ELABORATION_PROC_P (gnu_elab_proc_decl) = 1;
/* Initialize the information structure for the function. */
@@ -3626,7 +3635,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
/* Save away what we've made so far and record this potential elaboration
procedure. */
- info = (struct elab_info *) ggc_alloc (sizeof (struct elab_info));
+ info = ggc_alloc_elab_info ();
set_current_block_context (gnu_elab_proc_decl);
gnat_poplevel ();
DECL_SAVED_TREE (gnu_elab_proc_decl) = end_stmt_group ();
@@ -3642,7 +3651,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
/* Generate elaboration code for this unit, if necessary, and say whether
we did or not. */
- pop_stack (&gnu_elab_proc_stack);
+ VEC_pop (tree, gnu_elab_proc_stack);
/* Invalidate the global renaming pointers. This is necessary because
stabilization of the renamed entities may create SAVE_EXPRs which
@@ -3744,7 +3753,7 @@ gnat_to_gnu (Node_Id gnat_node)
the elaboration procedure, so mark us as being in that procedure. */
if (!current_function_decl)
{
- current_function_decl = TREE_VALUE (gnu_elab_proc_stack);
+ current_function_decl = VEC_last (tree, gnu_elab_proc_stack);
went_into_elab_proc = true;
}
@@ -3755,7 +3764,7 @@ gnat_to_gnu (Node_Id gnat_node)
every nested real statement instead. This also avoids triggering
spurious errors on dummy (empty) sequences created by the front-end
for package bodies in some cases. */
- if (current_function_decl == TREE_VALUE (gnu_elab_proc_stack)
+ if (current_function_decl == VEC_last (tree, gnu_elab_proc_stack)
&& kind != N_Handled_Sequence_Of_Statements)
Check_Elaboration_Code_Allowed (gnat_node);
}
@@ -3918,24 +3927,21 @@ gnat_to_gnu (Node_Id gnat_node)
String_Id gnat_string = Strval (gnat_node);
int length = String_Length (gnat_string);
int i;
- tree gnu_list = NULL_TREE;
tree gnu_idx = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type));
+ VEC(constructor_elt,gc) *gnu_vec
+ = VEC_alloc (constructor_elt, gc, length);
for (i = 0; i < length; i++)
{
- gnu_list
- = tree_cons (gnu_idx,
- build_int_cst (TREE_TYPE (gnu_result_type),
- Get_String_Char (gnat_string,
- i + 1)),
- gnu_list);
+ tree t = build_int_cst (TREE_TYPE (gnu_result_type),
+ Get_String_Char (gnat_string, i + 1));
+ CONSTRUCTOR_APPEND_ELT (gnu_vec, gnu_idx, t);
gnu_idx = int_const_binop (PLUS_EXPR, gnu_idx, integer_one_node,
0);
}
- gnu_result
- = gnat_build_constructor (gnu_result_type, nreverse (gnu_list));
+ gnu_result = gnat_build_constructor (gnu_result_type, gnu_vec);
}
break;
@@ -4323,7 +4329,7 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_aggr_type = TYPE_REPRESENTATIVE_ARRAY (gnu_result_type);
if (Null_Record_Present (gnat_node))
- gnu_result = gnat_build_constructor (gnu_aggr_type, NULL_TREE);
+ gnu_result = gnat_build_constructor (gnu_aggr_type, NULL);
else if (TREE_CODE (gnu_aggr_type) == RECORD_TYPE
|| TREE_CODE (gnu_aggr_type) == UNION_TYPE)
@@ -4879,7 +4885,7 @@ gnat_to_gnu (Node_Id gnat_node)
? gnat_to_gnu (Condition (gnat_node)) : NULL_TREE),
(Present (Name (gnat_node))
? get_gnu_tree (Entity (Name (gnat_node)))
- : TREE_VALUE (gnu_loop_label_stack)));
+ : VEC_last (tree, gnu_loop_label_stack)));
break;
case N_Return_Statement:
@@ -4888,13 +4894,13 @@ gnat_to_gnu (Node_Id gnat_node)
/* If we have a return label defined, convert this into a branch to
that label. The return proper will be handled elsewhere. */
- if (TREE_VALUE (gnu_return_label_stack))
+ if (VEC_last (tree, gnu_return_label_stack))
{
gnu_result = build1 (GOTO_EXPR, void_type_node,
- TREE_VALUE (gnu_return_label_stack));
+ VEC_last (tree, gnu_return_label_stack));
/* When not optimizing, make sure the return is preserved. */
if (!optimize && Comes_From_Source (gnat_node))
- DECL_ARTIFICIAL (TREE_VALUE (gnu_return_label_stack)) = 0;
+ DECL_ARTIFICIAL (VEC_last (tree, gnu_return_label_stack)) = 0;
break;
}
@@ -5154,18 +5160,15 @@ gnat_to_gnu (Node_Id gnat_node)
break;
case N_Pop_Constraint_Error_Label:
- gnu_constraint_error_label_stack
- = TREE_CHAIN (gnu_constraint_error_label_stack);
+ VEC_pop (tree, gnu_constraint_error_label_stack);
break;
case N_Pop_Storage_Error_Label:
- gnu_storage_error_label_stack
- = TREE_CHAIN (gnu_storage_error_label_stack);
+ VEC_pop (tree, gnu_storage_error_label_stack);
break;
case N_Pop_Program_Error_Label:
- gnu_program_error_label_stack
- = TREE_CHAIN (gnu_program_error_label_stack);
+ VEC_pop (tree, gnu_program_error_label_stack);
break;
/******************************/
@@ -5327,6 +5330,19 @@ gnat_to_gnu (Node_Id gnat_node)
/* Added Nodes */
/****************/
+ case N_Expression_With_Actions:
+ gnu_result_type = get_unpadded_type (Etype (gnat_node));
+ /* This construct doesn't define a scope so we don't wrap the statement
+ list in a BIND_EXPR; however, we wrap it in a SAVE_EXPR to protect it
+ from unsharing. */
+ gnu_result = build_stmt_group (Actions (gnat_node), false);
+ gnu_result = build1 (SAVE_EXPR, void_type_node, gnu_result);
+ TREE_SIDE_EFFECTS (gnu_result) = 1;
+ gnu_expr = gnat_to_gnu (Expression (gnat_node));
+ gnu_result
+ = build2 (COMPOUND_EXPR, TREE_TYPE (gnu_expr), gnu_result, gnu_expr);
+ break;
+
case N_Freeze_Entity:
start_stmt_group ();
process_freeze_entity (gnat_node);
@@ -5546,17 +5562,11 @@ gnat_to_gnu (Node_Id gnat_node)
convert (gnu_result_type,
boolean_false_node));
- /* Set the location information on the result if it is a real expression.
- References can be reused for multiple GNAT nodes and they would get
- the location information of their last use. Note that we may have
+ /* Set the location information on the result. Note that we may have
no result if we tried to build a CALL_EXPR node to a procedure with
no side-effects and optimization is enabled. */
- if (gnu_result
- && EXPR_P (gnu_result)
- && TREE_CODE (gnu_result) != NOP_EXPR
- && !REFERENCE_CLASS_P (gnu_result)
- && !EXPR_HAS_LOCATION (gnu_result))
- set_expr_location_from_node (gnu_result, gnat_node);
+ if (gnu_result && EXPR_P (gnu_result))
+ set_gnu_expr_location_from_node (gnu_result, gnat_node);
/* If we're supposed to return something of void_type, it means we have
something we're elaborating for effect, so just return. */
@@ -5682,13 +5692,13 @@ gnat_to_gnu (Node_Id gnat_node)
label to push onto the stack. */
static void
-push_exception_label_stack (tree *gnu_stack, Entity_Id gnat_label)
+push_exception_label_stack (VEC(tree,gc) **gnu_stack, Entity_Id gnat_label)
{
tree gnu_label = (Present (gnat_label)
? gnat_to_gnu_entity (gnat_label, NULL_TREE, 0)
: NULL_TREE);
- *gnu_stack = tree_cons (NULL_TREE, gnu_label, *gnu_stack);
+ VEC_safe_push (tree, gc, *gnu_stack, gnu_label);
}
/* Record the current code position in GNAT_NODE. */
@@ -5722,7 +5732,7 @@ start_stmt_group (void)
if (group)
stmt_group_free_list = group->previous;
else
- group = (struct stmt_group *) ggc_alloc (sizeof (struct stmt_group));
+ group = ggc_alloc_stmt_group ();
group->previous = current_stmt_group;
group->stmt_list = group->block = group->cleanups = NULL_TREE;
@@ -5938,37 +5948,6 @@ build_stmt_group (List_Id gnat_list, bool binding_p)
return end_stmt_group ();
}
-/* Push and pop routines for stacks. We keep a free list around so we
- don't waste tree nodes. */
-
-static void
-push_stack (tree *gnu_stack_ptr, tree gnu_purpose, tree gnu_value)
-{
- tree gnu_node = gnu_stack_free_list;
-
- if (gnu_node)
- {
- gnu_stack_free_list = TREE_CHAIN (gnu_node);
- TREE_CHAIN (gnu_node) = *gnu_stack_ptr;
- TREE_PURPOSE (gnu_node) = gnu_purpose;
- TREE_VALUE (gnu_node) = gnu_value;
- }
- else
- gnu_node = tree_cons (gnu_purpose, gnu_value, *gnu_stack_ptr);
-
- *gnu_stack_ptr = gnu_node;
-}
-
-static void
-pop_stack (tree *gnu_stack_ptr)
-{
- tree gnu_node = *gnu_stack_ptr;
-
- *gnu_stack_ptr = TREE_CHAIN (gnu_node);
- TREE_CHAIN (gnu_node) = gnu_stack_free_list;
- gnu_stack_free_list = gnu_node;
-}
-
/* Generate GIMPLE in place for the expression at *EXPR_P. */
int
@@ -7340,9 +7319,9 @@ static tree
pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type,
Entity_Id gnat_component_type)
{
- tree gnu_expr_list = NULL_TREE;
tree gnu_index = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_array_type));
tree gnu_expr;
+ VEC(constructor_elt,gc) *gnu_expr_vec = NULL;
for ( ; Present (gnat_expr); gnat_expr = Next (gnat_expr))
{
@@ -7365,14 +7344,13 @@ pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type,
gnu_expr = emit_range_check (gnu_expr, gnat_component_type, Empty);
}
- gnu_expr_list
- = tree_cons (gnu_index, convert (TREE_TYPE (gnu_array_type), gnu_expr),
- gnu_expr_list);
+ CONSTRUCTOR_APPEND_ELT (gnu_expr_vec, gnu_index,
+ convert (TREE_TYPE (gnu_array_type), gnu_expr));
gnu_index = int_const_binop (PLUS_EXPR, gnu_index, integer_one_node, 0);
}
- return gnat_build_constructor (gnu_array_type, nreverse (gnu_expr_list));
+ return gnat_build_constructor (gnu_array_type, gnu_expr_vec);
}
/* Subroutine of assoc_to_constructor: VALUES is a list of field associations,
@@ -7383,8 +7361,8 @@ pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type,
static tree
extract_values (tree values, tree record_type)
{
- tree result = NULL_TREE;
tree field, tem;
+ VEC(constructor_elt,gc) *v = NULL;
for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field))
{
@@ -7418,10 +7396,10 @@ extract_values (tree values, tree record_type)
if (!value)
continue;
- result = tree_cons (field, value, result);
+ CONSTRUCTOR_APPEND_ELT (v, field, value);
}
- return gnat_build_constructor (record_type, nreverse (result));
+ return gnat_build_constructor (record_type, v);
}
/* EXP is to be treated as an array or record. Handle the cases when it is
@@ -7491,6 +7469,37 @@ set_expr_location_from_node (tree node, Node_Id gnat_node)
SET_EXPR_LOCATION (node, locus);
}
+
+/* More elaborate version of set_expr_location_from_node to be used in more
+ general contexts, for example the result of the translation of a generic
+ GNAT node. */
+
+static void
+set_gnu_expr_location_from_node (tree node, Node_Id gnat_node)
+{
+ /* Set the location information on the node if it is a real expression.
+ References can be reused for multiple GNAT nodes and they would get
+ the location information of their last use. Also make sure not to
+ overwrite an existing location as it is probably more precise. */
+
+ switch (TREE_CODE (node))
+ {
+ CASE_CONVERT:
+ case NON_LVALUE_EXPR:
+ break;
+
+ case COMPOUND_EXPR:
+ if (EXPR_P (TREE_OPERAND (node, 1)))
+ set_gnu_expr_location_from_node (TREE_OPERAND (node, 1), gnat_node);
+
+ /* ... fall through ... */
+
+ default:
+ if (!REFERENCE_CLASS_P (node) && !EXPR_HAS_LOCATION (node))
+ set_expr_location_from_node (node, gnat_node);
+ break;
+ }
+}
/* Return a colon-separated list of encodings contained in encoded Ada
name. */
@@ -7498,7 +7507,7 @@ set_expr_location_from_node (tree node, Node_Id gnat_node)
static const char *
extract_encoding (const char *name)
{
- char *encoding = GGC_NEWVEC (char, strlen (name));
+ char *encoding = (char *) ggc_alloc_atomic (strlen (name));
get_encoding (name, encoding);
return encoding;
}
@@ -7508,7 +7517,7 @@ extract_encoding (const char *name)
static const char *
decode_name (const char *name)
{
- char *decoded = GGC_NEWVEC (char, strlen (name) * 2 + 60);
+ char *decoded = (char *) ggc_alloc_atomic (strlen (name) * 2 + 60);
__gnat_decode (name, decoded, 0);
return decoded;
}
@@ -7641,11 +7650,11 @@ tree
get_exception_label (char kind)
{
if (kind == N_Raise_Constraint_Error)
- return TREE_VALUE (gnu_constraint_error_label_stack);
+ return VEC_last (tree, gnu_constraint_error_label_stack);
else if (kind == N_Raise_Storage_Error)
- return TREE_VALUE (gnu_storage_error_label_stack);
+ return VEC_last (tree, gnu_storage_error_label_stack);
else if (kind == N_Raise_Program_Error)
- return TREE_VALUE (gnu_program_error_label_stack);
+ return VEC_last (tree, gnu_program_error_label_stack);
else
return NULL_TREE;
}
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index f10b788fe1a..c5d612da91b 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -206,8 +206,7 @@ static void process_attributes (tree, struct attrib *);
void
init_gnat_to_gnu (void)
{
- associate_gnat_to_gnu
- = (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree));
+ associate_gnat_to_gnu = ggc_alloc_cleared_vec_tree (max_gnat_nodes);
}
/* GNAT_ENTITY is a GNAT tree node for an entity. GNU_DECL is the GCC tree
@@ -257,8 +256,7 @@ present_gnu_tree (Entity_Id gnat_entity)
void
init_dummy_type (void)
{
- dummy_node_table
- = (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree));
+ dummy_node_table = ggc_alloc_cleared_vec_tree (max_gnat_nodes);
}
/* Make a dummy type corresponding to GNAT_TYPE. */
@@ -321,9 +319,7 @@ gnat_pushlevel (void)
free_binding_level = free_binding_level->chain;
}
else
- newlevel
- = (struct gnat_binding_level *)
- ggc_alloc (sizeof (struct gnat_binding_level));
+ newlevel = ggc_alloc_gnat_binding_level ();
/* Use a free BLOCK, if any; otherwise, allocate one. */
if (free_block_chain)
@@ -2226,7 +2222,7 @@ max_size (tree exp, bool max_p)
tree
build_template (tree template_type, tree array_type, tree expr)
{
- tree template_elts = NULL_TREE;
+ VEC(constructor_elt,gc) *template_elts = NULL;
tree bound_list = NULL_TREE;
tree field;
@@ -2275,11 +2271,11 @@ build_template (tree template_type, tree array_type, tree expr)
min = SUBSTITUTE_PLACEHOLDER_IN_EXPR (min, expr);
max = SUBSTITUTE_PLACEHOLDER_IN_EXPR (max, expr);
- template_elts = tree_cons (TREE_CHAIN (field), max,
- tree_cons (field, min, template_elts));
+ CONSTRUCTOR_APPEND_ELT (template_elts, field, min);
+ CONSTRUCTOR_APPEND_ELT (template_elts, TREE_CHAIN (field), max);
}
- return gnat_build_constructor (template_type, nreverse (template_elts));
+ return gnat_build_constructor (template_type, template_elts);
}
/* Build a 32-bit VMS descriptor from a Mechanism_Type, which must specify a
@@ -2954,6 +2950,7 @@ convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
/* See the head comment of build_vms_descriptor. */
int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass));
tree lfield, ufield;
+ VEC(constructor_elt,gc) *v;
/* Convert POINTER to the pointer-to-array type. */
gnu_expr64 = convert (p_array_type, gnu_expr64);
@@ -2963,14 +2960,15 @@ convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
case 1: /* Class S */
case 15: /* Class SB */
/* Build {1, LENGTH} template; LENGTH64 is the 5th field. */
+ v = VEC_alloc (constructor_elt, gc, 2);
t = TREE_CHAIN (TREE_CHAIN (klass));
t = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
- t = tree_cons (min_field,
- convert (TREE_TYPE (min_field), integer_one_node),
- tree_cons (max_field,
- convert (TREE_TYPE (max_field), t),
- NULL_TREE));
- template_tree = gnat_build_constructor (template_type, t);
+ CONSTRUCTOR_APPEND_ELT (v, min_field,
+ convert (TREE_TYPE (min_field),
+ integer_one_node));
+ CONSTRUCTOR_APPEND_ELT (v, max_field,
+ convert (TREE_TYPE (max_field), t));
+ template_tree = gnat_build_constructor (template_type, v);
template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template_tree);
/* For class S, we are done. */
@@ -2994,10 +2992,11 @@ convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
(TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (template_type))), ufield);
/* Build the template in the form of a constructor. */
- t = tree_cons (TYPE_FIELDS (template_type), lfield,
- tree_cons (TREE_CHAIN (TYPE_FIELDS (template_type)),
- ufield, NULL_TREE));
- template_tree = gnat_build_constructor (template_type, t);
+ v = VEC_alloc (constructor_elt, gc, 2);
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (template_type), lfield);
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (template_type)),
+ ufield);
+ template_tree = gnat_build_constructor (template_type, v);
/* Otherwise use the {1, LENGTH} template we build above. */
template_addr = build3 (COND_EXPR, p_bounds_type, u,
@@ -3041,10 +3040,11 @@ convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
(TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (template_type))), ufield);
/* Build the template in the form of a constructor. */
- t = tree_cons (TYPE_FIELDS (template_type), lfield,
- tree_cons (TREE_CHAIN (TYPE_FIELDS (template_type)),
- ufield, NULL_TREE));
- template_tree = gnat_build_constructor (template_type, t);
+ v = VEC_alloc (constructor_elt, gc, 2);
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (template_type), lfield);
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (template_type)),
+ ufield);
+ template_tree = gnat_build_constructor (template_type, v);
template_tree = build3 (COND_EXPR, template_type, u,
build_call_raise (CE_Length_Check_Failed, Empty,
N_Raise_Constraint_Error),
@@ -3061,10 +3061,11 @@ convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
}
/* Build the fat pointer in the form of a constructor. */
- t = tree_cons (TYPE_FIELDS (gnu_type), gnu_expr64,
- tree_cons (TREE_CHAIN (TYPE_FIELDS (gnu_type)),
- template_addr, NULL_TREE));
- return gnat_build_constructor (gnu_type, t);
+ v = VEC_alloc (constructor_elt, gc, 2);
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (gnu_type), gnu_expr64);
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (gnu_type)),
+ template_addr);
+ return gnat_build_constructor (gnu_type, v);
}
else
@@ -3102,6 +3103,7 @@ convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
tree template_tree, template_addr, aflags, dimct, t, u;
/* See the head comment of build_vms_descriptor. */
int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass));
+ VEC(constructor_elt,gc) *v;
/* Convert POINTER to the pointer-to-array type. */
gnu_expr32 = convert (p_array_type, gnu_expr32);
@@ -3111,14 +3113,15 @@ convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
case 1: /* Class S */
case 15: /* Class SB */
/* Build {1, LENGTH} template; LENGTH is the 1st field. */
+ v = VEC_alloc (constructor_elt, gc, 2);
t = TYPE_FIELDS (desc_type);
t = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE);
- t = tree_cons (min_field,
- convert (TREE_TYPE (min_field), integer_one_node),
- tree_cons (max_field,
- convert (TREE_TYPE (max_field), t),
- NULL_TREE));
- template_tree = gnat_build_constructor (template_type, t);
+ CONSTRUCTOR_APPEND_ELT (v, min_field,
+ convert (TREE_TYPE (min_field),
+ integer_one_node));
+ CONSTRUCTOR_APPEND_ELT (v, max_field,
+ convert (TREE_TYPE (max_field), t));
+ template_tree = gnat_build_constructor (template_type, v);
template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template_tree);
/* For class S, we are done. */
@@ -3182,11 +3185,12 @@ convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
}
/* Build the fat pointer in the form of a constructor. */
- t = tree_cons (TYPE_FIELDS (gnu_type), gnu_expr32,
- tree_cons (TREE_CHAIN (TYPE_FIELDS (gnu_type)),
- template_addr, NULL_TREE));
+ v = VEC_alloc (constructor_elt, gc, 2);
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (gnu_type), gnu_expr32);
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (gnu_type)),
+ template_addr);
- return gnat_build_constructor (gnu_type, t);
+ return gnat_build_constructor (gnu_type, v);
}
else
@@ -3465,7 +3469,7 @@ update_pointer_to (tree old_type, tree new_type)
{
tree new_ptr = TYPE_MAIN_VARIANT (TYPE_POINTER_TO (new_type));
tree new_obj_rec = TYPE_OBJECT_RECORD_TYPE (new_type);
- tree array_field, bounds_field, new_ref, last;
+ tree array_field, bounds_field, new_ref, last = NULL_TREE;
gcc_assert (TYPE_IS_FAT_POINTER_P (ptr));
@@ -3555,19 +3559,19 @@ convert_to_fat_pointer (tree type, tree expr)
tree p_array_type = TREE_TYPE (TYPE_FIELDS (type));
tree etype = TREE_TYPE (expr);
tree template_tree;
+ VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2);
/* If EXPR is null, make a fat pointer that contains null pointers to the
template and array. */
if (integer_zerop (expr))
- return
- gnat_build_constructor
- (type,
- tree_cons (TYPE_FIELDS (type),
- convert (p_array_type, expr),
- tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
- convert (build_pointer_type (template_type),
- expr),
- NULL_TREE)));
+ {
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type),
+ convert (p_array_type, expr));
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (type)),
+ convert (build_pointer_type (template_type),
+ expr));
+ return gnat_build_constructor (type, v);
+ }
/* If EXPR is a thin pointer, make template and data from the record.. */
else if (TYPE_IS_THIN_POINTER_P (etype))
@@ -3602,15 +3606,12 @@ convert_to_fat_pointer (tree type, tree expr)
Note that the call to "build_template" above is still fine because it
will only refer to the provided TEMPLATE_TYPE in this case. */
- return
- gnat_build_constructor
- (type,
- tree_cons (TYPE_FIELDS (type),
- convert (p_array_type, expr),
- tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
- build_unary_op (ADDR_EXPR, NULL_TREE,
- template_tree),
- NULL_TREE)));
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type),
+ convert (p_array_type, expr));
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (type)),
+ build_unary_op (ADDR_EXPR, NULL_TREE,
+ template_tree));
+ return gnat_build_constructor (type, v);
}
/* Convert to a thin pointer type, TYPE. The only thing we know how to convert
@@ -3667,6 +3668,8 @@ convert (tree type, tree expr)
constructor to build the record, unless a variable size is involved. */
else if (code == RECORD_TYPE && TYPE_PADDING_P (type))
{
+ VEC(constructor_elt,gc) *v;
+
/* If we previously converted from another type and our type is
of variable size, remove the conversion to avoid the need for
variable-sized temporaries. Likewise for a conversion between
@@ -3717,13 +3720,10 @@ convert (tree type, tree expr)
expr),
false);
- return
- gnat_build_constructor (type,
- tree_cons (TYPE_FIELDS (type),
- convert (TREE_TYPE
- (TYPE_FIELDS (type)),
- expr),
- NULL_TREE));
+ v = VEC_alloc (constructor_elt, gc, 1);
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type),
+ convert (TREE_TYPE (TYPE_FIELDS (type)), expr));
+ return gnat_build_constructor (type, v);
}
/* If the input type has padding, remove it and convert to the output type.
@@ -3775,20 +3775,19 @@ convert (tree type, tree expr)
if (code == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (type))
{
tree obj_type = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (type)));
+ VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2);
/* If the source already has a template, get a reference to the
associated array only, as we are going to rebuild a template
for the target type anyway. */
expr = maybe_unconstrained_array (expr);
- return
- gnat_build_constructor
- (type,
- tree_cons (TYPE_FIELDS (type),
- build_template (TREE_TYPE (TYPE_FIELDS (type)),
- obj_type, NULL_TREE),
- tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
- convert (obj_type, expr), NULL_TREE)));
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type),
+ build_template (TREE_TYPE (TYPE_FIELDS (type)),
+ obj_type, NULL_TREE));
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (type)),
+ convert (obj_type, expr));
+ return gnat_build_constructor (type, v);
}
/* There are some special cases of expressions that we process
@@ -4118,11 +4117,14 @@ convert (tree type, tree expr)
case RECORD_TYPE:
if (TYPE_JUSTIFIED_MODULAR_P (type) && !AGGREGATE_TYPE_P (etype))
- return
- gnat_build_constructor
- (type, tree_cons (TYPE_FIELDS (type),
- convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
- NULL_TREE));
+ {
+ VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 1);
+
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type),
+ convert (TREE_TYPE (TYPE_FIELDS (type)),
+ expr));
+ return gnat_build_constructor (type, v);
+ }
/* ... fall through ... */
@@ -4414,11 +4416,13 @@ unchecked_convert (tree type, tree expr, bool notrunc_p)
tree rec_type = make_node (RECORD_TYPE);
tree field = create_field_decl (get_identifier ("OBJ"), etype, rec_type,
NULL_TREE, NULL_TREE, 1, 0);
+ VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 1);
TYPE_FIELDS (rec_type) = field;
layout_type (rec_type);
- expr = gnat_build_constructor (rec_type, build_tree_list (field, expr));
+ CONSTRUCTOR_APPEND_ELT (v, field, expr);
+ expr = gnat_build_constructor (rec_type, v);
expr = unchecked_convert (type, expr, notrunc_p);
}
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 1c224a3ef07..ab3814ec4e0 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -1521,34 +1521,31 @@ build_call_raise (int msg, Node_Id gnat_node, char kind)
static int
compare_elmt_bitpos (const PTR rt1, const PTR rt2)
{
- const_tree const elmt1 = * (const_tree const *) rt1;
- const_tree const elmt2 = * (const_tree const *) rt2;
- const_tree const field1 = TREE_PURPOSE (elmt1);
- const_tree const field2 = TREE_PURPOSE (elmt2);
+ const constructor_elt * const elmt1 = (const constructor_elt const *) rt1;
+ const constructor_elt * const elmt2 = (const constructor_elt const *) rt2;
+ const_tree const field1 = elmt1->index;
+ const_tree const field2 = elmt2->index;
const int ret
= tree_int_cst_compare (bit_position (field1), bit_position (field2));
return ret ? ret : (int) (DECL_UID (field1) - DECL_UID (field2));
}
-/* Return a CONSTRUCTOR of TYPE whose list is LIST. */
+/* Return a CONSTRUCTOR of TYPE whose elements are V. */
tree
-gnat_build_constructor (tree type, tree list)
+gnat_build_constructor (tree type, VEC(constructor_elt,gc) *v)
{
bool allconstant = (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST);
bool side_effects = false;
- tree elmt, result;
- int n_elmts;
+ tree result, obj, val;
+ unsigned int n_elmts;
/* Scan the elements to see if they are all constant or if any has side
effects, to let us set global flags on the resulting constructor. Count
the elements along the way for possible sorting purposes below. */
- for (n_elmts = 0, elmt = list; elmt; elmt = TREE_CHAIN (elmt), n_elmts ++)
+ FOR_EACH_CONSTRUCTOR_ELT (v, n_elmts, obj, val)
{
- tree obj = TREE_PURPOSE (elmt);
- tree val = TREE_VALUE (elmt);
-
/* The predicate must be in keeping with output_constructor. */
if (!TREE_CONSTANT (val)
|| (TREE_CODE (type) == RECORD_TYPE
@@ -1565,27 +1562,10 @@ gnat_build_constructor (tree type, tree list)
by increasing bit position. This is necessary to ensure the
constructor can be output as static data. */
if (allconstant && TREE_CODE (type) == RECORD_TYPE && n_elmts > 1)
- {
- /* Fill an array with an element tree per index, and ask qsort to order
- them according to what a bitpos comparison function says. */
- tree *gnu_arr = (tree *) alloca (sizeof (tree) * n_elmts);
- int i;
-
- for (i = 0, elmt = list; elmt; elmt = TREE_CHAIN (elmt), i++)
- gnu_arr[i] = elmt;
+ qsort (VEC_address (constructor_elt, v), n_elmts,
+ sizeof (constructor_elt), compare_elmt_bitpos);
- qsort (gnu_arr, n_elmts, sizeof (tree), compare_elmt_bitpos);
-
- /* Then reconstruct the list from the sorted array contents. */
- list = NULL_TREE;
- for (i = n_elmts - 1; i >= 0; i--)
- {
- TREE_CHAIN (gnu_arr[i]) = list;
- list = gnu_arr[i];
- }
- }
-
- result = build_constructor_from_list (type, list);
+ result = build_constructor (type, v);
TREE_CONSTANT (result) = TREE_STATIC (result) = allconstant;
TREE_SIDE_EFFECTS (result) = side_effects;
TREE_READONLY (result) = TYPE_READONLY (type) || allconstant;
@@ -1823,13 +1803,12 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node)
tree malloc_ptr;
- /* On VMS, if 64-bit memory is disabled or pointers are 64-bit and the
- allocator size is 32-bit or Convention C, allocate 32-bit memory. */
+ /* On VMS, if pointers are 64-bit and the allocator size is 32-bit or
+ Convention C, allocate 32-bit memory. */
if (TARGET_ABI_OPEN_VMS
- && (!TARGET_MALLOC64
- || (POINTER_SIZE == 64
- && (UI_To_Int (Esize (Etype (gnat_node))) == 32
- || Convention (Etype (gnat_node)) == Convention_C))))
+ && (POINTER_SIZE == 64
+ && (UI_To_Int (Esize (Etype (gnat_node))) == 32
+ || Convention (Etype (gnat_node)) == Convention_C)))
malloc_ptr = build_call_1_expr (malloc32_decl, size_to_malloc);
else
malloc_ptr = build_call_1_expr (malloc_decl, size_to_malloc);
@@ -1987,7 +1966,6 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
tree template_type = TREE_TYPE (TYPE_FIELDS (storage_type));
tree storage_ptr_type = build_pointer_type (storage_type);
tree storage;
- tree template_cons = NULL_TREE;
size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_SIZE_UNIT (storage_type),
init);
@@ -2014,12 +1992,12 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
bounds. */
if (init)
{
- template_cons = tree_cons (TREE_CHAIN (TYPE_FIELDS (storage_type)),
- init, NULL_TREE);
- template_cons = tree_cons (TYPE_FIELDS (storage_type),
- build_template (template_type, type,
- init),
- template_cons);
+ VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2);
+
+ CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (storage_type),
+ build_template (template_type, type, init));
+ CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (storage_type)),
+ init);
return convert
(result_type,
@@ -2028,7 +2006,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
(MODIFY_EXPR, storage_type,
build_unary_op (INDIRECT_REF, NULL_TREE,
convert (storage_ptr_type, storage)),
- gnat_build_constructor (storage_type, template_cons)),
+ gnat_build_constructor (storage_type, v)),
convert (storage_ptr_type, storage)));
}
else
@@ -2101,10 +2079,11 @@ fill_vms_descriptor (tree expr, Entity_Id gnat_formal, Node_Id gnat_actual)
{
tree parm_decl = get_gnu_tree (gnat_formal);
tree record_type = TREE_TYPE (TREE_TYPE (parm_decl));
- tree const_list = NULL_TREE, field;
+ tree field;
const bool do_range_check
= strcmp ("MBO",
IDENTIFIER_POINTER (DECL_NAME (TYPE_FIELDS (record_type))));
+ VEC(constructor_elt,gc) *v = NULL;
expr = maybe_unconstrained_array (expr);
gnat_mark_addressable (expr);
@@ -2136,10 +2115,10 @@ fill_vms_descriptor (tree expr, Entity_Id gnat_formal, Node_Id gnat_actual)
N_Raise_Constraint_Error),
NULL_TREE));
}
- const_list = tree_cons (field, conexpr, const_list);
+ CONSTRUCTOR_APPEND_ELT (v, field, conexpr);
}
- return gnat_build_constructor (record_type, nreverse (const_list));
+ return gnat_build_constructor (record_type, v);
}
/* Indicate that we need to take the address of T and that it therefore
diff --git a/gcc/ada/get_scos.adb b/gcc/ada/get_scos.adb
index da63f90e307..70d77c80b6a 100644
--- a/gcc/ada/get_scos.adb
+++ b/gcc/ada/get_scos.adb
@@ -54,7 +54,12 @@ procedure Get_SCOs is
-- value read. Data_Error is raised for overflow (value greater than
-- Int'Last), or if the initial character is not a digit.
- procedure Get_Sloc_Range (Loc1, Loc2 : out Source_Location);
+ procedure Get_Source_Location (Loc : out Source_Location);
+ -- Reads a source location in the form line:col and places the source
+ -- location in Loc. Raises Data_Error if the format does not match this
+ -- requirement. Note that initial spaces are not skipped.
+
+ procedure Get_Source_Location_Range (Loc1, Loc2 : out Source_Location);
-- Skips initial spaces, then reads a source location range in the form
-- line:col-line:col and places the two source locations in Loc1 and Loc2.
-- Raises Data_Error if format does not match this requirement.
@@ -129,31 +134,32 @@ procedure Get_SCOs is
raise Data_Error;
end Get_Int;
- --------------------
- -- Get_Sloc_Range --
- --------------------
+ -------------------------
+ -- Get_Source_Location --
+ -------------------------
- procedure Get_Sloc_Range (Loc1, Loc2 : out Source_Location) is
+ procedure Get_Source_Location (Loc : out Source_Location) is
pragma Unsuppress (Range_Check);
-
begin
- Skip_Spaces;
-
- Loc1.Line := Logical_Line_Number (Get_Int);
- Check (':');
- Loc1.Col := Column_Number (Get_Int);
-
- Check ('-');
-
- Loc2.Line := Logical_Line_Number (Get_Int);
+ Loc.Line := Logical_Line_Number (Get_Int);
Check (':');
- Loc2.Col := Column_Number (Get_Int);
-
+ Loc.Col := Column_Number (Get_Int);
exception
when Constraint_Error =>
raise Data_Error;
- end Get_Sloc_Range;
+ end Get_Source_Location;
+
+ -------------------------------
+ -- Get_Source_Location_Range --
+ -------------------------------
+ procedure Get_Source_Location_Range (Loc1, Loc2 : out Source_Location) is
+ begin
+ Skip_Spaces;
+ Get_Source_Location (Loc1);
+ Check ('-');
+ Get_Source_Location (Loc2);
+ end Get_Source_Location_Range;
--------------
-- Skip_EOL --
--------------
@@ -222,8 +228,8 @@ begin
-- Scan out dependency number and file name
declare
- Ptr : String_Ptr := new String (1 .. 32768);
- N : Integer;
+ Ptr : String_Ptr := new String (1 .. 32768);
+ N : Integer;
begin
Skip_Spaces;
@@ -250,14 +256,31 @@ begin
-- Statement entry
- when 'S' =>
+ when 'S' | 's' =>
declare
Typ : Character;
Key : Character;
begin
+ -- If continuation, reset Last indication in last entry
+ -- stored for previous CS or cs line, and start with key
+ -- set to s for continuations.
+
+ if C = 's' then
+ SCO_Table.Table (SCO_Table.Last).Last := False;
+ Key := 's';
+
+ -- CS case (first line, so start with key set to S)
+
+ else
+ Key := 'S';
+ end if;
+
+ -- Initialize to scan items on one line
+
Skip_Spaces;
- Key := 'S';
+
+ -- Loop through items on one line
loop
Typ := Nextc;
@@ -268,7 +291,7 @@ begin
Skipc;
end if;
- Get_Sloc_Range (Loc1, Loc2);
+ Get_Source_Location_Range (Loc1, Loc2);
Add_SCO
(C1 => Key,
@@ -287,60 +310,81 @@ begin
when 'I' | 'E' | 'P' | 'W' | 'X' =>
Dtyp := C;
Skip_Spaces;
- C := Getc;
- -- Case of simple condition
+ -- Output header
+
+ declare
+ Loc : Source_Location;
+ C2v : Character;
+
+ begin
+ -- Acquire location information
+
+ if Dtyp = 'X' then
+ Loc := No_Source_Location;
+ else
+ Get_Source_Location (Loc);
+ end if;
+
+ -- C2 is a space except for pragmas where it is 'e' since
+ -- clearly the pragma is enabled if it was written out.
+
+ if C = 'P' then
+ C2v := 'e';
+ else
+ C2v := ' ';
+ end if;
- if C = 'c' or else C = 't' or else C = 'f' then
- Cond := C;
- Get_Sloc_Range (Loc1, Loc2);
Add_SCO
(C1 => Dtyp,
- C2 => Cond,
- From => Loc1,
- To => Loc2,
- Last => True);
+ C2 => C2v,
+ From => Loc,
+ To => No_Source_Location,
+ Last => False);
+ end;
- -- Complex expression
+ -- Loop through terms in complex expression
- else
- Add_SCO (C1 => Dtyp, Last => False);
+ C := Nextc;
+ while C /= CR and then C /= LF loop
+ if C = 'c' or else C = 't' or else C = 'f' then
+ Cond := C;
+ Skipc;
+ Get_Source_Location_Range (Loc1, Loc2);
+ Add_SCO
+ (C2 => Cond,
+ From => Loc1,
+ To => Loc2,
+ Last => False);
- -- Loop through terms in complex expression
+ elsif C = '!' or else
+ C = '&' or else
+ C = '|'
+ then
+ Skipc;
- while C /= CR and then C /= LF loop
- if C = 'c' or else C = 't' or else C = 'f' then
- Cond := C;
- Skipc;
- Get_Sloc_Range (Loc1, Loc2);
- Add_SCO
- (C2 => Cond,
- From => Loc1,
- To => Loc2,
- Last => False);
-
- elsif C = '!' or else
- C = '^' or else
- C = '&' or else
- C = '|'
- then
- Skipc;
- Add_SCO (C1 => C, Last => False);
+ declare
+ Loc : Source_Location;
+ begin
+ Get_Source_Location (Loc);
+ Add_SCO (C1 => C, From => Loc, Last => False);
+ end;
- elsif C = ' ' then
- Skip_Spaces;
+ elsif C = ' ' then
+ Skip_Spaces;
- else
- raise Data_Error;
- end if;
+ else
+ raise Data_Error;
+ end if;
- C := Nextc;
- end loop;
+ C := Nextc;
+ end loop;
- -- Reset Last indication to True for last entry
+ -- Reset Last indication to True for last entry
- SCO_Table.Table (SCO_Table.Last).Last := True;
- end if;
+ SCO_Table.Table (SCO_Table.Last).Last := True;
+
+ -- No other SCO lines are possible
when others =>
raise Data_Error;
diff --git a/gcc/ada/gnat-style.texi b/gcc/ada/gnat-style.texi
index 37395c722ff..1e2f365f351 100644
--- a/gcc/ada/gnat-style.texi
+++ b/gcc/ada/gnat-style.texi
@@ -17,7 +17,7 @@
Copyright @copyright{} 1992-2008, Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts and with no Back-Cover
Texts. A copy of the license is included in the section entitled
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 79824868be5..d3d15ccc3b1 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -30,6 +30,7 @@ with Csets; use Csets;
with Debug; use Debug;
with Elists;
with Errout; use Errout;
+with Exp_CG;
with Fmap;
with Fname; use Fname;
with Fname.UF; use Fname.UF;
@@ -49,6 +50,7 @@ with Par_SCO;
with Prepcomp;
with Repinfo; use Repinfo;
with Restrict;
+with Rident; use Rident;
with Rtsfind;
with SCOs;
with Sem;
@@ -168,12 +170,14 @@ procedure Gnat1drv is
Optimization_Level := 0;
- -- Disable specific expansions for Restrictions pragmas to avoid
- -- tree inconsistencies between compilations with different pragmas
- -- that will cause different SCIL files to be generated for the
- -- same Ada spec.
+ -- Enable some restrictions systematically to simplify the generated
+ -- code (and ease analysis). Note that restriction checks are also
+ -- disabled in CodePeer_Mode, see Restrict.Check_Restriction
- Treat_Restrictions_As_Warnings := True;
+ Restrict.Restrictions.Set (No_Task_Hierarchy) := True;
+ Restrict.Restrictions.Set (No_Abort_Statements) := True;
+ Restrict.Restrictions.Set (Max_Asynchronous_Select_Nesting) := True;
+ Restrict.Restrictions.Value (Max_Asynchronous_Select_Nesting) := 0;
-- Suppress overflow, division by zero and access checks since they
-- are handled implicitly by CodePeer.
@@ -332,6 +336,53 @@ procedure Gnat1drv is
else
Suppress_Options (Overflow_Check) := True;
end if;
+
+ -- Set switch indicating if we can use N_Expression_With_Actions
+
+ -- Debug flag -gnatd.X decisively sets usage on
+
+ if Debug_Flag_Dot_XX then
+ Use_Expression_With_Actions := True;
+
+ -- Debug flag -gnatd.Y decisively sets usage off
+
+ elsif Debug_Flag_Dot_YY then
+ Use_Expression_With_Actions := False;
+
+ -- If no debug flags, usage off for SCIL
+
+ elsif Generate_SCIL then
+ Use_Expression_With_Actions := False;
+
+ -- Otherwise this feature is implemented, so we allow its use
+
+ else
+ Use_Expression_With_Actions := True;
+ end if;
+
+ -- Set switch indicating if back end can handle limited types, and
+ -- guarantee that no incorrect copies are made (e.g. in the context
+ -- of a conditional expression).
+
+ -- Debug flag -gnatd.L decisively sets usage on
+
+ if Debug_Flag_Dot_LL then
+ Back_End_Handles_Limited_Types := True;
+
+ -- If no debug flag, usage off for AAMP, VM, SCIL cases
+
+ elsif AAMP_On_Target
+ or else VM_Target /= No_VM
+ or else Generate_SCIL
+ then
+ Back_End_Handles_Limited_Types := False;
+
+ -- Otherwise normal gcc back end, for now still turn flag off by
+ -- default, since there are unresolved problems in the front end.
+
+ else
+ Back_End_Handles_Limited_Types := False;
+ end if;
end Adjust_Global_Switches;
--------------------
@@ -549,6 +600,7 @@ begin
Nlists.Initialize;
Sinput.Initialize;
Sem.Initialize;
+ Exp_CG.Initialize;
Csets.Initialize;
Uintp.Initialize;
Urealp.Initialize;
@@ -812,42 +864,28 @@ begin
if Subunits_Missing then
Write_Str (" (missing subunits)");
Write_Eol;
- Write_Str ("to check parent unit");
elsif Main_Kind = N_Subunit then
Write_Str (" (subunit)");
Write_Eol;
- Write_Str ("to check subunit");
elsif Main_Kind = N_Subprogram_Declaration then
Write_Str (" (subprogram spec)");
Write_Eol;
- Write_Str ("to check subprogram spec");
-- Generic package body in GNAT implementation mode
elsif Main_Kind = N_Package_Body and then GNAT_Mode then
Write_Str (" (predefined generic)");
Write_Eol;
- Write_Str ("to check predefined generic");
-- Only other case is a package spec
else
Write_Str (" (package spec)");
Write_Eol;
- Write_Str ("to check package spec");
end if;
- Write_Str (" for errors, use ");
-
- if Hostparm.OpenVMS then
- Write_Str ("/NOLOAD");
- else
- Write_Str ("-gnatc");
- end if;
-
- Write_Eol;
Set_Standard_Output;
Sem_Ch13.Validate_Unchecked_Conversions;
@@ -938,6 +976,10 @@ begin
Namet.Unlock;
+ -- Generate the call-graph output of dispatching calls
+
+ Exp_CG.Generate_CG_Output;
+
-- Validate unchecked conversions (using the values for size and
-- alignment annotated by the backend where possible).
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 84a95a7e9ab..e4a39e1671b 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -18,7 +18,7 @@
Copyright @copyright{} 1995-2008, Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover Texts being ``GNAT Reference
Manual'', and with no Back-Cover Texts. A copy of the license is
@@ -81,7 +81,6 @@ AdaCore
* Interfacing to Other Languages::
* Specialized Needs Annexes::
* Implementation of Specific Ada Features::
-* Project File Reference::
* Obsolescent Features::
* GNU Free Documentation License::
* Index::
@@ -100,6 +99,8 @@ Implementation Defined Pragmas
* Pragma Ada_95::
* Pragma Ada_05::
* Pragma Ada_2005::
+* Pragma Ada_12::
+* Pragma Ada_2012::
* Pragma Annotate::
* Pragma Assert::
* Pragma Assume_No_Invalid_Values::
@@ -133,6 +134,7 @@ Implementation Defined Pragmas
* Pragma Export_Value::
* Pragma Export_Valued_Procedure::
* Pragma Extend_System::
+* Pragma Extensions_Allowed::
* Pragma External::
* Pragma External_Name_Casing::
* Pragma Fast_Math::
@@ -364,6 +366,8 @@ The GNAT Library
* GNAT.IO (g-io.ads)::
* GNAT.IO_Aux (g-io_aux.ads)::
* GNAT.Lock_Files (g-locfil.ads)::
+* GNAT.MBBS_Discrete_Random (g-mbdira.ads)::
+* GNAT.MBBS_Float_Random (g-mbflra.ads)::
* GNAT.MD5 (g-md5.ads)::
* GNAT.Memory_Dump (g-memdum.ads)::
* GNAT.Most_Recent_Exception (g-moreex.ads)::
@@ -463,8 +467,6 @@ Implementation of Specific Ada Features
* The Size of Discriminated Records with Default Discriminants::
* Strict Conformance to the Ada Reference Manual::
-Project File Reference
-
Obsolescent Features
GNU Free Documentation License
@@ -582,10 +584,6 @@ to GNAT's implementation of machine code insertions, tasking, and several
other features.
@item
-@ref{Project File Reference}, presents the syntax and semantics
-of project files.
-
-@item
@ref{Obsolescent Features} documents implementation dependent features,
including pragmas and attributes, which are considered obsolescent, since
there are other preferred ways of achieving the same results. These
@@ -717,6 +715,8 @@ consideration, the use of these pragmas should be minimized.
* Pragma Ada_95::
* Pragma Ada_05::
* Pragma Ada_2005::
+* Pragma Ada_12::
+* Pragma Ada_2012::
* Pragma Annotate::
* Pragma Assert::
* Pragma Assume_No_Invalid_Values::
@@ -750,6 +750,7 @@ consideration, the use of these pragmas should be minimized.
* Pragma Export_Value::
* Pragma Export_Valued_Procedure::
* Pragma Extend_System::
+* Pragma Extensions_Allowed::
* Pragma External::
* Pragma External_Name_Casing::
* Pragma Fast_Math::
@@ -908,9 +909,7 @@ pragma Ada_05;
@noindent
A configuration pragma that establishes Ada 2005 mode for the unit to which
it applies, regardless of the mode set by the command line switches.
-This mode is set automatically for the @code{Ada} and @code{System}
-packages and their children, so you need not specify it in these
-contexts. This pragma is useful when writing a reusable component that
+This pragma is useful when writing a reusable component that
itself uses Ada 2005 features, but which is intended to be usable from
either Ada 83 or Ada 95 programs.
@@ -927,6 +926,37 @@ pragma Ada_2005;
This configuration pragma is a synonym for pragma Ada_05 and has the
same syntax and effect.
+@node Pragma Ada_12
+@unnumberedsec Pragma Ada_12
+@findex Ada_12
+@noindent
+Syntax:
+@smallexample @c ada
+pragma Ada_12;
+@end smallexample
+
+@noindent
+A configuration pragma that establishes Ada 2012 mode for the unit to which
+it applies, regardless of the mode set by the command line switches.
+This mode is set automatically for the @code{Ada} and @code{System}
+packages and their children, so you need not specify it in these
+contexts. This pragma is useful when writing a reusable component that
+itself uses Ada 2012 features, but which is intended to be usable from
+Ada 83, Ada 95, or Ada 2005 programs.
+
+@node Pragma Ada_2012
+@unnumberedsec Pragma Ada_2012
+@findex Ada_2005
+@noindent
+Syntax:
+@smallexample @c ada
+pragma Ada_2012;
+@end smallexample
+
+@noindent
+This configuration pragma is a synonym for pragma Ada_12 and has the
+same syntax and effect.
+
@node Pragma Annotate
@unnumberedsec Pragma Annotate
@findex Annotate
@@ -2179,6 +2209,35 @@ it you will have to use the appropriate switch for compiling
system units. @xref{Top, @value{EDITION} User's Guide, About This
Guide,, gnat_ugn, @value{EDITION} User's Guide}, for details.
+@node Pragma Extensions_Allowed
+@unnumberedsec Pragma Extensions_Allowed
+@cindex Ada Extensions
+@cindex GNAT Extensions
+@findex Extensions_Allowed
+@noindent
+Syntax:
+
+@smallexample @c ada
+pragma Extensions_Allowed (On | Off);
+@end smallexample
+
+@noindent
+This configuration pragma enables or disables the implementation
+extension mode (the use of Off as a parameter cancels the effect
+of the @option{-gnatX} command switch).
+
+In extension mode, the latest version of the Ada language is
+implemented (currently Ada 2012), and in addition a small number
+of GNAT specific extensions are recognized as follows:
+
+@table @asis
+@item Constrained attribute for generic objects
+The @code{Constrained} attribute is permitted for objects of
+generic types. The result indicates if the corresponding actual
+is constrained.
+
+@end table
+
@node Pragma External
@unnumberedsec Pragma External
@findex External
@@ -2856,7 +2915,12 @@ the standard Ada pragma @code{Import}. It is provided for compatibility
with Ada 83. The definition is upwards compatible both with pragma
@code{Interface} as defined in the Ada 83 Reference Manual, and also
with some extended implementations of this pragma in certain Ada 83
-implementations.
+implementations. The only difference between pragma @code{Interface}
+and pragma @code{Import} is that there is special circuitry to allow
+both pragmas to appear for the same subprogram entity (normally it
+is illegal to have multiple @code{Import} pragmas. This is useful in
+maintaining Ada 83/Ada 95 compatibility and is compatible with other
+Ada 83 compilers.
@node Pragma Interface_Name
@unnumberedsec Pragma Interface_Name
@@ -2923,7 +2987,7 @@ Ada exceptions, or used to implement run-time functions such as the
Pragma @code{Interrupt_State} provides a general mechanism for overriding
such uses of interrupts. It subsumes the functionality of pragma
@code{Unreserve_All_Interrupts}. Pragma @code{Interrupt_State} is not
-available on OS/2, Windows or VMS. On all other platforms than VxWorks,
+available on Windows or VMS. On all other platforms than VxWorks,
it applies to signals; on VxWorks, it applies to vectored hardware interrupts
and may be used to mark interrupts required by the board support package
as reserved.
@@ -3967,8 +4031,6 @@ inlining (-gnatN option set) are accepted and legality-checked
by the compiler, but are ignored at run-time even if postcondition
checking is enabled.
-
-
@node Pragma Profile (Ravenscar)
@unnumberedsec Pragma Profile (Ravenscar)
@findex Ravenscar
@@ -4533,7 +4595,11 @@ gcc -c -gnatyl @dots{}
The form ALL_CHECKS activates all standard checks (its use is equivalent
to the use of the @code{gnaty} switch with no options. @xref{Top,
@value{EDITION} User's Guide, About This Guide, gnat_ugn,
-@value{EDITION} User's Guide}, for details.
+@value{EDITION} User's Guide}, for details.)
+
+Note: the behavior is slightly different in GNAT mode (@option{-gnatg} used).
+In this case, ALL_CHECKS implies the standard set of GNAT mode style check
+options (i.e. equivalent to -gnatyg).
The forms with @code{Off} and @code{On}
can be used to temporarily disable style checks
@@ -5249,6 +5315,9 @@ used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
be useful in checking whether obsolete pragmas in existing programs are hiding
real problems.
+Note: pragma Warnings does not affect the processing of style messages. See
+separate entry for pragma Style_Checks for control of style messages.
+
@node Pragma Weak_External
@unnumberedsec Pragma Weak_External
@findex Weak_External
@@ -5946,7 +6015,7 @@ end record;
@end smallexample
@noindent
-will have a size of 40 (that is @code{Rec'Size} will be 40. The
+will have a size of 40 (that is @code{Rec'Size} will be 40). The
alignment will be 4, because of the
integer field, and so the default size of record objects for this type
will be 64 (8 bytes).
@@ -6575,7 +6644,6 @@ For example:
for Y'Address use X'Address;>>
@end smallexample
-
@sp 1
@cartouche
An implementation need not support a specification for the @code{Size}
@@ -8846,7 +8914,7 @@ floating-point.
@code{Numerics.Float_Random.Max_Image_Width}. See A.5.2(27).
@end cartouche
@noindent
-Maximum image width is 649, see library file @file{a-numran.ads}.
+Maximum image width is 6864, see library file @file{s-rannum.ads}.
@sp 1
@cartouche
@@ -8855,7 +8923,7 @@ Maximum image width is 649, see library file @file{a-numran.ads}.
@code{Numerics.Discrete_Random.Max_Image_Width}. See A.5.2(27).
@end cartouche
@noindent
-Maximum image width is 80, see library file @file{a-nudira.ads}.
+Maximum image width is 6864, see library file @file{s-rannum.ads}.
@sp 1
@cartouche
@@ -8864,8 +8932,9 @@ Maximum image width is 80, see library file @file{a-nudira.ads}.
A.5.2(32).
@end cartouche
@noindent
-The algorithm is documented in the source files @file{a-numran.ads} and
-@file{a-numran.adb}.
+The algorithm is the Mersenne Twister, as documented in the source file
+@file{s-rannum.adb}. This version of the algorithm has a period of
+2**19937-1.
@sp 1
@cartouche
@@ -8874,7 +8943,9 @@ The algorithm is documented in the source files @file{a-numran.ads} and
state. See A.5.2(38).
@end cartouche
@noindent
-See the documentation contained in the file @file{a-numran.adb}.
+The value returned by the Image function is the concatenation of
+the fixed-width decimal representations of the 624 32-bit integers
+of the state vector.
@sp 1
@cartouche
@@ -11837,12 +11908,12 @@ This is a predefined instantiation of
build the type @code{Complex} and @code{Imaginary}.
@item Ada.Numerics.Discrete_Random
-This package provides a random number generator suitable for generating
-random integer values from a specified range.
+This generic package provides a random number generator suitable for generating
+uniformly distributed values of a specified discrete subtype.
@item Ada.Numerics.Float_Random
This package provides a random number generator suitable for generating
-uniformly distributed floating point values.
+uniformly distributed floating point values in the unit interval.
@item Ada.Numerics.Generic_Complex_Elementary_Functions
This is a generic version of the package that provides the
@@ -12225,8 +12296,6 @@ types are @code{Wide_Character} and @code{Wide_String} instead of
@code{Character} and @code{String}.
@end table
-
-
@node The Implementation of Standard I/O
@chapter The Implementation of Standard I/O
@@ -13241,8 +13310,8 @@ package Interfaces.C_Streams is
-- Standard C functions --
--------------------------
-- The functions selected below are ones that are
- -- available in DOS, OS/2, UNIX and Xenix (but not
- -- necessarily in ANSI C). These are very thin interfaces
+ -- available in UNIX (but not necessarily in ANSI C).
+ -- These are very thin interfaces
-- which copy exactly the C headers. For more
-- documentation on these functions, see the Microsoft C
-- "Run-Time Library Reference" (Microsoft Press, 1990,
@@ -13545,6 +13614,8 @@ of GNAT, and will generate a warning message.
* GNAT.IO (g-io.ads)::
* GNAT.IO_Aux (g-io_aux.ads)::
* GNAT.Lock_Files (g-locfil.ads)::
+* GNAT.MBBS_Discrete_Random (g-mbdira.ads)::
+* GNAT.MBBS_Float_Random (g-mbflra.ads)::
* GNAT.MD5 (g-md5.ads)::
* GNAT.Memory_Dump (g-memdum.ads)::
* GNAT.Most_Recent_Exception (g-moreex.ads)::
@@ -14429,6 +14500,24 @@ for whether a file exists, and functions for reading a line of text.
Provides a general interface for using files as locks. Can be used for
providing program level synchronization.
+@node GNAT.MBBS_Discrete_Random (g-mbdira.ads)
+@section @code{GNAT.MBBS_Discrete_Random} (@file{g-mbdira.ads})
+@cindex @code{GNAT.MBBS_Discrete_Random} (@file{g-mbdira.ads})
+@cindex Random number generation
+
+@noindent
+The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses
+a modified version of the Blum-Blum-Shub generator.
+
+@node GNAT.MBBS_Float_Random (g-mbflra.ads)
+@section @code{GNAT.MBBS_Float_Random} (@file{g-mbflra.ads})
+@cindex @code{GNAT.MBBS_Float_Random} (@file{g-mbflra.ads})
+@cindex Random number generation
+
+@noindent
+The original implementation of @code{Ada.Numerics.Float_Random}. Uses
+a modified version of the Blum-Blum-Shub generator.
+
@node GNAT.MD5 (g-md5.ads)
@section @code{GNAT.MD5} (@file{g-md5.ads})
@cindex @code{GNAT.MD5} (@file{g-md5.ads})
@@ -15477,7 +15566,7 @@ the underlying kernel. Otherwise, some target dependent glue code maps
the services offered by the underlying kernel to the semantics expected
by GNARL@.
-Whatever the underlying OS (VxWorks, UNIX, OS/2, Windows NT, etc.) the
+Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
key point is that each Ada task is mapped on a thread in the underlying
kernel. For example, in the case of VxWorks, one Ada task = one VxWorks task.
@@ -15822,7 +15911,6 @@ If any of these conditions are violated, the aggregate will be built in
a temporary (created either by the front-end or the code generator) and then
that temporary will be copied onto the target.
-
@node The Size of Discriminated Records with Default Discriminants
@section The Size of Discriminated Records with Default Discriminants
@@ -15939,1135 +16027,6 @@ machines that are not fully compliant with this standard, such as Alpha, the
behavior (although at the cost of a significant performance penalty), so
infinite and and NaN values are properly generated.
-
-@node Project File Reference
-@chapter Project File Reference
-
-@noindent
-This chapter describes the syntax and semantics of project files.
-Project files specify the options to be used when building a system.
-Project files can specify global settings for all tools,
-as well as tool-specific settings.
-@xref{Examples of Project Files,,, gnat_ugn, @value{EDITION} User's Guide},
-for examples of use.
-
-@menu
-* Reserved Words::
-* Lexical Elements::
-* Declarations::
-* Empty declarations::
-* Typed string declarations::
-* Variables::
-* Expressions::
-* Attributes::
-* Project Attributes::
-* Attribute References::
-* External Values::
-* Case Construction::
-* Packages::
-* Package Renamings::
-* Projects::
-* Project Extensions::
-* Project File Elaboration::
-@end menu
-
-@node Reserved Words
-@section Reserved Words
-
-@noindent
-All Ada reserved words are reserved in project files, and cannot be used
-as variable names or project names. In addition, the following are
-also reserved in project files:
-
-@itemize
-@item @code{extends}
-
-@item @code{external}
-
-@item @code{project}
-
-@end itemize
-
-@node Lexical Elements
-@section Lexical Elements
-
-@noindent
-Rules for identifiers are the same as in Ada. Identifiers
-are case-insensitive. Strings are case sensitive, except where noted.
-Comments have the same form as in Ada.
-
-@noindent
-Syntax:
-
-@smallexample
-simple_name ::=
- identifier
-
-name ::=
- simple_name @{. simple_name@}
-@end smallexample
-
-@node Declarations
-@section Declarations
-
-@noindent
-Declarations introduce new entities that denote types, variables, attributes,
-and packages. Some declarations can only appear immediately within a project
-declaration. Others can appear within a project or within a package.
-
-Syntax:
-@smallexample
-declarative_item ::=
- simple_declarative_item |
- typed_string_declaration |
- package_declaration
-
-simple_declarative_item ::=
- variable_declaration |
- typed_variable_declaration |
- attribute_declaration |
- case_construction |
- empty_declaration
-@end smallexample
-
-@node Empty declarations
-@section Empty declarations
-
-@smallexample
-empty_declaration ::=
- @b{null} ;
-@end smallexample
-
-An empty declaration is allowed anywhere a declaration is allowed.
-It has no effect.
-
-@node Typed string declarations
-@section Typed string declarations
-
-@noindent
-Typed strings are sequences of string literals. Typed strings are the only
-named types in project files. They are used in case constructions, where they
-provide support for conditional attribute definitions.
-
-Syntax:
-@smallexample
-typed_string_declaration ::=
- @b{type} <typed_string_>_simple_name @b{is}
- ( string_literal @{, string_literal@} );
-@end smallexample
-
-@noindent
-A typed string declaration can only appear immediately within a project
-declaration.
-
-All the string literals in a typed string declaration must be distinct.
-
-@node Variables
-@section Variables
-
-@noindent
-Variables denote values, and appear as constituents of expressions.
-
-@smallexample
-typed_variable_declaration ::=
- <typed_variable_>simple_name : <typed_string_>name := string_expression ;
-
-variable_declaration ::=
- <variable_>simple_name := expression;
-@end smallexample
-
-@noindent
-The elaboration of a variable declaration introduces the variable and
-assigns to it the value of the expression. The name of the variable is
-available after the assignment symbol.
-
-@noindent
-A typed_variable can only be declare once.
-
-@noindent
-a non-typed variable can be declared multiple times.
-
-@noindent
-Before the completion of its first declaration, the value of variable
-is the null string.
-
-@node Expressions
-@section Expressions
-
-@noindent
-An expression is a formula that defines a computation or retrieval of a value.
-In a project file the value of an expression is either a string or a list
-of strings. A string value in an expression is either a literal, the current
-value of a variable, an external value, an attribute reference, or a
-concatenation operation.
-
-Syntax:
-
-@smallexample
-expression ::=
- term @{& term@}
-
-term ::=
- string_literal |
- string_list |
- <variable_>name |
- external_value |
- attribute_reference
-
-string_literal ::=
- (same as Ada)
-
-string_list ::=
- ( <string_>expression @{ , <string_>expression @} )
-@end smallexample
-
-@subsection Concatenation
-@noindent
-The following concatenation functions are defined:
-
-@smallexample @c ada
- function "&" (X : String; Y : String) return String;
- function "&" (X : String_List; Y : String) return String_List;
- function "&" (X : String_List; Y : String_List) return String_List;
-@end smallexample
-
-@node Attributes
-@section Attributes
-
-@noindent
-An attribute declaration defines a property of a project or package. This
-property can later be queried by means of an attribute reference.
-Attribute values are strings or string lists.
-
-Some attributes are associative arrays. These attributes are mappings whose
-domain is a set of strings. These attributes are declared one association
-at a time, by specifying a point in the domain and the corresponding image
-of the attribute. They may also be declared as a full associative array,
-getting the same associations as the corresponding attribute in an imported
-or extended project.
-
-Attributes that are not associative arrays are called simple attributes.
-
-Syntax:
-@smallexample
-attribute_declaration ::=
- full_associative_array_declaration |
- @b{for} attribute_designator @b{use} expression ;
-
-full_associative_array_declaration ::=
- @b{for} <associative_array_attribute_>simple_name @b{use}
- <project_>simple_name [ . <package_>simple_Name ] ' <attribute_>simple_name ;
-
-attribute_designator ::=
- <simple_attribute_>simple_name |
- <associative_array_attribute_>simple_name ( string_literal )
-@end smallexample
-
-@noindent
-Some attributes are project-specific, and can only appear immediately within
-a project declaration. Others are package-specific, and can only appear within
-the proper package.
-
-The expression in an attribute definition must be a string or a string_list.
-The string literal appearing in the attribute_designator of an associative
-array attribute is case-insensitive.
-
-@node Project Attributes
-@section Project Attributes
-
-@noindent
-The following attributes apply to a project. All of them are simple
-attributes.
-
-@table @code
-@item Object_Dir
-Expression must be a path name. The attribute defines the
-directory in which the object files created by the build are to be placed. If
-not specified, object files are placed in the project directory.
-
-@item Exec_Dir
-Expression must be a path name. The attribute defines the
-directory in which the executables created by the build are to be placed.
-If not specified, executables are placed in the object directory.
-
-@item Source_Dirs
-Expression must be a list of path names. The attribute
-defines the directories in which the source files for the project are to be
-found. If not specified, source files are found in the project directory.
-If a string in the list ends with "/**", then the directory that precedes
-"/**" and all of its subdirectories (recursively) are included in the list
-of source directories.
-
-@item Excluded_Source_Dirs
-Expression must be a list of strings. Each entry designates a directory that
-is not to be included in the list of source directories of the project.
-This is normally used when there are strings ending with "/**" in the value
-of attribute Source_Dirs.
-
-@item Source_Files
-Expression must be a list of file names. The attribute
-defines the individual files, in the project directory, which are to be used
-as sources for the project. File names are path_names that contain no directory
-information. If the project has no sources the attribute must be declared
-explicitly with an empty list.
-
-@item Excluded_Source_Files (Locally_Removed_Files)
-Expression must be a list of strings that are legal file names.
-Each file name must designate a source that would normally be a source file
-in the source directories of the project or, if the project file is an
-extending project file, inherited by the current project file. It cannot
-designate an immediate source that is not inherited. Each of the source files
-in the list are not considered to be sources of the project file: they are not
-inherited. Attribute Locally_Removed_Files is obsolescent, attribute
-Excluded_Source_Files is preferred.
-
-@item Source_List_File
-Expression must a single path name. The attribute
-defines a text file that contains a list of source file names to be used
-as sources for the project
-
-@item Library_Dir
-Expression must be a path name. The attribute defines the
-directory in which a library is to be built. The directory must exist, must
-be distinct from the project's object directory, and must be writable.
-
-@item Library_Name
-Expression must be a string that is a legal file name,
-without extension. The attribute defines a string that is used to generate
-the name of the library to be built by the project.
-
-@item Library_Kind
-Argument must be a string value that must be one of the
-following @code{"static"}, @code{"dynamic"} or @code{"relocatable"}. This
-string is case-insensitive. If this attribute is not specified, the library is
-a static library. Otherwise, the library may be dynamic or relocatable. This
-distinction is operating-system dependent.
-
-@item Library_Version
-Expression must be a string value whose interpretation
-is platform dependent. On UNIX, it is used only for dynamic/relocatable
-libraries as the internal name of the library (the @code{"soname"}). If the
-library file name (built from the @code{Library_Name}) is different from the
-@code{Library_Version}, then the library file will be a symbolic link to the
-actual file whose name will be @code{Library_Version}.
-
-@item Library_Interface
-Expression must be a string list. Each element of the string list
-must designate a unit of the project.
-If this attribute is present in a Library Project File, then the project
-file is a Stand-alone Library_Project_File.
-
-@item Library_Auto_Init
-Expression must be a single string "true" or "false", case-insensitive.
-If this attribute is present in a Stand-alone Library Project File,
-it indicates if initialization is automatic when the dynamic library
-is loaded.
-
-@item Library_Options
-Expression must be a string list. Indicates additional switches that
-are to be used when building a shared library.
-
-@item Library_GCC
-Expression must be a single string. Designates an alternative to "gcc"
-for building shared libraries.
-
-@item Library_Src_Dir
-Expression must be a path name. The attribute defines the
-directory in which the sources of the interfaces of a Stand-alone Library will
-be copied. The directory must exist, must be distinct from the project's
-object directory and source directories of all projects in the project tree,
-and must be writable.
-
-@item Library_Src_Dir
-Expression must be a path name. The attribute defines the
-directory in which the ALI files of a Library will
-be copied. The directory must exist, must be distinct from the project's
-object directory and source directories of all projects in the project tree,
-and must be writable.
-
-@item Library_Symbol_File
-Expression must be a single string. Its value is the single file name of a
-symbol file to be created when building a stand-alone library when the
-symbol policy is either "compliant", "controlled" or "restricted",
-on platforms that support symbol control, such as VMS. When symbol policy
-is "direct", then a file with this name must exist in the object directory.
-
-@item Library_Reference_Symbol_File
-Expression must be a single string. Its value is the path name of a
-reference symbol file that is read when the symbol policy is either
-"compliant" or "controlled", on platforms that support symbol control,
-such as VMS, when building a stand-alone library. The path may be an absolute
-path or a path relative to the project directory.
-
-@item Library_Symbol_Policy
-Expression must be a single string. Its case-insensitive value can only be
-"autonomous", "default", "compliant", "controlled", "restricted" or "direct".
-
-This attribute is not taken into account on all platforms. It controls the
-policy for exported symbols and, on some platforms (like VMS) that have the
-notions of major and minor IDs built in the library files, it controls
-the setting of these IDs.
-
-"autonomous" or "default": exported symbols are not controlled.
-
-"compliant": if attribute Library_Reference_Symbol_File is not defined, then
-it is equivalent to policy "autonomous". If there are exported symbols in
-the reference symbol file that are not in the object files of the interfaces,
-the major ID of the library is increased. If there are symbols in the
-object files of the interfaces that are not in the reference symbol file,
-these symbols are put at the end of the list in the newly created symbol file
-and the minor ID is increased.
-
-"controlled": the attribute Library_Reference_Symbol_File must be defined.
-The library will fail to build if the exported symbols in the object files of
-the interfaces do not match exactly the symbol in the symbol file.
-
-"restricted": The attribute Library_Symbol_File must be defined. The library
-will fail to build if there are symbols in the symbol file that are not in
-the exported symbols of the object files of the interfaces. Additional symbols
-in the object files are not added to the symbol file.
-
-"direct": The attribute Library_Symbol_File must be defined and must designate
-an existing file in the object directory. This symbol file is passed directly
-to the underlying linker without any symbol processing.
-
-@item Main
-Expression must be a list of strings that are legal file names.
-These file names designate existing compilation units in the source directory
-that are legal main subprograms.
-
-When a project file is elaborated, as part of the execution of a gnatmake
-command, one or several executables are built and placed in the Exec_Dir.
-If the gnatmake command does not include explicit file names, the executables
-that are built correspond to the files specified by this attribute.
-
-@item Externally_Built
-Expression must be a single string. Its value must be either "true" of "false",
-case-insensitive. The default is "false". When the value of this attribute is
-"true", no attempt is made to compile the sources or to build the library,
-when the project is a library project.
-
-@item Main_Language
-This is a simple attribute. Its value is a string that specifies the
-language of the main program.
-
-@item Languages
-Expression must be a string list. Each string designates
-a programming language that is known to GNAT. The strings are case-insensitive.
-
-@end table
-
-@node Attribute References
-@section Attribute References
-
-@noindent
-Attribute references are used to retrieve the value of previously defined
-attribute for a package or project.
-Syntax:
-@smallexample
-attribute_reference ::=
- attribute_prefix ' <simple_attribute_>simple_name [ ( string_literal ) ]
-
-attribute_prefix ::=
- @b{project} |
- <project_simple_name | package_identifier |
- <project_>simple_name . package_identifier
-@end smallexample
-
-@noindent
-If an attribute has not been specified for a given package or project, its
-value is the null string or the empty list.
-
-@node External Values
-@section External Values
-
-@noindent
-An external value is an expression whose value is obtained from the command
-that invoked the processing of the current project file (typically a
-gnatmake command).
-
-Syntax:
-@smallexample
-external_value ::=
- @b{external} ( string_literal [, string_literal] )
-@end smallexample
-
-@noindent
-The first string_literal is the string to be used on the command line or
-in the environment to specify the external value. The second string_literal,
-if present, is the default to use if there is no specification for this
-external value either on the command line or in the environment.
-
-@node Case Construction
-@section Case Construction
-
-@noindent
-A case construction supports attribute and variable declarations that depend
-on the value of a previously declared variable.
-
-Syntax:
-@smallexample
-case_construction ::=
- @b{case} <typed_variable_>name @b{is}
- @{case_item@}
- @b{end case} ;
-
-case_item ::=
- @b{when} discrete_choice_list =>
- @{case_construction |
- attribute_declaration |
- variable_declaration |
- empty_declaration@}
-
-discrete_choice_list ::=
- string_literal @{| string_literal@} |
- @b{others}
-@end smallexample
-
-@noindent
-Inside a case construction, variable declarations must be for variables that
-have already been declared before the case construction.
-
-All choices in a choice list must be distinct. The choice lists of two
-distinct alternatives must be disjoint. Unlike Ada, the choice lists of all
-alternatives do not need to include all values of the type. An @code{others}
-choice must appear last in the list of alternatives.
-
-@node Packages
-@section Packages
-
-@noindent
-A package provides a grouping of variable declarations and attribute
-declarations to be used when invoking various GNAT tools. The name of
-the package indicates the tool(s) to which it applies.
-Syntax:
-
-@smallexample
-package_declaration ::=
- package_spec | package_renaming
-
-package_spec ::=
- @b{package} package_identifier @b{is}
- @{simple_declarative_item@}
- @b{end} package_identifier ;
-
-package_identifier ::=
- @code{Naming} | @code{Builder} | @code{Compiler} | @code{Binder} |
- @code{Linker} | @code{Finder} | @code{Cross_Reference} |
- @code{gnatls} | @code{IDE} | @code{Pretty_Printer} | @code{Check}
-@end smallexample
-
-@subsection Package Naming
-
-@noindent
-The attributes of a @code{Naming} package specifies the naming conventions
-that apply to the source files in a project. When invoking other GNAT tools,
-they will use the sources in the source directories that satisfy these
-naming conventions.
-
-The following attributes apply to a @code{Naming} package:
-
-@table @code
-@item Casing
-This is a simple attribute whose value is a string. Legal values of this
-string are @code{"lowercase"}, @code{"uppercase"} or @code{"mixedcase"}.
-These strings are themselves case insensitive.
-
-@noindent
-If @code{Casing} is not specified, then the default is @code{"lowercase"}.
-
-@item Dot_Replacement
-This is a simple attribute whose string value satisfies the following
-requirements:
-
-@itemize @bullet
-@item It must not be empty
-@item It cannot start or end with an alphanumeric character
-@item It cannot be a single underscore
-@item It cannot start with an underscore followed by an alphanumeric
-@item It cannot contain a dot @code{'.'} if longer than one character
-@end itemize
-
-@noindent
-If @code{Dot_Replacement} is not specified, then the default is @code{"-"}.
-
-@item Spec_Suffix
-This is an associative array attribute, defined on language names,
-whose image is a string that must satisfy the following
-conditions:
-
-@itemize @bullet
-@item It must not be empty
-@item It cannot start with an alphanumeric character
-@item It cannot start with an underscore followed by an alphanumeric character
-@end itemize
-
-@noindent
-For Ada, the attribute denotes the suffix used in file names that contain
-library unit declarations, that is to say units that are package and
-subprogram declarations. If @code{Spec_Suffix ("Ada")} is not
-specified, then the default is @code{".ads"}.
-
-For C and C++, the attribute denotes the suffix used in file names that
-contain prototypes.
-
-@item Body_Suffix
-This is an associative array attribute defined on language names,
-whose image is a string that must satisfy the following
-conditions:
-
-@itemize @bullet
-@item It must not be empty
-@item It cannot start with an alphanumeric character
-@item It cannot start with an underscore followed by an alphanumeric character
-@item It cannot be a suffix of @code{Spec_Suffix}
-@end itemize
-
-@noindent
-For Ada, the attribute denotes the suffix used in file names that contain
-library bodies, that is to say units that are package and subprogram bodies.
-If @code{Body_Suffix ("Ada")} is not specified, then the default is
-@code{".adb"}.
-
-For C and C++, the attribute denotes the suffix used in file names that contain
-source code.
-
-@item Separate_Suffix
-This is a simple attribute whose value satisfies the same conditions as
-@code{Body_Suffix}.
-
-This attribute is specific to Ada. It denotes the suffix used in file names
-that contain separate bodies. If it is not specified, then it defaults to same
-value as @code{Body_Suffix ("Ada")}.
-
-@item Spec
-This is an associative array attribute, specific to Ada, defined over
-compilation unit names. The image is a string that is the name of the file
-that contains that library unit. The file name is case sensitive if the
-conventions of the host operating system require it.
-
-@item Body
-This is an associative array attribute, specific to Ada, defined over
-compilation unit names. The image is a string that is the name of the file
-that contains the library unit body for the named unit. The file name is case
-sensitive if the conventions of the host operating system require it.
-
-@item Specification_Exceptions
-This is an associative array attribute defined on language names,
-whose value is a list of strings.
-
-This attribute is not significant for Ada.
-
-For C and C++, each string in the list denotes the name of a file that
-contains prototypes, but whose suffix is not necessarily the
-@code{Spec_Suffix} for the language.
-
-@item Implementation_Exceptions
-This is an associative array attribute defined on language names,
-whose value is a list of strings.
-
-This attribute is not significant for Ada.
-
-For C and C++, each string in the list denotes the name of a file that
-contains source code, but whose suffix is not necessarily the
-@code{Body_Suffix} for the language.
-@end table
-
-The following attributes of package @code{Naming} are obsolescent. They are
-kept as synonyms of other attributes for compatibility with previous versions
-of the Project Manager.
-
-@table @code
-@item Specification_Suffix
-This is a synonym of @code{Spec_Suffix}.
-
-@item Implementation_Suffix
-This is a synonym of @code{Body_Suffix}.
-
-@item Specification
-This is a synonym of @code{Spec}.
-
-@item Implementation
-This is a synonym of @code{Body}.
-@end table
-
-@subsection package Compiler
-
-@noindent
-The attributes of the @code{Compiler} package specify the compilation options
-to be used by the underlying compiler.
-
-@table @code
-@item Default_Switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies the compilation options to be used when compiling a component
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies the
-compilation options to be used when compiling the named file. If a file
-is not specified in the Switches attribute, it is compiled with the
-options specified by Default_Switches of its language, if defined.
-
-@item Local_Configuration_Pragmas.
-This is a simple attribute, whose
-value is a path name that designates a file containing configuration pragmas
-to be used for all invocations of the compiler for immediate sources of the
-project.
-@end table
-
-@subsection package Builder
-
-@noindent
-The attributes of package @code{Builder} specify the compilation, binding, and
-linking options to be used when building an executable for a project. The
-following attributes apply to package @code{Builder}:
-
-@table @code
-@item Default_Switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when building a main
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when building the named main file. If a main file
-is not specified in the Switches attribute, it is built with the
-options specified by Default_Switches of its language, if defined.
-
-@item Global_Configuration_Pragmas
-This is a simple attribute, whose
-value is a path name that designates a file that contains configuration pragmas
-to be used in every build of an executable. If both local and global
-configuration pragmas are specified, a compilation makes use of both sets.
-
-
-@item Executable
-This is an associative array attribute. Its domain is
-a set of main source file names. Its range is a simple string that specifies
-the executable file name to be used when linking the specified main source.
-If a main source is not specified in the Executable attribute, the executable
-file name is deducted from the main source file name.
-This attribute has no effect if its value is the empty string.
-
-@item Executable_Suffix
-This is a simple attribute whose value is the suffix to be added to
-the executables that don't have an attribute Executable specified.
-@end table
-
-@subsection package Gnatls
-
-@noindent
-The attributes of package @code{Gnatls} specify the tool options to be used
-when invoking the library browser @command{gnatls}.
-The following attributes apply to package @code{Gnatls}:
-
-@table @code
-@item Switches
-This is a single attribute with a string list value. Each nonempty string
-in the list is an option when invoking @code{gnatls}.
-@end table
-
-@subsection package Binder
-
-@noindent
-The attributes of package @code{Binder} specify the options to be used
-when invoking the binder in the construction of an executable.
-The following attributes apply to package @code{Binder}:
-
-@table @code
-@item Default_Switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when binding a main
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when binding the named main file. If a main file
-is not specified in the Switches attribute, it is bound with the
-options specified by Default_Switches of its language, if defined.
-@end table
-
-@subsection package Linker
-
-@noindent
-The attributes of package @code{Linker} specify the options to be used when
-invoking the linker in the construction of an executable.
-The following attributes apply to package @code{Linker}:
-
-@table @code
-@item Default_Switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when linking a main
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when linking the named main file. If a main file
-is not specified in the Switches attribute, it is linked with the
-options specified by Default_Switches of its language, if defined.
-
-@item Linker_Options
-This is a string list attribute. Its value specifies additional options that
-be given to the linker when linking an executable. This attribute is not
-used in the main project, only in projects imported directly or indirectly.
-
-@end table
-
-@subsection package Cross_Reference
-
-@noindent
-The attributes of package @code{Cross_Reference} specify the tool options
-to be used
-when invoking the library tool @command{gnatxref}.
-The following attributes apply to package @code{Cross_Reference}:
-
-@table @code
-@item Default_Switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when calling @command{gnatxref} on a source
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when calling @command{gnatxref} on the named main source.
-If a source is not specified in the Switches attribute, @command{gnatxref} will
-be called with the options specified by Default_Switches of its language,
-if defined.
-@end table
-
-@subsection package Finder
-
-@noindent
-The attributes of package @code{Finder} specify the tool options to be used
-when invoking the search tool @command{gnatfind}.
-The following attributes apply to package @code{Finder}:
-
-@table @code
-@item Default_Switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when calling @command{gnatfind} on a source
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when calling @command{gnatfind} on the named main source.
-If a source is not specified in the Switches attribute, @command{gnatfind} will
-be called with the options specified by Default_Switches of its language,
-if defined.
-@end table
-
-@subsection package Check
-
-@noindent
-The attributes of package @code{Check}
-specify the checking rule options to be used
-when invoking the checking tool @command{gnatcheck}.
-The following attributes apply to package @code{Check}:
-
-@table @code
-@item Default_switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when calling @command{gnatcheck} on a source
-written in that language. The first string in the range should always be
-@code{"-rules"} to specify that all the other options belong to the
-@code{-rules} section of the parameters of @command{gnatcheck} call.
-
-@end table
-
-@subsection package Pretty_Printer
-
-@noindent
-The attributes of package @code{Pretty_Printer}
-specify the tool options to be used
-when invoking the formatting tool @command{gnatpp}.
-The following attributes apply to package @code{Pretty_Printer}:
-
-@table @code
-@item Default_switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when calling @command{gnatpp} on a source
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when calling @command{gnatpp} on the named main source.
-If a source is not specified in the Switches attribute, @command{gnatpp} will
-be called with the options specified by Default_Switches of its language,
-if defined.
-@end table
-
-@subsection package gnatstub
-
-@noindent
-The attributes of package @code{gnatstub}
-specify the tool options to be used
-when invoking the tool @command{gnatstub}.
-The following attributes apply to package @code{gnatstub}:
-
-@table @code
-@item Default_switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when calling @command{gnatstub} on a source
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when calling @command{gnatstub} on the named main source.
-If a source is not specified in the Switches attribute, @command{gnatpp} will
-be called with the options specified by Default_Switches of its language,
-if defined.
-@end table
-
-@subsection package Eliminate
-
-@noindent
-The attributes of package @code{Eliminate}
-specify the tool options to be used
-when invoking the tool @command{gnatelim}.
-The following attributes apply to package @code{Eliminate}:
-
-@table @code
-@item Default_switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when calling @command{gnatelim} on a source
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when calling @command{gnatelim} on the named main source.
-If a source is not specified in the Switches attribute, @command{gnatelim} will
-be called with the options specified by Default_Switches of its language,
-if defined.
-@end table
-
-@subsection package Metrics
-
-@noindent
-The attributes of package @code{Metrics}
-specify the tool options to be used
-when invoking the tool @command{gnatmetric}.
-The following attributes apply to package @code{Metrics}:
-
-@table @code
-@item Default_switches
-This is an associative array attribute. Its
-domain is a set of language names. Its range is a string list that
-specifies options to be used when calling @command{gnatmetric} on a source
-written in that language, for which no file-specific switches have been
-specified.
-
-@item Switches
-This is an associative array attribute. Its domain is
-a set of file names. Its range is a string list that specifies
-options to be used when calling @command{gnatmetric} on the named main source.
-If a source is not specified in the Switches attribute, @command{gnatmetric}
-will be called with the options specified by Default_Switches of its language,
-if defined.
-@end table
-
-@subsection package IDE
-
-@noindent
-The attributes of package @code{IDE} specify the options to be used when using
-an Integrated Development Environment such as @command{GPS}.
-
-@table @code
-@item Remote_Host
-This is a simple attribute. Its value is a string that designates the remote
-host in a cross-compilation environment, to be used for remote compilation and
-debugging. This field should not be specified when running on the local
-machine.
-
-@item Program_Host
-This is a simple attribute. Its value is a string that specifies the
-name of IP address of the embedded target in a cross-compilation environment,
-on which the program should execute.
-
-@item Communication_Protocol
-This is a simple string attribute. Its value is the name of the protocol
-to use to communicate with the target in a cross-compilation environment,
-e.g.@: @code{"wtx"} or @code{"vxworks"}.
-
-@item Compiler_Command
-This is an associative array attribute, whose domain is a language name. Its
-value is string that denotes the command to be used to invoke the compiler.
-The value of @code{Compiler_Command ("Ada")} is expected to be compatible with
-gnatmake, in particular in the handling of switches.
-
-@item Debugger_Command
-This is simple attribute, Its value is a string that specifies the name of
-the debugger to be used, such as gdb, powerpc-wrs-vxworks-gdb or gdb-4.
-
-@item Default_Switches
-This is an associative array attribute. Its indexes are the name of the
-external tools that the GNAT Programming System (GPS) is supporting. Its
-value is a list of switches to use when invoking that tool.
-
-@item Gnatlist
-This is a simple attribute. Its value is a string that specifies the name
-of the @command{gnatls} utility to be used to retrieve information about the
-predefined path; e.g., @code{"gnatls"}, @code{"powerpc-wrs-vxworks-gnatls"}.
-
-@item VCS_Kind
-This is a simple attribute. Its value is a string used to specify the
-Version Control System (VCS) to be used for this project, e.g.@: CVS, RCS
-ClearCase or Perforce.
-
-@item VCS_File_Check
-This is a simple attribute. Its value is a string that specifies the
-command used by the VCS to check the validity of a file, either
-when the user explicitly asks for a check, or as a sanity check before
-doing the check-in.
-
-@item VCS_Log_Check
-This is a simple attribute. Its value is a string that specifies
-the command used by the VCS to check the validity of a log file.
-
-@item VCS_Repository_Root
-The VCS repository root path. This is used to create tags or branches
-of the repository. For subversion the value should be the @code{URL}
-as specified to check-out the working copy of the repository.
-
-@item VCS_Patch_Root
-The local root directory to use for building patch file. All patch chunks
-will be relative to this path. The root project directory is used if
-this value is not defined.
-
-@end table
-
-@node Package Renamings
-@section Package Renamings
-
-@noindent
-A package can be defined by a renaming declaration. The new package renames
-a package declared in a different project file, and has the same attributes
-as the package it renames.
-Syntax:
-@smallexample
-package_renaming ::==
- @b{package} package_identifier @b{renames}
- <project_>simple_name.package_identifier ;
-@end smallexample
-
-@noindent
-The package_identifier of the renamed package must be the same as the
-package_identifier. The project whose name is the prefix of the renamed
-package must contain a package declaration with this name. This project
-must appear in the context_clause of the enclosing project declaration,
-or be the parent project of the enclosing child project.
-
-@node Projects
-@section Projects
-
-@noindent
-A project file specifies a set of rules for constructing a software system.
-A project file can be self-contained, or depend on other project files.
-Dependencies are expressed through a context clause that names other projects.
-
-Syntax:
-
-@smallexample
-project ::=
- context_clause project_declaration
-
-project_declaration ::=
- simple_project_declaration | project_extension
-
-simple_project_declaration ::=
- @b{project} <project_>simple_name @b{is}
- @{declarative_item@}
- @b{end} <project_>simple_name;
-
-context_clause ::=
- @{with_clause@}
-
-with_clause ::=
- [@b{limited}] @b{with} path_name @{ , path_name @} ;
-
-path_name ::=
- string_literal
-@end smallexample
-
-@noindent
-A path name denotes a project file. A path name can be absolute or relative.
-An absolute path name includes a sequence of directories, in the syntax of
-the host operating system, that identifies uniquely the project file in the
-file system. A relative path name identifies the project file, relative
-to the directory that contains the current project, or relative to a
-directory listed in the environment variable ADA_PROJECT_PATH.
-Path names are case sensitive if file names in the host operating system
-are case sensitive.
-
-The syntax of the environment variable ADA_PROJECT_PATH is a list of
-directory names separated by colons (semicolons on Windows).
-
-A given project name can appear only once in a context_clause.
-
-It is illegal for a project imported by a context clause to refer, directly
-or indirectly, to the project in which this context clause appears (the
-dependency graph cannot contain cycles), except when one of the with_clause
-in the cycle is a @code{limited with}.
-
-@node Project Extensions
-@section Project Extensions
-
-@noindent
-A project extension introduces a new project, which inherits the declarations
-of another project.
-Syntax:
-@smallexample
-
-project_extension ::=
- @b{project} <project_>simple_name @b{extends} path_name @b{is}
- @{declarative_item@}
- @b{end} <project_>simple_name;
-@end smallexample
-
-@noindent
-The project extension declares a child project. The child project inherits
-all the declarations and all the files of the parent project, These inherited
-declaration can be overridden in the child project, by means of suitable
-declarations.
-
-@node Project File Elaboration
-@section Project File Elaboration
-
-@noindent
-A project file is processed as part of the invocation of a gnat tool that
-uses the project option. Elaboration of the process file consists in the
-sequential elaboration of all its declarations. The computed values of
-attributes and variables in the project are then used to establish the
-environment in which the gnat tool will execute.
-
@node Obsolescent Features
@chapter Obsolescent Features
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index db8b2ccd1c1..e18baef53d5 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -18,7 +18,7 @@ Copyright @copyright{} 1995-2009 Free Software Foundation,
Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts and with no Back-Cover
Texts. A copy of the license is included in the section entitled
@@ -107,6 +107,13 @@ Texts. A copy of the license is included in the section entitled
@macro ovar{varname}
@r{[}@var{\varname\}@r{]}@c
@end macro
+@c Status as of November 2009:
+@c Unfortunately texi2pdf and texi2html treat the trailing "@c"
+@c differently, and faulty output is produced by one or the other
+@c depending on whether the "@c" is present or absent.
+@c As a result, the @ovar macro is not used, and all invocations
+@c of the @ovar macro have been expanded inline.
+
@settitle @value{EDITION} User's Guide @value{PLATFORM}
@dircategory GNU Ada tools
@@ -169,6 +176,7 @@ AdaCore@*
* Configuration Pragmas::
* Handling Arbitrary File Naming Conventions Using gnatname::
* GNAT Project Manager::
+* Tools Supporting Project Files::
* The Cross-Referencing Tools gnatxref and gnatfind::
* The GNAT Pretty-Printer gnatpp::
* The GNAT Metric Tool gnatmetric::
@@ -340,6 +348,7 @@ Performance Considerations
Reducing Size of Ada Executables with gnatelim
* About gnatelim::
* Running gnatelim::
+* Processing Precompiled Libraries::
* Correcting the List of Eliminate Pragmas::
* Making Your Executables Smaller::
* Summary of the gnatelim Usage Cycle::
@@ -368,26 +377,6 @@ Handling Arbitrary File Naming Conventions Using gnatname
* Switches for gnatname::
* Examples of gnatname Usage::
-GNAT Project Manager
-
-* Introduction::
-* Examples of Project Files::
-* Project File Syntax::
-* Objects and Sources in Project Files::
-* Importing Projects::
-* Project Extension::
-* Project Hierarchy Extension::
-* External References in Project Files::
-* Packages in Project Files::
-* Variables from Imported Projects::
-* Naming Schemes::
-* Library Projects::
-* Stand-alone Library Projects::
-* Switches Related to Project Files::
-* Tools Supporting Project Files::
-* An Extended Example::
-* Project File Complete Syntax::
-
The Cross-Referencing Tools gnatxref and gnatfind
* Switches for gnatxref::
@@ -523,6 +512,7 @@ Running and Debugging Ada Programs
* Ada Exceptions::
* Ada Tasks::
* Debugging Generic Units::
+* Remote Debugging using gdbserver::
* GNAT Abnormal Termination or Failure to Terminate::
* Naming Conventions for GNAT Source Files::
* Getting Internal Debugging Information::
@@ -597,6 +587,8 @@ Platform-Specific Information for the Run-Time Libraries
* Linux-Specific Considerations::
* AIX-Specific Considerations::
* Irix-Specific Considerations::
+* RTX-Specific Considerations::
+* HP-UX-Specific Considerations::
Example of Binder Output File
@@ -3873,7 +3865,9 @@ without generating code, then use the @option{-gnatc} switch.
The basic command for compiling a file containing an Ada unit is
@smallexample
-$ gcc -c @ovar{switches} @file{file name}
+@c $ gcc -c @ovar{switches} @file{file name}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gcc -c @r{[}@var{switches}@r{]} @file{file name}
@end smallexample
@noindent
@@ -4066,6 +4060,17 @@ Enforce Ada 95 restrictions.
@cindex @option{-gnat05} (@command{gcc})
Allow full Ada 2005 features.
+@item -gnat2005
+@cindex @option{-gnat2005} (@command{gcc})
+Allow full Ada 2005 features (same as @option{-gnat05}
+
+@item -gnat12
+@cindex @option{-gnat12} (@command{gcc})
+
+@item -gnat2012
+@cindex @option{-gnat2012} (@command{gcc})
+Allow full Ada 2012 features (same as @option{-gnat12}
+
@item -gnata
@cindex @option{-gnata} (@command{gcc})
Assertions enabled. @code{Pragma Assert} and @code{pragma Debug} to be
@@ -4188,7 +4193,7 @@ Note that @option{^-gnatg^/GNAT_INTERNAL^} implies
@option{^-gnatwae^/WARNINGS=ALL,ERRORS^} and
@option{^-gnatyg^/STYLE_CHECKS=GNAT^}
so that all standard warnings and all standard style options are turned on.
-All warnings and style error messages are treated as errors.
+All warnings and style messages are treated as errors.
@ifclear vms
@item -gnatG=nn
@@ -4282,7 +4287,12 @@ controlled by this switch (division by zero checking is on by default).
@item -gnatp
@cindex @option{-gnatp} (@command{gcc})
-Suppress all checks. See @ref{Run-Time Checks} for details.
+Suppress all checks. See @ref{Run-Time Checks} for details. This switch
+has no effect if cancelled by a subsequent @option{-gnat-p} switch.
+
+@item -gnat-p
+@cindex @option{-gnat-p} (@command{gcc})
+Cancel effect of previous @option{-gnatp} switch.
@item -gnatP
@cindex @option{-gnatP} (@command{gcc})
@@ -4360,6 +4370,10 @@ Wide character encoding method
@cindex @option{-gnatx} (@command{gcc})
Suppress generation of cross-reference information.
+@item -gnatX
+@cindex @option{-gnatX} (@command{gcc})
+Enable GNAT implementation extensions and latest Ada version.
+
@item ^-gnaty^/STYLE_CHECKS=(option,option@dots{})^
@cindex @option{^-gnaty^/STYLE_CHECKS^} (@command{gcc})
Enable built-in style checks (@pxref{Style Checking}).
@@ -4419,7 +4433,9 @@ Inhibit the search of the default location for the GNAT Run Time
Library (RTL) ALI files.
@ifclear vms
-@item -O@ovar{n}
+@c @item -O@ovar{n}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+@item -O@r{[}@var{n}@r{]}
@cindex @option{-O} (@command{gcc})
@var{n} controls the optimization level.
@@ -4577,6 +4593,9 @@ The switches
@option{-gnatzc} and @option{-gnatzr} may not be combined with any other
switches, and only one of them may appear in the command line.
+@item
+The switch @option{-gnat-p} may not be combined with any other switch.
+
@ifclear vms
@item
Once a ``y'' appears in the string (that is a use of the @option{-gnaty}
@@ -5190,12 +5209,14 @@ This switch suppresses warnings for implicit dereferences in
indexed components, slices, and selected components.
@item -gnatwe
-@emph{Treat warnings as errors.}
+@emph{Treat warnings and style checks as errors.}
@cindex @option{-gnatwe} (@command{gcc})
@cindex Warnings, treat as error
-This switch causes warning messages to be treated as errors.
+This switch causes warning messages and style check messages to be
+treated as errors.
The warning string still appears, but the warning messages are counted
-as errors, and prevent the generation of an object file.
+as errors, and prevent the generation of an object file. Note that this
+is the only -gnatw switch that affects the handling of style check messages.
@item -gnatw.e
@emph{Activate every optional warning}
@@ -5558,7 +5579,8 @@ This switch completely suppresses the
output of all warning messages from the GNAT front end.
Note that it does not suppress warnings from the @command{gcc} back end.
To suppress these back end warnings as well, use the switch @option{-w}
-in addition to @option{-gnatws}.
+in addition to @option{-gnatws}. Also this switch has no effect on the
+handling of style check messages.
@item -gnatwt
@emph{Activate warnings for tracking of deleted conditional code.}
@@ -6117,8 +6139,10 @@ causes the compiler to
enforce specified style rules. A limited set of style rules has been used
in writing the GNAT sources themselves. This switch allows user programs
to activate all or some of these checks. If the source program fails a
-specified style check, an appropriate warning message is given, preceded by
-the character sequence ``(style)''.
+specified style check, an appropriate message is given, preceded by
+the character sequence ``(style)''. This message does not prevent
+successful compilation (unless the @option{-gnatwe} switch is used).
+
@ifset vms
@code{(option,option,@dots{})} is a sequence of keywords
@end ifset
@@ -6608,6 +6632,16 @@ year). The compiler will generate code based on the assumption that
the condition being checked is true, which can result in disaster if
that assumption is wrong.
+The @option{-gnatp} switch has no effect if a subsequent
+@option{-gnat-p} switch appears.
+
+@item -gnat-p
+@cindex @option{-gnat-p} (@command{gcc})
+@cindex Suppressing checks
+@cindex Checks, suppressing
+@findex Suppress
+This switch cancels the effect of a previous @option{gnatp} switch.
+
@item -gnato
@cindex @option{-gnato} (@command{gcc})
@cindex Overflow checks
@@ -6881,27 +6915,60 @@ uses of the new Ada 2005 features will cause error
messages or warnings.
This switch also can be used to cancel the effect of a previous
-@option{-gnat83} or @option{-gnat05} switch earlier in the command line.
+@option{-gnat83}, @option{-gnat05/2005}, or @option{-gnat12/2012}
+switch earlier in the command line.
-@item -gnat05 (Ada 2005 mode)
+@item -gnat05 or -gnat2005 (Ada 2005 mode)
@cindex @option{-gnat05} (@command{gcc})
+@cindex @option{-gnat2005} (@command{gcc})
@cindex Ada 2005 mode
@noindent
This switch directs the compiler to implement the Ada 2005 version of the
-language.
+language, as documented in the official Ada standards document.
Since Ada 2005 is almost completely upwards
compatible with Ada 95 (and thus also with Ada 83), Ada 83 and Ada 95 programs
may generally be compiled using this switch (see the description of the
@option{-gnat83} and @option{-gnat95} switches for further
information).
+Note that even though Ada 2005 is the current official version of the
+language, GNAT still compiles in Ada 95 mode by default, so if you are
+using Ada 2005 features in your program, you must use this switch (or
+the equivalent Ada_05 or Ada_2005 configuration pragmas).
+
+@item -gnat12 or -gnat2012 (Ada 2012 mode)
+@cindex @option{-gnat12} (@command{gcc})
+@cindex @option{-gnat2012} (@command{gcc})
+@cindex Ada 2012 mode
+
+@noindent
+This switch directs the compiler to implement the Ada 2012 version of the
+language.
+Since Ada 2012 is almost completely upwards
+compatible with Ada 2005 (and thus also with Ada 83, and Ada 95),
+Ada 83 and Ada 95 programs
+may generally be compiled using this switch (see the description of the
+@option{-gnat83}, @option{-gnat95}, and @option{-gnat05/2005} switches
+for further information).
+
For information about the approved ``Ada Issues'' that have been incorporated
-into Ada 2005, see @url{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs}.
-Included with GNAT releases is a file @file{features-ada0y} that describes
-the set of implemented Ada 2005 features.
-@end table
+into Ada 2012, see @url{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs}.
+Included with GNAT releases is a file @file{features-ada12} that describes
+the set of implemented Ada 2012 features.
+@item -gnatX (Enable GNAT Extensions)
+@cindex @option{-gnatX} (@command{gcc})
+@cindex Ada language extensions
+@cindex GNAT extensions
+
+@noindent
+This switch directs the compiler to implement the latest version of the
+language (currently Ada 2012) and also to enable certain GNAT implementation
+extensions that are not part of any Ada standard. For a full list of these
+extensions, see the GNAT reference manual.
+
+@end table
@node Character Set Control
@subsection Character Set Control
@@ -7187,7 +7254,9 @@ Shows the storage pool associated with a @code{free} statement.
Used to list an equivalent declaration for an internally generated
type that is referenced elsewhere in the listing.
-@item freeze @var{type-name} @ovar{actions}
+@c @item freeze @var{type-name} @ovar{actions}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+@item freeze @var{type-name} @r{[}@var{actions}@r{]}
Shows the point at which @var{type-name} is frozen, with possible
associated actions to be performed at the freeze point.
@@ -7886,12 +7955,14 @@ to be read by the @command{gnatlink} utility used to link the Ada application.
The form of the @code{gnatbind} command is
@smallexample
-$ gnatbind @ovar{switches} @var{mainprog}@r{[}.ali@r{]} @ovar{switches}
+@c $ gnatbind @ovar{switches} @var{mainprog}@r{[}.ali@r{]} @ovar{switches}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatbind @r{[}@var{switches}@r{]} @var{mainprog}@r{[}.ali@r{]} @r{[}@var{switches}@r{]}
@end smallexample
@noindent
where @file{@var{mainprog}.adb} is the Ada file containing the main program
-unit body. If no switches are specified, @code{gnatbind} constructs an Ada
+unit body. @code{gnatbind} constructs an Ada
package in two files whose names are
@file{b~@var{mainprog}.ads}, and @file{b~@var{mainprog}.adb}.
For example, if given the
@@ -7962,14 +8033,6 @@ the generated main program. It can also be debugged just like any other
Ada code provided the @option{^-g^/DEBUG^} switch is used for
@command{gnatbind} and @command{gnatlink}.
-However for some purposes it may be convenient to generate the main
-program in C rather than Ada. This may for example be helpful when you
-are generating a mixed language program with the main program in C. The
-GNAT compiler itself is an example.
-The use of the @option{^-C^/BIND_FILE=C^} switch
-for both @code{gnatbind} and @command{gnatlink} will cause the program to
-be generated in C (and compiled using the gnu C compiler).
-
@node Switches for gnatbind
@section Switches for @command{gnatbind}
@@ -8013,9 +8076,9 @@ Specify directory to be searched for ALI files.
@cindex @option{^-aI^/SOURCE_SEARCH^} (@command{gnatbind})
Specify directory to be searched for source file.
-@item ^-A^/BIND_FILE=ADA^
-@cindex @option{^-A^/BIND_FILE=ADA^} (@command{gnatbind})
-Generate binder program in Ada (default)
+@item ^-A^/ALI_LIST^@r{[=}@var{filename}@r{]}
+@cindex @option{^-A^/ALI_LIST^} (@command{gnatbind})
+Output ALI list (to standard output or to the named file).
@item ^-b^/REPORT_ERRORS=BRIEF^
@cindex @option{^-b^/REPORT_ERRORS=BRIEF^} (@command{gnatbind})
@@ -8025,10 +8088,6 @@ Generate brief messages to @file{stderr} even if verbose mode set.
@cindex @option{^-c^/NOOUTPUT^} (@command{gnatbind})
Check only, no generation of binder output file.
-@item ^-C^/BIND_FILE=C^
-@cindex @option{^-C^/BIND_FILE=C^} (@command{gnatbind})
-Generate binder program in C
-
@item ^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}
@cindex @option{^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}} (@command{gnatbind})
This switch can be used to change the default task stack size value
@@ -8173,9 +8232,9 @@ Name the output file @var{file} (default is @file{b~@var{xxx}.adb}).
Note that if this option is used, then linking must be done manually,
gnatlink cannot be used.
-@item ^-O^/OBJECT_LIST^
+@item ^-O^/OBJECT_LIST^@r{[=}@var{filename}@r{]}
@cindex @option{^-O^/OBJECT_LIST^} (@command{gnatbind})
-Output object list.
+Output object list (to standard output or to the named file).
@item ^-p^/PESSIMISTIC_ELABORATION^
@cindex @option{^-p^/PESSIMISTIC_ELABORATION^} (@command{gnatbind})
@@ -8474,24 +8533,11 @@ generated by the binder.
@table @option
@c !sort!
-@item ^-A^/BIND_FILE=ADA^
-@cindex @option{^-A^/BIND_FILE=ADA^} (@code{gnatbind})
-Generate binder program in Ada (default). The binder program is named
-@file{b~@var{mainprog}.adb} by default. This can be changed with
-@option{^-o^/OUTPUT^} @code{gnatbind} option.
-
@item ^-c^/NOOUTPUT^
@cindex @option{^-c^/NOOUTPUT^} (@code{gnatbind})
Check only. Do not generate the binder output file. In this mode the
binder performs all error checks but does not generate an output file.
-@item ^-C^/BIND_FILE=C^
-@cindex @option{^-C^/BIND_FILE=C^} (@code{gnatbind})
-Generate binder program in C. The binder program is named
-@file{b_@var{mainprog}.c}.
-This can be changed with @option{^-o^/OUTPUT^} @code{gnatbind}
-option.
-
@item ^-e^/ELABORATION_DEPENDENCIES^
@cindex @option{^-e^/ELABORATION_DEPENDENCIES^} (@code{gnatbind})
Output complete list of elaboration-order dependencies, showing the
@@ -8526,8 +8572,7 @@ directory names for the run-time units depend on the system configuration.
@cindex @option{^-o^/OUTPUT^} (@code{gnatbind})
Set name of output file to @var{file} instead of the normal
@file{b~@var{mainprog}.adb} default. Note that @var{file} denote the Ada
-binder generated body filename. In C mode you would normally give
-@var{file} an extension of @file{.c} because it will be a C source program.
+binder generated body filename.
Note that if this option is used, then linking must be done manually.
It is not possible to use gnatlink in this case, since it cannot locate
the binder file.
@@ -8601,9 +8646,7 @@ more quite separate groups of Ada units.
The binder takes the name of its output file from the last specified ALI
file, unless overridden by the use of the @option{^-o file^/OUTPUT=file^}.
@cindex @option{^-o^/OUTPUT^} (@command{gnatbind})
-The output is an Ada unit in source form that can
-be compiled with GNAT unless the -C switch is used in which case the
-output is a C source file, which must be compiled using the C compiler.
+The output is an Ada unit in source form that can be compiled with GNAT.
This compilation occurs automatically as part of the @command{gnatlink}
processing.
@@ -8800,39 +8843,8 @@ The main program @code{Hello} (source program in @file{hello.adb}) is
bound using the standard switch settings. The generated main program is
@file{mainprog.adb} with the associated spec in
@file{mainprog.ads}. Note that you must specify the body here not the
-spec, in the case where the output is in Ada. Note that if this option
-is used, then linking must be done manually, since gnatlink will not
-be able to find the generated file.
-
-@ifclear vms
-@item gnatbind main -C -o mainprog.c -x
-@end ifclear
-@ifset vms
-@item gnatbind MAIN.ALI /BIND_FILE=C /OUTPUT=Mainprog.C /READ_SOURCES=NONE
-@end ifset
-The main program @code{Main} (source program in
-@file{main.adb}) is bound, excluding source files from the
-consistency checking, generating
-the file @file{mainprog.c}.
-
-@ifclear vms
-@item gnatbind -x main_program -C -o mainprog.c
-This command is exactly the same as the previous example. Switches may
-appear anywhere in the command line, and single letter switches may be
-combined into a single switch.
-@end ifclear
-
-@ifclear vms
-@item gnatbind -n math dbase -C -o ada-control.c
-@end ifclear
-@ifset vms
-@item gnatbind /NOMAIN math dbase /BIND_FILE=C /OUTPUT=ada-control.c
-@end ifset
-The main program is in a language other than Ada, but calls to
-subprograms in packages @code{Math} and @code{Dbase} appear. This call
-to @code{gnatbind} generates the file @file{ada-control.c} containing
-the @code{adainit} and @code{adafinal} routines to be called before and
-after accessing the Ada units.
+spec. Note that if this option is used, then linking must be done manually,
+since gnatlink will not be able to find the generated file.
@end table
@c ------------------------------------
@@ -8865,8 +8877,12 @@ driver (see @ref{The GNAT Driver and Project Files}).
The form of the @command{gnatlink} command is
@smallexample
-$ gnatlink @ovar{switches} @var{mainprog}@r{[}.ali@r{]}
- @ovar{non-Ada objects} @ovar{linker options}
+@c $ gnatlink @ovar{switches} @var{mainprog}@r{[}.ali@r{]}
+@c @ovar{non-Ada objects} @ovar{linker options}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatlink @r{[}@var{switches}@r{]} @var{mainprog}@r{[}.ali@r{]}
+ @r{[}@var{non-Ada objects}@r{]} @r{[}@var{linker options}@r{]}
+
@end smallexample
@noindent
@@ -8947,17 +8963,6 @@ Display Copyright and version, then exit disregarding all other options.
If @option{--version} was not used, display usage, then exit disregarding
all other options.
-@item ^-A^/BIND_FILE=ADA^
-@cindex @option{^-A^/BIND_FILE=ADA^} (@command{gnatlink})
-The binder has generated code in Ada. This is the default.
-
-@item ^-C^/BIND_FILE=C^
-@cindex @option{^-C^/BIND_FILE=C^} (@command{gnatlink})
-If instead of generating a file in Ada, the binder has generated one in
-C, then the linker needs to know about it. Use this switch to signal
-to @command{gnatlink} that the binder has generated C code rather than
-Ada code.
-
@item ^-f^/FORCE_OBJECT_FILE_LIST^
@cindex Command line length
@cindex @option{^-f^/FORCE_OBJECT_FILE_LIST^} (@command{gnatlink})
@@ -9144,8 +9149,11 @@ dependencies, they will always be tracked exactly correctly by
The usual form of the @command{gnatmake} command is
@smallexample
-$ gnatmake @ovar{switches} @var{file_name}
- @ovar{file_names} @ovar{mode_switches}
+@c $ gnatmake @ovar{switches} @var{file_name}
+@c @ovar{file_names} @ovar{mode_switches}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatmake @r{[}@var{switches}@r{]} @var{file_name}
+ @r{[}@var{file_names}@r{]} @r{[}@var{mode_switches}@r{]}
@end smallexample
@noindent
@@ -9233,6 +9241,15 @@ itself must not include any embedded spaces.
@end ifclear
+@item ^--subdirs^/SUBDIRS^=subdir
+Actual object directory of each project file is the subdirectory subdir of the
+object directory specified or defauted in the project file.
+
+@item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^
+By default, shared library projects are not allowed to import static library
+projects. When this switch is used on the command line, this restriction is
+relaxed.
+
@item ^-a^/ALL_FILES^
@cindex @option{^-a^/ALL_FILES^} (@command{gnatmake})
Consider all files in the make process, even the GNAT internal system
@@ -10670,6 +10687,7 @@ program.
@menu
* About gnatelim::
* Running gnatelim::
+* Processing Precompiled Libraries::
* Correcting the List of Eliminate Pragmas::
* Making Your Executables Smaller::
* Summary of the gnatelim Usage Cycle::
@@ -10693,20 +10711,24 @@ because the compiler will not generate the code for 'eliminated' subprograms.
@xref{Pragma Eliminate,,, gnat_rm, GNAT Reference Manual}, for more
information about this pragma.
-@code{gnatelim} needs as its input data the name of the main subprogram
-and a bind file for a main subprogram.
+@code{gnatelim} needs as its input data the name of the main subprogram.
+
+If a set of source files is specified as @code{gnatelim} arguments, it
+treats these files as a complete set of sources making up a program to
+analyse, and analyses only these sources.
-To create a bind file for @code{gnatelim}, run @code{gnatbind} for
-the main subprogram. @code{gnatelim} can work with both Ada and C
-bind files; when both are present, it uses the Ada bind file.
-The following commands will build the program and create the bind file:
+After a full successful build of the main subprogram @code{gnatelim} can be
+called without specifying sources to analyse, in this case it computes
+the source closure of the main unit from the @file{ALI} files.
+
+The following command will create the set of @file{ALI} files needed for
+@code{gnatelim}:
@smallexample
$ gnatmake ^-c Main_Prog^/ACTIONS=COMPILE MAIN_PROG^
-$ gnatbind main_prog
@end smallexample
-Note that @code{gnatelim} needs neither object nor ALI files.
+Note that @code{gnatelim} does not need object files.
@node Running gnatelim
@subsection Running @code{gnatelim}
@@ -10715,23 +10737,64 @@ Note that @code{gnatelim} needs neither object nor ALI files.
@code{gnatelim} has the following command-line interface:
@smallexample
-$ gnatelim @ovar{options} name
+$ gnatelim [@var{switches}] ^-main^?MAIN^=@var{main_unit_name} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]}
@end smallexample
@noindent
-@code{name} should be a name of a source file that contains the main subprogram
-of a program (partition).
+@var{main_unit_name} should be a name of a source file that contains the main
+subprogram of a program (partition).
+
+Each @var{filename} is the name (including the extension) of a source
+file to process. ``Wildcards'' are allowed, and
+the file name may contain path information.
+
+@samp{@var{gcc_switches}} is a list of switches for
+@command{gcc}. They will be passed on to all compiler invocations made by
+@command{gnatelim} to generate the ASIS trees. Here you can provide
+@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
+use the @option{-gnatec} switch to set the configuration file etc.
@code{gnatelim} has the following switches:
@table @option
@c !sort!
+@item ^-files^/FILES^=@var{filename}
+@cindex @option{^-files^/FILES^} (@code{gnatelim})
+Take the argument source files from the specified file. This file should be an
+ordinary text file containing file names separated by spaces or
+line breaks. You can use this switch more than once in the same call to
+@command{gnatelim}. You also can combine this switch with
+an explicit list of files.
+
+@item ^-log^/LOG^
+@cindex @option{^-log^/LOG^} (@command{gnatelim})
+Duplicate all the output sent to @file{stderr} into a log file. The log file
+is named @file{gnatelim.log} and is located in the current directory.
+
+@item ^-log^/LOGFILE^=@var{filename}
+@cindex @option{^-log^/LOGFILE^} (@command{gnatelim})
+Duplicate all the output sent to @file{stderr} into a specified log file.
+
+@cindex @option{^--no-elim-dispatch^/NO_DISPATCH^} (@command{gnatelim})
+@item ^--no-elim-dispatch^/NO_DISPATCH^
+Do not generate pragmas for dispatching operations.
+
+@cindex @option{^-o^/OUTPUT^} (@command{gnatelim})
+@item ^-o^/OUTPUT^=@var{report_file}
+Put @command{gnatelim} output into a specified file. If this file already exists,
+it is overridden. If this switch is not used, @command{gnatelim} outputs its results
+into @file{stderr}
+
@item ^-q^/QUIET^
@cindex @option{^-q^/QUIET^} (@command{gnatelim})
Quiet mode: by default @code{gnatelim} outputs to the standard error
stream the number of program units left to be processed. This option turns
this trace off.
+@cindex @option{^-t^/TIME^} (@command{gnatelim})
+@item ^-t^/TIME^
+Print out execution time.
+
@item ^-v^/VERBOSE^
@cindex @option{^-v^/VERBOSE^} (@command{gnatelim})
Verbose mode: @code{gnatelim} version information is printed as Ada
@@ -10739,67 +10802,24 @@ comments to the standard output stream. Also, in addition to the number of
program units left @code{gnatelim} will output the name of the current unit
being processed.
-@item ^-a^/ALL^
-@cindex @option{^-a^/ALL^} (@command{gnatelim})
-Also look for subprograms from the GNAT run time that can be eliminated. Note
-that when @file{gnat.adc} is produced using this switch, the entire program
-must be recompiled with switch @option{^-a^/ALL_FILES^} to @command{gnatmake}.
-
-@item ^-I^/INCLUDE_DIRS=^@var{dir}
-@cindex @option{^-I^/INCLUDE_DIRS^} (@command{gnatelim})
-When looking for source files also look in directory @var{dir}. Specifying
-@option{^-I-^/INCLUDE_DIRS=-^} instructs @code{gnatelim} not to look for
-sources in the current directory.
-
-@item ^-b^/BIND_FILE=^@var{bind_file}
-@cindex @option{^-b^/BIND_FILE^} (@command{gnatelim})
-Specifies @var{bind_file} as the bind file to process. If not set, the name
-of the bind file is computed from the full expanded Ada name
-of a main subprogram.
-
-@item ^-C^/CONFIG_FILE=^@var{config_file}
-@cindex @option{^-C^/CONFIG_FILE^} (@command{gnatelim})
-Specifies a file @var{config_file} that contains configuration pragmas. The
-file must be specified with full path.
-
-@item ^--GCC^/COMPILER^=@var{compiler_name}
-@cindex @option{^-GCC^/COMPILER^} (@command{gnatelim})
-Instructs @code{gnatelim} to use specific @command{gcc} compiler instead of one
-available on the path.
-
-@item ^--GNATMAKE^/GNATMAKE^=@var{gnatmake_name}
-@cindex @option{^--GNATMAKE^/GNATMAKE^} (@command{gnatelim})
-Instructs @code{gnatelim} to use specific @command{gnatmake} instead of one
-available on the path.
+@item ^-wq^/WARNINGS=QUIET^
+@cindex @option{^-wq^/WARNINGS=QUIET^} (@command{gnatelim})
+Quet warning mode - some warnings are suppressed. In particular warnings that
+indicate that the analysed set of sources is incomplete to make up a
+partition and that some subprogram bodies are missing are not generated.
@end table
-@noindent
-@code{gnatelim} sends its output to the standard output stream, and all the
-tracing and debug information is sent to the standard error stream.
-In order to produce a proper GNAT configuration file
-@file{gnat.adc}, redirection must be used:
-
-@smallexample
-@ifset vms
-$ PIPE GNAT ELIM MAIN_PROG.ADB > GNAT.ADC
-@end ifset
-@ifclear vms
-$ gnatelim main_prog.adb > gnat.adc
-@end ifclear
-@end smallexample
-
-@ifclear vms
-@noindent
-or
-
-@smallexample
-$ gnatelim main_prog.adb >> gnat.adc
-@end smallexample
+@node Processing Precompiled Libraries
+@subsection Processing Precompiled Libraries
@noindent
-in order to append the @code{gnatelim} output to the existing contents of
-@file{gnat.adc}.
-@end ifclear
+If some program uses a precompiled Ada library, it can be processed by
+@code{gnatelim} in a usual way. @code{gnatelim} will newer generate an
+Eliminate pragma for a subprogram if the body of this subprogram has not
+been analysed, this is a typical case for subprograms from precompiled
+libraries. Switch @option{^-wq^/WARNINGS=QUIET^} may be used to suppress
+warnings about missing source files and non-analyzed subprogram bodies
+that can be generated when processing precompiled Ada libraries.
@node Correcting the List of Eliminate Pragmas
@subsection Correcting the List of Eliminate Pragmas
@@ -10810,22 +10830,23 @@ subprograms that are actually called in the program. In this case, the
compiler will generate an error message of the form:
@smallexample
-file.adb:106:07: cannot call eliminated subprogram "My_Prog"
+main.adb:4:08: cannot reference subprogram "P" eliminated at elim.out:5
@end smallexample
@noindent
You will need to manually remove the wrong @code{Eliminate} pragmas from
-the @file{gnat.adc} file. You should recompile your program
-from scratch after that, because you need a consistent @file{gnat.adc} file
-during the entire compilation.
+the configuration file indicated in the error message. You should recompile
+your program from scratch after that, because you need a consistent
+configuration file(s) during the entire compilation.
@node Making Your Executables Smaller
@subsection Making Your Executables Smaller
@noindent
In order to get a smaller executable for your program you now have to
-recompile the program completely with the new @file{gnat.adc} file
-created by @code{gnatelim} in your current directory:
+recompile the program completely with the configuration file containing
+pragmas Eliminate generated by gnatelim. If these pragmas are placed in
+@file{gnat.adc} file located in your current directory, just do:
@smallexample
$ gnatmake ^-f main_prog^/FORCE_COMPILE MAIN_PROG^
@@ -10839,10 +10860,10 @@ with the set of pragmas @code{Eliminate} that you have obtained with
Be aware that the set of @code{Eliminate} pragmas is specific to each
program. It is not recommended to merge sets of @code{Eliminate}
-pragmas created for different programs in one @file{gnat.adc} file.
+pragmas created for different programs in one configuration file.
@node Summary of the gnatelim Usage Cycle
-@subsection Summary of the gnatelim Usage Cycle
+@subsection Summary of the @code{gnatelim} Usage Cycle
@noindent
Here is a quick summary of the steps to be taken in order to reduce
@@ -10852,15 +10873,16 @@ to produce the debugging information, to set search path, etc.
@enumerate
@item
-Produce a bind file
+Create a complete set of @file{ALI} files (if the program has not been
+built already)
@smallexample
$ gnatmake ^-c main_prog^/ACTIONS=COMPILE MAIN_PROG^
-$ gnatbind main_prog
@end smallexample
@item
-Generate a list of @code{Eliminate} pragmas
+Generate a list of @code{Eliminate} pragmas in default configuration file
+@file{gnat.adc} in the current directory
@smallexample
@ifset vms
$ PIPE GNAT ELIM MAIN_PROG > GNAT.ADC
@@ -11119,8 +11141,11 @@ in which GNAT processes the ACVC tests.
The @code{gnatchop} command has the form:
@smallexample
+@c $ gnatchop switches @var{file name} @r{[}@var{file name} @dots{}@r{]}
+@c @ovar{directory}
+@c Expanding @ovar macro inline (explanation in macro def comments)
$ gnatchop switches @var{file name} @r{[}@var{file name} @dots{}@r{]}
- @ovar{directory}
+ @r{[}@var{directory}@r{]}
@end smallexample
@noindent
@@ -11376,6 +11401,8 @@ recognized by GNAT:
Ada_95
Ada_05
Ada_2005
+ Ada_12
+ Ada_2012
Assertion_Policy
Assume_No_Invalid_Values
C_Pass_By_Copy
@@ -11419,6 +11446,7 @@ recognized by GNAT:
Restrictions
Restrictions_Warnings
Reviewable
+ Short_Circuit_And_Or
Source_File_Name
Source_File_Name_Project
Style_Checks
@@ -11546,8 +11574,11 @@ set of files.
The usual form of the @code{gnatname} command is
@smallexample
-$ gnatname @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}
- @r{[}--and @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}@r{]}
+@c $ gnatname @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}
+@c @r{[}--and @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}@r{]}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatname @r{[}@var{switches}@r{]} @var{naming_pattern} @r{[}@var{naming_patterns}@r{]}
+ @r{[}--and @r{[}@var{switches}@r{]} @var{naming_pattern} @r{[}@var{naming_patterns}@r{]}@r{]}
@end smallexample
@noindent
@@ -11563,7 +11594,8 @@ regular files.
@noindent
One or several Naming Patterns may be given as arguments to @code{gnatname}.
-Each Naming Pattern is enclosed between double quotes.
+Each Naming Pattern is enclosed between double quotes (or single
+quotes on Windows).
A Naming Pattern is a regular expression similar to the wildcard patterns
used in file names by the Unix shells or the DOS prompt.
@@ -11762,3599 +11794,58 @@ are used in this example.
@c *****************************************
@c * G N A T P r o j e c t M a n a g e r *
@c *****************************************
-@node GNAT Project Manager
-@chapter GNAT Project Manager
-
-@menu
-* Introduction::
-* Examples of Project Files::
-* Project File Syntax::
-* Objects and Sources in Project Files::
-* Importing Projects::
-* Project Extension::
-* Project Hierarchy Extension::
-* External References in Project Files::
-* Packages in Project Files::
-* Variables from Imported Projects::
-* Naming Schemes::
-* Library Projects::
-* Stand-alone Library Projects::
-* Switches Related to Project Files::
-* Tools Supporting Project Files::
-* An Extended Example::
-* Project File Complete Syntax::
-@end menu
-
-@c ****************
-@c * Introduction *
-@c ****************
-
-@node Introduction
-@section Introduction
-
-@noindent
-This chapter describes GNAT's @emph{Project Manager}, a facility that allows
-you to manage complex builds involving a number of source files, directories,
-and compilation options for different system configurations. In particular,
-project files allow you to specify:
-@itemize @bullet
-@item
-The directory or set of directories containing the source files, and/or the
-names of the specific source files themselves
-@item
-The directory in which the compiler's output
-(@file{ALI} files, object files, tree files) is to be placed
-@item
-The directory in which the executable programs is to be placed
-@item
-^Switch^Switch^ settings for any of the project-enabled tools
-(@command{gnatmake}, compiler, binder, linker, @code{gnatls}, @code{gnatxref},
-@code{gnatfind}); you can apply these settings either globally or to individual
-compilation units.
-@item
-The source files containing the main subprogram(s) to be built
-@item
-The source programming language(s) (currently Ada and/or C)
-@item
-Source file naming conventions; you can specify these either globally or for
-individual compilation units
-@end itemize
-
-@menu
-* Project Files::
-@end menu
-
-@node Project Files
-@subsection Project Files
-
-@noindent
-Project files are written in a syntax close to that of Ada, using familiar
-notions such as packages, context clauses, declarations, default values,
-assignments, and inheritance. Finally, project files can be built
-hierarchically from other project files, simplifying complex system
-integration and project reuse.
-
-A @dfn{project} is a specific set of values for various compilation properties.
-The settings for a given project are described by means of
-a @dfn{project file}, which is a text file written in an Ada-like syntax.
-Property values in project files are either strings or lists of strings.
-Properties that are not explicitly set receive default values. A project
-file may interrogate the values of @dfn{external variables} (user-defined
-command-line switches or environment variables), and it may specify property
-settings conditionally, based on the value of such variables.
-
-In simple cases, a project's source files depend only on other source files
-in the same project, or on the predefined libraries. (@emph{Dependence} is
-used in
-the Ada technical sense; as in one Ada unit @code{with}ing another.) However,
-the Project Manager also allows more sophisticated arrangements,
-where the source files in one project depend on source files in other
-projects:
-@itemize @bullet
-@item
-One project can @emph{import} other projects containing needed source files.
-@item
-You can organize GNAT projects in a hierarchy: a @emph{child} project
-can extend a @emph{parent} project, inheriting the parent's source files and
-optionally overriding any of them with alternative versions
-@end itemize
-
-@noindent
-More generally, the Project Manager lets you structure large development
-efforts into hierarchical subsystems, where build decisions are delegated
-to the subsystem level, and thus different compilation environments
-(^switch^switch^ settings) used for different subsystems.
-
-The Project Manager is invoked through the
-@option{^-P^/PROJECT_FILE=^@emph{projectfile}}
-switch to @command{gnatmake} or to the @command{^gnat^GNAT^} front driver.
-@ifclear vms
-There may be zero, one or more spaces between @option{-P} and
-@option{@emph{projectfile}}.
-@end ifclear
-If you want to define (on the command line) an external variable that is
-queried by the project file, you must use the
-@option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}} switch.
-The Project Manager parses and interprets the project file, and drives the
-invoked tool based on the project settings.
-
-The Project Manager supports a wide range of development strategies,
-for systems of all sizes. Here are some typical practices that are
-easily handled:
-@itemize @bullet
-@item
-Using a common set of source files, but generating object files in different
-directories via different ^switch^switch^ settings
-@item
-Using a mostly-shared set of source files, but with different versions of
-some unit or units
-@end itemize
-
-@noindent
-The destination of an executable can be controlled inside a project file
-using the @option{^-o^-o^}
-^switch^switch^.
-In the absence of such a ^switch^switch^ either inside
-the project file or on the command line, any executable files generated by
-@command{gnatmake} are placed in the directory @code{Exec_Dir} specified
-in the project file. If no @code{Exec_Dir} is specified, they will be placed
-in the object directory of the project.
-
-You can use project files to achieve some of the effects of a source
-versioning system (for example, defining separate projects for
-the different sets of sources that comprise different releases) but the
-Project Manager is independent of any source configuration management tools
-that might be used by the developers.
-
-The next section introduces the main features of GNAT's project facility
-through a sequence of examples; subsequent sections will present the syntax
-and semantics in more detail. A more formal description of the project
-facility appears in @ref{Project File Reference,,, gnat_rm, GNAT
-Reference Manual}.
-
-@c *****************************
-@c * Examples of Project Files *
-@c *****************************
-
-@node Examples of Project Files
-@section Examples of Project Files
-@noindent
-This section illustrates some of the typical uses of project files and
-explains their basic structure and behavior.
-
-@menu
-* Common Sources with Different ^Switches^Switches^ and Directories::
-* Using External Variables::
-* Importing Other Projects::
-* Extending a Project::
-@end menu
-
-@node Common Sources with Different ^Switches^Switches^ and Directories
-@subsection Common Sources with Different ^Switches^Switches^ and Directories
-
-@menu
-* Source Files::
-* Specifying the Object Directory::
-* Specifying the Exec Directory::
-* Project File Packages::
-* Specifying ^Switch^Switch^ Settings::
-* Main Subprograms::
-* Executable File Names::
-* Source File Naming Conventions::
-* Source Language(s)::
-@end menu
-
-@noindent
-Suppose that the Ada source files @file{pack.ads}, @file{pack.adb}, and
-@file{proc.adb} are in the @file{/common} directory. The file
-@file{proc.adb} contains an Ada main subprogram @code{Proc} that @code{with}s
-package @code{Pack}. We want to compile these source files under two sets
-of ^switches^switches^:
-@itemize @bullet
-@item
-When debugging, we want to pass the @option{-g} switch to @command{gnatmake},
-and the @option{^-gnata^-gnata^},
-@option{^-gnato^-gnato^},
-and @option{^-gnatE^-gnatE^} switches to the
-compiler; the compiler's output is to appear in @file{/common/debug}
-@item
-When preparing a release version, we want to pass the @option{^-O2^O2^} switch
-to the compiler; the compiler's output is to appear in @file{/common/release}
-@end itemize
-
-@noindent
-The GNAT project files shown below, respectively @file{debug.gpr} and
-@file{release.gpr} in the @file{/common} directory, achieve these effects.
-
-Schematically:
-@smallexample
-@group
-^/common^[COMMON]^
- debug.gpr
- release.gpr
- pack.ads
- pack.adb
- proc.adb
-@end group
-@group
-^/common/debug^[COMMON.DEBUG]^
- proc.ali, proc.o
- pack.ali, pack.o
-@end group
-@group
-^/common/release^[COMMON.RELEASE]^
- proc.ali, proc.o
- pack.ali, pack.o
-@end group
-@end smallexample
-Here are the corresponding project files:
-
-@smallexample @c projectfile
-@group
-project Debug is
- for Object_Dir use "debug";
- for Main use ("proc");
-
- package Builder is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-g^-g^");
- for Executable ("proc.adb") use "proc1";
- end Builder;
-@end group
-
-@group
- package Compiler is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("-fstack-check",
- "^-gnata^-gnata^",
- "^-gnato^-gnato^",
- "^-gnatE^-gnatE^");
- end Compiler;
-end Debug;
-@end group
-@end smallexample
-
-@smallexample @c projectfile
-@group
-project Release is
- for Object_Dir use "release";
- for Exec_Dir use ".";
- for Main use ("proc");
-
- package Compiler is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-O2^-O2^");
- end Compiler;
-end Release;
-@end group
-@end smallexample
-
-@noindent
-The name of the project defined by @file{debug.gpr} is @code{"Debug"} (case
-insensitive), and analogously the project defined by @file{release.gpr} is
-@code{"Release"}. For consistency the file should have the same name as the
-project, and the project file's extension should be @code{"gpr"}. These
-conventions are not required, but a warning is issued if they are not followed.
-
-If the current directory is @file{^/temp^[TEMP]^}, then the command
-@smallexample
-gnatmake ^-P/common/debug.gpr^/PROJECT_FILE=[COMMON]DEBUG^
-@end smallexample
-
-@noindent
-generates object and ALI files in @file{^/common/debug^[COMMON.DEBUG]^},
-as well as the @code{^proc1^PROC1.EXE^} executable,
-using the ^switch^switch^ settings defined in the project file.
-
-Likewise, the command
-@smallexample
-gnatmake ^-P/common/release.gpr^/PROJECT_FILE=[COMMON]RELEASE^
-@end smallexample
-
-@noindent
-generates object and ALI files in @file{^/common/release^[COMMON.RELEASE]^},
-and the @code{^proc^PROC.EXE^}
-executable in @file{^/common^[COMMON]^},
-using the ^switch^switch^ settings from the project file.
-
-@node Source Files
-@unnumberedsubsubsec Source Files
-
-@noindent
-If a project file does not explicitly specify a set of source directories or
-a set of source files, then by default the project's source files are the
-Ada source files in the project file directory. Thus @file{pack.ads},
-@file{pack.adb}, and @file{proc.adb} are the source files for both projects.
-
-@node Specifying the Object Directory
-@unnumberedsubsubsec Specifying the Object Directory
-
-@noindent
-Several project properties are modeled by Ada-style @emph{attributes};
-a property is defined by supplying the equivalent of an Ada attribute
-definition clause in the project file.
-A project's object directory is another such a property; the corresponding
-attribute is @code{Object_Dir}, and its value is also a string expression,
-specified either as absolute or relative. In the later case,
-it is relative to the project file directory. Thus the compiler's
-output is directed to @file{^/common/debug^[COMMON.DEBUG]^}
-(for the @code{Debug} project)
-and to @file{^/common/release^[COMMON.RELEASE]^}
-(for the @code{Release} project).
-If @code{Object_Dir} is not specified, then the default is the project file
-directory itself.
-
-@node Specifying the Exec Directory
-@unnumberedsubsubsec Specifying the Exec Directory
-
-@noindent
-A project's exec directory is another property; the corresponding
-attribute is @code{Exec_Dir}, and its value is also a string expression,
-either specified as relative or absolute. If @code{Exec_Dir} is not specified,
-then the default is the object directory (which may also be the project file
-directory if attribute @code{Object_Dir} is not specified). Thus the executable
-is placed in @file{^/common/debug^[COMMON.DEBUG]^}
-for the @code{Debug} project (attribute @code{Exec_Dir} not specified)
-and in @file{^/common^[COMMON]^} for the @code{Release} project.
-
-@node Project File Packages
-@unnumberedsubsubsec Project File Packages
-
-@noindent
-A GNAT tool that is integrated with the Project Manager is modeled by a
-corresponding package in the project file. In the example above,
-The @code{Debug} project defines the packages @code{Builder}
-(for @command{gnatmake}) and @code{Compiler};
-the @code{Release} project defines only the @code{Compiler} package.
-
-The Ada-like package syntax is not to be taken literally. Although packages in
-project files bear a surface resemblance to packages in Ada source code, the
-notation is simply a way to convey a grouping of properties for a named
-entity. Indeed, the package names permitted in project files are restricted
-to a predefined set, corresponding to the project-aware tools, and the contents
-of packages are limited to a small set of constructs.
-The packages in the example above contain attribute definitions.
-
-@node Specifying ^Switch^Switch^ Settings
-@unnumberedsubsubsec Specifying ^Switch^Switch^ Settings
-
-@noindent
-^Switch^Switch^ settings for a project-aware tool can be specified through
-attributes in the package that corresponds to the tool.
-The example above illustrates one of the relevant attributes,
-@code{^Default_Switches^Default_Switches^}, which is defined in packages
-in both project files.
-Unlike simple attributes like @code{Source_Dirs},
-@code{^Default_Switches^Default_Switches^} is
-known as an @emph{associative array}. When you define this attribute, you must
-supply an ``index'' (a literal string), and the effect of the attribute
-definition is to set the value of the array at the specified index.
-For the @code{^Default_Switches^Default_Switches^} attribute,
-the index is a programming language (in our case, Ada),
-and the value specified (after @code{use}) must be a list
-of string expressions.
-
-The attributes permitted in project files are restricted to a predefined set.
-Some may appear at project level, others in packages.
-For any attribute that is an associative array, the index must always be a
-literal string, but the restrictions on this string (e.g., a file name or a
-language name) depend on the individual attribute.
-Also depending on the attribute, its specified value will need to be either a
-string or a string list.
-
-In the @code{Debug} project, we set the switches for two tools,
-@command{gnatmake} and the compiler, and thus we include the two corresponding
-packages; each package defines the @code{^Default_Switches^Default_Switches^}
-attribute with index @code{"Ada"}.
-Note that the package corresponding to
-@command{gnatmake} is named @code{Builder}. The @code{Release} project is
-similar, but only includes the @code{Compiler} package.
-
-In project @code{Debug} above, the ^switches^switches^ starting with
-@option{-gnat} that are specified in package @code{Compiler}
-could have been placed in package @code{Builder}, since @command{gnatmake}
-transmits all such ^switches^switches^ to the compiler.
-
-@node Main Subprograms
-@unnumberedsubsubsec Main Subprograms
-
-@noindent
-One of the specifiable properties of a project is a list of files that contain
-main subprograms. This property is captured in the @code{Main} attribute,
-whose value is a list of strings. If a project defines the @code{Main}
-attribute, it is not necessary to identify the main subprogram(s) when
-invoking @command{gnatmake} (@pxref{gnatmake and Project Files}).
-
-@node Executable File Names
-@unnumberedsubsubsec Executable File Names
-
-@noindent
-By default, the executable file name corresponding to a main source is
-deduced from the main source file name. Through the attributes
-@code{Executable} and @code{Executable_Suffix} of package @code{Builder},
-it is possible to change this default.
-In project @code{Debug} above, the executable file name
-for main source @file{^proc.adb^PROC.ADB^} is
-@file{^proc1^PROC1.EXE^}.
-Attribute @code{Executable_Suffix}, when specified, may change the suffix
-of the executable files, when no attribute @code{Executable} applies:
-its value replace the platform-specific executable suffix.
-Attributes @code{Executable} and @code{Executable_Suffix} are the only ways to
-specify a non-default executable file name when several mains are built at once
-in a single @command{gnatmake} command.
-
-@node Source File Naming Conventions
-@unnumberedsubsubsec Source File Naming Conventions
-
-@noindent
-Since the project files above do not specify any source file naming
-conventions, the GNAT defaults are used. The mechanism for defining source
-file naming conventions -- a package named @code{Naming} --
-is described below (@pxref{Naming Schemes}).
-
-@node Source Language(s)
-@unnumberedsubsubsec Source Language(s)
-
-@noindent
-Since the project files do not specify a @code{Languages} attribute, by
-default the GNAT tools assume that the language of the project file is Ada.
-More generally, a project can comprise source files
-in Ada, C, and/or other languages.
-
-@node Using External Variables
-@subsection Using External Variables
-
-@noindent
-Instead of supplying different project files for debug and release, we can
-define a single project file that queries an external variable (set either
-on the command line or via an ^environment variable^logical name^) in order to
-conditionally define the appropriate settings. Again, assume that the
-source files @file{pack.ads}, @file{pack.adb}, and @file{proc.adb} are
-located in directory @file{^/common^[COMMON]^}. The following project file,
-@file{build.gpr}, queries the external variable named @code{STYLE} and
-defines an object directory and ^switch^switch^ settings based on whether
-the value is @code{"deb"} (debug) or @code{"rel"} (release), and where
-the default is @code{"deb"}.
-
-@smallexample @c projectfile
-@group
-project Build is
- for Main use ("proc");
-
- type Style_Type is ("deb", "rel");
- Style : Style_Type := external ("STYLE", "deb");
-
- case Style is
- when "deb" =>
- for Object_Dir use "debug";
-
- when "rel" =>
- for Object_Dir use "release";
- for Exec_Dir use ".";
- end case;
-@end group
-
-@group
- package Builder is
-
- case Style is
- when "deb" =>
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-g^-g^");
- for Executable ("proc") use "proc1";
- when others =>
- null;
- end case;
-
- end Builder;
-@end group
-
-@group
- package Compiler is
-
- case Style is
- when "deb" =>
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-gnata^-gnata^",
- "^-gnato^-gnato^",
- "^-gnatE^-gnatE^");
-
- when "rel" =>
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-O2^-O2^");
- end case;
-
- end Compiler;
-
-end Build;
-@end group
-@end smallexample
-
-@noindent
-@code{Style_Type} is an example of a @emph{string type}, which is the project
-file analog of an Ada enumeration type but whose components are string literals
-rather than identifiers. @code{Style} is declared as a variable of this type.
-
-The form @code{external("STYLE", "deb")} is known as an
-@emph{external reference}; its first argument is the name of an
-@emph{external variable}, and the second argument is a default value to be
-used if the external variable doesn't exist. You can define an external
-variable on the command line via the @option{^-X^/EXTERNAL_REFERENCE^} switch,
-or you can use ^an environment variable^a logical name^
-as an external variable.
-
-Each @code{case} construct is expanded by the Project Manager based on the
-value of @code{Style}. Thus the command
-@ifclear vms
-@smallexample
-gnatmake -P/common/build.gpr -XSTYLE=deb
-@end smallexample
-@end ifclear
-
-@ifset vms
-@smallexample
-gnatmake /PROJECT_FILE=[COMMON]BUILD.GPR /EXTERNAL_REFERENCE=STYLE=deb
-@end smallexample
-@end ifset
-
-@noindent
-is equivalent to the @command{gnatmake} invocation using the project file
-@file{debug.gpr} in the earlier example. So is the command
-@smallexample
-gnatmake ^-P/common/build.gpr^/PROJECT_FILE=[COMMON]BUILD.GPR^
-@end smallexample
-
-@noindent
-since @code{"deb"} is the default for @code{STYLE}.
-
-Analogously,
-
-@ifclear vms
-@smallexample
-gnatmake -P/common/build.gpr -XSTYLE=rel
-@end smallexample
-@end ifclear
-
-@ifset vms
-@smallexample
-GNAT MAKE /PROJECT_FILE=[COMMON]BUILD.GPR /EXTERNAL_REFERENCE=STYLE=rel
-@end smallexample
-@end ifset
-
-@noindent
-is equivalent to the @command{gnatmake} invocation using the project file
-@file{release.gpr} in the earlier example.
-
-@node Importing Other Projects
-@subsection Importing Other Projects
-@cindex @code{ADA_PROJECT_PATH}
-@cindex @code{GPR_PROJECT_PATH}
-
-@noindent
-A compilation unit in a source file in one project may depend on compilation
-units in source files in other projects. To compile this unit under
-control of a project file, the
-dependent project must @emph{import} the projects containing the needed source
-files.
-This effect is obtained using syntax similar to an Ada @code{with} clause,
-but where @code{with}ed entities are strings that denote project files.
-
-As an example, suppose that the two projects @code{GUI_Proj} and
-@code{Comm_Proj} are defined in the project files @file{gui_proj.gpr} and
-@file{comm_proj.gpr} in directories @file{^/gui^[GUI]^}
-and @file{^/comm^[COMM]^}, respectively.
-Suppose that the source files for @code{GUI_Proj} are
-@file{gui.ads} and @file{gui.adb}, and that the source files for
-@code{Comm_Proj} are @file{comm.ads} and @file{comm.adb}, where each set of
-files is located in its respective project file directory. Schematically:
-
-@smallexample
-@group
-^/gui^[GUI]^
- gui_proj.gpr
- gui.ads
- gui.adb
-@end group
-
-@group
-^/comm^[COMM]^
- comm_proj.gpr
- comm.ads
- comm.adb
-@end group
-@end smallexample
-
-@noindent
-We want to develop an application in directory @file{^/app^[APP]^} that
-@code{with} the packages @code{GUI} and @code{Comm}, using the properties of
-the corresponding project files (e.g.@: the ^switch^switch^ settings
-and object directory).
-Skeletal code for a main procedure might be something like the following:
-
-@smallexample @c ada
-@group
-with GUI, Comm;
-procedure App_Main is
- @dots{}
-begin
- @dots{}
-end App_Main;
-@end group
-@end smallexample
-
-@noindent
-Here is a project file, @file{app_proj.gpr}, that achieves the desired
-effect:
-
-@smallexample @c projectfile
-@group
-with "/gui/gui_proj", "/comm/comm_proj";
-project App_Proj is
- for Main use ("app_main");
-end App_Proj;
-@end group
-@end smallexample
-
-@noindent
-Building an executable is achieved through the command:
-@smallexample
-gnatmake ^-P/app/app_proj^/PROJECT_FILE=[APP]APP_PROJ^
-@end smallexample
-@noindent
-which will generate the @code{^app_main^APP_MAIN.EXE^} executable
-in the directory where @file{app_proj.gpr} resides.
-
-If an imported project file uses the standard extension (@code{^gpr^GPR^}) then
-(as illustrated above) the @code{with} clause can omit the extension.
-
-Our example specified an absolute path for each imported project file.
-Alternatively, the directory name of an imported object can be omitted
-if either
-@itemize @bullet
-@item
-The imported project file is in the same directory as the importing project
-file, or
-@item
-You have defined one or two ^environment variables^logical names^
-that includes the directory containing
-the needed project file. The syntax of @code{GPR_PROJECT_PATH} and
-@code{ADA_PROJECT_PATH} is the same as
-the syntax of @code{ADA_INCLUDE_PATH} and @code{ADA_OBJECTS_PATH}: a list of
-directory names separated by colons (semicolons on Windows).
-@end itemize
-
-@noindent
-Thus, if we define @code{ADA_PROJECT_PATH} or @code{GPR_PROJECT_PATH}
-to include @file{^/gui^[GUI]^} and
-@file{^/comm^[COMM]^}, then our project file @file{app_proj.gpr} can be written
-as follows:
-
-@smallexample @c projectfile
-@group
-with "gui_proj", "comm_proj";
-project App_Proj is
- for Main use ("app_main");
-end App_Proj;
-@end group
-@end smallexample
-
-@noindent
-Importing other projects can create ambiguities.
-For example, the same unit might be present in different imported projects, or
-it might be present in both the importing project and in an imported project.
-Both of these conditions are errors. Note that in the current version of
-the Project Manager, it is illegal to have an ambiguous unit even if the
-unit is never referenced by the importing project. This restriction may be
-relaxed in a future release.
-
-@node Extending a Project
-@subsection Extending a Project
-
-@noindent
-In large software systems it is common to have multiple
-implementations of a common interface; in Ada terms, multiple versions of a
-package body for the same spec. For example, one implementation
-might be safe for use in tasking programs, while another might only be used
-in sequential applications. This can be modeled in GNAT using the concept
-of @emph{project extension}. If one project (the ``child'') @emph{extends}
-another project (the ``parent'') then by default all source files of the
-parent project are inherited by the child, but the child project can
-override any of the parent's source files with new versions, and can also
-add new files. This facility is the project analog of a type extension in
-Object-Oriented Programming. Project hierarchies are permitted (a child
-project may be the parent of yet another project), and a project that
-inherits one project can also import other projects.
-
-As an example, suppose that directory @file{^/seq^[SEQ]^} contains the project
-file @file{seq_proj.gpr} as well as the source files @file{pack.ads},
-@file{pack.adb}, and @file{proc.adb}:
-
-@smallexample
-@group
-^/seq^[SEQ]^
- pack.ads
- pack.adb
- proc.adb
- seq_proj.gpr
-@end group
-@end smallexample
-
-@noindent
-Note that the project file can simply be empty (that is, no attribute or
-package is defined):
-
-@smallexample @c projectfile
-@group
-project Seq_Proj is
-end Seq_Proj;
-@end group
-@end smallexample
-
-@noindent
-implying that its source files are all the Ada source files in the project
-directory.
-
-Suppose we want to supply an alternate version of @file{pack.adb}, in
-directory @file{^/tasking^[TASKING]^}, but use the existing versions of
-@file{pack.ads} and @file{proc.adb}. We can define a project
-@code{Tasking_Proj} that inherits @code{Seq_Proj}:
-
-@smallexample
-@group
-^/tasking^[TASKING]^
- pack.adb
- tasking_proj.gpr
-@end group
-
-@group
-project Tasking_Proj extends "/seq/seq_proj" is
-end Tasking_Proj;
-@end group
-@end smallexample
-
-@noindent
-The version of @file{pack.adb} used in a build depends on which project file
-is specified.
-
-Note that we could have obtained the desired behavior using project import
-rather than project inheritance; a @code{base} project would contain the
-sources for @file{pack.ads} and @file{proc.adb}, a sequential project would
-import @code{base} and add @file{pack.adb}, and likewise a tasking project
-would import @code{base} and add a different version of @file{pack.adb}. The
-choice depends on whether other sources in the original project need to be
-overridden. If they do, then project extension is necessary, otherwise,
-importing is sufficient.
-
-@noindent
-In a project file that extends another project file, it is possible to
-indicate that an inherited source is not part of the sources of the extending
-project. This is necessary sometimes when a package spec has been overloaded
-and no longer requires a body: in this case, it is necessary to indicate that
-the inherited body is not part of the sources of the project, otherwise there
-will be a compilation error when compiling the spec.
-
-For that purpose, the attribute @code{Excluded_Source_Files} is used.
-Its value is a string list: a list of file names. It is also possible to use
-attribute @code{Excluded_Source_List_File}. Its value is a single string:
-the file name of a text file containing a list of file names, one per line.
-
-@smallexample @c @projectfile
-project B extends "a" is
- for Source_Files use ("pkg.ads");
- -- New spec of Pkg does not need a completion
- for Excluded_Source_Files use ("pkg.adb");
-end B;
-@end smallexample
-
-Attribute @code{Excluded_Source_Files} may also be used to check if a source
-is still needed: if it is possible to build using @command{gnatmake} when such
-a source is put in attribute @code{Excluded_Source_Files} of a project P, then
-it is possible to remove the source completely from a system that includes
-project P.
-
-@c ***********************
-@c * Project File Syntax *
-@c ***********************
-
-@node Project File Syntax
-@section Project File Syntax
-
-@menu
-* Basic Syntax::
-* Qualified Projects::
-* Packages::
-* Expressions::
-* String Types::
-* Variables::
-* Attributes::
-* Associative Array Attributes::
-* case Constructions::
-@end menu
-
-@noindent
-This section describes the structure of project files.
-
-A project may be an @emph{independent project}, entirely defined by a single
-project file. Any Ada source file in an independent project depends only
-on the predefined library and other Ada source files in the same project.
-
-@noindent
-A project may also @dfn{depend on} other projects, in either or both of
-the following ways:
-@itemize @bullet
-@item It may import any number of projects
-@item It may extend at most one other project
-@end itemize
-
-@noindent
-The dependence relation is a directed acyclic graph (the subgraph reflecting
-the ``extends'' relation is a tree).
-
-A project's @dfn{immediate sources} are the source files directly defined by
-that project, either implicitly by residing in the project file's directory,
-or explicitly through any of the source-related attributes described below.
-More generally, a project @var{proj}'s @dfn{sources} are the immediate sources
-of @var{proj} together with the immediate sources (unless overridden) of any
-project on which @var{proj} depends (either directly or indirectly).
-
-@node Basic Syntax
-@subsection Basic Syntax
-
-@noindent
-As seen in the earlier examples, project files have an Ada-like syntax.
-The minimal project file is:
-@smallexample @c projectfile
-@group
-project Empty is
-
-end Empty;
-@end group
-@end smallexample
-
-@noindent
-The identifier @code{Empty} is the name of the project.
-This project name must be present after the reserved
-word @code{end} at the end of the project file, followed by a semi-colon.
-
-Any name in a project file, such as the project name or a variable name,
-has the same syntax as an Ada identifier.
-
-The reserved words of project files are the Ada 95 reserved words plus
-@code{extends}, @code{external}, and @code{project}. Note that the only Ada
-reserved words currently used in project file syntax are:
-
-@itemize @bullet
-@item
-@code{all}
-@item
-@code{at}
-@item
-@code{case}
-@item
-@code{end}
-@item
-@code{for}
-@item
-@code{is}
-@item
-@code{limited}
-@item
-@code{null}
-@item
-@code{others}
-@item
-@code{package}
-@item
-@code{renames}
-@item
-@code{type}
-@item
-@code{use}
-@item
-@code{when}
-@item
-@code{with}
-@end itemize
-
-@noindent
-Comments in project files have the same syntax as in Ada, two consecutive
-hyphens through the end of the line.
-
-@node Qualified Projects
-@subsection Qualified Projects
-
-@noindent
-Before the reserved @code{project}, there may be one or two "qualifiers", that
-is identifiers or other reserved words, to qualify the project.
-
-The current list of qualifiers is:
-
-@itemize @bullet
-@item
-@code{abstract}: qualify a project with no sources. A qualified abstract
-project must either have no declaration of attributes @code{Source_Dirs},
-@code{Source_Files}, @code{Languages} or @code{Source_List_File}, or one of
-@code{Source_Dirs}, @code{Source_Files}, or @code{Languages} must be declared
-as empty. If it extends another project, the project it extends must also be a
-qualified abstract project.
-
-@item
-@code{standard}: a standard project is a non library project with sources.
-
-@item
-@code{aggregate}: for future extension
-
-@item
-@code{aggregate library}: for future extension
-
-@item
-@code{library}: a library project must declare both attributes
-@code{Library_Name} and @code{Library_Dir}.
-
-@item
-@code{configuration}: a configuration project cannot be in a project tree.
-@end itemize
-
-@node Packages
-@subsection Packages
-
-@noindent
-A project file may contain @emph{packages}. The name of a package must be one
-of the identifiers from the following list. A package
-with a given name may only appear once in a project file. Package names are
-case insensitive. The following package names are legal:
-
-@itemize @bullet
-@item
-@code{Naming}
-@item
-@code{Builder}
-@item
-@code{Compiler}
-@item
-@code{Binder}
-@item
-@code{Linker}
-@item
-@code{Finder}
-@item
-@code{Cross_Reference}
-@item
-@code{Check}
-@item
-@code{Eliminate}
-@item
-@code{Pretty_Printer}
-@item
-@code{Metrics}
-@item
-@code{gnatls}
-@item
-@code{gnatstub}
-@item
-@code{IDE}
-@item
-@code{Language_Processing}
-@end itemize
-
-@noindent
-In its simplest form, a package may be empty:
-
-@smallexample @c projectfile
-@group
-project Simple is
- package Builder is
- end Builder;
-end Simple;
-@end group
-@end smallexample
-
-@noindent
-A package may contain @emph{attribute declarations},
-@emph{variable declarations} and @emph{case constructions}, as will be
-described below.
-
-When there is ambiguity between a project name and a package name,
-the name always designates the project. To avoid possible confusion, it is
-always a good idea to avoid naming a project with one of the
-names allowed for packages or any name that starts with @code{gnat}.
-
-@node Expressions
-@subsection Expressions
-
-@noindent
-An @emph{expression} is either a @emph{string expression} or a
-@emph{string list expression}.
-
-A @emph{string expression} is either a @emph{simple string expression} or a
-@emph{compound string expression}.
-
-A @emph{simple string expression} is one of the following:
-@itemize @bullet
-@item A literal string; e.g.@: @code{"comm/my_proj.gpr"}
-@item A string-valued variable reference (@pxref{Variables})
-@item A string-valued attribute reference (@pxref{Attributes})
-@item An external reference (@pxref{External References in Project Files})
-@end itemize
-
-@noindent
-A @emph{compound string expression} is a concatenation of string expressions,
-using the operator @code{"&"}
-@smallexample
- Path & "/" & File_Name & ".ads"
-@end smallexample
-
-@noindent
-A @emph{string list expression} is either a
-@emph{simple string list expression} or a
-@emph{compound string list expression}.
-
-A @emph{simple string list expression} is one of the following:
-@itemize @bullet
-@item A parenthesized list of zero or more string expressions,
-separated by commas
-@smallexample
- File_Names := (File_Name, "gnat.adc", File_Name & ".orig");
- Empty_List := ();
-@end smallexample
-@item A string list-valued variable reference
-@item A string list-valued attribute reference
-@end itemize
-
-@noindent
-A @emph{compound string list expression} is the concatenation (using
-@code{"&"}) of a simple string list expression and an expression. Note that
-each term in a compound string list expression, except the first, may be
-either a string expression or a string list expression.
-
-@smallexample @c projectfile
-@group
- File_Name_List := () & File_Name; -- One string in this list
- Extended_File_Name_List := File_Name_List & (File_Name & ".orig");
- -- Two strings
- Big_List := File_Name_List & Extended_File_Name_List;
- -- Concatenation of two string lists: three strings
- Illegal_List := "gnat.adc" & Extended_File_Name_List;
- -- Illegal: must start with a string list
-@end group
-@end smallexample
-
-@node String Types
-@subsection String Types
-
-@noindent
-A @emph{string type declaration} introduces a discrete set of string literals.
-If a string variable is declared to have this type, its value
-is restricted to the given set of literals.
-
-Here is an example of a string type declaration:
-
-@smallexample @c projectfile
- type OS is ("NT", "nt", "Unix", "GNU/Linux", "other OS");
-@end smallexample
-
-@noindent
-Variables of a string type are called @emph{typed variables}; all other
-variables are called @emph{untyped variables}. Typed variables are
-particularly useful in @code{case} constructions, to support conditional
-attribute declarations.
-(@pxref{case Constructions}).
-
-The string literals in the list are case sensitive and must all be different.
-They may include any graphic characters allowed in Ada, including spaces.
-
-A string type may only be declared at the project level, not inside a package.
-
-A string type may be referenced by its name if it has been declared in the same
-project file, or by an expanded name whose prefix is the name of the project
-in which it is declared.
-
-@node Variables
-@subsection Variables
-
-@noindent
-A variable may be declared at the project file level, or within a package.
-Here are some examples of variable declarations:
-
-@smallexample @c projectfile
-@group
- This_OS : OS := external ("OS"); -- a typed variable declaration
- That_OS := "GNU/Linux"; -- an untyped variable declaration
-@end group
-@end smallexample
-
-@noindent
-The syntax of a @emph{typed variable declaration} is identical to the Ada
-syntax for an object declaration. By contrast, the syntax of an untyped
-variable declaration is identical to an Ada assignment statement. In fact,
-variable declarations in project files have some of the characteristics of
-an assignment, in that successive declarations for the same variable are
-allowed. Untyped variable declarations do establish the expected kind of the
-variable (string or string list), and successive declarations for it must
-respect the initial kind.
-
-@noindent
-A string variable declaration (typed or untyped) declares a variable
-whose value is a string. This variable may be used as a string expression.
-@smallexample @c projectfile
- File_Name := "readme.txt";
- Saved_File_Name := File_Name & ".saved";
-@end smallexample
-
-@noindent
-A string list variable declaration declares a variable whose value is a list
-of strings. The list may contain any number (zero or more) of strings.
-
-@smallexample @c projectfile
- Empty_List := ();
- List_With_One_Element := ("^-gnaty^-gnaty^");
- List_With_Two_Elements := List_With_One_Element & "^-gnatg^-gnatg^";
- Long_List := ("main.ada", "pack1_.ada", "pack1.ada", "pack2_.ada"
- "pack2.ada", "util_.ada", "util.ada");
-@end smallexample
-
-@noindent
-The same typed variable may not be declared more than once at project level,
-and it may not be declared more than once in any package; it is in effect
-a constant.
-
-The same untyped variable may be declared several times. Declarations are
-elaborated in the order in which they appear, so the new value replaces
-the old one, and any subsequent reference to the variable uses the new value.
-However, as noted above, if a variable has been declared as a string, all
-subsequent
-declarations must give it a string value. Similarly, if a variable has
-been declared as a string list, all subsequent declarations
-must give it a string list value.
-
-A @emph{variable reference} may take several forms:
-
-@itemize @bullet
-@item The simple variable name, for a variable in the current package (if any)
-or in the current project
-@item An expanded name, whose prefix is a context name.
-@end itemize
-
-@noindent
-A @emph{context} may be one of the following:
-
-@itemize @bullet
-@item The name of an existing package in the current project
-@item The name of an imported project of the current project
-@item The name of an ancestor project (i.e., a project extended by the current
-project, either directly or indirectly)
-@item An expanded name whose prefix is an imported/parent project name, and
-whose selector is a package name in that project.
-@end itemize
-
-@noindent
-A variable reference may be used in an expression.
-
-@node Attributes
-@subsection Attributes
-
-@noindent
-A project (and its packages) may have @emph{attributes} that define
-the project's properties. Some attributes have values that are strings;
-others have values that are string lists.
-
-There are two categories of attributes: @emph{simple attributes}
-and @emph{associative arrays} (@pxref{Associative Array Attributes}).
-
-Legal project attribute names, and attribute names for each legal package are
-listed below. Attributes names are case-insensitive.
-
-The following attributes are defined on projects (all are simple attributes):
-
-@multitable @columnfractions .4 .3
-@item @emph{Attribute Name}
-@tab @emph{Value}
-@item @code{Source_Files}
-@tab string list
-@item @code{Source_Dirs}
-@tab string list
-@item @code{Source_List_File}
-@tab string
-@item @code{Object_Dir}
-@tab string
-@item @code{Exec_Dir}
-@tab string
-@item @code{Excluded_Source_Dirs}
-@tab string list
-@item @code{Excluded_Source_Files}
-@tab string list
-@item @code{Excluded_Source_List_File}
-@tab string
-@item @code{Languages}
-@tab string list
-@item @code{Main}
-@tab string list
-@item @code{Library_Dir}
-@tab string
-@item @code{Library_Name}
-@tab string
-@item @code{Library_Kind}
-@tab string
-@item @code{Library_Version}
-@tab string
-@item @code{Library_Interface}
-@tab string
-@item @code{Library_Auto_Init}
-@tab string
-@item @code{Library_Options}
-@tab string list
-@item @code{Library_Src_Dir}
-@tab string
-@item @code{Library_ALI_Dir}
-@tab string
-@item @code{Library_GCC}
-@tab string
-@item @code{Library_Symbol_File}
-@tab string
-@item @code{Library_Symbol_Policy}
-@tab string
-@item @code{Library_Reference_Symbol_File}
-@tab string
-@item @code{Externally_Built}
-@tab string
-@end multitable
-
-@noindent
-The following attributes are defined for package @code{Naming}
-(@pxref{Naming Schemes}):
-
-@multitable @columnfractions .4 .2 .2 .2
-@item Attribute Name @tab Category @tab Index @tab Value
-@item @code{Spec_Suffix}
-@tab associative array
-@tab language name
-@tab string
-@item @code{Body_Suffix}
-@tab associative array
-@tab language name
-@tab string
-@item @code{Separate_Suffix}
-@tab simple attribute
-@tab n/a
-@tab string
-@item @code{Casing}
-@tab simple attribute
-@tab n/a
-@tab string
-@item @code{Dot_Replacement}
-@tab simple attribute
-@tab n/a
-@tab string
-@item @code{Spec}
-@tab associative array
-@tab Ada unit name
-@tab string
-@item @code{Body}
-@tab associative array
-@tab Ada unit name
-@tab string
-@item @code{Specification_Exceptions}
-@tab associative array
-@tab language name
-@tab string list
-@item @code{Implementation_Exceptions}
-@tab associative array
-@tab language name
-@tab string list
-@end multitable
-
-@noindent
-The following attributes are defined for packages @code{Builder},
-@code{Compiler}, @code{Binder},
-@code{Linker}, @code{Cross_Reference}, and @code{Finder}
-(@pxref{^Switches^Switches^ and Project Files}).
-
-@multitable @columnfractions .4 .2 .2 .2
-@item Attribute Name @tab Category @tab Index @tab Value
-@item @code{^Default_Switches^Default_Switches^}
-@tab associative array
-@tab language name
-@tab string list
-@item @code{^Switches^Switches^}
-@tab associative array
-@tab file name
-@tab string list
-@end multitable
-
-@noindent
-In addition, package @code{Compiler} has a single string attribute
-@code{Local_Configuration_Pragmas} and package @code{Builder} has a single
-string attribute @code{Global_Configuration_Pragmas}.
-
-@noindent
-Each simple attribute has a default value: the empty string (for string-valued
-attributes) and the empty list (for string list-valued attributes).
-
-An attribute declaration defines a new value for an attribute.
-
-Examples of simple attribute declarations:
-
-@smallexample @c projectfile
- for Object_Dir use "objects";
- for Source_Dirs use ("units", "test/drivers");
-@end smallexample
-
-@noindent
-The syntax of a @dfn{simple attribute declaration} is similar to that of an
-attribute definition clause in Ada.
-
-Attributes references may be appear in expressions.
-The general form for such a reference is @code{<entity>'<attribute>}:
-Associative array attributes are functions. Associative
-array attribute references must have an argument that is a string literal.
-
-Examples are:
-
-@smallexample @c projectfile
- project'Object_Dir
- Naming'Dot_Replacement
- Imported_Project'Source_Dirs
- Imported_Project.Naming'Casing
- Builder'^Default_Switches^Default_Switches^("Ada")
-@end smallexample
-
-@noindent
-The prefix of an attribute may be:
-@itemize @bullet
-@item @code{project} for an attribute of the current project
-@item The name of an existing package of the current project
-@item The name of an imported project
-@item The name of a parent project that is extended by the current project
-@item An expanded name whose prefix is imported/parent project name,
-and whose selector is a package name
-@end itemize
-
-@noindent
-Example:
-@smallexample @c projectfile
-@group
- project Prj is
- for Source_Dirs use project'Source_Dirs & "units";
- for Source_Dirs use project'Source_Dirs & "test/drivers"
- end Prj;
-@end group
-@end smallexample
-
-@noindent
-In the first attribute declaration, initially the attribute @code{Source_Dirs}
-has the default value: an empty string list. After this declaration,
-@code{Source_Dirs} is a string list of one element: @code{"units"}.
-After the second attribute declaration @code{Source_Dirs} is a string list of
-two elements: @code{"units"} and @code{"test/drivers"}.
-
-Note: this example is for illustration only. In practice,
-the project file would contain only one attribute declaration:
-
-@smallexample @c projectfile
- for Source_Dirs use ("units", "test/drivers");
-@end smallexample
-
-@node Associative Array Attributes
-@subsection Associative Array Attributes
-
-@noindent
-Some attributes are defined as @emph{associative arrays}. An associative
-array may be regarded as a function that takes a string as a parameter
-and delivers a string or string list value as its result.
-
-Here are some examples of single associative array attribute associations:
-
-@smallexample @c projectfile
- for Body ("main") use "Main.ada";
- for ^Switches^Switches^ ("main.ada")
- use ("^-v^-v^",
- "^-gnatv^-gnatv^");
- for ^Switches^Switches^ ("main.ada")
- use Builder'^Switches^Switches^ ("main.ada")
- & "^-g^-g^";
-@end smallexample
-
-@noindent
-Like untyped variables and simple attributes, associative array attributes
-may be declared several times. Each declaration supplies a new value for the
-attribute, and replaces the previous setting.
-
-@noindent
-An associative array attribute may be declared as a full associative array
-declaration, with the value of the same attribute in an imported or extended
-project.
-
-@smallexample @c projectfile
- package Builder is
- for Default_Switches use Default.Builder'Default_Switches;
- end Builder;
-@end smallexample
-
-@noindent
-In this example, @code{Default} must be either a project imported by the
-current project, or the project that the current project extends. If the
-attribute is in a package (in this case, in package @code{Builder}), the same
-package needs to be specified.
-
-@noindent
-A full associative array declaration replaces any other declaration for the
-attribute, including other full associative array declaration. Single
-associative array associations may be declare after a full associative
-declaration, modifying the value for a single association of the attribute.
-
-@node case Constructions
-@subsection @code{case} Constructions
-
-@noindent
-A @code{case} construction is used in a project file to effect conditional
-behavior.
-Here is a typical example:
-
-@smallexample @c projectfile
-@group
-project MyProj is
- type OS_Type is ("GNU/Linux", "Unix", "NT", "VMS");
-
- OS : OS_Type := external ("OS", "GNU/Linux");
-@end group
-
-@group
- package Compiler is
- case OS is
- when "GNU/Linux" | "Unix" =>
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-gnath^-gnath^");
- when "NT" =>
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-gnatP^-gnatP^");
- when others =>
- end case;
- end Compiler;
-end MyProj;
-@end group
-@end smallexample
-
-@noindent
-The syntax of a @code{case} construction is based on the Ada case statement
-(although there is no @code{null} construction for empty alternatives).
-
-The case expression must be a typed string variable.
-Each alternative comprises the reserved word @code{when}, either a list of
-literal strings separated by the @code{"|"} character or the reserved word
-@code{others}, and the @code{"=>"} token.
-Each literal string must belong to the string type that is the type of the
-case variable.
-An @code{others} alternative, if present, must occur last.
-
-After each @code{=>}, there are zero or more constructions. The only
-constructions allowed in a case construction are other case constructions,
-attribute declarations and variable declarations. String type declarations and
-package declarations are not allowed. Variable declarations are restricted to
-variables that have already been declared before the case construction.
-
-The value of the case variable is often given by an external reference
-(@pxref{External References in Project Files}).
-
-@c ****************************************
-@c * Objects and Sources in Project Files *
-@c ****************************************
-
-@node Objects and Sources in Project Files
-@section Objects and Sources in Project Files
-
-@menu
-* Object Directory::
-* Exec Directory::
-* Source Directories::
-* Source File Names::
-@end menu
-
-@noindent
-Each project has exactly one object directory and one or more source
-directories. The source directories must contain at least one source file,
-unless the project file explicitly specifies that no source files are present
-(@pxref{Source File Names}).
-
-@node Object Directory
-@subsection Object Directory
-
-@noindent
-The object directory for a project is the directory containing the compiler's
-output (such as @file{ALI} files and object files) for the project's immediate
-sources.
-
-The object directory is given by the value of the attribute @code{Object_Dir}
-in the project file.
-
-@smallexample @c projectfile
- for Object_Dir use "objects";
-@end smallexample
-
-@noindent
-The attribute @code{Object_Dir} has a string value, the path name of the object
-directory. The path name may be absolute or relative to the directory of the
-project file. This directory must already exist, and be readable and writable.
-
-By default, when the attribute @code{Object_Dir} is not given an explicit value
-or when its value is the empty string, the object directory is the same as the
-directory containing the project file.
-
-@node Exec Directory
-@subsection Exec Directory
-
-@noindent
-The exec directory for a project is the directory containing the executables
-for the project's main subprograms.
-
-The exec directory is given by the value of the attribute @code{Exec_Dir}
-in the project file.
-
-@smallexample @c projectfile
- for Exec_Dir use "executables";
-@end smallexample
-
-@noindent
-The attribute @code{Exec_Dir} has a string value, the path name of the exec
-directory. The path name may be absolute or relative to the directory of the
-project file. This directory must already exist, and be writable.
-
-By default, when the attribute @code{Exec_Dir} is not given an explicit value
-or when its value is the empty string, the exec directory is the same as the
-object directory of the project file.
-
-@node Source Directories
-@subsection Source Directories
-
-@noindent
-The source directories of a project are specified by the project file
-attribute @code{Source_Dirs}.
-
-This attribute's value is a string list. If the attribute is not given an
-explicit value, then there is only one source directory, the one where the
-project file resides.
-
-A @code{Source_Dirs} attribute that is explicitly defined to be the empty list,
-as in
-
-@smallexample @c projectfile
- for Source_Dirs use ();
-@end smallexample
-
-@noindent
-indicates that the project contains no source files.
-
-Otherwise, each string in the string list designates one or more
-source directories.
-
-@smallexample @c projectfile
- for Source_Dirs use ("sources", "test/drivers");
-@end smallexample
-
-@noindent
-If a string in the list ends with @code{"/**"}, then the directory whose path
-name precedes the two asterisks, as well as all its subdirectories
-(recursively), are source directories.
-
-@smallexample @c projectfile
- for Source_Dirs use ("/system/sources/**");
-@end smallexample
-
-@noindent
-Here the directory @code{/system/sources} and all of its subdirectories
-(recursively) are source directories.
-
-To specify that the source directories are the directory of the project file
-and all of its subdirectories, you can declare @code{Source_Dirs} as follows:
-@smallexample @c projectfile
- for Source_Dirs use ("./**");
-@end smallexample
-
-@noindent
-Each of the source directories must exist and be readable.
-
-@node Source File Names
-@subsection Source File Names
-
-@noindent
-In a project that contains source files, their names may be specified by the
-attributes @code{Source_Files} (a string list) or @code{Source_List_File}
-(a string). Source file names never include any directory information.
-
-If the attribute @code{Source_Files} is given an explicit value, then each
-element of the list is a source file name.
-
-@smallexample @c projectfile
- for Source_Files use ("main.adb");
- for Source_Files use ("main.adb", "pack1.ads", "pack2.adb");
-@end smallexample
-
-@noindent
-If the attribute @code{Source_Files} is not given an explicit value,
-but the attribute @code{Source_List_File} is given a string value,
-then the source file names are contained in the text file whose path name
-(absolute or relative to the directory of the project file) is the
-value of the attribute @code{Source_List_File}.
-
-Each line in the file that is not empty or is not a comment
-contains a source file name.
-
-@smallexample @c projectfile
- for Source_List_File use "source_list.txt";
-@end smallexample
-
-@noindent
-By default, if neither the attribute @code{Source_Files} nor the attribute
-@code{Source_List_File} is given an explicit value, then each file in the
-source directories that conforms to the project's naming scheme
-(@pxref{Naming Schemes}) is an immediate source of the project.
-
-A warning is issued if both attributes @code{Source_Files} and
-@code{Source_List_File} are given explicit values. In this case, the attribute
-@code{Source_Files} prevails.
-
-Each source file name must be the name of one existing source file
-in one of the source directories.
-
-A @code{Source_Files} attribute whose value is an empty list
-indicates that there are no source files in the project.
-
-If the order of the source directories is known statically, that is if
-@code{"/**"} is not used in the string list @code{Source_Dirs}, then there may
-be several files with the same source file name. In this case, only the file
-in the first directory is considered as an immediate source of the project
-file. If the order of the source directories is not known statically, it is
-an error to have several files with the same source file name.
-
-Projects can be specified to have no Ada source
-files: the value of @code{Source_Dirs} or @code{Source_Files} may be an empty
-list, or the @code{"Ada"} may be absent from @code{Languages}:
-
-@smallexample @c projectfile
- for Source_Dirs use ();
- for Source_Files use ();
- for Languages use ("C", "C++");
-@end smallexample
-
-@noindent
-Otherwise, a project must contain at least one immediate source.
-
-Projects with no source files are useful as template packages
-(@pxref{Packages in Project Files}) for other projects; in particular to
-define a package @code{Naming} (@pxref{Naming Schemes}).
-
-@c ****************************
-@c * Importing Projects *
-@c ****************************
-
-@node Importing Projects
-@section Importing Projects
-@cindex @code{ADA_PROJECT_PATH}
-@cindex @code{GPR_PROJECT_PATH}
-
-@noindent
-An immediate source of a project P may depend on source files that
-are neither immediate sources of P nor in the predefined library.
-To get this effect, P must @emph{import} the projects that contain the needed
-source files.
-
-@smallexample @c projectfile
-@group
- with "project1", "utilities.gpr";
- with "/namings/apex.gpr";
- project Main is
- @dots{}
-@end group
-@end smallexample
-
-@noindent
-As can be seen in this example, the syntax for importing projects is similar
-to the syntax for importing compilation units in Ada. However, project files
-use literal strings instead of names, and the @code{with} clause identifies
-project files rather than packages.
-
-Each literal string is the file name or path name (absolute or relative) of a
-project file. If a string corresponds to a file name, with no path or a
-relative path, then its location is determined by the @emph{project path}. The
-latter can be queried using @code{gnatls -v}. It contains:
-
-@itemize @bullet
-@item
-In first position, the directory containing the current project file.
-@item
-In last position, the default project directory. This default project directory
-is part of the GNAT installation and is the standard place to install project
-files giving access to standard support libraries.
-@ifclear vms
-@ref{Installing a library}
-@end ifclear
-
-@item
-In between, all the directories referenced in the
-^environment variables^logical names^ @env{GPR_PROJECT_PATH}
-and @env{ADA_PROJECT_PATH} if they exist, and in that order.
-@end itemize
-
-@noindent
-If a relative pathname is used, as in
-
-@smallexample @c projectfile
- with "tests/proj";
-@end smallexample
-
-@noindent
-then the full path for the project is constructed by concatenating this
-relative path to those in the project path, in order, until a matching file is
-found. Any symbolic link will be fully resolved in the directory of the
-importing project file before the imported project file is examined.
-
-If the @code{with}'ed project file name does not have an extension,
-the default is @file{^.gpr^.GPR^}. If a file with this extension is not found,
-then the file name as specified in the @code{with} clause (no extension) will
-be used. In the above example, if a file @code{project1.gpr} is found, then it
-will be used; otherwise, if a file @code{^project1^PROJECT1^} exists
-then it will be used; if neither file exists, this is an error.
-
-A warning is issued if the name of the project file does not match the
-name of the project; this check is case insensitive.
-
-Any source file that is an immediate source of the imported project can be
-used by the immediate sources of the importing project, transitively. Thus
-if @code{A} imports @code{B}, and @code{B} imports @code{C}, the immediate
-sources of @code{A} may depend on the immediate sources of @code{C}, even if
-@code{A} does not import @code{C} explicitly. However, this is not recommended,
-because if and when @code{B} ceases to import @code{C}, some sources in
-@code{A} will no longer compile.
-
-A side effect of this capability is that normally cyclic dependencies are not
-permitted: if @code{A} imports @code{B} (directly or indirectly) then @code{B}
-is not allowed to import @code{A}. However, there are cases when cyclic
-dependencies would be beneficial. For these cases, another form of import
-between projects exists, the @code{limited with}: a project @code{A} that
-imports a project @code{B} with a straight @code{with} may also be imported,
-directly or indirectly, by @code{B} on the condition that imports from @code{B}
-to @code{A} include at least one @code{limited with}.
-
-@smallexample @c 0projectfile
-with "../b/b.gpr";
-with "../c/c.gpr";
-project A is
-end A;
-
-limited with "../a/a.gpr";
-project B is
-end B;
-
-with "../d/d.gpr";
-project C is
-end C;
-
-limited with "../a/a.gpr";
-project D is
-end D;
-@end smallexample
-
-@noindent
-In the above legal example, there are two project cycles:
-@itemize @bullet
-@item A-> B-> A
-@item A -> C -> D -> A
-@end itemize
-
-@noindent
-In each of these cycle there is one @code{limited with}: import of @code{A}
-from @code{B} and import of @code{A} from @code{D}.
-
-The difference between straight @code{with} and @code{limited with} is that
-the name of a project imported with a @code{limited with} cannot be used in the
-project that imports it. In particular, its packages cannot be renamed and
-its variables cannot be referred to.
-
-An exception to the above rules for @code{limited with} is that for the main
-project specified to @command{gnatmake} or to the @command{GNAT} driver a
-@code{limited with} is equivalent to a straight @code{with}. For example,
-in the example above, projects @code{B} and @code{D} could not be main
-projects for @command{gnatmake} or to the @command{GNAT} driver, because they
-each have a @code{limited with} that is the only one in a cycle of importing
-projects.
-
-@c *********************
-@c * Project Extension *
-@c *********************
-
-@node Project Extension
-@section Project Extension
-
-@noindent
-During development of a large system, it is sometimes necessary to use
-modified versions of some of the source files, without changing the original
-sources. This can be achieved through the @emph{project extension} facility.
-
-@smallexample @c projectfile
- project Modified_Utilities extends "/baseline/utilities.gpr" is @dots{}
-@end smallexample
-
-@noindent
-A project extension declaration introduces an extending project
-(the @emph{child}) and a project being extended (the @emph{parent}).
-
-By default, a child project inherits all the sources of its parent.
-However, inherited sources can be overridden: a unit in a parent is hidden
-by a unit of the same name in the child.
-
-Inherited sources are considered to be sources (but not immediate sources)
-of the child project; see @ref{Project File Syntax}.
-
-An inherited source file retains any switches specified in the parent project.
-
-For example if the project @code{Utilities} contains the spec and the
-body of an Ada package @code{Util_IO}, then the project
-@code{Modified_Utilities} can contain a new body for package @code{Util_IO}.
-The original body of @code{Util_IO} will not be considered in program builds.
-However, the package spec will still be found in the project
-@code{Utilities}.
-
-A child project can have only one parent, except when it is qualified as
-abstract. But it may import any number of other projects.
-
-A project is not allowed to import directly or indirectly at the same time a
-child project and any of its ancestors.
-
-@c *******************************
-@c * Project Hierarchy Extension *
-@c *******************************
-
-@node Project Hierarchy Extension
-@section Project Hierarchy Extension
-
-@noindent
-When extending a large system spanning multiple projects, it is often
-inconvenient to extend every project in the hierarchy that is impacted by a
-small change introduced. In such cases, it is possible to create a virtual
-extension of entire hierarchy using @code{extends all} relationship.
-
-When the project is extended using @code{extends all} inheritance, all projects
-that are imported by it, both directly and indirectly, are considered virtually
-extended. That is, the Project Manager creates "virtual projects"
-that extend every project in the hierarchy; all these virtual projects have
-no sources of their own and have as object directory the object directory of
-the root of "extending all" project.
-
-It is possible to explicitly extend one or more projects in the hierarchy
-in order to modify the sources. These extending projects must be imported by
-the "extending all" project, which will replace the corresponding virtual
-projects with the explicit ones.
-
-When building such a project hierarchy extension, the Project Manager will
-ensure that both modified sources and sources in virtual extending projects
-that depend on them, are recompiled.
-
-By means of example, consider the following hierarchy of projects.
-
-@enumerate
-@item
-project A, containing package P1
-@item
-project B importing A and containing package P2 which depends on P1
-@item
-project C importing B and containing package P3 which depends on P2
-@end enumerate
-
-@noindent
-We want to modify packages P1 and P3.
-
-This project hierarchy will need to be extended as follows:
-
-@enumerate
-@item
-Create project A1 that extends A, placing modified P1 there:
-
-@smallexample @c 0projectfile
-project A1 extends "(@dots{})/A" is
-end A1;
-@end smallexample
-
-@item
-Create project C1 that "extends all" C and imports A1, placing modified
-P3 there:
-
-@smallexample @c 0projectfile
-with "(@dots{})/A1";
-project C1 extends all "(@dots{})/C" is
-end C1;
-@end smallexample
-@end enumerate
-
-When you build project C1, your entire modified project space will be
-recompiled, including the virtual project B1 that has been impacted by the
-"extending all" inheritance of project C.
-
-Note that if a Library Project in the hierarchy is virtually extended,
-the virtual project that extends the Library Project is not a Library Project.
-
-@c ****************************************
-@c * External References in Project Files *
-@c ****************************************
-
-@node External References in Project Files
-@section External References in Project Files
-
-@noindent
-A project file may contain references to external variables; such references
-are called @emph{external references}.
-
-An external variable is either defined as part of the environment (an
-environment variable in Unix, for example) or else specified on the command
-line via the @option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}} switch.
-If both, then the command line value is used.
-
-The value of an external reference is obtained by means of the built-in
-function @code{external}, which returns a string value.
-This function has two forms:
-@itemize @bullet
-@item @code{external (external_variable_name)}
-@item @code{external (external_variable_name, default_value)}
-@end itemize
-
-@noindent
-Each parameter must be a string literal. For example:
-
-@smallexample @c projectfile
- external ("USER")
- external ("OS", "GNU/Linux")
-@end smallexample
-
-@noindent
-In the form with one parameter, the function returns the value of
-the external variable given as parameter. If this name is not present in the
-environment, the function returns an empty string.
-
-In the form with two string parameters, the second argument is
-the value returned when the variable given as the first argument is not
-present in the environment. In the example above, if @code{"OS"} is not
-the name of ^an environment variable^a logical name^ and is not passed on
-the command line, then the returned value is @code{"GNU/Linux"}.
-
-An external reference may be part of a string expression or of a string
-list expression, and can therefore appear in a variable declaration or
-an attribute declaration.
-
-@smallexample @c projectfile
-@group
- type Mode_Type is ("Debug", "Release");
- Mode : Mode_Type := external ("MODE");
- case Mode is
- when "Debug" =>
- @dots{}
-@end group
-@end smallexample
-
-@c *****************************
-@c * Packages in Project Files *
-@c *****************************
-
-@node Packages in Project Files
-@section Packages in Project Files
-
-@noindent
-A @emph{package} defines the settings for project-aware tools within a
-project.
-For each such tool one can declare a package; the names for these
-packages are preset (@pxref{Packages}).
-A package may contain variable declarations, attribute declarations, and case
-constructions.
-
-@smallexample @c projectfile
-@group
- project Proj is
- package Builder is -- used by gnatmake
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-v^-v^",
- "^-g^-g^");
- end Builder;
- end Proj;
-@end group
-@end smallexample
-
-@noindent
-The syntax of package declarations mimics that of package in Ada.
-
-Most of the packages have an attribute
-@code{^Default_Switches^Default_Switches^}.
-This attribute is an associative array, and its value is a string list.
-The index of the associative array is the name of a programming language (case
-insensitive). This attribute indicates the ^switch^switch^
-or ^switches^switches^ to be used
-with the corresponding tool.
-
-Some packages also have another attribute, @code{^Switches^Switches^},
-an associative array whose value is a string list.
-The index is the name of a source file.
-This attribute indicates the ^switch^switch^
-or ^switches^switches^ to be used by the corresponding
-tool when dealing with this specific file.
-
-Further information on these ^switch^switch^-related attributes is found in
-@ref{^Switches^Switches^ and Project Files}.
-
-A package may be declared as a @emph{renaming} of another package; e.g., from
-the project file for an imported project.
-
-@smallexample @c projectfile
-@group
- with "/global/apex.gpr";
- project Example is
- package Naming renames Apex.Naming;
- @dots{}
- end Example;
-@end group
-@end smallexample
-
-@noindent
-Packages that are renamed in other project files often come from project files
-that have no sources: they are just used as templates. Any modification in the
-template will be reflected automatically in all the project files that rename
-a package from the template.
-
-In addition to the tool-oriented packages, you can also declare a package
-named @code{Naming} to establish specialized source file naming conventions
-(@pxref{Naming Schemes}).
-
-@c ************************************
-@c * Variables from Imported Projects *
-@c ************************************
-
-@node Variables from Imported Projects
-@section Variables from Imported Projects
-
-@noindent
-An attribute or variable defined in an imported or parent project can
-be used in expressions in the importing / extending project.
-Such an attribute or variable is denoted by an expanded name whose prefix
-is either the name of the project or the expanded name of a package within
-a project.
-
-@smallexample @c projectfile
-@group
- with "imported";
- project Main extends "base" is
- Var1 := Imported.Var;
- Var2 := Base.Var & ".new";
-@end group
-
-@group
- package Builder is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use Imported.Builder'Ada_^Switches^Switches^ &
- "^-gnatg^-gnatg^" &
- "^-v^-v^";
- end Builder;
-@end group
-
-@group
- package Compiler is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use Base.Compiler'Ada_^Switches^Switches^;
- end Compiler;
- end Main;
-@end group
-@end smallexample
-
-@noindent
-In this example:
-
-@itemize @bullet
-@item
-The value of @code{Var1} is a copy of the variable @code{Var} defined
-in the project file @file{"imported.gpr"}
-@item
-the value of @code{Var2} is a copy of the value of variable @code{Var}
-defined in the project file @file{base.gpr}, concatenated with @code{".new"}
-@item
-attribute @code{^Default_Switches^Default_Switches^ ("Ada")} in package
-@code{Builder} is a string list that includes in its value a copy of the value
-of @code{Ada_^Switches^Switches^} defined in the @code{Builder} package
-in project file @file{imported.gpr} plus two new elements:
-@option{"^-gnatg^-gnatg^"}
-and @option{"^-v^-v^"};
-@item
-attribute @code{^Default_Switches^Default_Switches^ ("Ada")} in package
-@code{Compiler} is a copy of the variable @code{Ada_^Switches^Switches^}
-defined in the @code{Compiler} package in project file @file{base.gpr},
-the project being extended.
-@end itemize
-
-@c ******************
-@c * Naming Schemes *
-@c ******************
-
-@node Naming Schemes
-@section Naming Schemes
-
-@noindent
-Sometimes an Ada software system is ported from a foreign compilation
-environment to GNAT, and the file names do not use the default GNAT
-conventions. Instead of changing all the file names (which for a variety
-of reasons might not be possible), you can define the relevant file
-naming scheme in the @code{Naming} package in your project file.
-
-@noindent
-Note that the use of pragmas described in
-@ref{Alternative File Naming Schemes} by mean of a configuration
-pragmas file is not supported when using project files. You must use
-the features described in this paragraph. You can however use specify
-other configuration pragmas (@pxref{Specifying Configuration Pragmas}).
-
-@ifclear vms
-For example, the following
-package models the Apex file naming rules:
-
-@smallexample @c projectfile
-@group
- package Naming is
- for Casing use "lowercase";
- for Dot_Replacement use ".";
- for Spec_Suffix ("Ada") use ".1.ada";
- for Body_Suffix ("Ada") use ".2.ada";
- end Naming;
-@end group
-@end smallexample
-@end ifclear
-
-@ifset vms
-For example, the following package models the HP Ada file naming rules:
-
-@smallexample @c projectfile
-@group
- package Naming is
- for Casing use "lowercase";
- for Dot_Replacement use "__";
- for Spec_Suffix ("Ada") use "_.^ada^ada^";
- for Body_Suffix ("Ada") use ".^ada^ada^";
- end Naming;
-@end group
-@end smallexample
-
-@noindent
-(Note that @code{Casing} is @code{"lowercase"} because GNAT gets the file
-names in lower case)
-@end ifset
-
-@noindent
-You can define the following attributes in package @code{Naming}:
-
-@table @code
-
-@item @code{Casing}
-This must be a string with one of the three values @code{"lowercase"},
-@code{"uppercase"} or @code{"mixedcase"}; these strings are case insensitive.
-
-@noindent
-If @code{Casing} is not specified, then the default is @code{"lowercase"}.
-
-@item @code{Dot_Replacement}
-This must be a string whose value satisfies the following conditions:
-
-@itemize @bullet
-@item It must not be empty
-@item It cannot start or end with an alphanumeric character
-@item It cannot be a single underscore
-@item It cannot start with an underscore followed by an alphanumeric
-@item It cannot contain a dot @code{'.'} except if the entire string
-is @code{"."}
-@end itemize
-
-@noindent
-If @code{Dot_Replacement} is not specified, then the default is @code{"-"}.
-
-@item @code{Spec_Suffix}
-This is an associative array (indexed by the programming language name, case
-insensitive) whose value is a string that must satisfy the following
-conditions:
-
-@itemize @bullet
-@item It must not be empty
-@item It must include at least one dot
-@end itemize
-@noindent
-If @code{Spec_Suffix ("Ada")} is not specified, then the default is
-@code{"^.ads^.ADS^"}.
-
-@item @code{Body_Suffix}
-This is an associative array (indexed by the programming language name, case
-insensitive) whose value is a string that must satisfy the following
-conditions:
-
-@itemize @bullet
-@item It must not be empty
-@item It must include at least one dot
-@item It cannot be the same as @code{Spec_Suffix ("Ada")}
-@end itemize
-@noindent
-If @code{Body_Suffix ("Ada")} and @code{Spec_Suffix ("Ada")} end with the
-same string, then a file name that ends with the longest of these two suffixes
-will be a body if the longest suffix is @code{Body_Suffix ("Ada")} or a spec
-if the longest suffix is @code{Spec_Suffix ("Ada")}.
-
-If the suffix does not start with a '.', a file with a name exactly equal
-to the suffix will also be part of the project (for instance if you define
-the suffix as @code{Makefile}, a file called @file{Makefile} will be part
-of the project. This is not interesting in general when using projects to
-compile. However, it might become useful when a project is also used to
-find the list of source files in an editor, like the GNAT Programming System
-(GPS).
-
-If @code{Body_Suffix ("Ada")} is not specified, then the default is
-@code{"^.adb^.ADB^"}.
-
-@item @code{Separate_Suffix}
-This must be a string whose value satisfies the same conditions as
-@code{Body_Suffix}. The same "longest suffix" rules apply.
-
-@noindent
-If @code{Separate_Suffix ("Ada")} is not specified, then it defaults to same
-value as @code{Body_Suffix ("Ada")}.
-
-@item @code{Spec}
-@noindent
-You can use the associative array attribute @code{Spec} to define
-the source file name for an individual Ada compilation unit's spec. The array
-index must be a string literal that identifies the Ada unit (case insensitive).
-The value of this attribute must be a string that identifies the file that
-contains this unit's spec (case sensitive or insensitive depending on the
-operating system).
-
-@smallexample @c projectfile
- for Spec ("MyPack.MyChild") use "mypack.mychild.spec";
-@end smallexample
-
-When the source file contains several units, you can indicate at what
-position the unit occurs in the file, with the following. The first unit
-in the file has index 1
-
-@smallexample @c projectfile
- for Body ("top") use "foo.a" at 1;
- for Body ("foo") use "foo.a" at 2;
-@end smallexample
-
-@item @code{Body}
-
-You can use the associative array attribute @code{Body} to
-define the source file name for an individual Ada compilation unit's body
-(possibly a subunit). The array index must be a string literal that identifies
-the Ada unit (case insensitive). The value of this attribute must be a string
-that identifies the file that contains this unit's body or subunit (case
-sensitive or insensitive depending on the operating system).
-
-@smallexample @c projectfile
- for Body ("MyPack.MyChild") use "mypack.mychild.body";
-@end smallexample
-@end table
-
-@c ********************
-@c * Library Projects *
-@c ********************
-
-@node Library Projects
-@section Library Projects
-
-@noindent
-@emph{Library projects} are projects whose object code is placed in a library.
-(Note that this facility is not yet supported on all platforms).
-
-@code{gnatmake} or @code{gprbuild} will collect all object files into a
-single archive, which might either be a shared or a static library. This
-library can later on be linked with multiple executables, potentially
-reducing their sizes.
-
-If your project file specifies languages other than Ada, but you are still
-using @code{gnatmake} to compile and link, the latter will not try to
-compile your sources other than Ada (you should use @code{gprbuild} if that
-is your intent). However, @code{gnatmake} will automatically link all object
-files found in the object directory, whether or not they were compiled from
-an Ada source file. This specific behavior only applies when multiple
-languages are specified.
-
-To create a library project, you need to define in its project file
-two project-level attributes: @code{Library_Name} and @code{Library_Dir}.
-Additionally, you may define other library-related attributes such as
-@code{Library_Kind}, @code{Library_Version}, @code{Library_Interface},
-@code{Library_Auto_Init}, @code{Library_Options} and @code{Library_GCC}.
-
-The @code{Library_Name} attribute has a string value. There is no restriction
-on the name of a library. It is the responsibility of the developer to
-choose a name that will be accepted by the platform. It is recommended to
-choose names that could be Ada identifiers; such names are almost guaranteed
-to be acceptable on all platforms.
-
-The @code{Library_Dir} attribute has a string value that designates the path
-(absolute or relative) of the directory where the library will reside.
-It must designate an existing directory, and this directory must be writable,
-different from the project's object directory and from any source directory
-in the project tree.
-
-If both @code{Library_Name} and @code{Library_Dir} are specified and
-are legal, then the project file defines a library project. The optional
-library-related attributes are checked only for such project files.
-
-The @code{Library_Kind} attribute has a string value that must be one of the
-following (case insensitive): @code{"static"}, @code{"dynamic"} or
-@code{"relocatable"} (which is a synonym for @code{"dynamic"}). If this
-attribute is not specified, the library is a static library, that is
-an archive of object files that can be potentially linked into a
-static executable. Otherwise, the library may be dynamic or
-relocatable, that is a library that is loaded only at the start of execution.
-
-If you need to build both a static and a dynamic library, you should use two
-different object directories, since in some cases some extra code needs to
-be generated for the latter. For such cases, it is recommended to either use
-two different project files, or a single one which uses external variables
-to indicate what kind of library should be build.
-
-The @code{Library_ALI_Dir} attribute may be specified to indicate the
-directory where the ALI files of the library will be copied. When it is
-not specified, the ALI files are copied to the directory specified in
-attribute @code{Library_Dir}. The directory specified by @code{Library_ALI_Dir}
-must be writable and different from the project's object directory and from
-any source directory in the project tree.
-
-The @code{Library_Version} attribute has a string value whose interpretation
-is platform dependent. It has no effect on VMS and Windows. On Unix, it is
-used only for dynamic/relocatable libraries as the internal name of the
-library (the @code{"soname"}). If the library file name (built from the
-@code{Library_Name}) is different from the @code{Library_Version}, then the
-library file will be a symbolic link to the actual file whose name will be
-@code{Library_Version}.
-
-Example (on Unix):
-
-@smallexample @c projectfile
-@group
-project Plib is
-
- Version := "1";
-
- for Library_Dir use "lib_dir";
- for Library_Name use "dummy";
- for Library_Kind use "relocatable";
- for Library_Version use "libdummy.so." & Version;
-
-end Plib;
-@end group
-@end smallexample
-
-@noindent
-Directory @file{lib_dir} will contain the internal library file whose name
-will be @file{libdummy.so.1}, and @file{libdummy.so} will be a symbolic link to
-@file{libdummy.so.1}.
-
-When @command{gnatmake} detects that a project file
-is a library project file, it will check all immediate sources of the project
-and rebuild the library if any of the sources have been recompiled.
-
-Standard project files can import library project files. In such cases,
-the libraries will only be rebuilt if some of its sources are recompiled
-because they are in the closure of some other source in an importing project.
-Sources of the library project files that are not in such a closure will
-not be checked, unless the full library is checked, because one of its sources
-needs to be recompiled.
-
-For instance, assume the project file @code{A} imports the library project file
-@code{L}. The immediate sources of A are @file{a1.adb}, @file{a2.ads} and
-@file{a2.adb}. The immediate sources of L are @file{l1.ads}, @file{l1.adb},
-@file{l2.ads}, @file{l2.adb}.
-
-If @file{l1.adb} has been modified, then the library associated with @code{L}
-will be rebuilt when compiling all the immediate sources of @code{A} only
-if @file{a1.ads}, @file{a2.ads} or @file{a2.adb} includes a statement
-@code{"with L1;"}.
-
-To be sure that all the sources in the library associated with @code{L} are
-up to date, and that all the sources of project @code{A} are also up to date,
-the following two commands needs to be used:
-
-@smallexample
-gnatmake -Pl.gpr
-gnatmake -Pa.gpr
-@end smallexample
-
-When a library is built or rebuilt, an attempt is made first to delete all
-files in the library directory.
-All @file{ALI} files will also be copied from the object directory to the
-library directory. To build executables, @command{gnatmake} will use the
-library rather than the individual object files.
-
-@ifclear vms
-It is also possible to create library project files for third-party libraries
-that are precompiled and cannot be compiled locally thanks to the
-@code{externally_built} attribute. (See @ref{Installing a library}).
-@end ifclear
-
-@c *******************************
-@c * Stand-alone Library Projects *
-@c *******************************
-
-@node Stand-alone Library Projects
-@section Stand-alone Library Projects
-
-@noindent
-A Stand-alone Library is a library that contains the necessary code to
-elaborate the Ada units that are included in the library. A Stand-alone
-Library is suitable to be used in an executable when the main is not
-in Ada. However, Stand-alone Libraries may also be used with an Ada main
-subprogram.
-
-A Stand-alone Library Project is a Library Project where the library is
-a Stand-alone Library.
-
-To be a Stand-alone Library Project, in addition to the two attributes
-that make a project a Library Project (@code{Library_Name} and
-@code{Library_Dir}, see @ref{Library Projects}), the attribute
-@code{Library_Interface} must be defined.
-
-@smallexample @c projectfile
-@group
- for Library_Dir use "lib_dir";
- for Library_Name use "dummy";
- for Library_Interface use ("int1", "int1.child");
-@end group
-@end smallexample
-
-Attribute @code{Library_Interface} has a nonempty string list value,
-each string in the list designating a unit contained in an immediate source
-of the project file.
-
-When a Stand-alone Library is built, first the binder is invoked to build
-a package whose name depends on the library name
-(^b~dummy.ads/b^B$DUMMY.ADS/B^ in the example above).
-This binder-generated package includes initialization and
-finalization procedures whose
-names depend on the library name (dummyinit and dummyfinal in the example
-above). The object corresponding to this package is included in the library.
-
-A dynamic or relocatable Stand-alone Library is automatically initialized
-if automatic initialization of Stand-alone Libraries is supported on the
-platform and if attribute @code{Library_Auto_Init} is not specified or
-is specified with the value "true". A static Stand-alone Library is never
-automatically initialized.
-
-Single string attribute @code{Library_Auto_Init} may be specified with only
-two possible values: "false" or "true" (case-insensitive). Specifying
-"false" for attribute @code{Library_Auto_Init} will prevent automatic
-initialization of dynamic or relocatable libraries.
-
-When a non-automatically initialized Stand-alone Library is used
-in an executable, its initialization procedure must be called before
-any service of the library is used.
-When the main subprogram is in Ada, it may mean that the initialization
-procedure has to be called during elaboration of another package.
-
-For a Stand-Alone Library, only the @file{ALI} files of the Interface Units
-(those that are listed in attribute @code{Library_Interface}) are copied to
-the Library Directory. As a consequence, only the Interface Units may be
-imported from Ada units outside of the library. If other units are imported,
-the binding phase will fail.
-
-When a Stand-Alone Library is bound, the switches that are specified in
-the attribute @code{Default_Switches ("Ada")} in package @code{Binder} are
-used in the call to @command{gnatbind}.
-
-The string list attribute @code{Library_Options} may be used to specified
-additional switches to the call to @command{gcc} to link the library.
-
-The attribute @code{Library_Src_Dir}, may be specified for a
-Stand-Alone Library. @code{Library_Src_Dir} is a simple attribute that has a
-single string value. Its value must be the path (absolute or relative to the
-project directory) of an existing directory. This directory cannot be the
-object directory or one of the source directories, but it can be the same as
-the library directory. The sources of the Interface
-Units of the library, necessary to an Ada client of the library, will be
-copied to the designated directory, called Interface Copy directory.
-These sources includes the specs of the Interface Units, but they may also
-include bodies and subunits, when pragmas @code{Inline} or @code{Inline_Always}
-are used, or when there is a generic units in the spec. Before the sources
-are copied to the Interface Copy directory, an attempt is made to delete all
-files in the Interface Copy directory.
-
-@c *************************************
-@c * Switches Related to Project Files *
-@c *************************************
-@node Switches Related to Project Files
-@section Switches Related to Project Files
-
-@noindent
-The following switches are used by GNAT tools that support project files:
-
-@table @option
-
-@item ^-P^/PROJECT_FILE=^@var{project}
-@cindex @option{^-P^/PROJECT_FILE^} (any project-aware tool)
-Indicates the name of a project file. This project file will be parsed with
-the verbosity indicated by @option{^-vP^MESSAGE_PROJECT_FILES=^@emph{x}},
-if any, and using the external references indicated
-by @option{^-X^/EXTERNAL_REFERENCE^} switches, if any.
-@ifclear vms
-There may zero, one or more spaces between @option{-P} and @var{project}.
-@end ifclear
-
-@noindent
-There must be only one @option{^-P^/PROJECT_FILE^} switch on the command line.
-
-@noindent
-Since the Project Manager parses the project file only after all the switches
-on the command line are checked, the order of the switches
-@option{^-P^/PROJECT_FILE^},
-@option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}}
-or @option{^-X^/EXTERNAL_REFERENCE^} is not significant.
-
-@item ^-X^/EXTERNAL_REFERENCE=^@var{name=value}
-@cindex @option{^-X^/EXTERNAL_REFERENCE^} (any project-aware tool)
-Indicates that external variable @var{name} has the value @var{value}.
-The Project Manager will use this value for occurrences of
-@code{external(name)} when parsing the project file.
-
-@ifclear vms
-@noindent
-If @var{name} or @var{value} includes a space, then @var{name=value} should be
-put between quotes.
-@smallexample
- -XOS=NT
- -X"user=John Doe"
-@end smallexample
-@end ifclear
-
-@noindent
-Several @option{^-X^/EXTERNAL_REFERENCE^} switches can be used simultaneously.
-If several @option{^-X^/EXTERNAL_REFERENCE^} switches specify the same
-@var{name}, only the last one is used.
-
-@noindent
-An external variable specified with a @option{^-X^/EXTERNAL_REFERENCE^} switch
-takes precedence over the value of the same name in the environment.
-
-@item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}
-@cindex @option{^-vP^/MESSAGES_PROJECT_FILE^} (any project-aware tool)
-Indicates the verbosity of the parsing of GNAT project files.
-
-@ifclear vms
-@option{-vP0} means Default;
-@option{-vP1} means Medium;
-@option{-vP2} means High.
-@end ifclear
-
-@ifset vms
-There are three possible options for this qualifier: DEFAULT, MEDIUM and
-HIGH.
-@end ifset
-
-@noindent
-The default is ^Default^DEFAULT^: no output for syntactically correct
-project files.
-@noindent
-If several @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} switches are present,
-only the last one is used.
-
-@item ^-aP^/ADD_PROJECT_SEARCH_DIR=^<dir>
-@cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (any project-aware tool)
-Add directory <dir> at the beginning of the project search path, in order,
-after the current working directory.
-
-@ifclear vms
-@item -eL
-@cindex @option{-eL} (any project-aware tool)
-Follow all symbolic links when processing project files.
-@end ifclear
-
-@item ^--subdirs^/SUBDIRS^=<subdir>
-@cindex @option{^--subdirs^/SUBDIRS^=} (gnatmake and gnatclean)
-This switch is recognized by gnatmake and gnatclean. It indicate that the real
-directories (except the source directories) are the subdirectories <subdir>
-of the directories specified in the project files. This applies in particular
-to object directories, library directories and exec directories. If the
-subdirectories do not exist, they are created automatically.
-
-@end table
-
-@c **********************************
-@c * Tools Supporting Project Files *
-@c **********************************
-
-@node Tools Supporting Project Files
-@section Tools Supporting Project Files
-
-@menu
-* gnatmake and Project Files::
-* The GNAT Driver and Project Files::
-@end menu
-
-@node gnatmake and Project Files
-@subsection gnatmake and Project Files
-
-@noindent
-This section covers several topics related to @command{gnatmake} and
-project files: defining ^switches^switches^ for @command{gnatmake}
-and for the tools that it invokes; specifying configuration pragmas;
-the use of the @code{Main} attribute; building and rebuilding library project
-files.
-
-@menu
-* ^Switches^Switches^ and Project Files::
-* Specifying Configuration Pragmas::
-* Project Files and Main Subprograms::
-* Library Project Files::
-@end menu
-
-@node ^Switches^Switches^ and Project Files
-@subsubsection ^Switches^Switches^ and Project Files
-
-@ifset vms
-It is not currently possible to specify VMS style qualifiers in the project
-files; only Unix style ^switches^switches^ may be specified.
-@end ifset
-
-@noindent
-For each of the packages @code{Builder}, @code{Compiler}, @code{Binder}, and
-@code{Linker}, you can specify a @code{^Default_Switches^Default_Switches^}
-attribute, a @code{^Switches^Switches^} attribute, or both;
-as their names imply, these ^switch^switch^-related
-attributes affect the ^switches^switches^ that are used for each of these GNAT
-components when
-@command{gnatmake} is invoked. As will be explained below, these
-component-specific ^switches^switches^ precede
-the ^switches^switches^ provided on the @command{gnatmake} command line.
-
-The @code{^Default_Switches^Default_Switches^} attribute is an associative
-array indexed by language name (case insensitive) whose value is a string list.
-For example:
-
-@smallexample @c projectfile
-@group
-package Compiler is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-gnaty^-gnaty^",
- "^-v^-v^");
-end Compiler;
-@end group
-@end smallexample
-
-@noindent
-The @code{^Switches^Switches^} attribute is also an associative array,
-indexed by a file name (which may or may not be case sensitive, depending
-on the operating system) whose value is a string list. For example:
-
-@smallexample @c projectfile
-@group
-package Builder is
- for ^Switches^Switches^ ("main1.adb")
- use ("^-O2^-O2^");
- for ^Switches^Switches^ ("main2.adb")
- use ("^-g^-g^");
-end Builder;
-@end group
-@end smallexample
-
-@noindent
-For the @code{Builder} package, the file names must designate source files
-for main subprograms. For the @code{Binder} and @code{Linker} packages, the
-file names must designate @file{ALI} or source files for main subprograms.
-In each case just the file name without an explicit extension is acceptable.
-
-For each tool used in a program build (@command{gnatmake}, the compiler, the
-binder, and the linker), the corresponding package @dfn{contributes} a set of
-^switches^switches^ for each file on which the tool is invoked, based on the
-^switch^switch^-related attributes defined in the package.
-In particular, the ^switches^switches^
-that each of these packages contributes for a given file @var{f} comprise:
-
-@itemize @bullet
-@item
-the value of attribute @code{^Switches^Switches^ (@var{f})},
-if it is specified in the package for the given file,
-@item
-otherwise, the value of @code{^Default_Switches^Default_Switches^ ("Ada")},
-if it is specified in the package.
-@end itemize
-
-@noindent
-If neither of these attributes is defined in the package, then the package does
-not contribute any ^switches^switches^ for the given file.
-
-When @command{gnatmake} is invoked on a file, the ^switches^switches^ comprise
-two sets, in the following order: those contributed for the file
-by the @code{Builder} package;
-and the switches passed on the command line.
-
-When @command{gnatmake} invokes a tool (compiler, binder, linker) on a file,
-the ^switches^switches^ passed to the tool comprise three sets,
-in the following order:
-
-@enumerate
-@item
-the applicable ^switches^switches^ contributed for the file
-by the @code{Builder} package in the project file supplied on the command line;
-
-@item
-those contributed for the file by the package (in the relevant project file --
-see below) corresponding to the tool; and
-
-@item
-the applicable switches passed on the command line.
-@end enumerate
-
-@noindent
-The term @emph{applicable ^switches^switches^} reflects the fact that
-@command{gnatmake} ^switches^switches^ may or may not be passed to individual
-tools, depending on the individual ^switch^switch^.
-
-@command{gnatmake} may invoke the compiler on source files from different
-projects. The Project Manager will use the appropriate project file to
-determine the @code{Compiler} package for each source file being compiled.
-Likewise for the @code{Binder} and @code{Linker} packages.
-
-As an example, consider the following package in a project file:
-
-@smallexample @c projectfile
-@group
-project Proj1 is
- package Compiler is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-g^-g^");
- for ^Switches^Switches^ ("a.adb")
- use ("^-O1^-O1^");
- for ^Switches^Switches^ ("b.adb")
- use ("^-O2^-O2^",
- "^-gnaty^-gnaty^");
- end Compiler;
-end Proj1;
-@end group
-@end smallexample
-
-@noindent
-If @command{gnatmake} is invoked with this project file, and it needs to
-compile, say, the files @file{a.adb}, @file{b.adb}, and @file{c.adb}, then
-@file{a.adb} will be compiled with the ^switch^switch^
-@option{^-O1^-O1^},
-@file{b.adb} with ^switches^switches^
-@option{^-O2^-O2^}
-and @option{^-gnaty^-gnaty^},
-and @file{c.adb} with @option{^-g^-g^}.
-
-The following example illustrates the ordering of the ^switches^switches^
-contributed by different packages:
-
-@smallexample @c projectfile
-@group
-project Proj2 is
- package Builder is
- for ^Switches^Switches^ ("main.adb")
- use ("^-g^-g^",
- "^-O1^-)1^",
- "^-f^-f^");
- end Builder;
-@end group
-
-@group
- package Compiler is
- for ^Switches^Switches^ ("main.adb")
- use ("^-O2^-O2^");
- end Compiler;
-end Proj2;
-@end group
-@end smallexample
-
-@noindent
-If you issue the command:
-
-@smallexample
- gnatmake ^-Pproj2^/PROJECT_FILE=PROJ2^ -O0 main
-@end smallexample
-
-@noindent
-then the compiler will be invoked on @file{main.adb} with the following
-sequence of ^switches^switches^
-
-@smallexample
- ^-g -O1 -O2 -O0^-g -O1 -O2 -O0^
-@end smallexample
-
-with the last @option{^-O^-O^}
-^switch^switch^ having precedence over the earlier ones;
-several other ^switches^switches^
-(such as @option{^-c^-c^}) are added implicitly.
-
-The ^switches^switches^
-@option{^-g^-g^}
-and @option{^-O1^-O1^} are contributed by package
-@code{Builder}, @option{^-O2^-O2^} is contributed
-by the package @code{Compiler}
-and @option{^-O0^-O0^} comes from the command line.
-
-The @option{^-g^-g^}
-^switch^switch^ will also be passed in the invocation of
-@command{Gnatlink.}
-
-A final example illustrates switch contributions from packages in different
-project files:
-
-@smallexample @c projectfile
-@group
-project Proj3 is
- for Source_Files use ("pack.ads", "pack.adb");
- package Compiler is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-gnata^-gnata^");
- end Compiler;
-end Proj3;
-@end group
-
-@group
-with "Proj3";
-project Proj4 is
- for Source_Files use ("foo_main.adb", "bar_main.adb");
- package Builder is
- for ^Switches^Switches^ ("foo_main.adb")
- use ("^-s^-s^",
- "^-g^-g^");
- end Builder;
-end Proj4;
-@end group
-
-@group
--- Ada source file:
-with Pack;
-procedure Foo_Main is
- @dots{}
-end Foo_Main;
-@end group
-@end smallexample
-
-If the command is
-@smallexample
-gnatmake ^-PProj4^/PROJECT_FILE=PROJ4^ foo_main.adb -cargs -gnato
-@end smallexample
-
-@noindent
-then the ^switches^switches^ passed to the compiler for @file{foo_main.adb} are
-@option{^-g^-g^} (contributed by the package @code{Proj4.Builder}) and
-@option{^-gnato^-gnato^} (passed on the command line).
-When the imported package @code{Pack} is compiled, the ^switches^switches^ used
-are @option{^-g^-g^} from @code{Proj4.Builder},
-@option{^-gnata^-gnata^} (contributed from package @code{Proj3.Compiler},
-and @option{^-gnato^-gnato^} from the command line.
-
-@noindent
-When using @command{gnatmake} with project files, some ^switches^switches^ or
-arguments may be expressed as relative paths. As the working directory where
-compilation occurs may change, these relative paths are converted to absolute
-paths. For the ^switches^switches^ found in a project file, the relative paths
-are relative to the project file directory, for the switches on the command
-line, they are relative to the directory where @command{gnatmake} is invoked.
-The ^switches^switches^ for which this occurs are:
-^-I^-I^,
-^-A^-A^,
-^-L^-L^,
-^-aO^-aO^,
-^-aL^-aL^,
-^-aI^-aI^, as well as all arguments that are not switches (arguments to
-^switch^switch^
-^-o^-o^, object files specified in package @code{Linker} or after
--largs on the command line). The exception to this rule is the ^switch^switch^
-^--RTS=^--RTS=^ for which a relative path argument is never converted.
-
-@node Specifying Configuration Pragmas
-@subsubsection Specifying Configuration Pragmas
-
-When using @command{gnatmake} with project files, if there exists a file
-@file{gnat.adc} that contains configuration pragmas, this file will be
-ignored.
-
-Configuration pragmas can be defined by means of the following attributes in
-project files: @code{Global_Configuration_Pragmas} in package @code{Builder}
-and @code{Local_Configuration_Pragmas} in package @code{Compiler}.
-
-Both these attributes are single string attributes. Their values is the path
-name of a file containing configuration pragmas. If a path name is relative,
-then it is relative to the project directory of the project file where the
-attribute is defined.
-
-When compiling a source, the configuration pragmas used are, in order,
-those listed in the file designated by attribute
-@code{Global_Configuration_Pragmas} in package @code{Builder} of the main
-project file, if it is specified, and those listed in the file designated by
-attribute @code{Local_Configuration_Pragmas} in package @code{Compiler} of
-the project file of the source, if it exists.
-
-@node Project Files and Main Subprograms
-@subsubsection Project Files and Main Subprograms
-
-@noindent
-When using a project file, you can invoke @command{gnatmake}
-with one or several main subprograms, by specifying their source files on the
-command line.
-
-@smallexample
- gnatmake ^-P^/PROJECT_FILE=^prj main1 main2 main3
-@end smallexample
-
-@noindent
-Each of these needs to be a source file of the same project, except
-when the switch ^-u^/UNIQUE^ is used.
-
-@noindent
-When ^-u^/UNIQUE^ is not used, all the mains need to be sources of the
-same project, one of the project in the tree rooted at the project specified
-on the command line. The package @code{Builder} of this common project, the
-"main project" is the one that is considered by @command{gnatmake}.
-
-@noindent
-When ^-u^/UNIQUE^ is used, the specified source files may be in projects
-imported directly or indirectly by the project specified on the command line.
-Note that if such a source file is not part of the project specified on the
-command line, the ^switches^switches^ found in package @code{Builder} of the
-project specified on the command line, if any, that are transmitted
-to the compiler will still be used, not those found in the project file of
-the source file.
-
-@noindent
-When using a project file, you can also invoke @command{gnatmake} without
-explicitly specifying any main, and the effect depends on whether you have
-defined the @code{Main} attribute. This attribute has a string list value,
-where each element in the list is the name of a source file (the file
-extension is optional) that contains a unit that can be a main subprogram.
-
-If the @code{Main} attribute is defined in a project file as a non-empty
-string list and the switch @option{^-u^/UNIQUE^} is not used on the command
-line, then invoking @command{gnatmake} with this project file but without any
-main on the command line is equivalent to invoking @command{gnatmake} with all
-the file names in the @code{Main} attribute on the command line.
-
-Example:
-@smallexample @c projectfile
-@group
- project Prj is
- for Main use ("main1", "main2", "main3");
- end Prj;
-@end group
-@end smallexample
-
-@noindent
-With this project file, @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^"}
-is equivalent to
-@code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^ main1 main2 main3"}.
-
-When the project attribute @code{Main} is not specified, or is specified
-as an empty string list, or when the switch @option{-u} is used on the command
-line, then invoking @command{gnatmake} with no main on the command line will
-result in all immediate sources of the project file being checked, and
-potentially recompiled. Depending on the presence of the switch @option{-u},
-sources from other project files on which the immediate sources of the main
-project file depend are also checked and potentially recompiled. In other
-words, the @option{-u} switch is applied to all of the immediate sources of the
-main project file.
-
-When no main is specified on the command line and attribute @code{Main} exists
-and includes several mains, or when several mains are specified on the
-command line, the default ^switches^switches^ in package @code{Builder} will
-be used for all mains, even if there are specific ^switches^switches^
-specified for one or several mains.
-
-But the ^switches^switches^ from package @code{Binder} or @code{Linker} will be
-the specific ^switches^switches^ for each main, if they are specified.
-
-@node Library Project Files
-@subsubsection Library Project Files
-
-@noindent
-When @command{gnatmake} is invoked with a main project file that is a library
-project file, it is not allowed to specify one or more mains on the command
-line.
-
-@noindent
-When a library project file is specified, switches ^-b^/ACTION=BIND^ and
-^-l^/ACTION=LINK^ have special meanings.
-
-@itemize @bullet
-@item ^-b^/ACTION=BIND^ is only allowed for stand-alone libraries. It indicates
-to @command{gnatmake} that @command{gnatbind} should be invoked for the
-library.
-
-@item ^-l^/ACTION=LINK^ may be used for all library projects. It indicates
-to @command{gnatmake} that the binder generated file should be compiled
-(in the case of a stand-alone library) and that the library should be built.
-
-@end itemize
-
-@node The GNAT Driver and Project Files
-@subsection The GNAT Driver and Project Files
-
-@noindent
-A number of GNAT tools, other than @command{^gnatmake^gnatmake^}
-can benefit from project files:
-@command{^gnatbind^gnatbind^},
-@command{^gnatcheck^gnatcheck^}),
-@command{^gnatclean^gnatclean^}),
-@command{^gnatelim^gnatelim^},
-@command{^gnatfind^gnatfind^},
-@command{^gnatlink^gnatlink^},
-@command{^gnatls^gnatls^},
-@command{^gnatmetric^gnatmetric^},
-@command{^gnatpp^gnatpp^},
-@command{^gnatstub^gnatstub^},
-and @command{^gnatxref^gnatxref^}. However, none of these tools can be invoked
-directly with a project file switch (@option{^-P^/PROJECT_FILE=^}).
-They must be invoked through the @command{gnat} driver.
-
-The @command{gnat} driver is a wrapper that accepts a number of commands and
-calls the corresponding tool. It was designed initially for VMS platforms (to
-convert VMS qualifiers to Unix-style switches), but it is now available on all
-GNAT platforms.
-
-On non-VMS platforms, the @command{gnat} driver accepts the following commands
-(case insensitive):
-
-@itemize @bullet
-@item
-BIND to invoke @command{^gnatbind^gnatbind^}
-@item
-CHOP to invoke @command{^gnatchop^gnatchop^}
-@item
-CLEAN to invoke @command{^gnatclean^gnatclean^}
-@item
-COMP or COMPILE to invoke the compiler
-@item
-ELIM to invoke @command{^gnatelim^gnatelim^}
-@item
-FIND to invoke @command{^gnatfind^gnatfind^}
-@item
-KR or KRUNCH to invoke @command{^gnatkr^gnatkr^}
-@item
-LINK to invoke @command{^gnatlink^gnatlink^}
-@item
-LS or LIST to invoke @command{^gnatls^gnatls^}
-@item
-MAKE to invoke @command{^gnatmake^gnatmake^}
-@item
-NAME to invoke @command{^gnatname^gnatname^}
-@item
-PREP or PREPROCESS to invoke @command{^gnatprep^gnatprep^}
-@item
-PP or PRETTY to invoke @command{^gnatpp^gnatpp^}
-@item
-METRIC to invoke @command{^gnatmetric^gnatmetric^}
-@item
-STUB to invoke @command{^gnatstub^gnatstub^}
-@item
-XREF to invoke @command{^gnatxref^gnatxref^}
-@end itemize
-
-@noindent
-(note that the compiler is invoked using the command
-@command{^gnatmake -f -u -c^gnatmake -f -u -c^}).
-
-@noindent
-On non-VMS platforms, between @command{gnat} and the command, two
-special switches may be used:
-
-@itemize @bullet
-@item
-@command{-v} to display the invocation of the tool.
-@item
-@command{-dn} to prevent the @command{gnat} driver from removing
-the temporary files it has created. These temporary files are
-configuration files and temporary file list files.
-@end itemize
-
-@noindent
-The command may be followed by switches and arguments for the invoked
-tool.
-
-@smallexample
- gnat bind -C main.ali
- gnat ls -a main
- gnat chop foo.txt
-@end smallexample
-
-@noindent
-Switches may also be put in text files, one switch per line, and the text
-files may be specified with their path name preceded by '@@'.
-@smallexample
- gnat bind @@args.txt main.ali
-@end smallexample
-
-@noindent
-In addition, for commands BIND, COMP or COMPILE, FIND, ELIM, LS or LIST, LINK,
-METRIC, PP or PRETTY, STUB and XREF, the project file related switches
-(@option{^-P^/PROJECT_FILE^},
-@option{^-X^/EXTERNAL_REFERENCE^} and
-@option{^-vP^/MESSAGES_PROJECT_FILE=^x}) may be used in addition to
-the switches of the invoking tool.
-
-@noindent
-When GNAT PP or GNAT PRETTY is used with a project file, but with no source
-specified on the command line, it invokes @command{^gnatpp^gnatpp^} with all
-the immediate sources of the specified project file.
-
-@noindent
-When GNAT METRIC is used with a project file, but with no source
-specified on the command line, it invokes @command{^gnatmetric^gnatmetric^}
-with all the immediate sources of the specified project file and with
-@option{^-d^/DIRECTORY^} with the parameter pointing to the object directory
-of the project.
-
-@noindent
-In addition, when GNAT PP, GNAT PRETTY or GNAT METRIC is used with
-a project file, no source is specified on the command line and
-switch ^-U^/ALL_PROJECTS^ is specified on the command line, then
-the underlying tool (^gnatpp^gnatpp^ or
-^gnatmetric^gnatmetric^) is invoked for all sources of all projects,
-not only for the immediate sources of the main project.
-@ifclear vms
-(-U stands for Universal or Union of the project files of the project tree)
-@end ifclear
-
-@noindent
-For each of the following commands, there is optionally a corresponding
-package in the main project.
-
-@itemize @bullet
-@item
-package @code{Binder} for command BIND (invoking @code{^gnatbind^gnatbind^})
-
-@item
-package @code{Check} for command CHECK (invoking
-@code{^gnatcheck^gnatcheck^})
-
-@item
-package @code{Compiler} for command COMP or COMPILE (invoking the compiler)
-
-@item
-package @code{Cross_Reference} for command XREF (invoking
-@code{^gnatxref^gnatxref^})
-
-@item
-package @code{Eliminate} for command ELIM (invoking
-@code{^gnatelim^gnatelim^})
-
-@item
-package @code{Finder} for command FIND (invoking @code{^gnatfind^gnatfind^})
-
-@item
-package @code{Gnatls} for command LS or LIST (invoking @code{^gnatls^gnatls^})
-
-@item
-package @code{Gnatstub} for command STUB
-(invoking @code{^gnatstub^gnatstub^})
-
-@item
-package @code{Linker} for command LINK (invoking @code{^gnatlink^gnatlink^})
-
-@item
-package @code{Check} for command CHECK
-(invoking @code{^gnatcheck^gnatcheck^})
-
-@item
-package @code{Metrics} for command METRIC
-(invoking @code{^gnatmetric^gnatmetric^})
-
-@item
-package @code{Pretty_Printer} for command PP or PRETTY
-(invoking @code{^gnatpp^gnatpp^})
-
-@end itemize
-
-@noindent
-Package @code{Gnatls} has a unique attribute @code{^Switches^Switches^},
-a simple variable with a string list value. It contains ^switches^switches^
-for the invocation of @code{^gnatls^gnatls^}.
-
-@smallexample @c projectfile
-@group
-project Proj1 is
- package gnatls is
- for ^Switches^Switches^
- use ("^-a^-a^",
- "^-v^-v^");
- end gnatls;
-end Proj1;
-@end group
-@end smallexample
-
-@noindent
-All other packages have two attribute @code{^Switches^Switches^} and
-@code{^Default_Switches^Default_Switches^}.
-
-@noindent
-@code{^Switches^Switches^} is an associative array attribute, indexed by the
-source file name, that has a string list value: the ^switches^switches^ to be
-used when the tool corresponding to the package is invoked for the specific
-source file.
-
-@noindent
-@code{^Default_Switches^Default_Switches^} is an associative array attribute,
-indexed by the programming language that has a string list value.
-@code{^Default_Switches^Default_Switches^ ("Ada")} contains the
-^switches^switches^ for the invocation of the tool corresponding
-to the package, except if a specific @code{^Switches^Switches^} attribute
-is specified for the source file.
-
-@smallexample @c projectfile
-@group
-project Proj is
-
- for Source_Dirs use ("./**");
-
- package gnatls is
- for ^Switches^Switches^ use
- ("^-a^-a^",
- "^-v^-v^");
- end gnatls;
-@end group
-@group
-
- package Compiler is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-gnatv^-gnatv^",
- "^-gnatwa^-gnatwa^");
- end Binder;
-@end group
-@group
-
- package Binder is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-C^-C^",
- "^-e^-e^");
- end Binder;
-@end group
-@group
-
- package Linker is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-C^-C^");
- for ^Switches^Switches^ ("main.adb")
- use ("^-C^-C^",
- "^-v^-v^",
- "^-v^-v^");
- end Linker;
-@end group
-@group
-
- package Finder is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-a^-a^",
- "^-f^-f^");
- end Finder;
-@end group
-@group
-
- package Cross_Reference is
- for ^Default_Switches^Default_Switches^ ("Ada")
- use ("^-a^-a^",
- "^-f^-f^",
- "^-d^-d^",
- "^-u^-u^");
- end Cross_Reference;
-end Proj;
-@end group
-@end smallexample
-
-@noindent
-With the above project file, commands such as
-
-@smallexample
- ^gnat comp -Pproj main^GNAT COMP /PROJECT_FILE=PROJ MAIN^
- ^gnat ls -Pproj main^GNAT LIST /PROJECT_FILE=PROJ MAIN^
- ^gnat xref -Pproj main^GNAT XREF /PROJECT_FILE=PROJ MAIN^
- ^gnat bind -Pproj main.ali^GNAT BIND /PROJECT_FILE=PROJ MAIN.ALI^
- ^gnat link -Pproj main.ali^GNAT LINK /PROJECT_FILE=PROJ MAIN.ALI^
-@end smallexample
-
-@noindent
-will set up the environment properly and invoke the tool with the switches
-found in the package corresponding to the tool:
-@code{^Default_Switches^Default_Switches^ ("Ada")} for all tools,
-except @code{^Switches^Switches^ ("main.adb")}
-for @code{^gnatlink^gnatlink^}.
-It is also possible to invoke some of the tools,
-@code{^gnatcheck^gnatcheck^}),
-@code{^gnatmetric^gnatmetric^}),
-and @code{^gnatpp^gnatpp^})
-on a set of project units thanks to the combination of the switches
-@option{-P}, @option{-U} and possibly the main unit when one is interested
-in its closure. For instance,
-@smallexample
-gnat metric -Pproj
-@end smallexample
-will compute the metrics for all the immediate units of project
-@code{proj}.
-@smallexample
-gnat metric -Pproj -U
-@end smallexample
-will compute the metrics for all the units of the closure of projects
-rooted at @code{proj}.
-@smallexample
-gnat metric -Pproj -U main_unit
-@end smallexample
-will compute the metrics for the closure of units rooted at
-@code{main_unit}. This last possibility relies implicitly
-on @command{gnatbind}'s option @option{-R}.
-
-@c **********************
-@node An Extended Example
-@section An Extended Example
-
-@noindent
-Suppose that we have two programs, @var{prog1} and @var{prog2},
-whose sources are in corresponding directories. We would like
-to build them with a single @command{gnatmake} command, and we want to place
-their object files into @file{build} subdirectories of the source directories.
-Furthermore, we want to have to have two separate subdirectories
-in @file{build} -- @file{release} and @file{debug} -- which will contain
-the object files compiled with different set of compilation flags.
-
-In other words, we have the following structure:
+@c ------ macros for projects.texi
+@c These macros are needed when building the gprbuild documentation, but
+@c should have no effect in the gnat user's guide
+@macro CODESAMPLE{TXT}
@smallexample
@group
- main
- |- prog1
- | |- build
- | | debug
- | | release
- |- prog2
- |- build
- | debug
- | release
-@end group
-@end smallexample
-
-@noindent
-Here are the project files that we must place in a directory @file{main}
-to maintain this structure:
-
-@enumerate
-
-@item We create a @code{Common} project with a package @code{Compiler} that
-specifies the compilation ^switches^switches^:
-
-@smallexample
-File "common.gpr":
-@group
-@b{project} Common @b{is}
-
- @b{for} Source_Dirs @b{use} (); -- No source files
-@end group
-
-@group
- @b{type} Build_Type @b{is} ("release", "debug");
- Build : Build_Type := External ("BUILD", "debug");
-@end group
-@group
- @b{package} Compiler @b{is}
- @b{case} Build @b{is}
- @b{when} "release" =>
- @b{for} ^Default_Switches^Default_Switches^ ("Ada")
- @b{use} ("^-O2^-O2^");
- @b{when} "debug" =>
- @b{for} ^Default_Switches^Default_Switches^ ("Ada")
- @b{use} ("^-g^-g^");
- @b{end case};
- @b{end} Compiler;
-
-@b{end} Common;
-@end group
-@end smallexample
-
-@item We create separate projects for the two programs:
-
-@smallexample
-@group
-File "prog1.gpr":
-
-@b{with} "common";
-@b{project} Prog1 @b{is}
-
- @b{for} Source_Dirs @b{use} ("prog1");
- @b{for} Object_Dir @b{use} "prog1/build/" & Common.Build;
-
- @b{package} Compiler @b{renames} Common.Compiler;
-
-@b{end} Prog1;
-@end group
-@end smallexample
-
-@smallexample
-@group
-File "prog2.gpr":
-
-@b{with} "common";
-@b{project} Prog2 @b{is}
-
- @b{for} Source_Dirs @b{use} ("prog2");
- @b{for} Object_Dir @b{use} "prog2/build/" & Common.Build;
-
- @b{package} Compiler @b{renames} Common.Compiler;
-
-@end group
-@b{end} Prog2;
-@end smallexample
-
-@item We create a wrapping project @code{Main}:
-
-@smallexample
-@group
-File "main.gpr":
-
-@b{with} "common";
-@b{with} "prog1";
-@b{with} "prog2";
-@b{project} Main @b{is}
-
- @b{package} Compiler @b{renames} Common.Compiler;
-
-@b{end} Main;
+\TXT\
@end group
@end smallexample
+@end macro
-@item Finally we need to create a dummy procedure that @code{with}s (either
-explicitly or implicitly) all the sources of our two programs.
+@macro PROJECTFILE{TXT}
+@CODESAMPLE{\TXT\}
+@end macro
-@end enumerate
+@c simulates a newline when in a @CODESAMPLE
+@macro NL{}
+@end macro
+@macro TIP{TXT}
+@quotation
@noindent
-Now we can build the programs using the command
+\TXT\
+@end quotation
+@end macro
-@smallexample
- gnatmake ^-P^/PROJECT_FILE=^main dummy
-@end smallexample
+@macro TIPHTML{TXT}
+\TXT\
+@end macro
+@macro IMPORTANT{TXT}
+@quotation
@noindent
-for the Debug mode, or
-
-@ifclear vms
-@smallexample
- gnatmake -Pmain -XBUILD=release
-@end smallexample
-@end ifclear
+\TXT\
+@end quotation
-@ifset vms
-@smallexample
- GNAT MAKE /PROJECT_FILE=main /EXTERNAL_REFERENCE=BUILD=release
-@end smallexample
-@end ifset
+@end macro
+@macro NOTE{TXT}
+@quotation
@noindent
-for the Release mode.
-
-@c ********************************
-@c * Project File Complete Syntax *
-@c ********************************
-
-@node Project File Complete Syntax
-@section Project File Complete Syntax
-
-@smallexample
-project ::=
- context_clause project_declaration
-
-context_clause ::=
- @{with_clause@}
-
-with_clause ::=
- @b{with} path_name @{ , path_name @} ;
-
-path_name ::=
- string_literal
-
-project_declaration ::=
- simple_project_declaration | project_extension
-
-simple_project_declaration ::=
- @b{project} <project_>simple_name @b{is}
- @{declarative_item@}
- @b{end} <project_>simple_name;
-
-project_extension ::=
- @b{project} <project_>simple_name @b{extends} path_name @b{is}
- @{declarative_item@}
- @b{end} <project_>simple_name;
-
-declarative_item ::=
- package_declaration |
- typed_string_declaration |
- other_declarative_item
-
-package_declaration ::=
- package_spec | package_renaming
-
-package_spec ::=
- @b{package} package_identifier @b{is}
- @{simple_declarative_item@}
- @b{end} package_identifier ;
-
-package_identifier ::=
- @code{Naming} | @code{Builder} | @code{Compiler} | @code{Binder} |
- @code{Linker} | @code{Finder} | @code{Cross_Reference} |
- @code{^gnatls^gnatls^} | @code{IDE} | @code{Pretty_Printer}
-
-package_renaming ::==
- @b{package} package_identifier @b{renames}
- <project_>simple_name.package_identifier ;
-
-typed_string_declaration ::=
- @b{type} <typed_string_>_simple_name @b{is}
- ( string_literal @{, string_literal@} );
-
-other_declarative_item ::=
- attribute_declaration |
- typed_variable_declaration |
- variable_declaration |
- case_construction
-
-attribute_declaration ::=
- full_associative_array_declaration |
- @b{for} attribute_designator @b{use} expression ;
-
-full_associative_array_declaration ::=
- @b{for} <associative_array_attribute_>simple_name @b{use}
- <project_>simple_name [ . <package_>simple_Name ] ' <attribute_>simple_name ;
-
-attribute_designator ::=
- <simple_attribute_>simple_name |
- <associative_array_attribute_>simple_name ( string_literal )
-
-typed_variable_declaration ::=
- <typed_variable_>simple_name : <typed_string_>name := string_expression ;
-
-variable_declaration ::=
- <variable_>simple_name := expression;
-
-expression ::=
- term @{& term@}
-
-term ::=
- literal_string |
- string_list |
- <variable_>name |
- external_value |
- attribute_reference
-
-string_literal ::=
- (same as Ada)
-
-string_list ::=
- ( <string_>expression @{ , <string_>expression @} )
-
-external_value ::=
- @b{external} ( string_literal [, string_literal] )
-
-attribute_reference ::=
- attribute_prefix ' <simple_attribute_>simple_name [ ( literal_string ) ]
-
-attribute_prefix ::=
- @b{project} |
- <project_>simple_name | package_identifier |
- <project_>simple_name . package_identifier
-
-case_construction ::=
- @b{case} <typed_variable_>name @b{is}
- @{case_item@}
- @b{end case} ;
-
-case_item ::=
- @b{when} discrete_choice_list =>
- @{case_construction | attribute_declaration@}
-
-discrete_choice_list ::=
- string_literal @{| string_literal@} |
- @b{others}
-
-name ::=
- simple_name @{. simple_name@}
+\TXT\
+@end quotation
+@end macro
-simple_name ::=
- identifier (same as Ada)
+@include projects.texi
-@end smallexample
+@c *****************************************
+@c * Cross-referencing tools
+@c *****************************************
@node The Cross-Referencing Tools gnatxref and gnatfind
@chapter The Cross-Referencing Tools @code{gnatxref} and @code{gnatfind}
@@ -15403,7 +11894,9 @@ use the @code{gnat} driver (see @ref{The GNAT Driver and Project Files}).
@noindent
The command invocation for @code{gnatxref} is:
@smallexample
-$ gnatxref @ovar{switches} @var{sourcefile1} @r{[}@var{sourcefile2} @dots{}@r{]}
+@c $ gnatxref @ovar{switches} @var{sourcefile1} @r{[}@var{sourcefile2} @dots{}@r{]}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatxref @r{[}@var{switches}@r{]} @var{sourcefile1} @r{[}@var{sourcefile2} @dots{}@r{]}
@end smallexample
@noindent
@@ -15467,6 +11960,13 @@ Do not look for sources in the system default directory.
@cindex @option{-nostdlib} (@command{gnatxref})
Do not look for library files in the system default directory.
+@item --ext=@var{extension}
+@cindex @option{--ext} (@command{gnatxref})
+Specify an alternate ali file extension. The default is @code{ali} and other
+extensions (e.g. @code{sli} for SPARK library files) may be specified via this
+switch. Note that if this switch overrides the default, which means that only
+the new extension will be considered.
+
@item --RTS=@var{rts-path}
@cindex @option{--RTS} (@command{gnatxref})
Specifies the default location of the runtime library. Same meaning as the
@@ -15495,7 +11995,7 @@ Equivalent to @samp{-aODIR -aIDIR}.
@item -pFILE
@cindex @option{-pFILE} (@command{gnatxref})
-Specify a project file to use @xref{Project Files}.
+Specify a project file to use @xref{GNAT Project Manager}.
If you need to use the @file{.gpr}
project files, you should use gnatxref through the GNAT driver
(@command{gnat xref -Pproject}).
@@ -15535,8 +12035,11 @@ you can say @samp{gnatxref ^-ag^/ALL_FILES/IGNORE_LOCALS^} instead of
The command line for @code{gnatfind} is:
@smallexample
-$ gnatfind @ovar{switches} @var{pattern}@r{[}:@var{sourcefile}@r{[}:@var{line}@r{[}:@var{column}@r{]]]}
- @r{[}@var{file1} @var{file2} @dots{}]
+@c $ gnatfind @ovar{switches} @var{pattern}@r{[}:@var{sourcefile}@r{[}:@var{line}@r{[}:@var{column}@r{]]]}
+@c @r{[}@var{file1} @var{file2} @dots{}]
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatfind @r{[}@var{switches}@r{]} @var{pattern}@r{[}:@var{sourcefile}@r{[}:@var{line}@r{[}:@var{column}@r{]]]}
+ @r{[}@var{file1} @var{file2} @dots{}@r{]}
@end smallexample
@noindent
@@ -15675,7 +12178,7 @@ Equivalent to @samp{-aODIR -aIDIR}.
@item -pFILE
@cindex @option{-pFILE} (@command{gnatfind})
-Specify a project file (@pxref{Project Files}) to use.
+Specify a project file (@pxref{GNAT Project Manager}) to use.
By default, @code{gnatxref} and @code{gnatfind} will try to locate a
project file in the current directory.
@@ -16122,7 +12625,9 @@ call @command{gnatpp} through the @command{gnat} driver
The @command{gnatpp} command has the form
@smallexample
-$ gnatpp @ovar{switches} @var{filename}
+@c $ gnatpp @ovar{switches} @var{filename}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatpp @r{[}@var{switches}@r{]} @var{filename} @r{[}-cargs @var{gcc_switches}@r{]}
@end smallexample
@noindent
@@ -16138,6 +12643,13 @@ output source file
reformat; ``wildcards'' or several file names on the same gnatpp command are
allowed. The file name may contain path information; it does not have to
follow the GNAT file naming rules
+
+@item
+@samp{@var{gcc_switches}} is a list of switches for
+@command{gcc}. They will be passed on to all compiler invocations made by
+@command{gnatelim} to generate the ASIS trees. Here you can provide
+@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
+use the @option{-gnatec} switch to set the configuration file etc.
@end itemize
@menu
@@ -16635,12 +13147,12 @@ with @option{^-pipe^/STANDARD_OUTPUT^} option.
The additional @command{gnatpp} switches are defined in this subsection.
@table @option
-@item ^-files @var{filename}^/FILES=@var{output_file}^
+@item ^-files @var{filename}^/FILES=@var{filename}^
@cindex @option{^-files^/FILES^} (@code{gnatpp})
Take the argument source files from the specified file. This file should be an
-ordinary textual file containing file names separated by spaces or
-line breaks. You can use this switch more then once in the same call to
-@command{gnatpp}. You also can combine this switch with explicit list of
+ordinary text file containing file names separated by spaces or
+line breaks. You can use this switch more than once in the same call to
+@command{gnatpp}. You also can combine this switch with an explicit list of
files.
@item ^-v^/VERBOSE^
@@ -17224,7 +13736,9 @@ through the @command{gnat} driver.
The @command{gnatmetric} command has the form
@smallexample
-$ gnatmetric @ovar{switches} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]}
+@c $ gnatmetric @ovar{switches} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatmetric @r{[}@var{switches}@r{]} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]}
@end smallexample
@noindent
@@ -17245,7 +13759,7 @@ Including both a @option{-files} switch and one or more
@var{filename} arguments is permitted.
@item
-@samp{-cargs @var{gcc_switches}} is a list of switches for
+@samp{@var{gcc_switches}} is a list of switches for
@command{gcc}. They will be passed on to all compiler invocations made by
@command{gnatmetric} to generate the ASIS trees. Here you can provide
@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
@@ -17319,7 +13833,7 @@ Do not generate the output in text form (implies @option{^-x^/XML^})
@cindex @option{^-d^/DIRECTORY^} (@command{gnatmetric})
@item ^-d @var{output_dir}^/DIRECTORY=@var{output_dir}^
-Put textual files with detailed metrics into @var{output_dir}
+Put text files with detailed metrics into @var{output_dir}
@cindex @option{^-o^/SUFFIX_DETAILS^} (@command{gnatmetric})
@item ^-o @var{file_suffix}^/SUFFIX_DETAILS=@var{file_suffix}^
@@ -17896,7 +14410,7 @@ Additional @command{gnatmetric} switches are as follows:
@cindex @option{^-files^/FILES^} (@code{gnatmetric})
Take the argument source files from the specified file. This file should be an
ordinary text file containing file names separated by spaces or
-line breaks. You can use this switch more then once in the same call to
+line breaks. You can use this switch more than once in the same call to
@command{gnatmetric}. You also can combine this switch with
an explicit list of files.
@@ -18006,7 +14520,9 @@ The @code{gnatkr} command has the form
@ifclear vms
@smallexample
-$ gnatkr @var{name} @ovar{length}
+@c $ gnatkr @var{name} @ovar{length}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatkr @var{name} @r{[}@var{length}@r{]}
@end smallexample
@end ifclear
@@ -18194,7 +14710,9 @@ all characters need to be in the ASCII set (no accented letters).
To call @code{gnatprep} use
@smallexample
-$ gnatprep @ovar{switches} @var{infile} @var{outfile} @ovar{deffile}
+@c $ gnatprep @ovar{switches} @var{infile} @var{outfile} @ovar{deffile}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatprep @r{[}@var{switches}@r{]} @var{infile} @var{outfile} @r{[}@var{deffile}@r{]}
@end smallexample
@noindent
@@ -18878,6 +15396,15 @@ Display Copyright and version, then exit disregarding all other options.
If @option{--version} was not used, display usage, then exit disregarding
all other options.
+@item ^--subdirs^/SUBDIRS^=subdir
+Actual object directory of each project file is the subdirectory subdir of the
+object directory specified or defauted in the project file.
+
+@item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^
+By default, shared library projects are not allowed to import static library
+projects. When this switch is used on the command line, this restriction is
+relaxed.
+
@item ^-c^/COMPILER_FILES_ONLY^
@cindex @option{^-c^/COMPILER_FILES_ONLY^} (@code{gnatclean})
Only attempt to delete the files produced by the compiler, not those produced
@@ -19155,46 +15682,7 @@ be accessed by the directive @option{-l@var{xxx}} at link time.
@noindent
If you use project files, library installation is part of the library build
-process. Thus no further action is needed in order to make use of the
-libraries that are built as part of the general application build. A usable
-version of the library is installed in the directory specified by the
-@code{Library_Dir} attribute of the library project file.
-
-You may want to install a library in a context different from where the library
-is built. This situation arises with third party suppliers, who may want
-to distribute a library in binary form where the user is not expected to be
-able to recompile the library. The simplest option in this case is to provide
-a project file slightly different from the one used to build the library, by
-using the @code{externally_built} attribute. For instance, the project
-file used to build the library in the previous section can be changed into the
-following one when the library is installed:
-
-@smallexample @c projectfile
-project My_Lib is
- for Source_Dirs use ("src1", "src2");
- for Library_Name use "mylib";
- for Library_Dir use "lib";
- for Library_Kind use "dynamic";
- for Externally_Built use "true";
-end My_lib;
-@end smallexample
-
-@noindent
-This project file assumes that the directories @file{src1},
-@file{src2}, and @file{lib} exist in
-the directory containing the project file. The @code{externally_built}
-attribute makes it clear to the GNAT builder that it should not attempt to
-recompile any of the units from this library. It allows the library provider to
-restrict the source set to the minimum necessary for clients to make use of the
-library as described in the first section of this chapter. It is the
-responsibility of the library provider to install the necessary sources, ALI
-files and libraries in the directories mentioned in the project file. For
-convenience, the user's library project file should be installed in a location
-that will be searched automatically by the GNAT
-builder. These are the directories referenced in the @env{GPR_PROJECT_PATH}
-environment variable (@pxref{Importing Projects}), and also the default GNAT
-library location that can be queried with @command{gnatls -v} and is usually of
-the form $gnat_install_root/lib/gnat.
+process (@pxref{Installing a library with project files}).
When project files are not an option, it is also possible, but not recommended,
to install the library so that the sources needed to use the library are on the
@@ -20170,7 +16658,9 @@ Solaris and Windows NT/2000/XP (x86).
The @code{gnatmem} command has the form
@smallexample
- $ gnatmem @ovar{switches} user_program
+@c $ gnatmem @ovar{switches} user_program
+@c Expanding @ovar macro inline (explanation in macro def comments)
+ $ gnatmem @r{[}@var{switches}@r{]} @var{user_program}
@end smallexample
@noindent
@@ -20698,7 +17188,11 @@ driver (see @ref{The GNAT Driver and Project Files}).
Invoking @command{gnatcheck} on the command line has the form:
@smallexample
-$ gnatcheck @ovar{switches} @{@var{filename}@}
+@c $ gnatcheck @ovar{switches} @{@var{filename}@}
+@c @r{[}^-files^/FILES^=@{@var{arg_list_filename}@}@r{]}
+@c @r{[}-cargs @var{gcc_switches}@r{]} -rules @var{rule_options}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatcheck @r{[}@var{switches}@r{]} @{@var{filename}@}
@r{[}^-files^/FILES^=@{@var{arg_list_filename}@}@r{]}
@r{[}-cargs @var{gcc_switches}@r{]} -rules @var{rule_options}
@end smallexample
@@ -20846,13 +17340,6 @@ Set name of report file file to @var{report_file} .
@end table
-@noindent
-Note that if any of the options @option{^-s1^/COMPILER_STYLE^},
-@option{^-s2^/BY_RULES^} or
-@option{^-s3^/BY_FILES_BY_RULES^} is specified,
-then the @command{gnatcheck} report file will only contain sections
-explicitly denoted by these options.
-
@node gnatcheck Rule Options
@section @command{gnatcheck} Rule Options
@@ -21138,1808 +17625,13 @@ release.
@end ignore
@noindent
-The following subsections document the rules implemented in
-@command{gnatcheck}.
-The subsection title is the same as the rule identifier, which may be
-used as a parameter of the @option{+R} or @option{-R} options.
-
-
-@menu
-* Abstract_Type_Declarations::
-* Anonymous_Arrays::
-* Anonymous_Subtypes::
-* Blocks::
-* Boolean_Relational_Operators::
-@ignore
-* Ceiling_Violations::
-@end ignore
-* Complex_Inlined_Subprograms::
-* Controlled_Type_Declarations::
-* Declarations_In_Blocks::
-* Deep_Inheritance_Hierarchies::
-* Deeply_Nested_Generics::
-* Deeply_Nested_Inlining::
-@ignore
-* Deeply_Nested_Local_Inlining::
-@end ignore
-* Default_Parameters::
-* Direct_Calls_To_Primitives::
-* Discriminated_Records::
-* Enumeration_Ranges_In_CASE_Statements::
-* Exceptions_As_Control_Flow::
-* Exits_From_Conditional_Loops::
-* EXIT_Statements_With_No_Loop_Name::
-* Expanded_Loop_Exit_Names::
-* Explicit_Full_Discrete_Ranges::
-* Float_Equality_Checks::
-* Forbidden_Attributes::
-* Forbidden_Pragmas::
-* Function_Style_Procedures::
-* Generics_In_Subprograms::
-* GOTO_Statements::
-* Implicit_IN_Mode_Parameters::
-* Implicit_SMALL_For_Fixed_Point_Types::
-* Improperly_Located_Instantiations::
-* Improper_Returns::
-* Library_Level_Subprograms::
-* Local_Packages::
-@ignore
-* Improperly_Called_Protected_Entries::
-@end ignore
-* Metrics::
-* Misnamed_Controlling_Parameters::
-* Misnamed_Identifiers::
-* Multiple_Entries_In_Protected_Definitions::
-* Name_Clashes::
-* Non_Qualified_Aggregates::
-* Non_Short_Circuit_Operators::
-* Non_SPARK_Attributes::
-* Non_Tagged_Derived_Types::
-* Non_Visible_Exceptions::
-* Numeric_Literals::
-* OTHERS_In_Aggregates::
-* OTHERS_In_CASE_Statements::
-* OTHERS_In_Exception_Handlers::
-* Outer_Loop_Exits::
-* Overloaded_Operators::
-* Overly_Nested_Control_Structures::
-* Parameters_Out_Of_Order::
-* Positional_Actuals_For_Defaulted_Generic_Parameters::
-* Positional_Actuals_For_Defaulted_Parameters::
-* Positional_Components::
-* Positional_Generic_Parameters::
-* Positional_Parameters::
-* Predefined_Numeric_Types::
-* Raising_External_Exceptions::
-* Raising_Predefined_Exceptions::
-* Separate_Numeric_Error_Handlers::
-@ignore
-* Recursion::
-* Side_Effect_Functions::
-@end ignore
-* Slices::
-* Too_Many_Parents::
-* Unassigned_OUT_Parameters::
-* Uncommented_BEGIN_In_Package_Bodies::
-* Unconditional_Exits::
-* Unconstrained_Array_Returns::
-* Universal_Ranges::
-* Unnamed_Blocks_And_Loops::
-@ignore
-* Unused_Subprograms::
-@end ignore
-* USE_PACKAGE_Clauses::
-* Visible_Components::
-* Volatile_Objects_Without_Address_Clauses::
-@end menu
-
-
-@node Abstract_Type_Declarations
-@subsection @code{Abstract_Type_Declarations}
-@cindex @code{Abstract_Type_Declarations} rule (for @command{gnatcheck})
-
-@noindent
-Flag all declarations of abstract types. For an abstract private
-type, both the private and full type declarations are flagged.
-
-This rule has no parameters.
-
-
-@node Anonymous_Arrays
-@subsection @code{Anonymous_Arrays}
-@cindex @code{Anonymous_Arrays} rule (for @command{gnatcheck})
-
-@noindent
-Flag all anonymous array type definitions (by Ada semantics these can only
-occur in object declarations).
-
-This rule has no parameters.
-
-@node Anonymous_Subtypes
-@subsection @code{Anonymous_Subtypes}
-@cindex @code{Anonymous_Subtypes} rule (for @command{gnatcheck})
-
-@noindent
-Flag all uses of anonymous subtypes (except cases when subtype indication
-is a part of a record component definition, and this subtype indication
-depends on a discriminant). A use of an anonymous subtype is
-any instance of a subtype indication with a constraint, other than one
-that occurs immediately within a subtype declaration. Any use of a range
-other than as a constraint used immediately within a subtype declaration
-is considered as an anonymous subtype.
-
-An effect of this rule is that @code{for} loops such as the following are
-flagged (since @code{1..N} is formally a ``range''):
-
-@smallexample @c ada
-for I in 1 .. N loop
- @dots{}
-end loop;
-@end smallexample
-
-@noindent
-Declaring an explicit subtype solves the problem:
-
-@smallexample @c ada
-subtype S is Integer range 1..N;
-@dots{}
-for I in S loop
- @dots{}
-end loop;
-@end smallexample
-
-@noindent
-This rule has no parameters.
-
-@node Blocks
-@subsection @code{Blocks}
-@cindex @code{Blocks} rule (for @command{gnatcheck})
-
-@noindent
-Flag each block statement.
-
-This rule has no parameters.
-
-@node Boolean_Relational_Operators
-@subsection @code{Boolean_Relational_Operators}
-@cindex @code{Boolean_Relational_Operators} rule (for @command{gnatcheck})
-
-@noindent
-Flag each call to a predefined relational operator (``<'', ``>'', ``<='',
-``>='', ``='' and ``/='') for the predefined Boolean type.
-(This rule is useful in enforcing the SPARK language restrictions.)
-
-Calls to predefined relational operators of any type derived from
-@code{Standard.Boolean} are not detected. Calls to user-defined functions
-with these designators, and uses of operators that are renamings
-of the predefined relational operators for @code{Standard.Boolean},
-are likewise not detected.
-
-This rule has no parameters.
-
-@ignore
-@node Ceiling_Violations
-@subsection @code{Ceiling5_Violations} (under construction, GLOBAL)
-@cindex @code{Ceiling_Violations} rule (for @command{gnatcheck})
-
-@noindent
-Flag invocations of a protected operation by a task whose priority exceeds
-the protected object's ceiling.
-
-As of @value{NOW}, this rule has the following limitations:
-
-@itemize @bullet
-
-@item
- We consider only pragmas Priority and Interrupt_Priority as means to define
- a task/protected operation priority. We do not consider the effect of using
- Ada.Dynamic_Priorities.Set_Priority procedure;
-
-@item
- We consider only base task priorities, and no priority inheritance. That is,
- we do not make a difference between calls issued during task activation and
- execution of the sequence of statements from task body;
-
-@item
- Any situation when the priority of protected operation caller is set by a
- dynamic expression (that is, the corresponding Priority or
- Interrupt_Priority pragma has a non-static expression as an argument) we
- treat as a priority inconsistency (and, therefore, detect this situation).
-@end itemize
-
-@noindent
-At the moment the notion of the main subprogram is not implemented in
-gnatcheck, so any pragma Priority in a library level subprogram body (in case
-if this subprogram can be a main subprogram of a partition) changes the
-priority of an environment task. So if we have more then one such pragma in
-the set of processed sources, the pragma that is processed last, defines the
-priority of an environment task.
-
-This rule has no parameters.
-@end ignore
-
-@node Controlled_Type_Declarations
-@subsection @code{Controlled_Type_Declarations}
-@cindex @code{Controlled_Type_Declarations} rule (for @command{gnatcheck})
-
-@noindent
-Flag all declarations of controlled types. A declaration of a private type
-is flagged if its full declaration declares a controlled type. A declaration
-of a derived type is flagged if its ancestor type is controlled. Subtype
-declarations are not checked. A declaration of a type that itself is not a
-descendant of a type declared in @code{Ada.Finalization} but has a controlled
-component is not checked.
-
-This rule has no parameters.
-
-
-@node Complex_Inlined_Subprograms
-@subsection @code{Complex_Inlined_Subprograms}
-@cindex @code{Complex_Inlined_Subprograms} rule (for @command{gnatcheck})
-
-@noindent
-Flags a subprogram (or generic subprogram) if
-pragma Inline is applied to the subprogram and at least one of the following
-conditions is met:
-
-@itemize @bullet
-@item
-it contains at least one complex declaration such as a subprogram body,
-package, task, protected declaration, or a generic instantiation
-(except instantiation of @code{Ada.Unchecked_Conversion});
-
-@item
-it contains at least one complex statement such as a loop, a case
-or a if statement, or a short circuit control form;
-
-@item
-the number of statements exceeds
-a value specified by the @option{N} rule parameter;
-@end itemize
-
-@noindent
-This rule has the following (mandatory) parameter for the @option{+R} option:
-
-@table @emph
-@item N
-Positive integer specifying the maximum allowed total number of statements
-in the subprogram body.
-@end table
-
-
-@node Declarations_In_Blocks
-@subsection @code{Declarations_In_Blocks}
-@cindex @code{Declarations_In_Blocks} rule (for @command{gnatcheck})
-
-@noindent
-Flag all block statements containing local declarations. A @code{declare}
-block with an empty @i{declarative_part} or with a @i{declarative part}
-containing only pragmas and/or @code{use} clauses is not flagged.
-
-This rule has no parameters.
-
-
-@node Deep_Inheritance_Hierarchies
-@subsection @code{Deep_Inheritance_Hierarchies}
-@cindex @code{Deep_Inheritance_Hierarchies} rule (for @command{gnatcheck})
-
-@noindent
-Flags a tagged derived type declaration or an interface type declaration if
-its depth (in its inheritance
-hierarchy) exceeds the value specified by the @option{N} rule parameter.
-
-The inheritance depth of a tagged type or interface type is defined as 0 for
-a type with no parent and no progenitor, and otherwise as 1 + max of the
-depths of the immediate parent and immediate progenitors.
-
-This rule does not flag private extension
-declarations. In the case of a private extension, the corresponding full
-declaration is checked.
-
-This rule has the following (mandatory) parameter for the @option{+R} option:
-
-@table @emph
-@item N
-Integer not less than -1 specifying the maximal allowed depth of any inheritance
-hierarchy. If the rule parameter is set to -1, the rule flags all the declarations
-of tagged and interface types.
-@end table
-
-
-@node Deeply_Nested_Generics
-@subsection @code{Deeply_Nested_Generics}
-@cindex @code{Deeply_Nested_Generics} rule (for @command{gnatcheck})
-
-@noindent
-Flags a generic declaration nested in another generic declaration if
-the nesting level of the inner generic exceeds
-a value specified by the @option{N} rule parameter.
-The nesting level is the number of generic declaratons that enclose the given
-(generic) declaration. Formal packages are not flagged by this rule.
-
-This rule has the following (mandatory) parameters for the @option{+R} option:
-
-@table @emph
-@item N
-Positive integer specifying the maximal allowed nesting level
-for a generic declaration.
-@end table
-
-@node Deeply_Nested_Inlining
-@subsection @code{Deeply_Nested_Inlining}
-@cindex @code{Deeply_Nested_Inlining} rule (for @command{gnatcheck})
-
-@noindent
-Flags a subprogram (or generic subprogram) if
-pragma Inline has been applied to the subprogram but the subprogram
-calls to another inlined subprogram that results in nested inlining
-with nesting depth exceeding the value specified by the
-@option{N} rule parameter.
-
-This rule requires the global analysis of all the compilation units that
-are @command{gnatcheck} arguments; such analysis may affect the tool's
-performance.
-
-This rule has the following (mandatory) parameter for the @option{+R} option:
-
-@table @emph
-@item N
-Positive integer specifying the maximal allowed level of nested inlining.
-@end table
-
-
-@ignore
-@node Deeply_Nested_Local_Inlining
-@subsection @code{Deeply_Nested_Local_Inlining}
-@cindex @code{Deeply_Nested_Local_Inlining} rule (for @command{gnatcheck})
-
-@noindent
-Flags a subprogram body if a pragma @code{Inline} is applied to the
-corresponding subprogram (or generic subprogram) and the body contains a call
-to another inlined subprogram that results in nested inlining with nesting
-depth more then a value specified by the @option{N} rule parameter.
-This rule is similar to @code{Deeply_Nested_Inlining} rule, but it
-assumes that calls to subprograms in
-with'ed units are not inlided, so all the analysis of the depth of inlining is
-limited by the compilation unit where the subprogram body is located and the
-units it depends semantically upon. Such analysis may be usefull for the case
-when neiter @option{-gnatn} nor @option{-gnatN} option is used when building
-the executable.
-
-This rule has the following (mandatory) parameters for the @option{+R} option:
-
-@table @emph
-@item N
-Positive integer specifying the maximal allowed level of nested inlining.
-@end table
-
-@end ignore
-
-@node Default_Parameters
-@subsection @code{Default_Parameters}
-@cindex @code{Default_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flag all default expressions for subprogram parameters. Parameter
-declarations of formal and generic subprograms are also checked.
-
-This rule has no parameters.
-
-
-@node Direct_Calls_To_Primitives
-@subsection @code{Direct_Calls_To_Primitives}
-@cindex @code{Direct_Calls_To_Primitives} rule (for @command{gnatcheck})
-
-@noindent
-Flags any non-dispatching call to a dispatching primitive operation, except
-for the common idiom where a primitive subprogram for a tagged type
-directly calls the same primitive subprogram of the type's immediate ancestor.
-
-This rule has no parameters.
-
-
-@node Discriminated_Records
-@subsection @code{Discriminated_Records}
-@cindex @code{Discriminated_Records} rule (for @command{gnatcheck})
-
-@noindent
-Flag all declarations of record types with discriminants. Only the
-declarations of record and record extension types are checked. Incomplete,
-formal, private, derived and private extension type declarations are not
-checked. Task and protected type declarations also are not checked.
-
-This rule has no parameters.
-
-
-@node Enumeration_Ranges_In_CASE_Statements
-@subsection @code{Enumeration_Ranges_In_CASE_Statements}
-@cindex @code{Enumeration_Ranges_In_CASE_Statements} (for @command{gnatcheck})
-
-@noindent
-Flag each use of a range of enumeration literals as a choice in a
-@code{case} statement.
-All forms for specifying a range (explicit ranges
-such as @code{A .. B}, subtype marks and @code{'Range} attributes) are flagged.
-An enumeration range is
-flagged even if contains exactly one enumeration value or no values at all. A
-type derived from an enumeration type is considered as an enumeration type.
-
-This rule helps prevent maintenance problems arising from adding an
-enumeration value to a type and having it implicitly handled by an existing
-@code{case} statement with an enumeration range that includes the new literal.
-
-This rule has no parameters.
-
-
-@node Exceptions_As_Control_Flow
-@subsection @code{Exceptions_As_Control_Flow}
-@cindex @code{Exceptions_As_Control_Flow} (for @command{gnatcheck})
-
-@noindent
-Flag each place where an exception is explicitly raised and handled in the
-same subprogram body. A @code{raise} statement in an exception handler,
-package body, task body or entry body is not flagged.
-
-The rule has no parameters.
-
-@node Exits_From_Conditional_Loops
-@subsection @code{Exits_From_Conditional_Loops}
-@cindex @code{Exits_From_Conditional_Loops} (for @command{gnatcheck})
-
-@noindent
-Flag any exit statement if it transfers the control out of a @code{for} loop
-or a @code{while} loop. This includes cases when the @code{exit} statement
-applies to a @code{FOR} or @code{while} loop, and cases when it is enclosed
-in some @code{for} or @code{while} loop, but transfers the control from some
-outer (inconditional) @code{loop} statement.
-
-The rule has no parameters.
-
-
-@node EXIT_Statements_With_No_Loop_Name
-@subsection @code{EXIT_Statements_With_No_Loop_Name}
-@cindex @code{EXIT_Statements_With_No_Loop_Name} (for @command{gnatcheck})
-
-@noindent
-Flag each @code{exit} statement that does not specify the name of the loop
-being exited.
-
-The rule has no parameters.
-
-
-@node Expanded_Loop_Exit_Names
-@subsection @code{Expanded_Loop_Exit_Names}
-@cindex @code{Expanded_Loop_Exit_Names} rule (for @command{gnatcheck})
-
-@noindent
-Flag all expanded loop names in @code{exit} statements.
-
-This rule has no parameters.
-
-@node Explicit_Full_Discrete_Ranges
-@subsection @code{Explicit_Full_Discrete_Ranges}
-@cindex @code{Explicit_Full_Discrete_Ranges} rule (for @command{gnatcheck})
-
-@noindent
-Flag each discrete range that has the form @code{A'First .. A'Last}.
-
-This rule has no parameters.
-
-@node Float_Equality_Checks
-@subsection @code{Float_Equality_Checks}
-@cindex @code{Float_Equality_Checks} rule (for @command{gnatcheck})
-
-@noindent
-Flag all calls to the predefined equality operations for floating-point types.
-Both ``@code{=}'' and ``@code{/=}'' operations are checked.
-User-defined equality operations are not flagged, nor are ``@code{=}''
-and ``@code{/=}'' operations for fixed-point types.
-
-This rule has no parameters.
-
-
-@node Forbidden_Attributes
-@subsection @code{Forbidden_Attributes}
-@cindex @code{Forbidden_Attributes} rule (for @command{gnatcheck})
-
-@noindent
-Flag each use of the specified attributes. The attributes to be detected are
-named in the rule's parameters.
-
-This rule has the following parameters:
-
-@itemize @bullet
-@item For the @option{+R} option
-
-@table @asis
-@item @emph{Attribute_Designator}
-Adds the specified attribute to the set of attributes to be detected and sets
-the detection checks for all the specified attributes ON.
-If @emph{Attribute_Designator}
-does not denote any attribute defined in the Ada standard
-or in
-@ref{Implementation Defined Attributes,,, gnat_rm, GNAT Reference
-Manual}, it is treated as the name of unknown attribute.
-
-@item @code{GNAT}
-All the GNAT-specific attributes are detected; this sets
-the detection checks for all the specified attributes ON.
-
-@item @code{ALL}
-All attributes are detected; this sets the rule ON.
-@end table
-
-@item For the @option{-R} option
-@table @asis
-@item @emph{Attribute_Designator}
-Removes the specified attribute from the set of attributes to be
-detected without affecting detection checks for
-other attributes. If @emph{Attribute_Designator} does not correspond to any
-attribute defined in the Ada standard or in
-@ref{Implementation Defined Attributes,,, gnat_rm, GNAT Reference Manual},
-this option is treated as turning OFF detection of all unknown attributes.
-
-@item GNAT
-Turn OFF detection of all GNAT-specific attributes
-
-@item ALL
-Clear the list of the attributes to be detected and
-turn the rule OFF.
-@end table
-@end itemize
-
-@noindent
-Parameters are not case sensitive. If @emph{Attribute_Designator} does not
-have the syntax of an Ada identifier and therefore can not be considered as a
-(part of an) attribute designator, a diagnostic message is generated and the
-corresponding parameter is ignored. (If an attribute allows a static
-expression to be a part of the attribute designator, this expression is
-ignored by this rule.)
-
-When more then one parameter is given in the same rule option, the parameters
-must be separated by commas.
-
-If more then one option for this rule is specified for the gnatcheck call, a
-new option overrides the previous one(s).
-
-The @option{+R} option with no parameters turns the rule ON, with the set of
-attributes to be detected defined by the previous rule options.
-(By default this set is empty, so if the only option specified for the rule is
-@option{+RForbidden_Attributes} (with
-no parameter), then the rule is enabled, but it does not detect anything).
-The @option{-R} option with no parameter turns the rule OFF, but it does not
-affect the set of attributes to be detected.
-
-
-@node Forbidden_Pragmas
-@subsection @code{Forbidden_Pragmas}
-@cindex @code{Forbidden_Pragmas} rule (for @command{gnatcheck})
-
-@noindent
-Flag each use of the specified pragmas. The pragmas to be detected
-are named in the rule's parameters.
-
-This rule has the following parameters:
-
-@itemize @bullet
-@item For the @option{+R} option
-
-@table @asis
-@item @emph{Pragma_Name}
-Adds the specified pragma to the set of pragmas to be
-checked and sets the checks for all the specified pragmas
-ON. @emph{Pragma_Name} is treated as a name of a pragma. If it
-does not correspond to any pragma name defined in the Ada
-standard or to the name of a GNAT-specific pragma defined
-in @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference
-Manual}, it is treated as the name of unknown pragma.
-
-@item @code{GNAT}
-All the GNAT-specific pragmas are detected; this sets
-the checks for all the specified pragmas ON.
-
-@item @code{ALL}
-All pragmas are detected; this sets the rule ON.
-@end table
-
-@item For the @option{-R} option
-@table @asis
-@item @emph{Pragma_Name}
-Removes the specified pragma from the set of pragmas to be
-checked without affecting checks for
-other pragmas. @emph{Pragma_Name} is treated as a name
-of a pragma. If it does not correspond to any pragma
-defined in the Ada standard or to any name defined in
-@ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual},
-this option is treated as turning OFF detection of all unknown pragmas.
-
-@item GNAT
-Turn OFF detection of all GNAT-specific pragmas
-
-@item ALL
-Clear the list of the pragmas to be detected and
-turn the rule OFF.
-@end table
-@end itemize
-
-@noindent
-Parameters are not case sensitive. If @emph{Pragma_Name} does not have
-the syntax of an Ada identifier and therefore can not be considered
-as a pragma name, a diagnostic message is generated and the corresponding
-parameter is ignored.
-
-When more then one parameter is given in the same rule option, the parameters
-must be separated by a comma.
-
-If more then one option for this rule is specified for the @command{gnatcheck}
-call, a new option overrides the previous one(s).
-
-The @option{+R} option with no parameters turns the rule ON with the set of
-pragmas to be detected defined by the previous rule options.
-(By default this set is empty, so if the only option specified for the rule is
-@option{+RForbidden_Pragmas} (with
-no parameter), then the rule is enabled, but it does not detect anything).
-The @option{-R} option with no parameter turns the rule OFF, but it does not
-affect the set of pragmas to be detected.
-
-
-
-
-@node Function_Style_Procedures
-@subsection @code{Function_Style_Procedures}
-@cindex @code{Function_Style_Procedures} rule (for @command{gnatcheck})
-
-@noindent
-Flag each procedure that can be rewritten as a function. A procedure can be
-converted into a function if it has exactly one parameter of mode @code{out}
-and no parameters of mode @code{in out}. Procedure declarations,
-formal procedure declarations, and generic procedure declarations are always
-checked. Procedure
-bodies and body stubs are flagged only if they do not have corresponding
-separate declarations. Procedure renamings and procedure instantiations are
-not flagged.
-
-If a procedure can be rewritten as a function, but its @code{out} parameter is
-of a limited type, it is not flagged.
-
-Protected procedures are not flagged. Null procedures also are not flagged.
-
-This rule has no parameters.
-
-
-@node Generics_In_Subprograms
-@subsection @code{Generics_In_Subprograms}
-@cindex @code{Generics_In_Subprograms} rule (for @command{gnatcheck})
-
-@noindent
-Flag each declaration of a generic unit in a subprogram. Generic
-declarations in the bodies of generic subprograms are also flagged.
-A generic unit nested in another generic unit is not flagged.
-If a generic unit is
-declared in a local package that is declared in a subprogram body, the
-generic unit is flagged.
-
-This rule has no parameters.
-
-
-@node GOTO_Statements
-@subsection @code{GOTO_Statements}
-@cindex @code{GOTO_Statements} rule (for @command{gnatcheck})
-
-@noindent
-Flag each occurrence of a @code{goto} statement.
-
-This rule has no parameters.
-
-
-@node Implicit_IN_Mode_Parameters
-@subsection @code{Implicit_IN_Mode_Parameters}
-@cindex @code{Implicit_IN_Mode_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flag each occurrence of a formal parameter with an implicit @code{in} mode.
-Note that @code{access} parameters, although they technically behave
-like @code{in} parameters, are not flagged.
-
-This rule has no parameters.
-
-
-@node Implicit_SMALL_For_Fixed_Point_Types
-@subsection @code{Implicit_SMALL_For_Fixed_Point_Types}
-@cindex @code{Implicit_SMALL_For_Fixed_Point_Types} rule (for @command{gnatcheck})
-
-@noindent
-Flag each fixed point type declaration that lacks an explicit
-representation clause to define its @code{'Small} value.
-Since @code{'Small} can be defined only for ordinary fixed point types,
-decimal fixed point type declarations are not checked.
-
-This rule has no parameters.
-
-
-@node Improperly_Located_Instantiations
-@subsection @code{Improperly_Located_Instantiations}
-@cindex @code{Improperly_Located_Instantiations} rule (for @command{gnatcheck})
-
-@noindent
-Flag all generic instantiations in library-level package specs
-(including library generic packages) and in all subprogram bodies.
-
-Instantiations in task and entry bodies are not flagged. Instantiations in the
-bodies of protected subprograms are flagged.
-
-This rule has no parameters.
-
-
-
-@node Improper_Returns
-@subsection @code{Improper_Returns}
-@cindex @code{Improper_Returns} rule (for @command{gnatcheck})
-
-@noindent
-Flag each explicit @code{return} statement in procedures, and
-multiple @code{return} statements in functions.
-Diagnostic messages are generated for all @code{return} statements
-in a procedure (thus each procedure must be written so that it
-returns implicitly at the end of its statement part),
-and for all @code{return} statements in a function after the first one.
-This rule supports the stylistic convention that each subprogram
-should have no more than one point of normal return.
-
-This rule has no parameters.
-
-
-@node Library_Level_Subprograms
-@subsection @code{Library_Level_Subprograms}
-@cindex @code{Library_Level_Subprograms} rule (for @command{gnatcheck})
-
-@noindent
-Flag all library-level subprograms (including generic subprogram instantiations).
-
-This rule has no parameters.
-
-
-@node Local_Packages
-@subsection @code{Local_Packages}
-@cindex @code{Local_Packages} rule (for @command{gnatcheck})
-
-@noindent
-Flag all local packages declared in package and generic package
-specs.
-Local packages in bodies are not flagged.
-
-This rule has no parameters.
-
-@ignore
-@node Improperly_Called_Protected_Entries
-@subsection @code{Improperly_Called_Protected_Entries} (under construction, GLOBAL)
-@cindex @code{Improperly_Called_Protected_Entries} rule (for @command{gnatcheck})
-
-@noindent
-Flag each protected entry that can be called from more than one task.
-
-This rule has no parameters.
-@end ignore
-
-@node Metrics
-@subsection @code{Metrics}
-@cindex @code{Metrics} rule (for @command{gnatcheck})
-
-@noindent
-There is a set of checks based on computing a metric value and comparing the
-result with the specified upper (or lower, depending on a specific metric)
-value specified for a given metric. A construct is flagged if a given metric
-is applicable (can be computed) for it and the computed value is greater
-then (lover then) the specified upper (lower) bound.
-
-The name of any metric-based rule consists of the prefix @code{Metrics_}
-followed by the name of the corresponding metric (see the table below).
-For @option{+R} option, each metric-based rule has a numeric parameter
-specifying the bound (integer or real, depending on a metric), @option{-R}
-option for metric rules does not have a parameter.
-
-The following table shows the metric names for that the corresponding
-metrics-based checks are supported by gnatcheck, including the
-constraint that must be satisfied by the bound that is specified for the check
-and what bound - upper (U) or lower (L) - should be specified.
-
-@multitable {@code{Cyclomatic_Complexity}}{Cyclomatic complexity}{Positive integer}
-@ifnothtml
-@headitem Check Name @tab Description @tab Bounds Value
-@end ifnothtml
-@ifhtml
-@item @b{Check Name} @tab @b{Description} @tab @b{Bounds Value}
-@end ifhtml
-@c Above conditional code is workaround to bug in texi2html (Feb 2008)
-@item @code{Essential_Complexity} @tab Essential complexity @tab Positive integer (U)
-@item @code{Cyclomatic_Complexity} @tab Cyclomatic complexity @tab Positive integer (U)
-@item @code{LSLOC} @tab Logical Source Lines of Code @tab Positive integer (U)
-@end multitable
-
-@noindent
-The meaning and the computed values for all these metrics are exactly
-the same as for the corresponding metrics in @command{gnatmetric}.
-
-@emph{Example:} the rule
-@smallexample
-+RMetrics_Cyclomatic_Complexity : 7
-@end smallexample
-@noindent
-means that all bodies with cyclomatic complexity exceeding 7 will be flagged.
-
-To turn OFF the check for cyclomatic complexity metric, use the following option:
-@smallexample
--RMetrics_Cyclomatic_Complexity
-@end smallexample
-
-
-@node Misnamed_Controlling_Parameters
-@subsection @code{Misnamed_Controlling_Parameters}
-@cindex @code{Misnamed_Controlling_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flags a declaration of a dispatching operation, if the first parameter is
-not a controlling one and its name is not @code{This} (the check for
-parameter name is not case-sensitive). Declarations of dispatching functions
-with controlling result and no controlling parameter are never flagged.
-
-A subprogram body declaration, subprogram renaming declaration or subprogram
-body stub is flagged only if it is not a completion of a prior subprogram
-declaration.
-
-This rule has no parameters.
-
-
-
-@node Misnamed_Identifiers
-@subsection @code{Misnamed_Identifiers}
-@cindex @code{Misnamed_Identifiers} rule (for @command{gnatcheck})
-
-@noindent
-Flag the declaration of each identifier that does not have a suffix
-corresponding to the kind of entity being declared.
-The following declarations are checked:
-
-@itemize @bullet
-@item
-type declarations
-
-@item
-subtype declarations
-
-@item
-constant declarations (but not number declarations)
-
-@item
-package renaming declarations (but not generic package renaming
-declarations)
-@end itemize
-
-@noindent
-This rule may have parameters. When used without parameters, the rule enforces
-the following checks:
-
-@itemize @bullet
-@item
-type-defining names end with @code{_T}, unless the type is an access type,
-in which case the suffix must be @code{_A}
-@item
-constant names end with @code{_C}
-@item
-names defining package renamings end with @code{_R}
-@end itemize
-
-@noindent
-Defining identifiers from incomplete type declarations are never flagged.
-
-For a private type declaration (including private extensions), the defining
-identifier from the private type declaration is checked against the type
-suffix (even if the corresponding full declaration is an access type
-declaration), and the defining identifier from the corresponding full type
-declaration is not checked.
-
-@noindent
-For a deferred constant, the defining name in the corresponding full constant
-declaration is not checked.
-
-Defining names of formal types are not checked.
-
-The rule may have the following parameters:
-
-@itemize @bullet
-@item
-For the @option{+R} option:
-@table @code
-@item Default
-Sets the default listed above for all the names to be checked.
-
-@item Type_Suffix=@emph{string}
-Specifies the suffix for a type name.
-
-@item Access_Suffix=@emph{string}
-Specifies the suffix for an access type name. If
-this parameter is set, it overrides for access
-types the suffix set by the @code{Type_Suffix} parameter.
-For access types, @emph{string} may have the following format:
-@emph{suffix1(suffix2)}. That means that an access type name
-should have the @emph{suffix1} suffix except for the case when
-the designated type is also an access type, in this case the
-type name should have the @emph{suffix1 & suffix2} suffix.
-
-@item Class_Access_Suffix=@emph{string}
-Specifies the suffix for the name of an access type that points to some class-wide
-type. If this parameter is set, it overrides for such access
-types the suffix set by the @code{Type_Suffix} or @code{Access_Suffix}
-parameter.
-
-@item Class_Subtype_Suffix=@emph{string}
-Specifies the suffix for the name of a subtype that denotes a class-wide type.
-
-@item Constant_Suffix=@emph{string}
-Specifies the suffix for a constant name.
-
-@item Renaming_Suffix=@emph{string}
-Specifies the suffix for a package renaming name.
-@end table
-
-@item
-For the @option{-R} option:
-@table @code
-@item All_Suffixes
-Remove all the suffixes specified for the
-identifier suffix checks, whether by default or
-as specified by other rule parameters. All the
-checks for this rule are disabled as a result.
-
-@item Type_Suffix
-Removes the suffix specified for types. This
-disables checks for types but does not disable
-any other checks for this rule (including the
-check for access type names if @code{Access_Suffix} is
-set).
-
-@item Access_Suffix
-Removes the suffix specified for access types.
-This disables checks for access type names but
-does not disable any other checks for this rule.
-If @code{Type_Suffix} is set, access type names are
-checked as ordinary type names.
-
-@item Class_Access_Suffix
-Removes the suffix specified for access types pointing to class-wide
-type. This disables specific checks for names of access types pointing to
-class-wide types but does not disable any other checks for this rule.
-If @code{Type_Suffix} is set, access type names are
-checked as ordinary type names. If @code{Access_Suffix} is set, these
-access types are checked as any other access type name.
-
-@item Class_Subtype_Suffix=@emph{string}
-Removes the suffix specified for subtype names.
-This disables checks for subtype names but
-does not disable any other checks for this rule.
-
-@item Constant_Suffix
-Removes the suffix specified for constants. This
-disables checks for constant names but does not
-disable any other checks for this rule.
-
-@item Renaming_Suffix
-Removes the suffix specified for package
-renamings. This disables checks for package
-renamings but does not disable any other checks
-for this rule.
-@end table
-@end itemize
-
-@noindent
-If more than one parameter is used, parameters must be separated by commas.
-
-If more than one option is specified for the @command{gnatcheck} invocation,
-a new option overrides the previous one(s).
-
-The @option{+RMisnamed_Identifiers} option (with no parameter) enables
-checks for all the
-name suffixes specified by previous options used for this rule.
-
-The @option{-RMisnamed_Identifiers} option (with no parameter) disables
-all the checks but keeps
-all the suffixes specified by previous options used for this rule.
-
-The @emph{string} value must be a valid suffix for an Ada identifier (after
-trimming all the leading and trailing space characters, if any).
-Parameters are not case sensitive, except the @emph{string} part.
-
-If any error is detected in a rule parameter, the parameter is ignored.
-In such a case the options that are set for the rule are not
-specified.
-
-
-
-@node Multiple_Entries_In_Protected_Definitions
-@subsection @code{Multiple_Entries_In_Protected_Definitions}
-@cindex @code{Multiple_Entries_In_Protected_Definitions} rule (for @command{gnatcheck})
-
-@noindent
-Flag each protected definition (i.e., each protected object/type declaration)
-that defines more than one entry.
-Diagnostic messages are generated for all the entry declarations
-except the first one. An entry family is counted as one entry. Entries from
-the private part of the protected definition are also checked.
-
-This rule has no parameters.
-
-@node Name_Clashes
-@subsection @code{Name_Clashes}
-@cindex @code{Name_Clashes} rule (for @command{gnatcheck})
-
-@noindent
-Check that certain names are not used as defining identifiers. To activate
-this rule, you need to supply a reference to the dictionary file(s) as a rule
-parameter(s) (more then one dictionary file can be specified). If no
-dictionary file is set, this rule will not cause anything to be flagged.
-Only defining occurrences, not references, are checked.
-The check is not case-sensitive.
-
-This rule is enabled by default, but without setting any corresponding
-dictionary file(s); thus the default effect is to do no checks.
-
-A dictionary file is a plain text file. The maximum line length for this file
-is 1024 characters. If the line is longer then this limit, extra characters
-are ignored.
-
-Each line can be either an empty line, a comment line, or a line containing
-a list of identifiers separated by space or HT characters.
-A comment is an Ada-style comment (from @code{--} to end-of-line).
-Identifiers must follow the Ada syntax for identifiers.
-A line containing one or more identifiers may end with a comment.
-
-@node Non_Qualified_Aggregates
-@subsection @code{Non_Qualified_Aggregates}
-@cindex @code{Non_Qualified_Aggregates} rule (for @command{gnatcheck})
-
-@noindent
-Flag each non-qualified aggregate.
-A non-qualified aggregate is an
-aggregate that is not the expression of a qualified expression. A
-string literal is not considered an aggregate, but an array
-aggregate of a string type is considered as a normal aggregate.
-Aggregates of anonymous array types are not flagged.
-
-This rule has no parameters.
-
-
-@node Non_Short_Circuit_Operators
-@subsection @code{Non_Short_Circuit_Operators}
-@cindex @code{Non_Short_Circuit_Operators} rule (for @command{gnatcheck})
-
-@noindent
-Flag all calls to predefined @code{and} and @code{or} operators for
-any boolean type. Calls to
-user-defined @code{and} and @code{or} and to operators defined by renaming
-declarations are not flagged. Calls to predefined @code{and} and @code{or}
-operators for modular types or boolean array types are not flagged.
-
-This rule has no parameters.
-
-
-
-@node Non_SPARK_Attributes
-@subsection @code{Non_SPARK_Attributes}
-@cindex @code{Non_SPARK_Attributes} rule (for @command{gnatcheck})
-
-@noindent
-The SPARK language defines the following subset of Ada 95 attribute
-designators as those that can be used in SPARK programs. The use of
-any other attribute is flagged.
-
-@itemize @bullet
-@item @code{'Adjacent}
-@item @code{'Aft}
-@item @code{'Base}
-@item @code{'Ceiling}
-@item @code{'Component_Size}
-@item @code{'Compose}
-@item @code{'Copy_Sign}
-@item @code{'Delta}
-@item @code{'Denorm}
-@item @code{'Digits}
-@item @code{'Exponent}
-@item @code{'First}
-@item @code{'Floor}
-@item @code{'Fore}
-@item @code{'Fraction}
-@item @code{'Last}
-@item @code{'Leading_Part}
-@item @code{'Length}
-@item @code{'Machine}
-@item @code{'Machine_Emax}
-@item @code{'Machine_Emin}
-@item @code{'Machine_Mantissa}
-@item @code{'Machine_Overflows}
-@item @code{'Machine_Radix}
-@item @code{'Machine_Rounds}
-@item @code{'Max}
-@item @code{'Min}
-@item @code{'Model}
-@item @code{'Model_Emin}
-@item @code{'Model_Epsilon}
-@item @code{'Model_Mantissa}
-@item @code{'Model_Small}
-@item @code{'Modulus}
-@item @code{'Pos}
-@item @code{'Pred}
-@item @code{'Range}
-@item @code{'Remainder}
-@item @code{'Rounding}
-@item @code{'Safe_First}
-@item @code{'Safe_Last}
-@item @code{'Scaling}
-@item @code{'Signed_Zeros}
-@item @code{'Size}
-@item @code{'Small}
-@item @code{'Succ}
-@item @code{'Truncation}
-@item @code{'Unbiased_Rounding}
-@item @code{'Val}
-@item @code{'Valid}
-@end itemize
-
-@noindent
-This rule has no parameters.
-
-
-@node Non_Tagged_Derived_Types
-@subsection @code{Non_Tagged_Derived_Types}
-@cindex @code{Non_Tagged_Derived_Types} rule (for @command{gnatcheck})
-
-@noindent
-Flag all derived type declarations that do not have a record extension part.
-
-This rule has no parameters.
-
-
-
-@node Non_Visible_Exceptions
-@subsection @code{Non_Visible_Exceptions}
-@cindex @code{Non_Visible_Exceptions} rule (for @command{gnatcheck})
-
-@noindent
-Flag constructs leading to the possibility of propagating an exception
-out of the scope in which the exception is declared.
-Two cases are detected:
-
-@itemize @bullet
-@item
-An exception declaration in a subprogram body, task body or block
-statement is flagged if the body or statement does not contain a handler for
-that exception or a handler with an @code{others} choice.
-
-@item
-A @code{raise} statement in an exception handler of a subprogram body,
-task body or block statement is flagged if it (re)raises a locally
-declared exception. This may occur under the following circumstances:
-@itemize @minus
-@item
-it explicitly raises a locally declared exception, or
-@item
-it does not specify an exception name (i.e., it is simply @code{raise;})
-and the enclosing handler contains a locally declared exception in its
-exception choices.
-@end itemize
-@end itemize
-
-@noindent
-Renamings of local exceptions are not flagged.
-
-This rule has no parameters.
-
-
-@node Numeric_Literals
-@subsection @code{Numeric_Literals}
-@cindex @code{Numeric_Literals} rule (for @command{gnatcheck})
-
-@noindent
-Flag each use of a numeric literal in an index expression, and in any
-circumstance except for the following:
-
-@itemize @bullet
-@item
-a literal occurring in the initialization expression for a constant
-declaration or a named number declaration, or
-
-@item
-an integer literal that is less than or equal to a value
-specified by the @option{N} rule parameter.
-@end itemize
-
-@noindent
-This rule may have the following parameters for the @option{+R} option:
-
-@table @asis
-@item @emph{N}
-@emph{N} is an integer literal used as the maximal value that is not flagged
-(i.e., integer literals not exceeding this value are allowed)
-
-@item @code{ALL}
-All integer literals are flagged
-@end table
-
-@noindent
-If no parameters are set, the maximum unflagged value is 1.
-
-The last specified check limit (or the fact that there is no limit at
-all) is used when multiple @option{+R} options appear.
-
-The @option{-R} option for this rule has no parameters.
-It disables the rule but retains the last specified maximum unflagged value.
-If the @option{+R} option subsequently appears, this value is used as the
-threshold for the check.
-
-
-@node OTHERS_In_Aggregates
-@subsection @code{OTHERS_In_Aggregates}
-@cindex @code{OTHERS_In_Aggregates} rule (for @command{gnatcheck})
-
-@noindent
-Flag each use of an @code{others} choice in extension aggregates.
-In record and array aggregates, an @code{others} choice is flagged unless
-it is used to refer to all components, or to all but one component.
-
-If, in case of a named array aggregate, there are two associations, one
-with an @code{others} choice and another with a discrete range, the
-@code{others} choice is flagged even if the discrete range specifies
-exactly one component; for example, @code{(1..1 => 0, others => 1)}.
-
-This rule has no parameters.
-
-@node OTHERS_In_CASE_Statements
-@subsection @code{OTHERS_In_CASE_Statements}
-@cindex @code{OTHERS_In_CASE_Statements} rule (for @command{gnatcheck})
-
-@noindent
-Flag any use of an @code{others} choice in a @code{case} statement.
-
-This rule has no parameters.
-
-@node OTHERS_In_Exception_Handlers
-@subsection @code{OTHERS_In_Exception_Handlers}
-@cindex @code{OTHERS_In_Exception_Handlers} rule (for @command{gnatcheck})
-
-@noindent
-Flag any use of an @code{others} choice in an exception handler.
-
-This rule has no parameters.
-
-
-@node Outer_Loop_Exits
-@subsection @code{Outer_Loop_Exits}
-@cindex @code{Outer_Loop_Exits} rule (for @command{gnatcheck})
-
-@noindent
-Flag each @code{exit} statement containing a loop name that is not the name
-of the immediately enclosing @code{loop} statement.
-
-This rule has no parameters.
-
-
-@node Overloaded_Operators
-@subsection @code{Overloaded_Operators}
-@cindex @code{Overloaded_Operators} rule (for @command{gnatcheck})
-
-@noindent
-Flag each function declaration that overloads an operator symbol.
-A function body is checked only if the body does not have a
-separate spec. Formal functions are also checked. For a
-renaming declaration, only renaming-as-declaration is checked
-
-This rule has no parameters.
-
-
-@node Overly_Nested_Control_Structures
-@subsection @code{Overly_Nested_Control_Structures}
-@cindex @code{Overly_Nested_Control_Structures} rule (for @command{gnatcheck})
-
-@noindent
-Flag each control structure whose nesting level exceeds the value provided
-in the rule parameter.
-
-The control structures checked are the following:
-
-@itemize @bullet
-@item @code{if} statement
-@item @code{case} statement
-@item @code{loop} statement
-@item Selective accept statement
-@item Timed entry call statement
-@item Conditional entry call
-@item Asynchronous select statement
-@end itemize
-
-@noindent
-The rule has the following parameter for the @option{+R} option:
-
-@table @emph
-@item N
-Positive integer specifying the maximal control structure nesting
-level that is not flagged
-@end table
-
-@noindent
-If the parameter for the @option{+R} option is not specified or
-if it is not a positive integer, @option{+R} option is ignored.
-
-If more then one option is specified for the gnatcheck call, the later option and
-new parameter override the previous one(s).
-
-
-@node Parameters_Out_Of_Order
-@subsection @code{Parameters_Out_Of_Order}
-@cindex @code{Parameters_Out_Of_Order} rule (for @command{gnatcheck})
-
-@noindent
-Flag each subprogram and entry declaration whose formal parameters are not
-ordered according to the following scheme:
-
-@itemize @bullet
-
-@item @code{in} and @code{access} parameters first,
-then @code{in out} parameters,
-and then @code{out} parameters;
-
-@item for @code{in} mode, parameters with default initialization expressions
-occur last
-@end itemize
-
-@noindent
-Only the first violation of the described order is flagged.
-
-The following constructs are checked:
-
-@itemize @bullet
-@item subprogram declarations (including null procedures);
-@item generic subprogram declarations;
-@item formal subprogram declarations;
-@item entry declarations;
-@item subprogram bodies and subprogram body stubs that do not
-have separate specifications
-@end itemize
-
-@noindent
-Subprogram renamings are not checked.
-
-This rule has no parameters.
-
-
-@node Positional_Actuals_For_Defaulted_Generic_Parameters
-@subsection @code{Positional_Actuals_For_Defaulted_Generic_Parameters}
-@cindex @code{Positional_Actuals_For_Defaulted_Generic_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flag each generic actual parameter corresponding to a generic formal
-parameter with a default initialization, if positional notation is used.
-
-This rule has no parameters.
-
-@node Positional_Actuals_For_Defaulted_Parameters
-@subsection @code{Positional_Actuals_For_Defaulted_Parameters}
-@cindex @code{Positional_Actuals_For_Defaulted_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flag each actual parameter to a subprogram or entry call where the
-corresponding formal parameter has a default expression, if positional
-notation is used.
-
-This rule has no parameters.
-
-@node Positional_Components
-@subsection @code{Positional_Components}
-@cindex @code{Positional_Components} rule (for @command{gnatcheck})
-
-@noindent
-Flag each array, record and extension aggregate that includes positional
-notation.
-
-This rule has no parameters.
-
-
-@node Positional_Generic_Parameters
-@subsection @code{Positional_Generic_Parameters}
-@cindex @code{Positional_Generic_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flag each positional actual generic parameter except for the case when
-the generic unit being iinstantiated has exactly one generic formal
-parameter.
-
-This rule has no parameters.
-
-
-@node Positional_Parameters
-@subsection @code{Positional_Parameters}
-@cindex @code{Positional_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flag each positional parameter notation in a subprogram or entry call,
-except for the following:
-
-@itemize @bullet
-@item
-Parameters of calls to of prefix or infix operators are not flagged
-@item
-If the called subprogram or entry has only one formal parameter,
-the parameter of the call is not flagged;
-@item
-If a subprogram call uses the @emph{Object.Operation} notation, then
-@itemize @minus
-@item
-the first parameter (that is, @emph{Object}) is not flagged;
-@item
-if the called subprogram has only two parameters, the second parameter
-of the call is not flagged;
-@end itemize
-@end itemize
-
-@noindent
-This rule has no parameters.
-
-
-
-
-@node Predefined_Numeric_Types
-@subsection @code{Predefined_Numeric_Types}
-@cindex @code{Predefined_Numeric_Types} rule (for @command{gnatcheck})
-
-@noindent
-Flag each explicit use of the name of any numeric type or subtype defined
-in package @code{Standard}.
-
-The rationale for this rule is to detect when the
-program may depend on platform-specific characteristics of the implementation
-of the predefined numeric types. Note that this rule is over-pessimistic;
-for example, a program that uses @code{String} indexing
-likely needs a variable of type @code{Integer}.
-Another example is the flagging of predefined numeric types with explicit
-constraints:
-
-@smallexample @c ada
- subtype My_Integer is Integer range Left .. Right;
- Vy_Var : My_Integer;
-@end smallexample
-
-@noindent
-This rule detects only numeric types and subtypes defined in
-@code{Standard}. The use of numeric types and subtypes defined in other
-predefined packages (such as @code{System.Any_Priority} or
-@code{Ada.Text_IO.Count}) is not flagged
-
-This rule has no parameters.
-
-
-
-@node Raising_External_Exceptions
-@subsection @code{Raising_External_Exceptions}
-@cindex @code{Raising_External_Exceptions} rule (for @command{gnatcheck})
-
-@noindent
-Flag any @code{raise} statement, in a program unit declared in a library
-package or in a generic library package, for an exception that is
-neither a predefined exception nor an exception that is also declared (or
-renamed) in the visible part of the package.
-
-This rule has no parameters.
-
-
-
-@node Raising_Predefined_Exceptions
-@subsection @code{Raising_Predefined_Exceptions}
-@cindex @code{Raising_Predefined_Exceptions} rule (for @command{gnatcheck})
-
-@noindent
-Flag each @code{raise} statement that raises a predefined exception
-(i.e., one of the exceptions @code{Constraint_Error}, @code{Numeric_Error},
-@code{Program_Error}, @code{Storage_Error}, or @code{Tasking_Error}).
-
-This rule has no parameters.
-
-@node Separate_Numeric_Error_Handlers
-@subsection @code{Separate_Numeric_Error_Handlers}
-@cindex @code{Separate_Numeric_Error_Handlers} rule (for @command{gnatcheck})
-
-@noindent
-Flags each exception handler that contains a choice for
-the predefined @code{Constraint_Error} exception, but does not contain
-the choice for the predefined @code{Numeric_Error} exception, or
-that contains the choice for @code{Numeric_Error}, but does not contain the
-choice for @code{Constraint_Error}.
-
-This rule has no parameters.
-
-@ignore
-@node Recursion
-@subsection @code{Recursion} (under construction, GLOBAL)
-@cindex @code{Recursion} rule (for @command{gnatcheck})
-
-@noindent
-Flag recursive subprograms (cycles in the call graph). Declarations, and not
-calls, of recursive subprograms are detected.
-
-This rule has no parameters.
-@end ignore
-
-@ignore
-@node Side_Effect_Functions
-@subsection @code{Side_Effect_Functions} (under construction, GLOBAL)
-@cindex @code{Side_Effect_Functions} rule (for @command{gnatcheck})
-
-@noindent
-Flag functions with side effects.
-
-We define a side effect as changing any data object that is not local for the
-body of this function.
-
-At the moment, we do NOT consider a side effect any input-output operations
-(changing a state or a content of any file).
-
-We do not consider protected functions for this rule (???)
-
-There are the following sources of side effect:
-
-@enumerate
-@item Explicit (or direct) side-effect:
-
-@itemize @bullet
-@item
-direct assignment to a non-local variable;
-
-@item
-direct call to an entity that is known to change some data object that is
- not local for the body of this function (Note, that if F1 calls F2 and F2
- does have a side effect, this does not automatically mean that F1 also
- have a side effect, because it may be the case that F2 is declared in
- F1's body and it changes some data object that is global for F2, but
- local for F1);
-@end itemize
-
-@item Indirect side-effect:
-@itemize @bullet
-@item
-Subprogram calls implicitly issued by:
-@itemize @bullet
-@item
-computing initialization expressions from type declarations as a part
- of object elaboration or allocator evaluation;
-@item
-computing implicit parameters of subprogram or entry calls or generic
- instantiations;
-@end itemize
-
-@item
-activation of a task that change some non-local data object (directly or
- indirectly);
-
-@item
-elaboration code of a package that is a result of a package instantiation;
-
-@item
-controlled objects;
-@end itemize
-
-@item Situations when we can suspect a side-effect, but the full static check
-is either impossible or too hard:
-@itemize @bullet
-@item
-assignment to access variables or to the objects pointed by access
- variables;
-
-@item
-call to a subprogram pointed by access-to-subprogram value
-
-@item
-dispatching calls;
-@end itemize
-@end enumerate
-
-@noindent
-This rule has no parameters.
-@end ignore
-
-@node Slices
-@subsection @code{Slices}
-@cindex @code{Slices} rule (for @command{gnatcheck})
-
-@noindent
-Flag all uses of array slicing
-
-This rule has no parameters.
-
-
-@node Too_Many_Parents
-@subsection @code{Too_Many_Parents}
-@cindex @code{Too_Many_Parents} rule (for @command{gnatcheck})
-
-@noindent
-Flags any type declaration, single task declaration or single protected
-declaration that has more then @option{N} parents, @option{N} is a parameter
-of the rule.
-A parent here is either a (sub)type denoted by the subtype mark from the
-parent_subtype_indication (in case of a derived type declaration), or
-any of the progenitors from the interface list, if any.
-
-This rule has the following (mandatory) parameters for the @option{+R} option:
-
-@table @emph
-@item N
-Positive integer specifying the maximal allowed number of parents.
-@end table
-
-
-@node Unassigned_OUT_Parameters
-@subsection @code{Unassigned_OUT_Parameters}
-@cindex @code{Unassigned_OUT_Parameters} rule (for @command{gnatcheck})
-
-@noindent
-Flags procedures' @code{out} parameters that are not assigned, and
-identifies the contexts in which the assignments are missing.
-
-An @code{out} parameter is flagged in the statements in the procedure
-body's handled sequence of statements (before the procedure body's
-@code{exception} part, if any) if this sequence of statements contains
-no assignments to the parameter.
-
-An @code{out} parameter is flagged in an exception handler in the exception
-part of the procedure body's handled sequence of statements if the handler
-contains no assignment to the parameter.
-
-Bodies of generic procedures are also considered.
-
-The following are treated as assignments to an @code{out} parameter:
-
-@itemize @bullet
-@item
-an assignment statement, with the parameter or some component as the target;
-
-@item
-passing the parameter (or one of its components) as an @code{out} or
-@code{in out} parameter.
-@end itemize
-
-@noindent
-This rule does not have any parameters.
-
-
-
-@node Uncommented_BEGIN_In_Package_Bodies
-@subsection @code{Uncommented_BEGIN_In_Package_Bodies}
-@cindex @code{Uncommented_BEGIN_In_Package_Bodies} rule (for @command{gnatcheck})
-
-@noindent
-Flags each package body with declarations and a statement part that does not
-include a trailing comment on the line containing the @code{begin} keyword;
-this trailing comment needs to specify the package name and nothing else.
-The @code{begin} is not flagged if the package body does not
-contain any declarations.
-
-If the @code{begin} keyword is placed on the
-same line as the last declaration or the first statement, it is flagged
-independently of whether the line contains a trailing comment. The
-diagnostic message is attached to the line containing the first statement.
-
-This rule has no parameters.
-
-@node Unconditional_Exits
-@subsection @code{Unconditional_Exits}
-@cindex @code{Unconditional_Exits} rule (for @command{gnatcheck})
-
-@noindent
-Flag unconditional @code{exit} statements.
-
-This rule has no parameters.
-
-@node Unconstrained_Array_Returns
-@subsection @code{Unconstrained_Array_Returns}
-@cindex @code{Unconstrained_Array_Returns} rule (for @command{gnatcheck})
-
-@noindent
-Flag each function returning an unconstrained array. Function declarations,
-function bodies (and body stubs) having no separate specifications,
-and generic function instantiations are checked.
-Function calls and function renamings are
-not checked.
-
-Generic function declarations, and function declarations in generic
-packages are not checked, instead this rule checks the results of
-generic instantiations (that is, expanded specification and expanded
-body corresponding to an instantiation).
-
-This rule has no parameters.
-
-@node Universal_Ranges
-@subsection @code{Universal_Ranges}
-@cindex @code{Universal_Ranges} rule (for @command{gnatcheck})
-
-@noindent
-Flag discrete ranges that are a part of an index constraint, constrained
-array definition, or @code{for}-loop parameter specification, and whose bounds
-are both of type @i{universal_integer}. Ranges that have at least one
-bound of a specific type (such as @code{1 .. N}, where @code{N} is a variable
-or an expression of non-universal type) are not flagged.
-
-This rule has no parameters.
-
-
-@node Unnamed_Blocks_And_Loops
-@subsection @code{Unnamed_Blocks_And_Loops}
-@cindex @code{Unnamed_Blocks_And_Loops} rule (for @command{gnatcheck})
-
-@noindent
-Flag each unnamed block statement and loop statement.
-
-The rule has no parameters.
-
-
-
-@ignore
-@node Unused_Subprograms
-@subsection @code{Unused_Subprograms} (under construction, GLOBAL)
-@cindex @code{Unused_Subprograms} rule (for @command{gnatcheck})
-
-@noindent
-Flag all unused subprograms.
-
-This rule has no parameters.
-@end ignore
-
-
-
-
-@node USE_PACKAGE_Clauses
-@subsection @code{USE_PACKAGE_Clauses}
-@cindex @code{USE_PACKAGE_Clauses} rule (for @command{gnatcheck})
-
-@noindent
-Flag all @code{use} clauses for packages; @code{use type} clauses are
-not flagged.
-
-This rule has no parameters.
-
-
-@node Visible_Components
-@subsection @code{Visible_Components}
-@cindex @code{Visible_Components} rule (for @command{gnatcheck})
-
-@noindent
-Flags all the type declarations located in the visible part of a library
-package or a library generic package that can declare a visible component. A
-type is considered as declaring a visible component if it contains a record
-definition by its own or as a part of a record extension. Type declaration is
-flagged even if it contains a record definition that defines no components.
-
-Declarations located in private parts of local (generic) packages are not
-flagged. Declarations in private packages are not flagged.
-
-This rule has no parameters.
-
-
-@node Volatile_Objects_Without_Address_Clauses
-@subsection @code{Volatile_Objects_Without_Address_Clauses}
-@cindex @code{Volatile_Objects_Without_Address_Clauses} rule (for @command{gnatcheck})
-
-@noindent
-Flag each volatile object that does not have an address clause.
-
-The following check is made: if the pragma @code{Volatile} is applied to a
-data object or to its type, then an address clause must
-be supplied for this object.
-
-This rule does not check the components of data objects,
-array components that are volatile as a result of the pragma
-@code{Volatile_Components}, or objects that are volatile because
-they are atomic as a result of pragmas @code{Atomic} or
-@code{Atomic_Components}.
-
-Only variable declarations, and not constant declarations, are checked.
+The predefined rules implemented in @command{gnatcheck}
+are described in a companion document,
+@cite{GNATcheck Reference Manual -- Predefined Rules}.
+The rule identifier is
+used as a parameter of @command{gnatcheck}'s @option{+R} or @option{-R}
+switches.
-This rule has no parameters.
@node Example of gnatcheck Usage
@section Example of @command{gnatcheck} Usage
@@ -23157,7 +17849,9 @@ option @option{^--no-exception^/NO_EXCEPTION^} (see below).
@command{gnatstub} has the command-line interface of the form
@smallexample
-$ gnatstub @ovar{switches} @var{filename} @ovar{directory}
+@c $ gnatstub @ovar{switches} @var{filename} @ovar{directory}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatstub @r{[}@var{switches}@r{]} @var{filename} @r{[}@var{directory}@r{]} @r{[}-cargs @var{gcc_switches}@r{]}
@end smallexample
@noindent
@@ -23185,6 +17879,12 @@ indicates the directory in which the body stub is to be placed (the default
is the
current directory)
+@item @samp{@var{gcc_switches}} is a list of switches for
+@command{gcc}. They will be passed on to all compiler invocations made by
+@command{gnatelim} to generate the ASIS trees. Here you can provide
+@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
+use the @option{-gnatec} switch to set the configuration file etc.
+
@item switches
is an optional sequence of switches as described in the next section
@end table
@@ -23689,7 +18389,9 @@ be able to click on any identifier and go to its declaration.
The command line is as follow:
@smallexample
-$ perl gnathtml.pl @ovar{^switches^options^} @var{ada-files}
+@c $ perl gnathtml.pl @ovar{^switches^options^} @var{ada-files}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ perl gnathtml.pl @r{[}@var{^switches^options^}@r{]} @var{ada-files}
@end smallexample
@noindent
@@ -23795,7 +18497,9 @@ is. The syntax of this line is:
Alternatively, you may run the script using the following command line:
@smallexample
-$ perl gnathtml.pl @ovar{switches} @var{files}
+@c $ perl gnathtml.pl @ovar{switches} @var{files}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ perl gnathtml.pl @r{[}@var{switches}@r{]} @var{files}
@end smallexample
@ifset vms
@@ -24155,6 +18859,7 @@ the incorrect user program.
* Ada Exceptions::
* Ada Tasks::
* Debugging Generic Units::
+* Remote Debugging using gdbserver::
* GNAT Abnormal Termination or Failure to Terminate::
* Naming Conventions for GNAT Source Files::
* Getting Internal Debugging Information::
@@ -24300,11 +19005,10 @@ and execution encounters the breakpoint, then the program
stops and @code{GDB} signals that the breakpoint was encountered by
printing the line of code before which the program is halted.
-@item breakpoint exception @var{name}
-A special form of the breakpoint command which breakpoints whenever
-exception @var{name} is raised.
-If @var{name} is omitted,
-then a breakpoint will occur when any exception is raised.
+@item catch exception @var{name}
+This command causes the program execution to stop whenever exception
+@var{name} is raised. If @var{name} is omitted, then the execution is
+suspended when any exception is raised.
@item print @var{expression}
This will print the value of the given expression. Most simple
@@ -24466,25 +19170,25 @@ The value returned is always that from the first return statement
that was stepped through.
@node Ada Exceptions
-@section Breaking on Ada Exceptions
+@section Stopping when Ada Exceptions are Raised
@cindex Exceptions
@noindent
-You can set breakpoints that trip when your program raises
-selected exceptions.
+You can set catchpoints that stop the program execution when your program
+raises selected exceptions.
@table @code
-@item break exception
-Set a breakpoint that trips whenever (any task in the) program raises
-any exception.
+@item catch exception
+Set a catchpoint that stops execution whenever (any task in the) program
+raises any exception.
-@item break exception @var{name}
-Set a breakpoint that trips whenever (any task in the) program raises
-the exception @var{name}.
+@item catch exception @var{name}
+Set a catchpoint that stops execution whenever (any task in the) program
+raises the exception @var{name}.
-@item break exception unhandled
-Set a breakpoint that trips whenever (any task in the) program raises an
-exception for which there is no handler.
+@item catch exception unhandled
+Set a catchpoint that stops executino whenever (any task in the) program
+raises an exception for which there is no handler.
@item info exceptions
@itemx info exceptions @var{regexp}
@@ -24613,6 +19317,56 @@ When the breakpoint occurs, you can step through the code of the
instance in the normal manner and examine the values of local variables, as for
other units.
+@node Remote Debugging using gdbserver
+@section Remote Debugging using gdbserver
+@cindex Remote Debugging using gdbserver
+
+@noindent
+On platforms where gdbserver is supported, it is possible to use this tool
+to debug your application remotely. This can be useful in situations
+where the program needs to be run on a target host that is different
+from the host used for development, particularly when the target has
+a limited amount of resources (either CPU and/or memory).
+
+To do so, start your program using gdbserver on the target machine.
+gdbserver then automatically suspends the execution of your program
+at its entry point, waiting for a debugger to connect to it. The
+following commands starts an application and tells gdbserver to
+wait for a connection with the debugger on localhost port 4444.
+
+@smallexample
+$ gdbserver localhost:4444 program
+Process program created; pid = 5685
+Listening on port 4444
+@end smallexample
+
+Once gdbserver has started listening, we can tell the debugger to establish
+a connection with this gdbserver, and then start the same debugging session
+as if the program was being debugged on the same host, directly under
+the control of GDB.
+
+@smallexample
+$ gdb program
+(gdb) target remote targethost:4444
+Remote debugging using targethost:4444
+0x00007f29936d0af0 in ?? () from /lib64/ld-linux-x86-64.so.
+(gdb) b foo.adb:3
+Breakpoint 1 at 0x401f0c: file foo.adb, line 3.
+(gdb) continue
+Continuing.
+
+Breakpoint 1, foo () at foo.adb:4
+4 end foo;
+@end smallexample
+
+It is also possible to use gdbserver to attach to an already running
+program, in which case the execution of that program is simply suspended
+until the connection between the debugger and gdbserver is established.
+
+For more information on how to use gdbserver, @ref{Top, Server, Using
+the gdbserver Program, gdb, Debugging with GDB}. GNAT Pro provides support
+for gdbserver on x86-linux, x86-windows and x86_64-linux.
+
@node GNAT Abnormal Termination or Failure to Terminate
@section GNAT Abnormal Termination or Failure to Terminate
@cindex GNAT Abnormal Termination or Failure to Terminate
@@ -25964,7 +20718,9 @@ Unlike HP Ada, the GNAT ``@code{EXPORT_}@i{subprogram}'' pragmas require
a separate subprogram specification which must appear before the
subprogram body.
-GNAT also supplies a number of implementation-defined pragmas as follows:
+GNAT also supplies a number of implementation-defined pragmas including the
+following:
+
@itemize @bullet
@item @code{ABORT_DEFER}
@@ -25974,6 +20730,12 @@ GNAT also supplies a number of implementation-defined pragmas as follows:
@item @code{ADA_05}
+@item @code{Ada_2005}
+
+@item @code{Ada_12}
+
+@item @code{Ada_2012}
+
@item @code{ANNOTATE}
@item @code{ASSERT}
@@ -26020,7 +20782,7 @@ GNAT also supplies a number of implementation-defined pragmas as follows:
@end itemize
@noindent
-For full details on these GNAT implementation-defined pragmas,
+For full details on these and other GNAT implementation-defined pragmas,
see @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference
Manual}.
@@ -26919,6 +21681,7 @@ information about several specific platforms.
* AIX-Specific Considerations::
* Irix-Specific Considerations::
* RTX-Specific Considerations::
+* HP-UX-Specific Considerations::
@end menu
@node Summary of Run-Time Configurations
@@ -27278,10 +22041,47 @@ Windows executables that run in Ring 3 to utilize memory protection
@item
Real-time subsystem (RTSS) executables that run in Ring 0, where
performance can be optimized with RTSS applications taking precedent
-over all Windows applications (@emph{rts-rtx-rtss}).
+over all Windows applications (@emph{rts-rtx-rtss}). This mode requires
+the Microsoft linker to handle RTSS libraries.
@end itemize
+@node HP-UX-Specific Considerations
+@section HP-UX-Specific Considerations
+@cindex HP-UX Scheduling
+
+@noindent
+On HP-UX, appropriate privileges are required to change the scheduling
+parameters of a task. The calling process must have appropriate
+privileges or be a member of a group having @code{PRIV_RTSCHED} access to
+successfully change the scheduling parameters.
+
+By default, GNAT uses the @code{SCHED_HPUX} policy. To have access to the
+priority range 0-31 either the @code{FIFO_Within_Priorities} or the
+@code{Round_Robin_Within_Priorities} scheduling policies need to be set.
+
+To specify the @code{FIFO_Within_Priorities} scheduling policy you can use
+one of the following:
+
+@itemize @bullet
+@item
+@code{pragma Time_Slice (0.0)}
+@cindex pragma Time_Slice
+@item
+the corresponding binder option @option{-T0}
+@cindex @option{-T0} option
+@item
+@code{pragma Task_Dispatching_Policy (FIFO_Within_Priorities)}
+@cindex pragma Task_Dispatching_Policy
+@end itemize
+
+@noindent
+To specify the @code{Round_Robin_Within_Priorities}, scheduling policy
+you should use @code{pragma Time_Slice} with a
+value greater than @code{0.0}, or use the corresponding @option{-T}
+binder option, or set the @code{pragma Task_Dispatching_Policy
+(Round_Robin_Within_Priorities)}.
+
@c *******************************
@node Example of Binder Output File
@appendix Example of Binder Output File
@@ -33270,7 +28070,9 @@ static import library for the DLL and the actual DLL. The form of the
@smallexample
@cartouche
-$ gnatdll @ovar{switches} @var{list-of-files} @r{[}-largs @var{opts}@r{]}
+@c $ gnatdll @ovar{switches} @var{list-of-files} @r{[}-largs @var{opts}@r{]}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ gnatdll @r{[}@var{switches}@r{]} @var{list-of-files} @r{[}-largs @var{opts}@r{]}
@end cartouche
@end smallexample
@@ -33286,7 +28088,9 @@ missing, only the static import library is generated.
You may specify any of the following switches to @code{gnatdll}:
@table @code
-@item -a@ovar{address}
+@c @item -a@ovar{address}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+@item -a@r{[}@var{address}@r{]}
@cindex @option{-a} (@code{gnatdll})
Build a non-relocatable DLL at @var{address}. If @var{address} is not
specified the default address @var{0x11000000} will be used. By default,
@@ -33489,7 +28293,9 @@ common @code{dlltool} switches. The form of the @code{dlltool} command
is
@smallexample
-$ dlltool @ovar{switches}
+@c $ dlltool @ovar{switches}
+@c Expanding @ovar macro inline (explanation in macro def comments)
+$ dlltool @r{[}@var{switches}@r{]}
@end smallexample
@noindent
diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb
index fb3dc3d74ba..cb234d262e6 100644
--- a/gcc/ada/gnatbind.adb
+++ b/gcc/ada/gnatbind.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -45,6 +45,7 @@ with Rident; use Rident;
with Snames;
with Switch; use Switch;
with Switch.B; use Switch.B;
+with Table;
with Targparm; use Targparm;
with Types; use Types;
@@ -81,6 +82,16 @@ procedure Gnatbind is
Mapping_File : String_Ptr := null;
+ package Closure_Sources is new Table.Table
+ (Table_Component_Type => File_Name_Type,
+ Table_Index_Type => Natural,
+ Table_Low_Bound => 1,
+ Table_Initial => 10,
+ Table_Increment => 100,
+ Table_Name => "Gnatbind.Closure_Sources");
+ -- Table to record the sources in the closure, to avoid duplications. Used
+ -- only with switch -R.
+
function Gnatbind_Supports_Auto_Init return Boolean;
-- Indicates if automatic initialization of elaboration procedure
-- through the constructor mechanism is possible on the platform.
@@ -671,11 +682,12 @@ begin
begin
Id := Scan_ALI
- (F => Main_Lib_File,
- T => Text,
- Ignore_ED => False,
- Err => False,
- Ignore_Errors => Debug_Flag_I);
+ (F => Main_Lib_File,
+ T => Text,
+ Ignore_ED => False,
+ Err => False,
+ Ignore_Errors => Debug_Flag_I,
+ Directly_Scanned => True);
end;
Free (Text);
@@ -726,10 +738,10 @@ begin
Free (Text);
end if;
- -- Acquire all information in ALI files that have been read in
+ -- Load ALIs for all dependent units
for Index in ALIs.First .. ALIs.Last loop
- Read_ALI (Index);
+ Read_Withed_ALIs (Index);
end loop;
-- Quit if some file needs compiling
@@ -738,6 +750,28 @@ begin
raise Unrecoverable_Error;
end if;
+ -- Output list of ALI files in closure
+
+ if Output_ALI_List then
+ if ALI_List_Filename /= null then
+ Set_List_File (ALI_List_Filename.all);
+ end if;
+
+ for Index in ALIs.First .. ALIs.Last loop
+ declare
+ Full_Afile : constant File_Name_Type :=
+ Find_File (ALIs.Table (Index).Afile, Library);
+ begin
+ Write_Name (Full_Afile);
+ Write_Eol;
+ end;
+ end loop;
+
+ if ALI_List_Filename /= null then
+ Close_List_File;
+ end if;
+ end if;
+
-- Build source file table from the ALI files we have read in
Set_Source_Table;
@@ -814,55 +848,90 @@ begin
-- sources) if -R was used.
if List_Closure then
- if not Zero_Formatting then
- Write_Eol;
- Write_Str ("REFERENCED SOURCES");
- Write_Eol;
- end if;
+ List_Closure_Display : declare
+ Source : File_Name_Type;
- for J in reverse Elab_Order.First .. Elab_Order.Last loop
+ function Put_In_Sources (S : File_Name_Type) return Boolean;
+ -- Check if S is already in table Sources and put in Sources
+ -- if it is not. Return False if the source is already in
+ -- Sources, and True if it is added.
- -- Do not include the sources of the runtime
+ --------------------
+ -- Put_In_Sources --
+ --------------------
- if not Is_Internal_File_Name
- (Units.Table (Elab_Order.Table (J)).Sfile)
- then
- if not Zero_Formatting then
- Write_Str (" ");
- end if;
+ function Put_In_Sources (S : File_Name_Type)
+ return Boolean
+ is
+ begin
+ for J in 1 .. Closure_Sources.Last loop
+ if Closure_Sources.Table (J) = S then
+ return False;
+ end if;
+ end loop;
+
+ Closure_Sources.Append (S);
+ return True;
+ end Put_In_Sources;
+
+ -- Start of processing for List_Closure_Display
+
+ begin
+ Closure_Sources.Init;
- Write_Str
- (Get_Name_String
- (Units.Table (Elab_Order.Table (J)).Sfile));
+ if not Zero_Formatting then
+ Write_Eol;
+ Write_Str ("REFERENCED SOURCES");
Write_Eol;
end if;
- end loop;
- -- Subunits do not appear in the elaboration table because they
- -- are subsumed by their parent units, but we need to list them
- -- for other tools. For now they are listed after other files,
- -- rather than right after their parent, since there is no easy
- -- link between the elaboration table and the ALIs table ???
- -- Note also that subunits may appear repeatedly in the list,
- -- if the parent unit appears in the context of several units
- -- in the closure.
-
- for J in Sdep.First .. Sdep.Last loop
- if Sdep.Table (J).Subunit_Name /= No_Name
- and then not Is_Internal_File_Name (Sdep.Table (J).Sfile)
- then
- if not Zero_Formatting then
- Write_Str (" ");
+ for J in reverse Elab_Order.First .. Elab_Order.Last loop
+ Source := Units.Table (Elab_Order.Table (J)).Sfile;
+
+ -- Do not include the sources of the runtime and do not
+ -- include the same source several times.
+
+ if Put_In_Sources (Source)
+ and then not Is_Internal_File_Name (Source)
+ then
+ if not Zero_Formatting then
+ Write_Str (" ");
+ end if;
+
+ Write_Str (Get_Name_String (Source));
+ Write_Eol;
end if;
+ end loop;
+
+ -- Subunits do not appear in the elaboration table because
+ -- they are subsumed by their parent units, but we need to
+ -- list them for other tools. For now they are listed after
+ -- other files, rather than right after their parent, since
+ -- there is no easy link between the elaboration table and
+ -- the ALIs table ??? As subunits may appear repeatedly in
+ -- the list, if the parent unit appears in the context of
+ -- several units in the closure, duplicates are suppressed.
+
+ for J in Sdep.First .. Sdep.Last loop
+ Source := Sdep.Table (J).Sfile;
+
+ if Sdep.Table (J).Subunit_Name /= No_Name
+ and then Put_In_Sources (Source)
+ and then not Is_Internal_File_Name (Source)
+ then
+ if not Zero_Formatting then
+ Write_Str (" ");
+ end if;
+
+ Write_Str (Get_Name_String (Source));
+ Write_Eol;
+ end if;
+ end loop;
- Write_Str (Get_Name_String (Sdep.Table (J).Sfile));
+ if not Zero_Formatting then
Write_Eol;
end if;
- end loop;
-
- if not Zero_Formatting then
- Write_Eol;
- end if;
+ end List_Closure_Display;
end if;
end if;
end if;
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index 6ab6821a63d..0f3810144e4 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2010, 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- --
@@ -122,6 +122,7 @@ procedure GNATCmd is
Naming_String : constant SA := new String'("naming");
Binder_String : constant SA := new String'("binder");
+ Builder_String : constant SA := new String'("builder");
Compiler_String : constant SA := new String'("compiler");
Check_String : constant SA := new String'("check");
Synchronize_String : constant SA := new String'("synchronize");
@@ -139,7 +140,8 @@ procedure GNATCmd is
new String_List'((Naming_String, Binder_String));
Packages_To_Check_By_Check : constant String_List_Access :=
- new String_List'((Naming_String, Check_String, Compiler_String));
+ new String_List'
+ ((Naming_String, Builder_String, Check_String, Compiler_String));
Packages_To_Check_By_Sync : constant String_List_Access :=
new String_List'((Naming_String, Synchronize_String, Compiler_String));
@@ -209,9 +211,9 @@ procedure GNATCmd is
procedure Check_Files;
-- For GNAT LIST, GNAT PRETTY, GNAT METRIC, and GNAT STACK, check if a
- -- project file is specified, without any file arguments. If it is the
- -- case, invoke the GNAT tool with the proper list of files, derived from
- -- the sources of the project.
+ -- project file is specified, without any file arguments and without a
+ -- switch -files=. If it is the case, invoke the GNAT tool with the proper
+ -- list of files, derived from the sources of the project.
function Check_Project
(Project : Project_Id;
@@ -232,6 +234,11 @@ procedure GNATCmd is
-- STUB), gnatpp (GNAT PRETTY), gnatelim (GNAT ELIM), and gnatmetric (GNAT
-- METRIC).
+ function Mapping_File return Path_Name_Type;
+ -- Create and return the path name of a mapping file. Used for gnatstub
+ -- (GNAT STUB), gnatpp (GNAT PRETTY), gnatelim (GNAT ELIM), and gnatmetric
+ -- (GNAT METRIC).
+
procedure Delete_Temp_Config_Files;
-- Delete all temporary config files. The caller is responsible for
-- ensuring that Keep_Temporary_Files is False.
@@ -314,20 +321,25 @@ procedure GNATCmd is
Success : Boolean;
begin
- -- Check if there is at least one argument that is not a switch
+ -- Check if there is at least one argument that is not a switch or if
+ -- there is a -files= switch.
for Index in 1 .. Last_Switches.Last loop
- if Last_Switches.Table (Index) (1) /= '-' then
+ if Last_Switches.Table (Index).all'Length > 7
+ and then Last_Switches.Table (Index) (1 .. 7) = "-files="
+ then
+ Add_Sources := False;
+ exit;
+
+ elsif Last_Switches.Table (Index) (1) /= '-' then
if Index = 1
or else
(The_Command = Check
- and then
- Last_Switches.Table (Index - 1).all /= "-o")
+ and then Last_Switches.Table (Index - 1).all /= "-o")
or else
(The_Command = Pretty
- and then
- Last_Switches.Table (Index - 1).all /= "-o" and then
- Last_Switches.Table (Index - 1).all /= "-of")
+ and then Last_Switches.Table (Index - 1).all /= "-o"
+ and then Last_Switches.Table (Index - 1).all /= "-of")
or else
(The_Command = Metric
and then
@@ -346,13 +358,13 @@ procedure GNATCmd is
end if;
end loop;
- -- If all arguments were switches, add the path names of all the sources
- -- of the main project.
+ -- If all arguments are switches and there is no switch -files=, add
+ -- the path names of all the sources of the main project.
if Add_Sources then
- -- For gnatcheck, gnatpp and gnatmetric , create a temporary file and
- -- put the list of sources in it.
+ -- For gnatcheck, gnatpp, and gnatmetric, create a temporary file
+ -- and put the list of sources in it.
if The_Command = Check or else
The_Command = Pretty or else
@@ -443,8 +455,8 @@ procedure GNATCmd is
then
-- There is a body, check if it is for this project
- if All_Projects or else
- Unit.File_Names (Impl).Project = Project
+ if All_Projects
+ or else Unit.File_Names (Impl).Project = Project
then
Subunit := False;
@@ -883,6 +895,21 @@ procedure GNATCmd is
end Index;
------------------
+ -- Mapping_File --
+ ------------------
+
+ function Mapping_File return Path_Name_Type is
+ Result : Path_Name_Type;
+ begin
+ Prj.Env.Create_Mapping_File
+ (Project => Project,
+ Language => Name_Ada,
+ In_Tree => Project_Tree,
+ Name => Result);
+ return Result;
+ end Mapping_File;
+
+ ------------------
-- Process_Link --
------------------
@@ -1056,8 +1083,7 @@ procedure GNATCmd is
-- Append ".ali" if file name does not end with it
if Switch'Length <= 4
- or else Switch (Switch'Last - 3 .. Switch'Last)
- /= ".ali"
+ or else Switch (Switch'Last - 3 .. Switch'Last) /= ".ali"
then
Last := ALI_File'Last;
end if;
@@ -1070,8 +1096,8 @@ procedure GNATCmd is
else
for K in Switch'Range loop
- if Switch (K) = '/' or else
- Switch (K) = Directory_Separator
+ if Switch (K) = '/'
+ or else Switch (K) = Directory_Separator
then
Test_Existence := True;
exit;
@@ -1245,7 +1271,10 @@ procedure GNATCmd is
New_Line;
for C in Command_List'Range loop
- if not Command_List (C).VMS_Only then
+
+ -- No usage for VMS only command or for Sync
+
+ if not Command_List (C).VMS_Only and then C /= Sync then
if Targparm.AAMP_On_Target then
Put ("gnaampcmd ");
else
@@ -1279,7 +1308,7 @@ procedure GNATCmd is
end loop;
New_Line;
- Put_Line ("Commands find, list, metric, pretty, stack, stub and xref " &
+ Put_Line ("All commands except chop, krunch and preprocess " &
"accept project file switches -vPx, -Pprj and -Xnam=val");
New_Line;
end Non_VMS_Usage;
@@ -1611,11 +1640,12 @@ begin
-- --subdirs=... Specify Subdirs
- if Argv'Length > Makeutl.Subdirs_Option'Length and then
- Argv
- (Argv'First ..
- Argv'First + Makeutl.Subdirs_Option'Length - 1) =
- Makeutl.Subdirs_Option
+ if Argv'Length > Makeutl.Subdirs_Option'Length
+ and then
+ Argv
+ (Argv'First ..
+ Argv'First + Makeutl.Subdirs_Option'Length - 1) =
+ Makeutl.Subdirs_Option
then
Subdirs :=
new String'
@@ -1724,8 +1754,9 @@ begin
('=',
Argv (Argv'First + 2 .. Argv'Last));
begin
- if Equal_Pos >= Argv'First + 3 and then
- Equal_Pos /= Argv'Last then
+ if Equal_Pos >= Argv'First + 3
+ and then Equal_Pos /= Argv'Last
+ then
Add (Project_Node_Tree,
External_Name =>
Argv (Argv'First + 2 .. Equal_Pos - 1),
@@ -1927,7 +1958,7 @@ begin
end if;
end;
- if The_Command = Bind
+ if The_Command = Bind
or else The_Command = Link
or else The_Command = Elim
then
@@ -1942,7 +1973,7 @@ begin
-- For gnatcheck, gnatstub, gnatmetric, gnatpp and gnatelim, create
-- a configuration pragmas file, if necessary.
- if The_Command = Pretty
+ if The_Command = Pretty
or else The_Command = Metric
or else The_Command = Stub
or else The_Command = Elim
@@ -2080,7 +2111,7 @@ begin
while K <= First_Switches.Last
and then
(The_Command /= Check
- or else First_Switches.Table (K).all /= "-rules")
+ or else First_Switches.Table (K).all /= "-rules")
loop
Add_To_Carg_Switches (First_Switches.Table (K));
K := K + 1;
@@ -2120,8 +2151,7 @@ begin
while K <= Last_Switches.Last
and then
(The_Command /= Check
- or else
- Last_Switches.Table (K).all /= "-rules")
+ or else Last_Switches.Table (K).all /= "-rules")
loop
Add_To_Carg_Switches (Last_Switches.Table (K));
K := K + 1;
@@ -2149,6 +2179,7 @@ begin
declare
CP_File : constant Path_Name_Type := Configuration_Pragmas_File;
+ M_File : constant Path_Name_Type := Mapping_File;
begin
if CP_File /= No_Path then
@@ -2162,6 +2193,95 @@ begin
(new String'("-gnatec=" & Get_Name_String (CP_File)));
end if;
end if;
+
+ if M_File /= No_Path then
+ Add_To_Carg_Switches
+ (new String'("-gnatem=" & Get_Name_String (M_File)));
+ end if;
+
+ -- For gnatcheck, also indicate a global configuration pragmas
+ -- file and, if -U is not used, a local one.
+
+ if The_Command = Check then
+ declare
+ Pkg : constant Prj.Package_Id :=
+ Prj.Util.Value_Of
+ (Name => Name_Builder,
+ In_Packages => Project.Decl.Packages,
+ In_Tree => Project_Tree);
+
+ Variable : Variable_Value :=
+ Prj.Util.Value_Of
+ (Name => No_Name,
+ Attribute_Or_Array_Name =>
+ Name_Global_Configuration_Pragmas,
+ In_Package => Pkg,
+ In_Tree => Project_Tree);
+
+ begin
+ if (Variable = Nil_Variable_Value
+ or else Length_Of_Name (Variable.Value) = 0)
+ and then Pkg /= No_Package
+ then
+ Variable :=
+ Prj.Util.Value_Of
+ (Name => Name_Ada,
+ Attribute_Or_Array_Name =>
+ Name_Global_Config_File,
+ In_Package => Pkg,
+ In_Tree => Project_Tree);
+ end if;
+
+ if Variable /= Nil_Variable_Value
+ and then Length_Of_Name (Variable.Value) /= 0
+ then
+ Add_To_Carg_Switches
+ (new String'
+ ("-gnatec=" & Get_Name_String (Variable.Value)));
+ end if;
+ end;
+
+ if not All_Projects then
+ declare
+ Pkg : constant Prj.Package_Id :=
+ Prj.Util.Value_Of
+ (Name => Name_Compiler,
+ In_Packages => Project.Decl.Packages,
+ In_Tree => Project_Tree);
+
+ Variable : Variable_Value :=
+ Prj.Util.Value_Of
+ (Name => No_Name,
+ Attribute_Or_Array_Name =>
+ Name_Local_Configuration_Pragmas,
+ In_Package => Pkg,
+ In_Tree => Project_Tree);
+
+ begin
+ if (Variable = Nil_Variable_Value
+ or else Length_Of_Name (Variable.Value) = 0)
+ and then Pkg /= No_Package
+ then
+ Variable :=
+ Prj.Util.Value_Of
+ (Name => Name_Ada,
+ Attribute_Or_Array_Name =>
+ Name_Local_Config_File,
+ In_Package => Pkg,
+ In_Tree => Project_Tree);
+ end if;
+
+ if Variable /= Nil_Variable_Value
+ and then Length_Of_Name (Variable.Value) /= 0
+ then
+ Add_To_Carg_Switches
+ (new String'
+ ("-gnatec=" &
+ Get_Name_String (Variable.Value)));
+ end if;
+ end;
+ end if;
+ end if;
end;
end if;
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index 4469c91ec5d..675d9a364e4 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -1447,8 +1447,6 @@ procedure Gnatlink is
Write_Eol;
Write_Line (" mainprog.ali the ALI file of the main program");
Write_Eol;
- Write_Line (" -A Binder generated source file is in Ada (default)");
- Write_Line (" -C Binder generated source file is in C");
Write_Line (" -f force object file list to be generated");
Write_Line (" -g Compile binder source file with debug information");
Write_Line (" -n Do not compile the binder source file");
@@ -1648,15 +1646,6 @@ begin
Linker_Options.Increment_Last;
Linker_Options.Table (Linker_Options.Last) :=
new String'("-mrtp");
-
- -- Pass -fsjlj to the linker if --RTS=sjlj was passed
-
- elsif Arg'Length > 9
- and then Arg (Arg'First + 6 .. Arg'First + 9) = "sjlj"
- then
- Linker_Options.Increment_Last;
- Linker_Options.Table (Linker_Options.Last) :=
- new String'("-fsjlj");
end if;
end if;
end;
diff --git a/gcc/ada/gnatname.adb b/gcc/ada/gnatname.adb
index 4c935bebbc7..00ebebe413e 100644
--- a/gcc/ada/gnatname.adb
+++ b/gcc/ada/gnatname.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -306,7 +306,20 @@ procedure Gnatname is
-- Add and initialize another component to Arguments table
- Arguments.Increment_Last;
+ declare
+ New_Arguments : Argument_Data;
+ pragma Warnings (Off, New_Arguments);
+ -- Declaring this defaulted initialized object ensures
+ -- that the new allocated component of table Arguments
+ -- is correctly initialized.
+
+ -- This is VERY ugly, Table should never be used with
+ -- data requiring default initialization. We should
+ -- find a way to avoid violating this rule ???
+
+ begin
+ Arguments.Append (New_Arguments);
+ end;
Patterns.Init
(Arguments.Table (Arguments.Last).Directories);
diff --git a/gcc/ada/gnatsym.adb b/gcc/ada/gnatsym.adb
index dec5257f45c..5a88994a4c4 100644
--- a/gcc/ada/gnatsym.adb
+++ b/gcc/ada/gnatsym.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2010, 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- --
@@ -41,19 +41,19 @@
-- - (optional) the name of the reference symbol file
-- - the names of one or more object files where the symbols are found
-with Ada.Exceptions; use Ada.Exceptions;
-with Ada.Text_IO; use Ada.Text_IO;
-
-with GNAT.Command_Line; use GNAT.Command_Line;
-with GNAT.OS_Lib; use GNAT.OS_Lib;
-
with Gnatvsn; use Gnatvsn;
with Osint; use Osint;
with Output; use Output;
-
with Symbols; use Symbols;
with Table;
+with Ada.Exceptions; use Ada.Exceptions;
+with Ada.Text_IO; use Ada.Text_IO;
+
+with GNAT.Command_Line; use GNAT.Command_Line;
+with GNAT.Directory_Operations; use GNAT.Directory_Operations;
+with GNAT.OS_Lib; use GNAT.OS_Lib;
+
procedure Gnatsym is
Empty_String : aliased String := "";
@@ -82,8 +82,13 @@ procedure Gnatsym is
Version_String : String_Access := Empty;
-- The version of the library (used on VMS)
+ type Object_File_Data is record
+ Path : String_Access;
+ Name : String_Access;
+ end record;
+
package Object_Files is new Table.Table
- (Table_Component_Type => String_Access,
+ (Table_Component_Type => Object_File_Data,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
@@ -164,7 +169,8 @@ procedure Gnatsym is
end case;
end loop;
- -- Get the file names
+ -- Get the object file names and put them in the table in alphabetical
+ -- order of base names.
loop
declare
@@ -175,7 +181,26 @@ procedure Gnatsym is
exit when S'Length = 0;
Object_Files.Increment_Last;
- Object_Files.Table (Object_Files.Last) := S;
+
+ declare
+ Base : constant String := Base_Name (S.all);
+ Last : constant Positive := Object_Files.Last;
+ J : Positive;
+
+ begin
+ J := 1;
+ while J < Last loop
+ if Object_Files.Table (J).Name.all > Base then
+ Object_Files.Table (J + 1 .. Last) :=
+ Object_Files.Table (J .. Last - 1);
+ exit;
+ end if;
+
+ J := J + 1;
+ end loop;
+
+ Object_Files.Table (J) := (S, new String'(Base));
+ end;
end;
end loop;
exception
@@ -304,14 +329,16 @@ begin
if Verbose then
Write_Str ("Processing object file """);
- Write_Str (Object_Files.Table (Object_File).all);
+ Write_Str (Object_Files.Table (Object_File).Path.all);
Write_Line ("""");
end if;
- Processing.Process (Object_Files.Table (Object_File).all, Success);
+ Processing.Process
+ (Object_Files.Table (Object_File).Path.all,
+ Success);
end loop;
- -- Finalize the object file
+ -- Finalize the symbol file
if Success then
if Verbose then
diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads
index 0a62a693839..684a3bb4d79 100644
--- a/gcc/ada/gnatvsn.ads
+++ b/gcc/ada/gnatvsn.ads
@@ -77,7 +77,7 @@ package Gnatvsn is
-- value should never be decreased in the future, but it would be
-- OK to increase it if absolutely necessary.
- Library_Version : constant String := "4.5";
+ Library_Version : constant String := "4.6";
-- Library version. This value must be updated whenever any change to the
-- compiler affects the library formats in such a way as to obsolete
-- previously compiled library modules.
diff --git a/gcc/ada/gnatxref.adb b/gcc/ada/gnatxref.adb
index 2cccc0f1f51..c20ef175564 100644
--- a/gcc/ada/gnatxref.adb
+++ b/gcc/ada/gnatxref.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2010, 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- --
@@ -52,6 +52,9 @@ procedure Gnatxref is
RTS_Specified : String_Access := null;
-- Used to detect multiple use of --RTS= switch
+ EXT_Specified : String_Access := null;
+ -- Used to detect multiple use of --ext= switch
+
procedure Parse_Cmd_Line;
-- Parse every switch on the command line
@@ -79,7 +82,7 @@ procedure Gnatxref is
loop
case
GNAT.Command_Line.Getopt
- ("a aI: aO: d f g h I: nostdinc nostdlib p: u v -RTS=")
+ ("a aI: aO: d f g h I: nostdinc nostdlib p: u v -RTS= -ext=")
is
when ASCII.NUL =>
exit;
@@ -140,43 +143,70 @@ procedure Gnatxref is
-- Check that it is the first time we see this switch
- if RTS_Specified = null then
- RTS_Specified := new String'(GNAT.Command_Line.Parameter);
+ if Full_Switch = "-RTS" then
+ if RTS_Specified = null then
+ RTS_Specified := new String'(GNAT.Command_Line.Parameter);
- elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then
- Osint.Fail ("--RTS cannot be specified multiple times");
- end if;
+ elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then
+ Osint.Fail ("--RTS cannot be specified multiple times");
+ end if;
- Opt.No_Stdinc := True;
- Opt.RTS_Switch := True;
+ Opt.No_Stdinc := True;
+ Opt.RTS_Switch := True;
- declare
- Src_Path_Name : constant String_Ptr :=
- Get_RTS_Search_Dir
- (GNAT.Command_Line.Parameter, Include);
+ declare
+ Src_Path_Name : constant String_Ptr :=
+ Get_RTS_Search_Dir
+ (GNAT.Command_Line.Parameter,
+ Include);
- Lib_Path_Name : constant String_Ptr :=
- Get_RTS_Search_Dir
- (GNAT.Command_Line.Parameter, Objects);
+ Lib_Path_Name : constant String_Ptr :=
+ Get_RTS_Search_Dir
+ (GNAT.Command_Line.Parameter,
+ Objects);
- begin
- if Src_Path_Name /= null and then Lib_Path_Name /= null then
- Add_Search_Dirs (Src_Path_Name, Include);
- Add_Search_Dirs (Lib_Path_Name, Objects);
+ begin
+ if Src_Path_Name /= null
+ and then Lib_Path_Name /= null
+ then
+ Add_Search_Dirs (Src_Path_Name, Include);
+ Add_Search_Dirs (Lib_Path_Name, Objects);
+
+ elsif Src_Path_Name = null
+ and then Lib_Path_Name = null
+ then
+ Osint.Fail ("RTS path not valid: missing " &
+ "adainclude and adalib directories");
+
+ elsif Src_Path_Name = null then
+ Osint.Fail ("RTS path not valid: missing " &
+ "adainclude directory");
- elsif Src_Path_Name = null and then Lib_Path_Name = null then
- Osint.Fail ("RTS path not valid: missing " &
- "adainclude and adalib directories");
+ elsif Lib_Path_Name = null then
+ Osint.Fail ("RTS path not valid: missing " &
+ "adalib directory");
+ end if;
+ end;
- elsif Src_Path_Name = null then
- Osint.Fail ("RTS path not valid: missing " &
- "adainclude directory");
+ elsif GNAT.Command_Line.Full_Switch = "-ext" then
- elsif Lib_Path_Name = null then
- Osint.Fail ("RTS path not valid: missing " &
- "adalib directory");
+ -- Check that it is the first time we see this switch
+
+ if EXT_Specified = null then
+ EXT_Specified := new String'(GNAT.Command_Line.Parameter);
+
+ elsif EXT_Specified.all /= GNAT.Command_Line.Parameter then
+ Osint.Fail ("--ext cannot be specified multiple times");
end if;
- end;
+
+ if EXT_Specified'Length
+ = Osint.ALI_Default_Suffix'Length
+ then
+ Osint.ALI_Suffix := EXT_Specified.all'Access;
+ else
+ Osint.Fail ("--ext argument must have 3 characters");
+ end if;
+ end if;
when others =>
Write_Usage;
@@ -239,6 +269,7 @@ procedure Gnatxref is
& " directory");
Put_Line (" -nostdlib Don't look for library files in the system"
& " default directory");
+ Put_Line (" --ext=xxx Specify alternate ali file extension");
Put_Line (" --RTS=dir specify the default source and object search"
& " path");
Put_Line (" -p file Use file as the default project file");
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index a8e6faa2467..7763b1801de 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -194,34 +194,37 @@
#include <netdb.h>
#endif
-/*
- * Handling of gethostbyname, gethostbyaddr, getservbyname and getservbyport
- * =========================================================================
- *
- * The default implementation of GNAT.Sockets.Thin requires that these
- * operations be either thread safe, or that a reentrant version getXXXbyYYY_r
- * be provided. In both cases, socket.c provides a __gnat_safe_getXXXbyYYY
- * function with the same signature as getXXXbyYYY_r. If the operating
- * system version of getXXXbyYYY is thread safe, the provided auxiliary
- * buffer argument is unused and ignored.
- *
- * Target specific versions of GNAT.Sockets.Thin for platforms that can't
- * fulfill these requirements must provide their own protection mechanism
- * in Safe_GetXXXbyYYY, and if they require GNAT.Sockets to provide a buffer
- * to this effect, then we need to set Need_Netdb_Buffer here (case of
- * VxWorks and VMS).
- */
-
-#if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || defined (__osf__) || defined (_WIN32) || defined (__APPLE__)
+#if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || \
+ defined (__osf__) || defined (_WIN32) || defined (__APPLE__)
# define HAVE_THREAD_SAFE_GETxxxBYyyy 1
-#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || defined(__rtems__)
+
+#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || \
+ (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || \
+ defined(__rtems__)
# define HAVE_GETxxxBYyyy_R 1
#endif
-#if defined (HAVE_GETxxxBYyyy_R) || !defined (HAVE_THREAD_SAFE_GETxxxBYyyy)
+/*
+ * Properties of the unerlying NetDB library:
+ * Need_Netdb_Buffer __gnat_getXXXbyYYY expects a caller-supplied buffer
+ * Need_Netdb_Lock __gnat_getXXXbyYYY expects the caller to ensure
+ * mutual exclusion
+ *
+ * See "Handling of gethostbyname, gethostbyaddr, getservbyname and
+ * getservbyport" in socket.c for details.
+ */
+
+#if defined (HAVE_GETxxxBYyyy_R)
# define Need_Netdb_Buffer 1
+# define Need_Netdb_Lock 0
+
#else
# define Need_Netdb_Buffer 0
+# if !defined (HAVE_THREAD_SAFE_GETxxxBYyyy)
+# define Need_Netdb_Lock 1
+# else
+# define Need_Netdb_Lock 0
+# endif
#endif
#if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__)
diff --git a/gcc/ada/i-cstrea.ads b/gcc/ada/i-cstrea.ads
index 73258e76437..5c997bd75be 100644
--- a/gcc/ada/i-cstrea.ads
+++ b/gcc/ada/i-cstrea.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1995-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2010, 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- --
@@ -76,9 +76,9 @@ package Interfaces.C_Streams is
-- Standard C functions --
--------------------------
- -- The functions selected below are ones that are available in DOS,
- -- OS/2, UNIX and Xenix (but not necessarily in ANSI C). These are
- -- very thin interfaces which copy exactly the C headers. For more
+ -- The functions selected below are ones that are available in
+ -- UNIX (but not necessarily in ANSI C). These are very thin
+ -- interfaces which copy exactly the C headers. For more
-- documentation on these functions, see the Microsoft C "Run-Time
-- Library Reference" (Microsoft Press, 1990, ISBN 1-55615-225-6),
-- which includes useful information on system compatibility.
diff --git a/gcc/ada/i-forbla-darwin.adb b/gcc/ada/i-forbla-darwin.adb
index 2a2134ecba4..825a8840414 100644
--- a/gcc/ada/i-forbla-darwin.adb
+++ b/gcc/ada/i-forbla-darwin.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2006-2010, 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,5 +32,7 @@
-- Version for Mac OS X
package body Interfaces.Fortran.BLAS is
+ pragma Linker_Options ("-lgnala");
+ pragma Linker_Options ("-lm");
pragma Linker_Options ("-Wl,-framework,vecLib");
end Interfaces.Fortran.BLAS;
diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb
index 0f3ad5793ec..cbd489064ca 100644
--- a/gcc/ada/impunit.adb
+++ b/gcc/ada/impunit.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2010, 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- --
@@ -173,6 +173,14 @@ package body Impunit is
"a-wichun", -- Ada.Wide_Characters.Unicode
"a-widcha", -- Ada.Wide_Characters
+ -- Note: strictly the next two should be Ada 2012 units, but it seems
+ -- harmless (and useful) to make then available in Ada 95 mode, since
+ -- they only deal with Wide_Character, not Wide_Wide_Character.
+
+ "a-stuten", -- Ada.Strings.UTF_Encoding
+ "a-suenco", -- Ada.Strings.UTF_Encoding.Conversions
+ "a-suewen", -- Ada.Strings.UTF_Encoding.Wide_Encoding
+
---------------------------
-- GNAT Special IO Units --
---------------------------
@@ -250,6 +258,8 @@ package body Impunit is
"g-io ", -- GNAT.IO
"g-io_aux", -- GNAT.IO_Aux
"g-locfil", -- GNAT.Lock_Files
+ "g-mbdira", -- GNAT.MBBS_Discrete_Random
+ "g-mbflra", -- GNAT.MBBS_Float_Random
"g-md5 ", -- GNAT.MD5
"g-memdum", -- GNAT.Memory_Dump
"g-moreex", -- GNAT.Most_Recent_Exception
@@ -457,6 +467,11 @@ package body Impunit is
"a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
"a-zchuni", -- Ada.Wide_Wide_Characters.Unicode
+ -- Note: strictly the following should be Ada 2012 units, but it seems
+ -- harmless (and useful) to make then available in Ada 2005 mode.
+
+ "a-suezen", -- Ada.Strings.UTF_Encoding.Wide_Wide_Encoding
+
---------------------------
-- GNAT Special IO Units --
---------------------------
@@ -494,6 +509,8 @@ package body Impunit is
-- Array of alternative unit names
Scasuti : aliased String := "GNAT.Case_Util";
+ Scrc32 : aliased String := "GNAT.CRC32";
+ Shtable : aliased String := "GNAT.HTable";
Sos_lib : aliased String := "GNAT.OS_Lib";
Sregexp : aliased String := "GNAT.Regexp";
Sregpat : aliased String := "GNAT.Regpat";
@@ -504,8 +521,10 @@ package body Impunit is
-- Array giving mapping
- Map_Array : constant array (1 .. 8) of Aunit_Record := (
+ Map_Array : constant array (1 .. 10) of Aunit_Record := (
("casuti", Scasuti'Access),
+ ("crc32 ", Scrc32 'Access),
+ ("htable", Shtable'Access),
("os_lib", Sos_lib'Access),
("regexp", Sregexp'Access),
("regpat", Sregpat'Access),
@@ -609,12 +628,17 @@ package body Impunit is
Get_Name_String (Fname);
- if Name_Len = 12
+ if Name_Len in 11 .. 12
and then Name_Buffer (1 .. 2) = "s-"
- and then Name_Buffer (9 .. 12) = ".ads"
+ and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads"
then
for J in Map_Array'Range loop
- if Name_Buffer (3 .. 8) = Map_Array (J).Fname then
+ if (Name_Len = 12 and then
+ Name_Buffer (3 .. 8) = Map_Array (J).Fname)
+ or else
+ (Name_Len = 11 and then
+ Name_Buffer (3 .. 7) = Map_Array (J).Fname (1 .. 5))
+ then
Error_Msg_Strlen := Map_Array (J).Aname'Length;
Error_Msg_String (1 .. Error_Msg_Strlen) :=
Map_Array (J).Aname.all;
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 28498c428a5..f011668899c 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2009, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2010, 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- *
@@ -214,12 +214,10 @@ nanosleep (struct timestruc_t *Rqtp, struct timestruc_t *Rmtp)
#endif /* _AIXVERSION_430 */
-static void __gnat_error_handler (int sig, siginfo_t * si, void * uc);
-
static void
__gnat_error_handler (int sig,
- siginfo_t * si ATTRIBUTE_UNUSED,
- void * uc ATTRIBUTE_UNUSED)
+ siginfo_t *si ATTRIBUTE_UNUSED,
+ void *ucontext ATTRIBUTE_UNUSED)
{
struct Exception_Data *exception;
const char *msg;
@@ -287,7 +285,6 @@ __gnat_install_handler (void)
#include <signal.h>
#include <sys/siginfo.h>
-static void __gnat_error_handler (int, siginfo_t *, struct sigcontext *);
extern char *__gnat_get_code_loc (struct sigcontext *);
extern void __gnat_set_code_loc (struct sigcontext *, char *);
extern size_t __gnat_machine_state_length (void);
@@ -310,7 +307,7 @@ __gnat_adjust_context_for_raise (int signo, void *ucontext)
}
static void
-__gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context)
+__gnat_error_handler (int sig, siginfo_t *si, void *ucontext)
{
struct Exception_Data *exception;
static int recurse = 0;
@@ -318,10 +315,10 @@ __gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context)
/* Adjusting is required for every fault context, so adjust for this one
now, before we possibly trigger a recursive fault below. */
- __gnat_adjust_context_for_raise (sig, context);
+ __gnat_adjust_context_for_raise (sig, ucontext);
/* If this was an explicit signal from a "kill", just resignal it. */
- if (SI_FROMUSER (sip))
+ if (SI_FROMUSER (si))
{
signal (sig, SIG_DFL);
kill (getpid(), sig);
@@ -338,8 +335,9 @@ __gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context)
??? Using a static variable here isn't task-safe, but it's
much too hard to do anything else and we're just determining
which exception to raise. */
- if (sip->si_code == SEGV_ACCERR
- || (((long) sip->si_addr) & 3) != 0
+ if (si->si_code == SEGV_ACCERR
+ || (long) si->si_addr == 0
+ || (((long) si->si_addr) & 3) != 0
|| recurse)
{
exception = &constraint_error;
@@ -353,9 +351,9 @@ __gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context)
the actual address, just to be on the same page. */
recurse++;
((volatile char *)
- ((long) sip->si_addr & - getpagesize ()))[getpagesize ()];
- msg = "stack overflow (or erroneous memory access)";
+ ((long) si->si_addr & - getpagesize ()))[getpagesize ()];
exception = &storage_error;
+ msg = "stack overflow (or erroneous memory access)";
}
break;
@@ -438,13 +436,9 @@ __gnat_machine_state_length (void)
#include <sys/ucontext.h>
static void
-__gnat_error_handler (int sig, siginfo_t *siginfo, void *ucontext);
-
-static void
-__gnat_error_handler
- (int sig,
- siginfo_t *siginfo ATTRIBUTE_UNUSED,
- void *ucontext ATTRIBUTE_UNUSED)
+__gnat_error_handler (int sig,
+ siginfo_t *si ATTRIBUTE_UNUSED,
+ void *ucontext ATTRIBUTE_UNUSED)
{
struct Exception_Data *exception;
const char *msg;
@@ -570,8 +564,6 @@ void fake_linux_sigemptyset (sigset_t *set) {
#endif
-static void __gnat_error_handler (int, siginfo_t *siginfo, void *ucontext);
-
#if defined (i386) || defined (__x86_64__) || defined (__ia64__)
#define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
@@ -581,11 +573,7 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
{
mcontext_t *mcontext = &((ucontext_t *) ucontext)->uc_mcontext;
- /* On the i386 and x86-64 architectures, we specifically detect calls to
- the null address and entirely fold the not-yet-fully-established frame
- to prevent it from stopping the unwinding.
-
- On the i386 and x86-64 architectures, stack checking is performed by
+ /* On the i386 and x86-64 architectures, stack checking is performed by
means of probes with moving stack pointer, that is to say the probed
address is always the value of the stack pointer. Upon hitting the
guard page, the stack pointer therefore points to an inaccessible
@@ -605,25 +593,13 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
#if defined (i386)
unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP];
- /* The call insn pushes the return address onto the stack. Pop it. */
- if (pc == NULL)
- {
- mcontext->gregs[REG_EIP] = *(unsigned long *)mcontext->gregs[REG_ESP];
- mcontext->gregs[REG_ESP] += 4;
- }
/* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */
- else if (signo == SIGSEGV && *pc == 0x00240c83)
+ if (signo == SIGSEGV && pc && *pc == 0x00240c83)
mcontext->gregs[REG_ESP] += 4096 + 4 * sizeof (unsigned long);
#elif defined (__x86_64__)
unsigned long *pc = (unsigned long *)mcontext->gregs[REG_RIP];
- /* The call insn pushes the return address onto the stack. Pop it. */
- if (pc == NULL)
- {
- mcontext->gregs[REG_RIP] = *(unsigned long *)mcontext->gregs[REG_RSP];
- mcontext->gregs[REG_RSP] += 8;
- }
/* The pattern is "orq $0x0,(%rsp)" for a probe in 64-bit mode. */
- else if (signo == SIGSEGV && (*pc & 0xffffffffff) == 0x00240c8348)
+ if (signo == SIGSEGV && pc && (*pc & 0xffffffffff) == 0x00240c8348)
mcontext->gregs[REG_RSP] += 4096 + 4 * sizeof (unsigned long);
#elif defined (__ia64__)
/* ??? The IA-64 unwinder doesn't compensate for signals. */
@@ -634,12 +610,9 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
#endif
static void
-__gnat_error_handler (int sig,
- siginfo_t *siginfo ATTRIBUTE_UNUSED,
- void *ucontext)
+__gnat_error_handler (int sig, siginfo_t *si ATTRIBUTE_UNUSED, void *ucontext)
{
struct Exception_Data *exception;
- static int recurse = 0;
const char *msg;
/* Adjusting is required for every fault context, so adjust for this one
@@ -649,42 +622,24 @@ __gnat_error_handler (int sig,
switch (sig)
{
case SIGSEGV:
- /* If the problem was permissions, this is a constraint error.
- Likewise if the failing address isn't maximally aligned or if
- we've recursed.
-
- ??? Using a static variable here isn't task-safe, but it's
- much too hard to do anything else and we're just determining
- which exception to raise. */
- if (recurse)
- {
- exception = &constraint_error;
- msg = "SIGSEGV";
- }
- else
- {
- /* Here we would like a discrimination test to see whether the
- page before the faulting address is accessible. Unfortunately
- Linux seems to have no way of giving us the faulting address.
+ /* Here we would like a discrimination test to see whether the page
+ before the faulting address is accessible. Unfortunately, Linux
+ seems to have no way of giving us the faulting address.
- In versions of a-init.c before 1.95, we had a test of the page
- before the stack pointer using:
+ In old versions of init.c, we had a test of the page before the
+ stack pointer:
- recurse++;
- ((volatile char *)
- ((long) info->esp_at_signal & - getpagesize ()))[getpagesize ()];
+ ((volatile char *)
+ ((long) si->esp_at_signal & - getpagesize ()))[getpagesize ()];
- but that's wrong, since it tests the stack pointer location, and
- the current stack probe code does not move the stack pointer
- until all probes succeed.
+ but that's wrong since it tests the stack pointer location and the
+ stack probing code may not move it until all probes succeed.
- For now we simply do not attempt any discrimination at all. Note
- that this is quite acceptable, since a "real" SIGSEGV can only
- occur as the result of an erroneous program. */
-
- msg = "stack overflow (or erroneous memory access)";
- exception = &storage_error;
- }
+ For now we simply do not attempt any discrimination at all. Note
+ that this is quite acceptable, since a "real" SIGSEGV can only
+ occur as the result of an erroneous program. */
+ exception = &storage_error;
+ msg = "stack overflow (or erroneous memory access)";
break;
case SIGBUS:
@@ -702,11 +657,10 @@ __gnat_error_handler (int sig,
msg = "unhandled signal";
}
- recurse = 0;
Raise_From_Signal_Handler (exception, msg);
}
-#if defined (i386) || defined (__x86_64__)
+#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */
char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */
#endif
@@ -747,7 +701,7 @@ __gnat_install_handler (void)
handled properly, avoiding a SEGV generation from stack usage by the
handler itself. */
-#if defined (i386) || defined (__x86_64__)
+#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
stack_t stack;
stack.ss_sp = __gnat_alternate_stack;
stack.ss_size = sizeof (__gnat_alternate_stack);
@@ -768,7 +722,7 @@ __gnat_install_handler (void)
sigaction (SIGILL, &act, NULL);
if (__gnat_get_interrupt_state (SIGBUS) != 's')
sigaction (SIGBUS, &act, NULL);
-#if defined (i386) || defined (__x86_64__)
+#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
act.sa_flags |= SA_ONSTACK;
#endif
if (__gnat_get_interrupt_state (SIGSEGV) != 's')
@@ -800,8 +754,6 @@ extern int (*Check_Abort_Status) (void);
extern struct Exception_Data _abort_signal;
-static void __gnat_error_handler (int, int, sigcontext_t *);
-
/* We are not setting the SA_SIGINFO bit in the sigaction flags when
connecting that handler, with the effects described in the sigaction
man page:
@@ -1007,58 +959,13 @@ __gnat_install_handler(void)
#define RETURN_ADDR_OFFSET 0
#endif
-/* Likewise regarding how the "instruction pointer" register slot can
- be identified in signal machine contexts. We have either "REG_PC"
- or "PC" at hand, depending on the target CPU and Solaris version. */
-#if !defined (REG_PC)
-#define REG_PC PC
-#endif
-
-static void __gnat_error_handler (int, siginfo_t *, void *);
-
-#define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
-
-void
-__gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
-{
- mcontext_t *mcontext = &((ucontext_t *) ucontext)->uc_mcontext;
- unsigned long *pc = (unsigned long *)mcontext->gregs[REG_PC];
-
- /* We specifically detect calls to the null address and entirely fold
- the not-yet-fully-established frame to prevent it from stopping the
- unwinding. */
- if (pc == NULL)
-#if defined (__sparc)
- /* The call insn moves the return address into %o7. Move it back. */
- mcontext->gregs[REG_PC] = mcontext->gregs[REG_O7];
-#elif defined (i386)
- {
- /* The call insn pushes the return address onto the stack. Pop it. */
- mcontext->gregs[REG_PC] = *(unsigned long *)mcontext->gregs[UESP];
- mcontext->gregs[UESP] += 4;
- }
-#elif defined (__x86_64__)
- {
- /* The call insn pushes the return address onto the stack. Pop it. */
- mcontext->gregs[REG_PC] = *(unsigned long *)mcontext->gregs[REG_RSP];
- mcontext->gregs[REG_RSP] += 8;
- }
-#else
-#error architecture not supported on Solaris
-#endif
-}
-
static void
-__gnat_error_handler (int sig, siginfo_t *sip, void *ucontext)
+__gnat_error_handler (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED)
{
struct Exception_Data *exception;
static int recurse = 0;
const char *msg;
- /* Adjusting is required for every fault context, so adjust for this one
- now, before we possibly trigger a recursive fault below. */
- __gnat_adjust_context_for_raise (sig, ucontext);
-
switch (sig)
{
case SIGSEGV:
@@ -1069,9 +976,9 @@ __gnat_error_handler (int sig, siginfo_t *sip, void *ucontext)
??? Using a static variable here isn't task-safe, but it's
much too hard to do anything else and we're just determining
which exception to raise. */
- if (sip->si_code == SEGV_ACCERR
- || (long) sip->si_addr == 0
- || (((long) sip->si_addr) & 3) != 0
+ if (si->si_code == SEGV_ACCERR
+ || (long) si->si_addr == 0
+ || (((long) si->si_addr) & 3) != 0
|| recurse)
{
exception = &constraint_error;
@@ -1085,7 +992,7 @@ __gnat_error_handler (int sig, siginfo_t *sip, void *ucontext)
the actual address, just to be on the same page. */
recurse++;
((volatile char *)
- ((long) sip->si_addr & - getpagesize ()))[getpagesize ()];
+ ((long) si->si_addr & - getpagesize ()))[getpagesize ()];
exception = &storage_error;
msg = "stack overflow (or erroneous memory access)";
}
@@ -1661,15 +1568,18 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
#endif
-/* Feature logical name and global variable address pair */
+/* Feature logical name and global variable address pair.
+ If we ever add another feature logical to this list, the
+ feature struct will need to be enhanced to take into account
+ possible values for *gl_addr. */
struct feature {char *name; int* gl_addr;};
/* Default values for GNAT features set by environment. */
-int __gl_no_malloc_64 = 0;
+int __gl_heap_size = 64;
/* Array feature logical names and global variable addresses */
static struct feature features[] = {
- {"GNAT$NO_MALLOC_64", &__gl_no_malloc_64},
+ {"GNAT$NO_MALLOC_64", &__gl_heap_size},
{0, 0}
};
@@ -1700,10 +1610,14 @@ void __gnat_set_features ()
else
strcpy (buff, "");
- if (strcmp (buff, "ENABLE") == 0)
- *features [i].gl_addr = 1;
- else if (strcmp (buff, "DISABLE") == 0)
- *features [i].gl_addr = 0;
+ if ((strcmp (buff, "ENABLE") == 0) ||
+ (strcmp (buff, "TRUE") == 0) ||
+ (strcmp (buff, "1") == 0))
+ *features [i].gl_addr = 32;
+ else if ((strcmp (buff, "DISABLE") == 0) ||
+ (strcmp (buff, "FALSE") == 0) ||
+ (strcmp (buff, "0") == 0))
+ *features [i].gl_addr = 64;
}
__gnat_features_set = 1;
@@ -1719,11 +1633,10 @@ void __gnat_set_features ()
#include <sys/ucontext.h>
#include <unistd.h>
-static void __gnat_error_handler (int, siginfo_t *, ucontext_t *);
-
static void
-__gnat_error_handler (int sig, siginfo_t *info __attribute__ ((unused)),
- ucontext_t *ucontext)
+__gnat_error_handler (int sig,
+ siginfo_t *si ATTRIBUTE_UNUSED,
+ void *ucontext ATTRIBUTE_UNUSED)
{
struct Exception_Data *exception;
const char *msg;
@@ -1939,8 +1852,9 @@ __gnat_map_signal (int sig)
propagation after the required low level adjustments. */
void
-__gnat_error_handler (int sig, void * si ATTRIBUTE_UNUSED,
- struct sigcontext * sc)
+__gnat_error_handler (int sig,
+ void *si ATTRIBUTE_UNUSED,
+ struct sigcontext *sc ATTRIBUTE_UNUSED)
{
sigset_t mask;
@@ -2176,8 +2090,6 @@ __gnat_install_handler(void)
/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */
char __gnat_alternate_stack[32 * 1024]; /* 1 * MINSIGSTKSZ */
-static void __gnat_error_handler (int sig, siginfo_t * si, void * uc);
-
/* Defined in xnu unix_signal.c.
Tell the kernel to re-use alt stack when delivering a signal. */
#define UC_RESET_ALT_STACK 0x80000000
@@ -2208,7 +2120,7 @@ __gnat_is_stack_guard (mach_vm_address_t addr)
}
static void
-__gnat_error_handler (int sig, siginfo_t * si, void * uc ATTRIBUTE_UNUSED)
+__gnat_error_handler (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED)
{
struct Exception_Data *exception;
const char *msg;
@@ -2306,10 +2218,10 @@ __gnat_install_handler (void)
/*********************/
/* This routine is called as each process thread is created, for possible
- initialization of the FP processor. This version is used under INTERIX,
- WIN32 and could be used under OS/2. */
+ initialization of the FP processor. This version is used under INTERIX
+ and WIN32. */
-#if defined (_WIN32) || defined (__INTERIX) || defined (__EMX__) \
+#if defined (_WIN32) || defined (__INTERIX) \
|| defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \
|| defined (__OpenBSD__)
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index fbbdf605275..32ea0e5c7f3 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -307,13 +307,10 @@ __gnat_initialize (void *eh)
or the other, except for the mixed Ada/C++ case in which the first scheme
would fail for the same reason as in the linked-with-kernel situation.
- Selecting the crt set with the ctors/dtors capabilities (first scheme
- above) is triggered by adding "-dynamic" to the gcc *link* command line
- options. Selecting the other set is achieved by using "-static" instead.
-
- This is a first approach, tightly synchronized with a number of GCC
- configuration and crtstuff changes. We need to ensure that those changes
- are there to activate this circuitry. */
+ The crt set selection is controlled by command line options via GCC's
+ STARTFILE_SPEC in rs6000/vxworks.h. This is tightly synchronized with a
+ number of other GCC configuration and crtstuff changes, and we need to
+ ensure that those changes are there to activate this circuitry. */
#if (__GNUC__ >= 3) && (defined (_ARCH_PPC) || defined (__ppc))
{
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index eeeb9da9106..1379a9e82dd 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -34,7 +34,6 @@ with Fname.UF; use Fname.UF;
with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
-with Opt; use Opt;
with Sem_Aux; use Sem_Aux;
with Sem_Ch8; use Sem_Ch8;
with Sem_Ch10; use Sem_Ch10;
diff --git a/gcc/ada/inline.ads b/gcc/ada/inline.ads
index fec948d6941..04cb3234400 100644
--- a/gcc/ada/inline.ads
+++ b/gcc/ada/inline.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -36,6 +36,7 @@
-- Frontend, and thus are not mutually recursive.
with Alloc;
+with Opt; use Opt;
with Sem; use Sem;
with Table;
with Types; use Types;
@@ -84,6 +85,10 @@ package Inline is
-- This means we have to capture this information from the current scope
-- at the point of instantiation.
+ Version : Ada_Version_Type;
+ -- The body must be compiled with the same language version as the
+ -- spec. The version may be set by a configuration pragma in a separate
+ -- file or in the current file, and may differ from body to body.
end record;
package Pending_Instantiations is new Table.Table (
diff --git a/gcc/ada/itypes.ads b/gcc/ada/itypes.ads
index 0d70c1d382d..ffd3a1d496e 100644
--- a/gcc/ada/itypes.ads
+++ b/gcc/ada/itypes.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -127,7 +127,7 @@ package Itypes is
-- If the implicit type does not need an external name, then the
-- Related_Id parameter is omitted (and hence Empty). In this case
-- Suffix and Suffix_Index are ignored and the implicit type name is
- -- created by a call to New_Internal_Name ('T').
+ -- created by a call to Make_Temporary.
--
-- Note that in all cases, the name starts with "T". This is used
-- to identify implicit types in the error message handling circuits.
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index 69772d69290..be2bd802317 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -2560,10 +2560,10 @@ package body Layout is
begin
-- For some reasons, access types can cause trouble, So let's
- -- just do this for discrete types ???
+ -- just do this for scalar types ???
if Present (CT)
- and then Is_Discrete_Type (CT)
+ and then Is_Scalar_Type (CT)
and then Known_Static_Esize (CT)
then
declare
@@ -2736,8 +2736,7 @@ package body Layout is
begin
if Spec < Min then
Error_Msg_Uint_1 := Min;
- Error_Msg_NE
- ("size for & too small, minimum allowed is ^", SC, E);
+ Error_Msg_NE ("size for & too small, minimum allowed is ^", SC, E);
Init_Esize (E);
Init_RM_Size (E);
end if;
@@ -3119,11 +3118,7 @@ package body Layout is
Make_Func : Boolean := False) return Dynamic_SO_Ref
is
Loc : constant Source_Ptr := Sloc (Ins_Type);
-
- K : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('K'));
-
+ K : constant Entity_Id := Make_Temporary (Loc, 'K');
Decl : Node_Id;
Vtype_Primary_View : Entity_Id;
diff --git a/gcc/ada/lib-util.adb b/gcc/ada/lib-util.adb
index 77b0efc5b55..9047690d663 100644
--- a/gcc/ada/lib-util.adb
+++ b/gcc/ada/lib-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
@@ -25,6 +25,7 @@
with Hostparm;
with Osint.C; use Osint.C;
+with Stringt; use Stringt;
package body Lib.Util is
@@ -39,8 +40,13 @@ package body Lib.Util is
Info_Buffer_Col : Natural := 1;
-- Column number of next character to be written.
- -- Can be different from Info_Buffer_Len + 1
- -- because of tab characters written by Write_Info_Tab.
+ -- Can be different from Info_Buffer_Len + 1 because of tab characters
+ -- written by Write_Info_Tab.
+
+ procedure Write_Info_Hex_Byte (J : Natural);
+ -- Place two hex digits representing the value J (which is in the range
+ -- 0-255) in Info_Buffer, incrementing Info_Buffer_Len by 2. The digits
+ -- are output using lower case letters.
---------------------
-- Write_Info_Char --
@@ -58,20 +64,6 @@ package body Lib.Util is
--------------------------
procedure Write_Info_Char_Code (Code : Char_Code) is
-
- procedure Write_Info_Hex_Byte (J : Natural);
- -- Write single hex digit
-
- procedure Write_Info_Hex_Byte (J : Natural) is
- Hexd : constant String := "0123456789abcdef";
-
- begin
- Write_Info_Char (Hexd (J / 16 + 1));
- Write_Info_Char (Hexd (J mod 16 + 1));
- end Write_Info_Hex_Byte;
-
- -- Start of processing for Write_Info_Char_Code
-
begin
-- 00 .. 7F
@@ -128,11 +120,39 @@ package body Lib.Util is
end Write_Info_EOL;
-------------------------
+ -- Write_Info_Hex_Byte --
+ -------------------------
+
+ procedure Write_Info_Hex_Byte (J : Natural) is
+ Hexd : constant array (0 .. 15) of Character := "0123456789abcdef";
+ begin
+ Write_Info_Char (Hexd (J / 16));
+ Write_Info_Char (Hexd (J mod 16));
+ end Write_Info_Hex_Byte;
+
+ -------------------------
-- Write_Info_Initiate --
-------------------------
procedure Write_Info_Initiate (Key : Character) renames Write_Info_Char;
+ --------------------
+ -- Write_Info_Int --
+ --------------------
+
+ procedure Write_Info_Int (N : Int) is
+ begin
+ if N >= 0 then
+ Write_Info_Nat (N);
+
+ -- Negative numbers, use Write_Info_Uint to avoid problems with largest
+ -- negative number.
+
+ else
+ Write_Info_Uint (UI_From_Int (N));
+ end if;
+ end Write_Info_Int;
+
---------------------
-- Write_Info_Name --
---------------------
@@ -169,6 +189,38 @@ package body Lib.Util is
Write_Info_Char (Character'Val (N mod 10 + Character'Pos ('0')));
end Write_Info_Nat;
+ ---------------------
+ -- Write_Info_Slit --
+ ---------------------
+
+ procedure Write_Info_Slit (S : String_Id) is
+ C : Character;
+
+ begin
+ Write_Info_Str ("""");
+
+ for J in 1 .. String_Length (S) loop
+ C := Get_Character (Get_String_Char (S, J));
+
+ if C in Character'Val (16#20#) .. Character'Val (16#7E#)
+ and then C /= '{'
+ then
+ Write_Info_Char (C);
+
+ if C = '"' then
+ Write_Info_Char (C);
+ end if;
+
+ else
+ Write_Info_Char ('{');
+ Write_Info_Hex_Byte (Character'Pos (C));
+ Write_Info_Char ('}');
+ end if;
+ end loop;
+
+ Write_Info_Char ('"');
+ end Write_Info_Slit;
+
--------------------
-- Write_Info_Str --
--------------------
@@ -225,7 +277,16 @@ package body Lib.Util is
Info_Buffer_Len := 0;
Info_Buffer_Col := 1;
-
end Write_Info_Terminate;
+ ---------------------
+ -- Write_Info_Uint --
+ ---------------------
+
+ procedure Write_Info_Uint (N : Uint) is
+ begin
+ UI_Image (N, Decimal);
+ Write_Info_Str (UI_Image_Buffer (1 .. UI_Image_Length));
+ end Write_Info_Uint;
+
end Lib.Util;
diff --git a/gcc/ada/lib-util.ads b/gcc/ada/lib-util.ads
index a8326ac2a50..b34bd277a09 100644
--- a/gcc/ada/lib-util.ads
+++ b/gcc/ada/lib-util.ads
@@ -23,6 +23,8 @@
-- --
------------------------------------------------------------------------------
+with Uintp; use Uintp;
+
package Lib.Util is
-- This package implements a buffered write of library information
@@ -52,6 +54,10 @@ package Lib.Util is
procedure Write_Info_Nat (N : Nat);
-- Adds image of N to Info_Buffer with no leading or trailing blanks
+ procedure Write_Info_Int (N : Int);
+ -- Adds image of N to Info_Buffer with no leading or trailing blanks. A
+ -- minus sign is prepended for negative values.
+
procedure Write_Info_Name (Name : Name_Id);
procedure Write_Info_Name (Name : File_Name_Type);
procedure Write_Info_Name (Name : Unit_Name_Type);
@@ -59,6 +65,9 @@ package Lib.Util is
-- name is written literally from the names table entry without modifying
-- the case, using simply Get_Name_String.
+ procedure Write_Info_Slit (S : String_Id);
+ -- Write string literal value in format required for L/N lines in ali file
+
procedure Write_Info_Str (Val : String);
-- Adds characters of Val to Info_Buffer surrounded by quotes
@@ -70,4 +79,8 @@ package Lib.Util is
procedure Write_Info_Terminate;
-- Terminate current info line and output lines built in Info_Buffer
+ procedure Write_Info_Uint (N : Uint);
+ -- Adds decimal image of N to Info_Buffer with no leading or trailing
+ -- blanks. A minus sign is prepended for negative values.
+
end Lib.Util;
diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb
index 94d4b455526..24cce9251a3 100644
--- a/gcc/ada/lib-writ.adb
+++ b/gcc/ada/lib-writ.adb
@@ -592,42 +592,90 @@ package body Lib.Writ is
for J in 1 .. Linker_Option_Lines.Last loop
declare
- S : constant Linker_Option_Entry :=
- Linker_Option_Lines.Table (J);
- C : Character;
-
+ S : Linker_Option_Entry renames Linker_Option_Lines.Table (J);
begin
if S.Unit = Unit_Num then
Write_Info_Initiate ('L');
- Write_Info_Str (" """);
+ Write_Info_Char (' ');
+ Write_Info_Slit (S.Option);
+ Write_Info_EOL;
+ end if;
+ end;
+ end loop;
+
+ -- Output notes
+
+ for J in 1 .. Notes.Last loop
+ declare
+ N : constant Node_Id := Notes.Table (J).Pragma_Node;
+ L : constant Source_Ptr := Sloc (N);
+ U : constant Unit_Number_Type := Notes.Table (J).Unit;
+ C : Character;
- for J in 1 .. String_Length (S.Option) loop
- C := Get_Character (Get_String_Char (S.Option, J));
+ begin
+ if U = Unit_Num then
+ Write_Info_Initiate ('N');
+ Write_Info_Char (' ');
+
+ case Chars (Pragma_Identifier (N)) is
+ when Name_Annotate =>
+ C := 'A';
+ when Name_Comment =>
+ C := 'C';
+ when Name_Ident =>
+ C := 'I';
+ when Name_Title =>
+ C := 'T';
+ when Name_Subtitle =>
+ C := 'S';
+ when others =>
+ raise Program_Error;
+ end case;
+
+ Write_Info_Char (C);
+ Write_Info_Int (Int (Get_Logical_Line_Number (L)));
+ Write_Info_Char (':');
+ Write_Info_Int (Int (Get_Column_Number (L)));
- if C in Character'Val (16#20#) .. Character'Val (16#7E#)
- and then C /= '{'
- then
- Write_Info_Char (C);
+ declare
+ A : Node_Id;
- if C = '"' then
- Write_Info_Char (C);
+ begin
+ A := First (Pragma_Argument_Associations (N));
+ while Present (A) loop
+ Write_Info_Char (' ');
+
+ if Chars (A) /= No_Name then
+ Write_Info_Name (Chars (A));
+ Write_Info_Char (':');
end if;
- else
declare
- Hex : constant array (0 .. 15) of Character :=
- "0123456789ABCDEF";
+ Expr : constant Node_Id := Expression (A);
begin
- Write_Info_Char ('{');
- Write_Info_Char (Hex (Character'Pos (C) / 16));
- Write_Info_Char (Hex (Character'Pos (C) mod 16));
- Write_Info_Char ('}');
+ if Nkind (Expr) = N_Identifier then
+ Write_Info_Name (Chars (Expr));
+
+ elsif Nkind (Expr) = N_Integer_Literal
+ and then Is_Static_Expression (Expr)
+ then
+ Write_Info_Uint (Intval (Expr));
+
+ elsif Nkind (Expr) = N_String_Literal
+ and then Is_Static_Expression (Expr)
+ then
+ Write_Info_Slit (Strval (Expr));
+
+ else
+ Write_Info_Str ("<expr>");
+ end if;
end;
- end if;
- end loop;
- Write_Info_Char ('"');
+ Next (A);
+ end loop;
+ end;
+
Write_Info_EOL;
end if;
end;
diff --git a/gcc/ada/lib-writ.ads b/gcc/ada/lib-writ.ads
index 593442c4d4f..54514325229 100644
--- a/gcc/ada/lib-writ.ads
+++ b/gcc/ada/lib-writ.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -571,13 +571,47 @@ package Lib.Writ is
-- source file, so that this order is preserved by the binder in
-- constructing the set of linker arguments.
+ -- --------------
+ -- -- N Notes --
+ -- --------------
+
+ -- The final section of unit-specific lines contains notes which record
+ -- annotations inserted in source code for processing by external tools
+ -- using pragmas. For each occurrence of any of these pragmas, a line is
+ -- generated with the following syntax:
+
+ -- N x<sloc> [<arg_id>:]<arg> ...
+
+ -- x is one of:
+ -- A pragma Annotate
+ -- C pragma Comment
+ -- I pragma Ident
+ -- T pragma Title
+ -- S pragma Subtitle
+
+ -- <sloc> is the source location of the pragma in line:col format
+
+ -- Successive entries record the pragma_argument_associations.
+
+ -- If a pragma argument identifier is present, the entry is prefixed
+ -- with the pragma argument identifier <arg_id> followed by a colon.
+
+ -- <arg> represents the pragma argument, and has the following
+ -- conventions:
+
+ -- - identifiers are output verbatim
+ -- - static string expressions are output as literals encoded as
+ -- for L lines
+ -- - static integer expressions are output as decimal literals
+ -- - any other expression is replaced by the placeholder "<expr>"
+
---------------------
-- Reference Lines --
---------------------
-- The reference lines contain information about references from any of the
- -- units in the compilation (including, body version and version
- -- attributes, linker options pragmas and source dependencies.
+ -- units in the compilation (including body version and version attributes,
+ -- linker options pragmas and source dependencies).
-- ------------------------------------
-- -- E External Version References --
@@ -654,40 +688,6 @@ package Lib.Writ is
-- The cross-reference data follows the dependency lines. See the spec of
-- Lib.Xref for details on the format of this data.
- -- --------------
- -- -- N Notes --
- -- --------------
-
- -- The note lines record annotations inserted in source code for processing
- -- by external tools using pragmas. For each occurrence of any of these
- -- pragmas, a line is generated with the following syntax:
-
- -- N <dep>x<sloc> [<arg_id>:]<arg> ...
-
- -- x is one of:
- -- A pragma Annotate
- -- C pragma Comment
- -- I pragma Ident
- -- T pragma Title
- -- S pragma Subtitle
-
- -- <dep> is the source file containing the pragma by its dependency index
- -- (first D line has index 1)
- -- <sloc> is the source location of the pragma
-
- -- Successive entries record the pragma_argument_associations.
-
- -- For a named association, the entry is prefixed with the pragma argument
- -- identifier <arg_id> followed by a colon.
-
- -- <arg> represents the pragma argument, and has the following conventions:
-
- -- - identifiers are output verbatim
- -- - static string expressions are output as literals encoded as for
- -- L lines
- -- - static integer expressions are output as decimal literals
- -- - any other expression is replaced by the placeholder "<expr>"
-
---------------------------------
-- Source Coverage Obligations --
---------------------------------
@@ -696,14 +696,13 @@ package Lib.Writ is
-- reference data. See the spec of Par_SCO for full details of the format.
----------------------
- -- Global_Variables --
+ -- Global Variables --
----------------------
- -- The table structure defined here stores one entry for each
- -- Interrupt_State pragma encountered either in the main source or
- -- in an ancillary with'ed source. Since interrupt state values
- -- have to be consistent across all units in a partition, we may
- -- as well detect inconsistencies at compile time when we can.
+ -- The table defined here stores one entry for each Interrupt_State pragma
+ -- encountered either in the main source or in an ancillary with'ed source.
+ -- Since interrupt state values have to be consistent across all units in a
+ -- partition, we detect inconsistencies at compile time when we can.
type Interrupt_State_Entry is record
Interrupt_Number : Pos;
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index 516fc55261f..5283023a856 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2010, 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- --
@@ -214,7 +214,6 @@ package body Lib.Xref is
Base_T : Entity_Id;
Prim : Elmt_Id;
Prim_List : Elist_Id;
- Ent : Entity_Id;
begin
-- Handle subtypes of synchronized types
@@ -262,12 +261,8 @@ package body Lib.Xref is
-- reference purposes (it is the original for which we want the xref
-- and for which the comes_from_source test must be performed).
- Ent := Node (Prim);
- while Present (Alias (Ent)) loop
- Ent := Alias (Ent);
- end loop;
-
- Generate_Reference (Typ, Ent, 'p', Set_Ref => False);
+ Generate_Reference
+ (Typ, Ultimate_Alias (Node (Prim)), 'p', Set_Ref => False);
Next_Elmt (Prim);
end loop;
end Generate_Prim_Op_References;
@@ -666,7 +661,7 @@ package body Lib.Xref is
-- Check for pragma Unreferenced given and reference is within
-- this source unit (occasion for possible warning to be issued).
- if Has_Pragma_Unreferenced (E)
+ if Has_Unreferenced (E)
and then In_Same_Extended_Unit (E, N)
then
-- A reference as a named parameter in a call does not count
@@ -699,7 +694,7 @@ package body Lib.Xref is
BE := First_Entity (Current_Scope);
while Present (BE) loop
if Chars (BE) = Chars (E) then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?pragma Unreferenced given for&!", N, BE);
exit;
end if;
@@ -711,7 +706,8 @@ package body Lib.Xref is
-- Here we issue the warning, since this is a real reference
else
- Error_Msg_NE ("?pragma Unreferenced given for&!", N, E);
+ Error_Msg_NE -- CODEFIX
+ ("?pragma Unreferenced given for&!", N, E);
end if;
end if;
@@ -1703,10 +1699,7 @@ package body Lib.Xref is
-- through several levels of derivation, so find the
-- ultimate (source) ancestor.
- Op := Alias (Old_E);
- while Present (Alias (Op)) loop
- Op := Alias (Op);
- end loop;
+ Op := Ultimate_Alias (Old_E);
-- Normal case of no alias present
diff --git a/gcc/ada/lib-xref.ads b/gcc/ada/lib-xref.ads
index 2e9c8d26439..86303d1627d 100644
--- a/gcc/ada/lib-xref.ads
+++ b/gcc/ada/lib-xref.ads
@@ -68,9 +68,10 @@ package Lib.Xref is
-- col is the column number of the referenced entity
-- level is a single character that separates the col and
- -- entity fields. It is an asterisk for a top level library
+ -- entity fields. It is an asterisk (*) for a top level library
-- entity that is publicly visible, as well for an entity declared
- -- in the visible part of a generic package, and space otherwise.
+ -- in the visible part of a generic package, the plus sign (+) for
+ -- a C/C++ static entity, and space otherwise.
-- entity is the name of the referenced entity, with casing in
-- the canonical casing for the source file where it is defined.
@@ -541,7 +542,7 @@ package Lib.Xref is
-- d decimal fixed-point object decimal fixed-point type
-- e non-Boolean enumeration object non_Boolean enumeration type
-- f floating-point object floating-point type
- -- g (unused) (unused)
+ -- g C/C++ macro C/C++ fun-like macro
-- h Interface (Ada 2005) Abstract type
-- i signed integer object signed integer type
-- j (unused) (unused)
@@ -551,7 +552,7 @@ package Lib.Xref is
-- n enumeration literal named number
-- o ordinary fixed-point object ordinary fixed-point type
-- p access object access type
- -- q label on block (unused)
+ -- q label on block C/C++ include file
-- r record object record type
-- s string object string type
-- t task object task type
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
index 63dd62025fe..940527fc64d 100644
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -858,6 +858,7 @@ package body Lib is
procedure Initialize is
begin
Linker_Option_Lines.Init;
+ Notes.Init;
Load_Stack.Init;
Units.Init;
Compilation_Switches.Init;
@@ -984,11 +985,18 @@ package body Lib is
procedure Store_Linker_Option_String (S : String_Id) is
begin
- Linker_Option_Lines.Increment_Last;
- Linker_Option_Lines.Table (Linker_Option_Lines.Last) :=
- (Option => S, Unit => Current_Sem_Unit);
+ Linker_Option_Lines.Append ((Option => S, Unit => Current_Sem_Unit));
end Store_Linker_Option_String;
+ ----------------
+ -- Store_Note --
+ ----------------
+
+ procedure Store_Note (N : Node_Id) is
+ begin
+ Notes.Append ((Pragma_Node => N, Unit => Current_Sem_Unit));
+ end Store_Note;
+
-------------------------------
-- Synchronize_Serial_Number --
-------------------------------
diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads
index 9c36d91ff35..4a956b5118f 100644
--- a/gcc/ada/lib.ads
+++ b/gcc/ada/lib.ads
@@ -574,6 +574,10 @@ package Lib is
-- This procedure is called to register the string from a pragma
-- Linker_Option. The argument is the Id of the string to register.
+ procedure Store_Note (N : Node_Id);
+ -- This procedure is called to register a pragma N for which a notes
+ -- entry is required.
+
procedure Initialize;
-- Initialize internal tables
@@ -733,6 +737,21 @@ private
Table_Increment => Alloc.Linker_Option_Lines_Increment,
Table_Name => "Linker_Option_Lines");
+ -- The following table stores references to pragmas that generate Notes
+
+ type Notes_Entry is record
+ Pragma_Node : Node_Id;
+ Unit : Unit_Number_Type;
+ end record;
+
+ package Notes is new Table.Table (
+ Table_Component_Type => Notes_Entry,
+ Table_Index_Type => Integer,
+ Table_Low_Bound => 1,
+ Table_Initial => Alloc.Notes_Initial,
+ Table_Increment => Alloc.Notes_Increment,
+ Table_Name => "Notes");
+
-- The following table records the compilation switches used to compile
-- the main unit. The table includes only switches. It excludes -o
-- switches as well as artifacts of the gcc/gnat1 interface such as
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 0e3c85765d5..d1cafbf32d3 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -202,6 +202,14 @@ package body Make is
Unique_Compile_All_Projects : Boolean := False;
-- Set to True if -U is used
+ Must_Compile : Boolean := False;
+ -- True if gnatmake is invoked with -f -u and one or several mains on the
+ -- command line.
+
+ Main_On_Command_Line : Boolean := False;
+ -- True if gnatmake is invoked with one or several mains on the command
+ -- line.
+
RTS_Specified : String_Access := null;
-- Used to detect multiple --RTS= switches
@@ -1387,7 +1395,7 @@ package body Make is
if Project_Of_Current_Object_Directory /= Project then
Project_Of_Current_Object_Directory := Project;
- Object_Directory := Project.Object_Directory.Name;
+ Object_Directory := Project.Object_Directory.Display_Name;
-- Set the working directory to the object directory of the actual
-- project.
@@ -1785,6 +1793,13 @@ package body Make is
Modified_Source := Time_Stamp_Mismatch (ALI, Read_Only);
+ -- To avoid using too much memory when switch -m is used, free the
+ -- memory allocated for the source file when computing the checksum.
+
+ if Minimal_Recompilation then
+ Sinput.P.Clear_Source_File_Table;
+ end if;
+
if Modified_Source /= No_File then
ALI := No_ALI_Id;
@@ -2236,12 +2251,14 @@ package body Make is
if Arguments_Project = No_Project then
Add_Arguments (The_Saved_Gcc_Switches.all);
- elsif not Arguments_Project.Externally_Built then
+ elsif not Arguments_Project.Externally_Built
+ or else Must_Compile
+ then
-- We get the project directory for the relative path
-- switches and arguments.
- Arguments_Project := Ultimate_Extending_Project_Of
- (Arguments_Project);
+ Arguments_Project :=
+ Ultimate_Extending_Project_Of (Arguments_Project);
-- If building a dynamic or relocatable library, compile with
-- PIC option, if it exists.
@@ -2251,7 +2268,6 @@ package body Make is
then
declare
PIC : constant String := MLib.Tgt.PIC_Option;
-
begin
if PIC /= "" then
Add_Arguments ((1 => new String'(PIC)));
@@ -2432,7 +2448,7 @@ package body Make is
-- Info on the mapping file
Need_To_Check_Standard_Library : Boolean :=
- Check_Readonly_Files
+ (Check_Readonly_Files or Must_Compile)
and not Unique_Compile;
procedure Add_Process
@@ -2719,11 +2735,14 @@ package body Make is
-- check for an eventual library project, and use the full path.
if Arguments_Project /= No_Project then
- if not Arguments_Project.Externally_Built then
+ if not Arguments_Project.Externally_Built
+ or else Must_Compile
+ then
Prj.Env.Set_Ada_Paths
(Arguments_Project,
Project_Tree,
- Including_Libraries => True);
+ Including_Libraries => True,
+ Include_Path => Use_Include_Path_File);
if not Unique_Compile
and then MLib.Tgt.Support_For_Libraries /= Prj.None
@@ -2734,7 +2753,7 @@ package body Make is
begin
if Prj.Library
- and then not Prj.Externally_Built
+ and then (not Prj.Externally_Built or else Must_Compile)
and then not Prj.Need_To_Build_Lib
then
-- Add to the Q all sources of the project that have
@@ -2886,7 +2905,7 @@ package body Make is
begin
if Is_Predefined_File_Name (Fname, False) then
- if Check_Readonly_Files then
+ if Check_Readonly_Files or else Must_Compile then
Comp_Args (Comp_Args'First + 2 .. Comp_Last + 1) :=
Comp_Args (Comp_Args'First + 1 .. Comp_Last);
Comp_Last := Comp_Last + 1;
@@ -3084,7 +3103,7 @@ package body Make is
if Is_Marked (Sfile, Source_Index) then
Debug_Msg ("Skipping marked file:", Sfile);
- elsif not Check_Readonly_Files
+ elsif not (Check_Readonly_Files or Must_Compile)
and then Is_Internal_File_Name (Sfile, False)
then
Debug_Msg ("Skipping internal file:", Sfile);
@@ -3265,14 +3284,14 @@ package body Make is
end if;
In_Lib_Dir := Full_Lib_File /= No_File
- and then In_Ada_Lib_Dir (Full_Lib_File);
+ and then In_Ada_Lib_Dir (Full_Lib_File);
-- Since the following requires a system call, we precompute it
-- when needed.
if not In_Lib_Dir then
if Full_Lib_File /= No_File
- and then not Check_Readonly_Files
+ and then not (Check_Readonly_Files or else Must_Compile)
then
Get_Name_String (Full_Lib_File);
Name_Buffer (Name_Len + 1) := ASCII.NUL;
@@ -3314,7 +3333,7 @@ package body Make is
-- Source and library files can be located but are internal
-- files.
- elsif not Check_Readonly_Files
+ elsif not (Check_Readonly_Files or else Must_Compile)
and then Full_Lib_File /= No_File
and then Is_Internal_File_Name (Source_File, False)
then
@@ -3342,6 +3361,7 @@ package body Make is
if Arguments_Project = No_Project
or else not Arguments_Project.Externally_Built
+ or else Must_Compile
then
-- Don't waste any time if we have to recompile anyway
@@ -4731,13 +4751,6 @@ package body Make is
Display_Version ("GNATMAKE", "1995");
end if;
- if Main_Project /= No_Project
- and then Main_Project.Externally_Built
- then
- Make_Failed
- ("nothing to do for a main project that is externally built");
- end if;
-
if Osint.Number_Of_Files = 0 then
if Main_Project /= No_Project
and then Main_Project.Library
@@ -5174,6 +5187,25 @@ package body Make is
end;
end if;
+ -- The combination of -f -u and one or several mains on the command line
+ -- implies -a.
+
+ if Force_Compilations
+ and then Unique_Compile
+ and then not Unique_Compile_All_Projects
+ and then Main_On_Command_Line
+ then
+ Must_Compile := True;
+ end if;
+
+ if Main_Project /= No_Project
+ and then not Must_Compile
+ and then Main_Project.Externally_Built
+ then
+ Make_Failed
+ ("nothing to do for a main project that is externally built");
+ end if;
+
-- Get the target parameters, which are only needed for a couple of
-- cases in gnatmake. Protect against an exception, such as the case of
-- system.ads missing from the library, and fail gracefully.
@@ -6026,7 +6058,8 @@ package body Make is
-- and all the object directories in ADA_OBJECTS_PATH,
-- except those of library projects.
- Prj.Env.Set_Ada_Paths (Main_Project, Project_Tree, False);
+ Prj.Env.Set_Ada_Paths
+ (Main_Project, Project_Tree, Use_Include_Path_File);
-- If switch -C was specified, create a binder mapping file
@@ -6043,7 +6076,7 @@ package body Make is
exception
when others =>
- -- Delete the temporary mapping file, if one was created.
+ -- Delete the temporary mapping file if one was created
if Mapping_Path /= No_Path then
Delete_Temporary_File (Project_Tree, Mapping_Path);
@@ -6054,7 +6087,7 @@ package body Make is
raise;
end;
- -- If -dn was not specified, delete the temporary mapping file,
+ -- If -dn was not specified, delete the temporary mapping file
-- if one was created.
if Mapping_Path /= No_Path then
@@ -6253,7 +6286,11 @@ package body Make is
-- Put the object directories in ADA_OBJECTS_PATH
- Prj.Env.Set_Ada_Paths (Main_Project, Project_Tree, False);
+ Prj.Env.Set_Ada_Paths
+ (Main_Project,
+ Project_Tree,
+ Including_Libraries => False,
+ Include_Path => False);
-- Check for attributes Linker'Linker_Options in projects
-- other than the main project
@@ -8174,13 +8211,11 @@ package body Make is
elsif Argv (2 .. Argv'Last) = "nostdlib" then
- -- Don't pass -nostdlib to gnatlink, it will disable
- -- linking with all standard library files.
+ -- Pass -nstdlib to gnatbind and gnatlink
No_Stdlib := True;
-
- Add_Switch (Argv, Compiler, And_Save => And_Save);
Add_Switch (Argv, Binder, And_Save => And_Save);
+ Add_Switch (Argv, Linker, And_Save => And_Save);
elsif Argv (2 .. Argv'Last) = "nostdinc" then
@@ -8206,6 +8241,10 @@ package body Make is
-- If not a switch it must be a file name
else
+ if And_Save then
+ Main_On_Command_Line := True;
+ end if;
+
Add_File (Argv);
Mains.Add_Main (Argv);
end if;
diff --git a/gcc/ada/makeusg.adb b/gcc/ada/makeusg.adb
index ca22dceec9c..7f8ddb6163d 100644
--- a/gcc/ada/makeusg.adb
+++ b/gcc/ada/makeusg.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -23,8 +23,9 @@
-- --
------------------------------------------------------------------------------
-with Osint; use Osint;
-with Output; use Output;
+with Makeutl;
+with Osint; use Osint;
+with Output; use Output;
with Usage;
procedure Makeusg is
@@ -311,6 +312,14 @@ begin
Write_Str (" --subdirs=dir real obj/lib/exec dirs are subdirs");
Write_Eol;
+
+ -- Line for --unchecked-shared-lib-imports
+
+ Write_Str (" ");
+ Write_Str (Makeutl.Unchecked_Shared_Lib_Imports);
+ Write_Eol;
+ Write_Str (" Allow shared libraries to import static libraries");
+ Write_Eol;
Write_Eol;
-- General Compiler, Binder, Linker switches
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index ab00b506578..e07bebbad6b 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2010, 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- --
@@ -26,6 +26,7 @@
with ALI; use ALI;
with Debug;
with Fname;
+with Hostparm;
with Osint; use Osint;
with Output; use Output;
with Opt; use Opt;
@@ -38,8 +39,8 @@ with Ada.Command_Line; use Ada.Command_Line;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-with System.Case_Util; use System.Case_Util;
-with System.HTable;
+with GNAT.Case_Util; use GNAT.Case_Util;
+with GNAT.HTable;
package body Makeutl is
@@ -58,7 +59,7 @@ package body Makeutl is
function Hash (Key : Mark_Key) return Mark_Num;
- package Marks is new System.HTable.Simple_HTable
+ package Marks is new GNAT.HTable.Simple_HTable
(Header_Num => Mark_Num,
Element => Boolean,
No_Element => False,
@@ -378,6 +379,12 @@ package body Makeutl is
-- Beginning of Executable_Prefix_Path
begin
+ -- For VMS, the path returned is always /gnu/
+
+ if Hostparm.OpenVMS then
+ return "/gnu/";
+ end if;
+
-- First determine if a path prefix was placed in front of the
-- executable name.
diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads
index a7614f399c4..fd286a8ebcc 100644
--- a/gcc/ada/makeutl.ads
+++ b/gcc/ada/makeutl.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2010, 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- --
@@ -47,6 +47,11 @@ package Makeutl is
-- Switch used to indicate that the real directories (object, exec,
-- library, ...) are subdirectories of those in the project file.
+ Unchecked_Shared_Lib_Imports : constant String :=
+ "--unchecked-shared-lib-imports";
+ -- Command line switch to allow shared library projects to import projects
+ -- that are not shared library projects.
+
procedure Add
(Option : String_Access;
To : in out String_List_Access;
diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb
index f15b7c06d27..97a4c16180f 100644
--- a/gcc/ada/mlib-prj.adb
+++ b/gcc/ada/mlib-prj.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, AdaCore --
+-- Copyright (C) 2001-2010, AdaCore --
-- --
-- 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- --
@@ -2285,6 +2285,11 @@ package body MLib.Prj is
for Index in 1 .. Argument_Number loop
Write_Char (' ');
Write_Str (Arguments (Index).all);
+
+ if not Opt.Verbose_Mode and then Index > 4 then
+ Write_Str (" ...");
+ exit;
+ end if;
end loop;
Write_Eol;
diff --git a/gcc/ada/mlib-utl.adb b/gcc/ada/mlib-utl.adb
index 78378a673b9..67e03097ed6 100644
--- a/gcc/ada/mlib-utl.adb
+++ b/gcc/ada/mlib-utl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2008, AdaCore --
+-- Copyright (C) 2002-2010, AdaCore --
-- --
-- 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- --
@@ -460,11 +460,25 @@ package body MLib.Utl is
end loop;
if not Opt.Quiet_Output then
- Write_Str (Driver.all);
+ if Opt.Verbose_Mode then
+ Write_Str (Driver.all);
+
+ elsif Driver_Name /= No_Name then
+ Write_Str (Get_Name_String (Driver_Name));
+
+ else
+ Write_Str (Gcc_Name.all);
+ end if;
for J in 1 .. A loop
- Write_Char (' ');
- Write_Str (Arguments (J).all);
+ if Opt.Verbose_Mode or else J < 4 then
+ Write_Char (' ');
+ Write_Str (Arguments (J).all);
+
+ else
+ Write_Str (" ...");
+ exit;
+ end if;
end loop;
-- Do not display all the object files if not in verbose mode, only
@@ -480,10 +494,19 @@ package body MLib.Utl is
elsif Position = Second then
Write_Str (" ...");
Position := Last;
+ exit;
end if;
end loop;
for J in Options_2'Range loop
+ if not Opt.Verbose_Mode then
+ if Position = Second then
+ Write_Str (" ...");
+ end if;
+
+ exit;
+ end if;
+
Write_Char (' ');
Write_Str (Options_2 (J).all);
end loop;
diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb
index 09bd85a8439..fe4d27c24c4 100644
--- a/gcc/ada/nlists.adb
+++ b/gcc/ada/nlists.adb
@@ -1055,6 +1055,77 @@ package body Nlists is
Set_List_Link (Node, To);
end Prepend;
+ ------------------
+ -- Prepend_List --
+ ------------------
+
+ procedure Prepend_List (List : List_Id; To : List_Id) is
+
+ procedure Prepend_List_Debug;
+ pragma Inline (Prepend_List_Debug);
+ -- Output debug information if Debug_Flag_N set
+
+ ------------------------
+ -- Prepend_List_Debug --
+ ------------------------
+
+ procedure Prepend_List_Debug is
+ begin
+ if Debug_Flag_N then
+ Write_Str ("Prepend list ");
+ Write_Int (Int (List));
+ Write_Str (" to list ");
+ Write_Int (Int (To));
+ Write_Eol;
+ end if;
+ end Prepend_List_Debug;
+
+ -- Start of processing for Prepend_List
+
+ begin
+ if Is_Empty_List (List) then
+ return;
+
+ else
+ declare
+ F : constant Node_Id := First (To);
+ L : constant Node_Id := Last (List);
+ N : Node_Id;
+
+ begin
+ pragma Debug (Prepend_List_Debug);
+
+ N := L;
+ loop
+ Set_List_Link (N, To);
+ N := Prev (N);
+ exit when No (N);
+ end loop;
+
+ if No (F) then
+ Set_Last (To, L);
+ else
+ Set_Next (L, F);
+ end if;
+
+ Set_Prev (F, L);
+ Set_First (To, First (List));
+
+ Set_First (List, Empty);
+ Set_Last (List, Empty);
+ end;
+ end if;
+ end Prepend_List;
+
+ ---------------------
+ -- Prepend_List_To --
+ ---------------------
+
+ procedure Prepend_List_To (To : List_Id; List : List_Id) is
+ begin
+ Prepend_List (List, To);
+ end Prepend_List_To;
+
----------------
-- Prepend_To --
----------------
diff --git a/gcc/ada/nlists.ads b/gcc/ada/nlists.ads
index 3753936df10..cecf3a21db4 100644
--- a/gcc/ada/nlists.ads
+++ b/gcc/ada/nlists.ads
@@ -259,6 +259,14 @@ package Nlists is
pragma Inline (Prepend_To);
-- Like Prepend, but arguments are the other way round
+ procedure Prepend_List (List : List_Id; To : List_Id);
+ -- Prepends node list List to the start of node list To. On return,
+ -- List is reset to be empty.
+
+ procedure Prepend_List_To (To : List_Id; List : List_Id);
+ pragma Inline (Prepend_List_To);
+ -- Like Prepend_List, but arguments are the other way round
+
procedure Remove (Node : Node_Id);
-- Removes Node, which must be a node that is a member of a node list,
-- from this node list. The contents of Node are not otherwise affected.
diff --git a/gcc/ada/opt.adb b/gcc/ada/opt.adb
index a1528962b01..65c5726b901 100644
--- a/gcc/ada/opt.adb
+++ b/gcc/ada/opt.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 9013d7d3dcd..54cec4932d6 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -41,8 +41,11 @@
with Hostparm; use Hostparm;
with Types; use Types;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.Strings; use System.Strings;
with System.WCh_Con; use System.WCh_Con;
+pragma Warnings (On);
package Opt is
@@ -61,17 +64,15 @@ package Opt is
-- GNATBIND, GNATLINK
-- Set True if binder file to be generated in Ada rather than C
- type Ada_Version_Type is (Ada_83, Ada_95, Ada_05);
- pragma Warnings (Off, Ada_Version_Type);
+ type Ada_Version_Type is (Ada_83, Ada_95, Ada_05, Ada_12);
-- Versions of Ada for Ada_Version below. Note that these are ordered,
-- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
- -- The Warnings_Off pragma stops warnings for Ada_Version >= Ada_05,
- -- which we want to allow, so that things work OK when Ada_15 is added!
- -- This warning is now removed, so this pragma can be removed some time???
- Ada_Version_Default : Ada_Version_Type := Ada_05;
+ Ada_Version_Default : constant Ada_Version_Type := Ada_05;
+ pragma Warnings (Off, Ada_Version_Default);
-- GNAT
- -- Default Ada version if no switch given
+ -- Default Ada version if no switch given. The Warnings off is to kill
+ -- constant condition warnings.
Ada_Version : Ada_Version_Type := Ada_Version_Default;
-- GNAT
@@ -88,7 +89,7 @@ package Opt is
-- the rare cases (notably for pragmas Preelaborate_05 and Pure_05)
-- where in the run-time we want the explicit version set.
- Ada_Version_Runtime : Ada_Version_Type := Ada_05;
+ Ada_Version_Runtime : Ada_Version_Type := Ada_12;
-- GNAT
-- Ada version used to compile the runtime. Used to set Ada_Version (but
-- not Ada_Version_Explicit) when compiling predefined or internal units.
@@ -172,6 +173,15 @@ package Opt is
-- also set true if certain Unchecked_Conversion instantiations require
-- checking based on annotated values.
+ Back_End_Handles_Limited_Types : Boolean;
+ -- This flag is set true if the back end can properly handle limited or
+ -- other by reference types, and avoid copies. If this flag is False, then
+ -- the front end does special expansion for conditional expressions to make
+ -- sure that no copy occurs. If the flag is True, then the expansion for
+ -- conditional expressions relies on the back end properly handling things.
+ -- Currently the default is False for all cases (set in gnat1drv). The
+ -- default can be modified using -gnatd.L (sets the flag True).
+
Bind_Alternate_Main_Name : Boolean := False;
-- GNATBIND
-- True if main should be called Alternate_Main_Name.all.
@@ -183,8 +193,8 @@ package Opt is
Bind_For_Library : Boolean := False;
-- GNATBIND
- -- Set to True if the binder needs to generate a file designed for
- -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
+ -- Set to True if the binder needs to generate a file designed for building
+ -- a library. May be set to True by Gnatbind.Scan_Bind_Arg.
Bind_Only : Boolean := False;
-- GNATMAKE, GPRMAKE, GPRBUILD
@@ -224,7 +234,10 @@ package Opt is
-- GNAT
-- This points to the list of N_Pragma nodes for Check_Policy pragmas
-- that are linked through the Next_Pragma fields, with the list being
- -- terminated by Empty. The order is most recently processed first.
+ -- terminated by Empty. The order is most recently processed first. Note
+ -- that Push_Scope and Pop_Scope in Sem_Ch8 save and restore the value
+ -- of this variable, implementing the required scope control for pragmas
+ -- appearing a declarative part.
Check_Readonly_Files : Boolean := False;
-- GNATMAKE
@@ -450,8 +463,8 @@ package Opt is
Front_End_Setjmp_Longjmp_Exceptions;
-- GNAT
-- Set to the appropriate value depending on the default as given in
- -- system.ads (ZCX_By_Default, GCC_ZCX_Support).
- -- The C convention is there to make this variable accessible to gigi.
+ -- system.ads (ZCX_By_Default, GCC_ZCX_Support). The C convention is there
+ -- to make this variable accessible to gigi.
Exception_Tracebacks : Boolean := False;
-- GNATBIND
@@ -570,6 +583,11 @@ package Opt is
-- GNAT
-- True if compiling in GNAT system mode (-gnatg switch)
+ Heap_Size : Nat := 0;
+ -- GNATBIND
+ -- Heap size for memory allocations. Valid values are 32 and 64. Only
+ -- available on VMS.
+
HLO_Active : Boolean := False;
-- GNAT
-- True if High Level Optimizer is activated (-gnatH switch)
@@ -939,9 +957,17 @@ package Opt is
-- GNATBIND
-- True if output of list of linker options is requested (-K switch set)
- Output_Object_List : Boolean := False;
+ Output_ALI_List : Boolean := False;
+ ALI_List_Filename : String_Ptr;
+ -- GNATBIND
+ -- True if output of list of ALIs is requested (-A switch set). List is
+ -- output under the given filename, or standard output if not specified.
+
+ Output_Object_List : Boolean := False;
+ Object_List_Filename : String_Ptr;
-- GNATBIND
- -- True if output of list of objects is requested (-O switch set)
+ -- True if output of list of objects is requested (-O switch set). List is
+ -- output under the given filename, or standard output if not specified.
Overflow_Checks_Unsuppressed : Boolean := False;
-- GNAT
@@ -1226,11 +1252,23 @@ package Opt is
-- set True, and upper half characters in the source indicate the start of
-- a wide character sequence. Set by -gnatW or -W switches.
+ Use_Include_Path_File : Boolean := False;
+ -- GNATMAKE, GPRBUILD
+ -- When True, create a source search path file, even when a mapping file
+ -- is used.
+
Usage_Requested : Boolean := False;
-- GNAT, GNATBIND, GNATMAKE
-- Set to True if -h (-gnath for the compiler) switch encountered
-- requesting usage information
+ Use_Expression_With_Actions : Boolean;
+ -- The N_Expression_With_Actions node has been introduced relatively
+ -- recently, and not all back ends are prepared to handle it yet. So
+ -- we use this flag to suppress its use during a transitional period.
+ -- Currently the default is False for all cases (set in gnat1drv).
+ -- The default can be modified using -gnatd.X/-gnatd.Y.
+
Use_Pragma_Linker_Constructor : Boolean := False;
-- GNATBIND
-- True if pragma Linker_Constructor applies to adainit
diff --git a/gcc/ada/osint-b.adb b/gcc/ada/osint-b.adb
index b66cebf2ac2..39b7a99be84 100644
--- a/gcc/ada/osint-b.adb
+++ b/gcc/ada/osint-b.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -24,10 +24,13 @@
------------------------------------------------------------------------------
with Opt; use Opt;
+with Output; use Output;
with Targparm; use Targparm;
package body Osint.B is
+ Current_List_File : File_Descriptor := Invalid_FD;
+
-------------------------
-- Close_Binder_Output --
-------------------------
@@ -45,6 +48,19 @@ package body Osint.B is
end Close_Binder_Output;
+ ---------------------
+ -- Close_List_File --
+ ---------------------
+
+ procedure Close_List_File is
+ begin
+ if Current_List_File /= Invalid_FD then
+ Close (Current_List_File);
+ Current_List_File := Invalid_FD;
+ Set_Standard_Output;
+ end if;
+ end Close_List_File;
+
--------------------------
-- Create_Binder_Output --
--------------------------
@@ -65,8 +81,8 @@ package body Osint.B is
begin
if Output_File_Name /= "" then
- Name_Buffer (Output_File_Name'Range) := Output_File_Name;
- Name_Buffer (Output_File_Name'Last + 1) := ASCII.NUL;
+ Name_Buffer (1 .. Output_File_Name'Length) := Output_File_Name;
+ Name_Buffer (Output_File_Name'Length + 1) := ASCII.NUL;
if Typ = 's' then
Name_Buffer (Output_File_Name'Last) := 's';
@@ -176,6 +192,22 @@ package body Osint.B is
Current_File_Name_Index := To;
end Set_Current_File_Name_Index;
+ -------------------
+ -- Set_List_File --
+ -------------------
+
+ procedure Set_List_File (Filename : String) is
+ begin
+ pragma Assert (Current_List_File = Invalid_FD);
+ Current_List_File := Create_File (Filename, Text);
+
+ if Current_List_File = Invalid_FD then
+ Fail ("cannot create list file: " & Filename);
+ else
+ Set_Output (Current_List_File);
+ end if;
+ end Set_List_File;
+
-----------------------
-- Write_Binder_Info --
-----------------------
diff --git a/gcc/ada/osint-b.ads b/gcc/ada/osint-b.ads
index a6b601fd296..d24ec91ee21 100644
--- a/gcc/ada/osint-b.ads
+++ b/gcc/ada/osint-b.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -44,9 +44,9 @@ package Osint.B is
-- Binder Output --
-------------------
- -- These routines are used by the binder to generate the C source file
- -- containing the binder output. The format of this file is described
- -- in the package Bindfmt.
+ -- These routines are used by the binder to generate the C or Ada source
+ -- files containing the binder output. The format of these files is
+ -- described in package Bindgen.
procedure Create_Binder_Output
(Output_File_Name : String;
@@ -81,4 +81,16 @@ package Osint.B is
procedure Set_Current_File_Name_Index (To : Int);
-- Set value of Current_File_Name_Index (in private part of Osint) to To
+ ----------------------------------
+ -- Other binder-generated files --
+ ----------------------------------
+
+ procedure Set_List_File (Filename : String);
+ -- Create Filename as a text output file and set it as the current output
+ -- (see Output.Set_Output).
+
+ procedure Close_List_File;
+ -- If a specific output file was created by Set_List_File, close it and
+ -- reset the current output file to standard output.
+
end Osint.B;
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 6265ede68d1..75995e3fca4 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -23,23 +23,26 @@
-- --
------------------------------------------------------------------------------
+with Alloc;
+with Debug;
+with Fmap; use Fmap;
+with Gnatvsn; use Gnatvsn;
+with Hostparm;
+with Opt; use Opt;
+with Output; use Output;
+with Sdefault; use Sdefault;
+with Table;
+with Targparm; use Targparm;
+
with Unchecked_Conversion;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.Case_Util; use System.Case_Util;
+pragma Warnings (On);
with GNAT.HTable;
-with Alloc;
-with Debug;
-with Fmap; use Fmap;
-with Gnatvsn; use Gnatvsn;
-with Hostparm;
-with Opt; use Opt;
-with Output; use Output;
-with Sdefault; use Sdefault;
-with Table;
-with Targparm; use Targparm;
-
package body Osint is
Running_Program : Program_Type := Unspecified;
@@ -538,7 +541,11 @@ package body Osint is
end loop;
end if;
- if not Opt.No_Stdlib and not Opt.RTS_Switch then
+ -- Even when -nostdlib is used, we still want to have visibility on
+ -- the run-time object directory, as it is used by gnatbind to find
+ -- the run-time ALI files in "real" ZFP set up.
+
+ if not Opt.RTS_Switch then
Search_Path :=
Read_Default_Search_Dirs
(String_Access (Update_Path (Search_Dir_Prefix)),
diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads
index ae827ba286b..a1d9d05d4c4 100644
--- a/gcc/ada/osint.ads
+++ b/gcc/ada/osint.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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,19 +29,23 @@
with Namet; use Namet;
with Types; use Types;
-with System.Storage_Elements;
-with System.OS_Lib; use System.OS_Lib;
with System; use System;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
+with System.OS_Lib; use System.OS_Lib;
+pragma Warnings (On);
+
+with System.Storage_Elements;
+
pragma Elaborate_All (System.OS_Lib);
-- For the call to function Get_Target_Object_Suffix in the private part
package Osint is
Multi_Unit_Index_Character : Character := '~';
- -- The character before the index of the unit in a multi-unit source, in
- -- ALI and object file names. This is not a constant, because it is changed
- -- to '$' on VMS.
+ -- The character before the index of the unit in a multi-unit source in ALI
+ -- and object file names. Changed to '$' on VMS.
Ada_Include_Path : constant String := "ADA_INCLUDE_PATH";
Ada_Objects_Path : constant String := "ADA_OBJECTS_PATH";
@@ -80,7 +84,7 @@ package Osint is
Get_File_Names_Case_Sensitive /= 0;
-- Set to indicate whether the operating system convention is for file
-- names to be case sensitive (e.g., in Unix, set True), or non case
- -- sensitive (e.g., in OS/2, set False).
+ -- sensitive (e.g., in Windows, set False).
procedure Canonical_Case_File_Name (S : in out String);
-- Given a file name, converts it to canonical case form. For systems
diff --git a/gcc/ada/output.adb b/gcc/ada/output.adb
index 141c12fb294..8210d3f258f 100644
--- a/gcc/ada/output.adb
+++ b/gcc/ada/output.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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,8 +29,6 @@
-- --
------------------------------------------------------------------------------
-with System.OS_Lib; use System.OS_Lib;
-
package body Output is
Current_FD : File_Descriptor := Standout;
@@ -228,17 +226,26 @@ package body Output is
Special_Output_Proc := P;
end Set_Special_Output;
- ------------------------
- -- Set_Standard_Error --
- ------------------------
+ ----------------
+ -- Set_Output --
+ ----------------
- procedure Set_Standard_Error is
+ procedure Set_Output (FD : File_Descriptor) is
begin
if Special_Output_Proc = null then
Flush_Buffer;
end if;
- Current_FD := Standerr;
+ Current_FD := FD;
+ end Set_Output;
+
+ ------------------------
+ -- Set_Standard_Error --
+ ------------------------
+
+ procedure Set_Standard_Error is
+ begin
+ Set_Output (Standerr);
end Set_Standard_Error;
-------------------------
@@ -247,11 +254,7 @@ package body Output is
procedure Set_Standard_Output is
begin
- if Special_Output_Proc = null then
- Flush_Buffer;
- end if;
-
- Current_FD := Standout;
+ Set_Output (Standout);
end Set_Standard_Output;
-------
diff --git a/gcc/ada/output.ads b/gcc/ada/output.ads
index 7f13dc24b15..ddc395448d3 100644
--- a/gcc/ada/output.ads
+++ b/gcc/ada/output.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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,42 +29,46 @@
-- --
------------------------------------------------------------------------------
--- This package contains low level output routines used by the compiler
--- for writing error messages and informational output. It is also used
--- by the debug source file output routines (see Sprintf.Print_Eol).
+-- This package contains low level output routines used by the compiler for
+-- writing error messages and informational output. It is also used by the
+-- debug source file output routines (see Sprint.Print_Debug_Line).
with Hostparm; use Hostparm;
with Types; use Types;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
+with System.OS_Lib; use System.OS_Lib;
+pragma Warnings (On);
+
package Output is
pragma Elaborate_Body;
type Output_Proc is access procedure (S : String);
- -- This type is used for the Set_Special_Output procedure. If this
- -- procedure is called, then instead of lines being written to
- -- standard error or standard output, a call is made to the given
- -- procedure for each line, passing the line with an end of line
- -- character (which is a single ASCII.LF character, even in systems
- -- which normally use CR/LF or some other sequence for line end).
+ -- This type is used for the Set_Special_Output procedure. If Output_Proc
+ -- is called, then instead of lines being written to standard error or
+ -- standard output, a call is made to the given procedure for each line,
+ -- passing the line with an end of line character (which is a single
+ -- ASCII.LF character, even in systems which normally use CR/LF or some
+ -- other sequence for line end).
-----------------
-- Subprograms --
-----------------
procedure Set_Special_Output (P : Output_Proc);
- -- Sets subsequent output to call procedure P. If P is null, then
- -- the call cancels the effect of a previous call, reverting the
- -- output to standard error or standard output depending on the
- -- mode at the time of previous call. Any exception generated by
- -- by calls to P is simply propagated to the caller of the routine
- -- causing the write operation.
+ -- Sets subsequent output to call procedure P. If P is null, then the call
+ -- cancels the effect of a previous call, reverting the output to standard
+ -- error or standard output depending on the mode at the time of previous
+ -- call. Any exception generated by by calls to P is simply propagated to
+ -- the caller of the routine causing the write operation.
procedure Cancel_Special_Output;
- -- Cancels the effect of a call to Set_Special_Output, if any.
- -- The output is then directed to standard error or standard output
- -- depending on the last call to Set_Standard_Error or Set_Standard_Output.
- -- It is never an error to call Cancel_Special_Output. It has the same
- -- effect as calling Set_Special_Output (null).
+ -- Cancels the effect of a call to Set_Special_Output, if any. The output
+ -- is then directed to standard error or standard output depending on the
+ -- last call to Set_Standard_Error or Set_Standard_Output. It is never an
+ -- error to call Cancel_Special_Output. It has the same effect as calling
+ -- Set_Special_Output (null).
procedure Ignore_Output (S : String);
-- Does nothing. To disable output, pass Ignore_Output'Access to
@@ -79,11 +83,17 @@ package Output is
procedure Set_Standard_Output;
-- Sets subsequent output to appear on the standard output file (whatever
- -- that might mean for the host operating system, if anything) when
- -- no special output is in effect. When a special output is in effect,
- -- the output will appear on standard output only after special output
- -- has been cancelled. Output to standard output is the default mode
- -- before any call to either of the Set procedures.
+ -- that might mean for the host operating system, if anything) when no
+ -- special output is in effect. When a special output is in effect, the
+ -- output will appear on standard output only after special output has been
+ -- cancelled. Output to standard output is the default mode before any call
+ -- to either of the Set procedures.
+
+ procedure Set_Output (FD : File_Descriptor);
+ -- Sets subsequent output to appear on the given file descriptor when no
+ -- special output is in effect. When a special output is in effect, the
+ -- output will appear on the given file descriptor only after special
+ -- output has been cancelled.
procedure Indent;
-- Increases the current indentation level. Whenever a line is written
@@ -101,36 +111,36 @@ package Output is
-- If last character in buffer matches C, erase it, otherwise no effect
procedure Write_Eol;
- -- Write an end of line (whatever is required by the system in use,
- -- e.g. CR/LF for DOS, or LF for Unix) to the standard output file.
- -- This routine also empties the line buffer, actually writing it
- -- to the file. Note that Write_Eol is the only routine that causes
- -- any actual output to be written. Trailing spaces are removed.
+ -- Write an end of line (whatever is required by the system in use, e.g.
+ -- CR/LF for DOS, or LF for Unix) to the standard output file. This routine
+ -- also empties the line buffer, actually writing it to the file. Note that
+ -- Write_Eol is the only routine that causes any actual output to be
+ -- written. Trailing spaces are removed.
procedure Write_Eol_Keep_Blanks;
-- Similar as Write_Eol, except that trailing spaces are not removed
procedure Write_Int (Val : Int);
- -- Write an integer value with no leading blanks or zeroes. Negative
- -- values are preceded by a minus sign).
+ -- Write an integer value with no leading blanks or zeroes. Negative values
+ -- are preceded by a minus sign).
procedure Write_Spaces (N : Nat);
-- Write N spaces
procedure Write_Str (S : String);
-- Write a string of characters to the standard output file. Note that
- -- end of line is normally handled separately using WRITE_EOL, but it
- -- is allowed for the string to contain LF (but not CR) characters,
- -- which are properly interpreted as end of line characters. The string
- -- may also contain horizontal tab characters.
+ -- end of line is normally handled separately using WRITE_EOL, but it is
+ -- allowable for the string to contain LF (but not CR) characters, which
+ -- are properly interpreted as end of line characters. The string may also
+ -- contain horizontal tab characters.
procedure Write_Line (S : String);
-- Equivalent to Write_Str (S) followed by Write_Eol;
function Column return Pos;
pragma Inline (Column);
- -- Returns the number of the column about to be written (e.g. a value
- -- of 1 means the current line is empty).
+ -- Returns the number of the column about to be written (e.g. a value of 1
+ -- means the current line is empty).
-------------------------
-- Buffer Save/Restore --
diff --git a/gcc/ada/par-ch10.adb b/gcc/ada/par-ch10.adb
index 23cb1cd444c..e321affbfb9 100644
--- a/gcc/ada/par-ch10.adb
+++ b/gcc/ada/par-ch10.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -344,7 +344,8 @@ package body Ch10 is
Get_Expected_Unit_Type
(File_Name (Current_Source_File)) = Expect_Body
then
- Error_Msg_BC ("keyword BODY expected here [see file name]");
+ Error_Msg_BC -- CODEFIX
+ ("keyword BODY expected here [see file name]");
Restore_Scan_State (Scan_State);
Set_Unit (Comp_Unit_Node, P_Package (Pf_Pbod));
else
@@ -395,7 +396,8 @@ package body Ch10 is
-- Otherwise we saved the semicolon position, so complain
else
- Error_Msg (""";"" should be IS", SIS_Semicolon_Sloc);
+ Error_Msg -- CODEFIX
+ (""";"" should be IS", SIS_Semicolon_Sloc);
end if;
Body_Node := Unit (Comp_Unit_Node);
@@ -836,7 +838,8 @@ package body Ch10 is
end if;
if Token /= Tok_With then
- Error_Msg_SC ("unexpected LIMITED ignored");
+ Error_Msg_SC -- CODEFIX
+ ("unexpected LIMITED ignored");
end if;
if Ada_Version < Ada_05 then
@@ -876,8 +879,7 @@ package body Ch10 is
-- WITH TYPE is an obsolete GNAT specific extension
- Error_Msg_SP
- ("`WITH TYPE` is an obsolete 'G'N'A'T extension");
+ Error_Msg_SP ("`WITH TYPE` is an obsolete 'G'N'A'T extension");
Error_Msg_SP ("\use Ada 2005 `LIMITED WITH` clause instead");
Scan; -- past TYPE
@@ -1028,7 +1030,11 @@ package body Ch10 is
Ignore (Tok_Semicolon);
- if Token = Tok_Function or else Token = Tok_Procedure then
+ if Token = Tok_Function
+ or else Token = Tok_Not
+ or else Token = Tok_Overriding
+ or else Token = Tok_Procedure
+ then
Body_Node := P_Subprogram (Pf_Pbod);
elsif Token = Tok_Package then
diff --git a/gcc/ada/par-ch11.adb b/gcc/ada/par-ch11.adb
index 14129bc6230..62887237aa8 100644
--- a/gcc/ada/par-ch11.adb
+++ b/gcc/ada/par-ch11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -119,7 +119,8 @@ package body Ch11 is
Set_Choice_Parameter (Handler_Node, Choice_Param_Node);
elsif Token = Tok_Others then
- Error_Msg_AP ("missing "":""");
+ Error_Msg_AP -- CODEFIX
+ ("missing "":""");
Change_Identifier_To_Defining_Identifier (Choice_Param_Node);
Set_Choice_Parameter (Handler_Node, Choice_Param_Node);
diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb
index 046ac43e775..642c05a331b 100644
--- a/gcc/ada/par-ch12.adb
+++ b/gcc/ada/par-ch12.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -346,7 +346,7 @@ package body Ch12 is
Scan; -- past OTHERS
if Token /= Tok_Arrow then
- Error_Msg_BC ("expect arrow after others");
+ Error_Msg_BC ("expect arrow after others");
else
Scan; -- past arrow
end if;
@@ -912,7 +912,8 @@ package body Ch12 is
Scan;
if Token = Tok_Private then
- Error_Msg_SC ("TAGGED should be WITH");
+ Error_Msg_SC -- CODEFIX
+ ("TAGGED should be WITH");
Set_Private_Present (Def_Node, True);
T_Private;
else
diff --git a/gcc/ada/par-ch2.adb b/gcc/ada/par-ch2.adb
index e96c3794f99..def8ef5c521 100644
--- a/gcc/ada/par-ch2.adb
+++ b/gcc/ada/par-ch2.adb
@@ -503,7 +503,9 @@ package body Ch2 is
if Identifier_Seen and not Id_Present then
Error_Msg_SC
- ("|pragma argument identifier required here (RM 2.8(4))");
+ ("|pragma argument identifier required here");
+ Error_Msg_SC
+ ("\since previous argument had identifier (RM 2.8(4))");
end if;
if Id_Present then
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index 1b2683379e3..d1bc039b969 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -111,7 +111,6 @@ package body Ch3 is
-- current token, and if this is the first such message issued, saves
-- the message id in Missing_Begin_Msg, for possible later replacement.
-
---------------------------------
-- Check_Restricted_Expression --
---------------------------------
@@ -126,9 +125,7 @@ package body Ch3 is
and then Paren_Count (N) = 0
then
Error_Msg_N
- ("|this expression must be parenthesized!", N);
- Error_Msg_N
- ("\|since extensions (and set notation) are allowed", N);
+ ("|this expression must be parenthesized in Ada 2012 mode!", N);
end if;
end Check_Restricted_Expression;
@@ -385,7 +382,8 @@ package body Ch3 is
Scan; -- past = used in place of IS
elsif Token = Tok_Renames then
- Error_Msg_SC ("RENAMES should be IS");
+ Error_Msg_SC -- CODEFIX
+ ("RENAMES should be IS");
Scan; -- past RENAMES used in place of IS
else
@@ -972,7 +970,8 @@ package body Ch3 is
TF_Is;
if Token = Tok_New then
- Error_Msg_SC ("NEW ignored (only allowed in type declaration)");
+ Error_Msg_SC -- CODEFIX
+ ("NEW ignored (only allowed in type declaration)");
Scan; -- past NEW
end if;
@@ -1358,8 +1357,9 @@ package body Ch3 is
procedure No_List is
begin
if Num_Idents > 1 then
- Error_Msg ("identifier list not allowed for RENAMES",
- Sloc (Idents (2)));
+ Error_Msg
+ ("identifier list not allowed for RENAMES",
+ Sloc (Idents (2)));
end if;
List_OK := False;
@@ -1379,7 +1379,8 @@ package body Ch3 is
Check_Misspelling_Of (Tok_Renames);
if Token = Tok_Renames then
- Error_Msg_SP ("|extra "":"" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("|extra "":"" ignored");
Scan; -- past RENAMES
return True;
else
@@ -1750,9 +1751,10 @@ package body Ch3 is
-- illegal
if Token_Is_Renames then
- Error_Msg_N ("constraint not allowed in object renaming "
- & "declaration",
- Constraint (Object_Definition (Decl_Node)));
+ Error_Msg_N
+ ("constraint not allowed in object renaming "
+ & "declaration",
+ Constraint (Object_Definition (Decl_Node)));
raise Error_Resync;
end if;
end if;
@@ -1981,8 +1983,7 @@ package body Ch3 is
T_With; -- past WITH or give error message
if Token = Tok_Limited then
- Error_Msg_SC
- ("LIMITED keyword not allowed in private extension");
+ Error_Msg_SC ("LIMITED keyword not allowed in private extension");
Scan; -- ignore LIMITED
end if;
@@ -2107,7 +2108,6 @@ package body Ch3 is
Range_Node : Node_Id;
Save_Loc : Source_Ptr;
-
-- Start of processing for P_Range_Or_Subtype_Mark
begin
@@ -2170,6 +2170,11 @@ package body Ch3 is
return Expr_Node;
end if;
+ -- Simple expression case
+
+ elsif Expr_Form = EF_Simple and then Allow_Simple_Expression then
+ return Expr_Node;
+
-- Here we have some kind of error situation. Check for junk parens
-- then return what we have, caller will deal with other errors.
@@ -3434,8 +3439,7 @@ package body Ch3 is
Set_Null_Exclusion_Present (CompDef_Node, Not_Null_Present);
if Token = Tok_Array then
- Error_Msg_SC
- ("anonymous arrays not allowed as components");
+ Error_Msg_SC ("anonymous arrays not allowed as components");
raise Error_Resync;
end if;
@@ -3514,7 +3518,8 @@ package body Ch3 is
Error_Msg ("discriminant name expected", Sloc (Case_Node));
elsif Paren_Count (Case_Node) /= 0 then
- Error_Msg ("|discriminant name may not be parenthesized",
+ Error_Msg
+ ("|discriminant name may not be parenthesized",
Sloc (Case_Node));
Set_Paren_Count (Case_Node, 0);
end if;
@@ -3657,10 +3662,10 @@ package body Ch3 is
-- Expression
else
- -- If extensions are permitted then the expression must be a
- -- simple expression. The resaon for this restriction (i.e.
- -- going back to the Ada 83 rule) is to avoid ambiguities
- -- when set membership operations are allowed, consider the
+ -- In Ada 2012 mode, the expression must be a simple
+ -- expression. The resaon for this restriction (i.e. going
+ -- back to the Ada 83 rule) is to avoid ambiguities when set
+ -- membership operations are allowed, consider the
-- following:
-- when A in 1 .. 10 | 12 =>
@@ -3673,12 +3678,12 @@ package body Ch3 is
-- when (A in 1 .. 10 | 12) =>
-- when (A in 1 .. 10) | 12 =>
- -- To solve this, if extensins are enabled, we disallow
+ -- To solve this, in Ada 2012 mode, we disallow
-- the use of membership operations in expressions in
-- choices. Technically in the grammar, the expression
-- must match the grammar for restricted expression.
- if Extensions_Allowed then
+ if Ada_Version >= Ada_12 then
Check_Restricted_Expression (Expr_Node);
-- In Ada 83 mode, the syntax required a simple expression
@@ -3698,7 +3703,8 @@ package body Ch3 is
end if;
if Token = Tok_Comma then
- Error_Msg_SC (""","" should be ""'|""");
+ Error_Msg_SC -- CODEFIX
+ (""","" should be ""'|""");
else
exit when Token /= Tok_Vertical_Bar;
end if;
@@ -3745,8 +3751,9 @@ package body Ch3 is
end if;
if Abstract_Present then
- Error_Msg_SP ("ABSTRACT not allowed in interface type definition " &
- "(RM 3.9.4(2/2))");
+ Error_Msg_SP
+ ("ABSTRACT not allowed in interface type definition " &
+ "(RM 3.9.4(2/2))");
end if;
Scan; -- past INTERFACE
@@ -4284,7 +4291,8 @@ package body Ch3 is
-- Otherwise we saved the semicolon position, so complain
else
- Error_Msg ("|"";"" should be IS", SIS_Semicolon_Sloc);
+ Error_Msg -- CODEFIX
+ ("|"";"" should be IS", SIS_Semicolon_Sloc);
end if;
-- The next job is to fix up any declarations that occurred
@@ -4519,14 +4527,12 @@ package body Ch3 is
Kind = N_Task_Body or else
Kind = N_Protected_Body
then
- Error_Msg
- ("proper body not allowed in package spec", Sloc (Decl));
+ Error_Msg ("proper body not allowed in package spec", Sloc (Decl));
-- Test for body stub scanned, not acceptable as basic decl item
elsif Kind in N_Body_Stub then
- Error_Msg
- ("body stub not allowed in package spec", Sloc (Decl));
+ Error_Msg ("body stub not allowed in package spec", Sloc (Decl));
elsif Kind = N_Assignment_Statement then
Error_Msg
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 2bb9d25fcc1..d90b413d952 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -63,6 +63,7 @@ package body Ch4 is
function P_Aggregate_Or_Paren_Expr return Node_Id;
function P_Allocator return Node_Id;
+ function P_Case_Expression_Alternative return Node_Id;
function P_Record_Or_Array_Component_Association return Node_Id;
function P_Factor return Node_Id;
function P_Primary return Node_Id;
@@ -436,7 +437,7 @@ package body Ch4 is
elsif Token = Tok_Access then
Attr_Name := Name_Access;
- elsif Token = Tok_Mod and then Ada_Version = Ada_05 then
+ elsif Token = Tok_Mod and then Ada_Version >= Ada_95 then
Attr_Name := Name_Mod;
elsif Apostrophe_Should_Be_Semicolon then
@@ -565,8 +566,7 @@ package body Ch4 is
elsif Token = Tok_Range then
if Expr_Form /= EF_Simple_Name then
- Error_Msg_SC -- CODEFIX???
- ("subtype mark must precede RANGE");
+ Error_Msg_SC ("subtype mark must precede RANGE");
raise Error_Resync;
end if;
@@ -1164,6 +1164,13 @@ package body Ch4 is
T_Right_Paren;
return Expr_Node;
+ -- Case expression case
+
+ elsif Token = Tok_Case then
+ Expr_Node := P_Case_Expression;
+ T_Right_Paren;
+ return Expr_Node;
+
-- Note: the mechanism used here of rescanning the initial expression
-- is distinctly unpleasant, but it saves a lot of fiddling in scanning
-- out the discrete choice list.
@@ -1332,7 +1339,7 @@ package body Ch4 is
or else Token = Tok_Semicolon
then
if Present (Assoc_List) then
- Error_Msg_BC
+ Error_Msg_BC -- CODEFIX
("""='>"" expected (positional association cannot follow " &
"named association)");
end if;
@@ -1570,12 +1577,14 @@ package body Ch4 is
end P_Expression;
-- This function is identical to the normal P_Expression, except that it
- -- also permits the appearence of a conditional expression without the
- -- usual surrounding parentheses.
+ -- also permits the appearence of a case of conditional expression without
+ -- the usual surrounding parentheses.
function P_Expression_If_OK return Node_Id is
begin
- if Token = Tok_If then
+ if Token = Tok_Case then
+ return P_Case_Expression;
+ elsif Token = Tok_If then
return P_Conditional_Expression;
else
return P_Expression;
@@ -1672,11 +1681,13 @@ package body Ch4 is
end if;
end P_Expression_Or_Range_Attribute;
- -- Version that allows a non-parenthesized conditional expression
+ -- Version that allows a non-parenthesized case or conditional expression
function P_Expression_Or_Range_Attribute_If_OK return Node_Id is
begin
- if Token = Tok_If then
+ if Token = Tok_Case then
+ return P_Case_Expression;
+ elsif Token = Tok_If then
return P_Conditional_Expression;
else
return P_Expression_Or_Range_Attribute;
@@ -2339,9 +2350,9 @@ package body Ch4 is
return Error;
-- If this looks like a conditional expression, then treat it
- -- that way with an error messasge.
+ -- that way with an error message.
- elsif Extensions_Allowed then
+ elsif Ada_Version >= Ada_12 then
Error_Msg_SC
("conditional expression must be parenthesized");
return P_Conditional_Expression;
@@ -2352,6 +2363,31 @@ package body Ch4 is
return P_Identifier;
end if;
+ -- Deal with CASE (possible unparenthesized case expression)
+
+ when Tok_Case =>
+
+ -- If this looks like a real case, defined as a CASE appearing
+ -- the start of a new line, then we consider we have a missing
+ -- operand.
+
+ if Token_Is_At_Start_Of_Line then
+ Error_Msg_AP ("missing operand");
+ return Error;
+
+ -- If this looks like a case expression, then treat it that way
+ -- with an error message.
+
+ elsif Ada_Version >= Ada_12 then
+ Error_Msg_SC ("case expression must be parenthesized");
+ return P_Case_Expression;
+
+ -- Otherwise treat as misused identifier
+
+ else
+ return P_Identifier;
+ end if;
+
-- Anything else is illegal as the first token of a primary, but
-- we test for a reserved identifier so that it is treated nicely
@@ -2360,7 +2396,8 @@ package body Ch4 is
return P_Identifier;
elsif Prev_Token = Tok_Comma then
- Error_Msg_SP ("|extra "","" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("|extra "","" ignored");
raise Error_Resync;
else
@@ -2458,7 +2495,8 @@ package body Ch4 is
begin
if Token = Tok_Box then
- Error_Msg_SC ("|""'<'>"" should be ""/=""");
+ Error_Msg_SC -- CODEFIX
+ ("|""'<'>"" should be ""/=""");
end if;
Op_Kind := Relop_Node (Token);
@@ -2620,6 +2658,94 @@ package body Ch4 is
return Alloc_Node;
end P_Allocator;
+ -----------------------
+ -- P_Case_Expression --
+ -----------------------
+
+ function P_Case_Expression return Node_Id is
+ Loc : constant Source_Ptr := Token_Ptr;
+ Case_Node : Node_Id;
+ Save_State : Saved_Scan_State;
+
+ begin
+ if Ada_Version < Ada_12 then
+ Error_Msg_SC ("|case expression is an Ada 2012 feature");
+ Error_Msg_SC ("\|use -gnat12 switch to compile this unit");
+ end if;
+
+ Scan; -- past CASE
+ Case_Node :=
+ Make_Case_Expression (Loc,
+ Expression => P_Expression_No_Right_Paren,
+ Alternatives => New_List);
+ T_Is;
+
+ -- We now have scanned out CASE expression IS, scan alternatives
+
+ loop
+ T_When;
+ Append_To (Alternatives (Case_Node), P_Case_Expression_Alternative);
+
+ -- Missing comma if WHEN (more alternatives present)
+
+ if Token = Tok_When then
+ T_Comma;
+
+ -- If comma/WHEN, skip comma and we have another alternative
+
+ elsif Token = Tok_Comma then
+ Save_Scan_State (Save_State);
+ Scan; -- past comma
+
+ if Token /= Tok_When then
+ Restore_Scan_State (Save_State);
+ exit;
+ end if;
+
+ -- If no comma or WHEN, definitely done
+
+ else
+ exit;
+ end if;
+ end loop;
+
+ -- If we have an END CASE, diagnose as not needed
+
+ if Token = Tok_End then
+ Error_Msg_SC ("`END CASE` not allowed at end of case expression");
+ Scan; -- past END
+
+ if Token = Tok_Case then
+ Scan; -- past CASE;
+ end if;
+ end if;
+
+ -- Return the Case_Expression node
+
+ return Case_Node;
+ end P_Case_Expression;
+
+ -----------------------------------
+ -- P_Case_Expression_Alternative --
+ -----------------------------------
+
+ -- CASE_STATEMENT_ALTERNATIVE ::=
+ -- when DISCRETE_CHOICE_LIST =>
+ -- EXPRESSION
+
+ -- The caller has checked that and scanned past the initial WHEN token
+ -- Error recovery: can raise Error_Resync
+
+ function P_Case_Expression_Alternative return Node_Id is
+ Case_Alt_Node : Node_Id;
+ begin
+ Case_Alt_Node := New_Node (N_Case_Expression_Alternative, Token_Ptr);
+ Set_Discrete_Choices (Case_Alt_Node, P_Discrete_Choice_List);
+ TF_Arrow;
+ Set_Expression (Case_Alt_Node, P_Expression);
+ return Case_Alt_Node;
+ end P_Case_Expression_Alternative;
+
------------------------------
-- P_Conditional_Expression --
------------------------------
@@ -2633,9 +2759,9 @@ package body Ch4 is
begin
Inside_Conditional_Expression := Inside_Conditional_Expression + 1;
- if Token = Tok_If and then not Extensions_Allowed then
- Error_Msg_SC ("|conditional expression is an Ada extension");
- Error_Msg_SC ("\|use -gnatX switch to compile this unit");
+ if Token = Tok_If and then Ada_Version < Ada_12 then
+ Error_Msg_SC ("|conditional expression is an Ada 2012 feature");
+ Error_Msg_SC ("\|use -gnat12 switch to compile this unit");
end if;
Scan; -- past IF or ELSIF
@@ -2652,7 +2778,8 @@ package body Ch4 is
Scan; -- past semicolon
if Token = Tok_Else or else Token = Tok_Elsif then
- Error_Msg_SP ("|extra "";"" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("|extra "";"" ignored");
else
Restore_Scan_State (State);
@@ -2709,15 +2836,15 @@ package body Ch4 is
procedure P_Membership_Test (N : Node_Id) is
Alt : constant Node_Id :=
P_Range_Or_Subtype_Mark
- (Allow_Simple_Expression => Extensions_Allowed);
+ (Allow_Simple_Expression => (Ada_Version >= Ada_12));
begin
-- Set case
if Token = Tok_Vertical_Bar then
- if not Extensions_Allowed then
- Error_Msg_SC ("set notation is a language extension");
- Error_Msg_SC ("\|use -gnatX switch to compile this unit");
+ if Ada_Version < Ada_12 then
+ Error_Msg_SC ("set notation is an Ada 2012 feature");
+ Error_Msg_SC ("\|use -gnat12 switch to compile this unit");
end if;
Set_Alternatives (N, New_List (Alt));
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb
index f782f51e024..ec1bcebb8fe 100644
--- a/gcc/ada/par-ch5.adb
+++ b/gcc/ada/par-ch5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -193,7 +193,8 @@ package body Ch5 is
procedure Test_Statement_Required is
begin
if Statement_Required then
- Error_Msg_BC ("statement expected");
+ Error_Msg_BC -- CODEFIX
+ ("statement expected");
end if;
end Test_Statement_Required;
@@ -607,7 +608,8 @@ package body Ch5 is
or else
Nkind (Name_Node) = N_Selected_Component)
then
- Error_Msg_SC ("""/"" should be "".""");
+ Error_Msg_SC -- CODEFIX
+ ("""/"" should be "".""");
Statement_Required := False;
raise Error_Resync;
@@ -857,7 +859,8 @@ package body Ch5 is
Junk_Declaration;
else
- Error_Msg_BC ("statement expected");
+ Error_Msg_BC -- CODEFIX
+ ("statement expected");
raise Error_Resync;
end if;
end case;
@@ -1172,7 +1175,8 @@ package body Ch5 is
-- of WHEN expression =>
if Token = Tok_Arrow then
- Error_Msg_SC ("THEN expected");
+ Error_Msg_SC -- CODEFIX
+ ("THEN expected");
Scan; -- past the arrow
Pop_Scope_Stack; -- remove unneeded entry
raise Error_Resync;
@@ -1208,7 +1212,8 @@ package body Ch5 is
Scan; -- past ELSE
if Else_Should_Be_Elsif then
- Error_Msg_SP ("ELSE should be ELSIF");
+ Error_Msg_SP -- CODEFIX
+ ("ELSE should be ELSIF");
Add_Elsif_Part;
else
@@ -1258,7 +1263,8 @@ package body Ch5 is
if Token = Tok_Colon_Equal then
while Token = Tok_Colon_Equal loop
- Error_Msg_SC (""":="" should be ""=""");
+ Error_Msg_SC -- CODEFIX
+ (""":="" should be ""=""");
Scan; -- past junk :=
Discard_Junk_Node (P_Expression_No_Right_Paren);
end loop;
@@ -2196,7 +2202,8 @@ package body Ch5 is
-- What we are interested in is whether it was a case of a bad IS.
if Scope.Table (Scope.Last + 1).Etyp = E_Bad_Is then
- Error_Msg ("|IS should be "";""", Scope.Table (Scope.Last + 1).S_Is);
+ Error_Msg -- CODEFIX
+ ("|IS should be "";""", Scope.Table (Scope.Last + 1).S_Is);
Set_Bad_Is_Detected (Parent, True);
end if;
@@ -2225,7 +2232,8 @@ package body Ch5 is
TF_Then;
while Token = Tok_Then loop
- Error_Msg_SC ("redundant THEN");
+ Error_Msg_SC -- CODEFIX
+ ("redundant THEN");
TF_Then;
end loop;
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index ea5df6dfb3b..fc9a3741366 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -64,7 +64,8 @@ package body Ch6 is
if Token = Tok_Return then
Restore_Scan_State (Scan_State);
- Error_Msg_SC ("|extra "";"" ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra "";"" ignored");
Scan; -- rescan past junk semicolon
else
Restore_Scan_State (Scan_State);
@@ -195,7 +196,8 @@ package body Ch6 is
Not_Overriding := True;
else
- Error_Msg_SC ("OVERRIDING expected!");
+ Error_Msg_SC -- CODEFIX
+ ("OVERRIDING expected!");
end if;
-- Ada 2005: scan leading OVERRIDING indicator
@@ -215,14 +217,17 @@ package body Ch6 is
-- already been given, so no need to give another message here.
-- An overriding indicator is allowed for subprogram declarations,
- -- bodies, renamings, stubs, and instantiations. The test against
- -- Pf_Decl_Pbod is added to account for the case of subprograms
- -- declared in a protected type, where only subprogram declarations
- -- and bodies can occur.
+ -- bodies (including subunits), renamings, stubs, and
+ -- instantiations. The test against Pf_Decl_Pbod is added to account
+ -- for the case of subprograms declared in a protected type, where
+ -- only subprogram declarations and bodies can occur. The Pf_Pbod
+ -- case is for subunits.
if Pf_Flags /= Pf_Decl_Gins_Pbod_Rnam_Stub
and then
Pf_Flags /= Pf_Decl_Pbod
+ and then
+ Pf_Flags /= Pf_Pbod
then
Error_Msg_SC ("overriding indicator not allowed here!");
@@ -345,7 +350,8 @@ package body Ch6 is
if Token = Tok_Return then
if not Func then
- Error_Msg ("PROCEDURE should be FUNCTION", Fproc_Sloc);
+ Error_Msg -- CODEFIX
+ ("PROCEDURE should be FUNCTION", Fproc_Sloc);
Func := True;
end if;
@@ -418,7 +424,8 @@ package body Ch6 is
Scan; -- past semicolon
if Token = Tok_Is then
- Error_Msg_SP ("extra "";"" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("extra "";"" ignored");
else
Restore_Scan_State (Scan_State);
end if;
@@ -437,7 +444,8 @@ package body Ch6 is
-- semicolon, and go process the body.
if Token = Tok_Is then
- Error_Msg_SP ("|extra "";"" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("|extra "";"" ignored");
T_Is; -- scan past IS
goto Subprogram_Body;
@@ -449,7 +457,8 @@ package body Ch6 is
elsif Token = Tok_Begin
and then Start_Column >= Scope.Table (Scope.Last).Ecol
then
- Error_Msg_SP ("|"";"" should be IS!");
+ Error_Msg_SP -- CODEFIX
+ ("|"";"" should be IS!");
goto Subprogram_Body;
else
@@ -489,7 +498,8 @@ package body Ch6 is
-- Deal nicely with (now obsolete) use of <> in place of abstract
if Token = Tok_Box then
- Error_Msg_SC ("ABSTRACT expected");
+ Error_Msg_SC -- CODEFIX
+ ("ABSTRACT expected");
Token := Tok_Abstract;
end if;
@@ -553,7 +563,8 @@ package body Ch6 is
-- semicolon which should really be an IS
else
- Error_Msg_AP ("|missing "";""");
+ Error_Msg_AP -- CODEFIX
+ ("|missing "";""");
SIS_Missing_Semicolon_Message := Get_Msg_Id;
goto Subprogram_Declaration;
end if;
@@ -1216,7 +1227,8 @@ package body Ch6 is
-- that semicolon should have been a right parenthesis and exit
if Token = Tok_Is or else Token = Tok_Return then
- Error_Msg_SP ("|"";"" should be "")""");
+ Error_Msg_SP -- CODEFIX
+ ("|"";"" should be "")""");
exit Specification_Loop;
end if;
@@ -1224,7 +1236,8 @@ package body Ch6 is
-- assume we had a missing right parenthesis and terminate list
if Token in Token_Class_Declk then
- Error_Msg_AP ("missing "")""");
+ Error_Msg_AP -- CODEFIX
+ ("missing "")""");
Restore_Scan_State (Scan_State);
exit Specification_Loop;
end if;
@@ -1287,7 +1300,8 @@ package body Ch6 is
Set_In_Present (Node, True);
if Style.Mode_In_Check and then Token /= Tok_Out then
- Error_Msg_SP ("(style) IN should be omitted");
+ Error_Msg_SP -- CODEFIX
+ ("(style) IN should be omitted");
end if;
if Token = Tok_Access then
@@ -1302,8 +1316,7 @@ package body Ch6 is
end if;
if Token = Tok_In then
- Error_Msg_SC -- CODEFIX ???
- ("IN must precede OUT in parameter mode");
+ Error_Msg_SC ("IN must precede OUT in parameter mode");
Scan; -- past IN
Set_In_Present (Node, True);
end if;
diff --git a/gcc/ada/par-ch7.adb b/gcc/ada/par-ch7.adb
index 3b24c8792b8..d4d168de7bc 100644
--- a/gcc/ada/par-ch7.adb
+++ b/gcc/ada/par-ch7.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -69,10 +69,10 @@ package body Ch7 is
-- Pf_Flags.Rnam Set if renaming declaration OK
-- Pf_Flags.Stub Set if body stub OK
- -- If an inappropriate form is encountered, it is scanned out but an
- -- error message indicating that it is appearing in an inappropriate
- -- context is issued. The only possible settings for Pf_Flags are those
- -- defined as constants in package Par.
+ -- If an inappropriate form is encountered, it is scanned out but an error
+ -- message indicating that it is appearing in an inappropriate context is
+ -- issued. The only possible settings for Pf_Flags are those defined as
+ -- constants in package Par.
-- Note: in all contexts where a package specification is required, there
-- is a terminating semicolon. This semicolon is scanned out in the case
@@ -101,7 +101,8 @@ package body Ch7 is
Scan; -- past PACKAGE
if Token = Tok_Type then
- Error_Msg_SC ("TYPE not allowed here");
+ Error_Msg_SC -- CODEFIX
+ ("TYPE not allowed here");
Scan; -- past TYPE
end if;
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb
index 1271d478a73..23b27c7774e 100644
--- a/gcc/ada/par-ch9.adb
+++ b/gcc/ada/par-ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -154,7 +154,8 @@ package body Ch9 is
Scan; -- past semicolon
if Token = Tok_Entry then
- Error_Msg_SP ("|"";"" should be IS");
+ Error_Msg_SP -- CODEFIX
+ ("|"";"" should be IS");
Set_Task_Definition (Task_Node, P_Task_Definition);
else
Pop_Scope_Stack; -- Remove unused entry
@@ -181,13 +182,14 @@ package body Ch9 is
end loop;
if Token /= Tok_With then
- Error_Msg_SC ("WITH expected");
+ Error_Msg_SC -- CODEFIX
+ ("WITH expected");
end if;
Scan; -- past WITH
if Token = Tok_Private then
- Error_Msg_SP
+ Error_Msg_SP -- CODEFIX
("PRIVATE not allowed in task type declaration");
end if;
end if;
@@ -454,7 +456,8 @@ package body Ch9 is
if Token /= Tok_Is then
Restore_Scan_State (Scan_State);
- Error_Msg_SC ("missing IS");
+ Error_Msg_SC -- CODEFIX
+ ("missing IS");
Set_Protected_Definition (Protected_Node,
Make_Protected_Definition (Token_Ptr,
Visible_Declarations => Empty_List,
@@ -466,7 +469,8 @@ package body Ch9 is
return Protected_Node;
end if;
- Error_Msg_SP ("|extra ""("" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("|extra ""("" ignored");
end if;
T_Is;
@@ -492,7 +496,8 @@ package body Ch9 is
end loop;
if Token /= Tok_With then
- Error_Msg_SC ("WITH expected");
+ Error_Msg_SC -- CODEFIX
+ ("WITH expected");
end if;
Scan; -- past WITH
@@ -625,7 +630,8 @@ package body Ch9 is
Scan; -- past OVERRIDING
Not_Overriding := True;
else
- Error_Msg_SC ("OVERRIDING expected!");
+ Error_Msg_SC -- CODEFIX
+ ("OVERRIDING expected!");
end if;
else
@@ -758,8 +764,7 @@ package body Ch9 is
Scan; -- past PRIVATE
elsif Token = Tok_Identifier then
- Error_Msg_SC
- ("all components must be declared in spec!");
+ Error_Msg_SC ("all components must be declared in spec!");
Resync_Past_Semicolon;
elsif Token in Token_Class_Declk then
@@ -809,7 +814,8 @@ package body Ch9 is
Scan; -- part OVERRIDING
Not_Overriding := True;
else
- Error_Msg_SC ("OVERRIDING expected!");
+ Error_Msg_SC -- CODEFIX
+ ("OVERRIDING expected!");
end if;
elsif Token = Tok_Overriding then
@@ -823,7 +829,8 @@ package body Ch9 is
Error_Msg_SP ("\unit must be compiled with -gnat05 switch");
elsif Token /= Tok_Entry then
- Error_Msg_SC ("ENTRY expected!");
+ Error_Msg_SC -- CODEFIX
+ ("ENTRY expected!");
end if;
end if;
@@ -1115,7 +1122,8 @@ package body Ch9 is
Bnode := P_Expression_No_Right_Paren;
if Token = Tok_Colon_Equal then
- Error_Msg_SC ("|"":="" should be ""=""");
+ Error_Msg_SC -- CODEFIX
+ ("|"":="" should be ""=""");
Scan;
Bnode := P_Expression_No_Right_Paren;
end if;
diff --git a/gcc/ada/par-endh.adb b/gcc/ada/par-endh.adb
index 94e753976aa..5b16bce00b9 100644
--- a/gcc/ada/par-endh.adb
+++ b/gcc/ada/par-endh.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
diff --git a/gcc/ada/par-labl.adb b/gcc/ada/par-labl.adb
index 9874c4fcef9..6609a07576e 100644
--- a/gcc/ada/par-labl.adb
+++ b/gcc/ada/par-labl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -375,13 +375,21 @@ procedure Labl is
and then Matches (Node (N), Node (S1))
then
if not Found then
- if Parent (Node (N)) = Parent (Node (S1)) then
+
+ -- If the label and the goto are both in the same statement
+ -- list, then we've found a loop. Note that labels and goto
+ -- statements are always part of some list, so
+ -- List_Containing always makes sense.
+
+ if List_Containing (Node (N)) =
+ List_Containing (Node (S1))
+ then
Source := S1;
Found := True;
- else
- -- The goto is within some nested structure
+ -- The goto is within some nested structure
+ else
No_Header (N);
return;
end if;
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 9b5b0ab76a3..a421592ad84 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -150,8 +150,7 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is
Error_Msg_Name_2 := Name_On;
Error_Msg_Name_3 := Name_Off;
- Error_Msg
- ("argument for pragma% must be% or%", Sloc (Argx));
+ Error_Msg ("argument for pragma% must be% or%", Sloc (Argx));
raise Error_Resync;
end if;
end Check_Arg_Is_On_Or_Off;
@@ -307,7 +306,7 @@ begin
-- Ada_05/Ada_2005 --
---------------------
- -- This pragma must be processed at parse time, since we want to set
+ -- These pragmas must be processed at parse time, since we want to set
-- the Ada version properly at parse time to recognize the appropriate
-- Ada version syntax. However, it is only the zero argument form that
-- must be processed at parse time.
@@ -318,6 +317,18 @@ begin
Ada_Version_Explicit := Ada_05;
end if;
+ ---------------------
+ -- Ada_12/Ada_2012 --
+ ---------------------
+
+ -- These pragmas must be processed at parse time, since we want to set
+ -- the Ada version properly at parse time to recognize the appropriate
+ -- Ada version syntax.
+
+ when Pragma_Ada_12 | Pragma_Ada_2012 =>
+ Ada_Version := Ada_12;
+ Ada_Version_Explicit := Ada_12;
+
-----------
-- Debug --
-----------
@@ -375,8 +386,10 @@ begin
if Chars (Expression (Arg1)) = Name_On then
Extensions_Allowed := True;
+ Ada_Version := Ada_12;
else
Extensions_Allowed := False;
+ Ada_Version := Ada_Version_Explicit;
end if;
----------------
@@ -943,7 +956,11 @@ begin
OK := False;
elsif Chars (A) = Name_All_Checks then
- Stylesw.Set_Default_Style_Check_Options;
+ if GNAT_Mode then
+ Stylesw.Set_GNAT_Style_Check_Options;
+ else
+ Stylesw.Set_Default_Style_Check_Options;
+ end if;
elsif Chars (A) = Name_On then
Style_Check := True;
diff --git a/gcc/ada/par-tchk.adb b/gcc/ada/par-tchk.adb
index 9329b41cd14..c92b20fbfe2 100644
--- a/gcc/ada/par-tchk.adb
+++ b/gcc/ada/par-tchk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -83,15 +83,18 @@ package body Tchk is
-- A little recovery helper, accept then in place of =>
elsif Token = Tok_Then then
- Error_Msg_BC ("|THEN should be ""='>""");
+ Error_Msg_BC -- CODEFIX
+ ("|THEN should be ""='>""");
Scan; -- past THEN used in place of =>
elsif Token = Tok_Colon_Equal then
- Error_Msg_SC ("|"":="" should be ""='>""");
+ Error_Msg_SC -- CODEFIX
+ ("|"":="" should be ""='>""");
Scan; -- past := used in place of =>
else
- Error_Msg_AP ("missing ""='>""");
+ Error_Msg_AP -- CODEFIX
+ ("missing ""='>""");
end if;
end T_Arrow;
@@ -122,7 +125,8 @@ package body Tchk is
if Token = Tok_Box then
Scan;
else
- Error_Msg_AP ("missing ""'<'>""");
+ Error_Msg_AP -- CODEFIX
+ ("missing ""'<'>""");
end if;
end T_Box;
@@ -135,7 +139,8 @@ package body Tchk is
if Token = Tok_Colon then
Scan;
else
- Error_Msg_AP ("missing "":""");
+ Error_Msg_AP -- CODEFIX
+ ("missing "":""");
end if;
end T_Colon;
@@ -149,19 +154,23 @@ package body Tchk is
Scan;
elsif Token = Tok_Equal then
- Error_Msg_SC ("|""="" should be "":=""");
+ Error_Msg_SC -- CODEFIX
+ ("|""="" should be "":=""");
Scan;
elsif Token = Tok_Colon then
- Error_Msg_SC ("|"":"" should be "":=""");
+ Error_Msg_SC -- CODEFIX
+ ("|"":"" should be "":=""");
Scan;
elsif Token = Tok_Is then
- Error_Msg_SC ("|IS should be "":=""");
+ Error_Msg_SC -- CODEFIX
+ ("|IS should be "":=""");
Scan;
else
- Error_Msg_AP ("missing "":=""");
+ Error_Msg_AP -- CODEFIX
+ ("missing "":=""");
end if;
end T_Colon_Equal;
@@ -182,7 +191,8 @@ package body Tchk is
if Token = Tok_Comma then
Scan;
else
- Error_Msg_AP ("missing "",""");
+ Error_Msg_AP -- CODEFIX
+ ("missing "",""");
end if;
end if;
@@ -200,7 +210,8 @@ package body Tchk is
if Token = Tok_Dot_Dot then
Scan;
else
- Error_Msg_AP ("missing ""..""");
+ Error_Msg_AP -- CODEFIX
+ ("missing ""..""");
end if;
end T_Dot_Dot;
@@ -222,7 +233,8 @@ package body Tchk is
if Token = Tok_Greater_Greater then
Scan;
else
- Error_Msg_AP ("missing ""'>'>""");
+ Error_Msg_AP -- CODEFIX
+ ("missing ""'>'>""");
end if;
end T_Greater_Greater;
@@ -271,15 +283,18 @@ package body Tchk is
-- Allow OF, => or = to substitute for IS with complaint
elsif Token = Tok_Arrow then
- Error_Msg_SC ("|""=>"" should be IS");
+ Error_Msg_SC -- CODEFIX
+ ("|""=>"" should be IS");
Scan; -- past =>
elsif Token = Tok_Of then
- Error_Msg_SC ("|OF should be IS");
+ Error_Msg_SC -- CODEFIX
+ ("|OF should be IS");
Scan; -- past OF
elsif Token = Tok_Equal then
- Error_Msg_SC ("|""="" should be IS");
+ Error_Msg_SC -- CODEFIX
+ ("|""="" should be IS");
Scan; -- past =
else
@@ -289,7 +304,8 @@ package body Tchk is
-- Ignore extra IS keywords
while Token = Tok_Is loop
- Error_Msg_SC ("|extra IS ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra IS ignored");
Scan;
end loop;
end T_Is;
@@ -303,7 +319,8 @@ package body Tchk is
if Token = Tok_Left_Paren then
Scan;
else
- Error_Msg_AP ("missing ""(""");
+ Error_Msg_AP -- CODEFIX
+ ("missing ""(""");
end if;
end T_Left_Paren;
@@ -314,7 +331,8 @@ package body Tchk is
procedure T_Loop is
begin
if Token = Tok_Do then
- Error_Msg_SC ("LOOP expected");
+ Error_Msg_SC -- CODEFIX
+ ("LOOP expected");
Scan;
else
Check_Token (Tok_Loop, AP);
@@ -393,7 +411,8 @@ package body Tchk is
if Token = Tok_Right_Paren then
Scan;
else
- Error_Msg_AP ("|missing "")""");
+ Error_Msg_AP -- CODEFIX
+ ("|missing "")""");
end if;
end T_Right_Paren;
@@ -408,24 +427,28 @@ package body Tchk is
Scan;
if Token = Tok_Semicolon then
- Error_Msg_SC ("|extra "";"" ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra "";"" ignored");
Scan;
end if;
return;
elsif Token = Tok_Colon then
- Error_Msg_SC ("|"":"" should be "";""");
+ Error_Msg_SC -- CODEFIX
+ ("|"":"" should be "";""");
Scan;
return;
elsif Token = Tok_Comma then
- Error_Msg_SC ("|"","" should be "";""");
+ Error_Msg_SC -- CODEFIX
+ ("|"","" should be "";""");
Scan;
return;
elsif Token = Tok_Dot then
- Error_Msg_SC ("|""."" should be "";""");
+ Error_Msg_SC -- CODEFIX
+ ("|""."" should be "";""");
Scan;
return;
@@ -464,7 +487,8 @@ package body Tchk is
-- If none of those tests return, we really have a missing semicolon
- Error_Msg_AP ("|missing "";""");
+ Error_Msg_AP -- CODEFIX
+ ("|missing "";""");
return;
end T_Semicolon;
@@ -646,7 +670,8 @@ package body Tchk is
Scan; -- skip RETURN and we are done
else
- Error_Msg_SC ("missing RETURN");
+ Error_Msg_SC -- CODEFIX
+ ("missing RETURN");
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
@@ -814,7 +839,8 @@ package body Tchk is
if Token = Tok_Left_Paren then
Scan;
else
- Error_Msg_AP ("missing ""(""!");
+ Error_Msg_AP -- CODEFIX
+ ("missing ""(""!");
end if;
end U_Left_Paren;
@@ -827,7 +853,8 @@ package body Tchk is
if Token = Tok_Right_Paren then
Scan;
else
- Error_Msg_AP ("|missing "")""!");
+ Error_Msg_AP -- CODEFIX
+ ("|missing "")""!");
end if;
end U_Right_Paren;
@@ -846,7 +873,8 @@ package body Tchk is
Scan;
if Token = T then
- Error_Msg_SP ("|extra "";"" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("|extra "";"" ignored");
Scan;
else
Error_Msg_SP (M);
@@ -856,7 +884,8 @@ package body Tchk is
Scan;
if Token = T then
- Error_Msg_SP ("|extra "","" ignored");
+ Error_Msg_SP -- CODEFIX
+ ("|extra "","" ignored");
Scan;
else
diff --git a/gcc/ada/par-util.adb b/gcc/ada/par-util.adb
index 3672ca8145e..6a0e8efc6cb 100644
--- a/gcc/ada/par-util.adb
+++ b/gcc/ada/par-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -72,7 +72,8 @@ package body Util is
and then Name_Len = 7
and then Name_Buffer (1 .. 7) = "program"
then
- Error_Msg_SC ("PROCEDURE expected");
+ Error_Msg_SC -- CODEFIX
+ ("PROCEDURE expected");
Token := T;
return True;
@@ -86,8 +87,7 @@ package body Util is
M2 (P2 + J - 1) := Fold_Upper (S (J));
end loop;
- Error_Msg_SC -- CODEFIX???
- (M2 (1 .. P2 - 1 + S'Last));
+ Error_Msg_SC (M2 (1 .. P2 - 1 + S'Last));
Token := T;
return True;
end if;
@@ -334,7 +334,8 @@ package body Util is
<<Assume_Comma>>
Restore_Scan_State (Scan_State);
- Error_Msg_SC ("|"";"" should be "",""");
+ Error_Msg_SC -- CODEFIX
+ ("|"";"" should be "",""");
Scan; -- past the semicolon
return True;
@@ -384,26 +385,30 @@ package body Util is
begin
while Token = T loop
if T = Tok_Comma then
- Error_Msg_SC ("|extra "","" ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra "","" ignored");
elsif T = Tok_Left_Paren then
- Error_Msg_SC ("|extra ""("" ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra ""("" ignored");
elsif T = Tok_Right_Paren then
- Error_Msg_SC ("|extra "")"" ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra "")"" ignored");
elsif T = Tok_Semicolon then
- Error_Msg_SC ("|extra "";"" ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra "";"" ignored");
elsif T = Tok_Colon then
- Error_Msg_SC ("|extra "":"" ignored");
+ Error_Msg_SC -- CODEFIX
+ ("|extra "":"" ignored");
else
declare
Tname : constant String := Token_Type'Image (Token);
begin
- Error_Msg_SC
- ("|extra " & Tname (5 .. Tname'Last) & "ignored");
+ Error_Msg_SC ("|extra " & Tname (5 .. Tname'Last) & "ignored");
end;
end if;
@@ -567,8 +572,7 @@ package body Util is
end;
Error_Msg_Node_1 := Prev;
- Error_Msg_SC
- ("unexpected identifier, possibly & was meant here");
+ Error_Msg_SC ("unexpected identifier, possibly & was meant here");
Scan;
end Merge_Identifier;
diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb
index 78ffd604ebd..bf3dc1e6b51 100644
--- a/gcc/ada/par.adb
+++ b/gcc/ada/par.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -676,8 +676,13 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
function P_Simple_Expression return Node_Id;
function P_Simple_Expression_Or_Range_Attribute return Node_Id;
+ function P_Case_Expression return Node_Id;
+ -- Scans out a case expression. Called with Token pointing to the CASE
+ -- keyword, and returns pointing to the terminating right parent,
+ -- semicolon, or comma, but does not consume this terminating token.
+
function P_Conditional_Expression return Node_Id;
- -- Scans out a conditional expression. Called with token pointing to
+ -- Scans out a conditional expression. Called with Token pointing to
-- the IF keyword, and returns pointing to the terminating right paren,
-- semicolon or comma, but does not consume this terminating token.
@@ -1182,12 +1187,12 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
--------------
procedure Labl;
- -- This procedure creates implicit label declarations for all label that
- -- are declared in the current unit. Note that this could conceptually
- -- be done at the point where the labels are declared, but it is tricky
- -- to do it then, since the tree is not hooked up at the point where the
- -- label is declared (e.g. a sequence of statements is not yet attached
- -- to its containing scope at the point a label in the sequence is found)
+ -- This procedure creates implicit label declarations for all labels that
+ -- are declared in the current unit. Note that this could conceptually be
+ -- done at the point where the labels are declared, but it is tricky to do
+ -- it then, since the tree is not hooked up at the point where the label is
+ -- declared (e.g. a sequence of statements is not yet attached to its
+ -- containing scope at the point a label in the sequence is found).
--------------
-- Par.Load --
diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb
index 82ab9d651a0..7dbaf93af89 100644
--- a/gcc/ada/par_sco.adb
+++ b/gcc/ada/par_sco.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2010, 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- --
@@ -63,13 +63,14 @@ package body Par_SCO is
Table_Increment => 200,
Table_Name => "SCO_Unit_Number_Entry");
- --------------------------
- -- Condition Hash Table --
- --------------------------
+ ---------------------------------
+ -- Condition/Pragma Hash Table --
+ ---------------------------------
-- We need to be able to get to conditions quickly for handling the calls
- -- to Set_SCO_Condition efficiently. For this purpose we identify the
- -- conditions in the table by their starting sloc, and use the following
+ -- to Set_SCO_Condition efficiently, and similarly to get to pragmas to
+ -- handle calls to Set_SCO_Pragma_Enabled. For this purpose we identify the
+ -- conditions and pragmas in the table by their starting sloc, and use this
-- hash table to map from these starting sloc values to SCO_Table indexes.
type Header_Num is new Integer range 0 .. 996;
@@ -81,7 +82,7 @@ package body Par_SCO is
function Equal (F1, F2 : Source_Ptr) return Boolean;
-- Function to test two keys for equality
- package Condition_Hash_Table is new Simple_HTable
+ package Condition_Pragma_Hash_Table is new Simple_HTable
(Header_Num, Int, 0, Source_Ptr, Hash, Equal);
-- The actual hash table
@@ -104,8 +105,9 @@ package body Par_SCO is
-- If N is Empty, has no effect. Otherwise scans the tree for the node N,
-- to output any decisions it contains. T is one of IEPWX (for context of
-- expresion: if/exit when/pragma/while/expression). If T is other than X,
- -- then a decision is always present (at the very least a simple decision
- -- is present at the top level).
+ -- the node N is the conditional expression involved, and a decision is
+ -- always present (at the very least a simple decision is present at the
+ -- top level).
procedure Process_Decisions (L : List_Id; T : Character);
-- Calls above procedure for each element of the list L
@@ -119,11 +121,13 @@ package body Par_SCO is
-- Append an entry to SCO_Table with fields set as per arguments
procedure Traverse_Declarations_Or_Statements (L : List_Id);
+ procedure Traverse_Generic_Instantiation (N : Node_Id);
procedure Traverse_Generic_Package_Declaration (N : Node_Id);
procedure Traverse_Handled_Statement_Sequence (N : Node_Id);
procedure Traverse_Package_Body (N : Node_Id);
procedure Traverse_Package_Declaration (N : Node_Id);
procedure Traverse_Subprogram_Body (N : Node_Id);
+ procedure Traverse_Subprogram_Declaration (N : Node_Id);
-- Traverse the corresponding construct, generating SCO table entries
procedure Write_SCOs_To_ALI_File is new Put_SCOs;
@@ -299,8 +303,7 @@ package body Par_SCO is
function Is_Logical_Operator (N : Node_Id) return Boolean is
begin
- return Nkind_In (N, N_Op_Xor,
- N_Op_Not,
+ return Nkind_In (N, N_Op_Not,
N_And_Then,
N_Or_Else);
end Is_Logical_Operator;
@@ -327,6 +330,17 @@ package body Par_SCO is
procedure Process_Decisions (N : Node_Id; T : Character) is
+ Mark : Nat;
+ -- This is used to mark the location of a decision sequence in the SCO
+ -- table. We use it for backing out a simple decision in an expression
+ -- context that contains only NOT operators.
+
+ X_Not_Decision : Boolean;
+ -- This flag keeps track of whether a decision sequence in the SCO table
+ -- contains only NOT operators, and is for an expression context (T=X).
+ -- The flag will be set False if T is other than X, or if an operator
+ -- other than NOT is in the sequence.
+
function Process_Node (N : Node_Id) return Traverse_Result;
-- Processes one node in the traversal, looking for logical operators,
-- and if one is found, outputs the appropriate table entries.
@@ -340,13 +354,15 @@ package body Par_SCO is
-- Process_Decision_Operand, because we can't get decisions mixed up in
-- the global table. Call has no effect if N is Empty.
- procedure Output_Element (N : Node_Id; T : Character);
+ procedure Output_Element (N : Node_Id);
-- Node N is an operand of a logical operator that is not itself a
-- logical operator, or it is a simple decision. This routine outputs
- -- the table entry for the element, with C1 set to T (' ' for one of
- -- the elements of a complex decision, or 'I'/'W'/'E' for a simple
- -- decision (from an IF, WHILE, or EXIT WHEN). Last is set to False,
- -- and an entry is made in the condition hash table.
+ -- the table entry for the element, with C1 set to ' '. Last is set
+ -- False, and an entry is made in the condition hash table.
+
+ procedure Output_Header (T : Character);
+ -- Outputs a decision header node. T is I/W/E/P for IF/WHILE/EXIT WHEN/
+ -- PRAGMA, and 'X' for the expression case.
procedure Process_Decision_Operand (N : Node_Id);
-- This is called on node N, the top level node of a decision, or on one
@@ -376,16 +392,19 @@ package body Par_SCO is
else
L := Left_Opnd (N);
- if Nkind (N) = N_Op_Xor then
- C := '^';
- elsif Nkind_In (N, N_Op_Or, N_Or_Else) then
+ if Nkind_In (N, N_Op_Or, N_Or_Else) then
C := '|';
else
C := '&';
end if;
end if;
- Set_Table_Entry (C, ' ', No_Location, No_Location, False);
+ Set_Table_Entry
+ (C1 => C,
+ C2 => ' ',
+ From => Sloc (N),
+ To => No_Location,
+ Last => False);
Output_Decision_Operand (L);
Output_Decision_Operand (Right_Opnd (N));
@@ -393,7 +412,7 @@ package body Par_SCO is
-- Not a logical operator
else
- Output_Element (N, ' ');
+ Output_Element (N);
end if;
end Output_Decision_Operand;
@@ -401,15 +420,83 @@ package body Par_SCO is
-- Output_Element --
--------------------
- procedure Output_Element (N : Node_Id; T : Character) is
+ procedure Output_Element (N : Node_Id) is
FSloc : Source_Ptr;
LSloc : Source_Ptr;
begin
Sloc_Range (N, FSloc, LSloc);
- Set_Table_Entry (T, 'c', FSloc, LSloc, False);
- Condition_Hash_Table.Set (FSloc, SCO_Table.Last);
+ Set_Table_Entry
+ (C1 => ' ',
+ C2 => 'c',
+ From => FSloc,
+ To => LSloc,
+ Last => False);
+ Condition_Pragma_Hash_Table.Set (FSloc, SCO_Table.Last);
end Output_Element;
+ -------------------
+ -- Output_Header --
+ -------------------
+
+ procedure Output_Header (T : Character) is
+ begin
+ case T is
+ when 'I' | 'E' | 'W' =>
+
+ -- For IF, EXIT, WHILE, the token SLOC can be found from
+ -- the SLOC of the parent of the expression.
+
+ Set_Table_Entry
+ (C1 => T,
+ C2 => ' ',
+ From => Sloc (Parent (N)),
+ To => No_Location,
+ Last => False);
+
+ when 'P' =>
+
+ -- For PRAGMA, we must get the location from the pragma node.
+ -- Argument N is the pragma argument, and we have to go up two
+ -- levels (through the pragma argument association) to get to
+ -- the pragma node itself.
+
+ declare
+ Loc : constant Source_Ptr := Sloc (Parent (Parent (N)));
+
+ begin
+ Set_Table_Entry
+ (C1 => 'P',
+ C2 => 'd',
+ From => Loc,
+ To => No_Location,
+ Last => False);
+
+ -- For pragmas we also must make an entry in the hash table
+ -- for later access by Set_SCO_Pragma_Enabled. We set the
+ -- pragma as disabled above, the call will change C2 to 'e'
+ -- to enable the pragma header entry.
+
+ Condition_Pragma_Hash_Table.Set (Loc, SCO_Table.Last);
+ end;
+
+ when 'X' =>
+
+ -- For an expression, no Sloc
+
+ Set_Table_Entry
+ (C1 => 'X',
+ C2 => ' ',
+ From => No_Location,
+ To => No_Location,
+ Last => False);
+
+ -- No other possibilities
+
+ when others =>
+ raise Program_Error;
+ end case;
+ end Output_Header;
+
------------------------------
-- Process_Decision_Operand --
------------------------------
@@ -419,6 +506,7 @@ package body Par_SCO is
if Is_Logical_Operator (N) then
if Nkind (N) /= N_Op_Not then
Process_Decision_Operand (Left_Opnd (N));
+ X_Not_Decision := False;
end if;
Process_Decision_Operand (Right_Opnd (N));
@@ -439,9 +527,9 @@ package body Par_SCO is
-- Logical operators, output table entries and then process
-- operands recursively to deal with nested conditions.
- when N_And_Then |
- N_Or_Else |
- N_Op_Not =>
+ when N_And_Then |
+ N_Or_Else |
+ N_Op_Not =>
declare
T : Character;
@@ -458,15 +546,26 @@ package body Par_SCO is
-- Output header for sequence
- Set_Table_Entry (T, ' ', No_Location, No_Location, False);
+ X_Not_Decision := T = 'X' and then Nkind (N) = N_Op_Not;
+ Mark := SCO_Table.Last;
+ Output_Header (T);
-- Output the decision
Output_Decision_Operand (N);
- -- Change Last in last table entry to True to mark end
+ -- If the decision was in an expression context (T = 'X')
+ -- and contained only NOT operators, then we don't output
+ -- it, so delete it.
+
+ if X_Not_Decision then
+ SCO_Table.Set_Last (Mark);
- SCO_Table.Table (SCO_Table.Last).Last := True;
+ -- Otherwise, set Last in last table entry to mark end
+
+ else
+ SCO_Table.Table (SCO_Table.Last).Last := True;
+ end if;
-- Process any embedded decisions
@@ -474,9 +573,14 @@ package body Par_SCO is
return Skip;
end;
+ -- Case expression
+
+ when N_Case_Expression =>
+ return OK; -- ???
+
-- Conditional expression, processed like an if statement
- when N_Conditional_Expression =>
+ when N_Conditional_Expression =>
declare
Cond : constant Node_Id := First (Expressions (N));
Thnx : constant Node_Id := Next (Cond);
@@ -508,11 +612,12 @@ package body Par_SCO is
-- See if we have simple decision at outer level and if so then
-- generate the decision entry for this simple decision. A simple
-- decision is a boolean expression (which is not a logical operator
- -- or short circuit form) appearing as the operand of an IF, WHILE
- -- or EXIT WHEN construct.
+ -- or short circuit form) appearing as the operand of an IF, WHILE,
+ -- EXIT WHEN, or special PRAGMA construct.
if T /= 'X' and then not Is_Logical_Operator (N) then
- Output_Element (N, T);
+ Output_Header (T);
+ Output_Element (N);
-- Change Last in last table entry to True to mark end of
-- sequence, which is this case is only one element long.
@@ -671,6 +776,9 @@ package body Par_SCO is
if Nkind (Lu) = N_Subprogram_Body then
Traverse_Subprogram_Body (Lu);
+ elsif Nkind (Lu) = N_Subprogram_Declaration then
+ Traverse_Subprogram_Declaration (Lu);
+
elsif Nkind (Lu) = N_Package_Declaration then
Traverse_Package_Declaration (Lu);
@@ -680,12 +788,14 @@ package body Par_SCO is
elsif Nkind (Lu) = N_Generic_Package_Declaration then
Traverse_Generic_Package_Declaration (Lu);
- -- For anything else, the only issue is default expressions for
- -- parameters, where we have to worry about possible embedded decisions
- -- but nothing else.
+ elsif Nkind (Lu) in N_Generic_Instantiation then
+ Traverse_Generic_Instantiation (Lu);
+
+ -- All other cases of compilation units (e.g. renamings), generate
+ -- no SCO information.
else
- Process_Decisions (Lu, 'X');
+ null;
end if;
-- Make entry for new unit in unit tables, we will fill in the file
@@ -704,14 +814,48 @@ package body Par_SCO is
-- Set_SCO_Condition --
-----------------------
- procedure Set_SCO_Condition (First_Loc : Source_Ptr; Typ : Character) is
- Index : constant Nat := Condition_Hash_Table.Get (First_Loc);
+ procedure Set_SCO_Condition (Cond : Node_Id; Val : Boolean) is
+ Orig : constant Node_Id := Original_Node (Cond);
+ Index : Nat;
+ Start : Source_Ptr;
+ Dummy : Source_Ptr;
+
+ Constant_Condition_Code : constant array (Boolean) of Character :=
+ (False => 'f', True => 't');
begin
+ Sloc_Range (Orig, Start, Dummy);
+ Index := Condition_Pragma_Hash_Table.Get (Start);
+
+ -- The test here for zero is to deal with possible previous errors
+
if Index /= 0 then
- SCO_Table.Table (Index).C2 := Typ;
+ pragma Assert (SCO_Table.Table (Index).C1 = ' ');
+ SCO_Table.Table (Index).C2 := Constant_Condition_Code (Val);
end if;
end Set_SCO_Condition;
+ ----------------------------
+ -- Set_SCO_Pragma_Enabled --
+ ----------------------------
+
+ procedure Set_SCO_Pragma_Enabled (Loc : Source_Ptr) is
+ Index : Nat;
+
+ begin
+ -- Note: the reason we use the Sloc value as the key is that in the
+ -- generic case, the call to this procedure is made on a copy of the
+ -- original node, so we can't use the Node_Id value.
+
+ Index := Condition_Pragma_Hash_Table.Get (Loc);
+
+ -- The test here for zero is to deal with possible previous errors
+
+ if Index /= 0 then
+ pragma Assert (SCO_Table.Table (Index).C1 = 'P');
+ SCO_Table.Table (Index).C2 := 'e';
+ end if;
+ end Set_SCO_Pragma_Enabled;
+
---------------------
-- Set_Table_Entry --
---------------------
@@ -756,34 +900,73 @@ package body Par_SCO is
-- Traverse_Declarations_Or_Statements --
-----------------------------------------
+ -- Tables used by Traverse_Declarations_Or_Statements for temporarily
+ -- holding statement and decision entries. These are declared globally
+ -- since they are shared by recursive calls to this procedure.
+
+ type SC_Entry is record
+ From : Source_Ptr;
+ To : Source_Ptr;
+ Typ : Character;
+ end record;
+ -- Used to store a single entry in the following table, From:To represents
+ -- the range of entries in the CS line entry, and typ is the type, with
+ -- space meaning that no type letter will accompany the entry.
+
+ package SC is new Table.Table (
+ Table_Component_Type => SC_Entry,
+ Table_Index_Type => Nat,
+ Table_Low_Bound => 1,
+ Table_Initial => 1000,
+ Table_Increment => 200,
+ Table_Name => "SCO_SC");
+ -- Used to store statement components for a CS entry to be output
+ -- as a result of the call to this procedure. SC.Last is the last
+ -- entry stored, so the current statement sequence is represented
+ -- by SC_Array (SC_First .. SC.Last), where SC_First is saved on
+ -- entry to each recursive call to the routine.
+ --
+ -- Extend_Statement_Sequence adds an entry to this array, and then
+ -- Set_Statement_Entry clears the entries starting with SC_First,
+ -- copying these entries to the main SCO output table. The reason that
+ -- we do the temporary caching of results in this array is that we want
+ -- the SCO table entries for a given CS line to be contiguous, and the
+ -- processing may output intermediate entries such as decision entries.
+
+ type SD_Entry is record
+ Nod : Node_Id;
+ Lst : List_Id;
+ Typ : Character;
+ end record;
+ -- Used to store a single entry in the following table. Nod is the node to
+ -- be searched for decisions for the case of Process_Decisions_Defer with a
+ -- node argument (with Lst set to No_List. Lst is the list to be searched
+ -- for decisions for the case of Process_Decisions_Defer with a List
+ -- argument (in which case Nod is set to Empty).
+
+ package SD is new Table.Table (
+ Table_Component_Type => SD_Entry,
+ Table_Index_Type => Nat,
+ Table_Low_Bound => 1,
+ Table_Initial => 1000,
+ Table_Increment => 200,
+ Table_Name => "SCO_SD");
+ -- Used to store possible decision information. Instead of calling the
+ -- Process_Decisions procedures directly, we call Process_Decisions_Defer,
+ -- which simply stores the arguments in this table. Then when we clear
+ -- out a statement sequence using Set_Statement_Entry, after generating
+ -- the CS lines for the statements, the entries in this table result in
+ -- calls to Process_Decision. The reason for doing things this way is to
+ -- ensure that decisions are output after the CS line for the statements
+ -- in which the decisions occur.
+
procedure Traverse_Declarations_Or_Statements (L : List_Id) is
N : Node_Id;
Dummy : Source_Ptr;
- type SC_Entry is record
- From : Source_Ptr;
- To : Source_Ptr;
- Typ : Character;
- end record;
- -- Used to store a single entry in the following array
-
- SC_Array : array (Nat range 1 .. 10_000) of SC_Entry;
- SC_Last : Nat;
- -- Used to store statement components for a CS entry to be output
- -- as a result of the call to this procedure. SC_Last is the last
- -- entry stored, so the current statement sequence is represented
- -- by SC_Array (1 .. SC_Last). Extend_Statement_Sequence adds an
- -- entry to this array, and Set_Statement_Entry clears it, copying
- -- the entries to the main SCO output table. The reason that we do
- -- the temporary caching of results in this array is that we want
- -- the SCO table entries for a given CS line to be contiguous, and
- -- the processing may output intermediate entries such as decision
- -- entries. Note that the limit of 10_000 here is arbitrary, but does
- -- not cause any trouble, if we encounter more than 10_000 statements
- -- we simply break the current CS sequence at that point, which is
- -- harmless, since this is only used for back annotation and it is
- -- not critical that back annotation always work in all cases. Anyway
- -- exceeding 10,000 statements in a basic block is very unlikely.
+ SC_First : constant Nat := SC.Last + 1;
+ SD_First : constant Nat := SD.Last + 1;
+ -- Record first entries used in SC/SD at this recursive level
procedure Extend_Statement_Sequence (N : Node_Id; Typ : Character);
-- Extend the current statement sequence to encompass the node N. Typ
@@ -806,32 +989,69 @@ package body Par_SCO is
-- called when we find a statement or declaration that generates its
-- own table entry, so that we must end the current statement sequence.
+ 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
+ -- Set_Statement_Entry is called, which goes through the saved entries
+ -- making the corresponding calls to Process_Decision.
+
+ procedure Process_Decisions_Defer (L : List_Id; T : Character);
+ pragma Inline (Process_Decisions_Defer);
+ -- Same case for list arguments, deferred call to Process_Decisions
+
-------------------------
-- Set_Statement_Entry --
-------------------------
procedure Set_Statement_Entry is
- C1 : Character;
+ C1 : Character;
+ SC_Last : constant Int := SC.Last;
+ SD_Last : constant Int := SD.Last;
begin
- if SC_Last /= 0 then
- for J in 1 .. SC_Last loop
- if J = 1 then
- C1 := 'S';
- else
- C1 := 's';
- end if;
+ -- Output statement entries from saved entries in SC table
+ for J in SC_First .. SC_Last loop
+ if J = SC_First then
+ C1 := 'S';
+ else
+ C1 := 's';
+ end if;
+
+ declare
+ SCE : SC_Entry renames SC.Table (J);
+ begin
Set_Table_Entry
(C1 => C1,
- C2 => SC_Array (J).Typ,
- From => SC_Array (J).From,
- To => SC_Array (J).To,
+ C2 => SCE.Typ,
+ From => SCE.From,
+ To => SCE.To,
Last => (J = SC_Last));
- end loop;
+ end;
+ end loop;
- SC_Last := 0;
- end if;
+ -- Clear out used section of SC table
+
+ SC.Set_Last (SC_First - 1);
+
+ -- Output any embedded decisions
+
+ for J in SD_First .. SD_Last loop
+ declare
+ SDE : SD_Entry renames SD.Table (J);
+ begin
+ if Present (SDE.Nod) then
+ Process_Decisions (SDE.Nod, SDE.Typ);
+ else
+ Process_Decisions (SDE.Lst, SDE.Typ);
+ end if;
+ end;
+ end loop;
+
+ -- Clear out used section of SD table
+
+ SD.Set_Last (SD_First - 1);
end Set_Statement_Entry;
-------------------------------
@@ -839,20 +1059,11 @@ package body Par_SCO is
-------------------------------
procedure Extend_Statement_Sequence (N : Node_Id; Typ : Character) is
+ F : Source_Ptr;
+ T : Source_Ptr;
begin
- -- Clear out statement sequence if array full
-
- if SC_Last = SC_Array'Last then
- Set_Statement_Entry;
- else
- SC_Last := SC_Last + 1;
- end if;
-
- -- Record new entry
-
- Sloc_Range
- (N, SC_Array (SC_Last).From, SC_Array (SC_Last).To);
- SC_Array (SC_Last).Typ := Typ;
+ Sloc_Range (N, F, T);
+ SC.Append ((F, T, Typ));
end Extend_Statement_Sequence;
procedure Extend_Statement_Sequence
@@ -860,27 +1071,32 @@ package body Par_SCO is
To : Node_Id;
Typ : Character)
is
+ F : Source_Ptr;
+ T : Source_Ptr;
begin
- -- Clear out statement sequence if array full
+ Sloc_Range (From, F, Dummy);
+ Sloc_Range (To, Dummy, T);
+ SC.Append ((F, T, Typ));
+ end Extend_Statement_Sequence;
- if SC_Last = SC_Array'Last then
- Set_Statement_Entry;
- else
- SC_Last := SC_Last + 1;
- end if;
+ -----------------------------
+ -- Process_Decisions_Defer --
+ -----------------------------
- -- Make new entry
+ procedure Process_Decisions_Defer (N : Node_Id; T : Character) is
+ begin
+ SD.Append ((N, No_List, T));
+ end Process_Decisions_Defer;
- Sloc_Range (From, SC_Array (SC_Last).From, Dummy);
- Sloc_Range (To, Dummy, SC_Array (SC_Last).To);
- SC_Array (SC_Last).Typ := Typ;
- end Extend_Statement_Sequence;
+ procedure Process_Decisions_Defer (L : List_Id; T : Character) is
+ begin
+ SD.Append ((Empty, L, T));
+ end Process_Decisions_Defer;
-- Start of processing for Traverse_Declarations_Or_Statements
begin
if Is_Non_Empty_List (L) then
- SC_Last := 0;
-- Loop through statements or declarations
@@ -915,17 +1131,18 @@ package body Par_SCO is
-- Subprogram declaration
when N_Subprogram_Declaration =>
- Set_Statement_Entry;
- Process_Decisions
+ Process_Decisions_Defer
(Parameter_Specifications (Specification (N)), 'X');
+ Set_Statement_Entry;
-- Generic subprogram declaration
when N_Generic_Subprogram_Declaration =>
- Set_Statement_Entry;
- Process_Decisions (Generic_Formal_Declarations (N), 'X');
- Process_Decisions
+ Process_Decisions_Defer
+ (Generic_Formal_Declarations (N), 'X');
+ Process_Decisions_Defer
(Parameter_Specifications (Specification (N)), 'X');
+ Set_Statement_Entry;
-- Subprogram_Body
@@ -940,8 +1157,8 @@ package body Par_SCO is
when N_Exit_Statement =>
Extend_Statement_Sequence (N, ' ');
+ Process_Decisions_Defer (Condition (N), 'E');
Set_Statement_Entry;
- Process_Decisions (Condition (N), 'E');
-- Label, which breaks the current statement sequence, but the
-- label itself is not included in the next statement sequence,
@@ -963,16 +1180,33 @@ package body Par_SCO is
when N_If_Statement =>
Extend_Statement_Sequence (N, Condition (N), 'I');
+ Process_Decisions_Defer (Condition (N), 'I');
Set_Statement_Entry;
- Process_Decisions (Condition (N), 'I');
+
+ -- Now we traverse the statements in the THEN part
+
Traverse_Declarations_Or_Statements (Then_Statements (N));
+ -- Loop through ELSIF parts if present
+
if Present (Elsif_Parts (N)) then
declare
Elif : Node_Id := First (Elsif_Parts (N));
+
begin
while Present (Elif) loop
- Process_Decisions (Condition (Elif), 'I');
+
+ -- We generate a statement sequence for the
+ -- construct "ELSIF condition", so that we have
+ -- a statement for the resulting decisions.
+
+ Extend_Statement_Sequence
+ (Elif, Condition (Elif), 'I');
+ Process_Decisions_Defer (Condition (Elif), 'I');
+ Set_Statement_Entry;
+
+ -- Traverse the statements in the ELSIF
+
Traverse_Declarations_Or_Statements
(Then_Statements (Elif));
Next (Elif);
@@ -980,6 +1214,8 @@ package body Par_SCO is
end;
end if;
+ -- Finally traverse the ELSE statements if present
+
Traverse_Declarations_Or_Statements (Else_Statements (N));
-- Case statement, which breaks the current statement sequence,
@@ -987,14 +1223,13 @@ package body Par_SCO is
when N_Case_Statement =>
Extend_Statement_Sequence (N, Expression (N), 'C');
+ Process_Decisions_Defer (Expression (N), 'X');
Set_Statement_Entry;
- Process_Decisions (Expression (N), 'X');
-- Process case branches
declare
Alt : Node_Id;
-
begin
Alt := First (Alternatives (N));
while Present (Alt) loop
@@ -1017,22 +1252,17 @@ package body Par_SCO is
when N_Simple_Return_Statement =>
Extend_Statement_Sequence (N, ' ');
+ Process_Decisions_Defer (Expression (N), 'X');
Set_Statement_Entry;
- Process_Decisions (Expression (N), 'X');
-- Extended return statement
when N_Extended_Return_Statement =>
- declare
- Odecl : constant Node_Id :=
- First (Return_Object_Declarations (N));
- begin
- if Present (Expression (Odecl)) then
- Extend_Statement_Sequence
- (N, Expression (Odecl), 'R');
- Process_Decisions (Expression (Odecl), 'X');
- end if;
- end;
+ Extend_Statement_Sequence
+ (N, Last (Return_Object_Declarations (N)), 'R');
+ Process_Decisions_Defer
+ (Return_Object_Declarations (N), 'X');
+ Set_Statement_Entry;
Traverse_Handled_Statement_Sequence
(Handled_Statement_Sequence (N));
@@ -1057,13 +1287,13 @@ package body Par_SCO is
if Present (Condition (ISC)) then
Extend_Statement_Sequence (N, ISC, 'W');
- Process_Decisions (Condition (ISC), 'W');
+ Process_Decisions_Defer (Condition (ISC), 'W');
-- For statement
else
Extend_Statement_Sequence (N, ISC, 'F');
- Process_Decisions
+ Process_Decisions_Defer
(Loop_Parameter_Specification (ISC), 'X');
end if;
end;
@@ -1077,42 +1307,55 @@ package body Par_SCO is
when N_Pragma =>
Extend_Statement_Sequence (N, 'P');
- -- For pragmas Assert, Check, Precondition, and
- -- Postcondition, we generate decision entries for the
- -- condition only if the pragma is enabled. For now, we just
- -- check Assertions_Enabled, which will be set to reflect
- -- the presence of -gnata.
+ -- Processing depends on the kind of pragma
- -- Later we should move processing of the relevant pragmas
- -- to Par_Prag, and properly set the flag Pragma_Enabled at
- -- parse time, so that we can check this flag instead ???
+ case Pragma_Name (N) is
+ when Name_Assert |
+ Name_Check |
+ Name_Precondition |
+ Name_Postcondition =>
- -- For all other pragmas, we always generate decision
- -- entries for any embedded expressions.
+ -- For Assert/Check/Precondition/Postcondition, we
+ -- must generate a P entry for the decision. Note that
+ -- this is done unconditionally at this stage. Output
+ -- for disabled pragmas is suppressed later on, when
+ -- we output the decision line in Put_SCOs.
- declare
- Nam : constant Name_Id :=
- Chars (Pragma_Identifier (N));
- Arg : Node_Id := First (Pragma_Argument_Associations (N));
- begin
- case Nam is
- when Name_Assert |
- Name_Check |
- Name_Precondition |
- Name_Postcondition =>
+ declare
+ Nam : constant Name_Id :=
+ Chars (Pragma_Identifier (N));
+ Arg : Node_Id :=
+ First (Pragma_Argument_Associations (N));
+ begin
if Nam = Name_Check then
Next (Arg);
end if;
- if Assertions_Enabled then
- Process_Decisions (Expression (Arg), 'P');
- end if;
+ Process_Decisions_Defer (Expression (Arg), 'P');
+ end;
- when others =>
- Process_Decisions (N, 'X');
- end case;
- end;
+ -- For all other pragmas, we generate decision entries
+ -- for any embedded expressions.
+
+ when others =>
+ Process_Decisions_Defer (N, 'X');
+ end case;
+
+ -- 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
+ -- Prev_Ids is False.
+
+ when N_Object_Declaration =>
+ if not Prev_Ids (N) then
+ Extend_Statement_Sequence (N, 'o');
+
+ if Has_Decision (N) then
+ Process_Decisions_Defer (N, 'X');
+ end if;
+ end if;
-- All other cases, which extend the current statement sequence
-- but do not terminate it, even if they have nested decisions.
@@ -1135,9 +1378,6 @@ package body Par_SCO is
when N_Subtype_Declaration =>
Typ := 's';
- when N_Object_Declaration =>
- Typ := 'o';
-
when N_Renaming_Declaration =>
Typ := 'r';
@@ -1154,7 +1394,7 @@ package body Par_SCO is
-- Process any embedded decisions
if Has_Decision (N) then
- Process_Decisions (N, 'X');
+ Process_Decisions_Defer (N, 'X');
end if;
end case;
@@ -1165,6 +1405,30 @@ package body Par_SCO is
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);
+
+ -- Now output any embedded decisions
+
+ Process_Decisions (N, 'X');
+ end Traverse_Generic_Instantiation;
+
------------------------------------------
-- Traverse_Generic_Package_Declaration --
------------------------------------------
@@ -1183,7 +1447,6 @@ package body Par_SCO is
Handler : Node_Id;
begin
-
-- For package bodies without a statement part, the parser adds an empty
-- one, to normalize the representation. The null statement therein,
-- which does not come from source, does not get a SCO.
@@ -1232,4 +1495,16 @@ package body Par_SCO is
Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N));
end Traverse_Subprogram_Body;
+ -------------------------------------
+ -- Traverse_Subprogram_Declaration --
+ -------------------------------------
+
+ 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;
+
end Par_SCO;
diff --git a/gcc/ada/par_sco.ads b/gcc/ada/par_sco.ads
index 6cb68a71441..97e4a6a61af 100644
--- a/gcc/ada/par_sco.ads
+++ b/gcc/ada/par_sco.ads
@@ -25,156 +25,12 @@
-- This package contains the routines used to deal with generation and output
-- of Soure Coverage Obligations (SCO's) used for coverage analysis purposes.
+-- See package SCOs for full documentation of format of SCO information.
with Types; use Types;
package Par_SCO is
- ----------------
- -- SCO Format --
- ----------------
-
- -- Source coverage obligations are generated on a unit-by-unit basis in the
- -- ALI file, using lines that start with the identifying character C. These
- -- lines are generated if the -gnatC switch is set.
-
- -- Sloc Ranges
-
- -- In several places in the SCO lines, Sloc ranges appear. These are used
- -- to indicate the first and last Sloc of some construct in the tree and
- -- they have the form:
-
- -- line:col-line:col
-
- -- Note that SCO's are generated only for generic templates, not for
- -- generic instances (since only the first are part of the source). So
- -- we don't need generic instantiation stuff in these line:col items.
-
- -- SCO File headers
-
- -- The SCO information follows the cross-reference information, so it
- -- need not be read by tools like gnatbind, gnatmake etc. The SCO output
- -- is divided into sections, one section for each unit for which SCO's
- -- are generated. A SCO section has a header of the form:
-
- -- C dependency-number filename
-
- -- This header precedes SCO information for the unit identified by
- -- dependency number and file name. The dependency number is the
- -- index into the generated D lines and is ones origin (i.e. 2 =
- -- reference to second generated D line).
-
- -- Note that the filename here will reflect the original name if
- -- a Source_Reference pragma was encountered (since all line number
- -- references will be with respect to the original file).
-
- -- Statements
-
- -- For the purpose of SCO generation, the notion of statement includes
- -- simple statements and also the following declaration types:
-
- -- type_declaration
- -- subtype_declaration
- -- object_declaration
- -- renaming_declaration
- -- generic_instantiation
-
- -- Statement lines
-
- -- These lines correspond to a sequence of one or more statements which
- -- are always exeecuted in sequence, The first statement may be an entry
- -- point (e.g. statement after a label), and the last statement may be
- -- an exit point (e.g. an exit statement), but no other entry or exit
- -- points may occur within the sequence of statements. The idea is that
- -- the sequence can be treated as a single unit from a coverage point of
- -- view, if any of the code for the statement sequence is executed, this
- -- corresponds to coverage of the entire statement sequence. The form of
- -- a statement line in the ALI file is:
-
- -- CS sloc-range
-
- -- Exit points
-
- -- An exit point is a statement that causes transfer of control. Examples
- -- are exit statements, raise statements and return statements. The form
- -- of an exit point in the ALI file is:
-
- -- CT sloc-range
-
- -- Decisions
-
- -- Decisions represent the most significant section of the SCO lines
-
- -- Note: in the following description, logical operator includes the
- -- short circuited forms (so can be any of AND, OR, XOR, NOT, AND THEN,
- -- or OR ELSE).
-
- -- Decisions are either simple or complex. A simple decision is a boolean
- -- expresssion that occurs in the context of a control structure in the
- -- source program, including WHILE, IF, EXIT WHEN. Note that a boolean
- -- expression in any other context, e.g. on the right side of an
- -- assignment, is not considered to be a decision.
-
- -- A complex decision is an occurrence of a logical operator which is not
- -- itself an operand of some other logical operator. If any operand of
- -- the logical operator is itself a logical operator, this is not a
- -- separate decision, it is part of the same decision.
-
- -- So for example, if we have
-
- -- A, B, C, D : Boolean;
- -- function F (Arg : Boolean) return Boolean);
- -- ...
- -- A and then (B or else F (C and then D))
-
- -- There are two (complex) decisions here:
-
- -- 1. X and then (Y or else Z)
-
- -- where X = A, Y = B, and Z = F (C and then D)
-
- -- 2. C and then D
-
- -- For each decision, a decision line is generated with the form:
-
- -- C* expression
-
- -- Here * is one of the following characters:
-
- -- I decision in IF statement or conditional expression
- -- E decision in EXIT WHEN statement
- -- W decision in WHILE iteration scheme
- -- X decision appearing in some other expression context
-
- -- The expression is a prefix polish form indicating the structure of
- -- the decision, including logical operators and short circuit forms.
- -- The following is a grammar showing the structure of expression:
-
- -- expression ::= term (if expr is not logical operator)
- -- expression ::= & term term (if expr is AND THEN)
- -- expression ::= | term term (if expr is OR ELSE)
- -- expression ::= !term (if expr is NOT)
-
- -- term ::= element
- -- term ::= expression
-
- -- element ::= outcome sloc-range
-
- -- outcome is one of the following letters:
-
- -- c condition
- -- t true condition
- -- f false condition
-
- -- where t/f are used to mark a condition that has been recognized by
- -- the compiler as always being true or false.
-
- -- & indicates either AND THEN connecting two conditions
-
- -- | indicates either OR ELSE connection two conditions
-
- -- ! indicates NOT applied to the expression
-
-----------------
-- Subprograms --
-----------------
@@ -187,11 +43,19 @@ package Par_SCO is
-- internal tables recording the SCO information. Note that this is done
-- before any semantic analysis/expansion happens.
- procedure Set_SCO_Condition (First_Loc : Source_Ptr; Typ : Character);
+ procedure Set_SCO_Condition (Cond : Node_Id; Val : Boolean);
-- This procedure is called during semantic analysis to record a condition
- -- which has been identified as always True (Typ = 't') or always False
- -- (Typ = 'f') by the compiler. The condition is identified by the
- -- First_Sloc value in the original tree.
+ -- which has been identified as always True or always False, as indicated
+ -- by Val. The condition is identified by the First_Sloc value in the
+ -- original tree associated with Cond.
+
+ procedure Set_SCO_Pragma_Enabled (Loc : Source_Ptr);
+ -- This procedure is called from Sem_Prag when a pragma is enabled (i.e.
+ -- when the Pragma_Enabled flag is set). Loc is the Sloc of the N_Pragma
+ -- node. This is used to enable the corresponding SCO table entry. Note
+ -- that we use the Sloc as the key here, since in the generic case, the
+ -- analysis is on a copy of the node, which is different from the node
+ -- seen by Par_SCO in the parse tree (but the Sloc values are the same).
procedure SCO_Output;
-- Outputs SCO lines for all units, with appropriate section headers, for
@@ -199,8 +63,8 @@ package Par_SCO is
-- possibly modified by calls to Set_SCO_Condition.
procedure dsco;
- -- Debug routine to dump SCO table. This is a raw format dump showing
- -- exactly what the tables contain.
+ -- Debug routine to dump internal SCO table. This is a raw format dump
+ -- showing exactly what the table contains.
procedure pscos;
-- Debugging procedure to output contents of SCO binary tables in the
diff --git a/gcc/ada/prep.adb b/gcc/ada/prep.adb
index 9a76dc94730..2fb64cc614d 100644
--- a/gcc/ada/prep.adb
+++ b/gcc/ada/prep.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2010, 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- --
@@ -411,7 +411,8 @@ package body Prep is
Scan.all;
else
- Error_Msg ("`)` expected", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("`)` expected", Token_Ptr);
end if;
when Tok_Not =>
@@ -906,7 +907,8 @@ package body Prep is
Scan.all;
if Token /= Tok_Colon_Equal then
- Error_Msg ("`:=` expected", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("`:=` expected", Token_Ptr);
goto Cleanup;
end if;
@@ -1219,7 +1221,8 @@ package body Prep is
elsif
Pp_States.Table (Pp_States.Last).Else_Ptr /= 0
then
- Error_Msg ("duplicate ELSE line", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("duplicate ELSE line", Token_Ptr);
No_Error_Found := False;
end if;
@@ -1269,14 +1272,16 @@ package body Prep is
Scan.all;
if Token /= Tok_If then
- Error_Msg ("IF expected", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("IF expected", Token_Ptr);
No_Error_Found := False;
else
Scan.all;
if Token /= Tok_Semicolon then
- Error_Msg ("`;` Expected", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("`;` Expected", Token_Ptr);
No_Error_Found := False;
else
@@ -1312,13 +1317,15 @@ package body Prep is
No_Error_Found := False;
if Pp_States.Last = 0 then
- Error_Msg ("IF expected", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("IF expected", Token_Ptr);
elsif
Pp_States.Table (Pp_States.Last).Else_Ptr = 0
then
- Error_Msg ("IF, ELSIF, ELSE, or `END IF` expected",
- Token_Ptr);
+ Error_Msg
+ ("IF, ELSIF, ELSE, or `END IF` expected",
+ Token_Ptr);
else
Error_Msg ("IF or `END IF` expected", Token_Ptr);
diff --git a/gcc/ada/prepcomp.adb b/gcc/ada/prepcomp.adb
index ad14fc5e164..e36d59944ca 100644
--- a/gcc/ada/prepcomp.adb
+++ b/gcc/ada/prepcomp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2010, 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- --
@@ -342,7 +342,8 @@ package body Prepcomp is
while Token /= Tok_End_Of_Line and then Token /= Tok_EOF loop
if Token /= Tok_Minus then
- Error_Msg ("`'-` expected", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("`'-` expected", Token_Ptr);
Skip_To_End_Of_Line;
goto Scan_Line;
end if;
@@ -463,7 +464,8 @@ package body Prepcomp is
Scan;
if Token /= Tok_Equal then
- Error_Msg ("`=` expected", Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("`=` expected", Token_Ptr);
Skip_To_End_Of_Line;
goto Scan_Line;
end if;
diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb
index d143a504a84..2e9255c47d2 100644
--- a/gcc/ada/prj-attr.adb
+++ b/gcc/ada/prj-attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -71,7 +71,6 @@ package body Prj.Attr is
"SVRproject_dir#" &
"lVmain#" &
"LVlanguages#" &
- "SVmain_language#" &
"Lbroots#" &
"SVexternally_built#" &
diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb
index dfebd9a5d49..7ffa8d52b94 100644
--- a/gcc/ada/prj-conf.adb
+++ b/gcc/ada/prj-conf.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2006-2010, 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- --
@@ -23,23 +23,25 @@
-- --
------------------------------------------------------------------------------
-with Ada.Directories; use Ada.Directories;
-with GNAT.HTable; use GNAT.HTable;
-with Makeutl; use Makeutl;
+with Hostparm;
+with Makeutl; use Makeutl;
with MLib.Tgt;
-with Opt; use Opt;
-with Output; use Output;
+with Opt; use Opt;
+with Output; use Output;
with Prj.Env;
with Prj.Err;
with Prj.Part;
with Prj.PP;
-with Prj.Proc; use Prj.Proc;
-with Prj.Tree; use Prj.Tree;
-with Prj.Util; use Prj.Util;
-with Prj; use Prj;
-with Snames; use Snames;
-with System.Case_Util; use System.Case_Util;
-with System;
+with Prj.Proc; use Prj.Proc;
+with Prj.Tree; use Prj.Tree;
+with Prj.Util; use Prj.Util;
+with Prj; use Prj;
+with Snames; use Snames;
+
+with Ada.Directories; use Ada.Directories;
+
+with GNAT.Case_Util; use GNAT.Case_Util;
+with GNAT.HTable; use GNAT.HTable;
package body Prj.Conf is
@@ -889,8 +891,18 @@ package body Prj.Conf is
<<Process_Config_File>>
if Automatically_Generated then
- -- This might raise an Invalid_Config exception
- Do_Autoconf;
+ if Hostparm.OpenVMS then
+
+ -- There is no gprconfig on VMS
+
+ raise Invalid_Config
+ with "could not locate any configuration project file";
+
+ else
+ -- This might raise an Invalid_Config exception
+
+ Do_Autoconf;
+ end if;
end if;
-- Parse the configuration file
diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb
index f7fc668dd8f..39bda01987e 100644
--- a/gcc/ada/prj-env.adb
+++ b/gcc/ada/prj-env.adb
@@ -1498,7 +1498,9 @@ package body Prj.Env is
procedure Set_Ada_Paths
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Including_Libraries : Boolean)
+ Including_Libraries : Boolean;
+ Include_Path : Boolean := True;
+ Objects_Path : Boolean := True)
is
Source_Paths : Source_Path_Table.Instance;
@@ -1570,7 +1572,7 @@ package body Prj.Env is
-- If it is the first time we call this procedure for this project,
-- compute the source path and/or the object path.
- if Project.Include_Path_File = No_Path then
+ if Include_Path and then Project.Include_Path_File = No_Path then
Source_Path_Table.Init (Source_Paths);
Process_Source_Dirs := True;
Create_New_Path_File
@@ -1580,7 +1582,7 @@ package body Prj.Env is
-- For the object path, we make a distinction depending on
-- Including_Libraries.
- if Including_Libraries then
+ if Objects_Path and Including_Libraries then
if Project.Objects_Path_File_With_Libs = No_Path then
Object_Path_Table.Init (Object_Paths);
Process_Object_Dirs := True;
@@ -1588,7 +1590,7 @@ package body Prj.Env is
(In_Tree, Object_FD, Project.Objects_Path_File_With_Libs);
end if;
- else
+ elsif Objects_Path then
if Project.Objects_Path_File_Without_Libs = No_Path then
Object_Path_Table.Init (Object_Paths);
Process_Object_Dirs := True;
@@ -1662,7 +1664,8 @@ package body Prj.Env is
-- Set the env vars, if they need to be changed, and set the
-- corresponding flags.
- if In_Tree.Private_Part.Current_Source_Path_File /=
+ if Include_Path and then
+ In_Tree.Private_Part.Current_Source_Path_File /=
Project.Include_Path_File
then
In_Tree.Private_Part.Current_Source_Path_File :=
@@ -1672,28 +1675,30 @@ package body Prj.Env is
Get_Name_String (In_Tree.Private_Part.Current_Source_Path_File));
end if;
- if Including_Libraries then
- if In_Tree.Private_Part.Current_Object_Path_File /=
- Project.Objects_Path_File_With_Libs
- then
- In_Tree.Private_Part.Current_Object_Path_File :=
- Project.Objects_Path_File_With_Libs;
- Set_Path_File_Var
- (Project_Objects_Path_File,
- Get_Name_String
- (In_Tree.Private_Part.Current_Object_Path_File));
- end if;
+ if Objects_Path then
+ if Including_Libraries then
+ if In_Tree.Private_Part.Current_Object_Path_File /=
+ Project.Objects_Path_File_With_Libs
+ then
+ In_Tree.Private_Part.Current_Object_Path_File :=
+ Project.Objects_Path_File_With_Libs;
+ Set_Path_File_Var
+ (Project_Objects_Path_File,
+ Get_Name_String
+ (In_Tree.Private_Part.Current_Object_Path_File));
+ end if;
- else
- if In_Tree.Private_Part.Current_Object_Path_File /=
- Project.Objects_Path_File_Without_Libs
- then
- In_Tree.Private_Part.Current_Object_Path_File :=
- Project.Objects_Path_File_Without_Libs;
- Set_Path_File_Var
- (Project_Objects_Path_File,
- Get_Name_String
- (In_Tree.Private_Part.Current_Object_Path_File));
+ else
+ if In_Tree.Private_Part.Current_Object_Path_File /=
+ Project.Objects_Path_File_Without_Libs
+ then
+ In_Tree.Private_Part.Current_Object_Path_File :=
+ Project.Objects_Path_File_Without_Libs;
+ Set_Path_File_Var
+ (Project_Objects_Path_File,
+ Get_Name_String
+ (In_Tree.Private_Part.Current_Object_Path_File));
+ end if;
end if;
end if;
diff --git a/gcc/ada/prj-env.ads b/gcc/ada/prj-env.ads
index 27259c29b98..9dcde328038 100644
--- a/gcc/ada/prj-env.ads
+++ b/gcc/ada/prj-env.ads
@@ -94,7 +94,9 @@ package Prj.Env is
procedure Set_Ada_Paths
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Including_Libraries : Boolean);
+ Including_Libraries : Boolean;
+ Include_Path : Boolean := True;
+ Objects_Path : Boolean := True);
-- Set the environment variables for additional project path files, after
-- creating the path files if necessary.
diff --git a/gcc/ada/prj-ext.adb b/gcc/ada/prj-ext.adb
index fe6216f82fa..51da2a3e82c 100644
--- a/gcc/ada/prj-ext.adb
+++ b/gcc/ada/prj-ext.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2010, 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- --
@@ -23,7 +23,6 @@
-- --
------------------------------------------------------------------------------
-with System.OS_Lib; use System.OS_Lib;
with Hostparm;
with Makeutl; use Makeutl;
with Opt;
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index ca6a732ac76..b502b2aebc9 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2010, 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- --
@@ -26,6 +26,7 @@
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.Dynamic_HTables;
+with GNAT.Table;
with Err_Vars; use Err_Vars;
with Opt; use Opt;
@@ -54,10 +55,17 @@ package body Prj.Nmsc is
Name : File_Name_Type; -- ??? duplicates the key
Location : Source_Ptr;
Source : Source_Id := No_Source;
+ Listed : Boolean := False;
Found : Boolean := False;
end record;
+
No_Name_Location : constant Name_Location :=
- (No_File, No_Location, No_Source, False);
+ (Name => No_File,
+ Location => No_Location,
+ Source => No_Source,
+ Listed => False,
+ Found => False);
+
package Source_Names_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Name_Location,
@@ -65,11 +73,10 @@ package body Prj.Nmsc is
Key => File_Name_Type,
Hash => Hash,
Equal => "=");
- -- Information about file names found in string list attribute
- -- (Source_Files or Source_List_File).
- -- Except is set to True if source is a naming exception in the project.
- -- This is used to check that all referenced files were indeed found on the
- -- disk.
+ -- File name information found in string list attribute (Source_Files or
+ -- Source_List_File). Except is set to True if source is a naming exception
+ -- in the project. Used to check that all referenced files were indeed
+ -- found on the disk.
type Unit_Exception is record
Name : Name_Id; -- ??? duplicates the key
@@ -151,6 +158,20 @@ package body Prj.Nmsc is
-- This data must be initialized before processing any project, and the
-- same data is used for processing all projects in the tree.
+ type Lib_Data is record
+ Name : Name_Id;
+ Proj : Project_Id;
+ end record;
+
+ package Lib_Data_Table is new GNAT.Table
+ (Table_Component_Type => Lib_Data,
+ Table_Index_Type => Natural,
+ Table_Low_Bound => 1,
+ Table_Initial => 10,
+ Table_Increment => 100);
+ -- A table to record library names in order to check that two library
+ -- projects do not have the same library names.
+
procedure Initialize
(Data : out Tree_Processing_Data;
Tree : Project_Tree_Ref;
@@ -234,13 +255,9 @@ package body Prj.Nmsc is
procedure Check_Package_Naming
(Project : Project_Id;
- Data : in out Tree_Processing_Data;
- Bodies : out Array_Element_Id;
- Specs : out Array_Element_Id);
+ Data : in out Tree_Processing_Data);
-- Check the naming scheme part of Data, and initialize the naming scheme
- -- data in the config of the various languages. This also returns the
- -- naming scheme exceptions for unit-based languages (Bodies and Specs are
- -- associative arrays mapping individual unit names to source file names).
+ -- data in the config of the various languages.
procedure Check_Configuration
(Project : Project_Id;
@@ -298,6 +315,7 @@ package body Prj.Nmsc is
Data : in out Tree_Processing_Data;
Source_Dir_Rank : Natural;
Path : Path_Name_Type;
+ Display_Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
Locally_Removed : Boolean;
@@ -307,11 +325,12 @@ package body Prj.Nmsc is
-- schemes, it is added to various htables through Add_Source and to
-- Source_Paths_Htable.
--
- -- Name is the name of the candidate file. It hasn't been normalized yet
- -- and is the direct result of readdir().
+ -- File_Name is the same as Display_File_Name, but has been normalized.
+ -- They do not include the directory information.
--
- -- File_Name is the same as Name, but has been normalized.
- -- Display_File_Name, however, has not been normalized.
+ -- Path and Display_Path on the other hand are the full path to the file.
+ -- Path must have been normalized (canonical casing and possibly links
+ -- resolved).
--
-- Source_Directory is the directory in which the file was found. It is
-- neither normalized nor has had links resolved, and must not end with a
@@ -448,6 +467,32 @@ package body Prj.Nmsc is
-- Debug print a value for a specific property. Does nothing when not in
-- debug mode
+ procedure Error_Or_Warning
+ (Flags : Processing_Flags;
+ Kind : Error_Warning;
+ Msg : String;
+ Location : Source_Ptr;
+ Project : Project_Id);
+ -- Emits either an error or warning message (or nothing), depending on Kind
+
+ ----------------------
+ -- Error_Or_Warning --
+ ----------------------
+
+ procedure Error_Or_Warning
+ (Flags : Processing_Flags;
+ Kind : Error_Warning;
+ Msg : String;
+ Location : Source_Ptr;
+ Project : Project_Id) is
+ begin
+ case Kind is
+ when Error => Error_Msg (Flags, Msg, Location, Project);
+ when Warning => Error_Msg (Flags, "?" & Msg, Location, Project);
+ when Silent => null;
+ end case;
+ end Error_Or_Warning;
+
------------------------------
-- Replace_Into_Name_Buffer --
------------------------------
@@ -701,7 +746,7 @@ package body Prj.Nmsc is
if Current_Verbosity = High then
Write_Str ("Adding source File: ");
- Write_Str (Get_Name_String (File_Name));
+ Write_Str (Get_Name_String (Display_File));
if Index /= 0 then
Write_Str (" at" & Index'Img);
@@ -725,6 +770,7 @@ package body Prj.Nmsc is
end if;
Id.Project := Project;
+ Id.Location := Location;
Id.Source_Dir_Rank := Source_Dir_Rank;
Id.Language := Lang_Id;
Id.Kind := Kind;
@@ -736,6 +782,9 @@ package body Prj.Nmsc is
Id.Dep_Name := Dependency_Name
(File_Name, Lang_Id.Config.Dependency_Kind);
Id.Naming_Exception := Naming_Exception;
+ Id.Object := Object_Name
+ (File_Name, Config.Object_File_Suffix);
+ Id.Switches := Switches_Name (File_Name);
-- Add the source id to the Unit_Sources_HT hash table, if the unit name
-- is not null.
@@ -767,11 +816,6 @@ package body Prj.Nmsc is
Override_Kind (Id, Kind);
end if;
- if Is_Compilable (Id) and then Config.Object_Generated then
- Id.Object := Object_Name (File_Name, Config.Object_File_Suffix);
- Id.Switches := Switches_Name (File_Name);
- end if;
-
if Path /= No_Path_Information then
Id.Path := Path;
Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, Path.Name, Id);
@@ -813,11 +857,9 @@ package body Prj.Nmsc is
-----------
procedure Check
- (Project : Project_Id;
- Data : in out Tree_Processing_Data)
+ (Project : Project_Id;
+ Data : in out Tree_Processing_Data)
is
- Specs : Array_Element_Id;
- Bodies : Array_Element_Id;
Extending : Boolean := False;
Prj_Data : Project_Processing_Data;
@@ -889,7 +931,7 @@ package body Prj.Nmsc is
Extending := Project.Extends /= No_Project;
- Check_Package_Naming (Project, Data, Bodies => Bodies, Specs => Specs);
+ Check_Package_Naming (Project, Data);
-- Find the sources
@@ -1838,6 +1880,9 @@ package body Prj.Nmsc is
elsif Name = Name_Gnu then
Project.Config.Resp_File_Format := GNU;
+ elsif Name_Buffer (1 .. Name_Len) = "gcc" then
+ Project.Config.Resp_File_Format := GCC;
+
elsif Name = Name_Object_List then
Project.Config.Resp_File_Format := Object_List;
@@ -2719,9 +2764,7 @@ package body Prj.Nmsc is
procedure Check_Package_Naming
(Project : Project_Id;
- Data : in out Tree_Processing_Data;
- Bodies : out Array_Element_Id;
- Specs : out Array_Element_Id)
+ Data : in out Tree_Processing_Data)
is
Naming_Id : constant Package_Id :=
Util.Value_Of
@@ -2954,7 +2997,8 @@ package body Prj.Nmsc is
Kind => Kind,
File_Name => File_Name,
Display_File => File_Name_Type (Element.Value),
- Naming_Exception => True);
+ Naming_Exception => True,
+ Location => Element.Location);
else
-- Check if the file name is already recorded for another
@@ -3377,9 +3421,6 @@ package body Prj.Nmsc is
-- Start of processing for Check_Naming_Schemes
begin
- Specs := No_Array_Element;
- Bodies := No_Array_Element;
-
-- No Naming package or parsing a configuration file? nothing to do
if Naming_Id /= No_Package
@@ -3633,99 +3674,103 @@ package body Prj.Nmsc is
"library directory { does not exist",
Lib_Dir.Location, Project);
+ elsif not Project.Externally_Built then
+
-- The library directory cannot be the same as the Object
-- directory.
- elsif Project.Library_Dir.Name = Project.Object_Directory.Name then
- Error_Msg
- (Data.Flags,
- "library directory cannot be the same " &
- "as object directory",
- Lib_Dir.Location, Project);
- Project.Library_Dir := No_Path_Information;
-
- else
- declare
- OK : Boolean := True;
- Dirs_Id : String_List_Id;
- Dir_Elem : String_Element;
- Pid : Project_List;
-
- begin
- -- The library directory cannot be the same as a source
- -- directory of the current project.
-
- Dirs_Id := Project.Source_Dirs;
- while Dirs_Id /= Nil_String loop
- Dir_Elem := Data.Tree.String_Elements.Table (Dirs_Id);
- Dirs_Id := Dir_Elem.Next;
-
- if Project.Library_Dir.Name =
- Path_Name_Type (Dir_Elem.Value)
- then
- Err_Vars.Error_Msg_File_1 :=
- File_Name_Type (Dir_Elem.Value);
- Error_Msg
- (Data.Flags,
- "library directory cannot be the same " &
- "as source directory {",
- Lib_Dir.Location, Project);
- OK := False;
- exit;
- end if;
- end loop;
+ if Project.Library_Dir.Name = Project.Object_Directory.Name then
+ Error_Msg
+ (Data.Flags,
+ "library directory cannot be the same " &
+ "as object directory",
+ Lib_Dir.Location, Project);
+ Project.Library_Dir := No_Path_Information;
- if OK then
+ else
+ declare
+ OK : Boolean := True;
+ Dirs_Id : String_List_Id;
+ Dir_Elem : String_Element;
+ Pid : Project_List;
+ begin
-- The library directory cannot be the same as a source
- -- directory of another project either.
+ -- directory of the current project.
- Pid := Data.Tree.Projects;
- Project_Loop : loop
- exit Project_Loop when Pid = null;
+ Dirs_Id := Project.Source_Dirs;
+ while Dirs_Id /= Nil_String loop
+ Dir_Elem := Data.Tree.String_Elements.Table (Dirs_Id);
+ Dirs_Id := Dir_Elem.Next;
- if Pid.Project /= Project then
- Dirs_Id := Pid.Project.Source_Dirs;
+ if Project.Library_Dir.Name =
+ Path_Name_Type (Dir_Elem.Value)
+ then
+ Err_Vars.Error_Msg_File_1 :=
+ File_Name_Type (Dir_Elem.Value);
+ Error_Msg
+ (Data.Flags,
+ "library directory cannot be the same " &
+ "as source directory {",
+ Lib_Dir.Location, Project);
+ OK := False;
+ exit;
+ end if;
+ end loop;
- Dir_Loop : while Dirs_Id /= Nil_String loop
- Dir_Elem :=
- Data.Tree.String_Elements.Table (Dirs_Id);
- Dirs_Id := Dir_Elem.Next;
+ if OK then
- if Project.Library_Dir.Name =
- Path_Name_Type (Dir_Elem.Value)
- then
- Err_Vars.Error_Msg_File_1 :=
- File_Name_Type (Dir_Elem.Value);
- Err_Vars.Error_Msg_Name_1 := Pid.Project.Name;
+ -- The library directory cannot be the same as a
+ -- source directory of another project either.
- Error_Msg
- (Data.Flags,
- "library directory cannot be the same " &
- "as source directory { of project %%",
- Lib_Dir.Location, Project);
- OK := False;
- exit Project_Loop;
- end if;
- end loop Dir_Loop;
- end if;
+ Pid := Data.Tree.Projects;
+ Project_Loop : loop
+ exit Project_Loop when Pid = null;
- Pid := Pid.Next;
- end loop Project_Loop;
- end if;
+ if Pid.Project /= Project then
+ Dirs_Id := Pid.Project.Source_Dirs;
+
+ Dir_Loop : while Dirs_Id /= Nil_String loop
+ Dir_Elem :=
+ Data.Tree.String_Elements.Table (Dirs_Id);
+ Dirs_Id := Dir_Elem.Next;
+
+ if Project.Library_Dir.Name =
+ Path_Name_Type (Dir_Elem.Value)
+ then
+ Err_Vars.Error_Msg_File_1 :=
+ File_Name_Type (Dir_Elem.Value);
+ Err_Vars.Error_Msg_Name_1 :=
+ Pid.Project.Name;
+
+ Error_Msg
+ (Data.Flags,
+ "library directory cannot be the same" &
+ " as source directory { of project %%",
+ Lib_Dir.Location, Project);
+ OK := False;
+ exit Project_Loop;
+ end if;
+ end loop Dir_Loop;
+ end if;
- if not OK then
- Project.Library_Dir := No_Path_Information;
+ Pid := Pid.Next;
+ end loop Project_Loop;
+ end if;
- elsif Current_Verbosity = High then
+ if not OK then
+ Project.Library_Dir := No_Path_Information;
- -- Display the Library directory in high verbosity
+ elsif Current_Verbosity = High then
- Write_Attr
- ("Library directory",
- Get_Name_String (Project.Library_Dir.Display_Name));
- end if;
- end;
+ -- Display the Library directory in high verbosity
+
+ Write_Attr
+ ("Library directory",
+ Get_Name_String (Project.Library_Dir.Display_Name));
+ end if;
+ end;
+ end if;
end if;
end if;
@@ -3813,8 +3858,9 @@ package body Prj.Nmsc is
Lib_ALI_Dir.Location, Project);
end if;
- if Project.Library_ALI_Dir /= Project.Library_Dir then
-
+ if (not Project.Externally_Built) and then
+ Project.Library_ALI_Dir /= Project.Library_Dir
+ then
-- The library ALI directory cannot be the same as the
-- Object directory.
@@ -4078,9 +4124,46 @@ package body Prj.Nmsc is
end;
end if;
- if Project.Extends /= No_Project then
+ if Project.Extends /= No_Project and then Project.Extends.Library then
+
+ -- Remove the library name from Lib_Data_Table
+
+ for J in 1 .. Lib_Data_Table.Last loop
+ if Lib_Data_Table.Table (J).Proj = Project.Extends then
+ Lib_Data_Table.Table (J) :=
+ Lib_Data_Table.Table (Lib_Data_Table.Last);
+ Lib_Data_Table.Set_Last (Lib_Data_Table.Last - 1);
+ exit;
+ end if;
+ end loop;
+
Project.Extends.Library := False;
end if;
+
+ if Project.Library and then not Lib_Name.Default then
+
+ -- Check if the same library name is used in an other library project
+
+ for J in 1 .. Lib_Data_Table.Last loop
+ if Lib_Data_Table.Table (J).Name = Project.Library_Name then
+ Error_Msg_Name_1 := Lib_Data_Table.Table (J).Proj.Name;
+ Error_Msg
+ (Data.Flags,
+ "Library name cannot be the same as in project %%",
+ Lib_Name.Location, Project);
+ Project.Library := False;
+ exit;
+ end if;
+ end loop;
+ end if;
+
+ if Project.Library then
+
+ -- Record the library name
+
+ Lib_Data_Table.Append
+ ((Name => Project.Library_Name, Proj => Project));
+ end if;
end Check_Library_Attributes;
---------------------------------
@@ -4780,14 +4863,14 @@ package body Prj.Nmsc is
---------------------
procedure Get_Directories
- (Project : Project_Id;
- Data : in out Tree_Processing_Data)
+ (Project : Project_Id;
+ Data : in out Tree_Processing_Data)
is
package Recursive_Dirs is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Boolean,
No_Element => False,
- Key => Name_Id,
+ Key => Path_Name_Type,
Hash => Hash,
Equal => "=");
-- Hash table stores recursive source directories, to avoid looking
@@ -4834,123 +4917,127 @@ package body Prj.Nmsc is
-- Find one or several source directories, and add (or remove, if
-- Removed is True) them to list of source directories of the project.
- ----------------------
- -- Find_Source_Dirs --
- ----------------------
-
- procedure Find_Source_Dirs
- (From : File_Name_Type;
- Location : Source_Ptr;
- Rank : Natural;
- Removed : Boolean := False)
+ procedure Add_To_Or_Remove_From_Source_Dirs
+ (Path_Id : Path_Name_Type;
+ Display_Path_Id : Path_Name_Type;
+ Rank : Natural;
+ Removed : Boolean);
+ -- When Removed = False, the directory Path_Id to the list of
+ -- source_dirs if not already in the list. When Removed = True,
+ -- removed directory Path_Id if in the list.
+
+ ---------------------------------------
+ -- Add_To_Or_Remove_From_Source_Dirs --
+ ---------------------------------------
+
+ procedure Add_To_Or_Remove_From_Source_Dirs
+ (Path_Id : Path_Name_Type;
+ Display_Path_Id : Path_Name_Type;
+ Rank : Natural;
+ Removed : Boolean)
is
- Directory : constant String := Get_Name_String (From);
+ List : String_List_Id;
+ Prev : String_List_Id;
+ Rank_List : Number_List_Index;
+ Prev_Rank : Number_List_Index;
+ Element : String_Element;
- procedure Add_To_Or_Remove_From_List
- (Path_Id : Name_Id;
- Display_Path_Id : Name_Id);
- -- When Removed = False, the directory Path_Id to the list of
- -- source_dirs if not already in the list. When Removed = True,
- -- removed directory Path_Id if in the list.
+ begin
+ Prev := Nil_String;
+ Prev_Rank := No_Number_List;
+ List := Project.Source_Dirs;
+ Rank_List := Project.Source_Dir_Ranks;
+ while List /= Nil_String loop
+ Element := Data.Tree.String_Elements.Table (List);
+ exit when Element.Value = Name_Id (Path_Id);
+ Prev := List;
+ List := Element.Next;
+ Prev_Rank := Rank_List;
+ Rank_List := Data.Tree.Number_Lists.Table (Prev_Rank).Next;
+ end loop;
- procedure Recursive_Find_Dirs (Path : Name_Id);
- -- Find all the subdirectories (recursively) of Path and add them
- -- to the list of source directories of the project.
+ -- The directory is in the list if List is not Nil_String
- --------------------------------
- -- Add_To_Or_Remove_From_List --
- --------------------------------
-
- procedure Add_To_Or_Remove_From_List
- (Path_Id : Name_Id;
- Display_Path_Id : Name_Id)
- is
- List : String_List_Id;
- Prev : String_List_Id;
- Rank_List : Number_List_Index;
- Prev_Rank : Number_List_Index;
- Element : String_Element;
+ if not Removed and then List = Nil_String then
+ if Current_Verbosity = High then
+ Write_Str (" Adding Source Dir=");
+ Write_Line (Get_Name_String (Display_Path_Id));
+ end if;
- begin
- Prev := Nil_String;
- Prev_Rank := No_Number_List;
- List := Project.Source_Dirs;
- Rank_List := Project.Source_Dir_Ranks;
- while List /= Nil_String loop
- Element := Data.Tree.String_Elements.Table (List);
- exit when Element.Value = Path_Id;
- Prev := List;
- List := Element.Next;
- Prev_Rank := Rank_List;
- Rank_List := Data.Tree.Number_Lists.Table (Prev_Rank).Next;
- end loop;
+ String_Element_Table.Increment_Last (Data.Tree.String_Elements);
+ Element :=
+ (Value => Name_Id (Path_Id),
+ Index => 0,
+ Display_Value => Name_Id (Display_Path_Id),
+ Location => No_Location,
+ Flag => False,
+ Next => Nil_String);
- -- The directory is in the list if List is not Nil_String
+ Number_List_Table.Increment_Last (Data.Tree.Number_Lists);
- if not Removed and then List = Nil_String then
- if Current_Verbosity = High then
- Write_Str (" Adding Source Dir=");
- Write_Line (Get_Name_String (Path_Id));
- end if;
+ if Last_Source_Dir = Nil_String then
- String_Element_Table.Increment_Last (Data.Tree.String_Elements);
- Element :=
- (Value => Path_Id,
- Index => 0,
- Display_Value => Display_Path_Id,
- Location => No_Location,
- Flag => False,
- Next => Nil_String);
+ -- This is the first source directory
- Number_List_Table.Increment_Last (Data.Tree.Number_Lists);
+ Project.Source_Dirs :=
+ String_Element_Table.Last (Data.Tree.String_Elements);
+ Project.Source_Dir_Ranks :=
+ Number_List_Table.Last (Data.Tree.Number_Lists);
- if Last_Source_Dir = Nil_String then
+ else
+ -- We already have source directories, link the previous
+ -- last to the new one.
- -- This is the first source directory
+ Data.Tree.String_Elements.Table (Last_Source_Dir).Next :=
+ String_Element_Table.Last (Data.Tree.String_Elements);
+ Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank).Next :=
+ Number_List_Table.Last (Data.Tree.Number_Lists);
+ end if;
- Project.Source_Dirs :=
- String_Element_Table.Last (Data.Tree.String_Elements);
- Project.Source_Dir_Ranks :=
- Number_List_Table.Last (Data.Tree.Number_Lists);
+ -- And register this source directory as the new last
- else
- -- We already have source directories, link the previous
- -- last to the new one.
+ Last_Source_Dir :=
+ String_Element_Table.Last (Data.Tree.String_Elements);
+ Data.Tree.String_Elements.Table (Last_Source_Dir) := Element;
+ Last_Src_Dir_Rank :=
+ Number_List_Table.Last (Data.Tree.Number_Lists);
+ Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank) :=
+ (Number => Rank, Next => No_Number_List);
- Data.Tree.String_Elements.Table (Last_Source_Dir).Next :=
- String_Element_Table.Last (Data.Tree.String_Elements);
- Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank).Next :=
- Number_List_Table.Last (Data.Tree.Number_Lists);
- end if;
+ elsif Removed and then List /= Nil_String then
- -- And register this source directory as the new last
+ -- Remove source dir, if present
- Last_Source_Dir :=
- String_Element_Table.Last (Data.Tree.String_Elements);
- Data.Tree.String_Elements.Table (Last_Source_Dir) := Element;
- Last_Src_Dir_Rank :=
- Number_List_Table.Last (Data.Tree.Number_Lists);
- Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank) :=
- (Number => Rank, Next => No_Number_List);
+ if Prev = Nil_String then
+ Project.Source_Dirs :=
+ Data.Tree.String_Elements.Table (List).Next;
+ Project.Source_Dir_Ranks :=
+ Data.Tree.Number_Lists.Table (Rank_List).Next;
- elsif Removed and then List /= Nil_String then
+ else
+ Data.Tree.String_Elements.Table (Prev).Next :=
+ Data.Tree.String_Elements.Table (List).Next;
+ Data.Tree.Number_Lists.Table (Prev_Rank).Next :=
+ Data.Tree.Number_Lists.Table (Rank_List).Next;
+ end if;
+ end if;
+ end Add_To_Or_Remove_From_Source_Dirs;
- -- Remove source dir, if present
+ ----------------------
+ -- Find_Source_Dirs --
+ ----------------------
- if Prev = Nil_String then
- Project.Source_Dirs :=
- Data.Tree.String_Elements.Table (List).Next;
- Project.Source_Dir_Ranks :=
- Data.Tree.Number_Lists.Table (Rank_List).Next;
+ procedure Find_Source_Dirs
+ (From : File_Name_Type;
+ Location : Source_Ptr;
+ Rank : Natural;
+ Removed : Boolean := False)
+ is
+ Directory : constant String := Get_Name_String (From);
- else
- Data.Tree.String_Elements.Table (Prev).Next :=
- Data.Tree.String_Elements.Table (List).Next;
- Data.Tree.Number_Lists.Table (Prev_Rank).Next :=
- Data.Tree.Number_Lists.Table (Rank_List).Next;
- end if;
- end if;
- end Add_To_Or_Remove_From_List;
+ procedure Recursive_Find_Dirs (Path : Name_Id);
+ -- Find all the subdirectories (recursively) of Path and add them
+ -- to the list of source directories of the project.
-------------------------
-- Recursive_Find_Dirs --
@@ -4961,8 +5048,8 @@ package body Prj.Nmsc is
Name : String (1 .. 250);
Last : Natural;
- Non_Canonical_Path : Name_Id := No_Name;
- Canonical_Path : Name_Id := No_Name;
+ Non_Canonical_Path : Path_Name_Type := No_Path;
+ Canonical_Path : Path_Name_Type := No_Path;
The_Path : constant String :=
Normalize_Pathname
@@ -4981,7 +5068,8 @@ package body Prj.Nmsc is
The_Path (The_Path'First .. The_Path_Last);
Non_Canonical_Path := Name_Find;
Canonical_Path :=
- Name_Id (Canonical_Case_File_Name (Non_Canonical_Path));
+ Path_Name_Type
+ (Canonical_Case_File_Name (Name_Id (Non_Canonical_Path)));
-- To avoid processing the same directory several times, check
-- if the directory is already in Recursive_Dirs. If it is, then
@@ -4996,9 +5084,11 @@ package body Prj.Nmsc is
end if;
end if;
- Add_To_Or_Remove_From_List
+ Add_To_Or_Remove_From_Source_Dirs
(Path_Id => Canonical_Path,
- Display_Path_Id => Non_Canonical_Path);
+ Display_Path_Id => Non_Canonical_Path,
+ Rank => Rank,
+ Removed => Removed);
-- Now look for subdirectories. Do that even when this directory
-- is already in the list, because some of its subdirectories may
@@ -5095,7 +5185,7 @@ package body Prj.Nmsc is
Base_Dir : constant File_Name_Type := Name_Find;
Root_Dir : constant String :=
Normalize_Pathname
- (Name => Get_Name_String (Base_Dir),
+ (Name => Name_Buffer (1 .. Name_Len),
Directory =>
Get_Name_String
(Project.Directory.Display_Name),
@@ -5106,18 +5196,9 @@ package body Prj.Nmsc is
begin
if Root_Dir'Length = 0 then
Err_Vars.Error_Msg_File_1 := Base_Dir;
-
- if Location = No_Location then
- Error_Msg
- (Data.Flags,
- "{ is not a valid directory.",
- Project.Location, Project);
- else
- Error_Msg
- (Data.Flags,
- "{ is not a valid directory.",
- Location, Project);
- end if;
+ Error_Or_Warning
+ (Data.Flags, Data.Flags.Missing_Source_Files,
+ "{ is not a valid directory.", Location, Project);
else
-- We have an existing directory, we register it and all of
@@ -5155,57 +5236,18 @@ package body Prj.Nmsc is
if not Dir_Exists then
Err_Vars.Error_Msg_File_1 := From;
-
- if Location = No_Location then
- Error_Msg
- (Data.Flags,
- "{ is not a valid directory",
- Project.Location, Project);
- else
- Error_Msg
- (Data.Flags,
- "{ is not a valid directory",
- Location, Project);
- end if;
+ Error_Or_Warning
+ (Data.Flags, Data.Flags.Missing_Source_Files,
+ "{ is not a valid directory", Location, Project);
else
- declare
- Path : constant String :=
- Normalize_Pathname
- (Name =>
- Get_Name_String (Path_Name.Name),
- Directory =>
- Get_Name_String (Project.Directory.Name),
- Resolve_Links => Opt.Follow_Links_For_Dirs,
- Case_Sensitive => True) &
- Directory_Separator;
-
- Last_Path : constant Natural :=
- Compute_Directory_Last (Path);
- Path_Id : Name_Id;
- Display_Path : constant String :=
- Get_Name_String
- (Path_Name.Display_Name);
- Last_Display_Path : constant Natural :=
- Compute_Directory_Last
- (Display_Path);
- Display_Path_Id : Name_Id;
-
- begin
- Name_Len := 0;
- Add_Str_To_Name_Buffer (Path (Path'First .. Last_Path));
- Path_Id := Name_Find;
-
- Name_Len := 0;
- Add_Str_To_Name_Buffer
- (Display_Path
- (Display_Path'First .. Last_Display_Path));
- Display_Path_Id := Name_Find;
-
- Add_To_Or_Remove_From_List
- (Path_Id => Path_Id,
- Display_Path_Id => Display_Path_Id);
- end;
+ -- links have been resolved if necessary, and Path_Name
+ -- always ends with a directory separator
+ Add_To_Or_Remove_From_Source_Dirs
+ (Path_Id => Path_Name.Name,
+ Display_Path_Id => Path_Name.Display_Name,
+ Rank => Rank,
+ Removed => Removed);
end if;
end;
end if;
@@ -5275,21 +5317,9 @@ package body Prj.Nmsc is
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Object_Dir.Value);
-
- case Data.Flags.Require_Obj_Dirs is
- when Error =>
- Error_Msg
- (Data.Flags,
- "object directory { not found",
- Project.Location, Project);
- when Warning =>
- Error_Msg
- (Data.Flags,
- "?object directory { not found",
- Project.Location, Project);
- when Silent =>
- null;
- end case;
+ Error_Or_Warning
+ (Data.Flags, Data.Flags.Require_Obj_Dirs,
+ "object directory { not found", Project.Location, Project);
end if;
end if;
@@ -5375,7 +5405,7 @@ package body Prj.Nmsc is
pragma Assert (Source_Dirs.Kind = List, "Source_Dirs is not a list");
- if (not Source_Files.Default)
+ if not Source_Files.Default
and then Source_Files.Values = Nil_String
then
Project.Source_Dirs := Nil_String;
@@ -5388,43 +5418,14 @@ package body Prj.Nmsc is
end if;
elsif Source_Dirs.Default then
-
-- No Source_Dirs specified: the single source directory is the one
-- containing the project file.
- String_Element_Table.Append (Data.Tree.String_Elements,
- (Value => Name_Id (Project.Directory.Name),
- Display_Value => Name_Id (Project.Directory.Display_Name),
- Location => No_Location,
- Flag => False,
- Next => Nil_String,
- Index => 0));
-
- Project.Source_Dirs :=
- String_Element_Table.Last (Data.Tree.String_Elements);
-
- Number_List_Table.Append
- (Data.Tree.Number_Lists,
- (Number => 1, Next => No_Number_List));
-
- Project.Source_Dir_Ranks :=
- Number_List_Table.Last (Data.Tree.Number_Lists);
-
- if Current_Verbosity = High then
- Write_Attr
- ("Default source directory",
- Get_Name_String (Project.Directory.Display_Name));
- end if;
-
- elsif Source_Dirs.Values = Nil_String then
- if Project.Qualifier = Standard then
- Error_Msg
- (Data.Flags,
- "a standard project cannot have no source directories",
- Source_Dirs.Location, Project);
- end if;
-
- Project.Source_Dirs := Nil_String;
+ Add_To_Or_Remove_From_Source_Dirs
+ (Path_Id => Project.Directory.Name,
+ Display_Path_Id => Project.Directory.Display_Name,
+ Rank => 1,
+ Removed => False);
else
declare
@@ -5443,6 +5444,15 @@ package body Prj.Nmsc is
(File_Name_Type (Element.Value), Element.Location, Rank);
Source_Dir := Element.Next;
end loop;
+
+ if Project.Source_Dirs = Nil_String
+ and then Project.Qualifier = Standard
+ then
+ Error_Msg
+ (Data.Flags,
+ "a standard project cannot have no source directories",
+ Source_Dirs.Location, Project);
+ end if;
end;
end if;
@@ -5610,7 +5620,11 @@ package body Prj.Nmsc is
(Name => Source_Name,
Location => Location,
Source => No_Source,
+ Listed => True,
Found => False);
+
+ else
+ Name_Loc.Listed := True;
end if;
Source_Names_Htable.Set
@@ -6242,14 +6256,14 @@ package body Prj.Nmsc is
------------------
procedure Find_Sources
- (Project : in out Project_Processing_Data;
- Data : in out Tree_Processing_Data)
+ (Project : in out Project_Processing_Data;
+ Data : in out Tree_Processing_Data)
is
Sources : constant Variable_Value :=
Util.Value_Of
(Name_Source_Files,
- Project.Project.Decl.Attributes,
- Data.Tree);
+ Project.Project.Decl.Attributes,
+ Data.Tree);
Source_List_File : constant Variable_Value :=
Util.Value_Of
@@ -6345,11 +6359,16 @@ package body Prj.Nmsc is
(Name => Name,
Location => Location,
Source => No_Source,
+ Listed => True,
Found => False);
- Source_Names_Htable.Set
- (Project.Source_Names, Name, Name_Loc);
+
+ else
+ Name_Loc.Listed := True;
end if;
+ Source_Names_Htable.Set
+ (Project.Source_Names, Name, Name_Loc);
+
Current := Element.Next;
end loop;
@@ -6396,6 +6415,57 @@ package body Prj.Nmsc is
Has_Explicit_Sources := False;
end if;
+ -- Remove any exception that is not in the specified list of sources
+
+ if Has_Explicit_Sources then
+ declare
+ Source : Source_Id;
+ Iter : Source_Iterator;
+ NL : Name_Location;
+ Again : Boolean;
+ begin
+ Iter_Loop :
+ loop
+ Again := False;
+ Iter := For_Each_Source (Data.Tree, Project.Project);
+
+ Source_Loop :
+ loop
+ Source := Prj.Element (Iter);
+ exit Source_Loop when Source = No_Source;
+
+ if Source.Naming_Exception then
+ NL := Source_Names_Htable.Get
+ (Project.Source_Names, Source.File);
+
+ if NL /= No_Name_Location and then not NL.Listed then
+ -- Remove the exception
+ Source_Names_Htable.Set
+ (Project.Source_Names,
+ Source.File,
+ No_Name_Location);
+ Remove_Source (Source, No_Source);
+
+ Error_Msg_Name_1 := Name_Id (Source.File);
+ Error_Msg
+ (Data.Flags,
+ "? unknown source file %%",
+ NL.Location,
+ Project.Project);
+
+ Again := True;
+ exit Source_Loop;
+ end if;
+ end if;
+
+ Next (Iter);
+ end loop Source_Loop;
+
+ exit Iter_Loop when not Again;
+ end loop Iter_Loop;
+ end;
+ end if;
+
Search_Directories
(Project,
Data => Data,
@@ -6406,6 +6476,8 @@ package body Prj.Nmsc is
declare
Source : Source_Id;
Iter : Source_Iterator;
+ Found : Boolean := False;
+ Path : Path_Information;
begin
Iter := For_Each_Source (Data.Tree, Project.Project);
@@ -6417,26 +6489,31 @@ package body Prj.Nmsc is
and then Source.Path = No_Path_Information
then
if Source.Unit /= No_Unit_Index then
+ Found := False;
-- For multi-unit source files, source_id gets duplicated
-- once for every unit. Only the first source_id got its
- -- full path set. So if it isn't set for that first one,
- -- the file wasn't found. Otherwise we need to update for
- -- units after the first one.
+ -- full path set.
- if Source.Index = 0
- or else Source.Index = 1
- then
+ if Source.Index /= 0 then
+ Path := Files_Htable.Get
+ (Data.File_To_Source, Source.File).Path;
+
+ if Path /= No_Path_Information then
+ Found := True;
+ end if;
+ end if;
+
+ if not Found then
Error_Msg_Name_1 := Name_Id (Source.Display_File);
Error_Msg_Name_2 := Name_Id (Source.Unit.Name);
- Error_Msg
- (Data.Flags,
+ Error_Or_Warning
+ (Data.Flags, Data.Flags.Missing_Source_Files,
"source file %% for unit %% not found",
No_Location, Project.Project);
else
- Source.Path := Files_Htable.Get
- (Data.File_To_Source, Source.File).Path;
+ Source.Path := Path;
if Current_Verbosity = High then
if Source.Path /= No_Path_Information then
@@ -6444,7 +6521,7 @@ package body Prj.Nmsc is
& Get_Name_String (Source.File)
& " at" & Source.Index'Img
& " to "
- & Get_Name_String (Source.Path.Name));
+ & Get_Name_String (Path.Name));
end if;
end if;
end if;
@@ -6473,17 +6550,15 @@ package body Prj.Nmsc is
while NL /= No_Name_Location loop
if not NL.Found then
Err_Vars.Error_Msg_File_1 := NL.Name;
-
if First_Error then
- Error_Msg
- (Data.Flags,
+ Error_Or_Warning
+ (Data.Flags, Data.Flags.Missing_Source_Files,
"source file { not found",
NL.Location, Project.Project);
First_Error := False;
-
else
- Error_Msg
- (Data.Flags,
+ Error_Or_Warning
+ (Data.Flags, Data.Flags.Missing_Source_Files,
"\source file { not found",
NL.Location, Project.Project);
end if;
@@ -6721,15 +6796,12 @@ package body Prj.Nmsc is
Data : in out Tree_Processing_Data;
Source_Dir_Rank : Natural;
Path : Path_Name_Type;
+ Display_Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
Locally_Removed : Boolean;
For_All_Sources : Boolean)
is
- Canonical_Path : constant Path_Name_Type :=
- Path_Name_Type
- (Canonical_Case_File_Name (Name_Id (Path)));
-
Name_Loc : Name_Location :=
Source_Names_Htable.Get
(Project.Source_Names, File_Name);
@@ -6779,11 +6851,11 @@ package body Prj.Nmsc is
Check_Name := True;
else
- Name_Loc.Source.Path := (Canonical_Path, Path);
+ Name_Loc.Source.Path := (Path, Display_Path);
Source_Paths_Htable.Set
(Data.Tree.Source_Paths_HT,
- Canonical_Path,
+ Path,
Name_Loc.Source);
-- Check if this is a subunit
@@ -6792,7 +6864,7 @@ package body Prj.Nmsc is
and then Name_Loc.Source.Kind = Impl
then
Src_Ind := Sinput.P.Load_Project_File
- (Get_Name_String (Canonical_Path));
+ (Get_Name_String (Path));
if Sinput.P.Source_File_Is_Subunit (Src_Ind) then
Override_Kind (Name_Loc.Source, Sep);
@@ -6844,7 +6916,7 @@ package body Prj.Nmsc is
Display_File => Display_File_Name,
Unit => Unit,
Locally_Removed => Locally_Removed,
- Path => (Canonical_Path, Path));
+ Path => (Path, Display_Path));
-- If it is a source specified in a list, update the entry in
-- the Source_Names table.
@@ -6891,32 +6963,36 @@ package body Prj.Nmsc is
Num_Nod := Data.Tree.Number_Lists.Table (Src_Dir_Rank);
Element := Data.Tree.String_Elements.Table (Source_Dir);
- if Element.Value /= No_Name then
- Get_Name_String (Element.Display_Value);
-
- if Current_Verbosity = High then
- Write_Str ("Directory: ");
- Write_Str (Name_Buffer (1 .. Name_Len));
- Write_Line (Num_Nod.Number'Img);
- end if;
+ -- Use Element.Value in this test, not Display_Value, because we
+ -- want the symbolic links to be resolved when appropriate.
+ if Element.Value /= No_Name then
declare
Source_Directory : constant String :=
- Name_Buffer (1 .. Name_Len) &
- Directory_Separator;
+ Get_Name_String (Element.Value)
+ & Directory_Separator;
Dir_Last : constant Natural :=
- Compute_Directory_Last
- (Source_Directory);
+ Compute_Directory_Last (Source_Directory);
+
+ Display_Source_Directory : constant String :=
+ Get_Name_String
+ (Element.Display_Value)
+ & Directory_Separator;
+ -- Display_Source_Directory is to allow us to open a UTF-8
+ -- encoded directory on Windows.
begin
if Current_Verbosity = High then
- Write_Attr ("Source_Dir", Source_Directory);
+ Write_Attr
+ ("Source_Dir",
+ Source_Directory (Source_Directory'First .. Dir_Last));
+ Write_Line (Num_Nod.Number'Img);
end if;
-- We look to every entry in the source directory
- Open (Dir, Source_Directory);
+ Open (Dir, Display_Source_Directory);
loop
Read (Dir, Name, Last);
@@ -6931,7 +7007,7 @@ package body Prj.Nmsc is
if not Opt.Follow_Links_For_Files
or else Is_Regular_File
- (Source_Directory & Name (1 .. Last))
+ (Display_Source_Directory & Name (1 .. Last))
then
if Current_Verbosity = High then
Write_Str (" Checking ");
@@ -6961,17 +7037,24 @@ package body Prj.Nmsc is
Resolve_Links =>
Opt.Follow_Links_For_Files,
Case_Sensitive => True);
- -- Case_Sensitive set True (no folding)
- Path : Path_Name_Type;
- FF : File_Found := Excluded_Sources_Htable.Get
- (Project.Excluded, File_Name);
+ Path : Path_Name_Type;
+ FF : File_Found :=
+ Excluded_Sources_Htable.Get
+ (Project.Excluded, File_Name);
To_Remove : Boolean := False;
begin
Name_Len := Path_Name'Length;
Name_Buffer (1 .. Name_Len) := Path_Name;
- Path := Name_Find;
+
+ if Osint.File_Names_Case_Sensitive then
+ Path := Name_Find;
+ else
+ Canonical_Case_File_Name
+ (Name_Buffer (1 .. Name_Len));
+ Path := Name_Find;
+ end if;
if FF /= No_File_Found then
if not FF.Found then
@@ -6981,7 +7064,8 @@ package body Prj.Nmsc is
if Current_Verbosity = High then
Write_Str (" excluded source """);
- Write_Str (Get_Name_String (File_Name));
+ Write_Str
+ (Get_Name_String (Display_File_Name));
Write_Line ("""");
end if;
@@ -6995,11 +7079,20 @@ package body Prj.Nmsc is
end if;
end if;
+ -- Preserve the user's original casing and use of
+ -- links. The display_value (a directory) already
+ -- ends with a directory separator by construction,
+ -- so no need to add one.
+
+ Get_Name_String (Element.Display_Value);
+ Get_Name_String_And_Append (Display_File_Name);
+
Check_File
(Project => Project,
Source_Dir_Rank => Num_Nod.Number,
Data => Data,
Path => Path,
+ Display_Path => Name_Find,
File_Name => File_Name,
Locally_Removed => To_Remove,
Display_File_Name => Display_File_Name,
@@ -7066,8 +7159,9 @@ package body Prj.Nmsc is
K => Source.File,
E => Name_Location'
(Name => Source.File,
- Location => No_Location,
+ Location => Source.Location,
Source => Source,
+ Listed => False,
Found => False));
-- If this is an Ada exception, record in table Unit_Exceptions
@@ -7439,7 +7533,7 @@ package body Prj.Nmsc is
while Current /= Nil_String loop
Element := In_Tree.String_Elements.Table (Current);
Write_Str (" ");
- Write_Line (Get_Name_String (Element.Value));
+ Write_Line (Get_Name_String (Element.Display_Value));
Current := Element.Next;
end loop;
@@ -7485,9 +7579,49 @@ package body Prj.Nmsc is
-- Start of processing for Process_Naming_Scheme
begin
+ Lib_Data_Table.Init;
Initialize (Data, Tree => Tree, Flags => Flags);
Check_All_Projects (Root_Project, Data, Imported_First => True);
Free (Data);
+
+ -- Adjust language configs for projects that are extended
+
+ declare
+ List : Project_List;
+ Proj : Project_Id;
+ Exte : Project_Id;
+ Lang : Language_Ptr;
+ Elng : Language_Ptr;
+
+ begin
+ List := Tree.Projects;
+ while List /= null loop
+ Proj := List.Project;
+ Exte := Proj;
+ while Exte.Extended_By /= No_Project loop
+ Exte := Exte.Extended_By;
+ end loop;
+
+ if Exte /= Proj then
+ Lang := Proj.Languages;
+
+ if Lang /= No_Language_Index then
+ loop
+ Elng := Get_Language_From_Name
+ (Exte, Get_Name_String (Lang.Name));
+ exit when Elng /= No_Language_Index;
+ Exte := Exte.Extends;
+ end loop;
+
+ if Elng /= Lang then
+ Lang.Config := Elng.Config;
+ end if;
+ end if;
+ end if;
+
+ List := List.Next;
+ end loop;
+ end;
end Process_Naming_Scheme;
end Prj.Nmsc;
diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb
index c733f38365c..b8abe571bc4 100644
--- a/gcc/ada/prj-part.adb
+++ b/gcc/ada/prj-part.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -36,12 +36,11 @@ with Sinput.P; use Sinput.P;
with Snames;
with Table;
-with Ada.Characters.Handling; use Ada.Characters.Handling;
-with Ada.Exceptions; use Ada.Exceptions;
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Ada.Exceptions; use Ada.Exceptions;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-
-with System.HTable; use System.HTable;
+with GNAT.HTable; use GNAT.HTable;
package body Prj.Part is
@@ -98,7 +97,7 @@ package body Prj.Part is
-- limited imported projects when there is a circularity with at least
-- one limited imported project file.
- package Virtual_Hash is new System.HTable.Simple_HTable
+ package Virtual_Hash is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Project_Node_Id,
No_Element => Empty_Node,
@@ -108,7 +107,7 @@ package body Prj.Part is
-- Hash table to store the node id of the project for which a virtual
-- extending project need to be created.
- package Processed_Hash is new System.HTable.Simple_HTable
+ package Processed_Hash is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Boolean,
No_Element => False,
@@ -119,7 +118,7 @@ package body Prj.Part is
-- need to have a virtual extending project, to avoid processing the same
-- project twice.
- package Projects_Paths is new System.HTable.Simple_HTable
+ package Projects_Paths is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Path_Name_Type,
No_Element => No_Path,
diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb
index 49841522dc9..5859a8afe82 100644
--- a/gcc/ada/prj-proc.adb
+++ b/gcc/ada/prj-proc.adb
@@ -87,15 +87,15 @@ package body Prj.Proc is
-- based languages)
procedure Copy_Package_Declarations
- (From : Declarations;
- To : in out Declarations;
- New_Loc : Source_Ptr;
- Naming_Restricted : Boolean;
- In_Tree : Project_Tree_Ref);
+ (From : Declarations;
+ To : in out Declarations;
+ New_Loc : Source_Ptr;
+ Restricted : Boolean;
+ In_Tree : Project_Tree_Ref);
-- Copy a package declaration From to To for a renamed package. Change the
- -- locations of all the attributes to New_Loc. When Naming_Restricted is
- -- True, do not copy attributes Body, Spec, Implementation and
- -- Specification.
+ -- locations of all the attributes to New_Loc. When Restricted is
+ -- True, do not copy attributes Body, Spec, Implementation, Specification
+ -- and Linker_Options.
function Expression
(Project : Project_Id;
@@ -314,11 +314,11 @@ package body Prj.Proc is
-------------------------------
procedure Copy_Package_Declarations
- (From : Declarations;
- To : in out Declarations;
- New_Loc : Source_Ptr;
- Naming_Restricted : Boolean;
- In_Tree : Project_Tree_Ref)
+ (From : Declarations;
+ To : in out Declarations;
+ New_Loc : Source_Ptr;
+ Restricted : Boolean;
+ In_Tree : Project_Tree_Ref)
is
V1 : Variable_Id;
V2 : Variable_Id := No_Variable;
@@ -346,6 +346,12 @@ package body Prj.Proc is
Var := In_Tree.Variable_Elements.Table (V1);
V1 := Var.Next;
+ -- Do not copy the value of attribute inker_Options if Restricted
+
+ if Restricted and then Var.Name = Snames.Name_Linker_Options then
+ Var.Value.Values := Nil_String;
+ end if;
+
-- Remove the Next component
Var.Next := No_Variable;
@@ -376,16 +382,16 @@ package body Prj.Proc is
Arr := In_Tree.Arrays.Table (A1);
A1 := Arr.Next;
- if not Naming_Restricted or else
- (Arr.Name /= Snames.Name_Body
- and then Arr.Name /= Snames.Name_Spec
- and then Arr.Name /= Snames.Name_Implementation
- and then Arr.Name /= Snames.Name_Specification)
+ if not Restricted
+ or else
+ (Arr.Name /= Snames.Name_Body and then
+ Arr.Name /= Snames.Name_Spec and then
+ Arr.Name /= Snames.Name_Implementation and then
+ Arr.Name /= Snames.Name_Specification)
then
-- Remove the Next component
Arr.Next := No_Array;
-
Array_Table.Increment_Last (In_Tree.Arrays);
-- Create new Array declaration
@@ -1255,9 +1261,101 @@ package body Prj.Proc is
Pkg : Package_Id;
Item : Project_Node_Id)
is
+ procedure Check_Or_Set_Typed_Variable
+ (Value : in out Variable_Value;
+ Declaration : Project_Node_Id);
+ -- Check whether Value is valid for this typed variable declaration. If
+ -- it is an error, the behavior depends on the flags: either an error is
+ -- reported, or a warning, or nothing. In the last two cases, the value
+ -- of the variable is set to a valid value, replacing Value.
+
+ ---------------------------------
+ -- Check_Or_Set_Typed_Variable --
+ ---------------------------------
+
+ procedure Check_Or_Set_Typed_Variable
+ (Value : in out Variable_Value;
+ Declaration : Project_Node_Id)
+ is
+ Loc : constant Source_Ptr :=
+ Location_Of (Declaration, From_Project_Node_Tree);
+
+ Reset_Value : Boolean := False;
+ Current_String : Project_Node_Id;
+
+ begin
+ -- Report an error for an empty string
+
+ if Value.Value = Empty_String then
+ Error_Msg_Name_1 := Name_Of (Declaration, From_Project_Node_Tree);
+
+ case Flags.Allow_Invalid_External is
+ when Error =>
+ Error_Msg (Flags, "no value defined for %%", Loc, Project);
+ when Warning =>
+ Reset_Value := True;
+ Error_Msg (Flags, "?no value defined for %%", Loc, Project);
+ when Silent =>
+ Reset_Value := True;
+ end case;
+
+ else
+ -- Loop through all the valid strings for the
+ -- string type and compare to the string value.
+
+ Current_String :=
+ First_Literal_String
+ (String_Type_Of (Declaration, From_Project_Node_Tree),
+ From_Project_Node_Tree);
+ while Present (Current_String)
+ and then String_Value_Of
+ (Current_String, From_Project_Node_Tree) /= Value.Value
+ loop
+ Current_String :=
+ Next_Literal_String (Current_String, From_Project_Node_Tree);
+ end loop;
+
+ -- Report error if string value is not one for the string type
+
+ if No (Current_String) then
+ Error_Msg_Name_1 := Value.Value;
+ Error_Msg_Name_2 :=
+ Name_Of (Declaration, From_Project_Node_Tree);
+
+ case Flags.Allow_Invalid_External is
+ when Error =>
+ Error_Msg
+ (Flags, "value %% is illegal for typed string %%",
+ Loc, Project);
+ when Warning =>
+ Error_Msg
+ (Flags, "?value %% is illegal for typed string %%",
+ Loc, Project);
+ Reset_Value := True;
+ when Silent =>
+ Reset_Value := True;
+ end case;
+ end if;
+ end if;
+
+ if Reset_Value then
+ Current_String :=
+ First_Literal_String
+ (String_Type_Of (Declaration, From_Project_Node_Tree),
+ From_Project_Node_Tree);
+
+ Value.Value := String_Value_Of
+ (Current_String, From_Project_Node_Tree);
+ end if;
+ end Check_Or_Set_Typed_Variable;
+
+ -- Local variables
+
Current_Declarative_Item : Project_Node_Id;
Current_Item : Project_Node_Id;
+ -- Start of processing for Process_Declarative_Items
+
begin
-- Loop through declarative items
@@ -1353,15 +1451,15 @@ package body Prj.Proc is
-- renaming declaration.
Copy_Package_Declarations
- (From =>
+ (From =>
In_Tree.Packages.Table (Renamed_Package).Decl,
- To =>
+ To =>
In_Tree.Packages.Table (New_Pkg).Decl,
- New_Loc =>
+ New_Loc =>
Location_Of
(Current_Item, From_Project_Node_Tree),
- Naming_Restricted => False,
- In_Tree => In_Tree);
+ Restricted => False,
+ In_Tree => In_Tree);
end;
-- Standard package declaration, not renaming
@@ -1677,7 +1775,7 @@ package body Prj.Proc is
else
declare
- New_Value : constant Variable_Value :=
+ New_Value : Variable_Value :=
Expression
(Project => Project,
In_Tree => In_Tree,
@@ -1713,59 +1811,9 @@ package body Prj.Proc is
if Kind_Of (Current_Item, From_Project_Node_Tree) =
N_Typed_Variable_Declaration
then
- -- Report an error for an empty string
-
- if New_Value.Value = Empty_String then
- Error_Msg_Name_1 :=
- Name_Of (Current_Item, From_Project_Node_Tree);
- Error_Msg
- (Flags,
- "no value defined for %%",
- Location_Of
- (Current_Item, From_Project_Node_Tree),
- Project);
-
- else
- declare
- Current_String : Project_Node_Id;
-
- begin
- -- Loop through all the valid strings for the
- -- string type and compare to the string value.
-
- Current_String :=
- First_Literal_String
- (String_Type_Of (Current_Item,
- From_Project_Node_Tree),
- From_Project_Node_Tree);
- while Present (Current_String)
- and then
- String_Value_Of
- (Current_String, From_Project_Node_Tree) /=
- New_Value.Value
- loop
- Current_String :=
- Next_Literal_String
- (Current_String, From_Project_Node_Tree);
- end loop;
-
- -- Report an error if the string value is not
- -- one for the string type.
-
- if No (Current_String) then
- Error_Msg_Name_1 := New_Value.Value;
- Error_Msg_Name_2 :=
- Name_Of
- (Current_Item, From_Project_Node_Tree);
- Error_Msg
- (Flags,
- "value %% is illegal for typed string %%",
- Location_Of
- (Current_Item, From_Project_Node_Tree),
- Project);
- end if;
- end;
- end if;
+ Check_Or_Set_Typed_Variable
+ (Value => New_Value,
+ Declaration => Current_Item);
end if;
-- Comment here ???
@@ -2274,13 +2322,13 @@ package body Prj.Proc is
Is_Extending_All (From_Project_Node, From_Project_Node_Tree)
then
declare
- Object_Dir : constant Path_Name_Type :=
- Project.Object_Directory.Name;
+ Object_Dir : constant Path_Information :=
+ Project.Object_Directory;
begin
Prj := In_Tree.Projects;
while Prj /= null loop
if Prj.Project.Virtual then
- Prj.Project.Object_Directory.Name := Object_Dir;
+ Prj.Project.Object_Directory := Object_Dir;
end if;
Prj := Prj.Next;
end loop;
@@ -2579,13 +2627,12 @@ package body Prj.Proc is
Next => Project.Decl.Packages);
Project.Decl.Packages := Current_Pkg;
Copy_Package_Declarations
- (From => Element.Decl,
- To =>
+ (From => Element.Decl,
+ To =>
In_Tree.Packages.Table (Current_Pkg).Decl,
- New_Loc => No_Location,
- Naming_Restricted =>
- Element.Name = Snames.Name_Naming,
- In_Tree => In_Tree);
+ New_Loc => No_Location,
+ Restricted => True,
+ In_Tree => In_Tree);
end if;
Extended_Pkg := Element.Next;
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index 0bae53c23fc..be02a417014 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -34,10 +34,9 @@ with Uintp; use Uintp;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Unchecked_Deallocation;
+with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-
-with System.Case_Util; use System.Case_Util;
-with System.HTable;
+with GNAT.HTable;
package body Prj is
@@ -568,7 +567,7 @@ package body Prj is
-- Hash --
----------
- function Hash is new System.HTable.Hash (Header_Num => Header_Num);
+ function Hash is new GNAT.HTable.Hash (Header_Num => Header_Num);
-- Used in implementation of other functions Hash below
function Hash (Name : File_Name_Type) return Header_Num is
@@ -1226,11 +1225,13 @@ package body Prj is
function Create_Flags
(Report_Error : Error_Handler;
When_No_Sources : Error_Warning;
- Require_Sources_Other_Lang : Boolean := True;
- Allow_Duplicate_Basenames : Boolean := True;
- Compiler_Driver_Mandatory : Boolean := False;
- Error_On_Unknown_Language : Boolean := True;
- Require_Obj_Dirs : Error_Warning := Error)
+ Require_Sources_Other_Lang : Boolean := True;
+ Allow_Duplicate_Basenames : Boolean := True;
+ Compiler_Driver_Mandatory : Boolean := False;
+ Error_On_Unknown_Language : Boolean := True;
+ Require_Obj_Dirs : Error_Warning := Error;
+ Allow_Invalid_External : Error_Warning := Error;
+ Missing_Source_Files : Error_Warning := Error)
return Processing_Flags
is
begin
@@ -1241,7 +1242,9 @@ package body Prj is
Allow_Duplicate_Basenames => Allow_Duplicate_Basenames,
Error_On_Unknown_Language => Error_On_Unknown_Language,
Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
- Require_Obj_Dirs => Require_Obj_Dirs);
+ Require_Obj_Dirs => Require_Obj_Dirs,
+ Allow_Invalid_External => Allow_Invalid_External,
+ Missing_Source_Files => Missing_Source_Files);
end Create_Flags;
------------
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index 353138d2daf..a6a79646a53 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -667,6 +667,10 @@ package Prj is
Project : Project_Id := No_Project;
-- Project of the source
+ Location : Source_Ptr := No_Location;
+ -- Location in the project file of the declaration of the source in
+ -- package Naming.
+
Source_Dir_Rank : Natural := 0;
-- The rank of the source directory in list declared with attribute
-- Source_Dirs. Two source files with the same name cannot appears in
@@ -768,6 +772,7 @@ package Prj is
No_Source_Data : constant Source_Data :=
(Project => No_Project,
+ Location => No_Location,
Source_Dir_Rank => 0,
Language => No_Language_Index,
In_Interfaces => True,
@@ -894,6 +899,7 @@ package Prj is
type Response_File_Format is
(None,
GNU,
+ GCC,
Object_List,
Option_List);
-- The format of the different response files
@@ -1448,11 +1454,13 @@ package Prj is
function Create_Flags
(Report_Error : Error_Handler;
When_No_Sources : Error_Warning;
- Require_Sources_Other_Lang : Boolean := True;
- Allow_Duplicate_Basenames : Boolean := True;
- Compiler_Driver_Mandatory : Boolean := False;
- Error_On_Unknown_Language : Boolean := True;
- Require_Obj_Dirs : Error_Warning := Error)
+ Require_Sources_Other_Lang : Boolean := True;
+ Allow_Duplicate_Basenames : Boolean := True;
+ Compiler_Driver_Mandatory : Boolean := False;
+ Error_On_Unknown_Language : Boolean := True;
+ Require_Obj_Dirs : Error_Warning := Error;
+ Allow_Invalid_External : Error_Warning := Error;
+ Missing_Source_Files : Error_Warning := Error)
return Processing_Flags;
-- Function used to create Processing_Flags structure
--
@@ -1481,6 +1489,15 @@ package Prj is
-- If Require_Obj_Dirs is true, then all object directories must exist
-- (possibly after they have been created automatically if the appropriate
-- switches were specified), or an error is raised.
+ --
+ -- If Allow_Invalid_External is Silent, then no error is reported when an
+ -- invalid value is used for an external variable (and it doesn't match its
+ -- type). Instead, the first possible value is used.
+ --
+ -- Missing_Source_Files indicates whether it is an error or a warning that
+ -- a source file mentioned in the Source_Files attributes is not actually
+ -- found in the source directories. This also impacts errors for missing
+ -- source directories.
Gprbuild_Flags : constant Processing_Flags;
Gprclean_Flags : constant Processing_Flags;
@@ -1510,6 +1527,10 @@ package Prj is
-- another program running on the same machine has recreated it.
-- Does nothing if Debug.Debug_Flag_N is set
+ Virtual_Prefix : constant String := "v$";
+ -- The prefix for virtual extending projects. Because of the '$', which is
+ -- normally forbidden for project names, there cannot be any name clash.
+
private
All_Packages : constant String_List_Access := null;
@@ -1524,10 +1545,6 @@ private
Location => No_Location,
Default => False);
- Virtual_Prefix : constant String := "v$";
- -- The prefix for virtual extending projects. Because of the '$', which is
- -- normally forbidden for project names, there cannot be any name clash.
-
type Source_Iterator is record
In_Tree : Project_Tree_Ref;
@@ -1589,6 +1606,8 @@ private
Compiler_Driver_Mandatory : Boolean;
Error_On_Unknown_Language : Boolean;
Require_Obj_Dirs : Error_Warning;
+ Allow_Invalid_External : Error_Warning;
+ Missing_Source_Files : Error_Warning;
end record;
Gprbuild_Flags : constant Processing_Flags :=
@@ -1598,7 +1617,9 @@ private
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => True,
Error_On_Unknown_Language => True,
- Require_Obj_Dirs => Error);
+ Require_Obj_Dirs => Error,
+ Allow_Invalid_External => Error,
+ Missing_Source_Files => Error);
Gprclean_Flags : constant Processing_Flags :=
(Report_Error => null,
@@ -1607,7 +1628,9 @@ private
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => True,
Error_On_Unknown_Language => True,
- Require_Obj_Dirs => Warning);
+ Require_Obj_Dirs => Warning,
+ Allow_Invalid_External => Error,
+ Missing_Source_Files => Error);
Gnatmake_Flags : constant Processing_Flags :=
(Report_Error => null,
@@ -1616,6 +1639,8 @@ private
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => False,
Error_On_Unknown_Language => False,
- Require_Obj_Dirs => Error);
+ Require_Obj_Dirs => Error,
+ Allow_Invalid_External => Error,
+ Missing_Source_Files => Error);
end Prj;
diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi
new file mode 100644
index 00000000000..20fb19c8ee1
--- /dev/null
+++ b/gcc/ada/projects.texi
@@ -0,0 +1,3889 @@
+@set gprconfig GPRconfig
+
+@c ------ projects.texi
+@c This file is shared between the GNAT user's guide and gprbuild. It is not
+@c compilable on its own, you should instead compile the other two manuals.
+@c For that reason, there is no toplevel @menu
+
+@c ---------------------------------------------
+@node GNAT Project Manager
+@chapter GNAT Project Manager
+@c ---------------------------------------------
+
+@noindent
+@menu
+* Introduction::
+* Building With Projects::
+* Organizing Projects into Subsystems::
+* Scenarios in Projects::
+* Library Projects::
+* Project Extension::
+* Project File Reference::
+@end menu
+
+@c ---------------------------------------------
+@node Introduction
+@section Introduction
+@c ---------------------------------------------
+
+@noindent
+This chapter describes GNAT's @emph{Project Manager}, a facility that allows
+you to manage complex builds involving a number of source files, directories,
+and options for different system configurations. In particular,
+project files allow you to specify:
+
+@itemize @bullet
+@item The directory or set of directories containing the source files, and/or the
+ names of the specific source files themselves
+@item The directory in which the compiler's output
+ (@file{ALI} files, object files, tree files, etc.) is to be placed
+@item The directory in which the executable programs are to be placed
+@item Switch settings for any of the project-enabled tools;
+ you can apply these settings either globally or to individual compilation units.
+@item The source files containing the main subprogram(s) to be built
+@item The source programming language(s)
+@item Source file naming conventions; you can specify these either globally or for
+ individual compilation units (@pxref{Naming Schemes}).
+@item Change any of the above settings depending on external values, thus enabling
+ the reuse of the projects in various @b{scenarios} (@pxref{Scenarios
+ in Projects}).
+@item Automatically build libraries as part of the build process
+ (@pxref{Library Projects}).
+
+@end itemize
+
+@noindent
+Project files are written in a syntax close to that of Ada, using familiar
+notions such as packages, context clauses, declarations, default values,
+assignments, and inheritance (@pxref{Project File Reference}).
+
+Project files can be built hierarchically from other project files, simplifying
+complex system integration and project reuse (@pxref{Organizing Projects into
+Subsystems}).
+
+@itemize @bullet
+@item One project can import other projects containing needed source files.
+ More generally, the Project Manager lets you structure large development
+ efforts into hierarchical subsystems, where build decisions are delegated
+ to the subsystem level, and thus different compilation environments
+ (switch settings) used for different subsystems.
+@item You can organize GNAT projects in a hierarchy: a child project
+ can extend a parent project, inheriting the parent's source files and
+ optionally overriding any of them with alternative versions
+ (@pxref{Project Extension}).
+
+@end itemize
+
+@noindent
+Several tools support project files, generally in addition to specifying
+the information on the command line itself). They share common switches
+to control the loading of the project (in particular
+@option{^-P^/PROJECT_FILE=^@emph{projectfile}} and
+@option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}}).
+@xref{Switches Related to Project Files}.
+
+The Project Manager supports a wide range of development strategies,
+for systems of all sizes. Here are some typical practices that are
+easily handled:
+
+@itemize @bullet
+@item Using a common set of source files and generating object files in different
+ directories via different switch settings. It can be used for instance, for
+ generating separate sets of object files for debugging and for production.
+@item Using a mostly-shared set of source files with different versions of
+ some units or subunits. It can be used for instance, for grouping and hiding
+@end itemize
+
+@noindent
+all OS dependencies in a small number of implementation units.
+
+Project files can be used to achieve some of the effects of a source
+versioning system (for example, defining separate projects for
+the different sets of sources that comprise different releases) but the
+Project Manager is independent of any source configuration management tool
+that might be used by the developers.
+
+The various sections below introduce the different concepts related to
+projects. Each section starts with examples and use cases, and then goes into
+the details of related project file capabilities.
+
+@c ---------------------------------------------
+@node Building With Projects
+@section Building With Projects
+@c ---------------------------------------------
+
+@noindent
+In its simplest form, a unique project is used to build a single executable.
+This section concentrates on such a simple setup. Later sections will extend
+this basic model to more complex setups.
+
+The following concepts are the foundation of project files, and will be further
+detailed later in this documentation. They are summarized here as a reference.
+
+@table @asis
+@item @b{Project file}:
+ A text file using an Ada-like syntax, generally using the @file{.gpr}
+ extension. It defines build-related characteristics of an application.
+ The characteristics include the list of sources, the location of those
+ sources, the location for the generated object files, the name of
+ the main program, and the options for the various tools involved in the
+ build process.
+
+@item @b{Project attribute}:
+ A specific project characteristic is defined by an attribute clause. Its
+ value is a string or a sequence of strings. All settings in a project
+ are defined through a list of predefined attributes with precise
+ semantics. @xref{Attributes}.
+
+@item @b{Package in a project}:
+ Global attributes are defined at the top level of a project.
+ Attributes affecting specific tools are grouped in a
+ package whose name is related to tool's function. The most common
+ packages are @code{Builder}, @code{Compiler}, @code{Binder},
+ and @code{Linker}. @xref{Packages}.
+
+@item @b{Project variables}:
+ In addition to attributes, a project can use variables to store intermediate
+ values and avoid duplication in complex expressions. It can be initialized
+ with a value coming from the environment.
+ A frequent use of variables is to define scenarios.
+ @xref{External Values}, @xref{Scenarios in Projects}, and @xref{Variables}.
+
+@item @b{Source files} and @b{source directories}:
+ A source file is associated with a language through a naming convention. For
+ instance, @code{foo.c} is typically the name of a C source file;
+ @code{bar.ads} or @code{bar.1.ada} are two common naming conventions for a
+ file containing an Ada spec. A compilation unit is often composed of a main
+ source file and potentially several auxiliary ones, such as header files in C.
+ The naming conventions can be user defined @xref{Naming Schemes}, and will
+ drive the builder to call the appropriate compiler for the given source file.
+ Source files are searched for in the source directories associated with the
+ project through the @b{Source_Dirs} attribute. By default, all the files (in
+ these source directories) following the naming conventions associated with the
+ declared languages are considered to be part of the project. It is also
+ possible to limit the list of source files using the @b{Source_Files} or
+ @b{Source_List_File} attributes. Note that those last two attributes only
+ accept basenames with no directory information.
+
+@item @b{Object files} and @b{object directory}:
+ An object file is an intermediate file produced by the compiler from a
+ compilation unit. It is used by post-compilation tools to produce
+ final executables or libraries. Object files produced in the context of
+ a given project are stored in a single directory that can be specified by the
+ @b{Object_Dir} attribute. In order to store objects in
+ two or more object directories, the system must be split into
+ distinct subsystems with their own project file.
+
+@end table
+
+The following subsections introduce gradually all the attributes of interest
+for simple build needs. Here is the simple setup that will be used in the
+following examples.
+
+The Ada source files @file{pack.ads}, @file{pack.adb}, and @file{proc.adb} are in
+the @file{common/} directory. The file @file{proc.adb} contains an Ada main
+subprogram @code{Proc} that @code{with}s package @code{Pack}. We want to compile
+these source files with the switch @option{-O2}, and put the resulting files in
+the directory @file{obj/}.
+
+@smallexample
+@group
+^common/^[COMMON]^
+ pack.ads
+ pack.adb
+ proc.adb
+@end group
+@group
+^common/release/^[COMMON.RELEASE]^
+ proc.ali, proc.o pack.ali, pack.o
+@end group
+@end smallexample
+
+@noindent
+Our project is to be called @emph{Build}. The name of the
+file is the name of the project (case-insensitive) with the
+@file{.gpr} extension, therefore the project file name is @file{build.gpr}. This
+is not mandatory, but a warning is issued when this convention is not followed.
+
+This is a very simple example, and as stated above, a single project
+file is enough for it. We will thus create a new file, that for now
+should contain the following code:
+
+@smallexample
+@b{project} Build @b{is}
+@b{end} Build;
+@end smallexample
+
+@menu
+* Source Files and Directories::
+* Object and Exec Directory::
+* Main Subprograms::
+* Tools Options in Project Files::
+* Compiling with Project Files::
+* Executable File Names::
+* Avoid Duplication With Variables::
+* Naming Schemes::
+@end menu
+
+@c ---------------------------------------------
+@node Source Files and Directories
+@subsection Source Files and Directories
+@c ---------------------------------------------
+
+@noindent
+When you create a new project, the first thing to describe is how to find the
+corresponding source files. This is the only settings that are needed by all
+the tools that will use this project (builder, compiler, binder and linker for
+the compilation, IDEs to edit the source files,@dots{}).
+
+@cindex Source directories
+First step is to declare the source directories, which are the directories
+to be searched to find source files. In the case of the example,
+the @file{common} directory is the only source directory.
+
+@cindex @code{Source_Dirs}
+There are several ways of defining source directories:
+
+@itemize @bullet
+@item When the attribute @b{Source_Dirs} is not used, a project contains a
+ single source directory which is the one where the project file itself
+ resides. In our example, if @file{build.gpr} is placed in the @file{common}
+ directory, the project has the needed implicit source directory.
+
+@item The attribute @b{Source_Dirs} can be set to a list of path names, one
+ for each of the source directories. Such paths can either be absolute
+ names (for instance @file{"/usr/local/common/"} on UNIX), or relative to the
+ directory in which the project file resides (for instance "." if
+ @file{build.gpr} is inside @file{common/}, or "common" if it is one level up).
+ Each of the source directories must exist and be readable.
+
+@cindex portability
+ The syntax for directories is platform specific. For portability, however,
+ the project manager will always properly translate UNIX-like path names to
+ the native format of specific platform. For instance, when the same project
+ file is to be used both on Unix and Windows, "/" should be used as the
+ directory separator rather than "\".
+
+@item The attribute @b{Source_Dirs} can automatically include subdirectories
+ using a special syntax inspired by some UNIX shells. If any of the path in
+ the list ends with @emph{"/**"}, then that path and all its subdirectories
+ (recursively) are included in the list of source directories. For instance,
+ @file{./**} represent the complete directory tree rooted at ".".
+@cindex Source directories, recursive
+
+@cindex @code{Excluded_Source_Dirs}
+ When using that construct, it can sometimes be convenient to also use the
+ attribute @b{Excluded_Source_Dirs}, which is also a list of paths. Each entry
+ specifies a directory whose immediate content, not including subdirs, is to
+ be excluded. It is also possible to exclude a complete directory subtree
+ using the "/**" notation.
+
+@end itemize
+
+@noindent
+When applied to the simple example, and because we generally prefer to have
+the project file at the toplevel directory rather than mixed with the sources,
+we will create the following file
+
+@smallexample
+ build.gpr
+ @b{project} Build @b{is}
+ @b{for} Source_Dirs @b{use} ("common"); -- <<<<
+ @b{end} Build;
+@end smallexample
+
+@noindent
+Once source directories have been specified, one may need to indicate
+source files of interest. By default, all source files present in the source
+directories are considered by the project manager. When this is not desired,
+it is possible to specify the list of sources to consider explicitly.
+In such a case, only source file base names are indicated and not
+their absolute or relative path names. The project manager is in charge of
+locating the specified source files in the specified source directories.
+
+@itemize @bullet
+@item By default, the project manager search for all source files of all
+ specified languages in all the source directories.
+
+ Since the project manager was initially developed for Ada environments, the
+ default language is usually Ada and the above project file is complete: it
+ defines without ambiguity the sources composing the project: that is to say,
+ all the sources in subdirectory "common" for the default language (Ada) using
+ the default naming convention.
+
+@cindex @code{Languages}
+ However, when compiling a multi-language application, or a pure C
+ application, the project manager must be told which languages are of
+ interest, which is done by setting the @b{Languages} attribute to a list of
+ strings, each of which is the name of a language. Tools like
+ @command{gnatmake} only know about Ada, while other tools like
+ @command{gprbuild} know about many more languages such as C, C++, Fortran,
+ assembly and others can be added dynamically.
+
+@cindex Naming scheme
+ Even when using only Ada, the default naming might not be suitable. Indeed,
+ how does the project manager recognizes an "Ada file" from any other
+ file? Project files can describe the naming scheme used for source files,
+ and override the default (@pxref{Naming Schemes}). The default is the
+ standard GNAT extension (@file{.adb} for bodies and @file{.ads} for
+ specs), which is what is used in our example, explaining why no naming scheme
+ is explicitly specified.
+ @xref{Naming Schemes}.
+
+@item @code{Source Files}
+ @cindex @code{Source_Files}
+ In some cases, source directories might contain files that should not be
+ included in a project. One can specify the explicit list of file names to
+ be considered through the @b{Source_Files} attribute.
+ When this attribute is defined, instead of looking at every file in the
+ source directories, the project manager takes only those names into
+ consideration reports errors if they cannot be found in the source
+ directories or does not correspond to the naming scheme.
+
+@item For various reasons, it is sometimes useful to have a project with no
+ sources (most of the time because the attributes defined in the project
+ file will be reused in other projects, as explained in @pxref{Organizing
+ Projects into Subsystems}. To do this, the attribute
+ @emph{Source_Files} is set to the empty list, i.e. @code{()}. Alternatively,
+ @emph{Source_Dirs} can be set to the empty list, with the same
+ result.
+
+@item @code{Source_List_File}
+@cindex @code{Source_List_File}
+ If there is a great number of files, it might be more convenient to use
+ the attribute @b{Source_List_File}, which specifies the full path of a file.
+ This file must contain a list of source file names (one per line, no
+ directory information) that are searched as if they had been defined
+ through @emph{Source_Files}. Such a file can easily be created through
+ external tools.
+
+ A warning is issued if both attributes @code{Source_Files} and
+ @code{Source_List_File} are given explicit values. In this case, the
+ attribute @code{Source_Files} prevails.
+
+@item @code{Excluded_Source_Files}
+@cindex @code{Excluded_Source_Files}
+@cindex @code{Locally_Removed_Files}
+@cindex @code{Excluded_Source_List_File}
+ Specifying an explicit list of files is not always convenient.It might be
+ more convenient to use the default search rules with specific exceptions.
+ This can be done thanks to the attribute @b{Excluded_Source_Files}
+ (or its synonym @b{Locally_Removed_Files}).
+ Its value is the list of file names that should not be taken into account.
+ This attribute is often used when extending a project, @xref{Project
+ Extension}. A similar attribute @b{Excluded_Source_List_File} plays the same
+ role but takes the name of file containing file names similarly to
+ @code{Source_List_File}.
+
+@end itemize
+
+@noindent
+In most simple cases, such as the above example, the default source file search
+behavior provides the expected result, and we do not need to add anything after
+setting @code{Source_Dirs}. The project manager automatically finds
+@file{pack.ads}, @file{pack.adb} and @file{proc.adb} as source files of the
+project.
+
+Note that it is considered an error for a project file to have no sources
+attached to it unless explicitly declared as mentionend above.
+
+If the order of the source directories is known statically, that is if
+@code{"/**"} is not used in the string list @code{Source_Dirs}, then there may
+be several files with the same source file name sitting in different
+directories of the project. In this case, only the file in the first directory
+is considered as a source of the project and the others are hidden. If
+@code{"/**"} is not used in the string list @code{Source_Dirs}, it is an error
+to have several files with the same source file name in the same directory
+@code{"/**"} subtree, since there would be an ambiguity as to which one should
+be used. However, two files with the same source file name may in two single
+directories or directory subtrees. In this case, the one in the first directory
+or directory subtree is a source of the project.
+
+@c ---------------------------------------------
+@node Object and Exec Directory
+@subsection Object and Exec Directory
+@c ---------------------------------------------
+
+@noindent
+The next step when writing a project is to indicate where the compiler should
+put the object files. In fact, the compiler and other tools might create
+several different kind of files (for GNAT, there is the object file and the ALI
+file for instance). One of the important concepts in projects is that most
+tools may consider source directories as read-only and do not attempt to create
+new or temporary files there. Instead, all files are created in the object
+directory. It is of course not true for project-aware IDEs, whose purpose it is
+to create the source files.
+
+@cindex @code{Object_Dir}
+The object directory is specified through the @b{Object_Dir} attribute.
+Its value is the path to the object directory, either absolute or
+relative to the directory containing the project file. This
+directory must already exist and be readable and writable, although
+some tools have a switch to create the directory if needed (See
+the switch @code{-p} for @command{gnatmake} and @command{gprbuild}).
+
+If the attribute @code{Object_Dir} is not specified, it defaults to
+the project directory, that is the directory containing the project file.
+
+For our example, we can specify the object dir in this way:
+
+@smallexample
+ @b{project} Build @b{is}
+ @b{for} Source_Dirs @b{use} ("common");
+ @b{for} Object_Dir @b{use} "obj"; -- <<<<
+ @b{end} Build;
+@end smallexample
+
+@noindent
+As mentioned earlier, there is a single object directory per project. As a
+result, if you have an existing system where the object files are spread in
+several directories, you can either move all of them into the same directory if
+you want to build it with a single project file, or study the section on
+subsystems (@pxref{Organizing Projects into Subsystems}) to see how each
+separate object directory can be associated with one of the subsystem
+constituting the application.
+
+When the @command{linker} is called, it usually creates an executable. By
+default, this executable is placed in the object directory of the project. It
+might be convenient to store it in its own directory.
+
+@cindex @code{Exec_Dir}
+This can be done through the @code{Exec_Dir} attribute, which, like
+@emph{Object_Dir} contains a single absolute or relative path and must point to
+an existing and writable directory, unless you ask the tool to create it on
+your behalf. When not specified, It defaults to the object directory and
+therefore to the project file's directory if neither @emph{Object_Dir} nor
+@emph{Exec_Dir} was specified.
+
+In the case of the example, let's place the executable in the root
+of the hierarchy, ie the same directory as @file{build.gpr}. Hence
+the project file is now
+
+@smallexample
+ @b{project} Build @b{is}
+ @b{for} Source_Dirs @b{use} ("common");
+ @b{for} Object_Dir @b{use} "obj";
+ @b{for} Exec_Dir @b{use} "."; -- <<<<
+ @b{end} Build;
+@end smallexample
+
+@c ---------------------------------------------
+@node Main Subprograms
+@subsection Main Subprograms
+@c ---------------------------------------------
+
+@noindent
+In the previous section, executables were mentioned. The project manager needs
+to be taught what they are. In a project file, an executable is indicated by
+pointing to source file of the main subprogram. In C this is the file that
+contains the @code{main} function, and in Ada the file that contains the main
+unit.
+
+There can be any number of such main files within a given project, and thus
+several executables can be built in the context of a single project file. Of
+course, one given executable might not (and in fact will not) need all the
+source files referenced by the project. As opposed to other build environments
+such as @command{makefile}, one does not need to specify the list of
+dependencies of each executable, the project-aware builders knows enough of the
+semantics of the languages to build ands link only the necessary elements.
+
+@cindex @code{Main}
+The list of main files is specified via the @b{Main} attribute. It contains
+a list of file names (no directories). If a project defines this
+attribute, it is not necessary to identify main files on the
+command line when invoking a builder, and editors like
+@command{GPS} will be able to create extra menus to spawn or debug the
+corresponding executables.
+
+@smallexample
+ @b{project} Build @b{is}
+ @b{for} Source_Dirs @b{use} ("common");
+ @b{for} Object_Dir @b{use} "obj";
+ @b{for} Exec_Dir @b{use} ".";
+ @b{for} Main @b{use} ("proc.adb"); -- <<<<
+ @b{end} Build;
+@end smallexample
+
+@noindent
+If this attribute is defined in the project, then spawning the builder
+with a command such as
+
+@smallexample
+ gnatmake ^-Pbuild^/PROJECT_FILE=build^
+@end smallexample
+
+@noindent
+automatically builds all the executables corresponding to the files
+listed in the @emph{Main} attribute. It is possible to specify one
+or more executables on the command line to build a subset of them.
+
+@c ---------------------------------------------
+@node Tools Options in Project Files
+@subsection Tools Options in Project Files
+@c ---------------------------------------------
+
+@noindent
+We now have a project file that fully describes our environment, and can be
+used to build the application with a simple @command{gnatmake} command as seen
+in the previous section. In fact, the empty project we showed immediately at
+the beginning (with no attribute at all) could already fullfill that need if it
+was put in the @file{common} directory.
+
+Of course, we always want more control. This section will show you how to
+specify the compilation switches that the various tools involved in the
+building of the executable should use.
+
+@cindex command line length
+Since source names and locations are described into the project file, it is not
+necessary to use switches on the command line for this purpose (switches such
+as -I for gcc). This removes a major source of command line length overflow.
+Clearly, the builders will have to communicate this information one way or
+another to the underlying compilers and tools they call but they usually use
+response files for this and thus should not be subject to command line
+overflows.
+
+Several tools are participating to the creation of an executable: the compiler
+produces object files from the source files; the binder (in the Ada case)
+creates an source file that takes care, among other things, of elaboration
+issues and global variables initialization; and the linker gathers everything
+into a single executable that users can execute. All these tools are known by
+the project manager and will be called with user defined switches from the
+project files. However, we need to introduce a new project file concept to
+express which switches to be used for any of the tools involved in the build.
+
+@cindex project file packages
+A project file is subdivided into zero or more @b{packages}, each of which
+contains the attributes specific to one tool (or one set of tools). Project
+files use an Ada-like syntax for packages. Package names permitted in project
+files are restricted to a predefined set (@pxref{Packages}), and the contents
+of packages are limited to a small set of constructs and attributes
+(@pxref{Attributes}).
+
+Our example project file can be extended with the following empty packages. At
+this stage, they could all be omitted since they are empty, but they show which
+packages would be involved in the build process.
+
+@smallexample
+ @b{project} Build @b{is}
+ @b{for} Source_Dirs @b{use} ("common");
+ @b{for} Object_Dir @b{use} "obj";
+ @b{for} Exec_Dir @b{use} ".";
+ @b{for} Main @b{use} ("proc.adb");
+ @b{end} Build;
+
+ @b{package} Builder @b{is} --<<< for gnatmake and gprbuild
+ @b{end} Builder;
+
+ @b{package} Compiler @b{is} --<<< for the compiler
+ @b{end} Builder;
+
+ @b{package} Binder @b{is} --<<< for the binder
+ @b{end} Builder;
+
+ @b{package} Linker @b{is} --<<< for the linker
+ @b{end} Builder;
+@end smallexample
+
+@noindent
+Let's first examine the compiler switches. As stated in the initial description
+of the example, we want to compile all files with @option{-O2}. This is a
+compiler switch, although it is usual, on the command line, to pass it to the
+builder which then passes it to the compiler. It is recommended to use directly
+the right package, which will make the setup easier to understand for other
+people.
+
+Several attributes can be used to specify the switches:
+
+@table @asis
+@item @b{Default_Switches}:
+@cindex @code{Default_Switches}
+ This is the first mention in this manual of an @b{indexed attribute}. When
+ this attribute is defined, one must supply an @emph{index} in the form of a
+ literal string.
+ In the case of @emph{Default_Switches}, the index is the name of the
+ language to which the switches apply (since a different compiler will
+ likely be used for each language, and each compiler has its own set of
+ switches). The value of the attribute is a list of switches.
+
+ In this example, we want to compile all Ada source files with the
+ @option{-O2} switch, and the resulting project file is as follows
+ (only the @code{Compiler} package is shown):
+
+ @smallexample
+ @b{package} Compiler @b{is}
+ @b{for} Default_Switches ("Ada") @b{use} ("-O2");
+ @b{end} Compiler;
+ @end smallexample
+
+@item @b{Switches}:
+@cindex @code{Switches}
+ in some cases, we might want to use specific switches
+ for one or more files. For instance, compiling @file{proc.adb} might not be
+ possible at high level of optimization because of a compiler issue.
+ In such a case, the @emph{Switches}
+ attribute (indexed on the file name) can be used and will override the
+ switches defined by @emph{Default_Switches}. Our project file would
+ become:
+
+ @smallexample
+ @b{package} Compiler @b{is}
+ @b{for} Default_Switches ("Ada") @b{use} ("-O2");
+ @b{for} Switches ("proc.adb") @b{use} ("-O0");
+ @b{end} Compiler;
+ @end smallexample
+
+ @noindent
+ @code{Switches} can also be given a language name as index instead of a file
+ name in which case it has the same semantics as @emph{Default_Switches}.
+
+@item @b{Local_Configuration_Pragmas}:
+@cindex @code{Local_Configuration_Pragmas}
+ this attribute may specify the path
+ of a file containing configuration pragmas for use by the Ada compiler,
+ such as @code{pragma Restrictions (No_Tasking)}. These pragmas will be
+ used for all the sources of the project.
+
+@end table
+
+The switches for the other tools are defined in a similar manner through the
+@b{Default_Switches} and @b{Switches} attributes, respectively in the
+@emph{Builder} package (for @command{gnatmake} and @command{gprbuild}),
+the @emph{Binder} package (binding Ada executables) and the @emph{Linker}
+package (for linking executables).
+
+@c ---------------------------------------------
+@node Compiling with Project Files
+@subsection Compiling with Project Files
+@c ---------------------------------------------
+
+@noindent
+Now that our project files are written, let's build our executable.
+Here is the command we would use from the command line:
+
+@smallexample
+ gnatmake ^-Pbuild^/PROJECT_FILE=build^
+@end smallexample
+
+@noindent
+This will automatically build the executables specified through the
+@emph{Main} attribute: for each, it will compile or recompile the
+sources for which the object file does not exist or is not up-to-date; it
+will then run the binder; and finally run the linker to create the
+executable itself.
+
+@command{gnatmake} only knows how to handle Ada files. By using
+@command{gprbuild} as a builder, you could automatically manage C files the
+same way: create the file @file{utils.c} in the @file{common} directory,
+set the attribute @emph{Languages} to @code{"(Ada, C)"}, and run
+
+@smallexample
+ gprbuild ^-Pbuild^/PROJECT_FILE=build^
+@end smallexample
+
+@noindent
+Gprbuild knows how to recompile the C files and will
+recompile them only if one of their dependencies has changed. No direct
+indication on how to build the various elements is given in the
+project file, which describes the project properties rather than a
+set of actions to be executed. Here is the invocation of
+@command{gprbuild} when building a multi-language program:
+
+@smallexample
+$ gprbuild -Pbuild
+gcc -c proc.adb
+gcc -c pack.adb
+gcc -c utils.c
+gprbind proc
+...
+gcc proc.o -o proc
+@end smallexample
+
+@noindent
+Notice the three steps described earlier:
+
+@itemize @bullet
+@item The first three gcc commands correspond to the compilation phase.
+@item The gprbind command corresponds to the post-compilation phase.
+@item The last gcc command corresponds to the final link.
+
+@end itemize
+
+@noindent
+@cindex @option{-v} option (for GPRbuild)
+The default output of GPRbuild's execution is kept reasonably simple and easy
+to understand. In particular, some of the less frequently used commands are not
+shown, and some parameters are abbreviated. So it is not possible to rerun the
+effect ofthe gprbuild command by cut-and-pasting its output. GPRbuild's option
+@code{-v} provides a much more verbose output which includes, among other
+information, more complete compilation, post-compilation and link commands.
+
+@c ---------------------------------------------
+@node Executable File Names
+@subsection Executable File Names
+@c ---------------------------------------------
+
+@noindent
+@cindex @code{Executable}
+By default, the executable name corresponding to a main file is
+computed from the main source file name. Through the attribute
+@b{Builder.Executable}, it is possible to change this default.
+
+For instance, instead of building @command{proc} (or @command{proc.exe}
+on Windows), we could configure our project file to build "proc1"
+(resp proc1.exe) with the following addition:
+
+@smallexample @c projectfile
+ project Build is
+ ... -- same as before
+ package Builder is
+ for Executable ("proc.adb") use "proc1";
+ end Builder
+ end Build;
+@end smallexample
+
+@noindent
+@cindex @code{Executable_Suffix}
+Attribute @b{Executable_Suffix}, when specified, may change the suffix
+of the executable files, when no attribute @code{Executable} applies:
+its value replace the platform-specific executable suffix.
+The default executable suffix is empty on UNIX and ".exe" on Windows.
+
+It is also possible to change the name of the produced executable by using the
+command line switch @option{-o}. When several mains are defined in the project,
+it is not possible to use the @option{-o} switch and the only way to change the
+names of the executable is provided by Attributes @code{Executable} and
+@code{Executable_Suffix}.
+
+@c ---------------------------------------------
+@node Avoid Duplication With Variables
+@subsection Avoid Duplication With Variables
+@c ---------------------------------------------
+
+@noindent
+To illustrate some other project capabilities, here is a slightly more complex
+project using similar sources and a main program in C:
+
+@smallexample @c projectfile
+project C_Main is
+ for Languages use ("Ada", "C");
+ for Source_Dirs use ("common");
+ for Object_Dir use "obj";
+ for Main use ("main.c");
+ package Compiler is
+ C_Switches := ("-pedantic");
+ for Default_Switches ("C") use C_Switches;
+ for Default_Switches ("Ada") use ("-gnaty");
+ for Switches ("main.c") use C_Switches & ("-g");
+ end Compiler;
+end C_Main;
+@end smallexample
+
+@noindent
+This project has many similarities with the previous one.
+As expected, its @code{Main} attribute now refers to a C source.
+The attribute @emph{Exec_Dir} is now omitted, thus the resulting
+executable will be put in the directory @file{obj}.
+
+The most noticeable difference is the use of a variable in the
+@emph{Compiler} package to store settings used in several attributes.
+This avoids text duplication, and eases maintenance (a single place to
+modify if we want to add new switches for C files). We will revisit
+the use of variables in the context of scenarios (@pxref{Scenarios in
+Projects}).
+
+In this example, we see how the file @file{main.c} can be compiled with
+the switches used for all the other C files, plus @option{-g}.
+In this specific situation the use of a variable could have been
+replaced by a reference to the @code{Default_Switches} attribute:
+
+@smallexample @c projectfile
+ for Switches ("c_main.c") use Compiler'Default_Switches ("C") & ("-g");
+@end smallexample
+
+@noindent
+Note the tick (@emph{'}) used to refer to attributes defined in a package.
+
+Here is the output of the GPRbuild command using this project:
+
+@smallexample
+$gprbuild -Pc_main
+gcc -c -pedantic -g main.c
+gcc -c -gnaty proc.adb
+gcc -c -gnaty pack.adb
+gcc -c -pedantic utils.c
+gprbind main.bexch
+...
+gcc main.o -o main
+@end smallexample
+
+@noindent
+The default switches for Ada sources,
+the default switches for C sources (in the compilation of @file{lib.c}),
+and the specific switches for @file{main.c} have all been taken into
+account.
+
+@c ---------------------------------------------
+@node Naming Schemes
+@subsection Naming Schemes
+@c ---------------------------------------------
+
+@noindent
+Sometimes an Ada software system is ported from one compilation environment to
+another (say GNAT), and the file are not named using the default GNAT
+conventions. Instead of changing all the file names, which for a variety of
+reasons might not be possible, you can define the relevant file naming scheme
+in the @b{Naming} package of your project file.
+
+The naming scheme has two distinct goals for the project manager: it
+allows finding of source files when searching in the source
+directories, and given a source file name it makes it possible to guess
+the associated language, and thus the compiler to use.
+
+Note that the use by the Ada compiler of pragmas Source_File_Name is not
+supported when using project files. You must use the features described in this
+paragraph. You can however specify other configuration pragmas
+(@pxref{Specifying Configuration Pragmas}).
+
+The following attributes can be defined in package @code{Naming}:
+
+@table @asis
+@item @b{Casing}:
+@cindex @code{Casing}
+ Its value must be one of @code{"lowercase"} (the default if
+ unspecified), @code{"uppercase"} or @code{"mixedcase"}. It describes the
+ casing of file names with regards to the Ada unit name. Given an Ada unit
+ My_Unit, the file name will respectively be @file{my_unit.adb} (lowercase),
+ @file{MY_UNIT.ADB} (uppercase) or @file{My_Unit.adb} (mixedcase).
+ On Windows, file names are case insensitive, so this attribute is
+ irrelevant.
+
+@item @b{Dot_Replacement}:
+@cindex @code{Dot_Replacement}
+ This attribute specifies the string that should replace the "." in unit
+ names. Its default value is @code{"-"} so that a unit
+ @code{Parent.Child} is expected to be found in the file
+ @file{parent-child.adb}. The replacement string must satisfy the following
+ requirements to avoid ambiguities in the naming scheme:
+
+ @itemize -
+ @item It must not be empty
+ @item It cannot start or end with an alphanumeric character
+ @item It cannot be a single underscore
+ @item It cannot start with an underscore followed by an alphanumeric
+ @item It cannot contain a dot @code{'.'} except if the entire string
+ is @code{"."}
+
+ @end itemize
+
+@item @b{Spec_Suffix} and @b{Specification_Suffix}:
+@cindex @code{Spec_Suffix}
+@cindex @code{Specification_Suffix}
+ For Ada, these attributes give the suffix used in file names that contain
+ specifications. For other languages, they give the extension for files
+ that contain declaration (header files in C for instance). The attribute
+ is indexed on the language.
+ The two attributes are equivalent, but the latter is obsolescent.
+ If @code{Spec_Suffix ("Ada")} is not specified, then the default is
+ @code{"^.ads^.ADS^"}.
+ The value must satisfy the following requirements:
+
+ @itemize -
+ @item It must not be empty
+ @item It cannot start with an alphanumeric character
+ @item It cannot start with an underscore followed by an alphanumeric character
+ @item It must include at least one dot
+
+ @end itemize
+
+@item @b{Body_Suffix} and @b{Implementation_Suffix}:
+@cindex @code{Body_Suffix}
+@cindex @code{Implementation_Suffix}
+ These attributes give the extension used for file names that contain
+ code (bodies in Ada). They are indexed on the language. The second
+ version is obsolescent and fully replaced by the first attribute.
+
+ These attributes must satisfy the same requirements as @code{Spec_Suffix}.
+ In addition, they must be different from any of the values in
+ @code{Spec_Suffix}.
+ If @code{Body_Suffix ("Ada")} is not specified, then the default is
+ @code{"^.adb^.ADB^"}.
+
+ If @code{Body_Suffix ("Ada")} and @code{Spec_Suffix ("Ada")} end with the
+ same string, then a file name that ends with the longest of these two
+ suffixes will be a body if the longest suffix is @code{Body_Suffix ("Ada")}
+ or a spec if the longest suffix is @code{Spec_Suffix ("Ada")}.
+
+ If the suffix does not start with a '.', a file with a name exactly equal
+ to the suffix will also be part of the project (for instance if you define
+ the suffix as @code{Makefile}, a file called @file{Makefile} will be part
+ of the project. This capability is usually not interesting when building.
+ However, it might become useful when a project is also used to
+ find the list of source files in an editor, like the GNAT Programming System
+ (GPS).
+
+@item @b{Separate_Suffix}:
+@cindex @code{Separate_Suffix}
+ This attribute is specific to Ada. It denotes the suffix used in file names
+ that contain separate bodies. If it is not specified, then it defaults to
+ same value as @code{Body_Suffix ("Ada")}. The same rules apply as for the
+ @code{Body_Suffix} attribute. The only accepted index is "Ada".
+
+@item @b{Spec} or @b{Specification}:
+@cindex @code{Spec}
+@cindex @code{Specification}
+ This attribute @code{Spec} can be used to define the source file name for a
+ given Ada compilation unit's spec. The index is the literal name of the Ada
+ unit (case insensitive). The value is the literal base name of the file that
+ contains this unit's spec (case sensitive or insensitive depending on the
+ operating system). This attribute allows the definition of exceptions to the
+ general naming scheme, in case some files do not follow the usual
+ convention.
+
+ When a source file contains several units, the relative position of the unit
+ can be indicated. The first unit in the file is at position 1
+
+ @smallexample @c projectfile
+ for Spec ("MyPack.MyChild") use "mypack.mychild.spec";
+ for Spec ("top") use "foo.a" at 1;
+ for Spec ("foo") use "foo.a" at 2;
+ @end smallexample
+
+@item @b{Body} or @b{Implementation}:
+@cindex @code{Body}
+@cindex @code{Implementation}
+ These attribute play the same role as @emph{Spec} for Ada bodies.
+
+@item @b{Specification_Exceptions} and @b{Implementation_Exceptions}:
+@cindex @code{Specification_Exceptions}
+@cindex @code{Implementation_Exceptions}
+ These attributes define exceptions to the naming scheme for languages
+ other than Ada. They are indexed on the language name, and contain
+ a list of file names respectively for headers and source code.
+
+
+@end table
+
+@ifclear vms
+For example, the following package models the Apex file naming rules:
+
+@smallexample @c projectfile
+@group
+ package Naming is
+ for Casing use "lowercase";
+ for Dot_Replacement use ".";
+ for Spec_Suffix ("Ada") use ".1.ada";
+ for Body_Suffix ("Ada") use ".2.ada";
+ end Naming;
+@end group
+@end smallexample
+@end ifclear
+
+@ifset vms
+For example, the following package models the DEC Ada file naming rules:
+
+@smallexample @c projectfile
+@group
+ package Naming is
+ for Casing use "lowercase";
+ for Dot_Replacement use "__";
+ for Spec_Suffix ("Ada") use "_.ada";
+ for Body_Suffix ("Ada") use ".ada";
+ end Naming;
+@end group
+@end smallexample
+
+@noindent
+(Note that @code{Casing} is @code{"lowercase"} because GNAT gets the file
+names in lower case)
+@end ifset
+
+@c ---------------------------------------------
+@node Organizing Projects into Subsystems
+@section Organizing Projects into Subsystems
+@c ---------------------------------------------
+
+@noindent
+A @b{subsystem} is a coherent part of the complete system to be built. It is
+represented by a set of sources and one single object directory. A system can
+be composed of a single subsystem when it is simple as we have seen in the
+first section. Complex systems are usually composed of several interdependent
+subsystems. A subsystem is dependent on another subsystem if knowledge of the
+other one is required to build it, and in particular if visibility on some of
+the sources of this other subsystem is required. Each subsystem is usually
+represented by its own project file.
+
+In this section, the previous example is being extended. Let's assume some
+sources of our @code{Build} project depend on other sources.
+For instance, when building a graphical interface, it is usual to depend upon
+a graphical library toolkit such as GtkAda. Furthermore, we also need
+sources from a logging module we had previously written.
+
+@menu
+* Project Dependencies::
+* Cyclic Project Dependencies::
+* Sharing Between Projects::
+* Global Attributes::
+@end menu
+
+@c ---------------------------------------------
+@node Project Dependencies
+@subsection Project Dependencies
+@c ---------------------------------------------
+
+@noindent
+GtkAda comes with its own project file (appropriately called
+@file{gtkada.gpr}), and we will assume we have already built a project
+called @file{logging.gpr} for the logging module. With the information provided
+so far in @file{build.gpr}, building the application would fail with an error
+indicating that the gtkada and logging units that are relied upon by the sources
+of this project cannot be found.
+
+This is easily solved by adding the following @b{with} clauses at the beginning
+of our project:
+
+@smallexample @c projectfile
+ with "gtkada.gpr";
+ with "a/b/logging.gpr";
+ project Build is
+ ... -- as before
+ end Build;
+@end smallexample
+
+@noindent
+@cindex @code{Externally_Built}
+When such a project is compiled, @command{gnatmake} will automatically
+check the other projects and recompile their sources when needed. It will also
+recompile the sources from @code{Build} when needed, and finally create the
+executable. In some cases, the implementation units needed to recompile a
+project are not available, or come from some third-party and you do not want to
+recompile it yourself. In this case, the attribute @b{Externally_Built} to
+"true" can be set, indicating to the builder that this project can be assumed
+to be up-to-date, and should not be considered for recompilation. In Ada, if
+the sources of this externally built project were compiled with another version
+of the compiler or with incompatible options, the binder will issue an error.
+
+The project's @code{with} clause has several effects. It provides source
+visibility between projects during the compilation process. It also guarantees
+that the necessary object files from @code{Logging} and @code{GtkAda} are
+available when linking @code{Build}.
+
+As can be seen in this example, the syntax for importing projects is similar
+to the syntax for importing compilation units in Ada. However, project files
+use literal strings instead of names, and the @code{with} clause identifies
+project files rather than packages.
+
+Each literal string after @code{with} is the path
+(absolute or relative) to a project file. The @code{.gpr} extension is
+optional, although we recommend adding it. If no extension is specified,
+and no project file with the @file{^.gpr^.GPR^} extension is found, then
+the file is searched for exactly as written in the @code{with} clause,
+that is with no extension.
+
+@cindex project path
+When a relative path or a base name is used, the
+project files are searched relative to each of the directories in the
+@b{project path}. This path includes all the directories found with the
+following algorithm, in that order, as soon as a matching file is found,
+the search stops:
+
+@itemize @bullet
+@item First, the file is searched relative to the directory that contains the
+ current project file.
+@item
+@cindex @code{ADA_PROJECT_PATH}
+@cindex @code{GPR_PROJECT_PATH}
+ Then it is searched relative to all the directories specified in the
+ ^environment variables^logical names^ @b{GPR_PROJECT_PATH} and
+ @b{ADA_PROJECT_PATH} (in that order) if they exist. The former is
+ recommended, the latter is kept for backward compatibility.
+@item Finally, it is searched relative to the default project directories.
+ Such directories depends on the tool used. For @command{gnatmake}, there is
+ one default project directory: @file{<prefix>/lib/gnat/}. In our example,
+ @file{gtkada.gpr} is found in the predefined directory if it was installed at
+ the same root as GNAT.
+
+@end itemize
+
+@noindent
+Some tools also support extending the project path from the command line,
+generally through the @option{-aP}. You can see the value of the project
+path by using the @command{gnatls -v} command.
+
+Any symbolic link will be fully resolved in the directory of the
+importing project file before the imported project file is examined.
+
+Any source file in the imported project can be used by the sources of the
+importing project, transitively.
+Thus if @code{A} imports @code{B}, which imports @code{C}, the sources of
+@code{A} may depend on the sources of @code{C}, even if @code{A} does not
+import @code{C} explicitly. However, this is not recommended, because if
+and when @code{B} ceases to import @code{C}, some sources in @code{A} will
+no longer compile. @command{gprbuild} has a switch @option{--no-indirect-imports}
+that will report such indirect dependencies.
+
+One very important aspect of a project hierarchy is that
+@b{a given source can only belong to one project} (otherwise the project manager
+would not know which settings apply to it and when to recompile it). It means
+that different project files do not usually share source directories or
+when they do, they need to specify precisely which project owns which sources
+using attribute @code{Source_Files} or equivalent. By contrast, 2 projects
+can each own a source with the same base file name as long as they live in
+different directories. The latter is not true for Ada Sources because of the
+correlation betwen source files and Ada units.
+
+@c ---------------------------------------------
+@node Cyclic Project Dependencies
+@subsection Cyclic Project Dependencies
+@c ---------------------------------------------
+
+@noindent
+Cyclic dependencies are mostly forbidden:
+if @code{A} imports @code{B} (directly or indirectly) then @code{B}
+is not allowed to import @code{A}. However, there are cases when cyclic
+dependencies would be beneficial. For these cases, another form of import
+between projects exists: the @b{limited with}. A project @code{A} that
+imports a project @code{B} with a straight @code{with} may also be imported,
+directly or indirectly, by @code{B} through a @code{limited with}.
+
+The difference between straight @code{with} and @code{limited with} is that
+the name of a project imported with a @code{limited with} cannot be used in the
+project importing it. In particular, its packages cannot be renamed and
+its variables cannot be referred to.
+
+@smallexample @c 0projectfile
+with "b.gpr";
+with "c.gpr";
+project A is
+ For Exec_Dir use B'Exec_Dir; -- ok
+end A;
+
+limited with "a.gpr"; -- Cyclic dependency: A -> B -> A
+project B is
+ For Exec_Dir use A'Exec_Dir; -- not ok
+end B;
+
+with "d.gpr";
+project C is
+end C;
+
+limited with "a.gpr"; -- Cyclic dependency: A -> C -> D -> A
+project D is
+ For Exec_Dir use A'Exec_Dir; -- not ok
+end D;
+@end smallexample
+
+@c ---------------------------------------------
+@node Sharing Between Projects
+@subsection Sharing Between Projects
+@c ---------------------------------------------
+
+@noindent
+When building an application, it is common to have similar needs in severa of
+the projects corresponding to the subsystems under construction. For instance,
+they will all have the same compilation switches.
+
+As seen before (@pxref{Tools Options in Project Files}), setting compilation
+switches for all sources of a subsystem is simple: it is just a matter of
+adding a @code{Compiler.Default_Switches} attribute to each project files with
+the same value. Of course, that means duplication of data, and both places need
+to be changed in order to recompile the whole application with different
+switches. It can become a real problem if there are many subsystems and thus
+many project files to edit.
+
+There are two main approaches to avoiding this duplication:
+
+@itemize @bullet
+@item Since @file{build.gpr} imports @file{logging.gpr}, we could change it
+ to reference the attribute in Logging, either through a package renaming,
+ or by referencing the attribute. The following example shows both cases:
+
+ @smallexample @c projectfile
+ project Logging is
+ package Compiler is
+ for Switches ("Ada") use ("-O2");
+ end Compiler;
+ package Binder is
+ for Switches ("Ada") use ("-E");
+ end Binder;
+ end Logging;
+
+ with "logging.gpr";
+ project Build is
+ package Compiler renames Logging.Compiler;
+ package Binder is
+ for Switches ("Ada") use Logging.Binder'Switches ("Ada");
+ end Binder;
+ end Build;
+ @end smallexample
+
+ @noindent
+ The solution used for @code{Compiler} gets the same value for all
+ attributes of the package, but you cannot modify anything from the
+ package (adding extra switches or some exceptions). The second
+ version is more flexible, but more verbose.
+
+ If you need to refer to the value of a variable in an imported
+ project, rather than an attribute, the syntax is similar but uses
+ a "." rather than an apostrophe. For instance:
+
+ @smallexample @c projectfile
+ with "imported";
+ project Main is
+ Var1 := Imported.Var;
+ end Main;
+ @end smallexample
+
+@item The second approach is to define the switches in a third project.
+ That project is setup without any sources (so that, as opposed to
+ the first example, none of the project plays a special role), and
+ will only be used to define the attributes. Such a project is
+ typically called @file{shared.gpr}.
+
+ @smallexample @c projectfile
+ abstract project Shared is
+ for Source_Files use (); -- no project
+ package Compiler is
+ for Switches ("Ada") use ("-O2");
+ end Compiler;
+ end Shared;
+
+ with "shared.gpr";
+ project Logging is
+ package Compiler renames Shared.Compiler;
+ end Logging;
+
+ with "shared.gpr";
+ project Build is
+ package Compiler renames Shared.Compiler;
+ end Build;
+ @end smallexample
+
+ @noindent
+ As for the first example, we could have chosen to set the attributes
+ one by one rather than to rename a package. The reason we explicitly
+ indicate that @code{Shared} has no sources is so that it can be created
+ in any directory and we are sure it shares no sources with @code{Build}
+ or @code{Logging}, which of course would be invalid.
+
+@cindex project qualifier
+ Note the additional use of the @b{abstract} qualifier in @file{shared.gpr}.
+ This qualifier is optional, but helps convey the message that we do not
+ intend this project to have sources (@pxref{Qualified Projects} for
+ more qualifiers).
+@end itemize
+
+
+@c ---------------------------------------------
+@node Global Attributes
+@subsection Global Attributes
+@c ---------------------------------------------
+
+@noindent
+We have already seen many examples of attributes used to specify a special
+option of one of the tools involved in the build process. Most of those
+attributes are project specific. That it to say, they only affect the invocation
+of tools on the sources of the project where they are defined.
+
+There are a few additional attributes that apply to all projects in a
+hierarchy as long as they are defined on the "main" project.
+The main project is the project explicitly mentioned on the command-line.
+The project hierarchy is the "with"-closure of the main project.
+
+Here is a list of commonly used global attributes:
+
+@table @asis
+@item @b{Builder.Global_Configuration_Pragmas}:
+@cindex @code{Global_Configuration_Pragmas}
+ This attribute points to a file that contains configuration pragmas
+ to use when building executables. These pragmas apply for all
+ executables build from this project hierarchy. As we have seen before,
+ additional pragmas can be specified on a per-project basis by setting the
+ @code{Compiler.Local_Configuration_Pragmas} attribute.
+
+@item @b{Builder.Global_Compilation_Switches}:
+@cindex @code{Global_Compilation_Switches}
+ This attribute is a list of compiler switches to use when compiling any
+ source file in the project hierarchy. These switches are used in addition
+ to the ones defined in the @code{Compiler} package, which only apply to
+ the sources of the corresponding project. This attribute is indexed on
+ the name of the language.
+
+@end table
+
+Using such global capabilities is convenient. It can also lead to unexpected
+behavior. Especially when several subsystems are shared among different main
+projects and the different global attributes are not
+compatible. Note that using aggregate projects can be a safer and more powerful
+replacement to global attributes.
+
+@c ---------------------------------------------
+@node Scenarios in Projects
+@section Scenarios in Projects
+@c ---------------------------------------------
+
+@noindent
+Various aspects of the projects can be modified based on @b{scenarios}. These
+are user-defined modes that change the behavior of a project. Typical
+examples are the setup of platform-specific compiler options, or the use of
+a debug and a release mode (the former would activate the generation of debug
+information, when the second will focus on improving code optimization).
+
+Let's enhance our example to support a debug and a release modes.The issue is to
+let the user choose what kind of system he is building:
+use @option{-g} as compiler switches in debug mode and @option{-O2}
+in release mode. We will also setup the projects so that we do not share the
+same object directory in both modes, otherwise switching from one to the other
+might trigger more recompilations than needed or mix objects from the 2 modes.
+
+One naive approach is to create two different project files, say
+@file{build_debug.gpr} and @file{build_release.gpr}, that set the appropriate
+attributes as explained in previous sections. This solution does not scale well,
+because in presence of multiple projects depending on each other,
+you will also have to duplicate the complete hierarchy and adapt the project
+files to point to the right copies.
+
+@cindex scenarios
+Instead, project files support the notion of scenarios controlled
+by external values. Such values can come from several sources (in decreasing
+order of priority):
+
+@table @asis
+@item @b{Command line}:
+@cindex @option{-X}
+ When launching @command{gnatmake} or @command{gprbuild}, the user can pass
+ extra @option{-X} switches to define the external value. In
+ our case, the command line might look like
+
+ @smallexample
+ gnatmake -Pbuild.gpr -Xmode=debug
+ or gnatmake -Pbuild.gpr -Xmode=release
+ @end smallexample
+
+@item @b{^Environment variables^Logical names^}:
+ When the external value does not come from the command line, it can come from
+ the value of ^environment variables^logical names^ of the appropriate name.
+ In our case, if ^an environment variable^a logical name^ called "mode"
+ exist, its value will be taken into account.
+
+@item @b{External function second parameter}
+
+@end table
+
+@cindex @code{external}
+We now need to get that value in the project. The general form is to use
+the predefined function @b{external} which returns the current value of
+the external. For instance, we could setup the object directory to point to
+either @file{obj/debug} or @file{obj/release} by changing our project to
+
+@smallexample @c projectfile
+ project Build is
+ for Object_Dir use "obj/" & external ("mode", "debug");
+ ... -- as before
+ end Build;
+@end smallexample
+
+@noindent
+The second parameter to @code{external} is optional, and is the default
+value to use if "mode" is not set from the command line or the environment.
+
+In order to set the switches according to the different scenarios, other
+constructs have to be introduced such as typed variables and case statements.
+
+@cindex typed variable
+@cindex case statement
+A @b{typed variable} is a variable that
+can take only a limited number of values, similar to an enumeration in Ada.
+Such a variable can then be used in a @b{case statement} and create conditional
+sections in the project. The following example shows how this can be done:
+
+@smallexample @c projectfile
+ project Build is
+ type Mode_Type is ("debug", "release"); -- all possible values
+ Mode : Mode_Type := external ("mode", "debug"); -- a typed variable
+
+ package Compiler is
+ case Mode is
+ when "debug" =>
+ for Switches ("Ada") use ("-g");
+ when "release" =>
+ for Switches ("Ada") use ("-O2");
+ end case;
+ end Compiler;
+ end Build;
+@end smallexample
+
+@noindent
+The project has suddenly grown in size, but has become much more flexible.
+@code{Mode_Type} defines the only valid values for the @code{mode} variable. If
+any other value is read from the environment, an error is reported and the
+project is considered as invalid.
+
+The @code{Mode} variable is initialized with an external value
+defaulting to @code{"debug"}. This default could be omitted and that would
+force the user to define the value. Finally, we can use a case statement to set the
+switches depending on the scenario the user has chosen.
+
+Most aspects of the projects can depend on scenarios. The notable exception
+are project dependencies (@code{with} clauses), which may not depend on a scenario.
+
+Scenarios work the same way with @b{project hierarchies}: you can either
+duplicate a variable similar to @code{Mode} in each of the project (as long
+as the first argument to @code{external} is always the same and the type is
+the same), or simply set the variable in the @file{shared.gpr} project
+(@pxref{Sharing Between Projects}).
+
+@c ---------------------------------------------
+@node Library Projects
+@section Library Projects
+@c ---------------------------------------------
+
+@noindent
+So far, we have seen examples of projects that create executables. However,
+it is also possible to create libraries instead. A @b{library} is a specific
+type of subsystem where, for convenience, objects are grouped together
+using system-specific means such as archives or windows DLLs.
+
+Library projects provide a system- and language-independent way of building both @b{static}
+and @b{dynamic} libraries. They also support the concept of @b{standalone
+libraries} (SAL) which offers two significant properties: the elaboration
+(e.g. initialization) of the library is either automatic or very simple;
+a change in the
+implementation part of the library implies minimal post-compilation actions on
+the complete system and potentially no action at all for the rest of the
+system in the case of dynamic SALs.
+
+The GNAT Project Manager takes complete care of the library build, rebuild and
+installation tasks, including recompilation of the source files for which
+objects do not exist or are not up to date, assembly of the library archive, and
+installation of the library (i.e., copying associated source, object and
+@file{ALI} files to the specified location).
+
+@menu
+* Building Libraries::
+* Using Library Projects::
+* Stand-alone Library Projects::
+* Installing a library with project files::
+@end menu
+
+@c ---------------------------------------------
+@node Building Libraries
+@subsection Building Libraries
+@c ---------------------------------------------
+
+@noindent
+Let's enhance our example and transform the @code{logging} subsystem into a
+library.In orer to do so, a few changes need to be made to @file{logging.gpr}.
+A number of specific attributes needs to be defined: at least @code{Library_Name}
+and @code{Library_Dir}; in addition, a number of other attributes can be used
+to specify specific aspects of the library. For readablility, it is also
+recommended (although not mandatory), to use the qualifier @code{library} in
+front of the @code{project} keyword.
+
+@table @asis
+@item @b{Library_Name}:
+@cindex @code{Library_Name}
+ This attribute is the name of the library to be built. There is no
+ restriction on the name of a library imposed by the project manager;
+ however, there may be system specific restrictions on the name.
+ In general, it is recommended to stick to alphanumeric characters
+ (and possibly underscores) to help portability.
+
+@item @b{Library_Dir}:
+@cindex @code{Library_Dir}
+ This attribute is the path (absolute or relative) of the directory where
+ the library is to be installed. In the process of building a library,
+ the sources are compiled, the object files end up in the explicit or
+ implicit @code{Object_Dir} directory. When all sources of a library
+ are compiled, some of the compilation artifacts, including the library itself,
+ are copied to the library_dir directory. This directory must exists and be
+ writable. It must also be different from the object directory so that cleanup
+ activities in the Library_Dir do not affect recompilation needs.
+
+@end table
+
+Here is the new version of @file{logging.gpr} that makes it a library:
+
+@smallexample @c projectfile
+library project Logging is -- "library" is optional
+ for Library_Name use "logging"; -- will create "liblogging.a" on Unix
+ for Object_Dir use "obj";
+ for Library_Dir use "lib"; -- different from object_dir
+end Logging;
+@end smallexample
+
+@noindent
+Once the above two attributes are defined, the library project is valid and
+is enough for building a library with default characteristics.
+Other library-related attributes can be used to change the defaults:
+
+@table @asis
+@item @b{Library_Kind}:
+@cindex @code{Library_Kind}
+ The value of this attribute must be either @code{"static"}, @code{"dynamic"} or
+ @code{"relocatable"} (the latter is a synonym for dynamic). It indicates
+ which kind of library should be build (the default is to build a
+ static library, that is an archive of object files that can potentially
+ be linked into a static executable). When the library is set to be dynamic,
+ a separate image is created that will be loaded independnently, usually
+ at the start of the main program execution. Support for dynamic libraries is
+ very platform specific, for instance on Windows it takes the form of a DLL
+ while on GNU/Linux, it is a dynamic elf image whose suffix is usually
+ @file{.so}. Library project files, on the other hand, can be written in
+ a platform independant way so that the same project file can be used to build
+ a library on different Oses.
+
+ If you need to build both a static and a dynamic library, it is recommended
+ use two different object directories, since in some cases some extra code
+ needs to be generated for the latter. For such cases, one can
+ either define two different project files, or a single one which uses scenarios
+ to indicate at the various kinds of library to be build and their
+ corresponding object_dir.
+
+@cindex @code{Library_ALI_Dir}
+@item @b{Library_ALI_Dir}:
+ This attribute may be specified to indicate the directory where the ALI
+ files of the library are installed. By default, they are copied into the
+ @code{Library_Dir} directory, but as for the executables where we have a
+ separate @code{Exec_Dir} attribute, you might want to put them in a separate
+ directory since there can be hundreds of them. The same restrictions as for
+ the @code{Library_Dir} attribute apply.
+
+@cindex @code{Library_Version}
+@item @b{Library_Version}:
+ This attribute is platform dependent, and has no effect on VMS and Windows.
+ On Unix, it is used only for dynamic libraries as the internal
+ name of the library (the @code{"soname"}). If the library file name (built
+ from the @code{Library_Name}) is different from the @code{Library_Version},
+ then the library file will be a symbolic link to the actual file whose name
+ will be @code{Library_Version}. This follows the usual installation schemes
+ for dynamic libraries on many Unix systems.
+
+@smallexample @c projectfile
+@group
+ project Logging is
+ Version := "1";
+ for Library_Dir use "lib";
+ for Library_Name use "logging";
+ for Library_Kind use "dynamic";
+ for Library_Version use "liblogging.so." & Version;
+ end Logging;
+@end group
+@end smallexample
+
+ @noindent
+ After the compilation, the directory @file{lib} will contain both a
+ @file{libdummy.so.1} library and a symbolic link to it called
+ @file{libdummy.so}.
+
+@cindex @code{Library_GCC}
+@item @b{Library_GCC}:
+ This attribute is the name of the tool to use instead of "gcc" to link shared
+ libraries. A common use of this attribute is to define a wrapper script that
+ accomplishes specific actions before calling gcc (which itself is calling the
+ linker to build the library image).
+
+@cindex @code{Linker_Options}
+@item @b{Linker.Linker_Options}:
+ This attribute specifies additional switches to be given to the linker when
+ linking an executable. It is ignored when defined in the main project and
+ taken into account in all other projects that are imported directly or
+ indirectly. These switches complement the @code{Linker.Switches}
+ defined in the main project. This is useful when a particular subsystem
+ depends on an external library: adding this dependency as a
+ @code{Linker_Options} in the project of the subsystem is more convenient than
+ adding it to all the @code{Linker.Switches} of the main projects that depend
+ upon this subsystem.
+@end table
+
+
+@c ---------------------------------------------
+@node Using Library Projects
+@subsection Using Library Projects
+@c ---------------------------------------------
+
+@noindent
+When the builder detects that a project file is a library project file, it
+recompiles all sources of the project that need recompilation and rebuild the
+library if any of the sources have been recompiled. It then groups all object
+files into a single file, which is a shared or a static library. This library
+can later on be linked with multiple executables. Note that the use
+of shard libraries reduces the size of the final executable and can also reduce
+the memory footprint at execution time when the library is shared among several
+executables.
+
+It is also possible to build @b{multi-language libraries}. When using
+@command{gprbuild} as a builder, multi-language library projects allow naturally
+the creation of multi-language libraries . @command{gnatmake}, does n ot try to
+compile non Ada sources. However, when the project is multi-language, it will
+automatically link all object files found in the object directory, whether or
+not they were compiled from an Ada source file. This specific behavior does not
+apply to Ada-only projects which only take into account the objects
+corresponding to the sources of the project.
+
+A non-library project can import a library project. When the builder is invoked
+on the former, the library of the latter is only rebuilt when absolutely
+necessary. For instance, if a unit of the
+library is not up-to-date but non of the executables need this unit, then the
+unit is not recompiled and the library is not reassembled.
+For instance, let's assume in our example that logging has the following
+sources: @file{log1.ads}, @file{log1.adb}, @file{log2.ads} and
+@file{log2.adb}. If @file{log1.adb} has been modified, then the library
+@file{liblogging} will be rebuilt when compiling all the sources of
+@code{Build} only if @file{proc.ads}, @file{pack.ads} or @file{pack.adb}
+include a @code{"with Log1"}.
+
+To ensure that all the sources in the @code{Logging} library are
+up to date, and that all the sources of @code{Build} are also up to date,
+the following two commands needs to be used:
+
+@smallexample
+gnatmake -Plogging.gpr
+gnatmake -Pbuild.gpr
+@end smallexample
+
+@noindent
+All @file{ALI} files will also be copied from the object directory to the
+library directory. To build executables, @command{gnatmake} will use the
+library rather than the individual object files.
+
+@ifclear vms
+Library projects can also be useful to describe a library that need to be used
+but, for some reason, cannot be rebuilt. For instance, it is the case when some
+of the library sources are not available. Such library projects need simply to
+use the @code{Externally_Built} attribute as in the example below:
+
+@smallexample @c projectfile
+library project Extern_Lib is
+ for Languages use ("Ada", "C");
+ for Source_Dirs use ("lib_src");
+ for Library_Dir use "lib2";
+ for Library_Kind use "dynamic";
+ for Library_Name use "l2";
+ for Externally_Built use "true"; -- <<<<
+end Extern_Lib;
+@end smallexample
+
+@noindent
+In the case of externally built libraries, the @code{Object_Dir}
+attribute does not need to be specified because it will never be
+used.
+
+The main effect of using such an externally built library project is mostly to
+affect the linker command in order to reference the desired library. It can
+also be achieved by using @code{Linker.Linker_Options} or @code{Linker.Switches}
+in the project corresponding to the subsystem needing this external library.
+This latter method is more straightforward in simple cases but when several
+subsystems depend upon the same external library, finding the proper place
+for the @code{Linker.Linker_Options} might not be easy and if it is
+not placed properly, the final link command is likely to present ordering issues.
+In such a situation, it is better to use the externally built library project
+so that all other subsystems depending on it can declare this dependency thanks
+to a project @code{with} clause, which in turn will trigger the builder to find
+the proper order of libraries in the final link command.
+@end ifclear
+
+@c ---------------------------------------------
+@node Stand-alone Library Projects
+@subsection Stand-alone Library Projects
+@c ---------------------------------------------
+
+@noindent
+@cindex standalone libraries
+A @b{stand-alone library} is a library that contains the necessary code to
+elaborate the Ada units that are included in the library. A stand-alone
+library is a convenient way to add an Ada subsystem to a more global system
+whose main is not in Ada since it makes the elaboration of the Ada part mostly
+transparent. However, stand-alone libraries are also useful when the main is in
+Ada: they provide a means for minimizing relinking & redeployement of complex
+systems when localized changes are made.
+
+The most proeminent characteristic of a stand-alone library is that it offers a
+distinction between interface units and implementation units. Only the former
+are visible to units outside the library. A stand-alone library project is thus
+characterised by a third attribute, @b{Library_Interface}, in addition to the
+two attributes that make a project a Library Project (@code{Library_Name} and
+@code{Library_Dir}).
+
+@table @asis
+@item @b{Library_Interface}:
+@cindex @code{Library_Interface}
+ This attribute defines an explicit subset of the units of the project.
+ Projects importing this library project may only "with" units whose sources
+ are listed in the @code{Library_Interface}. Other sources are considered
+ implementation units.
+
+@smallexample @c projectfile
+@group
+ for Library_Dir use "lib";
+ for Library_Name use "loggin";
+ for Library_Interface use ("lib1", "lib2"); -- unit names
+@end group
+@end smallexample
+
+@end table
+
+In order to include the elaboration code in the stand-alone library, the binder
+is invoked on the closure of the library units creating a package whose name
+depends on the library name (^b~logging.ads/b^B$LOGGING.ADS/B^ in the example).
+This binder-generated package includes @b{initialization} and @b{finalization}
+procedures whose names depend on the library name (@code{logginginit} and
+@code{loggingfinal} in the example). The object corresponding to this package is
+included in the library.
+
+@table @asis
+@item @b{Library_Auto_Init}:
+@cindex @code{Library_Auto_Init}
+ A dynamic stand-alone Library is automatically initialized
+ if automatic initialization of Stand-alone Libraries is supported on the
+ platform and if attribute @b{Library_Auto_Init} is not specified or
+ is specified with the value "true". A static Stand-alone Library is never
+ automatically initialized. Specifying "false" for this attribute
+ prevent automatic initialization.
+
+ When a non-automatically initialized stand-alone library is used in an
+ executable, its initialization procedure must be called before any service of
+ the library is used. When the main subprogram is in Ada, it may mean that the
+ initialization procedure has to be called during elaboration of another
+ package.
+
+@item @b{Library_Dir}:
+@cindex @code{Library_Dir}
+ For a stand-alone library, only the @file{ALI} files of the interface units
+ (those that are listed in attribute @code{Library_Interface}) are copied to
+ the library directory. As a consequence, only the interface units may be
+ imported from Ada units outside of the library. If other units are imported,
+ the binding phase will fail.
+
+@item @b{Binder.Default_Switches}:
+ When a stand-alone library is bound, the switches that are specified in
+ the attribute @b{Binder.Default_Switches ("Ada")} are
+ used in the call to @command{gnatbind}.
+
+@item @b{Library_Options}:
+@cindex @code{Library_Options}
+ This attribute may be used to specified additional switches to @command{gcc}
+ when linking the library.
+
+@item @b{Library_Src_Dir}:
+@cindex @code{Library_Src_Dir}
+ This attribute defines the location (absolute or relative to the project
+ directory) where the sources of the interface units are copied at
+ installation time.
+ These sources includes the specs of the interface units along with the closure
+ of sources necessary to compile them successfully. That may include bodies and
+ subunits, when pragmas @code{Inline} are used, or when there is a generic
+ units in the spec. This directory cannot point to the object directory or
+ one of the source directories, but it can point to the library directory,
+ which is the default value for this attribute.
+
+@item @b{Library_Symbol_Policy}:
+@cindex @code{Library_Symbol_Policy}
+ This attribute controls the export of symbols and, on some platforms (like
+ VMS) that have the notions of major and minor IDs built in the library
+ files, it controls the setting of these IDs. It is not supported on all
+ platforms (where it will just have no effect). It may have one of the
+ following values:
+
+ @itemize -
+ @item @code{"autonomous"} or @code{"default"}: exported symbols are not controlled
+ @item @code{"compliant"}: if attribute @b{Library_Reference_Symbol_File}
+ is not defined, then it is equivalent to policy "autonomous". If there
+ are exported symbols in the reference symbol file that are not in the
+ object files of the interfaces, the major ID of the library is increased.
+ If there are symbols in the object files of the interfaces that are not
+ in the reference symbol file, these symbols are put at the end of the list
+ in the newly created symbol file and the minor ID is increased.
+ @item @code{"controlled"}: the attribute @b{Library_Reference_Symbol_File} must be
+ defined. The library will fail to build if the exported symbols in the
+ object files of the interfaces do not match exactly the symbol in the
+ symbol file.
+ @item @code{"restricted"}: The attribute @b{Library_Symbol_File} must be defined.
+ The library will fail to build if there are symbols in the symbol file that
+ are not in the exported symbols of the object files of the interfaces.
+ Additional symbols in the object files are not added to the symbol file.
+ @item @code{"direct"}: The attribute @b{Library_Symbol_File} must be defined and
+ must designate an existing file in the object directory. This symbol file
+ is passed directly to the underlying linker without any symbol processing.
+
+ @end itemize
+
+@item @b{Library_Reference_Symbol_File}
+@cindex @code{Library_Reference_Symbol_File}
+ This attribute may define the path name of a reference symbol file that is
+ read when the symbol policy is either "compliant" or "controlled", on
+ platforms that support symbol control, such as VMS, when building a
+ stand-alone library. The path may be an absolute path or a path relative
+ to the project directory.
+
+@item @b{Library_Symbol_File}
+@cindex @code{Library_Symbol_File}
+ This attribute may define the name of the symbol file to be created when
+ building a stand-alone library when the symbol policy is either "compliant",
+ "controlled" or "restricted", on platforms that support symbol control,
+ such as VMS. When symbol policy is "direct", then a file with this name
+ must exist in the object directory.
+@end table
+
+
+@c ---------------------------------------------
+@node Installing a library with project files
+@subsection Installing a library with project files
+@c ---------------------------------------------
+
+@noindent
+When using project files, library installation is part of the library build
+process. Thus no further action is needed in order to make use of the
+libraries that are built as part of the general application build. A usable
+version of the library is installed in the directory specified by the
+@code{Library_Dir} attribute of the library project file.
+
+You may want to install a library in a context different from where the library
+is built. This situation arises with third party suppliers, who may want
+to distribute a library in binary form where the user is not expected to be
+able to recompile the library. The simplest option in this case is to provide
+a project file slightly different from the one used to build the library, by
+using the @code{externally_built} attribute. @ref{Using Library Projects}
+
+@c ---------------------------------------------
+@node Project Extension
+@section Project Extension
+@c ---------------------------------------------
+
+@noindent
+During development of a large system, it is sometimes necessary to use
+modified versions of some of the source files, without changing the original
+sources. This can be achieved through the @b{project extension} facility.
+
+Suppose for instance that our example @code{Build} project is build every night
+for the whole team, in some shared directory. A developer usually need to work
+on a small part of the system, and might not want to have a copy of all the
+sources and all the object files (mostly because that would require too much
+disk space, time to recompile everything). He prefers to be able to override
+some of the source files in his directory, while taking advantage of all the
+object files generated at night.
+
+Another example can be taken from large software systems, where it is common to have
+multiple implementations of a common interface; in Ada terms, multiple
+versions of a package body for the same spec. For example, one implementation
+might be safe for use in tasking programs, while another might only be used
+in sequential applications. This can be modeled in GNAT using the concept
+of @emph{project extension}. If one project (the ``child'') @emph{extends}
+another project (the ``parent'') then by default all source files of the
+parent project are inherited by the child, but the child project can
+override any of the parent's source files with new versions, and can also
+add new files or remove unnecessary ones.
+This facility is the project analog of a type extension in
+object-oriented programming. Project hierarchies are permitted (an extending
+project may itself be extended), and a project that
+extends a project can also import other projects.
+
+A third example is that of using project extensions to provide different
+versions of the same system. For instance, assume that a @code{Common}
+project is used by two development branches. One of the branches has now
+been frozen, and no further change can be done to it or to @code{Common}.
+However, the other development branch still needs evolution of @code{Common}.
+Project extensions provide a flexible solution to create a new version
+of a subsystem while sharing and reusing as much as possible from the original
+one.
+
+A project extension inherits implicitly all the sources and objects from the
+project it extends. It is possible to create a new version of some of the
+sources in one of the additional source dirs of the extending project. Those new
+versions hide the original versions. Adding new sources or removing existing
+ones is also possible. Here is an example on how to extend the project
+@code{Build} from previous examples:
+
+@smallexample @c projectfile
+ project Work extends "../bld/build.gpr" is
+ end Work;
+@end smallexample
+
+@noindent
+The project after @b{extends} is the one being extended. As usual, it can be
+specified using an absolute path, or a path relative to any of the directories
+in the project path (@pxref{Project Dependencies}). This project does not
+specify source or object directories, so the default value for these attribute
+will be used that is to say the current directory (where project @code{Work} is
+placed). We can already compile that project with
+
+@smallexample
+ gnatmake -Pwork
+@end smallexample
+
+@noindent
+If no sources have been placed in the current directory, this command
+won't do anything, since this project does not change the
+sources it inherited from @code{Build}, therefore all the object files
+in @code{Build} and its dependencies are still valid and are reused
+automatically.
+
+Suppose we now want to supply an alternate version of @file{pack.adb}
+but use the existing versions of @file{pack.ads} and @file{proc.adb}.
+We can create the new file Work's current directory (likely
+by copying the one from the @code{Build} project and making changes to
+it. If new packages are needed at the same time, we simply create
+new files in the source directory of the extending project.
+
+When we recompile, @command{gnatmake} will now automatically recompile
+this file (thus creating @file{pack.o} in the current directory) and
+any file that depends on it (thus creating @file{proc.o}). Finally, the
+executable is also linked locally.
+
+Note that we could have obtained the desired behavior using project import
+rather than project inheritance. A @code{base} project would contain the
+sources for @file{pack.ads} and @file{proc.adb}, and @code{Work} would
+import @code{base} and add @file{pack.adb}. In this scenario, @code{base}
+cannot contain the original version of @file{pack.adb} otherwise there would be
+2 versions of the same unit in the closure of the project and this is not
+allowed. Generally speaking, it is not recommended to put the spec and the
+body of a unit in different projects since this affects their autonomy and
+reusability.
+
+In a project file that extends another project, it is possible to
+indicate that an inherited source is @b{not part} of the sources of the
+extending project. This is necessary sometimes when a package spec has
+been overridden and no longer requires a body: in this case, it is
+necessary to indicate that the inherited body is not part of the sources
+of the project, otherwise there will be a compilation error
+when compiling the spec.
+
+@cindex @code{Excluded_Source_Files}
+@cindex @code{Excluded_Source_List_File}
+For that purpose, the attribute @b{Excluded_Source_Files} is used.
+Its value is a list of file names.
+It is also possible to use attribute @code{Excluded_Source_List_File}.
+Its value is the path of a text file containing one file name per
+line.
+
+@smallexample @c @projectfile
+project Work extends "../bld/build.gpr" is
+ for Source_Files use ("pack.ads");
+ -- New spec of Pkg does not need a completion
+ for Excluded_Source_Files use ("pack.adb");
+end Work;
+@end smallexample
+
+@noindent
+An extending project retains all the switches specified in the
+extended project.
+
+@menu
+* Project Hierarchy Extension::
+@end menu
+
+@c ---------------------------------------------
+@node Project Hierarchy Extension
+@subsection Project Hierarchy Extension
+@c ---------------------------------------------
+
+@noindent
+One of the fundamental restrictions in project extension is the following:
+@b{A project is not allowed to import directly or indirectly at the same time an
+extending project and one of its ancestors}.
+
+By means of example, consider the following hierarchy of projects.
+
+@smallexample
+ a.gpr contains package A1
+ b.gpr, imports a.gpr and contains B1, which depends on A1
+ c.gpr, imports b.gpr and contains C1, which depends on B1
+@end smallexample
+
+@noindent
+If we want to locally extend the packages @code{A1} and @code{C1}, we need to
+create several extending projects:
+
+@smallexample
+ a_ext.gpr which extends a.gpr, and overrides A1
+ b_ext.gpr which extends b.gpr and imports a_ext.gpr
+ c_ext.gpr which extends c.gpr, imports b_ext.gpr and overrides C1
+@end smallexample
+
+@noindent
+@smallexample @c projectfile
+ project A_Ext extends "a.gpr" is
+ for Source_Files use ("a1.adb", "a1.ads");
+ end A_Ext;
+
+ with "a_ext.gpr";
+ project B_Ext extends "b.gpr" is
+ end B_Ext;
+
+ with "b_ext.gpr";
+ project C_Ext extends "c.gpr" is
+ for Source_Files use ("c1.adb");
+ end C_Ext;
+@end smallexample
+
+@noindent
+The extension @file{b_ext.gpr} is required, even though we are not overriding
+any of the sources of @file{b.gpr} because otherwise @file{c_expr.gpr} would
+import @file{b.gpr} which itself knows nothing about @file{a_ext.gpr}.
+
+@cindex extends all
+When extending a large system spanning multiple projects, it is often
+inconvenient to extend every project in the hierarchy that is impacted by a
+small change introduced in a low layer. In such cases, it is possible to create
+an @b{implicit extension} of entire hierarchy using @b{extends all}
+relationship.
+
+When the project is extended using @code{extends all} inheritance, all projects
+that are imported by it, both directly and indirectly, are considered virtually
+extended. That is, the project manager creates implicit projects
+that extend every project in the hierarchy; all these implicit projects do not
+control sources on their own and use the object directory of
+the "extending all" project.
+
+It is possible to explicitly extend one or more projects in the hierarchy
+in order to modify the sources. These extending projects must be imported by
+the "extending all" project, which will replace the corresponding virtual
+projects with the explicit ones.
+
+When building such a project hierarchy extension, the project manager will
+ensure that both modified sources and sources in implicit extending projects
+that depend on them, are recompiled.
+
+Thus, in our example we could create the following projects instead:
+
+@smallexample
+ a_ext.gpr, extends a.gpr and overrides A1
+ c_ext.gpr, "extends all" c.gpr, imports a_ext.gpr and overrides C1
+
+@end smallexample
+
+@noindent
+@smallexample @c projectfile
+ project A_Ext extends "a.gpr" is
+ for Source_Files use ("a1.adb", "a1.ads");
+ end A_Ext;
+
+ with "a_ext.gpr";
+ project C_Ext extends all "c.gpr" is
+ for Source_Files use ("c1.adb");
+ end C_Ext;
+@end smallexample
+
+@noindent
+When building project @file{c_ext.gpr}, the entire modified project space is
+considered for recompilation, including the sources of @file{b.gpr} that are
+impacted by the changes in @code{A1} and @code{C1}.
+
+@c ---------------------------------------------
+@node Project File Reference
+@section Project File Reference
+@c ---------------------------------------------
+
+@noindent
+This section describes the syntactic structure of project files, the various
+constructs that can be used. Finally, it ends with a summary of all available
+attributes.
+
+@menu
+* Project Declaration::
+* Qualified Projects::
+* Declarations::
+* Packages::
+* Expressions::
+* External Values::
+* Typed String Declaration::
+* Variables::
+* Attributes::
+* Case Statements::
+@end menu
+
+@c ---------------------------------------------
+@node Project Declaration
+@subsection Project Declaration
+@c ---------------------------------------------
+
+@noindent
+Project files have an Ada-like syntax. The minimal project file is:
+
+@smallexample @c projectfile
+@group
+project Empty is
+end Empty;
+@end group
+@end smallexample
+
+@noindent
+The identifier @code{Empty} is the name of the project.
+This project name must be present after the reserved
+word @code{end} at the end of the project file, followed by a semi-colon.
+
+@b{Identifiers} (ie the user-defined names such as project or variable names)
+have the same syntax as Ada identifiers: they must start with a letter,
+and be followed by zero or more letters, digits or underscore characters;
+it is also illegal to have two underscores next to each other. Identifiers
+are always case-insensitive ("Name" is the same as "name").
+
+@smallexample
+simple_name ::= identifier
+name ::= simple_name @{ . simple_name @}
+@end smallexample
+
+@noindent
+@b{Strings} are used for values of attributes or as indexes for these
+attributes. They are in general case sensitive, except when noted
+otherwise (in particular, strings representing file names will be case
+insensitive on some systems, so that "file.adb" and "File.adb" both
+represent the same file).
+
+@b{Reserved words} are the same as for standard Ada 95, and cannot
+be used for identifiers. In particular, the following words are currently
+used in project files, but others could be added later on. In bold are the
+extra reserved words in project files: @code{all, at, case, end, for, is,
+limited, null, others, package, renames, type, use, when, with, @b{extends},
+@b{external}, @b{project}}.
+
+@b{Comments} in project files have the same syntax as in Ada, two consecutive
+hyphens through the end of the line.
+
+A project may be an @b{independent project}, entirely defined by a single
+project file. Any source file in an independent project depends only
+on the predefined library and other source files in the same project.
+But a project may also depend on other projects, either by importing them
+through @b{with clauses}, or by @b{extending} at most one other project. Both
+types of dependency can be used in the same project.
+
+A path name denotes a project file. It can be absolute or relative.
+An absolute path name includes a sequence of directories, in the syntax of
+the host operating system, that identifies uniquely the project file in the
+file system. A relative path name identifies the project file, relative
+to the directory that contains the current project, or relative to a
+directory listed in the environment variables ADA_PROJECT_PATH and
+GPR_PROJECT_PATH. Path names are case sensitive if file names in the host
+operating system are case sensitive. As a special case, the directory
+separator can always be "/" even on Windows systems, so that project files
+can be made portable across architectures.
+The syntax of the environment variable ADA_PROJECT_PATH and
+GPR_PROJECT_PATH is a list of directory names separated by colons on UNIX and
+semicolons on Windows.
+
+A given project name can appear only once in a context clause.
+
+It is illegal for a project imported by a context clause to refer, directly
+or indirectly, to the project in which this context clause appears (the
+dependency graph cannot contain cycles), except when one of the with clause
+in the cycle is a @b{limited with}.
+@c ??? Need more details here
+
+@smallexample @c projectfile
+with "other_project.gpr";
+project My_Project extends "extended.gpr" is
+end My_Project;
+@end smallexample
+
+@noindent
+These dependencies form a @b{directed graph}, potentially cyclic when using
+@b{limited with}. The subprogram reflecting the @b{extends} relations is a
+tree.
+
+A project's @b{immediate sources} are the source files directly defined by
+that project, either implicitly by residing in the project source directories,
+or explicitly through any of the source-related attributes.
+More generally, a project sources are the immediate sources of the project
+together with the immediate sources (unless overridden) of any
+project on which it depends directly or indirectly.
+
+A @b{project hierarchy} can be created, where projects are children of
+other projects. The name of such a child project must be @code{Parent.Child},
+where @code{Parent} is the name of the parent project. In particular, this
+makes all @code{with} clauses of the parent project automatically visible
+in the child project.
+
+@smallexample
+project ::= context_clause project_declaration
+
+context_clause ::= @{with_clause@}
+with_clause ::= @i{with} path_name @{ , path_name @} ;
+path_name ::= string_literal
+
+project_declaration ::= simple_project_declaration | project_extension
+simple_project_declaration ::=
+ @i{project} @i{<project_>}name @i{is}
+ @{declarative_item@}
+ @i{end} <project_>simple_name;
+@end smallexample
+
+@c ---------------------------------------------
+@node Qualified Projects
+@subsection Qualified Projects
+@c ---------------------------------------------
+
+@noindent
+Before the reserved @code{project}, there may be one or two @b{qualifiers}, that
+is identifiers or reserved words, to qualify the project.
+The current list of qualifiers is:
+
+@table @asis
+@item @b{abstract}: qualifies a project with no sources. Such a
+ project must either have no declaration of attributes @code{Source_Dirs},
+ @code{Source_Files}, @code{Languages} or @code{Source_List_File}, or one of
+ @code{Source_Dirs}, @code{Source_Files}, or @code{Languages} must be declared
+ as empty. If it extends another project, the project it extends must also be a
+ qualified abstract project.
+@item @b{standard}: a standard project is a non library project with sources.
+ This is the default (implicit) qualifier.
+@item @b{aggregate}: for future extension
+@item @b{aggregate library}: for future extension
+@item @b{library}: a library project must declare both attributes
+ @code{Library_Name} and @code{Library_Dir}.
+@item @b{configuration}: a configuration project cannot be in a project tree.
+ It describes compilers and other tools to @code{gprbuild}.
+@end table
+
+
+@c ---------------------------------------------
+@node Declarations
+@subsection Declarations
+@c ---------------------------------------------
+
+@noindent
+Declarations introduce new entities that denote types, variables, attributes,
+and packages. Some declarations can only appear immediately within a project
+declaration. Others can appear within a project or within a package.
+
+@smallexample
+declarative_item ::= simple_declarative_item
+ | typed_string_declaration
+ | package_declaration
+
+simple_declarative_item ::= variable_declaration
+ | typed_variable_declaration
+ | attribute_declaration
+ | case_construction
+ | empty_declaration
+
+empty_declaration ::= @i{null} ;
+@end smallexample
+
+@noindent
+An empty declaration is allowed anywhere a declaration is allowed. It has
+no effect.
+
+@c ---------------------------------------------
+@node Packages
+@subsection Packages
+@c ---------------------------------------------
+
+@noindent
+A project file may contain @b{packages}, that group attributes (typically
+all the attributes that are used by one of the GNAT tools).
+
+A package with a given name may only appear once in a project file.
+The following packages are currently supported in project files
+(See @pxref{Attributes} for the list of attributes that each can contain).
+
+@table @code
+@item Binder
+ This package specifies characteristics useful when invoking the binder either
+ directly via the @command{gnat} driver or when using a builder such as
+ @command{gnatmake} or @command{gprbuild}. @xref{Main Subprograms}.
+@item Builder
+ This package specifies the compilation options used when building an
+ executable or a library for a project. Most of the options should be
+ set in one of @code{Compiler}, @code{Binder} or @code{Linker} packages,
+ but there are some general options that should be defined in this
+ package. @xref{Main Subprograms}, and @pxref{Executable File Names} in
+ particular.
+@item Check
+ This package specifies the options used when calling the checking tool
+ @command{gnatcheck} via the @command{gnat} driver. Its attribute
+ @b{Default_Switches} has the same semantics as for the package
+ @code{Builder}. The first string should always be @code{-rules} to specify
+ that all the other options belong to the @code{-rules} section of the
+ parameters to @command{gnatcheck}.
+@item Compiler
+ This package specifies the compilation options used by the compiler for
+ each languages. @xref{Tools Options in Project Files}.
+@item Cross_Reference
+ This package specifies the options used when calling the library tool
+ @command{gnatxref} via the @command{gnat} driver. Its attributes
+ @b{Default_Switches} and @b{Switches} have the same semantics as for the
+ package @code{Builder}.
+@item Eliminate
+ This package specifies the options used when calling the tool
+ @command{gnatelim} via the @command{gnat} driver. Its attributes
+ @b{Default_Switches} and @b{Switches} have the same semantics as for the
+ package @code{Builder}.
+@item Finder
+ This package specifies the options used when calling the search tool
+ @command{gnatfind} via the @command{gnat} driver. Its attributes
+ @b{Default_Switches} and @b{Switches} have the same semantics as for the
+ package @code{Builder}.
+@item Gnatls
+ This package the options to use when invoking @command{gnatls} via the
+ @command{gnat} driver.
+@item Gnatstub
+ This package specifies the options used when calling the tool
+ @command{gnatstub} via the @command{gnat} driver. Its attributes
+ @b{Default_Switches} and @b{Switches} have the same semantics as for the
+ package @code{Builder}.
+@item IDE
+ This package specifies the options used when starting an integrated
+ development environment, for instance @command{GPS} or @command{Gnatbench}.
+ @xref{The Development Environments}.
+@item Linker
+ This package specifies the options used by the linker.
+ @xref{Main Subprograms}.
+@item Metrics
+ This package specifies the options used when calling the tool
+ @command{gnatmetric} via the @command{gnat} driver. Its attributes
+ @b{Default_Switches} and @b{Switches} have the same semantics as for the
+ package @code{Builder}.
+@item Naming
+ This package specifies the naming conventions that apply
+ to the source files in a project. In particular, these conventions are
+ used to automatically find all source files in the source directories,
+ or given a file name to find out its language for proper processing.
+ @xref{Naming Schemes}.
+@item Pretty_Printer
+ This package specifies the options used when calling the formatting tool
+ @command{gnatpp} via the @command{gnat} driver. Its attributes
+ @b{Default_Switches} and @b{Switches} have the same semantics as for the
+ package @code{Builder}.
+@item Stack
+ This package specifies the options used when calling the tool
+ @command{gnatstack} via the @command{gnat} driver. Its attributes
+ @b{Default_Switches} and @b{Switches} have the same semantics as for the
+ package @code{Builder}.
+@item Synchronize
+ This package specifies the options used when calling the tool
+ @command{gnatsync} via the @command{gnat} driver.
+
+@end table
+
+In its simplest form, a package may be empty:
+
+@smallexample @c projectfile
+@group
+project Simple is
+ package Builder is
+ end Builder;
+end Simple;
+@end group
+@end smallexample
+
+@noindent
+A package may contain @b{attribute declarations},
+@b{variable declarations} and @b{case constructions}, as will be
+described below.
+
+When there is ambiguity between a project name and a package name,
+the name always designates the project. To avoid possible confusion, it is
+always a good idea to avoid naming a project with one of the
+names allowed for packages or any name that starts with @code{gnat}.
+
+A package can also be defined by a @b{renaming declaration}. The new package
+renames a package declared in a different project file, and has the same
+attributes as the package it renames. The name of the renamed package
+must be the same as the name of the renaming package. The project must
+contain a package declaration with this name, and the project
+must appear in the context clause of the current project, or be its parent
+project. It is not possible to add or override attributes to the renaming
+project. If you need to do so, you should declare a standard package, and
+assign the value of the attributes one by one (@code{for Switches ("Ada")
+use Other_Project.Compiler'Switches ("Ada")}).
+
+Packages that are renamed in other project files often come from project files
+that have no sources: they are just used as templates. Any modification in the
+template will be reflected automatically in all the project files that rename
+a package from the template. This is a very common way to share settings
+between projects.
+
+@smallexample
+package_declaration ::= package_spec | package_renaming
+package_spec ::=
+ @i{package} @i{<package_>}simple_name @i{is}
+ @{simple_declarative_item@}
+ @i{end} package_identifier ;
+package_renaming ::==
+ @i{package} @i{<package_>}simple_name @i{renames} @i{<project_>}simple_name.package_identifier ;
+@end smallexample
+
+@c ---------------------------------------------
+@node Expressions
+@subsection Expressions
+@c ---------------------------------------------
+
+@noindent
+An expression is any value that can be assigned to an attribute or a
+variable. It is either a litteral value, or a construct requiring runtime
+computation by the project manager. In a project file, the computed value of
+an expression is either a string or a list of strings.
+
+A string value is one of:
+@itemize @bullet
+@item A literal string, for instance @code{"comm/my_proj.gpr"}
+@item The name of a variable that evaluates to a string (@pxref{Variables})
+@item The name of an attribute that evaluates to a string (@pxref{Attributes})
+@item An external reference (@pxref{External Values})
+@item A concatenation of the above, as in @code{"prefix_" & Var}.
+
+@end itemize
+
+@noindent
+A list of strings is one of the following:
+
+@itemize @bullet
+@item A parenthesized comma-separated list of zero or more string expressions, for
+ instance @code{(File_Name, "gnat.adc", File_Name & ".orig")} or @code{()}.
+@item The name of a variable that evaluates to a list of strings
+@item The name of an attribute that evaluates to a list of strings
+@item A concatenation of a list of strings and a string (as defined above), for
+ instance @code{("A", "B") & "C"}
+@item A concatenation of two lists of strings
+
+@end itemize
+
+@noindent
+The following is the grammar for expressions
+
+@smallexample
+string_literal ::= "@{string_element@}" -- Same as Ada
+string_expression ::= string_literal
+ | @i{variable_}name
+ | external_value
+ | attribute_reference
+ | ( string_expression @{ & string_expression @} )
+string_list ::= ( string_expression @{ , string_expression @} )
+ | @i{string_variable}_name
+ | @i{string_}attribute_reference
+term ::= string_expression | string_list
+expression ::= term @{ & term @} -- Concatenation
+@end smallexample
+
+@noindent
+Concatenation involves strings and list of strings. As soon as a list of
+strings is involved, the result of the concatenation is a list of strings. The
+following Ada declarations show the existing operators:
+
+@smallexample @c ada
+ function "&" (X : String; Y : String) return String;
+ function "&" (X : String_List; Y : String) return String_List;
+ function "&" (X : String_List; Y : String_List) return String_List;
+@end smallexample
+
+@noindent
+Here are some specific examples:
+
+@smallexample @c projectfile
+@group
+ List := () & File_Name; -- One string in this list
+ List2 := List & (File_Name & ".orig"); -- Two strings
+ Big_List := List & Lists2; -- Three strings
+ Illegal := "gnat.adc" & List2; -- Illegal, must start with list
+@end group
+@end smallexample
+
+@c ---------------------------------------------
+@node External Values
+@subsection External Values
+@c ---------------------------------------------
+
+@noindent
+An external value is an expression whose value is obtained from the command
+that invoked the processing of the current project file (typically a
+gnatmake or gprbuild command).
+
+@smallexample
+external_value ::= @i{external} ( string_literal [, string_literal] )
+@end smallexample
+
+@noindent
+The first string_literal is the string to be used on the command line or
+in the environment to specify the external value. The second string_literal,
+if present, is the default to use if there is no specification for this
+external value either on the command line or in the environment.
+
+Typically, the external value will either exist in the
+^environment variables^logical name^
+or be specified on the command line through the
+@option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}} switch. If both
+are specified, then the command line value is used, so that a user can more
+easily override the value.
+
+The function @code{external} always returns a string, possibly empty if the
+value was not found in the environment and no default was specified in the
+call to @code{external}.
+
+An external reference may be part of a string expression or of a string
+list expression, and can therefore appear in a variable declaration or
+an attribute declaration.
+
+Most of the time, this construct is used to initialize typed variables, which
+are then used in @b{case} statements to control the value assigned to
+attributes in various scenarios. Thus such variables are often called
+@b{scenario variables}.
+
+@c ---------------------------------------------
+@node Typed String Declaration
+@subsection Typed String Declaration
+@c ---------------------------------------------
+
+@noindent
+A @b{type declaration} introduces a discrete set of string literals.
+If a string variable is declared to have this type, its value
+is restricted to the given set of literals. These are the only named
+types in project files. A string type may only be declared at the project
+level, not inside a package.
+
+@smallexample
+typed_string_declaration ::=
+ @i{type} @i{<typed_string_>}_simple_name @i{is} ( string_literal @{, string_literal@} );
+@end smallexample
+
+@noindent
+The string literals in the list are case sensitive and must all be different.
+They may include any graphic characters allowed in Ada, including spaces.
+Here is an example of a string type declaration:
+
+@smallexample @c projectfile
+ type OS is ("NT", "nt", "Unix", "GNU/Linux", "other OS");
+@end smallexample
+
+@noindent
+Variables of a string type are called @b{typed variables}; all other
+variables are called @b{untyped variables}. Typed variables are
+particularly useful in @code{case} constructions, to support conditional
+attribute declarations. (@pxref{Case Statements}).
+
+A string type may be referenced by its name if it has been declared in the same
+project file, or by an expanded name whose prefix is the name of the project
+in which it is declared.
+
+@c ---------------------------------------------
+@node Variables
+@subsection Variables
+@c ---------------------------------------------
+
+@noindent
+@b{Variables} store values (strings or list of strings) and can appear
+as part of an expression. The declaration of a variable creates the
+variable and assigns the value of the expression to it. The name of the
+variable is available immediately after the assignment symbol, if you
+need to reuse its old value to compute the new value. Before the completion
+of its first declaration, the value of a variable defaults to the empty
+string ("").
+
+A @b{typed} variable can be used as part of a @b{case} expression to
+compute the value, but it can only be declared once in the project file,
+so that all case statements see the same value for the variable. This
+provides more consistency and makes the project easier to understand.
+The syntax for its declaration is identical to the Ada syntax for an
+object declaration. In effect, a typed variable acts as a constant.
+
+An @b{untyped} variable can be declared and overridden multiple times
+within the same project. It is declared implicitly through an Ada
+assignment. The first declaration establishes the kind of the variable
+(string or list of strings) and successive declarations must respect
+the initial kind. Assignments are executed in the order in which they
+appear, so the new value replaces the old one and any subsequent reference
+to the variable uses the new value.
+
+A variable may be declared at the project file level, or within a package.
+
+@smallexample
+typed_variable_declaration ::=
+ @i{<typed_variable_>}simple_name : @i{<typed_string_>}name := string_expression;
+variable_declaration ::= @i{<variable_>}simple_name := expression;
+@end smallexample
+
+@noindent
+Here are some examples of variable declarations:
+
+@smallexample @c projectfile
+@group
+ This_OS : OS := external ("OS"); -- a typed variable declaration
+ That_OS := "GNU/Linux"; -- an untyped variable declaration
+
+ Name := "readme.txt";
+ Save_Name := Name & ".saved";
+
+ Empty_List := ();
+ List_With_One_Element := ("-gnaty");
+ List_With_Two_Elements := List_With_One_Element & "-gnatg";
+ Long_List := ("main.ada", "pack1_.ada", "pack1.ada", "pack2_.ada");
+@end group
+@end smallexample
+
+@noindent
+A @b{variable reference} may take several forms:
+
+@itemize @bullet
+@item The simple variable name, for a variable in the current package (if any)
+ or in the current project
+@item An expanded name, whose prefix is a context name.
+
+@end itemize
+
+@noindent
+A @b{context} may be one of the following:
+
+@itemize @bullet
+@item The name of an existing package in the current project
+@item The name of an imported project of the current project
+@item The name of an ancestor project (i.e., a project extended by the current
+ project, either directly or indirectly)
+@item An expanded name whose prefix is an imported/parent project name, and
+ whose selector is a package name in that project.
+@end itemize
+
+
+@c ---------------------------------------------
+@node Attributes
+@subsection Attributes
+@c ---------------------------------------------
+
+@noindent
+A project (and its packages) may have @b{attributes} that define
+the project's properties. Some attributes have values that are strings;
+others have values that are string lists.
+
+@smallexample
+attribute_declaration ::=
+ simple_attribute_declaration | indexed_attribute_declaration
+simple_attribute_declaration ::= @i{for} attribute_designator @i{use} expression ;
+indexed_attribute_declaration ::=
+ @i{for} @i{<indexed_attribute_>}simple_name ( string_literal) @i{use} expression ;
+attribute_designator ::=
+ @i{<simple_attribute_>}simple_name
+ | @i{<indexed_attribute_>}simple_name ( string_literal )
+@end smallexample
+
+@noindent
+There are two categories of attributes: @b{simple attributes}
+and @b{indexed attributes}.
+Each simple attribute has a default value: the empty string (for string
+attributes) and the empty list (for string list attributes).
+An attribute declaration defines a new value for an attribute, and overrides
+the previous value. The syntax of a simple attribute declaration is similar to
+that of an attribute definition clause in Ada.
+
+Some attributes are indexed. These attributes are mappings whose
+domain is a set of strings. They are declared one association
+at a time, by specifying a point in the domain and the corresponding image
+of the attribute.
+Like untyped variables and simple attributes, indexed attributes
+may be declared several times. Each declaration supplies a new value for the
+attribute, and replaces the previous setting.
+
+Here are some examples of attribute declarations:
+
+@smallexample @c projectfile
+ -- simple attributes
+ for Object_Dir use "objects";
+ for Source_Dirs use ("units", "test/drivers");
+
+ -- indexed attributes
+ for Body ("main") use "Main.ada";
+ for Switches ("main.ada") use ("-v", "-gnatv");
+ for Switches ("main.ada") use Builder'Switches ("main.ada") & "-g";
+
+ -- indexed attributes copy (from package Builder in project Default)
+ -- The package name must always be specified, even if it is the current
+ -- package.
+ for Default_Switches use Default.Builder'Default_Switches;
+@end smallexample
+
+@noindent
+Attributes references may be appear anywhere in expressions, and are used
+to retrieve the value previously assigned to the attribute. If an attribute
+has not been set in a given package or project, its value defaults to the
+empty string or the empty list.
+
+@smallexample
+attribute_reference ::= attribute_prefix ' @i{<simple_attribute>_}simple_name [ (string_literal) ]
+attribute_prefix ::= @i{project}
+ | @i{<project_>}simple_name
+ | package_identifier
+ | @i{<project_>}simple_name . package_identifier
+@end smallexample
+
+@noindent
+Examples are:
+
+@smallexample @c projectfile
+ project'Object_Dir
+ Naming'Dot_Replacement
+ Imported_Project'Source_Dirs
+ Imported_Project.Naming'Casing
+ Builder'Default_Switches ("Ada")
+@end smallexample
+
+@noindent
+The prefix of an attribute may be:
+
+@itemize @bullet
+@item @code{project} for an attribute of the current project
+@item The name of an existing package of the current project
+@item The name of an imported project
+@item The name of a parent project that is extended by the current project
+@item An expanded name whose prefix is imported/parent project name,
+ and whose selector is a package name
+
+@end itemize
+
+@noindent
+Legal attribute names are listed below, including the package in
+which they must be declared. These names are case-insensitive. The
+semantics for the attributes is explained in great details in other sections.
+
+The column @emph{index} indicates whether the attribute is an indexed attribute,
+and when it is whether its index is case sensitive (sensitive) or not (insensitive), or if case sensitivity depends is the same as file names sensitivity on the
+system (file). The text is between brackets ([]) if the index is optional.
+
+@multitable @columnfractions .3 .1 .2 .4
+@headitem Attribute Name @tab Value @tab Package @tab Index
+@headitem General attributes @tab @tab @tab @pxref{Building With Projects}
+@item Name @tab string @tab - @tab (Read-only, name of project)
+@item Project_Dir @tab string @tab - @tab (Read-only, directory of project)
+@item Source_Files @tab list @tab - @tab -
+@item Source_Dirs @tab list @tab - @tab -
+@item Source_List_File @tab string @tab - @tab -
+@item Locally_Removed_Files @tab list @tab - @tab -
+@item Excluded_Source_Files @tab list @tab - @tab -
+@item Object_Dir @tab string @tab - @tab -
+@item Exec_Dir @tab string @tab - @tab -
+@item Excluded_Source_Dirs @tab list @tab - @tab -
+@item Excluded_Source_Files @tab list @tab - @tab -
+@item Excluded_Source_List_File @tab list @tab - @tab -
+@item Inherit_Source_Path @tab list @tab - @tab insensitive
+@item Languages @tab list @tab - @tab -
+@item Main @tab list @tab - @tab -
+@item Main_Language @tab string @tab - @tab -
+@item Externally_Built @tab string @tab - @tab -
+@item Roots @tab list @tab - @tab file
+@headitem
+ Library-related attributes @tab @tab @tab @pxref{Library Projects}
+@item Library_Dir @tab string @tab - @tab -
+@item Library_Name @tab string @tab - @tab -
+@item Library_Kind @tab string @tab - @tab -
+@item Library_Version @tab string @tab - @tab -
+@item Library_Interface @tab string @tab - @tab -
+@item Library_Auto_Init @tab string @tab - @tab -
+@item Library_Options @tab list @tab - @tab -
+@item Library_Src_Dir @tab string @tab - @tab -
+@item Library_ALI_Dir @tab string @tab - @tab -
+@item Library_GCC @tab string @tab - @tab -
+@item Library_Symbol_File @tab string @tab - @tab -
+@item Library_Symbol_Policy @tab string @tab - @tab -
+@item Library_Reference_Symbol_File @tab string @tab - @tab -
+@item Interfaces @tab list @tab - @tab -
+@headitem
+ Naming @tab @tab @tab @pxref{Naming Schemes}
+@item Spec_Suffix @tab string @tab Naming @tab insensitive (language)
+@item Body_Suffix @tab string @tab Naming @tab insensitive (language)
+@item Separate_Suffix @tab string @tab Naming @tab -
+@item Casing @tab string @tab Naming @tab -
+@item Dot_Replacement @tab string @tab Naming @tab -
+@item Spec @tab string @tab Naming @tab insensitive (Ada unit)
+@item Body @tab string @tab Naming @tab insensitive (Ada unit)
+@item Specification_Exceptions @tab list @tab Naming @tab insensitive (language)
+@item Implementation_Exceptions @tab list @tab Naming @tab insensitive (language)
+@headitem
+ Building @tab @tab @tab @pxref{Switches and Project Files}
+@item Default_Switches @tab list @tab Builder, Compiler, Binder, Linker, Cross_Reference, Finder, Pretty_Printer, gnatstub, Check, Synchronize, Eliminate, Metrics, IDE @tab insensitive (language name)
+@item Switches @tab list @tab Builder, Compiler, Binder, Linker, Cross_Reference, Finder, gnatls, Pretty_Printer, gnatstub, Check, Synchronize, Eliminate, Metrics, Stack @tab [file] (file name)
+@item Local_Configuration_Pragmas @tab string @tab Compiler @tab -
+@item Local_Config_File @tab string @tab insensitive @tab -
+@item Global_Configuration_Pragmas @tab list @tab Builder @tab -
+@item Global_Compilation_Switches @tab list @tab Builder @tab language
+@item Executable @tab string @tab Builder @tab [file]
+@item Executable_Suffix @tab string @tab Builder @tab -
+@item Global_Config_File @tab string @tab Builder @tab insensitive (language)
+@headitem
+ IDE (used and created by GPS) @tab @tab @tab
+@item Remote_Host @tab string @tab IDE @tab -
+@item Program_Host @tab string @tab IDE @tab -
+@item Communication_Protocol @tab string @tab IDE @tab -
+@item Compiler_Command @tab string @tab IDE @tab insensitive (language)
+@item Debugger_Command @tab string @tab IDE @tab -
+@item Gnatlist @tab string @tab IDE @tab -
+@item VCS_Kind @tab string @tab IDE @tab -
+@item VCS_File_Check @tab string @tab IDE @tab -
+@item VCS_Log_Check @tab string @tab IDE @tab -
+@headitem
+ Configuration files @tab @tab @tab See gprbuild manual
+@item Default_Language @tab string @tab - @tab -
+@item Run_Path_Option @tab list @tab - @tab -
+@item Run_Path_Origin @tab string @tab - @tab -
+@item Separate_Run_Path_Options @tab string @tab - @tab -
+@item Toolchain_Version @tab string @tab - @tab insensitive
+@item Toolchain_Description @tab string @tab - @tab insensitive
+@item Object_Generated @tab string @tab - @tab insensitive
+@item Objects_Linked @tab string @tab - @tab insensitive
+@item Target @tab string @tab - @tab -
+@item Library_Builder @tab string @tab - @tab -
+@item Library_Support @tab string @tab - @tab -
+@item Archive_Builder @tab list @tab - @tab -
+@item Archive_Builder_Append_Option @tab list @tab - @tab -
+@item Archive_Indexer @tab list @tab - @tab -
+@item Archive_Suffix @tab string @tab - @tab -
+@item Library_Partial_Linker @tab list @tab - @tab -
+@item Shared_Library_Prefix @tab string @tab - @tab -
+@item Shared_Library_Suffix @tab string @tab - @tab -
+@item Symbolic_Link_Supported @tab string @tab - @tab -
+@item Library_Major_Minor_Id_Supported @tab string @tab - @tab -
+@item Library_Auto_Init_Supported @tab string @tab - @tab -
+@item Shared_Library_Minimum_Switches @tab list @tab - @tab -
+@item Library_Version_Switches @tab list @tab - @tab -
+@item Library_Install_Name_Option @tab string @tab - @tab -
+@item Runtime_Library_Dir @tab string @tab - @tab insensitive
+@item Runtime_Source_Dir @tab string @tab - @tab insensitive
+@item Driver @tab string @tab Compiler,Binder,Linker @tab insensitive (language)
+@item Required_Switches @tab list @tab Compiler,Binder,Linker @tab insensitive (language)
+@item Leading_Required_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Trailing_Required_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Pic_Options @tab list @tab Compiler @tab insensitive (language)
+@item Path_Syntax @tab string @tab Compiler @tab insensitive (language)
+@item Object_File_Suffix @tab string @tab Compiler @tab insensitive (language)
+@item Object_File_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Multi_Unit_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Multi_Unit_Object_Separator @tab string @tab Compiler @tab insensitve (language)
+@item Mapping_File_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Mapping_Spec_Suffix @tab string @tab Compiler @tab insensitive (language)
+@item Mapping_body_Suffix @tab string @tab Compiler @tab insensitive (language)
+@item Config_File_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Config_Body_File_Name @tab string @tab Compiler @tab insensitive (language)
+@item Config_Body_File_Name_Index @tab string @tab Compiler @tab insensitive (language)
+@item Config_Body_File_Name_Pattern @tab string @tab Compiler @tab insensitive (language)
+@item Config_Spec_File_Name @tab string @tab Compiler @tab insensitive (language)
+@item Config_Spec_File_Name_Index @tab string @tab Compiler @tab insensitive (language)
+@item Config_Spec_File_Name_Pattern @tab string @tab Compiler @tab insensitive (language)
+@item Config_File_Unique @tab string @tab Compiler @tab insensitive (language)
+@item Dependency_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Dependency_Driver @tab list @tab Compiler @tab insensitive (language)
+@item Include_Switches @tab list @tab Compiler @tab insensitive (language)
+@item Include_Path @tab string @tab Compiler @tab insensitive (language)
+@item Include_Path_File @tab string @tab Compiler @tab insensitive (language)
+@item Prefix @tab string @tab Binder @tab insensitive (language)
+@item Objects_Path @tab string @tab Binder @tab insensitive (language)
+@item Objects_Path_File @tab string @tab Binder @tab insensitive (language)
+@item Linker_Options @tab list @tab Linker @tab -
+@item Map_File_Options @tab string @tab Linker @tab -
+@item Executable_Switches @tab list @tab Linker @tab -
+@item Lib_Dir_Switch @tab string @tab Linker @tab -
+@item Lib_Name_Switch @tab string @tab Linker @tab -
+@item Max_Command_Line_Length @tab string @tab Linker @tab -
+@item Response_File_Format @tab string @tab Linker @tab -
+@item Response_File_Switches @tab list @tab Linker @tab -
+@end multitable
+
+@c ---------------------------------------------
+@node Case Statements
+@subsection Case Statements
+@c ---------------------------------------------
+
+@noindent
+A @b{case} statement is used in a project file to effect conditional
+behavior. Through this statement, you can set the value of attributes
+and variables depending on the value previously assigned to a typed
+variable.
+
+All choices in a choice list must be distinct. Unlike Ada, the choice
+lists of all alternatives do not need to include all values of the type.
+An @code{others} choice must appear last in the list of alternatives.
+
+The syntax of a @code{case} construction is based on the Ada case statement
+(although the @code{null} statement for empty alternatives is optional).
+
+The case expression must be a typed string variable, whose value is often
+given by an external reference (@pxref{External Values}).
+
+Each alternative starts with the reserved word @code{when}, either a list of
+literal strings separated by the @code{"|"} character or the reserved word
+@code{others}, and the @code{"=>"} token.
+Each literal string must belong to the string type that is the type of the
+case variable.
+After each @code{=>}, there are zero or more statements. The only
+statements allowed in a case construction are other case statements,
+attribute declarations and variable declarations. String type declarations and
+package declarations are not allowed. Variable declarations are restricted to
+variables that have already been declared before the case construction.
+
+@smallexample
+case_statement ::=
+ @i{case} @i{<typed_variable_>}name @i{is} @{case_item@} @i{end case} ;
+
+case_item ::=
+ @i{when} discrete_choice_list =>
+ @{case_statement
+ | attribute_declaration
+ | variable_declaration
+ | empty_declaration@}
+
+discrete_choice_list ::= string_literal @{| string_literal@} | @i{others}
+@end smallexample
+
+@noindent
+Here is a typical example:
+
+@smallexample @c projectfile
+@group
+project MyProj is
+ type OS_Type is ("GNU/Linux", "Unix", "NT", "VMS");
+ OS : OS_Type := external ("OS", "GNU/Linux");
+
+ package Compiler is
+ case OS is
+ when "GNU/Linux" | "Unix" =>
+ for Switches ("Ada") use ("-gnath");
+ when "NT" =>
+ for Switches ("Ada") use ("-gnatP");
+ when others =>
+ null;
+ end case;
+ end Compiler;
+end MyProj;
+@end group
+@end smallexample
+
+@c ---------------------------------------------
+@node Tools Supporting Project Files
+@chapter Tools Supporting Project Files
+@c ---------------------------------------------
+
+@noindent
+
+
+@menu
+* gnatmake and Project Files::
+* The GNAT Driver and Project Files::
+* The Development Environments::
+* Cleaning up with GPRclean::
+@end menu
+
+@c ---------------------------------------------
+@node gnatmake and Project Files
+@section gnatmake and Project Files
+@c ---------------------------------------------
+
+@noindent
+This section covers several topics related to @command{gnatmake} and
+project files: defining ^switches^switches^ for @command{gnatmake}
+and for the tools that it invokes; specifying configuration pragmas;
+the use of the @code{Main} attribute; building and rebuilding library project
+files.
+
+@menu
+* Switches Related to Project Files::
+* Switches and Project Files::
+* Specifying Configuration Pragmas::
+* Project Files and Main Subprograms::
+* Library Project Files::
+@end menu
+
+@c ---------------------------------------------
+@node Switches Related to Project Files
+@subsection Switches Related to Project Files
+@c ---------------------------------------------
+
+@noindent
+The following switches are used by GNAT tools that support project files:
+
+@table @option
+
+@item ^-P^/PROJECT_FILE=^@var{project}
+@cindex @option{^-P^/PROJECT_FILE^} (any project-aware tool)
+Indicates the name of a project file. This project file will be parsed with
+the verbosity indicated by @option{^-vP^MESSAGE_PROJECT_FILES=^@emph{x}},
+if any, and using the external references indicated
+by @option{^-X^/EXTERNAL_REFERENCE^} switches, if any.
+@ifclear vms
+There may zero, one or more spaces between @option{-P} and @var{project}.
+@end ifclear
+
+There must be only one @option{^-P^/PROJECT_FILE^} switch on the command line.
+
+Since the Project Manager parses the project file only after all the switches
+on the command line are checked, the order of the switches
+@option{^-P^/PROJECT_FILE^},
+@option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}}
+or @option{^-X^/EXTERNAL_REFERENCE^} is not significant.
+
+@item ^-X^/EXTERNAL_REFERENCE=^@var{name=value}
+@cindex @option{^-X^/EXTERNAL_REFERENCE^} (any project-aware tool)
+Indicates that external variable @var{name} has the value @var{value}.
+The Project Manager will use this value for occurrences of
+@code{external(name)} when parsing the project file.
+
+@ifclear vms
+If @var{name} or @var{value} includes a space, then @var{name=value} should be
+put between quotes.
+@smallexample
+ -XOS=NT
+ -X"user=John Doe"
+@end smallexample
+@end ifclear
+
+Several @option{^-X^/EXTERNAL_REFERENCE^} switches can be used simultaneously.
+If several @option{^-X^/EXTERNAL_REFERENCE^} switches specify the same
+@var{name}, only the last one is used.
+
+An external variable specified with a @option{^-X^/EXTERNAL_REFERENCE^} switch
+takes precedence over the value of the same name in the environment.
+
+@item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}
+@cindex @option{^-vP^/MESSAGES_PROJECT_FILE^} (any project-aware tool)
+Indicates the verbosity of the parsing of GNAT project files.
+
+@ifclear vms
+@option{-vP0} means Default;
+@option{-vP1} means Medium;
+@option{-vP2} means High.
+@end ifclear
+
+@ifset vms
+There are three possible options for this qualifier: DEFAULT, MEDIUM and
+HIGH.
+@end ifset
+
+The default is ^Default^DEFAULT^: no output for syntactically correct
+project files.
+If several @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} switches are present,
+only the last one is used.
+
+@item ^-aP^/ADD_PROJECT_SEARCH_DIR=^<dir>
+@cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (any project-aware tool)
+Add directory <dir> at the beginning of the project search path, in order,
+after the current working directory.
+
+@ifclear vms
+@item -eL
+@cindex @option{-eL} (any project-aware tool)
+Follow all symbolic links when processing project files.
+@end ifclear
+
+@item ^--subdirs^/SUBDIRS^=<subdir>
+@cindex @option{^--subdirs^/SUBDIRS^=} (gnatmake and gnatclean)
+This switch is recognized by gnatmake and gnatclean. It indicate that the real
+directories (except the source directories) are the subdirectories <subdir>
+of the directories specified in the project files. This applies in particular
+to object directories, library directories and exec directories. If the
+subdirectories do not exist, they are created automatically.
+
+@end table
+
+@c ---------------------------------------------
+@node Switches and Project Files
+@subsection Switches and Project Files
+@c ---------------------------------------------
+
+@noindent
+@ifset vms
+It is not currently possible to specify VMS style qualifiers in the project
+files; only Unix style ^switches^switches^ may be specified.
+@end ifset
+
+For each of the packages @code{Builder}, @code{Compiler}, @code{Binder}, and
+@code{Linker}, you can specify a @code{^Default_Switches^Default_Switches^}
+attribute, a @code{Switches} attribute, or both;
+as their names imply, these ^switch^switch^-related
+attributes affect the ^switches^switches^ that are used for each of these GNAT
+components when
+@command{gnatmake} is invoked. As will be explained below, these
+component-specific ^switches^switches^ precede
+the ^switches^switches^ provided on the @command{gnatmake} command line.
+
+The @code{^Default_Switches^Default_Switches^} attribute is an attribute
+indexed by language name (case insensitive) whose value is a string list.
+For example:
+
+@smallexample @c projectfile
+@group
+package Compiler is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-gnaty^-gnaty^",
+ "^-v^-v^");
+end Compiler;
+@end group
+@end smallexample
+
+@noindent
+The @code{Switches} attribute is indexed on a file name (which may or may
+not be case sensitive, depending
+on the operating system) whose value is a string list. For example:
+
+@smallexample @c projectfile
+@group
+package Builder is
+ for Switches ("main1.adb")
+ use ("^-O2^-O2^");
+ for Switches ("main2.adb")
+ use ("^-g^-g^");
+end Builder;
+@end group
+@end smallexample
+
+@noindent
+For the @code{Builder} package, the file names must designate source files
+for main subprograms. For the @code{Binder} and @code{Linker} packages, the
+file names must designate @file{ALI} or source files for main subprograms.
+In each case just the file name without an explicit extension is acceptable.
+
+For each tool used in a program build (@command{gnatmake}, the compiler, the
+binder, and the linker), the corresponding package @dfn{contributes} a set of
+^switches^switches^ for each file on which the tool is invoked, based on the
+^switch^switch^-related attributes defined in the package.
+In particular, the ^switches^switches^
+that each of these packages contributes for a given file @var{f} comprise:
+
+@itemize @bullet
+@item the value of attribute @code{Switches (@var{f})},
+ if it is specified in the package for the given file,
+@item otherwise, the value of @code{^Default_Switches^Default_Switches^ ("Ada")},
+ if it is specified in the package.
+
+@end itemize
+
+@noindent
+If neither of these attributes is defined in the package, then the package does
+not contribute any ^switches^switches^ for the given file.
+
+When @command{gnatmake} is invoked on a file, the ^switches^switches^ comprise
+two sets, in the following order: those contributed for the file
+by the @code{Builder} package;
+and the switches passed on the command line.
+
+When @command{gnatmake} invokes a tool (compiler, binder, linker) on a file,
+the ^switches^switches^ passed to the tool comprise three sets,
+in the following order:
+
+@enumerate
+@item
+the applicable ^switches^switches^ contributed for the file
+by the @code{Builder} package in the project file supplied on the command line;
+
+@item
+those contributed for the file by the package (in the relevant project file --
+see below) corresponding to the tool; and
+
+@item
+the applicable switches passed on the command line.
+@end enumerate
+
+The term @emph{applicable ^switches^switches^} reflects the fact that
+@command{gnatmake} ^switches^switches^ may or may not be passed to individual
+tools, depending on the individual ^switch^switch^.
+
+@command{gnatmake} may invoke the compiler on source files from different
+projects. The Project Manager will use the appropriate project file to
+determine the @code{Compiler} package for each source file being compiled.
+Likewise for the @code{Binder} and @code{Linker} packages.
+
+As an example, consider the following package in a project file:
+
+@smallexample @c projectfile
+@group
+project Proj1 is
+ package Compiler is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-g^-g^");
+ for Switches ("a.adb")
+ use ("^-O1^-O1^");
+ for Switches ("b.adb")
+ use ("^-O2^-O2^",
+ "^-gnaty^-gnaty^");
+ end Compiler;
+end Proj1;
+@end group
+@end smallexample
+
+@noindent
+If @command{gnatmake} is invoked with this project file, and it needs to
+compile, say, the files @file{a.adb}, @file{b.adb}, and @file{c.adb}, then
+@file{a.adb} will be compiled with the ^switch^switch^
+@option{^-O1^-O1^},
+@file{b.adb} with ^switches^switches^
+@option{^-O2^-O2^}
+and @option{^-gnaty^-gnaty^},
+and @file{c.adb} with @option{^-g^-g^}.
+
+The following example illustrates the ordering of the ^switches^switches^
+contributed by different packages:
+
+@smallexample @c projectfile
+@group
+project Proj2 is
+ package Builder is
+ for Switches ("main.adb")
+ use ("^-g^-g^",
+ "^-O1^-)1^",
+ "^-f^-f^");
+ end Builder;
+@end group
+
+@group
+ package Compiler is
+ for Switches ("main.adb")
+ use ("^-O2^-O2^");
+ end Compiler;
+end Proj2;
+@end group
+@end smallexample
+
+@noindent
+If you issue the command:
+
+@smallexample
+ gnatmake ^-Pproj2^/PROJECT_FILE=PROJ2^ -O0 main
+@end smallexample
+
+@noindent
+then the compiler will be invoked on @file{main.adb} with the following
+sequence of ^switches^switches^
+
+@smallexample
+ ^-g -O1 -O2 -O0^-g -O1 -O2 -O0^
+@end smallexample
+
+@noindent
+with the last @option{^-O^-O^}
+^switch^switch^ having precedence over the earlier ones;
+several other ^switches^switches^
+(such as @option{^-c^-c^}) are added implicitly.
+
+The ^switches^switches^
+@option{^-g^-g^}
+and @option{^-O1^-O1^} are contributed by package
+@code{Builder}, @option{^-O2^-O2^} is contributed
+by the package @code{Compiler}
+and @option{^-O0^-O0^} comes from the command line.
+
+The @option{^-g^-g^}
+^switch^switch^ will also be passed in the invocation of
+@command{Gnatlink.}
+
+A final example illustrates switch contributions from packages in different
+project files:
+
+@smallexample @c projectfile
+@group
+project Proj3 is
+ for Source_Files use ("pack.ads", "pack.adb");
+ package Compiler is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-gnata^-gnata^");
+ end Compiler;
+end Proj3;
+@end group
+
+@group
+with "Proj3";
+project Proj4 is
+ for Source_Files use ("foo_main.adb", "bar_main.adb");
+ package Builder is
+ for Switches ("foo_main.adb")
+ use ("^-s^-s^",
+ "^-g^-g^");
+ end Builder;
+end Proj4;
+@end group
+
+@group
+-- Ada source file:
+with Pack;
+procedure Foo_Main is
+ @dots{}
+end Foo_Main;
+@end group
+@end smallexample
+
+@noindent
+If the command is
+@smallexample
+gnatmake ^-PProj4^/PROJECT_FILE=PROJ4^ foo_main.adb -cargs -gnato
+@end smallexample
+
+@noindent
+then the ^switches^switches^ passed to the compiler for @file{foo_main.adb} are
+@option{^-g^-g^} (contributed by the package @code{Proj4.Builder}) and
+@option{^-gnato^-gnato^} (passed on the command line).
+When the imported package @code{Pack} is compiled, the ^switches^switches^ used
+are @option{^-g^-g^} from @code{Proj4.Builder},
+@option{^-gnata^-gnata^} (contributed from package @code{Proj3.Compiler},
+and @option{^-gnato^-gnato^} from the command line.
+
+When using @command{gnatmake} with project files, some ^switches^switches^ or
+arguments may be expressed as relative paths. As the working directory where
+compilation occurs may change, these relative paths are converted to absolute
+paths. For the ^switches^switches^ found in a project file, the relative paths
+are relative to the project file directory, for the switches on the command
+line, they are relative to the directory where @command{gnatmake} is invoked.
+The ^switches^switches^ for which this occurs are:
+^-I^-I^,
+^-A^-A^,
+^-L^-L^,
+^-aO^-aO^,
+^-aL^-aL^,
+^-aI^-aI^, as well as all arguments that are not switches (arguments to
+^switch^switch^
+^-o^-o^, object files specified in package @code{Linker} or after
+-largs on the command line). The exception to this rule is the ^switch^switch^
+^--RTS=^--RTS=^ for which a relative path argument is never converted.
+
+@c ---------------------------------------------
+@node Specifying Configuration Pragmas
+@subsection Specifying Configuration Pragmas
+@c ---------------------------------------------
+
+@noindent
+When using @command{gnatmake} with project files, if there exists a file
+@file{gnat.adc} that contains configuration pragmas, this file will be
+ignored.
+
+Configuration pragmas can be defined by means of the following attributes in
+project files: @code{Global_Configuration_Pragmas} in package @code{Builder}
+and @code{Local_Configuration_Pragmas} in package @code{Compiler}.
+
+Both these attributes are single string attributes. Their values is the path
+name of a file containing configuration pragmas. If a path name is relative,
+then it is relative to the project directory of the project file where the
+attribute is defined.
+
+When compiling a source, the configuration pragmas used are, in order,
+those listed in the file designated by attribute
+@code{Global_Configuration_Pragmas} in package @code{Builder} of the main
+project file, if it is specified, and those listed in the file designated by
+attribute @code{Local_Configuration_Pragmas} in package @code{Compiler} of
+the project file of the source, if it exists.
+
+@c ---------------------------------------------
+@node Project Files and Main Subprograms
+@subsection Project Files and Main Subprograms
+@c ---------------------------------------------
+
+@noindent
+When using a project file, you can invoke @command{gnatmake}
+with one or several main subprograms, by specifying their source files on the
+command line.
+
+@smallexample
+ gnatmake ^-P^/PROJECT_FILE=^prj main1 main2 main3
+@end smallexample
+
+@noindent
+Each of these needs to be a source file of the same project, except
+when the switch ^-u^/UNIQUE^ is used.
+
+When ^-u^/UNIQUE^ is not used, all the mains need to be sources of the
+same project, one of the project in the tree rooted at the project specified
+on the command line. The package @code{Builder} of this common project, the
+"main project" is the one that is considered by @command{gnatmake}.
+
+When ^-u^/UNIQUE^ is used, the specified source files may be in projects
+imported directly or indirectly by the project specified on the command line.
+Note that if such a source file is not part of the project specified on the
+command line, the ^switches^switches^ found in package @code{Builder} of the
+project specified on the command line, if any, that are transmitted
+to the compiler will still be used, not those found in the project file of
+the source file.
+
+When using a project file, you can also invoke @command{gnatmake} without
+explicitly specifying any main, and the effect depends on whether you have
+defined the @code{Main} attribute. This attribute has a string list value,
+where each element in the list is the name of a source file (the file
+extension is optional) that contains a unit that can be a main subprogram.
+
+If the @code{Main} attribute is defined in a project file as a non-empty
+string list and the switch @option{^-u^/UNIQUE^} is not used on the command
+line, then invoking @command{gnatmake} with this project file but without any
+main on the command line is equivalent to invoking @command{gnatmake} with all
+the file names in the @code{Main} attribute on the command line.
+
+Example:
+@smallexample @c projectfile
+@group
+ project Prj is
+ for Main use ("main1", "main2", "main3");
+ end Prj;
+@end group
+@end smallexample
+
+@noindent
+With this project file, @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^"}
+is equivalent to
+@code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^ main1 main2 main3"}.
+
+When the project attribute @code{Main} is not specified, or is specified
+as an empty string list, or when the switch @option{-u} is used on the command
+line, then invoking @command{gnatmake} with no main on the command line will
+result in all immediate sources of the project file being checked, and
+potentially recompiled. Depending on the presence of the switch @option{-u},
+sources from other project files on which the immediate sources of the main
+project file depend are also checked and potentially recompiled. In other
+words, the @option{-u} switch is applied to all of the immediate sources of the
+main project file.
+
+When no main is specified on the command line and attribute @code{Main} exists
+and includes several mains, or when several mains are specified on the
+command line, the default ^switches^switches^ in package @code{Builder} will
+be used for all mains, even if there are specific ^switches^switches^
+specified for one or several mains.
+
+But the ^switches^switches^ from package @code{Binder} or @code{Linker} will be
+the specific ^switches^switches^ for each main, if they are specified.
+
+@c ---------------------------------------------
+@node Library Project Files
+@subsection Library Project Files
+@c ---------------------------------------------
+
+@noindent
+When @command{gnatmake} is invoked with a main project file that is a library
+project file, it is not allowed to specify one or more mains on the command
+line.
+
+When a library project file is specified, switches ^-b^/ACTION=BIND^ and
+^-l^/ACTION=LINK^ have special meanings.
+
+@itemize @bullet
+@item ^-b^/ACTION=BIND^ is only allowed for stand-alone libraries. It indicates
+ to @command{gnatmake} that @command{gnatbind} should be invoked for the
+ library.
+
+@item ^-l^/ACTION=LINK^ may be used for all library projects. It indicates
+ to @command{gnatmake} that the binder generated file should be compiled
+ (in the case of a stand-alone library) and that the library should be built.
+@end itemize
+
+
+@c ---------------------------------------------
+@node The GNAT Driver and Project Files
+@section The GNAT Driver and Project Files
+@c ---------------------------------------------
+
+@noindent
+A number of GNAT tools, other than @command{^gnatmake^gnatmake^}
+can benefit from project files:
+(@command{^gnatbind^gnatbind^},
+@command{^gnatcheck^gnatcheck^},
+@command{^gnatclean^gnatclean^},
+@command{^gnatelim^gnatelim^},
+@command{^gnatfind^gnatfind^},
+@command{^gnatlink^gnatlink^},
+@command{^gnatls^gnatls^},
+@command{^gnatmetric^gnatmetric^},
+@command{^gnatpp^gnatpp^},
+@command{^gnatstub^gnatstub^},
+and @command{^gnatxref^gnatxref^}). However, none of these tools can be invoked
+directly with a project file switch (@option{^-P^/PROJECT_FILE=^}).
+They must be invoked through the @command{gnat} driver.
+
+The @command{gnat} driver is a wrapper that accepts a number of commands and
+calls the corresponding tool. It was designed initially for VMS platforms (to
+convert VMS qualifiers to Unix-style switches), but it is now available on all
+GNAT platforms.
+
+On non-VMS platforms, the @command{gnat} driver accepts the following commands
+(case insensitive):
+
+@itemize @bullet
+@item BIND to invoke @command{^gnatbind^gnatbind^}
+@item CHOP to invoke @command{^gnatchop^gnatchop^}
+@item CLEAN to invoke @command{^gnatclean^gnatclean^}
+@item COMP or COMPILE to invoke the compiler
+@item ELIM to invoke @command{^gnatelim^gnatelim^}
+@item FIND to invoke @command{^gnatfind^gnatfind^}
+@item KR or KRUNCH to invoke @command{^gnatkr^gnatkr^}
+@item LINK to invoke @command{^gnatlink^gnatlink^}
+@item LS or LIST to invoke @command{^gnatls^gnatls^}
+@item MAKE to invoke @command{^gnatmake^gnatmake^}
+@item NAME to invoke @command{^gnatname^gnatname^}
+@item PREP or PREPROCESS to invoke @command{^gnatprep^gnatprep^}
+@item PP or PRETTY to invoke @command{^gnatpp^gnatpp^}
+@item METRIC to invoke @command{^gnatmetric^gnatmetric^}
+@item STUB to invoke @command{^gnatstub^gnatstub^}
+@item XREF to invoke @command{^gnatxref^gnatxref^}
+
+@end itemize
+
+@noindent
+(note that the compiler is invoked using the command
+@command{^gnatmake -f -u -c^gnatmake -f -u -c^}).
+
+On non-VMS platforms, between @command{gnat} and the command, two
+special switches may be used:
+
+@itemize @bullet
+@item @command{-v} to display the invocation of the tool.
+@item @command{-dn} to prevent the @command{gnat} driver from removing
+ the temporary files it has created. These temporary files are
+ configuration files and temporary file list files.
+
+@end itemize
+
+@noindent
+The command may be followed by switches and arguments for the invoked
+tool.
+
+@smallexample
+ gnat bind -C main.ali
+ gnat ls -a main
+ gnat chop foo.txt
+@end smallexample
+
+@noindent
+Switches may also be put in text files, one switch per line, and the text
+files may be specified with their path name preceded by '@@'.
+
+@smallexample
+ gnat bind @@args.txt main.ali
+@end smallexample
+
+@noindent
+In addition, for commands BIND, COMP or COMPILE, FIND, ELIM, LS or LIST, LINK,
+METRIC, PP or PRETTY, STUB and XREF, the project file related switches
+(@option{^-P^/PROJECT_FILE^},
+@option{^-X^/EXTERNAL_REFERENCE^} and
+@option{^-vP^/MESSAGES_PROJECT_FILE=^x}) may be used in addition to
+the switches of the invoking tool.
+
+When GNAT PP or GNAT PRETTY is used with a project file, but with no source
+specified on the command line, it invokes @command{^gnatpp^gnatpp^} with all
+the immediate sources of the specified project file.
+
+When GNAT METRIC is used with a project file, but with no source
+specified on the command line, it invokes @command{^gnatmetric^gnatmetric^}
+with all the immediate sources of the specified project file and with
+@option{^-d^/DIRECTORY^} with the parameter pointing to the object directory
+of the project.
+
+In addition, when GNAT PP, GNAT PRETTY or GNAT METRIC is used with
+a project file, no source is specified on the command line and
+switch ^-U^/ALL_PROJECTS^ is specified on the command line, then
+the underlying tool (^gnatpp^gnatpp^ or
+^gnatmetric^gnatmetric^) is invoked for all sources of all projects,
+not only for the immediate sources of the main project.
+@ifclear vms
+(-U stands for Universal or Union of the project files of the project tree)
+@end ifclear
+
+For each of the following commands, there is optionally a corresponding
+package in the main project.
+
+@itemize @bullet
+@item package @code{Binder} for command BIND (invoking @code{^gnatbind^gnatbind^})
+
+@item package @code{Check} for command CHECK (invoking
+ @code{^gnatcheck^gnatcheck^})
+
+@item package @code{Compiler} for command COMP or COMPILE (invoking the compiler)
+
+@item package @code{Cross_Reference} for command XREF (invoking
+ @code{^gnatxref^gnatxref^})
+
+@item package @code{Eliminate} for command ELIM (invoking
+ @code{^gnatelim^gnatelim^})
+
+@item package @code{Finder} for command FIND (invoking @code{^gnatfind^gnatfind^})
+
+@item package @code{Gnatls} for command LS or LIST (invoking @code{^gnatls^gnatls^})
+
+@item package @code{Gnatstub} for command STUB
+ (invoking @code{^gnatstub^gnatstub^})
+
+@item package @code{Linker} for command LINK (invoking @code{^gnatlink^gnatlink^})
+
+@item package @code{Check} for command CHECK
+ (invoking @code{^gnatcheck^gnatcheck^})
+
+@item package @code{Metrics} for command METRIC
+ (invoking @code{^gnatmetric^gnatmetric^})
+
+@item package @code{Pretty_Printer} for command PP or PRETTY
+ (invoking @code{^gnatpp^gnatpp^})
+
+@end itemize
+
+@noindent
+Package @code{Gnatls} has a unique attribute @code{Switches},
+a simple variable with a string list value. It contains ^switches^switches^
+for the invocation of @code{^gnatls^gnatls^}.
+
+@smallexample @c projectfile
+@group
+project Proj1 is
+ package gnatls is
+ for Switches
+ use ("^-a^-a^",
+ "^-v^-v^");
+ end gnatls;
+end Proj1;
+@end group
+@end smallexample
+
+@noindent
+All other packages have two attribute @code{Switches} and
+@code{^Default_Switches^Default_Switches^}.
+
+@code{Switches} is an indexed attribute, indexed by the
+source file name, that has a string list value: the ^switches^switches^ to be
+used when the tool corresponding to the package is invoked for the specific
+source file.
+
+@code{^Default_Switches^Default_Switches^} is an attribute,
+indexed by the programming language that has a string list value.
+@code{^Default_Switches^Default_Switches^ ("Ada")} contains the
+^switches^switches^ for the invocation of the tool corresponding
+to the package, except if a specific @code{Switches} attribute
+is specified for the source file.
+
+@smallexample @c projectfile
+@group
+project Proj is
+
+ for Source_Dirs use ("./**");
+
+ package gnatls is
+ for Switches use
+ ("^-a^-a^",
+ "^-v^-v^");
+ end gnatls;
+@end group
+@group
+
+ package Compiler is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-gnatv^-gnatv^",
+ "^-gnatwa^-gnatwa^");
+ end Binder;
+@end group
+@group
+
+ package Binder is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-C^-C^",
+ "^-e^-e^");
+ end Binder;
+@end group
+@group
+
+ package Linker is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-C^-C^");
+ for Switches ("main.adb")
+ use ("^-C^-C^",
+ "^-v^-v^",
+ "^-v^-v^");
+ end Linker;
+@end group
+@group
+
+ package Finder is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-a^-a^",
+ "^-f^-f^");
+ end Finder;
+@end group
+@group
+
+ package Cross_Reference is
+ for ^Default_Switches^Default_Switches^ ("Ada")
+ use ("^-a^-a^",
+ "^-f^-f^",
+ "^-d^-d^",
+ "^-u^-u^");
+ end Cross_Reference;
+end Proj;
+@end group
+@end smallexample
+
+@noindent
+With the above project file, commands such as
+
+@smallexample
+ ^gnat comp -Pproj main^GNAT COMP /PROJECT_FILE=PROJ MAIN^
+ ^gnat ls -Pproj main^GNAT LIST /PROJECT_FILE=PROJ MAIN^
+ ^gnat xref -Pproj main^GNAT XREF /PROJECT_FILE=PROJ MAIN^
+ ^gnat bind -Pproj main.ali^GNAT BIND /PROJECT_FILE=PROJ MAIN.ALI^
+ ^gnat link -Pproj main.ali^GNAT LINK /PROJECT_FILE=PROJ MAIN.ALI^
+@end smallexample
+
+@noindent
+will set up the environment properly and invoke the tool with the switches
+found in the package corresponding to the tool:
+@code{^Default_Switches^Default_Switches^ ("Ada")} for all tools,
+except @code{Switches ("main.adb")}
+for @code{^gnatlink^gnatlink^}.
+It is also possible to invoke some of the tools,
+(@code{^gnatcheck^gnatcheck^},
+@code{^gnatmetric^gnatmetric^},
+and @code{^gnatpp^gnatpp^})
+on a set of project units thanks to the combination of the switches
+@option{-P}, @option{-U} and possibly the main unit when one is interested
+in its closure. For instance,
+@smallexample
+gnat metric -Pproj
+@end smallexample
+
+@noindent
+will compute the metrics for all the immediate units of project
+@code{proj}.
+@smallexample
+gnat metric -Pproj -U
+@end smallexample
+
+@noindent
+will compute the metrics for all the units of the closure of projects
+rooted at @code{proj}.
+@smallexample
+gnat metric -Pproj -U main_unit
+@end smallexample
+
+@noindent
+will compute the metrics for the closure of units rooted at
+@code{main_unit}. This last possibility relies implicitly
+on @command{gnatbind}'s option @option{-R}. But if the argument files for the
+tool invoked by the the @command{gnat} driver are explicitly specified
+either directly or through the tool @option{-files} option, then the tool
+is called only for these explicitly specified files.
+
+@c ---------------------------------------------
+@node The Development Environments
+@section The Development Environments
+@c ---------------------------------------------
+
+@noindent
+See the appropriate manuals for more details. These environments will
+store a number of settings in the project itself, when they are meant
+to be shared by the whole team working on the project. Here are the
+attributes defined in the package @b{IDE} in projects.
+
+@table @code
+@item Remote_Host
+This is a simple attribute. Its value is a string that designates the remote
+host in a cross-compilation environment, to be used for remote compilation and
+debugging. This field should not be specified when running on the local
+machine.
+
+@item Program_Host
+This is a simple attribute. Its value is a string that specifies the
+name of IP address of the embedded target in a cross-compilation environment,
+on which the program should execute.
+
+@item Communication_Protocol
+This is a simple string attribute. Its value is the name of the protocol
+to use to communicate with the target in a cross-compilation environment,
+e.g.@: @code{"wtx"} or @code{"vxworks"}.
+
+@item Compiler_Command
+This is an associative array attribute, whose domain is a language name. Its
+value is string that denotes the command to be used to invoke the compiler.
+The value of @code{Compiler_Command ("Ada")} is expected to be compatible with
+gnatmake, in particular in the handling of switches.
+
+@item Debugger_Command
+This is simple attribute, Its value is a string that specifies the name of
+the debugger to be used, such as gdb, powerpc-wrs-vxworks-gdb or gdb-4.
+
+@item Default_Switches
+This is an associative array attribute. Its indexes are the name of the
+external tools that the GNAT Programming System (GPS) is supporting. Its
+value is a list of switches to use when invoking that tool.
+
+@item Gnatlist
+This is a simple attribute. Its value is a string that specifies the name
+of the @command{gnatls} utility to be used to retrieve information about the
+predefined path; e.g., @code{"gnatls"}, @code{"powerpc-wrs-vxworks-gnatls"}.
+@item VCS_Kind
+This is a simple attribute. Its value is a string used to specify the
+Version Control System (VCS) to be used for this project, e.g.@: CVS, RCS
+ClearCase or Perforce.
+
+@item VCS_File_Check
+This is a simple attribute. Its value is a string that specifies the
+command used by the VCS to check the validity of a file, either
+when the user explicitly asks for a check, or as a sanity check before
+doing the check-in.
+
+@item VCS_Log_Check
+This is a simple attribute. Its value is a string that specifies
+the command used by the VCS to check the validity of a log file.
+
+@item VCS_Repository_Root
+The VCS repository root path. This is used to create tags or branches
+of the repository. For subversion the value should be the @code{URL}
+as specified to check-out the working copy of the repository.
+
+@item VCS_Patch_Root
+The local root directory to use for building patch file. All patch chunks
+will be relative to this path. The root project directory is used if
+this value is not defined.
+
+@end table
+
+@c ---------------------------------------------
+@node Cleaning up with GPRclean
+@section Cleaning up with GPRclean
+@c ---------------------------------------------
+
+@noindent
+The GPRclean tool removes the files created by GPRbuild.
+At a minimum, to invoke GPRclean you must specify a main project file
+in a command such as @code{gprclean proj.gpr} or @code{gprclean -P proj.gpr}.
+
+Examples of invocation of GPRclean:
+
+@smallexample
+ gprclean -r prj1.gpr
+ gprclean -c -P prj2.gpr
+@end smallexample
+
+@menu
+* Switches for GPRclean::
+@end menu
+
+@c ---------------------------------------------
+@node Switches for GPRclean
+@subsection Switches for GPRclean
+@c ---------------------------------------------
+
+@noindent
+The switches for GPRclean are:
+
+@itemize @bullet
+@item @option{--config=<main config project file name>} : Specify the
+ configuration project file name
+
+@item @option{--autoconf=<config project file name>}
+
+ This specifies a configuration project file name that already exists or will
+ be created automatically. Option @option{--autoconf=}
+ cannot be specified more than once. If the configuration project file
+ specified with @option{--autoconf=} exists, then it is used. Otherwise,
+ @value{gprconfig} is invoked to create it automatically.
+
+@item @option{-c} : Only delete compiler-generated files. Do not delete
+ executables and libraries.
+
+@item @option{-f} : Force deletions of unwritable files
+
+@item @option{-F} : Display full project path name in brief error messages
+
+@item @option{-h} : Display this message
+
+@item @option{-n} : Do not delete files, only list files to delete
+
+@item @option{-P<proj>} : Use Project File @emph{<proj>}.
+
+@item @option{-q} : Be quiet/terse. There is no output, except to report
+ problems.
+
+@item @option{-r} : (recursive) Clean all projects referenced by the main
+ project directly or indirectly. Without this switch, GPRclean only
+ cleans the main project.
+
+@item @option{-v} : Verbose mode
+
+@item @option{-vPx} : Specify verbosity when parsing Project Files.
+ x = 0 (default), 1 or 2.
+
+@item @option{-Xnm=val} : Specify an external reference for Project Files.
+
+@end itemize
+
+
+
diff --git a/gcc/ada/put_scos.adb b/gcc/ada/put_scos.adb
index 39b6288520e..9d3bcd7bb2b 100644
--- a/gcc/ada/put_scos.adb
+++ b/gcc/ada/put_scos.adb
@@ -26,6 +26,38 @@
with SCOs; use SCOs;
procedure Put_SCOs is
+ Ctr : Nat;
+
+ procedure Output_Range (T : SCO_Table_Entry);
+ -- Outputs T.From and T.To in line:col-line:col format
+
+ procedure Output_Source_Location (Loc : Source_Location);
+ -- Output source location in line:col format
+
+ ------------------
+ -- Output_Range --
+ ------------------
+
+ procedure Output_Range (T : SCO_Table_Entry) is
+ begin
+ Output_Source_Location (T.From);
+ Write_Info_Char ('-');
+ Output_Source_Location (T.To);
+ end Output_Range;
+
+ ----------------------------
+ -- Output_Source_Location --
+ ----------------------------
+
+ procedure Output_Source_Location (Loc : Source_Location) is
+ begin
+ Write_Info_Nat (Nat (Loc.Line));
+ Write_Info_Char (':');
+ Write_Info_Nat (Nat (Loc.Col));
+ end Output_Source_Location;
+
+-- Start of processing for Put_SCOs
+
begin
-- Loop through entries in SCO_Unit_Table
@@ -64,35 +96,16 @@ begin
Output_SCO_Line : declare
T : SCO_Table_Entry renames SCO_Table.Table (Start);
- procedure Output_Range (T : SCO_Table_Entry);
- -- Outputs T.From and T.To in line:col-line:col format
-
- ------------------
- -- Output_Range --
- ------------------
-
- procedure Output_Range (T : SCO_Table_Entry) is
- begin
- Write_Info_Nat (Nat (T.From.Line));
- Write_Info_Char (':');
- Write_Info_Nat (Nat (T.From.Col));
- Write_Info_Char ('-');
- Write_Info_Nat (Nat (T.To.Line));
- Write_Info_Char (':');
- Write_Info_Nat (Nat (T.To.Col));
- end Output_Range;
-
- -- Start of processing for Output_SCO_Line
-
begin
- Write_Info_Initiate ('C');
- Write_Info_Char (T.C1);
-
case T.C1 is
-- Statements
when 'S' =>
+ Write_Info_Initiate ('C');
+ Write_Info_Char ('S');
+
+ Ctr := 0;
loop
Write_Info_Char (' ');
@@ -105,8 +118,22 @@ begin
Start := Start + 1;
pragma Assert (SCO_Table.Table (Start).C1 = 's');
+
+ Ctr := Ctr + 1;
+
+ -- Up to 6 items on a line, if more than 6 items,
+ -- continuation lines are marked Cs.
+
+ if Ctr = 6 then
+ Write_Info_Terminate;
+ Write_Info_Initiate ('C');
+ Write_Info_Char ('s');
+ Ctr := 0;
+ end if;
end loop;
+ Write_Info_Terminate;
+
-- Statement continuations should not occur since they
-- are supposed to have been handled in the loop above.
@@ -116,41 +143,59 @@ begin
-- Decision
when 'I' | 'E' | 'P' | 'W' | 'X' =>
- if T.C2 = ' ' then
- Start := Start + 1;
- end if;
+ Start := Start + 1;
- -- Loop through table entries for this decision
+ -- For disabled pragma, skip decision output
- loop
- declare
- T : SCO_Table_Entry renames SCO_Table.Table (Start);
+ if T.C1 = 'P' and then T.C2 = 'd' then
+ while not SCO_Table.Table (Start).Last loop
+ Start := Start + 1;
+ end loop;
+
+ -- For all other cases output decision line
- begin
+ else
+ Write_Info_Initiate ('C');
+ Write_Info_Char (T.C1);
+
+ if T.C1 /= 'X' then
Write_Info_Char (' ');
+ Output_Source_Location (T.From);
+ end if;
- if T.C1 = '!' or else
- T.C1 = '^' or else
- T.C1 = '&' or else
- T.C1 = '|'
- then
- Write_Info_Char (T.C1);
+ -- Loop through table entries for this decision
- else
- Write_Info_Char (T.C2);
- Output_Range (T);
- end if;
+ loop
+ declare
+ T : SCO_Table_Entry
+ renames SCO_Table.Table (Start);
- exit when T.Last;
- Start := Start + 1;
- end;
- end loop;
+ begin
+ Write_Info_Char (' ');
+
+ if T.C1 = '!' or else
+ T.C1 = '&' or else
+ T.C1 = '|'
+ then
+ Write_Info_Char (T.C1);
+ Output_Source_Location (T.From);
+
+ else
+ Write_Info_Char (T.C2);
+ Output_Range (T);
+ end if;
+
+ exit when T.Last;
+ Start := Start + 1;
+ end;
+ end loop;
+
+ Write_Info_Terminate;
+ end if;
when others =>
raise Program_Error;
end case;
-
- Write_Info_Terminate;
end Output_SCO_Line;
Start := Start + 1;
diff --git a/gcc/ada/raise.h b/gcc/ada/raise.h
index b0de4912f30..1ccc37bca01 100644
--- a/gcc/ada/raise.h
+++ b/gcc/ada/raise.h
@@ -29,7 +29,6 @@
* *
****************************************************************************/
-
/* C counterparts of what System.Standard_Library defines. */
typedef unsigned Exception_Code;
@@ -46,16 +45,6 @@ struct Exception_Data
typedef struct Exception_Data *Exception_Id;
-struct Exception_Occurrence
-{
- int Max_Length;
- Exception_Id Id;
- int Msg_Length;
- char Msg[0];
-};
-
-typedef struct Exception_Occurrence *Exception_Occurrence_Access;
-
extern void _gnat_builtin_longjmp (void *, int);
extern void __gnat_unhandled_terminate (void);
extern void *__gnat_malloc (__SIZE_TYPE__);
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index c84996e3ba7..362d1d8cead 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2010, 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- --
@@ -403,7 +403,6 @@ package body Repinfo is
if List_Representation_Info >= 2 then
List_Object_Info (E);
end if;
-
end if;
-- Recurse into nested package, but not if they are package
diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb
index a57ac4c66ee..f7d97baec67 100644
--- a/gcc/ada/restrict.adb
+++ b/gcc/ada/restrict.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -256,6 +256,14 @@ package body Restrict is
-- Start of processing for Check_Restriction
begin
+ -- In CodePeer mode, we do not want to check for any restriction, or
+ -- set additional restrictions than those already set in gnat1drv.adb
+ -- so that we have consistency between each compilation.
+
+ if CodePeer_Mode then
+ return;
+ end if;
+
if UI_Is_In_Int_Range (V) then
VV := Integer (UI_To_Int (V));
else
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 32323fc593e..9742cb20b95 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -1333,8 +1333,8 @@ package body Rtsfind is
-- The RT_Unit_Table entry that may need updating
begin
- -- If entry is not set, set it now, and indicate that it
- -- was loaded through an explicit context clause..
+ -- If entry is not set, set it now, and indicate that it was
+ -- loaded through an explicit context clause.
if No (U.Entity) then
U := (Entity => E,
diff --git a/gcc/ada/s-auxdec-vms-alpha.adb b/gcc/ada/s-auxdec-vms-alpha.adb
new file mode 100644
index 00000000000..063b296f3ac
--- /dev/null
+++ b/gcc/ada/s-auxdec-vms-alpha.adb
@@ -0,0 +1,809 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . A U X _ D E C --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the Alpha/VMS version.
+
+pragma Style_Checks (All_Checks);
+-- Turn off alpha ordering check on subprograms, this unit is laid
+-- out to correspond to the declarations in the DEC 83 System unit.
+
+with System.Machine_Code; use System.Machine_Code;
+package body System.Aux_DEC is
+
+ ------------------------
+ -- Fetch_From_Address --
+ ------------------------
+
+ function Fetch_From_Address (A : Address) return Target is
+ type T_Ptr is access all Target;
+ function To_T_Ptr is new Ada.Unchecked_Conversion (Address, T_Ptr);
+ Ptr : constant T_Ptr := To_T_Ptr (A);
+ begin
+ return Ptr.all;
+ end Fetch_From_Address;
+
+ -----------------------
+ -- Assign_To_Address --
+ -----------------------
+
+ procedure Assign_To_Address (A : Address; T : Target) is
+ type T_Ptr is access all Target;
+ function To_T_Ptr is new Ada.Unchecked_Conversion (Address, T_Ptr);
+ Ptr : constant T_Ptr := To_T_Ptr (A);
+ begin
+ Ptr.all := T;
+ end Assign_To_Address;
+
+ -----------------------
+ -- Clear_Interlocked --
+ -----------------------
+
+ procedure Clear_Interlocked
+ (Bit : in out Boolean;
+ Old_Value : out Boolean)
+ is
+ use ASCII;
+ Clr_Bit : Boolean := Bit;
+ Old_Bit : Boolean;
+
+ begin
+ -- All these ASM sequences should be commented. I suggest definining
+ -- a constant called E which is LF & HT and then you have more space
+ -- for line by line comments ???
+
+ System.Machine_Code.Asm
+ (
+ "lda $16, %2" & LF & HT &
+ "mb" & LF & HT &
+ "sll $16, 3, $17 " & LF & HT &
+ "bis $31, 1, $1" & LF & HT &
+ "and $17, 63, $18" & LF & HT &
+ "bic $17, 63, $17" & LF & HT &
+ "sra $17, 3, $17" & LF & HT &
+ "bis $31, 1, %1" & LF & HT &
+ "sll %1, $18, $18" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, 0($17)" & LF & HT &
+ "and $1, $18, %1" & LF & HT &
+ "bic $1, $18, $1" & LF & HT &
+ "stq_c $1, 0($17)" & LF & HT &
+ "cmpeq %1, 0, %1" & LF & HT &
+ "beq $1, 1b" & LF & HT &
+ "mb" & LF & HT &
+ "xor %1, 1, %1" & LF & HT &
+ "trapb",
+ Outputs => (Boolean'Asm_Output ("=m", Clr_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit)),
+ Inputs => Boolean'Asm_Input ("m", Clr_Bit),
+ Clobber => "$1, $16, $17, $18",
+ Volatile => True);
+
+ Bit := Clr_Bit;
+ Old_Value := Old_Bit;
+ end Clear_Interlocked;
+
+ procedure Clear_Interlocked
+ (Bit : in out Boolean;
+ Old_Value : out Boolean;
+ Retry_Count : Natural;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+ Clr_Bit : Boolean := Bit;
+ Succ, Old_Bit : Boolean;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "lda $16, %3" & LF & HT &
+ "mb" & LF & HT &
+ "sll $16, 3, $18 " & LF & HT &
+ "bis $31, 1, %1" & LF & HT &
+ "and $18, 63, $19" & LF & HT &
+ "bic $18, 63, $18" & LF & HT &
+ "sra $18, 3, $18" & LF & HT &
+ "bis $31, %4, $17" & LF & HT &
+ "sll %1, $19, $19" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l %2, 0($18)" & LF & HT &
+ "and %2, $19, %1" & LF & HT &
+ "bic %2, $19, %2" & LF & HT &
+ "stq_c %2, 0($18)" & LF & HT &
+ "beq %2, 2f" & LF & HT &
+ "cmpeq %1, 0, %1" & LF & HT &
+ "br 3f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "xor %1, 1, %1" & LF & HT &
+ "trapb",
+ Outputs => (Boolean'Asm_Output ("=m", Clr_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit),
+ Boolean'Asm_Output ("=r", Succ)),
+ Inputs => (Boolean'Asm_Input ("m", Clr_Bit),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$16, $17, $18, $19",
+ Volatile => True);
+
+ Bit := Clr_Bit;
+ Old_Value := Old_Bit;
+ Success_Flag := Succ;
+ end Clear_Interlocked;
+
+ ---------------------
+ -- Set_Interlocked --
+ ---------------------
+
+ procedure Set_Interlocked
+ (Bit : in out Boolean;
+ Old_Value : out Boolean)
+ is
+ use ASCII;
+ Set_Bit : Boolean := Bit;
+ Old_Bit : Boolean;
+
+ begin
+ -- Don't we need comments on these long asm sequences???
+
+ System.Machine_Code.Asm
+ (
+ "lda $16, %2" & LF & HT &
+ "sll $16, 3, $17 " & LF & HT &
+ "bis $31, 1, $1" & LF & HT &
+ "and $17, 63, $18" & LF & HT &
+ "mb" & LF & HT &
+ "bic $17, 63, $17" & LF & HT &
+ "sra $17, 3, $17" & LF & HT &
+ "bis $31, 1, %1" & LF & HT &
+ "sll %1, $18, $18" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, 0($17)" & LF & HT &
+ "and $1, $18, %1" & LF & HT &
+ "bis $1, $18, $1" & LF & HT &
+ "stq_c $1, 0($17)" & LF & HT &
+ "cmovne %1, 1, %1" & LF & HT &
+ "beq $1, 1b" & LF & HT &
+ "mb" & LF & HT &
+ "trapb",
+ Outputs => (Boolean'Asm_Output ("=m", Set_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit)),
+ Inputs => Boolean'Asm_Input ("m", Set_Bit),
+ Clobber => "$1, $16, $17, $18",
+ Volatile => True);
+
+ Bit := Set_Bit;
+ Old_Value := Old_Bit;
+ end Set_Interlocked;
+
+ procedure Set_Interlocked
+ (Bit : in out Boolean;
+ Old_Value : out Boolean;
+ Retry_Count : Natural;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+ Set_Bit : Boolean := Bit;
+ Succ, Old_Bit : Boolean;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "lda $16, %3" & LF & HT &
+ "mb" & LF & HT &
+ "sll $16, 3, $18 " & LF & HT &
+ "bis $31, 1, %1" & LF & HT &
+ "and $18, 63, $19" & LF & HT &
+ "bic $18, 63, $18" & LF & HT &
+ "sra $18, 3, $18" & LF & HT &
+ "bis $31, %4, $17" & LF & HT &
+ "sll %1, $19, $19" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l %2, 0($18)" & LF & HT &
+ "and %2, $19, %1" & LF & HT &
+ "bis %2, $19, %2" & LF & HT &
+ "stq_c %2, 0($18)" & LF & HT &
+ "beq %2, 2f" & LF & HT &
+ "cmovne %1, 1, %1" & LF & HT &
+ "br 3f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "trapb",
+ Outputs => (Boolean'Asm_Output ("=m", Set_Bit),
+ Boolean'Asm_Output ("=r", Old_Bit),
+ Boolean'Asm_Output ("=r", Succ)),
+ Inputs => (Boolean'Asm_Input ("m", Set_Bit),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$16, $17, $18, $19",
+ Volatile => True);
+
+ Bit := Set_Bit;
+ Old_Value := Old_Bit;
+ Success_Flag := Succ;
+ end Set_Interlocked;
+
+ ---------------------
+ -- Add_Interlocked --
+ ---------------------
+
+ procedure Add_Interlocked
+ (Addend : Short_Integer;
+ Augend : in out Aligned_Word;
+ Sign : out Integer)
+ is
+ use ASCII;
+ Overflowed : Boolean := False;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "lda $18, %0" & LF & HT &
+ "bic $18, 6, $21" & LF & HT &
+ "mb" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $0, 0($21)" & LF & HT &
+ "extwl $0, $18, $19" & LF & HT &
+ "mskwl $0, $18, $0" & LF & HT &
+ "addq $19, %3, $20" & LF & HT &
+ "inswl $20, $18, $17" & LF & HT &
+ "xor $19, %3, $19" & LF & HT &
+ "bis $17, $0, $0" & LF & HT &
+ "stq_c $0, 0($21)" & LF & HT &
+ "beq $0, 1b" & LF & HT &
+ "srl $20, 16, $0" & LF & HT &
+ "mb" & LF & HT &
+ "srl $20, 12, $21" & LF & HT &
+ "zapnot $20, 3, $20" & LF & HT &
+ "and $0, 1, $0" & LF & HT &
+ "and $21, 8, $21" & LF & HT &
+ "bis $21, $0, $0" & LF & HT &
+ "cmpeq $20, 0, $21" & LF & HT &
+ "xor $20, 2, $20" & LF & HT &
+ "sll $21, 2, $21" & LF & HT &
+ "bis $21, $0, $0" & LF & HT &
+ "bic $20, $19, $21" & LF & HT &
+ "srl $21, 14, $21" & LF & HT &
+ "and $21, 2, $21" & LF & HT &
+ "bis $21, $0, $0" & LF & HT &
+ "and $0, 2, %2" & LF & HT &
+ "bne %2, 2f" & LF & HT &
+ "and $0, 4, %1" & LF & HT &
+ "cmpeq %1, 0, %1" & LF & HT &
+ "and $0, 8, $0" & LF & HT &
+ "lda $16, -1" & LF & HT &
+ "cmovne $0, $16, %1" & LF & HT &
+ "2:",
+ Outputs => (Aligned_Word'Asm_Output ("=m", Augend),
+ Integer'Asm_Output ("=r", Sign),
+ Boolean'Asm_Output ("=r", Overflowed)),
+ Inputs => (Short_Integer'Asm_Input ("r", Addend),
+ Aligned_Word'Asm_Input ("m", Augend)),
+ Clobber => "$0, $1, $16, $17, $18, $19, $20, $21",
+ Volatile => True);
+
+ if Overflowed then
+ raise Constraint_Error;
+ end if;
+ end Add_Interlocked;
+
+ ----------------
+ -- Add_Atomic --
+ ----------------
+
+ procedure Add_Atomic
+ (To : in out Aligned_Integer;
+ Amount : Integer)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "1:" & LF & HT &
+ "ldl_l $1, %0" & LF & HT &
+ "addl $1, %2, $0" & LF & HT &
+ "stl_c $0, %1" & LF & HT &
+ "beq $0, 1b" & LF & HT &
+ "mb",
+ Outputs => Aligned_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", Amount)),
+ Clobber => "$0, $1",
+ Volatile => True);
+ end Add_Atomic;
+
+ procedure Add_Atomic
+ (To : in out Aligned_Integer;
+ Amount : Integer;
+ Retry_Count : Natural;
+ Old_Value : out Integer;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "bis $31, %5, $17" & LF & HT &
+ "1:" & LF & HT &
+ "ldl_l $1, %0" & LF & HT &
+ "addl $1, %4, $0" & LF & HT &
+ "stl_c $0, %3" & LF & HT &
+ "beq $0, 2f" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "stq $0, %2" & LF & HT &
+ "stl $1, %1" & LF & HT &
+ "br 4f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "br 3b" & LF & HT &
+ "4:",
+ Outputs => (Aligned_Integer'Asm_Output ("=m", To),
+ Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", Amount),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
+ Volatile => True);
+ end Add_Atomic;
+
+ procedure Add_Atomic
+ (To : in out Aligned_Long_Integer;
+ Amount : Long_Integer)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, %0" & LF & HT &
+ "addq $1, %2, $0" & LF & HT &
+ "stq_c $0, %1" & LF & HT &
+ "beq $0, 1b" & LF & HT &
+ "mb",
+ Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", Amount)),
+ Clobber => "$0, $1",
+ Volatile => True);
+ end Add_Atomic;
+
+ procedure Add_Atomic
+ (To : in out Aligned_Long_Integer;
+ Amount : Long_Integer;
+ Retry_Count : Natural;
+ Old_Value : out Long_Integer;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "bis $31, %5, $17" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, %0" & LF & HT &
+ "addq $1, %4, $0" & LF & HT &
+ "stq_c $0, %3" & LF & HT &
+ "beq $0, 2f" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "stq $0, %2" & LF & HT &
+ "stq $1, %1" & LF & HT &
+ "br 4f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "br 3b" & LF & HT &
+ "4:",
+ Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
+ Long_Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", Amount),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
+ Volatile => True);
+ end Add_Atomic;
+
+ ----------------
+ -- And_Atomic --
+ ----------------
+
+ procedure And_Atomic
+ (To : in out Aligned_Integer;
+ From : Integer)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "1:" & LF & HT &
+ "ldl_l $1, %0" & LF & HT &
+ "and $1, %2, $0" & LF & HT &
+ "stl_c $0, %1" & LF & HT &
+ "beq $0, 1b" & LF & HT &
+ "mb",
+ Outputs => Aligned_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
+ Volatile => True);
+ end And_Atomic;
+
+ procedure And_Atomic
+ (To : in out Aligned_Integer;
+ From : Integer;
+ Retry_Count : Natural;
+ Old_Value : out Integer;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "bis $31, %5, $17" & LF & HT &
+ "1:" & LF & HT &
+ "ldl_l $1, %0" & LF & HT &
+ "and $1, %4, $0" & LF & HT &
+ "stl_c $0, %3" & LF & HT &
+ "beq $0, 2f" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "stq $0, %2" & LF & HT &
+ "stl $1, %1" & LF & HT &
+ "br 4f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "br 3b" & LF & HT &
+ "4:",
+ Outputs => (Aligned_Integer'Asm_Output ("=m", To),
+ Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
+ Volatile => True);
+ end And_Atomic;
+
+ procedure And_Atomic
+ (To : in out Aligned_Long_Integer;
+ From : Long_Integer)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, %0" & LF & HT &
+ "and $1, %2, $0" & LF & HT &
+ "stq_c $0, %1" & LF & HT &
+ "beq $0, 1b" & LF & HT &
+ "mb",
+ Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
+ Volatile => True);
+ end And_Atomic;
+
+ procedure And_Atomic
+ (To : in out Aligned_Long_Integer;
+ From : Long_Integer;
+ Retry_Count : Natural;
+ Old_Value : out Long_Integer;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "bis $31, %5, $17" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, %0" & LF & HT &
+ "and $1, %4, $0" & LF & HT &
+ "stq_c $0, %3" & LF & HT &
+ "beq $0, 2f" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "stq $0, %2" & LF & HT &
+ "stq $1, %1" & LF & HT &
+ "br 4f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "br 3b" & LF & HT &
+ "4:",
+ Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
+ Long_Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
+ Volatile => True);
+ end And_Atomic;
+
+ ---------------
+ -- Or_Atomic --
+ ---------------
+
+ procedure Or_Atomic
+ (To : in out Aligned_Integer;
+ From : Integer)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "1:" & LF & HT &
+ "ldl_l $1, %0" & LF & HT &
+ "bis $1, %2, $0" & LF & HT &
+ "stl_c $0, %1" & LF & HT &
+ "beq $0, 1b" & LF & HT &
+ "mb",
+ Outputs => Aligned_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
+ Volatile => True);
+ end Or_Atomic;
+
+ procedure Or_Atomic
+ (To : in out Aligned_Integer;
+ From : Integer;
+ Retry_Count : Natural;
+ Old_Value : out Integer;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "bis $31, %5, $17" & LF & HT &
+ "1:" & LF & HT &
+ "ldl_l $1, %0" & LF & HT &
+ "bis $1, %4, $0" & LF & HT &
+ "stl_c $0, %3" & LF & HT &
+ "beq $0, 2f" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "stq $0, %2" & LF & HT &
+ "stl $1, %1" & LF & HT &
+ "br 4f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "br 3b" & LF & HT &
+ "4:",
+ Outputs => (Aligned_Integer'Asm_Output ("=m", To),
+ Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Integer'Asm_Input ("m", To),
+ Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
+ Volatile => True);
+ end Or_Atomic;
+
+ procedure Or_Atomic
+ (To : in out Aligned_Long_Integer;
+ From : Long_Integer)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, %0" & LF & HT &
+ "bis $1, %2, $0" & LF & HT &
+ "stq_c $0, %1" & LF & HT &
+ "beq $0, 1b" & LF & HT &
+ "mb",
+ Outputs => Aligned_Long_Integer'Asm_Output ("=m", To),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From)),
+ Clobber => "$0, $1",
+ Volatile => True);
+ end Or_Atomic;
+
+ procedure Or_Atomic
+ (To : in out Aligned_Long_Integer;
+ From : Long_Integer;
+ Retry_Count : Natural;
+ Old_Value : out Long_Integer;
+ Success_Flag : out Boolean)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "mb" & LF & HT &
+ "bis $31, %5, $17" & LF & HT &
+ "1:" & LF & HT &
+ "ldq_l $1, %0" & LF & HT &
+ "bis $1, %4, $0" & LF & HT &
+ "stq_c $0, %3" & LF & HT &
+ "beq $0, 2f" & LF & HT &
+ "3:" & LF & HT &
+ "mb" & LF & HT &
+ "stq $0, %2" & LF & HT &
+ "stq $1, %1" & LF & HT &
+ "br 4f" & LF & HT &
+ "2:" & LF & HT &
+ "subq $17, 1, $17" & LF & HT &
+ "bgt $17, 1b" & LF & HT &
+ "br 3b" & LF & HT &
+ "4:",
+ Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To),
+ Long_Integer'Asm_Output ("=m", Old_Value),
+ Boolean'Asm_Output ("=m", Success_Flag)),
+ Inputs => (Aligned_Long_Integer'Asm_Input ("m", To),
+ Long_Integer'Asm_Input ("rJ", From),
+ Natural'Asm_Input ("rJ", Retry_Count)),
+ Clobber => "$0, $1, $17",
+ Volatile => True);
+ end Or_Atomic;
+
+ ------------
+ -- Insqhi --
+ ------------
+
+ procedure Insqhi
+ (Item : Address;
+ Header : Address;
+ Status : out Insq_Status)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "bis $31, %1, $17" & LF & HT &
+ "bis $31, %2, $16" & LF & HT &
+ "mb" & LF & HT &
+ "call_pal 0x87" & LF & HT &
+ "mb",
+ Outputs => Insq_Status'Asm_Output ("=v", Status),
+ Inputs => (Address'Asm_Input ("rJ", Item),
+ Address'Asm_Input ("rJ", Header)),
+ Clobber => "$16, $17",
+ Volatile => True);
+ end Insqhi;
+
+ ------------
+ -- Remqhi --
+ ------------
+
+ procedure Remqhi
+ (Header : Address;
+ Item : out Address;
+ Status : out Remq_Status)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "bis $31, %2, $16" & LF & HT &
+ "mb" & LF & HT &
+ "call_pal 0x93" & LF & HT &
+ "mb" & LF & HT &
+ "bis $31, $1, %1",
+ Outputs => (Remq_Status'Asm_Output ("=v", Status),
+ Address'Asm_Output ("=r", Item)),
+ Inputs => Address'Asm_Input ("rJ", Header),
+ Clobber => "$1, $16",
+ Volatile => True);
+ end Remqhi;
+
+ ------------
+ -- Insqti --
+ ------------
+
+ procedure Insqti
+ (Item : Address;
+ Header : Address;
+ Status : out Insq_Status)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "bis $31, %1, $17" & LF & HT &
+ "bis $31, %2, $16" & LF & HT &
+ "mb" & LF & HT &
+ "call_pal 0x88" & LF & HT &
+ "mb",
+ Outputs => Insq_Status'Asm_Output ("=v", Status),
+ Inputs => (Address'Asm_Input ("rJ", Item),
+ Address'Asm_Input ("rJ", Header)),
+ Clobber => "$16, $17",
+ Volatile => True);
+ end Insqti;
+
+ ------------
+ -- Remqti --
+ ------------
+
+ procedure Remqti
+ (Header : Address;
+ Item : out Address;
+ Status : out Remq_Status)
+ is
+ use ASCII;
+
+ begin
+ System.Machine_Code.Asm
+ (
+ "bis $31, %2, $16" & LF & HT &
+ "mb" & LF & HT &
+ "call_pal 0x94" & LF & HT &
+ "mb" & LF & HT &
+ "bis $31, $1, %1",
+ Outputs => (Remq_Status'Asm_Output ("=v", Status),
+ Address'Asm_Output ("=r", Item)),
+ Inputs => Address'Asm_Input ("rJ", Header),
+ Clobber => "$1, $16",
+ Volatile => True);
+ end Remqti;
+
+end System.Aux_DEC;
diff --git a/gcc/ada/s-auxdec-vms_64.ads b/gcc/ada/s-auxdec-vms_64.ads
index 3213e18a642..1480a441887 100644
--- a/gcc/ada/s-auxdec-vms_64.ads
+++ b/gcc/ada/s-auxdec-vms_64.ads
@@ -112,6 +112,9 @@ package System.Aux_DEC is
function "-" (Left : Address; Right : Address) return Integer;
function "-" (Left : Address; Right : Integer) return Address;
+ pragma Import (Intrinsic, "+");
+ pragma Import (Intrinsic, "-");
+
generic
type Target is private;
function Fetch_From_Address (A : Address) return Target;
@@ -227,16 +230,16 @@ package System.Aux_DEC is
type Unsigned_Quadword_Array is
array (Integer range <>) of Unsigned_Quadword;
- function To_Address (X : Integer) return Address;
+ function To_Address (X : Integer) return Short_Address;
pragma Pure_Function (To_Address);
- function To_Address_Long (X : Unsigned_Longword) return Address;
+ function To_Address_Long (X : Unsigned_Longword) return Short_Address;
pragma Pure_Function (To_Address_Long);
- function To_Integer (X : Address) return Integer;
+ function To_Integer (X : Short_Address) return Integer;
- function To_Unsigned_Longword (X : Address) return Unsigned_Longword;
- function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword;
+ function To_Unsigned_Longword (X : Short_Address) return Unsigned_Longword;
+ function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword;
-- Conventional names for static subtypes of type UNSIGNED_LONGWORD
@@ -461,12 +464,10 @@ private
-- them intrinsic, since the backend can handle them, but the front
-- end is not prepared to deal with them, so at least inline them.
- pragma Inline_Always ("+");
- pragma Inline_Always ("-");
- pragma Inline_Always ("not");
- pragma Inline_Always ("and");
- pragma Inline_Always ("or");
- pragma Inline_Always ("xor");
+ pragma Import (Intrinsic, "not");
+ pragma Import (Intrinsic, "and");
+ pragma Import (Intrinsic, "or");
+ pragma Import (Intrinsic, "xor");
-- Other inlined subprograms
@@ -578,6 +579,13 @@ private
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (Or_Atomic);
+ -- Inline the VAX Queue Funtions
+
+ pragma Inline_Always (Insqhi);
+ pragma Inline_Always (Remqhi);
+ pragma Inline_Always (Insqti);
+ pragma Inline_Always (Remqti);
+
-- Provide proper unchecked conversion definitions for transfer
-- functions. Note that we need this level of indirection because
-- the formal parameter name is X and not Source (and this is indeed
@@ -649,31 +657,31 @@ private
-- want warnings when we compile on such systems.
function To_Address_A is new
- Ada.Unchecked_Conversion (Integer, Address);
+ Ada.Unchecked_Conversion (Integer, Short_Address);
pragma Pure_Function (To_Address_A);
- function To_Address (X : Integer) return Address
+ function To_Address (X : Integer) return Short_Address
renames To_Address_A;
pragma Pure_Function (To_Address);
function To_Address_Long_A is new
- Ada.Unchecked_Conversion (Unsigned_Longword, Address);
+ Ada.Unchecked_Conversion (Unsigned_Longword, Short_Address);
pragma Pure_Function (To_Address_Long_A);
- function To_Address_Long (X : Unsigned_Longword) return Address
+ function To_Address_Long (X : Unsigned_Longword) return Short_Address
renames To_Address_Long_A;
pragma Pure_Function (To_Address_Long);
function To_Integer_A is new
- Ada.Unchecked_Conversion (Address, Integer);
+ Ada.Unchecked_Conversion (Short_Address, Integer);
- function To_Integer (X : Address) return Integer
+ function To_Integer (X : Short_Address) return Integer
renames To_Integer_A;
function To_Unsigned_Longword_A is new
- Ada.Unchecked_Conversion (Address, Unsigned_Longword);
+ Ada.Unchecked_Conversion (Short_Address, Unsigned_Longword);
- function To_Unsigned_Longword (X : Address) return Unsigned_Longword
+ function To_Unsigned_Longword (X : Short_Address) return Unsigned_Longword
renames To_Unsigned_Longword_A;
function To_Unsigned_Longword_A is new
diff --git a/gcc/ada/s-crtl.ads b/gcc/ada/s-crtl.ads
index 7d5f1107add..345e9a570ea 100644
--- a/gcc/ada/s-crtl.ads
+++ b/gcc/ada/s-crtl.ads
@@ -59,6 +59,9 @@ package System.CRTL is
type size_t is mod 2 ** Standard'Address_Size;
+ type ssize_t is range -(2 ** (Standard'Address_Size - 1))
+ .. +(2 ** (Standard'Address_Size - 1)) - 1;
+
type Filename_Encoding is (UTF8, ASCII_8bits, Unspecified);
for Filename_Encoding use (UTF8 => 0, ASCII_8bits => 1, Unspecified => 2);
pragma Convention (C, Filename_Encoding);
@@ -187,10 +190,10 @@ package System.CRTL is
function close (fd : int) return int;
pragma Import (C, close, "close");
- function read (fd : int; buffer : chars; nbytes : int) return int;
+ function read (fd : int; buffer : chars; count : size_t) return ssize_t;
pragma Import (C, read, "read");
- function write (fd : int; buffer : chars; nbytes : int) return int;
+ function write (fd : int; buffer : chars; count : size_t) return ssize_t;
pragma Import (C, write, "write");
end System.CRTL;
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb
index 60a96e427cf..185fc52cff9 100644
--- a/gcc/ada/s-fileio.adb
+++ b/gcc/ada/s-fileio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -104,7 +104,7 @@ package body System.File_IO is
File_Names_Case_Sensitive : constant Boolean := Get_Case_Sensitive /= 0;
-- Set to indicate whether the operating system convention is for file
-- names to be case sensitive (e.g., in Unix, set True), or non case
- -- sensitive (e.g., in OS/2, set False).
+ -- sensitive (e.g., in Windows, set False).
-----------------------
-- Local Subprograms --
diff --git a/gcc/ada/s-filofl.ads b/gcc/ada/s-filofl.ads
index 319fc8f41f0..e3aba15d571 100644
--- a/gcc/ada/s-filofl.ads
+++ b/gcc/ada/s-filofl.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005,2009 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
diff --git a/gcc/ada/s-finimp.adb b/gcc/ada/s-finimp.adb
index 9a5e534b4d4..050f79995ec 100644
--- a/gcc/ada/s-finimp.adb
+++ b/gcc/ada/s-finimp.adb
@@ -332,10 +332,10 @@ package body System.Finalization_Implementation is
P : Finalizable_Ptr := L;
Q : Finalizable_Ptr;
- type Fake_Exception_Occurence is record
+ type Fake_Exception_Occurrence is record
Id : Exception_Id;
end record;
- type Ptr is access all Fake_Exception_Occurence;
+ type Ptr is access all Fake_Exception_Occurrence;
function To_Ptr is new
Ada.Unchecked_Conversion (Exception_Occurrence_Access, Ptr);
diff --git a/gcc/ada/s-interr.adb b/gcc/ada/s-interr.adb
index 02231a46328..3d33f6c9e13 100644
--- a/gcc/ada/s-interr.adb
+++ b/gcc/ada/s-interr.adb
@@ -367,11 +367,27 @@ package body System.Interrupts is
--------------
procedure Finalize (Object : in out Static_Interrupt_Protection) is
+ function State
+ (Int : System.Interrupt_Management.Interrupt_ID) return Character;
+ pragma Import (C, State, "__gnat_get_interrupt_state");
+ -- Get interrupt state for interrupt number Int. Defined in init.c
+
+ Default : constant Character := 's';
+ -- 's' Interrupt_State pragma set state to System (use "default"
+ -- system handler)
+
begin
-- ??? loop to be executed only when we're not doing library level
-- finalization, since in this case all interrupt tasks are gone.
- if not Interrupt_Manager'Terminated then
+ -- If the Abort_Task signal is set to system, it means that we cannot
+ -- reset interrupt handlers since this would require sending the abort
+ -- signal to the Server_Task
+
+ if not Interrupt_Manager'Terminated
+ and then State (System.Interrupt_Management.Abort_Task_Interrupt)
+ /= Default
+ then
for N in reverse Object.Previous_Handlers'Range loop
Interrupt_Manager.Attach_Handler
(New_Handler => Object.Previous_Handlers (N).Handler,
diff --git a/gcc/ada/s-intman-vxworks.ads b/gcc/ada/s-intman-vxworks.ads
index be1165db448..5614553c77b 100644
--- a/gcc/ada/s-intman-vxworks.ads
+++ b/gcc/ada/s-intman-vxworks.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -59,8 +59,7 @@ package System.Interrupt_Management is
type Interrupt_Set is array (Interrupt_ID) of Boolean;
- subtype Signal_ID is Interrupt_ID
- range 0 .. Interfaces.C."-" (System.OS_Interface.NSIG, 1);
+ subtype Signal_ID is Interrupt_ID range 0 .. System.OS_Interface.NSIG - 1;
type Signal_Set is array (Signal_ID) of Boolean;
@@ -74,7 +73,7 @@ package System.Interrupt_Management is
-- convention that ID zero is not used for any "real" signals, and SIGRARE
-- = 0 when SIGRARE is not one of the locally supported signals, we can
-- write:
- -- Reserved (SIGRARE) := true;
+ -- Reserved (SIGRARE) := True;
-- and the initialization code will be portable.
Abort_Task_Interrupt : Signal_ID;
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb
index f7341367688..c7ca149ab68 100755
--- a/gcc/ada/s-os_lib.adb
+++ b/gcc/ada/s-os_lib.adb
@@ -2309,8 +2309,11 @@ package body System.OS_Lib is
N : Integer) return Integer
is
begin
- return Integer (System.CRTL.read
- (System.CRTL.int (FD), System.CRTL.chars (A), System.CRTL.int (N)));
+ return
+ Integer (System.CRTL.read
+ (System.CRTL.int (FD),
+ System.CRTL.chars (A),
+ System.CRTL.size_t (N)));
end Read;
-----------------
@@ -2718,8 +2721,11 @@ package body System.OS_Lib is
N : Integer) return Integer
is
begin
- return Integer (System.CRTL.write
- (System.CRTL.int (FD), System.CRTL.chars (A), System.CRTL.int (N)));
+ return
+ Integer (System.CRTL.write
+ (System.CRTL.int (FD),
+ System.CRTL.chars (A),
+ System.CRTL.size_t (N)));
end Write;
end System.OS_Lib;
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index 1e8bd520ceb..7e34a74b611 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -98,6 +98,22 @@ pragma Style_Checks ("M32766");
#include <limits.h>
#include <fcntl.h>
+#if defined (__alpha__) && defined (__osf__)
+/** Tru64 is unable to do vector IO operations with default value of IOV_MAX,
+ ** so its value is redefined to a small one which is known to work properly.
+ **/
+#undef IOV_MAX
+#define IOV_MAX 16
+#endif
+
+#if defined (__VMS)
+/** VMS is unable to do vector IO operations with default value of IOV_MAX,
+ ** so its value is redefined to a small one which is known to work properly.
+ **/
+#undef IOV_MAX
+#define IOV_MAX 16
+#endif
+
#if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
defined (__nucleus__))
# define HAVE_TERMIOS
@@ -1215,26 +1231,13 @@ CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
#define SIZEOF_fd_set (sizeof (fd_set))
CND(SIZEOF_fd_set, "fd_set");
+#define SIZEOF_struct_hostent (sizeof (struct hostent))
+CND(SIZEOF_struct_hostent, "struct hostent");
+
#define SIZEOF_struct_servent (sizeof (struct servent))
CND(SIZEOF_struct_servent, "struct servent");
/*
- -- Fields of struct hostent
-*/
-
-#ifdef __MINGW32__
-# define h_addrtype_t "short"
-# define h_length_t "short"
-#else
-# define h_addrtype_t "int"
-# define h_length_t "int"
-#endif
-
-TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";")
-TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";")
-
-/*
-
-- Fields of struct msghdr
*/
@@ -1255,6 +1258,7 @@ TXT(" subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
*/
CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
+CND(Need_Netdb_Lock, "Need lock for Netdb ops")
CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
/**
diff --git a/gcc/ada/s-osinte-hpux-dce.ads b/gcc/ada/s-osinte-hpux-dce.ads
index 417aae98e91..f39cbfdec34 100644
--- a/gcc/ada/s-osinte-hpux-dce.ads
+++ b/gcc/ada/s-osinte-hpux-dce.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2009, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index 323fc158f05..6c0f1353762 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2009, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
diff --git a/gcc/ada/s-osinte-vxworks.ads b/gcc/ada/s-osinte-vxworks.ads
index 0eda1ef603c..dd5f1eb1d6c 100644
--- a/gcc/ada/s-osinte-vxworks.ads
+++ b/gcc/ada/s-osinte-vxworks.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -490,8 +490,6 @@ package System.OS_Interface is
-- For uniprocessor systems return ERROR status.
private
- type sigset_t is new unsigned_long_long;
-
type pid_t is new int;
ERROR_PID : constant pid_t := -1;
@@ -499,4 +497,5 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
+ type sigset_t is new System.VxWorks.Ext.sigset_t;
end System.OS_Interface;
diff --git a/gcc/ada/s-rannum.adb b/gcc/ada/s-rannum.adb
index 4480c693e8e..d85dd2efacf 100644
--- a/gcc/ada/s-rannum.adb
+++ b/gcc/ada/s-rannum.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2007,2009 Free Software Foundation, Inc. --
+-- Copyright (C) 2007-2010, 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- --
@@ -86,44 +86,74 @@
-- --
------------------------------------------------------------------------------
-with Ada.Calendar; use Ada.Calendar;
+with Ada.Calendar; use Ada.Calendar;
with Ada.Unchecked_Conversion;
-with Interfaces; use Interfaces;
+
+with Interfaces; use Interfaces;
use Ada;
package body System.Random_Numbers is
- -------------------------
- -- Implementation Note --
- -------------------------
-
- -- The design of this spec is very awkward, as a result of Ada 95 not
- -- permitting in-out parameters for function formals (most naturally,
- -- Generator values would be passed this way). In pure Ada 95, the only
- -- solution is to use the heap and pointers, and, to avoid memory leaks,
- -- controlled types.
-
- -- This is awfully heavy, so what we do is to use Unrestricted_Access to
- -- get a pointer to the state in the passed Generator. This works because
- -- Generator is a limited type and will thus always be passed by reference.
-
- Low31_Mask : constant := 2**31-1;
- Bit31_Mask : constant := 2**31;
-
- Matrix_A_X : constant array (State_Val range 0 .. 1) of State_Val :=
- (0, 16#9908b0df#);
-
Y2K : constant Calendar.Time :=
Calendar.Time_Of
(Year => 2000, Month => 1, Day => 1, Seconds => 0.0);
- -- First Year 2000 day
+ -- First day of Year 2000 (what is this for???)
+ Image_Numeral_Length : constant := Max_Image_Width / N;
subtype Image_String is String (1 .. Max_Image_Width);
- -- Utility functions
-
- procedure Init (Gen : out Generator; Initiator : Unsigned_32);
+ ----------------------------
+ -- Algorithmic Parameters --
+ ----------------------------
+
+ Lower_Mask : constant := 2**31-1;
+ Upper_Mask : constant := 2**31;
+
+ Matrix_A : constant array (State_Val range 0 .. 1) of State_Val
+ := (0, 16#9908b0df#);
+ -- The twist transformation is represented by a matrix of the form
+ --
+ -- [ 0 I(31) ]
+ -- [ _a ]
+ --
+ -- where 0 is a 31x31 block of 0s, I(31) is the 31x31 identity matrix and
+ -- _a is a particular bit row-vector, represented here by a 32-bit integer.
+ -- If integer x represents a row vector of bits (with x(0), the units bit,
+ -- last), then
+ -- x * A = [0 x(31..1)] xor Matrix_A(x(0)).
+
+ U : constant := 11;
+ S : constant := 7;
+ B_Mask : constant := 16#9d2c5680#;
+ T : constant := 15;
+ C_Mask : constant := 16#efc60000#;
+ L : constant := 18;
+ -- The tempering shifts and bit masks, in the order applied
+
+ Seed0 : constant := 5489;
+ -- Default seed, used to initialize the state vector when Reset not called
+
+ Seed1 : constant := 19650218;
+ -- Seed used to initialize the state vector when calling Reset with an
+ -- initialization vector.
+
+ Mult0 : constant := 1812433253;
+ -- Multiplier for a modified linear congruential generator used to
+ -- initialize the state vector when calling Reset with a single integer
+ -- seed.
+
+ Mult1 : constant := 1664525;
+ Mult2 : constant := 1566083941;
+ -- Multipliers for two modified linear congruential generators used to
+ -- initialize the state vector when calling Reset with an initialization
+ -- vector.
+
+ -----------------------
+ -- Local Subprograms --
+ -----------------------
+
+ procedure Init (Gen : Generator; Initiator : Unsigned_32);
-- Perform a default initialization of the state of Gen. The resulting
-- state is identical for identical values of Initiator.
@@ -147,75 +177,208 @@ package body System.Random_Numbers is
------------
function Random (Gen : Generator) return Unsigned_32 is
- G : Generator renames Gen'Unrestricted_Access.all;
+ G : Generator renames Gen.Writable.Self.all;
Y : State_Val;
- I : Integer;
+ I : Integer; -- should avoid use of identifier I ???
begin
I := G.I;
if I < N - M then
- Y := (G.S (I) and Bit31_Mask) or (G.S (I + 1) and Low31_Mask);
- Y := G.S (I + M) xor Shift_Right (Y, 1) xor Matrix_A_X (Y and 1);
+ Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask);
+ Y := G.S (I + M) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1);
I := I + 1;
elsif I < N - 1 then
- Y := (G.S (I) and Bit31_Mask) or (G.S (I + 1) and Low31_Mask);
+ Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask);
Y := G.S (I + (M - N))
xor Shift_Right (Y, 1)
- xor Matrix_A_X (Y and 1);
+ xor Matrix_A (Y and 1);
I := I + 1;
elsif I = N - 1 then
- Y := (G.S (I) and Bit31_Mask) or (G.S (0) and Low31_Mask);
- Y := G.S (M - 1) xor Shift_Right (Y, 1) xor Matrix_A_X (Y and 1);
+ Y := (G.S (I) and Upper_Mask) or (G.S (0) and Lower_Mask);
+ Y := G.S (M - 1) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1);
I := 0;
else
- Init (G, 5489);
+ Init (G, Seed0);
return Random (Gen);
end if;
G.S (G.I) := Y;
G.I := I;
- Y := Y xor Shift_Right (Y, 11);
- Y := Y xor (Shift_Left (Y, 7) and 16#9d2c5680#);
- Y := Y xor (Shift_Left (Y, 15) and 16#efc60000#);
- Y := Y xor Shift_Right (Y, 18);
+ Y := Y xor Shift_Right (Y, U);
+ Y := Y xor (Shift_Left (Y, S) and B_Mask);
+ Y := Y xor (Shift_Left (Y, T) and C_Mask);
+ Y := Y xor Shift_Right (Y, L);
return Y;
end Random;
- function Random (Gen : Generator) return Float is
+ generic
+ type Unsigned is mod <>;
+ type Real is digits <>;
+ with function Random (G : Generator) return Unsigned is <>;
+ function Random_Float_Template (Gen : Generator) return Real;
+ pragma Inline (Random_Float_Template);
+ -- Template for a random-number generator implementation that delivers
+ -- values of type Real in the range [0 .. 1], using values from Gen,
+ -- assuming that Unsigned is large enough to hold the bits of a mantissa
+ -- for type Real.
+
+ ---------------------------
+ -- Random_Float_Template --
+ ---------------------------
- -- Note: The application of Float'Machine (...) is necessary to avoid
- -- returning extra significand bits. Without it, the function's value
- -- will change if it is spilled, for example, causing
- -- gratuitous nondeterminism.
+ function Random_Float_Template (Gen : Generator) return Real is
+
+ pragma Compile_Time_Error
+ (Unsigned'Last <= 2**(Real'Machine_Mantissa - 1),
+ "insufficiently large modular type used to hold mantissa");
- Result : constant Float :=
- Float'Machine
- (Float (Unsigned_32'(Random (Gen))) * 2.0 ** (-32));
begin
- if Result < 1.0 then
- return Result;
+ -- This code generates random floating-point numbers from unsigned
+ -- integers. Assuming that Real'Machine_Radix = 2, it can deliver all
+ -- machine values of type Real (as implied by Real'Machine_Mantissa and
+ -- Real'Machine_Emin), which is not true of the standard method (to
+ -- which we fall back for non-binary radix): computing Real(<random
+ -- integer>) / (<max random integer>+1). To do so, we first extract an
+ -- (M-1)-bit significand (where M is Real'Machine_Mantissa), and then
+ -- decide on a normalized exponent by repeated coin flips, decrementing
+ -- from 0 as long as we flip heads (1 bits). This process yields the
+ -- proper geometric distribution for the exponent: in a uniformly
+ -- distributed set of floating-point numbers, 1/2 of them will be in
+ -- (0.5, 1], 1/4 will be in (0.25, 0.5], and so forth. It makes a
+ -- further adjustment at binade boundaries (see comments below) to give
+ -- the effect of selecting a uniformly distributed real deviate in
+ -- [0..1] and then rounding to the nearest representable floating-point
+ -- number. The algorithm attempts to be stingy with random integers. In
+ -- the worst case, it can consume roughly -Real'Machine_Emin/32 32-bit
+ -- integers, but this case occurs with probability around
+ -- 2**Machine_Emin, and the expected number of calls to integer-valued
+ -- Random is 1. For another discussion of the issues addressed by this
+ -- process, see Allen Downey's unpublished paper at
+ -- http://allendowney.com/research/rand/downey07randfloat.pdf.
+
+ if Real'Machine_Radix /= 2 then
+ return Real'Machine
+ (Real (Unsigned'(Random (Gen))) * 2.0**(-Unsigned'Size));
+
else
- return Float'Adjacent (1.0, 0.0);
+ declare
+ type Bit_Count is range 0 .. 4;
+
+ subtype T is Real'Base;
+
+ Trailing_Ones : constant array (Unsigned_32 range 0 .. 15)
+ of Bit_Count :=
+ (2#00000# => 0, 2#00001# => 1, 2#00010# => 0, 2#00011# => 2,
+ 2#00100# => 0, 2#00101# => 1, 2#00110# => 0, 2#00111# => 3,
+ 2#01000# => 0, 2#01001# => 1, 2#01010# => 0, 2#01011# => 2,
+ 2#01100# => 0, 2#01101# => 1, 2#01110# => 0, 2#01111# => 4);
+
+ Pow_Tab : constant array (Bit_Count range 0 .. 3) of Real
+ := (0 => 2.0**(0 - T'Machine_Mantissa),
+ 1 => 2.0**(-1 - T'Machine_Mantissa),
+ 2 => 2.0**(-2 - T'Machine_Mantissa),
+ 3 => 2.0**(-3 - T'Machine_Mantissa));
+
+ Extra_Bits : constant Natural :=
+ (Unsigned'Size - T'Machine_Mantissa + 1);
+ -- Random bits left over after selecting mantissa
+
+ Mantissa : Unsigned;
+
+ X : Real; -- Scaled mantissa
+ R : Unsigned_32; -- Supply of random bits
+ R_Bits : Natural; -- Number of bits left in R
+ K : Bit_Count; -- Next decrement to exponent
+
+ begin
+ Mantissa := Random (Gen) / 2**Extra_Bits;
+ R := Unsigned_32 (Mantissa mod 2**Extra_Bits);
+ R_Bits := Extra_Bits;
+ X := Real (2**(T'Machine_Mantissa - 1) + Mantissa); -- Exact
+
+ if Extra_Bits < 4 and then R < 2 ** Extra_Bits - 1 then
+
+ -- We got lucky and got a zero in our few extra bits
+
+ K := Trailing_Ones (R);
+
+ else
+ Find_Zero : loop
+
+ -- R has R_Bits unprocessed random bits, a multiple of 4.
+ -- X needs to be halved for each trailing one bit. The
+ -- process stops as soon as a 0 bit is found. If R_Bits
+ -- becomes zero, reload R.
+
+ -- Process 4 bits at a time for speed: the two iterations
+ -- on average with three tests each was still too slow,
+ -- probably because the branches are not predictable.
+ -- This loop now will only execute once 94% of the cases,
+ -- doing more bits at a time will not help.
+
+ while R_Bits >= 4 loop
+ K := Trailing_Ones (R mod 16);
+
+ exit Find_Zero when K < 4; -- Exits 94% of the time
+
+ R_Bits := R_Bits - 4;
+ X := X / 16.0;
+ R := R / 16;
+ end loop;
+
+ -- Do not allow us to loop endlessly even in the (very
+ -- unlikely) case that Random (Gen) keeps yielding all ones.
+
+ exit Find_Zero when X = 0.0;
+ R := Random (Gen);
+ R_Bits := 32;
+ end loop Find_Zero;
+ end if;
+
+ -- K has the count of trailing ones not reflected yet in X. The
+ -- following multiplication takes care of that, as well as the
+ -- correction to move the radix point to the left of the mantissa.
+ -- Doing it at the end avoids repeated rounding errors in the
+ -- exceedingly unlikely case of ever having a subnormal result.
+
+ X := X * Pow_Tab (K);
+
+ -- The smallest value in each binade is rounded to by 0.75 of
+ -- the span of real numbers as its next larger neighbor, and
+ -- 1.0 is rounded to by half of the span of real numbers as its
+ -- next smaller neighbor. To account for this, when we encounter
+ -- the smallest number in a binade, we substitute the smallest
+ -- value in the next larger binade with probability 1/2.
+
+ if Mantissa = 0 and then Unsigned_32'(Random (Gen)) mod 2 = 0 then
+ X := 2.0 * X;
+ end if;
+
+ return X;
+ end;
end if;
+ end Random_Float_Template;
+
+ ------------
+ -- Random --
+ ------------
+
+ function Random (Gen : Generator) return Float is
+ function F is new Random_Float_Template (Unsigned_32, Float);
+ begin
+ return F (Gen);
end Random;
function Random (Gen : Generator) return Long_Float is
- Result : constant Long_Float :=
- Long_Float'Machine ((Long_Float (Unsigned_32'(Random (Gen)))
- * 2.0 ** (-32))
- + (Long_Float (Unsigned_32'(Random (Gen))) * 2.0 ** (-64)));
+ function F is new Random_Float_Template (Unsigned_64, Long_Float);
begin
- if Result < 1.0 then
- return Result;
- else
- return Long_Float'Adjacent (1.0, 0.0);
- end if;
+ return F (Gen);
end Random;
function Random (Gen : Generator) return Unsigned_64 is
@@ -244,10 +407,10 @@ package body System.Random_Numbers is
declare
-- In the 64-bit case, we have to be careful, since not all 64-bit
-- unsigned values are representable in GNAT's root_integer type.
- -- Ignore different-size warnings here; since GNAT's handling
+ -- Ignore different-size warnings here since GNAT's handling
-- is correct.
- pragma Warnings ("Z");
+ pragma Warnings ("Z"); -- better to use msg string! ???
function Conv_To_Unsigned is
new Unchecked_Conversion (Result_Subtype'Base, Unsigned_64);
function Conv_To_Result is
@@ -320,25 +483,30 @@ package body System.Random_Numbers is
-- Reset --
-----------
- procedure Reset (Gen : out Generator) is
- X : constant Unsigned_32 := Unsigned_32 ((Calendar.Clock - Y2K) * 64.0);
+ procedure Reset (Gen : Generator) is
+ Clock : constant Time := Calendar.Clock;
+ Duration_Since_Y2K : constant Duration := Clock - Y2K;
+
+ X : constant Unsigned_32 :=
+ Unsigned_32'Mod (Unsigned_64 (Duration_Since_Y2K) * 64);
+
begin
Init (Gen, X);
end Reset;
- procedure Reset (Gen : out Generator; Initiator : Integer_32) is
+ procedure Reset (Gen : Generator; Initiator : Integer_32) is
begin
Init (Gen, To_Unsigned (Initiator));
end Reset;
- procedure Reset (Gen : out Generator; Initiator : Unsigned_32) is
+ procedure Reset (Gen : Generator; Initiator : Unsigned_32) is
begin
Init (Gen, Initiator);
end Reset;
- procedure Reset (Gen : out Generator; Initiator : Integer) is
+ procedure Reset (Gen : Generator; Initiator : Integer) is
begin
- pragma Warnings ("C");
+ 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.
@@ -358,30 +526,30 @@ package body System.Random_Numbers is
end;
end if;
- pragma Warnings ("c");
+ pragma Warnings (On, "condition is always *");
end Reset;
- procedure Reset (Gen : out Generator; Initiator : Initialization_Vector) is
+ procedure Reset (Gen : Generator; Initiator : Initialization_Vector) is
+ G : Generator renames Gen.Writable.Self.all;
I, J : Integer;
begin
- Init (Gen, 19650218);
+ Init (G, Seed1);
I := 1;
J := 0;
if Initiator'Length > 0 then
for K in reverse 1 .. Integer'Max (N, Initiator'Length) loop
- Gen.S (I) :=
- (Gen.S (I)
- xor ((Gen.S (I - 1) xor Shift_Right (Gen.S (I - 1), 30))
- * 1664525))
+ G.S (I) :=
+ (G.S (I) xor ((G.S (I - 1)
+ xor Shift_Right (G.S (I - 1), 30)) * Mult1))
+ Initiator (J + Initiator'First) + Unsigned_32 (J);
I := I + 1;
J := J + 1;
if I >= N then
- Gen.S (0) := Gen.S (N - 1);
+ G.S (0) := G.S (N - 1);
I := 1;
end if;
@@ -392,39 +560,42 @@ package body System.Random_Numbers is
end if;
for K in reverse 1 .. N - 1 loop
- Gen.S (I) :=
- (Gen.S (I) xor ((Gen.S (I - 1)
- xor Shift_Right (Gen.S (I - 1), 30)) * 1566083941))
+ G.S (I) :=
+ (G.S (I) xor ((G.S (I - 1)
+ xor Shift_Right (G.S (I - 1), 30)) * Mult2))
- Unsigned_32 (I);
I := I + 1;
if I >= N then
- Gen.S (0) := Gen.S (N - 1);
+ G.S (0) := G.S (N - 1);
I := 1;
end if;
end loop;
- Gen.S (0) := Bit31_Mask;
+ G.S (0) := Upper_Mask;
end Reset;
- procedure Reset (Gen : out Generator; From_State : Generator) is
+ procedure Reset (Gen : Generator; From_State : Generator) is
+ G : Generator renames Gen.Writable.Self.all;
begin
- Gen.S := From_State.S;
- Gen.I := From_State.I;
+ G.S := From_State.S;
+ G.I := From_State.I;
end Reset;
- procedure Reset (Gen : out Generator; From_State : State) is
+ procedure Reset (Gen : Generator; From_State : State) is
+ G : Generator renames Gen.Writable.Self.all;
begin
- Gen.I := 0;
- Gen.S := From_State;
+ G.I := 0;
+ G.S := From_State;
end Reset;
- procedure Reset (Gen : out Generator; From_Image : String) is
+ procedure Reset (Gen : Generator; From_Image : String) is
+ G : Generator renames Gen.Writable.Self.all;
begin
- Gen.I := 0;
+ G.I := 0;
for J in 0 .. N - 1 loop
- Gen.S (J) := Extract_Value (From_Image, J);
+ G.S (J) := Extract_Value (From_Image, J);
end loop;
end Reset;
@@ -468,7 +639,6 @@ package body System.Random_Numbers is
begin
Result := (others => ' ');
-
for J in 0 .. N - 1 loop
Insert_Image (Result, J, Gen.S ((J + Gen.I) mod N));
end loop;
@@ -493,18 +663,18 @@ package body System.Random_Numbers is
-- Init --
----------
- procedure Init (Gen : out Generator; Initiator : Unsigned_32) is
+ procedure Init (Gen : Generator; Initiator : Unsigned_32) is
+ G : Generator renames Gen.Writable.Self.all;
begin
- Gen.S (0) := Initiator;
+ G.S (0) := Initiator;
for I in 1 .. N - 1 loop
- Gen.S (I) :=
- 1812433253
- * (Gen.S (I - 1) xor Shift_Right (Gen.S (I - 1), 30))
+ G.S (I) :=
+ (G.S (I - 1) xor Shift_Right (G.S (I - 1), 30)) * Mult0
+ Unsigned_32 (I);
end loop;
- Gen.I := 0;
+ G.I := 0;
end Init;
------------------
@@ -526,9 +696,8 @@ package body System.Random_Numbers is
-------------------
function Extract_Value (S : String; Index : Integer) return State_Val is
+ Start : constant Integer := S'First + Index * Image_Numeral_Length;
begin
- return State_Val'Value (S (S'First + Index * 11 ..
- S'First + Index * 11 + 11));
+ return State_Val'Value (S (Start .. Start + Image_Numeral_Length - 1));
end Extract_Value;
-
end System.Random_Numbers;
diff --git a/gcc/ada/s-rannum.ads b/gcc/ada/s-rannum.ads
index 28dcdc69215..0d2a7e9dee7 100644
--- a/gcc/ada/s-rannum.ads
+++ b/gcc/ada/s-rannum.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2007,2009 Free Software Foundation, Inc. --
+-- Copyright (C) 2007-2010, 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- --
@@ -88,27 +88,27 @@ package System.Random_Numbers is
-- in Reset). In general, there is little point in providing more than
-- a certain number of values (currently 624).
- procedure Reset (Gen : out Generator);
+ procedure Reset (Gen : Generator);
-- Re-initialize the state of Gen from the time of day
- procedure Reset (Gen : out Generator; Initiator : Initialization_Vector);
- procedure Reset (Gen : out Generator; Initiator : Interfaces.Integer_32);
- procedure Reset (Gen : out Generator; Initiator : Interfaces.Unsigned_32);
- procedure Reset (Gen : out Generator; Initiator : Integer);
+ procedure Reset (Gen : Generator; Initiator : Initialization_Vector);
+ procedure Reset (Gen : Generator; Initiator : Interfaces.Integer_32);
+ procedure Reset (Gen : Generator; Initiator : Interfaces.Unsigned_32);
+ procedure Reset (Gen : Generator; Initiator : Integer);
-- Re-initialize Gen based on the Initiator in various ways. Identical
-- values of Initiator cause identical sequences of values.
- procedure Reset (Gen : out Generator; From_State : Generator);
+ procedure Reset (Gen : Generator; From_State : Generator);
-- Causes the state of Gen to be identical to that of From_State; Gen
-- and From_State will produce identical sequences of values subsequently.
- procedure Reset (Gen : out Generator; From_State : State);
+ procedure Reset (Gen : Generator; From_State : State);
procedure Save (Gen : Generator; To_State : out State);
-- The sequence
-- Save (Gen2, S); Reset (Gen1, S)
-- has the same effect as Reset (Gen2, Gen1).
- procedure Reset (Gen : out Generator; From_Image : String);
+ procedure Reset (Gen : Generator; From_Image : String);
function Image (Gen : Generator) return String;
-- The call
-- Reset (Gen2, Image (Gen1))
@@ -135,12 +135,19 @@ private
subtype State_Val is Interfaces.Unsigned_32;
type State is array (0 .. N - 1) of State_Val;
+ type Writable_Access (Self : access Generator) is limited null record;
+ -- Auxiliary type to make Generator a self-referential type
+
type Generator is limited record
+ Writable : Writable_Access (Generator'Access);
+ -- This self reference allows functions to modify Generator arguments
+
S : State := (others => 0);
-- The shift register, a circular buffer
I : Integer := N;
- -- Current starting position in shift register S
+ -- Current starting position in shift register S (N means uninitialized)
+ -- We should avoid using the identifier I here ???
end record;
end System.Random_Numbers;
diff --git a/gcc/ada/s-regpat.adb b/gcc/ada/s-regpat.adb
index dec4c1fcef0..1c0cf746a53 100755
--- a/gcc/ada/s-regpat.adb
+++ b/gcc/ada/s-regpat.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1986 by University of Toronto. --
--- Copyright (C) 1999-2009, AdaCore --
+-- Copyright (C) 1999-2010, AdaCore --
-- --
-- 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- --
@@ -47,12 +47,10 @@ with Ada.Unchecked_Conversion;
package body System.Regpat is
- MAGIC : constant Character := Character'Val (10#0234#);
- -- The first byte of the regexp internal "program" is actually
- -- this magic number; the start node begins in the second byte.
- --
- -- This is used to make sure that a regular expression was correctly
- -- compiled.
+ Debug : constant Boolean := False;
+ -- Set to True to activate debug traces. This is normally set to constant
+ -- False to simply delete all the trace code. It is to be edited to True
+ -- for internal debugging of the package.
----------------------------
-- Implementation details --
@@ -76,21 +74,19 @@ package body System.Regpat is
-- You can see the exact byte-compiled version by using the Dump
-- subprogram. However, here are a few examples:
- -- (a|b): 1 : MAGIC
- -- 2 : BRANCH (next at 10)
- -- 5 : EXACT (next at 18) operand=a
- -- 10 : BRANCH (next at 18)
- -- 13 : EXACT (next at 18) operand=b
- -- 18 : EOP (next at 0)
+ -- (a|b): 1 : BRANCH (next at 9)
+ -- 4 : EXACT (next at 17) operand=a
+ -- 9 : BRANCH (next at 17)
+ -- 12 : EXACT (next at 17) operand=b
+ -- 17 : EOP (next at 0)
--
- -- (ab)*: 1 : MAGIC
- -- 2 : CURLYX (next at 26) { 0, 32767}
- -- 9 : OPEN 1 (next at 13)
- -- 13 : EXACT (next at 19) operand=ab
- -- 19 : CLOSE 1 (next at 23)
- -- 23 : WHILEM (next at 0)
- -- 26 : NOTHING (next at 29)
- -- 29 : EOP (next at 0)
+ -- (ab)*: 1 : CURLYX (next at 25) { 0, 32767}
+ -- 8 : OPEN 1 (next at 12)
+ -- 12 : EXACT (next at 18) operand=ab
+ -- 18 : CLOSE 1 (next at 22)
+ -- 22 : WHILEM (next at 0)
+ -- 25 : NOTHING (next at 28)
+ -- 28 : EOP (next at 0)
-- The opcodes are:
@@ -186,6 +182,12 @@ package body System.Regpat is
-- Using two bytes for the "next" pointer is vast overkill for most
-- things, but allows patterns to get big without disasters.
+ Next_Pointer_Bytes : constant := 3;
+ -- Points after the "next pointer" data. An instruction is therefore:
+ -- 1 byte: instruction opcode
+ -- 2 bytes: pointer to next instruction
+ -- * bytes: optional data for the instruction
+
-----------------------
-- Character classes --
-----------------------
@@ -279,11 +281,6 @@ package body System.Regpat is
Op : out Character_Class);
-- Return a pointer to the string argument of the node at P
- function Get_Next_Offset
- (Program : Program_Data;
- IP : Pointer) return Pointer;
- -- Get the offset field of a node. Used by Get_Next
-
function Get_Next
(Program : Program_Data;
IP : Pointer) return Pointer;
@@ -303,7 +300,6 @@ package body System.Regpat is
pragma Inline (Is_Alnum);
pragma Inline (Is_White_Space);
pragma Inline (Get_Next);
- pragma Inline (Get_Next_Offset);
pragma Inline (Operand);
pragma Inline (Read_Natural);
pragma Inline (String_Length);
@@ -318,6 +314,23 @@ package body System.Regpat is
Worst_Expression : constant Expression_Flags := (others => False);
-- Worst case
+ procedure Dump_Until
+ (Program : Program_Data;
+ Index : in out Pointer;
+ Till : Pointer;
+ Indent : Natural;
+ Do_Print : Boolean := True);
+ -- Dump the program until the node Till (not included) is met. Every line
+ -- is indented with Index spaces at the beginning Dumps till the end if
+ -- Till is 0.
+
+ procedure Dump_Operation
+ (Program : Program_Data;
+ Index : Pointer;
+ Indent : Natural);
+ -- Same as above, but only dumps a single operation, and compute its
+ -- indentation from the program.
+
---------
-- "=" --
---------
@@ -340,7 +353,7 @@ package body System.Regpat is
(Program_Data, Character_Class);
begin
- Op (0 .. 31) := Convert (Program (P + 3 .. P + 34));
+ Op (0 .. 31) := Convert (Program (P + Next_Pointer_Bytes .. P + 34));
end Bitmap_Operand;
-------------
@@ -369,7 +382,6 @@ package body System.Regpat is
PM : Pattern_Matcher renames Matcher;
Program : Program_Data renames PM.Program;
- Emit_Code : constant Boolean := PM.Size > 0;
Emit_Ptr : Pointer := Program_First;
Parse_Pos : Natural := Expression'First; -- Input-scan pointer
@@ -421,21 +433,31 @@ package body System.Regpat is
(Expr_Flags : out Expression_Flags;
IP : out Pointer);
-- Parse_Atom is the lowest level parse procedure.
- -- Optimization: gobbles an entire sequence of ordinary characters
- -- so that it can turn them into a single node, which is smaller to
- -- store and faster to run. Backslashed characters are exceptions,
- -- each becoming a separate node; the code is simpler that way and
- -- it's not worth fixing.
+ --
+ -- Optimization: Gobbles an entire sequence of ordinary characters so
+ -- that it can turn them into a single node, which is smaller to store
+ -- and faster to run. Backslashed characters are exceptions, each
+ -- becoming a separate node; the code is simpler that way and it's
+ -- not worth fixing.
procedure Insert_Operator
(Op : Opcode;
Operand : Pointer;
Greedy : Boolean := True);
- -- Insert_Operator inserts an operator in front of an
- -- already-emitted operand and relocates the operand.
- -- This applies to PLUS and STAR.
+ -- Insert_Operator inserts an operator in front of an already-emitted
+ -- operand and relocates the operand. This applies to PLUS and STAR.
-- If Minmod is True, then the operator is non-greedy.
+ function Insert_Operator_Before
+ (Op : Opcode;
+ Operand : Pointer;
+ Greedy : Boolean;
+ Opsize : Pointer) return Pointer;
+ -- Insert an operator before Operand (and move the latter forward in the
+ -- program). Opsize is the size needed to represent the operator. This
+ -- returns the position at which the operator was inserted, and moves
+ -- Emit_Ptr after the new position of the operand.
+
procedure Insert_Curly_Operator
(Op : Opcode;
Min : Natural;
@@ -451,9 +473,6 @@ package body System.Regpat is
procedure Link_Operand_Tail (P, Val : Pointer);
-- Link_Tail on operand of first argument; noop if operand-less
- function Next_Instruction (P : Pointer) return Pointer;
- -- Dig the "next" pointer out of a node
-
procedure Fail (M : String);
pragma No_Return (Fail);
-- Fail with a diagnostic message, if possible
@@ -513,7 +532,7 @@ package body System.Regpat is
procedure Emit (B : Character) is
begin
- if Emit_Code then
+ if Emit_Ptr <= PM.Size then
Program (Emit_Ptr) := B;
end if;
@@ -531,7 +550,12 @@ package body System.Regpat is
(Character_Class, Program31);
begin
- if Emit_Code then
+ -- What is the mysterious constant 31 here??? Can't it be expressed
+ -- symbolically (size of integer - 1 or some such???). In any case
+ -- it should be declared as a constant (and referenced presumably
+ -- as this constant + 1 below.
+
+ if Emit_Ptr + 31 <= PM.Size then
Program (Emit_Ptr .. Emit_Ptr + 31) := Convert (Bitmap);
end if;
@@ -544,7 +568,7 @@ package body System.Regpat is
procedure Emit_Natural (IP : Pointer; N : Natural) is
begin
- if Emit_Code then
+ if IP + 1 <= PM.Size then
Program (IP + 1) := Character'Val (N / 256);
Program (IP) := Character'Val (N mod 256);
end if;
@@ -558,13 +582,13 @@ package body System.Regpat is
Result : constant Pointer := Emit_Ptr;
begin
- if Emit_Code then
+ if Emit_Ptr + 2 <= PM.Size then
Program (Emit_Ptr) := Character'Val (Opcode'Pos (Op));
Program (Emit_Ptr + 1) := ASCII.NUL;
Program (Emit_Ptr + 2) := ASCII.NUL;
end if;
- Emit_Ptr := Emit_Ptr + 3;
+ Emit_Ptr := Emit_Ptr + Next_Pointer_Bytes;
return Result;
end Emit_Node;
@@ -639,21 +663,38 @@ package body System.Regpat is
Operand : Pointer;
Greedy : Boolean := True)
is
- Dest : constant Pointer := Emit_Ptr;
Old : Pointer;
- Size : Pointer := 7;
+ begin
+ Old := Insert_Operator_Before (Op, Operand, Greedy, Opsize => 7);
+ Emit_Natural (Old + Next_Pointer_Bytes, Min);
+ Emit_Natural (Old + Next_Pointer_Bytes + 2, Max);
+ end Insert_Curly_Operator;
+
+ ----------------------------
+ -- Insert_Operator_Before --
+ ----------------------------
+
+ function Insert_Operator_Before
+ (Op : Opcode;
+ Operand : Pointer;
+ Greedy : Boolean;
+ Opsize : Pointer) return Pointer
+ is
+ Dest : constant Pointer := Emit_Ptr;
+ Old : Pointer;
+ Size : Pointer := Opsize;
begin
- -- If the operand is not greedy, insert an extra operand before it
+ -- If not greedy, we have to emit another opcode first
if not Greedy then
- Size := Size + 3;
+ Size := Size + Next_Pointer_Bytes;
end if;
-- Move the operand in the byte-compilation, so that we can insert
-- the operator before it.
- if Emit_Code then
+ if Emit_Ptr + Size <= PM.Size then
Program (Operand + Size .. Emit_Ptr + Size) :=
Program (Operand .. Emit_Ptr);
end if;
@@ -665,15 +706,13 @@ package body System.Regpat is
if not Greedy then
Old := Emit_Node (MINMOD);
- Link_Tail (Old, Old + 3);
+ Link_Tail (Old, Old + Next_Pointer_Bytes);
end if;
Old := Emit_Node (Op);
- Emit_Natural (Old + 3, Min);
- Emit_Natural (Old + 5, Max);
-
Emit_Ptr := Dest + Size;
- end Insert_Curly_Operator;
+ return Old;
+ end Insert_Operator_Before;
---------------------
-- Insert_Operator --
@@ -684,40 +723,11 @@ package body System.Regpat is
Operand : Pointer;
Greedy : Boolean := True)
is
- Dest : constant Pointer := Emit_Ptr;
- Old : Pointer;
- Size : Pointer := 3;
-
Discard : Pointer;
pragma Warnings (Off, Discard);
-
begin
- -- If not greedy, we have to emit another opcode first
-
- if not Greedy then
- Size := Size + 3;
- end if;
-
- -- Move the operand in the byte-compilation, so that we can insert
- -- the operator before it.
-
- if Emit_Code then
- Program (Operand + Size .. Emit_Ptr + Size) :=
- Program (Operand .. Emit_Ptr);
- end if;
-
- -- Insert the operator at the position previously occupied by the
- -- operand.
-
- Emit_Ptr := Operand;
-
- if not Greedy then
- Old := Emit_Node (MINMOD);
- Link_Tail (Old, Old + 3);
- end if;
-
- Discard := Emit_Node (Op);
- Emit_Ptr := Dest + Size;
+ Discard := Insert_Operator_Before
+ (Op, Operand, Greedy, Opsize => Next_Pointer_Bytes);
end Insert_Operator;
-----------------------
@@ -784,7 +794,7 @@ package body System.Regpat is
procedure Link_Operand_Tail (P, Val : Pointer) is
begin
- if Emit_Code and then Program (P) = BRANCH then
+ if P <= PM.Size and then Program (P) = BRANCH then
Link_Tail (Operand (P), Val);
end if;
end Link_Operand_Tail;
@@ -799,16 +809,13 @@ package body System.Regpat is
Offset : Pointer;
begin
- if not Emit_Code then
- return;
- end if;
-
- -- Find last node
+ -- Find last node (the size of the pattern matcher might be too
+ -- small, so don't try to read past its end).
Scan := P;
- loop
- Temp := Next_Instruction (Scan);
- exit when Temp = 0;
+ while Scan + Next_Pointer_Bytes <= PM.Size loop
+ Temp := Get_Next (Program, Scan);
+ exit when Temp = Scan;
Scan := Temp;
end loop;
@@ -817,47 +824,25 @@ package body System.Regpat is
Emit_Natural (Scan + 1, Natural (Offset));
end Link_Tail;
- ----------------------
- -- Next_Instruction --
- ----------------------
-
- function Next_Instruction (P : Pointer) return Pointer is
- Offset : Pointer;
-
- begin
- if not Emit_Code then
- return 0;
- end if;
-
- Offset := Get_Next_Offset (Program, P);
-
- if Offset = 0 then
- return 0;
- end if;
-
- return P + Offset;
- end Next_Instruction;
-
-----------
-- Parse --
-----------
- -- Combining parenthesis handling with the base level
- -- of regular expression is a trifle forced, but the
- -- need to tie the tails of the branches to what follows
- -- makes it hard to avoid.
+ -- Combining parenthesis handling with the base level of regular
+ -- expression is a trifle forced, but the need to tie the tails of the
+ -- the branches to what follows makes it hard to avoid.
procedure Parse
- (Parenthesized : Boolean;
- Flags : out Expression_Flags;
- IP : out Pointer)
+ (Parenthesized : Boolean;
+ Flags : out Expression_Flags;
+ IP : out Pointer)
is
- E : String renames Expression;
- Br : Pointer;
- Ender : Pointer;
- Par_No : Natural;
- New_Flags : Expression_Flags;
- Have_Branch : Boolean := False;
+ E : String renames Expression;
+ Br, Br2 : Pointer;
+ Ender : Pointer;
+ Par_No : Natural;
+ New_Flags : Expression_Flags;
+ Have_Branch : Boolean := False;
begin
Flags := (Has_Width => True, others => False); -- Tentatively
@@ -938,15 +923,16 @@ package body System.Regpat is
Link_Tail (IP, Ender);
- if Have_Branch then
+ if Have_Branch and then Emit_Ptr <= PM.Size then
-- Hook the tails of the branches to the closing node
Br := IP;
loop
- exit when Br = 0;
Link_Operand_Tail (Br, Ender);
- Br := Next_Instruction (Br);
+ Br2 := Get_Next (Program, Br);
+ exit when Br2 = Br;
+ Br := Br2;
end loop;
end if;
@@ -1639,13 +1625,13 @@ package body System.Regpat is
-- is an initial string to emit, do it now.
if Has_Special_Operator
- and then Emit_Ptr >= Length_Ptr + 3
+ and then Emit_Ptr >= Length_Ptr + Next_Pointer_Bytes
then
Emit_Ptr := Emit_Ptr - 1;
Parse_Pos := Start_Pos;
end if;
- if Emit_Code then
+ if Length_Ptr <= PM.Size then
Program (Length_Ptr) := Character'Val (Emit_Ptr - Length_Ptr - 2);
end if;
@@ -1987,7 +1973,6 @@ package body System.Regpat is
-- Start of processing for Compile
begin
- Emit (MAGIC);
Parse (False, Expr_Flags, Result);
if Result = 0 then
@@ -1999,7 +1984,7 @@ package body System.Regpat is
-- Do we want to actually compile the expression, or simply get the
-- code size ???
- if Emit_Code then
+ if Emit_Ptr <= PM.Size then
Optimize (PM);
end if;
@@ -2010,19 +1995,38 @@ package body System.Regpat is
(Expression : String;
Flags : Regexp_Flags := No_Flags) return Pattern_Matcher
is
+ -- Assume the compiled regexp will fit in 1000 chars. If it does not we
+ -- will have to compile a second time once the correct size is known. If
+ -- it fits, we save a significant amount of time by avoiding the second
+ -- compilation.
+
+ Dummy : Pattern_Matcher (1000);
Size : Program_Size;
- Dummy : Pattern_Matcher (0);
- pragma Unreferenced (Dummy);
begin
Compile (Dummy, Expression, Size, Flags);
- declare
- Result : Pattern_Matcher (Size);
- begin
- Compile (Result, Expression, Size, Flags);
- return Result;
- end;
+ if Size <= Dummy.Size then
+ return Pattern_Matcher'
+ (Size => Size,
+ First => Dummy.First,
+ Anchored => Dummy.Anchored,
+ Must_Have => Dummy.Must_Have,
+ Must_Have_Length => Dummy.Must_Have_Length,
+ Paren_Count => Dummy.Paren_Count,
+ Flags => Dummy.Flags,
+ Program => Dummy.Program
+ (Dummy.Program'First .. Dummy.Program'First + Size - 1));
+ else
+ -- We have to recompile now that we know the size
+ -- ??? Can we use Ada05's return construct ?
+ declare
+ Result : Pattern_Matcher (Size);
+ begin
+ Compile (Result, Expression, Size, Flags);
+ return Result;
+ end;
+ end if;
end Compile;
procedure Compile
@@ -2031,93 +2035,107 @@ package body System.Regpat is
Flags : Regexp_Flags := No_Flags)
is
Size : Program_Size;
- pragma Unreferenced (Size);
+
begin
Compile (Matcher, Expression, Size, Flags);
+
+ if Size > Matcher.Size then
+ raise Expression_Error with "Pattern_Matcher is too small";
+ end if;
end Compile;
- ----------
- -- Dump --
- ----------
+ --------------------
+ -- Dump_Operation --
+ --------------------
- procedure Dump (Self : Pattern_Matcher) is
- Op : Opcode;
- Program : Program_Data renames Self.Program;
+ procedure Dump_Operation
+ (Program : Program_Data;
+ Index : Pointer;
+ Indent : Natural)
+ is
+ Current : Pointer := Index;
+ begin
+ Dump_Until (Program, Current, Current + 1, Indent);
+ end Dump_Operation;
+
+ ----------------
+ -- Dump_Until --
+ ----------------
+
+ procedure Dump_Until
+ (Program : Program_Data;
+ Index : in out Pointer;
+ Till : Pointer;
+ Indent : Natural;
+ Do_Print : Boolean := True)
+ is
+ function Image (S : String) return String;
+ -- Remove leading space
- procedure Dump_Until
- (Start : Pointer;
- Till : Pointer;
- Indent : Natural := 0);
- -- Dump the program until the node Till (not included) is met.
- -- Every line is indented with Index spaces at the beginning
- -- Dumps till the end if Till is 0.
+ -----------
+ -- Image --
+ -----------
- ----------------
- -- Dump_Until --
- ----------------
+ function Image (S : String) return String is
+ begin
+ if S (S'First) = ' ' then
+ return S (S'First + 1 .. S'Last);
+ else
+ return S;
+ end if;
+ end Image;
- procedure Dump_Until
- (Start : Pointer;
- Till : Pointer;
- Indent : Natural := 0)
- is
- Next : Pointer;
- Index : Pointer;
- Local_Indent : Natural := Indent;
- Length : Pointer;
+ -- Local variables
- begin
- Index := Start;
- while Index < Till loop
- Op := Opcode'Val (Character'Pos ((Self.Program (Index))));
+ Op : Opcode;
+ Next : Pointer;
+ Length : Pointer;
+ Local_Indent : Natural := Indent;
- if Op = CLOSE then
- Local_Indent := Local_Indent - 3;
- end if;
+ -- Start of processing for Dump_Until
- declare
- Point : constant String := Pointer'Image (Index);
+ begin
+ while Index < Till loop
+ Op := Opcode'Val (Character'Pos ((Program (Index))));
+ Next := Get_Next (Program, Index);
+ if Do_Print then
+ declare
+ Point : constant String := Pointer'Image (Index);
begin
- for J in 1 .. 6 - Point'Length loop
- Put (' ');
- end loop;
-
- Put (Point
- & " : "
- & (1 .. Local_Indent => ' ')
- & Opcode'Image (Op));
+ Put ((1 .. 4 - Point'Length => ' ')
+ & Point & ":"
+ & (1 .. Local_Indent * 2 => ' ') & Opcode'Image (Op));
end;
-- Print the parenthesis number
if Op = OPEN or else Op = CLOSE or else Op = REFF then
- Put (Natural'Image (Character'Pos (Program (Index + 3))));
+ Put (Image (Natural'Image
+ (Character'Pos
+ (Program (Index + Next_Pointer_Bytes)))));
end if;
- Next := Index + Get_Next_Offset (Program, Index);
-
if Next = Index then
- Put (" (next at 0)");
+ Put (" (-)");
else
- Put (" (next at " & Pointer'Image (Next) & ")");
+ Put (" (" & Image (Pointer'Image (Next)) & ")");
end if;
+ end if;
- case Op is
-
- -- Character class operand
-
- when ANYOF => null;
- declare
- Bitmap : Character_Class;
- Last : Character := ASCII.NUL;
- Current : Natural := 0;
+ case Op is
+ when ANYOF =>
+ declare
+ Bitmap : Character_Class;
+ Last : Character := ASCII.NUL;
+ Current : Natural := 0;
+ Current_Char : Character;
- Current_Char : Character;
+ begin
+ Bitmap_Operand (Program, Index, Bitmap);
- begin
- Bitmap_Operand (Program, Index, Bitmap);
- Put (" operand=");
+ if Do_Print then
+ Put ("[");
while Current <= 255 loop
Current_Char := Character'Val (Current);
@@ -2135,17 +2153,16 @@ package body System.Regpat is
Current_Char := Character'Val (Current);
exit when
not Get_From_Class (Bitmap, Current_Char);
-
end loop;
- if Last <= ' ' then
+ if not Is_Graphic (Last) then
Put (Last'Img);
else
Put (Last);
end if;
if Character'Succ (Last) /= Current_Char then
- Put ("-" & Character'Pred (Current_Char));
+ Put ("\-" & Character'Pred (Current_Char));
end if;
else
@@ -2153,76 +2170,93 @@ package body System.Regpat is
end if;
end loop;
- New_Line;
- Index := Index + 3 + Bitmap'Length;
- end;
+ Put_Line ("]");
+ end if;
- -- string operand
+ Index := Index + Next_Pointer_Bytes + Bitmap'Length;
+ end;
- when EXACT | EXACTF =>
- Length := String_Length (Program, Index);
- Put (" operand (length:" & Program_Size'Image (Length + 1)
- & ") ="
- & String (Program (String_Operand (Index)
- .. String_Operand (Index)
- + Length)));
- Index := String_Operand (Index) + Length + 1;
- New_Line;
+ when EXACT | EXACTF =>
+ Length := String_Length (Program, Index);
+ if Do_Print then
+ Put (" (" & Image (Program_Size'Image (Length + 1))
+ & " chars) <"
+ & String (Program (String_Operand (Index)
+ .. String_Operand (Index)
+ + Length)));
+ Put_Line (">");
+ end if;
- -- Node operand
+ Index := String_Operand (Index) + Length + 1;
- when BRANCH =>
- New_Line;
- Dump_Until (Index + 3, Next, Local_Indent + 3);
- Index := Next;
+ -- Node operand
- when STAR | PLUS =>
+ when BRANCH | STAR | PLUS =>
+ if Do_Print then
New_Line;
+ end if;
- -- Only one instruction
+ Index := Index + Next_Pointer_Bytes;
+ Dump_Until (Program, Index, Pointer'Min (Next, Till),
+ Local_Indent + 1, Do_Print);
+
+ when CURLY | CURLYX =>
+ if Do_Print then
+ Put_Line
+ (" {"
+ & Image (Natural'Image
+ (Read_Natural (Program, Index + Next_Pointer_Bytes)))
+ & ","
+ & Image (Natural'Image (Read_Natural (Program, Index + 5)))
+ & "}");
+ end if;
- Dump_Until (Index + 3, Index + 4, Local_Indent + 3);
- Index := Next;
+ Index := Index + 7;
+ Dump_Until (Program, Index, Pointer'Min (Next, Till),
+ Local_Indent + 1, Do_Print);
- when CURLY | CURLYX =>
- Put (" {"
- & Natural'Image (Read_Natural (Program, Index + 3))
- & ","
- & Natural'Image (Read_Natural (Program, Index + 5))
- & "}");
+ when OPEN =>
+ if Do_Print then
New_Line;
- Dump_Until (Index + 7, Next, Local_Indent + 3);
- Index := Next;
+ end if;
- when OPEN =>
- New_Line;
- Index := Index + 4;
- Local_Indent := Local_Indent + 3;
+ Index := Index + 4;
+ Local_Indent := Local_Indent + 1;
- when CLOSE | REFF =>
+ when CLOSE | REFF =>
+ if Do_Print then
New_Line;
- Index := Index + 4;
+ end if;
- when EOP =>
- Index := Index + 3;
- New_Line;
- exit;
+ Index := Index + 4;
- -- No operand
+ if Op = CLOSE then
+ Local_Indent := Local_Indent - 1;
+ end if;
- when others =>
- Index := Index + 3;
+ when others =>
+ Index := Index + Next_Pointer_Bytes;
+
+ if Do_Print then
New_Line;
- end case;
- end loop;
- end Dump_Until;
+ end if;
+
+ exit when Op = EOP;
+ end case;
+ end loop;
+ end Dump_Until;
+
+ ----------
+ -- Dump --
+ ----------
+
+ procedure Dump (Self : Pattern_Matcher) is
+ Program : Program_Data renames Self.Program;
+ Index : Pointer := Program'First;
-- Start of processing for Dump
begin
- pragma Assert (Self.Program (Program_First) = MAGIC,
- "Corrupted Pattern_Matcher");
-
Put_Line ("Must start with (Self.First) = "
& Character'Image (Self.First));
@@ -2238,8 +2272,7 @@ package body System.Regpat is
Put_Line (" Multiple_Lines mode");
end if;
- Put_Line (" 1 : MAGIC");
- Dump_Until (Program_First + 1, Self.Program'Last + 1);
+ Dump_Until (Program, Index, Self.Program'Last + 1, 0);
end Dump;
--------------------
@@ -2261,27 +2294,10 @@ package body System.Regpat is
--------------
function Get_Next (Program : Program_Data; IP : Pointer) return Pointer is
- Offset : constant Pointer := Get_Next_Offset (Program, IP);
begin
- if Offset = 0 then
- return 0;
- else
- return IP + Offset;
- end if;
+ return IP + Pointer (Read_Natural (Program, IP + 1));
end Get_Next;
- ---------------------
- -- Get_Next_Offset --
- ---------------------
-
- function Get_Next_Offset
- (Program : Program_Data;
- IP : Pointer) return Pointer
- is
- begin
- return Pointer (Read_Natural (Program, IP + 1));
- end Get_Next_Offset;
-
--------------
-- Is_Alnum --
--------------
@@ -2401,9 +2417,8 @@ package body System.Regpat is
-- using a loop instead of recursion.
-- Why is the above comment part of the spec rather than body ???
- function Match_Whilem (IP : Pointer) return Boolean;
- -- Return True if a WHILEM matches
- -- How come IP is unreferenced in the body ???
+ function Match_Whilem return Boolean;
+ -- Return True if a WHILEM matches the Current_Curly
function Recurse_Match (IP : Pointer; From : Natural) return Boolean;
pragma Inline (Recurse_Match);
@@ -2418,6 +2433,11 @@ package body System.Regpat is
Greedy : Boolean) return Boolean;
-- Return True it the simple operator (possibly non-greedy) matches
+ Dump_Indent : Integer := -1;
+ procedure Dump_Current (Scan : Pointer; Prefix : Boolean := True);
+ procedure Dump_Error (Msg : String);
+ -- Debug: print the current context
+
pragma Inline (Index);
pragma Inline (Repeat);
@@ -2446,15 +2466,15 @@ package body System.Regpat is
-------------------
function Recurse_Match (IP : Pointer; From : Natural) return Boolean is
- L : constant Natural := Last_Paren;
-
+ L : constant Natural := Last_Paren;
Tmp_F : constant Match_Array :=
Matches_Full (From + 1 .. Matches_Full'Last);
-
Start : constant Natural_Array :=
Matches_Tmp (From + 1 .. Matches_Tmp'Last);
Input : constant Natural := Input_Pos;
+ Dump_Indent_Save : constant Integer := Dump_Indent;
+
begin
if Match (IP) then
return True;
@@ -2464,9 +2484,45 @@ package body System.Regpat is
Matches_Full (Tmp_F'Range) := Tmp_F;
Matches_Tmp (Start'Range) := Start;
Input_Pos := Input;
+ Dump_Indent := Dump_Indent_Save;
return False;
end Recurse_Match;
+ ------------------
+ -- Dump_Current --
+ ------------------
+
+ procedure Dump_Current (Scan : Pointer; Prefix : Boolean := True) is
+ Length : constant := 10;
+ Pos : constant String := Integer'Image (Input_Pos);
+
+ begin
+ if Prefix then
+ Put ((1 .. 5 - Pos'Length => ' '));
+ Put (Pos & " <"
+ & Data (Input_Pos
+ .. Integer'Min (Last_In_Data, Input_Pos + Length - 1)));
+ Put ((1 .. Length - 1 - Last_In_Data + Input_Pos => ' '));
+ Put ("> |");
+
+ else
+ Put (" ");
+ end if;
+
+ Dump_Operation (Program, Scan, Indent => Dump_Indent);
+ end Dump_Current;
+
+ ----------------
+ -- Dump_Error --
+ ----------------
+
+ procedure Dump_Error (Msg : String) is
+ begin
+ Put (" | ");
+ Put ((1 .. Dump_Indent * 2 => ' '));
+ Put_Line (Msg);
+ end Dump_Error;
+
-----------
-- Match --
-----------
@@ -2475,8 +2531,11 @@ package body System.Regpat is
Scan : Pointer := IP;
Next : Pointer;
Op : Opcode;
+ Result : Boolean;
begin
+ Dump_Indent := Dump_Indent + 1;
+
State_Machine :
loop
pragma Assert (Scan /= 0);
@@ -2485,13 +2544,18 @@ package body System.Regpat is
Op := Opcode'Val (Character'Pos (Program (Scan)));
- -- Calculate offset of next instruction.
- -- Second character is most significant in Program_Data.
+ -- Calculate offset of next instruction. Second character is most
+ -- significant in Program_Data.
Next := Get_Next (Program, Scan);
+ if Debug then
+ Dump_Current (Scan);
+ end if;
+
case Op is
when EOP =>
+ Dump_Indent := Dump_Indent - 1;
return True; -- Success !
when BRANCH =>
@@ -2501,6 +2565,7 @@ package body System.Regpat is
else
loop
if Recurse_Match (Operand (Scan), 0) then
+ Dump_Indent := Dump_Indent - 1;
return True;
end if;
@@ -2517,7 +2582,7 @@ package body System.Regpat is
when BOL =>
exit State_Machine when Input_Pos /= BOL_Pos
and then ((Self.Flags and Multiple_Lines) = 0
- or else Data (Input_Pos - 1) /= ASCII.LF);
+ or else Data (Input_Pos - 1) /= ASCII.LF);
when MBOL =>
exit State_Machine when Input_Pos /= BOL_Pos
@@ -2529,7 +2594,7 @@ package body System.Regpat is
when EOL =>
exit State_Machine when Input_Pos <= Data'Last
and then ((Self.Flags and Multiple_Lines) = 0
- or else Data (Input_Pos) /= ASCII.LF);
+ or else Data (Input_Pos) /= ASCII.LF);
when MEOL =>
exit State_Machine when Input_Pos <= Data'Last
@@ -2610,7 +2675,6 @@ package body System.Regpat is
declare
Opnd : Pointer := String_Operand (Scan);
Current : Positive := Input_Pos;
-
Last : constant Pointer :=
Opnd + String_Length (Program, Scan);
@@ -2686,6 +2750,12 @@ package body System.Regpat is
-- If we haven't seen that parenthesis yet
if Last_Paren < No then
+ Dump_Indent := Dump_Indent - 1;
+
+ if Debug then
+ Dump_Error ("REFF: No match, backtracking");
+ end if;
+
return False;
end if;
@@ -2695,6 +2765,12 @@ package body System.Regpat is
if Input_Pos > Last_In_Data
or else Data (Input_Pos) /= Data (Data_Pos)
then
+ Dump_Indent := Dump_Indent - 1;
+
+ if Debug then
+ Dump_Error ("REFF: No match, backtracking");
+ end if;
+
return False;
end if;
@@ -2711,7 +2787,9 @@ package body System.Regpat is
Greed : constant Boolean := Greedy;
begin
Greedy := True;
- return Match_Simple_Operator (Op, Scan, Next, Greed);
+ Result := Match_Simple_Operator (Op, Scan, Next, Greed);
+ Dump_Indent := Dump_Indent - 1;
+ return Result;
end;
when CURLYX =>
@@ -2725,9 +2803,10 @@ package body System.Regpat is
declare
Min : constant Natural :=
- Read_Natural (Program, Scan + 3);
+ Read_Natural (Program, Scan + Next_Pointer_Bytes);
Max : constant Natural :=
- Read_Natural (Program, Scan + 5);
+ Read_Natural
+ (Program, Scan + Next_Pointer_Bytes + 2);
Cc : aliased Current_Curly_Record;
Has_Match : Boolean;
@@ -2742,25 +2821,46 @@ package body System.Regpat is
Next => Next,
Lastloc => 0,
Old_Cc => Current_Curly);
+ Greedy := True;
Current_Curly := Cc'Unchecked_Access;
- Has_Match := Match (Next - 3);
+ Has_Match := Match (Next - Next_Pointer_Bytes);
-- Start on the WHILEM
Current_Curly := Cc.Old_Cc;
+ Dump_Indent := Dump_Indent - 1;
+
+ if not Has_Match then
+ if Debug then
+ Dump_Error ("CURLYX failed...");
+ end if;
+ end if;
+
return Has_Match;
end;
when WHILEM =>
- return Match_Whilem (IP);
+ Result := Match_Whilem;
+ Dump_Indent := Dump_Indent - 1;
+
+ if Debug and then not Result then
+ Dump_Error ("WHILEM: no match, backtracking");
+ end if;
+
+ return Result;
end case;
Scan := Next;
end loop State_Machine;
- -- If we get here, there is no match.
- -- For successful matches when EOP is the terminating point.
+ if Debug then
+ Dump_Error ("failed...");
+ Dump_Indent := Dump_Indent - 1;
+ end if;
+
+ -- If we get here, there is no match. For successful matches when EOP
+ -- is the terminating point.
return False;
end Match;
@@ -2786,8 +2886,8 @@ package body System.Regpat is
Save : constant Natural := Input_Pos;
begin
- -- Lookahead to avoid useless match attempts
- -- when we know what character comes next.
+ -- Lookahead to avoid useless match attempts when we know what
+ -- character comes next.
if Program (Next) = EXACT then
Next_Char := Program (String_Operand (Next));
@@ -2806,21 +2906,31 @@ package body System.Regpat is
Operand_Code := Operand (Scan);
when others =>
- Min := Read_Natural (Program, Scan + 3);
- Max := Read_Natural (Program, Scan + 5);
+ Min := Read_Natural (Program, Scan + Next_Pointer_Bytes);
+ Max := Read_Natural (Program, Scan + Next_Pointer_Bytes + 2);
Operand_Code := Scan + 7;
end case;
+ if Debug then
+ Dump_Current (Operand_Code, Prefix => False);
+ end if;
+
-- Non greedy operators
if not Greedy then
- -- Test the minimal repetitions
+ -- Test we can repeat at least Min times
- if Min /= 0
- and then Repeat (Operand_Code, Min) < Min
- then
- return False;
+ if Min /= 0 then
+ No := Repeat (Operand_Code, Min);
+
+ if No < Min then
+ if Debug then
+ Dump_Error ("failed... matched" & No'Img & " times");
+ end if;
+
+ return False;
+ end if;
end if;
Old := Input_Pos;
@@ -2828,6 +2938,7 @@ package body System.Regpat is
-- Find the place where 'next' could work
if Next_Char_Known then
+
-- Last position to check
if Max = Natural'Last then
@@ -2842,6 +2953,10 @@ package body System.Regpat is
-- Look for the first possible opportunity
+ if Debug then
+ Dump_Error ("Next_Char must be " & Next_Char);
+ end if;
+
loop
-- Find the next possible position
@@ -2855,8 +2970,8 @@ package body System.Regpat is
return False;
end if;
- -- Check that we still match if we stop
- -- at the position we just found.
+ -- Check that we still match if we stop at the position we
+ -- just found.
declare
Num : constant Natural := Input_Pos - Old;
@@ -2864,6 +2979,10 @@ package body System.Regpat is
begin
Input_Pos := Old;
+ if Debug then
+ Dump_Error ("Would we still match at that position?");
+ end if;
+
if Repeat (Operand_Code, Num) < Num then
return False;
end if;
@@ -2879,14 +2998,18 @@ package body System.Regpat is
Input_Pos := Input_Pos + 1;
end loop;
- -- We know what the next character is
+ -- We do not know what the next character is
else
while Max >= Min loop
+ if Debug then
+ Dump_Error ("Non-greedy repeat, N=" & Min'Img);
+ Dump_Error ("Do we still match Next if we stop here?");
+ end if;
-- If the next character matches
- if Match (Next) then
+ if Recurse_Match (Next, 1) then
return True;
end if;
@@ -2897,6 +3020,10 @@ package body System.Regpat is
if Repeat (Operand_Code, 1) /= 0 then
Min := Min + 1;
else
+ if Debug then
+ Dump_Error ("Non-greedy repeat failed...");
+ end if;
+
return False;
end if;
end loop;
@@ -2909,12 +3036,15 @@ package body System.Regpat is
else
No := Repeat (Operand_Code, Max);
- -- ??? Perl has some special code here in case the
- -- next instruction is of type EOL, since $ and \Z
- -- can match before *and* after newline at the end.
+ if Debug and then No < Min then
+ Dump_Error ("failed... matched" & No'Img & " times");
+ end if;
- -- ??? Perl has some special code here in case (paren)
- -- is True.
+ -- ??? Perl has some special code here in case the next
+ -- instruction is of type EOL, since $ and \Z can match before
+ -- *and* after newline at the end.
+
+ -- ??? Perl has some special code here in case (paren) is True
-- Else, if we don't have any parenthesis
@@ -2948,10 +3078,9 @@ package body System.Regpat is
-- tree by recursing ever deeper. And if it fails, we have to reset
-- our parent's current state that we can try again after backing off.
- function Match_Whilem (IP : Pointer) return Boolean is
- pragma Unreferenced (IP);
-
+ function Match_Whilem return Boolean is
Cc : constant Current_Curly_Access := Current_Curly;
+
N : constant Natural := Cc.Cur + 1;
Ln : Natural := 0;
@@ -2991,12 +3120,22 @@ package body System.Regpat is
Cc.Cur := N;
Cc.Lastloc := Input_Pos;
+ if Debug then
+ Dump_Error
+ ("Tests that we match at least" & Cc.Min'Img & " N=" & N'Img);
+ end if;
+
if Match (Cc.Scan) then
return True;
end if;
Cc.Cur := N - 1;
Cc.Lastloc := Lastloc;
+
+ if Debug then
+ Dump_Error ("failed...");
+ end if;
+
return False;
end if;
@@ -3022,6 +3161,9 @@ package body System.Regpat is
-- Maximum greed exceeded ?
if N >= Cc.Max then
+ if Debug then
+ Dump_Error ("failed...");
+ end if;
return False;
end if;
@@ -3029,6 +3171,10 @@ package body System.Regpat is
Cc.Cur := N;
Cc.Lastloc := Input_Pos;
+ if Debug then
+ Dump_Error ("Next failed, what about Current?");
+ end if;
+
if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then
return True;
end if;
@@ -3044,6 +3190,10 @@ package body System.Regpat is
Cc.Cur := N;
Cc.Lastloc := Input_Pos;
+ if Debug then
+ Dump_Error ("Recurse at current position");
+ end if;
+
if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then
return True;
end if;
@@ -3057,6 +3207,10 @@ package body System.Regpat is
Ln := Current_Curly.Cur;
end if;
+ if Debug then
+ Dump_Error ("Failed matching for later positions");
+ end if;
+
if Match (Cc.Next) then
return True;
end if;
@@ -3068,6 +3222,11 @@ package body System.Regpat is
Current_Curly := Cc;
Cc.Cur := N - 1;
Cc.Lastloc := Lastloc;
+
+ if Debug then
+ Dump_Error ("failed...");
+ end if;
+
return False;
end Match_Whilem;
@@ -3200,7 +3359,7 @@ package body System.Regpat is
Last_Paren := 0;
Matches_Full := (others => No_Match);
- if Match (Program_First + 1) then
+ if Match (Program_First) then
Matches_Full (0) := (Pos, Input_Pos - 1);
return True;
end if;
@@ -3218,12 +3377,6 @@ package body System.Regpat is
return;
end if;
- -- Check validity of program
-
- pragma Assert
- (Program (Program_First) = MAGIC,
- "Corrupted Pattern_Matcher");
-
-- If there is a "must appear" string, look for it
if Self.Must_Have_Length > 0 then
@@ -3430,7 +3583,7 @@ package body System.Regpat is
function Operand (P : Pointer) return Pointer is
begin
- return P + 3;
+ return P + Next_Pointer_Bytes;
end Operand;
--------------
@@ -3452,7 +3605,7 @@ package body System.Regpat is
Self.Must_Have := Program'Last + 1;
Self.Must_Have_Length := 0;
- Scan := Program_First + 1; -- First instruction (can be anything)
+ Scan := Program_First; -- First instruction (can be anything)
if Program (Scan) = EXACT then
Self.First := Program (String_Operand (Scan));
@@ -3547,7 +3700,7 @@ package body System.Regpat is
is
begin
pragma Assert (Program (P) = EXACT or else Program (P) = EXACTF);
- return Character'Pos (Program (P + 3));
+ return Character'Pos (Program (P + Next_Pointer_Bytes));
end String_Length;
--------------------
diff --git a/gcc/ada/s-shasto.adb b/gcc/ada/s-shasto.adb
index 7038d796c28..783fdc4a95d 100644
--- a/gcc/ada/s-shasto.adb
+++ b/gcc/ada/s-shasto.adb
@@ -6,8 +6,8 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
--- --
+-- Copyright (C) 1998-2010, 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- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
@@ -88,8 +88,8 @@ package body System.Shared_Storage is
Item : AS.Stream_Element_Array);
subtype Hash_Header is Natural range 0 .. 30;
- -- Number of hash headers, related (for efficiency purposes only)
- -- to the maximum number of lock files..
+ -- Number of hash headers, related (for efficiency purposes only) to the
+ -- maximum number of lock files.
type Shared_Var_File_Entry;
type Shared_Var_File_Entry_Ptr is access Shared_Var_File_Entry;
diff --git a/gcc/ada/s-stchop.adb b/gcc/ada/s-stchop.adb
index d4aa675a857..b757c56532b 100644
--- a/gcc/ada/s-stchop.adb
+++ b/gcc/ada/s-stchop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -48,28 +48,24 @@ package body System.Stack_Checking.Operations is
function Set_Stack_Info
(Stack : not null access Stack_Access) return Stack_Access;
-
-- The function Set_Stack_Info is the actual function that updates the
-- cache containing a pointer to the Stack_Info. It may also be used for
-- detecting asynchronous abort in combination with Invalidate_Self_Cache.
-
+ --
-- Set_Stack_Info should do the following things in order:
-- 1) Get the Stack_Access value for the current task
-- 2) Set Stack.all to the value obtained in 1)
-- 3) Optionally Poll to check for asynchronous abort
-
+ --
-- This order is important because if at any time a write to the stack
-- cache is pending, that write should be followed by a Poll to prevent
-- loosing signals.
-
+ --
-- Note: This function must be compiled with Polling turned off
-
- -- Note: on systems like VxWorks and OS/2 with real thread-local storage,
- -- Set_Stack_Info should return an access value for such local
- -- storage. In those cases the cache will always be up-to-date.
-
- -- The following constants should be imported from some system-specific
- -- constants package. The constants must be static for performance reasons.
+ --
+ -- Note: on systems with real thread-local storage, Set_Stack_Info should
+ -- return an access value for such local storage. In those cases the cache
+ -- will always be up-to-date.
----------------------------
-- Invalidate_Stack_Cache --
diff --git a/gcc/ada/s-stoele.adb b/gcc/ada/s-stoele.adb
index 0bab843c138..cd3e22ef907 100644
--- a/gcc/ada/s-stoele.adb
+++ b/gcc/ada/s-stoele.adb
@@ -37,6 +37,10 @@ package body System.Storage_Elements is
pragma Suppress (All_Checks);
+ -- Conversion to/from address
+
+ -- Note qualification below of To_Address to avoid ambiguities on VMS
+
function To_Address is
new Ada.Unchecked_Conversion (Storage_Offset, Address);
function To_Offset is
@@ -47,38 +51,62 @@ package body System.Storage_Elements is
-- These functions must be place first because they are inlined_always
-- and are used and inlined in other subprograms defined in this unit.
- function To_Integer (Value : Address) return Integer_Address is
- begin
- return Integer_Address (Value);
- end To_Integer;
+ ----------------
+ -- To_Address --
+ ----------------
function To_Address (Value : Integer_Address) return Address is
begin
return Address (Value);
end To_Address;
+ ----------------
+ -- To_Integer --
+ ----------------
+
+ function To_Integer (Value : Address) return Integer_Address is
+ begin
+ return Integer_Address (Value);
+ end To_Integer;
+
-- Address arithmetic
+ ---------
+ -- "+" --
+ ---------
+
function "+" (Left : Address; Right : Storage_Offset) return Address is
begin
- return To_Address (To_Integer (Left) + To_Integer (To_Address (Right)));
+ return Storage_Elements.To_Address
+ (To_Integer (Left) + To_Integer (To_Address (Right)));
end "+";
function "+" (Left : Storage_Offset; Right : Address) return Address is
begin
- return To_Address (To_Integer (To_Address (Left)) + To_Integer (Right));
+ return Storage_Elements.To_Address
+ (To_Integer (To_Address (Left)) + To_Integer (Right));
end "+";
+ ---------
+ -- "-" --
+ ---------
+
function "-" (Left : Address; Right : Storage_Offset) return Address is
begin
- return To_Address (To_Integer (Left) - To_Integer (To_Address (Right)));
+ return Storage_Elements.To_Address
+ (To_Integer (Left) - To_Integer (To_Address (Right)));
end "-";
function "-" (Left, Right : Address) return Storage_Offset is
begin
- return To_Offset (To_Address (To_Integer (Left) - To_Integer (Right)));
+ return To_Offset (Storage_Elements.To_Address
+ (To_Integer (Left) - To_Integer (Right)));
end "-";
+ -----------
+ -- "mod" --
+ -----------
+
function "mod"
(Left : Address;
Right : Storage_Offset) return Storage_Offset
@@ -98,4 +126,5 @@ package body System.Storage_Elements is
raise Constraint_Error;
end if;
end "mod";
+
end System.Storage_Elements;
diff --git a/gcc/ada/s-taprop-vxworks.adb b/gcc/ada/s-taprop-vxworks.adb
index 4cde338bfd3..2cf8131755b 100644
--- a/gcc/ada/s-taprop-vxworks.adb
+++ b/gcc/ada/s-taprop-vxworks.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -99,10 +99,6 @@ package body System.Task_Primitives.Operations is
Dispatching_Policy : Character;
pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy");
- function Get_Policy (Prio : System.Any_Priority) return Character;
- pragma Import (C, Get_Policy, "__gnat_get_specific_dispatching");
- -- Get priority specific dispatching policy
-
Mutex_Protocol : Priority_Type;
Foreign_Task_Elaborated : aliased Boolean := True;
@@ -734,20 +730,13 @@ package body System.Task_Primitives.Operations is
-- Set_Priority --
------------------
- type Prio_Array_Type is array (System.Any_Priority) of Integer;
- pragma Atomic_Components (Prio_Array_Type);
-
- Prio_Array : Prio_Array_Type;
- -- Global array containing the id of the currently running task for each
- -- priority. Note that we assume that we are on a single processor with
- -- run-till-blocked scheduling.
-
procedure Set_Priority
(T : Task_Id;
Prio : System.Any_Priority;
Loss_Of_Inheritance : Boolean := False)
is
- Array_Item : Integer;
+ pragma Unreferenced (Loss_Of_Inheritance);
+
Result : int;
begin
@@ -756,33 +745,16 @@ package body System.Task_Primitives.Operations is
(T.Common.LL.Thread, To_VxWorks_Priority (int (Prio)));
pragma Assert (Result = 0);
- if (Dispatching_Policy = 'F' or else Get_Policy (Prio) = 'F')
- and then Loss_Of_Inheritance
- and then Prio < T.Common.Current_Priority
- then
- -- Annex D requirement (RM D.2.2(9)):
-
- -- If the task drops its priority due to the loss of inherited
- -- priority, it is added at the head of the ready queue for its
- -- new active priority.
+ -- Note: in VxWorks 6.6 (or earlier), the task is placed at the end of
+ -- the priority queue instead of the head. This is not the behavior
+ -- required by Annex D (RM D.2.3(5/2)), but we consider it an acceptable
+ -- variation (RM 1.1.3(6)), given this is the built-in behavior of the
+ -- operating system. VxWorks versions starting from 6.7 implement the
+ -- required Annex D semantics.
- Array_Item := Prio_Array (T.Common.Base_Priority) + 1;
- Prio_Array (T.Common.Base_Priority) := Array_Item;
-
- loop
- -- Give some processes a chance to arrive
-
- taskDelay (0);
-
- -- Then wait for our turn to proceed
-
- exit when Array_Item = Prio_Array (T.Common.Base_Priority)
- or else Prio_Array (T.Common.Base_Priority) = 1;
- end loop;
-
- Prio_Array (T.Common.Base_Priority) :=
- Prio_Array (T.Common.Base_Priority) - 1;
- end if;
+ -- In older versions we attempted to better approximate the Annex D
+ -- required behavior, but this simulation was not entirely accurate,
+ -- and it seems better to live with the standard VxWorks semantics.
T.Common.Current_Priority := Prio;
end Set_Priority;
diff --git a/gcc/ada/s-tasdeb.adb b/gcc/ada/s-tasdeb.adb
index 9fb0cd6e798..ccc81d9d53b 100644
--- a/gcc/ada/s-tasdeb.adb
+++ b/gcc/ada/s-tasdeb.adb
@@ -362,10 +362,11 @@ package body System.Tasking.Debug is
-----------
procedure Write (Fd : Integer; S : String; Count : Integer) is
- Discard : Integer;
+ Discard : System.CRTL.ssize_t;
pragma Unreferenced (Discard);
begin
- Discard := System.CRTL.write (Fd, S (S'First)'Address, Count);
+ Discard := System.CRTL.write (Fd, S (S'First)'Address,
+ System.CRTL.size_t (Count));
-- Is it really right to ignore write errors here ???
end Write;
diff --git a/gcc/ada/s-tpoben.adb b/gcc/ada/s-tpoben.adb
index 4694310ebff..ba2bf6c267a 100644
--- a/gcc/ada/s-tpoben.adb
+++ b/gcc/ada/s-tpoben.adb
@@ -226,12 +226,12 @@ package body System.Tasking.Protected_Objects.Entries is
raise Program_Error;
end if;
- -- pragma Assert (Self_Id.Deferral_Level = 0);
-- If a PO is created from a controlled operation, abort is already
- -- deferred at this point, so we need to use Defer_Abort_Nestable
- -- In some cases, the above assertion can be useful to spot
- -- inconsistencies, outside the above scenario involving controlled
- -- types.
+ -- deferred at this point, so we need to use Defer_Abort_Nestable. In
+ -- some cases, the following assertion can help to spot inconsistencies,
+ -- outside the above scenario involving controlled types.
+
+ -- pragma Assert (Self_Id.Deferral_Level = 0);
Initialization.Defer_Abort_Nestable (Self_ID);
Initialize_Lock (Init_Priority, Object.L'Access);
diff --git a/gcc/ada/s-vxwext-kernel.ads b/gcc/ada/s-vxwext-kernel.ads
index e450285ecbc..0df9211a68f 100644
--- a/gcc/ada/s-vxwext-kernel.ads
+++ b/gcc/ada/s-vxwext-kernel.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2008-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -39,6 +39,8 @@ package System.VxWorks.Ext is
subtype SEM_ID is Long_Integer;
-- typedef struct semaphore *SEM_ID;
+ type sigset_t is mod 2 ** Long_Long_Integer'Size;
+
type t_id is new Long_Integer;
subtype int is Interfaces.C.int;
diff --git a/gcc/ada/s-vxwext-rtp.ads b/gcc/ada/s-vxwext-rtp.ads
index 22452a18e77..844d39415db 100644
--- a/gcc/ada/s-vxwext-rtp.ads
+++ b/gcc/ada/s-vxwext-rtp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2008-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -39,6 +39,8 @@ package System.VxWorks.Ext is
subtype SEM_ID is Long_Integer;
-- typedef struct semaphore *SEM_ID;
+ type sigset_t is mod 2 ** Long_Long_Integer'Size;
+
type t_id is new Long_Integer;
subtype int is Interfaces.C.int;
diff --git a/gcc/ada/s-vxwext.ads b/gcc/ada/s-vxwext.ads
index 42abdc1f355..1559d7d8e14 100644
--- a/gcc/ada/s-vxwext.ads
+++ b/gcc/ada/s-vxwext.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2008-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-2010, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@@ -39,7 +39,10 @@ package System.VxWorks.Ext is
subtype SEM_ID is Long_Integer;
-- typedef struct semaphore *SEM_ID;
+ type sigset_t is mod 2 ** Interfaces.C.long'Size;
+
type t_id is new Long_Integer;
+
subtype int is Interfaces.C.int;
type Interrupt_Handler is access procedure (parameter : System.Address);
diff --git a/gcc/ada/scil_ll.adb b/gcc/ada/scil_ll.adb
new file mode 100644
index 00000000000..4591d8ef287
--- /dev/null
+++ b/gcc/ada/scil_ll.adb
@@ -0,0 +1,144 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S C I L _ L L --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Alloc; use Alloc;
+with Atree; use Atree;
+with Opt; use Opt;
+with Sinfo; use Sinfo;
+with Table;
+
+package body SCIL_LL is
+
+ procedure Copy_SCIL_Node (Target : Node_Id; Source : Node_Id);
+ -- Copy the SCIL field from Source to Target (it is used as the argument
+ -- for a call to Set_Reporting_Proc in package atree).
+
+ function SCIL_Nodes_Table_Size return Pos;
+ -- Used to initialize the table of SCIL nodes because we do not want
+ -- to consume memory for this table if it is not required.
+
+ ----------------------------
+ -- SCIL_Nodes_Table_Size --
+ ----------------------------
+
+ function SCIL_Nodes_Table_Size return Pos is
+ begin
+ if Generate_SCIL then
+ return Alloc.Orig_Nodes_Initial;
+ else
+ return 1;
+ end if;
+ end SCIL_Nodes_Table_Size;
+
+ package SCIL_Nodes is new Table.Table (
+ Table_Component_Type => Node_Id,
+ Table_Index_Type => Node_Id'Base,
+ Table_Low_Bound => First_Node_Id,
+ Table_Initial => SCIL_Nodes_Table_Size,
+ Table_Increment => Alloc.Orig_Nodes_Increment,
+ Table_Name => "SCIL_Nodes");
+ -- This table records the value of attribute SCIL_Node of all the
+ -- tree nodes.
+
+ --------------------
+ -- Copy_SCIL_Node --
+ --------------------
+
+ procedure Copy_SCIL_Node (Target : Node_Id; Source : Node_Id) is
+ begin
+ Set_SCIL_Node (Target, Get_SCIL_Node (Source));
+ end Copy_SCIL_Node;
+
+ ----------------
+ -- Initialize --
+ ----------------
+
+ procedure Initialize is
+ begin
+ SCIL_Nodes.Init;
+ Set_Reporting_Proc (Copy_SCIL_Node'Access);
+ end Initialize;
+
+ -------------------
+ -- Get_SCIL_Node --
+ -------------------
+
+ function Get_SCIL_Node (N : Node_Id) return Node_Id is
+ begin
+ if Generate_SCIL
+ and then Present (N)
+ then
+ return SCIL_Nodes.Table (N);
+ else
+ return Empty;
+ end if;
+ end Get_SCIL_Node;
+
+ -------------------
+ -- Set_SCIL_Node --
+ -------------------
+
+ procedure Set_SCIL_Node (N : Node_Id; Value : Node_Id) is
+ begin
+ pragma Assert (Generate_SCIL);
+
+ if Present (Value) then
+ case Nkind (Value) is
+ when N_SCIL_Dispatch_Table_Tag_Init =>
+ pragma Assert (Nkind (N) = N_Object_Declaration);
+ null;
+
+ when N_SCIL_Dispatching_Call =>
+ pragma Assert (Nkind_In (N, N_Function_Call,
+ N_Procedure_Call_Statement));
+ null;
+
+ when N_SCIL_Membership_Test =>
+ pragma Assert (Nkind_In (N, N_Identifier,
+ N_And_Then,
+ N_Or_Else,
+ N_Expression_With_Actions));
+ null;
+
+ when others =>
+ pragma Assert (False);
+ raise Program_Error;
+ end case;
+ end if;
+
+ if Atree.Last_Node_Id > SCIL_Nodes.Last then
+ SCIL_Nodes.Set_Last (Atree.Last_Node_Id);
+ end if;
+
+ SCIL_Nodes.Set_Item (N, Value);
+ end Set_SCIL_Node;
+
+end SCIL_LL;
diff --git a/gcc/ada/scil_ll.ads b/gcc/ada/scil_ll.ads
new file mode 100644
index 00000000000..8265a19df30
--- /dev/null
+++ b/gcc/ada/scil_ll.ads
@@ -0,0 +1,48 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S C I L _ L L --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2010, 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package extends the tree nodes with a field that is used to reference
+-- the SCIL node.
+
+with Types; use Types;
+
+package SCIL_LL is
+
+ function Get_SCIL_Node (N : Node_Id) return Node_Id;
+ -- Read the value of attribute SCIL node
+
+ procedure Set_SCIL_Node (N : Node_Id; Value : Node_Id);
+ -- Set the value of attribute SCIL node
+
+ procedure Initialize;
+ -- Initialize the table of SCIL nodes
+
+end SCIL_LL;
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index af1f3bbc3a0..d4005b47989 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -37,9 +37,12 @@ with Uintp; use Uintp;
with Urealp; use Urealp;
with Widechar; use Widechar;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.CRC32;
with System.UTF_32; use System.UTF_32;
with System.WCh_Con; use System.WCh_Con;
+pragma Warnings (On);
package body Scng is
@@ -325,7 +328,8 @@ package body Scng is
and then Source (Scan_Ptr + 2) = C
then
Scan_Ptr := Scan_Ptr + 1;
- Error_Msg_S ("no space allowed here");
+ Error_Msg_S -- CODEFIX
+ ("no space allowed here");
Scan_Ptr := Scan_Ptr + 2;
return True;
@@ -380,16 +384,14 @@ package body Scng is
Error_Msg_S -- CODEFIX
("two consecutive underlines not permitted");
else
- Error_Msg_S -- CODEFIX???
- ("underline cannot follow punctuation character");
+ Error_Msg_S ("underline cannot follow punctuation character");
end if;
else
if Source (Scan_Ptr - 1) = '_' then
- Error_Msg_S -- CODEFIX???
- ("punctuation character cannot follow underline");
+ Error_Msg_S ("punctuation character cannot follow underline");
else
- Error_Msg_S -- CODEFIX???
+ Error_Msg_S
("two consecutive punctuation characters not permitted");
end if;
end if;
@@ -572,8 +574,7 @@ package body Scng is
if Warn_On_Obsolescent_Feature then
Error_Msg_S
("use of "":"" is an obsolescent feature (RM J.2(3))?");
- Error_Msg_S
- ("\use ""'#"" instead?");
+ Error_Msg_S ("\use ""'#"" instead?");
end if;
end if;
@@ -658,9 +659,11 @@ package body Scng is
elsif not Identifier_Char (C) then
if Base_Char = '#' then
- Error_Msg_S ("missing '#");
+ Error_Msg_S -- CODEFIX
+ ("missing '#");
else
- Error_Msg_S ("missing ':");
+ Error_Msg_S -- CODEFIX
+ ("missing ':");
end if;
exit;
@@ -875,7 +878,7 @@ package body Scng is
end if;
end if;
- Error_Msg_S -- CODEFIX
+ Error_Msg_S -- CODEFIX
("missing string quote");
end Error_Unterminated_String;
@@ -1215,7 +1218,8 @@ package body Scng is
Accumulate_Checksum ('&');
if Source (Scan_Ptr + 1) = '&' then
- Error_Msg_S ("'&'& should be `AND THEN`");
+ Error_Msg_S -- CODEFIX
+ ("'&'& should be `AND THEN`");
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_And;
return;
@@ -1263,7 +1267,8 @@ package body Scng is
and then Source (Scan_Ptr + 2) /= '-'
then
Token := Tok_Colon_Equal;
- Error_Msg (":- should be :=", Scan_Ptr);
+ Error_Msg -- CODEFIX
+ (":- should be :=", Scan_Ptr);
Scan_Ptr := Scan_Ptr + 2;
return;
@@ -1367,7 +1372,8 @@ package body Scng is
return;
elsif Source (Scan_Ptr + 1) = '=' then
- Error_Msg_S ("== should be =");
+ Error_Msg_S -- CODEFIX
+ ("== should be =");
Scan_Ptr := Scan_Ptr + 1;
end if;
@@ -1588,8 +1594,7 @@ package body Scng is
if Warn_On_Obsolescent_Feature then
Error_Msg_S
("use of ""'%"" is an obsolescent feature (RM J.2(4))?");
- Error_Msg_S
- ("\use """""" instead?");
+ Error_Msg_S ("\use """""" instead?");
end if;
Slit;
@@ -1669,13 +1674,13 @@ package body Scng is
elsif Ada_Version >= Ada_05
and then Is_UTF_32_Non_Graphic (UTF_32 (Code))
then
- Error_Msg
+ Error_Msg -- CODEFIX????
("(Ada 2005) non-graphic character not permitted " &
"in character literal", Wptr);
end if;
if Source (Scan_Ptr) /= ''' then
- Error_Msg_S ("missing apostrophe");
+ Error_Msg_S ("missing apostrophe");
else
Scan_Ptr := Scan_Ptr + 1;
end if;
@@ -1789,7 +1794,8 @@ package body Scng is
-- Special check for || to give nice message
if Source (Scan_Ptr + 1) = '|' then
- Error_Msg_S ("""'|'|"" should be `OR ELSE`");
+ Error_Msg_S -- CODEFIX
+ ("""'|'|"" should be `OR ELSE`");
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_Or;
return;
@@ -1815,12 +1821,12 @@ package body Scng is
if Warn_On_Obsolescent_Feature then
Error_Msg_S
("use of ""'!"" is an obsolescent feature (RM J.2(2))?");
- Error_Msg_S
- ("\use ""'|"" instead?");
+ Error_Msg_S ("\use ""'|"" instead?");
end if;
if Source (Scan_Ptr + 1) = '=' then
- Error_Msg_S ("'!= should be /=");
+ Error_Msg_S -- CODEFIX
+ ("'!= should be /=");
Scan_Ptr := Scan_Ptr + 2;
Token := Tok_Not_Equal;
return;
@@ -2068,8 +2074,7 @@ package body Scng is
-- Punctuation is an error (at start of identifier)
elsif Is_UTF_32_Punctuation (Cat) then
- Error_Msg
- ("identifier cannot start with punctuation", Wptr);
+ Error_Msg ("identifier cannot start with punctuation", Wptr);
Scan_Ptr := Wptr;
Name_Len := 0;
Underline_Found := False;
@@ -2078,8 +2083,7 @@ package body Scng is
-- Mark character is an error (at start of identifier)
elsif Is_UTF_32_Mark (Cat) then
- Error_Msg
- ("identifier cannot start with mark character", Wptr);
+ Error_Msg ("identifier cannot start with mark character", Wptr);
Scan_Ptr := Wptr;
Name_Len := 0;
Underline_Found := False;
diff --git a/gcc/ada/scng.ads b/gcc/ada/scng.ads
index abcf3dad193..1988e26dd23 100644
--- a/gcc/ada/scng.ads
+++ b/gcc/ada/scng.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
@@ -23,9 +23,9 @@
-- --
------------------------------------------------------------------------------
--- This package contains a generic lexical analyzer. This is used
--- for scanning Ada source files or text files with an Ada-like syntax,
--- such as project files. It is instantiated in Scn and Prj.Err.
+-- This package contains a generic lexical analyzer. This is used for scanning
+-- Ada source files or text files with an Ada-like syntax, such as project
+-- files. It is instantiated in Scn and Prj.Err.
with Casing; use Casing;
with Styleg;
diff --git a/gcc/ada/scos.ads b/gcc/ada/scos.ads
index 19804e4567b..7111287c0a6 100644
--- a/gcc/ada/scos.ads
+++ b/gcc/ada/scos.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2010, 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- --
@@ -148,21 +148,27 @@ package SCOs is
-- o object declaration
-- r renaming declaration
-- i generic instantiation
- -- C CASE statement (includes only the expression)
+ -- C CASE statement (from CASE through end of expression)
-- E EXIT statement
- -- F FOR loop statement (includes only the iteration scheme)
- -- I IF statement (includes only the condition [in the RM sense, which
- -- is a decision in the SCO sense])
+ -- F FOR loop statement (from FOR through end of iteration scheme)
+ -- I IF statement (from IF through end of condition)
-- P PRAGMA
-- R extended RETURN statement
- -- W WHILE loop statement (includes only the condition)
+ -- W WHILE loop statement (from WHILE through end of condition)
+
+ -- Note: for I and W, condition above is in the RM syntax sense (this
+ -- condition is a decision in SCO terminology).
-- and is omitted for all other cases.
+ -- Note: up to 6 entries can appear on a single CS line. If more than 6
+ -- entries appear in one logical statement sequence, continuation lines
+ -- are marked by Cs and appear immediately after the CS line.
+
-- Decisions
-- Note: in the following description, logical operator includes only the
- -- short circuited forms and NOT (so can be only NOT, AND THEN, OR ELSE).
+ -- short-circuited forms and NOT (so can be only NOT, AND THEN, OR ELSE).
-- The reason that we can exclude AND/OR/XOR is that we expect SCO's to
-- be generated using the restriction No_Direct_Boolean_Operators if we
-- are interested in decision coverage, which does not permit the use of
@@ -171,18 +177,27 @@ package SCOs is
-- we are generating SCO's only for simple coverage, then we are not
-- interested in decisions in any case.
- -- Decisions are either simple or complex. A simple decision is a boolean
- -- expresssion that occurs in the context of a control structure in the
- -- source program, including WHILE, IF, EXIT WHEN, or in an Assert,
- -- Check, Pre_Condition or Post_Condition pragma. For pragmas, decision
- -- SCOs are generated only if the corresponding pragma is enabled. Note
- -- that a boolean expression in any other context, for example as right
- -- hand side of an assignment, is not considered to be a simple decision.
+ -- Note: the reason we include NOT is for informational purposes. The
+ -- presence of NOT does not generate additional coverage obligations,
+ -- but if we know where the NOT's are, the coverage tool can generate
+ -- more accurate diagnostics on uncovered tests.
+
+ -- A top level boolean expression is a boolean expression that is not an
+ -- operand of a logical operator.
- -- A complex decision is an occurrence of a logical operator which is not
- -- itself an operand of some other logical operator. If any operand of
- -- the logical operator is itself a logical operator, this is not a
- -- separate decision, it is part of the same decision.
+ -- Decisions are either simple or complex. A simple decision is a top
+ -- level boolean expresssion that has only one condition and that occurs
+ -- in the context of a control structure in the source program, including
+ -- WHILE, IF, EXIT WHEN, or in an Assert, Check, Pre_Condition or
+ -- Post_Condition pragma. For pragmas, decision SCOs are generated only
+ -- if the corresponding pragma is enabled. Note that a top level boolean
+ -- expression with only one condition that occurs in any other context,
+ -- for example as right hand side of an assignment, is not considered to
+ -- be a (simple) decision.
+
+ -- A complex decision is a top level boolean expression that has more
+ -- than one condition. A complex decision may occur in any boolean
+ -- expression context.
-- So for example, if we have
@@ -201,7 +216,7 @@ package SCOs is
-- For each decision, a decision line is generated with the form:
- -- C*sloc expression
+ -- C* sloc expression
-- Here * is one of the following characters:
@@ -217,7 +232,7 @@ package SCOs is
-- For X, sloc is omitted.
-- The expression is a prefix polish form indicating the structure of
- -- the decision, including logical operators and short circuit forms.
+ -- the decision, including logical operators and short-circuit forms.
-- The following is a grammar showing the structure of expression:
-- expression ::= term (if expr is not logical operator)
@@ -248,8 +263,35 @@ package SCOs is
-- ! indicates NOT applied to the expression.
- -- In the context of Couverture, the No_Direct_Boolean_Opeartors
- -- restriction is assumed, and no other operator can appear.
+ -- Note that complex decisions do NOT include non-short-circuited logical
+ -- operators (AND/XOR/OR). In the context of existing coverage tools the
+ -- No_Direct_Boolean_Operators restriction is assumed, so these operators
+ -- cannot appear in the source in any case.
+
+ -- The SCO line for a decision always occurs after the CS line for the
+ -- enclosing statement. The SCO line for a nested decision always occurs
+ -- after the line for the enclosing decision.
+
+ -- Note that membership tests are considered to be a single simple
+ -- condition, and that is true even if the Ada 2005 set membership
+ -- form is used, e.g. A in (2,7,11.15).
+
+ -- Case Expressions
+
+ -- For case statements, we rely on statement coverage to make sure that
+ -- all branches of a case statement are covered, but that does not work
+ -- for case expressions, since the entire expression is contained in a
+ -- single statement. However, for complete coverage we really should be
+ -- able to check that every branch of the case statement is covered, so
+ -- we generate a SCO of the form:
+
+ -- CC sloc-range sloc-range ...
+
+ -- where sloc-range covers the range of the case expression.
+
+ -- Note: up to 6 entries can appear on a single CC line. If more than 6
+ -- entries appear in one logical statement sequence, continuation lines
+ -- are marked by Cc and appear immediately after the CC line.
---------------------------------------------------------------------
-- Internal table used to store Source Coverage Obligations (SCOs) --
@@ -289,19 +331,45 @@ package SCOs is
-- Note: successive statements (possibly interspersed with entries of
-- other kinds, that are ignored for this purpose), starting with one
-- labeled with C1 = 'S', up to and including the first one labeled with
- -- Last=True, indicate the sequence to be output for a sequence of
- -- statements on a single CS line.
+ -- Last = True, indicate the sequence to be output for a sequence of
+ -- statements on a single CS line (possibly followed by Cs continuation
+ -- lines).
+
+ -- Decision (IF/EXIT/WHILE)
+ -- C1 = 'I'/'E'/'W' (for IF/EXIT/WHILE)
+ -- C2 = ' '
+ -- From = IF/EXIT/WHILE token
+ -- To = No_Source_Location
+ -- Last = unused
+
+ -- Decision (PRAGMA)
+ -- C1 = 'P'
+ -- C2 = 'e'/'d' for enabled/disabled
+ -- From = PRAGMA token
+ -- To = No_Source_Location
+ -- Last = unused
- -- Decision
- -- C1 = decision type code
+ -- Note: when the parse tree is first scanned, we unconditionally build
+ -- a pragma decision entry for any decision in a pragma (here as always
+ -- in SCO contexts, the only pragmas with decisions are Assert, Check,
+ -- Precondition and Postcondition), and we mark the pragma as disabled.
+ --
+ -- During analysis, if the pragma is enabled, Set_SCO_Pragma_Enabled to
+ -- mark the SCO decision table entry as enabled (C2 set to 'e'). Then
+ -- in Put_SCOs, we only output the decision for a pragma if C2 is 'e'.
+ --
+ -- When we read SCOs from an ALI file (in Get_SCOs), we always set C2
+ -- to 'e', since clearly the pragma is enabled if it was written out.
+
+ -- Decision (Expression)
+ -- C1 = 'X'
-- C2 = ' '
- -- From = location of IF/EXIT/PRAGMA/WHILE token,
- -- No_Source_Location for X
+ -- From = No_Source_Location
-- To = No_Source_Location
-- Last = unused
-- Operator
- -- C1 = '!', '^', '&', '|'
+ -- C1 = '!', '&', '|'
-- C2 = ' '
-- From = location of NOT/AND/OR token
-- To = No_Source_Location
@@ -316,8 +384,7 @@ package SCOs is
-- Note: the sequence starting with a decision, and continuing with
-- operators and elements up to and including the first one labeled with
- -- Last = True, indicate the sequence to be output for a complex decision
- -- on a single CD decision line.
+ -- Last = True, indicate the sequence to be output on one decision line.
----------------
-- Unit Table --
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index caa73a0b82c..5e6d8b2766a 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -67,9 +67,9 @@ package body Sem is
-- Controls debugging printouts for Walk_Library_Items
Outer_Generic_Scope : Entity_Id := Empty;
- -- Global reference to the outer scope that is generic. In a non
- -- generic context, it is empty. At the moment, it is only used
- -- for avoiding freezing of external references in generics.
+ -- Global reference to the outer scope that is generic. In a non- generic
+ -- context, it is empty. At the moment, it is only used for avoiding
+ -- freezing of external references in generics.
Comp_Unit_List : Elist_Id := No_Elist;
-- Used by Walk_Library_Items. This is a list of N_Compilation_Unit nodes
@@ -80,9 +80,9 @@ package body Sem is
generic
with procedure Action (Withed_Unit : Node_Id);
procedure Walk_Withs_Immediate (CU : Node_Id; Include_Limited : Boolean);
- -- Walk all the with clauses of CU, and call Action for the with'ed
- -- unit. Ignore limited withs, unless Include_Limited is True.
- -- CU must be an N_Compilation_Unit.
+ -- Walk all the with clauses of CU, and call Action for the with'ed unit.
+ -- Ignore limited withs, unless Include_Limited is True. CU must be an
+ -- N_Compilation_Unit.
generic
with procedure Action (Withed_Unit : Node_Id);
@@ -158,6 +158,9 @@ package body Sem is
when N_Block_Statement =>
Analyze_Block_Statement (N);
+ when N_Case_Expression =>
+ Analyze_Case_Expression (N);
+
when N_Case_Statement =>
Analyze_Case_Statement (N);
@@ -221,6 +224,9 @@ package body Sem is
when N_Explicit_Dereference =>
Analyze_Explicit_Dereference (N);
+ when N_Expression_With_Actions =>
+ Analyze_Expression_With_Actions (N);
+
when N_Extended_Return_Statement =>
Analyze_Extended_Return_Statement (N);
@@ -576,14 +582,14 @@ package body Sem is
when N_With_Clause =>
Analyze_With_Clause (N);
- -- A call to analyze the Empty node is an error, but most likely
- -- it is an error caused by an attempt to analyze a malformed
- -- piece of tree caused by some other error, so if there have
- -- been any other errors, we just ignore it, otherwise it is
- -- a real internal error which we complain about.
+ -- A call to analyze the Empty node is an error, but most likely it
+ -- is an error caused by an attempt to analyze a malformed piece of
+ -- tree caused by some other error, so if there have been any other
+ -- errors, we just ignore it, otherwise it is a real internal error
+ -- which we complain about.
- -- We must also consider the case of call to a runtime function
- -- that is not available in the configurable runtime.
+ -- We must also consider the case of call to a runtime function that
+ -- is not available in the configurable runtime.
when N_Empty =>
pragma Assert (Serious_Errors_Detected /= 0
@@ -609,11 +615,9 @@ package body Sem is
-- analyzed.
when
- N_SCIL_Dispatch_Table_Object_Init |
- N_SCIL_Dispatch_Table_Tag_Init |
- N_SCIL_Dispatching_Call |
- N_SCIL_Membership_Test |
- N_SCIL_Tag_Init =>
+ N_SCIL_Dispatch_Table_Tag_Init |
+ N_SCIL_Dispatching_Call |
+ N_SCIL_Membership_Test =>
null;
-- For the remaining node types, we generate compiler abort, because
@@ -629,6 +633,7 @@ package body Sem is
N_Access_Function_Definition |
N_Access_Procedure_Definition |
N_Access_To_Object_Definition |
+ N_Case_Expression_Alternative |
N_Case_Statement_Alternative |
N_Compilation_Unit_Aux |
N_Component_Association |
@@ -841,7 +846,7 @@ package body Sem is
return;
end if;
- -- Now search the global entity suppress table for a matching entry
+ -- Now search the global entity suppress table for a matching entry.
-- We also search this in reverse order so that if there are multiple
-- pragmas for the same entity, the last one applies.
@@ -1109,12 +1114,12 @@ package body Sem is
Node := First (L);
Insert_List_After (N, L);
- -- Now just analyze from the original first node until we get to
- -- the successor of the original insertion point (which may be
- -- Empty if the insertion point was at the end of the list). Note
- -- that this properly handles the case where any of the analyze
- -- calls result in the insertion of nodes after the analyzed
- -- node (possibly calling this routine recursively).
+ -- Now just analyze from the original first node until we get to the
+ -- successor of the original insertion point (which may be Empty if
+ -- the insertion point was at the end of the list). Note that this
+ -- properly handles the case where any of the analyze calls result in
+ -- the insertion of nodes after the analyzed node (possibly calling
+ -- this routine recursively).
while Node /= After loop
Analyze (Node);
@@ -1160,9 +1165,9 @@ package body Sem is
begin
if Is_Non_Empty_List (L) then
- -- Capture the Node_Id of the first list node to be inserted.
- -- This will still be the first node after the insert operation,
- -- since Insert_List_After does not modify the Node_Id values.
+ -- Capture the Node_Id of the first list node to be inserted. This
+ -- will still be the first node after the insert operation, since
+ -- Insert_List_After does not modify the Node_Id values.
Node := First (L);
Insert_List_Before (N, L);
@@ -1217,9 +1222,9 @@ package body Sem is
Ptr : Suppress_Stack_Entry_Ptr;
begin
- -- First search the local entity suppress stack, we search this from the
- -- top of the stack down, so that we get the innermost entry that
- -- applies to this case if there are nested entries.
+ -- First search the local entity suppress stack. We search this from the
+ -- top of the stack down so that we get the innermost entry that applies
+ -- to this case if there are nested entries.
Ptr := Local_Suppress_Stack_Top;
while Ptr /= null loop
@@ -1232,7 +1237,7 @@ package body Sem is
Ptr := Ptr.Prev;
end loop;
- -- Now search the global entity suppress table for a matching entry
+ -- Now search the global entity suppress table for a matching entry.
-- We also search this from the top down so that if there are multiple
-- pragmas for the same entity, the last one applies (not clear what
-- or whether the RM specifies this handling, but it seems reasonable).
@@ -1322,10 +1327,10 @@ package body Sem is
procedure Semantics (Comp_Unit : Node_Id) is
-- The following locations save the corresponding global flags and
- -- variables so that they can be restored on completion. This is
- -- needed so that calls to Rtsfind start with the proper default
- -- values for these variables, and also that such calls do not
- -- disturb the settings for units being analyzed at a higher level.
+ -- variables so that they can be restored on completion. This is needed
+ -- so that calls to Rtsfind start with the proper default values for
+ -- these variables, and also that such calls do not disturb the settings
+ -- for units being analyzed at a higher level.
S_Current_Sem_Unit : constant Unit_Number_Type := Current_Sem_Unit;
S_Full_Analysis : constant Boolean := Full_Analysis;
@@ -1343,12 +1348,12 @@ package body Sem is
-- context, is compiled with expansion disabled.
Save_Config_Switches : Config_Switches_Type;
- -- Variable used to save values of config switches while we analyze
- -- the new unit, to be restored on exit for proper recursive behavior.
+ -- Variable used to save values of config switches while we analyze the
+ -- new unit, to be restored on exit for proper recursive behavior.
procedure Do_Analyze;
- -- Procedure to analyze the compilation unit. This is called more
- -- than once when the high level optimizer is activated.
+ -- Procedure to analyze the compilation unit. This is called more than
+ -- once when the high level optimizer is activated.
----------------
-- Do_Analyze --
@@ -1517,6 +1522,9 @@ package body Sem is
procedure Walk_Library_Items is
type Unit_Number_Set is array (Main_Unit .. Last_Unit) of Boolean;
pragma Pack (Unit_Number_Set);
+
+ Main_CU : constant Node_Id := Cunit (Main_Unit);
+
Seen, Done : Unit_Number_Set := (others => False);
-- Seen (X) is True after we have seen unit X in the walk. This is used
-- to prevent processing the same unit more than once. Done (X) is True
@@ -1537,6 +1545,17 @@ package body Sem is
-- this unit. If it's an instance body, do the spec first. If it is
-- an instance spec, do the body last.
+ procedure Do_Withed_Unit (Withed_Unit : Node_Id);
+ -- Apply Do_Unit_And_Dependents to a unit in a context clause.
+
+ procedure Process_Bodies_In_Context (Comp : Node_Id);
+ -- The main unit and its spec may depend on bodies that contain generics
+ -- that are instantiated in them. Iterate through the corresponding
+ -- contexts before processing main (spec/body) itself, to process bodies
+ -- that may be present, together with their context. The spec of main
+ -- is processed wherever it appears in the list of units, while the body
+ -- is processed as the last unit in the list.
+
---------------
-- Do_Action --
---------------
@@ -1565,12 +1584,12 @@ package body Sem is
when N_Package_Body =>
- -- Package bodies are processed immediately after the
- -- corresponding spec.
+ -- Package bodies are processed separately if the main unit
+ -- depends on them.
null;
- when N_Subprogram_Body =>
+ when N_Subprogram_Body =>
-- A subprogram body must be the main unit
@@ -1578,14 +1597,17 @@ package body Sem is
or else CU = Cunit (Main_Unit));
null;
- -- All other cases cannot happen
-
when N_Function_Instantiation |
N_Procedure_Instantiation |
N_Package_Instantiation =>
- pragma Assert (False, "instantiation");
+
+ -- Can only happen if some generic body (needed for gnat2scil
+ -- traversal, but not by GNAT) is not available, ignore.
+
null;
+ -- All other cases cannot happen
+
when N_Subunit =>
pragma Assert (False, "subunit");
null;
@@ -1622,6 +1644,7 @@ package body Sem is
(Unit (Withed_Unit),
N_Generic_Package_Declaration,
N_Package_Body,
+ N_Package_Renaming_Declaration,
N_Subprogram_Body)
then
Write_Unit_Name
@@ -1647,12 +1670,14 @@ package body Sem is
Write_Unit_Info (Unit_Num, Item, Withs => True);
end if;
- -- Main unit should come last (except in the case where we
+ -- Main unit should come last, except in the case where we
-- skipped System_Aux_Id, in which case we missed the things it
- -- depends on).
+ -- depends on, and in the case of parent bodies if present.
pragma Assert
- (not Done (Main_Unit) or else Present (System_Aux_Id));
+ (not Done (Main_Unit)
+ or else Present (System_Aux_Id)
+ or else Nkind (Item) = N_Package_Body);
-- We shouldn't do the same thing twice
@@ -1677,38 +1702,38 @@ package body Sem is
Action (Item);
end Do_Action;
- ----------------------------
- -- Do_Unit_And_Dependents --
- ----------------------------
+ --------------------
+ -- Do_Withed_Unit --
+ --------------------
- procedure Do_Unit_And_Dependents (CU : Node_Id; Item : Node_Id) is
- Unit_Num : constant Unit_Number_Type :=
- Get_Cunit_Unit_Number (CU);
-
- procedure Do_Withed_Unit (Withed_Unit : Node_Id);
- -- Pass the buck to Do_Unit_And_Dependents
+ procedure Do_Withed_Unit (Withed_Unit : Node_Id) is
+ begin
+ Do_Unit_And_Dependents (Withed_Unit, Unit (Withed_Unit));
- --------------------
- -- Do_Withed_Unit --
- --------------------
+ -- If the unit in the with_clause is a generic instance, the clause
+ -- now denotes the instance body. Traverse the corresponding spec
+ -- because there may be no other dependence that will force the
+ -- traversal of its own context.
- procedure Do_Withed_Unit (Withed_Unit : Node_Id) is
- Save_Do_Main : constant Boolean := Do_Main;
+ if Nkind (Unit (Withed_Unit)) = N_Package_Body
+ and then Is_Generic_Instance
+ (Defining_Entity (Unit (Library_Unit (Withed_Unit))))
+ then
+ Do_Withed_Unit (Library_Unit (Withed_Unit));
+ end if;
+ end Do_Withed_Unit;
- begin
- -- Do not process the main unit if coming from a with_clause,
- -- as would happen with a parent body that has a child spec
- -- in its context.
+ ----------------------------
+ -- Do_Unit_And_Dependents --
+ ----------------------------
- Do_Main := False;
- Do_Unit_And_Dependents (Withed_Unit, Unit (Withed_Unit));
- Do_Main := Save_Do_Main;
- end Do_Withed_Unit;
+ procedure Do_Unit_And_Dependents (CU : Node_Id; Item : Node_Id) is
+ Unit_Num : constant Unit_Number_Type := Get_Cunit_Unit_Number (CU);
+ Child : Node_Id;
+ Parent_CU : Node_Id;
procedure Do_Withed_Units is new Walk_Withs (Do_Withed_Unit);
- -- Start of processing for Do_Unit_And_Dependents
-
begin
if not Seen (Unit_Num) then
@@ -1716,99 +1741,132 @@ package body Sem is
Do_Withed_Units (CU, Include_Limited => False);
- -- Process the unit if it is a spec. If it is the main unit,
- -- process it only if we have done all other units.
+ -- Process the unit if it is a spec or the the main unit, if it
+ -- has no previous spec or we have done all other units.
if not Nkind_In (Item, N_Package_Body, N_Subprogram_Body)
or else Acts_As_Spec (CU)
then
- if CU = Cunit (Main_Unit) and then not Do_Main then
+ if CU = Cunit (Main_Unit)
+ and then not Do_Main
+ then
Seen (Unit_Num) := False;
else
Seen (Unit_Num) := True;
+
+ if CU = Library_Unit (Main_CU) then
+ Process_Bodies_In_Context (CU);
+
+ -- If main is a child unit, examine context of parent
+ -- units to see if they include instantiated units.
+
+ if Is_Child_Unit (Cunit_Entity (Main_Unit)) then
+ Child := Cunit_Entity (Main_Unit);
+ while Is_Child_Unit (Child) loop
+ Parent_CU :=
+ Cunit
+ (Get_Cunit_Entity_Unit_Number (Scope (Child)));
+ Process_Bodies_In_Context (Parent_CU);
+ Child := Scope (Child);
+ end loop;
+ end if;
+ end if;
+
Do_Action (CU, Item);
Done (Unit_Num) := True;
end if;
end if;
end if;
+ end Do_Unit_And_Dependents;
- -- Process bodies. The spec, if present, has been processed already.
- -- A body appears if it is the main, or the body of a spec that is
- -- in the context of the main unit, and that is instantiated, or else
- -- contains a generic that is instantiated, or a subprogram that is
- -- or a subprogram that is inlined in the main unit.
-
- -- We exclude bodies that may appear in a circular dependency list,
- -- where spec A depends on spec B and body of B depends on spec A.
- -- This is not an elaboration issue, but body B must be excluded
- -- from the processing.
+ -------------------------------
+ -- Process_Bodies_In_Context --
+ -------------------------------
- declare
- Body_Unit : Node_Id := Empty;
- Body_Num : Unit_Number_Type;
+ procedure Process_Bodies_In_Context (Comp : Node_Id) is
+ Body_CU : Node_Id;
+ Body_U : Unit_Number_Type;
+ Clause : Node_Id;
+ Spec : Node_Id;
- function Circular_Dependence (B : Node_Id) return Boolean;
- -- Check whether this body depends on a spec that is pending,
- -- that is to say has been seen but not processed yet.
+ procedure Do_Withed_Units is new Walk_Withs (Do_Withed_Unit);
- -------------------------
- -- Circular_Dependence --
- -------------------------
+ function Depends_On_Main (CU : Node_Id) return Boolean;
+ -- The body of a unit that is withed by the spec of the main unit
+ -- may in turn have a with_clause on that spec. In that case do not
+ -- traverse the body, to prevent loops. It can also happen that the
+ -- main body as a with_clause on a child, which of course has an
+ -- implicit with on its parent. It's ok to traverse the child body
+ -- if the main spec has been processed, otherwise we also have a
+ -- circularity to avoid.
- function Circular_Dependence (B : Node_Id) return Boolean is
- Item : Node_Id;
- UN : Unit_Number_Type;
+ ---------------------
+ -- Depends_On_Main --
+ ---------------------
- begin
- Item := First (Context_Items (B));
- while Present (Item) loop
- if Nkind (Item) = N_With_Clause then
- UN := Get_Cunit_Unit_Number (Library_Unit (Item));
+ function Depends_On_Main (CU : Node_Id) return Boolean is
+ CL : Node_Id;
- if Seen (UN)
- and then not Done (UN)
- then
- return True;
- end if;
- end if;
+ begin
+ CL := First (Context_Items (CU));
- Next (Item);
- end loop;
+ -- Problem does not arise with main subprograms.
+ if Nkind (Unit (Main_CU)) /= N_Package_Body then
return False;
- end Circular_Dependence;
+ end if;
- begin
- if Nkind (Item) = N_Package_Declaration then
- Body_Unit := Library_Unit (CU);
+ while Present (CL) loop
+ if Nkind (CL) = N_With_Clause
+ and then Library_Unit (CL) = Library_Unit (Main_CU)
+ and then
+ not Done (Get_Cunit_Unit_Number (Library_Unit (CL)))
+ then
+ return True;
+ end if;
- elsif Nkind_In (Item, N_Package_Body, N_Subprogram_Body) then
- Body_Unit := CU;
- end if;
+ Next (CL);
+ end loop;
- if Present (Body_Unit)
+ return False;
+ end Depends_On_Main;
- -- Since specs and bodies are not done at the same time,
- -- guard against listing a body more than once. Bodies are
- -- only processed when the main unit is being processed,
- -- after all other units in the list. The DEC extension
- -- to System is excluded because of circularities.
+ -- Start of processing for Process_Bodies_In_Context
- and then not Seen (Get_Cunit_Unit_Number (Body_Unit))
- and then
- (No (System_Aux_Id)
- or else Unit_Num /= Get_Source_Unit (System_Aux_Id))
- and then not Circular_Dependence (Body_Unit)
- and then Do_Main
- then
- Body_Num := Get_Cunit_Unit_Number (Body_Unit);
- Seen (Body_Num) := True;
- Do_Action (Body_Unit, Unit (Body_Unit));
- Done (Body_Num) := True;
+ begin
+ Clause := First (Context_Items (Comp));
+ while Present (Clause) loop
+ if Nkind (Clause) = N_With_Clause then
+ Spec := Library_Unit (Clause);
+ Body_CU := Library_Unit (Spec);
+
+ -- If we are processing the spec of the main unit, load bodies
+ -- only if the with_clause indicates that it forced the loading
+ -- of the body for a generic instantiation.
+
+ if Present (Body_CU)
+ and then Body_CU /= Cunit (Main_Unit)
+ and then Nkind (Unit (Body_CU)) /= N_Subprogram_Body
+ and then (Nkind (Unit (Comp)) /= N_Package_Declaration
+ or else Present (Withed_Body (Clause)))
+ then
+ Body_U := Get_Cunit_Unit_Number (Body_CU);
+
+ if not Seen (Body_U)
+ and then not Depends_On_Main (Body_CU)
+ then
+ Seen (Body_U) := True;
+ Do_Withed_Units (Body_CU, Include_Limited => False);
+ Do_Action (Body_CU, Unit (Body_CU));
+ Done (Body_U) := True;
+ end if;
+ end if;
end if;
- end;
- end Do_Unit_And_Dependents;
+
+ Next (Clause);
+ end loop;
+ end Process_Bodies_In_Context;
-- Local Declarations
@@ -1848,7 +1906,7 @@ package body Sem is
end;
end loop;
- -- Now traverse compilation units in order
+ -- Now traverse compilation units (specs) in order
Cur := First_Elmt (Comp_Unit_List);
while Present (Cur) loop
@@ -1861,15 +1919,37 @@ package body Sem is
case Nkind (N) is
- -- If it's a body, ignore it. Bodies appear in the list only
- -- because of inlining/instantiations, and they are processed
- -- immediately after the corresponding specs. The main unit is
- -- processed separately after all other units.
+ -- If it is a subprogram body, process it if it has no
+ -- separate spec.
+
+ -- If it's a package body, ignore it, unless it is a body
+ -- created for an instance that is the main unit. In the case
+ -- of subprograms, the body is the wrapper package. In case of
+ -- a package, the original file carries the body, and the spec
+ -- appears as a later entry in the units list.
- when N_Package_Body | N_Subprogram_Body =>
- null;
+ -- Otherwise Bodies appear in the list only because of inlining
+ -- or instantiations, and they are processed only if relevant
+ -- to the main unit. The main unit itself is processed
+ -- separately after all other specs.
- -- It's a spec, so just do it
+ when N_Subprogram_Body =>
+ if Acts_As_Spec (N) then
+ Do_Unit_And_Dependents (CU, N);
+ end if;
+
+ when N_Package_Body =>
+ if CU = Main_CU
+ and then Nkind (Original_Node (Unit (Main_CU))) in
+ N_Generic_Instantiation
+ and then Present (Library_Unit (Main_CU))
+ then
+ Do_Unit_And_Dependents
+ (Library_Unit (Main_CU),
+ Unit (Library_Unit (Main_CU)));
+ end if;
+
+ -- It's a spec, process it, and the units it depends on
when others =>
Do_Unit_And_Dependents (CU, N);
@@ -1879,26 +1959,47 @@ package body Sem is
Next_Elmt (Cur);
end loop;
+ -- Now process package bodies on which main depends, followed by bodies
+ -- of parents, if present, and finally main itself.
+
if not Done (Main_Unit) then
Do_Main := True;
declare
- Main_CU : constant Node_Id := Cunit (Main_Unit);
+ Parent_CU : Node_Id;
+ Body_CU : Node_Id;
+ Body_U : Unit_Number_Type;
+ Child : Entity_Id;
begin
- -- If the main unit is an instantiation, the body appears before
- -- the instance spec, which is added later to the unit list. Do
- -- the spec if present, body will follow.
+ Process_Bodies_In_Context (Main_CU);
+
+ -- If the main unit is a child unit, parent bodies may be present
+ -- because they export instances or inlined subprograms. Check for
+ -- presence of these, which are not present in context clauses.
+
+ if Is_Child_Unit (Cunit_Entity (Main_Unit)) then
+ Child := Cunit_Entity (Main_Unit);
+ while Is_Child_Unit (Child) loop
+ Parent_CU :=
+ Cunit (Get_Cunit_Entity_Unit_Number (Scope (Child)));
+ Body_CU := Library_Unit (Parent_CU);
+
+ if Present (Body_CU)
+ and then not Seen (Get_Cunit_Unit_Number (Body_CU))
+ then
+ Body_U := Get_Cunit_Unit_Number (Body_CU);
+ Seen (Body_U) := True;
+ Do_Action (Body_CU, Unit (Body_CU));
+ Done (Body_U) := True;
+ end if;
- if Nkind (Original_Node (Unit (Main_CU)))
- in N_Generic_Instantiation
- and then Present (Library_Unit (Main_CU))
- then
- Do_Unit_And_Dependents
- (Library_Unit (Main_CU), Unit (Library_Unit (Main_CU)));
- else
- Do_Unit_And_Dependents (Main_CU, Unit (Main_CU));
+ Child := Scope (Child);
+ end loop;
end if;
+
+ Do_Action (Main_CU, Unit (Main_CU));
+ Done (Main_Unit) := True;
end;
end if;
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 3b0bda0753a..5ff55cec1b2 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -54,6 +54,7 @@ with Sinfo; use Sinfo;
with Snames; use Snames;
with Stringt; use Stringt;
with Stand; use Stand;
+with Style; use Style;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
@@ -1443,8 +1444,9 @@ package body Sem_Aggr is
-- a missing component association for a 1-aggregate.
if Paren_Count (Expr) > 0 then
- Error_Msg_N ("\if single-component aggregate is intended,"
- & " write e.g. (1 ='> ...)", Expr);
+ Error_Msg_N
+ ("\if single-component aggregate is intended,"
+ & " write e.g. (1 ='> ...)", Expr);
end if;
return Failure;
end if;
@@ -1798,8 +1800,8 @@ package body Sem_Aggr is
elsif Is_Tagged_Type (Etype (Expression (Assoc))) then
Check_Dynamically_Tagged_Expression
- (Expr => Expression (Assoc),
- Typ => Component_Type (Etype (N)),
+ (Expr => Expression (Assoc),
+ Typ => Component_Type (Etype (N)),
Related_Nod => N);
end if;
@@ -2288,6 +2290,18 @@ package body Sem_Aggr is
then
A_Type := Etype (Imm_Type);
return True;
+
+ -- The parent type may be a private extension. The aggregate is
+ -- legal if the type of the aggregate is an extension of it that
+ -- is not a private extension.
+
+ elsif Is_Private_Type (A_Type)
+ and then not Is_Private_Type (Imm_Type)
+ and then Present (Full_View (A_Type))
+ and then Base_Type (Full_View (A_Type)) = Etype (Imm_Type)
+ then
+ return True;
+
else
Imm_Type := Etype (Base_Type (Imm_Type));
end if;
@@ -2488,21 +2502,24 @@ package body Sem_Aggr is
-- whose value may already have been specified by N's ancestor part.
-- This routine checks whether this is indeed the case and if so returns
-- False, signaling that no value for Discr should appear in N's
- -- aggregate part. Also, in this case, the routine appends
- -- New_Assoc_List Discr the discriminant value specified in the ancestor
- -- part.
- -- Can't parse previous sentence, appends what where???
+ -- aggregate part. Also, in this case, the routine appends to
+ -- New_Assoc_List the discriminant value specified in the ancestor part.
+ --
+ -- If the aggregate is in a context with expansion delayed, it will be
+ -- reanalyzed. The inherited discriminant values must not be reinserted
+ -- in the component list to prevent spurious errors, but they must be
+ -- present on first analysis to build the proper subtype indications.
+ -- The flag Inherited_Discriminant is used to prevent the re-insertion.
function Get_Value
(Compon : Node_Id;
From : List_Id;
Consider_Others_Choice : Boolean := False)
return Node_Id;
- -- Given a record component stored in parameter Compon, the following
- -- function returns its value as it appears in the list From, which is
- -- a list of N_Component_Association nodes.
- -- What is this referring to??? There is no "following function" in
- -- sight???
+ -- Given a record component stored in parameter Compon, this function
+ -- returns its value as it appears in the list From, which is a list
+ -- of N_Component_Association nodes.
+ --
-- If no component association has a choice for the searched component,
-- the value provided by the others choice is returned, if there is one,
-- and Consider_Others_Choice is set to true. Otherwise Empty is
@@ -2556,6 +2573,7 @@ package body Sem_Aggr is
Loc : Source_Ptr;
Ancestor : Node_Id;
+ Comp_Assoc : Node_Id;
Discr_Expr : Node_Id;
Ancestor_Typ : Entity_Id;
@@ -2570,6 +2588,21 @@ package body Sem_Aggr is
return True;
end if;
+ -- Check whether inherited discriminant values have already been
+ -- inserted in the aggregate. This will be the case if we are
+ -- re-analyzing an aggregate whose expansion was delayed.
+
+ if Present (Component_Associations (N)) then
+ Comp_Assoc := First (Component_Associations (N));
+ while Present (Comp_Assoc) loop
+ if Inherited_Discriminant (Comp_Assoc) then
+ return True;
+ end if;
+
+ Next (Comp_Assoc);
+ end loop;
+ end if;
+
Ancestor := Ancestor_Part (N);
Ancestor_Typ := Etype (Ancestor);
Loc := Sloc (Ancestor);
@@ -2627,6 +2660,7 @@ package body Sem_Aggr is
end if;
Resolve_Aggr_Expr (Discr_Expr, Discr);
+ Set_Inherited_Discriminant (Last (New_Assoc_List));
return False;
end if;
@@ -2991,13 +3025,15 @@ package body Sem_Aggr is
if Selector_Name /= First (Choices (Assoc))
or else Present (Next (Selector_Name))
then
- Error_Msg_N ("OTHERS must appear alone in a choice list",
- Selector_Name);
+ Error_Msg_N
+ ("OTHERS must appear alone in a choice list",
+ Selector_Name);
return;
elsif Present (Next (Assoc)) then
- Error_Msg_N ("OTHERS must appear last in an aggregate",
- Selector_Name);
+ Error_Msg_N
+ ("OTHERS must appear last in an aggregate",
+ Selector_Name);
return;
-- (Ada2005): If this is an association with a box,
@@ -3213,18 +3249,17 @@ package body Sem_Aggr is
Error_Msg_NE
("type of aggregate has private ancestor&!",
N, Root_Typ);
- Error_Msg_N ("must use extension aggregate!", N);
+ Error_Msg_N ("must use extension aggregate!", N);
return;
end if;
Dnode := Declaration_Node (Base_Type (Root_Typ));
- -- If we don't get a full declaration, then we have some
- -- error which will get signalled later so skip this part.
- -- Otherwise, gather components of root that apply to the
- -- aggregate type. We use the base type in case there is an
- -- applicable stored constraint that renames the discriminants
- -- of the root.
+ -- If we don't get a full declaration, then we have some error
+ -- which will get signalled later so skip this part. Otherwise
+ -- gather components of root that apply to the aggregate type.
+ -- We use the base type in case there is an applicable stored
+ -- constraint that renames the discriminants of the root.
if Nkind (Dnode) = N_Full_Type_Declaration then
Record_Def := Type_Definition (Dnode);
@@ -3259,6 +3294,15 @@ package body Sem_Aggr is
Ancestor_Part (N), Parent_Typ);
return;
end if;
+
+ -- The current view of ancestor part may be a private type,
+ -- while the context type is always non-private.
+
+ elsif Is_Private_Type (Root_Typ)
+ and then Present (Full_View (Root_Typ))
+ and then Nkind (N) = N_Extension_Aggregate
+ then
+ exit when Base_Type (Full_View (Root_Typ)) = Parent_Typ;
end if;
end loop;
@@ -3460,8 +3504,8 @@ package body Sem_Aggr is
-- subaggregate is needed.
Capture_Discriminants : declare
- Loc : constant Source_Ptr := Sloc (N);
- Expr : Node_Id;
+ Loc : constant Source_Ptr := Sloc (N);
+ Expr : Node_Id;
procedure Add_Discriminant_Values
(New_Aggr : Node_Id;
@@ -3567,7 +3611,6 @@ package body Sem_Aggr is
New_Aggr : Node_Id;
begin
-
Inner_Comp := First_Component (Etype (Comp));
while Present (Inner_Comp) loop
Comp_Type := Etype (Inner_Comp);
@@ -3580,7 +3623,7 @@ package body Sem_Aggr is
Set_Etype (New_Aggr, Comp_Type);
Add_Association
(Inner_Comp, New_Aggr,
- Component_Associations (Aggr));
+ Component_Associations (Aggr));
-- Collect discriminant values and recurse
@@ -3630,7 +3673,7 @@ package body Sem_Aggr is
else
declare
- Comp : Entity_Id;
+ Comp : Entity_Id;
begin
-- If the type has additional components, create
@@ -3737,7 +3780,15 @@ package body Sem_Aggr is
New_Assoc := First (New_Assoc_List);
while Present (New_Assoc) loop
Component := First (Choices (New_Assoc));
- exit when Chars (Selectr) = Chars (Component);
+
+ if Chars (Selectr) = Chars (Component) then
+ if Style_Check then
+ Check_Identifier (Selectr, Entity (Component));
+ end if;
+
+ exit;
+ end if;
+
Next (New_Assoc);
end loop;
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index e37b216ca45..8b5fd1313da 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -136,6 +136,7 @@ package body Sem_Attr is
Attribute_05 : constant Attribute_Class_Array := Attribute_Class_Array'(
Attribute_Machine_Rounding |
+ Attribute_Mod |
Attribute_Priority |
Attribute_Stream_Size |
Attribute_Wide_Wide_Width => True,
@@ -2384,8 +2385,8 @@ package body Sem_Attr is
and then Base_Type (Typ) = Typ
and then Warn_On_Redundant_Constructs
then
- Error_Msg_NE
- ("?redundant attribute, & is its own base type", N, Typ);
+ Error_Msg_NE -- CODEFIX
+ ("?redundant attribute, & is its own base type", N, Typ);
end if;
Set_Etype (N, Base_Type (Entity (P)));
@@ -2775,10 +2776,8 @@ package body Sem_Attr is
exit;
elsif Ekind (Scope (Ent)) in Task_Kind
- and then Ekind (S) /= E_Loop
- and then Ekind (S) /= E_Block
- and then Ekind (S) /= E_Entry
- and then Ekind (S) /= E_Entry_Family
+ and then
+ not Ekind_In (S, E_Loop, E_Block, E_Entry, E_Entry_Family)
then
Error_Attr ("Attribute % cannot appear in inner unit", N);
@@ -3546,13 +3545,9 @@ package body Sem_Attr is
----------------------
procedure Must_Be_Imported (Proc_Ent : Entity_Id) is
- Pent : Entity_Id := Proc_Ent;
+ Pent : constant Entity_Id := Ultimate_Alias (Proc_Ent);
begin
- while Present (Alias (Pent)) loop
- Pent := Alias (Pent);
- end loop;
-
-- Ignore check if procedure not frozen yet (we will get
-- another chance when the default parameter is reanalyzed)
@@ -3654,6 +3649,7 @@ package body Sem_Attr is
function Process (N : Node_Id) return Traverse_Result is
begin
if Is_Entity_Name (N)
+ and then Present (Entity (N))
and then not Is_Formal (Entity (N))
and then Enclosing_Subprogram (Entity (N)) = Subp
then
@@ -4809,9 +4805,11 @@ package body Sem_Attr is
-- processing, since otherwise gigi might see an attribute which it is
-- unprepared to deal with.
- function Aft_Value return Nat;
- -- Computes Aft value for current attribute prefix (used by Aft itself
- -- and also by Width for computing the Width of a fixed point type).
+ procedure Check_Concurrent_Discriminant (Bound : Node_Id);
+ -- If Bound is a reference to a discriminant of a task or protected type
+ -- occurring within the object's body, rewrite attribute reference into
+ -- a reference to the corresponding discriminal. Use for the expansion
+ -- of checks against bounds of entry family index subtypes.
procedure Check_Expressions;
-- In case where the attribute is not foldable, the expressions, if
@@ -4878,24 +4876,33 @@ package body Sem_Attr is
-- Verify that the prefix of a potentially static array attribute
-- satisfies the conditions of 4.9 (14).
- ---------------
- -- Aft_Value --
- ---------------
+ -----------------------------------
+ -- Check_Concurrent_Discriminant --
+ -----------------------------------
- function Aft_Value return Nat is
- Result : Nat;
- Delta_Val : Ureal;
+ procedure Check_Concurrent_Discriminant (Bound : Node_Id) is
+ Tsk : Entity_Id;
+ -- The concurrent (task or protected) type
begin
- Result := 1;
- Delta_Val := Delta_Value (P_Type);
- while Delta_Val < Ureal_Tenth loop
- Delta_Val := Delta_Val * Ureal_10;
- Result := Result + 1;
- end loop;
+ if Nkind (Bound) = N_Identifier
+ and then Ekind (Entity (Bound)) = E_Discriminant
+ and then Is_Concurrent_Record_Type (Scope (Entity (Bound)))
+ then
+ Tsk := Corresponding_Concurrent_Type (Scope (Entity (Bound)));
- return Result;
- end Aft_Value;
+ if In_Open_Scopes (Tsk) and then Has_Completion (Tsk) then
+
+ -- Find discriminant of original concurrent type, and use
+ -- its current discriminal, which is the renaming within
+ -- the task/protected body.
+
+ Rewrite (N,
+ New_Occurrence_Of
+ (Find_Body_Discriminal (Entity (Bound)), Loc));
+ end if;
+ end if;
+ end Check_Concurrent_Discriminant;
-----------------------
-- Check_Expressions --
@@ -5626,10 +5633,10 @@ package body Sem_Attr is
while Present (N) loop
Static := Static and then Is_Static_Subtype (Etype (N));
- -- If however the index type is generic, attributes cannot
- -- be folded.
+ -- If however the index type is generic, or derived from
+ -- one, attributes cannot be folded.
- if Is_Generic_Type (Etype (N))
+ if Is_Generic_Type (Root_Type (Etype (N)))
and then Id /= Attribute_Component_Size
then
return;
@@ -5756,7 +5763,7 @@ package body Sem_Attr is
---------
when Attribute_Aft =>
- Fold_Uint (N, UI_From_Int (Aft_Value), True);
+ Fold_Uint (N, Aft_Value (P_Type), True);
---------------
-- Alignment --
@@ -5984,6 +5991,9 @@ package body Sem_Attr is
else
Fold_Uint (N, Expr_Value (Lo_Bound), Static);
end if;
+
+ else
+ Check_Concurrent_Discriminant (Lo_Bound);
end if;
end First_Attr;
@@ -6172,6 +6182,9 @@ package body Sem_Attr is
else
Fold_Uint (N, Expr_Value (Hi_Bound), Static);
end if;
+
+ else
+ Check_Concurrent_Discriminant (Hi_Bound);
end if;
end Last;
@@ -6192,13 +6205,13 @@ package body Sem_Attr is
Ind : Node_Id;
begin
- -- In the case of a generic index type, the bounds may appear static
- -- but the computation is not meaningful in this case, and may
- -- generate a spurious warning.
+ -- If any index type is a formal type, or derived from one, the
+ -- bounds are not static. Treating them as static can produce
+ -- spurious warnings or improper constant folding.
Ind := First_Index (P_Type);
while Present (Ind) loop
- if Is_Generic_Type (Etype (Ind)) then
+ if Is_Generic_Type (Root_Type (Etype (Ind))) then
return;
end if;
@@ -7328,7 +7341,8 @@ package body Sem_Attr is
-- For fixed-point type width is Fore + 1 + Aft (RM 3.5(34))
Fold_Uint
- (N, UI_From_Int (Fore_Value + 1 + Aft_Value), True);
+ (N, UI_From_Int (Fore_Value + 1) + Aft_Value (P_Type),
+ True);
end if;
-- Discrete types
@@ -7645,8 +7659,7 @@ 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 ("?non-local pointer cannot point to local object", P);
Error_Msg_F
("\?Program_Error will be raised at run time", P);
Rewrite (N,
@@ -7656,8 +7669,7 @@ package body Sem_Attr is
return;
else
- Error_Msg_F
- ("non-local pointer cannot point to local object", P);
+ Error_Msg_F ("non-local pointer cannot point to local object", P);
-- Check for case where we have a missing access definition
@@ -7813,11 +7825,9 @@ package body Sem_Attr is
-- also be accessibility checks on those, this is where the
-- checks can eventually be centralized ???
- if Ekind (Btyp) = E_Access_Subprogram_Type
- or else
- Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type
- or else
- Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type
+ if Ekind_In (Btyp, E_Access_Subprogram_Type,
+ E_Anonymous_Access_Subprogram_Type,
+ E_Anonymous_Access_Protected_Subprogram_Type)
then
-- Deal with convention mismatch
@@ -8244,9 +8254,8 @@ package body Sem_Attr is
end if;
end if;
- if Ekind (Btyp) = E_Access_Protected_Subprogram_Type
- or else
- Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type
+ if Ekind_In (Btyp, E_Access_Protected_Subprogram_Type,
+ E_Anonymous_Access_Protected_Subprogram_Type)
then
if Is_Entity_Name (P)
and then not Is_Protected_Type (Scope (Entity (P)))
@@ -8268,9 +8277,8 @@ package body Sem_Attr is
return;
end if;
- elsif (Ekind (Btyp) = E_Access_Subprogram_Type
- or else
- Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type)
+ elsif Ekind_In (Btyp, E_Access_Subprogram_Type,
+ E_Anonymous_Access_Subprogram_Type)
and then Ekind (Etype (N)) = E_Access_Protected_Subprogram_Type
then
Error_Msg_F ("context requires a non-protected subprogram", P);
diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb
index c1b3a331892..99bec9b72da 100755
--- a/gcc/ada/sem_aux.adb
+++ b/gcc/ada/sem_aux.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -312,8 +312,8 @@ package body Sem_Aux is
Ent : Entity_Id;
begin
- -- If the base type has no freeze node, it is a type in Standard,
- -- and always acts as its own first subtype unless it is one of the
+ -- If the base type has no freeze node, it is a type in Standard, and
+ -- always acts as its own first subtype, except where it is one of the
-- predefined integer types. If the type is formal, it is also a first
-- subtype, and its base type has no freeze node. On the other hand, a
-- subtype of a generic formal is not its own first subtype. Its base
@@ -321,7 +321,6 @@ package body Sem_Aux is
-- the first subtype is obtained.
if No (F) then
-
if B = Base_Type (Standard_Integer) then
return Standard_Integer;
@@ -800,4 +799,20 @@ package body Sem_Aux is
Obsolescent_Warnings.Tree_Write;
end Tree_Write;
+ --------------------
+ -- Ultimate_Alias --
+ --------------------
+
+ function Ultimate_Alias (Prim : Entity_Id) return Entity_Id is
+ E : Entity_Id := Prim;
+
+ begin
+ while Present (Alias (E)) loop
+ pragma Assert (Alias (E) /= E);
+ E := Alias (E);
+ end loop;
+
+ return E;
+ end Ultimate_Alias;
+
end Sem_Aux;
diff --git a/gcc/ada/sem_aux.ads b/gcc/ada/sem_aux.ads
index 464a764a3e3..8b763e05240 100755
--- a/gcc/ada/sem_aux.ads
+++ b/gcc/ada/sem_aux.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -193,4 +193,9 @@ package Sem_Aux is
function Number_Discriminants (Typ : Entity_Id) return Pos;
-- Typ is a type with discriminants, yields number of discriminants in type
+ function Ultimate_Alias (Prim : Entity_Id) return Entity_Id;
+ pragma Inline (Ultimate_Alias);
+ -- Return the last entity in the chain of aliased entities of Prim. If Prim
+ -- has no alias return Prim.
+
end Sem_Aux;
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
index da260f35c4a..fc8806a036f 100644
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2010, 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- --
diff --git a/gcc/ada/sem_case.ads b/gcc/ada/sem_case.ads
index dcc72931551..78ae7c61b3b 100644
--- a/gcc/ada/sem_case.ads
+++ b/gcc/ada/sem_case.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2010, 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- --
@@ -68,7 +68,7 @@ package Sem_Case is
-- Processing to carry out for a non static Choice
with procedure Process_Associated_Node (A : Node_Id);
- -- Associated to each case alternative, aggregate component
+ -- Associated with each case alternative, aggregate component
-- association or record variant A there is a node or list of nodes
-- that need semantic processing. This routine implements that
-- processing.
@@ -76,9 +76,9 @@ package Sem_Case is
package Generic_Choices_Processing is
function Number_Of_Choices (N : Node_Id) return Nat;
- -- Iterates through the choices of N, (N can be a case statement,
- -- array aggregate or record variant), counting all the Choice nodes
- -- except for the Others choice.
+ -- Iterates through the choices of N, (N can be a case expression, case
+ -- statement, array aggregate or record variant), counting all the
+ -- Choice nodes except for the Others choice.
procedure Analyze_Choices
(N : Node_Id;
@@ -87,10 +87,10 @@ package Sem_Case is
Last_Choice : out Nat;
Raises_CE : out Boolean;
Others_Present : out Boolean);
- -- From a case statement, array aggregate or record variant N, this
- -- routine analyzes the corresponding list of discrete choices.
- -- Subtyp is the subtype of the discrete choices. The type against
- -- which the discrete choices must be resolved is its base type.
+ -- From a case expression, case statement, array aggregate or record
+ -- variant N, this routine analyzes the corresponding list of discrete
+ -- choices. Subtyp is the subtype of the discrete choices. The type
+ -- against which the discrete choices must be resolved is its base type.
--
-- On entry Choice_Table must be big enough to contain all the discrete
-- choices encountered. The lower bound of Choice_Table must be one.
diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
index c8d06e8cfec..1f4ed1069f6 100644
--- a/gcc/ada/sem_cat.adb
+++ b/gcc/ada/sem_cat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -78,12 +78,12 @@ package body Sem_Cat is
function In_RCI_Declaration (N : Node_Id) return Boolean;
-- Determines if a declaration is within the visible part of a Remote
- -- Call Interface compilation unit, for semantic checking purposes only,
+ -- Call Interface compilation unit, for semantic checking purposes only
-- (returns false within an instance and within the package body).
function In_RT_Declaration return Boolean;
- -- Determines if current scope is within a Remote Types compilation unit,
- -- for semantic checking purposes.
+ -- Determines if current scope is within the declaration of a Remote Types
+ -- unit, for semantic checking purposes.
function Is_Non_Remote_Access_Type (E : Entity_Id) return Boolean;
-- Returns true if the entity is a type whose full view is a non-remote
@@ -1061,28 +1061,25 @@ package body Sem_Cat is
-- Exclude generic specs from the checks (this will get rechecked
-- on instantiations).
- if Inside_A_Generic
- and then No (Enclosing_Generic_Body (Id))
- then
+ if Inside_A_Generic and then No (Enclosing_Generic_Body (Id)) then
return;
end if;
- -- Required checks for declaration that is in a preelaborated
- -- package and is not within some subprogram.
+ -- Required checks for declaration that is in a preelaborated package
+ -- and is not within some subprogram.
if In_Preelaborated_Unit
and then not In_Subprogram_Or_Concurrent_Unit
then
-- Check for default initialized variable case. Note that in
- -- accordance with (RM B.1(24)) imported objects are not
- -- subject to default initialization.
+ -- accordance with (RM B.1(24)) imported objects are not subject to
+ -- default initialization.
-- If the initialization does not come from source and is an
-- aggregate, it is a static initialization that replaces an
-- implicit call, and must be treated as such.
if Present (E)
- and then
- (Comes_From_Source (E) or else Nkind (E) /= N_Aggregate)
+ and then (Comes_From_Source (E) or else Nkind (E) /= N_Aggregate)
then
null;
@@ -1210,13 +1207,8 @@ package body Sem_Cat is
elsif Nkind (Odf) = N_Subtype_Indication then
Ent := Etype (Subtype_Mark (Odf));
- elsif
- Nkind (Odf) = N_Constrained_Array_Definition
- then
+ elsif Nkind (Odf) = N_Constrained_Array_Definition then
Ent := Component_Type (T);
-
- -- else
- -- return;
end if;
if Is_Task_Type (Ent)
@@ -1230,9 +1222,9 @@ package body Sem_Cat is
end;
end if;
- -- Non-static discriminant not allowed in preelaborated unit
- -- Controlled object of a type with a user-defined Initialize
- -- is forbidden as well.
+ -- Non-static discriminants not allowed in preelaborated unit.
+ -- Objects of a controlled type with a user-defined Initialize
+ -- are forbidden as well.
if Is_Record_Type (Etype (Id)) then
declare
@@ -1248,7 +1240,7 @@ package body Sem_Cat is
if Nkind (PEE) = N_Full_Type_Declaration
and then not Static_Discriminant_Expr
- (Discriminant_Specifications (PEE))
+ (Discriminant_Specifications (PEE))
then
Error_Msg_N
("non-static discriminant in preelaborated unit",
@@ -1270,23 +1262,21 @@ package body Sem_Cat is
-- except within a subprogram, generic subprogram, task unit, or
-- protected unit (RM 10.2.1(16)).
- if In_Pure_Unit
- and then not In_Subprogram_Task_Protected_Unit
- then
+ if In_Pure_Unit and then not In_Subprogram_Task_Protected_Unit then
Error_Msg_N ("declaration of variable not allowed in pure unit", N);
-- The visible part of an RCI library unit must not contain the
-- declaration of a variable (RM E.1.3(9))
elsif In_RCI_Declaration (N) then
- Error_Msg_N ("declaration of variable not allowed in rci unit", N);
+ Error_Msg_N ("visible variable not allowed in 'R'C'I unit", N);
-- The visible part of a Shared Passive library unit must not contain
-- the declaration of a variable (RM E.2.2(7))
- elsif In_RT_Declaration then
+ elsif In_RT_Declaration and then not In_Private_Part (Id) then
Error_Msg_N
- ("variable declaration not allowed in remote types unit", N);
+ ("visible variable not allowed in remote types unit", N);
end if;
end Validate_Object_Declaration;
@@ -1397,8 +1387,8 @@ package body Sem_Cat is
null;
- elsif Ekind (Param_Type) = E_Anonymous_Access_Type
- or else Ekind (Param_Type) = E_Anonymous_Access_Subprogram_Type
+ elsif Ekind_In (Param_Type, E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
then
-- From RM E.2.2(14), no anonymous access parameter other than
-- controlling ones may be used (because an anonymous access
@@ -1454,9 +1444,9 @@ package body Sem_Cat is
("limited type not allowed in rci unit", Parent (E));
Explain_Limited_Type (E, Parent (E));
- elsif Ekind (E) = E_Generic_Function
- or else Ekind (E) = E_Generic_Package
- or else Ekind (E) = E_Generic_Procedure
+ elsif Ekind_In (E, E_Generic_Function,
+ E_Generic_Package,
+ E_Generic_Procedure)
then
Error_Msg_N ("generic declaration not allowed in rci unit",
Parent (E));
@@ -1551,7 +1541,6 @@ package body Sem_Cat is
Type_Decl := Parent (Param_Type);
if Ekind (Param_Type) = E_Anonymous_Access_Type then
-
if K = N_Subprogram_Declaration then
Error_Node := Param_Spec;
end if;
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 8a53d5891b6..1ce76e89c25 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -552,7 +552,8 @@ package body Sem_Ch10 is
or else
Used_In_Spec)
then
- Error_Msg_N ("?redundant with clause in body", Clause);
+ Error_Msg_N -- CODEFIX
+ ("?redundant with clause in body", Clause);
end if;
Used_In_Body := False;
@@ -580,7 +581,8 @@ package body Sem_Ch10 is
Exit_On_Self => True);
if Withed then
- Error_Msg_N ("?redundant with clause", Clause);
+ Error_Msg_N -- CODEFIX
+ ("?redundant with clause", Clause);
end if;
end;
end if;
@@ -690,8 +692,7 @@ package body Sem_Ch10 is
end if;
if Circularity then
- Error_Msg_N
- ("circular dependency caused by with_clauses", N);
+ Error_Msg_N ("circular dependency caused by with_clauses", N);
Error_Msg_N
("\possibly missing limited_with clause"
& " in one of the following", N);
@@ -2139,6 +2140,19 @@ package body Sem_Ch10 is
-- Start of processing for Analyze_Subunit
begin
+ if Style_Check then
+ declare
+ Nam : Node_Id := Name (Unit (N));
+
+ begin
+ if Nkind (Nam) = N_Selected_Component then
+ Nam := Selector_Name (Nam);
+ end if;
+
+ Check_Identifier (Nam, Par_Unit);
+ end;
+ end if;
+
if not Is_Empty_List (Context_Items (N)) then
-- Save current use clauses
@@ -2207,7 +2221,6 @@ package body Sem_Ch10 is
if Present (Enclosing_Child) then
Install_Siblings (Enclosing_Child, N);
end if;
-
end if;
Analyze (Proper_Body (Unit (N)));
@@ -3373,6 +3386,11 @@ package body Sem_Ch10 is
-- units. The shadow entities are created when the inserted clause is
-- analyzed. Implements Ada 2005 (AI-50217).
+ function Is_Ancestor_Unit (U1 : Node_Id; U2 : Node_Id) return Boolean;
+ -- When compiling a unit Q descended from some parent unit P, a limited
+ -- with_clause in the context of P that names some other ancestor of Q
+ -- must not be installed because the ancestor is immediately visible.
+
---------------------
-- Check_Renamings --
---------------------
@@ -3645,6 +3663,22 @@ package body Sem_Ch10 is
New_Nodes_OK := New_Nodes_OK - 1;
end Expand_Limited_With_Clause;
+ ----------------------
+ -- Is_Ancestor_Unit --
+ ----------------------
+
+ function Is_Ancestor_Unit (U1 : Node_Id; U2 : Node_Id) return Boolean is
+ E1 : constant Entity_Id := Defining_Entity (Unit (U1));
+ E2 : Entity_Id;
+ begin
+ if Nkind_In (Unit (U2), N_Package_Body, N_Subprogram_Body) then
+ E2 := Defining_Entity (Unit (Library_Unit (U2)));
+ return Is_Ancestor_Package (E1, E2);
+ else
+ return False;
+ end if;
+ end Is_Ancestor_Unit;
+
-- Start of processing for Install_Limited_Context_Clauses
begin
@@ -3678,6 +3712,9 @@ package body Sem_Ch10 is
if Library_Unit (Item) /= Cunit (Current_Sem_Unit)
and then not Limited_View_Installed (Item)
+ and then
+ not Is_Ancestor_Unit
+ (Library_Unit (Item), Cunit (Current_Sem_Unit))
then
if not Private_Present (Item)
or else Private_Present (N)
@@ -4013,7 +4050,8 @@ package body Sem_Ch10 is
function In_Context return Boolean;
-- Scan context of current unit, to check whether there is
-- a with_clause on the same unit as a private with-clause
- -- on a parent, in which case child unit is visible.
+ -- on a parent, in which case child unit is visible. If the
+ -- unit is a grand-child, the same applies to its parent.
----------------
-- In_Context --
@@ -4027,10 +4065,15 @@ package body Sem_Ch10 is
if Nkind (Clause) = N_With_Clause
and then Comes_From_Source (Clause)
and then Is_Entity_Name (Name (Clause))
- and then Entity (Name (Clause)) = Id
and then not Private_Present (Clause)
then
- return True;
+ if Entity (Name (Clause)) = Id
+ or else
+ (Nkind (Name (Clause)) = N_Expanded_Name
+ and then Entity (Prefix (Name (Clause))) = Id)
+ then
+ return True;
+ end if;
end if;
Next (Clause);
@@ -5346,7 +5389,7 @@ package body Sem_Ch10 is
-- and the full-view.
if No (Class_Wide_Type (T)) then
- CW := Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
+ CW := Make_Temporary (Loc, 'S');
-- Set parent to be the same as the parent of the tagged type.
-- We need a parent field set, and it is supposed to point to
@@ -5398,9 +5441,7 @@ package body Sem_Ch10 is
Sloc_Value : Source_Ptr;
Id_Char : Character) return Entity_Id
is
- E : constant Entity_Id :=
- Make_Defining_Identifier (Sloc_Value,
- Chars => New_Internal_Name (Id_Char));
+ E : constant Entity_Id := Make_Temporary (Sloc_Value, Id_Char);
begin
Set_Ekind (E, Kind);
@@ -5475,9 +5516,7 @@ package body Sem_Ch10 is
-- Build the header of the limited_view
- Lim_Header :=
- Make_Defining_Identifier (Sloc (N),
- Chars => New_Internal_Name (Id_Char => 'Z'));
+ Lim_Header := Make_Temporary (Sloc (N), 'Z');
Set_Ekind (Lim_Header, E_Package);
Set_Is_Internal (Lim_Header);
Set_Limited_View (P, Lim_Header);
@@ -5535,9 +5574,7 @@ package body Sem_Ch10 is
then
return True;
- elsif Ekind (E) = E_Generic_Function
- or else Ekind (E) = E_Generic_Procedure
- then
+ elsif Ekind_In (E, E_Generic_Function, E_Generic_Procedure) then
return True;
elsif Ekind (E) = E_Generic_Package
@@ -5578,10 +5615,7 @@ package body Sem_Ch10 is
then
Set_Body_Needed_For_SAL (Unit_Name);
- elsif Ekind (Unit_Name) = E_Generic_Procedure
- or else
- Ekind (Unit_Name) = E_Generic_Function
- then
+ elsif Ekind_In (Unit_Name, E_Generic_Procedure, E_Generic_Function) then
Set_Body_Needed_For_SAL (Unit_Name);
elsif Is_Subprogram (Unit_Name)
@@ -5927,9 +5961,9 @@ package body Sem_Ch10 is
if Nkind (Item) = N_With_Clause
and then Private_Present (Item)
then
- -- If private_with_clause is redundant, remove it from
- -- context, as a small optimization to subsequent handling
- -- of private_with clauses in other nested packages..
+ -- If private_with_clause is redundant, remove it from context,
+ -- as a small optimization to subsequent handling of private_with
+ -- clauses in other nested packages.
if In_Regular_With_Clause (Entity (Name (Item))) then
declare
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index d54c6f8a04f..cd6c10ba573 100644
--- a/gcc/ada/sem_ch11.adb
+++ b/gcc/ada/sem_ch11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 174811bb81a..a2009c2b66e 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -475,6 +475,12 @@ package body Sem_Ch12 is
-- of generic formals of a generic package declared with a box or with
-- partial parametrization.
+ procedure Mark_Context (Inst_Decl : Node_Id; Gen_Decl : Node_Id);
+ -- If the generic unit comes from a different unit, indicate that the
+ -- unit that contains the instance depends on the body that contains
+ -- the generic body. Used to determine a more precise dependency graph
+ -- for use by CodePeer.
+
procedure Set_Instance_Env
(Gen_Unit : Entity_Id;
Act_Unit : Entity_Id);
@@ -2408,8 +2414,8 @@ package body Sem_Ch12 is
end if;
elsif Nkind (Prefix (Def)) = N_Selected_Component then
- if Ekind (Entity (Selector_Name (Prefix (Def))))
- /= E_Entry_Family
+ if Ekind (Entity (Selector_Name (Prefix (Def)))) /=
+ E_Entry_Family
then
Error_Msg_N ("expect valid subprogram name as default", Def);
end if;
@@ -2592,7 +2598,7 @@ package body Sem_Ch12 is
then
Error_Msg_N ("premature usage of incomplete type", Def);
- elsif Is_Internal (Designated_Type (T)) then
+ elsif not Is_Entity_Name (Subtype_Indication (Def)) then
Error_Msg_N
("only a subtype mark is allowed in a formal", Def);
end if;
@@ -3231,7 +3237,8 @@ package body Sem_Ch12 is
or else Enclosing_Body_Present
or else Present (Corresponding_Body (Gen_Decl)))
and then (Is_In_Main_Unit (N)
- or else Might_Inline_Subp)
+ or else Might_Inline_Subp
+ or else CodePeer_Mode)
and then not Is_Actual_Pack
and then not Inline_Now
and then (Operating_Mode = Generate_Code
@@ -3387,7 +3394,8 @@ package body Sem_Ch12 is
Expander_Status => Expander_Active,
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
- Local_Suppress_Stack_Top => Local_Suppress_Stack_Top));
+ Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
+ Version => Ada_Version));
end if;
end if;
@@ -3694,7 +3702,8 @@ package body Sem_Ch12 is
Expander_Status => Expander_Active,
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
- Local_Suppress_Stack_Top => Local_Suppress_Stack_Top)),
+ Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
+ Version => Ada_Version)),
Inlined_Body => True);
Pop_Scope;
@@ -3809,7 +3818,8 @@ package body Sem_Ch12 is
Expander_Status => Expander_Active,
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
- Local_Suppress_Stack_Top => Local_Suppress_Stack_Top)),
+ Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
+ Version => Ada_Version)),
Inlined_Body => True);
end if;
end Inline_Instance_Body;
@@ -3848,7 +3858,8 @@ package body Sem_Ch12 is
Expander_Status => Expander_Active,
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
- Local_Suppress_Stack_Top => Local_Suppress_Stack_Top));
+ Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
+ Version => Ada_Version));
return True;
else
return False;
@@ -3999,11 +4010,14 @@ package body Sem_Ch12 is
-- If the instance is a child unit, mark the Id accordingly. Mark
-- the anonymous entity as well, which is the real subprogram and
-- which is used when the instance appears in a context clause.
+ -- Similarly, propagate the Is_Eliminated flag to handle properly
+ -- nested eliminated subprograms.
Set_Is_Child_Unit (Act_Decl_Id, Is_Child_Unit (Defining_Entity (N)));
Set_Is_Child_Unit (Anon_Id, Is_Child_Unit (Defining_Entity (N)));
New_Overloaded_Entity (Act_Decl_Id);
Check_Eliminated (Act_Decl_Id);
+ Set_Is_Eliminated (Anon_Id, Is_Eliminated (Act_Decl_Id));
-- In compilation unit case, kill elaboration checks on the
-- instantiation, since they are never needed -- the body is
@@ -4072,9 +4086,7 @@ package body Sem_Ch12 is
-- Verify that it is a generic subprogram of the right kind, and that
-- it does not lead to a circular instantiation.
- if Ekind (Gen_Unit) /= E_Generic_Procedure
- and then Ekind (Gen_Unit) /= E_Generic_Function
- then
+ if not Ekind_In (Gen_Unit, E_Generic_Procedure, E_Generic_Function) then
Error_Msg_N ("expect generic subprogram in instantiation", Gen_Id);
elsif In_Open_Scopes (Gen_Unit) then
@@ -4223,7 +4235,8 @@ package body Sem_Ch12 is
then
Error_Msg_NE ("access parameter& is controlling,",
N, Formal);
- Error_Msg_NE ("\corresponding parameter of & must be"
+ Error_Msg_NE
+ ("\corresponding parameter of & must be"
& " explicitly null-excluding", N, Gen_Id);
end if;
@@ -4848,8 +4861,13 @@ package body Sem_Ch12 is
-- To detect this case we have to rescan the list of formals, which
-- is usually short enough to ignore the resulting inefficiency.
+ -----------------------------
+ -- Denotes_Previous_Actual --
+ -----------------------------
+
function Denotes_Previous_Actual (Typ : Entity_Id) return Boolean is
Prev : Entity_Id;
+
begin
Prev := First_Entity (Instance);
while Present (Prev) loop
@@ -4859,12 +4877,15 @@ package body Sem_Ch12 is
and then Entity (Subtype_Indication (Parent (Prev))) = Typ
then
return True;
+
elsif Prev = E then
return False;
+
else
Next_Entity (Prev);
end if;
end loop;
+
return False;
end Denotes_Previous_Actual;
@@ -5874,7 +5895,7 @@ package body Sem_Ch12 is
-- If we are not instantiating, then this is where we load and
-- analyze subunits, i.e. at the point where the stub occurs. A
- -- more permissible system might defer this analysis to the point
+ -- more permissive system might defer this analysis to the point
-- of instantiation, but this seems to complicated for now.
if not Instantiating then
@@ -7853,8 +7874,7 @@ package body Sem_Ch12 is
if not Box_Present (Formal) then
declare
I_Pack : constant Entity_Id :=
- Make_Defining_Identifier (Sloc (Actual),
- Chars => New_Internal_Name ('P'));
+ Make_Temporary (Sloc (Actual), 'P');
begin
Set_Is_Internal (I_Pack);
@@ -8153,9 +8173,8 @@ package body Sem_Ch12 is
-- to prevent freezing anomalies.
declare
- Anon_Id : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, New_Internal_Name ('E'));
+ Anon_Id : constant Entity_Id := Make_Temporary (Loc, 'E');
+
begin
Set_Defining_Unit_Name (New_Spec, Anon_Id);
Insert_Before (Instantiation_Node, Decl_Node);
@@ -8302,8 +8321,7 @@ package body Sem_Ch12 is
Subt_Decl :=
Make_Subtype_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, New_Internal_Name ('P')),
+ Defining_Identifier => Make_Temporary (Loc, 'P'),
Subtype_Indication => New_Occurrence_Of (Ftyp, Loc));
Prepend (Subt_Decl, List);
@@ -8576,6 +8594,7 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top;
Scope_Suppress := Body_Info.Scope_Suppress;
+ Opt.Ada_Version := Body_Info.Version;
if No (Gen_Body_Id) then
Load_Parent_Of_Generic
@@ -8583,6 +8602,8 @@ package body Sem_Ch12 is
Gen_Body_Id := Corresponding_Body (Gen_Decl);
end if;
+ Mark_Context (Act_Decl, Gen_Decl);
+
-- Establish global variable for sloc adjustment and for error recovery
Instantiation_Node := Inst_Node;
@@ -8732,11 +8753,16 @@ package body Sem_Ch12 is
-- If we have no body, and the unit requires a body, then complain. This
-- complaint is suppressed if we have detected other errors (since a
-- common reason for missing the body is that it had errors).
+ -- In CodePeer mode, a warning has been emitted already, no need for
+ -- further messages.
elsif Unit_Requires_Body (Gen_Unit)
and then not Body_Optional
then
- if Serious_Errors_Detected = 0 then
+ if CodePeer_Mode then
+ null;
+
+ elsif Serious_Errors_Detected = 0 then
Error_Msg_NE
("cannot find body of generic package &", Inst_Node, Gen_Unit);
@@ -8832,6 +8858,7 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top;
Scope_Suppress := Body_Info.Scope_Suppress;
+ Opt.Ada_Version := Body_Info.Version;
if No (Gen_Body_Id) then
@@ -8859,6 +8886,7 @@ package body Sem_Ch12 is
if Present (Gen_Body_Id) then
Gen_Body := Unit_Declaration_Node (Gen_Body_Id);
+ Mark_Context (Inst_Node, Gen_Decl);
if Nkind (Gen_Body) = N_Subprogram_Body_Stub then
@@ -9213,8 +9241,10 @@ package body Sem_Ch12 is
elsif Ekind (A_Gen_T) = E_General_Access_Type
and then Ekind (Base_Type (Act_T)) /= E_General_Access_Type
then
- Error_Msg_N ("actual must be general access type!", Actual);
- Error_Msg_NE ("add ALL to }!", Actual, Act_T);
+ Error_Msg_N -- CODEFIX
+ ("actual must be general access type!", Actual);
+ Error_Msg_NE -- CODEFIX
+ ("add ALL to }!", Actual, Act_T);
Abandon_Instantiation (Actual);
end if;
end if;
@@ -9843,9 +9873,7 @@ package body Sem_Ch12 is
-- then so far the subprograms correspond, so
-- now check that any result types correspond.
- if No (Anc_Formal)
- and then No (Act_Formal)
- then
+ if No (Anc_Formal) and then No (Act_Formal) then
Subprograms_Correspond := True;
if Ekind (Act_Subp) = E_Function then
@@ -10327,8 +10355,7 @@ package body Sem_Ch12 is
Corr_Decl : Node_Id;
begin
- New_Corr := Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ New_Corr := Make_Temporary (Loc, 'S');
Corr_Decl :=
Make_Subtype_Declaration (Loc,
Defining_Identifier => New_Corr,
@@ -10374,6 +10401,131 @@ package body Sem_Ch12 is
end if;
end Is_Generic_Formal;
+ ------------------
+ -- Mark_Context --
+ ------------------
+
+ procedure Mark_Context (Inst_Decl : Node_Id; Gen_Decl : Node_Id) is
+ Loc : constant Source_Ptr := Sloc (Inst_Decl);
+ Inst_CU : constant Unit_Number_Type := Get_Code_Unit (Inst_Decl);
+
+ -- Note that we use Get_Code_Unit to determine the position of the
+ -- instantiation, because it may itself appear within another instance
+ -- and we need to mark the context of the enclosing unit, not that of
+ -- the unit that contains the generic.
+
+ Gen_CU : constant Unit_Number_Type := Get_Source_Unit (Gen_Decl);
+ Inst : Entity_Id;
+ Clause : Node_Id;
+ Scop : Entity_Id;
+
+ procedure Add_Implicit_With (CU : Unit_Number_Type);
+ -- If a generic is instantiated in the direct or indirect context of
+ -- the current unit, but there is no with_clause for it in the current
+ -- context, add a with_clause for it to indicate that the body of the
+ -- generic should be examined before the current unit.
+
+ procedure Add_Implicit_With (CU : Unit_Number_Type) is
+ Withn : constant Node_Id :=
+ Make_With_Clause (Loc,
+ Name => New_Occurrence_Of (Cunit_Entity (CU), Loc));
+ begin
+ Set_Implicit_With (Withn);
+ Set_Library_Unit (Withn, Cunit (CU));
+ Set_Withed_Body (Withn, Cunit (CU));
+ Prepend (Withn, Context_Items (Cunit (Inst_CU)));
+ end Add_Implicit_With;
+
+ begin
+ -- This is only relevant when compiling for CodePeer. In what follows,
+ -- C is the current unit containing the instance body, and G is the
+ -- generic unit in that instance.
+
+ if not CodePeer_Mode then
+ return;
+ end if;
+
+ -- Nothing to do if G is local.
+
+ if Inst_CU = Gen_CU then
+ return;
+ end if;
+
+ -- If G is itself declared within an instance, indicate that the
+ -- generic body of that instance is also needed by C. This must be
+ -- done recursively.
+
+ Scop := Scope (Defining_Entity (Gen_Decl));
+
+ while Is_Generic_Instance (Scop)
+ and then Ekind (Scop) = E_Package
+ loop
+ Mark_Context
+ (Inst_Decl,
+ Unit_Declaration_Node
+ (Generic_Parent
+ (Specification (Unit_Declaration_Node (Scop)))));
+ Scop := Scope (Scop);
+ end loop;
+
+ -- Add references to other generic units in the context of G, because
+ -- they may be instantiated within G, and their bodies needed by C.
+
+ Clause := First (Context_Items (Cunit (Gen_CU)));
+
+ while Present (Clause) loop
+ if Nkind (Clause) = N_With_Clause
+ and then
+ Nkind (Unit (Library_Unit (Clause)))
+ = N_Generic_Package_Declaration
+ then
+ Add_Implicit_With (Get_Source_Unit (Library_Unit (Clause)));
+ end if;
+
+ Next (Clause);
+ end loop;
+
+ -- Now indicate that the body of G is needed by C
+
+ Clause := First (Context_Items (Cunit (Inst_CU)));
+ while Present (Clause) loop
+ if Nkind (Clause) = N_With_Clause
+ and then Library_Unit (Clause) = Cunit (Gen_CU)
+ then
+ Set_Withed_Body (Clause, Cunit (Gen_CU));
+ return;
+ end if;
+
+ Next (Clause);
+ end loop;
+
+ -- If the with-clause for G is not in the context of C, it may appear in
+ -- some ancestor of C.
+
+ Inst := Cunit_Entity (Inst_CU);
+ while Is_Child_Unit (Inst) loop
+ Inst := Scope (Inst);
+
+ Clause :=
+ First (Context_Items (Parent (Unit_Declaration_Node (Inst))));
+ while Present (Clause) loop
+ if Nkind (Clause) = N_With_Clause
+ and then Library_Unit (Clause) = Cunit (Gen_CU)
+ then
+ Set_Withed_Body (Clause, Cunit (Gen_CU));
+ return;
+ end if;
+
+ Next (Clause);
+ end loop;
+ end loop;
+
+ -- If not found, G comes from an instance elsewhere in the context. Make
+ -- the dependence explicit in the context of C.
+
+ Add_Implicit_With (Gen_CU);
+ end Mark_Context;
+
---------------------
-- Is_In_Main_Unit --
---------------------
@@ -10434,8 +10586,8 @@ package body Sem_Ch12 is
-- instantiations are available, we must analyze them, to ensure that
-- the public symbols generated are the same when the unit is compiled
-- to generate code, and when it is compiled in the context of a unit
- -- that needs a particular nested instance. This process is applied
- -- to both package and subprogram instances.
+ -- that needs a particular nested instance. This process is applied to
+ -- both package and subprogram instances.
--------------------------------
-- Collect_Previous_Instances --
@@ -10480,10 +10632,18 @@ package body Sem_Ch12 is
Collect_Previous_Instances
(Private_Declarations (Specification (Decl)));
+ -- Previous non-generic bodies may contain instances as well
+
elsif Nkind (Decl) = N_Package_Body
and then Ekind (Corresponding_Spec (Decl)) /= E_Generic_Package
then
Collect_Previous_Instances (Declarations (Decl));
+
+ elsif Nkind (Decl) = N_Subprogram_Body
+ and then not Acts_As_Spec (Decl)
+ and then not Is_Generic_Subprogram (Corresponding_Spec (Decl))
+ then
+ Collect_Previous_Instances (Declarations (Decl));
end if;
Next (Decl);
@@ -10577,9 +10737,8 @@ package body Sem_Ch12 is
-- enclosing body. Because the generic body we need may use
-- global entities declared in the enclosing package (including
-- aggregates) it is in general necessary to compile this body
- -- with expansion enabled. The exception is if we are within a
- -- generic package, in which case the usual generic rule
- -- applies.
+ -- with expansion enabled, except if we are within a generic
+ -- package, in which case the usual generic rule applies.
declare
Exp_Status : Boolean := True;
@@ -10648,7 +10807,8 @@ package body Sem_Ch12 is
Get_Code_Unit (Sloc (Node (Decl))),
Scope_Suppress => Scope_Suppress,
Local_Suppress_Stack_Top =>
- Local_Suppress_Stack_Top);
+ Local_Suppress_Stack_Top,
+ Version => Ada_Version);
-- Package instance
@@ -10688,7 +10848,8 @@ package body Sem_Ch12 is
Get_Code_Unit (Sloc (Inst_Node)),
Scope_Suppress => Scope_Suppress,
Local_Suppress_Stack_Top =>
- Local_Suppress_Stack_Top)),
+ Local_Suppress_Stack_Top,
+ Version => Ada_Version)),
Body_Optional => Body_Optional);
end;
end if;
@@ -10711,11 +10872,20 @@ package body Sem_Ch12 is
Get_Body_Name (Get_Unit_Name (Unit (Comp_Unit)));
begin
- Error_Msg_Unit_1 := Bname;
- Error_Msg_N ("this instantiation requires$!", N);
- Error_Msg_File_1 := Get_File_Name (Bname, Subunit => False);
- Error_Msg_N ("\but file{ was not found!", N);
- raise Unrecoverable_Error;
+ -- In CodePeer mode, the missing body may make the analysis
+ -- incomplete, but we do not treat it as fatal.
+
+ if CodePeer_Mode then
+ return;
+
+ else
+ Error_Msg_Unit_1 := Bname;
+ Error_Msg_N ("this instantiation requires$!", N);
+ Error_Msg_File_1 :=
+ Get_File_Name (Bname, Subunit => False);
+ Error_Msg_N ("\but file{ was not found!", N);
+ raise Unrecoverable_Error;
+ end if;
end;
end if;
end if;
@@ -11225,9 +11395,9 @@ package body Sem_Ch12 is
-- exchanged explicitly now, in order to remain consistent with the
-- view of the parent type.
- if Ekind (Typ) = E_Private_Type
- or else Ekind (Typ) = E_Limited_Private_Type
- or else Ekind (Typ) = E_Record_Type_With_Private
+ if Ekind_In (Typ, E_Private_Type,
+ E_Limited_Private_Type,
+ E_Record_Type_With_Private)
then
Dep_Elmt := First_Elmt (Private_Dependents (Typ));
while Present (Dep_Elmt) loop
@@ -12023,18 +12193,17 @@ package body Sem_Ch12 is
elsif Nkind (N2) = N_Explicit_Dereference then
-- An identifier is rewritten as a dereference if it is the
- -- prefix in an implicit dereference.
-
- -- Check whether corresponding entity in prefix is global
+ -- prefix in an implicit dereference (call or attribute).
+ -- The analysis of an instantiation will expand the node
+ -- again, so we preserve the original tree but link it to
+ -- the resolved entity in case it is global.
if Is_Entity_Name (Prefix (N2))
and then Present (Entity (Prefix (N2)))
and then Is_Global (Entity (Prefix (N2)))
then
- Rewrite (N,
- Make_Explicit_Dereference (Loc,
- Prefix =>
- New_Occurrence_Of (Entity (Prefix (N2)), Loc)));
+ Set_Associated_Node (N, Prefix (N2));
+
elsif Nkind (Prefix (N2)) = N_Function_Call
and then Is_Global (Entity (Name (Prefix (N2))))
then
@@ -12156,6 +12325,26 @@ package body Sem_Ch12 is
-- All other cases than aggregates
else
+ -- For pragmas, we propagate the Enabled status for the
+ -- relevant pragmas to the original generic tree. This was
+ -- originally needed for SCO generation. It is no longer
+ -- needed there (since we use the Sloc value in calls to
+ -- Set_SCO_Pragma_Enabled), but it seems a generally good
+ -- idea to have this flag set properly.
+
+ if Nkind (N) = N_Pragma
+ and then
+ (Pragma_Name (N) = Name_Assert or else
+ Pragma_Name (N) = Name_Check or else
+ Pragma_Name (N) = Name_Precondition or else
+ Pragma_Name (N) = Name_Postcondition)
+ and then Present (Associated_Node (Pragma_Identifier (N)))
+ then
+ Set_Pragma_Enabled (N,
+ Pragma_Enabled
+ (Parent (Associated_Node (Pragma_Identifier (N)))));
+ end if;
+
Save_Global_Descendant (Field1 (N));
Save_Global_Descendant (Field2 (N));
Save_Global_Descendant (Field3 (N));
@@ -12237,19 +12426,22 @@ package body Sem_Ch12 is
Act_Unit : Entity_Id)
is
begin
- -- Regardless of the current mode, predefined units are analyzed in
- -- the most current Ada mode, and earlier version Ada checks do not
- -- apply to predefined units. Nothing needs to be done for non-internal
- -- units. These are always analyzed in the current mode.
+ -- Regardless of the current mode, predefined units are analyzed in the
+ -- most current Ada mode, and earlier version Ada checks do not apply
+ -- to predefined units. Nothing needs to be done for non-internal units.
+ -- These are always analyzed in the current mode.
if Is_Internal_File_Name
- (Fname => Unit_File_Name (Get_Source_Unit (Gen_Unit)),
- Renamings_Included => True)
+ (Fname => Unit_File_Name (Get_Source_Unit (Gen_Unit)),
+ Renamings_Included => True)
then
Set_Opt_Config_Switches (True, Current_Sem_Unit = Main_Unit);
end if;
- Current_Instantiated_Parent := (Gen_Unit, Act_Unit, Assoc_Null);
+ Current_Instantiated_Parent :=
+ (Gen_Id => Gen_Unit,
+ Act_Id => Act_Unit,
+ Next_In_HTable => Assoc_Null);
end Set_Instance_Env;
-----------------
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 6542dd28174..8b1d60aa153 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -73,10 +73,6 @@ package body Sem_Ch13 is
-- inherited from a derived type that is no longer appropriate for the
-- new Esize value. In this case, we reset the Alignment to unknown.
- procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id);
- -- Given two entities for record components or discriminants, checks
- -- if they have overlapping component clauses and issues errors if so.
-
function Get_Alignment_Value (Expr : Node_Id) return Uint;
-- Given the expression for an alignment value, returns the corresponding
-- Uint value. If the value is inappropriate, then error messages are
@@ -180,265 +176,421 @@ package body Sem_Ch13 is
-----------------------------------------
procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id) is
- Max_Machine_Scalar_Size : constant Uint :=
- UI_From_Int
- (Standard_Long_Long_Integer_Size);
- -- We use this as the maximum machine scalar size in the sense of AI-133
-
- Num_CC : Natural;
- Comp : Entity_Id;
- SSU : constant Uint := UI_From_Int (System_Storage_Unit);
+ Comp : Node_Id;
+ CC : Node_Id;
begin
- -- This first loop through components does two things. First it deals
- -- with the case of components with component clauses whose length is
- -- greater than the maximum machine scalar size (either accepting them
- -- or rejecting as needed). Second, it counts the number of components
- -- with component clauses whose length does not exceed this maximum for
- -- later processing.
-
- Num_CC := 0;
- Comp := First_Component_Or_Discriminant (R);
- while Present (Comp) loop
- declare
- CC : constant Node_Id := Component_Clause (Comp);
+ -- Processing depends on version of Ada
- begin
- if Present (CC) then
- declare
- Fbit : constant Uint := Static_Integer (First_Bit (CC));
+ case Ada_Version is
- begin
- -- Case of component with size > max machine scalar
+ -- For Ada 95, we just renumber bits within a storage unit. We do
+ -- the same for Ada 83 mode, since we recognize pragma Bit_Order
+ -- in Ada 83, and are free to add this extension.
- if Esize (Comp) > Max_Machine_Scalar_Size then
+ when Ada_83 | Ada_95 =>
+ Comp := First_Component_Or_Discriminant (R);
+ while Present (Comp) loop
+ CC := Component_Clause (Comp);
- -- Must begin on byte boundary
+ -- If component clause is present, then deal with the non-
+ -- default bit order case for Ada 95 mode.
- if Fbit mod SSU /= 0 then
- Error_Msg_N
- ("illegal first bit value for reverse bit order",
- First_Bit (CC));
- Error_Msg_Uint_1 := SSU;
- Error_Msg_Uint_2 := Max_Machine_Scalar_Size;
+ -- We only do this processing for the base type, and in
+ -- fact that's important, since otherwise if there are
+ -- record subtypes, we could reverse the bits once for
+ -- each subtype, which would be incorrect.
- Error_Msg_N
- ("\must be a multiple of ^ if size greater than ^",
- First_Bit (CC));
+ if Present (CC)
+ and then Ekind (R) = E_Record_Type
+ then
+ declare
+ CFB : constant Uint := Component_Bit_Offset (Comp);
+ CSZ : constant Uint := Esize (Comp);
+ CLC : constant Node_Id := Component_Clause (Comp);
+ Pos : constant Node_Id := Position (CLC);
+ FB : constant Node_Id := First_Bit (CLC);
- -- Must end on byte boundary
+ Storage_Unit_Offset : constant Uint :=
+ CFB / System_Storage_Unit;
- elsif Esize (Comp) mod SSU /= 0 then
- Error_Msg_N
- ("illegal last bit value for reverse bit order",
- Last_Bit (CC));
- Error_Msg_Uint_1 := SSU;
- Error_Msg_Uint_2 := Max_Machine_Scalar_Size;
+ Start_Bit : constant Uint :=
+ CFB mod System_Storage_Unit;
- Error_Msg_N
- ("\must be a multiple of ^ if size greater than ^",
- Last_Bit (CC));
+ begin
+ -- Cases where field goes over storage unit boundary
- -- OK, give warning if enabled
+ if Start_Bit + CSZ > System_Storage_Unit then
- elsif Warn_On_Reverse_Bit_Order then
- Error_Msg_N
- ("multi-byte field specified with non-standard"
- & " Bit_Order?", CC);
+ -- Allow multi-byte field but generate warning
- if Bytes_Big_Endian then
+ if Start_Bit mod System_Storage_Unit = 0
+ and then CSZ mod System_Storage_Unit = 0
+ then
Error_Msg_N
- ("\bytes are not reversed "
- & "(component is big-endian)?", CC);
+ ("multi-byte field specified with non-standard"
+ & " Bit_Order?", CLC);
+
+ if Bytes_Big_Endian then
+ Error_Msg_N
+ ("bytes are not reversed "
+ & "(component is big-endian)?", CLC);
+ else
+ Error_Msg_N
+ ("bytes are not reversed "
+ & "(component is little-endian)?", CLC);
+ end if;
+
+ -- Do not allow non-contiguous field
+
else
Error_Msg_N
- ("\bytes are not reversed "
- & "(component is little-endian)?", CC);
+ ("attempt to specify non-contiguous field "
+ & "not permitted", CLC);
+ Error_Msg_N
+ ("\caused by non-standard Bit_Order "
+ & "specified", CLC);
+ Error_Msg_N
+ ("\consider possibility of using "
+ & "Ada 2005 mode here", CLC);
end if;
- end if;
- -- Case where size is not greater than max machine
- -- scalar. For now, we just count these.
+ -- Case where field fits in one storage unit
- else
- Num_CC := Num_CC + 1;
- end if;
- end;
- end if;
- end;
+ else
+ -- Give warning if suspicious component clause
- Next_Component_Or_Discriminant (Comp);
- end loop;
+ if Intval (FB) >= System_Storage_Unit
+ and then Warn_On_Reverse_Bit_Order
+ then
+ Error_Msg_N
+ ("?Bit_Order clause does not affect " &
+ "byte ordering", Pos);
+ Error_Msg_Uint_1 :=
+ Intval (Pos) + Intval (FB) /
+ System_Storage_Unit;
+ Error_Msg_N
+ ("?position normalized to ^ before bit " &
+ "order interpreted", Pos);
+ end if;
- -- We need to sort the component clauses on the basis of the Position
- -- values in the clause, so we can group clauses with the same Position.
- -- together to determine the relevant machine scalar size.
+ -- Here is where we fix up the Component_Bit_Offset
+ -- value to account for the reverse bit order.
+ -- Some examples of what needs to be done are:
- declare
- Comps : array (0 .. Num_CC) of Entity_Id;
- -- Array to collect component and discriminant entities. The data
- -- starts at index 1, the 0'th entry is for the sort routine.
+ -- First_Bit .. Last_Bit Component_Bit_Offset
+ -- old new old new
- function CP_Lt (Op1, Op2 : Natural) return Boolean;
- -- Compare routine for Sort
+ -- 0 .. 0 7 .. 7 0 7
+ -- 0 .. 1 6 .. 7 0 6
+ -- 0 .. 2 5 .. 7 0 5
+ -- 0 .. 7 0 .. 7 0 4
- procedure CP_Move (From : Natural; To : Natural);
- -- Move routine for Sort
+ -- 1 .. 1 6 .. 6 1 6
+ -- 1 .. 4 3 .. 6 1 3
+ -- 4 .. 7 0 .. 3 4 0
- package Sorting is new GNAT.Heap_Sort_G (CP_Move, CP_Lt);
+ -- The general rule is that the first bit is
+ -- is obtained by subtracting the old ending bit
+ -- from storage_unit - 1.
- Start : Natural;
- Stop : Natural;
- -- Start and stop positions in component list of set of components
- -- with the same starting position (that constitute components in
- -- a single machine scalar).
+ Set_Component_Bit_Offset
+ (Comp,
+ (Storage_Unit_Offset * System_Storage_Unit) +
+ (System_Storage_Unit - 1) -
+ (Start_Bit + CSZ - 1));
- MaxL : Uint;
- -- Maximum last bit value of any component in this set
+ Set_Normalized_First_Bit
+ (Comp,
+ Component_Bit_Offset (Comp) mod
+ System_Storage_Unit);
+ end if;
+ end;
+ end if;
- MSS : Uint;
- -- Corresponding machine scalar size
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
- -----------
- -- CP_Lt --
- -----------
+ -- For Ada 2005, we do machine scalar processing, as fully described
+ -- In AI-133. This involves gathering all components which start at
+ -- the same byte offset and processing them together
- function CP_Lt (Op1, Op2 : Natural) return Boolean is
- begin
- return Position (Component_Clause (Comps (Op1))) <
- Position (Component_Clause (Comps (Op2)));
- end CP_Lt;
+ when Ada_05 .. Ada_Version_Type'Last =>
+ declare
+ Max_Machine_Scalar_Size : constant Uint :=
+ UI_From_Int
+ (Standard_Long_Long_Integer_Size);
+ -- We use this as the maximum machine scalar size
- -------------
- -- CP_Move --
- -------------
+ Num_CC : Natural;
+ SSU : constant Uint := UI_From_Int (System_Storage_Unit);
- procedure CP_Move (From : Natural; To : Natural) is
- begin
- Comps (To) := Comps (From);
- end CP_Move;
+ begin
+ -- This first loop through components does two things. First it
+ -- deals with the case of components with component clauses
+ -- whose length is greater than the maximum machine scalar size
+ -- (either accepting them or rejecting as needed). Second, it
+ -- counts the number of components with component clauses whose
+ -- length does not exceed this maximum for later processing.
+
+ Num_CC := 0;
+ Comp := First_Component_Or_Discriminant (R);
+ while Present (Comp) loop
+ CC := Component_Clause (Comp);
- begin
- -- Collect the component clauses
+ if Present (CC) then
+ declare
+ Fbit : constant Uint :=
+ Static_Integer (First_Bit (CC));
- Num_CC := 0;
- Comp := First_Component_Or_Discriminant (R);
- while Present (Comp) loop
- if Present (Component_Clause (Comp))
- and then Esize (Comp) <= Max_Machine_Scalar_Size
- then
- Num_CC := Num_CC + 1;
- Comps (Num_CC) := Comp;
- end if;
+ begin
+ -- Case of component with size > max machine scalar
+
+ if Esize (Comp) > Max_Machine_Scalar_Size then
+
+ -- Must begin on byte boundary
+
+ if Fbit mod SSU /= 0 then
+ Error_Msg_N
+ ("illegal first bit value for "
+ & "reverse bit order",
+ First_Bit (CC));
+ Error_Msg_Uint_1 := SSU;
+ Error_Msg_Uint_2 := Max_Machine_Scalar_Size;
+
+ Error_Msg_N
+ ("\must be a multiple of ^ "
+ & "if size greater than ^",
+ First_Bit (CC));
+
+ -- Must end on byte boundary
+
+ elsif Esize (Comp) mod SSU /= 0 then
+ Error_Msg_N
+ ("illegal last bit value for "
+ & "reverse bit order",
+ Last_Bit (CC));
+ Error_Msg_Uint_1 := SSU;
+ Error_Msg_Uint_2 := Max_Machine_Scalar_Size;
+
+ Error_Msg_N
+ ("\must be a multiple of ^ if size "
+ & "greater than ^",
+ Last_Bit (CC));
+
+ -- OK, give warning if enabled
+
+ elsif Warn_On_Reverse_Bit_Order then
+ Error_Msg_N
+ ("multi-byte field specified with "
+ & " non-standard Bit_Order?", CC);
+
+ if Bytes_Big_Endian then
+ Error_Msg_N
+ ("\bytes are not reversed "
+ & "(component is big-endian)?", CC);
+ else
+ Error_Msg_N
+ ("\bytes are not reversed "
+ & "(component is little-endian)?", CC);
+ end if;
+ end if;
- Next_Component_Or_Discriminant (Comp);
- end loop;
+ -- Case where size is not greater than max machine
+ -- scalar. For now, we just count these.
- -- Sort by ascending position number
-
- Sorting.Sort (Num_CC);
-
- -- We now have all the components whose size does not exceed the max
- -- machine scalar value, sorted by starting position. In this loop
- -- we gather groups of clauses starting at the same position, to
- -- process them in accordance with Ada 2005 AI-133.
-
- Stop := 0;
- while Stop < Num_CC loop
- Start := Stop + 1;
- Stop := Start;
- MaxL :=
- Static_Integer (Last_Bit (Component_Clause (Comps (Start))));
- while Stop < Num_CC loop
- if Static_Integer
- (Position (Component_Clause (Comps (Stop + 1)))) =
- Static_Integer
- (Position (Component_Clause (Comps (Stop))))
- then
- Stop := Stop + 1;
- MaxL :=
- UI_Max
- (MaxL,
- Static_Integer
- (Last_Bit (Component_Clause (Comps (Stop)))));
- else
- exit;
- end if;
- end loop;
+ else
+ Num_CC := Num_CC + 1;
+ end if;
+ end;
+ end if;
- -- Now we have a group of component clauses from Start to Stop
- -- whose positions are identical, and MaxL is the maximum last bit
- -- value of any of these components.
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
- -- We need to determine the corresponding machine scalar size.
- -- This loop assumes that machine scalar sizes are even, and that
- -- each possible machine scalar has twice as many bits as the
- -- next smaller one.
+ -- We need to sort the component clauses on the basis of the
+ -- Position values in the clause, so we can group clauses with
+ -- the same Position. together to determine the relevant
+ -- machine scalar size.
- MSS := Max_Machine_Scalar_Size;
- while MSS mod 2 = 0
- and then (MSS / 2) >= SSU
- and then (MSS / 2) > MaxL
- loop
- MSS := MSS / 2;
- end loop;
+ Sort_CC : declare
+ Comps : array (0 .. Num_CC) of Entity_Id;
+ -- Array to collect component and discriminant entities. The
+ -- data starts at index 1, the 0'th entry is for the sort
+ -- routine.
- -- Here is where we fix up the Component_Bit_Offset value to
- -- account for the reverse bit order. Some examples of what needs
- -- to be done for the case of a machine scalar size of 8 are:
+ function CP_Lt (Op1, Op2 : Natural) return Boolean;
+ -- Compare routine for Sort
- -- First_Bit .. Last_Bit Component_Bit_Offset
- -- old new old new
+ procedure CP_Move (From : Natural; To : Natural);
+ -- Move routine for Sort
- -- 0 .. 0 7 .. 7 0 7
- -- 0 .. 1 6 .. 7 0 6
- -- 0 .. 2 5 .. 7 0 5
- -- 0 .. 7 0 .. 7 0 4
+ package Sorting is new GNAT.Heap_Sort_G (CP_Move, CP_Lt);
- -- 1 .. 1 6 .. 6 1 6
- -- 1 .. 4 3 .. 6 1 3
- -- 4 .. 7 0 .. 3 4 0
+ Start : Natural;
+ Stop : Natural;
+ -- Start and stop positions in component list of set of
+ -- components with the same starting position (that
+ -- constitute components in a single machine scalar).
- -- The general rule is that the first bit is obtained by
- -- subtracting the old ending bit from machine scalar size - 1.
+ MaxL : Uint;
+ -- Maximum last bit value of any component in this set
- for C in Start .. Stop loop
- declare
- Comp : constant Entity_Id := Comps (C);
- CC : constant Node_Id := Component_Clause (Comp);
- LB : constant Uint := Static_Integer (Last_Bit (CC));
- NFB : constant Uint := MSS - Uint_1 - LB;
- NLB : constant Uint := NFB + Esize (Comp) - 1;
- Pos : constant Uint := Static_Integer (Position (CC));
+ MSS : Uint;
+ -- Corresponding machine scalar size
+
+ -----------
+ -- CP_Lt --
+ -----------
+
+ function CP_Lt (Op1, Op2 : Natural) return Boolean is
+ begin
+ return Position (Component_Clause (Comps (Op1))) <
+ Position (Component_Clause (Comps (Op2)));
+ end CP_Lt;
+
+ -------------
+ -- CP_Move --
+ -------------
+
+ procedure CP_Move (From : Natural; To : Natural) is
+ begin
+ Comps (To) := Comps (From);
+ end CP_Move;
+
+ -- Start of processing for Sort_CC
begin
- if Warn_On_Reverse_Bit_Order then
- Error_Msg_Uint_1 := MSS;
- Error_Msg_N
- ("info: reverse bit order in machine " &
- "scalar of length^?", First_Bit (CC));
- Error_Msg_Uint_1 := NFB;
- Error_Msg_Uint_2 := NLB;
+ -- Collect the component clauses
- if Bytes_Big_Endian then
- Error_Msg_NE
- ("?\info: big-endian range for "
- & "component & is ^ .. ^",
- First_Bit (CC), Comp);
- else
- Error_Msg_NE
- ("?\info: little-endian range "
- & "for component & is ^ .. ^",
- First_Bit (CC), Comp);
+ Num_CC := 0;
+ Comp := First_Component_Or_Discriminant (R);
+ while Present (Comp) loop
+ if Present (Component_Clause (Comp))
+ and then Esize (Comp) <= Max_Machine_Scalar_Size
+ then
+ Num_CC := Num_CC + 1;
+ Comps (Num_CC) := Comp;
end if;
- end if;
- Set_Component_Bit_Offset (Comp, Pos * SSU + NFB);
- Set_Normalized_First_Bit (Comp, NFB mod SSU);
- end;
- end loop;
- end loop;
- end;
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
+
+ -- Sort by ascending position number
+
+ Sorting.Sort (Num_CC);
+
+ -- We now have all the components whose size does not exceed
+ -- the max machine scalar value, sorted by starting
+ -- position. In this loop we gather groups of clauses
+ -- starting at the same position, to process them in
+ -- accordance with Ada 2005 AI-133.
+
+ Stop := 0;
+ while Stop < Num_CC loop
+ Start := Stop + 1;
+ Stop := Start;
+ MaxL :=
+ Static_Integer
+ (Last_Bit (Component_Clause (Comps (Start))));
+ while Stop < Num_CC loop
+ if Static_Integer
+ (Position (Component_Clause (Comps (Stop + 1)))) =
+ Static_Integer
+ (Position (Component_Clause (Comps (Stop))))
+ then
+ Stop := Stop + 1;
+ MaxL :=
+ UI_Max
+ (MaxL,
+ Static_Integer
+ (Last_Bit
+ (Component_Clause (Comps (Stop)))));
+ else
+ exit;
+ end if;
+ end loop;
+
+ -- Now we have a group of component clauses from Start to
+ -- Stop whose positions are identical, and MaxL is the
+ -- maximum last bit value of any of these components.
+
+ -- We need to determine the corresponding machine scalar
+ -- size. This loop assumes that machine scalar sizes are
+ -- even, and that each possible machine scalar has twice
+ -- as many bits as the next smaller one.
+
+ MSS := Max_Machine_Scalar_Size;
+ while MSS mod 2 = 0
+ and then (MSS / 2) >= SSU
+ and then (MSS / 2) > MaxL
+ loop
+ MSS := MSS / 2;
+ end loop;
+
+ -- Here is where we fix up the Component_Bit_Offset value
+ -- to account for the reverse bit order. Some examples of
+ -- what needs to be done for the case of a machine scalar
+ -- size of 8 are:
+
+ -- First_Bit .. Last_Bit Component_Bit_Offset
+ -- old new old new
+
+ -- 0 .. 0 7 .. 7 0 7
+ -- 0 .. 1 6 .. 7 0 6
+ -- 0 .. 2 5 .. 7 0 5
+ -- 0 .. 7 0 .. 7 0 4
+
+ -- 1 .. 1 6 .. 6 1 6
+ -- 1 .. 4 3 .. 6 1 3
+ -- 4 .. 7 0 .. 3 4 0
+
+ -- The general rule is that the first bit is obtained by
+ -- subtracting the old ending bit from machine scalar
+ -- size - 1.
+
+ for C in Start .. Stop loop
+ declare
+ Comp : constant Entity_Id := Comps (C);
+ CC : constant Node_Id :=
+ Component_Clause (Comp);
+ LB : constant Uint :=
+ Static_Integer (Last_Bit (CC));
+ NFB : constant Uint := MSS - Uint_1 - LB;
+ NLB : constant Uint := NFB + Esize (Comp) - 1;
+ Pos : constant Uint :=
+ Static_Integer (Position (CC));
+
+ begin
+ if Warn_On_Reverse_Bit_Order then
+ Error_Msg_Uint_1 := MSS;
+ Error_Msg_N
+ ("info: reverse bit order in machine " &
+ "scalar of length^?", 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 ^ .. ^",
+ First_Bit (CC), Comp);
+ else
+ Error_Msg_NE
+ ("?\info: little-endian range "
+ & "for component & is ^ .. ^",
+ First_Bit (CC), Comp);
+ end if;
+ end if;
+
+ Set_Component_Bit_Offset (Comp, Pos * SSU + NFB);
+ Set_Normalized_First_Bit (Comp, NFB mod SSU);
+ end;
+ end loop;
+ end loop;
+ end Sort_CC;
+ end;
+ end case;
end Adjust_Record_For_Reverse_Bit_Order;
--------------------------------------
@@ -704,7 +856,8 @@ package body Sem_Ch13 is
Attribute_Write =>
null;
- -- Other cases are errors, which will be caught below
+ -- Other cases are errors ("attribute& cannot be set with
+ -- definition clause"), which will be caught below.
when others =>
null;
@@ -803,9 +956,7 @@ package body Sem_Ch13 is
-- it imported.
if Ignore_Rep_Clauses then
- if Ekind (U_Ent) = E_Variable
- or else Ekind (U_Ent) = E_Constant
- then
+ if Ekind_In (U_Ent, E_Variable, E_Constant) then
Record_Rep_Item (U_Ent, N);
end if;
@@ -1026,13 +1177,19 @@ package body Sem_Ch13 is
-- check till after code generation to take full advantage
-- of the annotation done by the back end. This entry is
-- only made if the address clause comes from source.
+ -- If the entity has a generic type, the check will be
+ -- performed in the instance if the actual type justifies
+ -- it, and we do not insert the clause in the table to
+ -- prevent spurious warnings.
if Address_Clause_Overlay_Warnings
and then Comes_From_Source (N)
and then Present (O_Ent)
and then Is_Object (O_Ent)
then
- Address_Clause_Checks.Append ((N, U_Ent, O_Ent, Off));
+ if not Is_Generic_Type (Etype (U_Ent)) then
+ Address_Clause_Checks.Append ((N, U_Ent, O_Ent, Off));
+ end if;
-- If variable overlays a constant view, and we are
-- warning on overlays, then mark the variable as
@@ -1528,8 +1685,8 @@ package body Sem_Ch13 is
Nam);
return;
- elsif Ekind (U_Ent) /= E_Access_Type
- and then Ekind (U_Ent) /= E_General_Access_Type
+ elsif not
+ Ekind_In (U_Ent, E_Access_Type, E_General_Access_Type)
then
Error_Msg_N
("storage pool can only be given for access types", Nam);
@@ -1586,9 +1743,7 @@ package body Sem_Ch13 is
if not Is_Entity_Name (Expr)
and then Is_Object_Reference (Expr)
then
- Pool :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Pool := Make_Temporary (Loc, 'P', Expr);
declare
Rnode : constant Node_Id :=
@@ -1596,7 +1751,7 @@ package body Sem_Ch13 is
Defining_Identifier => Pool,
Subtype_Mark =>
New_Occurrence_Of (Etype (Expr), Loc),
- Name => Expr);
+ Name => Expr);
begin
Insert_Before (N, Rnode);
@@ -1656,8 +1811,7 @@ package body Sem_Ch13 is
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);
+ Error_Msg_N ("\use Storage_Size pragma instead?", N);
end if;
FOnly := True;
@@ -2213,7 +2367,9 @@ package body Sem_Ch13 is
-- code because their main purpose was to provide support to initialize
-- the secondary dispatch tables. They are now generated also when
-- compiling with no code generation to provide ASIS the relationship
- -- between interface primitives and tagged type primitives.
+ -- between interface primitives and tagged type primitives. They are
+ -- also used to locate primitives covering interfaces when processing
+ -- generics (see Derive_Subprograms).
if Ada_Version >= Ada_05
and then Ekind (E) = E_Record_Type
@@ -2221,6 +2377,12 @@ package body Sem_Ch13 is
and then not Is_Interface (E)
and then Has_Interfaces (E)
then
+ -- This would be a good common place to call the routine that checks
+ -- overriding of interface primitives (and thus factorize calls to
+ -- Check_Abstract_Overriding located at different contexts in the
+ -- compiler). However, this is not possible because it causes
+ -- spurious errors in case of late overriding.
+
Add_Internal_Interface_Entities (E);
end if;
end Analyze_Freeze_Entity;
@@ -2229,11 +2391,16 @@ package body Sem_Ch13 is
-- Analyze_Record_Representation_Clause --
------------------------------------------
+ -- Note: we check as much as we can here, but we can't do any checks
+ -- based on the position values (e.g. overlap checks) until freeze time
+ -- because especially in Ada 2005 (machine scalar mode), the processing
+ -- for non-standard bit order can substantially change the positions.
+ -- See procedure Check_Record_Representation_Clause (called from Freeze)
+ -- for the remainder of this processing.
+
procedure Analyze_Record_Representation_Clause (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
Ident : constant Node_Id := Identifier (N);
Rectype : Entity_Id;
- Fent : Entity_Id;
CC : Node_Id;
Posit : Uint;
Fbit : Uint;
@@ -2241,33 +2408,8 @@ package body Sem_Ch13 is
Hbit : Uint := Uint_0;
Comp : Entity_Id;
Ocomp : Entity_Id;
- Pcomp : Entity_Id;
Biased : Boolean;
- Max_Bit_So_Far : Uint;
- -- Records the maximum bit position so far. If all field positions
- -- are monotonically increasing, then we can skip the circuit for
- -- checking for overlap, since no overlap is possible.
-
- Tagged_Parent : Entity_Id := Empty;
- -- This is set in the case of a derived tagged type for which we have
- -- Is_Fully_Repped_Tagged_Type True (indicating that all components are
- -- positioned by record representation clauses). In this case we must
- -- check for overlap between components of this tagged type, and the
- -- components of its parent. Tagged_Parent will point to this parent
- -- type. For all other cases Tagged_Parent is left set to Empty.
-
- Parent_Last_Bit : Uint;
- -- Relevant only if Tagged_Parent is set, Parent_Last_Bit indicates the
- -- last bit position for any field in the parent type. We only need to
- -- check overlap for fields starting below this point.
-
- Overlap_Check_Required : Boolean;
- -- Used to keep track of whether or not an overlap check is required
-
- Ccount : Natural := 0;
- -- Number of component clauses in record rep clause
-
CR_Pragma : Node_Id := Empty;
-- Points to N_Pragma node if Complete_Representation pragma present
@@ -2364,7 +2506,6 @@ package body Sem_Ch13 is
-- Get the alignment value to perform error checking
Mod_Val := Get_Alignment_Value (Expression (M));
-
end if;
end;
end if;
@@ -2383,39 +2524,6 @@ package body Sem_Ch13 is
end loop;
end if;
- -- See if we have a fully repped derived tagged type
-
- declare
- PS : constant Entity_Id := Parent_Subtype (Rectype);
-
- begin
- if Present (PS) and then Is_Fully_Repped_Tagged_Type (PS) then
- Tagged_Parent := PS;
-
- -- Find maximum bit of any component of the parent type
-
- Parent_Last_Bit := UI_From_Int (System_Address_Size - 1);
- Pcomp := First_Entity (Tagged_Parent);
- while Present (Pcomp) loop
- if Ekind (Pcomp) = E_Discriminant
- or else
- Ekind (Pcomp) = E_Component
- then
- if Component_Bit_Offset (Pcomp) /= No_Uint
- and then Known_Static_Esize (Pcomp)
- then
- Parent_Last_Bit :=
- UI_Max
- (Parent_Last_Bit,
- Component_Bit_Offset (Pcomp) + Esize (Pcomp) - 1);
- end if;
-
- Next_Entity (Pcomp);
- end if;
- end loop;
- end if;
- end;
-
-- All done if no component clauses
CC := First (Component_Clauses (N));
@@ -2424,51 +2532,12 @@ package body Sem_Ch13 is
return;
end if;
- -- If a tag is present, then create a component clause that places it
- -- at the start of the record (otherwise gigi may place it after other
- -- fields that have rep clauses).
-
- Fent := First_Entity (Rectype);
-
- if Nkind (Fent) = N_Defining_Identifier
- and then Chars (Fent) = Name_uTag
- then
- Set_Component_Bit_Offset (Fent, Uint_0);
- Set_Normalized_Position (Fent, Uint_0);
- Set_Normalized_First_Bit (Fent, Uint_0);
- Set_Normalized_Position_Max (Fent, Uint_0);
- Init_Esize (Fent, System_Address_Size);
-
- Set_Component_Clause (Fent,
- Make_Component_Clause (Loc,
- Component_Name =>
- Make_Identifier (Loc,
- Chars => Name_uTag),
-
- Position =>
- Make_Integer_Literal (Loc,
- Intval => Uint_0),
-
- First_Bit =>
- Make_Integer_Literal (Loc,
- Intval => Uint_0),
-
- Last_Bit =>
- Make_Integer_Literal (Loc,
- UI_From_Int (System_Address_Size))));
-
- Ccount := Ccount + 1;
- end if;
-
-- A representation like this applies to the base type
Set_Has_Record_Rep_Clause (Base_Type (Rectype));
Set_Has_Non_Standard_Rep (Base_Type (Rectype));
Set_Has_Specified_Layout (Base_Type (Rectype));
- Max_Bit_So_Far := Uint_Minus_1;
- Overlap_Check_Required := False;
-
-- Process the component clauses
while Present (CC) loop
@@ -2487,7 +2556,6 @@ package body Sem_Ch13 is
-- Processing for real component clause
else
- Ccount := Ccount + 1;
Posit := Static_Integer (Position (CC));
Fbit := Static_Integer (First_Bit (CC));
Lbit := Static_Integer (Last_Bit (CC));
@@ -2596,12 +2664,6 @@ package body Sem_Ch13 is
Fbit := Fbit + UI_From_Int (SSU) * Posit;
Lbit := Lbit + UI_From_Int (SSU) * Posit;
- if Fbit <= Max_Bit_So_Far then
- Overlap_Check_Required := True;
- else
- Max_Bit_So_Far := Lbit;
- end if;
-
if Has_Size_Clause (Rectype)
and then Esize (Rectype) <= Lbit
then
@@ -2615,17 +2677,6 @@ package body Sem_Ch13 is
Set_Normalized_First_Bit (Comp, Fbit mod SSU);
Set_Normalized_Position (Comp, Fbit / SSU);
- Set_Normalized_Position_Max
- (Fent, Normalized_Position (Fent));
-
- if Is_Tagged_Type (Rectype)
- and then Fbit < System_Address_Size
- then
- Error_Msg_NE
- ("component overlaps tag field of&",
- Component_Name (CC), Rectype);
- end if;
-
-- This information is also set in the corresponding
-- component of the base type, found by accessing the
-- Original_Record_Component link if it is present.
@@ -2668,27 +2719,6 @@ package body Sem_Ch13 is
Error_Msg_N ("component size is negative", CC);
end if;
end if;
-
- -- If OK component size, check parent type overlap if
- -- this component might overlap a parent field.
-
- if Present (Tagged_Parent)
- and then Fbit <= Parent_Last_Bit
- then
- Pcomp := First_Entity (Tagged_Parent);
- while Present (Pcomp) loop
- if (Ekind (Pcomp) = E_Discriminant
- or else
- Ekind (Pcomp) = E_Component)
- and then not Is_Tag (Pcomp)
- and then Chars (Pcomp) /= Name_uParent
- then
- Check_Component_Overlap (Comp, Pcomp);
- end if;
-
- Next_Entity (Pcomp);
- end loop;
- end if;
end if;
end if;
end if;
@@ -2697,254 +2727,6 @@ package body Sem_Ch13 is
Next (CC);
end loop;
- -- Now that we have processed all the component clauses, check for
- -- overlap. We have to leave this till last, since the components can
- -- appear in any arbitrary order in the representation clause.
-
- -- We do not need this check if all specified ranges were monotonic,
- -- as recorded by Overlap_Check_Required being False at this stage.
-
- -- This first section checks if there are any overlapping entries at
- -- all. It does this by sorting all entries and then seeing if there are
- -- any overlaps. If there are none, then that is decisive, but if there
- -- are overlaps, they may still be OK (they may result from fields in
- -- different variants).
-
- if Overlap_Check_Required then
- Overlap_Check1 : declare
-
- OC_Fbit : array (0 .. Ccount) of Uint;
- -- First-bit values for component clauses, the value is the offset
- -- of the first bit of the field from start of record. The zero
- -- entry is for use in sorting.
-
- OC_Lbit : array (0 .. Ccount) of Uint;
- -- Last-bit values for component clauses, the value is the offset
- -- of the last bit of the field from start of record. The zero
- -- entry is for use in sorting.
-
- OC_Count : Natural := 0;
- -- Count of entries in OC_Fbit and OC_Lbit
-
- function OC_Lt (Op1, Op2 : Natural) return Boolean;
- -- Compare routine for Sort
-
- procedure OC_Move (From : Natural; To : Natural);
- -- Move routine for Sort
-
- package Sorting is new GNAT.Heap_Sort_G (OC_Move, OC_Lt);
-
- -----------
- -- OC_Lt --
- -----------
-
- function OC_Lt (Op1, Op2 : Natural) return Boolean is
- begin
- return OC_Fbit (Op1) < OC_Fbit (Op2);
- end OC_Lt;
-
- -------------
- -- OC_Move --
- -------------
-
- procedure OC_Move (From : Natural; To : Natural) is
- begin
- OC_Fbit (To) := OC_Fbit (From);
- OC_Lbit (To) := OC_Lbit (From);
- end OC_Move;
-
- -- Start of processing for Overlap_Check
-
- begin
- CC := First (Component_Clauses (N));
- while Present (CC) loop
- if Nkind (CC) /= N_Pragma then
- Posit := Static_Integer (Position (CC));
- Fbit := Static_Integer (First_Bit (CC));
- Lbit := Static_Integer (Last_Bit (CC));
-
- if Posit /= No_Uint
- and then Fbit /= No_Uint
- and then Lbit /= No_Uint
- then
- OC_Count := OC_Count + 1;
- Posit := Posit * SSU;
- OC_Fbit (OC_Count) := Fbit + Posit;
- OC_Lbit (OC_Count) := Lbit + Posit;
- end if;
- end if;
-
- Next (CC);
- end loop;
-
- Sorting.Sort (OC_Count);
-
- Overlap_Check_Required := False;
- for J in 1 .. OC_Count - 1 loop
- if OC_Lbit (J) >= OC_Fbit (J + 1) then
- Overlap_Check_Required := True;
- exit;
- end if;
- end loop;
- end Overlap_Check1;
- end if;
-
- -- If Overlap_Check_Required is still True, then we have to do the full
- -- scale overlap check, since we have at least two fields that do
- -- overlap, and we need to know if that is OK since they are in
- -- different variant, or whether we have a definite problem.
-
- if Overlap_Check_Required then
- Overlap_Check2 : declare
- C1_Ent, C2_Ent : Entity_Id;
- -- Entities of components being checked for overlap
-
- Clist : Node_Id;
- -- Component_List node whose Component_Items are being checked
-
- Citem : Node_Id;
- -- Component declaration for component being checked
-
- begin
- C1_Ent := First_Entity (Base_Type (Rectype));
-
- -- Loop through all components in record. For each component check
- -- for overlap with any of the preceding elements on the component
- -- list containing the component and also, if the component is in
- -- a variant, check against components outside the case structure.
- -- This latter test is repeated recursively up the variant tree.
-
- Main_Component_Loop : while Present (C1_Ent) loop
- if Ekind (C1_Ent) /= E_Component
- and then Ekind (C1_Ent) /= E_Discriminant
- then
- goto Continue_Main_Component_Loop;
- end if;
-
- -- Skip overlap check if entity has no declaration node. This
- -- happens with discriminants in constrained derived types.
- -- Probably we are missing some checks as a result, but that
- -- does not seem terribly serious ???
-
- if No (Declaration_Node (C1_Ent)) then
- goto Continue_Main_Component_Loop;
- end if;
-
- Clist := Parent (List_Containing (Declaration_Node (C1_Ent)));
-
- -- Loop through component lists that need checking. Check the
- -- current component list and all lists in variants above us.
-
- Component_List_Loop : loop
-
- -- If derived type definition, go to full declaration
- -- If at outer level, check discriminants if there are any.
-
- if Nkind (Clist) = N_Derived_Type_Definition then
- Clist := Parent (Clist);
- end if;
-
- -- Outer level of record definition, check discriminants
-
- if Nkind_In (Clist, N_Full_Type_Declaration,
- N_Private_Type_Declaration)
- then
- if Has_Discriminants (Defining_Identifier (Clist)) then
- C2_Ent :=
- First_Discriminant (Defining_Identifier (Clist));
- while Present (C2_Ent) loop
- exit when C1_Ent = C2_Ent;
- Check_Component_Overlap (C1_Ent, C2_Ent);
- Next_Discriminant (C2_Ent);
- end loop;
- end if;
-
- -- Record extension case
-
- elsif Nkind (Clist) = N_Derived_Type_Definition then
- Clist := Empty;
-
- -- Otherwise check one component list
-
- else
- Citem := First (Component_Items (Clist));
-
- while Present (Citem) loop
- if Nkind (Citem) = N_Component_Declaration then
- C2_Ent := Defining_Identifier (Citem);
- exit when C1_Ent = C2_Ent;
- Check_Component_Overlap (C1_Ent, C2_Ent);
- end if;
-
- Next (Citem);
- end loop;
- end if;
-
- -- Check for variants above us (the parent of the Clist can
- -- be a variant, in which case its parent is a variant part,
- -- and the parent of the variant part is a component list
- -- whose components must all be checked against the current
- -- component for overlap).
-
- if Nkind (Parent (Clist)) = N_Variant then
- Clist := Parent (Parent (Parent (Clist)));
-
- -- Check for possible discriminant part in record, this is
- -- treated essentially as another level in the recursion.
- -- For this case the parent of the component list is the
- -- record definition, and its parent is the full type
- -- declaration containing the discriminant specifications.
-
- elsif Nkind (Parent (Clist)) = N_Record_Definition then
- Clist := Parent (Parent ((Clist)));
-
- -- If neither of these two cases, we are at the top of
- -- the tree.
-
- else
- exit Component_List_Loop;
- end if;
- end loop Component_List_Loop;
-
- <<Continue_Main_Component_Loop>>
- Next_Entity (C1_Ent);
-
- end loop Main_Component_Loop;
- end Overlap_Check2;
- end if;
-
- -- For records that have component clauses for all components, and whose
- -- size is less than or equal to 32, we need to know the size in the
- -- front end to activate possible packed array processing where the
- -- component type is a record.
-
- -- At this stage Hbit + 1 represents the first unused bit from all the
- -- component clauses processed, so if the component clauses are
- -- complete, then this is the length of the record.
-
- -- For records longer than System.Storage_Unit, and for those where not
- -- all components have component clauses, the back end determines the
- -- length (it may for example be appropriate to round up the size
- -- to some convenient boundary, based on alignment considerations, etc).
-
- if Unknown_RM_Size (Rectype) and then Hbit + 1 <= 32 then
-
- -- Nothing to do if at least one component has no component clause
-
- Comp := First_Component_Or_Discriminant (Rectype);
- while Present (Comp) loop
- exit when No (Component_Clause (Comp));
- Next_Component_Or_Discriminant (Comp);
- end loop;
-
- -- If we fall out of loop, all components have component clauses
- -- and so we can set the size to the maximum value.
-
- if No (Comp) then
- Set_RM_Size (Rectype, Hbit + 1);
- end if;
- end if;
-
-- Check missing components if Complete_Representation pragma appeared
if Present (CR_Pragma) then
@@ -2958,7 +2740,7 @@ package body Sem_Ch13 is
Next_Component_Or_Discriminant (Comp);
end loop;
- -- If no Complete_Representation pragma, warn if missing components
+ -- If no Complete_Representation pragma, warn if missing components
elsif Warn_On_Unrepped_Components then
declare
@@ -2996,8 +2778,8 @@ package body Sem_Ch13 is
and then Comes_From_Source (Comp)
and then Present (Underlying_Type (Etype (Comp)))
and then (Is_Scalar_Type (Underlying_Type (Etype (Comp)))
- or else Size_Known_At_Compile_Time
- (Underlying_Type (Etype (Comp))))
+ or else Size_Known_At_Compile_Time
+ (Underlying_Type (Etype (Comp))))
and then not Has_Warnings_Off (Rectype)
then
Error_Msg_Sloc := Sloc (Comp);
@@ -3013,50 +2795,6 @@ package body Sem_Ch13 is
end if;
end Analyze_Record_Representation_Clause;
- -----------------------------
- -- Check_Component_Overlap --
- -----------------------------
-
- procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id) is
- begin
- if Present (Component_Clause (C1_Ent))
- and then Present (Component_Clause (C2_Ent))
- then
- -- Exclude odd case where we have two tag fields in the same record,
- -- both at location zero. This seems a bit strange, but it seems to
- -- happen in some circumstances ???
-
- if Chars (C1_Ent) = Name_uTag
- and then Chars (C2_Ent) = Name_uTag
- then
- return;
- end if;
-
- -- Here we check if the two fields overlap
-
- declare
- S1 : constant Uint := Component_Bit_Offset (C1_Ent);
- S2 : constant Uint := Component_Bit_Offset (C2_Ent);
- E1 : constant Uint := S1 + Esize (C1_Ent);
- E2 : constant Uint := S2 + Esize (C2_Ent);
-
- begin
- if E2 <= S1 or else E1 <= S2 then
- null;
- else
- Error_Msg_Node_2 :=
- Component_Name (Component_Clause (C2_Ent));
- Error_Msg_Sloc := Sloc (Error_Msg_Node_2);
- Error_Msg_Node_1 :=
- Component_Name (Component_Clause (C1_Ent));
- Error_Msg_N
- ("component& overlaps & #",
- Component_Name (Component_Clause (C1_Ent)));
- end if;
- end;
- end if;
- end Check_Component_Overlap;
-
-----------------------------------
-- Check_Constant_Address_Clause --
-----------------------------------
@@ -3203,11 +2941,8 @@ package body Sem_Ch13 is
-- Otherwise look at the identifier and see if it is OK
- if Ekind (Ent) = E_Named_Integer
- or else
- Ekind (Ent) = E_Named_Real
- or else
- Is_Type (Ent)
+ if Ekind_In (Ent, E_Named_Integer, E_Named_Real)
+ or else Is_Type (Ent)
then
return;
@@ -3403,9 +3138,576 @@ package body Sem_Ch13 is
-- Start of processing for Check_Constant_Address_Clause
begin
- Check_Expr_Constants (Expr);
+ -- If rep_clauses are to be ignored, no need for legality checks. In
+ -- particular, no need to pester user about rep clauses that violate
+ -- the rule on constant addresses, given that these clauses will be
+ -- removed by Freeze before they reach the back end.
+
+ if not Ignore_Rep_Clauses then
+ Check_Expr_Constants (Expr);
+ end if;
end Check_Constant_Address_Clause;
+ ----------------------------------------
+ -- Check_Record_Representation_Clause --
+ ----------------------------------------
+
+ procedure Check_Record_Representation_Clause (N : Node_Id) is
+ Loc : constant Source_Ptr := Sloc (N);
+ Ident : constant Node_Id := Identifier (N);
+ Rectype : Entity_Id;
+ Fent : Entity_Id;
+ CC : Node_Id;
+ Fbit : Uint;
+ Lbit : Uint;
+ Hbit : Uint := Uint_0;
+ Comp : Entity_Id;
+ Pcomp : Entity_Id;
+
+ Max_Bit_So_Far : Uint;
+ -- Records the maximum bit position so far. If all field positions
+ -- are monotonically increasing, then we can skip the circuit for
+ -- checking for overlap, since no overlap is possible.
+
+ Tagged_Parent : Entity_Id := Empty;
+ -- This is set in the case of a derived tagged type for which we have
+ -- Is_Fully_Repped_Tagged_Type True (indicating that all components are
+ -- positioned by record representation clauses). In this case we must
+ -- check for overlap between components of this tagged type, and the
+ -- components of its parent. Tagged_Parent will point to this parent
+ -- type. For all other cases Tagged_Parent is left set to Empty.
+
+ Parent_Last_Bit : Uint;
+ -- Relevant only if Tagged_Parent is set, Parent_Last_Bit indicates the
+ -- last bit position for any field in the parent type. We only need to
+ -- check overlap for fields starting below this point.
+
+ Overlap_Check_Required : Boolean;
+ -- Used to keep track of whether or not an overlap check is required
+
+ Ccount : Natural := 0;
+ -- Number of component clauses in record rep clause
+
+ procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id);
+ -- Given two entities for record components or discriminants, checks
+ -- if they have overlapping component clauses and issues errors if so.
+
+ procedure Find_Component;
+ -- Finds component entity corresponding to current component clause (in
+ -- CC), and sets Comp to the entity, and Fbit/Lbit to the zero origin
+ -- start/stop bits for the field. If there is no matching component or
+ -- if the matching component does not have a component clause, then
+ -- that's an error and Comp is set to Empty, but no error message is
+ -- issued, since the message was already given. Comp is also set to
+ -- Empty if the current "component clause" is in fact a pragma.
+
+ -----------------------------
+ -- Check_Component_Overlap --
+ -----------------------------
+
+ procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id) is
+ CC1 : constant Node_Id := Component_Clause (C1_Ent);
+ CC2 : constant Node_Id := Component_Clause (C2_Ent);
+ begin
+ if Present (CC1) and then Present (CC2) then
+
+ -- Exclude odd case where we have two tag fields in the same
+ -- record, both at location zero. This seems a bit strange, but
+ -- it seems to happen in some circumstances, perhaps on an error.
+
+ if Chars (C1_Ent) = Name_uTag
+ and then
+ Chars (C2_Ent) = Name_uTag
+ then
+ return;
+ end if;
+
+ -- Here we check if the two fields overlap
+
+ declare
+ S1 : constant Uint := Component_Bit_Offset (C1_Ent);
+ S2 : constant Uint := Component_Bit_Offset (C2_Ent);
+ E1 : constant Uint := S1 + Esize (C1_Ent);
+ E2 : constant Uint := S2 + Esize (C2_Ent);
+
+ begin
+ if E2 <= S1 or else E1 <= S2 then
+ null;
+ else
+ Error_Msg_Node_2 := Component_Name (CC2);
+ Error_Msg_Sloc := Sloc (Error_Msg_Node_2);
+ Error_Msg_Node_1 := Component_Name (CC1);
+ Error_Msg_N
+ ("component& overlaps & #", Component_Name (CC1));
+ end if;
+ end;
+ end if;
+ end Check_Component_Overlap;
+
+ --------------------
+ -- Find_Component --
+ --------------------
+
+ procedure Find_Component is
+
+ procedure Search_Component (R : Entity_Id);
+ -- Search components of R for a match. If found, Comp is set.
+
+ ----------------------
+ -- Search_Component --
+ ----------------------
+
+ procedure Search_Component (R : Entity_Id) is
+ begin
+ Comp := First_Component_Or_Discriminant (R);
+ while Present (Comp) loop
+
+ -- Ignore error of attribute name for component name (we
+ -- already gave an error message for this, so no need to
+ -- complain here)
+
+ if Nkind (Component_Name (CC)) = N_Attribute_Reference then
+ null;
+ else
+ exit when Chars (Comp) = Chars (Component_Name (CC));
+ end if;
+
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
+ end Search_Component;
+
+ -- Start of processing for Find_Component
+
+ begin
+ -- Return with Comp set to Empty if we have a pragma
+
+ if Nkind (CC) = N_Pragma then
+ Comp := Empty;
+ return;
+ end if;
+
+ -- Search current record for matching component
+
+ Search_Component (Rectype);
+
+ -- If not found, maybe component of base type that is absent from
+ -- statically constrained first subtype.
+
+ if No (Comp) then
+ Search_Component (Base_Type (Rectype));
+ end if;
+
+ -- If no component, or the component does not reference the component
+ -- clause in question, then there was some previous error for which
+ -- we already gave a message, so just return with Comp Empty.
+
+ if No (Comp)
+ or else Component_Clause (Comp) /= CC
+ then
+ Comp := Empty;
+
+ -- Normal case where we have a component clause
+
+ else
+ Fbit := Component_Bit_Offset (Comp);
+ Lbit := Fbit + Esize (Comp) - 1;
+ end if;
+ end Find_Component;
+
+ -- Start of processing for Check_Record_Representation_Clause
+
+ begin
+ Find_Type (Ident);
+ Rectype := Entity (Ident);
+
+ if Rectype = Any_Type then
+ return;
+ else
+ Rectype := Underlying_Type (Rectype);
+ end if;
+
+ -- See if we have a fully repped derived tagged type
+
+ declare
+ PS : constant Entity_Id := Parent_Subtype (Rectype);
+
+ begin
+ if Present (PS) and then Is_Fully_Repped_Tagged_Type (PS) then
+ Tagged_Parent := PS;
+
+ -- Find maximum bit of any component of the parent type
+
+ Parent_Last_Bit := UI_From_Int (System_Address_Size - 1);
+ Pcomp := First_Entity (Tagged_Parent);
+ while Present (Pcomp) loop
+ if Ekind_In (Pcomp, E_Discriminant, E_Component) then
+ if Component_Bit_Offset (Pcomp) /= No_Uint
+ and then Known_Static_Esize (Pcomp)
+ then
+ Parent_Last_Bit :=
+ UI_Max
+ (Parent_Last_Bit,
+ Component_Bit_Offset (Pcomp) + Esize (Pcomp) - 1);
+ end if;
+
+ Next_Entity (Pcomp);
+ end if;
+ end loop;
+ end if;
+ end;
+
+ -- All done if no component clauses
+
+ CC := First (Component_Clauses (N));
+
+ if No (CC) then
+ return;
+ end if;
+
+ -- If a tag is present, then create a component clause that places it
+ -- at the start of the record (otherwise gigi may place it after other
+ -- fields that have rep clauses).
+
+ Fent := First_Entity (Rectype);
+
+ if Nkind (Fent) = N_Defining_Identifier
+ and then Chars (Fent) = Name_uTag
+ then
+ Set_Component_Bit_Offset (Fent, Uint_0);
+ Set_Normalized_Position (Fent, Uint_0);
+ Set_Normalized_First_Bit (Fent, Uint_0);
+ Set_Normalized_Position_Max (Fent, Uint_0);
+ Init_Esize (Fent, System_Address_Size);
+
+ Set_Component_Clause (Fent,
+ Make_Component_Clause (Loc,
+ Component_Name =>
+ Make_Identifier (Loc,
+ Chars => Name_uTag),
+
+ Position =>
+ Make_Integer_Literal (Loc,
+ Intval => Uint_0),
+
+ First_Bit =>
+ Make_Integer_Literal (Loc,
+ Intval => Uint_0),
+
+ Last_Bit =>
+ Make_Integer_Literal (Loc,
+ UI_From_Int (System_Address_Size))));
+
+ Ccount := Ccount + 1;
+ end if;
+
+ Max_Bit_So_Far := Uint_Minus_1;
+ Overlap_Check_Required := False;
+
+ -- Process the component clauses
+
+ while Present (CC) loop
+ Find_Component;
+
+ if Present (Comp) then
+ Ccount := Ccount + 1;
+
+ if Fbit <= Max_Bit_So_Far then
+ Overlap_Check_Required := True;
+ else
+ Max_Bit_So_Far := Lbit;
+ end if;
+
+ -- Check bit position out of range of specified size
+
+ if Has_Size_Clause (Rectype)
+ and then Esize (Rectype) <= Lbit
+ then
+ Error_Msg_N
+ ("bit number out of range of specified size",
+ Last_Bit (CC));
+
+ -- Check for overlap with tag field
+
+ else
+ if Is_Tagged_Type (Rectype)
+ and then Fbit < System_Address_Size
+ then
+ Error_Msg_NE
+ ("component overlaps tag field of&",
+ Component_Name (CC), Rectype);
+ end if;
+
+ if Hbit < Lbit then
+ Hbit := Lbit;
+ end if;
+ end if;
+
+ -- Check parent overlap if component might overlap parent field
+
+ if Present (Tagged_Parent)
+ and then Fbit <= Parent_Last_Bit
+ then
+ Pcomp := First_Component_Or_Discriminant (Tagged_Parent);
+ while Present (Pcomp) loop
+ if not Is_Tag (Pcomp)
+ and then Chars (Pcomp) /= Name_uParent
+ then
+ Check_Component_Overlap (Comp, Pcomp);
+ end if;
+
+ Next_Component_Or_Discriminant (Pcomp);
+ end loop;
+ end if;
+ end if;
+
+ Next (CC);
+ end loop;
+
+ -- Now that we have processed all the component clauses, check for
+ -- overlap. We have to leave this till last, since the components can
+ -- appear in any arbitrary order in the representation clause.
+
+ -- We do not need this check if all specified ranges were monotonic,
+ -- as recorded by Overlap_Check_Required being False at this stage.
+
+ -- This first section checks if there are any overlapping entries at
+ -- all. It does this by sorting all entries and then seeing if there are
+ -- any overlaps. If there are none, then that is decisive, but if there
+ -- are overlaps, they may still be OK (they may result from fields in
+ -- different variants).
+
+ if Overlap_Check_Required then
+ Overlap_Check1 : declare
+
+ OC_Fbit : array (0 .. Ccount) of Uint;
+ -- First-bit values for component clauses, the value is the offset
+ -- of the first bit of the field from start of record. The zero
+ -- entry is for use in sorting.
+
+ OC_Lbit : array (0 .. Ccount) of Uint;
+ -- Last-bit values for component clauses, the value is the offset
+ -- of the last bit of the field from start of record. The zero
+ -- entry is for use in sorting.
+
+ OC_Count : Natural := 0;
+ -- Count of entries in OC_Fbit and OC_Lbit
+
+ function OC_Lt (Op1, Op2 : Natural) return Boolean;
+ -- Compare routine for Sort
+
+ procedure OC_Move (From : Natural; To : Natural);
+ -- Move routine for Sort
+
+ package Sorting is new GNAT.Heap_Sort_G (OC_Move, OC_Lt);
+
+ -----------
+ -- OC_Lt --
+ -----------
+
+ function OC_Lt (Op1, Op2 : Natural) return Boolean is
+ begin
+ return OC_Fbit (Op1) < OC_Fbit (Op2);
+ end OC_Lt;
+
+ -------------
+ -- OC_Move --
+ -------------
+
+ procedure OC_Move (From : Natural; To : Natural) is
+ begin
+ OC_Fbit (To) := OC_Fbit (From);
+ OC_Lbit (To) := OC_Lbit (From);
+ end OC_Move;
+
+ -- Start of processing for Overlap_Check
+
+ begin
+ CC := First (Component_Clauses (N));
+ while Present (CC) loop
+
+ -- Exclude component clause already marked in error
+
+ if not Error_Posted (CC) then
+ Find_Component;
+
+ if Present (Comp) then
+ OC_Count := OC_Count + 1;
+ OC_Fbit (OC_Count) := Fbit;
+ OC_Lbit (OC_Count) := Lbit;
+ end if;
+ end if;
+
+ Next (CC);
+ end loop;
+
+ Sorting.Sort (OC_Count);
+
+ Overlap_Check_Required := False;
+ for J in 1 .. OC_Count - 1 loop
+ if OC_Lbit (J) >= OC_Fbit (J + 1) then
+ Overlap_Check_Required := True;
+ exit;
+ end if;
+ end loop;
+ end Overlap_Check1;
+ end if;
+
+ -- If Overlap_Check_Required is still True, then we have to do the full
+ -- scale overlap check, since we have at least two fields that do
+ -- overlap, and we need to know if that is OK since they are in
+ -- different variant, or whether we have a definite problem.
+
+ if Overlap_Check_Required then
+ Overlap_Check2 : declare
+ C1_Ent, C2_Ent : Entity_Id;
+ -- Entities of components being checked for overlap
+
+ Clist : Node_Id;
+ -- Component_List node whose Component_Items are being checked
+
+ Citem : Node_Id;
+ -- Component declaration for component being checked
+
+ begin
+ C1_Ent := First_Entity (Base_Type (Rectype));
+
+ -- Loop through all components in record. For each component check
+ -- for overlap with any of the preceding elements on the component
+ -- list containing the component and also, if the component is in
+ -- a variant, check against components outside the case structure.
+ -- This latter test is repeated recursively up the variant tree.
+
+ Main_Component_Loop : while Present (C1_Ent) loop
+ if not Ekind_In (C1_Ent, E_Component, E_Discriminant) then
+ goto Continue_Main_Component_Loop;
+ end if;
+
+ -- Skip overlap check if entity has no declaration node. This
+ -- happens with discriminants in constrained derived types.
+ -- Probably we are missing some checks as a result, but that
+ -- does not seem terribly serious ???
+
+ if No (Declaration_Node (C1_Ent)) then
+ goto Continue_Main_Component_Loop;
+ end if;
+
+ Clist := Parent (List_Containing (Declaration_Node (C1_Ent)));
+
+ -- Loop through component lists that need checking. Check the
+ -- current component list and all lists in variants above us.
+
+ Component_List_Loop : loop
+
+ -- If derived type definition, go to full declaration
+ -- If at outer level, check discriminants if there are any.
+
+ if Nkind (Clist) = N_Derived_Type_Definition then
+ Clist := Parent (Clist);
+ end if;
+
+ -- Outer level of record definition, check discriminants
+
+ if Nkind_In (Clist, N_Full_Type_Declaration,
+ N_Private_Type_Declaration)
+ then
+ if Has_Discriminants (Defining_Identifier (Clist)) then
+ C2_Ent :=
+ First_Discriminant (Defining_Identifier (Clist));
+ while Present (C2_Ent) loop
+ exit when C1_Ent = C2_Ent;
+ Check_Component_Overlap (C1_Ent, C2_Ent);
+ Next_Discriminant (C2_Ent);
+ end loop;
+ end if;
+
+ -- Record extension case
+
+ elsif Nkind (Clist) = N_Derived_Type_Definition then
+ Clist := Empty;
+
+ -- Otherwise check one component list
+
+ else
+ Citem := First (Component_Items (Clist));
+
+ while Present (Citem) loop
+ if Nkind (Citem) = N_Component_Declaration then
+ C2_Ent := Defining_Identifier (Citem);
+ exit when C1_Ent = C2_Ent;
+ Check_Component_Overlap (C1_Ent, C2_Ent);
+ end if;
+
+ Next (Citem);
+ end loop;
+ end if;
+
+ -- Check for variants above us (the parent of the Clist can
+ -- be a variant, in which case its parent is a variant part,
+ -- and the parent of the variant part is a component list
+ -- whose components must all be checked against the current
+ -- component for overlap).
+
+ if Nkind (Parent (Clist)) = N_Variant then
+ Clist := Parent (Parent (Parent (Clist)));
+
+ -- Check for possible discriminant part in record, this
+ -- is treated essentially as another level in the
+ -- recursion. For this case the parent of the component
+ -- list is the record definition, and its parent is the
+ -- full type declaration containing the discriminant
+ -- specifications.
+
+ elsif Nkind (Parent (Clist)) = N_Record_Definition then
+ Clist := Parent (Parent ((Clist)));
+
+ -- If neither of these two cases, we are at the top of
+ -- the tree.
+
+ else
+ exit Component_List_Loop;
+ end if;
+ end loop Component_List_Loop;
+
+ <<Continue_Main_Component_Loop>>
+ Next_Entity (C1_Ent);
+
+ end loop Main_Component_Loop;
+ end Overlap_Check2;
+ end if;
+
+ -- For records that have component clauses for all components, and whose
+ -- size is less than or equal to 32, we need to know the size in the
+ -- front end to activate possible packed array processing where the
+ -- component type is a record.
+
+ -- At this stage Hbit + 1 represents the first unused bit from all the
+ -- component clauses processed, so if the component clauses are
+ -- complete, then this is the length of the record.
+
+ -- For records longer than System.Storage_Unit, and for those where not
+ -- all components have component clauses, the back end determines the
+ -- length (it may for example be appropriate to round up the size
+ -- to some convenient boundary, based on alignment considerations, etc).
+
+ if Unknown_RM_Size (Rectype) and then Hbit + 1 <= 32 then
+
+ -- Nothing to do if at least one component has no component clause
+
+ Comp := First_Component_Or_Discriminant (Rectype);
+ while Present (Comp) loop
+ exit when No (Component_Clause (Comp));
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
+
+ -- If we fall out of loop, all components have component clauses
+ -- and so we can set the size to the maximum value.
+
+ if No (Comp) then
+ Set_RM_Size (Rectype, Hbit + 1);
+ end if;
+ end if;
+ end Check_Record_Representation_Clause;
+
----------------
-- Check_Size --
----------------
@@ -3879,9 +4181,10 @@ package body Sem_Ch13 is
Out_Present => Out_P,
Parameter_Type => T_Ref));
- Spec := Make_Procedure_Specification (Loc,
- Defining_Unit_Name => Subp_Id,
- Parameter_Specifications => Formals);
+ Spec :=
+ Make_Procedure_Specification (Loc,
+ Defining_Unit_Name => Subp_Id,
+ Parameter_Specifications => Formals);
end if;
return Spec;
@@ -3955,8 +4258,7 @@ package body Sem_Ch13 is
elsif Is_Type (T)
and then Is_Generic_Type (Root_Type (T))
then
- Error_Msg_N
- ("representation item not allowed for generic type", N);
+ Error_Msg_N ("representation item not allowed for generic type", N);
return True;
end if;
diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads
index 93587fd38d2..b95eed60a92 100644
--- a/gcc/ada/sem_ch13.ads
+++ b/gcc/ada/sem_ch13.ads
@@ -38,9 +38,17 @@ package Sem_Ch13 is
procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id);
-- Called from Freeze where R is a record entity for which reverse bit
-- order is specified and there is at least one component clause. Adjusts
- -- component positions according to Ada 2005 AI-133. Note that this is only
- -- called in Ada 2005 mode. The Ada 95 handling for bit order is entirely
- -- contained in Freeze.
+ -- component positions according to either Ada 95 or Ada 2005 (AI-133).
+
+ procedure Check_Record_Representation_Clause (N : Node_Id);
+ -- This procedure completes the analysis of a record representation clause
+ -- N. It is called at freeze time after adjustment of component clause bit
+ -- positions for possible non-standard bit order. In the case of Ada 2005
+ -- (machine scalar) mode, this adjustment can make substantial changes, so
+ -- some checks, in particular for component overlaps cannot be done at the
+ -- time the record representation clause is first seen, but must be delayed
+ -- till freeze time, and in particular is called after calling the above
+ -- procedure for adjusting record bit positions for reverse bit order.
procedure Initialize;
-- Initialize internal tables for new compilation
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index f0463aaac94..d5b39f99f9d 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -68,6 +68,7 @@ with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
with Stand; use Stand;
with Sinfo; use Sinfo;
+with Sinput; use Sinput;
with Snames; use Snames;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
@@ -1037,8 +1038,8 @@ package body Sem_Ch3 is
begin
-- Associate the Itype node with the inner full-type declaration or
- -- subprogram spec. This is required to handle nested anonymous
- -- declarations. For example:
+ -- subprogram spec or entry body. This is required to handle nested
+ -- anonymous declarations. For example:
-- procedure P
-- (X : access procedure
@@ -1050,7 +1051,9 @@ package body Sem_Ch3 is
N_Private_Type_Declaration,
N_Private_Extension_Declaration,
N_Procedure_Specification,
- N_Function_Specification)
+ N_Function_Specification,
+ N_Entry_Body)
+
or else
Nkind_In (D_Ityp, N_Object_Declaration,
N_Object_Renaming_Declaration,
@@ -1364,7 +1367,7 @@ package body Sem_Ch3 is
Subtype_Indication =>
New_Occurrence_Of (RTE (RE_Interface_Tag), Loc));
- Tag := Make_Defining_Identifier (Loc, New_Internal_Name ('V'));
+ Tag := Make_Temporary (Loc, 'V');
Decl :=
Make_Component_Declaration (Loc,
@@ -1406,8 +1409,7 @@ package body Sem_Ch3 is
Subtype_Indication =>
New_Occurrence_Of (RTE (RE_Storage_Offset), Loc));
- Offset :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('V'));
+ Offset := Make_Temporary (Loc, 'V');
Decl :=
Make_Component_Declaration (Loc,
@@ -1515,13 +1517,14 @@ package body Sem_Ch3 is
-------------------------------------
procedure Add_Internal_Interface_Entities (Tagged_Type : Entity_Id) is
- Elmt : Elmt_Id;
- Iface : Entity_Id;
- Iface_Elmt : Elmt_Id;
- Iface_Prim : Entity_Id;
- Ifaces_List : Elist_Id;
- New_Subp : Entity_Id := Empty;
- Prim : Entity_Id;
+ Elmt : Elmt_Id;
+ Iface : Entity_Id;
+ Iface_Elmt : Elmt_Id;
+ Iface_Prim : Entity_Id;
+ Ifaces_List : Elist_Id;
+ New_Subp : Entity_Id := Empty;
+ Prim : Entity_Id;
+ Restore_Scope : Boolean := False;
begin
pragma Assert (Ada_Version >= Ada_05
@@ -1530,74 +1533,127 @@ package body Sem_Ch3 is
and then Has_Interfaces (Tagged_Type)
and then not Is_Interface (Tagged_Type));
+ -- Ensure that the internal entities are added to the scope of the type
+
+ if Scope (Tagged_Type) /= Current_Scope then
+ Push_Scope (Scope (Tagged_Type));
+ Restore_Scope := True;
+ end if;
+
Collect_Interfaces (Tagged_Type, Ifaces_List);
Iface_Elmt := First_Elmt (Ifaces_List);
while Present (Iface_Elmt) loop
Iface := Node (Iface_Elmt);
- -- Exclude from this processing interfaces that are parents of
- -- Tagged_Type because their primitives are located in the primary
- -- dispatch table (and hence no auxiliary internal entities are
- -- required to handle secondary dispatch tables in such case).
+ -- Originally we excluded here from this processing interfaces that
+ -- are parents of Tagged_Type because their primitives are located
+ -- in the primary dispatch table (and hence no auxiliary internal
+ -- entities are required to handle secondary dispatch tables in such
+ -- case). However, these auxiliary entities are also required to
+ -- handle derivations of interfaces in formals of generics (see
+ -- Derive_Subprograms).
- if not Is_Ancestor (Iface, Tagged_Type) then
- Elmt := First_Elmt (Primitive_Operations (Iface));
- while Present (Elmt) loop
- Iface_Prim := Node (Elmt);
+ Elmt := First_Elmt (Primitive_Operations (Iface));
+ while Present (Elmt) loop
+ Iface_Prim := Node (Elmt);
- if not Is_Predefined_Dispatching_Operation (Iface_Prim) then
- Prim :=
- Find_Primitive_Covering_Interface
- (Tagged_Type => Tagged_Type,
- Iface_Prim => Iface_Prim);
-
- pragma Assert (Present (Prim));
-
- Derive_Subprogram
- (New_Subp => New_Subp,
- Parent_Subp => Iface_Prim,
- Derived_Type => Tagged_Type,
- Parent_Type => Iface);
-
- -- Ada 2005 (AI-251): Decorate internal entity Iface_Subp
- -- associated with interface types. These entities are
- -- only registered in the list of primitives of its
- -- corresponding tagged type because they are only used
- -- to fill the contents of the secondary dispatch tables.
- -- Therefore they are removed from the homonym chains.
-
- Set_Is_Hidden (New_Subp);
- Set_Is_Internal (New_Subp);
- Set_Alias (New_Subp, Prim);
- Set_Is_Abstract_Subprogram (New_Subp,
- Is_Abstract_Subprogram (Prim));
- Set_Interface_Alias (New_Subp, Iface_Prim);
-
- -- Internal entities associated with interface types are
- -- only registered in the list of primitives of the tagged
- -- type. They are only used to fill the contents of the
- -- secondary dispatch tables. Therefore they are not needed
- -- in the homonym chains.
-
- Remove_Homonym (New_Subp);
-
- -- Hidden entities associated with interfaces must have set
- -- the Has_Delay_Freeze attribute to ensure that, in case of
- -- locally defined tagged types (or compiling with static
- -- dispatch tables generation disabled) the corresponding
- -- entry of the secondary dispatch table is filled when
- -- such an entity is frozen.
-
- Set_Has_Delayed_Freeze (New_Subp);
+ if not Is_Predefined_Dispatching_Operation (Iface_Prim) then
+ Prim :=
+ Find_Primitive_Covering_Interface
+ (Tagged_Type => Tagged_Type,
+ Iface_Prim => Iface_Prim);
+
+ -- Handle cases where the type has no primitive covering this
+ -- interface primitive.
+
+ if No (Prim) then
+
+ -- if the tagged type is defined at library level then we
+ -- invoke Check_Abstract_Overriding to report the error
+ -- and thus avoid generating the dispatch tables.
+
+ if Is_Library_Level_Tagged_Type (Tagged_Type) then
+ Check_Abstract_Overriding (Tagged_Type);
+ pragma Assert (Serious_Errors_Detected > 0);
+ return;
+
+ -- For tagged types defined in nested scopes it is still
+ -- possible to cover this interface primitive by means of
+ -- late overriding (see Override_Dispatching_Operation).
+
+ -- Search in the list of primitives of the type for the
+ -- entity that will be overridden in such case to reference
+ -- it in the internal entity that we build here. If the
+ -- primitive is not overridden then the error will be
+ -- reported later as part of the analysis of entities
+ -- defined in the enclosing scope.
+
+ else
+ declare
+ El : Elmt_Id;
+
+ begin
+ El := First_Elmt (Primitive_Operations (Tagged_Type));
+ while Present (El)
+ and then Alias (Node (El)) /= Iface_Prim
+ loop
+ Next_Elmt (El);
+ end loop;
+
+ pragma Assert (Present (El));
+ Prim := Node (El);
+ end;
+ end if;
end if;
- Next_Elmt (Elmt);
- end loop;
- end if;
+ Derive_Subprogram
+ (New_Subp => New_Subp,
+ Parent_Subp => Iface_Prim,
+ Derived_Type => Tagged_Type,
+ Parent_Type => Iface);
+
+ -- Ada 2005 (AI-251): Decorate internal entity Iface_Subp
+ -- associated with interface types. These entities are
+ -- only registered in the list of primitives of its
+ -- corresponding tagged type because they are only used
+ -- to fill the contents of the secondary dispatch tables.
+ -- Therefore they are removed from the homonym chains.
+
+ Set_Is_Hidden (New_Subp);
+ Set_Is_Internal (New_Subp);
+ Set_Alias (New_Subp, Prim);
+ Set_Is_Abstract_Subprogram
+ (New_Subp, Is_Abstract_Subprogram (Prim));
+ Set_Interface_Alias (New_Subp, Iface_Prim);
+
+ -- Internal entities associated with interface types are
+ -- only registered in the list of primitives of the tagged
+ -- type. They are only used to fill the contents of the
+ -- secondary dispatch tables. Therefore they are not needed
+ -- in the homonym chains.
+
+ Remove_Homonym (New_Subp);
+
+ -- Hidden entities associated with interfaces must have set
+ -- the Has_Delay_Freeze attribute to ensure that, in case of
+ -- locally defined tagged types (or compiling with static
+ -- dispatch tables generation disabled) the corresponding
+ -- entry of the secondary dispatch table is filled when
+ -- such an entity is frozen.
+
+ Set_Has_Delayed_Freeze (New_Subp);
+ end if;
+
+ Next_Elmt (Elmt);
+ end loop;
Next_Elmt (Iface_Elmt);
end loop;
+
+ if Restore_Scope then
+ Pop_Scope;
+ end if;
end Add_Internal_Interface_Entities;
-----------------------------------
@@ -1913,8 +1969,7 @@ package body Sem_Ch3 is
if Is_Interface (Root_Type (Current_Scope)) then
Error_Msg_N
("\limitedness is not inherited from limited interface", N);
- Error_Msg_N
- ("\add LIMITED to type indication", N);
+ Error_Msg_N ("\add LIMITED to type indication", N);
end if;
Explain_Limited_Type (T, N);
@@ -2141,17 +2196,6 @@ package body Sem_Ch3 is
or else Synchronized_Present (Def)
or else Task_Present (Def));
- Set_Is_Protected_Interface (T, Protected_Present (Def));
- Set_Is_Task_Interface (T, Task_Present (Def));
-
- -- Type is a synchronized interface if it includes the keyword task,
- -- protected, or synchronized.
-
- Set_Is_Synchronized_Interface
- (T, Synchronized_Present (Def)
- or else Protected_Present (Def)
- or else Task_Present (Def));
-
Set_Interfaces (T, New_Elmt_List);
Set_Primitive_Operations (T, New_Elmt_List);
@@ -2161,9 +2205,6 @@ package body Sem_Ch3 is
if Present (CW) then
Set_Is_Interface (CW);
Set_Is_Limited_Interface (CW, Is_Limited_Interface (T));
- Set_Is_Protected_Interface (CW, Is_Protected_Interface (T));
- Set_Is_Synchronized_Interface (CW, Is_Synchronized_Interface (T));
- Set_Is_Task_Interface (CW, Is_Task_Interface (T));
end if;
-- Check runtime support for synchronized interfaces
@@ -3285,9 +3326,7 @@ package body Sem_Ch3 is
("parent of type extension must be a tagged type ", Indic);
return;
- elsif Ekind (Parent_Type) = E_Void
- or else Ekind (Parent_Type) = E_Incomplete_Type
- then
+ elsif Ekind_In (Parent_Type, E_Void, E_Incomplete_Type) then
Error_Msg_N ("premature derivation of incomplete type", Indic);
return;
@@ -3750,10 +3789,10 @@ package body Sem_Ch3 is
if Present (Generic_Parent_Type (N))
and then
(Nkind
- (Parent (Generic_Parent_Type (N))) /= N_Formal_Type_Declaration
+ (Parent (Generic_Parent_Type (N))) /= N_Formal_Type_Declaration
or else Nkind
(Formal_Type_Definition (Parent (Generic_Parent_Type (N))))
- /= N_Formal_Private_Type_Definition)
+ /= N_Formal_Private_Type_Definition)
then
if Is_Tagged_Type (Id) then
@@ -4325,9 +4364,7 @@ package body Sem_Ch3 is
Decl : Entity_Id;
begin
- New_E :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ New_E := Make_Temporary (Loc, 'T');
Set_Is_Internal (New_E);
Decl :=
@@ -4576,10 +4613,7 @@ package body Sem_Ch3 is
Curr_Scope : constant Scope_Stack_Entry :=
Scope_Stack.Table (Scope_Stack.Last);
- Anon : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
-
+ Anon : constant Entity_Id := Make_Temporary (Loc, 'S');
Acc : Node_Id;
Comp : Node_Id;
Decl : Node_Id;
@@ -4921,9 +4955,7 @@ package body Sem_Ch3 is
is
Loc : constant Source_Ptr := Sloc (N);
- Corr_Record : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
-
+ Corr_Record : constant Entity_Id := Make_Temporary (Loc, 'C');
Corr_Decl : Node_Id;
Corr_Decl_Needed : Boolean;
-- If the derived type has fewer discriminants than its parent, the
@@ -5726,9 +5758,7 @@ package body Sem_Ch3 is
and then Expander_Active
then
declare
- Full_Der : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Full_Der : constant Entity_Id := Make_Temporary (Loc, 'T');
New_Ext : constant Node_Id :=
Copy_Separate_Tree
(Record_Extension_Part (Type_Definition (N)));
@@ -6778,6 +6808,15 @@ package body Sem_Ch3 is
Mark_Rewrite_Insertion (New_Decl);
Insert_Before (N, New_Decl);
+ -- In the extension case, make sure ancestor is frozen appropriately
+ -- (see also non-discriminated case below).
+
+ if Present (Record_Extension_Part (Type_Def))
+ or else Is_Interface (Parent_Base)
+ then
+ Freeze_Before (New_Decl, Parent_Type);
+ end if;
+
-- Note that this call passes False for the Derive_Subps parameter
-- because subprogram derivation is deferred until after creating
-- the subtype (see below).
@@ -6868,9 +6907,7 @@ package body Sem_Ch3 is
-- The declaration of a specific descendant of an interface type
-- freezes the interface type (RM 13.14).
- if not Private_Extension
- or else Is_Interface (Parent_Base)
- then
+ if not Private_Extension or else Is_Interface (Parent_Base) then
Freeze_Before (N, Parent_Type);
end if;
@@ -6954,9 +6991,8 @@ package body Sem_Ch3 is
-- Ada 2005 (AI-251)
- if Ada_Version = Ada_05
- and then Is_Tagged
- then
+ if Ada_Version >= Ada_05 and then Is_Tagged then
+
-- "The declaration of a specific descendant of an interface type
-- freezes the interface type" (RM 13.14).
@@ -7356,6 +7392,27 @@ package body Sem_Ch3 is
Exclude_Parents => True);
Set_Interfaces (Derived_Type, Ifaces_List);
+
+ -- If the derived type is the anonymous type created for
+ -- a declaration whose parent has a constraint, propagate
+ -- the interface list to the source type. This must be done
+ -- prior to the completion of the analysis of the source type
+ -- because the components in the extension may contain current
+ -- instances whose legality depends on some ancestor.
+
+ if Is_Itype (Derived_Type) then
+ declare
+ Def : constant Node_Id :=
+ Associated_Node_For_Itype (Derived_Type);
+ begin
+ if Present (Def)
+ and then Nkind (Def) = N_Full_Type_Declaration
+ then
+ Set_Interfaces
+ (Defining_Identifier (Def), Ifaces_List);
+ end if;
+ end;
+ end if;
end;
end if;
@@ -7527,9 +7584,7 @@ package body Sem_Ch3 is
begin
D := First_Entity (Derived_Type);
while Present (D) loop
- if Ekind (D) = E_Discriminant
- or else Ekind (D) = E_Component
- then
+ if Ekind_In (D, E_Discriminant, E_Component) then
if Is_Itype (Etype (D))
and then Ekind (Etype (D)) = E_Anonymous_Access_Type
then
@@ -7704,6 +7759,7 @@ package body Sem_Ch3 is
Set_Ekind (D_Minal, E_In_Parameter);
Set_Mechanism (D_Minal, Default_Mechanism);
Set_Etype (D_Minal, Etype (Discrim));
+ Set_Scope (D_Minal, Current_Scope);
Set_Discriminal (Discrim, D_Minal);
Set_Discriminal_Link (D_Minal, Discrim);
@@ -7720,6 +7776,7 @@ package body Sem_Ch3 is
Set_Ekind (CR_Disc, E_In_Parameter);
Set_Mechanism (CR_Disc, Default_Mechanism);
Set_Etype (CR_Disc, Etype (Discrim));
+ Set_Scope (CR_Disc, Current_Scope);
Set_Discriminal_Link (CR_Disc, Discrim);
Set_CR_Discriminant (Discrim, CR_Disc);
end if;
@@ -8566,8 +8623,7 @@ package body Sem_Ch3 is
-- them all, and not just the first one).
Error_Msg_Node_2 := Subp;
- Error_Msg_N
- ("nonabstract type& has abstract subprogram&!", T);
+ Error_Msg_N ("nonabstract type& has abstract subprogram&!", T);
end if;
end if;
@@ -8720,9 +8776,7 @@ package body Sem_Ch3 is
begin
if not Comes_From_Source (E) then
- if Ekind (E) = E_Task_Type
- or else Ekind (E) = E_Protected_Type
- then
+ if Ekind_In (E, E_Task_Type, E_Protected_Type) then
-- It may be an anonymous protected type created for a
-- single variable. Post error on variable, if present.
@@ -8770,8 +8824,7 @@ package body Sem_Ch3 is
Error_Msg_NE
("missing full declaration for }", Parent (E), E);
else
- Error_Msg_NE
- ("missing body for &", Parent (E), E);
+ Error_Msg_NE ("missing body for &", Parent (E), E);
end if;
-- Package body has no completion for a declaration that appears
@@ -8782,8 +8835,7 @@ package body Sem_Ch3 is
Error_Msg_Sloc := Sloc (E);
if Is_Type (E) then
- Error_Msg_NE
- ("missing full declaration for }!", Body_Id, E);
+ Error_Msg_NE ("missing full declaration for }!", Body_Id, E);
elsif Is_Overloadable (E)
and then Current_Entity_In_Scope (E) /= E
@@ -9563,7 +9615,14 @@ package body Sem_Ch3 is
if Is_Tagged_Type (Full_Base) then
Set_Is_Tagged_Type (Full);
Set_Primitive_Operations (Full, Primitive_Operations (Full_Base));
- Set_Class_Wide_Type (Full, Class_Wide_Type (Full_Base));
+
+ -- Inherit class_wide type of full_base in case the partial view was
+ -- not tagged. Otherwise it has already been created when the private
+ -- subtype was analyzed.
+
+ if No (Class_Wide_Type (Full)) then
+ Set_Class_Wide_Type (Full, Class_Wide_Type (Full_Base));
+ end if;
-- If this is a subtype of a protected or task type, constrain its
-- corresponding record, unless this is a subtype without constraints,
@@ -9633,14 +9692,11 @@ package body Sem_Ch3 is
then
declare
Loc : constant Source_Ptr := Sloc (N);
- Def_Id : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S'));
- Decl : constant Node_Id :=
+ Def_Id : constant Entity_Id := Make_Temporary (Loc, 'S');
+ Decl : constant Node_Id :=
Make_Subtype_Declaration (Loc,
- Defining_Identifier =>
- Def_Id,
- Subtype_Indication =>
+ Defining_Identifier => Def_Id,
+ Subtype_Indication =>
Relocate_Node (Curr_Obj_Def));
begin
@@ -9802,13 +9858,15 @@ package body Sem_Ch3 is
and then not In_Private_Part (Current_Scope)
then
Error_Msg_Sloc := Sloc (Prev);
- Error_Msg_N ("full constant for declaration#"
- & " must be in private part", N);
+ Error_Msg_N
+ ("full constant for declaration#"
+ & " must be in private part", N);
elsif Ekind (Current_Scope) = E_Package
- and then List_Containing (Parent (Prev))
- /= Visible_Declarations
- (Specification (Unit_Declaration_Node (Current_Scope)))
+ and then
+ List_Containing (Parent (Prev)) /=
+ Visible_Declarations
+ (Specification (Unit_Declaration_Node (Current_Scope)))
then
Error_Msg_N
("deferred constant must be declared in visible part",
@@ -10055,8 +10113,7 @@ package body Sem_Ch3 is
-- is such an array type... (RM 3.6.1)
if Is_Constrained (T) then
- Error_Msg_N
- ("array type is already constrained", Subtype_Mark (SI));
+ Error_Msg_N ("array type is already constrained", Subtype_Mark (SI));
Constraint_OK := False;
else
@@ -10804,8 +10861,7 @@ package body Sem_Ch3 is
Error_Msg_N
("(Ada 2005) incomplete subtype may not be constrained", C);
else
- Error_Msg_N
- ("invalid constraint: type has no discriminant", C);
+ Error_Msg_N ("invalid constraint: type has no discriminant", C);
end if;
Fixup_Bad_Constraint;
@@ -11043,6 +11099,7 @@ package body Sem_Ch3 is
else
Set_Ekind (Def_Id, E_Enumeration_Subtype);
Set_Is_Character_Type (Def_Id, Is_Character_Type (T));
+ Set_First_Literal (Def_Id, First_Literal (T));
end if;
Set_Size_Info (Def_Id, (T));
@@ -11283,6 +11340,7 @@ package body Sem_Ch3 is
Set_Is_Public (Full, Is_Public (Priv));
Set_Is_Pure (Full, Is_Pure (Priv));
Set_Is_Tagged_Type (Full, Is_Tagged_Type (Priv));
+ Set_Has_Pragma_Unmodified (Full, Has_Pragma_Unmodified (Priv));
Set_Has_Pragma_Unreferenced (Full, Has_Pragma_Unreferenced (Priv));
Set_Has_Pragma_Unreferenced_Objects
(Full, Has_Pragma_Unreferenced_Objects
@@ -11318,10 +11376,10 @@ package body Sem_Ch3 is
Access_Types_To_Process (Freeze_Node (Priv)));
end if;
- -- Swap the two entities. Now Privat is the full type entity and
- -- Full is the private one. They will be swapped back at the end
- -- of the private part. This swapping ensures that the entity that
- -- is visible in the private part is the full declaration.
+ -- Swap the two entities. Now Privat is the full type entity and Full is
+ -- the private one. They will be swapped back at the end of the private
+ -- part. This swapping ensures that the entity that is visible in the
+ -- private part is the full declaration.
Exchange_Entities (Priv, Full);
Append_Entity (Full, Scope (Full));
@@ -11927,7 +11985,7 @@ package body Sem_Ch3 is
-- non-abstract tagged types that can reference abstract primitives
-- through its Alias attribute are the internal entities that have
-- attribute Interface_Alias, and these entities are generated later
- -- by Freeze_Record_Type).
+ -- by Add_Internal_Interface_Entities).
if In_Private_Part (Current_Scope)
and then Is_Abstract_Type (Parent_Type)
@@ -12706,6 +12764,12 @@ package body Sem_Ch3 is
-- corresponding operations of the actual.
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)));
+
Derive_Subprogram
(New_Subp, Subp, Derived_Type, Parent_Base, Node (Act_Elmt));
@@ -12790,13 +12854,13 @@ package body Sem_Ch3 is
Subp := Node (Elmt);
Alias_Subp := Ultimate_Alias (Subp);
- -- At this early stage Derived_Type has no entities with attribute
- -- Interface_Alias. In addition, such primitives are always
- -- located at the end of the list of primitives of Parent_Type.
- -- Therefore, if found we can safely stop processing pending
- -- entities.
+ -- Do not derive internal entities of the parent that link
+ -- interface primitives and its covering primitive. These
+ -- entities will be added to this type when frozen.
- exit when Present (Interface_Alias (Subp));
+ if Present (Interface_Alias (Subp)) then
+ goto Continue;
+ end if;
-- If the generic actual is present find the corresponding
-- operation in the generic actual. If the parent type is a
@@ -12810,27 +12874,88 @@ package body Sem_Ch3 is
if Need_Search
or else
(Present (Generic_Actual)
- and then Present (Act_Subp)
- and then not Primitive_Names_Match (Subp, Act_Subp))
+ and then Present (Act_Subp)
+ and then not
+ (Primitive_Names_Match (Subp, Act_Subp)
+ and then
+ Type_Conformant (Subp, Act_Subp,
+ Skip_Controlling_Formals => True)))
then
pragma Assert (not Is_Ancestor (Parent_Base, Generic_Actual));
- pragma Assert (Is_Interface (Parent_Base));
- -- Remember that we need searching for all the pending
- -- primitives
+ -- Remember that we need searching for all pending primitives
Need_Search := True;
-- Handle entities associated with interface primitives
- if Present (Alias (Subp))
- and then Is_Interface (Find_Dispatching_Type (Alias (Subp)))
+ if Present (Alias_Subp)
+ and then Is_Interface (Find_Dispatching_Type (Alias_Subp))
and then not Is_Predefined_Dispatching_Operation (Subp)
then
+ -- Search for the primitive in the homonym chain
+
Act_Subp :=
Find_Primitive_Covering_Interface
(Tagged_Type => Generic_Actual,
- Iface_Prim => Subp);
+ Iface_Prim => Alias_Subp);
+
+ -- Previous search may not locate primitives covering
+ -- interfaces defined in generics units or instantiations.
+ -- (it fails if the covering primitive has formals whose
+ -- type is also defined in generics or instantiations).
+ -- In such case we search in the list of primitives of the
+ -- generic actual for the internal entity that links the
+ -- interface primitive and the covering primitive.
+
+ if No (Act_Subp)
+ and then Is_Generic_Type (Parent_Type)
+ then
+ -- This code has been designed to handle only generic
+ -- formals that implement interfaces that are defined
+ -- in a generic unit or instantiation. If this code is
+ -- needed for other cases we must review it because
+ -- (given that it relies on Original_Location to locate
+ -- the primitive of Generic_Actual that covers the
+ -- interface) it could leave linked through attribute
+ -- Alias entities of unrelated instantiations).
+
+ pragma Assert
+ (Is_Generic_Unit
+ (Scope (Find_Dispatching_Type (Alias_Subp)))
+ 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;
+ begin
+ Elmt :=
+ First_Elmt (Primitive_Operations (Generic_Actual));
+
+ Search : while Present (Elmt) loop
+ Prim := Node (Elmt);
+
+ if Present (Interface_Alias (Prim))
+ and then Original_Location
+ (Sloc (Interface_Alias (Prim)))
+ = Iface_Prim_Loc
+ then
+ Act_Subp := Alias (Prim);
+ exit Search;
+ end if;
+
+ Next_Elmt (Elmt);
+ end loop Search;
+ end;
+ end if;
+
+ pragma Assert (Present (Act_Subp)
+ or else Is_Abstract_Type (Generic_Actual)
+ or else Serious_Errors_Detected > 0);
-- Handle predefined primitives plus the rest of user-defined
-- primitives
@@ -12841,12 +12966,17 @@ package body Sem_Ch3 is
Act_Subp := Node (Act_Elmt);
exit when Primitive_Names_Match (Subp, Act_Subp)
- and then Type_Conformant (Subp, Act_Subp,
- Skip_Controlling_Formals => True)
+ and then Type_Conformant
+ (Subp, Act_Subp,
+ Skip_Controlling_Formals => True)
and then No (Interface_Alias (Act_Subp));
Next_Elmt (Act_Elmt);
end loop;
+
+ if No (Act_Elmt) then
+ Act_Subp := Empty;
+ end if;
end if;
end if;
@@ -12871,7 +13001,7 @@ package body Sem_Ch3 is
and then Is_Interface (Find_Dispatching_Type (Alias_Subp))
and then not
(Nkind (Parent (Alias_Subp)) = N_Procedure_Specification
- and then Null_Present (Parent (Alias_Subp)))
+ and then Null_Present (Parent (Alias_Subp)))
then
Derive_Subprogram
(New_Subp => New_Subp,
@@ -12905,6 +13035,7 @@ package body Sem_Ch3 is
Act_Subp := Node (Act_Elmt);
end if;
+ <<Continue>>
Next_Elmt (Elmt);
end loop;
@@ -13334,9 +13465,7 @@ package body Sem_Ch3 is
-- Check for early use of incomplete or private type
- if Ekind (Parent_Type) = E_Void
- or else Ekind (Parent_Type) = E_Incomplete_Type
- then
+ if Ekind_In (Parent_Type, E_Void, E_Incomplete_Type) then
Error_Msg_N ("premature derivation of incomplete type", Indic);
return;
@@ -13480,8 +13609,9 @@ package body Sem_Ch3 is
(not Is_Interface (Parent_Type)
or else not Is_Limited_Interface (Parent_Type))
then
- Error_Msg_NE ("parent type& of limited type must be limited",
- N, Parent_Type);
+ Error_Msg_NE
+ ("parent type& of limited type must be limited",
+ N, Parent_Type);
end if;
end if;
end Derived_Type_Declaration;
@@ -13934,9 +14064,9 @@ package body Sem_Ch3 is
elsif Nkind (Type_Definition (N)) = N_Derived_Type_Definition then
if No (Record_Extension_Part (Type_Definition (N))) then
- Error_Msg_NE (
- "full declaration of } must be a record extension",
- Prev, Id);
+ Error_Msg_NE
+ ("full declaration of } must be a record extension",
+ Prev, Id);
-- Set some attributes to produce a usable full view
@@ -14757,8 +14887,8 @@ package body Sem_Ch3 is
then
null;
- elsif Ekind (Derived_Base) = E_Private_Type
- or else Ekind (Derived_Base) = E_Limited_Private_Type
+ elsif Ekind_In (Derived_Base, E_Private_Type,
+ E_Limited_Private_Type)
then
null;
@@ -14926,9 +15056,7 @@ package body Sem_Ch3 is
-- Start of processing for Is_Visible_Component
begin
- if Ekind (C) = E_Component
- or else Ekind (C) = E_Discriminant
- then
+ if Ekind_In (C, E_Component, E_Discriminant) then
Original_Comp := Original_Record_Component (C);
end if;
@@ -16246,15 +16374,17 @@ package body Sem_Ch3 is
Iface := Find_Hidden_Interface (Priv_T_Ifaces, Full_T_Ifaces);
if Present (Iface) then
- Error_Msg_NE ("interface & not implemented by full type " &
- "(RM-2005 7.3 (7.3/2))", Priv_T, Iface);
+ Error_Msg_NE
+ ("interface & not implemented by full type " &
+ "(RM-2005 7.3 (7.3/2))", Priv_T, Iface);
end if;
Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces);
if Present (Iface) then
- Error_Msg_NE ("interface & not implemented by partial view " &
- "(RM-2005 7.3 (7.3/2))", Full_T, Iface);
+ Error_Msg_NE
+ ("interface & not implemented by partial view " &
+ "(RM-2005 7.3 (7.3/2))", Full_T, Iface);
end if;
end;
end if;
@@ -16463,9 +16593,9 @@ package body Sem_Ch3 is
while Present (Priv_Elmt) loop
Priv := Node (Priv_Elmt);
- if Ekind (Priv) = E_Private_Subtype
- or else Ekind (Priv) = E_Limited_Private_Subtype
- or else Ekind (Priv) = E_Record_Subtype_With_Private
+ if Ekind_In (Priv, E_Private_Subtype,
+ E_Limited_Private_Subtype,
+ E_Record_Subtype_With_Private)
then
Full := Make_Defining_Identifier (Sloc (Priv), Chars (Priv));
Set_Is_Itype (Full);
@@ -16613,10 +16743,7 @@ package body Sem_Ch3 is
Prim := Next_Entity (Full_T);
while Present (Prim) and then Prim /= Priv_T loop
- if Ekind (Prim) = E_Procedure
- or else
- Ekind (Prim) = E_Function
- then
+ if Ekind_In (Prim, E_Procedure, E_Function) then
Disp_Typ := Find_Dispatching_Type (Prim);
if Disp_Typ = Full_T
@@ -16646,10 +16773,9 @@ package body Sem_Ch3 is
end loop;
end if;
- -- For the tagged case, the two views can share the same
- -- Primitive Operation list and the same class wide type.
- -- Update attributes of the class-wide type which depend on
- -- the full declaration.
+ -- For the tagged case, the two views can share the same primitive
+ -- operations list and the same class-wide type. Update attributes
+ -- of the class-wide type which depend on the full declaration.
if Is_Tagged_Type (Priv_T) then
Set_Primitive_Operations (Priv_T, Full_List);
@@ -17480,19 +17606,27 @@ package body Sem_Ch3 is
and then Ekind (Current_Entity (Typ)) = E_Incomplete_Type
and then Full_View (Current_Entity (Typ)) = Typ
then
+ if Is_Tagged
+ and then Comes_From_Source (Current_Entity (Typ))
+ and then not Is_Tagged_Type (Current_Entity (Typ))
+ then
+ Make_Class_Wide_Type (Typ);
+ Error_Msg_N
+ ("incomplete view of tagged type should be declared tagged?",
+ Parent (Current_Entity (Typ)));
+ end if;
return;
else
Inc_T := Make_Defining_Identifier (Loc, Chars (Typ));
Decl := Make_Incomplete_Type_Declaration (Loc, Inc_T);
- -- Type has already been inserted into the current scope.
- -- Remove it, and add incomplete declaration for type, so
- -- that subsequent anonymous access types can use it.
- -- The entity is unchained from the homonym list and from
- -- immediate visibility. After analysis, the entity in the
- -- incomplete declaration becomes immediately visible in the
- -- record declaration that follows.
+ -- Type has already been inserted into the current scope. Remove
+ -- it, and add incomplete declaration for type, so that subsequent
+ -- anonymous access types can use it. The entity is unchained from
+ -- the homonym list and from immediate visibility. After analysis,
+ -- the entity in the incomplete declaration becomes immediately
+ -- visible in the record declaration that follows.
H := Current_Entity (Typ);
@@ -17513,8 +17647,9 @@ package body Sem_Ch3 is
Set_Full_View (Inc_T, Typ);
if Is_Tagged then
- -- Create a common class-wide type for both views, and set
- -- the Etype of the class-wide type to the full view.
+
+ -- Create a common class-wide type for both views, and set the
+ -- Etype of the class-wide type to the full view.
Make_Class_Wide_Type (Inc_T);
Set_Class_Wide_Type (Typ, Class_Wide_Type (Inc_T));
@@ -17676,9 +17811,7 @@ package body Sem_Ch3 is
(Access_Definition (Comp_Def));
Build_Incomplete_Type_Declaration;
- Anon_Access :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Anon_Access := Make_Temporary (Loc, 'S');
-- Create a declaration for the anonymous access type: either
-- an access_to_object or an access_to_subprogram.
diff --git a/gcc/ada/sem_ch3.ads b/gcc/ada/sem_ch3.ads
index 6bfa52844d0..18b585f04aa 100644
--- a/gcc/ada/sem_ch3.ads
+++ b/gcc/ada/sem_ch3.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -84,13 +84,11 @@ package Sem_Ch3 is
procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id);
-- Process an access type declaration
- procedure Build_Itype_Reference
- (Ityp : Entity_Id;
- Nod : Node_Id);
+ procedure Build_Itype_Reference (Ityp : Entity_Id; Nod : Node_Id);
-- Create a reference to an internal type, for use by Gigi. The back-end
- -- elaborates itypes on demand, i.e. when their first use is seen. This
- -- can lead to scope anomalies if the first use is within a scope that is
- -- nested within the scope that contains the point of definition of the
+ -- elaborates itypes on demand, i.e. when their first use is seen. This can
+ -- lead to scope anomalies if the first use is within a scope that is
+ -- nested within the scope that contains the point of definition of the
-- itype. The Itype_Reference node forces the elaboration of the itype
-- in the proper scope. The node is inserted after Nod, which is the
-- enclosing declaration that generated Ityp.
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 899b1a05878..743d128e65d 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -43,17 +43,18 @@ with Restrict; use Restrict;
with Rident; use Rident;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
+with Sem_Case; use Sem_Case;
with Sem_Cat; use Sem_Cat;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
-with Sem_SCIL; use Sem_SCIL;
with Sem_Disp; use Sem_Disp;
with Sem_Dist; use Sem_Dist;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
-with Sem_Util; use Sem_Util;
with Sem_Type; use Sem_Type;
+with Sem_Util; use Sem_Util;
+with Sem_Warn; use Sem_Warn;
with Stand; use Stand;
with Sinfo; use Sinfo;
with Snames; use Snames;
@@ -305,8 +306,7 @@ package body Sem_Ch4 is
end if;
if Opnd = Left_Opnd (N) then
- Error_Msg_N
- ("\left operand has the following interpretations", N);
+ Error_Msg_N ("\left operand has the following interpretations", N);
else
Error_Msg_N
("\right operand has the following interpretations", N);
@@ -472,8 +472,7 @@ package body Sem_Ch4 is
end if;
if Expander_Active then
- Def_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
+ Def_Id := Make_Temporary (Loc, 'S');
Insert_Action (E,
Make_Subtype_Declaration (Loc,
@@ -818,10 +817,10 @@ package body Sem_Ch4 is
elsif Nkind (Nam) = N_Selected_Component then
Nam_Ent := Entity (Selector_Name (Nam));
- if Ekind (Nam_Ent) /= E_Entry
- and then Ekind (Nam_Ent) /= E_Entry_Family
- and then Ekind (Nam_Ent) /= E_Function
- and then Ekind (Nam_Ent) /= E_Procedure
+ if not Ekind_In (Nam_Ent, E_Entry,
+ E_Entry_Family,
+ E_Function,
+ E_Procedure)
then
Error_Msg_N ("name in call is not a callable entity", Nam);
Set_Etype (N, Any_Type);
@@ -923,7 +922,21 @@ package body Sem_Ch4 is
end if;
end if;
- Analyze_One_Call (N, Nam_Ent, False, Success);
+ -- If the call has been rewritten from a prefixed call, the first
+ -- parameter has been analyzed, but may need a subsequent
+ -- dereference, so skip its analysis now.
+
+ if N /= Original_Node (N)
+ and then Nkind (Original_Node (N)) = Nkind (N)
+ and then Nkind (Name (N)) /= Nkind (Name (Original_Node (N)))
+ and then Present (Parameter_Associations (N))
+ and then Present (Etype (First (Parameter_Associations (N))))
+ then
+ Analyze_One_Call
+ (N, Nam_Ent, False, Success, Skip_First => True);
+ else
+ Analyze_One_Call (N, Nam_Ent, False, Success);
+ end if;
-- If the interpretation succeeds, mark the proper type of the
-- prefix (any valid candidate will do). If not, remove the
@@ -1035,6 +1048,141 @@ package body Sem_Ch4 is
end if;
end Analyze_Call;
+ -----------------------------
+ -- Analyze_Case_Expression --
+ -----------------------------
+
+ procedure Analyze_Case_Expression (N : Node_Id) is
+ Expr : constant Node_Id := Expression (N);
+ FirstX : constant Node_Id := Expression (First (Alternatives (N)));
+ Alt : Node_Id;
+ Exp_Type : Entity_Id;
+ Exp_Btype : Entity_Id;
+
+ Last_Choice : Nat;
+ Dont_Care : Boolean;
+ Others_Present : Boolean;
+
+ procedure Non_Static_Choice_Error (Choice : Node_Id);
+ -- Error routine invoked by the generic instantiation below when
+ -- the case expression has a non static choice.
+
+ package Case_Choices_Processing is new
+ Generic_Choices_Processing
+ (Get_Alternatives => Alternatives,
+ Get_Choices => Discrete_Choices,
+ Process_Empty_Choice => No_OP,
+ Process_Non_Static_Choice => Non_Static_Choice_Error,
+ Process_Associated_Node => No_OP);
+ use Case_Choices_Processing;
+
+ Case_Table : Choice_Table_Type (1 .. Number_Of_Choices (N));
+
+ -----------------------------
+ -- Non_Static_Choice_Error --
+ -----------------------------
+
+ procedure Non_Static_Choice_Error (Choice : Node_Id) is
+ begin
+ Flag_Non_Static_Expr
+ ("choice given in case expression is not static!", Choice);
+ end Non_Static_Choice_Error;
+
+ -- Start of processing for Analyze_Case_Expression
+
+ begin
+ if Comes_From_Source (N) then
+ Check_Compiler_Unit (N);
+ end if;
+
+ Analyze_And_Resolve (Expr, Any_Discrete);
+ Check_Unset_Reference (Expr);
+ Exp_Type := Etype (Expr);
+ Exp_Btype := Base_Type (Exp_Type);
+
+ Alt := First (Alternatives (N));
+ while Present (Alt) loop
+ Analyze (Expression (Alt));
+ Next (Alt);
+ end loop;
+
+ if not Is_Overloaded (FirstX) then
+ Set_Etype (N, Etype (FirstX));
+
+ else
+ declare
+ I : Interp_Index;
+ It : Interp;
+
+ begin
+ Set_Etype (N, Any_Type);
+
+ Get_First_Interp (FirstX, I, It);
+ while Present (It.Nam) loop
+
+ -- For each intepretation of the first expression, we only
+ -- add the intepretation if every other expression in the
+ -- case expression alternatives has a compatible type.
+
+ Alt := Next (First (Alternatives (N)));
+ while Present (Alt) loop
+ exit when not Has_Compatible_Type (Expression (Alt), It.Typ);
+ Next (Alt);
+ end loop;
+
+ if No (Alt) then
+ Add_One_Interp (N, It.Typ, It.Typ);
+ end if;
+
+ Get_Next_Interp (I, It);
+ end loop;
+ end;
+ end if;
+
+ Exp_Btype := Base_Type (Exp_Type);
+
+ -- The expression must be of a discrete type which must be determinable
+ -- independently of the context in which the expression occurs, but
+ -- using the fact that the expression must be of a discrete type.
+ -- Moreover, the type this expression must not be a character literal
+ -- (which is always ambiguous).
+
+ -- If error already reported by Resolve, nothing more to do
+
+ if Exp_Btype = Any_Discrete
+ or else Exp_Btype = Any_Type
+ then
+ return;
+
+ elsif Exp_Btype = Any_Character then
+ Error_Msg_N
+ ("character literal as case expression is ambiguous", Expr);
+ return;
+ end if;
+
+ -- If the case expression is a formal object of mode in out, then
+ -- treat it as having a nonstatic subtype by forcing use of the base
+ -- type (which has to get passed to Check_Case_Choices below). Also
+ -- use base type when the case expression is parenthesized.
+
+ if Paren_Count (Expr) > 0
+ or else (Is_Entity_Name (Expr)
+ and then Ekind (Entity (Expr)) = E_Generic_In_Out_Parameter)
+ then
+ Exp_Type := Exp_Btype;
+ end if;
+
+ -- Call instantiated Analyze_Choices which does the rest of the work
+
+ Analyze_Choices
+ (N, Exp_Type, Case_Table, Last_Choice, Dont_Care, Others_Present);
+
+ if Exp_Type = Universal_Integer and then not Others_Present then
+ Error_Msg_N
+ ("case on universal integer requires OTHERS choice", Expr);
+ end if;
+ end Analyze_Case_Expression;
+
---------------------------
-- Analyze_Comparison_Op --
---------------------------
@@ -1160,7 +1308,6 @@ package body Sem_Ch4 is
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
-
LT := Base_Type (Etype (L));
RT := Base_Type (Etype (R));
@@ -1237,9 +1384,17 @@ package body Sem_Ch4 is
procedure Analyze_Conditional_Expression (N : Node_Id) is
Condition : constant Node_Id := First (Expressions (N));
Then_Expr : constant Node_Id := Next (Condition);
- Else_Expr : constant Node_Id := Next (Then_Expr);
+ Else_Expr : Node_Id;
begin
+ -- Defend against error of missing expressions from previous error
+
+ if No (Then_Expr) then
+ return;
+ end if;
+
+ Else_Expr := Next (Then_Expr);
+
if Comes_From_Source (N) then
Check_Compiler_Unit (N);
end if;
@@ -1251,8 +1406,13 @@ package body Sem_Ch4 is
Analyze_Expression (Else_Expr);
end if;
+ -- If then expression not overloaded, then that decides the type
+
if not Is_Overloaded (Then_Expr) then
Set_Etype (N, Etype (Then_Expr));
+
+ -- Case where then expression is overloaded
+
else
declare
I : Interp_Index;
@@ -1262,6 +1422,12 @@ package body Sem_Ch4 is
Set_Etype (N, Any_Type);
Get_First_Interp (Then_Expr, I, It);
while Present (It.Nam) loop
+
+ -- For each possible intepretation of the Then Expression,
+ -- add it only if the else expression has a compatible type.
+
+ -- Is this right if Else_Expr is empty?
+
if Has_Compatible_Type (Else_Expr, It.Typ) then
Add_One_Interp (N, It.Typ, It.Typ);
end if;
@@ -1577,6 +1743,25 @@ package body Sem_Ch4 is
Check_Parameterless_Call (N);
end Analyze_Expression;
+ -------------------------------------
+ -- Analyze_Expression_With_Actions --
+ -------------------------------------
+
+ procedure Analyze_Expression_With_Actions (N : Node_Id) is
+ A : Node_Id;
+
+ begin
+ A := First (Actions (N));
+ loop
+ Analyze (A);
+ Next (A);
+ exit when No (A);
+ end loop;
+
+ Analyze_Expression (Expression (N));
+ Set_Etype (N, Etype (Expression (N)));
+ end Analyze_Expression_With_Actions;
+
------------------------------------
-- Analyze_Indexed_Component_Form --
------------------------------------
@@ -1930,7 +2115,8 @@ package body Sem_Ch4 is
elsif Ekind (Etype (P)) = E_Subprogram_Type
or else (Is_Access_Type (Etype (P))
and then
- Ekind (Designated_Type (Etype (P))) = E_Subprogram_Type)
+ Ekind (Designated_Type (Etype (P))) =
+ E_Subprogram_Type)
then
-- Call to access_to-subprogram with possible implicit dereference
@@ -1955,7 +2141,7 @@ package body Sem_Ch4 is
if Ekind (P_T) = E_Subprogram_Type
or else (Is_Access_Type (P_T)
and then
- Ekind (Designated_Type (P_T)) = E_Subprogram_Type)
+ Ekind (Designated_Type (P_T)) = E_Subprogram_Type)
then
Process_Function_Call;
@@ -2158,7 +2344,7 @@ package body Sem_Ch4 is
Analyze_Expression (L);
if No (R)
- and then Extensions_Allowed
+ and then Ada_Version >= Ada_12
then
Analyze_Set_Membership;
return;
@@ -3092,8 +3278,8 @@ package body Sem_Ch4 is
-- Analyze_Selected_Component --
--------------------------------
- -- Prefix is a record type or a task or protected type. In the
- -- later case, the selector must denote a visible entry.
+ -- Prefix is a record type or a task or protected type. In the latter case,
+ -- the selector must denote a visible entry.
procedure Analyze_Selected_Component (N : Node_Id) is
Name : constant Node_Id := Prefix (N);
@@ -3111,6 +3297,9 @@ package body Sem_Ch4 is
-- a class-wide type, we use its root type, whose components are
-- present in the class-wide type.
+ Is_Single_Concurrent_Object : Boolean;
+ -- Set True if the prefix is a single task or a single protected object
+
function Has_Mode_Conformant_Spec (Comp : Entity_Id) return Boolean;
-- It is known that the parent of N denotes a subprogram call. Comp
-- is an overloadable component of the concurrent type of the prefix.
@@ -3281,6 +3470,15 @@ package body Sem_Ch4 is
Type_To_Use := Root_Type (Prefix_Type);
end if;
+ -- If the prefix is a single concurrent object, use its name in error
+ -- messages, rather than that of its anonymous type.
+
+ Is_Single_Concurrent_Object :=
+ Is_Concurrent_Type (Prefix_Type)
+ and then Is_Internal_Name (Chars (Prefix_Type))
+ and then not Is_Derived_Type (Prefix_Type)
+ and then Is_Entity_Name (Name);
+
Comp := First_Entity (Type_To_Use);
-- If the selector has an original discriminant, the node appears in
@@ -3519,9 +3717,8 @@ package body Sem_Ch4 is
return;
else
- Error_Msg_NE
- ("invisible selector for }",
- N, First_Subtype (Prefix_Type));
+ Error_Msg_Node_2 := First_Subtype (Prefix_Type);
+ Error_Msg_NE ("invisible selector& for }", N, Sel);
Set_Entity (Sel, Any_Id);
Set_Etype (N, Any_Type);
end if;
@@ -3566,10 +3763,13 @@ package body Sem_Ch4 is
Has_Candidate := True;
end if;
- elsif Ekind (Comp) = E_Discriminant
- or else Ekind (Comp) = E_Entry_Family
+ -- Note: a selected component may not denote a component of a
+ -- protected type (4.1.3(7)).
+
+ elsif Ekind_In (Comp, E_Discriminant, E_Entry_Family)
or else (In_Scope
- and then Is_Entity_Name (Name))
+ and then not Is_Protected_Type (Prefix_Type)
+ and then Is_Entity_Name (Name))
then
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
@@ -3633,6 +3833,28 @@ package body Sem_Ch4 is
end if;
end if;
+ if Etype (N) = Any_Type and then Is_Protected_Type (Prefix_Type) then
+ -- Case of a prefix of a protected type: selector might denote
+ -- an invisible private component.
+
+ Comp := First_Private_Entity (Base_Type (Prefix_Type));
+ while Present (Comp) and then Chars (Comp) /= Chars (Sel) loop
+ Next_Entity (Comp);
+ end loop;
+
+ if Present (Comp) then
+ if Is_Single_Concurrent_Object then
+ Error_Msg_Node_2 := Entity (Name);
+ Error_Msg_NE ("invisible selector& for &", N, Sel);
+
+ else
+ Error_Msg_Node_2 := First_Subtype (Prefix_Type);
+ Error_Msg_NE ("invisible selector& for }", N, Sel);
+ end if;
+ return;
+ end if;
+ end if;
+
Set_Is_Overloaded (N, Is_Overloaded (Sel));
else
@@ -3645,15 +3867,7 @@ package body Sem_Ch4 is
if Etype (N) = Any_Type then
- -- If the prefix is a single concurrent object, use its name in the
- -- error message, rather than that of its anonymous type.
-
- if Is_Concurrent_Type (Prefix_Type)
- and then Is_Internal_Name (Chars (Prefix_Type))
- and then not Is_Derived_Type (Prefix_Type)
- and then Is_Entity_Name (Name)
- then
-
+ if Is_Single_Concurrent_Object then
Error_Msg_Node_2 := Entity (Name);
Error_Msg_NE ("no selector& for&", N, Sel);
@@ -3890,15 +4104,6 @@ package body Sem_Ch4 is
T : Entity_Id;
begin
- -- Check if the expression is a function call for which we need to
- -- adjust a SCIL dispatching node.
-
- if Generate_SCIL
- and then Nkind (Expr) = N_Function_Call
- then
- Adjust_SCIL_Node (N, Expr);
- end if;
-
-- If Conversion_OK is set, then the Etype is already set, and the
-- only processing required is to analyze the expression. This is
-- used to construct certain "illegal" conversions which are not
@@ -4488,9 +4693,7 @@ package body Sem_Ch4 is
if Nkind (N) = N_Function_Call then
Get_First_Interp (Nam, X, It);
while Present (It.Nam) loop
- if Ekind (It.Nam) = E_Function
- or else Ekind (It.Nam) = E_Operator
- then
+ if Ekind_In (It.Nam, E_Function, E_Operator) then
return;
else
Get_Next_Interp (X, It);
@@ -5302,10 +5505,11 @@ package body Sem_Ch4 is
end if;
end if;
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("operator for} is not directly visible!",
N, First_Subtype (Candidate_Type));
- Error_Msg_N ("use clause would make operation legal!", N);
+ Error_Msg_N -- CODEFIX
+ ("use clause would make operation legal!", N);
return;
-- If either operand is a junk operand (e.g. package name), then
@@ -6180,8 +6384,20 @@ package body Sem_Ch4 is
if Is_Overloaded (Subprog) then
Save_Interps (Subprog, Node_To_Replace);
+
else
Analyze (Node_To_Replace);
+
+ -- If the operation has been rewritten into a call, which may
+ -- get subsequently an explicit dereference, preserve the
+ -- type on the original node (selected component or indexed
+ -- component) for subsequent legality tests, e.g. Is_Variable.
+ -- which examines the original node.
+
+ if Nkind (Node_To_Replace) = N_Function_Call then
+ Set_Etype
+ (Original_Node (Node_To_Replace), Etype (Node_To_Replace));
+ end if;
end if;
end Complete_Object_Operation;
@@ -6649,29 +6865,31 @@ package body Sem_Ch4 is
if Is_Derived_Type (T) then
return Primitive_Operations (T);
- elsif Ekind (Scope (T)) = E_Procedure
- or else Ekind (Scope (T)) = E_Function
- then
+ elsif Ekind_In (Scope (T), E_Procedure, E_Function) then
+
-- Scan the list of generic formals to find subprograms
-- that may have a first controlling formal of the type.
- declare
- Decl : Node_Id;
-
- begin
- Decl :=
- First (Generic_Formal_Declarations
- (Unit_Declaration_Node (Scope (T))));
- while Present (Decl) loop
- if Nkind (Decl) in N_Formal_Subprogram_Declaration then
- Subp := Defining_Entity (Decl);
- Check_Candidate;
- end if;
-
- Next (Decl);
- end loop;
- end;
+ if Nkind (Unit_Declaration_Node (Scope (T)))
+ = N_Generic_Subprogram_Declaration
+ then
+ declare
+ Decl : Node_Id;
+
+ begin
+ Decl :=
+ First (Generic_Formal_Declarations
+ (Unit_Declaration_Node (Scope (T))));
+ while Present (Decl) loop
+ if Nkind (Decl) in N_Formal_Subprogram_Declaration then
+ Subp := Defining_Entity (Decl);
+ Check_Candidate;
+ end if;
+ Next (Decl);
+ end loop;
+ end;
+ end if;
return Candidates;
else
@@ -6681,7 +6899,15 @@ package body Sem_Ch4 is
-- declaration or body (either the one that declares T, or a
-- child unit).
- Subp := First_Entity (Scope (T));
+ -- For a subtype representing a generic actual type, go to the
+ -- base type.
+
+ if Is_Generic_Actual_Type (T) then
+ Subp := First_Entity (Scope (Base_Type (T)));
+ else
+ Subp := First_Entity (Scope (T));
+ end if;
+
while Present (Subp) loop
if Is_Overloadable (Subp) then
Check_Candidate;
@@ -6754,13 +6980,14 @@ package body Sem_Ch4 is
-- corresponding record (base) type.
if Is_Concurrent_Type (Obj_Type) then
- if not Present (Corresponding_Record_Type (Obj_Type)) then
- return False;
+ if Present (Corresponding_Record_Type (Obj_Type)) then
+ Corr_Type := Base_Type (Corresponding_Record_Type (Obj_Type));
+ Elmt := First_Elmt (Primitive_Operations (Corr_Type));
+ else
+ Corr_Type := Obj_Type;
+ Elmt := First_Elmt (Collect_Generic_Type_Ops (Obj_Type));
end if;
- Corr_Type := Base_Type (Corresponding_Record_Type (Obj_Type));
- Elmt := First_Elmt (Primitive_Operations (Corr_Type));
-
elsif not Is_Generic_Type (Obj_Type) then
Corr_Type := Obj_Type;
Elmt := First_Elmt (Primitive_Operations (Obj_Type));
@@ -6777,7 +7004,7 @@ package body Sem_Ch4 is
and then Present (First_Formal (Prim_Op))
and then Valid_First_Argument_Of (Prim_Op)
and then
- (Nkind (Call_Node) = N_Function_Call)
+ (Nkind (Call_Node) = N_Function_Call)
= (Ekind (Prim_Op) = E_Function)
then
-- Ada 2005 (AI-251): If this primitive operation corresponds
diff --git a/gcc/ada/sem_ch4.ads b/gcc/ada/sem_ch4.ads
index 6c8d1a33b55..e5c646f9bb8 100644
--- a/gcc/ada/sem_ch4.ads
+++ b/gcc/ada/sem_ch4.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -30,11 +30,13 @@ package Sem_Ch4 is
procedure Analyze_Allocator (N : Node_Id);
procedure Analyze_Arithmetic_Op (N : Node_Id);
procedure Analyze_Call (N : Node_Id);
+ procedure Analyze_Case_Expression (N : Node_Id);
procedure Analyze_Comparison_Op (N : Node_Id);
procedure Analyze_Concatenation (N : Node_Id);
procedure Analyze_Conditional_Expression (N : Node_Id);
procedure Analyze_Equality_Op (N : Node_Id);
procedure Analyze_Explicit_Dereference (N : Node_Id);
+ procedure Analyze_Expression_With_Actions (N : Node_Id);
procedure Analyze_Logical_Op (N : Node_Id);
procedure Analyze_Membership_Op (N : Node_Id);
procedure Analyze_Negation (N : Node_Id);
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 1f6806b231a..816e12b979e 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -46,7 +46,6 @@ with Sem_Disp; use Sem_Disp;
with Sem_Elab; use Sem_Elab;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
-with Sem_SCIL; use Sem_SCIL;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
@@ -448,14 +447,14 @@ package body Sem_Ch5 is
end if;
return;
- -- Enforce RM 3.9.3 (8): left-hand side cannot be abstract
+ -- Enforce RM 3.9.3 (8): the target of an assignment operation cannot be
+ -- abstract. This is only checked when the assignment Comes_From_Source,
+ -- because in some cases the expander generates such assignments (such
+ -- in the _assign operation for an abstract type).
- elsif Is_Interface (T1)
- and then not Is_Class_Wide_Type (T1)
- then
+ elsif Is_Abstract_Type (T1) and then Comes_From_Source (N) then
Error_Msg_N
- ("target of assignment operation may not be abstract", Lhs);
- return;
+ ("target of assignment operation must not be abstract", Lhs);
end if;
-- Resolution may have updated the subtype, in case the left-hand
@@ -693,10 +692,10 @@ package body Sem_Ch5 is
and then Nkind (Original_Node (Rhs)) not in N_Op
then
if Nkind (Lhs) in N_Has_Entity then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?useless assignment of & to itself!", N, Entity (Lhs));
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?useless assignment of object to itself!", N);
end if;
end if;
@@ -948,7 +947,7 @@ package body Sem_Ch5 is
-- the case statement has a non static choice.
procedure Process_Statements (Alternative : Node_Id);
- -- Analyzes all the statements associated to a case alternative.
+ -- Analyzes all the statements associated with a case alternative.
-- Needed by the generic instantiation below.
package Case_Choices_Processing is new
@@ -998,11 +997,9 @@ package body Sem_Ch5 is
if Is_Entity_Name (Exp) then
Ent := Entity (Exp);
- if Ekind (Ent) = E_Variable
- or else
- Ekind (Ent) = E_In_Out_Parameter
- or else
- Ekind (Ent) = E_Out_Parameter
+ if Ekind_In (Ent, E_Variable,
+ E_In_Out_Parameter,
+ E_Out_Parameter)
then
if List_Length (Choices) = 1
and then Nkind (First (Choices)) in N_Subexpr
@@ -1198,7 +1195,7 @@ package body Sem_Ch5 is
else
Error_Msg_N
("cannot exit from program unit or accept statement", N);
- exit;
+ return;
end if;
end loop;
@@ -1209,6 +1206,11 @@ package body Sem_Ch5 is
Check_Unset_Reference (Cond);
end if;
+ -- Chain exit statement to associated loop entity
+
+ Set_Next_Exit_Statement (N, First_Exit_Statement (Scope_Id));
+ Set_First_Exit_Statement (Scope_Id, N);
+
-- Since the exit may take us out of a loop, any previous assignment
-- statement is not useless, so clear last assignment indications. It
-- is OK to keep other current values, since if the exit statement
@@ -1472,8 +1474,8 @@ package body Sem_Ch5 is
R_Copy : constant Node_Id := New_Copy_Tree (R);
Lo : constant Node_Id := Low_Bound (R);
Hi : constant Node_Id := High_Bound (R);
- New_Lo_Bound : Node_Id := Empty;
- New_Hi_Bound : Node_Id := Empty;
+ New_Lo_Bound : Node_Id;
+ New_Hi_Bound : Node_Id;
Typ : Entity_Id;
Save_Analysis : Boolean;
@@ -1517,9 +1519,7 @@ package body Sem_Ch5 is
Analyze_And_Resolve (Original_Bound, Typ);
- Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Id := Make_Temporary (Loc, 'S', Original_Bound);
-- Normally, the best approach is simply to generate a constant
-- declaration that captures the bound. However, there is a nasty
@@ -1571,15 +1571,6 @@ package body Sem_Ch5 is
Name => New_Occurrence_Of (Id, Loc),
Expression => Relocate_Node (Original_Bound));
- -- If the relocated node is a function call then check if some
- -- SCIL node references it and needs readjustment.
-
- if Generate_SCIL
- and then Nkind (Original_Bound) = N_Function_Call
- then
- Adjust_SCIL_Node (Original_Bound, Expression (Assign));
- end if;
-
Insert_Before (Parent (N), Assign);
Analyze (Assign);
@@ -1718,13 +1709,10 @@ package body Sem_Ch5 is
then
declare
Loc : constant Source_Ptr := Sloc (N);
- Arr : constant Entity_Id :=
- Etype (Entity (Prefix (DS)));
+ Arr : constant Entity_Id := Etype (Entity (Prefix (DS)));
Indx : constant Entity_Id :=
Base_Type (Etype (First_Index (Arr)));
- Subt : constant Entity_Id :=
- Make_Defining_Identifier
- (Loc, New_Internal_Name ('S'));
+ Subt : constant Entity_Id := Make_Temporary (Loc, 'S');
Decl : Node_Id;
begin
@@ -2060,8 +2048,12 @@ package body Sem_Ch5 is
End_Scope;
Kill_Current_Values;
- -- Check for infinite loop. We skip this check for generated code, since
- -- it justs waste time and makes debugging the routine called harder.
+ -- Check for infinite loop. Skip check for generated code, since it
+ -- justs waste time and makes debugging the routine called harder.
+
+ -- Note that we have to wait till the body of the loop is fully analyzed
+ -- before making this call, since Check_Infinite_Loop_Warning relies on
+ -- being able to use semantic visibility information to find references.
if Comes_From_Source (N) then
Check_Infinite_Loop_Warning (N);
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index d1bbf53adf6..cbdaf68180f 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -98,7 +98,7 @@ package body Sem_Ch6 is
-----------------------
procedure Analyze_Return_Statement (N : Node_Id);
- -- Common processing for simple_ and extended_return_statements
+ -- Common processing for simple and extended return statements
procedure Analyze_Function_Return (N : Node_Id);
-- Subsidiary to Analyze_Return_Statement. Called when the return statement
@@ -106,11 +106,12 @@ package body Sem_Ch6 is
procedure Analyze_Return_Type (N : Node_Id);
-- Subsidiary to Process_Formals: analyze subtype mark in function
- -- specification, in a context where the formals are visible and hide
+ -- specification in a context where the formals are visible and hide
-- outer homographs.
procedure Analyze_Subprogram_Body_Helper (N : Node_Id);
- -- Does all the real work of Analyze_Subprogram_Body
+ -- Does all the real work of Analyze_Subprogram_Body. This is split out so
+ -- that we can use RETURN but not skip the debug output at the end.
procedure Analyze_Generic_Subprogram_Body (N : Node_Id; Gen_Id : Entity_Id);
-- Analyze a generic subprogram body. N is the body to be analyzed, and
@@ -514,10 +515,10 @@ package body Sem_Ch6 is
-------------------------------------
procedure Check_Return_Subtype_Indication (Obj_Decl : Node_Id) is
- Return_Obj : constant Node_Id := Defining_Identifier (Obj_Decl);
- R_Stm_Type : constant Entity_Id := Etype (Return_Obj);
- -- Subtype given in the extended return statement;
- -- this must match R_Type.
+ Return_Obj : constant Node_Id := Defining_Identifier (Obj_Decl);
+
+ R_Stm_Type : constant Entity_Id := Etype (Return_Obj);
+ -- Subtype given in the extended return statement (must match R_Type)
Subtype_Ind : constant Node_Id :=
Object_Definition (Original_Node (Obj_Decl));
@@ -542,7 +543,7 @@ package body Sem_Ch6 is
-- True if type of the return object is an anonymous access type
begin
- -- First, avoid cascade errors:
+ -- First, avoid cascaded errors
if Error_Posted (Obj_Decl) or else Error_Posted (Subtype_Ind) then
return;
@@ -773,6 +774,11 @@ package body Sem_Ch6 is
& "null-excluding return?",
Reason => CE_Null_Not_Allowed);
end if;
+
+ -- Apply checks suggested by AI05-0144 (dangerous order dependence)
+ -- (Disabled for now)
+
+ -- Check_Order_Dependence;
end if;
end Analyze_Function_Return;
@@ -978,6 +984,7 @@ package body Sem_Ch6 is
if Style_Check then
Style.Check_Identifier (Body_Id, Gen_Id);
end if;
+
End_Generic;
end Analyze_Generic_Subprogram_Body;
@@ -1037,6 +1044,7 @@ package body Sem_Ch6 is
procedure Analyze_Call_And_Resolve;
-- Do Analyze and Resolve calls for procedure call
+ -- At end, check illegal order dependence.
------------------------------
-- Analyze_Call_And_Resolve --
@@ -1047,6 +1055,11 @@ package body Sem_Ch6 is
if Nkind (N) = N_Procedure_Call_Statement then
Analyze_Call (N);
Resolve (N, Standard_Void_Type);
+
+ -- Apply checks suggested by AI05-0144 (Disabled for now)
+
+ -- Check_Order_Dependence;
+
else
Analyze (N);
end if;
@@ -1074,9 +1087,13 @@ package body Sem_Ch6 is
return;
end if;
- -- If error analyzing prefix, then set Any_Type as result and return
+ -- If there is an error analyzing the name (which may have been
+ -- rewritten if the original call was in prefix notation) then error
+ -- has been emitted already, mark node and return.
- if Etype (P) = Any_Type then
+ if Error_Posted (N)
+ or else Etype (Name (N)) = Any_Type
+ then
Set_Etype (N, Any_Type);
return;
end if;
@@ -1424,7 +1441,6 @@ package body Sem_Ch6 is
Prev_Id : constant Entity_Id := Current_Entity_In_Scope (Body_Id);
Conformant : Boolean;
HSS : Node_Id;
- Missing_Ret : Boolean;
P_Ent : Entity_Id;
Prot_Typ : Entity_Id := Empty;
Spec_Id : Entity_Id;
@@ -1466,6 +1482,10 @@ package body Sem_Ch6 is
-- If pragma does not appear after the body, check whether there is
-- an inline pragma before any local declarations.
+ procedure Check_Missing_Return;
+ -- Checks for a function with a no return statements, and also performs
+ -- the warning checks implemented by Check_Returns.
+
function Disambiguate_Spec return Entity_Id;
-- When a primitive is declared between the private view and the full
-- view of a concurrent type which implements an interface, a special
@@ -1658,6 +1678,46 @@ package body Sem_Ch6 is
end if;
end Check_Inline_Pragma;
+ --------------------------
+ -- Check_Missing_Return --
+ --------------------------
+
+ procedure Check_Missing_Return is
+ Id : Entity_Id;
+ Missing_Ret : Boolean;
+
+ begin
+ if Nkind (Body_Spec) = N_Function_Specification then
+ if Present (Spec_Id) then
+ Id := Spec_Id;
+ else
+ Id := Body_Id;
+ end if;
+
+ if Return_Present (Id) then
+ Check_Returns (HSS, 'F', Missing_Ret);
+
+ if Missing_Ret then
+ Set_Has_Missing_Return (Id);
+ end if;
+
+ elsif (Is_Generic_Subprogram (Id)
+ or else not Is_Machine_Code_Subprogram (Id))
+ and then not Body_Deleted
+ then
+ Error_Msg_N ("missing RETURN statement in function body", N);
+ end if;
+
+ -- If procedure with No_Return, check returns
+
+ elsif Nkind (Body_Spec) = N_Procedure_Specification
+ and then Present (Spec_Id)
+ and then No_Return (Spec_Id)
+ then
+ Check_Returns (HSS, 'P', Missing_Ret, Spec_Id);
+ end if;
+ end Check_Missing_Return;
+
-----------------------
-- Disambiguate_Spec --
-----------------------
@@ -1846,9 +1906,10 @@ package body Sem_Ch6 is
elsif not Is_Primitive (Spec_Id)
and then Ekind (Scope (Spec_Id)) /= E_Protected_Type
then
- Error_Msg_N ("overriding indicator only allowed " &
- "if subprogram is primitive",
- Body_Spec);
+ Error_Msg_N
+ ("overriding indicator only allowed " &
+ "if subprogram is primitive",
+ Body_Spec);
end if;
elsif Style_Check -- ??? incorrect use of Style_Check!
@@ -1881,6 +1942,12 @@ package body Sem_Ch6 is
Set_Is_Child_Unit (Body_Id, Is_Child_Unit (Spec_Id));
Analyze_Generic_Subprogram_Body (N, Spec_Id);
+
+ if Nkind (N) = N_Subprogram_Body then
+ HSS := Handled_Statement_Sequence (N);
+ Check_Missing_Return;
+ end if;
+
return;
else
@@ -2026,10 +2093,13 @@ package body Sem_Ch6 is
end if;
end if;
- -- Mark presence of postcondition proc in current scope
+ -- Mark presence of postcondition procedure in current scope and mark
+ -- the procedure itself as needing debug info. The latter is important
+ -- when analyzing decision coverage (for example, for MC/DC coverage).
if Chars (Body_Id) = Name_uPostconditions then
Set_Has_Postconditions (Current_Scope);
+ Set_Debug_Info_Needed (Body_Id);
end if;
-- Place subprogram on scope stack, and make formals visible. If there
@@ -2079,6 +2149,15 @@ package body Sem_Ch6 is
then
Conformant := True;
+ -- Conversely, the spec may have been generated for specless body
+ -- with an inline pragma.
+
+ elsif Comes_From_Source (N)
+ and then not Comes_From_Source (Spec_Id)
+ and then Has_Pragma_Inline (Spec_Id)
+ then
+ Conformant := True;
+
else
Check_Conformance
(Body_Id, Spec_Id,
@@ -2407,41 +2486,7 @@ package body Sem_Ch6 is
end if;
end if;
- -- If function, check return statements
-
- if Nkind (Body_Spec) = N_Function_Specification then
- declare
- Id : Entity_Id;
-
- begin
- if Present (Spec_Id) then
- Id := Spec_Id;
- else
- Id := Body_Id;
- end if;
-
- if Return_Present (Id) then
- Check_Returns (HSS, 'F', Missing_Ret);
-
- if Missing_Ret then
- Set_Has_Missing_Return (Id);
- end if;
-
- elsif not Is_Machine_Code_Subprogram (Id)
- and then not Body_Deleted
- then
- Error_Msg_N ("missing RETURN statement in function body", N);
- end if;
- end;
-
- -- If procedure with No_Return, check returns
-
- elsif Nkind (Body_Spec) = N_Procedure_Specification
- and then Present (Spec_Id)
- and then No_Return (Spec_Id)
- then
- Check_Returns (HSS, 'P', Missing_Ret, Spec_Id);
- end if;
+ Check_Missing_Return;
-- Now we are going to check for variables that are never modified in
-- the body of the procedure. But first we deal with a special case
@@ -2618,8 +2663,7 @@ package body Sem_Ch6 is
end loop;
if Is_Protected_Type (Current_Scope) then
- Error_Msg_N
- ("protected operation cannot be a null procedure", N);
+ Error_Msg_N ("protected operation cannot be a null procedure", N);
end if;
end if;
@@ -3087,6 +3131,15 @@ package body Sem_Ch6 is
and then Has_Excluded_Statement (Statements (S))
then
return True;
+
+ elsif Nkind (S) = N_Extended_Return_Statement then
+ if Has_Excluded_Statement
+ (Statements (Handled_Statement_Sequence (S)))
+ or else Present
+ (Exception_Handlers (Handled_Statement_Sequence (S)))
+ then
+ return True;
+ end if;
end if;
Next (S);
@@ -3109,6 +3162,7 @@ package body Sem_Ch6 is
or else Is_Child_Unit (S)
then
return False;
+
elsif Ekind (S) = E_Package
and then Has_Forward_Instantiation (S)
then
@@ -3153,12 +3207,33 @@ package body Sem_Ch6 is
return Abandon;
end if;
+ -- A return statement within an extended return is a noop
+ -- after inlining.
+
+ elsif No (Expression (N))
+ and then Nkind (Parent (Parent (N))) =
+ N_Extended_Return_Statement
+ then
+ return OK;
+
else
-- Expression has wrong form
return Abandon;
end if;
+ -- We can only inline a build-in-place function if
+ -- it has a single extended return.
+
+ elsif Nkind (N) = N_Extended_Return_Statement then
+ if No (Return_Statement) then
+ Return_Statement := N;
+ return OK;
+
+ else
+ return Abandon;
+ end if;
+
else
return OK;
end if;
@@ -3169,11 +3244,18 @@ package body Sem_Ch6 is
-- Start of processing for Has_Single_Return
begin
- return Check_All_Returns (N) = OK
- and then Present (Declarations (N))
- and then Present (First (Declarations (N)))
- and then Chars (Expression (Return_Statement)) =
- Chars (Defining_Identifier (First (Declarations (N))));
+ if Check_All_Returns (N) /= OK then
+ return False;
+
+ elsif Nkind (Return_Statement) = N_Extended_Return_Statement then
+ return True;
+
+ else
+ return Present (Declarations (N))
+ and then Present (First (Declarations (N)))
+ and then Chars (Expression (Return_Statement)) =
+ Chars (Defining_Identifier (First (Declarations (N))));
+ end if;
end Has_Single_Return;
--------------------
@@ -3462,21 +3544,21 @@ package body Sem_Ch6 is
when Mode_Conformant =>
if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then
- Error_Msg_N -- CODEFIX???
+ Error_Msg_N
("not mode conformant with operation inherited#!",
Enode);
else
- Error_Msg_N -- CODEFIX???
+ Error_Msg_N
("not mode conformant with declaration#!", Enode);
end if;
when Subtype_Conformant =>
if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then
- Error_Msg_N -- CODEFIX???
+ Error_Msg_N
("not subtype conformant with operation inherited#!",
Enode);
else
- Error_Msg_N -- CODEFIX???
+ Error_Msg_N
("not subtype conformant with declaration#!", Enode);
end if;
@@ -3960,22 +4042,25 @@ package body Sem_Ch6 is
if not Is_Overriding_Operation (Op) then
Error_Msg_N ("\\primitive % defined #", Typ);
else
- Error_Msg_N ("\\overriding operation % with " &
- "convention % defined #", Typ);
+ Error_Msg_N
+ ("\\overriding operation % with " &
+ "convention % defined #", Typ);
end if;
else pragma Assert (Present (Alias (Op)));
Error_Msg_Sloc := Sloc (Alias (Op));
- Error_Msg_N ("\\inherited operation % with " &
- "convention % defined #", Typ);
+ Error_Msg_N
+ ("\\inherited operation % with " &
+ "convention % defined #", Typ);
end if;
Error_Msg_Name_1 := Chars (Op);
Error_Msg_Name_2 :=
Get_Convention_Name (Convention (Iface_Prim));
Error_Msg_Sloc := Sloc (Iface_Prim);
- Error_Msg_N ("\\overridden operation % with " &
- "convention % defined #", Typ);
+ Error_Msg_N
+ ("\\overridden operation % with " &
+ "convention % defined #", Typ);
-- Avoid cascading errors
@@ -4393,7 +4478,8 @@ package body Sem_Ch6 is
then
Error_Msg_Node_2 := Alias (Overridden_Subp);
Error_Msg_Sloc := Sloc (Error_Msg_Node_2);
- Error_Msg_NE ("& does not match corresponding formal of&#",
+ Error_Msg_NE
+ ("& does not match corresponding formal of&#",
Form1, Form1);
exit;
end if;
@@ -4404,8 +4490,24 @@ package body Sem_Ch6 is
end;
end if;
+ -- If there is an overridden subprogram, then check that there is not
+ -- a "not overriding" indicator, and mark the subprogram as overriding.
+ -- This is not done if the overridden subprogram is marked as hidden,
+ -- which can occur for the case of inherited controlled operations
+ -- (see Derive_Subprogram), unless the inherited subprogram's parent
+ -- subprogram is not itself hidden. (Note: This condition could probably
+ -- be simplified, leaving out the testing for the specific controlled
+ -- cases, but it seems safer and clearer this way, and echoes similar
+ -- special-case tests of this kind in other places.)
+
if Present (Overridden_Subp)
- and then not Is_Hidden (Overridden_Subp)
+ and then (not Is_Hidden (Overridden_Subp)
+ or else
+ ((Chars (Overridden_Subp) = Name_Initialize
+ or else Chars (Overridden_Subp) = Name_Adjust
+ or else Chars (Overridden_Subp) = Name_Finalize)
+ and then Present (Alias (Overridden_Subp))
+ and then not Is_Hidden (Alias (Overridden_Subp))))
then
if Must_Not_Override (Spec) then
Error_Msg_Sloc := Sloc (Overridden_Subp);
@@ -4477,7 +4579,7 @@ package body Sem_Ch6 is
elsif Must_Override (Spec) then
if Is_Overriding_Operation (Subp) then
- Set_Is_Overriding_Operation (Subp);
+ null;
elsif not Can_Override then
Error_Msg_NE ("subprogram & is not overriding", Spec, Subp);
@@ -5329,6 +5431,14 @@ package body Sem_Ch6 is
-- and also returned as the result. These formals are always of mode IN.
-- The new formal has the type Typ, is declared in Scope, and its name
-- is given by a concatenation of the name of Assoc_Entity and Suffix.
+ -- The following suffixes are currently used. They should not be changed
+ -- without coordinating with CodePeer, which makes use of these to
+ -- provide better messages.
+
+ -- O denotes the Constrained bit.
+ -- L denotes the accessibility level.
+ -- BIP_xxx denotes an extra formal for a build-in-place function. See
+ -- the full list in exp_ch6.BIP_Formal_Kind.
----------------------
-- Add_Extra_Formal --
@@ -5455,7 +5565,7 @@ package body Sem_Ch6 is
and then not Is_Indefinite_Subtype (Formal_Type)
then
Set_Extra_Constrained
- (Formal, Add_Extra_Formal (Formal, Standard_Boolean, E, "F"));
+ (Formal, Add_Extra_Formal (Formal, Standard_Boolean, E, "O"));
end if;
end if;
@@ -5488,7 +5598,7 @@ package body Sem_Ch6 is
or else Present (Extra_Accessibility (P_Formal)))
then
Set_Extra_Accessibility
- (Formal, Add_Extra_Formal (Formal, Standard_Natural, E, "F"));
+ (Formal, Add_Extra_Formal (Formal, Standard_Natural, E, "L"));
end if;
-- This label is required when skipping extra formal generation for
@@ -6001,8 +6111,9 @@ package body Sem_Ch6 is
when N_Aggregate =>
return
FCL (Expressions (E1), Expressions (E2))
- and then FCL (Component_Associations (E1),
- Component_Associations (E2));
+ and then
+ FCL (Component_Associations (E1),
+ Component_Associations (E2));
when N_Allocator =>
if Nkind (Expression (E1)) = N_Qualified_Expression
@@ -6072,6 +6183,38 @@ package body Sem_Ch6 is
and then
FCE (Right_Opnd (E1), Right_Opnd (E2));
+ when N_Case_Expression =>
+ declare
+ Alt1 : Node_Id;
+ Alt2 : Node_Id;
+
+ begin
+ if not FCE (Expression (E1), Expression (E2)) then
+ return False;
+
+ else
+ Alt1 := First (Alternatives (E1));
+ Alt2 := First (Alternatives (E2));
+ loop
+ if Present (Alt1) /= Present (Alt2) then
+ return False;
+ elsif No (Alt1) then
+ return True;
+ end if;
+
+ if not FCE (Expression (Alt1), Expression (Alt2))
+ or else not FCL (Discrete_Choices (Alt1),
+ Discrete_Choices (Alt2))
+ then
+ return False;
+ end if;
+
+ Next (Alt1);
+ Next (Alt2);
+ end loop;
+ end if;
+ end;
+
when N_Character_Literal =>
return
Char_Literal_Value (E1) = Char_Literal_Value (E2);
@@ -6079,7 +6222,8 @@ package body Sem_Ch6 is
when N_Component_Association =>
return
FCL (Choices (E1), Choices (E2))
- and then FCE (Expression (E1), Expression (E2));
+ and then
+ FCE (Expression (E1), Expression (E2));
when N_Conditional_Expression =>
return
@@ -6100,13 +6244,15 @@ package body Sem_Ch6 is
when N_Function_Call =>
return
FCE (Name (E1), Name (E2))
- and then FCL (Parameter_Associations (E1),
- Parameter_Associations (E2));
+ and then
+ FCL (Parameter_Associations (E1),
+ Parameter_Associations (E2));
when N_Indexed_Component =>
return
FCE (Prefix (E1), Prefix (E2))
- and then FCL (Expressions (E1), Expressions (E2));
+ and then
+ FCL (Expressions (E1), Expressions (E2));
when N_Integer_Literal =>
return (Intval (E1) = Intval (E2));
@@ -6130,12 +6276,14 @@ package body Sem_Ch6 is
when N_Qualified_Expression =>
return
FCE (Subtype_Mark (E1), Subtype_Mark (E2))
- and then FCE (Expression (E1), Expression (E2));
+ and then
+ FCE (Expression (E1), Expression (E2));
when N_Range =>
return
FCE (Low_Bound (E1), Low_Bound (E2))
- and then FCE (High_Bound (E1), High_Bound (E2));
+ and then
+ FCE (High_Bound (E1), High_Bound (E2));
when N_Real_Literal =>
return (Realval (E1) = Realval (E2));
@@ -6143,12 +6291,14 @@ package body Sem_Ch6 is
when N_Selected_Component =>
return
FCE (Prefix (E1), Prefix (E2))
- and then FCE (Selector_Name (E1), Selector_Name (E2));
+ and then
+ FCE (Selector_Name (E1), Selector_Name (E2));
when N_Slice =>
return
FCE (Prefix (E1), Prefix (E2))
- and then FCE (Discrete_Range (E1), Discrete_Range (E2));
+ and then
+ FCE (Discrete_Range (E1), Discrete_Range (E2));
when N_String_Literal =>
declare
@@ -6177,17 +6327,20 @@ package body Sem_Ch6 is
when N_Type_Conversion =>
return
FCE (Subtype_Mark (E1), Subtype_Mark (E2))
- and then FCE (Expression (E1), Expression (E2));
+ and then
+ FCE (Expression (E1), Expression (E2));
when N_Unary_Op =>
return
Entity (E1) = Entity (E2)
- and then FCE (Right_Opnd (E1), Right_Opnd (E2));
+ and then
+ FCE (Right_Opnd (E1), Right_Opnd (E2));
when N_Unchecked_Type_Conversion =>
return
FCE (Subtype_Mark (E1), Subtype_Mark (E2))
- and then FCE (Expression (E1), Expression (E2));
+ and then
+ FCE (Expression (E1), Expression (E2));
-- All other node types cannot appear in this context. Strictly
-- we should raise a fatal internal error. Instead we just ignore
@@ -6343,8 +6496,8 @@ package body Sem_Ch6 is
or else Etype (Prim) = Etype (Iface_Prim)
or else not Has_Controlling_Result (Prim)
then
- return Type_Conformant (Prim, Iface_Prim,
- Skip_Controlling_Formals => True);
+ return Type_Conformant
+ (Iface_Prim, Prim, Skip_Controlling_Formals => True);
-- Case of a function returning an interface, or an access to one.
-- Check that the return types correspond.
@@ -6481,7 +6634,6 @@ package body Sem_Ch6 is
-- instance of) a generic type.
Formal := First_Formal (Prev_E);
-
while Present (Formal) loop
F_Typ := Base_Type (Etype (Formal));
@@ -6792,8 +6944,9 @@ package body Sem_Ch6 is
and then (not Is_Overriding
or else not Is_Abstract_Subprogram (E))
then
- Error_Msg_N ("abstract subprograms must be visible "
- & "(RM 3.9.3(10))!", S);
+ Error_Msg_N
+ ("abstract subprograms must be visible "
+ & "(RM 3.9.3(10))!", S);
elsif Ekind (S) = E_Function
and then Is_Tagged_Type (T)
@@ -7409,9 +7562,11 @@ package body Sem_Ch6 is
-- E exists and is overloadable
else
- -- Ada 2005 (AI-251): Derivation of abstract interface primitives
- -- need no check against the homonym chain. They are directly added
- -- to the list of primitive operations of Derived_Type.
+ -- Ada 2005 (AI-251): Derivation of abstract interface primitives.
+ -- They are directly added to the list of primitive operations of
+ -- Derived_Type, unless this is a rederivation in the private part
+ -- of an operation that was already derived in the visible part of
+ -- the current package.
if Ada_Version >= Ada_05
and then Present (Derived_Type)
@@ -7419,7 +7574,16 @@ package body Sem_Ch6 is
and then Present (Find_Dispatching_Type (Alias (S)))
and then Is_Interface (Find_Dispatching_Type (Alias (S)))
then
- goto Add_New_Entity;
+ if Type_Conformant (E, S)
+ and then Is_Package_Or_Generic_Package (Current_Scope)
+ and then In_Private_Part (Current_Scope)
+ and then Parent (E) /= Parent (S)
+ and then Alias (E) = Alias (S)
+ then
+ Check_Operation_From_Private_View (S, E);
+ else
+ goto Add_New_Entity;
+ end if;
end if;
Check_Synchronized_Overriding (S, Overridden_Subp);
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 27505f215a9..b797791c24f 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -261,8 +261,7 @@ package body Sem_Ch7 is
Error_Msg_N
("optional package body (not allowed in Ada 95)?", N);
else
- Error_Msg_N
- ("spec of this package does not allow a body", N);
+ Error_Msg_N ("spec of this package does not allow a body", N);
end if;
end if;
end if;
@@ -1954,6 +1953,7 @@ package body Sem_Ch7 is
Set_Is_Volatile (Priv, Is_Volatile (Full));
Set_Treat_As_Volatile (Priv, Treat_As_Volatile (Full));
Set_Is_Ada_2005_Only (Priv, Is_Ada_2005_Only (Full));
+ Set_Has_Pragma_Unmodified (Priv, Has_Pragma_Unmodified (Full));
Set_Has_Pragma_Unreferenced (Priv, Has_Pragma_Unreferenced (Full));
Set_Has_Pragma_Unreferenced_Objects
(Priv, Has_Pragma_Unreferenced_Objects
@@ -2032,6 +2032,11 @@ package body Sem_Ch7 is
end if;
Set_Has_Discriminants (Priv, Has_Discriminants (Full));
+
+ if Has_Discriminants (Full) then
+ Set_Discriminant_Constraint (Priv,
+ Discriminant_Constraint (Full));
+ end if;
end if;
end Preserve_Full_Attributes;
@@ -2068,7 +2073,7 @@ package body Sem_Ch7 is
-- but the formals are private and remain so.
if Ekind (Id) = E_Function
- and then Is_Operator_Symbol_Name (Chars (Id))
+ and then Is_Operator_Symbol_Name (Chars (Id))
and then not Is_Hidden (Id)
and then not Error_Posted (Id)
then
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index a25d1d6ab54..370e2d68975 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -398,15 +398,20 @@ package body Sem_Ch8 is
-- must be added to the list of actuals in any subsequent call.
function Applicable_Use (Pack_Name : Node_Id) return Boolean;
- -- Common code to Use_One_Package and Set_Use, to determine whether
- -- use clause must be processed. Pack_Name is an entity name that
- -- references the package in question.
+ -- Common code to Use_One_Package and Set_Use, to determine whether use
+ -- clause must be processed. Pack_Name is an entity name that references
+ -- the package in question.
procedure Attribute_Renaming (N : Node_Id);
-- Analyze renaming of attribute as subprogram. The renaming declaration N
-- is rewritten as a subprogram body that returns the attribute reference
-- applied to the formals of the function.
+ procedure Set_Entity_Or_Discriminal (N : Node_Id; E : Entity_Id);
+ -- Set Entity, with style check if need be. For a discriminant reference,
+ -- replace by the corresponding discriminal, i.e. the parameter of the
+ -- initialization procedure that corresponds to the discriminant.
+
procedure Check_Frozen_Renaming (N : Node_Id; Subp : Entity_Id);
-- A renaming_as_body may occur after the entity of the original decla-
-- ration has been frozen. In that case, the body of the new entity must
@@ -893,7 +898,7 @@ package body Sem_Ch8 is
Error_Msg_NE
("\?function & will be called only once", Nam,
Entity (Name (Nam)));
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\?suggest using an initialized constant object instead",
Nam);
end if;
@@ -910,9 +915,7 @@ package body Sem_Ch8 is
then
declare
Loc : constant Source_Ptr := Sloc (N);
- Subt : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
+ Subt : constant Entity_Id := Make_Temporary (Loc, 'T');
begin
Remove_Side_Effects (Nam);
Insert_Action (N,
@@ -1315,7 +1318,8 @@ package body Sem_Ch8 is
begin
if not Is_Overloaded (P) then
if Ekind (Etype (Nam)) /= E_Subprogram_Type
- or else not Type_Conformant (Etype (Nam), New_S) then
+ or else not Type_Conformant (Etype (Nam), New_S)
+ then
Error_Msg_N ("designated type does not match specification", P);
else
Resolve (P);
@@ -1330,8 +1334,8 @@ package body Sem_Ch8 is
while Present (It.Nam) loop
if Ekind (It.Nam) = E_Subprogram_Type
- and then Type_Conformant (It.Nam, New_S) then
-
+ and then Type_Conformant (It.Nam, New_S)
+ then
if Typ /= Any_Id then
Error_Msg_N ("ambiguous renaming", P);
return;
@@ -2149,9 +2153,7 @@ package body Sem_Ch8 is
-- Guard against previous errors, and omit renamings of predefined
-- operators.
- elsif Ekind (Old_S) /= E_Function
- and then Ekind (Old_S) /= E_Procedure
- then
+ elsif not Ekind_In (Old_S, E_Function, E_Procedure) then
null;
elsif Requires_Overriding (Old_S)
@@ -2584,8 +2586,7 @@ package body Sem_Ch8 is
("a generic package is not allowed in a use clause",
Pack_Name);
else
- Error_Msg_N -- CODEFIX???
- ("& is not a usable package", Pack_Name);
+ Error_Msg_N ("& is not a usable package", Pack_Name);
end if;
else
@@ -2706,7 +2707,7 @@ package body Sem_Ch8 is
if Warn_On_Redundant_Constructs
and then Pack = Current_Scope
then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible within itself?", Pack_Name, Pack);
end if;
@@ -2838,19 +2839,17 @@ package body Sem_Ch8 is
if Aname = Name_AST_Entry then
declare
- Ent : Entity_Id;
+ Ent : constant Entity_Id := Make_Temporary (Loc, 'R', Nam);
Decl : Node_Id;
begin
- Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
-
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Ent,
- Object_Definition =>
+ Object_Definition =>
New_Occurrence_Of (RTE (RE_AST_Handler), Loc),
- Expression => Nam,
- Constant_Present => True);
+ Expression => Nam,
+ Constant_Present => True);
Set_Assignment_OK (Decl, True);
Insert_Action (N, Decl);
@@ -3042,6 +3041,56 @@ package body Sem_Ch8 is
end if;
end Check_Frozen_Renaming;
+ -------------------------------
+ -- Set_Entity_Or_Discriminal --
+ -------------------------------
+
+ procedure Set_Entity_Or_Discriminal (N : Node_Id; E : Entity_Id) is
+ P : Node_Id;
+
+ begin
+ -- If the entity is not a discriminant, or else expansion is disabled,
+ -- simply set the entity.
+
+ if not In_Spec_Expression
+ or else Ekind (E) /= E_Discriminant
+ or else Inside_A_Generic
+ then
+ Set_Entity_With_Style_Check (N, E);
+
+ -- The replacement of a discriminant by the corresponding discriminal
+ -- is not done for a task discriminant that appears in a default
+ -- expression of an entry parameter. See Expand_Discriminant in exp_ch2
+ -- for details on their handling.
+
+ elsif Is_Concurrent_Type (Scope (E)) then
+
+ P := Parent (N);
+ while Present (P)
+ and then not Nkind_In (P, N_Parameter_Specification,
+ N_Component_Declaration)
+ loop
+ P := Parent (P);
+ end loop;
+
+ if Present (P)
+ and then Nkind (P) = N_Parameter_Specification
+ then
+ null;
+
+ else
+ Set_Entity (N, Discriminal (E));
+ end if;
+
+ -- Otherwise, this is a discriminant in a context in which
+ -- it is a reference to the corresponding parameter of the
+ -- init proc for the enclosing type.
+
+ else
+ Set_Entity (N, Discriminal (E));
+ end if;
+ end Set_Entity_Or_Discriminal;
+
-----------------------------------
-- Check_In_Previous_With_Clause --
-----------------------------------
@@ -3076,8 +3125,7 @@ package body Sem_Ch8 is
end loop;
if Is_Child_Unit (Entity (Original_Node (Par))) then
- Error_Msg_NE
- ("& is not directly visible", Par, Entity (Par));
+ Error_Msg_NE ("& is not directly visible", Par, Entity (Par));
else
return;
end if;
@@ -3426,33 +3474,47 @@ package body Sem_Ch8 is
------------------
procedure End_Use_Type (N : Node_Id) is
+ Elmt : Elmt_Id;
Id : Entity_Id;
Op_List : Elist_Id;
- Elmt : Elmt_Id;
+ Op : Entity_Id;
T : Entity_Id;
+ function May_Be_Used_Primitive_Of (T : Entity_Id) return Boolean;
+ -- An operator may be primitive in several types, if they are declared
+ -- in the same scope as the operator. To determine the use-visiblity of
+ -- the operator in such cases we must examine all types in the profile.
+
+ ------------------------------
+ -- May_Be_Used_Primitive_Of --
+ ------------------------------
+
+ function May_Be_Used_Primitive_Of (T : Entity_Id) return Boolean is
+ begin
+ return Scope (Op) = Scope (T)
+ and then (In_Use (T) or else Is_Potentially_Use_Visible (T));
+ end May_Be_Used_Primitive_Of;
+
+ -- Start of processing for End_Use_Type
+
begin
Id := First (Subtype_Marks (N));
while Present (Id) loop
- -- A call to rtsfind may occur while analyzing a use_type clause,
+ -- A call to Rtsfind may occur while analyzing a use_type clause,
-- in which case the type marks are not resolved yet, and there is
-- nothing to remove.
- if not Is_Entity_Name (Id)
- or else No (Entity (Id))
- then
+ if not Is_Entity_Name (Id) or else No (Entity (Id)) then
goto Continue;
end if;
T := Entity (Id);
- if T = Any_Type
- or else From_With_Type (T)
- then
+ if T = Any_Type or else From_With_Type (T) then
null;
- -- Note that the use_Type clause may mention a subtype of the type
+ -- Note that the use_type clause may mention a subtype of the type
-- whose primitive operations have been made visible. Here as
-- elsewhere, it is the base type that matters for visibility.
@@ -3468,8 +3530,30 @@ package body Sem_Ch8 is
Elmt := First_Elmt (Op_List);
while Present (Elmt) loop
- if Nkind (Node (Elmt)) = N_Defining_Operator_Symbol then
- Set_Is_Potentially_Use_Visible (Node (Elmt), False);
+ Op := Node (Elmt);
+
+ if Nkind (Op) = N_Defining_Operator_Symbol then
+ declare
+ T_First : constant Entity_Id :=
+ Base_Type (Etype (First_Formal (Op)));
+ T_Res : constant Entity_Id := Base_Type (Etype (Op));
+ T_Next : Entity_Id;
+
+ begin
+ if Present (Next_Formal (First_Formal (Op))) then
+ T_Next :=
+ Base_Type (Etype (Next_Formal (First_Formal (Op))));
+ else
+ T_Next := T_First;
+ end if;
+
+ if not May_Be_Used_Primitive_Of (T_First)
+ and then not May_Be_Used_Primitive_Of (T_Next)
+ and then not May_Be_Used_Primitive_Of (T_Res)
+ then
+ Set_Is_Potentially_Use_Visible (Op, False);
+ end if;
+ end;
end if;
Next_Elmt (Elmt);
@@ -3805,9 +3889,20 @@ package body Sem_Ch8 is
Nkind (Parent (Parent (N))) = N_Use_Package_Clause
then
Error_Msg_Qual_Level := 99;
- Error_Msg_NE ("\\missing `WITH &;`", N, Ent);
+ Error_Msg_NE -- CODEFIX
+ ("\\missing `WITH &;`", N, Ent);
Error_Msg_Qual_Level := 0;
end if;
+
+ if Ekind (Ent) = E_Discriminant
+ and then Present (Corresponding_Discriminant (Ent))
+ and then Scope (Corresponding_Discriminant (Ent)) =
+ Etype (Scope (Ent))
+ then
+ Error_Msg_N
+ ("inherited discriminant not allowed here" &
+ " (RM 3.8 (12), 3.8.1 (6))!", N);
+ end if;
end if;
-- Set entity and its containing package as referenced. We
@@ -3873,7 +3968,7 @@ package body Sem_Ch8 is
if Chars (Lit) /= Chars (N)
and then Is_Bad_Spelling_Of (Chars (N), Chars (Lit)) then
Error_Msg_Node_2 := Lit;
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("& is undefined, assume misspelling of &", N);
Rewrite (N, New_Occurrence_Of (Lit, Sloc (N)));
return;
@@ -3937,7 +4032,7 @@ package body Sem_Ch8 is
-- this is a very common error for beginners to make).
if Chars (N) = Name_Put or else Chars (N) = Name_Put_Line then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\\possible missing `WITH Ada.Text_'I'O; " &
"USE Ada.Text_'I'O`!", N);
@@ -3950,7 +4045,8 @@ package body Sem_Ch8 is
and then Is_Known_Unit (Parent (N))
then
Error_Msg_Node_2 := Selector_Name (Parent (N));
- Error_Msg_N ("\\missing `WITH &.&;`", Prefix (Parent (N)));
+ Error_Msg_N -- CODEFIX
+ ("\\missing `WITH &.&;`", Prefix (Parent (N)));
end if;
-- Now check for possible misspellings
@@ -4336,8 +4432,18 @@ package body Sem_Ch8 is
return;
end if;
- Set_Entity (N, E);
- -- Why no Style_Check here???
+ -- Set the entity. Note that the reason we call Set_Entity for the
+ -- overloadable case, as opposed to Set_Entity_With_Style_Check is
+ -- that in the overloaded case, the initial call can set the wrong
+ -- homonym. The call that sets the right homonym is in Sem_Res and
+ -- that call does use Set_Entity_With_Style_Check, so we don't miss
+ -- a style check.
+
+ if Is_Overloadable (E) then
+ Set_Entity (N, E);
+ else
+ Set_Entity_With_Style_Check (N, E);
+ end if;
if Is_Type (E) then
Set_Etype (N, E);
@@ -4447,58 +4553,7 @@ package body Sem_Ch8 is
Check_Nested_Access (E);
end if;
- -- Set Entity, with style check if need be. For a discriminant
- -- reference, replace by the corresponding discriminal, i.e. the
- -- parameter of the initialization procedure that corresponds to
- -- the discriminant. If this replacement is being performed, there
- -- is no style check to perform.
-
- -- This replacement must not be done if we are currently
- -- processing a generic spec or body, because the discriminal
- -- has not been not generated in this case.
-
- -- The replacement is also skipped if we are in special
- -- spec-expression mode. Why is this skipped in this case ???
-
- if not In_Spec_Expression
- or else Ekind (E) /= E_Discriminant
- or else Inside_A_Generic
- then
- Set_Entity_With_Style_Check (N, E);
-
- -- The replacement is not done either for a task discriminant that
- -- appears in a default expression of an entry parameter. See
- -- Expand_Discriminant in exp_ch2 for details on their handling.
-
- elsif Is_Concurrent_Type (Scope (E)) then
- declare
- P : Node_Id;
-
- begin
- P := Parent (N);
- while Present (P)
- and then not Nkind_In (P, N_Parameter_Specification,
- N_Component_Declaration)
- loop
- P := Parent (P);
- end loop;
-
- if Present (P)
- and then Nkind (P) = N_Parameter_Specification
- then
- null;
- else
- Set_Entity (N, Discriminal (E));
- end if;
- end;
-
- -- Otherwise, this is a discriminant in a context in which
- -- it is a reference to the corresponding parameter of the
- -- init proc for the enclosing type.
-
- else
- Set_Entity (N, Discriminal (E));
- end if;
+ Set_Entity_Or_Discriminal (N, E);
end if;
end;
end Find_Direct_Name;
@@ -4688,7 +4743,8 @@ package body Sem_Ch8 is
else
Error_Msg_Qual_Level := 99;
- Error_Msg_NE ("missing `WITH &;`", Selector, Candidate);
+ Error_Msg_NE -- CODEFIX
+ ("missing `WITH &;`", Selector, Candidate);
Error_Msg_Qual_Level := 0;
end if;
@@ -4719,9 +4775,9 @@ package body Sem_Ch8 is
exit when S = Standard_Standard;
- if Ekind (S) = E_Function
- or else Ekind (S) = E_Package
- or else Ekind (S) = E_Procedure
+ if Ekind_In (S, E_Function,
+ E_Package,
+ E_Procedure)
then
P := Generic_Parent (Specification
(Unit_Declaration_Node (S)));
@@ -4745,7 +4801,8 @@ package body Sem_Ch8 is
if Is_Known_Unit (N) then
if not Error_Posted (N) then
Error_Msg_Node_2 := Selector;
- Error_Msg_N ("missing `WITH &.&;`", Prefix (N));
+ Error_Msg_N -- CODEFIX
+ ("missing `WITH &.&;`", Prefix (N));
end if;
-- If this is a selection from a dummy package, then suppress
@@ -4785,11 +4842,17 @@ package body Sem_Ch8 is
("\use fully qualified name starting with"
& " Standard to make& visible", N, H);
Error_Msg_Qual_Level := 0;
- exit;
+ goto Done;
end if;
Next_Entity (Id);
end loop;
+
+ -- If not found, standard error message.
+
+ Error_Msg_NE ("& not declared in&", N, Selector);
+
+ <<Done>> null;
end;
else
@@ -4820,7 +4883,8 @@ package body Sem_Ch8 is
(Generic_Parent (Parent (Entity (Prefix (N)))))
then
Error_Msg_Node_2 := Selector;
- Error_Msg_N ("\missing `WITH &.&;`", Prefix (N));
+ Error_Msg_N -- CODEFIX
+ ("\missing `WITH &.&;`", Prefix (N));
end if;
end if;
end if;
@@ -4885,7 +4949,7 @@ package body Sem_Ch8 is
if Has_Homonym (Id) then
Set_Entity (N, Id);
else
- Set_Entity_With_Style_Check (N, Id);
+ Set_Entity_Or_Discriminal (N, Id);
Generate_Reference (Id, N);
end if;
@@ -5112,11 +5176,11 @@ package body Sem_Ch8 is
function Report_Overload return Entity_Id is
begin
if Is_Actual then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("ambiguous actual subprogram&, " &
"possible interpretations:", N, Nam);
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("ambiguous subprogram, " &
"possible interpretations:", N);
end if;
@@ -5582,7 +5646,19 @@ package body Sem_Ch8 is
-- It is legal to denote the class type of an incomplete
-- type. The full type will have to be tagged, of course.
-- In Ada 2005 this usage is declared obsolescent, so we
- -- warn accordingly.
+ -- warn accordingly. This usage is only legal if the type
+ -- is completed in the current scope, and not for a limited
+ -- view of a type.
+
+ if not Is_Tagged_Type (T)
+ and then Ada_Version >= Ada_05
+ then
+ if From_With_Type (T) then
+ Error_Msg_N
+ ("prefix of Class attribute must be tagged", N);
+ Set_Etype (N, Any_Type);
+ Set_Entity (N, Any_Type);
+ return;
-- ??? This test is temporarily disabled (always False)
-- because it causes an unwanted warning on GNAT sources
@@ -5590,14 +5666,13 @@ package body Sem_Ch8 is
-- Feature). Once this issue is cleared in the sources, it
-- can be enabled.
- if not Is_Tagged_Type (T)
- and then Ada_Version >= Ada_05
- and then 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);
+ 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);
+ end if;
end if;
Set_Is_Tagged_Type (T);
@@ -5685,7 +5760,7 @@ package body Sem_Ch8 is
and then Base_Type (Typ) = Typ
and then Warn_On_Redundant_Constructs
then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?redundant attribute, & is its own base type", N, Typ);
end if;
@@ -5968,12 +6043,45 @@ package body Sem_Ch8 is
Change_Selected_Component_To_Expanded_Name (N);
end if;
- Add_One_Interp (N, Predef_Op, T);
+ -- If the context is an unanalyzed function call, determine whether
+ -- a binary or unary interpretation is required.
- -- For operators with unary and binary interpretations, add both
+ if Nkind (Parent (N)) = N_Indexed_Component then
+ declare
+ Is_Binary_Call : constant Boolean :=
+ Present
+ (Next (First (Expressions (Parent (N)))));
+ Is_Binary_Op : constant Boolean :=
+ First_Entity
+ (Predef_Op) /= Last_Entity (Predef_Op);
+ Predef_Op2 : constant Entity_Id := Homonym (Predef_Op);
- if Present (Homonym (Predef_Op)) then
- Add_One_Interp (N, Homonym (Predef_Op), T);
+ begin
+ if Is_Binary_Call then
+ if Is_Binary_Op then
+ Add_One_Interp (N, Predef_Op, T);
+ else
+ Add_One_Interp (N, Predef_Op2, T);
+ end if;
+
+ else
+ if not Is_Binary_Op then
+ Add_One_Interp (N, Predef_Op, T);
+ else
+ Add_One_Interp (N, Predef_Op2, T);
+ end if;
+ end if;
+ end;
+
+ else
+ Add_One_Interp (N, Predef_Op, T);
+
+ -- For operators with unary and binary interpretations, if
+ -- context is not a call, add both
+
+ if Present (Homonym (Predef_Op)) then
+ Add_One_Interp (N, Homonym (Predef_Op), T);
+ end if;
end if;
-- The node is a reference to a predefined operator, and
@@ -6170,9 +6278,7 @@ package body Sem_Ch8 is
Next_Formal (Old_F);
end loop;
- if Ekind (Old_S) = E_Function
- or else Ekind (Old_S) = E_Enumeration_Literal
- then
+ if Ekind_In (Old_S, E_Function, E_Enumeration_Literal) then
Set_Etype (New_S, Etype (Old_S));
end if;
end if;
@@ -6488,7 +6594,7 @@ package body Sem_Ch8 is
if Present (Redundant) then
Error_Msg_Sloc := Sloc (Prev_Use);
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through previous use clause #?",
Redundant, Pack_Name);
end if;
@@ -7162,11 +7268,11 @@ package body Sem_Ch8 is
-- we compare the scope depth of its scope with that of the
-- current instance. However, a generic actual of a subprogram
-- instance is declared in the wrapper package but will not be
- -- hidden by a use-visible entity. Similarly, a generic actual
- -- will not be hidden by an entity declared in another generic
- -- actual, which can only have been use-visible in the generic.
- -- Is this condition complete, and can the following complex
- -- test be simplified ???
+ -- hidden by a use-visible entity. similarly, an entity that is
+ -- declared in an enclosing instance will not be hidden by an
+ -- an entity declared in a generic actual, which can only have
+ -- been use-visible in the generic and will not have hidden the
+ -- entity in the generic parent.
-- If Id is called Standard, the predefined package with the
-- same name is in the homonym chain. It has to be ignored
@@ -7181,8 +7287,8 @@ package body Sem_Ch8 is
and then (Scope (Prev) /= Standard_Standard
or else Sloc (Prev) > Standard_Location)
then
- if Ekind (Prev) = E_Package
- and then Present (Associated_Formal_Package (Prev))
+ if In_Open_Scopes (Scope (Prev))
+ and then Is_Generic_Instance (Scope (Prev))
and then Present (Associated_Formal_Package (P))
then
null;
@@ -7466,14 +7572,14 @@ package body Sem_Ch8 is
if Unit1 = Unit2 then
Error_Msg_Sloc := Sloc (Current_Use_Clause (T));
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
& "use_type_clause #?", Clause1, T);
return;
elsif Nkind (Unit1) = N_Subunit then
Error_Msg_Sloc := Sloc (Current_Use_Clause (T));
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
& "use_type_clause #?", Clause1, T);
return;
@@ -7483,7 +7589,7 @@ package body Sem_Ch8 is
and then Nkind (Unit1) /= N_Subunit
then
Error_Msg_Sloc := Sloc (Clause1);
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
& "use_type_clause #?", Current_Use_Clause (T), T);
return;
@@ -7534,7 +7640,7 @@ package body Sem_Ch8 is
end;
end if;
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
& "use_type_clause #?", Err_No, Id);
@@ -7543,7 +7649,7 @@ package body Sem_Ch8 is
-- level. In this case we don't have location information.
else
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
& "use type clause?", Id, T);
end if;
@@ -7553,7 +7659,7 @@ package body Sem_Ch8 is
-- where we do not have the location information available.
else
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
& "use type clause?", Id, T);
end if;
@@ -7562,7 +7668,7 @@ package body Sem_Ch8 is
elsif In_Use (Scope (T)) then
Error_Msg_Sloc := Sloc (Current_Use_Clause (Scope (T)));
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible through package use clause #?",
Id, T);
@@ -7570,7 +7676,7 @@ package body Sem_Ch8 is
else
Error_Msg_Node_2 := Scope (T);
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("& is already use-visible inside package &?", Id, T);
end if;
end if;
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 9a242d5eedd..21f80dfd713 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -30,7 +30,6 @@ with Errout; use Errout;
with Exp_Ch9; use Exp_Ch9;
with Elists; use Elists;
with Freeze; use Freeze;
-with Itypes; use Itypes;
with Lib.Xref; use Lib.Xref;
with Namet; use Namet;
with Nlists; use Nlists;
@@ -167,73 +166,6 @@ package body Sem_Ch9 is
Kind : Entity_Kind;
Task_Nam : Entity_Id;
- -----------------------
- -- Actual_Index_Type --
- -----------------------
-
- function Actual_Index_Type (E : Entity_Id) return Entity_Id;
- -- If the bounds of an entry family depend on task discriminants, create
- -- a new index type where a discriminant is replaced by the local
- -- variable that renames it in the task body.
-
- -----------------------
- -- Actual_Index_Type --
- -----------------------
-
- function Actual_Index_Type (E : Entity_Id) return Entity_Id is
- Typ : constant Entity_Id := Entry_Index_Type (E);
- Lo : constant Node_Id := Type_Low_Bound (Typ);
- Hi : constant Node_Id := Type_High_Bound (Typ);
- New_T : Entity_Id;
-
- function Actual_Discriminant_Ref (Bound : Node_Id) return Node_Id;
- -- If bound is discriminant reference, replace with corresponding
- -- local variable of the same name.
-
- -----------------------------
- -- Actual_Discriminant_Ref --
- -----------------------------
-
- function Actual_Discriminant_Ref (Bound : Node_Id) return Node_Id is
- Typ : constant Entity_Id := Etype (Bound);
- Ref : Node_Id;
- begin
- if not Is_Entity_Name (Bound)
- or else Ekind (Entity (Bound)) /= E_Discriminant
- then
- return Bound;
- else
- Ref := Make_Identifier (Sloc (N), Chars (Entity (Bound)));
- Analyze (Ref);
- Resolve (Ref, Typ);
- return Ref;
- end if;
- end Actual_Discriminant_Ref;
-
- -- Start of processing for Actual_Index_Type
-
- begin
- if not Has_Discriminants (Task_Nam)
- or else (not Is_Entity_Name (Lo)
- and then not Is_Entity_Name (Hi))
- then
- return Entry_Index_Type (E);
- else
- New_T := Create_Itype (Ekind (Typ), N);
- Set_Etype (New_T, Base_Type (Typ));
- Set_Size_Info (New_T, Typ);
- Set_RM_Size (New_T, RM_Size (Typ));
- Set_Scalar_Range (New_T,
- Make_Range (Sloc (N),
- Low_Bound => Actual_Discriminant_Ref (Lo),
- High_Bound => Actual_Discriminant_Ref (Hi)));
-
- return New_T;
- end if;
- end Actual_Index_Type;
-
- -- Start of processing for Analyze_Accept_Statement
-
begin
Tasking_Used := True;
@@ -370,7 +302,7 @@ package body Sem_Ch9 is
Error_Msg_N ("missing entry index in accept for entry family", N);
else
Analyze_And_Resolve (Index, Entry_Index_Type (E));
- Apply_Range_Check (Index, Actual_Index_Type (E));
+ Apply_Range_Check (Index, Entry_Index_Type (E));
end if;
elsif Present (Index) then
@@ -991,9 +923,7 @@ package body Sem_Ch9 is
procedure Analyze_Entry_Index_Specification (N : Node_Id) is
Iden : constant Node_Id := Defining_Identifier (N);
Def : constant Node_Id := Discrete_Subtype_Definition (N);
- Loop_Id : constant Entity_Id :=
- Make_Defining_Identifier (Sloc (N),
- Chars => New_Internal_Name ('L'));
+ Loop_Id : constant Entity_Id := Make_Temporary (Sloc (N), 'L');
begin
Tasking_Used := True;
@@ -1174,9 +1104,7 @@ package body Sem_Ch9 is
E := First_Entity (Current_Scope);
while Present (E) loop
- if Ekind (E) = E_Function
- or else Ekind (E) = E_Procedure
- then
+ if Ekind_In (E, E_Function, E_Procedure) then
Set_Convention (E, Convention_Protected);
elsif Is_Task_Type (Etype (E))
@@ -1248,16 +1176,6 @@ package body Sem_Ch9 is
Set_Is_Constrained (T, not Has_Discriminants (T));
- -- Perform minimal expansion of protected type while inside a generic.
- -- The corresponding record is needed for various semantic checks.
-
- if Ada_Version >= Ada_05
- and then Inside_A_Generic
- then
- Insert_After_And_Analyze (N,
- Build_Corresponding_Record (N, T, Sloc (T)));
- end if;
-
Analyze (Protected_Definition (N));
-- Protected types with entries are controlled (because of the
@@ -1343,9 +1261,7 @@ package body Sem_Ch9 is
Enclosing := Scope_Stack.Table (J).Entity;
exit when Is_Entry (Enclosing);
- if Ekind (Enclosing) /= E_Block
- and then Ekind (Enclosing) /= E_Loop
- then
+ if not Ekind_In (Enclosing, E_Block, E_Loop) then
Error_Msg_N ("requeue must appear within accept or entry body", N);
return;
end if;
@@ -1576,10 +1492,7 @@ package body Sem_Ch9 is
-- perform an unconditional goto so that any further
-- references will not occur anyway.
- if Ekind (Ent) = E_Out_Parameter
- or else
- Ekind (Ent) = E_In_Out_Parameter
- then
+ if Ekind_In (Ent, E_Out_Parameter, E_In_Out_Parameter) then
Set_Never_Set_In_Source (Ent, False);
Set_Is_True_Constant (Ent, False);
end if;
@@ -2053,15 +1966,6 @@ package body Sem_Ch9 is
Set_Is_Constrained (T, not Has_Discriminants (T));
- -- Perform minimal expansion of the task type while inside a generic
- -- context. The corresponding record is needed for various semantic
- -- checks.
-
- if Inside_A_Generic then
- Insert_After_And_Analyze (N,
- Build_Corresponding_Record (N, T, Sloc (T)));
- end if;
-
if Present (Task_Definition (N)) then
Analyze_Task_Definition (Task_Definition (N));
end if;
@@ -2433,15 +2337,17 @@ package body Sem_Ch9 is
Iface := Find_Hidden_Interface (Priv_T_Ifaces, Full_T_Ifaces);
if Present (Iface) then
- Error_Msg_NE ("interface & not implemented by full type " &
- "(RM-2005 7.3 (7.3/2))", Priv_T, Iface);
+ Error_Msg_NE
+ ("interface & not implemented by full type " &
+ "(RM-2005 7.3 (7.3/2))", Priv_T, Iface);
end if;
Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces);
if Present (Iface) then
- Error_Msg_NE ("interface & not implemented by partial " &
- "view (RM-2005 7.3 (7.3/2))", T, Iface);
+ Error_Msg_NE
+ ("interface & not implemented by partial " &
+ "view (RM-2005 7.3 (7.3/2))", T, Iface);
end if;
end if;
end if;
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 9c9da627ee0..a21337bb600 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -175,10 +175,7 @@ package body Sem_Disp is
Next_Formal (Formal);
end loop;
- if Ekind (Subp) = E_Function
- or else
- Ekind (Subp) = E_Generic_Function
- then
+ if Ekind_In (Subp, E_Function, E_Generic_Function) then
Ctrl_Type := Check_Controlling_Type (Etype (Subp), Subp);
if Present (Ctrl_Type) then
@@ -643,8 +640,8 @@ package body Sem_Disp is
end if;
if Present (Func) and then Is_Abstract_Subprogram (Func) then
- Error_Msg_N (
- "call to abstract function must be dispatching", N);
+ Error_Msg_N
+ ("call to abstract function must be dispatching", N);
end if;
end if;
@@ -673,25 +670,22 @@ package body Sem_Disp is
Body_Is_Last_Primitive : Boolean := False;
begin
- if Ekind (Subp) /= E_Procedure and then Ekind (Subp) /= E_Function then
+ if not Ekind_In (Subp, E_Procedure, E_Function) then
return;
end if;
Set_Is_Dispatching_Operation (Subp, False);
Tagged_Type := Find_Dispatching_Type (Subp);
- -- Ada 2005 (AI-345)
+ -- Ada 2005 (AI-345): Use the corresponding record (if available).
+ -- Required because primitives of concurrent types are be attached
+ -- to the corresponding record (not to the concurrent type).
- if Ada_Version = Ada_05
+ if Ada_Version >= Ada_05
and then Present (Tagged_Type)
and then Is_Concurrent_Type (Tagged_Type)
+ and then Present (Corresponding_Record_Type (Tagged_Type))
then
- -- Protect the frontend against previously detected errors
-
- if No (Corresponding_Record_Type (Tagged_Type)) then
- return;
- end if;
-
Tagged_Type := Corresponding_Record_Type (Tagged_Type);
end if;
@@ -749,7 +743,7 @@ package body Sem_Disp is
and then not In_Instance
then
Error_Msg_N ("?declaration of& is too late!", Subp);
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX??
("\spec should appear immediately after declaration of &!",
Subp, Typ);
exit;
@@ -790,7 +784,7 @@ package body Sem_Disp is
and then not Comes_From_Source (Subp)
and then not Has_Dispatching_Parent
then
- -- Complete decoration if internally built subprograms that override
+ -- Complete decoration of internally built subprograms that override
-- a dispatching primitive. These entities correspond with the
-- following cases:
@@ -1071,6 +1065,18 @@ package body Sem_Disp is
end if;
end if;
+ -- If the tagged type is a concurrent type then we must be compiling
+ -- with no code generation (we are either compiling a generic unit or
+ -- compiling under -gnatc mode) because we have previously tested that
+ -- no serious errors has been reported. In this case we do not add the
+ -- primitive to the list of primitives of Tagged_Type but we leave the
+ -- primitive decorated as a dispatching operation to be able to analyze
+ -- and report errors associated with the Object.Operation notation.
+
+ elsif Is_Concurrent_Type (Tagged_Type) then
+ pragma Assert (not Expander_Active);
+ null;
+
-- If no old subprogram, then we add this as a dispatching operation,
-- but we avoid doing this if an error was posted, to prevent annoying
-- cascaded errors.
@@ -1499,7 +1505,7 @@ package body Sem_Disp is
-- For subprograms internally generated by derivations of tagged types
-- use the alias subprogram as a reference to locate the dispatching
- -- type of Subp
+ -- type of Subp.
elsif not Comes_From_Source (Subp)
and then Present (Alias (Subp))
@@ -1703,7 +1709,28 @@ package body Sem_Disp is
return;
end if;
- Replace_Elmt (Elmt, New_Op);
+ -- The location of entities that come from source in the list of
+ -- primitives of the tagged type must follow their order of occurrence
+ -- in the sources to fulfill the C++ ABI. If the overriden entity is a
+ -- primitive of an interface that is not an ancestor of this tagged
+ -- type (that is, it is an entity added to the list of primitives by
+ -- Derive_Interface_Progenitors), then we must append the new entity
+ -- at the end of the list of primitives.
+
+ if Present (Alias (Prev_Op))
+ and then Is_Interface (Find_Dispatching_Type (Alias (Prev_Op)))
+ and then not Is_Ancestor (Find_Dispatching_Type (Alias (Prev_Op)),
+ Tagged_Type)
+ then
+ Remove_Elmt (Primitive_Operations (Tagged_Type), Elmt);
+ Append_Elmt (New_Op, Primitive_Operations (Tagged_Type));
+
+ -- The new primitive replaces the overriden entity. Required to ensure
+ -- that overriding primitive is assigned the same dispatch table slot.
+
+ else
+ Replace_Elmt (Elmt, New_Op);
+ end if;
if Ada_Version >= Ada_05
and then Has_Interfaces (Tagged_Type)
diff --git a/gcc/ada/sem_disp.ads b/gcc/ada/sem_disp.ads
index c0195ecd4fd..3877826ca29 100644
--- a/gcc/ada/sem_disp.ads
+++ b/gcc/ada/sem_disp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -46,7 +46,12 @@ package Sem_Disp is
-- if it has a parameter of this type and is defined at a proper place for
-- primitive operations (new primitives are only defined in package spec,
-- overridden operation can be defined in any scope). If Old_Subp is not
- -- Empty we are in the overriding case.
+ -- Empty we are in the overriding case. If the tagged type associated with
+ -- Subp is a concurrent type (case that occurs when the type is declared in
+ -- a generic because the analysis of generics disables generation of the
+ -- corresponding record) then this routine does does not add "Subp" to the
+ -- list of primitive operations but leaves Subp decorated as dispatching
+ -- operation to enable checks associated with the Object.Operation notation
procedure Check_Operation_From_Incomplete_Type
(Subp : Entity_Id;
diff --git a/gcc/ada/sem_dist.adb b/gcc/ada/sem_dist.adb
index 111a9d2d0d6..64b85758a10 100644
--- a/gcc/ada/sem_dist.adb
+++ b/gcc/ada/sem_dist.adb
@@ -451,9 +451,7 @@ package body Sem_Dist is
-- True iff this RAS has an access formal parameter (see
-- Exp_Dist.Add_RAS_Dereference_TSS for details).
- Subpkg : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('S'));
+ Subpkg : constant Entity_Id := Make_Temporary (Loc, 'S');
Subpkg_Decl : Node_Id;
Subpkg_Body : Node_Id;
Vis_Decls : constant List_Id := New_List;
@@ -464,16 +462,14 @@ package body Sem_Dist is
New_External_Name (Chars (User_Type), 'R'));
Full_Obj_Type : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars (Obj_Type));
+ Make_Defining_Identifier (Loc, Chars (Obj_Type));
RACW_Type : constant Entity_Id :=
Make_Defining_Identifier (Loc,
New_External_Name (Chars (User_Type), 'P'));
Fat_Type : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars (User_Type));
+ Make_Defining_Identifier (Loc, Chars (User_Type));
Fat_Type_Decl : Node_Id;
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 1e278a6bb58..74aac9e5e0e 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2010, 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- --
@@ -599,9 +599,7 @@ package body Sem_Elab is
-- No checks needed for pure or preelaborated compilation units
- if Is_Pure (E_Scope)
- or else Is_Preelaborated (E_Scope)
- then
+ if Is_Pure (E_Scope) or else Is_Preelaborated (E_Scope) then
return;
end if;
@@ -1891,6 +1889,11 @@ package body Sem_Elab is
elsif In_Task_Activation then
return;
+
+ -- Nothing to do if call is within a generic unit
+
+ elsif Inside_A_Generic then
+ return;
end if;
-- Delay this call if we are still delaying calls
@@ -2427,7 +2430,8 @@ package body Sem_Elab is
and then not Elaboration_Checks_Suppressed (Task_Scope)
then
Error_Msg_Node_2 := Task_Scope;
- Error_Msg_NE ("activation of an instance of task type&" &
+ Error_Msg_NE
+ ("activation of an instance of task type&" &
" requires pragma Elaborate_All on &?", N, Ent);
end if;
@@ -3008,10 +3012,7 @@ package body Sem_Elab is
-- Check for case of body entity
-- Why is the check for E_Void needed???
- if Ekind (E) = E_Void
- or else Ekind (E) = E_Subprogram_Body
- or else Ekind (E) = E_Package_Body
- then
+ if Ekind_In (E, E_Void, E_Subprogram_Body, E_Package_Body) then
Decl := E;
loop
@@ -3042,17 +3043,17 @@ package body Sem_Elab is
if No (Corresponding_Body (N)) then
declare
- Loc : constant Source_Ptr := Sloc (N);
- B : Node_Id;
- Formals : constant List_Id :=
- Copy_Parameter_List (Ent);
- Nam : constant Entity_Id :=
- Make_Defining_Identifier (Loc, Chars (Ent));
- Spec : Node_Id;
- Stats : constant List_Id :=
- New_List
- (Make_Raise_Program_Error (Loc,
- Reason => PE_Access_Before_Elaboration));
+ Loc : constant Source_Ptr := Sloc (N);
+ B : Node_Id;
+ Formals : constant List_Id := Copy_Parameter_List (Ent);
+ Nam : constant Entity_Id :=
+ Make_Defining_Identifier (Loc, Chars (Ent));
+ Spec : Node_Id;
+ Stats : constant List_Id :=
+ New_List
+ (Make_Raise_Program_Error (Loc,
+ Reason => PE_Access_Before_Elaboration));
+
begin
if Ekind (Ent) = E_Function then
Spec :=
diff --git a/gcc/ada/sem_elim.adb b/gcc/ada/sem_elim.adb
index e4c99fc01b6..c160c8e419a 100644
--- a/gcc/ada/sem_elim.adb
+++ b/gcc/ada/sem_elim.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2010, 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,7 +29,9 @@ with Errout; use Errout;
with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
+with Opt; use Opt;
with Sem; use Sem;
+with Sem_Aux; use Sem_Aux;
with Sem_Prag; use Sem_Prag;
with Sem_Util; use Sem_Util;
with Sinput; use Sinput;
@@ -234,6 +236,7 @@ package body Sem_Elim is
Elmt : Access_Elim_Data;
Scop : Entity_Id;
Form : Entity_Id;
+ Up : Nat;
begin
if No_Elimination then
@@ -286,21 +289,49 @@ package body Sem_Elim is
goto Continue;
end if;
- -- Find enclosing unit
+ -- Find enclosing unit, and verify that its name and those of its
+ -- parents match.
Scop := Cunit_Entity (Current_Sem_Unit);
-- Now see if compilation unit matches
- for J in reverse Elmt.Unit_Name'Range loop
+ Up := Elmt.Unit_Name'Last;
+
+ -- If we are within a subunit, the name in the pragma has been
+ -- parsed as a child unit, but the current compilation unit is in
+ -- fact the parent in which the subunit is embedded. We must skip
+ -- the first name which is that of the subunit to match the pragma
+ -- specification. Body may be that of a package or subprogram.
+
+ declare
+ Par : Node_Id;
+
+ begin
+ Par := Parent (E);
+ while Present (Par) loop
+ if Nkind (Par) = N_Subunit then
+ if Chars (Defining_Entity (Proper_Body (Par))) =
+ Elmt.Unit_Name (Up)
+ then
+ Up := Up - 1;
+ exit;
+
+ else
+ goto Continue;
+ end if;
+ end if;
+
+ Par := Parent (Par);
+ end loop;
+ end;
+
+ for J in reverse Elmt.Unit_Name'First .. Up loop
if Elmt.Unit_Name (J) /= Chars (Scop) then
goto Continue;
end if;
Scop := Scope (Scop);
- while Ekind (Scop) = E_Block loop
- Scop := Scope (Scop);
- end loop;
if Scop /= Standard_Standard and then J = 1 then
goto Continue;
@@ -311,8 +342,59 @@ package body Sem_Elim is
goto Continue;
end if;
- -- Check for case of given entity is a library level subprogram
- -- and we have the single parameter Eliminate case, a match!
+ if Present (Elmt.Entity_Node)
+ and then Elmt.Entity_Scope /= null
+ then
+ -- Check that names of enclosing scopes match. Skip blocks and
+ -- wrapper package of subprogram instances, which do not appear
+ -- in the pragma.
+
+ Scop := Scope (E);
+
+ for J in reverse Elmt.Entity_Scope'Range loop
+ while Ekind (Scop) = E_Block
+ or else
+ (Ekind (Scop) = E_Package
+ and then Is_Wrapper_Package (Scop))
+ loop
+ Scop := Scope (Scop);
+ end loop;
+
+ if Elmt.Entity_Scope (J) /= Chars (Scop) then
+ if Ekind (Scop) /= E_Protected_Type
+ or else Comes_From_Source (Scop)
+ then
+ goto Continue;
+
+ -- For simple protected declarations, retrieve the source
+ -- name of the object, which appeared in the Eliminate
+ -- pragma.
+
+ else
+ declare
+ Decl : constant Node_Id :=
+ Original_Node (Parent (Scop));
+
+ begin
+ if Elmt.Entity_Scope (J) /=
+ Chars (Defining_Identifier (Decl))
+ then
+ if J > 0 then
+ null;
+ end if;
+ goto Continue;
+ end if;
+ end;
+ end if;
+
+ end if;
+
+ Scop := Scope (Scop);
+ end loop;
+ end if;
+
+ -- If given entity is a library level subprogram and pragma had a
+ -- single parameter, a match!
if Is_Compilation_Unit (E)
and then Is_Subprogram (E)
@@ -332,9 +414,8 @@ package body Sem_Elim is
-- Check for case of subprogram
- elsif Ekind (E) = E_Function
- or else Ekind (E) = E_Procedure
- then
+ elsif Ekind_In (E, E_Function, E_Procedure) then
+
-- If Source_Location present, then see if it matches
if Elmt.Source_Location /= No_Name then
@@ -642,7 +723,20 @@ package body Sem_Elim is
Enclosing_Subp := Enclosing_Subprogram (Enclosing_Subp);
end loop;
- Eliminate_Error_Msg (N, Ultimate_Subp);
+ -- Emit error, unless we are within an instance body and the expander
+ -- is disabled, indicating an instance within an enclosing generic.
+ -- In an instance, the ultimate alias is an internal entity, so place
+ -- the message on the original subprogram.
+
+ if In_Instance_Body and then not Expander_Active then
+ null;
+
+ elsif Comes_From_Source (Ultimate_Subp) then
+ Eliminate_Error_Msg (N, Ultimate_Subp);
+
+ else
+ Eliminate_Error_Msg (N, S);
+ end if;
end if;
end Check_For_Eliminated_Subprogram;
@@ -673,7 +767,9 @@ package body Sem_Elim is
-- Otherwise should not fall through, entry should be in table
else
- raise Program_Error;
+ Error_Msg_NE
+ ("subprogram& is called but its alias is eliminated", N, E);
+ -- raise Program_Error;
end if;
end Eliminate_Error_Msg;
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index c9054f387a8..84bb34a66f2 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -31,6 +31,7 @@ with Elists; use Elists;
with Errout; use Errout;
with Eval_Fat; use Eval_Fat;
with Exp_Util; use Exp_Util;
+with Freeze; use Freeze;
with Lib; use Lib;
with Namet; use Namet;
with Nmake; use Nmake;
@@ -126,6 +127,10 @@ package body Sem_Eval is
-- This is the actual cache, with entries consisting of node/value pairs,
-- and the impossible value Node_High_Bound used for unset entries.
+ type Range_Membership is (In_Range, Out_Of_Range, Unknown);
+ -- Range membership may either be statically known to be in range or out
+ -- of range, or not statically known. Used for Test_In_Range below.
+
-----------------------
-- Local Subprograms --
-----------------------
@@ -176,6 +181,15 @@ package body Sem_Eval is
-- used for producing the result of the static evaluation of the
-- logical operators
+ function Find_Universal_Operator_Type (N : Node_Id) return Entity_Id;
+ -- Check whether an arithmetic operation with universal operands which
+ -- is a rewritten function call with an explicit scope indication is
+ -- ambiguous: P."+" (1, 2) will be ambiguous if there is more than one
+ -- visible numeric type declared in P and the context does not impose a
+ -- type on the result (e.g. in the expression of a type conversion).
+ -- If ambiguous, emit an error and return Empty, else return the result
+ -- type of the operator.
+
procedure Test_Expression_Is_Foldable
(N : Node_Id;
Op1 : Node_Id;
@@ -210,6 +224,18 @@ package body Sem_Eval is
-- Same processing, except applies to an expression N with two operands
-- Op1 and Op2.
+ function Test_In_Range
+ (N : Node_Id;
+ Typ : Entity_Id;
+ Assume_Valid : Boolean;
+ Fixed_Int : Boolean;
+ Int_Real : Boolean) return Range_Membership;
+ -- Common processing for Is_In_Range and Is_Out_Of_Range:
+ -- Returns In_Range or Out_Of_Range if it can be guaranteed at compile time
+ -- that expression N is known to be in or out of range of the subtype Typ.
+ -- If not compile time known, Unknown is returned.
+ -- See documentation of Is_In_Range for complete description of parameters.
+
procedure To_Bits (U : Uint; B : out Bits);
-- Converts a Uint value to a bit string of length B'Length
@@ -1430,6 +1456,7 @@ package body Sem_Eval is
Right : constant Node_Id := Right_Opnd (N);
Ltype : constant Entity_Id := Etype (Left);
Rtype : constant Entity_Id := Etype (Right);
+ Otype : Entity_Id := Empty;
Stat : Boolean;
Fold : Boolean;
@@ -1442,6 +1469,13 @@ package body Sem_Eval is
return;
end if;
+ if Is_Universal_Numeric_Type (Etype (Left))
+ and then
+ Is_Universal_Numeric_Type (Etype (Right))
+ then
+ Otype := Find_Universal_Operator_Type (N);
+ end if;
+
-- Fold for cases where both operands are of integer type
if Is_Integer_Type (Ltype) and then Is_Integer_Type (Rtype) then
@@ -1548,9 +1582,9 @@ package body Sem_Eval is
Fold_Uint (N, Result, Stat);
end;
- -- Cases where at least one operand is a real. We handle the cases
- -- of both reals, or mixed/real integer cases (the latter happen
- -- only for divide and multiply, and the result is always real).
+ -- Cases where at least one operand is a real. We handle the cases of
+ -- both reals, or mixed/real integer cases (the latter happen only for
+ -- divide and multiply, and the result is always real).
elsif Is_Real_Type (Ltype) or else Is_Real_Type (Rtype) then
declare
@@ -1593,6 +1627,14 @@ package body Sem_Eval is
Fold_Ureal (N, Result, Stat);
end;
end if;
+
+ -- If the operator was resolved to a specific type, make sure that type
+ -- is frozen even if the expression is folded into a literal (which has
+ -- a universal type).
+
+ if Present (Otype) then
+ Freeze_Before (N, Otype);
+ end if;
end Eval_Arithmetic_Op;
----------------------------
@@ -1632,10 +1674,7 @@ package body Sem_Eval is
and then Present (Alias (Entity (Name (N))))
and then Is_Enumeration_Type (Base_Type (Typ))
then
- Lit := Alias (Entity (Name (N)));
- while Present (Alias (Lit)) loop
- Lit := Alias (Lit);
- end loop;
+ Lit := Ultimate_Alias (Entity (Name (N)));
if Ekind (Lit) = E_Enumeration_Literal then
if Base_Type (Etype (Lit)) /= Base_Type (Typ) then
@@ -1650,6 +1689,27 @@ package body Sem_Eval is
end if;
end Eval_Call;
+ --------------------------
+ -- Eval_Case_Expression --
+ --------------------------
+
+ -- Right now we do not attempt folding of any case expressions, and the
+ -- language does not require it, so the only required processing is to
+ -- do the check for all expressions appearing in the case expression.
+
+ procedure Eval_Case_Expression (N : Node_Id) is
+ Alt : Node_Id;
+
+ begin
+ Check_Non_Static_Context (Expression (N));
+
+ Alt := First (Alternatives (N));
+ while Present (Alt) loop
+ Check_Non_Static_Context (Expression (Alt));
+ Next (Alt);
+ end loop;
+ end Eval_Case_Expression;
+
------------------------
-- Eval_Concatenation --
------------------------
@@ -1767,18 +1827,79 @@ package body Sem_Eval is
-- Eval_Conditional_Expression --
---------------------------------
- -- This GNAT internal construct can never be statically folded, so the
- -- only required processing is to do the check for non-static context
- -- for the two expression operands.
+ -- We can fold to a static expression if the condition and both constituent
+ -- expressions are static. Otherwise, the only required processing is to do
+ -- the check for non-static context for the then and else expressions.
procedure Eval_Conditional_Expression (N : Node_Id) is
- Condition : constant Node_Id := First (Expressions (N));
- Then_Expr : constant Node_Id := Next (Condition);
- Else_Expr : constant Node_Id := Next (Then_Expr);
+ Condition : constant Node_Id := First (Expressions (N));
+ Then_Expr : constant Node_Id := Next (Condition);
+ Else_Expr : constant Node_Id := Next (Then_Expr);
+ Result : Node_Id;
+ Non_Result : Node_Id;
+
+ Rstat : constant Boolean :=
+ Is_Static_Expression (Condition)
+ and then
+ Is_Static_Expression (Then_Expr)
+ and then
+ Is_Static_Expression (Else_Expr);
begin
- Check_Non_Static_Context (Then_Expr);
- Check_Non_Static_Context (Else_Expr);
+ -- If any operand is Any_Type, just propagate to result and do not try
+ -- to fold, this prevents cascaded errors.
+
+ if Etype (Condition) = Any_Type or else
+ Etype (Then_Expr) = Any_Type or else
+ Etype (Else_Expr) = Any_Type
+ then
+ Set_Etype (N, Any_Type);
+ Set_Is_Static_Expression (N, False);
+ return;
+
+ -- Static case where we can fold. Note that we don't try to fold cases
+ -- where the condition is known at compile time, but the result is
+ -- non-static. This avoids possible cases of infinite recursion where
+ -- the expander puts in a redundant test and we remove it. Instead we
+ -- deal with these cases in the expander.
+
+ elsif Rstat then
+
+ -- Select result operand
+
+ if Is_True (Expr_Value (Condition)) then
+ Result := Then_Expr;
+ Non_Result := Else_Expr;
+ else
+ Result := Else_Expr;
+ Non_Result := Then_Expr;
+ end if;
+
+ -- Note that it does not matter if the non-result operand raises a
+ -- Constraint_Error, but if the result raises constraint error then
+ -- we replace the node with a raise constraint error. This will
+ -- properly propagate Raises_Constraint_Error since this flag is
+ -- set in Result.
+
+ if Raises_Constraint_Error (Result) then
+ Rewrite_In_Raise_CE (N, Result);
+ Check_Non_Static_Context (Non_Result);
+
+ -- Otherwise the result operand replaces the original node
+
+ else
+ Rewrite (N, Relocate_Node (Result));
+ end if;
+
+ -- Case of condition not known at compile time
+
+ else
+ Check_Non_Static_Context (Condition);
+ Check_Non_Static_Context (Then_Expr);
+ Check_Non_Static_Context (Else_Expr);
+ end if;
+
+ Set_Is_Static_Expression (N, Rstat);
end Eval_Conditional_Expression;
----------------------
@@ -2069,7 +2190,11 @@ package body Sem_Eval is
Right_Int : constant Uint := Expr_Value (Right);
begin
- if Is_Modular_Integer_Type (Etype (N)) then
+ -- VMS includes bitwise operations on signed types
+
+ if Is_Modular_Integer_Type (Etype (N))
+ or else Is_VMS_Operator (Entity (N))
+ then
declare
Left_Bits : Bits (0 .. UI_To_Int (Esize (Etype (N))) - 1);
Right_Bits : Bits (0 .. UI_To_Int (Esize (Etype (N))) - 1);
@@ -2144,9 +2269,7 @@ package body Sem_Eval is
-- Ignore if error in either operand, except to make sure that Any_Type
-- is properly propagated to avoid junk cascaded errors.
- if Etype (Left) = Any_Type
- or else Etype (Right) = Any_Type
- then
+ if Etype (Left) = Any_Type or else Etype (Right) = Any_Type then
Set_Etype (N, Any_Type);
return;
end if;
@@ -2219,7 +2342,8 @@ package body Sem_Eval is
declare
Typlen : constant Uint := String_Type_Len (Etype (Right));
Strlen : constant Uint :=
- UI_From_Int (String_Length (Strval (Get_String_Val (Left))));
+ UI_From_Int
+ (String_Length (Strval (Get_String_Val (Left))));
begin
Result := (Typlen = Strlen);
end;
@@ -2252,6 +2376,7 @@ package body Sem_Eval is
end if;
Fold_Uint (N, Test (Result), True);
+
Warn_On_Known_Condition (N);
end Eval_Membership_Op;
@@ -2311,8 +2436,8 @@ package body Sem_Eval is
Result : Uint;
begin
- -- Exponentiation of an integer raises the exception
- -- Constraint_Error for a negative exponent (RM 4.5.6)
+ -- Exponentiation of an integer raises Constraint_Error for a
+ -- negative exponent (RM 4.5.6).
if Right_Int < 0 then
Apply_Compile_Time_Constraint_Error
@@ -2427,9 +2552,9 @@ package body Sem_Eval is
begin
-- Can only fold if target is string or scalar and subtype is static.
- -- Also, do not fold if our parent is an allocator (this is because
- -- the qualified expression is really part of the syntactic structure
- -- of an allocator, and we do not want to end up with something that
+ -- Also, do not fold if our parent is an allocator (this is because the
+ -- qualified expression is really part of the syntactic structure of an
+ -- allocator, and we do not want to end up with something that
-- corresponds to "new 1" where the 1 is the result of folding a
-- qualified expression).
@@ -2529,14 +2654,15 @@ package body Sem_Eval is
-- Eval_Relational_Op --
------------------------
- -- Relational operations are static functions, so the result is static
- -- if both operands are static (RM 4.9(7), 4.9(20)), except that for
- -- strings, the result is never static, even if the operands are.
+ -- Relational operations are static functions, so the result is static if
+ -- both operands are static (RM 4.9(7), 4.9(20)), except that for strings,
+ -- the result is never static, even if the operands are.
procedure Eval_Relational_Op (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Typ : constant Entity_Id := Etype (Left);
+ Otype : Entity_Id := Empty;
Result : Boolean;
Stat : Boolean;
Fold : Boolean;
@@ -2615,7 +2741,7 @@ package body Sem_Eval is
-- entity name, and the two X's are the same and K1 and K2 are
-- known at compile time, in this case, the length can also be
-- computed at compile time, even though the bounds are not
- -- known. A common case of this is e.g. (X'First..X'First+5).
+ -- known. A common case of this is e.g. (X'First .. X'First+5).
Extract_Length : declare
procedure Decompose_Expr
@@ -2645,17 +2771,37 @@ package body Sem_Eval is
if Nkind (Expr) = N_Op_Add
and then Compile_Time_Known_Value (Right_Opnd (Expr))
then
- Exp := Left_Opnd (Expr);
+ Exp := Left_Opnd (Expr);
Cons := Expr_Value (Right_Opnd (Expr));
elsif Nkind (Expr) = N_Op_Subtract
and then Compile_Time_Known_Value (Right_Opnd (Expr))
then
- Exp := Left_Opnd (Expr);
+ Exp := Left_Opnd (Expr);
Cons := -Expr_Value (Right_Opnd (Expr));
+ -- If the bound is a constant created to remove side
+ -- effects, recover original expression to see if it has
+ -- one of the recognizable forms.
+
+ elsif Nkind (Expr) = N_Identifier
+ and then not Comes_From_Source (Entity (Expr))
+ and then Ekind (Entity (Expr)) = E_Constant
+ and then
+ Nkind (Parent (Entity (Expr))) = N_Object_Declaration
+ then
+ Exp := Expression (Parent (Entity (Expr)));
+ Decompose_Expr (Exp, Ent, Kind, Cons);
+
+ -- If original expression includes an entity, create a
+ -- reference to it for use below.
+
+ if Present (Ent) then
+ Exp := New_Occurrence_Of (Ent, Sloc (Ent));
+ end if;
+
else
- Exp := Expr;
+ Exp := Expr;
Cons := Uint_0;
end if;
@@ -2664,8 +2810,10 @@ package body Sem_Eval is
if Nkind (Exp) = N_Attribute_Reference then
if Attribute_Name (Exp) = Name_First then
Kind := 'F';
+
elsif Attribute_Name (Exp) = Name_Last then
Kind := 'L';
+
else
Ent := Empty;
return;
@@ -2746,6 +2894,17 @@ package body Sem_Eval is
Set_Is_Static_Expression (N, False);
end if;
+ -- For operators on universal numeric types called as functions with
+ -- an explicit scope, determine appropriate specific numeric type, and
+ -- diagnose possible ambiguity.
+
+ if Is_Universal_Numeric_Type (Etype (Left))
+ and then
+ Is_Universal_Numeric_Type (Etype (Right))
+ then
+ Otype := Find_Universal_Operator_Type (N);
+ end if;
+
-- For static real type expressions, we cannot use Compile_Time_Compare
-- since it worries about run-time results which are not exact.
@@ -2845,6 +3004,13 @@ package body Sem_Eval is
Fold_Uint (N, Test (Result), Stat);
end if;
+ -- For the case of a folded relational operator on a specific numeric
+ -- type, freeze operand type now.
+
+ if Present (Otype) then
+ Freeze_Before (N, Otype);
+ end if;
+
Warn_On_Known_Condition (N);
end Eval_Relational_Op;
@@ -2852,9 +3018,9 @@ package body Sem_Eval is
-- Eval_Shift --
----------------
- -- Shift operations are intrinsic operations that can never be static,
- -- so the only processing required is to perform the required check for
- -- a non static context for the two operands.
+ -- Shift operations are intrinsic operations that can never be static, so
+ -- the only processing required is to perform the required check for a non
+ -- static context for the two operands.
-- Actually we could do some compile time evaluation here some time ???
@@ -2868,24 +3034,24 @@ package body Sem_Eval is
-- Eval_Short_Circuit --
------------------------
- -- A short circuit operation is potentially static if both operands
- -- are potentially static (RM 4.9 (13))
+ -- A short circuit operation is potentially static if both operands are
+ -- potentially static (RM 4.9 (13)).
procedure Eval_Short_Circuit (N : Node_Id) is
Kind : constant Node_Kind := Nkind (N);
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Left_Int : Uint;
- Rstat : constant Boolean :=
- Is_Static_Expression (Left)
- and then Is_Static_Expression (Right);
+
+ Rstat : constant Boolean :=
+ Is_Static_Expression (Left)
+ and then
+ Is_Static_Expression (Right);
begin
-- Short circuit operations are never static in Ada 83
- if Ada_Version = Ada_83
- and then Comes_From_Source (N)
- then
+ if Ada_Version = Ada_83 and then Comes_From_Source (N) then
Check_Non_Static_Context (Left);
Check_Non_Static_Context (Right);
return;
@@ -2896,8 +3062,8 @@ package body Sem_Eval is
-- are a special case, they can still be foldable, even if the right
-- operand raises constraint error.
- -- If either operand is Any_Type, just propagate to result and
- -- do not try to fold, this prevents cascaded errors.
+ -- If either operand is Any_Type, just propagate to result and do not
+ -- try to fold, this prevents cascaded errors.
if Etype (Left) = Any_Type or else Etype (Right) = Any_Type then
Set_Etype (N, Any_Type);
@@ -2942,7 +3108,7 @@ package body Sem_Eval is
if (Kind = N_And_Then and then Is_False (Left_Int))
or else
- (Kind = N_Or_Else and then Is_True (Left_Int))
+ (Kind = N_Or_Else and then Is_True (Left_Int))
then
Fold_Uint (N, Left_Int, Rstat);
return;
@@ -2970,8 +3136,8 @@ package body Sem_Eval is
-- Eval_Slice --
----------------
- -- Slices can never be static, so the only processing required is to
- -- check for non-static context if an explicit range is given.
+ -- Slices can never be static, so the only processing required is to check
+ -- for non-static context if an explicit range is given.
procedure Eval_Slice (N : Node_Id) is
Drange : constant Node_Id := Discrete_Range (N);
@@ -2981,7 +3147,7 @@ package body Sem_Eval is
Check_Non_Static_Context (High_Bound (Drange));
end if;
- -- A slice of the form A (subtype), when the subtype is the index of
+ -- A slice of the form A (subtype), when the subtype is the index of
-- the type of A, is redundant, the slice can be replaced with A, and
-- this is worth a warning.
@@ -3002,7 +3168,7 @@ package body Sem_Eval is
Error_Msg_N ("redundant slice denotes whole array?", 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;
@@ -3024,7 +3190,7 @@ package body Sem_Eval is
begin
-- Nothing to do if error type (handles cases like default expressions
- -- or generics where we have not yet fully resolved the type)
+ -- or generics where we have not yet fully resolved the type).
if Bas = Any_Type or else Bas = Any_String then
return;
@@ -3042,7 +3208,7 @@ package body Sem_Eval is
end if;
-- Here if Etype of string literal is normal Etype (not yet possible,
- -- but may be possible in future!)
+ -- but may be possible in future).
elsif not Is_OK_Static_Expression
(Type_Low_Bound (Etype (First_Index (Typ))))
@@ -3058,12 +3224,12 @@ package body Sem_Eval is
return;
end if;
- -- Test for illegal Ada 95 cases. A string literal is illegal in
- -- Ada 95 if its bounds are outside the index base type and this
- -- index type is static. This can happen in only two ways. Either
- -- the string literal is too long, or it is null, and the lower
- -- bound is type'First. In either case it is the upper bound that
- -- is out of range of the index type.
+ -- Test for illegal Ada 95 cases. A string literal is illegal in Ada 95
+ -- if its bounds are outside the index base type and this index type is
+ -- static. This can happen in only two ways. Either the string literal
+ -- is too long, or it is null, and the lower bound is type'First. In
+ -- either case it is the upper bound that is out of range of the index
+ -- type.
if Ada_Version >= Ada_95 then
if Root_Type (Bas) = Standard_String
@@ -3109,7 +3275,7 @@ package body Sem_Eval is
-- A type conversion is potentially static if its subtype mark is for a
-- static scalar subtype, and its operand expression is potentially static
- -- (RM 4.9 (10))
+ -- (RM 4.9(10)).
procedure Eval_Type_Conversion (N : Node_Id) is
Operand : constant Node_Id := Expression (N);
@@ -3120,9 +3286,9 @@ package body Sem_Eval is
Fold : Boolean;
function To_Be_Treated_As_Integer (T : Entity_Id) return Boolean;
- -- Returns true if type T is an integer type, or if it is a
- -- fixed-point type to be treated as an integer (i.e. the flag
- -- Conversion_OK is set on the conversion node).
+ -- Returns true if type T is an integer type, or if it is a fixed-point
+ -- type to be treated as an integer (i.e. the flag Conversion_OK is set
+ -- on the conversion node).
function To_Be_Treated_As_Real (T : Entity_Id) return Boolean;
-- Returns true if type T is a floating-point type, or if it is a
@@ -3256,10 +3422,11 @@ package body Sem_Eval is
-------------------
-- Predefined unary operators are static functions (RM 4.9(20)) and thus
- -- are potentially static if the operand is potentially static (RM 4.9(7))
+ -- are potentially static if the operand is potentially static (RM 4.9(7)).
procedure Eval_Unary_Op (N : Node_Id) is
Right : constant Node_Id := Right_Opnd (N);
+ Otype : Entity_Id := Empty;
Stat : Boolean;
Fold : Boolean;
@@ -3272,6 +3439,13 @@ package body Sem_Eval is
return;
end if;
+ if Etype (Right) = Universal_Integer
+ or else
+ Etype (Right) = Universal_Real
+ then
+ Otype := Find_Universal_Operator_Type (N);
+ end if;
+
-- Fold for integer case
if Is_Integer_Type (Etype (N)) then
@@ -3327,6 +3501,14 @@ package body Sem_Eval is
Fold_Ureal (N, Result, Stat);
end;
end if;
+
+ -- If the operator was resolved to a specific type, make sure that type
+ -- is frozen even if the expression is folded into a literal (which has
+ -- a universal type).
+
+ if Present (Otype) then
+ Freeze_Before (N, Otype);
+ end if;
end Eval_Unary_Op;
-------------------------------
@@ -3353,8 +3535,8 @@ package body Sem_Eval is
if Is_Entity_Name (N) then
Ent := Entity (N);
- -- An enumeration literal that was either in the source or
- -- created as a result of static evaluation.
+ -- An enumeration literal that was either in the source or created
+ -- as a result of static evaluation.
if Ekind (Ent) = E_Enumeration_Literal then
return Enumeration_Rep (Ent);
@@ -3366,8 +3548,8 @@ package body Sem_Eval is
return Expr_Rep_Value (Constant_Value (Ent));
end if;
- -- An integer literal that was either in the source or created
- -- as a result of static evaluation.
+ -- An integer literal that was either in the source or created as a
+ -- result of static evaluation.
elsif Kind = N_Integer_Literal then
return Intval (N);
@@ -3394,11 +3576,11 @@ package body Sem_Eval is
pragma Assert (Kind = N_Character_Literal);
Ent := Entity (N);
- -- Since Character literals of type Standard.Character don't
- -- have any defining character literals built for them, they
- -- do not have their Entity set, so just use their Char
- -- code. Otherwise for user-defined character literals use
- -- their Pos value as usual which is the same as the Rep value.
+ -- Since Character literals of type Standard.Character don't have any
+ -- defining character literals built for them, they do not have their
+ -- Entity set, so just use their Char code. Otherwise for user-
+ -- defined character literals use their Pos value as usual which is
+ -- the same as the Rep value.
if No (Ent) then
return Char_Literal_Value (N);
@@ -3432,8 +3614,8 @@ package body Sem_Eval is
if Is_Entity_Name (N) then
Ent := Entity (N);
- -- An enumeration literal that was either in the source or
- -- created as a result of static evaluation.
+ -- An enumeration literal that was either in the source or created as
+ -- a result of static evaluation.
if Ekind (Ent) = E_Enumeration_Literal then
Val := Enumeration_Pos (Ent);
@@ -3445,8 +3627,8 @@ package body Sem_Eval is
Val := Expr_Value (Constant_Value (Ent));
end if;
- -- An integer literal that was either in the source or created
- -- as a result of static evaluation.
+ -- An integer literal that was either in the source or created as a
+ -- result of static evaluation.
elsif Kind = N_Integer_Literal then
Val := Intval (N);
@@ -3558,8 +3740,8 @@ package body Sem_Eval is
return Ureal_0;
end if;
- -- If we fall through, we have a node that cannot be interpreted
- -- as a compile time constant. That is definitely an error.
+ -- If we fall through, we have a node that cannot be interpreted as a
+ -- compile time constant. That is definitely an error.
raise Program_Error;
end Expr_Value_R;
@@ -3578,6 +3760,144 @@ package body Sem_Eval is
end if;
end Expr_Value_S;
+ ----------------------------------
+ -- Find_Universal_Operator_Type --
+ ----------------------------------
+
+ function Find_Universal_Operator_Type (N : Node_Id) return Entity_Id is
+ PN : constant Node_Id := Parent (N);
+ Call : constant Node_Id := Original_Node (N);
+ Is_Int : constant Boolean := Is_Integer_Type (Etype (N));
+
+ Is_Fix : constant Boolean :=
+ Nkind (N) in N_Binary_Op
+ and then Nkind (Right_Opnd (N)) /= Nkind (Left_Opnd (N));
+ -- A mixed-mode operation in this context indicates the presence of
+ -- fixed-point type in the designated package.
+
+ Is_Relational : constant Boolean := Etype (N) = Standard_Boolean;
+ -- Case where N is a relational (or membership) operator (else it is an
+ -- arithmetic one).
+
+ In_Membership : constant Boolean :=
+ Nkind (PN) in N_Membership_Test
+ and then
+ Nkind (Right_Opnd (PN)) = N_Range
+ and then
+ Is_Universal_Numeric_Type (Etype (Left_Opnd (PN)))
+ and then
+ Is_Universal_Numeric_Type
+ (Etype (Low_Bound (Right_Opnd (PN))))
+ and then
+ Is_Universal_Numeric_Type
+ (Etype (High_Bound (Right_Opnd (PN))));
+ -- Case where N is part of a membership test with a universal range
+
+ E : Entity_Id;
+ Pack : Entity_Id;
+ Typ1 : Entity_Id := Empty;
+ Priv_E : Entity_Id;
+
+ function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean;
+ -- Check whether one operand is a mixed-mode operation that requires the
+ -- presence of a fixed-point type. Given that all operands are universal
+ -- and have been constant-folded, retrieve the original function call.
+
+ ---------------------------
+ -- Is_Mixed_Mode_Operand --
+ ---------------------------
+
+ function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean is
+ Onod : constant Node_Id := Original_Node (Op);
+ begin
+ return Nkind (Onod) = N_Function_Call
+ and then Present (Next_Actual (First_Actual (Onod)))
+ and then Etype (First_Actual (Onod)) /=
+ Etype (Next_Actual (First_Actual (Onod)));
+ end Is_Mixed_Mode_Operand;
+
+ -- Start of processing for Find_Universal_Operator_Type
+
+ begin
+ if Nkind (Call) /= N_Function_Call
+ or else Nkind (Name (Call)) /= N_Expanded_Name
+ then
+ return Empty;
+
+ -- There are several cases where the context does not imply the type of
+ -- the operands:
+ -- - the universal expression appears in a type conversion;
+ -- - the expression is a relational operator applied to universal
+ -- operands;
+ -- - the expression is a membership test with a universal operand
+ -- and a range with universal bounds.
+
+ elsif Nkind (Parent (N)) = N_Type_Conversion
+ or else Is_Relational
+ or else In_Membership
+ then
+ Pack := Entity (Prefix (Name (Call)));
+
+ -- If the prefix is a package declared elsewhere, iterate over its
+ -- visible entities, otherwise iterate over all declarations in the
+ -- designated scope.
+
+ if Ekind (Pack) = E_Package
+ and then not In_Open_Scopes (Pack)
+ then
+ Priv_E := First_Private_Entity (Pack);
+ else
+ Priv_E := Empty;
+ end if;
+
+ Typ1 := Empty;
+ E := First_Entity (Pack);
+ while Present (E) and then E /= Priv_E loop
+ if Is_Numeric_Type (E)
+ and then Nkind (Parent (E)) /= N_Subtype_Declaration
+ and then Comes_From_Source (E)
+ and then Is_Integer_Type (E) = Is_Int
+ and then
+ (Nkind (N) in N_Unary_Op
+ or else Is_Relational
+ or else Is_Fixed_Point_Type (E) = Is_Fix)
+ then
+ if No (Typ1) then
+ Typ1 := E;
+
+ -- Before emitting an error, check for the presence of a
+ -- mixed-mode operation that specifies a fixed point type.
+
+ elsif Is_Relational
+ and then
+ (Is_Mixed_Mode_Operand (Left_Opnd (N))
+ or else Is_Mixed_Mode_Operand (Right_Opnd (N)))
+ and then Is_Fixed_Point_Type (E) /= Is_Fixed_Point_Type (Typ1)
+
+ then
+ if Is_Fixed_Point_Type (E) then
+ Typ1 := E;
+ end if;
+
+ else
+ -- More than one type of the proper class declared in P
+
+ Error_Msg_N ("ambiguous operation", N);
+ Error_Msg_Sloc := Sloc (Typ1);
+ Error_Msg_N ("\possible interpretation (inherited)#", N);
+ Error_Msg_Sloc := Sloc (E);
+ Error_Msg_N ("\possible interpretation (inherited)#", N);
+ return Empty;
+ end if;
+ end if;
+
+ Next_Entity (E);
+ end loop;
+ end if;
+
+ return Typ1;
+ end Find_Universal_Operator_Type;
+
--------------------------
-- Flag_Non_Static_Expr --
--------------------------
@@ -3623,8 +3943,8 @@ package body Sem_Eval is
Ent : Entity_Id;
begin
- -- If we are folding a named number, retain the entity in the
- -- literal, for ASIS use.
+ -- If we are folding a named number, retain the entity in the literal,
+ -- for ASIS use.
if Is_Entity_Name (N)
and then Ekind (Entity (N)) = E_Named_Integer
@@ -3677,8 +3997,8 @@ package body Sem_Eval is
Ent : Entity_Id;
begin
- -- If we are folding a named number, retain the entity in the
- -- literal, for ASIS use.
+ -- If we are folding a named number, retain the entity in the literal,
+ -- for ASIS use.
if Is_Entity_Name (N)
and then Ekind (Entity (N)) = E_Named_Real
@@ -3872,78 +4192,9 @@ package body Sem_Eval is
Fixed_Int : Boolean := False;
Int_Real : Boolean := False) return Boolean
is
- Val : Uint;
- Valr : Ureal;
-
- pragma Warnings (Off, Assume_Valid);
- -- For now Assume_Valid is unreferenced since the current implementation
- -- always returns False if N is not a compile time known value, but we
- -- keep the parameter to allow for future enhancements in which we try
- -- to get the information in the variable case as well.
-
begin
- -- Universal types have no range limits, so always in range
-
- if Typ = Universal_Integer or else Typ = Universal_Real then
- return True;
-
- -- Never in range if not scalar type. Don't know if this can
- -- actually happen, but our spec allows it, so we must check!
-
- elsif not Is_Scalar_Type (Typ) then
- return False;
-
- -- Never in range unless we have a compile time known value
-
- elsif not Compile_Time_Known_Value (N) then
- return False;
-
- -- General processing with a known compile time value
-
- else
- declare
- Lo : Node_Id;
- Hi : Node_Id;
- LB_Known : Boolean;
- UB_Known : Boolean;
-
- begin
- Lo := Type_Low_Bound (Typ);
- Hi := Type_High_Bound (Typ);
-
- LB_Known := Compile_Time_Known_Value (Lo);
- UB_Known := Compile_Time_Known_Value (Hi);
-
- -- Fixed point types should be considered as such only in
- -- flag Fixed_Int is set to False.
-
- if Is_Floating_Point_Type (Typ)
- or else (Is_Fixed_Point_Type (Typ) and then not Fixed_Int)
- or else Int_Real
- then
- Valr := Expr_Value_R (N);
-
- if LB_Known and then Valr >= Expr_Value_R (Lo)
- and then UB_Known and then Valr <= Expr_Value_R (Hi)
- then
- return True;
- else
- return False;
- end if;
-
- else
- Val := Expr_Value (N);
-
- if LB_Known and then Val >= Expr_Value (Lo)
- and then UB_Known and then Val <= Expr_Value (Hi)
- then
- return True;
- else
- return False;
- end if;
- end if;
- end;
- end if;
+ return Test_In_Range (N, Typ, Assume_Valid, Fixed_Int, Int_Real)
+ = In_Range;
end Is_In_Range;
-------------------
@@ -3998,8 +4249,8 @@ package body Sem_Eval is
-- Is_OK_Static_Subtype --
--------------------------
- -- Determines if Typ is a static subtype as defined in (RM 4.9(26))
- -- where neither bound raises constraint error when evaluated.
+ -- Determines if Typ is a static subtype as defined in (RM 4.9(26)) where
+ -- neither bound raises constraint error when evaluated.
function Is_OK_Static_Subtype (Typ : Entity_Id) return Boolean is
Base_T : constant Entity_Id := Base_Type (Typ);
@@ -4041,8 +4292,8 @@ package body Sem_Eval is
return True;
else
- -- Scalar_Range (Typ) might be an N_Subtype_Indication, so
- -- use Get_Type_Low,High_Bound.
+ -- Scalar_Range (Typ) might be an N_Subtype_Indication, so use
+ -- Get_Type_{Low,High}_Bound.
return Is_OK_Static_Subtype (Anc_Subt)
and then Is_OK_Static_Expression (Type_Low_Bound (Typ))
@@ -4067,90 +4318,9 @@ package body Sem_Eval is
Fixed_Int : Boolean := False;
Int_Real : Boolean := False) return Boolean
is
- Val : Uint;
- Valr : Ureal;
-
- pragma Warnings (Off, Assume_Valid);
- -- For now Assume_Valid is unreferenced since the current implementation
- -- always returns False if N is not a compile time known value, but we
- -- keep the parameter to allow for future enhancements in which we try
- -- to get the information in the variable case as well.
-
begin
- -- Universal types have no range limits, so always in range
-
- if Typ = Universal_Integer or else Typ = Universal_Real then
- return False;
-
- -- Never out of range if not scalar type. Don't know if this can
- -- actually happen, but our spec allows it, so we must check!
-
- elsif not Is_Scalar_Type (Typ) then
- return False;
-
- -- Never out of range if this is a generic type, since the bounds
- -- of generic types are junk. Note that if we only checked for
- -- static expressions (instead of compile time known values) below,
- -- we would not need this check, because values of a generic type
- -- can never be static, but they can be known at compile time.
-
- elsif Is_Generic_Type (Typ) then
- return False;
-
- -- Never out of range unless we have a compile time known value
-
- elsif not Compile_Time_Known_Value (N) then
- return False;
-
- else
- declare
- Lo : Node_Id;
- Hi : Node_Id;
- LB_Known : Boolean;
- UB_Known : Boolean;
-
- begin
- Lo := Type_Low_Bound (Typ);
- Hi := Type_High_Bound (Typ);
-
- LB_Known := Compile_Time_Known_Value (Lo);
- UB_Known := Compile_Time_Known_Value (Hi);
-
- -- Real types (note that fixed-point types are not treated
- -- as being of a real type if the flag Fixed_Int is set,
- -- since in that case they are regarded as integer types).
-
- if Is_Floating_Point_Type (Typ)
- or else (Is_Fixed_Point_Type (Typ) and then not Fixed_Int)
- or else Int_Real
- then
- Valr := Expr_Value_R (N);
-
- if LB_Known and then Valr < Expr_Value_R (Lo) then
- return True;
-
- elsif UB_Known and then Expr_Value_R (Hi) < Valr then
- return True;
-
- else
- return False;
- end if;
-
- else
- Val := Expr_Value (N);
-
- if LB_Known and then Val < Expr_Value (Lo) then
- return True;
-
- elsif UB_Known and then Expr_Value (Hi) < Val then
- return True;
-
- else
- return False;
- end if;
- end if;
- end;
- end if;
+ return Test_In_Range (N, Typ, Assume_Valid, Fixed_Int, Int_Real)
+ = Out_Of_Range;
end Is_Out_Of_Range;
---------------------
@@ -4275,10 +4445,9 @@ package body Sem_Eval is
begin
-- If we have the static expression case, then this is an illegality
-- in Ada 95 mode, except that in an instance, we never generate an
- -- error (if the error is legitimate, it was already diagnosed in
- -- the template). The expression to compute the length of a packed
- -- array is attached to the array type itself, and deserves a separate
- -- message.
+ -- error (if the error is legitimate, it was already diagnosed in the
+ -- template). The expression to compute the length of a packed array is
+ -- attached to the array type itself, and deserves a separate message.
if Is_Static_Expression (N)
and then not In_Instance
@@ -4300,8 +4469,8 @@ package body Sem_Eval is
(N, "value not in range of}", CE_Range_Check_Failed);
end if;
- -- Here we generate a warning for the Ada 83 case, or when we are
- -- in an instance, or when we have a non-static expression case.
+ -- Here we generate a warning for the Ada 83 case, or when we are in an
+ -- instance, or when we have a non-static expression case.
else
Apply_Compile_Time_Constraint_Error
@@ -4317,22 +4486,22 @@ package body Sem_Eval is
Typ : constant Entity_Id := Etype (N);
begin
- -- If we want to raise CE in the condition of a raise_CE node
- -- we may as well get rid of the condition
+ -- If we want to raise CE in the condition of a N_Raise_CE node
+ -- we may as well get rid of the condition.
if Present (Parent (N))
and then Nkind (Parent (N)) = N_Raise_Constraint_Error
then
Set_Condition (Parent (N), Empty);
- -- If the expression raising CE is a N_Raise_CE node, we can use
- -- that one. We just preserve the type of the context
+ -- If the expression raising CE is a N_Raise_CE node, we can use that
+ -- one. We just preserve the type of the context.
elsif Nkind (Exp) = N_Raise_Constraint_Error then
Rewrite (N, Exp);
Set_Etype (N, Typ);
- -- We have to build an explicit raise_ce node
+ -- Else build an explcit N_Raise_CE
else
Rewrite (N,
@@ -4470,15 +4639,15 @@ package body Sem_Eval is
-- subtype, i.e. both types must be constrained or unconstrained.
-- To understand the requirement for this test, see RM 4.9.1(1).
- -- As is made clear in RM 3.5.4(11), type Integer, for example
- -- is a constrained subtype with constraint bounds matching the
- -- bounds of its corresponding unconstrained base type. In this
- -- situation, Integer and Integer'Base do not statically match,
- -- even though they have the same bounds.
+ -- As is made clear in RM 3.5.4(11), type Integer, for example is
+ -- a constrained subtype with constraint bounds matching the bounds
+ -- of its corresponding unconstrained base type. In this situation,
+ -- Integer and Integer'Base do not statically match, even though
+ -- they have the same bounds.
- -- We only apply this test to types in Standard and types that
- -- appear in user programs. That way, we do not have to be
- -- too careful about setting Is_Constrained right for itypes.
+ -- We only apply this test to types in Standard and types that appear
+ -- in user programs. That way, we do not have to be too careful about
+ -- setting Is_Constrained right for Itypes.
if Is_Numeric_Type (T1)
and then (Is_Constrained (T1) /= Is_Constrained (T2))
@@ -4489,9 +4658,9 @@ package body Sem_Eval is
then
return False;
- -- A generic scalar type does not statically match its base
- -- type (AI-311). In this case we make sure that the formals,
- -- which are first subtypes of their bases, are constrained.
+ -- A generic scalar type does not statically match its base type
+ -- (AI-311). In this case we make sure that the formals, which are
+ -- first subtypes of their bases, are constrained.
elsif Is_Generic_Type (T1)
and then Is_Generic_Type (T2)
@@ -4500,8 +4669,8 @@ package body Sem_Eval is
return False;
end if;
- -- If there was an error in either range, then just assume
- -- the types statically match to avoid further junk errors
+ -- If there was an error in either range, then just assume the types
+ -- statically match to avoid further junk errors.
if Error_Posted (Scalar_Range (T1))
or else
@@ -4532,8 +4701,8 @@ package body Sem_Eval is
then
return False;
- -- If either type has constraint error bounds, then say
- -- that they match to avoid junk cascaded errors here.
+ -- If either type has constraint error bounds, then say that
+ -- they match to avoid junk cascaded errors here.
elsif not Is_OK_Static_Subtype (T1)
or else not Is_OK_Static_Subtype (T2)
@@ -4643,11 +4812,11 @@ package body Sem_Eval is
return True;
- -- A definite type does not match an indefinite or classwide type
+ -- A definite type does not match an indefinite or classwide type.
-- However, a generic type with unknown discriminants may be
-- instantiated with a type with no discriminants, and conformance
- -- checking on an inherited operation may compare the actual with
- -- the subtype that renames it in the instance.
+ -- checking on an inherited operation may compare the actual with the
+ -- subtype that renames it in the instance.
elsif
Has_Unknown_Discriminants (T1) /= Has_Unknown_Discriminants (T2)
@@ -4659,16 +4828,15 @@ package body Sem_Eval is
elsif Is_Array_Type (T1) then
- -- If either subtype is unconstrained then both must be,
- -- and if both are unconstrained then no further checking
- -- is needed.
+ -- If either subtype is unconstrained then both must be, and if both
+ -- are unconstrained then no further checking is neede.
if not Is_Constrained (T1) or else not Is_Constrained (T2) then
return not (Is_Constrained (T1) or else Is_Constrained (T2));
end if;
- -- Both subtypes are constrained, so check that the index
- -- subtypes statically match.
+ -- Both subtypes are constrained, so check that the index subtypes
+ -- statically match.
declare
Index1 : Node_Id := First_Index (T1);
@@ -4693,8 +4861,8 @@ package body Sem_Eval is
if Can_Never_Be_Null (T1) /= Can_Never_Be_Null (T2) then
return False;
- elsif Ekind (T1) = E_Access_Subprogram_Type
- or else Ekind (T1) = E_Anonymous_Access_Subprogram_Type
+ elsif Ekind_In (T1, E_Access_Subprogram_Type,
+ E_Anonymous_Access_Subprogram_Type)
then
return
Subtype_Conformant
@@ -4819,8 +4987,8 @@ package body Sem_Eval is
Set_Etype (N, Any_Type);
return;
- -- If left operand raises constraint error, then replace node N with
- -- the raise constraint error node, and we are obviously not foldable.
+ -- If left operand raises constraint error, then replace node N with the
+ -- Raise_Constraint_Error node, and we are obviously not foldable.
-- Is_Static_Expression is set from the two operands in the normal way,
-- and we check the right operand if it is in a non-static context.
@@ -4833,9 +5001,9 @@ package body Sem_Eval is
Set_Is_Static_Expression (N, Rstat);
return;
- -- Similar processing for the case of the right operand. Note that
- -- we don't use this routine for the short-circuit case, so we do
- -- not have to worry about that special case here.
+ -- Similar processing for the case of the right operand. Note that we
+ -- don't use this routine for the short-circuit case, so we do not have
+ -- to worry about that special case here.
elsif Raises_Constraint_Error (Op2) then
if not Rstat then
@@ -4855,7 +5023,7 @@ package body Sem_Eval is
return;
-- If result is not static, then check non-static contexts on operands
- -- since one of them may be static and the other one may not be static
+ -- since one of them may be static and the other one may not be static.
elsif not Rstat then
Check_Non_Static_Context (Op1);
@@ -4864,8 +5032,8 @@ package body Sem_Eval is
and then Compile_Time_Known_Value (Op2);
return;
- -- Else result is static and foldable. Both operands are static,
- -- and neither raises constraint error, so we can definitely fold.
+ -- Else result is static and foldable. Both operands are static, and
+ -- neither raises constraint error, so we can definitely fold.
else
Set_Is_Static_Expression (N);
@@ -4875,6 +5043,125 @@ package body Sem_Eval is
end if;
end Test_Expression_Is_Foldable;
+ -------------------
+ -- Test_In_Range --
+ -------------------
+
+ function Test_In_Range
+ (N : Node_Id;
+ Typ : Entity_Id;
+ Assume_Valid : Boolean;
+ Fixed_Int : Boolean;
+ Int_Real : Boolean) return Range_Membership
+ is
+ Val : Uint;
+ Valr : Ureal;
+
+ pragma Warnings (Off, Assume_Valid);
+ -- For now Assume_Valid is unreferenced since the current implementation
+ -- always returns Unknown if N is not a compile time known value, but we
+ -- keep the parameter to allow for future enhancements in which we try
+ -- to get the information in the variable case as well.
+
+ begin
+ -- Universal types have no range limits, so always in range
+
+ if Typ = Universal_Integer or else Typ = Universal_Real then
+ return In_Range;
+
+ -- Never known if not scalar type. Don't know if this can actually
+ -- happen, but our spec allows it, so we must check!
+
+ elsif not Is_Scalar_Type (Typ) then
+ return Unknown;
+
+ -- Never known if this is a generic type, since the bounds of generic
+ -- types are junk. Note that if we only checked for static expressions
+ -- (instead of compile time known values) below, we would not need this
+ -- check, because values of a generic type can never be static, but they
+ -- can be known at compile time.
+
+ elsif Is_Generic_Type (Typ) then
+ return Unknown;
+
+ -- Never known unless we have a compile time known value
+
+ elsif not Compile_Time_Known_Value (N) then
+ return Unknown;
+
+ -- General processing with a known compile time value
+
+ else
+ declare
+ Lo : Node_Id;
+ Hi : Node_Id;
+
+ LB_Known : Boolean;
+ HB_Known : Boolean;
+
+ begin
+ Lo := Type_Low_Bound (Typ);
+ Hi := Type_High_Bound (Typ);
+
+ LB_Known := Compile_Time_Known_Value (Lo);
+ HB_Known := Compile_Time_Known_Value (Hi);
+
+ -- Fixed point types should be considered as such only if flag
+ -- Fixed_Int is set to False.
+
+ if Is_Floating_Point_Type (Typ)
+ or else (Is_Fixed_Point_Type (Typ) and then not Fixed_Int)
+ or else Int_Real
+ then
+ Valr := Expr_Value_R (N);
+
+ if LB_Known and HB_Known then
+ if Valr >= Expr_Value_R (Lo)
+ and then
+ Valr <= Expr_Value_R (Hi)
+ then
+ return In_Range;
+ else
+ return Out_Of_Range;
+ end if;
+
+ elsif (LB_Known and then Valr < Expr_Value_R (Lo))
+ or else
+ (HB_Known and then Valr > Expr_Value_R (Hi))
+ then
+ return Out_Of_Range;
+
+ else
+ return Unknown;
+ end if;
+
+ else
+ Val := Expr_Value (N);
+
+ if LB_Known and HB_Known then
+ if Val >= Expr_Value (Lo)
+ and then
+ Val <= Expr_Value (Hi)
+ then
+ return In_Range;
+ else
+ return Out_Of_Range;
+ end if;
+
+ elsif (LB_Known and then Val < Expr_Value (Lo))
+ or else
+ (HB_Known and then Val > Expr_Value (Hi))
+ then
+ return Out_Of_Range;
+
+ else
+ return Unknown;
+ end if;
+ end if;
+ end;
+ end if;
+ end Test_In_Range;
+
--------------
-- To_Bits --
--------------
@@ -4896,8 +5183,8 @@ package body Sem_Eval is
E : Entity_Id;
procedure Why_Not_Static_List (L : List_Id);
- -- A version that can be called on a list of expressions. Finds
- -- all non-static violations in any element of the list.
+ -- A version that can be called on a list of expressions. Finds all
+ -- non-static violations in any element of the list.
-------------------------
-- Why_Not_Static_List --
@@ -4919,8 +5206,8 @@ package body Sem_Eval is
-- Start of processing for Why_Not_Static
begin
- -- If in ACATS mode (debug flag 2), then suppress all these
- -- messages, this avoids massive updates to the ACATS base line.
+ -- If in ACATS mode (debug flag 2), then suppress all these messages,
+ -- this avoids massive updates to the ACATS base line.
if Debug_Flag_2 then
return;
@@ -5044,8 +5331,8 @@ package body Sem_Eval is
return;
- -- Special case generic types, since again this is a common
- -- source of confusion.
+ -- Special case generic types, since again this is a common source
+ -- of confusion.
elsif Is_Generic_Actual_Type (E)
or else
diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads
index 565ce675873..078ac375c35 100644
--- a/gcc/ada/sem_eval.ads
+++ b/gcc/ada/sem_eval.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -282,6 +282,7 @@ package Sem_Eval is
procedure Eval_Allocator (N : Node_Id);
procedure Eval_Arithmetic_Op (N : Node_Id);
procedure Eval_Call (N : Node_Id);
+ procedure Eval_Case_Expression (N : Node_Id);
procedure Eval_Character_Literal (N : Node_Id);
procedure Eval_Concatenation (N : Node_Id);
procedure Eval_Conditional_Expression (N : Node_Id);
diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb
index 42136b13ee8..20a1614fb06 100644
--- a/gcc/ada/sem_intr.adb
+++ b/gcc/ada/sem_intr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -53,8 +53,8 @@ package body Sem_Intr is
-- returns type String.
procedure Check_Intrinsic_Operator (E : Entity_Id; N : Node_Id);
- -- Check that operator is one of the binary arithmetic operators, and
- -- that the types involved have the same size.
+ -- Check that operator is one of the binary arithmetic operators, and that
+ -- the types involved both have underlying integer types.
procedure Check_Shift (E : Entity_Id; N : Node_Id);
-- Check intrinsic shift subprogram, the two arguments are the same
@@ -73,9 +73,7 @@ package body Sem_Intr is
procedure Check_Exception_Function (E : Entity_Id; N : Node_Id) is
begin
- if Ekind (E) /= E_Function
- and then Ekind (E) /= E_Generic_Function
- then
+ if not Ekind_In (E, E_Function, E_Generic_Function) then
Errint
("intrinsic exception subprogram must be a function", E, N);
@@ -200,11 +198,24 @@ package body Sem_Intr is
T2 := Etype (Next_Formal (First_Formal (E)));
end if;
- if Root_Type (T1) /= Root_Type (T2)
- or else Root_Type (T1) /= Root_Type (Ret)
+ if Root_Type (T1) = Root_Type (T2)
+ or else Root_Type (T1) = Root_Type (Ret)
+ then
+ -- Same types, predefined operator will apply
+
+ null;
+
+ elsif Is_Integer_Type (Underlying_Type (T1))
+ and then Is_Integer_Type (Underlying_Type (T2))
+ and then Is_Integer_Type (Underlying_Type (Ret))
then
+ -- Expansion will introduce conversions if sizes are not equal
+
+ null;
+
+ else
Errint
- ("types of intrinsic operator must have the same size", E, N);
+ ("types of intrinsic operator operands do not match", E, N);
end if;
-- Comparison operators
@@ -274,7 +285,7 @@ package body Sem_Intr is
return;
end if;
- if not Is_Numeric_Type (T1) then
+ if not Is_Numeric_Type (Underlying_Type (T1)) then
Errint ("intrinsic operator can only apply to numeric types", E, N);
end if;
end Check_Intrinsic_Operator;
@@ -374,9 +385,7 @@ package body Sem_Intr is
Ptyp2 : Node_Id;
begin
- if Ekind (E) /= E_Function
- and then Ekind (E) /= E_Generic_Function
- then
+ if not Ekind_In (E, E_Function, E_Generic_Function) then
Errint ("intrinsic shift subprogram must be a function", E, N);
return;
end if;
diff --git a/gcc/ada/sem_mech.adb b/gcc/ada/sem_mech.adb
index 5f18176b8c2..1954b3deb74 100644
--- a/gcc/ada/sem_mech.adb
+++ b/gcc/ada/sem_mech.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2010, 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- --
@@ -92,8 +92,7 @@ package body Sem_Mech is
return;
elsif Chars (Mech_Name) = Name_Copy then
- Error_Msg_N
- ("bad mechanism name, Value assumed", Mech_Name);
+ Error_Msg_N ("bad mechanism name, Value assumed", Mech_Name);
Set_Mechanism (Ent, By_Copy);
else
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 29b4cdf7db6..e5afd0cebb8 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -46,6 +46,7 @@ with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Output; use Output;
+with Par_SCO; use Par_SCO;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
@@ -376,10 +377,6 @@ package body Sem_Prag is
-- Any_Integer is OK). If not, given error and raise Pragma_Exit. If
-- Typ is left Empty, then any static expression is allowed.
- procedure Check_Arg_Is_String_Literal (Arg : Node_Id);
- -- Check the specified argument Arg to make sure that it is a string
- -- literal. If not give error and raise Pragma_Exit
-
procedure Check_Arg_Is_Task_Dispatching_Policy (Arg : Node_Id);
-- Check the specified argument Arg to make sure that it is a valid task
-- dispatching policy name. If not give error and raise Pragma_Exit.
@@ -1014,19 +1011,6 @@ package body Sem_Prag is
end if;
end Check_Arg_Is_Static_Expression;
- ---------------------------------
- -- Check_Arg_Is_String_Literal --
- ---------------------------------
-
- procedure Check_Arg_Is_String_Literal (Arg : Node_Id) is
- Argx : constant Node_Id := Get_Pragma_Arg (Arg);
- begin
- if Nkind (Argx) /= N_String_Literal then
- Error_Pragma_Arg
- ("argument for pragma% must be string literal", Argx);
- end if;
- end Check_Arg_Is_String_Literal;
-
------------------------------------------
-- Check_Arg_Is_Task_Dispatching_Policy --
------------------------------------------
@@ -1154,14 +1138,6 @@ package body Sem_Prag is
String_Val : constant String_Id := Strval (Nam);
begin
- -- We allow duplicated export names in CIL, as they are always
- -- enclosed in a namespace that differentiates them, and overloaded
- -- entities are supported by the VM.
-
- if VM_Target = CLI_Target then
- return;
- end if;
-
-- We are only interested in the export case, and in the case of
-- generics, it is the instance, not the template, that is the
-- problem (the template will generate a warning in any case).
@@ -1418,9 +1394,12 @@ package body Sem_Prag is
Pragma_Misplaced;
end if;
- -- Record whether pragma is enabled
+ -- Record if pragma is enabled
- Set_Pragma_Enabled (N, Check_Enabled (Pname));
+ if Check_Enabled (Pname) then
+ Set_Pragma_Enabled (N);
+ Set_SCO_Pragma_Enabled (Loc);
+ end if;
-- If we are within an inlined body, the legality of the pragma
-- has been checked already.
@@ -1867,7 +1846,8 @@ package body Sem_Prag is
Proc := Entity (Name);
if Ekind (Proc) /= E_Procedure
- or else Present (First_Formal (Proc)) then
+ or else Present (First_Formal (Proc))
+ then
Error_Pragma_Arg
("argument of pragma% must be parameterless procedure", Arg);
end if;
@@ -2366,12 +2346,176 @@ package body Sem_Prag is
Cname : Name_Id;
Comp_Unit : Unit_Number_Type;
+ procedure Diagnose_Multiple_Pragmas (S : Entity_Id);
+ -- Called if we have more than one Export/Import/Convention pragma.
+ -- This is generally illegal, but we have a special case of allowing
+ -- Import and Interface to coexist if they specify the convention in
+ -- a consistent manner. We are allowed to do this, since Interface is
+ -- an implementation defined pragma, and we choose to do it since we
+ -- know Rational allows this combination. S is the entity id of the
+ -- subprogram in question. This procedure also sets the special flag
+ -- Import_Interface_Present in both pragmas in the case where we do
+ -- have matching Import and Interface pragmas.
+
procedure Set_Convention_From_Pragma (E : Entity_Id);
-- Set convention in entity E, and also flag that the entity has a
-- convention pragma. If entity is for a private or incomplete type,
-- also set convention and flag on underlying type. This procedure
-- also deals with the special case of C_Pass_By_Copy convention.
+ -------------------------------
+ -- Diagnose_Multiple_Pragmas --
+ -------------------------------
+
+ procedure Diagnose_Multiple_Pragmas (S : Entity_Id) is
+ Pdec : constant Node_Id := Declaration_Node (S);
+ Decl : Node_Id;
+ Err : Boolean;
+
+ function Same_Convention (Decl : Node_Id) return Boolean;
+ -- Decl is a pragma node. This function returns True if this
+ -- pragma has a first argument that is an identifier with a
+ -- Chars field corresponding to the Convention_Id C.
+
+ function Same_Name (Decl : Node_Id) return Boolean;
+ -- Decl is a pragma node. This function returns True if this
+ -- pragma has a second argument that is an identifier with a
+ -- Chars field that matches the Chars of the current subprogram.
+
+ ---------------------
+ -- Same_Convention --
+ ---------------------
+
+ function Same_Convention (Decl : Node_Id) return Boolean is
+ Arg1 : constant Node_Id :=
+ First (Pragma_Argument_Associations (Decl));
+
+ begin
+ if Present (Arg1) then
+ declare
+ Arg : constant Node_Id := Get_Pragma_Arg (Arg1);
+ begin
+ if Nkind (Arg) = N_Identifier
+ and then Is_Convention_Name (Chars (Arg))
+ and then Get_Convention_Id (Chars (Arg)) = C
+ then
+ return True;
+ end if;
+ end;
+ end if;
+
+ return False;
+ end Same_Convention;
+
+ ---------------
+ -- Same_Name --
+ ---------------
+
+ function Same_Name (Decl : Node_Id) return Boolean is
+ Arg1 : constant Node_Id :=
+ First (Pragma_Argument_Associations (Decl));
+ Arg2 : Node_Id;
+
+ begin
+ if No (Arg1) then
+ return False;
+ end if;
+
+ Arg2 := Next (Arg1);
+
+ if No (Arg2) then
+ return False;
+ end if;
+
+ declare
+ Arg : constant Node_Id := Get_Pragma_Arg (Arg2);
+ begin
+ if Nkind (Arg) = N_Identifier
+ and then Chars (Arg) = Chars (S)
+ then
+ return True;
+ end if;
+ end;
+
+ return False;
+ end Same_Name;
+
+ -- Start of processing for Diagnose_Multiple_Pragmas
+
+ begin
+ Err := True;
+
+ -- Definitely give message if we have Convention/Export here
+
+ if Prag_Id = Pragma_Convention or else Prag_Id = Pragma_Export then
+ null;
+
+ -- If we have an Import or Export, scan back from pragma to
+ -- find any previous pragma applying to the same procedure.
+ -- The scan will be terminated by the start of the list, or
+ -- hitting the subprogram declaration. This won't allow one
+ -- pragma to appear in the public part and one in the private
+ -- part, but that seems very unlikely in practice.
+
+ else
+ Decl := Prev (N);
+ while Present (Decl) and then Decl /= Pdec loop
+
+ -- Look for pragma with same name as us
+
+ if Nkind (Decl) = N_Pragma
+ and then Same_Name (Decl)
+ then
+ -- Give error if same as our pragma or Export/Convention
+
+ if Pragma_Name (Decl) = Name_Export
+ or else
+ Pragma_Name (Decl) = Name_Convention
+ or else
+ Pragma_Name (Decl) = Pragma_Name (N)
+ then
+ exit;
+
+ -- Case of Import/Interface or the other way round
+
+ elsif Pragma_Name (Decl) = Name_Interface
+ or else
+ Pragma_Name (Decl) = Name_Import
+ then
+ -- Here we know that we have Import and Interface. It
+ -- doesn't matter which way round they are. See if
+ -- they specify the same convention. If so, all OK,
+ -- and set special flags to stop other messages
+
+ if Same_Convention (Decl) then
+ Set_Import_Interface_Present (N);
+ Set_Import_Interface_Present (Decl);
+ Err := False;
+
+ -- If different conventions, special message
+
+ else
+ Error_Msg_Sloc := Sloc (Decl);
+ Error_Pragma_Arg
+ ("convention differs from that given#", Arg1);
+ return;
+ end if;
+ end if;
+ end if;
+
+ Next (Decl);
+ end loop;
+ end if;
+
+ -- Give message if needed if we fall through those tests
+
+ if Err then
+ Error_Pragma_Arg
+ ("at most one Convention/Export/Import pragma is allowed",
+ Arg2);
+ end if;
+ end Diagnose_Multiple_Pragmas;
+
--------------------------------
-- Set_Convention_From_Pragma --
--------------------------------
@@ -2537,10 +2681,7 @@ package body Sem_Prag is
-- Check that we are not applying this to a named constant
- if Ekind (E) = E_Named_Integer
- or else
- Ekind (E) = E_Named_Real
- then
+ if Ekind_In (E, E_Named_Integer, E_Named_Real) then
Error_Msg_Name_1 := Pname;
Error_Msg_N
("cannot apply pragma% to named constant!",
@@ -2568,8 +2709,7 @@ package body Sem_Prag is
end if;
if Has_Convention_Pragma (E) then
- Error_Pragma_Arg
- ("at most one Convention/Export/Import pragma is allowed", Arg2);
+ Diagnose_Multiple_Pragmas (E);
elsif Convention (E) = Convention_Protected
or else Ekind (Scope (E)) = E_Protected_Type
@@ -2597,7 +2737,7 @@ package body Sem_Prag is
and then Ekind (E) /= E_Variable
and then not
(Is_Access_Type (E)
- and then Ekind (Designated_Type (E)) = E_Subprogram_Type)
+ and then Ekind (Designated_Type (E)) = E_Subprogram_Type)
then
Error_Pragma_Arg
("second argument of pragma% must be subprogram (type)",
@@ -2610,7 +2750,6 @@ package body Sem_Prag is
Set_Convention_From_Pragma (E);
if Is_Type (E) then
-
Check_First_Subtype (Arg2);
Set_Convention_From_Pragma (Base_Type (E));
@@ -2778,9 +2917,7 @@ package body Sem_Prag is
Process_Extended_Import_Export_Internal_Arg (Arg_Internal);
Def_Id := Entity (Arg_Internal);
- if Ekind (Def_Id) /= E_Constant
- and then Ekind (Def_Id) /= E_Variable
- then
+ if not Ekind_In (Def_Id, E_Constant, E_Variable) then
Error_Pragma_Arg
("pragma% must designate an object", Arg_Internal);
end if;
@@ -3132,7 +3269,7 @@ package body Sem_Prag is
Prag_Id = Pragma_Import_Valued_Procedure
then
if not Is_Imported (Ent) then
- Error_Pragma -- CODEFIX???
+ Error_Pragma
("pragma Import or Interface must precede pragma%");
end if;
@@ -3390,10 +3527,8 @@ package body Sem_Prag is
Kill_Size_Check_Code (Def_Id);
Note_Possible_Modification (Expression (Arg2), Sure => False);
- if Ekind (Def_Id) = E_Variable
- or else
- Ekind (Def_Id) = E_Constant
- then
+ if Ekind_In (Def_Id, E_Variable, E_Constant) then
+
-- We do not permit Import to apply to a renaming declaration
if Present (Renamed_Object (Def_Id)) then
@@ -3821,9 +3956,7 @@ package body Sem_Prag is
-- entity (if declared in the same unit) is inlined.
if Is_Subprogram (Subp) then
- while Present (Alias (Inner_Subp)) loop
- Inner_Subp := Alias (Inner_Subp);
- end loop;
+ Inner_Subp := Ultimate_Alias (Inner_Subp);
if In_Same_Source_Unit (Subp, Inner_Subp) then
Set_Inline_Flags (Inner_Subp);
@@ -4140,7 +4273,14 @@ package body Sem_Prag is
Set_Encoded_Interface_Name
(Get_Base_Subprogram (Subprogram_Def), Link_Nam);
- Check_Duplicated_Export_Name (Link_Nam);
+
+ -- We allow duplicated export names in CIL, as they are always
+ -- enclosed in a namespace that differentiates them, and overloaded
+ -- entities are supported by the VM.
+
+ if Convention (Subprogram_Def) /= Convention_CIL then
+ Check_Duplicated_Export_Name (Link_Nam);
+ end if;
end Process_Interface_Name;
-----------------------------------------
@@ -4594,8 +4734,7 @@ package body Sem_Prag is
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?", Arg, E);
end if;
if Warn_On_Export_Import and Inside_A_Generic then
@@ -4695,8 +4834,19 @@ package body Sem_Prag is
-- Error message if already imported or exported
if Is_Exported (E) or else Is_Imported (E) then
+
+ -- Error if being set Exported twice
+
if Is_Exported (E) then
Error_Msg_NE ("entity& was previously exported", N, E);
+
+ -- OK if Import/Interface case
+
+ elsif Import_Interface_Present (N) then
+ goto OK;
+
+ -- Error if being set Imported twice
+
else
Error_Msg_NE ("entity& was previously imported", N, E);
end if;
@@ -4725,6 +4875,8 @@ package body Sem_Prag is
Set_Is_Statically_Allocated (E);
end if;
end if;
+
+ <<OK>> null;
end Set_Imported;
-------------------------
@@ -5105,8 +5257,9 @@ package body Sem_Prag is
-- said this was a configuration pragma, but we did not check and
-- are hesitant to add the check now.
- -- However, we really cannot tolerate mixing Ada 2005 with Ada 83
- -- or Ada 95, so we must check if we are in Ada 2005 mode.
+ -- However, we really cannot tolerate mixing Ada 2005 or Ada 2012
+ -- with Ada 83 or Ada 95, so we must check if we are in Ada 2005
+ -- or Ada 2012 mode.
if Ada_Version >= Ada_05 then
Check_Valid_Configuration_Pragma;
@@ -5195,6 +5348,33 @@ package body Sem_Prag is
end if;
end;
+ ---------------------
+ -- Ada_12/Ada_2012 --
+ ---------------------
+
+ -- pragma Ada_12;
+ -- pragma Ada_2012;
+
+ -- Note: these pragma also have some specific processing in Par.Prag
+ -- because we want to set the Ada 2012 version mode during parsing.
+
+ when Pragma_Ada_12 | Pragma_Ada_2012 =>
+ GNAT_Pragma;
+ Check_Arg_Count (0);
+
+ -- For Ada_2012 we unconditionally enforce the documented
+ -- configuration pragma placement, since we do not want to
+ -- tolerate mixed modes in a unit involving Ada 2012. That would
+ -- cause real difficulties for those cases where there are
+ -- incompatibilities between Ada 95 and Ada 2005/Ada 2012.
+
+ Check_Valid_Configuration_Pragma;
+
+ -- Now set Ada 2012 mode
+
+ Ada_Version := Ada_12;
+ Ada_Version_Explicit := Ada_12;
+
----------------------
-- All_Calls_Remote --
----------------------
@@ -5246,6 +5426,8 @@ package body Sem_Prag is
GNAT_Pragma;
Check_At_Least_N_Arguments (1);
Check_Arg_Is_Identifier (Arg1);
+ Check_No_Identifiers;
+ Store_Note (N);
declare
Arg : Node_Id;
@@ -5788,8 +5970,17 @@ package body Sem_Prag is
end if;
Check_Arg_Is_Identifier (Arg1);
+
+ -- Indicate if pragma is enabled. The Original_Node reference here
+ -- is to deal with pragma Assert rewritten as a Check pragma.
+
Check_On := Check_Enabled (Chars (Get_Pragma_Arg (Arg1)));
- Set_Pragma_Enabled (N, Check_On);
+
+ if Check_On then
+ Set_Pragma_Enabled (N);
+ Set_Pragma_Enabled (Original_Node (N));
+ Set_SCO_Pragma_Enabled (Loc);
+ end if;
-- If expansion is active and the check is not enabled then we
-- rewrite the Check as:
@@ -7288,8 +7479,11 @@ package body Sem_Prag is
if Chars (Expression (Arg1)) = Name_On then
Extensions_Allowed := True;
+ Ada_Version := Ada_Version_Type'Last;
+
else
Extensions_Allowed := False;
+ Ada_Version := Ada_Version_Explicit;
end if;
--------------
@@ -7575,6 +7769,7 @@ package body Sem_Prag is
Check_Arg_Count (1);
Check_No_Identifiers;
Check_Arg_Is_Static_Expression (Arg1, Standard_String);
+ Store_Note (N);
-- For pragma Ident, preserve DEC compatibility by requiring the
-- pragma to appear in a declarative part or package spec.
@@ -9134,9 +9329,7 @@ package body Sem_Prag is
while Present (E)
and then Scope (E) = Current_Scope
loop
- if Ekind (E) = E_Procedure
- or else Ekind (E) = E_Generic_Procedure
- then
+ if Ekind_In (E, E_Procedure, E_Generic_Procedure) then
Set_No_Return (E);
-- Set flag on any alias as well
@@ -9918,7 +10111,7 @@ package body Sem_Prag is
-- This is one of the few cases where we need to test the value of
-- Ada_Version_Explicit rather than Ada_Version (which is always
- -- set to Ada_05 in a predefined unit), we need to know the
+ -- set to Ada_12 in a predefined unit), we need to know the
-- explicit version set to know if this pragma is active.
if Ada_Version_Explicit >= Ada_05 then
@@ -10294,9 +10487,7 @@ package body Sem_Prag is
Def_Id := Entity (Internal);
- if Ekind (Def_Id) /= E_Constant
- and then Ekind (Def_Id) /= E_Variable
- then
+ if not Ekind_In (Def_Id, E_Constant, E_Variable) then
Error_Pragma_Arg
("pragma% must designate an object", Internal);
end if;
@@ -10420,7 +10611,7 @@ package body Sem_Prag is
-- This is one of the few cases where we need to test the value of
-- Ada_Version_Explicit rather than Ada_Version (which is always
- -- set to Ada_05 in a predefined unit), we need to know the
+ -- set to Ada_12 in a predefined unit), we need to know the
-- explicit version set to know if this pragma is active.
if Ada_Version_Explicit >= Ada_05 then
@@ -10462,9 +10653,9 @@ package body Sem_Prag is
loop
Def_Id := Get_Base_Subprogram (E);
- if Ekind (Def_Id) /= E_Function
- and then Ekind (Def_Id) /= E_Generic_Function
- and then Ekind (Def_Id) /= E_Operator
+ if not Ekind_In (Def_Id, E_Function,
+ E_Generic_Function,
+ E_Operator)
then
Error_Pragma_Arg
("pragma% requires a function name", Arg1);
@@ -10484,8 +10675,9 @@ package body Sem_Prag is
if not Effective
and then Warn_On_Redundant_Constructs
then
- Error_Msg_NE ("pragma Pure_Function on& is redundant?",
- N, Entity (E_Id));
+ Error_Msg_NE
+ ("pragma Pure_Function on& is redundant?",
+ N, Entity (E_Id));
end if;
end if;
end Pure_Function;
@@ -10658,10 +10850,8 @@ 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?", N);
+ Error_Msg_N ("|use pragma Profile (Ravenscar) instead", N);
end if;
-------------------------
@@ -10680,8 +10870,7 @@ 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);
+ Error_Msg_N ("|use pragma Profile (Restricted) instead", N);
end if;
------------------
@@ -11164,7 +11353,11 @@ package body Sem_Prag is
elsif Nkind (A) = N_Identifier then
if Chars (A) = Name_All_Checks then
- Set_Default_Style_Check_Options;
+ if GNAT_Mode then
+ Set_GNAT_Style_Check_Options;
+ else
+ Set_Default_Style_Check_Options;
+ end if;
elsif Chars (A) = Name_On then
Style_Check := True;
@@ -11186,7 +11379,8 @@ package body Sem_Prag is
GNAT_Pragma;
Check_Arg_Count (1);
Check_Optional_Identifier (Arg1, Name_Subtitle);
- Check_Arg_Is_String_Literal (Arg1);
+ Check_Arg_Is_Static_Expression (Arg1, Standard_String);
+ Store_Note (N);
--------------
-- Suppress --
@@ -11564,10 +11758,11 @@ package body Sem_Prag is
begin
GNAT_Pragma;
Gather_Associations (Names, Args);
+ Store_Note (N);
for J in 1 .. 2 loop
if Present (Args (J)) then
- Check_Arg_Is_String_Literal (Args (J));
+ Check_Arg_Is_Static_Expression (Args (J), Standard_String);
end if;
end loop;
end Title;
@@ -12089,7 +12284,7 @@ package body Sem_Prag is
elsif not Is_Static_String_Expression (Arg1) then
Error_Pragma_Arg
("argument of pragma% must be On/Off or " &
- "static string expression", Arg2);
+ "static string expression", Arg1);
-- One argument string expression case
@@ -12309,6 +12504,11 @@ package body Sem_Prag is
raise Program_Error;
end case;
+ -- AI05-0144: detect dangerous order dependence. Disabled for now,
+ -- until AI is formally approved.
+
+ -- Check_Order_Dependence;
+
exception
when Pragma_Exit => null;
end Analyze_Pragma;
@@ -12483,6 +12683,8 @@ package body Sem_Prag is
Pragma_Ada_95 => -1,
Pragma_Ada_05 => -1,
Pragma_Ada_2005 => -1,
+ Pragma_Ada_12 => -1,
+ Pragma_Ada_2012 => -1,
Pragma_All_Calls_Remote => -1,
Pragma_Annotate => -1,
Pragma_Assert => -1,
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 96a295cd218..92ae30f4e55 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -130,10 +130,14 @@ package body Sem_Res is
-- declaration, and not an (anonymous) allocator type.
function Is_Predefined_Op (Nam : Entity_Id) return Boolean;
- -- Utility to check whether the name in the call is a predefined
- -- operator, in which case the call is made into an operator node.
- -- An instance of an intrinsic conversion operation may be given
- -- an operator name, but is not treated like an operator.
+ -- Utility to check whether the entity for an operator is a predefined
+ -- operator, in which case the expression is left as an operator in the
+ -- tree (else it is rewritten into a call). An instance of an intrinsic
+ -- conversion operation may be given an operator name, but is not treated
+ -- like an operator. Note that an operator that is an imported back-end
+ -- builtin has convention Intrinsic, but is expected to be rewritten into
+ -- a call, so such an operator is not treated as predefined by this
+ -- predicate.
procedure Replace_Actual_Discriminants (N : Node_Id; Default : Node_Id);
-- If a default expression in entry call N depends on the discriminants
@@ -160,12 +164,14 @@ package body Sem_Res is
procedure Resolve_Allocator (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Arithmetic_Op (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Call (N : Node_Id; Typ : Entity_Id);
+ procedure Resolve_Case_Expression (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Character_Literal (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Comparison_Op (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Conditional_Expression (N : Node_Id; Typ : Entity_Id);
+ procedure Resolve_Entity_Name (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Equality_Op (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Explicit_Dereference (N : Node_Id; Typ : Entity_Id);
- procedure Resolve_Entity_Name (N : Node_Id; Typ : Entity_Id);
+ procedure Resolve_Expression_With_Actions (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Indexed_Component (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Integer_Literal (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Logical_Op (N : Node_Id; Typ : Entity_Id);
@@ -211,9 +217,13 @@ package body Sem_Res is
procedure Resolve_Intrinsic_Operator (N : Node_Id; Typ : Entity_Id);
-- A call to a user-defined intrinsic operator is rewritten as a call
-- to the corresponding predefined operator, with suitable conversions.
+ -- Note that this applies only for intrinsic operators that denote
+ -- predefined operators, not operators that are intrinsic imports of
+ -- back-end builtins.
procedure Resolve_Intrinsic_Unary_Operator (N : Node_Id; Typ : Entity_Id);
- -- Ditto, for unary operators (only arithmetic ones)
+ -- Ditto, for unary operators (arithmetic ones and "not" on signed
+ -- integer types for VMS).
procedure Rewrite_Operator_As_Call (N : Node_Id; Nam : Entity_Id);
-- If an operator node resolves to a call to a user-defined operator,
@@ -276,16 +286,13 @@ package body Sem_Res is
-- First the ones in Standard
- Error_Msg_N
- ("\\possible interpretation: Character!", C);
- Error_Msg_N
- ("\\possible interpretation: Wide_Character!", C);
+ Error_Msg_N ("\\possible interpretation: Character!", C);
+ Error_Msg_N ("\\possible interpretation: Wide_Character!", C);
-- Include Wide_Wide_Character in Ada 2005 mode
if Ada_Version >= Ada_05 then
- Error_Msg_N
- ("\\possible interpretation: Wide_Wide_Character!", C);
+ Error_Msg_N ("\\possible interpretation: Wide_Wide_Character!", C);
end if;
-- Now any other types that match
@@ -632,9 +639,10 @@ package body Sem_Res is
procedure Check_For_Visible_Operator (N : Node_Id; T : Entity_Id) is
begin
if Is_Invisible_Operator (N, T) then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("operator for} is not directly visible!", N, First_Subtype (T));
- Error_Msg_N ("use clause would make operation legal!", N);
+ Error_Msg_N -- CODEFIX
+ ("use clause would make operation legal!", N);
end if;
end Check_For_Visible_Operator;
@@ -898,10 +906,12 @@ package body Sem_Res is
Expr := Original_Node (Expression (Parent (Comp)));
-- Return True if the expression is a call to a function
- -- (including an attribute function such as Image) with
- -- a result that requires a transient scope.
+ -- (including an attribute function such as Image, or a
+ -- user-defined operator) with a result that requires a
+ -- transient scope.
if (Nkind (Expr) = N_Function_Call
+ or else Nkind (Expr) in N_Op
or else (Nkind (Expr) = N_Attribute_Reference
and then Present (Expressions (Expr))))
and then Requires_Transient_Scope (Etype (Expr))
@@ -1034,7 +1044,7 @@ package body Sem_Res is
if (Is_Entity_Name (N)
and then Is_Overloadable (Entity (N))
and then (Ekind (Entity (N)) /= E_Enumeration_Literal
- or else Is_Overloaded (N)))
+ or else Is_Overloaded (N)))
-- Rewrite as call if it is an explicit dereference of an expression of
-- a subprogram access type, and the subprogram type is not that of a
@@ -1050,11 +1060,10 @@ package body Sem_Res is
or else
(Nkind (N) = N_Selected_Component
and then (Ekind (Entity (Selector_Name (N))) = E_Function
- or else
- ((Ekind (Entity (Selector_Name (N))) = E_Entry
- or else
- Ekind (Entity (Selector_Name (N))) = E_Procedure)
- and then Is_Overloaded (Selector_Name (N)))))
+ or else
+ (Ekind_In (Entity (Selector_Name (N)), E_Entry,
+ E_Procedure)
+ and then Is_Overloaded (Selector_Name (N)))))
-- If one of the above three conditions is met, rewrite as call.
-- Apply the rewriting only once.
@@ -1102,11 +1111,21 @@ package body Sem_Res is
function Is_Predefined_Op (Nam : Entity_Id) return Boolean is
begin
- return Is_Intrinsic_Subprogram (Nam)
- and then not Is_Generic_Instance (Nam)
+ -- Predefined operators are intrinsic subprograms
+
+ if not Is_Intrinsic_Subprogram (Nam) then
+ return False;
+ end if;
+
+ -- A call to a back-end builtin is never a predefined operator
+
+ if Is_Imported (Nam) and then Present (Interface_Name (Nam)) then
+ return False;
+ end if;
+
+ return not Is_Generic_Instance (Nam)
and then Chars (Nam) in Any_Operator_Name
- and then (No (Alias (Nam))
- or else Is_Predefined_Op (Alias (Nam)));
+ and then (No (Alias (Nam)) or else Is_Predefined_Op (Alias (Nam)));
end Is_Predefined_Op;
-----------------------------
@@ -1133,7 +1152,7 @@ package body Sem_Res is
function Operand_Type_In_Scope (S : Entity_Id) return Boolean;
-- If the operand is not universal, and the operator is given by a
- -- expanded name, verify that the operand has an interpretation with
+ -- expanded name, verify that the operand has an interpretation with
-- a type defined in the given scope of the operator.
function Type_In_P (Test : Kind_Test) return Entity_Id;
@@ -1274,16 +1293,15 @@ package body Sem_Res is
-- you courtesy of b33302a. The type itself must be frozen, so we must
-- find the type of the proper class in the given scope.
- -- A final wrinkle is the multiplication operator for fixed point
- -- types, which is defined in Standard only, and not in the scope of
- -- the fixed_point type itself.
+ -- A final wrinkle is the multiplication operator for fixed point types,
+ -- which is defined in Standard only, and not in the scope of the
+ -- fixed_point type itself.
if Nkind (Name (N)) = N_Expanded_Name then
Pack := Entity (Prefix (Name (N)));
- -- If the entity being called is defined in the given package,
- -- it is a renaming of a predefined operator, and known to be
- -- legal.
+ -- If the entity being called is defined in the given package, it is
+ -- a renaming of a predefined operator, and known to be legal.
if Scope (Entity (Name (N))) = Pack
and then Pack /= Standard_Standard
@@ -1297,8 +1315,7 @@ package body Sem_Res is
elsif In_Instance then
null;
- elsif (Op_Name = Name_Op_Multiply
- or else Op_Name = Name_Op_Divide)
+ elsif (Op_Name = Name_Op_Multiply or else Op_Name = Name_Op_Divide)
and then Is_Fixed_Point_Type (Etype (Left_Opnd (Op_Node)))
and then Is_Fixed_Point_Type (Etype (Right_Opnd (Op_Node)))
then
@@ -1306,8 +1323,8 @@ package body Sem_Res is
Error := True;
end if;
- -- Ada 2005, AI-420: Predefined equality on Universal_Access
- -- is available.
+ -- Ada 2005, AI-420: Predefined equality on Universal_Access is
+ -- available.
elsif Ada_Version >= Ada_05
and then (Op_Name = Name_Op_Eq or else Op_Name = Name_Op_Ne)
@@ -1338,7 +1355,7 @@ package body Sem_Res is
if Pack /= Standard_Standard then
if Opnd_Type = Universal_Integer then
- Orig_Type := Type_In_P (Is_Integer_Type'Access);
+ Orig_Type := Type_In_P (Is_Integer_Type'Access);
elsif Opnd_Type = Universal_Real then
Orig_Type := Type_In_P (Is_Real_Type'Access);
@@ -1347,7 +1364,7 @@ package body Sem_Res is
Orig_Type := Type_In_P (Is_String_Type'Access);
elsif Opnd_Type = Any_Access then
- Orig_Type := Type_In_P (Is_Definite_Access_Type'Access);
+ Orig_Type := Type_In_P (Is_Definite_Access_Type'Access);
elsif Opnd_Type = Any_Composite then
Orig_Type := Type_In_P (Is_Composite_Type'Access);
@@ -1407,6 +1424,41 @@ package body Sem_Res is
("& not declared in&", N, Selector_Name (Name (N)));
Set_Etype (N, Any_Type);
return;
+
+ -- Detect a mismatch between the context type and the result type
+ -- in the named package, which is otherwise not detected if the
+ -- operands are universal. Check is only needed if source entity is
+ -- an operator, not a function that renames an operator.
+
+ elsif Nkind (Parent (N)) /= N_Type_Conversion
+ and then Ekind (Entity (Name (N))) = E_Operator
+ and then Is_Numeric_Type (Typ)
+ and then not Is_Universal_Numeric_Type (Typ)
+ and then Scope (Base_Type (Typ)) /= Pack
+ and then not In_Instance
+ then
+ if Is_Fixed_Point_Type (Typ)
+ and then (Op_Name = Name_Op_Multiply
+ or else
+ Op_Name = Name_Op_Divide)
+ then
+ -- Already checked above
+
+ null;
+
+ -- Operator may be defined in an extension of System
+
+ elsif Present (System_Aux_Id)
+ and then Scope (Opnd_Type) = System_Aux_Id
+ then
+ null;
+
+ else
+ -- Could we use Wrong_Type here??? (this would require setting
+ -- Etype (N) to the actual type found where Typ was expected).
+
+ Error_Msg_NE ("expect }", N, Typ);
+ end if;
end if;
end if;
@@ -1468,14 +1520,6 @@ package body Sem_Res is
else
Resolve (N, Typ);
end if;
-
- -- For predefined operators on literals, the operation freezes
- -- their type.
-
- if Present (Orig_Type) then
- Set_Etype (Act1, Orig_Type);
- Freeze_Expression (Act1);
- end if;
end Make_Call_Into_Operator;
-------------------
@@ -1669,6 +1713,10 @@ package body Sem_Res is
-- Try and fix up a literal so that it matches its expected type. New
-- literals are manufactured if necessary to avoid cascaded errors.
+ procedure Report_Ambiguous_Argument;
+ -- Additional diagnostics when an ambiguous call has an ambiguous
+ -- argument (typically a controlling actual).
+
procedure Resolution_Failed;
-- Called when attempt at resolving current expression fails
@@ -1733,6 +1781,39 @@ package body Sem_Res is
end if;
end Patch_Up_Value;
+ -------------------------------
+ -- Report_Ambiguous_Argument --
+ -------------------------------
+
+ procedure Report_Ambiguous_Argument is
+ Arg : constant Node_Id := First (Parameter_Associations (N));
+ I : Interp_Index;
+ It : Interp;
+
+ begin
+ if Nkind (Arg) = N_Function_Call
+ and then Is_Entity_Name (Name (Arg))
+ and then Is_Overloaded (Name (Arg))
+ then
+ Error_Msg_NE ("ambiguous call to&", Arg, Name (Arg));
+
+ -- Could use comments on what is going on here ???
+
+ Get_First_Interp (Name (Arg), I, It);
+ while Present (It.Nam) loop
+ Error_Msg_Sloc := Sloc (It.Nam);
+
+ if Nkind (Parent (It.Nam)) = N_Full_Type_Declaration then
+ Error_Msg_N ("interpretation (inherited) #!", Arg);
+ else
+ Error_Msg_N ("interpretation #!", Arg);
+ end if;
+
+ Get_Next_Interp (I, It);
+ end loop;
+ end if;
+ end Report_Ambiguous_Argument;
+
-----------------------
-- Resolution_Failed --
-----------------------
@@ -1805,6 +1886,7 @@ package body Sem_Res is
-- Check that Typ is a remote access-to-subprogram type
if Is_Remote_Access_To_Subprogram_Type (Typ) then
+
-- Prefix (N) must statically denote a remote subprogram
-- declared in a package specification.
@@ -2037,6 +2119,13 @@ package body Sem_Res is
Error_Msg_N -- CODEFIX
("\\possible interpretation#!", N);
end if;
+
+ if Nkind_In
+ (N, N_Procedure_Call_Statement, N_Function_Call)
+ and then Present (Parameter_Associations (N))
+ then
+ Report_Ambiguous_Argument;
+ end if;
end if;
Error_Msg_Sloc := Sloc (It.Nam);
@@ -2077,7 +2166,7 @@ package body Sem_Res is
-- If this is an indirect call, use the subprogram_type
-- in the message, to have a meaningful location.
- -- Indicate as well if this is an inherited operation,
+ -- Also indicate if this is an inherited operation,
-- created by a type declaration.
elsif Nkind (N) = N_Function_Call
@@ -2134,6 +2223,9 @@ package body Sem_Res is
Set_Entity (N, Seen);
Generate_Reference (Seen, N);
+ elsif Nkind (N) = N_Case_Expression then
+ Set_Etype (N, Expr_Type);
+
elsif Nkind (N) = N_Character_Literal then
Set_Etype (N, Expr_Type);
@@ -2158,7 +2250,7 @@ package body Sem_Res is
null;
-- For procedure or function calls, set the type of the name,
- -- and also the entity pointer for the prefix
+ -- and also the entity pointer for the prefix.
elsif Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call)
and then (Is_Entity_Name (Name (N))
@@ -2194,9 +2286,9 @@ package body Sem_Res is
end if;
-- At this stage Found indicates whether or not an acceptable
- -- interpretation exists. If not, then we have an error, except
- -- that if the context is Any_Type as a result of some other error,
- -- then we suppress the error report.
+ -- interpretation exists. If not, then we have an error, except that if
+ -- the context is Any_Type as a result of some other error, then we
+ -- suppress the error report.
if not Found then
if Typ /= Any_Type then
@@ -2489,6 +2581,9 @@ package body Sem_Res is
when N_Attribute_Reference
=> Resolve_Attribute (N, Ctx_Type);
+ when N_Case_Expression
+ => Resolve_Case_Expression (N, Ctx_Type);
+
when N_Character_Literal
=> Resolve_Character_Literal (N, Ctx_Type);
@@ -2498,12 +2593,15 @@ package body Sem_Res is
when N_Expanded_Name
=> Resolve_Entity_Name (N, Ctx_Type);
- when N_Extension_Aggregate
- => Resolve_Extension_Aggregate (N, Ctx_Type);
-
when N_Explicit_Dereference
=> Resolve_Explicit_Dereference (N, Ctx_Type);
+ when N_Expression_With_Actions
+ => Resolve_Expression_With_Actions (N, Ctx_Type);
+
+ when N_Extension_Aggregate
+ => Resolve_Extension_Aggregate (N, Ctx_Type);
+
when N_Function_Call
=> Resolve_Call (N, Ctx_Type);
@@ -2584,7 +2682,6 @@ package body Sem_Res is
when N_Unchecked_Type_Conversion =>
Resolve_Unchecked_Type_Conversion (N, Ctx_Type);
-
end case;
-- If the subexpression was replaced by a non-subexpression, then
@@ -3379,6 +3476,13 @@ package body Sem_Res is
A_Typ := Etype (A);
F_Typ := Etype (F);
+ -- Save actual for subsequent check on order dependence,
+ -- and indicate whether actual is modifiable. For AI05-0144
+
+ -- Save_Actual (A,
+ -- Ekind (F) /= E_In_Parameter or else Is_Access_Type (F_Typ));
+ -- Why is this code commented out ???
+
-- For mode IN, if actual is an entity, and the type of the formal
-- has warnings suppressed, then we reset Never_Set_In_Source for
-- the calling entity. The reason for this is to catch cases like
@@ -3490,9 +3594,7 @@ package body Sem_Res is
-- might not be done in the In Out case since Gigi does not do
-- any analysis. More thought required about this ???
- if Ekind (F) = E_In_Parameter
- or else Ekind (F) = E_In_Out_Parameter
- then
+ if Ekind_In (F, E_In_Parameter, E_In_Out_Parameter) then
if Is_Scalar_Type (Etype (A)) then
Apply_Scalar_Range_Check (A, F_Typ);
@@ -3538,9 +3640,7 @@ package body Sem_Res is
end if;
end if;
- if Ekind (F) = E_Out_Parameter
- or else Ekind (F) = E_In_Out_Parameter
- then
+ if Ekind_In (F, E_Out_Parameter, E_In_Out_Parameter) then
if Nkind (A) = N_Type_Conversion then
if Is_Scalar_Type (A_Typ) then
Apply_Scalar_Range_Check
@@ -4568,7 +4668,7 @@ package body Sem_Res is
-- If the context is Universal_Fixed and the operands are also
-- universal fixed, this is an error, unless there is only one
- -- applicable fixed_point type (usually duration).
+ -- applicable fixed_point type (usually Duration).
if B_Typ = Universal_Fixed and then Etype (L) = Universal_Fixed then
T := Unique_Fixed_Point_Type (N);
@@ -4719,6 +4819,28 @@ package body Sem_Res is
Scop : Entity_Id;
Rtype : Entity_Id;
+ function Same_Or_Aliased_Subprograms
+ (S : Entity_Id;
+ E : Entity_Id) return Boolean;
+ -- Returns True if the subprogram entity S is the same as E or else
+ -- S is an alias of E.
+
+ ---------------------------------
+ -- Same_Or_Aliased_Subprograms --
+ ---------------------------------
+
+ function Same_Or_Aliased_Subprograms
+ (S : Entity_Id;
+ E : Entity_Id) return Boolean
+ is
+ Subp_Alias : constant Entity_Id := Alias (S);
+ begin
+ return S = E
+ or else (Present (Subp_Alias) and then Subp_Alias = E);
+ end Same_Or_Aliased_Subprograms;
+
+ -- Start of processing for Resolve_Call
+
begin
-- The context imposes a unique interpretation with type Typ on a
-- procedure or function call. Find the entity of the subprogram that
@@ -5004,10 +5126,15 @@ package body Sem_Res is
Expressions => Parameter_Associations (N));
end if;
+ -- Preserve the parenthesis count of the node
+
+ Set_Paren_Count (Index_Node, Paren_Count (N));
+
-- Since we are correcting a node classification error made
-- by the parser, we call Replace rather than Rewrite.
Replace (N, Index_Node);
+
Set_Etype (Prefix (N), Ret_Type);
Set_Etype (N, Typ);
Resolve_Indexed_Component (N, Typ);
@@ -5051,7 +5178,7 @@ package body Sem_Res is
-- Issue warning for possible infinite recursion in the absence
-- of the No_Recursion restriction.
- if Nam = Scop
+ if Same_Or_Aliased_Subprograms (Nam, Scop)
and then not Restriction_Active (No_Recursion)
and then Check_Infinite_Recursion (N)
then
@@ -5068,7 +5195,7 @@ package body Sem_Res is
else
Scope_Loop : while Scop /= Standard_Standard loop
- if Nam = Scop then
+ if Same_Or_Aliased_Subprograms (Nam, Scop) then
-- Although in general case, recursion is not statically
-- checkable, the case of calling an immediately containing
@@ -5316,9 +5443,7 @@ package body Sem_Res is
F := First_Formal (Nam);
A := First_Actual (N);
while Present (F) and then Present (A) loop
- if (Ekind (F) = E_Out_Parameter
- or else
- Ekind (F) = E_In_Out_Parameter)
+ if Ekind_In (F, E_Out_Parameter, E_In_Out_Parameter)
and then Warn_On_Modified_As_Out_Parameter (F)
and then Is_Entity_Name (A)
and then Present (Entity (A))
@@ -5380,9 +5505,14 @@ package body Sem_Res is
Check_Potentially_Blocking_Operation (N);
end if;
- -- Issue an error for a call to an eliminated subprogram
+ -- Issue an error for a call to an eliminated subprogram. We skip this
+ -- in a spec expression, e.g. a call in a default parameter value, since
+ -- we are not really doing a call at this time. That's important because
+ -- the spec expression may itself belong to an eliminated subprogram.
- Check_For_Eliminated_Subprogram (Subp, Nam);
+ if not In_Spec_Expression then
+ Check_For_Eliminated_Subprogram (Subp, Nam);
+ end if;
-- All done, evaluate call and deal with elaboration issues
@@ -5391,6 +5521,24 @@ package body Sem_Res is
Warn_On_Overlapping_Actuals (Nam, N);
end Resolve_Call;
+ -----------------------------
+ -- Resolve_Case_Expression --
+ -----------------------------
+
+ procedure Resolve_Case_Expression (N : Node_Id; Typ : Entity_Id) is
+ Alt : Node_Id;
+
+ begin
+ Alt := First (Alternatives (N));
+ while Present (Alt) loop
+ Resolve (Expression (Alt), Typ);
+ Next (Alt);
+ end loop;
+
+ Set_Etype (N, Typ);
+ Eval_Case_Expression (N);
+ end Resolve_Case_Expression;
+
-------------------------------
-- Resolve_Character_Literal --
-------------------------------
@@ -5689,6 +5837,14 @@ package body Sem_Res is
Set_Etype (N, Typ);
Eval_Named_Real (N);
+ -- For enumeration literals, we need to make sure that a proper style
+ -- check is done, since such literals are overloaded, and thus we did
+ -- not do a style check during the first phase of analysis.
+
+ elsif Ekind (E) = E_Enumeration_Literal then
+ Set_Entity_With_Style_Check (N, E);
+ Eval_Entity_Name (N);
+
-- Allow use of subtype only if it is a concurrent type where we are
-- currently inside the body. This will eventually be expanded into a
-- call to Self (for tasks) or _object (for protected objects). Any
@@ -5743,7 +5899,6 @@ package body Sem_Res is
and then not In_Spec_Expression
and then not Is_Imported (E)
then
-
if No_Initialization (Parent (E))
or else (Present (Full_View (E))
and then No_Initialization (Parent (Full_View (E))))
@@ -5794,7 +5949,7 @@ package body Sem_Res is
-- to the discriminant of the same name in the target task. If the
-- entry name is the target of a requeue statement and the entry is
-- in the current protected object, the bound to be used is the
- -- discriminal of the object (see apply_range_checks for details of
+ -- discriminal of the object (see Apply_Range_Checks for details of
-- the transformation).
-----------------------------
@@ -5817,7 +5972,14 @@ package body Sem_Res is
and then In_Open_Scopes (Tsk)
and then Nkind (Parent (Entry_Name)) = N_Requeue_Statement
then
- return New_Occurrence_Of (Discriminal (Entity (Bound)), Loc);
+ -- Note: here Bound denotes a discriminant of the corresponding
+ -- record type tskV, whose discriminal is a formal of the
+ -- init-proc tskVIP. What we want is the body discriminal,
+ -- which is associated to the discriminant of the original
+ -- concurrent type tsk.
+
+ return New_Occurrence_Of
+ (Find_Body_Discriminal (Entity (Bound)), Loc);
else
Ref :=
@@ -6097,9 +6259,7 @@ package body Sem_Res is
Resolve_Actuals (N, Nam);
Generate_Reference (Nam, Entry_Name);
- if Ekind (Nam) = E_Entry
- or else Ekind (Nam) = E_Entry_Family
- then
+ if Ekind_In (Nam, E_Entry, E_Entry_Family) then
Check_Potentially_Blocking_Operation (N);
end if;
@@ -6253,8 +6413,7 @@ package body Sem_Res is
return;
elsif T = Any_Access
- or else Ekind (T) = E_Allocator_Type
- or else Ekind (T) = E_Access_Attribute_Type
+ or else Ekind_In (T, E_Allocator_Type, E_Access_Attribute_Type)
then
T := Find_Unique_Access_Type;
@@ -6282,7 +6441,8 @@ package body Sem_Res is
and then Entity (R) = Standard_True
and then Comes_From_Source (R)
then
- Error_Msg_N ("?comparison with True is redundant!", R);
+ Error_Msg_N -- CODEFIX
+ ("?comparison with True is redundant!", R);
end if;
Check_Unset_Reference (L);
@@ -6321,8 +6481,8 @@ package body Sem_Res is
if Expander_Active
and then
- (Ekind (T) = E_Anonymous_Access_Type
- or else Ekind (T) = E_Anonymous_Access_Subprogram_Type
+ (Ekind_In (T, E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
or else Is_Private_Type (T))
then
if Etype (L) /= T then
@@ -6434,6 +6594,15 @@ package body Sem_Res is
end Resolve_Explicit_Dereference;
+ -------------------------------------
+ -- Resolve_Expression_With_Actions --
+ -------------------------------------
+
+ procedure Resolve_Expression_With_Actions (N : Node_Id; Typ : Entity_Id) is
+ begin
+ Set_Etype (N, Typ);
+ end Resolve_Expression_With_Actions;
+
-------------------------------
-- Resolve_Indexed_Component --
-------------------------------
@@ -6556,6 +6725,24 @@ package body Sem_Res is
Warn_On_Suspicious_Index (Name, First (Expressions (N)));
Eval_Indexed_Component (N);
end if;
+
+ -- If the array type is atomic, and is packed, and we are in a left side
+ -- context, then this is worth a warning, since we have a situation
+ -- where the access to the component may cause extra read/writes of
+ -- the atomic array object, which could be considered unexpected.
+
+ if Nkind (N) = N_Indexed_Component
+ and then (Is_Atomic (Array_Type)
+ or else (Is_Entity_Name (Prefix (N))
+ and then Is_Atomic (Entity (Prefix (N)))))
+ and then Is_Bit_Packed_Array (Array_Type)
+ and then Is_LHS (N)
+ then
+ Error_Msg_N ("?assignment to component of packed atomic array",
+ Prefix (N));
+ Error_Msg_N ("?\may cause unexpected accesses to atomic object",
+ Prefix (N));
+ end if;
end Resolve_Indexed_Component;
-----------------------------
@@ -6573,12 +6760,20 @@ package body Sem_Res is
--------------------------------
procedure Resolve_Intrinsic_Operator (N : Node_Id; Typ : Entity_Id) is
- Btyp : constant Entity_Id := Base_Type (Underlying_Type (Typ));
- Op : Entity_Id;
- Arg1 : Node_Id;
- Arg2 : Node_Id;
+ Btyp : constant Entity_Id := Base_Type (Underlying_Type (Typ));
+ Op : Entity_Id;
+ Orig_Op : constant Entity_Id := Entity (N);
+ Arg1 : Node_Id;
+ Arg2 : Node_Id;
begin
+ -- We must preserve the original entity in a generic setting, so that
+ -- the legality of the operation can be verified in an instance.
+
+ if not Expander_Active then
+ return;
+ end if;
+
Op := Entity (N);
while Scope (Op) /= Standard_Standard loop
Op := Homonym (Op);
@@ -6601,8 +6796,13 @@ package body Sem_Res is
Arg2 := Unchecked_Convert_To (Btyp, Right_Opnd (N));
end if;
- Save_Interps (Left_Opnd (N), Expression (Arg1));
- Save_Interps (Right_Opnd (N), Expression (Arg2));
+ if Nkind (Arg1) = N_Type_Conversion then
+ Save_Interps (Left_Opnd (N), Expression (Arg1));
+ end if;
+
+ if Nkind (Arg2) = N_Type_Conversion then
+ Save_Interps (Right_Opnd (N), Expression (Arg2));
+ end if;
Set_Left_Opnd (N, Arg1);
Set_Right_Opnd (N, Arg2);
@@ -6615,19 +6815,31 @@ package body Sem_Res is
or else Typ /= Etype (Right_Opnd (N))
then
-- Add explicit conversion where needed, and save interpretations in
- -- case operands are overloaded.
+ -- case operands are overloaded. If the context is a VMS operation,
+ -- assert that the conversion is legal (the operands have the proper
+ -- types to select the VMS intrinsic). Note that in rare cases the
+ -- VMS operators may be visible, but the default System is being used
+ -- and Address is a private type.
Arg1 := Convert_To (Typ, Left_Opnd (N));
Arg2 := Convert_To (Typ, Right_Opnd (N));
if Nkind (Arg1) = N_Type_Conversion then
Save_Interps (Left_Opnd (N), Expression (Arg1));
+
+ if Is_VMS_Operator (Orig_Op) then
+ Set_Conversion_OK (Arg1);
+ end if;
else
Save_Interps (Left_Opnd (N), Arg1);
end if;
if Nkind (Arg2) = N_Type_Conversion then
Save_Interps (Right_Opnd (N), Expression (Arg2));
+
+ if Is_VMS_Operator (Orig_Op) then
+ Set_Conversion_OK (Arg2);
+ end if;
else
Save_Interps (Right_Opnd (N), Arg2);
end if;
@@ -6699,13 +6911,18 @@ package body Sem_Res is
B_Typ := Base_Type (Typ);
end if;
+ -- OK if this is a VMS-specific intrinsic operation
+
+ if Is_VMS_Operator (Entity (N)) then
+ null;
+
-- The following test is required because the operands of the operation
-- may be literals, in which case the resulting type appears to be
-- compatible with a signed integer type, when in fact it is compatible
-- only with modular types. If the context itself is universal, the
-- operation is illegal.
- if not Valid_Boolean_Arg (Typ) then
+ elsif not Valid_Boolean_Arg (Typ) then
Error_Msg_N ("invalid context for logical operation", N);
Set_Etype (N, Any_Type);
return;
@@ -6822,6 +7039,18 @@ package body Sem_Res is
T := Intersect_Types (L, R);
end if;
+ -- If mixed-mode operations are present and operands are all literal,
+ -- the only interpretation involves Duration, which is probably not
+ -- the intention of the programmer.
+
+ if T = Any_Fixed then
+ T := Unique_Fixed_Point_Type (N);
+
+ if T = Any_Type then
+ return;
+ end if;
+ end if;
+
Resolve (L, T);
Check_Unset_Reference (L);
@@ -7249,9 +7478,12 @@ package body Sem_Res is
B_Typ := Base_Type (Typ);
end if;
+ if Is_VMS_Operator (Entity (N)) then
+ null;
+
-- Straightforward case of incorrect arguments
- if not Valid_Boolean_Arg (Typ) then
+ elsif not Valid_Boolean_Arg (Typ) then
Error_Msg_N ("invalid operand type for operator&", N);
Set_Etype (N, Any_Type);
return;
@@ -7628,7 +7860,6 @@ package body Sem_Res is
Comp := Next_Entity (Comp);
end loop;
-
end if;
Get_Next_Interp (I, It);
@@ -7666,9 +7897,7 @@ package body Sem_Res is
end if;
if Has_Discriminants (T)
- and then (Ekind (Entity (S)) = E_Component
- or else
- Ekind (Entity (S)) = E_Discriminant)
+ and then Ekind_In (Entity (S), E_Component, E_Discriminant)
and then Present (Original_Record_Component (Entity (S)))
and then Ekind (Original_Record_Component (Entity (S))) = E_Component
and then Present (Discriminant_Checking_Func
@@ -7697,6 +7926,23 @@ package body Sem_Res is
-- Note: No Eval processing is required, because the prefix is of a
-- record type, or protected type, and neither can possibly be static.
+ -- If the array type is atomic, and is packed, and we are in a left side
+ -- context, then this is worth a warning, since we have a situation
+ -- where the access to the component may cause extra read/writes of
+ -- the atomic array object, which could be considered unexpected.
+
+ if Nkind (N) = N_Selected_Component
+ and then (Is_Atomic (T)
+ or else (Is_Entity_Name (Prefix (N))
+ and then Is_Atomic (Entity (Prefix (N)))))
+ and then Is_Packed (T)
+ and then Is_LHS (N)
+ then
+ Error_Msg_N ("?assignment to component of packed atomic record",
+ Prefix (N));
+ Error_Msg_N ("?\may cause unexpected accesses to atomic object",
+ Prefix (N));
+ end if;
end Resolve_Selected_Component;
-------------------
@@ -7733,8 +7979,11 @@ package body Sem_Res is
R : constant Node_Id := Right_Opnd (N);
begin
+ -- Why are the calls to Check_Order_Dependence commented out ???
Resolve (L, B_Typ);
+ -- Check_Order_Dependence; -- For AI05-0144
Resolve (R, B_Typ);
+ -- Check_Order_Dependence; -- For AI05-0144
-- Check for issuing warning for always False assert/check, this happens
-- when assertions are turned off, in which case the pragma Assert/Check
@@ -7772,15 +8021,15 @@ package body Sem_Res is
then
null;
else
- -- Issue warning. Note that we don't want to make this
- -- an unconditional warning, because if the assert is
- -- within deleted code we do not want the warning. But
- -- we do not want the deletion of the IF/AND-THEN to
- -- take this message with it. We achieve this by making
- -- sure that the expanded code points to the Sloc of
- -- the expression, not the original pragma.
-
- Error_Msg_N ("?assertion would fail at run-time", Orig);
+ -- Issue warning. We do not want the deletion of the
+ -- IF/AND-THEN to take this message with it. We achieve
+ -- this by making sure that the expanded code points to
+ -- the Sloc of the expression, not the original pragma.
+
+ Error_Msg_N
+ ("?assertion would fail at run-time!",
+ Expression
+ (First (Pragma_Argument_Associations (Orig))));
end if;
end;
@@ -7803,7 +8052,10 @@ package body Sem_Res is
then
null;
else
- Error_Msg_N ("?check would fail at run-time", Orig);
+ Error_Msg_N
+ ("?check would fail at run-time!",
+ Expression
+ (Last (Pragma_Argument_Associations (Orig))));
end if;
end;
end if;
@@ -7905,6 +8157,7 @@ package body Sem_Res is
end if;
elsif Is_Entity_Name (Name)
+ or else Nkind (Name) = N_Explicit_Dereference
or else (Nkind (Name) = N_Function_Call
and then not Is_Constrained (Etype (Name)))
then
@@ -8398,7 +8651,7 @@ package body Sem_Res is
(Etype (Entity (Orig_N)) = Orig_T
or else
(Ekind (Entity (Orig_N)) = E_Loop_Parameter
- and then Covers (Orig_T, Etype (Entity (Orig_N)))))
+ and then Covers (Orig_T, Etype (Entity (Orig_N)))))
then
-- One more check, do not give warning if the analyzed conversion
-- has an expression with non-static bounds, and the bounds of the
@@ -8436,11 +8689,11 @@ package body Sem_Res is
begin
if Is_Access_Type (Opnd) then
- Opnd := Directly_Designated_Type (Opnd);
+ Opnd := Designated_Type (Opnd);
end if;
if Is_Access_Type (Target_Typ) then
- Target := Directly_Designated_Type (Target);
+ Target := Designated_Type (Target);
end if;
if Opnd = Target then
@@ -8454,7 +8707,8 @@ package body Sem_Res is
if From_With_Type (Opnd) then
Error_Msg_Qual_Level := 99;
- Error_Msg_NE ("missing WITH clause on package &", N,
+ Error_Msg_NE -- CODEFIX
+ ("missing WITH clause on package &", N,
Cunit_Entity (Get_Source_Unit (Base_Type (Opnd))));
Error_Msg_N
("type conversions require visibility of the full view",
@@ -8466,7 +8720,8 @@ package body Sem_Res is
and then Present (Non_Limited_View (Etype (Target))))
then
Error_Msg_Qual_Level := 99;
- Error_Msg_NE ("missing WITH clause on package &", N,
+ Error_Msg_NE -- CODEFIX
+ ("missing WITH clause on package &", N,
Cunit_Entity (Get_Source_Unit (Base_Type (Target))));
Error_Msg_N
("type conversions require visibility of the full view",
@@ -8482,9 +8737,7 @@ package body Sem_Res is
-- Handle subtypes
- if Ekind (Opnd) = E_Protected_Subtype
- or else Ekind (Opnd) = E_Task_Subtype
- then
+ if Ekind_In (Opnd, E_Protected_Subtype, E_Task_Subtype) then
Opnd := Etype (Opnd);
end if;
@@ -8560,7 +8813,7 @@ package body Sem_Res is
Determine_Range (Right_Opnd (N), OK, Lo, Hi);
if OK and then Hi >= Lo and then Lo >= 0 then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?abs applied to known non-negative value has no effect", N);
end if;
end if;
@@ -8784,9 +9037,7 @@ package body Sem_Res is
-- Exclude user-defined intrinsic operations of the same name, which are
-- treated separately and rewritten as calls.
- if Ekind (Op) /= E_Function
- or else Chars (N) /= Nam
- then
+ if Ekind (Op) /= E_Function or else Chars (N) /= Nam then
Op_Node := New_Node (Operator_Kind (Nam, Is_Binary), Sloc (N));
Set_Chars (Op_Node, Nam);
Set_Etype (Op_Node, Etype (N));
@@ -8825,9 +9076,8 @@ package body Sem_Res is
end case;
end if;
- elsif Ekind (Op) = E_Function
- and then Is_Intrinsic_Subprogram (Op)
- then
+ elsif Ekind (Op) = E_Function and then Is_Intrinsic_Subprogram (Op) then
+
-- Operator renames a user-defined operator of the same name. Use
-- the original operator in the node, which is the one that Gigi
-- knows about.
@@ -8877,7 +9127,17 @@ package body Sem_Res is
Index_Subtype := Create_Itype (Subtype_Kind (Ekind (Index_Type)), N);
- Set_Scalar_Range (Index_Subtype, Drange);
+ -- Take a new copy of Drange (where bounds have been rewritten to
+ -- reference side-effect-vree names). Using a separate tree ensures
+ -- that further expansion (e.g while rewriting a slice assignment
+ -- into a FOR loop) does not attempt to remove side effects on the
+ -- bounds again (which would cause the bounds in the index subtype
+ -- definition to refer to temporaries before they are defined) (the
+ -- reason is that some names are considered side effect free here
+ -- for the subtype, but not in the context of a loop iteration
+ -- scheme).
+
+ Set_Scalar_Range (Index_Subtype, New_Copy_Tree (Drange));
Set_Etype (Index_Subtype, Index_Type);
Set_Size_Info (Index_Subtype, Index_Type);
Set_RM_Size (Index_Subtype, RM_Size (Index_Type));
@@ -8900,18 +9160,22 @@ package body Sem_Res is
Set_Etype (N, Slice_Subtype);
- -- In the packed case, this must be immediately frozen
-
- -- Couldn't we always freeze here??? and if we did, then the above
- -- call to Check_Compile_Time_Size could be eliminated, which would
- -- be nice, because then that routine could be made private to Freeze.
-
- -- Why the test for In_Spec_Expression here ???
+ -- For packed slice subtypes, freeze immediately (except in the
+ -- case of being in a "spec expression" where we never freeze
+ -- when we first see the expression).
if Is_Packed (Slice_Subtype) and not In_Spec_Expression then
Freeze_Itype (Slice_Subtype, N);
- end if;
+ -- For all other cases insert an itype reference in the slice's actions
+ -- so that the itype is frozen at the proper place in the tree (i.e. at
+ -- the point where actions for the slice are analyzed). Note that this
+ -- is different from freezing the itype immediately, which might be
+ -- premature (e.g. if the slice is within a transient scope).
+
+ else
+ Ensure_Defined (Typ => Slice_Subtype, N => N);
+ end if;
end Set_Slice_Subtype;
--------------------------------
@@ -9253,9 +9517,8 @@ package body Sem_Res is
-- out-of-scope references.
elsif
- (Ekind (Target_Comp_Base) = E_Anonymous_Access_Type
- or else
- Ekind (Target_Comp_Base) = E_Anonymous_Access_Subprogram_Type)
+ Ekind_In (Target_Comp_Base, E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
and then Ekind (Opnd_Comp_Base) = Ekind (Target_Comp_Base)
and then
Subtypes_Statically_Match (Target_Comp_Type, Opnd_Comp_Type)
@@ -9384,6 +9647,7 @@ package body Sem_Res is
It : Interp;
It1 : Interp;
N1 : Entity_Id;
+ T1 : Entity_Id;
begin
-- Remove procedure calls, which syntactically cannot appear in
@@ -9440,16 +9704,30 @@ package body Sem_Res is
if Present (It.Typ) then
N1 := It1.Nam;
+ T1 := It1.Typ;
It1 := Disambiguate (Operand, I1, I, Any_Type);
if It1 = No_Interp then
Error_Msg_N ("ambiguous operand in conversion", Operand);
- Error_Msg_Sloc := Sloc (It.Nam);
+ -- If the interpretation involves a standard operator, use
+ -- the location of the type, which may be user-defined.
+
+ if Sloc (It.Nam) = Standard_Location then
+ Error_Msg_Sloc := Sloc (It.Typ);
+ else
+ Error_Msg_Sloc := Sloc (It.Nam);
+ end if;
+
Error_Msg_N -- CODEFIX
("\\possible interpretation#!", Operand);
- Error_Msg_Sloc := Sloc (N1);
+ if Sloc (N1) = Standard_Location then
+ Error_Msg_Sloc := Sloc (T1);
+ else
+ Error_Msg_Sloc := Sloc (N1);
+ end if;
+
Error_Msg_N -- CODEFIX
("\\possible interpretation#!", Operand);
@@ -9511,9 +9789,8 @@ package body Sem_Res is
-- Ada 2005 (AI-251): Anonymous access types where target references an
-- interface type.
- elsif (Ekind (Target_Type) = E_General_Access_Type
- or else
- Ekind (Target_Type) = E_Anonymous_Access_Type)
+ elsif Ekind_In (Target_Type, E_General_Access_Type,
+ E_Anonymous_Access_Type)
and then Is_Interface (Directly_Designated_Type (Target_Type))
then
-- Check the static accessibility rule of 4.6(17). Note that the
@@ -9582,8 +9859,8 @@ package body Sem_Res is
if Is_Entity_Name (Operand)
and then not Is_Local_Anonymous_Access (Opnd_Type)
- and then (Ekind (Entity (Operand)) = E_In_Parameter
- or else Ekind (Entity (Operand)) = E_Constant)
+ and then
+ Ekind_In (Entity (Operand), E_In_Parameter, E_Constant)
and then Present (Discriminal_Link (Entity (Operand)))
then
Error_Msg_N
@@ -9598,15 +9875,14 @@ package body Sem_Res is
-- General and anonymous access types
- elsif (Ekind (Target_Type) = E_General_Access_Type
- or else Ekind (Target_Type) = E_Anonymous_Access_Type)
+ elsif Ekind_In (Target_Type, E_General_Access_Type,
+ E_Anonymous_Access_Type)
and then
Conversion_Check
(Is_Access_Type (Opnd_Type)
- and then Ekind (Opnd_Type) /=
- E_Access_Subprogram_Type
- and then Ekind (Opnd_Type) /=
- E_Access_Protected_Subprogram_Type,
+ and then not
+ Ekind_In (Opnd_Type, E_Access_Subprogram_Type,
+ E_Access_Protected_Subprogram_Type),
"must be an access-to-object type")
then
if Is_Access_Constant (Opnd_Type)
@@ -9656,7 +9932,6 @@ package body Sem_Res is
elsif Ekind (Opnd_Type) = E_Anonymous_Access_Type
and then not Is_Local_Anonymous_Access (Opnd_Type)
then
-
-- When the operand is a selected access discriminant the check
-- needs to be made against the level of the object denoted by
-- the prefix of the selected name (Object_Access_Level handles
@@ -9693,8 +9968,8 @@ package body Sem_Res is
-- access type.
if Is_Entity_Name (Operand)
- and then (Ekind (Entity (Operand)) = E_In_Parameter
- or else Ekind (Entity (Operand)) = E_Constant)
+ and then
+ Ekind_In (Entity (Operand), E_In_Parameter, E_Constant)
and then Present (Discriminal_Link (Entity (Operand)))
then
Error_Msg_N
@@ -9914,7 +10189,8 @@ package body Sem_Res is
and then Is_Access_Type (Opnd_Type)
then
Error_Msg_N ("target type must be general access type!", N);
- Error_Msg_NE ("add ALL to }!", N, Target_Type);
+ Error_Msg_NE -- CODEFIX
+ ("add ALL to }!", N, Target_Type);
return False;
else
diff --git a/gcc/ada/sem_scil.adb b/gcc/ada/sem_scil.adb
index 5adf803fc70..3ab7511663e 100644
--- a/gcc/ada/sem_scil.adb
+++ b/gcc/ada/sem_scil.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2010, 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- --
@@ -23,649 +23,170 @@
-- --
------------------------------------------------------------------------------
-with Einfo; use Einfo;
-with Namet; use Namet;
-with Nlists; use Nlists;
-with Opt; use Opt;
-with Rtsfind; use Rtsfind;
-with Sem; use Sem;
-with Sem_Aux; use Sem_Aux;
-with Sem_Util; use Sem_Util;
-with Sinfo; use Sinfo;
-with Snames; use Snames;
-with Stand; use Stand;
+with Einfo; use Einfo;
+with Nlists; use Nlists;
+with Rtsfind; use Rtsfind;
+with Sem_Aux; use Sem_Aux;
+with Sinfo; use Sinfo;
+with Stand; use Stand;
+with SCIL_LL; use SCIL_LL;
package body Sem_SCIL is
- ----------------------
- -- Adjust_SCIL_Node --
- ----------------------
-
- procedure Adjust_SCIL_Node (Old_Node : Node_Id; New_Node : Node_Id) is
- SCIL_Node : Node_Id;
-
- begin
- pragma Assert (Generate_SCIL);
-
- -- Check cases in which no action is required. Currently the only SCIL
- -- nodes that may require adjustment are those of dispatching calls
- -- internally generated by the frontend.
-
- if Comes_From_Source (Old_Node)
- or else not
- Nkind_In (New_Node, N_Function_Call, N_Procedure_Call_Statement)
- then
- return;
-
- -- Conditional expression associated with equality operator. Old_Node
- -- may be part of the expansion of the predefined equality operator of
- -- a tagged type and hence we need to check if it has a SCIL dispatching
- -- node that needs adjustment.
-
- elsif Nkind (Old_Node) = N_Conditional_Expression
- and then (Nkind (Original_Node (Old_Node)) = N_Op_Eq
- or else
- (Nkind (Original_Node (Old_Node)) = N_Function_Call
- and then Chars (Name (Original_Node (Old_Node))) =
- Name_Op_Eq))
- then
- null;
-
- -- Type conversions may involve dispatching calls to functions whose
- -- associated SCIL dispatching node needs adjustment.
-
- elsif Nkind_In (Old_Node, N_Type_Conversion,
- N_Unchecked_Type_Conversion)
- then
- null;
-
- -- Relocated subprogram call
-
- elsif Nkind (Old_Node) = Nkind (New_Node)
- and then Original_Node (Old_Node) = Original_Node (New_Node)
- then
- null;
-
- else
- return;
- end if;
-
- -- Search for the SCIL node and update it (if found)
-
- SCIL_Node := Find_SCIL_Node (Old_Node);
-
- if Present (SCIL_Node) then
- Set_SCIL_Related_Node (SCIL_Node, New_Node);
- end if;
- end Adjust_SCIL_Node;
-
---------------------
-- Check_SCIL_Node --
---------------------
function Check_SCIL_Node (N : Node_Id) return Traverse_Result is
- Ctrl_Tag : Node_Id;
- Ctrl_Typ : Entity_Id;
+ SCIL_Node : constant Node_Id := Get_SCIL_Node (N);
+ Ctrl_Tag : Node_Id;
+ Ctrl_Typ : Entity_Id;
begin
- if Nkind (N) = N_SCIL_Membership_Test then
-
- -- Check contents of the boolean expression associated with the
- -- membership test.
-
- pragma Assert (Nkind (SCIL_Related_Node (N)) = N_Identifier
- and then Etype (SCIL_Related_Node (N)) = Standard_Boolean);
-
- -- Check the entity identifier of the associated tagged type (that
- -- is, in testing for membership in T'Class, the entity id of the
- -- specific type T).
-
- -- Note: When the SCIL node is generated the private and full-view
- -- of the tagged types may have been swapped and hence the node
- -- referenced by attribute SCIL_Entity may be the private view.
- -- Therefore, in order to uniformily locate the full-view we use
- -- attribute Underlying_Type.
+ -- For nodes that do not have SCIL node continue traversing the tree
- pragma Assert (Is_Tagged_Type (Underlying_Type (SCIL_Entity (N))));
-
- -- Interface types are unsupported
-
- pragma Assert (not Is_Interface (Underlying_Type (SCIL_Entity (N))));
-
- -- Check the decoration of the expression that denotes the tag value
- -- being tested
-
- Ctrl_Tag := SCIL_Tag_Value (N);
+ if No (SCIL_Node) then
+ return OK;
+ end if;
- case Nkind (Ctrl_Tag) is
+ case Nkind (SCIL_Node) is
+ when N_SCIL_Dispatch_Table_Tag_Init =>
+ pragma Assert (Nkind (N) = N_Object_Declaration);
+ null;
- -- For class-wide membership tests the SCIL tag value is the tag
- -- of the tested object (i.e. Obj.Tag).
+ when N_SCIL_Dispatching_Call =>
+ Ctrl_Tag := SCIL_Controlling_Tag (SCIL_Node);
- when N_Selected_Component =>
- pragma Assert (Etype (Ctrl_Tag) = RTE (RE_Tag));
- null;
+ -- Parent of SCIL dispatching call nodes MUST be a subprogram call
- when others =>
+ if not Nkind_In (N, N_Function_Call,
+ N_Procedure_Call_Statement)
+ then
pragma Assert (False);
- null;
-
- end case;
-
- return Skip;
+ raise Program_Error;
- elsif Nkind (N) = N_SCIL_Dispatching_Call then
- Ctrl_Tag := SCIL_Controlling_Tag (N);
+ -- In simple cases the controlling tag is the tag of the
+ -- controlling argument (i.e. Obj.Tag).
- -- SCIL_Related_Node of SCIL dispatching call nodes MUST reference
- -- subprogram calls.
+ elsif Nkind (Ctrl_Tag) = N_Selected_Component then
+ Ctrl_Typ := Etype (Ctrl_Tag);
- if not Nkind_In (SCIL_Related_Node (N), N_Function_Call,
- N_Procedure_Call_Statement)
- then
- pragma Assert (False);
- raise Program_Error;
+ -- Interface types are unsupported
- -- In simple cases the controlling tag is the tag of the controlling
- -- argument (i.e. Obj.Tag).
+ if Is_Interface (Ctrl_Typ)
+ or else (RTE_Available (RE_Interface_Tag)
+ and then Ctrl_Typ = RTE (RE_Interface_Tag))
+ then
+ null;
- elsif Nkind (Ctrl_Tag) = N_Selected_Component then
- Ctrl_Typ := Etype (Ctrl_Tag);
+ else
+ pragma Assert (Ctrl_Typ = RTE (RE_Tag));
+ null;
+ end if;
- -- Interface types are unsupported
+ -- When the controlling tag of a dispatching call is an identifier
+ -- the SCIL_Controlling_Tag attribute references the corresponding
+ -- object or parameter declaration. Interface types are still
+ -- unsupported.
- if Is_Interface (Ctrl_Typ)
- or else (RTE_Available (RE_Interface_Tag)
- and then Ctrl_Typ = RTE (RE_Interface_Tag))
+ elsif Nkind_In (Ctrl_Tag, N_Object_Declaration,
+ N_Parameter_Specification)
then
- null;
+ Ctrl_Typ := Etype (Defining_Identifier (Ctrl_Tag));
+
+ -- Interface types are unsupported.
+
+ if Is_Interface (Ctrl_Typ)
+ or else (RTE_Available (RE_Interface_Tag)
+ and then Ctrl_Typ = RTE (RE_Interface_Tag))
+ or else (Is_Access_Type (Ctrl_Typ)
+ and then
+ Is_Interface
+ (Available_View
+ (Base_Type (Designated_Type (Ctrl_Typ)))))
+ then
+ null;
- else
- pragma Assert (Ctrl_Typ = RTE (RE_Tag));
- null;
- end if;
+ else
+ pragma Assert
+ (Ctrl_Typ = RTE (RE_Tag)
+ or else
+ (Is_Access_Type (Ctrl_Typ)
+ and then Available_View
+ (Base_Type (Designated_Type (Ctrl_Typ)))
+ = RTE (RE_Tag)));
+ null;
+ end if;
- -- When the controlling tag of a dispatching call is an identifier
- -- the SCIL_Controlling_Tag attribute references the corresponding
- -- object or parameter declaration. Interface types are still
- -- unsupported.
-
- elsif Nkind_In (Ctrl_Tag, N_Object_Declaration,
- N_Parameter_Specification)
- then
- Ctrl_Typ := Etype (Defining_Identifier (Ctrl_Tag));
-
- -- Interface types are unsupported.
-
- if Is_Interface (Ctrl_Typ)
- or else (RTE_Available (RE_Interface_Tag)
- and then Ctrl_Typ = RTE (RE_Interface_Tag))
- or else (Is_Access_Type (Ctrl_Typ)
- and then
- Is_Interface
- (Available_View
- (Base_Type (Designated_Type (Ctrl_Typ)))))
- then
- null;
+ -- Interface types are unsupported
- else
- pragma Assert
- (Ctrl_Typ = RTE (RE_Tag)
- or else
- (Is_Access_Type (Ctrl_Typ)
- and then Available_View
- (Base_Type (Designated_Type (Ctrl_Typ))) =
- RTE (RE_Tag)));
+ elsif Is_Interface (Etype (Ctrl_Tag)) then
null;
- end if;
-
- -- Interface types are unsupported
-
- elsif Is_Interface (Etype (Ctrl_Tag)) then
- null;
- else
- pragma Assert (False);
- raise Program_Error;
- end if;
-
- return Skip;
-
- -- Node is not N_SCIL_Dispatching_Call
-
- else
- return OK;
- end if;
- end Check_SCIL_Node;
-
- --------------------
- -- Find_SCIL_Node --
- --------------------
-
- function Find_SCIL_Node (Node : Node_Id) return Node_Id is
- Found_Node : Node_Id;
- -- This variable stores the last node found by the nested subprogram
- -- Find_SCIL_Node.
-
- function Find_SCIL_Node (L : List_Id) return Boolean;
- -- Searches in list L for a SCIL node associated with a dispatching call
- -- whose SCIL_Related_Node is Node. If found returns true and stores the
- -- SCIL node in Found_Node; otherwise returns False and sets Found_Node
- -- to Empty.
-
- --------------------
- -- Find_SCIL_Node --
- --------------------
-
- function Find_SCIL_Node (L : List_Id) return Boolean is
- N : Node_Id;
-
- begin
- N := First (L);
- while Present (N) loop
- if Nkind (N) in N_SCIL_Node
- and then SCIL_Related_Node (N) = Node
- then
- Found_Node := N;
- return True;
+ else
+ pragma Assert (False);
+ raise Program_Error;
end if;
- Next (N);
- end loop;
+ return Skip;
- Found_Node := Empty;
- return False;
- end Find_SCIL_Node;
+ when N_SCIL_Membership_Test =>
- -- Local variables
+ -- Check contents of the boolean expression associated with the
+ -- membership test.
- P : Node_Id;
+ pragma Assert (Nkind_In (N, N_Identifier,
+ N_And_Then,
+ N_Or_Else,
+ N_Expression_With_Actions)
+ and then Etype (N) = Standard_Boolean);
- -- Start of processing for Find_SCIL_Node
+ -- Check the entity identifier of the associated tagged type (that
+ -- is, in testing for membership in T'Class, the entity id of the
+ -- specific type T).
- begin
- pragma Assert (Generate_SCIL);
-
- -- Search for the SCIL node in list associated with a transient scope
-
- if Scope_Is_Transient then
- declare
- SE : Scope_Stack_Entry
- renames Scope_Stack.Table (Scope_Stack.Last);
- begin
- if SE.Is_Transient
- and then Present (SE.Actions_To_Be_Wrapped_Before)
- and then Find_SCIL_Node (SE.Actions_To_Be_Wrapped_Before)
- then
- return Found_Node;
- end if;
- end;
- end if;
-
- -- Otherwise climb up the tree searching for the SCIL node analyzing
- -- all the lists in which Insert_Actions may have inserted it
-
- P := Node;
- while Present (P) loop
- case Nkind (P) is
+ -- Note: When the SCIL node is generated the private and full-view
+ -- of the tagged types may have been swapped and hence the node
+ -- referenced by attribute SCIL_Entity may be the private view.
+ -- Therefore, in order to uniformily locate the full-view we use
+ -- attribute Underlying_Type.
- -- Actions associated with AND THEN or OR ELSE
+ pragma Assert
+ (Is_Tagged_Type (Underlying_Type (SCIL_Entity (SCIL_Node))));
- when N_Short_Circuit =>
- if Present (Actions (P))
- and then Find_SCIL_Node (Actions (P))
- then
- return Found_Node;
- end if;
-
- -- Actions of conditional expressions
-
- when N_Conditional_Expression =>
- if (Present (Then_Actions (P))
- and then Find_SCIL_Node (Actions (P)))
- or else
- (Present (Else_Actions (P))
- and then Find_SCIL_Node (Else_Actions (P)))
- then
- return Found_Node;
- end if;
-
- -- Actions in handled sequence of statements
+ -- Interface types are unsupported
- when
- N_Handled_Sequence_Of_Statements =>
- if Find_SCIL_Node (Statements (P)) then
- return Found_Node;
- end if;
+ pragma Assert
+ (not Is_Interface (Underlying_Type (SCIL_Entity (SCIL_Node))));
- -- Conditions of while expression or elsif.
+ -- Check the decoration of the expression that denotes the tag
+ -- value being tested
- when N_Iteration_Scheme |
- N_Elsif_Part
- =>
- if Present (Condition_Actions (P))
- and then Find_SCIL_Node (Condition_Actions (P))
- then
- return Found_Node;
- end if;
+ Ctrl_Tag := SCIL_Tag_Value (SCIL_Node);
- -- Statements, declarations, pragmas, representation clauses
-
- when
- -- Statements
-
- N_Procedure_Call_Statement |
- N_Statement_Other_Than_Procedure_Call |
-
- -- Pragmas
-
- N_Pragma |
-
- -- Representation_Clause
-
- N_At_Clause |
- N_Attribute_Definition_Clause |
- N_Enumeration_Representation_Clause |
- N_Record_Representation_Clause |
-
- -- Declarations
-
- N_Abstract_Subprogram_Declaration |
- N_Entry_Body |
- N_Exception_Declaration |
- N_Exception_Renaming_Declaration |
- N_Formal_Abstract_Subprogram_Declaration |
- N_Formal_Concrete_Subprogram_Declaration |
- N_Formal_Object_Declaration |
- N_Formal_Type_Declaration |
- N_Full_Type_Declaration |
- N_Function_Instantiation |
- N_Generic_Function_Renaming_Declaration |
- N_Generic_Package_Declaration |
- N_Generic_Package_Renaming_Declaration |
- N_Generic_Procedure_Renaming_Declaration |
- N_Generic_Subprogram_Declaration |
- N_Implicit_Label_Declaration |
- N_Incomplete_Type_Declaration |
- N_Number_Declaration |
- N_Object_Declaration |
- N_Object_Renaming_Declaration |
- N_Package_Body |
- N_Package_Body_Stub |
- N_Package_Declaration |
- N_Package_Instantiation |
- N_Package_Renaming_Declaration |
- N_Private_Extension_Declaration |
- N_Private_Type_Declaration |
- N_Procedure_Instantiation |
- N_Protected_Body |
- N_Protected_Body_Stub |
- N_Protected_Type_Declaration |
- N_Single_Task_Declaration |
- N_Subprogram_Body |
- N_Subprogram_Body_Stub |
- N_Subprogram_Declaration |
- N_Subprogram_Renaming_Declaration |
- N_Subtype_Declaration |
- N_Task_Body |
- N_Task_Body_Stub |
- N_Task_Type_Declaration |
-
- -- Freeze entity behaves like a declaration or statement
-
- N_Freeze_Entity
- =>
- -- Do not search here if the item is not a list member
-
- if not Is_List_Member (P) then
- null;
+ case Nkind (Ctrl_Tag) is
- -- Do not search if parent of P is an N_Component_Association
- -- node (i.e. we are in the context of an N_Aggregate or
- -- N_Extension_Aggregate node). In this case the node should
- -- have been added before the entire aggregate.
+ -- For class-wide membership tests the SCIL tag value is the
+ -- tag of the tested object (i.e. Obj.Tag).
- elsif Nkind (Parent (P)) = N_Component_Association then
+ when N_Selected_Component =>
+ pragma Assert (Etype (Ctrl_Tag) = RTE (RE_Tag));
null;
- -- Do not search if the parent of P is either an N_Variant
- -- node or an N_Record_Definition node. In this case the node
- -- should have been added before the entire record.
-
- elsif Nkind (Parent (P)) = N_Variant
- or else Nkind (Parent (P)) = N_Record_Definition
- then
+ when others =>
+ pragma Assert (False);
null;
+ end case;
- -- Otherwise search it in the list containing this node
-
- elsif Find_SCIL_Node (List_Containing (P)) then
- return Found_Node;
- end if;
-
- -- A special case, N_Raise_xxx_Error can act either as a statement
- -- or a subexpression. We diferentiate them by looking at the
- -- Etype. It is set to Standard_Void_Type in the statement case.
-
- when
- N_Raise_xxx_Error =>
- if Etype (P) = Standard_Void_Type then
- if Is_List_Member (P)
- and then Find_SCIL_Node (List_Containing (P))
- then
- return Found_Node;
- end if;
-
- -- In the subexpression case, keep climbing
-
- else
- null;
- end if;
-
- -- If a component association appears within a loop created for
- -- an array aggregate, check if the SCIL node was added to the
- -- the list of nodes attached to the association.
-
- when
- N_Component_Association =>
- if Nkind (Parent (P)) = N_Aggregate
- and then Present (Loop_Actions (P))
- and then Find_SCIL_Node (Loop_Actions (P))
- then
- return Found_Node;
- end if;
-
- -- Another special case, an attribute denoting a procedure call
-
- when
- N_Attribute_Reference =>
- if Is_Procedure_Attribute_Name (Attribute_Name (P))
- and then Find_SCIL_Node (List_Containing (P))
- then
- return Found_Node;
-
- -- In the subexpression case, keep climbing
-
- else
- null;
- end if;
-
- -- SCIL nodes do not have subtrees and hence they can never be
- -- found climbing tree
-
- when
- N_SCIL_Dispatch_Table_Object_Init |
- N_SCIL_Dispatch_Table_Tag_Init |
- N_SCIL_Dispatching_Call |
- N_SCIL_Membership_Test |
- N_SCIL_Tag_Init
- =>
- pragma Assert (False);
- raise Program_Error;
-
- -- For all other node types, keep climbing tree
-
- when
- N_Abortable_Part |
- N_Accept_Alternative |
- N_Access_Definition |
- N_Access_Function_Definition |
- N_Access_Procedure_Definition |
- N_Access_To_Object_Definition |
- N_Aggregate |
- N_Allocator |
- N_Case_Statement_Alternative |
- N_Character_Literal |
- N_Compilation_Unit |
- N_Compilation_Unit_Aux |
- N_Component_Clause |
- N_Component_Declaration |
- N_Component_Definition |
- N_Component_List |
- N_Constrained_Array_Definition |
- N_Decimal_Fixed_Point_Definition |
- N_Defining_Character_Literal |
- N_Defining_Identifier |
- N_Defining_Operator_Symbol |
- N_Defining_Program_Unit_Name |
- N_Delay_Alternative |
- N_Delta_Constraint |
- N_Derived_Type_Definition |
- N_Designator |
- N_Digits_Constraint |
- N_Discriminant_Association |
- N_Discriminant_Specification |
- N_Empty |
- N_Entry_Body_Formal_Part |
- N_Entry_Call_Alternative |
- N_Entry_Declaration |
- N_Entry_Index_Specification |
- N_Enumeration_Type_Definition |
- N_Error |
- N_Exception_Handler |
- N_Expanded_Name |
- N_Explicit_Dereference |
- N_Extension_Aggregate |
- N_Floating_Point_Definition |
- N_Formal_Decimal_Fixed_Point_Definition |
- N_Formal_Derived_Type_Definition |
- N_Formal_Discrete_Type_Definition |
- N_Formal_Floating_Point_Definition |
- N_Formal_Modular_Type_Definition |
- N_Formal_Ordinary_Fixed_Point_Definition |
- N_Formal_Package_Declaration |
- N_Formal_Private_Type_Definition |
- N_Formal_Signed_Integer_Type_Definition |
- N_Function_Call |
- N_Function_Specification |
- N_Generic_Association |
- N_Identifier |
- N_In |
- N_Index_Or_Discriminant_Constraint |
- N_Indexed_Component |
- N_Integer_Literal |
- N_Itype_Reference |
- N_Label |
- N_Loop_Parameter_Specification |
- N_Mod_Clause |
- N_Modular_Type_Definition |
- N_Not_In |
- N_Null |
- N_Op_Abs |
- N_Op_Add |
- N_Op_And |
- N_Op_Concat |
- N_Op_Divide |
- N_Op_Eq |
- N_Op_Expon |
- N_Op_Ge |
- N_Op_Gt |
- N_Op_Le |
- N_Op_Lt |
- N_Op_Minus |
- N_Op_Mod |
- N_Op_Multiply |
- N_Op_Ne |
- N_Op_Not |
- N_Op_Or |
- N_Op_Plus |
- N_Op_Rem |
- N_Op_Rotate_Left |
- N_Op_Rotate_Right |
- N_Op_Shift_Left |
- N_Op_Shift_Right |
- N_Op_Shift_Right_Arithmetic |
- N_Op_Subtract |
- N_Op_Xor |
- N_Operator_Symbol |
- N_Ordinary_Fixed_Point_Definition |
- N_Others_Choice |
- N_Package_Specification |
- N_Parameter_Association |
- N_Parameter_Specification |
- N_Pop_Constraint_Error_Label |
- N_Pop_Program_Error_Label |
- N_Pop_Storage_Error_Label |
- N_Pragma_Argument_Association |
- N_Procedure_Specification |
- N_Protected_Definition |
- N_Push_Constraint_Error_Label |
- N_Push_Program_Error_Label |
- N_Push_Storage_Error_Label |
- N_Qualified_Expression |
- N_Range |
- N_Range_Constraint |
- N_Real_Literal |
- N_Real_Range_Specification |
- N_Record_Definition |
- N_Reference |
- N_Selected_Component |
- N_Signed_Integer_Type_Definition |
- N_Single_Protected_Declaration |
- N_Slice |
- N_String_Literal |
- N_Subprogram_Info |
- N_Subtype_Indication |
- N_Subunit |
- N_Task_Definition |
- N_Terminate_Alternative |
- N_Triggering_Alternative |
- N_Type_Conversion |
- N_Unchecked_Expression |
- N_Unchecked_Type_Conversion |
- N_Unconstrained_Array_Definition |
- N_Unused_At_End |
- N_Unused_At_Start |
- N_Use_Package_Clause |
- N_Use_Type_Clause |
- N_Variant |
- N_Variant_Part |
- N_Validate_Unchecked_Conversion |
- N_With_Clause
- =>
- null;
-
- end case;
-
- -- If we fall through above tests, keep climbing tree
-
- if Nkind (Parent (P)) = N_Subunit then
-
- -- This is the proper body corresponding to a stub. Insertion done
- -- at the point of the stub, which is in the declarative part of
- -- the parent unit.
+ return Skip;
- P := Corresponding_Stub (Parent (P));
-
- else
- P := Parent (P);
- end if;
- end loop;
-
- -- SCIL node not found
+ when others =>
+ pragma Assert (False);
+ raise Program_Error;
+ end case;
- return Empty;
- end Find_SCIL_Node;
+ return Skip;
+ end Check_SCIL_Node;
-------------------------
-- First_Non_SCIL_Node --
diff --git a/gcc/ada/sem_scil.ads b/gcc/ada/sem_scil.ads
index f257e636295..1a6e45caacb 100644
--- a/gcc/ada/sem_scil.ads
+++ b/gcc/ada/sem_scil.ads
@@ -4,9 +4,9 @@
-- --
-- S E M _ S C I L --
-- --
--- B o d y --
+-- S p e c --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2010, 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- --
@@ -33,10 +33,6 @@ package Sem_SCIL is
-- Here would be a good place to document what SCIL is all about ???
- procedure Adjust_SCIL_Node (Old_Node : Node_Id; New_Node : Node_Id);
- -- Searches for a SCIL dispatching node associated with Old_Node. If found
- -- then update its SCIL_Related_Node field to reference New_Node.
-
function Check_SCIL_Node (N : Node_Id) return Traverse_Result;
-- Process a single node during the tree traversal. Done to verify that
-- SCIL nodes decoration fulfill the requirements of the SCIL backend.
@@ -44,10 +40,6 @@ package Sem_SCIL is
procedure Check_SCIL_Nodes is new Traverse_Proc (Check_SCIL_Node);
-- The traversal procedure itself
- function Find_SCIL_Node (Node : Node_Id) return Node_Id;
- -- Searches for a SCIL dispatching node associated with Node. If not found
- -- then return Empty.
-
function First_Non_SCIL_Node (L : List_Id) return Node_Id;
-- Returns the first non-SCIL node of list L
diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb
index d35326e1a50..b1962861556 100644
--- a/gcc/ada/sem_type.adb
+++ b/gcc/ada/sem_type.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -362,7 +362,6 @@ package body Sem_Type is
-- performed, given that the operator was visible in the generic.
if Ekind (E) = E_Operator then
-
if Present (Opnd_Type) then
Vis_Type := Opnd_Type;
else
@@ -803,8 +802,8 @@ package body Sem_Type is
then
return True;
- -- The context may be class wide, and a class-wide type is
- -- compatible with any member of the class.
+ -- The context may be class wide, and a class-wide type is compatible
+ -- with any member of the class.
elsif Is_Class_Wide_Type (T1)
and then Is_Ancestor (Root_Type (T1), T2)
@@ -997,9 +996,7 @@ package body Sem_Type is
-- imposed by context.
elsif Ekind (T2) = E_Access_Attribute_Type
- and then (Ekind (BT1) = E_General_Access_Type
- or else
- Ekind (BT1) = E_Access_Type)
+ and then Ekind_In (BT1, E_General_Access_Type, E_Access_Type)
and then Covers (Designated_Type (T1), Designated_Type (T2))
then
-- If the target type is a RACW type while the source is an access
@@ -1677,9 +1674,8 @@ package body Sem_Type is
elsif Nkind (Parent (N)) = N_Object_Renaming_Declaration
and then Present (Access_Definition (Parent (N)))
then
- if Ekind (It1.Typ) = E_Anonymous_Access_Type
- or else
- Ekind (It1.Typ) = E_Anonymous_Access_Subprogram_Type
+ if Ekind_In (It1.Typ, E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
then
if Ekind (It2.Typ) = Ekind (It1.Typ) then
@@ -1691,9 +1687,8 @@ package body Sem_Type is
return It1;
end if;
- elsif Ekind (It2.Typ) = E_Anonymous_Access_Type
- or else
- Ekind (It2.Typ) = E_Anonymous_Access_Subprogram_Type
+ elsif Ekind_In (It2.Typ, E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
then
return It2;
@@ -1880,8 +1875,8 @@ package body Sem_Type is
if Ekind (Etype (Opnd)) = E_Anonymous_Access_Type
and then
- List_Containing (Parent (Designated_Type (Etype (Opnd))))
- = List_Containing (Unit_Declaration_Node (User_Subp))
+ List_Containing (Parent (Designated_Type (Etype (Opnd))))
+ = List_Containing (Unit_Declaration_Node (User_Subp))
then
if It2.Nam = Predef_Subp then
return It1;
@@ -2559,9 +2554,9 @@ package body Sem_Type is
BT1 := Base_Type (T1);
BT2 := Base_Type (T2);
- -- Handle underlying view of records with unknown discriminants
- -- using the original entity that motivated the construction of
- -- this underlying record view (see Build_Derived_Private_Type).
+ -- Handle underlying view of records with unknown discriminants using
+ -- the original entity that motivated the construction of this
+ -- underlying record view (see Build_Derived_Private_Type).
if Is_Underlying_Record_View (BT1) then
BT1 := Underlying_Record_View (BT1);
@@ -2574,12 +2569,20 @@ package body Sem_Type is
if BT1 = BT2 then
return True;
+ -- The predicate must look past privacy
+
elsif Is_Private_Type (T1)
and then Present (Full_View (T1))
and then BT2 = Base_Type (Full_View (T1))
then
return True;
+ elsif Is_Private_Type (T2)
+ and then Present (Full_View (T2))
+ and then BT1 = Base_Type (Full_View (T2))
+ then
+ return True;
+
else
Par := Etype (BT2);
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index e56066b7d4d..e846845ca70 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -50,19 +50,20 @@ with Sem_Ch8; use Sem_Ch8;
with Sem_Disp; use Sem_Disp;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
-with Sem_SCIL; use Sem_SCIL;
with Sem_Type; use Sem_Type;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Stand; use Stand;
with Style;
with Stringt; use Stringt;
+with Table;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
with Uname; use Uname;
with GNAT.HTable; use GNAT.HTable;
+
package body Sem_Util is
----------------------------------------
@@ -94,6 +95,30 @@ package body Sem_Util is
subtype NCT_Header_Num is Int range 0 .. 511;
-- Defines range of headers in hash tables (512 headers)
+ ----------------------------------
+ -- Order Dependence (AI05-0144) --
+ ----------------------------------
+
+ -- Each actual in a call is entered into the table below. A flag indicates
+ -- whether the corresponding formal is OUT or IN OUT. Each top-level call
+ -- (procedure call, condition, assignment) examines all the actuals for a
+ -- possible order dependence. The table is reset after each such check.
+
+ type Actual_Name is record
+ Act : Node_Id;
+ Is_Writable : Boolean;
+ -- Comments needed???
+
+ end record;
+
+ package Actuals_In_Call is new Table.Table (
+ Table_Component_Type => Actual_Name,
+ Table_Index_Type => Int,
+ Table_Low_Bound => 0,
+ Table_Initial => 10,
+ Table_Increment => 100,
+ Table_Name => "Actuals");
+
-----------------------
-- Local Subprograms --
-----------------------
@@ -398,9 +423,7 @@ package body Sem_Util is
end loop;
end if;
- Subt :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Subt := Make_Temporary (Loc, 'S', Related_Node => N);
Set_Is_Internal (Subt);
Decl :=
@@ -543,8 +566,8 @@ package body Sem_Util is
and then Is_Constrained (Root_Type (T)))
and then not Has_Unknown_Discriminants (T)
then
- -- If the type of the dereference is already constrained, it
- -- is an actual subtype.
+ -- If the type of the dereference is already constrained, it is an
+ -- actual subtype.
if Is_Array_Type (Etype (N))
and then Is_Constrained (Etype (N))
@@ -624,9 +647,7 @@ package body Sem_Util is
return Empty;
end if;
- Subt :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
+ Subt := Make_Temporary (Loc, 'S');
Set_Is_Internal (Subt);
Decl :=
@@ -666,10 +687,7 @@ package body Sem_Util is
end if;
declare
- Act : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('S'));
-
+ Act : constant Entity_Id := Make_Temporary (Loc, 'S');
Constraints : constant List_Id := New_List;
Decl : Node_Id;
@@ -1151,6 +1169,53 @@ package body Sem_Util is
end if;
end Check_Nested_Access;
+ ----------------------------
+ -- Check_Order_Dependence --
+ ----------------------------
+
+ procedure Check_Order_Dependence is
+ Act1 : Node_Id;
+ Act2 : Node_Id;
+
+ begin
+ -- This could use comments ???
+
+ for J in 0 .. Actuals_In_Call.Last loop
+ if Actuals_In_Call.Table (J).Is_Writable then
+ Act1 := Actuals_In_Call.Table (J).Act;
+
+ if Nkind (Act1) = N_Attribute_Reference then
+ Act1 := Prefix (Act1);
+ end if;
+
+ for K in 0 .. Actuals_In_Call.Last loop
+ if K /= J then
+ Act2 := Actuals_In_Call.Table (K).Act;
+
+ if Nkind (Act2) = N_Attribute_Reference then
+ Act2 := Prefix (Act2);
+ end if;
+
+ if Actuals_In_Call.Table (K).Is_Writable
+ and then K < J
+ then
+ -- Already checked
+
+ null;
+
+ elsif Denotes_Same_Object (Act1, Act2)
+ and then False
+ then
+ Error_Msg_N ("?,mighty suspicious!!!", Act1);
+ end if;
+ end if;
+ end loop;
+ end if;
+ end loop;
+
+ Actuals_In_Call.Set_Last (0);
+ end Check_Order_Dependence;
+
------------------------------------------
-- Check_Potentially_Blocking_Operation --
------------------------------------------
@@ -1677,18 +1742,40 @@ package body Sem_Util is
and then (not Formal_Derived
or else Present (Alias (Id)))
then
- Append_Elmt (Id, Op_List);
+ -- In the special case of an equality operator aliased to
+ -- an overriding dispatching equality belonging to the same
+ -- type, we don't include it in the list of primitives.
+ -- This avoids inheriting multiple equality operators when
+ -- deriving from untagged private types whose full type is
+ -- tagged, which can otherwise cause ambiguities. Note that
+ -- this should only happen for this kind of untagged parent
+ -- type, since normally dispatching operations are inherited
+ -- using the type's Primitive_Operations list.
+
+ if Chars (Id) = Name_Op_Eq
+ and then Is_Dispatching_Operation (Id)
+ and then Present (Alias (Id))
+ and then Is_Overriding_Operation (Alias (Id))
+ and then Base_Type (Etype (First_Entity (Id))) =
+ Base_Type (Etype (First_Entity (Alias (Id))))
+ then
+ null;
+
+ -- Include the subprogram in the list of primitives
+
+ else
+ Append_Elmt (Id, Op_List);
+ end if;
end if;
end if;
Next_Entity (Id);
- -- For a type declared in System, some of its operations
- -- may appear in the target-specific extension to System.
+ -- For a type declared in System, some of its operations may
+ -- appear in the target-specific extension to System.
if No (Id)
- and then Chars (B_Scope) = Name_System
- and then Scope (B_Scope) = Standard_Standard
+ and then B_Scope = RTU_Entity (System)
and then Present_System_Aux
then
B_Scope := System_Aux_Id;
@@ -2080,9 +2167,7 @@ package body Sem_Util is
-- so we can continue semantic analysis
elsif Nam = Error then
- Err :=
- Make_Defining_Identifier (Sloc (N),
- Chars => New_Internal_Name ('T'));
+ Err := Make_Temporary (Sloc (N), 'T');
Set_Defining_Unit_Name (N, Err);
return Err;
@@ -2238,7 +2323,9 @@ package body Sem_Util is
begin
if Is_Entity_Name (A1) then
- if Nkind_In (A2, N_Selected_Component, N_Indexed_Component) then
+ if Nkind_In (A2, N_Selected_Component, N_Indexed_Component)
+ and then not Is_Access_Type (Etype (A1))
+ then
return Denotes_Same_Object (A1, Prefix (A2))
or else Denotes_Same_Prefix (A1, Prefix (A2));
else
@@ -2558,7 +2645,12 @@ package body Sem_Util is
elsif Ekind (Dynamic_Scope) = E_Task_Type then
return Get_Task_Body_Procedure (Dynamic_Scope);
- elsif Convention (Dynamic_Scope) = Convention_Protected then
+ -- No body is generated if the protected operation is eliminated
+
+ elsif Convention (Dynamic_Scope) = Convention_Protected
+ and then not Is_Eliminated (Dynamic_Scope)
+ and then Present (Protected_Body_Subprogram (Dynamic_Scope))
+ then
return Protected_Body_Subprogram (Dynamic_Scope);
else
@@ -2817,9 +2909,7 @@ package body Sem_Util is
-- Avoid cascaded messages with duplicate components in
-- derived types.
- if Ekind (E) = E_Component
- or else Ekind (E) = E_Discriminant
- then
+ if Ekind_In (E, E_Component, E_Discriminant) then
return;
end if;
end if;
@@ -2854,9 +2944,7 @@ package body Sem_Util is
-- midst of inheriting components in a derived record definition.
-- Preserve their Ekind and Etype.
- if Ekind (Def_Id) = E_Discriminant
- or else Ekind (Def_Id) = E_Component
- then
+ if Ekind_In (Def_Id, E_Discriminant, E_Component) then
null;
-- If a type is already set, leave it alone (happens whey a type
@@ -2876,8 +2964,7 @@ package body Sem_Util is
-- Inherited discriminants and components in derived record types are
-- immediately visible. Itypes are not.
- if Ekind (Def_Id) = E_Discriminant
- or else Ekind (Def_Id) = E_Component
+ if Ekind_In (Def_Id, E_Discriminant, E_Component)
or else (No (Corresponding_Remote_Type (Def_Id))
and then not Is_Itype (Def_Id))
then
@@ -3048,6 +3135,38 @@ package body Sem_Util is
Call := Empty;
end Find_Actual;
+ ---------------------------
+ -- Find_Body_Discriminal --
+ ---------------------------
+
+ function Find_Body_Discriminal
+ (Spec_Discriminant : Entity_Id) return Entity_Id
+ is
+ pragma Assert (Is_Concurrent_Record_Type (Scope (Spec_Discriminant)));
+
+ Tsk : constant Entity_Id :=
+ Corresponding_Concurrent_Type (Scope (Spec_Discriminant));
+ Disc : Entity_Id;
+
+ begin
+ -- Find discriminant of original concurrent type, and use its current
+ -- discriminal, which is the renaming within the task/protected body.
+
+ Disc := First_Discriminant (Tsk);
+ while Present (Disc) loop
+ if Chars (Disc) = Chars (Spec_Discriminant) then
+ return Discriminal (Disc);
+ end if;
+
+ Next_Discriminant (Disc);
+ end loop;
+
+ -- That loop should always succeed in finding a matching entry and
+ -- returning. Fatal error if not.
+
+ raise Program_Error;
+ end Find_Body_Discriminal;
+
-------------------------------------
-- Find_Corresponding_Discriminant --
-------------------------------------
@@ -4452,15 +4571,13 @@ package body Sem_Util is
(T : Entity_Id;
Use_Full_View : Boolean := True) return Boolean
is
- Typ : Entity_Id;
+ Typ : Entity_Id := Base_Type (T);
begin
-- Handle concurrent types
- if Is_Concurrent_Type (T) then
- Typ := Corresponding_Record_Type (T);
- else
- Typ := T;
+ if Is_Concurrent_Type (Typ) then
+ Typ := Corresponding_Record_Type (Typ);
end if;
if not Present (Typ)
@@ -4848,10 +4965,8 @@ package body Sem_Util is
-- We are interested only in components and discriminants
- if Ekind (Ent) = E_Component
- or else
- Ekind (Ent) = E_Discriminant
- then
+ if Ekind_In (Ent, E_Component, E_Discriminant) then
+
-- Get default expression if any. If there is no declaration
-- node, it means we have an internal entity. The parent and
-- tag fields are examples of such entities. For these cases,
@@ -5406,15 +5521,6 @@ package body Sem_Util is
begin
Save_Interps (N, New_Prefix);
- -- Check if the node relocation requires readjustment of some SCIL
- -- dispatching node.
-
- if Generate_SCIL
- and then Nkind (N) = N_Function_Call
- then
- Adjust_SCIL_Node (N, New_Prefix);
- end if;
-
Rewrite (N, Make_Explicit_Dereference (Sloc (N), Prefix => New_Prefix));
Set_Etype (N, Designated_Type (Etype (New_Prefix)));
@@ -5700,7 +5806,14 @@ package body Sem_Util is
-- Start of processing for Is_Atomic_Object
begin
- if Is_Atomic (Etype (N))
+ -- Predicate is not relevant to subprograms
+
+ if Is_Entity_Name (N)
+ and then Is_Overloadable (Entity (N))
+ then
+ return False;
+
+ elsif Is_Atomic (Etype (N))
or else (Is_Entity_Name (N) and then Is_Atomic (Entity (N)))
then
return True;
@@ -5797,6 +5910,54 @@ package body Sem_Util is
and then Is_Imported (Entity (Name (N)));
end Is_CPP_Constructor_Call;
+ -----------------
+ -- Is_Delegate --
+ -----------------
+
+ function Is_Delegate (T : Entity_Id) return Boolean is
+ Desig_Type : Entity_Id;
+
+ begin
+ if VM_Target /= CLI_Target then
+ return False;
+ end if;
+
+ -- Access-to-subprograms are delegates in CIL
+
+ if Ekind (T) = E_Access_Subprogram_Type then
+ return True;
+ end if;
+
+ if Ekind (T) not in Access_Kind then
+
+ -- A delegate is a managed pointer. If no designated type is defined
+ -- it means that it's not a delegate.
+
+ return False;
+ end if;
+
+ Desig_Type := Etype (Directly_Designated_Type (T));
+
+ if not Is_Tagged_Type (Desig_Type) then
+ return False;
+ end if;
+
+ -- Test if the type is inherited from [mscorlib]System.Delegate
+
+ while Etype (Desig_Type) /= Desig_Type loop
+ if Chars (Scope (Desig_Type)) /= No_Name
+ and then Is_Imported (Scope (Desig_Type))
+ and then Get_Name_String (Chars (Scope (Desig_Type))) = "delegate"
+ then
+ return True;
+ end if;
+
+ Desig_Type := Etype (Desig_Type);
+ end loop;
+
+ return False;
+ end Is_Delegate;
+
----------------------------------------------
-- Is_Dependent_Component_Of_Mutable_Object --
----------------------------------------------
@@ -6376,10 +6537,7 @@ package body Sem_Util is
Ent : constant Entity_Id := Entity (Expr);
Sub : constant Entity_Id := Enclosing_Subprogram (Ent);
begin
- if Ekind (Ent) /= E_Variable
- and then
- Ekind (Ent) /= E_In_Out_Parameter
- then
+ if not Ekind_In (Ent, E_Variable, E_In_Out_Parameter) then
return False;
else
return Present (Sub) and then Sub = Current_Subprogram;
@@ -7033,6 +7191,15 @@ package body Sem_Util is
return (U /= 0);
end Is_True;
+ -------------------------------
+ -- Is_Universal_Numeric_Type --
+ -------------------------------
+
+ function Is_Universal_Numeric_Type (T : Entity_Id) return Boolean is
+ begin
+ return T = Universal_Integer or else T = Universal_Real;
+ end Is_Universal_Numeric_Type;
+
-------------------
-- Is_Value_Type --
-------------------
@@ -7045,53 +7212,25 @@ package body Sem_Util is
and then Get_Name_String (Chars (T)) = "valuetype";
end Is_Value_Type;
- -----------------
- -- Is_Delegate --
- -----------------
-
- function Is_Delegate (T : Entity_Id) return Boolean is
- Desig_Type : Entity_Id;
+ ---------------------
+ -- Is_VMS_Operator --
+ ---------------------
+ function Is_VMS_Operator (Op : Entity_Id) return Boolean is
begin
- if VM_Target /= CLI_Target then
- return False;
- end if;
-
- -- Access-to-subprograms are delegates in CIL
-
- if Ekind (T) = E_Access_Subprogram_Type then
- return True;
- end if;
-
- if Ekind (T) not in Access_Kind then
-
- -- A delegate is a managed pointer. If no designated type is defined
- -- it means that it's not a delegate.
-
- return False;
- end if;
-
- Desig_Type := Etype (Directly_Designated_Type (T));
-
- if not Is_Tagged_Type (Desig_Type) then
- return False;
- end if;
-
- -- Test if the type is inherited from [mscorlib]System.Delegate
-
- while Etype (Desig_Type) /= Desig_Type loop
- if Chars (Scope (Desig_Type)) /= No_Name
- and then Is_Imported (Scope (Desig_Type))
- and then Get_Name_String (Chars (Scope (Desig_Type))) = "delegate"
- then
- return True;
- end if;
-
- Desig_Type := Etype (Desig_Type);
- end loop;
+ -- The VMS operators are declared in a child of System that is loaded
+ -- through pragma Extend_System. In some rare cases a program is run
+ -- with this extension but without indicating that the target is VMS.
- return False;
- end Is_Delegate;
+ return Ekind (Op) = E_Function
+ and then Is_Intrinsic_Subprogram (Op)
+ and then
+ ((Present_System_Aux
+ and then Scope (Op) = System_Aux_Id)
+ or else
+ (True_VMS_Target
+ and then Scope (Scope (Op)) = RTU_Entity (System)));
+ end Is_VMS_Operator;
-----------------
-- Is_Variable --
@@ -7107,14 +7246,14 @@ package body Sem_Util is
-- expansion.
function In_Protected_Function (E : Entity_Id) return Boolean;
- -- Within a protected function, the private components of the
- -- enclosing protected type are constants. A function nested within
- -- a (protected) procedure is not itself protected.
+ -- Within a protected function, the private components of the enclosing
+ -- protected type are constants. A function nested within a (protected)
+ -- procedure is not itself protected.
function Is_Variable_Prefix (P : Node_Id) return Boolean;
- -- Prefixes can involve implicit dereferences, in which case we
- -- must test for the case of a reference of a constant access
- -- type, which can never be a variable.
+ -- Prefixes can involve implicit dereferences, in which case we must
+ -- test for the case of a reference of a constant access type, which can
+ -- can never be a variable.
---------------------------
-- In_Protected_Function --
@@ -7130,9 +7269,7 @@ package body Sem_Util is
else
S := Current_Scope;
while Present (S) and then S /= Prot loop
- if Ekind (S) = E_Function
- and then Scope (S) = Prot
- then
+ if Ekind (S) = E_Function and then Scope (S) = Prot then
return True;
end if;
@@ -7177,16 +7314,16 @@ package body Sem_Util is
if Nkind (N) in N_Subexpr and then Assignment_OK (N) then
return True;
- -- Normally we go to the original node, but there is one exception
- -- where we use the rewritten node, namely when it is an explicit
- -- dereference. The generated code may rewrite a prefix which is an
- -- access type with an explicit dereference. The dereference is a
- -- variable, even though the original node may not be (since it could
- -- be a constant of the access type).
+ -- Normally we go to the original node, but there is one exception where
+ -- we use the rewritten node, namely when it is an explicit dereference.
+ -- The generated code may rewrite a prefix which is an access type with
+ -- an explicit dereference. The dereference is a variable, even though
+ -- the original node may not be (since it could be a constant of the
+ -- access type).
- -- In Ada 2005 we have a further case to consider: the prefix may be
- -- a function call given in prefix notation. The original node appears
- -- to be a selected component, but we need to examine the call.
+ -- In Ada 2005 we have a further case to consider: the prefix may be a
+ -- function call given in prefix notation. The original node appears to
+ -- be a selected component, but we need to examine the call.
elsif Nkind (N) = N_Explicit_Dereference
and then Nkind (Orig_Node) /= N_Explicit_Dereference
@@ -7805,6 +7942,17 @@ package body Sem_Util is
if Nkind (N) = N_Allocator then
if Is_Dynamic then
Set_Is_Dynamic_Coextension (N);
+
+ -- If the allocator expression is potentially dynamic, it may
+ -- be expanded out of order and require dynamic allocation
+ -- anyway, so we treat the coextension itself as dynamic.
+ -- Potential optimization ???
+
+ elsif Nkind (Expression (N)) = N_Qualified_Expression
+ and then Nkind (Expression (Expression (N))) = N_Op_Concat
+ then
+ Set_Is_Dynamic_Coextension (N);
+
else
Set_Is_Static_Coextension (N);
end if;
@@ -8647,9 +8795,7 @@ package body Sem_Util is
-- If a record subtype is simply copied, the entity list will be
-- shared. Thus cloned_Subtype must be set to indicate the sharing.
- if Ekind (Old_Itype) = E_Record_Subtype
- or else Ekind (Old_Itype) = E_Class_Wide_Subtype
- then
+ if Ekind_In (Old_Itype, E_Record_Subtype, E_Class_Wide_Subtype) then
Set_Cloned_Subtype (New_Itype, Old_Itype);
end if;
@@ -8852,8 +8998,7 @@ package body Sem_Util is
Sloc_Value : Source_Ptr;
Id_Char : Character) return Entity_Id
is
- N : constant Entity_Id :=
- Make_Defining_Identifier (Sloc_Value, New_Internal_Name (Id_Char));
+ N : constant Entity_Id := Make_Temporary (Sloc_Value, Id_Char);
begin
Set_Ekind (N, Kind);
@@ -9468,15 +9613,112 @@ package body Sem_Util is
then
return Object_Access_Level (Expression (Obj));
- -- Function results are objects, so we get either the access level of
- -- the function or, in the case of an indirect call, the level of the
- -- access-to-subprogram type.
-
elsif Nkind (Obj) = N_Function_Call then
- if Is_Entity_Name (Name (Obj)) then
- return Subprogram_Access_Level (Entity (Name (Obj)));
+
+ -- Function results are objects, so we get either the access level of
+ -- the function or, in the case of an indirect call, the level of the
+ -- access-to-subprogram type. (This code is used for Ada 95, but it
+ -- looks wrong, because it seems that we should be checking the level
+ -- of the call itself, even for Ada 95. However, using the Ada 2005
+ -- version of the code causes regressions in several tests that are
+ -- compiled with -gnat95. ???)
+
+ if Ada_Version < Ada_05 then
+ if Is_Entity_Name (Name (Obj)) then
+ return Subprogram_Access_Level (Entity (Name (Obj)));
+ else
+ return Type_Access_Level (Etype (Prefix (Name (Obj))));
+ end if;
+
+ -- For Ada 2005, the level of the result object of a function call is
+ -- defined to be the level of the call's innermost enclosing master.
+ -- We determine that by querying the depth of the innermost enclosing
+ -- dynamic scope.
+
else
- return Type_Access_Level (Etype (Prefix (Name (Obj))));
+ Return_Master_Scope_Depth_Of_Call : declare
+
+ function Innermost_Master_Scope_Depth
+ (N : Node_Id) return Uint;
+ -- Returns the scope depth of the given node's innermost
+ -- enclosing dynamic scope (effectively the accessibility
+ -- level of the innermost enclosing master).
+
+ ----------------------------------
+ -- Innermost_Master_Scope_Depth --
+ ----------------------------------
+
+ function Innermost_Master_Scope_Depth
+ (N : Node_Id) return Uint
+ is
+ Node_Par : Node_Id := Parent (N);
+
+ begin
+ -- Locate the nearest enclosing node (by traversing Parents)
+ -- that Defining_Entity can be applied to, and return the
+ -- depth of that entity's nearest enclosing dynamic scope.
+
+ while Present (Node_Par) loop
+ case Nkind (Node_Par) is
+ when N_Component_Declaration |
+ N_Entry_Declaration |
+ N_Formal_Object_Declaration |
+ N_Formal_Type_Declaration |
+ N_Full_Type_Declaration |
+ N_Incomplete_Type_Declaration |
+ N_Loop_Parameter_Specification |
+ N_Object_Declaration |
+ N_Protected_Type_Declaration |
+ N_Private_Extension_Declaration |
+ N_Private_Type_Declaration |
+ N_Subtype_Declaration |
+ N_Function_Specification |
+ N_Procedure_Specification |
+ N_Task_Type_Declaration |
+ N_Body_Stub |
+ N_Generic_Instantiation |
+ N_Proper_Body |
+ N_Implicit_Label_Declaration |
+ N_Package_Declaration |
+ N_Single_Task_Declaration |
+ N_Subprogram_Declaration |
+ N_Generic_Declaration |
+ N_Renaming_Declaration |
+ N_Block_Statement |
+ N_Formal_Subprogram_Declaration |
+ N_Abstract_Subprogram_Declaration |
+ N_Entry_Body |
+ N_Exception_Declaration |
+ N_Formal_Package_Declaration |
+ N_Number_Declaration |
+ N_Package_Specification |
+ N_Parameter_Specification |
+ N_Single_Protected_Declaration |
+ N_Subunit =>
+
+ return Scope_Depth
+ (Nearest_Dynamic_Scope
+ (Defining_Entity (Node_Par)));
+
+ when others =>
+ null;
+ end case;
+
+ Node_Par := Parent (Node_Par);
+ end loop;
+
+ pragma Assert (False);
+
+ -- Should never reach the following return
+
+ return Scope_Depth (Current_Scope) + 1;
+ end Innermost_Master_Scope_Depth;
+
+ -- Start of processing for Return_Master_Scope_Depth_Of_Call
+
+ begin
+ return Innermost_Master_Scope_Depth (Obj);
+ end Return_Master_Scope_Depth_Of_Call;
end if;
-- For convenience we handle qualified expressions, even though
@@ -10140,12 +10382,7 @@ package body Sem_Util is
while R_Scope /= Standard_Standard loop
exit when R_Scope = E_Scope;
- if Ekind (R_Scope) /= E_Package
- and then
- Ekind (R_Scope) /= E_Block
- and then
- Ekind (R_Scope) /= E_Loop
- then
+ if not Ekind_In (R_Scope, E_Package, E_Block, E_Loop) then
return False;
else
R_Scope := Scope (R_Scope);
@@ -10341,6 +10578,32 @@ package body Sem_Util is
end if;
end Same_Value;
+ -----------------
+ -- Save_Actual --
+ -----------------
+
+ procedure Save_Actual (N : Node_Id; Writable : Boolean := False) is
+ begin
+ if Is_Entity_Name (N)
+ or else
+ Nkind_In (N, N_Indexed_Component, N_Selected_Component, N_Slice)
+ or else
+ (Nkind (N) = N_Attribute_Reference
+ and then Attribute_Name (N) = Name_Access)
+
+ then
+ -- We are only interested in IN OUT parameters of inner calls
+
+ if not Writable
+ or else Nkind (Parent (N)) = N_Function_Call
+ or else Nkind (Parent (N)) in N_Op
+ then
+ Actuals_In_Call.Increment_Last;
+ Actuals_In_Call.Table (Actuals_In_Call.Last) := (N, Writable);
+ end if;
+ end if;
+ end Save_Actual;
+
------------------------
-- Scope_Is_Transient --
------------------------
@@ -10489,6 +10752,9 @@ package body Sem_Util is
end loop;
end;
+ -- For a class wide subtype, we also need debug information
+ -- for the equivalent type.
+
if Ekind (T) = E_Class_Wide_Subtype then
Set_Debug_Info_Needed_If_Not_Set (Equivalent_Type (T));
end if;
@@ -10964,22 +11230,6 @@ package body Sem_Util is
return Scope_Depth (Enclosing_Dynamic_Scope (Btyp));
end Type_Access_Level;
- --------------------
- -- Ultimate_Alias --
- --------------------
- -- To do: add occurrences calling this new subprogram
-
- function Ultimate_Alias (Prim : Entity_Id) return Entity_Id is
- E : Entity_Id := Prim;
-
- begin
- while Present (Alias (E)) loop
- E := Alias (E);
- end loop;
-
- return E;
- end Ultimate_Alias;
-
--------------------------
-- Unit_Declaration_Node --
--------------------------
@@ -11218,8 +11468,10 @@ package body Sem_Util is
and then Covers
(Designated_Type (Expec_Type), Designated_Type (Found_Type))
then
- Error_Msg_N ("result must be general access type!", Expr);
- Error_Msg_NE ("add ALL to }!", Expr, Expec_Type);
+ Error_Msg_N -- CODEFIX
+ ("result must be general access type!", Expr);
+ Error_Msg_NE -- CODEFIX
+ ("add ALL to }!", Expr, Expec_Type);
-- Another special check, if the expected type is an integer type,
-- but the expression is of type System.Address, and the parent is
@@ -11266,7 +11518,8 @@ package body Sem_Util is
if From_With_Type (Found_Type) then
Error_Msg_NE ("\\found incomplete}!", Expr, Found_Type);
Error_Msg_Qual_Level := 99;
- Error_Msg_NE ("\\missing `WITH &;", Expr, Scope (Found_Type));
+ Error_Msg_NE -- CODEFIX
+ ("\\missing `WITH &;", Expr, Scope (Found_Type));
Error_Msg_Qual_Level := 0;
else
Error_Msg_NE ("found}!", Expr, Found_Type);
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index ed36cf8f3d7..54878f326a1 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -132,15 +132,20 @@ package Sem_Util is
-- Check wrong use of dynamically tagged expression
procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id);
- -- Verify that the full declaration of type T has been seen. If not,
- -- place error message on node N. Used in object declarations, type
- -- conversions, qualified expressions.
+ -- Verify that the full declaration of type T has been seen. If not, place
+ -- error message on node N. Used in object declarations, type conversions
+ -- and qualified expressions.
procedure Check_Nested_Access (Ent : Entity_Id);
-- Check whether Ent denotes an entity declared in an uplevel scope, which
-- is accessed inside a nested procedure, and set Has_Up_Level_Access flag
-- accordingly. This is currently only enabled for VM_Target /= No_VM.
+ procedure Check_Order_Dependence;
+ -- Examine the actuals in a top-level call to determine whether aliasing
+ -- between two actuals, one of which is writable, can make the call
+ -- order-dependent.
+
procedure Check_Potentially_Blocking_Operation (N : Node_Id);
-- N is one of the statement forms that is a potentially blocking
-- operation. If it appears within a protected action, emit warning.
@@ -153,10 +158,10 @@ package Sem_Util is
-- a possible unlocked access to data.
procedure Check_VMS (Construct : Node_Id);
- -- Check that this the target is OpenVMS, and if so, return with
- -- no effect, otherwise post an error noting this can only be used
- -- with OpenVMS ports. The argument is the construct in question
- -- and is used to post the error message.
+ -- Check that this the target is OpenVMS, and if so, return with no effect,
+ -- otherwise post an error noting this can only be used with OpenVMS ports.
+ -- The argument is the construct in question and is used to post the error
+ -- message.
procedure Collect_Interfaces
(T : Entity_Id;
@@ -187,10 +192,10 @@ package Sem_Util is
-- information on the same interface type.
function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id;
- -- Called upon type derivation and extension. We scan the declarative
- -- part in which the type appears, and collect subprograms that have
- -- one subsidiary subtype of the type. These subprograms can only
- -- appear after the type itself.
+ -- Called upon type derivation and extension. We scan the declarative part
+ -- in which the type appears, and collect subprograms that have one
+ -- subsidiary subtype of the type. These subprograms can only appear after
+ -- the type itself.
function Compile_Time_Constraint_Error
(N : Node_Id;
@@ -202,12 +207,11 @@ package Sem_Util is
-- generates a warning (or error) message in the same manner, but it does
-- not replace any nodes. For convenience, the function always returns its
-- first argument. The message is a warning if the message ends with ?, or
- -- we are operating in Ada 83 mode, or if the Warn parameter is set to
- -- True.
+ -- we are operating in Ada 83 mode, or the Warn parameter is set to True.
procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id);
- -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag
- -- of Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false);
+ -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag of
+ -- Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false).
function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id;
-- Utility to create a parameter profile for a new subprogram spec, when
@@ -216,6 +220,7 @@ package Sem_Util is
-- for stubbed subprograms.
function Current_Entity (N : Node_Id) return Entity_Id;
+ pragma Inline (Current_Entity);
-- Find the currently visible definition for a given identifier, that is to
-- say the first entry in the visibility chain for the Chars of N.
@@ -235,21 +240,20 @@ package Sem_Util is
-- from a library package which is not within any subprogram.
function Defining_Entity (N : Node_Id) return Entity_Id;
- -- Given a declaration N, returns the associated defining entity. If
- -- the declaration has a specification, the entity is obtained from
- -- the specification. If the declaration has a defining unit name,
- -- then the defining entity is obtained from the defining unit name
- -- ignoring any child unit prefixes.
+ -- Given a declaration N, returns the associated defining entity. If the
+ -- declaration has a specification, the entity is obtained from the
+ -- specification. If the declaration has a defining unit name, then the
+ -- defining entity is obtained from the defining unit name ignoring any
+ -- child unit prefixes.
function Denotes_Discriminant
(N : Node_Id;
Check_Concurrent : Boolean := False) return Boolean;
- -- Returns True if node N is an Entity_Name node for a discriminant.
- -- If the flag Check_Concurrent is true, function also returns true
- -- when N denotes the discriminal of the discriminant of a concurrent
- -- type. This is necessary to disable some optimizations on private
- -- components of protected types, and constraint checks on entry
- -- families constrained by discriminants.
+ -- Returns True if node N is an Entity_Name node for a discriminant. If the
+ -- flag Check_Concurrent is true, function also returns true when N denotes
+ -- the discriminal of the discriminant of a concurrent type. This is needed
+ -- to disable some optimizations on private components of protected types,
+ -- and constraint checks on entry families constrained by discriminants.
function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean;
function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean;
@@ -271,49 +275,48 @@ package Sem_Util is
function Designate_Same_Unit
(Name1 : Node_Id;
Name2 : Node_Id) return Boolean;
- -- Return true if Name1 and Name2 designate the same unit name;
- -- each of these names is supposed to be a selected component name,
- -- an expanded name, a defining program unit name or an identifier
+ -- Return true if Name1 and Name2 designate the same unit name; each of
+ -- these names is supposed to be a selected component name, an expanded
+ -- name, a defining program unit name or an identifier.
function Enclosing_Generic_Body
(N : Node_Id) return Node_Id;
- -- Returns the Node_Id associated with the innermost enclosing
- -- generic body, if any. If none, then returns Empty.
+ -- Returns the Node_Id associated with the innermost enclosing generic
+ -- body, if any. If none, then returns Empty.
function Enclosing_Generic_Unit
(N : Node_Id) return Node_Id;
- -- Returns the Node_Id associated with the innermost enclosing
- -- generic unit, if any. If none, then returns Empty.
+ -- Returns the Node_Id associated with the innermost enclosing generic
+ -- unit, if any. If none, then returns Empty.
function Enclosing_Lib_Unit_Entity return Entity_Id;
-- Returns the entity of enclosing N_Compilation_Unit Node which is the
- -- root of the current scope (which must not be Standard_Standard, and
- -- the caller is responsible for ensuring this condition).
+ -- root of the current scope (which must not be Standard_Standard, and the
+ -- caller is responsible for ensuring this condition).
function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id;
- -- Returns the enclosing N_Compilation_Unit Node that is the root
- -- of a subtree containing N.
+ -- Returns the enclosing N_Compilation_Unit Node that is the root of a
+ -- subtree containing N.
function Enclosing_Subprogram (E : Entity_Id) return Entity_Id;
-- Utility function to return the Ada entity of the subprogram enclosing
-- the entity E, if any. Returns Empty if no enclosing subprogram.
procedure Ensure_Freeze_Node (E : Entity_Id);
- -- Make sure a freeze node is allocated for entity E. If necessary,
- -- build and initialize a new freeze node and set Has_Delayed_Freeze
- -- true for entity E.
+ -- Make sure a freeze node is allocated for entity E. If necessary, build
+ -- and initialize a new freeze node and set Has_Delayed_Freeze True for E.
procedure Enter_Name (Def_Id : Entity_Id);
-- Insert new name in symbol table of current scope with check for
- -- duplications (error message is issued if a conflict is found)
- -- Note: Enter_Name is not used for overloadable entities, instead
- -- these are entered using Sem_Ch6.Enter_Overloadable_Entity.
+ -- duplications (error message is issued if a conflict is found).
+ -- Note: Enter_Name is not used for overloadable entities, instead these
+ -- are entered using Sem_Ch6.Enter_Overloadable_Entity.
procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id);
- -- This procedure is called after issuing a message complaining
- -- about an inappropriate use of limited type T. If useful, it
- -- adds additional continuation lines to the message explaining
- -- why type T is limited. Messages are placed at node N.
+ -- This procedure is called after issuing a message complaining about an
+ -- inappropriate use of limited type T. If useful, it adds additional
+ -- continuation lines to the message explaining why type T is limited.
+ -- Messages are placed at node N.
procedure Find_Actual
(N : Node_Id;
@@ -329,11 +332,11 @@ package Sem_Util is
function Find_Corresponding_Discriminant
(Id : Node_Id;
Typ : Entity_Id) return Entity_Id;
- -- Because discriminants may have different names in a generic unit
- -- and in an instance, they are resolved positionally when possible.
- -- A reference to a discriminant carries the discriminant that it
- -- denotes when analyzed. Subsequent uses of this id on a different
- -- type denote the discriminant at the same position in this new type.
+ -- Because discriminants may have different names in a generic unit and in
+ -- an instance, they are resolved positionally when possible. A reference
+ -- to a discriminant carries the discriminant that it denotes when it is
+ -- analyzed. Subsequent uses of this id on a different type denotes the
+ -- discriminant at the same position in this new type.
procedure Find_Overlaid_Entity
(N : Node_Id;
@@ -355,6 +358,12 @@ package Sem_Util is
-- Determine the alternative chosen, so that the code of non-selected
-- alternatives, and the warnings that may apply to them, are removed.
+ function Find_Body_Discriminal
+ (Spec_Discriminant : Entity_Id) return Entity_Id;
+ -- Given a discriminant of the record type that implements a task or
+ -- protected type, return the discriminal of the corresponding discriminant
+ -- of the actual concurrent type.
+
function First_Actual (Node : Node_Id) return Node_Id;
-- Node is an N_Function_Call or N_Procedure_Call_Statement node. The
-- result returned is the first actual parameter in declaration order
@@ -364,7 +373,7 @@ package Sem_Util is
-- iterating through the actuals in declaration order is to use this
-- function to find the first actual, and then use Next_Actual to obtain
-- the next actual in declaration order. Note that the value returned
- -- is always the expression (not the N_Parameter_Association nodes
+ -- is always the expression (not the N_Parameter_Association nodes,
-- even if named association is used).
function Full_Qualified_Name (E : Entity_Id) return String_Id;
@@ -409,15 +418,15 @@ package Sem_Util is
function Get_Actual_Subtype (N : Node_Id) return Entity_Id;
-- Given a node for an expression, obtain the actual subtype of the
-- expression. In the case of a parameter where the formal is an
- -- unconstrained array or discriminated type, this will be the
- -- previously constructed subtype of the actual. Note that this is
- -- not quite the "Actual Subtype" of the RM, since it is always
- -- a constrained type, i.e. it is the subtype of the value of the
- -- actual. The actual subtype is also returned in other cases where
- -- it has already been constructed for an object. Otherwise the
- -- expression type is returned unchanged, except for the case of an
- -- unconstrained array type, where an actual subtype is created, using
- -- Insert_Actions if necessary to insert any associated actions.
+ -- unconstrained array or discriminated type, this will be the previously
+ -- constructed subtype of the actual. Note that this is not quite the
+ -- "Actual Subtype" of the RM, since it is always a constrained type, i.e.
+ -- it is the subtype of the value of the actual. The actual subtype is also
+ -- returned in other cases where it has already been constructed for an
+ -- object. Otherwise the expression type is returned unchanged, except for
+ -- the case of an unconstrained array type, where an actual subtype is
+ -- created, using Insert_Actions if necessary to insert any associated
+ -- actions.
function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id;
-- This is like Get_Actual_Subtype, except that it never constructs an
@@ -427,41 +436,40 @@ package Sem_Util is
function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id;
-- This is used to construct the string literal node representing a
- -- default external name, i.e. one that is constructed from the name
- -- of an entity, or (in the case of extended DEC import/export pragmas,
- -- an identifier provided as the external name. Letters in the name are
+ -- default external name, i.e. one that is constructed from the name of an
+ -- entity, or (in the case of extended DEC import/export pragmas, an
+ -- identifier provided as the external name. Letters in the name are
-- according to the setting of Opt.External_Name_Default_Casing.
function Get_Generic_Entity (N : Node_Id) return Entity_Id;
- -- Returns the true generic entity in an instantiation. If the name in
- -- the instantiation is a renaming, the function returns the renamed
- -- generic.
+ -- Returns the true generic entity in an instantiation. If the name in the
+ -- instantiation is a renaming, the function returns the renamed generic.
procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id);
- -- This procedure assigns to L and H respectively the values of the
- -- low and high bounds of node N, which must be a range, subtype
- -- indication, or the name of a scalar subtype. The result in L, H
- -- may be set to Error if there was an earlier error in the range.
+ -- This procedure assigns to L and H respectively the values of the low and
+ -- high bounds of node N, which must be a range, subtype indication, or the
+ -- name of a scalar subtype. The result in L, H may be set to Error if
+ -- there was an earlier error in the range.
function Get_Enum_Lit_From_Pos
(T : Entity_Id;
Pos : Uint;
Loc : Source_Ptr) return Entity_Id;
- -- This function obtains the E_Enumeration_Literal entity for the
- -- specified value from the enumeration type or subtype T. The
- -- second argument is the Pos value, which is assumed to be in range.
- -- The third argument supplies a source location for constructed
- -- nodes returned by this function.
+ -- This function obtains the E_Enumeration_Literal entity for the specified
+ -- value from the enumeration type or subtype T. The second argument is the
+ -- Pos value, which is assumed to be in range. The third argument supplies
+ -- a source location for constructed nodes returned by this function.
procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id);
-- Retrieve the fully expanded name of the library unit declared by
-- Decl_Node into the name buffer.
function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id;
+ pragma Inline (Get_Name_Entity_Id);
-- An entity value is associated with each name in the name table. The
- -- Get_Name_Entity_Id function fetches the Entity_Id of this entity,
- -- which is the innermost visible entity with the given name. See the
- -- body of Sem_Ch8 for further details on handling of entity visibility.
+ -- Get_Name_Entity_Id function fetches the Entity_Id of this entity, which
+ -- is the innermost visible entity with the given name. See the body of
+ -- Sem_Ch8 for further details on handling of entity visibility.
function Get_Pragma_Id (N : Node_Id) return Pragma_Id;
pragma Inline (Get_Pragma_Id);
@@ -479,22 +487,20 @@ package Sem_Util is
-- with any other kind of entity.
function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id;
- -- Nod is either a procedure call statement, or a function call, or
- -- an accept statement node. This procedure finds the Entity_Id of the
- -- related subprogram or entry and returns it, or if no subprogram can
- -- be found, returns Empty.
+ -- Nod is either a procedure call statement, or a function call, or an
+ -- accept statement node. This procedure finds the Entity_Id of the related
+ -- subprogram or entry and returns it, or if no subprogram can be found,
+ -- returns Empty.
function Get_Subprogram_Body (E : Entity_Id) return Node_Id;
- -- Given the entity for a subprogram (E_Function or E_Procedure),
- -- return the corresponding N_Subprogram_Body node. If the corresponding
- -- body of the declaration is missing (as for an imported subprogram)
- -- return Empty.
+ -- Given the entity for a subprogram (E_Function or E_Procedure), return
+ -- the corresponding N_Subprogram_Body node. If the corresponding body
+ -- is missing (as for an imported subprogram), return Empty.
function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id;
pragma Inline (Get_Task_Body_Procedure);
-- Given an entity for a task type or subtype, retrieves the
- -- Task_Body_Procedure field from the corresponding task type
- -- declaration.
+ -- Task_Body_Procedure field from the corresponding task type declaration.
function Has_Access_Values (T : Entity_Id) return Boolean;
-- Returns true if type or subtype T is an access type, or has a component
@@ -524,18 +530,18 @@ package Sem_Util is
--
-- Note: Known_Incompatible does not mean that at run time the alignment
-- of Expr is known to be wrong for Obj, just that it can be determined
- -- that alignments have been explicitly or implicitly specified which
- -- are incompatible (whereas Unknown means that even this is not known).
- -- The appropriate reaction of a caller to Known_Incompatible is to treat
- -- it as Unknown, but issue a warning that there may be an alignment error.
+ -- that alignments have been explicitly or implicitly specified which are
+ -- incompatible (whereas Unknown means that even this is not known). The
+ -- appropriate reaction of a caller to Known_Incompatible is to treat it as
+ -- Unknown, but issue a warning that there may be an alignment error.
function Has_Declarations (N : Node_Id) return Boolean;
-- Determines if the node can have declarations
function Has_Discriminant_Dependent_Constraint
(Comp : Entity_Id) return Boolean;
- -- Returns True if and only if Comp has a constrained subtype
- -- that depends on a discriminant.
+ -- Returns True if and only if Comp has a constrained subtype that depends
+ -- on a discriminant.
function Has_Infinities (E : Entity_Id) return Boolean;
-- Determines if the range of the floating-point type E includes
@@ -565,18 +571,18 @@ package Sem_Util is
-- yet received a full declaration.
function Has_Stream (T : Entity_Id) return Boolean;
- -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or
- -- in the case of a composite type, has a component for which this
- -- predicate is True, and if so returns True. Otherwise a result of
- -- False means that there is no Stream type in sight. For a private
- -- type, the test is applied to the underlying type (or returns False
- -- if there is no underlying type).
+ -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or in the
+ -- case of a composite type, has a component for which this predicate is
+ -- True, and if so returns True. Otherwise a result of False means that
+ -- there is no Stream type in sight. For a private type, the test is
+ -- applied to the underlying type (or returns False if there is no
+ -- underlying type).
function Has_Tagged_Component (Typ : Entity_Id) return Boolean;
-- Returns True if Typ is a composite type (array or record) which is
-- either itself a tagged type, or has a component (recursively) which is
-- a tagged type. Returns False for non-composite type, or if no tagged
- -- component is present. This function is used to check if '=' has to be
+ -- component is present. This function is used to check if "=" has to be
-- expanded into a bunch component comparisons.
function Implements_Interface
@@ -607,11 +613,11 @@ package Sem_Util is
-- Returns True if node N belongs to a parameter specification
function In_Subprogram_Or_Concurrent_Unit return Boolean;
- -- Determines if the current scope is within a subprogram compilation
- -- unit (inside a subprogram declaration, subprogram body, or generic
- -- subprogram declaration) or within a task or protected body. The test
- -- is for appearing anywhere within such a construct (that is it does not
- -- need to be directly within).
+ -- Determines if the current scope is within a subprogram compilation unit
+ -- (inside a subprogram declaration, subprogram body, or generic
+ -- subprogram declaration) or within a task or protected body. The test is
+ -- for appearing anywhere within such a construct (that is it does not need
+ -- to be directly within).
function In_Visible_Part (Scope_Id : Entity_Id) return Boolean;
-- Determine whether a declaration occurs within the visible part of a
@@ -643,8 +649,8 @@ package Sem_Util is
-- Determines if N is an actual parameter in a subprogram call
function Is_Aliased_View (Obj : Node_Id) return Boolean;
- -- Determine if Obj is an aliased view, i.e. the name of an
- -- object to which 'Access or 'Unchecked_Access can apply.
+ -- Determine if Obj is an aliased view, i.e. the name of an object to which
+ -- 'Access or 'Unchecked_Access can apply.
function Is_Ancestor_Package
(E1 : Entity_Id;
@@ -652,8 +658,8 @@ package Sem_Util is
-- Determine whether package E1 is an ancestor of E2
function Is_Atomic_Object (N : Node_Id) return Boolean;
- -- Determines if the given node denotes an atomic object in the sense
- -- of the legality checks described in RM C.6(12).
+ -- Determines if the given node denotes an atomic object in the sense of
+ -- the legality checks described in RM C.6(12).
function Is_Coextension_Root (N : Node_Id) return Boolean;
-- Determine whether node N is an allocator which acts as a coextension
@@ -690,9 +696,10 @@ package Sem_Util is
-- it is of protected, synchronized or task kind.
function Is_False (U : Uint) return Boolean;
- -- The argument is a Uint value which is the Boolean'Pos value of a
- -- Boolean operand (i.e. is either 0 for False, or 1 for True). This
- -- function simply tests if it is False (i.e. zero)
+ pragma Inline (Is_False);
+ -- The argument is a Uint value which is the Boolean'Pos value of a Boolean
+ -- operand (i.e. is either 0 for False, or 1 for True). This function tests
+ -- if it is False (i.e. zero).
function Is_Fixed_Model_Number (U : Ureal; T : Entity_Id) return Boolean;
-- Returns True iff the number U is a model number of the fixed-
@@ -712,7 +719,7 @@ package Sem_Util is
-- by a derived type declarations.
function Is_LHS (N : Node_Id) return Boolean;
- -- Returns True iff N is used as Name in an assignment statement.
+ -- Returns True iff N is used as Name in an assignment statement
function Is_Library_Level_Entity (E : Entity_Id) return Boolean;
-- A library-level declaration is one that is accessible from Standard,
@@ -728,11 +735,11 @@ package Sem_Util is
-- variable and constant objects return True (compare Is_Variable).
function Is_OK_Variable_For_Out_Formal (AV : Node_Id) return Boolean;
- -- Used to test if AV is an acceptable formal for an OUT or IN OUT
- -- formal. Note that the Is_Variable function is not quite the right
- -- test because this is a case in which conversions whose expression
- -- is a variable (in the Is_Variable sense) with a non-tagged type
- -- target are considered view conversions and hence variables.
+ -- Used to test if AV is an acceptable formal for an OUT or IN OUT formal.
+ -- Note that the Is_Variable function is not quite the right test because
+ -- this is a case in which conversions whose expression is a variable (in
+ -- the Is_Variable sense) with a non-tagged type target are considered view
+ -- conversions and hence variables.
function Is_Partially_Initialized_Type (Typ : Entity_Id) return Boolean;
-- Typ is a type entity. This function returns true if this type is partly
@@ -776,6 +783,7 @@ package Sem_Util is
-- normally such nodes represent a direct name.
function Is_Statement (N : Node_Id) return Boolean;
+ pragma Inline (Is_Statement);
-- Check if the node N is a statement node. Note that this includes
-- the case of procedure call statements (unlike the direct use of
-- the N_Statement_Other_Than_Procedure_Call subtype from Sinfo).
@@ -785,14 +793,19 @@ package Sem_Util is
-- Returns True if E is a synchronized tagged type (AARM 3.9.4 (6/2))
function Is_Transfer (N : Node_Id) return Boolean;
- -- Returns True if the node N is a statement which is known to cause
- -- an unconditional transfer of control at runtime, i.e. the following
+ -- Returns True if the node N is a statement which is known to cause an
+ -- unconditional transfer of control at runtime, i.e. the following
-- statement definitely will not be executed.
function Is_True (U : Uint) return Boolean;
- -- The argument is a Uint value which is the Boolean'Pos value of a
- -- Boolean operand (i.e. is either 0 for False, or 1 for True). This
- -- function simply tests if it is True (i.e. non-zero)
+ pragma Inline (Is_True);
+ -- The argument is a Uint value which is the Boolean'Pos value of a Boolean
+ -- operand (i.e. is either 0 for False, or 1 for True). This function tests
+ -- if it is True (i.e. non-zero).
+
+ function Is_Universal_Numeric_Type (T : Entity_Id) return Boolean;
+ pragma Inline (Is_Universal_Numeric_Type);
+ -- True if T is Universal_Integer or Universal_Real
function Is_Value_Type (T : Entity_Id) return Boolean;
-- Returns true if type T represents a value type. This is only relevant to
@@ -800,6 +813,10 @@ package Sem_Util is
-- object that is accessed directly, as opposed to the other CIL objects
-- that are accessed through managed pointers.
+ function Is_VMS_Operator (Op : Entity_Id) return Boolean;
+ -- Determine whether an operator is one of the intrinsics defined
+ -- in the DEC system extension.
+
function Is_Delegate (T : Entity_Id) return Boolean;
-- Returns true if type T represents a delegate. A Delegate is the CIL
-- object used to represent access-to-subprogram types. This is only
@@ -990,7 +1007,8 @@ package Sem_Util is
procedure Next_Actual (Actual_Id : in out Node_Id);
pragma Inline (Next_Actual);
- -- Next_Actual (N) is equivalent to N := Next_Actual (N)
+ -- Next_Actual (N) is equivalent to N := Next_Actual (N). Note that we
+ -- inline this procedural form, but not the functional form that follows.
function Next_Actual (Actual_Id : Node_Id) return Node_Id;
-- Find next actual parameter in declaration order. As described for
@@ -1148,6 +1166,11 @@ package Sem_Util is
-- are only partially ordered, so Scope_Within_Or_Same (A,B) and
-- Scope_Within_Or_Same (B,A) can both be False for a given pair A,B.
+ procedure Save_Actual (N : Node_Id; Writable : Boolean := False);
+ -- Enter an actual in a call in a table global, for subsequent check of
+ -- possible order dependence in the presence of IN OUT parameters for
+ -- functions in Ada 2012 (or access parameters in older language versions).
+
function Scope_Within (Scope1, Scope2 : Entity_Id) return Boolean;
-- Like Scope_Within_Or_Same, except that this function returns
-- False in the case where Scope1 and Scope2 are the same scope.
@@ -1158,6 +1181,7 @@ package Sem_Util is
-- foreign convention, then we set Can_Use_Internal_Rep to False on E.
procedure Set_Current_Entity (E : Entity_Id);
+ pragma Inline (Set_Current_Entity);
-- Establish the entity E as the currently visible definition of its
-- associated name (i.e. the Node_Id associated with its name)
@@ -1175,6 +1199,7 @@ package Sem_Util is
-- can check identifier spelling style.
procedure Set_Name_Entity_Id (Id : Name_Id; Val : Entity_Id);
+ pragma Inline (Set_Name_Entity_Id);
-- Sets the Entity_Id value associated with the given name, which is the
-- Id of the innermost visible entity with the given name. See the body
-- of package Sem_Ch8 for further details on the handling of visibility.
@@ -1205,6 +1230,7 @@ package Sem_Util is
-- Set the flag Is_Transient of the current scope
procedure Set_Size_Info (T1, T2 : Entity_Id);
+ pragma Inline (Set_Size_Info);
-- Copies the Esize field and Has_Biased_Representation flag from sub(type)
-- entity T2 to (sub)type entity T1. Also copies the Is_Unsigned_Type flag
-- in the fixed-point and discrete cases, and also copies the alignment
@@ -1237,10 +1263,6 @@ package Sem_Util is
function Type_Access_Level (Typ : Entity_Id) return Uint;
-- Return the accessibility level of Typ
- function Ultimate_Alias (Prim : Entity_Id) return Entity_Id;
- -- Return the last entity in the chain of aliased entities of Prim.
- -- If Prim has no alias return Prim.
-
function Unit_Declaration_Node (Unit_Id : Entity_Id) return Node_Id;
-- Unit_Id is the simple name of a program unit, this function returns the
-- corresponding xxx_Declaration node for the entity. Also applies to the
@@ -1249,31 +1271,21 @@ package Sem_Util is
-- may be a child unit with any number of ancestors.
function Universal_Interpretation (Opnd : Node_Id) return Entity_Id;
- -- Yields universal_Integer or Universal_Real if this is a candidate
+ -- Yields Universal_Integer or Universal_Real if this is a candidate
function Unqualify (Expr : Node_Id) return Node_Id;
- -- Removes any qualifications from Expr. For example, for T1'(T2'(X)),
- -- this returns X. If Expr is not a qualified expression, returns Expr.
+ pragma Inline (Unqualify);
+ -- Removes any qualifications from Expr. For example, for T1'(T2'(X)), this
+ -- returns X. If Expr is not a qualified expression, returns Expr.
function Within_Init_Proc return Boolean;
-- Determines if Current_Scope is within an init proc
procedure Wrong_Type (Expr : Node_Id; Expected_Type : Entity_Id);
- -- Output error message for incorrectly typed expression. Expr is the
- -- node for the incorrectly typed construct (Etype (Expr) is the type
- -- found), and Expected_Type is the entity for the expected type. Note
- -- that Expr does not have to be a subexpression, anything with an
- -- Etype field may be used.
-
-private
- pragma Inline (Current_Entity);
- pragma Inline (Get_Name_Entity_Id);
- pragma Inline (Is_False);
- pragma Inline (Is_Statement);
- pragma Inline (Is_True);
- pragma Inline (Set_Current_Entity);
- pragma Inline (Set_Name_Entity_Id);
- pragma Inline (Set_Size_Info);
- pragma Inline (Unqualify);
+ -- Output error message for incorrectly typed expression. Expr is the node
+ -- for the incorrectly typed construct (Etype (Expr) is the type found),
+ -- and Expected_Type is the entity for the expected type. Note that Expr
+ -- does not have to be a subexpression, anything with an Etype field may
+ -- be used.
end Sem_Util;
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 580ba9aedc0..7f18a75e71e 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2010, 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- --
@@ -234,10 +234,11 @@ package body Sem_Warn is
-- within the body of the loop.
procedure Check_Infinite_Loop_Warning (Loop_Statement : Node_Id) is
- Iter : constant Node_Id := Iteration_Scheme (Loop_Statement);
+ Expression : Node_Id := Empty;
+ -- Set to WHILE or EXIT WHEN condition to be tested
Ref : Node_Id := Empty;
- -- Reference in iteration scheme to variable that might not be modified
+ -- Reference in Expression to variable that might not be modified
-- in loop, indicating a possible infinite loop.
Var : Entity_Id := Empty;
@@ -267,9 +268,9 @@ package body Sem_Warn is
function Test_Ref (N : Node_Id) return Traverse_Result;
-- Test for reference to variable in question. Returns Abandon if
- -- matching reference found.
+ -- matching reference found. Used in instantiation of No_Ref_Found.
- function Find_Ref is new Traverse_Func (Test_Ref);
+ function No_Ref_Found is new Traverse_Func (Test_Ref);
-- Function to traverse body of procedure. Returns Abandon if matching
-- reference found.
@@ -465,9 +466,9 @@ package body Sem_Warn is
function Test_Ref (N : Node_Id) return Traverse_Result is
begin
- -- Waste of time to look at iteration scheme
+ -- Waste of time to look at the expression we are testing
- if N = Iter then
+ if N = Expression then
return Skip;
-- Direct reference to variable in question
@@ -537,6 +538,29 @@ package body Sem_Warn is
then
return Abandon;
end if;
+
+ -- If any of the arguments are of type access to subprogram, then
+ -- we may have funny side effects, so no warning in this case.
+
+ declare
+ Actual : Node_Id;
+ begin
+ Actual := First_Actual (N);
+ while Present (Actual) loop
+ if Is_Access_Subprogram_Type (Etype (Actual)) then
+ return Abandon;
+ else
+ Next_Actual (Actual);
+ end if;
+ end loop;
+ end;
+
+ -- Declaration of the variable in question
+
+ elsif Nkind (N) = N_Object_Declaration
+ and then Defining_Identifier (N) = Var
+ then
+ return Abandon;
end if;
-- All OK, continue scan
@@ -547,20 +571,96 @@ package body Sem_Warn is
-- Start of processing for Check_Infinite_Loop_Warning
begin
- -- We need a while iteration with no condition actions. Condition
- -- actions just make things too complicated to get the warning right.
+ -- Skip processing if debug flag gnatd.w is set
- if No (Iter)
- or else No (Condition (Iter))
- or else Present (Condition_Actions (Iter))
- or else Debug_Flag_Dot_W
- then
+ if Debug_Flag_Dot_W then
+ return;
+ end if;
+
+ -- Deal with Iteration scheme present
+
+ declare
+ Iter : constant Node_Id := Iteration_Scheme (Loop_Statement);
+
+ begin
+ if Present (Iter) then
+
+ -- While iteration
+
+ if Present (Condition (Iter)) then
+
+ -- Skip processing for while iteration with conditions actions,
+ -- since they make it too complicated to get the warning right.
+
+ if Present (Condition_Actions (Iter)) then
+ return;
+ end if;
+
+ -- Capture WHILE condition
+
+ Expression := Condition (Iter);
+
+ -- For iteration, do not process, since loop will always terminate
+
+ elsif Present (Loop_Parameter_Specification (Iter)) then
+ return;
+ end if;
+ end if;
+ end;
+
+ -- Check chain of EXIT statements, we only process loops that have a
+ -- single exit condition (either a single EXIT WHEN statement, or a
+ -- WHILE loop not containing any EXIT WHEN statements).
+
+ declare
+ Ident : constant Node_Id := Identifier (Loop_Statement);
+ Exit_Stmt : Node_Id;
+
+ begin
+ -- If we don't have a proper chain set, ignore call entirely. This
+ -- happens because of previous errors.
+
+ if No (Entity (Ident))
+ or else Ekind (Entity (Ident)) /= E_Loop
+ then
+ return;
+ end if;
+
+ -- Otherwise prepare to scan list of EXIT statements
+
+ Exit_Stmt := First_Exit_Statement (Entity (Ident));
+ while Present (Exit_Stmt) loop
+
+ -- Check for EXIT WHEN
+
+ if Present (Condition (Exit_Stmt)) then
+
+ -- Quit processing if EXIT WHEN in WHILE loop, or more than
+ -- one EXIT WHEN statement present in the loop.
+
+ if Present (Expression) then
+ return;
+
+ -- Otherwise capture condition from EXIT WHEN statement
+
+ else
+ Expression := Condition (Exit_Stmt);
+ end if;
+ end if;
+
+ Exit_Stmt := Next_Exit_Statement (Exit_Stmt);
+ end loop;
+ end;
+
+ -- Return if no condition to test
+
+ if No (Expression) then
return;
end if;
-- Initial conditions met, see if condition is of right form
- Find_Var (Condition (Iter));
+ Find_Var (Expression);
-- Nothing to do if local variable from source not found. If it's a
-- renaming, it is probably renaming something too complicated to deal
@@ -608,7 +708,7 @@ package body Sem_Warn is
-- We have a variable reference of the right form, now we scan the loop
-- body to see if it looks like it might not be modified
- if Find_Ref (Loop_Statement) = OK then
+ if No_Ref_Found (Loop_Statement) = OK then
Error_Msg_NE
("?variable& is not modified in loop body!", Ref, Var);
Error_Msg_N
@@ -927,9 +1027,8 @@ package body Sem_Warn is
-- we exclude protected types, too complicated to worry about.
if Ekind (E1) = E_Variable
- or else
- ((Ekind (E1) = E_Out_Parameter
- or else Ekind (E1) = E_In_Out_Parameter)
+ or else
+ (Ekind_In (E1, E_Out_Parameter, E_In_Out_Parameter)
and then not Is_Protected_Type (Current_Scope))
then
-- Case of an unassigned variable
@@ -1245,7 +1344,7 @@ package body Sem_Warn is
while Present (Comp) loop
if Ekind (Comp) = E_Component
and then Nkind (Parent (Comp)) =
- N_Component_Declaration
+ N_Component_Declaration
and then No (Expression (Parent (Comp)))
then
Error_Msg_Node_2 := Comp;
@@ -1364,12 +1463,9 @@ package body Sem_Warn is
-- a separate spec.
and then not (Is_Formal (E1)
- and then
- Ekind (Scope (E1)) = E_Subprogram_Body
- and then
- Present (Spec_Entity (E1))
- and then
- Referenced (Spec_Entity (E1)))
+ and then Ekind (Scope (E1)) = E_Subprogram_Body
+ and then Present (Spec_Entity (E1))
+ and then Referenced (Spec_Entity (E1)))
-- Consider private type referenced if full view is referenced.
-- If there is not full view, this is a generic type on which
@@ -1377,8 +1473,7 @@ package body Sem_Warn is
and then
not (Is_Private_Type (E1)
- and then
- Present (Full_View (E1))
+ and then Present (Full_View (E1))
and then Referenced (Full_View (E1)))
-- Don't worry about full view, only about private type
@@ -1408,16 +1503,15 @@ package body Sem_Warn is
-- be non-referenced, since they start up tasks!
and then ((Ekind (E1) /= E_Variable
- and then Ekind (E1) /= E_Constant
- and then Ekind (E1) /= E_Component)
- or else not Is_Task_Type (E1T))
+ and then Ekind (E1) /= E_Constant
+ and then Ekind (E1) /= E_Component)
+ or else not Is_Task_Type (E1T))
-- For subunits, only place warnings on the main unit itself,
-- since parent units are not completely compiled.
and then (Nkind (Unit (Cunit (Main_Unit))) /= N_Subunit
- or else
- Get_Source_Unit (E1) = Main_Unit)
+ or else Get_Source_Unit (E1) = Main_Unit)
-- No warning on a return object, because these are often
-- created with a single expression and an implicit return.
@@ -1432,9 +1526,8 @@ package body Sem_Warn is
-- since they refer to problems in internal units).
if GNAT_Mode
- or else not
- Is_Internal_File_Name
- (Unit_File_Name (Get_Source_Unit (E1)))
+ or else not Is_Internal_File_Name
+ (Unit_File_Name (Get_Source_Unit (E1)))
then
-- We do not immediately flag the error. This is because we
-- have not expanded generic bodies yet, and they may have
@@ -2004,7 +2097,7 @@ package body Sem_Warn is
while Present (Nam) loop
if Entity (Nam) = Pack then
Error_Msg_Qual_Level := 1;
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?no entities of package& are referenced!",
Nam, Pack);
Error_Msg_Qual_Level := 0;
@@ -2201,7 +2294,7 @@ package body Sem_Warn is
-- else or a pragma elaborate with a body library task).
elsif Has_Visible_Entities (Entity (Name (Item))) then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?unit& is not referenced!", Name (Item));
end if;
end if;
@@ -2278,7 +2371,7 @@ package body Sem_Warn is
if not
Has_Unreferenced (Entity (Name (Item)))
then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?no entities of & are referenced!",
Name (Item));
end if;
@@ -2294,7 +2387,7 @@ package body Sem_Warn is
and then not Has_Warnings_Off (Lunit)
and then not Has_Unreferenced (Pack)
then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?no entities of & are referenced!",
Unit_Declaration_Node (Pack),
Pack);
@@ -2334,12 +2427,12 @@ package body Sem_Warn is
end if;
if Unreferenced_In_Spec (Item) then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?unit& is not referenced in spec!",
Name (Item));
elsif No_Entities_Ref_In_Spec (Item) then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?no entities of & are referenced in spec!",
Name (Item));
@@ -2688,8 +2781,9 @@ package body Sem_Warn is
-- default mode.
elsif Check_Unreferenced then
- Error_Msg_N ("?formal parameter& is read but "
- & "never assigned!", E1);
+ Error_Msg_N
+ ("?formal parameter& is read but "
+ & "never assigned!", E1);
end if;
end if;
@@ -2783,9 +2877,7 @@ package body Sem_Warn is
-- Reference to obsolescent component
- elsif Ekind (E) = E_Component
- or else Ekind (E) = E_Discriminant
- then
+ elsif Ekind_In (E, E_Component, E_Discriminant) then
Error_Msg_NE
("?reference to obsolescent component& declared#", N, E);
@@ -3423,28 +3515,16 @@ package body Sem_Warn is
and then Is_Known_Branch
then
declare
- Start : Source_Ptr;
- Dummy : Source_Ptr;
- Typ : Character;
Atrue : Boolean;
begin
- Sloc_Range (Orig, Start, Dummy);
Atrue := Test_Result;
- if Present (Parent (C))
- and then Nkind (Parent (C)) = N_Op_Not
- then
+ if Present (Parent (C)) and then Nkind (Parent (C)) = N_Op_Not then
Atrue := not Atrue;
end if;
- if Atrue then
- Typ := 't';
- else
- Typ := 'f';
- end if;
-
- Set_SCO_Condition (Start, Typ);
+ Set_SCO_Condition (Orig, Atrue);
end;
end if;
@@ -3776,7 +3856,8 @@ package body Sem_Warn is
procedure Warn1 is
begin
Error_Msg_Uint_1 := Low_Bound;
- Error_Msg_FE ("?index for& may assume lower bound of^", X, Ent);
+ Error_Msg_FE -- CODEFIX
+ ("?index for& may assume lower bound of^", X, Ent);
end Warn1;
-- Start of processing for Test_Suspicious_Index
@@ -3800,11 +3881,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
+ Error_Msg_FE -- CODEFIX
("\suggested replacement: `&''First`", X, Ent);
else
Error_Msg_Uint_1 := Intval (X) - Low_Bound;
- Error_Msg_FE -- CODEFIX
+ Error_Msg_FE -- CODEFIX
("\suggested replacement: `&''First + ^`", X, Ent);
end if;
@@ -3910,7 +3991,7 @@ package body Sem_Warn is
-- Replacement subscript is now in string buffer
- Error_Msg_FE -- CODEFIX
+ Error_Msg_FE -- CODEFIX
("\suggested replacement: `&~`", Original_Node (X), Ent);
end if;
@@ -4082,10 +4163,10 @@ package body Sem_Warn is
if Present (Renamed_Object (E))
and then Comes_From_Source (Renamed_Object (E))
then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?renamed variable & is not referenced!", E);
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?variable & is not referenced!", E);
end if;
end if;
@@ -4095,10 +4176,11 @@ package body Sem_Warn is
if Present (Renamed_Object (E))
and then Comes_From_Source (Renamed_Object (E))
then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?renamed constant & is not referenced!", E);
else
- Error_Msg_N ("?constant & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?constant & is not referenced!", E);
end if;
when E_In_Parameter |
@@ -4123,7 +4205,7 @@ package body Sem_Warn is
end if;
if not Is_Trivial_Subprogram (Scope (E)) then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?formal parameter & is not referenced!",
E, Spec_E);
end if;
@@ -4138,28 +4220,36 @@ package body Sem_Warn is
when E_Named_Integer |
E_Named_Real =>
- Error_Msg_N ("?named number & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?named number & is not referenced!", E);
when Formal_Object_Kind =>
- Error_Msg_N ("?formal object & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?formal object & is not referenced!", E);
when E_Enumeration_Literal =>
- Error_Msg_N ("?literal & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?literal & is not referenced!", E);
when E_Function =>
- Error_Msg_N ("?function & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?function & is not referenced!", E);
when E_Procedure =>
- Error_Msg_N ("?procedure & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?procedure & is not referenced!", E);
when E_Package =>
- Error_Msg_N ("?package & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?package & is not referenced!", E);
when E_Exception =>
- Error_Msg_N ("?exception & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?exception & is not referenced!", E);
when E_Label =>
- Error_Msg_N ("?label & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?label & is not referenced!", E);
when E_Generic_Procedure =>
Error_Msg_N -- CODEFIX
@@ -4170,10 +4260,12 @@ package body Sem_Warn is
("?generic function & is never instantiated!", E);
when Type_Kind =>
- Error_Msg_N ("?type & is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?type & is not referenced!", E);
when others =>
- Error_Msg_N ("?& is not referenced!", E);
+ Error_Msg_N -- CODEFIX
+ ("?& is not referenced!", E);
end case;
-- Kill warnings on the entity on which the message has been posted
@@ -4270,7 +4362,7 @@ package body Sem_Warn is
("?& modified by call, but value never referenced",
Last_Assignment (Ent), Ent);
else
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?useless assignment to&, value never referenced!",
Last_Assignment (Ent), Ent);
end if;
@@ -4286,7 +4378,7 @@ package body Sem_Warn is
("?& modified by call, but value overwritten #!",
Last_Assignment (Ent), Ent);
else
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?useless assignment to&, value overwritten #!",
Last_Assignment (Ent), Ent);
end if;
diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads
index 365ad397d1b..e74e144fc5b 100644
--- a/gcc/ada/sem_warn.ads
+++ b/gcc/ada/sem_warn.ads
@@ -170,7 +170,8 @@ package Sem_Warn is
procedure Check_Infinite_Loop_Warning (Loop_Statement : Node_Id);
-- N is the node for a loop statement. This procedure checks if a warning
- -- should be given for a possible infinite loop, and if so issues it.
+ -- for a possible infinite loop should be given for a suspicious WHILE or
+ -- EXIT WHEN condition.
procedure Check_Low_Bound_Tested (Expr : Node_Id);
-- Expr is the node for a comparison operation. This procedure checks if
diff --git a/gcc/ada/sfn_scan.adb b/gcc/ada/sfn_scan.adb
index dc6ab38d448..1d24ca227f3 100644
--- a/gcc/ada/sfn_scan.adb
+++ b/gcc/ada/sfn_scan.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2010, 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- --
@@ -37,11 +37,10 @@ package body SFN_Scan is
-- Allow easy access to control character definitions
EOF : constant Character := ASCII.SUB;
- -- The character SUB (16#1A#) is used in DOS and other systems derived
- -- from DOS (OS/2, NT etc.) to signal the end of a text file. If this
- -- character appears as the last character of a file scanned by a call
- -- to Scan_SFN_Pragmas, then it is ignored, otherwise it is treated as
- -- an illegal character.
+ -- The character SUB (16#1A#) is used in DOS-derived systems, such as
+ -- Windows to signal the end of a text file. If this character appears as
+ -- the last character of a file scanned by a call to Scan_SFN_Pragmas, then
+ -- it is ignored, otherwise it is treated as an illegal character.
type String_Ptr is access String;
@@ -637,7 +636,7 @@ package body SFN_Scan is
loop
if At_EOF or else S (P) = LF or else S (P) = CR then
- Error -- CODEFIX
+ Error -- CODEFIX
("missing string quote");
elsif S (P) = HT then
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index 73377f1a39f..c43e0b4cbe2 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -146,7 +146,9 @@ package body Sinfo is
begin
pragma Assert (False
or else NT (N).Nkind = N_And_Then
+ or else NT (N).Nkind = N_Case_Expression_Alternative
or else NT (N).Nkind = N_Compilation_Unit_Aux
+ or else NT (N).Nkind = N_Expression_With_Actions
or else NT (N).Nkind = N_Freeze_Entity
or else NT (N).Nkind = N_Or_Else);
return List1 (N);
@@ -229,6 +231,7 @@ package body Sinfo is
(N : Node_Id) return List_Id is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Case_Expression
or else NT (N).Nkind = N_Case_Statement
or else NT (N).Nkind = N_In
or else NT (N).Nkind = N_Not_In);
@@ -791,6 +794,7 @@ package body Sinfo is
(N : Node_Id) return List_Id is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Case_Expression_Alternative
or else NT (N).Nkind = N_Case_Statement_Alternative
or else NT (N).Nkind = N_Variant);
return List4 (N);
@@ -1169,6 +1173,8 @@ package body Sinfo is
or else NT (N).Nkind = N_Assignment_Statement
or else NT (N).Nkind = N_At_Clause
or else NT (N).Nkind = N_Attribute_Definition_Clause
+ or else NT (N).Nkind = N_Case_Expression
+ or else NT (N).Nkind = N_Case_Expression_Alternative
or else NT (N).Nkind = N_Case_Statement
or else NT (N).Nkind = N_Code_Statement
or else NT (N).Nkind = N_Component_Association
@@ -1178,6 +1184,7 @@ package body Sinfo is
or else NT (N).Nkind = N_Discriminant_Association
or else NT (N).Nkind = N_Discriminant_Specification
or else NT (N).Nkind = N_Exception_Declaration
+ or else NT (N).Nkind = N_Expression_With_Actions
or else NT (N).Nkind = N_Free_Statement
or else NT (N).Nkind = N_Mod_Clause
or else NT (N).Nkind = N_Modular_Type_Definition
@@ -1555,6 +1562,14 @@ package body Sinfo is
return Flag16 (N);
end Interface_Present;
+ function Import_Interface_Present
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Pragma);
+ return Flag16 (N);
+ end Import_Interface_Present;
+
function In_Present
(N : Node_Id) return Boolean is
begin
@@ -1572,6 +1587,14 @@ package body Sinfo is
return Flag11 (N);
end Includes_Infinities;
+ function Inherited_Discriminant
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Component_Association);
+ return Flag13 (N);
+ end Inherited_Discriminant;
+
function Instance_Spec
(N : Node_Id) return Node_Id is
begin
@@ -2021,6 +2044,14 @@ package body Sinfo is
return Node2 (N);
end Next_Entity;
+ function Next_Exit_Statement
+ (N : Node_Id) return Node_Id is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Exit_Statement);
+ return Node3 (N);
+ end Next_Exit_Statement;
+
function Next_Implicit_With
(N : Node_Id) return Node_Id is
begin
@@ -2561,26 +2592,12 @@ package body Sinfo is
(N : Node_Id) return Node_Id is
begin
pragma Assert (False
- or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init
or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init
or else NT (N).Nkind = N_SCIL_Dispatching_Call
- or else NT (N).Nkind = N_SCIL_Membership_Test
- or else NT (N).Nkind = N_SCIL_Tag_Init);
+ or else NT (N).Nkind = N_SCIL_Membership_Test);
return Node4 (N);
end SCIL_Entity;
- function SCIL_Related_Node
- (N : Node_Id) return Node_Id is
- begin
- pragma Assert (False
- or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init
- or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init
- or else NT (N).Nkind = N_SCIL_Dispatching_Call
- or else NT (N).Nkind = N_SCIL_Membership_Test
- or else NT (N).Nkind = N_SCIL_Tag_Init);
- return Node1 (N);
- end SCIL_Related_Node;
-
function SCIL_Tag_Value
(N : Node_Id) return Node_Id is
begin
@@ -2931,6 +2948,14 @@ package body Sinfo is
return Flag13 (N);
end Was_Originally_Stub;
+ function Withed_Body
+ (N : Node_Id) return Node_Id is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ return Node1 (N);
+ end Withed_Body;
+
function Zero_Cost_Handling
(N : Node_Id) return Boolean is
begin
@@ -3033,7 +3058,9 @@ package body Sinfo is
begin
pragma Assert (False
or else NT (N).Nkind = N_And_Then
+ or else NT (N).Nkind = N_Case_Expression_Alternative
or else NT (N).Nkind = N_Compilation_Unit_Aux
+ or else NT (N).Nkind = N_Expression_With_Actions
or else NT (N).Nkind = N_Freeze_Entity
or else NT (N).Nkind = N_Or_Else);
Set_List1_With_Parent (N, Val);
@@ -3116,6 +3143,7 @@ package body Sinfo is
(N : Node_Id; Val : List_Id) is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Case_Expression
or else NT (N).Nkind = N_Case_Statement
or else NT (N).Nkind = N_In
or else NT (N).Nkind = N_Not_In);
@@ -3678,6 +3706,7 @@ package body Sinfo is
(N : Node_Id; Val : List_Id) is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Case_Expression_Alternative
or else NT (N).Nkind = N_Case_Statement_Alternative
or else NT (N).Nkind = N_Variant);
Set_List4_With_Parent (N, Val);
@@ -4047,6 +4076,8 @@ package body Sinfo is
or else NT (N).Nkind = N_Assignment_Statement
or else NT (N).Nkind = N_At_Clause
or else NT (N).Nkind = N_Attribute_Definition_Clause
+ or else NT (N).Nkind = N_Case_Expression
+ or else NT (N).Nkind = N_Case_Expression_Alternative
or else NT (N).Nkind = N_Case_Statement
or else NT (N).Nkind = N_Code_Statement
or else NT (N).Nkind = N_Component_Association
@@ -4056,6 +4087,7 @@ package body Sinfo is
or else NT (N).Nkind = N_Discriminant_Association
or else NT (N).Nkind = N_Discriminant_Specification
or else NT (N).Nkind = N_Exception_Declaration
+ or else NT (N).Nkind = N_Expression_With_Actions
or else NT (N).Nkind = N_Free_Statement
or else NT (N).Nkind = N_Mod_Clause
or else NT (N).Nkind = N_Modular_Type_Definition
@@ -4433,6 +4465,14 @@ package body Sinfo is
Set_Flag16 (N, Val);
end Set_Interface_Present;
+ procedure Set_Import_Interface_Present
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Pragma);
+ Set_Flag16 (N, Val);
+ end Set_Import_Interface_Present;
+
procedure Set_In_Present
(N : Node_Id; Val : Boolean := True) is
begin
@@ -4450,6 +4490,14 @@ package body Sinfo is
Set_Flag11 (N, Val);
end Set_Includes_Infinities;
+ procedure Set_Inherited_Discriminant
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Component_Association);
+ Set_Flag13 (N, Val);
+ end Set_Inherited_Discriminant;
+
procedure Set_Instance_Spec
(N : Node_Id; Val : Node_Id) is
begin
@@ -4899,6 +4947,14 @@ package body Sinfo is
Set_Node2 (N, Val); -- semantic field, no parent set
end Set_Next_Entity;
+ procedure Set_Next_Exit_Statement
+ (N : Node_Id; Val : Node_Id) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Exit_Statement);
+ Set_Node3 (N, Val); -- semantic field, no parent set
+ end Set_Next_Exit_Statement;
+
procedure Set_Next_Implicit_With
(N : Node_Id; Val : Node_Id) is
begin
@@ -5439,26 +5495,12 @@ package body Sinfo is
(N : Node_Id; Val : Node_Id) is
begin
pragma Assert (False
- or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init
or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init
or else NT (N).Nkind = N_SCIL_Dispatching_Call
- or else NT (N).Nkind = N_SCIL_Membership_Test
- or else NT (N).Nkind = N_SCIL_Tag_Init);
+ or else NT (N).Nkind = N_SCIL_Membership_Test);
Set_Node4 (N, Val); -- semantic field, no parent set
end Set_SCIL_Entity;
- procedure Set_SCIL_Related_Node
- (N : Node_Id; Val : Node_Id) is
- begin
- pragma Assert (False
- or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init
- or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init
- or else NT (N).Nkind = N_SCIL_Dispatching_Call
- or else NT (N).Nkind = N_SCIL_Membership_Test
- or else NT (N).Nkind = N_SCIL_Tag_Init);
- Set_Node1 (N, Val); -- semantic field, no parent set
- end Set_SCIL_Related_Node;
-
procedure Set_SCIL_Tag_Value
(N : Node_Id; Val : Node_Id) is
begin
@@ -5809,6 +5851,14 @@ package body Sinfo is
Set_Flag13 (N, Val);
end Set_Was_Originally_Stub;
+ procedure Set_Withed_Body
+ (N : Node_Id; Val : Node_Id) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ Set_Node1 (N, Val);
+ end Set_Withed_Body;
+
procedure Set_Zero_Cost_Handling
(N : Node_Id; Val : Boolean := True) is
begin
@@ -5982,7 +6032,6 @@ package body Sinfo is
T = V8;
end Nkind_In;
-
function Nkind_In
(T : Node_Kind;
V1 : Node_Kind;
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 8a6a157cc34..cb358c4d75b 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -1172,6 +1172,11 @@ package Sinfo is
-- 'Address or 'Tag attribute. ???There are other implicit with clauses
-- as well.
+ -- Import_Interface_Present (Flag16-Sem)
+ -- This flag is set in an Interface or Import pragma if a matching
+ -- pragma of the other kind is also present. This is used to avoid
+ -- generating some unwanted error messages.
+
-- Includes_Infinities (Flag11-Sem)
-- This flag is present in N_Range nodes. It is set for the range of
-- unconstrained float types defined in Standard, which include not only
@@ -1180,6 +1185,12 @@ package Sinfo is
-- range is given by the programmer, even if that range is identical to
-- the range for Float.
+ -- Inherited_Discriminant (Flag13-Sem)
+ -- This flag is present in N_Component_Association nodes. It indicates
+ -- that a given component association in an extension aggregate is the
+ -- value obtained from a constraint on an ancestor. Used to prevent
+ -- double expansion when the aggregate has expansion delayed.
+
-- Instance_Spec (Node5-Sem)
-- This field is present in generic instantiation nodes, and also in
-- formal package declaration nodes (formal package declarations are
@@ -1395,6 +1406,12 @@ package Sinfo is
-- scope are chained, and this field is used as the forward pointer for
-- this list. See Einfo for further details.
+ -- Next_Exit_Statement (Node3-Sem)
+ -- Present in N_Exit_Statement nodes. The exit statements for a loop are
+ -- chained (in reverse order of appearence) from the First_Exit_Statement
+ -- field of the E_Loop entity for the loop. Next_Exit_Statement points to
+ -- the next entry on this chain (Empty = end of list).
+
-- Next_Implicit_With (Node3-Sem)
-- Present in N_With_Clause. Part of a chain of with_clauses generated
-- in rtsfind to indicate implicit dependencies on predefined units. Used
@@ -1609,10 +1626,6 @@ package Sinfo is
-- Present in SCIL nodes. Used to reference the tagged type associated
-- with the SCIL node.
- -- SCIL_Related_Node (Node1-Sem)
- -- Present in SCIL nodes. Used to reference a tree node that requires
- -- special processing in the CodePeer backend.
-
-- SCIL_Controlling_Tag (Node5-Sem)
-- Present in N_SCIL_Dispatching_Call nodes. Used to reference the
-- controlling tag of a dispatching call.
@@ -1723,6 +1736,12 @@ package Sinfo is
-- Original_Node here because of the case of nested instantiations where
-- the substituted node can be copied.
+ -- Withed_Body (Node1-Sem)
+ -- Present in N_With_Clause nodes. Set if the unit in whose context
+ -- the with_clause appears instantiates a generic contained in the
+ -- library unit of the with_clause and as a result loads its body.
+ -- Used for a more precise unit traversal for CodePeer.
+
-- Zero_Cost_Handling (Flag5-Sem)
-- This flag is set in all handled sequence of statement and exception
-- handler nodes if exceptions are to be handled using the zero-cost
@@ -1974,13 +1993,14 @@ package Sinfo is
-- which are explicitly documented.
-- N_Pragma
- -- Sloc points to pragma identifier
+ -- Sloc points to PRAGMA
-- Next_Pragma (Node1-Sem)
-- Pragma_Argument_Associations (List2) (set to No_List if none)
-- Debug_Statement (Node3) (set to Empty if not Debug, Assert)
-- Pragma_Identifier (Node4)
-- Next_Rep_Item (Node5-Sem)
-- Pragma_Enabled (Flag5-Sem)
+ -- Import_Interface_Present (Flag16-Sem)
-- Note: we should have a section on what pragmas are passed on to
-- the back end to be processed. This section should note that pragma
@@ -3328,6 +3348,7 @@ package Sinfo is
-- Loop_Actions (List2-Sem)
-- Expression (Node3)
-- Box_Present (Flag15)
+ -- Inherited_Discriminant (Flag13)
-- Note: this structure is used for both record component associations
-- and array component associations, since the two cases aren't always
@@ -4034,6 +4055,13 @@ package Sinfo is
-- Is_Null_Loop (Flag16)
-- Suppress_Loop_Warnings (Flag17)
+ -- Note: the parser fills in the Identifier field if there is an
+ -- explicit loop identifier. Otherwise the parser leaves this field
+ -- set to Empty, and then the semantic processing for a loop statement
+ -- creates an identifier, setting the Has_Created_Identifier flag to
+ -- True. So after semantic anlaysis, the Identifier is always set,
+ -- referencing an identifier whose entity has an Ekind of E_Loop.
+
--------------------------
-- 5.5 Iteration Scheme --
--------------------------
@@ -4122,7 +4150,8 @@ package Sinfo is
-- N_Exit_Statement
-- Sloc points to EXIT
-- Name (Node2) (set to Empty if no loop name present)
- -- Condition (Node1) (set to Empty if no when part present)
+ -- Condition (Node1) (set to Empty if no WHEN part present)
+ -- Next_Exit_Statement (Node3-Sem): Next exit on chain
-------------------------
-- 5.9 Goto Statement --
@@ -5530,6 +5559,7 @@ package Sinfo is
-- N_With_Clause
-- Sloc points to first token of library unit name
+ -- Withed_Body (Node1-Sem)
-- Name (Node2)
-- Next_Implicit_With (Node3-Sem)
-- Library_Unit (Node4-Sem)
@@ -5543,7 +5573,7 @@ package Sinfo is
-- Elaborate_Desirable (Flag11-Sem)
-- Private_Present (Flag15) set if with_clause has private keyword
-- Implicit_With (Flag16-Sem)
- -- Limited_Present (Flag17) set if LIMITED is present
+ -- Limited_Present (Flag17) set if LIMITED is present
-- Limited_View_Installed (Flag18-Sem)
-- Unreferenced_In_Spec (Flag7-Sem)
-- No_Entities_Ref_In_Spec (Flag8-Sem)
@@ -6509,10 +6539,46 @@ package Sinfo is
-- reconstructed tree printed by Sprint, and the node descriptions here
-- show this syntax.
- -- Note: Conditional_Expression is in this section for historical reasons.
- -- We will move it to its appropriate place when it is officially approved
- -- as an extension (and then we will know what the exact grammar and place
- -- in the Reference Manual is!)
+ -- Note: Case_Expression and Conditional_Expression is in this section for
+ -- now, since they are extensions. We will move them to their appropriate
+ -- places when they are officially approved as extensions (and then we will
+ -- know what the exact grammar and place in the Reference Manual is!)
+
+ ---------------------
+ -- Case Expression --
+ ---------------------
+
+ -- CASE_EXPRESSION ::=
+ -- case EXPRESSION is
+ -- CASE_EXPRESSION_ALTERNATIVE
+ -- {CASE_EXPRESSION_ALTERNATIVE}
+
+ -- Note that the Alternatives cannot include pragmas (this constrasts
+ -- with the situation of case statements where pragmas are allowed).
+
+ -- N_Case_Expression
+ -- Sloc points to CASE
+ -- Expression (Node3)
+ -- Alternatives (List4)
+
+ ---------------------------------
+ -- Case Expression Alternative --
+ ---------------------------------
+
+ -- CASE_STATEMENT_ALTERNATIVE ::=
+ -- when DISCRETE_CHOICE_LIST =>
+ -- EXPRESSION
+
+ -- N_Case_Expression_Alternative
+ -- Sloc points to WHEN
+ -- Actions (List1)
+ -- Discrete_Choices (List4)
+ -- Expression (Node3)
+
+ -- Note: The Actions field temporarily holds any actions associated with
+ -- evaluation of the Expression. During expansion of the case expression
+ -- these actions are wrapped into the an N_Expressions_With_Actions node
+ -- replacing the original expression.
----------------------------
-- Conditional Expression --
@@ -6583,6 +6649,46 @@ package Sinfo is
-- Has_Private_View (Flag11-Sem) set in generic units.
-- plus fields for expression
+ -----------------------------
+ -- Expression with Actions --
+ -----------------------------
+
+ -- This node is created by the analyzer/expander to handle some
+ -- expansion cases, notably short circuit forms where there are
+ -- actions associated with the right hand operand.
+
+ -- The N_Expression_With_Actions node represents an expression with
+ -- an associated set of actions (which are executable statements and
+ -- declarations, as might occur in a handled statement sequence).
+
+ -- The required semantics is that the set of actions is executed in
+ -- the order in which it appears just before the expression is
+ -- evaluated (and these actions must only be executed if the value
+ -- of the expression is evaluated). The node is considered to be
+ -- a subexpression, whose value is the value of the Expression after
+ -- executing all the actions.
+
+ -- Note: if the actions contain declarations, then these declarations
+ -- maybe referenced with in the expression. It is thus appropriate for
+ -- the back end to create a scope that encompasses the construct (any
+ -- declarations within the actions will definitely not be referenced
+ -- once elaboration of the construct is completed).
+
+ -- Sprint syntax: do
+ -- action;
+ -- action;
+ -- ...
+ -- action;
+ -- in expression end
+
+ -- N_Expression_With_Actions
+ -- Actions (List1)
+ -- Expression (Node3)
+ -- plus fields for expression
+
+ -- Note: the actions list is always non-null, since we would
+ -- never have created this node if there weren't some actions.
+
--------------------
-- Free Statement --
--------------------
@@ -6883,34 +6989,21 @@ package Sinfo is
-- Meanwhile these nodes should be considered in experimental form, and
-- should be ignored by all code generating back ends. ???
- -- N_SCIL_Dispatch_Table_Object_Init
- -- Sloc references a declaration node containing a dispatch table
- -- SCIL_Related_Node (Node1-Sem)
- -- SCIL_Entity (Node4-Sem)
-
-- N_SCIL_Dispatch_Table_Tag_Init
-- Sloc references a node for a tag initialization
- -- SCIL_Related_Node (Node1-Sem)
-- SCIL_Entity (Node4-Sem)
-- N_SCIL_Dispatching_Call
-- Sloc references the node of a dispatching call
- -- SCIL_Related_Node (Node1-Sem)
-- SCIL_Target_Prim (Node2-Sem)
-- SCIL_Entity (Node4-Sem)
-- SCIL_Controlling_Tag (Node5-Sem)
-- N_SCIL_Membership_Test
-- Sloc references the node of a membership test
- -- SCIL_Related_Node (Node1-Sem)
-- SCIL_Tag_Value (Node5-Sem)
-- SCIL_Entity (Node4-Sem)
- -- N_SCIL_Tag_Init
- -- Sloc references the node of a tag component initialization
- -- SCIL_Related_Node (Node1-Sem)
- -- SCIL_Entity (Node4-Sem)
-
---------------------
-- Subprogram_Info --
---------------------
@@ -7167,6 +7260,7 @@ package Sinfo is
N_Conditional_Expression,
N_Explicit_Dereference,
+ N_Expression_With_Actions,
N_Function_Call,
N_Indexed_Component,
N_Integer_Literal,
@@ -7184,6 +7278,7 @@ package Sinfo is
N_Aggregate,
N_Allocator,
+ N_Case_Expression,
N_Extension_Aggregate,
N_Range,
N_Real_Literal,
@@ -7350,11 +7445,9 @@ package Sinfo is
-- SCIL nodes
- N_SCIL_Dispatch_Table_Object_Init,
N_SCIL_Dispatch_Table_Tag_Init,
N_SCIL_Dispatching_Call,
N_SCIL_Membership_Test,
- N_SCIL_Tag_Init,
-- Other nodes (not part of any subtype class)
@@ -7362,6 +7455,7 @@ package Sinfo is
N_Abstract_Subprogram_Declaration,
N_Access_Definition,
N_Access_To_Object_Definition,
+ N_Case_Expression_Alternative,
N_Case_Statement_Alternative,
N_Compilation_Unit,
N_Compilation_Unit_Aux,
@@ -7567,8 +7661,8 @@ package Sinfo is
N_Or_Else;
subtype N_SCIL_Node is Node_Kind range
- N_SCIL_Dispatch_Table_Object_Init ..
- N_SCIL_Tag_Init;
+ N_SCIL_Dispatch_Table_Tag_Init ..
+ N_SCIL_Membership_Test;
subtype N_Statement_Other_Than_Procedure_Call is Node_Kind range
N_Abort_Statement ..
@@ -8090,12 +8184,18 @@ package Sinfo is
function Implicit_With
(N : Node_Id) return Boolean; -- Flag16
+ function Import_Interface_Present
+ (N : Node_Id) return Boolean; -- Flag16
+
function In_Present
(N : Node_Id) return Boolean; -- Flag15
function Includes_Infinities
(N : Node_Id) return Boolean; -- Flag11
+ function Inherited_Discriminant
+ (N : Node_Id) return Boolean; -- Flag13
+
function Instance_Spec
(N : Node_Id) return Node_Id; -- Node5
@@ -8240,6 +8340,9 @@ package Sinfo is
function Next_Entity
(N : Node_Id) return Node_Id; -- Node2
+ function Next_Exit_Statement
+ (N : Node_Id) return Node_Id; -- Node3
+
function Next_Implicit_With
(N : Node_Id) return Node_Id; -- Node3
@@ -8411,9 +8514,6 @@ package Sinfo is
function SCIL_Entity
(N : Node_Id) return Node_Id; -- Node4
- function SCIL_Related_Node
- (N : Node_Id) return Node_Id; -- Node1
-
function SCIL_Tag_Value
(N : Node_Id) return Node_Id; -- Node5
@@ -8522,6 +8622,9 @@ package Sinfo is
function Was_Originally_Stub
(N : Node_Id) return Boolean; -- Flag13
+ function Withed_Body
+ (N : Node_Id) return Node_Id; -- Node1
+
function Zero_Cost_Handling
(N : Node_Id) return Boolean; -- Flag5
@@ -9008,12 +9111,18 @@ package Sinfo is
procedure Set_Implicit_With
(N : Node_Id; Val : Boolean := True); -- Flag16
+ procedure Set_Import_Interface_Present
+ (N : Node_Id; Val : Boolean := True); -- Flag16
+
procedure Set_In_Present
(N : Node_Id; Val : Boolean := True); -- Flag15
procedure Set_Includes_Infinities
(N : Node_Id; Val : Boolean := True); -- Flag11
+ procedure Set_Inherited_Discriminant
+ (N : Node_Id; Val : Boolean := True); -- Flag13
+
procedure Set_Instance_Spec
(N : Node_Id; Val : Node_Id); -- Node5
@@ -9158,6 +9267,9 @@ package Sinfo is
procedure Set_Next_Entity
(N : Node_Id; Val : Node_Id); -- Node2
+ procedure Set_Next_Exit_Statement
+ (N : Node_Id; Val : Node_Id); -- Node3
+
procedure Set_Next_Implicit_With
(N : Node_Id; Val : Node_Id); -- Node3
@@ -9329,9 +9441,6 @@ package Sinfo is
procedure Set_SCIL_Entity
(N : Node_Id; Val : Node_Id); -- Node4
- procedure Set_SCIL_Related_Node
- (N : Node_Id; Val : Node_Id); -- Node1
-
procedure Set_SCIL_Tag_Value
(N : Node_Id; Val : Node_Id); -- Node5
@@ -9440,6 +9549,9 @@ package Sinfo is
procedure Set_Was_Originally_Stub
(N : Node_Id; Val : Boolean := True); -- Flag13
+ procedure Set_Withed_Body
+ (N : Node_Id; Val : Node_Id); -- Node1
+
procedure Set_Zero_Cost_Handling
(N : Node_Id; Val : Boolean := True); -- Flag5
@@ -10161,6 +10273,20 @@ package Sinfo is
4 => False, -- unused
5 => False), -- unused
+ N_Case_Expression =>
+ (1 => False, -- unused
+ 2 => False, -- unused
+ 3 => True, -- Expression (Node3)
+ 4 => True, -- Alternatives (List4)
+ 5 => False), -- unused
+
+ N_Case_Expression_Alternative =>
+ (1 => False, -- Actions (List1-Sem)
+ 2 => False, -- unused
+ 3 => True, -- Statements (List3)
+ 4 => True, -- Expression (Node4)
+ 5 => False), -- unused
+
N_Case_Statement =>
(1 => False, -- unused
2 => False, -- unused
@@ -10938,6 +11064,13 @@ package Sinfo is
4 => False, -- Entity (Node4-Sem)
5 => False), -- Etype (Node5-Sem)
+ N_Expression_With_Actions =>
+ (1 => True, -- Actions (List1)
+ 2 => False, -- unused
+ 3 => True, -- Expression (Node3)
+ 4 => False, -- unused
+ 5 => False), -- unused
+
N_Free_Statement =>
(1 => False, -- Storage_Pool (Node1-Sem)
2 => False, -- Procedure_To_Call (Node2-Sem)
@@ -11068,41 +11201,27 @@ package Sinfo is
-- Entries for SCIL nodes
- N_SCIL_Dispatch_Table_Object_Init =>
- (1 => False, -- SCIL_Related_Node (Node1-Sem)
- 2 => False, -- unused
- 3 => False, -- unused
- 4 => False, -- SCIL_Entity (Node4-Sem)
- 5 => False), -- unused
-
N_SCIL_Dispatch_Table_Tag_Init =>
- (1 => False, -- SCIL_Related_Node (Node1-Sem)
+ (1 => False, -- unused
2 => False, -- unused
3 => False, -- unused
4 => False, -- SCIL_Entity (Node4-Sem)
5 => False), -- unused
N_SCIL_Dispatching_Call =>
- (1 => False, -- SCIL_Related_Node (Node1-Sem)
+ (1 => False, -- unused
2 => False, -- SCIL_Target_Prim (Node2-Sem)
3 => False, -- unused
4 => False, -- SCIL_Entity (Node4-Sem)
5 => False), -- SCIL_Controlling_Tag (Node5-Sem)
N_SCIL_Membership_Test =>
- (1 => False, -- SCIL_Related_Node (Node1-Sem)
+ (1 => False, -- unused
2 => False, -- unused
3 => False, -- unused
4 => False, -- SCIL_Entity (Node4-Sem)
5 => False), -- SCIL_Tag_Value (Node5-Sem)
- N_SCIL_Tag_Init =>
- (1 => False, -- SCIL_Related_Node (Node1-Sem)
- 2 => False, -- unused
- 3 => False, -- unused
- 4 => False, -- SCIL_Entity (Node4-Sem)
- 5 => False), -- unused
-
-- Entries for Empty, Error and Unused. Even thought these have a Chars
-- field for debugging purposes, they are not really syntactic fields, so
-- we mark all fields as unused.
@@ -11298,7 +11417,9 @@ package Sinfo is
pragma Inline (Interface_List);
pragma Inline (Interface_Present);
pragma Inline (Includes_Infinities);
+ pragma Inline (Import_Interface_Present);
pragma Inline (In_Present);
+ pragma Inline (Inherited_Discriminant);
pragma Inline (Instance_Spec);
pragma Inline (Intval);
pragma Inline (Is_Accessibility_Actual);
@@ -11347,6 +11468,7 @@ package Sinfo is
pragma Inline (Name);
pragma Inline (Names);
pragma Inline (Next_Entity);
+ pragma Inline (Next_Exit_Statement);
pragma Inline (Next_Implicit_With);
pragma Inline (Next_Named_Actual);
pragma Inline (Next_Pragma);
@@ -11404,7 +11526,6 @@ package Sinfo is
pragma Inline (Rounded_Result);
pragma Inline (SCIL_Controlling_Tag);
pragma Inline (SCIL_Entity);
- pragma Inline (SCIL_Related_Node);
pragma Inline (SCIL_Tag_Value);
pragma Inline (SCIL_Target_Prim);
pragma Inline (Scope);
@@ -11441,6 +11562,7 @@ package Sinfo is
pragma Inline (Variants);
pragma Inline (Visible_Declarations);
pragma Inline (Was_Originally_Stub);
+ pragma Inline (Withed_Body);
pragma Inline (Zero_Cost_Handling);
pragma Inline (Set_ABE_Is_Certain);
@@ -11600,7 +11722,9 @@ package Sinfo is
pragma Inline (Set_Includes_Infinities);
pragma Inline (Set_Interface_List);
pragma Inline (Set_Interface_Present);
+ pragma Inline (Set_Import_Interface_Present);
pragma Inline (Set_In_Present);
+ pragma Inline (Set_Inherited_Discriminant);
pragma Inline (Set_Instance_Spec);
pragma Inline (Set_Intval);
pragma Inline (Set_Is_Accessibility_Actual);
@@ -11650,6 +11774,7 @@ package Sinfo is
pragma Inline (Set_Name);
pragma Inline (Set_Names);
pragma Inline (Set_Next_Entity);
+ pragma Inline (Set_Next_Exit_Statement);
pragma Inline (Set_Next_Implicit_With);
pragma Inline (Set_Next_Named_Actual);
pragma Inline (Set_Next_Pragma);
@@ -11706,7 +11831,6 @@ package Sinfo is
pragma Inline (Set_Rounded_Result);
pragma Inline (Set_SCIL_Controlling_Tag);
pragma Inline (Set_SCIL_Entity);
- pragma Inline (Set_SCIL_Related_Node);
pragma Inline (Set_SCIL_Tag_Value);
pragma Inline (Set_SCIL_Target_Prim);
pragma Inline (Set_Scope);
@@ -11743,6 +11867,7 @@ package Sinfo is
pragma Inline (Set_Variants);
pragma Inline (Set_Visible_Declarations);
pragma Inline (Set_Was_Originally_Stub);
+ pragma Inline (Set_Withed_Body);
pragma Inline (Set_Zero_Cost_Handling);
N_Simple_Return_Statement : constant Node_Kind := N_Return_Statement;
diff --git a/gcc/ada/sinput-c.adb b/gcc/ada/sinput-c.adb
index 4997346bd8e..aebdcacdd12 100644
--- a/gcc/ada/sinput-c.adb
+++ b/gcc/ada/sinput-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -28,7 +28,10 @@ with System; use System;
with Ada.Unchecked_Conversion;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.OS_Lib; use System.OS_Lib;
+pragma Warnings (On);
package body Sinput.C is
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 89bbe4c7e40..71700388890 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -6,7 +6,7 @@
-- --
-- T e m p l a t e --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -34,7 +34,7 @@ with Namet; use Namet;
package Snames is
-- This package contains definitions of standard names (i.e. entries in the
--- Names table) that are used throughout the GNAT compiler). It also contains
+-- Names table) that are used throughout the GNAT compiler. It also contains
-- the definitions of some enumeration types whose definitions are tied to
-- the order of these preset names.
@@ -334,6 +334,8 @@ package Snames is
Name_Ada_95 : constant Name_Id := N + $; -- GNAT
Name_Ada_05 : constant Name_Id := N + $; -- GNAT
Name_Ada_2005 : constant Name_Id := N + $; -- GNAT
+ Name_Ada_12 : constant Name_Id := N + $; -- GNAT
+ Name_Ada_2012 : constant Name_Id := N + $; -- GNAT
Name_Assertion_Policy : constant Name_Id := N + $; -- Ada 05
Name_Assume_No_Invalid_Values : constant Name_Id := N + $; -- GNAT
Name_C_Pass_By_Copy : constant Name_Id := N + $; -- GNAT
@@ -1416,6 +1418,8 @@ package Snames is
Pragma_Ada_95,
Pragma_Ada_05,
Pragma_Ada_2005,
+ Pragma_Ada_12,
+ Pragma_Ada_2012,
Pragma_Assertion_Policy,
Pragma_Assume_No_Invalid_Values,
Pragma_C_Pass_By_Copy,
@@ -1690,9 +1694,10 @@ package Snames is
-- call this function with a name that is not the name of a attribute.
function Get_Convention_Id (N : Name_Id) return Convention_Id;
- -- Returns Id of language convention corresponding to given name. It is an
- -- to call this function with a name that is not the name of a convention,
- -- or one previously given in a call to Record_Convention_Identifier.
+ -- Returns Id of language convention corresponding to given name. It is
+ -- an error to call this function with a name that is not the name of a
+ -- convention, or one that has been previously recorded using a call to
+ -- Record_Convention_Identifier.
function Get_Convention_Name (C : Convention_Id) return Name_Id;
-- Returns the name of language convention corresponding to given
diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c
index 76755643161..e68f4359782 100644
--- a/gcc/ada/socket.c
+++ b/gcc/ada/socket.c
@@ -32,6 +32,7 @@
/* This file provides a portable binding to the sockets API */
#include "gsocket.h"
+
#ifdef VMS
/*
* For VMS, gsocket.h can't include sockets-related DEC C header files
@@ -42,16 +43,27 @@
# include "s-oscons.h"
/*
- * We also need the declaration of struct servent, which s-oscons can't
- * provide, so we copy it manually here. This needs to be kept in synch
+ * We also need the declaration of struct hostent/servent, which s-oscons
+ * can't provide, so we copy it manually here. This needs to be kept in synch
* with the definition of that structure in the DEC C headers, which
* hopefully won't change frequently.
*/
+typedef char *__netdb_char_ptr __attribute__ (( mode (SI) ));
+typedef __netdb_char_ptr *__netdb_char_ptr_ptr __attribute__ (( mode (SI) ));
+
+struct hostent {
+ __netdb_char_ptr h_name;
+ __netdb_char_ptr_ptr h_aliases;
+ int h_addrtype;
+ int h_length;
+ __netdb_char_ptr_ptr h_addr_list;
+};
+
struct servent {
- char *s_name; /* official service name */
- char **s_aliases; /* alias list */
- int s_port; /* port # */
- char *s_proto; /* protocol to use */
+ __netdb_char_ptr s_name;
+ __netdb_char_ptr_ptr s_aliases;
+ int s_port;
+ __netdb_char_ptr s_proto;
};
#endif
@@ -87,15 +99,19 @@ extern void __gnat_remove_socket_from_set (fd_set *, int);
extern void __gnat_reset_socket_set (fd_set *);
extern int __gnat_get_h_errno (void);
extern int __gnat_socket_ioctl (int, int, int *);
+
extern char * __gnat_servent_s_name (struct servent *);
-extern char ** __gnat_servent_s_aliases (struct servent *);
-extern int __gnat_servent_s_port (struct servent *);
+extern char * __gnat_servent_s_alias (struct servent *, int index);
+extern unsigned short __gnat_servent_s_port (struct servent *);
extern char * __gnat_servent_s_proto (struct servent *);
-extern void __gnat_servent_set_s_name (struct servent *, char *);
-extern void __gnat_servent_set_s_aliases (struct servent *, char **);
-extern void __gnat_servent_set_s_port (struct servent *, int);
-extern void __gnat_servent_set_s_proto (struct servent *, char *);
-#if defined (__vxworks) || defined (_WIN32)
+
+extern char * __gnat_hostent_h_name (struct hostent *);
+extern char * __gnat_hostent_h_alias (struct hostent *, int);
+extern int __gnat_hostent_h_addrtype (struct hostent *);
+extern int __gnat_hostent_h_length (struct hostent *);
+extern char * __gnat_hostent_h_addr (struct hostent *, int);
+
+#ifndef HAVE_INET_PTON
extern int __gnat_inet_pton (int, const char *, void *);
#endif
@@ -164,76 +180,28 @@ __gnat_close_signalling_fd (int sig) {
#endif
/*
- * GetXXXbyYYY wrappers
- * These functions are used by the default implementation of g-socthi,
- * and also by the Windows version.
+ * Handling of gethostbyname, gethostbyaddr, getservbyname and getservbyport
+ * =========================================================================
+ *
+ * This module exposes __gnat_getXXXbyYYY operations with the same signature
+ * as the reentrant variant getXXXbyYYY_r.
+ *
+ * On platforms where getXXXbyYYY is intrinsically reentrant, the provided user
+ * buffer argument is ignored.
*
- * They can be used for any platform that either provides an intrinsically
- * task safe implementation of getXXXbyYYY, or a reentrant variant
- * getXXXbyYYY_r. Otherwise, a task safe wrapper, including proper mutual
- * exclusion if appropriate, must be implemented in the target specific
- * version of g-socthi.
+ * When getXXXbyYYY is not reentrant but getXXXbyYYY_r exists, the latter is
+ * used, and the provided buffer argument must point to a valid, thread-local
+ * buffer (usually on the caller's stack).
+ *
+ * When getXXXbyYYY is not reentrant and no reentrant getXXXbyYYY_r variant
+ * is available, the non-reentrant getXXXbyYYY is called, the provided user
+ * buffer is ignored, and the caller is expected to take care of mutual
+ * exclusion.
*/
-#ifdef HAVE_THREAD_SAFE_GETxxxBYyyy
+#ifdef HAVE_GETxxxBYyyy_R
int
-__gnat_safe_gethostbyname (const char *name,
- struct hostent *ret, char *buf, size_t buflen,
- int *h_errnop)
-{
- struct hostent *rh;
- rh = gethostbyname (name);
- if (rh == NULL) {
- *h_errnop = h_errno;
- return -1;
- }
- *ret = *rh;
- *h_errnop = 0;
- return 0;
-}
-
-int
-__gnat_safe_gethostbyaddr (const char *addr, int len, int type,
- struct hostent *ret, char *buf, size_t buflen,
- int *h_errnop)
-{
- struct hostent *rh;
- rh = gethostbyaddr (addr, len, type);
- if (rh == NULL) {
- *h_errnop = h_errno;
- return -1;
- }
- *ret = *rh;
- *h_errnop = 0;
- return 0;
-}
-
-int
-__gnat_safe_getservbyname (const char *name, const char *proto,
- struct servent *ret, char *buf, size_t buflen)
-{
- struct servent *rh;
- rh = getservbyname (name, proto);
- if (rh == NULL)
- return -1;
- *ret = *rh;
- return 0;
-}
-
-int
-__gnat_safe_getservbyport (int port, const char *proto,
- struct servent *ret, char *buf, size_t buflen)
-{
- struct servent *rh;
- rh = getservbyport (port, proto);
- if (rh == NULL)
- return -1;
- *ret = *rh;
- return 0;
-}
-#elif HAVE_GETxxxBYyyy_R
-int
-__gnat_safe_gethostbyname (const char *name,
+__gnat_gethostbyname (const char *name,
struct hostent *ret, char *buf, size_t buflen,
int *h_errnop)
{
@@ -250,7 +218,7 @@ __gnat_safe_gethostbyname (const char *name,
}
int
-__gnat_safe_gethostbyaddr (const char *addr, int len, int type,
+__gnat_gethostbyaddr (const char *addr, int len, int type,
struct hostent *ret, char *buf, size_t buflen,
int *h_errnop)
{
@@ -267,7 +235,7 @@ __gnat_safe_gethostbyaddr (const char *addr, int len, int type,
}
int
-__gnat_safe_getservbyname (const char *name, const char *proto,
+__gnat_getservbyname (const char *name, const char *proto,
struct servent *ret, char *buf, size_t buflen)
{
struct servent *rh;
@@ -283,7 +251,7 @@ __gnat_safe_getservbyname (const char *name, const char *proto,
}
int
-__gnat_safe_getservbyport (int port, const char *proto,
+__gnat_getservbyport (int port, const char *proto,
struct servent *ret, char *buf, size_t buflen)
{
struct servent *rh;
@@ -297,6 +265,130 @@ __gnat_safe_getservbyport (int port, const char *proto,
ri = (rh == NULL) ? -1 : 0;
return ri;
}
+#elif defined (__vxworks)
+static char vxw_h_name[MAXHOSTNAMELEN + 1];
+static char *vxw_h_aliases[1] = { NULL };
+static int vxw_h_addr;
+static char *vxw_h_addr_list[2] = { (char*) &vxw_h_addr, NULL };
+
+int
+__gnat_gethostbyname (const char *name,
+ struct hostent *ret, char *buf, size_t buflen,
+ int *h_errnop)
+{
+ vxw_h_addr = hostGetByName (name);
+ if (vxw_h_addr == ERROR) {
+ *h_errnop = __gnat_get_h_errno ();
+ return -1;
+ }
+ ret->h_name = name;
+ ret->h_aliases = &vxw_h_aliases;
+ ret->h_addrtype = AF_INET;
+ ret->h_length = 4;
+ ret->h_addr_list = &vxw_h_addr_list;
+ return 0;
+}
+
+int
+__gnat_gethostbyaddr (const char *addr, int len, int type,
+ struct hostent *ret, char *buf, size_t buflen,
+ int *h_errnop)
+{
+ if (type != AF_INET) {
+ *h_errnop = EAFNOSUPPORT;
+ return -1;
+ }
+
+ if (addr == NULL || len != 4) {
+ *h_errnop = EINVAL;
+ return -1;
+ }
+
+ if (hostGetByAddr (*(int*)addr, &vxw_h_name) != OK) {
+ *h_errnop = __gnat_get_h_errno ();
+ return -1;
+ }
+
+ vxw_h_addr = addr;
+
+ ret->h_name = &vxw_h_name;
+ ret->h_aliases = &vxw_h_aliases;
+ ret->h_addrtype = AF_INET;
+ ret->h_length = 4;
+ ret->h_addr_list = &vxw_h_addr_list;
+}
+
+int
+__gnat_getservbyname (const char *name, const char *proto,
+ struct servent *ret, char *buf, size_t buflen)
+{
+ /* Not available under VxWorks */
+ return -1;
+}
+
+int
+__gnat_getservbyport (int port, const char *proto,
+ struct servent *ret, char *buf, size_t buflen)
+{
+ /* Not available under VxWorks */
+ return -1;
+}
+#else
+int
+__gnat_gethostbyname (const char *name,
+ struct hostent *ret, char *buf, size_t buflen,
+ int *h_errnop)
+{
+ struct hostent *rh;
+ rh = gethostbyname (name);
+ if (rh == NULL) {
+ *h_errnop = __gnat_get_h_errno ();
+ return -1;
+ }
+ *ret = *rh;
+ *h_errnop = 0;
+ return 0;
+}
+
+int
+__gnat_gethostbyaddr (const char *addr, int len, int type,
+ struct hostent *ret, char *buf, size_t buflen,
+ int *h_errnop)
+{
+ struct hostent *rh;
+ rh = gethostbyaddr (addr, len, type);
+ if (rh == NULL) {
+ *h_errnop = __gnat_get_h_errno ();
+ return -1;
+ }
+ *ret = *rh;
+ *h_errnop = 0;
+ return 0;
+}
+
+int
+__gnat_getservbyname (const char *name, const char *proto,
+ struct servent *ret, char *buf, size_t buflen)
+{
+ struct servent *rh;
+ rh = getservbyname (name, proto);
+ if (rh == NULL)
+ return -1;
+ *ret = *rh;
+ return 0;
+}
+
+int
+__gnat_getservbyport (int port, const char *proto,
+ struct servent *ret, char *buf, size_t buflen)
+{
+ struct servent *rh;
+ rh = getservbyport (port, proto);
+ if (rh == NULL)
+ return -1;
+ *ret = *rh;
+ return 0;
+}
#endif
/* Find the largest socket in the socket set SET. This is needed for
@@ -510,6 +602,30 @@ __gnat_inet_pton (int af, const char *src, void *dst) {
#endif
/*
+ * Accessor functions for struct hostent.
+ */
+
+char * __gnat_hostent_h_name (struct hostent * h) {
+ return h->h_name;
+}
+
+char * __gnat_hostent_h_alias (struct hostent * h, int index) {
+ return h->h_aliases[index];
+}
+
+int __gnat_hostent_h_addrtype (struct hostent * h) {
+ return h->h_addrtype;
+}
+
+int __gnat_hostent_h_length (struct hostent * h) {
+ return h->h_length;
+}
+
+char * __gnat_hostent_h_addr (struct hostent * h, int index) {
+ return h->h_addr_list[index];
+}
+
+/*
* Accessor functions for struct servent.
*
* These are needed because servent has different representations on different
@@ -539,21 +655,19 @@ __gnat_inet_pton (int af, const char *src, void *dst) {
* };
*/
-/* Getters */
-
char *
__gnat_servent_s_name (struct servent * s)
{
return s->s_name;
}
-char **
-__gnat_servent_s_aliases (struct servent * s)
+char *
+__gnat_servent_s_alias (struct servent * s, int index)
{
- return s->s_aliases;
+ return s->s_aliases[index];
}
-int
+unsigned short
__gnat_servent_s_port (struct servent * s)
{
return s->s_port;
@@ -565,32 +679,6 @@ __gnat_servent_s_proto (struct servent * s)
return s->s_proto;
}
-/* Setters */
-
-void
-__gnat_servent_set_s_name (struct servent * s, char * s_name)
-{
- s->s_name = s_name;
-}
-
-void
-__gnat_servent_set_s_aliases (struct servent * s, char ** s_aliases)
-{
- s->s_aliases = s_aliases;
-}
-
-void
-__gnat_servent_set_s_port (struct servent * s, int s_port)
-{
- s->s_port = s_port;
-}
-
-void
-__gnat_servent_set_s_proto (struct servent * s, char * s_proto)
-{
- s->s_proto = s_proto;
-}
-
#else
# warning Sockets are not supported on this platform
#endif /* defined(HAVE_SOCKETS) */
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index cc9d5a081f1..44c12f0ab2d 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -403,7 +403,8 @@ package body Sprint is
procedure pg (Arg : Union_Id) is
begin
Dump_Generated_Only := True;
- Dump_Original_Only := False;
+ Dump_Original_Only := False;
+ Dump_Freeze_Null := True;
Current_Source_File := No_Source_File;
if Arg in List_Range then
@@ -1083,6 +1084,32 @@ package body Sprint is
Write_Char (';');
+ when N_Case_Expression =>
+ declare
+ Alt : Node_Id;
+
+ begin
+ Write_Str_With_Col_Check_Sloc ("(case ");
+ Sprint_Node (Expression (Node));
+ Write_Str_With_Col_Check (" is");
+
+ Alt := First (Alternatives (Node));
+ loop
+ Sprint_Node (Alt);
+ Next (Alt);
+ exit when No (Alt);
+ Write_Char (',');
+ end loop;
+
+ Write_Char (')');
+ end;
+
+ when N_Case_Expression_Alternative =>
+ Write_Str_With_Col_Check (" when ");
+ Sprint_Bar_List (Discrete_Choices (Node));
+ Write_Str (" => ");
+ Sprint_Node (Expression (Node));
+
when N_Case_Statement =>
Write_Indent_Str_Sloc ("case ");
Sprint_Node (Expression (Node));
@@ -1224,14 +1251,20 @@ package body Sprint is
declare
Condition : constant Node_Id := First (Expressions (Node));
Then_Expr : constant Node_Id := Next (Condition);
- Else_Expr : constant Node_Id := Next (Then_Expr);
+
begin
Write_Str_With_Col_Check_Sloc ("(if ");
Sprint_Node (Condition);
Write_Str_With_Col_Check (" then ");
- Sprint_Node (Then_Expr);
- Write_Str_With_Col_Check (" else ");
- Sprint_Node (Else_Expr);
+
+ -- Defense against junk here!
+
+ if Present (Then_Expr) then
+ Sprint_Node (Then_Expr);
+ Write_Str_With_Col_Check (" else ");
+ Sprint_Node (Next (Then_Expr));
+ end if;
+
Write_Char (')');
end;
@@ -1508,6 +1541,19 @@ package body Sprint is
Write_Char_Sloc ('.');
Write_Str_Sloc ("all");
+ when N_Expression_With_Actions =>
+ Indent_Begin;
+ Write_Indent_Str_Sloc ("do ");
+ Indent_Begin;
+ Sprint_Node_List (Actions (Node));
+ Indent_End;
+ Write_Indent;
+ Write_Str_With_Col_Check_Sloc ("in ");
+ Sprint_Node (Expression (Node));
+ Write_Str_With_Col_Check (" end");
+ Indent_End;
+ Write_Indent;
+
when N_Extended_Return_Statement =>
Write_Indent_Str_Sloc ("return ");
Sprint_Node_List (Return_Object_Declarations (Node));
@@ -2643,9 +2689,6 @@ package body Sprint is
-- Doc of this extended syntax belongs in sinfo.ads and/or
-- sprint.ads ???
- when N_SCIL_Dispatch_Table_Object_Init =>
- Write_Indent_Str ("[N_SCIL_Dispatch_Table_Object_Init]");
-
when N_SCIL_Dispatch_Table_Tag_Init =>
Write_Indent_Str ("[N_SCIL_Dispatch_Table_Tag_Init]");
@@ -2655,9 +2698,6 @@ package body Sprint is
when N_SCIL_Membership_Test =>
Write_Indent_Str ("[N_SCIL_Membership_Test]");
- when N_SCIL_Tag_Init =>
- Write_Indent_Str ("[N_SCIL_Dispatch_Table_Tag_Init]");
-
when N_Simple_Return_Statement =>
if Present (Expression (Node)) then
Write_Indent_Str_Sloc ("return ");
diff --git a/gcc/ada/sprint.ads b/gcc/ada/sprint.ads
index 59c371acbc3..64fe81ae4c5 100644
--- a/gcc/ada/sprint.ads
+++ b/gcc/ada/sprint.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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,6 +32,7 @@
-- tree may either blow up on a debugging check, or list incorrect source.
with Types; use Types;
+
package Sprint is
-----------------------
@@ -53,8 +54,8 @@ package Sprint is
-- Convert wi Rounded_Result target@(source)
-- Divide wi Treat_Fixed_As_Integer x #/ y
-- Divide wi Rounded_Result x @/ y
+ -- Expression with actions do action; .. action; in expr end
-- Expression with range check {expression}
- -- Operator with range check {operator} (e.g. {+})
-- Free statement free expr [storage_pool = xxx]
-- Freeze entity with freeze actions freeze entityname [ actions ]
-- Implicit call to run time routine $routine-name
@@ -69,6 +70,7 @@ package Sprint is
-- Multiple concatenation expr && expr && expr ... && expr
-- Multiply wi Treat_Fixed_As_Integer x #* y
-- Multiply wi Rounded_Result x @* y
+ -- Operator with range check {operator} (e.g. {+})
-- Others choice for cleanup when all others
-- Pop exception label %pop_xxx_exception_label
-- Push exception label %push_xxx_exception_label (label)
diff --git a/gcc/ada/style.adb b/gcc/ada/style.adb
index e700abdf8f8..0f0ab300cba 100644
--- a/gcc/ada/style.adb
+++ b/gcc/ada/style.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -78,11 +78,11 @@ package body Style is
begin
if Style_Check_Array_Attribute_Index then
if D = 1 and then Present (E1) then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("(style) index number not allowed for one dimensional array",
E1);
elsif D > 1 and then No (E1) then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("(style) index number required for multi-dimensional array",
N);
end if;
@@ -161,7 +161,7 @@ package body Style is
then
Error_Msg_Node_1 := Def;
Error_Msg_Sloc := Sloc (Def);
- Error_Msg
+ Error_Msg -- CODEFIX
("(style) bad casing of & declared#", Sref);
return;
@@ -222,7 +222,7 @@ package body Style is
String (Tref (Sref .. Sref + Source_Ptr (Nlen) - 1));
Set_Casing (Cas);
Error_Msg_Name_1 := Name_Enter;
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("(style) bad casing of %% declared in Standard", Ref);
end if;
end if;
@@ -243,10 +243,10 @@ package body Style is
if Style_Check_Missing_Overriding and then Comes_From_Source (N) then
if Nkind (N) = N_Subprogram_Body then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("(style) missing OVERRIDING indicator in body of%", N);
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("(style) missing OVERRIDING indicator in declaration of%", N);
end if;
end if;
@@ -259,7 +259,7 @@ package body Style is
procedure Subprogram_Not_In_Alpha_Order (Name : Node_Id) is
begin
if Style_Check_Order_Subprograms then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("(style) subprogram body& not in alphabetical order", Name);
end if;
end Subprogram_Not_In_Alpha_Order;
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb
index bf72722cc88..1c22dbcf707 100644
--- a/gcc/ada/styleg.adb
+++ b/gcc/ada/styleg.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -237,9 +237,11 @@ package body Styleg is
-- Otherwise we have an error
elsif Nkind (Orig) = N_Op_And then
- Error_Msg ("(style) `AND THEN` required", Sloc (Orig));
+ Error_Msg -- CODEFIX
+ ("(style) `AND THEN` required", Sloc (Orig));
else
- Error_Msg ("(style) `OR ELSE` required", Sloc (Orig));
+ Error_Msg -- CODEFIX
+ ("(style) `OR ELSE` required", Sloc (Orig));
end if;
end;
end if;
@@ -434,7 +436,8 @@ package body Styleg is
if Scan_Ptr > Source_First (Current_Source_File)
and then Source (Scan_Ptr - 1) > ' '
then
- Error_Msg_S ("(style) space required");
+ Error_Msg_S -- CODEFIX
+ ("(style) space required");
end if;
end if;
@@ -447,7 +450,8 @@ package body Styleg is
if Source (Scan_Ptr + 2) > ' '
and then not Is_Special_Character (Source (Scan_Ptr + 2))
then
- Error_Msg ("(style) space required", Scan_Ptr + 2);
+ Error_Msg -- CODEFIX
+ ("(style) space required", Scan_Ptr + 2);
end if;
end if;
@@ -505,7 +509,8 @@ package body Styleg is
if Is_Box_Comment then
Error_Space_Required (Scan_Ptr + 2);
else
- Error_Msg ("(style) two spaces required", Scan_Ptr + 2);
+ Error_Msg -- CODEFIX
+ ("(style) two spaces required", Scan_Ptr + 2);
end if;
return;
@@ -558,12 +563,12 @@ package body Styleg is
-- We expect one blank line, from the EOF, but no more than one
if Blank_Lines = 2 then
- Error_Msg
+ Error_Msg -- CODEFIX
("(style) blank line not allowed at end of file",
Blank_Line_Location);
elsif Blank_Lines >= 3 then
- Error_Msg
+ Error_Msg -- CODEFIX
("(style) blank lines not allowed at end of file",
Blank_Line_Location);
end if;
@@ -590,7 +595,8 @@ package body Styleg is
procedure Check_HT is
begin
if Style_Check_Horizontal_Tabs then
- Error_Msg_S ("(style) horizontal tab not allowed");
+ Error_Msg_S -- CODEFIX
+ ("(style) horizontal tab not allowed");
end if;
end Check_HT;
@@ -608,7 +614,8 @@ package body Styleg is
if Token_Ptr = First_Non_Blank_Location
and then Start_Column rem Style_Check_Indentation /= 0
then
- Error_Msg_SC ("(style) bad indentation");
+ Error_Msg_SC -- CODEFIX
+ ("(style) bad indentation");
end if;
end if;
end Check_Indentation;
@@ -682,9 +689,11 @@ package body Styleg is
if Style_Check_Form_Feeds then
if Source (Scan_Ptr) = ASCII.FF then
- Error_Msg_S ("(style) form feed not allowed");
+ Error_Msg_S -- CODEFIX
+ ("(style) form feed not allowed");
elsif Source (Scan_Ptr) = ASCII.VT then
- Error_Msg_S ("(style) vertical tab not allowed");
+ Error_Msg_S -- CODEFIX
+ ("(style) vertical tab not allowed");
end if;
end if;
@@ -717,7 +726,7 @@ package body Styleg is
-- Issue message for blanks at end of line if option enabled
if Style_Check_Blanks_At_End and then L < Len then
- Error_Msg
+ Error_Msg -- CODEFIX
("(style) trailing spaces not permitted", S);
end if;
@@ -913,7 +922,7 @@ package body Styleg is
else
if Token = Tok_Then then
- Error_Msg
+ Error_Msg -- CODEFIX
("(style) no statements may follow THEN on same line", S);
else
Error_Msg
@@ -977,7 +986,8 @@ package body Styleg is
procedure Check_Xtra_Parens (Loc : Source_Ptr) is
begin
if Style_Check_Xtra_Parens then
- Error_Msg ("redundant parentheses?", Loc);
+ Error_Msg -- CODEFIX
+ ("redundant parentheses?", Loc);
end if;
end Check_Xtra_Parens;
@@ -996,7 +1006,8 @@ package body Styleg is
procedure Error_Space_Not_Allowed (S : Source_Ptr) is
begin
- Error_Msg ("(style) space not allowed", S);
+ Error_Msg -- CODEFIX
+ ("(style) space not allowed", S);
end Error_Space_Not_Allowed;
--------------------------
@@ -1005,7 +1016,8 @@ package body Styleg is
procedure Error_Space_Required (S : Source_Ptr) is
begin
- Error_Msg ("(style) space required", S);
+ Error_Msg -- CODEFIX
+ ("(style) space required", S);
end Error_Space_Required;
--------------------
@@ -1037,7 +1049,8 @@ package body Styleg is
begin
if Style_Check_End_Labels then
Error_Msg_Node_1 := Name;
- Error_Msg_SP ("(style) `END &` required");
+ Error_Msg_SP -- CODEFIX
+ ("(style) `END &` required");
end if;
end No_End_Name;
@@ -1052,7 +1065,8 @@ package body Styleg is
begin
if Style_Check_End_Labels then
Error_Msg_Node_1 := Name;
- Error_Msg_SP ("(style) `EXIT &` required");
+ Error_Msg_SP -- CODEFIX
+ ("(style) `EXIT &` required");
end if;
end No_Exit_Name;
@@ -1067,7 +1081,7 @@ package body Styleg is
procedure Non_Lower_Case_Keyword is
begin
if Style_Check_Keyword_Casing then
- Error_Msg_SC -- CODEIX
+ Error_Msg_SC -- CODEFIX
("(style) reserved words must be all lower case");
end if;
end Non_Lower_Case_Keyword;
diff --git a/gcc/ada/switch-b.adb b/gcc/ada/switch-b.adb
index e3e597bcadf..b41296b2cc9 100644
--- a/gcc/ada/switch-b.adb
+++ b/gcc/ada/switch-b.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -23,9 +23,10 @@
-- --
------------------------------------------------------------------------------
-with Debug; use Debug;
-with Osint; use Osint;
-with Opt; use Opt;
+with Debug; use Debug;
+with Osint; use Osint;
+with Opt; use Opt;
+with Output; use Output;
with System.WCh_Con; use System.WCh_Con;
@@ -40,9 +41,35 @@ package body Switch.B is
Ptr : Integer := Switch_Chars'First;
C : Character := ' ';
+ function Get_Optional_Filename return String_Ptr;
+ -- If current character is '=', return a newly allocated string that
+ -- contains the remainder of the current switch (after the '='), else
+ -- return null.
+
function Get_Stack_Size (S : Character) return Int;
- -- Used for -d and -D to scan stack size including handling k/m.
- -- S is set to 'd' or 'D' to indicate the switch being scanned.
+ -- Used for -d and -D to scan stack size including handling k/m. S is
+ -- set to 'd' or 'D' to indicate the switch being scanned.
+
+ ---------------------------
+ -- Get_Optional_Filename --
+ ---------------------------
+
+ function Get_Optional_Filename return String_Ptr is
+ Result : String_Ptr;
+
+ begin
+ if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
+ if Ptr = Max then
+ Bad_Switch (Switch_Chars);
+ else
+ Result := new String'(Switch_Chars (Ptr + 1 .. Max));
+ Ptr := Max + 1;
+ return Result;
+ end if;
+ end if;
+
+ return null;
+ end Get_Optional_Filename;
--------------------
-- Get_Stack_Size --
@@ -61,11 +88,11 @@ package body Switch.B is
pragma Unsuppress (Overflow_Check);
begin
- -- Check for additional character 'k' (for kilobytes) or 'm'
- -- (for Megabytes), but only if we have not reached the end
- -- of the switch string. Note that if this appears before the
- -- end of the string we will get an error when we test to make
- -- sure that the string is exhausted (at the end of the case).
+ -- Check for additional character 'k' (for kilobytes) or 'm' (for
+ -- Megabytes), but only if we have not reached the end of the
+ -- switch string. Note that if this appears before the end of the
+ -- string we will get an error when we test to make sure that the
+ -- string is exhausted (at the end of the case).
if Ptr <= Max then
if Switch_Chars (Ptr) = 'k' then
@@ -97,8 +124,8 @@ package body Switch.B is
Ptr := Ptr + 1;
end if;
- -- A little check, "gnat" at the start of a switch is not allowed
- -- except for the compiler
+ -- A little check, "gnat" at the start of a switch is not allowed except
+ -- for the compiler
if Switch_Chars'Last >= Ptr + 3
and then Switch_Chars (Ptr .. Ptr + 3) = "gnat"
@@ -124,7 +151,8 @@ package body Switch.B is
when 'A' =>
Ptr := Ptr + 1;
- Ada_Bind_File := True;
+ Output_ALI_List := True;
+ ALI_List_Filename := Get_Optional_Filename;
-- Processing for b switch
@@ -136,16 +164,16 @@ package body Switch.B is
when 'c' =>
Ptr := Ptr + 1;
-
Check_Only := True;
-- Processing for C switch
when 'C' =>
Ptr := Ptr + 1;
-
Ada_Bind_File := False;
+ Write_Line ("warning: gnatbind switch -C is obsolescent");
+
-- Processing for d switch
when 'd' =>
@@ -243,6 +271,20 @@ package body Switch.B is
Ptr := Ptr + 1;
Usage_Requested := True;
+ -- Processing for H switch
+
+ when 'H' =>
+ if Ptr = Max then
+ Bad_Switch (Switch_Chars);
+ end if;
+
+ Ptr := Ptr + 1;
+ Scan_Nat (Switch_Chars, Max, Ptr, Heap_Size, C);
+
+ if Heap_Size /= 32 and then Heap_Size /= 64 then
+ Bad_Switch (Switch_Chars);
+ end if;
+
-- Processing for i switch
when 'i' =>
@@ -253,7 +295,7 @@ package body Switch.B is
Ptr := Ptr + 1;
C := Switch_Chars (Ptr);
- if C in '1' .. '5'
+ if C in '1' .. '5'
or else C = '8'
or else C = 'p'
or else C = 'f'
@@ -305,7 +347,6 @@ package body Switch.B is
if Output_File_Name_Present then
Osint.Fail ("duplicate -o switch");
-
else
Output_File_Name_Present := True;
end if;
@@ -315,6 +356,7 @@ package body Switch.B is
when 'O' =>
Ptr := Ptr + 1;
Output_Object_List := True;
+ Object_List_Filename := Get_Optional_Filename;
-- Processing for p switch
@@ -338,7 +380,6 @@ package body Switch.B is
when 'R' =>
Ptr := Ptr + 1;
- Check_Only := True;
List_Closure := True;
-- Processing for s switch
@@ -400,7 +441,6 @@ package body Switch.B is
Ptr := Ptr + 1;
case Switch_Chars (Ptr) is
-
when 'e' =>
Warning_Mode := Treat_As_Error;
@@ -433,8 +473,7 @@ package body Switch.B is
Wide_Character_Encoding_Method_Specified := True;
Upper_Half_Encoding :=
- Wide_Character_Encoding_Method in
- WC_Upper_Half_Encoding_Method;
+ Wide_Character_Encoding_Method in WC_Upper_Half_Encoding_Method;
Ptr := Ptr + 1;
@@ -486,7 +525,7 @@ package body Switch.B is
Osint.Fail ("missing path for --RTS");
else
- -- valid --RTS switch
+ -- Valid --RTS switch
Opt.No_Stdinc := True;
Opt.RTS_Switch := True;
@@ -508,8 +547,8 @@ package body Switch.B is
Lib_Path_Name /= null
then
-- Set the RTS_*_Path_Name variables, so that the
- -- correct directories will be set when
- -- Osint.Add_Default_Search_Dirs will be called later.
+ -- correct directories will be set when a subsequent
+ -- call Osint.Add_Default_Search_Dirs is made.
RTS_Src_Path_Name := Src_Path_Name;
RTS_Lib_Path_Name := Lib_Path_Name;
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 7b194107ff6..ab213af14bb 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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,8 +32,7 @@ with Validsw; use Validsw;
with Sem_Warn; use Sem_Warn;
with Stylesw; use Stylesw;
-with System.OS_Lib; use System.OS_Lib;
-
+with System.Strings;
with System.WCh_Con; use System.WCh_Con;
package body Switch.C is
@@ -41,11 +40,25 @@ package body Switch.C is
RTS_Specified : String_Access := null;
-- Used to detect multiple use of --RTS= flag
+ function Switch_Subsequently_Cancelled
+ (C : String;
+ Args : Argument_List;
+ Arg_Rank : Positive) return Boolean;
+ -- This function is called from Scan_Front_End_Switches. It determines if
+ -- the switch currently being scanned is followed by a switch of the form
+ -- "-gnat-" & C, where C is the argument. If so, then True is returned,
+ -- and Scan_Front_End_Switches will cancel the effect of the switch. If
+ -- no such switch is found, False is returned.
+
-----------------------------
-- Scan_Front_End_Switches --
-----------------------------
- procedure Scan_Front_End_Switches (Switch_Chars : String) is
+ procedure Scan_Front_End_Switches
+ (Switch_Chars : String;
+ Args : Argument_List;
+ Arg_Rank : Positive)
+ is
First_Switch : Boolean := True;
-- False for all but first switch
@@ -519,11 +532,11 @@ package body Switch.C is
System_Extend_Unit := Empty;
Warning_Mode := Treat_As_Error;
- -- Set Ada 2005 mode explicitly. We don't want to rely on the
+ -- Set Ada 2012 mode explicitly. We don't want to rely on the
-- implicit setting here, since for example, we want
-- Preelaborate_05 treated as Preelaborate
- Ada_Version := Ada_05;
+ Ada_Version := Ada_12;
Ada_Version_Explicit := Ada_Version;
-- Set default warnings and style checks for -gnatg
@@ -662,20 +675,27 @@ package body Switch.C is
when 'p' =>
Ptr := Ptr + 1;
- -- Set all specific options as well as All_Checks in the
- -- Suppress_Options array, excluding Elaboration_Check, since
- -- this is treated specially because we do not want -gnatp to
- -- disable static elaboration processing.
+ -- Skip processing if cancelled by subsequent -gnat-p
- for J in Suppress_Options'Range loop
- if J /= Elaboration_Check then
- Suppress_Options (J) := True;
- end if;
- end loop;
+ if Switch_Subsequently_Cancelled ("p", Args, Arg_Rank) then
+ Store_Switch := False;
- Validity_Checks_On := False;
- Opt.Suppress_Checks := True;
- Opt.Enable_Overflow_Checks := False;
+ else
+ -- Set all specific options as well as All_Checks in the
+ -- Suppress_Options array, excluding Elaboration_Check,
+ -- since this is treated specially because we do not want
+ -- -gnatp to disable static elaboration processing.
+
+ for J in Suppress_Options'Range loop
+ if J /= Elaboration_Check then
+ Suppress_Options (J) := True;
+ end if;
+ end loop;
+
+ Validity_Checks_On := False;
+ Opt.Suppress_Checks := True;
+ Opt.Enable_Overflow_Checks := False;
+ end if;
-- Processing for P switch
@@ -883,6 +903,8 @@ package body Switch.C is
when 'X' =>
Ptr := Ptr + 1;
Extensions_Allowed := True;
+ Ada_Version := Ada_Version_Type'Last;
+ Ada_Version_Explicit := Ada_Version_Type'Last;
-- Processing for y switch
@@ -933,6 +955,7 @@ package body Switch.C is
-- Processing for z switch
when 'z' =>
+
-- -gnatz must be the first and only switch in Switch_Chars,
-- and is a two-letter switch.
@@ -1027,11 +1050,68 @@ package body Switch.C is
Ada_Version_Explicit := Ada_Version;
end if;
- -- Ignore extra switch character
+ -- Processing for 12 switch
+
+ when '1' =>
+ if Ptr = Max then
+ Bad_Switch ("-gnat1");
+ end if;
- when '/' | '-' =>
Ptr := Ptr + 1;
+ if Switch_Chars (Ptr) /= '2' then
+ Bad_Switch ("-gnat1" & Switch_Chars (Ptr .. Max));
+ else
+ Ptr := Ptr + 1;
+ Ada_Version := Ada_12;
+ Ada_Version_Explicit := Ada_Version;
+ end if;
+
+ -- Processing for 2005 and 2012 switches
+
+ when '2' =>
+ if Ptr > Max - 3 then
+ Bad_Switch ("-gnat" & Switch_Chars (Ptr .. Max));
+
+ elsif Switch_Chars (Ptr .. Ptr + 3) = "2005" then
+ Ada_Version := Ada_05;
+
+ elsif Switch_Chars (Ptr .. Ptr + 3) = "2012" then
+ Ada_Version := Ada_12;
+
+ else
+ Bad_Switch ("-gnat" & Switch_Chars (Ptr .. Ptr + 3));
+ end if;
+
+ Ada_Version_Explicit := Ada_Version;
+ Ptr := Ptr + 4;
+
+ -- Switch cancellation, currently only -gnat-p is allowed.
+ -- All we do here is the error checking, since the actual
+ -- processing for switch cancellation is done by calls to
+ -- Switch_Subsequently_Cancelled at the appropriate point.
+
+ when '-' =>
+
+ -- Simple ignore -gnat-p
+
+ if Switch_Chars = "-gnat-p" then
+ return;
+
+ -- Any other occurrence of minus is ignored. This is for
+ -- maximum compatibility with previous version which ignored
+ -- all occurrences of minus.
+
+ else
+ Store_Switch := False;
+ Ptr := Ptr + 1;
+ end if;
+
+ -- We ignore '/' in switches, this is historical, still needed???
+
+ when '/' =>
+ Store_Switch := False;
+
-- Anything else is an error (illegal switch character)
when others =>
@@ -1048,4 +1128,29 @@ package body Switch.C is
end if;
end Scan_Front_End_Switches;
+ -----------------------------------
+ -- Switch_Subsequently_Cancelled --
+ -----------------------------------
+
+ function Switch_Subsequently_Cancelled
+ (C : String;
+ Args : Argument_List;
+ Arg_Rank : Positive) return Boolean
+ is
+ use type System.Strings.String_Access;
+
+ begin
+ -- Loop through arguments following the current one
+
+ for Arg in Arg_Rank + 1 .. Args'Last loop
+ if Args (Arg).all = "-gnat-" & C then
+ return True;
+ end if;
+ end loop;
+
+ -- No match found, not cancelled
+
+ return False;
+ end Switch_Subsequently_Cancelled;
+
end Switch.C;
diff --git a/gcc/ada/switch-c.ads b/gcc/ada/switch-c.ads
index 09ac49ecb57..1595858a28d 100644
--- a/gcc/ada/switch-c.ads
+++ b/gcc/ada/switch-c.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, 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,15 +29,24 @@
-- switches that are recognized. In addition, package Debug documents
-- the otherwise undocumented debug switches that are also recognized.
+with System.OS_Lib; use System.OS_Lib;
+
package Switch.C is
- procedure Scan_Front_End_Switches (Switch_Chars : String);
+ procedure Scan_Front_End_Switches
+ (Switch_Chars : String;
+ Args : Argument_List;
+ Arg_Rank : Positive);
-- Procedures to scan out front end switches stored in the given string.
-- The first character is known to be a valid switch character, and there
-- are no blanks or other switch terminator characters in the string, so
-- the entire string should consist of valid switch characters, except that
-- an optional terminating NUL character is allowed. A bad switch causes
-- a fatal error exit and control does not return. The call also sets
- -- Usage_Requested to True if a ? switch is encountered.
+ -- Usage_Requested to True if a switch -gnath is encountered.
+ --
+ -- Args is the full list of command line arguments. Arg_Rank is the
+ -- position of the switch in Args. It is used for certain switches -gnatx
+ -- to check if a subsequent switch -gnat-x cancels the switch -gnatx.
end Switch.C;
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb
index a7a8d192626..11491d3de42 100644
--- a/gcc/ada/switch-m.adb
+++ b/gcc/ada/switch-m.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
@@ -71,7 +71,7 @@ package body Switch.M is
procedure Add_Switch_Component (S : String);
-- Add a new String_Access component in Switches. If a string equal
-- to S is already stored in the table Normalized_Switches, use it.
- -- Other wise add a new component to the table.
+ -- Otherwise add a new component to the table.
--------------------------
-- Add_Switch_Component --
@@ -215,10 +215,10 @@ package body Switch.M is
-- One-letter switches
- when 'a' | 'A' | 'b' | 'c' | 'D' | 'E' | 'f' |
- 'F' | 'g' | 'h' | 'H' | 'k' | 'l' | 'L' | 'n' | 'N' |
- 'o' | 'O' | 'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 't' |
- 'u' | 'U' | 'v' | 'x' | 'X' | 'Z' =>
+ when 'a' | 'A' | 'b' | 'B' | 'c' | 'C' | 'E' | 'f' |
+ 'F' | 'g' | 'h' | 'H' | 'I' | 'L' | 'n' | 'N' |
+ 'o' | 'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 'S' |
+ 't' | 'u' | 'U' | 'v' | 'x' | 'X' | 'Z' =>
Storing (First_Stored) := C;
Add_Switch_Component
(Storing (Storing'First .. First_Stored));
@@ -226,10 +226,14 @@ package body Switch.M is
-- One-letter switches followed by a positive number
- when 'm' | 'T' =>
+ when 'D' | 'G' | 'j' | 'k' | 'm' | 'T' =>
Storing (First_Stored) := C;
Last_Stored := First_Stored;
+ if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
+ Ptr := Ptr + 1;
+ end if;
+
loop
Ptr := Ptr + 1;
exit when Ptr > Max
@@ -268,63 +272,93 @@ package body Switch.M is
when 'e' =>
- -- Store -gnateD, -gnatep= and -gnateG in the ALI file.
- -- The other -gnate switches do not need to be stored.
+ -- Some of the gnate... switches are not stored
Storing (First_Stored) := 'e';
Ptr := Ptr + 1;
- if Ptr > Max
- or else (Switch_Chars (Ptr) /= 'D'
- and then Switch_Chars (Ptr) /= 'G'
- and then Switch_Chars (Ptr) /= 'p')
- then
+ if Ptr > Max then
Last := 0;
return;
- end if;
- -- Processing for -gnateD
+ else
+ case Switch_Chars (Ptr) is
- if Switch_Chars (Ptr) = 'D' then
- Storing (First_Stored + 1 ..
- First_Stored + Max - Ptr + 1) :=
- Switch_Chars (Ptr .. Max);
- Add_Switch_Component
- (Storing (Storing'First ..
- First_Stored + Max - Ptr + 1));
+ when 'D' =>
+ Storing (First_Stored + 1 ..
+ First_Stored + Max - Ptr + 1) :=
+ Switch_Chars (Ptr .. Max);
+ Add_Switch_Component
+ (Storing (Storing'First ..
+ First_Stored + Max - Ptr + 1));
+ Ptr := Max + 1;
- -- Processing for -gnatep=
+ when 'G' =>
+ Ptr := Ptr + 1;
+ Add_Switch_Component ("-gnateG");
- elsif Switch_Chars (Ptr) = 'p' then
- Ptr := Ptr + 1;
+ when 'I' =>
+ Ptr := Ptr + 1;
- if Ptr = Max then
- Last := 0;
- return;
- end if;
+ declare
+ First : constant Positive := Ptr - 1;
+ begin
+ if Ptr <= Max and then
+ Switch_Chars (Ptr) = '='
+ then
+ Ptr := Ptr + 1;
+ end if;
+
+ while Ptr <= Max and then
+ Switch_Chars (Ptr) in '0' .. '9'
+ loop
+ Ptr := Ptr + 1;
+ end loop;
+
+ Storing (First_Stored + 1 ..
+ First_Stored + Ptr - First) :=
+ Switch_Chars (First .. Ptr - 1);
+ Add_Switch_Component
+ (Storing (Storing'First ..
+ First_Stored + Ptr - First));
+ end;
+
+ when 'p' =>
+ Ptr := Ptr + 1;
- if Switch_Chars (Ptr) = '=' then
- Ptr := Ptr + 1;
- end if;
+ if Ptr = Max then
+ Last := 0;
+ return;
+ end if;
- -- To normalize, always put a '=' after -gnatep.
- -- Because that could lengthen the switch string,
- -- declare a local variable.
-
- declare
- To_Store : String (1 .. Max - Ptr + 9);
- begin
- To_Store (1 .. 8) := "-gnatep=";
- To_Store (9 .. Max - Ptr + 9) :=
- Switch_Chars (Ptr .. Max);
- Add_Switch_Component (To_Store);
- end;
-
- elsif Switch_Chars (Ptr) = 'G' then
- Add_Switch_Component ("-gnateG");
- end if;
+ if Switch_Chars (Ptr) = '=' then
+ Ptr := Ptr + 1;
+ end if;
- return;
+ -- To normalize, always put a '=' after
+ -- -gnatep. Because that could lengthen the
+ -- switch string, declare a local variable.
+
+ declare
+ To_Store : String (1 .. Max - Ptr + 9);
+ begin
+ To_Store (1 .. 8) := "-gnatep=";
+ To_Store (9 .. Max - Ptr + 9) :=
+ Switch_Chars (Ptr .. Max);
+ Add_Switch_Component (To_Store);
+ end;
+
+ return;
+
+ when 'S' =>
+ Ptr := Ptr + 1;
+ Add_Switch_Component ("-gnateS");
+
+ when others =>
+ Last := 0;
+ return;
+ end case;
+ end if;
when 'i' =>
Storing (First_Stored) := 'i';
@@ -355,6 +389,20 @@ package body Switch.M is
return;
end if;
+ -- -gnatl may be -gnatl=<file name>
+
+ when 'l' =>
+ Ptr := Ptr + 1;
+
+ if Ptr > Max or else Switch_Chars (Ptr) /= '=' then
+ Add_Switch_Component ("-gnatl");
+
+ else
+ Add_Switch_Component
+ ("-gnatl" & Switch_Chars (Ptr .. Max));
+ return;
+ end if;
+
-- -gnatR may be followed by '0', '1', '2' or '3',
-- then by 's'
@@ -390,6 +438,26 @@ package body Switch.M is
Add_Switch_Component
(Storing (Storing'First .. Last_Stored));
+ -- -gnatWx, x = 'h'. 'u', 's', 'e', '8' or 'b'
+
+ when 'W' =>
+ Storing (First_Stored) := 'W';
+ Ptr := Ptr + 1;
+
+ if Ptr <= Max then
+ case Switch_Chars (Ptr) is
+ when 'h' | 'u' | 's' | 'e' | '8' | 'b' =>
+ Storing (First_Stored + 1) := Switch_Chars (Ptr);
+ Add_Switch_Component
+ (Storing (Storing'First .. First_Stored + 1));
+ Ptr := Ptr + 1;
+
+ when others =>
+ Last := 0;
+ return;
+ end case;
+ end if;
+
-- Multiple switches
when 'V' | 'w' | 'y' =>
@@ -584,6 +652,9 @@ package body Switch.M is
(Switch_Chars'First + Subdirs_Option'Length ..
Switch_Chars'Last));
+ elsif Switch_Chars = Makeutl.Unchecked_Shared_Lib_Imports then
+ Opt.Unchecked_Shared_Lib_Imports := True;
+
elsif Switch_Chars (Ptr) = '-' then
Bad_Switch (Switch_Chars);
@@ -839,6 +910,7 @@ package body Switch.M is
when 'x' =>
External_Unit_Compilation_Allowed := True;
+ Use_Include_Path_File := True;
-- Processing for z switch
diff --git a/gcc/ada/switch-m.ads b/gcc/ada/switch-m.ads
index 6a800234083..de7ccaf5d5d 100644
--- a/gcc/ada/switch-m.ads
+++ b/gcc/ada/switch-m.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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,7 +29,11 @@
-- switches that are recognized. In addition, package Debug documents
-- the otherwise undocumented debug switches that are also recognized.
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.OS_Lib; use System.OS_Lib;
+pragma Warnings (On);
+
with Prj.Tree;
package Switch.M is
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 5af4299e88c..c978c036a35 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2009, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2010, 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- *
@@ -34,7 +34,7 @@
#ifdef __vxworks
#include "ioLib.h"
-#if ! defined (__VXWORKSMILS__)
+#if ! defined (VTHREADS)
#include "dosFsLib.h"
#endif
#if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__))
@@ -158,7 +158,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
*/
-#if defined(WINNT) || defined (MSDOS) || defined (__EMX__)
+#if defined(WINNT)
static const char *mode_read_text = "rt";
static const char *mode_write_text = "wt";
static const char *mode_append_text = "at";
@@ -345,7 +345,7 @@ __gnat_ttyname (int filedes)
}
#endif
-#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
+#if defined (linux) || defined (sun) || defined (sgi) \
|| (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \
|| defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
|| (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \
@@ -403,7 +403,7 @@ getc_immediate_common (FILE *stream,
int *avail,
int waiting)
{
-#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
+#if defined (linux) || defined (sun) || defined (sgi) \
|| (defined (__osf__) && ! defined (__alpha_vxworks)) \
|| defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \
@@ -424,7 +424,7 @@ getc_immediate_common (FILE *stream,
/* Set RAW mode, with no echo */
termios_rec.c_lflag = termios_rec.c_lflag & ~ICANON & ~ECHO;
-#if defined(linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
+#if defined(linux) || defined (sun) || defined (sgi) \
|| defined (__osf__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
@@ -433,18 +433,12 @@ getc_immediate_common (FILE *stream,
/* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
a character forever. This doesn't seem to effect Ctrl-Z or
- Ctrl-C processing except on OS/2 where Ctrl-C won't work right
- unless we do a read loop. Luckily we can delay a bit between
- iterations. If not waiting (i.e. Get_Immediate (Char, Available)),
+ Ctrl-C processing.
+ If not waiting (i.e. Get_Immediate (Char, Available)),
don't wait for anything but timeout immediately. */
-#ifdef __EMX__
- termios_rec.c_cc[VMIN] = 0;
- termios_rec.c_cc[VTIME] = waiting;
-#else
termios_rec.c_cc[VMIN] = waiting;
termios_rec.c_cc[VTIME] = 0;
#endif
-#endif
tcsetattr (fd, TCSANOW, &termios_rec);
while (! good_one)
@@ -720,7 +714,7 @@ long __gnat_invalid_tzoff = 259273;
/* Definition of __gnat_localtime_r used by a-calend.adb */
-#if defined (__EMX__) || defined (__MINGW32__)
+#if defined (__MINGW32__)
#ifdef CERT
@@ -743,7 +737,7 @@ extern void (*Unlock_Task) (void);
#endif
-/* Reentrant localtime for Windows and OS/2. */
+/* Reentrant localtime for Windows. */
extern void
__gnat_localtime_tzoff (const time_t *, long *);
@@ -987,7 +981,7 @@ __gnat_is_file_not_found_error (int errno_val) {
/* In the case of VxWorks, we also have to take into account various
* filesystem-specific variants of this error.
*/
-#if ! defined (__VXWORKSMILS__)
+#if ! defined (VTHREADS)
case S_dosFsLib_FILE_NOT_FOUND:
#endif
#if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__))
diff --git a/gcc/ada/system-vms-ia64.ads b/gcc/ada/system-vms-ia64.ads
index 57fece94076..f5d806ddf77 100644
--- a/gcc/ada/system-vms-ia64.ads
+++ b/gcc/ada/system-vms-ia64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OpenVMS 64bit Itanium GCC_ZCX DEC Threads Version) --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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 --
@@ -239,7 +239,7 @@ private
-- Special VMS Interfaces --
----------------------------
- procedure Lib_Stop (I : Integer);
+ procedure Lib_Stop (Cond_Value : Integer);
pragma Interface (C, Lib_Stop);
pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value));
-- Interface to VMS condition handling. Used by RTSfind and pragma
@@ -251,4 +251,7 @@ private
-- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug.
-- Do not remove!
+ pragma Ident ("GNAT"); -- Gnat_Static_Version_String
+ -- Default ident for all VMS images.
+
end System;
diff --git a/gcc/ada/system-vms-zcx.ads b/gcc/ada/system-vms-zcx.ads
deleted file mode 100644
index 5b4c3edb5d6..00000000000
--- a/gcc/ada/system-vms-zcx.ads
+++ /dev/null
@@ -1,232 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M --
--- --
--- S p e c --
--- (OpenVMS GCC_ZCX DEC Threads Version) --
--- --
--- Copyright (C) 2002-2009, 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 --
--- apply solely to the contents of the part following the private keyword. --
--- --
--- 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- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.gnu.org/licenses/>. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
-package System is
- pragma Pure;
- -- Note that we take advantage of the implementation permission to make
- -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
- -- 2005, this is Pure in any case (AI-362).
-
- type Name is (SYSTEM_NAME_GNAT);
- System_Name : constant Name := SYSTEM_NAME_GNAT;
-
- -- System-Dependent Named Numbers
-
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
-
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
-
- Max_Base_Digits : constant := Long_Long_Float'Digits;
- Max_Digits : constant := Long_Long_Float'Digits;
-
- Max_Mantissa : constant := 63;
- Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
-
- Tick : constant := 0.01;
-
- -- Storage-related Declarations
-
- type Address is private;
- pragma Preelaborable_Initialization (Address);
- Null_Address : constant Address;
-
- Storage_Unit : constant := 8;
- Word_Size : constant := 32;
- Memory_Size : constant := 2 ** 32;
-
- -- Address comparison
-
- function "<" (Left, Right : Address) return Boolean;
- function "<=" (Left, Right : Address) return Boolean;
- function ">" (Left, Right : Address) return Boolean;
- function ">=" (Left, Right : Address) return Boolean;
- function "=" (Left, Right : Address) return Boolean;
-
- pragma Import (Intrinsic, "<");
- pragma Import (Intrinsic, "<=");
- pragma Import (Intrinsic, ">");
- pragma Import (Intrinsic, ">=");
- pragma Import (Intrinsic, "=");
-
- -- Other System-Dependent Declarations
-
- type Bit_Order is (High_Order_First, Low_Order_First);
- Default_Bit_Order : constant Bit_Order := Low_Order_First;
- pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
-
- -- Priority-related Declarations (RM D.1)
-
- Max_Priority : constant Positive := 30;
- Max_Interrupt_Priority : constant Positive := 31;
-
- subtype Any_Priority is Integer range 0 .. 31;
- subtype Priority is Any_Priority range 0 .. 30;
- subtype Interrupt_Priority is Any_Priority range 31 .. 31;
-
- Default_Priority : constant Priority := 15;
-
-private
-
- type Address is mod Memory_Size;
- Null_Address : constant Address := 0;
-
- --------------------------------------
- -- System Implementation Parameters --
- --------------------------------------
-
- -- These parameters provide information about the target that is used
- -- by the compiler. They are in the private part of System, where they
- -- can be accessed using the special circuitry in the Targparm unit
- -- whose source should be consulted for more detailed descriptions
- -- of the individual switch values.
-
- Backend_Divide_Checks : constant Boolean := False;
- Backend_Overflow_Checks : constant Boolean := True;
- Command_Line_Args : constant Boolean := True;
- Configurable_Run_Time : constant Boolean := False;
- Denorm : constant Boolean := False;
- Duration_32_Bits : constant Boolean := False;
- Exit_Status_Supported : constant Boolean := True;
- Fractional_Fixed_Ops : constant Boolean := False;
- Frontend_Layout : constant Boolean := False;
- Machine_Overflows : constant Boolean := False;
- Machine_Rounds : constant Boolean := True;
- OpenVMS : constant Boolean := True;
- Preallocated_Stacks : constant Boolean := False;
- Signed_Zeros : constant Boolean := True;
- Stack_Check_Default : constant Boolean := True;
- Stack_Check_Probes : constant Boolean := True;
- Stack_Check_Limits : constant Boolean := False;
- Support_64_Bit_Divides : constant Boolean := True;
- Support_Aggregates : constant Boolean := True;
- Support_Composite_Assign : constant Boolean := True;
- Support_Composite_Compare : constant Boolean := True;
- Support_Long_Shifts : constant Boolean := True;
- Always_Compatible_Rep : constant Boolean := True;
- Suppress_Standard_Library : constant Boolean := False;
- Use_Ada_Main_Program_Name : constant Boolean := False;
- ZCX_By_Default : constant Boolean := True;
- GCC_ZCX_Support : constant Boolean := True;
-
- --------------------------
- -- Underlying Priorities --
- ---------------------------
-
- -- Important note: this section of the file must come AFTER the
- -- definition of the system implementation parameters to ensure
- -- that the value of these parameters is available for analysis
- -- of the declarations here (using Rtsfind at compile time).
-
- -- The underlying priorities table provides a generalized mechanism
- -- for mapping from Ada priorities to system priorities. In some
- -- cases a 1-1 mapping is not the convenient or optimal choice.
-
- -- For DEC Threads OpenVMS, we use the full range of 31 priorities
- -- in the Ada model, but map them by compression onto the more limited
- -- range of priorities available in OpenVMS.
-
- -- To replace the default values of the Underlying_Priorities mapping,
- -- copy this source file into your build directory, edit the file to
- -- reflect your desired behavior, and recompile with the command:
-
- -- $ gcc -c -O3 -gnatpgn system.ads
-
- -- then recompile the run-time parts that depend on this package:
-
- -- $ gnatmake -a -gnatn -O3 <your application>
-
- -- then force rebuilding your application if you need different options:
-
- -- $ gnatmake -f <your options> <your application>
-
- type Priorities_Mapping is array (Any_Priority) of Integer;
- pragma Suppress_Initialization (Priorities_Mapping);
- -- Suppress initialization in case gnat.adc specifies Normalize_Scalars
-
- Underlying_Priorities : constant Priorities_Mapping :=
-
- (Priority'First => 16,
-
- 1 => 17,
- 2 => 18,
- 3 => 18,
- 4 => 18,
- 5 => 18,
- 6 => 19,
- 7 => 19,
- 8 => 19,
- 9 => 20,
- 10 => 20,
- 11 => 21,
- 12 => 21,
- 13 => 22,
- 14 => 23,
-
- Default_Priority => 24,
-
- 16 => 25,
- 17 => 25,
- 18 => 25,
- 19 => 26,
- 20 => 26,
- 21 => 26,
- 22 => 27,
- 23 => 27,
- 24 => 27,
- 25 => 28,
- 26 => 28,
- 27 => 29,
- 28 => 29,
- 29 => 30,
-
- Priority'Last => 30,
-
- Interrupt_Priority => 31);
-
- ----------------------------
- -- Special VMS Interfaces --
- ----------------------------
-
- procedure Lib_Stop (I : Integer);
- pragma Interface (C, Lib_Stop);
- pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value));
- -- Interface to VMS condition handling. Used by RTSfind and pragma
- -- {Import,Export}_Exception. Put here because this is the only
- -- VMS specific package that doesn't drag in tasking.
-
-end System;
diff --git a/gcc/ada/system-vms.ads b/gcc/ada/system-vms.ads
deleted file mode 100644
index 4b6f1eacdad..00000000000
--- a/gcc/ada/system-vms.ads
+++ /dev/null
@@ -1,237 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M --
--- --
--- S p e c --
--- (OpenVMS DEC Threads Version) --
--- --
--- Copyright (C) 1992-2009, 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 --
--- apply solely to the contents of the part following the private keyword. --
--- --
--- 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- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.gnu.org/licenses/>. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
-package System is
- pragma Pure;
- -- Note that we take advantage of the implementation permission to make
- -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
- -- 2005, this is Pure in any case (AI-362).
-
- type Name is (SYSTEM_NAME_GNAT);
- System_Name : constant Name := SYSTEM_NAME_GNAT;
-
- -- System-Dependent Named Numbers
-
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
-
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
-
- Max_Base_Digits : constant := Long_Long_Float'Digits;
- Max_Digits : constant := Long_Long_Float'Digits;
-
- Max_Mantissa : constant := 63;
- Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
-
- Tick : constant := 0.01;
-
- -- Storage-related Declarations
-
- type Address is private;
- pragma Preelaborable_Initialization (Address);
- Null_Address : constant Address;
-
- Storage_Unit : constant := 8;
- Word_Size : constant := 32;
- Memory_Size : constant := 2 ** 32;
-
- -- Address comparison
-
- function "<" (Left, Right : Address) return Boolean;
- function "<=" (Left, Right : Address) return Boolean;
- function ">" (Left, Right : Address) return Boolean;
- function ">=" (Left, Right : Address) return Boolean;
- function "=" (Left, Right : Address) return Boolean;
-
- pragma Import (Intrinsic, "<");
- pragma Import (Intrinsic, "<=");
- pragma Import (Intrinsic, ">");
- pragma Import (Intrinsic, ">=");
- pragma Import (Intrinsic, "=");
-
- -- Other System-Dependent Declarations
-
- type Bit_Order is (High_Order_First, Low_Order_First);
- Default_Bit_Order : constant Bit_Order := Low_Order_First;
- pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
-
- -- Priority-related Declarations (RM D.1)
-
- Max_Priority : constant Positive := 30;
- Max_Interrupt_Priority : constant Positive := 31;
-
- subtype Any_Priority is Integer range 0 .. 31;
- subtype Priority is Any_Priority range 0 .. 30;
- subtype Interrupt_Priority is Any_Priority range 31 .. 31;
-
- Default_Priority : constant Priority := 15;
-
-private
-
- type Address is mod Memory_Size;
- Null_Address : constant Address := 0;
-
- --------------------------------------
- -- System Implementation Parameters --
- --------------------------------------
-
- -- These parameters provide information about the target that is used
- -- by the compiler. They are in the private part of System, where they
- -- can be accessed using the special circuitry in the Targparm unit
- -- whose source should be consulted for more detailed descriptions
- -- of the individual switch values.
-
- Backend_Divide_Checks : constant Boolean := False;
- Backend_Overflow_Checks : constant Boolean := True;
- Command_Line_Args : constant Boolean := True;
- Configurable_Run_Time : constant Boolean := False;
- Denorm : constant Boolean := False;
- Duration_32_Bits : constant Boolean := False;
- Exit_Status_Supported : constant Boolean := True;
- Fractional_Fixed_Ops : constant Boolean := False;
- Frontend_Layout : constant Boolean := False;
- Machine_Overflows : constant Boolean := False;
- Machine_Rounds : constant Boolean := True;
- OpenVMS : constant Boolean := True;
- Preallocated_Stacks : constant Boolean := False;
- Signed_Zeros : constant Boolean := True;
- Stack_Check_Default : constant Boolean := True;
- Stack_Check_Probes : constant Boolean := True;
- Stack_Check_Limits : constant Boolean := False;
- Support_64_Bit_Divides : constant Boolean := True;
- Support_Aggregates : constant Boolean := True;
- Support_Composite_Assign : constant Boolean := True;
- Support_Composite_Compare : constant Boolean := True;
- Support_Long_Shifts : constant Boolean := True;
- Always_Compatible_Rep : constant Boolean := True;
- Suppress_Standard_Library : constant Boolean := False;
- Use_Ada_Main_Program_Name : constant Boolean := False;
- ZCX_By_Default : constant Boolean := True;
- GCC_ZCX_Support : constant Boolean := False;
-
- --------------------------
- -- Underlying Priorities --
- ---------------------------
-
- -- Important note: this section of the file must come AFTER the
- -- definition of the system implementation parameters to ensure
- -- that the value of these parameters is available for analysis
- -- of the declarations here (using Rtsfind at compile time).
-
- -- The underlying priorities table provides a generalized mechanism
- -- for mapping from Ada priorities to system priorities. In some
- -- cases a 1-1 mapping is not the convenient or optimal choice.
-
- -- For DEC Threads OpenVMS, we use the full range of 31 priorities
- -- in the Ada model, but map them by compression onto the more limited
- -- range of priorities available in OpenVMS.
-
- -- To replace the default values of the Underlying_Priorities mapping,
- -- copy this source file into your build directory, edit the file to
- -- reflect your desired behavior, and recompile with the command:
-
- -- $ gcc -c -O3 -gnatpgn system.ads
-
- -- then recompile the run-time parts that depend on this package:
-
- -- $ gnatmake -a -gnatn -O3 <your application>
-
- -- then force rebuilding your application if you need different options:
-
- -- $ gnatmake -f <your options> <your application>
-
- type Priorities_Mapping is array (Any_Priority) of Integer;
- pragma Suppress_Initialization (Priorities_Mapping);
- -- Suppress initialization in case gnat.adc specifies Normalize_Scalars
-
- Underlying_Priorities : constant Priorities_Mapping :=
-
- (Priority'First => 16,
-
- 1 => 17,
- 2 => 18,
- 3 => 18,
- 4 => 18,
- 5 => 18,
- 6 => 19,
- 7 => 19,
- 8 => 19,
- 9 => 20,
- 10 => 20,
- 11 => 21,
- 12 => 21,
- 13 => 22,
- 14 => 23,
-
- Default_Priority => 24,
-
- 16 => 25,
- 17 => 25,
- 18 => 25,
- 19 => 26,
- 20 => 26,
- 21 => 26,
- 22 => 27,
- 23 => 27,
- 24 => 27,
- 25 => 28,
- 26 => 28,
- 27 => 29,
- 28 => 29,
- 29 => 30,
-
- Priority'Last => 30,
-
- Interrupt_Priority => 31);
-
- ----------------------------
- -- Special VMS Interfaces --
- ----------------------------
-
- procedure Lib_Stop (I : Integer);
- pragma Interface (C, Lib_Stop);
- pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value));
- -- Interface to VMS condition handling. Used by RTSfind and pragma
- -- {Import,Export}_Exception. Put here because this is the only
- -- VMS specific package that doesn't drag in tasking.
-
- ADA_GNAT : constant Boolean := True;
- pragma Export_Object (ADA_GNAT, "ADA$GNAT");
- -- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug.
- -- Do not remove!
-
-end System;
diff --git a/gcc/ada/system-vms_64.ads b/gcc/ada/system-vms_64.ads
index 17b1ab81504..2934699420a 100644
--- a/gcc/ada/system-vms_64.ads
+++ b/gcc/ada/system-vms_64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OpenVMS 64bit GCC_ZCX DEC Threads Version) --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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 --
@@ -239,7 +239,7 @@ private
-- Special VMS Interfaces --
----------------------------
- procedure Lib_Stop (I : Integer);
+ procedure Lib_Stop (Cond_Value : Integer);
pragma Interface (C, Lib_Stop);
pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value));
-- Interface to VMS condition handling. Used by RTSfind and pragma
@@ -251,4 +251,7 @@ private
-- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug.
-- Do not remove!
+ pragma Ident ("GNAT"); -- Gnat_Static_Version_String
+ -- Default ident for all VMS images.
+
end System;
diff --git a/gcc/ada/tbuild.adb b/gcc/ada/tbuild.adb
index 3da3c611198..ed9a7138c43 100644
--- a/gcc/ada/tbuild.adb
+++ b/gcc/ada/tbuild.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -442,9 +442,9 @@ package body Tbuild is
function Make_Temporary
(Loc : Source_Ptr;
Id : Character;
- Related_Node : Node_Id := Empty) return Node_Id
+ Related_Node : Node_Id := Empty) return Entity_Id
is
- Temp : constant Node_Id :=
+ Temp : constant Entity_Id :=
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name (Id));
begin
@@ -659,7 +659,7 @@ package body Tbuild is
-- We don't really need these shift operators, since they never
-- appear as operators in the source, but the path of least
- -- resistance is to put them in (the aggregate must be complete)
+ -- resistance is to put them in (the aggregate must be complete).
N_Op_Rotate_Left => Name_Rotate_Left,
N_Op_Rotate_Right => Name_Rotate_Right,
@@ -686,7 +686,6 @@ package body Tbuild is
Loc : Source_Ptr) return Node_Id
is
Occurrence : Node_Id;
-
begin
Occurrence := New_Node (N_Identifier, Loc);
Set_Chars (Occurrence, Chars (Def_Id));
diff --git a/gcc/ada/tbuild.ads b/gcc/ada/tbuild.ads
index 0b73a53d220..da41111943b 100644
--- a/gcc/ada/tbuild.ads
+++ b/gcc/ada/tbuild.ads
@@ -179,11 +179,20 @@ package Tbuild is
function Make_Temporary
(Loc : Source_Ptr;
Id : Character;
- Related_Node : Node_Id := Empty) return Node_Id;
- -- Create a defining identifier to capture the value of an expression
- -- or aggregate, and link it to the expression that it replaces, in
- -- order to provide better CodePeer reports. The defining identifier
- -- name is obtained by Make_Internal_Name (Id).
+ Related_Node : Node_Id := Empty) return Entity_Id;
+ -- This function should be used for all cases where a defining identifier
+ -- is to be built with a name to be obtained by New_Internal_Name (here Id
+ -- is the character passed as the argument to New_Internal_Name). Loc is
+ -- the location for the Sloc value of the resulting Entity. Note that this
+ -- can be used for all kinds of temporary defining identifiers used in
+ -- expansion (objects, subtypes, functions etc).
+ --
+ -- Related_Node is used when the defining identifier is for an object that
+ -- captures the value of an expression (e.g. an aggregate). It should be
+ -- set whenever possible to point to the expression that is being captured.
+ -- This is provided to get better error messages, e.g. from CodePeer.
+ --
+ -- Make_Temp_Id would probably be a better name for this function???
function Make_Unsuppress_Block
(Loc : Source_Ptr;
@@ -268,6 +277,9 @@ package Tbuild is
-- if the identical unit is compiled with a semantically consistent set
-- of sources, the numbers will be consistent. This means that it is fine
-- to use these as public symbols.
+ --
+ -- Note: Nearly all uses of this function are via calls to Make_Temporary,
+ -- but there are just a few cases where it is called directly.
function New_Occurrence_Of
(Def_Id : Entity_Id;
diff --git a/gcc/ada/tempdir.ads b/gcc/ada/tempdir.ads
index a73b5a417ca..7ab1b5aff86 100644
--- a/gcc/ada/tempdir.ads
+++ b/gcc/ada/tempdir.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2010, 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- --
@@ -30,7 +30,7 @@
with Namet; use Namet;
-with System.OS_Lib; use System.OS_Lib;
+with GNAT.OS_Lib; use GNAT.OS_Lib;
package Tempdir is
diff --git a/gcc/ada/tree_io.ads b/gcc/ada/tree_io.ads
index c436054176a..0cb17fed26f 100644
--- a/gcc/ada/tree_io.ads
+++ b/gcc/ada/tree_io.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -34,10 +34,13 @@
-- create and close routines are elsewhere (in Osint in the compiler, and in
-- the tree read driver for the tree read interface).
-with Types; use Types;
+with Types; use Types;
+with System; use System;
-with System; use System;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.OS_Lib; use System.OS_Lib;
+pragma Warnings (On);
package Tree_IO is
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index c2f0770f29e..087170f69fe 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -38,6 +38,7 @@ with Snames; use Snames;
with Sinput; use Sinput;
with Stand; use Stand;
with Stringt; use Stringt;
+with SCIL_LL; use SCIL_LL;
with Treeprs; use Treeprs;
with Uintp; use Uintp;
with Urealp; use Urealp;
@@ -626,6 +627,14 @@ package body Treepr is
Print_Eol;
end if;
+ if Field_Present (Field28 (Ent)) then
+ Print_Str (Prefix);
+ Write_Field28_Name (Ent);
+ Write_Str (" = ");
+ Print_Field (Field28 (Ent));
+ Print_Eol;
+ end if;
+
Write_Entity_Flags (Ent, Prefix);
end Print_Entity_Info;
@@ -1188,6 +1197,14 @@ package body Treepr is
Print_Entity_Info (N, Prefix_Str_Char);
end if;
+ -- Print the SCIL node (if available)
+
+ if Present (Get_SCIL_Node (N)) then
+ Print_Str (Prefix_Str_Char);
+ Print_Str ("SCIL_Node = ");
+ Print_Node_Ref (Get_SCIL_Node (N));
+ Print_Eol;
+ end if;
end Print_Node;
---------------------
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index cc3603aafa0..5d7784dc03b 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -59,9 +59,6 @@ package Types is
type Int is range -2 ** 31 .. +2 ** 31 - 1;
-- Signed 32-bit integer
- type Dint is range -2 ** 63 .. +2 ** 63 - 1;
- -- Double length (64-bit) integer
-
subtype Nat is Int range 0 .. Int'Last;
-- Non-negative Int values
@@ -348,16 +345,16 @@ package Types is
-- lie in. Such tests appear only in the lowest level packages.
subtype List_Range is Union_Id
- range List_Low_Bound .. List_High_Bound;
+ range List_Low_Bound .. List_High_Bound;
subtype Node_Range is Union_Id
- range Node_Low_Bound .. Node_High_Bound;
+ range Node_Low_Bound .. Node_High_Bound;
subtype Elist_Range is Union_Id
- range Elist_Low_Bound .. Elist_High_Bound;
+ range Elist_Low_Bound .. Elist_High_Bound;
subtype Elmt_Range is Union_Id
- range Elmt_Low_Bound .. Elmt_High_Bound;
+ range Elmt_Low_Bound .. Elmt_High_Bound;
subtype Names_Range is Union_Id
range Names_Low_Bound .. Names_High_Bound;
@@ -369,23 +366,23 @@ package Types is
range Uint_Low_Bound .. Uint_High_Bound;
subtype Ureal_Range is Union_Id
- range Ureal_Low_Bound .. Ureal_High_Bound;
+ range Ureal_Low_Bound .. Ureal_High_Bound;
- ----------------------------
+ -----------------------------
-- Types for Atree Package --
- ----------------------------
+ -----------------------------
-- Node_Id values are used to identify nodes in the tree. They are
- -- subscripts into the Node table declared in package Tree. Note that
- -- the special values Empty and Error are subscripts into this table,
+ -- subscripts into the Nodes table declared in package Atree. Note that
+ -- the special values Empty and Error are subscripts into this table.
-- See package Atree for further details.
type Node_Id is range Node_Low_Bound .. Node_High_Bound;
-- Type used to identify nodes in the tree
subtype Entity_Id is Node_Id;
- -- A synonym for node types, used in the entity package to refer to nodes
- -- that are entities (i.e. nodes with an Nkind of N_Defining_xxx) All such
+ -- A synonym for node types, used in the Einfo package to refer to nodes
+ -- that are entities (i.e. nodes with an Nkind of N_Defining_xxx). All such
-- nodes are extended nodes and these are the only extended nodes, so that
-- in practice entity and extended nodes are synonymous.
@@ -402,12 +399,12 @@ package Types is
Empty_List_Or_Node : constant := 0;
-- This constant is used in situations (e.g. initializing empty fields)
- -- where the value set will be used to represent either an empty node
- -- or a non-existent list, depending on the context.
+ -- where the value set will be used to represent either an empty node or
+ -- a non-existent list, depending on the context.
Error : constant Node_Id := Node_Low_Bound + 1;
- -- Used to indicate that there was an error in the source program. A node
- -- is actually allocated at this address, so that Nkind (Error) = N_Error.
+ -- Used to indicate an error in the source program. A node is actually
+ -- allocated with this Id value, so that Nkind (Error) = N_Error.
Empty_Or_Error : constant Node_Id := Error;
-- Since Empty and Error are the first two Node_Id values, the test for
@@ -422,11 +419,12 @@ package Types is
-- Types for Nlists Package --
------------------------------
- -- List_Id values are used to identify node lists in the tree. They are
- -- subscripts into the Lists table declared in package Tree. Note that the
- -- special value Error_List is a subscript in this table, but the value
- -- No_List is *not* a valid subscript, and any attempt to apply list
- -- operations to No_List will cause a (detected) error.
+ -- List_Id values are used to identify node lists stored in the tree, so
+ -- that each node can be on at most one such list (see package Nlists for
+ -- further details). Note that the special value Error_List is a subscript
+ -- in this table, but the value No_List is *not* a valid subscript, and any
+ -- attempt to apply list operations to No_List will cause a (detected)
+ -- error.
type List_Id is range List_Low_Bound .. List_High_Bound;
-- Type used to identify a node list
@@ -449,24 +447,23 @@ package Types is
-- Types for Elists Package --
------------------------------
- -- Element list Id values are used to identify element lists stored in the
- -- tree (see package Atree for further details). They are formed by adding
- -- a bias (Element_List_Bias) to subscript values in the same array that is
- -- used for node list headers.
+ -- Element list Id values are used to identify element lists stored outside
+ -- of the tree, allowing nodes to be members of more than one such list
+ -- (see package Elists for further details).
type Elist_Id is range Elist_Low_Bound .. Elist_High_Bound;
-- Type used to identify an element list (Elist header table subscript)
No_Elist : constant Elist_Id := Elist_Low_Bound;
- -- Used to indicate absence of an element list. Note that this is not
- -- an actual Elist header, so element list operations on this value
- -- are not valid.
+ -- Used to indicate absence of an element list. Note that this is not an
+ -- actual Elist header, so element list operations on this value are not
+ -- valid.
First_Elist_Id : constant Elist_Id := No_Elist + 1;
-- Subscript of first allocated Elist header
- -- Element Id values are used to identify individual elements of an
- -- element list (see package Elists for further details).
+ -- Element Id values are used to identify individual elements of an element
+ -- list (see package Elists for further details).
type Elmt_Id is range Elmt_Low_Bound .. Elmt_High_Bound;
-- Type used to identify an element list
@@ -482,11 +479,12 @@ package Types is
-------------------------------
-- String_Id values are used to identify entries in the strings table. They
- -- are subscripts into the strings table defined in package Strings.
+ -- are subscripts into the Strings table defined in package Stringt.
-- Note that with only a few exceptions, which are clearly documented, the
-- type String_Id should be regarded as a private type. In particular it is
-- never appropriate to perform arithmetic operations using this type.
+ -- Doesn't this also apply to all other *_Id types???
type String_Id is range Strings_Low_Bound .. Strings_High_Bound;
-- Type used to identify entries in the strings table
@@ -505,10 +503,10 @@ package Types is
-- The type Char is used for character data internally in the compiler, but
-- character codes in the source are represented by the Char_Code type.
-- Each character literal in the source is interpreted as being one of the
- -- 16#8000_0000 possible Wide_Wide_Character codes, and a unique Integer
- -- Value is assigned, corresponding to the UTF_32 value, which also
- -- corresponds to the POS value in the Wide_Wide_Character type, and also
- -- corresponds to the POS value in the Wide_Character and Character types
+ -- 16#7FFF_FFFF# possible Wide_Wide_Character codes, and a unique Integer
+ -- value is assigned, corresponding to the UTF-32 value, which also
+ -- corresponds to the Pos value in the Wide_Wide_Character type, and also
+ -- corresponds to the Pos value in the Wide_Character and Character types
-- for values that are in appropriate range. String literals are similarly
-- interpreted as a sequence of such codes.
@@ -554,7 +552,7 @@ package Types is
type Unit_Number_Type is new Int;
-- Unit number. The main source is unit 0, and subsidiary sources have
-- non-zero numbers starting with 1. Unit numbers are used to index the
- -- file table in Lib.
+ -- Units table in package Lib.
Main_Unit : constant Unit_Number_Type := 0;
-- Unit number value for main unit
@@ -730,14 +728,14 @@ package Types is
-- Parameter Mechanism Control --
---------------------------------
- -- Function and parameter entities have a field that records the
- -- passing mechanism. See specification of Sem_Mech for full details.
- -- The following subtype is used to represent values of this type:
+ -- Function and parameter entities have a field that records the passing
+ -- mechanism. See specification of Sem_Mech for full details. The following
+ -- subtype is used to represent values of this type:
subtype Mechanism_Type is Int range -18 .. Int'Last;
- -- Type used to represent a mechanism value. This is a subtype rather
- -- than a type to avoid some annoying processing problems with certain
- -- routines in Einfo (processing them to create the corresponding C).
+ -- Type used to represent a mechanism value. This is a subtype rather than
+ -- a type to avoid some annoying processing problems with certain routines
+ -- in Einfo (processing them to create the corresponding C).
------------------------------
-- Run-Time Exception Codes --
@@ -762,12 +760,12 @@ package Types is
-- 1. Modify the type and subtype declarations below appropriately,
-- keeping things in alphabetical order.
- -- 2. Modify the corresponding definitions in types.h, including
- -- the definition of last_reason_code.
+ -- 2. Modify the corresponding definitions in types.h, including the
+ -- definition of last_reason_code.
- -- 3. Add a new routine in Ada.Exceptions with the appropriate call
- -- and static string constant. Note that there is more than one
- -- version of a-except.adb which must be modified.
+ -- 3. Add a new routine in Ada.Exceptions with the appropriate call and
+ -- static string constant. Note that there is more than one version
+ -- of a-except.adb which must be modified.
type RT_Exception_Code is
(CE_Access_Check_Failed, -- 00
diff --git a/gcc/ada/ug_words b/gcc/ada/ug_words
index 5e168d2798d..efa5356dff3 100644
--- a/gcc/ada/ug_words
+++ b/gcc/ada/ug_words
@@ -85,6 +85,7 @@ gcc -c ^ GNAT COMPILE
-gnatN ^ /INLINE=FULL
-gnato ^ /CHECKS=OVERFLOW
-gnatp ^ /CHECKS=SUPPRESS_ALL
+-gnat-p ^ /CHECKS=UNSUPPRESS_ALL
-gnatP ^ /POLLING
-gnatR ^ /REPRESENTATION_INFO
-gnatR0 ^ /REPRESENTATION_INFO=NONE
diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb
index 3b72d154c10..29ffe235aad 100644
--- a/gcc/ada/uintp.adb
+++ b/gcc/ada/uintp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -168,13 +168,15 @@ package body Uintp is
(Left, Right : Uint;
Quotient : out Uint;
Remainder : out Uint;
- Discard_Quotient : Boolean;
- Discard_Remainder : Boolean);
- -- Compute Euclidean division of Left by Right, and return Quotient and
- -- signed Remainder (Left rem Right).
+ Discard_Quotient : Boolean := False;
+ Discard_Remainder : Boolean := False);
+ -- Compute Euclidean division of Left by Right. If Discard_Quotient is
+ -- False then the quotient is returned in Quotient (otherwise Quotient is
+ -- set to No_Uint). If Discard_Remainder is False, then the remainder is
+ -- returned in Remainder (otherwise Remainder is set to No_Uint).
--
- -- If Discard_Quotient is True, Quotient is left unchanged.
- -- If Discard_Remainder is True, Remainder is left unchanged.
+ -- If Discard_Quotient is True, Quotient is set to No_Uint
+ -- If Discard_Remainder is True, Remainder is set to No_Uint
function Vector_To_Uint
(In_Vec : UI_Vector;
@@ -239,7 +241,7 @@ package body Uintp is
function Hash_Num (F : Int) return Hnum is
begin
- return Standard."mod" (F, Hnum'Range_Length);
+ return Types."mod" (F, Hnum'Range_Length);
end Hash_Num;
---------------
@@ -1253,7 +1255,6 @@ package body Uintp is
UI_Div_Rem
(Left, Right,
Quotient, Remainder,
- Discard_Quotient => False,
Discard_Remainder => True);
return Quotient;
end UI_Div;
@@ -1266,14 +1267,17 @@ package body Uintp is
(Left, Right : Uint;
Quotient : out Uint;
Remainder : out Uint;
- Discard_Quotient : Boolean;
- Discard_Remainder : Boolean)
+ Discard_Quotient : Boolean := False;
+ Discard_Remainder : Boolean := False)
is
pragma Warnings (Off, Quotient);
pragma Warnings (Off, Remainder);
begin
pragma Assert (Right /= Uint_0);
+ Quotient := No_Uint;
+ Remainder := No_Uint;
+
-- Cases where both operands are represented directly
if Direct (Left) and then Direct (Right) then
@@ -1345,9 +1349,11 @@ package body Uintp is
if not Discard_Quotient then
Quotient := Uint_0;
end if;
+
if not Discard_Remainder then
Remainder := Left;
end if;
+
return;
end if;
@@ -1377,6 +1383,7 @@ package body Uintp is
if not Discard_Remainder then
Remainder := UI_From_Int (Remainder_I);
end if;
+
return;
end;
end if;
@@ -1679,43 +1686,9 @@ package body Uintp is
function UI_From_CC (Input : Char_Code) return Uint is
begin
- return UI_From_Dint (Dint (Input));
+ return UI_From_Int (Int (Input));
end UI_From_CC;
- ------------------
- -- UI_From_Dint --
- ------------------
-
- function UI_From_Dint (Input : Dint) return Uint is
- begin
-
- if Dint (Min_Direct) <= Input and then Input <= Dint (Max_Direct) then
- return Uint (Dint (Uint_Direct_Bias) + Input);
-
- -- For values of larger magnitude, compute digits into a vector and call
- -- Vector_To_Uint.
-
- else
- declare
- Max_For_Dint : constant := 5;
- -- Base is defined so that 5 Uint digits is sufficient to hold the
- -- largest possible Dint value.
-
- V : UI_Vector (1 .. Max_For_Dint);
-
- Temp_Integer : Dint := Input;
-
- begin
- for J in reverse V'Range loop
- V (J) := Int (abs (Temp_Integer rem Dint (Base)));
- Temp_Integer := Temp_Integer / Dint (Base);
- end loop;
-
- return Vector_To_Uint (V, Input < Dint'(0));
- end;
- end if;
- end UI_From_Dint;
-
-----------------
-- UI_From_Int --
-----------------
@@ -2188,11 +2161,7 @@ package body Uintp is
Y := Uint_0;
loop
- UI_Div_Rem
- (U, V,
- Quotient => Q, Remainder => R,
- Discard_Quotient => False,
- Discard_Remainder => False);
+ UI_Div_Rem (U, V, Quotient => Q, Remainder => R);
U := V;
V := R;
@@ -2229,12 +2198,15 @@ package body Uintp is
function UI_Mul (Left : Uint; Right : Uint) return Uint is
begin
- -- Simple case of single length operands
+ -- Case where product fits in the range of a 32-bit integer
- if Direct (Left) and then Direct (Right) then
+ if Int (Left) <= Int (Uint_Max_Simple_Mul)
+ and then
+ Int (Right) <= Int (Uint_Max_Simple_Mul)
+ then
return
- UI_From_Dint
- (Dint (Direct_Val (Left)) * Dint (Direct_Val (Right)));
+ UI_From_Int
+ (Int (Direct_Val (Left)) * Int (Direct_Val (Right)));
end if;
-- Otherwise we have the general case (Algorithm M in Knuth)
@@ -2557,9 +2529,7 @@ package body Uintp is
pragma Warnings (Off, Quotient);
begin
UI_Div_Rem
- (Left, Right, Quotient, Remainder,
- Discard_Quotient => True,
- Discard_Remainder => False);
+ (Left, Right, Quotient, Remainder, Discard_Quotient => True);
return Remainder;
end;
end UI_Rem;
diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads
index 492498d6cf2..d222c52c12f 100644
--- a/gcc/ada/uintp.ads
+++ b/gcc/ada/uintp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -233,9 +233,6 @@ package Uintp is
-- given Modulo (uses Euclid's algorithm). Note: the call is considered
-- to be erroneous (and the behavior is undefined) if n is not invertible.
- function UI_From_Dint (Input : Dint) return Uint;
- -- Converts Dint value to universal integer form
-
function UI_From_Int (Input : Int) return Uint;
-- Converts Int value to universal integer form
@@ -404,7 +401,8 @@ private
-- Base is defined to allow efficient execution of the primitive operations
-- (a0, b0, c0) defined in the section "The Classical Algorithms"
-- (sec. 4.3.1) of Donald Knuth's "The Art of Computer Programming",
- -- Vol. 2. These algorithms are used in this package.
+ -- Vol. 2. These algorithms are used in this package. In particular,
+ -- the product of two single digits in this base fits in a 32-bit integer.
Base_Bits : constant := 15;
-- Number of bits in base value
@@ -470,6 +468,11 @@ private
Uint_Minus_80 : constant Uint := Uint (Uint_Direct_Bias - 80);
Uint_Minus_128 : constant Uint := Uint (Uint_Direct_Bias - 128);
+ Uint_Max_Simple_Mul : constant := Uint_Direct_Bias + 2 ** 15;
+ -- If two values are directly represented and less than or equal to this
+ -- value, then we know the product fits in a 32-bit integer. This allows
+ -- UI_Mul to efficiently compute the product in this case.
+
type Save_Mark is record
Save_Uint : Uint;
Save_Udigit : Int;
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 1840ade33b7..2121b7f20e4 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -397,47 +397,46 @@ begin
Write_Switch_Char ("wxx");
Write_Line ("Enable selected warning modes, xx = list of parameters:");
- Write_Line (" a turn on all optional info/warnings " &
- "(except dhl.ot.w)");
+ Write_Line (" a turn on all info/warnings marked below with +");
Write_Line (" A turn off all optional info/warnings");
- Write_Line (" .a* turn on warnings for failing assertion");
+ Write_Line (" .a*+ turn on warnings for failing assertion");
Write_Line (" .A turn off warnings for failing assertion");
- Write_Line (" b turn on warnings for bad fixed value " &
+ Write_Line (" b+ turn on warnings for bad fixed value " &
"(not multiple of small)");
Write_Line (" B* turn off warnings for bad fixed value " &
"(not multiple of small)");
- Write_Line (" .b* turn on warnings for biased representation");
+ Write_Line (" .b*+ turn on warnings for biased representation");
Write_Line (" .B turn off warnings for biased representation");
- Write_Line (" c turn on warnings for constant conditional");
+ Write_Line (" c+ turn on warnings for constant conditional");
Write_Line (" C* turn off warnings for constant conditional");
- Write_Line (" .c turn on warnings for unrepped components");
+ Write_Line (" .c+ turn on warnings for unrepped components");
Write_Line (" .C* turn off warnings for unrepped components");
Write_Line (" d turn on warnings for implicit dereference");
Write_Line (" D* turn off warnings for implicit dereference");
Write_Line (" e treat all warnings (but not info) as errors");
Write_Line (" .e turn on every optional info/warning " &
"(no exceptions)");
- Write_Line (" f turn on warnings for unreferenced formal");
+ Write_Line (" f+ turn on warnings for unreferenced formal");
Write_Line (" F* turn off warnings for unreferenced formal");
- Write_Line (" g* turn on warnings for unrecognized pragma");
+ Write_Line (" g*+ turn on warnings for unrecognized pragma");
Write_Line (" G turn off warnings for unrecognized pragma");
Write_Line (" h turn on warnings for hiding variable");
Write_Line (" H* turn off warnings for hiding variable");
- Write_Line (" i* turn on warnings for implementation unit");
+ Write_Line (" i*+ turn on warnings for implementation unit");
Write_Line (" I turn off warnings for implementation unit");
Write_Line (" .i turn on warnings for overlapping actuals");
Write_Line (" .I* turn off warnings for overlapping actuals");
- Write_Line (" j turn on warnings for obsolescent " &
+ Write_Line (" j+ turn on warnings for obsolescent " &
"(annex J) feature");
Write_Line (" J* turn off warnings for obsolescent " &
"(annex J) feature");
- Write_Line (" k turn on warnings on constant variable");
+ Write_Line (" k+ turn on warnings on constant variable");
Write_Line (" K* turn off warnings on constant variable");
Write_Line (" l turn on warnings for missing " &
"elaboration pragma");
Write_Line (" L* turn off warnings for missing " &
"elaboration pragma");
- Write_Line (" m turn on warnings for variable assigned " &
+ Write_Line (" m+ turn on warnings for variable assigned " &
"but not read");
Write_Line (" M* turn off warnings for variable assigned " &
"but not read");
@@ -450,47 +449,48 @@ begin
"but not read");
Write_Line (" .O* turn off warnings for out parameters assigned " &
"but not read");
- Write_Line (" p turn on warnings for ineffective pragma " &
+ Write_Line (" p+ turn on warnings for ineffective pragma " &
"Inline in frontend");
Write_Line (" P* turn off warnings for ineffective pragma " &
"Inline in frontend");
- Write_Line (" .p turn on warnings for suspicious parameter " &
+ Write_Line (" .p+ turn on warnings for suspicious parameter " &
"order");
Write_Line (" .P* turn off warnings for suspicious parameter " &
"order");
- Write_Line (" q* turn on warnings for questionable " &
+ Write_Line (" q*+ turn on warnings for questionable " &
"missing parenthesis");
Write_Line (" Q turn off warnings for questionable " &
"missing parenthesis");
- Write_Line (" r turn on warnings for redundant construct");
+ Write_Line (" r+ turn on warnings for redundant construct");
Write_Line (" R* turn off warnings for redundant construct");
- Write_Line (" .r turn on warnings for object renaming function");
+ Write_Line (" .r+ turn on warnings for object renaming function");
Write_Line (" .R* turn off warnings for object renaming function");
Write_Line (" s suppress all info/warnings");
Write_Line (" t turn on warnings for tracking deleted code");
Write_Line (" T* turn off warnings for tracking deleted code");
- Write_Line (" u turn on warnings for unused entity");
+ Write_Line (" u+ turn on warnings for unused entity");
Write_Line (" U* turn off warnings for unused entity");
- Write_Line (" v* turn on warnings for unassigned variable");
+ Write_Line (" v*+ turn on warnings for unassigned variable");
Write_Line (" V turn off warnings for unassigned variable");
- Write_Line (" .v* turn on info messages for reverse bit order");
+ Write_Line (" .v*+ turn on info messages for reverse bit order");
Write_Line (" .V turn off info messages for reverse bit order");
- Write_Line (" w* turn on warnings for wrong low bound assumption");
+ Write_Line (" w*+ turn on warnings for wrong low bound assumption");
Write_Line (" W turn off warnings for wrong low bound " &
"assumption");
Write_Line (" .w turn on warnings on pragma Warnings Off");
Write_Line (" .W* turn off warnings on pragma Warnings Off");
- Write_Line (" x* turn on warnings for export/import");
+ Write_Line (" x*+ turn on warnings for export/import");
Write_Line (" X turn off warnings for export/import");
- Write_Line (" .x turn on warnings for non-local exception");
+ Write_Line (" .x+ turn on warnings for non-local exception");
Write_Line (" .X* turn off warnings for non-local exception");
- Write_Line (" y* turn on warnings for Ada 2005 incompatibility");
+ Write_Line (" y*+ turn on warnings for Ada 2005 incompatibility");
Write_Line (" Y turn off warnings for Ada 2005 incompatibility");
- Write_Line (" z* turn on warnings for suspicious " &
+ Write_Line (" z*+ turn on warnings for suspicious " &
"unchecked conversion");
Write_Line (" Z turn off warnings for suspicious " &
"unchecked conversion");
Write_Line (" * indicates default in above list");
+ Write_Line (" + indicates warning flag included in -gnatwa");
-- Line for -gnatW switch
@@ -595,7 +595,22 @@ begin
if Ada_Version_Default = Ada_05 then
Write_Line ("Ada 2005 mode (default)");
else
- Write_Line ("Allow Ada 2005 extensions");
+ Write_Line ("Enforce Ada 2005 restrictions");
end if;
+ -- Line for -gnat12 switch
+
+ Write_Switch_Char ("12");
+
+ if Ada_Version_Default = Ada_12 then
+ Write_Line ("Ada 2012 mode (default)");
+ else
+ Write_Line ("Allow Ada 2012 extensions");
+ end if;
+
+ -- Line for -gnat-p switch
+
+ Write_Switch_Char ("-p");
+ Write_Line ("Cancel effect of previous -gnatp switch");
+
end Usage;
diff --git a/gcc/ada/vms_conv.adb b/gcc/ada/vms_conv.adb
index 0772a494f12..e9aba4906eb 100644
--- a/gcc/ada/vms_conv.adb
+++ b/gcc/ada/vms_conv.adb
@@ -2274,9 +2274,15 @@ package body VMS_Conv is
New_Line;
while Commands /= null loop
- Put (Commands.Usage.all);
- Set_Col (53);
- Put_Line (Commands.Unix_String.all);
+
+ -- No usage for GNAT SYNC
+
+ if Commands.Command /= Sync then
+ Put (Commands.Usage.all);
+ Set_Col (53);
+ Put_Line (Commands.Unix_String.all);
+ end if;
+
Commands := Commands.Next;
end loop;
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index 6f4ae0f65f0..8454041abb1 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2010, 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- --
@@ -196,6 +196,14 @@ package VMS_Data is
--
-- Add directories to the project search path.
+ S_Bind_ALI : aliased constant S := "/ALI_LIST " &
+ "-A";
+ -- /NOALI_LIST (D)
+ -- /ALI_LIST
+ --
+ -- Output full names of all the ALI files in the partition. The output is
+ -- written to SYS$OUTPUT.
+
S_Bind_Bind : aliased constant S := "/BIND_FILE=" &
"ADA " &
"-A " &
@@ -385,7 +393,7 @@ package VMS_Data is
-- /NOOBJECT_LIST (D)
-- /OBJECT_LIST
--
- -- Output full names of all the object files that must be linker to
+ -- Output full names of all the object files that must be linked to
-- provide the Ada component of the program. The output is written to
-- SYS$OUTPUT.
@@ -669,6 +677,7 @@ package VMS_Data is
Bind_Switches : aliased constant Switches :=
(S_Bind_Add 'Access,
+ S_Bind_ALI 'Access,
S_Bind_Bind 'Access,
S_Bind_Build 'Access,
S_Bind_Current 'Access,
@@ -834,37 +843,6 @@ package VMS_Data is
--
-- Duplicate all the output sent to Stderr into a log file.
- S_Check_Sections : aliased constant S := "/SECTIONS=" &
- "DEFAULT " &
- "-s123 " &
- "COMPILER_STYLE " &
- "-s1 " &
- "BY_RULES " &
- "-s2 " &
- "BY_FILES_BY_RULES " &
- "-s3";
- -- /SECTIONS[=section-option, section-option, ...]
- --
- -- Specify what sections should be included into the report file.
- -- By default, all three section (diagnoses in the format corresponding
- -- to compiler error and warning messages, diagnoses grouped by rules and
- -- then - by files, diagnoses grouped by files and then - by rules) are
- -- included in the report file.
- --
- -- section-option may be one of the following:
- --
- -- COMPILER_STYLE Include diagnostics in compile-style format
- -- (diagnoses are grouped by files, for each file
- -- they are ordered according to the references
- -- into the source)
- -- BY_RULES Include diagnostics grouped first by rules and
- -- then by files
- -- BY_FILES_BY_RULES Include diagnostics grouped first by files and
- -- then by rules
- --
- -- If one of these options is specified, then the report file contains
- -- only sections set by these options
-
S_Check_Short : aliased constant S := "/SHORT " &
"-s";
-- /NOSHORT (D)
@@ -872,6 +850,14 @@ package VMS_Data is
--
-- Generate a short form of the report file.
+ S_Check_Include : aliased constant S := "/INCLUDE_FILE=@" &
+ "--include-file=@";
+
+ -- /INCLUDE_FILE=filename
+ --
+ -- Add the content of the specified text file to the generated report
+ -- file.
+
S_Check_Subdirs : aliased constant S := "/SUBDIRS=<" &
"--subdirs=>";
-- /SUBDIRS=dir
@@ -896,24 +882,24 @@ package VMS_Data is
-- Specify the name of the output file.
Check_Switches : aliased constant Switches :=
- (S_Check_Add 'Access,
- S_Check_All 'Access,
- S_Diagnosis 'Access,
- S_Check_Ext 'Access,
- S_Check_Files 'Access,
- S_Check_Follow 'Access,
- S_Check_Help 'Access,
- S_Check_Locs 'Access,
- S_Check_Mess 'Access,
- S_Check_Project 'Access,
- S_Check_Quiet 'Access,
- S_Check_Time 'Access,
- S_Check_Log 'Access,
- S_Check_Sections 'Access,
- S_Check_Short 'Access,
- S_Check_Subdirs 'Access,
- S_Check_Verb 'Access,
- S_Check_Out 'Access);
+ (S_Check_Add 'Access,
+ S_Check_All 'Access,
+ S_Diagnosis 'Access,
+ S_Check_Ext 'Access,
+ S_Check_Files 'Access,
+ S_Check_Follow 'Access,
+ S_Check_Help 'Access,
+ S_Check_Locs 'Access,
+ S_Check_Mess 'Access,
+ S_Check_Project'Access,
+ S_Check_Quiet 'Access,
+ S_Check_Time 'Access,
+ S_Check_Log 'Access,
+ S_Check_Short 'Access,
+ S_Check_Include'Access,
+ S_Check_Subdirs'Access,
+ S_Check_Verb 'Access,
+ S_Check_Out 'Access);
----------------------------
-- Switches for GNAT CHOP --
@@ -1168,6 +1154,13 @@ package VMS_Data is
-- of the directory specified in the project file. If the subdirectory
-- does not exist, it is created automatically.
+ S_Clean_USL : aliased constant S := "/UNCHECKED_SHARED_LIB_IMPORTS " &
+ "--unchecked-shared-lib-imports";
+ -- /NOUNCHECKED_SHARED_LIB_IMPORTS (D)
+ -- /UNCHECKED_SHARED_LIB_IMPORTS
+ --
+ -- Allow shared library projects to import static library projects
+
S_Clean_Verbose : aliased constant S := "/VERBOSE " &
"-v";
-- /NOVERBOSE (D)
@@ -1193,7 +1186,8 @@ package VMS_Data is
S_Clean_Recurs 'Access,
S_Clean_Search 'Access,
S_Clean_Subdirs'Access,
- S_Clean_Verbose'Access);
+ S_Clean_Verbose'Access,
+ S_Clean_USL 'Access);
-------------------------------
-- Switches for GNAT COMPILE --
@@ -1233,7 +1227,13 @@ package VMS_Data is
"-gnat05";
-- /05 (D)
--
- -- Allows GNAT to recognize all implemented proposed Ada 2005
+ -- Allows GNAT to recognize the full range of Ada 2005 constructs.
+
+ S_GCC_Ada_12 : aliased constant S := "/12 " &
+ "-gnat12";
+ -- /05 (D)
+ --
+ -- Allows GNAT to recognize all implemented proposed Ada 2012
-- extensions. See features file for list of implemented features.
S_GCC_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" &
@@ -1276,7 +1276,9 @@ package VMS_Data is
"STACK " &
"-fstack-check " &
"SUPPRESS_ALL " &
- "-gnatp";
+ "-gnatp " &
+ "UNSUPPRESS_ALL " &
+ "-gnat-p";
-- /NOCHECKS
-- /CHECKS[=(keyword[,...])]
--
@@ -1290,47 +1292,50 @@ package VMS_Data is
-- You may specify one or more of the following keywords to the /CHECKS
-- qualifier to modify this behavior:
--
- -- DEFAULT The behavior described above. This is the default
- -- if the /CHECKS qualifier is not present on the
- -- command line. Same as /NOCHECKS.
- --
- -- OVERFLOW Enables overflow checking for integer operations and
- -- checks for access before elaboration on subprogram
- -- calls. This causes GNAT to generate slower and larger
- -- executable programs by adding code to check for both
- -- overflow and division by zero (resulting in raising
- -- "Constraint_Error" as required by Ada semantics).
- -- Similarly, GNAT does not generate elaboration check
- -- by default, and you must specify this keyword to
- -- enable them.
- --
- -- Note that this keyword does not affect the code
- -- generated for any floating-point operations; it
- -- applies only to integer operations. For floating-point,
- -- GNAT has the "Machine_Overflows" attribute set to
- -- "False" and the normal mode of operation is to generate
- -- IEEE NaN and infinite values on overflow or invalid
- -- operations (such as dividing 0.0 by 0.0).
- --
- -- ELABORATION Enables dynamic checks for access-before-elaboration
- -- on subprogram calls and generic instantiations.
- --
- -- ASSERTIONS The pragmas "Assert" and "Debug" normally have no
- -- effect and are ignored. This keyword causes "Assert"
- -- and "Debug" pragmas to be activated, as well as
- -- "Check", "Precondition" and "Postcondition" pragmas.
- --
- -- SUPPRESS_ALL Suppress all runtime checks as though you have "pragma
- -- Suppress (all_checks)" in your source. Use this switch
- -- to improve the performance of the code at the expense
- -- of safety in the presence of invalid data or program
- -- bugs.
- --
- -- DEFAULT Suppress the effect of any option OVERFLOW or
- -- ASSERTIONS.
- --
- -- FULL (D) Similar to OVERFLOW, but suppress the effect of any
- -- option ELABORATION or SUPPRESS_ALL.
+ -- DEFAULT The behavior described above. This is the default
+ -- if the /CHECKS qualifier is not present on the
+ -- command line. Same as /NOCHECKS.
+ --
+ -- OVERFLOW Enables overflow checking for integer operations and
+ -- checks for access before elaboration on subprogram
+ -- calls. This causes GNAT to generate slower and larger
+ -- executable programs by adding code to check for both
+ -- overflow and division by zero (resulting in raising
+ -- "Constraint_Error" as required by Ada semantics).
+ -- Similarly, GNAT does not generate elaboration check
+ -- by default, and you must specify this keyword to
+ -- enable them.
+ --
+ -- Note that this keyword does not affect the code
+ -- generated for any floating-point operations; it
+ -- applies only to integer operations. For the case of
+ -- floating-point, GNAT has the "Machine_Overflows"
+ -- attribute set to "False" and the normal mode of
+ -- operation is to generate IEEE NaN and infinite values
+ -- on overflow or invalid operations (such as dividing
+ -- 0.0 by 0.0).
+ --
+ -- ELABORATION Enables dynamic checks for access-before-elaboration
+ -- on subprogram calls and generic instantiations.
+ --
+ -- ASSERTIONS The pragmas "Assert" and "Debug" normally have no
+ -- effect and are ignored. This keyword causes "Assert"
+ -- and "Debug" pragmas to be activated, as well as
+ -- "Check", "Precondition" and "Postcondition" pragmas.
+ --
+ -- SUPPRESS_ALL Suppress all runtime checks as though you have
+ -- "pragma Suppress (all_checks)" in your source. Use
+ -- this switch to improve the performance of the code at
+ -- the expense of safety in the presence of invalid data
+ -- or program bugs.
+ --
+ -- UNSUPPRESS_ALL Cancels effect of previous SUPPRESS_ALL.
+ --
+ -- DEFAULT Suppress the effect of any option OVERFLOW or
+ -- ASSERTIONS.
+ --
+ -- FULL (D) Similar to OVERFLOW, but suppress the effect of any
+ -- option ELABORATION or SUPPRESS_ALL.
--
-- These keywords only control the default setting of the checks. You
-- may modify them using either "Suppress" (to remove checks) or
@@ -3615,6 +3620,13 @@ package VMS_Data is
-- HIGH A great number of messages are output, most of them not
-- being useful for the user.
+ S_Elim_Nodisp : aliased constant S := "/NO_DISPATCH " &
+ "--no-elim-dispatch";
+ -- /NONO_DISPATCH (D)
+ -- /NO_DISPATCH
+ --
+ -- Do not generate pragmas for dispatching operations.
+
S_Elim_Project : aliased constant S := "/PROJECT_FILE=<" &
"-P>";
-- /PROJECT_FILE=filename
@@ -3624,7 +3636,7 @@ package VMS_Data is
-- gnatelim. The source directories to be searched will be communicated
-- to gnatelim through logical name ADA_PRJ_INCLUDE_FILE.
- S_Elim_Quiet : aliased constant S := "/QUIET " &
+ S_Elim_Quiet : aliased constant S := "/QUIET " &
"-q";
-- /NOQUIET (D)
-- /QUIET
@@ -3633,6 +3645,48 @@ package VMS_Data is
-- the number of program units left to be processed. This option turns
-- this trace off.
+ S_Elim_Files : aliased constant S := "/FILES=@" &
+ "-files=@";
+
+ -- /FILES=filename
+ --
+ -- Take as arguments the files that are listed in the specified
+ -- text file.
+
+ S_Elim_Log : aliased constant S := "/LOG " &
+ "-l";
+ -- /NOLOG (D)
+ -- /LOG
+ --
+ -- Duplicate all the output sent to Stderr into a default log file.
+
+ S_Elim_Logfile : aliased constant S := "/LOGFILE=@" &
+ "-l@";
+
+ -- /LOGFILE=logfilename
+ --
+ -- Duplicate all the output sent to Stderr into a specified log file.
+
+ S_Elim_Main : aliased constant S := "/MAIN=@" &
+ "-main=@";
+
+ -- /MAIN=filename
+ --
+ -- Specify the main subprogram of the partition to analyse.
+
+ S_Elim_Out : aliased constant S := "/OUTPUT=@" &
+ "-o@";
+ -- /OUTPUT=filename
+ --
+ -- Specify the name of the output file.
+
+ S_Elim_Time : aliased constant S := "/TIME " &
+ "-t";
+ -- /NOTIME (D)
+ -- /TIME
+ --
+ -- Print out execution time
+
S_Elim_Search : aliased constant S := "/SEARCH=*" &
"-I*";
-- /SEARCH=(directory, ...)
@@ -3657,6 +3711,19 @@ package VMS_Data is
-- program units left, GNAT ELIM will output the name of the current unit
-- being processed.
+ S_Elim_Warn : aliased constant S := "/WARNINGS=" &
+ "NORMAL " &
+ "-wn " &
+ "QUIET " &
+ "-ws";
+
+ -- /WARNINGS[=(keyword[,...])]
+ --
+ -- The following keywords are supported:
+ --
+ -- NORMAL (D) Print warning all the messages.
+ -- QUIET Some warning messages are suppressed
+
Elim_Switches : aliased constant Switches :=
(S_Elim_Add 'Access,
S_Elim_All 'Access,
@@ -3665,14 +3732,22 @@ package VMS_Data is
S_Elim_Config 'Access,
S_Elim_Current 'Access,
S_Elim_Ext 'Access,
+ S_Elim_Files 'Access,
S_Elim_Follow 'Access,
S_Elim_GNATMAKE'Access,
+ S_Elim_Log 'Access,
+ S_Elim_Logfile 'Access,
+ S_Elim_Main 'Access,
S_Elim_Mess 'Access,
+ S_Elim_Nodisp 'Access,
+ S_Elim_Out 'Access,
S_Elim_Project 'Access,
S_Elim_Quiet 'Access,
S_Elim_Search 'Access,
S_Elim_Subdirs 'Access,
- S_Elim_Verb 'Access);
+ S_Elim_Time 'Access,
+ S_Elim_Verb 'Access,
+ S_Elim_Warn 'Access);
----------------------------
-- Switches for GNAT FIND --
@@ -4799,6 +4874,13 @@ package VMS_Data is
-- For example, -O -O2 is different than -O2 -O, but -g -O is equivalent
-- to -O -g.
+ S_Make_USL : aliased constant S := "/UNCHECKED_SHARED_LIB_IMPORTS " &
+ "--unchecked-shared-lib-imports";
+ -- /NOUNCHECKED_SHARED_LIB_IMPORTS (D)
+ -- /UNCHECKED_SHARED_LIB_IMPORTS
+ --
+ -- Allow shared library projects to import static library projects
+
S_Make_Unique : aliased constant S := "/UNIQUE " &
"-u";
-- /NOUNIQUE (D)
@@ -4876,6 +4958,7 @@ package VMS_Data is
S_Make_Stand 'Access,
S_Make_Subdirs 'Access,
S_Make_Switch 'Access,
+ S_Make_USL 'Access,
S_Make_Unique 'Access,
S_Make_Use_Map 'Access,
S_Make_Verbose 'Access);
diff --git a/gcc/ada/xr_tabls.adb b/gcc/ada/xr_tabls.adb
index 95bdfa985d8..b75da1f8423 100644
--- a/gcc/ada/xr_tabls.adb
+++ b/gcc/ada/xr_tabls.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2010, 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- --
@@ -395,7 +395,7 @@ package body Xr_Tabls is
begin
case Ref_Type is
- when 'b' | 'c' | 'm' | 'r' | 'R' | 'i' | ' ' | 'x' =>
+ when 'b' | 'c' | 'H' | 'm' | 'o' | 'r' | 'R' | 'i' | ' ' | 'x' =>
null;
when 'l' | 'w' =>
@@ -419,7 +419,12 @@ package body Xr_Tabls is
(Symbol_Length => 0,
Symbol => "",
Key => new String'(Key),
- Decl => null,
+ Decl => new Reference_Record'
+ (File => File_Ref,
+ Line => Line,
+ Column => Column,
+ Source_Line => null,
+ Next => null),
Is_Parameter => True,
Decl_Type => ' ',
Body_Ref => null,
@@ -458,7 +463,7 @@ package body Xr_Tabls is
New_Ref.Next := Declaration.Body_Ref;
Declaration.Body_Ref := New_Ref;
- when 'r' | 'R' | 'i' | 'l' | ' ' | 'x' | 'w' =>
+ when 'r' | 'R' | 'H' | 'i' | 'l' | 'o' | ' ' | 'x' | 'w' =>
New_Ref.Next := Declaration.Ref_Ref;
Declaration.Ref_Ref := New_Ref;
diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb
index f4d0fc29a36..ed213569e92 100644
--- a/gcc/ada/xref_lib.adb
+++ b/gcc/ada/xref_lib.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2010, 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- --
@@ -231,7 +231,7 @@ package body Xref_Lib is
Line_Start := Index (Entity (File_Start .. Entity'Last), ":");
- -- Check if it was a disk:\directory item (for NT and OS/2)
+ -- Check if it was a disk:\directory item (for Windows)
if File_Start = Line_Start - 1
and then Line_Start < Entity'Last
@@ -508,6 +508,7 @@ package body Xref_Lib is
when 'D' => return "decimal type";
when 'E' => return "enumeration type";
when 'F' => return "float type";
+ when 'H' => return "abstract type";
when 'I' => return "integer type";
when 'M' => return "modular type";
when 'O' => return "fixed type";
@@ -523,7 +524,6 @@ package body Xref_Lib is
when 'd' => return Param_String & "decimal object";
when 'e' => return Param_String & "enumeration object";
when 'f' => return Param_String & "float object";
- when 'h' => return "interface";
when 'i' => return Param_String & "integer object";
when 'm' => return Param_String & "modular object";
when 'o' => return Param_String & "fixed object";
@@ -535,6 +535,8 @@ package body Xref_Lib is
when 'x' => return Param_String & "abstract procedure";
when 'y' => return Param_String & "abstract function";
+ when 'h' => return "interface";
+ when 'g' => return "macro";
when 'K' => return "package";
when 'k' => return "generic package";
when 'L' => return "statement label";
@@ -542,6 +544,7 @@ package body Xref_Lib is
when 'N' => return "named number";
when 'n' => return "enumeration literal";
when 'q' => return "block label";
+ when 'Q' => return "include file";
when 'U' => return "procedure";
when 'u' => return "generic procedure";
when 'V' => return "function";
@@ -557,7 +560,11 @@ package body Xref_Lib is
-- have an unknown Abbrev value
when others =>
- return "??? (" & Get_Type (Decl) & ")";
+ if Is_Parameter (Decl) then
+ return "parameter";
+ else
+ return "??? (" & Get_Type (Decl) & ")";
+ end if;
end case;
end Get_Full_Type;
@@ -1587,8 +1594,13 @@ package body Xref_Lib is
File := Get_File_Ref (Arr (R));
F := Osint.To_Host_File_Spec
(Get_Gnatchop_File (Arr (R), Full_Path_Name));
- Write_Str (F.all & ' ');
- Free (F);
+
+ if F = null then
+ Write_Str ("<unknown> ");
+ else
+ Write_Str (F.all & ' ');
+ Free (F);
+ end if;
end if;
Print_Ref (Get_Line (Arr (R)), Get_Column (Arr (R)));
@@ -1637,8 +1649,14 @@ package body Xref_Lib is
Write_Str (" Decl: ");
F := Osint.To_Host_File_Spec
(Get_Gnatchop_File (Decl, Full_Path_Name));
- Print80 (F.all & ' ');
- Free (F);
+
+ if F = null then
+ Print80 ("<unknown> ");
+ else
+ Print80 (F.all & ' ');
+ Free (F);
+ end if;
+
Print_Ref (Get_Line (Decl), Get_Column (Decl));
Print_List
diff --git a/gcc/alias.c b/gcc/alias.c
index a4083a1a13b..30717127be2 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -279,7 +279,8 @@ ao_ref_from_mem (ao_ref *ref, const_rtx mem)
/* If this is a pointer dereference of a non-SSA_NAME punt.
??? We could replace it with a pointer to anything. */
- if (INDIRECT_REF_P (base)
+ if ((INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF)
&& TREE_CODE (TREE_OPERAND (base, 0)) != SSA_NAME)
return false;
@@ -293,10 +294,7 @@ ao_ref_from_mem (ao_ref *ref, const_rtx mem)
void *namep;
namep = pointer_map_contains (cfun->gimple_df->decls_to_pointers, base);
if (namep)
- {
- ref->base_alias_set = get_alias_set (base);
- ref->base = build1 (INDIRECT_REF, TREE_TYPE (base), *(tree *)namep);
- }
+ ref->base = build_simple_mem_ref (*(tree *)namep);
}
ref->ref_alias_set = MEM_ALIAS_SET (mem);
@@ -648,8 +646,8 @@ get_alias_set (tree t)
{
tree inner;
- /* Remove any nops, then give the language a chance to do
- something with this tree before we look at it. */
+ /* Give the language a chance to do something with this tree
+ before we look at it. */
STRIP_NOPS (t);
set = lang_hooks.get_alias_set (t);
if (set != -1)
@@ -659,21 +657,41 @@ get_alias_set (tree t)
if (TREE_CODE (t) == TARGET_MEM_REF)
t = TMR_ORIGINAL (t);
- /* First see if the actual object referenced is an INDIRECT_REF from a
- restrict-qualified pointer or a "void *". */
+ /* Get the base object of the reference. */
inner = t;
while (handled_component_p (inner))
{
+ /* If there is a VIEW_CONVERT_EXPR in the chain we cannot use
+ the type of any component references that wrap it to
+ determine the alias-set. */
+ if (TREE_CODE (inner) == VIEW_CONVERT_EXPR)
+ t = TREE_OPERAND (inner, 0);
inner = TREE_OPERAND (inner, 0);
- STRIP_NOPS (inner);
}
+ /* Handle pointer dereferences here, they can override the
+ alias-set. */
if (INDIRECT_REF_P (inner))
{
set = get_deref_alias_set_1 (TREE_OPERAND (inner, 0));
if (set != -1)
return set;
}
+ else if (TREE_CODE (inner) == MEM_REF)
+ {
+ set = get_deref_alias_set_1 (TREE_OPERAND (inner, 1));
+ if (set != -1)
+ return set;
+ }
+
+ /* If the innermost reference is a MEM_REF that has a
+ conversion embedded treat it like a VIEW_CONVERT_EXPR above,
+ using the memory access type for determining the alias-set. */
+ if (TREE_CODE (inner) == MEM_REF
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (inner))
+ != TYPE_MAIN_VARIANT
+ (TREE_TYPE (TREE_TYPE (TREE_OPERAND (inner, 1))))))
+ return get_deref_alias_set (TREE_OPERAND (inner, 1));
/* Otherwise, pick up the outermost object that we could have a pointer
to, processing conversions as above. */
@@ -713,7 +731,7 @@ get_alias_set (tree t)
t = TYPE_CANONICAL (t);
/* Canonical types shouldn't form a tree nor should the canonical
type require structural equality checks. */
- gcc_assert (!TYPE_STRUCTURAL_EQUALITY_P (t) && TYPE_CANONICAL (t) == t);
+ gcc_checking_assert (!TYPE_STRUCTURAL_EQUALITY_P (t) && TYPE_CANONICAL (t) == t);
/* If this is a type with a known alias set, return it. */
if (TYPE_ALIAS_SET_KNOWN_P (t))
@@ -823,10 +841,12 @@ record_alias_subset (alias_set_type superset, alias_set_type subset)
{
/* Create an entry for the SUPERSET, so that we have a place to
attach the SUBSET. */
- superset_entry = GGC_NEW (struct alias_set_entry_d);
+ superset_entry = ggc_alloc_cleared_alias_set_entry_d ();
superset_entry->alias_set = superset;
superset_entry->children
- = splay_tree_new_ggc (splay_tree_compare_ints);
+ = splay_tree_new_ggc (splay_tree_compare_ints,
+ ggc_alloc_splay_tree_scalar_scalar_splay_tree_s,
+ ggc_alloc_splay_tree_scalar_scalar_splay_tree_node_s);
superset_entry->has_zero_child = 0;
VEC_replace (alias_set_entry, alias_sets, superset, superset_entry);
}
@@ -1134,7 +1154,7 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
regno = REGNO (dest);
- gcc_assert (regno < VEC_length (rtx, reg_base_value));
+ gcc_checking_assert (regno < VEC_length (rtx, reg_base_value));
/* If this spans multiple hard registers, then we must indicate that every
register has an unusable value. */
@@ -2639,7 +2659,7 @@ init_alias_analysis (void)
timevar_push (TV_ALIAS_ANALYSIS);
reg_known_value_size = maxreg - FIRST_PSEUDO_REGISTER;
- reg_known_value = GGC_CNEWVEC (rtx, reg_known_value_size);
+ reg_known_value = ggc_alloc_cleared_vec_rtx (reg_known_value_size);
reg_known_equiv_p = XCNEWVEC (bool, reg_known_value_size);
/* If we have memory allocated from the previous run, use it. */
diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
index 6eecef53ee2..ade1753c046 100644
--- a/gcc/alloc-pool.c
+++ b/gcc/alloc-pool.c
@@ -137,7 +137,7 @@ create_alloc_pool (const char *name, size_t size, size_t num)
struct alloc_pool_descriptor *desc;
#endif
- gcc_assert (name);
+ gcc_checking_assert (name);
/* Make size large enough to store the list header. */
if (size < sizeof (alloc_pool_list))
@@ -152,7 +152,7 @@ create_alloc_pool (const char *name, size_t size, size_t num)
#endif
/* Um, we can't really allocate 0 elements per block. */
- gcc_assert (num);
+ gcc_checking_assert (num);
/* Allocate memory for the pool structure. */
pool = XNEW (struct alloc_pool_def);
@@ -201,7 +201,7 @@ empty_alloc_pool (alloc_pool pool)
struct alloc_pool_descriptor *desc = alloc_pool_descriptor (pool->name);
#endif
- gcc_assert (pool);
+ gcc_checking_assert (pool);
/* Free each block allocated to the pool. */
for (block = pool->block_list; block != NULL; block = next_block)
@@ -260,7 +260,7 @@ pool_alloc (alloc_pool pool)
desc->peak = desc->current;
#endif
- gcc_assert (pool);
+ gcc_checking_assert (pool);
/* If there are no more free elements, make some more!. */
if (!pool->returned_free_list)
@@ -328,19 +328,19 @@ pool_free (alloc_pool pool, void *ptr)
struct alloc_pool_descriptor *desc = alloc_pool_descriptor (pool->name);
#endif
- gcc_assert (ptr);
#ifdef ENABLE_CHECKING
- /* Check whether the PTR was allocated from POOL. */
- gcc_assert (pool->id == ALLOCATION_OBJECT_PTR_FROM_USER_PTR (ptr)->id);
+ gcc_assert (ptr
+ /* Check if we free more than we allocated, which is Bad (TM). */
+ && pool->elts_free < pool->elts_allocated
+ /* Check whether the PTR was allocated from POOL. */
+ && pool->id == ALLOCATION_OBJECT_PTR_FROM_USER_PTR (ptr)->id);
memset (ptr, 0xaf, pool->elt_size - offsetof (allocation_object, u.data));
/* Mark the element to be free. */
ALLOCATION_OBJECT_PTR_FROM_USER_PTR (ptr)->id = 0;
#else
- /* Check if we free more than we allocated, which is Bad (TM). */
- gcc_assert (pool->elts_free < pool->elts_allocated);
#endif
header = (alloc_pool_list) ptr;
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 6b5c3adecbf..94dffc95eb2 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1068,6 +1068,13 @@ find_inc (bool first_try)
/* For the post_add to work, the result_reg of the inc must not be
used in the mem insn since this will become the new index
register. */
+ if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) == 0
+ && reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn)))
+ {
+ debug_rtx (mem_insn.insn);
+ debug_rtx (inc_insn.reg_res);
+ gcc_unreachable ();
+ }
if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) != 0)
{
if (dump_file)
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 95ad4a90505..135c0c22a07 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -443,8 +443,8 @@ extern int pre_and_rev_post_order_compute (int *, int *, bool);
extern int dfs_enumerate_from (basic_block, int,
bool (*)(const_basic_block, const void *),
basic_block *, int, const void *);
-extern void compute_dominance_frontiers (bitmap *);
-extern bitmap compute_idf (bitmap, bitmap *);
+extern void compute_dominance_frontiers (struct bitmap_head_def *);
+extern bitmap compute_idf (bitmap, struct bitmap_head_def *);
extern void dump_bb_info (basic_block, bool, bool, int, const char *, FILE *);
extern void dump_edge_info (FILE *, edge, int);
extern void brief_dump_cfg (FILE *);
@@ -554,7 +554,9 @@ single_pred_p (const_basic_block bb)
static inline edge
single_succ_edge (const_basic_block bb)
{
+#ifdef ENABLE_CHECKING
gcc_assert (single_succ_p (bb));
+#endif
return EDGE_SUCC (bb, 0);
}
@@ -564,7 +566,9 @@ single_succ_edge (const_basic_block bb)
static inline edge
single_pred_edge (const_basic_block bb)
{
+#ifdef ENABLE_CHECKING
gcc_assert (single_pred_p (bb));
+#endif
return EDGE_PRED (bb, 0);
}
@@ -596,7 +600,9 @@ typedef struct {
static inline VEC(edge,gc) *
ei_container (edge_iterator i)
{
+#ifdef ENABLE_CHECKING
gcc_assert (i.container);
+#endif
return *i.container;
}
@@ -647,7 +653,9 @@ ei_one_before_end_p (edge_iterator i)
static inline void
ei_next (edge_iterator *i)
{
+#ifdef ENABLE_CHECKING
gcc_assert (i->index < EDGE_COUNT (ei_container (*i)));
+#endif
i->index++;
}
@@ -655,7 +663,9 @@ ei_next (edge_iterator *i)
static inline void
ei_prev (edge_iterator *i)
{
+#ifdef ENABLE_CHECKING
gcc_assert (i->index > 0);
+#endif
i->index--;
}
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 8f4a56606bd..f2fd2bdb510 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -230,7 +230,7 @@ bitmap_element_allocate (bitmap head)
/* Inner list was just a singleton. */
bitmap_ggc_free = element->prev;
else
- element = GGC_NEW (bitmap_element);
+ element = ggc_alloc_bitmap_element_def ();
}
#ifdef GATHER_STATISTICS
@@ -375,7 +375,7 @@ bitmap_gc_alloc_stat (ALONE_MEM_STAT_DECL)
{
bitmap map;
- map = GGC_NEW (struct bitmap_head_def);
+ map = ggc_alloc_bitmap_head_def ();
bitmap_initialize_stat (map, NULL PASS_MEM_STAT);
#ifdef GATHER_STATISTICS
register_overhead (map, sizeof (bitmap_head));
@@ -499,7 +499,7 @@ bitmap_elt_insert_after (bitmap head, bitmap_element *elt, unsigned int indx)
}
else
{
- gcc_assert (head->current);
+ gcc_checking_assert (head->current);
node->next = elt->next;
if (node->next)
node->next->prev = node;
@@ -624,11 +624,13 @@ bitmap_clear_bit (bitmap head, int bit)
BITMAP_WORD bit_val = ((BITMAP_WORD) 1) << bit_num;
bool res = (ptr->bits[word_num] & bit_val) != 0;
if (res)
- ptr->bits[word_num] &= ~bit_val;
-
- /* If we cleared the entire word, free up the element. */
- if (bitmap_element_zerop (ptr))
- bitmap_element_free (head, ptr);
+ {
+ ptr->bits[word_num] &= ~bit_val;
+ /* If we cleared the entire word, free up the element. */
+ if (!ptr->bits[word_num]
+ && bitmap_element_zerop (ptr))
+ bitmap_element_free (head, ptr);
+ }
return res;
}
@@ -780,7 +782,7 @@ bitmap_first_set_bit (const_bitmap a)
BITMAP_WORD word;
unsigned ix;
- gcc_assert (elt);
+ gcc_checking_assert (elt);
bit_no = elt->indx * BITMAP_ELEMENT_ALL_BITS;
for (ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
{
@@ -815,7 +817,7 @@ bitmap_first_set_bit (const_bitmap a)
if (!(word & 0x1))
word >>= 1, bit_no += 1;
- gcc_assert (word & 1);
+ gcc_checking_assert (word & 1);
#endif
return bit_no;
}
@@ -831,7 +833,7 @@ bitmap_last_set_bit (const_bitmap a)
BITMAP_WORD word;
int ix;
- gcc_assert (elt);
+ gcc_checking_assert (elt);
while (elt->next)
elt = elt->next;
bit_no = elt->indx * BITMAP_ELEMENT_ALL_BITS;
@@ -869,7 +871,7 @@ bitmap_last_set_bit (const_bitmap a)
word >>= 1, bit_no += 1;
#endif
- gcc_assert (word & 1);
+ gcc_checking_assert (word & 1);
return bit_no;
}
@@ -908,7 +910,7 @@ bitmap_and (bitmap dst, const_bitmap a, const_bitmap b)
dst_elt = bitmap_elt_insert_after (dst, dst_prev, a_elt->indx);
else
dst_elt->indx = a_elt->indx;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] & b_elt->bits[ix];
@@ -927,7 +929,7 @@ bitmap_and (bitmap dst, const_bitmap a, const_bitmap b)
/* Ensure that dst->current is valid. */
dst->current = dst->first;
bitmap_elt_clear_from (dst, dst_elt);
- gcc_assert (!dst->current == !dst->first);
+ gcc_checking_assert (!dst->current == !dst->first);
if (dst->current)
dst->indx = dst->current->indx;
}
@@ -960,7 +962,7 @@ bitmap_and_into (bitmap a, const_bitmap b)
unsigned ix;
BITMAP_WORD ior = 0;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] & b_elt->bits[ix];
@@ -975,8 +977,8 @@ bitmap_and_into (bitmap a, const_bitmap b)
}
}
bitmap_elt_clear_from (a, a_elt);
- gcc_assert (!a->current == !a->first);
- gcc_assert (!a->current || a->indx == a->current->indx);
+ gcc_checking_assert (!a->current == !a->first
+ && (!a->current || a->indx == a->current->indx));
}
@@ -992,7 +994,7 @@ bitmap_elt_copy (bitmap dst, bitmap_element *dst_elt, bitmap_element *dst_prev,
{
unsigned ix;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
if (src_elt->bits[ix] != dst_elt->bits[ix])
{
dst_elt->bits[ix] = src_elt->bits[ix];
@@ -1056,7 +1058,7 @@ bitmap_and_compl (bitmap dst, const_bitmap a, const_bitmap b)
if (!changed && dst_elt && dst_elt->indx == a_elt->indx)
{
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] & ~b_elt->bits[ix];
@@ -1082,7 +1084,7 @@ bitmap_and_compl (bitmap dst, const_bitmap a, const_bitmap b)
new_element = false;
}
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] & ~b_elt->bits[ix];
@@ -1119,7 +1121,7 @@ bitmap_and_compl (bitmap dst, const_bitmap a, const_bitmap b)
changed = true;
bitmap_elt_clear_from (dst, dst_elt);
}
- gcc_assert (!dst->current == !dst->first);
+ gcc_checking_assert (!dst->current == !dst->first);
if (dst->current)
dst->indx = dst->current->indx;
@@ -1159,7 +1161,7 @@ bitmap_and_compl_into (bitmap a, const_bitmap b)
unsigned ix;
BITMAP_WORD ior = 0;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD cleared = a_elt->bits[ix] & b_elt->bits[ix];
BITMAP_WORD r = a_elt->bits[ix] ^ cleared;
@@ -1175,8 +1177,8 @@ bitmap_and_compl_into (bitmap a, const_bitmap b)
b_elt = b_elt->next;
}
}
- gcc_assert (!a->current == !a->first);
- gcc_assert (!a->current || a->indx == a->current->indx);
+ gcc_checking_assert (!a->current == !a->first
+ && (!a->current || a->indx == a->current->indx));
return changed != 0;
}
@@ -1207,7 +1209,7 @@ bitmap_set_range (bitmap head, unsigned int start, unsigned int count)
bitmap_element_link (head, elt);
}
- gcc_assert (elt->indx == first_index);
+ gcc_checking_assert (elt->indx == first_index);
elt_prev = elt->prev;
for (i = first_index; i <= last_index; i++)
{
@@ -1453,7 +1455,7 @@ bitmap_compl_and_into (bitmap a, const_bitmap b)
unsigned ix;
BITMAP_WORD ior = 0;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD cleared = a_elt->bits[ix] & b_elt->bits[ix];
BITMAP_WORD r = b_elt->bits[ix] ^ cleared;
@@ -1470,8 +1472,8 @@ bitmap_compl_and_into (bitmap a, const_bitmap b)
b_elt = b_elt->next;
}
}
- gcc_assert (!a->current == !a->first);
- gcc_assert (!a->current || a->indx == a->current->indx);
+ gcc_checking_assert (!a->current == !a->first
+ && (!a->current || a->indx == a->current->indx));
return;
}
@@ -1494,7 +1496,7 @@ bitmap_elt_ior (bitmap dst, bitmap_element *dst_elt, bitmap_element *dst_prev,
if (!changed && dst_elt && dst_elt->indx == a_elt->indx)
{
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] | b_elt->bits[ix];
if (r != dst_elt->bits[ix])
@@ -1511,7 +1513,7 @@ bitmap_elt_ior (bitmap dst, bitmap_element *dst_elt, bitmap_element *dst_prev,
dst_elt = bitmap_elt_insert_after (dst, dst_prev, a_elt->indx);
else
dst_elt->indx = a_elt->indx;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] | b_elt->bits[ix];
dst_elt->bits[ix] = r;
@@ -1528,7 +1530,7 @@ bitmap_elt_ior (bitmap dst, bitmap_element *dst_elt, bitmap_element *dst_prev,
else
src = b_elt;
- gcc_assert (src);
+ gcc_checking_assert (src);
changed = bitmap_elt_copy (dst, dst_elt, dst_prev, src, changed);
}
return changed;
@@ -1576,7 +1578,7 @@ bitmap_ior (bitmap dst, const_bitmap a, const_bitmap b)
changed = true;
bitmap_elt_clear_from (dst, dst_elt);
}
- gcc_assert (!dst->current == !dst->first);
+ gcc_checking_assert (!dst->current == !dst->first);
if (dst->current)
dst->indx = dst->current->indx;
return changed;
@@ -1615,7 +1617,7 @@ bitmap_ior_into (bitmap a, const_bitmap b)
a_elt = *a_prev_pnext;
}
- gcc_assert (!a->current == !a->first);
+ gcc_checking_assert (!a->current == !a->first);
if (a->current)
a->indx = a->current->indx;
return changed;
@@ -1650,7 +1652,7 @@ bitmap_xor (bitmap dst, const_bitmap a, const_bitmap b)
dst_elt = bitmap_elt_insert_after (dst, dst_prev, a_elt->indx);
else
dst_elt->indx = a_elt->indx;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] ^ b_elt->bits[ix];
@@ -1693,7 +1695,7 @@ bitmap_xor (bitmap dst, const_bitmap a, const_bitmap b)
/* Ensure that dst->current is valid. */
dst->current = dst->first;
bitmap_elt_clear_from (dst, dst_elt);
- gcc_assert (!dst->current == !dst->first);
+ gcc_checking_assert (!dst->current == !dst->first);
if (dst->current)
dst->indx = dst->current->indx;
}
@@ -1735,7 +1737,7 @@ bitmap_xor_into (bitmap a, const_bitmap b)
BITMAP_WORD ior = 0;
bitmap_element *next = a_elt->next;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = a_elt->bits[ix] ^ b_elt->bits[ix];
@@ -1750,7 +1752,7 @@ bitmap_xor_into (bitmap a, const_bitmap b)
a_elt = next;
}
}
- gcc_assert (!a->current == !a->first);
+ gcc_checking_assert (!a->current == !a->first);
if (a->current)
a->indx = a->current->indx;
}
@@ -1772,7 +1774,7 @@ bitmap_equal_p (const_bitmap a, const_bitmap b)
{
if (a_elt->indx != b_elt->indx)
return false;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
if (a_elt->bits[ix] != b_elt->bits[ix])
return false;
}
@@ -1797,7 +1799,7 @@ bitmap_intersect_p (const_bitmap a, const_bitmap b)
b_elt = b_elt->next;
else
{
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
if (a_elt->bits[ix] & b_elt->bits[ix])
return true;
a_elt = a_elt->next;
@@ -1824,7 +1826,7 @@ bitmap_intersect_compl_p (const_bitmap a, const_bitmap b)
b_elt = b_elt->next;
else
{
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
if (a_elt->bits[ix] & ~b_elt->bits[ix])
return true;
a_elt = a_elt->next;
@@ -1880,7 +1882,7 @@ bitmap_ior_and_compl (bitmap dst, const_bitmap a, const_bitmap b, const_bitmap k
BITMAP_WORD ior = 0;
tmp_elt.indx = b_elt->indx;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
BITMAP_WORD r = b_elt->bits[ix] & ~kill_elt->bits[ix];
ior |= r;
@@ -1932,7 +1934,7 @@ bitmap_ior_and_compl (bitmap dst, const_bitmap a, const_bitmap b, const_bitmap k
changed = true;
bitmap_elt_clear_from (dst, dst_elt);
}
- gcc_assert (!dst->current == !dst->first);
+ gcc_checking_assert (!dst->current == !dst->first);
if (dst->current)
dst->indx = dst->current->indx;
@@ -1998,7 +2000,7 @@ bitmap_ior_and_into (bitmap a, const_bitmap b, const_bitmap c)
overall = 0;
and_elt.indx = b_elt->indx;
- for (ix = BITMAP_ELEMENT_WORDS; ix--;)
+ for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{
and_elt.bits[ix] = b_elt->bits[ix] & c_elt->bits[ix];
overall |= and_elt.bits[ix];
@@ -2028,7 +2030,7 @@ bitmap_ior_and_into (bitmap a, const_bitmap b, const_bitmap c)
}
done:
- gcc_assert (!a->current == !a->first);
+ gcc_checking_assert (!a->current == !a->first);
if (a->current)
a->indx = a->current->indx;
return changed;
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index bbc0e20cfef..68a46204a54 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -77,7 +77,7 @@ typedef struct GTY(()) bitmap_head_def {
bitmap_element *current; /* Last element looked at. */
unsigned int indx; /* Index of last element looked at. */
bitmap_obstack *obstack; /* Obstack to allocate elements from.
- If NULL, then use ggc_alloc. */
+ If NULL, then use GGC allocation. */
#ifdef GATHER_STATISTICS
struct bitmap_descriptor GTY((skip)) *desc;
#endif
@@ -385,6 +385,27 @@ bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no)
*bit_no += 1;
}
+/* Advance to first set bit in BI. */
+
+static inline void
+bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no)
+{
+#if (GCC_VERSION >= 3004)
+ {
+ unsigned int n = __builtin_ctzl (bi->bits);
+ gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
+ bi->bits >>= n;
+ *bit_no += n;
+ }
+#else
+ while (!(bi->bits & 1))
+ {
+ bi->bits >>= 1;
+ *bit_no += 1;
+ }
+#endif
+}
+
/* Advance to the next nonzero bit of a single bitmap, we will have
already advanced past the just iterated bit. Return true if there
is a bit to iterate. */
@@ -396,11 +417,7 @@ bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no)
if (bi->bits)
{
next_bit:
- while (!(bi->bits & 1))
- {
- bi->bits >>= 1;
- *bit_no += 1;
- }
+ bmp_iter_next_bit (bi, bit_no);
return true;
}
@@ -443,11 +460,7 @@ bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no)
if (bi->bits)
{
next_bit:
- while (!(bi->bits & 1))
- {
- bi->bits >>= 1;
- *bit_no += 1;
- }
+ bmp_iter_next_bit (bi, bit_no);
return true;
}
@@ -510,11 +523,7 @@ bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no)
if (bi->bits)
{
next_bit:
- while (!(bi->bits & 1))
- {
- bi->bits >>= 1;
- *bit_no += 1;
- }
+ bmp_iter_next_bit (bi, bit_no);
return true;
}
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index 5e3d12c359a..abb033fc096 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -1458,7 +1458,8 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save)
static void
branch_target_load_optimize (bool after_prologue_epilogue_gen)
{
- enum reg_class klass = targetm.branch_target_register_class ();
+ enum reg_class klass
+ = (enum reg_class) targetm.branch_target_register_class ();
if (klass != NO_REGS)
{
/* Initialize issue_rate. */
diff --git a/gcc/builtins.c b/gcc/builtins.c
index e57449ddcae..ddbbd79dbe2 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2521,8 +2521,6 @@ build_call_nofold_loc (location_t loc, tree fndecl, int n, ...)
SET_EXPR_LOCATION (fn, loc);
return fn;
}
-#define build_call_nofold(...) \
- build_call_nofold_loc (UNKNOWN_LOCATION, __VA_ARGS__)
/* Expand a call to one of the builtin rounding functions gcc defines
as an extension (lfloor and lceil). As these are gcc extensions we
@@ -2640,7 +2638,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target)
fallback_fndecl = build_fn_decl (name, fntype);
}
- exp = build_call_nofold (fallback_fndecl, 1, arg);
+ exp = build_call_nofold_loc (EXPR_LOCATION (exp), fallback_fndecl, 1, arg);
tmp = expand_normal (exp);
@@ -3085,7 +3083,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
&& (optab_handler (sqrt_optab, mode)->insn_code
!= CODE_FOR_nothing))))
{
- tree call_expr = build_call_nofold (fn, 1, narg0);
+ tree call_expr = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 1,
+ narg0);
/* Use expand_expr in case the newly built call expression
was folded to a non-call. */
op = expand_expr (call_expr, subtarget, mode, EXPAND_NORMAL);
@@ -3137,7 +3136,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
&& powi_cost (n/3) <= POWI_MAX_MULTS)
|| n == 1))
{
- tree call_expr = build_call_nofold (fn, 1,narg0);
+ tree call_expr = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 1,
+ narg0);
op = expand_builtin (call_expr, NULL_RTX, subtarget, mode, 0);
if (abs (n) % 3 == 2)
op = expand_simple_binop (mode, MULT, op, op, op,
@@ -3471,7 +3471,8 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len,
if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_MEMCPY])
{
tree fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
- tree result = build_call_nofold (fn, 3, dest, src, len);
+ tree result = build_call_nofold_loc (UNKNOWN_LOCATION, fn, 3,
+ dest, src, len);
return expand_expr (result, target, mode, EXPAND_NORMAL);
}
else
@@ -3553,7 +3554,7 @@ expand_movstr (tree dest, tree src, rtx target, int endp)
rtx dest_mem;
rtx src_mem;
rtx insn;
- const struct insn_data * data;
+ const struct insn_data_d * data;
if (!HAVE_movstr)
return NULL_RTX;
@@ -3652,7 +3653,7 @@ expand_builtin_stpcpy (tree exp, rtx target, enum machine_mode mode)
if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_STRCPY])
{
tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
- tree result = build_call_nofold (fn, 2, dst, src);
+ tree result = build_call_nofold_loc (loc, fn, 2, dst, src);
return expand_expr (result, target, mode, EXPAND_NORMAL);
}
else
@@ -3955,9 +3956,11 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
fndecl = get_callee_fndecl (orig_exp);
fcode = DECL_FUNCTION_CODE (fndecl);
if (fcode == BUILT_IN_MEMSET)
- fn = build_call_nofold (fndecl, 3, dest, val, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (orig_exp), fndecl, 3,
+ dest, val, len);
else if (fcode == BUILT_IN_BZERO)
- fn = build_call_nofold (fndecl, 2, dest, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (orig_exp), fndecl, 2,
+ dest, len);
else
gcc_unreachable ();
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
@@ -4230,7 +4233,7 @@ expand_builtin_strcmp (tree exp, ATTRIBUTE_UNUSED rtx target)
do_libcall:
#endif
fndecl = get_callee_fndecl (exp);
- fn = build_call_nofold (fndecl, 2, arg1, arg2);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fndecl, 2, arg1, arg2);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_call (fn, target, target == const0_rtx);
@@ -4352,7 +4355,8 @@ expand_builtin_strncmp (tree exp, ATTRIBUTE_UNUSED rtx target,
/* Expand the library call ourselves using a stabilized argument
list to avoid re-evaluating the function's arguments twice. */
fndecl = get_callee_fndecl (exp);
- fn = build_call_nofold (fndecl, 3, arg1, arg2, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fndecl, 3,
+ arg1, arg2, len);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_call (fn, target, target == const0_rtx);
@@ -4451,7 +4455,10 @@ stabilize_va_list_loc (location_t loc, tree valist, int needs_lvalue)
{
tree vatype = targetm.canonical_va_list_type (TREE_TYPE (valist));
- gcc_assert (vatype != NULL_TREE);
+ /* The current way of determining the type of valist is completely
+ bogus. We should have the information on the va builtin instead. */
+ if (!vatype)
+ vatype = targetm.fn_abi_va_list (cfun->decl);
if (TREE_CODE (vatype) == ARRAY_TYPE)
{
@@ -4470,21 +4477,21 @@ stabilize_va_list_loc (location_t loc, tree valist, int needs_lvalue)
}
else
{
- tree pt;
+ tree pt = build_pointer_type (vatype);
if (! needs_lvalue)
{
if (! TREE_SIDE_EFFECTS (valist))
return valist;
- pt = build_pointer_type (vatype);
valist = fold_build1_loc (loc, ADDR_EXPR, pt, valist);
TREE_SIDE_EFFECTS (valist) = 1;
}
if (TREE_SIDE_EFFECTS (valist))
valist = save_expr (valist);
- valist = build_fold_indirect_ref_loc (loc, valist);
+ valist = fold_build2_loc (loc, MEM_REF,
+ vatype, valist, build_int_cst (pt, 0));
}
return valist;
@@ -8342,6 +8349,7 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
{
tree srctype, desttype;
int src_align, dest_align;
+ tree off0;
if (endp == 3)
{
@@ -8367,37 +8375,26 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
}
/* If *src and *dest can't overlap, optimize into memcpy as well. */
- srcvar = build_fold_indirect_ref_loc (loc, src);
- destvar = build_fold_indirect_ref_loc (loc, dest);
- if (srcvar
- && !TREE_THIS_VOLATILE (srcvar)
- && destvar
- && !TREE_THIS_VOLATILE (destvar))
+ if (TREE_CODE (src) == ADDR_EXPR
+ && TREE_CODE (dest) == ADDR_EXPR)
{
tree src_base, dest_base, fn;
HOST_WIDE_INT src_offset = 0, dest_offset = 0;
HOST_WIDE_INT size = -1;
HOST_WIDE_INT maxsize = -1;
- src_base = srcvar;
- if (handled_component_p (src_base))
- src_base = get_ref_base_and_extent (src_base, &src_offset,
- &size, &maxsize);
- dest_base = destvar;
- if (handled_component_p (dest_base))
- dest_base = get_ref_base_and_extent (dest_base, &dest_offset,
- &size, &maxsize);
+ srcvar = TREE_OPERAND (src, 0);
+ src_base = get_ref_base_and_extent (srcvar, &src_offset,
+ &size, &maxsize);
+ destvar = TREE_OPERAND (dest, 0);
+ dest_base = get_ref_base_and_extent (destvar, &dest_offset,
+ &size, &maxsize);
if (host_integerp (len, 1))
- {
- maxsize = tree_low_cst (len, 1);
- if (maxsize
- > INTTYPE_MAXIMUM (HOST_WIDE_INT) / BITS_PER_UNIT)
- maxsize = -1;
- else
- maxsize *= BITS_PER_UNIT;
- }
+ maxsize = tree_low_cst (len, 1);
else
maxsize = -1;
+ src_offset /= BITS_PER_UNIT;
+ dest_offset /= BITS_PER_UNIT;
if (SSA_VAR_P (src_base)
&& SSA_VAR_P (dest_base))
{
@@ -8406,13 +8403,25 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
dest_offset, maxsize))
return NULL_TREE;
}
- else if (TREE_CODE (src_base) == INDIRECT_REF
- && TREE_CODE (dest_base) == INDIRECT_REF)
+ else if (TREE_CODE (src_base) == MEM_REF
+ && TREE_CODE (dest_base) == MEM_REF)
{
+ double_int off;
if (! operand_equal_p (TREE_OPERAND (src_base, 0),
- TREE_OPERAND (dest_base, 0), 0)
- || ranges_overlap_p (src_offset, maxsize,
- dest_offset, maxsize))
+ TREE_OPERAND (dest_base, 0), 0))
+ return NULL_TREE;
+ off = double_int_add (mem_ref_offset (src_base),
+ shwi_to_double_int (src_offset));
+ if (!double_int_fits_in_shwi_p (off))
+ return NULL_TREE;
+ src_offset = off.low;
+ off = double_int_add (mem_ref_offset (dest_base),
+ shwi_to_double_int (dest_offset));
+ if (!double_int_fits_in_shwi_p (off))
+ return NULL_TREE;
+ dest_offset = off.low;
+ if (ranges_overlap_p (src_offset, maxsize,
+ dest_offset, maxsize))
return NULL_TREE;
}
else
@@ -8468,12 +8477,12 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
dest = build1 (NOP_EXPR, build_pointer_type (desttype), dest);
}
if (!srctype || !desttype
+ || TREE_ADDRESSABLE (srctype)
+ || TREE_ADDRESSABLE (desttype)
|| !TYPE_SIZE_UNIT (srctype)
|| !TYPE_SIZE_UNIT (desttype)
|| TREE_CODE (TYPE_SIZE_UNIT (srctype)) != INTEGER_CST
- || TREE_CODE (TYPE_SIZE_UNIT (desttype)) != INTEGER_CST
- || TYPE_VOLATILE (srctype)
- || TYPE_VOLATILE (desttype))
+ || TREE_CODE (TYPE_SIZE_UNIT (desttype)) != INTEGER_CST)
return NULL_TREE;
src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
@@ -8485,97 +8494,44 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
if (!ignore)
dest = builtin_save_expr (dest);
- srcvar = NULL_TREE;
- if (tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len))
- {
- srcvar = build_fold_indirect_ref_loc (loc, src);
- if (TREE_THIS_VOLATILE (srcvar))
- return NULL_TREE;
- else if (!tree_int_cst_equal (tree_expr_size (srcvar), len))
- srcvar = NULL_TREE;
- /* With memcpy, it is possible to bypass aliasing rules, so without
- this check i.e. execute/20060930-2.c would be misoptimized,
- because it use conflicting alias set to hold argument for the
- memcpy call. This check is probably unnecessary with
- -fno-strict-aliasing. Similarly for destvar. See also
- PR29286. */
- else if (!var_decl_component_p (srcvar))
- srcvar = NULL_TREE;
- }
-
- destvar = NULL_TREE;
- if (tree_int_cst_equal (TYPE_SIZE_UNIT (desttype), len))
- {
- destvar = build_fold_indirect_ref_loc (loc, dest);
- if (TREE_THIS_VOLATILE (destvar))
- return NULL_TREE;
- else if (!tree_int_cst_equal (tree_expr_size (destvar), len))
- destvar = NULL_TREE;
- else if (!var_decl_component_p (destvar))
- destvar = NULL_TREE;
- }
+ /* Build accesses at offset zero with a ref-all character type. */
+ off0 = build_int_cst (build_pointer_type_for_mode (char_type_node,
+ ptr_mode, true), 0);
+
+ destvar = dest;
+ STRIP_NOPS (destvar);
+ if (TREE_CODE (destvar) == ADDR_EXPR
+ && var_decl_component_p (TREE_OPERAND (destvar, 0))
+ && tree_int_cst_equal (TYPE_SIZE_UNIT (desttype), len))
+ destvar = fold_build2 (MEM_REF, desttype, destvar, off0);
+ else
+ destvar = NULL_TREE;
+
+ srcvar = src;
+ STRIP_NOPS (srcvar);
+ if (TREE_CODE (srcvar) == ADDR_EXPR
+ && var_decl_component_p (TREE_OPERAND (srcvar, 0))
+ && tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len))
+ srcvar = fold_build2 (MEM_REF, destvar ? desttype : srctype,
+ srcvar, off0);
+ else
+ srcvar = NULL_TREE;
if (srcvar == NULL_TREE && destvar == NULL_TREE)
return NULL_TREE;
if (srcvar == NULL_TREE)
{
- tree srcptype;
- if (TREE_ADDRESSABLE (TREE_TYPE (destvar)))
- return NULL_TREE;
-
- srctype = build_qualified_type (desttype, 0);
- if (src_align < (int) TYPE_ALIGN (srctype))
- {
- if (AGGREGATE_TYPE_P (srctype)
- || SLOW_UNALIGNED_ACCESS (TYPE_MODE (srctype), src_align))
- return NULL_TREE;
-
- srctype = build_variant_type_copy (srctype);
- TYPE_ALIGN (srctype) = src_align;
- TYPE_USER_ALIGN (srctype) = 1;
- TYPE_PACKED (srctype) = 1;
- }
- srcptype = build_pointer_type_for_mode (srctype, ptr_mode, true);
- src = fold_convert_loc (loc, srcptype, src);
- srcvar = build_fold_indirect_ref_loc (loc, src);
+ STRIP_NOPS (src);
+ srcvar = fold_build2 (MEM_REF, desttype, src, off0);
}
else if (destvar == NULL_TREE)
{
- tree destptype;
- if (TREE_ADDRESSABLE (TREE_TYPE (srcvar)))
- return NULL_TREE;
-
- desttype = build_qualified_type (srctype, 0);
- if (dest_align < (int) TYPE_ALIGN (desttype))
- {
- if (AGGREGATE_TYPE_P (desttype)
- || SLOW_UNALIGNED_ACCESS (TYPE_MODE (desttype), dest_align))
- return NULL_TREE;
+ STRIP_NOPS (dest);
+ destvar = fold_build2 (MEM_REF, srctype, dest, off0);
+ }
- desttype = build_variant_type_copy (desttype);
- TYPE_ALIGN (desttype) = dest_align;
- TYPE_USER_ALIGN (desttype) = 1;
- TYPE_PACKED (desttype) = 1;
- }
- destptype = build_pointer_type_for_mode (desttype, ptr_mode, true);
- dest = fold_convert_loc (loc, destptype, dest);
- destvar = build_fold_indirect_ref_loc (loc, dest);
- }
-
- if (srctype == desttype
- || (gimple_in_ssa_p (cfun)
- && useless_type_conversion_p (desttype, srctype)))
- expr = srcvar;
- else if ((INTEGRAL_TYPE_P (TREE_TYPE (srcvar))
- || POINTER_TYPE_P (TREE_TYPE (srcvar)))
- && (INTEGRAL_TYPE_P (TREE_TYPE (destvar))
- || POINTER_TYPE_P (TREE_TYPE (destvar))))
- expr = fold_convert_loc (loc, TREE_TYPE (destvar), srcvar);
- else
- expr = fold_build1_loc (loc, VIEW_CONVERT_EXPR,
- TREE_TYPE (destvar), srcvar);
- expr = build2 (MODIFY_EXPR, TREE_TYPE (destvar), destvar, expr);
+ expr = build2 (MODIFY_EXPR, TREE_TYPE (destvar), destvar, srcvar);
}
if (ignore)
@@ -10758,6 +10714,26 @@ build_call_expr_loc (location_t loc, tree fndecl, int n, ...)
return fold_builtin_call_array (loc, TREE_TYPE (fntype), fn, n, argarray);
}
+/* Like build_call_expr_loc (UNKNOWN_LOCATION, ...). Duplicated because
+ varargs macros aren't supported by all bootstrap compilers. */
+
+tree
+build_call_expr (tree fndecl, int n, ...)
+{
+ va_list ap;
+ tree fntype = TREE_TYPE (fndecl);
+ tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
+ tree *argarray = (tree *) alloca (n * sizeof (tree));
+ int i;
+
+ va_start (ap, n);
+ for (i = 0; i < n; i++)
+ argarray[i] = va_arg (ap, tree);
+ va_end (ap);
+ return fold_builtin_call_array (UNKNOWN_LOCATION, TREE_TYPE (fntype),
+ fn, n, argarray);
+}
+
/* Construct a CALL_EXPR with type TYPE with FN as the function expression.
N arguments are passed in the array ARGARRAY. */
@@ -11848,7 +11824,7 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode,
if (! fn)
return NULL_RTX;
- fn = build_call_nofold (fn, 3, dest, src, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 3, dest, src, len);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_expr (fn, target, mode, EXPAND_NORMAL);
@@ -11896,7 +11872,8 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode,
tree fn = built_in_decls[BUILT_IN_MEMCPY_CHK];
if (!fn)
return NULL_RTX;
- fn = build_call_nofold (fn, 4, dest, src, len, size);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 4,
+ dest, src, len, size);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_expr (fn, target, mode, EXPAND_NORMAL);
@@ -12043,7 +12020,7 @@ maybe_emit_free_warning (tree exp)
return;
arg = get_base_address (TREE_OPERAND (arg, 0));
- if (arg == NULL || INDIRECT_REF_P (arg))
+ if (arg == NULL || INDIRECT_REF_P (arg) || TREE_CODE (arg) == MEM_REF)
return;
if (SSA_VAR_P (arg))
diff --git a/gcc/c-config-lang.in b/gcc/c-config-lang.in
index d3cd6f9efea..d9138031190 100644
--- a/gcc/c-config-lang.in
+++ b/gcc/c-config-lang.in
@@ -22,4 +22,4 @@
# files used by C that have garbage collection GTY macros in them
# which therefore need to be scanned by gengtype.c.
-gtfiles="\$(srcdir)/c-lang.c \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.h \$(srcdir)/c-pragma.c \$(srcdir)/c-objc-common.c \$(srcdir)/c-parser.c \$(srcdir)/c-lang.h"
+gtfiles="\$(srcdir)/c-lang.c \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/c-objc-common.c \$(srcdir)/c-parser.c \$(srcdir)/c-lang.h"
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index 09638d5b151..4de3cdb1c57 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "flags.h"
#include "convert.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "c-tree.h"
#include "langhooks.h"
#include "toplev.h"
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index cda6ce3ca77..2033a3b1e9f 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -45,8 +45,8 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "opts.h"
#include "timevar.h"
-#include "c-common.h"
-#include "c-pragma.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
#include "c-lang.h"
#include "langhooks.h"
#include "tree-mudflap.h"
@@ -58,7 +58,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks-def.h"
#include "pointer-set.h"
#include "plugin.h"
-#include "c-ada-spec.h"
+#include "c-family/c-ada-spec.h"
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
enum decl_context
@@ -590,7 +590,7 @@ bind (tree name, tree decl, struct c_scope *scope, bool invisible,
binding_freelist = b->prev;
}
else
- b = GGC_NEW (struct c_binding);
+ b = ggc_alloc_c_binding ();
b->shadowed = 0;
b->decl = decl;
@@ -704,7 +704,7 @@ void
record_inline_static (location_t loc, tree func, tree decl,
enum c_inline_static_type type)
{
- struct c_inline_static *csi = GGC_NEW (struct c_inline_static);
+ struct c_inline_static *csi = ggc_alloc_c_inline_static ();
csi->location = loc;
csi->function = func;
csi->static_decl = decl;
@@ -928,7 +928,7 @@ push_scope (void)
scope_freelist = scope->outer;
}
else
- scope = GGC_CNEW (struct c_scope);
+ scope = ggc_alloc_cleared_c_scope ();
/* The FLOAT_CONST_DECIMAL64 pragma applies to nested scopes. */
if (current_scope)
@@ -3007,7 +3007,7 @@ make_label (location_t location, tree name, bool defining,
DECL_CONTEXT (label) = current_function_decl;
DECL_MODE (label) = VOIDmode;
- label_vars = GGC_NEW (struct c_label_vars);
+ label_vars = ggc_alloc_c_label_vars ();
label_vars->shadowed = NULL;
set_spot_bindings (&label_vars->label_bindings, defining);
label_vars->decls_in_scope = make_tree_vector ();
@@ -3105,7 +3105,7 @@ lookup_label_for_goto (location_t loc, tree name)
{
struct c_goto_bindings *g;
- g = GGC_NEW (struct c_goto_bindings);
+ g = ggc_alloc_c_goto_bindings ();
g->loc = loc;
set_spot_bindings (&g->goto_bindings, true);
VEC_safe_push (c_goto_bindings_p, gc, label_vars->gotos, g);
@@ -5901,12 +5901,6 @@ grokdeclarator (const struct c_declarator *declarator,
pedwarn (loc, OPT_pedantic,
"ISO C forbids qualified function types");
- /* GNU C interprets a volatile-qualified function type to indicate
- that the function does not return. */
- if ((type_quals & TYPE_QUAL_VOLATILE)
- && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
- warning_at (loc, 0, "%<noreturn%> function returns non-void value");
-
/* Every function declaration is an external reference
(DECL_EXTERNAL) except for those which are not at file
scope and are explicitly declared "auto". This is
@@ -6993,9 +6987,9 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
ensure that this lives as long as the rest of the struct decl.
All decls in an inline function need to be saved. */
- space = GGC_CNEW (struct lang_type);
- space2 = GGC_NEWVAR (struct sorted_fields_type,
- sizeof (struct sorted_fields_type) + len * sizeof (tree));
+ space = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
+ space2 = ggc_alloc_sorted_fields_type
+ (sizeof (struct sorted_fields_type) + len * sizeof (tree));
len = 0;
space->s = space2;
@@ -7276,7 +7270,7 @@ finish_enum (tree enumtype, tree values, tree attributes)
/* Record the min/max values so that we can warn about bit-field
enumerations that are too small for the values. */
- lt = GGC_CNEW (struct lang_type);
+ lt = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
lt->enum_min = minnode;
lt->enum_max = maxnode;
TYPE_LANG_SPECIFIC (enumtype) = lt;
@@ -8299,7 +8293,7 @@ void
c_push_function_context (void)
{
struct language_function *p;
- p = GGC_NEW (struct language_function);
+ p = ggc_alloc_language_function ();
cfun->language = p;
p->base.x_stmt_tree = c_stmt_tree;
@@ -9664,11 +9658,6 @@ c_write_global_declarations (void)
if (pch_file)
return;
- /* Don't waste time on further processing if -fsyntax-only.
- Continue for warning and errors issued during lowering though. */
- if (flag_syntax_only)
- return;
-
/* Close the external scope. */
ext_block = pop_scope ();
external_scope = 0;
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
new file mode 100644
index 00000000000..4047ca54176
--- /dev/null
+++ b/gcc/c-family/ChangeLog
@@ -0,0 +1,162 @@
+2010-06-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * c-gimplify.c: Do not include tree-flow.h
+
+2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR other/44034
+ * c-common.c: Rename targetm member:
+ targetm.enum_va_list -> targetm.enum_va_list_p
+
+2010-06-28 Anatoly Sokolov <aesok@post.ru>
+
+ * c-common.c (shorten_compare): Adjust call to force_fit_type_double.
+
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * c-cppbuiltin.c: Do not include except.h.
+
+2010-06-24 Andi Kleen <ak@linux.intel.com>
+
+ * c-common.c (warn_for_omitted_condop): New.
+ * c-common.h (warn_for_omitted_condop): Add prototype.
+
+2010-06-21 Joseph Myers <joseph@codesourcery.com>
+
+ * c.opt (lang-objc): Remove.
+ * c-opts.c (c_common_handle_option): Don't handle OPT_lang_objc.
+
+2010-06-21 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * c-opts.c: Include "tm_p.h".
+
+2010-06-20 Joseph Myers <joseph@codesourcery.com>
+
+ * c-common.c (parse_optimize_options): Update call to
+ decode_options.
+
+2010-06-18 Nathan Froyd <froydnj@codesourcery.com>
+
+ * c-common.c (record_types_used_by_current_var_decl): Adjust for
+ new type of types_used_by_cur_var_decl.
+
+2010-06-17 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR bootstrap/44512
+ * c-cppbuiltin.c (builtin_define_with_hex_fp_value): Add cast
+ for C++ standard compliance.
+
+2010-06-16 Jason Merrill <jason@redhat.com>
+
+ * c.opt: Add -Wnoexcept.
+
+2010-06-16 Richard Guenther <rguenther@suse.de>
+
+ PR c/44555
+ * c-common.c (c_common_truthvalue_conversion): Remove
+ premature and wrong optimization concering ADDR_EXPRs.
+
+2010-06-15 Arnaud Charlet <charlet@adacore.com>
+
+ * c-ada-spec.c (dump_sloc): Remove column info.
+ (is_simple_enum): New function.
+ (dump_generic_ada_node, print_ada_declaration): Map C enum types to Ada
+ enum types when relevant.
+
+2010-06-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * c-common.c (conversion_warning): Warn at expression
+ location.
+
+2010-06-10 Joseph Myers <joseph@codesourcery.com>
+
+ * c-opts.c (c_common_handle_option): Don't handle
+ OPT_fshow_column.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * c-pragma.c (push_alignment): Use typed GC allocation.
+ (handle_pragma_push_options): Likewise.
+
+ * c-common.c (parse_optimize_options): Likewise.
+
+ * c-common.h (struct sorted_fields_type): Add variable_size GTY
+ option.
+
+2010-06-07 Joseph Myers <joseph@codesourcery.com>
+
+ * c-common.c (flag_preprocess_only, flag_undef, flag_no_builtin,
+ flag_no_nonansi_builtin, flag_short_double, flag_short_wchar,
+ flag_lax_vector_conversions, flag_ms_extensions, flag_no_asm,
+ flag_signed_bitfields, warn_strict_null_sentinel,
+ flag_nil_receivers, flag_zero_link, flag_replace_objc_classes,
+ flag_gen_declaration, flag_no_gnu_keywords,
+ flag_implement_inlines, flag_implicit_templates,
+ flag_implicit_inline_templates, flag_optional_diags,
+ flag_elide_constructors, flag_default_inline, flag_rtti,
+ flag_conserve_space, flag_access_control, flag_check_new,
+ flag_new_for_scope, flag_weak, flag_working_directory,
+ flag_use_cxa_atexit, flag_use_cxa_get_exception_ptr,
+ flag_enforce_eh_specs, flag_threadsafe_statics,
+ flag_pretty_templates): Remove.
+ * c-common.h (flag_preprocess_only, flag_nil_receivers,
+ flag_objc_exceptions, flag_objc_sjlj_exceptions, flag_zero_link,
+ flag_replace_objc_classes, flag_undef, flag_no_builtin,
+ flag_no_nonansi_builtin, flag_short_double, flag_short_wchar,
+ flag_lax_vector_conversions, flag_ms_extensions, flag_no_asm,
+ flag_const_strings, flag_signed_bitfields, flag_gen_declaration,
+ flag_no_gnu_keywords, flag_implement_inlines,
+ flag_implicit_templates, flag_implicit_inline_templates,
+ flag_optional_diags, flag_elide_constructors, flag_default_inline,
+ flag_rtti, flag_conserve_space, flag_access_control,
+ flag_check_new, flag_new_for_scope, flag_weak,
+ flag_working_directory, flag_use_cxa_atexit,
+ flag_use_cxa_get_exception_ptr, flag_enforce_eh_specs,
+ flag_threadsafe_statics, flag_pretty_templates,
+ warn_strict_null_sentinel): Remove.
+ * c.opt (E, Wstrict-null-sentinel, faccess-control, fasm,
+ fbuiltin, fcheck-new, fconserve-space, felide-constructors,
+ fenforce-eh-specs, ffor-scope, fgnu-keywords, fimplement-inlines,
+ fimplicit-inline-templates, fimplicit-templates,
+ flax-vector-conversions, fms-extensions, fnil-receivers,
+ fnonansi-builtins, fpretty-templates, freplace-objc-classes,
+ frtti, fshort-double, fshort-enums, fshort-wchar,
+ fsigned-bitfields, fsigned-char, fstats, fthreadsafe-statics,
+ funsigned-bitfields, funsigned-char, fuse-cxa-atexit,
+ fuse-cxa-get-exception-ptr, fweak, fworking-directory, fzero-link,
+ gen-decls, undef): Use Var.
+ (fdefault-inline, foptional-diags): Document as doing nothing.
+ * c-opts.c (c_common_handle_option): Remove cases for options now
+ using Var. Mark ignored options as such.
+
+2010-06-05 Steven Bosscher <steven@gcc.gnu.org>
+
+ * c-common.c: Moved to here from parent directory.
+ * c-common.def: Likewise.
+ * c-common.h: Likewise.
+ * c-cppbuiltin.c: Likewise.
+ * c-dump.c: Likewise.
+ * c-format.c: Likewise.
+ * c-format.h : Likewise.
+ * c-gimplify.c: Likewise.
+ * c-lex.c: Likewise.
+ * c-omp.c: Likewise.
+ * c.opt: Likewise.
+ * c-opts.c: Likewise.
+ * c-pch.c: Likewise.
+ * c-ppoutput.c: Likewise.
+ * c-pragma.c: Likewise.
+ * c-pragma.h: Likewise.
+ * c-pretty-print.c: Likewise.
+ * c-pretty-print.h: Likewise.
+ * c-semantics.c: Likewise.
+ * stub-objc.c: Likewise.
+
+ * c-common.c: Include gt-c-family-c-common.h.
+ * c-pragma.c: Include gt-c-family-c-pragma.h.
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/gcc/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 697b9633afd..8e914866696 100644
--- a/gcc/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -1549,7 +1549,7 @@ dump_ada_array_domains (pretty_printer *buffer, tree node, int spc)
pp_character (buffer, ')');
}
-/* Dump in BUFFER file:line:col information related to NODE. */
+/* Dump in BUFFER file:line information related to NODE. */
static void
dump_sloc (pretty_printer *buffer, tree node)
@@ -1568,8 +1568,6 @@ dump_sloc (pretty_printer *buffer, tree node)
pp_string (buffer, xloc.file);
pp_string (buffer, ":");
pp_decimal_int (buffer, xloc.line);
- pp_string (buffer, ":");
- pp_decimal_int (buffer, xloc.column);
}
}
@@ -1721,6 +1719,33 @@ dump_ada_template (pretty_printer *buffer, tree t,
return num_inst > 0;
}
+/* Return true if NODE is a simple enum types, that can be mapped to an
+ Ada enum type directly. */
+
+static bool
+is_simple_enum (tree node)
+{
+ unsigned HOST_WIDE_INT count = 0;
+ tree value;
+
+ for (value = TYPE_VALUES (node); value; value = TREE_CHAIN (value))
+ {
+ tree int_val = TREE_VALUE (value);
+
+ if (TREE_CODE (int_val) != INTEGER_CST)
+ int_val = DECL_INITIAL (int_val);
+
+ if (!host_integerp (int_val, 0))
+ return false;
+ else if (TREE_INT_CST_LOW (int_val) != count)
+ return false;
+
+ count++;
+ }
+
+ return true;
+}
+
static bool in_function = true;
static bool bitfield_used = false;
@@ -1785,30 +1810,59 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type,
(buffer, TYPE_NAME (node), node, cpp_check, spc, 0, true);
else
{
- tree value;
-
- pp_string (buffer, "unsigned");
+ tree value = TYPE_VALUES (node);
- for (value = TYPE_VALUES (node); value; value = TREE_CHAIN (value))
+ if (is_simple_enum (node))
{
- pp_semicolon (buffer);
- newline_and_indent (buffer, spc);
-
- pp_ada_tree_identifier
- (buffer, TREE_PURPOSE (value), node, false);
- pp_string (buffer, " : constant ");
+ bool first = true;
+ spc += INDENT_INCR;
+ newline_and_indent (buffer, spc - 1);
+ pp_string (buffer, "(");
+ for (; value; value = TREE_CHAIN (value))
+ {
+ if (first)
+ first = false;
+ else
+ {
+ pp_string (buffer, ",");
+ newline_and_indent (buffer, spc);
+ }
+ pp_ada_tree_identifier
+ (buffer, TREE_PURPOSE (value), node, false);
+ }
+ pp_string (buffer, ");");
+ spc -= INDENT_INCR;
+ newline_and_indent (buffer, spc);
+ pp_string (buffer, "pragma Convention (C, ");
dump_generic_ada_node
(buffer, DECL_NAME (type) ? type : TYPE_NAME (node), type,
cpp_check, spc, 0, true);
+ pp_string (buffer, ")");
+ }
+ else
+ {
+ pp_string (buffer, "unsigned");
+ for (; value; value = TREE_CHAIN (value))
+ {
+ pp_semicolon (buffer);
+ newline_and_indent (buffer, spc);
- pp_string (buffer, " := ");
- dump_generic_ada_node
- (buffer,
- TREE_CODE (TREE_VALUE (value)) == INTEGER_CST ?
- TREE_VALUE (value) : DECL_INITIAL (TREE_VALUE (value)),
- node,
- cpp_check, spc, false, true);
+ pp_ada_tree_identifier
+ (buffer, TREE_PURPOSE (value), node, false);
+ pp_string (buffer, " : constant ");
+
+ dump_generic_ada_node
+ (buffer, DECL_NAME (type) ? type : TYPE_NAME (node), type,
+ cpp_check, spc, 0, true);
+
+ pp_string (buffer, " := ");
+ dump_generic_ada_node
+ (buffer,
+ TREE_CODE (TREE_VALUE (value)) == INTEGER_CST ?
+ TREE_VALUE (value) : DECL_INITIAL (TREE_VALUE (value)),
+ node, cpp_check, spc, false, true);
+ }
}
}
break;
@@ -2078,7 +2132,7 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type,
pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
pp_string (buffer, "B"); /* pseudo-unit */
}
- else if (! host_integerp (node, 0))
+ else if (!host_integerp (node, 0))
{
tree val = node;
unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (val);
@@ -2575,6 +2629,14 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type,
return 1;
break;
+ case ENUMERAL_TYPE:
+ if ((orig && TYPE_NAME (orig) && orig != TREE_TYPE (t))
+ || !is_simple_enum (TREE_TYPE (t)))
+ pp_string (buffer, "subtype ");
+ else
+ pp_string (buffer, "type ");
+ break;
+
default:
pp_string (buffer, "subtype ");
}
diff --git a/gcc/c-ada-spec.h b/gcc/c-family/c-ada-spec.h
index 8aed158678c..8aed158678c 100644
--- a/gcc/c-ada-spec.h
+++ b/gcc/c-family/c-ada-spec.h
diff --git a/gcc/c-common.c b/gcc/c-family/c-common.c
index 97d6034f28d..324c28aa114 100644
--- a/gcc/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -169,10 +169,6 @@ tree c_global_trees[CTI_MAX];
/* Switches common to the C front ends. */
-/* Nonzero if preprocessing only. */
-
-int flag_preprocess_only;
-
/* Nonzero means don't output line number information. */
char flag_no_line_commands;
@@ -203,42 +199,6 @@ const char *pch_file;
user's namespace. */
int flag_iso;
-/* Nonzero if -undef was given. It suppresses target built-in macros
- and assertions. */
-int flag_undef;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions. */
-
-int flag_no_builtin;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions.
- -ansi sets this. */
-
-int flag_no_nonansi_builtin;
-
-/* Nonzero means give `double' the same size as `float'. */
-
-int flag_short_double;
-
-/* Nonzero means give `wchar_t' the same size as `short'. */
-
-int flag_short_wchar;
-
-/* Nonzero means allow implicit conversions between vectors with
- differing numbers of subparts and/or differing element types. */
-int flag_lax_vector_conversions;
-
-/* Nonzero means allow Microsoft extensions without warnings or errors. */
-int flag_ms_extensions;
-
-/* Nonzero means don't recognize the keyword `asm'. */
-
-int flag_no_asm;
-
-/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
-
-int flag_signed_bitfields = 1;
-
/* Warn about #pragma directives that are not recognized. */
int warn_unknown_pragmas; /* Tri state variable. */
@@ -248,27 +208,6 @@ int warn_unknown_pragmas; /* Tri state variable. */
int warn_format;
-/* Warn about using __null (as NULL in C++) as sentinel. For code compiled
- with GCC this doesn't matter as __null is guaranteed to have the right
- size. */
-
-int warn_strict_null_sentinel;
-
-/* Zero means that faster, ...NonNil variants of objc_msgSend...
- calls will be used in ObjC; passing nil receivers to such calls
- will most likely result in crashes. */
-int flag_nil_receivers = 1;
-
-/* Nonzero means that code generation will be altered to support
- "zero-link" execution. This currently affects ObjC only, but may
- affect other languages in the future. */
-int flag_zero_link = 0;
-
-/* Nonzero means emit an '__OBJC, __image_info' for the current translation
- unit. It will inform the ObjC runtime that class definition(s) herein
- contained are to replace one(s) previously loaded. */
-int flag_replace_objc_classes = 0;
-
/* C/ObjC language option variables. */
@@ -297,11 +236,6 @@ int flag_hosted = 1;
/* ObjC language option variables. */
-/* Open and close the file for outputting class declarations, if
- requested (ObjC). */
-
-int flag_gen_declaration;
-
/* Tells the compiler that this is a special run. Do not perform any
compiling, instead we are to test some platform dependent features
and output a C header file with appropriate definitions. */
@@ -316,119 +250,15 @@ const char *constant_string_class_name;
/* C++ language option variables. */
-/* Nonzero means don't recognize any extension keywords. */
-
-int flag_no_gnu_keywords;
-
-/* Nonzero means do emit exported implementations of functions even if
- they can be inlined. */
-
-int flag_implement_inlines = 1;
-
-/* Nonzero means that implicit instantiations will be emitted if needed. */
-
-int flag_implicit_templates = 1;
-
-/* Nonzero means that implicit instantiations of inline templates will be
- emitted if needed, even if instantiations of non-inline templates
- aren't. */
-
-int flag_implicit_inline_templates = 1;
-
/* Nonzero means generate separate instantiation control files and
juggle them at link time. */
int flag_use_repository;
-/* Nonzero if we want to issue diagnostics that the standard says are not
- required. */
-
-int flag_optional_diags = 1;
-
-/* Nonzero means we should attempt to elide constructors when possible. */
-
-int flag_elide_constructors = 1;
-
-/* Nonzero means that member functions defined in class scope are
- inline by default. */
-
-int flag_default_inline = 1;
-
-/* Controls whether compiler generates 'type descriptor' that give
- run-time type information. */
-
-int flag_rtti = 1;
-
-/* Nonzero if we want to conserve space in the .o files. We do this
- by putting uninitialized data and runtime initialized data into
- .common instead of .data at the expense of not flagging multiple
- definitions. */
-
-int flag_conserve_space;
-
-/* Nonzero if we want to obey access control semantics. */
-
-int flag_access_control = 1;
-
-/* Nonzero if we want to check the return value of new and avoid calling
- constructors if it is a null pointer. */
-
-int flag_check_new;
-
/* The C++ dialect being used. C++98 is the default. */
enum cxx_dialect cxx_dialect = cxx98;
-/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
- initialization variables.
- 0: Old rules, set by -fno-for-scope.
- 2: New ISO rules, set by -ffor-scope.
- 1: Try to implement new ISO rules, but with backup compatibility
- (and warnings). This is the default, for now. */
-
-int flag_new_for_scope = 1;
-
-/* Nonzero if we want to emit defined symbols with common-like linkage as
- weak symbols where possible, in order to conform to C++ semantics.
- Otherwise, emit them as local symbols. */
-
-int flag_weak = 1;
-
-/* 0 means we want the preprocessor to not emit line directives for
- the current working directory. 1 means we want it to do it. -1
- means we should decide depending on whether debugging information
- is being emitted or not. */
-
-int flag_working_directory = -1;
-
-/* Nonzero to use __cxa_atexit, rather than atexit, to register
- destructors for local statics and global objects. '2' means it has been
- set nonzero as a default, not by a command-line flag. */
-
-int flag_use_cxa_atexit = DEFAULT_USE_CXA_ATEXIT;
-
-/* Nonzero to use __cxa_get_exception_ptr in C++ exception-handling
- code. '2' means it has not been set explicitly on the command line. */
-
-int flag_use_cxa_get_exception_ptr = 2;
-
-/* Nonzero means to implement standard semantics for exception
- specifications, calling unexpected if an exception is thrown that
- doesn't match the specification. Zero means to treat them as
- assertions and optimize accordingly, but not check them. */
-
-int flag_enforce_eh_specs = 1;
-
-/* Nonzero means to generate thread-safe code for initializing local
- statics. */
-
-int flag_threadsafe_statics = 1;
-
-/* Nonzero if we want to pretty-print template specializations as the
- template signature followed by the arguments. */
-
-int flag_pretty_templates = 1;
-
/* Maximum template instantiation depth. This limit exists to limit the
time it takes to notice infinite template instantiations; the default
value of 1024 is likely to be in the next C++ standard. */
@@ -661,6 +491,7 @@ const struct c_common_resword c_common_reswords[] =
{ "mutable", RID_MUTABLE, D_CXXONLY | D_CXXWARN },
{ "namespace", RID_NAMESPACE, D_CXXONLY | D_CXXWARN },
{ "new", RID_NEW, D_CXXONLY | D_CXXWARN },
+ { "noexcept", RID_NOEXCEPT, D_CXXONLY | D_CXX0X | D_CXXWARN },
{ "nullptr", RID_NULLPTR, D_CXXONLY | D_CXX0X | D_CXXWARN },
{ "operator", RID_OPERATOR, D_CXXONLY | D_CXXWARN },
{ "private", RID_PRIVATE, D_CXX_OBJC | D_CXXWARN },
@@ -2007,6 +1838,8 @@ conversion_warning (tree type, tree expr)
int i;
const int expr_num_operands = TREE_OPERAND_LENGTH (expr);
tree expr_type = TREE_TYPE (expr);
+ location_t loc = EXPR_HAS_LOCATION (expr)
+ ? EXPR_LOCATION (expr) : input_location;
if (!warn_conversion && !warn_sign_conversion)
return;
@@ -2038,8 +1871,8 @@ conversion_warning (tree type, tree expr)
can hold the values 0 and -1) doesn't lose information - but
it does change the value. */
if (TYPE_PRECISION (type) == 1 && !TYPE_UNSIGNED (type))
- warning (OPT_Wconversion,
- "conversion to %qT from boolean expression", type);
+ warning_at (loc, OPT_Wconversion,
+ "conversion to %qT from boolean expression", type);
return;
case REAL_CST:
@@ -2060,11 +1893,11 @@ conversion_warning (tree type, tree expr)
{
if (TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (expr_type)
&& tree_int_cst_sgn (expr) < 0)
- warning (OPT_Wsign_conversion,
- "negative integer implicitly converted to unsigned type");
+ warning_at (loc, OPT_Wsign_conversion, "negative integer"
+ " implicitly converted to unsigned type");
else if (!TYPE_UNSIGNED (type) && TYPE_UNSIGNED (expr_type))
- warning (OPT_Wsign_conversion, "conversion of unsigned constant "
- "value to negative integer");
+ warning_at (loc, OPT_Wsign_conversion, "conversion of unsigned"
+ " constant value to negative integer");
else
give_warning = true;
}
@@ -2089,9 +1922,9 @@ conversion_warning (tree type, tree expr)
}
if (give_warning)
- warning (OPT_Wconversion,
- "conversion to %qT alters %qT constant value",
- type, expr_type);
+ warning_at (loc, OPT_Wconversion,
+ "conversion to %qT alters %qT constant value",
+ type, expr_type);
return;
@@ -2182,9 +2015,9 @@ conversion_warning (tree type, tree expr)
unsigned but expr is signed, then negative values
will be changed. */
|| (TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (expr_type)))
- warning (OPT_Wsign_conversion, "conversion to %qT from %qT "
- "may change the sign of the result",
- type, expr_type);
+ warning_at (loc, OPT_Wsign_conversion, "conversion to %qT from %qT "
+ "may change the sign of the result",
+ type, expr_type);
}
/* Warn for integer types converted to real types if and only if
@@ -2218,9 +2051,9 @@ conversion_warning (tree type, tree expr)
if (give_warning)
- warning (OPT_Wconversion,
- "conversion to %qT from %qT may alter its value",
- type, expr_type);
+ warning_at (loc, OPT_Wconversion,
+ "conversion to %qT from %qT may alter its value",
+ type, expr_type);
}
}
@@ -3528,9 +3361,8 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
/* Convert primop1 to target type, but do not introduce
additional overflow. We know primop1 is an int_cst. */
primop1 = force_fit_type_double (*restype_ptr,
- TREE_INT_CST_LOW (primop1),
- TREE_INT_CST_HIGH (primop1), 0,
- TREE_OVERFLOW (primop1));
+ tree_to_double_int (primop1),
+ 0, TREE_OVERFLOW (primop1));
}
if (type != *restype_ptr)
{
@@ -3992,23 +3824,7 @@ c_common_truthvalue_conversion (location_t location, tree expr)
inner);
return truthvalue_true_node;
}
-
- /* If we still have a decl, it is possible for its address to
- be NULL, so we cannot optimize. */
- if (DECL_P (inner))
- {
- gcc_assert (DECL_WEAK (inner));
- break;
- }
-
- if (TREE_SIDE_EFFECTS (inner))
- {
- expr = build2 (COMPOUND_EXPR, truthvalue_type_node,
- inner, truthvalue_true_node);
- goto ret;
- }
- else
- return truthvalue_true_node;
+ break;
}
case COMPLEX_EXPR:
@@ -5090,13 +4906,13 @@ c_common_nodes_and_builtins (void)
(build_decl (UNKNOWN_LOCATION,
TYPE_DECL, get_identifier ("__builtin_va_list"),
va_list_type_node));
- if (targetm.enum_va_list)
+ if (targetm.enum_va_list_p)
{
int l;
const char *pname;
tree ptype;
- for (l = 0; targetm.enum_va_list (l, &pname, &ptype); ++l)
+ for (l = 0; targetm.enum_va_list_p (l, &pname, &ptype); ++l)
{
lang_hooks.decls.pushdecl
(build_decl (UNKNOWN_LOCATION,
@@ -7807,6 +7623,8 @@ parse_optimize_options (tree args, bool attr_p)
unsigned i;
int saved_flag_strict_aliasing;
const char **opt_argv;
+ struct cl_decoded_option *decoded_options;
+ unsigned int decoded_options_count;
tree ap;
/* Build up argv vector. Just in case the string is stored away, use garbage
@@ -7853,7 +7671,7 @@ parse_optimize_options (tree args, bool attr_p)
next_p = NULL;
}
- r = q = (char *) ggc_alloc (len2 + 3);
+ r = q = (char *) ggc_alloc_atomic (len2 + 3);
/* If the user supplied -Oxxx or -fxxx, only allow -Oxxx or -fxxx
options. */
@@ -7899,7 +7717,8 @@ parse_optimize_options (tree args, bool attr_p)
saved_flag_strict_aliasing = flag_strict_aliasing;
/* Now parse the options. */
- decode_options (opt_argc, opt_argv);
+ decode_options (opt_argc, opt_argv, &decoded_options,
+ &decoded_options_count);
targetm.override_options_after_change();
@@ -8585,6 +8404,18 @@ fold_offsetof (tree expr, tree stop_ref)
return convert (size_type_node, fold_offsetof_1 (expr, stop_ref));
}
+/* Warn for A ?: C expressions (with B omitted) where A is a boolean
+ expression, because B will always be true. */
+
+void
+warn_for_omitted_condop (location_t location, tree cond)
+{
+ if (truth_value_p (TREE_CODE (cond)))
+ warning_at (location, OPT_Wparentheses,
+ "the omitted middle operand in ?: will always be %<true%>, "
+ "suggest explicit middle operand");
+}
+
/* Print an error message for an invalid lvalue. USE says
how the lvalue is being used and so selects the error message. */
@@ -9363,15 +9194,6 @@ set_underlying_type (tree x)
}
}
-/* Returns true if X is a typedef decl. */
-
-bool
-is_typedef_decl (tree x)
-{
- return (x && TREE_CODE (x) == TYPE_DECL
- && DECL_ORIGINAL_TYPE (x) != NULL_TREE);
-}
-
/* Record the types used by the current global variable declaration
being parsed, so that we can decide later to emit their debug info.
Those types are in types_used_by_cur_var_decl, and we are going to
@@ -9383,17 +9205,10 @@ record_types_used_by_current_var_decl (tree decl)
{
gcc_assert (decl && DECL_P (decl) && TREE_STATIC (decl));
- if (types_used_by_cur_var_decl)
+ while (!VEC_empty (tree, types_used_by_cur_var_decl))
{
- tree node;
- for (node = types_used_by_cur_var_decl;
- node;
- node = TREE_CHAIN (node))
- {
- tree type = TREE_PURPOSE (node);
- types_used_by_var_decl_insert (type, decl);
- }
- types_used_by_cur_var_decl = NULL;
+ tree type = VEC_pop (tree, types_used_by_cur_var_decl);
+ types_used_by_var_decl_insert (type, decl);
}
}
@@ -9462,4 +9277,4 @@ make_tree_vector_copy (const VEC(tree,gc) *orig)
return ret;
}
-#include "gt-c-common.h"
+#include "gt-c-family-c-common.h"
diff --git a/gcc/c-common.def b/gcc/c-family/c-common.def
index 1c593633e12..1c593633e12 100644
--- a/gcc/c-common.def
+++ b/gcc/c-family/c-common.def
diff --git a/gcc/c-common.h b/gcc/c-family/c-common.h
index f0541e92721..5784746e90a 100644
--- a/gcc/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -125,7 +125,7 @@ enum rid
RID_IS_UNION,
/* C++0x */
- RID_CONSTEXPR, RID_DECLTYPE, RID_NULLPTR, RID_STATIC_ASSERT,
+ RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT,
/* Objective-C */
RID_AT_ENCODE, RID_AT_END,
@@ -373,7 +373,7 @@ extern GTY(()) tree c_global_trees[CTI_MAX];
/* In a RECORD_TYPE, a sorted array of the fields of the type, not a
tree for size reasons. */
-struct GTY(()) sorted_fields_type {
+struct GTY((variable_size)) sorted_fields_type {
int len;
tree GTY((length ("%h.len"))) elts[1];
};
@@ -480,32 +480,6 @@ extern bool has_c_linkage (const_tree decl);
/* Switches common to the C front ends. */
-/* Nonzero if prepreprocessing only. */
-
-extern int flag_preprocess_only;
-
-/* Zero means that faster, ...NonNil variants of objc_msgSend...
- calls will be used in ObjC; passing nil receivers to such calls
- will most likely result in crashes. */
-extern int flag_nil_receivers;
-
-/* Nonzero means that we will allow new ObjC exception syntax (@throw,
- @try, etc.) in source code. */
-extern int flag_objc_exceptions;
-
-/* Nonzero means that we generate NeXT setjmp based exceptions. */
-extern int flag_objc_sjlj_exceptions;
-
-/* Nonzero means that code generation will be altered to support
- "zero-link" execution. This currently affects ObjC only, but may
- affect other languages in the future. */
-extern int flag_zero_link;
-
-/* Nonzero means emit an '__OBJC, __image_info' for the current translation
- unit. It will inform the ObjC runtime that class definition(s) herein
- contained are to replace one(s) previously loaded. */
-extern int flag_replace_objc_classes;
-
/* Nonzero means don't output line number information. */
extern char flag_no_line_commands;
@@ -538,48 +512,6 @@ extern const char *pch_file;
extern int flag_iso;
-/* Nonzero if -undef was given. It suppresses target built-in macros
- and assertions. */
-
-extern int flag_undef;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions. */
-
-extern int flag_no_builtin;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions.
- -ansi sets this. */
-
-extern int flag_no_nonansi_builtin;
-
-/* Nonzero means give `double' the same size as `float'. */
-
-extern int flag_short_double;
-
-/* Nonzero means give `wchar_t' the same size as `short'. */
-
-extern int flag_short_wchar;
-
-/* Nonzero means allow implicit conversions between vectors with
- differing numbers of subparts and/or differing element types. */
-extern int flag_lax_vector_conversions;
-
-/* Nonzero means allow Microsoft extensions without warnings or errors. */
-extern int flag_ms_extensions;
-
-/* Nonzero means don't recognize the keyword `asm'. */
-
-extern int flag_no_asm;
-
-/* Nonzero means give string constants the type `const char *', as mandated
- by the standard. */
-
-extern int flag_const_strings;
-
-/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
-
-extern int flag_signed_bitfields;
-
/* Warn about #pragma directives that are not recognized. */
extern int warn_unknown_pragmas; /* Tri state variable. */
@@ -617,11 +549,6 @@ extern int flag_hosted;
/* ObjC language option variables. */
-/* Open and close the file for outputting class declarations, if
- requested (ObjC). */
-
-extern int flag_gen_declaration;
-
/* Tells the compiler that this is a special run. Do not perform any
compiling, instead we are to test some platform dependent features
and output a C header file with appropriate definitions. */
@@ -636,65 +563,11 @@ extern const char *constant_string_class_name;
/* C++ language option variables. */
-/* Nonzero means don't recognize any extension keywords. */
-
-extern int flag_no_gnu_keywords;
-
-/* Nonzero means do emit exported implementations of functions even if
- they can be inlined. */
-
-extern int flag_implement_inlines;
-
-/* Nonzero means that implicit instantiations will be emitted if needed. */
-
-extern int flag_implicit_templates;
-
-/* Nonzero means that implicit instantiations of inline templates will be
- emitted if needed, even if instantiations of non-inline templates
- aren't. */
-
-extern int flag_implicit_inline_templates;
-
/* Nonzero means generate separate instantiation control files and
juggle them at link time. */
extern int flag_use_repository;
-/* Nonzero if we want to issue diagnostics that the standard says are not
- required. */
-
-extern int flag_optional_diags;
-
-/* Nonzero means we should attempt to elide constructors when possible. */
-
-extern int flag_elide_constructors;
-
-/* Nonzero means that member functions defined in class scope are
- inline by default. */
-
-extern int flag_default_inline;
-
-/* Controls whether compiler generates 'type descriptor' that give
- run-time type information. */
-
-extern int flag_rtti;
-
-/* Nonzero if we want to conserve space in the .o files. We do this
- by putting uninitialized data and runtime initialized data into
- .common instead of .data at the expense of not flagging multiple
- definitions. */
-
-extern int flag_conserve_space;
-
-/* Nonzero if we want to obey access control semantics. */
-
-extern int flag_access_control;
-
-/* Nonzero if we want to check the return value of new and avoid calling
- constructors if it is a null pointer. */
-
-extern int flag_check_new;
-
/* The supported C++ dialects. */
enum cxx_dialect {
@@ -708,61 +581,6 @@ enum cxx_dialect {
/* The C++ dialect being used. C++98 is the default. */
extern enum cxx_dialect cxx_dialect;
-/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
- initialization variables.
- 0: Old rules, set by -fno-for-scope.
- 2: New ISO rules, set by -ffor-scope.
- 1: Try to implement new ISO rules, but with backup compatibility
- (and warnings). This is the default, for now. */
-
-extern int flag_new_for_scope;
-
-/* Nonzero if we want to emit defined symbols with common-like linkage as
- weak symbols where possible, in order to conform to C++ semantics.
- Otherwise, emit them as local symbols. */
-
-extern int flag_weak;
-
-/* 0 means we want the preprocessor to not emit line directives for
- the current working directory. 1 means we want it to do it. -1
- means we should decide depending on whether debugging information
- is being emitted or not. */
-
-extern int flag_working_directory;
-
-/* Nonzero to use __cxa_atexit, rather than atexit, to register
- destructors for local statics and global objects. */
-
-extern int flag_use_cxa_atexit;
-
-/* Nonzero to use __cxa_get_exception_ptr in the C++ exception-handling
- logic. */
-
-extern int flag_use_cxa_get_exception_ptr;
-
-/* Nonzero means to implement standard semantics for exception
- specifications, calling unexpected if an exception is thrown that
- doesn't match the specification. Zero means to treat them as
- assertions and optimize accordingly, but not check them. */
-
-extern int flag_enforce_eh_specs;
-
-/* Nonzero (the default) means to generate thread-safe code for
- initializing local statics. */
-
-extern int flag_threadsafe_statics;
-
-/* Nonzero if we want to pretty-print template specializations as the
- template signature followed by the arguments. */
-
-extern int flag_pretty_templates;
-
-/* Warn about using __null (as NULL in C++) as sentinel. For code compiled
- with GCC this doesn't matter as __null is guaranteed to have the right
- size. */
-
-extern int warn_strict_null_sentinel;
-
/* Maximum template instantiation depth. This limit is rather
arbitrary, but it exists to limit the time it takes to notice
infinite template instantiations. */
@@ -918,6 +736,7 @@ extern void c_parse_file (void);
/* This is misnamed, it actually performs end-of-compilation processing. */
extern void finish_file (void);
+extern void warn_for_omitted_condop (location_t, tree);
/* These macros provide convenient access to the various _STMT nodes. */
@@ -1071,7 +890,6 @@ extern void warn_for_sign_compare (location_t,
tree result_type,
enum tree_code resultcode);
extern void set_underlying_type (tree x);
-extern bool is_typedef_decl (tree x);
extern VEC(tree,gc) *make_tree_vector (void);
extern void release_tree_vector (VEC(tree,gc) *);
extern VEC(tree,gc) *make_tree_vector_single (tree);
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 6bbdb460e7a..fbace227195 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1,5 +1,5 @@
/* Define builtin-in macros for the C family front ends.
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -28,11 +28,11 @@ along with GCC; see the file COPYING3. If not see
#include "c-common.h"
#include "c-pragma.h"
#include "output.h"
-#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
#include "debug.h" /* For dwarf2out_do_cfi_asm. */
#include "toplev.h"
#include "tm_p.h" /* For TARGET_CPU_CPP_BUILTINS & friends. */
#include "target.h"
+#include "cpp-id-data.h"
#ifndef TARGET_OS_CPP_BUILTINS
# define TARGET_OS_CPP_BUILTINS()
@@ -946,6 +946,51 @@ builtin_define_with_int_value (const char *macro, HOST_WIDE_INT value)
cpp_define (parse_in, buf);
}
+/* builtin_define_with_hex_fp_value is very expensive, so the following
+ array and function allows it to be done lazily when __DBL_MAX__
+ etc. is first used. */
+
+struct GTY(()) lazy_hex_fp_value_struct
+{
+ const char *hex_str;
+ cpp_macro *macro;
+ enum machine_mode mode;
+ int digits;
+ const char *fp_suffix;
+};
+static GTY(()) struct lazy_hex_fp_value_struct lazy_hex_fp_values[12];
+static GTY(()) int lazy_hex_fp_value_count;
+
+static bool
+lazy_hex_fp_value (cpp_reader *pfile ATTRIBUTE_UNUSED,
+ cpp_hashnode *node)
+{
+ REAL_VALUE_TYPE real;
+ char dec_str[64], buf1[256];
+ unsigned int idx;
+ if (node->value.builtin < BT_FIRST_USER
+ || (int) node->value.builtin >= BT_FIRST_USER + lazy_hex_fp_value_count)
+ return false;
+
+ idx = node->value.builtin - BT_FIRST_USER;
+ real_from_string (&real, lazy_hex_fp_values[idx].hex_str);
+ real_to_decimal_for_mode (dec_str, &real, sizeof (dec_str),
+ lazy_hex_fp_values[idx].digits, 0,
+ lazy_hex_fp_values[idx].mode);
+
+ sprintf (buf1, "%s%s", dec_str, lazy_hex_fp_values[idx].fp_suffix);
+ node->flags &= ~(NODE_BUILTIN | NODE_USED);
+ node->value.macro = lazy_hex_fp_values[idx].macro;
+ for (idx = 0; idx < node->value.macro->count; idx++)
+ if (node->value.macro->exp.tokens[idx].type == CPP_NUMBER)
+ break;
+ gcc_assert (idx < node->value.macro->count);
+ node->value.macro->exp.tokens[idx].val.str.len = strlen (buf1);
+ node->value.macro->exp.tokens[idx].val.str.text
+ = (const unsigned char *) ggc_strdup (buf1);
+ return true;
+}
+
/* Pass an object-like macro a hexadecimal floating-point value. */
static void
builtin_define_with_hex_fp_value (const char *macro,
@@ -957,6 +1002,31 @@ builtin_define_with_hex_fp_value (const char *macro,
REAL_VALUE_TYPE real;
char dec_str[64], buf1[256], buf2[256];
+ /* This is very expensive, so if possible expand them lazily. */
+ if (lazy_hex_fp_value_count < 12
+ && flag_dump_macros == 0
+ && !cpp_get_options (parse_in)->traditional)
+ {
+ struct cpp_hashnode *node;
+ if (lazy_hex_fp_value_count == 0)
+ cpp_get_callbacks (parse_in)->user_builtin_macro = lazy_hex_fp_value;
+ sprintf (buf2, fp_cast, "1.1");
+ sprintf (buf1, "%s=%s", macro, buf2);
+ cpp_define (parse_in, buf1);
+ node = C_CPP_HASHNODE (get_identifier (macro));
+ lazy_hex_fp_values[lazy_hex_fp_value_count].hex_str
+ = ggc_strdup (hex_str);
+ lazy_hex_fp_values[lazy_hex_fp_value_count].mode = TYPE_MODE (type);
+ lazy_hex_fp_values[lazy_hex_fp_value_count].digits = digits;
+ lazy_hex_fp_values[lazy_hex_fp_value_count].fp_suffix = fp_suffix;
+ lazy_hex_fp_values[lazy_hex_fp_value_count].macro = node->value.macro;
+ node->flags |= NODE_BUILTIN;
+ node->value.builtin
+ = (enum cpp_builtin_type) (BT_FIRST_USER + lazy_hex_fp_value_count);
+ lazy_hex_fp_value_count++;
+ return;
+ }
+
/* Hex values are really cool and convenient, except that they're
not supported in strict ISO C90 mode. First, the "p-" sequence
is not valid as part of a preprocessor number. Second, we get a
@@ -1105,3 +1175,5 @@ builtin_define_type_minmax (const char *min_macro, const char *max_macro,
cpp_define (parse_in, buf);
}
}
+
+#include "gt-c-family-c-cppbuiltin.h"
diff --git a/gcc/c-dump.c b/gcc/c-family/c-dump.c
index 71e872e22cb..71e872e22cb 100644
--- a/gcc/c-dump.c
+++ b/gcc/c-family/c-dump.c
diff --git a/gcc/c-format.c b/gcc/c-family/c-format.c
index 0522d2925c2..2c73ead370c 100644
--- a/gcc/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -421,6 +421,7 @@ static const format_flag_pair gcc_gfc_flag_pairs[] =
static const format_flag_spec gcc_diag_flag_specs[] =
{
{ '+', 0, 0, N_("'+' flag"), N_("the '+' printf flag"), STD_C89 },
+ { '#', 0, 0, N_("'#' flag"), N_("the '#' printf flag"), STD_C89 },
{ 'q', 0, 0, N_("'q' flag"), N_("the 'q' diagnostic flag"), STD_C89 },
{ 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 },
{ 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 },
@@ -429,16 +430,7 @@ static const format_flag_spec gcc_diag_flag_specs[] =
#define gcc_tdiag_flag_specs gcc_diag_flag_specs
#define gcc_cdiag_flag_specs gcc_diag_flag_specs
-
-static const format_flag_spec gcc_cxxdiag_flag_specs[] =
-{
- { '+', 0, 0, N_("'+' flag"), N_("the '+' printf flag"), STD_C89 },
- { '#', 0, 0, N_("'#' flag"), N_("the '#' printf flag"), STD_C89 },
- { 'q', 0, 0, N_("'q' flag"), N_("the 'q' diagnostic flag"), STD_C89 },
- { 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 },
- { 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 },
- { 0, 0, 0, NULL, NULL, STD_C89 }
-};
+#define gcc_cxxdiag_flag_specs gcc_diag_flag_specs
static const format_flag_spec scanf_flag_specs[] =
{
@@ -585,7 +577,9 @@ static const format_char_info gcc_tdiag_char_table[] =
/* Custom conversion specifiers. */
/* These will require a "tree" at runtime. */
- { "DFKTE", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL },
+ { "DFKTEV", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL },
+
+ { "v", 0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q#", "", NULL },
{ "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL },
{ "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL },
@@ -605,7 +599,9 @@ static const format_char_info gcc_cdiag_char_table[] =
/* Custom conversion specifiers. */
/* These will require a "tree" at runtime. */
- { "DEFKT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL },
+ { "DEFKTV", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL },
+
+ { "v", 0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q#", "", NULL },
{ "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL },
{ "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL },
@@ -627,6 +623,8 @@ static const format_char_info gcc_cxxdiag_char_table[] =
/* These will require a "tree" at runtime. */
{ "ADEFKTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+#", "", NULL },
+ { "v", 0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q#", "", NULL },
+
/* These accept either an 'int' or an 'enum tree_code' (which is handled as an 'int'.) */
{ "CLOPQ",0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
@@ -722,19 +720,19 @@ static const format_kind_info format_types_orig[] =
'w', 0, 'p', 0, 'L', 0,
NULL, NULL
},
- { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+", NULL,
+ { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+#", NULL,
gcc_diag_flag_specs, gcc_diag_flag_pairs,
FMT_FLAG_ARG_CONVERT,
0, 0, 'p', 0, 'L', 0,
NULL, &integer_type_node
},
- { "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+", NULL,
+ { "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+#", NULL,
gcc_tdiag_flag_specs, gcc_tdiag_flag_pairs,
FMT_FLAG_ARG_CONVERT,
0, 0, 'p', 0, 'L', 0,
NULL, &integer_type_node
},
- { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+", NULL,
+ { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+#", NULL,
gcc_cdiag_flag_specs, gcc_cdiag_flag_pairs,
FMT_FLAG_ARG_CONVERT,
0, 0, 'p', 0, 'L', 0,
diff --git a/gcc/c-format.h b/gcc/c-family/c-format.h
index 9d01f0af495..9d01f0af495 100644
--- a/gcc/c-format.h
+++ b/gcc/c-family/c-format.h
diff --git a/gcc/c-gimplify.c b/gcc/c-family/c-gimplify.c
index 06963a05e71..f446ebbb214 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -32,7 +32,6 @@ along with GCC; see the file COPYING3. If not see
#include "c-common.h"
#include "gimple.h"
#include "basic-block.h"
-#include "tree-flow.h"
#include "tree-inline.h"
#include "diagnostic-core.h"
#include "langhooks.h"
diff --git a/gcc/c-lex.c b/gcc/c-family/c-lex.c
index 5af574db226..5af574db226 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-family/c-lex.c
diff --git a/gcc/c-omp.c b/gcc/c-family/c-omp.c
index 31970bdeaee..31970bdeaee 100644
--- a/gcc/c-omp.c
+++ b/gcc/c-family/c-omp.c
diff --git a/gcc/c-opts.c b/gcc/c-family/c-opts.c
index 08592f58e4b..2f8d5d86230 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "options.h"
#include "mkdeps.h"
#include "target.h" /* For gcc_targetcm. */
+#include "tm_p.h" /* For C_COMMON_OVERRIDE_OPTIONS. */
#ifndef DOLLARS_IN_IDENTIFIERS
# define DOLLARS_IN_IDENTIFIERS true
@@ -395,10 +396,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
defer_opt (code, arg);
break;
- case OPT_E:
- flag_preprocess_only = 1;
- break;
-
case OPT_H:
cpp_opts->print_include_names = 1;
break;
@@ -462,10 +459,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
flag_no_line_commands = 1;
break;
- case OPT_fworking_directory:
- flag_working_directory = value;
- break;
-
case OPT_U:
defer_opt (code, arg);
break;
@@ -613,10 +606,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
warn_return_type = value;
break;
- case OPT_Wstrict_null_sentinel:
- warn_strict_null_sentinel = value;
- break;
-
case OPT_Wtraditional:
cpp_opts->warn_traditional = value;
break;
@@ -692,18 +681,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
warning (0, "switch %qs is no longer supported", option->opt_text);
break;
- case OPT_faccess_control:
- flag_access_control = value;
- break;
-
- case OPT_fasm:
- flag_no_asm = !value;
- break;
-
- case OPT_fbuiltin:
- flag_no_builtin = !value;
- break;
-
case OPT_fbuiltin_:
if (value)
result = 0;
@@ -727,70 +704,18 @@ c_common_handle_option (size_t scode, const char *arg, int value,
flag_no_builtin = !value;
break;
- case OPT_fshort_double:
- flag_short_double = value;
- break;
-
- case OPT_fshort_enums:
- flag_short_enums = value;
- break;
-
- case OPT_fshort_wchar:
- flag_short_wchar = value;
- break;
-
- case OPT_fsigned_bitfields:
- flag_signed_bitfields = value;
- break;
-
- case OPT_fsigned_char:
- flag_signed_char = value;
- break;
-
- case OPT_funsigned_bitfields:
- flag_signed_bitfields = !value;
- break;
-
- case OPT_funsigned_char:
- flag_signed_char = !value;
- break;
-
- case OPT_fcheck_new:
- flag_check_new = value;
- break;
-
- case OPT_fconserve_space:
- flag_conserve_space = value;
- break;
-
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
case OPT_fdefault_inline:
- flag_default_inline = value;
- break;
-
- case OPT_felide_constructors:
- flag_elide_constructors = value;
- break;
-
- case OPT_fenforce_eh_specs:
- flag_enforce_eh_specs = value;
+ /* Ignore. */
break;
case OPT_fextended_identifiers:
cpp_opts->extended_identifiers = value;
break;
- case OPT_ffor_scope:
- flag_new_for_scope = value;
- break;
-
- case OPT_fgnu_keywords:
- flag_no_gnu_keywords = !value;
- break;
-
case OPT_fgnu_runtime:
flag_next_runtime = !value;
break;
@@ -800,44 +725,16 @@ c_common_handle_option (size_t scode, const char *arg, int value,
flag_exceptions = value;
break;
- case OPT_fimplement_inlines:
- flag_implement_inlines = value;
- break;
-
- case OPT_fimplicit_inline_templates:
- flag_implicit_inline_templates = value;
- break;
-
- case OPT_fimplicit_templates:
- flag_implicit_templates = value;
- break;
-
- case OPT_flax_vector_conversions:
- flag_lax_vector_conversions = value;
- break;
-
- case OPT_fms_extensions:
- flag_ms_extensions = value;
- break;
-
case OPT_fnext_runtime:
flag_next_runtime = value;
break;
- case OPT_fnil_receivers:
- flag_nil_receivers = value;
- break;
-
- case OPT_fnonansi_builtins:
- flag_no_nonansi_builtin = !value;
- break;
-
case OPT_foperator_names:
cpp_opts->operator_names = value;
break;
case OPT_foptional_diags:
- flag_optional_diags = value;
+ /* Ignore. */
break;
case OPT_fpch_deps:
@@ -857,28 +754,12 @@ c_common_handle_option (size_t scode, const char *arg, int value,
cpp_opts->preprocessed = value;
break;
- case OPT_freplace_objc_classes:
- flag_replace_objc_classes = value;
- break;
-
case OPT_frepo:
flag_use_repository = value;
if (value)
flag_implicit_templates = 0;
break;
- case OPT_frtti:
- flag_rtti = value;
- break;
-
- case OPT_fshow_column:
- cpp_opts->show_column = value;
- break;
-
- case OPT_fstats:
- flag_detailed_statistics = value;
- break;
-
case OPT_ftabstop_:
/* It is documented that we silently ignore silly values. */
if (value >= 1 && value <= 100)
@@ -903,38 +784,10 @@ c_common_handle_option (size_t scode, const char *arg, int value,
max_tinst_depth = value;
break;
- case OPT_fuse_cxa_atexit:
- flag_use_cxa_atexit = value;
- break;
-
- case OPT_fuse_cxa_get_exception_ptr:
- flag_use_cxa_get_exception_ptr = value;
- break;
-
case OPT_fvisibility_inlines_hidden:
visibility_options.inlines_hidden = value;
break;
- case OPT_fweak:
- flag_weak = value;
- break;
-
- case OPT_fthreadsafe_statics:
- flag_threadsafe_statics = value;
- break;
-
- case OPT_fpretty_templates:
- flag_pretty_templates = value;
- break;
-
- case OPT_fzero_link:
- flag_zero_link = value;
- break;
-
- case OPT_gen_decls:
- flag_gen_declaration = 1;
- break;
-
case OPT_femit_struct_debug_baseonly:
set_struct_debug_option ("base");
break;
@@ -989,10 +842,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
cpp_opts->dollars_in_ident = false;
break;
- case OPT_lang_objc:
- cpp_opts->objc = 1;
- break;
-
case OPT_nostdinc:
std_inc = false;
break;
@@ -1094,10 +943,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
cpp_opts->traditional = 1;
break;
- case OPT_undef:
- flag_undef = 1;
- break;
-
case OPT_v:
verbose = true;
break;
diff --git a/gcc/c-pch.c b/gcc/c-family/c-pch.c
index 951ab1fc303..951ab1fc303 100644
--- a/gcc/c-pch.c
+++ b/gcc/c-family/c-pch.c
diff --git a/gcc/c-ppoutput.c b/gcc/c-family/c-ppoutput.c
index 1700fae3ed0..1700fae3ed0 100644
--- a/gcc/c-ppoutput.c
+++ b/gcc/c-family/c-ppoutput.c
diff --git a/gcc/c-pragma.c b/gcc/c-family/c-pragma.c
index 526d5fdfe92..cea0b267b92 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -77,7 +77,7 @@ push_alignment (int alignment, tree id)
{
align_stack * entry;
- entry = GGC_NEW (align_stack);
+ entry = ggc_alloc_align_stack ();
entry->alignment = alignment;
entry->id = id;
@@ -706,12 +706,6 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
diagnostic_t kind;
tree x;
- if (cfun)
- {
- error ("#pragma GCC diagnostic not allowed inside functions");
- return;
- }
-
token = pragma_lex (&x);
if (token != CPP_NAME)
GCC_BAD ("missing [error|warning|ignored] after %<#pragma GCC diagnostic%>");
@@ -722,8 +716,18 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
kind = DK_WARNING;
else if (strcmp (kind_string, "ignored") == 0)
kind = DK_IGNORED;
+ else if (strcmp (kind_string, "push") == 0)
+ {
+ diagnostic_push_diagnostics (global_dc, input_location);
+ return;
+ }
+ else if (strcmp (kind_string, "pop") == 0)
+ {
+ diagnostic_pop_diagnostics (global_dc, input_location);
+ return;
+ }
else
- GCC_BAD ("expected [error|warning|ignored] after %<#pragma GCC diagnostic%>");
+ GCC_BAD ("expected [error|warning|ignored|push|pop] after %<#pragma GCC diagnostic%>");
token = pragma_lex (&x);
if (token != CPP_STRING)
@@ -733,7 +737,7 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
if (strcmp (cl_options[option_index].opt_text, option_string) == 0)
{
/* This overrides -Werror, for example. */
- diagnostic_classify_diagnostic (global_dc, option_index, kind);
+ diagnostic_classify_diagnostic (global_dc, option_index, kind, input_location);
/* This makes sure the option is enabled, like -Wfoo would do. */
if (cl_options[option_index].var_type == CLVC_BOOLEAN
&& cl_options[option_index].flag_var
@@ -914,7 +918,7 @@ handle_pragma_push_options (cpp_reader *ARG_UNUSED(dummy))
return;
}
- p = GGC_NEW (opt_stack);
+ p = ggc_alloc_opt_stack ();
p->prev = options_stack;
options_stack = p;
@@ -1333,4 +1337,4 @@ init_pragma (void)
invoke_plugin_callbacks (PLUGIN_PRAGMAS, NULL);
}
-#include "gt-c-pragma.h"
+#include "gt-c-family-c-pragma.h"
diff --git a/gcc/c-pragma.h b/gcc/c-family/c-pragma.h
index eab23db6cd9..eab23db6cd9 100644
--- a/gcc/c-pragma.h
+++ b/gcc/c-family/c-pragma.h
diff --git a/gcc/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index ca0608c79e2..7f4b2388f43 100644
--- a/gcc/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -170,18 +170,43 @@ pp_c_exclamation (c_pretty_printer *pp)
pp_base (pp)->padding = pp_none;
}
-/* Print out the external representation of CV-QUALIFIER. */
+/* Print out the external representation of QUALIFIERS. */
-static void
-pp_c_cv_qualifier (c_pretty_printer *pp, const char *cv)
+void
+pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type)
{
const char *p = pp_last_position_in_text (pp);
+ bool previous = false;
+
+ if (!qualifiers)
+ return;
+
/* The C programming language does not have references, but it is much
simpler to handle those here rather than going through the same
logic in the C++ pretty-printer. */
if (p != NULL && (*p == '*' || *p == '&'))
pp_c_whitespace (pp);
- pp_c_ws_string (pp, cv);
+
+ if (qualifiers & TYPE_QUAL_CONST)
+ {
+ pp_c_ws_string (pp, func_type ? "__attribute__((const))" : "const");
+ previous = true;
+ }
+
+ if (qualifiers & TYPE_QUAL_VOLATILE)
+ {
+ if (previous)
+ pp_c_whitespace (pp);
+ pp_c_ws_string (pp, func_type ? "__attribute__((noreturn))" : "volatile");
+ previous = true;
+ }
+
+ if (qualifiers & TYPE_QUAL_RESTRICT)
+ {
+ if (previous)
+ pp_c_whitespace (pp);
+ pp_c_ws_string (pp, flag_isoc99 ? "restrict" : "__restrict__");
+ }
}
/* Pretty-print T using the type-cast notation '( type-name )'. */
@@ -242,12 +267,8 @@ pp_c_type_qualifier_list (c_pretty_printer *pp, tree t)
t = TREE_TYPE (t);
qualifiers = TYPE_QUALS (t);
- if (qualifiers & TYPE_QUAL_CONST)
- pp_c_cv_qualifier (pp, "const");
- if (qualifiers & TYPE_QUAL_VOLATILE)
- pp_c_cv_qualifier (pp, "volatile");
- if (qualifiers & TYPE_QUAL_RESTRICT)
- pp_c_cv_qualifier (pp, flag_isoc99 ? "restrict" : "__restrict__");
+ pp_c_cv_qualifiers (pp, qualifiers,
+ TREE_CODE (t) == FUNCTION_TYPE);
if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (t)))
{
diff --git a/gcc/c-pretty-print.h b/gcc/c-family/c-pretty-print.h
index 8f12bb05237..60ef0bc375e 100644
--- a/gcc/c-pretty-print.h
+++ b/gcc/c-family/c-pretty-print.h
@@ -176,6 +176,7 @@ void pp_c_space_for_pointer_operator (c_pretty_printer *, tree);
void pp_c_tree_decl_identifier (c_pretty_printer *, tree);
void pp_c_function_definition (c_pretty_printer *, tree);
void pp_c_attributes (c_pretty_printer *, tree);
+void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type);
void pp_c_type_qualifier_list (c_pretty_printer *, tree);
void pp_c_parameter_type_list (c_pretty_printer *, tree);
void pp_c_declaration (c_pretty_printer *, tree);
diff --git a/gcc/c-semantics.c b/gcc/c-family/c-semantics.c
index 683655f77c0..683655f77c0 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-family/c-semantics.c
diff --git a/gcc/c.opt b/gcc/c-family/c.opt
index 01d6428ea6a..ade444a8dcc 100644
--- a/gcc/c.opt
+++ b/gcc/c-family/c.opt
@@ -54,7 +54,7 @@ C ObjC C++ ObjC++ Joined Separate
-D<macro>[=<val>] Define a <macro> with <val> as its value. If just <macro> is given, <val> is taken to be 1
E
-C ObjC C++ ObjC++ Undocumented
+C ObjC C++ ObjC++ Undocumented Var(flag_preprocess_only)
F
C ObjC C++ ObjC++ Joined Separate
@@ -341,6 +341,10 @@ Wnested-externs
C ObjC Var(warn_nested_externs) Warning
Warn about \"extern\" declarations not at file scope
+Wnoexcept
+C++ ObjC++ Var(warn_noexcept) Warning
+Warn when a noexcept expression evaluates to false even though the expression can't actually throw
+
Wnon-template-friend
C++ ObjC++ Var(warn_nontemplate_friend) Init(1) Warning
Warn when non-templatized friend functions are declared within a template
@@ -438,7 +442,7 @@ C++ ObjC++ Var(warn_sign_promo) Warning
Warn when overload promotes from unsigned to signed
Wstrict-null-sentinel
-C++ ObjC++ Warning
+C++ ObjC++ Warning Var(warn_strict_null_sentinel)
Warn about uncasted NULL used as sentinel
Wstrict-prototypes
@@ -526,7 +530,7 @@ C ObjC C++ ObjC++ Joined
; Documented in common.opt. FIXME - what about -dI, -dD, -dN and -dD?
faccess-control
-C++ ObjC++
+C++ ObjC++ Var(flag_access_control) Init(1)
Enforce class member access control semantics
fall-virtual
@@ -537,18 +541,18 @@ C++ ObjC++
Change when template instances are emitted
fasm
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_no_asm, 0)
Recognize the \"asm\" keyword
fbuiltin
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_no_builtin, 0)
Recognize built-in functions
fbuiltin-
C ObjC C++ ObjC++ Joined
fcheck-new
-C++ ObjC++
+C++ ObjC++ Var(flag_check_new)
Check the return value of new
fcond-mismatch
@@ -556,7 +560,7 @@ C ObjC C++ ObjC++
Allow the arguments of the '?' operator to have different types
fconserve-space
-C++ ObjC++
+C++ ObjC++ Var(flag_conserve_space)
Reduce the size of object files
fconstant-string-class=
@@ -569,7 +573,7 @@ C++ ObjC++ Var(flag_deduce_init_list) Init(1)
fdefault-inline
C++ ObjC++
-Inline member functions by default
+Does nothing. Preserved for backward compatibility.
fdirectives-only
C ObjC C++ ObjC++
@@ -580,10 +584,10 @@ C ObjC C++ ObjC++
Permit '$' as an identifier character
felide-constructors
-C++ ObjC++
+C++ ObjC++ Var(flag_elide_constructors) Init(1)
fenforce-eh-specs
-C++ ObjC++
+C++ ObjC++ Var(flag_enforce_eh_specs) Init(1)
Generate code to check exception specifications
fenum-int-equiv
@@ -606,7 +610,7 @@ fexternal-templates
C++ ObjC++
ffor-scope
-C++ ObjC++
+C++ ObjC++ Var(flag_new_for_scope) Init(1)
Scope of for-init-statement variables is local to the loop
ffreestanding
@@ -614,7 +618,7 @@ C ObjC C++ ObjC++
Do not assume that standard C libraries and \"main\" exist
fgnu-keywords
-C++ ObjC++
+C++ ObjC++ Var(flag_no_gnu_keywords, 0)
Recognize GNU-defined keywords
fgnu-runtime
@@ -643,15 +647,15 @@ C++ ObjC++
Enable support for huge objects
fimplement-inlines
-C++ ObjC++
+C++ ObjC++ Var(flag_implement_inlines) Init(1)
Export functions even if they can be inlined
fimplicit-inline-templates
-C++ ObjC++
+C++ ObjC++ Var(flag_implicit_inline_templates) Init(1)
Emit implicit instantiations of inline templates
fimplicit-templates
-C++ ObjC++
+C++ ObjC++ Var(flag_implicit_templates) Init(1)
Emit implicit instantiations of templates
ffriend-injection
@@ -662,11 +666,11 @@ flabels-ok
C++ ObjC++
flax-vector-conversions
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_lax_vector_conversions)
Allow implicit conversions between vectors with differing numbers of subparts and/or differing element types.
fms-extensions
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_ms_extensions)
Don't warn about uses of Microsoft extensions
fname-mangling-version-
@@ -680,11 +684,11 @@ ObjC ObjC++
Generate code for NeXT (Apple Mac OS X) runtime environment
fnil-receivers
-ObjC ObjC++
+ObjC ObjC++ Var(flag_nil_receivers) Init(1)
Assume that receivers of Objective-C messages may be nil
fnonansi-builtins
-C++ ObjC++
+C++ ObjC++ Var(flag_no_nonansi_builtin, 0)
fnonnull-objects
C++ ObjC++
@@ -728,7 +732,7 @@ Recognize C++ keywords like \"compl\" and \"xor\"
foptional-diags
C++ ObjC++
-Enable optional diagnostics
+Does nothing. Preserved for backward compatibility.
fpch-deps
C ObjC C++ ObjC++
@@ -746,11 +750,11 @@ C ObjC C++ ObjC++
Treat the input file as already preprocessed
fpretty-templates
-C++ ObjC++
+C++ ObjC++ Var(flag_pretty_templates) Init(1)
-fno-pretty-templates Do not pretty-print template specializations as the template signature followed by the arguments
freplace-objc-classes
-ObjC ObjC++
+ObjC ObjC++ Var(flag_replace_objc_classes)
Used in Fix-and-Continue mode to indicate that object files may be swapped in at runtime
frepo
@@ -758,34 +762,34 @@ C++ ObjC++
Enable automatic template instantiation
frtti
-C++ ObjC++ Optimization
+C++ ObjC++ Optimization Var(flag_rtti) Init(1)
Generate run time type descriptor information
fshort-double
-C ObjC C++ ObjC++ Optimization
+C ObjC C++ ObjC++ Optimization Var(flag_short_double)
Use the same size for double as for float
fshort-enums
-C ObjC C++ ObjC++ Optimization
+C ObjC C++ ObjC++ Optimization Var(flag_short_enums)
Use the narrowest integer type possible for enumeration types
fshort-wchar
-C ObjC C++ ObjC++ Optimization
+C ObjC C++ ObjC++ Optimization Var(flag_short_wchar)
Force the underlying type for \"wchar_t\" to be \"unsigned short\"
fsigned-bitfields
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_signed_bitfields) Init(1)
When \"signed\" or \"unsigned\" is not given make the bitfield signed
fsigned-char
-C ObjC C++ ObjC++ LTO
+C ObjC C++ ObjC++ LTO Var(flag_signed_char)
Make \"char\" signed by default
fsquangle
C++ ObjC++
fstats
-C++ ObjC++
+C++ ObjC++ Var(flag_detailed_statistics)
Display statistics accumulated during compilation
fstrict-enums
@@ -810,23 +814,23 @@ fthis-is-variable
C++ ObjC++
fthreadsafe-statics
-C++ ObjC++ Optimization
+C++ ObjC++ Optimization Var(flag_threadsafe_statics) Init(1)
-fno-threadsafe-statics Do not generate thread-safe code for initializing local statics
funsigned-bitfields
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_signed_bitfields, 0) VarExists
When \"signed\" or \"unsigned\" is not given make the bitfield unsigned
funsigned-char
-C ObjC C++ ObjC++ LTO
+C ObjC C++ ObjC++ LTO Var(flag_signed_char, 0) VarExists
Make \"char\" unsigned by default
fuse-cxa-atexit
-C++ ObjC++
+C++ ObjC++ Var(flag_use_cxa_atexit) Init(DEFAULT_USE_CXA_ATEXIT)
Use __cxa_atexit to register destructors
fuse-cxa-get-exception-ptr
-C++ ObjC++
+C++ ObjC++ Var(flag_use_cxa_get_exception_ptr) Init(2)
Use __cxa_get_exception_ptr in exception handling
fvisibility-inlines-hidden
@@ -846,7 +850,7 @@ C++ ObjC++
Implement vtables using thunks
fweak
-C++ ObjC++
+C++ ObjC++ Var(flag_weak) Init(1)
Emit common-like symbols as weak symbols
fwide-exec-charset=
@@ -854,7 +858,7 @@ C ObjC C++ ObjC++ Joined RejectNegative
-fwide-exec-charset=<cset> Convert all wide strings and character constants to character set <cset>
fworking-directory
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_working_directory) Init(-1)
Generate a #line directive pointing at the current working directory
fxref
@@ -862,11 +866,11 @@ C++ ObjC++
Emit cross referencing information
fzero-link
-ObjC ObjC++
+ObjC ObjC++ Var(flag_zero_link)
Generate lazy class lookup (via objc_getClass()) for use in Zero-Link mode
gen-decls
-ObjC ObjC++
+ObjC ObjC++ Var(flag_gen_declaration)
Dump declarations to a .decl file
femit-struct-debug-baseonly
@@ -924,9 +928,6 @@ C ObjC C++ ObjC++ Joined Separate
lang-asm
C Undocumented
-lang-objc
-C ObjC C++ ObjC++ Undocumented
-
nostdinc
C ObjC C++ ObjC++
Do not search standard system include directories (those specified with -isystem will still be used)
@@ -1046,7 +1047,7 @@ C ObjC C++ ObjC++
-trigraphs Support ISO C trigraphs
undef
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Var(flag_undef)
Do not predefine system-specific and GCC-specific macros
v
diff --git a/gcc/stub-objc.c b/gcc/c-family/stub-objc.c
index b7748f79c6e..b7748f79c6e 100644
--- a/gcc/stub-objc.c
+++ b/gcc/c-family/stub-objc.c
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index 14d4eacf366..45a764f20e2 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -26,13 +26,13 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "c-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "langhooks.h"
#include "langhooks-def.h"
#include "tree-inline.h"
#include "diagnostic-core.h"
#include "c-objc-common.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
enum c_language_kind c_language = clk_c;
diff --git a/gcc/c-lang.h b/gcc/c-lang.h
index beed5071c66..c0bdc7cb9e5 100644
--- a/gcc/c-lang.h
+++ b/gcc/c-lang.h
@@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_C_LANG_H
#define GCC_C_LANG_H
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "ggc.h"
struct GTY(()) lang_type {
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index fccc2635fa8..d1cac99d562 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "c-tree.h"
#include "intl.h"
-#include "c-pretty-print.h"
+#include "c-family/c-pretty-print.h"
#include "flags.h"
#include "diagnostic.h"
#include "tree-pretty-print.h"
@@ -79,21 +79,22 @@ c_objc_common_init (void)
%E: an identifier or expression,
%F: a function declaration,
%T: a type.
+ %V: a list of type qualifiers from a tree.
+ %v: an explicit list of type qualifiers
+ %#v: an explicit list of type qualifiers of a function type.
- These format specifiers form a subset of the format specifiers set used
- by the C++ front-end.
Please notice when called, the `%' part was already skipped by the
diagnostic machinery. */
static bool
c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
int precision, bool wide, bool set_locus, bool hash)
{
- tree t;
+ tree t = NULL_TREE;
tree name;
c_pretty_printer *cpp = (c_pretty_printer *) pp;
pp->padding = pp_none;
- if (precision != 0 || wide || hash)
+ if (precision != 0 || wide)
return false;
if (*spec == 'K')
@@ -102,10 +103,12 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
return true;
}
- t = va_arg (*text->args_ptr, tree);
-
- if (set_locus && text->locus)
- *text->locus = DECL_SOURCE_LOCATION (t);
+ if (*spec != 'v')
+ {
+ t = va_arg (*text->args_ptr, tree);
+ if (set_locus && text->locus)
+ *text->locus = DECL_SOURCE_LOCATION (t);
+ }
switch (*spec)
{
@@ -155,6 +158,14 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
pp_expression (cpp, t);
return true;
+ case 'V':
+ pp_c_type_qualifier_list (cpp, t);
+ return true;
+
+ case 'v':
+ pp_c_cv_qualifiers (cpp, va_arg (*text->args_ptr, int), hash);
+ return true;
+
default:
return false;
}
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index b30b0636ec0..0493524a1b2 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -46,13 +46,13 @@ along with GCC; see the file COPYING3. If not see
#include "input.h"
#include "cpplib.h"
#include "timevar.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "c-tree.h"
#include "flags.h"
#include "output.h"
#include "toplev.h"
#include "ggc.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "vec.h"
#include "target.h"
#include "cgraph.h"
@@ -86,7 +86,7 @@ c_parse_init (void)
if (!c_dialect_objc ())
mask |= D_OBJC | D_CXX_OBJC;
- ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
+ ridpointers = ggc_alloc_cleared_vec_tree ((int) RID_MAX);
for (i = 0; i < num_c_common_reswords; i++)
{
/* If a keyword is disabled, do not enter it into the table
@@ -2706,7 +2706,7 @@ c_parser_parms_declarator (c_parser *parser, bool id_list_ok, tree attrs)
static struct c_arg_info *
c_parser_parms_list_declarator (c_parser *parser, tree attrs)
{
- bool good_parm = false;
+ bool bad_parm = false;
/* ??? Following the old parser, forward parameter declarations may
use abstract declarators, and if no real parameter declarations
follow the forward declarations then this is not diagnosed. Also
@@ -2758,11 +2758,10 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs)
/* Parse a parameter. */
struct c_parm *parm = c_parser_parameter_declaration (parser, attrs);
attrs = NULL_TREE;
- if (parm != NULL)
- {
- good_parm = true;
- push_parm_decl (parm);
- }
+ if (parm == NULL)
+ bad_parm = true;
+ else
+ push_parm_decl (parm);
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
tree new_attrs;
@@ -2774,20 +2773,13 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs)
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
c_parser_consume_token (parser);
- if (good_parm)
- return get_parm_info (false);
- else
+ if (bad_parm)
{
- struct c_arg_info *ret
- = XOBNEW (&parser_obstack, struct c_arg_info);
- ret->parms = 0;
- ret->tags = 0;
- ret->types = 0;
- ret->others = 0;
- ret->pending_sizes = 0;
- ret->had_vla_unspec = 0;
- return ret;
+ get_pending_sizes ();
+ return NULL;
}
+ else
+ return get_parm_info (false);
}
if (!c_parser_require (parser, CPP_COMMA,
"expected %<;%>, %<,%> or %<)%>"))
@@ -2802,20 +2794,13 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs)
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
c_parser_consume_token (parser);
- if (good_parm)
- return get_parm_info (true);
- else
+ if (bad_parm)
{
- struct c_arg_info *ret
- = XOBNEW (&parser_obstack, struct c_arg_info);
- ret->parms = 0;
- ret->tags = 0;
- ret->types = 0;
- ret->others = 0;
- ret->pending_sizes = 0;
- ret->had_vla_unspec = 0;
- return ret;
+ get_pending_sizes ();
+ return NULL;
}
+ else
+ return get_parm_info (true);
}
else
{
@@ -2841,10 +2826,22 @@ c_parser_parameter_declaration (c_parser *parser, tree attrs)
bool dummy = false;
if (!c_parser_next_token_starts_declspecs (parser))
{
+ c_token *token = c_parser_peek_token (parser);
+ if (parser->error)
+ return NULL;
+ c_parser_set_source_position_from_token (token);
+ if (token->type == CPP_NAME
+ && c_parser_peek_2nd_token (parser)->type != CPP_COMMA
+ && c_parser_peek_2nd_token (parser)->type != CPP_CLOSE_PAREN)
+ {
+ error ("unknown type name %qE", token->value);
+ parser->error = true;
+ }
/* ??? In some Objective-C cases '...' isn't applicable so there
should be a different message. */
- c_parser_error (parser,
- "expected declaration specifiers or %<...%>");
+ else
+ c_parser_error (parser,
+ "expected declaration specifiers or %<...%>");
c_parser_skip_to_end_of_parameter (parser);
return NULL;
}
@@ -4795,7 +4792,7 @@ static struct c_expr
c_parser_conditional_expression (c_parser *parser, struct c_expr *after)
{
struct c_expr cond, exp1, exp2, ret;
- location_t cond_loc, colon_loc;
+ location_t cond_loc, colon_loc, middle_loc;
gcc_assert (!after || c_dialect_objc ());
@@ -4809,8 +4806,11 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after)
if (c_parser_next_token_is (parser, CPP_COLON))
{
tree eptype = NULL_TREE;
- pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
+
+ middle_loc = c_parser_peek_token (parser)->location;
+ pedwarn (middle_loc, OPT_pedantic,
"ISO C forbids omitting the middle term of a ?: expression");
+ warn_for_omitted_condop (middle_loc, cond.value);
if (TREE_CODE (cond.value) == EXCESS_PRECISION_EXPR)
{
eptype = TREE_TYPE (cond.value);
@@ -5601,6 +5601,7 @@ c_parser_postfix_expression (c_parser *parser)
pedwarn (loc, OPT_pedantic,
"ISO C forbids braced-groups within expressions");
expr.value = c_finish_stmt_expr (brace_loc, stmt);
+ mark_exp_read (expr.value);
}
else if (c_token_starts_typename (c_parser_peek_2nd_token (parser)))
{
@@ -8149,10 +8150,11 @@ c_parser_omp_for_loop (location_t loc,
c_parser *parser, tree clauses, tree *par_clauses)
{
tree decl, cond, incr, save_break, save_cont, body, init, stmt, cl;
- tree declv, condv, incrv, initv, for_block = NULL, ret = NULL;
+ tree declv, condv, incrv, initv, ret = NULL;
bool fail = false, open_brace_parsed = false;
int i, collapse = 1, nbraces = 0;
location_t for_loc;
+ VEC(tree,gc) *for_block = make_tree_vector ();
for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl))
if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE)
@@ -8184,8 +8186,7 @@ c_parser_omp_for_loop (location_t loc,
if (c_parser_next_token_starts_declaration (parser))
{
if (i > 0)
- for_block
- = tree_cons (NULL, c_begin_compound_stmt (true), for_block);
+ VEC_safe_push (tree, gc, for_block, c_begin_compound_stmt (true));
c_parser_declaration_or_fndef (parser, true, true, true, true, true);
decl = check_for_loop_decls (for_loc);
if (decl == NULL)
@@ -8415,15 +8416,15 @@ c_parser_omp_for_loop (location_t loc,
ret = stmt;
}
pop_scopes:
- while (for_block)
+ while (!VEC_empty (tree, for_block))
{
/* FIXME diagnostics: LOC below should be the actual location of
this particular for block. We need to build a list of
locations to go along with FOR_BLOCK. */
- stmt = c_end_compound_stmt (loc, TREE_VALUE (for_block), true);
+ stmt = c_end_compound_stmt (loc, VEC_pop (tree, for_block), true);
add_stmt (stmt);
- for_block = TREE_CHAIN (for_block);
}
+ release_tree_vector (for_block);
return ret;
}
@@ -8881,7 +8882,7 @@ c_parse_file (void)
if (c_parser_peek_token (&tparser)->pragma_kind == PRAGMA_GCC_PCH_PREPROCESS)
c_parser_pragma_pch_preprocess (&tparser);
- the_parser = GGC_NEW (c_parser);
+ the_parser = ggc_alloc_c_parser ();
*the_parser = tparser;
/* Initialize EH, if we've been told to do so. */
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 30b5274841a..a607ecdeda6 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_C_TREE_H
#define GCC_C_TREE_H
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "toplev.h"
#include "diagnostic.h"
@@ -490,11 +490,6 @@ extern bool c_warn_unused_global_decl (const_tree);
extern void c_initialize_diagnostics (diagnostic_context *);
extern bool c_vla_unspec_p (tree x, tree fn);
-#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \
- c_build_qualified_type ((TYPE), \
- ((CONST_P) ? TYPE_QUAL_CONST : 0) | \
- ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
-
/* in c-typeck.c */
extern bool in_late_binary_op;
extern int in_alignof;
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index dade1e53391..18e4bdcebfe 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -39,7 +39,8 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "target.h"
#include "tree-iterator.h"
-#include "tree-flow.h"
+#include "bitmap.h"
+#include "gimple.h"
/* Possible cases of implicit bad conversions. Used to select
diagnostic messages in convert_for_assignment. */
@@ -1841,6 +1842,7 @@ mark_exp_read (tree exp)
mark_exp_read (TREE_OPERAND (exp, 0));
break;
case COMPOUND_EXPR:
+ case C_MAYBE_CONST_EXPR:
mark_exp_read (TREE_OPERAND (exp, 1));
break;
default:
@@ -3744,14 +3746,24 @@ build_unary_op (location_t location,
argtype = TREE_TYPE (arg);
/* If the lvalue is const or volatile, merge that into the type
- to which the address will point. Note that you can't get a
- restricted pointer by taking the address of something, so we
- only have to deal with `const' and `volatile' here. */
+ to which the address will point. This should only be needed
+ for function types. */
if ((DECL_P (arg) || REFERENCE_CLASS_P (arg))
&& (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg)))
- argtype = c_build_type_variant (argtype,
- TREE_READONLY (arg),
- TREE_THIS_VOLATILE (arg));
+ {
+ int orig_quals = TYPE_QUALS (strip_array_types (argtype));
+ int quals = orig_quals;
+
+ if (TREE_READONLY (arg))
+ quals |= TYPE_QUAL_CONST;
+ if (TREE_THIS_VOLATILE (arg))
+ quals |= TYPE_QUAL_VOLATILE;
+
+ gcc_assert (quals == orig_quals
+ || TREE_CODE (argtype) == FUNCTION_TYPE);
+
+ argtype = c_build_qualified_type (argtype, quals);
+ }
if (!c_mark_addressable (arg))
return error_mark_node;
@@ -4402,12 +4414,13 @@ build_compound_expr (location_t loc, tree expr1, tree expr2)
/* Issue -Wcast-qual warnings when appropriate. TYPE is the type to
which we are casting. OTYPE is the type of the expression being
- cast. Both TYPE and OTYPE are pointer types. -Wcast-qual appeared
- on the command line. Named address space qualifiers are not handled
- here, because they result in different warnings. */
+ cast. Both TYPE and OTYPE are pointer types. LOC is the location
+ of the cast. -Wcast-qual appeared on the command line. Named
+ address space qualifiers are not handled here, because they result
+ in different warnings. */
static void
-handle_warn_cast_qual (tree type, tree otype)
+handle_warn_cast_qual (location_t loc, tree type, tree otype)
{
tree in_type = type;
tree in_otype = otype;
@@ -4440,13 +4453,15 @@ handle_warn_cast_qual (tree type, tree otype)
&& TREE_CODE (in_otype) == POINTER_TYPE);
if (added)
- warning (OPT_Wcast_qual, "cast adds new qualifiers to function type");
+ warning_at (loc, OPT_Wcast_qual,
+ "cast adds %q#v qualifier to function type", added);
if (discarded)
/* There are qualifiers present in IN_OTYPE that are not present
in IN_TYPE. */
- warning (OPT_Wcast_qual,
- "cast discards qualifiers from pointer target type");
+ warning_at (loc, OPT_Wcast_qual,
+ "cast discards %q#v qualifier from pointer target type",
+ discarded);
if (added || discarded)
return;
@@ -4479,9 +4494,10 @@ handle_warn_cast_qual (tree type, tree otype)
if ((TYPE_QUALS (in_type) &~ TYPE_QUALS (in_otype)) != 0
&& !is_const)
{
- warning (OPT_Wcast_qual,
- ("new qualifiers in middle of multi-level non-const cast "
- "are unsafe"));
+ warning_at (loc, OPT_Wcast_qual,
+ "to be safe all intermediate pointers in cast from "
+ "%qT to %qT must be %<const%> qualified",
+ otype, type);
break;
}
if (is_const)
@@ -4585,7 +4601,7 @@ build_c_cast (location_t loc, tree type, tree expr)
if (warn_cast_qual
&& TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (otype) == POINTER_TYPE)
- handle_warn_cast_qual (type, otype);
+ handle_warn_cast_qual (loc, type, otype);
/* Warn about conversions between pointers to disjoint
address spaces. */
@@ -4997,7 +5013,7 @@ convert_for_assignment (location_t location, tree type, tree rhs,
pedwarn (LOCATION, OPT, AS); \
break; \
case ic_init: \
- pedwarn (LOCATION, OPT, IN); \
+ pedwarn_init (LOCATION, OPT, IN); \
break; \
case ic_return: \
pedwarn (LOCATION, OPT, RE); \
@@ -5007,6 +5023,36 @@ convert_for_assignment (location_t location, tree type, tree rhs,
} \
} while (0)
+ /* This macro is used to emit diagnostics to ensure that all format
+ strings are complete sentences, visible to gettext and checked at
+ compile time. It is the same as WARN_FOR_ASSIGNMENT but with an
+ extra parameter to enumerate qualifiers. */
+
+#define WARN_FOR_QUALIFIERS(LOCATION, OPT, AR, AS, IN, RE, QUALS) \
+ do { \
+ switch (errtype) \
+ { \
+ case ic_argpass: \
+ if (pedwarn (LOCATION, OPT, AR, parmnum, rname, QUALS)) \
+ inform ((fundecl && !DECL_IS_BUILTIN (fundecl)) \
+ ? DECL_SOURCE_LOCATION (fundecl) : LOCATION, \
+ "expected %qT but argument is of type %qT", \
+ type, rhstype); \
+ break; \
+ case ic_assign: \
+ pedwarn (LOCATION, OPT, AS, QUALS); \
+ break; \
+ case ic_init: \
+ pedwarn (LOCATION, OPT, IN, QUALS); \
+ break; \
+ case ic_return: \
+ pedwarn (LOCATION, OPT, RE, QUALS); \
+ break; \
+ default: \
+ gcc_unreachable (); \
+ } \
+ } while (0)
+
if (TREE_CODE (rhs) == EXCESS_PRECISION_EXPR)
rhs = TREE_OPERAND (rhs, 0);
@@ -5214,30 +5260,32 @@ convert_for_assignment (location_t location, tree type, tree rhs,
vice-versa. */
if (TYPE_QUALS_NO_ADDR_SPACE (ttl)
& ~TYPE_QUALS_NO_ADDR_SPACE (ttr))
- WARN_FOR_ASSIGNMENT (location, 0,
+ WARN_FOR_QUALIFIERS (location, 0,
G_("passing argument %d of %qE "
- "makes qualified function "
+ "makes %q#v qualified function "
"pointer from unqualified"),
- G_("assignment makes qualified "
+ G_("assignment makes %q#v qualified "
"function pointer from "
"unqualified"),
- G_("initialization makes qualified "
+ G_("initialization makes %q#v qualified "
"function pointer from "
"unqualified"),
- G_("return makes qualified function "
- "pointer from unqualified"));
+ G_("return makes %q#v qualified function "
+ "pointer from unqualified"),
+ TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr));
}
else if (TYPE_QUALS_NO_ADDR_SPACE (ttr)
& ~TYPE_QUALS_NO_ADDR_SPACE (ttl))
- WARN_FOR_ASSIGNMENT (location, 0,
+ WARN_FOR_QUALIFIERS (location, 0,
G_("passing argument %d of %qE discards "
- "qualifiers from pointer target type"),
- G_("assignment discards qualifiers "
+ "%qv qualifier from pointer target type"),
+ G_("assignment discards %qv qualifier "
"from pointer target type"),
- G_("initialization discards qualifiers "
+ G_("initialization discards %qv qualifier "
"from pointer target type"),
- G_("return discards qualifiers from "
- "pointer target type"));
+ G_("return discards %qv qualifier from "
+ "pointer target type"),
+ TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl));
memb = marginal_memb;
}
@@ -5383,15 +5431,16 @@ convert_for_assignment (location_t location, tree type, tree rhs,
qualifier are acceptable if the 'volatile' has been added
in by the Objective-C EH machinery. */
if (!objc_type_quals_match (ttl, ttr))
- WARN_FOR_ASSIGNMENT (location, 0,
+ WARN_FOR_QUALIFIERS (location, 0,
G_("passing argument %d of %qE discards "
- "qualifiers from pointer target type"),
- G_("assignment discards qualifiers "
+ "%qv qualifier from pointer target type"),
+ G_("assignment discards %qv qualifier "
"from pointer target type"),
- G_("initialization discards qualifiers "
+ G_("initialization discards %qv qualifier "
"from pointer target type"),
- G_("return discards qualifiers from "
- "pointer target type"));
+ G_("return discards %qv qualifier from "
+ "pointer target type"),
+ TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl));
}
/* If this is not a case of ignoring a mismatch in signedness,
no warning. */
@@ -5419,16 +5468,17 @@ convert_for_assignment (location_t location, tree type, tree rhs,
where an ordinary one is wanted, but not vice-versa. */
if (TYPE_QUALS_NO_ADDR_SPACE (ttl)
& ~TYPE_QUALS_NO_ADDR_SPACE (ttr))
- WARN_FOR_ASSIGNMENT (location, 0,
+ WARN_FOR_QUALIFIERS (location, 0,
G_("passing argument %d of %qE makes "
- "qualified function pointer "
+ "%q#v qualified function pointer "
"from unqualified"),
- G_("assignment makes qualified function "
+ G_("assignment makes %q#v qualified function "
"pointer from unqualified"),
- G_("initialization makes qualified "
+ G_("initialization makes %q#v qualified "
"function pointer from unqualified"),
- G_("return makes qualified function "
- "pointer from unqualified"));
+ G_("return makes %q#v qualified function "
+ "pointer from unqualified"),
+ TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr));
}
}
else
@@ -5737,15 +5787,16 @@ print_spelling (char *buffer)
}
/* Issue an error message for a bad initializer component.
- MSGID identifies the message.
+ GMSGID identifies the message.
The component name is taken from the spelling stack. */
void
-error_init (const char *msgid)
+error_init (const char *gmsgid)
{
char *ofwhat;
- error ("%s", _(msgid));
+ /* The gmsgid may be a format string with %< and %>. */
+ error (gmsgid);
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
if (*ofwhat)
error ("(near initialization for %qs)", ofwhat);
@@ -5753,15 +5804,16 @@ error_init (const char *msgid)
/* Issue a pedantic warning for a bad initializer component. OPT is
the option OPT_* (from options.h) controlling this warning or 0 if
- it is unconditionally given. MSGID identifies the message. The
+ it is unconditionally given. GMSGID identifies the message. The
component name is taken from the spelling stack. */
void
-pedwarn_init (location_t location, int opt, const char *msgid)
+pedwarn_init (location_t location, int opt, const char *gmsgid)
{
char *ofwhat;
-
- pedwarn (location, opt, "%s", _(msgid));
+
+ /* The gmsgid may be a format string with %< and %>. */
+ pedwarn (location, opt, gmsgid);
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
if (*ofwhat)
pedwarn (location, opt, "(near initialization for %qs)", ofwhat);
@@ -5770,15 +5822,16 @@ pedwarn_init (location_t location, int opt, const char *msgid)
/* Issue a warning for a bad initializer component.
OPT is the OPT_W* value corresponding to the warning option that
- controls this warning. MSGID identifies the message. The
+ controls this warning. GMSGID identifies the message. The
component name is taken from the spelling stack. */
static void
-warning_init (int opt, const char *msgid)
+warning_init (int opt, const char *gmsgid)
{
char *ofwhat;
- warning (opt, "%s", _(msgid));
+ /* The gmsgid may be a format string with %< and %>. */
+ warning (opt, gmsgid);
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
if (*ofwhat)
warning (opt, "(near initialization for %qs)", ofwhat);
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index 6bcfd4bf4c7..78b508cc535 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -1212,7 +1212,7 @@ insert_restore (struct insn_chain *chain, int before_p, int regno,
/* Check that insn to restore REGNO in save_mode[regno] is
correct. */
&& reg_save_code (regno, save_mode[regno]) >= 0)
- mem = adjust_address (mem, save_mode[regno], 0);
+ mem = adjust_address_nv (mem, save_mode[regno], 0);
else
mem = copy_rtx (mem);
@@ -1293,7 +1293,7 @@ insert_save (struct insn_chain *chain, int before_p, int regno,
/* Check that insn to save REGNO in save_mode[regno] is
correct. */
&& reg_save_code (regno, save_mode[regno]) >= 0)
- mem = adjust_address (mem, save_mode[regno], 0);
+ mem = adjust_address_nv (mem, save_mode[regno], 0);
else
mem = copy_rtx (mem);
diff --git a/gcc/calls.c b/gcc/calls.c
index 9c51f1a5a74..3b06ad397de 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -208,13 +208,15 @@ prepare_call_address (tree fndecl, rtx funexp, rtx static_chain_value,
The CALL_INSN is the first insn generated.
FNDECL is the declaration node of the function. This is given to the
- macro RETURN_POPS_ARGS to determine whether this function pops its own args.
+ hook TARGET_RETURN_POPS_ARGS to determine whether this function pops
+ its own args.
- FUNTYPE is the data type of the function. This is given to the macro
- RETURN_POPS_ARGS to determine whether this function pops its own args.
- We used to allow an identifier for library functions, but that doesn't
- work when the return type is an aggregate type and the calling convention
- says that the pointer to this aggregate is to be popped by the callee.
+ FUNTYPE is the data type of the function. This is given to the hook
+ TARGET_RETURN_POPS_ARGS to determine whether this function pops its
+ own args. We used to allow an identifier for library functions, but
+ that doesn't work when the return type is an aggregate type and the
+ calling convention says that the pointer to this aggregate is to be
+ popped by the callee.
STACK_SIZE is the number of bytes of arguments on the stack,
ROUNDED_STACK_SIZE is that number rounded up to
@@ -226,7 +228,7 @@ prepare_call_address (tree fndecl, rtx funexp, rtx static_chain_value,
It is zero if this call doesn't want a structure value.
NEXT_ARG_REG is the rtx that results from executing
- FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
+ targetm.calls.function_arg (&args_so_far, VOIDmode, void_type_node, true)
just after all the args have had their registers assigned.
This could be whatever you like, but normally it is the first
arg-register beyond those used for args in this call,
@@ -256,7 +258,8 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size);
rtx call_insn;
int already_popped = 0;
- HOST_WIDE_INT n_popped = RETURN_POPS_ARGS (fndecl, funtype, stack_size);
+ HOST_WIDE_INT n_popped
+ = targetm.calls.return_pops_args (fndecl, funtype, stack_size);
#ifdef CALL_POPS_ARGS
n_popped += CALL_POPS_ARGS (* args_so_far);
@@ -1124,17 +1127,18 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
args[i].unsignedp = unsignedp;
args[i].mode = mode;
- args[i].reg = FUNCTION_ARG (*args_so_far, mode, type,
- argpos < n_named_args);
-#ifdef FUNCTION_INCOMING_ARG
+ args[i].reg = targetm.calls.function_arg (args_so_far, mode, type,
+ argpos < n_named_args);
+
/* If this is a sibling call and the machine has register windows, the
register window has to be unwinded before calling the routine, so
arguments have to go into the incoming registers. */
- args[i].tail_call_reg = FUNCTION_INCOMING_ARG (*args_so_far, mode, type,
- argpos < n_named_args);
-#else
- args[i].tail_call_reg = args[i].reg;
-#endif
+ if (targetm.calls.function_incoming_arg != targetm.calls.function_arg)
+ args[i].tail_call_reg
+ = targetm.calls.function_incoming_arg (args_so_far, mode, type,
+ argpos < n_named_args);
+ else
+ args[i].tail_call_reg = args[i].reg;
if (args[i].reg)
args[i].partial
@@ -1189,8 +1193,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
/* Increment ARGS_SO_FAR, which has info about which arg-registers
have been used, etc. */
- FUNCTION_ARG_ADVANCE (*args_so_far, TYPE_MODE (type), type,
- argpos < n_named_args);
+ targetm.calls.function_arg_advance (args_so_far, TYPE_MODE (type),
+ type, argpos < n_named_args);
}
}
@@ -2323,10 +2327,10 @@ expand_call (tree exp, rtx target, int ignore)
- crtl->args.pretend_args_size)
/* If the callee pops its own arguments, then it must pop exactly
the same number of arguments as the current function. */
- || (RETURN_POPS_ARGS (fndecl, funtype, args_size.constant)
- != RETURN_POPS_ARGS (current_function_decl,
- TREE_TYPE (current_function_decl),
- crtl->args.size))
+ || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant)
+ != targetm.calls.return_pops_args (current_function_decl,
+ TREE_TYPE (current_function_decl),
+ crtl->args.size))
|| !lang_hooks.decls.ok_for_sibcall (fndecl))
try_tail_call = 0;
@@ -2825,14 +2829,15 @@ expand_call (tree exp, rtx target, int ignore)
/* Set up next argument register. For sibling calls on machines
with register windows this should be the incoming register. */
-#ifdef FUNCTION_INCOMING_ARG
if (pass == 0)
- next_arg_reg = FUNCTION_INCOMING_ARG (args_so_far, VOIDmode,
- void_type_node, 1);
+ next_arg_reg = targetm.calls.function_incoming_arg (&args_so_far,
+ VOIDmode,
+ void_type_node,
+ true);
else
-#endif
- next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode,
- void_type_node, 1);
+ next_arg_reg = targetm.calls.function_arg (&args_so_far,
+ VOIDmode, void_type_node,
+ true);
/* All arguments and registers used for the call must be set up by
now! */
@@ -3419,7 +3424,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
argvec[count].mode = Pmode;
argvec[count].partial = 0;
- argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1);
+ argvec[count].reg = targetm.calls.function_arg (&args_so_far,
+ Pmode, NULL_TREE, true);
gcc_assert (targetm.calls.arg_partial_bytes (&args_so_far, Pmode,
NULL_TREE, 1) == 0);
@@ -3435,7 +3441,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
|| reg_parm_stack_space > 0)
args_size.constant += argvec[count].locate.size.constant;
- FUNCTION_ARG_ADVANCE (args_so_far, Pmode, (tree) 0, 1);
+ targetm.calls.function_arg_advance (&args_so_far, Pmode, (tree) 0, true);
count++;
}
@@ -3494,7 +3500,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
argvec[count].value = val;
argvec[count].mode = mode;
- argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
+ argvec[count].reg = targetm.calls.function_arg (&args_so_far, mode,
+ NULL_TREE, true);
argvec[count].partial
= targetm.calls.arg_partial_bytes (&args_so_far, mode, NULL_TREE, 1);
@@ -3514,7 +3521,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
|| reg_parm_stack_space > 0)
args_size.constant += argvec[count].locate.size.constant;
- FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1);
+ targetm.calls.function_arg_advance (&args_so_far, mode, (tree) 0, true);
}
/* If this machine requires an external definition for library
@@ -3823,7 +3830,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
build_function_type (tfom, NULL_TREE),
original_args_size.constant, args_size.constant,
struct_value_size,
- FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
+ targetm.calls.function_arg (&args_so_far,
+ VOIDmode, void_type_node, true),
valreg,
old_inhibit_defer_pop + 1, call_fusage, flags, & args_so_far);
diff --git a/gcc/cfg.c b/gcc/cfg.c
index ee6af697468..563582ff296 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -84,13 +84,13 @@ void
init_flow (struct function *the_fun)
{
if (!the_fun->cfg)
- the_fun->cfg = GGC_CNEW (struct control_flow_graph);
+ the_fun->cfg = ggc_alloc_cleared_control_flow_graph ();
n_edges_for_function (the_fun) = 0;
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)
- = GGC_CNEW (struct basic_block_def);
+ = ggc_alloc_cleared_basic_block_def ();
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = ENTRY_BLOCK;
EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)
- = GGC_CNEW (struct basic_block_def);
+ = ggc_alloc_cleared_basic_block_def ();
EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = EXIT_BLOCK;
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->next_bb
= EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun);
@@ -139,7 +139,7 @@ basic_block
alloc_block (void)
{
basic_block bb;
- bb = GGC_CNEW (struct basic_block_def);
+ bb = ggc_alloc_cleared_basic_block_def ();
return bb;
}
@@ -277,7 +277,7 @@ edge
unchecked_make_edge (basic_block src, basic_block dst, int flags)
{
edge e;
- e = GGC_CNEW (struct edge_def);
+ e = ggc_alloc_cleared_edge_def ();
n_edges++;
e->src = src;
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 5bb23b77adb..65fe337ab01 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -1256,7 +1256,7 @@ dfs_enumerate_from (basic_block bb, int reverse,
static void
-compute_dominance_frontiers_1 (bitmap *frontiers)
+compute_dominance_frontiers_1 (bitmap_head *frontiers)
{
edge p;
edge_iterator ei;
@@ -1275,10 +1275,9 @@ compute_dominance_frontiers_1 (bitmap *frontiers)
domsb = get_immediate_dominator (CDI_DOMINATORS, b);
while (runner != domsb)
{
- if (bitmap_bit_p (frontiers[runner->index], b->index))
+ if (!bitmap_set_bit (&frontiers[runner->index],
+ b->index))
break;
- bitmap_set_bit (frontiers[runner->index],
- b->index);
runner = get_immediate_dominator (CDI_DOMINATORS,
runner);
}
@@ -1289,7 +1288,7 @@ compute_dominance_frontiers_1 (bitmap *frontiers)
void
-compute_dominance_frontiers (bitmap *frontiers)
+compute_dominance_frontiers (bitmap_head *frontiers)
{
timevar_push (TV_DOM_FRONTIERS);
@@ -1308,7 +1307,7 @@ compute_dominance_frontiers (bitmap *frontiers)
allocated for the return value. */
bitmap
-compute_idf (bitmap def_blocks, bitmap *dfs)
+compute_idf (bitmap def_blocks, bitmap_head *dfs)
{
bitmap_iterator bi;
unsigned bb_index, i;
@@ -1341,7 +1340,7 @@ compute_idf (bitmap def_blocks, bitmap *dfs)
we may pull a non-existing block from the work stack. */
gcc_assert (bb_index < (unsigned) last_basic_block);
- EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index], phi_insertion_points,
+ EXECUTE_IF_AND_COMPL_IN_BITMAP (&dfs[bb_index], phi_insertion_points,
0, i, bi)
{
/* Use a safe push because if there is a definition of VAR
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index cc8ff336a42..a76aeb23b3b 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "ssaexpand.h"
#include "bitmap.h"
#include "sbitmap.h"
+#include "insn-attr.h" /* For INSN_SCHEDULING. */
/* This variable holds information helping the rewriting of SSA trees
into RTL. */
@@ -67,7 +68,13 @@ gimple_assign_rhs_to_tree (gimple stmt)
grhs_class = get_gimple_rhs_class (gimple_expr_code (stmt));
- if (grhs_class == GIMPLE_BINARY_RHS)
+ if (grhs_class == GIMPLE_TERNARY_RHS)
+ t = build3 (gimple_assign_rhs_code (stmt),
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ gimple_assign_rhs3 (stmt));
+ else if (grhs_class == GIMPLE_BINARY_RHS)
t = build2 (gimple_assign_rhs_code (stmt),
TREE_TYPE (gimple_assign_lhs (stmt)),
gimple_assign_rhs1 (stmt),
@@ -1888,6 +1895,9 @@ expand_gimple_stmt_1 (gimple stmt)
ops.type = TREE_TYPE (lhs);
switch (get_gimple_rhs_class (gimple_expr_code (stmt)))
{
+ case GIMPLE_TERNARY_RHS:
+ ops.op2 = gimple_assign_rhs3 (stmt);
+ /* Fallthru */
case GIMPLE_BINARY_RHS:
ops.op1 = gimple_assign_rhs2 (stmt);
/* Fallthru */
@@ -2238,6 +2248,8 @@ expand_debug_expr (tree exp)
{
case COND_EXPR:
case DOT_PROD_EXPR:
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
goto ternary;
case TRUTH_ANDIF_EXPR:
@@ -2426,6 +2438,11 @@ expand_debug_expr (tree exp)
return op0;
}
+ case MEM_REF:
+ /* ??? FIXME. */
+ if (!integer_zerop (TREE_OPERAND (exp, 1)))
+ return NULL;
+ /* Fallthru. */
case INDIRECT_REF:
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
@@ -3024,6 +3041,8 @@ expand_debug_expr (tree exp)
return NULL;
case WIDEN_MULT_EXPR:
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
if (SCALAR_INT_MODE_P (GET_MODE (op0))
&& SCALAR_INT_MODE_P (mode))
{
@@ -3036,7 +3055,13 @@ expand_debug_expr (tree exp)
op1 = simplify_gen_unary (ZERO_EXTEND, mode, op1, inner_mode);
else
op1 = simplify_gen_unary (SIGN_EXTEND, mode, op1, inner_mode);
- return gen_rtx_MULT (mode, op0, op1);
+ op0 = gen_rtx_MULT (mode, op0, op1);
+ if (TREE_CODE (exp) == WIDEN_MULT_EXPR)
+ return op0;
+ else if (TREE_CODE (exp) == WIDEN_MULT_PLUS_EXPR)
+ return gen_rtx_PLUS (mode, op0, op2);
+ else
+ return gen_rtx_MINUS (mode, op2, op0);
}
return NULL;
@@ -3761,6 +3786,10 @@ gimple_expand_cfg (void)
set_curr_insn_block (DECL_INITIAL (current_function_decl));
prologue_locator = curr_insn_locator ();
+#ifdef INSN_SCHEDULING
+ init_sched_attrs ();
+#endif
+
/* Make sure first insn is a note even if we don't want linenums.
This makes sure the first insn will never be deleted.
Also, final expects a note to appear there. */
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 858e75b3f52..c0d9a4cacc2 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -334,9 +334,9 @@ flow_loop_tree_node_remove (struct loop *loop)
struct loop *
alloc_loop (void)
{
- struct loop *loop = GGC_CNEW (struct loop);
+ struct loop *loop = ggc_alloc_cleared_loop ();
- loop->exits = GGC_CNEW (struct loop_exit);
+ loop->exits = ggc_alloc_cleared_loop_exit ();
loop->exits->next = loop->exits->prev = loop->exits;
loop->can_be_parallel = false;
loop->single_iv = NULL_TREE;
@@ -1026,7 +1026,7 @@ rescan_loop_exit (edge e, bool new_edge, bool removed)
aloop != cloop;
aloop = loop_outer (aloop))
{
- exit = GGC_NEW (struct loop_exit);
+ exit = ggc_alloc_loop_exit ();
exit->e = e;
exit->next = aloop->exits->next;
@@ -1076,11 +1076,9 @@ record_loop_exits (void)
loops_state_set (LOOPS_HAVE_RECORDED_EXITS);
gcc_assert (current_loops->exits == NULL);
- current_loops->exits = htab_create_alloc (2 * number_of_loops (),
- loop_exit_hash,
- loop_exit_eq,
- loop_exit_free,
- ggc_calloc, ggc_free);
+ current_loops->exits = htab_create_ggc (2 * number_of_loops (),
+ loop_exit_hash, loop_exit_eq,
+ loop_exit_free);
FOR_EACH_BB (bb)
{
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index abdbf9d8598..3138281b589 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -42,7 +42,6 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "rtl.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "regs.h"
@@ -50,7 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "function.h"
#include "except.h"
-#include "toplev.h"
+#include "rtl-error.h"
#include "tm_p.h"
#include "obstack.h"
#include "insn-attr.h"
@@ -3080,7 +3079,7 @@ void
init_rtl_bb_info (basic_block bb)
{
gcc_assert (!bb->il.rtl);
- bb->il.rtl = GGC_CNEW (struct rtl_bb_info);
+ bb->il.rtl = ggc_alloc_cleared_rtl_bb_info ();
}
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 0c2441fcf6f..aaa50b607d2 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -442,7 +442,7 @@ cgraph_allocate_node (void)
}
else
{
- node = GGC_CNEW (struct cgraph_node);
+ node = ggc_alloc_cleared_cgraph_node ();
node->uid = cgraph_max_uid++;
}
@@ -970,7 +970,7 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
}
else
{
- edge = GGC_NEW (struct cgraph_edge);
+ edge = ggc_alloc_cgraph_edge ();
edge->uid = cgraph_edge_max_uid++;
}
@@ -1045,7 +1045,7 @@ cgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt,
edge->indirect_unknown_callee = 1;
initialize_inline_failed (edge);
- edge->indirect_info = GGC_CNEW (struct cgraph_indirect_call_info);
+ edge->indirect_info = ggc_alloc_cleared_cgraph_indirect_call_info ();
edge->indirect_info->param_index = -1;
edge->indirect_info->ecf_flags = ecf_flags;
@@ -1825,6 +1825,8 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf (f, " local");
if (node->local.externally_visible)
fprintf (f, " externally_visible");
+ if (node->local.used_from_object_file)
+ fprintf (f, " used_from_object_file");
if (node->local.finalized)
fprintf (f, " finalized");
if (node->local.disregard_inline_limits)
@@ -1973,7 +1975,7 @@ cgraph_add_asm_node (tree asm_str)
{
struct cgraph_asm_node *node;
- node = GGC_CNEW (struct cgraph_asm_node);
+ node = ggc_alloc_cleared_cgraph_asm_node ();
node->asm_str = asm_str;
node->order = cgraph_order++;
node->next = NULL;
@@ -2075,6 +2077,7 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
new_node->analyzed = n->analyzed;
new_node->local = n->local;
new_node->local.externally_visible = false;
+ new_node->local.used_from_object_file = false;
new_node->local.local = true;
new_node->local.vtable_method = false;
new_node->global = n->global;
@@ -2214,6 +2217,8 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
??? We cannot use COMDAT linkage because there is no
ABI support for this. */
DECL_EXTERNAL (new_node->decl) = 0;
+ if (DECL_ONE_ONLY (old_decl))
+ DECL_SECTION_NAME (new_node->decl) = NULL;
DECL_COMDAT_GROUP (new_node->decl) = 0;
TREE_PUBLIC (new_node->decl) = 0;
DECL_COMDAT (new_node->decl) = 0;
@@ -2266,6 +2271,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
else
new_node->clone.combined_args_to_skip = args_to_skip;
new_node->local.externally_visible = 0;
+ new_node->local.used_from_object_file = 0;
new_node->local.local = 1;
new_node->lowered = true;
new_node->reachable = true;
@@ -2606,6 +2612,8 @@ cgraph_node_cannot_return (struct cgraph_node *node)
bool
cgraph_edge_cannot_lead_to_return (struct cgraph_edge *e)
{
+ if (cgraph_node_cannot_return (e->caller))
+ return true;
if (e->indirect_unknown_callee)
{
int flags = e->indirect_info->ecf_flags;
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index c82fc181ebe..ef556b9cd7f 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -102,6 +102,9 @@ struct GTY(()) cgraph_local_info {
/* Set when function is visible by other units. */
unsigned externally_visible : 1;
+ /* Set when resolver determines that function is visible by other units. */
+ unsigned used_from_object_file : 1;
+
/* Set once it has been finalized so we consider it to be output. */
unsigned finalized : 1;
@@ -466,6 +469,8 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) varpool_node {
/* Circular list of nodes in the same comdat group if non-NULL. */
struct varpool_node *same_comdat_group;
struct ipa_ref_list ref_list;
+ /* File stream where this node is being written to. */
+ struct lto_file_decl_data * lto_file_data;
PTR GTY ((skip)) aux;
/* Ordering of all cgraph nodes. */
int order;
@@ -485,6 +490,8 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) varpool_node {
unsigned output : 1;
/* Set when function is visible by other units. */
unsigned externally_visible : 1;
+ /* Set when resolver determines that variable is visible by other units. */
+ unsigned used_from_object_file : 1;
/* Set for aliases once they got through assemble_alias. Also set for
extra name aliases in varpool_extra_name_alias. */
unsigned alias : 1;
@@ -722,7 +729,7 @@ varpool_first_static_initializer (void)
struct varpool_node *node;
for (node = varpool_nodes_queue; node; node = node->next_needed)
{
- gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
+ gcc_checking_assert (TREE_CODE (node->decl) == VAR_DECL);
if (DECL_INITIAL (node->decl))
return node;
}
@@ -735,7 +742,7 @@ varpool_next_static_initializer (struct varpool_node *node)
{
for (node = node->next_needed; node; node = node->next_needed)
{
- gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
+ gcc_checking_assert (TREE_CODE (node->decl) == VAR_DECL);
if (DECL_INITIAL (node->decl))
return node;
}
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index c63b5afc81c..9dcb8623167 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -275,7 +275,7 @@ mark_load (gimple stmt ATTRIBUTE_UNUSED, tree t,
void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
- if (TREE_CODE (t) == VAR_DECL
+ if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
@@ -300,7 +300,7 @@ mark_store (gimple stmt ATTRIBUTE_UNUSED, tree t,
void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
- if (TREE_CODE (t) == VAR_DECL
+ if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 54752ed54c1..5a69afa5286 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1364,8 +1364,7 @@ thunk_adjust (gimple_stmt_iterator * bsi,
vtabletmp2 = create_tmp_var (TREE_TYPE (TREE_TYPE (vtabletmp)),
"vtableaddr");
stmt = gimple_build_assign (vtabletmp2,
- build1 (INDIRECT_REF,
- TREE_TYPE (vtabletmp2), vtabletmp));
+ build_simple_mem_ref (vtabletmp));
gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
mark_symbols_for_renaming (stmt);
find_referenced_vars_in (stmt);
@@ -1384,9 +1383,7 @@ thunk_adjust (gimple_stmt_iterator * bsi,
vtabletmp3 = create_tmp_var (TREE_TYPE (TREE_TYPE (vtabletmp2)),
"vcalloffset");
stmt = gimple_build_assign (vtabletmp3,
- build1 (INDIRECT_REF,
- TREE_TYPE (vtabletmp3),
- vtabletmp2));
+ build_simple_mem_ref (vtabletmp2));
gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
mark_symbols_for_renaming (stmt);
find_referenced_vars_in (stmt);
@@ -2128,7 +2125,7 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
new_version->local.local = true;
new_version->local.vtable_method = false;
new_version->global = old_version->global;
- new_version->rtl = new_version->rtl;
+ new_version->rtl = old_version->rtl;
new_version->reachable = true;
new_version->count = old_version->count;
@@ -2196,7 +2193,6 @@ cgraph_function_versioning (struct cgraph_node *old_version_node,
else
new_decl = build_function_decl_skip_args (old_decl, args_to_skip);
- cgraph_make_decl_local (new_decl);
/* Generate a new name for the new version. */
DECL_NAME (new_decl) = clone_function_name (old_decl, clone_name);
SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
@@ -2345,7 +2341,6 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
{
tree decl = gimple_call_fndecl (e->call_stmt);
gimple new_stmt;
- gimple_stmt_iterator gsi;
#ifdef ENABLE_CHECKING
struct cgraph_node *node;
#endif
@@ -2367,29 +2362,34 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
cgraph_node_name (e->callee), e->callee->uid);
print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags);
if (e->callee->clone.combined_args_to_skip)
- {
- fprintf (cgraph_dump_file, " combined args to skip: ");
- dump_bitmap (cgraph_dump_file, e->callee->clone.combined_args_to_skip);
+ {
+ fprintf (cgraph_dump_file, " combined args to skip: ");
+ dump_bitmap (cgraph_dump_file,
+ e->callee->clone.combined_args_to_skip);
}
}
if (e->callee->clone.combined_args_to_skip)
- new_stmt = gimple_call_copy_skip_args (e->call_stmt,
- e->callee->clone.combined_args_to_skip);
+ {
+ gimple_stmt_iterator gsi;
+
+ new_stmt
+ = gimple_call_copy_skip_args (e->call_stmt,
+ e->callee->clone.combined_args_to_skip);
+
+ if (gimple_vdef (new_stmt)
+ && TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
+
+ gsi = gsi_for_stmt (e->call_stmt);
+ gsi_replace (&gsi, new_stmt, true);
+ }
else
new_stmt = e->call_stmt;
- if (gimple_vdef (new_stmt)
- && TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)
- SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
- gimple_call_set_fndecl (new_stmt, e->callee->decl);
- gsi = gsi_for_stmt (e->call_stmt);
- gsi_replace (&gsi, new_stmt, true);
+ gimple_call_set_fndecl (new_stmt, e->callee->decl);
update_stmt (new_stmt);
- /* Update EH information too, just in case. */
- maybe_clean_or_replace_eh_stmt (e->call_stmt, new_stmt);
-
cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt);
if (cgraph_dump_file)
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 42db3cbf0ff..b26aaf31485 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1535,12 +1535,7 @@ main (int argc, char **argv)
case 'o':
if (arg[2] == '\0')
output_file = *ld1++ = *ld2++ = *++argv;
- else if (1
-#ifdef SWITCHES_NEED_SPACES
- && ! strchr (SWITCHES_NEED_SPACES, arg[1])
-#endif
- )
-
+ else
output_file = &arg[2];
break;
@@ -1593,9 +1588,9 @@ main (int argc, char **argv)
}
else if (strncmp (arg, "--sysroot=", 10) == 0)
target_system_root = arg + 10;
- else if (strncmp (arg, "--version", 9) == 0)
+ else if (strcmp (arg, "--version") == 0)
vflag = true;
- else if (strncmp (arg, "--help", 9) == 0)
+ else if (strcmp (arg, "--help") == 0)
helpflag = true;
break;
}
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 8849697bfce..96bfb3a633e 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -555,7 +555,7 @@ rest_of_handle_stack_adjustments (void)
cleanup_cfg (flag_crossjumping ? CLEANUP_CROSSJUMP : 0);
/* This is kind of a heuristic. We need to run combine_stack_adjustments
- even for machines with possibly nonzero RETURN_POPS_ARGS
+ even for machines with possibly nonzero TARGET_RETURN_POPS_ARGS
and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
push instructions will have popping returns. */
#ifndef PUSH_ROUNDING
diff --git a/gcc/combine.c b/gcc/combine.c
index 1bee2c7f422..d3305cb4abe 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -7277,22 +7277,21 @@ make_compound_operation (rtx x, enum rtx_code in_code)
/* Call ourselves recursively on the inner expression. If we are
narrowing the object and it has a different RTL code from
what it originally did, do this SUBREG as a force_to_mode. */
-
- tem = make_compound_operation (SUBREG_REG (x), in_code);
-
{
- rtx simplified = simplify_subreg (mode, tem, GET_MODE (SUBREG_REG (x)),
- SUBREG_BYTE (x));
+ rtx inner = SUBREG_REG (x), simplified;
+
+ tem = make_compound_operation (inner, in_code);
+ simplified
+ = simplify_subreg (mode, tem, GET_MODE (inner), SUBREG_BYTE (x));
if (simplified)
tem = simplified;
- if (GET_CODE (tem) != GET_CODE (SUBREG_REG (x))
- && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))
+ if (GET_CODE (tem) != GET_CODE (inner)
+ && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (inner))
&& subreg_lowpart_p (x))
{
- rtx newer = force_to_mode (tem, mode, ~(HOST_WIDE_INT) 0,
- 0);
+ rtx newer = force_to_mode (tem, mode, ~(HOST_WIDE_INT) 0, 0);
/* If we have something other than a SUBREG, we might have
done an expansion, so rerun ourselves. */
@@ -7300,9 +7299,16 @@ make_compound_operation (rtx x, enum rtx_code in_code)
newer = make_compound_operation (newer, in_code);
/* force_to_mode can expand compounds. If it just re-expanded the
- compound use gen_lowpart instead to convert to the desired
- mode. */
- if (rtx_equal_p (newer, x))
+ compound, use gen_lowpart to convert to the desired mode. */
+ if (rtx_equal_p (newer, x)
+ /* Likewise if it re-expanded the compound only partially.
+ This happens for SUBREG of ZERO_EXTRACT if they extract
+ the same number of bits. */
+ || (GET_CODE (newer) == SUBREG
+ && (GET_CODE (SUBREG_REG (newer)) == LSHIFTRT
+ || GET_CODE (SUBREG_REG (newer)) == ASHIFTRT)
+ && GET_CODE (inner) == AND
+ && rtx_equal_p (SUBREG_REG (newer), XEXP (inner, 0))))
return gen_lowpart (GET_MODE (x), tem);
return newer;
diff --git a/gcc/common.opt b/gcc/common.opt
index 49044815509..6ca787a4b5f 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -173,7 +173,7 @@ Common Warning
Warn about code which might break strict aliasing rules
Wstrict-aliasing=
-Common Joined UInteger Var(warn_strict_aliasing) Init(-1) Warning
+Common Joined RejectNegative UInteger Var(warn_strict_aliasing) Init(-1) Warning
Warn about code which might break strict aliasing rules
Wstrict-overflow
@@ -181,7 +181,7 @@ Common Warning
Warn about optimizations that assume that signed overflow is undefined
Wstrict-overflow=
-Common Joined UInteger Var(warn_strict_overflow) Init(-1) Warning
+Common Joined RejectNegative UInteger Var(warn_strict_overflow) Init(-1) Warning
Warn about optimizations that assume that signed overflow is undefined
Wsuggest-attribute=const
@@ -192,6 +192,10 @@ Wsuggest-attribute=pure
Common Var(warn_suggest_attribute_pure) Warning
Warn about functions which might be candidates for __attribute__((pure))
+Wsuggest-attribute=noreturn
+Common Var(warn_suggest_attribute_noreturn) Warning
+Warn about functions which might be candidates for __attribute__((noreturn))
+
Wswitch
Common Var(warn_switch) Warning
Warn about enumerated switches, with no default, missing a case
@@ -301,7 +305,7 @@ Common Separate
; Additional positive integers will be assigned as new versions of
; the ABI become the default version of the ABI.
fabi-version=
-Common Joined UInteger Var(flag_abi_version) Init(2)
+Common Joined RejectNegative UInteger Var(flag_abi_version) Init(2)
falign-functions
Common Report Var(align_functions,0) Optimization UInteger
@@ -625,6 +629,10 @@ floop-block
Common Report Var(flag_loop_block) Optimization
Enable Loop Blocking transformation
+fstrict-volatile-bitfields
+Common Report Var(flag_strict_volatile_bitfields) Init(-1)
+Force bitfield accesses to match their type width
+
fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities
@@ -757,7 +765,7 @@ Common Report Var(flag_ira_share_spill_slots) Init(1)
Share stack slots for spilled pseudo-registers.
fira-verbose=
-Common RejectNegative Joined UInteger
+Common RejectNegative Joined UInteger Var(flag_ira_verbose) Init(5)
-fira-verbose=<number> Control IRA's level of diagnostic messages.
fivopts
@@ -790,7 +798,7 @@ Enable link-time optimization.
; The initial value of -1 comes from Z_DEFAULT_COMPRESSION in zlib.h.
flto-compression-level=
-Common Joined UInteger Var(flag_lto_compression_level) Init(-1)
+Common Joined RejectNegative UInteger Var(flag_lto_compression_level) Init(-1)
-flto-compression-level=<number> Use zlib compression level <number> for IL
flto-report
@@ -876,6 +884,10 @@ foptimize-sibling-calls
Common Report Var(flag_optimize_sibling_calls) Optimization
Optimize sibling and tail recursive calls
+fpartial-inlining
+Common Report Var(flag_partial_inlining)
+Perform partial inlining
+
fpre-ipa-mem-report
Common Report Var(pre_ipa_mem_report)
Report on memory allocation before interprocedural optimization
@@ -893,7 +905,7 @@ Common RejectNegative Joined UInteger Optimization
-fpack-struct=<number> Set initial maximum structure member alignment
fpcc-struct-return
-Common Report Var(flag_pcc_struct_return,1) VarExists
+Common Report Var(flag_pcc_struct_return,1) Init(DEFAULT_PCC_STRUCT_RETURN)
Return small aggregates in memory, not registers
fpeel-loops
@@ -937,7 +949,7 @@ Common Report Var(flag_predictive_commoning) Optimization
Run predictive commoning optimization.
fprefetch-loop-arrays
-Common Report Var(flag_prefetch_loop_arrays) Optimization
+Common Report Var(flag_prefetch_loop_arrays) Init(-1) Optimization
Generate prefetch instructions, if available, for arrays in loops
fprofile
@@ -1152,7 +1164,7 @@ Common Report Var(flag_zee) Init(0)
Eliminate redundant zero extensions on targets that support implicit extensions.
fshow-column
-Common C ObjC C++ ObjC++ Report Var(flag_show_column) Init(1)
+Common Report Var(flag_show_column) Init(1)
Show column numbers in diagnostics, when available. Default on
fsignaling-nans
@@ -1334,7 +1346,7 @@ Common Report Var(flag_tree_loop_optimize) Init(1) Optimization
Enable loop optimizations on tree level
ftree-parallelize-loops=
-Common Report Joined UInteger Var(flag_tree_parallelize_loops) Init(1)
+Common Report Joined RejectNegative UInteger Var(flag_tree_parallelize_loops) Init(1)
Enable automatic parallelization of loops
ftree-phiprop
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 3b74b689a52..6dc074d8a88 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1750,6 +1750,7 @@ mips64*-*-linux* | mipsisa64*-*-linux*)
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65"
;;
esac
+ extra_parts="$extra_parts crtfastmath.o"
gnu_ld=yes
gas=yes
test x$with_llsc != x || with_llsc=yes
@@ -1764,6 +1765,7 @@ mips*-*-linux*) # Linux MIPS, either endian.
mipsisa32*)
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32"
esac
+ extra_parts="$extra_parts crtfastmath.o"
test x$with_llsc != x || with_llsc=yes
;;
mips*-*-openbsd*)
@@ -3284,7 +3286,7 @@ case "${target}" in
| 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
| 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \
| 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
- | a2 | e300c[23] | 854[08] | e500mc | e500mc64 \
+ | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | titan\
| 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
# OK
;;
diff --git a/gcc/config.in b/gcc/config.in
index b7884a386d1..35d406d1872 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1168,6 +1168,12 @@
#endif
+/* Define if your PowerPC64 linker supports a large TOC. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_LARGE_TOC
+#endif
+
+
/* Define if your PowerPC64 linker only needs function descriptor syms. */
#ifndef USED_FOR_TARGET
#undef HAVE_LD_NO_DOT_SYMS
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 4daf3df4d65..a67097a3c2c 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -1569,10 +1569,12 @@ alpha_preferred_reload_class(rtx x, enum reg_class rclass)
RCLASS requires an extra scratch or immediate register. Return the class
needed for the immediate register. */
-static enum reg_class
-alpha_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
+static reg_class_t
+alpha_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
enum machine_mode mode, secondary_reload_info *sri)
{
+ enum reg_class rclass = (enum reg_class) rclass_i;
+
/* Loading and storing HImode or QImode values to and from memory
usually requires a scratch register. */
if (!TARGET_BWX && (mode == QImode || mode == HImode || mode == CQImode))
@@ -4806,8 +4808,7 @@ struct GTY(()) machine_function
static struct machine_function *
alpha_init_machine_status (void)
{
- return ((struct machine_function *)
- ggc_alloc_cleared (sizeof (struct machine_function)));
+ return ggc_alloc_cleared_machine_function ();
}
/* Support for frame based VMS condition handlers. */
@@ -6024,7 +6025,7 @@ alpha_stdarg_optimize_hook (struct stdarg_info *si, const_gimple stmt)
rhs = gimple_assign_rhs1 (stmt);
while (handled_component_p (rhs))
rhs = TREE_OPERAND (rhs, 0);
- if (TREE_CODE (rhs) != INDIRECT_REF
+ if (TREE_CODE (rhs) != MEM_REF
|| TREE_CODE (TREE_OPERAND (rhs, 0)) != SSA_NAME)
return false;
@@ -9743,7 +9744,7 @@ alpha_file_start (void)
/* If emitting dwarf2 debug information, we cannot generate a .file
directive to start the file, as it will conflict with dwarf2out
file numbers. So it's only useful when emitting mdebug output. */
- targetm.file_start_file_directive = (write_symbols == DBX_DEBUG);
+ targetm.asm_file_start_file_directive = (write_symbols == DBX_DEBUG);
#endif
default_file_start ();
@@ -9901,10 +9902,13 @@ alpha_need_linkage (const char *name, int is_local)
struct alpha_funcs *cfaf;
if (!alpha_funcs_tree)
- alpha_funcs_tree = splay_tree_new_ggc ((splay_tree_compare_fn)
- splay_tree_compare_pointers);
+ alpha_funcs_tree = splay_tree_new_ggc
+ (splay_tree_compare_pointers,
+ ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_s,
+ ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_node_s);
+
- cfaf = (struct alpha_funcs *) ggc_alloc (sizeof (struct alpha_funcs));
+ cfaf = ggc_alloc_alpha_funcs ();
cfaf->links = 0;
cfaf->num = ++alpha_funcs_num;
@@ -9938,9 +9942,12 @@ alpha_need_linkage (const char *name, int is_local)
}
}
else
- alpha_links_tree = splay_tree_new_ggc ((splay_tree_compare_fn) strcmp);
+ alpha_links_tree = splay_tree_new_ggc
+ ((splay_tree_compare_fn) strcmp,
+ ggc_alloc_splay_tree_str_alpha_links_splay_tree_s,
+ ggc_alloc_splay_tree_str_alpha_links_splay_tree_node_s);
- al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links));
+ al = ggc_alloc_alpha_links ();
name = ggc_strdup (name);
/* Assume external if no definition. */
@@ -9996,7 +10003,10 @@ alpha_use_linkage (rtx func, tree cfundecl, int lflag, int rflag)
al = (struct alpha_links *) lnode->value;
}
else
- cfaf->links = splay_tree_new_ggc ((splay_tree_compare_fn) strcmp);
+ cfaf->links = splay_tree_new_ggc
+ ((splay_tree_compare_fn) strcmp,
+ ggc_alloc_splay_tree_str_alpha_links_splay_tree_s,
+ ggc_alloc_splay_tree_str_alpha_links_splay_tree_node_s);
if (!al)
{
@@ -10012,7 +10022,7 @@ alpha_use_linkage (rtx func, tree cfundecl, int lflag, int rflag)
name_len = strlen (name);
linksym = (char *) alloca (name_len + 50);
- al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links));
+ al = ggc_alloc_alpha_links ();
al->num = cfaf->num;
node = splay_tree_lookup (alpha_links_tree, (splay_tree_key) name);
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 6235d9ff90a..c8590b9c782 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -703,15 +703,6 @@ extern int alpha_memory_latency;
in a register. */
/* #define REG_PARM_STACK_SPACE */
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 5127a123e31..9a4e360504b 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -530,14 +530,6 @@ extern enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER];
increase the stack frame size by this amount. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-#define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
-
/* Define a data type for recording info about an argument list
during the scan of that argument list. This data type should
hold all necessary information about the function itself
diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c
index 4e2a9cbe51a..786a7a3587f 100644
--- a/gcc/config/arm/arm-c.c
+++ b/gcc/config/arm/arm-c.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "tree.h"
#include "output.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
/* Output C specific EABI object attributes. These can not be done in
diff --git a/gcc/config/arm/arm-cores.def b/gcc/config/arm/arm-cores.def
index a1a6960f5fd..9e949a2c334 100644
--- a/gcc/config/arm/arm-cores.def
+++ b/gcc/config/arm/arm-cores.def
@@ -123,6 +123,7 @@ ARM_CORE("cortex-a8", cortexa8, 7A, FL_LDSCHED, 9e)
ARM_CORE("cortex-a9", cortexa9, 7A, FL_LDSCHED, 9e)
ARM_CORE("cortex-r4", cortexr4, 7R, FL_LDSCHED, 9e)
ARM_CORE("cortex-r4f", cortexr4f, 7R, FL_LDSCHED, 9e)
+ARM_CORE("cortex-m4", cortexm4, 7EM, FL_LDSCHED, 9e)
ARM_CORE("cortex-m3", cortexm3, 7M, FL_LDSCHED, 9e)
ARM_CORE("cortex-m1", cortexm1, 6M, FL_LDSCHED, 9e)
ARM_CORE("cortex-m0", cortexm0, 6M, FL_LDSCHED, 9e)
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 2933201a1eb..61dcf07d8ef 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -136,8 +136,6 @@ extern const char *arithmetic_instr (rtx, int);
extern void output_ascii_pseudo_op (FILE *, const unsigned char *, int);
extern const char *output_return_instruction (rtx, int, int);
extern void arm_poke_function_name (FILE *, const char *);
-extern void arm_print_operand (FILE *, rtx, int);
-extern void arm_print_operand_address (FILE *, rtx);
extern void arm_final_prescan_insn (rtx);
extern int arm_debugger_arg_offset (int, rtx);
extern bool arm_is_long_call_p (tree);
diff --git a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md
index 7aef5f5fb78..4123043058b 100644
--- a/gcc/config/arm/arm-tune.md
+++ b/gcc/config/arm/arm-tune.md
@@ -1,5 +1,5 @@
;; -*- buffer-read-only: t -*-
;; Generated automatically by gentune.sh from arm-cores.def
(define_attr "tune"
- "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm3,cortexm1,cortexm0"
+ "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm4,cortexm3,cortexm1,cortexm0"
(const (symbol_ref "((enum attr_tune) arm_tune)")))
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 6c886dccaef..9cb272c323e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -45,7 +45,7 @@
#include "cgraph.h"
#include "ggc.h"
#include "except.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h" /* ??? */
#include "integrate.h"
#include "tm_p.h"
#include "target.h"
@@ -83,6 +83,9 @@ static int const_ok_for_op (HOST_WIDE_INT, enum rtx_code);
static rtx emit_sfm (int, int);
static unsigned arm_size_return_regs (void);
static bool arm_assemble_integer (rtx, unsigned int, int);
+static void arm_print_operand (FILE *, rtx, int);
+static void arm_print_operand_address (FILE *, rtx);
+static bool arm_print_operand_punct_valid_p (unsigned char code);
static const char *fp_const_from_val (REAL_VALUE_TYPE *);
static arm_cc get_arm_condition_code (rtx);
static HOST_WIDE_INT int_log2 (HOST_WIDE_INT);
@@ -285,6 +288,13 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_ASM_INTEGER
#define TARGET_ASM_INTEGER arm_assemble_integer
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND arm_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS arm_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P arm_print_operand_punct_valid_p
+
#undef TARGET_ASM_FUNCTION_PROLOGUE
#define TARGET_ASM_FUNCTION_PROLOGUE arm_output_function_prologue
@@ -424,8 +434,8 @@ static const struct attribute_spec arm_attribute_table[] =
#define TARGET_MUST_PASS_IN_STACK arm_must_pass_in_stack
#ifdef TARGET_UNWIND_INFO
-#undef TARGET_UNWIND_EMIT
-#define TARGET_UNWIND_EMIT arm_unwind_emit
+#undef TARGET_ASM_UNWIND_EMIT
+#define TARGET_ASM_UNWIND_EMIT arm_unwind_emit
/* EABI unwinding tables use a different format for the typeinfo tables. */
#undef TARGET_ASM_TTYPE
@@ -527,9 +537,6 @@ enum processor_type arm_tune = arm_none;
/* The current tuning set. */
const struct tune_params *current_tune;
-/* The default processor used if not overridden by commandline. */
-static enum processor_type arm_default_cpu = arm_none;
-
/* Which floating point hardware to schedule for. */
int arm_fpu_attr;
@@ -585,6 +592,10 @@ static int thumb_call_reg_needed;
#define FL_IWMMXT (1 << 29) /* XScale v2 or "Intel Wireless MMX technology". */
+/* Flags that only effect tuning, not available instructions. */
+#define FL_TUNE (FL_WBUF | FL_VFPV2 | FL_STRONG | FL_LDSCHED \
+ | FL_CO_PROC)
+
#define FL_FOR_ARCH2 FL_NOTM
#define FL_FOR_ARCH3 (FL_FOR_ARCH2 | FL_MODE32)
#define FL_FOR_ARCH3M (FL_FOR_ARCH3 | FL_ARCH3M)
@@ -687,9 +698,9 @@ int arm_arch_thumb2;
/* Nonzero if chip supports integer division instruction. */
int arm_arch_hwdiv;
-/* In case of a PRE_INC, POST_INC, PRE_DEC, POST_DEC memory reference, we
- must report the mode of the memory reference from PRINT_OPERAND to
- PRINT_OPERAND_ADDRESS. */
+/* In case of a PRE_INC, POST_INC, PRE_DEC, POST_DEC memory reference,
+ we must report the mode of the memory reference from
+ TARGET_PRINT_OPERAND to TARGET_PRINT_OPERAND_ADDRESS. */
enum machine_mode output_memory_reference_mode;
/* The register number to be used for the PIC offset register. */
@@ -770,7 +781,7 @@ static const struct processors all_cores[] =
{
/* ARM Cores */
#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \
- {NAME, arm_none, #ARCH, FLAGS | FL_FOR_ARCH##ARCH, &arm_##COSTS##_tune},
+ {NAME, IDENT, #ARCH, FLAGS | FL_FOR_ARCH##ARCH, &arm_##COSTS##_tune},
#include "arm-cores.def"
#undef ARM_CORE
{NULL, arm_none, NULL, 0, NULL}
@@ -805,36 +816,19 @@ static const struct processors all_architectures[] =
{"armv7-a", cortexa8, "7A", FL_CO_PROC | FL_FOR_ARCH7A, NULL},
{"armv7-r", cortexr4, "7R", FL_CO_PROC | FL_FOR_ARCH7R, NULL},
{"armv7-m", cortexm3, "7M", FL_CO_PROC | FL_FOR_ARCH7M, NULL},
- {"armv7e-m", cortexm3, "7EM", FL_CO_PROC | FL_FOR_ARCH7EM, NULL},
+ {"armv7e-m", cortexm4, "7EM", FL_CO_PROC | FL_FOR_ARCH7EM, NULL},
{"ep9312", ep9312, "4T", FL_LDSCHED | FL_CIRRUS | FL_FOR_ARCH4, NULL},
{"iwmmxt", iwmmxt, "5TE", FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT , NULL},
{"iwmmxt2", iwmmxt2, "5TE", FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT , NULL},
{NULL, arm_none, NULL, 0 , NULL}
};
-struct arm_cpu_select
-{
- const char * string;
- const char * name;
- const struct processors * processors;
-};
-
-/* This is a magic structure. The 'string' field is magically filled in
- with a pointer to the value specified by the user on the command line
- assuming that the user has specified such a value. */
-
-static struct arm_cpu_select arm_select[] =
-{
- /* string name processors */
- { NULL, "-mcpu=", all_cores },
- { NULL, "-march=", all_architectures },
- { NULL, "-mtune=", all_cores }
-};
-/* Defines representing the indexes into the above table. */
-#define ARM_OPT_SET_CPU 0
-#define ARM_OPT_SET_ARCH 1
-#define ARM_OPT_SET_TUNE 2
+/* These are populated as commandline arguments are processed, or NULL
+ if not specified. */
+static const struct processors *arm_selected_arch;
+static const struct processors *arm_selected_cpu;
+static const struct processors *arm_selected_tune;
/* The name of the preprocessor macro to define for this architecture. */
@@ -1196,6 +1190,24 @@ arm_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
}
+/* Lookup NAME in SEL. */
+
+static const struct processors *
+arm_find_cpu (const char *name, const struct processors *sel, const char *desc)
+{
+ if (!(name && *name))
+ return NULL;
+
+ for (; sel->name != NULL; sel++)
+ {
+ if (streq (name, sel->name))
+ return sel;
+ }
+
+ error ("bad value (%s) for %s switch", name, desc);
+ return NULL;
+}
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
@@ -1204,11 +1216,11 @@ arm_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED)
switch (code)
{
case OPT_march_:
- arm_select[1].string = arg;
+ arm_selected_arch = arm_find_cpu(arg, all_architectures, "-march");
return true;
case OPT_mcpu_:
- arm_select[0].string = arg;
+ arm_selected_cpu = arm_find_cpu(arg, all_cores, "-mcpu");
return true;
case OPT_mhard_float:
@@ -1220,7 +1232,7 @@ arm_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED)
return true;
case OPT_mtune_:
- arm_select[2].string = arg;
+ arm_selected_tune = arm_find_cpu(arg, all_cores, "-mtune");
return true;
default:
@@ -1320,88 +1332,52 @@ void
arm_override_options (void)
{
unsigned i;
- enum processor_type target_arch_cpu = arm_none;
- enum processor_type selected_cpu = arm_none;
- /* Set up the flags based on the cpu/architecture selected by the user. */
- for (i = ARRAY_SIZE (arm_select); i--;)
+ if (arm_selected_arch)
{
- struct arm_cpu_select * ptr = arm_select + i;
-
- if (ptr->string != NULL && ptr->string[0] != '\0')
- {
- const struct processors * sel;
-
- for (sel = ptr->processors; sel->name != NULL; sel++)
- if (streq (ptr->string, sel->name))
- {
- /* Set the architecture define. */
- if (i != ARM_OPT_SET_TUNE)
- sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
-
- /* Determine the processor core for which we should
- tune code-generation. */
- if (/* -mcpu= is a sensible default. */
- i == ARM_OPT_SET_CPU
- /* -mtune= overrides -mcpu= and -march=. */
- || i == ARM_OPT_SET_TUNE)
- arm_tune = (enum processor_type) (sel - ptr->processors);
-
- /* Remember the CPU associated with this architecture.
- If no other option is used to set the CPU type,
- we'll use this to guess the most suitable tuning
- options. */
- if (i == ARM_OPT_SET_ARCH)
- target_arch_cpu = sel->core;
-
- if (i == ARM_OPT_SET_CPU)
- selected_cpu = (enum processor_type) (sel - ptr->processors);
-
- if (i != ARM_OPT_SET_TUNE)
- {
- /* If we have been given an architecture and a processor
- make sure that they are compatible. We only generate
- a warning though, and we prefer the CPU over the
- architecture. */
- if (insn_flags != 0 && (insn_flags ^ sel->flags))
- warning (0, "switch -mcpu=%s conflicts with -march= switch",
- ptr->string);
-
- insn_flags = sel->flags;
- }
-
- break;
- }
-
- if (sel->name == NULL)
- error ("bad value (%s) for %s switch", ptr->string, ptr->name);
- }
+ if (arm_selected_cpu)
+ {
+ /* Check for conflict between mcpu and march. */
+ if ((arm_selected_cpu->flags ^ arm_selected_arch->flags) & ~FL_TUNE)
+ {
+ warning (0, "switch -mcpu=%s conflicts with -march=%s switch",
+ arm_selected_cpu->name, arm_selected_arch->name);
+ /* -march wins for code generation.
+ -mcpu wins for default tuning. */
+ if (!arm_selected_tune)
+ arm_selected_tune = arm_selected_cpu;
+
+ arm_selected_cpu = arm_selected_arch;
+ }
+ else
+ /* -mcpu wins. */
+ arm_selected_arch = NULL;
+ }
+ else
+ /* Pick a CPU based on the architecture. */
+ arm_selected_cpu = arm_selected_arch;
}
- /* Guess the tuning options from the architecture if necessary. */
- if (arm_tune == arm_none)
- arm_tune = target_arch_cpu;
-
/* If the user did not specify a processor, choose one for them. */
- if (insn_flags == 0)
+ if (!arm_selected_cpu)
{
const struct processors * sel;
unsigned int sought;
- selected_cpu = (enum processor_type) TARGET_CPU_DEFAULT;
- if (selected_cpu == arm_none)
+ arm_selected_cpu = &all_cores[TARGET_CPU_DEFAULT];
+ if (!arm_selected_cpu->name)
{
#ifdef SUBTARGET_CPU_DEFAULT
/* Use the subtarget default CPU if none was specified by
configure. */
- selected_cpu = (enum processor_type) SUBTARGET_CPU_DEFAULT;
+ arm_selected_cpu = &all_cores[SUBTARGET_CPU_DEFAULT];
#endif
/* Default to ARM6. */
- if (selected_cpu == arm_none)
- selected_cpu = arm6;
+ if (arm_selected_cpu->name)
+ arm_selected_cpu = &all_cores[arm6];
}
- sel = &all_cores[selected_cpu];
+ sel = arm_selected_cpu;
insn_flags = sel->flags;
/* Now check to see if the user has specified some command line
@@ -1462,20 +1438,21 @@ arm_override_options (void)
sel = best_fit;
}
- insn_flags = sel->flags;
+ arm_selected_cpu = sel;
}
- sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
- arm_default_cpu = (enum processor_type) (sel - all_cores);
- if (arm_tune == arm_none)
- arm_tune = arm_default_cpu;
}
- /* The processor for which we should tune should now have been
- chosen. */
- gcc_assert (arm_tune != arm_none);
+ gcc_assert (arm_selected_cpu);
+ /* The selected cpu may be an architecture, so lookup tuning by core ID. */
+ if (!arm_selected_tune)
+ arm_selected_tune = &all_cores[arm_selected_cpu->core];
- tune_flags = all_cores[(int)arm_tune].flags;
- current_tune = all_cores[(int)arm_tune].tune;
+ sprintf (arm_arch_name, "__ARM_ARCH_%s__", arm_selected_cpu->arch);
+ insn_flags = arm_selected_cpu->flags;
+
+ arm_tune = arm_selected_tune->core;
+ tune_flags = arm_selected_tune->flags;
+ current_tune = arm_selected_tune->tune;
if (target_fp16_format_name)
{
@@ -1858,7 +1835,7 @@ arm_override_options (void)
/* Enable -mfix-cortex-m3-ldrd by default for Cortex-M3 cores. */
if (fix_cm3_ldrd == 2)
{
- if (selected_cpu == cortexm3)
+ if (arm_selected_cpu->core == cortexm3)
fix_cm3_ldrd = 1;
else
fix_cm3_ldrd = 0;
@@ -3854,7 +3831,18 @@ static bool
use_vfp_abi (enum arm_pcs pcs_variant, bool is_double)
{
if (pcs_variant == ARM_PCS_AAPCS_VFP)
- return true;
+ {
+ static bool seen_thumb1_vfp = false;
+
+ if (TARGET_THUMB1 && !seen_thumb1_vfp)
+ {
+ sorry ("Thumb-1 hard-float VFP ABI");
+ /* sorry() is not immediately fatal, so only display this once. */
+ seen_thumb1_vfp = true;
+ }
+
+ return true;
+ }
if (pcs_variant != ARM_PCS_AAPCS_LOCAL)
return false;
@@ -6410,23 +6398,6 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
return true;
case MINUS:
- if (TARGET_THUMB2)
- {
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- {
- if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
- *total = COSTS_N_INSNS (1);
- else
- *total = COSTS_N_INSNS (20);
- }
- else
- *total = COSTS_N_INSNS (ARM_NUM_REGS (mode));
- /* Thumb2 does not have RSB, so all arguments must be
- registers (subtracting a constant is canonicalized as
- addition of the negated constant). */
- return false;
- }
-
if (mode == DImode)
{
*total = COSTS_N_INSNS (ARM_NUM_REGS (mode));
@@ -11471,6 +11442,60 @@ note_invalid_constants (rtx insn, HOST_WIDE_INT address, int do_pushes)
return result;
}
+/* Convert instructions to their cc-clobbering variant if possible, since
+ that allows us to use smaller encodings. */
+
+static void
+thumb2_reorg (void)
+{
+ basic_block bb;
+ regset_head live;
+
+ INIT_REG_SET (&live);
+
+ /* We are freeing block_for_insn in the toplev to keep compatibility
+ with old MDEP_REORGS that are not CFG based. Recompute it now. */
+ compute_bb_for_insn ();
+ df_analyze ();
+
+ FOR_EACH_BB (bb)
+ {
+ rtx insn;
+ COPY_REG_SET (&live, DF_LR_OUT (bb));
+ df_simulate_initialize_backwards (bb, &live);
+ FOR_BB_INSNS_REVERSE (bb, insn)
+ {
+ if (NONJUMP_INSN_P (insn)
+ && !REGNO_REG_SET_P (&live, CC_REGNUM))
+ {
+ rtx pat = PATTERN (insn);
+ if (GET_CODE (pat) == SET
+ && low_register_operand (XEXP (pat, 0), SImode)
+ && thumb_16bit_operator (XEXP (pat, 1), SImode)
+ && low_register_operand (XEXP (XEXP (pat, 1), 0), SImode)
+ && low_register_operand (XEXP (XEXP (pat, 1), 1), SImode))
+ {
+ rtx dst = XEXP (pat, 0);
+ rtx src = XEXP (pat, 1);
+ rtx op0 = XEXP (src, 0);
+ if (rtx_equal_p (dst, op0)
+ || GET_CODE (src) == PLUS || GET_CODE (src) == MINUS)
+ {
+ rtx ccreg = gen_rtx_REG (CCmode, CC_REGNUM);
+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, ccreg);
+ rtvec vec = gen_rtvec (2, pat, clobber);
+ PATTERN (insn) = gen_rtx_PARALLEL (VOIDmode, vec);
+ INSN_CODE (insn) = -1;
+ }
+ }
+ }
+ if (NONDEBUG_INSN_P (insn))
+ df_simulate_one_insn_backwards (bb, insn, &live);
+ }
+ }
+ CLEAR_REG_SET (&live);
+}
+
/* Gcc puts the pool in the wrong place for ARM, since we can only
load addresses a limited distance around the pc. We do some
special munging to move the constant pool values to the correct
@@ -11482,6 +11507,9 @@ arm_reorg (void)
HOST_WIDE_INT address = 0;
Mfix * fix;
+ if (TARGET_THUMB2)
+ thumb2_reorg ();
+
minipool_fix_head = minipool_fix_tail = NULL;
/* The first insn must always be a note, or the code below won't
@@ -15064,7 +15092,7 @@ arm_print_condition (FILE *stream)
before output.
If CODE is 'B' then output a bitwise inverted value of X (a const int).
If X is a REG and CODE is `M', output a ldm/stm style multi-reg. */
-void
+static void
arm_print_operand (FILE *stream, rtx x, int code)
{
switch (code)
@@ -15683,6 +15711,140 @@ arm_print_operand (FILE *stream, rtx x, int code)
}
}
+/* Target hook for printing a memory address. */
+static void
+arm_print_operand_address (FILE *stream, rtx x)
+{
+ if (TARGET_32BIT)
+ {
+ int is_minus = GET_CODE (x) == MINUS;
+
+ if (GET_CODE (x) == REG)
+ asm_fprintf (stream, "[%r, #0]", REGNO (x));
+ else if (GET_CODE (x) == PLUS || is_minus)
+ {
+ rtx base = XEXP (x, 0);
+ rtx index = XEXP (x, 1);
+ HOST_WIDE_INT offset = 0;
+ if (GET_CODE (base) != REG
+ || (GET_CODE (index) == REG && REGNO (index) == SP_REGNUM))
+ {
+ /* Ensure that BASE is a register. */
+ /* (one of them must be). */
+ /* Also ensure the SP is not used as in index register. */
+ rtx temp = base;
+ base = index;
+ index = temp;
+ }
+ switch (GET_CODE (index))
+ {
+ case CONST_INT:
+ offset = INTVAL (index);
+ if (is_minus)
+ offset = -offset;
+ asm_fprintf (stream, "[%r, #%wd]",
+ REGNO (base), offset);
+ break;
+
+ case REG:
+ asm_fprintf (stream, "[%r, %s%r]",
+ REGNO (base), is_minus ? "-" : "",
+ REGNO (index));
+ break;
+
+ case MULT:
+ case ASHIFTRT:
+ case LSHIFTRT:
+ case ASHIFT:
+ case ROTATERT:
+ {
+ asm_fprintf (stream, "[%r, %s%r",
+ REGNO (base), is_minus ? "-" : "",
+ REGNO (XEXP (index, 0)));
+ arm_print_operand (stream, index, 'S');
+ fputs ("]", stream);
+ break;
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+ else if (GET_CODE (x) == PRE_INC || GET_CODE (x) == POST_INC
+ || GET_CODE (x) == PRE_DEC || GET_CODE (x) == POST_DEC)
+ {
+ extern enum machine_mode output_memory_reference_mode;
+
+ gcc_assert (GET_CODE (XEXP (x, 0)) == REG);
+
+ if (GET_CODE (x) == PRE_DEC || GET_CODE (x) == PRE_INC)
+ asm_fprintf (stream, "[%r, #%s%d]!",
+ REGNO (XEXP (x, 0)),
+ GET_CODE (x) == PRE_DEC ? "-" : "",
+ GET_MODE_SIZE (output_memory_reference_mode));
+ else
+ asm_fprintf (stream, "[%r], #%s%d",
+ REGNO (XEXP (x, 0)),
+ GET_CODE (x) == POST_DEC ? "-" : "",
+ GET_MODE_SIZE (output_memory_reference_mode));
+ }
+ else if (GET_CODE (x) == PRE_MODIFY)
+ {
+ asm_fprintf (stream, "[%r, ", REGNO (XEXP (x, 0)));
+ if (GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)
+ asm_fprintf (stream, "#%wd]!",
+ INTVAL (XEXP (XEXP (x, 1), 1)));
+ else
+ asm_fprintf (stream, "%r]!",
+ REGNO (XEXP (XEXP (x, 1), 1)));
+ }
+ else if (GET_CODE (x) == POST_MODIFY)
+ {
+ asm_fprintf (stream, "[%r], ", REGNO (XEXP (x, 0)));
+ if (GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)
+ asm_fprintf (stream, "#%wd",
+ INTVAL (XEXP (XEXP (x, 1), 1)));
+ else
+ asm_fprintf (stream, "%r",
+ REGNO (XEXP (XEXP (x, 1), 1)));
+ }
+ else output_addr_const (stream, x);
+ }
+ else
+ {
+ if (GET_CODE (x) == REG)
+ asm_fprintf (stream, "[%r]", REGNO (x));
+ else if (GET_CODE (x) == POST_INC)
+ asm_fprintf (stream, "%r!", REGNO (XEXP (x, 0)));
+ else if (GET_CODE (x) == PLUS)
+ {
+ gcc_assert (GET_CODE (XEXP (x, 0)) == REG);
+ if (GET_CODE (XEXP (x, 1)) == CONST_INT)
+ asm_fprintf (stream, "[%r, #%wd]",
+ REGNO (XEXP (x, 0)),
+ INTVAL (XEXP (x, 1)));
+ else
+ asm_fprintf (stream, "[%r, %r]",
+ REGNO (XEXP (x, 0)),
+ REGNO (XEXP (x, 1)));
+ }
+ else
+ output_addr_const (stream, x);
+ }
+}
+
+/* Target hook for indicating whether a punctuation character for
+ TARGET_PRINT_OPERAND is valid. */
+static bool
+arm_print_operand_punct_valid_p (unsigned char code)
+{
+ return (code == '@' || code == '|' || code == '.'
+ || code == '(' || code == ')' || code == '#'
+ || (TARGET_32BIT && (code == '?'))
+ || (TARGET_THUMB2 && (code == '!'))
+ || (TARGET_THUMB && (code == '_')));
+}
+
/* Target hook for assembling integer objects. The ARM version needs to
handle word-sized values specially. */
static bool
@@ -19313,7 +19475,7 @@ static struct machine_function *
arm_init_machine_status (void)
{
struct machine_function *machine;
- machine = (machine_function *) ggc_alloc_cleared (sizeof (machine_function));
+ machine = ggc_alloc_cleared_machine_function ();
#if ARM_FT_UNKNOWN != 0
machine->func_type = ARM_FT_UNKNOWN;
@@ -20167,13 +20329,10 @@ arm_file_start (void)
if (TARGET_BPABI)
{
const char *fpu_name;
- if (arm_select[0].string)
- asm_fprintf (asm_out_file, "\t.cpu %s\n", arm_select[0].string);
- else if (arm_select[1].string)
- asm_fprintf (asm_out_file, "\t.arch %s\n", arm_select[1].string);
+ if (arm_selected_arch)
+ asm_fprintf (asm_out_file, "\t.arch %s\n", arm_selected_arch->name);
else
- asm_fprintf (asm_out_file, "\t.cpu %s\n",
- all_cores[arm_default_cpu].name);
+ asm_fprintf (asm_out_file, "\t.cpu %s\n", arm_selected_cpu->name);
if (TARGET_SOFT_FLOAT)
{
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index cf7089b7bc4..8a2d394725f 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1498,17 +1498,6 @@ do { \
/* Offset of first parameter from the argument pointer register value. */
#define FIRST_PARM_OFFSET(FNDECL) (TARGET_ARM ? 4 : 0)
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the ARM, the caller does not pop any of its arguments that were passed
- on the stack. */
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
-
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
#define LIBCALL_VALUE(MODE) \
@@ -2414,17 +2403,6 @@ extern int making_const_table;
else if (TARGET_THUMB1) \
thumb1_final_prescan_insn (INSN)
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- (CODE == '@' || CODE == '|' || CODE == '.' \
- || CODE == '(' || CODE == ')' || CODE == '#' \
- || (TARGET_32BIT && (CODE == '?')) \
- || (TARGET_THUMB2 && (CODE == '!')) \
- || (TARGET_THUMB && (CODE == '_')))
-
-/* Output an operand of an instruction. */
-#define PRINT_OPERAND(STREAM, X, CODE) \
- arm_print_operand (STREAM, X, CODE)
-
#define ARM_SIGN_EXTEND(x) ((HOST_WIDE_INT) \
(HOST_BITS_PER_WIDE_INT <= 32 ? (unsigned HOST_WIDE_INT) (x) \
: ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0xffffffff) |\
@@ -2433,131 +2411,6 @@ extern int making_const_table;
& ~ (unsigned HOST_WIDE_INT) 0xffffffff) \
: 0))))
-/* Output the address of an operand. */
-#define ARM_PRINT_OPERAND_ADDRESS(STREAM, X) \
-{ \
- int is_minus = GET_CODE (X) == MINUS; \
- \
- if (GET_CODE (X) == REG) \
- asm_fprintf (STREAM, "[%r, #0]", REGNO (X)); \
- else if (GET_CODE (X) == PLUS || is_minus) \
- { \
- rtx base = XEXP (X, 0); \
- rtx index = XEXP (X, 1); \
- HOST_WIDE_INT offset = 0; \
- if (GET_CODE (base) != REG \
- || (GET_CODE (index) == REG && REGNO (index) == SP_REGNUM)) \
- { \
- /* Ensure that BASE is a register. */ \
- /* (one of them must be). */ \
- /* Also ensure the SP is not used as in index register. */ \
- rtx temp = base; \
- base = index; \
- index = temp; \
- } \
- switch (GET_CODE (index)) \
- { \
- case CONST_INT: \
- offset = INTVAL (index); \
- if (is_minus) \
- offset = -offset; \
- asm_fprintf (STREAM, "[%r, #%wd]", \
- REGNO (base), offset); \
- break; \
- \
- case REG: \
- asm_fprintf (STREAM, "[%r, %s%r]", \
- REGNO (base), is_minus ? "-" : "", \
- REGNO (index)); \
- break; \
- \
- case MULT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- case ASHIFT: \
- case ROTATERT: \
- { \
- asm_fprintf (STREAM, "[%r, %s%r", \
- REGNO (base), is_minus ? "-" : "", \
- REGNO (XEXP (index, 0))); \
- arm_print_operand (STREAM, index, 'S'); \
- fputs ("]", STREAM); \
- break; \
- } \
- \
- default: \
- gcc_unreachable (); \
- } \
- } \
- else if (GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC \
- || GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC) \
- { \
- extern enum machine_mode output_memory_reference_mode; \
- \
- gcc_assert (GET_CODE (XEXP (X, 0)) == REG); \
- \
- if (GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
- asm_fprintf (STREAM, "[%r, #%s%d]!", \
- REGNO (XEXP (X, 0)), \
- GET_CODE (X) == PRE_DEC ? "-" : "", \
- GET_MODE_SIZE (output_memory_reference_mode)); \
- else \
- asm_fprintf (STREAM, "[%r], #%s%d", \
- REGNO (XEXP (X, 0)), \
- GET_CODE (X) == POST_DEC ? "-" : "", \
- GET_MODE_SIZE (output_memory_reference_mode)); \
- } \
- else if (GET_CODE (X) == PRE_MODIFY) \
- { \
- asm_fprintf (STREAM, "[%r, ", REGNO (XEXP (X, 0))); \
- if (GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT) \
- asm_fprintf (STREAM, "#%wd]!", \
- INTVAL (XEXP (XEXP (X, 1), 1))); \
- else \
- asm_fprintf (STREAM, "%r]!", \
- REGNO (XEXP (XEXP (X, 1), 1))); \
- } \
- else if (GET_CODE (X) == POST_MODIFY) \
- { \
- asm_fprintf (STREAM, "[%r], ", REGNO (XEXP (X, 0))); \
- if (GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT) \
- asm_fprintf (STREAM, "#%wd", \
- INTVAL (XEXP (XEXP (X, 1), 1))); \
- else \
- asm_fprintf (STREAM, "%r", \
- REGNO (XEXP (XEXP (X, 1), 1))); \
- } \
- else output_addr_const (STREAM, X); \
-}
-
-#define THUMB_PRINT_OPERAND_ADDRESS(STREAM, X) \
-{ \
- if (GET_CODE (X) == REG) \
- asm_fprintf (STREAM, "[%r]", REGNO (X)); \
- else if (GET_CODE (X) == POST_INC) \
- asm_fprintf (STREAM, "%r!", REGNO (XEXP (X, 0))); \
- else if (GET_CODE (X) == PLUS) \
- { \
- gcc_assert (GET_CODE (XEXP (X, 0)) == REG); \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
- asm_fprintf (STREAM, "[%r, #%wd]", \
- REGNO (XEXP (X, 0)), \
- INTVAL (XEXP (X, 1))); \
- else \
- asm_fprintf (STREAM, "[%r, %r]", \
- REGNO (XEXP (X, 0)), \
- REGNO (XEXP (X, 1))); \
- } \
- else \
- output_addr_const (STREAM, X); \
-}
-
-#define PRINT_OPERAND_ADDRESS(STREAM, X) \
- if (TARGET_32BIT) \
- ARM_PRINT_OPERAND_ADDRESS (STREAM, X) \
- else \
- THUMB_PRINT_OPERAND_ADDRESS (STREAM, X)
-
#define OUTPUT_ADDR_CONST_EXTRA(file, x, fail) \
if (arm_output_addr_const_extra (file, x) == FALSE) \
goto fail
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 628bd62ae62..725d505ab5c 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -737,14 +737,14 @@
[(set (reg:CC CC_REGNUM)
(compare:CC
(match_operand:SI 1 "s_register_operand" "r,r")
- (match_operand:SI 2 "arm_addimm_operand" "I,L")))
+ (match_operand:SI 2 "arm_addimm_operand" "L,I")))
(set (match_operand:SI 0 "s_register_operand" "=r,r")
(plus:SI (match_dup 1)
- (match_operand:SI 3 "arm_addimm_operand" "L,I")))]
+ (match_operand:SI 3 "arm_addimm_operand" "I,L")))]
"TARGET_32BIT && INTVAL (operands[2]) == -INTVAL (operands[3])"
"@
- sub%.\\t%0, %1, %2
- add%.\\t%0, %1, #%n2"
+ add%.\\t%0, %1, %3
+ sub%.\\t%0, %1, #%n3"
[(set_attr "conds" "set")]
)
@@ -1422,7 +1422,15 @@
(set_attr "predicable" "yes")]
)
-;; Unnamed template to match long long multiply-accumulate (smlal)
+(define_expand "maddsidi4"
+ [(set (match_operand:DI 0 "s_register_operand" "")
+ (plus:DI
+ (mult:DI
+ (sign_extend:DI (match_operand:SI 1 "s_register_operand" ""))
+ (sign_extend:DI (match_operand:SI 2 "s_register_operand" "")))
+ (match_operand:DI 3 "s_register_operand" "")))]
+ "TARGET_32BIT && arm_arch3m"
+ "")
(define_insn "*mulsidi3adddi"
[(set (match_operand:DI 0 "s_register_operand" "=&r")
@@ -1518,7 +1526,15 @@
(set_attr "predicable" "yes")]
)
-;; Unnamed template to match long long unsigned multiply-accumulate (umlal)
+(define_expand "umaddsidi4"
+ [(set (match_operand:DI 0 "s_register_operand" "")
+ (plus:DI
+ (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "s_register_operand" ""))
+ (zero_extend:DI (match_operand:SI 2 "s_register_operand" "")))
+ (match_operand:DI 3 "s_register_operand" "")))]
+ "TARGET_32BIT && arm_arch3m"
+ "")
(define_insn "*umulsidi3adddi"
[(set (match_operand:DI 0 "s_register_operand" "=&r")
@@ -1686,29 +1702,29 @@
(set_attr "predicable" "yes")]
)
-(define_insn "*mulhisi3addsi"
+(define_insn "maddhisi4"
[(set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_operand:SI 1 "s_register_operand" "r")
+ (plus:SI (match_operand:SI 3 "s_register_operand" "r")
(mult:SI (sign_extend:SI
- (match_operand:HI 2 "s_register_operand" "%r"))
+ (match_operand:HI 1 "s_register_operand" "%r"))
(sign_extend:SI
- (match_operand:HI 3 "s_register_operand" "r")))))]
+ (match_operand:HI 2 "s_register_operand" "r")))))]
"TARGET_DSP_MULTIPLY"
- "smlabb%?\\t%0, %2, %3, %1"
+ "smlabb%?\\t%0, %1, %2, %3"
[(set_attr "insn" "smlaxy")
(set_attr "predicable" "yes")]
)
-(define_insn "*mulhidi3adddi"
+(define_insn "*maddhidi4"
[(set (match_operand:DI 0 "s_register_operand" "=r")
(plus:DI
- (match_operand:DI 1 "s_register_operand" "0")
+ (match_operand:DI 3 "s_register_operand" "0")
(mult:DI (sign_extend:DI
- (match_operand:HI 2 "s_register_operand" "%r"))
+ (match_operand:HI 1 "s_register_operand" "%r"))
(sign_extend:DI
- (match_operand:HI 3 "s_register_operand" "r")))))]
+ (match_operand:HI 2 "s_register_operand" "r")))))]
"TARGET_DSP_MULTIPLY"
- "smlalbb%?\\t%Q0, %R0, %2, %3"
+ "smlalbb%?\\t%Q0, %R0, %1, %2"
[(set_attr "insn" "smlalxy")
(set_attr "predicable" "yes")])
diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md
index 575d0ac4e9a..6d6c77d4b66 100644
--- a/gcc/config/arm/constraints.md
+++ b/gcc/config/arm/constraints.md
@@ -31,7 +31,7 @@
;; The following multi-letter normal constraints have been used:
;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv, Dy
;; in Thumb-1 state: Pa, Pb
-;; in Thumb-2 state: Ps, Pt, Pu, Pv
+;; in Thumb-2 state: Ps, Pt, Pu, Pv, Pw, Px
;; The following memory constraints have been used:
;; in ARM/Thumb-2 state: Q, Ut, Uv, Uy, Un, Um, Us
@@ -168,6 +168,16 @@
(and (match_code "const_int")
(match_test "TARGET_THUMB2 && ival >= -255 && ival <= 0")))
+(define_constraint "Pw"
+ "@internal In Thumb-2 state a constant in the range -255 to -1"
+ (and (match_code "const_int")
+ (match_test "TARGET_THUMB2 && ival >= -255 && ival <= -1")))
+
+(define_constraint "Px"
+ "@internal In Thumb-2 state a constant in the range -7 to -1"
+ (and (match_code "const_int")
+ (match_test "TARGET_THUMB2 && ival >= -7 && ival <= -1")))
+
(define_constraint "G"
"In ARM/Thumb-2 state a valid FPA immediate constant."
(and (match_code "const_double")
diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
index fa325b171e3..398518329e2 100644
--- a/gcc/config/arm/thumb2.md
+++ b/gcc/config/arm/thumb2.md
@@ -319,8 +319,8 @@
"
[(set_attr "length" "8,12,16,8,8")
(set_attr "type" "*,*,*,load2,store2")
- (set_attr "pool_range" "1020")
- (set_attr "neg_pool_range" "0")]
+ (set_attr "pool_range" "*,*,*,1020,*")
+ (set_attr "neg_pool_range" "*,*,*,0,*")]
)
(define_insn "*thumb2_cmpsi_shiftsi"
@@ -1082,29 +1082,6 @@
}"
)
-;; Peepholes and insns for 16-bit flag clobbering instructions.
-;; The conditional forms of these instructions do not clobber CC.
-;; However by the time peepholes are run it is probably too late to do
-;; anything useful with this information.
-(define_peephole2
- [(set (match_operand:SI 0 "low_register_operand" "")
- (match_operator:SI 3 "thumb_16bit_operator"
- [(match_operand:SI 1 "low_register_operand" "")
- (match_operand:SI 2 "low_register_operand" "")]))]
- "TARGET_THUMB2
- && (rtx_equal_p(operands[0], operands[1])
- || GET_CODE(operands[3]) == PLUS
- || GET_CODE(operands[3]) == MINUS)
- && peep2_regno_dead_p(0, CC_REGNUM)"
- [(parallel
- [(set (match_dup 0)
- (match_op_dup 3
- [(match_dup 1)
- (match_dup 2)]))
- (clobber (reg:CC CC_REGNUM))])]
- ""
-)
-
(define_insn "*thumb2_alusi3_short"
[(set (match_operand:SI 0 "s_register_operand" "=l")
(match_operator:SI 3 "thumb_16bit_operator"
@@ -1254,6 +1231,32 @@
(set_attr "length" "2")]
)
+(define_peephole2
+ [(set (match_operand:CC 0 "cc_register" "")
+ (compare:CC (match_operand:SI 1 "low_register_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")))]
+ "TARGET_THUMB2
+ && peep2_reg_dead_p (1, operands[1])
+ && satisfies_constraint_Pw (operands[2])"
+ [(parallel
+ [(set (match_dup 0) (compare:CC (match_dup 1) (match_dup 2)))
+ (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 3)))])]
+ "operands[3] = GEN_INT (- INTVAL (operands[2]));"
+)
+
+(define_peephole2
+ [(match_scratch:SI 3 "l")
+ (set (match_operand:CC 0 "cc_register" "")
+ (compare:CC (match_operand:SI 1 "low_register_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")))]
+ "TARGET_THUMB2
+ && satisfies_constraint_Px (operands[2])"
+ [(parallel
+ [(set (match_dup 0) (compare:CC (match_dup 1) (match_dup 2)))
+ (set (match_dup 3) (plus:SI (match_dup 1) (match_dup 4)))])]
+ "operands[4] = GEN_INT (- INTVAL (operands[2]));"
+)
+
(define_insn "*thumb2_addsi3_compare0"
[(set (reg:CC_NOOV CC_REGNUM)
(compare:CC_NOOV
@@ -1506,88 +1509,31 @@
(set_attr "predicable" "yes")]
)
-(define_insn "*thumb2_tlobits_cbranch"
- [(set (pc)
- (if_then_else
- (match_operator 0 "equality_operator"
- [(zero_extract:SI (match_operand:SI 1 "s_register_operand" "l,h,h")
- (match_operand:SI 2 "const_int_operand" "i,Pu,i")
- (const_int 0))
- (const_int 0)])
- (label_ref (match_operand 3 "" ""))
- (pc)))
- (clobber (match_scratch:SI 4 "=l,X,r"))
- (clobber (reg:CC CC_REGNUM))]
- "TARGET_THUMB2"
- "*
- {
- if (which_alternative == 0)
- {
- rtx op[3];
- op[0] = operands[4];
- op[1] = operands[1];
- op[2] = GEN_INT (32 - INTVAL (operands[2]));
-
- output_asm_insn (\"lsls\\t%0, %1, %2\", op);
- switch (get_attr_length (insn))
- {
- case 4: return \"b%d0\\t%l3\";
- case 6: return \"b%D0\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
- default: return \"b%D0\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
- }
- }
- else
- {
- rtx op[3];
-
- if (which_alternative == 1)
- {
- op[0] = operands[1];
- op[1] = GEN_INT ((1 << INTVAL (operands[2])) - 1);
- output_asm_insn (\"tst\\t%0, %1\", op);
- }
- else
- {
- op[0] = operands[4];
- op[1] = operands[1];
- op[2] = GEN_INT (32 - INTVAL (operands[2]));
- output_asm_insn (\"lsls\\t%0, %1, %2\", op);
- }
+(define_peephole2
+ [(set (match_operand:CC_NOOV 0 "cc_register" "")
+ (compare:CC_NOOV (zero_extract:SI
+ (match_operand:SI 1 "low_register_operand" "")
+ (const_int 1)
+ (match_operand:SI 2 "const_int_operand" ""))
+ (const_int 0)))
+ (match_scratch:SI 3 "l")
+ (set (pc)
+ (if_then_else (match_operator:CC_NOOV 4 "equality_operator"
+ [(match_dup 0) (const_int 0)])
+ (match_operand 5 "" "")
+ (match_operand 6 "" "")))]
+ "TARGET_THUMB2
+ && (INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32)"
+ [(parallel [(set (match_dup 0)
+ (compare:CC_NOOV (ashift:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))
+ (clobber (match_dup 3))])
+ (set (pc)
+ (if_then_else (match_op_dup 4 [(match_dup 0) (const_int 0)])
+ (match_dup 5) (match_dup 6)))]
+ "
+ operands[2] = GEN_INT (31 - INTVAL (operands[2]));
+ operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? LT : GE,
+ VOIDmode, operands[0], const0_rtx);
+ ")
- switch (get_attr_length (insn))
- {
- case 6: return \"b%d0\\t%l3\";
- case 8: return \"b%D0\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
- default: return \"b%D0\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
- }
- }
- }"
- [(set (attr "far_jump")
- (if_then_else
- (and (ge (minus (match_dup 3) (pc)) (const_int -2040))
- (le (minus (match_dup 3) (pc)) (const_int 2048)))
- (const_string "no")
- (const_string "yes")))
- (set (attr "length")
- (if_then_else
- (eq (symbol_ref ("which_alternative"))
- (const_int 0))
- (if_then_else
- (and (ge (minus (match_dup 3) (pc)) (const_int -250))
- (le (minus (match_dup 3) (pc)) (const_int 256)))
- (const_int 4)
- (if_then_else
- (and (ge (minus (match_dup 3) (pc)) (const_int -2040))
- (le (minus (match_dup 3) (pc)) (const_int 2048)))
- (const_int 6)
- (const_int 8)))
- (if_then_else
- (and (ge (minus (match_dup 3) (pc)) (const_int -250))
- (le (minus (match_dup 3) (pc)) (const_int 256)))
- (const_int 6)
- (if_then_else
- (and (ge (minus (match_dup 3) (pc)) (const_int -2040))
- (le (minus (match_dup 3) (pc)) (const_int 2048)))
- (const_int 8)
- (const_int 10)))))]
-)
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
index c2c1dd5d4c3..22724c1de63 100644
--- a/gcc/config/avr/avr-c.c
+++ b/gcc/config/avr/avr-c.c
@@ -26,7 +26,7 @@
#include "tm_p.h"
#include "cpplib.h"
#include "tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
/* Not included in avr.c since this requires C front end. */
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index d8942c5c081..531a4128bf3 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -243,8 +243,7 @@ static const enum reg_class reg_class_tab[]={
static struct machine_function *
avr_init_machine_status (void)
{
- return ((struct machine_function *)
- ggc_alloc_cleared (sizeof (struct machine_function)));
+ return ggc_alloc_cleared_machine_function ();
}
/* Return register class for register R. */
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 398b412dd91..32ff27eedf4 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -376,8 +376,6 @@ enum reg_class {
for POST_DEC targets (PR27386). */
/*#define PUSH_ROUNDING(NPUSHED) (NPUSHED)*/
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (function_arg (&(CUM), MODE, TYPE, NAMED))
typedef struct avr_args {
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 152e910ee67..1232ecc7378 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -2458,8 +2458,8 @@ bfin_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
RCLASS requires an extra scratch register. Return the class needed for the
scratch register. */
-static enum reg_class
-bfin_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
+static reg_class_t
+bfin_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
enum machine_mode mode, secondary_reload_info *sri)
{
/* If we have HImode or QImode, we can only use DREGS as secondary registers;
@@ -2467,6 +2467,7 @@ bfin_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
enum reg_class default_class = GET_MODE_SIZE (mode) >= 4 ? DPREGS : DREGS;
enum reg_class x_class = NO_REGS;
enum rtx_code code = GET_CODE (x);
+ enum reg_class rclass = (enum reg_class) rclass_i;
if (code == SUBREG)
x = SUBREG_REG (x), code = GET_CODE (x);
@@ -2634,11 +2635,7 @@ bfin_handle_option (size_t code, const char *arg, int value)
static struct machine_function *
bfin_init_machine_status (void)
{
- struct machine_function *f;
-
- f = GGC_CNEW (struct machine_function);
-
- return f;
+ return ggc_alloc_cleared_machine_function ();
}
/* Implement the macro OVERRIDE_OPTIONS. */
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index a1bd556003e..367cd96dbc8 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -871,8 +871,6 @@ typedef struct {
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
(function_arg_advance (&CUM, MODE, TYPE, NAMED))
-#define RETURN_POPS_ARGS(FDECL, FUNTYPE, STKSIZE) 0
-
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
diff --git a/gcc/config/cris/cris-protos.h b/gcc/config/cris/cris-protos.h
index 721c90ff887..c819c790d19 100644
--- a/gcc/config/cris/cris-protos.h
+++ b/gcc/config/cris/cris-protos.h
@@ -33,8 +33,6 @@ extern void cris_notice_update_cc (rtx, rtx);
extern bool cris_reload_address_legitimized (rtx, enum machine_mode, int, int, int);
extern int cris_register_move_cost (enum machine_mode, enum reg_class,
enum reg_class);
-extern void cris_print_operand (FILE *, rtx, int);
-extern void cris_print_operand_address (FILE *, rtx);
extern int cris_side_effect_mode_ok (enum rtx_code, rtx *, int, int,
int, int, int);
extern bool cris_cc0_user_requires_cmp (rtx);
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 62ee7d0c330..05736c76165 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -108,6 +108,12 @@ static void cris_operand_lossage (const char *, rtx);
static int cris_reg_saved_in_regsave_area (unsigned int, bool);
+static void cris_print_operand (FILE *, rtx, int);
+
+static void cris_print_operand_address (FILE *, rtx);
+
+static bool cris_print_operand_punct_valid_p (unsigned char code);
+
static void cris_asm_output_mi_thunk
(FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree);
@@ -158,6 +164,13 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
#undef TARGET_ASM_UNALIGNED_DI_OP
#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND cris_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS cris_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P cris_print_operand_punct_valid_p
+
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK cris_asm_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
@@ -687,7 +700,7 @@ saved_regs_mentioned (rtx x)
/* The PRINT_OPERAND worker. */
-void
+static void
cris_print_operand (FILE *file, rtx x, int code)
{
rtx operand = x;
@@ -1114,9 +1127,15 @@ cris_print_operand (FILE *file, rtx x, int code)
}
}
+static bool
+cris_print_operand_punct_valid_p (unsigned char code)
+{
+ return (code == '#' || code == '!' || code == ':');
+}
+
/* The PRINT_OPERAND_ADDRESS worker. */
-void
+static void
cris_print_operand_address (FILE *file, rtx x)
{
/* All these were inside MEM:s so output indirection characters. */
@@ -2552,8 +2571,8 @@ cris_file_start (void)
{
/* These expressions can vary at run time, so we cannot put
them into TARGET_INITIALIZER. */
- targetm.file_start_app_off = !(TARGET_PDEBUG || flag_print_asm_name);
- targetm.file_start_file_directive = TARGET_ELF;
+ targetm.asm_file_start_app_off = !(TARGET_PDEBUG || flag_print_asm_name);
+ targetm.asm_file_start_file_directive = TARGET_ELF;
default_file_start ();
}
@@ -2583,7 +2602,7 @@ cris_init_expanders (void)
static struct machine_function *
cris_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
/* Split a 2 word move (DI or presumably DF) into component parts.
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index 3c426b74ae5..4c685489a8c 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -859,8 +859,6 @@ enum reg_class
#define ACCUMULATE_OUTGOING_ARGS 1
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0
-
/* Node: Register Arguments */
@@ -1253,16 +1251,6 @@ enum cris_pic_symbol_type
#define ADDITIONAL_REGISTER_NAMES \
{{"r14", 14}, {"r15", 15}, {"pc", 15}}
-#define PRINT_OPERAND(FILE, X, CODE) \
- cris_print_operand (FILE, X, CODE)
-
-/* For delay-slot handling. */
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '#' || (CODE) == '!' || (CODE) == ':')
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- cris_print_operand_address (FILE, ADDR)
-
/* Output an empty line to illustrate the presence of the delay slot. */
#define DBR_OUTPUT_SEQEND(FILE) \
fprintf (FILE, "\n")
diff --git a/gcc/config/crx/crx.h b/gcc/config/crx/crx.h
index 1d5cb87af3e..a6260f48aa2 100644
--- a/gcc/config/crx/crx.h
+++ b/gcc/config/crx/crx.h
@@ -313,8 +313,6 @@ enum reg_class
#define PUSH_ROUNDING(BYTES) (((BYTES) + 3) & ~3)
-#define RETURN_POPS_ARGS(FNDECL, FUNTYPE, SIZE) 0
-
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
((rtx) crx_function_arg(&(CUM), (MODE), (TYPE), (NAMED)))
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 0e2f8067b4b..6221ab3be1b 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -25,9 +25,9 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "cpplib.h"
#include "tree.h"
-#include "c-pragma.h"
#include "incpath.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
#include "toplev.h"
#include "flags.h"
#include "tm_p.h"
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 0997e0a9f03..f66e5a0c21d 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -107,8 +107,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p)
if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion,
&osversion_len, NULL, 0) == -1)
{
- warning (0, "sysctl for kern.osversion failed: %s",
- xstrerror (errno));
+ warning (0, "sysctl for kern.osversion failed: %m");
return;
}
@@ -151,7 +150,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p)
return;
parse_failed:
- warning (0, "couldn't understand kern.osversion `%.*s'",
+ warning (0, "couldn't understand kern.osversion %q.*s",
(int) osversion_len, osversion);
return;
}
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 5886f0158a6..115349a64cb 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -87,6 +87,8 @@ extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *,
const char *);
extern void darwin_asm_output_dwarf_offset (FILE *, int, const char *,
section *);
+extern void darwin_asm_declare_constant_name (FILE *, const char *,
+ const_tree, HOST_WIDE_INT);
extern bool darwin_binds_local_p (const_tree);
extern void darwin_cpp_builtins (struct cpp_reader *);
extern void darwin_asm_output_anchor (rtx symbol);
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 9a9dde160c5..5801e431dfd 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -429,7 +429,7 @@ machopic_indirection_name (rtx sym_ref, bool stub_p)
}
else
{
- p = (machopic_indirection *) ggc_alloc (sizeof (machopic_indirection));
+ p = ggc_alloc_machopic_indirection ();
p->symbol = sym_ref;
p->ptr_name = xstrdup (buffer);
p->stub_p = stub_p;
@@ -966,7 +966,7 @@ machopic_output_indirection (void **slot, void *data)
{
switch_to_section (data_section);
assemble_align (GET_MODE_ALIGNMENT (Pmode));
- assemble_label (ptr_name);
+ assemble_label (asm_out_file, ptr_name);
assemble_integer (gen_rtx_SYMBOL_REF (Pmode, sym_name),
GET_MODE_SIZE (Pmode),
GET_MODE_ALIGNMENT (Pmode), 1);
@@ -1617,6 +1617,20 @@ darwin_non_lazy_pcrel (FILE *file, rtx addr)
fputs ("-.", file);
}
+/* The implementation of ASM_DECLARE_CONSTANT_NAME. */
+
+void
+darwin_asm_declare_constant_name (FILE *file, const char *name,
+ const_tree exp ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT size)
+{
+ assemble_label (file, name);
+
+ /* Darwin doesn't support zero-size objects, so give them a byte. */
+ if ((size) == 0)
+ assemble_zeros (1);
+}
+
/* Emit an assembler directive to set visibility for a symbol. The
only supported visibilities are VISIBILITY_DEFAULT and
VISIBILITY_HIDDEN; the latter corresponds to Darwin's "private
@@ -1850,7 +1864,7 @@ darwin_override_options (void)
/* Disable -freorder-blocks-and-partition for darwin_emit_unwind_label. */
if (flag_reorder_blocks_and_partition
- && (targetm.asm_out.unwind_label == darwin_emit_unwind_label))
+ && (targetm.asm_out.emit_unwind_label == darwin_emit_unwind_label))
{
inform (input_location,
"-freorder-blocks-and-partition does not work with exceptions "
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 149ef4a6972..a1e805c6d5b 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -652,14 +652,8 @@ extern GTY(()) int darwin_ms_struct;
ASM_OUTPUT_LABEL (FILE, xname); \
} while (0)
-#define ASM_DECLARE_CONSTANT_NAME(FILE, NAME, EXP, SIZE) \
- do { \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- /* Darwin doesn't support zero-size objects, so give them a \
- byte. */ \
- if ((SIZE) == 0) \
- assemble_zeros (1); \
- } while (0)
+#undef TARGET_ASM_DECLARE_CONSTANT_NAME
+#define TARGET_ASM_DECLARE_CONSTANT_NAME darwin_asm_declare_constant_name
/* Wrap new method names in quotes so the assembler doesn't gag.
Make Objective-C internal symbols local and in doing this, we need
diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h
index 5e6237895b5..ed675b16e6a 100644
--- a/gcc/config/fr30/fr30.h
+++ b/gcc/config/fr30/fr30.h
@@ -568,41 +568,6 @@ enum reg_class
proper. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* A C expression that should indicate the number of bytes of its own arguments
- that a function pops on returning, or 0 if the function pops no arguments
- and the caller must therefore pop them all after the function returns.
-
- FUNDECL is a C variable whose value is a tree node that describes the
- function in question. Normally it is a node of type `FUNCTION_DECL' that
- describes the declaration of the function. From this it is possible to
- obtain the DECL_ATTRIBUTES of the function.
-
- FUNTYPE is a C variable whose value is a tree node that describes the
- function in question. Normally it is a node of type `FUNCTION_TYPE' that
- describes the data type of the function. From this it is possible to obtain
- the data types of the value and arguments (if known).
-
- When a call to a library function is being considered, FUNTYPE will contain
- an identifier node for the library function. Thus, if you need to
- distinguish among various library functions, you can do so by their names.
- Note that "library function" in this context means a function used to
- perform arithmetic, whose name is known specially in the compiler and was
- not mentioned in the C code being compiled.
-
- STACK-SIZE is the number of bytes of arguments passed on the stack. If a
- variable number of bytes is passed, it is zero, and argument popping will
- always be the responsibility of the calling function.
-
- On the VAX, all functions always pop their arguments, so the definition of
- this macro is STACK-SIZE. On the 68000, using the standard calling
- convention, no functions pop their arguments, so the value of the macro is
- always 0 in this case. But an alternative calling convention is available
- in which functions that take a fixed number of arguments pop them but other
- functions (such as `printf') pop nothing (the caller pops all). When this
- convention is in use, FUNTYPE is examined to determine whether a function
- takes a fixed number of arguments. */
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
/*}}}*/
/*{{{ Function Arguments in Registers. */
diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index 3c9950d740b..11612e49825 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -73,8 +73,6 @@ extern rtx frv_index_memory (rtx, enum machine_mode, int);
extern const char *frv_asm_output_opcode
(FILE *, const char *);
extern void frv_final_prescan_insn (rtx, rtx *, int);
-extern void frv_print_operand (FILE *, rtx, int);
-extern void frv_print_operand_address (FILE *, rtx);
extern void frv_emit_move (enum machine_mode, rtx, rtx);
extern int frv_emit_movsi (rtx, rtx);
extern const char *output_move_single (rtx *, rtx);
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index d4009693cd8..9454bd25e7b 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -1,5 +1,5 @@
/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009 Free Software Foundation, Inc.
+ 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GCC.
@@ -267,6 +267,9 @@ static bool frv_legitimate_address_p (enum machine_mode, rtx, bool);
static int frv_default_flags_for_cpu (void);
static int frv_string_begins_with (const_tree, const char *);
static FRV_INLINE bool frv_small_data_reloc_p (rtx, int);
+static void frv_print_operand (FILE *, rtx, int);
+static void frv_print_operand_address (FILE *, rtx);
+static bool frv_print_operand_punct_valid_p (unsigned char code);
static void frv_print_operand_memory_reference_reg
(FILE *, rtx);
static void frv_print_operand_memory_reference (FILE *, rtx, int);
@@ -381,7 +384,7 @@ static int frv_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static void frv_output_dwarf_dtprel (FILE *, int, rtx)
ATTRIBUTE_UNUSED;
-static bool frv_secondary_reload (bool, rtx, enum reg_class,
+static reg_class_t frv_secondary_reload (bool, rtx, reg_class_t,
enum machine_mode,
secondary_reload_info *);
static bool frv_frame_pointer_required (void);
@@ -396,6 +399,12 @@ static void frv_trampoline_init (rtx, tree, rtx);
#endif
/* Initialize the GCC target structure. */
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND frv_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS frv_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P frv_print_operand_punct_valid_p
#undef TARGET_ASM_FUNCTION_PROLOGUE
#define TARGET_ASM_FUNCTION_PROLOGUE frv_function_prologue
#undef TARGET_ASM_FUNCTION_EPILOGUE
@@ -2562,7 +2571,7 @@ frv_index_memory (rtx memref, enum machine_mode mode, int index)
/* Print a memory address as an operand to reference that memory location. */
-void
+static void
frv_print_operand_address (FILE * stream, rtx x)
{
if (GET_CODE (x) == MEM)
@@ -2795,9 +2804,9 @@ comparison_string (enum rtx_code code, rtx op0)
/* Print an operand to an assembler instruction.
`%' followed by a letter and a digit says to output an operand in an
- alternate fashion. Four letters have standard, built-in meanings described
- below. The machine description macro `PRINT_OPERAND' can define additional
- letters with nonstandard meanings.
+ alternate fashion. Four letters have standard, built-in meanings
+ described below. The hook `TARGET_PRINT_OPERAND' can define
+ additional letters with nonstandard meanings.
`%cDIGIT' can be used to substitute an operand that is a constant value
without the syntax that normally indicates an immediate operand.
@@ -2818,13 +2827,14 @@ comparison_string (enum rtx_code code, rtx op0)
than once in a single template that generates multiple assembler
instructions.
- `%' followed by a punctuation character specifies a substitution that does
- not use an operand. Only one case is standard: `%%' outputs a `%' into the
- assembler code. Other nonstandard cases can be defined in the
- `PRINT_OPERAND' macro. You must also define which punctuation characters
- are valid with the `PRINT_OPERAND_PUNCT_VALID_P' macro. */
+ `%' followed by a punctuation character specifies a substitution that
+ does not use an operand. Only one case is standard: `%%' outputs a
+ `%' into the assembler code. Other nonstandard cases can be defined
+ in the `TARGET_PRINT_OPERAND' hook. You must also define which
+ punctuation characters are valid with the
+ `TARGET_PRINT_OPERAND_PUNCT_VALID_P' hook. */
-void
+static void
frv_print_operand (FILE * file, rtx x, int code)
{
struct frv_unspec unspec;
@@ -3115,6 +3125,13 @@ frv_print_operand (FILE * file, rtx x, int code)
return;
}
+static bool
+frv_print_operand_punct_valid_p (unsigned char code)
+{
+ return (code == '.' || code == '#' || code == '@' || code == '~'
+ || code == '*' || code == '&');
+}
+
/* A C statement (sans semicolon) for initializing the variable CUM for the
state at the beginning of the argument list. The variable has type
@@ -3374,11 +3391,11 @@ frv_regno_ok_for_base_p (int regno, int strict_p)
legitimate addresses. Normally you would simply recognize any `const' as
legitimate.
- Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that
- are not marked with `const'. It assumes that a naked `plus' indicates
- indexing. If so, then you *must* reject such naked constant sums as
- illegitimate addresses, so that none of them will be given to
- `PRINT_OPERAND_ADDRESS'. */
+ Usually `TARGET_PRINT_OPERAND_ADDRESS' is not prepared to handle
+ constant sums that are not marked with `const'. It assumes that a
+ naked `plus' indicates indexing. If so, then you *must* reject such
+ naked constant sums as illegitimate addresses, so that none of them
+ will be given to `TARGET_PRINT_OPERAND_ADDRESS'. */
int
frv_legitimate_address_p_1 (enum machine_mode mode,
@@ -6475,12 +6492,13 @@ frv_secondary_reload_class (enum reg_class rclass,
called from init_reg_autoinc() in regclass.c - before the reload optabs
have been initialised. */
-static bool
-frv_secondary_reload (bool in_p, rtx x, enum reg_class reload_class,
+static reg_class_t
+frv_secondary_reload (bool in_p, rtx x, reg_class_t reload_class_i,
enum machine_mode reload_mode,
secondary_reload_info * sri)
{
enum reg_class rclass = NO_REGS;
+ enum reg_class reload_class = (enum reg_class) reload_class_i;
if (sri->prev_sri && sri->prev_sri->t_icode != CODE_FOR_nothing)
{
@@ -7054,7 +7072,7 @@ frv_assemble_integer (rtx value, unsigned int size, int aligned_p)
static struct machine_function *
frv_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
/* Implement TARGET_SCHED_ISSUE_RATE. */
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index d5a7a4a6670..56db4e4a21e 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -1614,41 +1614,6 @@ typedef struct frv_stack {
proper. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* A C expression that should indicate the number of bytes of its own arguments
- that a function pops on returning, or 0 if the function pops no arguments
- and the caller must therefore pop them all after the function returns.
-
- FUNDECL is a C variable whose value is a tree node that describes the
- function in question. Normally it is a node of type `FUNCTION_DECL' that
- describes the declaration of the function. From this it is possible to
- obtain the DECL_ATTRIBUTES of the function.
-
- FUNTYPE is a C variable whose value is a tree node that describes the
- function in question. Normally it is a node of type `FUNCTION_TYPE' that
- describes the data type of the function. From this it is possible to obtain
- the data types of the value and arguments (if known).
-
- When a call to a library function is being considered, FUNTYPE will contain
- an identifier node for the library function. Thus, if you need to
- distinguish among various library functions, you can do so by their names.
- Note that "library function" in this context means a function used to
- perform arithmetic, whose name is known specially in the compiler and was
- not mentioned in the C code being compiled.
-
- STACK-SIZE is the number of bytes of arguments passed on the stack. If a
- variable number of bytes is passed, it is zero, and argument popping will
- always be the responsibility of the calling function.
-
- On the VAX, all functions always pop their arguments, so the definition of
- this macro is STACK-SIZE. On the 68000, using the standard calling
- convention, no functions pop their arguments, so the value of the macro is
- always 0 in this case. But an alternative calling convention is available
- in which functions that take a fixed number of arguments pop them but other
- functions (such as `printf') pop nothing (the caller pops all). When this
- convention is in use, FUNTYPE is examined to determine whether a function
- takes a fixed number of arguments. */
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
/* The number of register assigned to holding function arguments. */
@@ -2325,52 +2290,6 @@ do { \
#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS)\
frv_final_prescan_insn (INSN, OPVEC, NOPERANDS)
-
-/* A C compound statement to output to stdio stream STREAM the assembler syntax
- for an instruction operand X. X is an RTL expression.
-
- CODE is a value that can be used to specify one of several ways of printing
- the operand. It is used when identical operands must be printed differently
- depending on the context. CODE comes from the `%' specification that was
- used to request printing of the operand. If the specification was just
- `%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is
- the ASCII code for LTR.
-
- If X is a register, this macro should print the register's name. The names
- can be found in an array `reg_names' whose type is `char *[]'. `reg_names'
- is initialized from `REGISTER_NAMES'.
-
- When the machine description has a specification `%PUNCT' (a `%' followed by
- a punctuation character), this macro is called with a null pointer for X and
- the punctuation character for CODE. */
-#define PRINT_OPERAND(STREAM, X, CODE) frv_print_operand (STREAM, X, CODE)
-
-/* A C expression which evaluates to true if CODE is a valid punctuation
- character for use in the `PRINT_OPERAND' macro. If
- `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation
- characters (except for the standard one, `%') are used in this way. */
-/* . == gr0
- # == hint operand -- always zero for now
- @ == small data base register (gr16)
- ~ == pic register (gr17)
- * == temporary integer CCR register (cr3)
- & == temporary integer ICC register (icc3) */
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
-((CODE) == '.' || (CODE) == '#' || (CODE) == '@' || (CODE) == '~' \
- || (CODE) == '*' || (CODE) == '&')
-
-/* A C compound statement to output to stdio stream STREAM the assembler syntax
- for an instruction operand that is a memory reference whose address is X. X
- is an RTL expression.
-
- On some machines, the syntax for a symbolic address depends on the section
- that the address refers to. On these machines, define the macro
- `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and
- then check for it here.
-
- This declaration must be present. */
-#define PRINT_OPERAND_ADDRESS(STREAM, X) frv_print_operand_address (STREAM, X)
-
/* If defined, C string expressions to be used for the `%R', `%L', `%U', and
`%I' options of `asm_fprintf' (see `final.c'). These are useful when a
single `md' file must support multiple assembler formats. In that case, the
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 4136eb01688..5773fb15b51 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -39,7 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "optabs.h"
#include "toplev.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h" /* ??? */
#include "tm_p.h"
#include "ggc.h"
#include "target.h"
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 1ce1585544e..4e0a3b6728e 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -536,17 +536,6 @@ enum reg_class {
#define FIRST_PARM_OFFSET(FNDECL) 0
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the H8 the return does not pop anything. */
-
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
-
/* Definitions for register eliminations.
This is an array of structures. Each structure initializes one pair
diff --git a/gcc/config/i386/atom.md b/gcc/config/i386/atom.md
index a9c4c5d0576..1664269bac0 100644
--- a/gcc/config/i386/atom.md
+++ b/gcc/config/i386/atom.md
@@ -501,9 +501,10 @@
;; if palignr or psrldq
(define_insn_reservation "atom_sseishft_2" 1
(and (eq_attr "cpu" "atom")
- (and (eq_attr "type" "sseishft")
- (and (eq_attr "atom_unit" "sishuf")
- (match_operand 2 "immediate_operand"))))
+ (ior (eq_attr "type" "sseishft1")
+ (and (eq_attr "type" "sseishft")
+ (and (eq_attr "atom_unit" "sishuf")
+ (match_operand 2 "immediate_operand")))))
"atom-simple-0")
;; if reg/mem op
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 7c35e2ee57f..f2b70afa447 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
#undef ASM_GENERATE_INTERNAL_LABEL
#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "%s%s%ld", LOCAL_LABEL_PREFIX, \
+ sprintf ((BUF), "*%s%s%ld", LOCAL_LABEL_PREFIX, \
(PREFIX), (long)(NUMBER))
#undef LPREFIX
diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
index b33fc86ea98..1b89a0b428f 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -25,12 +25,12 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tm_p.h"
#include "flags.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "ggc.h"
#include "target.h"
#include "target-def.h"
#include "cpplib.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
static bool ix86_pragma_target_parse (tree, tree);
static void ix86_target_macros_internal
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index eaff7ab5058..4a0e3062212 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -60,8 +60,7 @@ extern bool legitimate_pic_operand_p (rtx);
extern int legitimate_pic_address_disp_p (rtx);
extern void print_reg (rtx, int, FILE*);
-extern void print_operand (FILE*, rtx, int);
-extern void print_operand_address (FILE*, rtx);
+extern void ix86_print_operand (FILE *, rtx, int);
extern bool output_addr_const_extra (FILE*, rtx);
extern void split_di (rtx[], int, rtx[], rtx[]);
@@ -150,15 +149,12 @@ extern void ix86_split_fp_branch (enum rtx_code code, rtx, rtx,
rtx, rtx, rtx, rtx);
extern bool ix86_hard_regno_mode_ok (int, enum machine_mode);
extern bool ix86_modes_tieable_p (enum machine_mode, enum machine_mode);
-extern int ix86_register_move_cost (enum machine_mode, enum reg_class,
- enum reg_class);
extern int ix86_secondary_memory_needed (enum reg_class, enum reg_class,
enum machine_mode, int);
extern bool ix86_cannot_change_mode_class (enum machine_mode,
enum machine_mode, enum reg_class);
extern enum reg_class ix86_preferred_reload_class (rtx, enum reg_class);
extern enum reg_class ix86_preferred_output_reload_class (rtx, enum reg_class);
-extern int ix86_memory_move_cost (enum machine_mode, enum reg_class, int);
extern int ix86_mode_needed (int, rtx);
extern void emit_i387_cw_initialization (int);
extern void x86_order_regs_for_local_alloc (void);
@@ -184,16 +180,11 @@ extern void ix86_expand_truncdf_32 (rtx, rtx);
#ifdef TREE_CODE
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
-extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
-extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
- tree, int);
#endif /* TREE_CODE */
#endif /* RTX_CODE */
#ifdef TREE_CODE
-extern int ix86_return_pops_args (tree, tree, int);
-
extern int ix86_data_alignment (tree, int);
extern unsigned int ix86_local_alignment (tree, enum machine_mode,
unsigned int);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 034c6c52b98..f28e794647c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2691,6 +2691,26 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune,
return ret;
}
+/* Return TRUE if software prefetching is beneficial for the
+ given CPU. */
+
+static bool
+software_prefetching_beneficial_p (void)
+{
+ switch (ix86_tune)
+ {
+ case PROCESSOR_GEODE:
+ case PROCESSOR_K6:
+ case PROCESSOR_ATHLON:
+ case PROCESSOR_K8:
+ case PROCESSOR_AMDFAM10:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
/* Function that is callable from the debugger to print the current
options. */
void
@@ -2725,7 +2745,7 @@ override_options (bool main_args_p)
{
int i;
unsigned int ix86_arch_mask, ix86_tune_mask;
- const bool ix86_tune_specified = (ix86_tune_string != NULL);
+ const bool ix86_tune_specified = (ix86_tune_string != NULL);
const char *prefix;
const char *suffix;
const char *sw;
@@ -2850,7 +2870,7 @@ override_options (bool main_args_p)
{"bdver1", PROCESSOR_BDVER1, CPU_BDVER1,
PTA_64BIT | PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE
| PTA_SSE2 | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM
- | PTA_SSSE3 | PTA_SSE4_1 | PTA_SSE4_2 | PTA_AES
+ | PTA_SSSE3 | PTA_SSE4_1 | PTA_SSE4_2 | PTA_AES
| PTA_PCLMUL | PTA_AVX | PTA_FMA4 | PTA_XOP | PTA_LWP},
{"generic32", PROCESSOR_GENERIC32, CPU_PENTIUMPRO,
0 /* flags are only used for -march switch. */ },
@@ -2891,6 +2911,8 @@ override_options (bool main_args_p)
in case they weren't overwritten by command line options. */
if (TARGET_64BIT)
{
+ if (flag_zee == 2)
+ flag_zee = 1;
/* Mach-O doesn't support omitting the frame pointer for now. */
if (flag_omit_frame_pointer == 2)
flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1);
@@ -2901,6 +2923,8 @@ override_options (bool main_args_p)
}
else
{
+ if (flag_zee == 2)
+ flag_zee = 0;
if (flag_omit_frame_pointer == 2)
flag_omit_frame_pointer = 0;
if (flag_asynchronous_unwind_tables == 2)
@@ -3531,6 +3555,13 @@ override_options (bool main_args_p)
if (!PARAM_SET_P (PARAM_L2_CACHE_SIZE))
set_param_value ("l2-cache-size", ix86_cost->l2_cache_size);
+ /* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */
+ if (flag_prefetch_loop_arrays < 0
+ && HAVE_prefetch
+ && optimize >= 3
+ && software_prefetching_beneficial_p ())
+ flag_prefetch_loop_arrays = 1;
+
/* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
can be optimized to ap = __builtin_next_arg (0). */
if (!TARGET_64BIT)
@@ -4320,13 +4351,13 @@ x86_64_elf_unique_section (tree decl, int reloc)
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
name = targetm.strip_name_encoding (name);
-
+
/* If we're using one_only, then there needs to be a .gnu.linkonce
prefix to the section name. */
linkonce = one_only ? ".gnu.linkonce" : "";
-
+
string = ACONCAT ((linkonce, prefix, ".", name, NULL));
-
+
DECL_SECTION_NAME (decl) = build_string (strlen (string), string);
return;
}
@@ -4390,10 +4421,6 @@ optimization_options (int level, int size ATTRIBUTE_UNUSED)
flag_schedule_insns = 0;
#endif
- /* For -O2 and beyond, turn on -fzee for x86_64 target. */
- if (level > 1 && TARGET_64BIT)
- flag_zee = 1;
-
if (TARGET_MACHO)
/* The Darwin libraries never set errno, so we might as well
avoid calling them when that's the only reason we would. */
@@ -4405,6 +4432,11 @@ optimization_options (int level, int size ATTRIBUTE_UNUSED)
specifying them, we will set the defaults in override_options. */
if (optimize >= 1)
flag_omit_frame_pointer = 2;
+
+ /* For -O2 and beyond, turn on -fzee for x86_64 target. */
+ if (level > 1)
+ flag_zee = 2;
+
flag_pcc_struct_return = 2;
flag_asynchronous_unwind_tables = 2;
flag_vect_cost_model = 1;
@@ -4833,7 +4865,7 @@ ix86_eax_live_at_start_p (void)
The attribute stdcall is equivalent to RTD on a per module basis. */
-int
+static int
ix86_return_pops_args (tree fundecl, tree funtype, int size)
{
int rtd;
@@ -5148,7 +5180,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
NULL. */
static enum machine_mode
-type_natural_mode (const_tree type, CUMULATIVE_ARGS *cum)
+type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum)
{
enum machine_mode mode = TYPE_MODE (type);
@@ -5176,7 +5208,7 @@ type_natural_mode (const_tree type, CUMULATIVE_ARGS *cum)
static bool warnedavx;
if (cum
- && !warnedavx
+ && !warnedavx
&& cum->warn_avx)
{
warnedavx = true;
@@ -5357,7 +5389,7 @@ classify_argument (enum machine_mode mode, const_tree type,
== NULL_TREE))
{
static bool warned;
-
+
if (!warned && warn_psabi)
{
warned = true;
@@ -5779,7 +5811,7 @@ construct_container (enum machine_mode mode, enum machine_mode orig_mode,
case X86_64_SSESF_CLASS:
case X86_64_SSEDF_CLASS:
if (mode != BLKmode)
- return gen_reg_or_parallel (mode, orig_mode,
+ return gen_reg_or_parallel (mode, orig_mode,
SSE_REGNO (sse_regno));
break;
case X86_64_X87_CLASS:
@@ -5905,7 +5937,8 @@ construct_container (enum machine_mode mode, enum machine_mode orig_mode,
static void
function_arg_advance_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, HOST_WIDE_INT bytes, HOST_WIDE_INT words)
+ const_tree type, HOST_WIDE_INT bytes,
+ HOST_WIDE_INT words)
{
switch (mode)
{
@@ -5993,7 +6026,7 @@ function_arg_advance_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static void
function_arg_advance_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, HOST_WIDE_INT words, int named)
+ const_tree type, HOST_WIDE_INT words, bool named)
{
int int_nregs, sse_nregs;
@@ -6029,9 +6062,13 @@ function_arg_advance_ms_64 (CUMULATIVE_ARGS *cum, HOST_WIDE_INT bytes,
}
}
-void
-function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, int named)
+/* Update the data in CUM to advance over an argument of mode MODE and
+ data type TYPE. (TYPE is null for libcalls where that information
+ may not be available.) */
+
+static void
+ix86_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named)
{
HOST_WIDE_INT bytes, words;
@@ -6066,8 +6103,8 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
(otherwise it is an extra parameter matching an ellipsis). */
static rtx
-function_arg_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- enum machine_mode orig_mode, tree type,
+function_arg_32 (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ enum machine_mode orig_mode, const_tree type,
HOST_WIDE_INT bytes, HOST_WIDE_INT words)
{
static bool warnedsse, warnedmmx;
@@ -6183,8 +6220,8 @@ function_arg_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
}
static rtx
-function_arg_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- enum machine_mode orig_mode, tree type, int named)
+function_arg_64 (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ enum machine_mode orig_mode, const_tree type, bool named)
{
/* Handle a hidden AL argument containing number of registers
for varargs x86-64 functions. */
@@ -6219,8 +6256,8 @@ function_arg_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
}
static rtx
-function_arg_ms_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- enum machine_mode orig_mode, int named,
+function_arg_ms_64 (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ enum machine_mode orig_mode, bool named,
HOST_WIDE_INT bytes)
{
unsigned int regno;
@@ -6266,9 +6303,19 @@ function_arg_ms_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
return gen_reg_or_parallel (mode, orig_mode, regno);
}
-rtx
-function_arg (CUMULATIVE_ARGS *cum, enum machine_mode omode,
- tree type, int named)
+/* Return where to put the arguments to a function.
+ Return zero to push the argument on the stack, or a hard register in which to store the argument.
+
+ MODE is the argument's machine mode. TYPE is the data type of the
+ argument. It is null for libcalls where that information may not be
+ available. CUM gives information about the preceding args and about
+ the function being called. NAMED is nonzero if this argument is a
+ named parameter (otherwise it is an extra parameter matching an
+ ellipsis). */
+
+static rtx
+ix86_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode omode,
+ const_tree type, bool named)
{
enum machine_mode mode = omode;
HOST_WIDE_INT bytes, words;
@@ -6393,10 +6440,9 @@ ix86_function_arg_boundary (enum machine_mode mode, tree type)
int align;
if (type)
{
- /* Since canonical type is used for call, we convert it to
- canonical type if needed. */
- if (!TYPE_STRUCTURAL_EQUALITY_P (type))
- type = TYPE_CANONICAL (type);
+ /* Since the main variant type is used for call, we convert it to
+ the main variant type. */
+ type = TYPE_MAIN_VARIANT (type);
align = TYPE_ALIGN (type);
}
else
@@ -6690,7 +6736,7 @@ ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
return SUBTARGET_RETURN_IN_MEMORY (type, fntype);
#else
const enum machine_mode mode = type_natural_mode (type, NULL);
-
+
if (TARGET_64BIT)
{
if (ix86_function_type_abi (fntype) == MS_ABI)
@@ -7002,7 +7048,7 @@ ix86_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
For stdargs, we do want to skip the last named argument. */
next_cum = *cum;
if (stdarg_p (fntype))
- function_arg_advance (&next_cum, mode, type, 1);
+ ix86_function_arg_advance (&next_cum, mode, type, true);
if (cum->call_abi == MS_ABI)
setup_incoming_varargs_ms_64 (&next_cum);
@@ -7047,11 +7093,17 @@ ix86_va_start (tree valist, rtx nextarg)
f_ovf = TREE_CHAIN (f_fpr);
f_sav = TREE_CHAIN (f_ovf);
- valist = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (valist)), valist);
- gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
- fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
- ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
- sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
+ valist = build_simple_mem_ref (valist);
+ TREE_TYPE (valist) = TREE_TYPE (sysv_va_list_type_node);
+ /* The following should be folded into the MEM_REF offset. */
+ gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), unshare_expr (valist),
+ f_gpr, NULL_TREE);
+ fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), unshare_expr (valist),
+ f_fpr, NULL_TREE);
+ ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), unshare_expr (valist),
+ f_ovf, NULL_TREE);
+ sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), unshare_expr (valist),
+ f_sav, NULL_TREE);
/* Count number of gp and fp argument registers used. */
words = crtl->args.info.words;
@@ -7263,7 +7315,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
}
if (need_temp)
{
- int i;
+ int i, prev_size = 0;
tree temp = create_tmp_var (type, "va_arg_tmp");
/* addr = &temp; */
@@ -7275,13 +7327,29 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
rtx slot = XVECEXP (container, 0, i);
rtx reg = XEXP (slot, 0);
enum machine_mode mode = GET_MODE (reg);
- tree piece_type = lang_hooks.types.type_for_mode (mode, 1);
- tree addr_type = build_pointer_type (piece_type);
- tree daddr_type = build_pointer_type_for_mode (piece_type,
- ptr_mode, true);
+ tree piece_type;
+ tree addr_type;
+ tree daddr_type;
tree src_addr, src;
int src_offset;
tree dest_addr, dest;
+ int cur_size = GET_MODE_SIZE (mode);
+
+ if (prev_size + cur_size > size)
+ {
+ cur_size = size - prev_size;
+ mode = mode_for_size (cur_size * BITS_PER_UNIT, MODE_INT, 1);
+ if (mode == BLKmode)
+ mode = QImode;
+ }
+ piece_type = lang_hooks.types.type_for_mode (mode, 1);
+ if (mode == GET_MODE (reg))
+ addr_type = build_pointer_type (piece_type);
+ else
+ addr_type = build_pointer_type_for_mode (piece_type, ptr_mode,
+ true);
+ daddr_type = build_pointer_type_for_mode (piece_type, ptr_mode,
+ true);
if (SSE_REGNO_P (REGNO (reg)))
{
@@ -7296,14 +7364,26 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
src_addr = fold_convert (addr_type, src_addr);
src_addr = fold_build2 (POINTER_PLUS_EXPR, addr_type, src_addr,
size_int (src_offset));
- src = build_va_arg_indirect_ref (src_addr);
dest_addr = fold_convert (daddr_type, addr);
dest_addr = fold_build2 (POINTER_PLUS_EXPR, daddr_type, dest_addr,
size_int (INTVAL (XEXP (slot, 1))));
- dest = build_va_arg_indirect_ref (dest_addr);
+ if (cur_size == GET_MODE_SIZE (mode))
+ {
+ src = build_va_arg_indirect_ref (src_addr);
+ dest = build_va_arg_indirect_ref (dest_addr);
- gimplify_assign (dest, src, pre_p);
+ gimplify_assign (dest, src, pre_p);
+ }
+ else
+ {
+ tree copy
+ = build_call_expr (implicit_built_in_decls[BUILT_IN_MEMCPY],
+ 3, dest_addr, src_addr,
+ size_int (cur_size));
+ gimplify_and_add (copy, pre_p);
+ }
+ prev_size += cur_size;
}
}
@@ -7563,7 +7643,7 @@ standard_sse_constant_opcode (rtx insn, rtx x)
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
return TARGET_AVX ? "vxorps\t%0, %0, %0" : "xorps\t%0, %0";
else
- return TARGET_AVX ? "vxorpd\t%0, %0, %0" : "xorpd\t%0, %0";
+ return TARGET_AVX ? "vxorpd\t%0, %0, %0" : "xorpd\t%0, %0";
case MODE_TI:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
return TARGET_AVX ? "vxorps\t%0, %0, %0" : "xorps\t%0, %0";
@@ -8097,8 +8177,10 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
preferred_alignment = crtl->preferred_stack_boundary / BITS_PER_UNIT;
/* MS ABI seem to require stack alignment to be always 16 except for function
- prologues. */
- if (ix86_cfun_abi () == MS_ABI && preferred_alignment < 16)
+ prologues and leaf. */
+ if ((ix86_cfun_abi () == MS_ABI && preferred_alignment < 16)
+ && (!current_function_is_leaf || cfun->calls_alloca != 0
+ || ix86_current_function_calls_tls_descriptor))
{
preferred_alignment = 16;
stack_alignment_needed = 16;
@@ -8173,7 +8255,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
frame->padding0 = ((offset + 16 - 1) & -16) - offset;
else
frame->padding0 = 0;
-
+
/* SSE register save area. */
offset += frame->padding0 + frame->nsseregs * 16;
@@ -8391,7 +8473,7 @@ pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset,
gcc_assert (ix86_cfa_state->reg == src);
ix86_cfa_state->offset += INTVAL (offset);
ix86_cfa_state->reg = dest;
-
+
r = gen_rtx_PLUS (Pmode, src, offset);
r = gen_rtx_SET (VOIDmode, dest, r);
add_reg_note (insn, REG_CFA_ADJUST_CFA, r);
@@ -8412,7 +8494,7 @@ pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset,
Return: the regno of chosen register. */
-static unsigned int
+static unsigned int
find_drap_reg (void)
{
tree decl = cfun->decl;
@@ -8436,7 +8518,7 @@ find_drap_reg (void)
register in such case. */
if (DECL_STATIC_CHAIN (decl) || crtl->tail_call_emit)
return DI_REG;
-
+
/* Reuse static chain register if it isn't used for parameter
passing. */
if (ix86_function_regparm (TREE_TYPE (decl), decl) <= 2
@@ -8461,7 +8543,7 @@ ix86_minimum_incoming_stack_boundary (bool sibcall)
if (ix86_user_incoming_stack_boundary)
incoming_stack_boundary = ix86_user_incoming_stack_boundary;
/* In 32bit, use MIN_STACK_BOUNDARY for incoming stack boundary
- if -mstackrealign is used, it isn't used for sibcall check and
+ if -mstackrealign is used, it isn't used for sibcall check and
estimated stack alignment is 128bit. */
else if (!sibcall
&& !TARGET_64BIT
@@ -8535,7 +8617,7 @@ ix86_get_drap_rtx (void)
drap_vreg = copy_to_reg (arg_ptr);
seq = get_insns ();
end_sequence ();
-
+
insn = emit_insn_before (seq, NEXT_INSN (entry_of_function ()));
if (!optimize)
{
@@ -8558,10 +8640,10 @@ ix86_internal_arg_pointer (void)
/* Finalize stack_realign_needed flag, which will guide prologue/epilogue
to be generated in correct form. */
-static void
+static void
ix86_finalize_stack_realign_flags (void)
{
- /* Check if stack realign is really needed after reload, and
+ /* Check if stack realign is really needed after reload, and
stores result in cfun */
unsigned int incoming_stack_boundary
= (crtl->parm_stack_boundary > ix86_incoming_stack_boundary
@@ -8694,7 +8776,7 @@ ix86_expand_prologue (void)
}
insn = emit_insn (gen_rtx_SET (VOIDmode, y, x));
- RTX_FRAME_RELATED_P (insn) = 1;
+ RTX_FRAME_RELATED_P (insn) = 1;
ix86_cfa_state->reg = crtl->drap_reg;
/* Align the stack. */
@@ -8756,7 +8838,7 @@ ix86_expand_prologue (void)
if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE && frame.save_regs_using_mov
&& (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT))
ix86_emit_save_regs_using_mov ((frame_pointer_needed
- && !crtl->stack_realign_needed)
+ && !crtl->stack_realign_needed)
? hard_frame_pointer_rtx
: stack_pointer_rtx,
-frame.nregs * UNITS_PER_WORD);
@@ -8988,7 +9070,7 @@ ix86_emit_leave (HOST_WIDE_INT red_offset)
ix86_cfa_state->reg = stack_pointer_rtx;
ix86_cfa_state->offset -= UNITS_PER_WORD;
- add_reg_note (insn, REG_CFA_ADJUST_CFA,
+ add_reg_note (insn, REG_CFA_ADJUST_CFA,
copy_rtx (XVECEXP (PATTERN (insn), 0, 0)));
RTX_FRAME_RELATED_P (insn) = 1;
ix86_add_cfa_restore_note (insn, hard_frame_pointer_rtx, red_offset);
@@ -9107,7 +9189,7 @@ ix86_expand_epilogue (int style)
/* See the comment about red zone and frame
pointer usage in ix86_expand_prologue. */
if (frame_pointer_needed && frame.red_zone_size)
- emit_insn (gen_memory_blockage ());
+ emit_insn (gen_memory_blockage ());
using_drap = crtl->drap_reg && crtl->stack_realign_needed;
gcc_assert (!using_drap || ix86_cfa_state->reg == crtl->drap_reg);
@@ -9163,13 +9245,13 @@ ix86_expand_epilogue (int style)
locations. If both are available, default to ebp, since offsets
are known to be small. Only exception is esp pointing directly
to the end of block of saved registers, where we may simplify
- addressing mode.
+ addressing mode.
If we are realigning stack with bp and sp, regs restore can't
be addressed by bp. sp must be used instead. */
if (!frame_pointer_needed
- || (sp_valid && !(frame.to_allocate + frame.padding0))
+ || (sp_valid && !(frame.to_allocate + frame.padding0))
|| stack_realign_fp)
{
ix86_emit_restore_sse_regs_using_mov (stack_pointer_rtx,
@@ -9285,7 +9367,7 @@ ix86_expand_epilogue (int style)
If we realign stack with frame pointer, then stack pointer
won't be able to recover via lea $offset(%bp), %sp, because
- there is a padding area between bp and sp for realign.
+ there is a padding area between bp and sp for realign.
"add $to_allocate, %sp" must be used instead. */
if (!sp_valid)
{
@@ -9326,8 +9408,8 @@ ix86_expand_epilogue (int style)
ix86_emit_leave (red_offset);
else
{
- /* For stack realigned really happens, recover stack
- pointer to hard frame pointer is a must, if not using
+ /* For stack realigned really happens, recover stack
+ pointer to hard frame pointer is a must, if not using
leave. */
if (stack_realign_fp)
pro_epilogue_adjust_stack (stack_pointer_rtx,
@@ -9351,10 +9433,11 @@ ix86_expand_epilogue (int style)
if (!call_used_regs[REGNO (crtl->drap_reg)])
param_ptr_offset += UNITS_PER_WORD;
- insn = emit_insn ((*ix86_gen_add3) (stack_pointer_rtx,
- crtl->drap_reg,
- GEN_INT (-param_ptr_offset)));
-
+ insn = emit_insn (gen_rtx_SET
+ (VOIDmode, stack_pointer_rtx,
+ gen_rtx_PLUS (Pmode,
+ crtl->drap_reg,
+ GEN_INT (-param_ptr_offset))));
ix86_cfa_state->reg = stack_pointer_rtx;
ix86_cfa_state->offset = param_ptr_offset;
@@ -9375,7 +9458,7 @@ ix86_expand_epilogue (int style)
gcc_assert (ix86_cfa_state->reg == stack_pointer_rtx);
ix86_cfa_state->offset += UNITS_PER_WORD;
-
+
r = gen_rtx_REG (Pmode, CX_REG);
insn = emit_insn (ix86_gen_pop1 (r));
@@ -10635,7 +10718,7 @@ get_dllimport_decl (tree decl)
if (h)
return h->to;
- *loc = h = GGC_NEW (struct tree_map);
+ *loc = h = ggc_alloc_tree_map ();
h->hash = in.hash;
h->base.from = decl;
h->to = to = build_decl (DECL_SOURCE_LOCATION (decl),
@@ -10962,7 +11045,7 @@ output_pic_addr_const (FILE *file, rtx x, int code)
}
else
/* We can't handle floating point constants;
- PRINT_OPERAND must handle them. */
+ TARGET_PRINT_OPERAND must handle them. */
output_operand_lossage ("floating constant misused");
break;
@@ -11580,7 +11663,7 @@ get_some_local_dynamic_name (void)
*/
void
-print_operand (FILE *file, rtx x, int code)
+ix86_print_operand (FILE *file, rtx x, int code)
{
if (code)
{
@@ -11615,7 +11698,7 @@ print_operand (FILE *file, rtx x, int code)
if (!REG_P (x))
{
putc ('[', file);
- PRINT_OPERAND (file, x, 0);
+ ix86_print_operand (file, x, 0);
putc (']', file);
return;
}
@@ -11625,7 +11708,7 @@ print_operand (FILE *file, rtx x, int code)
gcc_unreachable ();
}
- PRINT_OPERAND (file, x, 0);
+ ix86_print_operand (file, x, 0);
return;
@@ -11763,7 +11846,7 @@ print_operand (FILE *file, rtx x, int code)
output_operand_lossage
("invalid operand size for operand code '%c'", code);
return;
-
+
case 'd':
case 'b':
case 'w':
@@ -11780,7 +11863,7 @@ print_operand (FILE *file, rtx x, int code)
case 's':
if (CONST_INT_P (x) || ! SHIFT_DOUBLE_OMITS_COUNT)
{
- PRINT_OPERAND (file, x, 0);
+ ix86_print_operand (file, x, 0);
fputs (", ", file);
}
return;
@@ -12177,11 +12260,17 @@ print_operand (FILE *file, rtx x, int code)
output_addr_const (file, x);
}
}
+
+static bool
+ix86_print_operand_punct_valid_p (unsigned char code)
+{
+ return (code == '*' || code == '+' || code == '&' || code == ';');
+}
/* Print a memory operand whose address is ADDR. */
-void
-print_operand_address (FILE *file, rtx addr)
+static void
+ix86_print_operand_address (FILE *file, rtx addr)
{
struct ix86_address parts;
rtx base, index, disp;
@@ -13364,7 +13453,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
op1 = gen_lowpart (mode, op1);
switch (mode)
- {
+ {
case V4SFmode:
emit_insn (gen_avx_movups (op0, op1));
break;
@@ -13399,7 +13488,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
if (MEM_P (op1))
{
/* If we're optimizing for size, movups is the smallest. */
- if (optimize_insn_for_size_p ()
+ if (optimize_insn_for_size_p ()
|| TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
{
op0 = gen_lowpart (V4SFmode, op0);
@@ -13508,7 +13597,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
{
op0 = gen_lowpart (V2DFmode, op0);
op1 = gen_lowpart (V2DFmode, op1);
- emit_insn (gen_sse2_movupd (op0, op1));
+ emit_insn (gen_sse2_movupd (op0, op1));
}
else
{
@@ -13526,7 +13615,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
if (TARGET_SSE_UNALIGNED_STORE_OPTIMAL)
{
op0 = gen_lowpart (V4SFmode, op0);
- emit_insn (gen_sse_movups (op0, op1));
+ emit_insn (gen_sse_movups (op0, op1));
}
else
{
@@ -13795,7 +13884,7 @@ ix86_expand_unary_operator (enum rtx_code code, enum machine_mode mode,
#define LEA_SEARCH_THRESHOLD 12
/* Search backward for non-agu definition of register number REGNO1
- or register number REGNO2 in INSN's basic block until
+ or register number REGNO2 in INSN's basic block until
1. Pass LEA_SEARCH_THRESHOLD instructions, or
2. Reach BB boundary, or
3. Reach agu definition.
@@ -13835,20 +13924,20 @@ distance_non_agu_define (unsigned int regno1, unsigned int regno2,
prev = PREV_INSN (prev);
}
}
-
+
if (distance < LEA_SEARCH_THRESHOLD)
{
edge e;
edge_iterator ei;
bool simple_loop = false;
-
+
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->src == bb)
{
simple_loop = true;
break;
}
-
+
if (simple_loop)
{
rtx prev = BB_END (bb);
@@ -13885,7 +13974,7 @@ done:
return distance;
}
-/* Return the distance between INSN and the next insn that uses
+/* Return the distance between INSN and the next insn that uses
register number REGNO0 in memory address. Return -1 if no such
a use is found within LEA_SEARCH_THRESHOLD or REGNO0 is set. */
@@ -13936,14 +14025,14 @@ distance_agu_use (unsigned int regno0, rtx insn)
edge e;
edge_iterator ei;
bool simple_loop = false;
-
+
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == bb)
{
simple_loop = true;
break;
}
-
+
if (simple_loop)
{
rtx next = BB_HEAD (bb);
@@ -13978,7 +14067,7 @@ distance_agu_use (unsigned int regno0, rtx insn)
next = NEXT_INSN (next);
}
}
- }
+ }
return -1;
}
@@ -14012,7 +14101,7 @@ ix86_lea_for_add_ok (enum rtx_code code ATTRIBUTE_UNUSED,
/* If a = b + c, (a!=b && a!=c), must use lea form. */
if (regno0 != regno1 && regno0 != regno2)
return true;
- else
+ else
{
int dist_define, dist_use;
dist_define = distance_non_agu_define (regno1, regno2, insn);
@@ -14074,7 +14163,7 @@ ix86_dep_by_shift_count_body (const_rtx set_body, const_rtx use_body)
break;
}
- if (shift_rtx
+ if (shift_rtx
&& (GET_CODE (shift_rtx) == ASHIFT
|| GET_CODE (shift_rtx) == LSHIFTRT
|| GET_CODE (shift_rtx) == ASHIFTRT
@@ -14933,7 +15022,7 @@ ix86_cc_modes_compatible (enum machine_mode m1, enum machine_mode m2)
}
-/* Return a comparison we can do and that it is equivalent to
+/* Return a comparison we can do and that it is equivalent to
swap_condition (code) apart possibly from orderedness.
But, never change orderedness if TARGET_IEEE_FP, returning
UNKNOWN in that case if necessary. */
@@ -18278,7 +18367,7 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size, bool memset,
&& alg != rep_prefix_4_byte \
&& alg != rep_prefix_8_byte))
const struct processor_costs *cost;
-
+
/* Even if the string operation call is cold, we still might spend a lot
of time processing large blocks. */
if (optimize_function_for_size_p (cfun)
@@ -18825,7 +18914,7 @@ promote_duplicated_reg (enum machine_mode mode, rtx val)
if (mode == SImode)
emit_insn (gen_movsi_insv_1 (reg, reg));
else
- emit_insn (gen_movdi_insv_1_rex64 (reg, reg));
+ emit_insn (gen_movdi_insv_1 (reg, reg));
else
{
tmp = expand_simple_binop (mode, ASHIFT, reg, GEN_INT (8),
@@ -19452,7 +19541,7 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
}
if (ix86_cmodel == CM_LARGE_PIC
- && MEM_P (fnaddr)
+ && MEM_P (fnaddr)
&& GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF
&& !local_symbolic_operand (XEXP (fnaddr, 0), VOIDmode))
fnaddr = gen_rtx_MEM (QImode, construct_plt_address (XEXP (fnaddr, 0)));
@@ -19520,7 +19609,7 @@ ix86_init_machine_status (void)
{
struct machine_function *f;
- f = GGC_CNEW (struct machine_function);
+ f = ggc_alloc_cleared_machine_function ();
f->use_fast_prologue_epilogue_nregs = -1;
f->tls_descriptor_call_expanded_p = 0;
f->call_abi = ix86_abi;
@@ -19548,8 +19637,7 @@ assign_386_stack_local (enum machine_mode mode, enum ix86_stack_slot n)
if (s->mode == mode && s->n == n)
return copy_rtx (s->rtl);
- s = (struct stack_local_entry *)
- ggc_alloc (sizeof (struct stack_local_entry));
+ s = ggc_alloc_stack_local_entry ();
s->n = n;
s->mode = mode;
s->rtl = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
@@ -20426,7 +20514,7 @@ ix86_static_chain (const_tree fndecl, bool incoming_p)
}
/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNDECL is the decl of the target address; M_TRAMP is a MEM for
+ FNDECL is the decl of the target address; M_TRAMP is a MEM for
the trampoline, and CHAIN_VALUE is an RTX for the static chain
to be passed to the target function. */
@@ -22447,9 +22535,9 @@ static const struct builtin_description bdesc_args[] =
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_si256_si, "__builtin_ia32_si256_si", IX86_BUILTIN_SI256_SI, UNKNOWN, (int) V8SI_FTYPE_V4SI },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_ps256_ps, "__builtin_ia32_ps256_ps", IX86_BUILTIN_PS256_PS, UNKNOWN, (int) V8SF_FTYPE_V4SF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_pd256_pd, "__builtin_ia32_pd256_pd", IX86_BUILTIN_PD256_PD, UNKNOWN, (int) V4DF_FTYPE_V2DF },
- { OPTION_MASK_ISA_AVX, CODE_FOR_avx_si_si256, "__builtin_ia32_si_si256", IX86_BUILTIN_SI_SI256, UNKNOWN, (int) V4SI_FTYPE_V8SI },
- { OPTION_MASK_ISA_AVX, CODE_FOR_avx_ps_ps256, "__builtin_ia32_ps_ps256", IX86_BUILTIN_PS_PS256, UNKNOWN, (int) V4SF_FTYPE_V8SF },
- { OPTION_MASK_ISA_AVX, CODE_FOR_avx_pd_pd256, "__builtin_ia32_pd_pd256", IX86_BUILTIN_PD_PD256, UNKNOWN, (int) V2DF_FTYPE_V4DF },
+ { OPTION_MASK_ISA_AVX, CODE_FOR_vec_extract_lo_v8si, "__builtin_ia32_si_si256", IX86_BUILTIN_SI_SI256, UNKNOWN, (int) V4SI_FTYPE_V8SI },
+ { OPTION_MASK_ISA_AVX, CODE_FOR_vec_extract_lo_v8sf, "__builtin_ia32_ps_ps256", IX86_BUILTIN_PS_PS256, UNKNOWN, (int) V4SF_FTYPE_V8SF },
+ { OPTION_MASK_ISA_AVX, CODE_FOR_vec_extract_lo_v4df, "__builtin_ia32_pd_pd256", IX86_BUILTIN_PD_PD256, UNKNOWN, (int) V2DF_FTYPE_V4DF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_vtestpd, "__builtin_ia32_vtestzpd", IX86_BUILTIN_VTESTZPD, EQ, (int) INT_FTYPE_V2DF_V2DF_PTEST },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_vtestpd, "__builtin_ia32_vtestcpd", IX86_BUILTIN_VTESTCPD, LTU, (int) INT_FTYPE_V2DF_V2DF_PTEST },
@@ -22540,7 +22628,7 @@ static const struct builtin_description bdesc_multi_arg[] =
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_vmfmsubv2df4, "__builtin_ia32_vfmsubsd", IX86_BUILTIN_VFMSUBSD, UNKNOWN, (int)MULTI_ARG_3_DF },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fmsubv4sf4, "__builtin_ia32_vfmsubps", IX86_BUILTIN_VFMSUBPS, UNKNOWN, (int)MULTI_ARG_3_SF },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fmsubv2df4, "__builtin_ia32_vfmsubpd", IX86_BUILTIN_VFMSUBPD, UNKNOWN, (int)MULTI_ARG_3_DF },
-
+
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_vmfnmaddv4sf4, "__builtin_ia32_vfnmaddss", IX86_BUILTIN_VFNMADDSS, UNKNOWN, (int)MULTI_ARG_3_SF },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_vmfnmaddv2df4, "__builtin_ia32_vfnmaddsd", IX86_BUILTIN_VFNMADDSD, UNKNOWN, (int)MULTI_ARG_3_DF },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fnmaddv4sf4, "__builtin_ia32_vfnmaddps", IX86_BUILTIN_VFNMADDPS, UNKNOWN, (int)MULTI_ARG_3_SF },
@@ -22559,7 +22647,7 @@ static const struct builtin_description bdesc_multi_arg[] =
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fmaddv4df4256, "__builtin_ia32_vfmaddpd256", IX86_BUILTIN_VFMADDPD256, UNKNOWN, (int)MULTI_ARG_3_DF2 },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fmsubv8sf4256, "__builtin_ia32_vfmsubps256", IX86_BUILTIN_VFMSUBPS256, UNKNOWN, (int)MULTI_ARG_3_SF2 },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fmsubv4df4256, "__builtin_ia32_vfmsubpd256", IX86_BUILTIN_VFMSUBPD256, UNKNOWN, (int)MULTI_ARG_3_DF2 },
-
+
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fnmaddv8sf4256, "__builtin_ia32_vfnmaddps256", IX86_BUILTIN_VFNMADDPS256, UNKNOWN, (int)MULTI_ARG_3_SF2 },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fnmaddv4df4256, "__builtin_ia32_vfnmaddpd256", IX86_BUILTIN_VFNMADDPD256, UNKNOWN, (int)MULTI_ARG_3_DF2 },
{ OPTION_MASK_ISA_FMA4, CODE_FOR_fma4i_fnmsubv8sf4256, "__builtin_ia32_vfnmsubps256", IX86_BUILTIN_VFNMSUBPS256, UNKNOWN, (int)MULTI_ARG_3_SF2 },
@@ -23676,7 +23764,7 @@ ix86_expand_args_builtin (const struct builtin_description *d,
} args[4];
bool last_arg_count = false;
enum insn_code icode = d->icode;
- const struct insn_data *insn_p = &insn_data[icode];
+ const struct insn_data_d *insn_p = &insn_data[icode];
enum machine_mode tmode = insn_p->operand[0].mode;
enum machine_mode rmode = VOIDmode;
bool swap = false;
@@ -23856,8 +23944,8 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case V8HI_FTYPE_V8HI_V8HI_INT:
case V8SI_FTYPE_V8SI_V8SI_INT:
case V8SI_FTYPE_V8SI_V4SI_INT:
- case V8SF_FTYPE_V8SF_V8SF_INT:
- case V8SF_FTYPE_V8SF_V4SF_INT:
+ case V8SF_FTYPE_V8SF_V8SF_INT:
+ case V8SF_FTYPE_V8SF_V4SF_INT:
case V4SI_FTYPE_V4SI_V4SI_INT:
case V4DF_FTYPE_V4DF_V4DF_INT:
case V4DF_FTYPE_V4DF_V2DF_INT:
@@ -24070,7 +24158,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
} args[3];
enum insn_code icode = d->icode;
bool last_arg_constant = false;
- const struct insn_data *insn_p = &insn_data[icode];
+ const struct insn_data_d *insn_p = &insn_data[icode];
enum machine_mode tmode = insn_p->operand[0].mode;
enum { load, store } klass;
@@ -25261,13 +25349,13 @@ ix86_free_from_memory (enum machine_mode mode)
/* Implement TARGET_IRA_COVER_CLASSES. If -mfpmath=sse, we prefer
SSE_REGS to FLOAT_REGS if their costs for a pseudo are the
same. */
-static const enum reg_class *
+static const reg_class_t *
i386_ira_cover_classes (void)
{
- static const enum reg_class sse_fpmath_classes[] = {
+ static const reg_class_t sse_fpmath_classes[] = {
GENERAL_REGS, SSE_REGS, MMX_REGS, FLOAT_REGS, LIM_REG_CLASSES
};
- static const enum reg_class no_sse_fpmath_classes[] = {
+ static const reg_class_t no_sse_fpmath_classes[] = {
GENERAL_REGS, FLOAT_REGS, MMX_REGS, SSE_REGS, LIM_REG_CLASSES
};
@@ -25377,8 +25465,8 @@ ix86_preferred_output_reload_class (rtx x, enum reg_class regclass)
return regclass;
}
-static enum reg_class
-ix86_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
+static reg_class_t
+ix86_secondary_reload (bool in_p, rtx x, reg_class_t rclass,
enum machine_mode mode,
secondary_reload_info *sri ATTRIBUTE_UNUSED)
{
@@ -25630,10 +25718,11 @@ inline_memory_move_cost (enum machine_mode mode, enum reg_class regclass,
}
}
-int
-ix86_memory_move_cost (enum machine_mode mode, enum reg_class regclass, int in)
+static int
+ix86_memory_move_cost (enum machine_mode mode, reg_class_t regclass,
+ bool in)
{
- return inline_memory_move_cost (mode, regclass, in);
+ return inline_memory_move_cost (mode, (enum reg_class) regclass, in ? 1 : 0);
}
@@ -25644,10 +25733,13 @@ ix86_memory_move_cost (enum machine_mode mode, enum reg_class regclass, int in)
on some machines it is expensive to move between registers if they are not
general registers. */
-int
-ix86_register_move_cost (enum machine_mode mode, enum reg_class class1,
- enum reg_class class2)
+static int
+ix86_register_move_cost (enum machine_mode mode, reg_class_t class1_i,
+ reg_class_t class2_i)
{
+ enum reg_class class1 = (enum reg_class) class1_i;
+ enum reg_class class2 = (enum reg_class) class2_i;
+
/* In case we require secondary memory, compute cost of the store followed
by load. In order to avoid bad register allocation choices, we need
for this to be *at least* as high as the symmetric MEMORY_MOVE_COST. */
@@ -27292,7 +27384,7 @@ ix86_expand_vector_init_one_nonzero (bool mmx_ok, enum machine_mode mode,
emit_insn (gen_rtx_SET (VOIDmode, target, CONST0_RTX (mode)));
var = force_reg (GET_MODE_INNER (mode), var);
ix86_expand_vector_set (mmx_ok, target, var, one_var);
- return true;
+ return true;
}
switch (mode)
@@ -27626,7 +27718,7 @@ ix86_expand_vector_init_interleave (enum machine_mode mode,
rtx (*gen_load_even) (rtx, rtx, rtx);
rtx (*gen_interleave_first_low) (rtx, rtx, rtx);
rtx (*gen_interleave_second_low) (rtx, rtx, rtx);
-
+
switch (mode)
{
case V8HImode:
@@ -27650,7 +27742,7 @@ ix86_expand_vector_init_interleave (enum machine_mode mode,
default:
gcc_unreachable ();
}
-
+
for (i = 0; i < n; i++)
{
/* Extend the odd elment to SImode using a paradoxical SUBREG. */
@@ -27669,7 +27761,7 @@ ix86_expand_vector_init_interleave (enum machine_mode mode,
/* Cast the V4SImode vector back to a vector in orignal mode. */
op0 = gen_reg_rtx (mode);
emit_move_insn (op0, gen_lowpart (mode, op1));
-
+
/* Load even elements into the second positon. */
emit_insn ((*gen_load_even) (op0,
force_reg (inner_mode,
@@ -27792,7 +27884,7 @@ half:
break;
/* Don't use ix86_expand_vector_init_interleave if we can't
- move from GPR to SSE register directly. */
+ move from GPR to SSE register directly. */
if (!TARGET_INTER_UNIT_MOVES)
break;
@@ -29355,28 +29447,52 @@ static const struct attribute_spec ix86_attribute_table[] =
/* Implement targetm.vectorize.builtin_vectorization_cost. */
static int
-ix86_builtin_vectorization_cost (bool runtime_test)
+ix86_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost)
{
- /* If the branch of the runtime test is taken - i.e. - the vectorized
- version is skipped - this incurs a misprediction cost (because the
- vectorized version is expected to be the fall-through). So we subtract
- the latency of a mispredicted branch from the costs that are incured
- when the vectorized version is executed.
+ switch (type_of_cost)
+ {
+ case scalar_stmt:
+ return ix86_cost->scalar_stmt_cost;
- TODO: The values in individual target tables have to be tuned or new
- fields may be needed. For eg. on K8, the default branch path is the
- not-taken path. If the taken path is predicted correctly, the minimum
- penalty of going down the taken-path is 1 cycle. If the taken-path is
- not predicted correctly, then the minimum penalty is 10 cycles. */
+ case scalar_load:
+ return ix86_cost->scalar_load_cost;
- if (runtime_test)
- {
- return (-(ix86_cost->cond_taken_branch_cost));
+ case scalar_store:
+ return ix86_cost->scalar_store_cost;
+
+ case vector_stmt:
+ return ix86_cost->vec_stmt_cost;
+
+ case vector_load:
+ return ix86_cost->vec_align_load_cost;
+
+ case vector_store:
+ return ix86_cost->vec_store_cost;
+
+ case vec_to_scalar:
+ return ix86_cost->vec_to_scalar_cost;
+
+ case scalar_to_vec:
+ return ix86_cost->scalar_to_vec_cost;
+
+ case unaligned_load:
+ return ix86_cost->vec_unalign_load_cost;
+
+ case cond_branch_taken:
+ return ix86_cost->cond_taken_branch_cost;
+
+ case cond_branch_not_taken:
+ return ix86_cost->cond_not_taken_branch_cost;
+
+ case vec_perm:
+ return 1;
+
+ default:
+ gcc_unreachable ();
}
- else
- return 0;
}
+
/* Implement targetm.vectorize.builtin_vec_perm. */
static tree
@@ -30042,7 +30158,7 @@ expand_vec_perm_pshufb2 (struct expand_vec_perm_d *d)
nelt = d->nelt;
eltsz = GET_MODE_SIZE (GET_MODE_INNER (d->vmode));
-
+
/* Generate two permutation masks. If the required element is within
the given vector it is shuffled into the proper lane. If the required
element is in the other vector, force a zero into the lane by setting
@@ -30440,7 +30556,7 @@ ix86_expand_vec_perm_builtin (tree exp)
d.op1 = d.op0;
break;
}
-
+
d.target = gen_reg_rtx (d.vmode);
if (ix86_expand_vec_perm_builtin_1 (&d))
return d.target;
@@ -30512,7 +30628,7 @@ ix86_vectorize_builtin_vec_perm_ok (tree vec_type, tree mask)
an error generated from the extract. */
gcc_assert (vec_mask > 0 && vec_mask <= 3);
one_vec = (vec_mask != 3);
-
+
/* Implementable with shufps or pshufd. */
if (one_vec && (d.vmode == V4SFmode || d.vmode == V4SImode))
return true;
@@ -30580,10 +30696,12 @@ ix86_canonical_va_list_type (tree type)
tree wtype, htype;
/* Resolve references and pointers to va_list type. */
- if (INDIRECT_REF_P (type))
+ if (TREE_CODE (type) == MEM_REF)
type = TREE_TYPE (type);
else if (POINTER_TYPE_P (type) && POINTER_TYPE_P (TREE_TYPE(type)))
type = TREE_TYPE (type);
+ else if (POINTER_TYPE_P (type) && TREE_CODE (TREE_TYPE (type)) == ARRAY_TYPE)
+ type = TREE_TYPE (type);
if (TARGET_64BIT)
{
@@ -30747,6 +30865,13 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#undef TARGET_ASM_UNALIGNED_DI_OP
#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND ix86_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS ix86_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P ix86_print_operand_punct_valid_p
+
#undef TARGET_SCHED_ADJUST_COST
#define TARGET_SCHED_ADJUST_COST ix86_adjust_cost
#undef TARGET_SCHED_ISSUE_RATE
@@ -30800,6 +30925,10 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION ix86_handle_option
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST ix86_register_move_cost
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST ix86_memory_move_cost
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS ix86_rtx_costs
#undef TARGET_ADDRESS_COST
@@ -30842,6 +30971,10 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#define TARGET_SETUP_INCOMING_VARARGS ix86_setup_incoming_varargs
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK ix86_must_pass_in_stack
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE ix86_function_arg_advance
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG ix86_function_arg
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE ix86_pass_by_reference
#undef TARGET_INTERNAL_ARG_POINTER
@@ -30856,6 +30989,8 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#define TARGET_STATIC_CHAIN ix86_static_chain
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT ix86_trampoline_init
+#undef TARGET_RETURN_POPS_ARGS
+#define TARGET_RETURN_POPS_ARGS ix86_return_pops_args
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR ix86_gimplify_va_arg
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index b18aadefaca..7bf4334cb7d 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1543,26 +1543,6 @@ enum reg_class
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) \
(ix86_function_type_abi (FNTYPE) == MS_ABI)
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the 80386, the RTD insn may be used to pop them if the number
- of args is fixed, but if the number is variable then the caller
- must pop them all. RTD can't be used for library calls now
- because the library is compiled with the Unix compiler.
- Use of RTD is a selectable option, since it is incompatible with
- standard Unix calling sequences. If the option is not selected,
- the caller must always pop the args.
-
- The attribute stdcall is equivalent to RTD on a per module basis. */
-
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) \
- ix86_return_pops_args ((FUNDECL), (FUNTYPE), (SIZE))
-
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
@@ -1612,29 +1592,6 @@ typedef struct ix86_args {
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL))
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- function_arg (&(CUM), (MODE), (TYPE), (NAMED))
-
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
@@ -1892,28 +1849,6 @@ do { \
so give the MEM rtx a byte's mode. */
#define FUNCTION_MODE QImode
-/* A C expression for the cost of moving data from a register in class FROM to
- one in class TO. The classes are expressed using the enumeration values
- such as `GENERAL_REGS'. A value of 2 is the default; other values are
- interpreted relative to that.
-
- It is not required that the cost always equal 2 when FROM is the same as TO;
- on some machines it is expensive to move between registers if they are not
- general registers. */
-
-#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
- ix86_register_move_cost ((MODE), (CLASS1), (CLASS2))
-
-/* A C expression for the cost of moving data of mode M between a
- register and memory. A value of 2 is the default; this cost is
- relative to those in `REGISTER_MOVE_COST'.
-
- If moving between registers and memory is more expensive than
- between two registers, you should define this macro to express the
- relative cost. */
-
-#define MEMORY_MOVE_COST(MODE, CLASS, IN) \
- ix86_memory_move_cost ((MODE), (CLASS), (IN))
/* A C expression for the cost of a branch instruction. A value of 1
is the default; other values are interpreted relative to that. */
@@ -1993,7 +1928,8 @@ do { \
For non floating point regs, the following are the HImode names.
For float regs, the stack top is sometimes referred to as "%st(0)"
- instead of just "%st". PRINT_OPERAND handles this with the "y" code. */
+ instead of just "%st". TARGET_PRINT_OPERAND handles this with the
+ "y" code. */
#define HI_REGISTER_NAMES \
{"ax","dx","cx","bx","si","di","bp","sp", \
@@ -2163,20 +2099,6 @@ do { \
"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n" \
TEXT_SECTION_ASM_OP);
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- Effect of various CODE letters is described in i386.c near
- print_operand function. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '*' || (CODE) == '+' || (CODE) == '&' || (CODE) == ';')
-
-#define PRINT_OPERAND(FILE, X, CODE) \
- print_operand ((FILE), (X), (CODE))
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address ((FILE), (ADDR))
-
#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
do { \
if (! output_addr_const_extra (FILE, (X))) \
@@ -2445,57 +2367,6 @@ struct GTY(()) machine_function {
#define SYMBOL_REF_DLLEXPORT_P(X) \
((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0)
-/* Model costs for vectorizer. */
-
-/* Cost of conditional branch. */
-#undef TARG_COND_BRANCH_COST
-#define TARG_COND_BRANCH_COST ix86_cost->branch_cost
-
-/* Cost of any scalar operation, excluding load and store. */
-#undef TARG_SCALAR_STMT_COST
-#define TARG_SCALAR_STMT_COST ix86_cost->scalar_stmt_cost
-
-/* Cost of scalar load. */
-#undef TARG_SCALAR_LOAD_COST
-#define TARG_SCALAR_LOAD_COST ix86_cost->scalar_load_cost
-
-/* Cost of scalar store. */
-#undef TARG_SCALAR_STORE_COST
-#define TARG_SCALAR_STORE_COST ix86_cost->scalar_store_cost
-
-/* Cost of any vector operation, excluding load, store or vector to scalar
- operation. */
-#undef TARG_VEC_STMT_COST
-#define TARG_VEC_STMT_COST ix86_cost->vec_stmt_cost
-
-/* Cost of vector to scalar operation. */
-#undef TARG_VEC_TO_SCALAR_COST
-#define TARG_VEC_TO_SCALAR_COST ix86_cost->vec_to_scalar_cost
-
-/* Cost of scalar to vector operation. */
-#undef TARG_SCALAR_TO_VEC_COST
-#define TARG_SCALAR_TO_VEC_COST ix86_cost->scalar_to_vec_cost
-
-/* Cost of aligned vector load. */
-#undef TARG_VEC_LOAD_COST
-#define TARG_VEC_LOAD_COST ix86_cost->vec_align_load_cost
-
-/* Cost of misaligned vector load. */
-#undef TARG_VEC_UNALIGNED_LOAD_COST
-#define TARG_VEC_UNALIGNED_LOAD_COST ix86_cost->vec_unalign_load_cost
-
-/* Cost of vector store. */
-#undef TARG_VEC_STORE_COST
-#define TARG_VEC_STORE_COST ix86_cost->vec_store_cost
-
-/* Cost of conditional taken branch for vectorizer cost model. */
-#undef TARG_COND_TAKEN_BRANCH_COST
-#define TARG_COND_TAKEN_BRANCH_COST ix86_cost->cond_taken_branch_cost
-
-/* Cost of conditional not taken branch for vectorizer cost model. */
-#undef TARG_COND_NOT_TAKEN_BRANCH_COST
-#define TARG_COND_NOT_TAKEN_BRANCH_COST ix86_cost->cond_not_taken_branch_cost
-
/*
Local variables:
version-control: t
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index f1c87ac16d8..3d7d74dde6f 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -62,198 +62,199 @@
;; UNSPEC usage:
-(define_constants
- [; Relocation specifiers
- (UNSPEC_GOT 0)
- (UNSPEC_GOTOFF 1)
- (UNSPEC_GOTPCREL 2)
- (UNSPEC_GOTTPOFF 3)
- (UNSPEC_TPOFF 4)
- (UNSPEC_NTPOFF 5)
- (UNSPEC_DTPOFF 6)
- (UNSPEC_GOTNTPOFF 7)
- (UNSPEC_INDNTPOFF 8)
- (UNSPEC_PLTOFF 9)
- (UNSPEC_MACHOPIC_OFFSET 10)
-
- ; Prologue support
- (UNSPEC_STACK_ALLOC 11)
- (UNSPEC_SET_GOT 12)
- (UNSPEC_SSE_PROLOGUE_SAVE 13)
- (UNSPEC_REG_SAVE 14)
- (UNSPEC_DEF_CFA 15)
- (UNSPEC_SET_RIP 16)
- (UNSPEC_SET_GOT_OFFSET 17)
- (UNSPEC_MEMORY_BLOCKAGE 18)
- (UNSPEC_SSE_PROLOGUE_SAVE_LOW 19)
-
- ; TLS support
- (UNSPEC_TP 20)
- (UNSPEC_TLS_GD 21)
- (UNSPEC_TLS_LD_BASE 22)
- (UNSPEC_TLSDESC 23)
-
- ; Other random patterns
- (UNSPEC_SCAS 30)
- (UNSPEC_FNSTSW 31)
- (UNSPEC_SAHF 32)
- (UNSPEC_FSTCW 33)
- (UNSPEC_ADD_CARRY 34)
- (UNSPEC_FLDCW 35)
- (UNSPEC_REP 36)
- (UNSPEC_LD_MPIC 38) ; load_macho_picbase
- (UNSPEC_TRUNC_NOOP 39)
-
- ; For SSE/MMX support:
- (UNSPEC_FIX_NOTRUNC 40)
- (UNSPEC_MASKMOV 41)
- (UNSPEC_MOVMSK 42)
- (UNSPEC_MOVNT 43)
- (UNSPEC_MOVU 44)
- (UNSPEC_RCP 45)
- (UNSPEC_RSQRT 46)
- (UNSPEC_SFENCE 47)
- (UNSPEC_PFRCP 49)
- (UNSPEC_PFRCPIT1 40)
- (UNSPEC_PFRCPIT2 41)
- (UNSPEC_PFRSQRT 42)
- (UNSPEC_PFRSQIT1 43)
- (UNSPEC_MFENCE 44)
- (UNSPEC_LFENCE 45)
- (UNSPEC_PSADBW 46)
- (UNSPEC_LDDQU 47)
- (UNSPEC_MS_TO_SYSV_CALL 48)
-
- ; Generic math support
- (UNSPEC_COPYSIGN 50)
- (UNSPEC_IEEE_MIN 51) ; not commutative
- (UNSPEC_IEEE_MAX 52) ; not commutative
-
- ; x87 Floating point
- (UNSPEC_SIN 60)
- (UNSPEC_COS 61)
- (UNSPEC_FPATAN 62)
- (UNSPEC_FYL2X 63)
- (UNSPEC_FYL2XP1 64)
- (UNSPEC_FRNDINT 65)
- (UNSPEC_FIST 66)
- (UNSPEC_F2XM1 67)
- (UNSPEC_TAN 68)
- (UNSPEC_FXAM 69)
-
- ; x87 Rounding
- (UNSPEC_FRNDINT_FLOOR 70)
- (UNSPEC_FRNDINT_CEIL 71)
- (UNSPEC_FRNDINT_TRUNC 72)
- (UNSPEC_FRNDINT_MASK_PM 73)
- (UNSPEC_FIST_FLOOR 74)
- (UNSPEC_FIST_CEIL 75)
-
- ; x87 Double output FP
- (UNSPEC_SINCOS_COS 80)
- (UNSPEC_SINCOS_SIN 81)
- (UNSPEC_XTRACT_FRACT 84)
- (UNSPEC_XTRACT_EXP 85)
- (UNSPEC_FSCALE_FRACT 86)
- (UNSPEC_FSCALE_EXP 87)
- (UNSPEC_FPREM_F 88)
- (UNSPEC_FPREM_U 89)
- (UNSPEC_FPREM1_F 90)
- (UNSPEC_FPREM1_U 91)
-
- (UNSPEC_C2_FLAG 95)
- (UNSPEC_FXAM_MEM 96)
-
- ; SSP patterns
- (UNSPEC_SP_SET 100)
- (UNSPEC_SP_TEST 101)
- (UNSPEC_SP_TLS_SET 102)
- (UNSPEC_SP_TLS_TEST 103)
-
- ; SSSE3
- (UNSPEC_PSHUFB 120)
- (UNSPEC_PSIGN 121)
- (UNSPEC_PALIGNR 122)
-
- ; For SSE4A support
- (UNSPEC_EXTRQI 130)
- (UNSPEC_EXTRQ 131)
- (UNSPEC_INSERTQI 132)
- (UNSPEC_INSERTQ 133)
-
- ; For SSE4.1 support
- (UNSPEC_BLENDV 134)
- (UNSPEC_INSERTPS 135)
- (UNSPEC_DP 136)
- (UNSPEC_MOVNTDQA 137)
- (UNSPEC_MPSADBW 138)
- (UNSPEC_PHMINPOSUW 139)
- (UNSPEC_PTEST 140)
- (UNSPEC_ROUND 141)
-
- ; For SSE4.2 support
- (UNSPEC_CRC32 143)
- (UNSPEC_PCMPESTR 144)
- (UNSPEC_PCMPISTR 145)
-
- ; For FMA4 support
- (UNSPEC_FMA4_INTRINSIC 150)
- (UNSPEC_FMA4_FMADDSUB 151)
- (UNSPEC_FMA4_FMSUBADD 152)
- (UNSPEC_XOP_UNSIGNED_CMP 151)
- (UNSPEC_XOP_TRUEFALSE 152)
- (UNSPEC_XOP_PERMUTE 153)
- (UNSPEC_FRCZ 154)
-
- ; For AES support
- (UNSPEC_AESENC 159)
- (UNSPEC_AESENCLAST 160)
- (UNSPEC_AESDEC 161)
- (UNSPEC_AESDECLAST 162)
- (UNSPEC_AESIMC 163)
- (UNSPEC_AESKEYGENASSIST 164)
-
- ; For PCLMUL support
- (UNSPEC_PCLMUL 165)
-
- ; For AVX support
- (UNSPEC_PCMP 166)
- (UNSPEC_VPERMIL 167)
- (UNSPEC_VPERMIL2 168)
- (UNSPEC_VPERMIL2F128 169)
- (UNSPEC_MASKLOAD 170)
- (UNSPEC_MASKSTORE 171)
- (UNSPEC_CAST 172)
- (UNSPEC_VTESTP 173)
- ])
-
-(define_constants
- [(UNSPECV_BLOCKAGE 0)
- (UNSPECV_STACK_PROBE 1)
- (UNSPECV_EMMS 2)
- (UNSPECV_LDMXCSR 3)
- (UNSPECV_STMXCSR 4)
- (UNSPECV_FEMMS 5)
- (UNSPECV_CLFLUSH 6)
- (UNSPECV_ALIGN 7)
- (UNSPECV_MONITOR 8)
- (UNSPECV_MWAIT 9)
- (UNSPECV_CMPXCHG 10)
- (UNSPECV_XCHG 12)
- (UNSPECV_LOCK 13)
- (UNSPECV_PROLOGUE_USE 14)
- (UNSPECV_CLD 15)
- (UNSPECV_VZEROALL 16)
- (UNSPECV_VZEROUPPER 17)
- (UNSPECV_RDTSC 18)
- (UNSPECV_RDTSCP 19)
- (UNSPECV_RDPMC 20)
- (UNSPECV_VSWAPMOV 21)
- (UNSPECV_LLWP_INTRINSIC 22)
- (UNSPECV_SLWP_INTRINSIC 23)
- (UNSPECV_LWPVAL_INTRINSIC 24)
- (UNSPECV_LWPINS_INTRINSIC 25)
- ])
+(define_c_enum "unspec" [
+ ;; Relocation specifiers
+ UNSPEC_GOT
+ UNSPEC_GOTOFF
+ UNSPEC_GOTPCREL
+ UNSPEC_GOTTPOFF
+ UNSPEC_TPOFF
+ UNSPEC_NTPOFF
+ UNSPEC_DTPOFF
+ UNSPEC_GOTNTPOFF
+ UNSPEC_INDNTPOFF
+ UNSPEC_PLTOFF
+ UNSPEC_MACHOPIC_OFFSET
+
+ ;; Prologue support
+ UNSPEC_STACK_ALLOC
+ UNSPEC_SET_GOT
+ UNSPEC_SSE_PROLOGUE_SAVE
+ UNSPEC_REG_SAVE
+ UNSPEC_DEF_CFA
+ UNSPEC_SET_RIP
+ UNSPEC_SET_GOT_OFFSET
+ UNSPEC_MEMORY_BLOCKAGE
+ UNSPEC_SSE_PROLOGUE_SAVE_LOW
+
+ ;; TLS support
+ UNSPEC_TP
+ UNSPEC_TLS_GD
+ UNSPEC_TLS_LD_BASE
+ UNSPEC_TLSDESC
+
+ ;; Other random patterns
+ UNSPEC_SCAS
+ UNSPEC_FNSTSW
+ UNSPEC_SAHF
+ UNSPEC_PARITY
+ UNSPEC_FSTCW
+ UNSPEC_ADD_CARRY
+ UNSPEC_FLDCW
+ UNSPEC_REP
+ UNSPEC_LD_MPIC ; load_macho_picbase
+ UNSPEC_TRUNC_NOOP
+
+ ;; For SSE/MMX support:
+ UNSPEC_FIX_NOTRUNC
+ UNSPEC_MASKMOV
+ UNSPEC_MOVMSK
+ UNSPEC_MOVNT
+ UNSPEC_MOVU
+ UNSPEC_RCP
+ UNSPEC_RSQRT
+ UNSPEC_SFENCE
+ UNSPEC_PFRCP
+ UNSPEC_PFRCPIT1
+ UNSPEC_PFRCPIT2
+ UNSPEC_PFRSQRT
+ UNSPEC_PFRSQIT1
+ UNSPEC_MFENCE
+ UNSPEC_LFENCE
+ UNSPEC_PSADBW
+ UNSPEC_LDDQU
+ UNSPEC_MS_TO_SYSV_CALL
+
+ ;; Generic math support
+ UNSPEC_COPYSIGN
+ UNSPEC_IEEE_MIN ; not commutative
+ UNSPEC_IEEE_MAX ; not commutative
+
+ ;; x87 Floating point
+ UNSPEC_SIN
+ UNSPEC_COS
+ UNSPEC_FPATAN
+ UNSPEC_FYL2X
+ UNSPEC_FYL2XP1
+ UNSPEC_FRNDINT
+ UNSPEC_FIST
+ UNSPEC_F2XM1
+ UNSPEC_TAN
+ UNSPEC_FXAM
+
+ ;; x87 Rounding
+ UNSPEC_FRNDINT_FLOOR
+ UNSPEC_FRNDINT_CEIL
+ UNSPEC_FRNDINT_TRUNC
+ UNSPEC_FRNDINT_MASK_PM
+ UNSPEC_FIST_FLOOR
+ UNSPEC_FIST_CEIL
+
+ ;; x87 Double output FP
+ UNSPEC_SINCOS_COS
+ UNSPEC_SINCOS_SIN
+ UNSPEC_XTRACT_FRACT
+ UNSPEC_XTRACT_EXP
+ UNSPEC_FSCALE_FRACT
+ UNSPEC_FSCALE_EXP
+ UNSPEC_FPREM_F
+ UNSPEC_FPREM_U
+ UNSPEC_FPREM1_F
+ UNSPEC_FPREM1_U
+
+ UNSPEC_C2_FLAG
+ UNSPEC_FXAM_MEM
+
+ ;; SSP patterns
+ UNSPEC_SP_SET
+ UNSPEC_SP_TEST
+ UNSPEC_SP_TLS_SET
+ UNSPEC_SP_TLS_TEST
+
+ ;; SSSE3
+ UNSPEC_PSHUFB
+ UNSPEC_PSIGN
+ UNSPEC_PALIGNR
+
+ ;; For SSE4A support
+ UNSPEC_EXTRQI
+ UNSPEC_EXTRQ
+ UNSPEC_INSERTQI
+ UNSPEC_INSERTQ
+
+ ;; For SSE4.1 support
+ UNSPEC_BLENDV
+ UNSPEC_INSERTPS
+ UNSPEC_DP
+ UNSPEC_MOVNTDQA
+ UNSPEC_MPSADBW
+ UNSPEC_PHMINPOSUW
+ UNSPEC_PTEST
+ UNSPEC_ROUND
+
+ ;; For SSE4.2 support
+ UNSPEC_CRC32
+ UNSPEC_PCMPESTR
+ UNSPEC_PCMPISTR
+
+ ;; For FMA4 support
+ UNSPEC_FMA4_INTRINSIC
+ UNSPEC_FMA4_FMADDSUB
+ UNSPEC_FMA4_FMSUBADD
+ UNSPEC_XOP_UNSIGNED_CMP
+ UNSPEC_XOP_TRUEFALSE
+ UNSPEC_XOP_PERMUTE
+ UNSPEC_FRCZ
+
+ ;; For AES support
+ UNSPEC_AESENC
+ UNSPEC_AESENCLAST
+ UNSPEC_AESDEC
+ UNSPEC_AESDECLAST
+ UNSPEC_AESIMC
+ UNSPEC_AESKEYGENASSIST
+
+ ;; For PCLMUL support
+ UNSPEC_PCLMUL
+
+ ;; For AVX support
+ UNSPEC_PCMP
+ UNSPEC_VPERMIL
+ UNSPEC_VPERMIL2
+ UNSPEC_VPERMIL2F128
+ UNSPEC_MASKLOAD
+ UNSPEC_MASKSTORE
+ UNSPEC_CAST
+ UNSPEC_VTESTP
+])
+
+(define_c_enum "unspecv" [
+ UNSPECV_BLOCKAGE
+ UNSPECV_STACK_PROBE
+ UNSPECV_EMMS
+ UNSPECV_LDMXCSR
+ UNSPECV_STMXCSR
+ UNSPECV_FEMMS
+ UNSPECV_CLFLUSH
+ UNSPECV_ALIGN
+ UNSPECV_MONITOR
+ UNSPECV_MWAIT
+ UNSPECV_CMPXCHG
+ UNSPECV_XCHG
+ UNSPECV_LOCK
+ UNSPECV_PROLOGUE_USE
+ UNSPECV_CLD
+ UNSPECV_VZEROALL
+ UNSPECV_VZEROUPPER
+ UNSPECV_RDTSC
+ UNSPECV_RDTSCP
+ UNSPECV_RDPMC
+ UNSPECV_VSWAPMOV
+ UNSPECV_LLWP_INTRINSIC
+ UNSPECV_SLWP_INTRINSIC
+ UNSPECV_LWPVAL_INTRINSIC
+ UNSPECV_LWPINS_INTRINSIC
+])
;; Constants to represent pcomtrue/pcomfalse variants
(define_constants
@@ -356,7 +357,7 @@
push,pop,call,callv,leave,
str,bitmanip,
fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
- sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
+ sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
ssemuladd,sse4arg,lwp,
mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
@@ -371,7 +372,7 @@
(define_attr "unit" "integer,i387,sse,mmx,unknown"
(cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
(const_string "i387")
- (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
+ (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
(const_string "sse")
@@ -759,17 +760,31 @@
;; Used in signed and unsigned divisions.
(define_code_iterator any_div [div udiv])
+(define_code_attr extract_code
+ [(div "SIGN_EXTRACT") (udiv "ZERO_EXTRACT")])
;; Instruction prefix for signed and unsigned operations.
(define_code_attr sgnprefix [(sign_extend "i") (zero_extend "")
(div "i") (udiv "")])
-;; All single word integer modes.
+;; 64bit single word integer modes.
+(define_mode_iterator SWI1248x [QI HI SI DI])
+
+;; 64bit single word integer modes without QImode and HImode.
+(define_mode_iterator SWI48x [SI DI])
+
+;; Single word integer modes.
(define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
+;; Single word integer modes without SImode and DImode.
+(define_mode_iterator SWI12 [QI HI])
+
;; Single word integer modes without DImode.
(define_mode_iterator SWI124 [QI HI SI])
+;; Single word integer modes without QImode and DImode.
+(define_mode_iterator SWI24 [HI SI])
+
;; Single word integer modes without QImode.
(define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")])
@@ -1584,13 +1599,47 @@
;; Move instructions.
-;; General case of fullword move.
+(define_expand "movoi"
+ [(set (match_operand:OI 0 "nonimmediate_operand" "")
+ (match_operand:OI 1 "general_operand" ""))]
+ "TARGET_AVX"
+ "ix86_expand_move (OImode, operands); DONE;")
-(define_expand "movsi"
- [(set (match_operand:SI 0 "nonimmediate_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
+(define_expand "movti"
+ [(set (match_operand:TI 0 "nonimmediate_operand" "")
+ (match_operand:TI 1 "nonimmediate_operand" ""))]
+ "TARGET_64BIT || TARGET_SSE"
+{
+ if (TARGET_64BIT)
+ ix86_expand_move (TImode, operands);
+ else if (push_operand (operands[0], TImode))
+ ix86_expand_push (TImode, operands[1]);
+ else
+ ix86_expand_vector_move (TImode, operands);
+ DONE;
+})
+
+;; This expands to what emit_move_complex would generate if we didn't
+;; have a movti pattern. Having this avoids problems with reload on
+;; 32-bit targets when SSE is present, but doesn't seem to be harmful
+;; to have around all the time.
+(define_expand "movcdi"
+ [(set (match_operand:CDI 0 "nonimmediate_operand" "")
+ (match_operand:CDI 1 "general_operand" ""))]
""
- "ix86_expand_move (SImode, operands); DONE;")
+{
+ if (push_operand (operands[0], CDImode))
+ emit_move_complex_push (CDImode, operands[0], operands[1]);
+ else
+ emit_move_complex_parts (operands[0], operands[1]);
+ DONE;
+})
+
+(define_expand "mov<mode>"
+ [(set (match_operand:SWI1248x 0 "nonimmediate_operand" "")
+ (match_operand:SWI1248x 1 "general_operand" ""))]
+ ""
+ "ix86_expand_move (<MODE>mode, operands); DONE;")
;; Push/pop instructions. They are separate since autoinc/dec is not a
;; general_operand.
@@ -1601,6 +1650,79 @@
;; targets without our curiosities, and it is just as easy to represent
;; this differently.
+(define_insn "*pushdi2_rex64"
+ [(set (match_operand:DI 0 "push_operand" "=<,!<")
+ (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
+ "TARGET_64BIT"
+ "@
+ push{q}\t%1
+ #"
+ [(set_attr "type" "push,multi")
+ (set_attr "mode" "DI")])
+
+;; Convert impossible pushes of immediate to existing instructions.
+;; First try to get scratch register and go through it. In case this
+;; fails, push sign extended lower part first and then overwrite
+;; upper part by 32bit move.
+(define_peephole2
+ [(match_scratch:DI 2 "r")
+ (set (match_operand:DI 0 "push_operand" "")
+ (match_operand:DI 1 "immediate_operand" ""))]
+ "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
+ && !x86_64_immediate_operand (operands[1], DImode)"
+ [(set (match_dup 2) (match_dup 1))
+ (set (match_dup 0) (match_dup 2))]
+ "")
+
+;; We need to define this as both peepholer and splitter for case
+;; peephole2 pass is not run.
+;; "&& 1" is needed to keep it from matching the previous pattern.
+(define_peephole2
+ [(set (match_operand:DI 0 "push_operand" "")
+ (match_operand:DI 1 "immediate_operand" ""))]
+ "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
+ && !x86_64_immediate_operand (operands[1], DImode) && 1"
+ [(set (match_dup 0) (match_dup 1))
+ (set (match_dup 2) (match_dup 3))]
+{
+ split_di (&operands[1], 1, &operands[2], &operands[3]);
+
+ operands[1] = gen_lowpart (DImode, operands[2]);
+ operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
+ GEN_INT (4)));
+})
+
+(define_split
+ [(set (match_operand:DI 0 "push_operand" "")
+ (match_operand:DI 1 "immediate_operand" ""))]
+ "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
+ ? epilogue_completed : reload_completed)
+ && !symbolic_operand (operands[1], DImode)
+ && !x86_64_immediate_operand (operands[1], DImode)"
+ [(set (match_dup 0) (match_dup 1))
+ (set (match_dup 2) (match_dup 3))]
+{
+ split_di (&operands[1], 1, &operands[2], &operands[3]);
+
+ operands[1] = gen_lowpart (DImode, operands[2]);
+ operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
+ GEN_INT (4)));
+})
+
+(define_insn "*pushdi2"
+ [(set (match_operand:DI 0 "push_operand" "=<")
+ (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
+ "!TARGET_64BIT"
+ "#")
+
+(define_split
+ [(set (match_operand:DI 0 "push_operand" "")
+ (match_operand:DI 1 "general_operand" ""))]
+ "!TARGET_64BIT && reload_completed
+ && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
+ [(const_int 0)]
+ "ix86_split_long_move (operands); DONE;")
+
(define_insn "*pushsi2"
[(set (match_operand:SI 0 "push_operand" "=<")
(match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
@@ -1609,70 +1731,402 @@
[(set_attr "type" "push")
(set_attr "mode" "SI")])
+;; emit_push_insn when it calls move_by_pieces requires an insn to
+;; "push a byte/word". But actually we use pushl, which has the effect
+;; of rounding the amount pushed up to a word.
+
;; For 64BIT abi we always round up to 8 bytes.
-(define_insn "*pushsi2_rex64"
- [(set (match_operand:SI 0 "push_operand" "=X")
- (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
+(define_insn "*push<mode>2_rex64"
+ [(set (match_operand:SWI124 0 "push_operand" "=X")
+ (match_operand:SWI124 1 "nonmemory_no_elim_operand" "r<i>"))]
"TARGET_64BIT"
"push{q}\t%q1"
[(set_attr "type" "push")
- (set_attr "mode" "SI")])
+ (set_attr "mode" "DI")])
-(define_insn "*pushsi2_prologue"
- [(set (match_operand:SI 0 "push_operand" "=<")
- (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
- (clobber (mem:BLK (scratch)))]
+(define_insn "*push<mode>2"
+ [(set (match_operand:SWI12 0 "push_operand" "=X")
+ (match_operand:SWI12 1 "nonmemory_no_elim_operand" "rn"))]
"!TARGET_64BIT"
- "push{l}\t%1"
+ "push{l}\t%k1"
[(set_attr "type" "push")
(set_attr "mode" "SI")])
-(define_insn "*popsi1_epilogue"
+(define_insn "*push<mode>2_prologue"
+ [(set (match_operand:P 0 "push_operand" "=<")
+ (match_operand:P 1 "general_no_elim_operand" "r<i>*m"))
+ (clobber (mem:BLK (scratch)))]
+ ""
+ "push{<imodesuffix>}\t%1"
+ [(set_attr "type" "push")
+ (set_attr "mode" "<MODE>")])
+
+(define_insn "popdi1"
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
+ (mem:DI (reg:DI SP_REG)))
+ (set (reg:DI SP_REG)
+ (plus:DI (reg:DI SP_REG) (const_int 8)))]
+ "TARGET_64BIT"
+ "pop{q}\t%0"
+ [(set_attr "type" "pop")
+ (set_attr "mode" "DI")])
+
+(define_insn "popsi1"
[(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
(mem:SI (reg:SI SP_REG)))
(set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG) (const_int 4)))
- (clobber (mem:BLK (scratch)))]
+ (plus:SI (reg:SI SP_REG) (const_int 4)))]
"!TARGET_64BIT"
"pop{l}\t%0"
[(set_attr "type" "pop")
(set_attr "mode" "SI")])
-(define_insn "popsi1"
+(define_insn "*popdi1_epilogue"
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
+ (mem:DI (reg:DI SP_REG)))
+ (set (reg:DI SP_REG)
+ (plus:DI (reg:DI SP_REG) (const_int 8)))
+ (clobber (mem:BLK (scratch)))]
+ "TARGET_64BIT"
+ "pop{q}\t%0"
+ [(set_attr "type" "pop")
+ (set_attr "mode" "DI")])
+
+(define_insn "*popsi1_epilogue"
[(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
(mem:SI (reg:SI SP_REG)))
(set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG) (const_int 4)))]
+ (plus:SI (reg:SI SP_REG) (const_int 4)))
+ (clobber (mem:BLK (scratch)))]
"!TARGET_64BIT"
"pop{l}\t%0"
[(set_attr "type" "pop")
(set_attr "mode" "SI")])
-(define_insn "*movsi_xor"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "const0_operand" ""))
+(define_insn "*mov<mode>_xor"
+ [(set (match_operand:SWI48 0 "register_operand" "=r")
+ (match_operand:SWI48 1 "const0_operand" ""))
(clobber (reg:CC FLAGS_REG))]
"reload_completed"
- "xor{l}\t%0, %0"
+ "xor{l}\t%k0, %k0"
[(set_attr "type" "alu1")
(set_attr "mode" "SI")
(set_attr "length_immediate" "0")])
-(define_insn "*movsi_or"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "immediate_operand" "i"))
+(define_insn "*mov<mode>_or"
+ [(set (match_operand:SWI48 0 "register_operand" "=r")
+ (match_operand:SWI48 1 "const_int_operand" ""))
(clobber (reg:CC FLAGS_REG))]
"reload_completed
&& operands[1] == constm1_rtx"
-{
- operands[1] = constm1_rtx;
- return "or{l}\t{%1, %0|%0, %1}";
-}
+ "or{<imodesuffix>}\t{%1, %0|%0, %1}"
[(set_attr "type" "alu1")
- (set_attr "mode" "SI")
+ (set_attr "mode" "<MODE>")
(set_attr "length_immediate" "1")])
-(define_insn "*movsi_1"
+(define_insn "*movoi_internal_avx"
+ [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
+ (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
+ "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+{
+ switch (which_alternative)
+ {
+ case 0:
+ return "vxorps\t%0, %0, %0";
+ case 1:
+ case 2:
+ if (misaligned_operand (operands[0], OImode)
+ || misaligned_operand (operands[1], OImode))
+ return "vmovdqu\t{%1, %0|%0, %1}";
+ else
+ return "vmovdqa\t{%1, %0|%0, %1}";
+ default:
+ gcc_unreachable ();
+ }
+}
+ [(set_attr "type" "sselog1,ssemov,ssemov")
+ (set_attr "prefix" "vex")
+ (set_attr "mode" "OI")])
+
+(define_insn "*movti_internal_rex64"
+ [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
+ (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
+ "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+{
+ switch (which_alternative)
+ {
+ case 0:
+ case 1:
+ return "#";
+ case 2:
+ if (get_attr_mode (insn) == MODE_V4SF)
+ return "%vxorps\t%0, %d0";
+ else
+ return "%vpxor\t%0, %d0";
+ case 3:
+ case 4:
+ /* TDmode values are passed as TImode on the stack. Moving them
+ to stack may result in unaligned memory access. */
+ if (misaligned_operand (operands[0], TImode)
+ || misaligned_operand (operands[1], TImode))
+ {
+ if (get_attr_mode (insn) == MODE_V4SF)
+ return "%vmovups\t{%1, %0|%0, %1}";
+ else
+ return "%vmovdqu\t{%1, %0|%0, %1}";
+ }
+ else
+ {
+ if (get_attr_mode (insn) == MODE_V4SF)
+ return "%vmovaps\t{%1, %0|%0, %1}";
+ else
+ return "%vmovdqa\t{%1, %0|%0, %1}";
+ }
+ default:
+ gcc_unreachable ();
+ }
+}
+ [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
+ (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
+ (set (attr "mode")
+ (cond [(eq_attr "alternative" "2,3")
+ (if_then_else
+ (ne (symbol_ref "optimize_function_for_size_p (cfun)")
+ (const_int 0))
+ (const_string "V4SF")
+ (const_string "TI"))
+ (eq_attr "alternative" "4")
+ (if_then_else
+ (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
+ (const_int 0))
+ (ne (symbol_ref "optimize_function_for_size_p (cfun)")
+ (const_int 0)))
+ (const_string "V4SF")
+ (const_string "TI"))]
+ (const_string "DI")))])
+
+(define_split
+ [(set (match_operand:TI 0 "nonimmediate_operand" "")
+ (match_operand:TI 1 "general_operand" ""))]
+ "reload_completed
+ && !SSE_REG_P (operands[0]) && !SSE_REG_P (operands[1])"
+ [(const_int 0)]
+ "ix86_split_long_move (operands); DONE;")
+
+(define_insn "*movti_internal_sse"
+ [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
+ (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
+ "TARGET_SSE && !TARGET_64BIT
+ && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+{
+ switch (which_alternative)
+ {
+ case 0:
+ if (get_attr_mode (insn) == MODE_V4SF)
+ return "%vxorps\t%0, %d0";
+ else
+ return "%vpxor\t%0, %d0";
+ case 1:
+ case 2:
+ /* TDmode values are passed as TImode on the stack. Moving them
+ to stack may result in unaligned memory access. */
+ if (misaligned_operand (operands[0], TImode)
+ || misaligned_operand (operands[1], TImode))
+ {
+ if (get_attr_mode (insn) == MODE_V4SF)
+ return "%vmovups\t{%1, %0|%0, %1}";
+ else
+ return "%vmovdqu\t{%1, %0|%0, %1}";
+ }
+ else
+ {
+ if (get_attr_mode (insn) == MODE_V4SF)
+ return "%vmovaps\t{%1, %0|%0, %1}";
+ else
+ return "%vmovdqa\t{%1, %0|%0, %1}";
+ }
+ default:
+ gcc_unreachable ();
+ }
+}
+ [(set_attr "type" "sselog1,ssemov,ssemov")
+ (set_attr "prefix" "maybe_vex")
+ (set (attr "mode")
+ (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
+ (ne (symbol_ref "optimize_function_for_size_p (cfun)")
+ (const_int 0)))
+ (const_string "V4SF")
+ (and (eq_attr "alternative" "2")
+ (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
+ (const_int 0)))
+ (const_string "V4SF")]
+ (const_string "TI")))])
+
+(define_insn "*movdi_internal_rex64"
+ [(set (match_operand:DI 0 "nonimmediate_operand"
+ "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
+ (match_operand:DI 1 "general_operand"
+ "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
+ "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+{
+ switch (get_attr_type (insn))
+ {
+ case TYPE_SSECVT:
+ if (SSE_REG_P (operands[0]))
+ return "movq2dq\t{%1, %0|%0, %1}";
+ else
+ return "movdq2q\t{%1, %0|%0, %1}";
+
+ case TYPE_SSEMOV:
+ if (TARGET_AVX)
+ {
+ if (get_attr_mode (insn) == MODE_TI)
+ return "vmovdqa\t{%1, %0|%0, %1}";
+ else
+ return "vmovq\t{%1, %0|%0, %1}";
+ }
+
+ if (get_attr_mode (insn) == MODE_TI)
+ return "movdqa\t{%1, %0|%0, %1}";
+ /* FALLTHRU */
+
+ case TYPE_MMXMOV:
+ /* Moves from and into integer register is done using movd
+ opcode with REX prefix. */
+ if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
+ return "movd\t{%1, %0|%0, %1}";
+ return "movq\t{%1, %0|%0, %1}";
+
+ case TYPE_SSELOG1:
+ return "%vpxor\t%0, %d0";
+
+ case TYPE_MMX:
+ return "pxor\t%0, %0";
+
+ case TYPE_MULTI:
+ return "#";
+
+ case TYPE_LEA:
+ return "lea{q}\t{%a1, %0|%0, %a1}";
+
+ default:
+ gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
+ if (get_attr_mode (insn) == MODE_SI)
+ return "mov{l}\t{%k1, %k0|%k0, %k1}";
+ else if (which_alternative == 2)
+ return "movabs{q}\t{%1, %0|%0, %1}";
+ else
+ return "mov{q}\t{%1, %0|%0, %1}";
+ }
+}
+ [(set (attr "type")
+ (cond [(eq_attr "alternative" "5")
+ (const_string "mmx")
+ (eq_attr "alternative" "6,7,8,9,10")
+ (const_string "mmxmov")
+ (eq_attr "alternative" "11")
+ (const_string "sselog1")
+ (eq_attr "alternative" "12,13,14,15,16")
+ (const_string "ssemov")
+ (eq_attr "alternative" "17,18")
+ (const_string "ssecvt")
+ (eq_attr "alternative" "4")
+ (const_string "multi")
+ (match_operand:DI 1 "pic_32bit_operand" "")
+ (const_string "lea")
+ ]
+ (const_string "imov")))
+ (set (attr "modrm")
+ (if_then_else
+ (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
+ (const_string "0")
+ (const_string "*")))
+ (set (attr "length_immediate")
+ (if_then_else
+ (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
+ (const_string "8")
+ (const_string "*")))
+ (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
+ (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
+ (set (attr "prefix")
+ (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
+ (const_string "maybe_vex")
+ (const_string "orig")))
+ (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
+
+;; Convert impossible stores of immediate to existing instructions.
+;; First try to get scratch register and go through it. In case this
+;; fails, move by 32bit parts.
+(define_peephole2
+ [(match_scratch:DI 2 "r")
+ (set (match_operand:DI 0 "memory_operand" "")
+ (match_operand:DI 1 "immediate_operand" ""))]
+ "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
+ && !x86_64_immediate_operand (operands[1], DImode)"
+ [(set (match_dup 2) (match_dup 1))
+ (set (match_dup 0) (match_dup 2))]
+ "")
+
+;; We need to define this as both peepholer and splitter for case
+;; peephole2 pass is not run.
+;; "&& 1" is needed to keep it from matching the previous pattern.
+(define_peephole2
+ [(set (match_operand:DI 0 "memory_operand" "")
+ (match_operand:DI 1 "immediate_operand" ""))]
+ "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
+ && !x86_64_immediate_operand (operands[1], DImode) && 1"
+ [(set (match_dup 2) (match_dup 3))
+ (set (match_dup 4) (match_dup 5))]
+ "split_di (&operands[0], 2, &operands[2], &operands[4]);")
+
+(define_split
+ [(set (match_operand:DI 0 "memory_operand" "")
+ (match_operand:DI 1 "immediate_operand" ""))]
+ "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
+ ? epilogue_completed : reload_completed)
+ && !symbolic_operand (operands[1], DImode)
+ && !x86_64_immediate_operand (operands[1], DImode)"
+ [(set (match_dup 2) (match_dup 3))
+ (set (match_dup 4) (match_dup 5))]
+ "split_di (&operands[0], 2, &operands[2], &operands[4]);")
+
+(define_insn "*movdi_internal"
+ [(set (match_operand:DI 0 "nonimmediate_operand"
+ "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
+ (match_operand:DI 1 "general_operand"
+ "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
+ "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+ "@
+ #
+ #
+ pxor\t%0, %0
+ movq\t{%1, %0|%0, %1}
+ movq\t{%1, %0|%0, %1}
+ %vpxor\t%0, %d0
+ %vmovq\t{%1, %0|%0, %1}
+ %vmovdqa\t{%1, %0|%0, %1}
+ %vmovq\t{%1, %0|%0, %1}
+ xorps\t%0, %0
+ movlps\t{%1, %0|%0, %1}
+ movaps\t{%1, %0|%0, %1}
+ movlps\t{%1, %0|%0, %1}"
+ [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
+ (set (attr "prefix")
+ (if_then_else (eq_attr "alternative" "5,6,7,8")
+ (const_string "vex")
+ (const_string "orig")))
+ (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
+
+(define_split
+ [(set (match_operand:DI 0 "nonimmediate_operand" "")
+ (match_operand:DI 1 "general_operand" ""))]
+ "!TARGET_64BIT && reload_completed
+ && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))
+ && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
+ [(const_int 0)]
+ "ix86_split_long_move (operands); DONE;")
+
+(define_insn "*movsi_internal"
[(set (match_operand:SI 0 "nonimmediate_operand"
"=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
(match_operand:SI 1 "general_operand"
@@ -1710,7 +2164,7 @@
return "movd\t{%1, %0|%0, %1}";
case TYPE_LEA:
- return "lea{l}\t{%1, %0|%0, %1}";
+ return "lea{l}\t{%a1, %0|%0, %a1}";
default:
gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
@@ -1752,74 +2206,7 @@
]
(const_string "SI")))])
-;; Stores and loads of ax to arbitrary constant address.
-;; We fake an second form of instruction to force reload to load address
-;; into register when rax is not available
-(define_insn "*movabssi_1_rex64"
- [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
- (match_operand:SI 1 "nonmemory_operand" "a,er"))]
- "TARGET_64BIT && ix86_check_movabs (insn, 0)"
- "@
- movabs{l}\t{%1, %P0|%P0, %1}
- mov{l}\t{%1, %a0|%a0, %1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0,*")
- (set_attr "memory" "store")
- (set_attr "mode" "SI")])
-
-(define_insn "*movabssi_2_rex64"
- [(set (match_operand:SI 0 "register_operand" "=a,r")
- (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
- "TARGET_64BIT && ix86_check_movabs (insn, 1)"
- "@
- movabs{l}\t{%P1, %0|%0, %P1}
- mov{l}\t{%a1, %0|%0, %a1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0")
- (set_attr "memory" "load")
- (set_attr "mode" "SI")])
-
-(define_insn "*swapsi"
- [(set (match_operand:SI 0 "register_operand" "+r")
- (match_operand:SI 1 "register_operand" "+r"))
- (set (match_dup 1)
- (match_dup 0))]
- ""
- "xchg{l}\t%1, %0"
- [(set_attr "type" "imov")
- (set_attr "mode" "SI")
- (set_attr "pent_pair" "np")
- (set_attr "athlon_decode" "vector")
- (set_attr "amdfam10_decode" "double")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "nonimmediate_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "ix86_expand_move (HImode, operands); DONE;")
-
-(define_insn "*pushhi2"
- [(set (match_operand:HI 0 "push_operand" "=X")
- (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
- "!TARGET_64BIT"
- "push{l}\t%k1"
- [(set_attr "type" "push")
- (set_attr "mode" "SI")])
-
-;; For 64BIT abi we always round up to 8 bytes.
-(define_insn "*pushhi2_rex64"
- [(set (match_operand:HI 0 "push_operand" "=X")
- (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
- "TARGET_64BIT"
- "push{q}\t%q1"
- [(set_attr "type" "push")
- (set_attr "mode" "DI")])
-
-(define_insn "*movhi_1"
+(define_insn "*movhi_internal"
[(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
(match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
"!(MEM_P (operands[0]) && MEM_P (operands[1]))"
@@ -1838,7 +2225,8 @@
}
}
[(set (attr "type")
- (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
+ (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
+ (const_int 0))
(const_string "imov")
(and (eq_attr "alternative" "0")
(ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
@@ -1870,121 +2258,6 @@
]
(const_string "HI")))])
-;; Stores and loads of ax to arbitrary constant address.
-;; We fake an second form of instruction to force reload to load address
-;; into register when rax is not available
-(define_insn "*movabshi_1_rex64"
- [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
- (match_operand:HI 1 "nonmemory_operand" "a,er"))]
- "TARGET_64BIT && ix86_check_movabs (insn, 0)"
- "@
- movabs{w}\t{%1, %P0|%P0, %1}
- mov{w}\t{%1, %a0|%a0, %1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0,*")
- (set_attr "memory" "store")
- (set_attr "mode" "HI")])
-
-(define_insn "*movabshi_2_rex64"
- [(set (match_operand:HI 0 "register_operand" "=a,r")
- (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
- "TARGET_64BIT && ix86_check_movabs (insn, 1)"
- "@
- movabs{w}\t{%P1, %0|%0, %P1}
- mov{w}\t{%a1, %0|%0, %a1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0")
- (set_attr "memory" "load")
- (set_attr "mode" "HI")])
-
-(define_insn "*swaphi_1"
- [(set (match_operand:HI 0 "register_operand" "+r")
- (match_operand:HI 1 "register_operand" "+r"))
- (set (match_dup 1)
- (match_dup 0))]
- "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
- "xchg{l}\t%k1, %k0"
- [(set_attr "type" "imov")
- (set_attr "mode" "SI")
- (set_attr "pent_pair" "np")
- (set_attr "athlon_decode" "vector")
- (set_attr "amdfam10_decode" "double")])
-
-;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
-(define_insn "*swaphi_2"
- [(set (match_operand:HI 0 "register_operand" "+r")
- (match_operand:HI 1 "register_operand" "+r"))
- (set (match_dup 1)
- (match_dup 0))]
- "TARGET_PARTIAL_REG_STALL"
- "xchg{w}\t%1, %0"
- [(set_attr "type" "imov")
- (set_attr "mode" "HI")
- (set_attr "pent_pair" "np")
- (set_attr "athlon_decode" "vector")])
-
-(define_expand "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
- (match_operand:HI 1 "general_operand" ""))]
- ""
-{
- if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
- FAIL;
- /* Don't generate memory->memory moves, go through a register */
- if (MEM_P (operands[0]) && MEM_P (operands[1]))
- operands[1] = force_reg (HImode, operands[1]);
-})
-
-(define_insn "*movstricthi_1"
- [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
- (match_operand:HI 1 "general_operand" "rn,m"))]
- "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
- "mov{w}\t{%1, %0|%0, %1}"
- [(set_attr "type" "imov")
- (set_attr "mode" "HI")])
-
-(define_insn "*movstricthi_xor"
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
- (match_operand:HI 1 "const0_operand" ""))
- (clobber (reg:CC FLAGS_REG))]
- "reload_completed"
- "xor{w}\t%0, %0"
- [(set_attr "type" "alu1")
- (set_attr "mode" "HI")
- (set_attr "length_immediate" "0")])
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "nonimmediate_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "ix86_expand_move (QImode, operands); DONE;")
-
-;; emit_push_insn when it calls move_by_pieces requires an insn to
-;; "push a byte". But actually we use pushl, which has the effect
-;; of rounding the amount pushed up to a word.
-
-(define_insn "*pushqi2"
- [(set (match_operand:QI 0 "push_operand" "=X")
- (match_operand:QI 1 "nonmemory_no_elim_operand" "rn"))]
- "!TARGET_64BIT"
- "push{l}\t%k1"
- [(set_attr "type" "push")
- (set_attr "mode" "SI")])
-
-;; For 64BIT abi we always round up to 8 bytes.
-(define_insn "*pushqi2_rex64"
- [(set (match_operand:QI 0 "push_operand" "=X")
- (match_operand:QI 1 "nonmemory_no_elim_operand" "qn"))]
- "TARGET_64BIT"
- "push{q}\t%q1"
- [(set_attr "type" "push")
- (set_attr "mode" "DI")])
-
;; Situation is quite tricky about when to choose full sized (SImode) move
;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
;; partial register dependency machines (such as AMD Athlon), where QImode
@@ -1995,7 +2268,7 @@
;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
;; register stall machines with, where we use QImode instructions, since
;; partial register stall can be caused there. Then we use movzx.
-(define_insn "*movqi_1"
+(define_insn "*movqi_internal"
[(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
(match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
"!(MEM_P (operands[0]) && MEM_P (operands[1]))"
@@ -2016,7 +2289,8 @@
(cond [(and (eq_attr "alternative" "5")
(not (match_operand:QI 1 "aligned_operand" "")))
(const_string "imovx")
- (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
+ (ne (symbol_ref "optimize_function_for_size_p (cfun)")
+ (const_int 0))
(const_string "imov")
(and (eq_attr "alternative" "3")
(ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
@@ -2045,7 +2319,7 @@
(const_int 0))
(and (eq (symbol_ref "optimize_function_for_size_p (cfun)")
(const_int 0))
- (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
+ (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
(const_int 0))))))
(const_string "SI")
;; Avoid partial register stalls when not using QImode arithmetic
@@ -2059,9 +2333,53 @@
]
(const_string "QI")))])
-(define_insn "*swapqi_1"
- [(set (match_operand:QI 0 "register_operand" "+r")
- (match_operand:QI 1 "register_operand" "+r"))
+;; Stores and loads of ax to arbitrary constant address.
+;; We fake an second form of instruction to force reload to load address
+;; into register when rax is not available
+(define_insn "*movabs<mode>_1"
+ [(set (mem:SWI1248x (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
+ (match_operand:SWI1248x 1 "nonmemory_operand" "a,er"))]
+ "TARGET_64BIT && ix86_check_movabs (insn, 0)"
+ "@
+ movabs{<imodesuffix>}\t{%1, %P0|%P0, %1}
+ mov{<imodesuffix>}\t{%1, %a0|%a0, %1}"
+ [(set_attr "type" "imov")
+ (set_attr "modrm" "0,*")
+ (set_attr "length_address" "8,0")
+ (set_attr "length_immediate" "0,*")
+ (set_attr "memory" "store")
+ (set_attr "mode" "<MODE>")])
+
+(define_insn "*movabs<mode>_2"
+ [(set (match_operand:SWI1248x 0 "register_operand" "=a,r")
+ (mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
+ "TARGET_64BIT && ix86_check_movabs (insn, 1)"
+ "@
+ movabs{<imodesuffix>}\t{%P1, %0|%0, %P1}
+ mov{<imodesuffix>}\t{%a1, %0|%0, %a1}"
+ [(set_attr "type" "imov")
+ (set_attr "modrm" "0,*")
+ (set_attr "length_address" "8,0")
+ (set_attr "length_immediate" "0")
+ (set_attr "memory" "load")
+ (set_attr "mode" "<MODE>")])
+
+(define_insn "*swap<mode>"
+ [(set (match_operand:SWI48 0 "register_operand" "+r")
+ (match_operand:SWI48 1 "register_operand" "+r"))
+ (set (match_dup 1)
+ (match_dup 0))]
+ ""
+ "xchg{<imodesuffix>}\t%1, %0"
+ [(set_attr "type" "imov")
+ (set_attr "mode" "<MODE>")
+ (set_attr "pent_pair" "np")
+ (set_attr "athlon_decode" "vector")
+ (set_attr "amdfam10_decode" "double")])
+
+(define_insn "*swap<mode>_1"
+ [(set (match_operand:SWI12 0 "register_operand" "+r")
+ (match_operand:SWI12 1 "register_operand" "+r"))
(set (match_dup 1)
(match_dup 0))]
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
@@ -2070,78 +2388,70 @@
(set_attr "mode" "SI")
(set_attr "pent_pair" "np")
(set_attr "athlon_decode" "vector")
- (set_attr "amdfam10_decode" "vector")])
+ (set_attr "amdfam10_decode" "double")])
-;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
-(define_insn "*swapqi_2"
- [(set (match_operand:QI 0 "register_operand" "+q")
- (match_operand:QI 1 "register_operand" "+q"))
+;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL
+;; is disabled for AMDFAM10
+(define_insn "*swap<mode>_2"
+ [(set (match_operand:SWI12 0 "register_operand" "+<r>")
+ (match_operand:SWI12 1 "register_operand" "+<r>"))
(set (match_dup 1)
(match_dup 0))]
"TARGET_PARTIAL_REG_STALL"
- "xchg{b}\t%1, %0"
+ "xchg{<imodesuffix>}\t%1, %0"
[(set_attr "type" "imov")
- (set_attr "mode" "QI")
+ (set_attr "mode" "<MODE>")
(set_attr "pent_pair" "np")
(set_attr "athlon_decode" "vector")])
-(define_expand "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
- (match_operand:QI 1 "general_operand" ""))]
+(define_expand "movstrict<mode>"
+ [(set (strict_low_part (match_operand:SWI12 0 "nonimmediate_operand" ""))
+ (match_operand:SWI12 1 "general_operand" ""))]
""
{
if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
FAIL;
- /* Don't generate memory->memory moves, go through a register. */
+ /* Don't generate memory->memory moves, go through a register */
if (MEM_P (operands[0]) && MEM_P (operands[1]))
- operands[1] = force_reg (QImode, operands[1]);
+ operands[1] = force_reg (<MODE>mode, operands[1]);
})
-(define_insn "*movstrictqi_1"
- [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
- (match_operand:QI 1 "general_operand" "*qn,m"))]
- "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
+(define_insn "*movstrict<mode>_1"
+ [(set (strict_low_part
+ (match_operand:SWI12 0 "nonimmediate_operand" "+<r>m,<r>"))
+ (match_operand:SWI12 1 "general_operand" "<r>n,m"))]
+ "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
- "mov{b}\t{%1, %0|%0, %1}"
+ "mov{<imodesuffix>}\t{%1, %0|%0, %1}"
[(set_attr "type" "imov")
- (set_attr "mode" "QI")])
+ (set_attr "mode" "<MODE>")])
-(define_insn "*movstrictqi_xor"
- [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
- (match_operand:QI 1 "const0_operand" ""))
+(define_insn "*movstrict<mode>_xor"
+ [(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>"))
+ (match_operand:SWI12 1 "const0_operand" ""))
(clobber (reg:CC FLAGS_REG))]
"reload_completed"
- "xor{b}\t%0, %0"
+ "xor{<imodesuffix>}\t%0, %0"
[(set_attr "type" "alu1")
- (set_attr "mode" "QI")
+ (set_attr "mode" "<MODE>")
(set_attr "length_immediate" "0")])
-(define_insn "*movsi_extv_1"
- [(set (match_operand:SI 0 "register_operand" "=R")
- (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
- (const_int 8)
- (const_int 8)))]
- ""
- "movs{bl|x}\t{%h1, %0|%0, %h1}"
- [(set_attr "type" "imovx")
- (set_attr "mode" "SI")])
-
-(define_insn "*movhi_extv_1"
- [(set (match_operand:HI 0 "register_operand" "=R")
- (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
- (const_int 8)
- (const_int 8)))]
+(define_insn "*mov<mode>_extv_1"
+ [(set (match_operand:SWI24 0 "register_operand" "=R")
+ (sign_extract:SWI24 (match_operand 1 "ext_register_operand" "Q")
+ (const_int 8)
+ (const_int 8)))]
""
"movs{bl|x}\t{%h1, %k0|%k0, %h1}"
[(set_attr "type" "imovx")
(set_attr "mode" "SI")])
-(define_insn "*movqi_extv_1"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
+(define_insn "*movqi_extv_1_rex64"
+ [(set (match_operand:QI 0 "register_operand" "=Q,?R")
(sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
(const_int 8)
(const_int 8)))]
- "!TARGET_64BIT"
+ "TARGET_64BIT"
{
switch (get_attr_type (insn))
{
@@ -2163,12 +2473,12 @@
(const_string "SI")
(const_string "QI")))])
-(define_insn "*movqi_extv_1_rex64"
- [(set (match_operand:QI 0 "register_operand" "=Q,?R")
+(define_insn "*movqi_extv_1"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
(sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
(const_int 8)
(const_int 8)))]
- "TARGET_64BIT"
+ "!TARGET_64BIT"
{
switch (get_attr_type (insn))
{
@@ -2190,63 +2500,23 @@
(const_string "SI")
(const_string "QI")))])
-;; Stores and loads of ax to arbitrary constant address.
-;; We fake an second form of instruction to force reload to load address
-;; into register when rax is not available
-(define_insn "*movabsqi_1_rex64"
- [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
- (match_operand:QI 1 "nonmemory_operand" "a,er"))]
- "TARGET_64BIT && ix86_check_movabs (insn, 0)"
- "@
- movabs{b}\t{%1, %P0|%P0, %1}
- mov{b}\t{%1, %a0|%a0, %1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0,*")
- (set_attr "memory" "store")
- (set_attr "mode" "QI")])
-
-(define_insn "*movabsqi_2_rex64"
- [(set (match_operand:QI 0 "register_operand" "=a,r")
- (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
- "TARGET_64BIT && ix86_check_movabs (insn, 1)"
- "@
- movabs{b}\t{%P1, %0|%0, %P1}
- mov{b}\t{%a1, %0|%0, %a1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0")
- (set_attr "memory" "load")
- (set_attr "mode" "QI")])
-
-(define_insn "*movdi_extzv_1"
- [(set (match_operand:DI 0 "register_operand" "=R")
- (zero_extract:DI (match_operand 1 "ext_register_operand" "Q")
- (const_int 8)
- (const_int 8)))]
- "TARGET_64BIT"
- "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
- [(set_attr "type" "imovx")
- (set_attr "mode" "SI")])
-
-(define_insn "*movsi_extzv_1"
- [(set (match_operand:SI 0 "register_operand" "=R")
- (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
- (const_int 8)
- (const_int 8)))]
+(define_insn "*mov<mode>_extzv_1"
+ [(set (match_operand:SWI48 0 "register_operand" "=R")
+ (zero_extract:SWI48 (match_operand 1 "ext_register_operand" "Q")
+ (const_int 8)
+ (const_int 8)))]
""
- "movz{bl|x}\t{%h1, %0|%0, %h1}"
+ "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
[(set_attr "type" "imovx")
(set_attr "mode" "SI")])
-(define_insn "*movqi_extzv_2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
- (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
- (const_int 8)
- (const_int 8)) 0))]
- "!TARGET_64BIT"
+(define_insn "*movqi_extzv_2_rex64"
+ [(set (match_operand:QI 0 "register_operand" "=Q,?R")
+ (subreg:QI
+ (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
+ (const_int 8)
+ (const_int 8)) 0))]
+ "TARGET_64BIT"
{
switch (get_attr_type (insn))
{
@@ -2257,10 +2527,9 @@
}
}
[(set (attr "type")
- (if_then_else (and (match_operand:QI 0 "register_operand" "")
- (ior (not (match_operand:QI 0 "q_regs_operand" ""))
- (ne (symbol_ref "TARGET_MOVX")
- (const_int 0))))
+ (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
+ (ne (symbol_ref "TARGET_MOVX")
+ (const_int 0)))
(const_string "imovx")
(const_string "imov")))
(set (attr "mode")
@@ -2268,12 +2537,13 @@
(const_string "SI")
(const_string "QI")))])
-(define_insn "*movqi_extzv_2_rex64"
- [(set (match_operand:QI 0 "register_operand" "=Q,?R")
- (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
- (const_int 8)
- (const_int 8)) 0))]
- "TARGET_64BIT"
+(define_insn "*movqi_extzv_2"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
+ (subreg:QI
+ (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
+ (const_int 8)
+ (const_int 8)) 0))]
+ "!TARGET_64BIT"
{
switch (get_attr_type (insn))
{
@@ -2284,9 +2554,10 @@
}
}
[(set (attr "type")
- (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
- (ne (symbol_ref "TARGET_MOVX")
- (const_int 0)))
+ (if_then_else (and (match_operand:QI 0 "register_operand" "")
+ (ior (not (match_operand:QI 0 "q_regs_operand" ""))
+ (ne (symbol_ref "TARGET_MOVX")
+ (const_int 0))))
(const_string "imovx")
(const_string "imov")))
(set (attr "mode")
@@ -2294,32 +2565,30 @@
(const_string "SI")
(const_string "QI")))])
-(define_insn "movsi_insv_1"
- [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
- (const_int 8)
- (const_int 8))
- (match_operand:SI 1 "general_operand" "Qmn"))]
- "!TARGET_64BIT"
- "mov{b}\t{%b1, %h0|%h0, %b1}"
- [(set_attr "type" "imov")
- (set_attr "mode" "QI")])
+(define_expand "mov<mode>_insv_1"
+ [(set (zero_extract:SWI48 (match_operand 0 "ext_register_operand" "")
+ (const_int 8)
+ (const_int 8))
+ (match_operand:SWI48 1 "nonmemory_operand" ""))]
+ ""
+ "")
-(define_insn "*movsi_insv_1_rex64"
- [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
- (const_int 8)
- (const_int 8))
- (match_operand:SI 1 "nonmemory_operand" "Qn"))]
+(define_insn "*mov<mode>_insv_1_rex64"
+ [(set (zero_extract:SWI48x (match_operand 0 "ext_register_operand" "+Q")
+ (const_int 8)
+ (const_int 8))
+ (match_operand:SWI48x 1 "nonmemory_operand" "Qn"))]
"TARGET_64BIT"
"mov{b}\t{%b1, %h0|%h0, %b1}"
[(set_attr "type" "imov")
(set_attr "mode" "QI")])
-(define_insn "movdi_insv_1_rex64"
- [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q")
+(define_insn "*movsi_insv_1"
+ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
(const_int 8)
(const_int 8))
- (match_operand:DI 1 "nonmemory_operand" "Qn"))]
- "TARGET_64BIT"
+ (match_operand:SI 1 "general_operand" "Qmn"))]
+ "!TARGET_64BIT"
"mov{b}\t{%b1, %h0|%h0, %b1}"
[(set_attr "type" "imov")
(set_attr "mode" "QI")])
@@ -2334,455 +2603,202 @@
"mov{b}\t{%h1, %h0|%h0, %h1}"
[(set_attr "type" "imov")
(set_attr "mode" "QI")])
+
+;; Floating point move instructions.
-(define_expand "movdi"
- [(set (match_operand:DI 0 "nonimmediate_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "ix86_expand_move (DImode, operands); DONE;")
-
-(define_insn "*pushdi"
- [(set (match_operand:DI 0 "push_operand" "=<")
- (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
- "!TARGET_64BIT"
- "#")
-
-(define_insn "*pushdi2_rex64"
- [(set (match_operand:DI 0 "push_operand" "=<,!<")
- (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
- "TARGET_64BIT"
- "@
- push{q}\t%1
- #"
- [(set_attr "type" "push,multi")
- (set_attr "mode" "DI")])
-
-;; Convert impossible pushes of immediate to existing instructions.
-;; First try to get scratch register and go through it. In case this
-;; fails, push sign extended lower part first and then overwrite
-;; upper part by 32bit move.
-(define_peephole2
- [(match_scratch:DI 2 "r")
- (set (match_operand:DI 0 "push_operand" "")
- (match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
- && !x86_64_immediate_operand (operands[1], DImode)"
- [(set (match_dup 2) (match_dup 1))
- (set (match_dup 0) (match_dup 2))]
- "")
-
-;; We need to define this as both peepholer and splitter for case
-;; peephole2 pass is not run.
-;; "&& 1" is needed to keep it from matching the previous pattern.
-(define_peephole2
- [(set (match_operand:DI 0 "push_operand" "")
- (match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
- && !x86_64_immediate_operand (operands[1], DImode) && 1"
- [(set (match_dup 0) (match_dup 1))
- (set (match_dup 2) (match_dup 3))]
-{
- split_di (&operands[1], 1, &operands[2], &operands[3]);
-
- operands[1] = gen_lowpart (DImode, operands[2]);
- operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
- GEN_INT (4)));
-})
-
-(define_split
- [(set (match_operand:DI 0 "push_operand" "")
- (match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
- ? epilogue_completed : reload_completed)
- && !symbolic_operand (operands[1], DImode)
- && !x86_64_immediate_operand (operands[1], DImode)"
- [(set (match_dup 0) (match_dup 1))
- (set (match_dup 2) (match_dup 3))]
+(define_expand "movtf"
+ [(set (match_operand:TF 0 "nonimmediate_operand" "")
+ (match_operand:TF 1 "nonimmediate_operand" ""))]
+ "TARGET_SSE2"
{
- split_di (&operands[1], 1, &operands[2], &operands[3]);
-
- operands[1] = gen_lowpart (DImode, operands[2]);
- operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
- GEN_INT (4)));
+ ix86_expand_move (TFmode, operands);
+ DONE;
})
-(define_insn "*pushdi2_prologue_rex64"
- [(set (match_operand:DI 0 "push_operand" "=<")
- (match_operand:DI 1 "general_no_elim_operand" "re*m"))
- (clobber (mem:BLK (scratch)))]
- "TARGET_64BIT"
- "push{q}\t%1"
- [(set_attr "type" "push")
- (set_attr "mode" "DI")])
-
-(define_insn "*popdi1_epilogue_rex64"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
- (mem:DI (reg:DI SP_REG)))
- (set (reg:DI SP_REG)
- (plus:DI (reg:DI SP_REG) (const_int 8)))
- (clobber (mem:BLK (scratch)))]
- "TARGET_64BIT"
- "pop{q}\t%0"
- [(set_attr "type" "pop")
- (set_attr "mode" "DI")])
-
-(define_insn "popdi1"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
- (mem:DI (reg:DI SP_REG)))
- (set (reg:DI SP_REG)
- (plus:DI (reg:DI SP_REG) (const_int 8)))]
- "TARGET_64BIT"
- "pop{q}\t%0"
- [(set_attr "type" "pop")
- (set_attr "mode" "DI")])
-
-(define_insn "*movdi_xor_rex64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "const0_operand" ""))
- (clobber (reg:CC FLAGS_REG))]
- "TARGET_64BIT
- && reload_completed"
- "xor{l}\t%k0, %k0";
- [(set_attr "type" "alu1")
- (set_attr "mode" "SI")
- (set_attr "length_immediate" "0")])
+(define_expand "mov<mode>"
+ [(set (match_operand:X87MODEF 0 "nonimmediate_operand" "")
+ (match_operand:X87MODEF 1 "general_operand" ""))]
+ ""
+ "ix86_expand_move (<MODE>mode, operands); DONE;")
-(define_insn "*movdi_or_rex64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "const_int_operand" "i"))
- (clobber (reg:CC FLAGS_REG))]
- "TARGET_64BIT
- && reload_completed
- && operands[1] == constm1_rtx"
+(define_insn "*pushtf"
+ [(set (match_operand:TF 0 "push_operand" "=<,<,<")
+ (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
+ "TARGET_SSE2"
{
- operands[1] = constm1_rtx;
- return "or{q}\t{%1, %0|%0, %1}";
+ /* This insn should be already split before reg-stack. */
+ gcc_unreachable ();
}
- [(set_attr "type" "alu1")
- (set_attr "mode" "DI")
- (set_attr "length_immediate" "1")])
-
-(define_insn "*movdi_2"
- [(set (match_operand:DI 0 "nonimmediate_operand"
- "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
- (match_operand:DI 1 "general_operand"
- "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
- "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
- "@
- #
- #
- pxor\t%0, %0
- movq\t{%1, %0|%0, %1}
- movq\t{%1, %0|%0, %1}
- %vpxor\t%0, %d0
- %vmovq\t{%1, %0|%0, %1}
- %vmovdqa\t{%1, %0|%0, %1}
- %vmovq\t{%1, %0|%0, %1}
- xorps\t%0, %0
- movlps\t{%1, %0|%0, %1}
- movaps\t{%1, %0|%0, %1}
- movlps\t{%1, %0|%0, %1}"
- [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
- (set (attr "prefix")
- (if_then_else (eq_attr "alternative" "5,6,7,8")
- (const_string "vex")
- (const_string "orig")))
- (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
+ [(set_attr "type" "multi")
+ (set_attr "unit" "sse,*,*")
+ (set_attr "mode" "TF,SI,SI")])
(define_split
- [(set (match_operand:DI 0 "push_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- "!TARGET_64BIT && reload_completed
- && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
+ [(set (match_operand:TF 0 "push_operand" "")
+ (match_operand:TF 1 "general_operand" ""))]
+ "TARGET_SSE2 && reload_completed
+ && !SSE_REG_P (operands[1])"
[(const_int 0)]
"ix86_split_long_move (operands); DONE;")
-;; %%% This multiword shite has got to go.
(define_split
- [(set (match_operand:DI 0 "nonimmediate_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- "!TARGET_64BIT && reload_completed
- && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
- && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
- [(const_int 0)]
- "ix86_split_long_move (operands); DONE;")
+ [(set (match_operand:TF 0 "push_operand" "")
+ (match_operand:TF 1 "any_fp_register_operand" ""))]
+ "TARGET_SSE2"
+ [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
+ (set (mem:TF (reg:P SP_REG)) (match_dup 1))]
+ "")
-(define_insn "*movdi_1_rex64"
- [(set (match_operand:DI 0 "nonimmediate_operand"
- "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
- (match_operand:DI 1 "general_operand"
- "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
- "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+(define_insn "*pushxf"
+ [(set (match_operand:XF 0 "push_operand" "=<,<")
+ (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
+ "optimize_function_for_speed_p (cfun)"
{
- switch (get_attr_type (insn))
- {
- case TYPE_SSECVT:
- if (SSE_REG_P (operands[0]))
- return "movq2dq\t{%1, %0|%0, %1}";
- else
- return "movdq2q\t{%1, %0|%0, %1}";
-
- case TYPE_SSEMOV:
- if (TARGET_AVX)
- {
- if (get_attr_mode (insn) == MODE_TI)
- return "vmovdqa\t{%1, %0|%0, %1}";
- else
- return "vmovq\t{%1, %0|%0, %1}";
- }
-
- if (get_attr_mode (insn) == MODE_TI)
- return "movdqa\t{%1, %0|%0, %1}";
- /* FALLTHRU */
-
- case TYPE_MMXMOV:
- /* Moves from and into integer register is done using movd
- opcode with REX prefix. */
- if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
- return "movd\t{%1, %0|%0, %1}";
- return "movq\t{%1, %0|%0, %1}";
+ /* This insn should be already split before reg-stack. */
+ gcc_unreachable ();
+}
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387,*")
+ (set_attr "mode" "XF,SI")])
- case TYPE_SSELOG1:
- return "%vpxor\t%0, %d0";
+;; Size of pushxf is 3 (for sub) + 2 (for fstp) + memory operand size.
+;; Size of pushxf using integer instructions is 3+3*memory operand size
+;; Pushing using integer instructions is longer except for constants
+;; and direct memory references (assuming that any given constant is pushed
+;; only once, but this ought to be handled elsewhere).
- case TYPE_MMX:
- return "pxor\t%0, %0";
+(define_insn "*pushxf_nointeger"
+ [(set (match_operand:XF 0 "push_operand" "=X,X,X")
+ (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
+ "optimize_function_for_size_p (cfun)"
+{
+ /* This insn should be already split before reg-stack. */
+ gcc_unreachable ();
+}
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387,*,*")
+ (set_attr "mode" "XF,SI,SI")])
- case TYPE_MULTI:
- return "#";
+(define_split
+ [(set (match_operand:XF 0 "push_operand" "")
+ (match_operand:XF 1 "any_fp_register_operand" ""))]
+ "reload_completed"
+ [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
+ (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
+ "operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));")
- case TYPE_LEA:
- return "lea{q}\t{%a1, %0|%0, %a1}";
+(define_split
+ [(set (match_operand:XF 0 "push_operand" "")
+ (match_operand:XF 1 "general_operand" ""))]
+ "reload_completed
+ && !ANY_FP_REG_P (operands[1])"
+ [(const_int 0)]
+ "ix86_split_long_move (operands); DONE;")
- default:
- gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
- if (get_attr_mode (insn) == MODE_SI)
- return "mov{l}\t{%k1, %k0|%k0, %k1}";
- else if (which_alternative == 2)
- return "movabs{q}\t{%1, %0|%0, %1}";
- else
- return "mov{q}\t{%1, %0|%0, %1}";
- }
+(define_insn "*pushdf"
+ [(set (match_operand:DF 0 "push_operand" "=<,<,<")
+ (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
+ "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
+{
+ /* This insn should be already split before reg-stack. */
+ gcc_unreachable ();
}
- [(set (attr "type")
- (cond [(eq_attr "alternative" "5")
- (const_string "mmx")
- (eq_attr "alternative" "6,7,8,9,10")
- (const_string "mmxmov")
- (eq_attr "alternative" "11")
- (const_string "sselog1")
- (eq_attr "alternative" "12,13,14,15,16")
- (const_string "ssemov")
- (eq_attr "alternative" "17,18")
- (const_string "ssecvt")
- (eq_attr "alternative" "4")
- (const_string "multi")
- (match_operand:DI 1 "pic_32bit_operand" "")
- (const_string "lea")
- ]
- (const_string "imov")))
- (set (attr "modrm")
- (if_then_else
- (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
- (const_string "0")
- (const_string "*")))
- (set (attr "length_immediate")
- (if_then_else
- (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
- (const_string "8")
- (const_string "*")))
- (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
- (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
- (set (attr "prefix")
- (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
- (const_string "maybe_vex")
- (const_string "orig")))
- (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387,*,*")
+ (set_attr "mode" "DF,SI,DF")])
-;; Stores and loads of ax to arbitrary constant address.
-;; We fake an second form of instruction to force reload to load address
-;; into register when rax is not available
-(define_insn "*movabsdi_1_rex64"
- [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
- (match_operand:DI 1 "nonmemory_operand" "a,er"))]
- "TARGET_64BIT && ix86_check_movabs (insn, 0)"
- "@
- movabs{q}\t{%1, %P0|%P0, %1}
- mov{q}\t{%1, %a0|%a0, %1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0,*")
- (set_attr "memory" "store")
- (set_attr "mode" "DI")])
+;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
+;; Size of pushdf using integer instructions is 2+2*memory operand size
+;; On the average, pushdf using integers can be still shorter. Allow this
+;; pattern for optimize_size too.
-(define_insn "*movabsdi_2_rex64"
- [(set (match_operand:DI 0 "register_operand" "=a,r")
- (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
- "TARGET_64BIT && ix86_check_movabs (insn, 1)"
- "@
- movabs{q}\t{%P1, %0|%0, %P1}
- mov{q}\t{%a1, %0|%0, %a1}"
- [(set_attr "type" "imov")
- (set_attr "modrm" "0,*")
- (set_attr "length_address" "8,0")
- (set_attr "length_immediate" "0")
- (set_attr "memory" "load")
- (set_attr "mode" "DI")])
+(define_insn "*pushdf_nointeger"
+ [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
+ (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
+ "!(TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES)"
+{
+ /* This insn should be already split before reg-stack. */
+ gcc_unreachable ();
+}
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387,*,*,*")
+ (set_attr "mode" "DF,SI,SI,DF")])
-;; Convert impossible stores of immediate to existing instructions.
-;; First try to get scratch register and go through it. In case this
-;; fails, move by 32bit parts.
-(define_peephole2
- [(match_scratch:DI 2 "r")
- (set (match_operand:DI 0 "memory_operand" "")
- (match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
- && !x86_64_immediate_operand (operands[1], DImode)"
- [(set (match_dup 2) (match_dup 1))
- (set (match_dup 0) (match_dup 2))]
+;; %%% Kill this when call knows how to work this out.
+(define_split
+ [(set (match_operand:DF 0 "push_operand" "")
+ (match_operand:DF 1 "any_fp_register_operand" ""))]
+ "reload_completed"
+ [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
+ (set (mem:DF (reg:P SP_REG)) (match_dup 1))]
"")
-;; We need to define this as both peepholer and splitter for case
-;; peephole2 pass is not run.
-;; "&& 1" is needed to keep it from matching the previous pattern.
-(define_peephole2
- [(set (match_operand:DI 0 "memory_operand" "")
- (match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
- && !x86_64_immediate_operand (operands[1], DImode) && 1"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "split_di (&operands[0], 2, &operands[2], &operands[4]);")
-
(define_split
- [(set (match_operand:DI 0 "memory_operand" "")
- (match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
- ? epilogue_completed : reload_completed)
- && !symbolic_operand (operands[1], DImode)
- && !x86_64_immediate_operand (operands[1], DImode)"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "split_di (&operands[0], 2, &operands[2], &operands[4]);")
+ [(set (match_operand:DF 0 "push_operand" "")
+ (match_operand:DF 1 "general_operand" ""))]
+ "reload_completed
+ && !ANY_FP_REG_P (operands[1])"
+ [(const_int 0)]
+ "ix86_split_long_move (operands); DONE;")
-(define_insn "*swapdi_rex64"
- [(set (match_operand:DI 0 "register_operand" "+r")
- (match_operand:DI 1 "register_operand" "+r"))
- (set (match_dup 1)
- (match_dup 0))]
+(define_insn "*pushsf_rex64"
+ [(set (match_operand:SF 0 "push_operand" "=X,X,X")
+ (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
"TARGET_64BIT"
- "xchg{q}\t%1, %0"
- [(set_attr "type" "imov")
- (set_attr "mode" "DI")
- (set_attr "pent_pair" "np")
- (set_attr "athlon_decode" "vector")
- (set_attr "amdfam10_decode" "double")])
-
-(define_expand "movoi"
- [(set (match_operand:OI 0 "nonimmediate_operand" "")
- (match_operand:OI 1 "general_operand" ""))]
- "TARGET_AVX"
- "ix86_expand_move (OImode, operands); DONE;")
-
-(define_insn "*movoi_internal"
- [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
- (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
- "TARGET_AVX
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
{
- switch (which_alternative)
- {
- case 0:
- return "vxorps\t%0, %0, %0";
- case 1:
- case 2:
- if (misaligned_operand (operands[0], OImode)
- || misaligned_operand (operands[1], OImode))
- return "vmovdqu\t{%1, %0|%0, %1}";
- else
- return "vmovdqa\t{%1, %0|%0, %1}";
- default:
- gcc_unreachable ();
- }
+ /* Anything else should be already split before reg-stack. */
+ gcc_assert (which_alternative == 1);
+ return "push{q}\t%q1";
}
- [(set_attr "type" "sselog1,ssemov,ssemov")
- (set_attr "prefix" "vex")
- (set_attr "mode" "OI")])
-
-(define_expand "movti"
- [(set (match_operand:TI 0 "nonimmediate_operand" "")
- (match_operand:TI 1 "nonimmediate_operand" ""))]
- "TARGET_SSE || TARGET_64BIT"
-{
- if (TARGET_64BIT)
- ix86_expand_move (TImode, operands);
- else if (push_operand (operands[0], TImode))
- ix86_expand_push (TImode, operands[1]);
- else
- ix86_expand_vector_move (TImode, operands);
- DONE;
-})
+ [(set_attr "type" "multi,push,multi")
+ (set_attr "unit" "i387,*,*")
+ (set_attr "mode" "SF,DI,SF")])
-(define_insn "*movti_internal"
- [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
- (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
- "TARGET_SSE && !TARGET_64BIT
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+(define_insn "*pushsf"
+ [(set (match_operand:SF 0 "push_operand" "=<,<,<")
+ (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
+ "!TARGET_64BIT"
{
- switch (which_alternative)
- {
- case 0:
- if (get_attr_mode (insn) == MODE_V4SF)
- return "%vxorps\t%0, %d0";
- else
- return "%vpxor\t%0, %d0";
- case 1:
- case 2:
- /* TDmode values are passed as TImode on the stack. Moving them
- to stack may result in unaligned memory access. */
- if (misaligned_operand (operands[0], TImode)
- || misaligned_operand (operands[1], TImode))
- {
- if (get_attr_mode (insn) == MODE_V4SF)
- return "%vmovups\t{%1, %0|%0, %1}";
- else
- return "%vmovdqu\t{%1, %0|%0, %1}";
- }
- else
- {
- if (get_attr_mode (insn) == MODE_V4SF)
- return "%vmovaps\t{%1, %0|%0, %1}";
- else
- return "%vmovdqa\t{%1, %0|%0, %1}";
- }
- default:
- gcc_unreachable ();
- }
+ /* Anything else should be already split before reg-stack. */
+ gcc_assert (which_alternative == 1);
+ return "push{l}\t%1";
}
- [(set_attr "type" "sselog1,ssemov,ssemov")
- (set_attr "prefix" "maybe_vex")
- (set (attr "mode")
- (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
- (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0)))
- (const_string "V4SF")
- (and (eq_attr "alternative" "2")
- (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
- (const_int 0)))
- (const_string "V4SF")]
- (const_string "TI")))])
+ [(set_attr "type" "multi,push,multi")
+ (set_attr "unit" "i387,*,*")
+ (set_attr "mode" "SF,SI,SF")])
-(define_insn "*movti_rex64"
- [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
- (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
- "TARGET_64BIT
+(define_split
+ [(set (match_operand:SF 0 "push_operand" "")
+ (match_operand:SF 1 "memory_operand" ""))]
+ "reload_completed
+ && MEM_P (operands[1])
+ && (operands[2] = find_constant_src (insn))"
+ [(set (match_dup 0)
+ (match_dup 2))])
+
+;; %%% Kill this when call knows how to work this out.
+(define_split
+ [(set (match_operand:SF 0 "push_operand" "")
+ (match_operand:SF 1 "any_fp_register_operand" ""))]
+ "reload_completed"
+ [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
+ (set (mem:SF (reg:P SP_REG)) (match_dup 1))]
+ "operands[2] = GEN_INT (-GET_MODE_SIZE (<MODE>mode));")
+
+(define_insn "*movtf_internal"
+ [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
+ (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
+ "TARGET_SSE2
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
{
switch (which_alternative)
{
case 0:
case 1:
- return "#";
+ if (get_attr_mode (insn) == MODE_V4SF)
+ return "%vmovaps\t{%1, %0|%0, %1}";
+ else
+ return "%vmovdqa\t{%1, %0|%0, %1}";
case 2:
if (get_attr_mode (insn) == MODE_V4SF)
return "%vxorps\t%0, %d0";
@@ -2790,37 +2806,21 @@
return "%vpxor\t%0, %d0";
case 3:
case 4:
- /* TDmode values are passed as TImode on the stack. Moving them
- to stack may result in unaligned memory access. */
- if (misaligned_operand (operands[0], TImode)
- || misaligned_operand (operands[1], TImode))
- {
- if (get_attr_mode (insn) == MODE_V4SF)
- return "%vmovups\t{%1, %0|%0, %1}";
- else
- return "%vmovdqu\t{%1, %0|%0, %1}";
- }
- else
- {
- if (get_attr_mode (insn) == MODE_V4SF)
- return "%vmovaps\t{%1, %0|%0, %1}";
- else
- return "%vmovdqa\t{%1, %0|%0, %1}";
- }
+ return "#";
default:
gcc_unreachable ();
}
}
- [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
- (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
+ [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
+ (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
(set (attr "mode")
- (cond [(eq_attr "alternative" "2,3")
+ (cond [(eq_attr "alternative" "0,2")
(if_then_else
(ne (symbol_ref "optimize_function_for_size_p (cfun)")
(const_int 0))
(const_string "V4SF")
(const_string "TI"))
- (eq_attr "alternative" "4")
+ (eq_attr "alternative" "1")
(if_then_else
(ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
(const_int 0))
@@ -2831,97 +2831,21 @@
(const_string "DI")))])
(define_split
- [(set (match_operand:TI 0 "nonimmediate_operand" "")
- (match_operand:TI 1 "general_operand" ""))]
- "reload_completed && !SSE_REG_P (operands[0])
- && !SSE_REG_P (operands[1])"
+ [(set (match_operand:TF 0 "nonimmediate_operand" "")
+ (match_operand:TF 1 "general_operand" ""))]
+ "reload_completed
+ && !(SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]))"
[(const_int 0)]
"ix86_split_long_move (operands); DONE;")
-;; This expands to what emit_move_complex would generate if we didn't
-;; have a movti pattern. Having this avoids problems with reload on
-;; 32-bit targets when SSE is present, but doesn't seem to be harmful
-;; to have around all the time.
-(define_expand "movcdi"
- [(set (match_operand:CDI 0 "nonimmediate_operand" "")
- (match_operand:CDI 1 "general_operand" ""))]
- ""
-{
- if (push_operand (operands[0], CDImode))
- emit_move_complex_push (CDImode, operands[0], operands[1]);
- else
- emit_move_complex_parts (operands[0], operands[1]);
- DONE;
-})
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "nonimmediate_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "ix86_expand_move (SFmode, operands); DONE;")
-
-(define_insn "*pushsf"
- [(set (match_operand:SF 0 "push_operand" "=<,<,<")
- (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
- "!TARGET_64BIT"
-{
- /* Anything else should be already split before reg-stack. */
- gcc_assert (which_alternative == 1);
- return "push{l}\t%1";
-}
- [(set_attr "type" "multi,push,multi")
- (set_attr "unit" "i387,*,*")
- (set_attr "mode" "SF,SI,SF")])
-
-(define_insn "*pushsf_rex64"
- [(set (match_operand:SF 0 "push_operand" "=X,X,X")
- (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
- "TARGET_64BIT"
-{
- /* Anything else should be already split before reg-stack. */
- gcc_assert (which_alternative == 1);
- return "push{q}\t%q1";
-}
- [(set_attr "type" "multi,push,multi")
- (set_attr "unit" "i387,*,*")
- (set_attr "mode" "SF,DI,SF")])
-
-(define_split
- [(set (match_operand:SF 0 "push_operand" "")
- (match_operand:SF 1 "memory_operand" ""))]
- "reload_completed
- && MEM_P (operands[1])
- && (operands[2] = find_constant_src (insn))"
- [(set (match_dup 0)
- (match_dup 2))])
-
-;; %%% Kill this when call knows how to work this out.
-(define_split
- [(set (match_operand:SF 0 "push_operand" "")
- (match_operand:SF 1 "any_fp_register_operand" ""))]
- "!TARGET_64BIT"
- [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
- (set (mem:SF (reg:SI SP_REG)) (match_dup 1))])
-
-(define_split
- [(set (match_operand:SF 0 "push_operand" "")
- (match_operand:SF 1 "any_fp_register_operand" ""))]
- "TARGET_64BIT"
- [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
- (set (mem:SF (reg:DI SP_REG)) (match_dup 1))])
-
-(define_insn "*movsf_1"
- [(set (match_operand:SF 0 "nonimmediate_operand"
- "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
- (match_operand:SF 1 "general_operand"
- "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
- "!(MEM_P (operands[0]) && MEM_P (operands[1]))
+(define_insn "*movxf_internal"
+ [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
+ (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
+ "optimize_function_for_speed_p (cfun)
+ && !(MEM_P (operands[0]) && MEM_P (operands[1]))
&& (reload_in_progress || reload_completed
- || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
- || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
- && standard_80387_constant_p (operands[1]))
|| GET_CODE (operands[1]) != CONST_DOUBLE
- || memory_operand (operands[0], SFmode))"
+ || memory_operand (operands[0], XFmode))"
{
switch (which_alternative)
{
@@ -2932,169 +2856,72 @@
case 2:
return standard_80387_constant_opcode (operands[1]);
- case 3:
- case 4:
- return "mov{l}\t{%1, %0|%0, %1}";
- case 5:
- if (get_attr_mode (insn) == MODE_TI)
- return "%vpxor\t%0, %d0";
- else
- return "%vxorps\t%0, %d0";
- case 6:
- if (get_attr_mode (insn) == MODE_V4SF)
- return "%vmovaps\t{%1, %0|%0, %1}";
- else
- return "%vmovss\t{%1, %d0|%d0, %1}";
- case 7:
- if (TARGET_AVX)
- return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
- : "vmovss\t{%1, %0|%0, %1}";
- else
- return "movss\t{%1, %0|%0, %1}";
- case 8:
- return "%vmovss\t{%1, %0|%0, %1}";
-
- case 9: case 10: case 14: case 15:
- return "movd\t{%1, %0|%0, %1}";
- case 12: case 13:
- return "%vmovd\t{%1, %0|%0, %1}";
-
- case 11:
- return "movq\t{%1, %0|%0, %1}";
+ case 3: case 4:
+ return "#";
default:
gcc_unreachable ();
}
}
- [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
- (set (attr "prefix")
- (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
- (const_string "maybe_vex")
- (const_string "orig")))
- (set (attr "mode")
- (cond [(eq_attr "alternative" "3,4,9,10")
- (const_string "SI")
- (eq_attr "alternative" "5")
- (if_then_else
- (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
- (const_int 0))
- (ne (symbol_ref "TARGET_SSE2")
- (const_int 0)))
- (eq (symbol_ref "optimize_function_for_size_p (cfun)")
- (const_int 0)))
- (const_string "TI")
- (const_string "V4SF"))
- /* For architectures resolving dependencies on
- whole SSE registers use APS move to break dependency
- chains, otherwise use short move to avoid extra work.
-
- Do the same for architectures resolving dependencies on
- the parts. While in DF mode it is better to always handle
- just register parts, the SF mode is different due to lack
- of instructions to load just part of the register. It is
- better to maintain the whole registers in single format
- to avoid problems on using packed logical operations. */
- (eq_attr "alternative" "6")
- (if_then_else
- (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
- (const_int 0))
- (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
- (const_int 0)))
- (const_string "V4SF")
- (const_string "SF"))
- (eq_attr "alternative" "11")
- (const_string "DI")]
- (const_string "SF")))])
+ [(set_attr "type" "fmov,fmov,fmov,multi,multi")
+ (set_attr "mode" "XF,XF,XF,SI,SI")])
-(define_insn "*swapsf"
- [(set (match_operand:SF 0 "fp_register_operand" "+f")
- (match_operand:SF 1 "fp_register_operand" "+f"))
- (set (match_dup 1)
- (match_dup 0))]
- "reload_completed || TARGET_80387"
+;; Do not use integer registers when optimizing for size
+(define_insn "*movxf_internal_nointeger"
+ [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
+ (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
+ "optimize_function_for_size_p (cfun)
+ && !(MEM_P (operands[0]) && MEM_P (operands[1]))
+ && (reload_in_progress || reload_completed
+ || standard_80387_constant_p (operands[1])
+ || GET_CODE (operands[1]) != CONST_DOUBLE
+ || memory_operand (operands[0], XFmode))"
{
- if (STACK_TOP_P (operands[0]))
- return "fxch\t%1";
- else
- return "fxch\t%0";
-}
- [(set_attr "type" "fxch")
- (set_attr "mode" "SF")])
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "nonimmediate_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "ix86_expand_move (DFmode, operands); DONE;")
-
-;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
-;; Size of pushdf using integer instructions is 2+2*memory operand size
-;; On the average, pushdf using integers can be still shorter. Allow this
-;; pattern for optimize_size too.
+ switch (which_alternative)
+ {
+ case 0:
+ case 1:
+ return output_387_reg_move (insn, operands);
-(define_insn "*pushdf_nointeger"
- [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
- (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
- "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
-{
- /* This insn should be already split before reg-stack. */
- gcc_unreachable ();
-}
- [(set_attr "type" "multi")
- (set_attr "unit" "i387,*,*,*")
- (set_attr "mode" "DF,SI,SI,DF")])
+ case 2:
+ return standard_80387_constant_opcode (operands[1]);
-(define_insn "*pushdf_integer"
- [(set (match_operand:DF 0 "push_operand" "=<,<,<")
- (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
- "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
-{
- /* This insn should be already split before reg-stack. */
- gcc_unreachable ();
+ case 3: case 4:
+ return "#";
+ default:
+ gcc_unreachable ();
+ }
}
- [(set_attr "type" "multi")
- (set_attr "unit" "i387,*,*")
- (set_attr "mode" "DF,SI,DF")])
-
-;; %%% Kill this when call knows how to work this out.
-(define_split
- [(set (match_operand:DF 0 "push_operand" "")
- (match_operand:DF 1 "any_fp_register_operand" ""))]
- "reload_completed"
- [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
- (set (mem:DF (reg:P SP_REG)) (match_dup 1))]
- "")
+ [(set_attr "type" "fmov,fmov,fmov,multi,multi")
+ (set_attr "mode" "XF,XF,XF,SI,SI")])
(define_split
- [(set (match_operand:DF 0 "push_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- "reload_completed"
+ [(set (match_operand:XF 0 "nonimmediate_operand" "")
+ (match_operand:XF 1 "general_operand" ""))]
+ "reload_completed
+ && !(MEM_P (operands[0]) && MEM_P (operands[1]))
+ && ! (ANY_FP_REG_P (operands[0]) ||
+ (GET_CODE (operands[0]) == SUBREG
+ && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
+ && ! (ANY_FP_REG_P (operands[1]) ||
+ (GET_CODE (operands[1]) == SUBREG
+ && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
[(const_int 0)]
"ix86_split_long_move (operands); DONE;")
-;; Moving is usually shorter when only FP registers are used. This separate
-;; movdf pattern avoids the use of integer registers for FP operations
-;; when optimizing for size.
-
-(define_insn "*movdf_nointeger"
+(define_insn "*movdf_internal_rex64"
[(set (match_operand:DF 0 "nonimmediate_operand"
- "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
+ "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
(match_operand:DF 1 "general_operand"
- "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
- "!(MEM_P (operands[0]) && MEM_P (operands[1]))
- && ((optimize_function_for_size_p (cfun)
- || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
+ "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
+ "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
&& (reload_in_progress || reload_completed
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
|| (!(TARGET_SSE2 && TARGET_SSE_MATH)
&& optimize_function_for_size_p (cfun)
- && !memory_operand (operands[0], DFmode)
&& standard_80387_constant_p (operands[1]))
|| GET_CODE (operands[1]) != CONST_DOUBLE
- || ((optimize_function_for_size_p (cfun)
- || !TARGET_MEMORY_MISMATCH_STALL
- || reload_in_progress || reload_completed)
- && memory_operand (operands[0], DFmode)))"
+ || memory_operand (operands[0], DFmode))"
{
switch (which_alternative)
{
@@ -3108,6 +2935,7 @@
case 3:
case 4:
return "#";
+
case 5:
switch (get_attr_mode (insn))
{
@@ -3156,34 +2984,22 @@
else
return "movsd\t{%1, %0|%0, %1}";
case MODE_V1DF:
- if (TARGET_AVX)
- {
- if (REG_P (operands[0]))
- return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
- else
- return "vmovlpd\t{%1, %0|%0, %1}";
- }
- else
- return "movlpd\t{%1, %0|%0, %1}";
+ return "%vmovlpd\t{%1, %d0|%d0, %1}";
case MODE_V2SF:
- if (TARGET_AVX)
- {
- if (REG_P (operands[0]))
- return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
- else
- return "vmovlps\t{%1, %0|%0, %1}";
- }
- else
- return "movlps\t{%1, %0|%0, %1}";
+ return "%vmovlps\t{%1, %d0|%d0, %1}";
default:
gcc_unreachable ();
}
+ case 9:
+ case 10:
+ return "%vmovd\t{%1, %0|%0, %1}";
+
default:
- gcc_unreachable ();
+ gcc_unreachable();
}
}
- [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
+ [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
(set (attr "prefix")
(if_then_else (eq_attr "alternative" "0,1,2,3,4")
(const_string "orig")
@@ -3195,8 +3011,8 @@
(set (attr "mode")
(cond [(eq_attr "alternative" "0,1,2")
(const_string "DF")
- (eq_attr "alternative" "3,4")
- (const_string "SI")
+ (eq_attr "alternative" "3,4,9,10")
+ (const_string "DI")
/* For SSE1, we have many fewer alternatives. */
(eq (symbol_ref "TARGET_SSE2") (const_int 0))
@@ -3243,12 +3059,14 @@
]
(const_string "DF")))])
-(define_insn "*movdf_integer_rex64"
+(define_insn "*movdf_internal"
[(set (match_operand:DF 0 "nonimmediate_operand"
- "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
+ "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
(match_operand:DF 1 "general_operand"
- "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
- "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
+ "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
+ "!(MEM_P (operands[0]) && MEM_P (operands[1]))
+ && optimize_function_for_speed_p (cfun)
+ && TARGET_INTEGER_DFMODE_MOVES
&& (reload_in_progress || reload_completed
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
|| (!(TARGET_SSE2 && TARGET_SSE_MATH)
@@ -3274,17 +3092,17 @@
switch (get_attr_mode (insn))
{
case MODE_V4SF:
- return "%vxorps\t%0, %d0";
+ return "xorps\t%0, %0";
case MODE_V2DF:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "%vxorps\t%0, %d0";
+ return "xorps\t%0, %0";
else
- return "%vxorpd\t%0, %d0";
+ return "xorpd\t%0, %0";
case MODE_TI:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "%vxorps\t%0, %d0";
+ return "xorps\t%0, %0";
else
- return "%vpxor\t%0, %d0";
+ return "pxor\t%0, %0";
default:
gcc_unreachable ();
}
@@ -3294,50 +3112,34 @@
switch (get_attr_mode (insn))
{
case MODE_V4SF:
- return "%vmovaps\t{%1, %0|%0, %1}";
+ return "movaps\t{%1, %0|%0, %1}";
case MODE_V2DF:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "%vmovaps\t{%1, %0|%0, %1}";
+ return "movaps\t{%1, %0|%0, %1}";
else
- return "%vmovapd\t{%1, %0|%0, %1}";
+ return "movapd\t{%1, %0|%0, %1}";
case MODE_TI:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "%vmovaps\t{%1, %0|%0, %1}";
+ return "movaps\t{%1, %0|%0, %1}";
else
- return "%vmovdqa\t{%1, %0|%0, %1}";
+ return "movdqa\t{%1, %0|%0, %1}";
case MODE_DI:
- return "%vmovq\t{%1, %0|%0, %1}";
+ return "movq\t{%1, %0|%0, %1}";
case MODE_DF:
- if (TARGET_AVX)
- {
- if (REG_P (operands[0]) && REG_P (operands[1]))
- return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
- else
- return "vmovsd\t{%1, %0|%0, %1}";
- }
- else
- return "movsd\t{%1, %0|%0, %1}";
+ return "movsd\t{%1, %0|%0, %1}";
case MODE_V1DF:
- return "%vmovlpd\t{%1, %d0|%d0, %1}";
+ return "movlpd\t{%1, %0|%0, %1}";
case MODE_V2SF:
- return "%vmovlps\t{%1, %d0|%d0, %1}";
+ return "movlps\t{%1, %0|%0, %1}";
default:
gcc_unreachable ();
}
- case 9:
- case 10:
- return "%vmovd\t{%1, %0|%0, %1}";
-
default:
gcc_unreachable();
}
}
- [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
- (set (attr "prefix")
- (if_then_else (eq_attr "alternative" "0,1,2,3,4")
- (const_string "orig")
- (const_string "maybe_vex")))
+ [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
(set (attr "prefix_data16")
(if_then_else (eq_attr "mode" "V1DF")
(const_string "1")
@@ -3345,8 +3147,8 @@
(set (attr "mode")
(cond [(eq_attr "alternative" "0,1,2")
(const_string "DF")
- (eq_attr "alternative" "3,4,9,10")
- (const_string "DI")
+ (eq_attr "alternative" "3,4")
+ (const_string "SI")
/* For SSE1, we have many fewer alternatives. */
(eq (symbol_ref "TARGET_SSE2") (const_int 0))
@@ -3393,21 +3195,29 @@
]
(const_string "DF")))])
-(define_insn "*movdf_integer"
+;; Moving is usually shorter when only FP registers are used. This separate
+;; movdf pattern avoids the use of integer registers for FP operations
+;; when optimizing for size.
+
+(define_insn "*movdf_internal_nointeger"
[(set (match_operand:DF 0 "nonimmediate_operand"
- "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
+ "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
(match_operand:DF 1 "general_operand"
- "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
+ "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
"!(MEM_P (operands[0]) && MEM_P (operands[1]))
- && optimize_function_for_speed_p (cfun)
- && TARGET_INTEGER_DFMODE_MOVES
+ && ((optimize_function_for_size_p (cfun)
+ || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
&& (reload_in_progress || reload_completed
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
|| (!(TARGET_SSE2 && TARGET_SSE_MATH)
&& optimize_function_for_size_p (cfun)
+ && !memory_operand (operands[0], DFmode)
&& standard_80387_constant_p (operands[1]))
|| GET_CODE (operands[1]) != CONST_DOUBLE
- || memory_operand (operands[0], DFmode))"
+ || ((optimize_function_for_size_p (cfun)
+ || !TARGET_MEMORY_MISMATCH_STALL
+ || reload_in_progress || reload_completed)
+ && memory_operand (operands[0], DFmode)))"
{
switch (which_alternative)
{
@@ -3421,22 +3231,21 @@
case 3:
case 4:
return "#";
-
case 5:
switch (get_attr_mode (insn))
{
case MODE_V4SF:
- return "xorps\t%0, %0";
+ return "%vxorps\t%0, %d0";
case MODE_V2DF:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "xorps\t%0, %0";
+ return "%vxorps\t%0, %d0";
else
- return "xorpd\t%0, %0";
+ return "%vxorpd\t%0, %d0";
case MODE_TI:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "xorps\t%0, %0";
+ return "%vxorps\t%0, %d0";
else
- return "pxor\t%0, %0";
+ return "%vpxor\t%0, %d0";
default:
gcc_unreachable ();
}
@@ -3446,34 +3255,62 @@
switch (get_attr_mode (insn))
{
case MODE_V4SF:
- return "movaps\t{%1, %0|%0, %1}";
+ return "%vmovaps\t{%1, %0|%0, %1}";
case MODE_V2DF:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "movaps\t{%1, %0|%0, %1}";
+ return "%vmovaps\t{%1, %0|%0, %1}";
else
- return "movapd\t{%1, %0|%0, %1}";
+ return "%vmovapd\t{%1, %0|%0, %1}";
case MODE_TI:
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
- return "movaps\t{%1, %0|%0, %1}";
+ return "%vmovaps\t{%1, %0|%0, %1}";
else
- return "movdqa\t{%1, %0|%0, %1}";
+ return "%vmovdqa\t{%1, %0|%0, %1}";
case MODE_DI:
- return "movq\t{%1, %0|%0, %1}";
+ return "%vmovq\t{%1, %0|%0, %1}";
case MODE_DF:
- return "movsd\t{%1, %0|%0, %1}";
+ if (TARGET_AVX)
+ {
+ if (REG_P (operands[0]) && REG_P (operands[1]))
+ return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
+ else
+ return "vmovsd\t{%1, %0|%0, %1}";
+ }
+ else
+ return "movsd\t{%1, %0|%0, %1}";
case MODE_V1DF:
- return "movlpd\t{%1, %0|%0, %1}";
+ if (TARGET_AVX)
+ {
+ if (REG_P (operands[0]))
+ return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
+ else
+ return "vmovlpd\t{%1, %0|%0, %1}";
+ }
+ else
+ return "movlpd\t{%1, %0|%0, %1}";
case MODE_V2SF:
- return "movlps\t{%1, %0|%0, %1}";
+ if (TARGET_AVX)
+ {
+ if (REG_P (operands[0]))
+ return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
+ else
+ return "vmovlps\t{%1, %0|%0, %1}";
+ }
+ else
+ return "movlps\t{%1, %0|%0, %1}";
default:
gcc_unreachable ();
}
default:
- gcc_unreachable();
+ gcc_unreachable ();
}
}
[(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
+ (set (attr "prefix")
+ (if_then_else (eq_attr "alternative" "0,1,2,3,4")
+ (const_string "orig")
+ (const_string "maybe_vex")))
(set (attr "prefix_data16")
(if_then_else (eq_attr "mode" "V1DF")
(const_string "1")
@@ -3543,113 +3380,18 @@
[(const_int 0)]
"ix86_split_long_move (operands); DONE;")
-(define_insn "*swapdf"
- [(set (match_operand:DF 0 "fp_register_operand" "+f")
- (match_operand:DF 1 "fp_register_operand" "+f"))
- (set (match_dup 1)
- (match_dup 0))]
- "reload_completed || TARGET_80387"
-{
- if (STACK_TOP_P (operands[0]))
- return "fxch\t%1";
- else
- return "fxch\t%0";
-}
- [(set_attr "type" "fxch")
- (set_attr "mode" "DF")])
-
-(define_expand "movxf"
- [(set (match_operand:XF 0 "nonimmediate_operand" "")
- (match_operand:XF 1 "general_operand" ""))]
- ""
- "ix86_expand_move (XFmode, operands); DONE;")
-
-;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
-;; Size of pushdf using integer instructions is 3+3*memory operand size
-;; Pushing using integer instructions is longer except for constants
-;; and direct memory references.
-;; (assuming that any given constant is pushed only once, but this ought to be
-;; handled elsewhere).
-
-(define_insn "*pushxf_nointeger"
- [(set (match_operand:XF 0 "push_operand" "=X,X,X")
- (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
- "optimize_function_for_size_p (cfun)"
-{
- /* This insn should be already split before reg-stack. */
- gcc_unreachable ();
-}
- [(set_attr "type" "multi")
- (set_attr "unit" "i387,*,*")
- (set_attr "mode" "XF,SI,SI")])
-
-(define_insn "*pushxf_integer"
- [(set (match_operand:XF 0 "push_operand" "=<,<")
- (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
- "optimize_function_for_speed_p (cfun)"
-{
- /* This insn should be already split before reg-stack. */
- gcc_unreachable ();
-}
- [(set_attr "type" "multi")
- (set_attr "unit" "i387,*")
- (set_attr "mode" "XF,SI")])
-
-(define_split
- [(set (match_operand 0 "push_operand" "")
- (match_operand 1 "general_operand" ""))]
- "reload_completed
- && (GET_MODE (operands[0]) == XFmode
- || GET_MODE (operands[0]) == DFmode)
- && !ANY_FP_REG_P (operands[1])"
- [(const_int 0)]
- "ix86_split_long_move (operands); DONE;")
-
-(define_split
- [(set (match_operand:XF 0 "push_operand" "")
- (match_operand:XF 1 "any_fp_register_operand" ""))]
- ""
- [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
- (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
- "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
-
-;; Do not use integer registers when optimizing for size
-(define_insn "*movxf_nointeger"
- [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
- (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
- "optimize_function_for_size_p (cfun)
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))
- && (reload_in_progress || reload_completed
- || standard_80387_constant_p (operands[1])
- || GET_CODE (operands[1]) != CONST_DOUBLE
- || memory_operand (operands[0], XFmode))"
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- return output_387_reg_move (insn, operands);
-
- case 2:
- return standard_80387_constant_opcode (operands[1]);
-
- case 3: case 4:
- return "#";
- default:
- gcc_unreachable ();
- }
-}
- [(set_attr "type" "fmov,fmov,fmov,multi,multi")
- (set_attr "mode" "XF,XF,XF,SI,SI")])
-
-(define_insn "*movxf_integer"
- [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
- (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
- "optimize_function_for_speed_p (cfun)
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))
+(define_insn "*movsf_internal"
+ [(set (match_operand:SF 0 "nonimmediate_operand"
+ "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
+ (match_operand:SF 1 "general_operand"
+ "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
+ "!(MEM_P (operands[0]) && MEM_P (operands[1]))
&& (reload_in_progress || reload_completed
+ || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
+ || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
+ && standard_80387_constant_p (operands[1]))
|| GET_CODE (operands[1]) != CONST_DOUBLE
- || memory_operand (operands[0], XFmode))"
+ || memory_operand (operands[0], SFmode))"
{
switch (which_alternative)
{
@@ -3660,112 +3402,79 @@
case 2:
return standard_80387_constant_opcode (operands[1]);
- case 3: case 4:
- return "#";
-
- default:
- gcc_unreachable ();
- }
-}
- [(set_attr "type" "fmov,fmov,fmov,multi,multi")
- (set_attr "mode" "XF,XF,XF,SI,SI")])
-
-(define_expand "movtf"
- [(set (match_operand:TF 0 "nonimmediate_operand" "")
- (match_operand:TF 1 "nonimmediate_operand" ""))]
- "TARGET_SSE2"
-{
- ix86_expand_move (TFmode, operands);
- DONE;
-})
-
-(define_insn "*movtf_internal"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
- (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
- "TARGET_SSE2
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
+ case 3:
+ case 4:
+ return "mov{l}\t{%1, %0|%0, %1}";
+ case 5:
+ if (get_attr_mode (insn) == MODE_TI)
+ return "%vpxor\t%0, %d0";
+ else
+ return "%vxorps\t%0, %d0";
+ case 6:
if (get_attr_mode (insn) == MODE_V4SF)
return "%vmovaps\t{%1, %0|%0, %1}";
else
- return "%vmovdqa\t{%1, %0|%0, %1}";
- case 2:
- if (get_attr_mode (insn) == MODE_V4SF)
- return "%vxorps\t%0, %d0";
+ return "%vmovss\t{%1, %d0|%d0, %1}";
+ case 7:
+ if (TARGET_AVX)
+ return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
+ : "vmovss\t{%1, %0|%0, %1}";
else
- return "%vpxor\t%0, %d0";
- case 3:
- case 4:
- return "#";
+ return "movss\t{%1, %0|%0, %1}";
+ case 8:
+ return "%vmovss\t{%1, %0|%0, %1}";
+
+ case 9: case 10: case 14: case 15:
+ return "movd\t{%1, %0|%0, %1}";
+ case 12: case 13:
+ return "%vmovd\t{%1, %0|%0, %1}";
+
+ case 11:
+ return "movq\t{%1, %0|%0, %1}";
+
default:
gcc_unreachable ();
}
}
- [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
- (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
+ [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
+ (set (attr "prefix")
+ (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
+ (const_string "maybe_vex")
+ (const_string "orig")))
(set (attr "mode")
- (cond [(eq_attr "alternative" "0,2")
+ (cond [(eq_attr "alternative" "3,4,9,10")
+ (const_string "SI")
+ (eq_attr "alternative" "5")
(if_then_else
- (ne (symbol_ref "optimize_function_for_size_p (cfun)")
- (const_int 0))
- (const_string "V4SF")
- (const_string "TI"))
- (eq_attr "alternative" "1")
+ (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
+ (const_int 0))
+ (ne (symbol_ref "TARGET_SSE2")
+ (const_int 0)))
+ (eq (symbol_ref "optimize_function_for_size_p (cfun)")
+ (const_int 0)))
+ (const_string "TI")
+ (const_string "V4SF"))
+ /* For architectures resolving dependencies on
+ whole SSE registers use APS move to break dependency
+ chains, otherwise use short move to avoid extra work.
+
+ Do the same for architectures resolving dependencies on
+ the parts. While in DF mode it is better to always handle
+ just register parts, the SF mode is different due to lack
+ of instructions to load just part of the register. It is
+ better to maintain the whole registers in single format
+ to avoid problems on using packed logical operations. */
+ (eq_attr "alternative" "6")
(if_then_else
- (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
+ (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
(const_int 0))
- (ne (symbol_ref "optimize_function_for_size_p (cfun)")
+ (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
(const_int 0)))
(const_string "V4SF")
- (const_string "TI"))]
- (const_string "DI")))])
-
-(define_insn "*pushtf_sse"
- [(set (match_operand:TF 0 "push_operand" "=<,<,<")
- (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
- "TARGET_SSE2"
-{
- /* This insn should be already split before reg-stack. */
- gcc_unreachable ();
-}
- [(set_attr "type" "multi")
- (set_attr "unit" "sse,*,*")
- (set_attr "mode" "TF,SI,SI")])
-
-(define_split
- [(set (match_operand:TF 0 "push_operand" "")
- (match_operand:TF 1 "general_operand" ""))]
- "TARGET_SSE2 && reload_completed
- && !SSE_REG_P (operands[1])"
- [(const_int 0)]
- "ix86_split_long_move (operands); DONE;")
-
-(define_split
- [(set (match_operand:TF 0 "push_operand" "")
- (match_operand:TF 1 "any_fp_register_operand" ""))]
- "TARGET_SSE2"
- [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
- (set (mem:TF (reg:P SP_REG)) (match_dup 1))]
- "")
-
-(define_split
- [(set (match_operand 0 "nonimmediate_operand" "")
- (match_operand 1 "general_operand" ""))]
- "reload_completed
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))
- && GET_MODE (operands[0]) == XFmode
- && ! (ANY_FP_REG_P (operands[0]) ||
- (GET_CODE (operands[0]) == SUBREG
- && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
- && ! (ANY_FP_REG_P (operands[1]) ||
- (GET_CODE (operands[1]) == SUBREG
- && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
- [(const_int 0)]
- "ix86_split_long_move (operands); DONE;")
+ (const_string "SF"))
+ (eq_attr "alternative" "11")
+ (const_string "DI")]
+ (const_string "SF")))])
(define_split
[(set (match_operand 0 "register_operand" "")
@@ -3774,8 +3483,8 @@
&& MEM_P (operands[1])
&& (GET_MODE (operands[0]) == TFmode
|| GET_MODE (operands[0]) == XFmode
- || GET_MODE (operands[0]) == SFmode
- || GET_MODE (operands[0]) == DFmode)
+ || GET_MODE (operands[0]) == DFmode
+ || GET_MODE (operands[0]) == SFmode)
&& (operands[2] = find_constant_src (insn))"
[(set (match_dup 0) (match_dup 2))]
{
@@ -3806,8 +3515,8 @@
&& MEM_P (operands[1])
&& (GET_MODE (operands[0]) == TFmode
|| GET_MODE (operands[0]) == XFmode
- || GET_MODE (operands[0]) == SFmode
- || GET_MODE (operands[0]) == DFmode)
+ || GET_MODE (operands[0]) == DFmode
+ || GET_MODE (operands[0]) == SFmode)
&& (operands[2] = find_constant_src (insn))"
[(set (match_dup 0) (match_dup 2))]
{
@@ -3831,21 +3540,6 @@
FAIL;
})
-(define_insn "swapxf"
- [(set (match_operand:XF 0 "register_operand" "+f")
- (match_operand:XF 1 "register_operand" "+f"))
- (set (match_dup 1)
- (match_dup 0))]
- "TARGET_80387"
-{
- if (STACK_TOP_P (operands[0]))
- return "fxch\t%1";
- else
- return "fxch\t%0";
-}
- [(set_attr "type" "fxch")
- (set_attr "mode" "XF")])
-
;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence
(define_split
[(set (match_operand:X87MODEF 0 "register_operand" "")
@@ -3866,13 +3560,35 @@
operands[1] = CONST1_RTX (<MODE>mode);
})
-(define_split
- [(set (match_operand:TF 0 "nonimmediate_operand" "")
- (match_operand:TF 1 "general_operand" ""))]
- "reload_completed
- && !(SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]))"
- [(const_int 0)]
- "ix86_split_long_move (operands); DONE;")
+(define_insn "swapxf"
+ [(set (match_operand:XF 0 "register_operand" "+f")
+ (match_operand:XF 1 "register_operand" "+f"))
+ (set (match_dup 1)
+ (match_dup 0))]
+ "TARGET_80387"
+{
+ if (STACK_TOP_P (operands[0]))
+ return "fxch\t%1";
+ else
+ return "fxch\t%0";
+}
+ [(set_attr "type" "fxch")
+ (set_attr "mode" "XF")])
+
+(define_insn "*swap<mode>"
+ [(set (match_operand:MODEF 0 "fp_register_operand" "+f")
+ (match_operand:MODEF 1 "fp_register_operand" "+f"))
+ (set (match_dup 1)
+ (match_dup 0))]
+ "TARGET_80387 || reload_completed"
+{
+ if (STACK_TOP_P (operands[0]))
+ return "fxch\t%1";
+ else
+ return "fxch\t%0";
+}
+ [(set_attr "type" "fxch")
+ (set_attr "mode" "<MODE>")])
;; Zero extension instructions
@@ -4136,7 +3852,7 @@
(zero_extend:DI (match_operand:SI 1 "general_operand" "")))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT && reload_completed
- && !SSE_REG_P (operands[0]) && !MMX_REG_P (operands[0])"
+ && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))"
[(set (match_dup 3) (match_dup 1))
(set (match_dup 4) (const_int 0))]
"split_di (&operands[0], 1, &operands[3], &operands[4]);")
@@ -4411,7 +4127,7 @@
""
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
(set (mem:XF (reg:P SP_REG)) (float_extend:XF (match_dup 1)))]
- "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
+ "operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));")
(define_split
[(set (match_operand:XF 0 "push_operand" "")
@@ -4419,7 +4135,7 @@
""
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
(set (mem:DF (reg:P SP_REG)) (float_extend:XF (match_dup 1)))]
- "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
+ "operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));")
(define_expand "extendsfdf2"
[(set (match_operand:DF 0 "nonimmediate_operand" "")
@@ -5013,6 +4729,7 @@
(set (match_operand:SSEMODEI24 2 "register_operand" "")
(fix:SSEMODEI24 (match_dup 0)))]
"TARGET_SHORTEN_X87_SSE
+ && !(TARGET_AVOID_VECTOR_DECODE && optimize_insn_for_speed_p ())
&& peep2_reg_dead_p (2, operands[0])"
[(set (match_dup 2) (fix:SSEMODEI24 (match_dup 1)))]
"")
@@ -6118,10 +5835,6 @@
(const_string "lea")
(eq_attr "alternative" "3")
(const_string "lea")
- ; Current assemblers are broken and do not allow @GOTOFF in
- ; ought but a memory context.
- (match_operand:SWI48 2 "pic_symbolic_operand" "")
- (const_string "lea")
(match_operand:SWI48 2 "incdec_operand" "")
(const_string "incdec")
]
@@ -6172,10 +5885,6 @@
[(set (attr "type")
(cond [(eq_attr "alternative" "1")
(const_string "lea")
- ; Current assemblers are broken and do not allow @GOTOFF in
- ; ought but a memory context.
- (match_operand:SI 2 "pic_symbolic_operand" "")
- (const_string "lea")
(match_operand:SI 2 "incdec_operand" "")
(const_string "incdec")
]
@@ -6240,7 +5949,9 @@
{
case TYPE_LEA:
return "#";
+
case TYPE_INCDEC:
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (operands[2] == const1_rtx)
return "inc{w}\t%0";
else
@@ -6250,6 +5961,7 @@
}
default:
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], HImode))
return "sub{w}\t{%2, %0|%0, %2}";
@@ -6328,7 +6040,9 @@
{
case TYPE_LEA:
return "#";
+
case TYPE_INCDEC:
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (operands[2] == const1_rtx)
return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
else
@@ -6338,6 +6052,7 @@
}
default:
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], QImode))
{
if (widen)
@@ -6403,22 +6118,18 @@
(define_insn "*add<mode>_2"
[(set (reg FLAGS_REG)
(compare
- (plus:SWI48
- (match_operand:SWI48 1 "nonimmediate_operand" "%0,0")
- (match_operand:SWI48 2 "<general_operand>" "<g>,r<i>"))
+ (plus:SWI
+ (match_operand:SWI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:SWI 2 "<general_operand>" "<g>,<r><i>"))
(const_int 0)))
- (set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm")
- (plus:SWI48 (match_dup 1) (match_dup 2)))]
+ (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>,<r>m")
+ (plus:SWI (match_dup 1) (match_dup 2)))]
"ix86_match_ccmode (insn, CCGOCmode)
- && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)
- /* Current assemblers are broken and do not allow @GOTOFF in
- ought but a memory context. */
- && ! pic_symbolic_operand (operands[2], VOIDmode)"
+ && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
{
switch (get_attr_type (insn))
{
case TYPE_INCDEC:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (operands[2] == const1_rtx)
return "inc{<imodesuffix>}\t%0";
else
@@ -6428,9 +6139,6 @@
}
default:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
- /* ???? In DImode, we ought to handle there the 32bit case too
- - do we need new constraint? */
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
@@ -6438,7 +6146,7 @@
}
}
[(set (attr "type")
- (if_then_else (match_operand:SWI48 2 "incdec_operand" "")
+ (if_then_else (match_operand:SWI 2 "incdec_operand" "")
(const_string "incdec")
(const_string "alu")))
(set (attr "length_immediate")
@@ -6458,10 +6166,7 @@
(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
"TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
- && ix86_binary_operator_ok (PLUS, SImode, operands)
- /* Current assemblers are broken and do not allow @GOTOFF in
- ought but a memory context. */
- && ! pic_symbolic_operand (operands[2], VOIDmode)"
+ && ix86_binary_operator_ok (PLUS, SImode, operands)"
{
switch (get_attr_type (insn))
{
@@ -6492,99 +6197,18 @@
(const_string "*")))
(set_attr "mode" "SI")])
-(define_insn "*addhi_2"
- [(set (reg FLAGS_REG)
- (compare
- (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "rmn,rn"))
- (const_int 0)))
- (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
- (plus:HI (match_dup 1) (match_dup 2)))]
- "ix86_match_ccmode (insn, CCGOCmode)
- && ix86_binary_operator_ok (PLUS, HImode, operands)"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == const1_rtx)
- return "inc{w}\t%0";
- else
- {
- gcc_assert (operands[2] == constm1_rtx);
- return "dec{w}\t%0";
- }
-
- default:
- if (x86_maybe_negate_const_int (&operands[2], HImode))
- return "sub{w}\t{%2, %0|%0, %2}";
-
- return "add{w}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:HI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set (attr "length_immediate")
- (if_then_else
- (and (eq_attr "type" "alu") (match_operand 2 "const128_operand" ""))
- (const_string "1")
- (const_string "*")))
- (set_attr "mode" "HI")])
-
-(define_insn "*addqi_2"
- [(set (reg FLAGS_REG)
- (compare
- (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "qmn,qn"))
- (const_int 0)))
- (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
- (plus:QI (match_dup 1) (match_dup 2)))]
- "ix86_match_ccmode (insn, CCGOCmode)
- && ix86_binary_operator_ok (PLUS, QImode, operands)"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == const1_rtx)
- return "inc{b}\t%0";
- else
- {
- gcc_assert (operands[2] == constm1_rtx
- || (CONST_INT_P (operands[2])
- && INTVAL (operands[2]) == 255));
- return "dec{b}\t%0";
- }
-
- default:
- if (x86_maybe_negate_const_int (&operands[2], QImode))
- return "sub{b}\t{%2, %0|%0, %2}";
-
- return "add{b}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:QI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set_attr "mode" "QI")])
-
(define_insn "*add<mode>_3"
[(set (reg FLAGS_REG)
(compare
- (neg:SWI48 (match_operand:SWI48 2 "<general_operand>" "<g>"))
- (match_operand:SWI48 1 "nonimmediate_operand" "%0")))
- (clobber (match_scratch:SWI48 0 "=r"))]
+ (neg:SWI (match_operand:SWI 2 "<general_operand>" "<g>"))
+ (match_operand:SWI 1 "nonimmediate_operand" "%0")))
+ (clobber (match_scratch:SWI 0 "=<r>"))]
"ix86_match_ccmode (insn, CCZmode)
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))
- /* Current assemblers are broken and do not allow @GOTOFF in
- ought but a memory context. */
- && ! pic_symbolic_operand (operands[2], VOIDmode)"
+ && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
{
switch (get_attr_type (insn))
{
case TYPE_INCDEC:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (operands[2] == const1_rtx)
return "inc{<imodesuffix>}\t%0";
else
@@ -6594,9 +6218,6 @@
}
default:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
- /* ???? In DImode, we ought to handle there the 32bit case too
- - do we need new constraint? */
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
@@ -6604,7 +6225,7 @@
}
}
[(set (attr "type")
- (if_then_else (match_operand:SWI48 2 "incdec_operand" "")
+ (if_then_else (match_operand:SWI 2 "incdec_operand" "")
(const_string "incdec")
(const_string "alu")))
(set (attr "length_immediate")
@@ -6623,10 +6244,7 @@
(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
"TARGET_64BIT && ix86_match_ccmode (insn, CCZmode)
- && ix86_binary_operator_ok (PLUS, SImode, operands)
- /* Current assemblers are broken and do not allow @GOTOFF in
- ought but a memory context. */
- && ! pic_symbolic_operand (operands[2], VOIDmode)"
+ && ix86_binary_operator_ok (PLUS, SImode, operands)"
{
switch (get_attr_type (insn))
{
@@ -6657,79 +6275,6 @@
(const_string "*")))
(set_attr "mode" "SI")])
-(define_insn "*addhi_3"
- [(set (reg FLAGS_REG)
- (compare
- (neg:HI (match_operand:HI 2 "general_operand" "rmn"))
- (match_operand:HI 1 "nonimmediate_operand" "%0")))
- (clobber (match_scratch:HI 0 "=r"))]
- "ix86_match_ccmode (insn, CCZmode)
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == const1_rtx)
- return "inc{w}\t%0";
- else
- {
- gcc_assert (operands[2] == constm1_rtx);
- return "dec{w}\t%0";
- }
-
- default:
- if (x86_maybe_negate_const_int (&operands[2], HImode))
- return "sub{w}\t{%2, %0|%0, %2}";
-
- return "add{w}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:HI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set (attr "length_immediate")
- (if_then_else
- (and (eq_attr "type" "alu") (match_operand 2 "const128_operand" ""))
- (const_string "1")
- (const_string "*")))
- (set_attr "mode" "HI")])
-
-(define_insn "*addqi_3"
- [(set (reg FLAGS_REG)
- (compare
- (neg:QI (match_operand:QI 2 "general_operand" "qmn"))
- (match_operand:QI 1 "nonimmediate_operand" "%0")))
- (clobber (match_scratch:QI 0 "=q"))]
- "ix86_match_ccmode (insn, CCZmode)
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == const1_rtx)
- return "inc{b}\t%0";
- else
- {
- gcc_assert (operands[2] == constm1_rtx
- || (CONST_INT_P (operands[2])
- && INTVAL (operands[2]) == 255));
- return "dec{b}\t%0";
- }
-
- default:
- if (x86_maybe_negate_const_int (&operands[2], QImode))
- return "sub{b}\t{%2, %0|%0, %2}";
-
- return "add{b}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:QI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set_attr "mode" "QI")])
-
; For comparisons against 1, -1 and 128, we may generate better code
; by converting cmp to add, inc or dec as done by peephole2. This pattern
; is matched then. We can't accept general immediate, because for
@@ -6758,7 +6303,6 @@
}
default:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], DImode))
return "add{q}\t{%2, %0|%0, %2}";
@@ -6783,75 +6327,34 @@
; Also carry flag is reversed compared to cmp, so this conversion is valid
; only for comparisons not depending on it.
-(define_insn "*addsi_4"
+(define_insn "*add<mode>_4"
[(set (reg FLAGS_REG)
(compare
- (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))
- (clobber (match_scratch:SI 0 "=rm"))]
+ (match_operand:SWI124 1 "nonimmediate_operand" "0")
+ (match_operand:SWI124 2 "const_int_operand" "n")))
+ (clobber (match_scratch:SWI124 0 "=<r>m"))]
"ix86_match_ccmode (insn, CCGCmode)"
{
switch (get_attr_type (insn))
{
case TYPE_INCDEC:
if (operands[2] == constm1_rtx)
- return "inc{l}\t%0";
+ return "inc{<imodesuffix>}\t%0";
else
{
gcc_assert (operands[2] == const1_rtx);
- return "dec{l}\t%0";
- }
-
- default:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
- if (x86_maybe_negate_const_int (&operands[2], SImode))
- return "add{l}\t{%2, %0|%0, %2}";
-
- return "sub{l}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:SI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set (attr "length_immediate")
- (if_then_else
- (and (eq_attr "type" "alu") (match_operand 2 "const128_operand" ""))
- (const_string "1")
- (const_string "*")))
- (set_attr "mode" "SI")])
-
-; See comments above addsi_4 for details.
-
-(define_insn "*addhi_4"
- [(set (reg FLAGS_REG)
- (compare
- (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "const_int_operand" "n")))
- (clobber (match_scratch:HI 0 "=rm"))]
- "ix86_match_ccmode (insn, CCGCmode)"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == constm1_rtx)
- return "inc{w}\t%0";
- else
- {
- gcc_assert (operands[2] == const1_rtx);
- return "dec{w}\t%0";
+ return "dec{<imodesuffix>}\t%0";
}
default:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
- if (x86_maybe_negate_const_int (&operands[2], HImode))
- return "add{w}\t{%2, %0|%0, %2}";
+ if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
+ return "add{<imodesuffix>}\t{%2, %0|%0, %2}";
- return "sub{w}\t{%2, %0|%0, %2}";
+ return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
}
}
[(set (attr "type")
- (if_then_else (match_operand:HI 2 "incdec_operand" "")
+ (if_then_else (match_operand:<MODE> 2 "incdec_operand" "")
(const_string "incdec")
(const_string "alu")))
(set (attr "length_immediate")
@@ -6859,63 +6362,22 @@
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand" ""))
(const_string "1")
(const_string "*")))
- (set_attr "mode" "HI")])
-
-; See comments above addsi_4 for details.
-
-(define_insn "*addqi_4"
- [(set (reg FLAGS_REG)
- (compare
- (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "const_int_operand" "n")))
- (clobber (match_scratch:QI 0 "=qm"))]
- "ix86_match_ccmode (insn, CCGCmode)"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == constm1_rtx
- || (CONST_INT_P (operands[2])
- && INTVAL (operands[2]) == 255))
- return "inc{b}\t%0";
- else
- {
- gcc_assert (operands[2] == const1_rtx);
- return "dec{b}\t%0";
- }
-
- default:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
- if (x86_maybe_negate_const_int (&operands[2], QImode))
- return "add{b}\t{%2, %0|%0, %2}";
-
- return "sub{b}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:HI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set_attr "mode" "QI")])
+ (set_attr "mode" "<MODE>")])
(define_insn "*add<mode>_5"
[(set (reg FLAGS_REG)
(compare
- (plus:SWI48
- (match_operand:SWI48 1 "nonimmediate_operand" "%0")
- (match_operand:SWI48 2 "<general_operand>" "<g>"))
+ (plus:SWI
+ (match_operand:SWI 1 "nonimmediate_operand" "%0")
+ (match_operand:SWI 2 "<general_operand>" "<g>"))
(const_int 0)))
- (clobber (match_scratch:SWI48 0 "=r"))]
+ (clobber (match_scratch:SWI 0 "=<r>"))]
"ix86_match_ccmode (insn, CCGOCmode)
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))
- /* Current assemblers are broken and do not allow @GOTOFF in
- ought but a memory context. */
- && ! pic_symbolic_operand (operands[2], VOIDmode)"
+ && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
{
switch (get_attr_type (insn))
{
case TYPE_INCDEC:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (operands[2] == const1_rtx)
return "inc{<imodesuffix>}\t%0";
else
@@ -6925,7 +6387,6 @@
}
default:
- gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
@@ -6933,7 +6394,7 @@
}
}
[(set (attr "type")
- (if_then_else (match_operand:SWI48 2 "incdec_operand" "")
+ (if_then_else (match_operand:SWI 2 "incdec_operand" "")
(const_string "incdec")
(const_string "alu")))
(set (attr "length_immediate")
@@ -6943,81 +6404,6 @@
(const_string "*")))
(set_attr "mode" "<MODE>")])
-(define_insn "*addhi_5"
- [(set (reg FLAGS_REG)
- (compare
- (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
- (match_operand:HI 2 "general_operand" "rmn"))
- (const_int 0)))
- (clobber (match_scratch:HI 0 "=r"))]
- "ix86_match_ccmode (insn, CCGOCmode)
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == const1_rtx)
- return "inc{w}\t%0";
- else
- {
- gcc_assert (operands[2] == constm1_rtx);
- return "dec{w}\t%0";
- }
-
- default:
- if (x86_maybe_negate_const_int (&operands[2], HImode))
- return "sub{w}\t{%2, %0|%0, %2}";
-
- return "add{w}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:HI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set (attr "length_immediate")
- (if_then_else
- (and (eq_attr "type" "alu") (match_operand 2 "const128_operand" ""))
- (const_string "1")
- (const_string "*")))
- (set_attr "mode" "HI")])
-
-(define_insn "*addqi_5"
- [(set (reg FLAGS_REG)
- (compare
- (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
- (match_operand:QI 2 "general_operand" "qmn"))
- (const_int 0)))
- (clobber (match_scratch:QI 0 "=q"))]
- "ix86_match_ccmode (insn, CCGOCmode)
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
-{
- switch (get_attr_type (insn))
- {
- case TYPE_INCDEC:
- if (operands[2] == const1_rtx)
- return "inc{b}\t%0";
- else
- {
- gcc_assert (operands[2] == constm1_rtx
- || (CONST_INT_P (operands[2])
- && INTVAL (operands[2]) == 255));
- return "dec{b}\t%0";
- }
-
- default:
- if (x86_maybe_negate_const_int (&operands[2], QImode))
- return "sub{b}\t{%2, %0|%0, %2}";
-
- return "add{b}\t{%2, %0|%0, %2}";
- }
-}
- [(set (attr "type")
- (if_then_else (match_operand:QI 2 "incdec_operand" "")
- (const_string "incdec")
- (const_string "alu")))
- (set_attr "mode" "QI")])
-
(define_insn "*addqi_ext_1_rex64"
[(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
(const_int 8)
@@ -7038,9 +6424,7 @@
return "inc{b}\t%h0";
else
{
- gcc_assert (operands[2] == constm1_rtx
- || (CONST_INT_P (operands[2])
- && INTVAL (operands[2]) == 255));
+ gcc_assert (operands[2] == constm1_rtx);
return "dec{b}\t%h0";
}
@@ -7075,9 +6459,7 @@
return "inc{b}\t%h0";
else
{
- gcc_assert (operands[2] == constm1_rtx
- || (CONST_INT_P (operands[2])
- && INTVAL (operands[2]) == 255));
+ gcc_assert (operands[2] == constm1_rtx);
return "dec{b}\t%h0";
}
@@ -7890,17 +7272,6 @@
;; Divide instructions
-(define_insn "<u>divqi3"
- [(set (match_operand:QI 0 "register_operand" "=a")
- (any_div:QI
- (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "nonimmediate_operand" "qm")))
- (clobber (reg:CC FLAGS_REG))]
- "TARGET_QIMODE_MATH"
- "<sgnprefix>div{b}\t%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "QI")])
-
;; The patterns that match these are at the end of this file.
(define_expand "divxf3"
@@ -7937,6 +7308,92 @@
;; Divmod instructions.
+(define_expand "<u>divmodqi4"
+ [(parallel [(set (match_operand:QI 0 "register_operand" "")
+ (any_div:QI
+ (match_operand:QI 1 "register_operand" "")
+ (match_operand:QI 2 "nonimmediate_operand" "")))
+ (set (match_operand:QI 3 "register_operand" "")
+ (mod:QI (match_dup 1) (match_dup 2)))
+ (clobber (reg:CC FLAGS_REG))])]
+ "TARGET_QIMODE_MATH"
+{
+ rtx div, mod, insn;
+ rtx tmp0, tmp1;
+
+ tmp0 = gen_reg_rtx (HImode);
+ tmp1 = gen_reg_rtx (HImode);
+
+ /* Extend operands[1] to HImode. Generate 8bit divide. Result is
+ in AX. */
+ if (<extract_code> == SIGN_EXTRACT)
+ {
+ emit_insn (gen_extendqihi2 (tmp1, operands[1]));
+ emit_insn (gen_divmodhiqi3 (tmp0, tmp1, operands[2]));
+
+ div = gen_rtx_DIV (QImode, operands[1], operands[2]);
+ mod = gen_rtx_MOD (QImode, operands[1], operands[2]);
+
+ tmp1 = gen_rtx_<extract_code> (QImode, tmp0,
+ GEN_INT (8), GEN_INT (8));
+ }
+ else
+ {
+ emit_insn (gen_zero_extendqihi2 (tmp1, operands[1]));
+ emit_insn (gen_udivmodhiqi3 (tmp0, tmp1, operands[2]));
+
+ div = gen_rtx_UDIV (QImode, operands[1], operands[2]);
+ mod = gen_rtx_UMOD (QImode, operands[1], operands[2]);
+
+ tmp1 = gen_rtx_<extract_code> (SImode, tmp0,
+ GEN_INT (8), GEN_INT (8));
+ tmp1 = simplify_gen_subreg (QImode, tmp1, SImode, 0);
+ }
+
+ /* Extract remainder from AH. */
+ insn = emit_move_insn (operands[3], tmp1);
+ set_unique_reg_note (insn, REG_EQUAL, mod);
+
+ /* Extract quotient from AL. */
+ insn = emit_move_insn (operands[0], gen_lowpart (QImode, tmp0));
+ set_unique_reg_note (insn, REG_EQUAL, div);
+
+ DONE;
+})
+
+;; Divide AX by r/m8, with result stored in
+;; AL <- Quotient
+;; AH <- Remainder
+(define_insn "divmodhiqi3"
+ [(set (match_operand:HI 0 "register_operand" "=a")
+ (ior:HI
+ (ashift:HI
+ (zero_extend:HI
+ (mod:QI (match_operand:HI 1 "register_operand" "0")
+ (match_operand:QI 2 "nonimmediate_operand" "qm")))
+ (const_int 8))
+ (zero_extend:HI (div:QI (match_dup 1) (match_dup 2)))))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_QIMODE_MATH"
+ "idiv{b}\t%2"
+ [(set_attr "type" "idiv")
+ (set_attr "mode" "QI")])
+
+(define_insn "udivmodhiqi3"
+ [(set (match_operand:HI 0 "register_operand" "=a")
+ (ior:HI
+ (ashift:HI
+ (zero_extend:HI
+ (umod:QI (match_operand:HI 1 "register_operand" "0")
+ (match_operand:QI 2 "nonimmediate_operand" "qm")))
+ (const_int 8))
+ (zero_extend:HI (udiv:QI (match_dup 1) (match_dup 2)))))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_QIMODE_MATH"
+ "div{b}\t%2"
+ [(set_attr "type" "idiv")
+ (set_attr "mode" "QI")])
+
(define_expand "divmod<mode>4"
[(parallel [(set (match_operand:SWIM248 0 "register_operand" "")
(div:SWIM248
@@ -10142,7 +9599,7 @@
"TARGET_64BIT && reload_completed
&& true_regnum (operands[0]) != true_regnum (operands[1])"
[(set (match_dup 0)
- (zero_extend:DI (subreg:SI (mult:SI (match_dup 1) (match_dup 2)) 0)))]
+ (zero_extend:DI (subreg:SI (mult:DI (match_dup 1) (match_dup 2)) 0)))]
{
operands[1] = gen_lowpart (Pmode, operands[1]);
operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
@@ -10854,7 +10311,7 @@
FAIL;
if (TARGET_64BIT)
- emit_insn (gen_movdi_insv_1_rex64 (operands[0], operands[3]));
+ emit_insn (gen_movdi_insv_1 (operands[0], operands[3]));
else
emit_insn (gen_movsi_insv_1 (operands[0], operands[3]));
@@ -11420,7 +10877,7 @@
;; Define combination compare-and-branch fp compare instructions to help
;; combine.
-(define_insn "*fp_jcc_3_387"
+(define_insn "*fp_jcc_1_387"
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
[(match_operand 1 "register_operand" "f")
@@ -11438,7 +10895,7 @@
&& !TARGET_CMOVE"
"#")
-(define_insn "*fp_jcc_4_387"
+(define_insn "*fp_jcc_1r_387"
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
[(match_operand 1 "register_operand" "f")
@@ -11456,7 +10913,7 @@
&& !TARGET_CMOVE"
"#")
-(define_insn "*fp_jcc_5_387"
+(define_insn "*fp_jcc_2_387"
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
[(match_operand 1 "register_operand" "f")
@@ -11471,7 +10928,7 @@
&& !TARGET_CMOVE"
"#")
-(define_insn "*fp_jcc_6_387"
+(define_insn "*fp_jcc_2r_387"
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
[(match_operand 1 "register_operand" "f")
@@ -11486,7 +10943,7 @@
&& !TARGET_CMOVE"
"#")
-(define_insn "*fp_jcc_7_387"
+(define_insn "*fp_jcc_3_387"
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
[(match_operand 1 "register_operand" "f")
@@ -11503,29 +10960,6 @@
&& !TARGET_CMOVE"
"#")
-;; The order of operands in *fp_jcc_8_387 is forced by combine in
-;; simplify_comparison () function. Float operator is treated as RTX_OBJ
-;; with a precedence over other operators and is always put in the first
-;; place. Swap condition and operands to match ficom instruction.
-
-(define_insn "*fp_jcc_8<mode>_387"
- [(set (pc)
- (if_then_else (match_operator 0 "ix86_fp_comparison_operator"
- [(match_operator 1 "float_operator"
- [(match_operand:X87MODEI12 2 "nonimmediate_operand" "m,?r")])
- (match_operand 3 "register_operand" "f,f")])
- (label_ref (match_operand 4 "" ""))
- (pc)))
- (clobber (reg:CCFP FPSR_REG))
- (clobber (reg:CCFP FLAGS_REG))
- (clobber (match_scratch:HI 5 "=a,a"))]
- "X87_FLOAT_MODE_P (GET_MODE (operands[3]))
- && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
- && GET_MODE (operands[1]) == GET_MODE (operands[3])
- && ix86_fp_compare_mode (swap_condition (GET_CODE (operands[0]))) == CCFPmode
- && !TARGET_CMOVE"
- "#")
-
(define_split
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
@@ -11561,12 +10995,37 @@
DONE;
})
+;; The order of operands in *fp_jcc_4_387 is forced by combine in
+;; simplify_comparison () function. Float operator is treated as RTX_OBJ
+;; with a precedence over other operators and is always put in the first
+;; place. Swap condition and operands to match ficom instruction.
+
+(define_insn "*fp_jcc_4_<mode>_387"
+ [(set (pc)
+ (if_then_else
+ (match_operator 0 "ix86_swapped_fp_comparison_operator"
+ [(match_operator 1 "float_operator"
+ [(match_operand:X87MODEI12 2 "nonimmediate_operand" "m,?r")])
+ (match_operand 3 "register_operand" "f,f")])
+ (label_ref (match_operand 4 "" ""))
+ (pc)))
+ (clobber (reg:CCFP FPSR_REG))
+ (clobber (reg:CCFP FLAGS_REG))
+ (clobber (match_scratch:HI 5 "=a,a"))]
+ "X87_FLOAT_MODE_P (GET_MODE (operands[3]))
+ && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
+ && GET_MODE (operands[1]) == GET_MODE (operands[3])
+ && ix86_fp_compare_mode (swap_condition (GET_CODE (operands[0]))) == CCFPmode
+ && !TARGET_CMOVE"
+ "#")
+
(define_split
[(set (pc)
- (if_then_else (match_operator 0 "ix86_fp_comparison_operator"
- [(match_operator 1 "float_operator"
- [(match_operand:X87MODEI12 2 "memory_operand" "")])
- (match_operand 3 "register_operand" "")])
+ (if_then_else
+ (match_operator 0 "ix86_swapped_fp_comparison_operator"
+ [(match_operator 1 "float_operator"
+ [(match_operand:X87MODEI12 2 "memory_operand" "")])
+ (match_operand 3 "register_operand" "")])
(match_operand 4 "" "")
(match_operand 5 "" "")))
(clobber (reg:CCFP FPSR_REG))
@@ -11586,10 +11045,11 @@
;; %%% Kill this when reload knows how to do it.
(define_split
[(set (pc)
- (if_then_else (match_operator 0 "ix86_fp_comparison_operator"
- [(match_operator 1 "float_operator"
- [(match_operand:X87MODEI12 2 "register_operand" "")])
- (match_operand 3 "register_operand" "")])
+ (if_then_else
+ (match_operator 0 "ix86_swapped_fp_comparison_operator"
+ [(match_operator 1 "float_operator"
+ [(match_operand:X87MODEI12 2 "register_operand" "")])
+ (match_operand 3 "register_operand" "")])
(match_operand 4 "" "")
(match_operand 5 "" "")))
(clobber (reg:CCFP FPSR_REG))
@@ -12521,7 +11981,8 @@
(define_insn_and_split "paritydi2_cmp"
[(set (reg:CC FLAGS_REG)
- (parity:CC (match_operand:DI 3 "register_operand" "0")))
+ (unspec:CC [(match_operand:DI 3 "register_operand" "0")]
+ UNSPEC_PARITY))
(clobber (match_scratch:DI 0 "=r"))
(clobber (match_scratch:SI 1 "=&r"))
(clobber (match_scratch:HI 2 "=Q"))]
@@ -12534,7 +11995,7 @@
(clobber (reg:CC FLAGS_REG))])
(parallel
[(set (reg:CC FLAGS_REG)
- (parity:CC (match_dup 1)))
+ (unspec:CC [(match_dup 1)] UNSPEC_PARITY))
(clobber (match_dup 1))
(clobber (match_dup 2))])]
{
@@ -12551,7 +12012,8 @@
(define_insn_and_split "paritysi2_cmp"
[(set (reg:CC FLAGS_REG)
- (parity:CC (match_operand:SI 2 "register_operand" "0")))
+ (unspec:CC [(match_operand:SI 2 "register_operand" "0")]
+ UNSPEC_PARITY))
(clobber (match_scratch:SI 0 "=r"))
(clobber (match_scratch:HI 1 "=&Q"))]
"! TARGET_POPCNT"
@@ -12563,7 +12025,7 @@
(clobber (reg:CC FLAGS_REG))])
(parallel
[(set (reg:CC FLAGS_REG)
- (parity:CC (match_dup 1)))
+ (unspec:CC [(match_dup 1)] UNSPEC_PARITY))
(clobber (match_dup 1))])]
{
operands[3] = gen_lowpart (HImode, operands[2]);
@@ -12574,20 +12036,13 @@
(define_insn "*parityhi2_cmp"
[(set (reg:CC FLAGS_REG)
- (parity:CC (match_operand:HI 1 "register_operand" "0")))
+ (unspec:CC [(match_operand:HI 1 "register_operand" "0")]
+ UNSPEC_PARITY))
(clobber (match_scratch:HI 0 "=Q"))]
"! TARGET_POPCNT"
"xor{b}\t{%h0, %b0|%b0, %h0}"
[(set_attr "length" "2")
(set_attr "mode" "HI")])
-
-(define_insn "*parityqi2_cmp"
- [(set (reg:CC FLAGS_REG)
- (parity:CC (match_operand:QI 0 "register_operand" "q")))]
- "! TARGET_POPCNT"
- "test{b}\t%0, %0"
- [(set_attr "length" "2")
- (set_attr "mode" "QI")])
;; Thread-local storage patterns for ELF.
;;
@@ -16874,22 +16329,15 @@
return "mov{l}\t{%1, %0|%0, %1}";
case TYPE_ALU:
- if (CONST_INT_P (operands[2])
- && (INTVAL (operands[2]) == 128
- || (INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) != -128)))
- {
- operands[2] = GEN_INT (-INTVAL (operands[2]));
- return "sub{l}\t{%2, %0|%0, %2}";
- }
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
+ if (x86_maybe_negate_const_int (&operands[2], SImode))
+ return "sub{l}\t{%2, %0|%0, %2}";
+
return "add{l}\t{%2, %0|%0, %2}";
- case TYPE_LEA:
+ default:
operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
return "lea{l}\t{%a2, %0|%0, %a2}";
-
- default:
- gcc_unreachable ();
}
}
[(set (attr "type")
@@ -16924,24 +16372,15 @@
return "mov{q}\t{%1, %0|%0, %1}";
case TYPE_ALU:
- if (CONST_INT_P (operands[2])
- /* Avoid overflows. */
- && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
- && (INTVAL (operands[2]) == 128
- || (INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) != -128)))
- {
- operands[2] = GEN_INT (-INTVAL (operands[2]));
- return "sub{q}\t{%2, %0|%0, %2}";
- }
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
+ if (x86_maybe_negate_const_int (&operands[2], DImode))
+ return "sub{q}\t{%2, %0|%0, %2}";
+
return "add{q}\t{%2, %0|%0, %2}";
- case TYPE_LEA:
+ default:
operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
return "lea{q}\t{%a2, %0|%0, %a2}";
-
- default:
- gcc_unreachable ();
}
}
[(set (attr "type")
@@ -18120,15 +17559,14 @@
;; leal (%edx,%eax,4), %eax
(define_peephole2
- [(parallel [(set (match_operand 0 "register_operand" "")
+ [(match_scratch:P 5 "r")
+ (parallel [(set (match_operand 0 "register_operand" "")
(ashift (match_operand 1 "register_operand" "")
(match_operand 2 "const_int_operand" "")))
(clobber (reg:CC FLAGS_REG))])
- (set (match_operand 3 "register_operand")
- (match_operand 4 "x86_64_general_operand" ""))
- (parallel [(set (match_operand 5 "register_operand" "")
- (plus (match_operand 6 "register_operand" "")
- (match_operand 7 "register_operand" "")))
+ (parallel [(set (match_operand 3 "register_operand" "")
+ (plus (match_dup 0)
+ (match_operand 4 "x86_64_general_operand" "")))
(clobber (reg:CC FLAGS_REG))])]
"INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 3
/* Validate MODE for lea. */
@@ -18137,31 +17575,27 @@
|| GET_MODE (operands[0]) == HImode))
|| GET_MODE (operands[0]) == SImode
|| (TARGET_64BIT && GET_MODE (operands[0]) == DImode))
+ && (rtx_equal_p (operands[0], operands[3])
+ || peep2_reg_dead_p (2, operands[0]))
/* We reorder load and the shift. */
- && !rtx_equal_p (operands[1], operands[3])
- && !reg_overlap_mentioned_p (operands[0], operands[4])
- /* Last PLUS must consist of operand 0 and 3. */
- && !rtx_equal_p (operands[0], operands[3])
- && (rtx_equal_p (operands[3], operands[6])
- || rtx_equal_p (operands[3], operands[7]))
- && (rtx_equal_p (operands[0], operands[6])
- || rtx_equal_p (operands[0], operands[7]))
- /* The intermediate operand 0 must die or be same as output. */
- && (rtx_equal_p (operands[0], operands[5])
- || peep2_reg_dead_p (3, operands[0]))"
- [(set (match_dup 3) (match_dup 4))
+ && !reg_overlap_mentioned_p (operands[0], operands[4])"
+ [(set (match_dup 5) (match_dup 4))
(set (match_dup 0) (match_dup 1))]
{
- enum machine_mode mode = GET_MODE (operands[5]) == DImode ? DImode : SImode;
+ enum machine_mode mode = GET_MODE (operands[1]) == DImode ? DImode : SImode;
int scale = 1 << INTVAL (operands[2]);
rtx index = gen_lowpart (Pmode, operands[1]);
- rtx base = gen_lowpart (Pmode, operands[3]);
- rtx dest = gen_lowpart (mode, operands[5]);
+ rtx base = gen_lowpart (Pmode, operands[5]);
+ rtx dest = gen_lowpart (mode, operands[3]);
operands[1] = gen_rtx_PLUS (Pmode, base,
gen_rtx_MULT (Pmode, index, GEN_INT (scale)));
+ operands[5] = base;
if (mode != Pmode)
- operands[1] = gen_rtx_SUBREG (mode, operands[1], 0);
+ {
+ operands[1] = gen_rtx_SUBREG (mode, operands[1], 0);
+ operands[5] = gen_rtx_SUBREG (mode, operands[5], 0);
+ }
operands[0] = dest;
})
@@ -18549,11 +17983,11 @@
operands[1] = const0_rtx;
})
-(define_insn "*prefetch_sse"
- [(prefetch (match_operand:SI 0 "address_operand" "p")
+(define_insn "*prefetch_sse_<mode>"
+ [(prefetch (match_operand:P 0 "address_operand" "p")
(const_int 0)
(match_operand:SI 1 "const_int_operand" ""))]
- "TARGET_PREFETCH_SSE && !TARGET_64BIT"
+ "TARGET_PREFETCH_SSE"
{
static const char * const patterns[4] = {
"prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
@@ -18566,49 +18000,15 @@
}
[(set_attr "type" "sse")
(set_attr "atom_sse_attr" "prefetch")
- (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])"))
- (set_attr "memory" "none")])
-
-(define_insn "*prefetch_sse_rex"
- [(prefetch (match_operand:DI 0 "address_operand" "p")
- (const_int 0)
- (match_operand:SI 1 "const_int_operand" ""))]
- "TARGET_PREFETCH_SSE && TARGET_64BIT"
-{
- static const char * const patterns[4] = {
- "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
- };
-
- int locality = INTVAL (operands[1]);
- gcc_assert (locality >= 0 && locality <= 3);
-
- return patterns[locality];
-}
- [(set_attr "type" "sse")
- (set_attr "atom_sse_attr" "prefetch")
- (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])"))
- (set_attr "memory" "none")])
-
-(define_insn "*prefetch_3dnow"
- [(prefetch (match_operand:SI 0 "address_operand" "p")
- (match_operand:SI 1 "const_int_operand" "n")
- (const_int 3))]
- "TARGET_3DNOW && !TARGET_64BIT"
-{
- if (INTVAL (operands[1]) == 0)
- return "prefetch\t%a0";
- else
- return "prefetchw\t%a0";
-}
- [(set_attr "type" "mmx")
- (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])"))
+ (set (attr "length_address")
+ (symbol_ref "memory_address_length (operands[0])"))
(set_attr "memory" "none")])
-(define_insn "*prefetch_3dnow_rex"
- [(prefetch (match_operand:DI 0 "address_operand" "p")
+(define_insn "*prefetch_3dnow_<mode>"
+ [(prefetch (match_operand:P 0 "address_operand" "p")
(match_operand:SI 1 "const_int_operand" "n")
(const_int 3))]
- "TARGET_3DNOW && TARGET_64BIT"
+ "TARGET_3DNOW"
{
if (INTVAL (operands[1]) == 0)
return "prefetch\t%a0";
@@ -18616,7 +18016,8 @@
return "prefetchw\t%a0";
}
[(set_attr "type" "mmx")
- (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])"))
+ (set (attr "length_address")
+ (symbol_ref "memory_address_length (operands[0])"))
(set_attr "memory" "none")])
(define_expand "stack_protect_set"
@@ -18660,7 +18061,8 @@
(define_insn "stack_tls_protect_set_si"
[(set (match_operand:SI 0 "memory_operand" "=m")
- (unspec:SI [(match_operand:SI 1 "const_int_operand" "i")] UNSPEC_SP_TLS_SET))
+ (unspec:SI [(match_operand:SI 1 "const_int_operand" "i")]
+ UNSPEC_SP_TLS_SET))
(set (match_scratch:SI 2 "=&r") (const_int 0))
(clobber (reg:CC FLAGS_REG))]
""
@@ -18669,7 +18071,8 @@
(define_insn "stack_tls_protect_set_di"
[(set (match_operand:DI 0 "memory_operand" "=m")
- (unspec:DI [(match_operand:DI 1 "const_int_operand" "i")] UNSPEC_SP_TLS_SET))
+ (unspec:DI [(match_operand:DI 1 "const_int_operand" "i")]
+ UNSPEC_SP_TLS_SET))
(set (match_scratch:DI 2 "=&r") (const_int 0))
(clobber (reg:CC FLAGS_REG))]
"TARGET_64BIT"
diff --git a/gcc/config/i386/msformat-c.c b/gcc/config/i386/msformat-c.c
index af5c0f95f94..635c2ca6b62 100644
--- a/gcc/config/i386/msformat-c.c
+++ b/gcc/config/i386/msformat-c.c
@@ -25,12 +25,12 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "flags.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "toplev.h"
#include "intl.h"
#include "diagnostic.h"
#include "langhooks.h"
-#include "c-format.h"
+#include "c-family/c-format.h"
#include "alloc-pool.h"
/* Mingw specific format attributes ms_printf, ms_scanf, and ms_strftime. */
diff --git a/gcc/config/i386/ppro.md b/gcc/config/i386/ppro.md
index 5e163d8296f..20f457ab192 100644
--- a/gcc/config/i386/ppro.md
+++ b/gcc/config/i386/ppro.md
@@ -731,7 +731,7 @@
(define_insn_reservation "ppro_insn" 1
(and (eq_attr "cpu" "pentiumpro")
(and (eq_attr "memory" "none,unknown")
- (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseimul,mmx,mmxadd,mmxcmp")))
+ (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseishft1,sseimul,mmx,mmxadd,mmxcmp")))
"decodern,(p0|p1)")
;; read-modify and register-memory instructions have 2 or three uops,
@@ -739,13 +739,13 @@
(define_insn_reservation "ppro_insn_load" 3
(and (eq_attr "cpu" "pentiumpro")
(and (eq_attr "memory" "load")
- (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseimul,mmx,mmxadd,mmxcmp")))
+ (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseishft1,sseimul,mmx,mmxadd,mmxcmp")))
"decoder0,p2+(p0|p1)")
(define_insn_reservation "ppro_insn_store" 1
(and (eq_attr "cpu" "pentiumpro")
(and (eq_attr "memory" "store")
- (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseimul,mmx,mmxadd,mmxcmp")))
+ (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseishft1,sseimul,mmx,mmxadd,mmxcmp")))
"decoder0,(p0|p1),p4+p3")
;; read-modify-store instructions produce 4 uops so they have to be
@@ -753,6 +753,6 @@
(define_insn_reservation "ppro_insn_both" 4
(and (eq_attr "cpu" "pentiumpro")
(and (eq_attr "memory" "both")
- (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseimul,mmx,mmxadd,mmxcmp")))
+ (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,icmov,push,pop,fxch,sseiadd,sseishft,sseishft1,sseimul,mmx,mmxadd,mmxcmp")))
"decoder0,p2+(p0|p1),p4+p3")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 8f901cd8754..e5fea4a29d9 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -420,36 +420,6 @@
}
})
-;; Return true if the operand contains a @GOT or @GOTOFF reference.
-(define_predicate "pic_symbolic_operand"
- (match_code "const")
-{
- op = XEXP (op, 0);
- if (TARGET_64BIT)
- {
- if (GET_CODE (op) == UNSPEC
- && XINT (op, 1) == UNSPEC_GOTPCREL)
- return 1;
- if (GET_CODE (op) == PLUS
- && GET_CODE (XEXP (op, 0)) == UNSPEC
- && XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL)
- return 1;
- }
- else
- {
- if (GET_CODE (op) == UNSPEC)
- return 1;
- if (GET_CODE (op) != PLUS
- || !CONST_INT_P (XEXP (op, 1)))
- return 0;
- op = XEXP (op, 0);
- if (GET_CODE (op) == UNSPEC
- && XINT (op, 1) != UNSPEC_MACHOPIC_OFFSET)
- return 1;
- }
- return 0;
-})
-
;; Return true if OP is a symbolic operand that resolves locally.
(define_predicate "local_symbolic_operand"
(match_code "const,label_ref,symbol_ref")
@@ -1083,6 +1053,19 @@
(match_operand 0 "comparison_operator")
(match_operand 0 "ix86_trivial_fp_comparison_operator")))
+;; Same as above, but for swapped comparison used in fp_jcc_4_387.
+(define_predicate "ix86_swapped_fp_comparison_operator"
+ (match_operand 0 "comparison_operator")
+{
+ enum rtx_code code = GET_CODE (op);
+ int ret;
+
+ PUT_CODE (op, swap_condition (code));
+ ret = ix86_fp_comparison_operator (op, mode);
+ PUT_CODE (op, code);
+ return ret;
+})
+
;; Nearly general operand, but accept any const_double, since we wish
;; to be able to drop them into memory rather than have them get pulled
;; into registers.
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index 6a014651be5..11eaa15dd80 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -145,7 +145,7 @@ along with GCC; see the file COPYING3. If not see
do \
{ \
fprintf (FILE, "\tcall\t"); \
- print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
+ ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
fprintf (FILE, "\n"); \
} \
while (0)
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index dd95f3ff7d2..763b48de510 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -89,18 +89,13 @@
;; Mapping from integer vector mode to mnemonic suffix
(define_mode_attr ssevecsize [(V16QI "b") (V8HI "w") (V4SI "d") (V2DI "q")])
-;; Mapping of the fma4 suffix
-(define_mode_attr fma4modesuffixf4 [(V8SF "ps") (V4DF "pd")])
-(define_mode_attr ssemodesuffixf2s [(SF "ss") (DF "sd")
- (V4SF "ss") (V2DF "sd")])
-
-;; Mapping of the avx suffix
-(define_mode_attr ssemodesuffixf4 [(SF "ss") (DF "sd")
- (V4SF "ps") (V2DF "pd")])
-
-(define_mode_attr ssemodesuffixf2c [(V4SF "s") (V2DF "d")])
-
-(define_mode_attr ssescalarmodesuffix2s [(V4SF "ss") (V4SI "d")])
+;; Mapping of the insn mnemonic suffix
+(define_mode_attr ssemodesuffix
+ [(SF "ss") (DF "sd") (V4SF "ps") (V2DF "pd") (V8SF "ps") (V4DF "pd")
+ (V8SI "ps") (V4DI "pd")])
+(define_mode_attr ssescalarmodesuffix
+ [(SF "ss") (DF "sd") (V4SF "ss") (V2DF "sd") (V8SF "ss") (V4DF "sd")
+ (V4SI "d")])
;; Mapping of the max integer size for xop rotate immediate constraint
(define_mode_attr sserotatemax [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
@@ -141,8 +136,6 @@
[(V4SF "V4SI") (V8SF "V8SI") (V4SI "V4SF") (V8SI "V8SF")])
(define_mode_attr avxpermvecmode
[(V2DF "V2DI") (V4SF "V4SI") (V4DF "V4DI") (V8SF "V8SI")])
-(define_mode_attr avxmodesuffixf2c
- [(V4SF "s") (V2DF "d") (V8SI "s") (V8SF "s") (V4DI "d") (V4DF "d")])
(define_mode_attr avxmodesuffixp
[(V2DF "pd") (V4SI "si") (V4SF "ps") (V8SF "ps") (V8SI "si")
(V4DF "pd")])
@@ -366,14 +359,14 @@
DONE;
})
-(define_insn "avx_movup<avxmodesuffixf2c><avxmodesuffix>"
+(define_insn "avx_movu<ssemodesuffix><avxmodesuffix>"
[(set (match_operand:AVXMODEF2P 0 "nonimmediate_operand" "=x,m")
(unspec:AVXMODEF2P
[(match_operand:AVXMODEF2P 1 "nonimmediate_operand" "xm,x")]
UNSPEC_MOVU))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
- "vmovup<avxmodesuffixf2c>\t{%1, %0|%0, %1}"
+ "vmovu<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
(set_attr "movu" "1")
(set_attr "prefix" "vex")
@@ -392,14 +385,14 @@
(set_attr "prefix" "maybe_vex")
(set_attr "mode" "TI")])
-(define_insn "<sse>_movup<ssemodesuffixf2c>"
+(define_insn "<sse>_movu<ssemodesuffix>"
[(set (match_operand:SSEMODEF2P 0 "nonimmediate_operand" "=x,m")
(unspec:SSEMODEF2P
[(match_operand:SSEMODEF2P 1 "nonimmediate_operand" "xm,x")]
UNSPEC_MOVU))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
- "movup<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
+ "movu<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
(set_attr "movu" "1")
(set_attr "mode" "<MODE>")])
@@ -433,7 +426,7 @@
[(match_operand:AVXMODEF2P 1 "register_operand" "x")]
UNSPEC_MOVNT))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vmovntp<avxmodesuffixf2c>\t{%1, %0|%0, %1}"
+ "vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
@@ -444,7 +437,7 @@
[(match_operand:SSEMODEF2P 1 "register_operand" "x")]
UNSPEC_MOVNT))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "movntp<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
+ "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
(set_attr "mode" "<MODE>")])
@@ -580,7 +573,7 @@
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
- "v<plusminus_mnemonic>p<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "v<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sseadd")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
@@ -600,7 +593,7 @@
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
- "<plusminus_mnemonic>p<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sseadd")
(set_attr "mode" "<MODE>")])
@@ -613,7 +606,7 @@
(match_dup 1)
(const_int 1)))]
"AVX128_VEC_FLOAT_MODE_P (<MODE>mode)"
- "v<plusminus_mnemonic>s<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "v<plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sseadd")
(set_attr "prefix" "vex")
(set_attr "mode" "<ssescalarmode>")])
@@ -627,7 +620,7 @@
(match_dup 1)
(const_int 1)))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "<plusminus_mnemonic>s<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "<plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sseadd")
(set_attr "mode" "<ssescalarmode>")])
@@ -646,7 +639,7 @@
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)
&& ix86_binary_operator_ok (MULT, <MODE>mode, operands)"
- "vmulp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vmul<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssemul")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
@@ -666,7 +659,7 @@
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)
&& ix86_binary_operator_ok (MULT, <MODE>mode, operands)"
- "mulp<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "mul<ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "ssemul")
(set_attr "mode" "<MODE>")])
@@ -679,7 +672,7 @@
(match_dup 1)
(const_int 1)))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vmuls<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vmul<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssemul")
(set_attr "prefix" "vex")
(set_attr "mode" "<ssescalarmode>")])
@@ -693,7 +686,7 @@
(match_dup 1)
(const_int 1)))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "muls<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "mul<ssescalarmodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "ssemul")
(set_attr "mode" "<ssescalarmode>")])
@@ -728,7 +721,7 @@
(match_operand:AVXMODEF2P 1 "register_operand" "x")
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vdivp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vdiv<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssediv")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
@@ -762,7 +755,7 @@
(match_operand:SSEMODEF2P 1 "register_operand" "x")
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX128_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vdivp<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vdiv<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssediv")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
@@ -773,7 +766,7 @@
(match_operand:SSEMODEF2P 1 "register_operand" "0")
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "divp<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "div<ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "ssediv")
(set_attr "mode" "<MODE>")])
@@ -786,7 +779,7 @@
(match_dup 1)
(const_int 1)))]
"AVX128_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vdivs<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vdiv<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssediv")
(set_attr "prefix" "vex")
(set_attr "mode" "<ssescalarmode>")])
@@ -800,7 +793,7 @@
(match_dup 1)
(const_int 1)))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "divs<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "div<ssescalarmodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "ssediv")
(set_attr "mode" "<ssescalarmode>")])
@@ -924,7 +917,7 @@
(match_operand:SSEMODEF2P 2 "register_operand" "x")
(const_int 1)))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vsqrts<ssemodesuffixf2c>\t{%1, %2, %0|%0, %2, %1}"
+ "vsqrt<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %1}"
[(set_attr "type" "sse")
(set_attr "prefix" "vex")
(set_attr "mode" "<ssescalarmode>")])
@@ -937,7 +930,7 @@
(match_operand:SSEMODEF2P 2 "register_operand" "0")
(const_int 1)))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "sqrts<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
+ "sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "sse")
(set_attr "atom_sse_attr" "sqrt")
(set_attr "mode" "<ssescalarmode>")])
@@ -1042,7 +1035,7 @@
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode) && flag_finite_math_only
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
- "v<maxmin_float>p<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "v<maxmin_float><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sseadd")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
@@ -1054,7 +1047,7 @@
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode) && flag_finite_math_only
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
- "<maxmin_float>p<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "<maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sseadd")
(set_attr "mode" "<MODE>")])
@@ -1064,7 +1057,7 @@
(match_operand:AVXMODEF2P 1 "nonimmediate_operand" "%x")
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "v<maxmin_float>p<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "v<maxmin_float><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sseadd")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
@@ -1075,7 +1068,7 @@
(match_operand:SSEMODEF2P 1 "register_operand" "0")
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "<maxmin_float>p<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "<maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sseadd")
(set_attr "mode" "<MODE>")])
@@ -1088,7 +1081,7 @@
(match_dup 1)
(const_int 1)))]
"AVX128_VEC_FLOAT_MODE_P (<MODE>mode)"
- "v<maxmin_float>s<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "v<maxmin_float><ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sse")
(set_attr "prefix" "vex")
(set_attr "mode" "<ssescalarmode>")])
@@ -1102,7 +1095,7 @@
(match_dup 1)
(const_int 1)))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "<maxmin_float>s<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "<maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sseadd")
(set_attr "mode" "<ssescalarmode>")])
@@ -1119,7 +1112,7 @@
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")]
UNSPEC_IEEE_MIN))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vminp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vmin<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sseadd")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
@@ -1131,7 +1124,7 @@
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")]
UNSPEC_IEEE_MAX))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vmaxp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vmax<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sseadd")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
@@ -1143,7 +1136,7 @@
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")]
UNSPEC_IEEE_MIN))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "minp<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "min<ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sseadd")
(set_attr "mode" "<MODE>")])
@@ -1154,7 +1147,7 @@
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")]
UNSPEC_IEEE_MAX))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "maxp<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "max<ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sseadd")
(set_attr "mode" "<MODE>")])
@@ -1477,7 +1470,7 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(define_insn "avx_cmpp<avxmodesuffixf2c><mode>3"
+(define_insn "avx_cmp<ssemodesuffix><mode>3"
[(set (match_operand:AVXMODEF2P 0 "register_operand" "=x")
(unspec:AVXMODEF2P
[(match_operand:AVXMODEF2P 1 "register_operand" "x")
@@ -1485,13 +1478,13 @@
(match_operand:SI 3 "const_0_to_31_operand" "n")]
UNSPEC_PCMP))]
"TARGET_AVX"
- "vcmpp<avxmodesuffixf2c>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssecmp")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
-(define_insn "avx_cmps<ssemodesuffixf2c><mode>3"
+(define_insn "avx_cmp<ssescalarmodesuffix><mode>3"
[(set (match_operand:SSEMODEF2P 0 "register_operand" "")
(vec_merge:SSEMODEF2P
(unspec:SSEMODEF2P
@@ -1502,7 +1495,7 @@
(match_dup 1)
(const_int 1)))]
"TARGET_AVX"
- "vcmps<ssemodesuffixf2c>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssecmp")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
@@ -1516,7 +1509,7 @@
[(match_operand:AVXMODEF2P 1 "register_operand" "x")
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")]))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vcmp%D3p<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssecmp")
(set_attr "prefix" "vex")
(set_attr "length_immediate" "1")
@@ -1529,7 +1522,7 @@
(match_operand:SSEMODEF4 2 "nonimmediate_operand" "xm")]))]
"!TARGET_XOP
&& (SSE_FLOAT_MODE_P (<MODE>mode) || SSE_VEC_FLOAT_MODE_P (<MODE>mode))"
- "cmp%D3<ssemodesuffixf4>\t{%2, %0|%0, %2}"
+ "cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "ssecmp")
(set_attr "length_immediate" "1")
(set_attr "mode" "<MODE>")])
@@ -1543,7 +1536,7 @@
(match_dup 1)
(const_int 1)))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vcmp%D3s<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssecmp")
(set_attr "prefix" "vex")
(set_attr "mode" "<ssescalarmode>")])
@@ -1557,7 +1550,7 @@
(match_dup 1)
(const_int 1)))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "cmp%D3s<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "ssecmp")
(set_attr "length_immediate" "1")
(set_attr "mode" "<ssescalarmode>")])
@@ -1631,7 +1624,7 @@
(match_operand:AVXMODEF2P 1 "register_operand" "x"))
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vandnp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vandn<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sselog")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
@@ -1643,7 +1636,7 @@
(match_operand:SSEMODEF2P 1 "register_operand" "0"))
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "andnp<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
+ "andn<ssemodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "sselog")
(set_attr "mode" "<MODE>")])
@@ -1666,7 +1659,7 @@
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
return "v<logic>ps\t{%2, %1, %0|%0, %1, %2}";
else
- return "v<logic>p<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}";
+ return "v<logic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}";
}
[(set_attr "type" "sselog")
(set_attr "prefix" "vex")
@@ -1691,7 +1684,7 @@
if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
return "<logic>ps\t{%2, %0|%0, %2}";
else
- return "<logic>p<ssemodesuffixf2c>\t{%2, %0|%0, %2}";
+ return "<logic><ssemodesuffix>\t{%2, %0|%0, %2}";
}
[(set_attr "type" "sselog")
(set_attr "mode" "<MODE>")])
@@ -1818,7 +1811,7 @@
(match_operand:FMA4MODEF4 2 "nonimmediate_operand" "x,m"))
(match_operand:FMA4MODEF4 3 "nonimmediate_operand" "xm,x")))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfmadd<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1831,7 +1824,7 @@
(match_operand:FMA4MODEF4 2 "nonimmediate_operand" "x,m"))
(match_operand:FMA4MODEF4 3 "nonimmediate_operand" "xm,x")))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfmsub<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1845,7 +1838,7 @@
(match_operand:FMA4MODEF4 1 "nonimmediate_operand" "%x,x")
(match_operand:FMA4MODEF4 2 "nonimmediate_operand" "x,m"))))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfnmadd<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1859,7 +1852,7 @@
(match_operand:FMA4MODEF4 2 "nonimmediate_operand" "x,m"))
(match_operand:FMA4MODEF4 3 "nonimmediate_operand" "xm,x")))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfnmsub<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1871,7 +1864,7 @@
(match_operand:SSEMODEF4 2 "nonimmediate_operand" "x,m"))
(match_operand:SSEMODEF4 3 "nonimmediate_operand" "xm,x")))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfmadd<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1889,7 +1882,7 @@
(match_dup 0)
(const_int 1)))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfmadd<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1903,7 +1896,7 @@
(match_operand:SSEMODEF4 2 "nonimmediate_operand" "x,m"))
(match_operand:SSEMODEF4 3 "nonimmediate_operand" "xm,x")))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfmsub<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1921,7 +1914,7 @@
(match_dup 0)
(const_int 1)))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfmsub<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1935,7 +1928,7 @@
(match_operand:SSEMODEF4 1 "nonimmediate_operand" "%x,x")
(match_operand:SSEMODEF4 2 "nonimmediate_operand" "x,m"))))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfnmadd<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1953,7 +1946,7 @@
(match_dup 0)
(const_int 1)))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfnmadd<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1968,7 +1961,7 @@
(match_operand:SSEMODEF4 2 "nonimmediate_operand" "x,m"))
(match_operand:SSEMODEF4 3 "nonimmediate_operand" "xm,x")))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfnmsub<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -1987,7 +1980,7 @@
(match_dup 0)
(const_int 1)))]
"TARGET_FMA4 && TARGET_FUSED_MADD"
- "vfnmsub<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2001,7 +1994,7 @@
(match_operand:FMA4MODEF4 3 "nonimmediate_operand" "xm,x"))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfmadd<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2015,7 +2008,7 @@
(match_operand:FMA4MODEF4 3 "nonimmediate_operand" "xm,x"))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfmsub<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2029,7 +2022,7 @@
(match_operand:FMA4MODEF4 2 "nonimmediate_operand" "x,m")))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfnmadd<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2044,7 +2037,7 @@
(match_operand:FMA4MODEF4 3 "nonimmediate_operand" "xm,x"))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfnmsub<fma4modesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2058,7 +2051,7 @@
(match_operand:SSEMODEF2P 3 "nonimmediate_operand" "xm,x"))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfmadd<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2072,7 +2065,7 @@
(match_operand:SSEMODEF2P 3 "nonimmediate_operand" "xm,x"))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfmsub<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2086,7 +2079,7 @@
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "x,m")))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfnmadd<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2101,7 +2094,7 @@
(match_operand:SSEMODEF2P 3 "nonimmediate_operand" "xm,x"))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfnmsub<ssemodesuffixf4>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
@@ -2120,7 +2113,7 @@
(const_int 1))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfmadd<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<ssescalarmode>")])
@@ -2137,7 +2130,7 @@
(const_int 1))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfmsub<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<ssescalarmode>")])
@@ -2154,7 +2147,7 @@
(const_int 1))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfnmadd<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<ssescalarmode>")])
@@ -2172,7 +2165,7 @@
(const_int 1))]
UNSPEC_FMA4_INTRINSIC))]
"TARGET_FMA4"
- "vfnmsub<ssemodesuffixf2s>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<ssescalarmode>")])
@@ -4201,7 +4194,7 @@
"TARGET_AVX"
"@
vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
- vmov<ssescalarmodesuffix2s>\t{%2, %0|%0, %2}
+ vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
vmovd\t{%2, %0|%0, %2}
vmovss\t{%2, %1, %0|%0, %1, %2}
vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
@@ -4223,7 +4216,7 @@
"TARGET_SSE4_1"
"@
insertps\t{$0xe, %2, %0|%0, %2, 0xe}
- mov<ssescalarmodesuffix2s>\t{%2, %0|%0, %2}
+ mov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
movd\t{%2, %0|%0, %2}
movss\t{%2, %0|%0, %2}
pinsrd\t{$0, %2, %0|%0, %2, 0}
@@ -4243,7 +4236,7 @@
(const_int 1)))]
"TARGET_SSE2"
"@
- mov<ssescalarmodesuffix2s>\t{%2, %0|%0, %2}
+ mov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
movd\t{%2, %0|%0, %2}
movss\t{%2, %0|%0, %2}
#"
@@ -4395,19 +4388,24 @@
DONE;
})
-(define_insn "vec_extract_lo_<mode>"
+(define_insn_and_split "vec_extract_lo_<mode>"
[(set (match_operand:<avxhalfvecmode> 0 "nonimmediate_operand" "=x,m")
(vec_select:<avxhalfvecmode>
- (match_operand:AVX256MODE4P 1 "register_operand" "x,x")
+ (match_operand:AVX256MODE4P 1 "nonimmediate_operand" "xm,x")
(parallel [(const_int 0) (const_int 1)])))]
"TARGET_AVX"
- "vextractf128\t{$0x0, %1, %0|%0, %1, 0x0}"
- [(set_attr "type" "sselog")
- (set_attr "prefix_extra" "1")
- (set_attr "length_immediate" "1")
- (set_attr "memory" "none,store")
- (set_attr "prefix" "vex")
- (set_attr "mode" "V8SF")])
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rtx op1 = operands[1];
+ if (REG_P (op1))
+ op1 = gen_rtx_REG (<avxhalfvecmode>mode, REGNO (op1));
+ else
+ op1 = gen_lowpart (<avxhalfvecmode>mode, op1);
+ emit_move_insn (operands[0], op1);
+ DONE;
+})
(define_insn "vec_extract_hi_<mode>"
[(set (match_operand:<avxhalfvecmode> 0 "nonimmediate_operand" "=x,m")
@@ -4423,20 +4421,25 @@
(set_attr "prefix" "vex")
(set_attr "mode" "V8SF")])
-(define_insn "vec_extract_lo_<mode>"
+(define_insn_and_split "vec_extract_lo_<mode>"
[(set (match_operand:<avxhalfvecmode> 0 "nonimmediate_operand" "=x,m")
(vec_select:<avxhalfvecmode>
- (match_operand:AVX256MODE8P 1 "register_operand" "x,x")
+ (match_operand:AVX256MODE8P 1 "nonimmediate_operand" "xm,x")
(parallel [(const_int 0) (const_int 1)
(const_int 2) (const_int 3)])))]
"TARGET_AVX"
- "vextractf128\t{$0x1, %1, %0|%0, %1, 0x1}"
- [(set_attr "type" "sselog")
- (set_attr "prefix_extra" "1")
- (set_attr "length_immediate" "1")
- (set_attr "memory" "none,store")
- (set_attr "prefix" "vex")
- (set_attr "mode" "V8SF")])
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rtx op1 = operands[1];
+ if (REG_P (op1))
+ op1 = gen_rtx_REG (<avxhalfvecmode>mode, REGNO (op1));
+ else
+ op1 = gen_lowpart (<avxhalfvecmode>mode, op1);
+ emit_move_insn (operands[0], op1);
+ DONE;
+})
(define_insn "vec_extract_hi_<mode>"
[(set (match_operand:<avxhalfvecmode> 0 "nonimmediate_operand" "=x,m")
@@ -4453,22 +4456,27 @@
(set_attr "prefix" "vex")
(set_attr "mode" "V8SF")])
-(define_insn "vec_extract_lo_v16hi"
+(define_insn_and_split "vec_extract_lo_v16hi"
[(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
(vec_select:V8HI
- (match_operand:V16HI 1 "register_operand" "x,x")
+ (match_operand:V16HI 1 "nonimmediate_operand" "xm,x")
(parallel [(const_int 0) (const_int 1)
(const_int 2) (const_int 3)
(const_int 4) (const_int 5)
(const_int 6) (const_int 7)])))]
"TARGET_AVX"
- "vextractf128\t{$0x1, %1, %0|%0, %1, 0x1}"
- [(set_attr "type" "sselog")
- (set_attr "prefix_extra" "1")
- (set_attr "length_immediate" "1")
- (set_attr "memory" "none,store")
- (set_attr "prefix" "vex")
- (set_attr "mode" "V8SF")])
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rtx op1 = operands[1];
+ if (REG_P (op1))
+ op1 = gen_rtx_REG (V8HImode, REGNO (op1));
+ else
+ op1 = gen_lowpart (V8HImode, op1);
+ emit_move_insn (operands[0], op1);
+ DONE;
+})
(define_insn "vec_extract_hi_v16hi"
[(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
@@ -4487,10 +4495,10 @@
(set_attr "prefix" "vex")
(set_attr "mode" "V8SF")])
-(define_insn "vec_extract_lo_v32qi"
+(define_insn_and_split "vec_extract_lo_v32qi"
[(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
(vec_select:V16QI
- (match_operand:V32QI 1 "register_operand" "x,x")
+ (match_operand:V32QI 1 "nonimmediate_operand" "xm,x")
(parallel [(const_int 0) (const_int 1)
(const_int 2) (const_int 3)
(const_int 4) (const_int 5)
@@ -4500,13 +4508,18 @@
(const_int 12) (const_int 13)
(const_int 14) (const_int 15)])))]
"TARGET_AVX"
- "vextractf128\t{$0x1, %1, %0|%0, %1, 0x1}"
- [(set_attr "type" "sselog")
- (set_attr "prefix_extra" "1")
- (set_attr "length_immediate" "1")
- (set_attr "memory" "none,store")
- (set_attr "prefix" "vex")
- (set_attr "mode" "V8SF")])
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rtx op1 = operands[1];
+ if (REG_P (op1))
+ op1 = gen_rtx_REG (V16QImode, REGNO (op1));
+ else
+ op1 = gen_lowpart (V16QImode, op1);
+ emit_move_insn (operands[0], op1);
+ DONE;
+})
(define_insn "vec_extract_hi_v32qi"
[(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
@@ -6261,6 +6274,7 @@
[(set_attr "type" "sseishft")
(set_attr "prefix_data16" "1")
(set_attr "length_immediate" "1")
+ (set_attr "atom_unit" "sishuf")
(set_attr "mode" "TI")])
(define_insn "lshr<mode>3"
@@ -7691,7 +7705,7 @@
vpsrldq\t{$8, %1, %0|%0, %1, 8}
vmovq\t{%H1, %0|%0, %H1}
vmov{q}\t{%H1, %0|%0, %H1}"
- [(set_attr "type" "ssemov,sseishft,ssemov,imov")
+ [(set_attr "type" "ssemov,sseishft1,ssemov,imov")
(set_attr "length_immediate" "*,1,*,*")
(set_attr "memory" "*,none,*,*")
(set_attr "prefix" "vex")
@@ -7708,9 +7722,8 @@
psrldq\t{$8, %0|%0, 8}
movq\t{%H1, %0|%0, %H1}
mov{q}\t{%H1, %0|%0, %H1}"
- [(set_attr "type" "ssemov,sseishft,ssemov,imov")
+ [(set_attr "type" "ssemov,sseishft1,ssemov,imov")
(set_attr "length_immediate" "*,1,*,*")
- (set_attr "atom_unit" "*,sishuf,*,*")
(set_attr "memory" "*,none,*,*")
(set_attr "mode" "V2SF,TI,TI,DI")])
@@ -7726,7 +7739,7 @@
vmovhps\t{%1, %0|%0, %1}
vpsrldq\t{$8, %1, %0|%0, %1, 8}
vmovq\t{%H1, %0|%0, %H1}"
- [(set_attr "type" "ssemov,sseishft,ssemov")
+ [(set_attr "type" "ssemov,sseishft1,ssemov")
(set_attr "length_immediate" "*,1,*")
(set_attr "memory" "*,none,*")
(set_attr "prefix" "vex")
@@ -7743,9 +7756,8 @@
movhps\t{%1, %0|%0, %1}
psrldq\t{$8, %0|%0, 8}
movq\t{%H1, %0|%0, %H1}"
- [(set_attr "type" "ssemov,sseishft,ssemov")
+ [(set_attr "type" "ssemov,sseishft1,ssemov")
(set_attr "length_immediate" "*,1,*")
- (set_attr "atom_unit" "*,sishuf,*")
(set_attr "memory" "*,none,*")
(set_attr "mode" "V2SF,TI,TI")])
@@ -8318,24 +8330,24 @@
(set_attr "prefix_data16" "1")
(set_attr "mode" "TI")])
-(define_insn "avx_movmskp<avxmodesuffixf2c>256"
+(define_insn "avx_movmsk<ssemodesuffix>256"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI
[(match_operand:AVX256MODEF2P 1 "register_operand" "x")]
UNSPEC_MOVMSK))]
"AVX256_VEC_FLOAT_MODE_P (<MODE>mode)"
- "vmovmskp<avxmodesuffixf2c>\t{%1, %0|%0, %1}"
+ "vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssecvt")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
-(define_insn "<sse>_movmskp<ssemodesuffixf2c>"
+(define_insn "<sse>_movmsk<ssemodesuffix>"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI
[(match_operand:SSEMODEF2P 1 "register_operand" "x")]
UNSPEC_MOVMSK))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
- "%vmovmskp<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
+ "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
(set_attr "prefix" "maybe_vex")
(set_attr "mode" "<MODE>")])
@@ -9575,7 +9587,7 @@
(parallel [(const_int 0)]))]
UNSPEC_MOVNT))]
"TARGET_SSE4A"
- "movnts<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
+ "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
(set_attr "mode" "<ssescalarmode>")])
@@ -9636,21 +9648,21 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(define_insn "avx_blendp<avxmodesuffixf2c><avxmodesuffix>"
+(define_insn "avx_blend<ssemodesuffix><avxmodesuffix>"
[(set (match_operand:AVXMODEF2P 0 "register_operand" "=x")
(vec_merge:AVXMODEF2P
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")
(match_operand:AVXMODEF2P 1 "register_operand" "x")
(match_operand:SI 3 "const_0_to_<blendbits>_operand" "n")))]
"TARGET_AVX"
- "vblendp<avxmodesuffixf2c>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemov")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
-(define_insn "avx_blendvp<avxmodesuffixf2c><avxmodesuffix>"
+(define_insn "avx_blendv<ssemodesuffix><avxmodesuffix>"
[(set (match_operand:AVXMODEF2P 0 "register_operand" "=x")
(unspec:AVXMODEF2P
[(match_operand:AVXMODEF2P 1 "register_operand" "x")
@@ -9658,28 +9670,28 @@
(match_operand:AVXMODEF2P 3 "register_operand" "x")]
UNSPEC_BLENDV))]
"TARGET_AVX"
- "vblendvp<avxmodesuffixf2c>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemov")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<avxvecmode>")])
-(define_insn "sse4_1_blendp<ssemodesuffixf2c>"
+(define_insn "sse4_1_blend<ssemodesuffix>"
[(set (match_operand:SSEMODEF2P 0 "register_operand" "=x")
(vec_merge:SSEMODEF2P
(match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm")
(match_operand:SSEMODEF2P 1 "register_operand" "0")
(match_operand:SI 3 "const_0_to_<blendbits>_operand" "n")))]
"TARGET_SSE4_1"
- "blendp<ssemodesuffixf2c>\t{%3, %2, %0|%0, %2, %3}"
+ "blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
[(set_attr "type" "ssemov")
(set_attr "prefix_data16" "1")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "mode" "<MODE>")])
-(define_insn "sse4_1_blendvp<ssemodesuffixf2c>"
+(define_insn "sse4_1_blendv<ssemodesuffix>"
[(set (match_operand:SSEMODEF2P 0 "reg_not_xmm0_operand" "=x")
(unspec:SSEMODEF2P
[(match_operand:SSEMODEF2P 1 "reg_not_xmm0_operand" "0")
@@ -9687,13 +9699,13 @@
(match_operand:SSEMODEF2P 3 "register_operand" "Yz")]
UNSPEC_BLENDV))]
"TARGET_SSE4_1"
- "blendvp<ssemodesuffixf2c>\t{%3, %2, %0|%0, %2, %3}"
+ "blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
[(set_attr "type" "ssemov")
(set_attr "prefix_data16" "1")
(set_attr "prefix_extra" "1")
(set_attr "mode" "<MODE>")])
-(define_insn "avx_dpp<avxmodesuffixf2c><avxmodesuffix>"
+(define_insn "avx_dp<ssemodesuffix><avxmodesuffix>"
[(set (match_operand:AVXMODEF2P 0 "register_operand" "=x")
(unspec:AVXMODEF2P
[(match_operand:AVXMODEF2P 1 "nonimmediate_operand" "%x")
@@ -9701,14 +9713,14 @@
(match_operand:SI 3 "const_0_to_255_operand" "n")]
UNSPEC_DP))]
"TARGET_AVX"
- "vdpp<avxmodesuffixf2c>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssemul")
(set_attr "prefix" "vex")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "mode" "<avxvecmode>")])
-(define_insn "sse4_1_dpp<ssemodesuffixf2c>"
+(define_insn "sse4_1_dp<ssemodesuffix>"
[(set (match_operand:SSEMODEF2P 0 "register_operand" "=x")
(unspec:SSEMODEF2P
[(match_operand:SSEMODEF2P 1 "nonimmediate_operand" "%0")
@@ -9716,7 +9728,7 @@
(match_operand:SI 3 "const_0_to_255_operand" "n")]
UNSPEC_DP))]
"TARGET_SSE4_1"
- "dpp<ssemodesuffixf2c>\t{%3, %2, %0|%0, %2, %3}"
+ "dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
[(set_attr "type" "ssemul")
(set_attr "prefix_data16" "1")
(set_attr "prefix_extra" "1")
@@ -10242,13 +10254,13 @@
;; ptestps/ptestpd are very similar to comiss and ucomiss when
;; setting FLAGS_REG. But it is not a really compare instruction.
-(define_insn "avx_vtestp<avxmodesuffixf2c><avxmodesuffix>"
+(define_insn "avx_vtest<ssemodesuffix><avxmodesuffix>"
[(set (reg:CC FLAGS_REG)
(unspec:CC [(match_operand:AVXMODEF2P 0 "register_operand" "x")
(match_operand:AVXMODEF2P 1 "nonimmediate_operand" "xm")]
UNSPEC_VTESTP))]
"TARGET_AVX"
- "vtestp<avxmodesuffixf2c>\t{%1, %0|%0, %1}"
+ "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssecomi")
(set_attr "prefix_extra" "1")
(set_attr "prefix" "vex")
@@ -10280,28 +10292,28 @@
(set_attr "prefix" "maybe_vex")
(set_attr "mode" "TI")])
-(define_insn "avx_roundp<avxmodesuffixf2c>256"
+(define_insn "avx_round<ssemodesuffix>256"
[(set (match_operand:AVX256MODEF2P 0 "register_operand" "=x")
(unspec:AVX256MODEF2P
[(match_operand:AVX256MODEF2P 1 "nonimmediate_operand" "xm")
(match_operand:SI 2 "const_0_to_15_operand" "n")]
UNSPEC_ROUND))]
"TARGET_AVX"
- "vroundp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssecvt")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
-(define_insn "sse4_1_roundp<ssemodesuffixf2c>"
+(define_insn "sse4_1_round<ssemodesuffix>"
[(set (match_operand:SSEMODEF2P 0 "register_operand" "=x")
(unspec:SSEMODEF2P
[(match_operand:SSEMODEF2P 1 "nonimmediate_operand" "xm")
(match_operand:SI 2 "const_0_to_15_operand" "n")]
UNSPEC_ROUND))]
"TARGET_ROUND"
- "%vroundp<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssecvt")
(set_attr "prefix_data16" "1")
(set_attr "prefix_extra" "1")
@@ -10309,7 +10321,7 @@
(set_attr "prefix" "maybe_vex")
(set_attr "mode" "<MODE>")])
-(define_insn "*avx_rounds<ssemodesuffixf2c>"
+(define_insn "*avx_round<ssescalarmodesuffix>"
[(set (match_operand:SSEMODEF2P 0 "register_operand" "=x")
(vec_merge:SSEMODEF2P
(unspec:SSEMODEF2P
@@ -10319,14 +10331,14 @@
(match_operand:SSEMODEF2P 1 "register_operand" "x")
(const_int 1)))]
"TARGET_AVX"
- "vrounds<ssemodesuffixf2c>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
+ "vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
[(set_attr "type" "ssecvt")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
-(define_insn "sse4_1_rounds<ssemodesuffixf2c>"
+(define_insn "sse4_1_round<ssescalarmodesuffix>"
[(set (match_operand:SSEMODEF2P 0 "register_operand" "=x")
(vec_merge:SSEMODEF2P
(unspec:SSEMODEF2P
@@ -10336,7 +10348,7 @@
(match_operand:SSEMODEF2P 1 "register_operand" "0")
(const_int 1)))]
"TARGET_ROUND"
- "rounds<ssemodesuffixf2c>\t{%3, %2, %0|%0, %2, %3}"
+ "round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}"
[(set_attr "type" "ssecvt")
(set_attr "prefix_data16" "1")
(set_attr "prefix_extra" "1")
@@ -11778,7 +11790,7 @@
[(match_operand:SSEMODEF2P 1 "nonimmediate_operand" "xm")]
UNSPEC_FRCZ))]
"TARGET_XOP"
- "vfrcz<ssemodesuffixf4>\t{%1, %0|%0, %1}"
+ "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssecvt1")
(set_attr "mode" "<MODE>")])
@@ -11792,7 +11804,7 @@
(match_operand:SSEMODEF2P 1 "register_operand" "0")
(const_int 1)))]
"TARGET_XOP"
- "vfrcz<ssemodesuffixf2s>\t{%2, %0|%0, %2}"
+ "vfrcz<ssescalarmodesuffix>\t{%2, %0|%0, %2}"
[(set_attr "type" "ssecvt1")
(set_attr "mode" "<MODE>")])
@@ -11802,7 +11814,7 @@
[(match_operand:FMA4MODEF4 1 "nonimmediate_operand" "xm")]
UNSPEC_FRCZ))]
"TARGET_XOP"
- "vfrcz<fma4modesuffixf4>\t{%1, %0|%0, %1}"
+ "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssecvt1")
(set_attr "mode" "<MODE>")])
@@ -11882,7 +11894,7 @@
(match_operand:SI 4 "const_0_to_3_operand" "n")]
UNSPEC_VPERMIL2))]
"TARGET_XOP"
- "vpermil2p<avxmodesuffixf2c>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
+ "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
[(set_attr "type" "sse4arg")
(set_attr "length_immediate" "1")
(set_attr "mode" "<MODE>")])
@@ -12099,7 +12111,7 @@
(match_operand:<avxscalarmode> 1 "nonimmediate_operand" "m,?x")))]
"TARGET_AVX"
"@
- vbroadcasts<avxmodesuffixf2c>\t{%1, %0|%0, %1}
+ vbroadcast<ssescalarmodesuffix>\t{%1, %0|%0, %1}
#"
"&& reload_completed && REG_P (operands[1])"
[(set (match_dup 2) (vec_duplicate:<avxhalfvecmode> (match_dup 1)))
@@ -12253,7 +12265,7 @@
{
int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
operands[2] = GEN_INT (mask);
- return "vpermilp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}";
+ return "vpermil<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}";
}
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
@@ -12268,7 +12280,7 @@
(match_operand:<avxpermvecmode> 2 "nonimmediate_operand" "xm")]
UNSPEC_VPERMIL))]
"TARGET_AVX"
- "vpermilp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vpermil<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
(set_attr "prefix" "vex")
@@ -12511,7 +12523,7 @@
(set_attr "prefix" "vex")
(set_attr "mode" "V8SF")])
-(define_insn "avx_maskloadp<avxmodesuffixf2c><avxmodesuffix>"
+(define_insn "avx_maskload<ssemodesuffix><avxmodesuffix>"
[(set (match_operand:AVXMODEF2P 0 "register_operand" "=x")
(unspec:AVXMODEF2P
[(match_operand:AVXMODEF2P 1 "memory_operand" "m")
@@ -12519,13 +12531,13 @@
(match_dup 0)]
UNSPEC_MASKLOAD))]
"TARGET_AVX"
- "vmaskmovp<avxmodesuffixf2c>\t{%1, %2, %0|%0, %2, %1}"
+ "vmaskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
[(set_attr "type" "sselog1")
(set_attr "prefix_extra" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
-(define_insn "avx_maskstorep<avxmodesuffixf2c><avxmodesuffix>"
+(define_insn "avx_maskstore<ssemodesuffix><avxmodesuffix>"
[(set (match_operand:AVXMODEF2P 0 "memory_operand" "=m")
(unspec:AVXMODEF2P
[(match_operand:AVXMODEF2P 1 "register_operand" "x")
@@ -12533,83 +12545,30 @@
(match_dup 0)]
UNSPEC_MASKSTORE))]
"TARGET_AVX"
- "vmaskmovp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "vmaskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sselog1")
(set_attr "prefix_extra" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
-(define_insn "avx_<avxmodesuffixp><avxmodesuffix>_<avxmodesuffixp>"
- [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x,x")
+(define_insn_and_split "avx_<avxmodesuffixp><avxmodesuffix>_<avxmodesuffixp>"
+ [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
(unspec:AVX256MODE2P
- [(match_operand:<avxhalfvecmode> 1 "nonimmediate_operand" "0,xm")]
- UNSPEC_CAST))]
- "TARGET_AVX"
-{
- switch (which_alternative)
- {
- case 0:
- return "";
- case 1:
- switch (get_attr_mode (insn))
- {
- case MODE_V8SF:
- return "vmovaps\t{%1, %x0|%x0, %1}";
- case MODE_V4DF:
- return "vmovapd\t{%1, %x0|%x0, %1}";
- case MODE_OI:
- return "vmovdqa\t{%1, %x0|%x0, %1}";
- default:
- break;
- }
- default:
- break;
- }
- gcc_unreachable ();
-}
- [(set_attr "type" "ssemov")
- (set_attr "prefix" "vex")
- (set_attr "mode" "<avxvecmode>")
- (set (attr "length")
- (if_then_else (eq_attr "alternative" "0")
- (const_string "0")
- (const_string "*")))])
-
-(define_insn "avx_<avxmodesuffixp>_<avxmodesuffixp><avxmodesuffix>"
- [(set (match_operand:<avxhalfvecmode> 0 "register_operand" "=x,x")
- (unspec:<avxhalfvecmode>
- [(match_operand:AVX256MODE2P 1 "nonimmediate_operand" "0,xm")]
+ [(match_operand:<avxhalfvecmode> 1 "nonimmediate_operand" "xm,x")]
UNSPEC_CAST))]
"TARGET_AVX"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
{
- switch (which_alternative)
- {
- case 0:
- return "";
- case 1:
- switch (get_attr_mode (insn))
- {
- case MODE_V8SF:
- return "vmovaps\t{%x1, %0|%0, %x1}";
- case MODE_V4DF:
- return "vmovapd\t{%x1, %0|%0, %x1}";
- case MODE_OI:
- return "vmovdqa\t{%x1, %0|%0, %x1}";
- default:
- break;
- }
- default:
- break;
- }
- gcc_unreachable ();
-}
- [(set_attr "type" "ssemov")
- (set_attr "prefix" "vex")
- (set_attr "mode" "<avxvecmode>")
- (set (attr "length")
- (if_then_else (eq_attr "alternative" "0")
- (const_string "0")
- (const_string "*")))])
+ rtx op1 = operands[1];
+ if (REG_P (op1))
+ op1 = gen_rtx_REG (<MODE>mode, REGNO (op1));
+ else
+ op1 = gen_lowpart (<MODE>mode, op1);
+ emit_move_insn (operands[0], op1);
+ DONE;
+})
(define_expand "vec_init<mode>"
[(match_operand:AVX256MODE 0 "register_operand" "")
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 3750e0c4b08..c20a2ae89fc 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -576,7 +576,7 @@ i386_pe_record_external_function (tree decl, const char *name)
{
struct extern_list *p;
- p = (struct extern_list *) ggc_alloc (sizeof *p);
+ p = ggc_alloc_extern_list ();
p->next = extern_head;
p->decl = decl;
p->name = name;
@@ -617,7 +617,7 @@ i386_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
gcc_assert (TREE_PUBLIC (decl));
- p = (struct export_list *) ggc_alloc (sizeof *p);
+ p = ggc_alloc_export_list ();
p->next = export_head;
p->name = name;
p->is_data = is_data;
diff --git a/gcc/config/ia64/ia64-c.c b/gcc/config/ia64/ia64-c.c
index c89a83cd99b..7a0bdd7a3cd 100644
--- a/gcc/config/ia64/ia64-c.c
+++ b/gcc/config/ia64/ia64-c.c
@@ -24,8 +24,8 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "cpplib.h"
-#include "c-common.h"
-#include "c-pragma.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
#include "toplev.h"
#include "tm_p.h"
diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h
index 3c6a153498e..a5914b1a5ac 100644
--- a/gcc/config/ia64/ia64-protos.h
+++ b/gcc/config/ia64/ia64-protos.h
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler for IA-64.
- Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2007
+ Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2007, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -69,7 +69,6 @@ extern rtx ia64_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
tree, int, int);
extern rtx ia64_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
extern rtx ia64_va_arg (tree, tree);
-extern rtx ia64_function_value (const_tree, const_tree);
#endif /* RTX_CODE */
extern void ia64_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
@@ -80,10 +79,9 @@ extern void ia64_vms_output_aligned_decl_common (FILE *, tree, const char *,
unsigned HOST_WIDE_INT,
unsigned int);
extern void ia64_vms_elf_asm_named_section (const char *, unsigned int, tree);
+extern void ia64_start_function (FILE *, const char *, tree);
#endif /* TREE_CODE */
-extern int ia64_register_move_cost (enum machine_mode, enum reg_class,
- enum reg_class);
extern int ia64_epilogue_uses (int);
extern int ia64_eh_uses (int);
extern void emit_safe_across_calls (void);
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index e1e3dff8b59..7df747bf986 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -207,6 +207,11 @@ static int ia64_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static bool ia64_function_ok_for_sibcall (tree, tree);
static bool ia64_return_in_memory (const_tree, const_tree);
+static rtx ia64_function_value (const_tree, const_tree, bool);
+static rtx ia64_libcall_value (enum machine_mode, const_rtx);
+static bool ia64_function_value_regno_p (const unsigned int);
+static int ia64_register_move_cost (enum machine_mode, reg_class_t,
+ reg_class_t);
static bool ia64_rtx_costs (rtx, int, int, int *, bool);
static int ia64_unspec_may_trap_p (const_rtx, unsigned);
static void fix_range (const char *);
@@ -451,6 +456,8 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_ASM_GLOBALIZE_DECL_NAME
#define TARGET_ASM_GLOBALIZE_DECL_NAME ia64_globalize_decl_name
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST ia64_register_move_cost
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS ia64_rtx_costs
#undef TARGET_ADDRESS_COST
@@ -482,6 +489,13 @@ static const struct attribute_spec ia64_attribute_table[] =
#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
#endif
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE ia64_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE ia64_libcall_value
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P ia64_function_value_regno_p
+
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX ia64_struct_value_rtx
#undef TARGET_RETURN_IN_MEMORY
@@ -496,8 +510,8 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR ia64_gimplify_va_arg
-#undef TARGET_UNWIND_EMIT
-#define TARGET_UNWIND_EMIT process_for_unwind_directive
+#undef TARGET_ASM_UNWIND_EMIT
+#define TARGET_ASM_UNWIND_EMIT process_for_unwind_directive
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P ia64_scalar_mode_supported_p
@@ -3413,6 +3427,29 @@ ia64_expand_prologue (void)
finish_spill_pointers ();
}
+/* Output the textual info surrounding the prologue. */
+
+void
+ia64_start_function (FILE *file, const char *fnname,
+ tree decl ATTRIBUTE_UNUSED)
+{
+#if VMS_DEBUGGING_INFO
+ if (vms_debug_main
+ && strncmp (vms_debug_main, fnname, strlen (vms_debug_main)) == 0)
+ {
+ targetm.asm_out.globalize_label (asm_out_file, VMS_DEBUG_MAIN_POINTER);
+ ASM_OUTPUT_DEF (asm_out_file, VMS_DEBUG_MAIN_POINTER, fnname);
+ dwarf2out_vms_debug_main_pointer ();
+ vms_debug_main = 0;
+ }
+#endif
+
+ fputs ("\t.proc ", file);
+ assemble_name (file, fnname);
+ fputc ('\n', file);
+ ASM_OUTPUT_LABEL (file, fnname);
+}
+
/* Called after register allocation to add any instructions needed for the
epilogue. Using an epilogue insn is favored compared to putting all of the
instructions in output_function_prologue(), since it allows the scheduler
@@ -4637,13 +4674,20 @@ ia64_return_in_memory (const_tree valtype, const_tree fntype ATTRIBUTE_UNUSED)
/* Return rtx for register that holds the function return value. */
-rtx
-ia64_function_value (const_tree valtype, const_tree func)
+static rtx
+ia64_function_value (const_tree valtype,
+ const_tree fn_decl_or_type,
+ bool outgoing ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
enum machine_mode hfa_mode;
int unsignedp;
+ const_tree func = fn_decl_or_type;
+ if (fn_decl_or_type
+ && !DECL_P (fn_decl_or_type))
+ func = NULL;
+
mode = TYPE_MODE (valtype);
hfa_mode = hfa_element_mode (valtype, 0);
@@ -4721,6 +4765,28 @@ ia64_function_value (const_tree valtype, const_tree func)
}
}
+/* Worker function for TARGET_LIBCALL_VALUE. */
+
+static rtx
+ia64_libcall_value (enum machine_mode mode,
+ const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode,
+ (((GET_MODE_CLASS (mode) == MODE_FLOAT
+ || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
+ && (mode) != TFmode)
+ ? FR_RET_FIRST : GR_RET_FIRST));
+}
+
+/* Worker function for FUNCTION_VALUE_REGNO_P. */
+
+static bool
+ia64_function_value_regno_p (const unsigned int regno)
+{
+ return ((regno >= GR_RET_FIRST && regno <= GR_RET_LAST)
+ || (regno >= FR_RET_FIRST && regno <= FR_RET_LAST));
+}
+
/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
We need to emit DTP-relative relocations. */
@@ -5140,10 +5206,13 @@ ia64_rtx_costs (rtx x, int code, int outer_code, int *total,
/* Calculate the cost of moving data from a register in class FROM to
one in class TO, using MODE. */
-int
-ia64_register_move_cost (enum machine_mode mode, enum reg_class from,
- enum reg_class to)
+static int
+ia64_register_move_cost (enum machine_mode mode, reg_class_t from_i,
+ reg_class_t to_i)
{
+ enum reg_class from = (enum reg_class) from_i;
+ enum reg_class to = (enum reg_class) to_i;
+
/* ADDL_REGS is the same as GR_REGS for movement purposes. */
if (to == ADDL_REGS)
to = GR_REGS;
@@ -5540,7 +5609,7 @@ void ia64_init_expanders (void)
static struct machine_function *
ia64_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
static enum attr_itanium_class ia64_safe_itanium_class (rtx);
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index c019aa48184..d3821f6c6f4 100644
--- a/gcc/config/ia64/ia64.h
+++ b/gcc/config/ia64/ia64.h
@@ -1042,12 +1042,6 @@ enum reg_class
#define ACCUMULATE_OUTGOING_ARGS 1
-/* A C expression that should indicate the number of bytes of its own arguments
- that a function pops on returning, or 0 if the function pops no arguments
- and the caller must therefore pop them all after the function returns. */
-
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
/* Function Arguments in Registers */
@@ -1146,31 +1140,6 @@ do { \
#define FUNCTION_ARG_REGNO_P(REGNO) \
(((REGNO) >= AR_ARG_FIRST && (REGNO) < (AR_ARG_FIRST + MAX_ARGUMENT_SLOTS)) \
|| ((REGNO) >= FR_ARG_FIRST && (REGNO) < (FR_ARG_FIRST + MAX_ARGUMENT_SLOTS)))
-
-/* How Scalar Function Values are Returned */
-
-/* A C expression to create an RTX representing the place where a function
- returns a value of data type VALTYPE. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- ia64_function_value (VALTYPE, FUNC)
-
-/* A C expression to create an RTX representing the place where a library
- function returns a value of mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx_REG (MODE, \
- (((GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) && \
- (MODE) != TFmode) \
- ? FR_RET_FIRST : GR_RET_FIRST))
-
-/* A C expression that is nonzero if REGNO is the number of a hard register in
- which the values of called function may come back. */
-
-#define FUNCTION_VALUE_REGNO_P(REGNO) \
- (((REGNO) >= GR_RET_FIRST && (REGNO) <= GR_RET_LAST) \
- || ((REGNO) >= FR_RET_FIRST && (REGNO) <= FR_RET_LAST))
/* How Large Values are Returned */
@@ -1335,11 +1304,6 @@ do { \
/* Describing Relative Costs of Operations */
-/* A C expression for the cost of moving data from a register in class FROM to
- one in class TO, using MODE. */
-
-#define REGISTER_MOVE_COST ia64_register_move_cost
-
/* A C expression for the cost of moving data of mode M between a
register and memory. */
#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
diff --git a/gcc/config/ia64/sysv4.h b/gcc/config/ia64/sysv4.h
index 678a81ec628..0d760731b46 100644
--- a/gcc/config/ia64/sysv4.h
+++ b/gcc/config/ia64/sysv4.h
@@ -1,7 +1,7 @@
/* Override definitions in elfos.h/svr4.h to be correct for IA64.
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005,
-2007 Free Software Foundation, Inc.
+2007, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -127,12 +127,7 @@ do { \
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
-do { \
- fputs ("\t.proc ", FILE); \
- assemble_name (FILE, NAME); \
- fputc ('\n', FILE); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
-} while (0)
+ ia64_start_function(FILE,NAME,DECL)
/* We redefine this to use the ia64 .endp pseudo-op. */
diff --git a/gcc/config/ia64/t-ia64 b/gcc/config/ia64/t-ia64
index db7a8298d17..212bef7cfab 100644
--- a/gcc/config/ia64/t-ia64
+++ b/gcc/config/ia64/t-ia64
@@ -46,7 +46,7 @@ LIB2ADDEH = $(srcdir)/config/ia64/unwind-ia64.c $(srcdir)/unwind-sjlj.c \
$(srcdir)/unwind-c.c
ia64-c.o: $(srcdir)/config/ia64/ia64-c.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) $(CPPLIB_H) $(C_COMMON_H) c-pragma.h toplev.h
+ coretypes.h $(TM_H) $(TREE_H) $(CPPLIB_H) $(C_COMMON_H) $(C_PRAGMA_H) toplev.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/ia64/ia64-c.c
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
index 279586c0398..3d678ce5f85 100644
--- a/gcc/config/ia64/vms.h
+++ b/gcc/config/ia64/vms.h
@@ -1,5 +1,5 @@
/* Definitions of target machine GNU compiler. IA64-VMS version.
- Copyright (C) 2003-2009 Free Software Foundation, Inc.
+ Copyright (C) 2003-2010 Free Software Foundation, Inc.
Contributed by Douglas B Rupp (rupp@gnat.com).
This file is part of GCC.
@@ -72,13 +72,13 @@ along with GCC; see the file COPYING3. If not see
/* Turn on VMS specific Dwarf2 features. */
#define VMS_DEBUGGING_INFO 1
-#define ASM_OUTPUT_DWARF_DELTA_UNITS(FILE,SIZE,LABEL1,LABEL2,UNITS) \
-do { \
- fprintf (FILE, "\tdata4.ua\t ("); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, ")/16*3"); \
+#define ASM_OUTPUT_DWARF_VMS_DELTA(FILE,SIZE,LABEL1,LABEL2) \
+do { \
+ fprintf (FILE, "\tdata4.ua\t@slotcount("); \
+ assemble_name (FILE, LABEL1); \
+ fprintf (FILE, "-"); \
+ assemble_name (FILE, LABEL2); \
+ fprintf (FILE, ")"); \
} while (0)
#undef STARTFILE_SPEC
diff --git a/gcc/config/iq2000/iq2000-protos.h b/gcc/config/iq2000/iq2000-protos.h
index c01b6eee3b9..56fd39e7bc6 100644
--- a/gcc/config/iq2000/iq2000-protos.h
+++ b/gcc/config/iq2000/iq2000-protos.h
@@ -35,8 +35,6 @@ extern void iq2000_expand_eh_return (rtx);
extern int iq2000_can_use_return_insn (void);
extern int iq2000_adjust_insn_length (rtx, int);
extern char * iq2000_output_conditional_branch (rtx, rtx *, int, int, int, int);
-extern void print_operand_address (FILE *, rtx);
-extern void print_operand (FILE *, rtx, int);
#ifdef RTX_CODE
extern rtx gen_int_relational (enum rtx_code, rtx, rtx, rtx, int *);
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index 0e51eca7965..559d88433fa 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -108,8 +108,8 @@ struct GTY(()) machine_function
/* Global variables for machine-dependent things. */
-/* List of all IQ2000 punctuation characters used by print_operand. */
-char iq2000_print_operand_punct[256];
+/* List of all IQ2000 punctuation characters used by iq2000_print_operand. */
+static char iq2000_print_operand_punct[256];
/* The target cpu for optimization and scheduling. */
enum processor_type iq2000_tune;
@@ -169,6 +169,9 @@ static void iq2000_asm_trampoline_template (FILE *);
static void iq2000_trampoline_init (rtx, tree, rtx);
static rtx iq2000_function_value (const_tree, const_tree, bool);
static rtx iq2000_libcall_value (enum machine_mode, const_rtx);
+static void iq2000_print_operand (FILE *, rtx, int);
+static void iq2000_print_operand_address (FILE *, rtx);
+static bool iq2000_print_operand_punct_valid_p (unsigned char code);
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS iq2000_init_builtins
@@ -193,6 +196,13 @@ static rtx iq2000_libcall_value (enum machine_mode, const_rtx);
#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS false
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND iq2000_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS iq2000_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P iq2000_print_operand_punct_valid_p
+
#undef TARGET_PROMOTE_FUNCTION_MODE
#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
@@ -1385,11 +1395,7 @@ iq2000_va_start (tree valist, rtx nextarg)
static struct machine_function *
iq2000_init_machine_status (void)
{
- struct machine_function *f;
-
- f = GGC_CNEW (struct machine_function);
-
- return f;
+ return ggc_alloc_cleared_machine_function ();
}
/* Implement TARGET_HANDLE_OPTION. */
@@ -2924,8 +2930,8 @@ iq2000_setup_incoming_varargs (CUMULATIVE_ARGS *cum,
assembler syntax for an instruction operand that is a memory
reference whose address is ADDR. ADDR is an RTL expression. */
-void
-print_operand_address (FILE * file, rtx addr)
+static void
+iq2000_print_operand_address (FILE * file, rtx addr)
{
if (!addr)
error ("PRINT_OPERAND_ADDRESS, null pointer");
@@ -2950,7 +2956,7 @@ print_operand_address (FILE * file, rtx addr)
"PRINT_OPERAND_ADDRESS, LO_SUM with #1 not REG.");
fprintf (file, "%%lo(");
- print_operand_address (file, arg1);
+ iq2000_print_operand_address (file, arg1);
fprintf (file, ")(%s)", reg_names [REGNO (arg0)]);
}
break;
@@ -3052,12 +3058,12 @@ print_operand_address (FILE * file, rtx addr)
'$' Print the name of the stack pointer register (sp or $29).
'+' Print the name of the gp register (gp or $28). */
-void
-print_operand (FILE *file, rtx op, int letter)
+static void
+iq2000_print_operand (FILE *file, rtx op, int letter)
{
enum rtx_code code;
- if (PRINT_OPERAND_PUNCT_VALID_P (letter))
+ if (iq2000_print_operand_punct_valid_p (letter))
{
switch (letter)
{
@@ -3238,13 +3244,18 @@ print_operand (FILE *file, rtx op, int letter)
else if (code == CONST && GET_CODE (XEXP (op, 0)) == REG)
{
- print_operand (file, XEXP (op, 0), letter);
+ iq2000_print_operand (file, XEXP (op, 0), letter);
}
else
output_addr_const (file, op);
}
+static bool
+iq2000_print_operand_punct_valid_p (unsigned char code)
+{
+ return iq2000_print_operand_punct[code];
+}
/* For the IQ2000, transform:
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index fe97f206f96..07d4c2d864b 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -365,8 +365,6 @@ enum reg_class
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Function Arguments in Registers. */
@@ -571,13 +569,6 @@ typedef struct iq2000_args
#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
final_prescan_insn (INSN, OPVEC, NOPERANDS)
-/* See iq2000.c for the IQ2000 specific codes. */
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) iq2000_print_operand_punct[CODE]
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
#define DBR_OUTPUT_SEQEND(STREAM) \
do \
{ \
@@ -920,9 +911,6 @@ enum processor_type
#define SDATA_SECTION_ASM_OP "\t.sdata" /* Small data. */
-/* List of all IQ2000 punctuation characters used by print_operand. */
-extern char iq2000_print_operand_punct[256];
-
/* The target cpu for optimization and scheduling. */
extern enum processor_type iq2000_tune;
diff --git a/gcc/config/lm32/lm32.h b/gcc/config/lm32/lm32.h
index 3a814576722..0bf37455627 100644
--- a/gcc/config/lm32/lm32.h
+++ b/gcc/config/lm32/lm32.h
@@ -273,8 +273,6 @@ enum reg_class
#define ACCUMULATE_OUTGOING_ARGS 1
-#define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
-
/*--------------------------------*/
/* Passing Arguments in Registers */
/*--------------------------------*/
diff --git a/gcc/config/m32c/m32c-pragma.c b/gcc/config/m32c/m32c-pragma.c
index 4e309377465..b57615265a2 100644
--- a/gcc/config/m32c/m32c-pragma.c
+++ b/gcc/config/m32c/m32c-pragma.c
@@ -24,9 +24,8 @@
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "rtl.h"
#include "toplev.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "cpplib.h"
#include "hard-reg-set.h"
#include "output.h"
@@ -88,9 +87,47 @@ m32c_pragma_memregs (cpp_reader * reader ATTRIBUTE_UNUSED)
error ("#pragma GCC memregs takes a number [0..16]");
}
+/* Implements the "pragma ADDRESS" pragma. This pragma takes a
+ variable name and an address, and arranges for that variable to be
+ "at" that address. The variable is also made volatile. */
+static void
+m32c_pragma_address (cpp_reader * reader ATTRIBUTE_UNUSED)
+{
+ /* on off */
+ tree var, addr;
+ enum cpp_ttype type;
+ const char *var_str;
+
+ type = pragma_lex (&var);
+ if (type == CPP_NAME)
+ {
+ var_str = IDENTIFIER_POINTER (var);
+
+ type = pragma_lex (&addr);
+ if (type == CPP_NUMBER)
+ {
+ if (var != error_mark_node)
+ {
+ unsigned uaddr = tree_low_cst (addr, 1);
+ m32c_note_pragma_address (IDENTIFIER_POINTER (var), uaddr);
+ }
+
+ type = pragma_lex (&var);
+ if (type != CPP_EOF)
+ {
+ error ("junk at end of #pragma ADDRESS");
+ }
+ return;
+ }
+ }
+ error ("malformed #pragma ADDRESS variable address");
+}
+
/* Implements REGISTER_TARGET_PRAGMAS. */
void
m32c_register_pragmas (void)
{
c_register_pragma ("GCC", "memregs", m32c_pragma_memregs);
+ c_register_pragma (NULL, "ADDRESS", m32c_pragma_address);
+ c_register_pragma (NULL, "address", m32c_pragma_address);
}
diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h
index 42b92feb506..89231fc2d5d 100644
--- a/gcc/config/m32c/m32c-protos.h
+++ b/gcc/config/m32c/m32c-protos.h
@@ -42,6 +42,7 @@ int m32c_print_operand_punct_valid_p (int);
int m32c_push_rounding (int);
int m32c_reg_class_from_constraint (char, const char *);
void m32c_register_pragmas (void);
+void m32c_note_pragma_address (const char *, unsigned);
int m32c_regno_ok_for_base_p (int);
int m32c_trampoline_alignment (void);
int m32c_trampoline_size (void);
@@ -104,6 +105,8 @@ tree m32c_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
void m32c_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
bool m32c_promote_function_return (const_tree);
int m32c_special_page_vector_p (tree);
+void m32c_output_aligned_common (FILE *, tree, const char *,
+ int, int, int);
#endif
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index cfc4a1593b6..443325f8dd9 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -83,6 +83,9 @@ static int need_to_save (int);
static rtx m32c_function_value (const_tree, const_tree, bool);
static rtx m32c_libcall_value (enum machine_mode, const_rtx);
+/* Returns true if an address is specified, else false. */
+static bool m32c_get_pragma_address (const char *varname, unsigned *addr);
+
int current_function_special_page_vector (rtx);
#define SYMBOL_FLAG_FUNCVEC_FUNCTION (SYMBOL_FLAG_MACH_DEP << 0)
@@ -435,11 +438,7 @@ m32c_override_options (void)
static struct machine_function *
m32c_init_machine_status (void)
{
- struct machine_function *machine;
- machine =
- (machine_function *) ggc_alloc_cleared (sizeof (machine_function));
-
- return machine;
+ return ggc_alloc_cleared_machine_function ();
}
/* Implements INIT_EXPANDERS. We just set up to call the above
@@ -2933,7 +2932,107 @@ static void
m32c_insert_attributes (tree node ATTRIBUTE_UNUSED,
tree * attr_ptr ATTRIBUTE_UNUSED)
{
- /* Nothing to do here. */
+ unsigned addr;
+ /* See if we need to make #pragma address variables volatile. */
+
+ if (TREE_CODE (node) == VAR_DECL)
+ {
+ char *name = IDENTIFIER_POINTER (DECL_NAME (node));
+ if (m32c_get_pragma_address (name, &addr))
+ {
+ TREE_THIS_VOLATILE (node) = true;
+ }
+ }
+}
+
+
+struct GTY(()) pragma_entry {
+ const char *varname;
+ unsigned address;
+};
+typedef struct pragma_entry pragma_entry;
+
+/* Hash table of pragma info. */
+static GTY((param_is (pragma_entry))) htab_t pragma_htab;
+
+static int
+pragma_entry_eq (const void *p1, const void *p2)
+{
+ const pragma_entry *old = (const pragma_entry *) p1;
+ const char *new_name = (const char *) p2;
+
+ return strcmp (old->varname, new_name) == 0;
+}
+
+static hashval_t
+pragma_entry_hash (const void *p)
+{
+ const pragma_entry *old = (const pragma_entry *) p;
+ return htab_hash_string (old->varname);
+}
+
+void
+m32c_note_pragma_address (const char *varname, unsigned address)
+{
+ pragma_entry **slot;
+
+ if (!pragma_htab)
+ pragma_htab = htab_create_ggc (31, pragma_entry_hash,
+ pragma_entry_eq, NULL);
+
+ slot = (pragma_entry **)
+ htab_find_slot_with_hash (pragma_htab, varname,
+ htab_hash_string (varname), INSERT);
+
+ if (!*slot)
+ {
+ *slot = ggc_alloc_pragma_entry ();
+ (*slot)->varname = ggc_strdup (varname);
+ }
+ (*slot)->address = address;
+}
+
+static bool
+m32c_get_pragma_address (const char *varname, unsigned *address)
+{
+ pragma_entry **slot;
+
+ if (!pragma_htab)
+ return false;
+
+ slot = (pragma_entry **)
+ htab_find_slot_with_hash (pragma_htab, varname,
+ htab_hash_string (varname), NO_INSERT);
+ if (slot && *slot)
+ {
+ *address = (*slot)->address;
+ return true;
+ }
+ return false;
+}
+
+void
+m32c_output_aligned_common (FILE *stream, tree decl, const char *name,
+ int size, int align, int global)
+{
+ unsigned address;
+
+ if (m32c_get_pragma_address (name, &address))
+ {
+ /* We never output these as global. */
+ assemble_name (stream, name);
+ fprintf (stream, " = 0x%04x\n", address);
+ return;
+ }
+ if (!global)
+ {
+ fprintf (stream, "\t.local\t");
+ assemble_name (stream, name);
+ fprintf (stream, "\n");
+ }
+ fprintf (stream, "\t.comm\t");
+ assemble_name (stream, name);
+ fprintf (stream, ",%u,%u\n", size, align / BITS_PER_UNIT);
}
/* Predicates */
@@ -2964,7 +3063,7 @@ static const struct {
};
/* Returns TRUE if OP is a subreg of a hard reg which we don't
- support. */
+ support. We also bail on MEMs with illegal addresses. */
bool
m32c_illegal_subreg_p (rtx op)
{
@@ -2972,6 +3071,12 @@ m32c_illegal_subreg_p (rtx op)
unsigned int i;
int src_mode, dest_mode;
+ if (GET_CODE (op) == MEM
+ && ! m32c_legitimate_address_p (Pmode, XEXP (op, 0), false))
+ {
+ return true;
+ }
+
if (GET_CODE (op) != SUBREG)
return false;
diff --git a/gcc/config/m32c/m32c.h b/gcc/config/m32c/m32c.h
index 85dc2d1dce2..8f7b720c696 100644
--- a/gcc/config/m32c/m32c.h
+++ b/gcc/config/m32c/m32c.h
@@ -503,7 +503,6 @@ enum reg_class
#define PUSH_ARGS 1
#define PUSH_ROUNDING(N) m32c_push_rounding (N)
-#define RETURN_POPS_ARGS(D,T,S) 0
#define CALL_POPS_ARGS(C) 0
/* Passing Arguments in Registers */
@@ -644,6 +643,13 @@ typedef struct m32c_cumulative_args
#define ASM_OUTPUT_REG_PUSH(S,R) m32c_output_reg_push (S, R)
#define ASM_OUTPUT_REG_POP(S,R) m32c_output_reg_pop (S, R)
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGNMENT) \
+ m32c_output_aligned_common (STREAM, DECL, NAME, SIZE, ALIGNMENT, 1)
+
+#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGNMENT) \
+ m32c_output_aligned_common (STREAM, DECL, NAME, SIZE, ALIGNMENT, 0)
+
+
/* Output of Dispatch Tables */
#define ASM_OUTPUT_ADDR_VEC_ELT(S,V) \
diff --git a/gcc/config/m32c/predicates.md b/gcc/config/m32c/predicates.md
index 321debfd2ca..98a1c16e7c5 100644
--- a/gcc/config/m32c/predicates.md
+++ b/gcc/config/m32c/predicates.md
@@ -26,7 +26,7 @@
(define_predicate "m32c_any_operand"
(ior (match_operand 0 "general_operand")
- (match_operand 1 "memory_operand"))
+ (match_code "mem,const_int,const_double"))
{
return ! m32c_illegal_subreg_p (op);
}
@@ -36,7 +36,11 @@
(define_predicate "m32c_nonimmediate_operand"
(ior (match_operand 0 "nonimmediate_operand")
- (match_operand 1 "memory_operand")))
+ (match_code "mem"))
+ {
+ return ! m32c_illegal_subreg_p (op);
+ }
+)
; TRUE if the operand is a pseudo-register.
(define_predicate "m32c_pseudo"
@@ -135,7 +139,7 @@
; Likewise, plus TRUE for memory references.
(define_predicate "mra_operand"
- (and (and (match_operand 0 "nonimmediate_operand" "")
+ (and (and (match_operand 0 "m32c_nonimmediate_operand" "")
(not (match_operand 1 "cr_operand" "")))
(not (match_operand 2 "m32c_wide_subreg" ""))))
diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h
index 2b7d09afeb5..56ad708cda5 100644
--- a/gcc/config/m32r/m32r-protos.h
+++ b/gcc/config/m32r/m32r-protos.h
@@ -43,8 +43,6 @@ extern int zero_and_one (rtx, rtx);
extern char * emit_cond_move (rtx *, rtx);
extern void m32r_output_block_move (rtx, rtx *);
extern int m32r_expand_block_move (rtx *);
-extern void m32r_print_operand (FILE *, rtx, int);
-extern void m32r_print_operand_address (FILE *, rtx);
extern int m32r_not_same_reg (rtx, rtx);
extern int m32r_hard_regno_rename_ok (unsigned int, unsigned int);
extern int m32r_legitimate_pic_operand_p (rtx);
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 36265e6221d..a700ec9a581 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -44,7 +44,7 @@
#include "tm-constrs.h"
/* Array of valid operand punctuation characters. */
-char m32r_punct_chars[256];
+static char m32r_punct_chars[256];
/* Selected code model. */
enum m32r_model m32r_model = M32R_MODEL_DEFAULT;
@@ -67,6 +67,9 @@ static void block_move_call (rtx, rtx, rtx);
static int m32r_is_insn (rtx);
static rtx m32r_legitimize_address (rtx, rtx, enum machine_mode);
static tree m32r_handle_model_attribute (tree *, tree, tree, int, bool *);
+static void m32r_print_operand (FILE *, rtx, int);
+static void m32r_print_operand_address (FILE *, rtx);
+static bool m32r_print_operand_punct_valid_p (unsigned char code);
static void m32r_output_function_prologue (FILE *, HOST_WIDE_INT);
static void m32r_output_function_epilogue (FILE *, HOST_WIDE_INT);
@@ -111,6 +114,13 @@ static const struct attribute_spec m32r_attribute_table[] =
#undef TARGET_ASM_ALIGNED_SI_OP
#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND m32r_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS m32r_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P m32r_print_operand_punct_valid_p
+
#undef TARGET_ASM_FUNCTION_PROLOGUE
#define TARGET_ASM_FUNCTION_PROLOGUE m32r_output_function_prologue
#undef TARGET_ASM_FUNCTION_EPILOGUE
@@ -216,7 +226,7 @@ m32r_init (void)
{
init_reg_tables ();
- /* Initialize array for PRINT_OPERAND_PUNCT_VALID_P. */
+ /* Initialize array for TARGET_PRINT_OPERAND_PUNCT_VALID_P. */
memset (m32r_punct_chars, 0, sizeof (m32r_punct_chars));
m32r_punct_chars['#'] = 1;
m32r_punct_chars['@'] = 1; /* ??? no longer used */
@@ -1933,7 +1943,7 @@ m32r_file_start (void)
CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
For `%' followed by punctuation, CODE is the punctuation and X is null. */
-void
+static void
m32r_print_operand (FILE * file, rtx x, int code)
{
rtx addr;
@@ -2160,7 +2170,7 @@ m32r_print_operand (FILE * file, rtx x, int code)
/* Print a memory address as an operand to reference that memory location. */
-void
+static void
m32r_print_operand_address (FILE * file, rtx addr)
{
rtx base;
@@ -2248,6 +2258,12 @@ m32r_print_operand_address (FILE * file, rtx addr)
}
}
+static bool
+m32r_print_operand_punct_valid_p (unsigned char code)
+{
+ return m32r_punct_chars[code];
+}
+
/* Return true if the operands are the constants 0 and 1. */
int
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index 7b6237a7c22..91d055bcb5b 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -823,14 +823,6 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
increase the stack frame size by this amount. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-#define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
-
/* Define a data type for recording info about an argument list
during the scan of that argument list. This data type should
hold all necessary information about the function itself
@@ -1274,24 +1266,6 @@ L2: .word STATIC
SUBTARGET_ADDITIONAL_REGISTER_NAMES \
}
-/* A C expression which evaluates to true if CODE is a valid
- punctuation character for use in the `PRINT_OPERAND' macro. */
-extern char m32r_punct_chars[256];
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
- m32r_punct_chars[(unsigned char) (CHAR)]
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-#define PRINT_OPERAND(FILE, X, CODE) \
- m32r_print_operand (FILE, X, CODE)
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand that is a memory
- reference whose address is ADDR. ADDR is an RTL expression. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- m32r_print_operand_address (FILE, ADDR)
-
/* If defined, C string expressions to be used for the `%R', `%L',
`%U', and `%I' options of `asm_fprintf' (see `final.c'). These
are useful when a single `md' file must support multiple assembler
diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h
index 59154faf00b..d8ae8e078a9 100644
--- a/gcc/config/m68hc11/m68hc11-protos.h
+++ b/gcc/config/m68hc11/m68hc11-protos.h
@@ -1,5 +1,5 @@
/* Prototypes for exported functions defined in m68hc11.c
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010
Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
@@ -57,9 +57,6 @@ extern void m68hc11_output_swap (rtx, rtx*);
extern int next_insn_test_reg (rtx, rtx);
-extern void print_operand (FILE*, rtx, int);
-extern void print_operand_address (FILE*, rtx);
-
extern int m68hc11_reload_operands (rtx*);
extern int dead_register_here (rtx, rtx);
diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c
index 397413f61b7..ad63ee8153d 100644
--- a/gcc/config/m68hc11/m68hc11.c
+++ b/gcc/config/m68hc11/m68hc11.c
@@ -1,6 +1,6 @@
/* Subroutines for code generation on Motorola 68HC11 and 68HC12.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009 Free Software Foundation, Inc.
+ 2009, 2010 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
This file is part of GCC.
@@ -78,6 +78,8 @@ static tree m68hc11_handle_page0_attribute (tree *, tree, tree, int, bool *);
void create_regs_rtx (void);
static void asm_print_register (FILE *, int);
+static void m68hc11_print_operand (FILE *, rtx, int);
+static void m68hc11_print_operand_address (FILE *, rtx);
static void m68hc11_output_function_epilogue (FILE *, HOST_WIDE_INT);
static void m68hc11_asm_out_constructor (rtx, int);
static void m68hc11_asm_out_destructor (rtx, int);
@@ -238,6 +240,11 @@ static const struct attribute_spec m68hc11_attribute_table[] =
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND m68hc11_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS m68hc11_print_operand_address
+
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE m68hc11_output_function_epilogue
@@ -2123,8 +2130,8 @@ asm_print_register (FILE *file, int regno)
'T' generate the low-part temporary scratch register. The operand is
ignored. */
-void
-print_operand (FILE *file, rtx op, int letter)
+static void
+m68hc11_print_operand (FILE *file, rtx op, int letter)
{
if (letter == 't')
{
@@ -2316,8 +2323,8 @@ must_parenthesize (rtx op)
assembler syntax for an instruction operand that is a memory
reference whose address is ADDR. ADDR is an RTL expression. */
-void
-print_operand_address (FILE *file, rtx addr)
+static void
+m68hc11_print_operand_address (FILE *file, rtx addr)
{
rtx base;
rtx offset;
diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h
index b9626e1ecca..2ea80a76396 100644
--- a/gcc/config/m68hc11/m68hc11.h
+++ b/gcc/config/m68hc11/m68hc11.h
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler.
Motorola 68HC11 and 68HC12.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
@@ -896,15 +896,6 @@ extern enum reg_class m68hc11_tmp_regs_class;
stack pointer really advances by. No rounding or alignment needed
for MC6811. */
#define PUSH_ROUNDING(BYTES) (BYTES)
-
-/* Value is 1 if returning from a function call automatically pops the
- arguments described by the number-of-args field in the call. FUNTYPE is
- the data type of the function (as a tree), or for a library call it is
- an identifier node for the subroutine name.
-
- The standard MC6811 call, with arg count word, includes popping the
- args as part of the call template. */
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
/* Passing Arguments in Registers. */
@@ -1351,17 +1342,6 @@ do { \
"*_.frame", "*_.tmp", "*_.z", "*_.xy", "*fake clobber", \
SOFT_REG_NAMES, "*sframe", "*ap"}
-/* Print an instruction operand X on file FILE. CODE is the code from the
- %-spec for printing this operand. If `%z3' was used to print operand
- 3, then CODE is 'z'. */
-
-#define PRINT_OPERAND(FILE, X, CODE) \
- print_operand (FILE, X, CODE)
-
-/* Print a memory operand whose address is X, on file FILE. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
-
/* This is how to output an insn to push/pop a register on the stack.
It need not be very fast code.
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index de6442aa6be..253d621d074 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -153,6 +153,7 @@ static bool m68k_return_in_memory (const_tree, const_tree);
#endif
static void m68k_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static void m68k_trampoline_init (rtx, tree, rtx);
+static int m68k_return_pops_args (tree, tree, int);
static rtx m68k_delegitimize_address (rtx);
@@ -271,6 +272,9 @@ const char *m68k_library_id_string = "_current_shared_library_a5_offset_";
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT m68k_trampoline_init
+#undef TARGET_RETURN_POPS_ARGS
+#define TARGET_RETURN_POPS_ARGS m68k_return_pops_args
+
#undef TARGET_DELEGITIMIZE_ADDRESS
#define TARGET_DELEGITIMIZE_ADDRESS m68k_delegitimize_address
@@ -4597,7 +4601,8 @@ m68k_output_addr_const_extra (FILE *file, rtx x)
case UNSPEC_RELOC16:
case UNSPEC_RELOC32:
output_addr_const (file, XVECEXP (x, 0, 0));
- fputs (m68k_get_reloc_decoration (INTVAL (XVECEXP (x, 0, 1))), file);
+ fputs (m68k_get_reloc_decoration
+ ((enum m68k_reloc) INTVAL (XVECEXP (x, 0, 1))), file);
return true;
default:
@@ -4624,16 +4629,17 @@ m68k_output_dwarf_dtprel (FILE *file, int size, rtx x)
and turn them back into a direct symbol reference. */
static rtx
-m68k_delegitimize_address (rtx x)
+m68k_delegitimize_address (rtx orig_x)
{
- rtx orig_x = delegitimize_mem_from_attrs (x);
- rtx y;
+ rtx x, y;
rtx addend = NULL_RTX;
rtx result;
- x = orig_x;
- if (MEM_P (x))
- x = XEXP (x, 0);
+ orig_x = delegitimize_mem_from_attrs (orig_x);
+ if (! MEM_P (orig_x))
+ return orig_x;
+
+ x = XEXP (orig_x, 0);
if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 1)) == CONST
@@ -5608,7 +5614,6 @@ m68k_sched_attr_opx_type (rtx insn, int address_p)
default:
gcc_unreachable ();
- return 0;
}
}
@@ -5652,7 +5657,6 @@ m68k_sched_attr_opy_type (rtx insn, int address_p)
default:
gcc_unreachable ();
- return 0;
}
}
@@ -5758,7 +5762,6 @@ m68k_sched_attr_size (rtx insn)
default:
gcc_unreachable ();
- return 0;
}
}
@@ -5790,7 +5793,6 @@ sched_get_opxy_mem_type (rtx insn, bool opx_p)
default:
gcc_unreachable ();
- return 0;
}
}
else
@@ -5816,7 +5818,6 @@ sched_get_opxy_mem_type (rtx insn, bool opx_p)
default:
gcc_unreachable ();
- return 0;
}
}
}
@@ -5849,7 +5850,6 @@ m68k_sched_attr_op_mem (rtx insn)
default:
gcc_unreachable ();
- return 0;
}
}
@@ -5868,7 +5868,6 @@ m68k_sched_attr_op_mem (rtx insn)
default:
gcc_unreachable ();
- return 0;
}
}
@@ -6150,7 +6149,7 @@ m68k_sched_first_cycle_multipass_dfa_lookahead (void)
return m68k_sched_issue_rate () - 1;
}
-/* Implementation of targetm.sched.md_init_global () hook.
+/* Implementation of targetm.sched.init_global () hook.
It is invoked once per scheduling pass and is used here
to initialize scheduler constants. */
static void
@@ -6258,7 +6257,7 @@ m68k_sched_md_finish_global (FILE *dump ATTRIBUTE_UNUSED,
sched_branch_type = NULL;
}
-/* Implementation of targetm.sched.md_init () hook.
+/* Implementation of targetm.sched.init () hook.
It is invoked each time scheduler starts on the new block (basic block or
extended basic block). */
static void
@@ -6525,4 +6524,25 @@ m68k_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
FINALIZE_TRAMPOLINE (XEXP (m_tramp, 0));
}
+/* On the 68000, the RTS insn cannot pop anything.
+ On the 68010, the RTD insn may be used to pop them if the number
+ of args is fixed, but if the number is variable then the caller
+ must pop them all. RTD can't be used for library calls now
+ because the library is compiled with the Unix compiler.
+ Use of RTD is a selectable option, since it is incompatible with
+ standard Unix calling sequences. If the option is not selected,
+ the caller must always pop the args. */
+
+static int
+m68k_return_pops_args (tree fundecl, tree funtype, int size)
+{
+ return ((TARGET_RTD
+ && (!fundecl
+ || TREE_CODE (fundecl) != IDENTIFIER_NODE)
+ && (TYPE_ARG_TYPES (funtype) == 0
+ || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (funtype)))
+ == void_type_node)))
+ ? size : 0);
+}
+
#include "gt-m68k.h"
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 5787e8aa1fd..ac478619f73 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -534,21 +534,6 @@ extern enum reg_class regno_reg_class[];
#define FIRST_PARM_OFFSET(FNDECL) 8
-/* On the 68000, the RTS insn cannot pop anything.
- On the 68010, the RTD insn may be used to pop them if the number
- of args is fixed, but if the number is variable then the caller
- must pop them all. RTD can't be used for library calls now
- because the library is compiled with the Unix compiler.
- Use of RTD is a selectable option, since it is incompatible with
- standard Unix calling sequences. If the option is not selected,
- the caller must always pop the args. */
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) \
- ? (SIZE) : 0)
-
/* On the m68k the return value defaults to D0. */
#define FUNCTION_VALUE(VALTYPE, FUNC) \
gen_rtx_REG (TYPE_MODE (VALTYPE), D0_REG)
diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h
index 331cf7191d7..9be73236aa2 100644
--- a/gcc/config/mcore/mcore-protos.h
+++ b/gcc/config/mcore/mcore-protos.h
@@ -54,8 +54,6 @@ extern int mcore_is_dead (rtx, rtx);
extern int mcore_expand_insv (rtx *);
extern bool mcore_expand_block_move (rtx *);
extern const char * mcore_output_andn (rtx, rtx *);
-extern void mcore_print_operand_address (FILE *, rtx);
-extern void mcore_print_operand (FILE *, rtx, int);
extern bool mcore_gen_compare (RTX_CODE, rtx, rtx);
extern int mcore_symbolic_address_p (rtx);
extern bool mcore_r15_operand_p (rtx);
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 574b5f6d5cd..6bb4e6476fb 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -131,6 +131,9 @@ static tree mcore_handle_naked_attribute (tree *, tree, tree, int, bool *
static void mcore_asm_named_section (const char *,
unsigned int, tree);
#endif
+static void mcore_print_operand (FILE *, rtx, int);
+static void mcore_print_operand_address (FILE *, rtx);
+static bool mcore_print_operand_punct_valid_p (unsigned char code);
static void mcore_unique_section (tree, int);
static void mcore_encode_section_info (tree, rtx, int);
static const char *mcore_strip_name_encoding (const char *);
@@ -173,6 +176,13 @@ static const struct attribute_spec mcore_attribute_table[] =
#define TARGET_ASM_UNALIGNED_SI_OP "\t.long\t"
#endif
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND mcore_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS mcore_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P mcore_print_operand_punct_valid_p
+
#undef TARGET_ATTRIBUTE_TABLE
#define TARGET_ATTRIBUTE_TABLE mcore_attribute_table
#undef TARGET_ASM_UNIQUE_SECTION
@@ -287,7 +297,7 @@ calc_live_regs (int * count)
/* Print the operand address in x to the stream. */
-void
+static void
mcore_print_operand_address (FILE * stream, rtx x)
{
switch (GET_CODE (x))
@@ -329,6 +339,13 @@ mcore_print_operand_address (FILE * stream, rtx x)
}
}
+static bool
+mcore_print_operand_punct_valid_p (unsigned char code)
+{
+ return (code == '.' || code == '#' || code == '*' || code == '^'
+ || code == '!');
+}
+
/* Print operand x (an rtx) in assembler syntax to file stream
according to modifier code.
@@ -341,7 +358,7 @@ mcore_print_operand_address (FILE * stream, rtx x)
'U' print register for ldm/stm instruction
'X' print byte number for xtrbN instruction. */
-void
+static void
mcore_print_operand (FILE * stream, rtx x, int code)
{
switch (code)
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index 8167400633f..7421d5dbb85 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -540,16 +540,6 @@ extern const enum reg_class reg_class_from_letter[];
/* Offset of first parameter from the argument pointer register value. */
#define FIRST_PARM_OFFSET(FNDECL) 0
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the MCore, the callee does not pop any of its arguments that were passed
- on the stack. */
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
@@ -960,15 +950,4 @@ extern long mcore_current_compilation_timestamp;
} \
while (0)
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-#define PRINT_OPERAND(STREAM, X, CODE) mcore_print_operand (STREAM, X, CODE)
-
-/* Print a memory address as an operand to reference that memory location. */
-#define PRINT_OPERAND_ADDRESS(STREAM,X) mcore_print_operand_address (STREAM, X)
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
- ((CHAR)=='.' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '!')
-
#endif /* ! GCC_MCORE_H */
diff --git a/gcc/config/mep/mep-pragma.c b/gcc/config/mep/mep-pragma.c
index 3f9fc5a7071..1d79a3bd19f 100644
--- a/gcc/config/mep/mep-pragma.c
+++ b/gcc/config/mep/mep-pragma.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "rtl.h"
#include "toplev.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "cpplib.h"
#include "hard-reg-set.h"
#include "output.h"
diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c
index a4b167da4b7..9e23e45f8bb 100644
--- a/gcc/config/mep/mep.c
+++ b/gcc/config/mep/mep.c
@@ -2369,11 +2369,7 @@ mep_register_move_cost (enum machine_mode mode, enum reg_class from, enum reg_cl
static struct machine_function *
mep_init_machine_status (void)
{
- struct machine_function *f;
-
- f = (struct machine_function *) ggc_alloc_cleared (sizeof (struct machine_function));
-
- return f;
+ return ggc_alloc_cleared_machine_function ();
}
static rtx
@@ -4234,7 +4230,7 @@ mep_note_pragma_flag (const char *funcname, int flag)
if (!*slot)
{
- *slot = GGC_NEW (pragma_entry);
+ *slot = ggc_alloc_pragma_entry ();
(*slot)->flag = 0;
(*slot)->used = 0;
(*slot)->funcname = ggc_strdup (funcname);
@@ -6333,7 +6329,7 @@ mep_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
unsigned int n_args;
tree fnname;
const struct cgen_insn *cgen_insn;
- const struct insn_data *idata;
+ const struct insn_data_d *idata;
unsigned int first_arg = 0;
tree return_type = void_type_node;
unsigned int builtin_n_args;
@@ -7213,7 +7209,7 @@ bool
mep_emit_intrinsic (int intrinsic, const rtx *operands)
{
const struct cgen_insn *cgen_insn;
- const struct insn_data *idata;
+ const struct insn_data_d *idata;
rtx newop[10];
int i;
diff --git a/gcc/config/mep/mep.h b/gcc/config/mep/mep.h
index 9d286e33b94..d3af0734951 100644
--- a/gcc/config/mep/mep.h
+++ b/gcc/config/mep/mep.h
@@ -503,8 +503,6 @@ extern unsigned int mep_selected_isa;
#define ACCUMULATE_OUTGOING_ARGS 1
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
/* The ABI is thus: Arguments are in $1, $2, $3, $4, stack. Arguments
diff --git a/gcc/config/mep/t-mep b/gcc/config/mep/t-mep
index 5fd7f944116..9608d6c46d3 100644
--- a/gcc/config/mep/t-mep
+++ b/gcc/config/mep/t-mep
@@ -33,7 +33,7 @@ CRTSTUFF_CFLAGS = -O0 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
TCFLAGS = -mlibrary
mep-pragma.o: $(srcdir)/config/mep/mep-pragma.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) $(RTL_H) toplev.h c-pragma.h \
+ coretypes.h $(TM_H) $(TREE_H) $(RTL_H) toplev.h $(C_PRAGMA_H) \
$(CPPLIB_H) hard-reg-set.h output.h $(srcdir)/config/mep/mep-protos.h \
function.h insn-config.h reload.h $(TARGET_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --git a/gcc/config/mips/crtfastmath.c b/gcc/config/mips/crtfastmath.c
new file mode 100644
index 00000000000..a9586b0a797
--- /dev/null
+++ b/gcc/config/mips/crtfastmath.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License
+ and a copy of the GCC Runtime Library Exception along with this
+ program; see the files COPYING3 and COPYING.RUNTIME respectively.
+ If not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef __mips_hard_float
+
+/* Flush denormalized numbers to zero. */
+#define _FPU_FLUSH_TZ 0x1000000
+
+/* Rounding control. */
+#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
+#define _FPU_RC_ZERO 0x1
+#define _FPU_RC_UP 0x2
+#define _FPU_RC_DOWN 0x3
+
+/* Enable interrupts for IEEE exceptions. */
+#define _FPU_IEEE 0x00000F80
+
+/* Macros for accessing the hardware control word. */
+#define _FPU_GETCW(cw) __asm__ ("cfc1 %0,$31" : "=r" (cw))
+#define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw))
+
+static void __attribute__((constructor))
+set_fast_math (void)
+{
+ unsigned int fcr;
+
+ /* Flush to zero, round to nearest, IEEE exceptions disabled. */
+ fcr = _FPU_FLUSH_TZ | _FPU_RC_NEAREST;
+
+ _FPU_SETCW(fcr);
+}
+
+#endif /* __mips_hard_float */
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index 0512ef7d14f..8087e8ffd12 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -147,3 +147,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define DRIVER_SELF_SPECS \
BASE_DRIVER_SELF_SPECS, \
LINUX_DRIVER_SELF_SPECS
+
+/* Similar to standard Linux, but adding -ffast-math support. */
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
diff --git a/gcc/config/mips/linux64.h b/gcc/config/mips/linux64.h
index 2f24dfa1416..a68e8b4da9b 100644
--- a/gcc/config/mips/linux64.h
+++ b/gcc/config/mips/linux64.h
@@ -39,8 +39,10 @@ along with GCC; see the file COPYING3. If not see
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
#define LINUX_DYNAMIC_LINKERN32 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32)
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+ BIONIC_DYNAMIC_LINKERN32)
#undef LINK_SPEC
#define LINK_SPEC "\
diff --git a/gcc/config/mips/loongson.md b/gcc/config/mips/loongson.md
index f952cf672ee..10703bb7b08 100644
--- a/gcc/config/mips/loongson.md
+++ b/gcc/config/mips/loongson.md
@@ -18,6 +18,31 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+(define_c_enum "unspec" [
+ UNSPEC_LOONGSON_PAVG
+ UNSPEC_LOONGSON_PCMPEQ
+ UNSPEC_LOONGSON_PCMPGT
+ UNSPEC_LOONGSON_PEXTR
+ UNSPEC_LOONGSON_PINSR_0
+ UNSPEC_LOONGSON_PINSR_1
+ UNSPEC_LOONGSON_PINSR_2
+ UNSPEC_LOONGSON_PINSR_3
+ UNSPEC_LOONGSON_PMADD
+ UNSPEC_LOONGSON_PMOVMSK
+ UNSPEC_LOONGSON_PMULHU
+ UNSPEC_LOONGSON_PMULH
+ UNSPEC_LOONGSON_PMULL
+ UNSPEC_LOONGSON_PMULU
+ UNSPEC_LOONGSON_PASUBUB
+ UNSPEC_LOONGSON_BIADD
+ UNSPEC_LOONGSON_PSADBH
+ UNSPEC_LOONGSON_PSHUFH
+ UNSPEC_LOONGSON_PUNPCKH
+ UNSPEC_LOONGSON_PUNPCKL
+ UNSPEC_LOONGSON_PADDD
+ UNSPEC_LOONGSON_PSUBD
+])
+
;; Mode iterators and attributes.
;; 64-bit vectors of bytes.
diff --git a/gcc/config/mips/loongson2ef.md b/gcc/config/mips/loongson2ef.md
index df3de33f809..1238f20ecae 100644
--- a/gcc/config/mips/loongson2ef.md
+++ b/gcc/config/mips/loongson2ef.md
@@ -17,6 +17,13 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+(define_c_enum "unspec" [
+ UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN
+ UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN
+ UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN
+ UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN
+])
+
;; Automaton for integer instructions.
(define_automaton "ls2_alu")
diff --git a/gcc/config/mips/mips-dsp.md b/gcc/config/mips/mips-dsp.md
index 9e02f7214f9..faa22bdd364 100644
--- a/gcc/config/mips/mips-dsp.md
+++ b/gcc/config/mips/mips-dsp.md
@@ -16,6 +16,78 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+;; MIPS DSP ASE Revision 0.98 3/24/2005
+(define_c_enum "unspec" [
+ UNSPEC_ADDQ
+ UNSPEC_ADDQ_S
+ UNSPEC_SUBQ
+ UNSPEC_SUBQ_S
+ UNSPEC_ADDSC
+ UNSPEC_ADDWC
+ UNSPEC_MODSUB
+ UNSPEC_RADDU_W_QB
+ UNSPEC_ABSQ_S
+ UNSPEC_PRECRQ_QB_PH
+ UNSPEC_PRECRQ_PH_W
+ UNSPEC_PRECRQ_RS_PH_W
+ UNSPEC_PRECRQU_S_QB_PH
+ UNSPEC_PRECEQ_W_PHL
+ UNSPEC_PRECEQ_W_PHR
+ UNSPEC_PRECEQU_PH_QBL
+ UNSPEC_PRECEQU_PH_QBR
+ UNSPEC_PRECEQU_PH_QBLA
+ UNSPEC_PRECEQU_PH_QBRA
+ UNSPEC_PRECEU_PH_QBL
+ UNSPEC_PRECEU_PH_QBR
+ UNSPEC_PRECEU_PH_QBLA
+ UNSPEC_PRECEU_PH_QBRA
+ UNSPEC_SHLL
+ UNSPEC_SHLL_S
+ UNSPEC_SHRL_QB
+ UNSPEC_SHRA_PH
+ UNSPEC_SHRA_R
+ UNSPEC_MULEU_S_PH_QBL
+ UNSPEC_MULEU_S_PH_QBR
+ UNSPEC_MULQ_RS_PH
+ UNSPEC_MULEQ_S_W_PHL
+ UNSPEC_MULEQ_S_W_PHR
+ UNSPEC_DPAU_H_QBL
+ UNSPEC_DPAU_H_QBR
+ UNSPEC_DPSU_H_QBL
+ UNSPEC_DPSU_H_QBR
+ UNSPEC_DPAQ_S_W_PH
+ UNSPEC_DPSQ_S_W_PH
+ UNSPEC_MULSAQ_S_W_PH
+ UNSPEC_DPAQ_SA_L_W
+ UNSPEC_DPSQ_SA_L_W
+ UNSPEC_MAQ_S_W_PHL
+ UNSPEC_MAQ_S_W_PHR
+ UNSPEC_MAQ_SA_W_PHL
+ UNSPEC_MAQ_SA_W_PHR
+ UNSPEC_BITREV
+ UNSPEC_INSV
+ UNSPEC_REPL_QB
+ UNSPEC_REPL_PH
+ UNSPEC_CMP_EQ
+ UNSPEC_CMP_LT
+ UNSPEC_CMP_LE
+ UNSPEC_CMPGU_EQ_QB
+ UNSPEC_CMPGU_LT_QB
+ UNSPEC_CMPGU_LE_QB
+ UNSPEC_PICK
+ UNSPEC_PACKRL_PH
+ UNSPEC_EXTR_W
+ UNSPEC_EXTR_R_W
+ UNSPEC_EXTR_RS_W
+ UNSPEC_EXTR_S_H
+ UNSPEC_EXTP
+ UNSPEC_EXTPDP
+ UNSPEC_SHILO
+ UNSPEC_MTHLIP
+ UNSPEC_WRDSP
+ UNSPEC_RDDSP
+])
+
(define_constants
[(CCDSP_PO_REGNUM 182)
(CCDSP_SC_REGNUM 183)
diff --git a/gcc/config/mips/mips-dspr2.md b/gcc/config/mips/mips-dspr2.md
index 52495d43daa..9c3cbd58435 100644
--- a/gcc/config/mips/mips-dspr2.md
+++ b/gcc/config/mips/mips-dspr2.md
@@ -18,6 +18,58 @@
;;
; MIPS DSP ASE REV 2 Revision 0.02 11/24/2006
+(define_c_enum "unspec" [
+ UNSPEC_ABSQ_S_QB
+ UNSPEC_ADDU_PH
+ UNSPEC_ADDU_S_PH
+ UNSPEC_ADDUH_QB
+ UNSPEC_ADDUH_R_QB
+ UNSPEC_APPEND
+ UNSPEC_BALIGN
+ UNSPEC_CMPGDU_EQ_QB
+ UNSPEC_CMPGDU_LT_QB
+ UNSPEC_CMPGDU_LE_QB
+ UNSPEC_DPA_W_PH
+ UNSPEC_DPS_W_PH
+ UNSPEC_MADD
+ UNSPEC_MADDU
+ UNSPEC_MSUB
+ UNSPEC_MSUBU
+ UNSPEC_MUL_PH
+ UNSPEC_MUL_S_PH
+ UNSPEC_MULQ_RS_W
+ UNSPEC_MULQ_S_PH
+ UNSPEC_MULQ_S_W
+ UNSPEC_MULSA_W_PH
+ UNSPEC_MULT
+ UNSPEC_MULTU
+ UNSPEC_PRECR_QB_PH
+ UNSPEC_PRECR_SRA_PH_W
+ UNSPEC_PRECR_SRA_R_PH_W
+ UNSPEC_PREPEND
+ UNSPEC_SHRA_QB
+ UNSPEC_SHRA_R_QB
+ UNSPEC_SHRL_PH
+ UNSPEC_SUBU_PH
+ UNSPEC_SUBU_S_PH
+ UNSPEC_SUBUH_QB
+ UNSPEC_SUBUH_R_QB
+ UNSPEC_ADDQH_PH
+ UNSPEC_ADDQH_R_PH
+ UNSPEC_ADDQH_W
+ UNSPEC_ADDQH_R_W
+ UNSPEC_SUBQH_PH
+ UNSPEC_SUBQH_R_PH
+ UNSPEC_SUBQH_W
+ UNSPEC_SUBQH_R_W
+ UNSPEC_DPAX_W_PH
+ UNSPEC_DPSX_W_PH
+ UNSPEC_DPAQX_S_W_PH
+ UNSPEC_DPAQX_SA_W_PH
+ UNSPEC_DPSQX_S_W_PH
+ UNSPEC_DPSQX_SA_W_PH
+])
+
(define_insn "mips_absq_s_qb"
[(parallel
[(set (match_operand:V4QI 0 "register_operand" "=d")
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index e4fbb32b959..70920fd64a0 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -260,8 +260,6 @@ extern HOST_WIDE_INT mips_debugger_offset (rtx, HOST_WIDE_INT);
extern void mips_push_asm_switch (struct mips_asm_switch *);
extern void mips_pop_asm_switch (struct mips_asm_switch *);
-extern void mips_print_operand (FILE *, rtx, int);
-extern void mips_print_operand_address (FILE *, rtx);
extern void mips_output_external (FILE *, tree, const char *);
extern void mips_output_filename (FILE *, const char *);
extern void mips_output_ascii (FILE *, const char *, size_t);
diff --git a/gcc/config/mips/mips-ps-3d.md b/gcc/config/mips/mips-ps-3d.md
index c13c7a69b28..780fb03c706 100644
--- a/gcc/config/mips/mips-ps-3d.md
+++ b/gcc/config/mips/mips-ps-3d.md
@@ -17,6 +17,30 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+(define_c_enum "unspec" [
+ UNSPEC_MOVE_TF_PS
+ UNSPEC_C
+
+ ;; MIPS64/MIPS32R2 alnv.ps
+ UNSPEC_ALNV_PS
+
+ ;; MIPS-3D instructions
+ UNSPEC_CABS
+
+ UNSPEC_ADDR_PS
+ UNSPEC_CVT_PW_PS
+ UNSPEC_CVT_PS_PW
+ UNSPEC_MULR_PS
+ UNSPEC_ABS_PS
+
+ UNSPEC_RSQRT1
+ UNSPEC_RSQRT2
+ UNSPEC_RECIP1
+ UNSPEC_RECIP2
+ UNSPEC_SINGLE_CC
+ UNSPEC_SCC
+])
+
(define_insn "*movcc_v2sf_<mode>"
[(set (match_operand:V2SF 0 "register_operand" "=f,f")
(if_then_else:V2SF
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index a00b10680f8..ccdfbbc3fd1 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -504,11 +504,11 @@ struct mips_asm_switch mips_noat = { "at", 0 };
static bool mips_branch_likely;
/* The current instruction-set architecture. */
-enum processor_type mips_arch;
+enum processor mips_arch;
const struct mips_cpu_info *mips_arch_info;
/* The processor that we should tune the code for. */
-enum processor_type mips_tune;
+enum processor mips_tune;
const struct mips_cpu_info *mips_tune_info;
/* The ISA level associated with mips_arch. */
@@ -548,7 +548,7 @@ bool mips_hard_regno_mode_ok[(int) MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
/* Index C is true if character C is a valid PRINT_OPERAND punctation
character. */
-bool mips_print_operand_punct[256];
+static bool mips_print_operand_punct[256];
static GTY (()) int mips_output_filename_first_time = 1;
@@ -797,7 +797,8 @@ static const struct mips_rtx_cost_data mips_rtx_cost_optimize_size = {
};
/* Costs to use when optimizing for speed, indexed by processor. */
-static const struct mips_rtx_cost_data mips_rtx_cost_data[PROCESSOR_MAX] = {
+static const struct mips_rtx_cost_data
+ mips_rtx_cost_data[NUM_PROCESSOR_VALUES] = {
{ /* R3000 */
COSTS_N_INSNS (2), /* fp_add */
COSTS_N_INSNS (4), /* fp_mult_sf */
@@ -1217,7 +1218,7 @@ mflip_mips16_use_mips16_p (tree decl)
if (!entry)
{
mips16_flipper = !mips16_flipper;
- entry = GGC_NEW (struct mflip_mips16_entry);
+ entry = ggc_alloc_mflip_mips16_entry ();
entry->name = name;
entry->mips16_p = mips16_flipper ? !mips_base_mips16 : mips_base_mips16;
*slot = entry;
@@ -5851,7 +5852,7 @@ mips16_local_alias (rtx func)
SYMBOL_REF_FLAGS (local) = SYMBOL_REF_FLAGS (func) | SYMBOL_FLAG_LOCAL;
/* Create a new structure to represent the mapping. */
- alias = GGC_NEW (struct mips16_local_alias);
+ alias = ggc_alloc_mips16_local_alias ();
alias->func = func;
alias->local = local;
*slot = alias;
@@ -7446,7 +7447,15 @@ mips_print_float_branch_condition (FILE *file, enum rtx_code code, int letter)
}
}
-/* Implement the PRINT_OPERAND macro. The MIPS-specific operand codes are:
+/* Implement TARGET_PRINT_OPERAND_PUNCT_VALID_P. */
+
+static bool
+mips_print_operand_punct_valid_p (unsigned char code)
+{
+ return mips_print_operand_punct[code];
+}
+
+/* Implement TARGET_PRINT_OPERAND. The MIPS-specific operand codes are:
'X' Print CONST_INT OP in hexadecimal format.
'x' Print the low 16 bits of CONST_INT OP in hexadecimal format.
@@ -7470,12 +7479,12 @@ mips_print_float_branch_condition (FILE *file, enum rtx_code code, int letter)
'M' Print high-order register in a double-word register operand.
'z' Print $0 if OP is zero, otherwise print OP normally. */
-void
+static void
mips_print_operand (FILE *file, rtx op, int letter)
{
enum rtx_code code;
- if (PRINT_OPERAND_PUNCT_VALID_P (letter))
+ if (mips_print_operand_punct_valid_p (letter))
{
mips_print_operand_punctuation (file, letter);
return;
@@ -7617,9 +7626,9 @@ mips_print_operand (FILE *file, rtx op, int letter)
}
}
-/* Output address operand X to FILE. */
+/* Implement TARGET_PRINT_OPERAND_ADDRESS. */
-void
+static void
mips_print_operand_address (FILE *file, rtx x)
{
struct mips_address_info addr;
@@ -10920,14 +10929,14 @@ mips_register_move_cost (enum machine_mode mode,
/* Implement TARGET_IRA_COVER_CLASSES. */
-static const enum reg_class *
+static const reg_class_t *
mips_ira_cover_classes (void)
{
- static const enum reg_class acc_classes[] = {
+ static const reg_class_t acc_classes[] = {
GR_AND_ACC_REGS, FP_REGS, COP0_REGS, COP2_REGS, COP3_REGS,
ST_REGS, LIM_REG_CLASSES
};
- static const enum reg_class no_acc_classes[] = {
+ static const reg_class_t no_acc_classes[] = {
GR_REGS, FP_REGS, COP0_REGS, COP2_REGS, COP3_REGS,
ST_REGS, LIM_REG_CLASSES
};
@@ -15213,8 +15222,7 @@ mips_set_current_function (tree fndecl)
static struct machine_function *
mips_init_machine_status (void)
{
- return ((struct machine_function *)
- ggc_alloc_cleared (sizeof (struct machine_function)));
+ return ggc_alloc_cleared_machine_function ();
}
/* Return the processor associated with the given ISA level, or null
@@ -16377,6 +16385,13 @@ void mips_function_profiler (FILE *file)
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND mips_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS mips_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P mips_print_operand_punct_valid_p
+
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS mips_setup_incoming_varargs
#undef TARGET_STRICT_ARGUMENT_NAMING
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index c2816cf9f68..988deab22e5 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -28,53 +28,6 @@ along with GCC; see the file COPYING3. If not see
/* MIPS external variables defined in mips.c. */
-/* Which processor to schedule for. Since there is no difference between
- a R2000 and R3000 in terms of the scheduler, we collapse them into
- just an R3000. The elements of the enumeration must match exactly
- the cpu attribute in the mips.md machine description. */
-
-enum processor_type {
- PROCESSOR_R3000,
- PROCESSOR_4KC,
- PROCESSOR_4KP,
- PROCESSOR_5KC,
- PROCESSOR_5KF,
- PROCESSOR_20KC,
- PROCESSOR_24KC,
- PROCESSOR_24KF2_1,
- PROCESSOR_24KF1_1,
- PROCESSOR_74KC,
- PROCESSOR_74KF2_1,
- PROCESSOR_74KF1_1,
- PROCESSOR_74KF3_2,
- PROCESSOR_LOONGSON_2E,
- PROCESSOR_LOONGSON_2F,
- PROCESSOR_M4K,
- PROCESSOR_OCTEON,
- PROCESSOR_R3900,
- PROCESSOR_R6000,
- PROCESSOR_R4000,
- PROCESSOR_R4100,
- PROCESSOR_R4111,
- PROCESSOR_R4120,
- PROCESSOR_R4130,
- PROCESSOR_R4300,
- PROCESSOR_R4600,
- PROCESSOR_R4650,
- PROCESSOR_R5000,
- PROCESSOR_R5400,
- PROCESSOR_R5500,
- PROCESSOR_R7000,
- PROCESSOR_R8000,
- PROCESSOR_R9000,
- PROCESSOR_R10000,
- PROCESSOR_SB1,
- PROCESSOR_SB1A,
- PROCESSOR_SR71000,
- PROCESSOR_XLR,
- PROCESSOR_MAX
-};
-
/* Costs of various operations on the different architectures. */
struct mips_rtx_cost_data
@@ -121,7 +74,7 @@ struct mips_cpu_info {
/* The internal processor number that most closely matches this
entry. Several processors can have the same value, if there's no
difference between them from GCC's point of view. */
- enum processor_type cpu;
+ enum processor cpu;
/* The ISA level that the processor implements. */
int isa;
@@ -2209,8 +2162,6 @@ enum reg_class
#define STACK_BOUNDARY (TARGET_NEWABI ? 128 : 64)
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Symbolic macros for the registers used to return integer and floating
point values. */
@@ -2704,10 +2655,6 @@ typedef struct mips_args {
#define ALL_COP_ADDITIONAL_REGISTER_NAMES
-#define PRINT_OPERAND mips_print_operand
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) mips_print_operand_punct[CODE]
-#define PRINT_OPERAND_ADDRESS mips_print_operand_address
-
#define DBR_OUTPUT_SEQEND(STREAM) \
do \
{ \
@@ -3060,7 +3007,6 @@ struct mips_asm_switch {
extern const enum reg_class mips_regno_to_class[];
extern bool mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
-extern bool mips_print_operand_punct[256];
extern const char *current_function_file; /* filename current function is in */
extern int num_source_filenames; /* current .file # */
extern struct mips_asm_switch mips_noreorder;
@@ -3070,8 +3016,8 @@ extern int mips_dbx_regno[];
extern int mips_dwarf_regno[];
extern bool mips_split_p[];
extern bool mips_split_hi_p[];
-extern enum processor_type mips_arch; /* which cpu to codegen for */
-extern enum processor_type mips_tune; /* which cpu to schedule for */
+extern enum processor mips_arch; /* which cpu to codegen for */
+extern enum processor mips_tune; /* which cpu to schedule for */
extern int mips_isa; /* architectural level */
extern int mips_abi; /* which ABI to use */
extern const struct mips_cpu_info *mips_arch_info;
@@ -3087,10 +3033,6 @@ extern enum mips_code_readable_setting mips_code_readable;
#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
mips_final_prescan_insn (INSN, OPVEC, NOPERANDS)
-/* This is necessary to avoid a warning about comparing different enum
- types. */
-#define mips_tune_attr ((enum attr_cpu) mips_tune)
-
/* As on most targets, we want the .eh_frame section to be read-only where
possible. And as on most targets, this means two things:
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index a8543274328..9b09344d9c9 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -23,247 +23,119 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+(define_enum "processor" [
+ r3000
+ 4kc
+ 4kp
+ 5kc
+ 5kf
+ 20kc
+ 24kc
+ 24kf2_1
+ 24kf1_1
+ 74kc
+ 74kf2_1
+ 74kf1_1
+ 74kf3_2
+ loongson_2e
+ loongson_2f
+ m4k
+ octeon
+ r3900
+ r6000
+ r4000
+ r4100
+ r4111
+ r4120
+ r4130
+ r4300
+ r4600
+ r4650
+ r5000
+ r5400
+ r5500
+ r7000
+ r8000
+ r9000
+ r10000
+ sb1
+ sb1a
+ sr71000
+ xlr
+])
+
+(define_c_enum "unspec" [
+ ;; Unaligned accesses.
+ UNSPEC_LOAD_LEFT
+ UNSPEC_LOAD_RIGHT
+ UNSPEC_STORE_LEFT
+ UNSPEC_STORE_RIGHT
+
+ ;; Floating-point moves.
+ UNSPEC_LOAD_LOW
+ UNSPEC_LOAD_HIGH
+ UNSPEC_STORE_WORD
+ UNSPEC_MFHC1
+ UNSPEC_MTHC1
+
+ ;; HI/LO moves.
+ UNSPEC_MFHI
+ UNSPEC_MTHI
+ UNSPEC_SET_HILO
+
+ ;; GP manipulation.
+ UNSPEC_LOADGP
+ UNSPEC_COPYGP
+ UNSPEC_MOVE_GP
+ UNSPEC_POTENTIAL_CPRESTORE
+ UNSPEC_CPRESTORE
+ UNSPEC_RESTORE_GP
+ UNSPEC_EH_RETURN
+ UNSPEC_GP
+ UNSPEC_SET_GOT_VERSION
+ UNSPEC_UPDATE_GOT_VERSION
+
+ ;; Symbolic accesses.
+ UNSPEC_LOAD_CALL
+ UNSPEC_LOAD_GOT
+ UNSPEC_TLS_LDM
+ UNSPEC_TLS_GET_TP
+
+ ;; MIPS16 constant pools.
+ UNSPEC_ALIGN
+ UNSPEC_CONSTTABLE_INT
+ UNSPEC_CONSTTABLE_FLOAT
+
+ ;; Blockage and synchronisation.
+ UNSPEC_BLOCKAGE
+ UNSPEC_CLEAR_HAZARD
+ UNSPEC_RDHWR
+ UNSPEC_SYNCI
+ UNSPEC_SYNC
+
+ ;; Cache manipulation.
+ UNSPEC_MIPS_CACHE
+ UNSPEC_R10K_CACHE_BARRIER
+
+ ;; Interrupt handling.
+ UNSPEC_ERET
+ UNSPEC_DERET
+ UNSPEC_DI
+ UNSPEC_EHB
+ UNSPEC_RDPGPR
+ UNSPEC_COP0
+
+ ;; Used in a call expression in place of args_size. It's present for PIC
+ ;; indirect calls where it contains args_size and the function symbol.
+ UNSPEC_CALL_ATTR
+])
+
(define_constants
- [(UNSPEC_LOAD_LOW 0)
- (UNSPEC_LOAD_HIGH 1)
- (UNSPEC_STORE_WORD 2)
- (UNSPEC_GET_FNADDR 3)
- (UNSPEC_BLOCKAGE 4)
- (UNSPEC_POTENTIAL_CPRESTORE 5)
- (UNSPEC_CPRESTORE 6)
- (UNSPEC_RESTORE_GP 7)
- (UNSPEC_MOVE_GP 8)
- (UNSPEC_EH_RETURN 9)
- (UNSPEC_CONSTTABLE_INT 10)
- (UNSPEC_CONSTTABLE_FLOAT 11)
- (UNSPEC_ALIGN 14)
- (UNSPEC_HIGH 17)
- (UNSPEC_LOAD_LEFT 18)
- (UNSPEC_LOAD_RIGHT 19)
- (UNSPEC_STORE_LEFT 20)
- (UNSPEC_STORE_RIGHT 21)
- (UNSPEC_LOADGP 22)
- (UNSPEC_LOAD_CALL 23)
- (UNSPEC_LOAD_GOT 24)
- (UNSPEC_GP 25)
- (UNSPEC_MFHI 26)
- (UNSPEC_MTHI 27)
- (UNSPEC_SET_HILO 28)
- (UNSPEC_TLS_LDM 29)
- (UNSPEC_TLS_GET_TP 30)
- (UNSPEC_MFHC1 31)
- (UNSPEC_MTHC1 32)
- (UNSPEC_CLEAR_HAZARD 33)
- (UNSPEC_RDHWR 34)
- (UNSPEC_SYNCI 35)
- (UNSPEC_SYNC 36)
- (UNSPEC_COMPARE_AND_SWAP 37)
- (UNSPEC_COMPARE_AND_SWAP_12 38)
- (UNSPEC_SYNC_OLD_OP 39)
- (UNSPEC_SYNC_NEW_OP 40)
- (UNSPEC_SYNC_NEW_OP_12 41)
- (UNSPEC_SYNC_OLD_OP_12 42)
- (UNSPEC_SYNC_EXCHANGE 43)
- (UNSPEC_SYNC_EXCHANGE_12 44)
- (UNSPEC_MEMORY_BARRIER 45)
- (UNSPEC_SET_GOT_VERSION 46)
- (UNSPEC_UPDATE_GOT_VERSION 47)
- (UNSPEC_COPYGP 48)
- (UNSPEC_ERET 49)
- (UNSPEC_DERET 50)
- (UNSPEC_DI 51)
- (UNSPEC_EHB 52)
- (UNSPEC_RDPGPR 53)
- (UNSPEC_COP0 54)
- ;; Used in a call expression in place of args_size. It's present for PIC
- ;; indirect calls where it contains args_size and the function symbol.
- (UNSPEC_CALL_ATTR 55)
-
- (UNSPEC_ADDRESS_FIRST 100)
-
- (TLS_GET_TP_REGNUM 3)
+ [(TLS_GET_TP_REGNUM 3)
(RETURN_ADDR_REGNUM 31)
(CPRESTORE_SLOT_REGNUM 76)
(GOT_VERSION_REGNUM 79)
- ;; For MIPS Paired-Singled Floating Point Instructions.
-
- (UNSPEC_MOVE_TF_PS 200)
- (UNSPEC_C 201)
-
- ;; MIPS64/MIPS32R2 alnv.ps
- (UNSPEC_ALNV_PS 202)
-
- ;; MIPS-3D instructions
- (UNSPEC_CABS 203)
-
- (UNSPEC_ADDR_PS 204)
- (UNSPEC_CVT_PW_PS 205)
- (UNSPEC_CVT_PS_PW 206)
- (UNSPEC_MULR_PS 207)
- (UNSPEC_ABS_PS 208)
-
- (UNSPEC_RSQRT1 209)
- (UNSPEC_RSQRT2 210)
- (UNSPEC_RECIP1 211)
- (UNSPEC_RECIP2 212)
- (UNSPEC_SINGLE_CC 213)
- (UNSPEC_SCC 214)
-
- ;; MIPS DSP ASE Revision 0.98 3/24/2005
- (UNSPEC_ADDQ 300)
- (UNSPEC_ADDQ_S 301)
- (UNSPEC_SUBQ 302)
- (UNSPEC_SUBQ_S 303)
- (UNSPEC_ADDSC 304)
- (UNSPEC_ADDWC 305)
- (UNSPEC_MODSUB 306)
- (UNSPEC_RADDU_W_QB 307)
- (UNSPEC_ABSQ_S 308)
- (UNSPEC_PRECRQ_QB_PH 309)
- (UNSPEC_PRECRQ_PH_W 310)
- (UNSPEC_PRECRQ_RS_PH_W 311)
- (UNSPEC_PRECRQU_S_QB_PH 312)
- (UNSPEC_PRECEQ_W_PHL 313)
- (UNSPEC_PRECEQ_W_PHR 314)
- (UNSPEC_PRECEQU_PH_QBL 315)
- (UNSPEC_PRECEQU_PH_QBR 316)
- (UNSPEC_PRECEQU_PH_QBLA 317)
- (UNSPEC_PRECEQU_PH_QBRA 318)
- (UNSPEC_PRECEU_PH_QBL 319)
- (UNSPEC_PRECEU_PH_QBR 320)
- (UNSPEC_PRECEU_PH_QBLA 321)
- (UNSPEC_PRECEU_PH_QBRA 322)
- (UNSPEC_SHLL 323)
- (UNSPEC_SHLL_S 324)
- (UNSPEC_SHRL_QB 325)
- (UNSPEC_SHRA_PH 326)
- (UNSPEC_SHRA_R 327)
- (UNSPEC_MULEU_S_PH_QBL 328)
- (UNSPEC_MULEU_S_PH_QBR 329)
- (UNSPEC_MULQ_RS_PH 330)
- (UNSPEC_MULEQ_S_W_PHL 331)
- (UNSPEC_MULEQ_S_W_PHR 332)
- (UNSPEC_DPAU_H_QBL 333)
- (UNSPEC_DPAU_H_QBR 334)
- (UNSPEC_DPSU_H_QBL 335)
- (UNSPEC_DPSU_H_QBR 336)
- (UNSPEC_DPAQ_S_W_PH 337)
- (UNSPEC_DPSQ_S_W_PH 338)
- (UNSPEC_MULSAQ_S_W_PH 339)
- (UNSPEC_DPAQ_SA_L_W 340)
- (UNSPEC_DPSQ_SA_L_W 341)
- (UNSPEC_MAQ_S_W_PHL 342)
- (UNSPEC_MAQ_S_W_PHR 343)
- (UNSPEC_MAQ_SA_W_PHL 344)
- (UNSPEC_MAQ_SA_W_PHR 345)
- (UNSPEC_BITREV 346)
- (UNSPEC_INSV 347)
- (UNSPEC_REPL_QB 348)
- (UNSPEC_REPL_PH 349)
- (UNSPEC_CMP_EQ 350)
- (UNSPEC_CMP_LT 351)
- (UNSPEC_CMP_LE 352)
- (UNSPEC_CMPGU_EQ_QB 353)
- (UNSPEC_CMPGU_LT_QB 354)
- (UNSPEC_CMPGU_LE_QB 355)
- (UNSPEC_PICK 356)
- (UNSPEC_PACKRL_PH 357)
- (UNSPEC_EXTR_W 358)
- (UNSPEC_EXTR_R_W 359)
- (UNSPEC_EXTR_RS_W 360)
- (UNSPEC_EXTR_S_H 361)
- (UNSPEC_EXTP 362)
- (UNSPEC_EXTPDP 363)
- (UNSPEC_SHILO 364)
- (UNSPEC_MTHLIP 365)
- (UNSPEC_WRDSP 366)
- (UNSPEC_RDDSP 367)
-
- ;; MIPS DSP ASE REV 2 Revision 0.02 11/24/2006
- (UNSPEC_ABSQ_S_QB 400)
- (UNSPEC_ADDU_PH 401)
- (UNSPEC_ADDU_S_PH 402)
- (UNSPEC_ADDUH_QB 403)
- (UNSPEC_ADDUH_R_QB 404)
- (UNSPEC_APPEND 405)
- (UNSPEC_BALIGN 406)
- (UNSPEC_CMPGDU_EQ_QB 407)
- (UNSPEC_CMPGDU_LT_QB 408)
- (UNSPEC_CMPGDU_LE_QB 409)
- (UNSPEC_DPA_W_PH 410)
- (UNSPEC_DPS_W_PH 411)
- (UNSPEC_MADD 412)
- (UNSPEC_MADDU 413)
- (UNSPEC_MSUB 414)
- (UNSPEC_MSUBU 415)
- (UNSPEC_MUL_PH 416)
- (UNSPEC_MUL_S_PH 417)
- (UNSPEC_MULQ_RS_W 418)
- (UNSPEC_MULQ_S_PH 419)
- (UNSPEC_MULQ_S_W 420)
- (UNSPEC_MULSA_W_PH 421)
- (UNSPEC_MULT 422)
- (UNSPEC_MULTU 423)
- (UNSPEC_PRECR_QB_PH 424)
- (UNSPEC_PRECR_SRA_PH_W 425)
- (UNSPEC_PRECR_SRA_R_PH_W 426)
- (UNSPEC_PREPEND 427)
- (UNSPEC_SHRA_QB 428)
- (UNSPEC_SHRA_R_QB 429)
- (UNSPEC_SHRL_PH 430)
- (UNSPEC_SUBU_PH 431)
- (UNSPEC_SUBU_S_PH 432)
- (UNSPEC_SUBUH_QB 433)
- (UNSPEC_SUBUH_R_QB 434)
- (UNSPEC_ADDQH_PH 435)
- (UNSPEC_ADDQH_R_PH 436)
- (UNSPEC_ADDQH_W 437)
- (UNSPEC_ADDQH_R_W 438)
- (UNSPEC_SUBQH_PH 439)
- (UNSPEC_SUBQH_R_PH 440)
- (UNSPEC_SUBQH_W 441)
- (UNSPEC_SUBQH_R_W 442)
- (UNSPEC_DPAX_W_PH 443)
- (UNSPEC_DPSX_W_PH 444)
- (UNSPEC_DPAQX_S_W_PH 445)
- (UNSPEC_DPAQX_SA_W_PH 446)
- (UNSPEC_DPSQX_S_W_PH 447)
- (UNSPEC_DPSQX_SA_W_PH 448)
-
- ;; ST Microelectronics Loongson-2E/2F.
- (UNSPEC_LOONGSON_PAVG 500)
- (UNSPEC_LOONGSON_PCMPEQ 501)
- (UNSPEC_LOONGSON_PCMPGT 502)
- (UNSPEC_LOONGSON_PEXTR 503)
- (UNSPEC_LOONGSON_PINSR_0 504)
- (UNSPEC_LOONGSON_PINSR_1 505)
- (UNSPEC_LOONGSON_PINSR_2 506)
- (UNSPEC_LOONGSON_PINSR_3 507)
- (UNSPEC_LOONGSON_PMADD 508)
- (UNSPEC_LOONGSON_PMOVMSK 509)
- (UNSPEC_LOONGSON_PMULHU 510)
- (UNSPEC_LOONGSON_PMULH 511)
- (UNSPEC_LOONGSON_PMULL 512)
- (UNSPEC_LOONGSON_PMULU 513)
- (UNSPEC_LOONGSON_PASUBUB 514)
- (UNSPEC_LOONGSON_BIADD 515)
- (UNSPEC_LOONGSON_PSADBH 516)
- (UNSPEC_LOONGSON_PSHUFH 517)
- (UNSPEC_LOONGSON_PUNPCKH 518)
- (UNSPEC_LOONGSON_PUNPCKL 519)
- (UNSPEC_LOONGSON_PADDD 520)
- (UNSPEC_LOONGSON_PSUBD 521)
-
- ;; Used in loongson2ef.md
- (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN 530)
- (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN 531)
- (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN 532)
- (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN 533)
-
- (UNSPEC_MIPS_CACHE 600)
- (UNSPEC_R10K_CACHE_BARRIER 601)
-
;; PIC long branch sequences are never longer than 100 bytes.
(MAX_PIC_BRANCH_LENGTH 100)
]
@@ -327,6 +199,9 @@
shift_shift,lui_movf"
(const_string "unknown"))
+(define_attr "alu_type" "unknown,add,sub,not,nor,and,or,xor"
+ (const_string "unknown"))
+
;; Main data type used by the insn
(define_attr "mode" "unknown,none,QI,HI,SI,DI,TI,SF,DF,TF,FPSW"
(const_string "unknown"))
@@ -403,6 +278,10 @@
(cond [(eq_attr "jal" "!unset") (const_string "call")
(eq_attr "got" "load") (const_string "load")
+ (eq_attr "alu_type" "add,sub") (const_string "arith")
+
+ (eq_attr "alu_type" "not,nor,and,or,xor") (const_string "logical")
+
;; If a doubleword move uses these expensive instructions,
;; it is usually better to schedule them in the same way
;; as the singleword form, rather than as "multi".
@@ -636,11 +515,9 @@
(symbol_ref "mips_sync_loop_insns (insn, operands) * 4")
] (const_int 4)))
-;; Attribute describing the processor. This attribute must match exactly
-;; with the processor_type enumeration in mips.h.
-(define_attr "cpu"
- "r3000,4kc,4kp,5kc,5kf,20kc,24kc,24kf2_1,24kf1_1,74kc,74kf2_1,74kf1_1,74kf3_2,loongson_2e,loongson_2f,m4k,octeon,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,r10000,sb1,sb1a,sr71000,xlr"
- (const (symbol_ref "mips_tune_attr")))
+;; Attribute describing the processor.
+(define_enum_attr "cpu" "processor"
+ (const (symbol_ref "mips_tune")))
;; The type of hardware hazard associated with this instruction.
;; DELAY means that the next instruction cannot read the result
@@ -1108,7 +985,7 @@
"@
<d>addu\t%0,%1,%2
<d>addiu\t%0,%1,%2"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "add")
(set_attr "mode" "<MODE>")])
(define_insn "*add<mode>3_mips16"
@@ -1122,7 +999,7 @@
<d>addiu\t%0,%2
<d>addiu\t%0,%1,%2
<d>addu\t%0,%1,%2"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "add")
(set_attr "mode" "<MODE>")
(set_attr_alternative "length"
[(if_then_else (match_operand 2 "m16_simm8_8")
@@ -1260,7 +1137,7 @@
"@
addu\t%0,%1,%2
addiu\t%0,%1,%2"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "add")
(set_attr "mode" "SI")])
;; Split this insn so that the addiu splitters can have a crack at it.
@@ -1275,7 +1152,7 @@
"&& reload_completed"
[(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))]
{ operands[3] = gen_lowpart (SImode, operands[0]); }
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "add")
(set_attr "mode" "SI")
(set_attr "extended_mips16" "yes")])
@@ -1289,7 +1166,7 @@
(match_operand:SI 2 "register_operand" "d")) 3)))]
"ISA_HAS_BADDU && BYTES_BIG_ENDIAN"
"baddu\\t%0,%1,%2"
- [(set_attr "type" "arith")])
+ [(set_attr "alu_type" "add")])
(define_insn "*baddu_si_el"
[(set (match_operand:SI 0 "register_operand" "=d")
@@ -1299,7 +1176,7 @@
(match_operand:SI 2 "register_operand" "d")) 0)))]
"ISA_HAS_BADDU && !BYTES_BIG_ENDIAN"
"baddu\\t%0,%1,%2"
- [(set_attr "type" "arith")])
+ [(set_attr "alu_type" "add")])
(define_insn "*baddu_di<mode>"
[(set (match_operand:GPR 0 "register_operand" "=d")
@@ -1309,7 +1186,7 @@
(match_operand:DI 2 "register_operand" "d")))))]
"ISA_HAS_BADDU && TARGET_64BIT"
"baddu\\t%0,%1,%2"
- [(set_attr "type" "arith")])
+ [(set_attr "alu_type" "add")])
;;
;; ....................
@@ -1334,7 +1211,7 @@
(match_operand:GPR 2 "register_operand" "d")))]
""
"<d>subu\t%0,%1,%2"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "sub")
(set_attr "mode" "<MODE>")])
(define_insn "*subsi3_extended"
@@ -1344,7 +1221,7 @@
(match_operand:SI 2 "register_operand" "d"))))]
"TARGET_64BIT"
"subu\t%0,%1,%2"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "sub")
(set_attr "mode" "DI")])
;;
@@ -2613,7 +2490,7 @@
else
return "subu\t%0,%.,%1";
}
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "sub")
(set_attr "mode" "SI")])
(define_insn "negdi2"
@@ -2621,7 +2498,7 @@
(neg:DI (match_operand:DI 1 "register_operand" "d")))]
"TARGET_64BIT && !TARGET_MIPS16"
"dsubu\t%0,%.,%1"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "sub")
(set_attr "mode" "DI")])
;; neg.fmt is an arithmetic instruction and treats all NaN inputs as
@@ -2646,7 +2523,7 @@
else
return "nor\t%0,%.,%1";
}
- [(set_attr "type" "logical")
+ [(set_attr "alu_type" "not")
(set_attr "mode" "<MODE>")])
;;
@@ -2768,7 +2645,7 @@
"@
or\t%0,%1,%2
ori\t%0,%1,%x2"
- [(set_attr "type" "logical")
+ [(set_attr "alu_type" "or")
(set_attr "mode" "<MODE>")])
(define_insn "*ior<mode>3_mips16"
@@ -2777,7 +2654,7 @@
(match_operand:GPR 2 "register_operand" "d")))]
"TARGET_MIPS16"
"or\t%0,%2"
- [(set_attr "type" "logical")
+ [(set_attr "alu_type" "or")
(set_attr "mode" "<MODE>")])
(define_expand "xor<mode>3"
@@ -2795,7 +2672,7 @@
"@
xor\t%0,%1,%2
xori\t%0,%1,%x2"
- [(set_attr "type" "logical")
+ [(set_attr "alu_type" "xor")
(set_attr "mode" "<MODE>")])
(define_insn ""
@@ -2807,7 +2684,7 @@
xor\t%0,%2
cmpi\t%1,%2
cmp\t%1,%2"
- [(set_attr "type" "logical,arith,arith")
+ [(set_attr "alu_type" "xor")
(set_attr "mode" "<MODE>")
(set_attr_alternative "length"
[(const_int 4)
@@ -2822,7 +2699,7 @@
(not:GPR (match_operand:GPR 2 "register_operand" "d"))))]
"!TARGET_MIPS16"
"nor\t%0,%1,%2"
- [(set_attr "type" "logical")
+ [(set_attr "alu_type" "nor")
(set_attr "mode" "<MODE>")])
;;
@@ -3040,7 +2917,7 @@
operands[2] = GEN_INT (GET_MODE_MASK (<SHORT:MODE>mode));
return "andi\t%0,%1,%x2";
}
- [(set_attr "type" "logical")
+ [(set_attr "alu_type" "and")
(set_attr "mode" "<GPR:MODE>")])
(define_insn "*zero_extendhi_truncqi"
@@ -3049,7 +2926,7 @@
(truncate:QI (match_operand:DI 1 "register_operand" "d"))))]
"TARGET_64BIT && !TARGET_MIPS16"
"andi\t%0,%1,0xff"
- [(set_attr "type" "logical")
+ [(set_attr "alu_type" "and")
(set_attr "mode" "HI")])
;;
@@ -3981,7 +3858,7 @@
(match_operand:P 2 "immediate_operand" "")))]
"!TARGET_MIPS16"
"<d>addiu\t%0,%1,%R2"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "add")
(set_attr "mode" "<MODE>")])
(define_insn "*low<mode>_mips16"
@@ -3990,7 +3867,7 @@
(match_operand:P 2 "immediate_operand" "")))]
"TARGET_MIPS16"
"<d>addiu\t%0,%R2"
- [(set_attr "type" "arith")
+ [(set_attr "alu_type" "add")
(set_attr "mode" "<MODE>")
(set_attr "extended_mips16" "yes")])
@@ -6581,3 +6458,7 @@
; ST-Microelectronics Loongson-2E/2F-specific patterns.
(include "loongson.md")
+
+(define_c_enum "unspec" [
+ UNSPEC_ADDRESS_FIRST
+])
diff --git a/gcc/config/mips/sync.md b/gcc/config/mips/sync.md
index e28f56c601a..ee41d2c9740 100644
--- a/gcc/config/mips/sync.md
+++ b/gcc/config/mips/sync.md
@@ -19,6 +19,18 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+(define_c_enum "unspec" [
+ UNSPEC_COMPARE_AND_SWAP
+ UNSPEC_COMPARE_AND_SWAP_12
+ UNSPEC_SYNC_OLD_OP
+ UNSPEC_SYNC_NEW_OP
+ UNSPEC_SYNC_NEW_OP_12
+ UNSPEC_SYNC_OLD_OP_12
+ UNSPEC_SYNC_EXCHANGE
+ UNSPEC_SYNC_EXCHANGE_12
+ UNSPEC_MEMORY_BARRIER
+])
+
;; Atomic fetch bitwise operations.
(define_code_iterator fetchop_bit [ior xor and])
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index de66ac4e40d..4b35e06df4f 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -263,7 +263,7 @@ mmix_init_expanders (void)
static struct machine_function *
mmix_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
/* DATA_ALIGNMENT.
diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h
index 2886443c66d..48551028d5b 100644
--- a/gcc/config/mmix/mmix.h
+++ b/gcc/config/mmix/mmix.h
@@ -586,8 +586,6 @@ enum reg_class
#define ACCUMULATE_OUTGOING_ARGS 1
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0
-
/* Node: Register Arguments */
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index 12e78612014..1700f1a25be 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -492,15 +492,6 @@ enum reg_class {
them whenever possible. */
#define CAN_DEBUG_WITHOUT_FP
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* We use d0/d1 for passing parameters, so allocate 8 bytes of space
for a register flushback area. */
#define REG_PARM_STACK_SPACE(DECL) 8
diff --git a/gcc/config/moxie/moxie-protos.h b/gcc/config/moxie/moxie-protos.h
index 17bb4fc7cf7..471fd99a67d 100644
--- a/gcc/config/moxie/moxie-protos.h
+++ b/gcc/config/moxie/moxie-protos.h
@@ -1,5 +1,6 @@
/* Prototypes for moxie.c functions used in the md file & elsewhere.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -21,8 +22,6 @@ extern void moxie_override_options (void);
extern void moxie_expand_prologue (void);
extern void moxie_expand_epilogue (void);
extern int moxie_initial_elimination_offset (int, int);
-extern rtx moxie_function_value (const_tree, const_tree,
- bool ATTRIBUTE_UNUSED);
extern void moxie_print_operand (FILE *, rtx, int);
extern void moxie_print_operand_address (FILE *, rtx);
#ifdef RTX_CODE
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index 1e692b18d7e..1ce7107daff 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -70,7 +70,7 @@ moxie_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
We always return values in register $r0 for moxie. */
-rtx
+static rtx
moxie_function_value (const_tree valtype,
const_tree fntype_or_decl ATTRIBUTE_UNUSED,
bool outgoing ATTRIBUTE_UNUSED)
@@ -78,6 +78,27 @@ moxie_function_value (const_tree valtype,
return gen_rtx_REG (TYPE_MODE (valtype), MOXIE_R0);
}
+/* Define how to find the value returned by a library function.
+
+ We always return values in register $r0 for moxie. */
+
+static rtx
+moxie_libcall_value (enum machine_mode mode,
+ const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode, MOXIE_R0);
+}
+
+/* Handle TARGET_FUNCTION_VALUE_REGNO_P.
+
+ We always return values in register $r0 for moxie. */
+
+static bool
+moxie_function_value_regno_p (const unsigned int regno)
+{
+ return (regno == MOXIE_R0);
+}
+
/* Emit an error message when we're in an asm, and a fatal error for
"normal" insns. Formatted output isn't easily implemented, since we
use output_operand_lossage to output the actual message and handle the
@@ -205,7 +226,7 @@ struct GTY(()) machine_function
static struct machine_function *
moxie_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
@@ -530,6 +551,10 @@ moxie_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
node node representing a data type. */
#undef TARGET_FUNCTION_VALUE
#define TARGET_FUNCTION_VALUE moxie_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE moxie_libcall_value
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P moxie_function_value_regno_p
#undef TARGET_FRAME_POINTER_REQUIRED
#define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h
index 928ca8838a7..0a53b6b7216 100644
--- a/gcc/config/moxie/moxie.h
+++ b/gcc/config/moxie/moxie.h
@@ -268,18 +268,6 @@ enum reg_class
/* How Scalar Function Values Are Returned */
-/* These macros are deprecated, but we still need them for now since
- the version of gcc we're using doesn't fully support
- TARGET_FUNCTION_VALUE. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- moxie_function_value (VALTYPE, FUNC, 0)
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- moxie_function_value (VALTYPE, FUNC, 1)
-
-/* A C expression to create an RTX representing the place where a
- library function returns a value of mode MODE. */
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 2)
-
/* STACK AND CALLING */
/* Define this macro if pushing a word onto the stack moves the stack
@@ -429,10 +417,6 @@ enum reg_class
register in which function arguments are sometimes passed. */
#define FUNCTION_ARG_REGNO_P(r) (r >= MOXIE_R0 && r <= MOXIE_R5)
-/* A C expression that is nonzero if REGNO is the number of a hard
- register in which the values of called function may come back. */
-#define FUNCTION_VALUE_REGNO_P(r) (r == MOXIE_R0)
-
/* A macro whose definition is the name of the class to which a valid
base register must belong. A base register is one used in an
address which is the register value plus a displacement. */
@@ -469,8 +453,6 @@ enum reg_class
/* All load operations zero extend. */
#define LOAD_EXTEND_OP(MEM) ZERO_EXTEND
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
/* A C expression that is nonzero if X is a legitimate constant for
an immediate operand on the target machine. */
#define LEGITIMATE_CONSTANT_P(X) 1
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 5ef405b4f44..2640f05e1bc 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -155,9 +155,9 @@ static bool pa_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
static int pa_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static struct machine_function * pa_init_machine_status (void);
-static enum reg_class pa_secondary_reload (bool, rtx, enum reg_class,
- enum machine_mode,
- secondary_reload_info *);
+static reg_class_t pa_secondary_reload (bool, rtx, reg_class_t,
+ enum machine_mode,
+ secondary_reload_info *);
static void pa_extra_live_on_entry (bitmap);
static enum machine_mode pa_promote_function_mode (const_tree,
enum machine_mode, int *,
@@ -519,6 +519,17 @@ override_options (void)
if (flag_pic == 1 || TARGET_64BIT)
flag_pic = 2;
+ /* Disable -freorder-blocks-and-partition as we don't support hot and
+ cold partitioning. */
+ if (flag_reorder_blocks_and_partition)
+ {
+ inform (input_location,
+ "-freorder-blocks-and-partition does not work "
+ "on this architecture");
+ flag_reorder_blocks_and_partition = 0;
+ flag_reorder_blocks = 1;
+ }
+
/* We can't guarantee that .dword is available for 32-bit targets. */
if (UNITS_PER_WORD == 4)
targetm.asm_out.aligned_op.di = NULL;
@@ -558,7 +569,7 @@ pa_init_builtins (void)
static struct machine_function *
pa_init_machine_status (void)
{
- return GGC_CNEW (machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
/* If FROM is a probable pointer register, mark TO as a probable
@@ -1696,10 +1707,6 @@ emit_move_sequence (rtx *operands, enum machine_mode mode, rtx scratch_reg)
&& !REG_POINTER (operand0)
&& !HARD_REGISTER_P (operand0))
copy_reg_pointer (operand0, operand1);
- else if (REG_POINTER (operand0)
- && !REG_POINTER (operand1)
- && !HARD_REGISTER_P (operand1))
- copy_reg_pointer (operand1, operand0);
}
/* When MEMs are broken out, the REG_POINTER flag doesn't
@@ -5375,13 +5382,11 @@ get_deferred_plabel (rtx symbol)
tree id;
if (deferred_plabels == 0)
- deferred_plabels = (struct deferred_plabel *)
- ggc_alloc (sizeof (struct deferred_plabel));
+ deferred_plabels = ggc_alloc_deferred_plabel ();
else
- deferred_plabels = (struct deferred_plabel *)
- ggc_realloc (deferred_plabels,
- ((n_deferred_plabels + 1)
- * sizeof (struct deferred_plabel)));
+ deferred_plabels = GGC_RESIZEVEC (struct deferred_plabel,
+ deferred_plabels,
+ n_deferred_plabels + 1);
i = n_deferred_plabels++;
deferred_plabels[i].internal_label = gen_label_rtx ();
@@ -5683,11 +5688,12 @@ output_arg_descriptor (rtx call_insn)
fputc ('\n', asm_out_file);
}
-static enum reg_class
-pa_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
+static reg_class_t
+pa_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
enum machine_mode mode, secondary_reload_info *sri)
{
int is_symbolic, regno;
+ enum reg_class rclass = (enum reg_class) rclass_i;
/* Handle the easy stuff first. */
if (rclass == R1_REGS)
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 4b10a0a3b9b..4eae700b077 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler, for the HP Spectrum.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) of Cygnus Support
and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for
@@ -222,15 +222,6 @@ do { \
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
#endif
-/* This macro defines command-line switches that modify the default
- target name.
-
- The definition is be an initializer for an array of structures. Each
- array element has have three elements: the switch name, one of the
- enumeration codes ADD or DELETE to indicate whether the string should be
- inserted or deleted, and the string to be inserted or deleted. */
-#define MODIFY_TARGET_NAME {{"-32", DELETE, "64"}, {"-64", ADD, "64"}}
-
/* Make gcc agree with <machine/ansi.h> */
#define SIZE_TYPE "unsigned int"
@@ -562,14 +553,6 @@ extern struct rtx_def *hppa_pic_save_rtx (void);
? (STACK_POINTER_OFFSET) \
: ((STACK_POINTER_OFFSET) - crtl->outgoing_args_size))
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index 733bf756c3e..15e8a545f09 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -1,6 +1,6 @@
/* Subroutines for gcc2 for pdp11.
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2004, 2005,
- 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
This file is part of GCC.
@@ -151,6 +151,9 @@ static void pdp11_output_function_prologue (FILE *, HOST_WIDE_INT);
static void pdp11_output_function_epilogue (FILE *, HOST_WIDE_INT);
static bool pdp11_rtx_costs (rtx, int, int, int *, bool);
static bool pdp11_return_in_memory (const_tree, const_tree);
+static rtx pdp11_function_value (const_tree, const_tree, bool);
+static rtx pdp11_libcall_value (enum machine_mode, const_rtx);
+static bool pdp11_function_value_regno_p (const unsigned int);
static void pdp11_trampoline_init (rtx, tree, rtx);
/* Initialize the GCC target structure. */
@@ -185,6 +188,13 @@ static void pdp11_trampoline_init (rtx, tree, rtx);
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY pdp11_return_in_memory
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE pdp11_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE pdp11_libcall_value
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P pdp11_function_value_regno_p
+
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT pdp11_trampoline_init
@@ -1744,6 +1754,40 @@ pdp11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
|| (TYPE_MODE (type) == DFmode && ! TARGET_AC0));
}
+/* Worker function for TARGET_FUNCTION_VALUE.
+
+ On the pdp11 the value is found in R0 (or ac0??? not without FPU!!!! ) */
+
+static rtx
+pdp11_function_value (const_tree valtype,
+ const_tree fntype_or_decl ATTRIBUTE_UNUSED,
+ bool outgoing ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (TYPE_MODE (valtype),
+ BASE_RETURN_VALUE_REG(TYPE_MODE(valtype)));
+}
+
+/* Worker function for TARGET_LIBCALL_VALUE. */
+
+static rtx
+pdp11_libcall_value (enum machine_mode mode,
+ const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode, BASE_RETURN_VALUE_REG(mode));
+}
+
+/* Worker function for TARGET_FUNCTION_VALUE_REGNO_P.
+
+ On the pdp, the first "output" reg is the only register thus used.
+
+ maybe ac0 ? - as option someday! */
+
+static bool
+pdp11_function_value_regno_p (const unsigned int regno)
+{
+ return (regno == 0) || (TARGET_AC0 && (regno == 8));
+}
+
/* Worker function for TARGET_TRAMPOLINE_INIT.
trampoline - how should i do it in separate i+d ?
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index a08f7239e10..006fb4cbd86 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler, for the pdp-11
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
- 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
This file is part of GCC.
@@ -435,14 +435,6 @@ extern int current_first_parm_offset;
*/
#define FIRST_PARM_OFFSET(FNDECL) 4
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
@@ -450,31 +442,6 @@ extern int current_first_parm_offset;
#define BASE_RETURN_VALUE_REG(MODE) \
((MODE) == DFmode ? 8 : 0)
-/* On the pdp11 the value is found in R0 (or ac0???
-not without FPU!!!! ) */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx_REG (TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
-
-/* and the called function leaves it in the first register.
- Difference only on machines with register windows. */
-
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- gen_rtx_REG (TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, BASE_RETURN_VALUE_REG(MODE))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
- On the pdp, the first "output" reg is the only register thus used.
-
-maybe ac0 ? - as option someday! */
-
-#define FUNCTION_VALUE_REGNO_P(N) (((N) == 0) || (TARGET_AC0 && (N) == 8))
-
/* 1 if N is a possible register number for function argument passing.
- not used on pdp */
diff --git a/gcc/config/picochip/picochip-protos.h b/gcc/config/picochip/picochip-protos.h
index 875bb1d2a31..4a80bd16d5d 100644
--- a/gcc/config/picochip/picochip-protos.h
+++ b/gcc/config/picochip/picochip-protos.h
@@ -73,9 +73,9 @@ extern int picochip_symbol_offset (rtx operand);
extern int picochip_get_function_arg_boundary (enum machine_mode mode);
-extern enum reg_class picochip_secondary_reload(bool in_p,
+extern reg_class_t picochip_secondary_reload(bool in_p,
rtx x,
- enum reg_class cla,
+ reg_class_t cla,
enum machine_mode mode,
secondary_reload_info *sri);
diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c
index 499c55d9677..2e8dbb92355 100644
--- a/gcc/config/picochip/picochip.c
+++ b/gcc/config/picochip/picochip.c
@@ -1,5 +1,5 @@
/* Subroutines used for code generation on picoChip processors.
- Copyright (C) 2001,2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by picoChip Designs Ltd. (http://www.picochip.com)
Maintained by Daniel Towner (daniel.towner@picochip.com) and
Hariharan Sandanagobalane (hariharan@picochip.com)
@@ -103,12 +103,12 @@ int picochip_legitimize_reload_address (rtx *x, enum machine_mode mode,
rtx picochip_struct_value_rtx(tree fntype ATTRIBUTE_UNUSED, int incoming ATTRIBUTE_UNUSED);
rtx picochip_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
bool outgoing ATTRIBUTE_UNUSED);
-enum reg_class
+reg_class_t
picochip_secondary_reload (bool in_p,
- rtx x ATTRIBUTE_UNUSED,
- enum reg_class cla ATTRIBUTE_UNUSED,
- enum machine_mode mode,
- secondary_reload_info *sri);
+ rtx x ATTRIBUTE_UNUSED,
+ reg_class_t cla ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ secondary_reload_info *sri);
void
picochip_asm_named_section (const char *name,
unsigned int flags ATTRIBUTE_UNUSED,
@@ -4363,12 +4363,12 @@ picochip_get_high_const (rtx value)
choice of two registers to choose from, so that we a guaranteed to
get at least one register which is different to the output
register. This trick is taken from the alpha implementation. */
-enum reg_class
+reg_class_t
picochip_secondary_reload (bool in_p,
- rtx x ATTRIBUTE_UNUSED,
- enum reg_class cla ATTRIBUTE_UNUSED,
- enum machine_mode mode,
- secondary_reload_info *sri)
+ rtx x ATTRIBUTE_UNUSED,
+ reg_class_t cla ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ secondary_reload_info *sri)
{
if (mode == QImode && !TARGET_HAS_BYTE_ACCESS)
{
diff --git a/gcc/config/picochip/picochip.h b/gcc/config/picochip/picochip.h
index 7269fa062ad..b4aec727df5 100644
--- a/gcc/config/picochip/picochip.h
+++ b/gcc/config/picochip/picochip.h
@@ -406,9 +406,6 @@ extern const enum reg_class picochip_regno_reg_class[FIRST_PSEUDO_REGISTER];
#define PUSH_ARGS 0
-/* Functions don't pop their args. */
-#define RETURN_POPS_ARGS(FNDECL, FNTYPE, STACK) 0
-
/* Passing Arguments in Registers */
/* Store the offset of the next argument. */
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index bc4f30f7cb2..5f4510adc30 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -163,6 +163,8 @@
#define vec_vpkshus __builtin_vec_vpkshus
#define vec_re __builtin_vec_re
#define vec_round __builtin_vec_round
+#define vec_recipdiv __builtin_vec_recipdiv
+#define vec_rsqrt __builtin_vec_rsqrt
#define vec_rsqrte __builtin_vec_rsqrte
#define vec_vsubfp __builtin_vec_vsubfp
#define vec_subc __builtin_vec_subc
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 6fbb7cdcdac..7bf3c660312 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -75,9 +75,7 @@
(UNSPEC_VCTSXS 154)
(UNSPEC_VLOGEFP 155)
(UNSPEC_VEXPTEFP 156)
- (UNSPEC_VRSQRTEFP 157)
- (UNSPEC_VREFP 158)
- ;; 159-162 deleted
+ ;; 157-162 deleted
(UNSPEC_VLSDOI 163)
(UNSPEC_VUPKHSB 167)
(UNSPEC_VUPKHPX 168)
@@ -141,10 +139,11 @@
(UNSPEC_VPERMHI 321)
(UNSPEC_INTERHI 322)
(UNSPEC_INTERLO 323)
- (UNSPEC_VUPKHS_V4SF 324)
- (UNSPEC_VUPKLS_V4SF 325)
- (UNSPEC_VUPKHU_V4SF 326)
- (UNSPEC_VUPKLU_V4SF 327)
+ (UNSPEC_VUPKHS_V4SF 324)
+ (UNSPEC_VUPKLS_V4SF 325)
+ (UNSPEC_VUPKHU_V4SF 326)
+ (UNSPEC_VUPKLU_V4SF 327)
+ (UNSPEC_VNMSUBFP 328)
])
(define_constants
@@ -628,11 +627,64 @@
}")
;; Fused multiply subtract
-(define_insn "altivec_vnmsubfp"
+(define_expand "altivec_vnmsubfp"
+ [(match_operand:V4SF 0 "register_operand" "")
+ (match_operand:V4SF 1 "register_operand" "")
+ (match_operand:V4SF 2 "register_operand" "")
+ (match_operand:V4SF 3 "register_operand" "")]
+ "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
+{
+ if (TARGET_FUSED_MADD && HONOR_SIGNED_ZEROS (SFmode))
+ {
+ emit_insn (gen_altivec_vnmsubfp_1 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+ else if (TARGET_FUSED_MADD && !HONOR_SIGNED_ZEROS (DFmode))
+ {
+ emit_insn (gen_altivec_vnmsubfp_2 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+ else
+ {
+ emit_insn (gen_altivec_vnmsubfp_3 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+})
+
+(define_insn "altivec_vnmsubfp_1"
[(set (match_operand:V4SF 0 "register_operand" "=v")
- (neg:V4SF (minus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
- (match_operand:V4SF 2 "register_operand" "v"))
- (match_operand:V4SF 3 "register_operand" "v"))))]
+ (neg:V4SF
+ (minus:V4SF
+ (mult:V4SF
+ (match_operand:V4SF 1 "register_operand" "v")
+ (match_operand:V4SF 2 "register_operand" "v"))
+ (match_operand:V4SF 3 "register_operand" "v"))))]
+ "VECTOR_UNIT_ALTIVEC_P (V4SFmode) && TARGET_FUSED_MADD
+ && HONOR_SIGNED_ZEROS (SFmode)"
+ "vnmsubfp %0,%1,%2,%3"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "altivec_vnmsubfp_2"
+ [(set (match_operand:V4SF 0 "register_operand" "=v")
+ (minus:V4SF
+ (match_operand:V4SF 3 "register_operand" "v")
+ (mult:V4SF
+ (match_operand:V4SF 1 "register_operand" "v")
+ (match_operand:V4SF 2 "register_operand" "v"))))]
+ "VECTOR_UNIT_ALTIVEC_P (V4SFmode) && TARGET_FUSED_MADD
+ && !HONOR_SIGNED_ZEROS (SFmode)"
+ "vnmsubfp %0,%1,%2,%3"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "altivec_vnmsubfp_3"
+ [(set (match_operand:V4SF 0 "register_operand" "=v")
+ (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
+ (match_operand:V4SF 2 "register_operand" "v")
+ (match_operand:V4SF 3 "register_operand" "v")]
+ UNSPEC_VNMSUBFP))]
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
"vnmsubfp %0,%1,%2,%3"
[(set_attr "type" "vecfloat")])
@@ -1444,19 +1496,19 @@
"vexptefp %0,%1"
[(set_attr "type" "vecfloat")])
-(define_insn "altivec_vrsqrtefp"
+(define_insn "*altivec_vrsqrtefp"
[(set (match_operand:V4SF 0 "register_operand" "=v")
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
- UNSPEC_VRSQRTEFP))]
- "TARGET_ALTIVEC"
+ UNSPEC_RSQRT))]
+ "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
"vrsqrtefp %0,%1"
[(set_attr "type" "vecfloat")])
(define_insn "altivec_vrefp"
[(set (match_operand:V4SF 0 "register_operand" "=v")
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
- UNSPEC_VREFP))]
- "TARGET_ALTIVEC"
+ UNSPEC_FRES))]
+ "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
"vrefp %0,%1"
[(set_attr "type" "vecfloat")])
diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md
index bd4a1a1b8ae..7eb991a326f 100644
--- a/gcc/config/rs6000/constraints.md
+++ b/gcc/config/rs6000/constraints.md
@@ -166,7 +166,7 @@ usually better to use @samp{m} or @samp{es} in @code{asm} statements)"
(define_constraint "R"
"AIX TOC entry"
- (match_test "legitimate_constant_pool_address_p (op)"))
+ (match_test "legitimate_constant_pool_address_p (op, false)"))
;; General constraints
diff --git a/gcc/config/rs6000/e500.h b/gcc/config/rs6000/e500.h
index 05b20ad1139..744f4de4c58 100644
--- a/gcc/config/rs6000/e500.h
+++ b/gcc/config/rs6000/e500.h
@@ -1,5 +1,5 @@
/* Enable E500 support.
- Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009 Free Software
+ Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Free Software
Foundation, Inc.
This file is part of GCC.
@@ -46,3 +46,10 @@
error ("E500 and FPRs not supported"); \
} \
} while (0)
+
+/* When setting up caller-save slots (MODE == VOIDmode) ensure we
+ allocate space for DFmode. Save gprs in the correct mode too. */
+#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
+ (TARGET_E500_DOUBLE && ((MODE) == VOIDmode || (MODE) == DFmode) \
+ ? DFmode \
+ : choose_hard_reg_mode ((REGNO), (NREGS), false))
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 39d440a01c3..900570f2ea1 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -63,6 +63,16 @@ extern int dot_symbols;
#define TARGET_PROFILE_KERNEL profile_kernel
+#define TARGET_USES_LINUX64_OPT 1
+#ifdef HAVE_LD_LARGE_TOC
+extern enum rs6000_cmodel cmodel;
+#undef TARGET_CMODEL
+#define TARGET_CMODEL cmodel
+#define SET_CMODEL(opt) cmodel = opt
+#else
+#define SET_CMODEL(opt) do {} while (0)
+#endif
+
#undef PROCESSOR_DEFAULT
#define PROCESSOR_DEFAULT PROCESSOR_POWER6
#undef PROCESSOR_DEFAULT64
@@ -114,6 +124,23 @@ extern int dot_symbols;
target_flags |= MASK_POWERPC64; \
error ("-m64 requires a PowerPC64 cpu"); \
} \
+ if ((target_flags_explicit & MASK_MINIMAL_TOC) != 0) \
+ { \
+ if (rs6000_explicit_options.cmodel \
+ && cmodel != CMODEL_SMALL) \
+ error ("-mcmodel incompatible with other toc options"); \
+ SET_CMODEL (CMODEL_SMALL); \
+ } \
+ else \
+ { \
+ if (!rs6000_explicit_options.cmodel) \
+ SET_CMODEL (CMODEL_LARGE); \
+ if (cmodel != CMODEL_SMALL) \
+ { \
+ TARGET_NO_FP_IN_TOC = 0; \
+ TARGET_NO_SUM_IN_TOC = 0; \
+ } \
+ } \
} \
else \
{ \
@@ -124,6 +151,11 @@ extern int dot_symbols;
TARGET_PROFILE_KERNEL = 0; \
error (INVALID_32BIT, "profile-kernel"); \
} \
+ if (rs6000_explicit_options.cmodel) \
+ { \
+ SET_CMODEL (CMODEL_SMALL); \
+ error (INVALID_32BIT, "cmodel"); \
+ } \
} \
} \
while (0)
diff --git a/gcc/config/rs6000/linux64.opt b/gcc/config/rs6000/linux64.opt
index 0d52820691c..9d0e26ace33 100644
--- a/gcc/config/rs6000/linux64.opt
+++ b/gcc/config/rs6000/linux64.opt
@@ -22,3 +22,7 @@
mprofile-kernel
Target Report Var(profile_kernel)
Call mcount for profiling before a function prologue
+
+mcmodel=
+Target RejectNegative Joined
+Select code model
diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index b4de82b6612..c94af469fcd 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -837,7 +837,7 @@
return 1;
/* A SYMBOL_REF referring to the TOC is valid. */
- if (legitimate_constant_pool_address_p (op))
+ if (legitimate_constant_pool_address_p (op, false))
return 1;
/* A constant pool expression (relative to the TOC) is valid */
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index 7c5619a8e14..9f45a72e2c0 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -159,6 +159,7 @@ RS6000_BUILTIN(ALTIVEC_BUILTIN_VRFIZ, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VRLB, RS6000_BTC_CONST)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VRLH, RS6000_BTC_CONST)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VRLW, RS6000_BTC_CONST)
+RS6000_BUILTIN(ALTIVEC_BUILTIN_VRSQRTFP, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VRSQRTEFP, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLB, RS6000_BTC_CONST)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLH, RS6000_BTC_CONST)
@@ -269,6 +270,7 @@ RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXT_V8HI, RS6000_BTC_CONST)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXT_V16QI, RS6000_BTC_CONST)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXT_V4SF, RS6000_BTC_CONST)
RS6000_BUILTIN(ALTIVEC_BUILTIN_COPYSIGN_V4SF, RS6000_BTC_CONST)
+RS6000_BUILTIN(ALTIVEC_BUILTIN_VRECIPFP, RS6000_BTC_FP_PURE)
/* Altivec overloaded builtins. */
/* For now, don't set the classification for overloaded functions.
@@ -351,10 +353,12 @@ RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PACKS, RS6000_BTC_MISC)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PACKSU, RS6000_BTC_MISC)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PERM, RS6000_BTC_MISC)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RE, RS6000_BTC_MISC)
+RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RECIP, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RL, RS6000_BTC_MISC)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RINT, RS6000_BTC_MISC)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ROUND, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RSQRTE, RS6000_BTC_MISC)
+RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RSQRT, RS6000_BTC_FP_PURE)
+RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RSQRTE, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SEL, RS6000_BTC_MISC)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SL, RS6000_BTC_MISC)
RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SLD, RS6000_BTC_MISC)
@@ -959,6 +963,10 @@ RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEL_V2DF, RS6000_BTC_CONST)
RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEL_V2DI, RS6000_BTC_CONST)
RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEH_V2DF, RS6000_BTC_CONST)
RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEH_V2DI, RS6000_BTC_CONST)
+RS6000_BUILTIN(VSX_BUILTIN_VEC_RSQRT_V4SF, RS6000_BTC_FP_PURE)
+RS6000_BUILTIN(VSX_BUILTIN_VEC_RSQRT_V2DF, RS6000_BTC_FP_PURE)
+RS6000_BUILTIN(VSX_BUILTIN_RECIP_V4SF, RS6000_BTC_FP_PURE)
+RS6000_BUILTIN(VSX_BUILTIN_RECIP_V2DF, RS6000_BTC_FP_PURE)
/* VSX overloaded builtins, add the overloaded functions not present in
Altivec. */
@@ -991,4 +999,5 @@ RS6000_BUILTIN(POWER7_BUILTIN_BPERMD, RS6000_BTC_CONST)
RS6000_BUILTIN(RS6000_BUILTIN_RECIP, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(RS6000_BUILTIN_RECIPF, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(RS6000_BUILTIN_RSQRTF, RS6000_BTC_FP_PURE)
+RS6000_BUILTIN(RS6000_BUILTIN_RSQRT, RS6000_BTC_FP_PURE)
RS6000_BUILTIN(RS6000_BUILTIN_BSWAP_HI, RS6000_BTC_CONST)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index ac11336aee9..20f594a33e9 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -27,8 +27,8 @@
#include "tm.h"
#include "cpplib.h"
#include "tree.h"
-#include "c-common.h"
-#include "c-pragma.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
#include "toplev.h"
#include "tm_p.h"
#include "target.h"
@@ -362,6 +362,16 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("__builtin_vsx_xvnmsubasp=__builtin_vsx_xvnmsubsp");
builtin_define ("__builtin_vsx_xvnmsubmsp=__builtin_vsx_xvnmsubsp");
}
+ if (RS6000_RECIP_HAVE_RE_P (DFmode))
+ builtin_define ("__RECIP__");
+ if (RS6000_RECIP_HAVE_RE_P (SFmode))
+ builtin_define ("__RECIPF__");
+ if (RS6000_RECIP_HAVE_RSQRTE_P (DFmode))
+ builtin_define ("__RSQRTE__");
+ if (RS6000_RECIP_HAVE_RSQRTE_P (SFmode))
+ builtin_define ("__RSQRTEF__");
+ if (TARGET_RECIP_PRECISION)
+ builtin_define ("__RECIP_PRECISION__");
/* Tell users they can use __builtin_bswap{16,64}. */
builtin_define ("__HAVE_BSWAP__");
@@ -479,10 +489,22 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_void, RS6000_BTI_bool_V16QI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_RE, ALTIVEC_BUILTIN_VREFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_RE, VSX_BUILTIN_XVREDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ROUND, ALTIVEC_BUILTIN_VRFIN,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_RECIP, ALTIVEC_BUILTIN_VRECIPFP,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_RECIP, VSX_BUILTIN_RECIP_V2DF,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
+ { ALTIVEC_BUILTIN_VEC_RSQRT, ALTIVEC_BUILTIN_VRSQRTFP,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_RSQRT, VSX_BUILTIN_VEC_RSQRT_V2DF,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_RSQRTE, ALTIVEC_BUILTIN_VRSQRTEFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_RSQRTE, VSX_BUILTIN_XVRSQRTEDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_TRUNC, ALTIVEC_BUILTIN_VRFIZ,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_TRUNC, VSX_BUILTIN_XVRDPIZ,
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 43ed634495b..9e978bdae89 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -39,7 +39,7 @@ extern int small_data_operand (rtx, enum machine_mode);
extern bool toc_relative_expr_p (rtx);
extern bool invalid_e500_subreg (rtx, enum machine_mode);
extern void validate_condition_mode (enum rtx_code, enum machine_mode);
-extern bool legitimate_constant_pool_address_p (rtx);
+extern bool legitimate_constant_pool_address_p (const_rtx, bool);
extern bool legitimate_indirect_address_p (rtx, int);
extern bool legitimate_indexed_address_p (rtx, int);
extern bool avoiding_indexed_address_p (enum machine_mode);
@@ -106,13 +106,12 @@ extern void rs6000_split_compare_and_swap (rtx, rtx, rtx, rtx, rtx);
extern void rs6000_expand_compare_and_swapqhi (rtx, rtx, rtx, rtx);
extern void rs6000_split_compare_and_swapqhi (rtx, rtx, rtx, rtx, rtx, rtx);
extern void rs6000_split_lock_test_and_set (rtx, rtx, rtx, rtx);
-extern void rs6000_emit_swdivsf (rtx, rtx, rtx);
-extern void rs6000_emit_swdivdf (rtx, rtx, rtx);
-extern void rs6000_emit_swrsqrtsf (rtx, rtx);
+extern void rs6000_emit_swdiv (rtx, rtx, rtx, bool);
+extern void rs6000_emit_swrsqrt (rtx, rtx);
extern void output_toc (FILE *, rtx, int, enum machine_mode);
extern rtx rs6000_longcall_ref (rtx);
extern void rs6000_fatal_bad_address (rtx);
-extern rtx create_TOC_reference (rtx);
+extern rtx create_TOC_reference (rtx, rtx);
extern void rs6000_split_multireg_move (rtx, rtx);
extern void rs6000_emit_move (rtx, rtx, enum machine_mode);
extern rtx rs6000_secondary_memory_needed_rtx (enum machine_mode);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a7434ca5257..36187c95cd5 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -279,6 +279,9 @@ static GTY(()) section *toc_section;
/* String from -malign-XXXXX. */
int rs6000_alignment_flags;
+/* Code model for 64-bit linux. */
+enum rs6000_cmodel cmodel;
+
/* True for any options that were explicitly set. */
static struct {
bool aix_struct_ret; /* True if -maix-struct-ret was used. */
@@ -290,6 +293,7 @@ static struct {
bool long_double; /* True if -mlong-double- was used. */
bool ieee; /* True if -mabi=ieee/ibmlongdouble used. */
bool vrsave; /* True if -mvrsave was used. */
+ bool cmodel; /* True if -mcmodel was used. */
} rs6000_explicit_options;
struct builtin_description
@@ -316,6 +320,61 @@ int rs6000_vector_align[NUM_MACHINE_MODES];
/* Map selected modes to types for builtins. */
static GTY(()) tree builtin_mode_to_type[MAX_MACHINE_MODE][2];
+
+/* What modes to automatically generate reciprocal divide estimate (fre) and
+ reciprocal sqrt (frsqrte) for. */
+unsigned char rs6000_recip_bits[MAX_MACHINE_MODE];
+
+/* Masks to determine which reciprocal esitmate instructions to generate
+ automatically. */
+enum rs6000_recip_mask {
+ RECIP_SF_DIV = 0x001, /* Use divide estimate */
+ RECIP_DF_DIV = 0x002,
+ RECIP_V4SF_DIV = 0x004,
+ RECIP_V2DF_DIV = 0x008,
+
+ RECIP_SF_RSQRT = 0x010, /* Use reciprocal sqrt estimate. */
+ RECIP_DF_RSQRT = 0x020,
+ RECIP_V4SF_RSQRT = 0x040,
+ RECIP_V2DF_RSQRT = 0x080,
+
+ /* Various combination of flags for -mrecip=xxx. */
+ RECIP_NONE = 0,
+ RECIP_ALL = (RECIP_SF_DIV | RECIP_DF_DIV | RECIP_V4SF_DIV
+ | RECIP_V2DF_DIV | RECIP_SF_RSQRT | RECIP_DF_RSQRT
+ | RECIP_V4SF_RSQRT | RECIP_V2DF_RSQRT),
+
+ RECIP_HIGH_PRECISION = RECIP_ALL,
+
+ /* On low precision machines like the power5, don't enable double precision
+ reciprocal square root estimate, since it isn't accurate enough. */
+ RECIP_LOW_PRECISION = (RECIP_ALL & ~(RECIP_DF_RSQRT | RECIP_V2DF_RSQRT))
+};
+
+static unsigned int rs6000_recip_control;
+static const char *rs6000_recip_name;
+
+/* -mrecip options. */
+static struct
+{
+ const char *string; /* option name */
+ unsigned int mask; /* mask bits to set */
+} recip_options[] = {
+ { "all", RECIP_ALL },
+ { "none", RECIP_NONE },
+ { "div", (RECIP_SF_DIV | RECIP_DF_DIV | RECIP_V4SF_DIV
+ | RECIP_V2DF_DIV) },
+ { "divf", (RECIP_SF_DIV | RECIP_V4SF_DIV) },
+ { "divd", (RECIP_DF_DIV | RECIP_V2DF_DIV) },
+ { "rsqrt", (RECIP_SF_RSQRT | RECIP_DF_RSQRT | RECIP_V4SF_RSQRT
+ | RECIP_V2DF_RSQRT) },
+ { "rsqrtf", (RECIP_SF_RSQRT | RECIP_V4SF_RSQRT) },
+ { "rsqrtd", (RECIP_DF_RSQRT | RECIP_V2DF_RSQRT) },
+};
+
+/* 2 argument gen function typedef. */
+typedef rtx (*gen_2arg_fn_t) (rtx, rtx, rtx);
+
/* Target cpu costs. */
@@ -779,6 +838,25 @@ struct processor_costs ppce500mc64_cost = {
1, /* prefetch streams /*/
};
+/* Instruction costs on AppliedMicro Titan processors. */
+static const
+struct processor_costs titan_cost = {
+ COSTS_N_INSNS (5), /* mulsi */
+ COSTS_N_INSNS (5), /* mulsi_const */
+ COSTS_N_INSNS (5), /* mulsi_const9 */
+ COSTS_N_INSNS (5), /* muldi */
+ COSTS_N_INSNS (18), /* divsi */
+ COSTS_N_INSNS (18), /* divdi */
+ COSTS_N_INSNS (10), /* fp */
+ COSTS_N_INSNS (10), /* dmul */
+ COSTS_N_INSNS (46), /* sdiv */
+ COSTS_N_INSNS (72), /* ddiv */
+ 32, /* cache line size */
+ 32, /* l1 cache */
+ 512, /* l2 cache */
+ 1, /* prefetch streams /*/
+};
+
/* Instruction costs on POWER4 and POWER5 processors. */
static const
struct processor_costs power4_cost = {
@@ -1162,11 +1240,11 @@ bool (*rs6000_cannot_change_mode_class_ptr) (enum machine_mode,
enum reg_class)
= rs6000_cannot_change_mode_class;
-static enum reg_class rs6000_secondary_reload (bool, rtx, enum reg_class,
- enum machine_mode,
- struct secondary_reload_info *);
+static reg_class_t rs6000_secondary_reload (bool, rtx, reg_class_t,
+ enum machine_mode,
+ struct secondary_reload_info *);
-static const enum reg_class *rs6000_ira_cover_classes (void);
+static const reg_class_t *rs6000_ira_cover_classes (void);
const int INSN_NOT_AVAILABLE = -1;
static enum machine_mode rs6000_eh_return_filter_mode (void);
@@ -1384,11 +1462,11 @@ static const struct attribute_spec rs6000_attribute_table[] =
#define TARGET_VECTORIZE_BUILTIN_CONVERSION rs6000_builtin_conversion
#undef TARGET_VECTORIZE_BUILTIN_VEC_PERM
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM rs6000_builtin_vec_perm
-#undef TARGET_SUPPORT_VECTOR_MISALIGNMENT
-#define TARGET_SUPPORT_VECTOR_MISALIGNMENT \
+#undef TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
+#define TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT \
rs6000_builtin_support_vector_misalignment
-#undef TARGET_VECTOR_ALIGNMENT_REACHABLE
-#define TARGET_VECTOR_ALIGNMENT_REACHABLE rs6000_vector_alignment_reachable
+#undef TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
+#define TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE rs6000_vector_alignment_reachable
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS rs6000_init_builtins
@@ -1807,6 +1885,27 @@ rs6000_debug_reg_global (void)
if (nl)
fputs (nl, stderr);
+ if (rs6000_recip_control)
+ {
+ fprintf (stderr, "\nReciprocal mask = 0x%x\n", rs6000_recip_control);
+
+ for (m = 0; m < NUM_MACHINE_MODES; ++m)
+ if (rs6000_recip_bits[m])
+ {
+ fprintf (stderr,
+ "Reciprocal estimate mode: %-5s divide: %s rsqrt: %s\n",
+ GET_MODE_NAME (m),
+ (RS6000_RECIP_AUTO_RE_P (m)
+ ? "auto"
+ : (RS6000_RECIP_HAVE_RE_P (m) ? "have" : "none")),
+ (RS6000_RECIP_AUTO_RSQRTE_P (m)
+ ? "auto"
+ : (RS6000_RECIP_HAVE_RSQRTE_P (m) ? "have" : "none")));
+ }
+
+ fputs ("\n", stderr);
+ }
+
switch (rs6000_sched_costly_dep)
{
case max_dep_latency:
@@ -2014,8 +2113,9 @@ rs6000_init_hard_regno_mode_ok (void)
rs6000_constraints[RS6000_CONSTRAINT_wa] = VSX_REGS;
rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS;
rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS;
- if (TARGET_VSX_SCALAR_DOUBLE)
- rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS;
+ rs6000_constraints[RS6000_CONSTRAINT_ws] = (TARGET_VSX_SCALAR_MEMORY
+ ? VSX_REGS
+ : FLOAT_REGS);
}
if (TARGET_ALTIVEC)
@@ -2093,8 +2193,111 @@ rs6000_init_hard_regno_mode_ok (void)
if (TARGET_E500_DOUBLE)
rs6000_class_max_nregs[DFmode][GENERAL_REGS] = 1;
+ /* Calculate which modes to automatically generate code to use a the
+ reciprocal divide and square root instructions. In the future, possibly
+ automatically generate the instructions even if the user did not specify
+ -mrecip. The older machines double precision reciprocal sqrt estimate is
+ not accurate enough. */
+ memset (rs6000_recip_bits, 0, sizeof (rs6000_recip_bits));
+ if (TARGET_FRES)
+ rs6000_recip_bits[SFmode] = RS6000_RECIP_MASK_HAVE_RE;
+ if (TARGET_FRE)
+ rs6000_recip_bits[DFmode] = RS6000_RECIP_MASK_HAVE_RE;
+ if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode))
+ rs6000_recip_bits[V4SFmode] = RS6000_RECIP_MASK_HAVE_RE;
+ if (VECTOR_UNIT_VSX_P (V2DFmode))
+ rs6000_recip_bits[V2DFmode] = RS6000_RECIP_MASK_HAVE_RE;
+
+ if (TARGET_FRSQRTES)
+ rs6000_recip_bits[SFmode] |= RS6000_RECIP_MASK_HAVE_RSQRTE;
+ if (TARGET_FRSQRTE)
+ rs6000_recip_bits[DFmode] |= RS6000_RECIP_MASK_HAVE_RSQRTE;
+ if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode))
+ rs6000_recip_bits[V4SFmode] |= RS6000_RECIP_MASK_HAVE_RSQRTE;
+ if (VECTOR_UNIT_VSX_P (V2DFmode))
+ rs6000_recip_bits[V2DFmode] |= RS6000_RECIP_MASK_HAVE_RSQRTE;
+
+ if (rs6000_recip_control)
+ {
+ if (!TARGET_FUSED_MADD)
+ warning (0, "-mrecip requires -mfused-madd");
+ if (!flag_finite_math_only)
+ warning (0, "-mrecip requires -ffinite-math or -ffast-math");
+ if (flag_trapping_math)
+ warning (0, "-mrecip requires -fno-trapping-math or -ffast-math");
+ if (!flag_reciprocal_math)
+ warning (0, "-mrecip requires -freciprocal-math or -ffast-math");
+ if (TARGET_FUSED_MADD && flag_finite_math_only && !flag_trapping_math
+ && flag_reciprocal_math)
+ {
+ if (RS6000_RECIP_HAVE_RE_P (SFmode)
+ && (rs6000_recip_control & RECIP_SF_DIV) != 0)
+ rs6000_recip_bits[SFmode] |= RS6000_RECIP_MASK_AUTO_RE;
+
+ if (RS6000_RECIP_HAVE_RE_P (DFmode)
+ && (rs6000_recip_control & RECIP_DF_DIV) != 0)
+ rs6000_recip_bits[DFmode] |= RS6000_RECIP_MASK_AUTO_RE;
+
+ if (RS6000_RECIP_HAVE_RE_P (V4SFmode)
+ && (rs6000_recip_control & RECIP_V4SF_DIV) != 0)
+ rs6000_recip_bits[V4SFmode] |= RS6000_RECIP_MASK_AUTO_RE;
+
+ if (RS6000_RECIP_HAVE_RE_P (V2DFmode)
+ && (rs6000_recip_control & RECIP_V2DF_DIV) != 0)
+ rs6000_recip_bits[V2DFmode] |= RS6000_RECIP_MASK_AUTO_RE;
+
+ if (RS6000_RECIP_HAVE_RSQRTE_P (SFmode)
+ && (rs6000_recip_control & RECIP_SF_RSQRT) != 0)
+ rs6000_recip_bits[SFmode] |= RS6000_RECIP_MASK_AUTO_RSQRTE;
+
+ if (RS6000_RECIP_HAVE_RSQRTE_P (DFmode)
+ && (rs6000_recip_control & RECIP_DF_RSQRT) != 0)
+ rs6000_recip_bits[DFmode] |= RS6000_RECIP_MASK_AUTO_RSQRTE;
+
+ if (RS6000_RECIP_HAVE_RSQRTE_P (V4SFmode)
+ && (rs6000_recip_control & RECIP_V4SF_RSQRT) != 0)
+ rs6000_recip_bits[V4SFmode] |= RS6000_RECIP_MASK_AUTO_RSQRTE;
+
+ if (RS6000_RECIP_HAVE_RSQRTE_P (V2DFmode)
+ && (rs6000_recip_control & RECIP_V2DF_RSQRT) != 0)
+ rs6000_recip_bits[V2DFmode] |= RS6000_RECIP_MASK_AUTO_RSQRTE;
+ }
+ }
+
if (TARGET_DEBUG_REG)
rs6000_debug_reg_global ();
+
+ if (TARGET_DEBUG_COST || TARGET_DEBUG_REG)
+ fprintf (stderr,
+ "SImode variable mult cost = %d\n"
+ "SImode constant mult cost = %d\n"
+ "SImode short constant mult cost = %d\n"
+ "DImode multipliciation cost = %d\n"
+ "SImode division cost = %d\n"
+ "DImode division cost = %d\n"
+ "Simple fp operation cost = %d\n"
+ "DFmode multiplication cost = %d\n"
+ "SFmode division cost = %d\n"
+ "DFmode division cost = %d\n"
+ "cache line size = %d\n"
+ "l1 cache size = %d\n"
+ "l2 cache size = %d\n"
+ "simultaneous prefetches = %d\n"
+ "\n",
+ rs6000_cost->mulsi,
+ rs6000_cost->mulsi_const,
+ rs6000_cost->mulsi_const9,
+ rs6000_cost->muldi,
+ rs6000_cost->divsi,
+ rs6000_cost->divdi,
+ rs6000_cost->fp,
+ rs6000_cost->dmul,
+ rs6000_cost->sdiv,
+ rs6000_cost->ddiv,
+ rs6000_cost->cache_line_size,
+ rs6000_cost->l1_cache_size,
+ rs6000_cost->l2_cache_size,
+ rs6000_cost->simultaneous_prefetches);
}
#if TARGET_MACHO
@@ -2255,6 +2458,8 @@ rs6000_override_options (const char *default_cpu)
{"G4", PROCESSOR_PPC7450, POWERPC_7400_MASK},
{"G5", PROCESSOR_POWER4,
POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
+ {"titan", PROCESSOR_TITAN,
+ POWERPC_BASE_MASK | MASK_MULHW | MASK_DLMZB},
{"power", PROCESSOR_POWER, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
{"power2", PROCESSOR_POWER,
MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING},
@@ -2271,15 +2476,16 @@ rs6000_override_options (const char *default_cpu)
| MASK_MFCRF | MASK_POPCNTB | MASK_FPRND},
{"power6", PROCESSOR_POWER6,
POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_PPC_GFXOPT
- | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP},
+ | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP
+ | MASK_RECIP_PRECISION},
{"power6x", PROCESSOR_POWER6,
POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_PPC_GFXOPT
| MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP
- | MASK_MFPGPR},
+ | MASK_MFPGPR | MASK_RECIP_PRECISION},
{"power7", PROCESSOR_POWER7,
POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
| MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD
- | MASK_VSX}, /* Don't add MASK_ISEL by default */
+ | MASK_VSX| MASK_RECIP_PRECISION}, /* Don't add MASK_ISEL by default */
{"powerpc", PROCESSOR_POWERPC, POWERPC_BASE_MASK},
{"powerpc64", PROCESSOR_POWERPC64,
POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
@@ -2307,7 +2513,24 @@ rs6000_override_options (const char *default_cpu)
| MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_ALTIVEC
| MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_MULHW
| MASK_DLMZB | MASK_CMPB | MASK_MFPGPR | MASK_DFP
- | MASK_POPCNTD | MASK_VSX | MASK_ISEL | MASK_NO_UPDATE)
+ | MASK_POPCNTD | MASK_VSX | MASK_ISEL | MASK_NO_UPDATE
+ | MASK_RECIP_PRECISION)
+ };
+
+ /* Masks for instructions set at various powerpc ISAs. */
+ enum {
+ ISA_2_1_MASKS = MASK_MFCRF,
+ ISA_2_2_MASKS = (ISA_2_1_MASKS | MASK_POPCNTB | MASK_FPRND),
+
+ /* For ISA 2.05, do not add MFPGPR, since it isn't in ISA 2.06, and
+ don't add ALTIVEC, since in general it isn't a win on power6. */
+ ISA_2_5_MASKS = (ISA_2_2_MASKS | MASK_CMPB | MASK_RECIP_PRECISION
+ | MASK_DFP),
+
+ /* For ISA 2.06, don't add ISEL, since in general it isn't a win, but
+ altivec is a win so enable it. */
+ ISA_2_6_MASKS = (ISA_2_5_MASKS | MASK_ALTIVEC | MASK_POPCNTD
+ | MASK_VSX | MASK_RECIP_PRECISION)
};
/* Numerous experiment shows that IRA based loop pressure
@@ -2449,10 +2672,17 @@ rs6000_override_options (const char *default_cpu)
warning (0, msg);
target_flags &= ~ MASK_VSX;
}
- else if (TARGET_VSX && !TARGET_ALTIVEC)
- target_flags |= MASK_ALTIVEC;
}
+ /* For the newer switches (vsx, dfp, etc.) set some of the older options,
+ unless the user explicitly used the -mno-<option> to disable the code. */
+ if (TARGET_VSX)
+ target_flags |= (ISA_2_6_MASKS & (target_flags_explicit & ~ISA_2_6_MASKS));
+ else if (TARGET_DFP)
+ target_flags |= (ISA_2_5_MASKS & (target_flags_explicit & ~ISA_2_5_MASKS));
+ else if (TARGET_ALTIVEC)
+ target_flags |= (MASK_PPC_GFXOPT & (target_flags_explicit & ~MASK_PPC_GFXOPT));
+
/* Set debug flags */
if (rs6000_debug_name)
{
@@ -2673,6 +2903,12 @@ rs6000_override_options (const char *default_cpu)
if (!rs6000_explicit_options.aix_struct_ret)
aix_struct_return = (DEFAULT_ABI != ABI_V4 || DRAFT_V4_STRUCT_RET);
+#if 0
+ /* IBM XL compiler defaults to unsigned bitfields. */
+ if (TARGET_XL_COMPAT)
+ flag_signed_bitfields = 0;
+#endif
+
if (TARGET_LONG_DOUBLE_128 && !TARGET_IEEEQUAD)
REAL_MODE_FORMAT (TFmode) = &ibm_extended_format;
@@ -2690,8 +2926,10 @@ rs6000_override_options (const char *default_cpu)
/* Set branch target alignment, if not optimizing for size. */
if (!optimize_size)
{
- /* Cell wants to be aligned 8byte for dual issue. */
- if (rs6000_cpu == PROCESSOR_CELL)
+ /* Cell wants to be aligned 8byte for dual issue. Titan wants to be
+ aligned 8byte to avoid misprediction by the branch predictor. */
+ if (rs6000_cpu == PROCESSOR_TITAN
+ || rs6000_cpu == PROCESSOR_CELL)
{
if (align_functions <= 0)
align_functions = 8;
@@ -2815,6 +3053,10 @@ rs6000_override_options (const char *default_cpu)
rs6000_cost = &ppce500mc64_cost;
break;
+ case PROCESSOR_TITAN:
+ rs6000_cost = &titan_cost;
+ break;
+
case PROCESSOR_POWER4:
case PROCESSOR_POWER5:
rs6000_cost = &power4_cost;
@@ -2875,6 +3117,52 @@ rs6000_override_options (const char *default_cpu)
the DERAT mispredict penalty. */
TARGET_AVOID_XFORM = (rs6000_cpu == PROCESSOR_POWER6 && TARGET_CMPB);
+ /* Set the -mrecip options. */
+ if (rs6000_recip_name)
+ {
+ char *p = ASTRDUP (rs6000_recip_name);
+ char *q;
+ unsigned int mask, i;
+ bool invert;
+
+ while ((q = strtok (p, ",")) != NULL)
+ {
+ p = NULL;
+ if (*q == '!')
+ {
+ invert = true;
+ q++;
+ }
+ else
+ invert = false;
+
+ if (!strcmp (q, "default"))
+ mask = ((TARGET_RECIP_PRECISION)
+ ? RECIP_HIGH_PRECISION : RECIP_LOW_PRECISION);
+ else
+ {
+ for (i = 0; i < ARRAY_SIZE (recip_options); i++)
+ if (!strcmp (q, recip_options[i].string))
+ {
+ mask = recip_options[i].mask;
+ break;
+ }
+
+ if (i == ARRAY_SIZE (recip_options))
+ {
+ error ("Unknown option for -mrecip=%s", q);
+ invert = false;
+ mask = 0;
+ }
+ }
+
+ if (invert)
+ rs6000_recip_control &= ~mask;
+ else
+ rs6000_recip_control |= mask;
+ }
+ }
+
rs6000_init_hard_regno_mode_ok ();
}
@@ -3191,12 +3479,10 @@ rs6000_builtin_vectorized_function (tree fndecl, tree type_out,
{
enum machine_mode in_mode, out_mode;
int in_n, out_n;
- enum built_in_function fn = DECL_FUNCTION_CODE (fndecl);
if (TREE_CODE (type_out) != VECTOR_TYPE
|| TREE_CODE (type_in) != VECTOR_TYPE
- || !TARGET_VECTORIZE_BUILTINS
- || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
+ || !TARGET_VECTORIZE_BUILTINS)
return NULL_TREE;
out_mode = TYPE_MODE (TREE_TYPE (type_out));
@@ -3204,111 +3490,151 @@ rs6000_builtin_vectorized_function (tree fndecl, tree type_out,
in_mode = TYPE_MODE (TREE_TYPE (type_in));
in_n = TYPE_VECTOR_SUBPARTS (type_in);
- switch (fn)
+ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
{
- case BUILT_IN_COPYSIGN:
- if (VECTOR_UNIT_VSX_P (V2DFmode)
- && out_mode == DFmode && out_n == 2
- && in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_CPSGNDP];
- break;
- case BUILT_IN_COPYSIGNF:
- if (out_mode != SFmode || out_n != 4
- || in_mode != SFmode || in_n != 4)
- break;
- if (VECTOR_UNIT_VSX_P (V4SFmode))
- return rs6000_builtin_decls[VSX_BUILTIN_CPSGNSP];
- if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
- return rs6000_builtin_decls[ALTIVEC_BUILTIN_COPYSIGN_V4SF];
- break;
- case BUILT_IN_SQRT:
- if (VECTOR_UNIT_VSX_P (V2DFmode)
- && out_mode == DFmode && out_n == 2
- && in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_XVSQRTDP];
- break;
- case BUILT_IN_SQRTF:
- if (VECTOR_UNIT_VSX_P (V4SFmode)
- && out_mode == SFmode && out_n == 4
- && in_mode == SFmode && in_n == 4)
- return rs6000_builtin_decls[VSX_BUILTIN_XVSQRTSP];
- break;
- case BUILT_IN_CEIL:
- if (VECTOR_UNIT_VSX_P (V2DFmode)
- && out_mode == DFmode && out_n == 2
- && in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIP];
- break;
- case BUILT_IN_CEILF:
- if (out_mode != SFmode || out_n != 4
- || in_mode != SFmode || in_n != 4)
- break;
- if (VECTOR_UNIT_VSX_P (V4SFmode))
- return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIP];
- if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
- return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIP];
- break;
- case BUILT_IN_FLOOR:
- if (VECTOR_UNIT_VSX_P (V2DFmode)
- && out_mode == DFmode && out_n == 2
- && in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIM];
- break;
- case BUILT_IN_FLOORF:
- if (out_mode != SFmode || out_n != 4
- || in_mode != SFmode || in_n != 4)
- break;
- if (VECTOR_UNIT_VSX_P (V4SFmode))
- return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIM];
- if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
- return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIM];
- break;
- case BUILT_IN_TRUNC:
- if (VECTOR_UNIT_VSX_P (V2DFmode)
- && out_mode == DFmode && out_n == 2
- && in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIZ];
- break;
- case BUILT_IN_TRUNCF:
- if (out_mode != SFmode || out_n != 4
- || in_mode != SFmode || in_n != 4)
- break;
- if (VECTOR_UNIT_VSX_P (V4SFmode))
- return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIZ];
- if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
- return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIZ];
- break;
- case BUILT_IN_NEARBYINT:
- if (VECTOR_UNIT_VSX_P (V2DFmode)
- && flag_unsafe_math_optimizations
- && out_mode == DFmode && out_n == 2
- && in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_XVRDPI];
- break;
- case BUILT_IN_NEARBYINTF:
- if (VECTOR_UNIT_VSX_P (V4SFmode)
- && flag_unsafe_math_optimizations
- && out_mode == SFmode && out_n == 4
- && in_mode == SFmode && in_n == 4)
- return rs6000_builtin_decls[VSX_BUILTIN_XVRSPI];
- break;
- case BUILT_IN_RINT:
- if (VECTOR_UNIT_VSX_P (V2DFmode)
- && !flag_trapping_math
- && out_mode == DFmode && out_n == 2
- && in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIC];
- break;
- case BUILT_IN_RINTF:
- if (VECTOR_UNIT_VSX_P (V4SFmode)
- && !flag_trapping_math
- && out_mode == SFmode && out_n == 4
- && in_mode == SFmode && in_n == 4)
- return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIC];
- break;
- default:
- break;
+ enum built_in_function fn = DECL_FUNCTION_CODE (fndecl);
+ switch (fn)
+ {
+ case BUILT_IN_COPYSIGN:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_CPSGNDP];
+ break;
+ case BUILT_IN_COPYSIGNF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_CPSGNSP];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_COPYSIGN_V4SF];
+ break;
+ case BUILT_IN_SQRT:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVSQRTDP];
+ break;
+ case BUILT_IN_SQRTF:
+ if (VECTOR_UNIT_VSX_P (V4SFmode)
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVSQRTSP];
+ break;
+ case BUILT_IN_CEIL:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIP];
+ break;
+ case BUILT_IN_CEILF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIP];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIP];
+ break;
+ case BUILT_IN_FLOOR:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIM];
+ break;
+ case BUILT_IN_FLOORF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIM];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIM];
+ break;
+ case BUILT_IN_TRUNC:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIZ];
+ break;
+ case BUILT_IN_TRUNCF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIZ];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIZ];
+ break;
+ case BUILT_IN_NEARBYINT:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && flag_unsafe_math_optimizations
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPI];
+ break;
+ case BUILT_IN_NEARBYINTF:
+ if (VECTOR_UNIT_VSX_P (V4SFmode)
+ && flag_unsafe_math_optimizations
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPI];
+ break;
+ case BUILT_IN_RINT:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && !flag_trapping_math
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIC];
+ break;
+ case BUILT_IN_RINTF:
+ if (VECTOR_UNIT_VSX_P (V4SFmode)
+ && !flag_trapping_math
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIC];
+ break;
+ default:
+ break;
+ }
+ }
+
+ else if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
+ {
+ enum rs6000_builtins fn
+ = (enum rs6000_builtins)DECL_FUNCTION_CODE (fndecl);
+ switch (fn)
+ {
+ case RS6000_BUILTIN_RSQRTF:
+ if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRSQRTFP];
+ break;
+ case RS6000_BUILTIN_RSQRT:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_VEC_RSQRT_V2DF];
+ break;
+ case RS6000_BUILTIN_RECIPF:
+ if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRECIPFP];
+ break;
+ case RS6000_BUILTIN_RECIP:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_RECIP_V2DF];
+ break;
+ default:
+ break;
+ }
}
+
return NULL_TREE;
}
@@ -3356,6 +3682,20 @@ rs6000_handle_option (size_t code, const char *arg, int value)
break;
#endif
+#if defined (HAVE_LD_LARGE_TOC) && defined (TARGET_USES_LINUX64_OPT)
+ case OPT_mcmodel_:
+ if (strcmp (arg, "small") == 0)
+ cmodel = CMODEL_SMALL;
+ else if (strcmp (arg, "large") == 0)
+ cmodel = CMODEL_LARGE;
+ else
+ {
+ error ("invalid option for -mcmodel: '%s'", arg);
+ return false;
+ }
+ rs6000_explicit_options.cmodel = true;
+#endif
+
#ifdef TARGET_USES_AIX64_OPT
case OPT_maix64:
#else
@@ -3668,6 +4008,13 @@ rs6000_handle_option (size_t code, const char *arg, int value)
target_flags_explicit |= MASK_SOFT_FLOAT;
rs6000_single_float = rs6000_double_float = 0;
}
+
+ case OPT_mrecip:
+ rs6000_recip_name = (value) ? "default" : "none";
+ break;
+
+ case OPT_mrecip_:
+ rs6000_recip_name = arg;
break;
}
return true;
@@ -4802,26 +5149,29 @@ constant_pool_expr_p (rtx op)
&& ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (base), Pmode));
}
+static rtx tocrel_base, tocrel_offset;
+
bool
toc_relative_expr_p (rtx op)
{
- rtx base, offset;
-
if (GET_CODE (op) != CONST)
return false;
- split_const (op, &base, &offset);
- return (GET_CODE (base) == UNSPEC
- && XINT (base, 1) == UNSPEC_TOCREL);
+ split_const (op, &tocrel_base, &tocrel_offset);
+ return (GET_CODE (tocrel_base) == UNSPEC
+ && XINT (tocrel_base, 1) == UNSPEC_TOCREL);
}
bool
-legitimate_constant_pool_address_p (rtx x)
+legitimate_constant_pool_address_p (const_rtx x, bool strict)
{
return (TARGET_TOC
- && GET_CODE (x) == PLUS
+ && (GET_CODE (x) == PLUS || GET_CODE (x) == LO_SUM)
&& GET_CODE (XEXP (x, 0)) == REG
- && (TARGET_MINIMAL_TOC || REGNO (XEXP (x, 0)) == TOC_REGISTER)
+ && (REGNO (XEXP (x, 0)) == TOC_REGISTER
+ || ((TARGET_MINIMAL_TOC
+ || TARGET_CMODEL != CMODEL_SMALL)
+ && INT_REG_OK_FOR_BASE_P (XEXP (x, 0), strict)))
&& toc_relative_expr_p (XEXP (x, 1)));
}
@@ -4850,7 +5200,7 @@ rs6000_legitimate_offset_address_p (enum machine_mode mode, rtx x, int strict)
return false;
if (!reg_offset_addressing_ok_p (mode))
return virtual_stack_registers_memory_p (x);
- if (legitimate_constant_pool_address_p (x))
+ if (legitimate_constant_pool_address_p (x, strict))
return true;
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
return false;
@@ -5198,7 +5548,8 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
&& constant_pool_expr_p (x)
&& ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (x), Pmode))
{
- return create_TOC_reference (x);
+ rtx reg = TARGET_CMODEL != CMODEL_SMALL ? gen_reg_rtx (Pmode) : NULL_RTX;
+ return create_TOC_reference (x, reg);
}
else
return x;
@@ -5289,10 +5640,13 @@ rs6000_delegitimize_address (rtx orig_x)
if (MEM_P (x))
x = XEXP (x, 0);
- if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 1)) == CONST
+ if ((GET_CODE (x) == PLUS
+ || GET_CODE (x) == LO_SUM)
&& GET_CODE (XEXP (x, 0)) == REG
- && REGNO (XEXP (x, 0)) == TOC_REGISTER)
+ && (REGNO (XEXP (x, 0)) == TOC_REGISTER
+ || TARGET_MINIMAL_TOC
+ || TARGET_CMODEL != CMODEL_SMALL)
+ && GET_CODE (XEXP (x, 1)) == CONST)
{
y = XEXP (XEXP (x, 1), 0);
if (GET_CODE (y) == UNSPEC
@@ -5304,7 +5658,6 @@ rs6000_delegitimize_address (rtx orig_x)
else
return replace_equiv_address_nv (orig_x, y);
}
- return orig_x;
}
if (TARGET_MACHO
@@ -5418,20 +5771,16 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
rs6000_emit_move (got, gsym, Pmode);
else
{
- rtx tmp3, mem;
- rtx last;
+ rtx mem, lab, last;
tmp1 = gen_reg_rtx (Pmode);
tmp2 = gen_reg_rtx (Pmode);
- tmp3 = gen_reg_rtx (Pmode);
mem = gen_const_mem (Pmode, tmp1);
-
- emit_insn (gen_load_toc_v4_PIC_1b (gsym));
- emit_move_insn (tmp1,
- gen_rtx_REG (Pmode, LR_REGNO));
+ lab = gen_label_rtx ();
+ emit_insn (gen_load_toc_v4_PIC_1b (gsym, lab));
+ emit_move_insn (tmp1, gen_rtx_REG (Pmode, LR_REGNO));
emit_move_insn (tmp2, mem);
- emit_insn (gen_addsi3 (tmp3, tmp1, tmp2));
- last = emit_move_insn (got, tmp3);
+ last = emit_insn (gen_addsi3 (got, tmp1, tmp2));
set_unique_reg_note (last, REG_EQUAL, gsym);
}
}
@@ -5604,6 +5953,24 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode,
}
#endif
+ if (TARGET_CMODEL != CMODEL_SMALL
+ && GET_CODE (x) == LO_SUM
+ && GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
+ && REGNO (XEXP (XEXP (x, 0), 0)) == TOC_REGISTER
+ && GET_CODE (XEXP (XEXP (x, 0), 1)) == HIGH
+ && GET_CODE (XEXP (x, 1)) == CONST
+ && GET_CODE (XEXP (XEXP (x, 1), 0)) == UNSPEC
+ && XINT (XEXP (XEXP (x, 1), 0), 1) == UNSPEC_TOCREL
+ && rtx_equal_p (XEXP (XEXP (XEXP (x, 0), 1), 0), XEXP (x, 1)))
+ {
+ push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
+ BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
+ opnum, (enum reload_type) type);
+ *win = 1;
+ return x;
+ }
+
/* Force ld/std non-word aligned offset into base register by wrapping
in offset 0. */
if (GET_CODE (x) == PLUS
@@ -5729,7 +6096,11 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode,
&& constant_pool_expr_p (x)
&& ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (x), mode))
{
- x = create_TOC_reference (x);
+ x = create_TOC_reference (x, NULL_RTX);
+ if (TARGET_CMODEL != CMODEL_SMALL)
+ push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
+ BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
+ opnum, (enum reload_type) type);
*win = 1;
return x;
}
@@ -5812,7 +6183,7 @@ rs6000_legitimate_address_p (enum machine_mode mode, rtx x, bool reg_ok_strict)
return 1;
if (reg_offset_p && legitimate_small_data_p (mode, x))
return 1;
- if (reg_offset_p && legitimate_constant_pool_address_p (x))
+ if (reg_offset_p && legitimate_constant_pool_address_p (x, reg_ok_strict))
return 1;
/* If not REG_OK_STRICT (before reload) let pass any stack offset. */
if (! reg_ok_strict
@@ -5920,7 +6291,9 @@ rs6000_mode_dependent_address (const_rtx addr)
break;
case LO_SUM:
- return true;
+ /* Anything in the constant pool is sufficiently aligned that
+ all bytes have the same high part address. */
+ return !legitimate_constant_pool_address_p (addr, false);
/* Auto-increment cases are now treated generically in recog.c. */
case PRE_MODIFY:
@@ -6276,18 +6649,19 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c1, HOST_WIDE_INT c2)
static void
rs6000_eliminate_indexed_memrefs (rtx operands[2])
{
+ if (reload_in_progress)
+ return;
+
if (GET_CODE (operands[0]) == MEM
&& GET_CODE (XEXP (operands[0], 0)) != REG
- && ! legitimate_constant_pool_address_p (XEXP (operands[0], 0))
- && ! reload_in_progress)
+ && ! legitimate_constant_pool_address_p (XEXP (operands[0], 0), false))
operands[0]
= replace_equiv_address (operands[0],
copy_addr_to_reg (XEXP (operands[0], 0)));
if (GET_CODE (operands[1]) == MEM
&& GET_CODE (XEXP (operands[1], 0)) != REG
- && ! legitimate_constant_pool_address_p (XEXP (operands[1], 0))
- && ! reload_in_progress)
+ && ! legitimate_constant_pool_address_p (XEXP (operands[1], 0), false))
operands[1]
= replace_equiv_address (operands[1],
copy_addr_to_reg (XEXP (operands[1], 0)));
@@ -6612,19 +6986,32 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
&& ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (operands[1]),
get_pool_mode (operands[1])))
{
- operands[1] = create_TOC_reference (operands[1]);
+ rtx reg = NULL_RTX;
+ if (TARGET_CMODEL != CMODEL_SMALL)
+ {
+ if (can_create_pseudo_p ())
+ reg = gen_reg_rtx (Pmode);
+ else
+ reg = operands[0];
+ }
+ operands[1] = create_TOC_reference (operands[1], reg);
}
else if (mode == Pmode
&& CONSTANT_P (operands[1])
&& ((GET_CODE (operands[1]) != CONST_INT
&& ! easy_fp_constant (operands[1], mode))
|| (GET_CODE (operands[1]) == CONST_INT
- && num_insns_constant (operands[1], mode) > 2)
+ && (num_insns_constant (operands[1], mode)
+ > (TARGET_CMODEL != CMODEL_SMALL ? 3 : 2)))
|| (GET_CODE (operands[0]) == REG
&& FP_REGNO_P (REGNO (operands[0]))))
&& GET_CODE (operands[1]) != HIGH
- && ! legitimate_constant_pool_address_p (operands[1])
- && ! toc_relative_expr_p (operands[1]))
+ && ! legitimate_constant_pool_address_p (operands[1], false)
+ && ! toc_relative_expr_p (operands[1])
+ && (TARGET_CMODEL == CMODEL_SMALL
+ || can_create_pseudo_p ()
+ || (REG_P (operands[0])
+ && INT_REG_OK_FOR_BASE_P (operands[0], true))))
{
#if TARGET_MACHO
@@ -6670,9 +7057,17 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
get_pool_constant (XEXP (operands[1], 0)),
get_pool_mode (XEXP (operands[1], 0))))
{
- operands[1]
- = gen_const_mem (mode,
- create_TOC_reference (XEXP (operands[1], 0)));
+ rtx tocref;
+ rtx reg = NULL_RTX;
+ if (TARGET_CMODEL != CMODEL_SMALL)
+ {
+ if (can_create_pseudo_p ())
+ reg = gen_reg_rtx (Pmode);
+ else
+ reg = operands[0];
+ }
+ tocref = create_TOC_reference (XEXP (operands[1], 0), reg);
+ operands[1] = gen_const_mem (mode, tocref);
set_mem_alias_set (operands[1], get_TOC_alias_set ());
}
}
@@ -8865,6 +9260,7 @@ static struct builtin_description bdesc_2arg[] =
{ MASK_ALTIVEC, CODE_FOR_altivec_vpkshus, "__builtin_altivec_vpkshus", ALTIVEC_BUILTIN_VPKSHUS },
{ MASK_ALTIVEC, CODE_FOR_altivec_vpkuwus, "__builtin_altivec_vpkuwus", ALTIVEC_BUILTIN_VPKUWUS },
{ MASK_ALTIVEC, CODE_FOR_altivec_vpkswus, "__builtin_altivec_vpkswus", ALTIVEC_BUILTIN_VPKSWUS },
+ { MASK_ALTIVEC, CODE_FOR_recipv4sf3, "__builtin_altivec_vrecipdivfp", ALTIVEC_BUILTIN_VRECIPFP },
{ MASK_ALTIVEC, CODE_FOR_vrotlv16qi3, "__builtin_altivec_vrlb", ALTIVEC_BUILTIN_VRLB },
{ MASK_ALTIVEC, CODE_FOR_vrotlv8hi3, "__builtin_altivec_vrlh", ALTIVEC_BUILTIN_VRLH },
{ MASK_ALTIVEC, CODE_FOR_vrotlv4si3, "__builtin_altivec_vrlw", ALTIVEC_BUILTIN_VRLW },
@@ -8907,6 +9303,7 @@ static struct builtin_description bdesc_2arg[] =
{ MASK_VSX, CODE_FOR_subv2df3, "__builtin_vsx_xvsubdp", VSX_BUILTIN_XVSUBDP },
{ MASK_VSX, CODE_FOR_mulv2df3, "__builtin_vsx_xvmuldp", VSX_BUILTIN_XVMULDP },
{ MASK_VSX, CODE_FOR_divv2df3, "__builtin_vsx_xvdivdp", VSX_BUILTIN_XVDIVDP },
+ { MASK_VSX, CODE_FOR_recipv2df3, "__builtin_vsx_xvrecipdivdp", VSX_BUILTIN_RECIP_V2DF },
{ MASK_VSX, CODE_FOR_sminv2df3, "__builtin_vsx_xvmindp", VSX_BUILTIN_XVMINDP },
{ MASK_VSX, CODE_FOR_smaxv2df3, "__builtin_vsx_xvmaxdp", VSX_BUILTIN_XVMAXDP },
{ MASK_VSX, CODE_FOR_vsx_tdivv2df3_fe, "__builtin_vsx_xvtdivdp_fe", VSX_BUILTIN_XVTDIVDP_FE },
@@ -8919,6 +9316,7 @@ static struct builtin_description bdesc_2arg[] =
{ MASK_VSX, CODE_FOR_subv4sf3, "__builtin_vsx_xvsubsp", VSX_BUILTIN_XVSUBSP },
{ MASK_VSX, CODE_FOR_mulv4sf3, "__builtin_vsx_xvmulsp", VSX_BUILTIN_XVMULSP },
{ MASK_VSX, CODE_FOR_divv4sf3, "__builtin_vsx_xvdivsp", VSX_BUILTIN_XVDIVSP },
+ { MASK_VSX, CODE_FOR_recipv4sf3, "__builtin_vsx_xvrecipdivsp", VSX_BUILTIN_RECIP_V4SF },
{ MASK_VSX, CODE_FOR_sminv4sf3, "__builtin_vsx_xvminsp", VSX_BUILTIN_XVMINSP },
{ MASK_VSX, CODE_FOR_smaxv4sf3, "__builtin_vsx_xvmaxsp", VSX_BUILTIN_XVMAXSP },
{ MASK_VSX, CODE_FOR_vsx_tdivv4sf3_fe, "__builtin_vsx_xvtdivsp_fe", VSX_BUILTIN_XVTDIVSP_FE },
@@ -9035,6 +9433,7 @@ static struct builtin_description bdesc_2arg[] =
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_packsu", ALTIVEC_BUILTIN_VEC_PACKSU },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkswus", ALTIVEC_BUILTIN_VEC_VPKSWUS },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkshus", ALTIVEC_BUILTIN_VEC_VPKSHUS },
+ { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_recipdiv", ALTIVEC_BUILTIN_VEC_RECIP },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_rl", ALTIVEC_BUILTIN_VEC_RL },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vrlw", ALTIVEC_BUILTIN_VEC_VRLW },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vrlh", ALTIVEC_BUILTIN_VEC_VRLH },
@@ -9364,12 +9763,13 @@ static struct builtin_description bdesc_1arg[] =
{
{ MASK_ALTIVEC, CODE_FOR_altivec_vexptefp, "__builtin_altivec_vexptefp", ALTIVEC_BUILTIN_VEXPTEFP },
{ MASK_ALTIVEC, CODE_FOR_altivec_vlogefp, "__builtin_altivec_vlogefp", ALTIVEC_BUILTIN_VLOGEFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vrefp, "__builtin_altivec_vrefp", ALTIVEC_BUILTIN_VREFP },
+ { MASK_ALTIVEC, CODE_FOR_rev4sf2, "__builtin_altivec_vrefp", ALTIVEC_BUILTIN_VREFP },
{ MASK_ALTIVEC, CODE_FOR_vector_floorv4sf2, "__builtin_altivec_vrfim", ALTIVEC_BUILTIN_VRFIM },
{ MASK_ALTIVEC, CODE_FOR_altivec_vrfin, "__builtin_altivec_vrfin", ALTIVEC_BUILTIN_VRFIN },
{ MASK_ALTIVEC, CODE_FOR_vector_ceilv4sf2, "__builtin_altivec_vrfip", ALTIVEC_BUILTIN_VRFIP },
{ MASK_ALTIVEC, CODE_FOR_vector_btruncv4sf2, "__builtin_altivec_vrfiz", ALTIVEC_BUILTIN_VRFIZ },
- { MASK_ALTIVEC, CODE_FOR_altivec_vrsqrtefp, "__builtin_altivec_vrsqrtefp", ALTIVEC_BUILTIN_VRSQRTEFP },
+ { MASK_ALTIVEC, CODE_FOR_rsqrtv4sf2, "__builtin_altivec_vrsqrtfp", ALTIVEC_BUILTIN_VRSQRTFP },
+ { MASK_ALTIVEC, CODE_FOR_rsqrtev4sf2, "__builtin_altivec_vrsqrtefp", ALTIVEC_BUILTIN_VRSQRTEFP },
{ MASK_ALTIVEC, CODE_FOR_altivec_vspltisb, "__builtin_altivec_vspltisb", ALTIVEC_BUILTIN_VSPLTISB },
{ MASK_ALTIVEC, CODE_FOR_altivec_vspltish, "__builtin_altivec_vspltish", ALTIVEC_BUILTIN_VSPLTISH },
{ MASK_ALTIVEC, CODE_FOR_altivec_vspltisw, "__builtin_altivec_vspltisw", ALTIVEC_BUILTIN_VSPLTISW },
@@ -9382,14 +9782,16 @@ static struct builtin_description bdesc_1arg[] =
{ MASK_VSX, CODE_FOR_negv2df2, "__builtin_vsx_xvnegdp", VSX_BUILTIN_XVNEGDP },
{ MASK_VSX, CODE_FOR_sqrtv2df2, "__builtin_vsx_xvsqrtdp", VSX_BUILTIN_XVSQRTDP },
- { MASK_VSX, CODE_FOR_vsx_rsqrtev2df2, "__builtin_vsx_xvrsqrtedp", VSX_BUILTIN_XVRSQRTEDP },
+ { MASK_VSX, CODE_FOR_rsqrtv2df2, "__builtin_vsx_xvrsqrtdp", VSX_BUILTIN_VEC_RSQRT_V2DF },
+ { MASK_VSX, CODE_FOR_rsqrtev2df2, "__builtin_vsx_xvrsqrtedp", VSX_BUILTIN_XVRSQRTEDP },
{ MASK_VSX, CODE_FOR_vsx_tsqrtv2df2_fe, "__builtin_vsx_xvtsqrtdp_fe", VSX_BUILTIN_XVTSQRTDP_FE },
{ MASK_VSX, CODE_FOR_vsx_tsqrtv2df2_fg, "__builtin_vsx_xvtsqrtdp_fg", VSX_BUILTIN_XVTSQRTDP_FG },
{ MASK_VSX, CODE_FOR_vsx_frev2df2, "__builtin_vsx_xvredp", VSX_BUILTIN_XVREDP },
{ MASK_VSX, CODE_FOR_negv4sf2, "__builtin_vsx_xvnegsp", VSX_BUILTIN_XVNEGSP },
{ MASK_VSX, CODE_FOR_sqrtv4sf2, "__builtin_vsx_xvsqrtsp", VSX_BUILTIN_XVSQRTSP },
- { MASK_VSX, CODE_FOR_vsx_rsqrtev4sf2, "__builtin_vsx_xvrsqrtesp", VSX_BUILTIN_XVRSQRTESP },
+ { MASK_VSX, CODE_FOR_rsqrtv4sf2, "__builtin_vsx_xvrsqrtsp", VSX_BUILTIN_VEC_RSQRT_V4SF },
+ { MASK_VSX, CODE_FOR_rsqrtev4sf2, "__builtin_vsx_xvrsqrtesp", VSX_BUILTIN_XVRSQRTESP },
{ MASK_VSX, CODE_FOR_vsx_tsqrtv4sf2_fe, "__builtin_vsx_xvtsqrtsp_fe", VSX_BUILTIN_XVTSQRTSP_FE },
{ MASK_VSX, CODE_FOR_vsx_tsqrtv4sf2_fg, "__builtin_vsx_xvtsqrtsp_fg", VSX_BUILTIN_XVTSQRTSP_FG },
{ MASK_VSX, CODE_FOR_vsx_frev4sf2, "__builtin_vsx_xvresp", VSX_BUILTIN_XVRESP },
@@ -9448,6 +9850,7 @@ static struct builtin_description bdesc_1arg[] =
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mtvscr", ALTIVEC_BUILTIN_VEC_MTVSCR },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_re", ALTIVEC_BUILTIN_VEC_RE },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_round", ALTIVEC_BUILTIN_VEC_ROUND },
+ { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_rsqrt", ALTIVEC_BUILTIN_VEC_RSQRT },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_rsqrte", ALTIVEC_BUILTIN_VEC_RSQRTE },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_trunc", ALTIVEC_BUILTIN_VEC_TRUNC },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_unpackh", ALTIVEC_BUILTIN_VEC_UNPACKH },
@@ -10963,73 +11366,83 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
rtx ret;
bool success;
- if (fcode == RS6000_BUILTIN_RECIP)
+ switch (fcode)
+ {
+ case RS6000_BUILTIN_RECIP:
return rs6000_expand_binop_builtin (CODE_FOR_recipdf3, exp, target);
- if (fcode == RS6000_BUILTIN_RECIPF)
+ case RS6000_BUILTIN_RECIPF:
return rs6000_expand_binop_builtin (CODE_FOR_recipsf3, exp, target);
- if (fcode == RS6000_BUILTIN_RSQRTF)
+ case RS6000_BUILTIN_RSQRTF:
return rs6000_expand_unop_builtin (CODE_FOR_rsqrtsf2, exp, target);
- if (fcode == RS6000_BUILTIN_BSWAP_HI)
- return rs6000_expand_unop_builtin (CODE_FOR_bswaphi2, exp, target);
-
- if (fcode == POWER7_BUILTIN_BPERMD)
- return rs6000_expand_binop_builtin (((TARGET_64BIT)
- ? CODE_FOR_bpermd_di
- : CODE_FOR_bpermd_si), exp, target);
+ case RS6000_BUILTIN_RSQRT:
+ return rs6000_expand_unop_builtin (CODE_FOR_rsqrtdf2, exp, target);
- if (fcode == ALTIVEC_BUILTIN_MASK_FOR_LOAD
- || fcode == ALTIVEC_BUILTIN_MASK_FOR_STORE)
- {
- int icode = (int) CODE_FOR_altivec_lvsr;
- enum machine_mode tmode = insn_data[icode].operand[0].mode;
- enum machine_mode mode = insn_data[icode].operand[1].mode;
- tree arg;
- rtx op, addr, pat;
+ case RS6000_BUILTIN_BSWAP_HI:
+ return rs6000_expand_unop_builtin (CODE_FOR_bswaphi2, exp, target);
- gcc_assert (TARGET_ALTIVEC);
+ case POWER7_BUILTIN_BPERMD:
+ return rs6000_expand_binop_builtin (((TARGET_64BIT)
+ ? CODE_FOR_bpermd_di
+ : CODE_FOR_bpermd_si), exp, target);
- arg = CALL_EXPR_ARG (exp, 0);
- gcc_assert (TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE);
- op = expand_expr (arg, NULL_RTX, Pmode, EXPAND_NORMAL);
- addr = memory_address (mode, op);
- if (fcode == ALTIVEC_BUILTIN_MASK_FOR_STORE)
- op = addr;
- else
- {
- /* For the load case need to negate the address. */
- op = gen_reg_rtx (GET_MODE (addr));
- emit_insn (gen_rtx_SET (VOIDmode, op,
- gen_rtx_NEG (GET_MODE (addr), addr)));
- }
- op = gen_rtx_MEM (mode, op);
+ case ALTIVEC_BUILTIN_MASK_FOR_LOAD:
+ case ALTIVEC_BUILTIN_MASK_FOR_STORE:
+ {
+ int icode = (int) CODE_FOR_altivec_lvsr;
+ enum machine_mode tmode = insn_data[icode].operand[0].mode;
+ enum machine_mode mode = insn_data[icode].operand[1].mode;
+ tree arg;
+ rtx op, addr, pat;
+
+ gcc_assert (TARGET_ALTIVEC);
+
+ arg = CALL_EXPR_ARG (exp, 0);
+ gcc_assert (TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE);
+ op = expand_expr (arg, NULL_RTX, Pmode, EXPAND_NORMAL);
+ addr = memory_address (mode, op);
+ if (fcode == ALTIVEC_BUILTIN_MASK_FOR_STORE)
+ op = addr;
+ else
+ {
+ /* For the load case need to negate the address. */
+ op = gen_reg_rtx (GET_MODE (addr));
+ emit_insn (gen_rtx_SET (VOIDmode, op,
+ gen_rtx_NEG (GET_MODE (addr), addr)));
+ }
+ op = gen_rtx_MEM (mode, op);
- if (target == 0
- || GET_MODE (target) != tmode
- || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
- target = gen_reg_rtx (tmode);
+ if (target == 0
+ || GET_MODE (target) != tmode
+ || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
+ target = gen_reg_rtx (tmode);
- /*pat = gen_altivec_lvsr (target, op);*/
- pat = GEN_FCN (icode) (target, op);
- if (!pat)
- return 0;
- emit_insn (pat);
+ /*pat = gen_altivec_lvsr (target, op);*/
+ pat = GEN_FCN (icode) (target, op);
+ if (!pat)
+ return 0;
+ emit_insn (pat);
- return target;
- }
+ return target;
+ }
+ case ALTIVEC_BUILTIN_VCFUX:
+ case ALTIVEC_BUILTIN_VCFSX:
+ case ALTIVEC_BUILTIN_VCTUXS:
+ case ALTIVEC_BUILTIN_VCTSXS:
/* FIXME: There's got to be a nicer way to handle this case than
constructing a new CALL_EXPR. */
- if (fcode == ALTIVEC_BUILTIN_VCFUX
- || fcode == ALTIVEC_BUILTIN_VCFSX
- || fcode == ALTIVEC_BUILTIN_VCTUXS
- || fcode == ALTIVEC_BUILTIN_VCTSXS)
- {
if (call_expr_nargs (exp) == 1)
- exp = build_call_nary (TREE_TYPE (exp), CALL_EXPR_FN (exp),
- 2, CALL_EXPR_ARG (exp, 0), integer_zero_node);
+ {
+ exp = build_call_nary (TREE_TYPE (exp), CALL_EXPR_FN (exp),
+ 2, CALL_EXPR_ARG (exp, 0), integer_zero_node);
+ }
+ break;
+
+ default:
+ break;
}
if (TARGET_ALTIVEC)
@@ -11081,6 +11494,7 @@ static void
rs6000_init_builtins (void)
{
tree tdecl;
+ tree ftype;
V2SI_type_node = build_vector_type (intSI_type_node, 2);
V2SF_type_node = build_vector_type (float_type_node, 2);
@@ -11270,29 +11684,38 @@ rs6000_init_builtins (void)
altivec_init_builtins ();
if (TARGET_ALTIVEC || TARGET_SPE || TARGET_PAIRED_FLOAT || TARGET_VSX)
rs6000_common_init_builtins ();
- if (TARGET_PPC_GFXOPT)
+ if (TARGET_FRE)
{
- tree ftype = builtin_function_type (SFmode, SFmode, SFmode, VOIDmode,
- RS6000_BUILTIN_RECIPF,
- "__builtin_recipdivf");
+ ftype = builtin_function_type (DFmode, DFmode, DFmode, VOIDmode,
+ RS6000_BUILTIN_RECIP,
+ "__builtin_recipdiv");
+ def_builtin (MASK_POPCNTB, "__builtin_recipdiv", ftype,
+ RS6000_BUILTIN_RECIP);
+ }
+ if (TARGET_FRES)
+ {
+ ftype = builtin_function_type (SFmode, SFmode, SFmode, VOIDmode,
+ RS6000_BUILTIN_RECIPF,
+ "__builtin_recipdivf");
def_builtin (MASK_PPC_GFXOPT, "__builtin_recipdivf", ftype,
RS6000_BUILTIN_RECIPF);
-
+ }
+ if (TARGET_FRSQRTE)
+ {
+ ftype = builtin_function_type (DFmode, DFmode, VOIDmode, VOIDmode,
+ RS6000_BUILTIN_RSQRT,
+ "__builtin_rsqrt");
+ def_builtin (MASK_PPC_GFXOPT, "__builtin_rsqrt", ftype,
+ RS6000_BUILTIN_RSQRT);
+ }
+ if (TARGET_FRSQRTES)
+ {
ftype = builtin_function_type (SFmode, SFmode, VOIDmode, VOIDmode,
RS6000_BUILTIN_RSQRTF,
"__builtin_rsqrtf");
def_builtin (MASK_PPC_GFXOPT, "__builtin_rsqrtf", ftype,
RS6000_BUILTIN_RSQRTF);
}
- if (TARGET_POPCNTB)
- {
- tree ftype = builtin_function_type (DFmode, DFmode, DFmode, VOIDmode,
- RS6000_BUILTIN_RECIP,
- "__builtin_recipdiv");
- def_builtin (MASK_POPCNTB, "__builtin_recipdiv", ftype,
- RS6000_BUILTIN_RECIP);
-
- }
if (TARGET_POPCNTD)
{
enum machine_mode mode = (TARGET_64BIT) ? DImode : SImode;
@@ -12249,7 +12672,7 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0,
found = htab_find_slot (builtin_hash_table, &h, INSERT);
if (*found == NULL)
{
- h2 = GGC_NEW (struct builtin_hash_struct);
+ h2 = ggc_alloc_builtin_hash_struct ();
*h2 = h;
*found = (void *)h2;
args = void_list_node;
@@ -13259,7 +13682,7 @@ rs6000_check_sdmode (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
case RESULT_DECL:
case SSA_NAME:
case REAL_CST:
- case INDIRECT_REF:
+ case MEM_REF:
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
case VIEW_CONVERT_EXPR:
@@ -13305,14 +13728,15 @@ rs6000_reload_register_type (enum reg_class rclass)
For VSX and Altivec, we may need a register to convert sp+offset into
reg+sp. */
-static enum reg_class
+static reg_class_t
rs6000_secondary_reload (bool in_p,
rtx x,
- enum reg_class rclass,
+ reg_class_t rclass_i,
enum machine_mode mode,
secondary_reload_info *sri)
{
- enum reg_class ret = ALL_REGS;
+ enum reg_class rclass = (enum reg_class) rclass_i;
+ reg_class_t ret = ALL_REGS;
enum insn_code icode;
bool default_p = false;
@@ -13704,11 +14128,11 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, rtx scratch, bool store_p)
account for the Altivec and Floating registers being subsets of the VSX
register set under VSX, but distinct register sets on pre-VSX machines. */
-static const enum reg_class *
+static const reg_class_t *
rs6000_ira_cover_classes (void)
{
- static const enum reg_class cover_pre_vsx[] = IRA_COVER_CLASSES_PRE_VSX;
- static const enum reg_class cover_vsx[] = IRA_COVER_CLASSES_VSX;
+ static const reg_class_t cover_pre_vsx[] = IRA_COVER_CLASSES_PRE_VSX;
+ static const reg_class_t cover_vsx[] = IRA_COVER_CLASSES_VSX;
return (TARGET_VSX) ? cover_vsx : cover_pre_vsx;
}
@@ -13800,30 +14224,16 @@ rs6000_preferred_reload_class (rtx x, enum reg_class rclass)
if (GET_MODE_CLASS (mode) == MODE_INT && rclass == NON_SPECIAL_REGS)
return GENERAL_REGS;
- /* For VSX, prefer the traditional registers for DF if the address is of the
- form reg+offset because we can use the non-VSX loads. Prefer the Altivec
- registers if Altivec is handling the vector operations (i.e. V16QI, V8HI,
- and V4SI). */
- if (rclass == VSX_REGS && VECTOR_MEM_VSX_P (mode))
+ /* For VSX, prefer the traditional registers for 64-bit values because we can
+ use the non-VSX loads. Prefer the Altivec registers if Altivec is
+ handling the vector operations (i.e. V16QI, V8HI, and V4SI), or if we
+ prefer Altivec loads.. */
+ if (rclass == VSX_REGS)
{
- if (mode == DFmode && GET_CODE (x) == MEM)
- {
- rtx addr = XEXP (x, 0);
+ if (GET_MODE_SIZE (mode) <= 8)
+ return FLOAT_REGS;
- if (legitimate_indirect_address_p (addr, false)) /* reg */
- return VSX_REGS;
-
- if (legitimate_indexed_address_p (addr, false)) /* reg+reg */
- return VSX_REGS;
-
- if (GET_CODE (addr) == PRE_MODIFY
- && legitimate_indexed_address_p (XEXP (addr, 0), false))
- return VSX_REGS;
-
- return FLOAT_REGS;
- }
-
- if (VECTOR_UNIT_ALTIVEC_P (mode))
+ if (VECTOR_UNIT_ALTIVEC_P (mode) || VECTOR_MEM_ALTIVEC_P (mode))
return ALTIVEC_REGS;
return rclass;
@@ -14159,7 +14569,7 @@ rs6000_got_register (rtx value ATTRIBUTE_UNUSED)
static struct machine_function *
rs6000_init_machine_status (void)
{
- return GGC_CNEW (machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
/* These macros test for integers and extract the low-order bits. */
@@ -14472,27 +14882,16 @@ print_operand (FILE *file, rtx x, int code)
/* X must be a symbolic constant on ELF. Write an
expression suitable for an 'addi' that adds in the low 16
bits of the MEM. */
- if (GET_CODE (x) != CONST)
- {
- print_operand_address (file, x);
- fputs ("@l", file);
- }
- else
+ if (GET_CODE (x) == CONST)
{
if (GET_CODE (XEXP (x, 0)) != PLUS
|| (GET_CODE (XEXP (XEXP (x, 0), 0)) != SYMBOL_REF
&& GET_CODE (XEXP (XEXP (x, 0), 0)) != LABEL_REF)
|| GET_CODE (XEXP (XEXP (x, 0), 1)) != CONST_INT)
output_operand_lossage ("invalid %%K value");
- print_operand_address (file, XEXP (XEXP (x, 0), 0));
- fputs ("@l", file);
- /* For GNU as, there must be a non-alphanumeric character
- between 'l' and the number. The '-' is added by
- print_operand() already. */
- if (INTVAL (XEXP (XEXP (x, 0), 1)) >= 0)
- fputs ("+", file);
- print_operand (file, XEXP (XEXP (x, 0), 1), 0);
}
+ print_operand_address (file, x);
+ fputs ("@l", file);
return;
/* %l is output_asm_label. */
@@ -15022,14 +15421,6 @@ print_operand_address (FILE *file, rtx x)
else if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 1)) == CONST_INT)
fprintf (file, HOST_WIDE_INT_PRINT_DEC "(%s)",
INTVAL (XEXP (x, 1)), reg_names[ REGNO (XEXP (x, 0)) ]);
-#if TARGET_ELF
- else if (GET_CODE (x) == LO_SUM && GET_CODE (XEXP (x, 0)) == REG
- && CONSTANT_P (XEXP (x, 1)))
- {
- output_addr_const (file, XEXP (x, 1));
- fprintf (file, "@l(%s)", reg_names[ REGNO (XEXP (x, 0)) ]);
- }
-#endif
#if TARGET_MACHO
else if (GET_CODE (x) == LO_SUM && GET_CODE (XEXP (x, 0)) == REG
&& CONSTANT_P (XEXP (x, 1)))
@@ -15039,11 +15430,29 @@ print_operand_address (FILE *file, rtx x)
fprintf (file, ")(%s)", reg_names[ REGNO (XEXP (x, 0)) ]);
}
#endif
- else if (legitimate_constant_pool_address_p (x))
+ else if (legitimate_constant_pool_address_p (x, true))
+ {
+ /* This hack along with a corresponding hack in
+ rs6000_output_addr_const_extra arranges to output addends
+ where the assembler expects to find them. eg.
+ (lo_sum (reg 9)
+ . (const (plus (unspec [symbol_ref ("x") tocrel]) 8)))
+ without this hack would be output as "x@toc+8@l(9)". We
+ want "x+8@toc@l(9)". */
+ output_addr_const (file, tocrel_base);
+ if (GET_CODE (x) == LO_SUM)
+ fprintf (file, "@l(%s)", reg_names[ REGNO (XEXP (x, 0)) ]);
+ else
+ fprintf (file, "(%s)", reg_names[REGNO (XEXP (x, 0))]);
+ }
+#if TARGET_ELF
+ else if (GET_CODE (x) == LO_SUM && GET_CODE (XEXP (x, 0)) == REG
+ && CONSTANT_P (XEXP (x, 1)))
{
output_addr_const (file, XEXP (x, 1));
- fprintf (file, "(%s)", reg_names[REGNO (XEXP (x, 0))]);
+ fprintf (file, "@l(%s)", reg_names[ REGNO (XEXP (x, 0)) ]);
}
+#endif
else
gcc_unreachable ();
}
@@ -15057,9 +15466,14 @@ rs6000_output_addr_const_extra (FILE *file, rtx x)
switch (XINT (x, 1))
{
case UNSPEC_TOCREL:
- x = XVECEXP (x, 0, 0);
- gcc_assert (GET_CODE (x) == SYMBOL_REF);
- output_addr_const (file, x);
+ gcc_assert (GET_CODE (XVECEXP (x, 0, 0)) == SYMBOL_REF);
+ output_addr_const (file, XVECEXP (x, 0, 0));
+ if (x == tocrel_base && tocrel_offset != const0_rtx)
+ {
+ if (INTVAL (tocrel_offset) >= 0)
+ fprintf (file, "+");
+ output_addr_const (file, tocrel_offset);
+ }
if (!TARGET_AIX || (TARGET_ELF && TARGET_MINIMAL_TOC))
{
putc ('-', file);
@@ -15383,7 +15797,7 @@ rs6000_generate_compare (rtx cmp, enum machine_mode mode)
&& !TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128)
emit_insn (gen_rtx_PARALLEL (VOIDmode,
- gen_rtvec (9,
+ gen_rtvec (10,
gen_rtx_SET (VOIDmode,
compare_result,
gen_rtx_COMPARE (comp_mode, op0, op1)),
@@ -15394,7 +15808,8 @@ rs6000_generate_compare (rtx cmp, enum machine_mode mode)
gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (DFmode)),
gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (DFmode)),
gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (DFmode)),
- gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (DFmode)))));
+ gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (DFmode)),
+ gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (Pmode)))));
else if (GET_CODE (op1) == UNSPEC
&& XINT (op1, 1) == UNSPEC_SP_TEST)
{
@@ -17835,12 +18250,12 @@ rs6000_emit_load_toc_table (int fromprolog)
}
else
{
- rtx tocsym;
+ rtx tocsym, lab;
tocsym = gen_rtx_SYMBOL_REF (Pmode, toc_label_name);
- emit_insn (gen_load_toc_v4_PIC_1b (tocsym));
- emit_move_insn (dest,
- gen_rtx_REG (Pmode, LR_REGNO));
+ lab = gen_label_rtx ();
+ emit_insn (gen_load_toc_v4_PIC_1b (tocsym, lab));
+ emit_move_insn (dest, gen_rtx_REG (Pmode, LR_REGNO));
emit_move_insn (temp0, gen_rtx_MEM (Pmode, dest));
}
emit_insn (gen_addsi3 (dest, temp0, dest));
@@ -17953,8 +18368,10 @@ uses_TOC (void)
#endif
rtx
-create_TOC_reference (rtx symbol)
+create_TOC_reference (rtx symbol, rtx largetoc_reg)
{
+ rtx tocrel, tocreg;
+
if (TARGET_DEBUG_ADDR)
{
if (GET_CODE (symbol) == SYMBOL_REF)
@@ -17970,10 +18387,23 @@ create_TOC_reference (rtx symbol)
if (!can_create_pseudo_p ())
df_set_regs_ever_live (TOC_REGISTER, true);
- return gen_rtx_PLUS (Pmode,
- gen_rtx_REG (Pmode, TOC_REGISTER),
- gen_rtx_CONST (Pmode,
- gen_rtx_UNSPEC (Pmode, gen_rtvec (1, symbol), UNSPEC_TOCREL)));
+
+ tocrel = gen_rtx_CONST (Pmode,
+ gen_rtx_UNSPEC (Pmode, gen_rtvec (1, symbol),
+ UNSPEC_TOCREL));
+ tocreg = gen_rtx_REG (Pmode, TOC_REGISTER);
+ if (TARGET_CMODEL != CMODEL_SMALL)
+ {
+ rtx hi = gen_rtx_PLUS (Pmode, tocreg, gen_rtx_HIGH (Pmode, tocrel));
+ if (largetoc_reg != NULL)
+ {
+ emit_move_insn (largetoc_reg, hi);
+ hi = largetoc_reg;
+ }
+ return gen_rtx_LO_SUM (Pmode, hi, copy_rtx (tocrel));
+ }
+ else
+ return gen_rtx_PLUS (Pmode, tocreg, tocrel);
}
/* Issue assembly directives that create a reference to the given DWARF
@@ -20888,7 +21318,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
toc_hash_table = htab_create_ggc (1021, toc_hash_function,
toc_hash_eq, NULL);
- h = GGC_NEW (struct toc_hash_struct);
+ h = ggc_alloc_toc_hash_struct ();
h->key = x;
h->key_mode = mode;
h->labelno = labelno;
@@ -22118,6 +22548,7 @@ rs6000_issue_rate (void)
case CPU_PPCE300C3:
case CPU_PPCE500MC:
case CPU_PPCE500MC64:
+ case CPU_TITAN:
return 2;
case CPU_RIOS2:
case CPU_PPC476:
@@ -25110,17 +25541,41 @@ static tree
rs6000_builtin_reciprocal (unsigned int fn, bool md_fn,
bool sqrt ATTRIBUTE_UNUSED)
{
- if (! (TARGET_RECIP && TARGET_PPC_GFXOPT && !optimize_size
- && flag_finite_math_only && !flag_trapping_math
- && flag_unsafe_math_optimizations))
+ if (optimize_insn_for_size_p ())
return NULL_TREE;
if (md_fn)
- return NULL_TREE;
+ switch (fn)
+ {
+ case VSX_BUILTIN_XVSQRTDP:
+ if (!RS6000_RECIP_AUTO_RSQRTE_P (V2DFmode))
+ return NULL_TREE;
+
+ return rs6000_builtin_decls[VSX_BUILTIN_VEC_RSQRT_V2DF];
+
+ case VSX_BUILTIN_XVSQRTSP:
+ if (!RS6000_RECIP_AUTO_RSQRTE_P (V4SFmode))
+ return NULL_TREE;
+
+ return rs6000_builtin_decls[VSX_BUILTIN_VEC_RSQRT_V4SF];
+
+ default:
+ return NULL_TREE;
+ }
+
else
switch (fn)
{
+ case BUILT_IN_SQRT:
+ if (!RS6000_RECIP_AUTO_RSQRTE_P (DFmode))
+ return NULL_TREE;
+
+ return rs6000_builtin_decls[RS6000_BUILTIN_RSQRT];
+
case BUILT_IN_SQRTF:
+ if (!RS6000_RECIP_AUTO_RSQRTE_P (SFmode))
+ return NULL_TREE;
+
return rs6000_builtin_decls[RS6000_BUILTIN_RSQRTF];
default:
@@ -25128,192 +25583,300 @@ rs6000_builtin_reciprocal (unsigned int fn, bool md_fn,
}
}
-/* Newton-Raphson approximation of single-precision floating point divide n/d.
- Assumes no trapping math and finite arguments. */
+/* Load up a constant. If the mode is a vector mode, splat the value across
+ all of the vector elements. */
-void
-rs6000_emit_swdivsf (rtx dst, rtx n, rtx d)
+static rtx
+rs6000_load_constant_and_splat (enum machine_mode mode, REAL_VALUE_TYPE dconst)
{
- rtx x0, e0, e1, y1, u0, v0, one;
+ rtx reg;
+
+ if (mode == SFmode || mode == DFmode)
+ {
+ rtx d = CONST_DOUBLE_FROM_REAL_VALUE (dconst, mode);
+ reg = force_reg (mode, d);
+ }
+ else if (mode == V4SFmode)
+ {
+ rtx d = CONST_DOUBLE_FROM_REAL_VALUE (dconst, SFmode);
+ rtvec v = gen_rtvec (4, d, d, d, d);
+ reg = gen_reg_rtx (mode);
+ rs6000_expand_vector_init (reg, gen_rtx_PARALLEL (mode, v));
+ }
+ else if (mode == V2DFmode)
+ {
+ rtx d = CONST_DOUBLE_FROM_REAL_VALUE (dconst, DFmode);
+ rtvec v = gen_rtvec (2, d, d);
+ reg = gen_reg_rtx (mode);
+ rs6000_expand_vector_init (reg, gen_rtx_PARALLEL (mode, v));
+ }
+ else
+ gcc_unreachable ();
+
+ return reg;
+}
- x0 = gen_reg_rtx (SFmode);
- e0 = gen_reg_rtx (SFmode);
- e1 = gen_reg_rtx (SFmode);
- y1 = gen_reg_rtx (SFmode);
- u0 = gen_reg_rtx (SFmode);
- v0 = gen_reg_rtx (SFmode);
- one = force_reg (SFmode, CONST_DOUBLE_FROM_REAL_VALUE (dconst1, SFmode));
+/* Generate a FMADD instruction:
+ dst = (m1 * m2) + a
+
+ generating different RTL based on the fused multiply/add switch. */
+
+static void
+rs6000_emit_madd (rtx dst, rtx m1, rtx m2, rtx a)
+{
+ enum machine_mode mode = GET_MODE (dst);
+
+ if (!TARGET_FUSED_MADD)
+ {
+ /* For the simple ops, use the generator function, rather than assuming
+ that the RTL is standard. */
+ enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code acode = optab_handler (add_optab, mode)->insn_code;
+ gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
+ gen_2arg_fn_t gen_add = (gen_2arg_fn_t) GEN_FCN (acode);
+ rtx mreg = gen_reg_rtx (mode);
+
+ gcc_assert (mcode != CODE_FOR_nothing && acode != CODE_FOR_nothing);
+ emit_insn (gen_mul (mreg, m1, m2));
+ emit_insn (gen_add (dst, mreg, a));
+ }
+
+ else
+ emit_insn (gen_rtx_SET (VOIDmode, dst,
+ gen_rtx_PLUS (mode,
+ gen_rtx_MULT (mode, m1, m2),
+ a)));
+}
+
+/* Generate a FMSUB instruction:
+ dst = (m1 * m2) - a
+
+ generating different RTL based on the fused multiply/add switch. */
+
+static void
+rs6000_emit_msub (rtx dst, rtx m1, rtx m2, rtx a)
+{
+ enum machine_mode mode = GET_MODE (dst);
+
+ if (!TARGET_FUSED_MADD
+ || (mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (V4SFmode)))
+ {
+ /* For the simple ops, use the generator function, rather than assuming
+ that the RTL is standard. */
+ enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code scode = optab_handler (add_optab, mode)->insn_code;
+ gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
+ gen_2arg_fn_t gen_sub = (gen_2arg_fn_t) GEN_FCN (scode);
+ rtx mreg = gen_reg_rtx (mode);
+
+ gcc_assert (mcode != CODE_FOR_nothing && scode != CODE_FOR_nothing);
+ emit_insn (gen_mul (mreg, m1, m2));
+ emit_insn (gen_sub (dst, mreg, a));
+ }
+
+ else
+ emit_insn (gen_rtx_SET (VOIDmode, dst,
+ gen_rtx_MINUS (mode,
+ gen_rtx_MULT (mode, m1, m2),
+ a)));
+}
+
+/* Generate a FNMSUB instruction:
+ dst = - ((m1 * m2) - a)
+
+ Which is equivalent to (except in the prescence of -0.0):
+ dst = a - (m1 * m2)
+
+ generating different RTL based on the fast-math and fused multiply/add
+ switches. */
+
+static void
+rs6000_emit_nmsub (rtx dst, rtx m1, rtx m2, rtx a)
+{
+ enum machine_mode mode = GET_MODE (dst);
+
+ if (!TARGET_FUSED_MADD)
+ {
+ /* For the simple ops, use the generator function, rather than assuming
+ that the RTL is standard. */
+ enum insn_code mcode = optab_handler (smul_optab, mode)->insn_code;
+ enum insn_code scode = optab_handler (sub_optab, mode)->insn_code;
+ gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (mcode);
+ gen_2arg_fn_t gen_sub = (gen_2arg_fn_t) GEN_FCN (scode);
+ rtx mreg = gen_reg_rtx (mode);
+
+ gcc_assert (mcode != CODE_FOR_nothing && scode != CODE_FOR_nothing);
+ emit_insn (gen_mul (mreg, m1, m2));
+ emit_insn (gen_sub (dst, a, mreg));
+ }
+
+ else
+ {
+ rtx m = gen_rtx_MULT (mode, m1, m2);
+
+ if (!HONOR_SIGNED_ZEROS (mode))
+ emit_insn (gen_rtx_SET (VOIDmode, dst, gen_rtx_MINUS (mode, a, m)));
+
+ else
+ emit_insn (gen_rtx_SET (VOIDmode, dst,
+ gen_rtx_NEG (mode,
+ gen_rtx_MINUS (mode, m, a))));
+ }
+}
+
+/* Newton-Raphson approximation of floating point divide with just 2 passes
+ (either single precision floating point, or newer machines with higher
+ accuracy estimates). Support both scalar and vector divide. Assumes no
+ trapping math and finite arguments. */
+
+static void
+rs6000_emit_swdiv_high_precision (rtx dst, rtx n, rtx d)
+{
+ enum machine_mode mode = GET_MODE (dst);
+ rtx x0, e0, e1, y1, u0, v0;
+ enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
+ rtx one = rs6000_load_constant_and_splat (mode, dconst1);
+
+ gcc_assert (code != CODE_FOR_nothing);
/* x0 = 1./d estimate */
+ x0 = gen_reg_rtx (mode);
emit_insn (gen_rtx_SET (VOIDmode, x0,
- gen_rtx_UNSPEC (SFmode, gen_rtvec (1, d),
+ gen_rtx_UNSPEC (mode, gen_rtvec (1, d),
UNSPEC_FRES)));
- /* e0 = 1. - d * x0 */
- emit_insn (gen_rtx_SET (VOIDmode, e0,
- gen_rtx_MINUS (SFmode, one,
- gen_rtx_MULT (SFmode, d, x0))));
- /* e1 = e0 + e0 * e0 */
- emit_insn (gen_rtx_SET (VOIDmode, e1,
- gen_rtx_PLUS (SFmode,
- gen_rtx_MULT (SFmode, e0, e0), e0)));
- /* y1 = x0 + e1 * x0 */
- emit_insn (gen_rtx_SET (VOIDmode, y1,
- gen_rtx_PLUS (SFmode,
- gen_rtx_MULT (SFmode, e1, x0), x0)));
- /* u0 = n * y1 */
- emit_insn (gen_rtx_SET (VOIDmode, u0,
- gen_rtx_MULT (SFmode, n, y1)));
- /* v0 = n - d * u0 */
- emit_insn (gen_rtx_SET (VOIDmode, v0,
- gen_rtx_MINUS (SFmode, n,
- gen_rtx_MULT (SFmode, d, u0))));
- /* dst = u0 + v0 * y1 */
- emit_insn (gen_rtx_SET (VOIDmode, dst,
- gen_rtx_PLUS (SFmode,
- gen_rtx_MULT (SFmode, v0, y1), u0)));
-}
-
-/* Newton-Raphson approximation of double-precision floating point divide n/d.
- Assumes no trapping math and finite arguments. */
-void
-rs6000_emit_swdivdf (rtx dst, rtx n, rtx d)
+ e0 = gen_reg_rtx (mode);
+ rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - (d * x0) */
+
+ e1 = gen_reg_rtx (mode);
+ rs6000_emit_madd (e1, e0, e0, e0); /* e1 = (e0 * e0) + e0 */
+
+ y1 = gen_reg_rtx (mode);
+ rs6000_emit_madd (y1, e1, x0, x0); /* y1 = (e1 * x0) + x0 */
+
+ u0 = gen_reg_rtx (mode);
+ emit_insn (gen_mul (u0, n, y1)); /* u0 = n * y1 */
+
+ v0 = gen_reg_rtx (mode);
+ rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - (d * u0) */
+
+ rs6000_emit_madd (dst, v0, y1, u0); /* dst = (v0 * y1) + u0 */
+}
+
+/* Newton-Raphson approximation of floating point divide that has a low
+ precision estimate. Assumes no trapping math and finite arguments. */
+
+static void
+rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d)
{
+ enum machine_mode mode = GET_MODE (dst);
rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one;
+ enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
+
+ gcc_assert (code != CODE_FOR_nothing);
- x0 = gen_reg_rtx (DFmode);
- e0 = gen_reg_rtx (DFmode);
- e1 = gen_reg_rtx (DFmode);
- e2 = gen_reg_rtx (DFmode);
- y1 = gen_reg_rtx (DFmode);
- y2 = gen_reg_rtx (DFmode);
- y3 = gen_reg_rtx (DFmode);
- u0 = gen_reg_rtx (DFmode);
- v0 = gen_reg_rtx (DFmode);
- one = force_reg (DFmode, CONST_DOUBLE_FROM_REAL_VALUE (dconst1, DFmode));
+ one = rs6000_load_constant_and_splat (mode, dconst1);
/* x0 = 1./d estimate */
+ x0 = gen_reg_rtx (mode);
emit_insn (gen_rtx_SET (VOIDmode, x0,
- gen_rtx_UNSPEC (DFmode, gen_rtvec (1, d),
+ gen_rtx_UNSPEC (mode, gen_rtvec (1, d),
UNSPEC_FRES)));
- /* e0 = 1. - d * x0 */
- emit_insn (gen_rtx_SET (VOIDmode, e0,
- gen_rtx_MINUS (DFmode, one,
- gen_rtx_MULT (SFmode, d, x0))));
- /* y1 = x0 + e0 * x0 */
- emit_insn (gen_rtx_SET (VOIDmode, y1,
- gen_rtx_PLUS (DFmode,
- gen_rtx_MULT (DFmode, e0, x0), x0)));
- /* e1 = e0 * e0 */
- emit_insn (gen_rtx_SET (VOIDmode, e1,
- gen_rtx_MULT (DFmode, e0, e0)));
- /* y2 = y1 + e1 * y1 */
- emit_insn (gen_rtx_SET (VOIDmode, y2,
- gen_rtx_PLUS (DFmode,
- gen_rtx_MULT (DFmode, e1, y1), y1)));
- /* e2 = e1 * e1 */
- emit_insn (gen_rtx_SET (VOIDmode, e2,
- gen_rtx_MULT (DFmode, e1, e1)));
- /* y3 = y2 + e2 * y2 */
- emit_insn (gen_rtx_SET (VOIDmode, y3,
- gen_rtx_PLUS (DFmode,
- gen_rtx_MULT (DFmode, e2, y2), y2)));
- /* u0 = n * y3 */
- emit_insn (gen_rtx_SET (VOIDmode, u0,
- gen_rtx_MULT (DFmode, n, y3)));
- /* v0 = n - d * u0 */
- emit_insn (gen_rtx_SET (VOIDmode, v0,
- gen_rtx_MINUS (DFmode, n,
- gen_rtx_MULT (DFmode, d, u0))));
- /* dst = u0 + v0 * y3 */
- emit_insn (gen_rtx_SET (VOIDmode, dst,
- gen_rtx_PLUS (DFmode,
- gen_rtx_MULT (DFmode, v0, y3), u0)));
-}
-
-
-/* Newton-Raphson approximation of single-precision floating point rsqrt.
- Assumes no trapping math and finite arguments. */
+
+ e0 = gen_reg_rtx (mode);
+ rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - d * x0 */
+
+ y1 = gen_reg_rtx (mode);
+ rs6000_emit_madd (y1, e0, x0, x0); /* y1 = x0 + e0 * x0 */
+
+ e1 = gen_reg_rtx (mode);
+ emit_insn (gen_mul (e1, e0, e0)); /* e1 = e0 * e0 */
+
+ y2 = gen_reg_rtx (mode);
+ rs6000_emit_madd (y2, e1, y1, y1); /* y2 = y1 + e1 * y1 */
+
+ e2 = gen_reg_rtx (mode);
+ emit_insn (gen_mul (e2, e1, e1)); /* e2 = e1 * e1 */
+
+ y3 = gen_reg_rtx (mode);
+ rs6000_emit_madd (y3, e2, y2, y2); /* y3 = y2 + e2 * y2 */
+
+ u0 = gen_reg_rtx (mode);
+ emit_insn (gen_mul (u0, n, y3)); /* u0 = n * y3 */
+
+ v0 = gen_reg_rtx (mode);
+ rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - d * u0 */
+
+ rs6000_emit_madd (dst, v0, y3, u0); /* dst = u0 + v0 * y3 */
+}
+
+/* Newton-Raphson approximation of floating point divide DST = N/D. If NOTE_P,
+ add a reg_note saying that this was a division. Support both scalar and
+ vector divide. Assumes no trapping math and finite arguments. */
void
-rs6000_emit_swrsqrtsf (rtx dst, rtx src)
-{
- rtx x0, x1, x2, y1, u0, u1, u2, v0, v1, v2, t0,
- half, one, halfthree, c1, cond, label;
-
- x0 = gen_reg_rtx (SFmode);
- x1 = gen_reg_rtx (SFmode);
- x2 = gen_reg_rtx (SFmode);
- y1 = gen_reg_rtx (SFmode);
- u0 = gen_reg_rtx (SFmode);
- u1 = gen_reg_rtx (SFmode);
- u2 = gen_reg_rtx (SFmode);
- v0 = gen_reg_rtx (SFmode);
- v1 = gen_reg_rtx (SFmode);
- v2 = gen_reg_rtx (SFmode);
- t0 = gen_reg_rtx (SFmode);
- halfthree = gen_reg_rtx (SFmode);
- cond = gen_rtx_REG (CCFPmode, CR1_REGNO);
- label = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
+rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p)
+{
+ enum machine_mode mode = GET_MODE (dst);
+
+ if (RS6000_RECIP_HIGH_PRECISION_P (mode))
+ rs6000_emit_swdiv_high_precision (dst, n, d);
+ else
+ rs6000_emit_swdiv_low_precision (dst, n, d);
+
+ if (note_p)
+ add_reg_note (get_last_insn (), REG_EQUAL, gen_rtx_DIV (mode, n, d));
+}
+
+/* Newton-Raphson approximation of single/double-precision floating point
+ rsqrt. Assumes no trapping math and finite arguments. */
- /* check 0.0, 1.0, NaN, Inf by testing src * src = src */
- emit_insn (gen_rtx_SET (VOIDmode, t0,
- gen_rtx_MULT (SFmode, src, src)));
+void
+rs6000_emit_swrsqrt (rtx dst, rtx src)
+{
+ enum machine_mode mode = GET_MODE (src);
+ rtx x0 = gen_reg_rtx (mode);
+ rtx y = gen_reg_rtx (mode);
+ int passes = (TARGET_RECIP_PRECISION) ? 2 : 3;
+ REAL_VALUE_TYPE dconst3_2;
+ int i;
+ rtx halfthree;
+ enum insn_code code = optab_handler (smul_optab, mode)->insn_code;
+ gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
- emit_insn (gen_rtx_SET (VOIDmode, cond,
- gen_rtx_COMPARE (CCFPmode, t0, src)));
- c1 = gen_rtx_EQ (VOIDmode, cond, const0_rtx);
- emit_unlikely_jump (c1, label);
+ gcc_assert (code != CODE_FOR_nothing);
- half = force_reg (SFmode, CONST_DOUBLE_FROM_REAL_VALUE (dconsthalf, SFmode));
- one = force_reg (SFmode, CONST_DOUBLE_FROM_REAL_VALUE (dconst1, SFmode));
+ /* Load up the constant 1.5 either as a scalar, or as a vector. */
+ real_from_integer (&dconst3_2, VOIDmode, 3, 0, 0);
+ SET_REAL_EXP (&dconst3_2, REAL_EXP (&dconst3_2) - 1);
- /* halfthree = 1.5 = 1.0 + 0.5 */
- emit_insn (gen_rtx_SET (VOIDmode, halfthree,
- gen_rtx_PLUS (SFmode, one, half)));
+ halfthree = rs6000_load_constant_and_splat (mode, dconst3_2);
/* x0 = rsqrt estimate */
emit_insn (gen_rtx_SET (VOIDmode, x0,
- gen_rtx_UNSPEC (SFmode, gen_rtvec (1, src),
+ gen_rtx_UNSPEC (mode, gen_rtvec (1, src),
UNSPEC_RSQRT)));
- /* y1 = 0.5 * src = 1.5 * src - src -> fewer constants */
- emit_insn (gen_rtx_SET (VOIDmode, y1,
- gen_rtx_MINUS (SFmode,
- gen_rtx_MULT (SFmode, src, halfthree),
- src)));
-
- /* x1 = x0 * (1.5 - y1 * (x0 * x0)) */
- emit_insn (gen_rtx_SET (VOIDmode, u0,
- gen_rtx_MULT (SFmode, x0, x0)));
- emit_insn (gen_rtx_SET (VOIDmode, v0,
- gen_rtx_MINUS (SFmode,
- halfthree,
- gen_rtx_MULT (SFmode, y1, u0))));
- emit_insn (gen_rtx_SET (VOIDmode, x1,
- gen_rtx_MULT (SFmode, x0, v0)));
-
- /* x2 = x1 * (1.5 - y1 * (x1 * x1)) */
- emit_insn (gen_rtx_SET (VOIDmode, u1,
- gen_rtx_MULT (SFmode, x1, x1)));
- emit_insn (gen_rtx_SET (VOIDmode, v1,
- gen_rtx_MINUS (SFmode,
- halfthree,
- gen_rtx_MULT (SFmode, y1, u1))));
- emit_insn (gen_rtx_SET (VOIDmode, x2,
- gen_rtx_MULT (SFmode, x1, v1)));
-
- /* dst = x2 * (1.5 - y1 * (x2 * x2)) */
- emit_insn (gen_rtx_SET (VOIDmode, u2,
- gen_rtx_MULT (SFmode, x2, x2)));
- emit_insn (gen_rtx_SET (VOIDmode, v2,
- gen_rtx_MINUS (SFmode,
- halfthree,
- gen_rtx_MULT (SFmode, y1, u2))));
- emit_insn (gen_rtx_SET (VOIDmode, dst,
- gen_rtx_MULT (SFmode, x2, v2)));
+ /* y = 0.5 * src = 1.5 * src - src -> fewer constants */
+ rs6000_emit_msub (y, src, halfthree, src);
- emit_label (XEXP (label, 0));
+ for (i = 0; i < passes; i++)
+ {
+ rtx x1 = gen_reg_rtx (mode);
+ rtx u = gen_reg_rtx (mode);
+ rtx v = gen_reg_rtx (mode);
+
+ /* x1 = x0 * (1.5 - y * (x0 * x0)) */
+ emit_insn (gen_mul (u, x0, x0));
+ rs6000_emit_nmsub (v, y, u, halfthree);
+ emit_insn (gen_mul (x1, x0, v));
+ x0 = x1;
+ }
+
+ emit_move_insn (dst, x0);
+ return;
}
/* Emit popcount intrinsic on TARGET_POPCNTB (Power5) and TARGET_POPCNTD
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 10709642e82..cf5aa4deaf2 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -293,6 +293,18 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define TARGET_SECURE_PLT 0
#endif
+/* Code model for 64-bit linux.
+ small: 16-bit toc offsets.
+ large: 32-bit toc offsets. */
+enum rs6000_cmodel {
+ CMODEL_SMALL,
+ CMODEL_LARGE
+};
+
+#ifndef TARGET_CMODEL
+#define TARGET_CMODEL CMODEL_SMALL
+#endif
+
#define TARGET_32BIT (! TARGET_64BIT)
#ifndef HAVE_AS_TLS
@@ -348,7 +360,8 @@ enum processor_type
PROCESSOR_POWER6,
PROCESSOR_POWER7,
PROCESSOR_CELL,
- PROCESSOR_PPCA2
+ PROCESSOR_PPCA2,
+ PROCESSOR_TITAN
};
/* FPU operations supported.
@@ -543,6 +556,46 @@ extern int rs6000_vector_align[];
/* E500 processors only support plain "sync", not lwsync. */
#define TARGET_NO_LWSYNC TARGET_E500
+/* Which machine supports the various reciprocal estimate instructions. */
+#define TARGET_FRES (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \
+ && TARGET_FPRS && TARGET_SINGLE_FLOAT)
+
+#define TARGET_FRE (TARGET_HARD_FLOAT && TARGET_FPRS \
+ && TARGET_DOUBLE_FLOAT \
+ && (TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)))
+
+#define TARGET_FRSQRTES (TARGET_HARD_FLOAT && TARGET_POPCNTB \
+ && TARGET_FPRS && TARGET_SINGLE_FLOAT)
+
+#define TARGET_FRSQRTE (TARGET_HARD_FLOAT && TARGET_FPRS \
+ && TARGET_DOUBLE_FLOAT \
+ && (TARGET_PPC_GFXOPT || VECTOR_UNIT_VSX_P (DFmode)))
+
+/* Whether the various reciprocal divide/square root estimate instructions
+ exist, and whether we should automatically generate code for the instruction
+ by default. */
+#define RS6000_RECIP_MASK_HAVE_RE 0x1 /* have RE instruction. */
+#define RS6000_RECIP_MASK_AUTO_RE 0x2 /* generate RE by default. */
+#define RS6000_RECIP_MASK_HAVE_RSQRTE 0x4 /* have RSQRTE instruction. */
+#define RS6000_RECIP_MASK_AUTO_RSQRTE 0x8 /* gen. RSQRTE by default. */
+
+extern unsigned char rs6000_recip_bits[];
+
+#define RS6000_RECIP_HAVE_RE_P(MODE) \
+ (rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_HAVE_RE)
+
+#define RS6000_RECIP_AUTO_RE_P(MODE) \
+ (rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_AUTO_RE)
+
+#define RS6000_RECIP_HAVE_RSQRTE_P(MODE) \
+ (rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_HAVE_RSQRTE)
+
+#define RS6000_RECIP_AUTO_RSQRTE_P(MODE) \
+ (rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_AUTO_RSQRTE)
+
+#define RS6000_RECIP_HIGH_PRECISION_P(MODE) \
+ ((MODE) == SFmode || (MODE) == V4SFmode || TARGET_RECIP_PRECISION)
+
/* Sometimes certain combinations of command options do not make sense
on a particular target machine. You can define a macro
`OVERRIDE_OPTIONS' to take account of this. This macro, if
@@ -1525,15 +1578,6 @@ extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */
found in the variable crtl->outgoing_args_size. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index bcb66ec1479..02602a1f661 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -140,7 +140,7 @@
;; Processor type -- this attribute must exactly match the processor_type
;; enumeration in rs6000.h.
-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2"
+(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
(const (symbol_ref "rs6000_cpu_attr")))
@@ -175,6 +175,7 @@
(include "cell.md")
(include "xfpu.md")
(include "a2.md")
+(include "titan.md")
(include "predicates.md")
(include "constraints.md")
@@ -218,7 +219,11 @@
(TD "TARGET_DFP")])
; These modes do not fit in integer registers in 32-bit mode.
-(define_mode_iterator DIFD [DI DF DD])
+; but on e500v2, the gpr are 64 bit registers
+(define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
+
+;; Iterator for reciprocal estimate instructions
+(define_mode_iterator RECIPF [SF DF V4SF V2DF])
; Various instructions that come in SI and DI forms.
; A generic w/d attribute, for things like cmpw/cmpd.
@@ -240,6 +245,11 @@
(define_mode_attr mptrsize [(SI "si")
(DI "di")])
+(define_mode_attr rreg [(SF "f")
+ (DF "Ws")
+ (V4SF "Wf")
+ (V2DF "Wd")])
+
;; Start with fixed-point load and store insns. Here we put only the more
;; complex forms. Basic data transfer is done later.
@@ -5563,6 +5573,45 @@
[(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
(set_attr "length" "4,4,8,8")])
+;; Builtins to replace a division to generate FRE reciprocal estimate
+;; instructions and the necessary fixup instructions
+(define_expand "recip<mode>3"
+ [(match_operand:RECIPF 0 "gpc_reg_operand" "")
+ (match_operand:RECIPF 1 "gpc_reg_operand" "")
+ (match_operand:RECIPF 2 "gpc_reg_operand" "")]
+ "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
+{
+ rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
+ DONE;
+})
+
+;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
+;; hardware division. This is only done before register allocation and with
+;; -ffast-math. This must appear before the divsf3/divdf3 insns.
+(define_split
+ [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
+ (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
+ (match_operand 2 "gpc_reg_operand" "")))]
+ "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
+ && can_create_pseudo_p () && optimize_insn_for_speed_p ()
+ && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
+ [(const_int 0)]
+{
+ rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
+ DONE;
+})
+
+;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
+;; appropriate fixup.
+(define_expand "rsqrt<mode>2"
+ [(match_operand:RECIPF 0 "gpc_reg_operand" "")
+ (match_operand:RECIPF 1 "gpc_reg_operand" "")]
+ "RS6000_RECIP_HAVE_RSQRT_P (<MODE>mode)"
+{
+ rs6000_emit_swrsqrt (operands[0], operands[1]);
+ DONE;
+})
+
(define_split
[(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
(compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
@@ -5766,22 +5815,10 @@
"{fd|fdiv} %0,%1,%2"
[(set_attr "type" "ddiv")])
-(define_expand "recipsf3"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")
- (match_operand:SF 2 "gpc_reg_operand" "f")]
- UNSPEC_FRES))]
- "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
- && flag_finite_math_only && !flag_trapping_math"
-{
- rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
- DONE;
-})
-
(define_insn "fres"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
(unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
- "TARGET_PPC_GFXOPT && flag_finite_math_only"
+ "TARGET_FRES"
"fres %0,%1"
[(set_attr "type" "fp")])
@@ -5931,23 +5968,12 @@
"fsqrt %0,%1"
[(set_attr "type" "dsqrt")])
-(define_expand "rsqrtsf2"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
- UNSPEC_RSQRT))]
- "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
- && flag_finite_math_only && !flag_trapping_math"
-{
- rs6000_emit_swrsqrtsf (operands[0], operands[1]);
- DONE;
-})
-
-(define_insn "*rsqrt_internal1"
+(define_insn "*rsqrtsf_internal1"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
(unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
UNSPEC_RSQRT))]
- "TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT"
- "frsqrte %0,%1"
+ "TARGET_FRSQRTES"
+ "frsqrtes %0,%1"
[(set_attr "type" "fp")])
(define_expand "copysignsf3"
@@ -5960,9 +5986,18 @@
(match_dup 5))
(match_dup 3)
(match_dup 4)))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
- && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
+ && ((TARGET_PPC_GFXOPT
+ && !HONOR_NANS (SFmode)
+ && !HONOR_SIGNED_ZEROS (SFmode))
+ || VECTOR_UNIT_VSX_P (DFmode))"
{
+ if (VECTOR_UNIT_VSX_P (DFmode))
+ {
+ emit_insn (gen_vsx_copysignsf3 (operands[0], operands[1], operands[2],
+ CONST0_RTX (SFmode)));
+ DONE;
+ }
operands[3] = gen_reg_rtx (SFmode);
operands[4] = gen_reg_rtx (SFmode);
operands[5] = CONST0_RTX (SFmode);
@@ -6222,31 +6257,21 @@
"{fd|fdiv} %0,%1,%2"
[(set_attr "type" "ddiv")])
-(define_expand "recipdf3"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")
- (match_operand:DF 2 "gpc_reg_operand" "d")]
- UNSPEC_FRES))]
- "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
- && flag_finite_math_only && !flag_trapping_math"
-{
- rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
- DONE;
-})
-
-(define_expand "fred"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRES))]
- "(TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)) && flag_finite_math_only"
- "")
-
(define_insn "*fred_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=f")
(unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
- "TARGET_POPCNTB && flag_finite_math_only && !VECTOR_UNIT_VSX_P (DFmode)"
+ "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
"fre %0,%1"
[(set_attr "type" "fp")])
+(define_insn "*rsqrtdf_internal1"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
+ UNSPEC_RSQRT))]
+ "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
+ "frsqrte %0,%1"
+ [(set_attr "type" "fp")])
+
(define_insn "*fmadddf4_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
@@ -10980,7 +11005,12 @@
UNSPEC_TLSGD)
(clobber (reg:SI LR_REGNO))]
"HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
- "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
+{
+ if (TARGET_CMODEL != CMODEL_SMALL)
+ return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
+ else
+ return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
+}
"&& TARGET_TLS_MARKERS"
[(set (match_dup 0)
(unspec:TLSmode [(match_dup 1)
@@ -10993,7 +11023,10 @@
(clobber (reg:SI LR_REGNO))])]
""
[(set_attr "type" "two")
- (set_attr "length" "12")])
+ (set (attr "length")
+ (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
+ (const_int 16)
+ (const_int 12)))])
(define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
@@ -11029,13 +11062,47 @@
[(set_attr "type" "two")
(set_attr "length" "8")])
-(define_insn "*tls_gd<TLSmode:tls_abi_suffix>"
+(define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
(unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGD))]
"HAVE_AS_TLS && TARGET_TLS_MARKERS"
"addi %0,%1,%2@got@tlsgd"
+ "&& TARGET_CMODEL != CMODEL_SMALL"
+ [(set (match_dup 3)
+ (plus:TLSmode (match_dup 1)
+ (high:TLSmode
+ (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD))))
+ (set (match_dup 0)
+ (lo_sum:TLSmode (match_dup 3)
+ (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
+ "
+{
+ operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
+}"
+ [(set (attr "length")
+ (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
+ (const_int 8)
+ (const_int 4)))])
+
+(define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
+ (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (high:TLSmode
+ (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+ UNSPEC_TLSGD))))]
+ "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
+ "addis %0,%1,%2@got@tlsgd@ha"
+ [(set_attr "length" "4")])
+
+(define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
+ (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+ UNSPEC_TLSGD)))]
+ "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
+ "addi %0,%1,%2@got@tlsgd@l"
[(set_attr "length" "4")])
(define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
@@ -11078,7 +11145,12 @@
UNSPEC_TLSLD)
(clobber (reg:SI LR_REGNO))]
"HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
- "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
+{
+ if (TARGET_CMODEL != CMODEL_SMALL)
+ return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
+ else
+ return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
+}
"&& TARGET_TLS_MARKERS"
[(set (match_dup 0)
(unspec:TLSmode [(match_dup 1)]
@@ -11089,7 +11161,11 @@
(unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
(clobber (reg:SI LR_REGNO))])]
""
- [(set_attr "length" "12")])
+ [(set_attr "type" "two")
+ (set (attr "length")
+ (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
+ (const_int 16)
+ (const_int 12)))])
(define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
@@ -11122,12 +11198,44 @@
""
[(set_attr "length" "8")])
-(define_insn "*tls_ld<TLSmode:tls_abi_suffix>"
+(define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
(unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
UNSPEC_TLSLD))]
"HAVE_AS_TLS && TARGET_TLS_MARKERS"
"addi %0,%1,%&@got@tlsld"
+ "&& TARGET_CMODEL != CMODEL_SMALL"
+ [(set (match_dup 2)
+ (plus:TLSmode (match_dup 1)
+ (high:TLSmode
+ (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))
+ (set (match_dup 0)
+ (lo_sum:TLSmode (match_dup 2)
+ (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
+ "
+{
+ operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
+}"
+ [(set (attr "length")
+ (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
+ (const_int 8)
+ (const_int 4)))])
+
+(define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
+ (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (high:TLSmode
+ (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))]
+ "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
+ "addis %0,%1,%&@got@tlsld@ha"
+ [(set_attr "length" "4")])
+
+(define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
+ (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
+ "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
+ "addi %0,%1,%&@got@tlsld@l"
[(set_attr "length" "4")])
(define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
@@ -11184,13 +11292,48 @@
"HAVE_AS_TLS"
"addi %0,%1,%2@dtprel@l")
-(define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
+(define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
(unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGOTDTPREL))]
"HAVE_AS_TLS"
- "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
+ "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
+ "&& TARGET_CMODEL != CMODEL_SMALL"
+ [(set (match_dup 3)
+ (plus:TLSmode (match_dup 1)
+ (high:TLSmode
+ (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL))))
+ (set (match_dup 0)
+ (lo_sum:TLSmode (match_dup 3)
+ (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
+ "
+{
+ operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
+}"
+ [(set (attr "length")
+ (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
+ (const_int 8)
+ (const_int 4)))])
+
+(define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
+ (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (high:TLSmode
+ (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+ UNSPEC_TLSGOTDTPREL))))]
+ "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
+ "addis %0,%1,%2@got@dtprel@ha"
+ [(set_attr "length" "4")])
+
+(define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
+ (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+ UNSPEC_TLSGOTDTPREL)))]
+ "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
+ "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
+ [(set_attr "length" "4")])
(define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
@@ -11219,13 +11362,48 @@
;; "b" output constraint here and on tls_tls input to support linker tls
;; optimization. The linker may edit the instructions emitted by a
;; tls_got_tprel/tls_tls pair to addis,addi.
-(define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
+(define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
(unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGOTTPREL))]
"HAVE_AS_TLS"
- "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
+ "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
+ "&& TARGET_CMODEL != CMODEL_SMALL"
+ [(set (match_dup 3)
+ (plus:TLSmode (match_dup 1)
+ (high:TLSmode
+ (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL))))
+ (set (match_dup 0)
+ (lo_sum:TLSmode (match_dup 3)
+ (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
+ "
+{
+ operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
+}"
+ [(set (attr "length")
+ (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
+ (const_int 8)
+ (const_int 4)))])
+
+(define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
+ (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (high:TLSmode
+ (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+ UNSPEC_TLSGOTTPREL))))]
+ "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
+ "addis %0,%1,%2@got@tprel@ha"
+ [(set_attr "length" "4")])
+
+(define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
+ [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
+ (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
+ (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+ UNSPEC_TLSGOTTPREL)))]
+ "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
+ "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
+ [(set_attr "length" "4")])
(define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
@@ -11234,7 +11412,6 @@
UNSPEC_TLSTLS))]
"HAVE_AS_TLS"
"add %0,%1,%2@tls")
-
;; Next come insns related to the calling sequence.
;;
@@ -11436,10 +11613,12 @@
(define_insn "load_toc_v4_PIC_1b"
[(set (reg:SI LR_REGNO)
- (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
- UNSPEC_TOCPTR))]
+ (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
+ (label_ref (match_operand 1 "" ""))]
+ UNSPEC_TOCPTR))
+ (match_dup 1)]
"TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
- "bcl 20,31,$+8\\n\\t.long %0-$"
+ "bcl 20,31,$+8\;.long %0-$"
[(set_attr "type" "branch")
(set_attr "length" "8")])
@@ -11522,6 +11701,21 @@
"@
{cal|la} %0,%2@l(%1)
{ai|addic} %0,%1,%K2")
+
+;; Largetoc support
+(define_insn "largetoc_high"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
+ (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
+ (high:DI (match_operand:DI 2 "" ""))))]
+ "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
+ "{cau|addis} %0,%1,%2@ha")
+
+(define_insn "largetoc_low"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
+ (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
+ (match_operand:DI 2 "" "")))]
+ "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
+ "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
;; A function pointer under AIX is a pointer to a data area whose first word
;; contains the actual address of the function, whose second word contains a
@@ -12796,26 +12990,27 @@
(clobber (match_scratch:DF 7 "=d"))
(clobber (match_scratch:DF 8 "=d"))
(clobber (match_scratch:DF 9 "=d"))
- (clobber (match_scratch:DF 10 "=d"))]
+ (clobber (match_scratch:DF 10 "=d"))
+ (clobber (match_scratch:GPR 11 "=b"))]
"!TARGET_IEEEQUAD && TARGET_XL_COMPAT
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
"#"
"&& reload_completed"
- [(set (match_dup 3) (match_dup 13))
- (set (match_dup 4) (match_dup 14))
+ [(set (match_dup 3) (match_dup 14))
+ (set (match_dup 4) (match_dup 15))
(set (match_dup 9) (abs:DF (match_dup 5)))
(set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
(set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
- (label_ref (match_dup 11))
+ (label_ref (match_dup 12))
(pc)))
(set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
- (set (pc) (label_ref (match_dup 12)))
- (match_dup 11)
+ (set (pc) (label_ref (match_dup 13)))
+ (match_dup 12)
(set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
(set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
(set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
(set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
- (match_dup 12)]
+ (match_dup 13)]
{
REAL_VALUE_TYPE rv;
const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
@@ -12825,22 +13020,23 @@
operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
- operands[11] = gen_label_rtx ();
operands[12] = gen_label_rtx ();
+ operands[13] = gen_label_rtx ();
real_inf (&rv);
- operands[13] = force_const_mem (DFmode,
- CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
operands[14] = force_const_mem (DFmode,
+ CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
+ operands[15] = force_const_mem (DFmode,
CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
DFmode));
if (TARGET_TOC)
{
- operands[13] = gen_const_mem (DFmode,
- create_TOC_reference (XEXP (operands[13], 0)));
- operands[14] = gen_const_mem (DFmode,
- create_TOC_reference (XEXP (operands[14], 0)));
- set_mem_alias_set (operands[13], get_TOC_alias_set ());
+ rtx tocref;
+ tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
+ operands[14] = gen_const_mem (DFmode, tocref);
+ tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
+ operands[15] = gen_const_mem (DFmode, tocref);
set_mem_alias_set (operands[14], get_TOC_alias_set ());
+ set_mem_alias_set (operands[15], get_TOC_alias_set ());
}
})
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 63f0f8c1582..e70172a19a6 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -195,8 +195,16 @@ Target Report Var(TARGET_XL_COMPAT)
Conform more closely to IBM XLC semantics
mrecip
-Target Report Var(TARGET_RECIP)
-Generate software reciprocal sqrt for better throughput
+Target Report
+Generate software reciprocal divide and square root for better throughput.
+
+mrecip=
+Target Report RejectNegative Joined
+Generate software reciprocal divide and square root for better throughput.
+
+mrecip-precision
+Target Report Mask(RECIP_PRECISION)
+Assume that the reciprocal estimate instructions provide more accuracy.
mno-fp-in-toc
Target Report RejectNegative Var(TARGET_NO_FP_IN_TOC)
diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
index 773d710fa3f..8066c890eb1 100644
--- a/gcc/config/rs6000/t-rs6000
+++ b/gcc/config/rs6000/t-rs6000
@@ -32,7 +32,7 @@ rs6000.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \
$(srcdir)/config/rs6000/rs6000-protos.h \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPPLIB_H) \
- $(TM_P_H) c-pragma.h errors.h coretypes.h $(TM_H)
+ $(TM_P_H) $(C_PRAGMA_H) errors.h coretypes.h $(TM_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/rs6000/rs6000-c.c
diff --git a/gcc/config/rs6000/titan.md b/gcc/config/rs6000/titan.md
new file mode 100644
index 00000000000..744d7770f28
--- /dev/null
+++ b/gcc/config/rs6000/titan.md
@@ -0,0 +1,171 @@
+;; Pipeline description for the AppliedMicro Titan core.
+;; Copyright (C) 2010 Free Software Foundation, Inc.
+;; Contributed by Theobroma Systems Design und Consulting GmbH
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 3, or (at your
+;; option) any later version.
+;;
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+;; AppliedMicro Titan core complex
+
+(automata_option "progress")
+
+(define_automaton "titan_core,titan_fpu,titan_fxu,titan_bpu,titan_lsu")
+(define_cpu_unit "titan_issue_0,titan_issue_1" "titan_core")
+
+;; Some useful abbreviations.
+(define_reservation "titan_issue" "titan_issue_0|titan_issue_1")
+
+;; === FXU scheduling ===
+
+(define_cpu_unit "titan_fxu_sh,titan_fxu_wb" "titan_fxu")
+
+;; The 1-cycle adder executes add, addi, subf, neg, compare and trap
+;; instructions. It provides its own, dedicated result-bus, so we
+;; don't need the titan_fxu_wb reservation to complete.
+(define_insn_reservation "titan_fxu_adder" 1
+ (and (eq_attr "type" "cmp,fast_compare,trap")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fxu_sh")
+
+;; Keep the titan_imul and titan_mulhw (half-word) rules in order, to
+;; ensure the proper match: the half-word instructions are tagged as
+;; imul3 only, whereas regular multiplys will always carry a imul tag.
+
+(define_insn_reservation "titan_imul" 5
+ (and (eq_attr "type" "imul,imul2,imul_compare")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fxu_sh,nothing*5,titan_fxu_wb")
+
+(define_insn_reservation "titan_mulhw" 4
+ (and (eq_attr "type" "imul3")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fxu_sh,nothing*4,titan_fxu_wb")
+
+(define_bypass 2 "titan_mulhw" "titan_mulhw")
+
+(define_insn_reservation "titan_fxu_shift_and_rotate" 2
+ (and (eq_attr "type" "insert_word,shift,var_shift_rotate,cntlz")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fxu_sh,nothing*2,titan_fxu_wb")
+
+;; We model the divider for the worst-case (i.e. a full 32-bit
+;; divide). To model the bypass for byte-wise completion, a
+;; define_bypass with a guard-function could be used... however, this
+;; would be an optimization of doubtful value, as a large number of
+;; divides will operate on 32-bit variables.
+
+;; To avoid an unmanagably large automata (generating the automata
+;; would require well over 2GB in memory), we don't model the shared
+;; result bus on this one. The divider-pipeline is thus modeled
+;; through its latency and initial disptach bottlenecks (i.e. issue
+;; slots and fxu scheduler availability)
+(define_insn_reservation "titan_fxu_div" 34
+ (and (eq_attr "type" "idiv")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fxu_sh")
+
+(define_insn_reservation "titan_fxu_alu" 1
+ (and (eq_attr "type" "integer,exts")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fxu_sh,nothing,titan_fxu_wb")
+
+;; === BPU scheduling ===
+
+(define_cpu_unit "titan_bpu_sh" "titan_bpu")
+
+(define_insn_reservation "titan_bpu" 2
+ (and (eq_attr "type" "branch,jmpreg,cr_logical,delayed_cr")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_bpu_sh")
+
+;; === LSU scheduling ===
+
+(define_cpu_unit "titan_lsu_sh" "titan_lsu")
+
+;; Loads.
+(define_insn_reservation "titan_lsu_load" 3
+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
+ load_l,sync")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_lsu_sh")
+
+(define_insn_reservation "titan_lsu_fpload" 12
+ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_lsu_sh")
+
+;; Note that the isync is not clearly placed within any execution
+;; unit. We've made the assumption that it will be running out of the
+;; LSU, as msync is also executed within the LSU.
+(define_insn_reservation "titan_lsu_sync" 20
+ (and (eq_attr "type" "sync")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_lsu_sh*20")
+
+;; Stores.
+(define_insn_reservation "titan_lsu_store" 12
+ (and (eq_attr "type" "store,store_ux,store_u,store_c")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_lsu_sh")
+
+(define_insn_reservation "titan_lsu_fpstore" 12
+ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_lsu_sh")
+
+;; === FPU scheduling ===
+
+;; In order to keep the automaton for the Titan FPU efficient and
+;; maintainable, we've kept in as concise as possible and created a
+;; mapping for the main "choke points" only instead of modelling the
+;; overall flow of instructions through the FP-pipeline(s).
+
+;; The key elements modelled are:
+;; * each FP-instruction takes up one of the two issue slots
+;; * the FPU runs at half the core frequency
+;; * divides are not pipelined (but execute in a separate unit)
+;; * the FPU has a shared result bus for all its units
+
+(define_cpu_unit "titan_fp0,titan_fpdiv,titan_fpwb" "titan_fpu")
+
+(define_insn_reservation "titan_fp_div_double" 72
+ (and (eq_attr "type" "ddiv")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fpdiv*72,titan_fpwb")
+
+(define_insn_reservation "titan_fp_div_single" 46
+ (and (eq_attr "type" "sdiv")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fpdiv*46,titan_fpwb")
+
+(define_insn_reservation "titan_fp_single" 12
+ (and (eq_attr "fp_type" "fp_addsub_s,fp_mul_s,fp_maddsub_s")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fp0*2,nothing*10,titan_fpwb")
+
+;; Make sure the "titan_fp" rule stays last, as it's a catch all for
+;; double-precision and unclassified (e.g. fsel) FP-instructions
+(define_insn_reservation "titan_fp" 10
+ (and (eq_attr "type" "fpcompare,fp,dmul")
+ (eq_attr "cpu" "titan"))
+ "titan_issue,titan_fp0*2,nothing*8,titan_fpwb")
+
+;; Please note, that the non-pipelined FP-instructions "mcrfs",
+;; "mtfsb0[.]", "mtfsb1[.]", "mtfsf[.]", "mtfsfi[.]" are not
+;; accessible from regular language constructs (i.e. they are not used
+;; by the code generator, except for special purpose sequences defined
+;; in rs6000.md), no special provisions are made for these.
+
diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index 46fb2926c9f..760baeb458d 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -267,6 +267,20 @@
"VECTOR_UNIT_VSX_P (<MODE>mode)"
"")
+(define_expand "rsqrte<mode>2"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (unspec:VEC_F [(match_operand:VEC_F 1 "vfloat_operand" "")]
+ UNSPEC_RSQRT))]
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
+ "")
+
+(define_expand "re<mode>2"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (unspec:VEC_F [(match_operand:VEC_F 1 "vfloat_operand" "f")]
+ UNSPEC_FRES))]
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
+ "")
+
(define_expand "ftrunc<mode>2"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(fix:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")))]
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 7d572a48412..213d53ae5d1 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -195,7 +195,7 @@
(UNSPEC_VSX_MSUB 511)
(UNSPEC_VSX_NMADD 512)
(UNSPEC_VSX_NMSUB 513)
- (UNSPEC_VSX_RSQRTE 514)
+ ;; 514 deleted
(UNSPEC_VSX_TDIV 515)
(UNSPEC_VSX_TSQRT 516)
(UNSPEC_VSX_XXPERMDI 517)
@@ -446,10 +446,10 @@
[(set_attr "type" "<VStype_sqrt>")
(set_attr "fp_type" "<VSfptype_sqrt>")])
-(define_insn "vsx_rsqrte<mode>2"
+(define_insn "*vsx_rsqrte<mode>2"
[(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
(unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
- UNSPEC_VSX_RSQRTE))]
+ UNSPEC_RSQRT))]
"VECTOR_UNIT_VSX_P (<MODE>mode)"
"x<VSv>rsqrte<VSs> %x0,%x1"
[(set_attr "type" "<VStype_simple>")
@@ -862,6 +862,20 @@
[(set_attr "type" "<VStype_simple>")
(set_attr "fp_type" "<VSfptype_simple>")])
+;; Special version of copysign for single precision that knows internally
+;; scalar single values are kept as double
+(define_insn "vsx_copysignsf3"
+ [(set (match_operand:SF 0 "vsx_register_operand" "=f")
+ (if_then_else:SF
+ (ge:SF (match_operand:SF 2 "vsx_register_operand" "f")
+ (match_operand:SF 3 "zero_constant" "j"))
+ (abs:SF (match_operand:SF 1 "vsx_register_operand" "f"))
+ (neg:SF (abs:SF (match_dup 1)))))]
+ "VECTOR_UNIT_VSX_P (DFmode)"
+ "xscpsgndp %x0,%x2,%x1"
+ [(set_attr "type" "fp")
+ (set_attr "fp_type" "fp_addsub_d")])
+
;; For the conversions, limit the register class for the integer value to be
;; the fprs because we don't want to add the altivec registers to movdi/movsi.
;; For the unsigned tests, there isn't a generic double -> unsigned conversion
diff --git a/gcc/config/rx/constraints.md b/gcc/config/rx/constraints.md
index 52bf7df3621..b4b037d1a26 100644
--- a/gcc/config/rx/constraints.md
+++ b/gcc/config/rx/constraints.md
@@ -63,6 +63,13 @@
)
)
+(define_constraint "NEGint4"
+ "@internal An signed 4-bit negative immediate value"
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -15, -1)")
+ )
+)
+
;; This is used in arithmetic and logic instructions for
;; a source operand that lies in memory and which satisfies
;; rx_restricted_memory_address().
diff --git a/gcc/config/rx/predicates.md b/gcc/config/rx/predicates.md
index d7a363ebb88..94e5f5630c2 100644
--- a/gcc/config/rx/predicates.md
+++ b/gcc/config/rx/predicates.md
@@ -50,9 +50,9 @@
;; and a restricted subset of memory addresses are allowed.
(define_predicate "rx_source_operand"
- (match_code "const_int,reg,mem")
+ (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem")
{
- if (CONST_INT_P (op))
+ if (CONSTANT_P (op))
return rx_is_legitimate_constant (op);
if (! MEM_P (op))
diff --git a/gcc/config/rx/rx-modes.def b/gcc/config/rx/rx-modes.def
new file mode 100644
index 00000000000..5936b672b6b
--- /dev/null
+++ b/gcc/config/rx/rx-modes.def
@@ -0,0 +1,26 @@
+/* Definitions of target machine for GNU compiler, for ARM.
+ Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
+ Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
+ and Martin Simmons (@harleqn.co.uk).
+ More major hacks by Richard Earnshaw (rearnsha@arm.com)
+ Minor hacks by Nick Clifton (nickc@cygnus.com)
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+CC_MODE (CC_ZS);
+CC_MODE (CC_ZSO);
+CC_MODE (CC_ZSC);
diff --git a/gcc/config/rx/rx-protos.h b/gcc/config/rx/rx-protos.h
index f5ef51108e1..166290de5e7 100644
--- a/gcc/config/rx/rx-protos.h
+++ b/gcc/config/rx/rx-protos.h
@@ -31,6 +31,7 @@ extern int rx_initial_elimination_offset (int, int);
extern void rx_set_optimization_options (void);
#ifdef RTX_CODE
+extern bool rx_compare_redundant (rtx);
extern void rx_emit_stack_popm (rtx *, bool);
extern void rx_emit_stack_pushm (rtx *);
extern void rx_expand_epilogue (bool);
@@ -41,8 +42,6 @@ extern bool rx_is_legitimate_constant (rtx);
extern bool rx_is_mode_dependent_addr (rtx);
extern bool rx_is_restricted_memory_address (rtx, Mmode);
extern void rx_notice_update_cc (rtx body, rtx insn);
-extern void rx_print_operand (FILE *, rtx, int);
-extern void rx_print_operand_address (FILE *, rtx);
#endif
#ifdef TREE_CODE
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index b5a887b64eb..2219efe8559 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -50,6 +50,8 @@
#include "target-def.h"
#include "langhooks.h"
+static void rx_print_operand (FILE *, rtx, int);
+
enum rx_cpu_types rx_cpu_type = RX600;
/* Return true if OP is a reference to an object in a small data area. */
@@ -254,7 +256,7 @@ rx_is_mode_dependent_addr (rtx addr)
assembler syntax for an instruction operand that is a memory
reference whose address is ADDR. */
-void
+static void
rx_print_operand_address (FILE * file, rtx addr)
{
switch (GET_CODE (addr))
@@ -362,10 +364,11 @@ int rx_float_compare_mode;
%F Print a condition code flag name.
%H Print high part of a DImode register, integer or address.
%L Print low part of a DImode register, integer or address.
+ %N Print the negation of the immediate value.
%Q If the operand is a MEM, then correctly generate
register indirect or register relative addressing. */
-void
+static void
rx_print_operand (FILE * file, rtx op, int letter)
{
switch (letter)
@@ -422,7 +425,7 @@ rx_print_operand (FILE * file, rtx op, int letter)
case 0xc: fprintf (file, "intb"); break;
default:
warning (0, "unreocgnized control register number: %d - using 'psw'",
- INTVAL (op));
+ (int) INTVAL (op));
fprintf (file, "psw");
break;
}
@@ -444,46 +447,66 @@ rx_print_operand (FILE * file, rtx op, int letter)
break;
case 'H':
- if (REG_P (op))
- fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 0 : 1)]);
- else if (CONST_INT_P (op))
+ switch (GET_CODE (op))
{
- HOST_WIDE_INT v = INTVAL (op);
+ case REG:
+ fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 0 : 1)]);
+ break;
+ case CONST_INT:
+ {
+ HOST_WIDE_INT v = INTVAL (op);
+ fprintf (file, "#");
+ /* Trickery to avoid problems with shifting 32 bits at a time. */
+ v = v >> 16;
+ v = v >> 16;
+ rx_print_integer (file, v);
+ break;
+ }
+ case CONST_DOUBLE:
fprintf (file, "#");
- /* Trickery to avoid problems with shifting 32 bits at a time. */
- v = v >> 16;
- v = v >> 16;
- rx_print_integer (file, v);
- }
- else
- {
- gcc_assert (MEM_P (op));
-
+ rx_print_integer (file, CONST_DOUBLE_HIGH (op));
+ break;
+ case MEM:
if (! WORDS_BIG_ENDIAN)
op = adjust_address (op, SImode, 4);
output_address (XEXP (op, 0));
+ break;
+ default:
+ gcc_unreachable ();
}
break;
case 'L':
- if (REG_P (op))
- fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 1 : 0)]);
- else if (CONST_INT_P (op))
+ switch (GET_CODE (op))
{
+ case REG:
+ fprintf (file, "%s", reg_names [REGNO (op) + (WORDS_BIG_ENDIAN ? 1 : 0)]);
+ break;
+ case CONST_INT:
fprintf (file, "#");
rx_print_integer (file, INTVAL (op) & 0xffffffff);
- }
- else
- {
- gcc_assert (MEM_P (op));
-
+ break;
+ case CONST_DOUBLE:
+ fprintf (file, "#");
+ rx_print_integer (file, CONST_DOUBLE_LOW (op));
+ break;
+ case MEM:
if (WORDS_BIG_ENDIAN)
op = adjust_address (op, SImode, 4);
output_address (XEXP (op, 0));
+ break;
+ default:
+ gcc_unreachable ();
}
break;
+ case 'N':
+ gcc_assert (CONST_INT_P (op));
+ fprintf (file, "#");
+ rx_print_integer (file, - INTVAL (op));
+ break;
+
case 'Q':
if (MEM_P (op))
{
@@ -628,7 +651,7 @@ rx_print_operand (FILE * file, rtx op, int letter)
char *
rx_gen_move_template (rtx * operands, bool is_movu)
{
- static char template [64];
+ static char out_template [64];
const char * extension = TARGET_AS100_SYNTAX ? ".L" : "";
const char * src_template;
const char * dst_template;
@@ -672,9 +695,9 @@ rx_gen_move_template (rtx * operands, bool is_movu)
else
dst_template = "%0";
- sprintf (template, "%s%s\t%s, %s", is_movu ? "movu" : "mov",
+ sprintf (out_template, "%s%s\t%s, %s", is_movu ? "movu" : "mov",
extension, src_template, dst_template);
- return template;
+ return out_template;
}
/* Returns an assembler template for a conditional branch instruction. */
@@ -684,13 +707,6 @@ rx_gen_cond_branch_template (rtx condition, bool reversed)
{
enum rtx_code code = GET_CODE (condition);
-
- if ((cc_status.flags & CC_NO_OVERFLOW) && ! rx_float_compare_mode)
- gcc_assert (code != GT && code != GE && code != LE && code != LT);
-
- if ((cc_status.flags & CC_NO_CARRY) || rx_float_compare_mode)
- gcc_assert (code != GEU && code != GTU && code != LEU && code != LTU);
-
if (reversed)
{
if (rx_float_compare_mode)
@@ -771,6 +787,9 @@ rx_function_arg (Fargs * cum, Mmode mode, const_tree type, bool named)
/* An exploded version of rx_function_arg_size. */
size = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
+ /* If the size is not known it cannot be passed in registers. */
+ if (size < 1)
+ return NULL_RTX;
rounded_size = rx_round_up (size, UNITS_PER_WORD);
@@ -1038,7 +1057,7 @@ rx_get_stack_layout (unsigned int * lowest,
return;
}
- for (save_mask = high = low = 0, reg = 1; reg < FIRST_PSEUDO_REGISTER; reg++)
+ for (save_mask = high = low = 0, reg = 1; reg < CC_REGNUM; reg++)
{
if (df_regs_ever_live_p (reg)
&& (! call_used_regs[reg]
@@ -1216,7 +1235,7 @@ rx_expand_prologue (void)
if (mask)
{
/* Push registers in reverse order. */
- for (reg = FIRST_PSEUDO_REGISTER; reg --;)
+ for (reg = CC_REGNUM; reg --;)
if (mask & (1 << reg))
{
insn = emit_insn (gen_stack_push (gen_rtx_REG (SImode, reg)));
@@ -1245,7 +1264,7 @@ rx_expand_prologue (void)
{
acc_low = acc_high = 0;
- for (reg = 1; reg < FIRST_PSEUDO_REGISTER; reg ++)
+ for (reg = 1; reg < CC_REGNUM; reg ++)
if (mask & (1 << reg))
{
if (acc_low == 0)
@@ -1518,7 +1537,8 @@ rx_expand_epilogue (bool is_sibcall)
if (register_mask)
{
acc_low = acc_high = 0;
- for (reg = 1; reg < FIRST_PSEUDO_REGISTER; reg ++)
+
+ for (reg = 1; reg < CC_REGNUM; reg ++)
if (register_mask & (1 << reg))
{
if (acc_low == 0)
@@ -1549,7 +1569,7 @@ rx_expand_epilogue (bool is_sibcall)
if (register_mask)
{
- for (reg = 0; reg < FIRST_PSEUDO_REGISTER; reg ++)
+ for (reg = 0; reg < CC_REGNUM; reg ++)
if (register_mask & (1 << reg))
emit_insn (gen_stack_pop (gen_rtx_REG (SImode, reg)));
}
@@ -1649,48 +1669,6 @@ rx_initial_elimination_offset (int from, int to)
return stack_size;
}
-/* Update the status of the condition
- codes (cc0) based on the given INSN. */
-
-void
-rx_notice_update_cc (rtx body, rtx insn)
-{
- switch (get_attr_cc (insn))
- {
- case CC_NONE:
- /* Insn does not affect cc0 at all. */
- break;
- case CC_CLOBBER:
- /* Insn doesn't leave cc0 in a usable state. */
- CC_STATUS_INIT;
- break;
- case CC_SET_ZSOC:
- /* The insn sets all the condition code bits. */
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (body);
- break;
- case CC_SET_ZSO:
- /* Insn sets the Z,S and O flags, but not the C flag. */
- CC_STATUS_INIT;
- cc_status.flags |= CC_NO_CARRY;
- /* Do not set the value1 field in this case. The final_scan_insn()
- function naively believes that if cc_status.value1 is set then
- it can eliminate *any* comparison against that value, even if
- the type of comparison cannot be satisfied by the range of flag
- bits being set here. See gcc.c-torture/execute/20041210-1.c
- for an example of this in action. */
- break;
- case CC_SET_ZS:
- /* Insn sets the Z and S flags, but not the O or C flags. */
- CC_STATUS_INIT;
- cc_status.flags |= (CC_NO_CARRY | CC_NO_OVERFLOW);
- /* See comment above regarding cc_status.value1. */
- break;
- default:
- gcc_unreachable ();
- }
-}
-
/* Decide if a variable should go into one of the small data sections. */
static bool
@@ -2486,6 +2464,220 @@ rx_trampoline_init (rtx tramp, tree fndecl, rtx chain)
}
}
+
+static enum machine_mode
+rx_cc_modes_compatible (enum machine_mode m1, enum machine_mode m2)
+{
+ if (m1 == CCmode)
+ return m2;
+ if (m2 == CCmode)
+ return m1;
+ if (m1 == m2)
+ return m1;
+ if (m1 == CC_ZSmode)
+ return m1;
+ if (m2 == CC_ZSmode)
+ return m2;
+ return VOIDmode;
+}
+
+#define CC_FLAG_S (1 << 0)
+#define CC_FLAG_Z (1 << 1)
+#define CC_FLAG_O (1 << 2)
+#define CC_FLAG_C (1 << 3)
+
+static unsigned int
+flags_needed_for_conditional (rtx conditional)
+{
+ switch (GET_CODE (conditional))
+ {
+ case LE:
+ case GT: return CC_FLAG_S | CC_FLAG_Z | CC_FLAG_O;
+
+ case LEU:
+ case GTU: return CC_FLAG_Z | CC_FLAG_C;
+
+ case LT:
+ case GE: return CC_FLAG_S | CC_FLAG_O;
+
+ case LTU:
+ case GEU: return CC_FLAG_C;
+
+ case EQ:
+ case NE: return CC_FLAG_Z;
+
+ default: gcc_unreachable ();
+ }
+}
+
+static unsigned int
+flags_from_mode (enum machine_mode mode)
+{
+ switch (mode)
+ {
+ case CCmode: return CC_FLAG_S | CC_FLAG_Z | CC_FLAG_O | CC_FLAG_C;
+ case CC_ZSmode: return CC_FLAG_S | CC_FLAG_Z;
+ case CC_ZSOmode: return CC_FLAG_S | CC_FLAG_Z | CC_FLAG_O;
+ case CC_ZSCmode: return CC_FLAG_S | CC_FLAG_Z | CC_FLAG_C;
+ default: gcc_unreachable ();
+ }
+}
+
+/* Returns true if a compare insn is redundant because it
+ would only set flags that are already set correctly. */
+
+bool
+rx_compare_redundant (rtx cmp)
+{
+ unsigned int flags_needed;
+ unsigned int flags_set;
+ rtx next;
+ rtx prev;
+ rtx source;
+ rtx dest;
+ static rtx cc_reg = NULL_RTX;
+
+ if (cc_reg == NULL_RTX)
+ cc_reg = gen_rtx_REG (CCmode, CC_REGNUM);
+
+ /* We can only eliminate compares against 0. */
+ if (GET_CODE (XEXP (SET_SRC (PATTERN (cmp)), 1)) != CONST_INT
+ || INTVAL (XEXP (SET_SRC (PATTERN (cmp)), 1)) != 0)
+ return false;
+
+ /* Locate the branch insn that follows the
+ compare and which tests the bits in the PSW. */
+ next = cmp;
+ do
+ {
+ /* If we have found an insn that sets or clobbers the CC
+ register and it was not the IF_THEN_ELSE insn that we
+ are looking for, then the comparison is redundant. */
+ if (next != cmp && reg_mentioned_p (cc_reg, PATTERN (next)))
+ return true;
+
+ next = next_nonnote_insn (next);
+
+ /* If we run out of insns without finding the
+ user then the comparison is unnecessary. */
+ if (next == NULL_RTX)
+ return true;
+
+ /* If we have found another comparison
+ insn then the first one is redundant. */
+ if (INSN_P (next)
+ && GET_CODE (PATTERN (next)) == SET
+ && REG_P (SET_DEST (PATTERN (next)))
+ && REGNO (SET_DEST (PATTERN (next))) == CC_REGNUM)
+ return true;
+
+ /* If we have found another arithmetic/logic insn that
+ sets the PSW flags then the comparison is redundant. */
+ if (INSN_P (next)
+ && GET_CODE (PATTERN (next)) == PARALLEL
+ && GET_CODE (XVECEXP (PATTERN (next), 0, 1)) == SET
+ && REG_P (SET_DEST (XVECEXP (PATTERN (next), 0, 1)))
+ && REGNO (SET_DEST (XVECEXP (PATTERN (next), 0, 1))) == CC_REGNUM)
+ return true;
+
+ /* If we have found an unconditional branch then the
+ PSW flags might be carried along with the jump, so
+ the comparison is necessary. */
+ if (INSN_P (next) && JUMP_P (next))
+ {
+ if (GET_CODE (PATTERN (next)) != SET)
+ /* If the jump does not involve setting the PC
+ then it is a return of some kind, and we know
+ that the comparison is not used. */
+ return true;
+
+ if (GET_CODE (SET_SRC (PATTERN (next))) != IF_THEN_ELSE)
+ return false;
+ }
+ }
+ while (! INSN_P (next)
+ || DEBUG_INSN_P (next)
+ || GET_CODE (PATTERN (next)) != SET
+ || GET_CODE (SET_SRC (PATTERN (next))) != IF_THEN_ELSE);
+
+ flags_needed = flags_needed_for_conditional (XEXP (SET_SRC (PATTERN (next)), 0));
+
+ /* Now look to see if there was a previous
+ instruction which set the PSW bits. */
+ source = XEXP (SET_SRC (PATTERN (cmp)), 0);
+ prev = cmp;
+ do
+ {
+ /* If this insn uses/sets/clobbers the CC register
+ and it is not the insn that we are looking for
+ below, then we must need the comparison. */
+ if (prev != cmp && reg_mentioned_p (cc_reg, PATTERN (prev)))
+ return false;
+
+ prev = prev_nonnote_insn (prev);
+
+ if (prev == NULL_RTX)
+ return false;
+
+ /* If we encounter an insn which changes the contents of
+ the register which is the source of the comparison then
+ we will definitely need the comparison. */
+ if (INSN_P (prev)
+ && GET_CODE (PATTERN (prev)) == SET
+ && rtx_equal_p (SET_DEST (PATTERN (prev)), source))
+ {
+ /* Unless this instruction is a simple register move
+ instruction. In which case we can continue our
+ scan backwards, but now using the *source* of this
+ set instruction. */
+ if (REG_P (SET_SRC (PATTERN (prev))))
+ source = SET_SRC (PATTERN (prev));
+ /* We can also survive a sign-extension if the test is
+ for EQ/NE. Note the same does not apply to zero-
+ extension as this can turn a non-zero bit-pattern
+ into zero. */
+ else if (flags_needed == CC_FLAG_Z
+ && GET_CODE (SET_SRC (PATTERN (prev))) == SIGN_EXTEND)
+ source = XEXP (SET_SRC (PATTERN (prev)), 0);
+ else
+ return false;
+ }
+
+ /* A label means a possible branch into the
+ code here, so we have to stop scanning. */
+ if (LABEL_P (prev))
+ return false;
+ }
+ while (! INSN_P (prev)
+ || DEBUG_INSN_P (prev)
+ || GET_CODE (PATTERN (prev)) != PARALLEL
+ || GET_CODE (XVECEXP (PATTERN (prev), 0, 1)) != SET
+ || ! REG_P (SET_DEST (XVECEXP (PATTERN (prev), 0, 1)))
+ || REGNO (SET_DEST (XVECEXP (PATTERN (prev), 0, 1))) != CC_REGNUM);
+
+ flags_set = flags_from_mode (GET_MODE (SET_DEST (XVECEXP (PATTERN (prev), 0, 1))));
+
+ dest = SET_DEST (XVECEXP (PATTERN (prev), 0, 0));
+ /* The destination of the previous arithmetic/logic instruction
+ must match the source in the comparison operation. For registers
+ we ignore the mode as there may have been a sign-extension involved. */
+ if (! rtx_equal_p (source, dest))
+ {
+ if (REG_P (source) && REG_P (dest) && REGNO (dest) == REGNO (source))
+ ;
+ else
+ return false;
+ }
+
+ return ((flags_set & flags_needed) == flags_needed);
+}
+
+static int
+rx_memory_move_cost (enum machine_mode mode, enum reg_class regclass, bool in)
+{
+ return 2 + memory_move_secondary_cost (mode, regclass, in);
+}
+
#undef TARGET_FUNCTION_VALUE
#define TARGET_FUNCTION_VALUE rx_function_value
@@ -2573,6 +2765,18 @@ rx_trampoline_init (rtx tramp, tree fndecl, rtx chain)
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT rx_trampoline_init
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND rx_print_operand
+
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS rx_print_operand_address
+
+#undef TARGET_CC_MODES_COMPATIBLE
+#define TARGET_CC_MODES_COMPATIBLE rx_cc_modes_compatible
+
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST rx_memory_move_cost
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* #include "gt-rx.h" */
diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h
index 8be66b53d9b..b3a12690b08 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -142,6 +142,8 @@ extern enum rx_cpu_types rx_cpu_type;
#define POINTER_SIZE 32
#undef SIZE_TYPE
#define SIZE_TYPE "long unsigned int"
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
#define POINTERS_EXTEND_UNSIGNED 1
#define FUNCTION_MODE QImode
#define CASE_VECTOR_MODE Pmode
@@ -152,7 +154,6 @@ extern enum rx_cpu_types rx_cpu_type;
#define MOVE_MAX 4
#define STARTING_FRAME_OFFSET 0
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
#define LEGITIMATE_CONSTANT_P(X) rx_is_legitimate_constant (X)
@@ -196,6 +197,7 @@ enum reg_class
GR_REGS, LIM_REG_CLASSES \
}
+#define SMALL_REGISTER_CLASSES 0
#define N_REG_CLASSES (int) LIM_REG_CLASSES
#define CLASS_MAX_NREGS(CLASS, MODE) ((GET_MODE_SIZE (MODE) \
+ UNITS_PER_WORD - 1) \
@@ -205,7 +207,7 @@ enum reg_class
#define BASE_REG_CLASS GR_REGS
#define INDEX_REG_CLASS GR_REGS
-#define FIRST_PSEUDO_REGISTER 16
+#define FIRST_PSEUDO_REGISTER 17
#define REGNO_REG_CLASS(REGNO) ((REGNO) < FIRST_PSEUDO_REGISTER \
? GR_REGS : NO_REGS)
@@ -217,6 +219,7 @@ enum reg_class
#define STATIC_CHAIN_REGNUM 8
#define TRAMPOLINE_TEMP_REGNUM 9
#define STRUCT_VAL_REGNUM 15
+#define CC_REGNUM 16
/* This is the register which is used to hold the address of the start
of the small data area, if that feature is being used. Note - this
@@ -243,12 +246,12 @@ enum reg_class
#define FIXED_REGISTERS \
{ \
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 \
}
#define CALL_USED_REGISTERS \
{ \
- 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 \
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 \
}
#define CONDITIONAL_REGISTER_USAGE \
@@ -349,7 +352,7 @@ typedef unsigned int CUMULATIVE_ARGS;
#define REGISTER_NAMES \
{ \
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" \
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "cc" \
};
#define ADDITIONAL_REGISTER_NAMES \
@@ -607,14 +610,6 @@ typedef unsigned int CUMULATIVE_ARGS;
they contain are always computed between two same-section symbols. */
#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
-#define PRINT_OPERAND(FILE, X, CODE) \
- rx_print_operand (FILE, X, CODE)
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- rx_print_operand_address (FILE, ADDR)
-
-#define CC_NO_CARRY 0400
-#define NOTICE_UPDATE_CC(EXP, INSN) rx_notice_update_cc (EXP, INSN)
-
extern int rx_float_compare_mode;
/* This is a version of REG_P that also returns TRUE for SUBREGs. */
@@ -649,3 +644,16 @@ extern int rx_float_compare_mode;
/* This macro is used to decide when RX FPU instructions can be used. */
#define ALLOW_RX_FPU_INSNS (TARGET_USE_FPU)
+
+#define BRANCH_COST(SPEED,PREDICT) 1
+#define REGISTER_MOVE_COST(MODE,FROM,TO) 2
+
+#define SELECT_CC_MODE(OP,X,Y) \
+ (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CC_ZSmode : \
+ (GET_CODE (X) == PLUS || GET_CODE (X) == MINUS ? CC_ZSCmode : \
+ (GET_CODE (X) == ABS ? CC_ZSOmode : \
+ (GET_CODE (X) == AND || GET_CODE (X) == NOT || GET_CODE (X) == IOR \
+ || GET_CODE (X) == XOR || GET_CODE (X) == ROTATE \
+ || GET_CODE (X) == ROTATERT || GET_CODE (X) == ASHIFTRT \
+ || GET_CODE (X) == LSHIFTRT || GET_CODE (X) == ASHIFT ? CC_ZSmode : \
+ CCmode))))
diff --git a/gcc/config/rx/rx.md b/gcc/config/rx/rx.md
index 274ce6f3c66..aeba85ffe39 100644
--- a/gcc/config/rx/rx.md
+++ b/gcc/config/rx/rx.md
@@ -47,6 +47,7 @@
(define_constants
[
(SP_REG 0)
+ (CC_REG 16)
(UNSPEC_LOW_REG 0)
(UNSPEC_HIGH_REG 1)
@@ -86,14 +87,6 @@
]
)
-;; Condition code settings:
-;; none - insn does not affect the condition code bits
-;; set_zs - insn sets z,s to usable values;
-;; set_zso - insn sets z,s,o to usable values;
-;; set_zsoc - insn sets z,s,o,c to usable values;
-;; clobber - value of cc0 is unknown
-(define_attr "cc" "none,set_zs,set_zso,set_zsoc,clobber" (const_string "none"))
-
(define_attr "length" "" (const_int 8))
(include "predicates.md")
@@ -156,77 +149,120 @@
;; Comparisons
+;; Note - we do not specify the two instructions necessary to perform
+;; a compare-and-branch in the cbranchsi4 pattern because that would
+;; allow the comparison to be moved away from the jump before the reload
+;; pass has completed. That would be problematical because reload can
+;; generate ADDSI3 instructions which would corrupt the PSW flags.
+
(define_expand "cbranchsi4"
- [(set (cc0) (compare:CC (match_operand:SI 1 "register_operand")
- (match_operand:SI 2 "rx_source_operand")))
- (set (pc)
- (if_then_else (match_operator:SI 0 "comparison_operator"
- [(cc0) (const_int 0)])
+ [(set (pc)
+ (if_then_else (match_operator:SI 0 "comparison_operator"
+ [(match_operand:SI 1 "register_operand")
+ (match_operand:SI 2 "rx_source_operand")])
(label_ref (match_operand 3 ""))
- (pc)))]
+ (pc)))
+ ]
""
""
)
+(define_insn_and_split "*cbranchsi4_<code>"
+ [(set (pc)
+ (if_then_else (most_cond:SI (match_operand:SI 0 "register_operand" "r")
+ (match_operand:SI 1 "rx_source_operand" "riQ"))
+ (label_ref (match_operand 2 "" ""))
+ (pc)))
+ ]
+ ""
+ "#"
+ "reload_completed"
+ [(const_int 0)]
+ "
+ /* We contstruct the split by hand as otherwise the JUMP_LABEL
+ attribute is not set correctly on the jump insn. */
+ emit_insn (gen_cmpsi (operands[0], operands[1]));
+
+ emit_jump_insn (gen_conditional_branch (operands[2],
+ gen_rtx_fmt_ee (<most_cond:CODE>, CCmode,
+ gen_rtx_REG (CCmode, CC_REG), const0_rtx)));
+ "
+)
+
(define_expand "cbranchsf4"
- [(set (cc0) (compare:CC (match_operand:SF 1 "register_operand")
- (match_operand:SF 2 "rx_source_operand")))
- (set (pc)
- (if_then_else (match_operator:SI 0 "comparison_operator"
- [(cc0) (const_int 0)])
+ [(set (pc)
+ (if_then_else (match_operator:SF 0 "comparison_operator"
+ [(match_operand:SF 1 "register_operand")
+ (match_operand:SF 2 "rx_source_operand")])
(label_ref (match_operand 3 ""))
- (pc)))]
- "ALLOW_RX_FPU_INSNS && !cfun->can_throw_non_call_exceptions"
+ (pc)))
+ ]
+ "ALLOW_RX_FPU_INSNS"
""
)
-;; The TST instruction is not used as it does not set the Carry flag,
-;; so for example, the LessThan comparison cannot be tested.
-;;
-;; (define_insn "tstsi"
-;; [(set (cc0)
-;; (match_operand:SI 0 "rx_source_operand" "r,i,Q")))]
-;; ""
-;; {
-;; rx_float_compare_mode = false;
-;; return "tst\t%Q0";
-;; }
-;; [(set_attr "cc" "set_zs")
-;; (set_attr "timings" "11,11,33")
-;; (set_attr "length" "3,7,6")]
-;; )
+(define_insn_and_split "*cbranchsf4_<code>"
+ [(set (pc)
+ (if_then_else (most_cond:SF (match_operand:SF 0 "register_operand" "r")
+ (match_operand:SF 1 "rx_source_operand" "rFiQ"))
+ (label_ref (match_operand 2 "" ""))
+ (pc)))
+ ]
+ "ALLOW_RX_FPU_INSNS"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+ "
+ /* We contstruct the split by hand as otherwise the JUMP_LABEL
+ attribute is not set correctly on the jump insn. */
+ emit_insn (gen_cmpsf (operands[0], operands[1]));
+
+ emit_jump_insn (gen_conditional_branch (operands[2],
+ gen_rtx_fmt_ee (<most_cond:CODE>, CCmode,
+ gen_rtx_REG (CCmode, CC_REG), const0_rtx)));
+ "
+)
+
+(define_insn "tstsi"
+ [(set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (and:SI (match_operand:SI 0 "register_operand" "r,r,r")
+ (match_operand:SI 1 "rx_source_operand" "r,i,Q"))
+ (const_int 0)))]
+ ""
+ {
+ rx_float_compare_mode = false;
+ return "tst\t%Q1, %0";
+ }
+ [(set_attr "timings" "11,11,33")
+ (set_attr "length" "3,7,6")]
+)
(define_insn "cmpsi"
- [(set (cc0) (compare:CC
- (match_operand:SI 0 "register_operand" "r,r,r,r,r,r,r")
- (match_operand:SI 1 "rx_source_operand"
- "r,Uint04,Int08,Sint16,Sint24,i,Q")))]
+ [(set (reg:CC CC_REG)
+ (compare:CC (match_operand:SI 0 "register_operand" "r,r,r,r,r,r,r")
+ (match_operand:SI 1 "rx_source_operand" "r,Uint04,Int08,Sint16,Sint24,i,Q")))]
""
{
rx_float_compare_mode = false;
- return "cmp\t%Q1, %Q0";
+ if (rx_compare_redundant (insn))
+ return "; Compare Eliminated: cmp %Q1, %0";
+ return "cmp\t%Q1, %0";
}
- [(set_attr "cc" "set_zsoc")
- (set_attr "timings" "11,11,11,11,11,11,33")
+ [(set_attr "timings" "11,11,11,11,11,11,33")
(set_attr "length" "2,2,3,4,5,6,5")]
)
-;; This pattern is disabled if the function can throw non-call exceptions,
-;; it could generate a floating point exception, which would introduce an
-;; edge into the flow graph between this insn and the conditional branch
-;; insn to follow, thus breaking the cc0 relationship. Run the g++ test
-;; g++.dg/eh/080514-1.C to see this happen.
+;; ??? g++.dg/eh/080514-1.C to see this happen.
(define_insn "cmpsf"
- [(set (cc0)
- (compare:CC (match_operand:SF 0 "register_operand" "r,r,r")
- (match_operand:SF 1 "rx_source_operand" "r,i,Q")))]
- "ALLOW_RX_FPU_INSNS && !cfun->can_throw_non_call_exceptions"
+ [(set (reg:CC_ZSO CC_REG)
+ (compare:CC_ZSO (match_operand:SF 0 "register_operand" "r,r,r")
+ (match_operand:SF 1 "rx_source_operand" "r,iF,Q")))]
+ "ALLOW_RX_FPU_INSNS"
{
rx_float_compare_mode = true;
return "fcmp\t%1, %0";
}
- [(set_attr "cc" "set_zso")
- (set_attr "timings" "11,11,33")
+ [(set_attr "timings" "11,11,33")
(set_attr "length" "3,7,5")]
)
@@ -234,17 +270,17 @@
(define_expand "b<code>"
[(set (pc)
- (if_then_else (most_cond (cc0) (const_int 0))
+ (if_then_else (most_cond (reg:CC CC_REG) (const_int 0))
(label_ref (match_operand 0))
(pc)))]
""
""
)
-(define_insn "*conditional_branch"
+(define_insn "conditional_branch"
[(set (pc)
(if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
+ [(reg:CC CC_REG) (const_int 0)])
(label_ref (match_operand 0 "" ""))
(pc)))]
""
@@ -253,14 +289,13 @@
}
[(set_attr "length" "8") ;; This length is wrong, but it is
;; too hard to compute statically.
- (set_attr "timings" "33") ;; The timing assumes that the branch is taken.
- (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
+ (set_attr "timings" "33")] ;; The timing assumes that the branch is taken.
)
(define_insn "*reveresed_conditional_branch"
[(set (pc)
(if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
+ [(reg:CC CC_REG) (const_int 0)])
(pc)
(label_ref (match_operand 0 "" ""))))]
""
@@ -269,38 +304,37 @@
}
[(set_attr "length" "8") ;; This length is wrong, but it is
;; too hard to compute statically.
- (set_attr "timings" "33") ;; The timing assumes that the branch is taken.
- (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
+ (set_attr "timings" "33")] ;; The timing assumes that the branch is taken.
)
(define_insn "jump"
- [(set (pc) (label_ref (match_operand 0 "" "")))]
+ [(set (pc)
+ (label_ref (match_operand 0 "" "")))]
""
"bra\t%0"
[(set_attr "length" "4")
- (set_attr "timings" "33")
- (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
+ (set_attr "timings" "33")]
)
(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
+ [(set (pc)
+ (match_operand:SI 0 "register_operand" "r"))]
""
"jmp\t%0"
[(set_attr "length" "2")
- (set_attr "timings" "33")
- (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
+ (set_attr "timings" "33")]
)
(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
+ [(set (pc)
+ (match_operand:SI 0 "register_operand" "r"))
(use (label_ref (match_operand 1 "" "")))]
""
{ return flag_pic ? (TARGET_AS100_SYNTAX ? "\n?:\tbra\t%0"
: "\n1:\tbra\t%0")
: "jmp\t%0";
}
- [(set_attr "cc" "clobber") ;; FIXME: This clobber is wrong.
- (set_attr "timings" "33")
+ [(set_attr "timings" "33")
(set_attr "length" "2")]
)
@@ -324,11 +358,10 @@
)
(define_insn "pop_and_return"
- [(match_parallel 1 "rx_rtsd_vector"
+ [(match_parallel 1 "rx_rtsd_vector"
[(set:SI (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
- (match_operand:SI
- 0 "const_int_operand" "n")))])]
+ (match_operand:SI 0 "const_int_operand" "n")))])]
"reload_completed"
{
rx_emit_stack_popm (operands, false);
@@ -385,7 +418,8 @@
(define_insn "call_internal"
[(call (mem:QI (match_operand:SI 0 "rx_call_operand" "r,Symbol"))
- (match_operand:SI 1 "general_operand" "g,g"))]
+ (match_operand:SI 1 "general_operand" "g,g"))
+ (clobber (reg:CC CC_REG))]
""
"@
jsr\t%0
@@ -412,7 +446,8 @@
(define_insn "call_value_internal"
[(set (match_operand 0 "register_operand" "=r,r")
(call (mem:QI (match_operand:SI 1 "rx_call_operand" "r,Symbol"))
- (match_operand:SI 2 "general_operand" "g,g")))]
+ (match_operand:SI 2 "general_operand" "g,g")))
+ (clobber (reg:CC CC_REG))]
""
"@
jsr\t%1
@@ -562,11 +597,10 @@
)
(define_insn "stack_pushm"
- [(match_parallel 1 "rx_store_multiple_vector"
+ [(match_parallel 1 "rx_store_multiple_vector"
[(set:SI (reg:SI SP_REG)
(minus:SI (reg:SI SP_REG)
- (match_operand:SI
- 0 "const_int_operand" "n")))])]
+ (match_operand:SI 0 "const_int_operand" "n")))])]
"reload_completed"
{
rx_emit_stack_pushm (operands);
@@ -589,11 +623,10 @@
)
(define_insn "stack_popm"
- [(match_parallel 1 "rx_load_multiple_vector"
+ [(match_parallel 1 "rx_load_multiple_vector"
[(set:SI (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
- (match_operand:SI
- 0 "const_int_operand" "n")))])]
+ (match_operand:SI 0 "const_int_operand" "n")))])]
"reload_completed"
{
rx_emit_stack_popm (operands, true);
@@ -603,29 +636,29 @@
(set_attr "timings" "45")] ;; The timing is a guesstimate average timing.
)
+;; FIXME: Add memory destination options ?
(define_insn "cstoresi4"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r")
- (match_operator:SI
- 1 "comparison_operator"
- [(match_operand:SI
- 2 "register_operand" "r,r,r,r,r,r,r")
- (match_operand:SI
- 3 "rx_source_operand" "r,Uint04,Int08,Sint16,Sint24,i,Q")]))]
+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r")
+ (match_operator:SI 1 "comparison_operator"
+ [(match_operand:SI 2 "register_operand" "r,r,r,r,r,r,r")
+ (match_operand:SI 3 "rx_source_operand" "r,Uint04,Int08,Sint16,Sint24,i,Q")]))
+ (clobber (reg:CC CC_REG))] ;; Because the cc flags are set based on comparing ops 2 & 3 not the value in op 0.
""
{
rx_float_compare_mode = false;
return "cmp\t%Q3, %Q2\n\tsc%B1.L\t%0";
}
- [(set_attr "cc" "set_zsoc")
- (set_attr "timings" "22,22,22,22,22,22,44")
+ [(set_attr "timings" "22,22,22,22,22,22,44")
(set_attr "length" "5,5,6,7,8,9,8")]
)
(define_expand "movsicc"
- [(set (match_operand:SI 0 "register_operand")
- (if_then_else:SI (match_operand:SI 1 "comparison_operator")
- (match_operand:SI 2 "nonmemory_operand")
- (match_operand:SI 3 "immediate_operand")))]
+ [(parallel
+ [(set (match_operand:SI 0 "register_operand")
+ (if_then_else:SI (match_operand:SI 1 "comparison_operator")
+ (match_operand:SI 2 "nonmemory_operand")
+ (match_operand:SI 3 "immediate_operand")))
+ (clobber (reg:CC CC_REG))])] ;; See cstoresi4
""
{
if (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE)
@@ -636,22 +669,18 @@
)
(define_insn "*movsieq"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (if_then_else:SI (eq (match_operand:SI
- 3 "register_operand" "r,r,r")
- (match_operand:SI
- 4 "rx_source_operand" "riQ,riQ,riQ"))
- (match_operand:SI
- 1 "nonmemory_operand" "0,i,r")
- (match_operand:SI
- 2 "immediate_operand" "i,i,i")))]
+ [(set (match_operand:SI 0 "register_operand" "=r,r,r")
+ (if_then_else:SI (eq (match_operand:SI 3 "register_operand" "r,r,r")
+ (match_operand:SI 4 "rx_source_operand" "riQ,riQ,riQ"))
+ (match_operand:SI 1 "nonmemory_operand" "0,i,r")
+ (match_operand:SI 2 "immediate_operand" "i,i,i")))
+ (clobber (reg:CC CC_REG))] ;; See cstoresi4
""
"@
cmp\t%Q4, %Q3\n\tstnz\t%2, %0
cmp\t%Q4, %Q3\n\tmov.l\t%2, %0\n\tstz\t%1, %0
cmp\t%Q4, %Q3\n\tmov.l\t%1, %0\n\tstnz\t%2, %0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "length" "13,19,15")
+ [(set_attr "length" "13,19,15")
(set_attr "timings" "22,33,33")]
)
@@ -660,14 +689,14 @@
(if_then_else:SI (ne (match_operand:SI 3 "register_operand" "r,r,r")
(match_operand:SI 4 "rx_source_operand" "riQ,riQ,riQ"))
(match_operand:SI 1 "nonmemory_operand" "0,i,r")
- (match_operand:SI 2 "immediate_operand" "i,i,i")))]
+ (match_operand:SI 2 "immediate_operand" "i,i,i")))
+ (clobber (reg:CC CC_REG))] ;; See cstoresi4
""
"@
cmp\t%Q4, %Q3\n\tstz\t%2, %0
cmp\t%Q4, %Q3\n\tmov.l\t%2, %0\n\tstnz\t%1, %0
cmp\t%Q4, %Q3\n\tmov.l\t%1, %0\n\tstz\t%2, %0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "length" "13,19,15")
+ [(set_attr "length" "13,19,15")
(set_attr "timings" "22,33,33")]
)
@@ -675,61 +704,65 @@
(define_insn "abssi2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
- (abs:SI (match_operand:SI 1 "register_operand" "0,r")))]
+ (abs:SI (match_operand:SI 1 "register_operand" "0,r")))
+ (set (reg:CC_ZSO CC_REG)
+ (compare:CC_ZSO (abs:SI (match_dup 1))
+ (const_int 0)))]
""
"@
abs\t%0
abs\t%1, %0"
- [(set_attr "cc" "set_zso")
- (set_attr "length" "2,3")]
+ [(set_attr "length" "2,3")]
)
(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand"
- "=r,r,r,r,r,r,r,r,r,r,r,r")
- (plus:SI (match_operand:SI
- 1 "register_operand"
- "%0,0,0,0,0,0,r,r,r,r,r,0")
- (match_operand:SI
- 2 "rx_source_operand"
- "r,Uint04,Sint08,Sint16,Sint24,i,r,Sint08,Sint16,Sint24,i,Q")))]
+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r,r,r,r,r,r,r")
+ (plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,0,r,r,r,r,r,r,0")
+ (match_operand:SI 2 "rx_source_operand" "r,Uint04,NEGint4,Sint08,Sint16,Sint24,i,0,r,Sint08,Sint16,Sint24,i,Q")))
+ (set (reg:CC_ZSC CC_REG) ;; See subsi3
+ (compare:CC_ZSC (plus:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"@
add\t%2, %0
add\t%2, %0
+ sub\t%N2, %0
add\t%2, %0
add\t%2, %0
add\t%2, %0
add\t%2, %0
+ add\t%1, %0
add\t%2, %1, %0
add\t%2, %1, %0
add\t%2, %1, %0
add\t%2, %1, %0
add\t%2, %1, %0
add\t%Q2, %0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "timings" "11,11,11,11,11,11,11,11,11,11,11,33")
- (set_attr "length" "2,2,3,4,5,6,3,3,4,5,6,5")]
+ [(set_attr "timings" "11,11,11,11,11,11,11,11,11,11,11,11,11,33")
+ (set_attr "length" "2,2,2,3,4,5,6,2,3,3,4,5,6,5")]
)
(define_insn "adddi3"
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r")
(plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,0,0")
(match_operand:DI 2 "rx_source_operand"
- "r,Sint08,Sint16,Sint24,i,Q")))]
+ "r,Sint08,Sint16,Sint24,i,Q")))
+ (set (reg:CC_ZSC CC_REG) ;; See subsi3
+ (compare:CC_ZSC (plus:DI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"add\t%L2, %L0\n\tadc\t%H2, %H0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "timings" "22,22,22,22,22,44")
+ [(set_attr "timings" "22,22,22,22,22,44")
(set_attr "length" "5,7,9,11,13,11")]
)
(define_insn "andsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r,r")
- (and:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,r,0,Q")
- (match_operand:SI
- 2 "rx_source_operand"
- "r,Uint04,Sint08,Sint16,Sint24,i,r,Q,0")))]
+ (and:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,r,r,0")
+ (match_operand:SI 2 "rx_source_operand" "r,Uint04,Sint08,Sint16,Sint24,i,0,r,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (and:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"@
and\t%2, %0
@@ -738,12 +771,11 @@
and\t%2, %0
and\t%2, %0
and\t%2, %0
+ and\t%1, %0
and\t%2, %1, %0
- and\t%Q2, %0
- and\t%Q1, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "11,11,11,11,11,11,11,33,33")
- (set_attr "length" "2,2,3,4,5,6,3,5,5")]
+ and\t%Q2, %0"
+ [(set_attr "timings" "11,11,11,11,11,11,11,33,33")
+ (set_attr "length" "2,2,3,4,5,6,2,5,5")]
)
;; Byte swap (single 32-bit value).
@@ -767,12 +799,11 @@
(define_insn "divsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r")
(div:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0,0")
- (match_operand:SI
- 2 "rx_source_operand" "r,Sint08,Sint16,Sint24,i,Q")))]
+ (match_operand:SI 2 "rx_source_operand" "r,Sint08,Sint16,Sint24,i,Q")))
+ (clobber (reg:CC CC_REG))]
""
"div\t%Q2, %0"
- [(set_attr "cc" "clobber")
- (set_attr "timings" "1111") ;; Strictly speaking the timing should be
+ [(set_attr "timings" "1111") ;; Strictly speaking the timing should be
;; 2222, but that is a worst case sceanario.
(set_attr "length" "3,4,5,6,7,6")]
)
@@ -780,12 +811,11 @@
(define_insn "udivsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r")
(udiv:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0,0")
- (match_operand:SI
- 2 "rx_source_operand" "r,Sint08,Sint16,Sint24,i,Q")))]
+ (match_operand:SI 2 "rx_source_operand" "r,Sint08,Sint16,Sint24,i,Q")))
+ (clobber (reg:CC CC_REG))]
""
"divu\t%Q2, %0"
- [(set_attr "cc" "clobber")
- (set_attr "timings" "1010") ;; Strictly speaking the timing should be
+ [(set_attr "timings" "1010") ;; Strictly speaking the timing should be
;; 2020, but that is a worst case sceanario.
(set_attr "length" "3,4,5,6,7,6")]
)
@@ -803,13 +833,7 @@
2 "rx_source_operand"
"r,Sint08,Sint16,Sint24,i,Q"))))]
"! TARGET_BIG_ENDIAN_DATA"
- "@
- emul\t%Q2, %0
- emul\t%Q2, %0
- emul\t%Q2, %0
- emul\t%Q2, %0
- emul\t%Q2, %0
- emul\t%Q2, %0"
+ "emul\t%Q2, %0"
[(set_attr "length" "3,4,5,6,7,6")
(set_attr "timings" "22,22,22,22,22,44")]
)
@@ -819,16 +843,11 @@
;; mulsidi3 pattern. Immediate mode addressing is not supported
;; because gcc cannot handle the expression: (zero_extend (const_int)).
(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "register_operand"
- "=r,r")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand"
- "%0,0"))
- (zero_extend:DI (match_operand:SI 2 "rx_compare_operand"
- "r,Q"))))]
+ [(set (match_operand:DI 0 "register_operand" "=r,r")
+ (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0,0"))
+ (zero_extend:DI (match_operand:SI 2 "rx_compare_operand" "r,Q"))))]
"! TARGET_BIG_ENDIAN_DATA"
- "@
- emulu\t%Q2, %0
- emulu\t%Q2, %0"
+ "emulu\t%Q2, %0"
[(set_attr "length" "3,6")
(set_attr "timings" "22,44")]
)
@@ -850,40 +869,37 @@
(match_operand:SI 2 "rx_source_operand"
"r,Sint08,Sint16,Sint24,i,Q")))]
""
- "@
- min\t%Q2, %0
- min\t%Q2, %0
- min\t%Q2, %0
- min\t%Q2, %0
- min\t%Q2, %0
- min\t%Q2, %0"
+ "min\t%Q2, %0"
[(set_attr "length" "3,4,5,6,7,6")
(set_attr "timings" "11,11,11,11,11,33")]
)
(define_insn "mulsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r,r")
- (mult:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,0,Q,r")
+ (mult:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,0,r,r")
(match_operand:SI 2 "rx_source_operand"
"r,Uint04,Sint08,Sint16,Sint24,i,Q,0,r")))]
""
"@
+ mul\t%2, %0
+ mul\t%2, %0
+ mul\t%2, %0
+ mul\t%2, %0
+ mul\t%2, %0
mul\t%Q2, %0
mul\t%Q2, %0
- mul\t%Q2, %0
- mul\t%Q2, %0
- mul\t%Q2, %0
- mul\t%Q2, %0
- mul\t%Q2, %0
- mul\t%Q1, %0
- mul\t%Q2, %1, %0"
- [(set_attr "length" "2,2,3,4,5,6,5,5,3")
- (set_attr "timings" "11,11,11,11,11,11,33,33,11")]
+ mul\t%1, %0
+ mul\t%2, %1, %0"
+ [(set_attr "length" "2,2,3,4,5,6,5,2,3")
+ (set_attr "timings" "11,11,11,11,11,11,33,11,11")]
)
(define_insn "negsi2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
- (neg:SI (match_operand:SI 1 "register_operand" "0,r")))]
+ (neg:SI (match_operand:SI 1 "register_operand" "0,r")))
+ (set (reg:CC CC_REG)
+ (compare:CC (neg:SI (match_dup 1))
+ (const_int 0)))]
;; The NEG instruction does not comply with -fwrapv semantics.
;; See gcc.c-torture/execute/pr22493-1.c for an example of this.
"! flag_wrapv"
@@ -895,20 +911,24 @@
(define_insn "one_cmplsi2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
- (not:SI (match_operand:SI 1 "register_operand" "0,r")))]
+ (not:SI (match_operand:SI 1 "register_operand" "0,r")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (not:SI (match_dup 1))
+ (const_int 0)))]
""
"@
not\t%0
not\t%1, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "length" "2,3")]
+ [(set_attr "length" "2,3")]
)
(define_insn "iorsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r,r")
- (ior:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,r,0,Q")
- (match_operand:SI 2 "rx_source_operand"
- "r,Uint04,Sint08,Sint16,Sint24,i,r,Q,0")))]
+ (ior:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,r,r,0")
+ (match_operand:SI 2 "rx_source_operand" "r,Uint04,Sint08,Sint16,Sint24,i,0,r,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (ior:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"@
or\t%2, %0
@@ -916,78 +936,93 @@
or\t%2, %0
or\t%2, %0
or\t%2, %0
- or\t%2, %0
- or\t%2, %1, %0
or\t%Q2, %0
- or\t%Q1, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "11,11,11,11,11,11,11,33,33")
- (set_attr "length" "2,2,3,4,5,6,3,5,5")]
+ or\t%1, %0
+ or\t%2, %1, %0
+ or\t%Q2, %0"
+ [(set_attr "timings" "11,11,11,11,11,11,11,11,33")
+ (set_attr "length" "2,2,3,4,5,6,2,3,5")]
)
(define_insn "rotlsi3"
[(set (match_operand:SI 0 "register_operand" "=r")
(rotate:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "rx_shift_operand" "rn")))]
+ (match_operand:SI 2 "rx_shift_operand" "rn")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (rotate:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"rotl\t%2, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "length" "3")]
+ [(set_attr "length" "3")]
)
(define_insn "rotrsi3"
[(set (match_operand:SI 0 "register_operand" "=r")
(rotatert:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "rx_shift_operand" "rn")))]
+ (match_operand:SI 2 "rx_shift_operand" "rn")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (rotatert:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"rotr\t%2, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "length" "3")]
+ [(set_attr "length" "3")]
)
(define_insn "ashrsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r")
(ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0,r")
- (match_operand:SI 2 "rx_shift_operand" "r,n,n")))]
+ (match_operand:SI 2 "rx_shift_operand" "r,n,n")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (ashiftrt:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"@
shar\t%2, %0
shar\t%2, %0
shar\t%2, %1, %0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "length" "3,2,3")]
+ [(set_attr "length" "3,2,3")]
)
(define_insn "lshrsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r")
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0,r")
- (match_operand:SI 2 "rx_shift_operand" "r,n,n")))]
+ (match_operand:SI 2 "rx_shift_operand" "r,n,n")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (lshiftrt:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"@
shlr\t%2, %0
shlr\t%2, %0
shlr\t%2, %1, %0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "length" "3,2,3")]
+ [(set_attr "length" "3,2,3")]
)
(define_insn "ashlsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r")
(ashift:SI (match_operand:SI 1 "register_operand" "0,0,r")
- (match_operand:SI 2 "rx_shift_operand" "r,n,n")))]
+ (match_operand:SI 2 "rx_shift_operand" "r,n,n")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (ashift:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"@
shll\t%2, %0
shll\t%2, %0
shll\t%2, %1, %0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "length" "3,2,3")]
+ [(set_attr "length" "3,2,3")]
)
(define_insn "subsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
(minus:SI (match_operand:SI 1 "register_operand" "0,0,0,r,0")
- (match_operand:SI 2 "rx_source_operand" "r,Uint04,n,r,Q")))]
+ (match_operand:SI 2 "rx_source_operand" "r,Uint04,n,r,Q")))
+ (set (reg:CC_ZSC CC_REG)
+ ;; Note - we do not acknowledge that the SUB instruction sets the Overflow
+ ;; flag because its interpretation is different from comparing the result
+ ;; against zero. Compile and run gcc.c-torture/execute/cmpsi-1.c to see this.
+ (compare:CC_ZSC (minus:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"@
sub\t%2, %0
@@ -995,19 +1030,20 @@
add\t%N2, %0
sub\t%2, %1, %0
sub\t%Q2, %0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "timings" "11,11,11,11,33")
+ [(set_attr "timings" "11,11,11,11,33")
(set_attr "length" "2,2,6,3,5")]
)
(define_insn "subdi3"
[(set (match_operand:DI 0 "register_operand" "=r,r")
(minus:DI (match_operand:DI 1 "register_operand" "0,0")
- (match_operand:DI 2 "rx_source_operand" "r,Q")))]
+ (match_operand:DI 2 "rx_source_operand" "r,Q")))
+ (set (reg:CC_ZSC CC_REG) ;; See subsi3
+ (compare:CC_ZSC (minus:DI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
"sub\t%L2, %L0\n\tsbb\t%H2, %H0"
- [(set_attr "cc" "set_zsoc")
- (set_attr "timings" "22,44")
+ [(set_attr "timings" "22,44")
(set_attr "length" "5,11")]
)
@@ -1015,17 +1051,13 @@
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r")
(xor:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0")
(match_operand:SI 2 "rx_source_operand"
- "r,Sint08,Sint16,Sint24,i,Q")))]
+ "r,Sint08,Sint16,Sint24,i,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (xor:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))]
""
- "@
- xor\t%Q2, %0
- xor\t%Q2, %0
- xor\t%Q2, %0
- xor\t%Q2, %0
- xor\t%Q2, %0
- xor\t%Q2, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "11,11,11,11,11,33")
+ "xor\t%Q2, %0"
+ [(set_attr "timings" "11,11,11,11,11,33")
(set_attr "length" "3,4,5,6,7,6")]
)
@@ -1034,70 +1066,76 @@
(define_insn "addsf3"
[(set (match_operand:SF 0 "register_operand" "=r,r,r")
(plus:SF (match_operand:SF 1 "register_operand" "%0,0,0")
- (match_operand:SF 2 "rx_source_operand" "r,F,Q")))]
+ (match_operand:SF 2 "rx_source_operand" "r,F,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (plus:SF (match_dup 1) (match_dup 2))
+ (const_int 0)))]
"ALLOW_RX_FPU_INSNS"
- "@
- fadd\t%2, %0
- fadd\t%2, %0
- fadd\t%2, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "44,44,66")
+ "fadd\t%2, %0"
+ [(set_attr "timings" "44,44,66")
(set_attr "length" "3,7,5")]
)
(define_insn "divsf3"
[(set (match_operand:SF 0 "register_operand" "=r,r,r")
(div:SF (match_operand:SF 1 "register_operand" "0,0,0")
- (match_operand:SF 2 "rx_source_operand" "r,F,Q")))]
+ (match_operand:SF 2 "rx_source_operand" "r,F,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (div:SF (match_dup 1) (match_dup 2))
+ (const_int 0)))]
"ALLOW_RX_FPU_INSNS"
"fdiv\t%2, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "1616,1616,1818")
+ [(set_attr "timings" "1616,1616,1818")
(set_attr "length" "3,7,5")]
)
(define_insn "mulsf3"
[(set (match_operand:SF 0 "register_operand" "=r,r,r")
(mult:SF (match_operand:SF 1 "register_operand" "%0,0,0")
- (match_operand:SF 2 "rx_source_operand" "r,F,Q")))]
+ (match_operand:SF 2 "rx_source_operand" "r,F,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (mult:SF (match_dup 1) (match_dup 2))
+ (const_int 0)))]
"ALLOW_RX_FPU_INSNS"
- "@
- fmul\t%2, %0
- fmul\t%2, %0
- fmul\t%2, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "33,33,55")
+ "fmul\t%2, %0"
+ [(set_attr "timings" "33,33,55")
(set_attr "length" "3,7,5")]
)
(define_insn "subsf3"
[(set (match_operand:SF 0 "register_operand" "=r,r,r")
(minus:SF (match_operand:SF 1 "register_operand" "0,0,0")
- (match_operand:SF 2 "rx_source_operand" "r,F,Q")))]
+ (match_operand:SF 2 "rx_source_operand" "r,F,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (minus:SF (match_dup 1) (match_dup 2))
+ (const_int 0)))]
"ALLOW_RX_FPU_INSNS"
- "fsub\t%2, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "44,44,66")
+ "fsub\t%Q2, %0"
+ [(set_attr "timings" "44,44,66")
(set_attr "length" "3,7,5")]
)
(define_insn "fix_truncsfsi2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
- (fix:SI (match_operand:SF 1 "rx_compare_operand" "r,Q")))]
+ (fix:SI (match_operand:SF 1 "rx_compare_operand" "r,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (fix:SI (match_dup 1))
+ (const_int 0)))]
"ALLOW_RX_FPU_INSNS"
- "ftoi\t%1, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "22,44")
+ "ftoi\t%Q1, %0"
+ [(set_attr "timings" "22,44")
(set_attr "length" "3,5")]
)
(define_insn "floatsisf2"
[(set (match_operand:SF 0 "register_operand" "=r,r")
- (float:SF (match_operand:SI 1 "rx_compare_operand" "r,Q")))]
+ (float:SF (match_operand:SI 1 "rx_compare_operand" "r,Q")))
+ (set (reg:CC_ZS CC_REG)
+ (compare:CC_ZS (float:SF (match_dup 1))
+ (const_int 0)))]
"ALLOW_RX_FPU_INSNS"
- "itof\t%1, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "22,44")
+ "itof\t%Q1, %0"
+ [(set_attr "timings" "22,44")
(set_attr "length" "3,6")]
)
@@ -1109,8 +1147,8 @@
;; of three instructions at a time.
(define_insn "bitset"
- [(set:SI (match_operand:SI 0 "register_operand" "+r")
- (ior:SI (match_operand:SI 1 "register_operand" "0")
+ [(set:SI (match_operand:SI 0 "register_operand" "=r")
+ (ior:SI (match_operand:SI 1 "register_operand" "0")
(ashift:SI (const_int 1)
(match_operand:SI 2 "nonmemory_operand" "ri"))))]
""
@@ -1119,8 +1157,8 @@
)
(define_insn "bitset_in_memory"
- [(set:QI (match_operand:QI 0 "memory_operand" "+m")
- (ior:QI (match_operand:QI 1 "memory_operand" "0")
+ [(set:QI (match_operand:QI 0 "memory_operand" "=m")
+ (ior:QI (match_operand:QI 1 "memory_operand" "0")
(ashift:QI (const_int 1)
(match_operand:QI 2 "nonmemory_operand" "ri"))))]
""
@@ -1294,14 +1332,10 @@
)
(define_expand "insv"
- [(set:SI (zero_extract:SI (match_operand:SI
- 0 "nonimmediate_operand") ;; Destination
- (match_operand
- 1 "immediate_operand") ;; # of bits to set
- (match_operand
- 2 "immediate_operand")) ;; Starting bit
- (match_operand
- 3 "immediate_operand"))] ;; Bits to insert
+ [(set:SI (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand") ;; Destination
+ (match_operand 1 "immediate_operand") ;; # of bits to set
+ (match_operand 2 "immediate_operand")) ;; Starting bit
+ (match_operand 3 "immediate_operand"))] ;; Bits to insert
""
{
if (rx_expand_insv (operands))
@@ -1356,8 +1390,7 @@
(unspec_volatile:BLK [(reg:SI 1) (reg:SI 2) (reg:SI 3)] UNSPEC_MOVSTR)
(clobber (reg:SI 1))
(clobber (reg:SI 2))
- (clobber (reg:SI 3))
- ]
+ (clobber (reg:SI 3))]
""
"smovu"
[(set_attr "length" "2")
@@ -1371,11 +1404,11 @@
(clobber (reg:SI 1))
(clobber (reg:SI 2))
(clobber (reg:SI 3))
- ]
+ (clobber (reg:CC CC_REG))
+ ]
""
"mov\t%1, r1\n\tmov\t#0, r2\n\tsuntil.b\n\tmov\tr1, %0\n\tsub\t#1, %0"
[(set_attr "length" "10")
- (set_attr "cc" "clobber")
(set_attr "timings" "1111")] ;; The timing is a guesstimate.
)
@@ -1458,17 +1491,12 @@
)
(define_expand "cmpstrnsi"
- [(set (match_operand:SI
- 0 "register_operand") ;; Result
- (unspec_volatile:SI [(match_operand:BLK
- 1 "memory_operand") ;; String1
- (match_operand:BLK
- 2 "memory_operand")] ;; String2
+ [(set (match_operand:SI 0 "register_operand") ;; Result
+ (unspec_volatile:SI [(match_operand:BLK 1 "memory_operand") ;; String1
+ (match_operand:BLK 2 "memory_operand")] ;; String2
UNSPEC_CMPSTRN))
- (use (match_operand:SI
- 3 "register_operand")) ;; Max Length
- (match_operand:SI
- 4 "immediate_operand")] ;; Known Align
+ (use (match_operand:SI 3 "register_operand")) ;; Max Length
+ (match_operand:SI 4 "immediate_operand")] ;; Known Align
""
{
rtx str1 = gen_rtx_REG (SImode, 1);
@@ -1485,15 +1513,11 @@
)
(define_expand "cmpstrsi"
- [(set (match_operand:SI
- 0 "register_operand") ;; Result
- (unspec_volatile:SI [(match_operand:BLK
- 1 "memory_operand") ;; String1
- (match_operand:BLK
- 2 "memory_operand")] ;; String2
+ [(set (match_operand:SI 0 "register_operand") ;; Result
+ (unspec_volatile:SI [(match_operand:BLK 1 "memory_operand") ;; String1
+ (match_operand:BLK 2 "memory_operand")] ;; String2
UNSPEC_CMPSTRN))
- (match_operand:SI
- 3 "immediate_operand")] ;; Known Align
+ (match_operand:SI 3 "immediate_operand")] ;; Known Align
""
{
rtx str1 = gen_rtx_REG (SImode, 1);
@@ -1517,7 +1541,8 @@
(use (match_operand:BLK 2 "memory_operand" "m"))
(clobber (reg:SI 1))
(clobber (reg:SI 2))
- (clobber (reg:SI 3))]
+ (clobber (reg:SI 3))
+ (clobber (reg:CC CC_REG))]
""
"scmpu ; Perform the string comparison
mov #-1, %0 ; Set up -1 result (which cannot be created
@@ -1658,11 +1683,11 @@
(define_insn "lrintsf2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(unspec:SI [(match_operand:SF 1 "rx_compare_operand" "r,Q")]
- UNSPEC_BUILTIN_ROUND))]
+ UNSPEC_BUILTIN_ROUND))
+ (clobber (reg:CC CC_REG))]
""
"round\t%1, %0"
- [(set_attr "cc" "set_zs")
- (set_attr "timings" "22,44")
+ [(set_attr "timings" "22,44")
(set_attr "length" "3,5")]
)
@@ -1682,22 +1707,20 @@
(define_insn "clrpsw"
[(unspec:SI [(match_operand:SI 0 "immediate_operand" "i")]
UNSPEC_BUILTIN_CLRPSW)
- (clobber (cc0))]
+ (clobber (reg:CC CC_REG))]
""
"clrpsw\t%F0"
- [(set_attr "length" "2")
- (set_attr "cc" "clobber")]
+ [(set_attr "length" "2")]
)
;; Set Processor Status Word
(define_insn "setpsw"
[(unspec:SI [(match_operand:SI 0 "immediate_operand" "i")]
UNSPEC_BUILTIN_SETPSW)
- (clobber (cc0))]
+ (clobber (reg:CC CC_REG))]
""
"setpsw\t%F0"
- [(set_attr "length" "2")
- (set_attr "cc" "clobber")]
+ [(set_attr "length" "2")]
)
;; Move from control register
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index fb6913f2d60..7ff8cb870cd 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -1453,7 +1453,7 @@ s390_narrow_logical_operator (enum rtx_code code, rtx *memop, rtx *immop)
static struct machine_function *
s390_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
/* Change optimizations to be performed, depending on the
@@ -2957,10 +2957,12 @@ s390_reload_symref_address (rtx reg, rtx mem, rtx scratch, bool tomem)
RCLASS requires an extra scratch or immediate register. Return the class
needed for the immediate register. */
-static enum reg_class
-s390_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
+static reg_class_t
+s390_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
enum machine_mode mode, secondary_reload_info *sri)
{
+ enum reg_class rclass = (enum reg_class) rclass_i;
+
/* Intermediate register needed. */
if (reg_classes_intersect_p (CC_REGS, rclass))
return GENERAL_REGS;
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 1d74d30c000..cbe28991c18 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -673,9 +673,6 @@ extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
/* We need current_function_outgoing_args to be valid. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* Return doesn't modify the stack. */
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
-
/* Register arguments. */
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index df7e3dd71e2..f78af00a11c 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -2079,7 +2079,7 @@
[(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY")
(set_attr "type" "fload<mode>,fload<mode>,fload<mode>,
fstore<mode>,fstore<mode>,lr,load,store")
- (set_attr "z10prop" "*,*,*,*,*,*,z10_fr_E1,z10_fwd_A3,z10_rec")])
+ (set_attr "z10prop" "*,*,*,*,*,z10_fr_E1,z10_fwd_A3,z10_rec")])
(define_insn "*mov<mode>_31"
[(set (match_operand:DD_DF 0 "nonimmediate_operand"
@@ -2168,7 +2168,7 @@
[(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY")
(set_attr "type" "fload<mode>,fload<mode>,fload<mode>,
fstore<mode>,fstore<mode>,lr,load,load,store,store")
- (set_attr "z10prop" "*,*,*,*,*,*,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")])
+ (set_attr "z10prop" "*,*,*,*,*,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")])
;
; movcc instruction pattern
diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h
index cde9c222546..98ca0a3537b 100644
--- a/gcc/config/score/score.h
+++ b/gcc/config/score/score.h
@@ -581,8 +581,6 @@ extern enum reg_class score_char_to_class[256];
`crtl->outgoing_args_size'. */
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
/* Passing Arguments in Registers */
/* Determine where to put an argument to a function.
Value is zero to push the argument on the stack,
diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c
index 724cf61bc64..3e20f16dc33 100644
--- a/gcc/config/score/score3.c
+++ b/gcc/config/score/score3.c
@@ -1186,7 +1186,7 @@ score3_output_external (FILE *file ATTRIBUTE_UNUSED,
if (score3_in_small_data_p (decl))
{
- p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
+ p = ggc_alloc_extern_list ();
p->next = extern_head;
p->name = name;
p->size = int_size_in_bytes (TREE_TYPE (decl));
diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c
index 547ac00517a..464d97cee22 100644
--- a/gcc/config/score/score7.c
+++ b/gcc/config/score/score7.c
@@ -1174,7 +1174,7 @@ score7_output_external (FILE *file ATTRIBUTE_UNUSED,
if (score7_in_small_data_p (decl))
{
- p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
+ p = ggc_alloc_extern_list ();
p->next = extern_head;
p->name = name;
p->size = int_size_in_bytes (TREE_TYPE (decl));
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index d59cf6ab118..dc68af1332b 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -64,8 +64,6 @@ extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
extern int nonpic_symbol_mentioned_p (rtx);
extern void emit_sf_insn (rtx);
extern void emit_df_insn (rtx);
-extern void print_operand_address (FILE *, rtx);
-extern void print_operand (FILE *, rtx, int);
extern void output_pic_addr_const (FILE *, rtx);
extern int expand_block_move (rtx *);
extern int prepare_move_operands (rtx[], enum machine_mode mode);
@@ -175,9 +173,9 @@ extern int sh_contains_memref_p (rtx);
extern int sh_loads_bankedreg_p (rtx);
extern rtx shmedia_prepare_call_address (rtx fnaddr, int is_sibcall);
struct secondary_reload_info;
-extern enum reg_class sh_secondary_reload (bool, rtx, enum reg_class,
- enum machine_mode,
- struct secondary_reload_info *);
+extern reg_class_t sh_secondary_reload (bool, rtx, reg_class_t,
+ enum machine_mode,
+ struct secondary_reload_info *);
extern int sh2a_get_function_vector_number (rtx);
extern int sh2a_is_function_vector_call (rtx);
extern void sh_fix_range (const char *);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index abd579ae1a7..b8d2be17c36 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -198,6 +198,9 @@ static tree sh2a_handle_function_vector_handler_attribute (tree *, tree,
static tree sh_handle_sp_switch_attribute (tree *, tree, tree, int, bool *);
static tree sh_handle_trap_exit_attribute (tree *, tree, tree, int, bool *);
static tree sh_handle_renesas_attribute (tree *, tree, tree, int, bool *);
+static void sh_print_operand (FILE *, rtx, int);
+static void sh_print_operand_address (FILE *, rtx);
+static bool sh_print_operand_punct_valid_p (unsigned char code);
static void sh_output_function_epilogue (FILE *, HOST_WIDE_INT);
static void sh_insert_attributes (tree, tree *);
static const char *sh_check_pch_target_flags (int);
@@ -222,7 +225,7 @@ static int sh_variable_issue (FILE *, int, rtx, int);
static bool sh_function_ok_for_sibcall (tree, tree);
static bool sh_cannot_modify_jumps_p (void);
-static enum reg_class sh_target_reg_class (void);
+static reg_class_t sh_target_reg_class (void);
static bool sh_optimize_target_register_callee_saved (bool);
static bool sh_ms_bitfield_layout_p (const_tree);
@@ -326,6 +329,13 @@ static const struct attribute_spec sh_attribute_table[] =
#undef TARGET_ASM_ALIGNED_DI_OP
#define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t"
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND sh_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS sh_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P sh_print_operand_punct_valid_p
+
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE sh_output_function_epilogue
@@ -966,8 +976,8 @@ sh_override_options (void)
/* Print the operand address in x to the stream. */
-void
-print_operand_address (FILE *stream, rtx x)
+static void
+sh_print_operand_address (FILE *stream, rtx x)
{
switch (GET_CODE (x))
{
@@ -1045,8 +1055,8 @@ print_operand_address (FILE *stream, rtx x)
'u' prints the lowest 16 bits of CONST_INT, as an unsigned value.
'o' output an operator. */
-void
-print_operand (FILE *stream, rtx x, int code)
+static void
+sh_print_operand (FILE *stream, rtx x, int code)
{
int regno;
enum machine_mode mode;
@@ -1120,7 +1130,7 @@ print_operand (FILE *stream, rtx x, int code)
else if (MEM_P (x))
{
x = adjust_address (x, SImode, 4 * LSW);
- print_operand_address (stream, XEXP (x, 0));
+ sh_print_operand_address (stream, XEXP (x, 0));
}
else
{
@@ -1132,7 +1142,7 @@ print_operand (FILE *stream, rtx x, int code)
if (GET_MODE_SIZE (mode) >= 8)
sub = simplify_subreg (SImode, x, mode, 4 * LSW);
if (sub)
- print_operand (stream, sub, 0);
+ sh_print_operand (stream, sub, 0);
else
output_operand_lossage ("invalid operand to %%R");
}
@@ -1147,7 +1157,7 @@ print_operand (FILE *stream, rtx x, int code)
else if (MEM_P (x))
{
x = adjust_address (x, SImode, 4 * MSW);
- print_operand_address (stream, XEXP (x, 0));
+ sh_print_operand_address (stream, XEXP (x, 0));
}
else
{
@@ -1159,7 +1169,7 @@ print_operand (FILE *stream, rtx x, int code)
if (GET_MODE_SIZE (mode) >= 8)
sub = simplify_subreg (SImode, x, mode, 4 * MSW);
if (sub)
- print_operand (stream, sub, 0);
+ sh_print_operand (stream, sub, 0);
else
output_operand_lossage ("invalid operand to %%S");
}
@@ -1175,7 +1185,7 @@ print_operand (FILE *stream, rtx x, int code)
if (GET_CODE (XEXP (x, 0)) != PRE_DEC
&& GET_CODE (XEXP (x, 0)) != POST_INC)
x = adjust_address (x, SImode, 4);
- print_operand_address (stream, XEXP (x, 0));
+ sh_print_operand_address (stream, XEXP (x, 0));
break;
default:
break;
@@ -1189,7 +1199,7 @@ print_operand (FILE *stream, rtx x, int code)
{
case REG:
case SUBREG:
- print_operand (stream, x, 0);
+ sh_print_operand (stream, x, 0);
break;
default:
break;
@@ -1248,14 +1258,14 @@ print_operand (FILE *stream, rtx x, int code)
{
case REG:
case SUBREG:
- print_operand (stream, x, 0);
+ sh_print_operand (stream, x, 0);
fputs (", 0", stream);
break;
case PLUS:
- print_operand (stream, XEXP (x, 0), 0);
+ sh_print_operand (stream, XEXP (x, 0), 0);
fputs (", ", stream);
- print_operand (stream, XEXP (x, 1), 0);
+ sh_print_operand (stream, XEXP (x, 1), 0);
break;
default:
@@ -1398,6 +1408,13 @@ print_operand (FILE *stream, rtx x, int code)
break;
}
}
+
+static bool
+sh_print_operand_punct_valid_p (unsigned char code)
+{
+ return (code == '.' || code == '#' || code == '@' || code == ','
+ || code == '$' || code == '\'' || code == '>');
+}
/* Encode symbol attributes of a SYMBOL_REF into its
@@ -7636,13 +7653,15 @@ static tree
sh_build_builtin_va_list (void)
{
tree f_next_o, f_next_o_limit, f_next_fp, f_next_fp_limit, f_next_stack;
- tree record;
+ tree record, type_decl;
if (TARGET_SH5 || (! TARGET_SH2E && ! TARGET_SH4)
|| TARGET_HITACHI || sh_cfun_attr_renesas_p ())
return ptr_type_node;
record = (*lang_hooks.types.make_type) (RECORD_TYPE);
+ type_decl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__va_list_tag"), record);
f_next_o = build_decl (BUILTINS_LOCATION,
FIELD_DECL, get_identifier ("__va_next_o"),
@@ -7668,6 +7687,8 @@ sh_build_builtin_va_list (void)
DECL_FIELD_CONTEXT (f_next_fp_limit) = record;
DECL_FIELD_CONTEXT (f_next_stack) = record;
+ TREE_CHAIN (record) = type_decl;
+ TYPE_NAME (record) = type_decl;
TYPE_FIELDS (record) = f_next_o;
TREE_CHAIN (f_next_o) = f_next_o_limit;
TREE_CHAIN (f_next_o_limit) = f_next_fp;
@@ -7865,7 +7886,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
lab_false = create_artificial_label (UNKNOWN_LOCATION);
lab_over = create_artificial_label (UNKNOWN_LOCATION);
- valist = build1 (INDIRECT_REF, ptr_type_node, addr);
+ valist = build_simple_mem_ref (addr);
if (pass_as_float)
{
@@ -10498,7 +10519,7 @@ sh_cannot_modify_jumps_p (void)
return (TARGET_SHMEDIA && (reload_in_progress || reload_completed));
}
-static enum reg_class
+static reg_class_t
sh_target_reg_class (void)
{
return TARGET_SHMEDIA ? TARGET_REGS : NO_REGS;
@@ -12137,10 +12158,12 @@ shmedia_prepare_call_address (rtx fnaddr, int is_sibcall)
return fnaddr;
}
-enum reg_class
-sh_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
+reg_class_t
+sh_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
enum machine_mode mode, secondary_reload_info *sri)
{
+ enum reg_class rclass = (enum reg_class) rclass_i;
+
if (in_p)
{
if (REGCLASS_HAS_FP_REG (rclass)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 4eb8f397ef9..ee3e05995d6 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1423,17 +1423,6 @@ extern enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
/* Offset of first parameter from the argument pointer register value. */
#define FIRST_PARM_OFFSET(FNDECL) 0
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the SH, the caller does not pop any of its arguments that were passed
- on the stack. */
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Value is the number of bytes of arguments automatically popped when
calling a subroutine.
CUM is the accumulated argument list.
@@ -2441,20 +2430,6 @@ struct sh_args {
#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
final_prescan_insn ((INSN), (OPVEC), (NOPERANDS))
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(STREAM, X, CODE) print_operand ((STREAM), (X), (CODE))
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(STREAM,X) print_operand_address ((STREAM), (X))
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
- ((CHAR) == '.' || (CHAR) == '#' || (CHAR) == '@' || (CHAR) == ',' \
- || (CHAR) == '$' || (CHAR) == '\'' || (CHAR) == '>')
-
/* Recognize machine-specific patterns that may appear within
constants. Used for PIC-specific UNSPECs. */
#define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL) \
diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c
index 0b322d1f80f..f53fc32acce 100644
--- a/gcc/config/sol2-c.c
+++ b/gcc/config/sol2-c.c
@@ -26,12 +26,12 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "toplev.h"
-#include "c-format.h"
+#include "c-family/c-format.h"
#include "intl.h"
#include "cpplib.h"
-#include "c-pragma.h"
-#include "c-common.h"
+#include "c-family/c-pragma.h"
+#include "c-family/c-common.h"
/* cmn_err only accepts "l" and "ll". */
static const format_length_info cmn_err_length_specs[] =
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 98e54e6a92c..7b7ce2bfbab 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -99,7 +99,8 @@ along with GCC; see the file COPYING3. If not see
library. */ \
if (c_dialect_cxx ()) \
{ \
- builtin_define ("_XOPEN_SOURCE=500"); \
+ builtin_define ("__STDC_VERSION__=199901L");\
+ builtin_define ("_XOPEN_SOURCE=600"); \
builtin_define ("_LARGEFILE_SOURCE=1"); \
builtin_define ("_LARGEFILE64_SOURCE=1"); \
builtin_define ("__EXTENSIONS__"); \
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index fd602ccd200..cc51280596c 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -66,8 +66,6 @@ extern bool legitimate_pic_operand_p (rtx);
extern void sparc_emit_call_insn (rtx, rtx);
extern void sparc_defer_case_vector (rtx, rtx, int);
extern bool sparc_expand_move (enum machine_mode, rtx *);
-extern void sparc_emit_set_const32 (rtx, rtx);
-extern void sparc_emit_set_const64 (rtx, rtx);
extern void sparc_emit_set_symbolic_const64 (rtx, rtx, rtx);
extern int sparc_splitdi_legitimate (rtx, rtx);
extern int sparc_absnegfloat_split_legitimate (rtx, rtx);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 9e33c740b01..412f27c3066 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -354,6 +354,8 @@ static int function_arg_slotno (const CUMULATIVE_ARGS *, enum machine_mode,
static int supersparc_adjust_cost (rtx, rtx, rtx, int);
static int hypersparc_adjust_cost (rtx, rtx, rtx, int);
+static void sparc_emit_set_const32 (rtx, rtx);
+static void sparc_emit_set_const64 (rtx, rtx);
static void sparc_output_addr_vec (rtx);
static void sparc_output_addr_diff_vec (rtx);
static void sparc_output_deferred_case_vectors (void);
@@ -1111,7 +1113,7 @@ sparc_expand_move (enum machine_mode mode, rtx *operands)
We know it can't be done in one insn when we get
here, the move expander guarantees this. */
-void
+static void
sparc_emit_set_const32 (rtx op0, rtx op1)
{
enum machine_mode mode = GET_MODE (op0);
@@ -1353,7 +1355,7 @@ sparc_emit_set_symbolic_const64 (rtx op0, rtx op1, rtx temp)
}
#if HOST_BITS_PER_WIDE_INT == 32
-void
+static void
sparc_emit_set_const64 (rtx op0 ATTRIBUTE_UNUSED, rtx op1 ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
@@ -1710,7 +1712,7 @@ create_simple_focus_bits (unsigned HOST_WIDE_INT high_bits,
being loaded into a register. Emit the most efficient
insn sequence possible. Detection of all the 1-insn cases
has been done already. */
-void
+static void
sparc_emit_set_const64 (rtx op0, rtx op1)
{
unsigned HOST_WIDE_INT high_bits, low_bits;
@@ -1936,10 +1938,6 @@ sparc_emit_set_const64 (rtx op0, rtx op1)
}
/* The easiest way when all else fails, is full decomposition. */
-#if 0
- printf ("sparc_emit_set_const64: Hard constant [%08lx%08lx] neg[%08lx%08lx]\n",
- high_bits, low_bits, ~high_bits, ~low_bits);
-#endif
sparc_emit_set_const64_longway (op0, temp, high_bits, low_bits);
}
#endif /* HOST_BITS_PER_WIDE_INT == 32 */
@@ -9032,7 +9030,7 @@ sparc_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED,
static struct machine_function *
sparc_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
/* Locate some local-dynamic symbol still in use by this function
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 256b79cbc36..fa2434e8830 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1387,15 +1387,6 @@ extern char leaf_reg_remap[];
the function! */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
/* Define this macro if the target machine has "register windows". This
C expression returns the register number as seen by the called function
corresponding to register number OUT as seen by the calling function.
diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c
index a4f2274d92d..ce5f92d94db 100644
--- a/gcc/config/spu/spu-c.c
+++ b/gcc/config/spu/spu-c.c
@@ -20,8 +20,8 @@
#include "tm.h"
#include "cpplib.h"
#include "tree.h"
-#include "c-common.h"
-#include "c-pragma.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
#include "tm_p.h"
#include "langhooks.h"
diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h
index eae6badf192..6bf4f65fc1c 100644
--- a/gcc/config/spu/spu-protos.h
+++ b/gcc/config/spu/spu-protos.h
@@ -36,7 +36,7 @@ extern int spu_split_immediate (rtx * ops);
extern int spu_saved_regs_size (void);
extern int direct_return (void);
extern void spu_expand_prologue (void);
-extern void spu_expand_epilogue (unsigned char sibcall_p);
+extern void spu_expand_epilogue (bool sibcall_p);
extern rtx spu_return_addr (int count, rtx frame);
#ifdef RTX_CODE
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 0eff2ccfc8d..4b7f9162395 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -150,8 +150,8 @@ char regs_ever_allocated[FIRST_PSEUDO_REGISTER];
/* Prototypes and external defs. */
static void spu_init_builtins (void);
static tree spu_builtin_decl (unsigned, bool);
-static unsigned char spu_scalar_mode_supported_p (enum machine_mode mode);
-static unsigned char spu_vector_mode_supported_p (enum machine_mode mode);
+static bool spu_scalar_mode_supported_p (enum machine_mode mode);
+static bool spu_vector_mode_supported_p (enum machine_mode mode);
static bool spu_legitimate_address_p (enum machine_mode, rtx, bool);
static bool spu_addr_space_legitimate_address_p (enum machine_mode, rtx,
bool, addr_space_t);
@@ -180,13 +180,13 @@ static void spu_sched_init (FILE *, int, int);
static int spu_sched_reorder (FILE *, int, rtx *, int *, int);
static tree spu_handle_fndecl_attribute (tree * node, tree name, tree args,
int flags,
- unsigned char *no_add_attrs);
+ bool *no_add_attrs);
static tree spu_handle_vector_attribute (tree * node, tree name, tree args,
int flags,
- unsigned char *no_add_attrs);
+ bool *no_add_attrs);
static int spu_naked_function_p (tree func);
-static unsigned char spu_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- const_tree type, unsigned char named);
+static bool spu_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named);
static tree spu_build_builtin_va_list (void);
static void spu_va_start (tree, rtx);
static tree spu_gimplify_va_arg_expr (tree valist, tree type,
@@ -196,9 +196,9 @@ static int mem_is_padded_component_ref (rtx x);
static int reg_aligned_for_addr (rtx x);
static bool spu_assemble_integer (rtx x, unsigned int size, int aligned_p);
static void spu_asm_globalize_label (FILE * file, const char *name);
-static unsigned char spu_rtx_costs (rtx x, int code, int outer_code,
- int *total, bool speed);
-static unsigned char spu_function_ok_for_sibcall (tree decl, tree exp);
+static bool spu_rtx_costs (rtx x, int code, int outer_code,
+ int *total, bool speed);
+static bool spu_function_ok_for_sibcall (tree decl, tree exp);
static void spu_init_libfuncs (void);
static bool spu_return_in_memory (const_tree type, const_tree fntype);
static void fix_range (const char *);
@@ -209,7 +209,7 @@ static rtx spu_addr_space_legitimize_address (rtx, rtx, enum machine_mode,
static tree spu_builtin_mul_widen_even (tree);
static tree spu_builtin_mul_widen_odd (tree);
static tree spu_builtin_mask_for_load (void);
-static int spu_builtin_vectorization_cost (bool);
+static int spu_builtin_vectorization_cost (enum vect_cost_for_stmt);
static bool spu_vector_alignment_reachable (const_tree, bool);
static tree spu_builtin_vec_perm (tree, tree *);
static enum machine_mode spu_addr_space_pointer_mode (addr_space_t);
@@ -432,8 +432,8 @@ static const struct attribute_spec spu_attribute_table[] =
#undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
#define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST spu_builtin_vectorization_cost
-#undef TARGET_VECTOR_ALIGNMENT_REACHABLE
-#define TARGET_VECTOR_ALIGNMENT_REACHABLE spu_vector_alignment_reachable
+#undef TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
+#define TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE spu_vector_alignment_reachable
#undef TARGET_VECTORIZE_BUILTIN_VEC_PERM
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM spu_builtin_vec_perm
@@ -4171,7 +4171,7 @@ spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p,
f_args = TYPE_FIELDS (TREE_TYPE (va_list_type_node));
f_skip = TREE_CHAIN (f_args);
- valist = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (valist)), valist);
+ valist = build_simple_mem_ref (valist);
args =
build3 (COMPONENT_REF, TREE_TYPE (f_args), valist, f_args, NULL_TREE);
skip =
@@ -4488,8 +4488,7 @@ ea_load_store_inline (rtx mem, bool is_store, rtx ea_addr, rtx data_addr)
hit_ref, pc_rtx)));
/* Say that this branch is very likely to happen. */
v = REG_BR_PROB_BASE - REG_BR_PROB_BASE / 100 - 1;
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_BR_PROB, GEN_INT (v), REG_NOTES (insn));
+ add_reg_note (insn, REG_BR_PROB, GEN_INT (v));
ea_load_store (mem, is_store, ea_addr, data_addr);
cont_label = gen_label_rtx ();
@@ -6695,17 +6694,36 @@ spu_builtin_mask_for_load (void)
/* Implement targetm.vectorize.builtin_vectorization_cost. */
static int
-spu_builtin_vectorization_cost (bool runtime_test)
-{
- /* If the branch of the runtime test is taken - i.e. - the vectorized
- version is skipped - this incurs a misprediction cost (because the
- vectorized version is expected to be the fall-through). So we subtract
- the latency of a mispredicted branch from the costs that are incurred
- when the vectorized version is executed. */
- if (runtime_test)
- return -19;
- else
- return 0;
+spu_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost)
+{
+ switch (type_of_cost)
+ {
+ case scalar_stmt:
+ case vector_stmt:
+ case vector_load:
+ case vector_store:
+ case vec_to_scalar:
+ case scalar_to_vec:
+ case cond_branch_not_taken:
+ case vec_perm:
+ return 1;
+
+ case scalar_store:
+ return 10;
+
+ case scalar_load:
+ /* Load + rotate. */
+ return 2;
+
+ case unaligned_load:
+ return 2;
+
+ case cond_branch_taken:
+ return 6;
+
+ default:
+ gcc_unreachable ();
+ }
}
/* Return true iff, data reference of TYPE can reach vector alignment (16)
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index c8b0e121038..d3880418c2f 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -334,8 +334,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (0)
-
/* Register Arguments */
@@ -524,57 +522,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
do { if (LOG!=0) fprintf (FILE, "\t.align\t%d\n", (LOG)); } while (0)
-/* Model costs for the vectorizer. */
-
-/* Cost of conditional branch. */
-#ifndef TARG_COND_BRANCH_COST
-#define TARG_COND_BRANCH_COST 6
-#endif
-
-/* Cost of any scalar operation, excluding load and store. */
-#ifndef TARG_SCALAR_STMT_COST
-#define TARG_SCALAR_STMT_COST 1
-#endif
-
-/* Cost of scalar load. */
-#undef TARG_SCALAR_LOAD_COST
-#define TARG_SCALAR_LOAD_COST 2 /* load + rotate */
-
-/* Cost of scalar store. */
-#undef TARG_SCALAR_STORE_COST
-#define TARG_SCALAR_STORE_COST 10
-
-/* Cost of any vector operation, excluding load, store,
- or vector to scalar operation. */
-#undef TARG_VEC_STMT_COST
-#define TARG_VEC_STMT_COST 1
-
-/* Cost of vector to scalar operation. */
-#undef TARG_VEC_TO_SCALAR_COST
-#define TARG_VEC_TO_SCALAR_COST 1
-
-/* Cost of scalar to vector operation. */
-#undef TARG_SCALAR_TO_VEC_COST
-#define TARG_SCALAR_TO_VEC_COST 1
-
-/* Cost of aligned vector load. */
-#undef TARG_VEC_LOAD_COST
-#define TARG_VEC_LOAD_COST 1
-
-/* Cost of misaligned vector load. */
-#undef TARG_VEC_UNALIGNED_LOAD_COST
-#define TARG_VEC_UNALIGNED_LOAD_COST 2
-
-/* Cost of vector store. */
-#undef TARG_VEC_STORE_COST
-#define TARG_VEC_STORE_COST 1
-
-/* Cost of vector permutation. */
-#ifndef TARG_VEC_PERMUTE_COST
-#define TARG_VEC_PERMUTE_COST 1
-#endif
-
-
/* Misc */
#define CASE_VECTOR_MODE SImode
diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h
index cf6acf586c2..4ea89a218db 100644
--- a/gcc/config/stormy16/stormy16.h
+++ b/gcc/config/stormy16/stormy16.h
@@ -328,8 +328,6 @@ enum reg_class
#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-
/* Function Arguments in Registers. */
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index 4e0a00e27ce..b538ccfa405 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -26,7 +26,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(srcdir)/config/darwin.c
darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(CPPLIB_H) $(TREE_H) c-pragma.h toplev.h $(TM_P_H) \
+ $(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) toplev.h $(TM_P_H) \
incpath.h flags.h $(C_COMMON_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/darwin-c.c $(PREPROCESSOR_DEFINES)
diff --git a/gcc/config/t-sol2 b/gcc/config/t-sol2
index 526ae407382..6112f2db8b5 100644
--- a/gcc/config/t-sol2
+++ b/gcc/config/t-sol2
@@ -18,8 +18,8 @@
# Solaris-specific format checking and pragmas
sol2-c.o: $(srcdir)/config/sol2-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- tree.h c-format.h intl.h $(CPPLIB_H) c-pragma.h $(TM_H) $(TM_P_H) \
- toplev.h $(C_COMMON_H)
+ tree.h c-family/c-format.h $(C_PRAGMA_H) $(C_COMMON_H) $(CPPLIB_H) \
+ intl.h $(TM_H) $(TM_P_H) toplev.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/sol2-c.c
diff --git a/gcc/config/v850/t-v850 b/gcc/config/v850/t-v850
index 5c893d802e3..139ec5b40d5 100644
--- a/gcc/config/v850/t-v850
+++ b/gcc/config/v850/t-v850
@@ -108,7 +108,7 @@ MULTILIB_MATCHES = mv850e=mv850e1
TCFLAGS = -mno-app-regs -msmall-sld -Wa,-mwarn-signed-overflow -Wa,-mwarn-unsigned-overflow
v850-c.o: $(srcdir)/config/v850/v850-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(CPPLIB_H) $(TREE_H) c-pragma.h toplev.h $(GGC_H) $(TM_P_H)
+ $(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) toplev.h $(GGC_H) $(TM_P_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/v850/v850-c.c
diff --git a/gcc/config/v850/t-v850e b/gcc/config/v850/t-v850e
index 9fcd897bb17..f0e9c6f6e5c 100644
--- a/gcc/config/v850/t-v850e
+++ b/gcc/config/v850/t-v850e
@@ -106,7 +106,7 @@ INSTALL_LIBGCC = install-multilib
TCFLAGS = -mno-app-regs -msmall-sld -Wa,-mwarn-signed-overflow -Wa,-mwarn-unsigned-overflow
v850-c.o: $(srcdir)/config/v850/v850-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(CPPLIB_H) $(TREE_H) c-pragma.h toplev.h $(GGC_H) $(TM_P_H)
+ $(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) toplev.h $(GGC_H) $(TM_P_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/v850/v850-c.c
diff --git a/gcc/config/v850/v850-c.c b/gcc/config/v850/v850-c.c
index 0d53a72db5c..c3c3815492e 100644
--- a/gcc/config/v850/v850-c.c
+++ b/gcc/config/v850/v850-c.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "cpplib.h"
#include "tree.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "toplev.h"
#include "ggc.h"
#include "tm_p.h"
diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h
index d0ab31802f3..eadcc0a7637 100644
--- a/gcc/config/v850/v850-protos.h
+++ b/gcc/config/v850/v850-protos.h
@@ -35,8 +35,6 @@ extern void v850_init_expanders (void);
#ifdef RTX_CODE
extern int v850_output_addr_const_extra (FILE *, rtx);
extern rtx v850_return_addr (int);
-extern void print_operand (FILE *, rtx, int );
-extern void print_operand_address (FILE *, rtx);
extern const char *output_move_single (rtx *);
extern void notice_update_cc (rtx, rtx);
extern char * construct_save_jarl (rtx);
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index 18b1a1ac744..28b4c87a2e4 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -75,6 +75,9 @@ static int v850_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
static bool v850_can_eliminate (const int, const int);
static void v850_asm_trampoline_template (FILE *);
static void v850_trampoline_init (rtx, tree, rtx);
+static void v850_print_operand (FILE *, rtx, int);
+static void v850_print_operand_address (FILE *, rtx);
+static bool v850_print_operand_punct_valid_p (unsigned char code);
/* Information about the various small memory areas. */
struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
@@ -124,6 +127,13 @@ static const struct attribute_spec v850_attribute_table[] =
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND v850_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS v850_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P v850_print_operand_punct_valid_p
+
#undef TARGET_ATTRIBUTE_TABLE
#define TARGET_ATTRIBUTE_TABLE v850_attribute_table
@@ -514,8 +524,8 @@ v850_rtx_costs (rtx x,
/* Print operand X using operand code CODE to assembly language output file
FILE. */
-void
-print_operand (FILE * file, rtx x, int code)
+static void
+v850_print_operand (FILE * file, rtx x, int code)
{
HOST_WIDE_INT high, low;
@@ -659,7 +669,7 @@ print_operand (FILE * file, rtx x, int code)
break;
case MEM:
x = XEXP (adjust_address (x, SImode, 4), 0);
- print_operand_address (file, x);
+ v850_print_operand_address (file, x);
if (GET_CODE (x) == CONST_INT)
fprintf (file, "[r0]");
break;
@@ -730,7 +740,7 @@ print_operand (FILE * file, rtx x, int code)
case CONST:
case LABEL_REF:
case CODE_LABEL:
- print_operand_address (file, x);
+ v850_print_operand_address (file, x);
break;
default:
gcc_unreachable ();
@@ -743,14 +753,14 @@ print_operand (FILE * file, rtx x, int code)
/* Output assembly language output for the address ADDR to FILE. */
-void
-print_operand_address (FILE * file, rtx addr)
+static void
+v850_print_operand_address (FILE * file, rtx addr)
{
switch (GET_CODE (addr))
{
case REG:
fprintf (file, "0[");
- print_operand (file, addr, 0);
+ v850_print_operand (file, addr, 0);
fprintf (file, "]");
break;
case LO_SUM:
@@ -758,9 +768,9 @@ print_operand_address (FILE * file, rtx addr)
{
/* reg,foo */
fprintf (file, "lo(");
- print_operand (file, XEXP (addr, 1), 0);
+ v850_print_operand (file, XEXP (addr, 1), 0);
fprintf (file, ")[");
- print_operand (file, XEXP (addr, 0), 0);
+ v850_print_operand (file, XEXP (addr, 0), 0);
fprintf (file, "]");
}
break;
@@ -769,16 +779,16 @@ print_operand_address (FILE * file, rtx addr)
|| GET_CODE (XEXP (addr, 0)) == SUBREG)
{
/* reg,foo */
- print_operand (file, XEXP (addr, 1), 0);
+ v850_print_operand (file, XEXP (addr, 1), 0);
fprintf (file, "[");
- print_operand (file, XEXP (addr, 0), 0);
+ v850_print_operand (file, XEXP (addr, 0), 0);
fprintf (file, "]");
}
else
{
- print_operand (file, XEXP (addr, 0), 0);
+ v850_print_operand (file, XEXP (addr, 0), 0);
fprintf (file, "+");
- print_operand (file, XEXP (addr, 1), 0);
+ v850_print_operand (file, XEXP (addr, 1), 0);
}
break;
case SYMBOL_REF:
@@ -847,6 +857,12 @@ print_operand_address (FILE * file, rtx addr)
}
}
+static bool
+v850_print_operand_punct_valid_p (unsigned char code)
+{
+ return code == '.';
+}
+
/* When assemble_integer is used to emit the offsets for a switch
table it can encounter (TRUNCATE:HI (MINUS:SI (LABEL_REF:SI) (LABEL_REF:SI))).
output_addr_const will normally barf at this, but it is OK to omit
diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h
index 4a288178b7a..25faff1e7dd 100644
--- a/gcc/config/v850/v850.h
+++ b/gcc/config/v850/v850.h
@@ -556,15 +556,6 @@ enum reg_class
/* Keep the stack pointer constant throughout the function. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
#define RETURN_ADDR_RTX(COUNT, FP) v850_return_addr (COUNT)
/* Define a data type for recording info about an argument list
@@ -915,19 +906,6 @@ typedef enum
{ "r30", 30 }, \
{ "lp", 31} }
-/* Print an instruction operand X on file FILE.
- look in v850.c for details */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '.')
-
-/* Print a memory operand whose address is X, on file FILE.
- This uses a function in output-vax.c. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
#define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
#define ASM_OUTPUT_REG_POP(FILE,REGNO)
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 5d547fee8d5..b3dfcb1e079 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -58,6 +58,7 @@ static rtx vax_struct_value_rtx (tree, int);
static rtx vax_builtin_setjmp_frame_value (void);
static void vax_asm_trampoline_template (FILE *);
static void vax_trampoline_init (rtx, tree, rtx);
+static int vax_return_pops_args (tree, tree, int);
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
@@ -106,6 +107,8 @@ static void vax_trampoline_init (rtx, tree, rtx);
#define TARGET_ASM_TRAMPOLINE_TEMPLATE vax_asm_trampoline_template
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT vax_trampoline_init
+#undef TARGET_RETURN_POPS_ARGS
+#define TARGET_RETURN_POPS_ARGS vax_return_pops_args
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -2068,3 +2071,18 @@ vax_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
emit_insn (gen_sync_istream ());
}
+/* Value is the number of bytes of arguments automatically
+ popped when returning from a subroutine call.
+ FUNDECL is the declaration node of the function (as a tree),
+ FUNTYPE is the data type of the function (as a tree),
+ or for a library call it is an identifier node for the subroutine name.
+ SIZE is the number of bytes of arguments passed on the stack.
+
+ On the VAX, the RET insn pops a maximum of 255 args for any function. */
+
+static int
+vax_return_pops_args (tree fundecl ATTRIBUTE_UNUSED,
+ tree funtype ATTRIBUTE_UNUSED, int size)
+{
+ return size > 255 * 4 ? 0 : size;
+}
diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h
index e85ce01f820..88a8f1c9b1f 100644
--- a/gcc/config/vax/vax.h
+++ b/gcc/config/vax/vax.h
@@ -305,18 +305,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
/* Offset of first parameter from the argument pointer register value. */
#define FIRST_PARM_OFFSET(FNDECL) 4
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the VAX, the RET insn pops a maximum of 255 args for any function. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((SIZE) > 255 * 4 ? 0 : (SIZE))
-
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h
index 6bd1e565fe7..729bc84bbbc 100644
--- a/gcc/config/xtensa/xtensa-protos.h
+++ b/gcc/config/xtensa/xtensa-protos.h
@@ -67,9 +67,9 @@ extern void xtensa_output_literal (FILE *, rtx, enum machine_mode, int);
extern rtx xtensa_return_addr (int, rtx);
extern enum reg_class xtensa_preferred_reload_class (rtx, enum reg_class, int);
struct secondary_reload_info;
-extern enum reg_class xtensa_secondary_reload (bool, rtx, enum reg_class,
- enum machine_mode,
- struct secondary_reload_info *);
+extern reg_class_t xtensa_secondary_reload (bool, rtx, reg_class_t,
+ enum machine_mode,
+ struct secondary_reload_info *);
#endif /* RTX_CODE */
#ifdef TREE_CODE
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 76e872dddb3..5d891cde044 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1,5 +1,5 @@
/* Subroutines for insn-output.c for Tensilica's Xtensa architecture.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
@@ -1281,7 +1281,7 @@ xtensa_expand_nonlocal_goto (rtx *operands)
static struct machine_function *
xtensa_init_machine_status (void)
{
- return GGC_CNEW (struct machine_function);
+ return ggc_alloc_cleared_machine_function ();
}
@@ -3089,8 +3089,8 @@ xtensa_preferred_reload_class (rtx x, enum reg_class rclass, int isoutput)
}
-enum reg_class
-xtensa_secondary_reload (bool in_p, rtx x, enum reg_class rclass,
+reg_class_t
+xtensa_secondary_reload (bool in_p, rtx x, reg_class_t rclass,
enum machine_mode mode, secondary_reload_info *sri)
{
int regno;
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 80c296d930f..32819bc0de7 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -547,9 +547,6 @@ extern const enum reg_class xtensa_regno_to_class[FIRST_PSEUDO_REGISTER];
128-bit datatypes defined in TIE (e.g., for Vectra). */
#define STACK_BOUNDARY 128
-/* Functions do not pop arguments off the stack. */
-#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
-
/* Use a fixed register window size of 8. */
#define WINDOW_SIZE 8
diff --git a/gcc/configure b/gcc/configure
index ea79930b808..d1dcf891b8d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -7549,7 +7549,7 @@ test -n "$BISON" || BISON="$MISSING bison"
# NM
if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
&& test -d ../binutils ; then
- NM='$(objdir)/../binutils/nm-new'
+ NM='${objdir}/../binutils/nm-new'
else
# Extract the first word of "nm", so it can be a program name with args.
set dummy nm; ac_word=$2
@@ -7594,7 +7594,7 @@ fi
# AR
if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
&& test -d ../binutils ; then
- AR='$(objdir)/../binutils/ar'
+ AR='${objdir}/../binutils/ar'
else
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
@@ -10823,7 +10823,7 @@ tmake_file="${tmake_file_}"
out_object_file=`basename $out_file .c`.o
tm_file_list="options.h"
-tm_include_list="options.h"
+tm_include_list="options.h insn-constants.h"
for f in $tm_file; do
case $f in
./* )
@@ -24844,6 +24844,43 @@ $as_echo "$gcc_cv_ld_no_dot_syms" >&6; }
$as_echo "#define HAVE_LD_NO_DOT_SYMS 1" >>confdefs.h
fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker large toc support" >&5
+$as_echo_n "checking linker large toc support... " >&6; }
+if test "${gcc_cv_ld_large_toc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_ld_large_toc=no
+ if test $in_tree_ld = yes ; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then
+ gcc_cv_ld_large_toc=yes
+ fi
+ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
+ cat > conftest.s <<EOF
+ .section ".tbss","awT",@nobits
+ .align 3
+ie0: .space 8
+ .global _start
+ .text
+_start:
+ addis 9,13,ie0@got@tprel@ha
+ ld 9,ie0@got@tprel@l(9)
+EOF
+ if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
+ && $gcc_cv_ld -melf64ppc --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then
+ gcc_cv_ld_large_toc=yes
+ fi
+ rm -f conftest conftest.o conftest.s
+ fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_large_toc" >&5
+$as_echo "$gcc_cv_ld_large_toc" >&6; }
+ if test x"$gcc_cv_ld_large_toc" = xyes; then
+
+$as_echo "#define HAVE_LD_LARGE_TOC 1" >>confdefs.h
+
+ fi
;;
esac
@@ -26906,7 +26943,7 @@ case ${CONFIG_HEADERS} in
echo > cstamp-h ;;
esac
# Make sure all the subdirs exist.
-for d in $subdirs doc build
+for d in $subdirs doc build c-family
do
test -d $d || mkdir $d
done
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 27cb45c9a9d..9b3a75d95eb 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -913,7 +913,7 @@ AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
# NM
if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
&& test -d ../binutils ; then
- NM='$(objdir)/../binutils/nm-new'
+ NM='${objdir}/../binutils/nm-new'
else
AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
fi
@@ -921,7 +921,7 @@ fi
# AR
if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
&& test -d ../binutils ; then
- AR='$(objdir)/../binutils/ar'
+ AR='${objdir}/../binutils/ar'
else
AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
fi
@@ -1643,7 +1643,7 @@ tmake_file="${tmake_file_}"
out_object_file=`basename $out_file .c`.o
tm_file_list="options.h"
-tm_include_list="options.h"
+tm_include_list="options.h insn-constants.h"
for f in $tm_file; do
case $f in
./* )
@@ -3996,6 +3996,36 @@ EOF
AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
[Define if your PowerPC64 linker only needs function descriptor syms.])
fi
+
+ AC_CACHE_CHECK(linker large toc support,
+ gcc_cv_ld_large_toc,
+ [gcc_cv_ld_large_toc=no
+ if test $in_tree_ld = yes ; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then
+ gcc_cv_ld_large_toc=yes
+ fi
+ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
+ cat > conftest.s <<EOF
+ .section ".tbss","awT",@nobits
+ .align 3
+ie0: .space 8
+ .global _start
+ .text
+_start:
+ addis 9,13,ie0@got@tprel@ha
+ ld 9,ie0@got@tprel@l(9)
+EOF
+ if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
+ && $gcc_cv_ld -melf64ppc --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then
+ gcc_cv_ld_large_toc=yes
+ fi
+ rm -f conftest conftest.o conftest.s
+ fi
+ ])
+ if test x"$gcc_cv_ld_large_toc" = xyes; then
+ AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
+ [Define if your PowerPC64 linker supports a large TOC.])
+ fi
;;
esac
@@ -4638,7 +4668,7 @@ case ${CONFIG_HEADERS} in
echo > cstamp-h ;;
esac
# Make sure all the subdirs exist.
-for d in $subdirs doc build
+for d in $subdirs doc build c-family
do
test -d $d || mkdir $d
done
diff --git a/gcc/convert.c b/gcc/convert.c
index 436fb2a6587..f54b6d9adfe 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -46,7 +46,8 @@ convert_to_pointer (tree type, tree expr)
/* Propagate overflow to the NULL pointer. */
if (integer_zerop (expr))
- return force_fit_type_double (type, 0, 0, 0, TREE_OVERFLOW (expr));
+ return force_fit_type_double (type, double_int_zero, 0,
+ TREE_OVERFLOW (expr));
switch (TREE_CODE (TREE_TYPE (expr)))
{
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index a7bc8dbb67a..b631d94d85f 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -68,9 +68,6 @@ struct cl_optimization;
struct gimple_seq_d;
typedef struct gimple_seq_d *gimple_seq;
typedef const struct gimple_seq_d *const_gimple_seq;
-struct gimple_seq_node_d;
-typedef struct gimple_seq_node_d *gimple_seq_node;
-typedef const struct gimple_seq_node_d *const_gimple_seq_node;
/* Address space number for named address space support. */
typedef unsigned char addr_space_t;
@@ -113,6 +110,20 @@ typedef const struct edge_def *const_edge;
struct basic_block_def;
typedef struct basic_block_def *basic_block;
typedef const struct basic_block_def *const_basic_block;
+
+#define obstack_chunk_alloc ((void *(*) (long)) xmalloc)
+#define obstack_chunk_free ((void (*) (void *)) free)
+#define OBSTACK_CHUNK_SIZE 0
+#define gcc_obstack_init(OBSTACK) \
+ _obstack_begin ((OBSTACK), OBSTACK_CHUNK_SIZE, 0, \
+ obstack_chunk_alloc, \
+ obstack_chunk_free)
+
+/* enum reg_class is target specific, so it should not appear in
+ target-independent code or interfaces, like the target hook declarations
+ in target.h. */
+typedef int reg_class_t;
+
#else
struct _dont_use_rtx_here_;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 48a4613b477..27e7f7a5ff3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,565 @@
+2010-07-01 Richard Guenther <rguenther@suse.de>
+
+ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs
+ predicate we are looking for, allow non-gimplified
+ INDIRECT_REFs.
+
+2010-06-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44628
+ * typeck.c (cp_build_unary_op): Early return error_mark_node when
+ arg is NULL_TREE too.
+ * call.c (convert_class_to_reference): Return error_mark_node when
+ expr is NULL_TREE.
+
+2010-06-30 Michael Matz <matz@suse.de>
+
+ * repo.c (finish_repo): Fix typo.
+
+2010-06-30 Nathan Froyd <froydnj@codesourcery.com>
+
+ * parser.c (cp_parser_omp_for_loop): Use a VEC for for_block.
+
+2010-06-30 Nathan Froyd <froydnj@codesourcery.com>
+
+ * repo.c (pending_repo): Change type to a VEC.
+ (finish_repo): Adjust for new type of pending_repo.
+ (repo_emit_p): Likewise.
+
+2010-06-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * tree.c: Include gimple.h. Do not include tree-flow.h
+ * decl.c: Do not include tree-flow.h
+ * Make-lang.in: Adjust dependencies.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * decl.c (incomplete_var): Declare. Declare VECs containing them.
+ (incomplete_vars): Adjust comment. Change type to a VEC.
+ (maybe_register_incomplete_var): Adjust for new type.
+ (complete_vars): Adjust iteration over incomplete_vars.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * decl.c (struct named_label_entry): Change type of bad_decls field
+ to a VEC.
+ (poplevel_named_label_1): Adjust for new type of bad_decls.
+ (check_goto): Likewise.
+
+2010-06-29 Jason Merrill <jason@redhat.com>
+
+ Enable implicitly declared move constructor/operator= (N3053).
+ * class.c (add_implicitly_declared_members): A class with no
+ explicitly declared copy or move constructor gets both declared
+ implicitly, and similarly for operator=.
+ (check_bases): A type with no copy ctor does not inhibit
+ a const copy ctor in a derived class. It does mean the derived
+ one is non-trivial.
+ (check_field_decl): Likewise.
+ (check_bases_and_members): A nonexistent copy ctor/op= is non-trivial.
+ * tree.c (type_has_nontrivial_copy_init): Adjust semantics.
+ (trivially_copyable_p): Likewise.
+ * call.c (convert_like_real): Use type_has_nontrivial_copy_init.
+ * class.c (finish_struct_bits): Likewise.
+ * tree.c (build_target_expr_with_type): Likewise.
+ * typeck2.c (store_init_value): Likewise.
+
+ Enable implicitly deleted functions (N2346)
+ * class.c (check_bases_and_members): Adjust lambda flags.
+ * method.c (implicitly_declare_fn): Set DECL_DELETED_FN if appropriate.
+
+ * decl2.c (mark_used): Adjust error for use of deleted function.
+
+ Machinery to support implicit delete/move.
+ * cp-tree.h: (struct lang_type_class): Add lazy_move_assign,
+ has_complex_move_ctor, has_complex_move_assign bitfields.
+ (CLASSTYPE_LAZY_MOVE_ASSIGN): New.
+ (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New.
+ (TYPE_HAS_COMPLEX_MOVE_CTOR): New.
+ (enum special_function_kind): Add sfk_move_assignment.
+ (LOOKUP_SPECULATIVE): New.
+ * call.c (build_over_call): Return early if it's set.
+ (build_over_call): Use trivial_fn_p.
+ * class.c (check_bases): If the base has no default constructor,
+ the derived one is non-trivial. Handle move ctor/op=.
+ (check_field_decl): Likewise.
+ (check_bases_and_members): Handle move ctor/op=.
+ (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN.
+ (type_has_move_constructor, type_has_move_assign): New.
+ * decl.c (grok_special_member_properties): Handle move ctor/op=.
+ * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New.
+ (trivial_fn_p): New.
+ (do_build_copy_constructor): Use it.
+ (do_build_assign_ref): Likewise. Handle move assignment.
+ (build_stub_type, build_stub_object, locate_fn_flags): New.
+ (locate_ctor): Use locate_fn_flags.
+ (locate_copy, locate_dtor): Remove.
+ (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New.
+ (process_subob_fn, synthesized_method_walk): New.
+ (maybe_explain_implicit_delete): New.
+ (implicitly_declare_fn): Use synthesized_method_walk,
+ type_has_trivial_fn, and type_set_nontrivial_flag.
+ (defaulted_late_check): Set DECL_DELETED_FN.
+ (defaultable_fn_check): Handle sfk_move_assignment.
+ (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare
+ implicitly deleted move ctor/op=.
+ * search.c (lookup_fnfields_1): Handle sfk_move_assignment.
+ (lookup_fnfields_slot): New.
+ * semantics.c (omp_clause_info_fndecl): Remove.
+ (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor,
+ get_copy_assign, trivial_fn_p.
+ (trait_expr_value): Adjust call to locate_ctor.
+ * tree.c (special_function_p): Handle sfk_move_assignment.
+
+ * class.c (type_has_virtual_destructor): New.
+ * cp-tree.h: Declare it.
+ * semantics.c (trait_expr_value): Use it.
+
+ * call.c (build_over_call): Only give warnings with tf_warning.
+
+ * name-lookup.c (pop_scope): Handle NULL_TREE.
+
+ * cp-tree.h (TYPE_HAS_ASSIGN_REF): Rename to TYPE_HAS_COPY_ASSIGN.
+ (TYPE_HAS_CONST_ASSIGN_REF): Rename to TYPE_HAS_CONST_COPY_ASSIGN.
+ (TYPE_HAS_INIT_REF): Rename to TYPE_HAS_COPY_CTOR.
+ (TYPE_HAS_CONST_INIT_REF): Rename to TYPE_HAS_CONST_COPY_CTOR.
+ (TYPE_HAS_COMPLEX_ASSIGN_REF): Rename to TYPE_HAS_COMPLEX_COPY_ASSIGN.
+ (TYPE_HAS_COMPLEX_INIT_REF): Rename to TYPE_HAS_COMPLEX_COPY_CTOR.
+ (TYPE_HAS_TRIVIAL_ASSIGN_REF): Rename to TYPE_HAS_TRIVIAL_COPY_ASSIGN.
+ (TYPE_HAS_TRIVIAL_INIT_REF): Rename to TYPE_HAS_TRIVIAL_COPY_CTOR.
+ (CLASSTYPE_LAZY_ASSIGNMENT_OP): Rename to CLASSTYPE_LAZY_COPY_ASSIGN.
+ (sfk_assignment_operator): Rename to sfk_copy_assignment.
+ * decl.c, call.c, class.c, init.c, method.c, pt.c, ptree.c: Adjust.
+ * search.c, semantics.c, tree.c: Adjust.
+
+ * pt.c (dependent_scope_ref_p): Remove.
+ (value_dependent_expression_p): Don't call it.
+ (type_dependent_expression_p): Here either.
+ * init.c (build_offset_ref): Set TREE_TYPE on a qualified-id
+ if the scope isn't dependent.
+
+ * pt.c (convert_nontype_argument): Use mark_lvalue_use if we want
+ a reference.
+
+ PR c++/44587
+ * pt.c (has_value_dependent_address): New.
+ (value_dependent_expression_p): Check it.
+ (convert_nontype_argument): Likewise. Call decay_conversion before
+ folding if we want a pointer.
+ * semantics.c (finish_id_expression): Don't add SCOPE_REF if the
+ scope is the current instantiation.
+
+2010-06-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44682
+ * class.c (build_base_path): If want_pointer, call mark_rvalue_use
+ on expr.
+
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * init.c: Do not include except.h.
+ * decl.c: Likewise.
+ * expr.c: Likewise.
+ * cp-lang.c: Likewise.
+ * pt.c: Likewise.
+ * semantics.c: Likewise.
+ * decl2.c: Likewise.
+ * except.c: Likewise.
+ (init_exception_processing): Do not set the removed
+ lang_protect_cleanup_actions here.
+ (cp_protect_cleanup_actions): Make non-static and remove prototype.
+ (doing_eh): New, moved from except.c but removed the do_warning flag.
+ (expand_start_catch_block): Update doing_eh call.
+ (expand_end_catch_block): Likewise.
+ (build_throw): Likewise.
+ * cp-tree.h: Prototype cp_protect_cleanup_actions.
+ * cp-objcp-common.h: Set LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS to
+ cp_protect_cleanup_actions.
+ * Make-lang.in: Update dependencies.
+
+2010-06-26 Jason Merrill <jason@redhat.com>
+
+ * call.c (add_function_candidate): Set LOOKUP_COPY_PARM for any
+ constructor called with a single argument that takes a reference
+ to the constructor's class.
+ (BAD_CONVERSION_RANK): New.
+ (compare_ics): Use it to compare bad ICSes.
+
+2010-06-25 Joseph Myers <joseph@codesourcery.com>
+
+ * lang-specs.h: Remove +e handling.
+
+2010-06-24 Andi Kleen <ak@linux.intel.com>
+
+ * parser.c: (cp_parser_question_colon_clause):
+ Switch to use cp_lexer_peek_token.
+ Call warn_for_omitted_condop. Call pedwarn for omitted
+ middle operand.
+
+2010-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44619
+ * typeck2.c (build_m_component_ref): Call mark_lvalue_use on
+ datum and mark_rvalue_use on component.
+
+ PR c++/44627
+ * error.c (dump_expr): Don't look at CALL_EXPR_ARG (t, 0) if
+ the CALL_EXPR has no arguments.
+
+2010-06-21 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (comp_except_specs): Fix ce_derived with noexcept.
+
+ * semantics.c (check_trait_type): Check COMPLETE_TYPE_P for array
+ element type.
+
+2010-06-17 Nathan Froyd <froydnj@codesourcery.com>
+
+ * name-lookup.c (struct arg_lookup): Convert namespaces and
+ classes fields to VEC.
+ (arg_assoc_namespace): Adjust for new type of namespaces.
+ (arg_assoc_class): Adjust for new type of classes.
+ (lookup_arg_dependent): Use make_tree_vector and
+ release_tree_vector.
+ * typeck2.c (build_x_arrow): Use vec_member.
+
+2010-06-17 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/44486
+ * error.c (dump_decl): Better wording for anonymous namespace.
+
+2010-06-16 Nathan Froyd <froydnj@codesourcery.com>
+
+ * class.c (build_vtbl_initializer): Adjust computation of new_position
+ and which entry to add padding for.
+
+2010-06-16 Jason Merrill <jason@redhat.com>
+
+ * except.c (check_noexcept_r): Return the problematic function.
+ (finish_noexcept_expr): Give -Wnoexcept warning. Add complain parm.
+ * pt.c (tsubst_copy_and_build): Pass it.
+ * parser.c (cp_parser_unary_expression): Likewise.
+ * cp-tree.h: Adjust prototype.
+
+ * method.c (defaulted_late_check): Give the defaulted method
+ the same exception specification as the implicit declaration.
+
+2010-06-15 Jason Merrill <jason@redhat.com>
+
+ * class.c (add_implicitly_declared_members): Implicit assignment
+ operators can also be virtual overriders.
+ * method.c (lazily_declare_fn): Likewise.
+
+ * call.c (convert_like_real): Give "initializing argument of"
+ information for ambiguous conversion. Give source position
+ of function.
+
+ * call.c (print_z_candidates): Do print viable deleted candidates.
+ (joust): Don't choose a deleted function just because its worst
+ conversion is better than another candidate's worst.
+
+ * call.c (convert_like_real): Don't complain about
+ list-value-initialization from an explicit constructor.
+
+ * decl.c (duplicate_decls): Use DECL_IS_BUILTIN rather than test
+ DECL_SOURCE_LOCATION directly.
+
+ * class.c (type_has_user_provided_default_constructor): Use
+ sufficient_parms_p.
+
+ * call.c (is_subseq): Handle ck_aggr, ck_list.
+ (compare_ics): Treat an aggregate or ambiguous conversion to the
+ same type as involving the same function.
+
+2010-06-13 Shujing Zhao <pearly.zhao@oracle.com>
+
+ * typeck.c (convert_for_assignment): Fix comment. Change message
+ format from %d to %qP.
+ (convert_for_initialization): Fix comment.
+
+2010-06-11 Shujing Zhao <pearly.zhao@oracle.com>
+
+ * cp-tree.h (expr_list_kind): New type.
+ (impl_conv_rhs): New type.
+ (build_x_compound_expr_from_list, convert_for_initialization): Adjust
+ prototype.
+ (typeck.c (convert_arguments): Use impl_conv_rhs and emit the
+ diagnostics for easy translation. Change caller.
+ (convert_for_initialization): Use impl_conv_rhs and change caller.
+ (build_x_compound_expr_from_list): Use expr_list_kind and emit the
+ diagnostics for easy translation. Change caller.
+ * decl.c (bad_spec_place): New enum.
+ (bad_specifiers): Use it and emit the diagnostics for easy
+ translation. Change caller.
+ * pt.c (coerce_template_parms): Put the diagnostics in full sentence.
+
+2010-06-09 Nathan Froyd <froydnj@codesourcery.com>
+
+ * cp-tree.h (struct saved_scope): Change decl_ns_list field type
+ to a VEC.
+ * decl2.c (cp_write_global_declarations): Adjust for new type of
+ decl_namespace_list.
+ * name-lookup.c (current_decl_namespace): Likewise.
+ (push_decl_namespace): Likewise.
+ (pop_decl_namespace): Likewise.
+
+2010-06-09 Nathan Froyd <froydnj@codesourcery.com>
+
+ * call.c (build_java_interface_fn_ref): Call build_function_type_list
+ instead of build_function_type.
+ * decl.c (cxx_init_decl_processing): Likewise.
+ (declare_global_var): Likewise.
+ (get_atexit_node): Likewise.
+ (expand_static_init): Likewise.
+ * decl2.c (start_objects): Likewise.
+ (start_static_storage_duration_function): Likewise.
+ * except.c (init_exception_processing): Likewise.
+ (build_exc_ptr): Likewise.
+ (build_throw): Likewise.
+ * rtti.c (throw_bad_cast): Likewise.
+ (throw_bad_typeid): Likewise.
+ (build_dynamic_cast_1): Likewise.
+
+2010-06-09 Nathan Froyd <froydnj@codesourcery.com>
+
+ * call.c (build_call_n): Call XALLOCAVEC instead of alloca.
+ (build_op_delete_call): Likewise.
+ (build_over_call): Likewise.
+ * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise.
+ * pt.c (process_partial_specialization): Likewise.
+ (tsubst_template_args): Likewise.
+ * semantics.c (finish_asm_stmt): Likewise.
+
+2010-06-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (record_key_method_defined): New, broken out of ...
+ (finish_function): ... here. Call it.
+ (start_decl): Treat aliases as definitions.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * typeck2.c (abstract_virtuals_error): Use typed GC allocation.
+
+ * pt.c (maybe_process_partial_specialization): Likewise.
+ (register_specialization): Likewise.
+ (add_pending_template): Likewise.
+ (lookup_template_class): Likewise.
+ (push_tinst_level): Likewise.
+
+ * parser.c (cp_lexer_new_main): Likewise.
+ (cp_lexer_new_from_tokens): Likewise.
+ (cp_token_cache_new): Likewise.
+ (cp_parser_context_new): Likewise.
+ (cp_parser_new): Likewise.
+ (cp_parser_nested_name_specifier_opt): Likewise.
+ (cp_parser_template_id): Likewise.
+
+ * name-lookup.c (binding_entry_make): Likewise.
+ (binding_table_construct): Likewise.
+ (binding_table_new): Likewise.
+ (cxx_binding_make): Likewise.
+ (pushdecl_maybe_friend): Likewise.
+ (begin_scope): Likewise.
+ (push_to_top_level): Likewise.
+
+ * lex.c (init_reswords): Likewise.
+ (retrofit_lang_decl): Likewise.
+ (cxx_dup_lang_specific_decl): Likewise.
+ (copy_lang_type): Likewise.
+ (cxx_make_type): Likewise.
+
+ * decl.c (make_label_decl): Likewise.
+ (check_goto): Likewise.
+ (start_preparsed_function): Likewise.
+ (save_function_data): Likewise.
+
+ * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise.
+
+ * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise.
+
+ * class.c (finish_struct_1): Likewise.
+
+ * cp-tree.h (struct lang_type): Add variable_size GTY option.
+ (struct lang_decl): Likewise.
+
+ * parser.c (cp_parser_new): Update comment to not reference
+ ggc_alloc.
+
+2010-06-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/44366
+ * error.c (dump_parameters): Mask out TFF_SCOPE.
+ (dump_simple_decl): Don't print the scope of a PARM_DECL.
+ (dump_scope): Remove no-op mask.
+
+ PR c++/44401
+ * parser.c (cp_parser_lookup_name): Fix naming the constructor.
+
+ * cp-tree.h (COMPLETE_OR_OPEN_TYPE_P): New macro.
+ * init.c (build_offset_ref): Use it.
+ * pt.c (maybe_process_partial_specialization): Use it.
+ (instantiate_class_template): Use it.
+ * search.c (lookup_base): Use it.
+
+2010-06-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44444
+ * expr.c (mark_exp_read): Handle INDIRECT_REF.
+ * cvt.c (convert_to_void): Handle INDIRECT_REF like
+ handled_component_p.
+
+ PR c++/44443
+ * decl.c (initialize_local_var): If TREE_USED is set on the type,
+ set also DECL_READ_P on the decl.
+
+2010-05-25 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/44188
+ * cp-tree.h (typedef_variant_p): Move this declaration to
+ gcc/tree.h.
+ * tree.c (typedef_variant_p): Move this definition to gcc/tree.c.
+ * decl.c (grokdeclarator): Do not rename debug info of an
+ anonymous tagged type named by a typedef.
+
+2010-06-05 Fabien Chêne <fabien@gcc.gnu.org>
+
+ PR c++/44086
+ * class.c (check_field_decls): Move the call to
+ check_bitfield_decl before trying to set the
+ CLASSTYPE_READONLY_FIELDS_NEED_INIT flag.
+
+2010-06-05 Steven Bosscher <steven@gcc.gnu.org>
+
+ * typeck.c: Update include path for moved files.
+ * decl.c: Likewise.
+ * rtti.c: Likewise.
+ * cp-gimplify.c: Likewise.
+ * cp-lang.c: Likewise.
+ * pt.c: Likewise.
+ * semantics.c: Likewise.
+ * cxx-pretty-print.h: Likewise.
+ * decl2.c: Likewise.
+ * parser.c: Likewise.
+ * cp-objcp-common.c: Likewise.
+ * cp-tree.h: Likewise.
+ * name-lookup.c: Likewise.
+ * lex.c: Likewise.
+ * name-lookup.h: Likewise.
+ * config-lang.in: Update paths in gtfiles for files in c-family/.
+ * Make-lang.in: Likewise.
+
+2010-06-04 Magnus Fromreide <magfr@lysator.liu.se>
+
+ * cvt.c (cp_convert_to_pointer): Use null_ptr_cst_p.
+ * typeck.c (build_ptrmemfunc): Likewise.
+
+2010-06-04 Jason Merrill <jason@redhat.com>
+
+ * typeck2.c (merge_exception_specifiers): Adjust merging of
+ throw() and noexcept(true).
+
+ * pt.c (value_dependent_expression_p) [NOEXCEPT_EXPR]: Avoid
+ using an uninitialized variable.
+
+ * cxx-pretty-print.c (pp_cxx_unary_expression): Handle NOEXCEPT_EXPR.
+ (pp_cxx_expression): Likewise.
+
+ Implement noexcept-specification (15.4)
+ * parser.c (cp_parser_exception_specification_opt): Parse it.
+ Give -Wdeprecated warning about throw() specs.
+ * pt.c (tsubst_exception_specification): Handle it.
+ * error.c (dump_exception_spec): Handle it.
+ (dump_expr): Handle NOEXCEPT_EXPR.
+ * cxx-pretty-print.c (pp_cxx_exception_specification): Likewise.
+ * typeck.c (comp_except_specs): Handle compatibility rules.
+ Change exact parm to take an enum.
+ * typeck2.c (merge_exception_specifiers): Handle noexcept.
+ * except.c (nothrow_spec_p, type_noexcept_p): New fns.
+ (type_throw_all_p, build_noexcept_spec): New fns.
+ * cp-tree.h (TYPE_NOTHROW_P, TYPE_NOEXCEPT_P): Use them.
+ (comp_except_specs): Define ce_derived, ce_normal, ce_exact enums.
+ (cp_tree_index): Add CPTI_NOEXCEPT_TRUE_SPEC, CPTI_NOEXCEPT_FALSE_SPEC.
+ (noexcept_true_spec, noexcept_false_spec): New macros.
+ * name-lookup.c (pushdecl_maybe_friend): Adjust.
+ * search.c (check_final_overrider): Adjust.
+ * decl.c (check_redeclaration_exception_specification): Adjust.
+ (use_eh_spec_block): Use type_throw_all_p.
+ (cxx_init_decl_processing): Set noexcept_false_spec,noexcept_true_spec.
+ Give operator new a noexcept-specification in C++0x mode.
+ * tree.c (build_exception_variant, cxx_type_hash_eq): Adjust.
+ (cp_build_type_attribute_variant): Don't test TYPE_RAISES_EXCEPTIONS.
+
+ Implement noexcept operator (5.3.7)
+ * cp-tree.def (NOEXCEPT_EXPR): New.
+ * except.c (check_noexcept_r, finish_noexcept_expr): New.
+ * cp-tree.h: Declare finish_noexcept_expr.
+ * parser.c (cp_parser_unary_expression): Parse noexcept-expression.
+ * pt.c (tsubst_copy_and_build): And tsubst it.
+ (type_dependent_expression_p): Handle it.
+ (value_dependent_expression_p): Handle it.
+
+ * call.c (build_conditional_expr): Never fold in unevaluated context.
+ * tree.c (build_aggr_init_expr): Propagate TREE_NOTHROW.
+ * semantics.c (simplify_aggr_init_expr): Likewise.
+ * typeck.c (merge_types): Call merge_exception_specifiers.
+ * decl.c (duplicate_decls): Check DECL_SOURCE_LOCATION rather than
+ DECL_ANTICIPATED for preferring new type.
+
+2010-06-04 Joseph Myers <joseph@codesourcery.com>
+
+ * g++spec.c (lang_specific_driver): Use GCC-specific formats in
+ diagnostics.
+
+2010-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44412
+ * typeck.c (build_class_member_access_expr): Call mark_exp_read
+ on object for static data members.
+
+2010-06-04 Jakub Jelinek <jakub@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/44362
+ * call.c (build_conditional_expr): If both arg2 and arg3 are lvalues
+ with the same type, call mark_lvalue_use on both.
+
+2010-06-03 Nathan Froyd <froydnj@codesourcery.com>
+
+ * class.c (struct vtbl_init_data_s): Remove last_init field.
+ (struct secondary_vptr_vtt_init_data_s): Change type of inits field
+ to a VEC.
+ (finish_vtbls): Use a VEC rather than a TREE_LIST for the accumulated
+ initializers.
+ (build_vtt): Likewise.
+ (initialize_vtable): Take a VEC instead of a tree.
+ (build_vtt_inits): Change return type to void. Take a VEC **
+ instead of a tree *; accumulate results into said VEC.
+ (build_ctor_vtbl_group): Use a VEC rather than a TREE_LIST for the
+ accumulated initializers. Pass the vtable to accumulate_vtbl_inits.
+ (accumulate_vtbl_inits): Add extra vtable tree parameter; take a VEC
+ instead of a tree.
+ (dfs_accumulate_vtbl_inits): Likewise. Change return type to void.
+ (build_vtbl_initializer): Add VEC parameter; accumulate initializers
+ into it.
+ (dfs_build_secondary_vptr_vtt_inits): Use CONSTRUCTOR_APPEND_ELT
+ rather than tree_cons.
+ (build_vbase_offset_vtbl_entries): Likewise.
+ (add_vcall_offset): Likewise.
+ (build_rtti_vtbl_entries): Likewise.
+ * cp-tree.h (initialize_artificial_var): Take a VEC instead of a tree.
+ * decl.c (initialize_artificial_var): Use build_constructor instead
+ of build_constructor_from_list.
+
+2010-06-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c++/44294
+ * class.c (layout_class_type): Check MAX_FIXED_MODE_SIZE on
+ bit-field.
+
+2010-06-02 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * parser.c (cp_parser_mem_initializer_list): Change error text.
+
2010-06-02 Jakub Jelinek <jakub@redhat.com>
* cp-objcp-common.c (shadowed_var_for_decl): Change into
@@ -1469,3 +2031,4 @@ Copyright (C) 2010 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
+
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index d726ead2d80..7a605b743aa 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -71,10 +71,8 @@ g++-cross$(exeext): g++$(exeext)
# The compiler itself.
# Shared with C front end:
-CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
- c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
- incpath.o c-ppoutput.o c-cppbuiltin.o prefix.o \
- c-gimplify.o c-omp.o c-ada-spec.o
+CXX_C_OBJS = attribs.o incpath.o prefix.o \
+ $(C_COMMON_OBJS) $(CXX_TARGET_OBJS)
# Language-specific object files for C++ and Objective C++.
CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
@@ -85,7 +83,7 @@ CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
cp/cp-gimplify.o tree-mudflap.o $(CXX_C_OBJS)
# Language-specific object files for C++.
-CXX_OBJS = cp/cp-lang.o stub-objc.o $(CXX_AND_OBJCXX_OBJS)
+CXX_OBJS = cp/cp-lang.o c-family/stub-objc.o $(CXX_AND_OBJCXX_OBJS)
c++_OBJS = $(CXX_OBJS) dummy-checksum.o cc1plus-checksum.o cp/g++spec.o
@@ -251,16 +249,16 @@ cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
$(C_PRAGMA_H) toplev.h output.h input.h cp/operators.def $(TM_P_H)
cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h debug.h langhooks.h \
$(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-cp.h gt-cp-cp-lang.h \
- cp/cp-objcp-common.h $(EXPR_H) $(EXCEPT_H)
+ cp/cp-objcp-common.h $(EXPR_H)
cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
- output.h $(EXCEPT_H) toplev.h $(HASHTAB_H) $(RTL_H) \
+ output.h toplev.h $(HASHTAB_H) $(RTL_H) \
cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \
- debug.h gt-cp-decl.h $(TIMEVAR_H) $(TREE_FLOW_H) $(TARGET_H) $(PLUGIN_H) \
+ debug.h gt-cp-decl.h $(TIMEVAR_H) $(TARGET_H) $(PLUGIN_H) \
intl.h tree-iterator.h $(SPLAY_TREE_H)
cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
- output.h $(EXCEPT_H) toplev.h $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
+ output.h toplev.h $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
$(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H) $(GIMPLE_H) $(POINTER_SET_H) \
- $(SPLAY_TREE_H) c-ada-spec.h
+ $(SPLAY_TREE_H) c-family/c-ada-spec.h
cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) $(C_COMMON_H) toplev.h \
langhooks.h $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h \
@@ -286,23 +284,21 @@ cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
intl.h
cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
$(TREE_INLINE_H) $(REAL_H) gt-cp-tree.h \
- $(TARGET_H) debug.h $(TREE_FLOW_H) $(CGRAPH_H) $(SPLAY_TREE_H)
+ $(TARGET_H) debug.h $(CGRAPH_H) $(SPLAY_TREE_H) $(GIMPLE_H)
cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h convert.h \
$(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h intl.h
-cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(EXCEPT_H) \
+cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
toplev.h cp/cfns.h $(TREE_INLINE_H) $(TARGET_H)
-cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- toplev.h $(EXCEPT_H) $(TM_P_H)
+cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(TM_P_H)
cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/cp-objcp-common.h \
- toplev.h $(EXCEPT_H) $(TREE_INLINE_H) pointer-set.h gt-cp-pt.h \
- vecprim.h intl.h
+ toplev.h $(TREE_INLINE_H) pointer-set.h gt-cp-pt.h vecprim.h intl.h
cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \
$(FLAGS_H) $(REAL_H) $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H) \
tree-diagnostic.h tree-pretty-print.h
cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) \
gt-cp-repo.h
-cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) $(EXCEPT_H) toplev.h \
+cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) toplev.h \
$(FLAGS_H) output.h $(RTL_H) $(TIMEVAR_H) \
$(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H) \
bitmap.h gt-cp-semantics.h
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index b9f1c7fd4ec..d03ecb161af 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -122,6 +122,11 @@ struct conversion {
: (NODE)->user_conv_p ? cr_user \
: (NODE)->rank)
+#define BAD_CONVERSION_RANK(NODE) \
+ ((NODE)->ellipsis_p ? cr_ellipsis \
+ : (NODE)->user_conv_p ? cr_user \
+ : (NODE)->rank)
+
static struct obstack conversion_obstack;
static bool conversion_obstack_initialized;
@@ -282,7 +287,7 @@ build_call_n (tree function, int n, ...)
return build_call_a (function, 0, NULL);
else
{
- tree *argarray = (tree *) alloca (n * sizeof (tree));
+ tree *argarray = XALLOCAVEC (tree, n);
va_list ap;
int i;
@@ -1035,6 +1040,9 @@ convert_class_to_reference (tree reference_type, tree s, tree expr, int flags)
struct z_candidate *cand;
bool any_viable_p;
+ if (!expr)
+ return NULL;
+
conversions = lookup_conversions (s, /*lookup_template_convs_p=*/true);
if (!conversions)
return NULL;
@@ -1386,9 +1394,12 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
conversion operator). */
flags |= LOOKUP_NO_TEMP_BIND;
- /* Temporaries are copy-initialized, except for this hack to allow
- explicit conversion ops to the copy ctor. See also
- add_function_candidate. */
+ /* Core issue 899: When [copy-]initializing a temporary to be bound
+ to the first parameter of a copy constructor (12.8) called with
+ a single argument in the context of direct-initialization,
+ explicit conversion functions are also considered.
+
+ So don't set LOOKUP_ONLYCONVERTING in that case. */
if (!(flags & LOOKUP_COPY_PARM))
flags |= LOOKUP_ONLYCONVERTING;
@@ -1618,6 +1629,8 @@ add_function_candidate (struct z_candidate **candidates,
tree parmtype = TREE_VALUE (parmnode);
int lflags = flags;
+ parmnode = TREE_CHAIN (parmnode);
+
/* The type of the implicit object parameter ('this') for
overload resolution is not always the same as for the
function itself; conversion functions are considered to
@@ -1634,13 +1647,25 @@ add_function_candidate (struct z_candidate **candidates,
parmtype = build_pointer_type (parmtype);
}
- if (ctype && i == 0 && DECL_COPY_CONSTRUCTOR_P (fn)
- && (len-skip == 1))
+ /* Core issue 899: When [copy-]initializing a temporary to be bound
+ to the first parameter of a copy constructor (12.8) called with
+ a single argument in the context of direct-initialization,
+ explicit conversion functions are also considered.
+
+ So set LOOKUP_COPY_PARM to let reference_binding know that
+ it's being called in that context. We generalize the above
+ to handle move constructors and template constructors as well;
+ the standardese should soon be updated similarly. */
+ if (ctype && i == 0 && (len-skip == 1)
+ && !(flags & LOOKUP_ONLYCONVERTING)
+ && DECL_CONSTRUCTOR_P (fn)
+ && parmtype != error_mark_node
+ && (same_type_ignoring_top_level_qualifiers_p
+ (non_reference (parmtype), ctype)))
{
- /* Hack: Direct-initialize copy parm (i.e. suppress
- LOOKUP_ONLYCONVERTING) to make explicit conversion ops
- work. See also reference_binding. */
lflags |= LOOKUP_COPY_PARM;
+ /* We allow user-defined conversions within init-lists, but
+ not for the copy constructor. */
if (flags & LOOKUP_NO_COPY_CTOR_CONVERSION)
lflags |= LOOKUP_NO_CONVERSION;
}
@@ -1668,9 +1693,6 @@ add_function_candidate (struct z_candidate **candidates,
if (t->bad_p)
viable = -1;
-
- if (parmnode)
- parmnode = TREE_CHAIN (parmnode);
}
out:
@@ -2747,11 +2769,12 @@ print_z_candidates (struct z_candidate *candidates)
if (!candidates)
return;
- /* Remove deleted candidates. */
+ /* Remove non-viable deleted candidates. */
cand1 = candidates;
for (cand2 = &cand1; *cand2; )
{
if (TREE_CODE ((*cand2)->fn) == FUNCTION_DECL
+ && !(*cand2)->viable
&& DECL_DELETED_FN ((*cand2)->fn))
*cand2 = (*cand2)->next;
else
@@ -3631,7 +3654,6 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
tree arg2_type;
tree arg3_type;
tree result = NULL_TREE;
- tree result_save;
tree result_type = NULL_TREE;
bool lvalue_p = true;
struct z_candidate *candidates = 0;
@@ -3839,6 +3861,8 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
&& same_type_p (arg2_type, arg3_type))
{
result_type = arg2_type;
+ mark_lvalue_use (arg2);
+ mark_lvalue_use (arg3);
goto valid_operands;
}
@@ -4018,12 +4042,10 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
}
valid_operands:
- result_save = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
- result = fold_if_not_in_template (result_save);
-
- if (cp_unevaluated_operand && TREE_CODE (result) == CALL_EXPR)
- /* Avoid folding to a CALL_EXPR within decltype (c++/42013). */
- result = result_save;
+ result = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
+ if (!cp_unevaluated_operand)
+ /* Avoid folding within decltype (c++/42013) and noexcept. */
+ result = fold_if_not_in_template (result);
/* We can't use result_type below, as fold might have returned a
throw_expr. */
@@ -4757,7 +4779,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
/* The placement args might not be suitable for overload
resolution at this point, so build the call directly. */
int nargs = call_expr_nargs (placement);
- tree *argarray = (tree *) alloca (nargs * sizeof (tree));
+ tree *argarray = XALLOCAVEC (tree, nargs);
int i;
argarray[0] = addr;
for (i = 1; i < nargs; i++)
@@ -4934,7 +4956,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
{
permerror (input_location, "invalid conversion from %qT to %qT", TREE_TYPE (expr), totype);
if (fn)
- permerror (input_location, " initializing argument %P of %qD", argnum, fn);
+ permerror (DECL_SOURCE_LOCATION (fn),
+ " initializing argument %P of %qD", argnum, fn);
}
else
return error_mark_node;
@@ -4957,7 +4980,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
/* When converting from an init list we consider explicit
constructors, but actually trying to call one is an error. */
- if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn))
+ if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn)
+ /* Unless we're calling it for value-initialization from an
+ empty list, since that is handled separately in 8.5.4. */
+ && cand->num_convs > 0)
{
if (complain & tf_error)
error ("converting to %qT from initializer list would use "
@@ -5015,11 +5041,14 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
}
return expr;
case ck_ambig:
- if (!(complain & tf_error))
- return error_mark_node;
- /* Call build_user_type_conversion again for the error. */
- return build_user_type_conversion
- (totype, convs->u.expr, LOOKUP_NORMAL);
+ if (complain & tf_error)
+ {
+ /* Call build_user_type_conversion again for the error. */
+ build_user_type_conversion (totype, convs->u.expr, LOOKUP_NORMAL);
+ if (fn)
+ error (" initializing argument %P of %q+D", argnum, fn);
+ }
+ return error_mark_node;
case ck_list:
{
@@ -5107,7 +5136,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
if (diag_kind && fn)
{
if ((complain & tf_error))
- emit_diagnostic (diag_kind, input_location, 0,
+ emit_diagnostic (diag_kind, DECL_SOURCE_LOCATION (fn), 0,
" initializing argument %P of %qD", argnum, fn);
else if (diag_kind == DK_ERROR)
return error_mark_node;
@@ -5171,7 +5200,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
OK. */
if ((lvalue & clk_packed)
&& CLASS_TYPE_P (type)
- && !TYPE_HAS_TRIVIAL_INIT_REF (type))
+ && type_has_nontrivial_copy_init (type))
{
if (complain & tf_error)
error ("cannot bind packed field %qE to %qT",
@@ -5388,7 +5417,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum)
{
arg = digest_init (type, arg);
arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
- "default argument", fn, parmnum,
+ ICR_DEFAULT_ARGUMENT, fn, parmnum,
tf_warning_or_error);
}
else
@@ -5402,7 +5431,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum)
if (!CONSTANT_CLASS_P (arg))
arg = unshare_expr (arg);
arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
- "default argument", fn, parmnum,
+ ICR_DEFAULT_ARGUMENT, fn, parmnum,
tf_warning_or_error);
arg = convert_for_arg_passing (type, arg);
}
@@ -5574,7 +5603,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
}
/* Give any warnings we noticed during overload resolution. */
- if (cand->warnings)
+ if (cand->warnings && (complain & tf_warning))
{
struct candidate_warning *w;
for (w = cand->warnings; w; w = w->next)
@@ -5587,6 +5616,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
if (DECL_FUNCTION_MEMBER_P (fn))
{
+ tree access_fn;
/* If FN is a template function, two cases must be considered.
For example:
@@ -5614,10 +5644,41 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
different access. */
if (DECL_TEMPLATE_INFO (fn)
&& DECL_MEMBER_TEMPLATE_P (DECL_TI_TEMPLATE (fn)))
- perform_or_defer_access_check (cand->access_path,
- DECL_TI_TEMPLATE (fn), fn);
+ access_fn = DECL_TI_TEMPLATE (fn);
+ else
+ access_fn = fn;
+ if (flags & LOOKUP_SPECULATIVE)
+ {
+ /* If we're checking for implicit delete, we don't want access
+ control errors. */
+ if (!accessible_p (cand->access_path, access_fn, true))
+ {
+ /* Unless we're under maybe_explain_implicit_delete. */
+ if (flags & LOOKUP_COMPLAIN)
+ enforce_access (cand->access_path, access_fn, fn);
+ return error_mark_node;
+ }
+ }
else
- perform_or_defer_access_check (cand->access_path, fn, fn);
+ perform_or_defer_access_check (cand->access_path, access_fn, fn);
+ }
+
+ /* If we're checking for implicit delete, don't bother with argument
+ conversions. */
+ if (flags & LOOKUP_SPECULATIVE)
+ {
+ if (DECL_DELETED_FN (fn))
+ {
+ if (flags & LOOKUP_COMPLAIN)
+ mark_used (fn);
+ return error_mark_node;
+ }
+ if (cand->viable == 1)
+ return fn;
+ else if (!(flags & LOOKUP_COMPLAIN))
+ /* Reject bad conversions now. */
+ return error_mark_node;
+ /* else continue to get conversion error. */
}
/* Find maximum size of vector to hold converted arguments. */
@@ -5625,7 +5686,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
nargs = VEC_length (tree, args) + (first_arg != NULL_TREE ? 1 : 0);
if (parmlen > nargs)
nargs = parmlen;
- argarray = (tree *) alloca (nargs * sizeof (tree));
+ argarray = XALLOCAVEC (tree, nargs);
/* The implicit parameters to a constructor are not considered by overload
resolution, and must be of the proper type. */
@@ -5798,6 +5859,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
tree targ;
tree arg = argarray[num_artificial_parms_for (fn)];
tree fa;
+ bool trivial = trivial_fn_p (fn);
/* Pull out the real argument, disregarding const-correctness. */
targ = arg;
@@ -5822,13 +5884,12 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
if (TREE_CODE (arg) == TARGET_EXPR
&& TARGET_EXPR_LIST_INIT_P (arg))
{
- /* Copy-list-initialization doesn't require the copy constructor
+ /* Copy-list-initialization doesn't require the constructor
to be defined. */
}
/* [class.copy]: the copy constructor is implicitly defined even if
the implementation elided its use. */
- else if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn))
- || move_fn_p (fn))
+ else if (!trivial)
{
mark_used (fn);
already_used = true;
@@ -5846,13 +5907,10 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
{
if (TREE_CODE (arg) == TARGET_EXPR)
return arg;
- else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))
- && !move_fn_p (fn))
- return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
+ else if (trivial)
+ return force_target_expr (DECL_CONTEXT (fn), arg);
}
- else if (TREE_CODE (arg) == TARGET_EXPR
- || (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))
- && !move_fn_p (fn)))
+ else if (TREE_CODE (arg) == TARGET_EXPR || trivial)
{
tree to = stabilize_reference (cp_build_indirect_ref (fa, RO_NULL,
complain));
@@ -5862,8 +5920,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
}
}
else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR
- && copy_fn_p (fn)
- && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn)))
+ && trivial_fn_p (fn))
{
tree to = stabilize_reference
(cp_build_indirect_ref (argarray[0], RO_NULL, complain));
@@ -6009,14 +6066,11 @@ build_java_interface_fn_ref (tree fn, tree instance)
if (!java_iface_lookup_fn)
{
- tree endlink = build_void_list_node ();
- tree t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, java_int_type_node,
- endlink)));
+ tree ftype = build_function_type_list (ptr_type_node,
+ ptr_type_node, ptr_type_node,
+ java_int_type_node, NULL_TREE);
java_iface_lookup_fn
- = add_builtin_function ("_Jv_LookupInterfaceMethodIdx",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", ftype,
0, NOT_BUILT_IN, NULL, NULL_TREE);
}
@@ -6582,6 +6636,8 @@ is_subseq (conversion *ics1, conversion *ics2)
if (ics2->kind == ck_user
|| ics2->kind == ck_ambig
+ || ics2->kind == ck_aggr
+ || ics2->kind == ck_list
|| ics2->kind == ck_identity)
/* At this point, ICS1 cannot be a proper subsequence of
ICS2. We can get a USER_CONV when we are comparing the
@@ -6735,14 +6791,16 @@ compare_ics (conversion *ics1, conversion *ics2)
if (rank1 == cr_bad)
{
- /* XXX Isn't this an extension? */
- /* Both ICS are bad. We try to make a decision based on what
- would have happened if they'd been good. */
- if (ics1->user_conv_p > ics2->user_conv_p
- || ics1->rank > ics2->rank)
+ /* Both ICS are bad. We try to make a decision based on what would
+ have happened if they'd been good. This is not an extension,
+ we'll still give an error when we build up the call; this just
+ helps us give a more helpful error message. */
+ rank1 = BAD_CONVERSION_RANK (ics1);
+ rank2 = BAD_CONVERSION_RANK (ics2);
+
+ if (rank1 > rank2)
return -1;
- else if (ics1->user_conv_p < ics2->user_conv_p
- || ics1->rank < ics2->rank)
+ else if (rank1 < rank2)
return 1;
/* We couldn't make up our minds; try to figure it out below. */
@@ -6766,13 +6824,25 @@ compare_ics (conversion *ics1, conversion *ics2)
for (t1 = ics1; t1->kind != ck_user; t1 = t1->u.next)
if (t1->kind == ck_ambig || t1->kind == ck_aggr)
- return 0;
+ break;
for (t2 = ics2; t2->kind != ck_user; t2 = t2->u.next)
if (t2->kind == ck_ambig || t2->kind == ck_aggr)
- return 0;
+ break;
- if (t1->cand->fn != t2->cand->fn)
+ if (t1->kind != t2->kind)
return 0;
+ else if (t1->kind == ck_user)
+ {
+ if (t1->cand->fn != t2->cand->fn)
+ return 0;
+ }
+ else
+ {
+ /* For ambiguous or aggregate conversions, use the target type as
+ a proxy for the conversion function. */
+ if (!same_type_ignoring_top_level_qualifiers_p (t1->type, t2->type))
+ return 0;
+ }
/* We can just fall through here, after setting up
FROM_TYPE1 and FROM_TYPE2. */
@@ -7394,6 +7464,9 @@ tweak:
winner = -1, w = cand2, l = cand1;
if (winner)
{
+ /* Don't choose a deleted function over ambiguity. */
+ if (DECL_P (w->fn) && DECL_DELETED_FN (w->fn))
+ return 0;
if (warn)
{
pedwarn (input_location, 0,
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c2831c1a485..a2ed86334b5 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -77,9 +77,7 @@ typedef struct vtbl_init_data_s
tree rtti_binfo;
/* The negative-index vtable initializers built up so far. These
are in order from least negative index to most negative index. */
- tree inits;
- /* The last (i.e., most negative) entry in INITS. */
- tree* last_init;
+ VEC(constructor_elt,gc) *inits;
/* The binfo for the virtual base for which we're building
vcall offset initializers. */
tree vbase;
@@ -136,7 +134,8 @@ static void add_implicitly_declared_members (tree, int, int);
static tree fixed_type_or_null (tree, int *, int *);
static tree build_simple_base_path (tree expr, tree binfo);
static tree build_vtbl_ref_1 (tree, tree);
-static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
+static void build_vtbl_initializer (tree, tree, tree, tree, int *,
+ VEC(constructor_elt,gc) **);
static int count_fields (tree);
static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
static bool check_bitfield_decl (tree);
@@ -173,14 +172,15 @@ static void dump_vtable (tree, tree, tree);
static void dump_vtt (tree, tree);
static void dump_thunk (FILE *, int, tree);
static tree build_vtable (tree, tree, tree);
-static void initialize_vtable (tree, tree);
+static void initialize_vtable (tree, VEC(constructor_elt,gc) *);
static void layout_nonempty_base_or_field (record_layout_info,
tree, tree, splay_tree);
static tree end_of_class (tree, int);
static bool layout_empty_base (record_layout_info, tree, tree, splay_tree);
-static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
-static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
- tree);
+static void accumulate_vtbl_inits (tree, tree, tree, tree, tree,
+ VEC(constructor_elt,gc) **);
+static void dfs_accumulate_vtbl_inits (tree, tree, tree, tree, tree,
+ VEC(constructor_elt,gc) **);
static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
static void clone_constructors_and_destructors (tree);
@@ -189,7 +189,7 @@ static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
static void build_ctor_vtbl_group (tree, tree);
static void build_vtt (tree);
static tree binfo_ctor_vtable (tree);
-static tree *build_vtt_inits (tree, tree, tree *, tree *);
+static void build_vtt_inits (tree, tree, VEC(constructor_elt,gc) **, tree *);
static tree dfs_build_secondary_vptr_vtt_inits (tree, void *);
static tree dfs_fixup_binfo_vtbls (tree, void *);
static int record_subobject_offset (tree, tree, splay_tree);
@@ -283,6 +283,8 @@ build_base_path (enum tree_code code,
if (!want_pointer)
/* This must happen before the call to save_expr. */
expr = cp_build_unary_op (ADDR_EXPR, expr, 0, tf_warning_or_error);
+ else
+ mark_rvalue_use (expr);
offset = BINFO_OFFSET (binfo);
fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
@@ -1280,10 +1282,11 @@ check_bases (tree t,
assignment operators that take const references, then the
derived class cannot have such a member automatically
generated. */
- if (! TYPE_HAS_CONST_INIT_REF (basetype))
+ if (TYPE_HAS_COPY_CTOR (basetype)
+ && ! TYPE_HAS_CONST_COPY_CTOR (basetype))
*cant_have_const_ctor_p = 1;
- if (TYPE_HAS_ASSIGN_REF (basetype)
- && !TYPE_HAS_CONST_ASSIGN_REF (basetype))
+ if (TYPE_HAS_COPY_ASSIGN (basetype)
+ && !TYPE_HAS_CONST_COPY_ASSIGN (basetype))
*no_const_asn_ref_p = 1;
if (BINFO_VIRTUAL_P (base_binfo))
@@ -1309,13 +1312,19 @@ check_bases (tree t,
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype);
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (basetype);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t)
- |= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype);
- TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype);
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (t)
+ |= (TYPE_HAS_COMPLEX_COPY_ASSIGN (basetype)
+ || !TYPE_HAS_COPY_ASSIGN (basetype));
+ TYPE_HAS_COMPLEX_COPY_CTOR (t) |= (TYPE_HAS_COMPLEX_COPY_CTOR (basetype)
+ || !TYPE_HAS_COPY_CTOR (basetype));
+ TYPE_HAS_COMPLEX_MOVE_ASSIGN (t)
+ |= TYPE_HAS_COMPLEX_MOVE_ASSIGN (basetype);
+ TYPE_HAS_COMPLEX_MOVE_CTOR (t) |= TYPE_HAS_COMPLEX_MOVE_CTOR (basetype);
TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (basetype);
CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t)
|= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype);
- TYPE_HAS_COMPLEX_DFLT (t) |= TYPE_HAS_COMPLEX_DFLT (basetype);
+ TYPE_HAS_COMPLEX_DFLT (t) |= (!TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
+ || TYPE_HAS_COMPLEX_DFLT (basetype));
/* A standard-layout class is a class that:
...
@@ -1539,7 +1548,8 @@ finish_struct_bits (tree t)
mode to be BLKmode, and force its TREE_ADDRESSABLE bit to be
nonzero. This will cause it to be passed by invisible reference
and prevent it from being returned in a register. */
- if (! TYPE_HAS_TRIVIAL_INIT_REF (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
+ if (type_has_nontrivial_copy_init (t)
+ || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
{
tree variants;
DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode;
@@ -1666,10 +1676,10 @@ maybe_warn_about_overly_private_class (tree t)
template <class T> class C { private: C(); };
- To avoid this asymmetry, we check TYPE_HAS_INIT_REF. All
+ To avoid this asymmetry, we check TYPE_HAS_COPY_CTOR. All
complete non-template or fully instantiated classes have this
flag set. */
- if (!TYPE_HAS_INIT_REF (t))
+ if (!TYPE_HAS_COPY_CTOR (t))
nonprivate_ctor = 1;
else
for (fn = CLASSTYPE_CONSTRUCTORS (t); fn; fn = OVL_NEXT (fn))
@@ -2618,47 +2628,13 @@ add_implicitly_declared_members (tree t,
{
/* In general, we create destructors lazily. */
CLASSTYPE_LAZY_DESTRUCTOR (t) = 1;
- /* However, if the implicit destructor is non-trivial
- destructor, we sometimes have to create it at this point. */
- if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
- {
- bool lazy_p = true;
-
- if (TYPE_FOR_JAVA (t))
- /* If this a Java class, any non-trivial destructor is
- invalid, even if compiler-generated. Therefore, if the
- destructor is non-trivial we create it now. */
- lazy_p = false;
- else
- {
- tree binfo;
- tree base_binfo;
- int ix;
-
- /* If the implicit destructor will be virtual, then we must
- generate it now because (unfortunately) we do not
- generate virtual tables lazily. */
- binfo = TYPE_BINFO (t);
- for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
- {
- tree base_type;
- tree dtor;
-
- base_type = BINFO_TYPE (base_binfo);
- dtor = CLASSTYPE_DESTRUCTORS (base_type);
- if (dtor && DECL_VIRTUAL_P (dtor))
- {
- lazy_p = false;
- break;
- }
- }
- }
- /* If we can't get away with being lazy, generate the destructor
- now. */
- if (!lazy_p)
- lazily_declare_fn (sfk_destructor, t);
- }
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ && TYPE_FOR_JAVA (t))
+ /* But if this is a Java class, any non-trivial destructor is
+ invalid, even if compiler-generated. Therefore, if the
+ destructor is non-trivial we create it now. */
+ lazily_declare_fn (sfk_destructor, t);
}
/* [class.ctor]
@@ -2675,27 +2651,59 @@ add_implicitly_declared_members (tree t,
If a class definition does not explicitly declare a copy
constructor, one is declared implicitly. */
- if (! TYPE_HAS_INIT_REF (t) && ! TYPE_FOR_JAVA (t))
+ if (! TYPE_HAS_COPY_CTOR (t) && ! TYPE_FOR_JAVA (t)
+ && !type_has_move_constructor (t))
{
- TYPE_HAS_INIT_REF (t) = 1;
- TYPE_HAS_CONST_INIT_REF (t) = !cant_have_const_cctor;
+ TYPE_HAS_COPY_CTOR (t) = 1;
+ TYPE_HAS_CONST_COPY_CTOR (t) = !cant_have_const_cctor;
CLASSTYPE_LAZY_COPY_CTOR (t) = 1;
+ if (cxx_dialect >= cxx0x)
+ CLASSTYPE_LAZY_MOVE_CTOR (t) = 1;
}
- /* Currently only lambdas get a lazy move ctor, but N2987 adds them for
- other classes. */
- if (LAMBDA_TYPE_P (t))
- CLASSTYPE_LAZY_MOVE_CTOR (t) = 1;
-
/* If there is no assignment operator, one will be created if and
when it is needed. For now, just record whether or not the type
of the parameter to the assignment operator will be a const or
non-const reference. */
- if (!TYPE_HAS_ASSIGN_REF (t) && !TYPE_FOR_JAVA (t))
+ if (!TYPE_HAS_COPY_ASSIGN (t) && !TYPE_FOR_JAVA (t)
+ && !type_has_move_assign (t))
{
- TYPE_HAS_ASSIGN_REF (t) = 1;
- TYPE_HAS_CONST_ASSIGN_REF (t) = !cant_have_const_assignment;
- CLASSTYPE_LAZY_ASSIGNMENT_OP (t) = 1;
+ TYPE_HAS_COPY_ASSIGN (t) = 1;
+ TYPE_HAS_CONST_COPY_ASSIGN (t) = !cant_have_const_assignment;
+ CLASSTYPE_LAZY_COPY_ASSIGN (t) = 1;
+ if (cxx_dialect >= cxx0x)
+ CLASSTYPE_LAZY_MOVE_ASSIGN (t) = 1;
+ }
+
+ /* We can't be lazy about declaring functions that might override
+ a virtual function from a base class. */
+ if (TYPE_POLYMORPHIC_P (t)
+ && (CLASSTYPE_LAZY_COPY_ASSIGN (t)
+ || CLASSTYPE_LAZY_MOVE_ASSIGN (t)
+ || CLASSTYPE_LAZY_DESTRUCTOR (t)))
+ {
+ tree binfo = TYPE_BINFO (t);
+ tree base_binfo;
+ int ix;
+ tree opname = ansi_assopname (NOP_EXPR);
+ for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ++ix)
+ {
+ tree bv;
+ for (bv = BINFO_VIRTUALS (base_binfo); bv; bv = TREE_CHAIN (bv))
+ {
+ tree fn = BV_FN (bv);
+ if (DECL_NAME (fn) == opname)
+ {
+ if (CLASSTYPE_LAZY_COPY_ASSIGN (t))
+ lazily_declare_fn (sfk_copy_assignment, t);
+ if (CLASSTYPE_LAZY_MOVE_ASSIGN (t))
+ lazily_declare_fn (sfk_move_assignment, t);
+ }
+ else if (DECL_DESTRUCTOR_P (fn)
+ && CLASSTYPE_LAZY_DESTRUCTOR (t))
+ lazily_declare_fn (sfk_destructor, t);
+ }
+ }
}
}
@@ -2823,7 +2831,7 @@ check_field_decl (tree field,
the settings of CANT_HAVE_CONST_CTOR and friends. */
if (ANON_UNION_TYPE_P (type))
;
- /* And, we don't set TYPE_HAS_CONST_INIT_REF, etc., for anonymous
+ /* And, we don't set TYPE_HAS_CONST_COPY_CTOR, etc., for anonymous
structs. So, we recurse through their fields here. */
else if (ANON_AGGR_TYPE_P (type))
{
@@ -2849,24 +2857,34 @@ check_field_decl (tree field,
field);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
error ("member %q+#D with destructor not allowed in union", field);
- if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
+ if (TYPE_HAS_COMPLEX_COPY_ASSIGN (type))
error ("member %q+#D with copy assignment operator not allowed in union",
field);
+ /* Don't bother diagnosing move assop now; C++0x has more
+ flexible unions. */
}
else
{
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type);
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type);
- TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type);
- TYPE_HAS_COMPLEX_DFLT (t) |= TYPE_HAS_COMPLEX_DFLT (type);
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (t)
+ |= (TYPE_HAS_COMPLEX_COPY_ASSIGN (type)
+ || !TYPE_HAS_COPY_ASSIGN (type));
+ TYPE_HAS_COMPLEX_COPY_CTOR (t) |= (TYPE_HAS_COMPLEX_COPY_CTOR (type)
+ || !TYPE_HAS_COPY_CTOR (type));
+ TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) |= TYPE_HAS_COMPLEX_MOVE_ASSIGN (type);
+ TYPE_HAS_COMPLEX_MOVE_CTOR (t) |= TYPE_HAS_COMPLEX_MOVE_CTOR (type);
+ TYPE_HAS_COMPLEX_DFLT (t) |= (!TYPE_HAS_DEFAULT_CONSTRUCTOR (type)
+ || TYPE_HAS_COMPLEX_DFLT (type));
}
- if (!TYPE_HAS_CONST_INIT_REF (type))
+ if (TYPE_HAS_COPY_CTOR (type)
+ && !TYPE_HAS_CONST_COPY_CTOR (type))
*cant_have_const_ctor = 1;
- if (!TYPE_HAS_CONST_ASSIGN_REF (type))
+ if (TYPE_HAS_COPY_ASSIGN (type)
+ && !TYPE_HAS_CONST_COPY_ASSIGN (type))
*no_const_asn_ref = 1;
}
if (DECL_INITIAL (field) != NULL_TREE)
@@ -3025,7 +3043,8 @@ check_field_decls (tree t, tree *access_decls,
aggregate, initialization by a brace-enclosed list) is the
only way to initialize nonstatic const and reference
members. */
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1;
+ TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) = 1;
}
type = strip_array_types (type);
@@ -3092,6 +3111,14 @@ check_field_decls (tree t, tree *access_decls,
if (! zero_init_p (type))
CLASSTYPE_NON_ZERO_INIT_P (t) = 1;
+ /* We set DECL_C_BIT_FIELD in grokbitfield.
+ If the type and width are valid, we'll also set DECL_BIT_FIELD. */
+ if (! DECL_C_BIT_FIELD (x) || ! check_bitfield_decl (x))
+ check_field_decl (x, t,
+ cant_have_const_ctor_p,
+ no_const_asn_ref_p,
+ &any_default_members);
+
/* If any field is const, the structure type is pseudo-const. */
if (CP_TYPE_CONST_P (type))
{
@@ -3103,7 +3130,8 @@ check_field_decls (tree t, tree *access_decls,
aggregate, initialization by a brace-enclosed list) is the
only way to initialize nonstatic const and reference
members. */
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1;
+ TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) = 1;
}
/* A field that is pseudo-const makes the structure likewise. */
else if (CLASS_TYPE_P (type))
@@ -3120,14 +3148,6 @@ check_field_decls (tree t, tree *access_decls,
if (constructor_name_p (DECL_NAME (x), t)
&& TYPE_HAS_USER_CONSTRUCTOR (t))
permerror (input_location, "field %q+#D with same name as class", x);
-
- /* We set DECL_C_BIT_FIELD in grokbitfield.
- If the type and width are valid, we'll also set DECL_BIT_FIELD. */
- if (! DECL_C_BIT_FIELD (x) || ! check_bitfield_decl (x))
- check_field_decl (x, t,
- cant_have_const_ctor_p,
- no_const_asn_ref_p,
- &any_default_members);
}
/* Effective C++ rule 11: if a class has dynamic memory held by pointers,
@@ -3148,18 +3168,18 @@ check_field_decls (tree t, tree *access_decls,
&& has_pointers
&& TYPE_HAS_USER_CONSTRUCTOR (t)
&& TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
- && !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
+ && !(TYPE_HAS_COPY_CTOR (t) && TYPE_HAS_COPY_ASSIGN (t)))
{
warning (OPT_Weffc__, "%q#T has pointer data members", t);
- if (! TYPE_HAS_INIT_REF (t))
+ if (! TYPE_HAS_COPY_CTOR (t))
{
warning (OPT_Weffc__,
" but does not override %<%T(const %T&)%>", t, t);
- if (!TYPE_HAS_ASSIGN_REF (t))
+ if (!TYPE_HAS_COPY_ASSIGN (t))
warning (OPT_Weffc__, " or %<operator=(const %T&)%>", t);
}
- else if (! TYPE_HAS_ASSIGN_REF (t))
+ else if (! TYPE_HAS_COPY_ASSIGN (t))
warning (OPT_Weffc__,
" but does not override %<operator=(const %T&)%>", t);
}
@@ -3842,7 +3862,9 @@ check_methods (tree t)
if (DECL_PURE_VIRTUAL_P (x))
VEC_safe_push (tree, gc, CLASSTYPE_PURE_VIRTUALS (t), x);
}
- /* All user-provided destructors are non-trivial. */
+ /* All user-provided destructors are non-trivial.
+ Constructors and assignment ops are handled in
+ grok_special_member_properties. */
if (DECL_DESTRUCTOR_P (x) && user_provided_p (x))
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = 1;
}
@@ -4247,7 +4269,7 @@ type_has_user_provided_constructor (tree t)
bool
type_has_user_provided_default_constructor (tree t)
{
- tree fns, args;
+ tree fns;
if (!TYPE_HAS_USER_CONSTRUCTOR (t))
return false;
@@ -4256,16 +4278,70 @@ type_has_user_provided_default_constructor (tree t)
{
tree fn = OVL_CURRENT (fns);
if (TREE_CODE (fn) == FUNCTION_DECL
- && user_provided_p (fn))
- {
- args = FUNCTION_FIRST_USER_PARMTYPE (fn);
- while (args && TREE_PURPOSE (args))
- args = TREE_CHAIN (args);
- if (!args || args == void_list_node)
- return true;
- }
+ && user_provided_p (fn)
+ && sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (fn)))
+ return true;
+ }
+
+ return false;
+}
+
+/* Returns true iff class TYPE has a virtual destructor. */
+
+bool
+type_has_virtual_destructor (tree type)
+{
+ tree dtor;
+
+ if (!CLASS_TYPE_P (type))
+ return false;
+
+ gcc_assert (COMPLETE_TYPE_P (type));
+ dtor = CLASSTYPE_DESTRUCTORS (type);
+ return (dtor && DECL_VIRTUAL_P (dtor));
+}
+
+/* Returns true iff class T has a move constructor. */
+
+bool
+type_has_move_constructor (tree t)
+{
+ tree fns;
+
+ if (CLASSTYPE_LAZY_MOVE_CTOR (t))
+ {
+ gcc_assert (COMPLETE_TYPE_P (t));
+ lazily_declare_fn (sfk_move_constructor, t);
}
+ if (!CLASSTYPE_METHOD_VEC (t))
+ return false;
+
+ for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ if (move_fn_p (OVL_CURRENT (fns)))
+ return true;
+
+ return false;
+}
+
+/* Returns true iff class T has a move assignment operator. */
+
+bool
+type_has_move_assign (tree t)
+{
+ tree fns;
+
+ if (CLASSTYPE_LAZY_MOVE_ASSIGN (t))
+ {
+ gcc_assert (COMPLETE_TYPE_P (t));
+ lazily_declare_fn (sfk_move_assignment, t);
+ }
+
+ for (fns = lookup_fnfields_slot (t, ansi_assopname (NOP_EXPR));
+ fns; fns = OVL_NEXT (fns))
+ if (move_fn_p (OVL_CURRENT (fns)))
+ return true;
+
return false;
}
@@ -4384,7 +4460,7 @@ check_bases_and_members (tree t)
/* Save the initial values of these flags which only indicate whether
or not the class has user-provided functions. As we analyze the
bases and members we can set these flags for other reasons. */
- saved_complex_asn_ref = TYPE_HAS_COMPLEX_ASSIGN_REF (t);
+ saved_complex_asn_ref = TYPE_HAS_COMPLEX_COPY_ASSIGN (t);
saved_nontrivial_dtor = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
/* Check all the data member declarations. We cannot call
@@ -4402,7 +4478,8 @@ check_bases_and_members (tree t)
/* Do some bookkeeping that will guide the generation of implicitly
declared member functions. */
- TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_CONTAINS_VPTR_P (t);
+ TYPE_HAS_COMPLEX_COPY_CTOR (t) |= TYPE_CONTAINS_VPTR_P (t);
+ TYPE_HAS_COMPLEX_MOVE_CTOR (t) |= TYPE_CONTAINS_VPTR_P (t);
/* We need to call a constructor for this class if it has a
user-provided constructor, or if the default constructor is going
to initialize the vptr. (This is not an if-and-only-if;
@@ -4425,7 +4502,8 @@ check_bases_and_members (tree t)
|= (CLASSTYPE_NON_AGGREGATE (t)
|| saved_nontrivial_dtor || saved_complex_asn_ref);
CLASSTYPE_NON_STD_LAYOUT (t) |= TYPE_CONTAINS_VPTR_P (t);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_CONTAINS_VPTR_P (t);
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (t) |= TYPE_CONTAINS_VPTR_P (t);
+ TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) |= TYPE_CONTAINS_VPTR_P (t);
TYPE_HAS_COMPLEX_DFLT (t) |= TYPE_CONTAINS_VPTR_P (t);
/* If the class has no user-declared constructor, but does have
@@ -4495,10 +4573,9 @@ check_bases_and_members (tree t)
/* "The closure type associated with a lambda-expression has a deleted
default constructor and a deleted copy assignment operator." */
TYPE_NEEDS_CONSTRUCTING (t) = 1;
- TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0;
- CLASSTYPE_LAZY_DEFAULT_CTOR (t) = 0;
- TYPE_HAS_ASSIGN_REF (t) = 0;
- CLASSTYPE_LAZY_ASSIGNMENT_OP (t) = 0;
+ TYPE_HAS_COMPLEX_DFLT (t) = 1;
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1;
+ CLASSTYPE_LAZY_MOVE_ASSIGN (t) = 0;
/* "This class type is not an aggregate." */
CLASSTYPE_NON_AGGREGATE (t) = 1;
@@ -4976,8 +5053,10 @@ layout_class_type (tree t, tree *virtuals_p)
bits as additional padding. */
for (itk = itk_char; itk != itk_none; ++itk)
if (integer_types[itk] != NULL_TREE
- && INT_CST_LT (DECL_SIZE (field),
- TYPE_SIZE (integer_types[itk])))
+ && (INT_CST_LT (size_int (MAX_FIXED_MODE_SIZE),
+ TYPE_SIZE (integer_types[itk]))
+ || INT_CST_LT (DECL_SIZE (field),
+ TYPE_SIZE (integer_types[itk]))))
break;
/* ITK now indicates a type that is too large for the
@@ -5435,9 +5514,8 @@ finish_struct_1 (tree t)
n_fields = count_fields (TYPE_FIELDS (t));
if (n_fields > 7)
{
- struct sorted_fields_type *field_vec = GGC_NEWVAR
- (struct sorted_fields_type,
- sizeof (struct sorted_fields_type) + n_fields * sizeof (tree));
+ struct sorted_fields_type *field_vec = ggc_alloc_sorted_fields_type
+ (sizeof (struct sorted_fields_type) + n_fields * sizeof (tree));
field_vec->len = n_fields;
add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0);
qsort (field_vec->elts, n_fields, sizeof (tree),
@@ -7040,36 +7118,36 @@ debug_thunks (tree fn)
static void
finish_vtbls (tree t)
{
- tree list;
tree vbase;
+ VEC(constructor_elt,gc) *v = NULL;
+ tree vtable = BINFO_VTABLE (TYPE_BINFO (t));
/* We lay out the primary and secondary vtables in one contiguous
vtable. The primary vtable is first, followed by the non-virtual
secondary vtables in inheritance graph order. */
- list = build_tree_list (BINFO_VTABLE (TYPE_BINFO (t)), NULL_TREE);
- accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
- TYPE_BINFO (t), t, list);
+ accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t), TYPE_BINFO (t),
+ vtable, t, &v);
/* Then come the virtual bases, also in inheritance graph order. */
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
{
if (!BINFO_VIRTUAL_P (vbase))
continue;
- accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
+ accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), vtable, t, &v);
}
if (BINFO_VTABLE (TYPE_BINFO (t)))
- initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
+ initialize_vtable (TYPE_BINFO (t), v);
}
/* Initialize the vtable for BINFO with the INITS. */
static void
-initialize_vtable (tree binfo, tree inits)
+initialize_vtable (tree binfo, VEC(constructor_elt,gc) *inits)
{
tree decl;
- layout_vtable_decl (binfo, list_length (inits));
+ layout_vtable_decl (binfo, VEC_length (constructor_elt, inits));
decl = get_vtbl_decl_for_binfo (binfo);
initialize_artificial_var (decl, inits);
dump_vtable (BINFO_TYPE (binfo), binfo, decl);
@@ -7091,13 +7169,13 @@ initialize_vtable (tree binfo, tree inits)
static void
build_vtt (tree t)
{
- tree inits;
tree type;
tree vtt;
tree index;
+ VEC(constructor_elt,gc) *inits;
/* Build up the initializers for the VTT. */
- inits = NULL_TREE;
+ inits = NULL;
index = size_zero_node;
build_vtt_inits (TYPE_BINFO (t), t, &inits, &index);
@@ -7106,7 +7184,7 @@ build_vtt (tree t)
return;
/* Figure out the type of the VTT. */
- type = build_index_type (size_int (list_length (inits) - 1));
+ type = build_index_type (size_int (VEC_length (constructor_elt, inits) - 1));
type = build_cplus_array_type (const_ptr_type_node, type);
/* Now, build the VTT object itself. */
@@ -7152,8 +7230,8 @@ typedef struct secondary_vptr_vtt_init_data_s
/* Current index into the VTT. */
tree index;
- /* TREE_LIST of initializers built up. */
- tree inits;
+ /* Vector of initializers built up. */
+ VEC(constructor_elt,gc) *inits;
/* The type being constructed by this secondary VTT. */
tree type_being_constructed;
@@ -7167,19 +7245,18 @@ typedef struct secondary_vptr_vtt_init_data_s
for virtual bases of T. When it is not so, we build the constructor
vtables for the BINFO-in-T variant. */
-static tree *
-build_vtt_inits (tree binfo, tree t, tree *inits, tree *index)
+static void
+build_vtt_inits (tree binfo, tree t, VEC(constructor_elt,gc) **inits, tree *index)
{
int i;
tree b;
tree init;
- tree secondary_vptrs;
secondary_vptr_vtt_init_data data;
int top_level_p = SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), t);
/* We only need VTTs for subobjects with virtual bases. */
if (!CLASSTYPE_VBASECLASSES (BINFO_TYPE (binfo)))
- return inits;
+ return;
/* We need to use a construction vtable if this is not the primary
VTT. */
@@ -7193,8 +7270,7 @@ build_vtt_inits (tree binfo, tree t, tree *inits, tree *index)
/* Add the address of the primary vtable for the complete object. */
init = binfo_ctor_vtable (binfo);
- *inits = build_tree_list (NULL_TREE, init);
- inits = &TREE_CHAIN (*inits);
+ CONSTRUCTOR_APPEND_ELT (*inits, NULL_TREE, init);
if (top_level_p)
{
gcc_assert (!BINFO_VPTR_INDEX (binfo));
@@ -7205,30 +7281,23 @@ build_vtt_inits (tree binfo, tree t, tree *inits, tree *index)
/* Recursively add the secondary VTTs for non-virtual bases. */
for (i = 0; BINFO_BASE_ITERATE (binfo, i, b); ++i)
if (!BINFO_VIRTUAL_P (b))
- inits = build_vtt_inits (b, t, inits, index);
+ build_vtt_inits (b, t, inits, index);
/* Add secondary virtual pointers for all subobjects of BINFO with
either virtual bases or reachable along a virtual path, except
subobjects that are non-virtual primary bases. */
data.top_level_p = top_level_p;
data.index = *index;
- data.inits = NULL;
+ data.inits = *inits;
data.type_being_constructed = BINFO_TYPE (binfo);
dfs_walk_once (binfo, dfs_build_secondary_vptr_vtt_inits, NULL, &data);
*index = data.index;
- /* The secondary vptrs come back in reverse order. After we reverse
- them, and add the INITS, the last init will be the first element
- of the chain. */
- secondary_vptrs = data.inits;
- if (secondary_vptrs)
- {
- *inits = nreverse (secondary_vptrs);
- inits = &TREE_CHAIN (secondary_vptrs);
- gcc_assert (*inits == NULL_TREE);
- }
+ /* data.inits might have grown as we added secondary virtual pointers.
+ Make sure our caller knows about the new vector. */
+ *inits = data.inits;
if (top_level_p)
/* Add the secondary VTTs for virtual bases in inheritance graph
@@ -7238,13 +7307,11 @@ build_vtt_inits (tree binfo, tree t, tree *inits, tree *index)
if (!BINFO_VIRTUAL_P (b))
continue;
- inits = build_vtt_inits (b, t, inits, index);
+ build_vtt_inits (b, t, inits, index);
}
else
/* Remove the ctor vtables we created. */
dfs_walk_all (binfo, dfs_fixup_binfo_vtbls, NULL, binfo);
-
- return inits;
}
/* Called from build_vtt_inits via dfs_walk. BINFO is the binfo for the base
@@ -7292,7 +7359,7 @@ dfs_build_secondary_vptr_vtt_inits (tree binfo, void *data_)
}
/* Add the initializer for the secondary vptr itself. */
- data->inits = tree_cons (NULL_TREE, binfo_ctor_vtable (binfo), data->inits);
+ CONSTRUCTOR_APPEND_ELT (data->inits, NULL_TREE, binfo_ctor_vtable (binfo));
/* Advance the vtt index. */
data->index = size_binop (PLUS_EXPR, data->index,
@@ -7335,12 +7402,11 @@ dfs_fixup_binfo_vtbls (tree binfo, void* data)
static void
build_ctor_vtbl_group (tree binfo, tree t)
{
- tree list;
tree type;
tree vtbl;
- tree inits;
tree id;
tree vbase;
+ VEC(constructor_elt,gc) *v;
/* See if we've already created this construction vtable group. */
id = mangle_ctor_vtbl_for_type (t, binfo);
@@ -7353,9 +7419,10 @@ build_ctor_vtbl_group (tree binfo, tree t)
construction vtable group. */
vtbl = build_vtable (t, id, ptr_type_node);
DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1;
- list = build_tree_list (vtbl, NULL_TREE);
+
+ v = NULL;
accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)),
- binfo, t, list);
+ binfo, vtbl, t, &v);
/* Add the vtables for each of our virtual bases using the vbase in T
binfo. */
@@ -7369,12 +7436,11 @@ build_ctor_vtbl_group (tree binfo, tree t)
continue;
b = copied_binfo (vbase, binfo);
- accumulate_vtbl_inits (b, vbase, binfo, t, list);
+ accumulate_vtbl_inits (b, vbase, binfo, vtbl, t, &v);
}
- inits = TREE_VALUE (list);
/* Figure out the type of the construction vtable. */
- type = build_index_type (size_int (list_length (inits) - 1));
+ type = build_index_type (size_int (VEC_length (constructor_elt, v) - 1));
type = build_cplus_array_type (vtable_entry_type, type);
layout_type (type);
TREE_TYPE (vtbl) = type;
@@ -7383,7 +7449,7 @@ build_ctor_vtbl_group (tree binfo, tree t)
/* Initialize the construction vtable. */
CLASSTYPE_VTABLES (t) = chainon (CLASSTYPE_VTABLES (t), vtbl);
- initialize_artificial_var (vtbl, inits);
+ initialize_artificial_var (vtbl, v);
dump_vtable (t, binfo, vtbl);
}
@@ -7401,8 +7467,9 @@ static void
accumulate_vtbl_inits (tree binfo,
tree orig_binfo,
tree rtti_binfo,
+ tree vtbl,
tree t,
- tree inits)
+ VEC(constructor_elt,gc) **inits)
{
int i;
tree base_binfo;
@@ -7422,10 +7489,7 @@ accumulate_vtbl_inits (tree binfo,
return;
/* Build the initializers for the BINFO-in-T vtable. */
- TREE_VALUE (inits)
- = chainon (TREE_VALUE (inits),
- dfs_accumulate_vtbl_inits (binfo, orig_binfo,
- rtti_binfo, t, inits));
+ dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, vtbl, t, inits);
/* Walk the BINFO and its bases. We walk in preorder so that as we
initialize each vtable we can figure out at what offset the
@@ -7439,24 +7503,25 @@ accumulate_vtbl_inits (tree binfo,
continue;
accumulate_vtbl_inits (base_binfo,
BINFO_BASE_BINFO (orig_binfo, i),
- rtti_binfo, t,
+ rtti_binfo, vtbl, t,
inits);
}
}
-/* Called from accumulate_vtbl_inits. Returns the initializers for
- the BINFO vtable. */
+/* Called from accumulate_vtbl_inits. Adds the initializers for the
+ BINFO vtable to L. */
-static tree
+static void
dfs_accumulate_vtbl_inits (tree binfo,
tree orig_binfo,
tree rtti_binfo,
+ tree orig_vtbl,
tree t,
- tree l)
+ VEC(constructor_elt,gc) **l)
{
- tree inits = NULL_TREE;
tree vtbl = NULL_TREE;
int ctor_vtbl_p = !SAME_BINFO_TYPE_P (BINFO_TYPE (rtti_binfo), t);
+ int n_inits;
if (ctor_vtbl_p
&& BINFO_VIRTUAL_P (orig_binfo) && BINFO_PRIMARY_P (orig_binfo))
@@ -7510,23 +7575,24 @@ dfs_accumulate_vtbl_inits (tree binfo,
/* Otherwise, this is case 3 and we get our own. */
}
else if (!BINFO_NEW_VTABLE_MARKED (orig_binfo))
- return inits;
+ return;
+
+ n_inits = VEC_length (constructor_elt, *l);
if (!vtbl)
{
tree index;
int non_fn_entries;
- /* Compute the initializer for this vtable. */
- inits = build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
- &non_fn_entries);
+ /* Add the initializer for this vtable. */
+ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
+ &non_fn_entries, l);
/* Figure out the position to which the VPTR should point. */
- vtbl = TREE_PURPOSE (l);
- vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl);
+ vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, orig_vtbl);
index = size_binop (PLUS_EXPR,
size_int (non_fn_entries),
- size_int (list_length (TREE_VALUE (l))));
+ size_int (n_inits));
index = size_binop (MULT_EXPR,
TYPE_SIZE_UNIT (vtable_entry_type),
index);
@@ -7539,12 +7605,11 @@ dfs_accumulate_vtbl_inits (tree binfo,
straighten this out. */
BINFO_VTABLE (binfo) = tree_cons (rtti_binfo, vtbl, BINFO_VTABLE (binfo));
else if (BINFO_PRIMARY_P (binfo) && BINFO_VIRTUAL_P (binfo))
- inits = NULL_TREE;
+ /* Throw away any unneeded intializers. */
+ VEC_truncate (constructor_elt, *l, n_inits);
else
/* For an ordinary vtable, set BINFO_VTABLE. */
BINFO_VTABLE (binfo) = vtbl;
-
- return inits;
}
static GTY(()) tree abort_fndecl_addr;
@@ -7572,26 +7637,26 @@ static GTY(()) tree abort_fndecl_addr;
primary bases; we need these while the primary base is being
constructed. */
-static tree
+static void
build_vtbl_initializer (tree binfo,
tree orig_binfo,
tree t,
tree rtti_binfo,
- int* non_fn_entries_p)
+ int* non_fn_entries_p,
+ VEC(constructor_elt,gc) **inits)
{
tree v, b;
- tree vfun_inits;
vtbl_init_data vid;
- unsigned ix;
+ unsigned ix, jx;
tree vbinfo;
VEC(tree,gc) *vbases;
+ constructor_elt *e;
/* Initialize VID. */
memset (&vid, 0, sizeof (vid));
vid.binfo = binfo;
vid.derived = t;
vid.rtti_binfo = rtti_binfo;
- vid.last_init = &vid.inits;
vid.primary_vtbl_p = SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), t);
vid.ctor_vtbl_p = !SAME_BINFO_TYPE_P (BINFO_TYPE (rtti_binfo), t);
vid.generate_vcall_entries = true;
@@ -7617,28 +7682,52 @@ build_vtbl_initializer (tree binfo,
/* If the target requires padding between data entries, add that now. */
if (TARGET_VTABLE_DATA_ENTRY_DISTANCE > 1)
{
- tree cur, *prev;
+ int n_entries = VEC_length (constructor_elt, vid.inits);
- for (prev = &vid.inits; (cur = *prev); prev = &TREE_CHAIN (cur))
+ VEC_safe_grow (constructor_elt, gc, vid.inits,
+ TARGET_VTABLE_DATA_ENTRY_DISTANCE * n_entries);
+
+ /* Move data entries into their new positions and add padding
+ after the new positions. Iterate backwards so we don't
+ overwrite entries that we would need to process later. */
+ for (ix = n_entries - 1;
+ VEC_iterate (constructor_elt, vid.inits, ix, e);
+ ix--)
{
- tree add = cur;
- int i;
+ int j;
+ int new_position = (TARGET_VTABLE_DATA_ENTRY_DISTANCE * ix
+ + (TARGET_VTABLE_DATA_ENTRY_DISTANCE - 1));
- for (i = 1; i < TARGET_VTABLE_DATA_ENTRY_DISTANCE; ++i)
- add = tree_cons (NULL_TREE,
- build1 (NOP_EXPR, vtable_entry_type,
- null_pointer_node),
- add);
- *prev = add;
+ VEC_replace (constructor_elt, vid.inits, new_position, e);
+
+ for (j = 1; j < TARGET_VTABLE_DATA_ENTRY_DISTANCE; ++j)
+ {
+ constructor_elt *f = VEC_index (constructor_elt, vid.inits,
+ new_position - j);
+ f->index = NULL_TREE;
+ f->value = build1 (NOP_EXPR, vtable_entry_type,
+ null_pointer_node);
+ }
}
}
if (non_fn_entries_p)
- *non_fn_entries_p = list_length (vid.inits);
+ *non_fn_entries_p = VEC_length (constructor_elt, vid.inits);
+
+ /* The initializers for virtual functions were built up in reverse
+ order. Straighten them out and add them to the running list in one
+ step. */
+ jx = VEC_length (constructor_elt, *inits);
+ VEC_safe_grow (constructor_elt, gc, *inits,
+ (jx + VEC_length (constructor_elt, vid.inits)));
+
+ for (ix = VEC_length (constructor_elt, vid.inits) - 1;
+ VEC_iterate (constructor_elt, vid.inits, ix, e);
+ ix--, jx++)
+ VEC_replace (constructor_elt, *inits, jx, e);
/* Go through all the ordinary virtual functions, building up
initializers. */
- vfun_inits = NULL_TREE;
for (v = BINFO_VIRTUALS (orig_binfo); v; v = TREE_CHAIN (v))
{
tree delta;
@@ -7724,7 +7813,7 @@ build_vtbl_initializer (tree binfo,
int i;
if (init == size_zero_node)
for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
- vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
+ CONSTRUCTOR_APPEND_ELT (*inits, NULL_TREE, init);
else
for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
{
@@ -7733,22 +7822,12 @@ build_vtbl_initializer (tree binfo,
build_int_cst (NULL_TREE, i));
TREE_CONSTANT (fdesc) = 1;
- vfun_inits = tree_cons (NULL_TREE, fdesc, vfun_inits);
+ CONSTRUCTOR_APPEND_ELT (*inits, NULL_TREE, fdesc);
}
}
else
- vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
+ CONSTRUCTOR_APPEND_ELT (*inits, NULL_TREE, init);
}
-
- /* The initializers for virtual functions were built up in reverse
- order; straighten them out now. */
- vfun_inits = nreverse (vfun_inits);
-
- /* The negative offset initializers are also in reverse order. */
- vid.inits = nreverse (vid.inits);
-
- /* Chain the two together. */
- return chainon (vid.inits, vfun_inits);
}
/* Adds to vid->inits the initializers for the vbase and vcall
@@ -7858,12 +7937,9 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
delta = size_diffop_loc (input_location,
BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
- *vid->last_init
- = build_tree_list (NULL_TREE,
- fold_build1_loc (input_location, NOP_EXPR,
- vtable_entry_type,
- delta));
- vid->last_init = &TREE_CHAIN (*vid->last_init);
+ CONSTRUCTOR_APPEND_ELT (vid->inits, NULL_TREE,
+ fold_build1_loc (input_location, NOP_EXPR,
+ vtable_entry_type, delta));
}
}
@@ -8098,8 +8174,7 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
vcall_offset);
}
/* Add the initializer to the vtable. */
- *vid->last_init = build_tree_list (NULL_TREE, vcall_offset);
- vid->last_init = &TREE_CHAIN (*vid->last_init);
+ CONSTRUCTOR_APPEND_ELT (vid->inits, NULL_TREE, vcall_offset);
}
}
@@ -8143,15 +8218,13 @@ build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
/* Convert the declaration to a type that can be stored in the
vtable. */
init = build_nop (vfunc_ptr_type_node, decl);
- *vid->last_init = build_tree_list (NULL_TREE, init);
- vid->last_init = &TREE_CHAIN (*vid->last_init);
+ CONSTRUCTOR_APPEND_ELT (vid->inits, NULL_TREE, init);
/* Add the offset-to-top entry. It comes earlier in the vtable than
the typeinfo entry. Convert the offset to look like a
function pointer, so that we can put it in the vtable. */
init = build_nop (vfunc_ptr_type_node, offset);
- *vid->last_init = build_tree_list (NULL_TREE, init);
- vid->last_init = &TREE_CHAIN (*vid->last_init);
+ CONSTRUCTOR_APPEND_ELT (vid->inits, NULL_TREE, init);
}
/* Fold a OBJ_TYPE_REF expression to the address of a function.
diff --git a/gcc/cp/config-lang.in b/gcc/cp/config-lang.in
index c6d7b38b31f..a15c7e24705 100644
--- a/gcc/cp/config-lang.in
+++ b/gcc/cp/config-lang.in
@@ -30,4 +30,4 @@ compilers="cc1plus\$(exeext)"
target_libs="target-libstdc++-v3"
-gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.h \$(srcdir)/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/cp-lang.c"
+gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/cp-lang.c"
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 2e3f11d0946..fa897bfa2b8 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "toplev.h"
#include "tree-iterator.h"
#include "gimple.h"
@@ -575,7 +575,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
TREE_OPERAND (*expr_p, 1) = build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (op0), op1);
- else if ((rhs_predicate_for (op0)) (op1)
+ else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1))
&& !(TREE_CODE (op1) == CALL_EXPR
&& CALL_EXPR_RETURN_SLOT_OPT (op1))
&& is_really_empty_class (TREE_TYPE (op0)))
@@ -981,7 +981,7 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
return NULL;
nargs = list_length (DECL_ARGUMENTS (fn));
- argarray = (tree *) alloca (nargs * sizeof (tree));
+ argarray = XALLOCAVEC (tree, nargs);
defparm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
if (arg2)
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index a08f0dd71d0..fb687b81685 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -25,14 +25,13 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "toplev.h"
#include "langhooks.h"
#include "langhooks-def.h"
#include "debug.h"
#include "cp-objcp-common.h"
#include "hashtab.h"
-#include "except.h"
enum c_language_kind c_language = clk_cxx;
static void cp_init_ts (void);
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 35654c5f07a..9cfe7702aca 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "toplev.h"
#include "langhooks.h"
#include "langhooks-def.h"
@@ -203,7 +203,7 @@ decl_shadowed_for_var_insert (tree from, tree to)
struct tree_decl_map *h;
void **loc;
- h = GGC_NEW (struct tree_decl_map);
+ h = ggc_alloc_tree_decl_map ();
h->base.from = from;
h->to = to;
loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, DECL_UID (from),
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 1a97ad2b119..f2d4aa1cceb 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -143,4 +143,7 @@ extern bool cp_function_decl_explicit_p (tree decl);
#undef LANG_HOOKS_EH_USE_CXA_END_CLEANUP
#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP true
+#undef LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS
+#define LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS cp_protect_cleanup_actions
+
#endif /* GCC_CP_OBJCP_COMMON */
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index c71f94caa61..b77350fffa8 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -247,6 +247,7 @@ DEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", tcc_unary, 1)
DEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", tcc_unary, 1)
DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", tcc_expression, 2)
DEFTREECODE (TYPEID_EXPR, "typeid_expr", tcc_expression, 1)
+DEFTREECODE (NOEXCEPT_EXPR, "noexcept_expr", tcc_unary, 1)
/* A placeholder for an expression that is not type-dependent, but
does occur in a template. When an expression that is not
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index da8293f7b52..1d9077cdaf1 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -42,7 +42,7 @@ c-common.h, not after.
#endif
#include "toplev.h"
#include "diagnostic.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "name-lookup.h"
@@ -418,6 +418,23 @@ typedef enum readonly_error_kind
REK_DECREMENT
} readonly_error_kind;
+/* Possible cases of expression list used by build_x_compound_expr_from_list. */
+typedef enum expr_list_kind {
+ ELK_INIT, /* initializer */
+ ELK_MEM_INIT, /* member initializer */
+ ELK_FUNC_CAST /* functional cast */
+} expr_list_kind;
+
+/* Possible cases of implicit bad rhs conversions. */
+typedef enum impl_conv_rhs {
+ ICR_DEFAULT_ARGUMENT, /* default argument */
+ ICR_CONVERTING, /* converting */
+ ICR_INIT, /* initialization */
+ ICR_ARGPASS, /* argument passing */
+ ICR_RETURN, /* return */
+ ICR_ASSIGN /* assignment */
+} impl_conv_rhs;
+
/* Macros for access to language-specific slots in an identifier. */
#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
@@ -758,6 +775,8 @@ enum cp_tree_index
CPTI_LANG_NAME_JAVA,
CPTI_EMPTY_EXCEPT_SPEC,
+ CPTI_NOEXCEPT_TRUE_SPEC,
+ CPTI_NOEXCEPT_FALSE_SPEC,
CPTI_JCLASS,
CPTI_TERMINATE,
CPTI_CALL_UNEXPECTED,
@@ -847,6 +866,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
/* Exception specifier used for throw(). */
#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
+#define noexcept_true_spec cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC]
+#define noexcept_false_spec cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC]
/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
#define jclass_node cp_global_trees[CPTI_JCLASS]
@@ -892,7 +913,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
struct GTY(()) saved_scope {
VEC(cxx_saved_binding,gc) *old_bindings;
tree old_namespace;
- tree decl_ns_list;
+ VEC(tree,gc) *decl_ns_list;
tree class_name;
tree class_type;
tree access_specifier;
@@ -1218,11 +1239,11 @@ struct GTY(()) lang_type_header {
BOOL_BITFIELD is_lang_type_class : 1;
BOOL_BITFIELD has_type_conversion : 1;
- BOOL_BITFIELD has_init_ref : 1;
+ BOOL_BITFIELD has_copy_ctor : 1;
BOOL_BITFIELD has_default_ctor : 1;
BOOL_BITFIELD const_needs_init : 1;
BOOL_BITFIELD ref_needs_init : 1;
- BOOL_BITFIELD has_const_assign_ref : 1;
+ BOOL_BITFIELD has_const_copy_assign : 1;
BOOL_BITFIELD spare : 1;
};
@@ -1250,7 +1271,7 @@ struct GTY(()) lang_type_class {
unsigned non_pod_class : 1;
unsigned nearly_empty_p : 1;
unsigned user_align : 1;
- unsigned has_assign_ref : 1;
+ unsigned has_copy_assign : 1;
unsigned has_new : 1;
unsigned has_array_new : 1;
@@ -1276,19 +1297,23 @@ struct GTY(()) lang_type_class {
unsigned was_anonymous : 1;
unsigned lazy_default_ctor : 1;
unsigned lazy_copy_ctor : 1;
- unsigned lazy_assignment_op : 1;
+ unsigned lazy_copy_assign : 1;
unsigned lazy_destructor : 1;
- unsigned has_const_init_ref : 1;
- unsigned has_complex_init_ref : 1;
- unsigned has_complex_assign_ref : 1;
+ unsigned has_const_copy_ctor : 1;
+ unsigned has_complex_copy_ctor : 1;
+ unsigned has_complex_copy_assign : 1;
unsigned non_aggregate : 1;
unsigned has_complex_dflt : 1;
unsigned has_list_ctor : 1;
unsigned non_std_layout : 1;
- unsigned lazy_move_ctor : 1;
unsigned is_literal : 1;
+ unsigned lazy_move_ctor : 1;
+ unsigned lazy_move_assign : 1;
+ unsigned has_complex_move_ctor : 1;
+ unsigned has_complex_move_assign : 1;
+
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
so, make sure to copy it in instantiate_class_template! */
@@ -1296,7 +1321,7 @@ struct GTY(()) lang_type_class {
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
remove a flag. */
- unsigned dummy : 7;
+ unsigned dummy : 4;
tree primary_base;
VEC(tree_pair_s,gc) *vcall_indices;
@@ -1329,7 +1354,7 @@ struct GTY(()) lang_type_ptrmem {
tree record;
};
-struct GTY(()) lang_type {
+struct GTY((variable_size)) lang_type {
union lang_type_u
{
struct lang_type_header GTY((skip (""))) h;
@@ -1391,8 +1416,13 @@ struct GTY(()) lang_type {
/* Nonzero means that NODE (a class type) has an assignment operator
-- but that it has not yet been declared. */
-#define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \
- (LANG_TYPE_CLASS_CHECK (NODE)->lazy_assignment_op)
+#define CLASSTYPE_LAZY_COPY_ASSIGN(NODE) \
+ (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_assign)
+
+/* Nonzero means that NODE (a class type) has an assignment operator
+ -- but that it has not yet been declared. */
+#define CLASSTYPE_LAZY_MOVE_ASSIGN(NODE) \
+ (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_assign)
/* Nonzero means that NODE (a class type) has a destructor -- but that
it has not yet been declared. */
@@ -1400,17 +1430,17 @@ struct GTY(()) lang_type {
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
-#define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref)
+#define TYPE_HAS_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_assign)
/* True iff the class type NODE has an "operator =" whose parameter
has a parameter of type "const X&". */
-#define TYPE_HAS_CONST_ASSIGN_REF(NODE) \
- (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_assign_ref)
+#define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \
+ (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_copy_assign)
/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
-#define TYPE_HAS_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_init_ref)
-#define TYPE_HAS_CONST_INIT_REF(NODE) \
- (LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref)
+#define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_copy_ctor)
+#define TYPE_HAS_CONST_COPY_CTOR(NODE) \
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor)
/* Nonzero if this class has an X(initializer_list<T>) constructor. */
#define TYPE_HAS_LIST_CTOR(NODE) \
@@ -1429,6 +1459,11 @@ struct GTY(()) lang_type {
starting the definition of this type has been seen. */
#define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
+/* Nonzero means that this type is either complete or being defined, so we
+ can do lookup in it. */
+#define COMPLETE_OR_OPEN_TYPE_P(NODE) \
+ (COMPLETE_TYPE_P (NODE) || (CLASS_TYPE_P (NODE) && TYPE_BEING_DEFINED (NODE)))
+
/* Mark bits for repeated base checks. */
#define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
@@ -1726,19 +1761,18 @@ struct GTY(()) lang_type {
/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
will be NULL_TREE to indicate a throw specification of `()', or
- no exceptions allowed. */
+ no exceptions allowed. For a noexcept specification, TREE_VALUE
+ is NULL_TREE and TREE_PURPOSE is the constant-expression. */
#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
-/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
-#define TYPE_NOTHROW_P(NODE) \
- (TYPE_RAISES_EXCEPTIONS (NODE) \
- && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
+/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'
+ or noexcept(true). */
+#define TYPE_NOTHROW_P(NODE) nothrow_spec_p (TYPE_RAISES_EXCEPTIONS (NODE))
/* For FUNCTION_TYPE or METHOD_TYPE, true if NODE is noexcept. This is the
case for things declared noexcept(true) and, with -fnothrow-opt, for
throw() functions. */
-#define TYPE_NOEXCEPT_P(NODE) \
- (flag_nothrow_opt && TYPE_NOTHROW_P(NODE))
+#define TYPE_NOEXCEPT_P(NODE) type_noexcept_p (NODE)
/* The binding level associated with the namespace. */
#define NAMESPACE_LEVEL(NODE) \
@@ -1876,7 +1910,7 @@ struct GTY(()) lang_decl_parm {
union rather than a struct containing a union as its only field, but
tree.h declares it as a struct. */
-struct GTY(()) lang_decl {
+struct GTY((variable_size)) lang_decl {
union GTY((desc ("%h.base.selector"))) lang_decl_u {
struct lang_decl_base GTY ((default)) base;
struct lang_decl_min GTY((tag ("0"))) min;
@@ -3134,13 +3168,19 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define TYPE_NON_AGGREGATE_CLASS(NODE) \
(CLASS_TYPE_P (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
-/* Nonzero if there is a user-defined X::op=(x&) for this class. */
-#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref)
+/* Nonzero if there is a non-trivial X::op=(cv X&) for this class. */
+#define TYPE_HAS_COMPLEX_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_assign)
+
+/* Nonzero if there is a non-trivial X::X(cv X&) for this class. */
+#define TYPE_HAS_COMPLEX_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_ctor)
-/* Nonzero if there is a user-defined X::X(x&) for this class. */
-#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_init_ref)
+/* Nonzero if there is a non-trivial X::op=(X&&) for this class. */
+#define TYPE_HAS_COMPLEX_MOVE_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_assign)
-/* Nonzero if there is a user-defined default constructor for this class. */
+/* Nonzero if there is a non-trivial X::X(X&&) for this class. */
+#define TYPE_HAS_COMPLEX_MOVE_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_ctor)
+
+/* Nonzero if there is a non-trivial default constructor for this class. */
#define TYPE_HAS_COMPLEX_DFLT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_dflt)
/* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
@@ -3170,13 +3210,13 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
/* Nonzero for class type means that copy initialization of this type can use
a bitwise copy. */
-#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
- (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
+#define TYPE_HAS_TRIVIAL_COPY_CTOR(NODE) \
+ (TYPE_HAS_COPY_CTOR (NODE) && ! TYPE_HAS_COMPLEX_COPY_CTOR (NODE))
/* Nonzero for class type means that assignment of this type can use
a bitwise copy. */
-#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
- (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
+#define TYPE_HAS_TRIVIAL_COPY_ASSIGN(NODE) \
+ (TYPE_HAS_COPY_ASSIGN (NODE) && ! TYPE_HAS_COMPLEX_COPY_ASSIGN (NODE))
/* Returns true if NODE is a pointer-to-data-member. */
#define TYPE_PTRMEM_P(NODE) \
@@ -3263,8 +3303,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
do { \
if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
{ \
- TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \
- (struct lang_type, sizeof (struct lang_type_ptrmem)); \
+ TYPE_LANG_SPECIFIC (NODE) = ggc_alloc_cleared_lang_type \
+ (sizeof (struct lang_type_ptrmem)); \
TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
} \
TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
@@ -3842,7 +3882,8 @@ typedef enum special_function_kind {
sfk_constructor, /* A constructor. */
sfk_copy_constructor, /* A copy constructor. */
sfk_move_constructor, /* A move constructor. */
- sfk_assignment_operator, /* An assignment operator. */
+ sfk_copy_assignment, /* A copy assignment operator. */
+ sfk_move_assignment, /* A move assignment operator. */
sfk_destructor, /* A destructor. */
sfk_complete_destructor, /* A destructor for complete objects. */
sfk_base_destructor, /* A destructor for base subobjects. */
@@ -4137,12 +4178,21 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG };
/* We're inside an init-list, so narrowing conversions are ill-formed. */
#define LOOKUP_NO_NARROWING (LOOKUP_PREFER_RVALUE << 1)
/* Avoid user-defined conversions for the first parameter of a copy
- constructor. */
+ constructor (or move constructor). */
#define LOOKUP_NO_COPY_CTOR_CONVERSION (LOOKUP_NO_NARROWING << 1)
/* This is the first parameter of a copy constructor. */
#define LOOKUP_COPY_PARM (LOOKUP_NO_COPY_CTOR_CONVERSION << 1)
/* We only want to consider list constructors. */
#define LOOKUP_LIST_ONLY (LOOKUP_COPY_PARM << 1)
+/* Return after determining which function to call and checking access.
+ Used by sythesized_method_walk to determine which functions will
+ be called to initialize subobjects, in order to determine exception
+ specification and possible implicit delete.
+ This is kind of a hack, but since access control doesn't respect SFINAE
+ we can't just use tf_none to avoid access control errors, we need
+ another mechanism. Exiting early also avoids problems with trying
+ to perform argument conversions when the class isn't complete yet. */
+#define LOOKUP_SPECULATIVE (LOOKUP_LIST_ONLY << 1)
#define LOOKUP_NAMESPACES_ONLY(F) \
(((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
@@ -4629,6 +4679,9 @@ extern tree in_class_defaulted_default_constructor (tree);
extern bool user_provided_p (tree);
extern bool type_has_user_provided_constructor (tree);
extern bool type_has_user_provided_default_constructor (tree);
+extern bool type_has_virtual_destructor (tree);
+extern bool type_has_move_constructor (tree);
+extern bool type_has_move_assign (tree);
extern void defaulted_late_check (tree);
extern bool defaultable_fn_check (tree);
extern void fixup_type_variants (tree);
@@ -4743,7 +4796,7 @@ extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
extern void warn_extern_redeclared_static (tree, tree);
extern tree cxx_comdat_group (tree);
extern bool cp_missing_noreturn_ok_p (tree);
-extern void initialize_artificial_var (tree, tree);
+extern void initialize_artificial_var (tree, VEC(constructor_elt,gc) *);
extern tree check_var_type (tree, tree);
extern tree reshape_init (tree, tree);
extern tree next_initializable_field (tree);
@@ -4820,11 +4873,17 @@ extern tree build_exc_ptr (void);
extern tree build_throw (tree);
extern int nothrow_libfn_p (const_tree);
extern void check_handlers (tree);
+extern tree finish_noexcept_expr (tree, tsubst_flags_t);
+extern bool nothrow_spec_p (const_tree);
+extern bool type_noexcept_p (const_tree);
+extern bool type_throw_all_p (const_tree);
+extern tree build_noexcept_spec (tree, int);
extern void choose_personality_routine (enum languages);
extern tree eh_type_info (tree);
extern tree begin_eh_spec_block (void);
extern void finish_eh_spec_block (tree, tree);
extern tree build_eh_type_type (tree);
+extern tree cp_protect_cleanup_actions (void);
/* in expr.c */
extern tree cplus_expand_constant (tree);
@@ -4888,15 +4947,19 @@ extern void init_method (void);
extern tree make_thunk (tree, bool, tree, tree);
extern void finish_thunk (tree);
extern void use_thunk (tree, bool);
+extern bool trivial_fn_p (tree);
+extern bool maybe_explain_implicit_delete (tree);
extern void synthesize_method (tree);
extern tree lazily_declare_fn (special_function_kind,
tree);
extern tree skip_artificial_parms_for (const_tree, tree);
extern int num_artificial_parms_for (const_tree);
extern tree make_alias_for (tree, tree);
-extern tree locate_copy (tree, void *);
-extern tree locate_ctor (tree, void *);
-extern tree locate_dtor (tree, void *);
+extern tree get_copy_ctor (tree);
+extern tree get_copy_assign (tree);
+extern tree get_default_ctor (tree);
+extern tree get_dtor (tree);
+extern tree locate_ctor (tree);
/* In optimize.c */
extern bool maybe_clone_body (tree);
@@ -5037,6 +5100,7 @@ extern int accessible_p (tree, tree, bool);
extern tree lookup_field_1 (tree, tree, bool);
extern tree lookup_field (tree, tree, int, bool);
extern int lookup_fnfields_1 (tree, tree);
+extern tree lookup_fnfields_slot (tree, tree);
extern int class_method_index_for_fn (tree, tree);
extern tree lookup_fnfields (tree, tree, int);
extern tree lookup_member (tree, tree, int, bool);
@@ -5248,12 +5312,12 @@ extern bool pod_type_p (const_tree);
extern bool layout_pod_type_p (const_tree);
extern bool std_layout_type_p (const_tree);
extern bool trivial_type_p (const_tree);
+extern bool trivially_copyable_p (const_tree);
extern bool type_has_nontrivial_default_init (const_tree);
extern bool type_has_nontrivial_copy_init (const_tree);
extern bool class_tmpl_impl_spec_p (const_tree);
extern int zero_init_p (const_tree);
extern tree strip_typedefs (tree);
-extern bool typedef_variant_p (tree);
extern void cp_set_underlying_type (tree);
extern tree copy_binfo (tree, tree, tree,
tree *, int);
@@ -5347,7 +5411,8 @@ extern tree require_complete_type (tree);
extern tree complete_type (tree);
extern tree complete_type_or_else (tree, tree);
extern int type_unknown_p (const_tree);
-extern bool comp_except_specs (const_tree, const_tree, bool);
+enum { ce_derived, ce_normal, ce_exact };
+extern bool comp_except_specs (const_tree, const_tree, int);
extern bool comptypes (tree, tree, int);
extern bool compparms (const_tree, const_tree);
extern int comp_cv_qualification (const_tree, const_tree);
@@ -5387,7 +5452,7 @@ extern tree cp_build_unary_op (enum tree_code, tree, int,
extern tree unary_complex_lvalue (enum tree_code, tree);
extern tree build_x_conditional_expr (tree, tree, tree,
tsubst_flags_t);
-extern tree build_x_compound_expr_from_list (tree, const char *);
+extern tree build_x_compound_expr_from_list (tree, expr_list_kind);
extern tree build_x_compound_expr_from_vec (VEC(tree,gc) *, const char *);
extern tree build_x_compound_expr (tree, tree, tsubst_flags_t);
extern tree build_compound_expr (location_t, tree, tree);
@@ -5402,7 +5467,7 @@ extern tree build_x_modify_expr (tree, enum tree_code, tree,
extern tree cp_build_modify_expr (tree, enum tree_code, tree,
tsubst_flags_t);
extern tree convert_for_initialization (tree, tree, tree, int,
- const char *, tree, int,
+ impl_conv_rhs, tree, int,
tsubst_flags_t);
extern int comp_ptr_ttypes (tree, tree);
extern bool comp_ptr_ttypes_const (tree, tree);
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 71315b1f4fd..40a635153bc 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -196,7 +196,7 @@ cp_convert_to_pointer (tree type, tree expr)
return error_mark_node;
}
- if (integer_zerop (expr))
+ if (null_ptr_cst_p (expr))
{
if (TYPE_PTRMEMFUNC_P (type))
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0,
@@ -481,7 +481,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
else
{
rval = convert_for_initialization (NULL_TREE, type, expr, flags,
- "converting", 0, 0,
+ ICR_CONVERTING, 0, 0,
tf_warning_or_error);
if (rval == NULL_TREE || rval == error_mark_node)
return rval;
@@ -834,7 +834,9 @@ convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
while (TREE_CODE (exprv) == COMPOUND_EXPR)
exprv = TREE_OPERAND (exprv, 1);
- if (DECL_P (exprv) || handled_component_p (exprv))
+ if (DECL_P (exprv)
+ || handled_component_p (exprv)
+ || TREE_CODE (exprv) == INDIRECT_REF)
/* Expr is not being 'used' here, otherwise we whould have
called mark_{rl}value_use use here, which would have in turn
called mark_exp_read. Rather, we call mark_exp_read directly
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 04a83140ad9..6f4ab6b0811 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -791,6 +791,14 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
pp_unary_expression (pp, TREE_OPERAND (t, 0));
break;
+ case NOEXCEPT_EXPR:
+ pp_cxx_ws_string (pp, "noexcept");
+ pp_cxx_whitespace (pp);
+ pp_cxx_left_paren (pp);
+ pp_cxx_expression (pp, TREE_OPERAND (t, 0));
+ pp_cxx_right_paren (pp);
+ break;
+
case UNARY_PLUS_EXPR:
pp_plus (pp);
pp_cxx_cast_expression (pp, TREE_OPERAND (t, 0));
@@ -1061,6 +1069,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t)
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
+ case NOEXCEPT_EXPR:
pp_cxx_unary_expression (pp, t);
break;
@@ -1418,8 +1427,17 @@ pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
tree ex_spec = TYPE_RAISES_EXCEPTIONS (t);
bool need_comma = false;
- if (!TYPE_NOTHROW_P (t) && ex_spec == NULL)
+ if (ex_spec == NULL)
return;
+ if (TREE_PURPOSE (ex_spec))
+ {
+ pp_cxx_ws_string (pp, "noexcept");
+ pp_cxx_whitespace (pp);
+ pp_cxx_left_paren (pp);
+ pp_cxx_expression (pp, TREE_PURPOSE (ex_spec));
+ pp_cxx_right_paren (pp);
+ return;
+ }
pp_cxx_ws_string (pp, "throw");
pp_cxx_left_paren (pp);
for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec))
diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h
index a88d4c5ccdb..5a51f44bdb8 100644
--- a/gcc/cp/cxx-pretty-print.h
+++ b/gcc/cp/cxx-pretty-print.h
@@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_CXX_PRETTY_PRINT_H
#define GCC_CXX_PRETTY_PRINT_H
-#include "c-pretty-print.h"
+#include "c-family/c-pretty-print.h"
#undef pp_c_base
#define pp_c_base(PP) (&(PP)->c_base)
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b9f3ea84643..1d11fb8f785 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -40,22 +40,28 @@ along with GCC; see the file COPYING3. If not see
#include "decl.h"
#include "intl.h"
#include "output.h"
-#include "except.h"
#include "toplev.h"
#include "hashtab.h"
#include "tm_p.h"
#include "target.h"
-#include "c-common.h"
-#include "c-pragma.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
#include "diagnostic.h"
#include "intl.h"
#include "debug.h"
#include "timevar.h"
-#include "tree-flow.h"
#include "pointer-set.h"
#include "splay-tree.h"
#include "plugin.h"
+/* Possible cases of bad specifiers type used by bad_specifiers. */
+enum bad_spec_place {
+ BSP_VAR, /* variable */
+ BSP_PARM, /* parameter */
+ BSP_TYPE, /* type */
+ BSP_FIELD /* field */
+};
+
static tree grokparms (tree parmlist, tree *);
static const char *redeclaration_error_message (tree, tree);
@@ -71,7 +77,7 @@ static void record_unknown_type (tree, const char *);
static tree builtin_function_1 (tree, tree, bool);
static tree build_library_fn_1 (tree, enum tree_code, tree);
static int member_function_or_else (tree, tree, enum overload_flags);
-static void bad_specifiers (tree, const char *, int, int, int, int,
+static void bad_specifiers (tree, enum bad_spec_place, int, int, int, int,
int);
static void check_for_uninitialized_const_var (tree);
static hashval_t typename_hash (const void *);
@@ -90,6 +96,7 @@ static void check_function_type (tree, tree);
static void finish_constructor_body (void);
static void begin_destructor_body (void);
static void finish_destructor_body (void);
+static void record_key_method_defined (tree);
static tree create_array_type_for_decl (tree, tree, tree);
static tree get_atexit_node (void);
static tree get_dso_handle_node (void);
@@ -203,9 +210,9 @@ struct GTY(()) named_label_entry {
defined, or the inner scope popped. These are the decls that will
be skipped when jumping to the label. */
tree names_in_scope;
- /* A tree list of all decls from all binding levels that would be
+ /* A vector of all decls from all binding levels that would be
crossed by a backward branch to the label. */
- tree bad_decls;
+ VEC(tree,gc) *bad_decls;
/* A list of uses of the label, before the label is defined. */
struct named_label_use_entry *uses;
@@ -237,11 +244,18 @@ VEC(tree, gc) *deferred_mark_used_calls;
enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
-/* A TREE_LIST of VAR_DECLs. The TREE_PURPOSE is a RECORD_TYPE or
- UNION_TYPE; the TREE_VALUE is a VAR_DECL with that type. At the
- time the VAR_DECL was declared, the type was incomplete. */
+/* A list of VAR_DECLs whose type was incomplete at the time the
+ variable was declared. */
+
+typedef struct GTY(()) incomplete_var_d {
+ tree decl;
+ tree incomplete_type;
+} incomplete_var;
+
+DEF_VEC_O(incomplete_var);
+DEF_VEC_ALLOC_O(incomplete_var,gc);
-static GTY(()) tree incomplete_vars;
+static GTY(()) VEC(incomplete_var,gc) *incomplete_vars;
/* Returns the kind of template specialization we are currently
processing, given that it's declaration contained N_CLASS_SCOPES
@@ -462,7 +476,7 @@ poplevel_named_label_1 (void **slot, void *data)
for (decl = ent->names_in_scope; decl; decl = TREE_CHAIN (decl))
if (decl_jump_unsafe (decl))
- ent->bad_decls = tree_cons (NULL, decl, ent->bad_decls);
+ VEC_safe_push (tree, gc, ent->bad_decls, decl);
ent->binding_level = obl;
ent->names_in_scope = obl->names;
@@ -1104,10 +1118,10 @@ check_redeclaration_exception_specification (tree new_decl,
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (old_decl))
&& ! DECL_IS_BUILTIN (old_decl)
&& flag_exceptions
- && !comp_except_specs (new_exceptions, old_exceptions,
- /*exact=*/true))
+ && !comp_except_specs (new_exceptions, old_exceptions, ce_normal))
{
- error ("declaration of %qF throws different exceptions", new_decl);
+ error ("declaration of %qF has a different exception specifier",
+ new_decl);
error ("from previous declaration %q+F", old_decl);
}
}
@@ -1286,7 +1300,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Even if the types match, prefer the new declarations type for
built-ins which have not been explicitly declared, for
exception lists, etc... */
- else if (DECL_ANTICIPATED (olddecl))
+ else if (DECL_IS_BUILTIN (olddecl))
{
tree type = TREE_TYPE (newdecl);
tree attribs = (*targetm.merge_type_attributes)
@@ -2449,7 +2463,7 @@ make_label_decl (tree id, int local_p)
/* Record this label on the list of labels used in this function.
We do this before calling make_label_decl so that we get the
IDENTIFIER_LABEL_VALUE before the new label is declared. */
- ent = GGC_CNEW (struct named_label_entry);
+ ent = ggc_alloc_cleared_named_label_entry ();
ent->label_decl = decl;
slot = htab_find_slot (named_labels, ent, INSERT);
@@ -2643,6 +2657,7 @@ check_goto (tree decl)
struct named_label_entry *ent, dummy;
bool saw_catch = false, identified = false;
tree bad;
+ unsigned ix;
/* We can't know where a computed goto is jumping.
So we assume that it's OK. */
@@ -2669,7 +2684,7 @@ check_goto (tree decl)
&& ent->uses->names_in_scope == current_binding_level->names)
return;
- new_use = GGC_NEW (struct named_label_use_entry);
+ new_use = ggc_alloc_named_label_use_entry ();
new_use->binding_level = current_binding_level;
new_use->names_in_scope = current_binding_level->names;
new_use->o_goto_locus = input_location;
@@ -2681,29 +2696,28 @@ check_goto (tree decl)
}
if (ent->in_try_scope || ent->in_catch_scope
- || ent->in_omp_scope || ent->bad_decls)
+ || ent->in_omp_scope || !VEC_empty (tree, ent->bad_decls))
{
permerror (input_location, "jump to label %q+D", decl);
permerror (input_location, " from here");
identified = true;
}
- for (bad = ent->bad_decls; bad; bad = TREE_CHAIN (bad))
+ for (ix = 0; VEC_iterate (tree, ent->bad_decls, ix, bad); ix++)
{
- tree b = TREE_VALUE (bad);
- int u = decl_jump_unsafe (b);
+ int u = decl_jump_unsafe (bad);
- if (u > 1 && DECL_ARTIFICIAL (b))
+ if (u > 1 && DECL_ARTIFICIAL (bad))
{
/* Can't skip init of __exception_info. */
- error_at (DECL_SOURCE_LOCATION (b), " enters catch block");
+ error_at (DECL_SOURCE_LOCATION (bad), " enters catch block");
saw_catch = true;
}
else if (u > 1)
- error (" skips initialization of %q+#D", b);
+ error (" skips initialization of %q+#D", bad);
else
permerror (input_location, " enters scope of %q+#D which has "
- "non-trivial destructor", b);
+ "non-trivial destructor", bad);
}
if (ent->in_try_scope)
@@ -3433,6 +3447,8 @@ cxx_init_decl_processing (void)
truthvalue_true_node = boolean_true_node;
empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
+ noexcept_true_spec = build_tree_list (boolean_true_node, NULL_TREE);
+ noexcept_false_spec = build_tree_list (boolean_false_node, NULL_TREE);
#if 0
record_builtin_type (RID_MAX, NULL, string_type_node);
@@ -3442,11 +3458,9 @@ cxx_init_decl_processing (void)
vtable_index_type = ptrdiff_type_node;
vtt_parm_type = build_pointer_type (const_ptr_type_node);
- void_ftype = build_function_type (void_type_node, void_list_node);
- void_ftype_ptr = build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- ptr_type_node,
- void_list_node));
+ void_ftype = build_function_type_list (void_type_node, NULL_TREE);
+ void_ftype_ptr = build_function_type_list (void_type_node,
+ ptr_type_node, NULL_TREE);
void_ftype_ptr
= build_exception_variant (void_ftype_ptr, empty_except_spec);
@@ -3498,29 +3512,34 @@ cxx_init_decl_processing (void)
current_lang_name = lang_name_cplusplus;
{
- tree bad_alloc_id;
- tree bad_alloc_type_node;
- tree bad_alloc_decl;
tree newtype, deltype;
tree ptr_ftype_sizetype;
-
- push_namespace (std_identifier);
- bad_alloc_id = get_identifier ("bad_alloc");
- bad_alloc_type_node = make_class_type (RECORD_TYPE);
- TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
- bad_alloc_decl
- = create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
- DECL_CONTEXT (bad_alloc_decl) = current_namespace;
- pop_namespace ();
+ tree new_eh_spec;
ptr_ftype_sizetype
- = build_function_type (ptr_type_node,
- tree_cons (NULL_TREE,
- size_type_node,
- void_list_node));
- newtype = build_exception_variant
- (ptr_ftype_sizetype, add_exception_specifier
- (NULL_TREE, bad_alloc_type_node, -1));
+ = build_function_type_list (ptr_type_node, size_type_node, NULL_TREE);
+ if (cxx_dialect == cxx98)
+ {
+ tree bad_alloc_id;
+ tree bad_alloc_type_node;
+ tree bad_alloc_decl;
+
+ push_namespace (std_identifier);
+ bad_alloc_id = get_identifier ("bad_alloc");
+ bad_alloc_type_node = make_class_type (RECORD_TYPE);
+ TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
+ bad_alloc_decl
+ = create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
+ DECL_CONTEXT (bad_alloc_decl) = current_namespace;
+ pop_namespace ();
+
+ new_eh_spec
+ = add_exception_specifier (NULL_TREE, bad_alloc_type_node, -1);
+ }
+ else
+ new_eh_spec = noexcept_false_spec;
+
+ newtype = build_exception_variant (ptr_ftype_sizetype, new_eh_spec);
deltype = build_exception_variant (void_ftype_ptr, empty_except_spec);
push_cp_library_fn (NEW_EXPR, newtype);
push_cp_library_fn (VEC_NEW_EXPR, newtype);
@@ -3853,10 +3872,10 @@ fixup_anonymous_aggr (tree t)
/* Wipe out memory of synthesized methods. */
TYPE_HAS_USER_CONSTRUCTOR (t) = 0;
TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0;
- TYPE_HAS_INIT_REF (t) = 0;
- TYPE_HAS_CONST_INIT_REF (t) = 0;
- TYPE_HAS_ASSIGN_REF (t) = 0;
- TYPE_HAS_CONST_ASSIGN_REF (t) = 0;
+ TYPE_HAS_COPY_CTOR (t) = 0;
+ TYPE_HAS_CONST_COPY_CTOR (t) = 0;
+ TYPE_HAS_COPY_ASSIGN (t) = 0;
+ TYPE_HAS_CONST_COPY_ASSIGN (t) = 0;
/* Splice the implicitly generated functions out of the TYPE_METHODS
list. */
@@ -3902,7 +3921,7 @@ fixup_anonymous_aggr (tree t)
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
error ("member %q+#D with destructor not allowed "
"in anonymous aggregate", field);
- if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
+ if (TYPE_HAS_COMPLEX_COPY_ASSIGN (type))
error ("member %q+#D with copy assignment operator "
"not allowed in anonymous aggregate", field);
}
@@ -4119,6 +4138,7 @@ start_decl (const cp_declarator *declarator,
tree context;
bool was_public;
int flags;
+ bool alias;
*pushed_scope_p = NULL_TREE;
@@ -4180,6 +4200,10 @@ start_decl (const cp_declarator *declarator,
if (toplevel_bindings_p ())
TREE_STATIC (decl) = 1;
}
+ alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl)) != 0;
+
+ if (alias && TREE_CODE (decl) == FUNCTION_DECL)
+ record_key_method_defined (decl);
/* If this is a typedef that names the class for linkage purposes
(7.1.3p8), apply any attributes directly to the type. */
@@ -4282,7 +4306,9 @@ start_decl (const cp_declarator *declarator,
DECL_EXTERNAL (decl) = 1;
}
- if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
+ if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl)
+ /* Aliases are definitions. */
+ && !alias)
permerror (input_location, "declaration of %q#D outside of class is not definition",
decl);
@@ -4437,7 +4463,7 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
}
if (TREE_CODE (init) == TREE_LIST)
- init = build_x_compound_expr_from_list (init, "initializer");
+ init = build_x_compound_expr_from_list (init, ELK_INIT);
if (TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE)
@@ -5498,6 +5524,8 @@ initialize_local_var (tree decl, tree init)
/* Compute and store the initial value. */
already_used = TREE_USED (decl) || TREE_USED (type);
+ if (TREE_USED (type))
+ DECL_READ_P (decl) = 1;
/* Generate a cleanup, if necessary. */
cleanup = cxx_maybe_build_cleanup (decl);
@@ -5542,16 +5570,15 @@ initialize_local_var (tree decl, tree init)
/* DECL is a VAR_DECL for a compiler-generated variable with static
storage duration (like a virtual table) whose initializer is a
- compile-time constant. INIT must be either a TREE_LIST of values,
- or a CONSTRUCTOR. Initialize the variable and provide it to the
+ compile-time constant. Initialize the variable and provide it to the
back end. */
void
-initialize_artificial_var (tree decl, tree init)
+initialize_artificial_var (tree decl, VEC(constructor_elt,gc) *v)
{
+ tree init;
gcc_assert (DECL_ARTIFICIAL (decl));
- if (TREE_CODE (init) == TREE_LIST)
- init = build_constructor_from_list (TREE_TYPE (decl), init);
+ init = build_constructor (TREE_TYPE (decl), v);
gcc_assert (TREE_CODE (init) == CONSTRUCTOR);
DECL_INITIAL (decl) = init;
DECL_INITIALIZED_P (decl) = 1;
@@ -5657,7 +5684,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
return;
}
if (TREE_CODE (init) == TREE_LIST)
- init = build_x_compound_expr_from_list (init, "initializer");
+ init = build_x_compound_expr_from_list (init, ELK_INIT);
if (describable_type (init))
{
type = TREE_TYPE (decl) = do_auto_deduction (type, init, auto_node);
@@ -6058,20 +6085,21 @@ declare_global_var (tree name, tree type)
static tree
get_atexit_fn_ptr_type (void)
{
- tree arg_types;
tree fn_type;
if (!atexit_fn_ptr_type_node)
{
+ tree arg_type;
if (flag_use_cxa_atexit
&& !targetm.cxx.use_atexit_for_cxa_atexit ())
/* The parameter to "__cxa_atexit" is "void (*)(void *)". */
- arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ arg_type = ptr_type_node;
else
/* The parameter to "atexit" is "void (*)(void)". */
- arg_types = void_list_node;
+ arg_type = NULL_TREE;
- fn_type = build_function_type (void_type_node, arg_types);
+ fn_type = build_function_type_list (void_type_node,
+ arg_type, NULL_TREE);
atexit_fn_ptr_type_node = build_pointer_type (fn_type);
}
@@ -6086,7 +6114,6 @@ static tree
get_atexit_node (void)
{
tree atexit_fndecl;
- tree arg_types;
tree fn_type;
tree fn_ptr_type;
const char *name;
@@ -6103,25 +6130,28 @@ get_atexit_node (void)
We build up the argument types and then then function type
itself. */
+ tree argtype0, argtype1, argtype2;
use_aeabi_atexit = targetm.cxx.use_aeabi_atexit ();
/* First, build the pointer-to-function type for the first
argument. */
fn_ptr_type = get_atexit_fn_ptr_type ();
/* Then, build the rest of the argument types. */
- arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ argtype2 = ptr_type_node;
if (use_aeabi_atexit)
{
- arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types);
- arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
+ argtype1 = fn_ptr_type;
+ argtype0 = ptr_type_node;
}
else
{
- arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
- arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types);
+ argtype1 = ptr_type_node;
+ argtype0 = fn_ptr_type;
}
/* And the final __cxa_atexit type. */
- fn_type = build_function_type (integer_type_node, arg_types);
+ fn_type = build_function_type_list (integer_type_node,
+ argtype0, argtype1, argtype2,
+ NULL_TREE);
fn_ptr_type = build_pointer_type (fn_type);
if (use_aeabi_atexit)
name = "__aeabi_atexit";
@@ -6137,9 +6167,9 @@ get_atexit_node (void)
We build up the argument types and then then function type
itself. */
fn_ptr_type = get_atexit_fn_ptr_type ();
- arg_types = tree_cons (NULL_TREE, fn_ptr_type, void_list_node);
/* Build the final atexit type. */
- fn_type = build_function_type (integer_type_node, arg_types);
+ fn_type = build_function_type_list (integer_type_node,
+ fn_ptr_type, NULL_TREE);
name = "atexit";
}
@@ -6419,11 +6449,13 @@ expand_static_init (tree decl, tree init)
abort_fn = get_identifier ("__cxa_guard_abort");
if (!get_global_value_if_present (acquire_fn, &acquire_fn))
{
- tree argtypes = tree_cons (NULL_TREE, TREE_TYPE (guard_addr),
- void_list_node);
- tree vfntype = build_function_type (void_type_node, argtypes);
+ tree vfntype = build_function_type_list (void_type_node,
+ TREE_TYPE (guard_addr),
+ NULL_TREE);
acquire_fn = push_library_fn
- (acquire_fn, build_function_type (integer_type_node, argtypes),
+ (acquire_fn, build_function_type_list (integer_type_node,
+ TREE_TYPE (guard_addr),
+ NULL_TREE),
NULL_TREE);
release_fn = push_library_fn (release_fn, vfntype, NULL_TREE);
abort_fn = push_library_fn (abort_fn, vfntype, NULL_TREE);
@@ -6573,21 +6605,54 @@ member_function_or_else (tree ctype, tree cur_type, enum overload_flags flags)
static void
bad_specifiers (tree object,
- const char* type,
+ enum bad_spec_place type,
int virtualp,
int quals,
int inlinep,
int friendp,
int raises)
{
- if (virtualp)
- error ("%qD declared as a %<virtual%> %s", object, type);
- if (inlinep)
- error ("%qD declared as an %<inline%> %s", object, type);
- if (quals)
- error ("%<const%> and %<volatile%> function specifiers on "
- "%qD invalid in %s declaration",
- object, type);
+ switch (type)
+ {
+ case BSP_VAR:
+ if (virtualp)
+ error ("%qD declared as a %<virtual%> variable", object);
+ if (inlinep)
+ error ("%qD declared as an %<inline%> variable", object);
+ if (quals)
+ error ("%<const%> and %<volatile%> function specifiers on "
+ "%qD invalid in variable declaration", object);
+ break;
+ case BSP_PARM:
+ if (virtualp)
+ error ("%qD declared as a %<virtual%> parameter", object);
+ if (inlinep)
+ error ("%qD declared as an %<inline%> parameter", object);
+ if (quals)
+ error ("%<const%> and %<volatile%> function specifiers on "
+ "%qD invalid in parameter declaration", object);
+ break;
+ case BSP_TYPE:
+ if (virtualp)
+ error ("%qD declared as a %<virtual%> type", object);
+ if (inlinep)
+ error ("%qD declared as an %<inline%> type", object);
+ if (quals)
+ error ("%<const%> and %<volatile%> function specifiers on "
+ "%qD invalid in type declaration", object);
+ break;
+ case BSP_FIELD:
+ if (virtualp)
+ error ("%qD declared as a %<virtual%> field", object);
+ if (inlinep)
+ error ("%qD declared as an %<inline%> field", object);
+ if (quals)
+ error ("%<const%> and %<volatile%> function specifiers on "
+ "%qD invalid in field declaration", object);
+ break;
+ default:
+ gcc_unreachable();
+ }
if (friendp)
error ("%q+D declared as a friend", object);
if (raises
@@ -9079,10 +9144,12 @@ grokdeclarator (const cp_declarator *declarator,
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
{
if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- {
- debug_hooks->set_name (t, decl);
- TYPE_NAME (t) = decl;
- }
+ /* We do not rename the debug info representing the
+ anonymous tagged type because the standard says in
+ [dcl.typedef] that the naming applies only for
+ linkage purposes. */
+ /*debug_hooks->set_name (t, decl);*/
+ TYPE_NAME (t) = decl;
}
if (TYPE_LANG_SPECIFIC (type))
@@ -9107,7 +9174,7 @@ grokdeclarator (const cp_declarator *declarator,
|| (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
- bad_specifiers (decl, "type", virtualp,
+ bad_specifiers (decl, BSP_TYPE, virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
@@ -9293,7 +9360,7 @@ grokdeclarator (const cp_declarator *declarator,
{
decl = cp_build_parm_decl (unqualified_id, type);
- bad_specifiers (decl, "parameter", virtualp,
+ bad_specifiers (decl, BSP_PARM, virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
}
@@ -9571,7 +9638,7 @@ grokdeclarator (const cp_declarator *declarator,
}
}
- bad_specifiers (decl, "field", virtualp,
+ bad_specifiers (decl, BSP_FIELD, virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
}
@@ -9694,7 +9761,7 @@ grokdeclarator (const cp_declarator *declarator,
initialized,
(type_quals & TYPE_QUAL_CONST) != 0,
ctype ? ctype : in_namespace);
- bad_specifiers (decl, "variable", virtualp,
+ bad_specifiers (decl, BSP_VAR, virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
@@ -10200,11 +10267,11 @@ grok_special_member_properties (tree decl)
X&, volatile X& or const volatile X&, and either there
are no other parameters or else all other parameters have
default arguments. */
- TYPE_HAS_INIT_REF (class_type) = 1;
+ TYPE_HAS_COPY_CTOR (class_type) = 1;
if (user_provided_p (decl))
- TYPE_HAS_COMPLEX_INIT_REF (class_type) = 1;
+ TYPE_HAS_COMPLEX_COPY_CTOR (class_type) = 1;
if (ctor > 1)
- TYPE_HAS_CONST_INIT_REF (class_type) = 1;
+ TYPE_HAS_CONST_COPY_CTOR (class_type) = 1;
}
else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl)))
{
@@ -10212,6 +10279,8 @@ grok_special_member_properties (tree decl)
if (user_provided_p (decl))
TYPE_HAS_COMPLEX_DFLT (class_type) = 1;
}
+ else if (move_fn_p (decl) && user_provided_p (decl))
+ TYPE_HAS_COMPLEX_MOVE_CTOR (class_type) = 1;
else if (is_list_ctor (decl))
TYPE_HAS_LIST_CTOR (class_type) = 1;
}
@@ -10227,13 +10296,16 @@ grok_special_member_properties (tree decl)
if (assop)
{
- TYPE_HAS_ASSIGN_REF (class_type) = 1;
+ TYPE_HAS_COPY_ASSIGN (class_type) = 1;
if (user_provided_p (decl))
- TYPE_HAS_COMPLEX_ASSIGN_REF (class_type) = 1;
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (class_type) = 1;
if (assop != 1)
- TYPE_HAS_CONST_ASSIGN_REF (class_type) = 1;
+ TYPE_HAS_CONST_COPY_ASSIGN (class_type) = 1;
}
+ else if (move_fn_p (decl) && user_provided_p (decl))
+ TYPE_HAS_COMPLEX_MOVE_ASSIGN (class_type) = 1;
}
+ /* Destructors are handled in check_methods. */
}
/* Check a constructor DECL has the correct form. Complains
@@ -12003,7 +12075,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
/* Initialize the language data structures. Whenever we start
a new function, we destroy temporaries in the usual way. */
- cfun->language = GGC_CNEW (struct language_function);
+ cfun->language = ggc_alloc_cleared_language_function ();
current_stmt_tree ()->stmts_are_full_exprs_p = 1;
current_binding_level = bl;
@@ -12199,7 +12271,7 @@ use_eh_spec_block (tree fn)
{
return (flag_exceptions && flag_enforce_eh_specs
&& !processing_template_decl
- && TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn))
+ && !type_throw_all_p (TREE_TYPE (fn))
/* We insert the EH_SPEC_BLOCK only in the original
function; then, it is copied automatically to the
clones. */
@@ -12304,7 +12376,7 @@ save_function_data (tree decl)
gcc_assert (!DECL_PENDING_INLINE_P (decl));
/* Make a copy. */
- f = GGC_NEW (struct language_function);
+ f = ggc_alloc_language_function ();
memcpy (f, cp_function_chain, sizeof (struct language_function));
DECL_SAVED_FUNCTION_DATA (decl) = f;
@@ -12489,6 +12561,22 @@ outer_curly_brace_block (tree fndecl)
return block;
}
+/* If FNDECL is a class's key method, add the class to the list of
+ keyed classes that should be emitted. */
+
+static void
+record_key_method_defined (tree fndecl)
+{
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
+ && DECL_VIRTUAL_P (fndecl)
+ && !processing_template_decl)
+ {
+ tree fnclass = DECL_CONTEXT (fndecl);
+ if (fndecl == CLASSTYPE_KEY_METHOD (fnclass))
+ keyed_classes = tree_cons (NULL_TREE, fnclass, keyed_classes);
+ }
+}
+
/* Finish up a function declaration and compile that function
all the way to assembler language output. The free the storage
for the function definition.
@@ -12515,14 +12603,7 @@ finish_function (int flags)
gcc_assert (!defer_mark_used_calls);
defer_mark_used_calls = true;
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
- && DECL_VIRTUAL_P (fndecl)
- && !processing_template_decl)
- {
- tree fnclass = DECL_CONTEXT (fndecl);
- if (fndecl == CLASSTYPE_KEY_METHOD (fnclass))
- keyed_classes = tree_cons (NULL_TREE, fnclass, keyed_classes);
- }
+ record_key_method_defined (fndecl);
nested = function_depth > 1;
fntype = TREE_TYPE (fndecl);
@@ -12859,7 +12940,12 @@ maybe_register_incomplete_var (tree var)
/* RTTI TD entries are created while defining the type_info. */
|| (TYPE_LANG_SPECIFIC (inner_type)
&& TYPE_BEING_DEFINED (inner_type)))
- incomplete_vars = tree_cons (inner_type, var, incomplete_vars);
+ {
+ incomplete_var *iv
+ = VEC_safe_push (incomplete_var, gc, incomplete_vars, NULL);
+ iv->decl = var;
+ iv->incomplete_type = inner_type;
+ }
}
}
@@ -12870,24 +12956,24 @@ maybe_register_incomplete_var (tree var)
void
complete_vars (tree type)
{
- tree *list = &incomplete_vars;
+ unsigned ix;
+ incomplete_var *iv;
- gcc_assert (CLASS_TYPE_P (type));
- while (*list)
+ for (ix = 0; VEC_iterate (incomplete_var, incomplete_vars, ix, iv); )
{
- if (same_type_p (type, TREE_PURPOSE (*list)))
+ if (same_type_p (type, iv->incomplete_type))
{
- tree var = TREE_VALUE (*list);
+ tree var = iv->decl;
tree type = TREE_TYPE (var);
/* Complete the type of the variable. The VAR_DECL itself
will be laid out in expand_expr. */
complete_type (type);
cp_apply_type_quals_to_decl (cp_type_quals (type), var);
/* Remove this entry from the list. */
- *list = TREE_CHAIN (*list);
+ VEC_unordered_remove (incomplete_var, incomplete_vars, ix);
}
else
- list = &TREE_CHAIN (*list);
+ ix++;
}
/* Check for pending declarations which may have abstract type. */
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 33e0e265819..ce54c79f20e 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -37,23 +37,22 @@ along with GCC; see the file COPYING3. If not see
#include "cp-tree.h"
#include "decl.h"
#include "output.h"
-#include "except.h"
#include "toplev.h"
#include "timevar.h"
#include "cpplib.h"
#include "target.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "tree-mudflap.h"
#include "cgraph.h"
#include "tree-inline.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "tree-dump.h"
#include "intl.h"
#include "gimple.h"
#include "pointer-set.h"
#include "splay-tree.h"
#include "langhooks.h"
-#include "c-ada-spec.h"
+#include "c-family/c-ada-spec.h"
extern cpp_reader *parse_in;
@@ -2725,8 +2724,8 @@ start_objects (int method_type, int initp)
fndecl = build_lang_decl (FUNCTION_DECL,
get_file_function_name (type),
- build_function_type (void_type_node,
- void_list_node));
+ build_function_type_list (void_type_node,
+ NULL_TREE));
start_preparsed_function (fndecl, /*attrs=*/NULL_TREE, SF_PRE_PARSED);
TREE_PUBLIC (current_function_decl) = 0;
@@ -2818,7 +2817,6 @@ static splay_tree priority_info_map;
static tree
start_static_storage_duration_function (unsigned count)
{
- tree parm_types;
tree type;
tree body;
char id[sizeof (SSDF_IDENTIFIER) + 1 /* '\0' */ + 32];
@@ -2827,11 +2825,9 @@ start_static_storage_duration_function (unsigned count)
SSDF_IDENTIFIER_<number>. */
sprintf (id, "%s_%u", SSDF_IDENTIFIER, count);
- /* Create the parameters. */
- parm_types = void_list_node;
- parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types);
- parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types);
- type = build_function_type (void_type_node, parm_types);
+ type = build_function_type_list (void_type_node,
+ integer_type_node, integer_type_node,
+ NULL_TREE);
/* Create the FUNCTION_DECL itself. */
ssdf_decl = build_lang_decl (FUNCTION_DECL,
@@ -3589,7 +3585,8 @@ cp_write_global_declarations (void)
at_eof = 1;
/* Bad parse errors. Just forget about it. */
- if (! global_bindings_p () || current_class_type || decl_namespace_list)
+ if (! global_bindings_p () || current_class_type
+ || !VEC_empty (tree,decl_namespace_list))
return;
if (pch_file)
@@ -4113,8 +4110,9 @@ mark_used (tree decl)
return;
}
}
- error ("deleted function %q+D", decl);
- error ("used here");
+ error ("use of deleted function %qD", decl);
+ if (!maybe_explain_implicit_delete (decl))
+ error_at (DECL_SOURCE_LOCATION (decl), "declared here");
return;
}
/* If we don't need a value, then we don't need to synthesize DECL. */
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 381163b2daf..1902a135b89 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -115,7 +115,7 @@ init_error (void)
static void
dump_scope (tree scope, int flags)
{
- int f = ~TFF_RETURN_TYPE & (flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF));
+ int f = flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF);
if (scope == NULL_TREE)
return;
@@ -865,6 +865,7 @@ dump_simple_decl (tree t, tree type, int flags)
pp_maybe_space (cxx_pp);
}
if (! (flags & TFF_UNQUALIFIED_NAME)
+ && TREE_CODE (t) != PARM_DECL
&& (!DECL_INITIAL (t)
|| TREE_CODE (DECL_INITIAL (t)) != TEMPLATE_PARM_INDEX))
dump_scope (CP_DECL_CONTEXT (t), flags);
@@ -945,7 +946,7 @@ dump_decl (tree t, int flags)
dump_scope (CP_DECL_CONTEXT (t), flags);
flags &= ~TFF_UNQUALIFIED_NAME;
if (DECL_NAME (t) == NULL_TREE)
- pp_string (cxx_pp, M_("<unnamed>"));
+ pp_cxx_ws_string (cxx_pp, M_("{anonymous}"));
else
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
}
@@ -1355,6 +1356,7 @@ static void
dump_parameters (tree parmtypes, int flags)
{
int first = 1;
+ flags &= ~TFF_SCOPE;
pp_cxx_left_paren (cxx_pp);
for (first = 1; parmtypes != void_list_node;
@@ -1388,7 +1390,15 @@ dump_parameters (tree parmtypes, int flags)
static void
dump_exception_spec (tree t, int flags)
{
- if (t)
+ if (t && TREE_PURPOSE (t))
+ {
+ pp_cxx_ws_string (cxx_pp, "noexcept");
+ pp_cxx_whitespace (cxx_pp);
+ pp_cxx_left_paren (cxx_pp);
+ dump_expr (TREE_PURPOSE (t), flags);
+ pp_cxx_right_paren (cxx_pp);
+ }
+ else if (t)
{
pp_cxx_ws_string (cxx_pp, "throw");
pp_cxx_whitespace (cxx_pp);
@@ -1749,7 +1759,9 @@ dump_expr (tree t, int flags)
if (TREE_CODE (fn) == OBJ_TYPE_REF)
fn = resolve_virtual_fun_from_obj_type_ref (fn);
- if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE)
+ if (TREE_TYPE (fn) != NULL_TREE
+ && NEXT_CODE (fn) == METHOD_TYPE
+ && call_expr_nargs (t))
{
tree ob = CALL_EXPR_ARG (t, 0);
if (TREE_CODE (ob) == ADDR_EXPR)
@@ -2116,6 +2128,14 @@ dump_expr (tree t, int flags)
pp_cxx_right_paren (cxx_pp);
break;
+ case NOEXCEPT_EXPR:
+ pp_cxx_ws_string (cxx_pp, "noexcept");
+ pp_cxx_whitespace (cxx_pp);
+ pp_cxx_left_paren (cxx_pp);
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ pp_cxx_right_paren (cxx_pp);
+ break;
+
case REALPART_EXPR:
case IMAGPART_EXPR:
pp_cxx_ws_string (cxx_pp, operator_name_info[TREE_CODE (t)].name);
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 6f7f70ad804..79bab76cc5a 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -31,7 +31,6 @@ along with GCC; see the file COPYING3. If not see
#include "cp-tree.h"
#include "flags.h"
#include "output.h"
-#include "except.h"
#include "toplev.h"
#include "tree-inline.h"
#include "tree-iterator.h"
@@ -50,7 +49,6 @@ static tree wrap_cleanups_r (tree *, int *, void *);
static int complete_ptr_ref_or_void_ptr_p (tree, tree);
static bool is_admissible_throw_operand (tree);
static int can_convert_eh (tree, tree);
-static tree cp_protect_cleanup_actions (void);
/* Sets up all the global eh stuff that needs to be initialized at the
start of compilation. */
@@ -62,25 +60,22 @@ init_exception_processing (void)
/* void std::terminate (); */
push_namespace (std_identifier);
- tmp = build_function_type (void_type_node, void_list_node);
+ tmp = build_function_type_list (void_type_node, NULL_TREE);
terminate_node = build_cp_library_fn_ptr ("terminate", tmp);
TREE_THIS_VOLATILE (terminate_node) = 1;
TREE_NOTHROW (terminate_node) = 1;
pop_namespace ();
/* void __cxa_call_unexpected(void *); */
- tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- tmp = build_function_type (void_type_node, tmp);
+ tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
call_unexpected_node
= push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp);
-
- lang_protect_cleanup_actions = &cp_protect_cleanup_actions;
}
/* Returns an expression to be executed if an unhandled exception is
propagated out of a cleanup region. */
-static tree
+tree
cp_protect_cleanup_actions (void)
{
/* [except.terminate]
@@ -160,8 +155,9 @@ build_exc_ptr (void)
static tree
declare_nothrow_library_fn (tree name, tree return_type, tree parm_type)
{
- tree tmp = tree_cons (NULL_TREE, parm_type, void_list_node);
- return push_library_fn (name, build_function_type (return_type, tmp),
+ return push_library_fn (name, build_function_type_list (return_type,
+ parm_type,
+ NULL_TREE),
empty_except_spec);
}
@@ -407,6 +403,30 @@ initialize_handler_parm (tree decl, tree exp)
LOOKUP_ONLYCONVERTING|DIRECT_BIND);
}
+
+/* Routine to see if exception handling is turned on.
+ DO_WARN is nonzero if we want to inform the user that exception
+ handling is turned off.
+
+ This is used to ensure that -fexceptions has been specified if the
+ compiler tries to use any exception-specific functions. */
+
+static inline int
+doing_eh (void)
+{
+ if (! flag_exceptions)
+ {
+ static int warned = 0;
+ if (! warned)
+ {
+ error ("exception handling disabled, use -fexceptions to enable");
+ warned = 1;
+ }
+ return 0;
+ }
+ return 1;
+}
+
/* Call this to start a catch block. DECL is the catch parameter. */
tree
@@ -415,7 +435,7 @@ expand_start_catch_block (tree decl)
tree exp;
tree type, init;
- if (! doing_eh (1))
+ if (! doing_eh ())
return NULL_TREE;
/* Make sure this declaration is reasonable. */
@@ -494,7 +514,7 @@ expand_start_catch_block (tree decl)
void
expand_end_catch_block (void)
{
- if (! doing_eh (1))
+ if (! doing_eh ())
return;
/* The exception being handled is rethrown if control reaches the end of
@@ -641,7 +661,7 @@ build_throw (tree exp)
return error_mark_node;
}
- if (! doing_eh (1))
+ if (! doing_eh ())
return error_mark_node;
if (exp && decl_is_java_type (TREE_TYPE (exp), 1))
@@ -650,8 +670,9 @@ build_throw (tree exp)
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void _Jv_Throw (void *). */
- tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- tmp = build_function_type (ptr_type_node, tmp);
+ tree tmp;
+ tmp = build_function_type_list (ptr_type_node,
+ ptr_type_node, NULL_TREE);
fn = push_throw_library_fn (fn, tmp);
}
else if (really_overloaded_fn (fn))
@@ -675,9 +696,8 @@ build_throw (tree exp)
/* The CLEANUP_TYPE is the internal type of a destructor. */
if (!cleanup_type)
{
- tmp = void_list_node;
- tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
- tmp = build_function_type (void_type_node, tmp);
+ tmp = build_function_type_list (void_type_node,
+ ptr_type_node, NULL_TREE);
cleanup_type = build_pointer_type (tmp);
}
@@ -686,11 +706,9 @@ build_throw (tree exp)
{
/* Declare void __cxa_throw (void*, void*, void (*)(void*)). */
/* ??? Second argument is supposed to be "std::type_info*". */
- tmp = void_list_node;
- tmp = tree_cons (NULL_TREE, cleanup_type, tmp);
- tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
- tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
- tmp = build_function_type (void_type_node, tmp);
+ tmp = build_function_type_list (void_type_node,
+ ptr_type_node, ptr_type_node,
+ cleanup_type, NULL_TREE);
fn = push_throw_library_fn (fn, tmp);
}
@@ -808,7 +826,7 @@ build_throw (tree exp)
{
/* Declare void __cxa_rethrow (void). */
fn = push_throw_library_fn
- (fn, build_function_type (void_type_node, void_list_node));
+ (fn, build_function_type_list (void_type_node, NULL_TREE));
}
/* ??? Indicate that this function call allows exceptions of the type
@@ -998,3 +1016,143 @@ check_handlers (tree handlers)
check_handlers_1 (handler, i);
}
}
+
+/* walk_tree helper for finish_noexcept_expr. Returns non-null if the
+ expression *TP causes the noexcept operator to evaluate to false.
+
+ 5.3.7 [expr.noexcept]: The result of the noexcept operator is false if
+ in a potentially-evaluated context the expression would contain
+ * a potentially evaluated call to a function, member function,
+ function pointer, or member function pointer that does not have a
+ non-throwing exception-specification (15.4),
+ * a potentially evaluated throw-expression (15.1),
+ * a potentially evaluated dynamic_cast expression dynamic_cast<T>(v),
+ where T is a reference type, that requires a run-time check (5.2.7), or
+ * a potentially evaluated typeid expression (5.2.8) applied to a glvalue
+ expression whose type is a polymorphic class type (10.3). */
+
+static tree
+check_noexcept_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ tree t = *tp;
+ enum tree_code code = TREE_CODE (t);
+ if (code == CALL_EXPR
+ || code == AGGR_INIT_EXPR)
+ {
+ /* We can only use the exception specification of the called function
+ for determining the value of a noexcept expression; we can't use
+ TREE_NOTHROW, as it might have a different value in another
+ translation unit, creating ODR problems.
+
+ We could use TREE_NOTHROW (t) for !TREE_PUBLIC fns, though... */
+ tree fn = (code == AGGR_INIT_EXPR
+ ? AGGR_INIT_EXPR_FN (t) : CALL_EXPR_FN (t));
+ tree type = TREE_TYPE (TREE_TYPE (fn));
+
+ STRIP_NOPS (fn);
+ if (TREE_CODE (fn) == ADDR_EXPR)
+ {
+ /* We do use TREE_NOTHROW for ABI internals like __dynamic_cast,
+ and for C library functions known not to throw. */
+ fn = TREE_OPERAND (fn, 0);
+ if (TREE_CODE (fn) == FUNCTION_DECL
+ && DECL_EXTERN_C_P (fn)
+ && (DECL_ARTIFICIAL (fn)
+ || nothrow_libfn_p (fn)))
+ return TREE_NOTHROW (fn) ? NULL_TREE : fn;
+ }
+ if (!TYPE_NOTHROW_P (type))
+ return fn;
+ }
+
+ return NULL_TREE;
+}
+
+/* Evaluate noexcept ( EXPR ). */
+
+tree
+finish_noexcept_expr (tree expr, tsubst_flags_t complain)
+{
+ tree fn;
+
+ if (processing_template_decl)
+ return build_min (NOEXCEPT_EXPR, boolean_type_node, expr);
+
+ fn = cp_walk_tree_without_duplicates (&expr, check_noexcept_r, 0);
+ if (fn)
+ {
+ if ((complain & tf_warning) && TREE_CODE (fn) == FUNCTION_DECL
+ && TREE_NOTHROW (fn) && !DECL_ARTIFICIAL (fn))
+ {
+ warning (OPT_Wnoexcept, "noexcept-expression evaluates to %<false%> "
+ "because of a call to %qD", fn);
+ warning (OPT_Wnoexcept, "but %q+D does not throw; perhaps "
+ "it should be declared %<noexcept%>", fn);
+ }
+ return boolean_false_node;
+ }
+ else
+ return boolean_true_node;
+}
+
+/* Return true iff SPEC is throw() or noexcept(true). */
+
+bool
+nothrow_spec_p (const_tree spec)
+{
+ if (spec == NULL_TREE
+ || TREE_VALUE (spec) != NULL_TREE
+ || spec == noexcept_false_spec)
+ return false;
+ if (TREE_PURPOSE (spec) == NULL_TREE
+ || spec == noexcept_true_spec)
+ return true;
+ gcc_assert (processing_template_decl
+ || TREE_PURPOSE (spec) == error_mark_node);
+ return false;
+}
+
+/* For FUNCTION_TYPE or METHOD_TYPE, true if NODE is noexcept. This is the
+ case for things declared noexcept(true) and, with -fnothrow-opt, for
+ throw() functions. */
+
+bool
+type_noexcept_p (const_tree type)
+{
+ tree spec = TYPE_RAISES_EXCEPTIONS (type);
+ if (flag_nothrow_opt)
+ return nothrow_spec_p (spec);
+ else
+ return spec == noexcept_true_spec;
+}
+
+/* For FUNCTION_TYPE or METHOD_TYPE, true if NODE can throw any type,
+ i.e. no exception-specification or noexcept(false). */
+
+bool
+type_throw_all_p (const_tree type)
+{
+ tree spec = TYPE_RAISES_EXCEPTIONS (type);
+ return spec == NULL_TREE || spec == noexcept_false_spec;
+}
+
+/* Create a representation of the noexcept-specification with
+ constant-expression of EXPR. COMPLAIN is as for tsubst. */
+
+tree
+build_noexcept_spec (tree expr, int complain)
+{
+ expr = perform_implicit_conversion_flags (boolean_type_node, expr,
+ complain,
+ LOOKUP_NORMAL);
+ if (expr == boolean_true_node)
+ return noexcept_true_spec;
+ else if (expr == boolean_false_node)
+ return noexcept_false_spec;
+ else
+ {
+ gcc_assert (processing_template_decl || expr == error_mark_node);
+ return build_tree_list (expr, NULL_TREE);
+ }
+}
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index ef5d6be3c5b..681834d9a37 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -1,7 +1,7 @@
/* Convert language-specific tree expression to rtl instructions,
for GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004, 2007, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "cp-tree.h"
#include "toplev.h"
-#include "except.h"
#include "tm_p.h"
/* Expand C++-specific constants. Currently, this means PTRMEM_CST. */
@@ -132,6 +131,7 @@ mark_exp_read (tree exp)
case IMAGPART_EXPR:
CASE_CONVERT:
case ADDR_EXPR:
+ case INDIRECT_REF:
mark_exp_read (TREE_OPERAND (exp, 0));
break;
case COMPOUND_EXPR:
diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
index f33affc5e85..2b8081d9141 100644
--- a/gcc/cp/g++spec.c
+++ b/gcc/cp/g++spec.c
@@ -258,7 +258,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
}
if (quote)
- fatal_error ("argument to '%s' missing\n", quote);
+ fatal_error ("argument to %qs missing", quote);
/* There's no point adding -shared-libgcc if we don't have a shared
libgcc. */
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 1f3e8035382..85ad582f2d1 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -30,7 +30,6 @@ along with GCC; see the file COPYING3. If not see
#include "cp-tree.h"
#include "flags.h"
#include "output.h"
-#include "except.h"
#include "toplev.h"
#include "target.h"
@@ -526,7 +525,7 @@ perform_member_init (tree member, tree init)
else if (TREE_CODE (init) == TREE_LIST)
/* There was an explicit member initialization. Do some work
in that case. */
- init = build_x_compound_expr_from_list (init, "member initializer");
+ init = build_x_compound_expr_from_list (init, ELK_MEM_INIT);
if (init)
finish_expr_stmt (cp_build_modify_expr (decl, INIT_EXPR, init,
@@ -1509,8 +1508,17 @@ build_offset_ref (tree type, tree member, bool address_p)
return member;
if (dependent_type_p (type) || type_dependent_expression_p (member))
- return build_qualified_name (NULL_TREE, type, member,
- /*template_p=*/false);
+ {
+ tree ref, mem_type = NULL_TREE;
+ if (!dependent_scope_p (type))
+ mem_type = TREE_TYPE (member);
+ ref = build_qualified_name (mem_type, type, member,
+ /*template_p=*/false);
+ /* Undo convert_from_reference. */
+ if (TREE_CODE (ref) == INDIRECT_REF)
+ ref = TREE_OPERAND (ref, 0);
+ return ref;
+ }
gcc_assert (TYPE_P (type));
if (! is_class_type (type, 1))
@@ -1520,8 +1528,7 @@ build_offset_ref (tree type, tree member, bool address_p)
/* Callers should call mark_used before this point. */
gcc_assert (!DECL_P (member) || TREE_USED (member));
- if (!COMPLETE_TYPE_P (complete_type (type))
- && !TYPE_BEING_DEFINED (type))
+ if (!COMPLETE_OR_OPEN_TYPE_P (complete_type (type)))
{
error ("incomplete type %qT does not have member %qD", type, member);
return error_mark_node;
@@ -2827,7 +2834,7 @@ build_vec_init (tree base, tree maxindex, tree init,
&& TREE_CODE (atype) == ARRAY_TYPE
&& (from_array == 2
? (!CLASS_TYPE_P (inner_elt_type)
- || !TYPE_HAS_COMPLEX_ASSIGN_REF (inner_elt_type))
+ || !TYPE_HAS_COMPLEX_COPY_ASSIGN (inner_elt_type))
: !TYPE_NEEDS_CONSTRUCTING (type))
&& ((TREE_CODE (init) == CONSTRUCTOR
/* Don't do this if the CONSTRUCTOR might contain something
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index 8aa3adf61a7..24213587f76 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -1,6 +1,6 @@
/* Definitions for specs for C++.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2007, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see
%(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\
cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\
%{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2 %{+e1*}\
+ %(cc1_options) %2\
%{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
%W{o*:--output-pch=%*}}%V}}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
@@ -58,11 +58,11 @@ along with GCC; see the file COPYING3. If not see
%(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\
cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\
%{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2 %{+e1*}\
+ %(cc1_options) %2\
%{!fsyntax-only:%(invoke_as)}}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{".ii", "@c++-cpp-output", 0, 0, 0},
{"@c++-cpp-output",
"%{!M:%{!MM:%{!E:\
- cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
+ cc1plus -fpreprocessed %i %(cc1_options) %2\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 041e391f543..9e3b57b75ef 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "cp-tree.h"
#include "cpplib.h"
#include "flags.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "toplev.h"
#include "output.h"
#include "tm_p.h"
@@ -184,7 +184,7 @@ init_reswords (void)
/* The Objective-C keywords are all context-dependent. */
mask |= D_OBJC;
- ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
+ ridpointers = ggc_alloc_cleared_vec_tree ((int) RID_MAX);
for (i = 0; i < num_c_common_reswords; i++)
{
if (c_common_reswords[i].disable & D_CONLY)
@@ -540,7 +540,7 @@ retrofit_lang_decl (tree t)
else
gcc_unreachable ();
- ld = GGC_CNEWVAR (struct lang_decl, size);
+ ld = ggc_alloc_cleared_lang_decl (size);
ld->u.base.selector = sel;
@@ -581,7 +581,7 @@ cxx_dup_lang_specific_decl (tree node)
else
gcc_unreachable ();
- ld = GGC_NEWVAR (struct lang_decl, size);
+ ld = ggc_alloc_lang_decl (size);
memcpy (ld, DECL_LANG_SPECIFIC (node), size);
DECL_LANG_SPECIFIC (node) = ld;
@@ -618,7 +618,7 @@ copy_lang_type (tree node)
size = sizeof (struct lang_type);
else
size = sizeof (struct lang_type_ptrmem);
- lt = GGC_NEWVAR (struct lang_type, size);
+ lt = ggc_alloc_lang_type (size);
memcpy (lt, TYPE_LANG_SPECIFIC (node), size);
TYPE_LANG_SPECIFIC (node) = lt;
@@ -649,7 +649,8 @@ cxx_make_type (enum tree_code code)
if (RECORD_OR_UNION_CODE_P (code)
|| code == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- struct lang_type *pi = GGC_CNEW (struct lang_type);
+ struct lang_type *pi
+ = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
TYPE_LANG_SPECIFIC (t) = pi;
pi->u.c.h.is_lang_type_class = 1;
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 124a83ced3d..ad41e9acc57 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -57,9 +57,8 @@ enum mangling_flags
typedef enum mangling_flags mangling_flags;
-static void do_build_assign_ref (tree);
+static void do_build_copy_assign (tree);
static void do_build_copy_constructor (tree);
-static tree synthesize_exception_spec (tree, tree (*) (tree, void *), void *);
static tree make_alias_for_thunk (tree);
/* Called once to initialize method.c. */
@@ -400,6 +399,74 @@ use_thunk (tree thunk_fndecl, bool emit_p)
/* Code for synthesizing methods which have default semantics defined. */
+/* True iff CTYPE has a trivial SFK. */
+
+static bool
+type_has_trivial_fn (tree ctype, special_function_kind sfk)
+{
+ switch (sfk)
+ {
+ case sfk_constructor:
+ return !TYPE_HAS_COMPLEX_DFLT (ctype);
+ case sfk_copy_constructor:
+ return !TYPE_HAS_COMPLEX_COPY_CTOR (ctype);
+ case sfk_move_constructor:
+ return !TYPE_HAS_COMPLEX_MOVE_CTOR (ctype);
+ case sfk_copy_assignment:
+ return !TYPE_HAS_COMPLEX_COPY_ASSIGN (ctype);
+ case sfk_move_assignment:
+ return !TYPE_HAS_COMPLEX_MOVE_ASSIGN (ctype);
+ case sfk_destructor:
+ return !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype);
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Note that CTYPE has a non-trivial SFK even though we previously thought
+ it was trivial. */
+
+static void
+type_set_nontrivial_flag (tree ctype, special_function_kind sfk)
+{
+ switch (sfk)
+ {
+ case sfk_constructor:
+ TYPE_HAS_COMPLEX_DFLT (ctype) = true;
+ return;
+ case sfk_copy_constructor:
+ TYPE_HAS_COMPLEX_COPY_CTOR (ctype) = true;
+ return;
+ case sfk_move_constructor:
+ TYPE_HAS_COMPLEX_MOVE_CTOR (ctype) = true;
+ return;
+ case sfk_copy_assignment:
+ TYPE_HAS_COMPLEX_COPY_ASSIGN (ctype) = true;
+ return;
+ case sfk_move_assignment:
+ TYPE_HAS_COMPLEX_MOVE_ASSIGN (ctype) = true;
+ return;
+ case sfk_destructor:
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype) = true;
+ return;
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* True iff FN is a trivial defaulted member function ([cd]tor, op=). */
+
+bool
+trivial_fn_p (tree fn)
+{
+ if (!DECL_DEFAULTED_FN (fn))
+ return false;
+
+ /* If fn is a clone, get the primary variant. */
+ fn = DECL_ORIGIN (fn);
+ return type_has_trivial_fn (DECL_CONTEXT (fn), special_function_p (fn));
+}
+
/* Generate code for default X(X&) or X(X&&) constructor. */
static void
@@ -407,14 +474,15 @@ do_build_copy_constructor (tree fndecl)
{
tree parm = FUNCTION_FIRST_USER_PARM (fndecl);
bool move_p = DECL_MOVE_CONSTRUCTOR_P (fndecl);
+ bool trivial = trivial_fn_p (fndecl);
parm = convert_from_reference (parm);
- if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)
+ if (trivial
&& is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
- else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
+ else if (trivial)
{
tree t = build2 (INIT_EXPR, void_type_node, current_class_ref, parm);
finish_expr_stmt (t);
@@ -508,19 +576,21 @@ do_build_copy_constructor (tree fndecl)
}
static void
-do_build_assign_ref (tree fndecl)
+do_build_copy_assign (tree fndecl)
{
tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
tree compound_stmt;
+ bool move_p = move_fn_p (fndecl);
+ bool trivial = trivial_fn_p (fndecl);
compound_stmt = begin_compound_stmt (0);
parm = convert_from_reference (parm);
- if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
+ if (trivial
&& is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
- else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
+ else if (trivial)
{
tree t = build2 (MODIFY_EXPR, void_type_node, current_class_ref, parm);
finish_expr_stmt (t);
@@ -542,6 +612,8 @@ do_build_assign_ref (tree fndecl)
/* We must convert PARM directly to the base class
explicitly since the base class may be ambiguous. */
converted_parm = build_base_path (PLUS_EXPR, parm, base_binfo, 1);
+ if (move_p)
+ converted_parm = move (converted_parm);
/* Call the base class assignment operator. */
parmvec = make_tree_vector_single (converted_parm);
finish_expr_stmt
@@ -604,6 +676,8 @@ do_build_assign_ref (tree fndecl)
expr_type = cp_build_qualified_type (expr_type, quals);
init = build3 (COMPONENT_REF, expr_type, init, field, NULL_TREE);
+ if (move_p && TREE_CODE (expr_type) != REFERENCE_TYPE)
+ init = move (init);
if (DECL_NAME (field))
init = cp_build_modify_expr (comp, NOP_EXPR, init,
@@ -657,7 +731,7 @@ synthesize_method (tree fndecl)
if (DECL_OVERLOADED_OPERATOR_P (fndecl) == NOP_EXPR)
{
- do_build_assign_ref (fndecl);
+ do_build_copy_assign (fndecl);
need_body = false;
}
else if (DECL_CONSTRUCTOR_P (fndecl))
@@ -695,163 +769,505 @@ synthesize_method (tree fndecl)
fndecl);
}
-/* Use EXTRACTOR to locate the relevant function called for each base &
- class field of TYPE. CLIENT allows additional information to be passed
- to EXTRACTOR. Generates the union of all exceptions generated by those
- functions. Note that we haven't updated TYPE_FIELDS and such of any
- variants yet, so we need to look at the main one. */
+/* Build a reference to type TYPE with cv-quals QUALS, which is an
+ rvalue if RVALUE is true. */
static tree
-synthesize_exception_spec (tree type, tree (*extractor) (tree, void*),
- void *client)
+build_stub_type (tree type, int quals, bool rvalue)
{
- tree raises = empty_except_spec;
- tree fields = TYPE_FIELDS (type);
- tree binfo, base_binfo;
- int i;
+ tree argtype = cp_build_qualified_type (type, quals);
+ return cp_build_reference_type (argtype, rvalue);
+}
- for (binfo = TYPE_BINFO (type), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- {
- tree fn = (*extractor) (BINFO_TYPE (base_binfo), client);
- if (fn)
- {
- tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
+/* Build a dummy glvalue from dereferencing a dummy reference of type
+ REFTYPE. */
- raises = merge_exception_specifiers (raises, fn_raises);
- }
- }
- for (; fields; fields = TREE_CHAIN (fields))
- {
- tree type = TREE_TYPE (fields);
- tree fn;
+static tree
+build_stub_object (tree reftype)
+{
+ tree stub = build1 (NOP_EXPR, reftype, integer_one_node);
+ return convert_from_reference (stub);
+}
- if (TREE_CODE (fields) != FIELD_DECL || DECL_ARTIFICIAL (fields))
- continue;
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
- if (!CLASS_TYPE_P (type))
- continue;
+/* Determine which function will be called when looking up NAME in TYPE,
+ called with a single ARGTYPE argument, or no argument if ARGTYPE is
+ null. FLAGS and COMPLAIN are as for build_new_method_call.
- fn = (*extractor) (type, client);
- if (fn)
- {
- tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
+ Returns a FUNCTION_DECL if all is well.
+ Returns NULL_TREE if overload resolution failed.
+ Returns error_mark_node if the chosen function cannot be called. */
- raises = merge_exception_specifiers (raises, fn_raises);
- }
+static tree
+locate_fn_flags (tree type, tree name, tree argtype, int flags,
+ tsubst_flags_t complain)
+{
+ tree ob, fn, fns, binfo, rval;
+ VEC(tree,gc) *args;
+
+ if (TYPE_P (type))
+ binfo = TYPE_BINFO (type);
+ else
+ {
+ binfo = type;
+ type = BINFO_TYPE (binfo);
+ }
+
+ ob = build_stub_object (cp_build_reference_type (type, false));
+ args = make_tree_vector ();
+ if (argtype)
+ {
+ tree arg = build_stub_object (argtype);
+ VEC_quick_push (tree, args, arg);
}
- return raises;
+
+ fns = lookup_fnfields (binfo, name, 0);
+ rval = build_new_method_call (ob, fns, &args, binfo, flags, &fn, complain);
+
+ release_tree_vector (args);
+ if (fn && rval == error_mark_node)
+ return rval;
+ else
+ return fn;
}
/* Locate the dtor of TYPE. */
tree
-locate_dtor (tree type, void *client ATTRIBUTE_UNUSED)
+get_dtor (tree type)
{
- return CLASSTYPE_DESTRUCTORS (type);
+ tree fn = locate_fn_flags (type, complete_dtor_identifier, NULL_TREE,
+ LOOKUP_NORMAL, tf_warning_or_error);
+ if (fn == error_mark_node)
+ return NULL_TREE;
+ return fn;
}
/* Locate the default ctor of TYPE. */
tree
-locate_ctor (tree type, void *client ATTRIBUTE_UNUSED)
+locate_ctor (tree type)
{
- tree fns;
+ tree fn = locate_fn_flags (type, complete_ctor_identifier, NULL_TREE,
+ LOOKUP_SPECULATIVE, tf_none);
+ if (fn == error_mark_node)
+ return NULL_TREE;
+ return fn;
+}
- if (!TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
+/* Likewise, but give any appropriate errors. */
+
+tree
+get_default_ctor (tree type)
+{
+ tree fn = locate_fn_flags (type, complete_ctor_identifier, NULL_TREE,
+ LOOKUP_NORMAL, tf_warning_or_error);
+ if (fn == error_mark_node)
return NULL_TREE;
+ return fn;
+}
+
+/* Locate the copy ctor of TYPE. */
+
+tree
+get_copy_ctor (tree type)
+{
+ int quals = (TYPE_HAS_CONST_COPY_CTOR (type)
+ ? TYPE_QUAL_CONST : TYPE_UNQUALIFIED);
+ tree argtype = build_stub_type (type, quals, false);
+ tree fn = locate_fn_flags (type, complete_ctor_identifier, argtype,
+ LOOKUP_NORMAL, tf_warning_or_error);
+ if (fn == error_mark_node)
+ return NULL_TREE;
+ return fn;
+}
- /* Call lookup_fnfields_1 to create the constructor declarations, if
- necessary. */
- if (CLASSTYPE_LAZY_DEFAULT_CTOR (type))
- return lazily_declare_fn (sfk_constructor, type);
+/* Locate the copy assignment operator of TYPE. */
- for (fns = CLASSTYPE_CONSTRUCTORS (type); fns; fns = OVL_NEXT (fns))
+tree
+get_copy_assign (tree type)
+{
+ int quals = (TYPE_HAS_CONST_COPY_ASSIGN (type)
+ ? TYPE_QUAL_CONST : TYPE_UNQUALIFIED);
+ tree argtype = build_stub_type (type, quals, false);
+ tree fn = locate_fn_flags (type, ansi_assopname (NOP_EXPR), argtype,
+ LOOKUP_NORMAL, tf_warning_or_error);
+ if (fn == error_mark_node)
+ return NULL_TREE;
+ return fn;
+}
+
+/* Subroutine of synthesized_method_walk. Update SPEC_P, TRIVIAL_P and
+ DELETED_P or give an error message MSG with argument ARG. */
+
+static void
+process_subob_fn (tree fn, bool move_p, tree *spec_p, bool *trivial_p,
+ bool *deleted_p, const char *msg, tree arg)
+{
+ if (!fn || fn == error_mark_node)
+ goto bad;
+
+ if (spec_p)
{
- tree fn = OVL_CURRENT (fns);
- tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ tree raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
+ *spec_p = merge_exception_specifiers (*spec_p, raises);
+ }
- parms = skip_artificial_parms_for (fn, parms);
+ if (trivial_p && !trivial_fn_p (fn))
+ *trivial_p = false;
- if (sufficient_parms_p (parms))
- return fn;
+ if (move_p && !move_fn_p (fn) && !trivial_fn_p (fn))
+ {
+ if (msg)
+ error (msg, arg);
+ goto bad;
}
- gcc_unreachable ();
+
+ return;
+
+ bad:
+ if (deleted_p)
+ *deleted_p = true;
}
-struct copy_data
+/* The caller wants to generate an implicit declaration of SFK for CTYPE
+ which is const if relevant and CONST_P is set. If spec_p, trivial_p and
+ deleted_p are non-null, set their referent appropriately. If diag is
+ true, we're being called from maybe_explain_implicit_delete to give
+ errors. */
+
+static void
+synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
+ tree *spec_p, bool *trivial_p, bool *deleted_p,
+ bool diag)
{
- tree name;
- int quals;
-};
+ tree binfo, base_binfo, field, scope, fnname, rval, argtype;
+ bool move_p, copy_arg_p, assign_p, expected_trivial, check_vdtor;
+ VEC(tree,gc) *vbases;
+ int i, quals, flags;
+ tsubst_flags_t complain;
+ const char *msg;
+
+ if (spec_p)
+ *spec_p = (cxx_dialect >= cxx0x
+ ? noexcept_true_spec : empty_except_spec);
+
+ if (deleted_p)
+ {
+ /* "The closure type associated with a lambda-expression has a deleted
+ default constructor and a deleted copy assignment operator."
+ This is diagnosed in maybe_explain_implicit_delete. */
+ if (LAMBDA_TYPE_P (ctype)
+ && (sfk == sfk_constructor
+ || sfk == sfk_copy_assignment))
+ {
+ *deleted_p = true;
+ return;
+ }
-/* Locate the copy ctor or copy assignment of TYPE. CLIENT_
- points to a COPY_DATA holding the name (NULL for the ctor)
- and desired qualifiers of the source operand. */
+ *deleted_p = false;
+ }
-tree
-locate_copy (tree type, void *client_)
-{
- struct copy_data *client = (struct copy_data *)client_;
- tree fns;
- tree best = NULL_TREE;
- bool excess_p = false;
+ move_p = false;
+ switch (sfk)
+ {
+ case sfk_constructor:
+ case sfk_destructor:
+ copy_arg_p = false;
+ break;
- if (client->name)
+ case sfk_move_constructor:
+ case sfk_move_assignment:
+ move_p = true;
+ case sfk_copy_constructor:
+ case sfk_copy_assignment:
+ copy_arg_p = true;
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ expected_trivial = type_has_trivial_fn (ctype, sfk);
+ if (trivial_p)
+ *trivial_p = expected_trivial;
+
+#ifndef ENABLE_CHECKING
+ /* The TYPE_HAS_COMPLEX_* flags tell us about constraints from base
+ class versions and other properties of the type. But a subobject
+ class can be trivially copyable and yet have overload resolution
+ choose a template constructor for initialization, depending on
+ rvalueness and cv-quals. So we can't exit early for copy/move
+ methods in C++0x. */
+ if (expected_trivial
+ && (!copy_arg_p || cxx_dialect < cxx0x))
+ return;
+#endif
+
+ assign_p = false;
+ switch (sfk)
{
- int ix;
- ix = lookup_fnfields_1 (type, client->name);
- if (ix < 0)
- return NULL_TREE;
- fns = VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
+ case sfk_move_assignment:
+ case sfk_copy_assignment:
+ assign_p = true;
+ fnname = ansi_assopname (NOP_EXPR);
+ break;
+
+ case sfk_destructor:
+ check_vdtor = true;
+ /* The synthesized method will call base dtors, but check complete
+ here to avoid having to deal with VTT. */
+ fnname = complete_dtor_identifier;
+ break;
+
+ case sfk_constructor:
+ case sfk_move_constructor:
+ case sfk_copy_constructor:
+ fnname = complete_ctor_identifier;
+ break;
+
+ default:
+ gcc_unreachable ();
}
- else if (TYPE_HAS_INIT_REF (type))
+
+ ++cp_unevaluated_operand;
+ ++c_inhibit_evaluation_warnings;
+
+ scope = push_scope (ctype);
+
+ if (diag)
{
- /* If construction of the copy constructor was postponed, create
- it now. */
- if (CLASSTYPE_LAZY_COPY_CTOR (type))
- lazily_declare_fn (sfk_copy_constructor, type);
- if (CLASSTYPE_LAZY_MOVE_CTOR (type))
- lazily_declare_fn (sfk_move_constructor, type);
- fns = CLASSTYPE_CONSTRUCTORS (type);
+ flags = LOOKUP_NORMAL|LOOKUP_SPECULATIVE;
+ complain = tf_warning_or_error;
}
else
- return NULL_TREE;
- for (; fns; fns = OVL_NEXT (fns))
{
- tree fn = OVL_CURRENT (fns);
- tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
- tree src_type;
- int excess;
- int quals;
-
- parms = skip_artificial_parms_for (fn, parms);
- if (!parms)
- continue;
- src_type = non_reference (TREE_VALUE (parms));
+ flags = LOOKUP_PROTECT|LOOKUP_SPECULATIVE;
+ complain = tf_none;
+ }
- if (src_type == error_mark_node)
- return NULL_TREE;
+ if (const_p)
+ quals = TYPE_QUAL_CONST;
+ else
+ quals = TYPE_UNQUALIFIED;
+ argtype = NULL_TREE;
- if (!same_type_ignoring_top_level_qualifiers_p (src_type, type))
- continue;
- if (!sufficient_parms_p (TREE_CHAIN (parms)))
+ for (binfo = TYPE_BINFO (ctype), i = 0;
+ BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
+ {
+ tree basetype = BINFO_TYPE (base_binfo);
+ if (copy_arg_p)
+ argtype = build_stub_type (basetype, quals, move_p);
+ rval = locate_fn_flags (base_binfo, fnname, argtype, flags, complain);
+
+ if (!diag)
+ msg = NULL;
+ else if (assign_p)
+ msg = ("base %qT does not have a move assignment operator or trivial "
+ "copy assignment operator");
+ else
+ msg = ("base %qT does not have a move constructor or trivial "
+ "copy constructor");
+
+ process_subob_fn (rval, move_p, spec_p, trivial_p, deleted_p,
+ msg, BINFO_TYPE (base_binfo));
+
+ if (check_vdtor && type_has_virtual_destructor (basetype))
+ {
+ rval = locate_fn_flags (ctype, ansi_opname (DELETE_EXPR),
+ ptr_type_node, flags, complain);
+ /* Unlike for base ctor/op=/dtor, for operator delete it's fine
+ to have a null rval (no class-specific op delete). */
+ if (rval && rval == error_mark_node && deleted_p)
+ *deleted_p = true;
+ }
+ }
+
+ vbases = CLASSTYPE_VBASECLASSES (ctype);
+ if (vbases && assign_p && move_p)
+ {
+ /* Should the spec be changed to allow vbases that only occur once? */
+ if (diag)
+ error ("%qT has virtual bases, default move assignment operator "
+ "cannot be generated", ctype);
+ else if (deleted_p)
+ *deleted_p = true;
+ }
+ else if (!assign_p)
+ for (i = 0; VEC_iterate (tree, vbases, i, base_binfo); ++i)
+ {
+ if (copy_arg_p)
+ argtype = build_stub_type (BINFO_TYPE (base_binfo), quals, move_p);
+ rval = locate_fn_flags (base_binfo, fnname, argtype, flags, complain);
+
+ if (!diag)
+ msg = NULL;
+ else if (assign_p)
+ msg = ("virtual base %qT does not have a move assignment "
+ "operator or trivial copy assignment operator");
+ else
+ msg = ("virtual base %qT does not have a move constructor "
+ "or trivial copy constructor");
+
+ process_subob_fn (rval, move_p, spec_p, trivial_p, deleted_p,
+ msg, BINFO_TYPE (base_binfo));
+ }
+
+ for (field = TYPE_FIELDS (ctype); field; field = TREE_CHAIN (field))
+ {
+ tree mem_type;
+
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_ARTIFICIAL (field))
continue;
- quals = cp_type_quals (src_type);
- if (client->quals & ~quals)
+
+ mem_type = strip_array_types (TREE_TYPE (field));
+ if (assign_p)
+ {
+ bool bad = true;
+ if (CP_TYPE_CONST_P (mem_type) && !CLASS_TYPE_P (mem_type))
+ {
+ if (diag)
+ error ("non-static const member %q#D, can't use default "
+ "assignment operator", field);
+ }
+ else if (TREE_CODE (mem_type) == REFERENCE_TYPE)
+ {
+ if (diag)
+ error ("non-static reference member %q#D, can't use "
+ "default assignment operator", field);
+ }
+ else
+ bad = false;
+
+ if (bad && deleted_p)
+ *deleted_p = true;
+ }
+ else if (sfk == sfk_constructor)
+ {
+ bool bad = true;
+ if (CP_TYPE_CONST_P (mem_type)
+ && (!CLASS_TYPE_P (mem_type)
+ || !type_has_user_provided_default_constructor (mem_type)))
+ {
+ if (diag)
+ error ("uninitialized non-static const member %q#D",
+ field);
+ }
+ else if (TREE_CODE (mem_type) == REFERENCE_TYPE)
+ {
+ if (diag)
+ error ("uninitialized non-static reference member %q#D",
+ field);
+ }
+ else
+ bad = false;
+
+ if (bad && deleted_p)
+ *deleted_p = true;
+ }
+
+ if (!CLASS_TYPE_P (mem_type)
+ || ANON_AGGR_TYPE_P (mem_type))
continue;
- excess = quals & ~client->quals;
- if (!best || (excess_p && !excess))
+
+ if (copy_arg_p)
{
- best = fn;
- excess_p = excess;
+ int mem_quals = cp_type_quals (mem_type) | quals;
+ if (DECL_MUTABLE_P (field))
+ mem_quals &= ~TYPE_QUAL_CONST;
+ argtype = build_stub_type (mem_type, mem_quals, move_p);
}
+
+ rval = locate_fn_flags (mem_type, fnname, argtype, flags, complain);
+
+ if (!diag)
+ msg = NULL;
+ else if (assign_p)
+ msg = ("non-static data member %qD does not have a move "
+ "assignment operator or trivial copy assignment operator");
else
- /* Ambiguous */
- return NULL_TREE;
+ msg = ("non-static data member %qD does not have a move "
+ "constructor or trivial copy constructor");
+
+ process_subob_fn (rval, move_p, spec_p, trivial_p, deleted_p,
+ msg, field);
}
- return best;
+
+ pop_scope (scope);
+
+ --cp_unevaluated_operand;
+ --c_inhibit_evaluation_warnings;
+
+#ifdef ENABLE_CHECKING
+ /* If we expected this to be trivial but it isn't, then either we're in
+ C++0x mode and this is a copy/move ctor/op= or there's an error. */
+ gcc_assert (!(trivial_p && expected_trivial && !*trivial_p)
+ || (copy_arg_p && cxx_dialect >= cxx0x)
+ || errorcount);
+#endif
+}
+
+/* DECL is a deleted function. If it's implicitly deleted, explain why and
+ return true; else return false. */
+
+bool
+maybe_explain_implicit_delete (tree decl)
+{
+ /* If decl is a clone, get the primary variant. */
+ decl = DECL_ORIGIN (decl);
+ gcc_assert (DECL_DELETED_FN (decl));
+ if (DECL_DEFAULTED_FN (decl)
+ && DECL_INITIAL (decl) == NULL_TREE)
+ {
+ /* Not marked GTY; it doesn't need to be GC'd or written to PCH. */
+ static htab_t explained_htab;
+ void **slot;
+
+ special_function_kind sfk;
+ location_t loc;
+ bool informed;
+ tree ctype;
+
+ if (!explained_htab)
+ explained_htab = htab_create (37, htab_hash_pointer,
+ htab_eq_pointer, NULL);
+ slot = htab_find_slot (explained_htab, decl, INSERT);
+ if (*slot)
+ return true;
+ *slot = decl;
+
+ sfk = special_function_p (decl);
+ ctype = DECL_CONTEXT (decl);
+ loc = input_location;
+ input_location = DECL_SOURCE_LOCATION (decl);
+
+ informed = false;
+ if (LAMBDA_TYPE_P (ctype))
+ {
+ informed = true;
+ if (sfk == sfk_constructor)
+ error ("a lambda closure type has a deleted default constructor");
+ else if (sfk == sfk_copy_assignment)
+ error ("a lambda closure type has a deleted copy assignment operator");
+ else
+ informed = false;
+ }
+ if (!informed)
+ {
+ tree parm_type = TREE_VALUE (FUNCTION_FIRST_USER_PARMTYPE (decl));
+ bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
+ tree scope = push_scope (ctype);
+ error ("%qD is implicitly deleted because the default "
+ "definition would be ill-formed:", decl);
+ pop_scope (scope);
+ synthesized_method_walk (ctype, sfk, const_p,
+ NULL, NULL, NULL, true);
+ }
+
+ input_location = loc;
+ return true;
+ }
+ return false;
}
/* Implicitly declare the special function indicated by KIND, as a
@@ -872,6 +1288,8 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
tree this_parm;
tree name;
HOST_WIDE_INT saved_processing_template_decl;
+ bool deleted_p;
+ bool trivial_p;
/* Because we create declarations for implicitly declared functions
lazily, we may be creating the declaration for a member of TYPE
@@ -903,50 +1321,49 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
case sfk_destructor:
/* Destructor. */
name = constructor_name (type);
- raises = synthesize_exception_spec (type, &locate_dtor, 0);
break;
case sfk_constructor:
/* Default constructor. */
name = constructor_name (type);
- raises = synthesize_exception_spec (type, &locate_ctor, 0);
break;
case sfk_copy_constructor:
- case sfk_assignment_operator:
+ case sfk_copy_assignment:
case sfk_move_constructor:
+ case sfk_move_assignment:
{
- struct copy_data data;
-
- data.name = NULL;
- data.quals = 0;
- if (kind == sfk_assignment_operator)
+ bool move_p;
+ if (kind == sfk_copy_assignment
+ || kind == sfk_move_assignment)
{
return_type = build_reference_type (type);
name = ansi_assopname (NOP_EXPR);
- data.name = name;
}
else
name = constructor_name (type);
if (const_p)
- {
- data.quals = TYPE_QUAL_CONST;
- rhs_parm_type = cp_build_qualified_type (type, TYPE_QUAL_CONST);
- }
+ rhs_parm_type = cp_build_qualified_type (type, TYPE_QUAL_CONST);
else
rhs_parm_type = type;
- rhs_parm_type
- = cp_build_reference_type (rhs_parm_type,
- kind == sfk_move_constructor);
+ move_p = (kind == sfk_move_assignment
+ || kind == sfk_move_constructor);
+ rhs_parm_type = cp_build_reference_type (rhs_parm_type, move_p);
+
parameter_types = tree_cons (NULL_TREE, rhs_parm_type, parameter_types);
- raises = synthesize_exception_spec (type, &locate_copy, &data);
break;
}
default:
gcc_unreachable ();
}
+ synthesized_method_walk (type, kind, const_p, &raises, &trivial_p,
+ &deleted_p, false);
+
+ if (!trivial_p && type_has_trivial_fn (type, kind))
+ type_set_nontrivial_flag (type, kind);
+
/* Create the function. */
fn_type = build_method_type_directly (type, return_type, parameter_types);
if (raises)
@@ -991,6 +1408,8 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
DECL_IN_AGGR_P (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
DECL_DEFAULTED_FN (fn) = 1;
+ if (cxx_dialect >= cxx0x)
+ DECL_DELETED_FN (fn) = deleted_p;
DECL_NOT_REALLY_EXTERN (fn) = 1;
DECL_DECLARED_INLINE_P (fn) = 1;
gcc_assert (!TREE_USED (fn));
@@ -1022,6 +1441,18 @@ defaulted_late_check (tree fn)
error_at (DECL_SOURCE_LOCATION (fn),
"does not match expected signature %qD", implicit_fn);
}
+
+ /* 8.4.2/2: If it is explicitly defaulted on its first declaration, it is
+ implicitly considered to have the same exception-specification as if
+ it had been implicitly declared. */
+ if (DECL_DEFAULTED_IN_CLASS_P (fn))
+ {
+ tree eh_spec = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (implicit_fn));
+ TREE_TYPE (fn) = build_exception_variant (TREE_TYPE (fn), eh_spec);
+ }
+
+ if (DECL_DELETED_FN (implicit_fn))
+ DECL_DELETED_FN (fn) = 1;
}
/* Returns true iff FN can be explicitly defaulted, and gives any
@@ -1046,9 +1477,13 @@ defaultable_fn_check (tree fn)
else if (DECL_DESTRUCTOR_P (fn))
kind = sfk_destructor;
else if (DECL_ASSIGNMENT_OPERATOR_P (fn)
- && DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR
- && copy_fn_p (fn))
- kind = sfk_assignment_operator;
+ && DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR)
+ {
+ if (copy_fn_p (fn))
+ kind = sfk_copy_assignment;
+ else if (move_fn_p (fn))
+ kind = sfk_move_assignment;
+ }
if (kind == sfk_none)
{
@@ -1094,21 +1529,49 @@ tree
lazily_declare_fn (special_function_kind sfk, tree type)
{
tree fn;
- bool const_p;
-
- /* Figure out whether or not the argument has a const reference
- type. */
- if (sfk == sfk_copy_constructor)
- const_p = TYPE_HAS_CONST_INIT_REF (type);
- else if (sfk == sfk_assignment_operator)
- const_p = TYPE_HAS_CONST_ASSIGN_REF (type);
- else
- /* In this case, CONST_P will be ignored. */
- const_p = false;
+ /* Whether or not the argument has a const reference type. */
+ bool const_p = false;
+
+ switch (sfk)
+ {
+ case sfk_constructor:
+ CLASSTYPE_LAZY_DEFAULT_CTOR (type) = 0;
+ break;
+ case sfk_copy_constructor:
+ const_p = TYPE_HAS_CONST_COPY_CTOR (type);
+ CLASSTYPE_LAZY_COPY_CTOR (type) = 0;
+ break;
+ case sfk_move_constructor:
+ CLASSTYPE_LAZY_MOVE_CTOR (type) = 0;
+ break;
+ case sfk_copy_assignment:
+ const_p = TYPE_HAS_CONST_COPY_ASSIGN (type);
+ CLASSTYPE_LAZY_COPY_ASSIGN (type) = 0;
+ break;
+ case sfk_move_assignment:
+ CLASSTYPE_LAZY_MOVE_ASSIGN (type) = 0;
+ break;
+ case sfk_destructor:
+ CLASSTYPE_LAZY_DESTRUCTOR (type) = 0;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
/* Declare the function. */
fn = implicitly_declare_fn (sfk, type, const_p);
+
+ /* For move variants, rather than declare them as deleted we just
+ don't declare them at all. */
+ if (DECL_DELETED_FN (fn)
+ && (sfk == sfk_move_constructor
+ || sfk == sfk_move_assignment))
+ return NULL_TREE;
+
/* A destructor may be virtual. */
- if (sfk == sfk_destructor)
+ if (sfk == sfk_destructor
+ || sfk == sfk_move_assignment
+ || sfk == sfk_copy_assignment)
check_for_override (fn, type);
/* Add it to CLASSTYPE_METHOD_VEC. */
add_method (type, fn, NULL_TREE);
@@ -1133,22 +1596,10 @@ lazily_declare_fn (special_function_kind sfk, tree type)
TYPE_METHODS (type) = fn;
}
maybe_add_class_template_decl_list (type, fn, /*friend_p=*/0);
- if (sfk == sfk_assignment_operator)
- CLASSTYPE_LAZY_ASSIGNMENT_OP (type) = 0;
- else
- {
- /* Remember that the function has been created. */
- if (sfk == sfk_constructor)
- CLASSTYPE_LAZY_DEFAULT_CTOR (type) = 0;
- else if (sfk == sfk_copy_constructor)
- CLASSTYPE_LAZY_COPY_CTOR (type) = 0;
- else if (sfk == sfk_move_constructor)
- CLASSTYPE_LAZY_MOVE_CTOR (type) = 0;
- else if (sfk == sfk_destructor)
- CLASSTYPE_LAZY_DESTRUCTOR (type) = 0;
- /* Create appropriate clones. */
- clone_function_decl (fn, /*update_method_vec=*/true);
- }
+ if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
+ || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
+ /* Create appropriate clones. */
+ clone_function_decl (fn, /*update_method_vec=*/true);
return fn;
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 936c25638e0..67131190305 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "diagnostic-core.h"
#include "debug.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
/* The bindings for a particular name in a particular scope. */
@@ -102,7 +102,7 @@ binding_entry_make (tree name, tree type)
free_binding_entry = entry->chain;
}
else
- entry = GGC_NEW (struct binding_entry_s);
+ entry = ggc_alloc_binding_entry_s ();
entry->name = name;
entry->type = type;
@@ -144,7 +144,7 @@ binding_table_construct (binding_table table, size_t chain_count)
{
table->chain_count = chain_count;
table->entry_count = 0;
- table->chain = GGC_CNEWVEC (binding_entry, table->chain_count);
+ table->chain = ggc_alloc_cleared_vec_binding_entry (table->chain_count);
}
/* Make TABLE's entries ready for reuse. */
@@ -178,7 +178,7 @@ binding_table_free (binding_table table)
static inline binding_table
binding_table_new (size_t chain_count)
{
- binding_table table = GGC_NEW (struct binding_table_s);
+ binding_table table = ggc_alloc_binding_table_s ();
table->chain = NULL;
binding_table_construct (table, chain_count);
return table;
@@ -292,7 +292,7 @@ cxx_binding_make (tree value, tree type)
free_bindings = binding->previous;
}
else
- binding = GGC_NEW (cxx_binding);
+ binding = ggc_alloc_cxx_binding ();
cxx_binding_init (binding, value, type);
@@ -707,7 +707,7 @@ pushdecl_maybe_friend (tree x, bool is_friend)
= htab_create_ggc (20, cxx_int_tree_map_hash,
cxx_int_tree_map_eq, NULL);
- h = GGC_NEW (struct cxx_int_tree_map);
+ h = ggc_alloc_cxx_int_tree_map ();
h->uid = DECL_UID (x);
h->to = t;
loc = htab_find_slot_with_hash
@@ -805,7 +805,7 @@ pushdecl_maybe_friend (tree x, bool is_friend)
TYPE_RAISES_EXCEPTIONS (TREE_TYPE (previous));
if (!comp_except_specs (previous_exception_spec,
x_exception_spec,
- true))
+ ce_normal))
{
pedwarn (input_location, 0, "declaration of %q#D with C language linkage",
x);
@@ -1384,7 +1384,7 @@ begin_scope (scope_kind kind, tree entity)
free_binding_level = scope->level_chain;
}
else
- scope = GGC_CNEW (cxx_scope);
+ scope = ggc_alloc_cleared_cxx_scope ();
scope->this_entity = entity;
scope->more_cleanups_ok = true;
@@ -2480,6 +2480,8 @@ push_scope (tree t)
void
pop_scope (tree t)
{
+ if (t == NULL_TREE)
+ return;
if (TREE_CODE (t) == NAMESPACE_DECL)
pop_decl_namespace ();
else if CLASS_TYPE_P (t)
@@ -3195,8 +3197,8 @@ current_decl_namespace (void)
{
tree result;
/* If we have been pushed into a different namespace, use it. */
- if (decl_namespace_list)
- return TREE_PURPOSE (decl_namespace_list);
+ if (!VEC_empty (tree, decl_namespace_list))
+ return VEC_last (tree, decl_namespace_list);
if (current_class_type)
result = decl_namespace_context (current_class_type);
@@ -3380,8 +3382,7 @@ push_decl_namespace (tree decl)
{
if (TREE_CODE (decl) != NAMESPACE_DECL)
decl = decl_namespace_context (decl);
- decl_namespace_list = tree_cons (ORIGINAL_NAMESPACE (decl),
- NULL_TREE, decl_namespace_list);
+ VEC_safe_push (tree, gc, decl_namespace_list, ORIGINAL_NAMESPACE (decl));
}
/* [namespace.memdef]/2 */
@@ -3389,7 +3390,7 @@ push_decl_namespace (tree decl)
void
pop_decl_namespace (void)
{
- decl_namespace_list = TREE_CHAIN (decl_namespace_list);
+ VEC_pop (tree, decl_namespace_list);
}
/* Return the namespace that is the common ancestor
@@ -4589,8 +4590,8 @@ struct arg_lookup
{
tree name;
VEC(tree,gc) *args;
- tree namespaces;
- tree classes;
+ VEC(tree,gc) *namespaces;
+ VEC(tree,gc) *classes;
tree functions;
};
@@ -4667,9 +4668,9 @@ arg_assoc_namespace (struct arg_lookup *k, tree scope)
{
tree value;
- if (purpose_member (scope, k->namespaces))
- return 0;
- k->namespaces = tree_cons (scope, NULL_TREE, k->namespaces);
+ if (vec_member (scope, k->namespaces))
+ return false;
+ VEC_safe_push (tree, gc, k->namespaces, scope);
/* Check out our super-users. */
for (value = DECL_NAMESPACE_ASSOCIATIONS (scope); value;
@@ -4850,9 +4851,9 @@ arg_assoc_class (struct arg_lookup *k, tree type)
if (!CLASS_TYPE_P (type))
return false;
- if (purpose_member (type, k->classes))
+ if (vec_member (type, k->classes))
return false;
- k->classes = tree_cons (type, NULL_TREE, k->classes);
+ VEC_safe_push (tree, gc, k->classes, type);
if (TYPE_CLASS_SCOPE_P (type)
&& arg_assoc_class_only (k, TYPE_CONTEXT (type)))
@@ -5049,14 +5050,14 @@ lookup_arg_dependent (tree name, tree fns, VEC(tree,gc) *args)
k.name = name;
k.args = args;
k.functions = fns;
- k.classes = NULL_TREE;
+ k.classes = make_tree_vector ();
/* We previously performed an optimization here by setting
NAMESPACES to the current namespace when it was safe. However, DR
164 says that namespaces that were already searched in the first
stage of template processing are searched again (potentially
picking up later definitions) in the second stage. */
- k.namespaces = NULL_TREE;
+ k.namespaces = make_tree_vector ();
arg_assoc_args_vec (&k, args);
@@ -5070,6 +5071,9 @@ lookup_arg_dependent (tree name, tree fns, VEC(tree,gc) *args)
error (" in call to %qD", name);
fns = error_mark_node;
}
+
+ release_tree_vector (k.classes);
+ release_tree_vector (k.namespaces);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fns);
}
@@ -5406,7 +5410,7 @@ push_to_top_level (void)
bool need_pop;
timevar_push (TV_NAME_LOOKUP);
- s = GGC_CNEW (struct saved_scope);
+ s = ggc_alloc_cleared_saved_scope ();
b = scope_chain ? current_binding_level : 0;
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index 08514810ab0..e5190eba93f 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_CP_NAME_LOOKUP_H
#define GCC_CP_NAME_LOOKUP_H
-#include "c-common.h"
+#include "c-family/c-common.h"
/* The type of dictionary used to map names to types declared at
a given scope. */
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 4a50b556f46..e8f10a4d000 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "cp-tree.h"
#include "intl.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "decl.h"
#include "flags.h"
#include "diagnostic-core.h"
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "target.h"
#include "cgraph.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "plugin.h"
@@ -393,7 +393,7 @@ cp_lexer_new_main (void)
c_common_no_more_pch ();
/* Allocate the memory. */
- lexer = GGC_CNEW (cp_lexer);
+ lexer = ggc_alloc_cleared_cp_lexer ();
#ifdef ENABLE_CHECKING
/* Initially we are not debugging. */
@@ -404,7 +404,7 @@ cp_lexer_new_main (void)
/* Create the buffer. */
alloc = CP_LEXER_BUFFER_SIZE;
- buffer = GGC_NEWVEC (cp_token, alloc);
+ buffer = ggc_alloc_vec_cp_token (alloc);
/* Put the first token in the buffer. */
space = alloc;
@@ -445,7 +445,7 @@ cp_lexer_new_from_tokens (cp_token_cache *cache)
{
cp_token *first = cache->first;
cp_token *last = cache->last;
- cp_lexer *lexer = GGC_CNEW (cp_lexer);
+ cp_lexer *lexer = ggc_alloc_cleared_cp_lexer ();
/* We do not own the buffer. */
lexer->buffer = NULL;
@@ -946,7 +946,7 @@ cp_lexer_stop_debugging (cp_lexer* lexer)
static cp_token_cache *
cp_token_cache_new (cp_token *first, cp_token *last)
{
- cp_token_cache *cache = GGC_NEW (cp_token_cache);
+ cp_token_cache *cache = ggc_alloc_cp_token_cache ();
cache->first = first;
cache->last = last;
return cache;
@@ -1496,7 +1496,7 @@ cp_parser_context_new (cp_parser_context* next)
memset (context, 0, sizeof (*context));
}
else
- context = GGC_CNEW (cp_parser_context);
+ context = ggc_alloc_cleared_cp_parser_context ();
/* No errors have occurred yet in this context. */
context->status = CP_PARSER_STATUS_KIND_NO_ERROR;
@@ -3093,7 +3093,7 @@ cp_parser_new (void)
cp_lexer *lexer;
unsigned i;
- /* cp_lexer_new_main is called before calling ggc_alloc because
+ /* cp_lexer_new_main is called before doing GC allocation because
cp_lexer_new_main might load a PCH file. */
lexer = cp_lexer_new_main ();
@@ -3102,7 +3102,7 @@ cp_parser_new (void)
for (i = 0; i < sizeof (binops) / sizeof (binops[0]); i++)
binops_by_token[binops[i].token_type] = binops[i];
- parser = GGC_CNEW (cp_parser);
+ parser = ggc_alloc_cleared_cp_parser ();
parser->lexer = lexer;
parser->context = cp_parser_context_new (NULL);
@@ -4605,7 +4605,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
token->type = CPP_NESTED_NAME_SPECIFIER;
/* Retrieve any deferred checks. Do not pop this access checks yet
so the memory will not be reclaimed during token replacing below. */
- token->u.tree_check_value = GGC_CNEW (struct tree_check);
+ token->u.tree_check_value = ggc_alloc_cleared_tree_check ();
token->u.tree_check_value->value = parser->scope;
token->u.tree_check_value->checks = get_deferred_access_checks ();
token->u.tree_check_value->qualifying_scope =
@@ -5841,6 +5841,51 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p,
}
break;
+ case RID_NOEXCEPT:
+ {
+ tree expr;
+ const char *saved_message;
+ bool saved_integral_constant_expression_p;
+ bool saved_non_integral_constant_expression_p;
+ bool saved_greater_than_is_operator_p;
+
+ cp_lexer_consume_token (parser->lexer);
+ cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN);
+
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = G_("types may not be defined in %<noexcept%> expressions");
+
+ saved_integral_constant_expression_p
+ = parser->integral_constant_expression_p;
+ saved_non_integral_constant_expression_p
+ = parser->non_integral_constant_expression_p;
+ parser->integral_constant_expression_p = false;
+
+ saved_greater_than_is_operator_p
+ = parser->greater_than_is_operator_p;
+ parser->greater_than_is_operator_p = true;
+
+ ++cp_unevaluated_operand;
+ ++c_inhibit_evaluation_warnings;
+ expr = cp_parser_expression (parser, false, NULL);
+ --c_inhibit_evaluation_warnings;
+ --cp_unevaluated_operand;
+
+ parser->greater_than_is_operator_p
+ = saved_greater_than_is_operator_p;
+
+ parser->integral_constant_expression_p
+ = saved_integral_constant_expression_p;
+ parser->non_integral_constant_expression_p
+ = saved_non_integral_constant_expression_p;
+
+ parser->type_definition_forbidden_message = saved_message;
+
+ cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
+ return finish_noexcept_expr (expr, tf_warning_or_error);
+ }
+
default:
break;
}
@@ -6770,15 +6815,20 @@ cp_parser_question_colon_clause (cp_parser* parser, tree logical_or_expr)
{
tree expr;
tree assignment_expr;
+ struct cp_token *token;
/* Consume the `?' token. */
cp_lexer_consume_token (parser->lexer);
+ token = cp_lexer_peek_token (parser->lexer);
if (cp_parser_allow_gnu_extensions_p (parser)
- && cp_lexer_next_token_is (parser->lexer, CPP_COLON))
+ && token->type == CPP_COLON)
{
+ pedwarn (token->location, OPT_pedantic,
+ "ISO C++ does not allow ?: with omitted middle operand");
/* Implicit true clause. */
expr = NULL_TREE;
c_inhibit_evaluation_warnings += logical_or_expr == truthvalue_true_node;
+ warn_for_omitted_condop (token->location, logical_or_expr);
}
else
{
@@ -10136,7 +10186,7 @@ cp_parser_mem_initializer_list (cp_parser* parser)
mem-initializer-list. */
if (!DECL_CONSTRUCTOR_P (current_function_decl))
error_at (token->location,
- "only constructors take base initializers");
+ "only constructors take member initializers");
/* Loop through the list. */
while (true)
@@ -11230,7 +11280,7 @@ cp_parser_template_id (cp_parser *parser,
token->type = CPP_TEMPLATE_ID;
/* Retrieve any deferred checks. Do not pop this access checks yet
so the memory will not be reclaimed during token replacing below. */
- token->u.tree_check_value = GGC_CNEW (struct tree_check);
+ token->u.tree_check_value = ggc_alloc_cleared_tree_check ();
token->u.tree_check_value->value = template_id;
token->u.tree_check_value->checks = get_deferred_access_checks ();
token->keyword = RID_MAX;
@@ -17489,13 +17539,50 @@ cp_parser_exception_specification_opt (cp_parser* parser)
{
cp_token *token;
tree type_id_list;
+ const char *saved_message;
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
+
+ /* Is it a noexcept-specification? */
+ if (cp_parser_is_keyword (token, RID_NOEXCEPT))
+ {
+ tree expr;
+ cp_lexer_consume_token (parser->lexer);
+
+ if (cp_lexer_peek_token (parser->lexer)->type == CPP_OPEN_PAREN)
+ {
+ cp_lexer_consume_token (parser->lexer);
+
+ /* Types may not be defined in an exception-specification. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = G_("types may not be defined in an exception-specification");
+
+ expr = cp_parser_constant_expression (parser, false, NULL);
+
+ /* Restore the saved message. */
+ parser->type_definition_forbidden_message = saved_message;
+
+ cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
+ }
+ else
+ expr = boolean_true_node;
+
+ return build_noexcept_spec (expr, tf_warning_or_error);
+ }
+
/* If it's not `throw', then there's no exception-specification. */
if (!cp_parser_is_keyword (token, RID_THROW))
return NULL_TREE;
+#if 0
+ /* Enable this once a lot of code has transitioned to noexcept? */
+ if (cxx_dialect == cxx0x && !in_system_header)
+ warning (OPT_Wdeprecated, "dynamic exception specifications are "
+ "deprecated in C++0x; use %<noexcept%> instead.");
+#endif
+
/* Consume the `throw'. */
cp_lexer_consume_token (parser->lexer);
@@ -17507,8 +17594,6 @@ cp_parser_exception_specification_opt (cp_parser* parser)
/* If it's not a `)', then there is a type-id-list. */
if (token->type != CPP_CLOSE_PAREN)
{
- const char *saved_message;
-
/* Types may not be defined in an exception-specification. */
saved_message = parser->type_definition_forbidden_message;
parser->type_definition_forbidden_message
@@ -18285,6 +18370,14 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
if (dependent_p)
pushed_scope = push_scope (parser->scope);
+ /* If the PARSER->SCOPE is a template specialization, it
+ may be instantiated during name lookup. In that case,
+ errors may be issued. Even if we rollback the current
+ tentative parse, those errors are valid. */
+ decl = lookup_qualified_name (parser->scope, name,
+ tag_type != none_type,
+ /*complain=*/true);
+
/* 3.4.3.1: In a lookup in which the constructor is an acceptable
lookup result and the nested-name-specifier nominates a class C:
* if the name specified after the nested-name-specifier, when
@@ -18300,17 +18393,11 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
shall be used only in the declarator-id of a declaration that
names a constructor or in a using-declaration. */
if (tag_type == none_type
- && CLASS_TYPE_P (parser->scope)
- && constructor_name_p (name, parser->scope))
- name = ctor_identifier;
-
- /* If the PARSER->SCOPE is a template specialization, it
- may be instantiated during name lookup. In that case,
- errors may be issued. Even if we rollback the current
- tentative parse, those errors are valid. */
- decl = lookup_qualified_name (parser->scope, name,
- tag_type != none_type,
- /*complain=*/true);
+ && DECL_SELF_REFERENCE_P (decl)
+ && same_type_p (DECL_CONTEXT (decl), parser->scope))
+ decl = lookup_qualified_name (parser->scope, ctor_identifier,
+ tag_type != none_type,
+ /*complain=*/true);
/* If we have a single function from a using decl, pull it out. */
if (TREE_CODE (decl) == OVERLOAD
@@ -22618,11 +22705,12 @@ static tree
cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
{
tree init, cond, incr, body, decl, pre_body = NULL_TREE, ret;
- tree for_block = NULL_TREE, real_decl, initv, condv, incrv, declv;
+ tree real_decl, initv, condv, incrv, declv;
tree this_pre_body, cl;
location_t loc_first;
bool collapse_err = false;
int i, collapse = 1, nbraces = 0;
+ VEC(tree,gc) *for_block = make_tree_vector ();
for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl))
if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE)
@@ -22741,8 +22829,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
LOOKUP_ONLYCONVERTING);
if (CLASS_TYPE_P (TREE_TYPE (decl)))
{
- for_block
- = tree_cons (NULL, this_pre_body, for_block);
+ VEC_safe_push (tree, gc, for_block, this_pre_body);
init = NULL_TREE;
}
else
@@ -22996,11 +23083,9 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
}
}
- while (for_block)
- {
- add_stmt (pop_stmt_list (TREE_VALUE (for_block)));
- for_block = TREE_CHAIN (for_block);
- }
+ while (!VEC_empty (tree, for_block))
+ add_stmt (pop_stmt_list (VEC_pop (tree, for_block)));
+ release_tree_vector (for_block);
return ret;
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index dcb455b66aa..09d077ade06 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -35,12 +35,11 @@ along with GCC; see the file COPYING3. If not see
#include "pointer-set.h"
#include "flags.h"
#include "cp-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "cp-objcp-common.h"
#include "tree-inline.h"
#include "decl.h"
#include "output.h"
-#include "except.h"
#include "toplev.h"
#include "timevar.h"
#include "tree-iterator.h"
@@ -888,10 +887,10 @@ maybe_process_partial_specialization (tree type)
slot = (spec_entry **)
htab_find_slot (type_specializations, &elt, INSERT);
- *slot = GGC_NEW (spec_entry);
+ *slot = ggc_alloc_spec_entry ();
**slot = elt;
}
- else if (COMPLETE_TYPE_P (inst) || TYPE_BEING_DEFINED (inst))
+ else if (COMPLETE_OR_OPEN_TYPE_P (inst))
/* But if we've had an implicit instantiation, that's a
problem ([temp.expl.spec]/6). */
error ("specialization %qT after instantiation %qT",
@@ -1401,7 +1400,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
if (!optimize_specialization_lookup_p (tmpl))
{
gcc_assert (tmpl && args && spec);
- *slot = GGC_NEW (spec_entry);
+ *slot = ggc_alloc_spec_entry ();
**slot = elt;
if (TREE_CODE (spec) == FUNCTION_DECL && DECL_NAMESPACE_SCOPE_P (spec)
&& PRIMARY_TEMPLATE_P (tmpl)
@@ -3875,10 +3874,10 @@ process_partial_specialization (tree decl)
or some such would have been OK. */
tpd.level = TMPL_PARMS_DEPTH (current_template_parms);
- tpd.parms = (int *) alloca (sizeof (int) * ntparms);
+ tpd.parms = XALLOCAVEC (int, ntparms);
memset (tpd.parms, 0, sizeof (int) * ntparms);
- tpd.arg_uses_template_parms = (int *) alloca (sizeof (int) * nargs);
+ tpd.arg_uses_template_parms = XALLOCAVEC (int, nargs);
memset (tpd.arg_uses_template_parms, 0, sizeof (int) * nargs);
for (i = 0; i < nargs; ++i)
{
@@ -3993,12 +3992,11 @@ process_partial_specialization (tree decl)
if (!tpd2.parms)
{
/* We haven't yet initialized TPD2. Do so now. */
- tpd2.arg_uses_template_parms
- = (int *) alloca (sizeof (int) * nargs);
+ tpd2.arg_uses_template_parms = XALLOCAVEC (int, nargs);
/* The number of parameters here is the number in the
main template, which, as checked in the assertion
above, is NARGS. */
- tpd2.parms = (int *) alloca (sizeof (int) * nargs);
+ tpd2.parms = XALLOCAVEC (int, nargs);
tpd2.level =
TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl));
}
@@ -4882,6 +4880,36 @@ check_valid_ptrmem_cst_expr (tree type, tree expr)
return false;
}
+/* Returns TRUE iff the address of OP is value-dependent.
+
+ 14.6.2.4 [temp.dep.temp]:
+ A non-integral non-type template-argument is dependent if its type is
+ dependent or it has either of the following forms
+ qualified-id
+ & qualified-id
+ and contains a nested-name-specifier which specifies a class-name that
+ names a dependent type.
+
+ We generalize this to just say that the address of a member of a
+ dependent class is value-dependent; the above doesn't cover the
+ address of a static data member named with an unqualified-id. */
+
+static bool
+has_value_dependent_address (tree op)
+{
+ /* We could use get_inner_reference here, but there's no need;
+ this is only relevant for template non-type arguments, which
+ can only be expressed as &id-expression. */
+ if (DECL_P (op))
+ {
+ tree ctx = CP_DECL_CONTEXT (op);
+ if (TYPE_P (ctx) && dependent_type_p (ctx))
+ return true;
+ }
+
+ return false;
+}
+
/* Attempt to convert the non-type template parameter EXPR to the
indicated TYPE. If the conversion is successful, return the
converted value. If the conversion is unsuccessful, return
@@ -4920,6 +4948,11 @@ convert_nontype_argument (tree type, tree expr)
return NULL_TREE;
}
+ /* Add the ADDR_EXPR now for the benefit of
+ value_dependent_expression_p. */
+ if (TYPE_PTROBV_P (type))
+ expr = decay_conversion (expr);
+
/* If we are in a template, EXPR may be non-dependent, but still
have a syntactic, rather than semantic, form. For example, EXPR
might be a SCOPE_REF, rather than the VAR_DECL to which the
@@ -4927,11 +4960,18 @@ convert_nontype_argument (tree type, tree expr)
so that access checking can be performed when the template is
instantiated -- but here we need the resolved form so that we can
convert the argument. */
- expr = fold_non_dependent_expr (expr);
+ if (TYPE_REF_OBJ_P (type)
+ && has_value_dependent_address (expr))
+ /* If we want the address and it's value-dependent, don't fold. */;
+ else
+ expr = fold_non_dependent_expr (expr);
if (error_operand_p (expr))
return error_mark_node;
expr_type = TREE_TYPE (expr);
- expr = mark_rvalue_use (expr);
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ expr = mark_lvalue_use (expr);
+ else
+ expr = mark_rvalue_use (expr);
/* HACK: Due to double coercion, we can get a
NOP_EXPR<REFERENCE_TYPE>(ADDR_EXPR<POINTER_TYPE> (arg)) here,
@@ -5922,15 +5962,15 @@ coerce_template_parms (tree parms,
{
if (complain & tf_error)
{
- const char *or_more = "";
if (variadic_p)
{
- or_more = " or more";
--nparms;
+ error ("wrong number of template arguments "
+ "(%d, should be %d or more)", nargs, nparms);
}
-
- error ("wrong number of template arguments (%d, should be %d%s)",
- nargs, nparms, or_more);
+ else
+ error ("wrong number of template arguments "
+ "(%d, should be %d)", nargs, nparms);
if (in_decl)
error ("provided for %q+D", in_decl);
@@ -6155,7 +6195,7 @@ add_pending_template (tree d)
if (level)
push_tinst_level (d);
- pt = GGC_NEW (struct pending_template);
+ pt = ggc_alloc_pending_template ();
pt->next = NULL;
pt->tinst = current_tinst_level;
if (last_pending_template)
@@ -6718,7 +6758,7 @@ lookup_template_class (tree d1,
elt.spec = t;
slot = (spec_entry **) htab_find_slot_with_hash (type_specializations,
&elt, hash, INSERT);
- *slot = GGC_NEW (spec_entry);
+ *slot = ggc_alloc_spec_entry ();
**slot = elt;
/* Note this use of the partial instantiation so we can check it
@@ -7076,7 +7116,7 @@ push_tinst_level (tree d)
return 0;
}
- new_level = GGC_NEW (struct tinst_level);
+ new_level = ggc_alloc_tinst_level ();
new_level->decl = d;
new_level->locus = input_location;
new_level->in_system_header_p = in_system_header;
@@ -7699,8 +7739,7 @@ instantiate_class_template (tree type)
if (type == error_mark_node)
return error_mark_node;
- if (TYPE_BEING_DEFINED (type)
- || COMPLETE_TYPE_P (type)
+ if (COMPLETE_OR_OPEN_TYPE_P (type)
|| uses_template_parms (type))
return type;
@@ -7770,10 +7809,10 @@ instantiate_class_template (tree type)
TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern);
TYPE_HAS_ARRAY_NEW_OPERATOR (type) = TYPE_HAS_ARRAY_NEW_OPERATOR (pattern);
TYPE_GETS_DELETE (type) = TYPE_GETS_DELETE (pattern);
- TYPE_HAS_ASSIGN_REF (type) = TYPE_HAS_ASSIGN_REF (pattern);
- TYPE_HAS_CONST_ASSIGN_REF (type) = TYPE_HAS_CONST_ASSIGN_REF (pattern);
- TYPE_HAS_INIT_REF (type) = TYPE_HAS_INIT_REF (pattern);
- TYPE_HAS_CONST_INIT_REF (type) = TYPE_HAS_CONST_INIT_REF (pattern);
+ TYPE_HAS_COPY_ASSIGN (type) = TYPE_HAS_COPY_ASSIGN (pattern);
+ TYPE_HAS_CONST_COPY_ASSIGN (type) = TYPE_HAS_CONST_COPY_ASSIGN (pattern);
+ TYPE_HAS_COPY_CTOR (type) = TYPE_HAS_COPY_CTOR (pattern);
+ TYPE_HAS_CONST_COPY_CTOR (type) = TYPE_HAS_CONST_COPY_CTOR (pattern);
TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern);
TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern);
TYPE_PACKED (type) = TYPE_PACKED (pattern);
@@ -7795,8 +7834,7 @@ instantiate_class_template (tree type)
instantiate it, and that lookup should instantiate the enclosing
class. */
gcc_assert (!DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
- || COMPLETE_TYPE_P (TYPE_CONTEXT (type))
- || TYPE_BEING_DEFINED (TYPE_CONTEXT (type)));
+ || COMPLETE_OR_OPEN_TYPE_P (TYPE_CONTEXT (type)));
base_list = NULL_TREE;
if (BINFO_N_BASE_BINFOS (pbinfo))
@@ -8527,7 +8565,7 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl)
tree orig_t = t;
int len = TREE_VEC_LENGTH (t);
int need_new = 0, i, expanded_len_adjust = 0, out;
- tree *elts = (tree *) alloca (len * sizeof (tree));
+ tree *elts = XALLOCAVEC (tree, len);
for (i = 0; i < len; i++)
{
@@ -9838,7 +9876,15 @@ tsubst_exception_specification (tree fntype,
specs = TYPE_RAISES_EXCEPTIONS (fntype);
new_specs = NULL_TREE;
- if (specs)
+ if (specs && TREE_PURPOSE (specs))
+ {
+ /* A noexcept-specifier. */
+ new_specs = tsubst_copy_and_build
+ (TREE_PURPOSE (specs), args, complain, in_decl, /*function_p=*/false,
+ /*integral_constant_expression_p=*/true);
+ new_specs = build_noexcept_spec (new_specs, complain);
+ }
+ else if (specs)
{
if (! TREE_VALUE (specs))
new_specs = specs;
@@ -12245,6 +12291,17 @@ tsubst_copy_and_build (tree t,
return cxx_sizeof_or_alignof_expr (op1, TREE_CODE (t),
complain & tf_error);
+ case NOEXCEPT_EXPR:
+ op1 = TREE_OPERAND (t, 0);
+ ++cp_unevaluated_operand;
+ ++c_inhibit_evaluation_warnings;
+ op1 = tsubst_copy_and_build (op1, args, complain, in_decl,
+ /*function_p=*/false,
+ /*integral_constant_expression_p=*/false);
+ --cp_unevaluated_operand;
+ --c_inhibit_evaluation_warnings;
+ return finish_noexcept_expr (op1, complain);
+
case MODOP_EXPR:
{
tree r = build_x_modify_expr
@@ -17463,40 +17520,6 @@ dependent_scope_p (tree scope)
&& !currently_open_class (scope));
}
-/* Returns TRUE if EXPRESSION is dependent, according to CRITERION. */
-
-static bool
-dependent_scope_ref_p (tree expression, bool criterion (tree))
-{
- tree scope;
- tree name;
-
- gcc_assert (TREE_CODE (expression) == SCOPE_REF);
-
- if (!TYPE_P (TREE_OPERAND (expression, 0)))
- return true;
-
- scope = TREE_OPERAND (expression, 0);
- name = TREE_OPERAND (expression, 1);
-
- /* [temp.dep.expr]
-
- An id-expression is type-dependent if it contains a
- nested-name-specifier that contains a class-name that names a
- dependent type. */
- /* The suggested resolution to Core Issue 224 implies that if the
- qualifying type is the current class, then we must peek
- inside it. */
- if (DECL_P (name)
- && currently_open_class (scope)
- && !criterion (name))
- return false;
- if (dependent_type_p (scope))
- return true;
-
- return false;
-}
-
/* Returns TRUE if the EXPRESSION is value-dependent, in the sense of
[temp.dep.constexpr]. EXPRESSION is already known to be a constant
expression. */
@@ -17579,8 +17602,17 @@ value_dependent_expression_p (tree expression)
return dependent_type_p (expression);
return type_dependent_expression_p (expression);
+ case NOEXCEPT_EXPR:
+ expression = TREE_OPERAND (expression, 0);
+ /* FIXME why check value-dependency? */
+ return (type_dependent_expression_p (expression)
+ || value_dependent_expression_p (expression));
+
case SCOPE_REF:
- return dependent_scope_ref_p (expression, value_dependent_expression_p);
+ {
+ tree name = TREE_OPERAND (expression, 1);
+ return value_dependent_expression_p (name);
+ }
case COMPONENT_REF:
return (value_dependent_expression_p (TREE_OPERAND (expression, 0))
@@ -17617,6 +17649,13 @@ value_dependent_expression_p (tree expression)
return ((value_dependent_expression_p (TREE_OPERAND (expression, 0)))
|| (value_dependent_expression_p (TREE_OPERAND (expression, 2))));
+ case ADDR_EXPR:
+ {
+ tree op = TREE_OPERAND (expression, 0);
+ return (value_dependent_expression_p (op)
+ || has_value_dependent_address (op));
+ }
+
default:
/* A constant expression is value-dependent if any subexpression is
value-dependent. */
@@ -17680,6 +17719,7 @@ type_dependent_expression_p (tree expression)
if (TREE_CODE (expression) == PSEUDO_DTOR_EXPR
|| TREE_CODE (expression) == SIZEOF_EXPR
|| TREE_CODE (expression) == ALIGNOF_EXPR
+ || TREE_CODE (expression) == NOEXCEPT_EXPR
|| TREE_CODE (expression) == TRAIT_EXPR
|| TREE_CODE (expression) == TYPEID_EXPR
|| TREE_CODE (expression) == DELETE_EXPR
@@ -17715,10 +17755,19 @@ type_dependent_expression_p (tree expression)
return dependent_type_p (type);
}
- if (TREE_CODE (expression) == SCOPE_REF
- && dependent_scope_ref_p (expression,
- type_dependent_expression_p))
- return true;
+ if (TREE_CODE (expression) == SCOPE_REF)
+ {
+ tree scope = TREE_OPERAND (expression, 0);
+ tree name = TREE_OPERAND (expression, 1);
+
+ /* 14.6.2.2 [temp.dep.expr]: An id-expression is type-dependent if it
+ contains an identifier associated by name lookup with one or more
+ declarations declared with a dependent type, or...a
+ nested-name-specifier or qualified-id that names a member of an
+ unknown specialization. */
+ return (type_dependent_expression_p (name)
+ || dependent_scope_p (scope));
+ }
if (TREE_CODE (expression) == FUNCTION_DECL
&& DECL_LANG_SPECIFIC (expression)
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index a1fa71ffe22..c2493c7fcad 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -124,9 +124,9 @@ cxx_print_type (FILE *file, tree node, int indent)
fputs (" X()", file);
if (TYPE_HAS_CONVERSION (node))
fputs (" has-type-conversion", file);
- if (TYPE_HAS_INIT_REF (node))
+ if (TYPE_HAS_COPY_CTOR (node))
{
- if (TYPE_HAS_CONST_INIT_REF (node))
+ if (TYPE_HAS_CONST_COPY_CTOR (node))
fputs (" X(constX&)", file);
else
fputs (" X(X&)", file);
@@ -139,7 +139,7 @@ cxx_print_type (FILE *file, tree node, int indent)
fputs (" delete", file);
if (TYPE_GETS_DELETE (node) & 2)
fputs (" delete[]", file);
- if (TYPE_HAS_ASSIGN_REF (node))
+ if (TYPE_HAS_COPY_ASSIGN (node))
fputs (" this=(X&)", file);
if (CLASSTYPE_SORTED_FIELDS (node))
fprintf (file, " sorted-fields %p",
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 08a4d623d40..2a08c8fa412 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -43,7 +43,7 @@ static FILE *open_repo_file (const char *);
static char *afgets (FILE *);
static FILE *reopen_repo_file_for_write (void);
-static GTY(()) tree pending_repo;
+static GTY(()) VEC(tree,gc) *pending_repo;
static char *repo_name;
static const char *old_args, *old_dir, *old_main;
@@ -236,9 +236,10 @@ reopen_repo_file_for_write (void)
void
finish_repo (void)
{
- tree t;
+ tree val;
char *dir, *args;
FILE *repo_file;
+ unsigned ix;
if (!flag_use_repository || flag_compare_debug)
return;
@@ -266,9 +267,10 @@ finish_repo (void)
fprintf (repo_file, "\n");
}
- for (t = pending_repo; t; t = TREE_CHAIN (t))
+ for (ix = VEC_length (tree, pending_repo) - 1;
+ VEC_iterate (tree, pending_repo, ix, val);
+ ix--)
{
- tree val = TREE_VALUE (t);
tree name = DECL_ASSEMBLER_NAME (val);
char type = IDENTIFIER_REPO_CHOSEN (name) ? 'C' : 'O';
fprintf (repo_file, "%c %s\n", type, IDENTIFIER_POINTER (name));
@@ -352,7 +354,7 @@ repo_emit_p (tree decl)
if (!DECL_REPO_AVAILABLE_P (decl))
{
DECL_REPO_AVAILABLE_P (decl) = 1;
- pending_repo = tree_cons (NULL_TREE, decl, pending_repo);
+ VEC_safe_push (tree, gc, pending_repo, decl);
}
return IDENTIFIER_REPO_CHOSEN (DECL_ASSEMBLER_NAME (decl)) ? 1 : ret;
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 62aa9212929..dde8e825dbe 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "convert.h"
#include "target.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
/* C++ returns type information to the user in struct type_info
objects. We also use type information to implement dynamic_cast and
@@ -207,8 +207,8 @@ throw_bad_cast (void)
{
tree fn = get_identifier ("__cxa_bad_cast");
if (!get_global_value_if_present (fn, &fn))
- fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
- void_list_node));
+ fn = push_throw_library_fn (fn, build_function_type_list (ptr_type_node,
+ NULL_TREE));
return build_cxx_call (fn, 0, NULL);
}
@@ -225,7 +225,7 @@ throw_bad_typeid (void)
tree t;
t = build_reference_type (const_type_info_type_node);
- t = build_function_type (t, void_list_node);
+ t = build_function_type_list (t, NULL_TREE);
fn = push_throw_library_fn (fn, t);
}
@@ -729,12 +729,10 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
(cp_build_qualified_type
(tinfo_ptr, TYPE_QUAL_CONST));
name = "__dynamic_cast";
- tmp = tree_cons
- (NULL_TREE, const_ptr_type_node, tree_cons
- (NULL_TREE, tinfo_ptr, tree_cons
- (NULL_TREE, tinfo_ptr, tree_cons
- (NULL_TREE, ptrdiff_type_node, void_list_node))));
- tmp = build_function_type (ptr_type_node, tmp);
+ tmp = build_function_type_list (ptr_type_node,
+ const_ptr_type_node,
+ tinfo_ptr, tinfo_ptr,
+ ptrdiff_type_node, NULL_TREE);
dcast_fn = build_library_fn_ptr (name, tmp);
DECL_PURE_P (dcast_fn) = 1;
pop_abi_namespace ();
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 4843855bf70..9dbefd3c5bc 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -216,8 +216,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
/* If BASE is incomplete, it can't be a base of T--and instantiating it
might cause an error. */
- if (t_binfo && CLASS_TYPE_P (base)
- && (COMPLETE_TYPE_P (base) || TYPE_BEING_DEFINED (base)))
+ if (t_binfo && CLASS_TYPE_P (base) && COMPLETE_OR_OPEN_TYPE_P (base))
{
struct lookup_base_data_s data;
@@ -1336,7 +1335,7 @@ lookup_conversion_operator (tree class_type, tree type)
}
/* TYPE is a class type. Return the index of the fields within
- the method vector with name NAME, or -1 is no such field exists. */
+ the method vector with name NAME, or -1 if no such field exists. */
int
lookup_fnfields_1 (tree type, tree name)
@@ -1362,9 +1361,13 @@ lookup_fnfields_1 (tree type, tree name)
if (CLASSTYPE_LAZY_MOVE_CTOR (type))
lazily_declare_fn (sfk_move_constructor, type);
}
- else if (name == ansi_assopname(NOP_EXPR)
- && CLASSTYPE_LAZY_ASSIGNMENT_OP (type))
- lazily_declare_fn (sfk_assignment_operator, type);
+ else if (name == ansi_assopname (NOP_EXPR))
+ {
+ if (CLASSTYPE_LAZY_COPY_ASSIGN (type))
+ lazily_declare_fn (sfk_copy_assignment, type);
+ if (CLASSTYPE_LAZY_MOVE_ASSIGN (type))
+ lazily_declare_fn (sfk_move_assignment, type);
+ }
else if ((name == dtor_identifier
|| name == base_dtor_identifier
|| name == complete_dtor_identifier
@@ -1442,6 +1445,18 @@ lookup_fnfields_1 (tree type, tree name)
return -1;
}
+/* TYPE is a class type. Return the field within the method vector with
+ name NAME, or NULL_TREE if no such field exists. */
+
+tree
+lookup_fnfields_slot (tree type, tree name)
+{
+ int ix = lookup_fnfields_1 (type, name);
+ if (ix < 0)
+ return NULL_TREE;
+ return VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
+}
+
/* Like lookup_fnfields_1, except that the name is extracted from
FUNCTION, which is a FUNCTION_DECL or a TEMPLATE_DECL. */
@@ -1867,7 +1882,7 @@ check_final_overrider (tree overrider, tree basefn)
}
/* Check throw specifier is at least as strict. */
- if (!comp_except_specs (base_throw, over_throw, 0))
+ if (!comp_except_specs (base_throw, over_throw, ce_derived))
{
error ("looser throw specifier for %q+#F", overrider);
error (" overriding %q+#F", basefn);
@@ -1890,6 +1905,7 @@ check_final_overrider (tree overrider, tree basefn)
{
error ("deleted function %q+D", overrider);
error ("overriding non-deleted function %q+D", basefn);
+ maybe_explain_implicit_delete (overrider);
}
else
{
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 05d1cada906..156f278e171 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -30,10 +30,9 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "tree-inline.h"
#include "tree-mudflap.h"
-#include "except.h"
#include "toplev.h"
#include "flags.h"
#include "output.h"
@@ -1219,7 +1218,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
tree operand;
int i;
- oconstraints = (const char **) alloca (noutputs * sizeof (char *));
+ oconstraints = XALLOCAVEC (const char *, noutputs);
string = resolve_asm_operand_names (string, output_operands,
input_operands, labels);
@@ -3098,7 +3097,13 @@ finish_id_expression (tree id_expression,
{
tree r = convert_from_reference (decl);
- if (processing_template_decl && TYPE_P (scope))
+ /* In a template, return a SCOPE_REF for most qualified-ids
+ so that we can check access at instantiation time. But if
+ we're looking at a member of the current instantiation, we
+ know we have access and building up the SCOPE_REF confuses
+ non-type template argument handling. */
+ if (processing_template_decl && TYPE_P (scope)
+ && !currently_open_class (scope))
r = build_qualified_name (TREE_TYPE (r),
scope, decl,
template_p);
@@ -3255,6 +3260,7 @@ simplify_aggr_init_expr (tree *tp)
fn,
aggr_init_expr_nargs (aggr_init_expr),
AGGR_INIT_EXPR_ARGP (aggr_init_expr));
+ TREE_NOTHROW (call_expr) = TREE_NOTHROW (aggr_init_expr);
if (style == ctor)
{
@@ -3521,31 +3527,6 @@ finalize_nrv (tree *tp, tree var, tree result)
htab_delete (data.visited);
}
-/* Return the declaration for the function called by CALL_EXPR T,
- TYPE is the class type of the clause decl. */
-
-static tree
-omp_clause_info_fndecl (tree t, tree type)
-{
- tree ret = get_callee_fndecl (t);
-
- if (ret)
- return ret;
-
- gcc_assert (TREE_CODE (t) == CALL_EXPR);
- t = CALL_EXPR_FN (t);
- STRIP_NOPS (t);
- if (TREE_CODE (t) == OBJ_TYPE_REF)
- {
- t = cp_fold_obj_type_ref (t, type);
- if (TREE_CODE (t) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL)
- return TREE_OPERAND (t, 0);
- }
-
- return NULL_TREE;
-}
-
/* Create CP_OMP_CLAUSE_INFO for clause C. Returns true if it is invalid. */
bool
@@ -3563,80 +3544,27 @@ cxx_omp_create_clause_info (tree c, tree type, bool need_default_ctor,
info = make_tree_vec (3);
CP_OMP_CLAUSE_INFO (c) = info;
- if (need_default_ctor
- || (need_copy_ctor && !TYPE_HAS_TRIVIAL_INIT_REF (type)))
+ if (need_default_ctor || need_copy_ctor)
{
- VEC(tree,gc) *vec;
-
if (need_default_ctor)
- vec = NULL;
+ t = get_default_ctor (type);
else
- {
- t = build_int_cst (build_pointer_type (type), 0);
- t = build1 (INDIRECT_REF, type, t);
- vec = make_tree_vector_single (t);
- }
- t = build_special_member_call (NULL_TREE, complete_ctor_identifier,
- &vec, type, LOOKUP_NORMAL,
- tf_warning_or_error);
+ t = get_copy_ctor (type);
- if (vec != NULL)
- release_tree_vector (vec);
-
- if (targetm.cxx.cdtor_returns_this () || errorcount)
- /* Because constructors and destructors return this,
- the call will have been cast to "void". Remove the
- cast here. We would like to use STRIP_NOPS, but it
- wouldn't work here because TYPE_MODE (t) and
- TYPE_MODE (TREE_OPERAND (t, 0)) are different.
- They are VOIDmode and Pmode, respectively. */
- if (TREE_CODE (t) == NOP_EXPR)
- t = TREE_OPERAND (t, 0);
-
- TREE_VEC_ELT (info, 0) = get_callee_fndecl (t);
+ if (t && !trivial_fn_p (t))
+ TREE_VEC_ELT (info, 0) = t;
}
if ((need_default_ctor || need_copy_ctor)
&& TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
- {
- t = build_int_cst (build_pointer_type (type), 0);
- t = build1 (INDIRECT_REF, type, t);
- t = build_special_member_call (t, complete_dtor_identifier,
- NULL, type, LOOKUP_NORMAL,
- tf_warning_or_error);
+ TREE_VEC_ELT (info, 1) = get_dtor (type);
- if (targetm.cxx.cdtor_returns_this () || errorcount)
- /* Because constructors and destructors return this,
- the call will have been cast to "void". Remove the
- cast here. We would like to use STRIP_NOPS, but it
- wouldn't work here because TYPE_MODE (t) and
- TYPE_MODE (TREE_OPERAND (t, 0)) are different.
- They are VOIDmode and Pmode, respectively. */
- if (TREE_CODE (t) == NOP_EXPR)
- t = TREE_OPERAND (t, 0);
-
- TREE_VEC_ELT (info, 1) = omp_clause_info_fndecl (t, type);
- }
-
- if (need_copy_assignment && !TYPE_HAS_TRIVIAL_ASSIGN_REF (type))
+ if (need_copy_assignment)
{
- VEC(tree,gc) *vec;
-
- t = build_int_cst (build_pointer_type (type), 0);
- t = build1 (INDIRECT_REF, type, t);
- vec = make_tree_vector_single (t);
- t = build_special_member_call (t, ansi_assopname (NOP_EXPR),
- &vec, type, LOOKUP_NORMAL,
- tf_warning_or_error);
- release_tree_vector (vec);
-
- /* We'll have called convert_from_reference on the call, which
- may well have added an indirect_ref. It's unneeded here,
- and in the way, so kill it. */
- if (TREE_CODE (t) == INDIRECT_REF)
- t = TREE_OPERAND (t, 0);
+ t = get_copy_assign (type);
- TREE_VEC_ELT (info, 2) = omp_clause_info_fndecl (t, type);
+ if (t && !trivial_fn_p (t))
+ TREE_VEC_ELT (info, 2) = t;
}
return errorcount != save_errorcount;
@@ -5005,7 +4933,7 @@ classtype_has_nothrow_assign_or_copy_p (tree type, bool assign_p)
return false;
fns = VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
}
- else if (TYPE_HAS_INIT_REF (type))
+ else if (TYPE_HAS_COPY_CTOR (type))
{
/* If construction of the copy constructor was postponed, create
it now. */
@@ -5064,13 +4992,13 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
return (!CP_TYPE_CONST_P (type1) && type_code1 != REFERENCE_TYPE
&& (trivial_type_p (type1)
|| (CLASS_TYPE_P (type1)
- && TYPE_HAS_TRIVIAL_ASSIGN_REF (type1))));
+ && TYPE_HAS_TRIVIAL_COPY_ASSIGN (type1))));
case CPTK_HAS_NOTHROW_CONSTRUCTOR:
type1 = strip_array_types (type1);
return (trait_expr_value (CPTK_HAS_TRIVIAL_CONSTRUCTOR, type1, type2)
|| (CLASS_TYPE_P (type1)
- && (t = locate_ctor (type1, NULL))
+ && (t = locate_ctor (type1))
&& TYPE_NOTHROW_P (TREE_TYPE (t))));
case CPTK_HAS_TRIVIAL_CONSTRUCTOR:
@@ -5089,7 +5017,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
type" wording for this trait. */
type1 = strip_array_types (type1);
return (trivial_type_p (type1) || type_code1 == REFERENCE_TYPE
- || (CLASS_TYPE_P (type1) && TYPE_HAS_TRIVIAL_INIT_REF (type1)));
+ || (CLASS_TYPE_P (type1) && TYPE_HAS_TRIVIAL_COPY_CTOR (type1)));
case CPTK_HAS_TRIVIAL_DESTRUCTOR:
type1 = strip_array_types (type1);
@@ -5098,8 +5026,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (type1)));
case CPTK_HAS_VIRTUAL_DESTRUCTOR:
- return (CLASS_TYPE_P (type1)
- && (t = locate_dtor (type1, NULL)) && DECL_VIRTUAL_P (t));
+ return type_has_virtual_destructor (type1);
case CPTK_IS_ABSTRACT:
return (CLASS_TYPE_P (type1) && CLASSTYPE_PURE_VIRTUALS (type1));
@@ -5151,7 +5078,8 @@ check_trait_type (tree type)
if (COMPLETE_TYPE_P (type))
return true;
- if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
+ if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)
+ && COMPLETE_TYPE_P (TREE_TYPE (type)))
return true;
if (VOID_TYPE_P (type))
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 9a5ee0fb2d8..d62f9d7acf6 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -31,9 +31,9 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "debug.h"
#include "convert.h"
-#include "tree-flow.h"
#include "cgraph.h"
#include "splay-tree.h"
+#include "gimple.h" /* gimple_has_body_p */
static tree bot_manip (tree *, int *, void *);
static tree bot_replace (tree *, int *, void *);
@@ -418,6 +418,7 @@ build_aggr_init_expr (tree type, tree init)
AGGR_INIT_EXPR_ARGP (init));
TREE_SIDE_EFFECTS (rval) = 1;
AGGR_INIT_VIA_CTOR_P (rval) = is_ctor;
+ TREE_NOTHROW (rval) = TREE_NOTHROW (init);
}
else
rval = init;
@@ -478,7 +479,7 @@ build_target_expr_with_type (tree init, tree type)
if (TREE_CODE (init) == TARGET_EXPR)
return init;
- else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type)
+ else if (CLASS_TYPE_P (type) && type_has_nontrivial_copy_init (type)
&& !VOID_TYPE_P (TREE_TYPE (init))
&& TREE_CODE (init) != COND_EXPR
&& TREE_CODE (init) != CONSTRUCTOR
@@ -496,7 +497,8 @@ build_target_expr_with_type (tree init, tree type)
/* Like the above function, but without the checking. This function should
only be used by code which is deliberately trying to subvert the type
- system, such as call_builtin_trap. */
+ system, such as call_builtin_trap. Or build_over_call, to avoid
+ infinite recursion. */
tree
force_target_expr (tree type, tree init)
@@ -1055,14 +1057,6 @@ strip_typedefs (tree t)
return cp_build_qualified_type (result, cp_type_quals (t));
}
-/* Returns true iff TYPE is a type variant created for a typedef. */
-
-bool
-typedef_variant_p (tree type)
-{
- return is_typedef_decl (TYPE_NAME (type));
-}
-
/* Setup a TYPE_DECL node as a typedef representation.
See comments of set_underlying_type in c-common.c. */
@@ -1466,12 +1460,16 @@ cxx_printable_name_translate (tree decl, int v)
tree
build_exception_variant (tree type, tree raises)
{
- tree v = TYPE_MAIN_VARIANT (type);
- int type_quals = TYPE_QUALS (type);
+ tree v;
+ int type_quals;
+
+ if (comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (type), ce_exact))
+ return type;
- for (; v; v = TYPE_NEXT_VARIANT (v))
+ type_quals = TYPE_QUALS (type);
+ for (v = TYPE_MAIN_VARIANT (type); v; v = TYPE_NEXT_VARIANT (v))
if (check_qualified_type (v, type, type_quals)
- && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
+ && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), ce_exact))
return v;
/* Need to build a new variant. */
@@ -2371,7 +2369,9 @@ type_has_nontrivial_default_init (const_tree t)
return 0;
}
-/* Returns true iff copying an object of type T is non-trivial. */
+/* Returns true iff copying an object of type T (including via move
+ constructor) is non-trivial. That is, T has no non-trivial copy
+ constructors and no non-trivial move constructors. */
bool
type_has_nontrivial_copy_init (const_tree t)
@@ -2379,12 +2379,38 @@ type_has_nontrivial_copy_init (const_tree t)
t = strip_array_types (CONST_CAST_TREE (t));
if (CLASS_TYPE_P (t))
- return TYPE_HAS_COMPLEX_INIT_REF (t);
+ {
+ gcc_assert (COMPLETE_TYPE_P (t));
+ return ((TYPE_HAS_COPY_CTOR (t)
+ && TYPE_HAS_COMPLEX_COPY_CTOR (t))
+ || TYPE_HAS_COMPLEX_MOVE_CTOR (t));
+ }
else
return 0;
}
-/* Returns 1 iff type T is a trivial type, as defined in [basic.types]. */
+/* Returns 1 iff type T is a trivially copyable type, as defined in
+ [basic.types] and [class]. */
+
+bool
+trivially_copyable_p (const_tree t)
+{
+ t = strip_array_types (CONST_CAST_TREE (t));
+
+ if (CLASS_TYPE_P (t))
+ return ((!TYPE_HAS_COPY_CTOR (t)
+ || !TYPE_HAS_COMPLEX_COPY_CTOR (t))
+ && !TYPE_HAS_COMPLEX_MOVE_CTOR (t)
+ && (!TYPE_HAS_COPY_ASSIGN (t)
+ || !TYPE_HAS_COMPLEX_COPY_ASSIGN (t))
+ && !TYPE_HAS_COMPLEX_MOVE_ASSIGN (t)
+ && TYPE_HAS_TRIVIAL_DESTRUCTOR (t));
+ else
+ return scalarish_type_p (t);
+}
+
+/* Returns 1 iff type T is a trivial type, as defined in [basic.types] and
+ [class]. */
bool
trivial_type_p (const_tree t)
@@ -2393,9 +2419,7 @@ trivial_type_p (const_tree t)
if (CLASS_TYPE_P (t))
return (TYPE_HAS_TRIVIAL_DFLT (t)
- && TYPE_HAS_TRIVIAL_INIT_REF (t)
- && TYPE_HAS_TRIVIAL_ASSIGN_REF (t)
- && TYPE_HAS_TRIVIAL_DESTRUCTOR (t));
+ && trivially_copyable_p (t));
else
return scalarish_type_p (t);
}
@@ -2644,10 +2668,8 @@ cp_build_type_attribute_variant (tree type, tree attributes)
tree new_type;
new_type = build_type_attribute_variant (type, attributes);
- if ((TREE_CODE (new_type) == FUNCTION_TYPE
- || TREE_CODE (new_type) == METHOD_TYPE)
- && (TYPE_RAISES_EXCEPTIONS (new_type)
- != TYPE_RAISES_EXCEPTIONS (type)))
+ if (TREE_CODE (new_type) == FUNCTION_TYPE
+ || TREE_CODE (new_type) == METHOD_TYPE)
new_type = build_exception_variant (new_type,
TYPE_RAISES_EXCEPTIONS (type));
@@ -2668,7 +2690,7 @@ cxx_type_hash_eq (const_tree typea, const_tree typeb)
gcc_assert (TREE_CODE (typea) == FUNCTION_TYPE);
return comp_except_specs (TYPE_RAISES_EXCEPTIONS (typea),
- TYPE_RAISES_EXCEPTIONS (typeb), 1);
+ TYPE_RAISES_EXCEPTIONS (typeb), ce_exact);
}
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
@@ -2837,7 +2859,12 @@ special_function_p (const_tree decl)
if (DECL_CONSTRUCTOR_P (decl))
return sfk_constructor;
if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR)
- return sfk_assignment_operator;
+ {
+ if (copy_fn_p (decl))
+ return sfk_copy_assignment;
+ if (move_fn_p (decl))
+ return sfk_move_assignment;
+ }
if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
return sfk_destructor;
if (DECL_COMPLETE_DESTRUCTOR_P (decl))
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a7d04ddbc5b..20345b551ed 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -39,12 +39,12 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "target.h"
#include "convert.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "params.h"
static tree pfn_from_ptrmemfunc (tree);
static tree delta_from_ptrmemfunc (tree);
-static tree convert_for_assignment (tree, tree, const char *, tree, int,
+static tree convert_for_assignment (tree, tree, impl_conv_rhs, tree, int,
tsubst_flags_t, int);
static tree cp_pointer_int_sum (enum tree_code, tree, tree);
static tree rationalize_conditional_expr (enum tree_code, tree,
@@ -829,26 +829,17 @@ merge_types (tree t1, tree t2)
/* Simple way if one arg fails to specify argument types. */
if (p1 == NULL_TREE || TREE_VALUE (p1) == void_type_node)
- {
- parms = p2;
- raises = TYPE_RAISES_EXCEPTIONS (t2);
- }
+ parms = p2;
else if (p2 == NULL_TREE || TREE_VALUE (p2) == void_type_node)
- {
- parms = p1;
- raises = TYPE_RAISES_EXCEPTIONS (t1);
- }
+ parms = p1;
else
- {
- parms = commonparms (p1, p2);
- /* In cases where we're merging a real declaration with a
- built-in declaration, t1 is the real one. */
- raises = TYPE_RAISES_EXCEPTIONS (t1);
- }
+ parms = commonparms (p1, p2);
rval = build_function_type (valtype, parms);
gcc_assert (type_memfn_quals (t1) == type_memfn_quals (t2));
rval = apply_memfn_quals (rval, type_memfn_quals (t1));
+ raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1),
+ TYPE_RAISES_EXCEPTIONS (t2));
t1 = build_exception_variant (rval, raises);
break;
}
@@ -858,7 +849,8 @@ merge_types (tree t1, tree t2)
/* Get this value the long way, since TYPE_METHOD_BASETYPE
is just the main variant of this. */
tree basetype = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t2)));
- tree raises = TYPE_RAISES_EXCEPTIONS (t1);
+ tree raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1),
+ TYPE_RAISES_EXCEPTIONS (t2));
tree t3;
/* If this was a member function type, get back to the
@@ -989,13 +981,14 @@ comp_except_types (tree a, tree b, bool exact)
}
/* Return true if TYPE1 and TYPE2 are equivalent exception specifiers.
- If EXACT is false, T2 can be stricter than T1 (according to 15.4/7),
- otherwise it must be exact. Exception lists are unordered, but
- we've already filtered out duplicates. Most lists will be in order,
- we should try to make use of that. */
+ If EXACT is ce_derived, T2 can be stricter than T1 (according to 15.4/5).
+ If EXACT is ce_normal, the compatibility rules in 15.4/3 apply.
+ If EXACT is ce_exact, the specs must be exactly the same. Exception lists
+ are unordered, but we've already filtered out duplicates. Most lists will
+ be in order, we should try to make use of that. */
bool
-comp_except_specs (const_tree t1, const_tree t2, bool exact)
+comp_except_specs (const_tree t1, const_tree t2, int exact)
{
const_tree probe;
const_tree base;
@@ -1004,14 +997,42 @@ comp_except_specs (const_tree t1, const_tree t2, bool exact)
if (t1 == t2)
return true;
+ /* First handle noexcept. */
+ if (exact < ce_exact)
+ {
+ /* noexcept(false) is compatible with any throwing dynamic-exc-spec
+ and stricter than any spec. */
+ if (t1 == noexcept_false_spec)
+ return !nothrow_spec_p (t2) || exact == ce_derived;
+ /* Even a derived noexcept(false) is compatible with a throwing
+ dynamic spec. */
+ if (t2 == noexcept_false_spec)
+ return !nothrow_spec_p (t1);
+
+ /* Otherwise, if we aren't looking for an exact match, noexcept is
+ equivalent to throw(). */
+ if (t1 == noexcept_true_spec)
+ t1 = empty_except_spec;
+ if (t2 == noexcept_true_spec)
+ t2 = empty_except_spec;
+ }
+
+ /* If any noexcept is left, it is only comparable to itself;
+ either we're looking for an exact match or we're redeclaring a
+ template with dependent noexcept. */
+ if ((t1 && TREE_PURPOSE (t1))
+ || (t2 && TREE_PURPOSE (t2)))
+ return (t1 && t2
+ && cp_tree_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2)));
+
if (t1 == NULL_TREE) /* T1 is ... */
- return t2 == NULL_TREE || !exact;
+ return t2 == NULL_TREE || exact == ce_derived;
if (!TREE_VALUE (t1)) /* t1 is EMPTY */
return t2 != NULL_TREE && !TREE_VALUE (t2);
if (t2 == NULL_TREE) /* T2 is ... */
return false;
if (TREE_VALUE (t1) && !TREE_VALUE (t2)) /* T2 is EMPTY, T1 is not */
- return !exact;
+ return exact == ce_derived;
/* Neither set is ... or EMPTY, make sure each part of T2 is in T1.
Count how many we find, to determine exactness. For exact matching and
@@ -1026,7 +1047,7 @@ comp_except_specs (const_tree t1, const_tree t2, bool exact)
if (comp_except_types (a, b, exact))
{
- if (probe == base && exact)
+ if (probe == base && exact > ce_derived)
base = TREE_CHAIN (probe);
length++;
break;
@@ -1035,7 +1056,7 @@ comp_except_specs (const_tree t1, const_tree t2, bool exact)
if (probe == NULL_TREE)
return false;
}
- return !exact || base == NULL_TREE || length == list_length (t1);
+ return exact == ce_derived || base == NULL_TREE || length == list_length (t1);
}
/* Compare the array types T1 and T2. ALLOW_REDECLARATION is true if
@@ -2229,6 +2250,7 @@ build_class_member_access_expr (tree object, tree member,
{
/* A static data member. */
result = member;
+ mark_exp_read (object);
/* If OBJECT has side-effects, they are supposed to occur. */
if (TREE_SIDE_EFFECTS (object))
result = build2 (COMPOUND_EXPR, TREE_TYPE (result), object, result);
@@ -3473,7 +3495,7 @@ convert_arguments (tree typelist, VEC(tree,gc) **values, tree fndecl,
{
parmval = convert_for_initialization
(NULL_TREE, type, val, flags,
- "argument passing", fndecl, i, complain);
+ ICR_ARGPASS, fndecl, i, complain);
parmval = convert_for_arg_passing (type, parmval);
}
@@ -4759,7 +4781,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
tree val;
const char *invalid_op_diag;
- if (error_operand_p (arg))
+ if (!arg || error_operand_p (arg))
return error_mark_node;
if ((invalid_op_diag
@@ -5466,14 +5488,30 @@ build_x_conditional_expr (tree ifexp, tree op1, tree op2,
/* Given a list of expressions, return a compound expression
that performs them all and returns the value of the last of them. */
-tree build_x_compound_expr_from_list (tree list, const char *msg)
+tree
+build_x_compound_expr_from_list (tree list, expr_list_kind exp)
{
tree expr = TREE_VALUE (list);
if (TREE_CHAIN (list))
{
- if (msg)
- permerror (input_location, "%s expression list treated as compound expression", msg);
+ switch (exp)
+ {
+ case ELK_INIT:
+ permerror (input_location, "expression list treated as compound "
+ "expression in initializer");
+ break;
+ case ELK_MEM_INIT:
+ permerror (input_location, "expression list treated as compound "
+ "expression in mem-initializer");
+ break;
+ case ELK_FUNC_CAST:
+ permerror (input_location, "expression list treated as compound "
+ "expression in functional cast");
+ break;
+ default:
+ gcc_unreachable ();
+ }
for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list))
expr = build_x_compound_expr (expr, TREE_VALUE (list),
@@ -6747,10 +6785,10 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
/* Calls with INIT_EXPR are all direct-initialization, so don't set
LOOKUP_ONLYCONVERTING. */
newrhs = convert_for_initialization (lhs, olhstype, newrhs, LOOKUP_NORMAL,
- "initialization", NULL_TREE, 0,
+ ICR_INIT, NULL_TREE, 0,
complain);
else
- newrhs = convert_for_assignment (olhstype, newrhs, "assignment",
+ newrhs = convert_for_assignment (olhstype, newrhs, ICR_ASSIGN,
NULL_TREE, 0, complain, LOOKUP_IMPLICIT);
if (!same_type_p (lhstype, olhstype))
@@ -7019,7 +7057,7 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p)
}
/* Handle null pointer to member function conversions. */
- if (integer_zerop (pfn))
+ if (null_ptr_cst_p (pfn))
{
pfn = build_c_cast (input_location, type, integer_zero_node);
return build_ptrmemfunc1 (to_type,
@@ -7150,14 +7188,15 @@ delta_from_ptrmemfunc (tree t)
}
/* Convert value RHS to type TYPE as preparation for an assignment to
- an lvalue of type TYPE. ERRTYPE is a string to use in error
- messages: "assignment", "return", etc. If FNDECL is non-NULL, we
- are doing the conversion in order to pass the PARMNUMth argument of
- FNDECL. */
+ an lvalue of type TYPE. ERRTYPE indicates what kind of error the
+ implicit conversion is. If FNDECL is non-NULL, we are doing the
+ conversion in order to pass the PARMNUMth argument of FNDECL.
+ If FNDECL is NULL, we are doing the conversion in function pointer
+ argument passing, conversion in initialization, etc. */
static tree
convert_for_assignment (tree type, tree rhs,
- const char *errtype, tree fndecl, int parmnum,
+ impl_conv_rhs errtype, tree fndecl, int parmnum,
tsubst_flags_t complain, int flags)
{
tree rhstype;
@@ -7194,23 +7233,25 @@ convert_for_assignment (tree type, tree rhs,
if (c_dialect_objc ())
{
int parmno;
+ tree selector;
tree rname = fndecl;
- if (!strcmp (errtype, "assignment"))
- parmno = -1;
- else if (!strcmp (errtype, "initialization"))
- parmno = -2;
- else
- {
- tree selector = objc_message_selector ();
-
- parmno = parmnum;
-
- if (selector && parmno > 1)
- {
- rname = selector;
- parmno -= 1;
- }
+ switch (errtype)
+ {
+ case ICR_ASSIGN:
+ parmno = -1;
+ break;
+ case ICR_INIT:
+ parmno = -2;
+ break;
+ default:
+ selector = objc_message_selector ();
+ parmno = parmnum;
+ if (selector && parmno > 1)
+ {
+ rname = selector;
+ parmno -= 1;
+ }
}
if (objc_compare_types (type, rhstype, parmno, rname))
@@ -7247,8 +7288,35 @@ convert_for_assignment (tree type, tree rhs,
error ("cannot convert %qT to %qT for argument %qP to %qD",
rhstype, type, parmnum, fndecl);
else
- error ("cannot convert %qT to %qT in %s", rhstype, type,
- errtype);
+ switch (errtype)
+ {
+ case ICR_DEFAULT_ARGUMENT:
+ error ("cannot convert %qT to %qT in default argument",
+ rhstype, type);
+ break;
+ case ICR_ARGPASS:
+ error ("cannot convert %qT to %qT in argument passing",
+ rhstype, type);
+ break;
+ case ICR_CONVERTING:
+ error ("cannot convert %qT to %qT",
+ rhstype, type);
+ break;
+ case ICR_INIT:
+ error ("cannot convert %qT to %qT in initialization",
+ rhstype, type);
+ break;
+ case ICR_RETURN:
+ error ("cannot convert %qT to %qT in return",
+ rhstype, type);
+ break;
+ case ICR_ASSIGN:
+ error ("cannot convert %qT to %qT in assignment",
+ rhstype, type);
+ break;
+ default:
+ gcc_unreachable();
+ }
}
return error_mark_node;
}
@@ -7260,9 +7328,42 @@ convert_for_assignment (tree type, tree rhs,
&& coder == codel
&& check_missing_format_attribute (type, rhstype)
&& (complain & tf_warning))
- warning (OPT_Wmissing_format_attribute,
- "%s might be a candidate for a format attribute",
- errtype);
+ switch (errtype)
+ {
+ case ICR_ARGPASS:
+ case ICR_DEFAULT_ARGUMENT:
+ if (fndecl)
+ warning (OPT_Wmissing_format_attribute,
+ "parameter %qP of %qD might be a candidate "
+ "for a format attribute", parmnum, fndecl);
+ else
+ warning (OPT_Wmissing_format_attribute,
+ "parameter might be a candidate "
+ "for a format attribute");
+ break;
+ case ICR_CONVERTING:
+ warning (OPT_Wmissing_format_attribute,
+ "target of conversion might be might be a candidate "
+ "for a format attribute");
+ break;
+ case ICR_INIT:
+ warning (OPT_Wmissing_format_attribute,
+ "target of initialization might be a candidate "
+ "for a format attribute");
+ break;
+ case ICR_RETURN:
+ warning (OPT_Wmissing_format_attribute,
+ "return type might be a candidate "
+ "for a format attribute");
+ break;
+ case ICR_ASSIGN:
+ warning (OPT_Wmissing_format_attribute,
+ "left-hand side of assignment might be a candidate "
+ "for a format attribute");
+ break;
+ default:
+ gcc_unreachable();
+ }
}
/* If -Wparentheses, warn about a = b = c when a has type bool and b
@@ -7288,7 +7389,7 @@ convert_for_assignment (tree type, tree rhs,
/* Convert RHS to be of type TYPE.
If EXP is nonzero, it is the target of the initialization.
- ERRTYPE is a string to use in error messages.
+ ERRTYPE indicates what kind of error the implicit conversion is.
Two major differences between the behavior of
`convert_for_assignment' and `convert_for_initialization'
@@ -7304,7 +7405,7 @@ convert_for_assignment (tree type, tree rhs,
tree
convert_for_initialization (tree exp, tree type, tree rhs, int flags,
- const char *errtype, tree fndecl, int parmnum,
+ impl_conv_rhs errtype, tree fndecl, int parmnum,
tsubst_flags_t complain)
{
enum tree_code codel = TREE_CODE (type);
@@ -7695,7 +7796,7 @@ check_return_expr (tree retval, bool *no_warning)
to the type of return value's location to handle the
case that functype is smaller than the valtype. */
retval = convert_for_initialization
- (NULL_TREE, functype, retval, flags, "return", NULL_TREE, 0,
+ (NULL_TREE, functype, retval, flags, ICR_RETURN, NULL_TREE, 0,
tf_warning_or_error);
retval = convert (valtype, retval);
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 7603ead5463..f62bbb5d950 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -352,7 +352,7 @@ abstract_virtuals_error (tree decl, tree type)
slot = htab_find_slot_with_hash (abstract_pending_vars, type,
(hashval_t)TYPE_UID (type), INSERT);
- pat = GGC_NEW (struct pending_abstract_type);
+ pat = ggc_alloc_pending_abstract_type ();
pat->type = type;
pat->decl = decl;
pat->locus = ((decl && DECL_P (decl))
@@ -714,7 +714,7 @@ store_init_value (tree decl, tree init, int flags)
if (MAYBE_CLASS_TYPE_P (type))
{
- gcc_assert (TYPE_HAS_TRIVIAL_INIT_REF (type)
+ gcc_assert (!type_has_nontrivial_copy_init (type)
|| TREE_CODE (init) == CONSTRUCTOR);
if (TREE_CODE (init) == TREE_LIST)
@@ -727,10 +727,9 @@ store_init_value (tree decl, tree init, int flags)
else if (TREE_CODE (init) == TREE_LIST
&& TREE_TYPE (init) != unknown_type_node)
{
- if (TREE_CODE (decl) == RESULT_DECL)
- init = build_x_compound_expr_from_list (init,
- "return value initializer");
- else if (TREE_CODE (init) == TREE_LIST
+ gcc_assert (TREE_CODE (decl) != RESULT_DECL);
+
+ if (TREE_CODE (init) == TREE_LIST
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
{
error ("cannot initialize arrays using this syntax");
@@ -738,7 +737,7 @@ store_init_value (tree decl, tree init, int flags)
}
else
/* We get here with code like `int a (2);' */
- init = build_x_compound_expr_from_list (init, "initializer");
+ init = build_x_compound_expr_from_list (init, ELK_INIT);
}
/* End of special C++ code. */
@@ -909,7 +908,7 @@ digest_init_r (tree type, tree init, bool nested, int flags)
if (cxx_dialect != cxx98 && nested)
check_narrowing (type, init);
init = convert_for_initialization (0, type, init, flags,
- "initialization", NULL_TREE, 0,
+ ICR_INIT, NULL_TREE, 0,
tf_warning_or_error);
exp = &init;
@@ -963,7 +962,7 @@ digest_init_r (tree type, tree init, bool nested, int flags)
return convert_for_initialization (NULL_TREE, type, init,
flags,
- "initialization", NULL_TREE, 0,
+ ICR_INIT, NULL_TREE, 0,
tf_warning_or_error);
}
}
@@ -1419,18 +1418,14 @@ build_x_arrow (tree expr)
/*overloaded_p=*/NULL,
tf_warning_or_error)))
{
- tree t;
- unsigned ix;
-
if (expr == error_mark_node)
return error_mark_node;
- for (ix = 0; VEC_iterate (tree, types_memoized, ix, t); ix++)
- if (TREE_TYPE (expr) == t)
- {
- error ("circular pointer delegation detected");
- return error_mark_node;
- }
+ if (vec_member (TREE_TYPE (expr), types_memoized))
+ {
+ error ("circular pointer delegation detected");
+ return error_mark_node;
+ }
VEC_safe_push (tree, gc, types_memoized, TREE_TYPE (expr));
last_rval = expr;
@@ -1483,6 +1478,9 @@ build_m_component_ref (tree datum, tree component)
if (error_operand_p (datum) || error_operand_p (component))
return error_mark_node;
+ mark_lvalue_use (datum);
+ mark_rvalue_use (component);
+
ptrmem_type = TREE_TYPE (component);
if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
{
@@ -1596,7 +1594,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
return cp_convert (type, integer_zero_node);
/* This must build a C cast. */
- parms = build_x_compound_expr_from_list (parms, "functional cast");
+ parms = build_x_compound_expr_from_list (parms, ELK_FUNC_CAST);
return cp_build_c_cast (type, parms, complain);
}
@@ -1721,10 +1719,14 @@ merge_exception_specifiers (tree list, tree add)
{
if (!list || !add)
return NULL_TREE;
- else if (!TREE_VALUE (list))
- return add;
+ /* For merging noexcept(true) and throw(), take the more recent one (LIST).
+ A throw(type-list) spec takes precedence over a noexcept(false) spec.
+ Any other noexcept-spec should only be merged with an equivalent one.
+ So the !TREE_VALUE code below is correct for all cases. */
else if (!TREE_VALUE (add))
return list;
+ else if (!TREE_VALUE (list))
+ return add;
else
{
tree orig_list = list;
diff --git a/gcc/cppspec.c b/gcc/cppspec.c
index dfae81ead09..c3adaa1aa58 100644
--- a/gcc/cppspec.c
+++ b/gcc/cppspec.c
@@ -103,7 +103,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
need_E = 0;
else if (argv[i][1] == 'S' || argv[i][1] == 'c')
{
- fatal_error ("\"%s\" is not a valid option to the "
+ fatal_error ("%qs is not a valid option to the "
"preprocessor", argv[i]);
return;
}
diff --git a/gcc/cse.c b/gcc/cse.c
index e45c9b25b16..82921f66861 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -2669,26 +2669,16 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse)
case MEM:
if (for_gcse)
{
+ /* Can't merge two expressions in different alias sets, since we
+ can decide that the expression is transparent in a block when
+ it isn't, due to it being set with the different alias set. */
+ if (MEM_ALIAS_SET (x) != MEM_ALIAS_SET (y))
+ return 0;
+
/* A volatile mem should not be considered equivalent to any
other. */
if (MEM_VOLATILE_P (x) || MEM_VOLATILE_P (y))
return 0;
-
- /* Can't merge two expressions in different alias sets, since we
- can decide that the expression is transparent in a block when
- it isn't, due to it being set with the different alias set.
-
- Also, can't merge two expressions with different MEM_ATTRS.
- They could e.g. be two different entities allocated into the
- same space on the stack (see e.g. PR25130). In that case, the
- MEM addresses can be the same, even though the two MEMs are
- absolutely not equivalent.
-
- But because really all MEM attributes should be the same for
- equivalent MEMs, we just use the invariant that MEMs that have
- the same attributes share the same mem_attrs data structure. */
- if (MEM_ATTRS (x) != MEM_ATTRS (y))
- return 0;
}
break;
@@ -6315,9 +6305,9 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
}
}
+ optimize_this_for_speed_p = optimize_bb_for_speed_p (bb);
FOR_BB_INSNS (bb, insn)
{
- optimize_this_for_speed_p = optimize_bb_for_speed_p (bb);
/* If we have processed 1,000 insns, flush the hash table to
avoid extreme quadratic behavior. We must not include NOTEs
in the count since there may be more of them when generating
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 5e819cd9797..28ed6d7b348 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -178,6 +178,7 @@ static cselib_val dummy_val;
that is constant through the whole function and should never be
eliminated. */
static cselib_val *cfa_base_preserved_val;
+static unsigned int cfa_base_preserved_regno;
/* Used to list all values that contain memory reference.
May or may not contain the useless values - the list is compacted
@@ -338,7 +339,7 @@ cselib_reset_table (unsigned int num)
if (cfa_base_preserved_val)
{
- unsigned int regno = REGNO (cfa_base_preserved_val->locs->loc);
+ unsigned int regno = cfa_base_preserved_regno;
unsigned int new_used_regs = 0;
for (i = 0; i < n_used_regs; i++)
if (used_regs[i] == regno)
@@ -571,12 +572,15 @@ cselib_preserved_value_p (cselib_val *v)
never invalidated and preserved across cselib_reset_table calls. */
void
-cselib_preserve_cfa_base_value (cselib_val *v)
+cselib_preserve_cfa_base_value (cselib_val *v, unsigned int regno)
{
if (cselib_preserve_constants
&& v->locs
&& REG_P (v->locs->loc))
- cfa_base_preserved_val = v;
+ {
+ cfa_base_preserved_val = v;
+ cfa_base_preserved_regno = regno;
+ }
}
/* Clean all non-constant expressions in the hash table, but retain
@@ -1783,7 +1787,9 @@ cselib_invalidate_regno (unsigned int regno, enum machine_mode mode)
if (i < FIRST_PSEUDO_REGISTER && v != NULL)
this_last = end_hard_regno (GET_MODE (v->val_rtx), i) - 1;
- if (this_last < regno || v == NULL || v == cfa_base_preserved_val)
+ if (this_last < regno || v == NULL
+ || (v == cfa_base_preserved_val
+ && i == cfa_base_preserved_regno))
{
l = &(*l)->next;
continue;
@@ -2266,6 +2272,7 @@ cselib_finish (void)
cselib_discard_hook = NULL;
cselib_preserve_constants = false;
cfa_base_preserved_val = NULL;
+ cfa_base_preserved_regno = INVALID_REGNUM;
free_alloc_pool (elt_list_pool);
free_alloc_pool (elt_loc_list_pool);
free_alloc_pool (cselib_val_pool);
diff --git a/gcc/cselib.h b/gcc/cselib.h
index 90d963888c6..4259e396fdf 100644
--- a/gcc/cselib.h
+++ b/gcc/cselib.h
@@ -99,6 +99,6 @@ extern unsigned int cselib_get_next_uid (void);
extern void cselib_preserve_value (cselib_val *);
extern bool cselib_preserved_value_p (cselib_val *);
extern void cselib_preserve_only_values (void);
-extern void cselib_preserve_cfa_base_value (cselib_val *);
+extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int);
extern void dump_cselib_table (FILE *);
diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def
index 78553a41d6e..0d73d942073 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -160,6 +160,7 @@ DEBUG_COUNTER (global_alloc_at_reg)
DEBUG_COUNTER (hoist)
DEBUG_COUNTER (ia64_sched2)
DEBUG_COUNTER (if_conversion)
+DEBUG_COUNTER (if_conversion_tree)
DEBUG_COUNTER (if_after_combine)
DEBUG_COUNTER (if_after_reload)
DEBUG_COUNTER (local_alloc_for_sched)
@@ -167,6 +168,7 @@ DEBUG_COUNTER (postreload_cse)
DEBUG_COUNTER (pre)
DEBUG_COUNTER (pre_insn)
DEBUG_COUNTER (treepre_insert)
+DEBUG_COUNTER (tree_sra)
DEBUG_COUNTER (sched2_func)
DEBUG_COUNTER (sched_block)
DEBUG_COUNTER (sched_func)
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index a314e7b4430..066e91f191a 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -1,6 +1,6 @@
/* Output dbx-format symbol table information from GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -357,6 +357,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
dbxout_source_line, /* source_line */
dbxout_begin_prologue, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
+ debug_nothing_int_charstar, /* begin_epilogue */
debug_nothing_int_charstar, /* end_epilogue */
#ifdef DBX_FUNCTION_FIRST
dbxout_begin_function,
@@ -399,6 +400,7 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
xcoffout_source_line,
xcoffout_begin_prologue, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
+ debug_nothing_int_charstar, /* begin_epilogue */
xcoffout_end_epilogue,
debug_nothing_tree, /* begin_function */
xcoffout_end_function,
@@ -1004,7 +1006,7 @@ dbxout_init (const char *input_file_name)
const char *mapped_name;
typevec_len = 100;
- typevec = GGC_CNEWVEC (struct typeinfo, typevec_len);
+ typevec = ggc_alloc_cleared_vec_typeinfo (typevec_len);
/* stabstr_ob contains one string, which will be just fine with
1-byte alignment. */
diff --git a/gcc/dce.c b/gcc/dce.c
index 12f3af0760f..ee18b58c4ab 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -94,14 +94,6 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores)
rtx body, x;
int i;
- /* Don't delete jumps, notes and the like. */
- if (!NONJUMP_INSN_P (insn))
- return false;
-
- /* Don't delete insns that can throw. */
- if (!insn_nothrow_p (insn))
- return false;
-
if (CALL_P (insn)
/* We cannot delete calls inside of the recursive dce because
this may cause basic blocks to be deleted and this messes up
@@ -116,6 +108,14 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores)
&& !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)))
return find_call_stack_args (insn, false, fast, arg_stores);
+ /* Don't delete jumps, notes and the like. */
+ if (!NONJUMP_INSN_P (insn))
+ return false;
+
+ /* Don't delete insns that can throw. */
+ if (!insn_nothrow_p (insn))
+ return false;
+
body = PATTERN (insn);
switch (GET_CODE (body))
{
@@ -904,19 +904,18 @@ dce_process_block (basic_block bb, bool redo_out, bitmap au)
FOR_BB_INSNS_REVERSE (bb, insn)
if (INSN_P (insn))
{
- bool needed = false;
+ bool needed = marked_insn_p (insn);
/* The insn is needed if there is someone who uses the output. */
- for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
- if (bitmap_bit_p (local_live, DF_REF_REGNO (*def_rec))
- || bitmap_bit_p (au, DF_REF_REGNO (*def_rec)))
- {
- needed = true;
- break;
- }
-
- if (needed)
- mark_insn (insn, true);
+ if (!needed)
+ for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+ if (bitmap_bit_p (local_live, DF_REF_REGNO (*def_rec))
+ || bitmap_bit_p (au, DF_REF_REGNO (*def_rec)))
+ {
+ needed = true;
+ mark_insn (insn, true);
+ break;
+ }
/* No matter if the instruction is needed or not, we remove
any regno in the defs from the live set. */
@@ -924,7 +923,7 @@ dce_process_block (basic_block bb, bool redo_out, bitmap au)
/* On the other hand, we do not allow the dead uses to set
anything in local_live. */
- if (marked_insn_p (insn))
+ if (needed)
df_simulate_uses (insn, local_live);
}
@@ -961,8 +960,8 @@ fast_dce (bool byte_level)
df_simulate_fixup_sets has the disadvantage of calling
bb_has_eh_pred once per insn, so we cache the information
here. */
- bitmap au = df->regular_block_artificial_uses;
- bitmap au_eh = df->eh_block_artificial_uses;
+ bitmap au = &df->regular_block_artificial_uses;
+ bitmap au_eh = &df->eh_block_artificial_uses;
int i;
prescan_insns_for_dce (true);
diff --git a/gcc/ddg.c b/gcc/ddg.c
index 09932ae3c74..72e12de03ca 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -192,7 +192,7 @@ create_ddg_dep_from_intra_loop_link (ddg_ptr g, ddg_node_ptr src_node,
first_def = df_bb_regno_first_def_find (g->bb, regno);
gcc_assert (first_def);
- if (bitmap_bit_p (bb_info->gen, DF_REF_ID (first_def)))
+ if (bitmap_bit_p (&bb_info->gen, DF_REF_ID (first_def)))
return;
}
}
@@ -263,7 +263,7 @@ add_cross_iteration_register_deps (ddg_ptr g, df_ref last_def)
#ifdef ENABLE_CHECKING
if (DF_REF_ID (last_def) != DF_REF_ID (first_def))
- gcc_assert (!bitmap_bit_p (bb_info->gen, DF_REF_ID (first_def)));
+ gcc_assert (!bitmap_bit_p (&bb_info->gen, DF_REF_ID (first_def)));
#endif
/* Create inter-loop true dependences and anti dependences. */
@@ -338,7 +338,7 @@ build_inter_loop_deps (ddg_ptr g)
rd_bb_info = DF_RD_BB_INFO (g->bb);
/* Find inter-loop register output, true and anti deps. */
- EXECUTE_IF_SET_IN_BITMAP (rd_bb_info->gen, 0, rd_num, bi)
+ EXECUTE_IF_SET_IN_BITMAP (&rd_bb_info->gen, 0, rd_num, bi)
{
df_ref rd = DF_DEFS_GET (rd_num);
diff --git a/gcc/debug.c b/gcc/debug.c
index c60a78d4708..c53d05eae58 100644
--- a/gcc/debug.c
+++ b/gcc/debug.c
@@ -1,5 +1,5 @@
/* Do-nothing debug hooks for GCC.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
debug_nothing_int_charstar_int_bool, /* source_line */
debug_nothing_int_charstar, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
+ debug_nothing_int_charstar, /* begin_epilogue */
debug_nothing_int_charstar, /* end_epilogue */
debug_nothing_tree, /* begin_function */
debug_nothing_int, /* end_function */
diff --git a/gcc/debug.h b/gcc/debug.h
index 079ecb623ad..2ca0ad86e50 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -1,5 +1,5 @@
/* Debug hooks for GCC.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -75,6 +75,9 @@ struct gcc_debug_hooks
function. */
void (* end_prologue) (unsigned int line, const char *file);
+ /* Called at beginning of epilogue code. */
+ void (* begin_epilogue) (unsigned int line, const char *file);
+
/* Record end of epilogue code. */
void (* end_epilogue) (unsigned int line, const char *file);
@@ -194,6 +197,8 @@ extern const struct gcc_debug_hooks vmsdbg_debug_hooks;
/* Dwarf2 frame information. */
extern void dwarf2out_begin_prologue (unsigned int, const char *);
+extern void dwarf2out_vms_end_prologue (unsigned int, const char *);
+extern void dwarf2out_vms_begin_epilogue (unsigned int, const char *);
extern void dwarf2out_end_epilogue (unsigned int, const char *);
extern void dwarf2out_frame_init (void);
extern void dwarf2out_frame_finish (void);
diff --git a/gcc/defaults.h b/gcc/defaults.h
index e6b96b6c1c2..98ffc82e4b2 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -32,14 +32,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GET_ENVIRONMENT(VALUE, NAME) do { (VALUE) = getenv (NAME); } while (0)
#endif
-#define obstack_chunk_alloc ((void *(*) (long)) xmalloc)
-#define obstack_chunk_free ((void (*) (void *)) free)
-#define OBSTACK_CHUNK_SIZE 0
-#define gcc_obstack_init(OBSTACK) \
- _obstack_begin ((OBSTACK), OBSTACK_CHUNK_SIZE, 0, \
- obstack_chunk_alloc, \
- obstack_chunk_free)
-
/* Store in OUTPUT a string (made with alloca) containing an
assembler-name for a local static variable or function named NAME.
LABELNO is an integer which is different for each call. */
@@ -989,10 +981,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif /* old constraint mechanism in use */
-#ifndef REGISTER_MOVE_COST
-#define REGISTER_MOVE_COST(m, x, y) 2
-#endif
-
/* Determine whether the entire c99 runtime
is present in the runtime library. */
#ifndef TARGET_C99_FUNCTIONS
@@ -1165,4 +1153,217 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X) && GET_CODE (X) != CONST_DOUBLE)
#endif
+#ifndef MAX_FIXED_MODE_SIZE
+#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode)
+#endif
+
+/* Nonzero if structures and unions should be returned in memory.
+
+ This should only be defined if compatibility with another compiler or
+ with an ABI is needed, because it results in slower code. */
+
+#ifndef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 1
+#endif
+
+#ifdef GCC_INSN_FLAGS_H
+/* Dependent default target macro definitions
+
+ This section of defaults.h defines target macros that depend on generated
+ headers. This is a bit awkward: We want to put all default definitions
+ for target macros in defaults.h, but some of the defaults depend on the
+ HAVE_* flags defines of insn-flags.h. But insn-flags.h is not always
+ included by files that do include defaults.h.
+
+ Fortunately, the default macro definitions that depend on the HAVE_*
+ macros are also the ones that will only be used inside GCC itself, i.e.
+ not in the gen* programs or in target objects like libgcc.
+
+ Obviously, it would be best to keep this section of defaults.h as small
+ as possible, by converting the macros defined below to target hooks or
+ functions.
+*/
+
+/* Just because the user configured --with-sjlj-exceptions=no doesn't
+ mean that we can use call frame exceptions. Detect that the target
+ has appropriate support. */
+
+#ifndef MUST_USE_SJLJ_EXCEPTIONS
+# if defined (EH_RETURN_DATA_REGNO) \
+ && (defined (TARGET_UNWIND_INFO) \
+ || (DWARF2_UNWIND_INFO \
+ && (defined (EH_RETURN_HANDLER_RTX) \
+ || defined (HAVE_eh_return))))
+# define MUST_USE_SJLJ_EXCEPTIONS 0
+# else
+# define MUST_USE_SJLJ_EXCEPTIONS 1
+# endif
+#endif
+
+#ifdef CONFIG_SJLJ_EXCEPTIONS
+# if CONFIG_SJLJ_EXCEPTIONS == 1
+# define USING_SJLJ_EXCEPTIONS 1
+# endif
+# if CONFIG_SJLJ_EXCEPTIONS == 0
+# define USING_SJLJ_EXCEPTIONS 0
+# if !defined(EH_RETURN_DATA_REGNO)
+ #error "EH_RETURN_DATA_REGNO required"
+# endif
+# if ! (defined(TARGET_UNWIND_INFO) || DWARF2_UNWIND_INFO)
+ #error "{DWARF2,TARGET}_UNWIND_INFO required"
+# endif
+# if !defined(TARGET_UNWIND_INFO) \
+ && !(defined(EH_RETURN_HANDLER_RTX) || defined(HAVE_eh_return))
+ #error "EH_RETURN_HANDLER_RTX or eh_return required"
+# endif
+/* Usually the above error checks will have already triggered an
+ error, but backends may set MUST_USE_SJLJ_EXCEPTIONS for their own
+ reasons. */
+# if MUST_USE_SJLJ_EXCEPTIONS
+ #error "Must use SJLJ exceptions but configured not to"
+# endif
+# endif
+#else
+# define USING_SJLJ_EXCEPTIONS MUST_USE_SJLJ_EXCEPTIONS
+#endif
+
+/* The default branch cost is 1. */
+#ifndef BRANCH_COST
+#define BRANCH_COST(speed_p, predictable_p) 1
+#endif
+
+/* If a memory-to-memory move would take MOVE_RATIO or more simple
+ move-instruction sequences, we will do a movmem or libcall instead. */
+
+#ifndef MOVE_RATIO
+#if defined (HAVE_movmemqi) || defined (HAVE_movmemhi) || defined (HAVE_movmemsi) || defined (HAVE_movmemdi) || defined (HAVE_movmemti)
+#define MOVE_RATIO(speed) 2
+#else
+/* If we are optimizing for space (-Os), cut down the default move ratio. */
+#define MOVE_RATIO(speed) ((speed) ? 15 : 3)
+#endif
+#endif
+
+/* If a clear memory operation would take CLEAR_RATIO or more simple
+ move-instruction sequences, we will do a setmem or libcall instead. */
+
+#ifndef CLEAR_RATIO
+#if defined (HAVE_setmemqi) || defined (HAVE_setmemhi) || defined (HAVE_setmemsi) || defined (HAVE_setmemdi) || defined (HAVE_setmemti)
+#define CLEAR_RATIO(speed) 2
+#else
+/* If we are optimizing for space, cut down the default clear ratio. */
+#define CLEAR_RATIO(speed) ((speed) ? 15 :3)
+#endif
+#endif
+
+/* If a memory set (to value other than zero) operation would take
+ SET_RATIO or more simple move-instruction sequences, we will do a movmem
+ or libcall instead. */
+#ifndef SET_RATIO
+#define SET_RATIO(speed) MOVE_RATIO(speed)
+#endif
+
+/* Supply a default definition for FUNCTION_ARG_PADDING:
+ usually pad upward, but pad short args downward on
+ big-endian machines. */
+
+#define DEFAULT_FUNCTION_ARG_PADDING(MODE, TYPE) \
+ (! BYTES_BIG_ENDIAN \
+ ? upward \
+ : (((MODE) == BLKmode \
+ ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
+ && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT)) \
+ : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
+ ? downward : upward))
+
+#ifndef FUNCTION_ARG_PADDING
+#define FUNCTION_ARG_PADDING(MODE, TYPE) \
+ DEFAULT_FUNCTION_ARG_PADDING ((MODE), (TYPE))
+#endif
+
+/* Supply a default definition for FUNCTION_ARG_BOUNDARY. Normally, we let
+ FUNCTION_ARG_PADDING, which also pads the length, handle any needed
+ alignment. */
+
+#ifndef FUNCTION_ARG_BOUNDARY
+#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) PARM_BOUNDARY
+#endif
+
+/* Supply a default definition of STACK_SAVEAREA_MODE for emit_stack_save.
+ Normally move_insn, so Pmode stack pointer. */
+
+#ifndef STACK_SAVEAREA_MODE
+#define STACK_SAVEAREA_MODE(LEVEL) Pmode
+#endif
+
+/* Supply a default definition of STACK_SIZE_MODE for
+ allocate_dynamic_stack_space. Normally PLUS/MINUS, so word_mode. */
+
+#ifndef STACK_SIZE_MODE
+#define STACK_SIZE_MODE word_mode
+#endif
+
+/* Provide default values for the macros controlling stack checking. */
+
+/* The default is neither full builtin stack checking... */
+#ifndef STACK_CHECK_BUILTIN
+#define STACK_CHECK_BUILTIN 0
+#endif
+
+/* ...nor static builtin stack checking. */
+#ifndef STACK_CHECK_STATIC_BUILTIN
+#define STACK_CHECK_STATIC_BUILTIN 0
+#endif
+
+/* The default interval is one page (4096 bytes). */
+#ifndef STACK_CHECK_PROBE_INTERVAL_EXP
+#define STACK_CHECK_PROBE_INTERVAL_EXP 12
+#endif
+
+/* The default is not to move the stack pointer. */
+#ifndef STACK_CHECK_MOVING_SP
+#define STACK_CHECK_MOVING_SP 0
+#endif
+
+/* This is a kludge to try to capture the discrepancy between the old
+ mechanism (generic stack checking) and the new mechanism (static
+ builtin stack checking). STACK_CHECK_PROTECT needs to be bumped
+ for the latter because part of the protection area is effectively
+ included in STACK_CHECK_MAX_FRAME_SIZE for the former. */
+#ifdef STACK_CHECK_PROTECT
+#define STACK_OLD_CHECK_PROTECT STACK_CHECK_PROTECT
+#else
+#define STACK_OLD_CHECK_PROTECT \
+ (USING_SJLJ_EXCEPTIONS ? 75 * UNITS_PER_WORD : 8 * 1024)
+#endif
+
+/* Minimum amount of stack required to recover from an anticipated stack
+ overflow detection. The default value conveys an estimate of the amount
+ of stack required to propagate an exception. */
+#ifndef STACK_CHECK_PROTECT
+#define STACK_CHECK_PROTECT \
+ (USING_SJLJ_EXCEPTIONS ? 75 * UNITS_PER_WORD : 12 * 1024)
+#endif
+
+/* Make the maximum frame size be the largest we can and still only need
+ one probe per function. */
+#ifndef STACK_CHECK_MAX_FRAME_SIZE
+#define STACK_CHECK_MAX_FRAME_SIZE \
+ ((1 << STACK_CHECK_PROBE_INTERVAL_EXP) - UNITS_PER_WORD)
+#endif
+
+/* This is arbitrary, but should be large enough everywhere. */
+#ifndef STACK_CHECK_FIXED_FRAME_SIZE
+#define STACK_CHECK_FIXED_FRAME_SIZE (4 * UNITS_PER_WORD)
+#endif
+
+/* Provide a reasonable default for the maximum size of an object to
+ allocate in the fixed frame. We may need to be able to make this
+ controllable by the user at some point. */
+#ifndef STACK_CHECK_MAX_VAR_SIZE
+#define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100)
+#endif
+
+#endif /* GCC_INSN_FLAGS_H */
+
#endif /* ! GCC_DEFAULTS_H */
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 0930a02ce29..8eaef6d3557 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -399,6 +399,7 @@ are write-only operations.
static void *df_get_bb_info (struct dataflow *, unsigned int);
static void df_set_bb_info (struct dataflow *, unsigned int, void *);
+static void df_clear_bb_info (struct dataflow *, unsigned int);
#ifdef DF_DEBUG_CFG
static void df_set_clean_cfg (void);
#endif
@@ -414,7 +415,7 @@ bitmap_obstack df_bitmap_obstack;
Functions to create, destroy and manipulate an instance of df.
----------------------------------------------------------------------------*/
-struct df *df;
+struct df_d *df;
/* Add PROBLEM (and any dependent problems) to the DF instance. */
@@ -504,8 +505,9 @@ df_set_blocks (bitmap blocks)
/* This block is called to change the focus from one subset
to another. */
int p;
- bitmap diff = BITMAP_ALLOC (&df_bitmap_obstack);
- bitmap_and_compl (diff, df->blocks_to_analyze, blocks);
+ bitmap_head diff;
+ bitmap_initialize (&diff, &df_bitmap_obstack);
+ bitmap_and_compl (&diff, df->blocks_to_analyze, blocks);
for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
@@ -516,50 +518,47 @@ df_set_blocks (bitmap blocks)
bitmap_iterator bi;
unsigned int bb_index;
- EXECUTE_IF_SET_IN_BITMAP (diff, 0, bb_index, bi)
+ EXECUTE_IF_SET_IN_BITMAP (&diff, 0, bb_index, bi)
{
basic_block bb = BASIC_BLOCK (bb_index);
if (bb)
{
void *bb_info = df_get_bb_info (dflow, bb_index);
- if (bb_info)
- {
- dflow->problem->free_bb_fun (bb, bb_info);
- df_set_bb_info (dflow, bb_index, NULL);
- }
+ dflow->problem->free_bb_fun (bb, bb_info);
+ df_clear_bb_info (dflow, bb_index);
}
}
}
}
- BITMAP_FREE (diff);
+ bitmap_clear (&diff);
}
else
{
/* This block of code is executed to change the focus from
the entire function to a subset. */
- bitmap blocks_to_reset = NULL;
+ bitmap_head blocks_to_reset;
+ bool initialized = false;
int p;
for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
if (dflow->optional_p && dflow->problem->reset_fun)
{
- if (!blocks_to_reset)
+ if (!initialized)
{
basic_block bb;
- blocks_to_reset =
- BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_initialize (&blocks_to_reset, &df_bitmap_obstack);
FOR_ALL_BB(bb)
{
- bitmap_set_bit (blocks_to_reset, bb->index);
+ bitmap_set_bit (&blocks_to_reset, bb->index);
}
}
- dflow->problem->reset_fun (blocks_to_reset);
+ dflow->problem->reset_fun (&blocks_to_reset);
}
}
- if (blocks_to_reset)
- BITMAP_FREE (blocks_to_reset);
+ if (initialized)
+ bitmap_clear (&blocks_to_reset);
df->blocks_to_analyze = BITMAP_ALLOC (&df_bitmap_obstack);
}
@@ -705,7 +704,7 @@ static unsigned int
rest_of_handle_df_initialize (void)
{
gcc_assert (!df);
- df = XCNEW (struct df);
+ df = XCNEW (struct df_d);
df->changeable_flags = 0;
bitmap_obstack_initialize (&df_bitmap_obstack);
@@ -852,35 +851,52 @@ struct rtl_opt_pass pass_df_finish =
The general data flow analysis engine.
----------------------------------------------------------------------------*/
+/* Return time BB when it was visited for last time. */
+#define BB_LAST_CHANGE_AGE(bb) ((ptrdiff_t)(bb)->aux)
/* Helper function for df_worklist_dataflow.
Propagate the dataflow forward.
Given a BB_INDEX, do the dataflow propagation
and set bits on for successors in PENDING
- if the out set of the dataflow has changed. */
+ if the out set of the dataflow has changed.
-static void
+ AGE specify time when BB was visited last time.
+ AGE of 0 means we are visiting for first time and need to
+ compute transfer function to initialize datastructures.
+ Otherwise we re-do transfer function only if something change
+ while computing confluence functions.
+ We need to compute confluence only of basic block that are younger
+ then last visit of the BB.
+
+ Return true if BB info has changed. This is always the case
+ in the first visit. */
+
+static bool
df_worklist_propagate_forward (struct dataflow *dataflow,
unsigned bb_index,
unsigned *bbindex_to_postorder,
bitmap pending,
- sbitmap considered)
+ sbitmap considered,
+ ptrdiff_t age)
{
edge e;
edge_iterator ei;
basic_block bb = BASIC_BLOCK (bb_index);
+ bool changed = !age;
/* Calculate <conf_op> of incoming edges. */
if (EDGE_COUNT (bb->preds) > 0)
FOR_EACH_EDGE (e, ei, bb->preds)
{
- if (TEST_BIT (considered, e->src->index))
- dataflow->problem->con_fun_n (e);
+ if (age <= BB_LAST_CHANGE_AGE (e->src)
+ && TEST_BIT (considered, e->src->index))
+ changed |= dataflow->problem->con_fun_n (e);
}
else if (dataflow->problem->con_fun_0)
dataflow->problem->con_fun_0 (bb);
- if (dataflow->problem->trans_fun (bb_index))
+ if (changed
+ && dataflow->problem->trans_fun (bb_index))
{
/* The out set of this block has changed.
Propagate to the outgoing blocks. */
@@ -891,35 +907,41 @@ df_worklist_propagate_forward (struct dataflow *dataflow,
if (TEST_BIT (considered, ob_index))
bitmap_set_bit (pending, bbindex_to_postorder[ob_index]);
}
+ return true;
}
+ return false;
}
/* Helper function for df_worklist_dataflow.
Propagate the dataflow backward. */
-static void
+static bool
df_worklist_propagate_backward (struct dataflow *dataflow,
unsigned bb_index,
unsigned *bbindex_to_postorder,
bitmap pending,
- sbitmap considered)
+ sbitmap considered,
+ ptrdiff_t age)
{
edge e;
edge_iterator ei;
basic_block bb = BASIC_BLOCK (bb_index);
+ bool changed = !age;
/* Calculate <conf_op> of incoming edges. */
if (EDGE_COUNT (bb->succs) > 0)
FOR_EACH_EDGE (e, ei, bb->succs)
{
- if (TEST_BIT (considered, e->dest->index))
- dataflow->problem->con_fun_n (e);
+ if (age <= BB_LAST_CHANGE_AGE (e->dest)
+ && TEST_BIT (considered, e->dest->index))
+ changed |= dataflow->problem->con_fun_n (e);
}
else if (dataflow->problem->con_fun_0)
dataflow->problem->con_fun_0 (bb);
- if (dataflow->problem->trans_fun (bb_index))
+ if (changed
+ && dataflow->problem->trans_fun (bb_index))
{
/* The out set of this block has changed.
Propagate to the outgoing blocks. */
@@ -930,58 +952,93 @@ df_worklist_propagate_backward (struct dataflow *dataflow,
if (TEST_BIT (considered, ob_index))
bitmap_set_bit (pending, bbindex_to_postorder[ob_index]);
}
+ return true;
}
+ return false;
}
+/* Main dataflow solver loop.
+ DATAFLOW is problem we are solving, PENDING is worklist of basic blocks we
+ need to visit.
+ BLOCK_IN_POSTORDER is array of size N_BLOCKS specifying postorder in BBs and
+ BBINDEX_TO_POSTORDER is array mapping back BB->index to postorder possition.
+ PENDING will be freed.
-/* This will free "pending". */
+ The worklists are bitmaps indexed by postorder positions.
+
+ The function implements standard algorithm for dataflow solving with two
+ worklists (we are processing WORKLIST and storing new BBs to visit in
+ PENDING).
+
+ As an optimization we maintain ages when BB was changed (stored in bb->aux)
+ and when it was last visited (stored in last_visit_age). This avoids need
+ to re-do confluence function for edges to basic blocks whose source
+ did not change since destination was visited last time. */
static void
df_worklist_dataflow_doublequeue (struct dataflow *dataflow,
bitmap pending,
sbitmap considered,
int *blocks_in_postorder,
- unsigned *bbindex_to_postorder)
+ unsigned *bbindex_to_postorder,
+ int n_blocks)
{
enum df_flow_dir dir = dataflow->problem->dir;
int dcount = 0;
bitmap worklist = BITMAP_ALLOC (&df_bitmap_obstack);
+ int age = 0;
+ bool changed;
+ VEC(int, heap) *last_visit_age = NULL;
+ int prev_age;
+ basic_block bb;
+ int i;
+
+ VEC_safe_grow_cleared (int, heap, last_visit_age, n_blocks);
/* Double-queueing. Worklist is for the current iteration,
and pending is for the next. */
while (!bitmap_empty_p (pending))
{
+ bitmap_iterator bi;
+ unsigned int index;
+
/* Swap pending and worklist. */
bitmap temp = worklist;
worklist = pending;
pending = temp;
- do
+ EXECUTE_IF_SET_IN_BITMAP (worklist, 0, index, bi)
{
- int index;
unsigned bb_index;
dcount++;
- index = bitmap_first_set_bit (worklist);
- bitmap_clear_bit (worklist, index);
-
+ bitmap_clear_bit (pending, index);
bb_index = blocks_in_postorder[index];
-
+ bb = BASIC_BLOCK (bb_index);
+ prev_age = VEC_index (int, last_visit_age, index);
if (dir == DF_FORWARD)
- df_worklist_propagate_forward (dataflow, bb_index,
- bbindex_to_postorder,
- pending, considered);
+ changed = df_worklist_propagate_forward (dataflow, bb_index,
+ bbindex_to_postorder,
+ pending, considered,
+ prev_age);
else
- df_worklist_propagate_backward (dataflow, bb_index,
- bbindex_to_postorder,
- pending, considered);
+ changed = df_worklist_propagate_backward (dataflow, bb_index,
+ bbindex_to_postorder,
+ pending, considered,
+ prev_age);
+ VEC_replace (int, last_visit_age, index, ++age);
+ if (changed)
+ bb->aux = (void *)(ptrdiff_t)age;
}
- while (!bitmap_empty_p (worklist));
+ bitmap_clear (worklist);
}
+ for (i = 0; i < n_blocks; i++)
+ BASIC_BLOCK (blocks_in_postorder[i])->aux = NULL;
BITMAP_FREE (worklist);
BITMAP_FREE (pending);
+ VEC_free (int, heap, last_visit_age);
/* Dump statistics. */
if (dump_file)
@@ -1045,8 +1102,8 @@ df_worklist_dataflow (struct dataflow *dataflow,
/* Solve it. */
df_worklist_dataflow_doublequeue (dataflow, pending, considered,
blocks_in_postorder,
- bbindex_to_postorder);
-
+ bbindex_to_postorder,
+ n_blocks);
sbitmap_free (considered);
free (bbindex_to_postorder);
}
@@ -1083,15 +1140,15 @@ df_analyze_problem (struct dataflow *dflow,
{
timevar_push (dflow->problem->tv_id);
+ /* (Re)Allocate the datastructures necessary to solve the problem. */
+ if (dflow->problem->alloc_fun)
+ dflow->problem->alloc_fun (blocks_to_consider);
+
#ifdef ENABLE_DF_CHECKING
if (dflow->problem->verify_start_fun)
dflow->problem->verify_start_fun ();
#endif
- /* (Re)Allocate the datastructures necessary to solve the problem. */
- if (dflow->problem->alloc_fun)
- dflow->problem->alloc_fun (blocks_to_consider);
-
/* Set up the problem and compute the local information. */
if (dflow->problem->local_compute_fun)
dflow->problem->local_compute_fun (blocks_to_consider);
@@ -1293,7 +1350,8 @@ df_get_bb_info (struct dataflow *dflow, unsigned int index)
return NULL;
if (index >= dflow->block_info_size)
return NULL;
- return (struct df_scan_bb_info *) dflow->block_info[index];
+ return (void *)((char *)dflow->block_info
+ + index * dflow->problem->block_info_elt_size);
}
@@ -1304,7 +1362,22 @@ df_set_bb_info (struct dataflow *dflow, unsigned int index,
void *bb_info)
{
gcc_assert (dflow->block_info);
- dflow->block_info[index] = bb_info;
+ memcpy ((char *)dflow->block_info
+ + index * dflow->problem->block_info_elt_size,
+ bb_info, dflow->problem->block_info_elt_size);
+}
+
+
+/* Clear basic block info. */
+
+static void
+df_clear_bb_info (struct dataflow *dflow, unsigned int index)
+{
+ gcc_assert (dflow->block_info);
+ gcc_assert (dflow->block_info_size > index);
+ memset ((char *)dflow->block_info
+ + index * dflow->problem->block_info_elt_size,
+ 0, dflow->problem->block_info_elt_size);
}
@@ -1377,6 +1450,29 @@ df_set_bb_dirty_nonlr (basic_block bb)
}
}
+/* Grow the bb_info array. */
+
+void
+df_grow_bb_info (struct dataflow *dflow)
+{
+ unsigned int new_size = last_basic_block + 1;
+ if (dflow->block_info_size < new_size)
+ {
+ new_size += new_size / 4;
+ dflow->block_info
+ = (void *)XRESIZEVEC (char, (char *)dflow->block_info,
+ new_size
+ * dflow->problem->block_info_elt_size);
+ memset ((char *)dflow->block_info
+ + dflow->block_info_size
+ * dflow->problem->block_info_elt_size,
+ 0,
+ (new_size - dflow->block_info_size)
+ * dflow->problem->block_info_elt_size);
+ dflow->block_info_size = new_size;
+ }
+}
+
/* Clear the dirty bits. This is called from places that delete
blocks. */
@@ -1391,6 +1487,7 @@ df_clear_bb_dirty (basic_block bb)
bitmap_clear_bit (dflow->out_of_date_transfer_functions, bb->index);
}
}
+
/* Called from the rtl_compact_blocks to reorganize the problems basic
block info. */
@@ -1399,11 +1496,10 @@ df_compact_blocks (void)
{
int i, p;
basic_block bb;
- void **problem_temps;
- int size = last_basic_block * sizeof (void *);
- bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack);
- problem_temps = XNEWVAR (void *, size);
+ void *problem_temps;
+ bitmap_head tmp;
+ bitmap_initialize (&tmp, &df_bitmap_obstack);
for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
@@ -1412,17 +1508,17 @@ df_compact_blocks (void)
dflow problem. */
if (dflow->out_of_date_transfer_functions)
{
- bitmap_copy (tmp, dflow->out_of_date_transfer_functions);
+ bitmap_copy (&tmp, dflow->out_of_date_transfer_functions);
bitmap_clear (dflow->out_of_date_transfer_functions);
- if (bitmap_bit_p (tmp, ENTRY_BLOCK))
+ if (bitmap_bit_p (&tmp, ENTRY_BLOCK))
bitmap_set_bit (dflow->out_of_date_transfer_functions, ENTRY_BLOCK);
- if (bitmap_bit_p (tmp, EXIT_BLOCK))
+ if (bitmap_bit_p (&tmp, EXIT_BLOCK))
bitmap_set_bit (dflow->out_of_date_transfer_functions, EXIT_BLOCK);
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
- if (bitmap_bit_p (tmp, bb->index))
+ if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (dflow->out_of_date_transfer_functions, i);
i++;
}
@@ -1431,6 +1527,8 @@ df_compact_blocks (void)
/* Now shuffle the block info for the problem. */
if (dflow->problem->free_bb_fun)
{
+ int size = last_basic_block * dflow->problem->block_info_elt_size;
+ problem_temps = XNEWVAR (char, size);
df_grow_bb_info (dflow);
memcpy (problem_temps, dflow->block_info, size);
@@ -1440,22 +1538,16 @@ df_compact_blocks (void)
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
- df_set_bb_info (dflow, i, problem_temps[bb->index]);
- problem_temps[bb->index] = NULL;
+ df_set_bb_info (dflow, i,
+ (char *)problem_temps
+ + bb->index * dflow->problem->block_info_elt_size);
i++;
}
- memset (dflow->block_info + i, 0,
- (last_basic_block - i) *sizeof (void *));
-
- /* Free any block infos that were not copied (and NULLed).
- These are from orphaned blocks. */
- for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
- {
- basic_block bb = BASIC_BLOCK (i);
- if (problem_temps[i] && bb)
- dflow->problem->free_bb_fun
- (bb, problem_temps[i]);
- }
+ memset ((char *)dflow->block_info
+ + i * dflow->problem->block_info_elt_size, 0,
+ (last_basic_block - i)
+ * dflow->problem->block_info_elt_size);
+ free (problem_temps);
}
}
@@ -1463,24 +1555,22 @@ df_compact_blocks (void)
if (df->blocks_to_analyze)
{
- if (bitmap_bit_p (tmp, ENTRY_BLOCK))
+ if (bitmap_bit_p (&tmp, ENTRY_BLOCK))
bitmap_set_bit (df->blocks_to_analyze, ENTRY_BLOCK);
- if (bitmap_bit_p (tmp, EXIT_BLOCK))
+ if (bitmap_bit_p (&tmp, EXIT_BLOCK))
bitmap_set_bit (df->blocks_to_analyze, EXIT_BLOCK);
- bitmap_copy (tmp, df->blocks_to_analyze);
+ bitmap_copy (&tmp, df->blocks_to_analyze);
bitmap_clear (df->blocks_to_analyze);
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
- if (bitmap_bit_p (tmp, bb->index))
+ if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (df->blocks_to_analyze, i);
i++;
}
}
- BITMAP_FREE (tmp);
-
- free (problem_temps);
+ bitmap_clear (&tmp);
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
@@ -1523,7 +1613,6 @@ df_bb_replace (int old_index, basic_block new_block)
if (dflow->block_info)
{
df_grow_bb_info (dflow);
- gcc_assert (df_get_bb_info (dflow, old_index) == NULL);
df_set_bb_info (dflow, old_index,
df_get_bb_info (dflow, new_block_index));
}
@@ -1559,7 +1648,7 @@ df_bb_delete (int bb_index)
if (bb_info)
{
dflow->problem->free_bb_fun (bb, bb_info);
- df_set_bb_info (dflow, bb_index, NULL);
+ df_clear_bb_info (dflow, bb_index);
}
}
}
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 25bbba61bb1..1196e81e729 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -54,8 +54,8 @@ along with GCC; see the file COPYING3. If not see
#define DF_SPARSE_THRESHOLD 32
-static bitmap seen_in_block = NULL;
-static bitmap seen_in_insn = NULL;
+static bitmap_head seen_in_block;
+static bitmap_head seen_in_insn;
/*----------------------------------------------------------------------------
@@ -100,22 +100,6 @@ df_get_live_in (basic_block bb)
/* Generic versions to get the void* version of the block info. Only
used inside the problem instance vectors. */
-/* Grow the bb_info array. */
-
-void
-df_grow_bb_info (struct dataflow *dflow)
-{
- unsigned int new_size = last_basic_block + 1;
- if (dflow->block_info_size < new_size)
- {
- new_size += new_size / 4;
- dflow->block_info = XRESIZEVEC (void *, dflow->block_info, new_size);
- memset (dflow->block_info + dflow->block_info_size, 0,
- (new_size - dflow->block_info_size) *sizeof (void *));
- dflow->block_info_size = new_size;
- }
-}
-
/* Dump a def-use or use-def chain for REF to FILE. */
void
@@ -195,24 +179,13 @@ df_print_bb_index (basic_block bb, FILE *file)
struct df_rd_problem_data
{
/* The set of defs to regs invalidated by call. */
- bitmap sparse_invalidated_by_call;
+ bitmap_head sparse_invalidated_by_call;
/* The set of defs to regs invalidate by call for rd. */
- bitmap dense_invalidated_by_call;
+ bitmap_head dense_invalidated_by_call;
/* An obstack for the bitmaps we need for this problem. */
bitmap_obstack rd_bitmaps;
};
-/* Set basic block info. */
-
-static void
-df_rd_set_bb_info (unsigned int index,
- struct df_rd_bb_info *bb_info)
-{
- gcc_assert (df_rd);
- gcc_assert (index < df_rd->block_info_size);
- df_rd->block_info[index] = bb_info;
-}
-
/* Free basic block info. */
@@ -223,12 +196,11 @@ df_rd_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
struct df_rd_bb_info *bb_info = (struct df_rd_bb_info *) vbb_info;
if (bb_info)
{
- BITMAP_FREE (bb_info->kill);
- BITMAP_FREE (bb_info->sparse_kill);
- BITMAP_FREE (bb_info->gen);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- pool_free (df_rd->block_pool, bb_info);
+ bitmap_clear (&bb_info->kill);
+ bitmap_clear (&bb_info->sparse_kill);
+ bitmap_clear (&bb_info->gen);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -243,15 +215,11 @@ df_rd_alloc (bitmap all_blocks)
bitmap_iterator bi;
struct df_rd_problem_data *problem_data;
- if (!df_rd->block_pool)
- df_rd->block_pool = create_alloc_pool ("df_rd_block pool",
- sizeof (struct df_rd_bb_info), 50);
-
if (df_rd->problem_data)
{
problem_data = (struct df_rd_problem_data *) df_rd->problem_data;
- bitmap_clear (problem_data->sparse_invalidated_by_call);
- bitmap_clear (problem_data->dense_invalidated_by_call);
+ bitmap_clear (&problem_data->sparse_invalidated_by_call);
+ bitmap_clear (&problem_data->dense_invalidated_by_call);
}
else
{
@@ -259,10 +227,10 @@ df_rd_alloc (bitmap all_blocks)
df_rd->problem_data = problem_data;
bitmap_obstack_initialize (&problem_data->rd_bitmaps);
- problem_data->sparse_invalidated_by_call
- = BITMAP_ALLOC (&problem_data->rd_bitmaps);
- problem_data->dense_invalidated_by_call
- = BITMAP_ALLOC (&problem_data->rd_bitmaps);
+ bitmap_initialize (&problem_data->sparse_invalidated_by_call,
+ &problem_data->rd_bitmaps);
+ bitmap_initialize (&problem_data->dense_invalidated_by_call,
+ &problem_data->rd_bitmaps);
}
df_grow_bb_info (df_rd);
@@ -274,21 +242,21 @@ df_rd_alloc (bitmap all_blocks)
EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
{
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
- if (bb_info)
+
+ /* When bitmaps are already initialized, just clear them. */
+ if (bb_info->kill.obstack)
{
- bitmap_clear (bb_info->kill);
- bitmap_clear (bb_info->sparse_kill);
- bitmap_clear (bb_info->gen);
+ bitmap_clear (&bb_info->kill);
+ bitmap_clear (&bb_info->sparse_kill);
+ bitmap_clear (&bb_info->gen);
}
else
{
- bb_info = (struct df_rd_bb_info *) pool_alloc (df_rd->block_pool);
- df_rd_set_bb_info (bb_index, bb_info);
- bb_info->kill = BITMAP_ALLOC (&problem_data->rd_bitmaps);
- bb_info->sparse_kill = BITMAP_ALLOC (&problem_data->rd_bitmaps);
- bb_info->gen = BITMAP_ALLOC (&problem_data->rd_bitmaps);
- bb_info->in = BITMAP_ALLOC (&problem_data->rd_bitmaps);
- bb_info->out = BITMAP_ALLOC (&problem_data->rd_bitmaps);
+ bitmap_initialize (&bb_info->kill, &problem_data->rd_bitmaps);
+ bitmap_initialize (&bb_info->sparse_kill, &problem_data->rd_bitmaps);
+ bitmap_initialize (&bb_info->gen, &problem_data->rd_bitmaps);
+ bitmap_initialize (&bb_info->in, &problem_data->rd_bitmaps);
+ bitmap_initialize (&bb_info->out, &problem_data->rd_bitmaps);
}
}
df_rd->optional_p = true;
@@ -370,11 +338,11 @@ df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
{
/* Only the last def(s) for a regno in the block has any
effect. */
- if (!bitmap_bit_p (seen_in_block, regno))
+ if (!bitmap_bit_p (&seen_in_block, regno))
{
/* The first def for regno in insn gets to knock out the
defs from other instructions. */
- if ((!bitmap_bit_p (seen_in_insn, regno))
+ if ((!bitmap_bit_p (&seen_in_insn, regno))
/* If the def is to only part of the reg, it does
not kill the other defs that reach here. */
&& (!(DF_REF_FLAGS (def) &
@@ -382,22 +350,22 @@ df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
{
if (n_defs > DF_SPARSE_THRESHOLD)
{
- bitmap_set_bit (bb_info->sparse_kill, regno);
- bitmap_clear_range(bb_info->gen, begin, n_defs);
+ bitmap_set_bit (&bb_info->sparse_kill, regno);
+ bitmap_clear_range(&bb_info->gen, begin, n_defs);
}
else
{
- bitmap_set_range (bb_info->kill, begin, n_defs);
- bitmap_clear_range (bb_info->gen, begin, n_defs);
+ bitmap_set_range (&bb_info->kill, begin, n_defs);
+ bitmap_clear_range (&bb_info->gen, begin, n_defs);
}
}
- bitmap_set_bit (seen_in_insn, regno);
+ bitmap_set_bit (&seen_in_insn, regno);
/* All defs for regno in the instruction may be put into
the gen set. */
if (!(DF_REF_FLAGS (def)
& (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)))
- bitmap_set_bit (bb_info->gen, DF_REF_ID (def));
+ bitmap_set_bit (&bb_info->gen, DF_REF_ID (def));
}
}
}
@@ -414,8 +382,8 @@ df_rd_bb_local_compute (unsigned int bb_index)
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
rtx insn;
- bitmap_clear (seen_in_block);
- bitmap_clear (seen_in_insn);
+ bitmap_clear (&seen_in_block);
+ bitmap_clear (&seen_in_insn);
/* Artificials are only hard regs. */
if (!(df->changeable_flags & DF_NO_HARD_REGS))
@@ -439,8 +407,8 @@ df_rd_bb_local_compute (unsigned int bb_index)
result and another def for the clobber. If only one vector
is used and the clobber goes first, the result will be
lost. */
- bitmap_ior_into (seen_in_block, seen_in_insn);
- bitmap_clear (seen_in_insn);
+ bitmap_ior_into (&seen_in_block, &seen_in_insn);
+ bitmap_clear (&seen_in_insn);
}
/* Process the artificial defs at the top of the block last since we
@@ -463,11 +431,11 @@ df_rd_local_compute (bitmap all_blocks)
unsigned int regno;
struct df_rd_problem_data *problem_data
= (struct df_rd_problem_data *) df_rd->problem_data;
- bitmap sparse_invalidated = problem_data->sparse_invalidated_by_call;
- bitmap dense_invalidated = problem_data->dense_invalidated_by_call;
+ bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call;
+ bitmap dense_invalidated = &problem_data->dense_invalidated_by_call;
- seen_in_block = BITMAP_ALLOC (&df_bitmap_obstack);
- seen_in_insn = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_initialize (&seen_in_block, &df_bitmap_obstack);
+ bitmap_initialize (&seen_in_insn, &df_bitmap_obstack);
df_maybe_reorganize_def_refs (DF_REF_ORDER_BY_REG);
@@ -487,8 +455,8 @@ df_rd_local_compute (bitmap all_blocks)
DF_DEFS_COUNT (regno));
}
- BITMAP_FREE (seen_in_block);
- BITMAP_FREE (seen_in_insn);
+ bitmap_clear (&seen_in_block);
+ bitmap_clear (&seen_in_insn);
}
@@ -504,46 +472,49 @@ df_rd_init_solution (bitmap all_blocks)
{
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
- bitmap_copy (bb_info->out, bb_info->gen);
- bitmap_clear (bb_info->in);
+ bitmap_copy (&bb_info->out, &bb_info->gen);
+ bitmap_clear (&bb_info->in);
}
}
/* In of target gets or of out of source. */
-static void
+static bool
df_rd_confluence_n (edge e)
{
- bitmap op1 = df_rd_get_bb_info (e->dest->index)->in;
- bitmap op2 = df_rd_get_bb_info (e->src->index)->out;
+ bitmap op1 = &df_rd_get_bb_info (e->dest->index)->in;
+ bitmap op2 = &df_rd_get_bb_info (e->src->index)->out;
+ bool changed = false;
if (e->flags & EDGE_FAKE)
- return;
+ return false;
if (e->flags & EDGE_EH)
{
struct df_rd_problem_data *problem_data
= (struct df_rd_problem_data *) df_rd->problem_data;
- bitmap sparse_invalidated = problem_data->sparse_invalidated_by_call;
- bitmap dense_invalidated = problem_data->dense_invalidated_by_call;
+ bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call;
+ bitmap dense_invalidated = &problem_data->dense_invalidated_by_call;
bitmap_iterator bi;
unsigned int regno;
- bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head tmp;
- bitmap_copy (tmp, op2);
- bitmap_and_compl_into (tmp, dense_invalidated);
+ bitmap_initialize (&tmp, &df_bitmap_obstack);
+ bitmap_copy (&tmp, op2);
+ bitmap_and_compl_into (&tmp, dense_invalidated);
EXECUTE_IF_SET_IN_BITMAP (sparse_invalidated, 0, regno, bi)
{
- bitmap_clear_range (tmp,
+ bitmap_clear_range (&tmp,
DF_DEFS_BEGIN (regno),
DF_DEFS_COUNT (regno));
}
- bitmap_ior_into (op1, tmp);
- BITMAP_FREE (tmp);
+ changed |= bitmap_ior_into (op1, &tmp);
+ bitmap_clear (&tmp);
+ return changed;
}
else
- bitmap_ior_into (op1, op2);
+ return bitmap_ior_into (op1, op2);
}
@@ -555,11 +526,11 @@ df_rd_transfer_function (int bb_index)
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
unsigned int regno;
bitmap_iterator bi;
- bitmap in = bb_info->in;
- bitmap out = bb_info->out;
- bitmap gen = bb_info->gen;
- bitmap kill = bb_info->kill;
- bitmap sparse_kill = bb_info->sparse_kill;
+ bitmap in = &bb_info->in;
+ bitmap out = &bb_info->out;
+ bitmap gen = &bb_info->gen;
+ bitmap kill = &bb_info->kill;
+ bitmap sparse_kill = &bb_info->sparse_kill;
if (bitmap_empty_p (sparse_kill))
return bitmap_ior_and_compl (out, gen, in, kill);
@@ -567,30 +538,30 @@ df_rd_transfer_function (int bb_index)
{
struct df_rd_problem_data *problem_data;
bool changed = false;
- bitmap tmp;
+ bitmap_head tmp;
/* Note that TMP is _not_ a temporary bitmap if we end up replacing
OUT with TMP. Therefore, allocate TMP in the RD bitmaps obstack. */
problem_data = (struct df_rd_problem_data *) df_rd->problem_data;
- tmp = BITMAP_ALLOC (&problem_data->rd_bitmaps);
+ bitmap_initialize (&tmp, &problem_data->rd_bitmaps);
- bitmap_copy (tmp, in);
+ bitmap_copy (&tmp, in);
EXECUTE_IF_SET_IN_BITMAP (sparse_kill, 0, regno, bi)
{
- bitmap_clear_range (tmp,
+ bitmap_clear_range (&tmp,
DF_DEFS_BEGIN (regno),
DF_DEFS_COUNT (regno));
}
- bitmap_and_compl_into (tmp, kill);
- bitmap_ior_into (tmp, gen);
- changed = !bitmap_equal_p (tmp, out);
+ bitmap_and_compl_into (&tmp, kill);
+ bitmap_ior_into (&tmp, gen);
+ changed = !bitmap_equal_p (&tmp, out);
if (changed)
{
- BITMAP_FREE (out);
+ bitmap_clear (out);
bb_info->out = tmp;
}
else
- BITMAP_FREE (tmp);
+ bitmap_clear (&tmp);
return changed;
}
}
@@ -606,11 +577,11 @@ df_rd_free (void)
if (problem_data)
{
- free_alloc_pool (df_rd->block_pool);
bitmap_obstack_release (&problem_data->rd_bitmaps);
df_rd->block_info_size = 0;
free (df_rd->block_info);
+ df_rd->block_info = NULL;
free (df_rd->problem_data);
}
free (df_rd);
@@ -633,9 +604,9 @@ df_rd_start_dump (FILE *file)
fprintf (file, ";; Reaching defs:\n\n");
fprintf (file, " sparse invalidated \t");
- dump_bitmap (file, problem_data->sparse_invalidated_by_call);
+ dump_bitmap (file, &problem_data->sparse_invalidated_by_call);
fprintf (file, " dense invalidated \t");
- dump_bitmap (file, problem_data->dense_invalidated_by_call);
+ dump_bitmap (file, &problem_data->dense_invalidated_by_call);
for (regno = 0; regno < m; regno++)
if (DF_DEFS_COUNT (regno))
@@ -653,15 +624,15 @@ static void
df_rd_top_dump (basic_block bb, FILE *file)
{
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb->index);
- if (!bb_info || !bb_info->in)
+ if (!bb_info)
return;
- fprintf (file, ";; rd in \t(%d)\n", (int) bitmap_count_bits (bb_info->in));
- dump_bitmap (file, bb_info->in);
- fprintf (file, ";; rd gen \t(%d)\n", (int) bitmap_count_bits (bb_info->gen));
- dump_bitmap (file, bb_info->gen);
- fprintf (file, ";; rd kill\t(%d)\n", (int) bitmap_count_bits (bb_info->kill));
- dump_bitmap (file, bb_info->kill);
+ fprintf (file, ";; rd in \t(%d)\n", (int) bitmap_count_bits (&bb_info->in));
+ dump_bitmap (file, &bb_info->in);
+ fprintf (file, ";; rd gen \t(%d)\n", (int) bitmap_count_bits (&bb_info->gen));
+ dump_bitmap (file, &bb_info->gen);
+ fprintf (file, ";; rd kill\t(%d)\n", (int) bitmap_count_bits (&bb_info->kill));
+ dump_bitmap (file, &bb_info->kill);
}
@@ -671,11 +642,11 @@ static void
df_rd_bottom_dump (basic_block bb, FILE *file)
{
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb->index);
- if (!bb_info || !bb_info->out)
+ if (!bb_info)
return;
- fprintf (file, ";; rd out \t(%d)\n", (int) bitmap_count_bits (bb_info->out));
- dump_bitmap (file, bb_info->out);
+ fprintf (file, ";; rd out \t(%d)\n", (int) bitmap_count_bits (&bb_info->out));
+ dump_bitmap (file, &bb_info->out);
}
/* All of the information associated with every instance of the problem. */
@@ -702,6 +673,7 @@ static struct df_problem problem_RD =
NULL, /* Incremental solution verify start. */
NULL, /* Incremental solution verify end. */
NULL, /* Dependent problem. */
+ sizeof (struct df_rd_bb_info),/* Size of entry of block_info array. */
TV_DF_RD, /* Timing variable. */
true /* Reset blocks on dropping out of blocks_to_analyze. */
};
@@ -731,23 +703,12 @@ df_rd_add_problem (void)
/* Private data used to verify the solution for this problem. */
struct df_lr_problem_data
{
- bitmap *in;
- bitmap *out;
+ bitmap_head *in;
+ bitmap_head *out;
+ /* An obstack for the bitmaps we need for this problem. */
+ bitmap_obstack lr_bitmaps;
};
-
-/* Set basic block info. */
-
-static void
-df_lr_set_bb_info (unsigned int index,
- struct df_lr_bb_info *bb_info)
-{
- gcc_assert (df_lr);
- gcc_assert (index < df_lr->block_info_size);
- df_lr->block_info[index] = bb_info;
-}
-
-
/* Free basic block info. */
static void
@@ -757,11 +718,10 @@ df_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
struct df_lr_bb_info *bb_info = (struct df_lr_bb_info *) vbb_info;
if (bb_info)
{
- BITMAP_FREE (bb_info->use);
- BITMAP_FREE (bb_info->def);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- pool_free (df_lr->block_pool, bb_info);
+ bitmap_clear (&bb_info->use);
+ bitmap_clear (&bb_info->def);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -774,29 +734,37 @@ df_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
{
unsigned int bb_index;
bitmap_iterator bi;
-
- if (!df_lr->block_pool)
- df_lr->block_pool = create_alloc_pool ("df_lr_block pool",
- sizeof (struct df_lr_bb_info), 50);
+ struct df_lr_problem_data *problem_data;
df_grow_bb_info (df_lr);
+ if (df_lr->problem_data)
+ problem_data = (struct df_lr_problem_data *) df_lr->problem_data;
+ else
+ {
+ problem_data = XNEW (struct df_lr_problem_data);
+ df_lr->problem_data = problem_data;
+
+ problem_data->out = NULL;
+ problem_data->in = NULL;
+ bitmap_obstack_initialize (&problem_data->lr_bitmaps);
+ }
EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
- if (bb_info)
+
+ /* When bitmaps are already initialized, just clear them. */
+ if (bb_info->use.obstack)
{
- bitmap_clear (bb_info->def);
- bitmap_clear (bb_info->use);
+ bitmap_clear (&bb_info->def);
+ bitmap_clear (&bb_info->use);
}
else
{
- bb_info = (struct df_lr_bb_info *) pool_alloc (df_lr->block_pool);
- df_lr_set_bb_info (bb_index, bb_info);
- bb_info->use = BITMAP_ALLOC (NULL);
- bb_info->def = BITMAP_ALLOC (NULL);
- bb_info->in = BITMAP_ALLOC (NULL);
- bb_info->out = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&bb_info->use, &problem_data->lr_bitmaps);
+ bitmap_initialize (&bb_info->def, &problem_data->lr_bitmaps);
+ bitmap_initialize (&bb_info->in, &problem_data->lr_bitmaps);
+ bitmap_initialize (&bb_info->out, &problem_data->lr_bitmaps);
}
}
@@ -816,8 +784,8 @@ df_lr_reset (bitmap all_blocks)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
gcc_assert (bb_info);
- bitmap_clear (bb_info->in);
- bitmap_clear (bb_info->out);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -840,8 +808,8 @@ df_lr_bb_local_compute (unsigned int bb_index)
if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
{
unsigned int dregno = DF_REF_REGNO (def);
- bitmap_set_bit (bb_info->def, dregno);
- bitmap_clear_bit (bb_info->use, dregno);
+ bitmap_set_bit (&bb_info->def, dregno);
+ bitmap_clear_bit (&bb_info->use, dregno);
}
}
@@ -851,7 +819,7 @@ df_lr_bb_local_compute (unsigned int bb_index)
df_ref use = *use_rec;
/* Add use to set of uses in this BB. */
if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
- bitmap_set_bit (bb_info->use, DF_REF_REGNO (use));
+ bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
}
FOR_BB_INSNS_REVERSE (bb, insn)
@@ -869,8 +837,8 @@ df_lr_bb_local_compute (unsigned int bb_index)
if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
{
unsigned int dregno = DF_REF_REGNO (def);
- bitmap_set_bit (bb_info->def, dregno);
- bitmap_clear_bit (bb_info->use, dregno);
+ bitmap_set_bit (&bb_info->def, dregno);
+ bitmap_clear_bit (&bb_info->use, dregno);
}
}
@@ -878,7 +846,7 @@ df_lr_bb_local_compute (unsigned int bb_index)
{
df_ref use = *use_rec;
/* Add use to set of uses in this BB. */
- bitmap_set_bit (bb_info->use, DF_REF_REGNO (use));
+ bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
}
}
@@ -891,8 +859,8 @@ df_lr_bb_local_compute (unsigned int bb_index)
if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
{
unsigned int dregno = DF_REF_REGNO (def);
- bitmap_set_bit (bb_info->def, dregno);
- bitmap_clear_bit (bb_info->use, dregno);
+ bitmap_set_bit (&bb_info->def, dregno);
+ bitmap_clear_bit (&bb_info->use, dregno);
}
}
@@ -903,7 +871,7 @@ df_lr_bb_local_compute (unsigned int bb_index)
df_ref use = *use_rec;
/* Add use to set of uses in this BB. */
if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
- bitmap_set_bit (bb_info->use, DF_REF_REGNO (use));
+ bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
}
#endif
@@ -924,10 +892,10 @@ df_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
unsigned int bb_index;
bitmap_iterator bi;
- bitmap_clear (df->hardware_regs_used);
+ bitmap_clear (&df->hardware_regs_used);
/* The all-important stack pointer must always be live. */
- bitmap_set_bit (df->hardware_regs_used, STACK_POINTER_REGNUM);
+ bitmap_set_bit (&df->hardware_regs_used, STACK_POINTER_REGNUM);
/* Before reload, there are a few registers that must be forced
live everywhere -- which might not already be the case for
@@ -936,20 +904,20 @@ df_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
{
/* Any reference to any pseudo before reload is a potential
reference of the frame pointer. */
- bitmap_set_bit (df->hardware_regs_used, FRAME_POINTER_REGNUM);
+ bitmap_set_bit (&df->hardware_regs_used, FRAME_POINTER_REGNUM);
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
/* Pseudos with argument area equivalences may require
reloading via the argument pointer. */
if (fixed_regs[ARG_POINTER_REGNUM])
- bitmap_set_bit (df->hardware_regs_used, ARG_POINTER_REGNUM);
+ bitmap_set_bit (&df->hardware_regs_used, ARG_POINTER_REGNUM);
#endif
/* Any constant, or pseudo with constant equivalences, may
require reloading from memory using the pic register. */
if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
&& fixed_regs[PIC_OFFSET_TABLE_REGNUM])
- bitmap_set_bit (df->hardware_regs_used, PIC_OFFSET_TABLE_REGNUM);
+ bitmap_set_bit (&df->hardware_regs_used, PIC_OFFSET_TABLE_REGNUM);
}
EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi)
@@ -959,7 +927,7 @@ df_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
/* The exit block is special for this problem and its bits are
computed from thin air. */
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (EXIT_BLOCK);
- bitmap_copy (bb_info->use, df->exit_block_uses);
+ bitmap_copy (&bb_info->use, df->exit_block_uses);
}
else
df_lr_bb_local_compute (bb_index);
@@ -980,8 +948,8 @@ df_lr_init (bitmap all_blocks)
EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
- bitmap_copy (bb_info->in, bb_info->use);
- bitmap_clear (bb_info->out);
+ bitmap_copy (&bb_info->in, &bb_info->use);
+ bitmap_clear (&bb_info->out);
}
}
@@ -992,29 +960,31 @@ df_lr_init (bitmap all_blocks)
static void
df_lr_confluence_0 (basic_block bb)
{
- bitmap op1 = df_lr_get_bb_info (bb->index)->out;
+ bitmap op1 = &df_lr_get_bb_info (bb->index)->out;
if (bb != EXIT_BLOCK_PTR)
- bitmap_copy (op1, df->hardware_regs_used);
+ bitmap_copy (op1, &df->hardware_regs_used);
}
/* Confluence function that ignores fake edges. */
-static void
+static bool
df_lr_confluence_n (edge e)
{
- bitmap op1 = df_lr_get_bb_info (e->src->index)->out;
- bitmap op2 = df_lr_get_bb_info (e->dest->index)->in;
+ bitmap op1 = &df_lr_get_bb_info (e->src->index)->out;
+ bitmap op2 = &df_lr_get_bb_info (e->dest->index)->in;
+ bool changed = false;
/* Call-clobbered registers die across exception and call edges. */
/* ??? Abnormal call edges ignored for the moment, as this gets
confused by sibling call edges, which crashes reg-stack. */
if (e->flags & EDGE_EH)
- bitmap_ior_and_compl_into (op1, op2, regs_invalidated_by_call_regset);
+ changed = bitmap_ior_and_compl_into (op1, op2, regs_invalidated_by_call_regset);
else
- bitmap_ior_into (op1, op2);
+ changed = bitmap_ior_into (op1, op2);
- bitmap_ior_into (op1, df->hardware_regs_used);
+ changed |= bitmap_ior_into (op1, &df->hardware_regs_used);
+ return changed;
}
@@ -1024,10 +994,10 @@ static bool
df_lr_transfer_function (int bb_index)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
- bitmap in = bb_info->in;
- bitmap out = bb_info->out;
- bitmap use = bb_info->use;
- bitmap def = bb_info->def;
+ bitmap in = &bb_info->in;
+ bitmap out = &bb_info->out;
+ bitmap use = &bb_info->use;
+ bitmap def = &bb_info->def;
return bitmap_ior_and_compl (in, use, out, def);
}
@@ -1072,24 +1042,17 @@ df_lr_finalize (bitmap all_blocks)
static void
df_lr_free (void)
{
+ struct df_lr_problem_data *problem_data
+ = (struct df_lr_problem_data *) df_lr->problem_data;
if (df_lr->block_info)
{
- unsigned int i;
- for (i = 0; i < df_lr->block_info_size; i++)
- {
- struct df_lr_bb_info *bb_info = df_lr_get_bb_info (i);
- if (bb_info)
- {
- BITMAP_FREE (bb_info->use);
- BITMAP_FREE (bb_info->def);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- }
- }
- free_alloc_pool (df_lr->block_pool);
df_lr->block_info_size = 0;
free (df_lr->block_info);
+ df_lr->block_info = NULL;
+ bitmap_obstack_release (&problem_data->lr_bitmaps);
+ free (df_lr->problem_data);
+ df_lr->problem_data = NULL;
}
BITMAP_FREE (df_lr->out_of_date_transfer_functions);
@@ -1104,21 +1067,24 @@ df_lr_top_dump (basic_block bb, FILE *file)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index);
struct df_lr_problem_data *problem_data;
- if (!bb_info || !bb_info->in)
+ if (!bb_info)
return;
fprintf (file, ";; lr in \t");
- df_print_regset (file, bb_info->in);
+ df_print_regset (file, &bb_info->in);
if (df_lr->problem_data)
{
problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
- fprintf (file, ";; old in \t");
- df_print_regset (file, problem_data->in[bb->index]);
+ if (problem_data->in)
+ {
+ fprintf (file, ";; old in \t");
+ df_print_regset (file, &problem_data->in[bb->index]);
+ }
}
fprintf (file, ";; lr use \t");
- df_print_regset (file, bb_info->use);
+ df_print_regset (file, &bb_info->use);
fprintf (file, ";; lr def \t");
- df_print_regset (file, bb_info->def);
+ df_print_regset (file, &bb_info->def);
}
@@ -1129,16 +1095,19 @@ df_lr_bottom_dump (basic_block bb, FILE *file)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index);
struct df_lr_problem_data *problem_data;
- if (!bb_info || !bb_info->out)
+ if (!bb_info)
return;
fprintf (file, ";; lr out \t");
- df_print_regset (file, bb_info->out);
+ df_print_regset (file, &bb_info->out);
if (df_lr->problem_data)
{
problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
- fprintf (file, ";; old out \t");
- df_print_regset (file, problem_data->out[bb->index]);
+ if (problem_data->out)
+ {
+ fprintf (file, ";; old out \t");
+ df_print_regset (file, &problem_data->out[bb->index]);
+ }
}
}
@@ -1152,25 +1121,21 @@ df_lr_verify_solution_start (void)
basic_block bb;
struct df_lr_problem_data *problem_data;
if (df_lr->solutions_dirty)
- {
- df_lr->problem_data = NULL;
- return;
- }
+ return;
/* Set it true so that the solution is recomputed. */
df_lr->solutions_dirty = true;
- problem_data = XNEW (struct df_lr_problem_data);
- df_lr->problem_data = problem_data;
- problem_data->in = XNEWVEC (bitmap, last_basic_block);
- problem_data->out = XNEWVEC (bitmap, last_basic_block);
+ problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
+ problem_data->in = XNEWVEC (bitmap_head, last_basic_block);
+ problem_data->out = XNEWVEC (bitmap_head, last_basic_block);
FOR_ALL_BB (bb)
{
- problem_data->in[bb->index] = BITMAP_ALLOC (NULL);
- problem_data->out[bb->index] = BITMAP_ALLOC (NULL);
- bitmap_copy (problem_data->in[bb->index], DF_LR_IN (bb));
- bitmap_copy (problem_data->out[bb->index], DF_LR_OUT (bb));
+ bitmap_initialize (&problem_data->in[bb->index], &problem_data->lr_bitmaps);
+ bitmap_initialize (&problem_data->out[bb->index], &problem_data->lr_bitmaps);
+ bitmap_copy (&problem_data->in[bb->index], DF_LR_IN (bb));
+ bitmap_copy (&problem_data->out[bb->index], DF_LR_OUT (bb));
}
}
@@ -1184,11 +1149,11 @@ df_lr_verify_solution_end (void)
struct df_lr_problem_data *problem_data;
basic_block bb;
- if (df_lr->problem_data == NULL)
- return;
-
problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
+ if (!problem_data->out)
+ return;
+
if (df_lr->solutions_dirty)
/* Do not check if the solution is still dirty. See the comment
in df_lr_finalize for details. */
@@ -1196,8 +1161,8 @@ df_lr_verify_solution_end (void)
else
FOR_ALL_BB (bb)
{
- if ((!bitmap_equal_p (problem_data->in[bb->index], DF_LR_IN (bb)))
- || (!bitmap_equal_p (problem_data->out[bb->index], DF_LR_OUT (bb))))
+ if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LR_IN (bb)))
+ || (!bitmap_equal_p (&problem_data->out[bb->index], DF_LR_OUT (bb))))
{
/*df_dump (stderr);*/
gcc_unreachable ();
@@ -1208,14 +1173,14 @@ df_lr_verify_solution_end (void)
if the comparison fails. */
FOR_ALL_BB (bb)
{
- BITMAP_FREE (problem_data->in[bb->index]);
- BITMAP_FREE (problem_data->out[bb->index]);
+ bitmap_clear (&problem_data->in[bb->index]);
+ bitmap_clear (&problem_data->out[bb->index]);
}
free (problem_data->in);
free (problem_data->out);
- free (problem_data);
- df_lr->problem_data = NULL;
+ problem_data->in = NULL;
+ problem_data->out = NULL;
}
@@ -1243,6 +1208,7 @@ static struct df_problem problem_LR =
df_lr_verify_solution_start,/* Incremental solution verify start. */
df_lr_verify_solution_end, /* Incremental solution verify end. */
NULL, /* Dependent problem. */
+ sizeof (struct df_lr_bb_info),/* Size of entry of block_info array. */
TV_DF_LR, /* Timing variable. */
false /* Reset blocks on dropping out of blocks_to_analyze. */
};
@@ -1269,25 +1235,21 @@ void
df_lr_verify_transfer_functions (void)
{
basic_block bb;
- bitmap saved_def;
- bitmap saved_use;
- bitmap saved_adef;
- bitmap saved_ause;
- bitmap all_blocks;
+ bitmap_head saved_def;
+ bitmap_head saved_use;
+ bitmap_head all_blocks;
if (!df)
return;
- saved_def = BITMAP_ALLOC (NULL);
- saved_use = BITMAP_ALLOC (NULL);
- saved_adef = BITMAP_ALLOC (NULL);
- saved_ause = BITMAP_ALLOC (NULL);
- all_blocks = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&saved_def, &bitmap_default_obstack);
+ bitmap_initialize (&saved_use, &bitmap_default_obstack);
+ bitmap_initialize (&all_blocks, &bitmap_default_obstack);
FOR_ALL_BB (bb)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index);
- bitmap_set_bit (all_blocks, bb->index);
+ bitmap_set_bit (&all_blocks, bb->index);
if (bb_info)
{
@@ -1297,14 +1259,14 @@ df_lr_verify_transfer_functions (void)
if (!bitmap_bit_p (df_lr->out_of_date_transfer_functions,
bb->index))
{
- bitmap_copy (saved_def, bb_info->def);
- bitmap_copy (saved_use, bb_info->use);
- bitmap_clear (bb_info->def);
- bitmap_clear (bb_info->use);
+ bitmap_copy (&saved_def, &bb_info->def);
+ bitmap_copy (&saved_use, &bb_info->use);
+ bitmap_clear (&bb_info->def);
+ bitmap_clear (&bb_info->use);
df_lr_bb_local_compute (bb->index);
- gcc_assert (bitmap_equal_p (saved_def, bb_info->def));
- gcc_assert (bitmap_equal_p (saved_use, bb_info->use));
+ gcc_assert (bitmap_equal_p (&saved_def, &bb_info->def));
+ gcc_assert (bitmap_equal_p (&saved_use, &bb_info->use));
}
}
else
@@ -1322,13 +1284,11 @@ df_lr_verify_transfer_functions (void)
/* Make sure there are no dirty bits in blocks that have been deleted. */
gcc_assert (!bitmap_intersect_compl_p (df_lr->out_of_date_transfer_functions,
- all_blocks));
+ &all_blocks));
- BITMAP_FREE (saved_def);
- BITMAP_FREE (saved_use);
- BITMAP_FREE (saved_adef);
- BITMAP_FREE (saved_ause);
- BITMAP_FREE (all_blocks);
+ bitmap_clear (&saved_def);
+ bitmap_clear (&saved_use);
+ bitmap_clear (&all_blocks);
}
@@ -1355,25 +1315,16 @@ df_lr_verify_transfer_functions (void)
/* Private data used to verify the solution for this problem. */
struct df_live_problem_data
{
- bitmap *in;
- bitmap *out;
+ bitmap_head *in;
+ bitmap_head *out;
+ /* An obstack for the bitmaps we need for this problem. */
+ bitmap_obstack live_bitmaps;
};
/* Scratch var used by transfer functions. This is used to implement
an optimization to reduce the amount of space used to compute the
combined lr and live analysis. */
-static bitmap df_live_scratch;
-
-/* Set basic block info. */
-
-static void
-df_live_set_bb_info (unsigned int index,
- struct df_live_bb_info *bb_info)
-{
- gcc_assert (df_live);
- gcc_assert (index < df_live->block_info_size);
- df_live->block_info[index] = bb_info;
-}
+static bitmap_head df_live_scratch;
/* Free basic block info. */
@@ -1385,11 +1336,10 @@ df_live_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
struct df_live_bb_info *bb_info = (struct df_live_bb_info *) vbb_info;
if (bb_info)
{
- BITMAP_FREE (bb_info->gen);
- BITMAP_FREE (bb_info->kill);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- pool_free (df_live->block_pool, bb_info);
+ bitmap_clear (&bb_info->gen);
+ bitmap_clear (&bb_info->kill);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -1402,31 +1352,39 @@ df_live_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
{
unsigned int bb_index;
bitmap_iterator bi;
+ struct df_live_problem_data *problem_data;
+
+ if (df_live->problem_data)
+ problem_data = (struct df_live_problem_data *) df_live->problem_data;
+ else
+ {
+ problem_data = XNEW (struct df_live_problem_data);
+ df_live->problem_data = problem_data;
- if (!df_live->block_pool)
- df_live->block_pool = create_alloc_pool ("df_live_block pool",
- sizeof (struct df_live_bb_info), 100);
- if (!df_live_scratch)
- df_live_scratch = BITMAP_ALLOC (NULL);
+ problem_data->out = NULL;
+ problem_data->in = NULL;
+ bitmap_obstack_initialize (&problem_data->live_bitmaps);
+ bitmap_initialize (&df_live_scratch, &problem_data->live_bitmaps);
+ }
df_grow_bb_info (df_live);
EXECUTE_IF_SET_IN_BITMAP (df_live->out_of_date_transfer_functions, 0, bb_index, bi)
{
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
- if (bb_info)
+
+ /* When bitmaps are already initialized, just clear them. */
+ if (bb_info->kill.obstack)
{
- bitmap_clear (bb_info->kill);
- bitmap_clear (bb_info->gen);
+ bitmap_clear (&bb_info->kill);
+ bitmap_clear (&bb_info->gen);
}
else
{
- bb_info = (struct df_live_bb_info *) pool_alloc (df_live->block_pool);
- df_live_set_bb_info (bb_index, bb_info);
- bb_info->kill = BITMAP_ALLOC (NULL);
- bb_info->gen = BITMAP_ALLOC (NULL);
- bb_info->in = BITMAP_ALLOC (NULL);
- bb_info->out = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&bb_info->kill, &problem_data->live_bitmaps);
+ bitmap_initialize (&bb_info->gen, &problem_data->live_bitmaps);
+ bitmap_initialize (&bb_info->in, &problem_data->live_bitmaps);
+ bitmap_initialize (&bb_info->out, &problem_data->live_bitmaps);
}
}
df_live->optional_p = (optimize <= 1);
@@ -1445,8 +1403,8 @@ df_live_reset (bitmap all_blocks)
{
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
gcc_assert (bb_info);
- bitmap_clear (bb_info->in);
- bitmap_clear (bb_info->out);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -1489,20 +1447,20 @@ df_live_bb_local_compute (unsigned int bb_index)
DF_REF_PARTIAL | DF_REF_CONDITIONAL))
/* All partial or conditional def
seen are included in the gen set. */
- bitmap_set_bit (bb_info->gen, regno);
+ bitmap_set_bit (&bb_info->gen, regno);
else if (DF_REF_FLAGS_IS_SET (def, DF_REF_MUST_CLOBBER))
/* Only must clobbers for the entire reg destroy the
value. */
- bitmap_set_bit (bb_info->kill, regno);
+ bitmap_set_bit (&bb_info->kill, regno);
else if (! DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER))
- bitmap_set_bit (bb_info->gen, regno);
+ bitmap_set_bit (&bb_info->gen, regno);
}
}
for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
{
df_ref def = *def_rec;
- bitmap_set_bit (bb_info->gen, DF_REF_REGNO (def));
+ bitmap_set_bit (&bb_info->gen, DF_REF_REGNO (def));
}
}
@@ -1542,23 +1500,23 @@ df_live_init (bitmap all_blocks)
/* No register may reach a location where it is not used. Thus
we trim the rr result to the places where it is used. */
- bitmap_and (bb_info->out, bb_info->gen, bb_lr_info->out);
- bitmap_clear (bb_info->in);
+ bitmap_and (&bb_info->out, &bb_info->gen, &bb_lr_info->out);
+ bitmap_clear (&bb_info->in);
}
}
/* Forward confluence function that ignores fake edges. */
-static void
+static bool
df_live_confluence_n (edge e)
{
- bitmap op1 = df_live_get_bb_info (e->dest->index)->in;
- bitmap op2 = df_live_get_bb_info (e->src->index)->out;
+ bitmap op1 = &df_live_get_bb_info (e->dest->index)->in;
+ bitmap op2 = &df_live_get_bb_info (e->src->index)->out;
if (e->flags & EDGE_FAKE)
- return;
+ return false;
- bitmap_ior_into (op1, op2);
+ return bitmap_ior_into (op1, op2);
}
@@ -1569,20 +1527,20 @@ df_live_transfer_function (int bb_index)
{
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
struct df_lr_bb_info *bb_lr_info = df_lr_get_bb_info (bb_index);
- bitmap in = bb_info->in;
- bitmap out = bb_info->out;
- bitmap gen = bb_info->gen;
- bitmap kill = bb_info->kill;
+ bitmap in = &bb_info->in;
+ bitmap out = &bb_info->out;
+ bitmap gen = &bb_info->gen;
+ bitmap kill = &bb_info->kill;
/* We need to use a scratch set here so that the value returned from this
function invocation properly reflects whether the sets changed in a
significant way; i.e. not just because the lr set was anded in. */
- bitmap_and (df_live_scratch, gen, bb_lr_info->out);
+ bitmap_and (&df_live_scratch, gen, &bb_lr_info->out);
/* No register may reach a location where it is not used. Thus
we trim the rr result to the places where it is used. */
- bitmap_and_into (in, bb_lr_info->in);
+ bitmap_and_into (in, &bb_lr_info->in);
- return bitmap_ior_and_compl (out, df_live_scratch, in, kill);
+ return bitmap_ior_and_compl (out, &df_live_scratch, in, kill);
}
@@ -1604,8 +1562,8 @@ df_live_finalize (bitmap all_blocks)
/* No register may reach a location where it is not used. Thus
we trim the rr result to the places where it is used. */
- bitmap_and_into (bb_live_info->in, bb_lr_info->in);
- bitmap_and_into (bb_live_info->out, bb_lr_info->out);
+ bitmap_and_into (&bb_live_info->in, &bb_lr_info->in);
+ bitmap_and_into (&bb_live_info->out, &bb_lr_info->out);
}
df_live->solutions_dirty = false;
@@ -1618,28 +1576,17 @@ df_live_finalize (bitmap all_blocks)
static void
df_live_free (void)
{
+ struct df_live_problem_data *problem_data
+ = (struct df_live_problem_data *) df_live->problem_data;
if (df_live->block_info)
{
- unsigned int i;
-
- for (i = 0; i < df_live->block_info_size; i++)
- {
- struct df_live_bb_info *bb_info = df_live_get_bb_info (i);
- if (bb_info)
- {
- BITMAP_FREE (bb_info->gen);
- BITMAP_FREE (bb_info->kill);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- }
- }
-
- free_alloc_pool (df_live->block_pool);
df_live->block_info_size = 0;
free (df_live->block_info);
-
- if (df_live_scratch)
- BITMAP_FREE (df_live_scratch);
+ df_live->block_info = NULL;
+ bitmap_clear (&df_live_scratch);
+ bitmap_obstack_release (&problem_data->live_bitmaps);
+ free (problem_data);
+ df_live->problem_data = NULL;
}
BITMAP_FREE (df_live->out_of_date_transfer_functions);
free (df_live);
@@ -1654,21 +1601,24 @@ df_live_top_dump (basic_block bb, FILE *file)
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index);
struct df_live_problem_data *problem_data;
- if (!bb_info || !bb_info->in)
+ if (!bb_info)
return;
fprintf (file, ";; live in \t");
- df_print_regset (file, bb_info->in);
+ df_print_regset (file, &bb_info->in);
if (df_live->problem_data)
{
problem_data = (struct df_live_problem_data *)df_live->problem_data;
- fprintf (file, ";; old in \t");
- df_print_regset (file, problem_data->in[bb->index]);
+ if (problem_data->in)
+ {
+ fprintf (file, ";; old in \t");
+ df_print_regset (file, &problem_data->in[bb->index]);
+ }
}
fprintf (file, ";; live gen \t");
- df_print_regset (file, bb_info->gen);
+ df_print_regset (file, &bb_info->gen);
fprintf (file, ";; live kill\t");
- df_print_regset (file, bb_info->kill);
+ df_print_regset (file, &bb_info->kill);
}
@@ -1680,16 +1630,19 @@ df_live_bottom_dump (basic_block bb, FILE *file)
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index);
struct df_live_problem_data *problem_data;
- if (!bb_info || !bb_info->out)
+ if (!bb_info)
return;
fprintf (file, ";; live out \t");
- df_print_regset (file, bb_info->out);
+ df_print_regset (file, &bb_info->out);
if (df_live->problem_data)
{
problem_data = (struct df_live_problem_data *)df_live->problem_data;
- fprintf (file, ";; old out \t");
- df_print_regset (file, problem_data->out[bb->index]);
+ if (problem_data->out)
+ {
+ fprintf (file, ";; old out \t");
+ df_print_regset (file, &problem_data->out[bb->index]);
+ }
}
}
@@ -1703,25 +1656,21 @@ df_live_verify_solution_start (void)
basic_block bb;
struct df_live_problem_data *problem_data;
if (df_live->solutions_dirty)
- {
- df_live->problem_data = NULL;
- return;
- }
+ return;
/* Set it true so that the solution is recomputed. */
df_live->solutions_dirty = true;
- problem_data = XNEW (struct df_live_problem_data);
- df_live->problem_data = problem_data;
- problem_data->in = XNEWVEC (bitmap, last_basic_block);
- problem_data->out = XNEWVEC (bitmap, last_basic_block);
+ problem_data = (struct df_live_problem_data *)df_live->problem_data;
+ problem_data->in = XNEWVEC (bitmap_head, last_basic_block);
+ problem_data->out = XNEWVEC (bitmap_head, last_basic_block);
FOR_ALL_BB (bb)
{
- problem_data->in[bb->index] = BITMAP_ALLOC (NULL);
- problem_data->out[bb->index] = BITMAP_ALLOC (NULL);
- bitmap_copy (problem_data->in[bb->index], DF_LIVE_IN (bb));
- bitmap_copy (problem_data->out[bb->index], DF_LIVE_OUT (bb));
+ bitmap_initialize (&problem_data->in[bb->index], &problem_data->live_bitmaps);
+ bitmap_initialize (&problem_data->out[bb->index], &problem_data->live_bitmaps);
+ bitmap_copy (&problem_data->in[bb->index], DF_LIVE_IN (bb));
+ bitmap_copy (&problem_data->out[bb->index], DF_LIVE_OUT (bb));
}
}
@@ -1735,15 +1684,14 @@ df_live_verify_solution_end (void)
struct df_live_problem_data *problem_data;
basic_block bb;
- if (df_live->problem_data == NULL)
- return;
-
problem_data = (struct df_live_problem_data *)df_live->problem_data;
+ if (!problem_data->out)
+ return;
FOR_ALL_BB (bb)
{
- if ((!bitmap_equal_p (problem_data->in[bb->index], DF_LIVE_IN (bb)))
- || (!bitmap_equal_p (problem_data->out[bb->index], DF_LIVE_OUT (bb))))
+ if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LIVE_IN (bb)))
+ || (!bitmap_equal_p (&problem_data->out[bb->index], DF_LIVE_OUT (bb))))
{
/*df_dump (stderr);*/
gcc_unreachable ();
@@ -1754,8 +1702,8 @@ df_live_verify_solution_end (void)
if the comparison fails. */
FOR_ALL_BB (bb)
{
- BITMAP_FREE (problem_data->in[bb->index]);
- BITMAP_FREE (problem_data->out[bb->index]);
+ bitmap_clear (&problem_data->in[bb->index]);
+ bitmap_clear (&problem_data->out[bb->index]);
}
free (problem_data->in);
@@ -1789,6 +1737,7 @@ static struct df_problem problem_LIVE =
df_live_verify_solution_start,/* Incremental solution verify start. */
df_live_verify_solution_end, /* Incremental solution verify end. */
&problem_LR, /* Dependent problem. */
+ sizeof (struct df_live_bb_info),/* Size of entry of block_info array. */
TV_DF_LIVE, /* Timing variable. */
false /* Reset blocks on dropping out of blocks_to_analyze. */
};
@@ -1828,23 +1777,23 @@ void
df_live_verify_transfer_functions (void)
{
basic_block bb;
- bitmap saved_gen;
- bitmap saved_kill;
- bitmap all_blocks;
+ bitmap_head saved_gen;
+ bitmap_head saved_kill;
+ bitmap_head all_blocks;
if (!df)
return;
- saved_gen = BITMAP_ALLOC (NULL);
- saved_kill = BITMAP_ALLOC (NULL);
- all_blocks = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&saved_gen, &bitmap_default_obstack);
+ bitmap_initialize (&saved_kill, &bitmap_default_obstack);
+ bitmap_initialize (&all_blocks, &bitmap_default_obstack);
df_grow_insn_info ();
FOR_ALL_BB (bb)
{
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index);
- bitmap_set_bit (all_blocks, bb->index);
+ bitmap_set_bit (&all_blocks, bb->index);
if (bb_info)
{
@@ -1854,14 +1803,14 @@ df_live_verify_transfer_functions (void)
if (!bitmap_bit_p (df_live->out_of_date_transfer_functions,
bb->index))
{
- bitmap_copy (saved_gen, bb_info->gen);
- bitmap_copy (saved_kill, bb_info->kill);
- bitmap_clear (bb_info->gen);
- bitmap_clear (bb_info->kill);
+ bitmap_copy (&saved_gen, &bb_info->gen);
+ bitmap_copy (&saved_kill, &bb_info->kill);
+ bitmap_clear (&bb_info->gen);
+ bitmap_clear (&bb_info->kill);
df_live_bb_local_compute (bb->index);
- gcc_assert (bitmap_equal_p (saved_gen, bb_info->gen));
- gcc_assert (bitmap_equal_p (saved_kill, bb_info->kill));
+ gcc_assert (bitmap_equal_p (&saved_gen, &bb_info->gen));
+ gcc_assert (bitmap_equal_p (&saved_kill, &bb_info->kill));
}
}
else
@@ -1879,10 +1828,10 @@ df_live_verify_transfer_functions (void)
/* Make sure there are no dirty bits in blocks that have been deleted. */
gcc_assert (!bitmap_intersect_compl_p (df_live->out_of_date_transfer_functions,
- all_blocks));
- BITMAP_FREE (saved_gen);
- BITMAP_FREE (saved_kill);
- BITMAP_FREE (all_blocks);
+ &all_blocks));
+ bitmap_clear (&saved_gen);
+ bitmap_clear (&saved_kill);
+ bitmap_clear (&all_blocks);
}
/*----------------------------------------------------------------------------
@@ -2109,9 +2058,10 @@ df_chain_create_bb (unsigned int bb_index)
basic_block bb = BASIC_BLOCK (bb_index);
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
rtx insn;
- bitmap cpy = BITMAP_ALLOC (NULL);
+ bitmap_head cpy;
- bitmap_copy (cpy, bb_info->in);
+ bitmap_initialize (&cpy, &bitmap_default_obstack);
+ bitmap_copy (&cpy, &bb_info->in);
bitmap_set_bit (df_chain->out_of_date_transfer_functions, bb_index);
/* Since we are going forwards, process the artificial uses first
@@ -2123,12 +2073,12 @@ df_chain_create_bb (unsigned int bb_index)
/* Artificials are only hard regs. */
if (!(df->changeable_flags & DF_NO_HARD_REGS))
- df_chain_create_bb_process_use (cpy,
+ df_chain_create_bb_process_use (&cpy,
df_get_artificial_uses (bb->index),
DF_REF_AT_TOP);
#endif
- df_rd_simulate_artificial_defs_at_top (bb, cpy);
+ df_rd_simulate_artificial_defs_at_top (bb, &cpy);
/* Process the regular instructions next. */
FOR_BB_INSNS (bb, insn)
@@ -2138,22 +2088,22 @@ df_chain_create_bb (unsigned int bb_index)
/* First scan the uses and link them up with the defs that remain
in the cpy vector. */
- df_chain_create_bb_process_use (cpy, DF_INSN_UID_USES (uid), 0);
+ df_chain_create_bb_process_use (&cpy, DF_INSN_UID_USES (uid), 0);
if (df->changeable_flags & DF_EQ_NOTES)
- df_chain_create_bb_process_use (cpy, DF_INSN_UID_EQ_USES (uid), 0);
+ df_chain_create_bb_process_use (&cpy, DF_INSN_UID_EQ_USES (uid), 0);
/* Since we are going forwards, process the defs second. */
- df_rd_simulate_one_insn (bb, insn, cpy);
+ df_rd_simulate_one_insn (bb, insn, &cpy);
}
/* Create the chains for the artificial uses of the hard registers
at the end of the block. */
if (!(df->changeable_flags & DF_NO_HARD_REGS))
- df_chain_create_bb_process_use (cpy,
+ df_chain_create_bb_process_use (&cpy,
df_get_artificial_uses (bb->index),
0);
- BITMAP_FREE (cpy);
+ bitmap_clear (&cpy);
}
/* Create def-use chains from reaching use bitmaps for basic blocks
@@ -2314,6 +2264,7 @@ static struct df_problem problem_CHAIN =
NULL, /* Incremental solution verify start. */
NULL, /* Incremental solution verify end. */
&problem_RD, /* Dependent problem. */
+ sizeof (struct df_scan_bb_info),/* Size of entry of block_info array. */
TV_DF_CHAIN, /* Timing variable. */
false /* Reset blocks on dropping out of blocks_to_analyze. */
};
@@ -2368,12 +2319,12 @@ df_chain_add_problem (unsigned int chain_flags)
struct df_byte_lr_problem_data
{
/* Expanded versions of bitvectors used in lr. */
- bitmap invalidated_by_call;
- bitmap hardware_regs_used;
+ bitmap_head invalidated_by_call;
+ bitmap_head hardware_regs_used;
/* Indexed by regno, this is true if there are subregs, extracts or
strict_low_parts for this regno. */
- bitmap needs_expansion;
+ bitmap_head needs_expansion;
/* The start position and len for each regno in the various bit
vectors. */
@@ -2406,18 +2357,6 @@ df_byte_lr_get_regno_len (unsigned int regno)
}
-/* Set basic block info. */
-
-static void
-df_byte_lr_set_bb_info (unsigned int index,
- struct df_byte_lr_bb_info *bb_info)
-{
- gcc_assert (df_byte_lr);
- gcc_assert (index < df_byte_lr->block_info_size);
- df_byte_lr->block_info[index] = bb_info;
-}
-
-
/* Free basic block info. */
static void
@@ -2427,11 +2366,10 @@ df_byte_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
struct df_byte_lr_bb_info *bb_info = (struct df_byte_lr_bb_info *) vbb_info;
if (bb_info)
{
- BITMAP_FREE (bb_info->use);
- BITMAP_FREE (bb_info->def);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- pool_free (df_byte_lr->block_pool, bb_info);
+ bitmap_clear (&bb_info->use);
+ bitmap_clear (&bb_info->def);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -2452,7 +2390,7 @@ df_byte_lr_check_regs (df_ref *ref_rec)
| DF_REF_ZERO_EXTRACT
| DF_REF_STRICT_LOW_PART)
|| GET_CODE (DF_REF_REG (ref)) == SUBREG)
- bitmap_set_bit (problem_data->needs_expansion, DF_REF_REGNO (ref));
+ bitmap_set_bit (&problem_data->needs_expansion, DF_REF_REGNO (ref));
}
}
@@ -2494,10 +2432,6 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
df_byte_lr->problem_data = problem_data;
- if (!df_byte_lr->block_pool)
- df_byte_lr->block_pool = create_alloc_pool ("df_byte_lr_block pool",
- sizeof (struct df_byte_lr_bb_info), 50);
-
df_grow_bb_info (df_byte_lr);
/* Create the mapping from regnos to slots. This does not change
@@ -2509,9 +2443,12 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
bitmap_obstack_initialize (&problem_data->byte_lr_bitmaps);
problem_data->regno_start = XNEWVEC (unsigned int, max_reg);
problem_data->regno_len = XNEWVEC (unsigned int, max_reg);
- problem_data->hardware_regs_used = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
- problem_data->invalidated_by_call = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
- problem_data->needs_expansion = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
+ bitmap_initialize (&problem_data->hardware_regs_used,
+ &problem_data->byte_lr_bitmaps);
+ bitmap_initialize (&problem_data->invalidated_by_call,
+ &problem_data->byte_lr_bitmaps);
+ bitmap_initialize (&problem_data->needs_expansion,
+ &problem_data->byte_lr_bitmaps);
/* Discover which regno's use subregs, extracts or
strict_low_parts. */
@@ -2538,7 +2475,7 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
{
int len;
problem_data->regno_start[regno] = index;
- if (bitmap_bit_p (problem_data->needs_expansion, regno))
+ if (bitmap_bit_p (&problem_data->needs_expansion, regno))
len = GET_MODE_SIZE (GET_MODE (regno_reg_rtx[regno]));
else
len = 1;
@@ -2547,27 +2484,27 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
index += len;
}
- df_byte_lr_expand_bitmap (problem_data->hardware_regs_used,
- df->hardware_regs_used);
- df_byte_lr_expand_bitmap (problem_data->invalidated_by_call,
+ df_byte_lr_expand_bitmap (&problem_data->hardware_regs_used,
+ &df->hardware_regs_used);
+ df_byte_lr_expand_bitmap (&problem_data->invalidated_by_call,
regs_invalidated_by_call_regset);
EXECUTE_IF_SET_IN_BITMAP (df_byte_lr->out_of_date_transfer_functions, 0, bb_index, bi)
{
struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb_index);
- if (bb_info)
+
+ /* When bitmaps are already initialized, just clear them. */
+ if (bb_info->use.obstack)
{
- bitmap_clear (bb_info->def);
- bitmap_clear (bb_info->use);
+ bitmap_clear (&bb_info->def);
+ bitmap_clear (&bb_info->use);
}
else
{
- bb_info = (struct df_byte_lr_bb_info *) pool_alloc (df_byte_lr->block_pool);
- df_byte_lr_set_bb_info (bb_index, bb_info);
- bb_info->use = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
- bb_info->def = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
- bb_info->in = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
- bb_info->out = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
+ bitmap_initialize (&bb_info->use, &problem_data->byte_lr_bitmaps);
+ bitmap_initialize (&bb_info->def, &problem_data->byte_lr_bitmaps);
+ bitmap_initialize (&bb_info->in, &problem_data->byte_lr_bitmaps);
+ bitmap_initialize (&bb_info->out, &problem_data->byte_lr_bitmaps);
}
}
@@ -2587,8 +2524,8 @@ df_byte_lr_reset (bitmap all_blocks)
{
struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb_index);
gcc_assert (bb_info);
- bitmap_clear (bb_info->in);
- bitmap_clear (bb_info->out);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -2615,8 +2552,8 @@ df_byte_lr_bb_local_compute (unsigned int bb_index)
unsigned int dregno = DF_REF_REGNO (def);
unsigned int start = problem_data->regno_start[dregno];
unsigned int len = problem_data->regno_len[dregno];
- bitmap_set_range (bb_info->def, start, len);
- bitmap_clear_range (bb_info->use, start, len);
+ bitmap_set_range (&bb_info->def, start, len);
+ bitmap_clear_range (&bb_info->use, start, len);
}
}
@@ -2630,7 +2567,7 @@ df_byte_lr_bb_local_compute (unsigned int bb_index)
unsigned int uregno = DF_REF_REGNO (use);
unsigned int start = problem_data->regno_start[uregno];
unsigned int len = problem_data->regno_len[uregno];
- bitmap_set_range (bb_info->use, start, len);
+ bitmap_set_range (&bb_info->use, start, len);
}
}
@@ -2660,8 +2597,8 @@ df_byte_lr_bb_local_compute (unsigned int bb_index)
}
if (len)
{
- bitmap_set_range (bb_info->def, start, len);
- bitmap_clear_range (bb_info->use, start, len);
+ bitmap_set_range (&bb_info->def, start, len);
+ bitmap_clear_range (&bb_info->use, start, len);
}
}
}
@@ -2681,7 +2618,7 @@ df_byte_lr_bb_local_compute (unsigned int bb_index)
}
/* Add use to set of uses in this BB. */
if (len)
- bitmap_set_range (bb_info->use, start, len);
+ bitmap_set_range (&bb_info->use, start, len);
}
}
@@ -2696,8 +2633,8 @@ df_byte_lr_bb_local_compute (unsigned int bb_index)
unsigned int dregno = DF_REF_REGNO (def);
unsigned int start = problem_data->regno_start[dregno];
unsigned int len = problem_data->regno_len[dregno];
- bitmap_set_range (bb_info->def, start, len);
- bitmap_clear_range (bb_info->use, start, len);
+ bitmap_set_range (&bb_info->def, start, len);
+ bitmap_clear_range (&bb_info->use, start, len);
}
}
@@ -2712,7 +2649,7 @@ df_byte_lr_bb_local_compute (unsigned int bb_index)
unsigned int uregno = DF_REF_REGNO (use);
unsigned int start = problem_data->regno_start[uregno];
unsigned int len = problem_data->regno_len[uregno];
- bitmap_set_range (bb_info->use, start, len);
+ bitmap_set_range (&bb_info->use, start, len);
}
}
#endif
@@ -2734,7 +2671,7 @@ df_byte_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
/* The exit block is special for this problem and its bits are
computed from thin air. */
struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (EXIT_BLOCK);
- df_byte_lr_expand_bitmap (bb_info->use, df->exit_block_uses);
+ df_byte_lr_expand_bitmap (&bb_info->use, df->exit_block_uses);
}
else
df_byte_lr_bb_local_compute (bb_index);
@@ -2755,8 +2692,8 @@ df_byte_lr_init (bitmap all_blocks)
EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
{
struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb_index);
- bitmap_copy (bb_info->in, bb_info->use);
- bitmap_clear (bb_info->out);
+ bitmap_copy (&bb_info->in, &bb_info->use);
+ bitmap_clear (&bb_info->out);
}
}
@@ -2769,31 +2706,34 @@ df_byte_lr_confluence_0 (basic_block bb)
{
struct df_byte_lr_problem_data *problem_data
= (struct df_byte_lr_problem_data *)df_byte_lr->problem_data;
- bitmap op1 = df_byte_lr_get_bb_info (bb->index)->out;
+ bitmap op1 = &df_byte_lr_get_bb_info (bb->index)->out;
if (bb != EXIT_BLOCK_PTR)
- bitmap_copy (op1, problem_data->hardware_regs_used);
+ bitmap_copy (op1, &problem_data->hardware_regs_used);
}
/* Confluence function that ignores fake edges. */
-static void
+static bool
df_byte_lr_confluence_n (edge e)
{
struct df_byte_lr_problem_data *problem_data
= (struct df_byte_lr_problem_data *)df_byte_lr->problem_data;
- bitmap op1 = df_byte_lr_get_bb_info (e->src->index)->out;
- bitmap op2 = df_byte_lr_get_bb_info (e->dest->index)->in;
+ bitmap op1 = &df_byte_lr_get_bb_info (e->src->index)->out;
+ bitmap op2 = &df_byte_lr_get_bb_info (e->dest->index)->in;
+ bool changed = false;
/* Call-clobbered registers die across exception and call edges. */
/* ??? Abnormal call edges ignored for the moment, as this gets
confused by sibling call edges, which crashes reg-stack. */
if (e->flags & EDGE_EH)
- bitmap_ior_and_compl_into (op1, op2, problem_data->invalidated_by_call);
+ changed = bitmap_ior_and_compl_into (op1, op2,
+ &problem_data->invalidated_by_call);
else
- bitmap_ior_into (op1, op2);
+ changed = bitmap_ior_into (op1, op2);
- bitmap_ior_into (op1, problem_data->hardware_regs_used);
+ changed |= bitmap_ior_into (op1, &problem_data->hardware_regs_used);
+ return changed;
}
@@ -2803,10 +2743,10 @@ static bool
df_byte_lr_transfer_function (int bb_index)
{
struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb_index);
- bitmap in = bb_info->in;
- bitmap out = bb_info->out;
- bitmap use = bb_info->use;
- bitmap def = bb_info->def;
+ bitmap in = &bb_info->in;
+ bitmap out = &bb_info->out;
+ bitmap use = &bb_info->use;
+ bitmap def = &bb_info->def;
return bitmap_ior_and_compl (in, use, out, def);
}
@@ -2823,9 +2763,9 @@ df_byte_lr_free (void)
if (df_byte_lr->block_info)
{
- free_alloc_pool (df_byte_lr->block_pool);
df_byte_lr->block_info_size = 0;
free (df_byte_lr->block_info);
+ df_byte_lr->block_info = NULL;
}
BITMAP_FREE (df_byte_lr->out_of_date_transfer_functions);
@@ -2843,15 +2783,15 @@ static void
df_byte_lr_top_dump (basic_block bb, FILE *file)
{
struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb->index);
- if (!bb_info || !bb_info->in)
+ if (!bb_info)
return;
fprintf (file, ";; blr in \t");
- df_print_byte_regset (file, bb_info->in);
+ df_print_byte_regset (file, &bb_info->in);
fprintf (file, ";; blr use \t");
- df_print_byte_regset (file, bb_info->use);
+ df_print_byte_regset (file, &bb_info->use);
fprintf (file, ";; blr def \t");
- df_print_byte_regset (file, bb_info->def);
+ df_print_byte_regset (file, &bb_info->def);
}
@@ -2861,11 +2801,11 @@ static void
df_byte_lr_bottom_dump (basic_block bb, FILE *file)
{
struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb->index);
- if (!bb_info || !bb_info->out)
+ if (!bb_info)
return;
fprintf (file, ";; blr out \t");
- df_print_byte_regset (file, bb_info->out);
+ df_print_byte_regset (file, &bb_info->out);
}
@@ -2892,7 +2832,8 @@ static struct df_problem problem_BYTE_LR =
df_byte_lr_bottom_dump, /* Debugging end block. */
NULL, /* Incremental solution verify start. */
NULL, /* Incremental solution verify end. */
- NULL, /* Dependent problem. */
+ NULL, /* Dependent problem. */
+ sizeof (struct df_byte_lr_bb_info),/* Size of entry of block_info array. */
TV_DF_BYTE_LR, /* Timing variable. */
false /* Reset blocks on dropping out of blocks_to_analyze. */
};
@@ -3387,8 +3328,8 @@ df_create_unused_note (rtx insn, rtx old, df_ref def,
}
#endif
- if (!(bitmap_bit_p (live, dregno)
- || (DF_REF_FLAGS (def) & DF_REF_MW_HARDREG)
+ if (!((DF_REF_FLAGS (def) & DF_REF_MW_HARDREG)
+ || bitmap_bit_p (live, dregno)
|| bitmap_bit_p (artificial_uses, dregno)
|| df_ignore_stack_reg (dregno)))
{
@@ -3757,10 +3698,10 @@ df_note_bb_compute (unsigned int bb_index,
else
dead_debug_insert_before (&debug, uregno, insn);
- if ( (!(DF_REF_FLAGS (use) & DF_REF_MW_HARDREG))
+ if ( (!(DF_REF_FLAGS (use)
+ & (DF_REF_MW_HARDREG | DF_REF_READ_WRITE)))
&& (!bitmap_bit_p (do_not_gen, uregno))
&& (!bitmap_bit_p (artificial_uses, uregno))
- && (!(DF_REF_FLAGS (use) & DF_REF_READ_WRITE))
&& (!df_ignore_stack_reg (uregno)))
{
rtx reg = (DF_REF_LOC (use))
@@ -3808,9 +3749,11 @@ df_note_compute (bitmap all_blocks)
{
unsigned int bb_index;
bitmap_iterator bi;
- bitmap live = BITMAP_ALLOC (&df_bitmap_obstack);
- bitmap do_not_gen = BITMAP_ALLOC (&df_bitmap_obstack);
- bitmap artificial_uses = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head live, do_not_gen, artificial_uses;
+
+ bitmap_initialize (&live, &df_bitmap_obstack);
+ bitmap_initialize (&do_not_gen, &df_bitmap_obstack);
+ bitmap_initialize (&artificial_uses, &df_bitmap_obstack);
#ifdef REG_DEAD_DEBUGGING
if (dump_file)
@@ -3819,12 +3762,12 @@ df_note_compute (bitmap all_blocks)
EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
{
- df_note_bb_compute (bb_index, live, do_not_gen, artificial_uses);
+ df_note_bb_compute (bb_index, &live, &do_not_gen, &artificial_uses);
}
- BITMAP_FREE (live);
- BITMAP_FREE (do_not_gen);
- BITMAP_FREE (artificial_uses);
+ bitmap_clear (&live);
+ bitmap_clear (&do_not_gen);
+ bitmap_clear (&artificial_uses);
}
@@ -3861,6 +3804,7 @@ static struct df_problem problem_NOTE =
NULL, /* Incremental solution verify start. */
NULL, /* Incremental solution verify end. */
&problem_LR, /* Dependent problem. */
+ sizeof (struct df_scan_bb_info),/* Size of entry of block_info array. */
TV_DF_NOTE, /* Timing variable. */
false /* Reset blocks on dropping out of blocks_to_analyze. */
};
@@ -3978,9 +3922,9 @@ df_simulate_fixup_sets (basic_block bb, bitmap live)
/* These regs are considered always live so if they end up dying
because of some def, we need to bring the back again. */
if (bb_has_eh_pred (bb))
- bitmap_ior_into (live, df->eh_block_artificial_uses);
+ bitmap_ior_into (live, &df->eh_block_artificial_uses);
else
- bitmap_ior_into (live, df->regular_block_artificial_uses);
+ bitmap_ior_into (live, &df->regular_block_artificial_uses);
}
@@ -4189,20 +4133,16 @@ df_simulate_one_insn_forwards (basic_block bb, rtx insn, bitmap live)
propagating the information to BB3's successors.
---------------------------------------------------------------------------*/
+/* Private data used to verify the solution for this problem. */
+struct df_md_problem_data
+{
+ /* An obstack for the bitmaps we need for this problem. */
+ bitmap_obstack md_bitmaps;
+};
+
/* Scratch var used by transfer functions. This is used to do md analysis
only for live registers. */
-static bitmap df_md_scratch;
-
-/* Set basic block info. */
-
-static void
-df_md_set_bb_info (unsigned int index,
- struct df_md_bb_info *bb_info)
-{
- gcc_assert (df_md);
- gcc_assert (index < df_md->block_info_size);
- df_md->block_info[index] = bb_info;
-}
+static bitmap_head df_md_scratch;
static void
@@ -4212,12 +4152,11 @@ df_md_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
struct df_md_bb_info *bb_info = (struct df_md_bb_info *) vbb_info;
if (bb_info)
{
- BITMAP_FREE (bb_info->kill);
- BITMAP_FREE (bb_info->gen);
- BITMAP_FREE (bb_info->init);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- pool_free (df_md->block_pool, bb_info);
+ bitmap_clear (&bb_info->kill);
+ bitmap_clear (&bb_info->gen);
+ bitmap_clear (&bb_info->init);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -4230,34 +4169,38 @@ df_md_alloc (bitmap all_blocks)
{
unsigned int bb_index;
bitmap_iterator bi;
-
- if (!df_md->block_pool)
- df_md->block_pool = create_alloc_pool ("df_md_block pool",
- sizeof (struct df_md_bb_info), 50);
+ struct df_md_problem_data *problem_data;
df_grow_bb_info (df_md);
- df_md_scratch = BITMAP_ALLOC (NULL);
+ if (df_md->problem_data)
+ problem_data = (struct df_md_problem_data *) df_md->problem_data;
+ else
+ {
+ problem_data = XNEW (struct df_md_problem_data);
+ df_md->problem_data = problem_data;
+ bitmap_obstack_initialize (&problem_data->md_bitmaps);
+ }
+ bitmap_initialize (&df_md_scratch, &problem_data->md_bitmaps);
EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
{
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
- if (bb_info)
+ /* When bitmaps are already initialized, just clear them. */
+ if (bb_info->init.obstack)
{
- bitmap_clear (bb_info->init);
- bitmap_clear (bb_info->gen);
- bitmap_clear (bb_info->kill);
- bitmap_clear (bb_info->in);
- bitmap_clear (bb_info->out);
+ bitmap_clear (&bb_info->init);
+ bitmap_clear (&bb_info->gen);
+ bitmap_clear (&bb_info->kill);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
else
{
- bb_info = (struct df_md_bb_info *) pool_alloc (df_md->block_pool);
- df_md_set_bb_info (bb_index, bb_info);
- bb_info->init = BITMAP_ALLOC (NULL);
- bb_info->gen = BITMAP_ALLOC (NULL);
- bb_info->kill = BITMAP_ALLOC (NULL);
- bb_info->in = BITMAP_ALLOC (NULL);
- bb_info->out = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&bb_info->init, &problem_data->md_bitmaps);
+ bitmap_initialize (&bb_info->gen, &problem_data->md_bitmaps);
+ bitmap_initialize (&bb_info->kill, &problem_data->md_bitmaps);
+ bitmap_initialize (&bb_info->in, &problem_data->md_bitmaps);
+ bitmap_initialize (&bb_info->out, &problem_data->md_bitmaps);
}
}
@@ -4320,7 +4263,7 @@ df_md_bb_local_compute_process_def (struct df_md_bb_info *bb_info,
int top_flag)
{
df_ref def;
- bitmap_clear (seen_in_insn);
+ bitmap_clear (&seen_in_insn);
while ((def = *def_rec++) != NULL)
{
@@ -4329,21 +4272,21 @@ df_md_bb_local_compute_process_def (struct df_md_bb_info *bb_info,
|| (dregno >= FIRST_PSEUDO_REGISTER))
&& top_flag == (DF_REF_FLAGS (def) & DF_REF_AT_TOP))
{
- if (!bitmap_bit_p (seen_in_insn, dregno))
+ if (!bitmap_bit_p (&seen_in_insn, dregno))
{
if (DF_REF_FLAGS (def)
& (DF_REF_PARTIAL | DF_REF_CONDITIONAL | DF_REF_MAY_CLOBBER))
{
- bitmap_set_bit (bb_info->gen, dregno);
- bitmap_clear_bit (bb_info->kill, dregno);
+ bitmap_set_bit (&bb_info->gen, dregno);
+ bitmap_clear_bit (&bb_info->kill, dregno);
}
else
{
/* When we find a clobber and a regular def,
make sure the regular def wins. */
- bitmap_set_bit (seen_in_insn, dregno);
- bitmap_set_bit (bb_info->kill, dregno);
- bitmap_clear_bit (bb_info->gen, dregno);
+ bitmap_set_bit (&seen_in_insn, dregno);
+ bitmap_set_bit (&bb_info->kill, dregno);
+ bitmap_clear_bit (&bb_info->gen, dregno);
}
}
}
@@ -4389,38 +4332,38 @@ df_md_local_compute (bitmap all_blocks)
unsigned int bb_index, df_bb_index;
bitmap_iterator bi1, bi2;
basic_block bb;
- bitmap *frontiers;
+ bitmap_head *frontiers;
- seen_in_insn = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&seen_in_insn, &bitmap_default_obstack);
EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi1)
{
df_md_bb_local_compute (bb_index);
}
- BITMAP_FREE (seen_in_insn);
+ bitmap_clear (&seen_in_insn);
- frontiers = XNEWVEC (bitmap, last_basic_block);
+ frontiers = XNEWVEC (bitmap_head, last_basic_block);
FOR_ALL_BB (bb)
- frontiers[bb->index] = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack);
compute_dominance_frontiers (frontiers);
/* Add each basic block's kills to the nodes in the frontier of the BB. */
EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi1)
{
- bitmap kill = df_md_get_bb_info (bb_index)->kill;
- EXECUTE_IF_SET_IN_BITMAP (frontiers[bb_index], 0, df_bb_index, bi2)
+ bitmap kill = &df_md_get_bb_info (bb_index)->kill;
+ EXECUTE_IF_SET_IN_BITMAP (&frontiers[bb_index], 0, df_bb_index, bi2)
{
basic_block bb = BASIC_BLOCK (df_bb_index);
if (bitmap_bit_p (all_blocks, df_bb_index))
- bitmap_ior_and_into (df_md_get_bb_info (df_bb_index)->init, kill,
+ bitmap_ior_and_into (&df_md_get_bb_info (df_bb_index)->init, kill,
df_get_live_in (bb));
}
}
FOR_ALL_BB (bb)
- BITMAP_FREE (frontiers[bb->index]);
+ bitmap_clear (&frontiers[bb->index]);
free (frontiers);
}
@@ -4437,8 +4380,8 @@ df_md_reset (bitmap all_blocks)
{
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
gcc_assert (bb_info);
- bitmap_clear (bb_info->in);
- bitmap_clear (bb_info->out);
+ bitmap_clear (&bb_info->in);
+ bitmap_clear (&bb_info->out);
}
}
@@ -4447,21 +4390,21 @@ df_md_transfer_function (int bb_index)
{
basic_block bb = BASIC_BLOCK (bb_index);
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
- bitmap in = bb_info->in;
- bitmap out = bb_info->out;
- bitmap gen = bb_info->gen;
- bitmap kill = bb_info->kill;
+ bitmap in = &bb_info->in;
+ bitmap out = &bb_info->out;
+ bitmap gen = &bb_info->gen;
+ bitmap kill = &bb_info->kill;
/* We need to use a scratch set here so that the value returned from this
function invocation properly reflects whether the sets changed in a
significant way; i.e. not just because the live set was anded in. */
- bitmap_and (df_md_scratch, gen, df_get_live_out (bb));
+ bitmap_and (&df_md_scratch, gen, df_get_live_out (bb));
/* Multiple definitions of a register are not relevant if it is not
live. Thus we trim the result to the places where it is live. */
bitmap_and_into (in, df_get_live_in (bb));
- return bitmap_ior_and_compl (out, df_md_scratch, in, kill);
+ return bitmap_ior_and_compl (out, &df_md_scratch, in, kill);
}
/* Initialize the solution bit vectors for problem. */
@@ -4476,7 +4419,7 @@ df_md_init (bitmap all_blocks)
{
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
- bitmap_copy (bb_info->in, bb_info->init);
+ bitmap_copy (&bb_info->in, &bb_info->init);
df_md_transfer_function (bb_index);
}
}
@@ -4485,24 +4428,25 @@ static void
df_md_confluence_0 (basic_block bb)
{
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb->index);
- bitmap_copy (bb_info->in, bb_info->init);
+ bitmap_copy (&bb_info->in, &bb_info->init);
}
/* In of target gets or of out of source. */
-static void
+static bool
df_md_confluence_n (edge e)
{
- bitmap op1 = df_md_get_bb_info (e->dest->index)->in;
- bitmap op2 = df_md_get_bb_info (e->src->index)->out;
+ bitmap op1 = &df_md_get_bb_info (e->dest->index)->in;
+ bitmap op2 = &df_md_get_bb_info (e->src->index)->out;
if (e->flags & EDGE_FAKE)
- return;
+ return false;
if (e->flags & EDGE_EH)
- bitmap_ior_and_compl_into (op1, op2, regs_invalidated_by_call_regset);
+ return bitmap_ior_and_compl_into (op1, op2,
+ regs_invalidated_by_call_regset);
else
- bitmap_ior_into (op1, op2);
+ return bitmap_ior_into (op1, op2);
}
/* Free all storage associated with the problem. */
@@ -4510,25 +4454,16 @@ df_md_confluence_n (edge e)
static void
df_md_free (void)
{
- unsigned int i;
- for (i = 0; i < df_md->block_info_size; i++)
- {
- struct df_md_bb_info *bb_info = df_md_get_bb_info (i);
- if (bb_info)
- {
- BITMAP_FREE (bb_info->kill);
- BITMAP_FREE (bb_info->gen);
- BITMAP_FREE (bb_info->init);
- BITMAP_FREE (bb_info->in);
- BITMAP_FREE (bb_info->out);
- }
- }
+ struct df_md_problem_data *problem_data
+ = (struct df_md_problem_data *) df_md->problem_data;
- BITMAP_FREE (df_md_scratch);
- free_alloc_pool (df_md->block_pool);
+ bitmap_obstack_release (&problem_data->md_bitmaps);
+ free (problem_data);
+ df_md->problem_data = NULL;
df_md->block_info_size = 0;
free (df_md->block_info);
+ df_md->block_info = NULL;
free (df_md);
}
@@ -4539,17 +4474,17 @@ static void
df_md_top_dump (basic_block bb, FILE *file)
{
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb->index);
- if (!bb_info || !bb_info->in)
+ if (!bb_info)
return;
fprintf (file, ";; md in \t");
- df_print_regset (file, bb_info->in);
+ df_print_regset (file, &bb_info->in);
fprintf (file, ";; md init \t");
- df_print_regset (file, bb_info->init);
+ df_print_regset (file, &bb_info->init);
fprintf (file, ";; md gen \t");
- df_print_regset (file, bb_info->gen);
+ df_print_regset (file, &bb_info->gen);
fprintf (file, ";; md kill \t");
- df_print_regset (file, bb_info->kill);
+ df_print_regset (file, &bb_info->kill);
}
/* Debugging info at bottom of bb. */
@@ -4558,11 +4493,11 @@ static void
df_md_bottom_dump (basic_block bb, FILE *file)
{
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb->index);
- if (!bb_info || !bb_info->out)
+ if (!bb_info)
return;
fprintf (file, ";; md out \t");
- df_print_regset (file, bb_info->out);
+ df_print_regset (file, &bb_info->out);
}
static struct df_problem problem_MD =
@@ -4587,6 +4522,7 @@ static struct df_problem problem_MD =
NULL, /* Incremental solution verify start. */
NULL, /* Incremental solution verify end. */
NULL, /* Dependent problem. */
+ sizeof (struct df_md_bb_info),/* Size of entry of block_info array. */
TV_DF_MD, /* Timing variable. */
false /* Reset blocks on dropping out of blocks_to_analyze. */
};
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index bf285a19287..b4633abfb10 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -257,16 +257,15 @@ df_scan_free_internal (void)
df_scan->block_info = NULL;
df_scan->block_info_size = 0;
- BITMAP_FREE (df->hardware_regs_used);
- BITMAP_FREE (df->regular_block_artificial_uses);
- BITMAP_FREE (df->eh_block_artificial_uses);
+ bitmap_clear (&df->hardware_regs_used);
+ bitmap_clear (&df->regular_block_artificial_uses);
+ bitmap_clear (&df->eh_block_artificial_uses);
BITMAP_FREE (df->entry_block_defs);
BITMAP_FREE (df->exit_block_uses);
- BITMAP_FREE (df->insns_to_delete);
- BITMAP_FREE (df->insns_to_rescan);
- BITMAP_FREE (df->insns_to_notes_rescan);
+ bitmap_clear (&df->insns_to_delete);
+ bitmap_clear (&df->insns_to_rescan);
+ bitmap_clear (&df->insns_to_notes_rescan);
- free_alloc_pool (df_scan->block_pool);
free_alloc_pool (problem_data->ref_base_pool);
free_alloc_pool (problem_data->ref_artificial_pool);
free_alloc_pool (problem_data->ref_regular_pool);
@@ -280,17 +279,6 @@ df_scan_free_internal (void)
}
-/* Set basic block info. */
-
-static void
-df_scan_set_bb_info (unsigned int index,
- struct df_scan_bb_info *bb_info)
-{
- df_grow_bb_info (df_scan);
- df_scan->block_info[index] = (void *) bb_info;
-}
-
-
/* Free basic block info. */
static void
@@ -298,7 +286,9 @@ df_scan_free_bb_info (basic_block bb, void *vbb_info)
{
struct df_scan_bb_info *bb_info = (struct df_scan_bb_info *) vbb_info;
unsigned int bb_index = bb->index;
- if (bb_info)
+
+ /* See if bb_info is initialized. */
+ if (bb_info->artificial_defs)
{
rtx insn;
FOR_BB_INSNS (bb, insn)
@@ -312,13 +302,15 @@ df_scan_free_bb_info (basic_block bb, void *vbb_info)
bb_info = df_scan_get_bb_info (bb_index);
/* Get rid of any artificial uses or defs. */
- df_ref_chain_delete_du_chain (bb_info->artificial_defs);
- df_ref_chain_delete_du_chain (bb_info->artificial_uses);
- df_ref_chain_delete (bb_info->artificial_defs);
- df_ref_chain_delete (bb_info->artificial_uses);
- bb_info->artificial_defs = NULL;
- bb_info->artificial_uses = NULL;
- pool_free (df_scan->block_pool, bb_info);
+ if (bb_info->artificial_defs)
+ {
+ df_ref_chain_delete_du_chain (bb_info->artificial_defs);
+ df_ref_chain_delete_du_chain (bb_info->artificial_uses);
+ df_ref_chain_delete (bb_info->artificial_defs);
+ df_ref_chain_delete (bb_info->artificial_uses);
+ bb_info->artificial_defs = NULL;
+ bb_info->artificial_uses = NULL;
+ }
}
}
@@ -339,11 +331,6 @@ df_scan_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
if (df_scan->problem_data)
df_scan_free_internal ();
- df_scan->block_pool
- = create_alloc_pool ("df_scan_block pool",
- sizeof (struct df_scan_bb_info),
- block_size);
-
problem_data = XNEW (struct df_scan_problem_data);
df_scan->problem_data = problem_data;
df_scan->computed = true;
@@ -383,23 +370,18 @@ df_scan_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
{
unsigned int bb_index = bb->index;
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
- if (!bb_info)
- {
- bb_info = (struct df_scan_bb_info *) pool_alloc (df_scan->block_pool);
- df_scan_set_bb_info (bb_index, bb_info);
- }
bb_info->artificial_defs = NULL;
bb_info->artificial_uses = NULL;
}
- df->hardware_regs_used = BITMAP_ALLOC (&problem_data->reg_bitmaps);
- df->regular_block_artificial_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps);
- df->eh_block_artificial_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps);
+ bitmap_initialize (&df->hardware_regs_used, &problem_data->reg_bitmaps);
+ bitmap_initialize (&df->regular_block_artificial_uses, &problem_data->reg_bitmaps);
+ bitmap_initialize (&df->eh_block_artificial_uses, &problem_data->reg_bitmaps);
df->entry_block_defs = BITMAP_ALLOC (&problem_data->reg_bitmaps);
df->exit_block_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps);
- df->insns_to_delete = BITMAP_ALLOC (&problem_data->insn_bitmaps);
- df->insns_to_rescan = BITMAP_ALLOC (&problem_data->insn_bitmaps);
- df->insns_to_notes_rescan = BITMAP_ALLOC (&problem_data->insn_bitmaps);
+ bitmap_initialize (&df->insns_to_delete, &problem_data->insn_bitmaps);
+ bitmap_initialize (&df->insns_to_rescan, &problem_data->insn_bitmaps);
+ bitmap_initialize (&df->insns_to_notes_rescan, &problem_data->insn_bitmaps);
df_scan->optional_p = false;
}
@@ -437,11 +419,11 @@ df_scan_start_dump (FILE *file ATTRIBUTE_UNUSED)
fprintf (file, ";; invalidated by call \t");
df_print_regset (file, regs_invalidated_by_call_regset);
fprintf (file, ";; hardware regs used \t");
- df_print_regset (file, df->hardware_regs_used);
+ df_print_regset (file, &df->hardware_regs_used);
fprintf (file, ";; regular block artificial uses \t");
- df_print_regset (file, df->regular_block_artificial_uses);
+ df_print_regset (file, &df->regular_block_artificial_uses);
fprintf (file, ";; eh block artificial uses \t");
- df_print_regset (file, df->eh_block_artificial_uses);
+ df_print_regset (file, &df->eh_block_artificial_uses);
fprintf (file, ";; entry block defs \t");
df_print_regset (file, df->entry_block_defs);
fprintf (file, ";; exit block uses \t");
@@ -539,6 +521,7 @@ static struct df_problem problem_SCAN =
NULL, /* Incremental solution verify start. */
NULL, /* Incremental solution verify end. */
NULL, /* Dependent problem. */
+ sizeof (struct df_scan_bb_info),/* Size of entry of block_info array. */
TV_DF_SCAN, /* Timing variable. */
false /* Reset blocks on dropping out of blocks_to_analyze. */
};
@@ -682,11 +665,11 @@ df_scan_blocks (void)
df->def_info.ref_order = DF_REF_ORDER_NO_TABLE;
df->use_info.ref_order = DF_REF_ORDER_NO_TABLE;
- df_get_regular_block_artificial_uses (df->regular_block_artificial_uses);
- df_get_eh_block_artificial_uses (df->eh_block_artificial_uses);
+ df_get_regular_block_artificial_uses (&df->regular_block_artificial_uses);
+ df_get_eh_block_artificial_uses (&df->eh_block_artificial_uses);
- bitmap_ior_into (df->eh_block_artificial_uses,
- df->regular_block_artificial_uses);
+ bitmap_ior_into (&df->eh_block_artificial_uses,
+ &df->regular_block_artificial_uses);
/* ENTRY and EXIT blocks have special defs/uses. */
df_get_entry_block_def_set (df->entry_block_defs);
@@ -1140,9 +1123,9 @@ df_insn_delete (basic_block bb, unsigned int uid)
{
if (insn_info)
{
- bitmap_clear_bit (df->insns_to_rescan, uid);
- bitmap_clear_bit (df->insns_to_notes_rescan, uid);
- bitmap_set_bit (df->insns_to_delete, uid);
+ bitmap_clear_bit (&df->insns_to_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_notes_rescan, uid);
+ bitmap_set_bit (&df->insns_to_delete, uid);
}
if (dump_file)
fprintf (dump_file, "deferring deletion of insn with uid = %d.\n", uid);
@@ -1152,9 +1135,9 @@ df_insn_delete (basic_block bb, unsigned int uid)
if (dump_file)
fprintf (dump_file, "deleting insn with uid = %d.\n", uid);
- bitmap_clear_bit (df->insns_to_delete, uid);
- bitmap_clear_bit (df->insns_to_rescan, uid);
- bitmap_clear_bit (df->insns_to_notes_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_delete, uid);
+ bitmap_clear_bit (&df->insns_to_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_notes_rescan, uid);
if (insn_info)
{
struct df_scan_problem_data *problem_data
@@ -1257,9 +1240,9 @@ df_insn_rescan (rtx insn)
if (dump_file)
fprintf (dump_file, "deferring rescan insn with uid = %d.\n", uid);
- bitmap_clear_bit (df->insns_to_delete, uid);
- bitmap_clear_bit (df->insns_to_notes_rescan, uid);
- bitmap_set_bit (df->insns_to_rescan, INSN_UID (insn));
+ bitmap_clear_bit (&df->insns_to_delete, uid);
+ bitmap_clear_bit (&df->insns_to_notes_rescan, uid);
+ bitmap_set_bit (&df->insns_to_rescan, INSN_UID (insn));
return false;
}
@@ -1268,9 +1251,9 @@ df_insn_rescan (rtx insn)
collection_rec.eq_use_vec = VEC_alloc (df_ref, stack, 32);
collection_rec.mw_vec = VEC_alloc (df_mw_hardreg_ptr, stack, 32);
- bitmap_clear_bit (df->insns_to_delete, uid);
- bitmap_clear_bit (df->insns_to_rescan, uid);
- bitmap_clear_bit (df->insns_to_notes_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_delete, uid);
+ bitmap_clear_bit (&df->insns_to_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_notes_rescan, uid);
if (insn_info)
{
int luid;
@@ -1337,9 +1320,9 @@ df_insn_rescan_debug_internal (rtx insn)
if (dump_file)
fprintf (dump_file, "deleting debug_insn with uid = %d.\n", uid);
- bitmap_clear_bit (df->insns_to_delete, uid);
- bitmap_clear_bit (df->insns_to_rescan, uid);
- bitmap_clear_bit (df->insns_to_notes_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_delete, uid);
+ bitmap_clear_bit (&df->insns_to_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_notes_rescan, uid);
if (!insn_info->defs)
return false;
@@ -1384,7 +1367,9 @@ df_insn_rescan_all (void)
basic_block bb;
bitmap_iterator bi;
unsigned int uid;
- bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head tmp;
+
+ bitmap_initialize (&tmp, &df_bitmap_obstack);
if (df->changeable_flags & DF_NO_INSN_RESCAN)
{
@@ -1398,18 +1383,18 @@ df_insn_rescan_all (void)
defer_insn_rescan = true;
}
- bitmap_copy (tmp, df->insns_to_delete);
- EXECUTE_IF_SET_IN_BITMAP (tmp, 0, uid, bi)
+ bitmap_copy (&tmp, &df->insns_to_delete);
+ EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi)
{
struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid);
if (insn_info)
df_insn_delete (NULL, uid);
}
- BITMAP_FREE (tmp);
- bitmap_clear (df->insns_to_delete);
- bitmap_clear (df->insns_to_rescan);
- bitmap_clear (df->insns_to_notes_rescan);
+ bitmap_clear (&tmp);
+ bitmap_clear (&df->insns_to_delete);
+ bitmap_clear (&df->insns_to_rescan);
+ bitmap_clear (&df->insns_to_notes_rescan);
FOR_EACH_BB (bb)
{
@@ -1436,7 +1421,9 @@ df_process_deferred_rescans (void)
bool defer_insn_rescan = false;
bitmap_iterator bi;
unsigned int uid;
- bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head tmp;
+
+ bitmap_initialize (&tmp, &df_bitmap_obstack);
if (df->changeable_flags & DF_NO_INSN_RESCAN)
{
@@ -1453,24 +1440,24 @@ df_process_deferred_rescans (void)
if (dump_file)
fprintf (dump_file, "starting the processing of deferred insns\n");
- bitmap_copy (tmp, df->insns_to_delete);
- EXECUTE_IF_SET_IN_BITMAP (tmp, 0, uid, bi)
+ bitmap_copy (&tmp, &df->insns_to_delete);
+ EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi)
{
struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid);
if (insn_info)
df_insn_delete (NULL, uid);
}
- bitmap_copy (tmp, df->insns_to_rescan);
- EXECUTE_IF_SET_IN_BITMAP (tmp, 0, uid, bi)
+ bitmap_copy (&tmp, &df->insns_to_rescan);
+ EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi)
{
struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid);
if (insn_info)
df_insn_rescan (insn_info->insn);
}
- bitmap_copy (tmp, df->insns_to_notes_rescan);
- EXECUTE_IF_SET_IN_BITMAP (tmp, 0, uid, bi)
+ bitmap_copy (&tmp, &df->insns_to_notes_rescan);
+ EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi)
{
struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid);
if (insn_info)
@@ -1480,10 +1467,10 @@ df_process_deferred_rescans (void)
if (dump_file)
fprintf (dump_file, "ending the processing of deferred insns\n");
- BITMAP_FREE (tmp);
- bitmap_clear (df->insns_to_delete);
- bitmap_clear (df->insns_to_rescan);
- bitmap_clear (df->insns_to_notes_rescan);
+ bitmap_clear (&tmp);
+ bitmap_clear (&df->insns_to_delete);
+ bitmap_clear (&df->insns_to_rescan);
+ bitmap_clear (&df->insns_to_notes_rescan);
if (no_insn_rescan)
df_set_flags (DF_NO_INSN_RESCAN);
@@ -1567,7 +1554,7 @@ df_reorganize_refs_by_reg_by_reg (struct df_ref_info *ref_info,
DF_REF_ID (ref) = offset++;
count++;
ref = DF_REF_NEXT_REG (ref);
- gcc_assert (offset < ref_info->refs_size);
+ gcc_checking_assert (offset < ref_info->refs_size);
}
}
if (include_uses)
@@ -1579,7 +1566,7 @@ df_reorganize_refs_by_reg_by_reg (struct df_ref_info *ref_info,
DF_REF_ID (ref) = offset++;
count++;
ref = DF_REF_NEXT_REG (ref);
- gcc_assert (offset < ref_info->refs_size);
+ gcc_checking_assert (offset < ref_info->refs_size);
}
}
if (include_eq_uses)
@@ -1591,7 +1578,7 @@ df_reorganize_refs_by_reg_by_reg (struct df_ref_info *ref_info,
DF_REF_ID (ref) = offset++;
count++;
ref = DF_REF_NEXT_REG (ref);
- gcc_assert (offset < ref_info->refs_size);
+ gcc_checking_assert (offset < ref_info->refs_size);
}
}
ref_info->count[regno] = count;
@@ -2194,16 +2181,16 @@ df_notes_rescan (rtx insn)
insn_info->mw_hardregs = df_null_mw_rec;
}
- bitmap_clear_bit (df->insns_to_delete, uid);
+ bitmap_clear_bit (&df->insns_to_delete, uid);
/* If the insn is set to be rescanned, it does not need to also
be notes rescanned. */
- if (!bitmap_bit_p (df->insns_to_rescan, uid))
- bitmap_set_bit (df->insns_to_notes_rescan, INSN_UID (insn));
+ if (!bitmap_bit_p (&df->insns_to_rescan, uid))
+ bitmap_set_bit (&df->insns_to_notes_rescan, INSN_UID (insn));
return;
}
- bitmap_clear_bit (df->insns_to_delete, uid);
- bitmap_clear_bit (df->insns_to_notes_rescan, uid);
+ bitmap_clear_bit (&df->insns_to_delete, uid);
+ bitmap_clear_bit (&df->insns_to_notes_rescan, uid);
if (insn_info)
{
@@ -2606,8 +2593,8 @@ df_install_ref (df_ref this_ref,
df->hard_regs_live_count[regno]++;
}
- gcc_assert (DF_REF_NEXT_REG (this_ref) == NULL
- && DF_REF_PREV_REG (this_ref) == NULL);
+ gcc_checking_assert (DF_REF_NEXT_REG (this_ref) == NULL
+ && DF_REF_PREV_REG (this_ref) == NULL);
DF_REF_NEXT_REG (this_ref) = head;
@@ -2802,19 +2789,19 @@ df_ref_create_structure (enum df_ref_class cl,
{
case DF_REF_BASE:
this_ref = (df_ref) pool_alloc (problem_data->ref_base_pool);
- gcc_assert (loc == NULL);
+ gcc_checking_assert (loc == NULL);
break;
case DF_REF_ARTIFICIAL:
this_ref = (df_ref) pool_alloc (problem_data->ref_artificial_pool);
this_ref->artificial_ref.bb = bb;
- gcc_assert (loc == NULL);
+ gcc_checking_assert (loc == NULL);
break;
case DF_REF_REGULAR:
this_ref = (df_ref) pool_alloc (problem_data->ref_regular_pool);
this_ref->regular_ref.loc = loc;
- gcc_assert (loc);
+ gcc_checking_assert (loc);
break;
case DF_REF_EXTRACT:
@@ -2823,7 +2810,7 @@ df_ref_create_structure (enum df_ref_class cl,
DF_REF_EXTRACT_OFFSET (this_ref) = offset;
DF_REF_EXTRACT_MODE (this_ref) = mode;
this_ref->regular_ref.loc = loc;
- gcc_assert (loc);
+ gcc_checking_assert (loc);
break;
}
@@ -2893,7 +2880,7 @@ df_ref_record (enum df_ref_class cl,
{
unsigned int regno;
- gcc_assert (REG_P (reg) || GET_CODE (reg) == SUBREG);
+ gcc_checking_assert (REG_P (reg) || GET_CODE (reg) == SUBREG);
regno = REGNO (GET_CODE (reg) == SUBREG ? SUBREG_REG (reg) : reg);
if (regno < FIRST_PSEUDO_REGISTER)
@@ -3452,13 +3439,15 @@ df_get_call_refs (struct df_collection_rec * collection_rec,
bool is_sibling_call;
unsigned int i;
df_ref def;
- bitmap defs_generated = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head defs_generated;
+
+ bitmap_initialize (&defs_generated, &df_bitmap_obstack);
/* Do not generate clobbers for registers that are the result of the
call. This causes ordering problems in the chain building code
depending on which def is seen first. */
for (i = 0; VEC_iterate (df_ref, collection_rec->def_vec, i, def); ++i)
- bitmap_set_bit (defs_generated, DF_REF_REGNO (def));
+ bitmap_set_bit (&defs_generated, DF_REF_REGNO (def));
/* Record the registers used to pass arguments, and explicitly
noted as clobbered. */
@@ -3474,7 +3463,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec,
if (REG_P (XEXP (XEXP (note, 0), 0)))
{
unsigned int regno = REGNO (XEXP (XEXP (note, 0), 0));
- if (!bitmap_bit_p (defs_generated, regno))
+ if (!bitmap_bit_p (&defs_generated, regno))
df_defs_record (collection_rec, XEXP (note, 0), bb,
insn_info, flags);
}
@@ -3508,7 +3497,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec,
EXECUTE_IF_SET_IN_BITMAP (regs_invalidated_by_call_regset, 0, ui, bi)
{
if (!global_regs[ui]
- && (!bitmap_bit_p (defs_generated, ui))
+ && (!bitmap_bit_p (&defs_generated, ui))
&& (!is_sibling_call
|| !bitmap_bit_p (df->exit_block_uses, ui)
|| refers_to_regno_p (ui, ui+1,
@@ -3519,7 +3508,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec,
-1, -1, VOIDmode);
}
- BITMAP_FREE (defs_generated);
+ bitmap_clear (&defs_generated);
return;
}
@@ -3670,8 +3659,8 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb)
bitmap_iterator bi;
unsigned int regno;
bitmap au = bb_has_eh_pred (bb)
- ? df->eh_block_artificial_uses
- : df->regular_block_artificial_uses;
+ ? &df->eh_block_artificial_uses
+ : &df->regular_block_artificial_uses;
EXECUTE_IF_SET_IN_BITMAP (au, 0, regno, bi)
{
@@ -3692,23 +3681,12 @@ df_bb_refs_record (int bb_index, bool scan_insns)
basic_block bb = BASIC_BLOCK (bb_index);
rtx insn;
int luid = 0;
- struct df_scan_bb_info *bb_info;
struct df_collection_rec collection_rec;
if (!df)
return;
- bb_info = df_scan_get_bb_info (bb_index);
-
- /* Need to make sure that there is a record in the basic block info. */
- if (!bb_info)
- {
- bb_info = (struct df_scan_bb_info *) pool_alloc (df_scan->block_pool);
- df_scan_set_bb_info (bb_index, bb_info);
- bb_info->artificial_defs = NULL;
- bb_info->artificial_uses = NULL;
- }
-
+ df_grow_bb_info (df_scan);
collection_rec.def_vec = VEC_alloc (df_ref, stack, 128);
collection_rec.use_vec = VEC_alloc (df_ref, stack, 32);
collection_rec.eq_use_vec = VEC_alloc (df_ref, stack, 32);
@@ -3944,7 +3922,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
bitmap_set_bit (entry_block_defs, REGNO (INCOMING_RETURN_ADDR_RTX));
#endif
- targetm.live_on_entry (entry_block_defs);
+ targetm.extra_live_on_entry (entry_block_defs);
}
@@ -3993,13 +3971,14 @@ df_record_entry_block_defs (bitmap entry_block_defs)
void
df_update_entry_block_defs (void)
{
- bitmap refs = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head refs;
bool changed = false;
- df_get_entry_block_def_set (refs);
+ bitmap_initialize (&refs, &df_bitmap_obstack);
+ df_get_entry_block_def_set (&refs);
if (df->entry_block_defs)
{
- if (!bitmap_equal_p (df->entry_block_defs, refs))
+ if (!bitmap_equal_p (df->entry_block_defs, &refs))
{
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (ENTRY_BLOCK);
df_ref_chain_delete_du_chain (bb_info->artificial_defs);
@@ -4012,17 +3991,18 @@ df_update_entry_block_defs (void)
{
struct df_scan_problem_data *problem_data
= (struct df_scan_problem_data *) df_scan->problem_data;
+ gcc_unreachable ();
df->entry_block_defs = BITMAP_ALLOC (&problem_data->reg_bitmaps);
changed = true;
}
if (changed)
{
- df_record_entry_block_defs (refs);
- bitmap_copy (df->entry_block_defs, refs);
+ df_record_entry_block_defs (&refs);
+ bitmap_copy (df->entry_block_defs, &refs);
df_set_bb_dirty (BASIC_BLOCK (ENTRY_BLOCK));
}
- BITMAP_FREE (refs);
+ bitmap_clear (&refs);
}
@@ -4165,13 +4145,14 @@ df_record_exit_block_uses (bitmap exit_block_uses)
void
df_update_exit_block_uses (void)
{
- bitmap refs = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head refs;
bool changed = false;
- df_get_exit_block_use_set (refs);
+ bitmap_initialize (&refs, &df_bitmap_obstack);
+ df_get_exit_block_use_set (&refs);
if (df->exit_block_uses)
{
- if (!bitmap_equal_p (df->exit_block_uses, refs))
+ if (!bitmap_equal_p (df->exit_block_uses, &refs))
{
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (EXIT_BLOCK);
df_ref_chain_delete_du_chain (bb_info->artificial_uses);
@@ -4184,17 +4165,18 @@ df_update_exit_block_uses (void)
{
struct df_scan_problem_data *problem_data
= (struct df_scan_problem_data *) df_scan->problem_data;
+ gcc_unreachable ();
df->exit_block_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps);
changed = true;
}
if (changed)
{
- df_record_exit_block_uses (refs);
- bitmap_copy (df->exit_block_uses, refs);
+ df_record_exit_block_uses (&refs);
+ bitmap_copy (df->exit_block_uses,& refs);
df_set_bb_dirty (BASIC_BLOCK (EXIT_BLOCK));
}
- BITMAP_FREE (refs);
+ bitmap_clear (&refs);
}
static bool initialized = false;
@@ -4550,24 +4532,25 @@ df_bb_verify (basic_block bb)
static bool
df_entry_block_bitmap_verify (bool abort_if_fail)
{
- bitmap entry_block_defs = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head entry_block_defs;
bool is_eq;
- df_get_entry_block_def_set (entry_block_defs);
+ bitmap_initialize (&entry_block_defs, &df_bitmap_obstack);
+ df_get_entry_block_def_set (&entry_block_defs);
- is_eq = bitmap_equal_p (entry_block_defs, df->entry_block_defs);
+ is_eq = bitmap_equal_p (&entry_block_defs, df->entry_block_defs);
if (!is_eq && abort_if_fail)
{
print_current_pass (stderr);
fprintf (stderr, "entry_block_defs = ");
- df_print_regset (stderr, entry_block_defs);
+ df_print_regset (stderr, &entry_block_defs);
fprintf (stderr, "df->entry_block_defs = ");
df_print_regset (stderr, df->entry_block_defs);
gcc_assert (0);
}
- BITMAP_FREE (entry_block_defs);
+ bitmap_clear (&entry_block_defs);
return is_eq;
}
@@ -4579,24 +4562,25 @@ df_entry_block_bitmap_verify (bool abort_if_fail)
static bool
df_exit_block_bitmap_verify (bool abort_if_fail)
{
- bitmap exit_block_uses = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_head exit_block_uses;
bool is_eq;
- df_get_exit_block_use_set (exit_block_uses);
+ bitmap_initialize (&exit_block_uses, &df_bitmap_obstack);
+ df_get_exit_block_use_set (&exit_block_uses);
- is_eq = bitmap_equal_p (exit_block_uses, df->exit_block_uses);
+ is_eq = bitmap_equal_p (&exit_block_uses, df->exit_block_uses);
if (!is_eq && abort_if_fail)
{
print_current_pass (stderr);
fprintf (stderr, "exit_block_uses = ");
- df_print_regset (stderr, exit_block_uses);
+ df_print_regset (stderr, &exit_block_uses);
fprintf (stderr, "df->exit_block_uses = ");
df_print_regset (stderr, df->exit_block_uses);
gcc_assert (0);
}
- BITMAP_FREE (exit_block_uses);
+ bitmap_clear (&exit_block_uses);
return is_eq;
}
@@ -4610,8 +4594,8 @@ df_scan_verify (void)
{
unsigned int i;
basic_block bb;
- bitmap regular_block_artificial_uses;
- bitmap eh_block_artificial_uses;
+ bitmap_head regular_block_artificial_uses;
+ bitmap_head eh_block_artificial_uses;
if (!df)
return;
@@ -4632,23 +4616,23 @@ df_scan_verify (void)
/* (2) There are various bitmaps whose value may change over the
course of the compilation. This step recomputes them to make
sure that they have not slipped out of date. */
- regular_block_artificial_uses = BITMAP_ALLOC (&df_bitmap_obstack);
- eh_block_artificial_uses = BITMAP_ALLOC (&df_bitmap_obstack);
+ bitmap_initialize (&regular_block_artificial_uses, &df_bitmap_obstack);
+ bitmap_initialize (&eh_block_artificial_uses, &df_bitmap_obstack);
- df_get_regular_block_artificial_uses (regular_block_artificial_uses);
- df_get_eh_block_artificial_uses (eh_block_artificial_uses);
+ df_get_regular_block_artificial_uses (&regular_block_artificial_uses);
+ df_get_eh_block_artificial_uses (&eh_block_artificial_uses);
- bitmap_ior_into (eh_block_artificial_uses,
- regular_block_artificial_uses);
+ bitmap_ior_into (&eh_block_artificial_uses,
+ &regular_block_artificial_uses);
/* Check artificial_uses bitmaps didn't change. */
- gcc_assert (bitmap_equal_p (regular_block_artificial_uses,
- df->regular_block_artificial_uses));
- gcc_assert (bitmap_equal_p (eh_block_artificial_uses,
- df->eh_block_artificial_uses));
+ gcc_assert (bitmap_equal_p (&regular_block_artificial_uses,
+ &df->regular_block_artificial_uses));
+ gcc_assert (bitmap_equal_p (&eh_block_artificial_uses,
+ &df->eh_block_artificial_uses));
- BITMAP_FREE (regular_block_artificial_uses);
- BITMAP_FREE (eh_block_artificial_uses);
+ bitmap_clear (&regular_block_artificial_uses);
+ bitmap_clear (&eh_block_artificial_uses);
/* Verify entry block and exit block. These only verify the bitmaps,
the refs are verified in df_bb_verify. */
diff --git a/gcc/df.h b/gcc/df.h
index afbe88a4225..01a4d1046e9 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -34,7 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
struct dataflow;
-struct df;
+struct df_d;
struct df_problem;
struct df_link;
struct df_insn_info;
@@ -222,10 +222,12 @@ typedef void (*df_dataflow_function) (struct dataflow *, bitmap, int *, int);
/* Confluence operator for blocks with 0 out (or in) edges. */
typedef void (*df_confluence_function_0) (basic_block);
-/* Confluence operator for blocks with 1 or more out (or in) edges. */
-typedef void (*df_confluence_function_n) (edge);
+/* Confluence operator for blocks with 1 or more out (or in) edges.
+ Return true if BB input data has changed. */
+typedef bool (*df_confluence_function_n) (edge);
-/* Transfer function for blocks. */
+/* Transfer function for blocks.
+ Return true if BB output data has changed. */
typedef bool (*df_transfer_function) (int);
/* Function to massage the information after the problem solving. */
@@ -277,6 +279,7 @@ struct df_problem {
df_verify_solution_start verify_start_fun;
df_verify_solution_end verify_end_fun;
struct df_problem *dependent_problem;
+ unsigned int block_info_elt_size;
/* The timevar id associated with this pass. */
timevar_id_t tv_id;
@@ -294,7 +297,7 @@ struct dataflow
/* Array indexed by bb->index, that contains basic block problem and
solution specific information. */
- void **block_info;
+ void *block_info;
unsigned int block_info_size;
/* The pool to allocate the block_info from. */
@@ -524,7 +527,7 @@ struct df_reg_info
used by owners of the problem.
----------------------------------------------------------------------------*/
-struct df
+struct df_d
{
/* The set of problems to be solved is stored in two arrays. In
@@ -564,22 +567,22 @@ struct df
int num_problems_defined;
- bitmap hardware_regs_used; /* The set of hardware registers used. */
+ bitmap_head hardware_regs_used; /* The set of hardware registers used. */
/* The set of hard regs that are in the artificial uses at the end
of a regular basic block. */
- bitmap regular_block_artificial_uses;
+ bitmap_head regular_block_artificial_uses;
/* The set of hard regs that are in the artificial uses at the end
of a basic block that has an EH pred. */
- bitmap eh_block_artificial_uses;
+ bitmap_head eh_block_artificial_uses;
/* The set of hardware registers live on entry to the function. */
bitmap entry_block_defs;
bitmap exit_block_uses; /* The set of hardware registers used in exit block. */
/* Insns to delete, rescan or reprocess the notes at next
df_rescan_all or df_process_deferred_rescans. */
- bitmap insns_to_delete;
- bitmap insns_to_rescan;
- bitmap insns_to_notes_rescan;
+ bitmap_head insns_to_delete;
+ bitmap_head insns_to_rescan;
+ bitmap_head insns_to_notes_rescan;
int *postorder; /* The current set of basic blocks
in reverse postorder. */
int *postorder_inverted; /* The current set of basic blocks
@@ -626,20 +629,20 @@ struct df
/* Most transformations that wish to use live register analysis will
use these macros. This info is the and of the lr and live sets. */
-#define DF_LIVE_IN(BB) (DF_LIVE_BB_INFO(BB)->in)
-#define DF_LIVE_OUT(BB) (DF_LIVE_BB_INFO(BB)->out)
+#define DF_LIVE_IN(BB) (&DF_LIVE_BB_INFO(BB)->in)
+#define DF_LIVE_OUT(BB) (&DF_LIVE_BB_INFO(BB)->out)
/* These macros are used by passes that are not tolerant of
uninitialized variables. This intolerance should eventually
be fixed. */
-#define DF_LR_IN(BB) (DF_LR_BB_INFO(BB)->in)
-#define DF_LR_OUT(BB) (DF_LR_BB_INFO(BB)->out)
+#define DF_LR_IN(BB) (&DF_LR_BB_INFO(BB)->in)
+#define DF_LR_OUT(BB) (&DF_LR_BB_INFO(BB)->out)
/* These macros are used by passes that are not tolerant of
uninitialized variables. This intolerance should eventually
be fixed. */
-#define DF_BYTE_LR_IN(BB) (DF_BYTE_LR_BB_INFO(BB)->in)
-#define DF_BYTE_LR_OUT(BB) (DF_BYTE_LR_BB_INFO(BB)->out)
+#define DF_BYTE_LR_IN(BB) (&DF_BYTE_LR_BB_INFO(BB)->in)
+#define DF_BYTE_LR_OUT(BB) (&DF_BYTE_LR_BB_INFO(BB)->out)
/* Macros to access the elements within the ref structure. */
@@ -796,13 +799,13 @@ struct df_scan_bb_info
struct df_rd_bb_info
{
/* Local sets to describe the basic blocks. */
- bitmap kill;
- bitmap sparse_kill;
- bitmap gen; /* The set of defs generated in this block. */
+ bitmap_head kill;
+ bitmap_head sparse_kill;
+ bitmap_head gen; /* The set of defs generated in this block. */
/* The results of the dataflow problem. */
- bitmap in; /* At the top of the block. */
- bitmap out; /* At the bottom of the block. */
+ bitmap_head in; /* At the top of the block. */
+ bitmap_head out; /* At the bottom of the block. */
};
@@ -812,13 +815,13 @@ struct df_rd_bb_info
struct df_md_bb_info
{
/* Local sets to describe the basic blocks. */
- bitmap gen; /* Partial/conditional definitions live at BB out. */
- bitmap kill; /* Other definitions that are live at BB out. */
- bitmap init; /* Definitions coming from dominance frontier edges. */
+ bitmap_head gen; /* Partial/conditional definitions live at BB out. */
+ bitmap_head kill; /* Other definitions that are live at BB out. */
+ bitmap_head init; /* Definitions coming from dominance frontier edges. */
/* The results of the dataflow problem. */
- bitmap in; /* Just before the block itself. */
- bitmap out; /* At the bottom of the block. */
+ bitmap_head in; /* Just before the block itself. */
+ bitmap_head out; /* At the bottom of the block. */
};
@@ -828,13 +831,13 @@ struct df_md_bb_info
struct df_lr_bb_info
{
/* Local sets to describe the basic blocks. */
- bitmap def; /* The set of registers set in this block
- - except artificial defs at the top. */
- bitmap use; /* The set of registers used in this block. */
+ bitmap_head def; /* The set of registers set in this block
+ - except artificial defs at the top. */
+ bitmap_head use; /* The set of registers used in this block. */
/* The results of the dataflow problem. */
- bitmap in; /* Just before the block itself. */
- bitmap out; /* At the bottom of the block. */
+ bitmap_head in; /* Just before the block itself. */
+ bitmap_head out; /* At the bottom of the block. */
};
@@ -845,13 +848,13 @@ struct df_lr_bb_info
struct df_live_bb_info
{
/* Local sets to describe the basic blocks. */
- bitmap kill; /* The set of registers unset in this block. Calls,
- for instance, unset registers. */
- bitmap gen; /* The set of registers set in this block. */
+ bitmap_head kill; /* The set of registers unset in this block. Calls,
+ for instance, unset registers. */
+ bitmap_head gen; /* The set of registers set in this block. */
/* The results of the dataflow problem. */
- bitmap in; /* At the top of the block. */
- bitmap out; /* At the bottom of the block. */
+ bitmap_head in; /* At the top of the block. */
+ bitmap_head out; /* At the bottom of the block. */
};
@@ -861,20 +864,20 @@ indexed by the df_byte_lr_offset array which is indexed by pseudo. */
struct df_byte_lr_bb_info
{
/* Local sets to describe the basic blocks. */
- bitmap def; /* The set of registers set in this block
- - except artificial defs at the top. */
- bitmap use; /* The set of registers used in this block. */
+ bitmap_head def; /* The set of registers set in this block
+ - except artificial defs at the top. */
+ bitmap_head use; /* The set of registers used in this block. */
/* The results of the dataflow problem. */
- bitmap in; /* Just before the block itself. */
- bitmap out; /* At the bottom of the block. */
+ bitmap_head in; /* Just before the block itself. */
+ bitmap_head out; /* At the bottom of the block. */
};
/* This is used for debugging and for the dumpers to find the latest
instance so that the df info can be added to the dumps. This
should not be used by regular code. */
-extern struct df *df;
+extern struct df_d *df;
#define df_scan (df->problems_by_index[DF_SCAN])
#define df_rd (df->problems_by_index[DF_RD])
#define df_lr (df->problems_by_index[DF_LR])
@@ -1037,7 +1040,7 @@ static inline struct df_scan_bb_info *
df_scan_get_bb_info (unsigned int index)
{
if (index < df_scan->block_info_size)
- return (struct df_scan_bb_info *) df_scan->block_info[index];
+ return &((struct df_scan_bb_info *) df_scan->block_info)[index];
else
return NULL;
}
@@ -1046,7 +1049,7 @@ static inline struct df_rd_bb_info *
df_rd_get_bb_info (unsigned int index)
{
if (index < df_rd->block_info_size)
- return (struct df_rd_bb_info *) df_rd->block_info[index];
+ return &((struct df_rd_bb_info *) df_rd->block_info)[index];
else
return NULL;
}
@@ -1055,7 +1058,7 @@ static inline struct df_lr_bb_info *
df_lr_get_bb_info (unsigned int index)
{
if (index < df_lr->block_info_size)
- return (struct df_lr_bb_info *) df_lr->block_info[index];
+ return &((struct df_lr_bb_info *) df_lr->block_info)[index];
else
return NULL;
}
@@ -1064,7 +1067,7 @@ static inline struct df_md_bb_info *
df_md_get_bb_info (unsigned int index)
{
if (index < df_md->block_info_size)
- return (struct df_md_bb_info *) df_md->block_info[index];
+ return &((struct df_md_bb_info *) df_md->block_info)[index];
else
return NULL;
}
@@ -1073,7 +1076,7 @@ static inline struct df_live_bb_info *
df_live_get_bb_info (unsigned int index)
{
if (index < df_live->block_info_size)
- return (struct df_live_bb_info *) df_live->block_info[index];
+ return &((struct df_live_bb_info *) df_live->block_info)[index];
else
return NULL;
}
@@ -1082,7 +1085,7 @@ static inline struct df_byte_lr_bb_info *
df_byte_lr_get_bb_info (unsigned int index)
{
if (index < df_byte_lr->block_info_size)
- return (struct df_byte_lr_bb_info *) df_byte_lr->block_info[index];
+ return &((struct df_byte_lr_bb_info *) df_byte_lr->block_info)[index];
else
return NULL;
}
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index b5047164002..674bad608aa 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -32,7 +32,10 @@ typedef enum
#define DEFINE_DIAGNOSTIC_KIND(K, msgid) K,
#include "diagnostic.def"
#undef DEFINE_DIAGNOSTIC_KIND
- DK_LAST_DIAGNOSTIC_KIND
+ DK_LAST_DIAGNOSTIC_KIND,
+ /* This is used for tagging pragma pops in the diagnostic
+ classification history chain. */
+ DK_POP
} diagnostic_t;
extern const char *progname;
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 61401e62a80..34e9679693f 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -306,7 +306,8 @@ default_diagnostic_finalizer (diagnostic_context *context,
diagnostic_t
diagnostic_classify_diagnostic (diagnostic_context *context,
int option_index,
- diagnostic_t new_kind)
+ diagnostic_t new_kind,
+ location_t where)
{
diagnostic_t old_kind;
@@ -316,10 +317,66 @@ diagnostic_classify_diagnostic (diagnostic_context *context,
return DK_UNSPECIFIED;
old_kind = context->classify_diagnostic[option_index];
- context->classify_diagnostic[option_index] = new_kind;
+
+ /* Handle pragmas separately, since we need to keep track of *where*
+ the pragmas were. */
+ if (where != UNKNOWN_LOCATION)
+ {
+ int i;
+
+ for (i = context->n_classification_history - 1; i >= 0; i --)
+ if (context->classification_history[i].option == option_index)
+ {
+ old_kind = context->classification_history[i].kind;
+ break;
+ }
+
+ i = context->n_classification_history;
+ context->classification_history =
+ (diagnostic_classification_change_t *) xrealloc (context->classification_history, (i + 1)
+ * sizeof (diagnostic_classification_change_t));
+ context->classification_history[i].location = where;
+ context->classification_history[i].option = option_index;
+ context->classification_history[i].kind = new_kind;
+ context->n_classification_history ++;
+ }
+ else
+ context->classify_diagnostic[option_index] = new_kind;
+
return old_kind;
}
+/* Save all diagnostic classifications in a stack. */
+void
+diagnostic_push_diagnostics (diagnostic_context *context, location_t where ATTRIBUTE_UNUSED)
+{
+ context->push_list = (int *) xrealloc (context->push_list, (context->n_push + 1) * sizeof (int));
+ context->push_list[context->n_push ++] = context->n_classification_history;
+}
+
+/* Restore the topmost classification set off the stack. If the stack
+ is empty, revert to the state based on command line parameters. */
+void
+diagnostic_pop_diagnostics (diagnostic_context *context, location_t where)
+{
+ int jump_to;
+ int i;
+
+ if (context->n_push)
+ jump_to = context->push_list [-- context->n_push];
+ else
+ jump_to = 0;
+
+ i = context->n_classification_history;
+ context->classification_history =
+ (diagnostic_classification_change_t *) xrealloc (context->classification_history, (i + 1)
+ * sizeof (diagnostic_classification_change_t));
+ context->classification_history[i].location = where;
+ context->classification_history[i].option = jump_to;
+ context->classification_history[i].kind = DK_POP;
+ context->n_classification_history ++;
+}
+
/* Report a diagnostic message (an error or a warning) as specified by
DC. This function is *the* subroutine in terms of which front-ends
should implement their specific diagnostic handling modules. The
@@ -374,13 +431,41 @@ diagnostic_report_diagnostic (diagnostic_context *context,
if (diagnostic->option_index)
{
+ diagnostic_t diag_class = DK_UNSPECIFIED;
+
/* This tests if the user provided the appropriate -Wfoo or
-Wno-foo option. */
if (! context->option_enabled (diagnostic->option_index))
return false;
+
+ /* This tests for #pragma diagnostic changes. */
+ if (context->n_classification_history > 0)
+ {
+ int i;
+ /* FIXME: Stupid search. Optimize later. */
+ for (i = context->n_classification_history - 1; i >= 0; i --)
+ {
+ if (context->classification_history[i].location <= location)
+ {
+ if (context->classification_history[i].kind == (int) DK_POP)
+ {
+ i = context->classification_history[i].option;
+ continue;
+ }
+ if (context->classification_history[i].option == diagnostic->option_index)
+ {
+ diag_class = context->classification_history[i].kind;
+ if (diag_class != DK_UNSPECIFIED)
+ diagnostic->kind = diag_class;
+ break;
+ }
+ }
+ }
+ }
/* This tests if the user provided the appropriate -Werror=foo
option. */
- if (context->classify_diagnostic[diagnostic->option_index] != DK_UNSPECIFIED)
+ if (diag_class == DK_UNSPECIFIED
+ && context->classify_diagnostic[diagnostic->option_index] != DK_UNSPECIFIED)
{
diagnostic->kind = context->classify_diagnostic[diagnostic->option_index];
}
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 062402fa3f9..d3840749e91 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -41,6 +41,16 @@ typedef struct diagnostic_info
int option_index;
} diagnostic_info;
+/* Each time a diagnostic's classification is changed with a pragma,
+ we record the change and the location of the change in an array of
+ these structs. */
+typedef struct diagnostic_classification_change_t
+{
+ location_t location;
+ int option;
+ diagnostic_t kind;
+} diagnostic_classification_change_t;
+
/* Forward declarations. */
typedef struct diagnostic_context diagnostic_context;
typedef void (*diagnostic_starter_fn) (diagnostic_context *,
@@ -76,6 +86,20 @@ struct diagnostic_context
all. */
diagnostic_t *classify_diagnostic;
+ /* History of all changes to the classifications above. This list
+ is stored in location-order, so we can search it, either
+ binary-wise or end-to-front, to find the most recent
+ classification for a given diagnostic, given the location of the
+ diagnostic. */
+ diagnostic_classification_change_t *classification_history;
+
+ /* The size of the above array. */
+ int n_classification_history;
+
+ /* For pragma push/pop. */
+ int *push_list;
+ int n_push;
+
/* True if we should print the command line option which controls
each diagnostic, if known. */
bool show_option_requested;
@@ -228,7 +252,10 @@ extern void diagnostic_report_current_module (diagnostic_context *);
/* Force diagnostics controlled by OPTIDX to be kind KIND. */
extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *,
int /* optidx */,
- diagnostic_t /* kind */);
+ diagnostic_t /* kind */,
+ location_t);
+extern void diagnostic_push_diagnostics (diagnostic_context *, location_t);
+extern void diagnostic_pop_diagnostics (diagnostic_context *, location_t);
extern bool diagnostic_report_diagnostic (diagnostic_context *,
diagnostic_info *);
#ifdef ATTRIBUTE_GCC_DIAG
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 7a250bd72ec..7276b6198b4 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -16,7 +16,7 @@ Copyright @copyright{} 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation. A copy of
the license is included in the
@c man end
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 8e9a7061b2b..b967e798b32 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2296,7 +2296,7 @@ attribute is present.
@cindex @code{externally_visible} attribute.
This attribute, attached to a global variable or function, nullifies
the effect of the @option{-fwhole-program} command-line option, so the
-object remains visible outside the current compilation unit.
+object remains visible outside the current compilation unit. If @option{-fwhole-program} is used together with @option{-flto} and @command{gold} is used as the linker plugin, @code{externally_visible} attributes are automatically added to functions (not variable yet due to a current @command{gold} issue) that are accessed outside of LTO objects according to resolution file produced by @command{gold}. For other linkers that cannot generate resolution file, explicit @code{externally_visible} attributes are still necessary.
@item far
@cindex functions which handle memory bank switching
@@ -10994,6 +10994,10 @@ vector unsigned char vec_vrlb (vector unsigned char,
vector float vec_round (vector float);
+vector float vec_recip (vector float, vector float);
+
+vector float vec_rsqrt (vector float);
+
vector float vec_rsqrte (vector float);
vector float vec_sel (vector float, vector float, vector bool int);
@@ -11922,8 +11926,10 @@ vector double vec_or (vector bool long, vector double);
vector double vec_perm (vector double,
vector double,
vector unsigned char);
-vector float vec_rint (vector float);
vector double vec_rint (vector double);
+vector double vec_recip (vector double, vector double);
+vector double vec_rsqrt (vector double);
+vector double vec_rsqrte (vector double);
vector double vec_sel (vector double, vector double, vector bool long);
vector double vec_sel (vector double, vector double, vector unsigned long);
vector double vec_sub (vector double, vector double);
@@ -11964,10 +11970,20 @@ GCC provides a few other builtins on Powerpc to access certain instructions:
float __builtin_recipdivf (float, float);
float __builtin_rsqrtf (float);
double __builtin_recipdiv (double, double);
+double __builtin_rsqrt (double);
long __builtin_bpermd (long, long);
int __builtin_bswap16 (int);
@end smallexample
+The @code{vec_rsqrt}, @code{__builtin_rsqrt}, and
+@code{__builtin_rsqrtf} functions generate multiple instructions to
+implement the reciprocal sqrt functionality using reciprocal sqrt
+estimate instructions.
+
+The @code{__builtin_recipdiv}, and @code{__builtin_recipdivf}
+functions generate multiple instructions to implement division using
+the reciprocal estimate instructions.
+
@node RX Built-in Functions
@subsection RX Built-in Functions
GCC supports some of the RX instructions which cannot be expressed in
@@ -12250,7 +12266,7 @@ subsequent functions.
@subsection M32C Pragmas
@table @code
-@item memregs @var{number}
+@item GCC memregs @var{number}
@cindex pragma, memregs
Overrides the command-line option @code{-memregs=} for the current
file. Use with care! This pragma must be before any function in the
@@ -12259,6 +12275,21 @@ make them incompatible. This pragma is useful when a
performance-critical function uses a memreg for temporary values,
as it may allow you to reduce the number of memregs used.
+@item ADDRESS @var{name} @var{address}
+@cindex pragma, address
+For any declared symbols matching @var{name}, this does three things
+to that symbol: it forces the symbol to be located at the given
+address (a number), it forces the symbol to be volatile, and it
+changes the symbol's scope to be static. This pragma exists for
+compatibility with other compilers, but note that the common
+@code{1234H} numeric syntax is not supported (use @code{0x1234}
+instead). Example:
+
+@example
+#pragma ADDRESS port3 0x103
+char port3;
+@end example
+
@end table
@node MeP Pragmas
@@ -12574,15 +12605,30 @@ option.
#pragma GCC diagnostic ignored "-Wformat"
@end example
-Note that these pragmas override any command-line options. Also,
-while it is syntactically valid to put these pragmas anywhere in your
-sources, the only supported location for them is before any data or
-functions are defined. Doing otherwise may result in unpredictable
-results depending on how the optimizer manages your sources. If the
-same option is listed multiple times, the last one specified is the
-one that is in effect. This pragma is not intended to be a general
-purpose replacement for command-line options, but for implementing
-strict control over project policies.
+Note that these pragmas override any command-line options. GCC keeps
+track of the location of each pragma, and issues diagnostics according
+to the state as of that point in the source file. Thus, pragmas occurring
+after a line do not affect diagnostics caused by that line.
+
+@item #pragma GCC diagnostic push
+@itemx #pragma GCC diagnostic pop
+
+Causes GCC to remember the state of the diagnostics as of each
+@code{push}, and restore to that point at each @code{pop}. If a
+@code{pop} has no matching @code{push}, the command line options are
+restored.
+
+@example
+#pragma GCC diagnostic error "-Wuninitialized"
+ foo(a); /* error is given for this one */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+ foo(b); /* no diagnostic for this one */
+#pragma GCC diagnostic pop
+ foo(c); /* error is given for this one */
+#pragma GCC diagnostic pop
+ foo(d); /* depends on command line options */
+@end example
@end table
diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi
index 34b89634033..0e167bae004 100644
--- a/gcc/doc/gcc.texi
+++ b/gcc/doc/gcc.texi
@@ -40,12 +40,12 @@
@c %**end of header
@copying
-Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008 Free Software Foundation, Inc.
+Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
+1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
diff --git a/gcc/doc/gccint.texi b/gcc/doc/gccint.texi
index 456acc18318..d895898c863 100644
--- a/gcc/doc/gccint.texi
+++ b/gcc/doc/gccint.texi
@@ -31,7 +31,7 @@ Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2008, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index a81fbc246b4..74ada126977 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -1,15 +1,15 @@
-@c Copyright (C) 1996, 1997, 1999, 2000, 2001,
-@c 2002, 2003, 2004, 2005, 2008 Free Software Foundation, Inc.
+@c Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+@c 2008, 2010 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@ignore
@c man begin COPYRIGHT
-Copyright @copyright{} 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2008 Free Software Foundation, Inc.
+Copyright @copyright{} 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
+2005, 2008, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU General Public License'' and ``Funding
Free Software'', the Front-Cover texts being (a) (see below), and with
diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi
index 4d7a5d865bd..7b3be30dc6a 100644
--- a/gcc/doc/generic.texi
+++ b/gcc/doc/generic.texi
@@ -1116,6 +1116,7 @@ target system bytes are not the same width as host system bytes.
@subsection References to storage
@tindex ADDR_EXPR
@tindex INDIRECT_REF
+@tindex MEM_REF
@tindex ARRAY_REF
@tindex ARRAY_RANGE_REF
@tindex TARGET_MEM_REF
@@ -1176,6 +1177,13 @@ These nodes are used to represent the object pointed to by a pointer.
The operand is the pointer being dereferenced; it will always have
pointer or reference type.
+@item MEM_REF
+These nodes are used to represent the object pointed to by a pointer
+offset by a constant.
+The first operand is the pointer being dereferenced; it will always have
+pointer or reference type. The second operand is a pointer constant.
+Its type is specifying the type to be used for type-based alias analysis.
+
@item COMPONENT_REF
These nodes represent non-static data member accesses. The first
operand is the object (rather than a pointer to it); the second operand
diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi
index 16692c57450..b778db387d9 100644
--- a/gcc/doc/gimple.texi
+++ b/gcc/doc/gimple.texi
@@ -452,8 +452,8 @@ becomes
The same rule holds for arguments to a @code{GIMPLE_CALL}.
-The target of an assignment is usually a variable, but can also be an
-@code{INDIRECT_REF} or a compound lvalue as described below.
+The target of an assignment is usually a variable, but can also be a
+@code{MEM_REF} or a compound lvalue as described below.
@menu
* Compound Expressions::
@@ -546,6 +546,9 @@ gimple_rhs_class}
@item @code{GIMPLE_INVALID_RHS}
The tree cannot be used as a GIMPLE operand.
+@item @code{GIMPLE_TERNARY_RHS}
+The tree is a valid GIMPLE ternary operation.
+
@item @code{GIMPLE_BINARY_RHS}
The tree is a valid GIMPLE binary operation.
@@ -567,10 +570,11 @@ from @code{c = a op b ? x : y}. Something similar occurs with
expressions should be flattened into the operand vector.
@end itemize
-For tree nodes in the categories @code{GIMPLE_BINARY_RHS} and
-@code{GIMPLE_UNARY_RHS}, they cannot be stored inside tuples directly.
-They first need to be flattened and separated into individual
-components. For instance, given the GENERIC expression
+For tree nodes in the categories @code{GIMPLE_TERNARY_RHS},
+@code{GIMPLE_BINARY_RHS} and @code{GIMPLE_UNARY_RHS}, they cannot be
+stored inside tuples directly. They first need to be flattened and
+separated into individual components. For instance, given the GENERIC
+expression
@smallexample
a = b + c
@@ -660,6 +664,11 @@ Return true if t is a valid expression to use as the function
called by a @code{GIMPLE_CALL}.
@end deftypefn
+@deftypefn {GIMPLE function} is_gimple_mem_ref_addr (tree t)
+Return true if t is a valid expression to use as first operand
+of a @code{MEM_REF} expression.
+@end deftypefn
+
@deftypefn {GIMPLE function} is_gimple_constant (tree t)
Return true if t is a valid gimple constant.
@end deftypefn
@@ -1073,7 +1082,16 @@ Return the second operand on the @code{RHS} of assignment statement @code{G}.
Return the address of the second operand on the @code{RHS} of assignment
statement @code{G}.
@end deftypefn
+
+@deftypefn {GIMPLE function} tree gimple_assign_rhs3 (gimple g)
+Return the third operand on the @code{RHS} of assignment statement @code{G}.
+@end deftypefn
+@deftypefn {GIMPLE function} tree *gimple_assign_rhs3_ptr (gimple g)
+Return the address of the third operand on the @code{RHS} of assignment
+statement @code{G}.
+@end deftypefn
+
@deftypefn {GIMPLE function} void gimple_assign_set_lhs (gimple g, tree lhs)
Set @code{LHS} to be the @code{LHS} operand of assignment statement @code{G}.
@end deftypefn
@@ -1083,17 +1101,13 @@ Set @code{RHS} to be the first operand on the @code{RHS} of assignment
statement @code{G}.
@end deftypefn
-@deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
-Return the second operand on the @code{RHS} of assignment statement @code{G}.
-@end deftypefn
-
-@deftypefn {GIMPLE function} tree *gimple_assign_rhs2_ptr (gimple g)
-Return a pointer to the second operand on the @code{RHS} of assignment
+@deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs)
+Set @code{RHS} to be the second operand on the @code{RHS} of assignment
statement @code{G}.
@end deftypefn
-@deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs)
-Set @code{RHS} to be the second operand on the @code{RHS} of assignment
+@deftypefn {GIMPLE function} void gimple_assign_set_rhs3 (gimple g, tree rhs)
+Set @code{RHS} to be the third operand on the @code{RHS} of assignment
statement @code{G}.
@end deftypefn
diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi
index 56da9b55fc9..05a279c7d7c 100644
--- a/gcc/doc/gty.texi
+++ b/gcc/doc/gty.texi
@@ -149,20 +149,17 @@ option is a fragment of C code that calculates the length.
The second case is when a structure or a global variable contains a
pointer to an array, like this:
@smallexample
-tree *
- GTY ((length ("%h.regno_pointer_align_length"))) regno_decl;
+struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
@end smallexample
-In this case, @code{regno_decl} has been allocated by writing something like
+In this case, @code{iter} has been allocated by writing something like
@smallexample
- x->regno_decl =
- ggc_alloc (x->regno_pointer_align_length * sizeof (tree));
+ x->iter = ggc_alloc_cleared_vec_gimple_omp_for_iter (collapse);
@end smallexample
-and the @code{length} provides the length of the field.
+and the @code{collapse} provides the length of the field.
This second use of @code{length} also works on global variables, like:
@verbatim
- static GTY((length ("reg_base_value_size")))
- rtx *reg_base_value;
+static GTY((length("reg_known_value_size"))) rtx *reg_known_value;
@end verbatim
@findex skip
@@ -353,6 +350,30 @@ of pointers. @code{reorder} functions can be expensive. When
possible, it is better to depend on properties of the data, like an ID
number or the hash of a string instead.
+@findex variable_size
+@item variable_size
+
+The type machinery expects the types to be of constant size. When this
+is not true, for example, with structs that have array fields or unions,
+the type machinery cannot tell how many bytes need to be allocated at
+each allocation. The @code{variable_size} is used to mark such types.
+The type machinery then provides allocators that take a parameter
+indicating an exact size of object being allocated.
+
+For example,
+@smallexample
+struct GTY((variable_size)) sorted_fields_type @{
+ int len;
+ tree GTY((length ("%h.len"))) elts[1];
+@};
+@end smallexample
+
+Then the objects of @code{struct sorted_fields_type} are allocated in GC
+memory as follows:
+@smallexample
+ field_vec = ggc_alloc_sorted_fields_type (size);
+@end smallexample
+
@findex special
@item special ("@var{name}")
diff --git a/gcc/doc/include/fdl.texi b/gcc/doc/include/fdl.texi
index 74651448e0c..8f3d7be2e80 100644
--- a/gcc/doc/include/fdl.texi
+++ b/gcc/doc/include/fdl.texi
@@ -6,11 +6,13 @@
gpl(7), fsf-funding(7).
@c man end
@c man begin COPYRIGHT
-Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+@uref{http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
+@c This file is intended to be included within another document,
+@c hence no sectioning command or @node.
@c man end
@end ignore
@c Special handling for inclusion in the install manual.
@@ -33,11 +35,11 @@ of this license document, but changing it is not allowed.
@end ifclear
@cindex FDL, GNU Free Documentation License
-@center Version 1.2, November 2002
+@center Version 1.3, 3 November 2008
@display
-Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+@uref{http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -142,6 +144,9 @@ formats which do not have any title page as such, ``Title Page'' means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
+The ``publisher'' means any person or entity that distributes copies
+of the Document to the public.
+
A section ``Entitled XYZ'' means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
@@ -410,13 +415,30 @@ title.
@item
TERMINATION
-You may not copy, modify, sublicense, or distribute the Document except
-as expressly provided for under this License. Any other attempt to
-copy, modify, sublicense or distribute the Document is void, and will
-automatically terminate your rights under this License. However,
-parties who have received copies, or rights, from you under this
-License will not have their licenses terminated so long as such
-parties remain in full compliance.
+You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+
+However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
@item
FUTURE REVISIONS OF THIS LICENSE
@@ -434,7 +456,42 @@ following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
-as a draft) by the Free Software Foundation.
+as a draft) by the Free Software Foundation. If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy's public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+
+@item
+RELICENSING
+
+``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works. A
+public wiki that anybody can edit is an example of such a server. A
+``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
+site means any set of copyrightable works thus published on the MMC
+site.
+
+``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+
+``Incorporate'' means to publish or republish a Document, in whole or
+in part, as part of another Document.
+
+An MMC is ``eligible for relicensing'' if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole
+or in part into the MMC, (1) had no cover texts or invariant sections,
+and (2) were thus incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+
@end enumerate
@page
@@ -448,7 +505,7 @@ license notices just after the title page:
@group
Copyright (C) @var{year} @var{your name}.
Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.2
+ under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 87959e36b62..6492903bcdd 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -72,11 +72,11 @@
@c Part 2 Summary Description and Copyright
@copying
Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
-1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008 Free Software Foundation, Inc.
+1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+2010 Free Software Foundation, Inc.
@sp 1
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, the Front-Cover texts being (a) (see below), and
with the Back-Cover Texts being (b) (see below). A copy of the
@@ -2150,6 +2150,11 @@ Removes any @option{-O}-started option from @code{BOOT_CFLAGS}, and adds
@item @samp{bootstrap-O3}
Analogous to @code{bootstrap-O1}.
+@item @samp{bootstrap-lto}
+Enables Link-Time Optimization for host tools during bootstrapping.
+@samp{BUILD_CONFIG=bootstrap-lto} is equivalent to adding
+@option{-flto} to @samp{BOOT_CFLAGS}.
+
@item @samp{bootstrap-debug}
Verifies that the compiler generates the same executable code, whether
or not it is asked to emit debug information. To this end, this
@@ -2301,7 +2306,7 @@ and network filesystems.
@section Building the Ada compiler
In order to build GNAT, the Ada compiler, you need a working GNAT
-compiler (GCC version 3.4 or later).
+compiler (GCC version 4.0 or later).
This includes GNAT tools such as @command{gnatmake} and
@command{gnatlink}, since the Ada front end is written in Ada and
uses some GNAT-specific extensions.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 2a4ea479682..21740c1523c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -15,7 +15,7 @@ Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU General Public License'' and ``Funding
Free Software'', the Front-Cover texts being (a) (see below), and with
@@ -196,7 +196,7 @@ in the following sections.
-fno-default-inline -fvisibility-inlines-hidden @gol
-fvisibility-ms-compat @gol
-Wabi -Wconversion-null -Wctor-dtor-privacy @gol
--Wnon-virtual-dtor -Wreorder @gol
+-Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
-Weffc++ -Wstrict-null-sentinel @gol
-Wno-non-template-friend -Wold-style-cast @gol
-Woverloaded-virtual -Wno-pmf-conversions @gol
@@ -248,7 +248,7 @@ Objective-C and Objective-C++ Dialects}.
-Wlogical-op -Wlong-long @gol
-Wmain -Wmissing-braces -Wmissing-field-initializers @gol
-Wmissing-format-attribute -Wmissing-include-dirs @gol
--Wmissing-noreturn -Wno-mudflap @gol
+-Wno-mudflap @gol
-Wno-multichar -Wnonnull -Wno-overflow @gol
-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
@@ -258,7 +258,7 @@ Objective-C and Objective-C++ Dialects}.
-Wsign-compare -Wsign-conversion -Wstack-protector @gol
-Wstrict-aliasing -Wstrict-aliasing=n @gol
-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
--Wsuggest-attribute=@r{[}const@r{|}pure@r{]} @gol
+-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
-Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
-Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
-Wunknown-pragmas -Wno-pragmas @gol
@@ -362,7 +362,7 @@ Objective-C and Objective-C++ Dialects}.
-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
-fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
--fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays @gol
+-fpartial-inlining -fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays @gol
-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
-fprofile-generate=@var{path} @gol
-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
@@ -744,6 +744,7 @@ See RS/6000 and PowerPC Options.
@emph{RS/6000 and PowerPC Options}
@gccoptlist{-mcpu=@var{cpu-type} @gol
-mtune=@var{cpu-type} @gol
+-mcmodel=@var{code-model} @gol
-mpower -mno-power -mpower2 -mno-power2 @gol
-mpowerpc -mpowerpc64 -mno-powerpc @gol
-maltivec -mno-altivec @gol
@@ -783,7 +784,8 @@ See RS/6000 and PowerPC Options.
-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
-mprototype -mno-prototype @gol
-msim -mmvme -mads -myellowknife -memb -msdata @gol
--msdata=@var{opt} -mvxworks -G @var{num} -pthread}
+-msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
+-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision -mno-recip-precision}
@emph{RX Options}
@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
@@ -2280,6 +2282,14 @@ Warn when a class seems unusable because all the constructors or
destructors in that class are private, and it has neither friends nor
public static member functions.
+@item -Wnoexcept @r{(C++ and Objective-C++ only)}
+@opindex Wnoexcept
+@opindex Wno-noexcept
+Warn when a noexcept-expression evaluates to false because of a call
+to a function that does not have a non-throwing exception
+specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
+the compiler to never throw an exception.
+
@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
@opindex Wnon-virtual-dtor
@opindex Wno-non-virtual-dtor
@@ -3265,6 +3275,12 @@ look like this:
@end group
@end smallexample
+Also warn for dangerous uses of the
+?: with omitted middle operand GNU extension. When the condition
+in the ?: operator is a boolean expression the omitted value will
+be always 1. Often the user expects it to be a value computed
+inside the conditional expression instead.
+
This warning is enabled by @option{-Wall}.
@item -Wsequence-point
@@ -3653,7 +3669,7 @@ comparisons, so this warning level will give a very large number of
false positives.
@end table
-@item -Wsuggest-attribute=@r{[}const@r{|}pure@r{]}
+@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]}
@opindex Wsuggest-attribute=
@opindex Wno-suggest-attribute=
Warn for cases where adding an attribute may be beneficial. The
@@ -3662,20 +3678,22 @@ attributes currently supported are listed below.
@table @gcctabopt
@item -Wsuggest-attribute=pure
@itemx -Wsuggest-attribute=const
+@itemx -Wsuggest-attribute=noreturn
@opindex Wsuggest-attribute=pure
@opindex Wno-suggest-attribute=pure
@opindex Wsuggest-attribute=const
@opindex Wno-suggest-attribute=const
+@opindex Wsuggest-attribute=noreturn
+@opindex Wno-suggest-attribute=noreturn
Warn about functions which might be candidates for attributes
-@code{pure} or @code{const}. The compiler only warns for functions
-visible in other compilation units or if it cannot prove that the
-function returns normally. A function returns normally if it doesn't
-contain an infinite loop nor returns abnormally by throwing, calling
-@code{abort()} or trapping. This analysis requires option
-@option{-fipa-pure-const}, which is enabled by default at @option{-O}
-and higher. Higher optimization levels improve the accuracy of the
-analysis.
+@code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
+functions visible in other compilation units or (in the case of @code{pure} and
+@code{const}) if it cannot prove that the function returns normally. A function
+returns normally if it doesn't contain an infinite loop nor returns abnormally
+by throwing, calling @code{abort()} or trapping. This analysis requires option
+@option{-fipa-pure-const}, which is enabled by default at @option{-O} and
+higher. Higher optimization levels improve the accuracy of the analysis.
@end table
@item -Warray-bounds
@@ -4152,16 +4170,6 @@ struct s x = @{ .f = 3, .g = 4 @};
This warning is included in @option{-Wextra}. To get other @option{-Wextra}
warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
-@item -Wmissing-noreturn
-@opindex Wmissing-noreturn
-@opindex Wno-missing-noreturn
-Warn about functions which might be candidates for attribute @code{noreturn}.
-Note these are only possible candidates, not absolute ones. Care should
-be taken to manually verify functions actually do not ever return before
-adding the @code{noreturn} attribute, otherwise subtle code generation
-bugs could be introduced. You will not get a warning for @code{main} in
-hosted C environments.
-
@item -Wmissing-format-attribute
@opindex Wmissing-format-attribute
@opindex Wno-missing-format-attribute
@@ -5863,6 +5871,7 @@ also turns on the following optimization flags:
-findirect-inlining @gol
-fipa-sra @gol
-foptimize-sibling-calls @gol
+-fpartial-inlining @gol
-fpeephole2 @gol
-fregmove @gol
-freorder-blocks -freorder-functions @gol
@@ -7020,6 +7029,14 @@ This optimization is enabled by default.
With this option, the compiler will create multiple copies of some
local variables when unrolling a loop which can result in superior code.
+@item -fpartial-inlining
+@opindex fpartial-inlining
+Inline parts of functions. This option has any effect only
+when inlining itself is turned on by the @option{-finline-functions}
+or @option{-finline-small-functions} options.
+
+Enabled at level @option{-O2}.
+
@item -fpredictive-commoning
@opindex fpredictive-commoning
Perform predictive commoning optimization, i.e., reusing computations
@@ -7293,7 +7310,7 @@ Enabled by default with @option{-funroll-loops}.
Assume that the current compilation unit represents the whole program being
compiled. All public functions and variables with the exception of @code{main}
and those merged by attribute @code{externally_visible} become static functions
-and in effect are optimized more aggressively by interprocedural optimizers.
+and in effect are optimized more aggressively by interprocedural optimizers. If @command{gold} is used as the linker plugin, @code{externally_visible} attributes are automatically added to functions (not variable yet due to a current @command{gold} issue) that are accessed outside of LTO objects according to resolution file produced by @command{gold}. For other linkers that cannot generate resolution file, explicit @code{externally_visible} attributes are still necessary.
While this option is equivalent to proper use of the @code{static} keyword for
programs consisting of a single file, in combination with option
@option{-combine}, @option{-flto} or @option{-fwhopr} this flag can be used to
@@ -8108,7 +8125,7 @@ a lot of functions that would otherwise not be considered for inlining
by the compiler will be investigated. To those functions, a different
(more restrictive) limit compared to functions declared inline can
be applied.
-The default value is 50.
+The default value is 40.
@item large-function-insns
The limit specifying really large functions. For functions larger than this
@@ -9911,7 +9928,7 @@ assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
@samp{cortex-a5}, @samp{cortex-a8}, @samp{cortex-a9},
-@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m3},
+@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m4}, @samp{cortex-m3},
@samp{cortex-m1},
@samp{cortex-m0},
@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
@@ -14923,7 +14940,7 @@ Supported values for @var{cpu_type} are @samp{401}, @samp{403},
@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
-@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
+@samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
@samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
@@ -14975,16 +14992,16 @@ values for @var{cpu_type} are used for @option{-mtune} as for
architecture, registers, and mnemonics set by @option{-mcpu}, but the
scheduling parameters set by @option{-mtune}.
-@item -mswdiv
-@itemx -mno-swdiv
-@opindex mswdiv
-@opindex mno-swdiv
-Generate code to compute division as reciprocal estimate and iterative
-refinement, creating opportunities for increased throughput. This
-feature requires: optional PowerPC Graphics instruction set for single
-precision and FRE instruction for double precision, assuming divides
-cannot generate user-visible traps, and the domain values not include
-Infinities, denormals or zero denominator.
+@item -mcmodel=small
+@opindex mcmodel=small
+Generate PowerPC64 code for the small model: The TOC is limited to
+64k.
+
+@item -mcmodel=large
+@opindex mcmodel=large
+Generate PowerPC64 code for the large model: The TOC may be up to 4G
+in size. Other data and code is only limited by the 64-bit address
+space.
@item -maltivec
@itemx -mno-altivec
@@ -15641,6 +15658,52 @@ sequence.
Adds support for multithreading with the @dfn{pthreads} library.
This option sets flags for both the preprocessor and linker.
+@item -mrecip
+@itemx -mno-recip
+@opindex mrecip
+This option will enable GCC to use the reciprocal estimate and
+reciprocal square root estimate instructions with additional
+Newton-Raphson steps to increase precision instead of doing a divide or
+square root and divide for floating point arguments. You should use
+the @option{-ffast-math} option when using @option{-mrecip} (or at
+least @option{-funsafe-math-optimizations},
+@option{-finite-math-only}, @option{-freciprocal-math} and
+@option{-fno-trapping-math}). Note that while the throughput of the
+sequence is generally higher than the throughput of the non-reciprocal
+instruction, the precision of the sequence can be decreased by up to 2
+ulp (i.e. the inverse of 1.0 equals 0.99999994) for reciprocal square
+roots.
+
+@item -mrecip=@var{opt}
+@opindex mrecip=opt
+This option allows to control which reciprocal estimate instructions
+may be used. @var{opt} is a comma separated list of options, that may
+be preceeded by a @code{!} to invert the option:
+@code{all}: enable all estimate instructions,
+@code{default}: enable the default instructions, equvalent to @option{-mrecip},
+@code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
+@code{div}: enable the reciprocal approximation instructions for both single and double precision;
+@code{divf}: enable the single precision reciprocal approximation instructions;
+@code{divd}: enable the double precision reciprocal approximation instructions;
+@code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
+@code{rsqrtf}: enable the single precision reciprocal square root approximation instructions;
+@code{rsqrtd}: enable the double precision reciprocal square root approximation instructions;
+
+So for example, @option{-mrecip=all,!rsqrtd} would enable the
+all of the reciprocal estimate instructions, except for the
+@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
+which handle the double precision reciprocal square root calculations.
+
+@item -mrecip-precision
+@itemx -mno-recip-precision
+@opindex mrecip-precision
+Assume (do not assume) that the reciprocal estimate instructions
+provide higher precision estimates than is mandated by the powerpc
+ABI. Selecting @option{-mcpu=power6} or @option{-mcpu=power7}
+automatically selects @option{-mrecip-precision}. The double
+precision square root estimate instructions are not generated by
+default on low precision machines, since they do not provide an
+estimate that converges after three steps.
@end table
@node RX Options
@@ -17673,6 +17736,32 @@ the DSOs.
An overview of these techniques, their benefits and how to use them
is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
+@item -fstrict-volatile-bitfields
+This option should be used if accesses to volatile bitfields (or other
+structure fields, although the compiler usually honors those types
+anyway) should use a single access in a mode of the same size as the
+container's type, aligned to a natural alignment if possible. For
+example, targets with memory-mapped peripheral registers might require
+all such accesses to be 16 bits wide; with this flag the user could
+declare all peripheral bitfields as ``unsigned short'' (assuming short
+is 16 bits on these targets) to force GCC to use 16 bit accesses
+instead of, perhaps, a more efficient 32 bit access.
+
+If this option is disabled, the compiler will use the most efficient
+instruction. In the previous example, that might be a 32-bit load
+instruction, even though that will access bytes that do not contain
+any portion of the bitfield, or memory-mapped registers unrelated to
+the one being updated.
+
+If the target requires strict alignment, and honoring the container
+type would require violating this alignment, a warning is issued.
+However, the access happens as the user requested, under the
+assumption that the user knows something about the target hardware
+that GCC is unaware of.
+
+The default value of this option is determined by the application binary
+interface for the target processor.
+
@end table
@c man end
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index fb3a4c1bc73..211fdcb8635 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -1052,6 +1052,10 @@ an operand may be in a register, and which kinds of register; whether the
operand can be a memory reference, and which kinds of address; whether the
operand may be an immediate constant, and which possible values it may
have. Constraints can also require two operands to match.
+Side-effects aren't allowed in operands of inline @code{asm}, unless
+@samp{<} or @samp{>} constraints are used, because there is no guarantee
+that the side-effects will happen exactly once in an instruction that can update
+the addressing register.
@ifset INTERNALS
@menu
@@ -1129,12 +1133,21 @@ would fit the @samp{m} constraint but not the @samp{o} constraint.
@cindex @samp{<} in constraint
@item @samp{<}
A memory operand with autodecrement addressing (either predecrement or
-postdecrement) is allowed.
+postdecrement) is allowed. In inline @code{asm} this constraint is only
+allowed if the operand is used exactly once in an instruction that can
+handle the side-effects. Not using an operand with @samp{<} in constraint
+string in the inline @code{asm} pattern at all or using it in multiple
+instructions isn't valid, because the side-effects wouldn't be performed
+or would be performed more than once. Furthermore, on some targets
+the operand with @samp{<} in constraint string must be accompanied by
+special instruction suffixes like @code{%U0} instruction suffix on PowerPC
+or @code{%P0} on IA-64.
@cindex @samp{>} in constraint
@item @samp{>}
A memory operand with autoincrement addressing (either preincrement or
-postincrement) is allowed.
+postincrement) is allowed. In inline @code{asm} the same restrictions
+as for @samp{<} apply.
@cindex @samp{r} in constraint
@cindex registers in constraints
@@ -3750,7 +3763,8 @@ it is unsafe to call @code{gen_reg_rtx} to allocate a new pseudo.
The constraints on a @samp{mov@var{m}} must permit moving any hard
register to any other hard register provided that
@code{HARD_REGNO_MODE_OK} permits mode @var{m} in both registers and
-@code{REGISTER_MOVE_COST} applied to their classes returns a value of 2.
+@code{TARGET_REGISTER_MOVE_COST} applied to their classes returns a value
+of 2.
It is obligatory to support floating point @samp{mov@var{m}}
instructions into and out of any registers that can hold fixed point
@@ -6700,9 +6714,46 @@ distances. @xref{Insn Lengths}.
The @code{enabled} attribute can be defined to prevent certain
alternatives of an insn definition from being used during code
generation. @xref{Disable Insn Alternatives}.
-
@end table
+@findex define_enum_attr
+@anchor{define_enum_attr}
+Another way of defining an attribute is to use:
+
+@smallexample
+(define_enum_attr "@var{attr}" "@var{enum}" @var{default})
+@end smallexample
+
+This works in just the same way as @code{define_attr}, except that
+the list of values is taken from a separate enumeration called
+@var{enum} (@pxref{define_enum}). This form allows you to use
+the same list of values for several attributes without having to
+repeat the list each time. For example:
+
+@smallexample
+(define_enum "processor" [
+ model_a
+ model_b
+ @dots{}
+])
+(define_enum_attr "arch" "processor"
+ (const (symbol_ref "target_arch")))
+(define_enum_attr "tune" "processor"
+ (const (symbol_ref "target_tune")))
+@end smallexample
+
+defines the same attributes as:
+
+@smallexample
+(define_attr "arch" "model_a,model_b,@dots{}"
+ (const (symbol_ref "target_arch")))
+(define_attr "tune" "model_a,model_b,@dots{}"
+ (const (symbol_ref "target_tune")))
+@end smallexample
+
+but without duplicating the processor list. The second example defines two
+separate C enums (@code{attr_arch} and @code{attr_tune}) whereas the first
+defines a single C enum (@code{processor}).
@end ifset
@ifset INTERNALS
@node Expressions
@@ -7902,6 +7953,124 @@ You could write:
The constants that are defined with a define_constant are also output
in the insn-codes.h header file as #defines.
+
+@cindex enumerations
+@findex define_c_enum
+You can also use the machine description file to define enumerations.
+Like the constants defined by @code{define_constant}, these enumerations
+are visible to both the machine description file and the main C code.
+
+The syntax is as follows:
+
+@smallexample
+(define_c_enum "@var{name}" [
+ @var{value0}
+ @var{value1}
+ @dots{}
+ @var{valuen}
+])
+@end smallexample
+
+This definition causes the equivalent of the following C code to appear
+in @file{insn-constants.h}:
+
+@smallexample
+enum @var{name} @{
+ @var{value0} = 0,
+ @var{value1} = 1,
+ @dots{}
+ @var{valuen} = @var{n}
+@};
+#define NUM_@var{cname}_VALUES (@var{n} + 1)
+@end smallexample
+
+where @var{cname} is the capitalized form of @var{name}.
+It also makes each @var{valuei} available in the machine description
+file, just as if it had been declared with:
+
+@smallexample
+(define_constants [(@var{valuei} @var{i})])
+@end smallexample
+
+Each @var{valuei} is usually an upper-case identifier and usually
+begins with @var{cname}.
+
+You can split the enumeration definition into as many statements as
+you like. The above example is directly equivalent to:
+
+@smallexample
+(define_c_enum "@var{name}" [@var{value0}])
+(define_c_enum "@var{name}" [@var{value1}])
+@dots{}
+(define_c_enum "@var{name}" [@var{valuen}])
+@end smallexample
+
+Splitting the enumeration helps to improve the modularity of each
+individual @code{.md} file. For example, if a port defines its
+synchronization instructions in a separate @file{sync.md} file,
+it is convenient to define all synchronization-specific enumeration
+values in @file{sync.md} rather than in the main @file{.md} file.
+
+Some enumeration names have special significance to GCC:
+
+@table @code
+@item unspecv
+@findex unspec_volatile
+If an enumeration called @code{unspecv} is defined, GCC will use it
+when printing out @code{unspec_volatile} expressions. For example:
+
+@smallexample
+(define_c_enum "unspecv" [
+ UNSPECV_BLOCKAGE
+])
+@end smallexample
+
+causes GCC to print @samp{(unspec_volatile @dots{} 0)} as:
+
+@smallexample
+(unspec_volatile ... UNSPECV_BLOCKAGE)
+@end smallexample
+
+@item unspec
+@findex unspec
+If an enumeration called @code{unspec} is defined, GCC will use
+it when printing out @code{unspec} expressions. GCC will also use
+it when printing out @code{unspec_volatile} expressions unless an
+@code{unspecv} enumeration is also defined. You can therefore
+decide whether to keep separate enumerations for volatile and
+non-volatile expressions or whether to use the same enumeration
+for both.
+@end table
+
+@findex define_enum
+@anchor{define_enum}
+Another way of defining an enumeration is to use @code{define_enum}:
+
+@smallexample
+(define_enum "@var{name}" [
+ @var{value0}
+ @var{value1}
+ @dots{}
+ @var{valuen}
+])
+@end smallexample
+
+This directive implies:
+
+@smallexample
+(define_c_enum "@var{name}" [
+ @var{cname}_@var{cvalue0}
+ @var{cname}_@var{cvalue1}
+ @dots{}
+ @var{cname}_@var{cvaluen}
+])
+@end smallexample
+
+@findex define_enum_attr
+where @var{cvaluei} is the capitalized form of @var{valuei}.
+However, unlike @code{define_c_enum}, the enumerations defined
+by @code{define_enum} can be used in attribute specifications
+(@pxref{define_enum_attr}).
@end ifset
@ifset INTERNALS
@node Iterators
diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi
index 77000fee646..5a560424993 100644
--- a/gcc/doc/plugins.texi
+++ b/gcc/doc/plugins.texi
@@ -50,8 +50,10 @@ fatal error: plugin <name> is not licensed under a GPL-compatible license
compilation terminated
@end smallexample
-The type of the symbol is irrelevant. The compiler merely asserts that
-it exists in the global scope. Something like this is enough:
+The declared type of the symbol should be int, to match a forward declaration
+in @file{gcc-plugin.h} that suppresses C++ mangling. It does not need to be in
+any allocated section, though. The compiler merely asserts that
+the symbol exists in the global scope. Something like this is enough:
@smallexample
int plugin_is_GPL_compatible;
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index c4353c790c5..cb116a93f57 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1734,6 +1734,9 @@ Target supports @option{-freorder-blocks-and-partition}.
@item fstack_protector
Target supports @option{-fstack-protector}.
+@item gas
+Target uses GNU @command{as}.
+
@item gc_sections
Target supports @option{--gc-sections}.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 6e68d2ea8d3..d6bc604b7ee 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -141,13 +141,6 @@ should call @code{DEFAULT_SWITCH_CURTAILS_COMPILATION} and then check
for additional options.
@end defmac
-@defmac SWITCHES_NEED_SPACES
-A string-valued C expression which enumerates the options for which
-the linker needs a space between the option and its argument.
-
-If this macro is not defined, the default value is @code{""}.
-@end defmac
-
@defmac TARGET_OPTION_TRANSLATE_TABLE
If defined, a list of pairs of strings, the first of which is a
potential command line target to the @file{gcc} driver program, and the
@@ -523,31 +516,6 @@ Cross compilers do not search either @file{/usr/local/include} or its
replacement.
@end defmac
-@defmac MODIFY_TARGET_NAME
-Define this macro if you wish to define command-line switches that
-modify the default target name.
-
-For each switch, you can include a string to be appended to the first
-part of the configuration name or a string to be deleted from the
-configuration name, if present. The definition should be an initializer
-for an array of structures. Each array element should have three
-elements: the switch name (a string constant, including the initial
-dash), one of the enumeration codes @code{ADD} or @code{DELETE} to
-indicate whether the string should be inserted or deleted, and the string
-to be inserted or deleted (a string constant).
-
-For example, on a machine where @samp{64} at the end of the
-configuration name denotes a 64-bit target and you want the @option{-32}
-and @option{-64} switches to select between 32- and 64-bit targets, you would
-code
-
-@smallexample
-#define MODIFY_TARGET_NAME \
- @{ @{ "-32", DELETE, "64"@}, \
- @{"-64", ADD, "64"@}@}
-@end smallexample
-@end defmac
-
@defmac SYSTEM_INCLUDE_DIR
Define this macro as a C string constant if you wish to specify a
system-specific directory to search for header files before the standard
@@ -818,15 +786,18 @@ Don't use this macro to turn on various extra optimizations for
If you need to do something whenever the optimization level is
changed via the optimize attribute or pragma, see
@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}
+
+This macros is obsolete, new ports should use the target hook
+@code{TARGET_OPTION_OVERRIDE} instead.
@end defmac
@deftypefn {Target Hook} void TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE (void)
-This target function is similar to the macro @code{OVERRIDE_OPTIONS}
+This target function is similar to the hook @code{TARGET_OPTION_OVERRIDE}
but is called when the optimize level is changed via an attribute or
pragma or when it is reset at the end of the code affected by the
attribute or pragma. It is not called at the beginning of compilation
-when @code{OVERRIDE_OPTIONS} is called so if you want to perform these
-actions then, you should have @code{OVERRIDE_OPTIONS} call
+when @code{TARGET_OPTION_OVERRIDE} is called so if you want to perform these
+actions then, you should have @code{TARGET_OPTION_OVERRIDE} call
@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}.
@end deftypefn
@@ -924,7 +895,7 @@ used to initialize the @code{machine} of that structure.
@code{struct machine_function} structures are expected to be freed by GC@.
Generally, any memory that they reference must be allocated by using
-@code{ggc_alloc}, including the structure itself.
+GC allocation, including the structure itself.
@end deftypevar
@node Storage Layout
@@ -2677,7 +2648,7 @@ Don't define this macro unless the target machine has limitations which
require the macro to do something nontrivial.
@end defmac
-@deftypefn {Target Hook} {enum reg_class} TARGET_SECONDARY_RELOAD (bool @var{in_p}, rtx @var{x}, enum reg_class @var{reload_class}, enum machine_mode @var{reload_mode}, secondary_reload_info *@var{sri})
+@deftypefn {Target Hook} reg_class_t TARGET_SECONDARY_RELOAD (bool @var{in_p}, rtx @var{x}, reg_class_t @var{reload_class}, enum machine_mode @var{reload_mode}, secondary_reload_info *@var{sri})
Many machines have some registers that cannot be copied directly to or
from memory or even from other types of registers. An example is the
@samp{MQ} register, which on most machines, can only be copied to or
@@ -2917,7 +2888,7 @@ as below:
@end smallexample
@end defmac
-@deftypefn {Target Hook} {const enum reg_class *} TARGET_IRA_COVER_CLASSES (void)
+@deftypefn {Target Hook} {const reg_class_t *} TARGET_IRA_COVER_CLASSES (void)
Return an array of cover classes for the Integrated Register Allocator
(@acronym{IRA}). Cover classes are a set of non-intersecting register
classes covering all hard registers used for register allocation
@@ -3960,11 +3931,10 @@ suppresses this behavior and causes the parameter to be passed on the
stack in its natural location.
@end defmac
-@defmac RETURN_POPS_ARGS (@var{fundecl}, @var{funtype}, @var{stack-size})
-A C expression that should indicate the number of bytes of its own
-arguments that a function pops on returning, or 0 if the
-function pops no arguments and the caller must therefore pop them all
-after the function returns.
+@deftypefn {Target Hook} int TARGET_RETURN_POPS_ARGS (tree @var{fundecl}, tree @var{funtype}, int @var{size})
+This target hook returns the number of bytes of its own arguments that
+a function pops on returning, or 0 if the function pops no arguments
+and the caller must therefore pop them all after the function returns.
@var{fundecl} is a C variable whose value is a tree node that describes
the function in question. Normally it is a node of type
@@ -3984,12 +3954,12 @@ by their names. Note that ``library function'' in this context means
a function used to perform arithmetic, whose name is known specially
in the compiler and was not mentioned in the C code being compiled.
-@var{stack-size} is the number of bytes of arguments passed on the
+@var{size} is the number of bytes of arguments passed on the
stack. If a variable number of bytes is passed, it is zero, and
argument popping will always be the responsibility of the calling function.
On the VAX, all functions always pop their arguments, so the definition
-of this macro is @var{stack-size}. On the 68000, using the standard
+of this macro is @var{size}. On the 68000, using the standard
calling convention, no functions pop their arguments, so the value of
the macro is always 0 in this case. But an alternative calling
convention is available in which functions that take a fixed number of
@@ -3997,7 +3967,7 @@ arguments pop them but other functions (such as @code{printf}) pop
nothing (the caller pops all). When this convention is in use,
@var{funtype} is examined to determine whether a function takes a fixed
number of arguments.
-@end defmac
+@end deftypefn
@defmac CALL_POPS_ARGS (@var{cum})
A C expression that should indicate the number of bytes a call sequence
@@ -4119,7 +4089,7 @@ register to be used by the caller for this argument; likewise
@code{FUNCTION_INCOMING_ARG}, for the called function.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_PASS_BY_REFERENCE (CUMULATIVE_ARGS *@var{cum}, enum machine_mode @var{mode}, tree @var{type}, bool @var{named})
+@deftypefn {Target Hook} bool TARGET_PASS_BY_REFERENCE (CUMULATIVE_ARGS *@var{cum}, enum machine_mode @var{mode}, const_tree @var{type}, bool @var{named})
This target hook should return @code{true} if an argument at the
position indicated by @var{cum} should be passed by reference. This
predicate is queried after target independent reasons for being
@@ -4298,13 +4268,13 @@ This hook returns a type node for @code{va_list} for the target.
The default version of the hook returns @code{void*}.
@end deftypefn
-@deftypefn {Target Hook} int TARGET_ENUM_VA_LIST_P (int @var{idx}, const char ** @var{pname}, tree @var{ptype})
+@deftypefn {Target Hook} int TARGET_ENUM_VA_LIST_P (int @var{idx}, const char **@var{pname}, tree *@var{ptree})
This target hook is used in function @code{c_common_nodes_and_builtins}
to iterate through the target specific builtin types for va_list. The
variable @var{idx} is used as iterator. @var{pname} has to be a pointer
-to a @code{const char *} and @var{ptype} a pointer to a @code{tree} typed
+to a @code{const char *} and @var{ptree} a pointer to a @code{tree} typed
variable.
-The arguments @var{pname} and @var{ptype} are used to store the result of
+The arguments @var{pname} and @var{ptree} are used to store the result of
this macro and are set to the name of the va_list builtin type and its
internal type.
If the return value of this macro is zero, then there is no more element.
@@ -4445,11 +4415,6 @@ This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE} for
a new target instead.
@end defmac
-@defmac FUNCTION_OUTGOING_VALUE (@var{valtype}, @var{func})
-This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE} for
-a new target instead.
-@end defmac
-
@defmac LIBCALL_VALUE (@var{mode})
A C expression to create an RTX representing the place where a library
function returns a value of mode @var{mode}.
@@ -4460,8 +4425,7 @@ specially by the compiler and was not mentioned in the C code being
compiled.
@end defmac
-@deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (enum machine_mode
-@var{mode}, const_rtx @var{fun})
+@deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (enum machine_mode @var{mode}, const_rtx @var{fun})
Define this hook if the back-end needs to know the name of the libcall
function in order to determine where the result should be returned.
@@ -5742,9 +5706,8 @@ preserved (e.g.@: used only by a reduction computation). Otherwise, the
@code{widen_mult_hi/lo} idioms will be used.
@end deftypefn
-@deftypefn {Target Hook} int TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST (bool @var{runtime_test})
-Returns the cost to be added to the overhead involved with executing
-the vectorized version of a loop.
+@deftypefn {Target Hook} int TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST (enum vect_cost_for_stmt @var{type_of_cost})
+Returns cost of different scalar or vector statements for vectorization cost model.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE (const_tree @var{type}, bool @var{is_packed})
@@ -5780,7 +5743,7 @@ return type of the vectorized function shall be of vector type
@var{vec_type_out} and the argument types should be @var{vec_type_in}.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_SUPPORT_VECTOR_MISALIGNMENT (enum machine_mode @var{mode}, const_tree @var{type}, int @var{misalignment}, bool @var{is_packed})
+@deftypefn {Target Hook} bool TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT (enum machine_mode @var{mode}, const_tree @var{type}, int @var{misalignment}, bool @var{is_packed})
This hook should return true if the target supports misaligned vector
store/load of a specific factor denoted in the @var{misalignment}
parameter. The vector store/load should be of machine mode @var{mode} and
@@ -6154,8 +6117,32 @@ classes returns a value of 2, reload does not check to ensure that the
constraints of the insn are met. Setting a cost of other than 2 will
allow reload to verify that the constraints are met. You should do this
if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
+
+These macros are obsolete, new ports should use the target hook
+@code{TARGET_REGISTER_MOVE_COST} instead.
@end defmac
+@deftypefn {Target Hook} int TARGET_REGISTER_MOVE_COST (enum machine_mode @var{mode}, reg_class_t @var{from}, reg_class_t @var{to})
+This target hook should return the cost of moving data of mode @var{mode}
+from a register in class @var{from} to one in class @var{to}. The classes
+are expressed using the enumeration values such as @code{GENERAL_REGS}.
+A value of 2 is the default; other values are interpreted relative to
+that.
+
+It is not required that the cost always equal 2 when @var{from} is the
+same as @var{to}; on some machines it is expensive to move between
+registers if they are not general registers.
+
+If reload sees an insn consisting of a single @code{set} between two
+hard registers, and if @code{TARGET_REGISTER_MOVE_COST} applied to their
+classes returns a value of 2, reload does not check to ensure that the
+constraints of the insn are met. Setting a cost of other than 2 will
+allow reload to verify that the constraints are met. You should do this
+if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
+
+The default version of this function returns 2.
+@end deftypefn
+
@defmac MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in})
A C expression for the cost of moving data of mode @var{mode} between a
register of class @var{class} and memory; @var{in} is zero if the value
@@ -6178,8 +6165,35 @@ secondary register in the conventional way but the default base value of
4 is not correct for your machine, define this macro to add some other
value to the result of that function. The arguments to that function
are the same as to this macro.
+
+These macros are obsolete, new ports should use the target hook
+@code{TARGET_MEMORY_MOVE_COST} instead.
@end defmac
+@deftypefn {Target Hook} int TARGET_MEMORY_MOVE_COST (enum machine_mode @var{mode}, reg_class_t @var{rclass}, bool @var{in})
+This target hook should return the cost of moving data of mode @var{mode}
+between a register of class @var{rclass} and memory; @var{in} is @code{false}
+if the value is to be written to memory, @code{true} if it is to be read in.
+This cost is relative to those in @code{TARGET_REGISTER_MOVE_COST}.
+If moving between registers and memory is more expensive than between two
+registers, you should add this target hook to express the relative cost.
+
+If you do not add this target hook, GCC uses a default cost of 4 plus
+the cost of copying via a secondary reload register, if one is
+needed. If your machine requires a secondary reload register to copy
+between memory and a register of @var{rclass} but the reload mechanism is
+more complex than copying via an intermediate, use this target hook to
+reflect the actual cost of the move.
+
+GCC defines the function @code{memory_move_secondary_cost} if
+secondary reloads are needed. It computes the costs due to copying via
+a secondary register. If your machine copies from memory using a
+secondary register in the conventional way but the default base value of
+4 is not correct for your machine, use this target hook to add some other
+value to the result of that function. The arguments to that function
+are the same as to this target hook.
+@end deftypefn
+
@defmac BRANCH_COST (@var{speed_p}, @var{predictable_p})
A C expression for the cost of a branch instruction. A value of 1 is the
default; other values are interpreted relative to that. Parameter @var{speed_p}
@@ -6631,7 +6645,6 @@ The default is that any ready insns can be chosen to be issued.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_DFA_NEW_CYCLE (FILE *@var{dump}, int @var{verbose}, rtx @var{insn}, int @var{last_clock}, int @var{clock}, int *@var{sort_p})
-
This hook is called by the insn scheduler before issuing @var{insn}
on cycle @var{clock}. If the hook returns nonzero,
@var{insn} is not issued on this processor cycle. Instead,
@@ -7766,21 +7779,19 @@ You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or
@code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro.
@end defmac
-@defmac ASM_DECLARE_CONSTANT_NAME (@var{stream}, @var{name}, @var{exp}, @var{size})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} any text necessary for declaring the name @var{name} of a
-constant which is being defined. This macro is responsible for
-outputting the label definition (perhaps using
-@code{ASM_OUTPUT_LABEL}). The argument @var{exp} is the
-value of the constant, and @var{size} is the size of the constant
-in bytes. @var{name} will be an internal label.
+@deftypefn {Target Hook} void TARGET_ASM_DECLARE_CONSTANT_NAME (FILE *@var{file}, const char *@var{name}, const_tree @var{expr}, HOST_WIDE_INT @var{size})
+A target hook to output to the stdio stream @var{file} any text necessary
+for declaring the name @var{name} of a constant which is being defined. This
+target hook is responsible for outputting the label definition (perhaps using
+@code{assemble_label}). The argument @var{exp} is the value of the constant,
+and @var{size} is the size of the constant in bytes. The @var{name}
+will be an internal label.
-If this macro is not defined, then the @var{name} is defined in the
-usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
+The default version of this target hook, define the @var{name} in the
+usual manner as a label (by means of @code{assemble_label}).
-You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition
-of this macro.
-@end defmac
+You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in this target hook.
+@end deftypefn
@defmac ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@@ -8680,7 +8691,7 @@ to be broken up according to function.
The default is that no label is emitted.
@end deftypefn
-@deftypefn {Target Hook} void TARGET_UNWIND_EMIT (FILE *@var{stream}, rtx @var{insn})
+@deftypefn {Target Hook} void TARGET_ASM_UNWIND_EMIT (FILE *@var{stream}, rtx @var{insn})
This target hook emits assembly directives required to unwind the
given instruction. This is only used when TARGET_UNWIND_INFO is set.
@end deftypefn
@@ -8744,7 +8755,7 @@ default.
@defmac TARGET_UNWIND_INFO
Define this macro if your target has ABI specified unwind tables. Usually
-these will be output by @code{TARGET_UNWIND_EMIT}.
+these will be output by @code{TARGET_ASM_UNWIND_EMIT}.
@end defmac
@deftypevr {Target Hook} bool TARGET_UNWIND_TABLES_DEFAULT
@@ -8829,7 +8840,7 @@ define the macro.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @var{align_jumps} in the target's
-@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.
@end defmac
@@ -8858,7 +8869,7 @@ define the macro.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @code{align_loops} in the target's
-@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.
@end defmac
@@ -8874,7 +8885,7 @@ the maximum of the specified values is used.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @code{align_labels} in the target's
-@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.
@end defmac
@@ -9270,6 +9281,12 @@ A C statement to issue assembly directives that create a difference
@var{lab1} minus @var{lab2}, using an integer of the given @var{size}.
@end defmac
+@defmac ASM_OUTPUT_DWARF_VMS_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
+A C statement to issue assembly directives that create a difference
+between the two given labels in system defined units, e.g. instruction
+slots on IA64 VMS, using an integer of the given size.
+@end defmac
+
@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{section})
A C statement to issue assembly directives that create a
section-relative reference to the given @var{label}, using an integer of the
@@ -9340,7 +9357,7 @@ in response to the @option{-g} option. The default behavior for VMS
is to generate minimal debug info for a traceback in the absence of
@option{-g} unless explicitly overridden with @option{-g0}. This
behavior is controlled by @code{OPTIMIZATION_OPTIONS} and
-@code{OVERRIDE_OPTIONS}.
+@code{TARGET_OPTION_OVERRIDE}.
@end defmac
@node Floating Point
@@ -9609,9 +9626,7 @@ to perform initial processing of the @samp{dllimport} and
@end deftypefn
@deftypefn {Target Hook} bool TARGET_VALID_DLLIMPORT_ATTRIBUTE_P (const_tree @var{decl})
-@var{decl} is a variable or function with @code{__attribute__((dllimport))}
-specified. Use this hook if the target needs to add extra validation
-checks to @code{handle_dll_attribute}.
+@var{decl} is a variable or function with @code{__attribute__((dllimport))} specified. Use this hook if the target needs to add extra validation checks to @code{handle_dll_attribute}.
@end deftypefn
@defmac TARGET_DECLSPEC
@@ -9675,11 +9690,25 @@ information in the @var{struct cl_target_option} structure for
function specific options.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_OPTION_PRAGMA_PARSE (target @var{args})
+@deftypefn {Target Hook} bool TARGET_OPTION_PRAGMA_PARSE (tree @var{args}, tree @var{pop_target})
This target hook parses the options for @code{#pragma GCC option} to
set the machine specific options for functions that occur later in the
input stream. The options should be the same as handled by the
-@code{TARGET_VALID_OPTION_ATTRIBUTE_P} hook.
+@code{TARGET_OPTION_VALID_ATTRIBUTE_P} hook.
+@end deftypefn
+
+@deftypefn {Target Hook} void TARGET_OPTION_OVERRIDE (void)
+Sometimes certain combinations of command options do not make sense on
+a particular target machine. You can override the hook
+@code{TARGET_OPTION_OVERRIDE} to take account of this. This hooks is called
+once just after all the command options have been parsed.
+
+Don't use this hook to turn on various extra optimizations for
+@option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
+
+If you need to do something whenever the optimization level is
+changed via the optimize attribute or pragma, see
+@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}
@end deftypefn
@deftypefn {Target Hook} bool TARGET_CAN_INLINE_P (tree @var{caller}, tree @var{callee})
@@ -9869,7 +9898,7 @@ This hook should return @code{true} if the element size should be stored in
array cookies. The default is to return @code{false}.
@end deftypefn
-@deftypefn {Target Hook} int TARGET_CXX_IMPORT_EXPORT_CLASS (tree @var{type}, int @var{import_export})
+@deftypefn {Target Hook} int TARGET_CXX_IMPORT_EXPORT_CLASS (tree @var{type}, int @var{import_export})
If defined by a backend this hook allows the decision made to export
class @var{type} to be overruled. Upon entry @var{import_export}
will contain 1 if the class is going to be exported, @minus{}1 if it is going
@@ -9895,12 +9924,7 @@ method. The default is to return @code{true}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY (tree @var{decl})
-@var{decl} is a virtual table, virtual table table, typeinfo object,
-or other similar implicit class data object that will be emitted with
-external linkage in this translation unit. No ELF visibility has been
-explicitly specified. If the target needs to specify a visibility
-other than that of the containing class, use this hook to set
-@code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}.
+@var{decl} is a virtual table, virtual table table, typeinfo object, or other similar implicit class data object that will be emitted with external linkage in this translation unit. No ELF visibility has been explicitly specified. If the target needs to specify a visibility other than that of the containing class, use this hook to set @code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT (void)
@@ -9932,9 +9956,7 @@ unloaded. The default is to return false.
@end deftypefn
@deftypefn {Target Hook} void TARGET_CXX_ADJUST_CLASS_AT_DEFINITION (tree @var{type})
-@var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been
-defined. Use this hook to make adjustments to the class (eg, tweak
-visibility or perform any other required target modifications).
+@var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been defined. Use this hook to make adjustments to the class (eg, tweak visibility or perform any other required target modifications).
@end deftypefn
@node Named Address Spaces
@@ -10769,7 +10791,6 @@ built-in function.
@end deftypefn
@deftypefn {Target Hook} tree TARGET_RESOLVE_OVERLOADED_BUILTIN (unsigned int @var{loc}, tree @var{fndecl}, void *@var{arglist})
-
Select a replacement for a machine specific built-in function that
was set up by @samp{TARGET_INIT_BUILTINS}. This is done
@emph{before} regular type checking, and so allows the target to
@@ -10782,7 +10803,6 @@ another @code{CALL_EXPR}.
@end deftypefn
@deftypefn {Target Hook} tree TARGET_FOLD_BUILTIN (tree @var{fndecl}, int @var{n_args}, tree *@var{argp}, bool @var{ignore})
-
Fold a call to a machine specific built-in function that was set up by
@samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the
built-in function. @var{n_args} is the number of arguments passed to
@@ -10924,7 +10944,7 @@ cannot_modify_jumps_past_reload_p ()
@end smallexample
@end deftypefn
-@deftypefn {Target Hook} {enum reg_class} TARGET_BRANCH_TARGET_REGISTER_CLASS (void)
+@deftypefn {Target Hook} reg_class_t TARGET_BRANCH_TARGET_REGISTER_CLASS (void)
This target hook returns a register class for which branch target register
optimizations should be applied. All registers in this class should be
usable interchangeably. After reload, registers in this class will be
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
new file mode 100644
index 00000000000..083d56ffd3b
--- /dev/null
+++ b/gcc/doc/tm.texi.in
@@ -0,0 +1,11168 @@
+@c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
+@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c Free Software Foundation, Inc.
+@c This is part of the GCC manual.
+@c For copying conditions, see the file gcc.texi.
+
+@node Target Macros
+@chapter Target Description Macros and Functions
+@cindex machine description macros
+@cindex target description macros
+@cindex macros, target description
+@cindex @file{tm.h} macros
+
+In addition to the file @file{@var{machine}.md}, a machine description
+includes a C header file conventionally given the name
+@file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
+The header file defines numerous macros that convey the information
+about the target machine that does not fit into the scheme of the
+@file{.md} file. The file @file{tm.h} should be a link to
+@file{@var{machine}.h}. The header file @file{config.h} includes
+@file{tm.h} and most compiler source files include @file{config.h}. The
+source file defines a variable @code{targetm}, which is a structure
+containing pointers to functions and data relating to the target
+machine. @file{@var{machine}.c} should also contain their definitions,
+if they are not defined elsewhere in GCC, and other functions called
+through the macros defined in the @file{.h} file.
+
+@menu
+* Target Structure:: The @code{targetm} variable.
+* Driver:: Controlling how the driver runs the compilation passes.
+* Run-time Target:: Defining @samp{-m} options like @option{-m68000} and @option{-m68020}.
+* Per-Function Data:: Defining data structures for per-function information.
+* Storage Layout:: Defining sizes and alignments of data.
+* Type Layout:: Defining sizes and properties of basic user data types.
+* Registers:: Naming and describing the hardware registers.
+* Register Classes:: Defining the classes of hardware registers.
+* Old Constraints:: The old way to define machine-specific constraints.
+* Stack and Calling:: Defining which way the stack grows and by how much.
+* Varargs:: Defining the varargs macros.
+* Trampolines:: Code set up at run time to enter a nested function.
+* Library Calls:: Controlling how library routines are implicitly called.
+* Addressing Modes:: Defining addressing modes valid for memory operands.
+* Anchored Addresses:: Defining how @option{-fsection-anchors} should work.
+* Condition Code:: Defining how insns update the condition code.
+* Costs:: Defining relative costs of different operations.
+* Scheduling:: Adjusting the behavior of the instruction scheduler.
+* Sections:: Dividing storage into text, data, and other sections.
+* PIC:: Macros for position independent code.
+* Assembler Format:: Defining how to write insns and pseudo-ops to output.
+* Debugging Info:: Defining the format of debugging output.
+* Floating Point:: Handling floating point for cross-compilers.
+* Mode Switching:: Insertion of mode-switching instructions.
+* Target Attributes:: Defining target-specific uses of @code{__attribute__}.
+* Emulated TLS:: Emulated TLS support.
+* MIPS Coprocessors:: MIPS coprocessor support and how to customize it.
+* PCH Target:: Validity checking for precompiled headers.
+* C++ ABI:: Controlling C++ ABI changes.
+* Named Address Spaces:: Adding support for named address spaces
+* Misc:: Everything else.
+@end menu
+
+@node Target Structure
+@section The Global @code{targetm} Variable
+@cindex target hooks
+@cindex target functions
+
+@deftypevar {struct gcc_target} targetm
+The target @file{.c} file must define the global @code{targetm} variable
+which contains pointers to functions and data relating to the target
+machine. The variable is declared in @file{target.h};
+@file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is
+used to initialize the variable, and macros for the default initializers
+for elements of the structure. The @file{.c} file should override those
+macros for which the default definition is inappropriate. For example:
+@smallexample
+#include "target.h"
+#include "target-def.h"
+
+/* @r{Initialize the GCC target structure.} */
+
+#undef TARGET_COMP_TYPE_ATTRIBUTES
+#define TARGET_COMP_TYPE_ATTRIBUTES @var{machine}_comp_type_attributes
+
+struct gcc_target targetm = TARGET_INITIALIZER;
+@end smallexample
+@end deftypevar
+
+Where a macro should be defined in the @file{.c} file in this manner to
+form part of the @code{targetm} structure, it is documented below as a
+``Target Hook'' with a prototype. Many macros will change in future
+from being defined in the @file{.h} file to being part of the
+@code{targetm} structure.
+
+@node Driver
+@section Controlling the Compilation Driver, @file{gcc}
+@cindex driver
+@cindex controlling the compilation driver
+
+@c prevent bad page break with this line
+You can control the compilation driver.
+
+@defmac SWITCH_TAKES_ARG (@var{char})
+A C expression which determines whether the option @option{-@var{char}}
+takes arguments. The value should be the number of arguments that
+option takes--zero, for many options.
+
+By default, this macro is defined as
+@code{DEFAULT_SWITCH_TAKES_ARG}, which handles the standard options
+properly. You need not define @code{SWITCH_TAKES_ARG} unless you
+wish to add additional options which take arguments. Any redefinition
+should call @code{DEFAULT_SWITCH_TAKES_ARG} and then check for
+additional options.
+@end defmac
+
+@defmac WORD_SWITCH_TAKES_ARG (@var{name})
+A C expression which determines whether the option @option{-@var{name}}
+takes arguments. The value should be the number of arguments that
+option takes--zero, for many options. This macro rather than
+@code{SWITCH_TAKES_ARG} is used for multi-character option names.
+
+By default, this macro is defined as
+@code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options
+properly. You need not define @code{WORD_SWITCH_TAKES_ARG} unless you
+wish to add additional options which take arguments. Any redefinition
+should call @code{DEFAULT_WORD_SWITCH_TAKES_ARG} and then check for
+additional options.
+@end defmac
+
+@defmac SWITCH_CURTAILS_COMPILATION (@var{char})
+A C expression which determines whether the option @option{-@var{char}}
+stops compilation before the generation of an executable. The value is
+boolean, nonzero if the option does stop an executable from being
+generated, zero otherwise.
+
+By default, this macro is defined as
+@code{DEFAULT_SWITCH_CURTAILS_COMPILATION}, which handles the standard
+options properly. You need not define
+@code{SWITCH_CURTAILS_COMPILATION} unless you wish to add additional
+options which affect the generation of an executable. Any redefinition
+should call @code{DEFAULT_SWITCH_CURTAILS_COMPILATION} and then check
+for additional options.
+@end defmac
+
+@defmac TARGET_OPTION_TRANSLATE_TABLE
+If defined, a list of pairs of strings, the first of which is a
+potential command line target to the @file{gcc} driver program, and the
+second of which is a space-separated (tabs and other whitespace are not
+supported) list of options with which to replace the first option. The
+target defining this list is responsible for assuring that the results
+are valid. Replacement options may not be the @code{--opt} style, they
+must be the @code{-opt} style. It is the intention of this macro to
+provide a mechanism for substitution that affects the multilibs chosen,
+such as one option that enables many options, some of which select
+multilibs. Example nonsensical definition, where @option{-malt-abi},
+@option{-EB}, and @option{-mspoo} cause different multilibs to be chosen:
+
+@smallexample
+#define TARGET_OPTION_TRANSLATE_TABLE \
+@{ "-fast", "-march=fast-foo -malt-abi -I/usr/fast-foo" @}, \
+@{ "-compat", "-EB -malign=4 -mspoo" @}
+@end smallexample
+@end defmac
+
+@defmac DRIVER_SELF_SPECS
+A list of specs for the driver itself. It should be a suitable
+initializer for an array of strings, with no surrounding braces.
+
+The driver applies these specs to its own command line between loading
+default @file{specs} files (but not command-line specified ones) and
+choosing the multilib directory or running any subcommands. It
+applies them in the order given, so each spec can depend on the
+options added by earlier ones. It is also possible to remove options
+using @samp{%<@var{option}} in the usual way.
+
+This macro can be useful when a port has several interdependent target
+options. It provides a way of standardizing the command line so
+that the other specs are easier to write.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac OPTION_DEFAULT_SPECS
+A list of specs used to support configure-time default options (i.e.@:
+@option{--with} options) in the driver. It should be a suitable initializer
+for an array of structures, each containing two strings, without the
+outermost pair of surrounding braces.
+
+The first item in the pair is the name of the default. This must match
+the code in @file{config.gcc} for the target. The second item is a spec
+to apply if a default with this name was specified. The string
+@samp{%(VALUE)} in the spec will be replaced by the value of the default
+everywhere it occurs.
+
+The driver will apply these specs to its own command line between loading
+default @file{specs} files and processing @code{DRIVER_SELF_SPECS}, using
+the same mechanism as @code{DRIVER_SELF_SPECS}.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac CPP_SPEC
+A C string constant that tells the GCC driver program options to
+pass to CPP@. It can also specify how to translate options you
+give to GCC into options for GCC to pass to the CPP@.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac CPLUSPLUS_CPP_SPEC
+This macro is just like @code{CPP_SPEC}, but is used for C++, rather
+than C@. If you do not define this macro, then the value of
+@code{CPP_SPEC} (if any) will be used instead.
+@end defmac
+
+@defmac CC1_SPEC
+A C string constant that tells the GCC driver program options to
+pass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other language
+front ends.
+It can also specify how to translate options you give to GCC into options
+for GCC to pass to front ends.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac CC1PLUS_SPEC
+A C string constant that tells the GCC driver program options to
+pass to @code{cc1plus}. It can also specify how to translate options you
+give to GCC into options for GCC to pass to the @code{cc1plus}.
+
+Do not define this macro if it does not need to do anything.
+Note that everything defined in CC1_SPEC is already passed to
+@code{cc1plus} so there is no need to duplicate the contents of
+CC1_SPEC in CC1PLUS_SPEC@.
+@end defmac
+
+@defmac ASM_SPEC
+A C string constant that tells the GCC driver program options to
+pass to the assembler. It can also specify how to translate options
+you give to GCC into options for GCC to pass to the assembler.
+See the file @file{sun3.h} for an example of this.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac ASM_FINAL_SPEC
+A C string constant that tells the GCC driver program how to
+run any programs which cleanup after the normal assembler.
+Normally, this is not needed. See the file @file{mips.h} for
+an example of this.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac AS_NEEDS_DASH_FOR_PIPED_INPUT
+Define this macro, with no value, if the driver should give the assembler
+an argument consisting of a single dash, @option{-}, to instruct it to
+read from its standard input (which will be a pipe connected to the
+output of the compiler proper). This argument is given after any
+@option{-o} option specifying the name of the output file.
+
+If you do not define this macro, the assembler is assumed to read its
+standard input if given no non-option arguments. If your assembler
+cannot read standard input at all, use a @samp{%@{pipe:%e@}} construct;
+see @file{mips.h} for instance.
+@end defmac
+
+@defmac LINK_SPEC
+A C string constant that tells the GCC driver program options to
+pass to the linker. It can also specify how to translate options you
+give to GCC into options for GCC to pass to the linker.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac LIB_SPEC
+Another C string constant used much like @code{LINK_SPEC}. The difference
+between the two is that @code{LIB_SPEC} is used at the end of the
+command given to the linker.
+
+If this macro is not defined, a default is provided that
+loads the standard C library from the usual place. See @file{gcc.c}.
+@end defmac
+
+@defmac LIBGCC_SPEC
+Another C string constant that tells the GCC driver program
+how and when to place a reference to @file{libgcc.a} into the
+linker command line. This constant is placed both before and after
+the value of @code{LIB_SPEC}.
+
+If this macro is not defined, the GCC driver provides a default that
+passes the string @option{-lgcc} to the linker.
+@end defmac
+
+@defmac REAL_LIBGCC_SPEC
+By default, if @code{ENABLE_SHARED_LIBGCC} is defined, the
+@code{LIBGCC_SPEC} is not directly used by the driver program but is
+instead modified to refer to different versions of @file{libgcc.a}
+depending on the values of the command line flags @option{-static},
+@option{-shared}, @option{-static-libgcc}, and @option{-shared-libgcc}. On
+targets where these modifications are inappropriate, define
+@code{REAL_LIBGCC_SPEC} instead. @code{REAL_LIBGCC_SPEC} tells the
+driver how to place a reference to @file{libgcc} on the link command
+line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified.
+@end defmac
+
+@defmac USE_LD_AS_NEEDED
+A macro that controls the modifications to @code{LIBGCC_SPEC}
+mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will be
+generated that uses --as-needed and the shared libgcc in place of the
+static exception handler library, when linking without any of
+@code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}.
+@end defmac
+
+@defmac LINK_EH_SPEC
+If defined, this C string constant is added to @code{LINK_SPEC}.
+When @code{USE_LD_AS_NEEDED} is zero or undefined, it also affects
+the modifications to @code{LIBGCC_SPEC} mentioned in
+@code{REAL_LIBGCC_SPEC}.
+@end defmac
+
+@defmac STARTFILE_SPEC
+Another C string constant used much like @code{LINK_SPEC}. The
+difference between the two is that @code{STARTFILE_SPEC} is used at
+the very beginning of the command given to the linker.
+
+If this macro is not defined, a default is provided that loads the
+standard C startup file from the usual place. See @file{gcc.c}.
+@end defmac
+
+@defmac ENDFILE_SPEC
+Another C string constant used much like @code{LINK_SPEC}. The
+difference between the two is that @code{ENDFILE_SPEC} is used at
+the very end of the command given to the linker.
+
+Do not define this macro if it does not need to do anything.
+@end defmac
+
+@defmac THREAD_MODEL_SPEC
+GCC @code{-v} will print the thread model GCC was configured to use.
+However, this doesn't work on platforms that are multilibbed on thread
+models, such as AIX 4.3. On such platforms, define
+@code{THREAD_MODEL_SPEC} such that it evaluates to a string without
+blanks that names one of the recognized thread models. @code{%*}, the
+default value of this macro, will expand to the value of
+@code{thread_file} set in @file{config.gcc}.
+@end defmac
+
+@defmac SYSROOT_SUFFIX_SPEC
+Define this macro to add a suffix to the target sysroot when GCC is
+configured with a sysroot. This will cause GCC to search for usr/lib,
+et al, within sysroot+suffix.
+@end defmac
+
+@defmac SYSROOT_HEADERS_SUFFIX_SPEC
+Define this macro to add a headers_suffix to the target sysroot when
+GCC is configured with a sysroot. This will cause GCC to pass the
+updated sysroot+headers_suffix to CPP, causing it to search for
+usr/include, et al, within sysroot+headers_suffix.
+@end defmac
+
+@defmac EXTRA_SPECS
+Define this macro to provide additional specifications to put in the
+@file{specs} file that can be used in various specifications like
+@code{CC1_SPEC}.
+
+The definition should be an initializer for an array of structures,
+containing a string constant, that defines the specification name, and a
+string constant that provides the specification.
+
+Do not define this macro if it does not need to do anything.
+
+@code{EXTRA_SPECS} is useful when an architecture contains several
+related targets, which have various @code{@dots{}_SPECS} which are similar
+to each other, and the maintainer would like one central place to keep
+these definitions.
+
+For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to
+define either @code{_CALL_SYSV} when the System V calling sequence is
+used or @code{_CALL_AIX} when the older AIX-based calling sequence is
+used.
+
+The @file{config/rs6000/rs6000.h} target file defines:
+
+@smallexample
+#define EXTRA_SPECS \
+ @{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},
+
+#define CPP_SYS_DEFAULT ""
+@end smallexample
+
+The @file{config/rs6000/sysv.h} target file defines:
+@smallexample
+#undef CPP_SPEC
+#define CPP_SPEC \
+"%@{posix: -D_POSIX_SOURCE @} \
+%@{mcall-sysv: -D_CALL_SYSV @} \
+%@{!mcall-sysv: %(cpp_sysv_default) @} \
+%@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}"
+
+#undef CPP_SYSV_DEFAULT
+#define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
+@end smallexample
+
+while the @file{config/rs6000/eabiaix.h} target file defines
+@code{CPP_SYSV_DEFAULT} as:
+
+@smallexample
+#undef CPP_SYSV_DEFAULT
+#define CPP_SYSV_DEFAULT "-D_CALL_AIX"
+@end smallexample
+@end defmac
+
+@defmac LINK_LIBGCC_SPECIAL_1
+Define this macro if the driver program should find the library
+@file{libgcc.a}. If you do not define this macro, the driver program will pass
+the argument @option{-lgcc} to tell the linker to do the search.
+@end defmac
+
+@defmac LINK_GCC_C_SEQUENCE_SPEC
+The sequence in which libgcc and libc are specified to the linker.
+By default this is @code{%G %L %G}.
+@end defmac
+
+@defmac LINK_COMMAND_SPEC
+A C string constant giving the complete command line need to execute the
+linker. When you do this, you will need to update your port each time a
+change is made to the link command line within @file{gcc.c}. Therefore,
+define this macro only if you need to completely redefine the command
+line for invoking the linker and there is no other way to accomplish
+the effect you need. Overriding this macro may be avoidable by overriding
+@code{LINK_GCC_C_SEQUENCE_SPEC} instead.
+@end defmac
+
+@defmac LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
+A nonzero value causes @command{collect2} to remove duplicate @option{-L@var{directory}} search
+directories from linking commands. Do not give it a nonzero value if
+removing duplicate search directories changes the linker's semantics.
+@end defmac
+
+@defmac MULTILIB_DEFAULTS
+Define this macro as a C expression for the initializer of an array of
+string to tell the driver program which options are defaults for this
+target and thus do not need to be handled specially when using
+@code{MULTILIB_OPTIONS}.
+
+Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in
+the target makefile fragment or if none of the options listed in
+@code{MULTILIB_OPTIONS} are set by default.
+@xref{Target Fragment}.
+@end defmac
+
+@defmac RELATIVE_PREFIX_NOT_LINKDIR
+Define this macro to tell @command{gcc} that it should only translate
+a @option{-B} prefix into a @option{-L} linker option if the prefix
+indicates an absolute file name.
+@end defmac
+
+@defmac MD_EXEC_PREFIX
+If defined, this macro is an additional prefix to try after
+@code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searched
+when the compiler is built as a cross
+compiler. If you define @code{MD_EXEC_PREFIX}, then be sure to add it
+to the list of directories used to find the assembler in @file{configure.in}.
+@end defmac
+
+@defmac STANDARD_STARTFILE_PREFIX
+Define this macro as a C string constant if you wish to override the
+standard choice of @code{libdir} as the default prefix to
+try when searching for startup files such as @file{crt0.o}.
+@code{STANDARD_STARTFILE_PREFIX} is not searched when the compiler
+is built as a cross compiler.
+@end defmac
+
+@defmac STANDARD_STARTFILE_PREFIX_1
+Define this macro as a C string constant if you wish to override the
+standard choice of @code{/lib} as a prefix to try after the default prefix
+when searching for startup files such as @file{crt0.o}.
+@code{STANDARD_STARTFILE_PREFIX_1} is not searched when the compiler
+is built as a cross compiler.
+@end defmac
+
+@defmac STANDARD_STARTFILE_PREFIX_2
+Define this macro as a C string constant if you wish to override the
+standard choice of @code{/lib} as yet another prefix to try after the
+default prefix when searching for startup files such as @file{crt0.o}.
+@code{STANDARD_STARTFILE_PREFIX_2} is not searched when the compiler
+is built as a cross compiler.
+@end defmac
+
+@defmac MD_STARTFILE_PREFIX
+If defined, this macro supplies an additional prefix to try after the
+standard prefixes. @code{MD_EXEC_PREFIX} is not searched when the
+compiler is built as a cross compiler.
+@end defmac
+
+@defmac MD_STARTFILE_PREFIX_1
+If defined, this macro supplies yet another prefix to try after the
+standard prefixes. It is not searched when the compiler is built as a
+cross compiler.
+@end defmac
+
+@defmac INIT_ENVIRONMENT
+Define this macro as a C string constant if you wish to set environment
+variables for programs called by the driver, such as the assembler and
+loader. The driver passes the value of this macro to @code{putenv} to
+initialize the necessary environment variables.
+@end defmac
+
+@defmac LOCAL_INCLUDE_DIR
+Define this macro as a C string constant if you wish to override the
+standard choice of @file{/usr/local/include} as the default prefix to
+try when searching for local header files. @code{LOCAL_INCLUDE_DIR}
+comes before @code{SYSTEM_INCLUDE_DIR} in the search order.
+
+Cross compilers do not search either @file{/usr/local/include} or its
+replacement.
+@end defmac
+
+@defmac SYSTEM_INCLUDE_DIR
+Define this macro as a C string constant if you wish to specify a
+system-specific directory to search for header files before the standard
+directory. @code{SYSTEM_INCLUDE_DIR} comes before
+@code{STANDARD_INCLUDE_DIR} in the search order.
+
+Cross compilers do not use this macro and do not search the directory
+specified.
+@end defmac
+
+@defmac STANDARD_INCLUDE_DIR
+Define this macro as a C string constant if you wish to override the
+standard choice of @file{/usr/include} as the default prefix to
+try when searching for header files.
+
+Cross compilers ignore this macro and do not search either
+@file{/usr/include} or its replacement.
+@end defmac
+
+@defmac STANDARD_INCLUDE_COMPONENT
+The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}.
+See @code{INCLUDE_DEFAULTS}, below, for the description of components.
+If you do not define this macro, no component is used.
+@end defmac
+
+@defmac INCLUDE_DEFAULTS
+Define this macro if you wish to override the entire default search path
+for include files. For a native compiler, the default search path
+usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR},
+@code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and
+@code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR}
+and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile},
+and specify private search areas for GCC@. The directory
+@code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs.
+
+The definition should be an initializer for an array of structures.
+Each array element should have four elements: the directory name (a
+string constant), the component name (also a string constant), a flag
+for C++-only directories,
+and a flag showing that the includes in the directory don't need to be
+wrapped in @code{extern @samp{C}} when compiling C++. Mark the end of
+the array with a null element.
+
+The component name denotes what GNU package the include file is part of,
+if any, in all uppercase letters. For example, it might be @samp{GCC}
+or @samp{BINUTILS}. If the package is part of a vendor-supplied
+operating system, code the component name as @samp{0}.
+
+For example, here is the definition used for VAX/VMS:
+
+@smallexample
+#define INCLUDE_DEFAULTS \
+@{ \
+ @{ "GNU_GXX_INCLUDE:", "G++", 1, 1@}, \
+ @{ "GNU_CC_INCLUDE:", "GCC", 0, 0@}, \
+ @{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0@}, \
+ @{ ".", 0, 0, 0@}, \
+ @{ 0, 0, 0, 0@} \
+@}
+@end smallexample
+@end defmac
+
+Here is the order of prefixes tried for exec files:
+
+@enumerate
+@item
+Any prefixes specified by the user with @option{-B}.
+
+@item
+The environment variable @code{GCC_EXEC_PREFIX} or, if @code{GCC_EXEC_PREFIX}
+is not set and the compiler has not been installed in the configure-time
+@var{prefix}, the location in which the compiler has actually been installed.
+
+@item
+The directories specified by the environment variable @code{COMPILER_PATH}.
+
+@item
+The macro @code{STANDARD_EXEC_PREFIX}, if the compiler has been installed
+in the configured-time @var{prefix}.
+
+@item
+The location @file{/usr/libexec/gcc/}, but only if this is a native compiler.
+
+@item
+The location @file{/usr/lib/gcc/}, but only if this is a native compiler.
+
+@item
+The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native
+compiler.
+@end enumerate
+
+Here is the order of prefixes tried for startfiles:
+
+@enumerate
+@item
+Any prefixes specified by the user with @option{-B}.
+
+@item
+The environment variable @code{GCC_EXEC_PREFIX} or its automatically determined
+value based on the installed toolchain location.
+
+@item
+The directories specified by the environment variable @code{LIBRARY_PATH}
+(or port-specific name; native only, cross compilers do not use this).
+
+@item
+The macro @code{STANDARD_EXEC_PREFIX}, but only if the toolchain is installed
+in the configured @var{prefix} or this is a native compiler.
+
+@item
+The location @file{/usr/lib/gcc/}, but only if this is a native compiler.
+
+@item
+The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native
+compiler.
+
+@item
+The macro @code{MD_STARTFILE_PREFIX}, if defined, but only if this is a
+native compiler, or we have a target system root.
+
+@item
+The macro @code{MD_STARTFILE_PREFIX_1}, if defined, but only if this is a
+native compiler, or we have a target system root.
+
+@item
+The macro @code{STANDARD_STARTFILE_PREFIX}, with any sysroot modifications.
+If this path is relative it will be prefixed by @code{GCC_EXEC_PREFIX} and
+the machine suffix or @code{STANDARD_EXEC_PREFIX} and the machine suffix.
+
+@item
+The macro @code{STANDARD_STARTFILE_PREFIX_1}, but only if this is a native
+compiler, or we have a target system root. The default for this macro is
+@file{/lib/}.
+
+@item
+The macro @code{STANDARD_STARTFILE_PREFIX_2}, but only if this is a native
+compiler, or we have a target system root. The default for this macro is
+@file{/usr/lib/}.
+@end enumerate
+
+@node Run-time Target
+@section Run-time Target Specification
+@cindex run-time target specification
+@cindex predefined macros
+@cindex target specifications
+
+@c prevent bad page break with this line
+Here are run-time target specifications.
+
+@defmac TARGET_CPU_CPP_BUILTINS ()
+This function-like macro expands to a block of code that defines
+built-in preprocessor macros and assertions for the target CPU, using
+the functions @code{builtin_define}, @code{builtin_define_std} and
+@code{builtin_assert}. When the front end
+calls this macro it provides a trailing semicolon, and since it has
+finished command line option processing your code can use those
+results freely.
+
+@code{builtin_assert} takes a string in the form you pass to the
+command-line option @option{-A}, such as @code{cpu=mips}, and creates
+the assertion. @code{builtin_define} takes a string in the form
+accepted by option @option{-D} and unconditionally defines the macro.
+
+@code{builtin_define_std} takes a string representing the name of an
+object-like macro. If it doesn't lie in the user's namespace,
+@code{builtin_define_std} defines it unconditionally. Otherwise, it
+defines a version with two leading underscores, and another version
+with two leading and trailing underscores, and defines the original
+only if an ISO standard was not requested on the command line. For
+example, passing @code{unix} defines @code{__unix}, @code{__unix__}
+and possibly @code{unix}; passing @code{_mips} defines @code{__mips},
+@code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64}
+defines only @code{_ABI64}.
+
+You can also test for the C dialect being compiled. The variable
+@code{c_language} is set to one of @code{clk_c}, @code{clk_cplusplus}
+or @code{clk_objective_c}. Note that if we are preprocessing
+assembler, this variable will be @code{clk_c} but the function-like
+macro @code{preprocessing_asm_p()} will return true, so you might want
+to check for that first. If you need to check for strict ANSI, the
+variable @code{flag_iso} can be used. The function-like macro
+@code{preprocessing_trad_p()} can be used to check for traditional
+preprocessing.
+@end defmac
+
+@defmac TARGET_OS_CPP_BUILTINS ()
+Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
+and is used for the target operating system instead.
+@end defmac
+
+@defmac TARGET_OBJFMT_CPP_BUILTINS ()
+Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
+and is used for the target object format. @file{elfos.h} uses this
+macro to define @code{__ELF__}, so you probably do not need to define
+it yourself.
+@end defmac
+
+@deftypevar {extern int} target_flags
+This variable is declared in @file{options.h}, which is included before
+any target-specific headers.
+@end deftypevar
+
+@hook TARGET_DEFAULT_TARGET_FLAGS
+This variable specifies the initial value of @code{target_flags}.
+Its default setting is 0.
+@end deftypevr
+
+@cindex optional hardware or system features
+@cindex features, optional, in system conventions
+
+@hook TARGET_HANDLE_OPTION
+This hook is called whenever the user specifies one of the
+target-specific options described by the @file{.opt} definition files
+(@pxref{Options}). It has the opportunity to do some option-specific
+processing and should return true if the option is valid. The default
+definition does nothing but return true.
+
+@var{code} specifies the @code{OPT_@var{name}} enumeration value
+associated with the selected option; @var{name} is just a rendering of
+the option name in which non-alphanumeric characters are replaced by
+underscores. @var{arg} specifies the string argument and is null if
+no argument was given. If the option is flagged as a @code{UInteger}
+(@pxref{Option properties}), @var{value} is the numeric value of the
+argument. Otherwise @var{value} is 1 if the positive form of the
+option was used and 0 if the ``no-'' form was.
+@end deftypefn
+
+@hook TARGET_HANDLE_C_OPTION
+This target hook is called whenever the user specifies one of the
+target-specific C language family options described by the @file{.opt}
+definition files(@pxref{Options}). It has the opportunity to do some
+option-specific processing and should return true if the option is
+valid. The arguments are like for @code{TARGET_HANDLE_OPTION}. The
+default definition does nothing but return false.
+
+In general, you should use @code{TARGET_HANDLE_OPTION} to handle
+options. However, if processing an option requires routines that are
+only available in the C (and related language) front ends, then you
+should use @code{TARGET_HANDLE_C_OPTION} instead.
+@end deftypefn
+
+@defmac TARGET_VERSION
+This macro is a C statement to print on @code{stderr} a string
+describing the particular machine description choice. Every machine
+description should define @code{TARGET_VERSION}. For example:
+
+@smallexample
+#ifdef MOTOROLA
+#define TARGET_VERSION \
+ fprintf (stderr, " (68k, Motorola syntax)");
+#else
+#define TARGET_VERSION \
+ fprintf (stderr, " (68k, MIT syntax)");
+#endif
+@end smallexample
+@end defmac
+
+@defmac OVERRIDE_OPTIONS
+Sometimes certain combinations of command options do not make sense on
+a particular target machine. You can define a macro
+@code{OVERRIDE_OPTIONS} to take account of this. This macro, if
+defined, is executed once just after all the command options have been
+parsed.
+
+Don't use this macro to turn on various extra optimizations for
+@option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
+
+If you need to do something whenever the optimization level is
+changed via the optimize attribute or pragma, see
+@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}
+
+This macros is obsolete, new ports should use the target hook
+@code{TARGET_OPTION_OVERRIDE} instead.
+@end defmac
+
+@hook TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE
+This target function is similar to the hook @code{TARGET_OPTION_OVERRIDE}
+but is called when the optimize level is changed via an attribute or
+pragma or when it is reset at the end of the code affected by the
+attribute or pragma. It is not called at the beginning of compilation
+when @code{TARGET_OPTION_OVERRIDE} is called so if you want to perform these
+actions then, you should have @code{TARGET_OPTION_OVERRIDE} call
+@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}.
+@end deftypefn
+
+@defmac C_COMMON_OVERRIDE_OPTIONS
+This is similar to @code{OVERRIDE_OPTIONS} but is only used in the C
+language frontends (C, Objective-C, C++, Objective-C++) and so can be
+used to alter option flag variables which only exist in those
+frontends.
+@end defmac
+
+@defmac OPTIMIZATION_OPTIONS (@var{level}, @var{size})
+Some machines may desire to change what optimizations are performed for
+various optimization levels. This macro, if defined, is executed once
+just after the optimization level is determined and before the remainder
+of the command options have been parsed. Values set in this macro are
+used as the default values for the other command line options.
+
+@var{level} is the optimization level specified; 2 if @option{-O2} is
+specified, 1 if @option{-O} is specified, and 0 if neither is specified.
+
+@var{size} is nonzero if @option{-Os} is specified and zero otherwise.
+
+This macro is run once at program startup and when the optimization
+options are changed via @code{#pragma GCC optimize} or by using the
+@code{optimize} attribute.
+
+@strong{Do not examine @code{write_symbols} in
+this macro!} The debugging options are not supposed to alter the
+generated code.
+@end defmac
+
+@hook TARGET_HELP
+This hook is called in response to the user invoking
+@option{--target-help} on the command line. It gives the target a
+chance to display extra information on the target specific command
+line options found in its @file{.opt} file.
+@end deftypefn
+
+@defmac CAN_DEBUG_WITHOUT_FP
+Define this macro if debugging can be performed even without a frame
+pointer. If this macro is defined, GCC will turn on the
+@option{-fomit-frame-pointer} option whenever @option{-O} is specified.
+@end defmac
+
+@node Per-Function Data
+@section Defining data structures for per-function information.
+@cindex per-function data
+@cindex data structures
+
+If the target needs to store information on a per-function basis, GCC
+provides a macro and a couple of variables to allow this. Note, just
+using statics to store the information is a bad idea, since GCC supports
+nested functions, so you can be halfway through encoding one function
+when another one comes along.
+
+GCC defines a data structure called @code{struct function} which
+contains all of the data specific to an individual function. This
+structure contains a field called @code{machine} whose type is
+@code{struct machine_function *}, which can be used by targets to point
+to their own specific data.
+
+If a target needs per-function specific data it should define the type
+@code{struct machine_function} and also the macro @code{INIT_EXPANDERS}.
+This macro should be used to initialize the function pointer
+@code{init_machine_status}. This pointer is explained below.
+
+One typical use of per-function, target specific data is to create an
+RTX to hold the register containing the function's return address. This
+RTX can then be used to implement the @code{__builtin_return_address}
+function, for level 0.
+
+Note---earlier implementations of GCC used a single data area to hold
+all of the per-function information. Thus when processing of a nested
+function began the old per-function data had to be pushed onto a
+stack, and when the processing was finished, it had to be popped off the
+stack. GCC used to provide function pointers called
+@code{save_machine_status} and @code{restore_machine_status} to handle
+the saving and restoring of the target specific information. Since the
+single data area approach is no longer used, these pointers are no
+longer supported.
+
+@defmac INIT_EXPANDERS
+Macro called to initialize any target specific information. This macro
+is called once per function, before generation of any RTL has begun.
+The intention of this macro is to allow the initialization of the
+function pointer @code{init_machine_status}.
+@end defmac
+
+@deftypevar {void (*)(struct function *)} init_machine_status
+If this function pointer is non-@code{NULL} it will be called once per
+function, before function compilation starts, in order to allow the
+target to perform any target specific initialization of the
+@code{struct function} structure. It is intended that this would be
+used to initialize the @code{machine} of that structure.
+
+@code{struct machine_function} structures are expected to be freed by GC@.
+Generally, any memory that they reference must be allocated by using
+GC allocation, including the structure itself.
+@end deftypevar
+
+@node Storage Layout
+@section Storage Layout
+@cindex storage layout
+
+Note that the definitions of the macros in this table which are sizes or
+alignments measured in bits do not need to be constant. They can be C
+expressions that refer to static variables, such as the @code{target_flags}.
+@xref{Run-time Target}.
+
+@defmac BITS_BIG_ENDIAN
+Define this macro to have the value 1 if the most significant bit in a
+byte has the lowest number; otherwise define it to have the value zero.
+This means that bit-field instructions count from the most significant
+bit. If the machine has no bit-field instructions, then this must still
+be defined, but it doesn't matter which value it is defined to. This
+macro need not be a constant.
+
+This macro does not affect the way structure fields are packed into
+bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
+@end defmac
+
+@defmac BYTES_BIG_ENDIAN
+Define this macro to have the value 1 if the most significant byte in a
+word has the lowest number. This macro need not be a constant.
+@end defmac
+
+@defmac WORDS_BIG_ENDIAN
+Define this macro to have the value 1 if, in a multiword object, the
+most significant word has the lowest number. This applies to both
+memory locations and registers; GCC fundamentally assumes that the
+order of words in memory is the same as the order in registers. This
+macro need not be a constant.
+@end defmac
+
+@defmac LIBGCC2_WORDS_BIG_ENDIAN
+Define this macro if @code{WORDS_BIG_ENDIAN} is not constant. This must be a
+constant value with the same meaning as @code{WORDS_BIG_ENDIAN}, which will be
+used only when compiling @file{libgcc2.c}. Typically the value will be set
+based on preprocessor defines.
+@end defmac
+
+@defmac FLOAT_WORDS_BIG_ENDIAN
+Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or
+@code{TFmode} floating point numbers are stored in memory with the word
+containing the sign bit at the lowest address; otherwise define it to
+have the value 0. This macro need not be a constant.
+
+You need not define this macro if the ordering is the same as for
+multi-word integers.
+@end defmac
+
+@defmac BITS_PER_UNIT
+Define this macro to be the number of bits in an addressable storage
+unit (byte). If you do not define this macro the default is 8.
+@end defmac
+
+@defmac BITS_PER_WORD
+Number of bits in a word. If you do not define this macro, the default
+is @code{BITS_PER_UNIT * UNITS_PER_WORD}.
+@end defmac
+
+@defmac MAX_BITS_PER_WORD
+Maximum number of bits in a word. If this is undefined, the default is
+@code{BITS_PER_WORD}. Otherwise, it is the constant value that is the
+largest value that @code{BITS_PER_WORD} can have at run-time.
+@end defmac
+
+@defmac UNITS_PER_WORD
+Number of storage units in a word; normally the size of a general-purpose
+register, a power of two from 1 or 8.
+@end defmac
+
+@defmac MIN_UNITS_PER_WORD
+Minimum number of units in a word. If this is undefined, the default is
+@code{UNITS_PER_WORD}. Otherwise, it is the constant value that is the
+smallest value that @code{UNITS_PER_WORD} can have at run-time.
+@end defmac
+
+@defmac UNITS_PER_SIMD_WORD (@var{mode})
+Number of units in the vectors that the vectorizer can produce for
+scalar mode @var{mode}. The default is equal to @code{UNITS_PER_WORD},
+because the vectorizer can do some transformations even in absence of
+specialized @acronym{SIMD} hardware.
+@end defmac
+
+@defmac POINTER_SIZE
+Width of a pointer, in bits. You must specify a value no wider than the
+width of @code{Pmode}. If it is not equal to the width of @code{Pmode},
+you must define @code{POINTERS_EXTEND_UNSIGNED}. If you do not specify
+a value the default is @code{BITS_PER_WORD}.
+@end defmac
+
+@defmac POINTERS_EXTEND_UNSIGNED
+A C expression that determines how pointers should be extended from
+@code{ptr_mode} to either @code{Pmode} or @code{word_mode}. It is
+greater than zero if pointers should be zero-extended, zero if they
+should be sign-extended, and negative if some other sort of conversion
+is needed. In the last case, the extension is done by the target's
+@code{ptr_extend} instruction.
+
+You need not define this macro if the @code{ptr_mode}, @code{Pmode}
+and @code{word_mode} are all the same width.
+@end defmac
+
+@defmac PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type})
+A macro to update @var{m} and @var{unsignedp} when an object whose type
+is @var{type} and which has the specified mode and signedness is to be
+stored in a register. This macro is only called when @var{type} is a
+scalar type.
+
+On most RISC machines, which only have operations that operate on a full
+register, define this macro to set @var{m} to @code{word_mode} if
+@var{m} is an integer mode narrower than @code{BITS_PER_WORD}. In most
+cases, only integer modes should be widened because wider-precision
+floating-point operations are usually more expensive than their narrower
+counterparts.
+
+For most machines, the macro definition does not change @var{unsignedp}.
+However, some machines, have instructions that preferentially handle
+either signed or unsigned quantities of certain modes. For example, on
+the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
+sign-extend the result to 64 bits. On such machines, set
+@var{unsignedp} according to which kind of extension is more efficient.
+
+Do not define this macro if it would never modify @var{m}.
+@end defmac
+
+@hook TARGET_PROMOTE_FUNCTION_MODE
+Like @code{PROMOTE_MODE}, but it is applied to outgoing function arguments or
+function return values. The target hook should return the new mode
+and possibly change @code{*@var{punsignedp}} if the promotion should
+change signedness. This function is called only for scalar @emph{or
+pointer} types.
+
+@var{for_return} allows to distinguish the promotion of arguments and
+return values. If it is @code{1}, a return value is being promoted and
+@code{TARGET_FUNCTION_VALUE} must perform the same promotions done here.
+If it is @code{2}, the returned mode should be that of the register in
+which an incoming parameter is copied, or the outgoing result is computed;
+then the hook should return the same mode as @code{promote_mode}, though
+the signedness may be different.
+
+The default is to not promote arguments and return values. You can
+also define the hook to @code{default_promote_function_mode_always_promote}
+if you would like to apply the same rules given by @code{PROMOTE_MODE}.
+@end deftypefn
+
+@defmac PARM_BOUNDARY
+Normal alignment required for function parameters on the stack, in
+bits. All stack parameters receive at least this much alignment
+regardless of data type. On most machines, this is the same as the
+size of an integer.
+@end defmac
+
+@defmac STACK_BOUNDARY
+Define this macro to the minimum alignment enforced by hardware for the
+stack pointer on this machine. The definition is a C expression for the
+desired alignment (measured in bits). This value is used as a default
+if @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines,
+this should be the same as @code{PARM_BOUNDARY}.
+@end defmac
+
+@defmac PREFERRED_STACK_BOUNDARY
+Define this macro if you wish to preserve a certain alignment for the
+stack pointer, greater than what the hardware enforces. The definition
+is a C expression for the desired alignment (measured in bits). This
+macro must evaluate to a value equal to or larger than
+@code{STACK_BOUNDARY}.
+@end defmac
+
+@defmac INCOMING_STACK_BOUNDARY
+Define this macro if the incoming stack boundary may be different
+from @code{PREFERRED_STACK_BOUNDARY}. This macro must evaluate
+to a value equal to or larger than @code{STACK_BOUNDARY}.
+@end defmac
+
+@defmac FUNCTION_BOUNDARY
+Alignment required for a function entry point, in bits.
+@end defmac
+
+@defmac BIGGEST_ALIGNMENT
+Biggest alignment that any data type can require on this machine, in
+bits. Note that this is not the biggest alignment that is supported,
+just the biggest alignment that, when violated, may cause a fault.
+@end defmac
+
+@defmac MALLOC_ABI_ALIGNMENT
+Alignment, in bits, a C conformant malloc implementation has to
+provide. If not defined, the default value is @code{BITS_PER_WORD}.
+@end defmac
+
+@defmac ATTRIBUTE_ALIGNED_VALUE
+Alignment used by the @code{__attribute__ ((aligned))} construct. If
+not defined, the default value is @code{BIGGEST_ALIGNMENT}.
+@end defmac
+
+@defmac MINIMUM_ATOMIC_ALIGNMENT
+If defined, the smallest alignment, in bits, that can be given to an
+object that can be referenced in one operation, without disturbing any
+nearby object. Normally, this is @code{BITS_PER_UNIT}, but may be larger
+on machines that don't have byte or half-word store operations.
+@end defmac
+
+@defmac BIGGEST_FIELD_ALIGNMENT
+Biggest alignment that any structure or union field can require on this
+machine, in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} for
+structure and union fields only, unless the field alignment has been set
+by the @code{__attribute__ ((aligned (@var{n})))} construct.
+@end defmac
+
+@defmac ADJUST_FIELD_ALIGN (@var{field}, @var{computed})
+An expression for the alignment of a structure field @var{field} if the
+alignment computed in the usual way (including applying of
+@code{BIGGEST_ALIGNMENT} and @code{BIGGEST_FIELD_ALIGNMENT} to the
+alignment) is @var{computed}. It overrides alignment only if the
+field alignment has not been set by the
+@code{__attribute__ ((aligned (@var{n})))} construct.
+@end defmac
+
+@defmac MAX_STACK_ALIGNMENT
+Biggest stack alignment guaranteed by the backend. Use this macro
+to specify the maximum alignment of a variable on stack.
+
+If not defined, the default value is @code{STACK_BOUNDARY}.
+
+@c FIXME: The default should be @code{PREFERRED_STACK_BOUNDARY}.
+@c But the fix for PR 32893 indicates that we can only guarantee
+@c maximum stack alignment on stack up to @code{STACK_BOUNDARY}, not
+@c @code{PREFERRED_STACK_BOUNDARY}, if stack alignment isn't supported.
+@end defmac
+
+@defmac MAX_OFILE_ALIGNMENT
+Biggest alignment supported by the object file format of this machine.
+Use this macro to limit the alignment which can be specified using the
+@code{__attribute__ ((aligned (@var{n})))} construct. If not defined,
+the default value is @code{BIGGEST_ALIGNMENT}.
+
+On systems that use ELF, the default (in @file{config/elfos.h}) is
+the largest supported 32-bit ELF section alignment representable on
+a 32-bit host e.g. @samp{(((unsigned HOST_WIDEST_INT) 1 << 28) * 8)}.
+On 32-bit ELF the largest supported section alignment in bits is
+@samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.
+@end defmac
+
+@defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})
+If defined, a C expression to compute the alignment for a variable in
+the static store. @var{type} is the data type, and @var{basic-align} is
+the alignment that the object would ordinarily have. The value of this
+macro is used instead of that alignment to align the object.
+
+If this macro is not defined, then @var{basic-align} is used.
+
+@findex strcpy
+One use of this macro is to increase alignment of medium-size data to
+make it all fit in fewer cache lines. Another is to cause character
+arrays to be word-aligned so that @code{strcpy} calls that copy
+constants to character arrays can be done inline.
+@end defmac
+
+@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})
+If defined, a C expression to compute the alignment given to a constant
+that is being placed in memory. @var{constant} is the constant and
+@var{basic-align} is the alignment that the object would ordinarily
+have. The value of this macro is used instead of that alignment to
+align the object.
+
+If this macro is not defined, then @var{basic-align} is used.
+
+The typical use of this macro is to increase alignment for string
+constants to be word aligned so that @code{strcpy} calls that copy
+constants can be done inline.
+@end defmac
+
+@defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})
+If defined, a C expression to compute the alignment for a variable in
+the local store. @var{type} is the data type, and @var{basic-align} is
+the alignment that the object would ordinarily have. The value of this
+macro is used instead of that alignment to align the object.
+
+If this macro is not defined, then @var{basic-align} is used.
+
+One use of this macro is to increase alignment of medium-size data to
+make it all fit in fewer cache lines.
+@end defmac
+
+@defmac STACK_SLOT_ALIGNMENT (@var{type}, @var{mode}, @var{basic-align})
+If defined, a C expression to compute the alignment for stack slot.
+@var{type} is the data type, @var{mode} is the widest mode available,
+and @var{basic-align} is the alignment that the slot would ordinarily
+have. The value of this macro is used instead of that alignment to
+align the slot.
+
+If this macro is not defined, then @var{basic-align} is used when
+@var{type} is @code{NULL}. Otherwise, @code{LOCAL_ALIGNMENT} will
+be used.
+
+This macro is to set alignment of stack slot to the maximum alignment
+of all possible modes which the slot may have.
+@end defmac
+
+@defmac LOCAL_DECL_ALIGNMENT (@var{decl})
+If defined, a C expression to compute the alignment for a local
+variable @var{decl}.
+
+If this macro is not defined, then
+@code{LOCAL_ALIGNMENT (TREE_TYPE (@var{decl}), DECL_ALIGN (@var{decl}))}
+is used.
+
+One use of this macro is to increase alignment of medium-size data to
+make it all fit in fewer cache lines.
+@end defmac
+
+@defmac MINIMUM_ALIGNMENT (@var{exp}, @var{mode}, @var{align})
+If defined, a C expression to compute the minimum required alignment
+for dynamic stack realignment purposes for @var{exp} (a type or decl),
+@var{mode}, assuming normal alignment @var{align}.
+
+If this macro is not defined, then @var{align} will be used.
+@end defmac
+
+@defmac EMPTY_FIELD_BOUNDARY
+Alignment in bits to be given to a structure bit-field that follows an
+empty field such as @code{int : 0;}.
+
+If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro.
+@end defmac
+
+@defmac STRUCTURE_SIZE_BOUNDARY
+Number of bits which any structure or union's size must be a multiple of.
+Each structure or union's size is rounded up to a multiple of this.
+
+If you do not define this macro, the default is the same as
+@code{BITS_PER_UNIT}.
+@end defmac
+
+@defmac STRICT_ALIGNMENT
+Define this macro to be the value 1 if instructions will fail to work
+if given data not on the nominal alignment. If instructions will merely
+go slower in that case, define this macro as 0.
+@end defmac
+
+@defmac PCC_BITFIELD_TYPE_MATTERS
+Define this if you wish to imitate the way many other C compilers handle
+alignment of bit-fields and the structures that contain them.
+
+The behavior is that the type written for a named bit-field (@code{int},
+@code{short}, or other integer type) imposes an alignment for the entire
+structure, as if the structure really did contain an ordinary field of
+that type. In addition, the bit-field is placed within the structure so
+that it would fit within such a field, not crossing a boundary for it.
+
+Thus, on most machines, a named bit-field whose type is written as
+@code{int} would not cross a four-byte boundary, and would force
+four-byte alignment for the whole structure. (The alignment used may
+not be four bytes; it is controlled by the other alignment parameters.)
+
+An unnamed bit-field will not affect the alignment of the containing
+structure.
+
+If the macro is defined, its definition should be a C expression;
+a nonzero value for the expression enables this behavior.
+
+Note that if this macro is not defined, or its value is zero, some
+bit-fields may cross more than one alignment boundary. The compiler can
+support such references if there are @samp{insv}, @samp{extv}, and
+@samp{extzv} insns that can directly reference memory.
+
+The other known way of making bit-fields work is to define
+@code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}.
+Then every structure can be accessed with fullwords.
+
+Unless the machine has bit-field instructions or you define
+@code{STRUCTURE_SIZE_BOUNDARY} that way, you must define
+@code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value.
+
+If your aim is to make GCC use the same conventions for laying out
+bit-fields as are used by another compiler, here is how to investigate
+what the other compiler does. Compile and run this program:
+
+@smallexample
+struct foo1
+@{
+ char x;
+ char :0;
+ char y;
+@};
+
+struct foo2
+@{
+ char x;
+ int :0;
+ char y;
+@};
+
+main ()
+@{
+ printf ("Size of foo1 is %d\n",
+ sizeof (struct foo1));
+ printf ("Size of foo2 is %d\n",
+ sizeof (struct foo2));
+ exit (0);
+@}
+@end smallexample
+
+If this prints 2 and 5, then the compiler's behavior is what you would
+get from @code{PCC_BITFIELD_TYPE_MATTERS}.
+@end defmac
+
+@defmac BITFIELD_NBYTES_LIMITED
+Like @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limited
+to aligning a bit-field within the structure.
+@end defmac
+
+@hook TARGET_ALIGN_ANON_BITFIELD
+When @code{PCC_BITFIELD_TYPE_MATTERS} is true this hook will determine
+whether unnamed bitfields affect the alignment of the containing
+structure. The hook should return true if the structure should inherit
+the alignment requirements of an unnamed bitfield's type.
+@end deftypefn
+
+@hook TARGET_NARROW_VOLATILE_BITFIELD
+This target hook should return @code{true} if accesses to volatile bitfields
+should use the narrowest mode possible. It should return @code{false} if
+these accesses should use the bitfield container type.
+
+The default is @code{!TARGET_STRICT_ALIGN}.
+@end deftypefn
+
+@defmac MEMBER_TYPE_FORCES_BLK (@var{field}, @var{mode})
+Return 1 if a structure or array containing @var{field} should be accessed using
+@code{BLKMODE}.
+
+If @var{field} is the only field in the structure, @var{mode} is its
+mode, otherwise @var{mode} is VOIDmode. @var{mode} is provided in the
+case where structures of one field would require the structure's mode to
+retain the field's mode.
+
+Normally, this is not needed.
+@end defmac
+
+@defmac ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified})
+Define this macro as an expression for the alignment of a type (given
+by @var{type} as a tree node) if the alignment computed in the usual
+way is @var{computed} and the alignment explicitly specified was
+@var{specified}.
+
+The default is to use @var{specified} if it is larger; otherwise, use
+the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}
+@end defmac
+
+@defmac MAX_FIXED_MODE_SIZE
+An integer expression for the size in bits of the largest integer
+machine mode that should actually be used. All integer machine modes of
+this size or smaller can be used for structures and unions with the
+appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE
+(DImode)} is assumed.
+@end defmac
+
+@defmac STACK_SAVEAREA_MODE (@var{save_level})
+If defined, an expression of type @code{enum machine_mode} that
+specifies the mode of the save area operand of a
+@code{save_stack_@var{level}} named pattern (@pxref{Standard Names}).
+@var{save_level} is one of @code{SAVE_BLOCK}, @code{SAVE_FUNCTION}, or
+@code{SAVE_NONLOCAL} and selects which of the three named patterns is
+having its mode specified.
+
+You need not define this macro if it always returns @code{Pmode}. You
+would most commonly define this macro if the
+@code{save_stack_@var{level}} patterns need to support both a 32- and a
+64-bit mode.
+@end defmac
+
+@defmac STACK_SIZE_MODE
+If defined, an expression of type @code{enum machine_mode} that
+specifies the mode of the size increment operand of an
+@code{allocate_stack} named pattern (@pxref{Standard Names}).
+
+You need not define this macro if it always returns @code{word_mode}.
+You would most commonly define this macro if the @code{allocate_stack}
+pattern needs to support both a 32- and a 64-bit mode.
+@end defmac
+
+@hook TARGET_LIBGCC_CMP_RETURN_MODE
+This target hook should return the mode to be used for the return value
+of compare instructions expanded to libgcc calls. If not defined
+@code{word_mode} is returned which is the right choice for a majority of
+targets.
+@end deftypefn
+
+@hook TARGET_LIBGCC_SHIFT_COUNT_MODE
+This target hook should return the mode to be used for the shift count operand
+of shift instructions expanded to libgcc calls. If not defined
+@code{word_mode} is returned which is the right choice for a majority of
+targets.
+@end deftypefn
+
+@hook TARGET_UNWIND_WORD_MODE
+Return machine mode to be used for @code{_Unwind_Word} type.
+The default is to use @code{word_mode}.
+@end deftypefn
+
+@defmac ROUND_TOWARDS_ZERO
+If defined, this macro should be true if the prevailing rounding
+mode is towards zero.
+
+Defining this macro only affects the way @file{libgcc.a} emulates
+floating-point arithmetic.
+
+Not defining this macro is equivalent to returning zero.
+@end defmac
+
+@defmac LARGEST_EXPONENT_IS_NORMAL (@var{size})
+This macro should return true if floats with @var{size}
+bits do not have a NaN or infinity representation, but use the largest
+exponent for normal numbers instead.
+
+Defining this macro only affects the way @file{libgcc.a} emulates
+floating-point arithmetic.
+
+The default definition of this macro returns false for all sizes.
+@end defmac
+
+@hook TARGET_MS_BITFIELD_LAYOUT_P
+This target hook returns @code{true} if bit-fields in the given
+@var{record_type} are to be laid out following the rules of Microsoft
+Visual C/C++, namely: (i) a bit-field won't share the same storage
+unit with the previous bit-field if their underlying types have
+different sizes, and the bit-field will be aligned to the highest
+alignment of the underlying types of itself and of the previous
+bit-field; (ii) a zero-sized bit-field will affect the alignment of
+the whole enclosing structure, even if it is unnamed; except that
+(iii) a zero-sized bit-field will be disregarded unless it follows
+another bit-field of nonzero size. If this hook returns @code{true},
+other macros that control bit-field layout are ignored.
+
+When a bit-field is inserted into a packed record, the whole size
+of the underlying type is used by one or more same-size adjacent
+bit-fields (that is, if its long:3, 32 bits is used in the record,
+and any additional adjacent long bit-fields are packed into the same
+chunk of 32 bits. However, if the size changes, a new field of that
+size is allocated). In an unpacked record, this is the same as using
+alignment, but not equivalent when packing.
+
+If both MS bit-fields and @samp{__attribute__((packed))} are used,
+the latter will take precedence. If @samp{__attribute__((packed))} is
+used on a single field when MS bit-fields are in use, it will take
+precedence for that field, but the alignment of the rest of the structure
+may affect its placement.
+@end deftypefn
+
+@hook TARGET_DECIMAL_FLOAT_SUPPORTED_P
+Returns true if the target supports decimal floating point.
+@end deftypefn
+
+@hook TARGET_FIXED_POINT_SUPPORTED_P
+Returns true if the target supports fixed-point arithmetic.
+@end deftypefn
+
+@hook TARGET_EXPAND_TO_RTL_HOOK
+This hook is called just before expansion into rtl, allowing the target
+to perform additional initializations or analysis before the expansion.
+For example, the rs6000 port uses it to allocate a scratch stack slot
+for use in copying SDmode values between memory and floating point
+registers whenever the function being expanded has any SDmode
+usage.
+@end deftypefn
+
+@hook TARGET_INSTANTIATE_DECLS
+This hook allows the backend to perform additional instantiations on rtl
+that are not actually in any insns yet, but will be later.
+@end deftypefn
+
+@hook TARGET_MANGLE_TYPE
+If your target defines any fundamental types, or any types your target
+uses should be mangled differently from the default, define this hook
+to return the appropriate encoding for these types as part of a C++
+mangled name. The @var{type} argument is the tree structure representing
+the type to be mangled. The hook may be applied to trees which are
+not target-specific fundamental types; it should return @code{NULL}
+for all such types, as well as arguments it does not recognize. If the
+return value is not @code{NULL}, it must point to a statically-allocated
+string constant.
+
+Target-specific fundamental types might be new fundamental types or
+qualified versions of ordinary fundamental types. Encode new
+fundamental types as @samp{@w{u @var{n} @var{name}}}, where @var{name}
+is the name used for the type in source code, and @var{n} is the
+length of @var{name} in decimal. Encode qualified versions of
+ordinary types as @samp{@w{U @var{n} @var{name} @var{code}}}, where
+@var{name} is the name used for the type qualifier in source code,
+@var{n} is the length of @var{name} as above, and @var{code} is the
+code used to represent the unqualified version of this type. (See
+@code{write_builtin_type} in @file{cp/mangle.c} for the list of
+codes.) In both cases the spaces are for clarity; do not include any
+spaces in your string.
+
+This hook is applied to types prior to typedef resolution. If the mangled
+name for a particular type depends only on that type's main variant, you
+can perform typedef resolution yourself using @code{TYPE_MAIN_VARIANT}
+before mangling.
+
+The default version of this hook always returns @code{NULL}, which is
+appropriate for a target that does not define any new fundamental
+types.
+@end deftypefn
+
+@node Type Layout
+@section Layout of Source Language Data Types
+
+These macros define the sizes and other characteristics of the standard
+basic data types used in programs being compiled. Unlike the macros in
+the previous section, these apply to specific features of C and related
+languages, rather than to fundamental aspects of storage layout.
+
+@defmac INT_TYPE_SIZE
+A C expression for the size in bits of the type @code{int} on the
+target machine. If you don't define this, the default is one word.
+@end defmac
+
+@defmac SHORT_TYPE_SIZE
+A C expression for the size in bits of the type @code{short} on the
+target machine. If you don't define this, the default is half a word.
+(If this would be less than one storage unit, it is rounded up to one
+unit.)
+@end defmac
+
+@defmac LONG_TYPE_SIZE
+A C expression for the size in bits of the type @code{long} on the
+target machine. If you don't define this, the default is one word.
+@end defmac
+
+@defmac ADA_LONG_TYPE_SIZE
+On some machines, the size used for the Ada equivalent of the type
+@code{long} by a native Ada compiler differs from that used by C@. In
+that situation, define this macro to be a C expression to be used for
+the size of that type. If you don't define this, the default is the
+value of @code{LONG_TYPE_SIZE}.
+@end defmac
+
+@defmac LONG_LONG_TYPE_SIZE
+A C expression for the size in bits of the type @code{long long} on the
+target machine. If you don't define this, the default is two
+words. If you want to support GNU Ada on your machine, the value of this
+macro must be at least 64.
+@end defmac
+
+@defmac CHAR_TYPE_SIZE
+A C expression for the size in bits of the type @code{char} on the
+target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT}.
+@end defmac
+
+@defmac BOOL_TYPE_SIZE
+A C expression for the size in bits of the C++ type @code{bool} and
+C99 type @code{_Bool} on the target machine. If you don't define
+this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
+@end defmac
+
+@defmac FLOAT_TYPE_SIZE
+A C expression for the size in bits of the type @code{float} on the
+target machine. If you don't define this, the default is one word.
+@end defmac
+
+@defmac DOUBLE_TYPE_SIZE
+A C expression for the size in bits of the type @code{double} on the
+target machine. If you don't define this, the default is two
+words.
+@end defmac
+
+@defmac LONG_DOUBLE_TYPE_SIZE
+A C expression for the size in bits of the type @code{long double} on
+the target machine. If you don't define this, the default is two
+words.
+@end defmac
+
+@defmac SHORT_FRACT_TYPE_SIZE
+A C expression for the size in bits of the type @code{short _Fract} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT}.
+@end defmac
+
+@defmac FRACT_TYPE_SIZE
+A C expression for the size in bits of the type @code{_Fract} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT * 2}.
+@end defmac
+
+@defmac LONG_FRACT_TYPE_SIZE
+A C expression for the size in bits of the type @code{long _Fract} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT * 4}.
+@end defmac
+
+@defmac LONG_LONG_FRACT_TYPE_SIZE
+A C expression for the size in bits of the type @code{long long _Fract} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT * 8}.
+@end defmac
+
+@defmac SHORT_ACCUM_TYPE_SIZE
+A C expression for the size in bits of the type @code{short _Accum} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT * 2}.
+@end defmac
+
+@defmac ACCUM_TYPE_SIZE
+A C expression for the size in bits of the type @code{_Accum} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT * 4}.
+@end defmac
+
+@defmac LONG_ACCUM_TYPE_SIZE
+A C expression for the size in bits of the type @code{long _Accum} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT * 8}.
+@end defmac
+
+@defmac LONG_LONG_ACCUM_TYPE_SIZE
+A C expression for the size in bits of the type @code{long long _Accum} on
+the target machine. If you don't define this, the default is
+@code{BITS_PER_UNIT * 16}.
+@end defmac
+
+@defmac LIBGCC2_LONG_DOUBLE_TYPE_SIZE
+Define this macro if @code{LONG_DOUBLE_TYPE_SIZE} is not constant or
+if you want routines in @file{libgcc2.a} for a size other than
+@code{LONG_DOUBLE_TYPE_SIZE}. If you don't define this, the
+default is @code{LONG_DOUBLE_TYPE_SIZE}.
+@end defmac
+
+@defmac LIBGCC2_HAS_DF_MODE
+Define this macro if neither @code{LIBGCC2_DOUBLE_TYPE_SIZE} nor
+@code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is
+@code{DFmode} but you want @code{DFmode} routines in @file{libgcc2.a}
+anyway. If you don't define this and either @code{LIBGCC2_DOUBLE_TYPE_SIZE}
+or @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64 then the default is 1,
+otherwise it is 0.
+@end defmac
+
+@defmac LIBGCC2_HAS_XF_MODE
+Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not
+@code{XFmode} but you want @code{XFmode} routines in @file{libgcc2.a}
+anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}
+is 80 then the default is 1, otherwise it is 0.
+@end defmac
+
+@defmac LIBGCC2_HAS_TF_MODE
+Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not
+@code{TFmode} but you want @code{TFmode} routines in @file{libgcc2.a}
+anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}
+is 128 then the default is 1, otherwise it is 0.
+@end defmac
+
+@defmac SF_SIZE
+@defmacx DF_SIZE
+@defmacx XF_SIZE
+@defmacx TF_SIZE
+Define these macros to be the size in bits of the mantissa of
+@code{SFmode}, @code{DFmode}, @code{XFmode} and @code{TFmode} values,
+if the defaults in @file{libgcc2.h} are inappropriate. By default,
+@code{FLT_MANT_DIG} is used for @code{SF_SIZE}, @code{LDBL_MANT_DIG}
+for @code{XF_SIZE} and @code{TF_SIZE}, and @code{DBL_MANT_DIG} or
+@code{LDBL_MANT_DIG} for @code{DF_SIZE} according to whether
+@code{LIBGCC2_DOUBLE_TYPE_SIZE} or
+@code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64.
+@end defmac
+
+@defmac TARGET_FLT_EVAL_METHOD
+A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},
+assuming, if applicable, that the floating-point control word is in its
+default state. If you do not define this macro the value of
+@code{FLT_EVAL_METHOD} will be zero.
+@end defmac
+
+@defmac WIDEST_HARDWARE_FP_SIZE
+A C expression for the size in bits of the widest floating-point format
+supported by the hardware. If you define this macro, you must specify a
+value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}.
+If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE}
+is the default.
+@end defmac
+
+@defmac DEFAULT_SIGNED_CHAR
+An expression whose value is 1 or 0, according to whether the type
+@code{char} should be signed or unsigned by default. The user can
+always override this default with the options @option{-fsigned-char}
+and @option{-funsigned-char}.
+@end defmac
+
+@hook TARGET_DEFAULT_SHORT_ENUMS
+This target hook should return true if the compiler should give an
+@code{enum} type only as many bytes as it takes to represent the range
+of possible values of that type. It should return false if all
+@code{enum} types should be allocated like @code{int}.
+
+The default is to return false.
+@end deftypefn
+
+@defmac SIZE_TYPE
+A C expression for a string describing the name of the data type to use
+for size values. The typedef name @code{size_t} is defined using the
+contents of the string.
+
+The string can contain more than one keyword. If so, separate them with
+spaces, and write first any length keyword, then @code{unsigned} if
+appropriate, and finally @code{int}. The string must exactly match one
+of the data type names defined in the function
+@code{init_decl_processing} in the file @file{c-decl.c}. You may not
+omit @code{int} or change the order---that would cause the compiler to
+crash on startup.
+
+If you don't define this macro, the default is @code{"long unsigned
+int"}.
+@end defmac
+
+@defmac PTRDIFF_TYPE
+A C expression for a string describing the name of the data type to use
+for the result of subtracting two pointers. The typedef name
+@code{ptrdiff_t} is defined using the contents of the string. See
+@code{SIZE_TYPE} above for more information.
+
+If you don't define this macro, the default is @code{"long int"}.
+@end defmac
+
+@defmac WCHAR_TYPE
+A C expression for a string describing the name of the data type to use
+for wide characters. The typedef name @code{wchar_t} is defined using
+the contents of the string. See @code{SIZE_TYPE} above for more
+information.
+
+If you don't define this macro, the default is @code{"int"}.
+@end defmac
+
+@defmac WCHAR_TYPE_SIZE
+A C expression for the size in bits of the data type for wide
+characters. This is used in @code{cpp}, which cannot make use of
+@code{WCHAR_TYPE}.
+@end defmac
+
+@defmac WINT_TYPE
+A C expression for a string describing the name of the data type to
+use for wide characters passed to @code{printf} and returned from
+@code{getwc}. The typedef name @code{wint_t} is defined using the
+contents of the string. See @code{SIZE_TYPE} above for more
+information.
+
+If you don't define this macro, the default is @code{"unsigned int"}.
+@end defmac
+
+@defmac INTMAX_TYPE
+A C expression for a string describing the name of the data type that
+can represent any value of any standard or extended signed integer type.
+The typedef name @code{intmax_t} is defined using the contents of the
+string. See @code{SIZE_TYPE} above for more information.
+
+If you don't define this macro, the default is the first of
+@code{"int"}, @code{"long int"}, or @code{"long long int"} that has as
+much precision as @code{long long int}.
+@end defmac
+
+@defmac UINTMAX_TYPE
+A C expression for a string describing the name of the data type that
+can represent any value of any standard or extended unsigned integer
+type. The typedef name @code{uintmax_t} is defined using the contents
+of the string. See @code{SIZE_TYPE} above for more information.
+
+If you don't define this macro, the default is the first of
+@code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long
+unsigned int"} that has as much precision as @code{long long unsigned
+int}.
+@end defmac
+
+@defmac SIG_ATOMIC_TYPE
+@defmacx INT8_TYPE
+@defmacx INT16_TYPE
+@defmacx INT32_TYPE
+@defmacx INT64_TYPE
+@defmacx UINT8_TYPE
+@defmacx UINT16_TYPE
+@defmacx UINT32_TYPE
+@defmacx UINT64_TYPE
+@defmacx INT_LEAST8_TYPE
+@defmacx INT_LEAST16_TYPE
+@defmacx INT_LEAST32_TYPE
+@defmacx INT_LEAST64_TYPE
+@defmacx UINT_LEAST8_TYPE
+@defmacx UINT_LEAST16_TYPE
+@defmacx UINT_LEAST32_TYPE
+@defmacx UINT_LEAST64_TYPE
+@defmacx INT_FAST8_TYPE
+@defmacx INT_FAST16_TYPE
+@defmacx INT_FAST32_TYPE
+@defmacx INT_FAST64_TYPE
+@defmacx UINT_FAST8_TYPE
+@defmacx UINT_FAST16_TYPE
+@defmacx UINT_FAST32_TYPE
+@defmacx UINT_FAST64_TYPE
+@defmacx INTPTR_TYPE
+@defmacx UINTPTR_TYPE
+C expressions for the standard types @code{sig_atomic_t},
+@code{int8_t}, @code{int16_t}, @code{int32_t}, @code{int64_t},
+@code{uint8_t}, @code{uint16_t}, @code{uint32_t}, @code{uint64_t},
+@code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t},
+@code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t},
+@code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t},
+@code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t},
+@code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t},
+@code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t}. See
+@code{SIZE_TYPE} above for more information.
+
+If any of these macros evaluates to a null pointer, the corresponding
+type is not supported; if GCC is configured to provide
+@code{<stdint.h>} in such a case, the header provided may not conform
+to C99, depending on the type in question. The defaults for all of
+these macros are null pointers.
+@end defmac
+
+@defmac TARGET_PTRMEMFUNC_VBIT_LOCATION
+The C++ compiler represents a pointer-to-member-function with a struct
+that looks like:
+
+@smallexample
+ struct @{
+ union @{
+ void (*fn)();
+ ptrdiff_t vtable_index;
+ @};
+ ptrdiff_t delta;
+ @};
+@end smallexample
+
+@noindent
+The C++ compiler must use one bit to indicate whether the function that
+will be called through a pointer-to-member-function is virtual.
+Normally, we assume that the low-order bit of a function pointer must
+always be zero. Then, by ensuring that the vtable_index is odd, we can
+distinguish which variant of the union is in use. But, on some
+platforms function pointers can be odd, and so this doesn't work. In
+that case, we use the low-order bit of the @code{delta} field, and shift
+the remainder of the @code{delta} field to the left.
+
+GCC will automatically make the right selection about where to store
+this bit using the @code{FUNCTION_BOUNDARY} setting for your platform.
+However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY}
+set such that functions always start at even addresses, but the lowest
+bit of pointers to functions indicate whether the function at that
+address is in ARM or Thumb mode. If this is the case of your
+architecture, you should define this macro to
+@code{ptrmemfunc_vbit_in_delta}.
+
+In general, you should not have to define this macro. On architectures
+in which function addresses are always even, according to
+@code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to
+@code{ptrmemfunc_vbit_in_pfn}.
+@end defmac
+
+@defmac TARGET_VTABLE_USES_DESCRIPTORS
+Normally, the C++ compiler uses function pointers in vtables. This
+macro allows the target to change to use ``function descriptors''
+instead. Function descriptors are found on targets for whom a
+function pointer is actually a small data structure. Normally the
+data structure consists of the actual code address plus a data
+pointer to which the function's data is relative.
+
+If vtables are used, the value of this macro should be the number
+of words that the function descriptor occupies.
+@end defmac
+
+@defmac TARGET_VTABLE_ENTRY_ALIGN
+By default, the vtable entries are void pointers, the so the alignment
+is the same as pointer alignment. The value of this macro specifies
+the alignment of the vtable entry in bits. It should be defined only
+when special alignment is necessary. */
+@end defmac
+
+@defmac TARGET_VTABLE_DATA_ENTRY_DISTANCE
+There are a few non-descriptor entries in the vtable at offsets below
+zero. If these entries must be padded (say, to preserve the alignment
+specified by @code{TARGET_VTABLE_ENTRY_ALIGN}), set this to the number
+of words in each data entry.
+@end defmac
+
+@node Registers
+@section Register Usage
+@cindex register usage
+
+This section explains how to describe what registers the target machine
+has, and how (in general) they can be used.
+
+The description of which registers a specific instruction can use is
+done with register classes; see @ref{Register Classes}. For information
+on using registers to access a stack frame, see @ref{Frame Registers}.
+For passing values in registers, see @ref{Register Arguments}.
+For returning values in registers, see @ref{Scalar Return}.
+
+@menu
+* Register Basics:: Number and kinds of registers.
+* Allocation Order:: Order in which registers are allocated.
+* Values in Registers:: What kinds of values each reg can hold.
+* Leaf Functions:: Renumbering registers for leaf functions.
+* Stack Registers:: Handling a register stack such as 80387.
+@end menu
+
+@node Register Basics
+@subsection Basic Characteristics of Registers
+
+@c prevent bad page break with this line
+Registers have various characteristics.
+
+@defmac FIRST_PSEUDO_REGISTER
+Number of hardware registers known to the compiler. They receive
+numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
+pseudo register's number really is assigned the number
+@code{FIRST_PSEUDO_REGISTER}.
+@end defmac
+
+@defmac FIXED_REGISTERS
+@cindex fixed register
+An initializer that says which registers are used for fixed purposes
+all throughout the compiled code and are therefore not available for
+general allocation. These would include the stack pointer, the frame
+pointer (except on machines where that can be used as a general
+register when no frame pointer is needed), the program counter on
+machines where that is considered one of the addressable registers,
+and any other numbered register with a standard use.
+
+This information is expressed as a sequence of numbers, separated by
+commas and surrounded by braces. The @var{n}th number is 1 if
+register @var{n} is fixed, 0 otherwise.
+
+The table initialized from this macro, and the table initialized by
+the following one, may be overridden at run time either automatically,
+by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
+the user with the command options @option{-ffixed-@var{reg}},
+@option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}.
+@end defmac
+
+@defmac CALL_USED_REGISTERS
+@cindex call-used register
+@cindex call-clobbered register
+@cindex call-saved register
+Like @code{FIXED_REGISTERS} but has 1 for each register that is
+clobbered (in general) by function calls as well as for fixed
+registers. This macro therefore identifies the registers that are not
+available for general allocation of values that must live across
+function calls.
+
+If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
+automatically saves it on function entry and restores it on function
+exit, if the register is used within the function.
+@end defmac
+
+@defmac CALL_REALLY_USED_REGISTERS
+@cindex call-used register
+@cindex call-clobbered register
+@cindex call-saved register
+Like @code{CALL_USED_REGISTERS} except this macro doesn't require
+that the entire set of @code{FIXED_REGISTERS} be included.
+(@code{CALL_USED_REGISTERS} must be a superset of @code{FIXED_REGISTERS}).
+This macro is optional. If not specified, it defaults to the value
+of @code{CALL_USED_REGISTERS}.
+@end defmac
+
+@defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode})
+@cindex call-used register
+@cindex call-clobbered register
+@cindex call-saved register
+A C expression that is nonzero if it is not permissible to store a
+value of mode @var{mode} in hard register number @var{regno} across a
+call without some part of it being clobbered. For most machines this
+macro need not be defined. It is only required for machines that do not
+preserve the entire contents of a register across a call.
+@end defmac
+
+@findex fixed_regs
+@findex call_used_regs
+@findex global_regs
+@findex reg_names
+@findex reg_class_contents
+@defmac CONDITIONAL_REGISTER_USAGE
+Zero or more C statements that may conditionally modify five variables
+@code{fixed_regs}, @code{call_used_regs}, @code{global_regs},
+@code{reg_names}, and @code{reg_class_contents}, to take into account
+any dependence of these register sets on target flags. The first three
+of these are of type @code{char []} (interpreted as Boolean vectors).
+@code{global_regs} is a @code{const char *[]}, and
+@code{reg_class_contents} is a @code{HARD_REG_SET}. Before the macro is
+called, @code{fixed_regs}, @code{call_used_regs},
+@code{reg_class_contents}, and @code{reg_names} have been initialized
+from @code{FIXED_REGISTERS}, @code{CALL_USED_REGISTERS},
+@code{REG_CLASS_CONTENTS}, and @code{REGISTER_NAMES}, respectively.
+@code{global_regs} has been cleared, and any @option{-ffixed-@var{reg}},
+@option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}
+command options have been applied.
+
+You need not define this macro if it has no work to do.
+
+@cindex disabling certain registers
+@cindex controlling register usage
+If the usage of an entire class of registers depends on the target
+flags, you may indicate this to GCC by using this macro to modify
+@code{fixed_regs} and @code{call_used_regs} to 1 for each of the
+registers in the classes which should not be used by GCC@. Also define
+the macro @code{REG_CLASS_FROM_LETTER} / @code{REG_CLASS_FROM_CONSTRAINT}
+to return @code{NO_REGS} if it
+is called with a letter for a class that shouldn't be used.
+
+(However, if this class is not included in @code{GENERAL_REGS} and all
+of the insn patterns whose constraints permit this class are
+controlled by target switches, then GCC will automatically avoid using
+these registers when the target switches are opposed to them.)
+@end defmac
+
+@defmac INCOMING_REGNO (@var{out})
+Define this macro if the target machine has register windows. This C
+expression returns the register number as seen by the called function
+corresponding to the register number @var{out} as seen by the calling
+function. Return @var{out} if register number @var{out} is not an
+outbound register.
+@end defmac
+
+@defmac OUTGOING_REGNO (@var{in})
+Define this macro if the target machine has register windows. This C
+expression returns the register number as seen by the calling function
+corresponding to the register number @var{in} as seen by the called
+function. Return @var{in} if register number @var{in} is not an inbound
+register.
+@end defmac
+
+@defmac LOCAL_REGNO (@var{regno})
+Define this macro if the target machine has register windows. This C
+expression returns true if the register is call-saved but is in the
+register window. Unlike most call-saved registers, such registers
+need not be explicitly restored on function exit or during non-local
+gotos.
+@end defmac
+
+@defmac PC_REGNUM
+If the program counter has a register number, define this as that
+register number. Otherwise, do not define it.
+@end defmac
+
+@node Allocation Order
+@subsection Order of Allocation of Registers
+@cindex order of register allocation
+@cindex register allocation order
+
+@c prevent bad page break with this line
+Registers are allocated in order.
+
+@defmac REG_ALLOC_ORDER
+If defined, an initializer for a vector of integers, containing the
+numbers of hard registers in the order in which GCC should prefer
+to use them (from most preferred to least).
+
+If this macro is not defined, registers are used lowest numbered first
+(all else being equal).
+
+One use of this macro is on machines where the highest numbered
+registers must always be saved and the save-multiple-registers
+instruction supports only sequences of consecutive registers. On such
+machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists
+the highest numbered allocable register first.
+@end defmac
+
+@defmac ADJUST_REG_ALLOC_ORDER
+A C statement (sans semicolon) to choose the order in which to allocate
+hard registers for pseudo-registers local to a basic block.
+
+Store the desired register order in the array @code{reg_alloc_order}.
+Element 0 should be the register to allocate first; element 1, the next
+register; and so on.
+
+The macro body should not assume anything about the contents of
+@code{reg_alloc_order} before execution of the macro.
+
+On most machines, it is not necessary to define this macro.
+@end defmac
+
+@defmac HONOR_REG_ALLOC_ORDER
+Normally, IRA tries to estimate the costs for saving a register in the
+prologue and restoring it in the epilogue. This discourages it from
+using call-saved registers. If a machine wants to ensure that IRA
+allocates registers in the order given by REG_ALLOC_ORDER even if some
+call-saved registers appear earlier than call-used ones, this macro
+should be defined.
+@end defmac
+
+@defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno})
+In some case register allocation order is not enough for the
+Integrated Register Allocator (@acronym{IRA}) to generate a good code.
+If this macro is defined, it should return a floating point value
+based on @var{regno}. The cost of using @var{regno} for a pseudo will
+be increased by approximately the pseudo's usage frequency times the
+value returned by this macro. Not defining this macro is equivalent
+to having it always return @code{0.0}.
+
+On most machines, it is not necessary to define this macro.
+@end defmac
+
+@node Values in Registers
+@subsection How Values Fit in Registers
+
+This section discusses the macros that describe which kinds of values
+(specifically, which machine modes) each register can hold, and how many
+consecutive registers are needed for a given mode.
+
+@defmac HARD_REGNO_NREGS (@var{regno}, @var{mode})
+A C expression for the number of consecutive hard registers, starting
+at register number @var{regno}, required to hold a value of mode
+@var{mode}. This macro must never return zero, even if a register
+cannot hold the requested mode - indicate that with HARD_REGNO_MODE_OK
+and/or CANNOT_CHANGE_MODE_CLASS instead.
+
+On a machine where all registers are exactly one word, a suitable
+definition of this macro is
+
+@smallexample
+#define HARD_REGNO_NREGS(REGNO, MODE) \
+ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
+ / UNITS_PER_WORD)
+@end smallexample
+@end defmac
+
+@defmac HARD_REGNO_NREGS_HAS_PADDING (@var{regno}, @var{mode})
+A C expression that is nonzero if a value of mode @var{mode}, stored
+in memory, ends with padding that causes it to take up more space than
+in registers starting at register number @var{regno} (as determined by
+multiplying GCC's notion of the size of the register when containing
+this mode by the number of registers returned by
+@code{HARD_REGNO_NREGS}). By default this is zero.
+
+For example, if a floating-point value is stored in three 32-bit
+registers but takes up 128 bits in memory, then this would be
+nonzero.
+
+This macros only needs to be defined if there are cases where
+@code{subreg_get_info}
+would otherwise wrongly determine that a @code{subreg} can be
+represented by an offset to the register number, when in fact such a
+@code{subreg} would contain some of the padding not stored in
+registers and so not be representable.
+@end defmac
+
+@defmac HARD_REGNO_NREGS_WITH_PADDING (@var{regno}, @var{mode})
+For values of @var{regno} and @var{mode} for which
+@code{HARD_REGNO_NREGS_HAS_PADDING} returns nonzero, a C expression
+returning the greater number of registers required to hold the value
+including any padding. In the example above, the value would be four.
+@end defmac
+
+@defmac REGMODE_NATURAL_SIZE (@var{mode})
+Define this macro if the natural size of registers that hold values
+of mode @var{mode} is not the word size. It is a C expression that
+should give the natural size in bytes for the specified mode. It is
+used by the register allocator to try to optimize its results. This
+happens for example on SPARC 64-bit where the natural size of
+floating-point registers is still 32-bit.
+@end defmac
+
+@defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
+A C expression that is nonzero if it is permissible to store a value
+of mode @var{mode} in hard register number @var{regno} (or in several
+registers starting with that one). For a machine where all registers
+are equivalent, a suitable definition is
+
+@smallexample
+#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
+@end smallexample
+
+You need not include code to check for the numbers of fixed registers,
+because the allocation mechanism considers them to be always occupied.
+
+@cindex register pairs
+On some machines, double-precision values must be kept in even/odd
+register pairs. You can implement that by defining this macro to reject
+odd register numbers for such modes.
+
+The minimum requirement for a mode to be OK in a register is that the
+@samp{mov@var{mode}} instruction pattern support moves between the
+register and other hard register in the same class and that moving a
+value into the register and back out not alter it.
+
+Since the same instruction used to move @code{word_mode} will work for
+all narrower integer modes, it is not necessary on any machine for
+@code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
+you define patterns @samp{movhi}, etc., to take advantage of this. This
+is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
+and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
+to be tieable.
+
+Many machines have special registers for floating point arithmetic.
+Often people assume that floating point machine modes are allowed only
+in floating point registers. This is not true. Any registers that
+can hold integers can safely @emph{hold} a floating point machine
+mode, whether or not floating arithmetic can be done on it in those
+registers. Integer move instructions can be used to move the values.
+
+On some machines, though, the converse is true: fixed-point machine
+modes may not go in floating registers. This is true if the floating
+registers normalize any value stored in them, because storing a
+non-floating value there would garble it. In this case,
+@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
+floating registers. But if the floating registers do not automatically
+normalize, if you can store any bit pattern in one and retrieve it
+unchanged without a trap, then any machine mode may go in a floating
+register, so you can define this macro to say so.
+
+The primary significance of special floating registers is rather that
+they are the registers acceptable in floating point arithmetic
+instructions. However, this is of no concern to
+@code{HARD_REGNO_MODE_OK}. You handle it by writing the proper
+constraints for those instructions.
+
+On some machines, the floating registers are especially slow to access,
+so that it is better to store a value in a stack frame than in such a
+register if floating point arithmetic is not being done. As long as the
+floating registers are not in class @code{GENERAL_REGS}, they will not
+be used unless some pattern's constraint asks for one.
+@end defmac
+
+@defmac HARD_REGNO_RENAME_OK (@var{from}, @var{to})
+A C expression that is nonzero if it is OK to rename a hard register
+@var{from} to another hard register @var{to}.
+
+One common use of this macro is to prevent renaming of a register to
+another register that is not saved by a prologue in an interrupt
+handler.
+
+The default is always nonzero.
+@end defmac
+
+@defmac MODES_TIEABLE_P (@var{mode1}, @var{mode2})
+A C expression that is nonzero if a value of mode
+@var{mode1} is accessible in mode @var{mode2} without copying.
+
+If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
+@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for
+any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
+should be nonzero. If they differ for any @var{r}, you should define
+this macro to return zero unless some other mechanism ensures the
+accessibility of the value in a narrower mode.
+
+You should define this macro to return nonzero in as many cases as
+possible since doing so will allow GCC to perform better register
+allocation.
+@end defmac
+
+@hook TARGET_HARD_REGNO_SCRATCH_OK
+This target hook should return @code{true} if it is OK to use a hard register
+@var{regno} as scratch reg in peephole2.
+
+One common use of this macro is to prevent using of a register that
+is not saved by a prologue in an interrupt handler.
+
+The default version of this hook always returns @code{true}.
+@end deftypefn
+
+@defmac AVOID_CCMODE_COPIES
+Define this macro if the compiler should avoid copies to/from @code{CCmode}
+registers. You should only define this macro if support for copying to/from
+@code{CCmode} is incomplete.
+@end defmac
+
+@node Leaf Functions
+@subsection Handling Leaf Functions
+
+@cindex leaf functions
+@cindex functions, leaf
+On some machines, a leaf function (i.e., one which makes no calls) can run
+more efficiently if it does not make its own register window. Often this
+means it is required to receive its arguments in the registers where they
+are passed by the caller, instead of the registers where they would
+normally arrive.
+
+The special treatment for leaf functions generally applies only when
+other conditions are met; for example, often they may use only those
+registers for its own variables and temporaries. We use the term ``leaf
+function'' to mean a function that is suitable for this special
+handling, so that functions with no calls are not necessarily ``leaf
+functions''.
+
+GCC assigns register numbers before it knows whether the function is
+suitable for leaf function treatment. So it needs to renumber the
+registers in order to output a leaf function. The following macros
+accomplish this.
+
+@defmac LEAF_REGISTERS
+Name of a char vector, indexed by hard register number, which
+contains 1 for a register that is allowable in a candidate for leaf
+function treatment.
+
+If leaf function treatment involves renumbering the registers, then the
+registers marked here should be the ones before renumbering---those that
+GCC would ordinarily allocate. The registers which will actually be
+used in the assembler code, after renumbering, should not be marked with 1
+in this vector.
+
+Define this macro only if the target machine offers a way to optimize
+the treatment of leaf functions.
+@end defmac
+
+@defmac LEAF_REG_REMAP (@var{regno})
+A C expression whose value is the register number to which @var{regno}
+should be renumbered, when a function is treated as a leaf function.
+
+If @var{regno} is a register number which should not appear in a leaf
+function before renumbering, then the expression should yield @minus{}1, which
+will cause the compiler to abort.
+
+Define this macro only if the target machine offers a way to optimize the
+treatment of leaf functions, and registers need to be renumbered to do
+this.
+@end defmac
+
+@findex current_function_is_leaf
+@findex current_function_uses_only_leaf_regs
+@code{TARGET_ASM_FUNCTION_PROLOGUE} and
+@code{TARGET_ASM_FUNCTION_EPILOGUE} must usually treat leaf functions
+specially. They can test the C variable @code{current_function_is_leaf}
+which is nonzero for leaf functions. @code{current_function_is_leaf} is
+set prior to local register allocation and is valid for the remaining
+compiler passes. They can also test the C variable
+@code{current_function_uses_only_leaf_regs} which is nonzero for leaf
+functions which only use leaf registers.
+@code{current_function_uses_only_leaf_regs} is valid after all passes
+that modify the instructions have been run and is only useful if
+@code{LEAF_REGISTERS} is defined.
+@c changed this to fix overfull. ALSO: why the "it" at the beginning
+@c of the next paragraph?! --mew 2feb93
+
+@node Stack Registers
+@subsection Registers That Form a Stack
+
+There are special features to handle computers where some of the
+``registers'' form a stack. Stack registers are normally written by
+pushing onto the stack, and are numbered relative to the top of the
+stack.
+
+Currently, GCC can only handle one group of stack-like registers, and
+they must be consecutively numbered. Furthermore, the existing
+support for stack-like registers is specific to the 80387 floating
+point coprocessor. If you have a new architecture that uses
+stack-like registers, you will need to do substantial work on
+@file{reg-stack.c} and write your machine description to cooperate
+with it, as well as defining these macros.
+
+@defmac STACK_REGS
+Define this if the machine has any stack-like registers.
+@end defmac
+
+@defmac STACK_REG_COVER_CLASS
+This is a cover class containing the stack registers. Define this if
+the machine has any stack-like registers.
+@end defmac
+
+@defmac FIRST_STACK_REG
+The number of the first stack-like register. This one is the top
+of the stack.
+@end defmac
+
+@defmac LAST_STACK_REG
+The number of the last stack-like register. This one is the bottom of
+the stack.
+@end defmac
+
+@node Register Classes
+@section Register Classes
+@cindex register class definitions
+@cindex class definitions, register
+
+On many machines, the numbered registers are not all equivalent.
+For example, certain registers may not be allowed for indexed addressing;
+certain registers may not be allowed in some instructions. These machine
+restrictions are described to the compiler using @dfn{register classes}.
+
+You define a number of register classes, giving each one a name and saying
+which of the registers belong to it. Then you can specify register classes
+that are allowed as operands to particular instruction patterns.
+
+@findex ALL_REGS
+@findex NO_REGS
+In general, each register will belong to several classes. In fact, one
+class must be named @code{ALL_REGS} and contain all the registers. Another
+class must be named @code{NO_REGS} and contain no registers. Often the
+union of two classes will be another class; however, this is not required.
+
+@findex GENERAL_REGS
+One of the classes must be named @code{GENERAL_REGS}. There is nothing
+terribly special about the name, but the operand constraint letters
+@samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} is
+the same as @code{ALL_REGS}, just define it as a macro which expands
+to @code{ALL_REGS}.
+
+Order the classes so that if class @var{x} is contained in class @var{y}
+then @var{x} has a lower class number than @var{y}.
+
+The way classes other than @code{GENERAL_REGS} are specified in operand
+constraints is through machine-dependent operand constraint letters.
+You can define such letters to correspond to various classes, then use
+them in operand constraints.
+
+You should define a class for the union of two classes whenever some
+instruction allows both classes. For example, if an instruction allows
+either a floating point (coprocessor) register or a general register for a
+certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
+which includes both of them. Otherwise you will get suboptimal code.
+
+You must also specify certain redundant information about the register
+classes: for each class, which classes contain it and which ones are
+contained in it; for each pair of classes, the largest class contained
+in their union.
+
+When a value occupying several consecutive registers is expected in a
+certain class, all the registers used must belong to that class.
+Therefore, register classes cannot be used to enforce a requirement for
+a register pair to start with an even-numbered register. The way to
+specify this requirement is with @code{HARD_REGNO_MODE_OK}.
+
+Register classes used for input-operands of bitwise-and or shift
+instructions have a special requirement: each such class must have, for
+each fixed-point machine mode, a subclass whose registers can transfer that
+mode to or from memory. For example, on some machines, the operations for
+single-byte values (@code{QImode}) are limited to certain registers. When
+this is so, each register class that is used in a bitwise-and or shift
+instruction must have a subclass consisting of registers from which
+single-byte values can be loaded or stored. This is so that
+@code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
+
+@deftp {Data type} {enum reg_class}
+An enumerated type that must be defined with all the register class names
+as enumerated values. @code{NO_REGS} must be first. @code{ALL_REGS}
+must be the last register class, followed by one more enumerated value,
+@code{LIM_REG_CLASSES}, which is not a register class but rather
+tells how many classes there are.
+
+Each register class has a number, which is the value of casting
+the class name to type @code{int}. The number serves as an index
+in many of the tables described below.
+@end deftp
+
+@defmac N_REG_CLASSES
+The number of distinct register classes, defined as follows:
+
+@smallexample
+#define N_REG_CLASSES (int) LIM_REG_CLASSES
+@end smallexample
+@end defmac
+
+@defmac REG_CLASS_NAMES
+An initializer containing the names of the register classes as C string
+constants. These names are used in writing some of the debugging dumps.
+@end defmac
+
+@defmac REG_CLASS_CONTENTS
+An initializer containing the contents of the register classes, as integers
+which are bit masks. The @var{n}th integer specifies the contents of class
+@var{n}. The way the integer @var{mask} is interpreted is that
+register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
+
+When the machine has more than 32 registers, an integer does not suffice.
+Then the integers are replaced by sub-initializers, braced groupings containing
+several integers. Each sub-initializer must be suitable as an initializer
+for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
+In this situation, the first integer in each sub-initializer corresponds to
+registers 0 through 31, the second integer to registers 32 through 63, and
+so on.
+@end defmac
+
+@defmac REGNO_REG_CLASS (@var{regno})
+A C expression whose value is a register class containing hard register
+@var{regno}. In general there is more than one such class; choose a class
+which is @dfn{minimal}, meaning that no smaller class also contains the
+register.
+@end defmac
+
+@defmac BASE_REG_CLASS
+A macro whose definition is the name of the class to which a valid
+base register must belong. A base register is one used in an address
+which is the register value plus a displacement.
+@end defmac
+
+@defmac MODE_BASE_REG_CLASS (@var{mode})
+This is a variation of the @code{BASE_REG_CLASS} macro which allows
+the selection of a base register in a mode dependent manner. If
+@var{mode} is VOIDmode then it should return the same value as
+@code{BASE_REG_CLASS}.
+@end defmac
+
+@defmac MODE_BASE_REG_REG_CLASS (@var{mode})
+A C expression whose value is the register class to which a valid
+base register must belong in order to be used in a base plus index
+register address. You should define this macro if base plus index
+addresses have different requirements than other base register uses.
+@end defmac
+
+@defmac MODE_CODE_BASE_REG_CLASS (@var{mode}, @var{outer_code}, @var{index_code})
+A C expression whose value is the register class to which a valid
+base register must belong. @var{outer_code} and @var{index_code} define the
+context in which the base register occurs. @var{outer_code} is the code of
+the immediately enclosing expression (@code{MEM} for the top level of an
+address, @code{ADDRESS} for something that occurs in an
+@code{address_operand}). @var{index_code} is the code of the corresponding
+index expression if @var{outer_code} is @code{PLUS}; @code{SCRATCH} otherwise.
+@end defmac
+
+@defmac INDEX_REG_CLASS
+A macro whose definition is the name of the class to which a valid
+index register must belong. An index register is one used in an
+address where its value is either multiplied by a scale factor or
+added to another register (as well as added to a displacement).
+@end defmac
+
+@defmac REGNO_OK_FOR_BASE_P (@var{num})
+A C expression which is nonzero if register number @var{num} is
+suitable for use as a base register in operand addresses.
+Like @code{TARGET_LEGITIMATE_ADDRESS_P}, this macro should also
+define a strict and a non-strict variant. Both variants behave
+the same for hard register; for pseudos, the strict variant will
+pass only those that have been allocated to a valid hard registers,
+while the non-strict variant will pass all pseudos.
+
+@findex REG_OK_STRICT
+Compiler source files that want to use the strict variant of this and
+other macros define the macro @code{REG_OK_STRICT}. You should use an
+@code{#ifdef REG_OK_STRICT} conditional to define the strict variant in
+that case and the non-strict variant otherwise.
+@end defmac
+
+@defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode})
+A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that
+that expression may examine the mode of the memory reference in
+@var{mode}. You should define this macro if the mode of the memory
+reference affects whether a register may be used as a base register. If
+you define this macro, the compiler will use it instead of
+@code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} for
+addresses that appear outside a @code{MEM}, i.e., as an
+@code{address_operand}.
+
+This macro also has strict and non-strict variants.
+@end defmac
+
+@defmac REGNO_MODE_OK_FOR_REG_BASE_P (@var{num}, @var{mode})
+A C expression which is nonzero if register number @var{num} is suitable for
+use as a base register in base plus index operand addresses, accessing
+memory in mode @var{mode}. It may be either a suitable hard register or a
+pseudo register that has been allocated such a hard register. You should
+define this macro if base plus index addresses have different requirements
+than other base register uses.
+
+Use of this macro is deprecated; please use the more general
+@code{REGNO_MODE_CODE_OK_FOR_BASE_P}.
+
+This macro also has strict and non-strict variants.
+@end defmac
+
+@defmac REGNO_MODE_CODE_OK_FOR_BASE_P (@var{num}, @var{mode}, @var{outer_code}, @var{index_code})
+A C expression that is just like @code{REGNO_MODE_OK_FOR_BASE_P}, except
+that that expression may examine the context in which the register
+appears in the memory reference. @var{outer_code} is the code of the
+immediately enclosing expression (@code{MEM} if at the top level of the
+address, @code{ADDRESS} for something that occurs in an
+@code{address_operand}). @var{index_code} is the code of the
+corresponding index expression if @var{outer_code} is @code{PLUS};
+@code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addresses
+that appear outside a @code{MEM}, i.e., as an @code{address_operand}.
+
+This macro also has strict and non-strict variants.
+@end defmac
+
+@defmac REGNO_OK_FOR_INDEX_P (@var{num})
+A C expression which is nonzero if register number @var{num} is
+suitable for use as an index register in operand addresses. It may be
+either a suitable hard register or a pseudo register that has been
+allocated such a hard register.
+
+The difference between an index register and a base register is that
+the index register may be scaled. If an address involves the sum of
+two registers, neither one of them scaled, then either one may be
+labeled the ``base'' and the other the ``index''; but whichever
+labeling is used must fit the machine's constraints of which registers
+may serve in each capacity. The compiler will try both labelings,
+looking for one that is valid, and will reload one or both registers
+only if neither labeling works.
+
+This macro also has strict and non-strict variants.
+@end defmac
+
+@defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
+A C expression that places additional restrictions on the register class
+to use when it is necessary to copy value @var{x} into a register in class
+@var{class}. The value is a register class; perhaps @var{class}, or perhaps
+another, smaller class. On many machines, the following definition is
+safe:
+
+@smallexample
+#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
+@end smallexample
+
+Sometimes returning a more restrictive class makes better code. For
+example, on the 68000, when @var{x} is an integer constant that is in range
+for a @samp{moveq} instruction, the value of this macro is always
+@code{DATA_REGS} as long as @var{class} includes the data registers.
+Requiring a data register guarantees that a @samp{moveq} will be used.
+
+One case where @code{PREFERRED_RELOAD_CLASS} must not return
+@var{class} is if @var{x} is a legitimate constant which cannot be
+loaded into some register class. By returning @code{NO_REGS} you can
+force @var{x} into a memory location. For example, rs6000 can load
+immediate values into general-purpose registers, but does not have an
+instruction for loading an immediate value into a floating-point
+register, so @code{PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when
+@var{x} is a floating-point constant. If the constant can't be loaded
+into any kind of register, code generation will be better if
+@code{LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead
+of using @code{PREFERRED_RELOAD_CLASS}.
+
+If an insn has pseudos in it after register allocation, reload will go
+through the alternatives and call repeatedly @code{PREFERRED_RELOAD_CLASS}
+to find the best one. Returning @code{NO_REGS}, in this case, makes
+reload add a @code{!} in front of the constraint: the x86 back-end uses
+this feature to discourage usage of 387 registers when math is done in
+the SSE registers (and vice versa).
+@end defmac
+
+@defmac PREFERRED_OUTPUT_RELOAD_CLASS (@var{x}, @var{class})
+Like @code{PREFERRED_RELOAD_CLASS}, but for output reloads instead of
+input reloads. If you don't define this macro, the default is to use
+@var{class}, unchanged.
+
+You can also use @code{PREFERRED_OUTPUT_RELOAD_CLASS} to discourage
+reload from using some alternatives, like @code{PREFERRED_RELOAD_CLASS}.
+@end defmac
+
+@defmac LIMIT_RELOAD_CLASS (@var{mode}, @var{class})
+A C expression that places additional restrictions on the register class
+to use when it is necessary to be able to hold a value of mode
+@var{mode} in a reload register for which class @var{class} would
+ordinarily be used.
+
+Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when
+there are certain modes that simply can't go in certain reload classes.
+
+The value is a register class; perhaps @var{class}, or perhaps another,
+smaller class.
+
+Don't define this macro unless the target machine has limitations which
+require the macro to do something nontrivial.
+@end defmac
+
+@hook TARGET_SECONDARY_RELOAD
+Many machines have some registers that cannot be copied directly to or
+from memory or even from other types of registers. An example is the
+@samp{MQ} register, which on most machines, can only be copied to or
+from general registers, but not memory. Below, we shall be using the
+term 'intermediate register' when a move operation cannot be performed
+directly, but has to be done by copying the source into the intermediate
+register first, and then copying the intermediate register to the
+destination. An intermediate register always has the same mode as
+source and destination. Since it holds the actual value being copied,
+reload might apply optimizations to re-use an intermediate register
+and eliding the copy from the source when it can determine that the
+intermediate register still holds the required value.
+
+Another kind of secondary reload is required on some machines which
+allow copying all registers to and from memory, but require a scratch
+register for stores to some memory locations (e.g., those with symbolic
+address on the RT, and those with certain symbolic address on the SPARC
+when compiling PIC)@. Scratch registers need not have the same mode
+as the value being copied, and usually hold a different value than
+that being copied. Special patterns in the md file are needed to
+describe how the copy is performed with the help of the scratch register;
+these patterns also describe the number, register class(es) and mode(s)
+of the scratch register(s).
+
+In some cases, both an intermediate and a scratch register are required.
+
+For input reloads, this target hook is called with nonzero @var{in_p},
+and @var{x} is an rtx that needs to be copied to a register of class
+@var{reload_class} in @var{reload_mode}. For output reloads, this target
+hook is called with zero @var{in_p}, and a register of class @var{reload_class}
+needs to be copied to rtx @var{x} in @var{reload_mode}.
+
+If copying a register of @var{reload_class} from/to @var{x} requires
+an intermediate register, the hook @code{secondary_reload} should
+return the register class required for this intermediate register.
+If no intermediate register is required, it should return NO_REGS.
+If more than one intermediate register is required, describe the one
+that is closest in the copy chain to the reload register.
+
+If scratch registers are needed, you also have to describe how to
+perform the copy from/to the reload register to/from this
+closest intermediate register. Or if no intermediate register is
+required, but still a scratch register is needed, describe the
+copy from/to the reload register to/from the reload operand @var{x}.
+
+You do this by setting @code{sri->icode} to the instruction code of a pattern
+in the md file which performs the move. Operands 0 and 1 are the output
+and input of this copy, respectively. Operands from operand 2 onward are
+for scratch operands. These scratch operands must have a mode, and a
+single-register-class
+@c [later: or memory]
+output constraint.
+
+When an intermediate register is used, the @code{secondary_reload}
+hook will be called again to determine how to copy the intermediate
+register to/from the reload operand @var{x}, so your hook must also
+have code to handle the register class of the intermediate operand.
+
+@c [For later: maybe we'll allow multi-alternative reload patterns -
+@c the port maintainer could name a mov<mode> pattern that has clobbers -
+@c and match the constraints of input and output to determine the required
+@c alternative. A restriction would be that constraints used to match
+@c against reloads registers would have to be written as register class
+@c constraints, or we need a new target macro / hook that tells us if an
+@c arbitrary constraint can match an unknown register of a given class.
+@c Such a macro / hook would also be useful in other places.]
+
+
+@var{x} might be a pseudo-register or a @code{subreg} of a
+pseudo-register, which could either be in a hard register or in memory.
+Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is
+in memory and the hard register number if it is in a register.
+
+Scratch operands in memory (constraint @code{"=m"} / @code{"=&m"}) are
+currently not supported. For the time being, you will have to continue
+to use @code{SECONDARY_MEMORY_NEEDED} for that purpose.
+
+@code{copy_cost} also uses this target hook to find out how values are
+copied. If you want it to include some extra cost for the need to allocate
+(a) scratch register(s), set @code{sri->extra_cost} to the additional cost.
+Or if two dependent moves are supposed to have a lower cost than the sum
+of the individual moves due to expected fortuitous scheduling and/or special
+forwarding logic, you can set @code{sri->extra_cost} to a negative amount.
+@end deftypefn
+
+@defmac SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
+@defmacx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
+@defmacx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
+These macros are obsolete, new ports should use the target hook
+@code{TARGET_SECONDARY_RELOAD} instead.
+
+These are obsolete macros, replaced by the @code{TARGET_SECONDARY_RELOAD}
+target hook. Older ports still define these macros to indicate to the
+reload phase that it may
+need to allocate at least one register for a reload in addition to the
+register to contain the data. Specifically, if copying @var{x} to a
+register @var{class} in @var{mode} requires an intermediate register,
+you were supposed to define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the
+largest register class all of whose registers can be used as
+intermediate registers or scratch registers.
+
+If copying a register @var{class} in @var{mode} to @var{x} requires an
+intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}
+was supposed to be defined be defined to return the largest register
+class required. If the
+requirements for input and output reloads were the same, the macro
+@code{SECONDARY_RELOAD_CLASS} should have been used instead of defining both
+macros identically.
+
+The values returned by these macros are often @code{GENERAL_REGS}.
+Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x}
+can be directly copied to or from a register of @var{class} in
+@var{mode} without requiring a scratch register. Do not define this
+macro if it would always return @code{NO_REGS}.
+
+If a scratch register is required (either with or without an
+intermediate register), you were supposed to define patterns for
+@samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required
+(@pxref{Standard Names}. These patterns, which were normally
+implemented with a @code{define_expand}, should be similar to the
+@samp{mov@var{m}} patterns, except that operand 2 is the scratch
+register.
+
+These patterns need constraints for the reload register and scratch
+register that
+contain a single register class. If the original reload register (whose
+class is @var{class}) can meet the constraint given in the pattern, the
+value returned by these macros is used for the class of the scratch
+register. Otherwise, two additional reload registers are required.
+Their classes are obtained from the constraints in the insn pattern.
+
+@var{x} might be a pseudo-register or a @code{subreg} of a
+pseudo-register, which could either be in a hard register or in memory.
+Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is
+in memory and the hard register number if it is in a register.
+
+These macros should not be used in the case where a particular class of
+registers can only be copied to memory and not to another class of
+registers. In that case, secondary reload registers are not needed and
+would not be helpful. Instead, a stack location must be used to perform
+the copy and the @code{mov@var{m}} pattern should use memory as an
+intermediate storage. This case often occurs between floating-point and
+general registers.
+@end defmac
+
+@defmac SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})
+Certain machines have the property that some registers cannot be copied
+to some other registers without using memory. Define this macro on
+those machines to be a C expression that is nonzero if objects of mode
+@var{m} in registers of @var{class1} can only be copied to registers of
+class @var{class2} by storing a register of @var{class1} into memory
+and loading that memory location into a register of @var{class2}.
+
+Do not define this macro if its value would always be zero.
+@end defmac
+
+@defmac SECONDARY_MEMORY_NEEDED_RTX (@var{mode})
+Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler
+allocates a stack slot for a memory location needed for register copies.
+If this macro is defined, the compiler instead uses the memory location
+defined by this macro.
+
+Do not define this macro if you do not define
+@code{SECONDARY_MEMORY_NEEDED}.
+@end defmac
+
+@defmac SECONDARY_MEMORY_NEEDED_MODE (@var{mode})
+When the compiler needs a secondary memory location to copy between two
+registers of mode @var{mode}, it normally allocates sufficient memory to
+hold a quantity of @code{BITS_PER_WORD} bits and performs the store and
+load operations in a mode that many bits wide and whose class is the
+same as that of @var{mode}.
+
+This is right thing to do on most machines because it ensures that all
+bits of the register are copied and prevents accesses to the registers
+in a narrower mode, which some machines prohibit for floating-point
+registers.
+
+However, this default behavior is not correct on some machines, such as
+the DEC Alpha, that store short integers in floating-point registers
+differently than in integer registers. On those machines, the default
+widening will not work correctly and you must define this macro to
+suppress that widening in some cases. See the file @file{alpha.h} for
+details.
+
+Do not define this macro if you do not define
+@code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode that
+is @code{BITS_PER_WORD} bits wide is correct for your machine.
+@end defmac
+
+@defmac CLASS_LIKELY_SPILLED_P (@var{class})
+A C expression whose value is nonzero if pseudos that have been assigned
+to registers of class @var{class} would likely be spilled because
+registers of @var{class} are needed for spill registers.
+
+The default value of this macro returns 1 if @var{class} has exactly one
+register and zero otherwise. On most machines, this default should be
+used. Only define this macro to some other expression if pseudos
+allocated by @file{local-alloc.c} end up in memory because their hard
+registers were needed for spill registers. If this macro returns nonzero
+for those classes, those pseudos will only be allocated by
+@file{global.c}, which knows how to reallocate the pseudo to another
+register. If there would not be another register available for
+reallocation, you should not change the definition of this macro since
+the only effect of such a definition would be to slow down register
+allocation.
+@end defmac
+
+@defmac CLASS_MAX_NREGS (@var{class}, @var{mode})
+A C expression for the maximum number of consecutive registers
+of class @var{class} needed to hold a value of mode @var{mode}.
+
+This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact,
+the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
+should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno},
+@var{mode})} for all @var{regno} values in the class @var{class}.
+
+This macro helps control the handling of multiple-word values
+in the reload pass.
+@end defmac
+
+@defmac CANNOT_CHANGE_MODE_CLASS (@var{from}, @var{to}, @var{class})
+If defined, a C expression that returns nonzero for a @var{class} for which
+a change from mode @var{from} to mode @var{to} is invalid.
+
+For the example, loading 32-bit integer or floating-point objects into
+floating-point registers on the Alpha extends them to 64 bits.
+Therefore loading a 64-bit object and then storing it as a 32-bit object
+does not store the low-order 32 bits, as would be the case for a normal
+register. Therefore, @file{alpha.h} defines @code{CANNOT_CHANGE_MODE_CLASS}
+as below:
+
+@smallexample
+#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
+ (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
+ ? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0)
+@end smallexample
+@end defmac
+
+@hook TARGET_IRA_COVER_CLASSES
+Return an array of cover classes for the Integrated Register Allocator
+(@acronym{IRA}). Cover classes are a set of non-intersecting register
+classes covering all hard registers used for register allocation
+purposes. If a move between two registers in the same cover class is
+possible, it should be cheaper than a load or store of the registers.
+The array is terminated by a @code{LIM_REG_CLASSES} element.
+
+The order of cover classes in the array is important. If two classes
+have the same cost of usage for a pseudo, the class occurred first in
+the array is chosen for the pseudo.
+
+This hook is called once at compiler startup, after the command-line
+options have been processed. It is then re-examined by every call to
+@code{target_reinit}.
+
+The default implementation returns @code{IRA_COVER_CLASSES}, if defined,
+otherwise there is no default implementation. You must define either this
+macro or @code{IRA_COVER_CLASSES} in order to use the integrated register
+allocator with Chaitin-Briggs coloring. If the macro is not defined,
+the only available coloring algorithm is Chow's priority coloring.
+@end deftypefn
+
+@defmac IRA_COVER_CLASSES
+See the documentation for @code{TARGET_IRA_COVER_CLASSES}.
+@end defmac
+
+@node Old Constraints
+@section Obsolete Macros for Defining Constraints
+@cindex defining constraints, obsolete method
+@cindex constraints, defining, obsolete method
+
+Machine-specific constraints can be defined with these macros instead
+of the machine description constructs described in @ref{Define
+Constraints}. This mechanism is obsolete. New ports should not use
+it; old ports should convert to the new mechanism.
+
+@defmac CONSTRAINT_LEN (@var{char}, @var{str})
+For the constraint at the start of @var{str}, which starts with the letter
+@var{c}, return the length. This allows you to have register class /
+constant / extra constraints that are longer than a single letter;
+you don't need to define this macro if you can do with single-letter
+constraints only. The definition of this macro should use
+DEFAULT_CONSTRAINT_LEN for all the characters that you don't want
+to handle specially.
+There are some sanity checks in genoutput.c that check the constraint lengths
+for the md file, so you can also use this macro to help you while you are
+transitioning from a byzantine single-letter-constraint scheme: when you
+return a negative length for a constraint you want to re-use, genoutput
+will complain about every instance where it is used in the md file.
+@end defmac
+
+@defmac REG_CLASS_FROM_LETTER (@var{char})
+A C expression which defines the machine-dependent operand constraint
+letters for register classes. If @var{char} is such a letter, the
+value should be the register class corresponding to it. Otherwise,
+the value should be @code{NO_REGS}. The register letter @samp{r},
+corresponding to class @code{GENERAL_REGS}, will not be passed
+to this macro; you do not need to handle it.
+@end defmac
+
+@defmac REG_CLASS_FROM_CONSTRAINT (@var{char}, @var{str})
+Like @code{REG_CLASS_FROM_LETTER}, but you also get the constraint string
+passed in @var{str}, so that you can use suffixes to distinguish between
+different variants.
+@end defmac
+
+@defmac CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
+A C expression that defines the machine-dependent operand constraint
+letters (@samp{I}, @samp{J}, @samp{K}, @dots{} @samp{P}) that specify
+particular ranges of integer values. If @var{c} is one of those
+letters, the expression should check that @var{value}, an integer, is in
+the appropriate range and return 1 if so, 0 otherwise. If @var{c} is
+not one of those letters, the value should be 0 regardless of
+@var{value}.
+@end defmac
+
+@defmac CONST_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})
+Like @code{CONST_OK_FOR_LETTER_P}, but you also get the constraint
+string passed in @var{str}, so that you can use suffixes to distinguish
+between different variants.
+@end defmac
+
+@defmac CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
+A C expression that defines the machine-dependent operand constraint
+letters that specify particular ranges of @code{const_double} values
+(@samp{G} or @samp{H}).
+
+If @var{c} is one of those letters, the expression should check that
+@var{value}, an RTX of code @code{const_double}, is in the appropriate
+range and return 1 if so, 0 otherwise. If @var{c} is not one of those
+letters, the value should be 0 regardless of @var{value}.
+
+@code{const_double} is used for all floating-point constants and for
+@code{DImode} fixed-point constants. A given letter can accept either
+or both kinds of values. It can use @code{GET_MODE} to distinguish
+between these kinds.
+@end defmac
+
+@defmac CONST_DOUBLE_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})
+Like @code{CONST_DOUBLE_OK_FOR_LETTER_P}, but you also get the constraint
+string passed in @var{str}, so that you can use suffixes to distinguish
+between different variants.
+@end defmac
+
+@defmac EXTRA_CONSTRAINT (@var{value}, @var{c})
+A C expression that defines the optional machine-dependent constraint
+letters that can be used to segregate specific types of operands, usually
+memory references, for the target machine. Any letter that is not
+elsewhere defined and not matched by @code{REG_CLASS_FROM_LETTER} /
+@code{REG_CLASS_FROM_CONSTRAINT}
+may be used. Normally this macro will not be defined.
+
+If it is required for a particular target machine, it should return 1
+if @var{value} corresponds to the operand type represented by the
+constraint letter @var{c}. If @var{c} is not defined as an extra
+constraint, the value returned should be 0 regardless of @var{value}.
+
+For example, on the ROMP, load instructions cannot have their output
+in r0 if the memory reference contains a symbolic address. Constraint
+letter @samp{Q} is defined as representing a memory address that does
+@emph{not} contain a symbolic address. An alternative is specified with
+a @samp{Q} constraint on the input and @samp{r} on the output. The next
+alternative specifies @samp{m} on the input and a register class that
+does not include r0 on the output.
+@end defmac
+
+@defmac EXTRA_CONSTRAINT_STR (@var{value}, @var{c}, @var{str})
+Like @code{EXTRA_CONSTRAINT}, but you also get the constraint string passed
+in @var{str}, so that you can use suffixes to distinguish between different
+variants.
+@end defmac
+
+@defmac EXTRA_MEMORY_CONSTRAINT (@var{c}, @var{str})
+A C expression that defines the optional machine-dependent constraint
+letters, amongst those accepted by @code{EXTRA_CONSTRAINT}, that should
+be treated like memory constraints by the reload pass.
+
+It should return 1 if the operand type represented by the constraint
+at the start of @var{str}, the first letter of which is the letter @var{c},
+comprises a subset of all memory references including
+all those whose address is simply a base register. This allows the reload
+pass to reload an operand, if it does not directly correspond to the operand
+type of @var{c}, by copying its address into a base register.
+
+For example, on the S/390, some instructions do not accept arbitrary
+memory references, but only those that do not make use of an index
+register. The constraint letter @samp{Q} is defined via
+@code{EXTRA_CONSTRAINT} as representing a memory address of this type.
+If the letter @samp{Q} is marked as @code{EXTRA_MEMORY_CONSTRAINT},
+a @samp{Q} constraint can handle any memory operand, because the
+reload pass knows it can be reloaded by copying the memory address
+into a base register if required. This is analogous to the way
+an @samp{o} constraint can handle any memory operand.
+@end defmac
+
+@defmac EXTRA_ADDRESS_CONSTRAINT (@var{c}, @var{str})
+A C expression that defines the optional machine-dependent constraint
+letters, amongst those accepted by @code{EXTRA_CONSTRAINT} /
+@code{EXTRA_CONSTRAINT_STR}, that should
+be treated like address constraints by the reload pass.
+
+It should return 1 if the operand type represented by the constraint
+at the start of @var{str}, which starts with the letter @var{c}, comprises
+a subset of all memory addresses including
+all those that consist of just a base register. This allows the reload
+pass to reload an operand, if it does not directly correspond to the operand
+type of @var{str}, by copying it into a base register.
+
+Any constraint marked as @code{EXTRA_ADDRESS_CONSTRAINT} can only
+be used with the @code{address_operand} predicate. It is treated
+analogously to the @samp{p} constraint.
+@end defmac
+
+@node Stack and Calling
+@section Stack Layout and Calling Conventions
+@cindex calling conventions
+
+@c prevent bad page break with this line
+This describes the stack layout and calling conventions.
+
+@menu
+* Frame Layout::
+* Exception Handling::
+* Stack Checking::
+* Frame Registers::
+* Elimination::
+* Stack Arguments::
+* Register Arguments::
+* Scalar Return::
+* Aggregate Return::
+* Caller Saves::
+* Function Entry::
+* Profiling::
+* Tail Calls::
+* Stack Smashing Protection::
+@end menu
+
+@node Frame Layout
+@subsection Basic Stack Layout
+@cindex stack frame layout
+@cindex frame layout
+
+@c prevent bad page break with this line
+Here is the basic stack layout.
+
+@defmac STACK_GROWS_DOWNWARD
+Define this macro if pushing a word onto the stack moves the stack
+pointer to a smaller address.
+
+When we say, ``define this macro if @dots{}'', it means that the
+compiler checks this macro only with @code{#ifdef} so the precise
+definition used does not matter.
+@end defmac
+
+@defmac STACK_PUSH_CODE
+This macro defines the operation used when something is pushed
+on the stack. In RTL, a push operation will be
+@code{(set (mem (STACK_PUSH_CODE (reg sp))) @dots{})}
+
+The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC},
+and @code{POST_INC}. Which of these is correct depends on
+the stack direction and on whether the stack pointer points
+to the last item on the stack or whether it points to the
+space for the next item on the stack.
+
+The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is
+defined, which is almost always right, and @code{PRE_INC} otherwise,
+which is often wrong.
+@end defmac
+
+@defmac FRAME_GROWS_DOWNWARD
+Define this macro to nonzero value if the addresses of local variable slots
+are at negative offsets from the frame pointer.
+@end defmac
+
+@defmac ARGS_GROW_DOWNWARD
+Define this macro if successive arguments to a function occupy decreasing
+addresses on the stack.
+@end defmac
+
+@defmac STARTING_FRAME_OFFSET
+Offset from the frame pointer to the first local variable slot to be allocated.
+
+If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by
+subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.
+Otherwise, it is found by adding the length of the first slot to the
+value @code{STARTING_FRAME_OFFSET}.
+@c i'm not sure if the above is still correct.. had to change it to get
+@c rid of an overfull. --mew 2feb93
+@end defmac
+
+@defmac STACK_ALIGNMENT_NEEDED
+Define to zero to disable final alignment of the stack during reload.
+The nonzero default for this macro is suitable for most ports.
+
+On ports where @code{STARTING_FRAME_OFFSET} is nonzero or where there
+is a register save block following the local block that doesn't require
+alignment to @code{STACK_BOUNDARY}, it may be beneficial to disable
+stack alignment and do it in the backend.
+@end defmac
+
+@defmac STACK_POINTER_OFFSET
+Offset from the stack pointer register to the first location at which
+outgoing arguments are placed. If not specified, the default value of
+zero is used. This is the proper value for most machines.
+
+If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
+the first location at which outgoing arguments are placed.
+@end defmac
+
+@defmac FIRST_PARM_OFFSET (@var{fundecl})
+Offset from the argument pointer register to the first argument's
+address. On some machines it may depend on the data type of the
+function.
+
+If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
+the first argument's address.
+@end defmac
+
+@defmac STACK_DYNAMIC_OFFSET (@var{fundecl})
+Offset from the stack pointer register to an item dynamically allocated
+on the stack, e.g., by @code{alloca}.
+
+The default value for this macro is @code{STACK_POINTER_OFFSET} plus the
+length of the outgoing arguments. The default is correct for most
+machines. See @file{function.c} for details.
+@end defmac
+
+@defmac INITIAL_FRAME_ADDRESS_RTX
+A C expression whose value is RTL representing the address of the initial
+stack frame. This address is passed to @code{RETURN_ADDR_RTX} and
+@code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonable
+default value will be used. Define this macro in order to make frame pointer
+elimination work in the presence of @code{__builtin_frame_address (count)} and
+@code{__builtin_return_address (count)} for @code{count} not equal to zero.
+@end defmac
+
+@defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
+A C expression whose value is RTL representing the address in a stack
+frame where the pointer to the caller's frame is stored. Assume that
+@var{frameaddr} is an RTL expression for the address of the stack frame
+itself.
+
+If you don't define this macro, the default is to return the value
+of @var{frameaddr}---that is, the stack frame address is also the
+address of the stack word that points to the previous frame.
+@end defmac
+
+@defmac SETUP_FRAME_ADDRESSES
+If defined, a C expression that produces the machine-specific code to
+setup the stack so that arbitrary frames can be accessed. For example,
+on the SPARC, we must flush all of the register windows to the stack
+before we can access arbitrary stack frames. You will seldom need to
+define this macro.
+@end defmac
+
+@hook TARGET_BUILTIN_SETJMP_FRAME_VALUE
+This target hook should return an rtx that is used to store
+the address of the current frame into the built in @code{setjmp} buffer.
+The default value, @code{virtual_stack_vars_rtx}, is correct for most
+machines. One reason you may need to define this target hook is if
+@code{hard_frame_pointer_rtx} is the appropriate value on your machine.
+@end deftypefn
+
+@defmac FRAME_ADDR_RTX (@var{frameaddr})
+A C expression whose value is RTL representing the value of the frame
+address for the current frame. @var{frameaddr} is the frame pointer
+of the current frame. This is used for __builtin_frame_address.
+You need only define this macro if the frame address is not the same
+as the frame pointer. Most machines do not need to define it.
+@end defmac
+
+@defmac RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
+A C expression whose value is RTL representing the value of the return
+address for the frame @var{count} steps up from the current frame, after
+the prologue. @var{frameaddr} is the frame pointer of the @var{count}
+frame, or the frame pointer of the @var{count} @minus{} 1 frame if
+@code{RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
+
+The value of the expression must always be the correct address when
+@var{count} is zero, but may be @code{NULL_RTX} if there is no way to
+determine the return address of other frames.
+@end defmac
+
+@defmac RETURN_ADDR_IN_PREVIOUS_FRAME
+Define this if the return address of a particular stack frame is accessed
+from the frame pointer of the previous stack frame.
+@end defmac
+
+@defmac INCOMING_RETURN_ADDR_RTX
+A C expression whose value is RTL representing the location of the
+incoming return address at the beginning of any function, before the
+prologue. This RTL is either a @code{REG}, indicating that the return
+value is saved in @samp{REG}, or a @code{MEM} representing a location in
+the stack.
+
+You only need to define this macro if you want to support call frame
+debugging information like that provided by DWARF 2.
+
+If this RTL is a @code{REG}, you should also define
+@code{DWARF_FRAME_RETURN_COLUMN} to @code{DWARF_FRAME_REGNUM (REGNO)}.
+@end defmac
+
+@defmac DWARF_ALT_FRAME_RETURN_COLUMN
+A C expression whose value is an integer giving a DWARF 2 column
+number that may be used as an alternative return column. The column
+must not correspond to any gcc hard register (that is, it must not
+be in the range of @code{DWARF_FRAME_REGNUM}).
+
+This macro can be useful if @code{DWARF_FRAME_RETURN_COLUMN} is set to a
+general register, but an alternative column needs to be used for signal
+frames. Some targets have also used different frame return columns
+over time.
+@end defmac
+
+@defmac DWARF_ZERO_REG
+A C expression whose value is an integer giving a DWARF 2 register
+number that is considered to always have the value zero. This should
+only be defined if the target has an architected zero register, and
+someone decided it was a good idea to use that register number to
+terminate the stack backtrace. New ports should avoid this.
+@end defmac
+
+@hook TARGET_DWARF_HANDLE_FRAME_UNSPEC
+This target hook allows the backend to emit frame-related insns that
+contain UNSPECs or UNSPEC_VOLATILEs. The DWARF 2 call frame debugging
+info engine will invoke it on insns of the form
+@smallexample
+(set (reg) (unspec [@dots{}] UNSPEC_INDEX))
+@end smallexample
+and
+@smallexample
+(set (reg) (unspec_volatile [@dots{}] UNSPECV_INDEX)).
+@end smallexample
+to let the backend emit the call frame instructions. @var{label} is
+the CFI label attached to the insn, @var{pattern} is the pattern of
+the insn and @var{index} is @code{UNSPEC_INDEX} or @code{UNSPECV_INDEX}.
+@end deftypefn
+
+@defmac INCOMING_FRAME_SP_OFFSET
+A C expression whose value is an integer giving the offset, in bytes,
+from the value of the stack pointer register to the top of the stack
+frame at the beginning of any function, before the prologue. The top of
+the frame is defined to be the value of the stack pointer in the
+previous frame, just before the call instruction.
+
+You only need to define this macro if you want to support call frame
+debugging information like that provided by DWARF 2.
+@end defmac
+
+@defmac ARG_POINTER_CFA_OFFSET (@var{fundecl})
+A C expression whose value is an integer giving the offset, in bytes,
+from the argument pointer to the canonical frame address (cfa). The
+final value should coincide with that calculated by
+@code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable
+during virtual register instantiation.
+
+The default value for this macro is
+@code{FIRST_PARM_OFFSET (fundecl) + crtl->args.pretend_args_size},
+which is correct for most machines; in general, the arguments are found
+immediately before the stack frame. Note that this is not the case on
+some targets that save registers into the caller's frame, such as SPARC
+and rs6000, and so such targets need to define this macro.
+
+You only need to define this macro if the default is incorrect, and you
+want to support call frame debugging information like that provided by
+DWARF 2.
+@end defmac
+
+@defmac FRAME_POINTER_CFA_OFFSET (@var{fundecl})
+If defined, a C expression whose value is an integer giving the offset
+in bytes from the frame pointer to the canonical frame address (cfa).
+The final value should coincide with that calculated by
+@code{INCOMING_FRAME_SP_OFFSET}.
+
+Normally the CFA is calculated as an offset from the argument pointer,
+via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is
+variable due to the ABI, this may not be possible. If this macro is
+defined, it implies that the virtual register instantiation should be
+based on the frame pointer instead of the argument pointer. Only one
+of @code{FRAME_POINTER_CFA_OFFSET} and @code{ARG_POINTER_CFA_OFFSET}
+should be defined.
+@end defmac
+
+@defmac CFA_FRAME_BASE_OFFSET (@var{fundecl})
+If defined, a C expression whose value is an integer giving the offset
+in bytes from the canonical frame address (cfa) to the frame base used
+in DWARF 2 debug information. The default is zero. A different value
+may reduce the size of debug information on some ports.
+@end defmac
+
+@node Exception Handling
+@subsection Exception Handling Support
+@cindex exception handling
+
+@defmac EH_RETURN_DATA_REGNO (@var{N})
+A C expression whose value is the @var{N}th register number used for
+data by exception handlers, or @code{INVALID_REGNUM} if fewer than
+@var{N} registers are usable.
+
+The exception handling library routines communicate with the exception
+handlers via a set of agreed upon registers. Ideally these registers
+should be call-clobbered; it is possible to use call-saved registers,
+but may negatively impact code size. The target must support at least
+2 data registers, but should define 4 if there are enough free registers.
+
+You must define this macro if you want to support call frame exception
+handling like that provided by DWARF 2.
+@end defmac
+
+@defmac EH_RETURN_STACKADJ_RTX
+A C expression whose value is RTL representing a location in which
+to store a stack adjustment to be applied before function return.
+This is used to unwind the stack to an exception handler's call frame.
+It will be assigned zero on code paths that return normally.
+
+Typically this is a call-clobbered hard register that is otherwise
+untouched by the epilogue, but could also be a stack slot.
+
+Do not define this macro if the stack pointer is saved and restored
+by the regular prolog and epilog code in the call frame itself; in
+this case, the exception handling library routines will update the
+stack location to be restored in place. Otherwise, you must define
+this macro if you want to support call frame exception handling like
+that provided by DWARF 2.
+@end defmac
+
+@defmac EH_RETURN_HANDLER_RTX
+A C expression whose value is RTL representing a location in which
+to store the address of an exception handler to which we should
+return. It will not be assigned on code paths that return normally.
+
+Typically this is the location in the call frame at which the normal
+return address is stored. For targets that return by popping an
+address off the stack, this might be a memory address just below
+the @emph{target} call frame rather than inside the current call
+frame. If defined, @code{EH_RETURN_STACKADJ_RTX} will have already
+been assigned, so it may be used to calculate the location of the
+target call frame.
+
+Some targets have more complex requirements than storing to an
+address calculable during initial code generation. In that case
+the @code{eh_return} instruction pattern should be used instead.
+
+If you want to support call frame exception handling, you must
+define either this macro or the @code{eh_return} instruction pattern.
+@end defmac
+
+@defmac RETURN_ADDR_OFFSET
+If defined, an integer-valued C expression for which rtl will be generated
+to add it to the exception handler address before it is searched in the
+exception handling tables, and to subtract it again from the address before
+using it to return to the exception handler.
+@end defmac
+
+@defmac ASM_PREFERRED_EH_DATA_FORMAT (@var{code}, @var{global})
+This macro chooses the encoding of pointers embedded in the exception
+handling sections. If at all possible, this should be defined such
+that the exception handling section will not require dynamic relocations,
+and so may be read-only.
+
+@var{code} is 0 for data, 1 for code labels, 2 for function pointers.
+@var{global} is true if the symbol may be affected by dynamic relocations.
+The macro should return a combination of the @code{DW_EH_PE_*} defines
+as found in @file{dwarf2.h}.
+
+If this macro is not defined, pointers will not be encoded but
+represented directly.
+@end defmac
+
+@defmac ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX (@var{file}, @var{encoding}, @var{size}, @var{addr}, @var{done})
+This macro allows the target to emit whatever special magic is required
+to represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}.
+Generic code takes care of pc-relative and indirect encodings; this must
+be defined if the target uses text-relative or data-relative encodings.
+
+This is a C statement that branches to @var{done} if the format was
+handled. @var{encoding} is the format chosen, @var{size} is the number
+of bytes that the format occupies, @var{addr} is the @code{SYMBOL_REF}
+to be emitted.
+@end defmac
+
+@defmac MD_UNWIND_SUPPORT
+A string specifying a file to be #include'd in unwind-dw2.c. The file
+so included typically defines @code{MD_FALLBACK_FRAME_STATE_FOR}.
+@end defmac
+
+@defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs})
+This macro allows the target to add CPU and operating system specific
+code to the call-frame unwinder for use when there is no unwind data
+available. The most common reason to implement this macro is to unwind
+through signal frames.
+
+This macro is called from @code{uw_frame_state_for} in
+@file{unwind-dw2.c}, @file{unwind-dw2-xtensa.c} and
+@file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context};
+@var{fs} is an @code{_Unwind_FrameState}. Examine @code{context->ra}
+for the address of the code being executed and @code{context->cfa} for
+the stack pointer value. If the frame can be decoded, the register
+save addresses should be updated in @var{fs} and the macro should
+evaluate to @code{_URC_NO_REASON}. If the frame cannot be decoded,
+the macro should evaluate to @code{_URC_END_OF_STACK}.
+
+For proper signal handling in Java this macro is accompanied by
+@code{MAKE_THROW_FRAME}, defined in @file{libjava/include/*-signal.h} headers.
+@end defmac
+
+@defmac MD_HANDLE_UNWABI (@var{context}, @var{fs})
+This macro allows the target to add operating system specific code to the
+call-frame unwinder to handle the IA-64 @code{.unwabi} unwinding directive,
+usually used for signal or interrupt frames.
+
+This macro is called from @code{uw_update_context} in @file{unwind-ia64.c}.
+@var{context} is an @code{_Unwind_Context};
+@var{fs} is an @code{_Unwind_FrameState}. Examine @code{fs->unwabi}
+for the abi and context in the @code{.unwabi} directive. If the
+@code{.unwabi} directive can be handled, the register save addresses should
+be updated in @var{fs}.
+@end defmac
+
+@defmac TARGET_USES_WEAK_UNWIND_INFO
+A C expression that evaluates to true if the target requires unwind
+info to be given comdat linkage. Define it to be @code{1} if comdat
+linkage is necessary. The default is @code{0}.
+@end defmac
+
+@node Stack Checking
+@subsection Specifying How Stack Checking is Done
+
+GCC will check that stack references are within the boundaries of the
+stack, if the option @option{-fstack-check} is specified, in one of
+three ways:
+
+@enumerate
+@item
+If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC
+will assume that you have arranged for full stack checking to be done
+at appropriate places in the configuration files. GCC will not do
+other special processing.
+
+@item
+If @code{STACK_CHECK_BUILTIN} is zero and the value of the
+@code{STACK_CHECK_STATIC_BUILTIN} macro is nonzero, GCC will assume
+that you have arranged for static stack checking (checking of the
+static stack frame of functions) to be done at appropriate places
+in the configuration files. GCC will only emit code to do dynamic
+stack checking (checking on dynamic stack allocations) using the third
+approach below.
+
+@item
+If neither of the above are true, GCC will generate code to periodically
+``probe'' the stack pointer using the values of the macros defined below.
+@end enumerate
+
+If neither STACK_CHECK_BUILTIN nor STACK_CHECK_STATIC_BUILTIN is defined,
+GCC will change its allocation strategy for large objects if the option
+@option{-fstack-check} is specified: they will always be allocated
+dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes.
+
+@defmac STACK_CHECK_BUILTIN
+A nonzero value if stack checking is done by the configuration files in a
+machine-dependent manner. You should define this macro if stack checking
+is required by the ABI of your machine or if you would like to do stack
+checking in some more efficient way than the generic approach. The default
+value of this macro is zero.
+@end defmac
+
+@defmac STACK_CHECK_STATIC_BUILTIN
+A nonzero value if static stack checking is done by the configuration files
+in a machine-dependent manner. You should define this macro if you would
+like to do static stack checking in some more efficient way than the generic
+approach. The default value of this macro is zero.
+@end defmac
+
+@defmac STACK_CHECK_PROBE_INTERVAL_EXP
+An integer specifying the interval at which GCC must generate stack probe
+instructions, defined as 2 raised to this integer. You will normally
+define this macro so that the interval be no larger than the size of
+the ``guard pages'' at the end of a stack area. The default value
+of 12 (4096-byte interval) is suitable for most systems.
+@end defmac
+
+@defmac STACK_CHECK_MOVING_SP
+An integer which is nonzero if GCC should move the stack pointer page by page
+when doing probes. This can be necessary on systems where the stack pointer
+contains the bottom address of the memory area accessible to the executing
+thread at any point in time. In this situation an alternate signal stack
+is required in order to be able to recover from a stack overflow. The
+default value of this macro is zero.
+@end defmac
+
+@defmac STACK_CHECK_PROTECT
+The number of bytes of stack needed to recover from a stack overflow, for
+languages where such a recovery is supported. The default value of 75 words
+with the @code{setjmp}/@code{longjmp}-based exception handling mechanism and
+8192 bytes with other exception handling mechanisms should be adequate for
+most machines.
+@end defmac
+
+The following macros are relevant only if neither STACK_CHECK_BUILTIN
+nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether
+in the opposite case.
+
+@defmac STACK_CHECK_MAX_FRAME_SIZE
+The maximum size of a stack frame, in bytes. GCC will generate probe
+instructions in non-leaf functions to ensure at least this many bytes of
+stack are available. If a stack frame is larger than this size, stack
+checking will not be reliable and GCC will issue a warning. The
+default is chosen so that GCC only generates one instruction on most
+systems. You should normally not change the default value of this macro.
+@end defmac
+
+@defmac STACK_CHECK_FIXED_FRAME_SIZE
+GCC uses this value to generate the above warning message. It
+represents the amount of fixed frame used by a function, not including
+space for any callee-saved registers, temporaries and user variables.
+You need only specify an upper bound for this amount and will normally
+use the default of four words.
+@end defmac
+
+@defmac STACK_CHECK_MAX_VAR_SIZE
+The maximum size, in bytes, of an object that GCC will place in the
+fixed area of the stack frame when the user specifies
+@option{-fstack-check}.
+GCC computed the default from the values of the above macros and you will
+normally not need to override that default.
+@end defmac
+
+@need 2000
+@node Frame Registers
+@subsection Registers That Address the Stack Frame
+
+@c prevent bad page break with this line
+This discusses registers that address the stack frame.
+
+@defmac STACK_POINTER_REGNUM
+The register number of the stack pointer register, which must also be a
+fixed register according to @code{FIXED_REGISTERS}. On most machines,
+the hardware determines which register this is.
+@end defmac
+
+@defmac FRAME_POINTER_REGNUM
+The register number of the frame pointer register, which is used to
+access automatic variables in the stack frame. On some machines, the
+hardware determines which register this is. On other machines, you can
+choose any register you wish for this purpose.
+@end defmac
+
+@defmac HARD_FRAME_POINTER_REGNUM
+On some machines the offset between the frame pointer and starting
+offset of the automatic variables is not known until after register
+allocation has been done (for example, because the saved registers are
+between these two locations). On those machines, define
+@code{FRAME_POINTER_REGNUM} the number of a special, fixed register to
+be used internally until the offset is known, and define
+@code{HARD_FRAME_POINTER_REGNUM} to be the actual hard register number
+used for the frame pointer.
+
+You should define this macro only in the very rare circumstances when it
+is not possible to calculate the offset between the frame pointer and
+the automatic variables until after register allocation has been
+completed. When this macro is defined, you must also indicate in your
+definition of @code{ELIMINABLE_REGS} how to eliminate
+@code{FRAME_POINTER_REGNUM} into either @code{HARD_FRAME_POINTER_REGNUM}
+or @code{STACK_POINTER_REGNUM}.
+
+Do not define this macro if it would be the same as
+@code{FRAME_POINTER_REGNUM}.
+@end defmac
+
+@defmac ARG_POINTER_REGNUM
+The register number of the arg pointer register, which is used to access
+the function's argument list. On some machines, this is the same as the
+frame pointer register. On some machines, the hardware determines which
+register this is. On other machines, you can choose any register you
+wish for this purpose. If this is not the same register as the frame
+pointer register, then you must mark it as a fixed register according to
+@code{FIXED_REGISTERS}, or arrange to be able to eliminate it
+(@pxref{Elimination}).
+@end defmac
+
+@defmac RETURN_ADDRESS_POINTER_REGNUM
+The register number of the return address pointer register, which is used to
+access the current function's return address from the stack. On some
+machines, the return address is not at a fixed offset from the frame
+pointer or stack pointer or argument pointer. This register can be defined
+to point to the return address on the stack, and then be converted by
+@code{ELIMINABLE_REGS} into either the frame pointer or stack pointer.
+
+Do not define this macro unless there is no other way to get the return
+address from the stack.
+@end defmac
+
+@defmac STATIC_CHAIN_REGNUM
+@defmacx STATIC_CHAIN_INCOMING_REGNUM
+Register numbers used for passing a function's static chain pointer. If
+register windows are used, the register number as seen by the called
+function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register
+number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}. If
+these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need
+not be defined.
+
+The static chain register need not be a fixed register.
+
+If the static chain is passed in memory, these macros should not be
+defined; instead, the @code{TARGET_STATIC_CHAIN} hook should be used.
+@end defmac
+
+@hook TARGET_STATIC_CHAIN
+This hook replaces the use of @code{STATIC_CHAIN_REGNUM} et al for
+targets that may use different static chain locations for different
+nested functions. This may be required if the target has function
+attributes that affect the calling conventions of the function and
+those calling conventions use different static chain locations.
+
+The default version of this hook uses @code{STATIC_CHAIN_REGNUM} et al.
+
+If the static chain is passed in memory, this hook should be used to
+provide rtx giving @code{mem} expressions that denote where they are stored.
+Often the @code{mem} expression as seen by the caller will be at an offset
+from the stack pointer and the @code{mem} expression as seen by the callee
+will be at an offset from the frame pointer.
+@findex stack_pointer_rtx
+@findex frame_pointer_rtx
+@findex arg_pointer_rtx
+The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and
+@code{arg_pointer_rtx} will have been initialized and should be used
+to refer to those items.
+@end deftypefn
+
+@defmac DWARF_FRAME_REGISTERS
+This macro specifies the maximum number of hard registers that can be
+saved in a call frame. This is used to size data structures used in
+DWARF2 exception handling.
+
+Prior to GCC 3.0, this macro was needed in order to establish a stable
+exception handling ABI in the face of adding new hard registers for ISA
+extensions. In GCC 3.0 and later, the EH ABI is insulated from changes
+in the number of hard registers. Nevertheless, this macro can still be
+used to reduce the runtime memory requirements of the exception handling
+routines, which can be substantial if the ISA contains a lot of
+registers that are not call-saved.
+
+If this macro is not defined, it defaults to
+@code{FIRST_PSEUDO_REGISTER}.
+@end defmac
+
+@defmac PRE_GCC3_DWARF_FRAME_REGISTERS
+
+This macro is similar to @code{DWARF_FRAME_REGISTERS}, but is provided
+for backward compatibility in pre GCC 3.0 compiled code.
+
+If this macro is not defined, it defaults to
+@code{DWARF_FRAME_REGISTERS}.
+@end defmac
+
+@defmac DWARF_REG_TO_UNWIND_COLUMN (@var{regno})
+
+Define this macro if the target's representation for dwarf registers
+is different than the internal representation for unwind column.
+Given a dwarf register, this macro should return the internal unwind
+column number to use instead.
+
+See the PowerPC's SPE target for an example.
+@end defmac
+
+@defmac DWARF_FRAME_REGNUM (@var{regno})
+
+Define this macro if the target's representation for dwarf registers
+used in .eh_frame or .debug_frame is different from that used in other
+debug info sections. Given a GCC hard register number, this macro
+should return the .eh_frame register number. The default is
+@code{DBX_REGISTER_NUMBER (@var{regno})}.
+
+@end defmac
+
+@defmac DWARF2_FRAME_REG_OUT (@var{regno}, @var{for_eh})
+
+Define this macro to map register numbers held in the call frame info
+that GCC has collected using @code{DWARF_FRAME_REGNUM} to those that
+should be output in .debug_frame (@code{@var{for_eh}} is zero) and
+.eh_frame (@code{@var{for_eh}} is nonzero). The default is to
+return @code{@var{regno}}.
+
+@end defmac
+
+@node Elimination
+@subsection Eliminating Frame Pointer and Arg Pointer
+
+@c prevent bad page break with this line
+This is about eliminating the frame pointer and arg pointer.
+
+@hook TARGET_FRAME_POINTER_REQUIRED
+This target hook should return @code{true} if a function must have and use
+a frame pointer. This target hook is called in the reload pass. If its return
+value is @code{true} the function will have a frame pointer.
+
+This target hook can in principle examine the current function and decide
+according to the facts, but on most machines the constant @code{false} or the
+constant @code{true} suffices. Use @code{false} when the machine allows code
+to be generated with no frame pointer, and doing so saves some time or space.
+Use @code{true} when there is no possible advantage to avoiding a frame
+pointer.
+
+In certain cases, the compiler does not know how to produce valid code
+without a frame pointer. The compiler recognizes those cases and
+automatically gives the function a frame pointer regardless of what
+@code{TARGET_FRAME_POINTER_REQUIRED} returns. You don't need to worry about
+them.
+
+In a function that does not require a frame pointer, the frame pointer
+register can be allocated for ordinary usage, unless you mark it as a
+fixed register. See @code{FIXED_REGISTERS} for more information.
+
+Default return value is @code{false}.
+@end deftypefn
+
+@findex get_frame_size
+@defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
+A C statement to store in the variable @var{depth-var} the difference
+between the frame pointer and the stack pointer values immediately after
+the function prologue. The value would be computed from information
+such as the result of @code{get_frame_size ()} and the tables of
+registers @code{regs_ever_live} and @code{call_used_regs}.
+
+If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
+need not be defined. Otherwise, it must be defined even if
+@code{TARGET_FRAME_POINTER_REQUIRED} always returns true; in that
+case, you may set @var{depth-var} to anything.
+@end defmac
+
+@defmac ELIMINABLE_REGS
+If defined, this macro specifies a table of register pairs used to
+eliminate unneeded registers that point into the stack frame. If it is not
+defined, the only elimination attempted by the compiler is to replace
+references to the frame pointer with references to the stack pointer.
+
+The definition of this macro is a list of structure initializations, each
+of which specifies an original and replacement register.
+
+On some machines, the position of the argument pointer is not known until
+the compilation is completed. In such a case, a separate hard register
+must be used for the argument pointer. This register can be eliminated by
+replacing it with either the frame pointer or the argument pointer,
+depending on whether or not the frame pointer has been eliminated.
+
+In this case, you might specify:
+@smallexample
+#define ELIMINABLE_REGS \
+@{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \
+ @{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \
+ @{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@}
+@end smallexample
+
+Note that the elimination of the argument pointer with the stack pointer is
+specified first since that is the preferred elimination.
+@end defmac
+
+@hook TARGET_CAN_ELIMINATE
+This target hook should returns @code{true} if the compiler is allowed to
+try to replace register number @var{from_reg} with register number
+@var{to_reg}. This target hook need only be defined if @code{ELIMINABLE_REGS}
+is defined, and will usually be @code{true}, since most of the cases
+preventing register elimination are things that the compiler already
+knows about.
+
+Default return value is @code{true}.
+@end deftypefn
+
+@defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
+This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It
+specifies the initial difference between the specified pair of
+registers. This macro must be defined if @code{ELIMINABLE_REGS} is
+defined.
+@end defmac
+
+@node Stack Arguments
+@subsection Passing Function Arguments on the Stack
+@cindex arguments on stack
+@cindex stack arguments
+
+The macros in this section control how arguments are passed
+on the stack. See the following section for other macros that
+control passing certain arguments in registers.
+
+@hook TARGET_PROMOTE_PROTOTYPES
+This target hook returns @code{true} if an argument declared in a
+prototype as an integral type smaller than @code{int} should actually be
+passed as an @code{int}. In addition to avoiding errors in certain
+cases of mismatch, it also makes for better code on certain machines.
+The default is to not promote prototypes.
+@end deftypefn
+
+@defmac PUSH_ARGS
+A C expression. If nonzero, push insns will be used to pass
+outgoing arguments.
+If the target machine does not have a push instruction, set it to zero.
+That directs GCC to use an alternate strategy: to
+allocate the entire argument block and then store the arguments into
+it. When @code{PUSH_ARGS} is nonzero, @code{PUSH_ROUNDING} must be defined too.
+@end defmac
+
+@defmac PUSH_ARGS_REVERSED
+A C expression. If nonzero, function arguments will be evaluated from
+last to first, rather than from first to last. If this macro is not
+defined, it defaults to @code{PUSH_ARGS} on targets where the stack
+and args grow in opposite directions, and 0 otherwise.
+@end defmac
+
+@defmac PUSH_ROUNDING (@var{npushed})
+A C expression that is the number of bytes actually pushed onto the
+stack when an instruction attempts to push @var{npushed} bytes.
+
+On some machines, the definition
+
+@smallexample
+#define PUSH_ROUNDING(BYTES) (BYTES)
+@end smallexample
+
+@noindent
+will suffice. But on other machines, instructions that appear
+to push one byte actually push two bytes in an attempt to maintain
+alignment. Then the definition should be
+
+@smallexample
+#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
+@end smallexample
+@end defmac
+
+@findex current_function_outgoing_args_size
+@defmac ACCUMULATE_OUTGOING_ARGS
+A C expression. If nonzero, the maximum amount of space required for outgoing arguments
+will be computed and placed into the variable
+@code{current_function_outgoing_args_size}. No space will be pushed
+onto the stack for each call; instead, the function prologue should
+increase the stack frame size by this amount.
+
+Setting both @code{PUSH_ARGS} and @code{ACCUMULATE_OUTGOING_ARGS}
+is not proper.
+@end defmac
+
+@defmac REG_PARM_STACK_SPACE (@var{fndecl})
+Define this macro if functions should assume that stack space has been
+allocated for arguments even when their values are passed in
+registers.
+
+The value of this macro is the size, in bytes, of the area reserved for
+arguments passed in registers for the function represented by @var{fndecl},
+which can be zero if GCC is calling a library function.
+The argument @var{fndecl} can be the FUNCTION_DECL, or the type itself
+of the function.
+
+This space can be allocated by the caller, or be a part of the
+machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says
+which.
+@end defmac
+@c above is overfull. not sure what to do. --mew 5feb93 did
+@c something, not sure if it looks good. --mew 10feb93
+
+@defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype})
+Define this to a nonzero value if it is the responsibility of the
+caller to allocate the area reserved for arguments passed in registers
+when calling a function of @var{fntype}. @var{fntype} may be NULL
+if the function called is a library function.
+
+If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls
+whether the space for these arguments counts in the value of
+@code{current_function_outgoing_args_size}.
+@end defmac
+
+@defmac STACK_PARMS_IN_REG_PARM_AREA
+Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the
+stack parameters don't skip the area specified by it.
+@c i changed this, makes more sens and it should have taken care of the
+@c overfull.. not as specific, tho. --mew 5feb93
+
+Normally, when a parameter is not passed in registers, it is placed on the
+stack beyond the @code{REG_PARM_STACK_SPACE} area. Defining this macro
+suppresses this behavior and causes the parameter to be passed on the
+stack in its natural location.
+@end defmac
+
+@hook TARGET_RETURN_POPS_ARGS
+This target hook returns the number of bytes of its own arguments that
+a function pops on returning, or 0 if the function pops no arguments
+and the caller must therefore pop them all after the function returns.
+
+@var{fundecl} is a C variable whose value is a tree node that describes
+the function in question. Normally it is a node of type
+@code{FUNCTION_DECL} that describes the declaration of the function.
+From this you can obtain the @code{DECL_ATTRIBUTES} of the function.
+
+@var{funtype} is a C variable whose value is a tree node that
+describes the function in question. Normally it is a node of type
+@code{FUNCTION_TYPE} that describes the data type of the function.
+From this it is possible to obtain the data types of the value and
+arguments (if known).
+
+When a call to a library function is being considered, @var{fundecl}
+will contain an identifier node for the library function. Thus, if
+you need to distinguish among various library functions, you can do so
+by their names. Note that ``library function'' in this context means
+a function used to perform arithmetic, whose name is known specially
+in the compiler and was not mentioned in the C code being compiled.
+
+@var{size} is the number of bytes of arguments passed on the
+stack. If a variable number of bytes is passed, it is zero, and
+argument popping will always be the responsibility of the calling function.
+
+On the VAX, all functions always pop their arguments, so the definition
+of this macro is @var{size}. On the 68000, using the standard
+calling convention, no functions pop their arguments, so the value of
+the macro is always 0 in this case. But an alternative calling
+convention is available in which functions that take a fixed number of
+arguments pop them but other functions (such as @code{printf}) pop
+nothing (the caller pops all). When this convention is in use,
+@var{funtype} is examined to determine whether a function takes a fixed
+number of arguments.
+@end deftypefn
+
+@defmac CALL_POPS_ARGS (@var{cum})
+A C expression that should indicate the number of bytes a call sequence
+pops off the stack. It is added to the value of @code{RETURN_POPS_ARGS}
+when compiling a function call.
+
+@var{cum} is the variable in which all arguments to the called function
+have been accumulated.
+
+On certain architectures, such as the SH5, a call trampoline is used
+that pops certain registers off the stack, depending on the arguments
+that have been passed to the function. Since this is a property of the
+call site, not of the called function, @code{RETURN_POPS_ARGS} is not
+appropriate.
+@end defmac
+
+@node Register Arguments
+@subsection Passing Arguments in Registers
+@cindex arguments in registers
+@cindex registers arguments
+
+This section describes the macros which let you control how various
+types of arguments are passed in registers or how they are arranged in
+the stack.
+
+@defmac FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
+A C expression that controls whether a function argument is passed
+in a register, and which register.
+
+The arguments are @var{cum}, which summarizes all the previous
+arguments; @var{mode}, the machine mode of the argument; @var{type},
+the data type of the argument as a tree node or 0 if that is not known
+(which happens for C support library functions); and @var{named},
+which is 1 for an ordinary argument and 0 for nameless arguments that
+correspond to @samp{@dots{}} in the called function's prototype.
+@var{type} can be an incomplete type if a syntax error has previously
+occurred.
+
+The value of the expression is usually either a @code{reg} RTX for the
+hard register in which to pass the argument, or zero to pass the
+argument on the stack.
+
+For machines like the VAX and 68000, where normally all arguments are
+pushed, zero suffices as a definition.
+
+The value of the expression can also be a @code{parallel} RTX@. This is
+used when an argument is passed in multiple locations. The mode of the
+@code{parallel} should be the mode of the entire argument. The
+@code{parallel} holds any number of @code{expr_list} pairs; each one
+describes where part of the argument is passed. In each
+@code{expr_list} the first operand must be a @code{reg} RTX for the hard
+register in which to pass this part of the argument, and the mode of the
+register RTX indicates how large this part of the argument is. The
+second operand of the @code{expr_list} is a @code{const_int} which gives
+the offset in bytes into the entire argument of where this part starts.
+As a special exception the first @code{expr_list} in the @code{parallel}
+RTX may have a first operand of zero. This indicates that the entire
+argument is also stored on the stack.
+
+The last time this macro is called, it is called with @code{MODE ==
+VOIDmode}, and its result is passed to the @code{call} or @code{call_value}
+pattern as operands 2 and 3 respectively.
+
+@cindex @file{stdarg.h} and register arguments
+The usual way to make the ISO library @file{stdarg.h} work on a machine
+where some arguments are usually passed in registers, is to cause
+nameless arguments to be passed on the stack instead. This is done
+by making @code{FUNCTION_ARG} return 0 whenever @var{named} is 0.
+
+@cindex @code{TARGET_MUST_PASS_IN_STACK}, and @code{FUNCTION_ARG}
+@cindex @code{REG_PARM_STACK_SPACE}, and @code{FUNCTION_ARG}
+You may use the hook @code{targetm.calls.must_pass_in_stack}
+in the definition of this macro to determine if this argument is of a
+type that must be passed in the stack. If @code{REG_PARM_STACK_SPACE}
+is not defined and @code{FUNCTION_ARG} returns nonzero for such an
+argument, the compiler will abort. If @code{REG_PARM_STACK_SPACE} is
+defined, the argument will be computed in the stack and then loaded into
+a register.
+@end defmac
+
+@hook TARGET_MUST_PASS_IN_STACK
+This target hook should return @code{true} if we should not pass @var{type}
+solely in registers. The file @file{expr.h} defines a
+definition that is usually appropriate, refer to @file{expr.h} for additional
+documentation.
+@end deftypefn
+
+@defmac FUNCTION_INCOMING_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
+Define this macro if the target machine has ``register windows'', so
+that the register in which a function sees an arguments is not
+necessarily the same as the one in which the caller passed the
+argument.
+
+For such machines, @code{FUNCTION_ARG} computes the register in which
+the caller passes the value, and @code{FUNCTION_INCOMING_ARG} should
+be defined in a similar fashion to tell the function being called
+where the arguments will arrive.
+
+If @code{FUNCTION_INCOMING_ARG} is not defined, @code{FUNCTION_ARG}
+serves both purposes.
+@end defmac
+
+@hook TARGET_ARG_PARTIAL_BYTES
+This target hook returns the number of bytes at the beginning of an
+argument that must be put in registers. The value must be zero for
+arguments that are passed entirely in registers or that are entirely
+pushed on the stack.
+
+On some machines, certain arguments must be passed partially in
+registers and partially in memory. On these machines, typically the
+first few words of arguments are passed in registers, and the rest
+on the stack. If a multi-word argument (a @code{double} or a
+structure) crosses that boundary, its first few words must be passed
+in registers and the rest must be pushed. This macro tells the
+compiler when this occurs, and how many bytes should go in registers.
+
+@code{FUNCTION_ARG} for these arguments should return the first
+register to be used by the caller for this argument; likewise
+@code{FUNCTION_INCOMING_ARG}, for the called function.
+@end deftypefn
+
+@hook TARGET_PASS_BY_REFERENCE
+This target hook should return @code{true} if an argument at the
+position indicated by @var{cum} should be passed by reference. This
+predicate is queried after target independent reasons for being
+passed by reference, such as @code{TREE_ADDRESSABLE (type)}.
+
+If the hook returns true, a copy of that argument is made in memory and a
+pointer to the argument is passed instead of the argument itself.
+The pointer is passed in whatever way is appropriate for passing a pointer
+to that type.
+@end deftypefn
+
+@hook TARGET_CALLEE_COPIES
+The function argument described by the parameters to this hook is
+known to be passed by reference. The hook should return true if the
+function argument should be copied by the callee instead of copied
+by the caller.
+
+For any argument for which the hook returns true, if it can be
+determined that the argument is not modified, then a copy need
+not be generated.
+
+The default version of this hook always returns false.
+@end deftypefn
+
+@defmac CUMULATIVE_ARGS
+A C type for declaring a variable that is used as the first argument of
+@code{FUNCTION_ARG} and other related values. For some target machines,
+the type @code{int} suffices and can hold the number of bytes of
+argument so far.
+
+There is no need to record in @code{CUMULATIVE_ARGS} anything about the
+arguments that have been passed on the stack. The compiler has other
+variables to keep track of that. For target machines on which all
+arguments are passed on the stack, there is no need to store anything in
+@code{CUMULATIVE_ARGS}; however, the data structure must exist and
+should not be empty, so use @code{int}.
+@end defmac
+
+@defmac OVERRIDE_ABI_FORMAT (@var{fndecl})
+If defined, this macro is called before generating any code for a
+function, but after the @var{cfun} descriptor for the function has been
+created. The back end may use this macro to update @var{cfun} to
+reflect an ABI other than that which would normally be used by default.
+If the compiler is generating code for a compiler-generated function,
+@var{fndecl} may be @code{NULL}.
+@end defmac
+
+@defmac INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname}, @var{fndecl}, @var{n_named_args})
+A C statement (sans semicolon) for initializing the variable
+@var{cum} for the state at the beginning of the argument list. The
+variable has type @code{CUMULATIVE_ARGS}. The value of @var{fntype}
+is the tree node for the data type of the function which will receive
+the args, or 0 if the args are to a compiler support library function.
+For direct calls that are not libcalls, @var{fndecl} contain the
+declaration node of the function. @var{fndecl} is also set when
+@code{INIT_CUMULATIVE_ARGS} is used to find arguments for the function
+being compiled. @var{n_named_args} is set to the number of named
+arguments, including a structure return address if it is passed as a
+parameter, when making a call. When processing incoming arguments,
+@var{n_named_args} is set to @minus{}1.
+
+When processing a call to a compiler support library function,
+@var{libname} identifies which one. It is a @code{symbol_ref} rtx which
+contains the name of the function, as a string. @var{libname} is 0 when
+an ordinary C function call is being processed. Thus, each time this
+macro is called, either @var{libname} or @var{fntype} is nonzero, but
+never both of them at once.
+@end defmac
+
+@defmac INIT_CUMULATIVE_LIBCALL_ARGS (@var{cum}, @var{mode}, @var{libname})
+Like @code{INIT_CUMULATIVE_ARGS} but only used for outgoing libcalls,
+it gets a @code{MODE} argument instead of @var{fntype}, that would be
+@code{NULL}. @var{indirect} would always be zero, too. If this macro
+is not defined, @code{INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname,
+0)} is used instead.
+@end defmac
+
+@defmac INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname})
+Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of
+finding the arguments for the function being compiled. If this macro is
+undefined, @code{INIT_CUMULATIVE_ARGS} is used instead.
+
+The value passed for @var{libname} is always 0, since library routines
+with special calling conventions are never compiled with GCC@. The
+argument @var{libname} exists for symmetry with
+@code{INIT_CUMULATIVE_ARGS}.
+@c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe.
+@c --mew 5feb93 i switched the order of the sentences. --mew 10feb93
+@end defmac
+
+@defmac FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named})
+A C statement (sans semicolon) to update the summarizer variable
+@var{cum} to advance past an argument in the argument list. The
+values @var{mode}, @var{type} and @var{named} describe that argument.
+Once this is done, the variable @var{cum} is suitable for analyzing
+the @emph{following} argument with @code{FUNCTION_ARG}, etc.
+
+This macro need not do anything if the argument in question was passed
+on the stack. The compiler knows how to track the amount of stack space
+used for arguments without any special help.
+@end defmac
+
+@defmac FUNCTION_ARG_OFFSET (@var{mode}, @var{type})
+If defined, a C expression that is the number of bytes to add to the
+offset of the argument passed in memory. This is needed for the SPU,
+which passes @code{char} and @code{short} arguments in the preferred
+slot that is in the middle of the quad word instead of starting at the
+top.
+@end defmac
+
+@defmac FUNCTION_ARG_PADDING (@var{mode}, @var{type})
+If defined, a C expression which determines whether, and in which direction,
+to pad out an argument with extra space. The value should be of type
+@code{enum direction}: either @code{upward} to pad above the argument,
+@code{downward} to pad below, or @code{none} to inhibit padding.
+
+The @emph{amount} of padding is always just enough to reach the next
+multiple of @code{FUNCTION_ARG_BOUNDARY}; this macro does not control
+it.
+
+This macro has a default definition which is right for most systems.
+For little-endian machines, the default is to pad upward. For
+big-endian machines, the default is to pad downward for an argument of
+constant size shorter than an @code{int}, and upward otherwise.
+@end defmac
+
+@defmac PAD_VARARGS_DOWN
+If defined, a C expression which determines whether the default
+implementation of va_arg will attempt to pad down before reading the
+next argument, if that argument is smaller than its aligned space as
+controlled by @code{PARM_BOUNDARY}. If this macro is not defined, all such
+arguments are padded down if @code{BYTES_BIG_ENDIAN} is true.
+@end defmac
+
+@defmac BLOCK_REG_PADDING (@var{mode}, @var{type}, @var{first})
+Specify padding for the last element of a block move between registers and
+memory. @var{first} is nonzero if this is the only element. Defining this
+macro allows better control of register function parameters on big-endian
+machines, without using @code{PARALLEL} rtl. In particular,
+@code{MUST_PASS_IN_STACK} need not test padding and mode of types in
+registers, as there is no longer a "wrong" part of a register; For example,
+a three byte aggregate may be passed in the high part of a register if so
+required.
+@end defmac
+
+@defmac FUNCTION_ARG_BOUNDARY (@var{mode}, @var{type})
+If defined, a C expression that gives the alignment boundary, in bits,
+of an argument with the specified mode and type. If it is not defined,
+@code{PARM_BOUNDARY} is used for all arguments.
+@end defmac
+
+@defmac FUNCTION_ARG_REGNO_P (@var{regno})
+A C expression that is nonzero if @var{regno} is the number of a hard
+register in which function arguments are sometimes passed. This does
+@emph{not} include implicit arguments such as the static chain and
+the structure-value address. On many machines, no registers can be
+used for this purpose since all function arguments are pushed on the
+stack.
+@end defmac
+
+@hook TARGET_SPLIT_COMPLEX_ARG
+This hook should return true if parameter of type @var{type} are passed
+as two scalar parameters. By default, GCC will attempt to pack complex
+arguments into the target's word size. Some ABIs require complex arguments
+to be split and treated as their individual components. For example, on
+AIX64, complex floats should be passed in a pair of floating point
+registers, even though a complex float would fit in one 64-bit floating
+point register.
+
+The default value of this hook is @code{NULL}, which is treated as always
+false.
+@end deftypefn
+
+@hook TARGET_BUILD_BUILTIN_VA_LIST
+This hook returns a type node for @code{va_list} for the target.
+The default version of the hook returns @code{void*}.
+@end deftypefn
+
+@hook TARGET_ENUM_VA_LIST_P
+This target hook is used in function @code{c_common_nodes_and_builtins}
+to iterate through the target specific builtin types for va_list. The
+variable @var{idx} is used as iterator. @var{pname} has to be a pointer
+to a @code{const char *} and @var{ptree} a pointer to a @code{tree} typed
+variable.
+The arguments @var{pname} and @var{ptree} are used to store the result of
+this macro and are set to the name of the va_list builtin type and its
+internal type.
+If the return value of this macro is zero, then there is no more element.
+Otherwise the @var{IDX} should be increased for the next call of this
+macro to iterate through all types.
+@end deftypefn
+
+@hook TARGET_FN_ABI_VA_LIST
+This hook returns the va_list type of the calling convention specified by
+@var{fndecl}.
+The default version of this hook returns @code{va_list_type_node}.
+@end deftypefn
+
+@hook TARGET_CANONICAL_VA_LIST_TYPE
+This hook returns the va_list type of the calling convention specified by the
+type of @var{type}. If @var{type} is not a valid va_list type, it returns
+@code{NULL_TREE}.
+@end deftypefn
+
+@hook TARGET_GIMPLIFY_VA_ARG_EXPR
+This hook performs target-specific gimplification of
+@code{VA_ARG_EXPR}. The first two parameters correspond to the
+arguments to @code{va_arg}; the latter two are as in
+@code{gimplify.c:gimplify_expr}.
+@end deftypefn
+
+@hook TARGET_VALID_POINTER_MODE
+Define this to return nonzero if the port can handle pointers
+with machine mode @var{mode}. The default version of this
+hook returns true for both @code{ptr_mode} and @code{Pmode}.
+@end deftypefn
+
+@hook TARGET_SCALAR_MODE_SUPPORTED_P
+Define this to return nonzero if the port is prepared to handle
+insns involving scalar mode @var{mode}. For a scalar mode to be
+considered supported, all the basic arithmetic and comparisons
+must work.
+
+The default version of this hook returns true for any mode
+required to handle the basic C types (as defined by the port).
+Included here are the double-word arithmetic supported by the
+code in @file{optabs.c}.
+@end deftypefn
+
+@hook TARGET_VECTOR_MODE_SUPPORTED_P
+Define this to return nonzero if the port is prepared to handle
+insns involving vector mode @var{mode}. At the very least, it
+must have move patterns for this mode.
+@end deftypefn
+
+@hook TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P
+Define this to return nonzero for machine modes for which the port has
+small register classes. If this target hook returns nonzero for a given
+@var{mode}, the compiler will try to minimize the lifetime of registers
+in @var{mode}. The hook may be called with @code{VOIDmode} as argument.
+In this case, the hook is expected to return nonzero if it returns nonzero
+for any mode.
+
+On some machines, it is risky to let hard registers live across arbitrary
+insns. Typically, these machines have instructions that require values
+to be in specific registers (like an accumulator), and reload will fail
+if the required hard register is used for another purpose across such an
+insn.
+
+Passes before reload do not know which hard registers will be used
+in an instruction, but the machine modes of the registers set or used in
+the instruction are already known. And for some machines, register
+classes are small for, say, integer registers but not for floating point
+registers. For example, the AMD x86-64 architecture requires specific
+registers for the legacy x86 integer instructions, but there are many
+SSE registers for floating point operations. On such targets, a good
+strategy may be to return nonzero from this hook for @code{INTEGRAL_MODE_P}
+machine modes but zero for the SSE register classes.
+
+The default version of this hook retuns false for any mode. It is always
+safe to redefine this hook to return with a nonzero value. But if you
+unnecessarily define it, you will reduce the amount of optimizations
+that can be performed in some cases. If you do not define this hook
+to return a nonzero value when it is required, the compiler will run out
+of spill registers and print a fatal error message.
+@end deftypefn
+
+@node Scalar Return
+@subsection How Scalar Function Values Are Returned
+@cindex return values in registers
+@cindex values, returned by functions
+@cindex scalars, returned as values
+
+This section discusses the macros that control returning scalars as
+values---values that can fit in registers.
+
+@hook TARGET_FUNCTION_VALUE
+
+Define this to return an RTX representing the place where a function
+returns or receives a value of data type @var{ret_type}, a tree node
+representing a data type. @var{fn_decl_or_type} is a tree node
+representing @code{FUNCTION_DECL} or @code{FUNCTION_TYPE} of a
+function being called. If @var{outgoing} is false, the hook should
+compute the register in which the caller will see the return value.
+Otherwise, the hook should return an RTX representing the place where
+a function returns a value.
+
+On many machines, only @code{TYPE_MODE (@var{ret_type})} is relevant.
+(Actually, on most machines, scalar values are returned in the same
+place regardless of mode.) The value of the expression is usually a
+@code{reg} RTX for the hard register where the return value is stored.
+The value can also be a @code{parallel} RTX, if the return value is in
+multiple places. See @code{FUNCTION_ARG} for an explanation of the
+@code{parallel} form. Note that the callee will populate every
+location specified in the @code{parallel}, but if the first element of
+the @code{parallel} contains the whole return value, callers will use
+that element as the canonical location and ignore the others. The m68k
+port uses this type of @code{parallel} to return pointers in both
+@samp{%a0} (the canonical location) and @samp{%d0}.
+
+If @code{TARGET_PROMOTE_FUNCTION_RETURN} returns true, you must apply
+the same promotion rules specified in @code{PROMOTE_MODE} if
+@var{valtype} is a scalar type.
+
+If the precise function being called is known, @var{func} is a tree
+node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
+pointer. This makes it possible to use a different value-returning
+convention for specific functions when all their calls are
+known.
+
+Some target machines have ``register windows'' so that the register in
+which a function returns its value is not the same as the one in which
+the caller sees the value. For such machines, you should return
+different RTX depending on @var{outgoing}.
+
+@code{TARGET_FUNCTION_VALUE} is not used for return values with
+aggregate data types, because these are returned in another way. See
+@code{TARGET_STRUCT_VALUE_RTX} and related macros, below.
+@end deftypefn
+
+@defmac FUNCTION_VALUE (@var{valtype}, @var{func})
+This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE} for
+a new target instead.
+@end defmac
+
+@defmac LIBCALL_VALUE (@var{mode})
+A C expression to create an RTX representing the place where a library
+function returns a value of mode @var{mode}.
+
+Note that ``library function'' in this context means a compiler
+support routine, used to perform arithmetic, whose name is known
+specially by the compiler and was not mentioned in the C code being
+compiled.
+@end defmac
+
+@hook TARGET_LIBCALL_VALUE
+Define this hook if the back-end needs to know the name of the libcall
+function in order to determine where the result should be returned.
+
+The mode of the result is given by @var{mode} and the name of the called
+library function is given by @var{fun}. The hook should return an RTX
+representing the place where the library function result will be returned.
+
+If this hook is not defined, then LIBCALL_VALUE will be used.
+@end deftypefn
+
+@defmac FUNCTION_VALUE_REGNO_P (@var{regno})
+A C expression that is nonzero if @var{regno} is the number of a hard
+register in which the values of called function may come back.
+
+A register whose use for returning values is limited to serving as the
+second of a pair (for a value of type @code{double}, say) need not be
+recognized by this macro. So for most machines, this definition
+suffices:
+
+@smallexample
+#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
+@end smallexample
+
+If the machine has register windows, so that the caller and the called
+function use different registers for the return value, this macro
+should recognize only the caller's register numbers.
+
+This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE_REGNO_P}
+for a new target instead.
+@end defmac
+
+@hook TARGET_FUNCTION_VALUE_REGNO_P
+A target hook that return @code{true} if @var{regno} is the number of a hard
+register in which the values of called function may come back.
+
+A register whose use for returning values is limited to serving as the
+second of a pair (for a value of type @code{double}, say) need not be
+recognized by this target hook.
+
+If the machine has register windows, so that the caller and the called
+function use different registers for the return value, this target hook
+should recognize only the caller's register numbers.
+
+If this hook is not defined, then FUNCTION_VALUE_REGNO_P will be used.
+@end deftypefn
+
+@defmac APPLY_RESULT_SIZE
+Define this macro if @samp{untyped_call} and @samp{untyped_return}
+need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for
+saving and restoring an arbitrary return value.
+@end defmac
+
+@hook TARGET_RETURN_IN_MSB
+This hook should return true if values of type @var{type} are returned
+at the most significant end of a register (in other words, if they are
+padded at the least significant end). You can assume that @var{type}
+is returned in a register; the caller is required to check this.
+
+Note that the register provided by @code{TARGET_FUNCTION_VALUE} must
+be able to hold the complete return value. For example, if a 1-, 2-
+or 3-byte structure is returned at the most significant end of a
+4-byte register, @code{TARGET_FUNCTION_VALUE} should provide an
+@code{SImode} rtx.
+@end deftypefn
+
+@node Aggregate Return
+@subsection How Large Values Are Returned
+@cindex aggregates as return values
+@cindex large return values
+@cindex returning aggregate values
+@cindex structure value address
+
+When a function value's mode is @code{BLKmode} (and in some other
+cases), the value is not returned according to
+@code{TARGET_FUNCTION_VALUE} (@pxref{Scalar Return}). Instead, the
+caller passes the address of a block of memory in which the value
+should be stored. This address is called the @dfn{structure value
+address}.
+
+This section describes how to control returning structure values in
+memory.
+
+@hook TARGET_RETURN_IN_MEMORY
+This target hook should return a nonzero value to say to return the
+function value in memory, just as large structures are always returned.
+Here @var{type} will be the data type of the value, and @var{fntype}
+will be the type of the function doing the returning, or @code{NULL} for
+libcalls.
+
+Note that values of mode @code{BLKmode} must be explicitly handled
+by this function. Also, the option @option{-fpcc-struct-return}
+takes effect regardless of this macro. On most systems, it is
+possible to leave the hook undefined; this causes a default
+definition to be used, whose value is the constant 1 for @code{BLKmode}
+values, and 0 otherwise.
+
+Do not use this hook to indicate that structures and unions should always
+be returned in memory. You should instead use @code{DEFAULT_PCC_STRUCT_RETURN}
+to indicate this.
+@end deftypefn
+
+@defmac DEFAULT_PCC_STRUCT_RETURN
+Define this macro to be 1 if all structure and union return values must be
+in memory. Since this results in slower code, this should be defined
+only if needed for compatibility with other compilers or with an ABI@.
+If you define this macro to be 0, then the conventions used for structure
+and union return values are decided by the @code{TARGET_RETURN_IN_MEMORY}
+target hook.
+
+If not defined, this defaults to the value 1.
+@end defmac
+
+@hook TARGET_STRUCT_VALUE_RTX
+This target hook should return the location of the structure value
+address (normally a @code{mem} or @code{reg}), or 0 if the address is
+passed as an ``invisible'' first argument. Note that @var{fndecl} may
+be @code{NULL}, for libcalls. You do not need to define this target
+hook if the address is always passed as an ``invisible'' first
+argument.
+
+On some architectures the place where the structure value address
+is found by the called function is not the same place that the
+caller put it. This can be due to register windows, or it could
+be because the function prologue moves it to a different place.
+@var{incoming} is @code{1} or @code{2} when the location is needed in
+the context of the called function, and @code{0} in the context of
+the caller.
+
+If @var{incoming} is nonzero and the address is to be found on the
+stack, return a @code{mem} which refers to the frame pointer. If
+@var{incoming} is @code{2}, the result is being used to fetch the
+structure value address at the beginning of a function. If you need
+to emit adjusting code, you should do it at this point.
+@end deftypefn
+
+@defmac PCC_STATIC_STRUCT_RETURN
+Define this macro if the usual system convention on the target machine
+for returning structures and unions is for the called function to return
+the address of a static variable containing the value.
+
+Do not define this if the usual system convention is for the caller to
+pass an address to the subroutine.
+
+This macro has effect in @option{-fpcc-struct-return} mode, but it does
+nothing when you use @option{-freg-struct-return} mode.
+@end defmac
+
+@node Caller Saves
+@subsection Caller-Saves Register Allocation
+
+If you enable it, GCC can save registers around function calls. This
+makes it possible to use call-clobbered registers to hold variables that
+must live across calls.
+
+@defmac CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls})
+A C expression to determine whether it is worthwhile to consider placing
+a pseudo-register in a call-clobbered hard register and saving and
+restoring it around each function call. The expression should be 1 when
+this is worth doing, and 0 otherwise.
+
+If you don't define this macro, a default is used which is good on most
+machines: @code{4 * @var{calls} < @var{refs}}.
+@end defmac
+
+@defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs})
+A C expression specifying which mode is required for saving @var{nregs}
+of a pseudo-register in call-clobbered hard register @var{regno}. If
+@var{regno} is unsuitable for caller save, @code{VOIDmode} should be
+returned. For most machines this macro need not be defined since GCC
+will select the smallest suitable mode.
+@end defmac
+
+@node Function Entry
+@subsection Function Entry and Exit
+@cindex function entry and exit
+@cindex prologue
+@cindex epilogue
+
+This section describes the macros that output function entry
+(@dfn{prologue}) and exit (@dfn{epilogue}) code.
+
+@hook TARGET_ASM_FUNCTION_PROLOGUE
+If defined, a function that outputs the assembler code for entry to a
+function. The prologue is responsible for setting up the stack frame,
+initializing the frame pointer register, saving registers that must be
+saved, and allocating @var{size} additional bytes of storage for the
+local variables. @var{size} is an integer. @var{file} is a stdio
+stream to which the assembler code should be output.
+
+The label for the beginning of the function need not be output by this
+macro. That has already been done when the macro is run.
+
+@findex regs_ever_live
+To determine which registers to save, the macro can refer to the array
+@code{regs_ever_live}: element @var{r} is nonzero if hard register
+@var{r} is used anywhere within the function. This implies the function
+prologue should save register @var{r}, provided it is not one of the
+call-used registers. (@code{TARGET_ASM_FUNCTION_EPILOGUE} must likewise use
+@code{regs_ever_live}.)
+
+On machines that have ``register windows'', the function entry code does
+not save on the stack the registers that are in the windows, even if
+they are supposed to be preserved by function calls; instead it takes
+appropriate steps to ``push'' the register stack, if any non-call-used
+registers are used in the function.
+
+@findex frame_pointer_needed
+On machines where functions may or may not have frame-pointers, the
+function entry code must vary accordingly; it must set up the frame
+pointer if one is wanted, and not otherwise. To determine whether a
+frame pointer is in wanted, the macro can refer to the variable
+@code{frame_pointer_needed}. The variable's value will be 1 at run
+time in a function that needs a frame pointer. @xref{Elimination}.
+
+The function entry code is responsible for allocating any stack space
+required for the function. This stack space consists of the regions
+listed below. In most cases, these regions are allocated in the
+order listed, with the last listed region closest to the top of the
+stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and
+the highest address if it is not defined). You can use a different order
+for a machine if doing so is more convenient or required for
+compatibility reasons. Except in cases where required by standard
+or by a debugger, there is no reason why the stack layout used by GCC
+need agree with that used by other compilers for a machine.
+@end deftypefn
+
+@hook TARGET_ASM_FUNCTION_END_PROLOGUE
+If defined, a function that outputs assembler code at the end of a
+prologue. This should be used when the function prologue is being
+emitted as RTL, and you have some extra assembler that needs to be
+emitted. @xref{prologue instruction pattern}.
+@end deftypefn
+
+@hook TARGET_ASM_FUNCTION_BEGIN_EPILOGUE
+If defined, a function that outputs assembler code at the start of an
+epilogue. This should be used when the function epilogue is being
+emitted as RTL, and you have some extra assembler that needs to be
+emitted. @xref{epilogue instruction pattern}.
+@end deftypefn
+
+@hook TARGET_ASM_FUNCTION_EPILOGUE
+If defined, a function that outputs the assembler code for exit from a
+function. The epilogue is responsible for restoring the saved
+registers and stack pointer to their values when the function was
+called, and returning control to the caller. This macro takes the
+same arguments as the macro @code{TARGET_ASM_FUNCTION_PROLOGUE}, and the
+registers to restore are determined from @code{regs_ever_live} and
+@code{CALL_USED_REGISTERS} in the same way.
+
+On some machines, there is a single instruction that does all the work
+of returning from the function. On these machines, give that
+instruction the name @samp{return} and do not define the macro
+@code{TARGET_ASM_FUNCTION_EPILOGUE} at all.
+
+Do not define a pattern named @samp{return} if you want the
+@code{TARGET_ASM_FUNCTION_EPILOGUE} to be used. If you want the target
+switches to control whether return instructions or epilogues are used,
+define a @samp{return} pattern with a validity condition that tests the
+target switches appropriately. If the @samp{return} pattern's validity
+condition is false, epilogues will be used.
+
+On machines where functions may or may not have frame-pointers, the
+function exit code must vary accordingly. Sometimes the code for these
+two cases is completely different. To determine whether a frame pointer
+is wanted, the macro can refer to the variable
+@code{frame_pointer_needed}. The variable's value will be 1 when compiling
+a function that needs a frame pointer.
+
+Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and
+@code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially.
+The C variable @code{current_function_is_leaf} is nonzero for such a
+function. @xref{Leaf Functions}.
+
+On some machines, some functions pop their arguments on exit while
+others leave that for the caller to do. For example, the 68020 when
+given @option{-mrtd} pops arguments in functions that take a fixed
+number of arguments.
+
+@findex current_function_pops_args
+Your definition of the macro @code{RETURN_POPS_ARGS} decides which
+functions pop their own arguments. @code{TARGET_ASM_FUNCTION_EPILOGUE}
+needs to know what was decided. The number of bytes of the current
+function's arguments that this function should pop is available in
+@code{crtl->args.pops_args}. @xref{Scalar Return}.
+@end deftypefn
+
+@itemize @bullet
+@item
+@findex current_function_pretend_args_size
+A region of @code{current_function_pretend_args_size} bytes of
+uninitialized space just underneath the first argument arriving on the
+stack. (This may not be at the very start of the allocated stack region
+if the calling sequence has pushed anything else since pushing the stack
+arguments. But usually, on such machines, nothing else has been pushed
+yet, because the function prologue itself does all the pushing.) This
+region is used on machines where an argument may be passed partly in
+registers and partly in memory, and, in some cases to support the
+features in @code{<stdarg.h>}.
+
+@item
+An area of memory used to save certain registers used by the function.
+The size of this area, which may also include space for such things as
+the return address and pointers to previous stack frames, is
+machine-specific and usually depends on which registers have been used
+in the function. Machines with register windows often do not require
+a save area.
+
+@item
+A region of at least @var{size} bytes, possibly rounded up to an allocation
+boundary, to contain the local variables of the function. On some machines,
+this region and the save area may occur in the opposite order, with the
+save area closer to the top of the stack.
+
+@item
+@cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
+Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of
+@code{current_function_outgoing_args_size} bytes to be used for outgoing
+argument lists of the function. @xref{Stack Arguments}.
+@end itemize
+
+@defmac EXIT_IGNORE_STACK
+Define this macro as a C expression that is nonzero if the return
+instruction or the function epilogue ignores the value of the stack
+pointer; in other words, if it is safe to delete an instruction to
+adjust the stack pointer before a return from the function. The
+default is 0.
+
+Note that this macro's value is relevant only for functions for which
+frame pointers are maintained. It is never safe to delete a final
+stack adjustment in a function that has no frame pointer, and the
+compiler knows this regardless of @code{EXIT_IGNORE_STACK}.
+@end defmac
+
+@defmac EPILOGUE_USES (@var{regno})
+Define this macro as a C expression that is nonzero for registers that are
+used by the epilogue or the @samp{return} pattern. The stack and frame
+pointer registers are already assumed to be used as needed.
+@end defmac
+
+@defmac EH_USES (@var{regno})
+Define this macro as a C expression that is nonzero for registers that are
+used by the exception handling mechanism, and so should be considered live
+on entry to an exception edge.
+@end defmac
+
+@defmac DELAY_SLOTS_FOR_EPILOGUE
+Define this macro if the function epilogue contains delay slots to which
+instructions from the rest of the function can be ``moved''. The
+definition should be a C expression whose value is an integer
+representing the number of delay slots there.
+@end defmac
+
+@defmac ELIGIBLE_FOR_EPILOGUE_DELAY (@var{insn}, @var{n})
+A C expression that returns 1 if @var{insn} can be placed in delay
+slot number @var{n} of the epilogue.
+
+The argument @var{n} is an integer which identifies the delay slot now
+being considered (since different slots may have different rules of
+eligibility). It is never negative and is always less than the number
+of epilogue delay slots (what @code{DELAY_SLOTS_FOR_EPILOGUE} returns).
+If you reject a particular insn for a given delay slot, in principle, it
+may be reconsidered for a subsequent delay slot. Also, other insns may
+(at least in principle) be considered for the so far unfilled delay
+slot.
+
+@findex current_function_epilogue_delay_list
+@findex final_scan_insn
+The insns accepted to fill the epilogue delay slots are put in an RTL
+list made with @code{insn_list} objects, stored in the variable
+@code{current_function_epilogue_delay_list}. The insn for the first
+delay slot comes first in the list. Your definition of the macro
+@code{TARGET_ASM_FUNCTION_EPILOGUE} should fill the delay slots by
+outputting the insns in this list, usually by calling
+@code{final_scan_insn}.
+
+You need not define this macro if you did not define
+@code{DELAY_SLOTS_FOR_EPILOGUE}.
+@end defmac
+
+@hook TARGET_ASM_OUTPUT_MI_THUNK
+A function that outputs the assembler code for a thunk
+function, used to implement C++ virtual function calls with multiple
+inheritance. The thunk acts as a wrapper around a virtual function,
+adjusting the implicit object parameter before handing control off to
+the real function.
+
+First, emit code to add the integer @var{delta} to the location that
+contains the incoming first argument. Assume that this argument
+contains a pointer, and is the one used to pass the @code{this} pointer
+in C++. This is the incoming argument @emph{before} the function prologue,
+e.g.@: @samp{%o0} on a sparc. The addition must preserve the values of
+all other incoming arguments.
+
+Then, if @var{vcall_offset} is nonzero, an additional adjustment should be
+made after adding @code{delta}. In particular, if @var{p} is the
+adjusted pointer, the following adjustment should be made:
+
+@smallexample
+p += (*((ptrdiff_t **)p))[vcall_offset/sizeof(ptrdiff_t)]
+@end smallexample
+
+After the additions, emit code to jump to @var{function}, which is a
+@code{FUNCTION_DECL}. This is a direct pure jump, not a call, and does
+not touch the return address. Hence returning from @var{FUNCTION} will
+return to whoever called the current @samp{thunk}.
+
+The effect must be as if @var{function} had been called directly with
+the adjusted first argument. This macro is responsible for emitting all
+of the code for a thunk function; @code{TARGET_ASM_FUNCTION_PROLOGUE}
+and @code{TARGET_ASM_FUNCTION_EPILOGUE} are not invoked.
+
+The @var{thunk_fndecl} is redundant. (@var{delta} and @var{function}
+have already been extracted from it.) It might possibly be useful on
+some targets, but probably not.
+
+If you do not define this macro, the target-independent code in the C++
+front end will generate a less efficient heavyweight thunk that calls
+@var{function} instead of jumping to it. The generic approach does
+not support varargs.
+@end deftypefn
+
+@hook TARGET_ASM_CAN_OUTPUT_MI_THUNK
+A function that returns true if TARGET_ASM_OUTPUT_MI_THUNK would be able
+to output the assembler code for the thunk function specified by the
+arguments it is passed, and false otherwise. In the latter case, the
+generic approach will be used by the C++ front end, with the limitations
+previously exposed.
+@end deftypefn
+
+@node Profiling
+@subsection Generating Code for Profiling
+@cindex profiling, code generation
+
+These macros will help you generate code for profiling.
+
+@defmac FUNCTION_PROFILER (@var{file}, @var{labelno})
+A C statement or compound statement to output to @var{file} some
+assembler code to call the profiling subroutine @code{mcount}.
+
+@findex mcount
+The details of how @code{mcount} expects to be called are determined by
+your operating system environment, not by GCC@. To figure them out,
+compile a small program for profiling using the system's installed C
+compiler and look at the assembler code that results.
+
+Older implementations of @code{mcount} expect the address of a counter
+variable to be loaded into some register. The name of this variable is
+@samp{LP} followed by the number @var{labelno}, so you would generate
+the name using @samp{LP%d} in a @code{fprintf}.
+@end defmac
+
+@defmac PROFILE_HOOK
+A C statement or compound statement to output to @var{file} some assembly
+code to call the profiling subroutine @code{mcount} even the target does
+not support profiling.
+@end defmac
+
+@defmac NO_PROFILE_COUNTERS
+Define this macro to be an expression with a nonzero value if the
+@code{mcount} subroutine on your system does not need a counter variable
+allocated for each function. This is true for almost all modern
+implementations. If you define this macro, you must not use the
+@var{labelno} argument to @code{FUNCTION_PROFILER}.
+@end defmac
+
+@defmac PROFILE_BEFORE_PROLOGUE
+Define this macro if the code for function profiling should come before
+the function prologue. Normally, the profiling code comes after.
+@end defmac
+
+@node Tail Calls
+@subsection Permitting tail calls
+@cindex tail calls
+
+@hook TARGET_FUNCTION_OK_FOR_SIBCALL
+True if it is ok to do sibling call optimization for the specified
+call expression @var{exp}. @var{decl} will be the called function,
+or @code{NULL} if this is an indirect call.
+
+It is not uncommon for limitations of calling conventions to prevent
+tail calls to functions outside the current unit of translation, or
+during PIC compilation. The hook is used to enforce these restrictions,
+as the @code{sibcall} md pattern can not fail, or fall over to a
+``normal'' call. The criteria for successful sibling call optimization
+may vary greatly between different architectures.
+@end deftypefn
+
+@hook TARGET_EXTRA_LIVE_ON_ENTRY
+Add any hard registers to @var{regs} that are live on entry to the
+function. This hook only needs to be defined to provide registers that
+cannot be found by examination of FUNCTION_ARG_REGNO_P, the callee saved
+registers, STATIC_CHAIN_INCOMING_REGNUM, STATIC_CHAIN_REGNUM,
+TARGET_STRUCT_VALUE_RTX, FRAME_POINTER_REGNUM, EH_USES,
+FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, and the PIC_OFFSET_TABLE_REGNUM.
+@end deftypefn
+
+@node Stack Smashing Protection
+@subsection Stack smashing protection
+@cindex stack smashing protection
+
+@hook TARGET_STACK_PROTECT_GUARD
+This hook returns a @code{DECL} node for the external variable to use
+for the stack protection guard. This variable is initialized by the
+runtime to some random value and is used to initialize the guard value
+that is placed at the top of the local stack frame. The type of this
+variable must be @code{ptr_type_node}.
+
+The default version of this hook creates a variable called
+@samp{__stack_chk_guard}, which is normally defined in @file{libgcc2.c}.
+@end deftypefn
+
+@hook TARGET_STACK_PROTECT_FAIL
+This hook returns a tree expression that alerts the runtime that the
+stack protect guard variable has been modified. This expression should
+involve a call to a @code{noreturn} function.
+
+The default version of this hook invokes a function called
+@samp{__stack_chk_fail}, taking no arguments. This function is
+normally defined in @file{libgcc2.c}.
+@end deftypefn
+
+@node Varargs
+@section Implementing the Varargs Macros
+@cindex varargs implementation
+
+GCC comes with an implementation of @code{<varargs.h>} and
+@code{<stdarg.h>} that work without change on machines that pass arguments
+on the stack. Other machines require their own implementations of
+varargs, and the two machine independent header files must have
+conditionals to include it.
+
+ISO @code{<stdarg.h>} differs from traditional @code{<varargs.h>} mainly in
+the calling convention for @code{va_start}. The traditional
+implementation takes just one argument, which is the variable in which
+to store the argument pointer. The ISO implementation of
+@code{va_start} takes an additional second argument. The user is
+supposed to write the last named argument of the function here.
+
+However, @code{va_start} should not use this argument. The way to find
+the end of the named arguments is with the built-in functions described
+below.
+
+@defmac __builtin_saveregs ()
+Use this built-in function to save the argument registers in memory so
+that the varargs mechanism can access them. Both ISO and traditional
+versions of @code{va_start} must use @code{__builtin_saveregs}, unless
+you use @code{TARGET_SETUP_INCOMING_VARARGS} (see below) instead.
+
+On some machines, @code{__builtin_saveregs} is open-coded under the
+control of the target hook @code{TARGET_EXPAND_BUILTIN_SAVEREGS}. On
+other machines, it calls a routine written in assembler language,
+found in @file{libgcc2.c}.
+
+Code generated for the call to @code{__builtin_saveregs} appears at the
+beginning of the function, as opposed to where the call to
+@code{__builtin_saveregs} is written, regardless of what the code is.
+This is because the registers must be saved before the function starts
+to use them for its own purposes.
+@c i rewrote the first sentence above to fix an overfull hbox. --mew
+@c 10feb93
+@end defmac
+
+@defmac __builtin_args_info (@var{category})
+Use this built-in function to find the first anonymous arguments in
+registers.
+
+In general, a machine may have several categories of registers used for
+arguments, each for a particular category of data types. (For example,
+on some machines, floating-point registers are used for floating-point
+arguments while other arguments are passed in the general registers.)
+To make non-varargs functions use the proper calling convention, you
+have defined the @code{CUMULATIVE_ARGS} data type to record how many
+registers in each category have been used so far
+
+@code{__builtin_args_info} accesses the same data structure of type
+@code{CUMULATIVE_ARGS} after the ordinary argument layout is finished
+with it, with @var{category} specifying which word to access. Thus, the
+value indicates the first unused register in a given category.
+
+Normally, you would use @code{__builtin_args_info} in the implementation
+of @code{va_start}, accessing each category just once and storing the
+value in the @code{va_list} object. This is because @code{va_list} will
+have to update the values, and there is no way to alter the
+values accessed by @code{__builtin_args_info}.
+@end defmac
+
+@defmac __builtin_next_arg (@var{lastarg})
+This is the equivalent of @code{__builtin_args_info}, for stack
+arguments. It returns the address of the first anonymous stack
+argument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, it
+returns the address of the location above the first anonymous stack
+argument. Use it in @code{va_start} to initialize the pointer for
+fetching arguments from the stack. Also use it in @code{va_start} to
+verify that the second parameter @var{lastarg} is the last named argument
+of the current function.
+@end defmac
+
+@defmac __builtin_classify_type (@var{object})
+Since each machine has its own conventions for which data types are
+passed in which kind of register, your implementation of @code{va_arg}
+has to embody these conventions. The easiest way to categorize the
+specified data type is to use @code{__builtin_classify_type} together
+with @code{sizeof} and @code{__alignof__}.
+
+@code{__builtin_classify_type} ignores the value of @var{object},
+considering only its data type. It returns an integer describing what
+kind of type that is---integer, floating, pointer, structure, and so on.
+
+The file @file{typeclass.h} defines an enumeration that you can use to
+interpret the values of @code{__builtin_classify_type}.
+@end defmac
+
+These machine description macros help implement varargs:
+
+@hook TARGET_EXPAND_BUILTIN_SAVEREGS
+If defined, this hook produces the machine-specific code for a call to
+@code{__builtin_saveregs}. This code will be moved to the very
+beginning of the function, before any parameter access are made. The
+return value of this function should be an RTX that contains the value
+to use as the return of @code{__builtin_saveregs}.
+@end deftypefn
+
+@hook TARGET_SETUP_INCOMING_VARARGS
+This target hook offers an alternative to using
+@code{__builtin_saveregs} and defining the hook
+@code{TARGET_EXPAND_BUILTIN_SAVEREGS}. Use it to store the anonymous
+register arguments into the stack so that all the arguments appear to
+have been passed consecutively on the stack. Once this is done, you can
+use the standard implementation of varargs that works for machines that
+pass all their arguments on the stack.
+
+The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} data
+structure, containing the values that are obtained after processing the
+named arguments. The arguments @var{mode} and @var{type} describe the
+last named argument---its machine mode and its data type as a tree node.
+
+The target hook should do two things: first, push onto the stack all the
+argument registers @emph{not} used for the named arguments, and second,
+store the size of the data thus pushed into the @code{int}-valued
+variable pointed to by @var{pretend_args_size}. The value that you
+store here will serve as additional offset for setting up the stack
+frame.
+
+Because you must generate code to push the anonymous arguments at
+compile time without knowing their data types,
+@code{TARGET_SETUP_INCOMING_VARARGS} is only useful on machines that
+have just a single category of argument register and use it uniformly
+for all data types.
+
+If the argument @var{second_time} is nonzero, it means that the
+arguments of the function are being analyzed for the second time. This
+happens for an inline function, which is not actually compiled until the
+end of the source file. The hook @code{TARGET_SETUP_INCOMING_VARARGS} should
+not generate any instructions in this case.
+@end deftypefn
+
+@hook TARGET_STRICT_ARGUMENT_NAMING
+Define this hook to return @code{true} if the location where a function
+argument is passed depends on whether or not it is a named argument.
+
+This hook controls how the @var{named} argument to @code{FUNCTION_ARG}
+is set for varargs and stdarg functions. If this hook returns
+@code{true}, the @var{named} argument is always true for named
+arguments, and false for unnamed arguments. If it returns @code{false},
+but @code{TARGET_PRETEND_OUTGOING_VARARGS_NAMED} returns @code{true},
+then all arguments are treated as named. Otherwise, all named arguments
+except the last are treated as named.
+
+You need not define this hook if it always returns @code{false}.
+@end deftypefn
+
+@hook TARGET_PRETEND_OUTGOING_VARARGS_NAMED
+If you need to conditionally change ABIs so that one works with
+@code{TARGET_SETUP_INCOMING_VARARGS}, but the other works like neither
+@code{TARGET_SETUP_INCOMING_VARARGS} nor @code{TARGET_STRICT_ARGUMENT_NAMING} was
+defined, then define this hook to return @code{true} if
+@code{TARGET_SETUP_INCOMING_VARARGS} is used, @code{false} otherwise.
+Otherwise, you should not define this hook.
+@end deftypefn
+
+@node Trampolines
+@section Trampolines for Nested Functions
+@cindex trampolines for nested functions
+@cindex nested functions, trampolines for
+
+A @dfn{trampoline} is a small piece of code that is created at run time
+when the address of a nested function is taken. It normally resides on
+the stack, in the stack frame of the containing function. These macros
+tell GCC how to generate code to allocate and initialize a
+trampoline.
+
+The instructions in the trampoline must do two things: load a constant
+address into the static chain register, and jump to the real address of
+the nested function. On CISC machines such as the m68k, this requires
+two instructions, a move immediate and a jump. Then the two addresses
+exist in the trampoline as word-long immediate operands. On RISC
+machines, it is often necessary to load each address into a register in
+two parts. Then pieces of each address form separate immediate
+operands.
+
+The code generated to initialize the trampoline must store the variable
+parts---the static chain value and the function address---into the
+immediate operands of the instructions. On a CISC machine, this is
+simply a matter of copying each address to a memory reference at the
+proper offset from the start of the trampoline. On a RISC machine, it
+may be necessary to take out pieces of the address and store them
+separately.
+
+@hook TARGET_ASM_TRAMPOLINE_TEMPLATE
+This hook is called by @code{assemble_trampoline_template} to output,
+on the stream @var{f}, assembler code for a block of data that contains
+the constant parts of a trampoline. This code should not include a
+label---the label is taken care of automatically.
+
+If you do not define this hook, it means no template is needed
+for the target. Do not define this hook on systems where the block move
+code to copy the trampoline into place would be larger than the code
+to generate it on the spot.
+@end deftypefn
+
+@defmac TRAMPOLINE_SECTION
+Return the section into which the trampoline template is to be placed
+(@pxref{Sections}). The default value is @code{readonly_data_section}.
+@end defmac
+
+@defmac TRAMPOLINE_SIZE
+A C expression for the size in bytes of the trampoline, as an integer.
+@end defmac
+
+@defmac TRAMPOLINE_ALIGNMENT
+Alignment required for trampolines, in bits.
+
+If you don't define this macro, the value of @code{FUNCTION_ALIGNMENT}
+is used for aligning trampolines.
+@end defmac
+
+@hook TARGET_TRAMPOLINE_INIT
+This hook is called to initialize a trampoline.
+@var{m_tramp} is an RTX for the memory block for the trampoline; @var{fndecl}
+is the @code{FUNCTION_DECL} for the nested function; @var{static_chain} is an
+RTX for the static chain value that should be passed to the function
+when it is called.
+
+If the target defines @code{TARGET_ASM_TRAMPOLINE_TEMPLATE}, then the
+first thing this hook should do is emit a block move into @var{m_tramp}
+from the memory block returned by @code{assemble_trampoline_template}.
+Note that the block move need only cover the constant parts of the
+trampoline. If the target isolates the variable parts of the trampoline
+to the end, not all @code{TRAMPOLINE_SIZE} bytes need be copied.
+
+If the target requires any other actions, such as flushing caches or
+enabling stack execution, these actions should be performed after
+initializing the trampoline proper.
+@end deftypefn
+
+@hook TARGET_TRAMPOLINE_ADJUST_ADDRESS
+This hook should perform any machine-specific adjustment in
+the address of the trampoline. Its argument contains the address of the
+memory block that was passed to @code{TARGET_TRAMPOLINE_INIT}. In case
+the address to be used for a function call should be different from the
+address at which the template was stored, the different address should
+be returned; otherwise @var{addr} should be returned unchanged.
+If this hook is not defined, @var{addr} will be used for function calls.
+@end deftypefn
+
+Implementing trampolines is difficult on many machines because they have
+separate instruction and data caches. Writing into a stack location
+fails to clear the memory in the instruction cache, so when the program
+jumps to that location, it executes the old contents.
+
+Here are two possible solutions. One is to clear the relevant parts of
+the instruction cache whenever a trampoline is set up. The other is to
+make all trampolines identical, by having them jump to a standard
+subroutine. The former technique makes trampoline execution faster; the
+latter makes initialization faster.
+
+To clear the instruction cache when a trampoline is initialized, define
+the following macro.
+
+@defmac CLEAR_INSN_CACHE (@var{beg}, @var{end})
+If defined, expands to a C expression clearing the @emph{instruction
+cache} in the specified interval. The definition of this macro would
+typically be a series of @code{asm} statements. Both @var{beg} and
+@var{end} are both pointer expressions.
+@end defmac
+
+The operating system may also require the stack to be made executable
+before calling the trampoline. To implement this requirement, define
+the following macro.
+
+@defmac ENABLE_EXECUTE_STACK
+Define this macro if certain operations must be performed before executing
+code located on the stack. The macro should expand to a series of C
+file-scope constructs (e.g.@: functions) and provide a unique entry point
+named @code{__enable_execute_stack}. The target is responsible for
+emitting calls to the entry point in the code, for example from the
+@code{TARGET_TRAMPOLINE_INIT} hook.
+@end defmac
+
+To use a standard subroutine, define the following macro. In addition,
+you must make sure that the instructions in a trampoline fill an entire
+cache line with identical instructions, or else ensure that the
+beginning of the trampoline code is always aligned at the same point in
+its cache line. Look in @file{m68k.h} as a guide.
+
+@defmac TRANSFER_FROM_TRAMPOLINE
+Define this macro if trampolines need a special subroutine to do their
+work. The macro should expand to a series of @code{asm} statements
+which will be compiled with GCC@. They go in a library function named
+@code{__transfer_from_trampoline}.
+
+If you need to avoid executing the ordinary prologue code of a compiled
+C function when you jump to the subroutine, you can do so by placing a
+special label of your own in the assembler code. Use one @code{asm}
+statement to generate an assembler label, and another to make the label
+global. Then trampolines can use that label to jump directly to your
+special assembler code.
+@end defmac
+
+@node Library Calls
+@section Implicit Calls to Library Routines
+@cindex library subroutine names
+@cindex @file{libgcc.a}
+
+@c prevent bad page break with this line
+Here is an explanation of implicit calls to library routines.
+
+@defmac DECLARE_LIBRARY_RENAMES
+This macro, if defined, should expand to a piece of C code that will get
+expanded when compiling functions for libgcc.a. It can be used to
+provide alternate names for GCC's internal library functions if there
+are ABI-mandated names that the compiler should provide.
+@end defmac
+
+@findex set_optab_libfunc
+@findex init_one_libfunc
+@hook TARGET_INIT_LIBFUNCS
+This hook should declare additional library routines or rename
+existing ones, using the functions @code{set_optab_libfunc} and
+@code{init_one_libfunc} defined in @file{optabs.c}.
+@code{init_optabs} calls this macro after initializing all the normal
+library routines.
+
+The default is to do nothing. Most ports don't need to define this hook.
+@end deftypefn
+
+@defmac FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison})
+This macro should return @code{true} if the library routine that
+implements the floating point comparison operator @var{comparison} in
+mode @var{mode} will return a boolean, and @var{false} if it will
+return a tristate.
+
+GCC's own floating point libraries return tristates from the
+comparison operators, so the default returns false always. Most ports
+don't need to define this macro.
+@end defmac
+
+@defmac TARGET_LIB_INT_CMP_BIASED
+This macro should evaluate to @code{true} if the integer comparison
+functions (like @code{__cmpdi2}) return 0 to indicate that the first
+operand is smaller than the second, 1 to indicate that they are equal,
+and 2 to indicate that the first operand is greater than the second.
+If this macro evaluates to @code{false} the comparison functions return
+@minus{}1, 0, and 1 instead of 0, 1, and 2. If the target uses the routines
+in @file{libgcc.a}, you do not need to define this macro.
+@end defmac
+
+@cindex US Software GOFAST, floating point emulation library
+@cindex floating point emulation library, US Software GOFAST
+@cindex GOFAST, floating point emulation library
+@findex gofast_maybe_init_libfuncs
+@defmac US_SOFTWARE_GOFAST
+Define this macro if your system C library uses the US Software GOFAST
+library to provide floating point emulation.
+
+In addition to defining this macro, your architecture must set
+@code{TARGET_INIT_LIBFUNCS} to @code{gofast_maybe_init_libfuncs}, or
+else call that function from its version of that hook. It is defined
+in @file{config/gofast.h}, which must be included by your
+architecture's @file{@var{cpu}.c} file. See @file{sparc/sparc.c} for
+an example.
+
+If this macro is defined, the
+@code{TARGET_FLOAT_LIB_COMPARE_RETURNS_BOOL} target hook must return
+false for @code{SFmode} and @code{DFmode} comparisons.
+@end defmac
+
+@cindex @code{EDOM}, implicit usage
+@findex matherr
+@defmac TARGET_EDOM
+The value of @code{EDOM} on the target machine, as a C integer constant
+expression. If you don't define this macro, GCC does not attempt to
+deposit the value of @code{EDOM} into @code{errno} directly. Look in
+@file{/usr/include/errno.h} to find the value of @code{EDOM} on your
+system.
+
+If you do not define @code{TARGET_EDOM}, then compiled code reports
+domain errors by calling the library function and letting it report the
+error. If mathematical functions on your system use @code{matherr} when
+there is an error, then you should leave @code{TARGET_EDOM} undefined so
+that @code{matherr} is used normally.
+@end defmac
+
+@cindex @code{errno}, implicit usage
+@defmac GEN_ERRNO_RTX
+Define this macro as a C expression to create an rtl expression that
+refers to the global ``variable'' @code{errno}. (On certain systems,
+@code{errno} may not actually be a variable.) If you don't define this
+macro, a reasonable default is used.
+@end defmac
+
+@cindex C99 math functions, implicit usage
+@defmac TARGET_C99_FUNCTIONS
+When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into
+@code{sinf} and similarly for other functions defined by C99 standard. The
+default is zero because a number of existing systems lack support for these
+functions in their runtime so this macro needs to be redefined to one on
+systems that do support the C99 runtime.
+@end defmac
+
+@cindex sincos math function, implicit usage
+@defmac TARGET_HAS_SINCOS
+When this macro is nonzero, GCC will implicitly optimize calls to @code{sin}
+and @code{cos} with the same argument to a call to @code{sincos}. The
+default is zero. The target has to provide the following functions:
+@smallexample
+void sincos(double x, double *sin, double *cos);
+void sincosf(float x, float *sin, float *cos);
+void sincosl(long double x, long double *sin, long double *cos);
+@end smallexample
+@end defmac
+
+@defmac NEXT_OBJC_RUNTIME
+Define this macro to generate code for Objective-C message sending using
+the calling convention of the NeXT system. This calling convention
+involves passing the object, the selector and the method arguments all
+at once to the method-lookup library function.
+
+The default calling convention passes just the object and the selector
+to the lookup function, which returns a pointer to the method.
+@end defmac
+
+@node Addressing Modes
+@section Addressing Modes
+@cindex addressing modes
+
+@c prevent bad page break with this line
+This is about addressing modes.
+
+@defmac HAVE_PRE_INCREMENT
+@defmacx HAVE_PRE_DECREMENT
+@defmacx HAVE_POST_INCREMENT
+@defmacx HAVE_POST_DECREMENT
+A C expression that is nonzero if the machine supports pre-increment,
+pre-decrement, post-increment, or post-decrement addressing respectively.
+@end defmac
+
+@defmac HAVE_PRE_MODIFY_DISP
+@defmacx HAVE_POST_MODIFY_DISP
+A C expression that is nonzero if the machine supports pre- or
+post-address side-effect generation involving constants other than
+the size of the memory operand.
+@end defmac
+
+@defmac HAVE_PRE_MODIFY_REG
+@defmacx HAVE_POST_MODIFY_REG
+A C expression that is nonzero if the machine supports pre- or
+post-address side-effect generation involving a register displacement.
+@end defmac
+
+@defmac CONSTANT_ADDRESS_P (@var{x})
+A C expression that is 1 if the RTX @var{x} is a constant which
+is a valid address. On most machines the default definition of
+@code{(CONSTANT_P (@var{x}) && GET_CODE (@var{x}) != CONST_DOUBLE)}
+is acceptable, but a few machines are more restrictive as to which
+constant addresses are supported.
+@end defmac
+
+@defmac CONSTANT_P (@var{x})
+@code{CONSTANT_P}, which is defined by target-independent code,
+accepts integer-values expressions whose values are not explicitly
+known, such as @code{symbol_ref}, @code{label_ref}, and @code{high}
+expressions and @code{const} arithmetic expressions, in addition to
+@code{const_int} and @code{const_double} expressions.
+@end defmac
+
+@defmac MAX_REGS_PER_ADDRESS
+A number, the maximum number of registers that can appear in a valid
+memory address. Note that it is up to you to specify a value equal to
+the maximum number that @code{TARGET_LEGITIMATE_ADDRESS_P} would ever
+accept.
+@end defmac
+
+@hook TARGET_LEGITIMATE_ADDRESS_P
+A function that returns whether @var{x} (an RTX) is a legitimate memory
+address on the target machine for a memory operand of mode @var{mode}.
+
+Legitimate addresses are defined in two variants: a strict variant and a
+non-strict one. The @var{strict} parameter chooses which variant is
+desired by the caller.
+
+The strict variant is used in the reload pass. It must be defined so
+that any pseudo-register that has not been allocated a hard register is
+considered a memory reference. This is because in contexts where some
+kind of register is required, a pseudo-register with no hard register
+must be rejected. For non-hard registers, the strict variant should look
+up the @code{reg_renumber} array; it should then proceed using the hard
+register number in the array, or treat the pseudo as a memory reference
+if the array holds @code{-1}.
+
+The non-strict variant is used in other passes. It must be defined to
+accept all pseudo-registers in every context where some kind of
+register is required.
+
+Normally, constant addresses which are the sum of a @code{symbol_ref}
+and an integer are stored inside a @code{const} RTX to mark them as
+constant. Therefore, there is no need to recognize such sums
+specifically as legitimate addresses. Normally you would simply
+recognize any @code{const} as legitimate.
+
+Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant
+sums that are not marked with @code{const}. It assumes that a naked
+@code{plus} indicates indexing. If so, then you @emph{must} reject such
+naked constant sums as illegitimate addresses, so that none of them will
+be given to @code{PRINT_OPERAND_ADDRESS}.
+
+@cindex @code{TARGET_ENCODE_SECTION_INFO} and address validation
+On some machines, whether a symbolic address is legitimate depends on
+the section that the address refers to. On these machines, define the
+target hook @code{TARGET_ENCODE_SECTION_INFO} to store the information
+into the @code{symbol_ref}, and then check for it here. When you see a
+@code{const}, you will have to look inside it to find the
+@code{symbol_ref} in order to determine the section. @xref{Assembler
+Format}.
+
+@cindex @code{GO_IF_LEGITIMATE_ADDRESS}
+Some ports are still using a deprecated legacy substitute for
+this hook, the @code{GO_IF_LEGITIMATE_ADDRESS} macro. This macro
+has this syntax:
+
+@example
+#define GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
+@end example
+
+@noindent
+and should @code{goto @var{label}} if the address @var{x} is a valid
+address on the target machine for a memory operand of mode @var{mode}.
+Whether the strict or non-strict variants are desired is defined by
+the @code{REG_OK_STRICT} macro introduced earlier in this section.
+Using the hook is usually simpler because it limits the number of
+files that are recompiled when changes are made.
+@end deftypefn
+
+@defmac TARGET_MEM_CONSTRAINT
+A single character to be used instead of the default @code{'m'}
+character for general memory addresses. This defines the constraint
+letter which matches the memory addresses accepted by
+@code{TARGET_LEGITIMATE_ADDRESS_P}. Define this macro if you want to
+support new address formats in your back end without changing the
+semantics of the @code{'m'} constraint. This is necessary in order to
+preserve functionality of inline assembly constructs using the
+@code{'m'} constraint.
+@end defmac
+
+@defmac FIND_BASE_TERM (@var{x})
+A C expression to determine the base term of address @var{x},
+or to provide a simplified version of @var{x} from which @file{alias.c}
+can easily find the base term. This macro is used in only two places:
+@code{find_base_value} and @code{find_base_term} in @file{alias.c}.
+
+It is always safe for this macro to not be defined. It exists so
+that alias analysis can understand machine-dependent addresses.
+
+The typical use of this macro is to handle addresses containing
+a label_ref or symbol_ref within an UNSPEC@.
+@end defmac
+
+@hook TARGET_LEGITIMIZE_ADDRESS
+This hook is given an invalid memory address @var{x} for an
+operand of mode @var{mode} and should try to return a valid memory
+address.
+
+@findex break_out_memory_refs
+@var{x} will always be the result of a call to @code{break_out_memory_refs},
+and @var{oldx} will be the operand that was given to that function to produce
+@var{x}.
+
+The code of the hook should not alter the substructure of
+@var{x}. If it transforms @var{x} into a more legitimate form, it
+should return the new @var{x}.
+
+It is not necessary for this hook to come up with a legitimate address.
+The compiler has standard ways of doing so in all cases. In fact, it
+is safe to omit this hook or make it return @var{x} if it cannot find
+a valid way to legitimize the address. But often a machine-dependent
+strategy can generate better code.
+@end deftypefn
+
+@defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win})
+A C compound statement that attempts to replace @var{x}, which is an address
+that needs reloading, with a valid memory address for an operand of mode
+@var{mode}. @var{win} will be a C statement label elsewhere in the code.
+It is not necessary to define this macro, but it might be useful for
+performance reasons.
+
+For example, on the i386, it is sometimes possible to use a single
+reload register instead of two by reloading a sum of two pseudo
+registers into a register. On the other hand, for number of RISC
+processors offsets are limited so that often an intermediate address
+needs to be generated in order to address a stack slot. By defining
+@code{LEGITIMIZE_RELOAD_ADDRESS} appropriately, the intermediate addresses
+generated for adjacent some stack slots can be made identical, and thus
+be shared.
+
+@emph{Note}: This macro should be used with caution. It is necessary
+to know something of how reload works in order to effectively use this,
+and it is quite easy to produce macros that build in too much knowledge
+of reload internals.
+
+@emph{Note}: This macro must be able to reload an address created by a
+previous invocation of this macro. If it fails to handle such addresses
+then the compiler may generate incorrect code or abort.
+
+@findex push_reload
+The macro definition should use @code{push_reload} to indicate parts that
+need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually
+suitable to be passed unaltered to @code{push_reload}.
+
+The code generated by this macro must not alter the substructure of
+@var{x}. If it transforms @var{x} into a more legitimate form, it
+should assign @var{x} (which will always be a C variable) a new value.
+This also applies to parts that you change indirectly by calling
+@code{push_reload}.
+
+@findex strict_memory_address_p
+The macro definition may use @code{strict_memory_address_p} to test if
+the address has become legitimate.
+
+@findex copy_rtx
+If you want to change only a part of @var{x}, one standard way of doing
+this is to use @code{copy_rtx}. Note, however, that it unshares only a
+single level of rtl. Thus, if the part to be changed is not at the
+top level, you'll need to replace first the top level.
+It is not necessary for this macro to come up with a legitimate
+address; but often a machine-dependent strategy can generate better code.
+@end defmac
+
+@hook TARGET_MODE_DEPENDENT_ADDRESS_P
+This hook returns @code{true} if memory address @var{addr} can have
+different meanings depending on the machine mode of the memory
+reference it is used for or if the address is valid for some modes
+but not others.
+
+Autoincrement and autodecrement addresses typically have mode-dependent
+effects because the amount of the increment or decrement is the size
+of the operand being addressed. Some machines have other mode-dependent
+addresses. Many RISC machines have no mode-dependent addresses.
+
+You may assume that @var{addr} is a valid address for the machine.
+
+The default version of this hook returns @code{false}.
+@end deftypefn
+
+@defmac GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
+A C statement or compound statement with a conditional @code{goto
+@var{label};} executed if memory address @var{x} (an RTX) can have
+different meanings depending on the machine mode of the memory
+reference it is used for or if the address is valid for some modes
+but not others.
+
+Autoincrement and autodecrement addresses typically have mode-dependent
+effects because the amount of the increment or decrement is the size
+of the operand being addressed. Some machines have other mode-dependent
+addresses. Many RISC machines have no mode-dependent addresses.
+
+You may assume that @var{addr} is a valid address for the machine.
+
+These are obsolete macros, replaced by the
+@code{TARGET_MODE_DEPENDENT_ADDRESS_P} target hook.
+@end defmac
+
+@defmac LEGITIMATE_CONSTANT_P (@var{x})
+A C expression that is nonzero if @var{x} is a legitimate constant for
+an immediate operand on the target machine. You can assume that
+@var{x} satisfies @code{CONSTANT_P}, so you need not check this. In fact,
+@samp{1} is a suitable definition for this macro on machines where
+anything @code{CONSTANT_P} is valid.
+@end defmac
+
+@hook TARGET_DELEGITIMIZE_ADDRESS
+This hook is used to undo the possibly obfuscating effects of the
+@code{LEGITIMIZE_ADDRESS} and @code{LEGITIMIZE_RELOAD_ADDRESS} target
+macros. Some backend implementations of these macros wrap symbol
+references inside an @code{UNSPEC} rtx to represent PIC or similar
+addressing modes. This target hook allows GCC's optimizers to understand
+the semantics of these opaque @code{UNSPEC}s by converting them back
+into their original form.
+@end deftypefn
+
+@hook TARGET_CANNOT_FORCE_CONST_MEM
+This hook should return true if @var{x} is of a form that cannot (or
+should not) be spilled to the constant pool. The default version of
+this hook returns false.
+
+The primary reason to define this hook is to prevent reload from
+deciding that a non-legitimate constant would be better reloaded
+from the constant pool instead of spilling and reloading a register
+holding the constant. This restriction is often true of addresses
+of TLS symbols for various targets.
+@end deftypefn
+
+@hook TARGET_USE_BLOCKS_FOR_CONSTANT_P
+This hook should return true if pool entries for constant @var{x} can
+be placed in an @code{object_block} structure. @var{mode} is the mode
+of @var{x}.
+
+The default version returns false for all constants.
+@end deftypefn
+
+@hook TARGET_BUILTIN_RECIPROCAL
+This hook should return the DECL of a function that implements reciprocal of
+the builtin function with builtin function code @var{fn}, or
+@code{NULL_TREE} if such a function is not available. @var{md_fn} is true
+when @var{fn} is a code of a machine-dependent builtin function. When
+@var{sqrt} is true, additional optimizations that apply only to the reciprocal
+of a square root function are performed, and only reciprocals of @code{sqrt}
+function are valid.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD
+This hook should return the DECL of a function @var{f} that given an
+address @var{addr} as an argument returns a mask @var{m} that can be
+used to extract from two vectors the relevant data that resides in
+@var{addr} in case @var{addr} is not properly aligned.
+
+The autovectorizer, when vectorizing a load operation from an address
+@var{addr} that may be unaligned, will generate two vector loads from
+the two aligned addresses around @var{addr}. It then generates a
+@code{REALIGN_LOAD} operation to extract the relevant data from the
+two loaded vectors. The first two arguments to @code{REALIGN_LOAD},
+@var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, and
+the third argument, @var{OFF}, defines how the data will be extracted
+from these two vectors: if @var{OFF} is 0, then the returned vector is
+@var{v2}; otherwise, the returned vector is composed from the last
+@var{VS}-@var{OFF} elements of @var{v1} concatenated to the first
+@var{OFF} elements of @var{v2}.
+
+If this hook is defined, the autovectorizer will generate a call
+to @var{f} (using the DECL tree that this hook returns) and will
+use the return value of @var{f} as the argument @var{OFF} to
+@code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f}
+should comply with the semantics expected by @code{REALIGN_LOAD}
+described above.
+If this hook is not defined, then @var{addr} will be used as
+the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low
+log2(@var{VS}) @minus{} 1 bits of @var{addr} will be considered.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN
+This hook should return the DECL of a function @var{f} that implements
+widening multiplication of the even elements of two input vectors of type @var{x}.
+
+If this hook is defined, the autovectorizer will use it along with the
+@code{TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD} target hook when vectorizing
+widening multiplication in cases that the order of the results does not have to be
+preserved (e.g.@: used only by a reduction computation). Otherwise, the
+@code{widen_mult_hi/lo} idioms will be used.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD
+This hook should return the DECL of a function @var{f} that implements
+widening multiplication of the odd elements of two input vectors of type @var{x}.
+
+If this hook is defined, the autovectorizer will use it along with the
+@code{TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN} target hook when vectorizing
+widening multiplication in cases that the order of the results does not have to be
+preserved (e.g.@: used only by a reduction computation). Otherwise, the
+@code{widen_mult_hi/lo} idioms will be used.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
+Returns cost of different scalar or vector statements for vectorization cost model.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
+Return true if vector alignment is reachable (by peeling N iterations) for the given type.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_VEC_PERM
+Target builtin that implements vector permute.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_VEC_PERM_OK
+Return true if a vector created for @code{builtin_vec_perm} is valid.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_CONVERSION
+This hook should return the DECL of a function that implements conversion of the
+input vector of type @var{src_type} to type @var{dest_type}.
+The value of @var{code} is one of the enumerators in @code{enum tree_code} and
+specifies how the conversion is to be applied
+(truncation, rounding, etc.).
+
+If this hook is defined, the autovectorizer will use the
+@code{TARGET_VECTORIZE_BUILTIN_CONVERSION} target hook when vectorizing
+conversion. Otherwise, it will return @code{NULL_TREE}.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
+This hook should return the decl of a function that implements the
+vectorized variant of the builtin function with builtin function code
+@var{code} or @code{NULL_TREE} if such a function is not available.
+The value of @var{fndecl} is the builtin function declaration. The
+return type of the vectorized function shall be of vector type
+@var{vec_type_out} and the argument types should be @var{vec_type_in}.
+@end deftypefn
+
+@hook TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
+This hook should return true if the target supports misaligned vector
+store/load of a specific factor denoted in the @var{misalignment}
+parameter. The vector store/load should be of machine mode @var{mode} and
+the elements in the vectors should be of type @var{type}. @var{is_packed}
+parameter is true if the memory access is defined in a packed struct.
+@end deftypefn
+
+@node Anchored Addresses
+@section Anchored Addresses
+@cindex anchored addresses
+@cindex @option{-fsection-anchors}
+
+GCC usually addresses every static object as a separate entity.
+For example, if we have:
+
+@smallexample
+static int a, b, c;
+int foo (void) @{ return a + b + c; @}
+@end smallexample
+
+the code for @code{foo} will usually calculate three separate symbolic
+addresses: those of @code{a}, @code{b} and @code{c}. On some targets,
+it would be better to calculate just one symbolic address and access
+the three variables relative to it. The equivalent pseudocode would
+be something like:
+
+@smallexample
+int foo (void)
+@{
+ register int *xr = &x;
+ return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
+@}
+@end smallexample
+
+(which isn't valid C). We refer to shared addresses like @code{x} as
+``section anchors''. Their use is controlled by @option{-fsection-anchors}.
+
+The hooks below describe the target properties that GCC needs to know
+in order to make effective use of section anchors. It won't use
+section anchors at all unless either @code{TARGET_MIN_ANCHOR_OFFSET}
+or @code{TARGET_MAX_ANCHOR_OFFSET} is set to a nonzero value.
+
+@hook TARGET_MIN_ANCHOR_OFFSET
+The minimum offset that should be applied to a section anchor.
+On most targets, it should be the smallest offset that can be
+applied to a base register while still giving a legitimate address
+for every mode. The default value is 0.
+@end deftypevr
+
+@hook TARGET_MAX_ANCHOR_OFFSET
+Like @code{TARGET_MIN_ANCHOR_OFFSET}, but the maximum (inclusive)
+offset that should be applied to section anchors. The default
+value is 0.
+@end deftypevr
+
+@hook TARGET_ASM_OUTPUT_ANCHOR
+Write the assembly code to define section anchor @var{x}, which is a
+@code{SYMBOL_REF} for which @samp{SYMBOL_REF_ANCHOR_P (@var{x})} is true.
+The hook is called with the assembly output position set to the beginning
+of @code{SYMBOL_REF_BLOCK (@var{x})}.
+
+If @code{ASM_OUTPUT_DEF} is available, the hook's default definition uses
+it to define the symbol as @samp{. + SYMBOL_REF_BLOCK_OFFSET (@var{x})}.
+If @code{ASM_OUTPUT_DEF} is not available, the hook's default definition
+is @code{NULL}, which disables the use of section anchors altogether.
+@end deftypefn
+
+@hook TARGET_USE_ANCHORS_FOR_SYMBOL_P
+Return true if GCC should attempt to use anchors to access @code{SYMBOL_REF}
+@var{x}. You can assume @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})} and
+@samp{!SYMBOL_REF_ANCHOR_P (@var{x})}.
+
+The default version is correct for most targets, but you might need to
+intercept this hook to handle things like target-specific attributes
+or target-specific sections.
+@end deftypefn
+
+@node Condition Code
+@section Condition Code Status
+@cindex condition code status
+
+The macros in this section can be split in two families, according to the
+two ways of representing condition codes in GCC.
+
+The first representation is the so called @code{(cc0)} representation
+(@pxref{Jump Patterns}), where all instructions can have an implicit
+clobber of the condition codes. The second is the condition code
+register representation, which provides better schedulability for
+architectures that do have a condition code register, but on which
+most instructions do not affect it. The latter category includes
+most RISC machines.
+
+The implicit clobbering poses a strong restriction on the placement of
+the definition and use of the condition code, which need to be in adjacent
+insns for machines using @code{(cc0)}. This can prevent important
+optimizations on some machines. For example, on the IBM RS/6000, there
+is a delay for taken branches unless the condition code register is set
+three instructions earlier than the conditional branch. The instruction
+scheduler cannot perform this optimization if it is not permitted to
+separate the definition and use of the condition code register.
+
+For this reason, it is possible and suggested to use a register to
+represent the condition code for new ports. If there is a specific
+condition code register in the machine, use a hard register. If the
+condition code or comparison result can be placed in any general register,
+or if there are multiple condition registers, use a pseudo register.
+Registers used to store the condition code value will usually have a mode
+that is in class @code{MODE_CC}.
+
+Alternatively, you can use @code{BImode} if the comparison operator is
+specified already in the compare instruction. In this case, you are not
+interested in most macros in this section.
+
+@menu
+* CC0 Condition Codes:: Old style representation of condition codes.
+* MODE_CC Condition Codes:: Modern representation of condition codes.
+* Cond. Exec. Macros:: Macros to control conditional execution.
+@end menu
+
+@node CC0 Condition Codes
+@subsection Representation of condition codes using @code{(cc0)}
+@findex cc0
+
+@findex cc_status
+The file @file{conditions.h} defines a variable @code{cc_status} to
+describe how the condition code was computed (in case the interpretation of
+the condition code depends on the instruction that it was set by). This
+variable contains the RTL expressions on which the condition code is
+currently based, and several standard flags.
+
+Sometimes additional machine-specific flags must be defined in the machine
+description header file. It can also add additional machine-specific
+information by defining @code{CC_STATUS_MDEP}.
+
+@defmac CC_STATUS_MDEP
+C code for a data type which is used for declaring the @code{mdep}
+component of @code{cc_status}. It defaults to @code{int}.
+
+This macro is not used on machines that do not use @code{cc0}.
+@end defmac
+
+@defmac CC_STATUS_MDEP_INIT
+A C expression to initialize the @code{mdep} field to ``empty''.
+The default definition does nothing, since most machines don't use
+the field anyway. If you want to use the field, you should probably
+define this macro to initialize it.
+
+This macro is not used on machines that do not use @code{cc0}.
+@end defmac
+
+@defmac NOTICE_UPDATE_CC (@var{exp}, @var{insn})
+A C compound statement to set the components of @code{cc_status}
+appropriately for an insn @var{insn} whose body is @var{exp}. It is
+this macro's responsibility to recognize insns that set the condition
+code as a byproduct of other activity as well as those that explicitly
+set @code{(cc0)}.
+
+This macro is not used on machines that do not use @code{cc0}.
+
+If there are insns that do not set the condition code but do alter
+other machine registers, this macro must check to see whether they
+invalidate the expressions that the condition code is recorded as
+reflecting. For example, on the 68000, insns that store in address
+registers do not set the condition code, which means that usually
+@code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
+insns. But suppose that the previous insn set the condition code
+based on location @samp{a4@@(102)} and the current insn stores a new
+value in @samp{a4}. Although the condition code is not changed by
+this, it will no longer be true that it reflects the contents of
+@samp{a4@@(102)}. Therefore, @code{NOTICE_UPDATE_CC} must alter
+@code{cc_status} in this case to say that nothing is known about the
+condition code value.
+
+The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
+with the results of peephole optimization: insns whose patterns are
+@code{parallel} RTXs containing various @code{reg}, @code{mem} or
+constants which are just the operands. The RTL structure of these
+insns is not sufficient to indicate what the insns actually do. What
+@code{NOTICE_UPDATE_CC} should do when it sees one is just to run
+@code{CC_STATUS_INIT}.
+
+A possible definition of @code{NOTICE_UPDATE_CC} is to call a function
+that looks at an attribute (@pxref{Insn Attributes}) named, for example,
+@samp{cc}. This avoids having detailed information about patterns in
+two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
+@end defmac
+
+@node MODE_CC Condition Codes
+@subsection Representation of condition codes using registers
+@findex CCmode
+@findex MODE_CC
+
+@defmac SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
+On many machines, the condition code may be produced by other instructions
+than compares, for example the branch can use directly the condition
+code set by a subtract instruction. However, on some machines
+when the condition code is set this way some bits (such as the overflow
+bit) are not set in the same way as a test instruction, so that a different
+branch instruction must be used for some conditional branches. When
+this happens, use the machine mode of the condition code register to
+record different formats of the condition code register. Modes can
+also be used to record which compare instruction (e.g. a signed or an
+unsigned comparison) produced the condition codes.
+
+If other modes than @code{CCmode} are required, add them to
+@file{@var{machine}-modes.def} and define @code{SELECT_CC_MODE} to choose
+a mode given an operand of a compare. This is needed because the modes
+have to be chosen not only during RTL generation but also, for example,
+by instruction combination. The result of @code{SELECT_CC_MODE} should
+be consistent with the mode used in the patterns; for example to support
+the case of the add on the SPARC discussed above, we have the pattern
+
+@smallexample
+(define_insn ""
+ [(set (reg:CC_NOOV 0)
+ (compare:CC_NOOV
+ (plus:SI (match_operand:SI 0 "register_operand" "%r")
+ (match_operand:SI 1 "arith_operand" "rI"))
+ (const_int 0)))]
+ ""
+ "@dots{}")
+@end smallexample
+
+@noindent
+together with a @code{SELECT_CC_MODE} that returns @code{CC_NOOVmode}
+for comparisons whose argument is a @code{plus}:
+
+@smallexample
+#define SELECT_CC_MODE(OP,X,Y) \
+ (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
+ ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
+ : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
+ || GET_CODE (X) == NEG) \
+ ? CC_NOOVmode : CCmode))
+@end smallexample
+
+Another reason to use modes is to retain information on which operands
+were used by the comparison; see @code{REVERSIBLE_CC_MODE} later in
+this section.
+
+You should define this macro if and only if you define extra CC modes
+in @file{@var{machine}-modes.def}.
+@end defmac
+
+@defmac CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1})
+On some machines not all possible comparisons are defined, but you can
+convert an invalid comparison into a valid one. For example, the Alpha
+does not have a @code{GT} comparison, but you can use an @code{LT}
+comparison instead and swap the order of the operands.
+
+On such machines, define this macro to be a C statement to do any
+required conversions. @var{code} is the initial comparison code
+and @var{op0} and @var{op1} are the left and right operands of the
+comparison, respectively. You should modify @var{code}, @var{op0}, and
+@var{op1} as required.
+
+GCC will not assume that the comparison resulting from this macro is
+valid but will see if the resulting insn matches a pattern in the
+@file{md} file.
+
+You need not define this macro if it would never change the comparison
+code or operands.
+@end defmac
+
+@defmac REVERSIBLE_CC_MODE (@var{mode})
+A C expression whose value is one if it is always safe to reverse a
+comparison whose mode is @var{mode}. If @code{SELECT_CC_MODE}
+can ever return @var{mode} for a floating-point inequality comparison,
+then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero.
+
+You need not define this macro if it would always returns zero or if the
+floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.
+For example, here is the definition used on the SPARC, where floating-point
+inequality comparisons are always given @code{CCFPEmode}:
+
+@smallexample
+#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
+@end smallexample
+@end defmac
+
+@defmac REVERSE_CONDITION (@var{code}, @var{mode})
+A C expression whose value is reversed condition code of the @var{code} for
+comparison done in CC_MODE @var{mode}. The macro is used only in case
+@code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case
+machine has some non-standard way how to reverse certain conditionals. For
+instance in case all floating point conditions are non-trapping, compiler may
+freely convert unordered compares to ordered one. Then definition may look
+like:
+
+@smallexample
+#define REVERSE_CONDITION(CODE, MODE) \
+ ((MODE) != CCFPmode ? reverse_condition (CODE) \
+ : reverse_condition_maybe_unordered (CODE))
+@end smallexample
+@end defmac
+
+@hook TARGET_FIXED_CONDITION_CODE_REGS
+On targets which do not use @code{(cc0)}, and which use a hard
+register rather than a pseudo-register to hold condition codes, the
+regular CSE passes are often not able to identify cases in which the
+hard register is set to a common value. Use this hook to enable a
+small pass which optimizes such cases. This hook should return true
+to enable this pass, and it should set the integers to which its
+arguments point to the hard register numbers used for condition codes.
+When there is only one such register, as is true on most systems, the
+integer pointed to by @var{p2} should be set to
+@code{INVALID_REGNUM}.
+
+The default version of this hook returns false.
+@end deftypefn
+
+@hook TARGET_CC_MODES_COMPATIBLE
+On targets which use multiple condition code modes in class
+@code{MODE_CC}, it is sometimes the case that a comparison can be
+validly done in more than one mode. On such a system, define this
+target hook to take two mode arguments and to return a mode in which
+both comparisons may be validly done. If there is no such mode,
+return @code{VOIDmode}.
+
+The default version of this hook checks whether the modes are the
+same. If they are, it returns that mode. If they are different, it
+returns @code{VOIDmode}.
+@end deftypefn
+
+@node Cond. Exec. Macros
+@subsection Macros to control conditional execution
+@findex conditional execution
+@findex predication
+
+There is one macro that may need to be defined for targets
+supporting conditional execution, independent of how they
+represent conditional branches.
+
+@defmac REVERSE_CONDEXEC_PREDICATES_P (@var{op1}, @var{op2})
+A C expression that returns true if the conditional execution predicate
+@var{op1}, a comparison operation, is the inverse of @var{op2} and vice
+versa. Define this to return 0 if the target has conditional execution
+predicates that cannot be reversed safely. There is no need to validate
+that the arguments of op1 and op2 are the same, this is done separately.
+If no expansion is specified, this macro is defined as follows:
+
+@smallexample
+#define REVERSE_CONDEXEC_PREDICATES_P (x, y) \
+ (GET_CODE ((x)) == reversed_comparison_code ((y), NULL))
+@end smallexample
+@end defmac
+
+@node Costs
+@section Describing Relative Costs of Operations
+@cindex costs of instructions
+@cindex relative costs
+@cindex speed of instructions
+
+These macros let you describe the relative speed of various operations
+on the target machine.
+
+@defmac REGISTER_MOVE_COST (@var{mode}, @var{from}, @var{to})
+A C expression for the cost of moving data of mode @var{mode} from a
+register in class @var{from} to one in class @var{to}. The classes are
+expressed using the enumeration values such as @code{GENERAL_REGS}. A
+value of 2 is the default; other values are interpreted relative to
+that.
+
+It is not required that the cost always equal 2 when @var{from} is the
+same as @var{to}; on some machines it is expensive to move between
+registers if they are not general registers.
+
+If reload sees an insn consisting of a single @code{set} between two
+hard registers, and if @code{REGISTER_MOVE_COST} applied to their
+classes returns a value of 2, reload does not check to ensure that the
+constraints of the insn are met. Setting a cost of other than 2 will
+allow reload to verify that the constraints are met. You should do this
+if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
+
+These macros are obsolete, new ports should use the target hook
+@code{TARGET_REGISTER_MOVE_COST} instead.
+@end defmac
+
+@hook TARGET_REGISTER_MOVE_COST
+This target hook should return the cost of moving data of mode @var{mode}
+from a register in class @var{from} to one in class @var{to}. The classes
+are expressed using the enumeration values such as @code{GENERAL_REGS}.
+A value of 2 is the default; other values are interpreted relative to
+that.
+
+It is not required that the cost always equal 2 when @var{from} is the
+same as @var{to}; on some machines it is expensive to move between
+registers if they are not general registers.
+
+If reload sees an insn consisting of a single @code{set} between two
+hard registers, and if @code{TARGET_REGISTER_MOVE_COST} applied to their
+classes returns a value of 2, reload does not check to ensure that the
+constraints of the insn are met. Setting a cost of other than 2 will
+allow reload to verify that the constraints are met. You should do this
+if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
+
+The default version of this function returns 2.
+@end deftypefn
+
+@defmac MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in})
+A C expression for the cost of moving data of mode @var{mode} between a
+register of class @var{class} and memory; @var{in} is zero if the value
+is to be written to memory, nonzero if it is to be read in. This cost
+is relative to those in @code{REGISTER_MOVE_COST}. If moving between
+registers and memory is more expensive than between two registers, you
+should define this macro to express the relative cost.
+
+If you do not define this macro, GCC uses a default cost of 4 plus
+the cost of copying via a secondary reload register, if one is
+needed. If your machine requires a secondary reload register to copy
+between memory and a register of @var{class} but the reload mechanism is
+more complex than copying via an intermediate, define this macro to
+reflect the actual cost of the move.
+
+GCC defines the function @code{memory_move_secondary_cost} if
+secondary reloads are needed. It computes the costs due to copying via
+a secondary register. If your machine copies from memory using a
+secondary register in the conventional way but the default base value of
+4 is not correct for your machine, define this macro to add some other
+value to the result of that function. The arguments to that function
+are the same as to this macro.
+
+These macros are obsolete, new ports should use the target hook
+@code{TARGET_MEMORY_MOVE_COST} instead.
+@end defmac
+
+@hook TARGET_MEMORY_MOVE_COST
+This target hook should return the cost of moving data of mode @var{mode}
+between a register of class @var{rclass} and memory; @var{in} is @code{false}
+if the value is to be written to memory, @code{true} if it is to be read in.
+This cost is relative to those in @code{TARGET_REGISTER_MOVE_COST}.
+If moving between registers and memory is more expensive than between two
+registers, you should add this target hook to express the relative cost.
+
+If you do not add this target hook, GCC uses a default cost of 4 plus
+the cost of copying via a secondary reload register, if one is
+needed. If your machine requires a secondary reload register to copy
+between memory and a register of @var{rclass} but the reload mechanism is
+more complex than copying via an intermediate, use this target hook to
+reflect the actual cost of the move.
+
+GCC defines the function @code{memory_move_secondary_cost} if
+secondary reloads are needed. It computes the costs due to copying via
+a secondary register. If your machine copies from memory using a
+secondary register in the conventional way but the default base value of
+4 is not correct for your machine, use this target hook to add some other
+value to the result of that function. The arguments to that function
+are the same as to this target hook.
+@end deftypefn
+
+@defmac BRANCH_COST (@var{speed_p}, @var{predictable_p})
+A C expression for the cost of a branch instruction. A value of 1 is the
+default; other values are interpreted relative to that. Parameter @var{speed_p}
+is true when the branch in question should be optimized for speed. When
+it is false, @code{BRANCH_COST} should be returning value optimal for code size
+rather then performance considerations. @var{predictable_p} is true for well
+predictable branches. On many architectures the @code{BRANCH_COST} can be
+reduced then.
+@end defmac
+
+Here are additional macros which do not specify precise relative costs,
+but only that certain actions are more expensive than GCC would
+ordinarily expect.
+
+@defmac SLOW_BYTE_ACCESS
+Define this macro as a C expression which is nonzero if accessing less
+than a word of memory (i.e.@: a @code{char} or a @code{short}) is no
+faster than accessing a word of memory, i.e., if such access
+require more than one instruction or if there is no difference in cost
+between byte and (aligned) word loads.
+
+When this macro is not defined, the compiler will access a field by
+finding the smallest containing object; when it is defined, a fullword
+load will be used if alignment permits. Unless bytes accesses are
+faster than word accesses, using word accesses is preferable since it
+may eliminate subsequent memory access if subsequent accesses occur to
+other fields in the same word of the structure, but to different bytes.
+@end defmac
+
+@defmac SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment})
+Define this macro to be the value 1 if memory accesses described by the
+@var{mode} and @var{alignment} parameters have a cost many times greater
+than aligned accesses, for example if they are emulated in a trap
+handler.
+
+When this macro is nonzero, the compiler will act as if
+@code{STRICT_ALIGNMENT} were nonzero when generating code for block
+moves. This can cause significantly more instructions to be produced.
+Therefore, do not set this macro nonzero if unaligned accesses only add a
+cycle or two to the time for a memory access.
+
+If the value of this macro is always zero, it need not be defined. If
+this macro is defined, it should produce a nonzero value when
+@code{STRICT_ALIGNMENT} is nonzero.
+@end defmac
+
+@defmac MOVE_RATIO (@var{speed})
+The threshold of number of scalar memory-to-memory move insns, @emph{below}
+which a sequence of insns should be generated instead of a
+string move insn or a library call. Increasing the value will always
+make code faster, but eventually incurs high cost in increased code size.
+
+Note that on machines where the corresponding move insn is a
+@code{define_expand} that emits a sequence of insns, this macro counts
+the number of such sequences.
+
+The parameter @var{speed} is true if the code is currently being
+optimized for speed rather than size.
+
+If you don't define this, a reasonable default is used.
+@end defmac
+
+@defmac MOVE_BY_PIECES_P (@var{size}, @var{alignment})
+A C expression used to determine whether @code{move_by_pieces} will be used to
+copy a chunk of memory, or whether some other block move mechanism
+will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less
+than @code{MOVE_RATIO}.
+@end defmac
+
+@defmac MOVE_MAX_PIECES
+A C expression used by @code{move_by_pieces} to determine the largest unit
+a load or store used to copy memory is. Defaults to @code{MOVE_MAX}.
+@end defmac
+
+@defmac CLEAR_RATIO (@var{speed})
+The threshold of number of scalar move insns, @emph{below} which a sequence
+of insns should be generated to clear memory instead of a string clear insn
+or a library call. Increasing the value will always make code faster, but
+eventually incurs high cost in increased code size.
+
+The parameter @var{speed} is true if the code is currently being
+optimized for speed rather than size.
+
+If you don't define this, a reasonable default is used.
+@end defmac
+
+@defmac CLEAR_BY_PIECES_P (@var{size}, @var{alignment})
+A C expression used to determine whether @code{clear_by_pieces} will be used
+to clear a chunk of memory, or whether some other block clear mechanism
+will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less
+than @code{CLEAR_RATIO}.
+@end defmac
+
+@defmac SET_RATIO (@var{speed})
+The threshold of number of scalar move insns, @emph{below} which a sequence
+of insns should be generated to set memory to a constant value, instead of
+a block set insn or a library call.
+Increasing the value will always make code faster, but
+eventually incurs high cost in increased code size.
+
+The parameter @var{speed} is true if the code is currently being
+optimized for speed rather than size.
+
+If you don't define this, it defaults to the value of @code{MOVE_RATIO}.
+@end defmac
+
+@defmac SET_BY_PIECES_P (@var{size}, @var{alignment})
+A C expression used to determine whether @code{store_by_pieces} will be
+used to set a chunk of memory to a constant value, or whether some
+other mechanism will be used. Used by @code{__builtin_memset} when
+storing values other than constant zero.
+Defaults to 1 if @code{move_by_pieces_ninsns} returns less
+than @code{SET_RATIO}.
+@end defmac
+
+@defmac STORE_BY_PIECES_P (@var{size}, @var{alignment})
+A C expression used to determine whether @code{store_by_pieces} will be
+used to set a chunk of memory to a constant string value, or whether some
+other mechanism will be used. Used by @code{__builtin_strcpy} when
+called with a constant source string.
+Defaults to 1 if @code{move_by_pieces_ninsns} returns less
+than @code{MOVE_RATIO}.
+@end defmac
+
+@defmac USE_LOAD_POST_INCREMENT (@var{mode})
+A C expression used to determine whether a load postincrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_POST_INCREMENT}.
+@end defmac
+
+@defmac USE_LOAD_POST_DECREMENT (@var{mode})
+A C expression used to determine whether a load postdecrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_POST_DECREMENT}.
+@end defmac
+
+@defmac USE_LOAD_PRE_INCREMENT (@var{mode})
+A C expression used to determine whether a load preincrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_PRE_INCREMENT}.
+@end defmac
+
+@defmac USE_LOAD_PRE_DECREMENT (@var{mode})
+A C expression used to determine whether a load predecrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_PRE_DECREMENT}.
+@end defmac
+
+@defmac USE_STORE_POST_INCREMENT (@var{mode})
+A C expression used to determine whether a store postincrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_POST_INCREMENT}.
+@end defmac
+
+@defmac USE_STORE_POST_DECREMENT (@var{mode})
+A C expression used to determine whether a store postdecrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_POST_DECREMENT}.
+@end defmac
+
+@defmac USE_STORE_PRE_INCREMENT (@var{mode})
+This macro is used to determine whether a store preincrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_PRE_INCREMENT}.
+@end defmac
+
+@defmac USE_STORE_PRE_DECREMENT (@var{mode})
+This macro is used to determine whether a store predecrement is a good
+thing to use for a given mode. Defaults to the value of
+@code{HAVE_PRE_DECREMENT}.
+@end defmac
+
+@defmac NO_FUNCTION_CSE
+Define this macro if it is as good or better to call a constant
+function address than to call an address kept in a register.
+@end defmac
+
+@defmac RANGE_TEST_NON_SHORT_CIRCUIT
+Define this macro if a non-short-circuit operation produced by
+@samp{fold_range_test ()} is optimal. This macro defaults to true if
+@code{BRANCH_COST} is greater than or equal to the value 2.
+@end defmac
+
+@hook TARGET_RTX_COSTS
+This target hook describes the relative costs of RTL expressions.
+
+The cost may depend on the precise form of the expression, which is
+available for examination in @var{x}, and the rtx code of the expression
+in which it is contained, found in @var{outer_code}. @var{code} is the
+expression code---redundant, since it can be obtained with
+@code{GET_CODE (@var{x})}.
+
+In implementing this hook, you can use the construct
+@code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast
+instructions.
+
+On entry to the hook, @code{*@var{total}} contains a default estimate
+for the cost of the expression. The hook should modify this value as
+necessary. Traditionally, the default costs are @code{COSTS_N_INSNS (5)}
+for multiplications, @code{COSTS_N_INSNS (7)} for division and modulus
+operations, and @code{COSTS_N_INSNS (1)} for all other operations.
+
+When optimizing for code size, i.e.@: when @code{speed} is
+false, this target hook should be used to estimate the relative
+size cost of an expression, again relative to @code{COSTS_N_INSNS}.
+
+The hook returns true when all subexpressions of @var{x} have been
+processed, and false when @code{rtx_cost} should recurse.
+@end deftypefn
+
+@hook TARGET_ADDRESS_COST
+This hook computes the cost of an addressing mode that contains
+@var{address}. If not defined, the cost is computed from
+the @var{address} expression and the @code{TARGET_RTX_COST} hook.
+
+For most CISC machines, the default cost is a good approximation of the
+true cost of the addressing mode. However, on RISC machines, all
+instructions normally have the same length and execution time. Hence
+all addresses will have equal costs.
+
+In cases where more than one form of an address is known, the form with
+the lowest cost will be used. If multiple forms have the same, lowest,
+cost, the one that is the most complex will be used.
+
+For example, suppose an address that is equal to the sum of a register
+and a constant is used twice in the same basic block. When this macro
+is not defined, the address will be computed in a register and memory
+references will be indirect through that register. On machines where
+the cost of the addressing mode containing the sum is no higher than
+that of a simple indirect reference, this will produce an additional
+instruction and possibly require an additional register. Proper
+specification of this macro eliminates this overhead for such machines.
+
+This hook is never called with an invalid address.
+
+On machines where an address involving more than one register is as
+cheap as an address computation involving only one register, defining
+@code{TARGET_ADDRESS_COST} to reflect this can cause two registers to
+be live over a region of code where only one would have been if
+@code{TARGET_ADDRESS_COST} were not defined in that manner. This effect
+should be considered in the definition of this macro. Equivalent costs
+should probably only be given to addresses with different numbers of
+registers on machines with lots of registers.
+@end deftypefn
+
+@node Scheduling
+@section Adjusting the Instruction Scheduler
+
+The instruction scheduler may need a fair amount of machine-specific
+adjustment in order to produce good code. GCC provides several target
+hooks for this purpose. It is usually enough to define just a few of
+them: try the first ones in this list first.
+
+@hook TARGET_SCHED_ISSUE_RATE
+This hook returns the maximum number of instructions that can ever
+issue at the same time on the target machine. The default is one.
+Although the insn scheduler can define itself the possibility of issue
+an insn on the same cycle, the value can serve as an additional
+constraint to issue insns on the same simulated processor cycle (see
+hooks @samp{TARGET_SCHED_REORDER} and @samp{TARGET_SCHED_REORDER2}).
+This value must be constant over the entire compilation. If you need
+it to vary depending on what the instructions are, you must use
+@samp{TARGET_SCHED_VARIABLE_ISSUE}.
+@end deftypefn
+
+@hook TARGET_SCHED_VARIABLE_ISSUE
+This hook is executed by the scheduler after it has scheduled an insn
+from the ready list. It should return the number of insns which can
+still be issued in the current cycle. The default is
+@samp{@w{@var{more} - 1}} for insns other than @code{CLOBBER} and
+@code{USE}, which normally are not counted against the issue rate.
+You should define this hook if some insns take more machine resources
+than others, so that fewer insns can follow them in the same cycle.
+@var{file} is either a null pointer, or a stdio stream to write any
+debug output to. @var{verbose} is the verbose level provided by
+@option{-fsched-verbose-@var{n}}. @var{insn} is the instruction that
+was scheduled.
+@end deftypefn
+
+@hook TARGET_SCHED_ADJUST_COST
+This function corrects the value of @var{cost} based on the
+relationship between @var{insn} and @var{dep_insn} through the
+dependence @var{link}. It should return the new value. The default
+is to make no adjustment to @var{cost}. This can be used for example
+to specify to the scheduler using the traditional pipeline description
+that an output- or anti-dependence does not incur the same cost as a
+data-dependence. If the scheduler using the automaton based pipeline
+description, the cost of anti-dependence is zero and the cost of
+output-dependence is maximum of one and the difference of latency
+times of the first and the second insns. If these values are not
+acceptable, you could use the hook to modify them too. See also
+@pxref{Processor pipeline description}.
+@end deftypefn
+
+@hook TARGET_SCHED_ADJUST_PRIORITY
+This hook adjusts the integer scheduling priority @var{priority} of
+@var{insn}. It should return the new priority. Increase the priority to
+execute @var{insn} earlier, reduce the priority to execute @var{insn}
+later. Do not define this hook if you do not need to adjust the
+scheduling priorities of insns.
+@end deftypefn
+
+@hook TARGET_SCHED_REORDER
+This hook is executed by the scheduler after it has scheduled the ready
+list, to allow the machine description to reorder it (for example to
+combine two small instructions together on @samp{VLIW} machines).
+@var{file} is either a null pointer, or a stdio stream to write any
+debug output to. @var{verbose} is the verbose level provided by
+@option{-fsched-verbose-@var{n}}. @var{ready} is a pointer to the ready
+list of instructions that are ready to be scheduled. @var{n_readyp} is
+a pointer to the number of elements in the ready list. The scheduler
+reads the ready list in reverse order, starting with
+@var{ready}[@var{*n_readyp} @minus{} 1] and going to @var{ready}[0]. @var{clock}
+is the timer tick of the scheduler. You may modify the ready list and
+the number of ready insns. The return value is the number of insns that
+can issue this cycle; normally this is just @code{issue_rate}. See also
+@samp{TARGET_SCHED_REORDER2}.
+@end deftypefn
+
+@hook TARGET_SCHED_REORDER2
+Like @samp{TARGET_SCHED_REORDER}, but called at a different time. That
+function is called whenever the scheduler starts a new cycle. This one
+is called once per iteration over a cycle, immediately after
+@samp{TARGET_SCHED_VARIABLE_ISSUE}; it can reorder the ready list and
+return the number of insns to be scheduled in the same cycle. Defining
+this hook can be useful if there are frequent situations where
+scheduling one insn causes other insns to become ready in the same
+cycle. These other insns can then be taken into account properly.
+@end deftypefn
+
+@hook TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK
+This hook is called after evaluation forward dependencies of insns in
+chain given by two parameter values (@var{head} and @var{tail}
+correspondingly) but before insns scheduling of the insn chain. For
+example, it can be used for better insn classification if it requires
+analysis of dependencies. This hook can use backward and forward
+dependencies of the insn scheduler because they are already
+calculated.
+@end deftypefn
+
+@hook TARGET_SCHED_INIT
+This hook is executed by the scheduler at the beginning of each block of
+instructions that are to be scheduled. @var{file} is either a null
+pointer, or a stdio stream to write any debug output to. @var{verbose}
+is the verbose level provided by @option{-fsched-verbose-@var{n}}.
+@var{max_ready} is the maximum number of insns in the current scheduling
+region that can be live at the same time. This can be used to allocate
+scratch space if it is needed, e.g.@: by @samp{TARGET_SCHED_REORDER}.
+@end deftypefn
+
+@hook TARGET_SCHED_FINISH
+This hook is executed by the scheduler at the end of each block of
+instructions that are to be scheduled. It can be used to perform
+cleanup of any actions done by the other scheduling hooks. @var{file}
+is either a null pointer, or a stdio stream to write any debug output
+to. @var{verbose} is the verbose level provided by
+@option{-fsched-verbose-@var{n}}.
+@end deftypefn
+
+@hook TARGET_SCHED_INIT_GLOBAL
+This hook is executed by the scheduler after function level initializations.
+@var{file} is either a null pointer, or a stdio stream to write any debug output to.
+@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}.
+@var{old_max_uid} is the maximum insn uid when scheduling begins.
+@end deftypefn
+
+@hook TARGET_SCHED_FINISH_GLOBAL
+This is the cleanup hook corresponding to @code{TARGET_SCHED_INIT_GLOBAL}.
+@var{file} is either a null pointer, or a stdio stream to write any debug output to.
+@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}.
+@end deftypefn
+
+@hook TARGET_SCHED_DFA_PRE_CYCLE_INSN
+The hook returns an RTL insn. The automaton state used in the
+pipeline hazard recognizer is changed as if the insn were scheduled
+when the new simulated processor cycle starts. Usage of the hook may
+simplify the automaton pipeline description for some @acronym{VLIW}
+processors. If the hook is defined, it is used only for the automaton
+based pipeline description. The default is not to change the state
+when the new simulated processor cycle starts.
+@end deftypefn
+
+@hook TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN
+The hook can be used to initialize data used by the previous hook.
+@end deftypefn
+
+@hook TARGET_SCHED_DFA_POST_CYCLE_INSN
+The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but used
+to changed the state as if the insn were scheduled when the new
+simulated processor cycle finishes.
+@end deftypefn
+
+@hook TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN
+The hook is analogous to @samp{TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN} but
+used to initialize data used by the previous hook.
+@end deftypefn
+
+@hook TARGET_SCHED_DFA_PRE_ADVANCE_CYCLE
+The hook to notify target that the current simulated cycle is about to finish.
+The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but used
+to change the state in more complicated situations - e.g., when advancing
+state on a single insn is not enough.
+@end deftypefn
+
+@hook TARGET_SCHED_DFA_POST_ADVANCE_CYCLE
+The hook to notify target that new simulated cycle has just started.
+The hook is analogous to @samp{TARGET_SCHED_DFA_POST_CYCLE_INSN} but used
+to change the state in more complicated situations - e.g., when advancing
+state on a single insn is not enough.
+@end deftypefn
+
+@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
+This hook controls better choosing an insn from the ready insn queue
+for the @acronym{DFA}-based insn scheduler. Usually the scheduler
+chooses the first insn from the queue. If the hook returns a positive
+value, an additional scheduler code tries all permutations of
+@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD ()}
+subsequent ready insns to choose an insn whose issue will result in
+maximal number of issued insns on the same cycle. For the
+@acronym{VLIW} processor, the code could actually solve the problem of
+packing simple insns into the @acronym{VLIW} insn. Of course, if the
+rules of @acronym{VLIW} packing are described in the automaton.
+
+This code also could be used for superscalar @acronym{RISC}
+processors. Let us consider a superscalar @acronym{RISC} processor
+with 3 pipelines. Some insns can be executed in pipelines @var{A} or
+@var{B}, some insns can be executed only in pipelines @var{B} or
+@var{C}, and one insn can be executed in pipeline @var{B}. The
+processor may issue the 1st insn into @var{A} and the 2nd one into
+@var{B}. In this case, the 3rd insn will wait for freeing @var{B}
+until the next cycle. If the scheduler issues the 3rd insn the first,
+the processor could issue all 3 insns per cycle.
+
+Actually this code demonstrates advantages of the automaton based
+pipeline hazard recognizer. We try quickly and easy many insn
+schedules to choose the best one.
+
+The default is no multipass scheduling.
+@end deftypefn
+
+@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD
+
+This hook controls what insns from the ready insn queue will be
+considered for the multipass insn scheduling. If the hook returns
+zero for @var{insn}, the insn will be not chosen to
+be issued.
+
+The default is that any ready insns can be chosen to be issued.
+@end deftypefn
+
+@hook TARGET_SCHED_DFA_NEW_CYCLE
+This hook is called by the insn scheduler before issuing @var{insn}
+on cycle @var{clock}. If the hook returns nonzero,
+@var{insn} is not issued on this processor cycle. Instead,
+the processor cycle is advanced. If *@var{sort_p}
+is zero, the insn ready queue is not sorted on the new cycle
+start as usually. @var{dump} and @var{verbose} specify the file and
+verbosity level to use for debugging output.
+@var{last_clock} and @var{clock} are, respectively, the
+processor cycle on which the previous insn has been issued,
+and the current processor cycle.
+@end deftypefn
+
+@hook TARGET_SCHED_IS_COSTLY_DEPENDENCE
+This hook is used to define which dependences are considered costly by
+the target, so costly that it is not advisable to schedule the insns that
+are involved in the dependence too close to one another. The parameters
+to this hook are as follows: The first parameter @var{_dep} is the dependence
+being evaluated. The second parameter @var{cost} is the cost of the
+dependence as estimated by the scheduler, and the third
+parameter @var{distance} is the distance in cycles between the two insns.
+The hook returns @code{true} if considering the distance between the two
+insns the dependence between them is considered costly by the target,
+and @code{false} otherwise.
+
+Defining this hook can be useful in multiple-issue out-of-order machines,
+where (a) it's practically hopeless to predict the actual data/resource
+delays, however: (b) there's a better chance to predict the actual grouping
+that will be formed, and (c) correctly emulating the grouping can be very
+important. In such targets one may want to allow issuing dependent insns
+closer to one another---i.e., closer than the dependence distance; however,
+not in cases of ``costly dependences'', which this hooks allows to define.
+@end deftypefn
+
+@hook TARGET_SCHED_H_I_D_EXTENDED
+This hook is called by the insn scheduler after emitting a new instruction to
+the instruction stream. The hook notifies a target backend to extend its
+per instruction data structures.
+@end deftypefn
+
+@hook TARGET_SCHED_ALLOC_SCHED_CONTEXT
+Return a pointer to a store large enough to hold target scheduling context.
+@end deftypefn
+
+@hook TARGET_SCHED_INIT_SCHED_CONTEXT
+Initialize store pointed to by @var{tc} to hold target scheduling context.
+It @var{clean_p} is true then initialize @var{tc} as if scheduler is at the
+beginning of the block. Otherwise, copy the current context into @var{tc}.
+@end deftypefn
+
+@hook TARGET_SCHED_SET_SCHED_CONTEXT
+Copy target scheduling context pointed to by @var{tc} to the current context.
+@end deftypefn
+
+@hook TARGET_SCHED_CLEAR_SCHED_CONTEXT
+Deallocate internal data in target scheduling context pointed to by @var{tc}.
+@end deftypefn
+
+@hook TARGET_SCHED_FREE_SCHED_CONTEXT
+Deallocate a store for target scheduling context pointed to by @var{tc}.
+@end deftypefn
+
+@hook TARGET_SCHED_SPECULATE_INSN
+This hook is called by the insn scheduler when @var{insn} has only
+speculative dependencies and therefore can be scheduled speculatively.
+The hook is used to check if the pattern of @var{insn} has a speculative
+version and, in case of successful check, to generate that speculative
+pattern. The hook should return 1, if the instruction has a speculative form,
+or @minus{}1, if it doesn't. @var{request} describes the type of requested
+speculation. If the return value equals 1 then @var{new_pat} is assigned
+the generated speculative pattern.
+@end deftypefn
+
+@hook TARGET_SCHED_NEEDS_BLOCK_P
+This hook is called by the insn scheduler during generation of recovery code
+for @var{insn}. It should return @code{true}, if the corresponding check
+instruction should branch to recovery code, or @code{false} otherwise.
+@end deftypefn
+
+@hook TARGET_SCHED_GEN_SPEC_CHECK
+This hook is called by the insn scheduler to generate a pattern for recovery
+check instruction. If @var{mutate_p} is zero, then @var{insn} is a
+speculative instruction for which the check should be generated.
+@var{label} is either a label of a basic block, where recovery code should
+be emitted, or a null pointer, when requested check doesn't branch to
+recovery code (a simple check). If @var{mutate_p} is nonzero, then
+a pattern for a branchy check corresponding to a simple check denoted by
+@var{insn} should be generated. In this case @var{label} can't be null.
+@end deftypefn
+
+@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD_SPEC
+This hook is used as a workaround for
+@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD} not being
+called on the first instruction of the ready list. The hook is used to
+discard speculative instructions that stand first in the ready list from
+being scheduled on the current cycle. If the hook returns @code{false},
+@var{insn} will not be chosen to be issued.
+For non-speculative instructions,
+the hook should always return @code{true}. For example, in the ia64 backend
+the hook is used to cancel data speculative insns when the ALAT table
+is nearly full.
+@end deftypefn
+
+@hook TARGET_SCHED_SET_SCHED_FLAGS
+This hook is used by the insn scheduler to find out what features should be
+enabled/used.
+The structure *@var{spec_info} should be filled in by the target.
+The structure describes speculation types that can be used in the scheduler.
+@end deftypefn
+
+@hook TARGET_SCHED_SMS_RES_MII
+This hook is called by the swing modulo scheduler to calculate a
+resource-based lower bound which is based on the resources available in
+the machine and the resources required by each instruction. The target
+backend can use @var{g} to calculate such bound. A very simple lower
+bound will be used in case this hook is not implemented: the total number
+of instructions divided by the issue rate.
+@end deftypefn
+
+@node Sections
+@section Dividing the Output into Sections (Texts, Data, @dots{})
+@c the above section title is WAY too long. maybe cut the part between
+@c the (...)? --mew 10feb93
+
+An object file is divided into sections containing different types of
+data. In the most common case, there are three sections: the @dfn{text
+section}, which holds instructions and read-only data; the @dfn{data
+section}, which holds initialized writable data; and the @dfn{bss
+section}, which holds uninitialized data. Some systems have other kinds
+of sections.
+
+@file{varasm.c} provides several well-known sections, such as
+@code{text_section}, @code{data_section} and @code{bss_section}.
+The normal way of controlling a @code{@var{foo}_section} variable
+is to define the associated @code{@var{FOO}_SECTION_ASM_OP} macro,
+as described below. The macros are only read once, when @file{varasm.c}
+initializes itself, so their values must be run-time constants.
+They may however depend on command-line flags.
+
+@emph{Note:} Some run-time files, such @file{crtstuff.c}, also make
+use of the @code{@var{FOO}_SECTION_ASM_OP} macros, and expect them
+to be string literals.
+
+Some assemblers require a different string to be written every time a
+section is selected. If your assembler falls into this category, you
+should define the @code{TARGET_ASM_INIT_SECTIONS} hook and use
+@code{get_unnamed_section} to set up the sections.
+
+You must always create a @code{text_section}, either by defining
+@code{TEXT_SECTION_ASM_OP} or by initializing @code{text_section}
+in @code{TARGET_ASM_INIT_SECTIONS}. The same is true of
+@code{data_section} and @code{DATA_SECTION_ASM_OP}. If you do not
+create a distinct @code{readonly_data_section}, the default is to
+reuse @code{text_section}.
+
+All the other @file{varasm.c} sections are optional, and are null
+if the target does not provide them.
+
+@defmac TEXT_SECTION_ASM_OP
+A C expression whose value is a string, including spacing, containing the
+assembler operation that should precede instructions and read-only data.
+Normally @code{"\t.text"} is right.
+@end defmac
+
+@defmac HOT_TEXT_SECTION_NAME
+If defined, a C string constant for the name of the section containing most
+frequently executed functions of the program. If not defined, GCC will provide
+a default definition if the target supports named sections.
+@end defmac
+
+@defmac UNLIKELY_EXECUTED_TEXT_SECTION_NAME
+If defined, a C string constant for the name of the section containing unlikely
+executed functions in the program.
+@end defmac
+
+@defmac DATA_SECTION_ASM_OP
+A C expression whose value is a string, including spacing, containing the
+assembler operation to identify the following data as writable initialized
+data. Normally @code{"\t.data"} is right.
+@end defmac
+
+@defmac SDATA_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+initialized, writable small data.
+@end defmac
+
+@defmac READONLY_DATA_SECTION_ASM_OP
+A C expression whose value is a string, including spacing, containing the
+assembler operation to identify the following data as read-only initialized
+data.
+@end defmac
+
+@defmac BSS_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+uninitialized global data. If not defined, and neither
+@code{ASM_OUTPUT_BSS} nor @code{ASM_OUTPUT_ALIGNED_BSS} are defined,
+uninitialized global data will be output in the data section if
+@option{-fno-common} is passed, otherwise @code{ASM_OUTPUT_COMMON} will be
+used.
+@end defmac
+
+@defmac SBSS_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+uninitialized, writable small data.
+@end defmac
+
+@defmac TLS_COMMON_ASM_OP
+If defined, a C expression whose value is a string containing the
+assembler operation to identify the following data as thread-local
+common data. The default is @code{".tls_common"}.
+@end defmac
+
+@defmac TLS_SECTION_ASM_FLAG
+If defined, a C expression whose value is a character constant
+containing the flag used to mark a section as a TLS section. The
+default is @code{'T'}.
+@end defmac
+
+@defmac INIT_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+initialization code. If not defined, GCC will assume such a section does
+not exist. This section has no corresponding @code{init_section}
+variable; it is used entirely in runtime code.
+@end defmac
+
+@defmac FINI_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+finalization code. If not defined, GCC will assume such a section does
+not exist. This section has no corresponding @code{fini_section}
+variable; it is used entirely in runtime code.
+@end defmac
+
+@defmac INIT_ARRAY_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+part of the @code{.init_array} (or equivalent) section. If not
+defined, GCC will assume such a section does not exist. Do not define
+both this macro and @code{INIT_SECTION_ASM_OP}.
+@end defmac
+
+@defmac FINI_ARRAY_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+part of the @code{.fini_array} (or equivalent) section. If not
+defined, GCC will assume such a section does not exist. Do not define
+both this macro and @code{FINI_SECTION_ASM_OP}.
+@end defmac
+
+@defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})
+If defined, an ASM statement that switches to a different section
+via @var{section_op}, calls @var{function}, and switches back to
+the text section. This is used in @file{crtstuff.c} if
+@code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls
+to initialization and finalization functions from the init and fini
+sections. By default, this macro uses a simple function call. Some
+ports need hand-crafted assembly code to avoid dependencies on
+registers initialized in the function prologue or to ensure that
+constant pools don't end up too far way in the text section.
+@end defmac
+
+@defmac TARGET_LIBGCC_SDATA_SECTION
+If defined, a string which names the section into which small
+variables defined in crtstuff and libgcc should go. This is useful
+when the target has options for optimizing access to small data, and
+you want the crtstuff and libgcc routines to be conservative in what
+they expect of your application yet liberal in what your application
+expects. For example, for targets with a @code{.sdata} section (like
+MIPS), you could compile crtstuff with @code{-G 0} so that it doesn't
+require small data support from your application, but use this macro
+to put small data into @code{.sdata} so that your application can
+access these variables whether it uses small data or not.
+@end defmac
+
+@defmac FORCE_CODE_SECTION_ALIGN
+If defined, an ASM statement that aligns a code section to some
+arbitrary boundary. This is used to force all fragments of the
+@code{.init} and @code{.fini} sections to have to same alignment
+and thus prevent the linker from having to add any padding.
+@end defmac
+
+@defmac JUMP_TABLES_IN_TEXT_SECTION
+Define this macro to be an expression with a nonzero value if jump
+tables (for @code{tablejump} insns) should be output in the text
+section, along with the assembler instructions. Otherwise, the
+readonly data section is used.
+
+This macro is irrelevant if there is no separate readonly data section.
+@end defmac
+
+@hook TARGET_ASM_INIT_SECTIONS
+Define this hook if you need to do something special to set up the
+@file{varasm.c} sections, or if your target has some special sections
+of its own that you need to create.
+
+GCC calls this hook after processing the command line, but before writing
+any assembly code, and before calling any of the section-returning hooks
+described below.
+@end deftypefn
+
+@hook TARGET_ASM_RELOC_RW_MASK
+Return a mask describing how relocations should be treated when
+selecting sections. Bit 1 should be set if global relocations
+should be placed in a read-write section; bit 0 should be set if
+local relocations should be placed in a read-write section.
+
+The default version of this function returns 3 when @option{-fpic}
+is in effect, and 0 otherwise. The hook is typically redefined
+when the target cannot support (some kinds of) dynamic relocations
+in read-only sections even in executables.
+@end deftypefn
+
+@hook TARGET_ASM_SELECT_SECTION
+Return the section into which @var{exp} should be placed. You can
+assume that @var{exp} is either a @code{VAR_DECL} node or a constant of
+some sort. @var{reloc} indicates whether the initial value of @var{exp}
+requires link-time relocations. Bit 0 is set when variable contains
+local relocations only, while bit 1 is set for global relocations.
+@var{align} is the constant alignment in bits.
+
+The default version of this function takes care of putting read-only
+variables in @code{readonly_data_section}.
+
+See also @var{USE_SELECT_SECTION_FOR_FUNCTIONS}.
+@end deftypefn
+
+@defmac USE_SELECT_SECTION_FOR_FUNCTIONS
+Define this macro if you wish TARGET_ASM_SELECT_SECTION to be called
+for @code{FUNCTION_DECL}s as well as for variables and constants.
+
+In the case of a @code{FUNCTION_DECL}, @var{reloc} will be zero if the
+function has been determined to be likely to be called, and nonzero if
+it is unlikely to be called.
+@end defmac
+
+@hook TARGET_ASM_UNIQUE_SECTION
+Build up a unique section name, expressed as a @code{STRING_CST} node,
+and assign it to @samp{DECL_SECTION_NAME (@var{decl})}.
+As with @code{TARGET_ASM_SELECT_SECTION}, @var{reloc} indicates whether
+the initial value of @var{exp} requires link-time relocations.
+
+The default version of this function appends the symbol name to the
+ELF section name that would normally be used for the symbol. For
+example, the function @code{foo} would be placed in @code{.text.foo}.
+Whatever the actual target object format, this is often good enough.
+@end deftypefn
+
+@hook TARGET_ASM_FUNCTION_RODATA_SECTION
+Return the readonly data section associated with
+@samp{DECL_SECTION_NAME (@var{decl})}.
+The default version of this function selects @code{.gnu.linkonce.r.name} if
+the function's section is @code{.gnu.linkonce.t.name}, @code{.rodata.name}
+if function is in @code{.text.name}, and the normal readonly-data section
+otherwise.
+@end deftypefn
+
+@hook TARGET_ASM_SELECT_RTX_SECTION
+Return the section into which a constant @var{x}, of mode @var{mode},
+should be placed. You can assume that @var{x} is some kind of
+constant in RTL@. The argument @var{mode} is redundant except in the
+case of a @code{const_int} rtx. @var{align} is the constant alignment
+in bits.
+
+The default version of this function takes care of putting symbolic
+constants in @code{flag_pic} mode in @code{data_section} and everything
+else in @code{readonly_data_section}.
+@end deftypefn
+
+@hook TARGET_MANGLE_DECL_ASSEMBLER_NAME
+Define this hook if you need to postprocess the assembler name generated
+by target-independent code. The @var{id} provided to this hook will be
+the computed name (e.g., the macro @code{DECL_NAME} of the @var{decl} in C,
+or the mangled name of the @var{decl} in C++). The return value of the
+hook is an @code{IDENTIFIER_NODE} for the appropriate mangled name on
+your target system. The default implementation of this hook just
+returns the @var{id} provided.
+@end deftypefn
+
+@hook TARGET_ENCODE_SECTION_INFO
+Define this hook if references to a symbol or a constant must be
+treated differently depending on something about the variable or
+function named by the symbol (such as what section it is in).
+
+The hook is executed immediately after rtl has been created for
+@var{decl}, which may be a variable or function declaration or
+an entry in the constant pool. In either case, @var{rtl} is the
+rtl in question. Do @emph{not} use @code{DECL_RTL (@var{decl})}
+in this hook; that field may not have been initialized yet.
+
+In the case of a constant, it is safe to assume that the rtl is
+a @code{mem} whose address is a @code{symbol_ref}. Most decls
+will also have this form, but that is not guaranteed. Global
+register variables, for instance, will have a @code{reg} for their
+rtl. (Normally the right thing to do with such unusual rtl is
+leave it alone.)
+
+The @var{new_decl_p} argument will be true if this is the first time
+that @code{TARGET_ENCODE_SECTION_INFO} has been invoked on this decl. It will
+be false for subsequent invocations, which will happen for duplicate
+declarations. Whether or not anything must be done for the duplicate
+declaration depends on whether the hook examines @code{DECL_ATTRIBUTES}.
+@var{new_decl_p} is always true when the hook is called for a constant.
+
+@cindex @code{SYMBOL_REF_FLAG}, in @code{TARGET_ENCODE_SECTION_INFO}
+The usual thing for this hook to do is to record flags in the
+@code{symbol_ref}, using @code{SYMBOL_REF_FLAG} or @code{SYMBOL_REF_FLAGS}.
+Historically, the name string was modified if it was necessary to
+encode more than one bit of information, but this practice is now
+discouraged; use @code{SYMBOL_REF_FLAGS}.
+
+The default definition of this hook, @code{default_encode_section_info}
+in @file{varasm.c}, sets a number of commonly-useful bits in
+@code{SYMBOL_REF_FLAGS}. Check whether the default does what you need
+before overriding it.
+@end deftypefn
+
+@hook TARGET_STRIP_NAME_ENCODING
+Decode @var{name} and return the real name part, sans
+the characters that @code{TARGET_ENCODE_SECTION_INFO}
+may have added.
+@end deftypefn
+
+@hook TARGET_IN_SMALL_DATA_P
+Returns true if @var{exp} should be placed into a ``small data'' section.
+The default version of this hook always returns false.
+@end deftypefn
+
+@hook TARGET_HAVE_SRODATA_SECTION
+Contains the value true if the target places read-only
+``small data'' into a separate section. The default value is false.
+@end deftypevr
+
+@hook TARGET_BINDS_LOCAL_P
+Returns true if @var{exp} names an object for which name resolution
+rules must resolve to the current ``module'' (dynamic shared library
+or executable image).
+
+The default version of this hook implements the name resolution rules
+for ELF, which has a looser model of global name binding than other
+currently supported object file formats.
+@end deftypefn
+
+@hook TARGET_HAVE_TLS
+Contains the value true if the target supports thread-local storage.
+The default value is false.
+@end deftypevr
+
+
+@node PIC
+@section Position Independent Code
+@cindex position independent code
+@cindex PIC
+
+This section describes macros that help implement generation of position
+independent code. Simply defining these macros is not enough to
+generate valid PIC; you must also add support to the hook
+@code{TARGET_LEGITIMATE_ADDRESS_P} and to the macro
+@code{PRINT_OPERAND_ADDRESS}, as well as @code{LEGITIMIZE_ADDRESS}. You
+must modify the definition of @samp{movsi} to do something appropriate
+when the source operand contains a symbolic address. You may also
+need to alter the handling of switch statements so that they use
+relative addresses.
+@c i rearranged the order of the macros above to try to force one of
+@c them to the next line, to eliminate an overfull hbox. --mew 10feb93
+
+@defmac PIC_OFFSET_TABLE_REGNUM
+The register number of the register used to address a table of static
+data addresses in memory. In some cases this register is defined by a
+processor's ``application binary interface'' (ABI)@. When this macro
+is defined, RTL is generated for this register once, as with the stack
+pointer and frame pointer registers. If this macro is not defined, it
+is up to the machine-dependent files to allocate such a register (if
+necessary). Note that this register must be fixed when in use (e.g.@:
+when @code{flag_pic} is true).
+@end defmac
+
+@defmac PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
+Define this macro if the register defined by
+@code{PIC_OFFSET_TABLE_REGNUM} is clobbered by calls. Do not define
+this macro if @code{PIC_OFFSET_TABLE_REGNUM} is not defined.
+@end defmac
+
+@defmac LEGITIMATE_PIC_OPERAND_P (@var{x})
+A C expression that is nonzero if @var{x} is a legitimate immediate
+operand on the target machine when generating position independent code.
+You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not
+check this. You can also assume @var{flag_pic} is true, so you need not
+check it either. You need not define this macro if all constants
+(including @code{SYMBOL_REF}) can be immediate operands when generating
+position independent code.
+@end defmac
+
+@node Assembler Format
+@section Defining the Output Assembler Language
+
+This section describes macros whose principal purpose is to describe how
+to write instructions in assembler language---rather than what the
+instructions do.
+
+@menu
+* File Framework:: Structural information for the assembler file.
+* Data Output:: Output of constants (numbers, strings, addresses).
+* Uninitialized Data:: Output of uninitialized variables.
+* Label Output:: Output and generation of labels.
+* Initialization:: General principles of initialization
+ and termination routines.
+* Macros for Initialization::
+ Specific macros that control the handling of
+ initialization and termination routines.
+* Instruction Output:: Output of actual instructions.
+* Dispatch Tables:: Output of jump tables.
+* Exception Region Output:: Output of exception region code.
+* Alignment Output:: Pseudo ops for alignment and skipping data.
+@end menu
+
+@node File Framework
+@subsection The Overall Framework of an Assembler File
+@cindex assembler format
+@cindex output of assembler code
+
+@c prevent bad page break with this line
+This describes the overall framework of an assembly file.
+
+@findex default_file_start
+@hook TARGET_ASM_FILE_START
+Output to @code{asm_out_file} any text which the assembler expects to
+find at the beginning of a file. The default behavior is controlled
+by two flags, documented below. Unless your target's assembler is
+quite unusual, if you override the default, you should call
+@code{default_file_start} at some point in your target hook. This
+lets other target files rely on these variables.
+@end deftypefn
+
+@hook TARGET_ASM_FILE_START_APP_OFF
+If this flag is true, the text of the macro @code{ASM_APP_OFF} will be
+printed as the very first line in the assembly file, unless
+@option{-fverbose-asm} is in effect. (If that macro has been defined
+to the empty string, this variable has no effect.) With the normal
+definition of @code{ASM_APP_OFF}, the effect is to notify the GNU
+assembler that it need not bother stripping comments or extra
+whitespace from its input. This allows it to work a bit faster.
+
+The default is false. You should not set it to true unless you have
+verified that your port does not generate any extra whitespace or
+comments that will cause GAS to issue errors in NO_APP mode.
+@end deftypevr
+
+@hook TARGET_ASM_FILE_START_FILE_DIRECTIVE
+If this flag is true, @code{output_file_directive} will be called
+for the primary source file, immediately after printing
+@code{ASM_APP_OFF} (if that is enabled). Most ELF assemblers expect
+this to be done. The default is false.
+@end deftypevr
+
+@hook TARGET_ASM_FILE_END
+Output to @code{asm_out_file} any text which the assembler expects
+to find at the end of a file. The default is to output nothing.
+@end deftypefn
+
+@deftypefun void file_end_indicate_exec_stack ()
+Some systems use a common convention, the @samp{.note.GNU-stack}
+special section, to indicate whether or not an object file relies on
+the stack being executable. If your system uses this convention, you
+should define @code{TARGET_ASM_FILE_END} to this function. If you
+need to do other things in that hook, have your hook function call
+this function.
+@end deftypefun
+
+@hook TARGET_ASM_LTO_START
+Output to @code{asm_out_file} any text which the assembler expects
+to find at the start of an LTO section. The default is to output
+nothing.
+@end deftypefn
+
+@hook TARGET_ASM_LTO_END
+Output to @code{asm_out_file} any text which the assembler expects
+to find at the end of an LTO section. The default is to output
+nothing.
+@end deftypefn
+
+@hook TARGET_ASM_CODE_END
+Output to @code{asm_out_file} any text which is needed before emitting
+unwind info and debug info at the end of a file. Some targets emit
+here PIC setup thunks that cannot be emitted at the end of file,
+because they couldn't have unwind info then. The default is to output
+nothing.
+@end deftypefn
+
+@defmac ASM_COMMENT_START
+A C string constant describing how to begin a comment in the target
+assembler language. The compiler assumes that the comment will end at
+the end of the line.
+@end defmac
+
+@defmac ASM_APP_ON
+A C string constant for text to be output before each @code{asm}
+statement or group of consecutive ones. Normally this is
+@code{"#APP"}, which is a comment that has no effect on most
+assemblers but tells the GNU assembler that it must check the lines
+that follow for all valid assembler constructs.
+@end defmac
+
+@defmac ASM_APP_OFF
+A C string constant for text to be output after each @code{asm}
+statement or group of consecutive ones. Normally this is
+@code{"#NO_APP"}, which tells the GNU assembler to resume making the
+time-saving assumptions that are valid for ordinary compiler output.
+@end defmac
+
+@defmac ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
+A C statement to output COFF information or DWARF debugging information
+which indicates that filename @var{name} is the current source file to
+the stdio stream @var{stream}.
+
+This macro need not be defined if the standard form of output
+for the file format in use is appropriate.
+@end defmac
+
+@defmac OUTPUT_QUOTED_STRING (@var{stream}, @var{string})
+A C statement to output the string @var{string} to the stdio stream
+@var{stream}. If you do not call the function @code{output_quoted_string}
+in your config files, GCC will only call it to output filenames to
+the assembler source. So you can use it to canonicalize the format
+of the filename using this macro.
+@end defmac
+
+@defmac ASM_OUTPUT_IDENT (@var{stream}, @var{string})
+A C statement to output something to the assembler file to handle a
+@samp{#ident} directive containing the text @var{string}. If this
+macro is not defined, nothing is output for a @samp{#ident} directive.
+@end defmac
+
+@hook TARGET_ASM_NAMED_SECTION
+Output assembly directives to switch to section @var{name}. The section
+should have attributes as specified by @var{flags}, which is a bit mask
+of the @code{SECTION_*} flags defined in @file{output.h}. If @var{decl}
+is non-NULL, it is the @code{VAR_DECL} or @code{FUNCTION_DECL} with which
+this section is associated.
+@end deftypefn
+
+@hook TARGET_HAVE_NAMED_SECTIONS
+This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}.
+@end deftypevr
+
+@anchor{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}
+@hook TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
+This flag is true if we can create zeroed data by switching to a BSS
+section and then using @code{ASM_OUTPUT_SKIP} to allocate the space.
+This is true on most ELF targets.
+@end deftypevr
+
+@hook TARGET_SECTION_TYPE_FLAGS
+Choose a set of section attributes for use by @code{TARGET_ASM_NAMED_SECTION}
+based on a variable or function decl, a section name, and whether or not the
+declaration's initializer may contain runtime relocations. @var{decl} may be
+null, in which case read-write data should be assumed.
+
+The default version of this function handles choosing code vs data,
+read-only vs read-write data, and @code{flag_pic}. You should only
+need to override this if your target has special flags that might be
+set via @code{__attribute__}.
+@end deftypefn
+
+@hook TARGET_ASM_RECORD_GCC_SWITCHES
+Provides the target with the ability to record the gcc command line
+switches that have been passed to the compiler, and options that are
+enabled. The @var{type} argument specifies what is being recorded.
+It can take the following values:
+
+@table @gcctabopt
+@item SWITCH_TYPE_PASSED
+@var{text} is a command line switch that has been set by the user.
+
+@item SWITCH_TYPE_ENABLED
+@var{text} is an option which has been enabled. This might be as a
+direct result of a command line switch, or because it is enabled by
+default or because it has been enabled as a side effect of a different
+command line switch. For example, the @option{-O2} switch enables
+various different individual optimization passes.
+
+@item SWITCH_TYPE_DESCRIPTIVE
+@var{text} is either NULL or some descriptive text which should be
+ignored. If @var{text} is NULL then it is being used to warn the
+target hook that either recording is starting or ending. The first
+time @var{type} is SWITCH_TYPE_DESCRIPTIVE and @var{text} is NULL, the
+warning is for start up and the second time the warning is for
+wind down. This feature is to allow the target hook to make any
+necessary preparations before it starts to record switches and to
+perform any necessary tidying up after it has finished recording
+switches.
+
+@item SWITCH_TYPE_LINE_START
+This option can be ignored by this target hook.
+
+@item SWITCH_TYPE_LINE_END
+This option can be ignored by this target hook.
+@end table
+
+The hook's return value must be zero. Other return values may be
+supported in the future.
+
+By default this hook is set to NULL, but an example implementation is
+provided for ELF based targets. Called @var{elf_record_gcc_switches},
+it records the switches as ASCII text inside a new, string mergeable
+section in the assembler output file. The name of the new section is
+provided by the @code{TARGET_ASM_RECORD_GCC_SWITCHES_SECTION} target
+hook.
+@end deftypefn
+
+@hook TARGET_ASM_RECORD_GCC_SWITCHES_SECTION
+This is the name of the section that will be created by the example
+ELF implementation of the @code{TARGET_ASM_RECORD_GCC_SWITCHES} target
+hook.
+@end deftypevr
+
+@need 2000
+@node Data Output
+@subsection Output of Data
+
+
+@hook TARGET_ASM_BYTE_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP
+These hooks specify assembly directives for creating certain kinds
+of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a
+byte-sized object, the @code{TARGET_ASM_ALIGNED_HI_OP} one creates an
+aligned two-byte object, and so on. Any of the hooks may be
+@code{NULL}, indicating that no suitable directive is available.
+
+The compiler will print these strings at the start of a new line,
+followed immediately by the object's initial value. In most cases,
+the string should contain a tab, a pseudo-op, and then another tab.
+@end deftypevr
+
+@hook TARGET_ASM_INTEGER
+The @code{assemble_integer} function uses this hook to output an
+integer object. @var{x} is the object's value, @var{size} is its size
+in bytes and @var{aligned_p} indicates whether it is aligned. The
+function should return @code{true} if it was able to output the
+object. If it returns false, @code{assemble_integer} will try to
+split the object into smaller parts.
+
+The default implementation of this hook will use the
+@code{TARGET_ASM_BYTE_OP} family of strings, returning @code{false}
+when the relevant string is @code{NULL}.
+@end deftypefn
+
+@defmac OUTPUT_ADDR_CONST_EXTRA (@var{stream}, @var{x}, @var{fail})
+A C statement to recognize @var{rtx} patterns that
+@code{output_addr_const} can't deal with, and output assembly code to
+@var{stream} corresponding to the pattern @var{x}. This may be used to
+allow machine-dependent @code{UNSPEC}s to appear within constants.
+
+If @code{OUTPUT_ADDR_CONST_EXTRA} fails to recognize a pattern, it must
+@code{goto fail}, so that a standard error message is printed. If it
+prints an error message itself, by calling, for example,
+@code{output_operand_lossage}, it may just complete normally.
+@end defmac
+
+@defmac ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
+A C statement to output to the stdio stream @var{stream} an assembler
+instruction to assemble a string constant containing the @var{len}
+bytes at @var{ptr}. @var{ptr} will be a C expression of type
+@code{char *} and @var{len} a C expression of type @code{int}.
+
+If the assembler has a @code{.ascii} pseudo-op as found in the
+Berkeley Unix assembler, do not define the macro
+@code{ASM_OUTPUT_ASCII}.
+@end defmac
+
+@defmac ASM_OUTPUT_FDESC (@var{stream}, @var{decl}, @var{n})
+A C statement to output word @var{n} of a function descriptor for
+@var{decl}. This must be defined if @code{TARGET_VTABLE_USES_DESCRIPTORS}
+is defined, and is otherwise unused.
+@end defmac
+
+@defmac CONSTANT_POOL_BEFORE_FUNCTION
+You may define this macro as a C expression. You should define the
+expression to have a nonzero value if GCC should output the constant
+pool for a function before the code for the function, or a zero value if
+GCC should output the constant pool after the function. If you do
+not define this macro, the usual case, GCC will output the constant
+pool before the function.
+@end defmac
+
+@defmac ASM_OUTPUT_POOL_PROLOGUE (@var{file}, @var{funname}, @var{fundecl}, @var{size})
+A C statement to output assembler commands to define the start of the
+constant pool for a function. @var{funname} is a string giving
+the name of the function. Should the return type of the function
+be required, it can be obtained via @var{fundecl}. @var{size}
+is the size, in bytes, of the constant pool that will be written
+immediately after this call.
+
+If no constant-pool prefix is required, the usual case, this macro need
+not be defined.
+@end defmac
+
+@defmac ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto})
+A C statement (with or without semicolon) to output a constant in the
+constant pool, if it needs special treatment. (This macro need not do
+anything for RTL expressions that can be output normally.)
+
+The argument @var{file} is the standard I/O stream to output the
+assembler code on. @var{x} is the RTL expression for the constant to
+output, and @var{mode} is the machine mode (in case @var{x} is a
+@samp{const_int}). @var{align} is the required alignment for the value
+@var{x}; you should output an assembler directive to force this much
+alignment.
+
+The argument @var{labelno} is a number to use in an internal label for
+the address of this pool entry. The definition of this macro is
+responsible for outputting the label definition at the proper place.
+Here is how to do this:
+
+@smallexample
+@code{(*targetm.asm_out.internal_label)} (@var{file}, "LC", @var{labelno});
+@end smallexample
+
+When you output a pool entry specially, you should end with a
+@code{goto} to the label @var{jumpto}. This will prevent the same pool
+entry from being output a second time in the usual manner.
+
+You need not define this macro if it would do nothing.
+@end defmac
+
+@defmac ASM_OUTPUT_POOL_EPILOGUE (@var{file} @var{funname} @var{fundecl} @var{size})
+A C statement to output assembler commands to at the end of the constant
+pool for a function. @var{funname} is a string giving the name of the
+function. Should the return type of the function be required, you can
+obtain it via @var{fundecl}. @var{size} is the size, in bytes, of the
+constant pool that GCC wrote immediately before this call.
+
+If no constant-pool epilogue is required, the usual case, you need not
+define this macro.
+@end defmac
+
+@defmac IS_ASM_LOGICAL_LINE_SEPARATOR (@var{C}, @var{STR})
+Define this macro as a C expression which is nonzero if @var{C} is
+used as a logical line separator by the assembler. @var{STR} points
+to the position in the string where @var{C} was found; this can be used if
+a line separator uses multiple characters.
+
+If you do not define this macro, the default is that only
+the character @samp{;} is treated as a logical line separator.
+@end defmac
+
+@hook TARGET_ASM_OPEN_PAREN
+These target hooks are C string constants, describing the syntax in the
+assembler for grouping arithmetic expressions. If not overridden, they
+default to normal parentheses, which is correct for most assemblers.
+@end deftypevr
+
+These macros are provided by @file{real.h} for writing the definitions
+of @code{ASM_OUTPUT_DOUBLE} and the like:
+
+@defmac REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
+@defmacx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l})
+@defmacx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l})
+@defmacx REAL_VALUE_TO_TARGET_DECIMAL32 (@var{x}, @var{l})
+@defmacx REAL_VALUE_TO_TARGET_DECIMAL64 (@var{x}, @var{l})
+@defmacx REAL_VALUE_TO_TARGET_DECIMAL128 (@var{x}, @var{l})
+These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the
+target's floating point representation, and store its bit pattern in
+the variable @var{l}. For @code{REAL_VALUE_TO_TARGET_SINGLE} and
+@code{REAL_VALUE_TO_TARGET_DECIMAL32}, this variable should be a
+simple @code{long int}. For the others, it should be an array of
+@code{long int}. The number of elements in this array is determined
+by the size of the desired target floating point data type: 32 bits of
+it go in each @code{long int} array element. Each array element holds
+32 bits of the result, even if @code{long int} is wider than 32 bits
+on the host machine.
+
+The array element values are designed so that you can print them out
+using @code{fprintf} in the order they should appear in the target
+machine's memory.
+@end defmac
+
+@node Uninitialized Data
+@subsection Output of Uninitialized Variables
+
+Each of the macros in this section is used to do the whole job of
+outputting a single uninitialized variable.
+
+@defmac ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} the assembler definition of a common-label named
+@var{name} whose size is @var{size} bytes. The variable @var{rounded}
+is the size rounded up to whatever alignment the caller wants. It is
+possible that @var{size} may be zero, for instance if a struct with no
+other member than a zero-length array is defined. In this case, the
+backend must output a symbol definition that allocates at least one
+byte, both so that the address of the resulting object does not compare
+equal to any other, and because some object formats cannot even express
+the concept of a zero-sized common symbol, as that is how they represent
+an ordinary undefined external.
+
+Use the expression @code{assemble_name (@var{stream}, @var{name})} to
+output the name itself; before and after that, output the additional
+assembler syntax for defining the name, and a newline.
+
+This macro controls how the assembler definitions of uninitialized
+common global variables are output.
+@end defmac
+
+@defmac ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment})
+Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a
+separate, explicit argument. If you define this macro, it is used in
+place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in
+handling the required alignment of the variable. The alignment is specified
+as the number of bits.
+@end defmac
+
+@defmac ASM_OUTPUT_ALIGNED_DECL_COMMON (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
+Like @code{ASM_OUTPUT_ALIGNED_COMMON} except that @var{decl} of the
+variable to be output, if there is one, or @code{NULL_TREE} if there
+is no corresponding variable. If you define this macro, GCC will use it
+in place of both @code{ASM_OUTPUT_COMMON} and
+@code{ASM_OUTPUT_ALIGNED_COMMON}. Define this macro when you need to see
+the variable's decl in order to chose what to output.
+@end defmac
+
+@defmac ASM_OUTPUT_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{rounded})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} the assembler definition of uninitialized global @var{decl} named
+@var{name} whose size is @var{size} bytes. The variable @var{rounded}
+is the size rounded up to whatever alignment the caller wants.
+
+Try to use function @code{asm_output_bss} defined in @file{varasm.c} when
+defining this macro. If unable, use the expression
+@code{assemble_name (@var{stream}, @var{name})} to output the name itself;
+before and after that, output the additional assembler syntax for defining
+the name, and a newline.
+
+There are two ways of handling global BSS@. One is to define either
+this macro or its aligned counterpart, @code{ASM_OUTPUT_ALIGNED_BSS}.
+The other is to have @code{TARGET_ASM_SELECT_SECTION} return a
+switchable BSS section (@pxref{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}).
+You do not need to do both.
+
+Some languages do not have @code{common} data, and require a
+non-common form of global BSS in order to handle uninitialized globals
+efficiently. C++ is one example of this. However, if the target does
+not support global BSS, the front end may choose to make globals
+common in order to save space in the object file.
+@end defmac
+
+@defmac ASM_OUTPUT_ALIGNED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
+Like @code{ASM_OUTPUT_BSS} except takes the required alignment as a
+separate, explicit argument. If you define this macro, it is used in
+place of @code{ASM_OUTPUT_BSS}, and gives you more flexibility in
+handling the required alignment of the variable. The alignment is specified
+as the number of bits.
+
+Try to use function @code{asm_output_aligned_bss} defined in file
+@file{varasm.c} when defining this macro.
+@end defmac
+
+@defmac ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} the assembler definition of a local-common-label named
+@var{name} whose size is @var{size} bytes. The variable @var{rounded}
+is the size rounded up to whatever alignment the caller wants.
+
+Use the expression @code{assemble_name (@var{stream}, @var{name})} to
+output the name itself; before and after that, output the additional
+assembler syntax for defining the name, and a newline.
+
+This macro controls how the assembler definitions of uninitialized
+static variables are output.
+@end defmac
+
+@defmac ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment})
+Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a
+separate, explicit argument. If you define this macro, it is used in
+place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in
+handling the required alignment of the variable. The alignment is specified
+as the number of bits.
+@end defmac
+
+@defmac ASM_OUTPUT_ALIGNED_DECL_LOCAL (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
+Like @code{ASM_OUTPUT_ALIGNED_DECL} except that @var{decl} of the
+variable to be output, if there is one, or @code{NULL_TREE} if there
+is no corresponding variable. If you define this macro, GCC will use it
+in place of both @code{ASM_OUTPUT_DECL} and
+@code{ASM_OUTPUT_ALIGNED_DECL}. Define this macro when you need to see
+the variable's decl in order to chose what to output.
+@end defmac
+
+@node Label Output
+@subsection Output and Generation of Labels
+
+@c prevent bad page break with this line
+This is about outputting labels.
+
+@findex assemble_name
+@defmac ASM_OUTPUT_LABEL (@var{stream}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} the assembler definition of a label named @var{name}.
+Use the expression @code{assemble_name (@var{stream}, @var{name})} to
+output the name itself; before and after that, output the additional
+assembler syntax for defining the name, and a newline. A default
+definition of this macro is provided which is correct for most systems.
+@end defmac
+
+@findex assemble_name_raw
+@defmac ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{name})
+Identical to @code{ASM_OUTPUT_LABEL}, except that @var{name} is known
+to refer to a compiler-generated label. The default definition uses
+@code{assemble_name_raw}, which is like @code{assemble_name} except
+that it is more efficient.
+@end defmac
+
+@defmac SIZE_ASM_OP
+A C string containing the appropriate assembler directive to specify the
+size of a symbol, without any arguments. On systems that use ELF, the
+default (in @file{config/elfos.h}) is @samp{"\t.size\t"}; on other
+systems, the default is not to define this macro.
+
+Define this macro only if it is correct to use the default definitions
+of @code{ASM_OUTPUT_SIZE_DIRECTIVE} and @code{ASM_OUTPUT_MEASURED_SIZE}
+for your system. If you need your own custom definitions of those
+macros, or if you do not need explicit symbol sizes at all, do not
+define this macro.
+@end defmac
+
+@defmac ASM_OUTPUT_SIZE_DIRECTIVE (@var{stream}, @var{name}, @var{size})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} a directive telling the assembler that the size of the
+symbol @var{name} is @var{size}. @var{size} is a @code{HOST_WIDE_INT}.
+If you define @code{SIZE_ASM_OP}, a default definition of this macro is
+provided.
+@end defmac
+
+@defmac ASM_OUTPUT_MEASURED_SIZE (@var{stream}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} a directive telling the assembler to calculate the size of
+the symbol @var{name} by subtracting its address from the current
+address.
+
+If you define @code{SIZE_ASM_OP}, a default definition of this macro is
+provided. The default assumes that the assembler recognizes a special
+@samp{.} symbol as referring to the current address, and can calculate
+the difference between this and another symbol. If your assembler does
+not recognize @samp{.} or cannot do calculations with it, you will need
+to redefine @code{ASM_OUTPUT_MEASURED_SIZE} to use some other technique.
+@end defmac
+
+@defmac TYPE_ASM_OP
+A C string containing the appropriate assembler directive to specify the
+type of a symbol, without any arguments. On systems that use ELF, the
+default (in @file{config/elfos.h}) is @samp{"\t.type\t"}; on other
+systems, the default is not to define this macro.
+
+Define this macro only if it is correct to use the default definition of
+@code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own
+custom definition of this macro, or if you do not need explicit symbol
+types at all, do not define this macro.
+@end defmac
+
+@defmac TYPE_OPERAND_FMT
+A C string which specifies (using @code{printf} syntax) the format of
+the second operand to @code{TYPE_ASM_OP}. On systems that use ELF, the
+default (in @file{config/elfos.h}) is @samp{"@@%s"}; on other systems,
+the default is not to define this macro.
+
+Define this macro only if it is correct to use the default definition of
+@code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own
+custom definition of this macro, or if you do not need explicit symbol
+types at all, do not define this macro.
+@end defmac
+
+@defmac ASM_OUTPUT_TYPE_DIRECTIVE (@var{stream}, @var{type})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} a directive telling the assembler that the type of the
+symbol @var{name} is @var{type}. @var{type} is a C string; currently,
+that string is always either @samp{"function"} or @samp{"object"}, but
+you should not count on this.
+
+If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a default
+definition of this macro is provided.
+@end defmac
+
+@defmac ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} any text necessary for declaring the name @var{name} of a
+function which is being defined. This macro is responsible for
+outputting the label definition (perhaps using
+@code{ASM_OUTPUT_LABEL}). The argument @var{decl} is the
+@code{FUNCTION_DECL} tree node representing the function.
+
+If this macro is not defined, then the function name is defined in the
+usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
+
+You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition
+of this macro.
+@end defmac
+
+@defmac ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} any text necessary for declaring the size of a function
+which is being defined. The argument @var{name} is the name of the
+function. The argument @var{decl} is the @code{FUNCTION_DECL} tree node
+representing the function.
+
+If this macro is not defined, then the function size is not defined.
+
+You may wish to use @code{ASM_OUTPUT_MEASURED_SIZE} in the definition
+of this macro.
+@end defmac
+
+@defmac ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} any text necessary for declaring the name @var{name} of an
+initialized variable which is being defined. This macro must output the
+label definition (perhaps using @code{ASM_OUTPUT_LABEL}). The argument
+@var{decl} is the @code{VAR_DECL} tree node representing the variable.
+
+If this macro is not defined, then the variable name is defined in the
+usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
+
+You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or
+@code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro.
+@end defmac
+
+@hook TARGET_ASM_DECLARE_CONSTANT_NAME
+A target hook to output to the stdio stream @var{file} any text necessary
+for declaring the name @var{name} of a constant which is being defined. This
+target hook is responsible for outputting the label definition (perhaps using
+@code{assemble_label}). The argument @var{exp} is the value of the constant,
+and @var{size} is the size of the constant in bytes. The @var{name}
+will be an internal label.
+
+The default version of this target hook, define the @var{name} in the
+usual manner as a label (by means of @code{assemble_label}).
+
+You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in this target hook.
+@end deftypefn
+
+@defmac ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} any text necessary for claiming a register @var{regno}
+for a global variable @var{decl} with name @var{name}.
+
+If you don't define this macro, that is equivalent to defining it to do
+nothing.
+@end defmac
+
+@defmac ASM_FINISH_DECLARE_OBJECT (@var{stream}, @var{decl}, @var{toplevel}, @var{atend})
+A C statement (sans semicolon) to finish up declaring a variable name
+once the compiler has processed its initializer fully and thus has had a
+chance to determine the size of an array when controlled by an
+initializer. This is used on systems where it's necessary to declare
+something about the size of the object.
+
+If you don't define this macro, that is equivalent to defining it to do
+nothing.
+
+You may wish to use @code{ASM_OUTPUT_SIZE_DIRECTIVE} and/or
+@code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro.
+@end defmac
+
+@hook TARGET_ASM_GLOBALIZE_LABEL
+This target hook is a function to output to the stdio stream
+@var{stream} some commands that will make the label @var{name} global;
+that is, available for reference from other files.
+
+The default implementation relies on a proper definition of
+@code{GLOBAL_ASM_OP}.
+@end deftypefn
+
+@hook TARGET_ASM_GLOBALIZE_DECL_NAME
+This target hook is a function to output to the stdio stream
+@var{stream} some commands that will make the name associated with @var{decl}
+global; that is, available for reference from other files.
+
+The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL target hook.
+@end deftypefn
+
+@defmac ASM_WEAKEN_LABEL (@var{stream}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} some commands that will make the label @var{name} weak;
+that is, available for reference from other files but only used if
+no other definition is available. Use the expression
+@code{assemble_name (@var{stream}, @var{name})} to output the name
+itself; before and after that, output the additional assembler syntax
+for making that name weak, and a newline.
+
+If you don't define this macro or @code{ASM_WEAKEN_DECL}, GCC will not
+support weak symbols and you should not define the @code{SUPPORTS_WEAK}
+macro.
+@end defmac
+
+@defmac ASM_WEAKEN_DECL (@var{stream}, @var{decl}, @var{name}, @var{value})
+Combines (and replaces) the function of @code{ASM_WEAKEN_LABEL} and
+@code{ASM_OUTPUT_WEAK_ALIAS}, allowing access to the associated function
+or variable decl. If @var{value} is not @code{NULL}, this C statement
+should output to the stdio stream @var{stream} assembler code which
+defines (equates) the weak symbol @var{name} to have the value
+@var{value}. If @var{value} is @code{NULL}, it should output commands
+to make @var{name} weak.
+@end defmac
+
+@defmac ASM_OUTPUT_WEAKREF (@var{stream}, @var{decl}, @var{name}, @var{value})
+Outputs a directive that enables @var{name} to be used to refer to
+symbol @var{value} with weak-symbol semantics. @code{decl} is the
+declaration of @code{name}.
+@end defmac
+
+@defmac SUPPORTS_WEAK
+A C expression which evaluates to true if the target supports weak symbols.
+
+If you don't define this macro, @file{defaults.h} provides a default
+definition. If either @code{ASM_WEAKEN_LABEL} or @code{ASM_WEAKEN_DECL}
+is defined, the default definition is @samp{1}; otherwise, it is
+@samp{0}. Define this macro if you want to control weak symbol support
+with a compiler flag such as @option{-melf}.
+@end defmac
+
+@defmac MAKE_DECL_ONE_ONLY (@var{decl})
+A C statement (sans semicolon) to mark @var{decl} to be emitted as a
+public symbol such that extra copies in multiple translation units will
+be discarded by the linker. Define this macro if your object file
+format provides support for this concept, such as the @samp{COMDAT}
+section flags in the Microsoft Windows PE/COFF format, and this support
+requires changes to @var{decl}, such as putting it in a separate section.
+@end defmac
+
+@defmac SUPPORTS_ONE_ONLY
+A C expression which evaluates to true if the target supports one-only
+semantics.
+
+If you don't define this macro, @file{varasm.c} provides a default
+definition. If @code{MAKE_DECL_ONE_ONLY} is defined, the default
+definition is @samp{1}; otherwise, it is @samp{0}. Define this macro if
+you want to control one-only symbol support with a compiler flag, or if
+setting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration to
+be emitted as one-only.
+@end defmac
+
+@hook TARGET_ASM_ASSEMBLE_VISIBILITY
+This target hook is a function to output to @var{asm_out_file} some
+commands that will make the symbol(s) associated with @var{decl} have
+hidden, protected or internal visibility as specified by @var{visibility}.
+@end deftypefn
+
+@defmac TARGET_WEAK_NOT_IN_ARCHIVE_TOC
+A C expression that evaluates to true if the target's linker expects
+that weak symbols do not appear in a static archive's table of contents.
+The default is @code{0}.
+
+Leaving weak symbols out of an archive's table of contents means that,
+if a symbol will only have a definition in one translation unit and
+will have undefined references from other translation units, that
+symbol should not be weak. Defining this macro to be nonzero will
+thus have the effect that certain symbols that would normally be weak
+(explicit template instantiations, and vtables for polymorphic classes
+with noninline key methods) will instead be nonweak.
+
+The C++ ABI requires this macro to be zero. Define this macro for
+targets where full C++ ABI compliance is impossible and where linker
+restrictions require weak symbols to be left out of a static archive's
+table of contents.
+@end defmac
+
+@defmac ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} any text necessary for declaring the name of an external
+symbol named @var{name} which is referenced in this compilation but
+not defined. The value of @var{decl} is the tree node for the
+declaration.
+
+This macro need not be defined if it does not need to output anything.
+The GNU assembler and most Unix assemblers don't require anything.
+@end defmac
+
+@hook TARGET_ASM_EXTERNAL_LIBCALL
+This target hook is a function to output to @var{asm_out_file} an assembler
+pseudo-op to declare a library function name external. The name of the
+library function is given by @var{symref}, which is a @code{symbol_ref}.
+@end deftypefn
+
+@hook TARGET_ASM_MARK_DECL_PRESERVED
+This target hook is a function to output to @var{asm_out_file} an assembler
+directive to annotate @var{symbol} as used. The Darwin target uses the
+.no_dead_code_strip directive.
+@end deftypefn
+
+@defmac ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} a reference in assembler syntax to a label named
+@var{name}. This should add @samp{_} to the front of the name, if that
+is customary on your operating system, as it is in most Berkeley Unix
+systems. This macro is used in @code{assemble_name}.
+@end defmac
+
+@defmac ASM_OUTPUT_SYMBOL_REF (@var{stream}, @var{sym})
+A C statement (sans semicolon) to output a reference to
+@code{SYMBOL_REF} @var{sym}. If not defined, @code{assemble_name}
+will be used to output the name of the symbol. This macro may be used
+to modify the way a symbol is referenced depending on information
+encoded by @code{TARGET_ENCODE_SECTION_INFO}.
+@end defmac
+
+@defmac ASM_OUTPUT_LABEL_REF (@var{stream}, @var{buf})
+A C statement (sans semicolon) to output a reference to @var{buf}, the
+result of @code{ASM_GENERATE_INTERNAL_LABEL}. If not defined,
+@code{assemble_name} will be used to output the name of the symbol.
+This macro is not used by @code{output_asm_label}, or the @code{%l}
+specifier that calls it; the intention is that this macro should be set
+when it is necessary to output a label differently when its address is
+being taken.
+@end defmac
+
+@hook TARGET_ASM_INTERNAL_LABEL
+A function to output to the stdio stream @var{stream} a label whose
+name is made from the string @var{prefix} and the number @var{labelno}.
+
+It is absolutely essential that these labels be distinct from the labels
+used for user-level functions and variables. Otherwise, certain programs
+will have name conflicts with internal labels.
+
+It is desirable to exclude internal labels from the symbol table of the
+object file. Most assemblers have a naming convention for labels that
+should be excluded; on many systems, the letter @samp{L} at the
+beginning of a label has this effect. You should find out what
+convention your system uses, and follow it.
+
+The default version of this function utilizes @code{ASM_GENERATE_INTERNAL_LABEL}.
+@end deftypefn
+
+@defmac ASM_OUTPUT_DEBUG_LABEL (@var{stream}, @var{prefix}, @var{num})
+A C statement to output to the stdio stream @var{stream} a debug info
+label whose name is made from the string @var{prefix} and the number
+@var{num}. This is useful for VLIW targets, where debug info labels
+may need to be treated differently than branch target labels. On some
+systems, branch target labels must be at the beginning of instruction
+bundles, but debug info labels can occur in the middle of instruction
+bundles.
+
+If this macro is not defined, then @code{(*targetm.asm_out.internal_label)} will be
+used.
+@end defmac
+
+@defmac ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
+A C statement to store into the string @var{string} a label whose name
+is made from the string @var{prefix} and the number @var{num}.
+
+This string, when output subsequently by @code{assemble_name}, should
+produce the output that @code{(*targetm.asm_out.internal_label)} would produce
+with the same @var{prefix} and @var{num}.
+
+If the string begins with @samp{*}, then @code{assemble_name} will
+output the rest of the string unchanged. It is often convenient for
+@code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way. If the
+string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets
+to output the string, and may change it. (Of course,
+@code{ASM_OUTPUT_LABELREF} is also part of your machine description, so
+you should know what it does on your machine.)
+@end defmac
+
+@defmac ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
+A C expression to assign to @var{outvar} (which is a variable of type
+@code{char *}) a newly allocated string made from the string
+@var{name} and the number @var{number}, with some suitable punctuation
+added. Use @code{alloca} to get space for the string.
+
+The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to
+produce an assembler label for an internal static variable whose name is
+@var{name}. Therefore, the string must be such as to result in valid
+assembler code. The argument @var{number} is different each time this
+macro is executed; it prevents conflicts between similarly-named
+internal static variables in different scopes.
+
+Ideally this string should not be a valid C identifier, to prevent any
+conflict with the user's own symbols. Most assemblers allow periods
+or percent signs in assembler symbols; putting at least one of these
+between the name and the number will suffice.
+
+If this macro is not defined, a default definition will be provided
+which is correct for most systems.
+@end defmac
+
+@defmac ASM_OUTPUT_DEF (@var{stream}, @var{name}, @var{value})
+A C statement to output to the stdio stream @var{stream} assembler code
+which defines (equates) the symbol @var{name} to have the value @var{value}.
+
+@findex SET_ASM_OP
+If @code{SET_ASM_OP} is defined, a default definition is provided which is
+correct for most systems.
+@end defmac
+
+@defmac ASM_OUTPUT_DEF_FROM_DECLS (@var{stream}, @var{decl_of_name}, @var{decl_of_value})
+A C statement to output to the stdio stream @var{stream} assembler code
+which defines (equates) the symbol whose tree node is @var{decl_of_name}
+to have the value of the tree node @var{decl_of_value}. This macro will
+be used in preference to @samp{ASM_OUTPUT_DEF} if it is defined and if
+the tree nodes are available.
+
+@findex SET_ASM_OP
+If @code{SET_ASM_OP} is defined, a default definition is provided which is
+correct for most systems.
+@end defmac
+
+@defmac TARGET_DEFERRED_OUTPUT_DEFS (@var{decl_of_name}, @var{decl_of_value})
+A C statement that evaluates to true if the assembler code which defines
+(equates) the symbol whose tree node is @var{decl_of_name} to have the value
+of the tree node @var{decl_of_value} should be emitted near the end of the
+current compilation unit. The default is to not defer output of defines.
+This macro affects defines output by @samp{ASM_OUTPUT_DEF} and
+@samp{ASM_OUTPUT_DEF_FROM_DECLS}.
+@end defmac
+
+@defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
+A C statement to output to the stdio stream @var{stream} assembler code
+which defines (equates) the weak symbol @var{name} to have the value
+@var{value}. If @var{value} is @code{NULL}, it defines @var{name} as
+an undefined weak symbol.
+
+Define this macro if the target only supports weak aliases; define
+@code{ASM_OUTPUT_DEF} instead if possible.
+@end defmac
+
+@defmac OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name})
+Define this macro to override the default assembler names used for
+Objective-C methods.
+
+The default name is a unique method number followed by the name of the
+class (e.g.@: @samp{_1_Foo}). For methods in categories, the name of
+the category is also included in the assembler name (e.g.@:
+@samp{_1_Foo_Bar}).
+
+These names are safe on most systems, but make debugging difficult since
+the method's selector is not present in the name. Therefore, particular
+systems define other ways of computing names.
+
+@var{buf} is an expression of type @code{char *} which gives you a
+buffer in which to store the name; its length is as long as
+@var{class_name}, @var{cat_name} and @var{sel_name} put together, plus
+50 characters extra.
+
+The argument @var{is_inst} specifies whether the method is an instance
+method or a class method; @var{class_name} is the name of the class;
+@var{cat_name} is the name of the category (or @code{NULL} if the method is not
+in a category); and @var{sel_name} is the name of the selector.
+
+On systems where the assembler can handle quoted names, you can use this
+macro to provide more human-readable names.
+@end defmac
+
+@defmac ASM_DECLARE_CLASS_REFERENCE (@var{stream}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} commands to declare that the label @var{name} is an
+Objective-C class reference. This is only needed for targets whose
+linkers have special support for NeXT-style runtimes.
+@end defmac
+
+@defmac ASM_DECLARE_UNRESOLVED_REFERENCE (@var{stream}, @var{name})
+A C statement (sans semicolon) to output to the stdio stream
+@var{stream} commands to declare that the label @var{name} is an
+unresolved Objective-C class reference. This is only needed for targets
+whose linkers have special support for NeXT-style runtimes.
+@end defmac
+
+@node Initialization
+@subsection How Initialization Functions Are Handled
+@cindex initialization routines
+@cindex termination routines
+@cindex constructors, output of
+@cindex destructors, output of
+
+The compiled code for certain languages includes @dfn{constructors}
+(also called @dfn{initialization routines})---functions to initialize
+data in the program when the program is started. These functions need
+to be called before the program is ``started''---that is to say, before
+@code{main} is called.
+
+Compiling some languages generates @dfn{destructors} (also called
+@dfn{termination routines}) that should be called when the program
+terminates.
+
+To make the initialization and termination functions work, the compiler
+must output something in the assembler code to cause those functions to
+be called at the appropriate time. When you port the compiler to a new
+system, you need to specify how to do this.
+
+There are two major ways that GCC currently supports the execution of
+initialization and termination functions. Each way has two variants.
+Much of the structure is common to all four variations.
+
+@findex __CTOR_LIST__
+@findex __DTOR_LIST__
+The linker must build two lists of these functions---a list of
+initialization functions, called @code{__CTOR_LIST__}, and a list of
+termination functions, called @code{__DTOR_LIST__}.
+
+Each list always begins with an ignored function pointer (which may hold
+0, @minus{}1, or a count of the function pointers after it, depending on
+the environment). This is followed by a series of zero or more function
+pointers to constructors (or destructors), followed by a function
+pointer containing zero.
+
+Depending on the operating system and its executable file format, either
+@file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup
+time and exit time. Constructors are called in reverse order of the
+list; destructors in forward order.
+
+The best way to handle static constructors works only for object file
+formats which provide arbitrarily-named sections. A section is set
+aside for a list of constructors, and another for a list of destructors.
+Traditionally these are called @samp{.ctors} and @samp{.dtors}. Each
+object file that defines an initialization function also puts a word in
+the constructor section to point to that function. The linker
+accumulates all these words into one contiguous @samp{.ctors} section.
+Termination functions are handled similarly.
+
+This method will be chosen as the default by @file{target-def.h} if
+@code{TARGET_ASM_NAMED_SECTION} is defined. A target that does not
+support arbitrary sections, but does support special designated
+constructor and destructor sections may define @code{CTORS_SECTION_ASM_OP}
+and @code{DTORS_SECTION_ASM_OP} to achieve the same effect.
+
+When arbitrary sections are available, there are two variants, depending
+upon how the code in @file{crtstuff.c} is called. On systems that
+support a @dfn{.init} section which is executed at program startup,
+parts of @file{crtstuff.c} are compiled into that section. The
+program is linked by the @command{gcc} driver like this:
+
+@smallexample
+ld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o
+@end smallexample
+
+The prologue of a function (@code{__init}) appears in the @code{.init}
+section of @file{crti.o}; the epilogue appears in @file{crtn.o}. Likewise
+for the function @code{__fini} in the @dfn{.fini} section. Normally these
+files are provided by the operating system or by the GNU C library, but
+are provided by GCC for a few targets.
+
+The objects @file{crtbegin.o} and @file{crtend.o} are (for most targets)
+compiled from @file{crtstuff.c}. They contain, among other things, code
+fragments within the @code{.init} and @code{.fini} sections that branch
+to routines in the @code{.text} section. The linker will pull all parts
+of a section together, which results in a complete @code{__init} function
+that invokes the routines we need at startup.
+
+To use this variant, you must define the @code{INIT_SECTION_ASM_OP}
+macro properly.
+
+If no init section is available, when GCC compiles any function called
+@code{main} (or more accurately, any function designated as a program
+entry point by the language front end calling @code{expand_main_function}),
+it inserts a procedure call to @code{__main} as the first executable code
+after the function prologue. The @code{__main} function is defined
+in @file{libgcc2.c} and runs the global constructors.
+
+In file formats that don't support arbitrary sections, there are again
+two variants. In the simplest variant, the GNU linker (GNU @code{ld})
+and an `a.out' format must be used. In this case,
+@code{TARGET_ASM_CONSTRUCTOR} is defined to produce a @code{.stabs}
+entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__},
+and with the address of the void function containing the initialization
+code as its value. The GNU linker recognizes this as a request to add
+the value to a @dfn{set}; the values are accumulated, and are eventually
+placed in the executable as a vector in the format described above, with
+a leading (ignored) count and a trailing zero element.
+@code{TARGET_ASM_DESTRUCTOR} is handled similarly. Since no init
+section is available, the absence of @code{INIT_SECTION_ASM_OP} causes
+the compilation of @code{main} to call @code{__main} as above, starting
+the initialization process.
+
+The last variant uses neither arbitrary sections nor the GNU linker.
+This is preferable when you want to do dynamic linking and when using
+file formats which the GNU linker does not support, such as `ECOFF'@. In
+this case, @code{TARGET_HAVE_CTORS_DTORS} is false, initialization and
+termination functions are recognized simply by their names. This requires
+an extra program in the linkage step, called @command{collect2}. This program
+pretends to be the linker, for use with GCC; it does its job by running
+the ordinary linker, but also arranges to include the vectors of
+initialization and termination functions. These functions are called
+via @code{__main} as described above. In order to use this method,
+@code{use_collect2} must be defined in the target in @file{config.gcc}.
+
+@ifinfo
+The following section describes the specific macros that control and
+customize the handling of initialization and termination functions.
+@end ifinfo
+
+@node Macros for Initialization
+@subsection Macros Controlling Initialization Routines
+
+Here are the macros that control how the compiler handles initialization
+and termination functions:
+
+@defmac INIT_SECTION_ASM_OP
+If defined, a C string constant, including spacing, for the assembler
+operation to identify the following data as initialization code. If not
+defined, GCC will assume such a section does not exist. When you are
+using special sections for initialization and termination functions, this
+macro also controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to
+run the initialization functions.
+@end defmac
+
+@defmac HAS_INIT_SECTION
+If defined, @code{main} will not call @code{__main} as described above.
+This macro should be defined for systems that control start-up code
+on a symbol-by-symbol basis, such as OSF/1, and should not
+be defined explicitly for systems that support @code{INIT_SECTION_ASM_OP}.
+@end defmac
+
+@defmac LD_INIT_SWITCH
+If defined, a C string constant for a switch that tells the linker that
+the following symbol is an initialization routine.
+@end defmac
+
+@defmac LD_FINI_SWITCH
+If defined, a C string constant for a switch that tells the linker that
+the following symbol is a finalization routine.
+@end defmac
+
+@defmac COLLECT_SHARED_INIT_FUNC (@var{stream}, @var{func})
+If defined, a C statement that will write a function that can be
+automatically called when a shared library is loaded. The function
+should call @var{func}, which takes no arguments. If not defined, and
+the object format requires an explicit initialization function, then a
+function called @code{_GLOBAL__DI} will be generated.
+
+This function and the following one are used by collect2 when linking a
+shared library that needs constructors or destructors, or has DWARF2
+exception tables embedded in the code.
+@end defmac
+
+@defmac COLLECT_SHARED_FINI_FUNC (@var{stream}, @var{func})
+If defined, a C statement that will write a function that can be
+automatically called when a shared library is unloaded. The function
+should call @var{func}, which takes no arguments. If not defined, and
+the object format requires an explicit finalization function, then a
+function called @code{_GLOBAL__DD} will be generated.
+@end defmac
+
+@defmac INVOKE__main
+If defined, @code{main} will call @code{__main} despite the presence of
+@code{INIT_SECTION_ASM_OP}. This macro should be defined for systems
+where the init section is not actually run automatically, but is still
+useful for collecting the lists of constructors and destructors.
+@end defmac
+
+@defmac SUPPORTS_INIT_PRIORITY
+If nonzero, the C++ @code{init_priority} attribute is supported and the
+compiler should emit instructions to control the order of initialization
+of objects. If zero, the compiler will issue an error message upon
+encountering an @code{init_priority} attribute.
+@end defmac
+
+@hook TARGET_HAVE_CTORS_DTORS
+This value is true if the target supports some ``native'' method of
+collecting constructors and destructors to be run at startup and exit.
+It is false if we must use @command{collect2}.
+@end deftypevr
+
+@hook TARGET_ASM_CONSTRUCTOR
+If defined, a function that outputs assembler code to arrange to call
+the function referenced by @var{symbol} at initialization time.
+
+Assume that @var{symbol} is a @code{SYMBOL_REF} for a function taking
+no arguments and with no return value. If the target supports initialization
+priorities, @var{priority} is a value between 0 and @code{MAX_INIT_PRIORITY};
+otherwise it must be @code{DEFAULT_INIT_PRIORITY}.
+
+If this macro is not defined by the target, a suitable default will
+be chosen if (1) the target supports arbitrary section names, (2) the
+target defines @code{CTORS_SECTION_ASM_OP}, or (3) @code{USE_COLLECT2}
+is not defined.
+@end deftypefn
+
+@hook TARGET_ASM_DESTRUCTOR
+This is like @code{TARGET_ASM_CONSTRUCTOR} but used for termination
+functions rather than initialization functions.
+@end deftypefn
+
+If @code{TARGET_HAVE_CTORS_DTORS} is true, the initialization routine
+generated for the generated object file will have static linkage.
+
+If your system uses @command{collect2} as the means of processing
+constructors, then that program normally uses @command{nm} to scan
+an object file for constructor functions to be called.
+
+On certain kinds of systems, you can define this macro to make
+@command{collect2} work faster (and, in some cases, make it work at all):
+
+@defmac OBJECT_FORMAT_COFF
+Define this macro if the system uses COFF (Common Object File Format)
+object files, so that @command{collect2} can assume this format and scan
+object files directly for dynamic constructor/destructor functions.
+
+This macro is effective only in a native compiler; @command{collect2} as
+part of a cross compiler always uses @command{nm} for the target machine.
+@end defmac
+
+@defmac REAL_NM_FILE_NAME
+Define this macro as a C string constant containing the file name to use
+to execute @command{nm}. The default is to search the path normally for
+@command{nm}.
+
+If your system supports shared libraries and has a program to list the
+dynamic dependencies of a given library or executable, you can define
+these macros to enable support for running initialization and
+termination functions in shared libraries:
+@end defmac
+
+@defmac LDD_SUFFIX
+Define this macro to a C string constant containing the name of the program
+which lists dynamic dependencies, like @command{"ldd"} under SunOS 4.
+@end defmac
+
+@defmac PARSE_LDD_OUTPUT (@var{ptr})
+Define this macro to be C code that extracts filenames from the output
+of the program denoted by @code{LDD_SUFFIX}. @var{ptr} is a variable
+of type @code{char *} that points to the beginning of a line of output
+from @code{LDD_SUFFIX}. If the line lists a dynamic dependency, the
+code must advance @var{ptr} to the beginning of the filename on that
+line. Otherwise, it must set @var{ptr} to @code{NULL}.
+@end defmac
+
+@defmac SHLIB_SUFFIX
+Define this macro to a C string constant containing the default shared
+library extension of the target (e.g., @samp{".so"}). @command{collect2}
+strips version information after this suffix when generating global
+constructor and destructor names. This define is only needed on targets
+that use @command{collect2} to process constructors and destructors.
+@end defmac
+
+@node Instruction Output
+@subsection Output of Assembler Instructions
+
+@c prevent bad page break with this line
+This describes assembler instruction output.
+
+@defmac REGISTER_NAMES
+A C initializer containing the assembler's names for the machine
+registers, each one as a C string constant. This is what translates
+register numbers in the compiler into assembler language.
+@end defmac
+
+@defmac ADDITIONAL_REGISTER_NAMES
+If defined, a C initializer for an array of structures containing a name
+and a register number. This macro defines additional names for hard
+registers, thus allowing the @code{asm} option in declarations to refer
+to registers using alternate names.
+@end defmac
+
+@defmac ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
+Define this macro if you are using an unusual assembler that
+requires different names for the machine instructions.
+
+The definition is a C statement or statements which output an
+assembler instruction opcode to the stdio stream @var{stream}. The
+macro-operand @var{ptr} is a variable of type @code{char *} which
+points to the opcode name in its ``internal'' form---the form that is
+written in the machine description. The definition should output the
+opcode name to @var{stream}, performing any translation you desire, and
+increment the variable @var{ptr} to point at the end of the opcode
+so that it will not be output twice.
+
+In fact, your macro definition may process less than the entire opcode
+name, or more than the opcode name; but if you want to process text
+that includes @samp{%}-sequences to substitute operands, you must take
+care of the substitution yourself. Just be sure to increment
+@var{ptr} over whatever text should not be output normally.
+
+@findex recog_data.operand
+If you need to look at the operand values, they can be found as the
+elements of @code{recog_data.operand}.
+
+If the macro definition does nothing, the instruction is output
+in the usual way.
+@end defmac
+
+@defmac FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
+If defined, a C statement to be executed just prior to the output of
+assembler code for @var{insn}, to modify the extracted operands so
+they will be output differently.
+
+Here the argument @var{opvec} is the vector containing the operands
+extracted from @var{insn}, and @var{noperands} is the number of
+elements of the vector which contain meaningful data for this insn.
+The contents of this vector are what will be used to convert the insn
+template into assembler code, so you can change the assembler output
+by changing the contents of the vector.
+
+This macro is useful when various assembler syntaxes share a single
+file of instruction patterns; by defining this macro differently, you
+can cause a large class of instructions to be output differently (such
+as with rearranged operands). Naturally, variations in assembler
+syntax affecting individual insn patterns ought to be handled by
+writing conditional output routines in those patterns.
+
+If this macro is not defined, it is equivalent to a null statement.
+@end defmac
+
+@hook TARGET_ASM_FINAL_POSTSCAN_INSN
+If defined, this target hook is a function which is executed just after the
+output of assembler code for @var{insn}, to change the mode of the assembler
+if necessary.
+
+Here the argument @var{opvec} is the vector containing the operands
+extracted from @var{insn}, and @var{noperands} is the number of
+elements of the vector which contain meaningful data for this insn.
+The contents of this vector are what was used to convert the insn
+template into assembler code, so you can change the assembler mode
+by checking the contents of the vector.
+@end deftypefn
+
+@defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
+A C compound statement to output to stdio stream @var{stream} the
+assembler syntax for an instruction operand @var{x}. @var{x} is an
+RTL expression.
+
+@var{code} is a value that can be used to specify one of several ways
+of printing the operand. It is used when identical operands must be
+printed differently depending on the context. @var{code} comes from
+the @samp{%} specification that was used to request printing of the
+operand. If the specification was just @samp{%@var{digit}} then
+@var{code} is 0; if the specification was @samp{%@var{ltr}
+@var{digit}} then @var{code} is the ASCII code for @var{ltr}.
+
+@findex reg_names
+If @var{x} is a register, this macro should print the register's name.
+The names can be found in an array @code{reg_names} whose type is
+@code{char *[]}. @code{reg_names} is initialized from
+@code{REGISTER_NAMES}.
+
+When the machine description has a specification @samp{%@var{punct}}
+(a @samp{%} followed by a punctuation character), this macro is called
+with a null pointer for @var{x} and the punctuation character for
+@var{code}.
+@end defmac
+
+@defmac PRINT_OPERAND_PUNCT_VALID_P (@var{code})
+A C expression which evaluates to true if @var{code} is a valid
+punctuation character for use in the @code{PRINT_OPERAND} macro. If
+@code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no
+punctuation characters (except for the standard one, @samp{%}) are used
+in this way.
+@end defmac
+
+@defmac PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
+A C compound statement to output to stdio stream @var{stream} the
+assembler syntax for an instruction operand that is a memory reference
+whose address is @var{x}. @var{x} is an RTL expression.
+
+@cindex @code{TARGET_ENCODE_SECTION_INFO} usage
+On some machines, the syntax for a symbolic address depends on the
+section that the address refers to. On these machines, define the hook
+@code{TARGET_ENCODE_SECTION_INFO} to store the information into the
+@code{symbol_ref}, and then check for it here. @xref{Assembler
+Format}.
+@end defmac
+
+@findex dbr_sequence_length
+@defmac DBR_OUTPUT_SEQEND (@var{file})
+A C statement, to be executed after all slot-filler instructions have
+been output. If necessary, call @code{dbr_sequence_length} to
+determine the number of slots filled in a sequence (zero if not
+currently outputting a sequence), to decide how many no-ops to output,
+or whatever.
+
+Don't define this macro if it has nothing to do, but it is helpful in
+reading assembly output if the extent of the delay sequence is made
+explicit (e.g.@: with white space).
+@end defmac
+
+@findex final_sequence
+Note that output routines for instructions with delay slots must be
+prepared to deal with not being output as part of a sequence
+(i.e.@: when the scheduling pass is not run, or when no slot fillers could be
+found.) The variable @code{final_sequence} is null when not
+processing a sequence, otherwise it contains the @code{sequence} rtx
+being output.
+
+@findex asm_fprintf
+@defmac REGISTER_PREFIX
+@defmacx LOCAL_LABEL_PREFIX
+@defmacx USER_LABEL_PREFIX
+@defmacx IMMEDIATE_PREFIX
+If defined, C string expressions to be used for the @samp{%R}, @samp{%L},
+@samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see
+@file{final.c}). These are useful when a single @file{md} file must
+support multiple assembler formats. In that case, the various @file{tm.h}
+files can define these macros differently.
+@end defmac
+
+@defmac ASM_FPRINTF_EXTENSIONS (@var{file}, @var{argptr}, @var{format})
+If defined this macro should expand to a series of @code{case}
+statements which will be parsed inside the @code{switch} statement of
+the @code{asm_fprintf} function. This allows targets to define extra
+printf formats which may useful when generating their assembler
+statements. Note that uppercase letters are reserved for future
+generic extensions to asm_fprintf, and so are not available to target
+specific code. The output file is given by the parameter @var{file}.
+The varargs input pointer is @var{argptr} and the rest of the format
+string, starting the character after the one that is being switched
+upon, is pointed to by @var{format}.
+@end defmac
+
+@defmac ASSEMBLER_DIALECT
+If your target supports multiple dialects of assembler language (such as
+different opcodes), define this macro as a C expression that gives the
+numeric index of the assembler language dialect to use, with zero as the
+first variant.
+
+If this macro is defined, you may use constructs of the form
+@smallexample
+@samp{@{option0|option1|option2@dots{}@}}
+@end smallexample
+@noindent
+in the output templates of patterns (@pxref{Output Template}) or in the
+first argument of @code{asm_fprintf}. This construct outputs
+@samp{option0}, @samp{option1}, @samp{option2}, etc., if the value of
+@code{ASSEMBLER_DIALECT} is zero, one, two, etc. Any special characters
+within these strings retain their usual meaning. If there are fewer
+alternatives within the braces than the value of
+@code{ASSEMBLER_DIALECT}, the construct outputs nothing.
+
+If you do not define this macro, the characters @samp{@{}, @samp{|} and
+@samp{@}} do not have any special meaning when used in templates or
+operands to @code{asm_fprintf}.
+
+Define the macros @code{REGISTER_PREFIX}, @code{LOCAL_LABEL_PREFIX},
+@code{USER_LABEL_PREFIX} and @code{IMMEDIATE_PREFIX} if you can express
+the variations in assembler language syntax with that mechanism. Define
+@code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntax
+if the syntax variant are larger and involve such things as different
+opcodes or operand order.
+@end defmac
+
+@defmac ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
+A C expression to output to @var{stream} some assembler code
+which will push hard register number @var{regno} onto the stack.
+The code need not be optimal, since this macro is used only when
+profiling.
+@end defmac
+
+@defmac ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
+A C expression to output to @var{stream} some assembler code
+which will pop hard register number @var{regno} off of the stack.
+The code need not be optimal, since this macro is used only when
+profiling.
+@end defmac
+
+@node Dispatch Tables
+@subsection Output of Dispatch Tables
+
+@c prevent bad page break with this line
+This concerns dispatch tables.
+
+@cindex dispatch table
+@defmac ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{body}, @var{value}, @var{rel})
+A C statement to output to the stdio stream @var{stream} an assembler
+pseudo-instruction to generate a difference between two labels.
+@var{value} and @var{rel} are the numbers of two internal labels. The
+definitions of these labels are output using
+@code{(*targetm.asm_out.internal_label)}, and they must be printed in the same
+way here. For example,
+
+@smallexample
+fprintf (@var{stream}, "\t.word L%d-L%d\n",
+ @var{value}, @var{rel})
+@end smallexample
+
+You must provide this macro on machines where the addresses in a
+dispatch table are relative to the table's own address. If defined, GCC
+will also use this macro on all machines when producing PIC@.
+@var{body} is the body of the @code{ADDR_DIFF_VEC}; it is provided so that the
+mode and flags can be read.
+@end defmac
+
+@defmac ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
+This macro should be provided on machines where the addresses
+in a dispatch table are absolute.
+
+The definition should be a C statement to output to the stdio stream
+@var{stream} an assembler pseudo-instruction to generate a reference to
+a label. @var{value} is the number of an internal label whose
+definition is output using @code{(*targetm.asm_out.internal_label)}.
+For example,
+
+@smallexample
+fprintf (@var{stream}, "\t.word L%d\n", @var{value})
+@end smallexample
+@end defmac
+
+@defmac ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
+Define this if the label before a jump-table needs to be output
+specially. The first three arguments are the same as for
+@code{(*targetm.asm_out.internal_label)}; the fourth argument is the
+jump-table which follows (a @code{jump_insn} containing an
+@code{addr_vec} or @code{addr_diff_vec}).
+
+This feature is used on system V to output a @code{swbeg} statement
+for the table.
+
+If this macro is not defined, these labels are output with
+@code{(*targetm.asm_out.internal_label)}.
+@end defmac
+
+@defmac ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
+Define this if something special must be output at the end of a
+jump-table. The definition should be a C statement to be executed
+after the assembler code for the table is written. It should write
+the appropriate code to stdio stream @var{stream}. The argument
+@var{table} is the jump-table insn, and @var{num} is the label-number
+of the preceding label.
+
+If this macro is not defined, nothing special is output at the end of
+the jump-table.
+@end defmac
+
+@hook TARGET_ASM_EMIT_UNWIND_LABEL
+This target hook emits a label at the beginning of each FDE@. It
+should be defined on targets where FDEs need special labels, and it
+should write the appropriate label, for the FDE associated with the
+function declaration @var{decl}, to the stdio stream @var{stream}.
+The third argument, @var{for_eh}, is a boolean: true if this is for an
+exception table. The fourth argument, @var{empty}, is a boolean:
+true if this is a placeholder label for an omitted FDE@.
+
+The default is that FDEs are not given nonlocal labels.
+@end deftypefn
+
+@hook TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL
+This target hook emits a label at the beginning of the exception table.
+It should be defined on targets where it is desirable for the table
+to be broken up according to function.
+
+The default is that no label is emitted.
+@end deftypefn
+
+@hook TARGET_ASM_UNWIND_EMIT
+This target hook emits assembly directives required to unwind the
+given instruction. This is only used when TARGET_UNWIND_INFO is set.
+@end deftypefn
+
+@node Exception Region Output
+@subsection Assembler Commands for Exception Regions
+
+@c prevent bad page break with this line
+
+This describes commands marking the start and the end of an exception
+region.
+
+@defmac EH_FRAME_SECTION_NAME
+If defined, a C string constant for the name of the section containing
+exception handling frame unwind information. If not defined, GCC will
+provide a default definition if the target supports named sections.
+@file{crtstuff.c} uses this macro to switch to the appropriate section.
+
+You should define this symbol if your target supports DWARF 2 frame
+unwind information and the default definition does not work.
+@end defmac
+
+@defmac EH_FRAME_IN_DATA_SECTION
+If defined, DWARF 2 frame unwind information will be placed in the
+data section even though the target supports named sections. This
+might be necessary, for instance, if the system linker does garbage
+collection and sections cannot be marked as not to be collected.
+
+Do not define this macro unless @code{TARGET_ASM_NAMED_SECTION} is
+also defined.
+@end defmac
+
+@defmac EH_TABLES_CAN_BE_READ_ONLY
+Define this macro to 1 if your target is such that no frame unwind
+information encoding used with non-PIC code will ever require a
+runtime relocation, but the linker may not support merging read-only
+and read-write sections into a single read-write section.
+@end defmac
+
+@defmac MASK_RETURN_ADDR
+An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so
+that it does not contain any extraneous set bits in it.
+@end defmac
+
+@defmac DWARF2_UNWIND_INFO
+Define this macro to 0 if your target supports DWARF 2 frame unwind
+information, but it does not yet work with exception handling.
+Otherwise, if your target supports this information (if it defines
+@samp{INCOMING_RETURN_ADDR_RTX} and either @samp{UNALIGNED_INT_ASM_OP}
+or @samp{OBJECT_FORMAT_ELF}), GCC will provide a default definition of 1.
+
+If @code{TARGET_UNWIND_INFO} is defined, the target specific unwinder
+will be used in all cases. Defining this macro will enable the generation
+of DWARF 2 frame debugging information.
+
+If @code{TARGET_UNWIND_INFO} is not defined, and this macro is defined to 1,
+the DWARF 2 unwinder will be the default exception handling mechanism;
+otherwise, the @code{setjmp}/@code{longjmp}-based scheme will be used by
+default.
+@end defmac
+
+@defmac TARGET_UNWIND_INFO
+Define this macro if your target has ABI specified unwind tables. Usually
+these will be output by @code{TARGET_ASM_UNWIND_EMIT}.
+@end defmac
+
+@hook TARGET_UNWIND_TABLES_DEFAULT
+This variable should be set to @code{true} if the target ABI requires unwinding
+tables even when exceptions are not used.
+@end deftypevr
+
+@defmac MUST_USE_SJLJ_EXCEPTIONS
+This macro need only be defined if @code{DWARF2_UNWIND_INFO} is
+runtime-variable. In that case, @file{except.h} cannot correctly
+determine the corresponding definition of @code{MUST_USE_SJLJ_EXCEPTIONS},
+so the target must provide it directly.
+@end defmac
+
+@defmac DONT_USE_BUILTIN_SETJMP
+Define this macro to 1 if the @code{setjmp}/@code{longjmp}-based scheme
+should use the @code{setjmp}/@code{longjmp} functions from the C library
+instead of the @code{__builtin_setjmp}/@code{__builtin_longjmp} machinery.
+@end defmac
+
+@defmac DWARF_CIE_DATA_ALIGNMENT
+This macro need only be defined if the target might save registers in the
+function prologue at an offset to the stack pointer that is not aligned to
+@code{UNITS_PER_WORD}. The definition should be the negative minimum
+alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive
+minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if
+the target supports DWARF 2 frame unwind information.
+@end defmac
+
+@hook TARGET_TERMINATE_DW2_EH_FRAME_INFO
+Contains the value true if the target should add a zero word onto the
+end of a Dwarf-2 frame info section when used for exception handling.
+Default value is false if @code{EH_FRAME_SECTION_NAME} is defined, and
+true otherwise.
+@end deftypevr
+
+@hook TARGET_DWARF_REGISTER_SPAN
+Given a register, this hook should return a parallel of registers to
+represent where to find the register pieces. Define this hook if the
+register and its mode are represented in Dwarf in non-contiguous
+locations, or if the register should be represented in more than one
+register in Dwarf. Otherwise, this hook should return @code{NULL_RTX}.
+If not defined, the default is to return @code{NULL_RTX}.
+@end deftypefn
+
+@hook TARGET_INIT_DWARF_REG_SIZES_EXTRA
+If some registers are represented in Dwarf-2 unwind information in
+multiple pieces, define this hook to fill in information about the
+sizes of those pieces in the table used by the unwinder at runtime.
+It will be called by @code{expand_builtin_init_dwarf_reg_sizes} after
+filling in a single size corresponding to each hard register;
+@var{address} is the address of the table.
+@end deftypefn
+
+@hook TARGET_ASM_TTYPE
+This hook is used to output a reference from a frame unwinding table to
+the type_info object identified by @var{sym}. It should return @code{true}
+if the reference was output. Returning @code{false} will cause the
+reference to be output using the normal Dwarf2 routines.
+@end deftypefn
+
+@hook TARGET_ARM_EABI_UNWINDER
+This flag should be set to @code{true} on targets that use an ARM EABI
+based unwinding library, and @code{false} on other targets. This effects
+the format of unwinding tables, and how the unwinder in entered after
+running a cleanup. The default is @code{false}.
+@end deftypevr
+
+@node Alignment Output
+@subsection Assembler Commands for Alignment
+
+@c prevent bad page break with this line
+This describes commands for alignment.
+
+@defmac JUMP_ALIGN (@var{label})
+The alignment (log base 2) to put in front of @var{label}, which is
+a common destination of jumps and has no fallthru incoming edge.
+
+This macro need not be defined if you don't want any special alignment
+to be done at such a time. Most machine descriptions do not currently
+define the macro.
+
+Unless it's necessary to inspect the @var{label} parameter, it is better
+to set the variable @var{align_jumps} in the target's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
+selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.
+@end defmac
+
+@defmac LABEL_ALIGN_AFTER_BARRIER (@var{label})
+The alignment (log base 2) to put in front of @var{label}, which follows
+a @code{BARRIER}.
+
+This macro need not be defined if you don't want any special alignment
+to be done at such a time. Most machine descriptions do not currently
+define the macro.
+@end defmac
+
+@defmac LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
+The maximum number of bytes to skip when applying
+@code{LABEL_ALIGN_AFTER_BARRIER}. This works only if
+@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
+@end defmac
+
+@defmac LOOP_ALIGN (@var{label})
+The alignment (log base 2) to put in front of @var{label}, which follows
+a @code{NOTE_INSN_LOOP_BEG} note.
+
+This macro need not be defined if you don't want any special alignment
+to be done at such a time. Most machine descriptions do not currently
+define the macro.
+
+Unless it's necessary to inspect the @var{label} parameter, it is better
+to set the variable @code{align_loops} in the target's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
+selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.
+@end defmac
+
+@defmac LOOP_ALIGN_MAX_SKIP
+The maximum number of bytes to skip when applying @code{LOOP_ALIGN}.
+This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
+@end defmac
+
+@defmac LABEL_ALIGN (@var{label})
+The alignment (log base 2) to put in front of @var{label}.
+If @code{LABEL_ALIGN_AFTER_BARRIER} / @code{LOOP_ALIGN} specify a different alignment,
+the maximum of the specified values is used.
+
+Unless it's necessary to inspect the @var{label} parameter, it is better
+to set the variable @code{align_labels} in the target's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
+selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.
+@end defmac
+
+@defmac LABEL_ALIGN_MAX_SKIP
+The maximum number of bytes to skip when applying @code{LABEL_ALIGN}.
+This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
+@end defmac
+
+@defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
+A C statement to output to the stdio stream @var{stream} an assembler
+instruction to advance the location counter by @var{nbytes} bytes.
+Those bytes should be zero when loaded. @var{nbytes} will be a C
+expression of type @code{unsigned HOST_WIDE_INT}.
+@end defmac
+
+@defmac ASM_NO_SKIP_IN_TEXT
+Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the
+text section because it fails to put zeros in the bytes that are skipped.
+This is true on many Unix systems, where the pseudo--op to skip bytes
+produces no-op instructions rather than zeros when used in the text
+section.
+@end defmac
+
+@defmac ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
+A C statement to output to the stdio stream @var{stream} an assembler
+command to advance the location counter to a multiple of 2 to the
+@var{power} bytes. @var{power} will be a C expression of type @code{int}.
+@end defmac
+
+@defmac ASM_OUTPUT_ALIGN_WITH_NOP (@var{stream}, @var{power})
+Like @code{ASM_OUTPUT_ALIGN}, except that the ``nop'' instruction is used
+for padding, if necessary.
+@end defmac
+
+@defmac ASM_OUTPUT_MAX_SKIP_ALIGN (@var{stream}, @var{power}, @var{max_skip})
+A C statement to output to the stdio stream @var{stream} an assembler
+command to advance the location counter to a multiple of 2 to the
+@var{power} bytes, but only if @var{max_skip} or fewer bytes are needed to
+satisfy the alignment request. @var{power} and @var{max_skip} will be
+a C expression of type @code{int}.
+@end defmac
+
+@need 3000
+@node Debugging Info
+@section Controlling Debugging Information Format
+
+@c prevent bad page break with this line
+This describes how to specify debugging information.
+
+@menu
+* All Debuggers:: Macros that affect all debugging formats uniformly.
+* DBX Options:: Macros enabling specific options in DBX format.
+* DBX Hooks:: Hook macros for varying DBX format.
+* File Names and DBX:: Macros controlling output of file names in DBX format.
+* SDB and DWARF:: Macros for SDB (COFF) and DWARF formats.
+* VMS Debug:: Macros for VMS debug format.
+@end menu
+
+@node All Debuggers
+@subsection Macros Affecting All Debugging Formats
+
+@c prevent bad page break with this line
+These macros affect all debugging formats.
+
+@defmac DBX_REGISTER_NUMBER (@var{regno})
+A C expression that returns the DBX register number for the compiler
+register number @var{regno}. In the default macro provided, the value
+of this expression will be @var{regno} itself. But sometimes there are
+some registers that the compiler knows about and DBX does not, or vice
+versa. In such cases, some register may need to have one number in the
+compiler and another for DBX@.
+
+If two registers have consecutive numbers inside GCC, and they can be
+used as a pair to hold a multiword value, then they @emph{must} have
+consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}.
+Otherwise, debuggers will be unable to access such a pair, because they
+expect register pairs to be consecutive in their own numbering scheme.
+
+If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that
+does not preserve register pairs, then what you must do instead is
+redefine the actual register numbering scheme.
+@end defmac
+
+@defmac DEBUGGER_AUTO_OFFSET (@var{x})
+A C expression that returns the integer offset value for an automatic
+variable having address @var{x} (an RTL expression). The default
+computation assumes that @var{x} is based on the frame-pointer and
+gives the offset from the frame-pointer. This is required for targets
+that produce debugging output for DBX or COFF-style debugging output
+for SDB and allow the frame-pointer to be eliminated when the
+@option{-g} options is used.
+@end defmac
+
+@defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x})
+A C expression that returns the integer offset value for an argument
+having address @var{x} (an RTL expression). The nominal offset is
+@var{offset}.
+@end defmac
+
+@defmac PREFERRED_DEBUGGING_TYPE
+A C expression that returns the type of debugging output GCC should
+produce when the user specifies just @option{-g}. Define
+this if you have arranged for GCC to support more than one format of
+debugging output. Currently, the allowable values are @code{DBX_DEBUG},
+@code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG},
+@code{XCOFF_DEBUG}, @code{VMS_DEBUG}, and @code{VMS_AND_DWARF2_DEBUG}.
+
+When the user specifies @option{-ggdb}, GCC normally also uses the
+value of this macro to select the debugging output format, but with two
+exceptions. If @code{DWARF2_DEBUGGING_INFO} is defined, GCC uses the
+value @code{DWARF2_DEBUG}. Otherwise, if @code{DBX_DEBUGGING_INFO} is
+defined, GCC uses @code{DBX_DEBUG}.
+
+The value of this macro only affects the default debugging output; the
+user can always get a specific type of output by using @option{-gstabs},
+@option{-gcoff}, @option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}.
+@end defmac
+
+@node DBX Options
+@subsection Specific Options for DBX Output
+
+@c prevent bad page break with this line
+These are specific options for DBX output.
+
+@defmac DBX_DEBUGGING_INFO
+Define this macro if GCC should produce debugging output for DBX
+in response to the @option{-g} option.
+@end defmac
+
+@defmac XCOFF_DEBUGGING_INFO
+Define this macro if GCC should produce XCOFF format debugging output
+in response to the @option{-g} option. This is a variant of DBX format.
+@end defmac
+
+@defmac DEFAULT_GDB_EXTENSIONS
+Define this macro to control whether GCC should by default generate
+GDB's extended version of DBX debugging information (assuming DBX-format
+debugging information is enabled at all). If you don't define the
+macro, the default is 1: always generate the extended information
+if there is any occasion to.
+@end defmac
+
+@defmac DEBUG_SYMS_TEXT
+Define this macro if all @code{.stabs} commands should be output while
+in the text section.
+@end defmac
+
+@defmac ASM_STABS_OP
+A C string constant, including spacing, naming the assembler pseudo op to
+use instead of @code{"\t.stabs\t"} to define an ordinary debugging symbol.
+If you don't define this macro, @code{"\t.stabs\t"} is used. This macro
+applies only to DBX debugging information format.
+@end defmac
+
+@defmac ASM_STABD_OP
+A C string constant, including spacing, naming the assembler pseudo op to
+use instead of @code{"\t.stabd\t"} to define a debugging symbol whose
+value is the current location. If you don't define this macro,
+@code{"\t.stabd\t"} is used. This macro applies only to DBX debugging
+information format.
+@end defmac
+
+@defmac ASM_STABN_OP
+A C string constant, including spacing, naming the assembler pseudo op to
+use instead of @code{"\t.stabn\t"} to define a debugging symbol with no
+name. If you don't define this macro, @code{"\t.stabn\t"} is used. This
+macro applies only to DBX debugging information format.
+@end defmac
+
+@defmac DBX_NO_XREFS
+Define this macro if DBX on your system does not support the construct
+@samp{xs@var{tagname}}. On some systems, this construct is used to
+describe a forward reference to a structure named @var{tagname}.
+On other systems, this construct is not supported at all.
+@end defmac
+
+@defmac DBX_CONTIN_LENGTH
+A symbol name in DBX-format debugging information is normally
+continued (split into two separate @code{.stabs} directives) when it
+exceeds a certain length (by default, 80 characters). On some
+operating systems, DBX requires this splitting; on others, splitting
+must not be done. You can inhibit splitting by defining this macro
+with the value zero. You can override the default splitting-length by
+defining this macro as an expression for the length you desire.
+@end defmac
+
+@defmac DBX_CONTIN_CHAR
+Normally continuation is indicated by adding a @samp{\} character to
+the end of a @code{.stabs} string when a continuation follows. To use
+a different character instead, define this macro as a character
+constant for the character you want to use. Do not define this macro
+if backslash is correct for your system.
+@end defmac
+
+@defmac DBX_STATIC_STAB_DATA_SECTION
+Define this macro if it is necessary to go to the data section before
+outputting the @samp{.stabs} pseudo-op for a non-global static
+variable.
+@end defmac
+
+@defmac DBX_TYPE_DECL_STABS_CODE
+The value to use in the ``code'' field of the @code{.stabs} directive
+for a typedef. The default is @code{N_LSYM}.
+@end defmac
+
+@defmac DBX_STATIC_CONST_VAR_CODE
+The value to use in the ``code'' field of the @code{.stabs} directive
+for a static variable located in the text section. DBX format does not
+provide any ``right'' way to do this. The default is @code{N_FUN}.
+@end defmac
+
+@defmac DBX_REGPARM_STABS_CODE
+The value to use in the ``code'' field of the @code{.stabs} directive
+for a parameter passed in registers. DBX format does not provide any
+``right'' way to do this. The default is @code{N_RSYM}.
+@end defmac
+
+@defmac DBX_REGPARM_STABS_LETTER
+The letter to use in DBX symbol data to identify a symbol as a parameter
+passed in registers. DBX format does not customarily provide any way to
+do this. The default is @code{'P'}.
+@end defmac
+
+@defmac DBX_FUNCTION_FIRST
+Define this macro if the DBX information for a function and its
+arguments should precede the assembler code for the function. Normally,
+in DBX format, the debugging information entirely follows the assembler
+code.
+@end defmac
+
+@defmac DBX_BLOCKS_FUNCTION_RELATIVE
+Define this macro, with value 1, if the value of a symbol describing
+the scope of a block (@code{N_LBRAC} or @code{N_RBRAC}) should be
+relative to the start of the enclosing function. Normally, GCC uses
+an absolute address.
+@end defmac
+
+@defmac DBX_LINES_FUNCTION_RELATIVE
+Define this macro, with value 1, if the value of a symbol indicating
+the current line number (@code{N_SLINE}) should be relative to the
+start of the enclosing function. Normally, GCC uses an absolute address.
+@end defmac
+
+@defmac DBX_USE_BINCL
+Define this macro if GCC should generate @code{N_BINCL} and
+@code{N_EINCL} stabs for included header files, as on Sun systems. This
+macro also directs GCC to output a type number as a pair of a file
+number and a type number within the file. Normally, GCC does not
+generate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a single
+number for a type number.
+@end defmac
+
+@node DBX Hooks
+@subsection Open-Ended Hooks for DBX Format
+
+@c prevent bad page break with this line
+These are hooks for DBX format.
+
+@defmac DBX_OUTPUT_LBRAC (@var{stream}, @var{name})
+Define this macro to say how to output to @var{stream} the debugging
+information for the start of a scope level for variable names. The
+argument @var{name} is the name of an assembler symbol (for use with
+@code{assemble_name}) whose value is the address where the scope begins.
+@end defmac
+
+@defmac DBX_OUTPUT_RBRAC (@var{stream}, @var{name})
+Like @code{DBX_OUTPUT_LBRAC}, but for the end of a scope level.
+@end defmac
+
+@defmac DBX_OUTPUT_NFUN (@var{stream}, @var{lscope_label}, @var{decl})
+Define this macro if the target machine requires special handling to
+output an @code{N_FUN} entry for the function @var{decl}.
+@end defmac
+
+@defmac DBX_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}, @var{counter})
+A C statement to output DBX debugging information before code for line
+number @var{line} of the current source file to the stdio stream
+@var{stream}. @var{counter} is the number of time the macro was
+invoked, including the current invocation; it is intended to generate
+unique labels in the assembly output.
+
+This macro should not be defined if the default output is correct, or
+if it can be made correct by defining @code{DBX_LINES_FUNCTION_RELATIVE}.
+@end defmac
+
+@defmac NO_DBX_FUNCTION_END
+Some stabs encapsulation formats (in particular ECOFF), cannot handle the
+@code{.stabs "",N_FUN,,0,0,Lscope-function-1} gdb dbx extension construct.
+On those machines, define this macro to turn this feature off without
+disturbing the rest of the gdb extensions.
+@end defmac
+
+@defmac NO_DBX_BNSYM_ENSYM
+Some assemblers cannot handle the @code{.stabd BNSYM/ENSYM,0,0} gdb dbx
+extension construct. On those machines, define this macro to turn this
+feature off without disturbing the rest of the gdb extensions.
+@end defmac
+
+@node File Names and DBX
+@subsection File Names in DBX Format
+
+@c prevent bad page break with this line
+This describes file names in DBX format.
+
+@defmac DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name})
+A C statement to output DBX debugging information to the stdio stream
+@var{stream}, which indicates that file @var{name} is the main source
+file---the file specified as the input file for compilation.
+This macro is called only once, at the beginning of compilation.
+
+This macro need not be defined if the standard form of output
+for DBX debugging information is appropriate.
+
+It may be necessary to refer to a label equal to the beginning of the
+text section. You can use @samp{assemble_name (stream, ltext_label_name)}
+to do so. If you do this, you must also set the variable
+@var{used_ltext_label_name} to @code{true}.
+@end defmac
+
+@defmac NO_DBX_MAIN_SOURCE_DIRECTORY
+Define this macro, with value 1, if GCC should not emit an indication
+of the current directory for compilation and current source language at
+the beginning of the file.
+@end defmac
+
+@defmac NO_DBX_GCC_MARKER
+Define this macro, with value 1, if GCC should not emit an indication
+that this object file was compiled by GCC@. The default is to emit
+an @code{N_OPT} stab at the beginning of every source file, with
+@samp{gcc2_compiled.} for the string and value 0.
+@end defmac
+
+@defmac DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name})
+A C statement to output DBX debugging information at the end of
+compilation of the main source file @var{name}. Output should be
+written to the stdio stream @var{stream}.
+
+If you don't define this macro, nothing special is output at the end
+of compilation, which is correct for most machines.
+@end defmac
+
+@defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
+Define this macro @emph{instead of} defining
+@code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output at
+the end of compilation is an @code{N_SO} stab with an empty string,
+whose value is the highest absolute text address in the file.
+@end defmac
+
+@need 2000
+@node SDB and DWARF
+@subsection Macros for SDB and DWARF Output
+
+@c prevent bad page break with this line
+Here are macros for SDB and DWARF output.
+
+@defmac SDB_DEBUGGING_INFO
+Define this macro if GCC should produce COFF-style debugging output
+for SDB in response to the @option{-g} option.
+@end defmac
+
+@defmac DWARF2_DEBUGGING_INFO
+Define this macro if GCC should produce dwarf version 2 format
+debugging output in response to the @option{-g} option.
+
+@hook TARGET_DWARF_CALLING_CONVENTION
+Define this to enable the dwarf attribute @code{DW_AT_calling_convention} to
+be emitted for each function. Instead of an integer return the enum
+value for the @code{DW_CC_} tag.
+@end deftypefn
+
+To support optional call frame debugging information, you must also
+define @code{INCOMING_RETURN_ADDR_RTX} and either set
+@code{RTX_FRAME_RELATED_P} on the prologue insns if you use RTL for the
+prologue, or call @code{dwarf2out_def_cfa} and @code{dwarf2out_reg_save}
+as appropriate from @code{TARGET_ASM_FUNCTION_PROLOGUE} if you don't.
+@end defmac
+
+@defmac DWARF2_FRAME_INFO
+Define this macro to a nonzero value if GCC should always output
+Dwarf 2 frame information. If @code{DWARF2_UNWIND_INFO}
+(@pxref{Exception Region Output} is nonzero, GCC will output this
+information not matter how you define @code{DWARF2_FRAME_INFO}.
+@end defmac
+
+@defmac DWARF2_ASM_LINE_DEBUG_INFO
+Define this macro to be a nonzero value if the assembler can generate Dwarf 2
+line debug info sections. This will result in much more compact line number
+tables, and hence is desirable if it works.
+@end defmac
+
+@defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
+A C statement to issue assembly directives that create a difference
+@var{lab1} minus @var{lab2}, using an integer of the given @var{size}.
+@end defmac
+
+@defmac ASM_OUTPUT_DWARF_VMS_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
+A C statement to issue assembly directives that create a difference
+between the two given labels in system defined units, e.g. instruction
+slots on IA64 VMS, using an integer of the given size.
+@end defmac
+
+@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{section})
+A C statement to issue assembly directives that create a
+section-relative reference to the given @var{label}, using an integer of the
+given @var{size}. The label is known to be defined in the given @var{section}.
+@end defmac
+
+@defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label})
+A C statement to issue assembly directives that create a self-relative
+reference to the given @var{label}, using an integer of the given @var{size}.
+@end defmac
+
+@defmac ASM_OUTPUT_DWARF_TABLE_REF (@var{label})
+A C statement to issue assembly directives that create a reference to
+the DWARF table identifier @var{label} from the current section. This
+is used on some systems to avoid garbage collecting a DWARF table which
+is referenced by a function.
+@end defmac
+
+@hook TARGET_ASM_OUTPUT_DWARF_DTPREL
+If defined, this target hook is a function which outputs a DTP-relative
+reference to the given TLS symbol of the specified size.
+@end deftypefn
+
+@defmac PUT_SDB_@dots{}
+Define these macros to override the assembler syntax for the special
+SDB assembler directives. See @file{sdbout.c} for a list of these
+macros and their arguments. If the standard syntax is used, you need
+not define them yourself.
+@end defmac
+
+@defmac SDB_DELIM
+Some assemblers do not support a semicolon as a delimiter, even between
+SDB assembler directives. In that case, define this macro to be the
+delimiter to use (usually @samp{\n}). It is not necessary to define
+a new set of @code{PUT_SDB_@var{op}} macros if this is the only change
+required.
+@end defmac
+
+@defmac SDB_ALLOW_UNKNOWN_REFERENCES
+Define this macro to allow references to unknown structure,
+union, or enumeration tags to be emitted. Standard COFF does not
+allow handling of unknown references, MIPS ECOFF has support for
+it.
+@end defmac
+
+@defmac SDB_ALLOW_FORWARD_REFERENCES
+Define this macro to allow references to structure, union, or
+enumeration tags that have not yet been seen to be handled. Some
+assemblers choke if forward tags are used, while some require it.
+@end defmac
+
+@defmac SDB_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
+A C statement to output SDB debugging information before code for line
+number @var{line} of the current source file to the stdio stream
+@var{stream}. The default is to emit an @code{.ln} directive.
+@end defmac
+
+@need 2000
+@node VMS Debug
+@subsection Macros for VMS Debug Format
+
+@c prevent bad page break with this line
+Here are macros for VMS debug format.
+
+@defmac VMS_DEBUGGING_INFO
+Define this macro if GCC should produce debugging output for VMS
+in response to the @option{-g} option. The default behavior for VMS
+is to generate minimal debug info for a traceback in the absence of
+@option{-g} unless explicitly overridden with @option{-g0}. This
+behavior is controlled by @code{OPTIMIZATION_OPTIONS} and
+@code{TARGET_OPTION_OVERRIDE}.
+@end defmac
+
+@node Floating Point
+@section Cross Compilation and Floating Point
+@cindex cross compilation and floating point
+@cindex floating point and cross compilation
+
+While all modern machines use twos-complement representation for integers,
+there are a variety of representations for floating point numbers. This
+means that in a cross-compiler the representation of floating point numbers
+in the compiled program may be different from that used in the machine
+doing the compilation.
+
+Because different representation systems may offer different amounts of
+range and precision, all floating point constants must be represented in
+the target machine's format. Therefore, the cross compiler cannot
+safely use the host machine's floating point arithmetic; it must emulate
+the target's arithmetic. To ensure consistency, GCC always uses
+emulation to work with floating point values, even when the host and
+target floating point formats are identical.
+
+The following macros are provided by @file{real.h} for the compiler to
+use. All parts of the compiler which generate or optimize
+floating-point calculations must use these macros. They may evaluate
+their operands more than once, so operands must not have side effects.
+
+@defmac REAL_VALUE_TYPE
+The C data type to be used to hold a floating point value in the target
+machine's format. Typically this is a @code{struct} containing an
+array of @code{HOST_WIDE_INT}, but all code should treat it as an opaque
+quantity.
+@end defmac
+
+@deftypefn Macro int REAL_VALUES_EQUAL (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
+Compares for equality the two values, @var{x} and @var{y}. If the target
+floating point format supports negative zeroes and/or NaNs,
+@samp{REAL_VALUES_EQUAL (-0.0, 0.0)} is true, and
+@samp{REAL_VALUES_EQUAL (NaN, NaN)} is false.
+@end deftypefn
+
+@deftypefn Macro int REAL_VALUES_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
+Tests whether @var{x} is less than @var{y}.
+@end deftypefn
+
+@deftypefn Macro HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE @var{x})
+Truncates @var{x} to a signed integer, rounding toward zero.
+@end deftypefn
+
+@deftypefn Macro {unsigned HOST_WIDE_INT} REAL_VALUE_UNSIGNED_FIX (REAL_VALUE_TYPE @var{x})
+Truncates @var{x} to an unsigned integer, rounding toward zero. If
+@var{x} is negative, returns zero.
+@end deftypefn
+
+@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ATOF (const char *@var{string}, enum machine_mode @var{mode})
+Converts @var{string} into a floating point number in the target machine's
+representation for mode @var{mode}. This routine can handle both
+decimal and hexadecimal floating point constants, using the syntax
+defined by the C language for both.
+@end deftypefn
+
+@deftypefn Macro int REAL_VALUE_NEGATIVE (REAL_VALUE_TYPE @var{x})
+Returns 1 if @var{x} is negative (including negative zero), 0 otherwise.
+@end deftypefn
+
+@deftypefn Macro int REAL_VALUE_ISINF (REAL_VALUE_TYPE @var{x})
+Determines whether @var{x} represents infinity (positive or negative).
+@end deftypefn
+
+@deftypefn Macro int REAL_VALUE_ISNAN (REAL_VALUE_TYPE @var{x})
+Determines whether @var{x} represents a ``NaN'' (not-a-number).
+@end deftypefn
+
+@deftypefn Macro void REAL_ARITHMETIC (REAL_VALUE_TYPE @var{output}, enum tree_code @var{code}, REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
+Calculates an arithmetic operation on the two floating point values
+@var{x} and @var{y}, storing the result in @var{output} (which must be a
+variable).
+
+The operation to be performed is specified by @var{code}. Only the
+following codes are supported: @code{PLUS_EXPR}, @code{MINUS_EXPR},
+@code{MULT_EXPR}, @code{RDIV_EXPR}, @code{MAX_EXPR}, @code{MIN_EXPR}.
+
+If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and the
+target's floating point format cannot represent infinity, it will call
+@code{abort}. Callers should check for this situation first, using
+@code{MODE_HAS_INFINITIES}. @xref{Storage Layout}.
+@end deftypefn
+
+@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x})
+Returns the negative of the floating point value @var{x}.
+@end deftypefn
+
+@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ABS (REAL_VALUE_TYPE @var{x})
+Returns the absolute value of @var{x}.
+@end deftypefn
+
+@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_TRUNCATE (REAL_VALUE_TYPE @var{mode}, enum machine_mode @var{x})
+Truncates the floating point value @var{x} to fit in @var{mode}. The
+return value is still a full-size @code{REAL_VALUE_TYPE}, but it has an
+appropriate bit pattern to be output as a floating constant whose
+precision accords with mode @var{mode}.
+@end deftypefn
+
+@deftypefn Macro void REAL_VALUE_TO_INT (HOST_WIDE_INT @var{low}, HOST_WIDE_INT @var{high}, REAL_VALUE_TYPE @var{x})
+Converts a floating point value @var{x} into a double-precision integer
+which is then stored into @var{low} and @var{high}. If the value is not
+integral, it is truncated.
+@end deftypefn
+
+@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, HOST_WIDE_INT @var{low}, HOST_WIDE_INT @var{high}, enum machine_mode @var{mode})
+Converts a double-precision integer found in @var{low} and @var{high},
+into a floating point value which is then stored into @var{x}. The
+value is truncated to fit in mode @var{mode}.
+@end deftypefn
+
+@node Mode Switching
+@section Mode Switching Instructions
+@cindex mode switching
+The following macros control mode switching optimizations:
+
+@defmac OPTIMIZE_MODE_SWITCHING (@var{entity})
+Define this macro if the port needs extra instructions inserted for mode
+switching in an optimizing compilation.
+
+For an example, the SH4 can perform both single and double precision
+floating point operations, but to perform a single precision operation,
+the FPSCR PR bit has to be cleared, while for a double precision
+operation, this bit has to be set. Changing the PR bit requires a general
+purpose register as a scratch register, hence these FPSCR sets have to
+be inserted before reload, i.e.@: you can't put this into instruction emitting
+or @code{TARGET_MACHINE_DEPENDENT_REORG}.
+
+You can have multiple entities that are mode-switched, and select at run time
+which entities actually need it. @code{OPTIMIZE_MODE_SWITCHING} should
+return nonzero for any @var{entity} that needs mode-switching.
+If you define this macro, you also have to define
+@code{NUM_MODES_FOR_MODE_SWITCHING}, @code{MODE_NEEDED},
+@code{MODE_PRIORITY_TO_MODE} and @code{EMIT_MODE_SET}.
+@code{MODE_AFTER}, @code{MODE_ENTRY}, and @code{MODE_EXIT}
+are optional.
+@end defmac
+
+@defmac NUM_MODES_FOR_MODE_SWITCHING
+If you define @code{OPTIMIZE_MODE_SWITCHING}, you have to define this as
+initializer for an array of integers. Each initializer element
+N refers to an entity that needs mode switching, and specifies the number
+of different modes that might need to be set for this entity.
+The position of the initializer in the initializer---starting counting at
+zero---determines the integer that is used to refer to the mode-switched
+entity in question.
+In macros that take mode arguments / yield a mode result, modes are
+represented as numbers 0 @dots{} N @minus{} 1. N is used to specify that no mode
+switch is needed / supplied.
+@end defmac
+
+@defmac MODE_NEEDED (@var{entity}, @var{insn})
+@var{entity} is an integer specifying a mode-switched entity. If
+@code{OPTIMIZE_MODE_SWITCHING} is defined, you must define this macro to
+return an integer value not larger than the corresponding element in
+@code{NUM_MODES_FOR_MODE_SWITCHING}, to denote the mode that @var{entity} must
+be switched into prior to the execution of @var{insn}.
+@end defmac
+
+@defmac MODE_AFTER (@var{mode}, @var{insn})
+If this macro is defined, it is evaluated for every @var{insn} during
+mode switching. It determines the mode that an insn results in (if
+different from the incoming mode).
+@end defmac
+
+@defmac MODE_ENTRY (@var{entity})
+If this macro is defined, it is evaluated for every @var{entity} that needs
+mode switching. It should evaluate to an integer, which is a mode that
+@var{entity} is assumed to be switched to at function entry. If @code{MODE_ENTRY}
+is defined then @code{MODE_EXIT} must be defined.
+@end defmac
+
+@defmac MODE_EXIT (@var{entity})
+If this macro is defined, it is evaluated for every @var{entity} that needs
+mode switching. It should evaluate to an integer, which is a mode that
+@var{entity} is assumed to be switched to at function exit. If @code{MODE_EXIT}
+is defined then @code{MODE_ENTRY} must be defined.
+@end defmac
+
+@defmac MODE_PRIORITY_TO_MODE (@var{entity}, @var{n})
+This macro specifies the order in which modes for @var{entity} are processed.
+0 is the highest priority, @code{NUM_MODES_FOR_MODE_SWITCHING[@var{entity}] - 1} the
+lowest. The value of the macro should be an integer designating a mode
+for @var{entity}. For any fixed @var{entity}, @code{mode_priority_to_mode}
+(@var{entity}, @var{n}) shall be a bijection in 0 @dots{}
+@code{num_modes_for_mode_switching[@var{entity}] - 1}.
+@end defmac
+
+@defmac EMIT_MODE_SET (@var{entity}, @var{mode}, @var{hard_regs_live})
+Generate one or more insns to set @var{entity} to @var{mode}.
+@var{hard_reg_live} is the set of hard registers live at the point where
+the insn(s) are to be inserted.
+@end defmac
+
+@node Target Attributes
+@section Defining target-specific uses of @code{__attribute__}
+@cindex target attributes
+@cindex machine attributes
+@cindex attributes, target-specific
+
+Target-specific attributes may be defined for functions, data and types.
+These are described using the following target hooks; they also need to
+be documented in @file{extend.texi}.
+
+@hook TARGET_ATTRIBUTE_TABLE
+If defined, this target hook points to an array of @samp{struct
+attribute_spec} (defined in @file{tree.h}) specifying the machine
+specific attributes for this target and some of the restrictions on the
+entities to which these attributes are applied and the arguments they
+take.
+@end deftypevr
+
+@hook TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P
+If defined, this target hook is a function which returns true if the
+machine-specific attribute named @var{name} expects an identifier
+given as its first argument to be passed on as a plain identifier, not
+subjected to name lookup. If this is not defined, the default is
+false for all machine-specific attributes.
+@end deftypefn
+
+@hook TARGET_COMP_TYPE_ATTRIBUTES
+If defined, this target hook is a function which returns zero if the attributes on
+@var{type1} and @var{type2} are incompatible, one if they are compatible,
+and two if they are nearly compatible (which causes a warning to be
+generated). If this is not defined, machine-specific attributes are
+supposed always to be compatible.
+@end deftypefn
+
+@hook TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
+If defined, this target hook is a function which assigns default attributes to
+the newly defined @var{type}.
+@end deftypefn
+
+@hook TARGET_MERGE_TYPE_ATTRIBUTES
+Define this target hook if the merging of type attributes needs special
+handling. If defined, the result is a list of the combined
+@code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}. It is assumed
+that @code{comptypes} has already been called and returned 1. This
+function may call @code{merge_attributes} to handle machine-independent
+merging.
+@end deftypefn
+
+@hook TARGET_MERGE_DECL_ATTRIBUTES
+Define this target hook if the merging of decl attributes needs special
+handling. If defined, the result is a list of the combined
+@code{DECL_ATTRIBUTES} of @var{olddecl} and @var{newdecl}.
+@var{newdecl} is a duplicate declaration of @var{olddecl}. Examples of
+when this is needed are when one attribute overrides another, or when an
+attribute is nullified by a subsequent definition. This function may
+call @code{merge_attributes} to handle machine-independent merging.
+
+@findex TARGET_DLLIMPORT_DECL_ATTRIBUTES
+If the only target-specific handling you require is @samp{dllimport}
+for Microsoft Windows targets, you should define the macro
+@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES} to @code{1}. The compiler
+will then define a function called
+@code{merge_dllimport_decl_attributes} which can then be defined as
+the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. You can also
+add @code{handle_dll_attribute} in the attribute table for your port
+to perform initial processing of the @samp{dllimport} and
+@samp{dllexport} attributes. This is done in @file{i386/cygwin.h} and
+@file{i386/i386.c}, for example.
+@end deftypefn
+
+@hook TARGET_VALID_DLLIMPORT_ATTRIBUTE_P
+
+@defmac TARGET_DECLSPEC
+Define this macro to a nonzero value if you want to treat
+@code{__declspec(X)} as equivalent to @code{__attribute((X))}. By
+default, this behavior is enabled only for targets that define
+@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. The current implementation
+of @code{__declspec} is via a built-in macro, but you should not rely
+on this implementation detail.
+@end defmac
+
+@hook TARGET_INSERT_ATTRIBUTES
+Define this target hook if you want to be able to add attributes to a decl
+when it is being created. This is normally useful for back ends which
+wish to implement a pragma by using the attributes which correspond to
+the pragma's effect. The @var{node} argument is the decl which is being
+created. The @var{attr_ptr} argument is a pointer to the attribute list
+for this decl. The list itself should not be modified, since it may be
+shared with other decls, but attributes may be chained on the head of
+the list and @code{*@var{attr_ptr}} modified to point to the new
+attributes, or a copy of the list may be made if further changes are
+needed.
+@end deftypefn
+
+@hook TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P
+@cindex inlining
+This target hook returns @code{true} if it is ok to inline @var{fndecl}
+into the current function, despite its having target-specific
+attributes, @code{false} otherwise. By default, if a function has a
+target specific attribute attached to it, it will not be inlined.
+@end deftypefn
+
+@hook TARGET_OPTION_VALID_ATTRIBUTE_P
+This hook is called to parse the @code{attribute(option("..."))}, and
+it allows the function to set different target machine compile time
+options for the current function that might be different than the
+options specified on the command line. The hook should return
+@code{true} if the options are valid.
+
+The hook should set the @var{DECL_FUNCTION_SPECIFIC_TARGET} field in
+the function declaration to hold a pointer to a target specific
+@var{struct cl_target_option} structure.
+@end deftypefn
+
+@hook TARGET_OPTION_SAVE
+This hook is called to save any additional target specific information
+in the @var{struct cl_target_option} structure for function specific
+options.
+@xref{Option file format}.
+@end deftypefn
+
+@hook TARGET_OPTION_RESTORE
+This hook is called to restore any additional target specific
+information in the @var{struct cl_target_option} structure for
+function specific options.
+@end deftypefn
+
+@hook TARGET_OPTION_PRINT
+This hook is called to print any additional target specific
+information in the @var{struct cl_target_option} structure for
+function specific options.
+@end deftypefn
+
+@hook TARGET_OPTION_PRAGMA_PARSE
+This target hook parses the options for @code{#pragma GCC option} to
+set the machine specific options for functions that occur later in the
+input stream. The options should be the same as handled by the
+@code{TARGET_OPTION_VALID_ATTRIBUTE_P} hook.
+@end deftypefn
+
+@hook TARGET_OPTION_OVERRIDE
+Sometimes certain combinations of command options do not make sense on
+a particular target machine. You can override the hook
+@code{TARGET_OPTION_OVERRIDE} to take account of this. This hooks is called
+once just after all the command options have been parsed.
+
+Don't use this hook to turn on various extra optimizations for
+@option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
+
+If you need to do something whenever the optimization level is
+changed via the optimize attribute or pragma, see
+@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}
+@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
+default, inlining is not allowed if the callee function has function
+specific target options and the caller does not use the same options.
+@end deftypefn
+
+@node Emulated TLS
+@section Emulating TLS
+@cindex Emulated TLS
+
+For targets whose psABI does not provide Thread Local Storage via
+specific relocations and instruction sequences, an emulation layer is
+used. A set of target hooks allows this emulation layer to be
+configured for the requirements of a particular target. For instance
+the psABI may in fact specify TLS support in terms of an emulation
+layer.
+
+The emulation layer works by creating a control object for every TLS
+object. To access the TLS object, a lookup function is provided
+which, when given the address of the control object, will return the
+address of the current thread's instance of the TLS object.
+
+@hook TARGET_EMUTLS_GET_ADDRESS
+Contains the name of the helper function that uses a TLS control
+object to locate a TLS instance. The default causes libgcc's
+emulated TLS helper function to be used.
+@end deftypevr
+
+@hook TARGET_EMUTLS_REGISTER_COMMON
+Contains the name of the helper function that should be used at
+program startup to register TLS objects that are implicitly
+initialized to zero. If this is @code{NULL}, all TLS objects will
+have explicit initializers. The default causes libgcc's emulated TLS
+registration function to be used.
+@end deftypevr
+
+@hook TARGET_EMUTLS_VAR_SECTION
+Contains the name of the section in which TLS control variables should
+be placed. The default of @code{NULL} allows these to be placed in
+any section.
+@end deftypevr
+
+@hook TARGET_EMUTLS_TMPL_SECTION
+Contains the name of the section in which TLS initializers should be
+placed. The default of @code{NULL} allows these to be placed in any
+section.
+@end deftypevr
+
+@hook TARGET_EMUTLS_VAR_PREFIX
+Contains the prefix to be prepended to TLS control variable names.
+The default of @code{NULL} uses a target-specific prefix.
+@end deftypevr
+
+@hook TARGET_EMUTLS_TMPL_PREFIX
+Contains the prefix to be prepended to TLS initializer objects. The
+default of @code{NULL} uses a target-specific prefix.
+@end deftypevr
+
+@hook TARGET_EMUTLS_VAR_FIELDS
+Specifies a function that generates the FIELD_DECLs for a TLS control
+object type. @var{type} is the RECORD_TYPE the fields are for and
+@var{name} should be filled with the structure tag, if the default of
+@code{__emutls_object} is unsuitable. The default creates a type suitable
+for libgcc's emulated TLS function.
+@end deftypefn
+
+@hook TARGET_EMUTLS_VAR_INIT
+Specifies a function that generates the CONSTRUCTOR to initialize a
+TLS control object. @var{var} is the TLS control object, @var{decl}
+is the TLS object and @var{tmpl_addr} is the address of the
+initializer. The default initializes libgcc's emulated TLS control object.
+@end deftypefn
+
+@hook TARGET_EMUTLS_VAR_ALIGN_FIXED
+Specifies whether the alignment of TLS control variable objects is
+fixed and should not be increased as some backends may do to optimize
+single objects. The default is false.
+@end deftypevr
+
+@hook TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS
+Specifies whether a DWARF @code{DW_OP_form_tls_address} location descriptor
+may be used to describe emulated TLS control objects.
+@end deftypevr
+
+@node MIPS Coprocessors
+@section Defining coprocessor specifics for MIPS targets.
+@cindex MIPS coprocessor-definition macros
+
+The MIPS specification allows MIPS implementations to have as many as 4
+coprocessors, each with as many as 32 private registers. GCC supports
+accessing these registers and transferring values between the registers
+and memory using asm-ized variables. For example:
+
+@smallexample
+ register unsigned int cp0count asm ("c0r1");
+ unsigned int d;
+
+ d = cp0count + 3;
+@end smallexample
+
+(``c0r1'' is the default name of register 1 in coprocessor 0; alternate
+names may be added as described below, or the default names may be
+overridden entirely in @code{SUBTARGET_CONDITIONAL_REGISTER_USAGE}.)
+
+Coprocessor registers are assumed to be epilogue-used; sets to them will
+be preserved even if it does not appear that the register is used again
+later in the function.
+
+Another note: according to the MIPS spec, coprocessor 1 (if present) is
+the FPU@. One accesses COP1 registers through standard mips
+floating-point support; they are not included in this mechanism.
+
+There is one macro used in defining the MIPS coprocessor interface which
+you may want to override in subtargets; it is described below.
+
+@defmac ALL_COP_ADDITIONAL_REGISTER_NAMES
+A comma-separated list (with leading comma) of pairs describing the
+alternate names of coprocessor registers. The format of each entry should be
+@smallexample
+@{ @var{alternatename}, @var{register_number}@}
+@end smallexample
+Default: empty.
+@end defmac
+
+@node PCH Target
+@section Parameters for Precompiled Header Validity Checking
+@cindex parameters, precompiled headers
+
+@hook TARGET_GET_PCH_VALIDITY
+This hook returns a pointer to the data needed by
+@code{TARGET_PCH_VALID_P} and sets
+@samp{*@var{sz}} to the size of the data in bytes.
+@end deftypefn
+
+@hook TARGET_PCH_VALID_P
+This hook checks whether the options used to create a PCH file are
+compatible with the current settings. It returns @code{NULL}
+if so and a suitable error message if not. Error messages will
+be presented to the user and must be localized using @samp{_(@var{msg})}.
+
+@var{data} is the data that was returned by @code{TARGET_GET_PCH_VALIDITY}
+when the PCH file was created and @var{sz} is the size of that data in bytes.
+It's safe to assume that the data was created by the same version of the
+compiler, so no format checking is needed.
+
+The default definition of @code{default_pch_valid_p} should be
+suitable for most targets.
+@end deftypefn
+
+@hook TARGET_CHECK_PCH_TARGET_FLAGS
+If this hook is nonnull, the default implementation of
+@code{TARGET_PCH_VALID_P} will use it to check for compatible values
+of @code{target_flags}. @var{pch_flags} specifies the value that
+@code{target_flags} had when the PCH file was created. The return
+value is the same as for @code{TARGET_PCH_VALID_P}.
+@end deftypefn
+
+@node C++ ABI
+@section C++ ABI parameters
+@cindex parameters, c++ abi
+
+@hook TARGET_CXX_GUARD_TYPE
+Define this hook to override the integer type used for guard variables.
+These are used to implement one-time construction of static objects. The
+default is long_long_integer_type_node.
+@end deftypefn
+
+@hook TARGET_CXX_GUARD_MASK_BIT
+This hook determines how guard variables are used. It should return
+@code{false} (the default) if the first byte should be used. A return value of
+@code{true} indicates that only the least significant bit should be used.
+@end deftypefn
+
+@hook TARGET_CXX_GET_COOKIE_SIZE
+This hook returns the size of the cookie to use when allocating an array
+whose elements have the indicated @var{type}. Assumes that it is already
+known that a cookie is needed. The default is
+@code{max(sizeof (size_t), alignof(type))}, as defined in section 2.7 of the
+IA64/Generic C++ ABI@.
+@end deftypefn
+
+@hook TARGET_CXX_COOKIE_HAS_SIZE
+This hook should return @code{true} if the element size should be stored in
+array cookies. The default is to return @code{false}.
+@end deftypefn
+
+@hook TARGET_CXX_IMPORT_EXPORT_CLASS
+If defined by a backend this hook allows the decision made to export
+class @var{type} to be overruled. Upon entry @var{import_export}
+will contain 1 if the class is going to be exported, @minus{}1 if it is going
+to be imported and 0 otherwise. This function should return the
+modified value and perform any other actions necessary to support the
+backend's targeted operating system.
+@end deftypefn
+
+@hook TARGET_CXX_CDTOR_RETURNS_THIS
+This hook should return @code{true} if constructors and destructors return
+the address of the object created/destroyed. The default is to return
+@code{false}.
+@end deftypefn
+
+@hook TARGET_CXX_KEY_METHOD_MAY_BE_INLINE
+This hook returns true if the key method for a class (i.e., the method
+which, if defined in the current translation unit, causes the virtual
+table to be emitted) may be an inline function. Under the standard
+Itanium C++ ABI the key method may be an inline function so long as
+the function is not declared inline in the class definition. Under
+some variants of the ABI, an inline function can never be the key
+method. The default is to return @code{true}.
+@end deftypefn
+
+@hook TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY
+
+@hook TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT
+This hook returns true (the default) if virtual tables and other
+similar implicit class data objects are always COMDAT if they have
+external linkage. If this hook returns false, then class data for
+classes whose virtual table will be emitted in only one translation
+unit will not be COMDAT.
+@end deftypefn
+
+@hook TARGET_CXX_LIBRARY_RTTI_COMDAT
+This hook returns true (the default) if the RTTI information for
+the basic types which is defined in the C++ runtime should always
+be COMDAT, false if it should not be COMDAT.
+@end deftypefn
+
+@hook TARGET_CXX_USE_AEABI_ATEXIT
+This hook returns true if @code{__aeabi_atexit} (as defined by the ARM EABI)
+should be used to register static destructors when @option{-fuse-cxa-atexit}
+is in effect. The default is to return false to use @code{__cxa_atexit}.
+@end deftypefn
+
+@hook TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT
+This hook returns true if the target @code{atexit} function can be used
+in the same manner as @code{__cxa_atexit} to register C++ static
+destructors. This requires that @code{atexit}-registered functions in
+shared libraries are run in the correct order when the libraries are
+unloaded. The default is to return false.
+@end deftypefn
+
+@hook TARGET_CXX_ADJUST_CLASS_AT_DEFINITION
+
+@node Named Address Spaces
+@section Adding support for named address spaces
+@cindex named address spaces
+
+The draft technical report of the ISO/IEC JTC1 S22 WG14 N1275
+standards committee, @cite{Programming Languages - C - Extensions to
+support embedded processors}, specifies a syntax for embedded
+processors to specify alternate address spaces. You can configure a
+GCC port to support section 5.1 of the draft report to add support for
+address spaces other than the default address space. These address
+spaces are new keywords that are similar to the @code{volatile} and
+@code{const} type attributes.
+
+Pointers to named address spaces can have a different size than
+pointers to the generic address space.
+
+For example, the SPU port uses the @code{__ea} address space to refer
+to memory in the host processor, rather than memory local to the SPU
+processor. Access to memory in the @code{__ea} address space involves
+issuing DMA operations to move data between the host processor and the
+local processor memory address space. Pointers in the @code{__ea}
+address space are either 32 bits or 64 bits based on the
+@option{-mea32} or @option{-mea64} switches (native SPU pointers are
+always 32 bits).
+
+Internally, address spaces are represented as a small integer in the
+range 0 to 15 with address space 0 being reserved for the generic
+address space.
+
+To register a named address space qualifier keyword with the C front end,
+the target may call the @code{c_register_addr_space} routine. For example,
+the SPU port uses the following to declare @code{__ea} as the keyword for
+named address space #1:
+@smallexample
+#define ADDR_SPACE_EA 1
+c_register_addr_space ("__ea", ADDR_SPACE_EA);
+@end smallexample
+
+@hook TARGET_ADDR_SPACE_POINTER_MODE
+Define this to return the machine mode to use for pointers to
+@var{address_space} if the target supports named address spaces.
+The default version of this hook returns @code{ptr_mode} for the
+generic address space only.
+@end deftypefn
+
+@hook TARGET_ADDR_SPACE_ADDRESS_MODE
+Define this to return the machine mode to use for addresses in
+@var{address_space} if the target supports named address spaces.
+The default version of this hook returns @code{Pmode} for the
+generic address space only.
+@end deftypefn
+
+@hook TARGET_ADDR_SPACE_VALID_POINTER_MODE
+Define this to return nonzero if the port can handle pointers
+with machine mode @var{mode} to address space @var{as}. This target
+hook is the same as the @code{TARGET_VALID_POINTER_MODE} target hook,
+except that it includes explicit named address space support. The default
+version of this hook returns true for the modes returned by either the
+@code{TARGET_ADDR_SPACE_POINTER_MODE} or @code{TARGET_ADDR_SPACE_ADDRESS_MODE}
+target hooks for the given address space.
+@end deftypefn
+
+@hook TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
+Define this to return true if @var{exp} is a valid address for mode
+@var{mode} in the named address space @var{as}. The @var{strict}
+parameter says whether strict addressing is in effect after reload has
+finished. This target hook is the same as the
+@code{TARGET_LEGITIMATE_ADDRESS_P} target hook, except that it includes
+explicit named address space support.
+@end deftypefn
+
+@hook TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS
+Define this to modify an invalid address @var{x} to be a valid address
+with mode @var{mode} in the named address space @var{as}. This target
+hook is the same as the @code{TARGET_LEGITIMIZE_ADDRESS} target hook,
+except that it includes explicit named address space support.
+@end deftypefn
+
+@hook TARGET_ADDR_SPACE_SUBSET_P
+Define this to return whether the @var{subset} named address space is
+contained within the @var{superset} named address space. Pointers to
+a named address space that is a subset of another named address space
+will be converted automatically without a cast if used together in
+arithmetic operations. Pointers to a superset address space can be
+converted to pointers to a subset address space via explicit casts.
+@end deftypefn
+
+@hook TARGET_ADDR_SPACE_CONVERT
+Define this to convert the pointer expression represented by the RTL
+@var{op} with type @var{from_type} that points to a named address
+space to a new pointer expression with type @var{to_type} that points
+to a different named address space. When this hook it called, it is
+guaranteed that one of the two address spaces is a subset of the other,
+as determined by the @code{TARGET_ADDR_SPACE_SUBSET_P} target hook.
+@end deftypefn
+
+@node Misc
+@section Miscellaneous Parameters
+@cindex parameters, miscellaneous
+
+@c prevent bad page break with this line
+Here are several miscellaneous parameters.
+
+@defmac HAS_LONG_COND_BRANCH
+Define this boolean macro to indicate whether or not your architecture
+has conditional branches that can span all of memory. It is used in
+conjunction with an optimization that partitions hot and cold basic
+blocks into separate sections of the executable. If this macro is
+set to false, gcc will convert any conditional branches that attempt
+to cross between sections into unconditional branches or indirect jumps.
+@end defmac
+
+@defmac HAS_LONG_UNCOND_BRANCH
+Define this boolean macro to indicate whether or not your architecture
+has unconditional branches that can span all of memory. It is used in
+conjunction with an optimization that partitions hot and cold basic
+blocks into separate sections of the executable. If this macro is
+set to false, gcc will convert any unconditional branches that attempt
+to cross between sections into indirect jumps.
+@end defmac
+
+@defmac CASE_VECTOR_MODE
+An alias for a machine mode name. This is the machine mode that
+elements of a jump-table should have.
+@end defmac
+
+@defmac CASE_VECTOR_SHORTEN_MODE (@var{min_offset}, @var{max_offset}, @var{body})
+Optional: return the preferred mode for an @code{addr_diff_vec}
+when the minimum and maximum offset are known. If you define this,
+it enables extra code in branch shortening to deal with @code{addr_diff_vec}.
+To make this work, you also have to define @code{INSN_ALIGN} and
+make the alignment for @code{addr_diff_vec} explicit.
+The @var{body} argument is provided so that the offset_unsigned and scale
+flags can be updated.
+@end defmac
+
+@defmac CASE_VECTOR_PC_RELATIVE
+Define this macro to be a C expression to indicate when jump-tables
+should contain relative addresses. You need not define this macro if
+jump-tables never contain relative addresses, or jump-tables should
+contain relative addresses only when @option{-fPIC} or @option{-fPIC}
+is in effect.
+@end defmac
+
+@hook TARGET_CASE_VALUES_THRESHOLD
+This function return the smallest number of different values for which it
+is best to use a jump-table instead of a tree of conditional branches.
+The default is four for machines with a @code{casesi} instruction and
+five otherwise. This is best for most machines.
+@end deftypefn
+
+@defmac CASE_USE_BIT_TESTS
+Define this macro to be a C expression to indicate whether C switch
+statements may be implemented by a sequence of bit tests. This is
+advantageous on processors that can efficiently implement left shift
+of 1 by the number of bits held in a register, but inappropriate on
+targets that would require a loop. By default, this macro returns
+@code{true} if the target defines an @code{ashlsi3} pattern, and
+@code{false} otherwise.
+@end defmac
+
+@defmac WORD_REGISTER_OPERATIONS
+Define this macro if operations between registers with integral mode
+smaller than a word are always performed on the entire register.
+Most RISC machines have this property and most CISC machines do not.
+@end defmac
+
+@defmac LOAD_EXTEND_OP (@var{mem_mode})
+Define this macro to be a C expression indicating when insns that read
+memory in @var{mem_mode}, an integral mode narrower than a word, set the
+bits outside of @var{mem_mode} to be either the sign-extension or the
+zero-extension of the data read. Return @code{SIGN_EXTEND} for values
+of @var{mem_mode} for which the
+insn sign-extends, @code{ZERO_EXTEND} for which it zero-extends, and
+@code{UNKNOWN} for other modes.
+
+This macro is not called with @var{mem_mode} non-integral or with a width
+greater than or equal to @code{BITS_PER_WORD}, so you may return any
+value in this case. Do not define this macro if it would always return
+@code{UNKNOWN}. On machines where this macro is defined, you will normally
+define it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}.
+
+You may return a non-@code{UNKNOWN} value even if for some hard registers
+the sign extension is not performed, if for the @code{REGNO_REG_CLASS}
+of these hard registers @code{CANNOT_CHANGE_MODE_CLASS} returns nonzero
+when the @var{from} mode is @var{mem_mode} and the @var{to} mode is any
+integral mode larger than this but not larger than @code{word_mode}.
+
+You must return @code{UNKNOWN} if for some hard registers that allow this
+mode, @code{CANNOT_CHANGE_MODE_CLASS} says that they cannot change to
+@code{word_mode}, but that they can change to another integral mode that
+is larger then @var{mem_mode} but still smaller than @code{word_mode}.
+@end defmac
+
+@defmac SHORT_IMMEDIATES_SIGN_EXTEND
+Define this macro if loading short immediate values into registers sign
+extends.
+@end defmac
+
+@defmac FIXUNS_TRUNC_LIKE_FIX_TRUNC
+Define this macro if the same instructions that convert a floating
+point number to a signed fixed point number also convert validly to an
+unsigned one.
+@end defmac
+
+@hook TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
+When @option{-ffast-math} is in effect, GCC tries to optimize
+divisions by the same divisor, by turning them into multiplications by
+the reciprocal. This target hook specifies the minimum number of divisions
+that should be there for GCC to perform the optimization for a variable
+of mode @var{mode}. The default implementation returns 3 if the machine
+has an instruction for the division, and 2 if it does not.
+@end deftypefn
+
+@defmac MOVE_MAX
+The maximum number of bytes that a single instruction can move quickly
+between memory and registers or between two memory locations.
+@end defmac
+
+@defmac MAX_MOVE_MAX
+The maximum number of bytes that a single instruction can move quickly
+between memory and registers or between two memory locations. If this
+is undefined, the default is @code{MOVE_MAX}. Otherwise, it is the
+constant value that is the largest value that @code{MOVE_MAX} can have
+at run-time.
+@end defmac
+
+@defmac SHIFT_COUNT_TRUNCATED
+A C expression that is nonzero if on this machine the number of bits
+actually used for the count of a shift operation is equal to the number
+of bits needed to represent the size of the object being shifted. When
+this macro is nonzero, the compiler will assume that it is safe to omit
+a sign-extend, zero-extend, and certain bitwise `and' instructions that
+truncates the count of a shift operation. On machines that have
+instructions that act on bit-fields at variable positions, which may
+include `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED}
+also enables deletion of truncations of the values that serve as
+arguments to bit-field instructions.
+
+If both types of instructions truncate the count (for shifts) and
+position (for bit-field operations), or if no variable-position bit-field
+instructions exist, you should define this macro.
+
+However, on some machines, such as the 80386 and the 680x0, truncation
+only applies to shift operations and not the (real or pretended)
+bit-field operations. Define @code{SHIFT_COUNT_TRUNCATED} to be zero on
+such machines. Instead, add patterns to the @file{md} file that include
+the implied truncation of the shift instructions.
+
+You need not define this macro if it would always have the value of zero.
+@end defmac
+
+@anchor{TARGET_SHIFT_TRUNCATION_MASK}
+@hook TARGET_SHIFT_TRUNCATION_MASK
+This function describes how the standard shift patterns for @var{mode}
+deal with shifts by negative amounts or by more than the width of the mode.
+@xref{shift patterns}.
+
+On many machines, the shift patterns will apply a mask @var{m} to the
+shift count, meaning that a fixed-width shift of @var{x} by @var{y} is
+equivalent to an arbitrary-width shift of @var{x} by @var{y & m}. If
+this is true for mode @var{mode}, the function should return @var{m},
+otherwise it should return 0. A return value of 0 indicates that no
+particular behavior is guaranteed.
+
+Note that, unlike @code{SHIFT_COUNT_TRUNCATED}, this function does
+@emph{not} apply to general shift rtxes; it applies only to instructions
+that are generated by the named shift patterns.
+
+The default implementation of this function returns
+@code{GET_MODE_BITSIZE (@var{mode}) - 1} if @code{SHIFT_COUNT_TRUNCATED}
+and 0 otherwise. This definition is always safe, but if
+@code{SHIFT_COUNT_TRUNCATED} is false, and some shift patterns
+nevertheless truncate the shift count, you may get better code
+by overriding it.
+@end deftypefn
+
+@defmac TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
+A C expression which is nonzero if on this machine it is safe to
+``convert'' an integer of @var{inprec} bits to one of @var{outprec}
+bits (where @var{outprec} is smaller than @var{inprec}) by merely
+operating on it as if it had only @var{outprec} bits.
+
+On many machines, this expression can be 1.
+
+@c rearranged this, removed the phrase "it is reported that". this was
+@c to fix an overfull hbox. --mew 10feb93
+When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for
+modes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result.
+If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
+such cases may improve things.
+@end defmac
+
+@hook TARGET_MODE_REP_EXTENDED
+The representation of an integral mode can be such that the values
+are always extended to a wider integral mode. Return
+@code{SIGN_EXTEND} if values of @var{mode} are represented in
+sign-extended form to @var{rep_mode}. Return @code{UNKNOWN}
+otherwise. (Currently, none of the targets use zero-extended
+representation this way so unlike @code{LOAD_EXTEND_OP},
+@code{TARGET_MODE_REP_EXTENDED} is expected to return either
+@code{SIGN_EXTEND} or @code{UNKNOWN}. Also no target extends
+@var{mode} to @var{rep_mode} so that @var{rep_mode} is not the next
+widest integral mode and currently we take advantage of this fact.)
+
+Similarly to @code{LOAD_EXTEND_OP} you may return a non-@code{UNKNOWN}
+value even if the extension is not performed on certain hard registers
+as long as for the @code{REGNO_REG_CLASS} of these hard registers
+@code{CANNOT_CHANGE_MODE_CLASS} returns nonzero.
+
+Note that @code{TARGET_MODE_REP_EXTENDED} and @code{LOAD_EXTEND_OP}
+describe two related properties. If you define
+@code{TARGET_MODE_REP_EXTENDED (mode, word_mode)} you probably also want
+to define @code{LOAD_EXTEND_OP (mode)} to return the same type of
+extension.
+
+In order to enforce the representation of @code{mode},
+@code{TRULY_NOOP_TRUNCATION} should return false when truncating to
+@code{mode}.
+@end deftypefn
+
+@defmac STORE_FLAG_VALUE
+A C expression describing the value returned by a comparison operator
+with an integral mode and stored by a store-flag instruction
+(@samp{cstore@var{mode}4}) when the condition is true. This description must
+apply to @emph{all} the @samp{cstore@var{mode}4} patterns and all the
+comparison operators whose results have a @code{MODE_INT} mode.
+
+A value of 1 or @minus{}1 means that the instruction implementing the
+comparison operator returns exactly 1 or @minus{}1 when the comparison is true
+and 0 when the comparison is false. Otherwise, the value indicates
+which bits of the result are guaranteed to be 1 when the comparison is
+true. This value is interpreted in the mode of the comparison
+operation, which is given by the mode of the first operand in the
+@samp{cstore@var{mode}4} pattern. Either the low bit or the sign bit of
+@code{STORE_FLAG_VALUE} be on. Presently, only those bits are used by
+the compiler.
+
+If @code{STORE_FLAG_VALUE} is neither 1 or @minus{}1, the compiler will
+generate code that depends only on the specified bits. It can also
+replace comparison operators with equivalent operations if they cause
+the required bits to be set, even if the remaining bits are undefined.
+For example, on a machine whose comparison operators return an
+@code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as
+@samp{0x80000000}, saying that just the sign bit is relevant, the
+expression
+
+@smallexample
+(ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0))
+@end smallexample
+
+@noindent
+can be converted to
+
+@smallexample
+(ashift:SI @var{x} (const_int @var{n}))
+@end smallexample
+
+@noindent
+where @var{n} is the appropriate shift count to move the bit being
+tested into the sign bit.
+
+There is no way to describe a machine that always sets the low-order bit
+for a true value, but does not guarantee the value of any other bits,
+but we do not know of any machine that has such an instruction. If you
+are trying to port GCC to such a machine, include an instruction to
+perform a logical-and of the result with 1 in the pattern for the
+comparison operators and let us know at @email{gcc@@gcc.gnu.org}.
+
+Often, a machine will have multiple instructions that obtain a value
+from a comparison (or the condition codes). Here are rules to guide the
+choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions
+to be used:
+
+@itemize @bullet
+@item
+Use the shortest sequence that yields a valid definition for
+@code{STORE_FLAG_VALUE}. It is more efficient for the compiler to
+``normalize'' the value (convert it to, e.g., 1 or 0) than for the
+comparison operators to do so because there may be opportunities to
+combine the normalization with other operations.
+
+@item
+For equal-length sequences, use a value of 1 or @minus{}1, with @minus{}1 being
+slightly preferred on machines with expensive jumps and 1 preferred on
+other machines.
+
+@item
+As a second choice, choose a value of @samp{0x80000001} if instructions
+exist that set both the sign and low-order bits but do not define the
+others.
+
+@item
+Otherwise, use a value of @samp{0x80000000}.
+@end itemize
+
+Many machines can produce both the value chosen for
+@code{STORE_FLAG_VALUE} and its negation in the same number of
+instructions. On those machines, you should also define a pattern for
+those cases, e.g., one matching
+
+@smallexample
+(set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C})))
+@end smallexample
+
+Some machines can also perform @code{and} or @code{plus} operations on
+condition code values with less instructions than the corresponding
+@samp{cstore@var{mode}4} insn followed by @code{and} or @code{plus}. On those
+machines, define the appropriate patterns. Use the names @code{incscc}
+and @code{decscc}, respectively, for the patterns which perform
+@code{plus} or @code{minus} operations on condition code values. See
+@file{rs6000.md} for some examples. The GNU Superoptizer can be used to
+find such instruction sequences on other machines.
+
+If this macro is not defined, the default value, 1, is used. You need
+not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
+instructions, or if the value generated by these instructions is 1.
+@end defmac
+
+@defmac FLOAT_STORE_FLAG_VALUE (@var{mode})
+A C expression that gives a nonzero @code{REAL_VALUE_TYPE} value that is
+returned when comparison operators with floating-point results are true.
+Define this macro on machines that have comparison operations that return
+floating-point values. If there are no such operations, do not define
+this macro.
+@end defmac
+
+@defmac VECTOR_STORE_FLAG_VALUE (@var{mode})
+A C expression that gives a rtx representing the nonzero true element
+for vector comparisons. The returned rtx should be valid for the inner
+mode of @var{mode} which is guaranteed to be a vector mode. Define
+this macro on machines that have vector comparison operations that
+return a vector result. If there are no such operations, do not define
+this macro. Typically, this macro is defined as @code{const1_rtx} or
+@code{constm1_rtx}. This macro may return @code{NULL_RTX} to prevent
+the compiler optimizing such vector comparison operations for the
+given mode.
+@end defmac
+
+@defmac CLZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
+@defmacx CTZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
+A C expression that indicates whether the architecture defines a value
+for @code{clz} or @code{ctz} with a zero operand.
+A result of @code{0} indicates the value is undefined.
+If the value is defined for only the RTL expression, the macro should
+evaluate to @code{1}; if the value applies also to the corresponding optab
+entry (which is normally the case if it expands directly into
+the corresponding RTL), then the macro should evaluate to @code{2}.
+In the cases where the value is defined, @var{value} should be set to
+this value.
+
+If this macro is not defined, the value of @code{clz} or
+@code{ctz} at zero is assumed to be undefined.
+
+This macro must be defined if the target's expansion for @code{ffs}
+relies on a particular value to get correct results. Otherwise it
+is not necessary, though it may be used to optimize some corner cases, and
+to provide a default expansion for the @code{ffs} optab.
+
+Note that regardless of this macro the ``definedness'' of @code{clz}
+and @code{ctz} at zero do @emph{not} extend to the builtin functions
+visible to the user. Thus one may be free to adjust the value at will
+to match the target expansion of these operations without fear of
+breaking the API@.
+@end defmac
+
+@defmac Pmode
+An alias for the machine mode for pointers. On most machines, define
+this to be the integer mode corresponding to the width of a hardware
+pointer; @code{SImode} on 32-bit machine or @code{DImode} on 64-bit machines.
+On some machines you must define this to be one of the partial integer
+modes, such as @code{PSImode}.
+
+The width of @code{Pmode} must be at least as large as the value of
+@code{POINTER_SIZE}. If it is not equal, you must define the macro
+@code{POINTERS_EXTEND_UNSIGNED} to specify how pointers are extended
+to @code{Pmode}.
+@end defmac
+
+@defmac FUNCTION_MODE
+An alias for the machine mode used for memory references to functions
+being called, in @code{call} RTL expressions. On most CISC machines,
+where an instruction can begin at any byte address, this should be
+@code{QImode}. On most RISC machines, where all instructions have fixed
+size and alignment, this should be a mode with the same size and alignment
+as the machine instruction words - typically @code{SImode} or @code{HImode}.
+@end defmac
+
+@defmac STDC_0_IN_SYSTEM_HEADERS
+In normal operation, the preprocessor expands @code{__STDC__} to the
+constant 1, to signify that GCC conforms to ISO Standard C@. On some
+hosts, like Solaris, the system compiler uses a different convention,
+where @code{__STDC__} is normally 0, but is 1 if the user specifies
+strict conformance to the C Standard.
+
+Defining @code{STDC_0_IN_SYSTEM_HEADERS} makes GNU CPP follows the host
+convention when processing system header files, but when processing user
+files @code{__STDC__} will always expand to 1.
+@end defmac
+
+@defmac NO_IMPLICIT_EXTERN_C
+Define this macro if the system header files support C++ as well as C@.
+This macro inhibits the usual method of using system header files in
+C++, which is to pretend that the file's contents are enclosed in
+@samp{extern "C" @{@dots{}@}}.
+@end defmac
+
+@findex #pragma
+@findex pragma
+@defmac REGISTER_TARGET_PRAGMAS ()
+Define this macro if you want to implement any target-specific pragmas.
+If defined, it is a C expression which makes a series of calls to
+@code{c_register_pragma} or @code{c_register_pragma_with_expansion}
+for each pragma. The macro may also do any
+setup required for the pragmas.
+
+The primary reason to define this macro is to provide compatibility with
+other compilers for the same target. In general, we discourage
+definition of target-specific pragmas for GCC@.
+
+If the pragma can be implemented by attributes then you should consider
+defining the target hook @samp{TARGET_INSERT_ATTRIBUTES} as well.
+
+Preprocessor macros that appear on pragma lines are not expanded. All
+@samp{#pragma} directives that do not match any registered pragma are
+silently ignored, unless the user specifies @option{-Wunknown-pragmas}.
+@end defmac
+
+@deftypefun void c_register_pragma (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *))
+@deftypefunx void c_register_pragma_with_expansion (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *))
+
+Each call to @code{c_register_pragma} or
+@code{c_register_pragma_with_expansion} establishes one pragma. The
+@var{callback} routine will be called when the preprocessor encounters a
+pragma of the form
+
+@smallexample
+#pragma [@var{space}] @var{name} @dots{}
+@end smallexample
+
+@var{space} is the case-sensitive namespace of the pragma, or
+@code{NULL} to put the pragma in the global namespace. The callback
+routine receives @var{pfile} as its first argument, which can be passed
+on to cpplib's functions if necessary. You can lex tokens after the
+@var{name} by calling @code{pragma_lex}. Tokens that are not read by the
+callback will be silently ignored. The end of the line is indicated by
+a token of type @code{CPP_EOF}. Macro expansion occurs on the
+arguments of pragmas registered with
+@code{c_register_pragma_with_expansion} but not on the arguments of
+pragmas registered with @code{c_register_pragma}.
+
+Note that the use of @code{pragma_lex} is specific to the C and C++
+compilers. It will not work in the Java or Fortran compilers, or any
+other language compilers for that matter. Thus if @code{pragma_lex} is going
+to be called from target-specific code, it must only be done so when
+building the C and C++ compilers. This can be done by defining the
+variables @code{c_target_objs} and @code{cxx_target_objs} in the
+target entry in the @file{config.gcc} file. These variables should name
+the target-specific, language-specific object file which contains the
+code that uses @code{pragma_lex}. Note it will also be necessary to add a
+rule to the makefile fragment pointed to by @code{tmake_file} that shows
+how to build this object file.
+@end deftypefun
+
+@findex #pragma
+@findex pragma
+@defmac HANDLE_SYSV_PRAGMA
+Define this macro (to a value of 1) if you want the System V style
+pragmas @samp{#pragma pack(<n>)} and @samp{#pragma weak <name>
+[=<value>]} to be supported by gcc.
+
+The pack pragma specifies the maximum alignment (in bytes) of fields
+within a structure, in much the same way as the @samp{__aligned__} and
+@samp{__packed__} @code{__attribute__}s do. A pack value of zero resets
+the behavior to the default.
+
+A subtlety for Microsoft Visual C/C++ style bit-field packing
+(e.g.@: -mms-bitfields) for targets that support it:
+When a bit-field is inserted into a packed record, the whole size
+of the underlying type is used by one or more same-size adjacent
+bit-fields (that is, if its long:3, 32 bits is used in the record,
+and any additional adjacent long bit-fields are packed into the same
+chunk of 32 bits. However, if the size changes, a new field of that
+size is allocated).
+
+If both MS bit-fields and @samp{__attribute__((packed))} are used,
+the latter will take precedence. If @samp{__attribute__((packed))} is
+used on a single field when MS bit-fields are in use, it will take
+precedence for that field, but the alignment of the rest of the structure
+may affect its placement.
+
+The weak pragma only works if @code{SUPPORTS_WEAK} and
+@code{ASM_WEAKEN_LABEL} are defined. If enabled it allows the creation
+of specifically named weak labels, optionally with a value.
+@end defmac
+
+@findex #pragma
+@findex pragma
+@defmac HANDLE_PRAGMA_PACK_PUSH_POP
+Define this macro (to a value of 1) if you want to support the Win32
+style pragmas @samp{#pragma pack(push[,@var{n}])} and @samp{#pragma
+pack(pop)}. The @samp{pack(push,[@var{n}])} pragma specifies the maximum
+alignment (in bytes) of fields within a structure, in much the same way as
+the @samp{__aligned__} and @samp{__packed__} @code{__attribute__}s do. A
+pack value of zero resets the behavior to the default. Successive
+invocations of this pragma cause the previous values to be stacked, so
+that invocations of @samp{#pragma pack(pop)} will return to the previous
+value.
+@end defmac
+
+@defmac HANDLE_PRAGMA_PACK_WITH_EXPANSION
+Define this macro, as well as
+@code{HANDLE_SYSV_PRAGMA}, if macros should be expanded in the
+arguments of @samp{#pragma pack}.
+@end defmac
+
+@hook TARGET_HANDLE_PRAGMA_EXTERN_PREFIX
+
+@defmac TARGET_DEFAULT_PACK_STRUCT
+If your target requires a structure packing default other than 0 (meaning
+the machine default), define this macro to the necessary value (in bytes).
+This must be a value that would also be valid to use with
+@samp{#pragma pack()} (that is, a small power of two).
+@end defmac
+
+@defmac DOLLARS_IN_IDENTIFIERS
+Define this macro to control use of the character @samp{$} in
+identifier names for the C family of languages. 0 means @samp{$} is
+not allowed by default; 1 means it is allowed. 1 is the default;
+there is no need to define this macro in that case.
+@end defmac
+
+@defmac NO_DOLLAR_IN_LABEL
+Define this macro if the assembler does not accept the character
+@samp{$} in label names. By default constructors and destructors in
+G++ have @samp{$} in the identifiers. If this macro is defined,
+@samp{.} is used instead.
+@end defmac
+
+@defmac NO_DOT_IN_LABEL
+Define this macro if the assembler does not accept the character
+@samp{.} in label names. By default constructors and destructors in G++
+have names that use @samp{.}. If this macro is defined, these names
+are rewritten to avoid @samp{.}.
+@end defmac
+
+@defmac INSN_SETS_ARE_DELAYED (@var{insn})
+Define this macro as a C expression that is nonzero if it is safe for the
+delay slot scheduler to place instructions in the delay slot of @var{insn},
+even if they appear to use a resource set or clobbered in @var{insn}.
+@var{insn} is always a @code{jump_insn} or an @code{insn}; GCC knows that
+every @code{call_insn} has this behavior. On machines where some @code{insn}
+or @code{jump_insn} is really a function call and hence has this behavior,
+you should define this macro.
+
+You need not define this macro if it would always return zero.
+@end defmac
+
+@defmac INSN_REFERENCES_ARE_DELAYED (@var{insn})
+Define this macro as a C expression that is nonzero if it is safe for the
+delay slot scheduler to place instructions in the delay slot of @var{insn},
+even if they appear to set or clobber a resource referenced in @var{insn}.
+@var{insn} is always a @code{jump_insn} or an @code{insn}. On machines where
+some @code{insn} or @code{jump_insn} is really a function call and its operands
+are registers whose use is actually in the subroutine it calls, you should
+define this macro. Doing so allows the delay slot scheduler to move
+instructions which copy arguments into the argument registers into the delay
+slot of @var{insn}.
+
+You need not define this macro if it would always return zero.
+@end defmac
+
+@defmac MULTIPLE_SYMBOL_SPACES
+Define this macro as a C expression that is nonzero if, in some cases,
+global symbols from one translation unit may not be bound to undefined
+symbols in another translation unit without user intervention. For
+instance, under Microsoft Windows symbols must be explicitly imported
+from shared libraries (DLLs).
+
+You need not define this macro if it would always evaluate to zero.
+@end defmac
+
+@hook TARGET_MD_ASM_CLOBBERS
+This target hook should add to @var{clobbers} @code{STRING_CST} trees for
+any hard regs the port wishes to automatically clobber for an asm.
+It should return the result of the last @code{tree_cons} used to add a
+clobber. The @var{outputs}, @var{inputs} and @var{clobber} lists are the
+corresponding parameters to the asm and may be inspected to avoid
+clobbering a register that is an input or output of the asm. You can use
+@code{tree_overlaps_hard_reg_set}, declared in @file{tree.h}, to test
+for overlap with regards to asm-declared registers.
+@end deftypefn
+
+@defmac MATH_LIBRARY
+Define this macro as a C string constant for the linker argument to link
+in the system math library, or @samp{""} if the target does not have a
+separate math library.
+
+You need only define this macro if the default of @samp{"-lm"} is wrong.
+@end defmac
+
+@defmac LIBRARY_PATH_ENV
+Define this macro as a C string constant for the environment variable that
+specifies where the linker should look for libraries.
+
+You need only define this macro if the default of @samp{"LIBRARY_PATH"}
+is wrong.
+@end defmac
+
+@defmac TARGET_POSIX_IO
+Define this macro if the target supports the following POSIX@ file
+functions, access, mkdir and file locking with fcntl / F_SETLKW@.
+Defining @code{TARGET_POSIX_IO} will enable the test coverage code
+to use file locking when exiting a program, which avoids race conditions
+if the program has forked. It will also create directories at run-time
+for cross-profiling.
+@end defmac
+
+@defmac MAX_CONDITIONAL_EXECUTE
+
+A C expression for the maximum number of instructions to execute via
+conditional execution instructions instead of a branch. A value of
+@code{BRANCH_COST}+1 is the default if the machine does not use cc0, and
+1 if it does use cc0.
+@end defmac
+
+@defmac IFCVT_MODIFY_TESTS (@var{ce_info}, @var{true_expr}, @var{false_expr})
+Used if the target needs to perform machine-dependent modifications on the
+conditionals used for turning basic blocks into conditionally executed code.
+@var{ce_info} points to a data structure, @code{struct ce_if_block}, which
+contains information about the currently processed blocks. @var{true_expr}
+and @var{false_expr} are the tests that are used for converting the
+then-block and the else-block, respectively. Set either @var{true_expr} or
+@var{false_expr} to a null pointer if the tests cannot be converted.
+@end defmac
+
+@defmac IFCVT_MODIFY_MULTIPLE_TESTS (@var{ce_info}, @var{bb}, @var{true_expr}, @var{false_expr})
+Like @code{IFCVT_MODIFY_TESTS}, but used when converting more complicated
+if-statements into conditions combined by @code{and} and @code{or} operations.
+@var{bb} contains the basic block that contains the test that is currently
+being processed and about to be turned into a condition.
+@end defmac
+
+@defmac IFCVT_MODIFY_INSN (@var{ce_info}, @var{pattern}, @var{insn})
+A C expression to modify the @var{PATTERN} of an @var{INSN} that is to
+be converted to conditional execution format. @var{ce_info} points to
+a data structure, @code{struct ce_if_block}, which contains information
+about the currently processed blocks.
+@end defmac
+
+@defmac IFCVT_MODIFY_FINAL (@var{ce_info})
+A C expression to perform any final machine dependent modifications in
+converting code to conditional execution. The involved basic blocks
+can be found in the @code{struct ce_if_block} structure that is pointed
+to by @var{ce_info}.
+@end defmac
+
+@defmac IFCVT_MODIFY_CANCEL (@var{ce_info})
+A C expression to cancel any machine dependent modifications in
+converting code to conditional execution. The involved basic blocks
+can be found in the @code{struct ce_if_block} structure that is pointed
+to by @var{ce_info}.
+@end defmac
+
+@defmac IFCVT_INIT_EXTRA_FIELDS (@var{ce_info})
+A C expression to initialize any extra fields in a @code{struct ce_if_block}
+structure, which are defined by the @code{IFCVT_EXTRA_FIELDS} macro.
+@end defmac
+
+@defmac IFCVT_EXTRA_FIELDS
+If defined, it should expand to a set of field declarations that will be
+added to the @code{struct ce_if_block} structure. These should be initialized
+by the @code{IFCVT_INIT_EXTRA_FIELDS} macro.
+@end defmac
+
+@hook TARGET_MACHINE_DEPENDENT_REORG
+If non-null, this hook performs a target-specific pass over the
+instruction stream. The compiler will run it at all optimization levels,
+just before the point at which it normally does delayed-branch scheduling.
+
+The exact purpose of the hook varies from target to target. Some use
+it to do transformations that are necessary for correctness, such as
+laying out in-function constant pools or avoiding hardware hazards.
+Others use it as an opportunity to do some machine-dependent optimizations.
+
+You need not implement the hook if it has nothing to do. The default
+definition is null.
+@end deftypefn
+
+@hook TARGET_INIT_BUILTINS
+Define this hook if you have any machine-specific built-in functions
+that need to be defined. It should be a function that performs the
+necessary setup.
+
+Machine specific built-in functions can be useful to expand special machine
+instructions that would otherwise not normally be generated because
+they have no equivalent in the source language (for example, SIMD vector
+instructions or prefetch instructions).
+
+To create a built-in function, call the function
+@code{lang_hooks.builtin_function}
+which is defined by the language front end. You can use any type nodes set
+up by @code{build_common_tree_nodes} and @code{build_common_tree_nodes_2};
+only language front ends that use those two functions will call
+@samp{TARGET_INIT_BUILTINS}.
+@end deftypefn
+
+@hook TARGET_BUILTIN_DECL
+Define this hook if you have any machine-specific built-in functions
+that need to be defined. It should be a function that returns the
+builtin function declaration for the builtin function code @var{code}.
+If there is no such builtin and it cannot be initialized at this time
+if @var{initialize_p} is true the function should return @code{NULL_TREE}.
+If @var{code} is out of range the function should return
+@code{error_mark_node}.
+@end deftypefn
+
+@hook TARGET_EXPAND_BUILTIN
+
+Expand a call to a machine specific built-in function that was set up by
+@samp{TARGET_INIT_BUILTINS}. @var{exp} is the expression for the
+function call; the result should go to @var{target} if that is
+convenient, and have mode @var{mode} if that is convenient.
+@var{subtarget} may be used as the target for computing one of
+@var{exp}'s operands. @var{ignore} is nonzero if the value is to be
+ignored. This function should return the result of the call to the
+built-in function.
+@end deftypefn
+
+@hook TARGET_RESOLVE_OVERLOADED_BUILTIN
+Select a replacement for a machine specific built-in function that
+was set up by @samp{TARGET_INIT_BUILTINS}. This is done
+@emph{before} regular type checking, and so allows the target to
+implement a crude form of function overloading. @var{fndecl} is the
+declaration of the built-in function. @var{arglist} is the list of
+arguments passed to the built-in function. The result is a
+complete expression that implements the operation, usually
+another @code{CALL_EXPR}.
+@var{arglist} really has type @samp{VEC(tree,gc)*}
+@end deftypefn
+
+@hook TARGET_FOLD_BUILTIN
+Fold a call to a machine specific built-in function that was set up by
+@samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the
+built-in function. @var{n_args} is the number of arguments passed to
+the function; the arguments themselves are pointed to by @var{argp}.
+The result is another tree containing a simplified expression for the
+call's result. If @var{ignore} is true the value will be ignored.
+@end deftypefn
+
+@hook TARGET_INVALID_WITHIN_DOLOOP
+
+Take an instruction in @var{insn} and return NULL if it is valid within a
+low-overhead loop, otherwise return a string explaining why doloop
+could not be applied.
+
+Many targets use special registers for low-overhead looping. For any
+instruction that clobbers these this function should return a string indicating
+the reason why the doloop could not be applied.
+By default, the RTL loop optimizer does not use a present doloop pattern for
+loops containing function calls or branch on table instructions.
+@end deftypefn
+
+@defmac MD_CAN_REDIRECT_BRANCH (@var{branch1}, @var{branch2})
+
+Take a branch insn in @var{branch1} and another in @var{branch2}.
+Return true if redirecting @var{branch1} to the destination of
+@var{branch2} is possible.
+
+On some targets, branches may have a limited range. Optimizing the
+filling of delay slots can result in branches being redirected, and this
+may in turn cause a branch offset to overflow.
+@end defmac
+
+@hook TARGET_COMMUTATIVE_P
+This target hook returns @code{true} if @var{x} is considered to be commutative.
+Usually, this is just COMMUTATIVE_P (@var{x}), but the HP PA doesn't consider
+PLUS to be commutative inside a MEM@. @var{outer_code} is the rtx code
+of the enclosing rtl, if known, otherwise it is UNKNOWN.
+@end deftypefn
+
+@hook TARGET_ALLOCATE_INITIAL_VALUE
+
+When the initial value of a hard register has been copied in a pseudo
+register, it is often not necessary to actually allocate another register
+to this pseudo register, because the original hard register or a stack slot
+it has been saved into can be used. @code{TARGET_ALLOCATE_INITIAL_VALUE}
+is called at the start of register allocation once for each hard register
+that had its initial value copied by using
+@code{get_func_hard_reg_initial_val} or @code{get_hard_reg_initial_val}.
+Possible values are @code{NULL_RTX}, if you don't want
+to do any special allocation, a @code{REG} rtx---that would typically be
+the hard register itself, if it is known not to be clobbered---or a
+@code{MEM}.
+If you are returning a @code{MEM}, this is only a hint for the allocator;
+it might decide to use another register anyways.
+You may use @code{current_function_leaf_function} in the hook, functions
+that use @code{REG_N_SETS}, to determine if the hard
+register in question will not be clobbered.
+The default value of this hook is @code{NULL}, which disables any special
+allocation.
+@end deftypefn
+
+@hook TARGET_UNSPEC_MAY_TRAP_P
+This target hook returns nonzero if @var{x}, an @code{unspec} or
+@code{unspec_volatile} operation, might cause a trap. Targets can use
+this hook to enhance precision of analysis for @code{unspec} and
+@code{unspec_volatile} operations. You may call @code{may_trap_p_1}
+to analyze inner elements of @var{x} in which case @var{flags} should be
+passed along.
+@end deftypefn
+
+@hook TARGET_SET_CURRENT_FUNCTION
+The compiler invokes this hook whenever it changes its current function
+context (@code{cfun}). You can define this function if
+the back end needs to perform any initialization or reset actions on a
+per-function basis. For example, it may be used to implement function
+attributes that affect register usage or code generation patterns.
+The argument @var{decl} is the declaration for the new function context,
+and may be null to indicate that the compiler has left a function context
+and is returning to processing at the top level.
+The default hook function does nothing.
+
+GCC sets @code{cfun} to a dummy function context during initialization of
+some parts of the back end. The hook function is not invoked in this
+situation; you need not worry about the hook being invoked recursively,
+or when the back end is in a partially-initialized state.
+@code{cfun} might be @code{NULL} to indicate processing at top level,
+outside of any function scope.
+@end deftypefn
+
+@defmac TARGET_OBJECT_SUFFIX
+Define this macro to be a C string representing the suffix for object
+files on your target machine. If you do not define this macro, GCC will
+use @samp{.o} as the suffix for object files.
+@end defmac
+
+@defmac TARGET_EXECUTABLE_SUFFIX
+Define this macro to be a C string representing the suffix to be
+automatically added to executable files on your target machine. If you
+do not define this macro, GCC will use the null string as the suffix for
+executable files.
+@end defmac
+
+@defmac COLLECT_EXPORT_LIST
+If defined, @code{collect2} will scan the individual object files
+specified on its command line and create an export list for the linker.
+Define this macro for systems like AIX, where the linker discards
+object files that are not referenced from @code{main} and uses export
+lists.
+@end defmac
+
+@defmac MODIFY_JNI_METHOD_CALL (@var{mdecl})
+Define this macro to a C expression representing a variant of the
+method call @var{mdecl}, if Java Native Interface (JNI) methods
+must be invoked differently from other methods on your target.
+For example, on 32-bit Microsoft Windows, JNI methods must be invoked using
+the @code{stdcall} calling convention and this macro is then
+defined as this expression:
+
+@smallexample
+build_type_attribute_variant (@var{mdecl},
+ build_tree_list
+ (get_identifier ("stdcall"),
+ NULL))
+@end smallexample
+@end defmac
+
+@hook TARGET_CANNOT_MODIFY_JUMPS_P
+This target hook returns @code{true} past the point in which new jump
+instructions could be created. On machines that require a register for
+every jump such as the SHmedia ISA of SH5, this point would typically be
+reload, so this target hook should be defined to a function such as:
+
+@smallexample
+static bool
+cannot_modify_jumps_past_reload_p ()
+@{
+ return (reload_completed || reload_in_progress);
+@}
+@end smallexample
+@end deftypefn
+
+@hook TARGET_BRANCH_TARGET_REGISTER_CLASS
+This target hook returns a register class for which branch target register
+optimizations should be applied. All registers in this class should be
+usable interchangeably. After reload, registers in this class will be
+re-allocated and loads will be hoisted out of loops and be subjected
+to inter-block scheduling.
+@end deftypefn
+
+@hook TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED
+Branch target register optimization will by default exclude callee-saved
+registers
+that are not already live during the current function; if this target hook
+returns true, they will be included. The target code must than make sure
+that all target registers in the class returned by
+@samp{TARGET_BRANCH_TARGET_REGISTER_CLASS} that might need saving are
+saved. @var{after_prologue_epilogue_gen} indicates if prologues and
+epilogues have already been generated. Note, even if you only return
+true when @var{after_prologue_epilogue_gen} is false, you still are likely
+to have to make special provisions in @code{INITIAL_ELIMINATION_OFFSET}
+to reserve space for caller-saved target registers.
+@end deftypefn
+
+@hook TARGET_HAVE_CONDITIONAL_EXECUTION
+This target hook returns true if the target supports conditional execution.
+This target hook is required only when the target has several different
+modes and they have different conditional execution capability, such as ARM.
+@end deftypefn
+
+@hook TARGET_LOOP_UNROLL_ADJUST
+This target hook returns a new value for the number of times @var{loop}
+should be unrolled. The parameter @var{nunroll} is the number of times
+the loop is to be unrolled. The parameter @var{loop} is a pointer to
+the loop, which is going to be checked for unrolling. This target hook
+is required only when the target has special constraints like maximum
+number of memory accesses.
+@end deftypefn
+
+@defmac POWI_MAX_MULTS
+If defined, this macro is interpreted as a signed integer C expression
+that specifies the maximum number of floating point multiplications
+that should be emitted when expanding exponentiation by an integer
+constant inline. When this value is defined, exponentiation requiring
+more than this number of multiplications is implemented by calling the
+system library's @code{pow}, @code{powf} or @code{powl} routines.
+The default value places no upper bound on the multiplication count.
+@end defmac
+
+@deftypefn Macro void TARGET_EXTRA_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc})
+This target hook should register any extra include files for the
+target. The parameter @var{stdinc} indicates if normal include files
+are present. The parameter @var{sysroot} is the system root directory.
+The parameter @var{iprefix} is the prefix for the gcc directory.
+@end deftypefn
+
+@deftypefn Macro void TARGET_EXTRA_PRE_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc})
+This target hook should register any extra include files for the
+target before any standard headers. The parameter @var{stdinc}
+indicates if normal include files are present. The parameter
+@var{sysroot} is the system root directory. The parameter
+@var{iprefix} is the prefix for the gcc directory.
+@end deftypefn
+
+@deftypefn Macro void TARGET_OPTF (char *@var{path})
+This target hook should register special include paths for the target.
+The parameter @var{path} is the include to register. On Darwin
+systems, this is used for Framework includes, which have semantics
+that are different from @option{-I}.
+@end deftypefn
+
+@defmac bool TARGET_USE_LOCAL_THUNK_ALIAS_P (tree @var{fndecl})
+This target macro returns @code{true} if it is safe to use a local alias
+for a virtual function @var{fndecl} when constructing thunks,
+@code{false} otherwise. By default, the macro returns @code{true} for all
+functions, if a target supports aliases (i.e.@: defines
+@code{ASM_OUTPUT_DEF}), @code{false} otherwise,
+@end defmac
+
+@defmac TARGET_FORMAT_TYPES
+If defined, this macro is the name of a global variable containing
+target-specific format checking information for the @option{-Wformat}
+option. The default is to have no target-specific format checks.
+@end defmac
+
+@defmac TARGET_N_FORMAT_TYPES
+If defined, this macro is the number of entries in
+@code{TARGET_FORMAT_TYPES}.
+@end defmac
+
+@defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES
+If defined, this macro is the name of a global variable containing
+target-specific format overrides for the @option{-Wformat} option. The
+default is to have no target-specific format overrides. If defined,
+@code{TARGET_FORMAT_TYPES} must be defined, too.
+@end defmac
+
+@defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT
+If defined, this macro specifies the number of entries in
+@code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES}.
+@end defmac
+
+@defmac TARGET_OVERRIDES_FORMAT_INIT
+If defined, this macro specifies the optional initialization
+routine for target specific customizations of the system printf
+and scanf formatter settings.
+@end defmac
+
+@hook TARGET_RELAXED_ORDERING
+If set to @code{true}, means that the target's memory model does not
+guarantee that loads which do not depend on one another will access
+main memory in the order of the instruction stream; if ordering is
+important, an explicit memory barrier must be used. This is true of
+many recent processors which implement a policy of ``relaxed,''
+``weak,'' or ``release'' memory consistency, such as Alpha, PowerPC,
+and ia64. The default is @code{false}.
+@end deftypevr
+
+@hook TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN
+If defined, this macro returns the diagnostic message when it is
+illegal to pass argument @var{val} to function @var{funcdecl}
+with prototype @var{typelist}.
+@end deftypefn
+
+@hook TARGET_INVALID_CONVERSION
+If defined, this macro returns the diagnostic message when it is
+invalid to convert from @var{fromtype} to @var{totype}, or @code{NULL}
+if validity should be determined by the front end.
+@end deftypefn
+
+@hook TARGET_INVALID_UNARY_OP
+If defined, this macro returns the diagnostic message when it is
+invalid to apply operation @var{op} (where unary plus is denoted by
+@code{CONVERT_EXPR}) to an operand of type @var{type}, or @code{NULL}
+if validity should be determined by the front end.
+@end deftypefn
+
+@hook TARGET_INVALID_BINARY_OP
+If defined, this macro returns the diagnostic message when it is
+invalid to apply operation @var{op} to operands of types @var{type1}
+and @var{type2}, or @code{NULL} if validity should be determined by
+the front end.
+@end deftypefn
+
+@hook TARGET_INVALID_PARAMETER_TYPE
+If defined, this macro returns the diagnostic message when it is
+invalid for functions to include parameters of type @var{type},
+or @code{NULL} if validity should be determined by
+the front end. This is currently used only by the C and C++ front ends.
+@end deftypefn
+
+@hook TARGET_INVALID_RETURN_TYPE
+If defined, this macro returns the diagnostic message when it is
+invalid for functions to have return type @var{type},
+or @code{NULL} if validity should be determined by
+the front end. This is currently used only by the C and C++ front ends.
+@end deftypefn
+
+@hook TARGET_PROMOTED_TYPE
+If defined, this target hook returns the type to which values of
+@var{type} should be promoted when they appear in expressions,
+analogous to the integer promotions, or @code{NULL_TREE} to use the
+front end's normal promotion rules. This hook is useful when there are
+target-specific types with special promotion rules.
+This is currently used only by the C and C++ front ends.
+@end deftypefn
+
+@hook TARGET_CONVERT_TO_TYPE
+If defined, this hook returns the result of converting @var{expr} to
+@var{type}. It should return the converted expression,
+or @code{NULL_TREE} to apply the front end's normal conversion rules.
+This hook is useful when there are target-specific types with special
+conversion rules.
+This is currently used only by the C and C++ front ends.
+@end deftypefn
+
+@defmac TARGET_USE_JCR_SECTION
+This macro determines whether to use the JCR section to register Java
+classes. By default, TARGET_USE_JCR_SECTION is defined to 1 if both
+SUPPORTS_WEAK and TARGET_HAVE_NAMED_SECTIONS are true, else 0.
+@end defmac
+
+@defmac OBJC_JBLEN
+This macro determines the size of the objective C jump buffer for the
+NeXT runtime. By default, OBJC_JBLEN is defined to an innocuous value.
+@end defmac
+
+@defmac LIBGCC2_UNWIND_ATTRIBUTE
+Define this macro if any target-specific attributes need to be attached
+to the functions in @file{libgcc} that provide low-level support for
+call stack unwinding. It is used in declarations in @file{unwind-generic.h}
+and the associated definitions of those functions.
+@end defmac
+
+@hook TARGET_UPDATE_STACK_BOUNDARY
+Define this macro to update the current function stack boundary if
+necessary.
+@end deftypefn
+
+@hook TARGET_GET_DRAP_RTX
+This hook should return an rtx for Dynamic Realign Argument Pointer (DRAP) if a
+different argument pointer register is needed to access the function's
+argument list due to stack realignment. Return @code{NULL} if no DRAP
+is needed.
+@end deftypefn
+
+@hook TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
+When optimization is disabled, this hook indicates whether or not
+arguments should be allocated to stack slots. Normally, GCC allocates
+stacks slots for arguments when not optimizing in order to make
+debugging easier. However, when a function is declared with
+@code{__attribute__((naked))}, there is no stack frame, and the compiler
+cannot safely move arguments from the registers in which they are passed
+to the stack. Therefore, this hook should return true in general, but
+false for naked functions. The default implementation always returns true.
+@end deftypefn
+
+@hook TARGET_CONST_ANCHOR
+On some architectures it can take multiple instructions to synthesize
+a constant. If there is another constant already in a register that
+is close enough in value then it is preferable that the new constant
+is computed from this register using immediate addition or
+subtraction. We accomplish this through CSE. Besides the value of
+the constant we also add a lower and an upper constant anchor to the
+available expressions. These are then queried when encountering new
+constants. The anchors are computed by rounding the constant up and
+down to a multiple of the value of @code{TARGET_CONST_ANCHOR}.
+@code{TARGET_CONST_ANCHOR} should be the maximum positive value
+accepted by immediate-add plus one. We currently assume that the
+value of @code{TARGET_CONST_ANCHOR} is a power of 2. For example, on
+MIPS, where add-immediate takes a 16-bit signed value,
+@code{TARGET_CONST_ANCHOR} is set to @samp{0x8000}. The default value
+is zero, which disables this optimization. @end deftypevr
diff --git a/gcc/double-int.c b/gcc/double-int.c
index 000be2bf7b0..aa175e89d41 100644
--- a/gcc/double-int.c
+++ b/gcc/double-int.c
@@ -134,56 +134,6 @@ fit_double_type (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
return l1 != low0 || h1 != high0;
}
-/* We force the double-int HIGH:LOW to the range of the type TYPE by
- sign or zero extending it.
- OVERFLOWABLE indicates if we are interested
- in overflow of the value, when >0 we are only interested in signed
- overflow, for <0 we are interested in any overflow. OVERFLOWED
- indicates whether overflow has already occurred. CONST_OVERFLOWED
- indicates whether constant overflow has already occurred. We force
- T's value to be within range of T's type (by setting to 0 or 1 all
- the bits outside the type's range). We set TREE_OVERFLOWED if,
- OVERFLOWED is nonzero,
- or OVERFLOWABLE is >0 and signed overflow occurs
- or OVERFLOWABLE is <0 and any overflow occurs
- We return a new tree node for the extended double-int. The node
- is shared if no overflow flags are set. */
-
-tree
-force_fit_type_double (tree type, unsigned HOST_WIDE_INT low,
- HOST_WIDE_INT high, int overflowable,
- bool overflowed)
-{
- int sign_extended_type;
- bool overflow;
-
- /* Size types *are* sign extended. */
- sign_extended_type = (!TYPE_UNSIGNED (type)
- || (TREE_CODE (type) == INTEGER_TYPE
- && TYPE_IS_SIZETYPE (type)));
-
- overflow = fit_double_type (low, high, &low, &high, type);
-
- /* If we need to set overflow flags, return a new unshared node. */
- if (overflowed || overflow)
- {
- if (overflowed
- || overflowable < 0
- || (overflowable > 0 && sign_extended_type))
- {
- tree t = make_node (INTEGER_CST);
- TREE_INT_CST_LOW (t) = low;
- TREE_INT_CST_HIGH (t) = high;
- TREE_TYPE (t) = type;
- TREE_OVERFLOW (t) = 1;
- return t;
- }
- }
-
- /* Else build a shared node. */
- return build_int_cst_wide (type, low, high);
-}
-
/* Add two doubleword integers with doubleword result.
Return nonzero if the operation overflows according to UNSIGNED_P.
Each argument is given as two `HOST_WIDE_INT' pieces.
@@ -432,51 +382,6 @@ rshift_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
}
}
-/* Rotate the doubleword integer in L1, H1 left by COUNT places
- keeping only PREC bits of result.
- Rotate right if COUNT is negative.
- Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-void
-lrotate_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
- HOST_WIDE_INT count, unsigned int prec,
- unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv)
-{
- unsigned HOST_WIDE_INT s1l, s2l;
- HOST_WIDE_INT s1h, s2h;
-
- count %= prec;
- if (count < 0)
- count += prec;
-
- lshift_double (l1, h1, count, prec, &s1l, &s1h, 0);
- rshift_double (l1, h1, prec - count, prec, &s2l, &s2h, 0);
- *lv = s1l | s2l;
- *hv = s1h | s2h;
-}
-
-/* Rotate the doubleword integer in L1, H1 left by COUNT places
- keeping only PREC bits of result. COUNT must be positive.
- Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-void
-rrotate_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
- HOST_WIDE_INT count, unsigned int prec,
- unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv)
-{
- unsigned HOST_WIDE_INT s1l, s2l;
- HOST_WIDE_INT s1h, s2h;
-
- count %= prec;
- if (count < 0)
- count += prec;
-
- rshift_double (l1, h1, count, prec, &s1l, &s1h, 0);
- lshift_double (l1, h1, prec - count, prec, &s2l, &s2h, 0);
- *lv = s1l | s2l;
- *hv = s1h | s2h;
-}
-
/* Divide doubleword integer LNUM, HNUM by doubleword integer LDEN, HDEN
for a quotient (stored in *LQUO, *HQUO) and remainder (in *LREM, *HREM).
CODE is a tree code for a kind of division, one of
@@ -842,14 +747,6 @@ double_int_sext (double_int cst, unsigned prec)
return r;
}
-/* Returns true if CST fits in unsigned HOST_WIDE_INT. */
-
-bool
-double_int_fits_in_uhwi_p (double_int cst)
-{
- return cst.high == 0;
-}
-
/* Returns true if CST fits in signed HOST_WIDE_INT. */
bool
@@ -875,24 +772,6 @@ double_int_fits_in_hwi_p (double_int cst, bool uns)
return double_int_fits_in_shwi_p (cst);
}
-/* Returns value of CST as a signed number. CST must satisfy
- double_int_fits_in_shwi_p. */
-
-HOST_WIDE_INT
-double_int_to_shwi (double_int cst)
-{
- return (HOST_WIDE_INT) cst.low;
-}
-
-/* Returns value of CST as an unsigned number. CST must satisfy
- double_int_fits_in_uhwi_p. */
-
-unsigned HOST_WIDE_INT
-double_int_to_uhwi (double_int cst)
-{
- return cst.low;
-}
-
/* Returns A * B. */
double_int
@@ -1049,6 +928,42 @@ double_int_rshift (double_int a, HOST_WIDE_INT count, unsigned int prec, bool ar
return ret;
}
+/* Rotate A left by COUNT places keeping only PREC bits of result.
+ Rotate right if COUNT is negative. */
+
+double_int
+double_int_lrotate (double_int a, HOST_WIDE_INT count, unsigned int prec)
+{
+ double_int t1, t2;
+
+ count %= prec;
+ if (count < 0)
+ count += prec;
+
+ t1 = double_int_lshift (a, count, prec, false);
+ t2 = double_int_rshift (a, prec - count, prec, false);
+
+ return double_int_ior (t1, t2);
+}
+
+/* Rotate A rigth by COUNT places keeping only PREC bits of result.
+ Rotate right if COUNT is negative. */
+
+double_int
+double_int_rrotate (double_int a, HOST_WIDE_INT count, unsigned int prec)
+{
+ double_int t1, t2;
+
+ count %= prec;
+ if (count < 0)
+ count += prec;
+
+ t1 = double_int_rshift (a, count, prec, false);
+ t2 = double_int_lshift (a, prec - count, prec, false);
+
+ return double_int_ior (t1, t2);
+}
+
/* Returns -1 if A < B, 0 if A == B and 1 if A > B. Signedness of the
comparison is given by UNS. */
@@ -1097,6 +1012,51 @@ double_int_scmp (double_int a, double_int b)
return 0;
}
+/* Compares two values A and B. Returns max value. Signedness of the
+ comparison is given by UNS. */
+
+double_int
+double_int_max (double_int a, double_int b, bool uns)
+{
+ return (double_int_cmp (a, b, uns) == 1) ? a : b;
+}
+
+/* Compares two signed values A and B. Returns max value. */
+
+double_int double_int_smax (double_int a, double_int b)
+{
+ return (double_int_scmp (a, b) == 1) ? a : b;
+}
+
+/* Compares two unsigned values A and B. Returns max value. */
+
+double_int double_int_umax (double_int a, double_int b)
+{
+ return (double_int_ucmp (a, b) == 1) ? a : b;
+}
+
+/* Compares two values A and B. Returns mix value. Signedness of the
+ comparison is given by UNS. */
+
+double_int double_int_min (double_int a, double_int b, bool uns)
+{
+ return (double_int_cmp (a, b, uns) == -1) ? a : b;
+}
+
+/* Compares two signed values A and B. Returns min value. */
+
+double_int double_int_smin (double_int a, double_int b)
+{
+ return (double_int_scmp (a, b) == -1) ? a : b;
+}
+
+/* Compares two unsigned values A and B. Returns min value. */
+
+double_int double_int_umin (double_int a, double_int b)
+{
+ return (double_int_ucmp (a, b) == -1) ? a : b;
+}
+
/* Splits last digit of *CST (taken as unsigned) in BASE and returns it. */
static unsigned
diff --git a/gcc/double-int.h b/gcc/double-int.h
index c13b112d496..6af0757990c 100644
--- a/gcc/double-int.h
+++ b/gcc/double-int.h
@@ -97,6 +97,35 @@ uhwi_to_double_int (unsigned HOST_WIDE_INT cst)
return r;
}
+/* Returns value of CST as a signed number. CST must satisfy
+ double_int_fits_in_shwi_p. */
+
+static inline HOST_WIDE_INT
+double_int_to_shwi (double_int cst)
+{
+ return (HOST_WIDE_INT) cst.low;
+}
+
+/* Returns value of CST as an unsigned number. CST must satisfy
+ double_int_fits_in_uhwi_p. */
+
+static inline unsigned HOST_WIDE_INT
+double_int_to_uhwi (double_int cst)
+{
+ return cst.low;
+}
+
+bool double_int_fits_in_hwi_p (double_int, bool);
+bool double_int_fits_in_shwi_p (double_int);
+
+/* Returns true if CST fits in unsigned HOST_WIDE_INT. */
+
+static inline bool
+double_int_fits_in_uhwi_p (double_int cst)
+{
+ return cst.high == 0;
+}
+
/* The following operations perform arithmetics modulo 2^precision,
so you do not need to call double_int_ext between them, even if
you are representing numbers with precision less than
@@ -109,11 +138,6 @@ double_int double_int_neg (double_int);
/* You must ensure that double_int_ext is called on the operands
of the following operations, if the precision of the numbers
is less than 2 * HOST_BITS_PER_WIDE_INT bits. */
-bool double_int_fits_in_hwi_p (double_int, bool);
-bool double_int_fits_in_shwi_p (double_int);
-bool double_int_fits_in_uhwi_p (double_int);
-HOST_WIDE_INT double_int_to_shwi (double_int);
-unsigned HOST_WIDE_INT double_int_to_uhwi (double_int);
double_int double_int_div (double_int, double_int, bool, unsigned);
double_int double_int_sdiv (double_int, double_int, unsigned);
double_int double_int_udiv (double_int, double_int, unsigned);
@@ -157,9 +181,22 @@ double_int_and (double_int a, double_int b)
return a;
}
+/* Returns A ^ B. */
+
+static inline double_int
+double_int_xor (double_int a, double_int b)
+{
+ a.low ^= b.low;
+ a.high ^= b.high;
+ return a;
+}
+
+
/* Shift operations. */
double_int double_int_lshift (double_int, HOST_WIDE_INT, unsigned int, bool);
double_int double_int_rshift (double_int, HOST_WIDE_INT, unsigned int, bool);
+double_int double_int_lrotate (double_int, HOST_WIDE_INT, unsigned int);
+double_int double_int_rrotate (double_int, HOST_WIDE_INT, unsigned int);
/* Returns true if CST is negative. Of course, CST is considered to
be signed. */
@@ -173,6 +210,15 @@ double_int_negative_p (double_int cst)
int double_int_cmp (double_int, double_int, bool);
int double_int_scmp (double_int, double_int);
int double_int_ucmp (double_int, double_int);
+
+double_int double_int_max (double_int, double_int, bool);
+double_int double_int_smax (double_int, double_int);
+double_int double_int_umax (double_int, double_int);
+
+double_int double_int_min (double_int, double_int, bool);
+double_int double_int_smin (double_int, double_int);
+double_int double_int_umin (double_int, double_int);
+
void dump_double_int (FILE *, double_int, bool);
/* Zero and sign extension of numbers in smaller precisions. */
@@ -223,8 +269,6 @@ double_int_equal_p (double_int cst1, double_int cst2)
/* Legacy interface with decomposed high/low parts. */
-extern tree force_fit_type_double (tree, unsigned HOST_WIDE_INT, HOST_WIDE_INT,
- int, bool);
extern int fit_double_type (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *,
const_tree);
@@ -248,12 +292,6 @@ extern void lshift_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
extern void rshift_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
HOST_WIDE_INT, unsigned int,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *, bool);
-extern void lrotate_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, unsigned int,
- unsigned HOST_WIDE_INT *, HOST_WIDE_INT *);
-extern void rrotate_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, unsigned int,
- unsigned HOST_WIDE_INT *, HOST_WIDE_INT *);
extern int div_and_round_double (unsigned, int, unsigned HOST_WIDE_INT,
HOST_WIDE_INT, unsigned HOST_WIDE_INT,
HOST_WIDE_INT, unsigned HOST_WIDE_INT *,
diff --git a/gcc/dse.c b/gcc/dse.c
index 2be8a942c75..98861f11044 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2326,7 +2326,8 @@ get_call_args (rtx call_insn, tree fn, rtx *args, int nargs)
arg = TREE_CHAIN (arg), idx++)
{
enum machine_mode mode = TYPE_MODE (TREE_VALUE (arg));
- rtx reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1), link, tmp;
+ rtx reg, link, tmp;
+ reg = targetm.calls.function_arg (&args_so_far, mode, NULL_TREE, true);
if (!reg || !REG_P (reg) || GET_MODE (reg) != mode
|| GET_MODE_CLASS (mode) != MODE_INT)
return false;
@@ -2360,7 +2361,7 @@ get_call_args (rtx call_insn, tree fn, rtx *args, int nargs)
if (tmp)
args[idx] = tmp;
- FUNCTION_ARG_ADVANCE (args_so_far, mode, NULL_TREE, 1);
+ targetm.calls.function_arg_advance (&args_so_far, mode, NULL_TREE, true);
}
if (arg != void_list_node || idx != nargs)
return false;
@@ -3396,7 +3397,7 @@ dse_confluence_0 (basic_block bb)
out set of the src of E. If the various in or out sets are not
there, that means they are all ones. */
-static void
+static bool
dse_confluence_n (edge e)
{
bb_info_t src_info = bb_table[e->src->index];
@@ -3412,6 +3413,7 @@ dse_confluence_n (edge e)
bitmap_copy (src_info->out, dest_info->in);
}
}
+ return true;
}
diff --git a/gcc/dse.h b/gcc/dse.h
index 862eacadc1e..7c9c94bc57e 100644
--- a/gcc/dse.h
+++ b/gcc/dse.h
@@ -23,8 +23,6 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_DSE_H
#define GCC_DSE_H
-struct df;
-
extern void dse_record_singleton_alias_set (alias_set_type, enum machine_mode);
extern void dse_invalidate_singleton_alias_set (alias_set_type);
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 516a26004f0..84e8cadc9d3 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -152,6 +152,35 @@ dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
va_end (ap);
}
+/* Output the difference between two symbols in instruction units
+ in a given size. */
+
+void
+dw2_asm_output_vms_delta (int size ATTRIBUTE_UNUSED,
+ const char *lab1, const char *lab2,
+ const char *comment, ...)
+{
+ va_list ap;
+
+ va_start (ap, comment);
+
+#ifndef ASM_OUTPUT_DWARF_VMS_DELTA
+ /* VMS Delta is only special on ia64-vms, but this funtion also gets
+ called on alpha-vms so it has to do something sane. */
+ dw2_asm_output_delta (size, lab1, lab2, comment);
+#else
+ ASM_OUTPUT_DWARF_VMS_DELTA (asm_out_file, size, lab1, lab2);
+ if (flag_debug_asm && comment)
+ {
+ fprintf (asm_out_file, "\t%s ", ASM_COMMENT_START);
+ vfprintf (asm_out_file, comment, ap);
+ }
+ fputc ('\n', asm_out_file);
+#endif
+
+ va_end (ap);
+}
+
/* Output a section-relative reference to a LABEL, which was placed in
BASE. In general this can only be done for debugging symbols.
E.g. on most targets with the GNU linker, this is accomplished with
@@ -816,7 +845,9 @@ dw2_force_const_mem (rtx x, bool is_public)
if (! indirect_pool)
/* We use strcmp, rather than just comparing pointers, so that the
sort order will not depend on the host system. */
- indirect_pool = splay_tree_new_ggc (splay_tree_compare_strings);
+ indirect_pool = splay_tree_new_ggc (splay_tree_compare_strings,
+ ggc_alloc_splay_tree_str_tree_node_splay_tree_s,
+ ggc_alloc_splay_tree_str_tree_node_splay_tree_node_s);
gcc_assert (GET_CODE (x) == SYMBOL_REF);
diff --git a/gcc/dwarf2asm.h b/gcc/dwarf2asm.h
index e7be9bdbaee..39515d0ddb3 100644
--- a/gcc/dwarf2asm.h
+++ b/gcc/dwarf2asm.h
@@ -1,5 +1,6 @@
/* Dwarf2 assembler output helper routines.
- Copyright (C) 2001, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2005, 2007, 2008, 2010
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -30,6 +31,10 @@ extern void dw2_asm_output_delta (int, const char *, const char *,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_4;
+extern void dw2_asm_output_vms_delta (int, const char *, const char *,
+ const char *, ...)
+ ATTRIBUTE_NULL_PRINTF_4;
+
extern void dw2_asm_output_offset (int, const char *, section *,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_4;
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 48f5fa4c208..6decc6f050e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -299,6 +299,8 @@ typedef struct GTY(()) dw_fde_struct {
const char *dw_fde_begin;
const char *dw_fde_current_label;
const char *dw_fde_end;
+ const char *dw_fde_vms_end_prologue;
+ const char *dw_fde_vms_begin_epilogue;
const char *dw_fde_hot_section_label;
const char *dw_fde_hot_section_end_label;
const char *dw_fde_unlikely_section_label;
@@ -508,6 +510,14 @@ static void def_cfa_1 (const char *, dw_cfa_location *);
#define FUNC_END_LABEL "LFE"
#endif
+#ifndef PROLOGUE_END_LABEL
+#define PROLOGUE_END_LABEL "LPE"
+#endif
+
+#ifndef EPILOGUE_BEGIN_LABEL
+#define EPILOGUE_BEGIN_LABEL "LEB"
+#endif
+
#ifndef FRAME_BEGIN_LABEL
#define FRAME_BEGIN_LABEL "Lframe"
#endif
@@ -722,7 +732,7 @@ dwarf_cfi_name (unsigned int cfi_opc)
static inline dw_cfi_ref
new_cfi (void)
{
- dw_cfi_ref cfi = GGC_NEW (dw_cfi_node);
+ dw_cfi_ref cfi = ggc_alloc_dw_cfi_node ();
cfi->dw_cfi_next = NULL;
cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0;
@@ -1694,7 +1704,7 @@ queue_reg_save (const char *label, rtx reg, rtx sreg, HOST_WIDE_INT offset)
if (q == NULL)
{
- q = GGC_NEW (struct queued_reg_save);
+ q = ggc_alloc_queued_reg_save ();
q->next = queued_reg_saves;
queued_reg_saves = q;
}
@@ -2789,7 +2799,7 @@ dwarf2out_frame_debug (rtx insn, bool after_p)
NOTE_INSN_CFA_RESTORE_STATE at the appropriate place in the stream. */
void
-dwarf2out_begin_epilogue (rtx insn)
+dwarf2out_cfi_begin_epilogue (rtx insn)
{
bool saw_frp = false;
rtx i;
@@ -2862,7 +2872,8 @@ dwarf2out_begin_epilogue (rtx insn)
cfa_remember.in_use = 1;
}
-/* A "subroutine" of dwarf2out_begin_epilogue. Emit the restore required. */
+/* A "subroutine" of dwarf2out_cfi_begin_epilogue. Emit the restore
+ required. */
void
dwarf2out_frame_debug_restore_state (void)
@@ -3452,8 +3463,8 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
char l1[20], l2[20];
dw_cfi_ref cfi;
- targetm.asm_out.unwind_label (asm_out_file, fde->decl, for_eh,
- /* empty */ 0);
+ targetm.asm_out.emit_unwind_label (asm_out_file, fde->decl, for_eh,
+ /* empty */ 0);
targetm.asm_out.internal_label (asm_out_file, FDE_LABEL,
for_eh + j);
ASM_GENERATE_INTERNAL_LABEL (l1, FDE_AFTER_SIZE_LABEL, for_eh + j);
@@ -3669,7 +3680,8 @@ output_call_frame_info (int for_eh)
else if (fde_needed_for_eh_p (&fde_table[i]))
any_eh_needed = true;
else if (TARGET_USES_WEAK_UNWIND_INFO)
- targetm.asm_out.unwind_label (asm_out_file, fde_table[i].decl, 1, 1);
+ targetm.asm_out.emit_unwind_label (asm_out_file, fde_table[i].decl,
+ 1, 1);
if (!any_eh_needed)
return;
@@ -3961,6 +3973,8 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
fde->dw_fde_switched_sections = 0;
fde->dw_fde_switched_cold_to_hot = 0;
fde->dw_fde_end = NULL;
+ fde->dw_fde_vms_end_prologue = NULL;
+ fde->dw_fde_vms_begin_epilogue = NULL;
fde->dw_fde_cfi = NULL;
fde->dw_fde_switch_cfi = NULL;
fde->funcdef_number = current_function_funcdef_no;
@@ -4017,6 +4031,51 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
}
}
+/* Output a marker (i.e. a label) for the end of the generated code
+ for a function prologue. This gets called *after* the prologue code has
+ been generated. */
+
+void
+dwarf2out_vms_end_prologue (unsigned int line ATTRIBUTE_UNUSED,
+ const char *file ATTRIBUTE_UNUSED)
+{
+ dw_fde_ref fde;
+ char label[MAX_ARTIFICIAL_LABEL_BYTES];
+
+ /* Output a label to mark the endpoint of the code generated for this
+ function. */
+ ASM_GENERATE_INTERNAL_LABEL (label, PROLOGUE_END_LABEL,
+ current_function_funcdef_no);
+ ASM_OUTPUT_DEBUG_LABEL (asm_out_file, PROLOGUE_END_LABEL,
+ current_function_funcdef_no);
+ fde = &fde_table[fde_table_in_use - 1];
+ fde->dw_fde_vms_end_prologue = xstrdup (label);
+}
+
+/* Output a marker (i.e. a label) for the beginning of the generated code
+ for a function epilogue. This gets called *before* the prologue code has
+ been generated. */
+
+void
+dwarf2out_vms_begin_epilogue (unsigned int line ATTRIBUTE_UNUSED,
+ const char *file ATTRIBUTE_UNUSED)
+{
+ dw_fde_ref fde;
+ char label[MAX_ARTIFICIAL_LABEL_BYTES];
+
+ fde = &fde_table[fde_table_in_use - 1];
+ if (fde->dw_fde_vms_begin_epilogue)
+ return;
+
+ /* Output a label to mark the endpoint of the code generated for this
+ function. */
+ ASM_GENERATE_INTERNAL_LABEL (label, EPILOGUE_BEGIN_LABEL,
+ current_function_funcdef_no);
+ ASM_OUTPUT_DEBUG_LABEL (asm_out_file, EPILOGUE_BEGIN_LABEL,
+ current_function_funcdef_no);
+ fde->dw_fde_vms_begin_epilogue = xstrdup (label);
+}
+
/* Output a marker (i.e. a label) for the absolute end of the generated code
for a function definition. This gets called *after* the epilogue code has
been generated. */
@@ -4049,7 +4108,7 @@ void
dwarf2out_frame_init (void)
{
/* Allocate the initial hunk of the fde_table. */
- fde_table = GGC_CNEWVEC (dw_fde_node, FDE_TABLE_INCREMENT);
+ fde_table = ggc_alloc_cleared_vec_dw_fde_node (FDE_TABLE_INCREMENT);
fde_table_allocated = FDE_TABLE_INCREMENT;
fde_table_in_use = 0;
@@ -4193,7 +4252,8 @@ enum dw_val_class
dw_val_class_str,
dw_val_class_macptr,
dw_val_class_file,
- dw_val_class_data8
+ dw_val_class_data8,
+ dw_val_class_vms_delta
};
/* Describe a floating point constant value, or a vector constant value. */
@@ -4231,6 +4291,11 @@ typedef struct GTY(()) dw_val_struct {
unsigned char GTY ((tag ("dw_val_class_flag"))) val_flag;
struct dwarf_file_data * GTY ((tag ("dw_val_class_file"))) val_file;
unsigned char GTY ((tag ("dw_val_class_data8"))) val_data8[8];
+ struct dw_val_vms_delta_union
+ {
+ char * lbl1;
+ char * lbl2;
+ } GTY ((tag ("dw_val_class_vms_delta"))) val_vms_delta;
}
GTY ((desc ("%1.val_class"))) v;
}
@@ -4605,7 +4670,7 @@ static inline dw_loc_descr_ref
new_loc_descr (enum dwarf_location_atom op, unsigned HOST_WIDE_INT oprnd1,
unsigned HOST_WIDE_INT oprnd2)
{
- dw_loc_descr_ref descr = GGC_CNEW (dw_loc_descr_node);
+ dw_loc_descr_ref descr = ggc_alloc_cleared_dw_loc_descr_node ();
descr->dw_loc_opc = op;
descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
@@ -5466,7 +5531,13 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
dwarf2out_ignore_block,
dwarf2out_source_line,
dwarf2out_begin_prologue,
- debug_nothing_int_charstar, /* end_prologue */
+#if VMS_DEBUGGING_INFO
+ dwarf2out_vms_end_prologue,
+ dwarf2out_vms_begin_epilogue,
+#else
+ debug_nothing_int_charstar,
+ debug_nothing_int_charstar,
+#endif
dwarf2out_end_epilogue,
dwarf2out_begin_function,
debug_nothing_int, /* end_function */
@@ -6202,6 +6273,7 @@ static void gen_type_die (tree, dw_die_ref);
static void gen_block_die (tree, dw_die_ref, int);
static void decls_for_scope (tree, dw_die_ref, int);
static int is_redundant_typedef (const_tree);
+static bool is_naming_typedef_decl (const_tree);
static inline dw_die_ref get_context_die (tree);
static void gen_namespace_die (tree, dw_die_ref);
static void gen_decl_die (tree, tree, dw_die_ref);
@@ -6213,6 +6285,8 @@ static struct dwarf_file_data * lookup_filename (const char *);
static void retry_incomplete_types (void);
static void gen_type_die_for_member (tree, tree, dw_die_ref);
static void gen_generic_params_dies (tree);
+static void gen_tagged_type_die (tree, dw_die_ref, enum debug_info_usage);
+static void gen_type_die_with_usage (tree, dw_die_ref, enum debug_info_usage);
static void splice_child_die (dw_die_ref, dw_die_ref);
static int file_info_cmp (const void *, const void *);
static dw_loc_list_ref new_loc_list (dw_loc_descr_ref, const char *,
@@ -6227,6 +6301,10 @@ static void prune_unused_types_walk_attribs (dw_die_ref);
static void prune_unused_types_prune (dw_die_ref);
static void prune_unused_types (void);
static int maybe_emit_file (struct dwarf_file_data *fd);
+static inline const char *AT_vms_delta1 (dw_attr_ref);
+static inline const char *AT_vms_delta2 (dw_attr_ref);
+static inline void add_AT_vms_delta (dw_die_ref, enum dwarf_attribute,
+ const char *, const char *);
static void append_entry_to_tmpl_value_parm_die_table (dw_die_ref, tree);
static void gen_remaining_tmpl_value_param_die_attribute (void);
@@ -6734,14 +6812,24 @@ dwarf_attr_name (unsigned int attr)
return "DW_AT_MIPS_tail_loop_begin";
case DW_AT_MIPS_epilog_begin:
return "DW_AT_MIPS_epilog_begin";
+#if VMS_DEBUGGING_INFO
+ case DW_AT_HP_prologue:
+ return "DW_AT_HP_prologue";
+#else
case DW_AT_MIPS_loop_unroll_factor:
return "DW_AT_MIPS_loop_unroll_factor";
+#endif
case DW_AT_MIPS_software_pipeline_depth:
return "DW_AT_MIPS_software_pipeline_depth";
case DW_AT_MIPS_linkage_name:
return "DW_AT_MIPS_linkage_name";
+#if VMS_DEBUGGING_INFO
+ case DW_AT_HP_epilogue:
+ return "DW_AT_HP_epilogue";
+#else
case DW_AT_MIPS_stride:
return "DW_AT_MIPS_stride";
+#endif
case DW_AT_MIPS_abstract_name:
return "DW_AT_MIPS_abstract_name";
case DW_AT_MIPS_clone_origin:
@@ -7055,8 +7143,7 @@ find_AT_string (const char *str)
htab_hash_string (str), INSERT);
if (*slot == NULL)
{
- node = (struct indirect_string_node *)
- ggc_alloc_cleared (sizeof (struct indirect_string_node));
+ node = ggc_alloc_cleared_indirect_string_node ();
node->str = ggc_strdup (str);
*slot = node;
}
@@ -7308,6 +7395,21 @@ AT_file (dw_attr_ref a)
return a->dw_attr_val.v.val_file;
}
+/* Add a vms delta attribute value to a DIE. */
+
+static inline void
+add_AT_vms_delta (dw_die_ref die, enum dwarf_attribute attr_kind,
+ const char *lbl1, const char *lbl2)
+{
+ dw_attr_node attr;
+
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_vms_delta;
+ attr.dw_attr_val.v.val_vms_delta.lbl1 = xstrdup (lbl1);
+ attr.dw_attr_val.v.val_vms_delta.lbl2 = xstrdup (lbl2);
+ add_dwarf_attr (die, &attr);
+}
+
/* Add a label identifier attribute value to a DIE. */
static inline void
@@ -7379,6 +7481,24 @@ add_AT_range_list (dw_die_ref die, enum dwarf_attribute attr_kind,
add_dwarf_attr (die, &attr);
}
+/* Return the start label of a delta attribute. */
+
+static inline const char *
+AT_vms_delta1 (dw_attr_ref a)
+{
+ gcc_assert (a && (AT_class (a) == dw_val_class_vms_delta));
+ return a->dw_attr_val.v.val_vms_delta.lbl1;
+}
+
+/* Return the end label of a delta attribute. */
+
+static inline const char *
+AT_vms_delta2 (dw_attr_ref a)
+{
+ gcc_assert (a && (AT_class (a) == dw_val_class_vms_delta));
+ return a->dw_attr_val.v.val_vms_delta.lbl2;
+}
+
static inline const char *
AT_lbl (dw_attr_ref a)
{
@@ -7681,7 +7801,7 @@ splice_child_die (dw_die_ref parent, dw_die_ref child)
static inline dw_die_ref
new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t)
{
- dw_die_ref die = GGC_CNEW (die_node);
+ dw_die_ref die = ggc_alloc_cleared_die_node ();
die->die_tag = tag_value;
@@ -7691,7 +7811,7 @@ new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t)
{
limbo_die_node *limbo_node;
- limbo_node = GGC_CNEW (limbo_die_node);
+ limbo_node = ggc_alloc_cleared_limbo_die_node ();
limbo_node->die = die;
limbo_node->created_for = t;
limbo_node->next = limbo_die_list;
@@ -7954,7 +8074,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
slot = htab_find_slot_with_hash (decl_loc_table, decl, decl_id, INSERT);
if (*slot == NULL)
{
- temp = GGC_CNEW (var_loc_list);
+ temp = ggc_alloc_cleared_var_loc_list ();
temp->decl_id = decl_id;
*slot = temp;
}
@@ -8044,7 +8164,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
memset (loc, '\0', sizeof (*loc));
}
else
- loc = GGC_CNEW (struct var_loc_node);
+ loc = ggc_alloc_cleared_var_loc_node ();
if (bitsize == -1 || piece_loc == NULL)
loc->loc = construct_piece_list (loc_note, bitpos, bitsize);
else
@@ -8061,7 +8181,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
}
else
{
- loc = GGC_CNEW (struct var_loc_node);
+ loc = ggc_alloc_cleared_var_loc_node ();
temp->first = loc;
temp->last = loc;
loc->loc = construct_piece_list (loc_note, bitpos, bitsize);
@@ -8176,6 +8296,10 @@ print_die (dw_die_ref die, FILE *outfile)
else
fprintf (outfile, "die -> <null>");
break;
+ case dw_val_class_vms_delta:
+ fprintf (outfile, "delta: @slotcount(%s-%s)",
+ AT_vms_delta2 (a), AT_vms_delta1 (a));
+ break;
case dw_val_class_lbl_id:
case dw_val_class_lineptr:
case dw_val_class_macptr:
@@ -8354,6 +8478,7 @@ attr_checksum (dw_attr_ref at, struct md5_ctx *ctx, int *mark)
break;
case dw_val_class_fde_ref:
+ case dw_val_class_vms_delta:
case dw_val_class_lbl_id:
case dw_val_class_lineptr:
case dw_val_class_macptr:
@@ -9084,6 +9209,7 @@ same_dw_val_p (const dw_val_node *v1, const dw_val_node *v2, int *mark)
return same_die_p (v1->v.val_die_ref.die, v2->v.val_die_ref.die, mark);
case dw_val_class_fde_ref:
+ case dw_val_class_vms_delta:
case dw_val_class_lbl_id:
case dw_val_class_lineptr:
case dw_val_class_macptr:
@@ -9505,6 +9631,18 @@ is_declaration_die (dw_die_ref die)
return 0;
}
+/* Return non-zero if this DIE is nested inside a subprogram. */
+
+static int
+is_nested_in_subprogram (dw_die_ref die)
+{
+ dw_die_ref decl = get_AT_ref (die, DW_AT_specification);
+
+ if (decl == NULL)
+ decl = die;
+ return local_scope_p (decl);
+}
+
/* Return non-zero if this is a type DIE that should be moved to a
COMDAT .debug_types section. */
@@ -9517,8 +9655,11 @@ should_move_die_to_comdat (dw_die_ref die)
case DW_TAG_structure_type:
case DW_TAG_enumeration_type:
case DW_TAG_union_type:
- /* Don't move declarations or inlined instances. */
- if (is_declaration_die (die) || get_AT (die, DW_AT_abstract_origin))
+ /* Don't move declarations, inlined instances, or types nested in a
+ subprogram. */
+ if (is_declaration_die (die)
+ || get_AT (die, DW_AT_abstract_origin)
+ || is_nested_in_subprogram (die))
return 0;
return 1;
case DW_TAG_array_type:
@@ -9551,7 +9692,7 @@ clone_die (dw_die_ref die)
dw_attr_ref a;
unsigned ix;
- clone = GGC_CNEW (die_node);
+ clone = ggc_alloc_cleared_die_node ();
clone->die_tag = die->die_tag;
for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
@@ -9592,7 +9733,7 @@ clone_as_declaration (dw_die_ref die)
if (decl != NULL)
return clone_die (decl);
- clone = GGC_CNEW (die_node);
+ clone = ggc_alloc_cleared_die_node ();
clone->die_tag = die->die_tag;
for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
@@ -9811,7 +9952,7 @@ break_out_comdat_types (dw_die_ref die)
unit = new_die (DW_TAG_type_unit, NULL, NULL);
add_AT_unsigned (unit, DW_AT_language,
get_AT_unsigned (comp_unit_die, DW_AT_language));
- type_node = GGC_CNEW (comdat_type_node);
+ type_node = ggc_alloc_cleared_comdat_type_node ();
type_node->root_die = unit;
type_node->next = comdat_type_list;
comdat_type_list = type_node;
@@ -9930,8 +10071,6 @@ copy_ancestor_tree (dw_die_ref unit, dw_die_ref die, htab_t decl_table)
if (decl_table != NULL)
{
- /* Make sure the copy is marked as part of the type unit. */
- copy->die_mark = 1;
/* Record the pointer to the copy. */
entry->copy = copy;
}
@@ -10005,7 +10144,18 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, htab_t decl_table)
installed in a previously-added context, it won't
get visited otherwise. */
if (parent != unit)
- copy_decls_walk (unit, parent, decl_table);
+ {
+ /* Find the highest point of the newly-added tree,
+ mark each node along the way, and walk from there. */
+ parent->die_mark = 1;
+ while (parent->die_parent
+ && parent->die_parent->die_mark == 0)
+ {
+ parent = parent->die_parent;
+ parent->die_mark = 1;
+ }
+ copy_decls_walk (unit, parent, decl_table);
+ }
}
}
}
@@ -10265,6 +10415,9 @@ size_of_die (dw_die_ref die)
case dw_val_class_data8:
size += 8;
break;
+ case dw_val_class_vms_delta:
+ size += DWARF_OFFSET_SIZE;
+ break;
default:
gcc_unreachable ();
}
@@ -10422,6 +10575,7 @@ value_format (dw_attr_ref a)
if (dwarf_version >= 4)
return DW_FORM_sec_offset;
/* FALLTHRU */
+ case dw_val_class_vms_delta:
case dw_val_class_offset:
switch (DWARF_OFFSET_SIZE)
{
@@ -10609,7 +10763,7 @@ static inline dw_loc_list_ref
new_loc_list (dw_loc_descr_ref expr, const char *begin, const char *end,
const char *section)
{
- dw_loc_list_ref retlist = GGC_CNEW (dw_loc_list_node);
+ dw_loc_list_ref retlist = ggc_alloc_cleared_dw_loc_list_node ();
retlist->begin = begin;
retlist->end = end;
@@ -10887,6 +11041,12 @@ output_die (dw_die_ref die)
}
break;
+ case dw_val_class_vms_delta:
+ dw2_asm_output_vms_delta (DWARF_OFFSET_SIZE,
+ AT_vms_delta2 (a), AT_vms_delta1 (a),
+ "%s", name);
+ break;
+
case dw_val_class_lbl_id:
dw2_asm_output_addr (DWARF2_ADDR_SIZE, AT_lbl (a), "%s", name);
break;
@@ -12242,6 +12402,20 @@ base_type_die (tree type)
switch (TREE_CODE (type))
{
case INTEGER_TYPE:
+ if ((dwarf_version >= 4 || !dwarf_strict)
+ && TYPE_NAME (type)
+ && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && DECL_IS_BUILTIN (TYPE_NAME (type))
+ && DECL_NAME (TYPE_NAME (type)))
+ {
+ const char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ if (strcmp (name, "char16_t") == 0
+ || strcmp (name, "char32_t") == 0)
+ {
+ encoding = DW_ATE_UTF;
+ break;
+ }
+ }
if (TYPE_STRING_FLAG (type))
{
if (TYPE_UNSIGNED (type))
@@ -12825,6 +12999,26 @@ reg_loc_descriptor (rtx rtl, enum var_init_status initialized)
if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
return 0;
+ /* We only use "frame base" when we're sure we're talking about the
+ post-prologue local stack frame. We do this by *not* running
+ register elimination until this point, and recognizing the special
+ argument pointer and soft frame pointer rtx's.
+ Use DW_OP_fbreg offset DW_OP_stack_value in this case. */
+ if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
+ && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
+ {
+ dw_loc_descr_ref result = NULL;
+
+ if (dwarf_version >= 4 || !dwarf_strict)
+ {
+ result = mem_loc_descriptor (rtl, VOIDmode, initialized);
+ if (result)
+ add_loc_descr (&result,
+ new_loc_descr (DW_OP_stack_value, 0, 0));
+ }
+ return result;
+ }
+
regs = targetm.dwarf_register_span (rtl);
if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
@@ -14130,7 +14324,8 @@ loc_descriptor (rtx rtl, enum machine_mode mode,
if (SCALAR_FLOAT_MODE_P (mode))
{
unsigned int length = GET_MODE_SIZE (mode);
- unsigned char *array = GGC_NEWVEC (unsigned char, length);
+ unsigned char *array
+ = (unsigned char*) ggc_alloc_atomic (length);
insert_float (rtl, array);
loc_result->dw_loc_oprnd2.val_class = dw_val_class_vec;
@@ -14155,7 +14350,8 @@ loc_descriptor (rtx rtl, enum machine_mode mode,
{
unsigned int elt_size = GET_MODE_UNIT_SIZE (GET_MODE (rtl));
unsigned int length = CONST_VECTOR_NUNITS (rtl);
- unsigned char *array = GGC_NEWVEC (unsigned char, length * elt_size);
+ unsigned char *array = (unsigned char *)
+ ggc_alloc_atomic (length * elt_size);
unsigned int i;
unsigned char *p;
@@ -14639,12 +14835,12 @@ add_loc_descr_to_each (dw_loc_list_ref list, dw_loc_descr_ref ref)
list = list->dw_loc_next;
while (list)
{
- copy = GGC_CNEW (dw_loc_descr_node);
+ copy = ggc_alloc_dw_loc_descr_node ();
memcpy (copy, ref, sizeof (dw_loc_descr_node));
add_loc_descr (&list->expr, copy);
while (copy->dw_loc_next)
{
- dw_loc_descr_ref new_copy = GGC_CNEW (dw_loc_descr_node);
+ dw_loc_descr_ref new_copy = ggc_alloc_dw_loc_descr_node ();
memcpy (new_copy, copy->dw_loc_next, sizeof (dw_loc_descr_node));
copy->dw_loc_next = new_copy;
copy = new_copy;
@@ -14984,6 +15180,11 @@ loc_list_from_tree (tree loc, int want_address)
}
break;
+ case MEM_REF:
+ /* ??? FIXME. */
+ if (!integer_zerop (TREE_OPERAND (loc, 1)))
+ return 0;
+ /* Fallthru. */
case INDIRECT_REF:
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
@@ -15595,6 +15796,17 @@ add_AT_location_description (dw_die_ref die, enum dwarf_attribute attr_kind,
add_AT_loc_list (die, attr_kind, descr);
}
+/* Add DW_AT_accessibility attribute to DIE if needed. */
+
+static void
+add_accessibility_attribute (dw_die_ref die, tree decl)
+{
+ if (TREE_PROTECTED (decl))
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_protected);
+ else if (TREE_PRIVATE (decl))
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_private);
+}
+
/* Attach the specialized form of location attribute used for data members of
struct and union types. In the special case of a FIELD_DECL node which
represents a bit-field, the "offset" part of this special location
@@ -15800,7 +16012,7 @@ add_const_value_attribute (dw_die_ref die, rtx rtl)
if (SCALAR_FLOAT_MODE_P (mode))
{
unsigned int length = GET_MODE_SIZE (mode);
- unsigned char *array = GGC_NEWVEC (unsigned char, length);
+ unsigned char *array = (unsigned char *) ggc_alloc_atomic (length);
insert_float (rtl, array);
add_AT_vec (die, DW_AT_const_value, length / 4, 4, array);
@@ -15816,7 +16028,8 @@ add_const_value_attribute (dw_die_ref die, rtx rtl)
enum machine_mode mode = GET_MODE (rtl);
unsigned int elt_size = GET_MODE_UNIT_SIZE (mode);
unsigned int length = CONST_VECTOR_NUNITS (rtl);
- unsigned char *array = GGC_NEWVEC (unsigned char, length * elt_size);
+ unsigned char *array = (unsigned char *) ggc_alloc_atomic
+ (length * elt_size);
unsigned int i;
unsigned char *p;
@@ -16566,7 +16779,8 @@ tree_add_const_value_attribute (dw_die_ref die, tree t)
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (init));
if (size > 0 && (int) size == size)
{
- unsigned char *array = GGC_CNEWVEC (unsigned char, size);
+ unsigned char *array = (unsigned char *)
+ ggc_alloc_cleared_atomic (size);
if (native_encode_initializer (init, array, size))
{
@@ -16754,7 +16968,7 @@ add_comp_dir_attribute (dw_die_ref die)
int wdlen;
wdlen = strlen (wd);
- wd1 = GGC_NEWVEC (char, wdlen + 2);
+ wd1 = (char *) ggc_alloc_atomic (wdlen + 2);
strcpy (wd1, wd);
wd1 [wdlen] = DIR_SEPARATOR;
wd1 [wdlen + 1] = 0;
@@ -17177,6 +17391,34 @@ add_src_coords_attributes (dw_die_ref die, tree decl)
add_AT_unsigned (die, DW_AT_decl_line, s.line);
}
+/* Add DW_AT_{,MIPS_}linkage_name attribute for the given decl. */
+
+static void
+add_linkage_name (dw_die_ref die, tree decl)
+{
+ if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
+ && TREE_PUBLIC (decl)
+ && !DECL_ABSTRACT (decl)
+ && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
+ && die->die_tag != DW_TAG_member)
+ {
+ /* Defer until we have an assembler name set. */
+ if (!DECL_ASSEMBLER_NAME_SET_P (decl))
+ {
+ limbo_die_node *asm_name;
+
+ asm_name = ggc_alloc_cleared_limbo_die_node ();
+ asm_name->die = die;
+ asm_name->created_for = decl;
+ asm_name->next = deferred_asm_name;
+ deferred_asm_name = asm_name;
+ }
+ else if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
+ add_AT_string (die, AT_linkage_name,
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+ }
+}
+
/* Add a DW_AT_name attribute and source coordinate attribute for the
given decl, but only if it actually has a name. */
@@ -17194,26 +17436,7 @@ add_name_and_src_coords_attributes (dw_die_ref die, tree decl)
if (! DECL_ARTIFICIAL (decl))
add_src_coords_attributes (die, decl);
- if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
- && TREE_PUBLIC (decl)
- && !DECL_ABSTRACT (decl)
- && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl)))
- {
- /* Defer until we have an assembler name set. */
- if (!DECL_ASSEMBLER_NAME_SET_P (decl))
- {
- limbo_die_node *asm_name;
-
- asm_name = GGC_CNEW (limbo_die_node);
- asm_name->die = die;
- asm_name->created_for = decl;
- asm_name->next = deferred_asm_name;
- deferred_asm_name = asm_name;
- }
- else if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
- add_AT_string (die, AT_linkage_name,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- }
+ add_linkage_name (die, decl);
}
#ifdef VMS_DEBUGGING_INFO
@@ -17228,6 +17451,39 @@ add_name_and_src_coords_attributes (dw_die_ref die, tree decl)
#endif
}
+#ifdef VMS_DEBUGGING_INFO
+
+/* Output the debug main pointer die for VMS */
+
+void
+dwarf2out_vms_debug_main_pointer (void)
+{
+ char label[MAX_ARTIFICIAL_LABEL_BYTES];
+ dw_die_ref die;
+
+ /* Allocate the VMS debug main subprogram die. */
+ die = ggc_alloc_cleared_die_node ();
+ die->die_tag = DW_TAG_subprogram;
+ add_name_attribute (die, VMS_DEBUG_MAIN_POINTER);
+ ASM_GENERATE_INTERNAL_LABEL (label, PROLOGUE_END_LABEL,
+ current_function_funcdef_no);
+ add_AT_lbl_id (die, DW_AT_entry_pc, label);
+
+ /* Make it the first child of comp_unit_die. */
+ die->die_parent = comp_unit_die;
+ if (comp_unit_die->die_child)
+ {
+ die->die_sib = comp_unit_die->die_child->die_sib;
+ comp_unit_die->die_child->die_sib = die;
+ }
+ else
+ {
+ die->die_sib = die;
+ comp_unit_die->die_child = die;
+ }
+}
+#endif
+
/* Push a new declaration scope. */
static void
@@ -17855,7 +18111,10 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die)
TREE_ASM_WRITTEN (type) = 1;
add_byte_size_attribute (type_die, type);
if (TYPE_STUB_DECL (type) != NULL_TREE)
- add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ {
+ add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ add_accessibility_attribute (type_die, TYPE_STUB_DECL (type));
+ }
/* If the first reference to this type was as the return type of an
inline function, then it may not have a parent. Fix this now. */
@@ -18362,10 +18621,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
if (DECL_ARTIFICIAL (decl))
add_AT_flag (subr_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (subr_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (subr_die, DW_AT_accessibility, DW_ACCESS_private);
+ add_accessibility_attribute (subr_die, decl);
}
if (declaration)
@@ -18429,6 +18685,32 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
current_function_funcdef_no);
add_AT_lbl_id (subr_die, DW_AT_high_pc, label_id);
+#if VMS_DEBUGGING_INFO
+ /* HP OpenVMS Industry Standard 64: DWARF Extensions
+ Section 2.3 Prologue and Epilogue Attributes:
+ When a breakpoint is set on entry to a function, it is generally
+ desirable for execution to be suspended, not on the very first
+ instruction of the function, but rather at a point after the
+ function's frame has been set up, after any language defined local
+ declaration processing has been completed, and before execution of
+ the first statement of the function begins. Debuggers generally
+ cannot properly determine where this point is. Similarly for a
+ breakpoint set on exit from a function. The prologue and epilogue
+ attributes allow a compiler to communicate the location(s) to use. */
+
+ {
+ dw_fde_ref fde = &fde_table[current_funcdef_fde];
+
+ if (fde->dw_fde_vms_end_prologue)
+ add_AT_vms_delta (subr_die, DW_AT_HP_prologue,
+ fde->dw_fde_begin, fde->dw_fde_vms_end_prologue);
+
+ if (fde->dw_fde_vms_begin_epilogue)
+ add_AT_vms_delta (subr_die, DW_AT_HP_epilogue,
+ fde->dw_fde_begin, fde->dw_fde_vms_begin_epilogue);
+ }
+#endif
+
add_pubname (decl, subr_die);
add_arange (decl, subr_die);
}
@@ -18805,6 +19087,9 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
if (get_AT_unsigned (old_die, DW_AT_decl_line) != (unsigned) s.line)
add_AT_unsigned (var_die, DW_AT_decl_line, s.line);
+
+ if (old_die->die_tag == DW_TAG_member)
+ add_linkage_name (var_die, decl);
}
}
else
@@ -18834,10 +19119,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
if (DECL_ARTIFICIAL (decl))
add_AT_flag (var_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_private);
+ add_accessibility_attribute (var_die, decl);
}
if (declaration)
@@ -19066,10 +19348,7 @@ gen_field_die (tree decl, dw_die_ref context_die)
if (DECL_ARTIFICIAL (decl))
add_AT_flag (decl_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_private);
+ add_accessibility_attribute (decl_die, decl);
/* Equate decl number to die, so that we can look up this decl later on. */
equate_decl_number_to_die (decl, decl_die);
@@ -19343,7 +19622,10 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
TREE_ASM_WRITTEN (type) = 1;
add_byte_size_attribute (type_die, type);
if (TYPE_STUB_DECL (type) != NULL_TREE)
- add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ {
+ add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ add_accessibility_attribute (type_die, TYPE_STUB_DECL (type));
+ }
/* If the first reference to this type was as the return type of an
inline function, then it may not have a parent. Fix this now. */
@@ -19426,10 +19708,38 @@ gen_typedef_die (tree decl, dw_die_ref context_die)
equate_type_number_to_die (TREE_TYPE (decl), type_die);
}
else
- type = TREE_TYPE (decl);
+ {
+ type = TREE_TYPE (decl);
+
+ if (is_naming_typedef_decl (TYPE_NAME (type)))
+ /*
+ Here, we are in the case of decl being a typedef naming
+ an anonymous type, e.g:
+ typedef struct {...} foo;
+ In that case TREE_TYPE (decl) is not a typedef variant
+ type and TYPE_NAME of the anonymous type is set to the
+ TYPE_DECL of the typedef. This construct is emitted by
+ the C++ FE.
+
+ TYPE is the anonymous struct named by the typedef
+ DECL. As we need the DW_AT_type attribute of the
+ DW_TAG_typedef to point to the DIE of TYPE, let's
+ generate that DIE right away. add_type_attribute
+ called below will then pick (via lookup_type_die) that
+ anonymous struct DIE. */
+ gen_tagged_type_die (type, context_die, DINFO_USAGE_DIR_USE);
+ }
add_type_attribute (type_die, type, TREE_READONLY (decl),
TREE_THIS_VOLATILE (decl), context_die);
+
+ if (is_naming_typedef_decl (decl))
+ /* We want that all subsequent calls to lookup_type_die with
+ TYPE in argument yield the DW_TAG_typedef we have just
+ created. */
+ equate_type_number_to_die (type, type_die);
+
+ add_accessibility_attribute (type_die, decl);
}
if (DECL_ABSTRACT (decl))
@@ -19439,13 +19749,78 @@ gen_typedef_die (tree decl, dw_die_ref context_die)
add_pubtype (decl, type_die);
}
+/* Generate a DIE for a struct, class, enum or union type. */
+
+static void
+gen_tagged_type_die (tree type,
+ dw_die_ref context_die,
+ enum debug_info_usage usage)
+{
+ int need_pop;
+
+ if (type == NULL_TREE
+ || !is_tagged_type (type))
+ return;
+
+ /* If this is a nested type whose containing class hasn't been written
+ out yet, writing it out will cover this one, too. This does not apply
+ to instantiations of member class templates; they need to be added to
+ the containing class as they are generated. FIXME: This hurts the
+ idea of combining type decls from multiple TUs, since we can't predict
+ what set of template instantiations we'll get. */
+ if (TYPE_CONTEXT (type)
+ && AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
+ && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
+ {
+ gen_type_die_with_usage (TYPE_CONTEXT (type), context_die, usage);
+
+ if (TREE_ASM_WRITTEN (type))
+ return;
+
+ /* If that failed, attach ourselves to the stub. */
+ push_decl_scope (TYPE_CONTEXT (type));
+ context_die = lookup_type_die (TYPE_CONTEXT (type));
+ need_pop = 1;
+ }
+ else if (TYPE_CONTEXT (type) != NULL_TREE
+ && (TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL))
+ {
+ /* If this type is local to a function that hasn't been written
+ out yet, use a NULL context for now; it will be fixed up in
+ decls_for_scope. */
+ context_die = lookup_decl_die (TYPE_CONTEXT (type));
+ need_pop = 0;
+ }
+ else
+ {
+ context_die = declare_in_namespace (type, context_die);
+ need_pop = 0;
+ }
+
+ if (TREE_CODE (type) == ENUMERAL_TYPE)
+ {
+ /* This might have been written out by the call to
+ declare_in_namespace. */
+ if (!TREE_ASM_WRITTEN (type))
+ gen_enumeration_type_die (type, context_die);
+ }
+ else
+ gen_struct_or_union_type_die (type, context_die, usage);
+
+ if (need_pop)
+ pop_decl_scope ();
+
+ /* Don't set TREE_ASM_WRITTEN on an incomplete struct; we want to fix
+ it up if it is ever completed. gen_*_type_die will set it for us
+ when appropriate. */
+}
+
/* Generate a type description DIE. */
static void
gen_type_die_with_usage (tree type, dw_die_ref context_die,
enum debug_info_usage usage)
{
- int need_pop;
struct array_descr_info info;
if (type == NULL_TREE || type == error_mark_node)
@@ -19453,8 +19828,7 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
/* If TYPE is a typedef type variant, let's generate debug info
for the parent typedef which TYPE is a type of. */
- if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
+ if (typedef_variant_p (type))
{
if (TREE_ASM_WRITTEN (type))
return;
@@ -19469,6 +19843,21 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type)));
TREE_ASM_WRITTEN (type) = 1;
+
+ gen_decl_die (TYPE_NAME (type), NULL, context_die);
+ return;
+ }
+
+ /* If type is an anonymous tagged type named by a typedef, let's
+ generate debug info for the typedef. */
+ if (is_naming_typedef_decl (TYPE_NAME (type)))
+ {
+ /* Use the DIE of the containing namespace as the parent DIE of
+ the type description DIE we want to generate. */
+ if (DECL_CONTEXT (TYPE_NAME (type))
+ && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL)
+ context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type)));
+
gen_decl_die (TYPE_NAME (type), NULL, context_die);
return;
}
@@ -19556,57 +19945,7 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
case RECORD_TYPE:
case UNION_TYPE:
case QUAL_UNION_TYPE:
- /* If this is a nested type whose containing class hasn't been written
- out yet, writing it out will cover this one, too. This does not apply
- to instantiations of member class templates; they need to be added to
- the containing class as they are generated. FIXME: This hurts the
- idea of combining type decls from multiple TUs, since we can't predict
- what set of template instantiations we'll get. */
- if (TYPE_CONTEXT (type)
- && AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
- && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
- {
- gen_type_die_with_usage (TYPE_CONTEXT (type), context_die, usage);
-
- if (TREE_ASM_WRITTEN (type))
- return;
-
- /* If that failed, attach ourselves to the stub. */
- push_decl_scope (TYPE_CONTEXT (type));
- context_die = lookup_type_die (TYPE_CONTEXT (type));
- need_pop = 1;
- }
- else if (TYPE_CONTEXT (type) != NULL_TREE
- && (TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL))
- {
- /* If this type is local to a function that hasn't been written
- out yet, use a NULL context for now; it will be fixed up in
- decls_for_scope. */
- context_die = lookup_decl_die (TYPE_CONTEXT (type));
- need_pop = 0;
- }
- else
- {
- context_die = declare_in_namespace (type, context_die);
- need_pop = 0;
- }
-
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- {
- /* This might have been written out by the call to
- declare_in_namespace. */
- if (!TREE_ASM_WRITTEN (type))
- gen_enumeration_type_die (type, context_die);
- }
- else
- gen_struct_or_union_type_die (type, context_die, usage);
-
- if (need_pop)
- pop_decl_scope ();
-
- /* Don't set TREE_ASM_WRITTEN on an incomplete struct; we want to fix
- it up if it is ever completed. gen_*_type_die will set it for us
- when appropriate. */
+ gen_tagged_type_die (type, context_die, usage);
return;
case VOID_TYPE:
@@ -19814,6 +20153,36 @@ is_redundant_typedef (const_tree decl)
return 0;
}
+/* Return TRUE if TYPE is a typedef that names a type for linkage
+ purposes. This kind of typedefs is produced by the C++ FE for
+ constructs like:
+
+ typedef struct {...} foo;
+
+ In that case, there is no typedef variant type produced for foo.
+ Rather, the TREE_TYPE of the TYPE_DECL of foo is the anonymous
+ struct type. */
+
+static bool
+is_naming_typedef_decl (const_tree decl)
+{
+ if (decl == NULL_TREE
+ || TREE_CODE (decl) != TYPE_DECL
+ || !is_tagged_type (TREE_TYPE (decl))
+ || DECL_IS_BUILTIN (decl)
+ || is_redundant_typedef (decl)
+ /* It looks like Ada produces TYPE_DECLs that are very similar
+ to C++ naming typedefs but that have different
+ semantics. Let's be specific to c++ for now. */
+ || !is_cxx ())
+ return FALSE;
+
+ return (DECL_ORIGINAL_TYPE (decl) == NULL_TREE
+ && TYPE_NAME (TREE_TYPE (decl)) == decl
+ && (TYPE_STUB_DECL (TREE_TYPE (decl))
+ != TYPE_NAME (TREE_TYPE (decl))));
+}
+
/* Returns the DIE for a context. */
static inline dw_die_ref
@@ -20591,7 +20960,7 @@ lookup_filename (const char *file_name)
if (*slot)
return (struct dwarf_file_data *) *slot;
- created = GGC_NEW (struct dwarf_file_data);
+ created = ggc_alloc_dwarf_file_data ();
created->filename = file_name;
created->emitted_number = 0;
*slot = created;
@@ -20747,7 +21116,7 @@ vcall_insn_table_eq (const void *x, const void *y)
static void
store_vcall_insn (unsigned int vtable_slot, int insn_uid)
{
- struct vcall_insn *item = GGC_NEW (struct vcall_insn);
+ struct vcall_insn *item = ggc_alloc_vcall_insn ();
struct vcall_insn **slot;
gcc_assert (item);
@@ -21105,13 +21474,15 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
decl_scope_table = VEC_alloc (tree, gc, 256);
/* Allocate the initial hunk of the abbrev_die_table. */
- abbrev_die_table = GGC_CNEWVEC (dw_die_ref, ABBREV_DIE_TABLE_INCREMENT);
+ abbrev_die_table = ggc_alloc_cleared_vec_dw_die_ref
+ (ABBREV_DIE_TABLE_INCREMENT);
abbrev_die_table_allocated = ABBREV_DIE_TABLE_INCREMENT;
/* Zero-th entry is allocated, but unused. */
abbrev_die_table_in_use = 1;
/* Allocate the initial hunk of the line_info_table. */
- line_info_table = GGC_CNEWVEC (dw_line_info_entry, LINE_INFO_TABLE_INCREMENT);
+ line_info_table = ggc_alloc_cleared_vec_dw_line_info_entry
+ (LINE_INFO_TABLE_INCREMENT);
line_info_table_allocated = LINE_INFO_TABLE_INCREMENT;
/* Zero-th entry is allocated, but unused. */
@@ -22129,6 +22500,7 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
0, /* source_line */
0, /* begin_prologue */
0, /* end_prologue */
+ 0, /* begin_epilogue */
0, /* end_epilogue */
0, /* begin_function */
0, /* end_function */
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index 85c320dfbd5..d70b26f6ffd 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -1,5 +1,5 @@
/* dwarf2out.h - Various declarations for functions found in dwarf2out.c
- Copyright (C) 1998, 1999, 2000, 2003, 2007
+ Copyright (C) 1998, 1999, 2000, 2003, 2007, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -20,13 +20,16 @@ along with GCC; see the file COPYING3. If not see
extern void dwarf2out_decl (tree);
extern void dwarf2out_frame_debug (rtx, bool);
-extern void dwarf2out_begin_epilogue (rtx);
+extern void dwarf2out_cfi_begin_epilogue (rtx);
extern void dwarf2out_frame_debug_restore_state (void);
extern void debug_dwarf (void);
struct die_struct;
extern void debug_dwarf_die (struct die_struct *);
extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *));
+#ifdef VMS_DEBUGGING_INFO
+extern void dwarf2out_vms_debug_main_pointer (void);
+#endif
struct array_descr_info
{
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 3f7fb5f895a..6dae9962cff 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -341,7 +341,7 @@ get_mem_attrs (alias_set_type alias, tree expr, rtx offset, rtx size,
slot = htab_find_slot (mem_attrs_htab, &attrs, INSERT);
if (*slot == 0)
{
- *slot = ggc_alloc (sizeof (mem_attrs));
+ *slot = ggc_alloc_mem_attrs ();
memcpy (*slot, &attrs, sizeof (mem_attrs));
}
@@ -390,7 +390,7 @@ get_reg_attrs (tree decl, int offset)
slot = htab_find_slot (reg_attrs_htab, &attrs, INSERT);
if (*slot == 0)
{
- *slot = ggc_alloc (sizeof (reg_attrs));
+ *slot = ggc_alloc_reg_attrs ();
memcpy (*slot, &attrs, sizeof (reg_attrs));
}
@@ -1614,6 +1614,35 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
|| TREE_CODE (t) == ALIGN_INDIRECT_REF
|| TYPE_ALIGN_OK (type))
align = MAX (align, TYPE_ALIGN (type));
+ else if (TREE_CODE (t) == MEM_REF)
+ {
+ unsigned HOST_WIDE_INT aoff = BITS_PER_UNIT;
+ if (host_integerp (TREE_OPERAND (t, 1), 1))
+ {
+ unsigned HOST_WIDE_INT ioff = TREE_INT_CST_LOW (TREE_OPERAND (t, 1));
+ aoff = (ioff & -ioff) * BITS_PER_UNIT;
+ }
+ if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
+ && DECL_P (TREE_OPERAND (TREE_OPERAND (t, 0), 0)))
+ align = MAX (align,
+ DECL_ALIGN (TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
+ else if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
+ && CONSTANT_CLASS_P (TREE_OPERAND (TREE_OPERAND (t, 0), 0)))
+ {
+ align = TYPE_ALIGN (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
+#ifdef CONSTANT_ALIGNMENT
+ align = CONSTANT_ALIGNMENT (TREE_OPERAND (TREE_OPERAND (t, 0), 0), align);
+#endif
+ }
+ else
+ /* This technically isn't correct. We can't really derive
+ alignment information from types. */
+ align = MAX (align,
+ TYPE_ALIGN (TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 1)))));
+ if (!integer_zerop (TREE_OPERAND (t, 1))
+ && aoff < align)
+ align = aoff;
+ }
else
if (TREE_CODE (t) == MISALIGNED_INDIRECT_REF)
{
@@ -1654,6 +1683,9 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
|| TREE_CODE (base) == BIT_FIELD_REF)
base = TREE_OPERAND (base, 0);
+ if (TREE_CODE (base) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR)
+ base = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
if (DECL_P (base))
{
if (CODE_CONTAINS_STRUCT (TREE_CODE (base), TS_DECL_WITH_VIS))
@@ -1668,12 +1700,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
if (base && DECL_P (base)
&& TREE_READONLY (base)
&& (TREE_STATIC (base) || DECL_EXTERNAL (base)))
- {
- tree base_type = TREE_TYPE (base);
- gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING (base_type))
- || DECL_ARTIFICIAL (base));
- MEM_READONLY_P (ref) = 1;
- }
+ MEM_READONLY_P (ref) = 1;
/* If this expression uses it's parent's alias set, mark it such
that we won't change it. */
@@ -1779,7 +1806,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
}
/* If this is an indirect reference, record it. */
- else if (TREE_CODE (t) == INDIRECT_REF
+ else if (TREE_CODE (t) == MEM_REF
|| TREE_CODE (t) == MISALIGNED_INDIRECT_REF)
{
expr = t;
@@ -1789,7 +1816,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
}
/* If this is an indirect reference, record it. */
- else if (TREE_CODE (t) == INDIRECT_REF
+ else if (TREE_CODE (t) == MEM_REF
|| TREE_CODE (t) == MISALIGNED_INDIRECT_REF)
{
expr = t;
@@ -5240,7 +5267,7 @@ start_sequence (void)
free_sequence_stack = tem->next;
}
else
- tem = GGC_NEW (struct sequence_stack);
+ tem = ggc_alloc_sequence_stack ();
tem->next = seq_stack;
tem->first = get_insns ();
@@ -5555,8 +5582,7 @@ init_emit (void)
crtl->emit.regno_pointer_align
= XCNEWVEC (unsigned char, crtl->emit.regno_pointer_align_length);
- regno_reg_rtx
- = GGC_NEWVEC (rtx, crtl->emit.regno_pointer_align_length);
+ regno_reg_rtx = ggc_alloc_vec_rtx (crtl->emit.regno_pointer_align_length);
/* Put copies of all the hard registers into regno_reg_rtx. */
memcpy (regno_reg_rtx,
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index 704f901f069..1b2c162b785 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -76,7 +76,7 @@ get_insns (void)
static inline void
set_first_insn (rtx insn)
{
- gcc_assert (!insn || !PREV_INSN (insn));
+ gcc_checking_assert (!insn || !PREV_INSN (insn));
crtl->emit.x_first_insn = insn;
}
@@ -93,7 +93,7 @@ get_last_insn (void)
static inline void
set_last_insn (rtx insn)
{
- gcc_assert (!insn || !NEXT_INSN (insn));
+ gcc_checking_assert (!insn || !NEXT_INSN (insn));
crtl->emit.x_last_insn = insn;
}
diff --git a/gcc/except.c b/gcc/except.c
index d166a9a1527..419936a4838 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see
During pass_lower_eh (tree-eh.c) we record the nested structure
of the TRY nodes in EH_REGION nodes in CFUN->EH->REGION_TREE.
- We expand the lang_protect_cleanup_actions hook into MUST_NOT_THROW
+ We expand the eh_protect_cleanup_actions langhook into MUST_NOT_THROW
regions at this time. We can then flatten the statements within
the TRY nodes to straight-line code. Statements that had been within
TRY nodes that can throw are recorded within CFUN->EH->THROW_STMT_TABLE,
@@ -150,10 +150,6 @@ along with GCC; see the file COPYING3. If not see
#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
#endif
-/* Protect cleanup actions with must-not-throw regions, with a call
- to the given failure handler. */
-tree (*lang_protect_cleanup_actions) (void);
-
static GTY(()) int call_site_base;
static GTY ((param_is (union tree_node)))
htab_t type_to_runtime_map;
@@ -203,30 +199,6 @@ static void dw2_output_call_site_table (int, int);
static void sjlj_output_call_site_table (void);
-/* Routine to see if exception handling is turned on.
- DO_WARN is nonzero if we want to inform the user that exception
- handling is turned off.
-
- This is used to ensure that -fexceptions has been specified if the
- compiler tries to use any exception-specific functions. */
-
-int
-doing_eh (int do_warn)
-{
- if (! flag_exceptions)
- {
- static int warned = 0;
- if (! warned && do_warn)
- {
- error ("exception handling disabled, use -fexceptions to enable");
- warned = 1;
- }
- return 0;
- }
- return 1;
-}
-
-
void
init_eh (void)
{
@@ -329,7 +301,7 @@ init_eh (void)
void
init_eh_for_function (void)
{
- cfun->eh = GGC_CNEW (struct eh_status);
+ cfun->eh = ggc_alloc_cleared_eh_status ();
/* Make sure zero'th entries are used. */
VEC_safe_push (eh_region, gc, cfun->eh->region_array, NULL);
@@ -345,12 +317,8 @@ gen_eh_region (enum eh_region_type type, eh_region outer)
{
eh_region new_eh;
-#ifdef ENABLE_CHECKING
- gcc_assert (doing_eh (0));
-#endif
-
/* Insert a new blank region as a leaf in the tree. */
- new_eh = GGC_CNEW (struct eh_region_d);
+ new_eh = ggc_alloc_cleared_eh_region_d ();
new_eh->type = type;
new_eh->outer = outer;
if (outer)
@@ -407,7 +375,7 @@ gen_eh_region_catch (eh_region t, tree type_or_list)
add_type_for_runtime (TREE_VALUE (type_node));
}
- c = GGC_CNEW (struct eh_catch_d);
+ c = ggc_alloc_cleared_eh_catch_d ();
c->type_list = type_list;
l = t->u.eh_try.last_catch;
c->prev_catch = l;
@@ -441,7 +409,7 @@ gen_eh_region_must_not_throw (eh_region outer)
eh_landing_pad
gen_eh_landing_pad (eh_region region)
{
- eh_landing_pad lp = GGC_CNEW (struct eh_landing_pad_d);
+ eh_landing_pad lp = ggc_alloc_cleared_eh_landing_pad_d ();
lp->next_lp = region->landing_pads;
lp->region = region;
@@ -1617,6 +1585,8 @@ make_reg_eh_region_note_nothrow_nononlocal (rtx insn)
bool
insn_could_throw_p (const_rtx insn)
{
+ if (!flag_exceptions)
+ return false;
if (CALL_P (insn))
return true;
if (INSN_P (insn) && cfun->can_throw_non_call_exceptions)
@@ -2368,7 +2338,7 @@ add_call_site (rtx landing_pad, int action, int section)
{
call_site_record record;
- record = GGC_NEW (struct call_site_record_d);
+ record = ggc_alloc_call_site_record_d ();
record->landing_pad = landing_pad;
record->action = action;
@@ -2960,7 +2930,7 @@ output_one_function_exception_table (const char * ARG_UNUSED (fnname),
#endif
/* If the target wants a label to begin the table, emit it here. */
- targetm.asm_out.except_table_label (asm_out_file);
+ targetm.asm_out.emit_except_table_label (asm_out_file);
have_tt_data = (VEC_length (tree, cfun->eh->ttype_data)
|| (targetm.arm_eabi_unwinder
diff --git a/gcc/except.h b/gcc/except.h
index ef511c90515..72fd76ef646 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -19,6 +19,13 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+/* No include guards here, but define an include file marker anyway, so
+ that the compiler can keep track of where this file is included. This
+ is e.g. used to avoid including this file in front-end specific files. */
+#ifndef GCC_EXCEPT_H
+# define GCC_EXCEPT_H
+#endif
+
#include "hashtab.h"
#include "vecprim.h"
#include "vecir.h"
@@ -222,14 +229,10 @@ struct GTY(()) eh_status
};
-/* Test: is exception handling turned on? */
-extern int doing_eh (int);
-
/* Invokes CALLBACK for every exception handler label. Only used by old
loop hackery; should not be used by new code. */
extern void for_each_eh_label (void (*) (rtx));
-extern void init_eh (void);
extern void init_eh_for_function (void);
extern void remove_eh_landing_pad (eh_landing_pad);
@@ -287,58 +290,6 @@ extern void assign_filter_values (void);
extern eh_region get_eh_region_from_rtx (const_rtx);
extern eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx);
-/* If non-NULL, this is a function that returns a function decl to be
- executed if an unhandled exception is propagated out of a cleanup
- region. For example, in C++, an exception thrown by a destructor
- during stack unwinding is required to result in a call to
- `std::terminate', so the C++ version of this function returns a
- FUNCTION_DECL for `std::terminate'. */
-extern tree (*lang_protect_cleanup_actions) (void);
-
-
-/* Just because the user configured --with-sjlj-exceptions=no doesn't
- mean that we can use call frame exceptions. Detect that the target
- has appropriate support. */
-
-#ifndef MUST_USE_SJLJ_EXCEPTIONS
-# if defined (EH_RETURN_DATA_REGNO) \
- && (defined (TARGET_UNWIND_INFO) \
- || (DWARF2_UNWIND_INFO \
- && (defined (EH_RETURN_HANDLER_RTX) \
- || defined (HAVE_eh_return))))
-# define MUST_USE_SJLJ_EXCEPTIONS 0
-# else
-# define MUST_USE_SJLJ_EXCEPTIONS 1
-# endif
-#endif
-
-#ifdef CONFIG_SJLJ_EXCEPTIONS
-# if CONFIG_SJLJ_EXCEPTIONS == 1
-# define USING_SJLJ_EXCEPTIONS 1
-# endif
-# if CONFIG_SJLJ_EXCEPTIONS == 0
-# define USING_SJLJ_EXCEPTIONS 0
-# if !defined(EH_RETURN_DATA_REGNO)
- #error "EH_RETURN_DATA_REGNO required"
-# endif
-# if ! (defined(TARGET_UNWIND_INFO) || DWARF2_UNWIND_INFO)
- #error "{DWARF2,TARGET}_UNWIND_INFO required"
-# endif
-# if !defined(TARGET_UNWIND_INFO) \
- && !(defined(EH_RETURN_HANDLER_RTX) || defined(HAVE_eh_return))
- #error "EH_RETURN_HANDLER_RTX or eh_return required"
-# endif
-/* Usually the above error checks will have already triggered an
- error, but backends may set MUST_USE_SJLJ_EXCEPTIONS for their own
- reasons. */
-# if MUST_USE_SJLJ_EXCEPTIONS
- #error "Must use SJLJ exceptions but configured not to"
-# endif
-# endif
-#else
-# define USING_SJLJ_EXCEPTIONS MUST_USE_SJLJ_EXCEPTIONS
-#endif
-
struct GTY(()) throw_stmt_node {
gimple stmt;
int lp_nr;
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 017e208a801..9aa61a8f244 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -301,7 +301,7 @@ negate_rtx (enum machine_mode mode, rtx x)
enum machine_mode
mode_for_extraction (enum extraction_pattern pattern, int opno)
{
- const struct insn_data *data;
+ const struct insn_data_d *data;
switch (pattern)
{
@@ -903,8 +903,14 @@ store_fixed_bit_field (rtx op0, unsigned HOST_WIDE_INT offset,
if (GET_MODE_BITSIZE (mode) == 0
|| GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (word_mode))
mode = word_mode;
- mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
- MEM_ALIGN (op0), mode, MEM_VOLATILE_P (op0));
+
+ if (MEM_VOLATILE_P (op0)
+ && GET_MODE_BITSIZE (GET_MODE (op0)) > 0
+ && flag_strict_volatile_bitfields > 0)
+ mode = GET_MODE (op0);
+ else
+ mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
+ MEM_ALIGN (op0), mode, MEM_VOLATILE_P (op0));
if (mode == VOIDmode)
{
@@ -1377,6 +1383,14 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
? mode_for_size (bitsize, GET_MODE_CLASS (tmode), 0)
: mode);
+ /* If the bitfield is volatile, we need to make sure the access
+ remains on a type-aligned boundary. */
+ if (GET_CODE (op0) == MEM
+ && MEM_VOLATILE_P (op0)
+ && GET_MODE_BITSIZE (GET_MODE (op0)) > 0
+ && flag_strict_volatile_bitfields > 0)
+ goto no_subreg_mode_swap;
+
if (((bitsize >= BITS_PER_WORD && bitsize == GET_MODE_BITSIZE (mode)
&& bitpos % BITS_PER_WORD == 0)
|| (mode1 != BLKmode
@@ -1729,8 +1743,19 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
includes the entire field. If such a mode would be larger than
a word, we won't be doing the extraction the normal way. */
- mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
- MEM_ALIGN (op0), word_mode, MEM_VOLATILE_P (op0));
+ if (MEM_VOLATILE_P (op0)
+ && flag_strict_volatile_bitfields > 0)
+ {
+ if (GET_MODE_BITSIZE (GET_MODE (op0)) > 0)
+ mode = GET_MODE (op0);
+ else if (target && GET_MODE_BITSIZE (GET_MODE (target)) > 0)
+ mode = GET_MODE (target);
+ else
+ mode = tmode;
+ }
+ else
+ mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
+ MEM_ALIGN (op0), word_mode, MEM_VOLATILE_P (op0));
if (mode == VOIDmode)
/* The only way this should occur is if the field spans word
@@ -1751,12 +1776,51 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
* BITS_PER_UNIT);
}
- /* Get ref to an aligned byte, halfword, or word containing the field.
- Adjust BITPOS to be position within a word,
- and OFFSET to be the offset of that word.
- Then alter OP0 to refer to that word. */
- bitpos += (offset % (total_bits / BITS_PER_UNIT)) * BITS_PER_UNIT;
- offset -= (offset % (total_bits / BITS_PER_UNIT));
+ /* If we're accessing a volatile MEM, we can't do the next
+ alignment step if it results in a multi-word access where we
+ otherwise wouldn't have one. So, check for that case
+ here. */
+ if (MEM_P (op0)
+ && MEM_VOLATILE_P (op0)
+ && flag_strict_volatile_bitfields > 0
+ && bitpos + bitsize <= total_bits
+ && bitpos + bitsize + (offset % (total_bits / BITS_PER_UNIT)) * BITS_PER_UNIT > total_bits)
+ {
+ if (STRICT_ALIGNMENT)
+ {
+ static bool informed_about_misalignment = false;
+ bool warned;
+
+ if (bitsize == total_bits)
+ warned = warning_at (input_location, OPT_fstrict_volatile_bitfields,
+ "mis-aligned access used for structure member");
+ else
+ warned = warning_at (input_location, OPT_fstrict_volatile_bitfields,
+ "mis-aligned access used for structure bitfield");
+
+ if (! informed_about_misalignment && warned)
+ {
+ informed_about_misalignment = true;
+ inform (input_location,
+ "When a volatile object spans multiple type-sized locations,"
+ " the compiler must choose between using a single mis-aligned access to"
+ " preserve the volatility, or using multiple aligned accesses to avoid"
+ " runtime faults. This code may fail at runtime if the hardware does"
+ " not allow this access.");
+ }
+ }
+ }
+ else
+ {
+
+ /* Get ref to an aligned byte, halfword, or word containing the field.
+ Adjust BITPOS to be position within a word,
+ and OFFSET to be the offset of that word.
+ Then alter OP0 to refer to that word. */
+ bitpos += (offset % (total_bits / BITS_PER_UNIT)) * BITS_PER_UNIT;
+ offset -= (offset % (total_bits / BITS_PER_UNIT));
+ }
+
op0 = adjust_address (op0, mode, offset);
}
diff --git a/gcc/expr.c b/gcc/expr.c
index 6b2feb685a4..a2a8054eb4e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1276,12 +1276,14 @@ block_move_libcall_safe_for_call_parm (void)
for ( ; arg != void_list_node ; arg = TREE_CHAIN (arg))
{
enum machine_mode mode = TYPE_MODE (TREE_VALUE (arg));
- rtx tmp = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
+ rtx tmp = targetm.calls.function_arg (&args_so_far, mode,
+ NULL_TREE, true);
if (!tmp || !REG_P (tmp))
return false;
if (targetm.calls.arg_partial_bytes (&args_so_far, mode, NULL, 1))
return false;
- FUNCTION_ARG_ADVANCE (args_so_far, mode, NULL_TREE, 1);
+ targetm.calls.function_arg_advance (&args_so_far, mode,
+ NULL_TREE, true);
}
}
return true;
@@ -4211,6 +4213,10 @@ expand_assignment (tree to, tree from, bool nontemporal)
an array element in an unaligned packed structure field, has the same
problem. */
if (handled_component_p (to)
+ /* ??? We only need to handle MEM_REF here if the access is not
+ a full access of the base object. */
+ || (TREE_CODE (to) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (to, 0)) == ADDR_EXPR)
|| TREE_CODE (TREE_TYPE (to)) == ARRAY_TYPE)
{
enum machine_mode mode1;
@@ -4229,6 +4235,13 @@ expand_assignment (tree to, tree from, bool nontemporal)
to_rtx = expand_normal (tem);
+ /* If the bitfield is volatile, we want to access it in the
+ field's mode, not the computed mode. */
+ if (volatilep
+ && GET_CODE (to_rtx) == MEM
+ && flag_strict_volatile_bitfields > 0)
+ to_rtx = adjust_address (to_rtx, mode1, 0);
+
if (offset != 0)
{
enum machine_mode address_mode;
@@ -4677,6 +4690,51 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
BLOCK_OP_NORMAL);
return NULL_RTX;
}
+ else if (TREE_CODE (exp) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == STRING_CST
+ && integer_zerop (TREE_OPERAND (exp, 1))
+ && !nontemporal && !call_param_p
+ && TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
+ {
+ /* Optimize initialization of an array with a STRING_CST. */
+ HOST_WIDE_INT exp_len, str_copy_len;
+ rtx dest_mem;
+ tree str = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
+
+ exp_len = int_expr_size (exp);
+ if (exp_len <= 0)
+ goto normal_expr;
+
+ str_copy_len = strlen (TREE_STRING_POINTER (str));
+ if (str_copy_len < TREE_STRING_LENGTH (str) - 1)
+ goto normal_expr;
+
+ str_copy_len = TREE_STRING_LENGTH (str);
+ if ((STORE_MAX_PIECES & (STORE_MAX_PIECES - 1)) == 0)
+ {
+ str_copy_len += STORE_MAX_PIECES - 1;
+ str_copy_len &= ~(STORE_MAX_PIECES - 1);
+ }
+ str_copy_len = MIN (str_copy_len, exp_len);
+ if (!can_store_by_pieces (str_copy_len, builtin_strncpy_read_str,
+ CONST_CAST(char *, TREE_STRING_POINTER (str)),
+ MEM_ALIGN (target), false))
+ goto normal_expr;
+
+ dest_mem = target;
+
+ dest_mem = store_by_pieces (dest_mem,
+ str_copy_len, builtin_strncpy_read_str,
+ CONST_CAST(char *, TREE_STRING_POINTER (str)),
+ MEM_ALIGN (target), false,
+ exp_len > str_copy_len ? 1 : 0);
+ if (exp_len > str_copy_len)
+ clear_storage (adjust_address (dest_mem, BLKmode, 0),
+ GEN_INT (exp_len - str_copy_len),
+ BLOCK_OP_NORMAL);
+ return NULL_RTX;
+ }
else
{
rtx tmp_target;
@@ -5843,7 +5901,15 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
operations. */
|| (bitsize >= 0
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) == INTEGER_CST
- && compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), bitsize) != 0))
+ && compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), bitsize) != 0)
+ /* If we are expanding a MEM_REF of a non-BLKmode non-addressable
+ decl we must use bitfield operations. */
+ || (bitsize >= 0
+ && TREE_CODE (exp) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
+ && DECL_P (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
+ && !TREE_ADDRESSABLE (TREE_OPERAND (TREE_OPERAND (exp, 0),0 ))
+ && DECL_MODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) != BLKmode))
{
rtx temp;
gimple nop_def;
@@ -5977,7 +6043,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
enum machine_mode mode = VOIDmode;
bool blkmode_bitfield = false;
tree offset = size_zero_node;
- tree bit_offset = bitsize_zero_node;
+ double_int bit_offset = double_int_zero;
/* First get the mode, signedness, and size. We do this from just the
outermost expression. */
@@ -5990,6 +6056,12 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
mode = DECL_MODE (field);
else if (DECL_MODE (field) == BLKmode)
blkmode_bitfield = true;
+ else if (TREE_THIS_VOLATILE (exp)
+ && flag_strict_volatile_bitfields > 0)
+ /* Volatile bitfields should be accessed in the mode of the
+ field's type, not the mode computed based on the bit
+ size. */
+ mode = TYPE_MODE (DECL_BIT_FIELD_TYPE (field));
*punsignedp = DECL_UNSIGNED (field);
}
@@ -6032,8 +6104,9 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
switch (TREE_CODE (exp))
{
case BIT_FIELD_REF:
- bit_offset = size_binop (PLUS_EXPR, bit_offset,
- TREE_OPERAND (exp, 2));
+ bit_offset
+ = double_int_add (bit_offset,
+ tree_to_double_int (TREE_OPERAND (exp, 2)));
break;
case COMPONENT_REF:
@@ -6048,8 +6121,9 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
break;
offset = size_binop (PLUS_EXPR, offset, this_offset);
- bit_offset = size_binop (PLUS_EXPR, bit_offset,
- DECL_FIELD_BIT_OFFSET (field));
+ bit_offset = double_int_add (bit_offset,
+ tree_to_double_int
+ (DECL_FIELD_BIT_OFFSET (field)));
/* ??? Right now we don't do anything with DECL_OFFSET_ALIGN. */
}
@@ -6081,8 +6155,8 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
break;
case IMAGPART_EXPR:
- bit_offset = size_binop (PLUS_EXPR, bit_offset,
- bitsize_int (*pbitsize));
+ bit_offset = double_int_add (bit_offset,
+ uhwi_to_double_int (*pbitsize));
break;
case VIEW_CONVERT_EXPR:
@@ -6096,6 +6170,24 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
goto done;
break;
+ case MEM_REF:
+ /* Hand back the decl for MEM[&decl, off]. */
+ if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR)
+ {
+ tree off = TREE_OPERAND (exp, 1);
+ if (!integer_zerop (off))
+ {
+ double_int boff, coff = mem_ref_offset (exp);
+ boff = double_int_lshift (coff,
+ BITS_PER_UNIT == 8
+ ? 3 : exact_log2 (BITS_PER_UNIT),
+ HOST_BITS_PER_DOUBLE_INT, true);
+ bit_offset = double_int_add (bit_offset, boff);
+ }
+ exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
+ }
+ goto done;
+
default:
goto done;
}
@@ -6113,9 +6205,11 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
this conversion. */
if (host_integerp (offset, 0))
{
- double_int tem = double_int_mul (tree_to_double_int (offset),
- uhwi_to_double_int (BITS_PER_UNIT));
- tem = double_int_add (tem, tree_to_double_int (bit_offset));
+ double_int tem = double_int_lshift (tree_to_double_int (offset),
+ BITS_PER_UNIT == 8
+ ? 3 : exact_log2 (BITS_PER_UNIT),
+ HOST_BITS_PER_DOUBLE_INT, true);
+ tem = double_int_add (tem, bit_offset);
if (double_int_fits_in_shwi_p (tem))
{
*pbitpos = double_int_to_shwi (tem);
@@ -6126,7 +6220,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
/* Otherwise, split it up. */
if (offset)
{
- *pbitpos = tree_low_cst (bit_offset, 0);
+ *pbitpos = double_int_to_shwi (bit_offset);
*poffset = offset;
}
@@ -6854,6 +6948,16 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
/* This case will happen via recursion for &a->b. */
return expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
+ case MEM_REF:
+ {
+ tree tem = TREE_OPERAND (exp, 0);
+ if (!integer_zerop (TREE_OPERAND (exp, 1)))
+ tem = build2 (POINTER_PLUS_EXPR, TREE_TYPE (TREE_OPERAND (exp, 1)),
+ tem,
+ double_int_to_tree (sizetype, mem_ref_offset (exp)));
+ return expand_expr (tem, target, tmode, modifier);
+ }
+
case CONST_DECL:
/* Expand the initializer like constants above. */
return XEXP (expand_expr_constant (DECL_INITIAL (exp), 0, modifier), 0);
@@ -7222,8 +7326,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
rtx subtarget, original_target;
int ignore;
bool reduce_bit_field;
- gimple subexp0_def, subexp1_def;
- tree top0, top1;
location_t loc = ops->location;
tree treeop0, treeop1;
#define REDUCE_BIT_FIELD(expr) (reduce_bit_field \
@@ -7243,7 +7345,8 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
exactly those that are valid in gimple expressions that aren't
GIMPLE_SINGLE_RHS (or invalid). */
gcc_assert (get_gimple_rhs_class (code) == GIMPLE_UNARY_RHS
- || get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS);
+ || get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS
+ || get_gimple_rhs_class (code) == GIMPLE_TERNARY_RHS);
ignore = (target == const0_rtx
|| ((CONVERT_EXPR_CODE_P (code)
@@ -7418,58 +7521,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
fold_convert_loc (loc, ssizetype,
treeop1));
case PLUS_EXPR:
-
- /* Check if this is a case for multiplication and addition. */
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == FIXED_POINT_TYPE)
- && (subexp0_def = get_def_for_expr (treeop0,
- MULT_EXPR)))
- {
- tree subsubexp0, subsubexp1;
- gimple subsubexp0_def, subsubexp1_def;
- enum tree_code this_code;
-
- this_code = TREE_CODE (type) == INTEGER_TYPE ? NOP_EXPR
- : FIXED_CONVERT_EXPR;
- subsubexp0 = gimple_assign_rhs1 (subexp0_def);
- subsubexp0_def = get_def_for_expr (subsubexp0, this_code);
- subsubexp1 = gimple_assign_rhs2 (subexp0_def);
- subsubexp1_def = get_def_for_expr (subsubexp1, this_code);
- if (subsubexp0_def && subsubexp1_def
- && (top0 = gimple_assign_rhs1 (subsubexp0_def))
- && (top1 = gimple_assign_rhs1 (subsubexp1_def))
- && (TYPE_PRECISION (TREE_TYPE (top0))
- < TYPE_PRECISION (TREE_TYPE (subsubexp0)))
- && (TYPE_PRECISION (TREE_TYPE (top0))
- == TYPE_PRECISION (TREE_TYPE (top1)))
- && (TYPE_UNSIGNED (TREE_TYPE (top0))
- == TYPE_UNSIGNED (TREE_TYPE (top1))))
- {
- tree op0type = TREE_TYPE (top0);
- enum machine_mode innermode = TYPE_MODE (op0type);
- bool zextend_p = TYPE_UNSIGNED (op0type);
- bool sat_p = TYPE_SATURATING (TREE_TYPE (subsubexp0));
- if (sat_p == 0)
- this_optab = zextend_p ? umadd_widen_optab : smadd_widen_optab;
- else
- this_optab = zextend_p ? usmadd_widen_optab
- : ssmadd_widen_optab;
- if (mode == GET_MODE_2XWIDER_MODE (innermode)
- && (optab_handler (this_optab, mode)->insn_code
- != CODE_FOR_nothing))
- {
- expand_operands (top0, top1, NULL_RTX, &op0, &op1,
- EXPAND_NORMAL);
- op2 = expand_expr (treeop1, subtarget,
- VOIDmode, EXPAND_NORMAL);
- temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
- target, unsignedp);
- gcc_assert (temp);
- return REDUCE_BIT_FIELD (temp);
- }
- }
- }
-
/* If we are adding a constant, a VAR_DECL that is sp, fp, or ap, and
something else, make sure we add the register to the constant and
then to the other thing. This case can occur during strength
@@ -7584,57 +7635,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
return REDUCE_BIT_FIELD (simplify_gen_binary (PLUS, mode, op0, op1));
case MINUS_EXPR:
- /* Check if this is a case for multiplication and subtraction. */
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == FIXED_POINT_TYPE)
- && (subexp1_def = get_def_for_expr (treeop1,
- MULT_EXPR)))
- {
- tree subsubexp0, subsubexp1;
- gimple subsubexp0_def, subsubexp1_def;
- enum tree_code this_code;
-
- this_code = TREE_CODE (type) == INTEGER_TYPE ? NOP_EXPR
- : FIXED_CONVERT_EXPR;
- subsubexp0 = gimple_assign_rhs1 (subexp1_def);
- subsubexp0_def = get_def_for_expr (subsubexp0, this_code);
- subsubexp1 = gimple_assign_rhs2 (subexp1_def);
- subsubexp1_def = get_def_for_expr (subsubexp1, this_code);
- if (subsubexp0_def && subsubexp1_def
- && (top0 = gimple_assign_rhs1 (subsubexp0_def))
- && (top1 = gimple_assign_rhs1 (subsubexp1_def))
- && (TYPE_PRECISION (TREE_TYPE (top0))
- < TYPE_PRECISION (TREE_TYPE (subsubexp0)))
- && (TYPE_PRECISION (TREE_TYPE (top0))
- == TYPE_PRECISION (TREE_TYPE (top1)))
- && (TYPE_UNSIGNED (TREE_TYPE (top0))
- == TYPE_UNSIGNED (TREE_TYPE (top1))))
- {
- tree op0type = TREE_TYPE (top0);
- enum machine_mode innermode = TYPE_MODE (op0type);
- bool zextend_p = TYPE_UNSIGNED (op0type);
- bool sat_p = TYPE_SATURATING (TREE_TYPE (subsubexp0));
- if (sat_p == 0)
- this_optab = zextend_p ? umsub_widen_optab : smsub_widen_optab;
- else
- this_optab = zextend_p ? usmsub_widen_optab
- : ssmsub_widen_optab;
- if (mode == GET_MODE_2XWIDER_MODE (innermode)
- && (optab_handler (this_optab, mode)->insn_code
- != CODE_FOR_nothing))
- {
- expand_operands (top0, top1, NULL_RTX, &op0, &op1,
- EXPAND_NORMAL);
- op2 = expand_expr (treeop0, subtarget,
- VOIDmode, EXPAND_NORMAL);
- temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
- target, unsignedp);
- gcc_assert (temp);
- return REDUCE_BIT_FIELD (temp);
- }
- }
- }
-
/* For initializers, we are allowed to return a MINUS of two
symbolic constants. Here we handle all cases when both operands
are constant. */
@@ -7675,6 +7675,14 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
goto binop2;
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
+ expand_operands (treeop0, treeop1, NULL_RTX, &op0, &op1, EXPAND_NORMAL);
+ op2 = expand_normal (ops->op2);
+ target = expand_widen_pattern_expr (ops, op0, op1, op2,
+ target, unsignedp);
+ return target;
+
case WIDEN_MULT_EXPR:
/* If first operand is constant, swap them.
Thus the following special case checks need only
@@ -8284,6 +8292,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
location_t loc = EXPR_LOCATION (exp);
struct separate_ops ops;
tree treeop0, treeop1, treeop2;
+ tree ssa_name = NULL_TREE;
+ gimple g;
type = TREE_TYPE (exp);
mode = TYPE_MODE (type);
@@ -8396,15 +8406,17 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
base variable. This unnecessarily allocates a pseudo, see how we can
reuse it, if partition base vars have it set already. */
if (!currently_expanding_to_rtl)
- return expand_expr_real_1 (SSA_NAME_VAR (exp), target, tmode, modifier, NULL);
- {
- gimple g = get_gimple_for_ssa_name (exp);
- if (g)
- return expand_expr_real (gimple_assign_rhs_to_tree (g), target,
- tmode, modifier, NULL);
- }
- decl_rtl = get_rtx_for_ssa_name (exp);
- exp = SSA_NAME_VAR (exp);
+ return expand_expr_real_1 (SSA_NAME_VAR (exp), target, tmode, modifier,
+ NULL);
+
+ g = get_gimple_for_ssa_name (exp);
+ if (g)
+ return expand_expr_real (gimple_assign_rhs_to_tree (g), target, tmode,
+ modifier, NULL);
+
+ ssa_name = exp;
+ decl_rtl = get_rtx_for_ssa_name (ssa_name);
+ exp = SSA_NAME_VAR (ssa_name);
goto expand_decl_rtl;
case PARM_DECL:
@@ -8506,15 +8518,21 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* If the mode of DECL_RTL does not match that of the decl, it
must be a promoted value. We return a SUBREG of the wanted mode,
but mark it so that we know that it was already extended. */
-
- if (REG_P (decl_rtl)
- && GET_MODE (decl_rtl) != DECL_MODE (exp))
+ if (REG_P (decl_rtl) && GET_MODE (decl_rtl) != DECL_MODE (exp))
{
enum machine_mode pmode;
- /* Get the signedness used for this variable. Ensure we get the
- same mode we got when the variable was declared. */
- pmode = promote_decl_mode (exp, &unsignedp);
+ /* Get the signedness to be used for this variable. Ensure we get
+ the same mode we got when the variable was declared. */
+ if (code == SSA_NAME
+ && (g = SSA_NAME_DEF_STMT (ssa_name))
+ && gimple_code (g) == GIMPLE_CALL)
+ pmode = promote_function_mode (type, mode, &unsignedp,
+ TREE_TYPE
+ (TREE_TYPE (gimple_call_fn (g))),
+ 2);
+ else
+ pmode = promote_decl_mode (exp, &unsignedp);
gcc_assert (GET_MODE (decl_rtl) == pmode);
temp = gen_lowpart_SUBREG (mode, decl_rtl);
@@ -8751,6 +8769,71 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
return temp;
+ case MEM_REF:
+ {
+ addr_space_t as
+ = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 1))));
+ enum machine_mode address_mode;
+ tree base = TREE_OPERAND (exp, 0);
+ /* Handle expansion of non-aliased memory with non-BLKmode. That
+ might end up in a register. */
+ if (TREE_CODE (base) == ADDR_EXPR)
+ {
+ HOST_WIDE_INT offset = mem_ref_offset (exp).low;
+ tree bit_offset;
+ base = TREE_OPERAND (base, 0);
+ if (!DECL_P (base))
+ {
+ HOST_WIDE_INT off;
+ base = get_addr_base_and_unit_offset (base, &off);
+ gcc_assert (base);
+ offset += off;
+ }
+ /* If we are expanding a MEM_REF of a non-BLKmode non-addressable
+ decl we must use bitfield operations. */
+ if (DECL_P (base)
+ && !TREE_ADDRESSABLE (base)
+ && DECL_MODE (base) != BLKmode
+ && DECL_RTL_SET_P (base)
+ && !MEM_P (DECL_RTL (base)))
+ {
+ tree bftype;
+ if (offset == 0
+ && host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1)
+ && (GET_MODE_BITSIZE (DECL_MODE (base))
+ == TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp)))))
+ return expand_expr (build1 (VIEW_CONVERT_EXPR,
+ TREE_TYPE (exp), base),
+ target, tmode, modifier);
+ bit_offset = bitsize_int (offset * BITS_PER_UNIT);
+ bftype = TREE_TYPE (base);
+ if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
+ bftype = TREE_TYPE (exp);
+ return expand_expr (build3 (BIT_FIELD_REF, bftype,
+ base,
+ TYPE_SIZE (TREE_TYPE (exp)),
+ bit_offset),
+ target, tmode, modifier);
+ }
+ }
+ address_mode = targetm.addr_space.address_mode (as);
+ op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, address_mode,
+ EXPAND_NORMAL);
+ if (!integer_zerop (TREE_OPERAND (exp, 1)))
+ {
+ rtx off;
+ off = immed_double_int_const (mem_ref_offset (exp), address_mode);
+ op0 = simplify_gen_binary (PLUS, address_mode, op0, off);
+ }
+ op0 = memory_address_addr_space (mode, op0, as);
+ temp = gen_rtx_MEM (mode, op0);
+ set_mem_attributes (temp, exp, 0);
+ set_mem_addr_space (temp, as);
+ if (TREE_THIS_VOLATILE (exp))
+ MEM_VOLATILE_P (temp) = 1;
+ return temp;
+ }
+
case ARRAY_REF:
{
@@ -8966,6 +9049,14 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
|| modifier == EXPAND_STACK_PARM)
? modifier : EXPAND_NORMAL);
+
+ /* If the bitfield is volatile, we want to access it in the
+ field's mode, not the computed mode. */
+ if (volatilep
+ && GET_CODE (op0) == MEM
+ && flag_strict_volatile_bitfields > 0)
+ op0 = adjust_address (op0, mode1, 0);
+
mode2
= CONSTANT_P (op0) ? TYPE_MODE (TREE_TYPE (tem)) : GET_MODE (op0);
@@ -9091,6 +9182,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT
&& modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER)
+ /* If the field is volatile, we always want an aligned
+ access. */
+ || (volatilep && flag_strict_volatile_bitfields > 0)
/* If the field isn't aligned enough to fetch as a memref,
fetch it as a bit field. */
|| (mode1 != BLKmode
diff --git a/gcc/expr.h b/gcc/expr.h
index af230a617da..6ee964a39f4 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -34,11 +34,6 @@ along with GCC; see the file COPYING3. If not see
/* For GET_MODE_BITSIZE, word_mode */
#include "machmode.h"
-/* The default branch cost is 1. */
-#ifndef BRANCH_COST
-#define BRANCH_COST(speed_p, predictable_p) 1
-#endif
-
/* This is the 4th arg to `expand_expr'.
EXPAND_STACK_PARM means we are possibly expanding a call param onto
the stack.
@@ -61,37 +56,6 @@ enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
more information. */
#define OK_DEFER_POP (inhibit_defer_pop -= 1)
-/* If a memory-to-memory move would take MOVE_RATIO or more simple
- move-instruction sequences, we will do a movmem or libcall instead. */
-
-#ifndef MOVE_RATIO
-#if defined (HAVE_movmemqi) || defined (HAVE_movmemhi) || defined (HAVE_movmemsi) || defined (HAVE_movmemdi) || defined (HAVE_movmemti)
-#define MOVE_RATIO(speed) 2
-#else
-/* If we are optimizing for space (-Os), cut down the default move ratio. */
-#define MOVE_RATIO(speed) ((speed) ? 15 : 3)
-#endif
-#endif
-
-/* If a clear memory operation would take CLEAR_RATIO or more simple
- move-instruction sequences, we will do a setmem or libcall instead. */
-
-#ifndef CLEAR_RATIO
-#if defined (HAVE_setmemqi) || defined (HAVE_setmemhi) || defined (HAVE_setmemsi) || defined (HAVE_setmemdi) || defined (HAVE_setmemti)
-#define CLEAR_RATIO(speed) 2
-#else
-/* If we are optimizing for space, cut down the default clear ratio. */
-#define CLEAR_RATIO(speed) ((speed) ? 15 :3)
-#endif
-#endif
-
-/* If a memory set (to value other than zero) operation would take
- SET_RATIO or more simple move-instruction sequences, we will do a movmem
- or libcall instead. */
-#ifndef SET_RATIO
-#define SET_RATIO(speed) MOVE_RATIO(speed)
-#endif
-
enum direction {none, upward, downward};
/* Structure to record the size of a sequence of arguments
@@ -166,106 +130,6 @@ do { \
((SIZE).var == 0 ? GEN_INT ((SIZE).constant) \
: expand_normal (ARGS_SIZE_TREE (SIZE)))
-/* Supply a default definition for FUNCTION_ARG_PADDING:
- usually pad upward, but pad short args downward on
- big-endian machines. */
-
-#define DEFAULT_FUNCTION_ARG_PADDING(MODE, TYPE) \
- (! BYTES_BIG_ENDIAN \
- ? upward \
- : (((MODE) == BLKmode \
- ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT)) \
- : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
- ? downward : upward))
-
-#ifndef FUNCTION_ARG_PADDING
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- DEFAULT_FUNCTION_ARG_PADDING ((MODE), (TYPE))
-#endif
-
-/* Supply a default definition for FUNCTION_ARG_BOUNDARY. Normally, we let
- FUNCTION_ARG_PADDING, which also pads the length, handle any needed
- alignment. */
-
-#ifndef FUNCTION_ARG_BOUNDARY
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) PARM_BOUNDARY
-#endif
-
-/* Supply a default definition of STACK_SAVEAREA_MODE for emit_stack_save.
- Normally move_insn, so Pmode stack pointer. */
-
-#ifndef STACK_SAVEAREA_MODE
-#define STACK_SAVEAREA_MODE(LEVEL) Pmode
-#endif
-
-/* Supply a default definition of STACK_SIZE_MODE for
- allocate_dynamic_stack_space. Normally PLUS/MINUS, so word_mode. */
-
-#ifndef STACK_SIZE_MODE
-#define STACK_SIZE_MODE word_mode
-#endif
-
-/* Provide default values for the macros controlling stack checking. */
-
-/* The default is neither full builtin stack checking... */
-#ifndef STACK_CHECK_BUILTIN
-#define STACK_CHECK_BUILTIN 0
-#endif
-
-/* ...nor static builtin stack checking. */
-#ifndef STACK_CHECK_STATIC_BUILTIN
-#define STACK_CHECK_STATIC_BUILTIN 0
-#endif
-
-/* The default interval is one page (4096 bytes). */
-#ifndef STACK_CHECK_PROBE_INTERVAL_EXP
-#define STACK_CHECK_PROBE_INTERVAL_EXP 12
-#endif
-
-/* The default is not to move the stack pointer. */
-#ifndef STACK_CHECK_MOVING_SP
-#define STACK_CHECK_MOVING_SP 0
-#endif
-
-/* This is a kludge to try to capture the discrepancy between the old
- mechanism (generic stack checking) and the new mechanism (static
- builtin stack checking). STACK_CHECK_PROTECT needs to be bumped
- for the latter because part of the protection area is effectively
- included in STACK_CHECK_MAX_FRAME_SIZE for the former. */
-#ifdef STACK_CHECK_PROTECT
-#define STACK_OLD_CHECK_PROTECT STACK_CHECK_PROTECT
-#else
-#define STACK_OLD_CHECK_PROTECT \
- (USING_SJLJ_EXCEPTIONS ? 75 * UNITS_PER_WORD : 8 * 1024)
-#endif
-
-/* Minimum amount of stack required to recover from an anticipated stack
- overflow detection. The default value conveys an estimate of the amount
- of stack required to propagate an exception. */
-#ifndef STACK_CHECK_PROTECT
-#define STACK_CHECK_PROTECT \
- (USING_SJLJ_EXCEPTIONS ? 75 * UNITS_PER_WORD : 12 * 1024)
-#endif
-
-/* Make the maximum frame size be the largest we can and still only need
- one probe per function. */
-#ifndef STACK_CHECK_MAX_FRAME_SIZE
-#define STACK_CHECK_MAX_FRAME_SIZE \
- ((1 << STACK_CHECK_PROBE_INTERVAL_EXP) - UNITS_PER_WORD)
-#endif
-
-/* This is arbitrary, but should be large enough everywhere. */
-#ifndef STACK_CHECK_FIXED_FRAME_SIZE
-#define STACK_CHECK_FIXED_FRAME_SIZE (4 * UNITS_PER_WORD)
-#endif
-
-/* Provide a reasonable default for the maximum size of an object to
- allocate in the fixed frame. We may need to be able to make this
- controllable by the user at some point. */
-#ifndef STACK_CHECK_MAX_VAR_SIZE
-#define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100)
-#endif
/* This structure is used to pass around information about exploded
unary, binary and trinary expressions between expand_expr_real_1 and
diff --git a/gcc/final.c b/gcc/final.c
index 44f02adb0f4..2bb897dc10b 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -62,7 +62,8 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "except.h"
#include "function.h"
-#include "toplev.h"
+#include "rtl-error.h"
+#include "toplev.h" /* exact_log2, floor_log2 */
#include "reload.h"
#include "intl.h"
#include "basic-block.h"
@@ -220,7 +221,6 @@ static void output_asm_name (void);
static void output_alternate_entry_point (FILE *, rtx);
static tree get_mem_expr_from_op (rtx, int *);
static void output_asm_operand_names (rtx *, int *, int);
-static void output_operand (rtx, int);
#ifdef LEAF_REGISTERS
static void leaf_renumber_regs (rtx);
#endif
@@ -1897,8 +1897,9 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
case NOTE_INSN_EPILOGUE_BEG:
#if defined (DWARF2_UNWIND_INFO) && defined (HAVE_epilogue)
if (dwarf2out_do_frame ())
- dwarf2out_begin_epilogue (insn);
+ dwarf2out_cfi_begin_epilogue (insn);
#endif
+ (*debug_hooks->begin_epilogue) (last_linenum, last_filename);
targetm.asm_out.function_begin_epilogue (file);
break;
@@ -3329,7 +3330,7 @@ output_asm_insn (const char *templ, rtx *operands)
outputs an operand in a special way depending on the letter.
Letters `acln' are implemented directly.
Other letters are passed to `output_operand' so that
- the PRINT_OPERAND macro can define them. */
+ the TARGET_PRINT_OPERAND hook can define them. */
else if (ISALPHA (*p))
{
int letter = *p++;
@@ -3395,12 +3396,10 @@ output_asm_insn (const char *templ, rtx *operands)
c = *p;
}
/* % followed by punctuation: output something for that
- punctuation character alone, with no operand.
- The PRINT_OPERAND macro decides what is actually done. */
-#ifdef PRINT_OPERAND_PUNCT_VALID_P
- else if (PRINT_OPERAND_PUNCT_VALID_P ((unsigned char) *p))
+ punctuation character alone, with no operand. The
+ TARGET_PRINT_OPERAND hook decides what is actually done. */
+ else if (targetm.asm_out.print_operand_punct_valid_p ((unsigned char) *p))
output_operand (NULL_RTX, *p++);
-#endif
else
output_operand_lossage ("invalid %%-code");
break;
@@ -3472,16 +3471,15 @@ mark_symbol_refs_as_used (rtx x)
}
/* Print operand X using machine-dependent assembler syntax.
- The macro PRINT_OPERAND is defined just to control this function.
CODE is a non-digit that preceded the operand-number in the % spec,
such as 'z' if the spec was `%z3'. CODE is 0 if there was no char
between the % and the digits.
When CODE is a non-letter, X is 0.
The meanings of the letters are machine-dependent and controlled
- by PRINT_OPERAND. */
+ by TARGET_PRINT_OPERAND. */
-static void
+void
output_operand (rtx x, int code ATTRIBUTE_UNUSED)
{
if (x && GET_CODE (x) == SUBREG)
@@ -3490,7 +3488,7 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
/* X must not be a pseudo reg. */
gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
- PRINT_OPERAND (asm_out_file, x, code);
+ targetm.asm_out.print_operand (asm_out_file, x, code);
if (x == NULL_RTX)
return;
@@ -3498,16 +3496,15 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
for_each_rtx (&x, mark_symbol_ref_as_used, NULL);
}
-/* Print a memory reference operand for address X
- using machine-dependent assembler syntax.
- The macro PRINT_OPERAND_ADDRESS exists just to control this function. */
+/* Print a memory reference operand for address X using
+ machine-dependent assembler syntax. */
void
output_address (rtx x)
{
bool changed = false;
walk_alter_subreg (&x, &changed);
- PRINT_OPERAND_ADDRESS (asm_out_file, x);
+ targetm.asm_out.print_operand_address (asm_out_file, x);
}
/* Print an integer constant expression in assembler syntax.
diff --git a/gcc/flags.h b/gcc/flags.h
index bc51b2bda34..5e87c097882 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -150,19 +150,6 @@ extern int flag_print_asm_name;
/* Now the symbols that are set with `-f' switches. */
-/* Nonzero means `char' should be signed. */
-
-extern int flag_signed_char;
-
-/* Nonzero means give an enum type only as many bytes as it needs. A value
- of 2 means it has not yet been initialized. */
-
-extern int flag_short_enums;
-
-/* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
-
-extern int flag_pcc_struct_return;
-
/* 0 means straightforward implementation of complex divide acceptable.
1 means wide ranges of inputs must work for complex divide.
2 means C99-like requirements for complex multiply and divide. */
@@ -234,8 +221,6 @@ enum ira_region
extern enum ira_region flag_ira_region;
-extern unsigned int flag_ira_verbose;
-
/* The options for excess precision. */
enum excess_precision
{
@@ -291,14 +276,6 @@ enum graph_dump_types
};
extern enum graph_dump_types graph_dump_format;
-/* Nonzero means to collect statistics which might be expensive
- and to print them when we are done. */
-extern int flag_detailed_statistics;
-
-/* Nonzero means that we defer emitting functions until they are actually
- used. */
-extern int flag_remove_unreachable_functions;
-
/* Nonzero if we should track variables. */
extern int flag_var_tracking;
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b6e8ed68783..1e3bae65405 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -27,8 +27,7 @@ along with GCC; see the file COPYING3. If not see
@@ This would also make life easier when this technology is used
@@ for cross-compilers. */
-/* The entry points in this file are fold, size_int_wide, size_binop
- and force_fit_type_double.
+/* The entry points in this file are fold, size_int_wide and size_binop.
fold takes a tree as argument and returns a simplified tree.
@@ -39,10 +38,6 @@ along with GCC; see the file COPYING3. If not see
size_int takes an integer value, and creates a tree constant
with type from `sizetype'.
- force_fit_type_double takes a constant, an overflowable flag and a
- prior overflow indicator. It forces the value to fit the type and
- sets TREE_OVERFLOW.
-
Note: Since the folders get called on non-gimple code as well as
gimple code, we need to handle GIMPLE tuples as well as their
corresponding tree equivalents. */
@@ -65,6 +60,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "md5.h"
#include "gimple.h"
+#include "tree-flow.h"
/* Nonzero if we are folding constants inside an initializer; zero
otherwise. */
@@ -97,7 +93,7 @@ static bool negate_expr_p (tree);
static tree negate_expr (tree);
static tree split_tree (tree, enum tree_code, tree *, tree *, tree *, int);
static tree associate_trees (location_t, tree, tree, enum tree_code, tree);
-static tree const_binop (enum tree_code, tree, tree, int);
+static tree const_binop (enum tree_code, tree, tree);
static enum comparison_code comparison_to_compcode (enum tree_code);
static enum tree_code compcode_to_comparison (enum comparison_code);
static int operand_equal_for_comparison_p (tree, tree, tree);
@@ -141,7 +137,7 @@ static tree fold_inf_compare (location_t, enum tree_code, tree, tree, tree);
static tree fold_div_compare (location_t, enum tree_code, tree, tree, tree);
static bool reorder_operands_p (const_tree, const_tree);
static tree fold_negate_const (tree, tree);
-static tree fold_not_const (tree, tree);
+static tree fold_not_const (const_tree, tree);
static tree fold_relational_const (enum tree_code, tree, tree, tree);
static tree fold_convert_const (enum tree_code, tree, tree);
@@ -924,145 +920,140 @@ int_binop_types_match_p (enum tree_code code, const_tree type1, const_tree type2
tree
int_const_binop (enum tree_code code, const_tree arg1, const_tree arg2, int notrunc)
{
- unsigned HOST_WIDE_INT int1l, int2l;
- HOST_WIDE_INT int1h, int2h;
- unsigned HOST_WIDE_INT low;
- HOST_WIDE_INT hi;
- unsigned HOST_WIDE_INT garbagel;
- HOST_WIDE_INT garbageh;
+ double_int op1, op2, res, tmp;
tree t;
tree type = TREE_TYPE (arg1);
- int uns = TYPE_UNSIGNED (type);
- int is_sizetype
+ bool uns = TYPE_UNSIGNED (type);
+ bool is_sizetype
= (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type));
- int overflow = 0;
+ bool overflow = false;
- int1l = TREE_INT_CST_LOW (arg1);
- int1h = TREE_INT_CST_HIGH (arg1);
- int2l = TREE_INT_CST_LOW (arg2);
- int2h = TREE_INT_CST_HIGH (arg2);
+ op1 = tree_to_double_int (arg1);
+ op2 = tree_to_double_int (arg2);
switch (code)
{
case BIT_IOR_EXPR:
- low = int1l | int2l, hi = int1h | int2h;
+ res = double_int_ior (op1, op2);
break;
case BIT_XOR_EXPR:
- low = int1l ^ int2l, hi = int1h ^ int2h;
+ res = double_int_xor (op1, op2);
break;
case BIT_AND_EXPR:
- low = int1l & int2l, hi = int1h & int2h;
+ res = double_int_and (op1, op2);
break;
case RSHIFT_EXPR:
- int2l = -int2l;
+ res = double_int_rshift (op1, double_int_to_shwi (op2),
+ TYPE_PRECISION (type), !uns);
+ break;
+
case LSHIFT_EXPR:
/* It's unclear from the C standard whether shifts can overflow.
The following code ignores overflow; perhaps a C standard
interpretation ruling is needed. */
- lshift_double (int1l, int1h, int2l, TYPE_PRECISION (type),
- &low, &hi, !uns);
+ res = double_int_lshift (op1, double_int_to_shwi (op2),
+ TYPE_PRECISION (type), !uns);
break;
case RROTATE_EXPR:
- int2l = - int2l;
+ res = double_int_rrotate (op1, double_int_to_shwi (op2),
+ TYPE_PRECISION (type));
+ break;
+
case LROTATE_EXPR:
- lrotate_double (int1l, int1h, int2l, TYPE_PRECISION (type),
- &low, &hi);
+ res = double_int_lrotate (op1, double_int_to_shwi (op2),
+ TYPE_PRECISION (type));
break;
case PLUS_EXPR:
- overflow = add_double (int1l, int1h, int2l, int2h, &low, &hi);
+ overflow = add_double (op1.low, op1.high, op2.low, op2.high,
+ &res.low, &res.high);
break;
case MINUS_EXPR:
- neg_double (int2l, int2h, &low, &hi);
- add_double (int1l, int1h, low, hi, &low, &hi);
- overflow = OVERFLOW_SUM_SIGN (hi, int2h, int1h);
+ neg_double (op2.low, op2.high, &res.low, &res.high);
+ add_double (op1.low, op1.high, res.low, res.high,
+ &res.low, &res.high);
+ overflow = OVERFLOW_SUM_SIGN (res.high, op2.high, op1.high);
break;
case MULT_EXPR:
- overflow = mul_double (int1l, int1h, int2l, int2h, &low, &hi);
+ overflow = mul_double (op1.low, op1.high, op2.low, op2.high,
+ &res.low, &res.high);
break;
case TRUNC_DIV_EXPR:
case FLOOR_DIV_EXPR: case CEIL_DIV_EXPR:
case EXACT_DIV_EXPR:
/* This is a shortcut for a common special case. */
- if (int2h == 0 && (HOST_WIDE_INT) int2l > 0
+ if (op2.high == 0 && (HOST_WIDE_INT) op2.low > 0
&& !TREE_OVERFLOW (arg1)
&& !TREE_OVERFLOW (arg2)
- && int1h == 0 && (HOST_WIDE_INT) int1l >= 0)
+ && op1.high == 0 && (HOST_WIDE_INT) op1.low >= 0)
{
if (code == CEIL_DIV_EXPR)
- int1l += int2l - 1;
+ op1.low += op2.low - 1;
- low = int1l / int2l, hi = 0;
+ res.low = op1.low / op2.low, res.high = 0;
break;
}
/* ... fall through ... */
case ROUND_DIV_EXPR:
- if (int2h == 0 && int2l == 0)
+ if (double_int_zero_p (op2))
return NULL_TREE;
- if (int2h == 0 && int2l == 1)
+ if (double_int_one_p (op2))
{
- low = int1l, hi = int1h;
+ res = op1;
break;
}
- if (int1l == int2l && int1h == int2h
- && ! (int1l == 0 && int1h == 0))
+ if (double_int_equal_p (op1, op2)
+ && ! double_int_zero_p (op1))
{
- low = 1, hi = 0;
+ res = double_int_one;
break;
}
- overflow = div_and_round_double (code, uns, int1l, int1h, int2l, int2h,
- &low, &hi, &garbagel, &garbageh);
+ overflow = div_and_round_double (code, uns,
+ op1.low, op1.high, op2.low, op2.high,
+ &res.low, &res.high,
+ &tmp.low, &tmp.high);
break;
case TRUNC_MOD_EXPR:
case FLOOR_MOD_EXPR: case CEIL_MOD_EXPR:
/* This is a shortcut for a common special case. */
- if (int2h == 0 && (HOST_WIDE_INT) int2l > 0
+ if (op2.high == 0 && (HOST_WIDE_INT) op2.low > 0
&& !TREE_OVERFLOW (arg1)
&& !TREE_OVERFLOW (arg2)
- && int1h == 0 && (HOST_WIDE_INT) int1l >= 0)
+ && op1.high == 0 && (HOST_WIDE_INT) op1.low >= 0)
{
if (code == CEIL_MOD_EXPR)
- int1l += int2l - 1;
- low = int1l % int2l, hi = 0;
+ op1.low += op2.low - 1;
+ res.low = op1.low % op2.low, res.high = 0;
break;
}
/* ... fall through ... */
case ROUND_MOD_EXPR:
- if (int2h == 0 && int2l == 0)
+ if (double_int_zero_p (op2))
return NULL_TREE;
overflow = div_and_round_double (code, uns,
- int1l, int1h, int2l, int2h,
- &garbagel, &garbageh, &low, &hi);
+ op1.low, op1.high, op2.low, op2.high,
+ &tmp.low, &tmp.high,
+ &res.low, &res.high);
break;
case MIN_EXPR:
- case MAX_EXPR:
- if (uns)
- low = (((unsigned HOST_WIDE_INT) int1h
- < (unsigned HOST_WIDE_INT) int2h)
- || (((unsigned HOST_WIDE_INT) int1h
- == (unsigned HOST_WIDE_INT) int2h)
- && int1l < int2l));
- else
- low = (int1h < int2h
- || (int1h == int2h && int1l < int2l));
+ res = double_int_min (op1, op2, uns);
+ break;
- if (low == (code == MIN_EXPR))
- low = int1l, hi = int1h;
- else
- low = int2l, hi = int2h;
+ case MAX_EXPR:
+ res = double_int_max (op1, op2, uns);
break;
default:
@@ -1071,7 +1062,7 @@ int_const_binop (enum tree_code code, const_tree arg1, const_tree arg2, int notr
if (notrunc)
{
- t = build_int_cst_wide (TREE_TYPE (arg1), low, hi);
+ t = build_int_cst_wide (TREE_TYPE (arg1), res.low, res.high);
/* Propagate overflow flags ourselves. */
if (((!uns || is_sizetype) && overflow)
@@ -1082,7 +1073,7 @@ int_const_binop (enum tree_code code, const_tree arg1, const_tree arg2, int notr
}
}
else
- t = force_fit_type_double (TREE_TYPE (arg1), low, hi, 1,
+ t = force_fit_type_double (TREE_TYPE (arg1), res, 1,
((!uns || is_sizetype) && overflow)
| TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2));
@@ -1092,12 +1083,10 @@ int_const_binop (enum tree_code code, const_tree arg1, const_tree arg2, int notr
/* Combine two constants ARG1 and ARG2 under operation CODE to produce a new
constant. We assume ARG1 and ARG2 have the same data type, or at least
are the same kind of constant and the same machine mode. Return zero if
- combining the constants is not allowed in the current operating mode.
-
- If NOTRUNC is nonzero, do not truncate the result to fit the data type. */
+ combining the constants is not allowed in the current operating mode. */
static tree
-const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
+const_binop (enum tree_code code, tree arg1, tree arg2)
{
/* Sanity check for the recursive cases. */
if (!arg1 || !arg2)
@@ -1107,7 +1096,7 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
STRIP_NOPS (arg2);
if (TREE_CODE (arg1) == INTEGER_CST)
- return int_const_binop (code, arg1, arg2, notrunc);
+ return int_const_binop (code, arg1, arg2, 0);
if (TREE_CODE (arg1) == REAL_CST)
{
@@ -1241,8 +1230,8 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
{
case PLUS_EXPR:
case MINUS_EXPR:
- real = const_binop (code, r1, r2, notrunc);
- imag = const_binop (code, i1, i2, notrunc);
+ real = const_binop (code, r1, r2);
+ imag = const_binop (code, i1, i2);
break;
case MULT_EXPR:
@@ -1252,13 +1241,11 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
mpc_mul);
real = const_binop (MINUS_EXPR,
- const_binop (MULT_EXPR, r1, r2, notrunc),
- const_binop (MULT_EXPR, i1, i2, notrunc),
- notrunc);
+ const_binop (MULT_EXPR, r1, r2),
+ const_binop (MULT_EXPR, i1, i2));
imag = const_binop (PLUS_EXPR,
- const_binop (MULT_EXPR, r1, i2, notrunc),
- const_binop (MULT_EXPR, i1, r2, notrunc),
- notrunc);
+ const_binop (MULT_EXPR, r1, i2),
+ const_binop (MULT_EXPR, i1, r2));
break;
case RDIV_EXPR:
@@ -1282,22 +1269,19 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
*/
tree magsquared
= const_binop (PLUS_EXPR,
- const_binop (MULT_EXPR, r2, r2, notrunc),
- const_binop (MULT_EXPR, i2, i2, notrunc),
- notrunc);
+ const_binop (MULT_EXPR, r2, r2),
+ const_binop (MULT_EXPR, i2, i2));
tree t1
= const_binop (PLUS_EXPR,
- const_binop (MULT_EXPR, r1, r2, notrunc),
- const_binop (MULT_EXPR, i1, i2, notrunc),
- notrunc);
+ const_binop (MULT_EXPR, r1, r2),
+ const_binop (MULT_EXPR, i1, i2));
tree t2
= const_binop (MINUS_EXPR,
- const_binop (MULT_EXPR, i1, r2, notrunc),
- const_binop (MULT_EXPR, r1, i2, notrunc),
- notrunc);
+ const_binop (MULT_EXPR, i1, r2),
+ const_binop (MULT_EXPR, r1, i2));
- real = const_binop (code, t1, magsquared, notrunc);
- imag = const_binop (code, t2, magsquared, notrunc);
+ real = const_binop (code, t1, magsquared);
+ imag = const_binop (code, t2, magsquared);
}
else
{
@@ -1319,18 +1303,16 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
ti = (ai * ratio) - ar;
tr = tr / div;
ti = ti / div; */
- tree ratio = const_binop (code, r2, i2, notrunc);
+ tree ratio = const_binop (code, r2, i2);
tree div = const_binop (PLUS_EXPR, i2,
- const_binop (MULT_EXPR, r2, ratio,
- notrunc),
- notrunc);
- real = const_binop (MULT_EXPR, r1, ratio, notrunc);
- real = const_binop (PLUS_EXPR, real, i1, notrunc);
- real = const_binop (code, real, div, notrunc);
-
- imag = const_binop (MULT_EXPR, i1, ratio, notrunc);
- imag = const_binop (MINUS_EXPR, imag, r1, notrunc);
- imag = const_binop (code, imag, div, notrunc);
+ const_binop (MULT_EXPR, r2, ratio));
+ real = const_binop (MULT_EXPR, r1, ratio);
+ real = const_binop (PLUS_EXPR, real, i1);
+ real = const_binop (code, real, div);
+
+ imag = const_binop (MULT_EXPR, i1, ratio);
+ imag = const_binop (MINUS_EXPR, imag, r1);
+ imag = const_binop (code, imag, div);
}
else
{
@@ -1341,19 +1323,17 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
ti = b - (a * ratio);
tr = tr / div;
ti = ti / div; */
- tree ratio = const_binop (code, i2, r2, notrunc);
+ tree ratio = const_binop (code, i2, r2);
tree div = const_binop (PLUS_EXPR, r2,
- const_binop (MULT_EXPR, i2, ratio,
- notrunc),
- notrunc);
+ const_binop (MULT_EXPR, i2, ratio));
- real = const_binop (MULT_EXPR, i1, ratio, notrunc);
- real = const_binop (PLUS_EXPR, real, r1, notrunc);
- real = const_binop (code, real, div, notrunc);
+ real = const_binop (MULT_EXPR, i1, ratio);
+ real = const_binop (PLUS_EXPR, real, r1);
+ real = const_binop (code, real, div);
- imag = const_binop (MULT_EXPR, r1, ratio, notrunc);
- imag = const_binop (MINUS_EXPR, i1, imag, notrunc);
- imag = const_binop (code, imag, div, notrunc);
+ imag = const_binop (MULT_EXPR, r1, ratio);
+ imag = const_binop (MINUS_EXPR, i1, imag);
+ imag = const_binop (code, imag, div);
}
}
break;
@@ -1399,7 +1379,7 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
elements2 = TREE_CHAIN (elements2);
}
- elem = const_binop (code, elem1, elem2, notrunc);
+ elem = const_binop (code, elem1, elem2);
/* It is possible that const_binop cannot handle the given
code and return NULL_TREE */
@@ -1526,8 +1506,7 @@ fold_convert_const_int_from_int (tree type, const_tree arg1)
/* Given an integer constant, make new constant with new type,
appropriately sign-extended or truncated. */
- t = force_fit_type_double (type, TREE_INT_CST_LOW (arg1),
- TREE_INT_CST_HIGH (arg1),
+ t = force_fit_type_double (type, tree_to_double_int (arg1),
!POINTER_TYPE_P (TREE_TYPE (arg1)),
(TREE_INT_CST_HIGH (arg1) < 0
&& (TYPE_UNSIGNED (type)
@@ -1607,8 +1586,7 @@ fold_convert_const_int_from_real (enum tree_code code, tree type, const_tree arg
if (! overflow)
real_to_integer2 ((HOST_WIDE_INT *) &val.low, &val.high, &r);
- t = force_fit_type_double (type, val.low, val.high, -1,
- overflow | TREE_OVERFLOW (arg1));
+ t = force_fit_type_double (type, val, -1, overflow | TREE_OVERFLOW (arg1));
return t;
}
@@ -1651,7 +1629,7 @@ fold_convert_const_int_from_fixed (tree type, const_tree arg1)
/* Given a fixed-point constant, make new constant with new type,
appropriately sign-extended or truncated. */
- t = force_fit_type_double (type, temp.low, temp.high, -1,
+ t = force_fit_type_double (type, temp, -1,
(double_int_negative_p (temp)
&& (TYPE_UNSIGNED (type)
< TYPE_UNSIGNED (TREE_TYPE (arg1))))
@@ -2614,6 +2592,17 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
case IMAGPART_EXPR:
return OP_SAME (0);
+ case MEM_REF:
+ /* Require equal access sizes. We can have incomplete types
+ for array references of variable-sized arrays from the
+ Fortran frontent though. */
+ return ((TYPE_SIZE (TREE_TYPE (arg0)) == TYPE_SIZE (TREE_TYPE (arg1))
+ || (TYPE_SIZE (TREE_TYPE (arg0))
+ && TYPE_SIZE (TREE_TYPE (arg1))
+ && operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)),
+ TYPE_SIZE (TREE_TYPE (arg1)), flags)))
+ && OP_SAME (0) && OP_SAME (1));
+
case ARRAY_REF:
case ARRAY_RANGE_REF:
/* Operands 2 and 3 may be null.
@@ -3463,11 +3452,16 @@ optimize_bit_field_compare (location_t loc, enum tree_code code,
/* See if we can find a mode to refer to this field. We should be able to,
but fail if we can't. */
- nmode = get_best_mode (lbitsize, lbitpos,
- const_p ? TYPE_ALIGN (TREE_TYPE (linner))
- : MIN (TYPE_ALIGN (TREE_TYPE (linner)),
- TYPE_ALIGN (TREE_TYPE (rinner))),
- word_mode, lvolatilep || rvolatilep);
+ if (lvolatilep
+ && GET_MODE_BITSIZE (lmode) > 0
+ && flag_strict_volatile_bitfields > 0)
+ nmode = lmode;
+ else
+ nmode = get_best_mode (lbitsize, lbitpos,
+ const_p ? TYPE_ALIGN (TREE_TYPE (linner))
+ : MIN (TYPE_ALIGN (TREE_TYPE (linner)),
+ TYPE_ALIGN (TREE_TYPE (rinner))),
+ word_mode, lvolatilep || rvolatilep);
if (nmode == VOIDmode)
return 0;
@@ -3490,9 +3484,9 @@ optimize_bit_field_compare (location_t loc, enum tree_code code,
/* Make the mask to be used against the extracted field. */
mask = build_int_cst_type (unsigned_type, -1);
- mask = const_binop (LSHIFT_EXPR, mask, size_int (nbitsize - lbitsize), 0);
+ mask = const_binop (LSHIFT_EXPR, mask, size_int (nbitsize - lbitsize));
mask = const_binop (RSHIFT_EXPR, mask,
- size_int (nbitsize - lbitsize - lbitpos), 0);
+ size_int (nbitsize - lbitsize - lbitpos));
if (! const_p)
/* If not comparing with constant, just rework the comparison
@@ -3525,7 +3519,7 @@ optimize_bit_field_compare (location_t loc, enum tree_code code,
if (! integer_zerop (const_binop (RSHIFT_EXPR,
fold_convert_loc (loc,
unsigned_type, rhs),
- size_int (lbitsize), 0)))
+ size_int (lbitsize))))
{
warning (0, "comparison is always %d due to width of bit-field",
code == NE_EXPR);
@@ -3536,7 +3530,7 @@ optimize_bit_field_compare (location_t loc, enum tree_code code,
{
tree tem = const_binop (RSHIFT_EXPR,
fold_convert_loc (loc, signed_type, rhs),
- size_int (lbitsize - 1), 0);
+ size_int (lbitsize - 1));
if (! integer_zerop (tem) && ! integer_all_onesp (tem))
{
warning (0, "comparison is always %d due to width of bit-field",
@@ -3565,8 +3559,8 @@ optimize_bit_field_compare (location_t loc, enum tree_code code,
rhs = const_binop (BIT_AND_EXPR,
const_binop (LSHIFT_EXPR,
fold_convert_loc (loc, unsigned_type, rhs),
- size_int (lbitpos), 0),
- mask, 0);
+ size_int (lbitpos)),
+ mask);
lhs = build2 (code, compare_type,
build2 (BIT_AND_EXPR, unsigned_type, lhs, mask),
@@ -3652,8 +3646,8 @@ decode_field_reference (location_t loc, tree exp, HOST_WIDE_INT *pbitsize,
mask = build_int_cst_type (unsigned_type, -1);
- mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
- mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
+ mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize));
+ mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize));
/* Merge it with the mask we found in the BIT_AND_EXPR, if any. */
if (and_mask != 0)
@@ -3681,9 +3675,8 @@ all_ones_mask_p (const_tree mask, int size)
tree_int_cst_equal (mask,
const_binop (RSHIFT_EXPR,
const_binop (LSHIFT_EXPR, tmask,
- size_int (precision - size),
- 0),
- size_int (precision - size), 0));
+ size_int (precision - size)),
+ size_int (precision - size)));
}
/* Subroutine for fold: determine if VAL is the INTEGER_CONST that
@@ -4283,7 +4276,7 @@ build_range_check (location_t loc, tree type, tree exp, int in_p,
low = fold_convert_loc (loc, etype, low);
exp = fold_convert_loc (loc, etype, exp);
- value = const_binop (MINUS_EXPR, high, low, 0);
+ value = const_binop (MINUS_EXPR, high, low);
if (POINTER_TYPE_P (etype))
@@ -4786,7 +4779,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type,
OEP_ONLY_CONST)
&& operand_equal_p (arg01,
const_binop (PLUS_EXPR, arg2,
- build_int_cst (type, 1), 0),
+ build_int_cst (type, 1)),
OEP_ONLY_CONST))
{
tem = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (arg00), arg00,
@@ -4804,7 +4797,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type,
OEP_ONLY_CONST)
&& operand_equal_p (arg01,
const_binop (MINUS_EXPR, arg2,
- build_int_cst (type, 1), 0),
+ build_int_cst (type, 1)),
OEP_ONLY_CONST))
{
tem = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (arg00), arg00,
@@ -4822,7 +4815,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type,
OEP_ONLY_CONST)
&& operand_equal_p (arg01,
const_binop (MINUS_EXPR, arg2,
- build_int_cst (type, 1), 0),
+ build_int_cst (type, 1)),
OEP_ONLY_CONST))
{
tem = fold_build2_loc (loc, MAX_EXPR, TREE_TYPE (arg00), arg00,
@@ -4838,7 +4831,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type,
OEP_ONLY_CONST)
&& operand_equal_p (arg01,
const_binop (PLUS_EXPR, arg2,
- build_int_cst (type, 1), 0),
+ build_int_cst (type, 1)),
OEP_ONLY_CONST))
{
tem = fold_build2_loc (loc, MAX_EXPR, TREE_TYPE (arg00), arg00,
@@ -4970,8 +4963,8 @@ unextend (tree c, int p, int unsignedp, tree mask)
/* We work by getting just the sign bit into the low-order bit, then
into the high-order bit, then sign-extend. We then XOR that value
with C. */
- temp = const_binop (RSHIFT_EXPR, c, size_int (p - 1), 0);
- temp = const_binop (BIT_AND_EXPR, temp, size_int (1), 0);
+ temp = const_binop (RSHIFT_EXPR, c, size_int (p - 1));
+ temp = const_binop (BIT_AND_EXPR, temp, size_int (1));
/* We must use a signed type in order to get an arithmetic right shift.
However, we must also avoid introducing accidental overflows, so that
@@ -4982,18 +4975,16 @@ unextend (tree c, int p, int unsignedp, tree mask)
if (TYPE_UNSIGNED (type))
temp = fold_convert (signed_type_for (type), temp);
- temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1), 0);
- temp = const_binop (RSHIFT_EXPR, temp, size_int (modesize - p - 1), 0);
+ temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1));
+ temp = const_binop (RSHIFT_EXPR, temp, size_int (modesize - p - 1));
if (mask != 0)
temp = const_binop (BIT_AND_EXPR, temp,
- fold_convert (TREE_TYPE (c), mask),
- 0);
+ fold_convert (TREE_TYPE (c), mask));
/* If necessary, convert the type back to match the type of C. */
if (TYPE_UNSIGNED (type))
temp = fold_convert (type, temp);
- return fold_convert (type,
- const_binop (BIT_XOR_EXPR, c, temp, 0));
+ return fold_convert (type, const_binop (BIT_XOR_EXPR, c, temp));
}
/* For an expression that has the form
@@ -5330,19 +5321,18 @@ fold_truthop (location_t loc, enum tree_code code, tree truth_type,
}
ll_mask = const_binop (LSHIFT_EXPR, fold_convert_loc (loc, lntype, ll_mask),
- size_int (xll_bitpos), 0);
+ size_int (xll_bitpos));
rl_mask = const_binop (LSHIFT_EXPR, fold_convert_loc (loc, lntype, rl_mask),
- size_int (xrl_bitpos), 0);
+ size_int (xrl_bitpos));
if (l_const)
{
l_const = fold_convert_loc (loc, lntype, l_const);
l_const = unextend (l_const, ll_bitsize, ll_unsignedp, ll_and_mask);
- l_const = const_binop (LSHIFT_EXPR, l_const, size_int (xll_bitpos), 0);
+ l_const = const_binop (LSHIFT_EXPR, l_const, size_int (xll_bitpos));
if (! integer_zerop (const_binop (BIT_AND_EXPR, l_const,
fold_build1_loc (loc, BIT_NOT_EXPR,
- lntype, ll_mask),
- 0)))
+ lntype, ll_mask))))
{
warning (0, "comparison is always %d", wanted_code == NE_EXPR);
@@ -5353,11 +5343,10 @@ fold_truthop (location_t loc, enum tree_code code, tree truth_type,
{
r_const = fold_convert_loc (loc, lntype, r_const);
r_const = unextend (r_const, rl_bitsize, rl_unsignedp, rl_and_mask);
- r_const = const_binop (LSHIFT_EXPR, r_const, size_int (xrl_bitpos), 0);
+ r_const = const_binop (LSHIFT_EXPR, r_const, size_int (xrl_bitpos));
if (! integer_zerop (const_binop (BIT_AND_EXPR, r_const,
fold_build1_loc (loc, BIT_NOT_EXPR,
- lntype, rl_mask),
- 0)))
+ lntype, rl_mask))))
{
warning (0, "comparison is always %d", wanted_code == NE_EXPR);
@@ -5398,18 +5387,18 @@ fold_truthop (location_t loc, enum tree_code code, tree truth_type,
lr_mask = const_binop (LSHIFT_EXPR, fold_convert_loc (loc,
rntype, lr_mask),
- size_int (xlr_bitpos), 0);
+ size_int (xlr_bitpos));
rr_mask = const_binop (LSHIFT_EXPR, fold_convert_loc (loc,
rntype, rr_mask),
- size_int (xrr_bitpos), 0);
+ size_int (xrr_bitpos));
/* Make a mask that corresponds to both fields being compared.
Do this for both items being compared. If the operands are the
same size and the bits being compared are in the same position
then we can do this by masking both and comparing the masked
results. */
- ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask, 0);
- lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_mask, 0);
+ ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask);
+ lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_mask);
if (lnbitsize == rnbitsize && xll_bitpos == xlr_bitpos)
{
lhs = make_bit_field_ref (loc, ll_inner, lntype, lnbitsize, lnbitpos,
@@ -5448,9 +5437,9 @@ fold_truthop (location_t loc, enum tree_code code, tree truth_type,
MIN (lr_bitpos, rr_bitpos), lr_unsignedp);
ll_mask = const_binop (RSHIFT_EXPR, ll_mask,
- size_int (MIN (xll_bitpos, xrl_bitpos)), 0);
+ size_int (MIN (xll_bitpos, xrl_bitpos)));
lr_mask = const_binop (RSHIFT_EXPR, lr_mask,
- size_int (MIN (xlr_bitpos, xrr_bitpos)), 0);
+ size_int (MIN (xlr_bitpos, xrr_bitpos)));
/* Convert to the smaller type before masking out unwanted bits. */
type = lntype;
@@ -5487,10 +5476,10 @@ fold_truthop (location_t loc, enum tree_code code, tree truth_type,
common between the masks, those bits of the constants must be the same.
If not, the condition is always false. Test for this to avoid generating
incorrect code below. */
- result = const_binop (BIT_AND_EXPR, ll_mask, rl_mask, 0);
+ result = const_binop (BIT_AND_EXPR, ll_mask, rl_mask);
if (! integer_zerop (result)
- && simple_cst_equal (const_binop (BIT_AND_EXPR, result, l_const, 0),
- const_binop (BIT_AND_EXPR, result, r_const, 0)) != 1)
+ && simple_cst_equal (const_binop (BIT_AND_EXPR, result, l_const),
+ const_binop (BIT_AND_EXPR, result, r_const)) != 1)
{
if (wanted_code == NE_EXPR)
{
@@ -5511,7 +5500,7 @@ fold_truthop (location_t loc, enum tree_code code, tree truth_type,
result = make_bit_field_ref (loc, ll_inner, lntype, lnbitsize, lnbitpos,
ll_unsignedp || rl_unsignedp);
- ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask, 0);
+ ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask);
if (! all_ones_mask_p (ll_mask, lnbitsize))
{
result = build2 (BIT_AND_EXPR, lntype, result, ll_mask);
@@ -5519,7 +5508,7 @@ fold_truthop (location_t loc, enum tree_code code, tree truth_type,
}
result = build2 (wanted_code, truth_type, result,
- const_binop (BIT_IOR_EXPR, l_const, r_const, 0));
+ const_binop (BIT_IOR_EXPR, l_const, r_const));
fold_truthop_exit:
SET_EXPR_LOCATION (result, loc);
@@ -5702,9 +5691,9 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
/* For a constant, we can always simplify if we are a multiply
or (for divide and modulus) if it is a multiple of our constant. */
if (code == MULT_EXPR
- || integer_zerop (const_binop (TRUNC_MOD_EXPR, t, c, 0)))
+ || integer_zerop (const_binop (TRUNC_MOD_EXPR, t, c)))
return const_binop (code, fold_convert (ctype, t),
- fold_convert (ctype, c), 0);
+ fold_convert (ctype, c));
break;
CASE_CONVERT: case NON_LVALUE_EXPR:
@@ -5812,7 +5801,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
&& 0 != (t1 = fold_convert (ctype,
const_binop (LSHIFT_EXPR,
size_one_node,
- op1, 0)))
+ op1)))
&& !TREE_OVERFLOW (t1))
return extract_muldiv (build2 (tcode == LSHIFT_EXPR
? MULT_EXPR : FLOOR_DIV_EXPR,
@@ -5880,10 +5869,10 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
/* If it's a multiply or a division/modulus operation of a multiple
of our constant, do the operation and verify it doesn't overflow. */
if (code == MULT_EXPR
- || integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c, 0)))
+ || integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c)))
{
op1 = const_binop (code, fold_convert (ctype, op1),
- fold_convert (ctype, c), 0);
+ fold_convert (ctype, c));
/* We allow the constant to overflow with wrapping semantics. */
if (op1 == 0
|| (TREE_OVERFLOW (op1) && !TYPE_OVERFLOW_WRAPS (ctype)))
@@ -5931,7 +5920,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
|| (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE
&& TYPE_IS_SIZETYPE (TREE_TYPE (t))))
&& TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST
- && integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c, 0)))
+ && integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c)))
{
*strict_overflow_p = true;
return omit_one_operand (type, integer_zero_node, op0);
@@ -5963,8 +5952,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
&& 0 != (t1 = int_const_binop (MULT_EXPR,
fold_convert (ctype, op1),
fold_convert (ctype, c), 1))
- && 0 != (t1 = force_fit_type_double (ctype, TREE_INT_CST_LOW (t1),
- TREE_INT_CST_HIGH (t1),
+ && 0 != (t1 = force_fit_type_double (ctype, tree_to_double_int (t1),
(TYPE_UNSIGNED (ctype)
&& tcode != MULT_EXPR) ? -1 : 1,
TREE_OVERFLOW (t1)))
@@ -5987,23 +5975,23 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
&& code != FLOOR_MOD_EXPR && code != ROUND_MOD_EXPR
&& code != MULT_EXPR)))
{
- if (integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c, 0)))
+ if (integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c)))
{
if (TYPE_OVERFLOW_UNDEFINED (ctype))
*strict_overflow_p = true;
return fold_build2 (tcode, ctype, fold_convert (ctype, op0),
fold_convert (ctype,
const_binop (TRUNC_DIV_EXPR,
- op1, c, 0)));
+ op1, c)));
}
- else if (integer_zerop (const_binop (TRUNC_MOD_EXPR, c, op1, 0)))
+ else if (integer_zerop (const_binop (TRUNC_MOD_EXPR, c, op1)))
{
if (TYPE_OVERFLOW_UNDEFINED (ctype))
*strict_overflow_p = true;
return fold_build2 (code, ctype, fold_convert (ctype, op0),
fold_convert (ctype,
const_binop (TRUNC_DIV_EXPR,
- c, op1, 0)));
+ c, op1)));
}
}
break;
@@ -6368,8 +6356,7 @@ fold_div_compare (location_t loc,
tree prod, tmp, hi, lo;
tree arg00 = TREE_OPERAND (arg0, 0);
tree arg01 = TREE_OPERAND (arg0, 1);
- unsigned HOST_WIDE_INT lpart;
- HOST_WIDE_INT hpart;
+ double_int val;
bool unsigned_p = TYPE_UNSIGNED (TREE_TYPE (arg0));
bool neg_overflow;
int overflow;
@@ -6380,9 +6367,8 @@ fold_div_compare (location_t loc,
TREE_INT_CST_HIGH (arg01),
TREE_INT_CST_LOW (arg1),
TREE_INT_CST_HIGH (arg1),
- &lpart, &hpart, unsigned_p);
- prod = force_fit_type_double (TREE_TYPE (arg00), lpart, hpart,
- -1, overflow);
+ &val.low, &val.high, unsigned_p);
+ prod = force_fit_type_double (TREE_TYPE (arg00), val, -1, overflow);
neg_overflow = false;
if (unsigned_p)
@@ -6396,8 +6382,8 @@ fold_div_compare (location_t loc,
TREE_INT_CST_HIGH (prod),
TREE_INT_CST_LOW (tmp),
TREE_INT_CST_HIGH (tmp),
- &lpart, &hpart, unsigned_p);
- hi = force_fit_type_double (TREE_TYPE (arg00), lpart, hpart,
+ &val.low, &val.high, unsigned_p);
+ hi = force_fit_type_double (TREE_TYPE (arg00), val,
-1, overflow | TREE_OVERFLOW (prod));
}
else if (tree_int_cst_sgn (arg01) >= 0)
@@ -6850,9 +6836,8 @@ fold_sign_changed_comparison (location_t loc, enum tree_code code, tree type,
return NULL_TREE;
if (TREE_CODE (arg1) == INTEGER_CST)
- arg1 = force_fit_type_double (inner_type, TREE_INT_CST_LOW (arg1),
- TREE_INT_CST_HIGH (arg1), 0,
- TREE_OVERFLOW (arg1));
+ arg1 = force_fit_type_double (inner_type, tree_to_double_int (arg1),
+ 0, TREE_OVERFLOW (arg1));
else
arg1 = fold_convert_loc (loc, inner_type, arg1);
@@ -7623,6 +7608,9 @@ build_fold_addr_expr_with_type_loc (location_t loc, tree t, tree ptrtype)
SET_EXPR_LOCATION (t, loc);
}
}
+ else if (TREE_CODE (t) == MEM_REF
+ && integer_zerop (TREE_OPERAND (t, 1)))
+ return TREE_OPERAND (t, 0);
else if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
{
t = build_fold_addr_expr_loc (loc, TREE_OPERAND (t, 0));
@@ -7957,9 +7945,8 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
}
if (change)
{
- tem = force_fit_type_double (type, TREE_INT_CST_LOW (and1),
- TREE_INT_CST_HIGH (and1), 0,
- TREE_OVERFLOW (and1));
+ tem = force_fit_type_double (type, tree_to_double_int (and1),
+ 0, TREE_OVERFLOW (and1));
return fold_build2_loc (loc, BIT_AND_EXPR, type,
fold_convert_loc (loc, type, and0), tem);
}
@@ -8042,6 +8029,9 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
if (TREE_CODE (op0) == VIEW_CONVERT_EXPR)
return fold_build1_loc (loc, VIEW_CONVERT_EXPR,
type, TREE_OPERAND (op0, 0));
+ if (TREE_CODE (op0) == MEM_REF)
+ return fold_build2_loc (loc, MEM_REF, type,
+ TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1));
/* For integral conversions with the same precision or pointer
conversions use a NOP_EXPR instead. */
@@ -8651,9 +8641,9 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
&& (TREE_CODE (lhs) != INTEGER_CST
|| !TREE_OVERFLOW (lhs)))
{
- fold_overflow_warning (("assuming signed overflow does not occur "
+ fold_overflow_warning ("assuming signed overflow does not occur "
"when changing X +- C1 cmp C2 to "
- "X cmp C1 +- C2"),
+ "X cmp C1 +- C2",
WARN_STRICT_OVERFLOW_COMPARISON);
return fold_build2_loc (loc, code, type, variable, lhs);
}
@@ -8693,6 +8683,11 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
else if (TREE_CODE (arg0) == POINTER_PLUS_EXPR)
{
base0 = TREE_OPERAND (arg0, 0);
+ if (TREE_CODE (base0) == ADDR_EXPR)
+ {
+ base0 = TREE_OPERAND (base0, 0);
+ indirect_base0 = true;
+ }
offset0 = TREE_OPERAND (arg0, 1);
}
@@ -8710,6 +8705,11 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
else if (TREE_CODE (arg1) == POINTER_PLUS_EXPR)
{
base1 = TREE_OPERAND (arg1, 0);
+ if (TREE_CODE (base1) == ADDR_EXPR)
+ {
+ base1 = TREE_OPERAND (base1, 0);
+ indirect_base1 = true;
+ }
offset1 = TREE_OPERAND (arg1, 1);
}
@@ -9015,7 +9015,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == REAL_CST
&& 0 != (tem = const_binop (TREE_CODE (arg0) == PLUS_EXPR
? MINUS_EXPR : PLUS_EXPR,
- arg1, TREE_OPERAND (arg0, 1), 0))
+ arg1, TREE_OPERAND (arg0, 1)))
&& !TREE_OVERFLOW (tem))
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), tem);
@@ -9028,7 +9028,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
&& TREE_CODE (arg0) == MINUS_EXPR
&& TREE_CODE (TREE_OPERAND (arg0, 0)) == REAL_CST
&& 0 != (tem = const_binop (MINUS_EXPR, TREE_OPERAND (arg0, 0),
- arg1, 0))
+ arg1))
&& !TREE_OVERFLOW (tem))
return fold_build2_loc (loc, swap_tree_comparison (code), type,
TREE_OPERAND (arg0, 1), tem);
@@ -9449,7 +9449,7 @@ fold_binary_loc (location_t loc,
/* Make sure type and arg0 have the same saturating flag. */
gcc_assert (TYPE_SATURATING (type)
== TYPE_SATURATING (TREE_TYPE (arg0)));
- tem = const_binop (code, arg0, arg1, 0);
+ tem = const_binop (code, arg0, arg1);
}
else if (kind == tcc_comparison)
tem = fold_relational_const (code, type, arg0, arg1);
@@ -9552,6 +9552,36 @@ fold_binary_loc (location_t loc,
switch (code)
{
+ case MEM_REF:
+ /* MEM[&MEM[p, CST1], CST2] -> MEM[p, CST1 + CST2]. */
+ if (TREE_CODE (arg0) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (arg0, 0)) == MEM_REF)
+ {
+ tree iref = TREE_OPERAND (arg0, 0);
+ return fold_build2 (MEM_REF, type,
+ TREE_OPERAND (iref, 0),
+ int_const_binop (PLUS_EXPR, arg1,
+ TREE_OPERAND (iref, 1), 0));
+ }
+
+ /* MEM[&a.b, CST2] -> MEM[&a, offsetof (a, b) + CST2]. */
+ if (TREE_CODE (arg0) == ADDR_EXPR
+ && handled_component_p (TREE_OPERAND (arg0, 0)))
+ {
+ tree base;
+ HOST_WIDE_INT coffset;
+ base = get_addr_base_and_unit_offset (TREE_OPERAND (arg0, 0),
+ &coffset);
+ if (!base)
+ return NULL_TREE;
+ return fold_build2 (MEM_REF, type,
+ build_fold_addr_expr (base),
+ int_const_binop (PLUS_EXPR, arg1,
+ size_int (coffset), 0));
+ }
+
+ return NULL_TREE;
+
case POINTER_PLUS_EXPR:
/* 0 +p index -> (type)index */
if (integer_zerop (arg0))
@@ -9708,7 +9738,7 @@ fold_binary_loc (location_t loc,
&& TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST
&& integer_zerop (const_binop (BIT_AND_EXPR,
TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 1), 0)))
+ TREE_OPERAND (arg1, 1))))
{
code = BIT_IOR_EXPR;
goto bit_ior;
@@ -10430,7 +10460,7 @@ fold_binary_loc (location_t loc,
&& TREE_CODE (TREE_OPERAND (arg0, 0)) == REAL_CST)
{
tree tem = const_binop (MULT_EXPR, TREE_OPERAND (arg0, 0),
- arg1, 0);
+ arg1);
if (tem)
return fold_build2_loc (loc, RDIV_EXPR, type, tem,
TREE_OPERAND (arg0, 1));
@@ -10799,7 +10829,7 @@ fold_binary_loc (location_t loc,
&& TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST
&& integer_zerop (const_binop (BIT_AND_EXPR,
TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 1), 0)))
+ TREE_OPERAND (arg1, 1))))
{
code = BIT_IOR_EXPR;
goto bit_ior;
@@ -11255,7 +11285,7 @@ fold_binary_loc (location_t loc,
{
if (flag_reciprocal_math
&& 0 != (tem = const_binop (code, build_real (type, dconst1),
- arg1, 0)))
+ arg1)))
return fold_build2_loc (loc, MULT_EXPR, type, arg0, tem);
/* Find the reciprocal if optimizing and the result is exact. */
if (optimize)
@@ -11292,7 +11322,7 @@ fold_binary_loc (location_t loc,
&& TREE_CODE (TREE_OPERAND (arg1, 1)) == REAL_CST)
{
tree tem = const_binop (RDIV_EXPR, arg0,
- TREE_OPERAND (arg1, 1), 0);
+ TREE_OPERAND (arg1, 1));
if (tem)
return fold_build2_loc (loc, RDIV_EXPR, type, tem,
TREE_OPERAND (arg1, 0));
@@ -11727,7 +11757,7 @@ fold_binary_loc (location_t loc,
{
tree tem = build_int_cst (TREE_TYPE (arg1),
TYPE_PRECISION (type));
- tem = const_binop (MINUS_EXPR, tem, arg1, 0);
+ tem = const_binop (MINUS_EXPR, tem, arg1);
return fold_build2_loc (loc, RROTATE_EXPR, type, op0, tem);
}
@@ -12074,7 +12104,7 @@ fold_binary_loc (location_t loc,
? MINUS_EXPR : PLUS_EXPR,
fold_convert_loc (loc, TREE_TYPE (arg0),
arg1),
- TREE_OPERAND (arg0, 1), 0))
+ TREE_OPERAND (arg0, 1)))
&& !TREE_OVERFLOW (tem))
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), tem);
@@ -12810,14 +12840,14 @@ fold_binary_loc (location_t loc,
{
case GT_EXPR:
arg1 = const_binop (PLUS_EXPR, arg1,
- build_int_cst (TREE_TYPE (arg1), 1), 0);
+ build_int_cst (TREE_TYPE (arg1), 1));
return fold_build2_loc (loc, EQ_EXPR, type,
fold_convert_loc (loc,
TREE_TYPE (arg1), arg0),
arg1);
case LE_EXPR:
arg1 = const_binop (PLUS_EXPR, arg1,
- build_int_cst (TREE_TYPE (arg1), 1), 0);
+ build_int_cst (TREE_TYPE (arg1), 1));
return fold_build2_loc (loc, NE_EXPR, type,
fold_convert_loc (loc, TREE_TYPE (arg1),
arg0),
@@ -12851,13 +12881,13 @@ fold_binary_loc (location_t loc,
switch (code)
{
case GE_EXPR:
- arg1 = const_binop (MINUS_EXPR, arg1, integer_one_node, 0);
+ arg1 = const_binop (MINUS_EXPR, arg1, integer_one_node);
return fold_build2_loc (loc, NE_EXPR, type,
fold_convert_loc (loc,
TREE_TYPE (arg1), arg0),
arg1);
case LT_EXPR:
- arg1 = const_binop (MINUS_EXPR, arg1, integer_one_node, 0);
+ arg1 = const_binop (MINUS_EXPR, arg1, integer_one_node);
return fold_build2_loc (loc, EQ_EXPR, type,
fold_convert_loc (loc, TREE_TYPE (arg1),
arg0),
@@ -14176,7 +14206,7 @@ multiple_of_p (tree type, const_tree top, const_tree bottom)
&& 0 != (t1 = fold_convert (type,
const_binop (LSHIFT_EXPR,
size_one_node,
- op1, 0)))
+ op1)))
&& !TREE_OVERFLOW (t1))
return multiple_of_p (type, t1, bottom);
}
@@ -15155,12 +15185,10 @@ fold_negate_const (tree arg0, tree type)
{
case INTEGER_CST:
{
- unsigned HOST_WIDE_INT low;
- HOST_WIDE_INT high;
- int overflow = neg_double (TREE_INT_CST_LOW (arg0),
- TREE_INT_CST_HIGH (arg0),
- &low, &high);
- t = force_fit_type_double (type, low, high, 1,
+ double_int val = tree_to_double_int (arg0);
+ int overflow = neg_double (val.low, val.high, &val.low, &val.high);
+
+ t = force_fit_type_double (type, val, 1,
(overflow | TREE_OVERFLOW (arg0))
&& !TYPE_UNSIGNED (type));
break;
@@ -15203,25 +15231,26 @@ fold_abs_const (tree arg0, tree type)
switch (TREE_CODE (arg0))
{
case INTEGER_CST:
- /* If the value is unsigned, then the absolute value is
- the same as the ordinary value. */
- if (TYPE_UNSIGNED (type))
- t = arg0;
- /* Similarly, if the value is non-negative. */
- else if (INT_CST_LT (integer_minus_one_node, arg0))
- t = arg0;
- /* If the value is negative, then the absolute value is
- its negation. */
- else
- {
- unsigned HOST_WIDE_INT low;
- HOST_WIDE_INT high;
- int overflow = neg_double (TREE_INT_CST_LOW (arg0),
- TREE_INT_CST_HIGH (arg0),
- &low, &high);
- t = force_fit_type_double (type, low, high, -1,
- overflow | TREE_OVERFLOW (arg0));
- }
+ {
+ double_int val = tree_to_double_int (arg0);
+
+ /* If the value is unsigned or non-negative, then the absolute value
+ is the same as the ordinary value. */
+ if (TYPE_UNSIGNED (type)
+ || !double_int_negative_p (val))
+ t = arg0;
+
+ /* If the value is negative, then the absolute value is
+ its negation. */
+ else
+ {
+ int overflow;
+
+ overflow = neg_double (val.low, val.high, &val.low, &val.high);
+ t = force_fit_type_double (type, val, -1,
+ overflow | TREE_OVERFLOW (arg0));
+ }
+ }
break;
case REAL_CST:
@@ -15242,17 +15271,14 @@ fold_abs_const (tree arg0, tree type)
constant. TYPE is the type of the result. */
static tree
-fold_not_const (tree arg0, tree type)
+fold_not_const (const_tree arg0, tree type)
{
- tree t = NULL_TREE;
+ double_int val;
gcc_assert (TREE_CODE (arg0) == INTEGER_CST);
- t = force_fit_type_double (type, ~TREE_INT_CST_LOW (arg0),
- ~TREE_INT_CST_HIGH (arg0), 0,
- TREE_OVERFLOW (arg0));
-
- return t;
+ val = double_int_not (tree_to_double_int (arg0));
+ return force_fit_type_double (type, val, 0, TREE_OVERFLOW (arg0));
}
/* Given CODE, a relational operator, the target type, TYPE and two
@@ -15650,25 +15676,23 @@ round_up_loc (location_t loc, tree value, int divisor)
{
if (TREE_CODE (value) == INTEGER_CST)
{
- unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (value);
- unsigned HOST_WIDE_INT high;
+ double_int val = tree_to_double_int (value);
bool overflow_p;
- if ((low & (divisor - 1)) == 0)
+ if ((val.low & (divisor - 1)) == 0)
return value;
overflow_p = TREE_OVERFLOW (value);
- high = TREE_INT_CST_HIGH (value);
- low &= ~(divisor - 1);
- low += divisor;
- if (low == 0)
+ val.low &= ~(divisor - 1);
+ val.low += divisor;
+ if (val.low == 0)
{
- high++;
- if (high == 0)
+ val.high++;
+ if (val.high == 0)
overflow_p = true;
}
- return force_fit_type_double (TREE_TYPE (value), low, high,
+ return force_fit_type_double (TREE_TYPE (value), val,
-1, overflow_p);
}
else
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0db8ce51016..18509132034 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,482 @@
+2010-06-29 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44718
+ * resolve.c (is_external_proc): Prevent procedure pointers from being
+ regarded as external procedures.
+
+2010-06-29 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44696
+ * trans-intrinsic.c (gfc_conv_associated): Handle polymorphic variables
+ passed as second argument of ASSOCIATED.
+
+2010-06-29 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/44582
+ * trans-expr.c (arrayfunc_assign_needs_temporary): New function
+ to determine if a function assignment can be made without a
+ temporary.
+ (gfc_trans_arrayfunc_assign): Move all the conditions that
+ suppress the direct function call to the above new functon and
+ call it.
+
+2010-06-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40158
+ * interface.c (argument_rank_mismatch): New function.
+ (compare_parameter): Call new function instead of generating
+ the error directly.
+
+2010-06-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * trans-openmp.c (dovar_init): Define. Define VECs containing it.
+ (gfc_trans_omp_do): Use a VEC to accumulate variables and their
+ initializers.
+
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * Make-lang.in: Update dependencies.
+
+2010-06-27 Nathan Froyd <froydnj@codesourcery.com>
+
+ * gfortran.h (gfc_code): Split backend_decl field into cycle_label
+ and exit_label fields.
+ * trans-openmp.c (gfc_trans_omp_do): Assign to new fields
+ individually.
+ * trans-stmt.c (gfc_trans_simple_do): Likewise.
+ (gfc_trans_do): Likewise.
+ (gfc_trans_do_while): Likewise.
+ (gfc_trans_cycle): Use cycle_label directly.
+ (gfc_trans_exit): Use exit_label directly.
+
+2010-06-27 Daniel Kraft <d@domob.eu>
+
+ * dump-parse-tree.c (show_symbol): Dump target-expression for
+ associate names.
+ (show_code_node): Make distinction between BLOCK and ASSOCIATE.
+ (show_namespace): Use show_level for correct indentation of
+ "inner namespaces" (contained procedures or BLOCK).
+
+2010-06-27 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/44678
+ * dump-parse-tree.c (show_code_node): Show namespace for
+ EXEC_BLOCK.
+
+2010-06-26 Tobias Burnus <burnus@net-b.de>
+
+ * decl.c (gfc_match_decl_type_spec): Support
+ TYPE(intrinsic-type-spec).
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * intrinsic.h (gfc_check_selected_real_kind,
+ gfc_simplify_selected_real_kind): Update prototypes.
+ * intrinsic.c (add_functions): Add radix support to
+ selected_real_kind.
+ * check.c (gfc_check_selected_real_kind): Ditto.
+ * simplify.c (gfc_simplify_selected_real_kind): Ditto.
+ * trans-decl.c (gfc_build_intrinsic_function_decls):
+ Change call from selected_real_kind to selected_real_kind2008.
+ * intrinsic.texi (SELECTED_REAL_KIND): Update for radix.
+ (PRECISION, RANGE, RADIX): Add cross @refs.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * decl.c (gfc_match_entry): Mark ENTRY as GFC_STD_F2008_OBS.
+ * gfortran.texi (_gfortran_set_options): Update for
+ GFC_STD_F2008_OBS addition.
+ * libgfortran.h: Add GFC_STD_F2008_OBS.
+ * options.c (set_default_std_flags, gfc_handle_option): Handle
+ GFC_STD_F2008_OBS.
+ io.c (check_format): Fix allow_std check.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * decl.c (gfc_match_entry): Allow END besides
+ END SUBROUTINE/END FUNCTION for contained procedures.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * parse.c (next_free, next_fixed): Allow ";" as first character.
+
+2010-06-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/44614
+ * decl.c (variable_decl): Fix IMPORT diagnostic for CLASS.
+
+2010-06-22 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44616
+ * resolve.c (resolve_fl_derived): Avoid checking for abstract on class
+ containers.
+
+2010-06-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40632
+ * interface.c (compare_parameter): Add gfc_is_simply_contiguous
+ checks.
+ * symbol.c (gfc_add_contiguous): New function.
+ (gfc_copy_attr, check_conflict): Handle contiguous attribute.
+ * decl.c (match_attr_spec): Ditto.
+ (gfc_match_contiguous): New function.
+ * resolve.c (resolve_fl_derived, resolve_symbol): Handle
+ contiguous.
+ * gfortran.h (symbol_attribute): Add contiguous.
+ (gfc_is_simply_contiguous): Add prototype.
+ (gfc_add_contiguous): Add prototype.
+ * match.h (gfc_match_contiguous): Add prototype.
+ * parse.c (decode_specification_statement,
+ decode_statement): Handle contiguous attribute.
+ * expr.c (gfc_is_simply_contiguous): New function.
+ * dump-parse-tree.c (show_attr): Handle contiguous.
+ * module.c (ab_attribute, attr_bits, mio_symbol_attribute):
+ Ditto.
+ * trans-expr.c (gfc_add_interface_mapping): Copy
+ attr.contiguous.
+ * trans-array.c (gfc_conv_descriptor_stride_get,
+ gfc_conv_array_parameter): Handle contiguous arrays.
+ * trans-types.c (gfc_build_array_type, gfc_build_array_type,
+ gfc_sym_type, gfc_get_derived_type, gfc_get_array_descr_info):
+ Ditto.
+ * trans.h (gfc_array_kind): Ditto.
+ * trans-decl.c (gfc_get_symbol_decl): Ditto.
+
+2010-06-20 Joseph Myers <joseph@codesourcery.com>
+
+ * options.c (gfc_handle_option): Don't handle N_OPTS.
+
+2010-06-19 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44584
+ * resolve.c (resolve_fl_derived): Reverse ordering of conditions
+ to avoid ICE.
+
+2010-06-18 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/44556
+ * resolve.c (resolve_allocate_deallocate): Properly check
+ part-refs in stat=/errmsg= for invalid use.
+
+2010-06-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44558
+ * resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
+ Return directly in case of an error.
+
+2010-06-16 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44549
+ * gfortran.h (gfc_get_typebound_proc): Modified Prototype.
+ * decl.c (match_procedure_in_type): Give a unique gfc_typebound_proc
+ structure to each procedure in a procedure list.
+ * module.c (mio_typebound_proc): Add NULL argument to
+ 'gfc_get_typebound_proc'.
+ * symbol.c (gfc_get_typebound_proc): Add a new argument, which is used
+ to initialize the new structure.
+
+2010-06-15 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/43388
+ * gfortran.h (gfc_expr): Add new member 'mold'.
+ * match.c (gfc_match_allocate): Implement the MOLD tag.
+ * resolve.c (resolve_allocate_expr): Ditto.
+ * trans-stmt.c (gfc_trans_allocate): Ditto.
+
+2010-06-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/44536
+ * trans-openmp.c (gfc_omp_predetermined_sharing): Don't return
+ OMP_CLAUSE_DEFAULT_SHARED for artificial vars with
+ GFC_DECL_SAVED_DESCRIPTOR set.
+ (gfc_omp_report_decl): New function.
+ * trans.h (gfc_omp_report_decl): New prototype.
+ * f95-lang.c (LANG_HOOKS_OMP_REPORT_DECL): Redefine.
+
+2010-06-13 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/31588
+ PR fortran/43954
+ * gfortranspec.c (lang_specific_driver): Removed deprecation
+ warning for -M.
+ * lang.opt: Add options -M, -MM, -MD, -MMD, -MF, -MG, -MP, -MT, -MQ.
+ * lang-specs.h (CPP_FORWARD_OPTIONS): Add -M* options.
+ * cpp.h (gfc_cpp_makedep): New.
+ (gfc_cpp_add_dep): New.
+ (gfc_cpp_add_target): New.
+ * cpp.c (gfc_cpp_option): Add deps* members.
+ (gfc_cpp_makedep): New.
+ (gfc_cpp_add_dep): New.
+ (gfc_cpp_add_target): New.
+ (gfc_cpp_init_options): Initialize new options.
+ (gfc_cpp_handle_option): Handle new options.
+ (gfc_cpp_post_options): Map new options to libcpp-options.
+ (gfc_cpp_init): Handle deferred -MQ and -MT options.
+ (gfc_cpp_done): If requested, write dependencies to file.
+ * module.c (gfc_dump_module): Add a module filename as target.
+ * scanner.c (open_included_file): New parameter system; add the
+ included file as dependency.
+ (gfc_open_included_file): Add the included file as dependency.
+ (gfc_open_intrinsic_module): Likewise.
+ * invoke.texi: Removed deprecation warning for -M.
+ * gfortran.texi: Removed Makefile-dependencies project.
+
+2010-06-12 Daniel Franke <franke.daniel@gmail.com>
+
+ * resolve.c (resolve_global_procedure): Improved checking if an
+ explicit interface is required.
+
+2010-06-12 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * trans-decl.c (gfc_build_intrinsic_function_decls): Fix
+ return type.
+ * trans-intrinsic.c (gfc_conv_intrinsic_fdate): Fix argument type.
+ (gfc_conv_intrinsic_ttynam): Likewise.
+ (gfc_conv_intrinsic_trim): Likewise.
+
+2010-06-12 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40117
+ * decl.c (match_procedure_in_type): Allow procedure lists (F08).
+
+2010-06-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_build_intrinsic_lib_fndecls): Fix comment.
+
+2010-06-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * mathbuiltins.def: Add builtins that do not directly correspond
+ to a Fortran intrinsic, with new macro OTHER_BUILTIN.
+ * f95-lang.c (gfc_init_builtin_functions): Define OTHER_BUILTIN.
+ * trans-intrinsic.c (gfc_intrinsic_map_t): Remove
+ code_{r,c}{4,8,10,16} fields. Add
+ {,complex}{float,double,long_double}_built_in fields.
+ (gfc_intrinsic_map): Adjust definitions of DEFINE_MATH_BUILTIN,
+ DEFINE_MATH_BUILTIN_C and LIB_FUNCTION accordingly. Add
+ definition of OTHER_BUILTIN.
+ (real_compnt_info): Remove unused struct.
+ (builtin_decl_for_precision, builtin_decl_for_float_kind): New
+ functions.
+ (build_round_expr): Call builtin_decl_for_precision instead of
+ series of if-else.
+ (gfc_conv_intrinsic_aint): Call builtin_decl_for_float_kind
+ instead of a switch.
+ (gfc_build_intrinsic_lib_fndecls): Match
+ {real,complex}{4,8,10,16}decl into the C-style built_in_decls.
+ (gfc_get_intrinsic_lib_fndecl): Do not hardcode floating-point
+ kinds.
+ (gfc_conv_intrinsic_lib_function): Go through all the extended
+ gfc_intrinsic_map.
+ (gfc_trans_same_strlen_check): Call builtin_decl_for_float_kind
+ instead of a switch.
+ (gfc_conv_intrinsic_abs): Likewise.
+ (gfc_conv_intrinsic_mod): Likewise.
+ (gfc_conv_intrinsic_sign): Likewise.
+ (gfc_conv_intrinsic_fraction): Likewise.
+ (gfc_conv_intrinsic_nearest): Likewise.
+ (gfc_conv_intrinsic_spacing): Likewise.
+ (gfc_conv_intrinsic_rrspacing): Likewise.
+ (gfc_conv_intrinsic_scale): Likewise.
+ (gfc_conv_intrinsic_set_exponent): Likewise.
+
+2010-06-11 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/42051
+ PR fortran/43896
+ * trans-expr.c (gfc_conv_derived_to_class): Handle array-valued
+ functions with CLASS formal arguments.
+
+2010-06-10 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44207
+ * resolve.c (conformable_arrays): Handle allocatable components.
+
+2010-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/38273
+ * gfortran.texi: Document that Cray pointers cannot be function
+ results.
+
+2010-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/36234
+ * gfortran.texi: Document lack of support for syntax
+ "complex FUNCTION name*16()", and existence of alternative
+ legacy syntax "complex*16 FUNCTION name()".
+
+2010-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/43032
+ * intrinsic.texi (FLUSH): Note the difference between FLUSH and
+ POSIX's fsync(), and how to call the latter from Fortran code.
+
+2010-06-10 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/44457
+ * interface.c (compare_actual_formal): Reject actual arguments with
+ array subscript passed to ASYNCHRONOUS dummys.
+
+2010-06-10 Daniel Kraft <d@domob.eu>
+
+ PR fortran/38936
+ * gfortran.h (enum gfc_statement): Add ST_ASSOCIATE, ST_END_ASSOCIATE.
+ (struct gfc_symbol): New field `assoc'.
+ (struct gfc_association_list): New struct.
+ (struct gfc_code): New struct `block' in union, move `ns' there
+ and add association list.
+ (gfc_free_association_list): New method.
+ (gfc_has_vector_subscript): Made public;
+ * match.h (gfc_match_associate): New method.
+ * parse.h (enum gfc_compile_state): Add COMP_ASSOCIATE.
+ * decl.c (gfc_match_end): Handle ST_END_ASSOCIATE.
+ * interface.c (gfc_has_vector_subscript): Made public.
+ (compare_actual_formal): Rename `has_vector_subscript' accordingly.
+ * match.c (gfc_match_associate): New method.
+ (gfc_match_select_type): Change reference to gfc_code's `ns' field.
+ * primary.c (match_variable): Don't allow names associated to expr here.
+ * parse.c (decode_statement): Try matching ASSOCIATE statement.
+ (case_exec_markers, case_end): Add ASSOCIATE statement.
+ (gfc_ascii_statement): Hande ST_ASSOCIATE and ST_END_ASSOCIATE.
+ (parse_associate): New method.
+ (parse_executable): Handle ST_ASSOCIATE.
+ (parse_block_construct): Change reference to gfc_code's `ns' field.
+ * resolve.c (resolve_select_type): Ditto.
+ (resolve_code): Ditto.
+ (resolve_block_construct): Ditto and add comment.
+ (resolve_select_type): Set association list in generated BLOCK to NULL.
+ (resolve_symbol): Resolve associate names.
+ * st.c (gfc_free_statement): Change reference to gfc_code's `ns' field
+ and free association list.
+ (gfc_free_association_list): New method.
+ * symbol.c (gfc_new_symbol): NULL new field `assoc'.
+ * trans-stmt.c (gfc_trans_block_construct): Change reference to
+ gfc_code's `ns' field.
+
+2010-06-10 Kai Tietz <kai.tietz@onevision.com>
+
+ * error.c (error_print): Pre-initialize loc by NULL.
+ * openmp.c (resolve_omp_clauses): Add explicit
+ braces to avoid ambigous else.
+ * array.c (match_subscript): Pre-initialize m to MATCH_ERROR.
+
+2010-06-10 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * gfc-internals.texi: Move to GFDL 1.3.
+ * gfortran.texi: Ditto.
+ * intrinsic.texi: Ditto.
+ * invoke.texi: Ditto.
+
+2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/44347
+ * check.c (gfc_check_selected_real_kind): Verify that the
+ actual arguments are scalar.
+
+2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/44359
+ * intrinsic.c (gfc_convert_type_warn): Further improve -Wconversion.
+
+2010-06-09 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44430
+ * dump-parse-tree.c (show_symbol): Avoid infinite loop.
+
+2010-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ * fortran/symbol.c (check_conflict): Remove an invalid conflict check.
+
+2010-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ * fortran/intrinsic.c (add_functions): Change gfc_check_btest,
+ gfc_check_ibclr, and gfc_check_ibset to gfc_check_bitfcn.
+ * fortran/intrinsic.h: Remove prototypes for gfc_check_btest,
+ gfc_check_ibclr, and gfc_check_ibset. Add prototype for
+ gfc_check_bitfcn.
+ * fortran/check.c (nonnegative_check, less_than_bitsize1,
+ less_than_bitsize2): New functions.
+ (gfc_check_btest): Renamed to gfc_check_bitfcn. Use
+ nonnegative_check and less_than_bitsize1.
+ (gfc_check_ibclr, gfc_check_ibset): Removed.
+ (gfc_check_ibits,gfc_check_mvbits): Use nonnegative_check and
+ less_than_bitsize1.
+
+2010-06-09 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44211
+ * resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
+ Resolve references.
+
+2010-06-09 Kai Tietz <kai.tietz@onevision.com>
+
+ * resolve.c (resolve_deallocate_expr): Avoid warning
+ about possible use of iunitialized sym.
+ (resolve_allocate_expr): Pre-initialize sym by NULL.
+
+2010-06-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/43040
+ * f95-lang.c (gfc_init_builtin_functions): Remove comment.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * trans-types.c (gfc_get_nodesc_array_type): Use typed GC
+ allocation.
+ (gfc_get_array_type_bounds): Likewise.
+
+ * trans-decl.c (gfc_allocate_lang_decl): Likewise.
+ (gfc_find_module): Likewise.
+
+ * f95-lang.c (pushlevel): Likewise.
+
+ * trans.h (struct lang_type): Add variable_size GTY option.
+ (struct lang_decl): Likewise.
+
+2010-06-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/44446
+ * symbol.c (check_conflict): Move protected--external/procedure check ...
+ * resolve.c (resolve_select_type): ... to the resolution stage.
+
+2010-06-07 Tobias Burnus <burnus@net-b.de>
+
+ * options.c (gfc_handle_option): Fix -fno-recursive.
+
+2010-06-07 Tobias Burnus <burnus@net-b.de>
+
+ * gfc-internals.texi (copyrights-gfortran): Fix copyright year format.
+ * gfortran.texi (copyrights-gfortran): Ditto.
+
+2010-06-07 Joseph Myers <joseph@codesourcery.com>
+
+ * lang.opt (fshort-enums): Define using Var and VarExists.
+ * options.c (gfc_handle_option): Don't set flag_short_enums here.
+
+2010-06-05 Paul Thomas <pault@gcc.gnu.org>
+ Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/43945
+ * resolve.c (get_declared_from_expr): Move to before
+ resolve_typebound_generic_call. Make new_ref and class_ref
+ ignorable if set to NULL.
+ (resolve_typebound_generic_call): Once we have resolved the
+ generic call, check that the specific instance is that which
+ is bound to the declared type.
+ (resolve_typebound_function,resolve_typebound_subroutine): Avoid
+ freeing 'class_ref->next' twice.
+
+2010-06-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/43895
+ * trans-array.c (structure_alloc_comps): Dereference scalar
+ 'decl' if it is a REFERENCE_TYPE. Tidy expressions containing
+ TREE_TYPE (decl).
+
+2010-06-04 Joseph Myers <joseph@codesourcery.com>
+
+ * gfortranspec.c (append_arg, lang_specific_driver): Use
+ GCC-specific formats in diagnostics.
+
2010-06-02 Tobias Burnus <burnus@net-b.de>
PR fortran/44360
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index b74f9e99d0b..2a8c791c445 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -336,7 +336,7 @@ GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/libgfortran.h \
fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
gt-fortran-f95-lang.h gtype-fortran.h $(CGRAPH_H) $(TARGET_H) fortran/cpp.h \
$(BUILTINS_DEF) fortran/types.def \
- libfuncs.h expr.h except.h
+ libfuncs.h expr.h
fortran/scanner.o: toplev.h fortran/cpp.h
fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans.o: $(GFORTRAN_TRANS_DEPS) tree-iterator.h
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 3ffc39714da..64816f28abb 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -64,7 +64,7 @@ gfc_copy_array_ref (gfc_array_ref *src)
static match
match_subscript (gfc_array_ref *ar, int init, bool match_star)
{
- match m;
+ match m = MATCH_ERROR;
bool star = false;
int i;
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 3a68c29b543..34527172431 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -241,6 +241,80 @@ array_check (gfc_expr *e, int n)
}
+/* If expr is a constant, then check to ensure that it is greater than
+ of equal to zero. */
+
+static gfc_try
+nonnegative_check (const char *arg, gfc_expr *expr)
+{
+ int i;
+
+ if (expr->expr_type == EXPR_CONSTANT)
+ {
+ gfc_extract_int (expr, &i);
+ if (i < 0)
+ {
+ gfc_error ("'%s' at %L must be nonnegative", arg, &expr->where);
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+
+
+/* If expr2 is constant, then check that the value is less than
+ bit_size(expr1). */
+
+static gfc_try
+less_than_bitsize1 (const char *arg1, gfc_expr *expr1, const char *arg2,
+ gfc_expr *expr2)
+{
+ int i2, i3;
+
+ if (expr2->expr_type == EXPR_CONSTANT)
+ {
+ gfc_extract_int (expr2, &i2);
+ i3 = gfc_validate_kind (BT_INTEGER, expr1->ts.kind, false);
+ if (i2 >= gfc_integer_kinds[i3].bit_size)
+ {
+ gfc_error ("'%s' at %L must be less than BIT_SIZE('%s')",
+ arg2, &expr2->where, arg1);
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+
+
+/* If expr2 and expr3 are constants, then check that the value is less than
+ or equal to bit_size(expr1). */
+
+static gfc_try
+less_than_bitsize2 (const char *arg1, gfc_expr *expr1, const char *arg2,
+ gfc_expr *expr2, const char *arg3, gfc_expr *expr3)
+{
+ int i2, i3;
+
+ if (expr2->expr_type == EXPR_CONSTANT && expr3->expr_type == EXPR_CONSTANT)
+ {
+ gfc_extract_int (expr2, &i2);
+ gfc_extract_int (expr3, &i3);
+ i2 += i3;
+ i3 = gfc_validate_kind (BT_INTEGER, expr1->ts.kind, false);
+ if (i2 > gfc_integer_kinds[i3].bit_size)
+ {
+ gfc_error ("'%s + %s' at %L must be less than or equal "
+ "to BIT_SIZE('%s')",
+ arg2, arg3, &expr2->where, arg1);
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+
/* Make sure two expressions have the same type. */
static gfc_try
@@ -766,13 +840,20 @@ gfc_check_besn (gfc_expr *n, gfc_expr *x)
gfc_try
-gfc_check_btest (gfc_expr *i, gfc_expr *pos)
+gfc_check_bitfcn (gfc_expr *i, gfc_expr *pos)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
return FAILURE;
+
if (type_check (pos, 1, BT_INTEGER) == FAILURE)
return FAILURE;
+ if (nonnegative_check ("pos", pos) == FAILURE)
+ return FAILURE;
+
+ if (less_than_bitsize1 ("i", i, "pos", pos) == FAILURE)
+ return FAILURE;
+
return SUCCESS;
}
@@ -1389,19 +1470,6 @@ gfc_check_iand (gfc_expr *i, gfc_expr *j)
gfc_try
-gfc_check_ibclr (gfc_expr *i, gfc_expr *pos)
-{
- if (type_check (i, 0, BT_INTEGER) == FAILURE)
- return FAILURE;
-
- if (type_check (pos, 1, BT_INTEGER) == FAILURE)
- return FAILURE;
-
- return SUCCESS;
-}
-
-
-gfc_try
gfc_check_ibits (gfc_expr *i, gfc_expr *pos, gfc_expr *len)
{
if (type_check (i, 0, BT_INTEGER) == FAILURE)
@@ -1413,17 +1481,13 @@ gfc_check_ibits (gfc_expr *i, gfc_expr *pos, gfc_expr *len)
if (type_check (len, 2, BT_INTEGER) == FAILURE)
return FAILURE;
- return SUCCESS;
-}
-
+ if (nonnegative_check ("pos", pos) == FAILURE)
+ return FAILURE;
-gfc_try
-gfc_check_ibset (gfc_expr *i, gfc_expr *pos)
-{
- if (type_check (i, 0, BT_INTEGER) == FAILURE)
+ if (nonnegative_check ("len", len) == FAILURE)
return FAILURE;
- if (type_check (pos, 1, BT_INTEGER) == FAILURE)
+ if (less_than_bitsize2 ("i", i, "pos", pos, "len", len) == FAILURE)
return FAILURE;
return SUCCESS;
@@ -2856,21 +2920,45 @@ gfc_check_selected_int_kind (gfc_expr *r)
gfc_try
-gfc_check_selected_real_kind (gfc_expr *p, gfc_expr *r)
+gfc_check_selected_real_kind (gfc_expr *p, gfc_expr *r, gfc_expr *radix)
{
- if (p == NULL && r == NULL)
+ if (p == NULL && r == NULL
+ && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: SELECTED_REAL_KIND with"
+ " neither 'P' nor 'R' argument at %L",
+ gfc_current_intrinsic_where) == FAILURE)
+ return FAILURE;
+
+ if (p)
{
- gfc_error ("Missing arguments to %s intrinsic at %L",
- gfc_current_intrinsic, gfc_current_intrinsic_where);
+ if (type_check (p, 0, BT_INTEGER) == FAILURE)
+ return FAILURE;
- return FAILURE;
+ if (scalar_check (p, 0) == FAILURE)
+ return FAILURE;
}
- if (p != NULL && type_check (p, 0, BT_INTEGER) == FAILURE)
- return FAILURE;
+ if (r)
+ {
+ if (type_check (r, 1, BT_INTEGER) == FAILURE)
+ return FAILURE;
- if (r != NULL && type_check (r, 1, BT_INTEGER) == FAILURE)
- return FAILURE;
+ if (scalar_check (r, 1) == FAILURE)
+ return FAILURE;
+ }
+
+ if (radix)
+ {
+ if (type_check (radix, 1, BT_INTEGER) == FAILURE)
+ return FAILURE;
+
+ if (scalar_check (radix, 1) == FAILURE)
+ return FAILURE;
+
+ if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: '%s' intrinsic with "
+ "RADIX argument at %L", gfc_current_intrinsic,
+ &radix->where) == FAILURE)
+ return FAILURE;
+ }
return SUCCESS;
}
@@ -3646,6 +3734,22 @@ gfc_check_mvbits (gfc_expr *from, gfc_expr *frompos, gfc_expr *len,
if (type_check (topos, 4, BT_INTEGER) == FAILURE)
return FAILURE;
+ if (nonnegative_check ("frompos", frompos) == FAILURE)
+ return FAILURE;
+
+ if (nonnegative_check ("topos", topos) == FAILURE)
+ return FAILURE;
+
+ if (nonnegative_check ("len", len) == FAILURE)
+ return FAILURE;
+
+ if (less_than_bitsize2 ("from", from, "frompos", frompos, "len", len)
+ == FAILURE)
+ return FAILURE;
+
+ if (less_than_bitsize2 ("to", to, "topos", topos, "len", len) == FAILURE)
+ return FAILURE;
+
return SUCCESS;
}
diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
index 8dbd157deaa..7f960f5e557 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "../../libcpp/internal.h"
#include "cpp.h"
#include "incpath.h"
+#include "mkdeps.h"
#ifndef TARGET_OS_CPP_BUILTINS
# define TARGET_OS_CPP_BUILTINS()
@@ -84,6 +85,12 @@ struct gfc_cpp_option_data
int no_predefined; /* -undef */
int standard_include_paths; /* -nostdinc */
int verbose; /* -v */
+ int deps; /* -M */
+ int deps_skip_system; /* -MM */
+ const char *deps_filename; /* -M[M]D */
+ const char *deps_filename_user; /* -MF <arg> */
+ int deps_missing_are_generated; /* -MG */
+ int deps_phony; /* -MP */
const char *multilib; /* -imultilib <dir> */
const char *prefix; /* -iprefix <dir> */
@@ -270,6 +277,26 @@ gfc_cpp_preprocess_only (void)
return gfc_cpp_option.preprocess_only;
}
+bool
+gfc_cpp_makedep (void)
+{
+ return gfc_cpp_option.deps;
+}
+
+void
+gfc_cpp_add_dep (const char *name, bool system)
+{
+ if (!gfc_cpp_option.deps_skip_system || !system)
+ deps_add_dep (cpp_get_deps (cpp_in), name);
+}
+
+void
+gfc_cpp_add_target (const char *name)
+{
+ deps_add_target (cpp_get_deps (cpp_in), name, 0);
+}
+
+
const char *
gfc_cpp_temporary_file (void)
{
@@ -299,6 +326,12 @@ gfc_cpp_init_options (unsigned int argc,
gfc_cpp_option.no_predefined = 0;
gfc_cpp_option.standard_include_paths = 1;
gfc_cpp_option.verbose = 0;
+ gfc_cpp_option.deps = 0;
+ gfc_cpp_option.deps_skip_system = 0;
+ gfc_cpp_option.deps_phony = 0;
+ gfc_cpp_option.deps_missing_are_generated = 0;
+ gfc_cpp_option.deps_filename = NULL;
+ gfc_cpp_option.deps_filename_user = NULL;
gfc_cpp_option.multilib = NULL;
gfc_cpp_option.prefix = NULL;
@@ -414,6 +447,43 @@ gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED
gfc_cpp_option.print_include_names = 1;
break;
+ case OPT_MM:
+ gfc_cpp_option.deps_skip_system = 1;
+ /* fall through */
+
+ case OPT_M:
+ gfc_cpp_option.deps = 1;
+ break;
+
+ case OPT_MMD:
+ gfc_cpp_option.deps_skip_system = 1;
+ /* fall through */
+
+ case OPT_MD:
+ gfc_cpp_option.deps = 1;
+ gfc_cpp_option.deps_filename = arg;
+ break;
+
+ case OPT_MF:
+ /* If specified multiple times, last one wins. */
+ gfc_cpp_option.deps_filename_user = arg;
+ break;
+
+ case OPT_MG:
+ gfc_cpp_option.deps_missing_are_generated = 1;
+ break;
+
+ case OPT_MP:
+ gfc_cpp_option.deps_phony = 1;
+ break;
+
+ case OPT_MQ:
+ case OPT_MT:
+ gfc_cpp_option.deferred_opt[gfc_cpp_option.deferred_opt_count].code = code;
+ gfc_cpp_option.deferred_opt[gfc_cpp_option.deferred_opt_count].arg = arg;
+ gfc_cpp_option.deferred_opt_count++;
+ break;
+
case OPT_P:
gfc_cpp_option.no_line_commands = 1;
break;
@@ -430,16 +500,17 @@ gfc_cpp_post_options (void)
an error. */
if (!gfc_cpp_enabled ()
&& (gfc_cpp_preprocess_only ()
- || !gfc_cpp_option.discard_comments
- || !gfc_cpp_option.discard_comments_in_macro_exp
- || gfc_cpp_option.print_include_names
- || gfc_cpp_option.no_line_commands
- || gfc_cpp_option.dump_macros
- || gfc_cpp_option.dump_includes))
+ || gfc_cpp_makedep ()
+ || !gfc_cpp_option.discard_comments
+ || !gfc_cpp_option.discard_comments_in_macro_exp
+ || gfc_cpp_option.print_include_names
+ || gfc_cpp_option.no_line_commands
+ || gfc_cpp_option.dump_macros
+ || gfc_cpp_option.dump_includes))
gfc_fatal_error("To enable preprocessing, use -cpp");
cpp_in = cpp_create_reader (CLK_GNUC89, NULL, line_table);
- if (!gfc_cpp_enabled())
+ if (!gfc_cpp_enabled ())
return;
gcc_assert (cpp_in);
@@ -462,6 +533,17 @@ gfc_cpp_post_options (void)
cpp_option->print_include_names = gfc_cpp_option.print_include_names;
cpp_option->preprocessed = gfc_option.flag_preprocessed;
+ if (gfc_cpp_makedep ())
+ {
+ cpp_option->deps.style = DEPS_USER;
+ cpp_option->deps.phony_targets = gfc_cpp_option.deps_phony;
+ cpp_option->deps.missing_files = gfc_cpp_option.deps_missing_are_generated;
+
+ /* -MF <arg> overrides -M[M]D. */
+ if (gfc_cpp_option.deps_filename_user)
+ gfc_cpp_option.deps_filename = gfc_cpp_option.deps_filename_user;
+ }
+
if (gfc_cpp_option.working_directory == -1)
gfc_cpp_option.working_directory = (debug_info_level != DINFO_LEVEL_NONE);
@@ -572,6 +654,9 @@ gfc_cpp_init (void)
else
cpp_assert (cpp_in, opt->arg);
}
+ else if (opt->code == OPT_MT || opt->code == OPT_MQ)
+ deps_add_target (cpp_get_deps (cpp_in),
+ opt->arg, opt->code == OPT_MQ);
}
if (gfc_cpp_option.working_directory
@@ -615,14 +700,27 @@ gfc_cpp_done (void)
if (!gfc_cpp_enabled ())
return;
- /* TODO: if dependency tracking was enabled, call
- cpp_finish() here to write dependencies.
+ gcc_assert (cpp_in);
- Use cpp_get_deps() to access the current source's
- dependencies during parsing. Add dependencies using
- the mkdeps-interface (defined in libcpp). */
+ if (gfc_cpp_makedep ())
+ {
+ if (gfc_cpp_option.deps_filename)
+ {
+ FILE *f = fopen (gfc_cpp_option.deps_filename, "w");
+ if (f)
+ {
+ cpp_finish (cpp_in, f);
+ fclose (f);
+ }
+ else
+ gfc_fatal_error ("opening output file %s: %s",
+ gfc_cpp_option.deps_filename,
+ xstrerror (errno));
+ }
+ else
+ cpp_finish (cpp_in, stdout);
+ }
- gcc_assert (cpp_in);
cpp_undef_all (cpp_in);
cpp_clear_file_cache (cpp_in);
}
diff --git a/gcc/fortran/cpp.h b/gcc/fortran/cpp.h
index 54a899f6a8e..556eecbc099 100644
--- a/gcc/fortran/cpp.h
+++ b/gcc/fortran/cpp.h
@@ -24,6 +24,12 @@ bool gfc_cpp_enabled (void);
bool gfc_cpp_preprocess_only (void);
+bool gfc_cpp_makedep (void);
+
+void gfc_cpp_add_dep (const char *name, bool system);
+
+void gfc_cpp_add_target (const char *name);
+
const char *gfc_cpp_temporary_file (void);
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 9786a860bae..07c3acb9467 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1764,7 +1764,7 @@ variable_decl (int elem)
specified in the procedure definition, except that the interface
may specify a procedure that is not pure if the procedure is
defined to be pure(12.3.2). */
- if (current_ts.type == BT_DERIVED
+ if ((current_ts.type == BT_DERIVED || current_ts.type == BT_CLASS)
&& gfc_current_ns->proc_name
&& gfc_current_ns->proc_name->attr.if_source == IFSRC_IFBODY
&& current_ts.u.derived->ns != gfc_current_ns)
@@ -2342,7 +2342,7 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
gfc_symbol *sym;
match m;
char c;
- bool seen_deferred_kind;
+ bool seen_deferred_kind, matched_type;
/* A belt and braces check that the typespec is correctly being treated
as a deferred characteristic association. */
@@ -2374,47 +2374,88 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
return MATCH_YES;
}
- if (gfc_match (" integer") == MATCH_YES)
+
+ m = gfc_match (" type ( %n", name);
+ matched_type = (m == MATCH_YES);
+
+ if ((matched_type && strcmp ("integer", name) == 0)
+ || (!matched_type && gfc_match (" integer") == MATCH_YES))
{
ts->type = BT_INTEGER;
ts->kind = gfc_default_integer_kind;
goto get_kind;
}
- if (gfc_match (" character") == MATCH_YES)
+ if ((matched_type && strcmp ("character", name) == 0)
+ || (!matched_type && gfc_match (" character") == MATCH_YES))
{
+ if (matched_type
+ && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: TYPE with "
+ "intrinsic-type-spec at %C") == FAILURE)
+ return MATCH_ERROR;
+
ts->type = BT_CHARACTER;
if (implicit_flag == 0)
- return gfc_match_char_spec (ts);
+ m = gfc_match_char_spec (ts);
else
- return MATCH_YES;
+ m = MATCH_YES;
+
+ if (matched_type && m == MATCH_YES && gfc_match_char (')') != MATCH_YES)
+ m = MATCH_ERROR;
+
+ return m;
}
- if (gfc_match (" real") == MATCH_YES)
+ if ((matched_type && strcmp ("real", name) == 0)
+ || (!matched_type && gfc_match (" real") == MATCH_YES))
{
ts->type = BT_REAL;
ts->kind = gfc_default_real_kind;
goto get_kind;
}
- if (gfc_match (" double precision") == MATCH_YES)
+ if ((matched_type
+ && (strcmp ("doubleprecision", name) == 0
+ || (strcmp ("double", name) == 0
+ && gfc_match (" precision") == MATCH_YES)))
+ || (!matched_type && gfc_match (" double precision") == MATCH_YES))
{
+ if (matched_type
+ && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: TYPE with "
+ "intrinsic-type-spec at %C") == FAILURE)
+ return MATCH_ERROR;
+ if (matched_type && gfc_match_char (')') != MATCH_YES)
+ return MATCH_ERROR;
+
ts->type = BT_REAL;
ts->kind = gfc_default_double_kind;
return MATCH_YES;
}
- if (gfc_match (" complex") == MATCH_YES)
+ if ((matched_type && strcmp ("complex", name) == 0)
+ || (!matched_type && gfc_match (" complex") == MATCH_YES))
{
ts->type = BT_COMPLEX;
ts->kind = gfc_default_complex_kind;
goto get_kind;
}
- if (gfc_match (" double complex") == MATCH_YES)
+ if ((matched_type
+ && (strcmp ("doublecomplex", name) == 0
+ || (strcmp ("double", name) == 0
+ && gfc_match (" complex") == MATCH_YES)))
+ || (!matched_type && gfc_match (" double complex") == MATCH_YES))
{
- if (gfc_notify_std (GFC_STD_GNU, "DOUBLE COMPLEX at %C does not "
- "conform to the Fortran 95 standard") == FAILURE)
+ if (gfc_notify_std (GFC_STD_GNU, "Extension: DOUBLE COMPLEX at %C")
+ == FAILURE)
+ return MATCH_ERROR;
+
+ if (matched_type
+ && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: TYPE with "
+ "intrinsic-type-spec at %C") == FAILURE)
+ return MATCH_ERROR;
+
+ if (matched_type && gfc_match_char (')') != MATCH_YES)
return MATCH_ERROR;
ts->type = BT_COMPLEX;
@@ -2422,14 +2463,17 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
return MATCH_YES;
}
- if (gfc_match (" logical") == MATCH_YES)
+ if ((matched_type && strcmp ("logical", name) == 0)
+ || (!matched_type && gfc_match (" logical") == MATCH_YES))
{
ts->type = BT_LOGICAL;
ts->kind = gfc_default_logical_kind;
goto get_kind;
}
- m = gfc_match (" type ( %n )", name);
+ if (matched_type)
+ m = gfc_match_char (')');
+
if (m == MATCH_YES)
ts->type = BT_DERIVED;
else
@@ -2490,23 +2534,43 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
return MATCH_YES;
get_kind:
+ if (matched_type
+ && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: TYPE with "
+ "intrinsic-type-spec at %C") == FAILURE)
+ return MATCH_ERROR;
+
/* For all types except double, derived and character, look for an
optional kind specifier. MATCH_NO is actually OK at this point. */
if (implicit_flag == 1)
- return MATCH_YES;
+ {
+ if (matched_type && gfc_match_char (')') != MATCH_YES)
+ return MATCH_ERROR;
+
+ return MATCH_YES;
+ }
if (gfc_current_form == FORM_FREE)
{
c = gfc_peek_ascii_char ();
if (!gfc_is_whitespace (c) && c != '*' && c != '('
&& c != ':' && c != ',')
- return MATCH_NO;
+ {
+ if (matched_type && c == ')')
+ {
+ gfc_next_ascii_char ();
+ return MATCH_YES;
+ }
+ return MATCH_NO;
+ }
}
m = gfc_match_kind_spec (ts, false);
if (m == MATCH_NO && ts->type != BT_CHARACTER)
m = gfc_match_old_kind_spec (ts);
+ if (matched_type && gfc_match_char (')') != MATCH_YES)
+ return MATCH_ERROR;
+
/* Defer association of the KIND expression of function results
until after USE and IMPORT statements. */
if ((gfc_current_state () == COMP_NONE && gfc_error_flag_test ())
@@ -2875,8 +2939,8 @@ match_attr_spec (void)
DECL_IN, DECL_OUT, DECL_INOUT, DECL_INTRINSIC, DECL_OPTIONAL,
DECL_PARAMETER, DECL_POINTER, DECL_PROTECTED, DECL_PRIVATE,
DECL_PUBLIC, DECL_SAVE, DECL_TARGET, DECL_VALUE, DECL_VOLATILE,
- DECL_IS_BIND_C, DECL_CODIMENSION, DECL_ASYNCHRONOUS, DECL_NONE,
- GFC_DECL_END /* Sentinel */
+ DECL_IS_BIND_C, DECL_CODIMENSION, DECL_ASYNCHRONOUS, DECL_CONTIGUOUS,
+ DECL_NONE, GFC_DECL_END /* Sentinel */
}
decl_types;
@@ -2939,6 +3003,7 @@ match_attr_spec (void)
}
break;
}
+ break;
case 'b':
/* Try and match the bind(c). */
@@ -2950,8 +3015,24 @@ match_attr_spec (void)
break;
case 'c':
- if (match_string_p ("codimension"))
- d = DECL_CODIMENSION;
+ gfc_next_ascii_char ();
+ if ('o' != gfc_next_ascii_char ())
+ break;
+ switch (gfc_next_ascii_char ())
+ {
+ case 'd':
+ if (match_string_p ("imension"))
+ {
+ d = DECL_CODIMENSION;
+ break;
+ }
+ case 'n':
+ if (match_string_p ("tiguous"))
+ {
+ d = DECL_CONTIGUOUS;
+ break;
+ }
+ }
break;
case 'd':
@@ -3144,6 +3225,9 @@ match_attr_spec (void)
case DECL_CODIMENSION:
attr = "CODIMENSION";
break;
+ case DECL_CONTIGUOUS:
+ attr = "CONTIGUOUS";
+ break;
case DECL_DIMENSION:
attr = "DIMENSION";
break;
@@ -3214,7 +3298,7 @@ match_attr_spec (void)
if (gfc_current_state () == COMP_DERIVED
&& d != DECL_DIMENSION && d != DECL_CODIMENSION
&& d != DECL_POINTER && d != DECL_PRIVATE
- && d != DECL_PUBLIC && d != DECL_NONE)
+ && d != DECL_PUBLIC && d != DECL_CONTIGUOUS && d != DECL_NONE)
{
if (d == DECL_ALLOCATABLE)
{
@@ -3283,6 +3367,15 @@ match_attr_spec (void)
t = gfc_add_codimension (&current_attr, NULL, &seen_at[d]);
break;
+ case DECL_CONTIGUOUS:
+ if (gfc_notify_std (GFC_STD_F2008,
+ "Fortran 2008: CONTIGUOUS attribute at %C")
+ == FAILURE)
+ t = FAILURE;
+ else
+ t = gfc_add_contiguous (&current_attr, NULL, &seen_at[d]);
+ break;
+
case DECL_DIMENSION:
t = gfc_add_dimension (&current_attr, NULL, &seen_at[d]);
break;
@@ -4934,6 +5027,10 @@ gfc_match_entry (void)
if (m != MATCH_YES)
return m;
+ if (gfc_notify_std (GFC_STD_F2008_OBS, "Fortran 2008 obsolescent feature: "
+ "ENTRY statement at %C") == FAILURE)
+ return MATCH_ERROR;
+
state = gfc_current_state ();
if (state != COMP_SUBROUTINE && state != COMP_FUNCTION)
{
@@ -5483,14 +5580,23 @@ gfc_match_end (gfc_statement *st)
block_name = gfc_current_block () == NULL
? NULL : gfc_current_block ()->name;
- if (state == COMP_BLOCK && !strcmp (block_name, "block@"))
- block_name = NULL;
-
- if (state == COMP_CONTAINS || state == COMP_DERIVED_CONTAINS)
+ switch (state)
{
+ case COMP_ASSOCIATE:
+ case COMP_BLOCK:
+ if (!strcmp (block_name, "block@"))
+ block_name = NULL;
+ break;
+
+ case COMP_CONTAINS:
+ case COMP_DERIVED_CONTAINS:
state = gfc_state_stack->previous->state;
block_name = gfc_state_stack->previous->sym == NULL
? NULL : gfc_state_stack->previous->sym->name;
+ break;
+
+ default:
+ break;
}
switch (state)
@@ -5539,6 +5645,12 @@ gfc_match_end (gfc_statement *st)
eos_ok = 0;
break;
+ case COMP_ASSOCIATE:
+ *st = ST_END_ASSOCIATE;
+ target = " associate";
+ eos_ok = 0;
+ break;
+
case COMP_BLOCK:
*st = ST_END_BLOCK;
target = " block";
@@ -5598,7 +5710,14 @@ gfc_match_end (gfc_statement *st)
if (gfc_match_eos () == MATCH_YES)
{
- if (!eos_ok)
+ if (!eos_ok && (*st == ST_END_SUBROUTINE || *st == ST_END_FUNCTION))
+ {
+ if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: END statement "
+ "instead of %s statement at %L",
+ gfc_ascii_statement (*st), &old_loc) == FAILURE)
+ goto cleanup;
+ }
+ else if (!eos_ok)
{
/* We would have required END [something]. */
gfc_error ("%s statement expected at %L",
@@ -5622,7 +5741,7 @@ gfc_match_end (gfc_statement *st)
if (*st != ST_ENDDO && *st != ST_ENDIF && *st != ST_END_SELECT
&& *st != ST_END_FORALL && *st != ST_END_WHERE && *st != ST_END_BLOCK
- && *st != ST_END_CRITICAL)
+ && *st != ST_END_ASSOCIATE && *st != ST_END_CRITICAL)
return MATCH_YES;
if (!block_name)
@@ -6106,6 +6225,20 @@ gfc_match_codimension (void)
match
+gfc_match_contiguous (void)
+{
+ if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: CONTIGUOUS statement at %C")
+ == FAILURE)
+ return MATCH_ERROR;
+
+ gfc_clear_attr (&current_attr);
+ current_attr.contiguous = 1;
+
+ return attr_decl ();
+}
+
+
+match
gfc_match_dimension (void)
{
gfc_clear_attr (&current_attr);
@@ -7527,14 +7660,15 @@ match_procedure_in_type (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
char target_buf[GFC_MAX_SYMBOL_LEN + 1];
- char* target = NULL;
- gfc_typebound_proc* tb;
+ char* target = NULL, *ifc = NULL;
+ gfc_typebound_proc tb;
bool seen_colons;
bool seen_attrs;
match m;
gfc_symtree* stree;
gfc_namespace* ns;
gfc_symbol* block;
+ int num;
/* Check current state. */
gcc_assert (gfc_state_stack->state == COMP_DERIVED_CONTAINS);
@@ -7559,28 +7693,26 @@ match_procedure_in_type (void)
return MATCH_ERROR;
}
- target = target_buf;
+ ifc = target_buf;
}
/* Construct the data structure. */
- tb = gfc_get_typebound_proc ();
- tb->where = gfc_current_locus;
- tb->is_generic = 0;
+ tb.where = gfc_current_locus;
+ tb.is_generic = 0;
/* Match binding attributes. */
- m = match_binding_attributes (tb, false, false);
+ m = match_binding_attributes (&tb, false, false);
if (m == MATCH_ERROR)
return m;
seen_attrs = (m == MATCH_YES);
- /* Check that attribute DEFERRED is given iff an interface is specified, which
- means target != NULL. */
- if (tb->deferred && !target)
+ /* Check that attribute DEFERRED is given if an interface is specified. */
+ if (tb.deferred && !ifc)
{
gfc_error ("Interface must be specified for DEFERRED binding at %C");
return MATCH_ERROR;
}
- if (target && !tb->deferred)
+ if (ifc && !tb.deferred)
{
gfc_error ("PROCEDURE(interface) at %C should be declared DEFERRED");
return MATCH_ERROR;
@@ -7597,97 +7729,103 @@ match_procedure_in_type (void)
return MATCH_ERROR;
}
- /* Match the binding name. */
- m = gfc_match_name (name);
- if (m == MATCH_ERROR)
- return m;
- if (m == MATCH_NO)
- {
- gfc_error ("Expected binding name at %C");
- return MATCH_ERROR;
- }
-
- /* Try to match the '=> target', if it's there. */
- m = gfc_match (" =>");
- if (m == MATCH_ERROR)
- return m;
- if (m == MATCH_YES)
+ /* Match the binding names. */
+ for(num=1;;num++)
{
- if (tb->deferred)
+ m = gfc_match_name (name);
+ if (m == MATCH_ERROR)
+ return m;
+ if (m == MATCH_NO)
{
- gfc_error ("'=> target' is invalid for DEFERRED binding at %C");
+ gfc_error ("Expected binding name at %C");
return MATCH_ERROR;
}
- if (!seen_colons)
- {
- gfc_error ("'::' needed in PROCEDURE binding with explicit target"
- " at %C");
- return MATCH_ERROR;
- }
+ if (num>1 && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: PROCEDURE list"
+ " at %C") == FAILURE)
+ return MATCH_ERROR;
- m = gfc_match_name (target_buf);
+ /* Try to match the '=> target', if it's there. */
+ target = ifc;
+ m = gfc_match (" =>");
if (m == MATCH_ERROR)
return m;
- if (m == MATCH_NO)
+ if (m == MATCH_YES)
{
- gfc_error ("Expected binding target after '=>' at %C");
- return MATCH_ERROR;
+ if (tb.deferred)
+ {
+ gfc_error ("'=> target' is invalid for DEFERRED binding at %C");
+ return MATCH_ERROR;
+ }
+
+ if (!seen_colons)
+ {
+ gfc_error ("'::' needed in PROCEDURE binding with explicit target"
+ " at %C");
+ return MATCH_ERROR;
+ }
+
+ m = gfc_match_name (target_buf);
+ if (m == MATCH_ERROR)
+ return m;
+ if (m == MATCH_NO)
+ {
+ gfc_error ("Expected binding target after '=>' at %C");
+ return MATCH_ERROR;
+ }
+ target = target_buf;
}
- target = target_buf;
- }
- /* Now we should have the end. */
- m = gfc_match_eos ();
- if (m == MATCH_ERROR)
- return m;
- if (m == MATCH_NO)
- {
- gfc_error ("Junk after PROCEDURE declaration at %C");
- return MATCH_ERROR;
- }
+ /* If no target was found, it has the same name as the binding. */
+ if (!target)
+ target = name;
- /* If no target was found, it has the same name as the binding. */
- if (!target)
- target = name;
+ /* Get the namespace to insert the symbols into. */
+ ns = block->f2k_derived;
+ gcc_assert (ns);
- /* Get the namespace to insert the symbols into. */
- ns = block->f2k_derived;
- gcc_assert (ns);
+ /* If the binding is DEFERRED, check that the containing type is ABSTRACT. */
+ if (tb.deferred && !block->attr.abstract)
+ {
+ gfc_error ("Type '%s' containing DEFERRED binding at %C "
+ "is not ABSTRACT", block->name);
+ return MATCH_ERROR;
+ }
- /* If the binding is DEFERRED, check that the containing type is ABSTRACT. */
- if (tb->deferred && !block->attr.abstract)
- {
- gfc_error ("Type '%s' containing DEFERRED binding at %C is not ABSTRACT",
- block->name);
- return MATCH_ERROR;
- }
+ /* See if we already have a binding with this name in the symtree which
+ would be an error. If a GENERIC already targetted this binding, it may
+ be already there but then typebound is still NULL. */
+ stree = gfc_find_symtree (ns->tb_sym_root, name);
+ if (stree && stree->n.tb)
+ {
+ gfc_error ("There is already a procedure with binding name '%s' for "
+ "the derived type '%s' at %C", name, block->name);
+ return MATCH_ERROR;
+ }
- /* See if we already have a binding with this name in the symtree which would
- be an error. If a GENERIC already targetted this binding, it may be
- already there but then typebound is still NULL. */
- stree = gfc_find_symtree (ns->tb_sym_root, name);
- if (stree && stree->n.tb)
- {
- gfc_error ("There's already a procedure with binding name '%s' for the"
- " derived type '%s' at %C", name, block->name);
- return MATCH_ERROR;
- }
+ /* Insert it and set attributes. */
- /* Insert it and set attributes. */
+ if (!stree)
+ {
+ stree = gfc_new_symtree (&ns->tb_sym_root, name);
+ gcc_assert (stree);
+ }
+ stree->n.tb = gfc_get_typebound_proc (&tb);
- if (!stree)
- {
- stree = gfc_new_symtree (&ns->tb_sym_root, name);
- gcc_assert (stree);
+ if (gfc_get_sym_tree (target, gfc_current_ns, &stree->n.tb->u.specific,
+ false))
+ return MATCH_ERROR;
+ gfc_set_sym_referenced (stree->n.tb->u.specific->n.sym);
+
+ if (gfc_match_eos () == MATCH_YES)
+ return MATCH_YES;
+ if (gfc_match_char (',') != MATCH_YES)
+ goto syntax;
}
- stree->n.tb = tb;
-
- if (gfc_get_sym_tree (target, gfc_current_ns, &tb->u.specific, false))
- return MATCH_ERROR;
- gfc_set_sym_referenced (tb->u.specific->n.sym);
- return MATCH_YES;
+syntax:
+ gfc_error ("Syntax error in PROCEDURE statement at %C");
+ return MATCH_ERROR;
}
@@ -7821,7 +7959,7 @@ gfc_match_generic (void)
}
else
{
- tb = gfc_get_typebound_proc ();
+ tb = gfc_get_typebound_proc (NULL);
tb->where = gfc_current_locus;
tb->access = tbattr.access;
tb->is_generic = 1;
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 87f60df8e2a..fcf5b25d350 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -1588,4 +1588,3 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref)
return fin_dep == GFC_DEP_OVERLAP;
}
-
diff --git a/gcc/fortran/dependency.h b/gcc/fortran/dependency.h
index 6fa0416e2a7..dd786bedaba 100644
--- a/gcc/fortran/dependency.h
+++ b/gcc/fortran/dependency.h
@@ -43,3 +43,4 @@ int gfc_expr_is_one (gfc_expr *, int);
int gfc_dep_resolver(gfc_ref *, gfc_ref *);
int gfc_are_equivalenced_arrays (gfc_expr *, gfc_expr *);
+
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index e90b0941885..1a649106f15 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -598,6 +598,8 @@ show_attr (symbol_attribute *attr)
fputs (" CODIMENSION", dumpfile);
if (attr->dimension)
fputs (" DIMENSION", dumpfile);
+ if (attr->contiguous)
+ fputs (" CONTIGUOUS", dumpfile);
if (attr->external)
fputs (" EXTERNAL", dumpfile);
if (attr->intrinsic)
@@ -794,6 +796,15 @@ show_symbol (gfc_symbol *sym)
fprintf (dumpfile, "symbol %s ", sym->name);
show_typespec (&sym->ts);
+
+ /* If this symbol is an associate-name, show its target expression. */
+ if (sym->assoc)
+ {
+ fputs (" => ", dumpfile);
+ show_expr (sym->assoc->target);
+ fputs (" ", dumpfile);
+ }
+
show_attr (&sym->attr);
if (sym->value)
@@ -853,7 +864,7 @@ show_symbol (gfc_symbol *sym)
}
}
- if (sym->formal_ns)
+ if (sym->formal_ns && (sym->formal_ns->proc_name != sym))
{
show_indent ();
fputs ("Formal namespace", dumpfile);
@@ -1175,6 +1186,7 @@ show_code_node (int level, gfc_code *c)
gfc_filepos *fp;
gfc_inquire *i;
gfc_dt *dt;
+ gfc_namespace *ns;
code_indent (level, c->here);
@@ -1374,6 +1386,22 @@ show_code_node (int level, gfc_code *c)
fputs ("ENDIF", dumpfile);
break;
+ case EXEC_BLOCK:
+ {
+ const char* blocktype;
+ if (c->ext.block.assoc)
+ blocktype = "ASSOCIATE";
+ else
+ blocktype = "BLOCK";
+ show_indent ();
+ fprintf (dumpfile, "%s ", blocktype);
+ ns = c->ext.block.ns;
+ show_namespace (ns);
+ show_indent ();
+ fprintf (dumpfile, "END %s ", blocktype);
+ break;
+ }
+
case EXEC_SELECT:
d = c->block;
fputs ("SELECT CASE ", dumpfile);
@@ -2144,7 +2172,7 @@ show_namespace (gfc_namespace *ns)
fputc ('\n', dumpfile);
fputc ('\n', dumpfile);
- show_code (0, ns->code);
+ show_code (show_level, ns->code);
for (ns = ns->contained; ns; ns = ns->sibling)
{
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index b05e669c370..30928286c98 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -471,7 +471,7 @@ error_print (const char *type, const char *format0, va_list argp)
locus *l1, *l2, *loc;
const char *format;
- l1 = l2 = NULL;
+ loc = l1 = l2 = NULL;
have_l1 = 0;
pos = -1;
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index b6452054b11..c876fdd7740 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4080,3 +4080,105 @@ gfc_has_ultimate_pointer (gfc_expr *e)
else
return false;
}
+
+
+/* Check whether an expression is "simply contiguous", cf. F2008, 6.5.4.
+ Note: A scalar is not regarded as "simply contiguous" by the standard.
+ if bool is not strict, some futher checks are done - for instance,
+ a "(::1)" is accepted. */
+
+bool
+gfc_is_simply_contiguous (gfc_expr *expr, bool strict)
+{
+ bool colon;
+ int i;
+ gfc_array_ref *ar = NULL;
+ gfc_ref *ref, *part_ref = NULL;
+
+ if (expr->expr_type == EXPR_FUNCTION)
+ return expr->value.function.esym
+ ? expr->value.function.esym->result->attr.contiguous : false;
+ else if (expr->expr_type != EXPR_VARIABLE)
+ return false;
+
+ if (expr->rank == 0)
+ return false;
+
+ for (ref = expr->ref; ref; ref = ref->next)
+ {
+ if (ar)
+ return false; /* Array shall be last part-ref. */
+
+ if (ref->type == REF_COMPONENT)
+ part_ref = ref;
+ else if (ref->type == REF_SUBSTRING)
+ return false;
+ else if (ref->u.ar.type != AR_ELEMENT)
+ ar = &ref->u.ar;
+ }
+
+ if ((part_ref && !part_ref->u.c.component->attr.contiguous
+ && part_ref->u.c.component->attr.pointer)
+ || (!part_ref && !expr->symtree->n.sym->attr.contiguous
+ && (expr->symtree->n.sym->attr.pointer
+ || expr->symtree->n.sym->as->type == AS_ASSUMED_SHAPE)))
+ return false;
+
+ if (!ar || ar->type == AR_FULL)
+ return true;
+
+ gcc_assert (ar->type == AR_SECTION);
+
+ /* Check for simply contiguous array */
+ colon = true;
+ for (i = 0; i < ar->dimen; i++)
+ {
+ if (ar->dimen_type[i] == DIMEN_VECTOR)
+ return false;
+
+ if (ar->dimen_type[i] == DIMEN_ELEMENT)
+ {
+ colon = false;
+ continue;
+ }
+
+ gcc_assert (ar->dimen_type[i] == DIMEN_RANGE);
+
+
+ /* If the previous section was not contiguous, that's an error,
+ unless we have effective only one element and checking is not
+ strict. */
+ if (!colon && (strict || !ar->start[i] || !ar->end[i]
+ || ar->start[i]->expr_type != EXPR_CONSTANT
+ || ar->end[i]->expr_type != EXPR_CONSTANT
+ || mpz_cmp (ar->start[i]->value.integer,
+ ar->end[i]->value.integer) != 0))
+ return false;
+
+ /* Following the standard, "(::1)" or - if known at compile time -
+ "(lbound:ubound)" are not simply contigous; if strict
+ is false, they are regarded as simply contiguous. */
+ if (ar->stride[i] && (strict || ar->stride[i]->expr_type != EXPR_CONSTANT
+ || ar->stride[i]->ts.type != BT_INTEGER
+ || mpz_cmp_si (ar->stride[i]->value.integer, 1) != 0))
+ return false;
+
+ if (ar->start[i]
+ && (strict || ar->start[i]->expr_type != EXPR_CONSTANT
+ || !ar->as->lower[i]
+ || ar->as->lower[i]->expr_type != EXPR_CONSTANT
+ || mpz_cmp (ar->start[i]->value.integer,
+ ar->as->lower[i]->value.integer) != 0))
+ colon = false;
+
+ if (ar->end[i]
+ && (strict || ar->end[i]->expr_type != EXPR_CONSTANT
+ || !ar->as->upper[i]
+ || ar->as->upper[i]->expr_type != EXPR_CONSTANT
+ || mpz_cmp (ar->end[i]->value.integer,
+ ar->as->upper[i]->value.integer) != 0))
+ colon = false;
+ }
+
+ return true;
+}
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 14525dc2552..c6af0026ba8 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -111,6 +111,7 @@ static void gfc_init_ts (void);
#undef LANG_HOOKS_INIT_TS
#undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE
#undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
+#undef LANG_HOOKS_OMP_REPORT_DECL
#undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
#undef LANG_HOOKS_OMP_CLAUSE_COPY_CTOR
#undef LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP
@@ -137,6 +138,7 @@ static void gfc_init_ts (void);
#define LANG_HOOKS_INIT_TS gfc_init_ts
#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE gfc_omp_privatize_by_reference
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING gfc_omp_predetermined_sharing
+#define LANG_HOOKS_OMP_REPORT_DECL gfc_omp_report_decl
#define LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR gfc_omp_clause_default_ctor
#define LANG_HOOKS_OMP_CLAUSE_COPY_CTOR gfc_omp_clause_copy_ctor
#define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP gfc_omp_clause_assign_op
@@ -350,8 +352,7 @@ getdecls (void)
void
pushlevel (int ignore ATTRIBUTE_UNUSED)
{
- struct binding_level *newlevel
- = (struct binding_level *) ggc_alloc (sizeof (struct binding_level));
+ struct binding_level *newlevel = ggc_alloc_binding_level ();
*newlevel = clear_binding_level;
@@ -754,10 +755,11 @@ gfc_init_builtin_functions (void)
func_longdouble_longdoublep_longdoublep =
build_function_type_list (void_type_node, ptype, ptype, NULL_TREE);
+/* Non-math builtins are defined manually, so they're not included here. */
+#define OTHER_BUILTIN(ID,NAME,TYPE)
+
#include "mathbuiltins.def"
- /* We define these separately as the fortran versions have different
- semantics (they return an integer type) */
gfc_define_builtin ("__builtin_roundl", mfunc_longdouble[0],
BUILT_IN_ROUNDL, "roundl", true);
gfc_define_builtin ("__builtin_round", mfunc_double[0],
diff --git a/gcc/fortran/gfc-internals.texi b/gcc/fortran/gfc-internals.texi
index f01393e3d68..90f90fdac5d 100644
--- a/gcc/fortran/gfc-internals.texi
+++ b/gcc/fortran/gfc-internals.texi
@@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename gfc-internals.info
-@set copyrights-gfortran 2007-2010
+@set copyrights-gfortran 2007, 2008, 2009, 2010
@include gcc-common.texi
@@ -35,7 +35,7 @@ Copyright @copyright{} @value{copyrights-gfortran} Free Software Foundation,
Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 9762cddfaa8..0c96bf40e6e 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -205,11 +205,12 @@ arith;
/* Statements. */
typedef enum
{
- ST_ARITHMETIC_IF, ST_ALLOCATE, ST_ATTR_DECL, ST_BACKSPACE,
- ST_BLOCK, ST_BLOCK_DATA,
+ ST_ARITHMETIC_IF, ST_ALLOCATE, ST_ATTR_DECL, ST_ASSOCIATE,
+ ST_BACKSPACE, ST_BLOCK, ST_BLOCK_DATA,
ST_CALL, ST_CASE, ST_CLOSE, ST_COMMON, ST_CONTINUE, ST_CONTAINS, ST_CYCLE,
ST_DATA, ST_DATA_DECL, ST_DEALLOCATE, ST_DO, ST_ELSE, ST_ELSEIF,
- ST_ELSEWHERE, ST_END_BLOCK, ST_END_BLOCK_DATA, ST_ENDDO, ST_IMPLIED_ENDDO,
+ ST_ELSEWHERE, ST_END_ASSOCIATE, ST_END_BLOCK, ST_END_BLOCK_DATA,
+ ST_ENDDO, ST_IMPLIED_ENDDO,
ST_END_FILE, ST_FINAL, ST_FLUSH, ST_END_FORALL, ST_END_FUNCTION, ST_ENDIF,
ST_END_INTERFACE, ST_END_MODULE, ST_END_PROGRAM, ST_END_SELECT,
ST_END_SUBROUTINE, ST_END_WHERE, ST_END_TYPE, ST_ENTRY, ST_EQUIVALENCE,
@@ -664,7 +665,8 @@ typedef struct
unsigned allocatable:1, dimension:1, codimension:1, external:1, intrinsic:1,
optional:1, pointer:1, target:1, value:1, volatile_:1, temporary:1,
dummy:1, result:1, assign:1, threadprivate:1, not_always_present:1,
- implied_index:1, subref_array_pointer:1, proc_pointer:1, asynchronous:1;
+ implied_index:1, subref_array_pointer:1, proc_pointer:1, asynchronous:1,
+ contiguous:1;
/* For CLASS containers, the pointer attribute is sometimes set internally
even though it was not directly specified. In this case, keep the
@@ -1201,6 +1203,9 @@ typedef struct gfc_symbol
char binding_label[GFC_MAX_BINDING_LABEL_LEN + 1];
/* Store a reference to the common_block, if this symbol is in one. */
struct gfc_common_head *common_block;
+
+ /* Link to corresponding association-list if this is an associate name. */
+ struct gfc_association_list *assoc;
}
gfc_symbol;
@@ -1665,10 +1670,13 @@ typedef struct gfc_expr
it from recurring. */
unsigned int error : 1;
- /* Mark and expression where a user operator has been substituted by
+ /* Mark an expression where a user operator has been substituted by
a function call in interface.c(gfc_extend_expr). */
unsigned int user_operator : 1;
+ /* Mark an expression as being a MOLD argument of ALLOCATE. */
+ unsigned int mold : 1;
+
/* If an expression comes from a Hollerith constant or compile-time
evaluation of a transfer statement, it may have a prescribed target-
memory representation, and these cannot always be backformed from
@@ -1974,6 +1982,25 @@ typedef struct gfc_forall_iterator
gfc_forall_iterator;
+/* Linked list to store associations in an ASSOCIATE statement. */
+
+typedef struct gfc_association_list
+{
+ struct gfc_association_list *next;
+
+ /* Whether this is association to a variable that can be changed; otherwise,
+ it's association to an expression and the name may not be used as
+ lvalue. */
+ unsigned variable:1;
+
+ char name[GFC_MAX_SYMBOL_LEN + 1];
+ gfc_symtree *st; /* Symtree corresponding to name. */
+ gfc_expr *target;
+}
+gfc_association_list;
+#define gfc_get_association_list() XCNEW (gfc_association_list)
+
+
/* Executable statements that fill gfc_code structures. */
typedef enum
{
@@ -2026,6 +2053,13 @@ typedef struct gfc_code
}
alloc;
+ struct
+ {
+ gfc_namespace *ns;
+ gfc_association_list *assoc;
+ }
+ block;
+
gfc_open *open;
gfc_close *close;
gfc_filepos *filepos;
@@ -2040,13 +2074,12 @@ typedef struct gfc_code
const char *omp_name;
gfc_namelist *omp_namelist;
bool omp_bool;
- gfc_namespace *ns;
}
ext; /* Points to additional structures required by statement */
- /* Backend_decl is used for cycle and break labels in do loops, and
- probably for other constructs as well, once we translate them. */
- tree backend_decl;
+ /* Cycle and break labels in do loops. */
+ tree cycle_label;
+ tree exit_label;
}
gfc_code;
@@ -2405,6 +2438,7 @@ gfc_try gfc_add_attribute (symbol_attribute *, locus *);
gfc_try gfc_add_ext_attribute (symbol_attribute *, ext_attr_id_t, locus *);
gfc_try gfc_add_allocatable (symbol_attribute *, locus *);
gfc_try gfc_add_codimension (symbol_attribute *, const char *, locus *);
+gfc_try gfc_add_contiguous (symbol_attribute *, const char *, locus *);
gfc_try gfc_add_dimension (symbol_attribute *, const char *, locus *);
gfc_try gfc_add_external (symbol_attribute *, locus *);
gfc_try gfc_add_intrinsic (symbol_attribute *, locus *);
@@ -2513,7 +2547,7 @@ void gfc_free_dt_list (void);
gfc_gsymbol *gfc_get_gsymbol (const char *);
gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *);
-gfc_typebound_proc* gfc_get_typebound_proc (void);
+gfc_typebound_proc* gfc_get_typebound_proc (gfc_typebound_proc*);
gfc_symbol* gfc_get_derived_super_type (gfc_symbol*);
gfc_symbol* gfc_get_ultimate_derived_super_type (gfc_symbol*);
bool gfc_type_is_extension_of (gfc_symbol *, gfc_symbol *);
@@ -2582,6 +2616,7 @@ void gfc_free_actual_arglist (gfc_actual_arglist *);
gfc_actual_arglist *gfc_copy_actual_arglist (gfc_actual_arglist *);
const char *gfc_extract_int (gfc_expr *, int *);
bool is_subref_array (gfc_expr *);
+bool gfc_is_simply_contiguous (gfc_expr *, bool);
gfc_expr *gfc_build_conversion (gfc_expr *);
void gfc_free_ref_list (gfc_ref *);
@@ -2647,6 +2682,7 @@ gfc_code *gfc_get_code (void);
gfc_code *gfc_append_code (gfc_code *, gfc_code *);
void gfc_free_statement (gfc_code *);
void gfc_free_statements (gfc_code *);
+void gfc_free_association_list (gfc_association_list *);
/* resolve.c */
gfc_try gfc_resolve_expr (gfc_expr *);
@@ -2719,6 +2755,7 @@ void gfc_set_current_interface_head (gfc_interface *);
gfc_symtree* gfc_find_sym_in_symtree (gfc_symbol*);
bool gfc_arglist_matches_symbol (gfc_actual_arglist**, gfc_symbol*);
bool gfc_check_operator_interface (gfc_symbol*, gfc_intrinsic_op, locus);
+int gfc_has_vector_subscript (gfc_expr*);
/* io.c */
extern gfc_st_label format_asterisk;
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index a7f6fbac220..8d43c8bf8a4 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename gfortran.info
-@set copyrights-gfortran 1999-2010
+@set copyrights-gfortran 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
@include gcc-common.texi
@@ -80,7 +80,7 @@
Copyright @copyright{} @value{copyrights-gfortran} Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
@@ -1515,10 +1515,10 @@ to Cray pointers and pointees. Pointees may not have the
@code{ALLOCATABLE}, @code{INTENT}, @code{OPTIONAL}, @code{DUMMY},
@code{TARGET}, @code{INTRINSIC}, or @code{POINTER} attributes. Pointers
may not have the @code{DIMENSION}, @code{POINTER}, @code{TARGET},
-@code{ALLOCATABLE}, @code{EXTERNAL}, or @code{INTRINSIC} attributes.
-Pointees may not occur in more than one pointer statement. A pointee
-cannot be a pointer. Pointees cannot occur in equivalence, common, or
-data statements.
+@code{ALLOCATABLE}, @code{EXTERNAL}, or @code{INTRINSIC} attributes, nor
+may they be function results. Pointees may not occur in more than one
+pointer statement. A pointee cannot be a pointer. Pointees cannot occur
+in equivalence, common, or data statements.
A Cray pointer may also point to a function or a subroutine. For
example, the following excerpt is valid:
@@ -1719,7 +1719,8 @@ code that uses them running with the GNU Fortran compiler.
@c * TYPE and ACCEPT I/O Statements::
@c * .XOR. operator::
@c * CARRIAGECONTROL, DEFAULTFILE, DISPOSE and RECORDTYPE I/O specifiers::
-@c * Omitted arguments in procedure call:
+@c * Omitted arguments in procedure call::
+* Alternate complex function syntax::
@end menu
@@ -1894,6 +1895,18 @@ c
@end smallexample
+@node Alternate complex function syntax
+@subsection Alternate complex function syntax
+@cindex Complex function
+
+Some Fortran compilers, including @command{g77}, let the user declare
+complex functions with the syntax @code{COMPLEX FUNCTION name*16()}, as
+well as @code{COMPLEX*16 FUNCTION name()}. Both are non-standard, legacy
+extensions. @command{gfortran} accepts the latter form, which is more
+common, but not the former.
+
+
+
@c ---------------------------------------------------------------------
@c Mixed-Language Programming
@c ---------------------------------------------------------------------
@@ -2322,9 +2335,10 @@ if e.g. an input-output edit descriptor is invalid in a given standard.
Possible values are (bitwise or-ed) @code{GFC_STD_F77} (1),
@code{GFC_STD_F95_OBS} (2), @code{GFC_STD_F95_DEL} (4), @code{GFC_STD_F95}
(8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU} (32),
-@code{GFC_STD_LEGACY} (64), and @code{GFC_STD_F2008} (128).
-Default: @code{GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F2003
-| GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY}.
+@code{GFC_STD_LEGACY} (64), @code{GFC_STD_F2008} (128), and
+@code{GFC_STD_F2008_OBS} (256). Default: @code{GFC_STD_F95_OBS
+| GFC_STD_F95_DEL | GFC_STD_F95 | GFC_STD_F2003 | GFC_STD_F2008
+| GFC_STD_F2008_OBS | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY}.
@item @var{option}[1] @tab Standard-warning flag; prints a warning to
standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}.
@item @var{option}[2] @tab If non zero, enable pedantic checking.
@@ -2639,9 +2653,6 @@ J3 Fortran 95 standard.
User-specified alignment rules for structures.
@item
-Flag to generate @code{Makefile} info.
-
-@item
Automatically extend single precision constants to double.
@item
diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c
index 1f67acc1513..61f1547c87c 100644
--- a/gcc/fortran/gfortranspec.c
+++ b/gcc/fortran/gfortranspec.c
@@ -244,7 +244,7 @@ append_arg (const char *arg)
}
if (g77_newargc == newargsize)
- fatal_error ("overflowed output arg list for '%s'", arg);
+ fatal_error ("overflowed output arg list for %qs", arg);
g77_newargv[g77_newargc++] = arg;
}
@@ -402,7 +402,7 @@ For more information about these matters, see the file named COPYING\n\n"));
if (i + skip < argc)
i += skip;
else
- fatal_error ("argument to '%s' missing", argv[i]);
+ fatal_error ("argument to %qs missing", argv[i]);
}
if ((n_outfiles != 0) && (n_infiles == 0))
@@ -424,35 +424,6 @@ For more information about these matters, see the file named COPYING\n\n"));
continue;
}
- if ((argv[i][0] == '-') && (argv[i][1] == 'M'))
- {
- char *p;
-
- warning (0, "using -M <directory> is deprecated, use -J instead");
- if (argv[i][2] == '\0')
- {
- if (i+1 < argc)
- {
- p = XNEWVEC (char, strlen (argv[i + 1]) + 3);
- p[0] = '-';
- p[1] = 'J';
- strcpy (&p[2], argv[i + 1]);
- i++;
- }
- else
- fatal_error ("argument to '%s' missing", argv[i]);
- }
- else
- {
- p = XNEWVEC (char, strlen (argv[i]) + 1);
- p[0] = '-';
- p[1] = 'J';
- strcpy (&p[2], argv[i] + 2);
- }
- append_arg (p);
- continue;
- }
-
if ((argv[i][0] == '-') && (argv[i][1] != 'l'))
{
/* Not a filename or library. */
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 99ade9d273d..587b09cdf8c 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1376,6 +1376,30 @@ compare_pointer (gfc_symbol *formal, gfc_expr *actual)
}
+/* Emit clear error messages for rank mismatch. */
+
+static void
+argument_rank_mismatch (const char *name, locus *where,
+ int rank1, int rank2)
+{
+ if (rank1 == 0)
+ {
+ gfc_error ("Rank mismatch in argument '%s' at %L "
+ "(scalar and rank-%d)", name, where, rank2);
+ }
+ else if (rank2 == 0)
+ {
+ gfc_error ("Rank mismatch in argument '%s' at %L "
+ "(rank-%d and scalar)", name, where, rank1);
+ }
+ else
+ {
+ gfc_error ("Rank mismatch in argument '%s' at %L "
+ "(rank-%d and rank-%d)", name, where, rank1, rank2);
+ }
+}
+
+
/* Given a symbol of a formal argument list and an expression, see if
the two are compatible as arguments. Returns nonzero if
compatible, zero if not compatible. */
@@ -1435,6 +1459,16 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
return 1;
}
+ /* F2008, C1241. */
+ if (formal->attr.pointer && formal->attr.contiguous
+ && !gfc_is_simply_contiguous (actual, true))
+ {
+ if (where)
+ gfc_error ("Actual argument to contiguous pointer dummy '%s' at %L "
+ "must be simply contigous", formal->name, &actual->where);
+ return 0;
+ }
+
if ((actual->expr_type != EXPR_NULL || actual->ts.type != BT_UNKNOWN)
&& !gfc_compare_types (&formal->ts, &actual->ts))
{
@@ -1502,6 +1536,34 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
: actual->symtree->n.sym->as->corank);
return 0;
}
+
+ /* F2008, 12.5.2.8. */
+ if (formal->attr.dimension
+ && (formal->attr.contiguous || formal->as->type != AS_ASSUMED_SHAPE)
+ && !gfc_is_simply_contiguous (actual, true))
+ {
+ if (where)
+ gfc_error ("Actual argument to '%s' at %L must be simply "
+ "contiguous", formal->name, &actual->where);
+ return 0;
+ }
+ }
+
+ /* F2008, C1239/C1240. */
+ if (actual->expr_type == EXPR_VARIABLE
+ && (actual->symtree->n.sym->attr.asynchronous
+ || actual->symtree->n.sym->attr.volatile_)
+ && (formal->attr.asynchronous || formal->attr.volatile_)
+ && actual->rank && !gfc_is_simply_contiguous (actual, true)
+ && ((formal->as->type != AS_ASSUMED_SHAPE && !formal->attr.pointer)
+ || formal->attr.contiguous))
+ {
+ if (where)
+ gfc_error ("Dummy argument '%s' has to be a pointer or assumed-shape "
+ "array without CONTIGUOUS attribute - as actual argument at"
+ " %L is not simply contiguous and both are ASYNCHRONOUS "
+ "or VOLATILE", formal->name, &actual->where);
+ return 0;
}
if (symbol_rank (formal) == actual->rank)
@@ -1521,9 +1583,8 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
&& gfc_is_coindexed (actual)))
{
if (where)
- gfc_error ("Rank mismatch in argument '%s' at %L (%d and %d)",
- formal->name, &actual->where, symbol_rank (formal),
- actual->rank);
+ argument_rank_mismatch (formal->name, &actual->where,
+ symbol_rank (formal), actual->rank);
return 0;
}
else if (actual->rank != 0 && (is_elemental || formal->attr.dimension))
@@ -1562,9 +1623,8 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
else if (ref == NULL && actual->expr_type != EXPR_NULL)
{
if (where)
- gfc_error ("Rank mismatch in argument '%s' at %L (%d and %d)",
- formal->name, &actual->where, symbol_rank (formal),
- actual->rank);
+ argument_rank_mismatch (formal->name, &actual->where,
+ symbol_rank (formal), actual->rank);
return 0;
}
@@ -1821,8 +1881,8 @@ get_expr_storage_size (gfc_expr *e)
which has a vector subscript. If it has, one is returned,
otherwise zero. */
-static int
-has_vector_subscript (gfc_expr *e)
+int
+gfc_has_vector_subscript (gfc_expr *e)
{
int i;
gfc_ref *ref;
@@ -2133,13 +2193,15 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if ((f->sym->attr.intent == INTENT_OUT
|| f->sym->attr.intent == INTENT_INOUT
- || f->sym->attr.volatile_)
- && has_vector_subscript (a->expr))
+ || f->sym->attr.volatile_
+ || f->sym->attr.asynchronous)
+ && gfc_has_vector_subscript (a->expr))
{
if (where)
- gfc_error ("Array-section actual argument with vector subscripts "
- "at %L is incompatible with INTENT(OUT), INTENT(INOUT) "
- "or VOLATILE attribute of the dummy argument '%s'",
+ gfc_error ("Array-section actual argument with vector "
+ "subscripts at %L is incompatible with INTENT(OUT), "
+ "INTENT(INOUT), VOLATILE or ASYNCHRONOUS attribute "
+ "of the dummy argument '%s'",
&a->expr->where, f->sym->name);
return 0;
}
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index a92b5b54519..833fd30beb1 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -1354,7 +1354,7 @@ add_functions (void)
make_generic ("bit_size", GFC_ISYM_BIT_SIZE, GFC_STD_F95);
add_sym_2 ("btest", GFC_ISYM_BTEST, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F95,
- gfc_check_btest, gfc_simplify_btest, gfc_resolve_btest,
+ gfc_check_bitfcn, gfc_simplify_btest, gfc_resolve_btest,
i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
make_generic ("btest", GFC_ISYM_BTEST, GFC_STD_F95);
@@ -1738,7 +1738,7 @@ add_functions (void)
make_generic ("iargc", GFC_ISYM_IARGC, GFC_STD_GNU);
add_sym_2 ("ibclr", GFC_ISYM_IBCLR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
- gfc_check_ibclr, gfc_simplify_ibclr, gfc_resolve_ibclr,
+ gfc_check_bitfcn, gfc_simplify_ibclr, gfc_resolve_ibclr,
i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
make_generic ("ibclr", GFC_ISYM_IBCLR, GFC_STD_F95);
@@ -1751,7 +1751,7 @@ add_functions (void)
make_generic ("ibits", GFC_ISYM_IBITS, GFC_STD_F95);
add_sym_2 ("ibset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
- gfc_check_ibset, gfc_simplify_ibset, gfc_resolve_ibset,
+ gfc_check_bitfcn, gfc_simplify_ibset, gfc_resolve_ibset,
i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
make_generic ("ibset", GFC_ISYM_IBSET, GFC_STD_F95);
@@ -2375,10 +2375,11 @@ add_functions (void)
make_generic ("selected_int_kind", GFC_ISYM_SI_KIND, GFC_STD_F95);
- add_sym_2 ("selected_real_kind", GFC_ISYM_SR_KIND, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di,
+ add_sym_3 ("selected_real_kind", GFC_ISYM_SR_KIND, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di,
GFC_STD_F95, gfc_check_selected_real_kind,
gfc_simplify_selected_real_kind, NULL,
- p, BT_INTEGER, di, OPTIONAL, r, BT_INTEGER, di, OPTIONAL);
+ p, BT_INTEGER, di, OPTIONAL, r, BT_INTEGER, di, OPTIONAL,
+ "radix", BT_INTEGER, di, OPTIONAL);
make_generic ("selected_real_kind", GFC_ISYM_SR_KIND, GFC_STD_F95);
@@ -4022,58 +4023,67 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag)
}
else if (wflag)
{
- /* Two modes of warning:
- - gfc_option.warn_conversion tries to be more intelligent
- about the warnings raised and omits those where smaller
- kinds are promoted to larger ones without change in the
- value
- - gfc_option.warn_conversion_extra does not take the kinds
- into account and also warns for coversions like
- REAL(4) -> REAL(8)
-
- NOTE: Possible enhancement for warn_conversion
- If converting from a smaller to a larger kind, check if the
- value is constant and if yes, whether the value still fits
- in the smaller kind. If yes, omit the warning.
- */
-
- /* If the types are the same (but not LOGICAL), and if from-kind
- is larger than to-kind, this may indicate a loss of precision.
- The same holds for conversions from REAL to COMPLEX. */
- if (((from_ts.type == ts->type && from_ts.type != BT_LOGICAL)
- && ((gfc_option.warn_conversion && from_ts.kind > ts->kind)
- || gfc_option.warn_conversion_extra))
- || ((from_ts.type == BT_REAL && ts->type == BT_COMPLEX)
- && ((gfc_option.warn_conversion && from_ts.kind > ts->kind)
- || gfc_option.warn_conversion_extra)))
- gfc_warning_now ("Possible change of value in conversion "
- "from %s to %s at %L", gfc_typename (&from_ts),
- gfc_typename (ts), &expr->where);
-
- /* If INTEGER is converted to REAL/COMPLEX, this is generally ok if
- the kind of the INTEGER value is less or equal to the kind of the
- REAL/COMPLEX one. Otherwise the value may not fit.
- Assignment of an overly large integer constant also generates
- an overflow error with range checking. */
- else if (from_ts.type == BT_INTEGER
- && (ts->type == BT_REAL || ts->type == BT_COMPLEX)
- && ((gfc_option.warn_conversion && from_ts.kind > ts->kind)
- || gfc_option.warn_conversion_extra))
- gfc_warning_now ("Possible change of value in conversion "
- "from %s to %s at %L", gfc_typename (&from_ts),
- gfc_typename (ts), &expr->where);
-
- /* If REAL/COMPLEX is converted to INTEGER, or COMPLEX is converted
- to REAL we almost certainly have a loss of digits, regardless of
- the respective kinds. */
- else if ((((from_ts.type == BT_REAL || from_ts.type == BT_COMPLEX)
- && ts->type == BT_INTEGER)
- || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL))
- && (gfc_option.warn_conversion
- || gfc_option.warn_conversion_extra))
- gfc_warning_now ("Possible change of value in conversion from "
- "%s to %s at %L", gfc_typename (&from_ts),
- gfc_typename (ts), &expr->where);
+ if (gfc_option.flag_range_check
+ && expr->expr_type == EXPR_CONSTANT
+ && from_ts.type == ts->type)
+ {
+ /* Do nothing. Constants of the same type are range-checked
+ elsewhere. If a value too large for the target type is
+ assigned, an error is generated. Not checking here avoids
+ duplications of warnings/errors.
+ If range checking was disabled, but -Wconversion enabled,
+ a non range checked warning is generated below. */
+ }
+ else if (from_ts.type == BT_LOGICAL || ts->type == BT_LOGICAL)
+ {
+ /* Do nothing. This block exists only to simplify the other
+ else-if expressions.
+ LOGICAL <> LOGICAL no warning, independent of kind values
+ LOGICAL <> INTEGER extension, warned elsewhere
+ LOGICAL <> REAL invalid, error generated elsewhere
+ LOGICAL <> COMPLEX invalid, error generated elsewhere */
+ }
+ else if (from_ts.type == ts->type
+ || (from_ts.type == BT_INTEGER && ts->type == BT_REAL)
+ || (from_ts.type == BT_INTEGER && ts->type == BT_COMPLEX)
+ || (from_ts.type == BT_REAL && ts->type == BT_COMPLEX))
+ {
+ /* Larger kinds can hold values of smaller kinds without problems.
+ Hence, only warn if target kind is smaller than the source
+ kind - or if -Wconversion-extra is specified. */
+ if (gfc_option.warn_conversion_extra)
+ gfc_warning_now ("Conversion from %s to %s at %L",
+ gfc_typename (&from_ts), gfc_typename (ts),
+ &expr->where);
+ else if (gfc_option.warn_conversion
+ && from_ts.kind > ts->kind)
+ gfc_warning_now ("Possible change of value in conversion "
+ "from %s to %s at %L", gfc_typename (&from_ts),
+ gfc_typename (ts), &expr->where);
+ }
+ else if ((from_ts.type == BT_REAL && ts->type == BT_INTEGER)
+ || (from_ts.type == BT_COMPLEX && ts->type == BT_INTEGER)
+ || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL))
+ {
+ /* Conversion from REAL/COMPLEX to INTEGER or COMPLEX to REAL
+ usually comes with a loss of information, regardless of kinds. */
+ if (gfc_option.warn_conversion_extra
+ || gfc_option.warn_conversion)
+ gfc_warning_now ("Possible change of value in conversion "
+ "from %s to %s at %L", gfc_typename (&from_ts),
+ gfc_typename (ts), &expr->where);
+ }
+ else if (from_ts.type == BT_HOLLERITH || ts->type == BT_HOLLERITH)
+ {
+ /* If HOLLERITH is involved, all bets are off. */
+ if (gfc_option.warn_conversion_extra
+ || gfc_option.warn_conversion)
+ gfc_warning_now ("Conversion from %s to %s at %L",
+ gfc_typename (&from_ts), gfc_typename (ts),
+ &expr->where);
+ }
+ else
+ gcc_unreachable ();
}
/* Insert a pre-resolved function call to the right function. */
diff --git a/gcc/fortran/intrinsic.h b/gcc/fortran/intrinsic.h
index 2e1b95eb375..919f09e90b4 100644
--- a/gcc/fortran/intrinsic.h
+++ b/gcc/fortran/intrinsic.h
@@ -40,7 +40,7 @@ gfc_try gfc_check_associated (gfc_expr *, gfc_expr *);
gfc_try gfc_check_atan_2 (gfc_expr *, gfc_expr *);
gfc_try gfc_check_atan2 (gfc_expr *, gfc_expr *);
gfc_try gfc_check_besn (gfc_expr *, gfc_expr *);
-gfc_try gfc_check_btest (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_bitfcn (gfc_expr *, gfc_expr *);
gfc_try gfc_check_char (gfc_expr *, gfc_expr *);
gfc_try gfc_check_chdir (gfc_expr *);
gfc_try gfc_check_chmod (gfc_expr *, gfc_expr *);
@@ -74,9 +74,7 @@ gfc_try gfc_check_hypot (gfc_expr *, gfc_expr *);
gfc_try gfc_check_i (gfc_expr *);
gfc_try gfc_check_iand (gfc_expr *, gfc_expr *);
gfc_try gfc_check_and (gfc_expr *, gfc_expr *);
-gfc_try gfc_check_ibclr (gfc_expr *, gfc_expr *);
gfc_try gfc_check_ibits (gfc_expr *, gfc_expr *, gfc_expr *);
-gfc_try gfc_check_ibset (gfc_expr *, gfc_expr *);
gfc_try gfc_check_ichar_iachar (gfc_expr *, gfc_expr *);
gfc_try gfc_check_idnint (gfc_expr *);
gfc_try gfc_check_ieor (gfc_expr *, gfc_expr *);
@@ -128,7 +126,7 @@ gfc_try gfc_check_second_sub (gfc_expr *);
gfc_try gfc_check_secnds (gfc_expr *);
gfc_try gfc_check_selected_char_kind (gfc_expr *);
gfc_try gfc_check_selected_int_kind (gfc_expr *);
-gfc_try gfc_check_selected_real_kind (gfc_expr *, gfc_expr *);
+gfc_try gfc_check_selected_real_kind (gfc_expr *, gfc_expr *, gfc_expr *);
gfc_try gfc_check_set_exponent (gfc_expr *, gfc_expr *);
gfc_try gfc_check_shape (gfc_expr *);
gfc_try gfc_check_size (gfc_expr *, gfc_expr *, gfc_expr *);
@@ -324,7 +322,7 @@ gfc_expr *gfc_simplify_scale (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_scan (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_selected_char_kind (gfc_expr *);
gfc_expr *gfc_simplify_selected_int_kind (gfc_expr *);
-gfc_expr *gfc_simplify_selected_real_kind (gfc_expr *, gfc_expr *);
+gfc_expr *gfc_simplify_selected_real_kind (gfc_expr *, gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_set_exponent (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_sign (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_shape (gfc_expr *);
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index bc0ea8dce3a..06c6793b2c4 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -5,7 +5,7 @@ This is part of the GNU Fortran manual.
For copying conditions, see the file gfortran.texi.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
@@ -4185,6 +4185,44 @@ Subroutine
Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
statement that should be preferred over the @code{FLUSH} intrinsic.
+The @code{FLUSH} intrinsic and the Fortran 2003 @code{FLUSH} statement
+have identical effect: they flush the runtime library's I/O buffer so
+that the data becomes visible to other processes. This does not guarantee
+that the data is committed to disk.
+
+On POSIX systems, you can request that all data is transferred to the
+storage device by calling the @code{fsync} function, with the POSIX file
+descriptor of the I/O unit as argument (retrieved with GNU intrinsic
+@code{FNUM}). The following example shows how:
+
+@smallexample
+ ! Declare the interface for POSIX fsync function
+ interface
+ function fsync (fd) bind(c,name="fsync")
+ use iso_c_binding, only: c_int
+ integer(c_int), value :: fd
+ integer(c_int) :: fsync
+ end function fsync
+ end interface
+
+ ! Variable declaration
+ integer :: ret
+
+ ! Opening unit 10
+ open (10,file="foo")
+
+ ! ...
+ ! Perform I/O on unit 10
+ ! ...
+
+ ! Flush and sync
+ flush(10)
+ ret = fsync(fnum(10))
+
+ ! Handle possible error
+ if (ret /= 0) stop "Error calling FSYNC"
+@end smallexample
+
@end table
@@ -8678,6 +8716,9 @@ Inquiry function
The return value is of type @code{INTEGER} and of the default integer
kind.
+@item @emph{See also}:
+@ref{SELECTED_REAL_KIND}, @ref{RANGE}
+
@item @emph{Example}:
@smallexample
program prec_and_range
@@ -8823,6 +8864,9 @@ Inquiry function
The return value is a scalar of type @code{INTEGER} and of the default
integer kind.
+@item @emph{See also}:
+@ref{SELECTED_REAL_KIND}
+
@item @emph{Example}:
@smallexample
program test_radix
@@ -9060,6 +9104,9 @@ or @code{COMPLEX}.
The return value is of type @code{INTEGER} and of the default integer
kind.
+@item @emph{See also}:
+@ref{SELECTED_REAL_KIND}, @ref{PRECISION}
+
@item @emph{Example}:
See @code{PRECISION} for an example.
@end table
@@ -9638,45 +9685,58 @@ end program large_integers
@fnindex SELECTED_REAL_KIND
@cindex real kind
@cindex kind, real
+@cindex radix, real
@table @asis
@item @emph{Description}:
@code{SELECTED_REAL_KIND(P,R)} returns the kind value of a real data type
-with decimal precision of at least @code{P} digits and exponent
-range greater at least @code{R}.
+with decimal precision of at least @code{P} digits, exponent range of
+at least @code{R}, and with a radix of @code{RADIX}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, with @code{RADIX} Fortran 2008 or later
@item @emph{Class}:
Transformational function
@item @emph{Syntax}:
-@code{RESULT = SELECTED_REAL_KIND([P, R])}
+@code{RESULT = SELECTED_REAL_KIND([P, R, RADIX])}
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
@item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
+@item @var{RADIX} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
@end multitable
-At least one argument shall be present.
+Before Fortran 2008, at least one of the arguments @var{R} or @var{P} shall
+be present; since Fortran 2008, they are assumed to be zero if absent.
@item @emph{Return value}:
@code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
-a real data type with decimal precision of at least @code{P} digits and a
-decimal exponent range of at least @code{R}. If more than one real data
-type meet the criteria, the kind of the data type with the smallest
-decimal precision is returned. If no real data type matches the criteria,
-the result is
+a real data type with decimal precision of at least @code{P} digits, a
+decimal exponent range of at least @code{R}, and with the requested
+@code{RADIX}. If the @code{RADIX} parameter is absent, real kinds with
+any radix can be returned. If more than one real data type meet the
+criteria, the kind of the data type with the smallest decimal precision
+is returned. If no real data type matches the criteria, the result is
@table @asis
@item -1 if the processor does not support a real data type with a
-precision greater than or equal to @code{P}
+precision greater than or equal to @code{P}, but the @code{R} and
+@code{RADIX} requirements can be fulfilled
@item -2 if the processor does not support a real type with an exponent
-range greater than or equal to @code{R}
-@item -3 if neither is supported.
+range greater than or equal to @code{R}, but @code{P} and @code{RADIX}
+are fulfillable
+@item -3 if @code{RADIX} but not @code{P} and @code{R} requirements
+are fulfillable
+@item -4 if @code{RADIX} and either @code{P} or @code{R} requirements
+are fulfillable
+@item -5 if there is no real type with the given @code{RADIX}
@end table
+@item @emph{See also}:
+@ref{PRECISION}, @ref{RANGE}, @ref{RADIX}
+
@item @emph{Example}:
@smallexample
program real_kinds
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 78c1c436561..1dfd3bdd920 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -9,7 +9,7 @@ Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
@@ -148,8 +148,7 @@ and warnings}.
@item Directory Options
@xref{Directory Options,,Options for directory search}.
-@gccoptlist{-I@var{dir} -J@var{dir} -M@var{dir} @gol
--fintrinsic-modules-path @var{dir}}
+@gccoptlist{-I@var{dir} -J@var{dir} -fintrinsic-modules-path @var{dir}}
@item Link Options
@xref{Link Options,,Options for influencing the linking step}.
@@ -964,7 +963,6 @@ gcc,Using the GNU Compiler Collection (GCC)}, for information on the
@option{-I} option.
@item -J@var{dir}
-@item -M@var{dir}
@opindex @code{J}@var{dir}
@opindex @code{M}@var{dir}
@cindex paths, search
@@ -975,8 +973,6 @@ statement.
The default is the current directory.
-@option{-M} is deprecated to avoid conflicts with existing GCC options.
-
@item -fintrinsic-modules-path @var{dir}
@opindex @code{fintrinsic-modules-path} @var{dir}
@cindex paths, search
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index dc20bc2ffb6..f9a6d7b1240 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -730,7 +730,7 @@ data_desc:
t = format_lex ();
if (t == FMT_ERROR)
goto fail;
- if (gfc_option.allow_std < GFC_STD_F2003 && t != FMT_COMMA
+ if (!(gfc_option.allow_std & GFC_STD_F2003) && t != FMT_COMMA
&& t != FMT_F && t != FMT_E && t != FMT_EN && t != FMT_ES
&& t != FMT_D && t != FMT_G && t != FMT_RPAREN && t != FMT_SLASH)
{
diff --git a/gcc/fortran/lang-specs.h b/gcc/fortran/lang-specs.h
index a622dcb1a6a..4fe24de1927 100644
--- a/gcc/fortran/lang-specs.h
+++ b/gcc/fortran/lang-specs.h
@@ -28,7 +28,7 @@
%{O*} %{undef}"
/* Options that f951 should know about, even if not preprocessing. */
-#define CPP_FORWARD_OPTIONS "%{i*} %{I*}"
+#define CPP_FORWARD_OPTIONS "%{i*} %{I*} %{M*}"
#define F951_CPP_OPTIONS "%{!nocpp: -cpp %g.f90 %{E} %(cpp_unique_options) \
%{E|M|MM:%(cpp_debug_options) " CPP_ONLY_OPTIONS \
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index c1a86ddab08..1f3ef9d0574 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -56,6 +56,42 @@ J
Fortran Joined Separate
-J<directory> Put MODULE files in 'directory'
+M
+Fortran
+; Documented in C
+
+MD
+Fortran Separate
+; Documented in C
+
+MF
+Fortran Joined Separate
+; Documented in C
+
+MG
+Fortran
+; Documented in C
+
+MM
+Fortran
+; Documented in C
+
+MMD
+Fortran Separate
+; Documented in C
+
+MP
+Fortran
+; Documented in C
+
+MT
+Fortran Joined Separate
+; Documented in C
+
+MQ
+Fortran Joined Separate
+; Documented in C
+
P
Fortran
; Documented in C
@@ -369,7 +405,7 @@ Fortran
Append a second underscore if the name already contains an underscore
fshort-enums
-Fortran
+Fortran Var(flag_short_enums) VarExists
; Documented in C
fsign-zero
diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h
index 85bd43df98c..d9216d30149 100644
--- a/gcc/fortran/libgfortran.h
+++ b/gcc/fortran/libgfortran.h
@@ -23,15 +23,16 @@ along with GCC; see the file COPYING3. If not see
Note that no features were obsoleted nor deleted in F2003.
Please remember to keep those definitions in sync with
gfortran.texi. */
-#define GFC_STD_F2008 (1<<7) /* New in F2008. */
-#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
-#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
-#define GFC_STD_F2003 (1<<4) /* New in F2003. */
-#define GFC_STD_F95 (1<<3) /* New in F95. */
-#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
-#define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */
-#define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or
- obsolescent in later standards. */
+#define GFC_STD_F2008_OBS (1<<8) /* Obsolescent in F2008. */
+#define GFC_STD_F2008 (1<<7) /* New in F2008. */
+#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
+#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
+#define GFC_STD_F2003 (1<<4) /* New in F2003. */
+#define GFC_STD_F95 (1<<3) /* New in F95. */
+#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
+#define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */
+#define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or
+ obsolescent in later standards. */
/* Bitmasks for the various FPE that can be enabled. */
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 2cbac0200fd..92c4da0a4b5 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1797,6 +1797,98 @@ gfc_match_block (void)
}
+/* Match an ASSOCIATE statement. */
+
+match
+gfc_match_associate (void)
+{
+ if (gfc_match_label () == MATCH_ERROR)
+ return MATCH_ERROR;
+
+ if (gfc_match (" associate") != MATCH_YES)
+ return MATCH_NO;
+
+ /* Match the association list. */
+ if (gfc_match_char ('(') != MATCH_YES)
+ {
+ gfc_error ("Expected association list at %C");
+ return MATCH_ERROR;
+ }
+ new_st.ext.block.assoc = NULL;
+ while (true)
+ {
+ gfc_association_list* newAssoc = gfc_get_association_list ();
+ gfc_association_list* a;
+
+ /* Match the next association. */
+ if (gfc_match (" %n => %e", newAssoc->name, &newAssoc->target)
+ != MATCH_YES)
+ {
+ gfc_error ("Expected association at %C");
+ goto assocListError;
+ }
+
+ /* Check that the current name is not yet in the list. */
+ for (a = new_st.ext.block.assoc; a; a = a->next)
+ if (!strcmp (a->name, newAssoc->name))
+ {
+ gfc_error ("Duplicate name '%s' in association at %C",
+ newAssoc->name);
+ goto assocListError;
+ }
+
+ /* The target expression must not be coindexed. */
+ if (gfc_is_coindexed (newAssoc->target))
+ {
+ gfc_error ("Association target at %C must not be coindexed");
+ goto assocListError;
+ }
+
+ /* The target is a variable (and may be used as lvalue) if it's an
+ EXPR_VARIABLE and does not have vector-subscripts. */
+ newAssoc->variable = (newAssoc->target->expr_type == EXPR_VARIABLE
+ && !gfc_has_vector_subscript (newAssoc->target));
+
+ /* Put it into the list. */
+ newAssoc->next = new_st.ext.block.assoc;
+ new_st.ext.block.assoc = newAssoc;
+
+ /* Try next one or end if closing parenthesis is found. */
+ gfc_gobble_whitespace ();
+ if (gfc_peek_char () == ')')
+ break;
+ if (gfc_match_char (',') != MATCH_YES)
+ {
+ gfc_error ("Expected ')' or ',' at %C");
+ return MATCH_ERROR;
+ }
+
+ continue;
+
+assocListError:
+ gfc_free (newAssoc);
+ goto error;
+ }
+ if (gfc_match_char (')') != MATCH_YES)
+ {
+ /* This should never happen as we peek above. */
+ gcc_unreachable ();
+ }
+
+ if (gfc_match_eos () != MATCH_YES)
+ {
+ gfc_error ("Junk after ASSOCIATE statement at %C");
+ goto error;
+ }
+
+ return MATCH_YES;
+
+error:
+ gfc_free_association_list (new_st.ext.block.assoc);
+ return MATCH_ERROR;
+}
+
+
/* Match a DO statement. */
match
@@ -2693,16 +2785,16 @@ match
gfc_match_allocate (void)
{
gfc_alloc *head, *tail;
- gfc_expr *stat, *errmsg, *tmp, *source;
+ gfc_expr *stat, *errmsg, *tmp, *source, *mold;
gfc_typespec ts;
gfc_symbol *sym;
match m;
locus old_locus;
- bool saw_stat, saw_errmsg, saw_source, b1, b2, b3;
+ bool saw_stat, saw_errmsg, saw_source, saw_mold, b1, b2, b3;
head = tail = NULL;
- stat = errmsg = source = tmp = NULL;
- saw_stat = saw_errmsg = saw_source = false;
+ stat = errmsg = source = mold = tmp = NULL;
+ saw_stat = saw_errmsg = saw_source = saw_mold = false;
if (gfc_match_char ('(') != MATCH_YES)
goto syntax;
@@ -2895,6 +2987,38 @@ alloc_opt_list:
goto alloc_opt_list;
}
+ m = gfc_match (" mold = %e", &tmp);
+ if (m == MATCH_ERROR)
+ goto cleanup;
+ if (m == MATCH_YES)
+ {
+ if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: MOLD tag at %L",
+ &tmp->where) == FAILURE)
+ goto cleanup;
+
+ /* Check F08:C636. */
+ if (saw_mold)
+ {
+ gfc_error ("Redundant MOLD tag found at %L ", &tmp->where);
+ goto cleanup;
+ }
+
+ /* Check F08:C637. */
+ if (ts.type != BT_UNKNOWN)
+ {
+ gfc_error ("MOLD tag at %L conflicts with the typespec at %L",
+ &tmp->where, &old_locus);
+ goto cleanup;
+ }
+
+ mold = tmp;
+ saw_mold = true;
+ mold->mold = 1;
+
+ if (gfc_match_char (',') == MATCH_YES)
+ goto alloc_opt_list;
+ }
+
gfc_gobble_whitespace ();
if (gfc_peek_char () == ')')
@@ -2905,10 +3029,21 @@ alloc_opt_list:
if (gfc_match (" )%t") != MATCH_YES)
goto syntax;
+ /* Check F08:C637. */
+ if (source && mold)
+ {
+ gfc_error ("MOLD tag at %L conflicts with SOURCE tag at %L",
+ &mold->where, &source->where);
+ goto cleanup;
+ }
+
new_st.op = EXEC_ALLOCATE;
new_st.expr1 = stat;
new_st.expr2 = errmsg;
- new_st.expr3 = source;
+ if (source)
+ new_st.expr3 = source;
+ else
+ new_st.expr3 = mold;
new_st.ext.alloc.list = head;
new_st.ext.alloc.ts = ts;
@@ -2921,7 +3056,8 @@ cleanup:
gfc_free_expr (errmsg);
gfc_free_expr (source);
gfc_free_expr (stat);
- gfc_free_expr (tmp);
+ gfc_free_expr (mold);
+ if (tmp && tmp->expr_type) gfc_free_expr (tmp);
gfc_free_alloc_list (head);
return MATCH_ERROR;
}
@@ -4361,7 +4497,7 @@ gfc_match_select_type (void)
new_st.op = EXEC_SELECT_TYPE;
new_st.expr1 = expr1;
new_st.expr2 = expr2;
- new_st.ext.ns = gfc_current_ns;
+ new_st.ext.block.ns = gfc_current_ns;
select_type_push (expr1->symtree->n.sym);
diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h
index 049f3d3285c..501049e1220 100644
--- a/gcc/fortran/match.h
+++ b/gcc/fortran/match.h
@@ -69,6 +69,7 @@ match gfc_match_else (void);
match gfc_match_elseif (void);
match gfc_match_critical (void);
match gfc_match_block (void);
+match gfc_match_associate (void);
match gfc_match_do (void);
match gfc_match_cycle (void);
match gfc_match_exit (void);
@@ -167,6 +168,7 @@ void gfc_set_constant_character_len (int, gfc_expr *, int);
match gfc_match_allocatable (void);
match gfc_match_asynchronous (void);
match gfc_match_codimension (void);
+match gfc_match_contiguous (void);
match gfc_match_dimension (void);
match gfc_match_external (void);
match gfc_match_gcc_attributes (void);
diff --git a/gcc/fortran/mathbuiltins.def b/gcc/fortran/mathbuiltins.def
index 3bedc1a6ba5..2d6e9677d62 100644
--- a/gcc/fortran/mathbuiltins.def
+++ b/gcc/fortran/mathbuiltins.def
@@ -51,3 +51,20 @@ DEFINE_MATH_BUILTIN (ERFC, "erfc", 0)
DEFINE_MATH_BUILTIN (TGAMMA,"tgamma", 0)
DEFINE_MATH_BUILTIN (LGAMMA,"lgamma", 0)
DEFINE_MATH_BUILTIN (HYPOT, "hypot", 1)
+
+/* OTHER_BUILTIN (CODE, NAME, PROTOTYPE_TYPE)
+ For floating-point builtins that do not directly correspond to a
+ Fortran intrinsic. This is used to map the different variants (float,
+ double and long double) and to build the quad-precision decls. */
+OTHER_BUILTIN (CABS, "cabs", cabs)
+OTHER_BUILTIN (COPYSIGN, "copysign", 2)
+OTHER_BUILTIN (FABS, "fabs", 1)
+OTHER_BUILTIN (FMOD, "fmod", 2)
+OTHER_BUILTIN (FREXP, "frexp", frexp)
+OTHER_BUILTIN (HUGE_VAL, "huge_val", 0)
+OTHER_BUILTIN (LLROUND, "llround", llround)
+OTHER_BUILTIN (LROUND, "lround", lround)
+OTHER_BUILTIN (NEXTAFTER, "nextafter", 2)
+OTHER_BUILTIN (ROUND, "round", 1)
+OTHER_BUILTIN (SCALBN, "scalbn", scalbn)
+OTHER_BUILTIN (TRUNC, "trunc", 1)
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 9bdee2a60f0..b42a9e8c1d1 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -74,6 +74,7 @@ along with GCC; see the file COPYING3. If not see
#include "parse.h" /* FIXME */
#include "md5.h"
#include "constructor.h"
+#include "cpp.h"
#define MODULE_EXTENSION ".mod"
@@ -1674,7 +1675,7 @@ typedef enum
AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED,
AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP,
AB_IS_CLASS, AB_PROCEDURE, AB_PROC_POINTER, AB_ASYNCHRONOUS, AB_CODIMENSION,
- AB_COARRAY_COMP, AB_VTYPE, AB_VTAB
+ AB_COARRAY_COMP, AB_VTYPE, AB_VTAB, AB_CONTIGUOUS
}
ab_attribute;
@@ -1684,6 +1685,7 @@ static const mstring attr_bits[] =
minit ("ASYNCHRONOUS", AB_ASYNCHRONOUS),
minit ("DIMENSION", AB_DIMENSION),
minit ("CODIMENSION", AB_CODIMENSION),
+ minit ("CONTIGUOUS", AB_CONTIGUOUS),
minit ("EXTERNAL", AB_EXTERNAL),
minit ("INTRINSIC", AB_INTRINSIC),
minit ("OPTIONAL", AB_OPTIONAL),
@@ -1806,6 +1808,8 @@ mio_symbol_attribute (symbol_attribute *attr)
MIO_NAME (ab_attribute) (AB_DIMENSION, attr_bits);
if (attr->codimension)
MIO_NAME (ab_attribute) (AB_CODIMENSION, attr_bits);
+ if (attr->contiguous)
+ MIO_NAME (ab_attribute) (AB_CONTIGUOUS, attr_bits);
if (attr->external)
MIO_NAME (ab_attribute) (AB_EXTERNAL, attr_bits);
if (attr->intrinsic)
@@ -1914,6 +1918,9 @@ mio_symbol_attribute (symbol_attribute *attr)
case AB_CODIMENSION:
attr->codimension = 1;
break;
+ case AB_CONTIGUOUS:
+ attr->contiguous = 1;
+ break;
case AB_EXTERNAL:
attr->external = 1;
break;
@@ -3323,7 +3330,7 @@ mio_typebound_proc (gfc_typebound_proc** proc)
if (iomode == IO_INPUT)
{
- *proc = gfc_get_typebound_proc ();
+ *proc = gfc_get_typebound_proc (NULL);
(*proc)->where = gfc_current_locus;
}
gcc_assert (*proc);
@@ -5120,6 +5127,9 @@ gfc_dump_module (const char *name, int dump_flag)
return;
}
+ if (gfc_cpp_makedep ())
+ gfc_cpp_add_target (filename);
+
/* Write the module to the temporary file. */
module_fp = fopen (filename_tmp, "w");
if (module_fp == NULL)
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 6a56515298e..0e25bf48cb3 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -845,11 +845,13 @@ resolve_omp_clauses (gfc_code *code)
for (list = 0; list < OMP_LIST_NUM; list++)
if (list != OMP_LIST_FIRSTPRIVATE && list != OMP_LIST_LASTPRIVATE)
for (n = omp_clauses->lists[list]; n; n = n->next)
- if (n->sym->mark)
- gfc_error ("Symbol '%s' present on multiple clauses at %L",
- n->sym->name, &code->loc);
- else
- n->sym->mark = 1;
+ {
+ if (n->sym->mark)
+ gfc_error ("Symbol '%s' present on multiple clauses at %L",
+ n->sym->name, &code->loc);
+ else
+ n->sym->mark = 1;
+ }
gcc_assert (OMP_LIST_LASTPRIVATE == OMP_LIST_FIRSTPRIVATE + 1);
for (list = OMP_LIST_FIRSTPRIVATE; list <= OMP_LIST_LASTPRIVATE; list++)
@@ -862,22 +864,24 @@ resolve_omp_clauses (gfc_code *code)
}
for (n = omp_clauses->lists[OMP_LIST_FIRSTPRIVATE]; n; n = n->next)
- if (n->sym->mark)
- gfc_error ("Symbol '%s' present on multiple clauses at %L",
- n->sym->name, &code->loc);
- else
- n->sym->mark = 1;
-
+ {
+ if (n->sym->mark)
+ gfc_error ("Symbol '%s' present on multiple clauses at %L",
+ n->sym->name, &code->loc);
+ else
+ n->sym->mark = 1;
+ }
for (n = omp_clauses->lists[OMP_LIST_LASTPRIVATE]; n; n = n->next)
n->sym->mark = 0;
for (n = omp_clauses->lists[OMP_LIST_LASTPRIVATE]; n; n = n->next)
- if (n->sym->mark)
- gfc_error ("Symbol '%s' present on multiple clauses at %L",
- n->sym->name, &code->loc);
- else
- n->sym->mark = 1;
-
+ {
+ if (n->sym->mark)
+ gfc_error ("Symbol '%s' present on multiple clauses at %L",
+ n->sym->name, &code->loc);
+ else
+ n->sym->mark = 1;
+ }
for (list = 0; list < OMP_LIST_NUM; list++)
if ((n = omp_clauses->lists[list]) != NULL)
{
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 6c6ccb10461..af537a1e70e 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -48,7 +48,7 @@ set_default_std_flags (void)
{
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
- | GFC_STD_GNU | GFC_STD_LEGACY;
+ | GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY;
gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
}
@@ -541,10 +541,6 @@ gfc_handle_option (size_t scode, const char *arg, int value,
int result = 1;
enum opt_code code = (enum opt_code) scode;
- /* Ignore file names. */
- if (code == N_OPTS)
- return 1;
-
if (gfc_cpp_handle_option (scode, arg, value) == 1)
return 1;
@@ -861,7 +857,8 @@ gfc_handle_option (size_t scode, const char *arg, int value,
break;
case OPT_std_f95:
- gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
+ gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77
+ | GFC_STD_F2008_OBS;
gfc_option.warn_std = GFC_STD_F95_OBS;
gfc_option.max_continue_fixed = 19;
gfc_option.max_continue_free = 39;
@@ -872,7 +869,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
case OPT_std_f2003:
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
- | GFC_STD_F2003 | GFC_STD_F95;
+ | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008_OBS;
gfc_option.warn_std = GFC_STD_F95_OBS;
gfc_option.max_identifier_length = 63;
gfc_option.warn_ampersand = 1;
@@ -881,8 +878,8 @@ gfc_handle_option (size_t scode, const char *arg, int value,
case OPT_std_f2008:
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
- | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008;
- gfc_option.warn_std = GFC_STD_F95_OBS;
+ | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008 | GFC_STD_F2008_OBS;
+ gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS;
gfc_option.max_identifier_length = 63;
gfc_option.warn_ampersand = 1;
gfc_option.warn_tabs = 0;
@@ -902,7 +899,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
break;
case OPT_fshort_enums:
- flag_short_enums = 1;
+ /* Handled in language-independent code. */
break;
case OPT_fconvert_little_endian:
@@ -938,7 +935,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
break;
case OPT_frecursive:
- gfc_option.flag_recursive = 1;
+ gfc_option.flag_recursive = value;
break;
case OPT_falign_commons:
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 7fc35418bec..50f795723eb 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -139,6 +139,7 @@ decode_specification_statement (void)
case 'c':
match ("codimension", gfc_match_codimension, ST_ATTR_DECL);
+ match ("contiguous", gfc_match_contiguous, ST_ATTR_DECL);
break;
case 'd':
@@ -292,7 +293,7 @@ decode_statement (void)
gfc_undo_symbols ();
gfc_current_locus = old_locus;
- /* Check for the IF, DO, SELECT, WHERE, FORALL, CRITICAL, and BLOCK
+ /* Check for the IF, DO, SELECT, WHERE, FORALL, CRITICAL, BLOCK and ASSOCIATE
statements, which might begin with a block label. The match functions for
these statements are unusual in that their keyword is not seen before
the matcher is called. */
@@ -314,6 +315,7 @@ decode_statement (void)
match (NULL, gfc_match_do, ST_DO);
match (NULL, gfc_match_block, ST_BLOCK);
+ match (NULL, gfc_match_associate, ST_ASSOCIATE);
match (NULL, gfc_match_critical, ST_CRITICAL);
match (NULL, gfc_match_select, ST_SELECT_CASE);
match (NULL, gfc_match_select_type, ST_SELECT_TYPE);
@@ -345,6 +347,7 @@ decode_statement (void)
match ("call", gfc_match_call, ST_CALL);
match ("close", gfc_match_close, ST_CLOSE);
match ("continue", gfc_match_continue, ST_CONTINUE);
+ match ("contiguous", gfc_match_contiguous, ST_ATTR_DECL);
match ("cycle", gfc_match_cycle, ST_CYCLE);
match ("case", gfc_match_case, ST_CASE);
match ("common", gfc_match_common, ST_COMMON);
@@ -714,7 +717,9 @@ next_free (void)
if (at_bol && c == ';')
{
- gfc_error_now ("Semicolon at %C needs to be preceded by statement");
+ if (!(gfc_option.allow_std & GFC_STD_F2008))
+ gfc_error_now ("Fortran 2008: Semicolon at %C without preceding "
+ "statement");
gfc_next_ascii_char (); /* Eat up the semicolon. */
return ST_NONE;
}
@@ -850,7 +855,11 @@ next_fixed (void)
if (c == ';')
{
- gfc_error_now ("Semicolon at %C needs to be preceded by statement");
+ if (digit_flag)
+ gfc_error_now ("Semicolon at %C needs to be preceded by statement");
+ else if (!(gfc_option.allow_std & GFC_STD_F2008))
+ gfc_error_now ("Fortran 2008: Semicolon at %C without preceding "
+ "statement");
return ST_NONE;
}
@@ -949,7 +958,7 @@ next_statement (void)
/* Statements that mark other executable statements. */
#define case_exec_markers case ST_DO: case ST_FORALL_BLOCK: \
- case ST_IF_BLOCK: case ST_BLOCK: \
+ case ST_IF_BLOCK: case ST_BLOCK: case ST_ASSOCIATE: \
case ST_WHERE_BLOCK: case ST_SELECT_CASE: case ST_SELECT_TYPE: \
case ST_OMP_PARALLEL: \
case ST_OMP_PARALLEL_SECTIONS: case ST_OMP_SECTIONS: case ST_OMP_ORDERED: \
@@ -970,7 +979,7 @@ next_statement (void)
#define case_end case ST_END_BLOCK_DATA: case ST_END_FUNCTION: \
case ST_END_PROGRAM: case ST_END_SUBROUTINE: \
- case ST_END_BLOCK
+ case ST_END_BLOCK: case ST_END_ASSOCIATE
/* Push a new state onto the stack. */
@@ -1155,6 +1164,9 @@ gfc_ascii_statement (gfc_statement st)
case ST_ALLOCATE:
p = "ALLOCATE";
break;
+ case ST_ASSOCIATE:
+ p = "ASSOCIATE";
+ break;
case ST_ATTR_DECL:
p = _("attribute declaration");
break;
@@ -1215,6 +1227,9 @@ gfc_ascii_statement (gfc_statement st)
case ST_ELSEWHERE:
p = "ELSEWHERE";
break;
+ case ST_END_ASSOCIATE:
+ p = "END ASSOCIATE";
+ break;
case ST_END_BLOCK:
p = "END BLOCK";
break;
@@ -3160,7 +3175,8 @@ parse_block_construct (void)
my_ns = gfc_build_block_ns (gfc_current_ns);
new_st.op = EXEC_BLOCK;
- new_st.ext.ns = my_ns;
+ new_st.ext.block.ns = my_ns;
+ new_st.ext.block.assoc = NULL;
accept_statement (ST_BLOCK);
push_state (&s, COMP_BLOCK, my_ns->proc_name);
@@ -3173,6 +3189,92 @@ parse_block_construct (void)
}
+/* Parse an ASSOCIATE construct. This is essentially a BLOCK construct
+ behind the scenes with compiler-generated variables. */
+
+static void
+parse_associate (void)
+{
+ gfc_namespace* my_ns;
+ gfc_state_data s;
+ gfc_statement st;
+ gfc_association_list* a;
+ gfc_code* assignTail;
+
+ gfc_notify_std (GFC_STD_F2003, "Fortran 2003: ASSOCIATE construct at %C");
+
+ my_ns = gfc_build_block_ns (gfc_current_ns);
+
+ new_st.op = EXEC_BLOCK;
+ new_st.ext.block.ns = my_ns;
+ gcc_assert (new_st.ext.block.assoc);
+
+ /* Add all associations to expressions as BLOCK variables, and create
+ assignments to them giving their values. */
+ gfc_current_ns = my_ns;
+ assignTail = NULL;
+ for (a = new_st.ext.block.assoc; a; a = a->next)
+ if (!a->variable)
+ {
+ gfc_code* newAssign;
+
+ if (gfc_get_sym_tree (a->name, NULL, &a->st, false))
+ gcc_unreachable ();
+
+ /* Note that in certain cases, the target-expression's type is not yet
+ known and so we have to adapt the symbol's ts also during resolution
+ for these cases. */
+ a->st->n.sym->ts = a->target->ts;
+ a->st->n.sym->attr.flavor = FL_VARIABLE;
+ a->st->n.sym->assoc = a;
+ gfc_set_sym_referenced (a->st->n.sym);
+
+ /* Create the assignment to calculate the expression and set it. */
+ newAssign = gfc_get_code ();
+ newAssign->op = EXEC_ASSIGN;
+ newAssign->loc = gfc_current_locus;
+ newAssign->expr1 = gfc_get_variable_expr (a->st);
+ newAssign->expr2 = a->target;
+
+ /* Hang it in. */
+ if (assignTail)
+ assignTail->next = newAssign;
+ else
+ gfc_current_ns->code = newAssign;
+ assignTail = newAssign;
+ }
+ else
+ {
+ gfc_error ("Association to variables is not yet supported at %C");
+ return;
+ }
+ gcc_assert (assignTail);
+
+ accept_statement (ST_ASSOCIATE);
+ push_state (&s, COMP_ASSOCIATE, my_ns->proc_name);
+
+loop:
+ st = parse_executable (ST_NONE);
+ switch (st)
+ {
+ case ST_NONE:
+ unexpected_eof ();
+
+ case_end:
+ accept_statement (st);
+ assignTail->next = gfc_state_stack->head;
+ break;
+
+ default:
+ unexpected_statement (st);
+ goto loop;
+ }
+
+ gfc_current_ns = gfc_current_ns->parent;
+ pop_state ();
+}
+
+
/* Parse a DO loop. Note that the ST_CYCLE and ST_EXIT statements are
handled inside of parse_executable(), because they aren't really
loop statements. */
@@ -3542,8 +3644,6 @@ parse_executable (gfc_statement st)
case ST_END_SUBROUTINE:
case ST_DO:
- case ST_CRITICAL:
- case ST_BLOCK:
case ST_FORALL:
case ST_WHERE:
case ST_SELECT_CASE:
@@ -3573,6 +3673,10 @@ parse_executable (gfc_statement st)
parse_block_construct ();
break;
+ case ST_ASSOCIATE:
+ parse_associate ();
+ break;
+
case ST_IF_BLOCK:
parse_if_block ();
break;
diff --git a/gcc/fortran/parse.h b/gcc/fortran/parse.h
index faa813d88d0..65d1a7e604a 100644
--- a/gcc/fortran/parse.h
+++ b/gcc/fortran/parse.h
@@ -28,7 +28,7 @@ typedef enum
{
COMP_NONE, COMP_PROGRAM, COMP_MODULE, COMP_SUBROUTINE, COMP_FUNCTION,
COMP_BLOCK_DATA, COMP_INTERFACE, COMP_DERIVED, COMP_DERIVED_CONTAINS,
- COMP_BLOCK, COMP_IF,
+ COMP_BLOCK, COMP_ASSOCIATE, COMP_IF,
COMP_DO, COMP_SELECT, COMP_FORALL, COMP_WHERE, COMP_CONTAINS, COMP_ENUM,
COMP_SELECT_TYPE, COMP_OMP_STRUCTURED_BLOCK, COMP_CRITICAL
}
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 68b6a437360..b6c08a9c406 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2975,6 +2975,12 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag)
gfc_error ("Assigning to PROTECTED variable at %C");
return MATCH_ERROR;
}
+ if (sym->assoc && !sym->assoc->variable)
+ {
+ gfc_error ("'%s' associated to expression can't appear in a variable"
+ " definition context at %C", sym->name);
+ return MATCH_ERROR;
+ }
break;
case FL_UNKNOWN:
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 48bb6187c17..4e11fc6c311 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1858,29 +1858,6 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
}
}
- if (gsym->ns->proc_name->attr.function
- && gsym->ns->proc_name->as
- && gsym->ns->proc_name->as->rank
- && (!sym->as || sym->as->rank != gsym->ns->proc_name->as->rank))
- gfc_error ("The reference to function '%s' at %L either needs an "
- "explicit INTERFACE or the rank is incorrect", sym->name,
- where);
-
- /* Non-assumed length character functions. */
- if (sym->attr.function && sym->ts.type == BT_CHARACTER
- && gsym->ns->proc_name->ts.u.cl->length != NULL)
- {
- gfc_charlen *cl = sym->ts.u.cl;
-
- if (!sym->attr.entry_master && sym->attr.if_source == IFSRC_UNKNOWN
- && cl && cl->length && cl->length->expr_type != EXPR_CONSTANT)
- {
- gfc_error ("Nonconstant character-length function '%s' at %L "
- "must have an explicit interface", sym->name,
- &sym->declared_at);
- }
- }
-
/* Differences in constant character lengths. */
if (sym->attr.function && sym->ts.type == BT_CHARACTER)
{
@@ -1911,26 +1888,108 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
sym->name, &sym->declared_at, gfc_typename (&sym->ts),
gfc_typename (&gsym->ns->proc_name->ts));
- /* Assumed shape arrays as dummy arguments. */
if (gsym->ns->proc_name->formal)
{
gfc_formal_arglist *arg = gsym->ns->proc_name->formal;
for ( ; arg; arg = arg->next)
- if (arg->sym && arg->sym->as
- && arg->sym->as->type == AS_ASSUMED_SHAPE)
+ if (!arg->sym)
+ continue;
+ /* F2003, 12.3.1.1 (2a); F2008, 12.4.2.2 (2a) */
+ else if (arg->sym->attr.allocatable
+ || arg->sym->attr.asynchronous
+ || arg->sym->attr.optional
+ || arg->sym->attr.pointer
+ || arg->sym->attr.target
+ || arg->sym->attr.value
+ || arg->sym->attr.volatile_)
+ {
+ gfc_error ("Dummy argument '%s' of procedure '%s' at %L "
+ "has an attribute that requires an explicit "
+ "interface for this procedure", arg->sym->name,
+ sym->name, &sym->declared_at);
+ break;
+ }
+ /* F2003, 12.3.1.1 (2b); F2008, 12.4.2.2 (2b) */
+ else if (arg->sym && arg->sym->as
+ && arg->sym->as->type == AS_ASSUMED_SHAPE)
{
gfc_error ("Procedure '%s' at %L with assumed-shape dummy "
- "'%s' argument must have an explicit interface",
+ "argument '%s' must have an explicit interface",
sym->name, &sym->declared_at, arg->sym->name);
break;
}
- else if (arg->sym && arg->sym->attr.optional)
+ /* F2008, 12.4.2.2 (2c) */
+ else if (arg->sym->attr.codimension)
{
- gfc_error ("Procedure '%s' at %L with optional dummy argument "
+ gfc_error ("Procedure '%s' at %L with coarray dummy argument "
"'%s' must have an explicit interface",
sym->name, &sym->declared_at, arg->sym->name);
break;
}
+ /* F2003, 12.3.1.1 (2c); F2008, 12.4.2.2 (2d) */
+ else if (false) /* TODO: is a parametrized derived type */
+ {
+ gfc_error ("Procedure '%s' at %L with parametrized derived "
+ "type argument '%s' must have an explicit "
+ "interface", sym->name, &sym->declared_at,
+ arg->sym->name);
+ break;
+ }
+ /* F2003, 12.3.1.1 (2d); F2008, 12.4.2.2 (2e) */
+ else if (arg->sym->ts.type == BT_CLASS)
+ {
+ gfc_error ("Procedure '%s' at %L with polymorphic dummy "
+ "argument '%s' must have an explicit interface",
+ sym->name, &sym->declared_at, arg->sym->name);
+ break;
+ }
+ }
+
+ if (gsym->ns->proc_name->attr.function)
+ {
+ /* F2003, 12.3.1.1 (3a); F2008, 12.4.2.2 (3a) */
+ if (gsym->ns->proc_name->as
+ && gsym->ns->proc_name->as->rank
+ && (!sym->as || sym->as->rank != gsym->ns->proc_name->as->rank))
+ gfc_error ("The reference to function '%s' at %L either needs an "
+ "explicit INTERFACE or the rank is incorrect", sym->name,
+ where);
+
+ /* F2003, 12.3.1.1 (3b); F2008, 12.4.2.2 (3b) */
+ if (gsym->ns->proc_name->result->attr.pointer
+ || gsym->ns->proc_name->result->attr.allocatable)
+ gfc_error ("Function '%s' at %L with a POINTER or ALLOCATABLE "
+ "result must have an explicit interface", sym->name,
+ where);
+
+ /* F2003, 12.3.1.1 (3c); F2008, 12.4.2.2 (3c) */
+ if (sym->ts.type == BT_CHARACTER
+ && gsym->ns->proc_name->ts.u.cl->length != NULL)
+ {
+ gfc_charlen *cl = sym->ts.u.cl;
+
+ if (!sym->attr.entry_master && sym->attr.if_source == IFSRC_UNKNOWN
+ && cl && cl->length && cl->length->expr_type != EXPR_CONSTANT)
+ {
+ gfc_error ("Nonconstant character-length function '%s' at %L "
+ "must have an explicit interface", sym->name,
+ &sym->declared_at);
+ }
+ }
+ }
+
+ /* F2003, 12.3.1.1 (4); F2008, 12.4.2.2 (4) */
+ if (gsym->ns->proc_name->attr.elemental)
+ {
+ gfc_error ("ELEMENTAL procedure '%s' at %L must have an explicit "
+ "interface", sym->name, &sym->declared_at);
+ }
+
+ /* F2003, 12.3.1.1 (5); F2008, 12.4.2.2 (5) */
+ if (gsym->ns->proc_name->attr.is_bind_c)
+ {
+ gfc_error ("Procedure '%s' at %L with BIND(C) attribute must have "
+ "an explicit interface", sym->name, &sym->declared_at);
}
if (gfc_option.flag_whole_file == 1
@@ -2200,6 +2259,7 @@ is_external_proc (gfc_symbol *sym)
&& !(sym->attr.intrinsic
|| gfc_is_intrinsic (sym, sym->attr.subroutine, sym->declared_at))
&& sym->attr.proc != PROC_ST_FUNCTION
+ && !sym->attr.proc_pointer
&& !sym->attr.use_assoc
&& sym->name)
return true;
@@ -3615,11 +3675,11 @@ resolve_operator (gfc_expr *e)
e->rank = op1->rank;
if (e->shape == NULL)
{
- t = compare_shapes(op1, op2);
+ t = compare_shapes (op1, op2);
if (t == FAILURE)
e->shape = NULL;
else
- e->shape = gfc_copy_shape (op1->shape, op1->rank);
+ e->shape = gfc_copy_shape (op1->shape, op1->rank);
}
}
else
@@ -5160,6 +5220,43 @@ resolve_typebound_static (gfc_expr* e, gfc_symtree** target,
}
+/* Get the ultimate declared type from an expression. In addition,
+ return the last class/derived type reference and the copy of the
+ reference list. */
+static gfc_symbol*
+get_declared_from_expr (gfc_ref **class_ref, gfc_ref **new_ref,
+ gfc_expr *e)
+{
+ gfc_symbol *declared;
+ gfc_ref *ref;
+
+ declared = NULL;
+ if (class_ref)
+ *class_ref = NULL;
+ if (new_ref)
+ *new_ref = gfc_copy_ref (e->ref);
+
+ for (ref = e->ref; ref; ref = ref->next)
+ {
+ if (ref->type != REF_COMPONENT)
+ continue;
+
+ if (ref->u.c.component->ts.type == BT_CLASS
+ || ref->u.c.component->ts.type == BT_DERIVED)
+ {
+ declared = ref->u.c.component->ts.u.derived;
+ if (class_ref)
+ *class_ref = ref;
+ }
+ }
+
+ if (declared == NULL)
+ declared = e->symtree->n.sym->ts.u.derived;
+
+ return declared;
+}
+
+
/* Given an EXPR_COMPCALL calling a GENERIC typebound procedure, figure out
which of the specific bindings (if any) matches the arglist and transform
the expression into a call of that binding. */
@@ -5169,6 +5266,8 @@ resolve_typebound_generic_call (gfc_expr* e, const char **name)
{
gfc_typebound_proc* genproc;
const char* genname;
+ gfc_symtree *st;
+ gfc_symbol *derived;
gcc_assert (e->expr_type == EXPR_COMPCALL);
genname = e->value.compcall.name;
@@ -5236,6 +5335,19 @@ resolve_typebound_generic_call (gfc_expr* e, const char **name)
return FAILURE;
success:
+ /* Make sure that we have the right specific instance for the name. */
+ genname = e->value.compcall.tbp->u.specific->name;
+
+ /* Is the symtree name a "unique name". */
+ if (*genname == '@')
+ genname = e->value.compcall.tbp->u.specific->n.sym->name;
+
+ derived = get_declared_from_expr (NULL, NULL, e);
+
+ st = gfc_find_typebound_proc (derived, NULL, genname, false, &e->where);
+ if (st)
+ e->value.compcall.tbp = st->n.tb;
+
return SUCCESS;
}
@@ -5343,38 +5455,6 @@ resolve_compcall (gfc_expr* e, const char **name)
}
-/* Get the ultimate declared type from an expression. In addition,
- return the last class/derived type reference and the copy of the
- reference list. */
-static gfc_symbol*
-get_declared_from_expr (gfc_ref **class_ref, gfc_ref **new_ref,
- gfc_expr *e)
-{
- gfc_symbol *declared;
- gfc_ref *ref;
-
- declared = NULL;
- *class_ref = NULL;
- *new_ref = gfc_copy_ref (e->ref);
- for (ref = *new_ref; ref; ref = ref->next)
- {
- if (ref->type != REF_COMPONENT)
- continue;
-
- if (ref->u.c.component->ts.type == BT_CLASS
- || ref->u.c.component->ts.type == BT_DERIVED)
- {
- declared = ref->u.c.component->ts.u.derived;
- *class_ref = ref;
- }
- }
-
- if (declared == NULL)
- declared = e->symtree->n.sym->ts.u.derived;
-
- return declared;
-}
-
/* Resolve a typebound function, or 'method'. First separate all
the non-CLASS references by calling resolve_compcall directly. */
@@ -5395,6 +5475,9 @@ resolve_typebound_function (gfc_expr* e)
if (st == NULL)
return resolve_compcall (e, NULL);
+ if (resolve_ref (e) == FAILURE)
+ return FAILURE;
+
/* Get the CLASS declared type. */
declared = get_declared_from_expr (&class_ref, &new_ref, e);
@@ -5416,18 +5499,16 @@ resolve_typebound_function (gfc_expr* e)
/* Treat the call as if it is a typebound procedure, in order to roll
out the correct name for the specific function. */
- resolve_compcall (e, &name);
+ if (resolve_compcall (e, &name) == FAILURE)
+ return FAILURE;
ts = e->ts;
/* Then convert the expression to a procedure pointer component call. */
e->value.function.esym = NULL;
e->symtree = st;
- if (class_ref)
- {
- gfc_free_ref_list (class_ref->next);
- e->ref = new_ref;
- }
+ if (new_ref)
+ e->ref = new_ref;
/* '$vptr' points to the vtab, which contains the procedure pointers. */
gfc_add_component_ref (e, "$vptr");
@@ -5470,6 +5551,9 @@ resolve_typebound_subroutine (gfc_code *code)
if (st == NULL)
return resolve_typebound_call (code, NULL);
+ if (resolve_ref (code->expr1) == FAILURE)
+ return FAILURE;
+
/* Get the CLASS declared type. */
declared = get_declared_from_expr (&class_ref, &new_ref, code->expr1);
@@ -5489,18 +5573,16 @@ resolve_typebound_subroutine (gfc_code *code)
if (code->expr1->value.compcall.tbp->is_generic)
genname = code->expr1->value.compcall.name;
- resolve_typebound_call (code, &name);
+ if (resolve_typebound_call (code, &name) == FAILURE)
+ return FAILURE;
ts = code->expr1->ts;
/* Then convert the expression to a procedure pointer component call. */
code->expr1->value.function.esym = NULL;
code->expr1->symtree = st;
- if (class_ref)
- {
- gfc_free_ref_list (class_ref->next);
- code->expr1->ref = new_ref;
- }
+ if (new_ref)
+ code->expr1->ref = new_ref;
/* '$vptr' points to the vtab, which contains the procedure pointers. */
gfc_add_component_ref (code->expr1, "$vptr");
@@ -6051,6 +6133,7 @@ resolve_deallocate_expr (gfc_expr *e)
bad:
gfc_error ("Allocate-object at %L must be ALLOCATABLE or a POINTER",
&e->where);
+ return FAILURE;
}
if (check_intent_in && sym->attr.intent == INTENT_IN)
@@ -6125,8 +6208,11 @@ gfc_expr_to_initialize (gfc_expr *e)
static gfc_try
conformable_arrays (gfc_expr *e1, gfc_expr *e2)
{
+ gfc_ref *tail;
+ for (tail = e2->ref; tail && tail->next; tail = tail->next);
+
/* First compare rank. */
- if (e2->ref && e1->rank != e2->ref->u.ar.as->rank)
+ if (tail && e1->rank != tail->u.ar.as->rank)
{
gfc_error ("Source-expr at %L must be scalar or have the "
"same rank as the allocate-object at %L",
@@ -6143,15 +6229,15 @@ conformable_arrays (gfc_expr *e1, gfc_expr *e2)
for (i = 0; i < e1->rank; i++)
{
- if (e2->ref->u.ar.end[i])
+ if (tail->u.ar.end[i])
{
- mpz_set (s, e2->ref->u.ar.end[i]->value.integer);
- mpz_sub (s, s, e2->ref->u.ar.start[i]->value.integer);
+ mpz_set (s, tail->u.ar.end[i]->value.integer);
+ mpz_sub (s, s, tail->u.ar.start[i]->value.integer);
mpz_add_ui (s, s, 1);
}
else
{
- mpz_set (s, e2->ref->u.ar.start[i]->value.integer);
+ mpz_set (s, tail->u.ar.start[i]->value.integer);
}
if (mpz_cmp (e1->shape[i], s) != 0)
@@ -6182,10 +6268,9 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
symbol_attribute attr;
gfc_ref *ref, *ref2;
gfc_array_ref *ar;
- gfc_symbol *sym;
+ gfc_symbol *sym = NULL;
gfc_alloc *a;
gfc_component *c;
- gfc_expr *init_e;
/* Check INTENT(IN), unless the object is a sub-component of a pointer. */
check_intent_in = 1;
@@ -6318,11 +6403,14 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
goto failure;
}
}
- else if (is_abstract&& code->ext.alloc.ts.type == BT_UNKNOWN)
+
+ /* Check F08:C629. */
+ if (is_abstract && code->ext.alloc.ts.type == BT_UNKNOWN
+ && !code->expr3)
{
gcc_assert (e->ts.type == BT_CLASS);
gfc_error ("Allocating %s of ABSTRACT base type at %L requires a "
- "type-spec or SOURCE=", sym->name, &e->where);
+ "type-spec or source-expr", sym->name, &e->where);
goto failure;
}
@@ -6333,25 +6421,26 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
goto failure;
}
- if (!code->expr3)
+ if (!code->expr3 || code->expr3->mold)
{
/* Add default initializer for those derived types that need them. */
- if (e->ts.type == BT_DERIVED
- && (init_e = gfc_default_initializer (&e->ts)))
- {
- gfc_code *init_st = gfc_get_code ();
- init_st->loc = code->loc;
- init_st->op = EXEC_INIT_ASSIGN;
- init_st->expr1 = gfc_expr_to_initialize (e);
- init_st->expr2 = init_e;
- init_st->next = code->next;
- code->next = init_st;
- }
- else if (e->ts.type == BT_CLASS
- && ((code->ext.alloc.ts.type == BT_UNKNOWN
- && (init_e = gfc_default_initializer (&CLASS_DATA (e)->ts)))
- || (code->ext.alloc.ts.type == BT_DERIVED
- && (init_e = gfc_default_initializer (&code->ext.alloc.ts)))))
+ gfc_expr *init_e = NULL;
+ gfc_typespec ts;
+
+ if (code->ext.alloc.ts.type == BT_DERIVED)
+ ts = code->ext.alloc.ts;
+ else if (code->expr3)
+ ts = code->expr3->ts;
+ else
+ ts = e->ts;
+
+ if (ts.type == BT_DERIVED)
+ init_e = gfc_default_initializer (&ts);
+ /* FIXME: Use default init of dynamic type (cf. PR 44541). */
+ else if (e->ts.type == BT_CLASS)
+ init_e = gfc_default_initializer (&ts.u.derived->components->ts);
+
+ if (init_e)
{
gfc_code *init_st = gfc_get_code ();
init_st->loc = code->loc;
@@ -6503,8 +6592,29 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
for (p = code->ext.alloc.list; p; p = p->next)
if (p->expr->symtree->n.sym->name == stat->symtree->n.sym->name)
- gfc_error ("Stat-variable at %L shall not be %sd within "
- "the same %s statement", &stat->where, fcn, fcn);
+ {
+ gfc_ref *ref1, *ref2;
+ bool found = true;
+
+ for (ref1 = p->expr->ref, ref2 = stat->ref; ref1 && ref2;
+ ref1 = ref1->next, ref2 = ref2->next)
+ {
+ if (ref1->type != REF_COMPONENT || ref2->type != REF_COMPONENT)
+ continue;
+ if (ref1->u.c.component->name != ref2->u.c.component->name)
+ {
+ found = false;
+ break;
+ }
+ }
+
+ if (found)
+ {
+ gfc_error ("Stat-variable at %L shall not be %sd within "
+ "the same %s statement", &stat->where, fcn, fcn);
+ break;
+ }
+ }
}
/* Check the errmsg variable. */
@@ -6532,8 +6642,29 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
for (p = code->ext.alloc.list; p; p = p->next)
if (p->expr->symtree->n.sym->name == errmsg->symtree->n.sym->name)
- gfc_error ("Errmsg-variable at %L shall not be %sd within "
- "the same %s statement", &errmsg->where, fcn, fcn);
+ {
+ gfc_ref *ref1, *ref2;
+ bool found = true;
+
+ for (ref1 = p->expr->ref, ref2 = errmsg->ref; ref1 && ref2;
+ ref1 = ref1->next, ref2 = ref2->next)
+ {
+ if (ref1->type != REF_COMPONENT || ref2->type != REF_COMPONENT)
+ continue;
+ if (ref1->u.c.component->name != ref2->u.c.component->name)
+ {
+ found = false;
+ break;
+ }
+ }
+
+ if (found)
+ {
+ gfc_error ("Errmsg-variable at %L shall not be %sd within "
+ "the same %s statement", &errmsg->where, fcn, fcn);
+ break;
+ }
+ }
}
/* Check that an allocate-object appears only once in the statement.
@@ -7137,7 +7268,7 @@ resolve_select_type (gfc_code *code)
gfc_namespace *ns;
int error = 0;
- ns = code->ext.ns;
+ ns = code->ext.block.ns;
gfc_resolve (ns);
/* Check for F03:C813. */
@@ -7224,6 +7355,7 @@ resolve_select_type (gfc_code *code)
else
ns->code->next = new_st;
code->op = EXEC_BLOCK;
+ code->ext.block.assoc = NULL;
code->expr1 = code->expr2 = NULL;
code->block = NULL;
@@ -7967,10 +8099,11 @@ gfc_resolve_forall (gfc_code *code, gfc_namespace *ns, int forall_save)
static void
resolve_block_construct (gfc_code* code)
{
- /* Eventually, we may want to do some checks here or handle special stuff.
- But so far the only thing we can do is resolving the local namespace. */
+ /* For an ASSOCIATE block, the associations (and their targets) are already
+ resolved during gfc_resolve_symbol. */
- gfc_resolve (code->ext.ns);
+ /* Resolve the BLOCK's namespace. */
+ gfc_resolve (code->ext.block.ns);
}
@@ -8291,7 +8424,7 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
gfc_resolve_omp_do_blocks (code, ns);
break;
case EXEC_SELECT_TYPE:
- gfc_current_ns = code->ext.ns;
+ gfc_current_ns = code->ext.block.ns;
gfc_resolve_blocks (code->block, gfc_current_ns);
gfc_current_ns = ns;
break;
@@ -8455,7 +8588,7 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
break;
case EXEC_BLOCK:
- gfc_resolve (code->ext.ns);
+ gfc_resolve (code->ext.block.ns);
break;
case EXEC_DO:
@@ -10694,6 +10827,14 @@ resolve_fl_derived (gfc_symbol *sym)
return FAILURE;
}
+ /* F2008, C448. */
+ if (c->attr.contiguous && (!c->attr.dimension || !c->attr.pointer))
+ {
+ gfc_error ("Component '%s' at %L has the CONTIGUOUS attribute but "
+ "is not an array pointer", c->name, &c->loc);
+ return FAILURE;
+ }
+
if (c->attr.proc_pointer && c->ts.interface)
{
if (c->ts.interface->attr.procedure && !sym->attr.vtype)
@@ -10760,7 +10901,7 @@ resolve_fl_derived (gfc_symbol *sym)
c->ts.u.cl = cl;
}
}
- else if (c->ts.interface->name[0] != '\0' && !sym->attr.vtype)
+ else if (!sym->attr.vtype && c->ts.interface->name[0] != '\0')
{
gfc_error ("Interface '%s' of procedure pointer component "
"'%s' at %L must be explicit", c->ts.interface->name,
@@ -11004,6 +11145,7 @@ resolve_fl_derived (gfc_symbol *sym)
/* If this is a non-ABSTRACT type extending an ABSTRACT one, ensure that
all DEFERRED bindings are overridden. */
if (super_type && super_type->attr.abstract && !sym->attr.abstract
+ && !sym->attr.is_class
&& ensure_not_abstract (sym, super_type) == FAILURE)
return FAILURE;
@@ -11265,6 +11407,7 @@ resolve_symbol (gfc_symbol *sym)
sym->attr.pure = ifc->attr.pure;
sym->attr.elemental = ifc->attr.elemental;
sym->attr.dimension = ifc->attr.dimension;
+ sym->attr.contiguous = ifc->attr.contiguous;
sym->attr.recursive = ifc->attr.recursive;
sym->attr.always_explicit = ifc->attr.always_explicit;
sym->attr.ext_attr |= ifc->attr.ext_attr;
@@ -11297,6 +11440,31 @@ resolve_symbol (gfc_symbol *sym)
}
}
+ if (sym->attr.is_protected && !sym->attr.proc_pointer
+ && (sym->attr.procedure || sym->attr.external))
+ {
+ if (sym->attr.external)
+ gfc_error ("PROTECTED attribute conflicts with EXTERNAL attribute "
+ "at %L", &sym->declared_at);
+ else
+ gfc_error ("PROCEDURE attribute conflicts with PROTECTED attribute "
+ "at %L", &sym->declared_at);
+
+ return;
+ }
+
+
+ /* F2008, C530. */
+ if (sym->attr.contiguous
+ && (!sym->attr.dimension || (sym->as->type != AS_ASSUMED_SHAPE
+ && !sym->attr.pointer)))
+ {
+ gfc_error ("'%s' at %L has the CONTIGUOUS attribute but is not an "
+ "array pointer or an assumed-shape array", sym->name,
+ &sym->declared_at);
+ return;
+ }
+
if (sym->attr.flavor == FL_DERIVED && resolve_fl_derived (sym) == FAILURE)
return;
@@ -11307,7 +11475,6 @@ resolve_symbol (gfc_symbol *sym)
can. */
mp_flag = (sym->result != NULL && sym->result != sym);
-
/* Make sure that the intrinsic is consistent with its internal
representation. This needs to be done before assigning a default
type to avoid spurious warnings. */
@@ -11315,6 +11482,18 @@ resolve_symbol (gfc_symbol *sym)
&& resolve_intrinsic (sym, &sym->declared_at) == FAILURE)
return;
+ /* For associate names, resolve corresponding expression and make sure
+ they get their type-spec set this way. */
+ if (sym->assoc)
+ {
+ gcc_assert (sym->attr.flavor == FL_VARIABLE);
+ if (gfc_resolve_expr (sym->assoc->target) != SUCCESS)
+ return;
+
+ sym->ts = sym->assoc->target->ts;
+ gcc_assert (sym->ts.type != BT_UNKNOWN);
+ }
+
/* Assign default type to symbols that need one and don't have one. */
if (sym->ts.type == BT_UNKNOWN)
{
@@ -11344,6 +11523,7 @@ resolve_symbol (gfc_symbol *sym)
sym->attr.dimension = sym->result->attr.dimension;
sym->attr.pointer = sym->result->attr.pointer;
sym->attr.allocatable = sym->result->attr.allocatable;
+ sym->attr.contiguous = sym->result->attr.contiguous;
}
}
}
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 7b4ab244136..a8ab2353e85 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -390,7 +390,8 @@ gfc_release_include_path (void)
static FILE *
-open_included_file (const char *name, gfc_directorylist *list, bool module)
+open_included_file (const char *name, gfc_directorylist *list,
+ bool module, bool system)
{
char *fullname;
gfc_directorylist *p;
@@ -407,7 +408,12 @@ open_included_file (const char *name, gfc_directorylist *list, bool module)
f = gfc_open_file (fullname);
if (f != NULL)
- return f;
+ {
+ if (gfc_cpp_makedep ())
+ gfc_cpp_add_dep (fullname, system);
+
+ return f;
+ }
}
return NULL;
@@ -421,28 +427,37 @@ open_included_file (const char *name, gfc_directorylist *list, bool module)
FILE *
gfc_open_included_file (const char *name, bool include_cwd, bool module)
{
- FILE *f;
+ FILE *f = NULL;
- if (IS_ABSOLUTE_PATH (name))
- return gfc_open_file (name);
-
- if (include_cwd)
+ if (IS_ABSOLUTE_PATH (name) || include_cwd)
{
f = gfc_open_file (name);
- if (f != NULL)
- return f;
+ if (f && gfc_cpp_makedep ())
+ gfc_cpp_add_dep (name, false);
}
- return open_included_file (name, include_dirs, module);
+ if (!f)
+ f = open_included_file (name, include_dirs, module, false);
+
+ return f;
}
FILE *
gfc_open_intrinsic_module (const char *name)
{
+ FILE *f = NULL;
+
if (IS_ABSOLUTE_PATH (name))
- return gfc_open_file (name);
+ {
+ f = gfc_open_file (name);
+ if (f && gfc_cpp_makedep ())
+ gfc_cpp_add_dep (name, true);
+ }
+
+ if (!f)
+ f = open_included_file (name, intrinsic_modules_dirs, true, true);
- return open_included_file (name, intrinsic_modules_dirs, true);
+ return f;
}
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 743c4632986..7356625cf41 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4589,9 +4589,11 @@ gfc_simplify_selected_int_kind (gfc_expr *e)
gfc_expr *
-gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q)
+gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q, gfc_expr *rdx)
{
- int range, precision, i, kind, found_precision, found_range;
+ int range, precision, radix, i, kind, found_precision, found_range,
+ found_radix;
+ locus *loc = &gfc_current_locus;
if (p == NULL)
precision = 0;
@@ -4600,6 +4602,7 @@ gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q)
if (p->expr_type != EXPR_CONSTANT
|| gfc_extract_int (p, &precision) != NULL)
return NULL;
+ loc = &p->where;
}
if (q == NULL)
@@ -4609,11 +4612,27 @@ gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q)
if (q->expr_type != EXPR_CONSTANT
|| gfc_extract_int (q, &range) != NULL)
return NULL;
+
+ if (!loc)
+ loc = &q->where;
+ }
+
+ if (rdx == NULL)
+ radix = 0;
+ else
+ {
+ if (rdx->expr_type != EXPR_CONSTANT
+ || gfc_extract_int (rdx, &radix) != NULL)
+ return NULL;
+
+ if (!loc)
+ loc = &rdx->where;
}
kind = INT_MAX;
found_precision = 0;
found_range = 0;
+ found_radix = 0;
for (i = 0; gfc_real_kinds[i].kind != 0; i++)
{
@@ -4623,23 +4642,30 @@ gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q)
if (gfc_real_kinds[i].range >= range)
found_range = 1;
+ if (gfc_real_kinds[i].radix >= radix)
+ found_radix = 1;
+
if (gfc_real_kinds[i].precision >= precision
- && gfc_real_kinds[i].range >= range && gfc_real_kinds[i].kind < kind)
+ && gfc_real_kinds[i].range >= range
+ && gfc_real_kinds[i].radix >= radix && gfc_real_kinds[i].kind < kind)
kind = gfc_real_kinds[i].kind;
}
if (kind == INT_MAX)
{
- kind = 0;
-
- if (!found_precision)
+ if (found_radix && found_range && !found_precision)
kind = -1;
- if (!found_range)
- kind -= 2;
+ else if (found_radix && found_precision && !found_range)
+ kind = -2;
+ else if (found_radix && !found_precision && !found_range)
+ kind = -3;
+ else if (found_radix)
+ kind = -4;
+ else
+ kind = -5;
}
- return gfc_get_int_expr (gfc_default_integer_kind,
- p ? &p->where : &q->where, kind);
+ return gfc_get_int_expr (gfc_default_integer_kind, loc, kind);
}
diff --git a/gcc/fortran/st.c b/gcc/fortran/st.c
index ffef22d1140..f9ad5d82793 100644
--- a/gcc/fortran/st.c
+++ b/gcc/fortran/st.c
@@ -116,7 +116,8 @@ gfc_free_statement (gfc_code *p)
break;
case EXEC_BLOCK:
- gfc_free_namespace (p->ext.ns);
+ gfc_free_namespace (p->ext.block.ns);
+ gfc_free_association_list (p->ext.block.assoc);
break;
case EXEC_COMPCALL:
@@ -231,3 +232,15 @@ gfc_free_statements (gfc_code *p)
}
}
+
+/* Free an association list (of an ASSOCIATE statement). */
+
+void
+gfc_free_association_list (gfc_association_list* assoc)
+{
+ if (!assoc)
+ return;
+
+ gfc_free_association_list (assoc->next);
+ gfc_free (assoc);
+}
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index b436de5e2af..df6ada963c3 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -372,7 +372,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
*cray_pointee = "CRAY POINTEE", *data = "DATA", *value = "VALUE",
*volatile_ = "VOLATILE", *is_protected = "PROTECTED",
*is_bind_c = "BIND(C)", *procedure = "PROCEDURE",
- *asynchronous = "ASYNCHRONOUS", *codimension = "CODIMENSION";
+ *asynchronous = "ASYNCHRONOUS", *codimension = "CODIMENSION",
+ *contiguous = "CONTIGUOUS";
static const char *threadprivate = "THREADPRIVATE";
const char *a1, *a2;
@@ -518,6 +519,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (cray_pointer, cray_pointee);
conf (cray_pointer, dimension);
conf (cray_pointer, codimension);
+ conf (cray_pointer, contiguous);
conf (cray_pointer, pointer);
conf (cray_pointer, target);
conf (cray_pointer, allocatable);
@@ -529,6 +531,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (cray_pointer, entry);
conf (cray_pointee, allocatable);
+ conf (cray_pointer, contiguous);
conf (cray_pointer, codimension);
conf (cray_pointee, intent);
conf (cray_pointee, optional);
@@ -545,7 +548,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (data, function);
conf (data, result);
conf (data, allocatable);
- conf (data, use_assoc);
conf (value, pointer)
conf (value, allocatable)
@@ -567,7 +569,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
}
conf (is_protected, intrinsic)
- conf (is_protected, external)
conf (is_protected, in_common)
conf (asynchronous, intrinsic)
@@ -587,7 +588,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (procedure, dimension)
conf (procedure, codimension)
conf (procedure, intrinsic)
- conf (procedure, is_protected)
conf (procedure, target)
conf (procedure, value)
conf (procedure, volatile_)
@@ -616,6 +616,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (dummy);
conf2 (volatile_);
conf2 (asynchronous);
+ conf2 (contiguous);
conf2 (pointer);
conf2 (is_protected);
conf2 (target);
@@ -723,6 +724,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (function);
conf2 (subroutine);
conf2 (entry);
+ conf2 (contiguous);
conf2 (pointer);
conf2 (is_protected);
conf2 (target);
@@ -931,6 +933,18 @@ gfc_add_dimension (symbol_attribute *attr, const char *name, locus *where)
gfc_try
+gfc_add_contiguous (symbol_attribute *attr, const char *name, locus *where)
+{
+
+ if (check_used (attr, name, where))
+ return FAILURE;
+
+ attr->contiguous = 1;
+ return check_conflict (attr, name, where);
+}
+
+
+gfc_try
gfc_add_external (symbol_attribute *attr, locus *where)
{
@@ -1718,6 +1732,8 @@ gfc_copy_attr (symbol_attribute *dest, symbol_attribute *src, locus *where)
goto fail;
if (src->codimension && gfc_add_codimension (dest, NULL, where) == FAILURE)
goto fail;
+ if (src->contiguous && gfc_add_contiguous (dest, NULL, where) == FAILURE)
+ goto fail;
if (src->optional && gfc_add_optional (dest, where) == FAILURE)
goto fail;
if (src->pointer && gfc_add_pointer (dest, where) == FAILURE)
@@ -2515,6 +2531,7 @@ gfc_new_symbol (const char *name, gfc_namespace *ns)
/* Clear the ptrs we may need. */
p->common_block = NULL;
p->f2k_derived = NULL;
+ p->assoc = NULL;
return p;
}
@@ -4593,12 +4610,14 @@ gfc_check_symbol_typed (gfc_symbol* sym, gfc_namespace* ns,
list and marked `error' until symbols are committed. */
gfc_typebound_proc*
-gfc_get_typebound_proc (void)
+gfc_get_typebound_proc (gfc_typebound_proc *tb0)
{
gfc_typebound_proc *result;
tentative_tbp *list_node;
result = XCNEW (gfc_typebound_proc);
+ if (tb0)
+ *result = *tb0;
result->error = 1;
list_node = XCNEW (tentative_tbp);
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 7d7b3a36839..7eb8e755785 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -285,7 +285,9 @@ gfc_conv_descriptor_stride_get (tree desc, tree dim)
tree type = TREE_TYPE (desc);
gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
if (integer_zerop (dim)
- && GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ALLOCATABLE)
+ && (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ALLOCATABLE
+ ||GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE_CONT
+ ||GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER_CONT))
return gfc_index_one_node;
return gfc_conv_descriptor_stride (desc, dim);
@@ -5522,6 +5524,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,
ultimate_ptr_comp = false;
ultimate_alloc_comp = false;
+
for (ref = expr->ref; ref; ref = ref->next)
{
if (ref->next == NULL)
@@ -5608,7 +5611,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,
contiguous = g77 && !this_array_result && contiguous;
/* There is no need to pack and unpack the array, if it is contiguous
- and not deferred or assumed shape. */
+ and not a deferred- or assumed-shape array, or if it is simply
+ contiguous. */
no_pack = ((sym && sym->as
&& !sym->attr.pointer
&& sym->as->type != AS_DEFERRED
@@ -5616,7 +5620,9 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,
||
(ref && ref->u.ar.as
&& ref->u.ar.as->type != AS_DEFERRED
- && ref->u.ar.as->type != AS_ASSUMED_SHAPE));
+ && ref->u.ar.as->type != AS_ASSUMED_SHAPE)
+ ||
+ gfc_is_simply_contiguous (expr, false));
no_pack = contiguous && no_pack;
@@ -5680,9 +5686,24 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,
gfc_add_expr_to_block (&se->post, tmp);
}
- if (g77)
+ if (g77 || (fsym && fsym->attr.contiguous
+ && !gfc_is_simply_contiguous (expr, false)))
{
+ tree origptr = NULL_TREE;
+
desc = se->expr;
+
+ /* For contiguous arrays, save the original value of the descriptor. */
+ if (!g77)
+ {
+ origptr = gfc_create_var (pvoid_type_node, "origptr");
+ tmp = build_fold_indirect_ref_loc (input_location, desc);
+ tmp = gfc_conv_array_data (tmp);
+ tmp = fold_build2 (MODIFY_EXPR, TREE_TYPE (origptr), origptr,
+ fold_convert (TREE_TYPE (origptr), tmp));
+ gfc_add_expr_to_block (&se->pre, tmp);
+ }
+
/* Repack the array. */
if (gfc_option.warn_array_temp)
{
@@ -5706,7 +5727,15 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,
ptr = gfc_evaluate_now (ptr, &se->pre);
- se->expr = ptr;
+ /* Use the packed data for the actual argument, except for contiguous arrays,
+ where the descriptor's data component is set. */
+ if (g77)
+ se->expr = ptr;
+ else
+ {
+ tmp = build_fold_indirect_ref_loc (input_location, desc);
+ gfc_conv_descriptor_data_set (&se->pre, tmp, ptr);
+ }
if (gfc_option.rtcheck & GFC_RTCHECK_ARRAY_TEMPS)
{
@@ -5768,6 +5797,14 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,
gfc_add_block_to_block (&block, &se->post);
gfc_init_block (&se->post);
+
+ /* Reset the descriptor pointer. */
+ if (!g77)
+ {
+ tmp = build_fold_indirect_ref_loc (input_location, desc);
+ gfc_conv_descriptor_data_set (&se->post, tmp, origptr);
+ }
+
gfc_add_block_to_block (&se->post, &block);
}
}
@@ -5938,6 +5975,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_loopinfo loop;
stmtblock_t fnblock;
stmtblock_t loopbody;
+ tree decl_type;
tree tmp;
tree comp;
tree dcmp;
@@ -5951,21 +5989,28 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_init_block (&fnblock);
- if (POINTER_TYPE_P (TREE_TYPE (decl)) && rank != 0)
+ decl_type = TREE_TYPE (decl);
+
+ if ((POINTER_TYPE_P (decl_type) && rank != 0)
+ || (TREE_CODE (decl_type) == REFERENCE_TYPE && rank == 0))
+
decl = build_fold_indirect_ref_loc (input_location,
decl);
+ /* Just in case in gets dereferenced. */
+ decl_type = TREE_TYPE (decl);
+
/* If this an array of derived types with allocatable components
build a loop and recursively call this function. */
- if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- || GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
+ if (TREE_CODE (decl_type) == ARRAY_TYPE
+ || GFC_DESCRIPTOR_TYPE_P (decl_type))
{
tmp = gfc_conv_array_data (decl);
var = build_fold_indirect_ref_loc (input_location,
tmp);
/* Get the number of elements - 1 and set the counter. */
- if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
+ if (GFC_DESCRIPTOR_TYPE_P (decl_type))
{
/* Use the descriptor for an allocatable array. Since this
is a full array reference, we only need the descriptor
@@ -5981,7 +6026,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
else
{
/* Otherwise use the TYPE_DOMAIN information. */
- tmp = array_type_nelts (TREE_TYPE (decl));
+ tmp = array_type_nelts (decl_type);
tmp = fold_convert (gfc_array_index_type, tmp);
}
@@ -5998,7 +6043,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
{
if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dest)))
{
- tmp = gfc_duplicate_allocatable (dest, decl, TREE_TYPE(decl), rank);
+ tmp = gfc_duplicate_allocatable (dest, decl, decl_type, rank);
gfc_add_expr_to_block (&fnblock, tmp);
}
tmp = build_fold_indirect_ref_loc (input_location,
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 224474aeff2..1c7226c41e6 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -612,8 +612,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
void
gfc_allocate_lang_decl (tree decl)
{
- DECL_LANG_SPECIFIC (decl) = (struct lang_decl *)
- ggc_alloc_cleared (sizeof (struct lang_decl));
+ DECL_LANG_SPECIFIC (decl) = ggc_alloc_cleared_lang_decl(sizeof
+ (struct lang_decl));
}
/* Remember a symbol to generate initialization/cleanup code at function
@@ -1213,7 +1213,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
/* Create variables to hold the non-constant bits of array info. */
gfc_build_qualified_array (decl, sym);
- if ((sym->attr.allocatable || !sym->attr.dummy) && !sym->attr.pointer)
+ if (sym->attr.contiguous
+ || ((sym->attr.allocatable || !sym->attr.dummy) && !sym->attr.pointer))
GFC_DECL_PACKED_ARRAY (decl) = 1;
}
@@ -2424,26 +2425,26 @@ gfc_build_intrinsic_function_decls (void)
gfor_fndecl_string_len_trim =
gfc_build_library_function_decl (get_identifier (PREFIX("string_len_trim")),
- gfc_int4_type_node, 2,
+ gfc_charlen_type_node, 2,
gfc_charlen_type_node, pchar1_type_node);
gfor_fndecl_string_index =
gfc_build_library_function_decl (get_identifier (PREFIX("string_index")),
- gfc_int4_type_node, 5,
+ gfc_charlen_type_node, 5,
gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node,
gfc_logical4_type_node);
gfor_fndecl_string_scan =
gfc_build_library_function_decl (get_identifier (PREFIX("string_scan")),
- gfc_int4_type_node, 5,
+ gfc_charlen_type_node, 5,
gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node,
gfc_logical4_type_node);
gfor_fndecl_string_verify =
gfc_build_library_function_decl (get_identifier (PREFIX("string_verify")),
- gfc_int4_type_node, 5,
+ gfc_charlen_type_node, 5,
gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node,
gfc_logical4_type_node);
@@ -2611,9 +2612,10 @@ gfc_build_intrinsic_function_decls (void)
gfor_fndecl_sr_kind =
gfc_build_library_function_decl (get_identifier
- (PREFIX("selected_real_kind")),
- gfc_int4_type_node, 2,
- pvoid_type_node, pvoid_type_node);
+ (PREFIX("selected_real_kind2008")),
+ gfc_int4_type_node, 3,
+ pvoid_type_node, pvoid_type_node,
+ pvoid_type_node);
/* Power functions. */
{
@@ -3410,7 +3412,7 @@ gfc_find_module (const char *name)
htab_hash_string (name), INSERT);
if (*slot == NULL)
{
- struct module_htab_entry *entry = GGC_CNEW (struct module_htab_entry);
+ struct module_htab_entry *entry = ggc_alloc_cleared_module_htab_entry ();
entry->name = gfc_get_string (name);
entry->decls = htab_create_ggc (10, module_htab_decls_hash,
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 6c5c3286eb8..692b3e2f846 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1718,6 +1718,7 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
new_sym->as = gfc_copy_array_spec (sym->as);
new_sym->attr.referenced = 1;
new_sym->attr.dimension = sym->attr.dimension;
+ new_sym->attr.contiguous = sym->attr.contiguous;
new_sym->attr.codimension = sym->attr.codimension;
new_sym->attr.pointer = sym->attr.pointer;
new_sym->attr.allocatable = sym->attr.allocatable;
@@ -2492,12 +2493,14 @@ gfc_conv_derived_to_class (gfc_se *parmse, gfc_expr *e,
ss = gfc_walk_expr (e);
if (ss == gfc_ss_terminator)
{
+ parmse->ss = NULL;
gfc_conv_expr_reference (parmse, e);
tmp = fold_convert (TREE_TYPE (ctree), parmse->expr);
gfc_add_modify (&parmse->pre, ctree, tmp);
}
else
{
+ parmse->ss = ss;
gfc_conv_expr (parmse, e);
gfc_add_modify (&parmse->pre, ctree, parmse->expr);
}
@@ -4867,41 +4870,40 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
}
-/* Try to translate array(:) = func (...), where func is a transformational
- array function, without using a temporary. Returns NULL is this isn't the
- case. */
+/* There are quite a lot of restrictions on the optimisation in using an
+ array function assign without a temporary. */
-static tree
-gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
+static bool
+arrayfunc_assign_needs_temporary (gfc_expr * expr1, gfc_expr * expr2)
{
- gfc_se se;
- gfc_ss *ss;
gfc_ref * ref;
bool seen_array_ref;
bool c = false;
- gfc_component *comp = NULL;
+ gfc_symbol *sym = expr1->symtree->n.sym;
/* The caller has already checked rank>0 and expr_type == EXPR_FUNCTION. */
if (expr2->value.function.isym && !gfc_is_intrinsic_libcall (expr2))
- return NULL;
+ return true;
- /* Elemental functions don't need a temporary anyway. */
+ /* Elemental functions are scalarized so that they don't need a
+ temporary in gfc_trans_assignment_1, so return a true. Otherwise,
+ they would need special treatment in gfc_trans_arrayfunc_assign. */
if (expr2->value.function.esym != NULL
&& expr2->value.function.esym->attr.elemental)
- return NULL;
+ return true;
- /* Fail if rhs is not FULL or a contiguous section. */
+ /* Need a temporary if rhs is not FULL or a contiguous section. */
if (expr1->ref && !(gfc_full_array_ref_p (expr1->ref, &c) || c))
- return NULL;
+ return true;
- /* Fail if EXPR1 can't be expressed as a descriptor. */
+ /* Need a temporary if EXPR1 can't be expressed as a descriptor. */
if (gfc_ref_needs_temporary_p (expr1->ref))
- return NULL;
+ return true;
/* Functions returning pointers need temporaries. */
if (expr2->symtree->n.sym->attr.pointer
|| expr2->symtree->n.sym->attr.allocatable)
- return NULL;
+ return true;
/* Character array functions need temporaries unless the
character lengths are the same. */
@@ -4909,15 +4911,15 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
{
if (expr1->ts.u.cl->length == NULL
|| expr1->ts.u.cl->length->expr_type != EXPR_CONSTANT)
- return NULL;
+ return true;
if (expr2->ts.u.cl->length == NULL
|| expr2->ts.u.cl->length->expr_type != EXPR_CONSTANT)
- return NULL;
+ return true;
if (mpz_cmp (expr1->ts.u.cl->length->value.integer,
expr2->ts.u.cl->length->value.integer) != 0)
- return NULL;
+ return true;
}
/* Check that no LHS component references appear during an array
@@ -4931,7 +4933,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
if (ref->type == REF_ARRAY)
seen_array_ref= true;
else if (ref->type == REF_COMPONENT && seen_array_ref)
- return NULL;
+ return true;
}
/* Check for a dependency. */
@@ -4939,6 +4941,62 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
expr2->value.function.esym,
expr2->value.function.actual,
NOT_ELEMENTAL))
+ return true;
+
+ /* If we have reached here with an intrinsic function, we do not
+ need a temporary. */
+ if (expr2->value.function.isym)
+ return false;
+
+ /* If the LHS is a dummy, we need a temporary if it is not
+ INTENT(OUT). */
+ if (sym->attr.dummy && sym->attr.intent != INTENT_OUT)
+ return true;
+
+ /* A PURE function can unconditionally be called without a temporary. */
+ if (expr2->value.function.esym != NULL
+ && expr2->value.function.esym->attr.pure)
+ return false;
+
+ /* TODO a function that could correctly be declared PURE but is not
+ could do with returning false as well. */
+
+ if (!sym->attr.use_assoc
+ && !sym->attr.in_common
+ && !sym->attr.pointer
+ && !sym->attr.target
+ && expr2->value.function.esym)
+ {
+ /* A temporary is not needed if the function is not contained and
+ the variable is local or host associated and not a pointer or
+ a target. */
+ if (!expr2->value.function.esym->attr.contained)
+ return false;
+
+ /* A temporary is not needed if the variable is local and not
+ a pointer, a target or a result. */
+ if (sym->ns->parent
+ && expr2->value.function.esym->ns == sym->ns->parent)
+ return false;
+ }
+
+ /* Default to temporary use. */
+ return true;
+}
+
+
+/* Try to translate array(:) = func (...), where func is a transformational
+ array function, without using a temporary. Returns NULL if this isn't the
+ case. */
+
+static tree
+gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
+{
+ gfc_se se;
+ gfc_ss *ss;
+ gfc_component *comp = NULL;
+
+ if (arrayfunc_assign_needs_temporary (expr1, expr2))
return NULL;
/* The frontend doesn't seem to bother filling in expr->symtree for intrinsic
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 94dcc296dbf..06fd538d775 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -50,14 +50,12 @@ typedef struct GTY(()) gfc_intrinsic_map_t {
/* Enum value from the "language-independent", aka C-centric, part
of gcc, or END_BUILTINS of no such value set. */
- enum built_in_function code_r4;
- enum built_in_function code_r8;
- enum built_in_function code_r10;
- enum built_in_function code_r16;
- enum built_in_function code_c4;
- enum built_in_function code_c8;
- enum built_in_function code_c10;
- enum built_in_function code_c16;
+ enum built_in_function float_built_in;
+ enum built_in_function double_built_in;
+ enum built_in_function long_double_built_in;
+ enum built_in_function complex_float_built_in;
+ enum built_in_function complex_double_built_in;
+ enum built_in_function complex_long_double_built_in;
/* True if the naming pattern is to prepend "c" for complex and
append "f" for kind=4. False if the naming pattern is to
@@ -90,28 +88,33 @@ gfc_intrinsic_map_t;
except for atan2. */
#define DEFINE_MATH_BUILTIN(ID, NAME, ARGTYPE) \
{ GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, \
- BUILT_IN_ ## ID ## L, BUILT_IN_ ## ID ## L, (enum built_in_function) 0, \
- (enum built_in_function) 0, (enum built_in_function) 0, \
- (enum built_in_function) 0, true, false, true, NAME, NULL_TREE, \
- NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, \
- NULL_TREE},
+ BUILT_IN_ ## ID ## L, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+ true, false, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, \
+ NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
#define DEFINE_MATH_BUILTIN_C(ID, NAME, ARGTYPE) \
{ GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, \
- BUILT_IN_ ## ID ## L, BUILT_IN_ ## ID ## L, BUILT_IN_C ## ID ## F, \
- BUILT_IN_C ## ID, BUILT_IN_C ## ID ## L, BUILT_IN_C ## ID ## L, true, \
- true, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, \
- NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
+ BUILT_IN_ ## ID ## L, BUILT_IN_C ## ID ## F, BUILT_IN_C ## ID, \
+ BUILT_IN_C ## ID ## L, true, true, true, NAME, NULL_TREE, NULL_TREE, \
+ NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
#define LIB_FUNCTION(ID, NAME, HAVE_COMPLEX) \
- { GFC_ISYM_ ## ID, END_BUILTINS, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
- END_BUILTINS, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+ { GFC_ISYM_ ## ID, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+ END_BUILTINS, END_BUILTINS, END_BUILTINS, \
false, HAVE_COMPLEX, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, \
NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE }
+#define OTHER_BUILTIN(ID, NAME, TYPE) \
+ { GFC_ISYM_NONE, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, \
+ BUILT_IN_ ## ID ## L, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+ true, false, true, NAME, NULL_TREE, NULL_TREE, \
+ NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
+
static GTY(()) gfc_intrinsic_map_t gfc_intrinsic_map[] =
{
- /* Functions built into gcc itself. */
+ /* Functions built into gcc itself (DEFINE_MATH_BUILTIN and
+ DEFINE_MATH_BUILTIN_C), then the built-ins that don't correspond
+ to any GFC_ISYM id directly, which use the OTHER_BUILTIN macro. */
#include "mathbuiltins.def"
/* Functions in libgfortran. */
@@ -121,30 +124,45 @@ static GTY(()) gfc_intrinsic_map_t gfc_intrinsic_map[] =
LIB_FUNCTION (NONE, NULL, false)
};
+#undef OTHER_BUILTIN
#undef LIB_FUNCTION
#undef DEFINE_MATH_BUILTIN
#undef DEFINE_MATH_BUILTIN_C
-/* Structure for storing components of a floating number to be used by
- elemental functions to manipulate reals. */
-typedef struct
+
+enum rounding_mode { RND_ROUND, RND_TRUNC, RND_CEIL, RND_FLOOR };
+
+
+/* Find the correct variant of a given builtin from its argument. */
+static tree
+builtin_decl_for_precision (enum built_in_function base_built_in,
+ int precision)
{
- tree arg; /* Variable tree to view convert to integer. */
- tree expn; /* Variable tree to save exponent. */
- tree frac; /* Variable tree to save fraction. */
- tree smask; /* Constant tree of sign's mask. */
- tree emask; /* Constant tree of exponent's mask. */
- tree fmask; /* Constant tree of fraction's mask. */
- tree edigits; /* Constant tree of the number of exponent bits. */
- tree fdigits; /* Constant tree of the number of fraction bits. */
- tree f1; /* Constant tree of the f1 defined in the real model. */
- tree bias; /* Constant tree of the bias of exponent in the memory. */
- tree type; /* Type tree of arg1. */
- tree mtype; /* Type tree of integer type. Kind is that of arg1. */
+ int i = END_BUILTINS;
+
+ gfc_intrinsic_map_t *m;
+ for (m = gfc_intrinsic_map; m->double_built_in != base_built_in ; m++)
+ ;
+
+ if (precision == TYPE_PRECISION (float_type_node))
+ i = m->float_built_in;
+ else if (precision == TYPE_PRECISION (double_type_node))
+ i = m->double_built_in;
+ else if (precision == TYPE_PRECISION (long_double_type_node))
+ i = m->long_double_built_in;
+
+ return (i == END_BUILTINS ? NULL_TREE : built_in_decls[i]);
+}
+
+
+static tree
+builtin_decl_for_float_kind (enum built_in_function double_built_in, int kind)
+{
+ int i = gfc_validate_kind (BT_REAL, kind, false);
+ return builtin_decl_for_precision (double_built_in,
+ gfc_real_kinds[i].mode_precision);
}
-real_compnt_info;
-enum rounding_mode { RND_ROUND, RND_TRUNC, RND_CEIL, RND_FLOOR };
/* Evaluate the arguments to an intrinsic function. The value
of NARGS may be less than the actual number of arguments in EXPR
@@ -353,14 +371,10 @@ build_round_expr (tree arg, tree restype)
gcc_unreachable ();
/* Now, depending on the argument type, we choose between intrinsics. */
- if (argprec == TYPE_PRECISION (float_type_node))
- fn = built_in_decls[longlong ? BUILT_IN_LLROUNDF : BUILT_IN_LROUNDF];
- else if (argprec == TYPE_PRECISION (double_type_node))
- fn = built_in_decls[longlong ? BUILT_IN_LLROUND : BUILT_IN_LROUND];
- else if (argprec == TYPE_PRECISION (long_double_type_node))
- fn = built_in_decls[longlong ? BUILT_IN_LLROUNDL : BUILT_IN_LROUNDL];
+ if (longlong)
+ fn = builtin_decl_for_precision (BUILT_IN_LLROUND, argprec);
else
- gcc_unreachable ();
+ fn = builtin_decl_for_precision (BUILT_IN_LROUND, argprec);
return fold_convert (restype, build_call_expr_loc (input_location,
fn, 1, arg));
@@ -416,6 +430,7 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum rounding_mode op)
tree arg[2];
tree tmp;
tree cond;
+ tree decl;
mpfr_t huge;
int n, nargs;
int kind;
@@ -423,44 +438,16 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum rounding_mode op)
kind = expr->ts.kind;
nargs = gfc_intrinsic_argument_list_length (expr);
- n = END_BUILTINS;
+ decl = NULL_TREE;
/* We have builtin functions for some cases. */
switch (op)
{
case RND_ROUND:
- switch (kind)
- {
- case 4:
- n = BUILT_IN_ROUNDF;
- break;
-
- case 8:
- n = BUILT_IN_ROUND;
- break;
-
- case 10:
- case 16:
- n = BUILT_IN_ROUNDL;
- break;
- }
+ decl = builtin_decl_for_float_kind (BUILT_IN_ROUND, kind);
break;
case RND_TRUNC:
- switch (kind)
- {
- case 4:
- n = BUILT_IN_TRUNCF;
- break;
-
- case 8:
- n = BUILT_IN_TRUNC;
- break;
-
- case 10:
- case 16:
- n = BUILT_IN_TRUNCL;
- break;
- }
+ decl = builtin_decl_for_float_kind (BUILT_IN_TRUNC, kind);
break;
default:
@@ -472,11 +459,9 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum rounding_mode op)
gfc_conv_intrinsic_function_args (se, expr, arg, nargs);
/* Use a builtin function if one exists. */
- if (n != END_BUILTINS)
+ if (decl != NULL_TREE)
{
- tmp = built_in_decls[n];
- se->expr = build_call_expr_loc (input_location,
- tmp, 1, arg[0]);
+ se->expr = build_call_expr_loc (input_location, decl, 1, arg[0]);
return;
}
@@ -580,24 +565,30 @@ gfc_build_intrinsic_lib_fndecls (void)
gfc_intrinsic_map_t *m;
/* Add GCC builtin functions. */
- for (m = gfc_intrinsic_map; m->id != GFC_ISYM_NONE; m++)
+ for (m = gfc_intrinsic_map;
+ m->id != GFC_ISYM_NONE || m->double_built_in != END_BUILTINS; m++)
{
- if (m->code_r4 != END_BUILTINS)
- m->real4_decl = built_in_decls[m->code_r4];
- if (m->code_r8 != END_BUILTINS)
- m->real8_decl = built_in_decls[m->code_r8];
- if (m->code_r10 != END_BUILTINS)
- m->real10_decl = built_in_decls[m->code_r10];
- if (m->code_r16 != END_BUILTINS)
- m->real16_decl = built_in_decls[m->code_r16];
- if (m->code_c4 != END_BUILTINS)
- m->complex4_decl = built_in_decls[m->code_c4];
- if (m->code_c8 != END_BUILTINS)
- m->complex8_decl = built_in_decls[m->code_c8];
- if (m->code_c10 != END_BUILTINS)
- m->complex10_decl = built_in_decls[m->code_c10];
- if (m->code_c16 != END_BUILTINS)
- m->complex16_decl = built_in_decls[m->code_c16];
+ if (m->float_built_in != END_BUILTINS)
+ m->real4_decl = built_in_decls[m->float_built_in];
+ if (m->complex_float_built_in != END_BUILTINS)
+ m->complex4_decl = built_in_decls[m->complex_float_built_in];
+ if (m->double_built_in != END_BUILTINS)
+ m->real8_decl = built_in_decls[m->double_built_in];
+ if (m->complex_double_built_in != END_BUILTINS)
+ m->complex8_decl = built_in_decls[m->complex_double_built_in];
+
+ /* If real(kind=10) exists, it is always long double. */
+ if (m->long_double_built_in != END_BUILTINS)
+ m->real10_decl = built_in_decls[m->long_double_built_in];
+ if (m->complex_long_double_built_in != END_BUILTINS)
+ m->complex10_decl = built_in_decls[m->complex_long_double_built_in];
+
+ /* For now, we assume that if real(kind=16) exists, it is long double.
+ Later, we will deal with __float128 and break this assumption. */
+ if (m->long_double_built_in != END_BUILTINS)
+ m->real16_decl = built_in_decls[m->long_double_built_in];
+ if (m->complex_long_double_built_in != END_BUILTINS)
+ m->complex16_decl = built_in_decls[m->complex_long_double_built_in];
}
}
@@ -666,18 +657,18 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr)
if (m->libm_name)
{
- if (ts->kind == 4)
+ int n = gfc_validate_kind (BT_REAL, ts->kind, false);
+ if (gfc_real_kinds[n].c_float)
snprintf (name, sizeof (name), "%s%s%s",
- ts->type == BT_COMPLEX ? "c" : "", m->name, "f");
- else if (ts->kind == 8)
+ ts->type == BT_COMPLEX ? "c" : "", m->name, "f");
+ else if (gfc_real_kinds[n].c_double)
snprintf (name, sizeof (name), "%s%s",
- ts->type == BT_COMPLEX ? "c" : "", m->name);
+ ts->type == BT_COMPLEX ? "c" : "", m->name);
+ else if (gfc_real_kinds[n].c_long_double)
+ snprintf (name, sizeof (name), "%s%s%s",
+ ts->type == BT_COMPLEX ? "c" : "", m->name, "l");
else
- {
- gcc_assert (ts->kind == 10 || ts->kind == 16);
- snprintf (name, sizeof (name), "%s%s%s",
- ts->type == BT_COMPLEX ? "c" : "", m->name, "l");
- }
+ gcc_unreachable ();
}
else
{
@@ -725,7 +716,8 @@ gfc_conv_intrinsic_lib_function (gfc_se * se, gfc_expr * expr)
id = expr->value.function.isym->id;
/* Find the entry for this function. */
- for (m = gfc_intrinsic_map; m->id != GFC_ISYM_NONE; m++)
+ for (m = gfc_intrinsic_map;
+ m->id != GFC_ISYM_NONE || m->double_built_in != END_BUILTINS; m++)
{
if (id == m->id)
break;
@@ -787,31 +779,16 @@ gfc_trans_same_strlen_check (const char* intr_name, locus* where,
static void
gfc_conv_intrinsic_exponent (gfc_se *se, gfc_expr *expr)
{
- tree arg, type, res, tmp;
- int frexp;
+ tree arg, type, res, tmp, frexp;
- switch (expr->value.function.actual->expr->ts.kind)
- {
- case 4:
- frexp = BUILT_IN_FREXPF;
- break;
- case 8:
- frexp = BUILT_IN_FREXP;
- break;
- case 10:
- case 16:
- frexp = BUILT_IN_FREXPL;
- break;
- default:
- gcc_unreachable ();
- }
+ frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP,
+ expr->value.function.actual->expr->ts.kind);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
res = gfc_create_var (integer_type_node, NULL);
- tmp = build_call_expr_loc (input_location,
- built_in_decls[frexp], 2, arg,
- gfc_build_addr_expr (NULL_TREE, res));
+ tmp = build_call_expr_loc (input_location, frexp, 2, arg,
+ gfc_build_addr_expr (NULL_TREE, res));
gfc_add_expr_to_block (&se->pre, tmp);
type = gfc_typenode_for_spec (&expr->ts);
@@ -991,8 +968,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper)
static void
gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr)
{
- tree arg;
- int n;
+ tree arg, cabs;
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
@@ -1004,23 +980,8 @@ gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr)
break;
case BT_COMPLEX:
- switch (expr->ts.kind)
- {
- case 4:
- n = BUILT_IN_CABSF;
- break;
- case 8:
- n = BUILT_IN_CABS;
- break;
- case 10:
- case 16:
- n = BUILT_IN_CABSL;
- break;
- default:
- gcc_unreachable ();
- }
- se->expr = build_call_expr_loc (input_location,
- built_in_decls[n], 1, arg);
+ cabs = builtin_decl_for_float_kind (BUILT_IN_CABS, expr->ts.kind);
+ se->expr = build_call_expr_loc (input_location, cabs, 1, arg);
break;
default:
@@ -1072,6 +1033,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo)
tree tmp;
tree test;
tree test2;
+ tree fmod;
mpfr_t huge;
int n, ikind;
tree args[2];
@@ -1091,33 +1053,16 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo)
break;
case BT_REAL:
- n = END_BUILTINS;
+ fmod = NULL_TREE;
/* Check if we have a builtin fmod. */
- switch (expr->ts.kind)
- {
- case 4:
- n = BUILT_IN_FMODF;
- break;
-
- case 8:
- n = BUILT_IN_FMOD;
- break;
-
- case 10:
- case 16:
- n = BUILT_IN_FMODL;
- break;
-
- default:
- break;
- }
+ fmod = builtin_decl_for_float_kind (BUILT_IN_FMOD, expr->ts.kind);
/* Use it if it exists. */
- if (n != END_BUILTINS)
+ if (fmod != NULL_TREE)
{
- tmp = build_addr (built_in_decls[n], current_function_decl);
+ tmp = build_addr (fmod, current_function_decl);
se->expr = build_call_array_loc (input_location,
- TREE_TYPE (TREE_TYPE (built_in_decls[n])),
+ TREE_TYPE (TREE_TYPE (fmod)),
tmp, 2, args);
if (modulo == 0)
return;
@@ -1135,7 +1080,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo)
test = (fmod (arg, arg2) != 0) && ((arg < 0) xor (arg2 < 0))
thereby avoiding another division and retaining the accuracy
of the builtin function. */
- if (n != END_BUILTINS && modulo)
+ if (fmod != NULL_TREE && modulo)
{
tree zero = gfc_build_const (type, integer_zero_node);
tmp = gfc_evaluate_now (se->expr, &se->pre);
@@ -1232,24 +1177,8 @@ gfc_conv_intrinsic_sign (gfc_se * se, gfc_expr * expr)
{
tree abs;
- switch (expr->ts.kind)
- {
- case 4:
- tmp = built_in_decls[BUILT_IN_COPYSIGNF];
- abs = built_in_decls[BUILT_IN_FABSF];
- break;
- case 8:
- tmp = built_in_decls[BUILT_IN_COPYSIGN];
- abs = built_in_decls[BUILT_IN_FABS];
- break;
- case 10:
- case 16:
- tmp = built_in_decls[BUILT_IN_COPYSIGNL];
- abs = built_in_decls[BUILT_IN_FABSL];
- break;
- default:
- gcc_unreachable ();
- }
+ tmp = builtin_decl_for_float_kind (BUILT_IN_COPYSIGN, expr->ts.kind);
+ abs = builtin_decl_for_float_kind (BUILT_IN_FABS, expr->ts.kind);
/* We explicitly have to ignore the minus sign. We do so by using
result = (arg1 == 0) ? abs(arg0) : copysign(arg0, arg1). */
@@ -1264,8 +1193,8 @@ gfc_conv_intrinsic_sign (gfc_se * se, gfc_expr * expr)
build_call_expr (tmp, 2, args[0], args[1]));
}
else
- se->expr = build_call_expr_loc (input_location,
- tmp, 2, args[0], args[1]);
+ se->expr = build_call_expr_loc (input_location, tmp, 2,
+ args[0], args[1]);
return;
}
@@ -1400,7 +1329,7 @@ gfc_conv_intrinsic_fdate (gfc_se * se, gfc_expr * expr)
args = (tree *) alloca (sizeof (tree) * num_args);
var = gfc_create_var (pchar_type_node, "pstr");
- len = gfc_create_var (gfc_get_int_type (4), "len");
+ len = gfc_create_var (gfc_charlen_type_node, "len");
gfc_conv_intrinsic_function_args (se, expr, &args[2], num_args - 2);
args[0] = gfc_build_addr_expr (NULL_TREE, var);
@@ -1441,7 +1370,7 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr)
args = (tree *) alloca (sizeof (tree) * num_args);
var = gfc_create_var (pchar_type_node, "pstr");
- len = gfc_create_var (gfc_get_int_type (4), "len");
+ len = gfc_create_var (gfc_charlen_type_node, "len");
gfc_conv_intrinsic_function_args (se, expr, &args[2], num_args - 2);
args[0] = gfc_build_addr_expr (NULL_TREE, var);
@@ -3620,32 +3549,16 @@ gfc_conv_intrinsic_merge (gfc_se * se, gfc_expr * expr)
static void
gfc_conv_intrinsic_fraction (gfc_se * se, gfc_expr * expr)
{
- tree arg, type, tmp;
- int frexp;
+ tree arg, type, tmp, frexp;
- switch (expr->ts.kind)
- {
- case 4:
- frexp = BUILT_IN_FREXPF;
- break;
- case 8:
- frexp = BUILT_IN_FREXP;
- break;
- case 10:
- case 16:
- frexp = BUILT_IN_FREXPL;
- break;
- default:
- gcc_unreachable ();
- }
+ frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
tmp = gfc_create_var (integer_type_node, NULL);
- se->expr = build_call_expr_loc (input_location,
- built_in_decls[frexp], 2,
- fold_convert (type, arg),
- gfc_build_addr_expr (NULL_TREE, tmp));
+ se->expr = build_call_expr_loc (input_location, frexp, 2,
+ fold_convert (type, arg),
+ gfc_build_addr_expr (NULL_TREE, tmp));
se->expr = fold_convert (type, se->expr);
}
@@ -3657,41 +3570,19 @@ gfc_conv_intrinsic_fraction (gfc_se * se, gfc_expr * expr)
static void
gfc_conv_intrinsic_nearest (gfc_se * se, gfc_expr * expr)
{
- tree args[2], type, tmp;
- int nextafter, copysign, huge_val;
+ tree args[2], type, tmp, nextafter, copysign, huge_val;
- switch (expr->ts.kind)
- {
- case 4:
- nextafter = BUILT_IN_NEXTAFTERF;
- copysign = BUILT_IN_COPYSIGNF;
- huge_val = BUILT_IN_HUGE_VALF;
- break;
- case 8:
- nextafter = BUILT_IN_NEXTAFTER;
- copysign = BUILT_IN_COPYSIGN;
- huge_val = BUILT_IN_HUGE_VAL;
- break;
- case 10:
- case 16:
- nextafter = BUILT_IN_NEXTAFTERL;
- copysign = BUILT_IN_COPYSIGNL;
- huge_val = BUILT_IN_HUGE_VALL;
- break;
- default:
- gcc_unreachable ();
- }
+ nextafter = builtin_decl_for_float_kind (BUILT_IN_NEXTAFTER, expr->ts.kind);
+ copysign = builtin_decl_for_float_kind (BUILT_IN_COPYSIGN, expr->ts.kind);
+ huge_val = builtin_decl_for_float_kind (BUILT_IN_HUGE_VAL, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2);
- tmp = build_call_expr_loc (input_location,
- built_in_decls[copysign], 2,
- build_call_expr_loc (input_location,
- built_in_decls[huge_val], 0),
- fold_convert (type, args[1]));
- se->expr = build_call_expr_loc (input_location,
- built_in_decls[nextafter], 2,
- fold_convert (type, args[0]), tmp);
+ tmp = build_call_expr_loc (input_location, copysign, 2,
+ build_call_expr_loc (input_location, huge_val, 0),
+ fold_convert (type, args[1]));
+ se->expr = build_call_expr_loc (input_location, nextafter, 2,
+ fold_convert (type, args[0]), tmp);
se->expr = fold_convert (type, se->expr);
}
@@ -3717,8 +3608,8 @@ static void
gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr)
{
tree arg, type, prec, emin, tiny, res, e;
- tree cond, tmp;
- int frexp, scalbn, k;
+ tree cond, tmp, frexp, scalbn;
+ int k;
stmtblock_t block;
k = gfc_validate_kind (BT_REAL, expr->ts.kind, false);
@@ -3726,24 +3617,8 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr)
emin = build_int_cst (NULL_TREE, gfc_real_kinds[k].min_exponent - 1);
tiny = gfc_conv_mpfr_to_tree (gfc_real_kinds[k].tiny, expr->ts.kind, 0);
- switch (expr->ts.kind)
- {
- case 4:
- frexp = BUILT_IN_FREXPF;
- scalbn = BUILT_IN_SCALBNF;
- break;
- case 8:
- frexp = BUILT_IN_FREXP;
- scalbn = BUILT_IN_SCALBN;
- break;
- case 10:
- case 16:
- frexp = BUILT_IN_FREXPL;
- scalbn = BUILT_IN_SCALBNL;
- break;
- default:
- gcc_unreachable ();
- }
+ frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
+ scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
arg = gfc_evaluate_now (arg, &se->pre);
@@ -3755,17 +3630,15 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr)
/* Build the block for s /= 0. */
gfc_start_block (&block);
- tmp = build_call_expr_loc (input_location,
- built_in_decls[frexp], 2, arg,
- gfc_build_addr_expr (NULL_TREE, e));
+ tmp = build_call_expr_loc (input_location, frexp, 2, arg,
+ gfc_build_addr_expr (NULL_TREE, e));
gfc_add_expr_to_block (&block, tmp);
tmp = fold_build2 (MINUS_EXPR, integer_type_node, e, prec);
gfc_add_modify (&block, e, fold_build2 (MAX_EXPR, integer_type_node,
tmp, emin));
- tmp = build_call_expr_loc (input_location,
- built_in_decls[scalbn], 2,
+ tmp = build_call_expr_loc (input_location, scalbn, 2,
build_real_from_int_cst (type, integer_one_node), e);
gfc_add_modify (&block, res, tmp);
@@ -3796,33 +3669,16 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr)
static void
gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
{
- tree arg, type, e, x, cond, stmt, tmp;
- int frexp, scalbn, fabs, prec, k;
+ tree arg, type, e, x, cond, stmt, tmp, frexp, scalbn, fabs;
+ int prec, k;
stmtblock_t block;
k = gfc_validate_kind (BT_REAL, expr->ts.kind, false);
prec = gfc_real_kinds[k].digits;
- switch (expr->ts.kind)
- {
- case 4:
- frexp = BUILT_IN_FREXPF;
- scalbn = BUILT_IN_SCALBNF;
- fabs = BUILT_IN_FABSF;
- break;
- case 8:
- frexp = BUILT_IN_FREXP;
- scalbn = BUILT_IN_SCALBN;
- fabs = BUILT_IN_FABS;
- break;
- case 10:
- case 16:
- frexp = BUILT_IN_FREXPL;
- scalbn = BUILT_IN_SCALBNL;
- fabs = BUILT_IN_FABSL;
- break;
- default:
- gcc_unreachable ();
- }
+
+ frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
+ scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
+ fabs = builtin_decl_for_float_kind (BUILT_IN_FABS, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
@@ -3831,20 +3687,17 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
e = gfc_create_var (integer_type_node, NULL);
x = gfc_create_var (type, NULL);
gfc_add_modify (&se->pre, x,
- build_call_expr_loc (input_location,
- built_in_decls[fabs], 1, arg));
+ build_call_expr_loc (input_location, fabs, 1, arg));
gfc_start_block (&block);
- tmp = build_call_expr_loc (input_location,
- built_in_decls[frexp], 2, arg,
- gfc_build_addr_expr (NULL_TREE, e));
+ tmp = build_call_expr_loc (input_location, frexp, 2, arg,
+ gfc_build_addr_expr (NULL_TREE, e));
gfc_add_expr_to_block (&block, tmp);
tmp = fold_build2 (MINUS_EXPR, integer_type_node,
build_int_cst (NULL_TREE, prec), e);
- tmp = build_call_expr_loc (input_location,
- built_in_decls[scalbn], 2, x, tmp);
+ tmp = build_call_expr_loc (input_location, scalbn, 2, x, tmp);
gfc_add_modify (&block, x, tmp);
stmt = gfc_finish_block (&block);
@@ -3861,31 +3714,15 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
static void
gfc_conv_intrinsic_scale (gfc_se * se, gfc_expr * expr)
{
- tree args[2], type;
- int scalbn;
+ tree args[2], type, scalbn;
- switch (expr->ts.kind)
- {
- case 4:
- scalbn = BUILT_IN_SCALBNF;
- break;
- case 8:
- scalbn = BUILT_IN_SCALBN;
- break;
- case 10:
- case 16:
- scalbn = BUILT_IN_SCALBNL;
- break;
- default:
- gcc_unreachable ();
- }
+ scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2);
- se->expr = build_call_expr_loc (input_location,
- built_in_decls[scalbn], 2,
- fold_convert (type, args[0]),
- fold_convert (integer_type_node, args[1]));
+ se->expr = build_call_expr_loc (input_location, scalbn, 2,
+ fold_convert (type, args[0]),
+ fold_convert (integer_type_node, args[1]));
se->expr = fold_convert (type, se->expr);
}
@@ -3895,39 +3732,20 @@ gfc_conv_intrinsic_scale (gfc_se * se, gfc_expr * expr)
static void
gfc_conv_intrinsic_set_exponent (gfc_se * se, gfc_expr * expr)
{
- tree args[2], type, tmp;
- int frexp, scalbn;
+ tree args[2], type, tmp, frexp, scalbn;
- switch (expr->ts.kind)
- {
- case 4:
- frexp = BUILT_IN_FREXPF;
- scalbn = BUILT_IN_SCALBNF;
- break;
- case 8:
- frexp = BUILT_IN_FREXP;
- scalbn = BUILT_IN_SCALBN;
- break;
- case 10:
- case 16:
- frexp = BUILT_IN_FREXPL;
- scalbn = BUILT_IN_SCALBNL;
- break;
- default:
- gcc_unreachable ();
- }
+ frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
+ scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2);
tmp = gfc_create_var (integer_type_node, NULL);
- tmp = build_call_expr_loc (input_location,
- built_in_decls[frexp], 2,
- fold_convert (type, args[0]),
- gfc_build_addr_expr (NULL_TREE, tmp));
- se->expr = build_call_expr_loc (input_location,
- built_in_decls[scalbn], 2, tmp,
- fold_convert (integer_type_node, args[1]));
+ tmp = build_call_expr_loc (input_location, frexp, 2,
+ fold_convert (type, args[0]),
+ gfc_build_addr_expr (NULL_TREE, tmp));
+ se->expr = build_call_expr_loc (input_location, scalbn, 2, tmp,
+ fold_convert (integer_type_node, args[1]));
se->expr = fold_convert (type, se->expr);
}
@@ -4598,6 +4416,8 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
else
{
/* An optional target. */
+ if (arg2->expr->ts.type == BT_CLASS)
+ gfc_add_component_ref (arg2->expr, "$data");
ss2 = gfc_walk_expr (arg2->expr);
nonzero_charlen = NULL_TREE;
@@ -4805,7 +4625,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr)
var = gfc_create_var (gfc_get_pchar_type (expr->ts.kind), "pstr");
addr = gfc_build_addr_expr (ppvoid_type_node, var);
- len = gfc_create_var (gfc_get_int_type (4), "len");
+ len = gfc_create_var (gfc_charlen_type_node, "len");
gfc_conv_intrinsic_function_args (se, expr, &args[2], num_args - 2);
args[0] = gfc_build_addr_expr (NULL_TREE, len);
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 50e7847d0e1..7a7d33088d7 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -75,7 +75,10 @@ gfc_omp_privatize_by_reference (const_tree decl)
enum omp_clause_default_kind
gfc_omp_predetermined_sharing (tree decl)
{
- if (DECL_ARTIFICIAL (decl) && ! GFC_DECL_RESULT (decl))
+ if (DECL_ARTIFICIAL (decl)
+ && ! GFC_DECL_RESULT (decl)
+ && ! (DECL_LANG_SPECIFIC (decl)
+ && GFC_DECL_SAVED_DESCRIPTOR (decl)))
return OMP_CLAUSE_DEFAULT_SHARED;
/* Cray pointees shouldn't be listed in any clauses and should be
@@ -118,6 +121,19 @@ gfc_omp_predetermined_sharing (tree decl)
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}
+/* Return decl that should be used when reporting DEFAULT(NONE)
+ diagnostics. */
+
+tree
+gfc_omp_report_decl (tree decl)
+{
+ if (DECL_ARTIFICIAL (decl)
+ && DECL_LANG_SPECIFIC (decl)
+ && GFC_DECL_SAVED_DESCRIPTOR (decl))
+ return GFC_DECL_SAVED_DESCRIPTOR (decl);
+
+ return decl;
+}
/* Return true if DECL in private clause needs
OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause. */
@@ -1134,6 +1150,14 @@ gfc_trans_omp_critical (gfc_code *code)
return build2 (OMP_CRITICAL, void_type_node, stmt, name);
}
+typedef struct dovar_init_d {
+ tree var;
+ tree init;
+} dovar_init;
+
+DEF_VEC_O(dovar_init);
+DEF_VEC_ALLOC_O(dovar_init,heap);
+
static tree
gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
gfc_omp_clauses *do_clauses, tree par_clauses)
@@ -1145,7 +1169,9 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
stmtblock_t body;
gfc_omp_clauses *clauses = code->ext.omp_clauses;
int i, collapse = clauses->collapse;
- tree dovar_init = NULL_TREE;
+ VEC(dovar_init,heap) *inits = NULL;
+ dovar_init *di;
+ unsigned ix;
if (collapse <= 0)
collapse = 1;
@@ -1260,7 +1286,9 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
/* Initialize DOVAR. */
tmp = fold_build2 (MULT_EXPR, type, count, step);
tmp = fold_build2 (PLUS_EXPR, type, from, tmp);
- dovar_init = tree_cons (dovar, tmp, dovar_init);
+ di = VEC_safe_push (dovar_init, heap, inits, NULL);
+ di->var = dovar;
+ di->init = tmp;
}
if (!dovar_found)
@@ -1329,24 +1357,18 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
gfc_start_block (&body);
- dovar_init = nreverse (dovar_init);
- while (dovar_init)
- {
- gfc_add_modify (&body, TREE_PURPOSE (dovar_init),
- TREE_VALUE (dovar_init));
- dovar_init = TREE_CHAIN (dovar_init);
- }
+ for (ix = 0; VEC_iterate (dovar_init, inits, ix, di); ix++)
+ gfc_add_modify (&body, di->var, di->init);
+ VEC_free (dovar_init, heap, inits);
/* Cycle statement is implemented with a goto. Exit statement must not be
present for this loop. */
cycle_label = gfc_build_label_decl (NULL_TREE);
- /* Put these labels where they can be found later. We put the
- labels in a TREE_LIST node (because TREE_CHAIN is already
- used). cycle_label goes in TREE_PURPOSE (backend_decl), exit
- label in TREE_VALUE (backend_decl). */
+ /* Put these labels where they can be found later. */
- code->block->backend_decl = tree_cons (cycle_label, NULL, NULL);
+ code->block->cycle_label = cycle_label;
+ code->block->exit_label = NULL_TREE;
/* Main loop body. */
tmp = gfc_trans_omp_code (code->block->next, true);
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 37b577f2cc4..6fa84b91694 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -850,7 +850,7 @@ gfc_trans_block_construct (gfc_code* code)
stmtblock_t body;
tree tmp;
- ns = code->ext.ns;
+ ns = code->ext.block.ns;
gcc_assert (ns);
sym = ns->proc_name;
gcc_assert (sym);
@@ -928,7 +928,8 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar,
exit_label = gfc_build_label_decl (NULL_TREE);
/* Put the labels where they can be found later. See gfc_trans_do(). */
- code->block->backend_decl = tree_cons (cycle_label, exit_label, NULL);
+ code->block->cycle_label = cycle_label;
+ code->block->exit_label = exit_label;
/* Loop body. */
gfc_start_block (&body);
@@ -1196,12 +1197,10 @@ gfc_trans_do (gfc_code * code, tree exit_cond)
/* Loop body. */
gfc_start_block (&body);
- /* Put these labels where they can be found later. We put the
- labels in a TREE_LIST node (because TREE_CHAIN is already
- used). cycle_label goes in TREE_PURPOSE (backend_decl), exit
- label in TREE_VALUE (backend_decl). */
+ /* Put these labels where they can be found later. */
- code->block->backend_decl = tree_cons (cycle_label, exit_label, NULL);
+ code->block->cycle_label = cycle_label;
+ code->block->exit_label = exit_label;
/* Main loop body. */
tmp = gfc_trans_code_cond (code->block->next, exit_cond);
@@ -1305,7 +1304,8 @@ gfc_trans_do_while (gfc_code * code)
exit_label = gfc_build_label_decl (NULL_TREE);
/* Put the labels where they can be found later. See gfc_trans_do(). */
- code->block->backend_decl = tree_cons (cycle_label, exit_label, NULL);
+ code->block->cycle_label = cycle_label;
+ code->block->exit_label = exit_label;
/* Create a GIMPLE version of the exit condition. */
gfc_init_se (&cond, NULL);
@@ -4080,7 +4080,7 @@ gfc_trans_cycle (gfc_code * code)
{
tree cycle_label;
- cycle_label = TREE_PURPOSE (code->ext.whichloop->backend_decl);
+ cycle_label = code->ext.whichloop->cycle_label;
TREE_USED (cycle_label) = 1;
return build1_v (GOTO_EXPR, cycle_label);
}
@@ -4095,7 +4095,7 @@ gfc_trans_exit (gfc_code * code)
{
tree exit_label;
- exit_label = TREE_VALUE (code->ext.whichloop->backend_decl);
+ exit_label = code->ext.whichloop->exit_label;
TREE_USED (exit_label) = 1;
return build1_v (GOTO_EXPR, exit_label);
}
@@ -4155,20 +4155,23 @@ gfc_trans_allocate (gfc_code * code)
/* A scalar or derived type. */
/* Determine allocate size. */
- if (code->expr3 && code->expr3->ts.type == BT_CLASS)
+ if (al->expr->ts.type == BT_CLASS && code->expr3)
{
- gfc_expr *sz;
- gfc_se se_sz;
- sz = gfc_copy_expr (code->expr3);
- gfc_add_component_ref (sz, "$vptr");
- gfc_add_component_ref (sz, "$size");
- gfc_init_se (&se_sz, NULL);
- gfc_conv_expr (&se_sz, sz);
- gfc_free_expr (sz);
- memsz = se_sz.expr;
+ if (code->expr3->ts.type == BT_CLASS)
+ {
+ gfc_expr *sz;
+ gfc_se se_sz;
+ sz = gfc_copy_expr (code->expr3);
+ gfc_add_component_ref (sz, "$vptr");
+ gfc_add_component_ref (sz, "$size");
+ gfc_init_se (&se_sz, NULL);
+ gfc_conv_expr (&se_sz, sz);
+ gfc_free_expr (sz);
+ memsz = se_sz.expr;
+ }
+ else
+ memsz = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->expr3->ts));
}
- else if (code->expr3 && code->expr3->ts.type != BT_CLASS)
- memsz = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->expr3->ts));
else if (code->ext.alloc.ts.type != BT_UNKNOWN)
memsz = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->ext.alloc.ts));
else
@@ -4230,7 +4233,7 @@ gfc_trans_allocate (gfc_code * code)
gfc_add_expr_to_block (&block, tmp);
/* Initialization via SOURCE block. */
- if (code->expr3)
+ if (code->expr3 && !code->expr3->mold)
{
gfc_expr *rhs = gfc_copy_expr (code->expr3);
if (al->expr->ts.type == BT_CLASS)
@@ -4266,7 +4269,7 @@ gfc_trans_allocate (gfc_code * code)
rhs = NULL;
if (code->expr3 && code->expr3->ts.type == BT_CLASS)
{
- /* VPTR must be determined at run time. */
+ /* Polymorphic SOURCE: VPTR must be determined at run time. */
rhs = gfc_copy_expr (code->expr3);
gfc_add_component_ref (rhs, "$vptr");
tmp = gfc_trans_pointer_assignment (lhs, rhs);
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index d794c2fb668..2f5b759886d 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1202,7 +1202,8 @@ gfc_is_nodesc_array (gfc_symbol * sym)
static tree
gfc_build_array_type (tree type, gfc_array_spec * as,
- enum gfc_array_kind akind, bool restricted)
+ enum gfc_array_kind akind, bool restricted,
+ bool contiguous)
{
tree lbound[GFC_MAX_DIMENSIONS];
tree ubound[GFC_MAX_DIMENSIONS];
@@ -1219,7 +1220,8 @@ gfc_build_array_type (tree type, gfc_array_spec * as,
}
if (as->type == AS_ASSUMED_SHAPE)
- akind = GFC_ARRAY_ASSUMED_SHAPE;
+ akind = contiguous ? GFC_ARRAY_ASSUMED_SHAPE_CONT
+ : GFC_ARRAY_ASSUMED_SHAPE;
return gfc_get_array_type_bounds (type, as->rank, as->corank, lbound,
ubound, 0, akind, restricted);
}
@@ -1390,8 +1392,8 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
type = make_node (ARRAY_TYPE);
GFC_ARRAY_TYPE_P (type) = 1;
- TYPE_LANG_SPECIFIC (type) = (struct lang_type *)
- ggc_alloc_cleared (sizeof (struct lang_type));
+ TYPE_LANG_SPECIFIC (type)
+ = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
known_stride = (packed != PACKED_NO);
known_offset = 1;
@@ -1631,8 +1633,8 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
TYPE_NAME (fat_type) = get_identifier (name);
GFC_DESCRIPTOR_TYPE_P (fat_type) = 1;
- TYPE_LANG_SPECIFIC (fat_type) = (struct lang_type *)
- ggc_alloc_cleared (sizeof (struct lang_type));
+ TYPE_LANG_SPECIFIC (fat_type)
+ = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
GFC_TYPE_ARRAY_RANK (fat_type) = dimen;
GFC_TYPE_ARRAY_DTYPE (fat_type) = NULL_TREE;
@@ -1799,10 +1801,12 @@ gfc_sym_type (gfc_symbol * sym)
{
enum gfc_array_kind akind = GFC_ARRAY_UNKNOWN;
if (sym->attr.pointer)
- akind = GFC_ARRAY_POINTER;
+ akind = sym->attr.contiguous ? GFC_ARRAY_POINTER_CONT
+ : GFC_ARRAY_POINTER;
else if (sym->attr.allocatable)
akind = GFC_ARRAY_ALLOCATABLE;
- type = gfc_build_array_type (type, sym->as, akind, restricted);
+ type = gfc_build_array_type (type, sym->as, akind, restricted,
+ sym->attr.contiguous);
}
}
else
@@ -2121,14 +2125,16 @@ gfc_get_derived_type (gfc_symbol * derived)
{
enum gfc_array_kind akind;
if (c->attr.pointer)
- akind = GFC_ARRAY_POINTER;
+ akind = c->attr.contiguous ? GFC_ARRAY_POINTER_CONT
+ : GFC_ARRAY_POINTER;
else
akind = GFC_ARRAY_ALLOCATABLE;
/* Pointers to arrays aren't actually pointer types. The
descriptors are separate, but the data is common. */
field_type = gfc_build_array_type (field_type, c->as, akind,
!c->attr.target
- && !c->attr.pointer);
+ && !c->attr.pointer,
+ c->attr.contiguous);
}
else
field_type = gfc_get_nodesc_array_type (field_type, c->as,
@@ -2516,7 +2522,8 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
if (int_size_in_bytes (etype) <= 0)
return false;
/* Nor non-constant lower bounds in assumed shape arrays. */
- if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE)
+ if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE
+ || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE_CONT)
{
for (dim = 0; dim < rank; dim++)
if (GFC_TYPE_ARRAY_LBOUND (type, dim) == NULL_TREE
@@ -2565,7 +2572,8 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ALLOCATABLE)
info->allocated = build2 (NE_EXPR, boolean_type_node,
info->data_location, null_pointer_node);
- else if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER)
+ else if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER
+ || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER_CONT)
info->associated = build2 (NE_EXPR, boolean_type_node,
info->data_location, null_pointer_node);
@@ -2579,7 +2587,8 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
size_binop (PLUS_EXPR, dim_off, upper_suboff));
t = build1 (INDIRECT_REF, gfc_array_index_type, t);
info->dimen[dim].upper_bound = t;
- if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE)
+ if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE
+ || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE_CONT)
{
/* Assumed shape arrays have known lower bounds. */
info->dimen[dim].upper_bound
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 9ee81480c5b..02361fc8466 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -523,6 +523,7 @@ bool gfc_get_array_descr_info (const_tree, struct array_descr_info *);
/* In trans-openmp.c */
bool gfc_omp_privatize_by_reference (const_tree);
enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree);
+tree gfc_omp_report_decl (tree);
tree gfc_omp_clause_default_ctor (tree, tree, tree);
tree gfc_omp_clause_copy_ctor (tree, tree, tree);
tree gfc_omp_clause_assign_op (tree, tree, tree);
@@ -619,18 +620,24 @@ extern GTY(()) tree gfor_fndecl_sr_kind;
/* True if node is an integer constant. */
#define INTEGER_CST_P(node) (TREE_CODE(node) == INTEGER_CST)
-/* G95-specific declaration information. */
+/* gfortran-specific declaration information, the _CONT versions denote
+ arrays with CONTIGUOUS attribute. */
enum gfc_array_kind
{
GFC_ARRAY_UNKNOWN,
GFC_ARRAY_ASSUMED_SHAPE,
+ GFC_ARRAY_ASSUMED_SHAPE_CONT,
GFC_ARRAY_ALLOCATABLE,
- GFC_ARRAY_POINTER
+ GFC_ARRAY_POINTER,
+ GFC_ARRAY_POINTER_CONT
};
/* Array types only. */
-struct GTY(()) lang_type {
+/* FIXME: the variable_size annotation here is needed because these types are
+ variable-sized in some other frontends. Due to gengtype deficiency the GTY
+ options of such types have to agree across all frontends. */
+struct GTY((variable_size)) lang_type {
int rank;
enum gfc_array_kind akind;
tree lbound[GFC_MAX_DIMENSIONS];
@@ -644,7 +651,7 @@ struct GTY(()) lang_type {
tree base_decl[2];
};
-struct GTY(()) lang_decl {
+struct GTY((variable_size)) lang_decl {
/* Dummy variables. */
tree saved_descriptor;
/* Assigned integer nodes. Stringlength is the IO format string's length.
diff --git a/gcc/function.c b/gcc/function.c
index 771552913f1..3a7bb25dac6 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "tree.h"
#include "flags.h"
#include "except.h"
@@ -51,7 +51,6 @@ along with GCC; see the file COPYING3. If not see
#include "recog.h"
#include "output.h"
#include "basic-block.h"
-#include "toplev.h"
#include "hashtab.h"
#include "ggc.h"
#include "tm_p.h"
@@ -132,7 +131,7 @@ static GTY((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
htab_t types_used_by_vars_hash = NULL;
-tree types_used_by_cur_var_decl = NULL;
+VEC(tree,gc) *types_used_by_cur_var_decl;
/* Forward declarations. */
@@ -340,7 +339,7 @@ try_fit_stack_local (HOST_WIDE_INT start, HOST_WIDE_INT length,
static void
add_frame_space (HOST_WIDE_INT start, HOST_WIDE_INT end)
{
- struct frame_space *space = GGC_NEW (struct frame_space);
+ struct frame_space *space = ggc_alloc_frame_space ();
space->next = crtl->frame_space_list;
crtl->frame_space_list = space;
space->start = start;
@@ -683,7 +682,7 @@ static void
insert_temp_slot_address (rtx address, struct temp_slot *temp_slot)
{
void **slot;
- struct temp_slot_address_entry *t = GGC_NEW (struct temp_slot_address_entry);
+ struct temp_slot_address_entry *t = ggc_alloc_temp_slot_address_entry ();
t->address = address;
t->temp_slot = temp_slot;
t->hash = temp_slot_address_compute_hash (t);
@@ -835,7 +834,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
if (best_p->size - rounded_size >= alignment)
{
- p = GGC_NEW (struct temp_slot);
+ p = ggc_alloc_temp_slot ();
p->in_use = p->addr_taken = 0;
p->size = best_p->size - rounded_size;
p->base_offset = best_p->base_offset + rounded_size;
@@ -859,7 +858,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
{
HOST_WIDE_INT frame_offset_old = frame_offset;
- p = GGC_NEW (struct temp_slot);
+ p = ggc_alloc_temp_slot ();
/* We are passing an explicit alignment request to assign_stack_local.
One side effect of that is assign_stack_local will not round SIZE
@@ -2374,13 +2373,10 @@ assign_parm_find_entry_rtl (struct assign_parm_data_all *all,
return;
}
-#ifdef FUNCTION_INCOMING_ARG
- entry_parm = FUNCTION_INCOMING_ARG (all->args_so_far, data->promoted_mode,
- data->passed_type, data->named_arg);
-#else
- entry_parm = FUNCTION_ARG (all->args_so_far, data->promoted_mode,
- data->passed_type, data->named_arg);
-#endif
+ entry_parm = targetm.calls.function_incoming_arg (&all->args_so_far,
+ data->promoted_mode,
+ data->passed_type,
+ data->named_arg);
if (entry_parm == 0)
data->promoted_mode = data->passed_mode;
@@ -2404,13 +2400,9 @@ assign_parm_find_entry_rtl (struct assign_parm_data_all *all,
if (targetm.calls.pretend_outgoing_varargs_named (&all->args_so_far))
{
rtx tem;
-#ifdef FUNCTION_INCOMING_ARG
- tem = FUNCTION_INCOMING_ARG (all->args_so_far, data->promoted_mode,
- data->passed_type, true);
-#else
- tem = FUNCTION_ARG (all->args_so_far, data->promoted_mode,
- data->passed_type, true);
-#endif
+ tem = targetm.calls.function_incoming_arg (&all->args_so_far,
+ data->promoted_mode,
+ data->passed_type, true);
in_regs = tem != NULL;
}
}
@@ -3275,8 +3267,8 @@ assign_parms (tree fndecl)
set_decl_incoming_rtl (parm, data.entry_parm, data.passed_pointer);
/* Update info on where next arg arrives in registers. */
- FUNCTION_ARG_ADVANCE (all.args_so_far, data.promoted_mode,
- data.passed_type, data.named_arg);
+ targetm.calls.function_arg_advance (&all.args_so_far, data.promoted_mode,
+ data.passed_type, data.named_arg);
assign_parm_adjust_stack_rtl (&data);
@@ -3369,8 +3361,9 @@ assign_parms (tree fndecl)
/* See how many bytes, if any, of its args a function should try to pop
on return. */
- crtl->args.pops_args = RETURN_POPS_ARGS (fndecl, TREE_TYPE (fndecl),
- crtl->args.size);
+ crtl->args.pops_args = targetm.calls.return_pops_args (fndecl,
+ TREE_TYPE (fndecl),
+ crtl->args.size);
/* For stdarg.h function, save info about
regs and stack space used by the named args. */
@@ -3464,8 +3457,8 @@ gimplify_parameters (void)
continue;
/* Update info on where next arg arrives in registers. */
- FUNCTION_ARG_ADVANCE (all.args_so_far, data.promoted_mode,
- data.passed_type, data.named_arg);
+ targetm.calls.function_arg_advance (&all.args_so_far, data.promoted_mode,
+ data.passed_type, data.named_arg);
/* ??? Once upon a time variable_size stuffed parameter list
SAVE_EXPRs (amongst others) onto a pending sizes list. This
@@ -4196,7 +4189,7 @@ allocate_struct_function (tree fndecl, bool abstract_p)
tree result;
tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE;
- cfun = GGC_CNEW (struct function);
+ cfun = ggc_alloc_cleared_function ();
init_eh_for_function ();
@@ -5562,9 +5555,7 @@ used_types_insert (tree t)
/* So this might be a type referenced by a global variable.
Record that type so that we can later decide to emit its debug
information. */
- types_used_by_cur_var_decl =
- tree_cons (t, NULL, types_used_by_cur_var_decl);
-
+ VEC_safe_push (tree, gc, types_used_by_cur_var_decl, t);
}
}
@@ -5623,8 +5614,7 @@ types_used_by_var_decl_insert (tree type, tree var_decl)
if (*slot == NULL)
{
struct types_used_by_vars_entry *entry;
- entry = (struct types_used_by_vars_entry*) ggc_alloc
- (sizeof (struct types_used_by_vars_entry));
+ entry = ggc_alloc_types_used_by_vars_entry ();
entry->type = type;
entry->var_decl = var_decl;
*slot = entry;
diff --git a/gcc/function.h b/gcc/function.h
index deb170dc38c..617034872cc 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -645,9 +645,9 @@ hashval_t types_used_by_vars_do_hash (const void*);
int types_used_by_vars_eq (const void *, const void *);
void types_used_by_var_decl_insert (tree type, tree var_decl);
-/* During parsing of a global variable, this linked list points to
- the list of types referenced by the global variable. */
-extern GTY(()) tree types_used_by_cur_var_decl;
+/* During parsing of a global variable, this vector contains the types
+ referenced by the global variable. */
+extern GTY(()) VEC(tree,gc) *types_used_by_cur_var_decl;
/* cfun shouldn't be set directly; use one of these functions instead. */
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 5085805d6c8..c96a0a301ec 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -220,8 +220,8 @@ single_def_use_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
struct df_lr_bb_info *lr_bb_info = df_lr_get_bb_info (bb_index);
rtx insn;
- bitmap_copy (local_md, md_bb_info->in);
- bitmap_copy (local_lr, lr_bb_info->in);
+ bitmap_copy (local_md, &md_bb_info->in);
+ bitmap_copy (local_lr, &lr_bb_info->in);
/* Push a marker for the leave_block callback. */
VEC_safe_push (df_ref, heap, reg_defs_stack, NULL);
diff --git a/gcc/gcc-plugin.h b/gcc/gcc-plugin.h
index 948c4397570..7573fa28d7c 100644
--- a/gcc/gcc-plugin.h
+++ b/gcc/gcc-plugin.h
@@ -38,6 +38,12 @@ enum plugin_event
PLUGIN_EVENT_FIRST_DYNAMIC
};
+/* All globals declared here have C linkage to reduce link compatibility
+ issues with implementation language choice and mangling. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern const char **plugin_event_name;
struct plugin_argument
@@ -96,16 +102,10 @@ extern bool plugin_default_version_check (struct plugin_gcc_version *,
typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version);
-#ifdef __cplusplus
-extern "C" {
-#endif
/* Declaration for "plugin_init" function so that it doesn't need to be
duplicated in every plugin. */
extern int plugin_init (struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version);
-#ifdef __cplusplus
-}
-#endif
/* Function type for a plugin callback routine.
@@ -147,4 +147,19 @@ extern int unregister_callback (const char *plugin_name, int event);
-iplugindir program argument to cc1. */
extern const char* default_plugin_dir_name (void);
+#ifdef __cplusplus
+}
+#endif
+
+/* In case the C++ compiler does name mangling for globals, declare
+ plugin_is_GPL_compatible extern "C" so that a later definition
+ in a plugin file will have this linkage. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int plugin_is_GPL_compatible;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GCC_PLUGIN_H */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index a199f02b46d..6a0dae5c5a0 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -280,23 +280,6 @@ static const char *cross_compile = "1";
static const char *cross_compile = "0";
#endif
-#ifdef MODIFY_TARGET_NAME
-
-/* Information on how to alter the target name based on a command-line
- switch. The only case we support now is simply appending or deleting a
- string to or from the end of the first part of the configuration name. */
-
-enum add_del {ADD, DELETE};
-
-static const struct modify_target
-{
- const char *const sw;
- const enum add_del add_del;
- const char *const str;
-}
-modify_target[] = MODIFY_TARGET_NAME;
-#endif
-
/* Greatest exit code of sub-processes that has been encountered up to
now. */
static int greatest_status = 1;
@@ -399,6 +382,7 @@ static const char *replace_outfile_spec_function (int, const char **);
static const char *version_compare_spec_function (int, const char **);
static const char *include_spec_function (int, const char **);
static const char *find_file_spec_function (int, const char **);
+static const char *find_plugindir_spec_function (int, const char **);
static const char *print_asm_header_spec_function (int, const char **);
static const char *compare_debug_dump_opt_spec_function (int, const char **);
static const char *compare_debug_self_opt_spec_function (int, const char **);
@@ -680,18 +664,6 @@ proper position among the other output files. */
"%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
#endif
-/* config.h can define SWITCHES_NEED_SPACES to control which options
- require spaces between the option and the argument.
-
- We define SWITCHES_NEED_SPACES to include "o" by default. This
- causes "-ofoo.o" to be split into "-o foo.o" during the initial
- processing of the command-line, before being seen by the specs
- machinery. This makes sure we record "foo.o" as the temporary file
- to be deleted in the case of error, rather than "-ofoo.o". */
-#ifndef SWITCHES_NEED_SPACES
-#define SWITCHES_NEED_SPACES "o"
-#endif
-
/* config.h can define ENDFILE_SPEC to override the default crtn files. */
#ifndef ENDFILE_SPEC
#define ENDFILE_SPEC ""
@@ -827,7 +799,6 @@ static const char *link_gomp_spec = "";
static const char *libgcc_spec = LIBGCC_SPEC;
static const char *endfile_spec = ENDFILE_SPEC;
static const char *startfile_spec = STARTFILE_SPEC;
-static const char *switches_need_spaces = SWITCHES_NEED_SPACES;
static const char *linker_name_spec = LINKER_NAME;
static const char *linker_plugin_file_spec = "";
static const char *lto_wrapper_spec = "";
@@ -862,7 +833,7 @@ static const char *cpp_unique_options =
%{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
%{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\
%{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD}\
- %{!iplugindir*:%{fplugin*:-iplugindir=%:find-file(plugin)}}\
+ %{!iplugindir*:%{fplugin*:%:find-plugindir()}}\
%{H} %C %{D*&U*&A*} %{i*} %Z %i\
%{fmudflap:-D_MUDFLAP -include mf-runtime.h}\
%{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h}\
@@ -885,7 +856,7 @@ static const char *cpp_debug_options = "%{d*}";
/* NB: This is shared amongst all front-ends, except for Ada. */
static const char *cc1_options =
"%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{!iplugindir*:%{fplugin*:-iplugindir=%:find-file(plugin)}}\
+ %{!iplugindir*:%{fplugin*:%:find-plugindir()}}\
%1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*}\
%{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \
%{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}} \
@@ -1392,7 +1363,7 @@ translate_options (int *argcp, const char *const **argvp)
else if (strchr (arginfo, '*') != 0)
{
- error ("incomplete '%s' option", option_map[j].name);
+ error ("incomplete %qs option", option_map[j].name);
break;
}
@@ -1403,7 +1374,7 @@ translate_options (int *argcp, const char *const **argvp)
{
if (i + 1 == argc)
{
- error ("missing argument to '%s' option",
+ error ("missing argument to %qs option",
option_map[j].name);
break;
}
@@ -1416,7 +1387,7 @@ translate_options (int *argcp, const char *const **argvp)
else if (strchr (arginfo, 'o') == 0)
{
if (arg != 0)
- error ("extraneous argument to '%s' option",
+ error ("extraneous argument to %qs option",
option_map[j].name);
arg = 0;
}
@@ -1474,7 +1445,7 @@ translate_options (int *argcp, const char *const **argvp)
}
}
else
- /* Ordinary operands, or +e options. */
+ /* Ordinary operands. */
newv[newindex++] = argv[i++];
}
@@ -1667,7 +1638,6 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec),
INIT_STATIC_SPEC ("libgcc", &libgcc_spec),
INIT_STATIC_SPEC ("startfile", &startfile_spec),
- INIT_STATIC_SPEC ("switches_need_spaces", &switches_need_spaces),
INIT_STATIC_SPEC ("cross_compile", &cross_compile),
INIT_STATIC_SPEC ("version", &compiler_version),
INIT_STATIC_SPEC ("multilib", &multilib_select),
@@ -1719,6 +1689,7 @@ static const struct spec_function static_spec_functions[] =
{ "version-compare", version_compare_spec_function },
{ "include", include_spec_function },
{ "find-file", find_file_spec_function },
+ { "find-plugindir", find_plugindir_spec_function },
{ "print-asm-header", print_asm_header_spec_function },
{ "compare-debug-dump-opt", compare_debug_dump_opt_spec_function },
{ "compare-debug-self-opt", compare_debug_self_opt_spec_function },
@@ -2281,8 +2252,8 @@ read_specs (const char *filename, int main_p)
for (newsl = specs; newsl; newsl = newsl->next)
if (strcmp (newsl->name, p2) == 0)
- fatal_error ("%s: attempt to rename spec '%s' to "
- "already defined spec '%s'",
+ fatal_error ("%s: attempt to rename spec %qs to "
+ "already defined spec %qs",
filename, p1, p2);
if (verbose_flag)
@@ -2907,7 +2878,7 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
int require_machine_suffix, int os_multilib)
{
if (!IS_ABSOLUTE_PATH (prefix))
- fatal_error ("system path '%s' is not absolute", prefix);
+ fatal_error ("system path %qs is not absolute", prefix);
if (target_system_root)
{
@@ -3095,7 +3066,7 @@ execute (void)
? PEX_RECORD_TIMES : 0),
progname, temp_filename);
if (pex == NULL)
- pfatal_with_name (_("pex_init failed"));
+ fatal_error ("pex_init failed: %m");
for (i = 0; i < n_commands; i++)
{
@@ -3134,13 +3105,13 @@ execute (void)
statuses = (int *) alloca (n_commands * sizeof (int));
if (!pex_get_status (pex, n_commands, statuses))
- pfatal_with_name (_("failed to get exit status"));
+ fatal_error ("failed to get exit status: %m");
if (report_times || report_times_to_file)
{
times = (struct pex_time *) alloca (n_commands * sizeof (struct pex_time));
if (!pex_get_times (pex, n_commands, times))
- pfatal_with_name (_("failed to get process times"));
+ fatal_error ("failed to get process times: %m");
}
pex_free (pex);
@@ -3266,6 +3237,8 @@ static struct switchstr *switches;
static int n_switches;
+static int n_switches_alloc;
+
/* Set to zero if -fcompare-debug is disabled, positive if it's
enabled and we're running the first compilation, negative if it's
enabled and we're running the second compilation. For most of the
@@ -3311,6 +3284,8 @@ static struct infile *infiles;
int n_infiles;
+static int n_infiles_alloc;
+
/* True if multiple input files are being compiled to a single
assembly file. */
@@ -3495,6 +3470,51 @@ add_linker_option (const char *option, int len)
linker_options [n_linker_options - 1] = save_string (option, len);
}
+/* Allocate space for an input file in infiles. */
+
+static void
+alloc_infile (void)
+{
+ if (n_infiles_alloc == 0)
+ {
+ n_infiles_alloc = 16;
+ infiles = XNEWVEC (struct infile, n_infiles_alloc);
+ }
+ else if (n_infiles_alloc == n_infiles)
+ {
+ n_infiles_alloc *= 2;
+ infiles = XRESIZEVEC (struct infile, infiles, n_infiles_alloc);
+ }
+}
+
+/* Store an input file with the given NAME and LANGUAGE in
+ infiles. */
+
+static void
+add_infile (const char *name, const char *language)
+{
+ alloc_infile ();
+ infiles[n_infiles].name = name;
+ infiles[n_infiles++].language = language;
+}
+
+/* Allocate space for a switch in switches. */
+
+static void
+alloc_switch (void)
+{
+ if (n_switches_alloc == 0)
+ {
+ n_switches_alloc = 16;
+ switches = XNEWVEC (struct switchstr, n_switches_alloc);
+ }
+ else if (n_switches_alloc == n_switches)
+ {
+ n_switches_alloc *= 2;
+ switches = XRESIZEVEC (struct switchstr, switches, n_switches_alloc);
+ }
+}
+
/* Create the vector `switches' and its contents.
Store its length in `n_switches'. */
@@ -3506,11 +3526,6 @@ process_command (int argc, const char **argv)
char *temp1;
const char *spec_lang = 0;
int last_language_n_infiles;
- int lang_n_infiles = 0;
-#ifdef MODIFY_TARGET_NAME
- int is_modify_target_name;
- unsigned int j;
-#endif
const char *tooldir_prefix;
char *(*get_relative_prefix) (const char *, const char *,
const char *) = NULL;
@@ -3724,12 +3739,22 @@ process_command (int argc, const char **argv)
}
}
- /* Scan argv twice. Here, the first time, just count how many switches
- there will be in their vector, and how many input files in theirs.
- Here we also parse the switches that cc itself uses (e.g. -v). */
+ /* Process the options and store input files and switches in their
+ vectors. */
+
+ last_language_n_infiles = -1;
for (i = 1; i < argc; i++)
{
+ const char *p = NULL;
+ int c = 0;
+
+ if (argv[i][0] == '-' && argv[i][1] != 0)
+ {
+ p = &argv[i][1];
+ c = *p;
+ }
+
if (! strcmp (argv[i], "-dumpspecs"))
{
struct spec_list *sl;
@@ -3755,59 +3780,50 @@ process_command (int argc, const char **argv)
/* translate_options () has turned --version into -fversion. */
print_version = 1;
- /* We will be passing a dummy file on to the sub-processes. */
- n_infiles++;
- n_switches++;
-
/* CPP driver cannot obtain switch from cc1_options. */
if (is_cpp_driver)
add_preprocessor_option ("--version", strlen ("--version"));
add_assembler_option ("--version", strlen ("--version"));
add_linker_option ("--version", strlen ("--version"));
+
+ goto normal_switch;
}
else if (strcmp (argv[i], "-fhelp") == 0)
{
/* translate_options () has turned --help into -fhelp. */
print_help_list = 1;
- /* We will be passing a dummy file on to the sub-processes. */
- n_infiles++;
- n_switches++;
-
/* CPP driver cannot obtain switch from cc1_options. */
if (is_cpp_driver)
add_preprocessor_option ("--help", 6);
add_assembler_option ("--help", 6);
add_linker_option ("--help", 6);
+
+ goto normal_switch;
}
else if (strncmp (argv[i], "-fhelp=", 7) == 0)
{
/* translate_options () has turned --help into -fhelp. */
print_subprocess_help = 2;
- /* We will be passing a dummy file on to the sub-processes. */
- n_infiles++;
- n_switches++;
+ goto normal_switch;
}
else if (strcmp (argv[i], "-ftarget-help") == 0)
{
/* translate_options() has turned --target-help into -ftarget-help. */
print_subprocess_help = 1;
- /* We will be passing a dummy file on to the sub-processes. */
- n_infiles++;
- n_switches++;
-
/* CPP driver cannot obtain switch from cc1_options. */
if (is_cpp_driver)
add_preprocessor_option ("--target-help", 13);
add_assembler_option ("--target-help", 13);
add_linker_option ("--target-help", 13);
+
+ goto normal_switch;
}
else if (! strcmp (argv[i], "-pass-exit-codes"))
{
pass_exit_codes = 1;
- n_switches++;
}
else if (! strcmp (argv[i], "-print-search-dirs"))
print_search_dirs = 1;
@@ -3830,16 +3846,18 @@ process_command (int argc, const char **argv)
else if (! strcmp (argv[i], "-fcompare-debug-second"))
{
compare_debug_second = 1;
- n_switches++;
+ goto normal_switch;
}
else if (! strcmp (argv[i], "-fno-compare-debug"))
{
argv[i] = "-fcompare-debug=";
+ p = &argv[i][1];
goto compare_debug_with_arg;
}
else if (! strcmp (argv[i], "-fcompare-debug"))
{
argv[i] = "-fcompare-debug=-gtoggle";
+ p = &argv[i][1];
goto compare_debug_with_arg;
}
#define OPT "-fcompare-debug="
@@ -3857,7 +3875,7 @@ process_command (int argc, const char **argv)
compare_debug_opt = NULL;
else
compare_debug_opt = opt;
- n_switches++;
+ goto normal_switch;
}
else if (! strncmp (argv[i], "-Wa,", 4))
{
@@ -3893,63 +3911,73 @@ process_command (int argc, const char **argv)
/* Record the part after the last comma. */
add_preprocessor_option (argv[i] + prev, j - prev);
}
- else if (argv[i][0] == '+' && argv[i][1] == 'e')
- /* The +e options to the C++ front-end. */
- n_switches++;
else if (strncmp (argv[i], "-Wl,", 4) == 0)
{
- int j;
+ int prev, j;
/* Split the argument at commas. */
- for (j = 3; argv[i][j]; j++)
- n_infiles += (argv[i][j] == ',');
+ prev = 4;
+ for (j = 4; argv[i][j]; j++)
+ if (argv[i][j] == ',')
+ {
+ add_infile (save_string (argv[i] + prev, j - prev), "*");
+ prev = j + 1;
+ }
+ /* Record the part after the last comma. */
+ add_infile (argv[i] + prev, "*");
}
else if (strcmp (argv[i], "-Xlinker") == 0)
{
if (i + 1 == argc)
- fatal_error ("argument to '-Xlinker' is missing");
+ fatal_error ("argument to %<-Xlinker%> is missing");
- n_infiles++;
+ add_infile (argv[i+1], "*");
i++;
}
else if (strcmp (argv[i], "-Xpreprocessor") == 0)
{
if (i + 1 == argc)
- fatal_error ("argument to '-Xpreprocessor' is missing");
+ fatal_error ("argument to %<-Xpreprocessor%> is missing");
add_preprocessor_option (argv[i+1], strlen (argv[i+1]));
+ i++;
}
else if (strcmp (argv[i], "-Xassembler") == 0)
{
if (i + 1 == argc)
- fatal_error ("argument to '-Xassembler' is missing");
+ fatal_error ("argument to %<-Xassembler%> is missing");
add_assembler_option (argv[i+1], strlen (argv[i+1]));
+ i++;
}
else if (strcmp (argv[i], "-l") == 0)
{
if (i + 1 == argc)
- fatal_error ("argument to '-l' is missing");
+ fatal_error ("argument to %<-l%> is missing");
- n_infiles++;
+ /* POSIX allows separation of -l and the lib arg;
+ canonicalize by concatenating -l with its arg */
+ add_infile (concat ("-l", argv[i + 1], NULL), "*");
i++;
}
else if (strncmp (argv[i], "-l", 2) == 0)
- n_infiles++;
+ {
+ add_infile (argv[i], "*");
+ }
else if (strcmp (argv[i], "-save-temps") == 0)
{
save_temps_flag = SAVE_TEMPS_CWD;
- n_switches++;
+ goto normal_switch;
}
else if (strncmp (argv[i], "-save-temps=", 12) == 0)
{
- n_switches++;
if (strcmp (argv[i]+12, "cwd") == 0)
save_temps_flag = SAVE_TEMPS_CWD;
else if (strcmp (argv[i]+12, "obj") == 0
|| strcmp (argv[i]+12, "object") == 0)
save_temps_flag = SAVE_TEMPS_OBJ;
else
- fatal_error ("'%s' is an unknown -save-temps option", argv[i]);
+ fatal_error ("%qs is an unknown -save-temps option", argv[i]);
+ goto normal_switch;
}
else if (strcmp (argv[i], "-no-canonical-prefixes") == 0)
/* Already handled as a special case, so ignored here. */
@@ -3957,13 +3985,13 @@ process_command (int argc, const char **argv)
else if (strcmp (argv[i], "-combine") == 0)
{
combine_flag = 1;
- n_switches++;
+ goto normal_switch;
}
else if (strcmp (argv[i], "-specs") == 0)
{
struct user_specs *user = XNEW (struct user_specs);
if (++i >= argc)
- fatal_error ("argument to '-specs' is missing");
+ fatal_error ("argument to %<-specs%> is missing");
user->next = (struct user_specs *) 0;
user->filename = argv[i];
@@ -3977,7 +4005,7 @@ process_command (int argc, const char **argv)
{
struct user_specs *user = XNEW (struct user_specs);
if (strlen (argv[i]) == 7)
- fatal_error ("argument to '-specs=' is missing");
+ fatal_error ("argument to %<-specs=%> is missing");
user->next = (struct user_specs *) 0;
user->filename = argv[i] + 7;
@@ -3987,6 +4015,11 @@ process_command (int argc, const char **argv)
user_specs_head = user;
user_specs_tail = user;
}
+ else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
+ {
+ target_system_root = argv[i] + strlen ("--sysroot=");
+ target_system_root_changed = 1;
+ }
else if (strcmp (argv[i], "-time") == 0)
report_times = 1;
else if (strncmp (argv[i], "-time=", sizeof ("-time=") - 1) == 0)
@@ -4000,16 +4033,14 @@ process_command (int argc, const char **argv)
/* -pipe has to go into the switches array as well as
setting a flag. */
use_pipes = 1;
- n_switches++;
+ goto normal_switch;
}
else if (strcmp (argv[i], "-wrapper") == 0)
{
if (++i >= argc)
- fatal_error ("argument to '-wrapper' is missing");
+ fatal_error ("argument to %<-wrapper%> is missing");
wrapper_string = argv[i];
- n_switches++;
- n_switches++;
}
else if (strcmp (argv[i], "-###") == 0)
{
@@ -4022,9 +4053,6 @@ process_command (int argc, const char **argv)
}
else if (argv[i][0] == '-' && argv[i][1] != 0)
{
- const char *p = &argv[i][1];
- int c = *p;
-
switch (c)
{
case 'B':
@@ -4033,9 +4061,9 @@ process_command (int argc, const char **argv)
int len;
if (p[1] == 0 && i + 1 == argc)
- fatal_error ("argument to '-B' is missing");
+ fatal_error ("argument to %<-B%> is missing");
if (p[1] == 0)
- value = argv[++i];
+ value = argv[i + 1];
else
value = p + 1;
@@ -4064,28 +4092,38 @@ process_command (int argc, const char **argv)
PREFIX_PRIORITY_B_OPT, 0, 0);
add_prefix (&include_prefixes, value, NULL,
PREFIX_PRIORITY_B_OPT, 0, 0);
- n_switches++;
}
- break;
+ goto normal_switch;
case 'v': /* Print our subcommands and print versions. */
- n_switches++;
/* If they do anything other than exactly `-v', don't set
verbose_flag; rather, continue on to give the error. */
if (p[1] != 0)
break;
verbose_flag++;
+ goto normal_switch;
+
+ case 'x':
+ if (p[1] == 0 && i + 1 == argc)
+ fatal_error ("argument to %<-x%> is missing");
+ if (p[1] == 0)
+ spec_lang = argv[++i];
+ else
+ spec_lang = p + 1;
+ if (! strcmp (spec_lang, "none"))
+ /* Suppress the warning if -xnone comes after the last input
+ file, because alternate command interfaces like g++ might
+ find it useful to place -xnone after each input file. */
+ spec_lang = 0;
+ else
+ last_language_n_infiles = n_infiles;
break;
case 'S':
case 'c':
case 'E':
if (p[1] == 0)
- {
- have_c = 1;
- n_switches++;
- break;
- }
+ have_c = 1;
goto normal_switch;
case 'o':
@@ -4123,7 +4161,10 @@ process_command (int argc, const char **argv)
if (p[1] == 0)
argv[i + 1] = convert_filename (argv[i + 1], ! have_c, 0);
else
- argv[i] = convert_filename (argv[i], ! have_c, 0);
+ {
+ argv[i] = convert_filename (argv[i], ! have_c, 0);
+ p = &argv[i][1];
+ }
#endif
/* Save the output name in case -save-temps=obj was used. */
if ((p[1] == 0) && argv[i + 1])
@@ -4135,55 +4176,105 @@ process_command (int argc, const char **argv)
default:
normal_switch:
-#ifdef MODIFY_TARGET_NAME
- is_modify_target_name = 0;
-
- for (j = 0; j < ARRAY_SIZE (modify_target); j++)
- if (! strcmp (argv[i], modify_target[j].sw))
- {
- char *new_name = XNEWVEC (char, strlen (modify_target[j].str)
- + strlen (spec_machine));
- const char *p, *r;
- char *q;
- int made_addition = 0;
-
- is_modify_target_name = 1;
- for (p = spec_machine, q = new_name; *p != 0; )
- {
- if (modify_target[j].add_del == DELETE
- && (! strncmp (q, modify_target[j].str,
- strlen (modify_target[j].str))))
- p += strlen (modify_target[j].str);
- else if (modify_target[j].add_del == ADD
- && ! made_addition && *p == '-')
- {
- for (r = modify_target[j].str; *r != 0; )
- *q++ = *r++;
- made_addition = 1;
- }
-
- *q++ = *p++;
- }
-
- spec_machine = new_name;
- }
-
- if (is_modify_target_name)
- break;
-#endif
+ alloc_switch ();
+ switches[n_switches].part1 = p;
+ /* Deal with option arguments in separate argv elements. */
+ if ((SWITCH_TAKES_ARG (c) > (p[1] != 0))
+ || WORD_SWITCH_TAKES_ARG (p))
+ {
+ int j = 0;
+ int n_args = WORD_SWITCH_TAKES_ARG (p);
+ if (n_args == 0)
+ {
+ /* Count only the option arguments in separate
+ argv elements. */
+ n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
+ }
+ if (i + n_args >= argc)
+ fatal_error ("argument to %<-%s%> is missing", p);
+ switches[n_switches].args
+ = XNEWVEC (const char *, n_args + 1);
+ while (j < n_args)
+ switches[n_switches].args[j++] = argv[++i];
+ /* Null-terminate the vector. */
+ switches[n_switches].args[j] = 0;
+ }
+ else if (c == 'o')
+ {
+ /* On some systems, ld cannot handle "-o" without
+ a space. So split the option from its argument. */
+ char *part1 = XNEWVEC (char, 2);
+ part1[0] = c;
+ part1[1] = '\0';
+
+ switches[n_switches].part1 = part1;
+ switches[n_switches].args = XNEWVEC (const char *, 2);
+ switches[n_switches].args[0] = xstrdup (p+1);
+ switches[n_switches].args[1] = 0;
+ }
+ else
+ switches[n_switches].args = 0;
+
+ switches[n_switches].live_cond = 0;
+ switches[n_switches].validated = 0;
+ switches[n_switches].ordering = 0;
+ /* These are always valid, since gcc.c itself understands the
+ first four, gfortranspec.c understands -static-libgfortran
+ and g++spec.c understands -static-libstdc++ */
+ if (!strcmp (p, "save-temps")
+ || !strcmp (p, "static-libgcc")
+ || !strcmp (p, "shared-libgcc")
+ || !strcmp (p, "pipe")
+ || !strcmp (p, "static-libgfortran")
+ || !strcmp (p, "static-libstdc++"))
+ switches[n_switches].validated = 1;
+ else
+ {
+ char ch = switches[n_switches].part1[0];
+ if (ch == 'B')
+ switches[n_switches].validated = 1;
+ }
n_switches++;
-
- if (SWITCH_TAKES_ARG (c) > (p[1] != 0))
- i += SWITCH_TAKES_ARG (c) - (p[1] != 0);
- else if (WORD_SWITCH_TAKES_ARG (p))
- i += WORD_SWITCH_TAKES_ARG (p);
}
}
else
{
- n_infiles++;
- lang_n_infiles++;
+ const char *p = strrchr (argv[i], '@');
+ char *fname;
+ long offset;
+ int consumed;
+#ifdef HAVE_TARGET_OBJECT_SUFFIX
+ argv[i] = convert_filename (argv[i], 0, access (argv[i], F_OK));
+#endif
+ /* For LTO static archive support we handle input file
+ specifications that are composed of a filename and
+ an offset like FNAME@OFFSET. */
+ if (p
+ && p != argv[i]
+ && sscanf (p, "@%li%n", &offset, &consumed) >= 1
+ && strlen (p) == (unsigned int)consumed)
+ {
+ fname = (char *)xmalloc (p - argv[i] + 1);
+ memcpy (fname, argv[i], p - argv[i]);
+ fname[p - argv[i]] = '\0';
+ /* Only accept non-stdin and existing FNAME parts, otherwise
+ try with the full name. */
+ if (strcmp (fname, "-") == 0 || access (fname, F_OK) < 0)
+ {
+ free (fname);
+ fname = xstrdup (argv[i]);
+ }
+ }
+ else
+ fname = xstrdup (argv[i]);
+
+ if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0)
+ perror_with_name (fname);
+ else
+ add_infile (argv[i], spec_lang);
+
+ free (fname);
}
}
@@ -4222,13 +4313,11 @@ process_command (int argc, const char **argv)
{
compare_debug = 2;
compare_debug_opt = gcd;
- n_switches++;
}
else if (gcd && *gcd && strcmp (gcd, "0"))
{
compare_debug = 3;
compare_debug_opt = "-gtoggle";
- n_switches++;
}
}
else if (compare_debug < 0)
@@ -4281,7 +4370,7 @@ process_command (int argc, const char **argv)
then consider it to relocate with the rest of the GCC installation
if GCC_EXEC_PREFIX is set.
``make_relative_prefix'' is not compiled for VMS, so don't call it. */
- if (target_system_root && gcc_exec_prefix)
+ if (target_system_root && !target_system_root_changed && gcc_exec_prefix)
{
char *tmp_prefix = get_relative_prefix (argv[0],
standard_bindir_prefix,
@@ -4297,256 +4386,12 @@ process_command (int argc, const char **argv)
/* More prefixes are enabled in main, after we read the specs file
and determine whether this is cross-compilation or not. */
- /* Then create the space for the vectors and scan again. */
-
- switches = XNEWVEC (struct switchstr, n_switches + 1);
- infiles = XNEWVEC (struct infile, n_infiles + 1);
- n_switches = 0;
- n_infiles = 0;
- last_language_n_infiles = -1;
-
- /* This, time, copy the text of each switch and store a pointer
- to the copy in the vector of switches.
- Store all the infiles in their vector. */
-
- for (i = 1; i < argc; i++)
- {
- /* Just skip the switches that were handled by the preceding loop. */
-#ifdef MODIFY_TARGET_NAME
- is_modify_target_name = 0;
-
- for (j = 0; j < ARRAY_SIZE (modify_target); j++)
- if (! strcmp (argv[i], modify_target[j].sw))
- is_modify_target_name = 1;
-
- if (is_modify_target_name)
- ;
- else
-#endif
- if (! strncmp (argv[i], "-Wa,", 4))
- ;
- else if (! strncmp (argv[i], "-Wp,", 4))
- ;
- else if (! strcmp (argv[i], "-no-canonical-prefixes"))
- ;
- else if (! strcmp (argv[i], "-pass-exit-codes"))
- ;
- else if (! strcmp (argv[i], "-print-search-dirs"))
- ;
- else if (! strcmp (argv[i], "-print-libgcc-file-name"))
- ;
- else if (! strncmp (argv[i], "-print-file-name=", 17))
- ;
- else if (! strncmp (argv[i], "-print-prog-name=", 17))
- ;
- else if (! strcmp (argv[i], "-print-multi-lib"))
- ;
- else if (! strcmp (argv[i], "-print-multi-directory"))
- ;
- else if (! strcmp (argv[i], "-print-sysroot"))
- ;
- else if (! strcmp (argv[i], "-print-multi-os-directory"))
- ;
- else if (! strcmp (argv[i], "-print-sysroot-headers-suffix"))
- ;
- else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
- {
- target_system_root = argv[i] + strlen ("--sysroot=");
- target_system_root_changed = 1;
- }
- else if (argv[i][0] == '+' && argv[i][1] == 'e')
- {
- /* Compensate for the +e options to the C++ front-end;
- they're there simply for cfront call-compatibility. We do
- some magic in default_compilers to pass them down properly.
- Note we deliberately start at the `+' here, to avoid passing
- -e0 or -e1 down into the linker. */
- switches[n_switches].part1 = &argv[i][0];
- switches[n_switches].args = 0;
- switches[n_switches].live_cond = 0;
- switches[n_switches].validated = 0;
- n_switches++;
- }
- else if (strncmp (argv[i], "-Wl,", 4) == 0)
- {
- int prev, j;
- /* Split the argument at commas. */
- prev = 4;
- for (j = 4; argv[i][j]; j++)
- if (argv[i][j] == ',')
- {
- infiles[n_infiles].language = "*";
- infiles[n_infiles++].name
- = save_string (argv[i] + prev, j - prev);
- prev = j + 1;
- }
- /* Record the part after the last comma. */
- infiles[n_infiles].language = "*";
- infiles[n_infiles++].name = argv[i] + prev;
- }
- else if (strcmp (argv[i], "-Xlinker") == 0)
- {
- infiles[n_infiles].language = "*";
- infiles[n_infiles++].name = argv[++i];
- }
- /* Xassembler and Xpreprocessor were already handled in the first argv
- scan, so all we need to do here is ignore them and their argument. */
- else if (strcmp (argv[i], "-Xassembler") == 0)
- i++;
- else if (strcmp (argv[i], "-Xpreprocessor") == 0)
- i++;
- else if (strcmp (argv[i], "-l") == 0)
- { /* POSIX allows separation of -l and the lib arg;
- canonicalize by concatenating -l with its arg */
- infiles[n_infiles].language = "*";
- infiles[n_infiles++].name = concat ("-l", argv[++i], NULL);
- }
- else if (strncmp (argv[i], "-l", 2) == 0)
- {
- infiles[n_infiles].language = "*";
- infiles[n_infiles++].name = argv[i];
- }
- else if (strcmp (argv[i], "-wrapper") == 0)
- i++;
- else if (strcmp (argv[i], "-specs") == 0)
- i++;
- else if (strncmp (argv[i], "-specs=", 7) == 0)
- ;
- else if (strcmp (argv[i], "-time") == 0)
- ;
- else if (strncmp (argv[i], "-time=", sizeof ("-time=") - 1) == 0)
- ;
- else if (strcmp (argv[i], "-###") == 0)
- ;
- else if (argv[i][0] == '-' && argv[i][1] != 0)
- {
- const char *p = &argv[i][1];
- int c = *p;
-
- if (c == 'x')
- {
- if (p[1] == 0 && i + 1 == argc)
- fatal_error ("argument to '-x' is missing");
- if (p[1] == 0)
- spec_lang = argv[++i];
- else
- spec_lang = p + 1;
- if (! strcmp (spec_lang, "none"))
- /* Suppress the warning if -xnone comes after the last input
- file, because alternate command interfaces like g++ might
- find it useful to place -xnone after each input file. */
- spec_lang = 0;
- else
- last_language_n_infiles = n_infiles;
- continue;
- }
- switches[n_switches].part1 = p;
- /* Deal with option arguments in separate argv elements. */
- if ((SWITCH_TAKES_ARG (c) > (p[1] != 0))
- || WORD_SWITCH_TAKES_ARG (p))
- {
- int j = 0;
- int n_args = WORD_SWITCH_TAKES_ARG (p);
-
- if (n_args == 0)
- {
- /* Count only the option arguments in separate argv elements. */
- n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
- }
- if (i + n_args >= argc)
- fatal_error ("argument to '-%s' is missing", p);
- switches[n_switches].args
- = XNEWVEC (const char *, n_args + 1);
- while (j < n_args)
- switches[n_switches].args[j++] = argv[++i];
- /* Null-terminate the vector. */
- switches[n_switches].args[j] = 0;
- }
- else if (strchr (switches_need_spaces, c))
- {
- /* On some systems, ld cannot handle some options without
- a space. So split the option from its argument. */
- char *part1 = XNEWVEC (char, 2);
- part1[0] = c;
- part1[1] = '\0';
-
- switches[n_switches].part1 = part1;
- switches[n_switches].args = XNEWVEC (const char *, 2);
- switches[n_switches].args[0] = xstrdup (p+1);
- switches[n_switches].args[1] = 0;
- }
- else
- switches[n_switches].args = 0;
-
- switches[n_switches].live_cond = 0;
- switches[n_switches].validated = 0;
- switches[n_switches].ordering = 0;
- /* These are always valid, since gcc.c itself understands the
- first four, gfortranspec.c understands -static-libgfortran
- and g++spec.c understands -static-libstdc++ */
- if (!strcmp (p, "save-temps")
- || !strcmp (p, "static-libgcc")
- || !strcmp (p, "shared-libgcc")
- || !strcmp (p, "pipe")
- || !strcmp (p, "static-libgfortran")
- || !strcmp (p, "static-libstdc++"))
- switches[n_switches].validated = 1;
- else
- {
- char ch = switches[n_switches].part1[0];
- if (ch == 'B')
- switches[n_switches].validated = 1;
- }
- n_switches++;
- }
- else
- {
- const char *p = strrchr (argv[i], '@');
- char *fname;
- long offset;
- int consumed;
-#ifdef HAVE_TARGET_OBJECT_SUFFIX
- argv[i] = convert_filename (argv[i], 0, access (argv[i], F_OK));
-#endif
- /* For LTO static archive support we handle input file
- specifications that are composed of a filename and
- an offset like FNAME@OFFSET. */
- if (p
- && p != argv[i]
- && sscanf (p, "@%li%n", &offset, &consumed) >= 1
- && strlen (p) == (unsigned int)consumed)
- {
- fname = (char *)xmalloc (p - argv[i] + 1);
- memcpy (fname, argv[i], p - argv[i]);
- fname[p - argv[i]] = '\0';
- /* Only accept non-stdin and existing FNAME parts, otherwise
- try with the full name. */
- if (strcmp (fname, "-") == 0 || access (fname, F_OK) < 0)
- {
- free (fname);
- fname = xstrdup (argv[i]);
- }
- }
- else
- fname = xstrdup (argv[i]);
-
- if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0)
- perror_with_name (fname);
- else
- {
- infiles[n_infiles].language = spec_lang;
- infiles[n_infiles++].name = argv[i];
- }
-
- free (fname);
- }
- }
-
if (n_infiles == last_language_n_infiles && spec_lang != 0)
- warning (0, "'-x %s' after last input file has no effect", spec_lang);
+ warning (0, "%<-x %s%> after last input file has no effect", spec_lang);
if (compare_debug == 2 || compare_debug == 3)
{
+ alloc_switch ();
switches[n_switches].part1 = concat ("fcompare-debug=",
compare_debug_opt,
NULL);
@@ -4561,15 +4406,16 @@ process_command (int argc, const char **argv)
/* Ensure we only invoke each subprocess once. */
if (print_subprocess_help || print_help_list || print_version)
{
- n_infiles = 1;
+ n_infiles = 0;
/* Create a dummy input file, so that we can pass
the help option on to the various sub-processes. */
- infiles[0].language = "c";
- infiles[0].name = "help-dummy";
+ add_infile ("help-dummy", "c");
}
+ alloc_switch ();
switches[n_switches].part1 = 0;
+ alloc_infile ();
infiles[n_infiles].name = 0;
}
@@ -4706,7 +4552,7 @@ end_going_arg (void)
if (full_script_path == NULL)
{
- error ("unable to locate default linker script '%s' in the library search paths", string);
+ error ("unable to locate default linker script %qs in the library search paths", string);
/* Script was not found on search path. */
return;
}
@@ -4894,7 +4740,7 @@ do_self_spec (const char *spec)
/* Each switch should start with '-'. */
if (c != '-')
- fatal_error ("switch '%s' does not start with '-'", argbuf[i]);
+ fatal_error ("switch %qs does not start with %<-%>", argbuf[i]);
p++;
c = *p;
@@ -4918,7 +4764,7 @@ do_self_spec (const char *spec)
n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
}
if (i + n_args >= argbuf_index)
- fatal_error ("argument to '-%s' is missing", p);
+ fatal_error ("argument to %<-%s%> is missing", p);
sw->args
= XNEWVEC (const char *, n_args + 1);
while (j < n_args)
@@ -4926,9 +4772,9 @@ do_self_spec (const char *spec)
/* Null-terminate the vector. */
sw->args[j] = 0;
}
- else if (strchr (switches_need_spaces, c))
+ else if (c == 'o')
{
- /* On some systems, ld cannot handle some options without
+ /* On some systems, ld cannot handle "-o" without
a space. So split the option from its argument. */
char *part1 = XNEWVEC (char, 2);
part1[0] = c;
@@ -5124,7 +4970,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
switch (c = *p++)
{
case 0:
- fatal_error ("spec '%s' invalid", spec);
+ fatal_error ("spec %qs invalid", spec);
case 'b':
if (save_temps_length)
@@ -5273,7 +5119,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
p += 2;
/* We don't support extra suffix characters after %O. */
if (*p == '.' || ISALNUM ((unsigned char) *p))
- fatal_error ("spec '%s' has invalid '%%0%c'", spec, *p);
+ fatal_error ("spec %qs has invalid %<%%0%c%>", spec, *p);
if (suffix_length == 0)
suffix = TARGET_OBJECT_SUFFIX;
else
@@ -5584,7 +5430,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
int cur_index = argbuf_index;
/* Handle the {...} following the %W. */
if (*p != '{')
- fatal_error ("spec '%s' has invalid '%%W%c", spec, *p);
+ fatal_error ("spec %qs has invalid %<%%W%c%>", spec, *p);
p = handle_braces (p + 1);
if (p == 0)
return -1;
@@ -5604,7 +5450,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
/* Skip past the option value and make a copy. */
if (*p != '{')
- fatal_error ("spec '%s' has invalid '%%x%c'", spec, *p);
+ fatal_error ("spec %qs has invalid %<%%x%c%>", spec, *p);
while (*p++ != '}')
;
string = save_string (p1 + 1, p - p1 - 2);
@@ -5799,7 +5645,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
/* Catch the case where a spec string contains something like
'%{foo:%*}'. i.e. there is no * in the pattern on the left
hand side of the :. */
- error ("spec failure: '%%*' has not been initialized by pattern match");
+ error ("spec failure: %<%%*%> has not been initialized by pattern match");
break;
/* Process a string found as the value of a spec given by name.
@@ -5889,7 +5735,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
break;
default:
- error ("spec failure: unrecognized spec option '%c'", c);
+ error ("spec failure: unrecognized spec option %qc", c);
break;
}
break;
@@ -5951,7 +5797,7 @@ eval_spec_function (const char *func, const char *args)
sf = lookup_spec_function (func);
if (sf == NULL)
- fatal_error ("unknown spec function '%s'", func);
+ fatal_error ("unknown spec function %qs", func);
/* Push the spec processing context. */
save_argbuf_index = argbuf_index;
@@ -5971,7 +5817,7 @@ eval_spec_function (const char *func, const char *args)
alloc_args ();
if (do_spec_2 (args) < 0)
- fatal_error ("error in args to spec function '%s'", func);
+ fatal_error ("error in args to spec function %qs", func);
/* argbuf_index is an index for the next argument to be inserted, and
so contains the count of the args already inserted. */
@@ -6288,7 +6134,7 @@ handle_braces (const char *p)
return p;
invalid:
- fatal_error ("braced spec '%s' is invalid at '%c'", orig, *p);
+ fatal_error ("braced spec %qs is invalid at %qc", orig, *p);
#undef SKIP_WHITE
}
@@ -6376,7 +6222,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom,
return p;
invalid:
- fatal_error ("braced spec body '%s' is invalid", body);
+ fatal_error ("braced spec body %qs is invalid", body);
}
/* Return 0 iff switch number SWITCHNUM is obsoleted by a later switch
@@ -7074,7 +6920,7 @@ main (int argc, char **argv)
for (i = 0; (int) i < n_switches; i++)
if (! switches[i].validated)
- error ("unrecognized option '-%s'", switches[i].part1);
+ error ("unrecognized option %<-%s%>", switches[i].part1);
/* Obey some of the options. */
@@ -7317,7 +7163,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
value = do_spec (input_file_compiler->spec);
infiles[i].preprocessed = true;
if (!have_o_argbuf_index)
- fatal_error ("spec '%s' is invalid",
+ fatal_error ("spec %qs is invalid",
input_file_compiler->spec);
infiles[i].name = argbuf[have_o_argbuf_index];
infiles[i].incompiler
@@ -7654,7 +7500,7 @@ pfatal_with_name (const char *name)
static void
perror_with_name (const char *name)
{
- error ("%s: %s", name, xstrerror (errno));
+ error ("%s: %m", name);
}
static inline void
@@ -7809,7 +7655,7 @@ used_arg (const char *p, int len)
if (*q == '\0')
{
invalid_matches:
- fatal_error ("multilib spec '%s' is invalid",
+ fatal_error ("multilib spec %qs is invalid",
multilib_matches);
}
q++;
@@ -8001,7 +7847,7 @@ set_multilib_dir (void)
if (*p == '\0')
{
invalid_exclusions:
- fatal_error ("multilib exclusions '%s' is invalid",
+ fatal_error ("multilib exclusions %qs is invalid",
multilib_exclusions);
}
@@ -8059,7 +7905,7 @@ set_multilib_dir (void)
if (*p == '\0')
{
invalid_select:
- fatal_error ("multilib select '%s' is invalid",
+ fatal_error ("multilib select %qs is invalid",
multilib_select);
}
++p;
@@ -8200,7 +8046,7 @@ print_multilib_info (void)
if (*p == '\0')
{
invalid_select:
- fatal_error ("multilib select '%s' is invalid", multilib_select);
+ fatal_error ("multilib select %qs is invalid", multilib_select);
}
++p;
@@ -8238,7 +8084,7 @@ print_multilib_info (void)
if (*e == '\0')
{
invalid_exclusion:
- fatal_error ("multilib exclusion '%s' is invalid",
+ fatal_error ("multilib exclusion %qs is invalid",
multilib_exclusions);
}
@@ -8444,7 +8290,7 @@ getenv_spec_function (int argc, const char **argv)
value = getenv (argv[0]);
if (!value)
- fatal_error ("environment variable \"%s\" not defined", argv[0]);
+ fatal_error ("environment variable %qs not defined", argv[0]);
/* We have to escape every character of the environment variable so
they are not interpreted as active spec characters. A
@@ -8535,12 +8381,12 @@ compare_version_strings (const char *v1, const char *v2)
abort ();
rresult = regexec (&r, v1, 0, NULL, 0);
if (rresult == REG_NOMATCH)
- fatal_error ("invalid version number `%s'", v1);
+ fatal_error ("invalid version number %qs", v1);
else if (rresult != 0)
abort ();
rresult = regexec (&r, v2, 0, NULL, 0);
if (rresult == REG_NOMATCH)
- fatal_error ("invalid version number `%s'", v2);
+ fatal_error ("invalid version number %qs", v2);
else if (rresult != 0)
abort ();
@@ -8630,7 +8476,7 @@ version_compare_spec_function (int argc, const char **argv)
break;
default:
- fatal_error ("unknown operator '%s' in %%:version-compare", argv[0]);
+ fatal_error ("unknown operator %qs in %%:version-compare", argv[0]);
}
if (! result)
return NULL;
@@ -8657,11 +8503,11 @@ include_spec_function (int argc, const char **argv)
return NULL;
}
-/* %:find-file spec function. This function replace its argument by
+/* %:find-file spec function. This function replaces its argument by
the file found thru find_file, that is the -print-file-name gcc
program option. */
static const char *
-find_file_spec_function (int argc, const char**argv)
+find_file_spec_function (int argc, const char **argv)
{
const char *file;
@@ -8673,6 +8519,22 @@ find_file_spec_function (int argc, const char**argv)
}
+/* %:find-plugindir spec function. This function replaces its argument
+ by the -iplugindir=<dir> option. `dir' is found thru find_file, that
+ is the -print-file-name gcc program option. */
+static const char *
+find_plugindir_spec_function (int argc, const char **argv ATTRIBUTE_UNUSED)
+{
+ const char *option;
+
+ if (argc != 0)
+ abort ();
+
+ option = concat ("-iplugindir=", find_file ("plugin"), NULL);
+ return option;
+}
+
+
/* %:print-asm-header spec function. Print a banner to say that the
following output is from the assembler. */
diff --git a/gcc/genattr.c b/gcc/genattr.c
index 18bba53034d..4fd22e219e3 100644
--- a/gcc/genattr.c
+++ b/gcc/genattr.c
@@ -1,6 +1,6 @@
/* Generate attribute information (insn-attr.h) from machine description.
- Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003, 2004, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003, 2004, 2007, 2008,
+ 2010 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GCC.
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
+#include "read-md.h"
#include "gensupport.h"
@@ -39,36 +40,48 @@ write_upcase (const char *str)
putchar (TOUPPER(*str));
}
+static VEC (rtx, heap) *const_attrs, *reservations;
+
+
static void
gen_attr (rtx attr)
{
const char *p, *tag;
int is_const = GET_CODE (XEXP (attr, 2)) == CONST;
+ if (is_const)
+ VEC_safe_push (rtx, heap, const_attrs, attr);
+
printf ("#define HAVE_ATTR_%s\n", XSTR (attr, 0));
/* If numeric attribute, don't need to write an enum. */
- p = XSTR (attr, 1);
- if (*p == '\0')
- printf ("extern int get_attr_%s (%s);\n", XSTR (attr, 0),
- (is_const ? "void" : "rtx"));
+ if (GET_CODE (attr) == DEFINE_ENUM_ATTR)
+ printf ("extern enum %s get_attr_%s (%s);\n\n",
+ XSTR (attr, 1), XSTR (attr, 0), (is_const ? "void" : "rtx"));
else
{
- printf ("enum attr_%s {", XSTR (attr, 0));
-
- while ((tag = scan_comma_elt (&p)) != 0)
+ p = XSTR (attr, 1);
+ if (*p == '\0')
+ printf ("extern int get_attr_%s (%s);\n", XSTR (attr, 0),
+ (is_const ? "void" : "rtx"));
+ else
{
- write_upcase (XSTR (attr, 0));
- putchar ('_');
- while (tag != p)
- putchar (TOUPPER (*tag++));
- if (*p == ',')
- fputs (", ", stdout);
- }
+ printf ("enum attr_%s {", XSTR (attr, 0));
+
+ while ((tag = scan_comma_elt (&p)) != 0)
+ {
+ write_upcase (XSTR (attr, 0));
+ putchar ('_');
+ while (tag != p)
+ putchar (TOUPPER (*tag++));
+ if (*p == ',')
+ fputs (", ", stdout);
+ }
+ fputs ("};\n", stdout);
- fputs ("};\n", stdout);
- printf ("extern enum attr_%s get_attr_%s (%s);\n\n",
- XSTR (attr, 0), XSTR (attr, 0), (is_const ? "void" : "rtx"));
+ printf ("extern enum attr_%s get_attr_%s (%s);\n\n",
+ XSTR (attr, 0), XSTR (attr, 0), (is_const ? "void" : "rtx"));
+ }
}
/* If `length' attribute, write additional function definitions and define
@@ -85,6 +98,68 @@ extern int insn_current_length (rtx);\n\n\
}
}
+/* Check that attribute NAME is used in define_insn_reservation condition
+ EXP. Return true if it is. */
+static bool
+check_tune_attr (const char *name, rtx exp)
+{
+ switch (GET_CODE (exp))
+ {
+ case AND:
+ if (check_tune_attr (name, XEXP (exp, 0)))
+ return true;
+ return check_tune_attr (name, XEXP (exp, 1));
+
+ case IOR:
+ return (check_tune_attr (name, XEXP (exp, 0))
+ && check_tune_attr (name, XEXP (exp, 1)));
+
+ case EQ_ATTR:
+ return strcmp (XSTR (exp, 0), name) == 0;
+
+ default:
+ return false;
+ }
+}
+
+/* Try to find a const attribute (usually cpu or tune) that is used
+ in all define_insn_reservation conditions. */
+static bool
+find_tune_attr (rtx exp)
+{
+ unsigned int i;
+ rtx attr;
+
+ switch (GET_CODE (exp))
+ {
+ case AND:
+ case IOR:
+ if (find_tune_attr (XEXP (exp, 0)))
+ return true;
+ return find_tune_attr (XEXP (exp, 1));
+
+ case EQ_ATTR:
+ if (strcmp (XSTR (exp, 0), "alternative") == 0)
+ return false;
+
+ for (i = 0; VEC_iterate (rtx, const_attrs, i, attr); i++)
+ if (strcmp (XSTR (attr, 0), XSTR (exp, 0)) == 0)
+ {
+ unsigned int j;
+ rtx resv;
+
+ for (j = 0; VEC_iterate (rtx, reservations, j, resv); j++)
+ if (! check_tune_attr (XSTR (attr, 0), XEXP (resv, 2)))
+ return false;
+ return true;
+ }
+ return false;
+
+ default:
+ return false;
+ }
+}
+
int
main (int argc, char **argv)
{
@@ -97,7 +172,7 @@ main (int argc, char **argv)
progname = "genattr";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
puts ("/* Generated automatically by the program `genattr'");
@@ -121,7 +196,8 @@ main (int argc, char **argv)
if (desc == NULL)
break;
- if (GET_CODE (desc) == DEFINE_ATTR)
+ if (GET_CODE (desc) == DEFINE_ATTR
+ || GET_CODE (desc) == DEFINE_ENUM_ATTR)
gen_attr (desc);
else if (GET_CODE (desc) == DEFINE_DELAY)
@@ -154,11 +230,16 @@ main (int argc, char **argv)
}
else if (GET_CODE (desc) == DEFINE_INSN_RESERVATION)
- num_insn_reservations++;
+ {
+ num_insn_reservations++;
+ VEC_safe_push (rtx, heap, reservations, desc);
+ }
}
if (num_insn_reservations > 0)
{
+ bool has_tune_attr
+ = find_tune_attr (XEXP (VEC_index (rtx, reservations, 0), 2));
/* Output interface for pipeline hazards recognition based on
DFA (deterministic finite state automata. */
printf ("\n#define INSN_SCHEDULING\n");
@@ -173,10 +254,24 @@ main (int argc, char **argv)
printf ("#define CPU_UNITS_QUERY 0\n");
printf ("#endif\n\n");
/* Interface itself: */
- printf ("/* Internal insn code number used by automata. */\n");
- printf ("extern int internal_dfa_insn_code (rtx);\n\n");
- printf ("/* Insn latency time defined in define_insn_reservation. */\n");
- printf ("extern int insn_default_latency (rtx);\n\n");
+ if (has_tune_attr)
+ {
+ printf ("/* Initialize fn pointers for internal_dfa_insn_code\n");
+ printf (" and insn_default_latency. */\n");
+ printf ("extern void init_sched_attrs (void);\n\n");
+ printf ("/* Internal insn code number used by automata. */\n");
+ printf ("extern int (*internal_dfa_insn_code) (rtx);\n\n");
+ printf ("/* Insn latency time defined in define_insn_reservation. */\n");
+ printf ("extern int (*insn_default_latency) (rtx);\n\n");
+ }
+ else
+ {
+ printf ("#define init_sched_attrs() do { } while (0)\n\n");
+ printf ("/* Internal insn code number used by automata. */\n");
+ printf ("extern int internal_dfa_insn_code (rtx);\n\n");
+ printf ("/* Insn latency time defined in define_insn_reservation. */\n");
+ printf ("extern int insn_default_latency (rtx);\n\n");
+ }
printf ("/* Return nonzero if there is a bypass for given insn\n");
printf (" which is a data producer. */\n");
printf ("extern int bypass_p (rtx);\n\n");
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 1a9ebd22eaf..a86332d49e3 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -1,6 +1,6 @@
/* Generate code from machine description to compute values of attributes.
Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
@@ -109,9 +109,11 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
-#include "gensupport.h"
#include "obstack.h"
#include "errors.h"
+#include "read-md.h"
+#include "gensupport.h"
+#include "vecprim.h"
/* Flags for make_internal_attr's `special' parameter. */
#define ATTR_NONE 0
@@ -170,6 +172,7 @@ struct attr_value
struct attr_desc
{
char *name; /* Name of attribute. */
+ const char *enum_name; /* Enum name for DEFINE_ENUM_NAME. */
struct attr_desc *next; /* Next attribute. */
struct attr_value *first_value; /* First value of this attribute. */
struct attr_value *default_val; /* Default value for this attribute. */
@@ -275,7 +278,7 @@ static void write_attr_valueq (struct attr_desc *, const char *);
static struct attr_value *find_most_used (struct attr_desc *);
static void write_attr_set (struct attr_desc *, int, rtx,
const char *, const char *, rtx,
- int, int);
+ int, int, unsigned int);
static void write_attr_case (struct attr_desc *, struct attr_value *,
int, const char *, const char *, int, rtx);
static void write_attr_value (struct attr_desc *, rtx);
@@ -885,19 +888,17 @@ check_attr_value (rtx exp, struct attr_desc *attr)
case CONST_INT:
if (attr && ! attr->is_numeric)
{
- message_with_line (attr->lineno,
- "CONST_INT not valid for non-numeric attribute %s",
- attr->name);
- have_error = 1;
+ error_with_line (attr->lineno,
+ "CONST_INT not valid for non-numeric attribute %s",
+ attr->name);
break;
}
if (INTVAL (exp) < 0)
{
- message_with_line (attr->lineno,
- "negative numeric value specified for attribute %s",
- attr->name);
- have_error = 1;
+ error_with_line (attr->lineno,
+ "negative numeric value specified for attribute %s",
+ attr->name);
break;
}
break;
@@ -912,10 +913,9 @@ check_attr_value (rtx exp, struct attr_desc *attr)
for (; *p; p++)
if (! ISDIGIT (*p))
{
- message_with_line (attr ? attr->lineno : 0,
- "non-numeric value for numeric attribute %s",
- attr ? attr->name : "internal");
- have_error = 1;
+ error_with_line (attr ? attr->lineno : 0,
+ "non-numeric value for numeric attribute %s",
+ attr ? attr->name : "internal");
break;
}
break;
@@ -927,12 +927,9 @@ check_attr_value (rtx exp, struct attr_desc *attr)
break;
if (av == NULL)
- {
- message_with_line (attr->lineno,
- "unknown value `%s' for `%s' attribute",
- XSTR (exp, 0), attr ? attr->name : "internal");
- have_error = 1;
- }
+ error_with_line (attr->lineno,
+ "unknown value `%s' for `%s' attribute",
+ XSTR (exp, 0), attr ? attr->name : "internal");
break;
case IF_THEN_ELSE:
@@ -950,10 +947,9 @@ check_attr_value (rtx exp, struct attr_desc *attr)
case MOD:
if (attr && !attr->is_numeric)
{
- message_with_line (attr->lineno,
- "invalid operation `%s' for non-numeric attribute value",
- GET_RTX_NAME (GET_CODE (exp)));
- have_error = 1;
+ error_with_line (attr->lineno,
+ "invalid operation `%s' for non-numeric"
+ " attribute value", GET_RTX_NAME (GET_CODE (exp)));
break;
}
/* Fall through. */
@@ -976,9 +972,8 @@ check_attr_value (rtx exp, struct attr_desc *attr)
case COND:
if (XVECLEN (exp, 0) % 2 != 0)
{
- message_with_line (attr->lineno,
- "first operand of COND must have even length");
- have_error = 1;
+ error_with_line (attr->lineno,
+ "first operand of COND must have even length");
break;
}
@@ -998,27 +993,18 @@ check_attr_value (rtx exp, struct attr_desc *attr)
{
struct attr_desc *attr2 = find_attr (&XSTR (exp, 0), 0);
if (attr2 == NULL)
- {
- message_with_line (attr ? attr->lineno : 0,
- "unknown attribute `%s' in ATTR",
- XSTR (exp, 0));
- have_error = 1;
- }
+ error_with_line (attr ? attr->lineno : 0,
+ "unknown attribute `%s' in ATTR",
+ XSTR (exp, 0));
else if (attr && attr->is_const && ! attr2->is_const)
- {
- message_with_line (attr->lineno,
- "non-constant attribute `%s' referenced from `%s'",
- XSTR (exp, 0), attr->name);
- have_error = 1;
- }
+ error_with_line (attr->lineno,
+ "non-constant attribute `%s' referenced from `%s'",
+ XSTR (exp, 0), attr->name);
else if (attr
&& attr->is_numeric != attr2->is_numeric)
- {
- message_with_line (attr->lineno,
- "numeric attribute mismatch calling `%s' from `%s'",
- XSTR (exp, 0), attr->name);
- have_error = 1;
- }
+ error_with_line (attr->lineno,
+ "numeric attribute mismatch calling `%s' from `%s'",
+ XSTR (exp, 0), attr->name);
}
break;
@@ -1029,10 +1015,9 @@ check_attr_value (rtx exp, struct attr_desc *attr)
return attr_rtx (SYMBOL_REF, XSTR (exp, 0));
default:
- message_with_line (attr ? attr->lineno : 0,
- "invalid operation `%s' for attribute value",
- GET_RTX_NAME (GET_CODE (exp)));
- have_error = 1;
+ error_with_line (attr ? attr->lineno : 0,
+ "invalid operation `%s' for attribute value",
+ GET_RTX_NAME (GET_CODE (exp)));
break;
}
@@ -1051,9 +1036,8 @@ convert_set_attr_alternative (rtx exp, struct insn_def *id)
if (XVECLEN (exp, 1) != num_alt)
{
- message_with_line (id->lineno,
- "bad number of entries in SET_ATTR_ALTERNATIVE");
- have_error = 1;
+ error_with_line (id->lineno,
+ "bad number of entries in SET_ATTR_ALTERNATIVE");
return NULL_RTX;
}
@@ -1132,8 +1116,7 @@ check_defs (void)
case SET:
if (GET_CODE (XEXP (value, 0)) != ATTR)
{
- message_with_line (id->lineno, "bad attribute set");
- have_error = 1;
+ error_with_line (id->lineno, "bad attribute set");
value = NULL_RTX;
}
break;
@@ -1147,9 +1130,8 @@ check_defs (void)
break;
default:
- message_with_line (id->lineno, "invalid attribute code %s",
- GET_RTX_NAME (GET_CODE (value)));
- have_error = 1;
+ error_with_line (id->lineno, "invalid attribute code %s",
+ GET_RTX_NAME (GET_CODE (value)));
value = NULL_RTX;
}
if (value == NULL_RTX)
@@ -1157,9 +1139,8 @@ check_defs (void)
if ((attr = find_attr (&XSTR (XEXP (value, 0), 0), 0)) == NULL)
{
- message_with_line (id->lineno, "unknown attribute %s",
- XSTR (XEXP (value, 0), 0));
- have_error = 1;
+ error_with_line (id->lineno, "unknown attribute %s",
+ XSTR (XEXP (value, 0), 0));
continue;
}
@@ -1922,11 +1903,13 @@ make_alternative_compare (int mask)
computation. If a test condition involves an address, we leave the EQ_ATTR
intact because addresses are only valid for the `length' attribute.
- EXP is the EQ_ATTR expression and VALUE is the value of that attribute
- for the insn corresponding to INSN_CODE and INSN_INDEX. */
+ EXP is the EQ_ATTR expression and ATTR is the attribute to which
+ it refers. VALUE is the value of that attribute for the insn
+ corresponding to INSN_CODE and INSN_INDEX. */
static rtx
-evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index)
+evaluate_eq_attr (rtx exp, struct attr_desc *attr, rtx value,
+ int insn_code, int insn_index)
{
rtx orexp, andexp;
rtx right;
@@ -1944,16 +1927,12 @@ evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index)
case SYMBOL_REF:
{
- char *p;
- char string[256];
+ const char *prefix;
+ char *string, *p;
gcc_assert (GET_CODE (exp) == EQ_ATTR);
- gcc_assert (strlen (XSTR (exp, 0)) + strlen (XSTR (exp, 1)) + 2
- <= 256);
-
- strcpy (string, XSTR (exp, 0));
- strcat (string, "_");
- strcat (string, XSTR (exp, 1));
+ prefix = attr->enum_name ? attr->enum_name : attr->name;
+ string = ACONCAT ((prefix, "_", XSTR (exp, 1), NULL));
for (p = string; *p; p++)
*p = TOUPPER (*p);
@@ -1987,7 +1966,7 @@ evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index)
right = insert_right_side (AND, andexp, this_cond,
insn_code, insn_index);
right = insert_right_side (AND, right,
- evaluate_eq_attr (exp,
+ evaluate_eq_attr (exp, attr,
XVECEXP (value, 0,
i + 1),
insn_code, insn_index),
@@ -2003,7 +1982,7 @@ evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index)
/* Handle the default case. */
right = insert_right_side (AND, andexp,
- evaluate_eq_attr (exp, XEXP (value, 1),
+ evaluate_eq_attr (exp, attr, XEXP (value, 1),
insn_code, insn_index),
insn_code, insn_index);
newexp = insert_right_side (IOR, orexp, right, insn_code, insn_index);
@@ -2753,7 +2732,8 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
if (av)
{
got_av:
- x = evaluate_eq_attr (exp, av->value, insn_code, insn_index);
+ x = evaluate_eq_attr (exp, attr, av->value,
+ insn_code, insn_index);
x = SIMPLIFY_TEST_EXP (x, insn_code, insn_index);
if (attr_rtx_cost(x) < 20)
return x;
@@ -2921,13 +2901,30 @@ clear_struct_flag (rtx x)
}
}
-/* Create table entries for DEFINE_ATTR. */
+/* Add attribute value NAME to the beginning of ATTR's list. */
+
+static void
+add_attr_value (struct attr_desc *attr, const char *name)
+{
+ struct attr_value *av;
+
+ av = oballoc (struct attr_value);
+ av->value = attr_rtx (CONST_STRING, name);
+ av->next = attr->first_value;
+ attr->first_value = av;
+ av->first_insn = NULL;
+ av->num_insns = 0;
+ av->has_asm_insn = 0;
+}
+
+/* Create table entries for DEFINE_ATTR or DEFINE_ENUM_ATTR. */
static void
gen_attr (rtx exp, int lineno)
{
+ struct enum_type *et;
+ struct enum_value *ev;
struct attr_desc *attr;
- struct attr_value *av;
const char *name_ptr;
char *p;
@@ -2936,51 +2933,45 @@ gen_attr (rtx exp, int lineno)
attr = find_attr (&XSTR (exp, 0), 1);
if (attr->default_val)
{
- message_with_line (lineno, "duplicate definition for attribute %s",
- attr->name);
+ error_with_line (lineno, "duplicate definition for attribute %s",
+ attr->name);
message_with_line (attr->lineno, "previous definition");
- have_error = 1;
return;
}
attr->lineno = lineno;
- if (*XSTR (exp, 1) == '\0')
+ if (GET_CODE (exp) == DEFINE_ENUM_ATTR)
+ {
+ attr->enum_name = XSTR (exp, 1);
+ et = lookup_enum_type (XSTR (exp, 1));
+ if (!et || !et->md_p)
+ error_with_line (lineno, "No define_enum called `%s' defined",
+ attr->name);
+ for (ev = et->values; ev; ev = ev->next)
+ add_attr_value (attr, ev->name);
+ }
+ else if (*XSTR (exp, 1) == '\0')
attr->is_numeric = 1;
else
{
name_ptr = XSTR (exp, 1);
while ((p = next_comma_elt (&name_ptr)) != NULL)
- {
- av = oballoc (struct attr_value);
- av->value = attr_rtx (CONST_STRING, p);
- av->next = attr->first_value;
- attr->first_value = av;
- av->first_insn = NULL;
- av->num_insns = 0;
- av->has_asm_insn = 0;
- }
+ add_attr_value (attr, p);
}
if (GET_CODE (XEXP (exp, 2)) == CONST)
{
attr->is_const = 1;
if (attr->is_numeric)
- {
- message_with_line (lineno,
- "constant attributes may not take numeric values");
- have_error = 1;
- }
+ error_with_line (lineno,
+ "constant attributes may not take numeric values");
/* Get rid of the CONST node. It is allowed only at top-level. */
XEXP (exp, 2) = XEXP (XEXP (exp, 2), 0);
}
if (! strcmp_check (attr->name, length_str) && ! attr->is_numeric)
- {
- message_with_line (lineno,
- "`length' attribute must take numeric values");
- have_error = 1;
- }
+ error_with_line (lineno, "`length' attribute must take numeric values");
/* Set up the default value. */
XEXP (exp, 2) = check_attr_value (XEXP (exp, 2), attr);
@@ -3114,9 +3105,9 @@ gen_delay (rtx def, int lineno)
if (XVECLEN (def, 1) % 3 != 0)
{
- message_with_line (lineno,
- "number of elements in DEFINE_DELAY must be multiple of three");
- have_error = 1;
+ error_with_line (lineno,
+ "number of elements in DEFINE_DELAY must"
+ " be multiple of three");
return;
}
@@ -3136,16 +3127,98 @@ gen_delay (rtx def, int lineno)
delays = delay;
}
-/* Given a piece of RTX, print a C expression to test its truth value.
- We use AND and IOR both for logical and bit-wise operations, so
- interpret them as logical unless they are inside a comparison expression.
- The first bit of FLAGS will be nonzero in that case.
+/* Names of attributes that could be possibly cached. */
+static const char *cached_attrs[32];
+/* Number of such attributes. */
+static int cached_attr_count;
+/* Bitmasks of possibly cached attributes. */
+static unsigned int attrs_seen_once, attrs_seen_more_than_once;
+static unsigned int attrs_to_cache;
+static unsigned int attrs_cached_inside, attrs_cached_after;
- Set the second bit of FLAGS to make references to attribute values use
- a cached local variable instead of calling a function. */
+/* Finds non-const attributes that could be possibly cached.
+ When create is TRUE, fills in cached_attrs array.
+ Computes ATTRS_SEEN_ONCE and ATTRS_SEEN_MORE_THAN_ONCE
+ bitmasks. */
static void
-write_test_expr (rtx exp, int flags)
+find_attrs_to_cache (rtx exp, bool create)
+{
+ int i;
+ const char *name;
+ struct attr_desc *attr;
+
+ if (exp == NULL)
+ return;
+
+ switch (GET_CODE (exp))
+ {
+ case NOT:
+ if (GET_CODE (XEXP (exp, 0)) == EQ_ATTR)
+ find_attrs_to_cache (XEXP (exp, 0), create);
+ return;
+
+ case EQ_ATTR:
+ name = XSTR (exp, 0);
+ if (name == alternative_name)
+ return;
+ for (i = 0; i < cached_attr_count; i++)
+ if (name == cached_attrs[i])
+ {
+ if ((attrs_seen_once & (1U << i)) != 0)
+ attrs_seen_more_than_once |= (1U << i);
+ else
+ attrs_seen_once |= (1U << i);
+ return;
+ }
+ if (!create)
+ return;
+ attr = find_attr (&name, 0);
+ gcc_assert (attr);
+ if (attr->is_const)
+ return;
+ if (cached_attr_count == 32)
+ return;
+ cached_attrs[cached_attr_count] = XSTR (exp, 0);
+ attrs_seen_once |= (1U << cached_attr_count);
+ cached_attr_count++;
+ return;
+
+ case AND:
+ case IOR:
+ find_attrs_to_cache (XEXP (exp, 0), create);
+ find_attrs_to_cache (XEXP (exp, 1), create);
+ return;
+
+ case COND:
+ for (i = 0; i < XVECLEN (exp, 0); i += 2)
+ find_attrs_to_cache (XVECEXP (exp, 0, i), create);
+ return;
+
+ default:
+ return;
+ }
+}
+
+/* Given a piece of RTX, print a C expression to test its truth value.
+ We use AND and IOR both for logical and bit-wise operations, so
+ interpret them as logical unless they are inside a comparison expression. */
+
+/* Interpret AND/IOR as bit-wise operations instead of logical. */
+#define FLG_BITWISE 1
+/* Set if cached attribute will be known initialized in else block after
+ this condition. This is true for LHS of toplevel && and || and
+ even for RHS of ||, but not for RHS of &&. */
+#define FLG_AFTER 2
+/* Set if cached attribute will be known initialized in then block after
+ this condition. This is true for LHS of toplevel && and || and
+ even for RHS of &&, but not for RHS of ||. */
+#define FLG_INSIDE 4
+/* Cleared when an operand of &&. */
+#define FLG_OUTSIDE_AND 8
+
+static unsigned int
+write_test_expr (rtx exp, unsigned int attrs_cached, int flags)
{
int comparison_operator = 0;
RTX_CODE code;
@@ -3167,12 +3240,30 @@ write_test_expr (rtx exp, int flags)
case EQ: case NE:
case GE: case GT:
case LE: case LT:
- comparison_operator = 1;
+ comparison_operator = FLG_BITWISE;
case PLUS: case MINUS: case MULT: case DIV: case MOD:
case AND: case IOR: case XOR:
case ASHIFT: case LSHIFTRT: case ASHIFTRT:
- write_test_expr (XEXP (exp, 0), flags | comparison_operator);
+ if ((code != AND && code != IOR) || (flags & FLG_BITWISE))
+ {
+ flags &= ~(FLG_AFTER | FLG_INSIDE | FLG_OUTSIDE_AND);
+ write_test_expr (XEXP (exp, 0), attrs_cached,
+ flags | comparison_operator);
+ }
+ else
+ {
+ if (code == AND)
+ flags &= ~FLG_OUTSIDE_AND;
+ if (GET_CODE (XEXP (exp, 0)) == code
+ || GET_CODE (XEXP (exp, 0)) == EQ_ATTR
+ || (GET_CODE (XEXP (exp, 0)) == NOT
+ && GET_CODE (XEXP (XEXP (exp, 0), 0)) == EQ_ATTR))
+ attrs_cached
+ = write_test_expr (XEXP (exp, 0), attrs_cached, flags);
+ else
+ write_test_expr (XEXP (exp, 0), attrs_cached, flags);
+ }
switch (code)
{
case EQ:
@@ -3221,13 +3312,13 @@ write_test_expr (rtx exp, int flags)
printf (" %% ");
break;
case AND:
- if (flags & 1)
+ if (flags & FLG_BITWISE)
printf (" & ");
else
printf (" && ");
break;
case IOR:
- if (flags & 1)
+ if (flags & FLG_BITWISE)
printf (" | ");
else
printf (" || ");
@@ -3246,15 +3337,49 @@ write_test_expr (rtx exp, int flags)
gcc_unreachable ();
}
- write_test_expr (XEXP (exp, 1), flags | comparison_operator);
+ if (code == AND)
+ {
+ /* For if (something && (cached_x = get_attr_x (insn)) == X)
+ cached_x is only known to be initialized in then block. */
+ flags &= ~FLG_AFTER;
+ }
+ else if (code == IOR)
+ {
+ if (flags & FLG_OUTSIDE_AND)
+ /* For if (something || (cached_x = get_attr_x (insn)) == X)
+ cached_x is only known to be initialized in else block
+ and else if conditions. */
+ flags &= ~FLG_INSIDE;
+ else
+ /* For if ((something || (cached_x = get_attr_x (insn)) == X)
+ && something_else)
+ cached_x is not know to be initialized anywhere. */
+ flags &= ~(FLG_AFTER | FLG_INSIDE);
+ }
+ if ((code == AND || code == IOR)
+ && (GET_CODE (XEXP (exp, 1)) == code
+ || GET_CODE (XEXP (exp, 1)) == EQ_ATTR
+ || (GET_CODE (XEXP (exp, 1)) == NOT
+ && GET_CODE (XEXP (XEXP (exp, 1), 0)) == EQ_ATTR)))
+ attrs_cached
+ = write_test_expr (XEXP (exp, 1), attrs_cached, flags);
+ else
+ write_test_expr (XEXP (exp, 1), attrs_cached,
+ flags | comparison_operator);
break;
case NOT:
/* Special-case (not (eq_attrq "alternative" "x")) */
- if (! (flags & 1) && GET_CODE (XEXP (exp, 0)) == EQ_ATTR
- && XSTR (XEXP (exp, 0), 0) == alternative_name)
+ if (! (flags & FLG_BITWISE) && GET_CODE (XEXP (exp, 0)) == EQ_ATTR)
{
- printf ("which_alternative != %s", XSTR (XEXP (exp, 0), 1));
+ if (XSTR (XEXP (exp, 0), 0) == alternative_name)
+ {
+ printf ("which_alternative != %s", XSTR (XEXP (exp, 0), 1));
+ break;
+ }
+
+ printf ("! ");
+ attrs_cached = write_test_expr (XEXP (exp, 0), attrs_cached, flags);
break;
}
@@ -3265,7 +3390,7 @@ write_test_expr (rtx exp, int flags)
switch (code)
{
case NOT:
- if (flags & 1)
+ if (flags & FLG_BITWISE)
printf ("~ ");
else
printf ("! ");
@@ -3280,14 +3405,15 @@ write_test_expr (rtx exp, int flags)
gcc_unreachable ();
}
- write_test_expr (XEXP (exp, 0), flags);
+ flags &= ~(FLG_AFTER | FLG_INSIDE | FLG_OUTSIDE_AND);
+ write_test_expr (XEXP (exp, 0), attrs_cached, flags);
break;
case EQ_ATTR_ALT:
{
int set = XINT (exp, 0), bit = 0;
- if (flags & 1)
+ if (flags & FLG_BITWISE)
fatal ("EQ_ATTR_ALT not valid inside comparison");
if (!set)
@@ -3333,7 +3459,7 @@ write_test_expr (rtx exp, int flags)
have been removed by optimization. Handle "alternative"
specially and give error if EQ_ATTR present inside a comparison. */
case EQ_ATTR:
- if (flags & 1)
+ if (flags & FLG_BITWISE)
fatal ("EQ_ATTR not valid inside comparison");
if (XSTR (exp, 0) == alternative_name)
@@ -3348,14 +3474,28 @@ write_test_expr (rtx exp, int flags)
/* Now is the time to expand the value of a constant attribute. */
if (attr->is_const)
{
- write_test_expr (evaluate_eq_attr (exp, attr->default_val->value,
- -2, -2),
- flags);
+ write_test_expr (evaluate_eq_attr (exp, attr,
+ attr->default_val->value, -2, -2),
+ attrs_cached, 0);
}
else
{
- if (flags & 2)
- printf ("attr_%s", attr->name);
+ int i;
+ for (i = 0; i < cached_attr_count; i++)
+ if (attr->name == cached_attrs[i])
+ break;
+ if (i < cached_attr_count && (attrs_cached & (1U << i)) != 0)
+ printf ("cached_%s", attr->name);
+ else if (i < cached_attr_count && (attrs_to_cache & (1U << i)) != 0)
+ {
+ printf ("(cached_%s = get_attr_%s (insn))",
+ attr->name, attr->name);
+ if (flags & FLG_AFTER)
+ attrs_cached_after |= (1U << i);
+ if (flags & FLG_INSIDE)
+ attrs_cached_inside |= (1U << i);
+ attrs_cached |= (1U << i);
+ }
else
printf ("get_attr_%s (insn)", attr->name);
printf (" == ");
@@ -3365,7 +3505,7 @@ write_test_expr (rtx exp, int flags)
/* Comparison test of flags for define_delays. */
case ATTR_FLAG:
- if (flags & 1)
+ if (flags & FLG_BITWISE)
fatal ("ATTR_FLAG not valid inside comparison");
printf ("(flags & ATTR_FLAG_%s) != 0", XSTR (exp, 0));
break;
@@ -3417,11 +3557,11 @@ write_test_expr (rtx exp, int flags)
break;
case IF_THEN_ELSE:
- write_test_expr (XEXP (exp, 0), flags & 2);
+ write_test_expr (XEXP (exp, 0), attrs_cached, 0);
printf (" ? ");
- write_test_expr (XEXP (exp, 1), flags | 1);
+ write_test_expr (XEXP (exp, 1), attrs_cached, FLG_BITWISE);
printf (" : ");
- write_test_expr (XEXP (exp, 2), flags | 1);
+ write_test_expr (XEXP (exp, 2), attrs_cached, FLG_BITWISE);
break;
default:
@@ -3430,6 +3570,7 @@ write_test_expr (rtx exp, int flags)
}
printf (")");
+ return attrs_cached;
}
/* Given an attribute value, return the maximum CONST_STRING argument
@@ -3634,6 +3775,7 @@ static void
write_attr_get (struct attr_desc *attr)
{
struct attr_value *av, *common_av;
+ int i, j;
/* Find the most used attribute value. Handle that as the `default' of the
switch we will generate. */
@@ -3641,7 +3783,9 @@ write_attr_get (struct attr_desc *attr)
/* Write out start of function, then all values with explicit `case' lines,
then a `default', then the value with the most uses. */
- if (!attr->is_numeric)
+ if (attr->enum_name)
+ printf ("enum %s\n", attr->enum_name);
+ else if (!attr->is_numeric)
printf ("enum attr_%s\n", attr->name);
else
printf ("int\n");
@@ -3661,16 +3805,48 @@ write_attr_get (struct attr_desc *attr)
if (av->num_insns == 1)
write_attr_set (attr, 2, av->value, "return", ";",
true_rtx, av->first_insn->def->insn_code,
- av->first_insn->def->insn_index);
+ av->first_insn->def->insn_index, 0);
else if (av->num_insns != 0)
write_attr_set (attr, 2, av->value, "return", ";",
- true_rtx, -2, 0);
+ true_rtx, -2, 0, 0);
printf ("}\n\n");
return;
}
printf ("{\n");
+
+ /* Find attributes that are worth caching in the conditions. */
+ cached_attr_count = 0;
+ attrs_seen_more_than_once = 0;
+ for (av = attr->first_value; av; av = av->next)
+ {
+ attrs_seen_once = 0;
+ find_attrs_to_cache (av->value, true);
+ }
+ /* Remove those that aren't worth caching from the array. */
+ for (i = 0, j = 0; i < cached_attr_count; i++)
+ if ((attrs_seen_more_than_once & (1U << i)) != 0)
+ {
+ const char *name = cached_attrs[i];
+ struct attr_desc *cached_attr;
+ if (i != j)
+ cached_attrs[j] = name;
+ cached_attr = find_attr (&name, 0);
+ gcc_assert (cached_attr && cached_attr->is_const == 0);
+ if (cached_attr->enum_name)
+ printf (" enum %s", cached_attr->enum_name);
+ else if (!cached_attr->is_numeric)
+ printf (" enum attr_%s", cached_attr->name);
+ else
+ printf (" int");
+ printf (" cached_%s ATTRIBUTE_UNUSED;\n", name);
+ j++;
+ }
+ cached_attr_count = j;
+ if (cached_attr_count)
+ printf ("\n");
+
printf (" switch (recog_memoized (insn))\n");
printf (" {\n");
@@ -3680,6 +3856,7 @@ write_attr_get (struct attr_desc *attr)
write_attr_case (attr, common_av, 0, "return", ";", 4, true_rtx);
printf (" }\n}\n\n");
+ cached_attr_count = 0;
}
/* Given an AND tree of known true terms (because we are inside an `if' with
@@ -3718,7 +3895,7 @@ eliminate_known_true (rtx known_true, rtx exp, int insn_code, int insn_index)
static void
write_attr_set (struct attr_desc *attr, int indent, rtx value,
const char *prefix, const char *suffix, rtx known_true,
- int insn_code, int insn_index)
+ int insn_code, int insn_index, unsigned int attrs_cached)
{
if (GET_CODE (value) == COND)
{
@@ -3730,6 +3907,15 @@ write_attr_set (struct attr_desc *attr, int indent, rtx value,
int first_if = 1;
int i;
+ if (cached_attr_count)
+ {
+ attrs_seen_once = 0;
+ attrs_seen_more_than_once = 0;
+ for (i = 0; i < XVECLEN (value, 0); i += 2)
+ find_attrs_to_cache (XVECEXP (value, 0, i), false);
+ attrs_to_cache |= attrs_seen_more_than_once;
+ }
+
for (i = 0; i < XVECLEN (value, 0); i += 2)
{
rtx testexp;
@@ -3760,17 +3946,22 @@ write_attr_set (struct attr_desc *attr, int indent, rtx value,
if (inner_true == false_rtx)
continue;
+ attrs_cached_inside = attrs_cached;
+ attrs_cached_after = attrs_cached;
write_indent (indent);
printf ("%sif ", first_if ? "" : "else ");
first_if = 0;
- write_test_expr (testexp, 0);
+ write_test_expr (testexp, attrs_cached,
+ (FLG_AFTER | FLG_INSIDE | FLG_OUTSIDE_AND));
+ attrs_cached = attrs_cached_after;
printf ("\n");
write_indent (indent + 2);
printf ("{\n");
write_attr_set (attr, indent + 4,
XVECEXP (value, 0, i + 1), prefix, suffix,
- inner_true, insn_code, insn_index);
+ inner_true, insn_code, insn_index,
+ attrs_cached_inside);
write_indent (indent + 2);
printf ("}\n");
our_known_true = newexp;
@@ -3785,7 +3976,8 @@ write_attr_set (struct attr_desc *attr, int indent, rtx value,
}
write_attr_set (attr, first_if ? indent : indent + 4, default_val,
- prefix, suffix, our_known_true, insn_code, insn_index);
+ prefix, suffix, our_known_true, insn_code, insn_index,
+ attrs_cached);
if (! first_if)
{
@@ -3866,13 +4058,14 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av,
printf ("extract_insn_cached (insn);\n");
}
+ attrs_to_cache = 0;
if (av->num_insns == 1)
write_attr_set (attr, indent + 2, av->value, prefix, suffix,
known_true, av->first_insn->def->insn_code,
- av->first_insn->def->insn_index);
+ av->first_insn->def->insn_index, 0);
else
write_attr_set (attr, indent + 2, av->value, prefix, suffix,
- known_true, -2, 0);
+ known_true, -2, 0, 0);
if (strncmp (prefix, "return", 6))
{
@@ -3898,7 +4091,7 @@ write_attr_valueq (struct attr_desc *attr, const char *s)
}
else
{
- write_upcase (attr->name);
+ write_upcase (attr->enum_name ? attr->enum_name : attr->name);
printf ("_");
write_upcase (s);
}
@@ -4162,6 +4355,7 @@ find_attr (const char **name_p, int create)
attr = oballoc (struct attr_desc);
attr->name = DEF_ATTR_STRING (name);
+ attr->enum_name = 0;
attr->first_value = attr->default_val = NULL;
attr->is_numeric = attr->is_const = attr->is_special = 0;
attr->next = attrs[index];
@@ -4379,6 +4573,69 @@ process_bypasses (void)
r->bypassed = true;
}
+/* Check that attribute NAME is used in define_insn_reservation condition
+ EXP. Return true if it is. */
+static bool
+check_tune_attr (const char *name, rtx exp)
+{
+ switch (GET_CODE (exp))
+ {
+ case AND:
+ if (check_tune_attr (name, XEXP (exp, 0)))
+ return true;
+ return check_tune_attr (name, XEXP (exp, 1));
+
+ case IOR:
+ return (check_tune_attr (name, XEXP (exp, 0))
+ && check_tune_attr (name, XEXP (exp, 1)));
+
+ case EQ_ATTR:
+ return XSTR (exp, 0) == name;
+
+ default:
+ return false;
+ }
+}
+
+/* Try to find a const attribute (usually cpu or tune) that is used
+ in all define_insn_reservation conditions. */
+static struct attr_desc *
+find_tune_attr (rtx exp)
+{
+ struct attr_desc *attr;
+
+ switch (GET_CODE (exp))
+ {
+ case AND:
+ case IOR:
+ attr = find_tune_attr (XEXP (exp, 0));
+ if (attr)
+ return attr;
+ return find_tune_attr (XEXP (exp, 1));
+
+ case EQ_ATTR:
+ if (XSTR (exp, 0) == alternative_name)
+ return NULL;
+
+ attr = find_attr (&XSTR (exp, 0), 0);
+ gcc_assert (attr);
+
+ if (attr->is_const && !attr->is_special)
+ {
+ struct insn_reserv *decl;
+
+ for (decl = all_insn_reservs; decl; decl = decl->next)
+ if (! check_tune_attr (attr->name, decl->condexp))
+ return NULL;
+ return attr;
+ }
+ return NULL;
+
+ default:
+ return NULL;
+ }
+}
+
/* Create all of the attributes that describe automaton properties. */
static void
make_automaton_attrs (void)
@@ -4386,28 +4643,154 @@ make_automaton_attrs (void)
int i;
struct insn_reserv *decl;
rtx code_exp, lats_exp, byps_exp;
+ struct attr_desc *tune_attr;
if (n_insn_reservs == 0)
return;
- code_exp = rtx_alloc (COND);
- lats_exp = rtx_alloc (COND);
+ tune_attr = find_tune_attr (all_insn_reservs->condexp);
+ if (tune_attr != NULL)
+ {
+ rtx *condexps = XNEWVEC (rtx, n_insn_reservs * 3);
+ struct attr_value *val;
+ bool first = true;
+
+ gcc_assert (tune_attr->is_const
+ && !tune_attr->is_special
+ && !tune_attr->is_numeric);
+ for (val = tune_attr->first_value; val; val = val->next)
+ {
+ if (val == tune_attr->default_val)
+ continue;
+ gcc_assert (GET_CODE (val->value) == CONST_STRING);
+ printf ("static int internal_dfa_insn_code_%s (rtx);\n"
+ "static int insn_default_latency_%s (rtx);\n",
+ XSTR (val->value, 0), XSTR (val->value, 0));
+ }
- XVEC (code_exp, 0) = rtvec_alloc (n_insn_reservs * 2);
- XVEC (lats_exp, 0) = rtvec_alloc (n_insn_reservs * 2);
+ printf ("\n");
+ printf ("int (*internal_dfa_insn_code) (rtx);\n");
+ printf ("int (*insn_default_latency) (rtx);\n");
+ printf ("\n");
+ printf ("void\n");
+ printf ("init_sched_attrs (void)\n");
+ printf ("{\n");
- XEXP (code_exp, 1) = make_numeric_value (n_insn_reservs + 1);
- XEXP (lats_exp, 1) = make_numeric_value (0);
+ for (val = tune_attr->first_value; val; val = val->next)
+ {
+ int j;
+ char *name;
+ rtx test = attr_rtx (EQ_ATTR, tune_attr->name, XSTR (val->value, 0));
+
+ if (val == tune_attr->default_val)
+ continue;
+ for (decl = all_insn_reservs, i = 0;
+ decl;
+ decl = decl->next)
+ {
+ rtx ctest = test;
+ rtx condexp
+ = simplify_and_tree (decl->condexp, &ctest, -2, 0);
+ if (condexp == false_rtx)
+ continue;
+ if (condexp == true_rtx)
+ break;
+ condexps[i] = condexp;
+ condexps[i + 1] = make_numeric_value (decl->insn_num);
+ condexps[i + 2] = make_numeric_value (decl->default_latency);
+ i += 3;
+ }
- for (decl = all_insn_reservs, i = 0;
- decl;
- decl = decl->next, i += 2)
+ code_exp = rtx_alloc (COND);
+ lats_exp = rtx_alloc (COND);
+
+ j = i / 3 * 2;
+ XVEC (code_exp, 0) = rtvec_alloc (j);
+ XVEC (lats_exp, 0) = rtvec_alloc (j);
+
+ if (decl)
+ {
+ XEXP (code_exp, 1) = make_numeric_value (decl->insn_num);
+ XEXP (lats_exp, 1) = make_numeric_value (decl->default_latency);
+ }
+ else
+ {
+ XEXP (code_exp, 1) = make_numeric_value (n_insn_reservs + 1);
+ XEXP (lats_exp, 1) = make_numeric_value (0);
+ }
+
+ while (i > 0)
+ {
+ i -= 3;
+ j -= 2;
+ XVECEXP (code_exp, 0, j) = condexps[i];
+ XVECEXP (lats_exp, 0, j) = condexps[i];
+
+ XVECEXP (code_exp, 0, j + 1) = condexps[i + 1];
+ XVECEXP (lats_exp, 0, j + 1) = condexps[i + 2];
+ }
+
+ name = XNEWVEC (char,
+ sizeof ("*internal_dfa_insn_code_")
+ + strlen (XSTR (val->value, 0)));
+ strcpy (name, "*internal_dfa_insn_code_");
+ strcat (name, XSTR (val->value, 0));
+ make_internal_attr (name, code_exp, ATTR_NONE);
+ strcpy (name, "*insn_default_latency_");
+ strcat (name, XSTR (val->value, 0));
+ make_internal_attr (name, lats_exp, ATTR_NONE);
+ XDELETEVEC (name);
+
+ if (first)
+ {
+ printf (" if (");
+ first = false;
+ }
+ else
+ printf (" else if (");
+ write_test_expr (test, 0, 0);
+ printf (")\n");
+ printf (" {\n");
+ printf (" internal_dfa_insn_code\n");
+ printf (" = internal_dfa_insn_code_%s;\n",
+ XSTR (val->value, 0));
+ printf (" insn_default_latency\n");
+ printf (" = insn_default_latency_%s;\n",
+ XSTR (val->value, 0));
+ printf (" }\n");
+ }
+
+ printf (" else\n");
+ printf (" gcc_unreachable ();\n");
+ printf ("}\n");
+ printf ("\n");
+
+ XDELETEVEC (condexps);
+ }
+ else
{
- XVECEXP (code_exp, 0, i) = decl->condexp;
- XVECEXP (lats_exp, 0, i) = decl->condexp;
+ code_exp = rtx_alloc (COND);
+ lats_exp = rtx_alloc (COND);
+
+ XVEC (code_exp, 0) = rtvec_alloc (n_insn_reservs * 2);
+ XVEC (lats_exp, 0) = rtvec_alloc (n_insn_reservs * 2);
+
+ XEXP (code_exp, 1) = make_numeric_value (n_insn_reservs + 1);
+ XEXP (lats_exp, 1) = make_numeric_value (0);
- XVECEXP (code_exp, 0, i+1) = make_numeric_value (decl->insn_num);
- XVECEXP (lats_exp, 0, i+1) = make_numeric_value (decl->default_latency);
+ for (decl = all_insn_reservs, i = 0;
+ decl;
+ decl = decl->next, i += 2)
+ {
+ XVECEXP (code_exp, 0, i) = decl->condexp;
+ XVECEXP (lats_exp, 0, i) = decl->condexp;
+
+ XVECEXP (code_exp, 0, i+1) = make_numeric_value (decl->insn_num);
+ XVECEXP (lats_exp, 0, i+1)
+ = make_numeric_value (decl->default_latency);
+ }
+ make_internal_attr ("*internal_dfa_insn_code", code_exp, ATTR_NONE);
+ make_internal_attr ("*insn_default_latency", lats_exp, ATTR_NONE);
}
if (n_bypasses == 0)
@@ -4430,8 +4813,6 @@ make_automaton_attrs (void)
}
}
- make_internal_attr ("*internal_dfa_insn_code", code_exp, ATTR_NONE);
- make_internal_attr ("*insn_default_latency", lats_exp, ATTR_NONE);
make_internal_attr ("*bypass_p", byps_exp, ATTR_NONE);
}
@@ -4446,7 +4827,7 @@ main (int argc, char **argv)
progname = "genattrtab";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
obstack_init (hash_obstack);
@@ -4488,6 +4869,7 @@ from the machine description file `md'. */\n\n");
break;
case DEFINE_ATTR:
+ case DEFINE_ENUM_ATTR:
gen_attr (desc, lineno);
break;
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index 4c58d35814e..a268aa053da 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -3314,15 +3314,18 @@ finish_alt_states (void)
/* Set bit number bitno in the bit string. The macro is not side
effect proof. */
#define SET_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] |= 1 << (bitno) % CHAR_BIT)
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] |= \
+ (HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))
#define CLEAR_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] &= ~(1 << (bitno) % CHAR_BIT))
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] &= \
+ ~((HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)))
/* Test if bit number bitno in the bitstring is set. The macro is not
side effect proof. */
-#define TEST_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] >> (bitno) % CHAR_BIT & 1)
+#define TEST_BIT(bitstring, bitno) \
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] >> \
+ (bitno) % (sizeof (*(bitstring)) * CHAR_BIT) & 1)
@@ -4174,20 +4177,18 @@ initiate_excl_sets (void)
static reserv_sets_t
get_excl_set (reserv_sets_t in_set)
{
- int excl_char_num;
- int chars_num;
- int i;
+ int el;
+ unsigned int i;
int start_unit_num;
int unit_num;
- chars_num = els_in_cycle_reserv * sizeof (set_el_t);
- memset (excl_set, 0, chars_num);
- for (excl_char_num = 0; excl_char_num < chars_num; excl_char_num++)
- if (((unsigned char *) in_set) [excl_char_num])
- for (i = CHAR_BIT - 1; i >= 0; i--)
- if ((((unsigned char *) in_set) [excl_char_num] >> i) & 1)
+ memset (excl_set, 0, els_in_cycle_reserv * sizeof (set_el_t));
+ for (el = 0; el < els_in_cycle_reserv; el++)
+ if (in_set[el])
+ for (i = 0; i < CHAR_BIT * sizeof (set_el_t); i++)
+ if ((in_set[el] >> i) & 1)
{
- start_unit_num = excl_char_num * CHAR_BIT + i;
+ start_unit_num = el * CHAR_BIT * sizeof (set_el_t) + i;
if (start_unit_num >= description->units_num)
return excl_set;
for (unit_num = 0; unit_num < els_in_cycle_reserv; unit_num++)
@@ -4286,21 +4287,19 @@ check_presence_pattern_sets (reserv_sets_t checked_set,
reserv_sets_t original_set,
int final_p)
{
- int char_num;
- int chars_num;
- int i;
+ int el;
+ unsigned int i;
int start_unit_num;
int unit_num;
int presence_p;
pattern_reserv_t pat_reserv;
- chars_num = els_in_cycle_reserv * sizeof (set_el_t);
- for (char_num = 0; char_num < chars_num; char_num++)
- if (((unsigned char *) original_set) [char_num])
- for (i = CHAR_BIT - 1; i >= 0; i--)
- if ((((unsigned char *) original_set) [char_num] >> i) & 1)
+ for (el = 0; el < els_in_cycle_reserv; el++)
+ if (original_set[el])
+ for (i = 0; i < CHAR_BIT * sizeof (set_el_t); i++)
+ if ((original_set[el] >> i) & 1)
{
- start_unit_num = char_num * CHAR_BIT + i;
+ start_unit_num = el * CHAR_BIT * sizeof (set_el_t) + i;
if (start_unit_num >= description->units_num)
break;
if ((final_p
@@ -4335,20 +4334,18 @@ check_absence_pattern_sets (reserv_sets_t checked_set,
reserv_sets_t original_set,
int final_p)
{
- int char_num;
- int chars_num;
- int i;
+ int el;
+ unsigned int i;
int start_unit_num;
int unit_num;
pattern_reserv_t pat_reserv;
- chars_num = els_in_cycle_reserv * sizeof (set_el_t);
- for (char_num = 0; char_num < chars_num; char_num++)
- if (((unsigned char *) original_set) [char_num])
- for (i = CHAR_BIT - 1; i >= 0; i--)
- if ((((unsigned char *) original_set) [char_num] >> i) & 1)
+ for (el = 0; el < els_in_cycle_reserv; el++)
+ if (original_set[el])
+ for (i = 0; i < CHAR_BIT * sizeof (set_el_t); i++)
+ if ((original_set[el] >> i) & 1)
{
- start_unit_num = char_num * CHAR_BIT + i;
+ start_unit_num = el * CHAR_BIT * sizeof (set_el_t) + i;
if (start_unit_num >= description->units_num)
break;
for (pat_reserv = (final_p
@@ -7488,72 +7485,6 @@ output_trans_table (automaton_t automaton)
VEC_free (vect_el_t, heap, transition_vect);
}
-/* The current number of passing states to find minimal issue delay
- value for an ainsn and state. */
-static int curr_state_pass_num;
-
-/* This recursive function passes states to find minimal issue delay
- value for AINSN. The state being visited is STATE. The function
- returns minimal issue delay value for AINSN in STATE or -1 if we
- enter into a loop. */
-static int
-min_issue_delay_pass_states (state_t state, ainsn_t ainsn)
-{
- arc_t arc;
- int min_insn_issue_delay, insn_issue_delay;
-
- if (state->state_pass_num == curr_state_pass_num
- || state->min_insn_issue_delay != -1)
- /* We've entered into a loop or already have the correct value for
- given state and ainsn. */
- return state->min_insn_issue_delay;
- state->state_pass_num = curr_state_pass_num;
- min_insn_issue_delay = -1;
- for (arc = first_out_arc (state); arc != NULL; arc = next_out_arc (arc))
- if (arc->insn == ainsn)
- {
- min_insn_issue_delay = 0;
- break;
- }
- else
- {
- insn_issue_delay = min_issue_delay_pass_states (arc->to_state, ainsn);
- if (insn_issue_delay != -1)
- {
- if (arc->insn->insn_reserv_decl
- == DECL_INSN_RESERV (advance_cycle_insn_decl))
- insn_issue_delay++;
- if (min_insn_issue_delay == -1
- || min_insn_issue_delay > insn_issue_delay)
- {
- min_insn_issue_delay = insn_issue_delay;
- if (insn_issue_delay == 0)
- break;
- }
- }
- }
- return min_insn_issue_delay;
-}
-
-/* The function searches minimal issue delay value for AINSN in STATE.
- The function can return negative value if we can not issue AINSN. We
- will report about it later. */
-static int
-min_issue_delay (state_t state, ainsn_t ainsn)
-{
- curr_state_pass_num++;
- state->min_insn_issue_delay = min_issue_delay_pass_states (state, ainsn);
- return state->min_insn_issue_delay;
-}
-
-/* The function initiates code for finding minimal issue delay values.
- It should be called only once. */
-static void
-initiate_min_issue_delay_pass_states (void)
-{
- curr_state_pass_num = 0;
-}
-
/* Form and output vectors representing minimal issue delay table of
AUTOMATON. The table is state x ainsn -> minimal issue delay of
the ainsn. */
@@ -7562,11 +7493,11 @@ output_min_issue_delay_table (automaton_t automaton)
{
vla_hwint_t min_issue_delay_vect;
vla_hwint_t compressed_min_issue_delay_vect;
- vect_el_t min_delay;
ainsn_t ainsn;
- size_t i, min_issue_delay_len;
- size_t compressed_min_issue_delay_len;
+ size_t i;
+ size_t min_issue_delay_len, compressed_min_issue_delay_len;
size_t cfactor;
+ int changed;
/* Create vect of pointers to states ordered by num of transitions
from the state (state with the maximum num is the first). */
@@ -7577,27 +7508,86 @@ output_min_issue_delay_table (automaton_t automaton)
* automaton->insn_equiv_classes_num);
min_issue_delay_vect = VEC_alloc (vect_el_t, heap, min_issue_delay_len);
for (i = 0; i < min_issue_delay_len; i++)
- VEC_quick_push (vect_el_t, min_issue_delay_vect, 0);
+ VEC_quick_push (vect_el_t, min_issue_delay_vect, -1);
automaton->max_min_delay = 0;
- for (ainsn = automaton->ainsn_list; ainsn != NULL; ainsn = ainsn->next_ainsn)
+
+ do
+ {
+ size_t state_no;
+
+ changed = 0;
+
+ for (state_no = 0; state_no < VEC_length (state_t, output_states_vect);
+ state_no++)
+ {
+ state_t s = VEC_index (state_t, output_states_vect, state_no);
+ arc_t arc;
+
+ for (arc = first_out_arc (s); arc; arc = next_out_arc (arc))
+ {
+ int k;
+
+ size_t asn = s->order_state_num
+ * automaton->insn_equiv_classes_num
+ + arc->insn->insn_equiv_class_num;
+
+ if (VEC_index (vect_el_t, min_issue_delay_vect, asn))
+ {
+ VEC_replace (vect_el_t, min_issue_delay_vect, asn, 0);
+ changed = 1;
+ }
+
+ for (k = 0; k < automaton->insn_equiv_classes_num; k++)
+ {
+ size_t n0, n1;
+ vect_el_t delay0, delay1;
+
+ n0 = s->order_state_num
+ * automaton->insn_equiv_classes_num
+ + k;
+ n1 = arc->to_state->order_state_num
+ * automaton->insn_equiv_classes_num
+ + k;
+ delay0 = VEC_index (vect_el_t, min_issue_delay_vect, n0);
+ delay1 = VEC_index (vect_el_t, min_issue_delay_vect, n1);
+ if (delay1 != -1)
+ {
+ if (arc->insn->insn_reserv_decl
+ == DECL_INSN_RESERV (advance_cycle_insn_decl))
+ delay1++;
+ if (delay1 < delay0 || delay0 == -1)
+ {
+ VEC_replace (vect_el_t, min_issue_delay_vect, n0, delay1);
+ changed = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ while (changed);
+
+ automaton->max_min_delay = 0;
+
+ for (ainsn = automaton->ainsn_list; ainsn; ainsn = ainsn->next_ainsn)
if (ainsn->first_ainsn_with_given_equivalence_num)
{
for (i = 0; i < VEC_length (state_t, output_states_vect); i++)
- VEC_index (state_t, output_states_vect, i)->min_insn_issue_delay = -1;
- for (i = 0; i < VEC_length (state_t, output_states_vect); i++)
{
state_t s = VEC_index (state_t, output_states_vect, i);
- min_delay = min_issue_delay (s, ainsn);
- if (automaton->max_min_delay < min_delay)
- automaton->max_min_delay = min_delay;
- VEC_replace (vect_el_t, min_issue_delay_vect,
- s->order_state_num
- * automaton->insn_equiv_classes_num
- + ainsn->insn_equiv_class_num,
- min_delay);
+ size_t np = s->order_state_num
+ * automaton->insn_equiv_classes_num
+ + ainsn->insn_equiv_class_num;
+ vect_el_t x = VEC_index (vect_el_t, min_issue_delay_vect, np);
+
+ if (automaton->max_min_delay < x)
+ automaton->max_min_delay = x;
+ if (x == -1)
+ VEC_replace (vect_el_t, min_issue_delay_vect, np, 0);
}
}
+
fprintf (output_file, "/* Vector of min issue delay of insns. */\n");
fprintf (output_file, "static const ");
output_range_type (output_file, 0, automaton->max_min_delay);
@@ -7749,7 +7739,6 @@ output_tables (void)
{
automaton_t automaton;
- initiate_min_issue_delay_pass_states ();
for (automaton = description->first_automaton;
automaton != NULL;
automaton = automaton->next_automaton)
@@ -9478,7 +9467,7 @@ main (int argc, char **argv)
progname = "genautomata";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
initiate_automaton_gen (argc, argv);
diff --git a/gcc/gencodes.c b/gcc/gencodes.c
index 5a6014cb1c3..4c59f8392b5 100644
--- a/gcc/gencodes.c
+++ b/gcc/gencodes.c
@@ -58,7 +58,7 @@ main (int argc, char **argv)
direct references to CODE_FOR_xxx in C code. */
insn_elision = 0;
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
puts ("\
diff --git a/gcc/genconditions.c b/gcc/genconditions.c
index a1a6ef3251d..2d93c3470d6 100644
--- a/gcc/genconditions.c
+++ b/gcc/genconditions.c
@@ -33,6 +33,7 @@
#include "rtl.h"
#include "errors.h"
#include "hashtab.h"
+#include "read-md.h"
#include "gensupport.h"
/* so we can include except.h in the generated file. */
@@ -116,7 +117,7 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy))
const struct c_test *test = * (const struct c_test **) slot;
const char *p;
- print_rtx_ptr_loc (test->expr);
+ print_md_ptr_loc (test->expr);
fputs (" { \"", stdout);
for (p = test->expr; *p; p++)
{
@@ -213,7 +214,7 @@ main (int argc, char **argv)
progname = "genconditions";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
/* Read the machine description. */
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index a0a023dce47..027c92e50dc 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -264,7 +264,7 @@ main (int argc, char **argv)
progname = "genconfig";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
puts ("/* Generated automatically by the program `genconfig'");
diff --git a/gcc/genconstants.c b/gcc/genconstants.c
index a68dbf157b2..20b19bfd879 100644
--- a/gcc/genconstants.c
+++ b/gcc/genconstants.c
@@ -28,21 +28,50 @@ along with GCC; see the file COPYING3. If not see
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
-#include "rtl.h"
#include "errors.h"
-#include "gensupport.h"
+#include "read-md.h"
/* Called via traverse_md_constants; emit a #define for
the current constant definition. */
static int
-print_md_constant (void **slot, void *info)
+print_md_constant (void **slot, void *info ATTRIBUTE_UNUSED)
{
struct md_constant *def = (struct md_constant *) *slot;
- FILE *file = (FILE *) info;
- fprintf (file, "#define %s %s\n", def->name, def->value);
+ if (!def->parent_enum)
+ printf ("#define %s %s\n", def->name, def->value);
+ return 1;
+}
+
+/* Called via traverse_enums. Emit an enum definition for
+ enum_type *SLOT. */
+
+static int
+print_enum_type (void **slot, void *info ATTRIBUTE_UNUSED)
+{
+ struct enum_type *def;
+ struct enum_value *value;
+ char *value_name;
+
+ def = (struct enum_type *) *slot;
+ printf ("\nenum %s {", def->name);
+ for (value = def->values; value; value = value->next)
+ {
+ printf ("\n %s = %s", value->def->name, value->def->value);
+ if (value->next)
+ putc (',', stdout);
+ }
+ printf ("\n};\n");
+
+ /* Define NUM_<enum>_VALUES to be the largest enum value + 1. */
+ value_name = ACONCAT (("num_", def->name, "_values", NULL));
+ upcase_string (value_name);
+ printf ("#define %s %d\n", value_name, def->num_values);
+
+ /* Declare the array that is generated by genenum. */
+ printf ("extern const char *const %s_strings[];\n", def->name);
+
return 1;
}
@@ -51,7 +80,7 @@ main (int argc, char **argv)
{
progname = "genconstants";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!read_md_files (argc, argv, NULL, NULL))
return (FATAL_EXIT_CODE);
/* Initializing the MD reader has the side effect of loading up
@@ -62,7 +91,8 @@ main (int argc, char **argv)
puts ("#ifndef GCC_INSN_CONSTANTS_H");
puts ("#define GCC_INSN_CONSTANTS_H\n");
- traverse_md_constants (print_md_constant, stdout);
+ traverse_md_constants (print_md_constant, 0);
+ traverse_enum_types (print_enum_type, 0);
puts ("\n#endif /* GCC_INSN_CONSTANTS_H */");
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 9df559b5705..98ec42fe0c3 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
+#include "read-md.h"
#include "gensupport.h"
@@ -398,7 +399,7 @@ gen_insn (rtx insn, int lineno)
if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
return;
- printf ("/* %s:%d */\n", read_rtx_filename, lineno);
+ printf ("/* %s:%d */\n", read_md_filename, lineno);
/* Find out how many operands this function has. */
operands = max_operand_vec (insn, 1);
@@ -513,7 +514,7 @@ gen_expand (rtx expand)
/* Output the special code to be executed before the sequence
is generated. */
- print_rtx_ptr_loc (XSTR (expand, 3));
+ print_md_ptr_loc (XSTR (expand, 3));
printf ("%s\n", XSTR (expand, 3));
/* Output code to copy the arguments back out of `operands'
@@ -642,7 +643,7 @@ gen_split (rtx split)
if (XSTR (split, 3))
{
- print_rtx_ptr_loc (XSTR (split, 3));
+ print_md_ptr_loc (XSTR (split, 3));
printf ("%s\n", XSTR (split, 3));
}
@@ -832,7 +833,7 @@ main (int argc, char **argv)
progname = "genemit";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
/* Assign sequential codes to all entries in the machine description
@@ -887,17 +888,17 @@ from the machine description file `md'. */\n\n");
break;
case DEFINE_EXPAND:
- printf ("/* %s:%d */\n", read_rtx_filename, line_no);
+ printf ("/* %s:%d */\n", read_md_filename, line_no);
gen_expand (desc);
break;
case DEFINE_SPLIT:
- printf ("/* %s:%d */\n", read_rtx_filename, line_no);
+ printf ("/* %s:%d */\n", read_md_filename, line_no);
gen_split (desc);
break;
case DEFINE_PEEPHOLE2:
- printf ("/* %s:%d */\n", read_rtx_filename, line_no);
+ printf ("/* %s:%d */\n", read_md_filename, line_no);
gen_split (desc);
break;
diff --git a/gcc/genenums.c b/gcc/genenums.c
new file mode 100644
index 00000000000..8cb48360f62
--- /dev/null
+++ b/gcc/genenums.c
@@ -0,0 +1,66 @@
+/* Generate from machine description the strings for each enum.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "bconfig.h"
+#include "system.h"
+#include "coretypes.h"
+#include "errors.h"
+#include "read-md.h"
+
+/* Called via traverse_enum_types. Emit an enum definition for
+ enum_type *SLOT. */
+
+static int
+print_enum_type (void **slot, void *info ATTRIBUTE_UNUSED)
+{
+ struct enum_type *def;
+ struct enum_value *value;
+
+ def = (struct enum_type *) *slot;
+ printf ("\nconst char *const %s_strings[] = {", def->name);
+ for (value = def->values; value; value = value->next)
+ {
+ printf ("\n \"%s\"", value->def->name);
+ if (value->next)
+ putc (',', stdout);
+ }
+ printf ("\n};\n");
+ return 1;
+}
+
+int
+main (int argc, char **argv)
+{
+ progname = "genenums";
+
+ if (!read_md_files (argc, argv, NULL, NULL))
+ return (FATAL_EXIT_CODE);
+
+ puts ("/* Generated automatically by the program `genenums'");
+ puts (" from the machine description file. */\n");
+ puts ("#include \"config.h\"\n");
+ puts ("#include \"system.h\"\n");
+
+ traverse_enum_types (print_enum_type, 0);
+
+ if (ferror (stdout) || fflush (stdout) || fclose (stdout))
+ return FATAL_EXIT_CODE;
+
+ return SUCCESS_EXIT_CODE;
+}
diff --git a/gcc/genextract.c b/gcc/genextract.c
index c414891bb6b..2bf9779f381 100644
--- a/gcc/genextract.c
+++ b/gcc/genextract.c
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
+#include "read-md.h"
#include "gensupport.h"
#include "vec.h"
#include "vecprim.h"
@@ -409,7 +410,7 @@ main (int argc, char **argv)
progname = "genextract";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
/* Read the machine description. */
diff --git a/gcc/genflags.c b/gcc/genflags.c
index fcfd2f1bd89..f3cffe8746d 100644
--- a/gcc/genflags.c
+++ b/gcc/genflags.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "rtl.h"
#include "obstack.h"
#include "errors.h"
+#include "read-md.h"
#include "gensupport.h"
/* Obstack to remember insns with. */
@@ -261,7 +262,7 @@ main (int argc, char **argv)
direct calls to their generators in C code. */
insn_elision = 0;
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
puts ("/* Generated automatically by the program `genflags'");
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 65bb8d1cfc8..b16a33ac04d 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1657,13 +1657,21 @@ get_file_langdir (const char *f)
int lang_index;
const char * srcdir_relative_path = get_file_srcdir_relative_path (f);
+ const char * r;
if (!srcdir_relative_path)
return NULL;
lang_index = get_prefix_langdir_index (srcdir_relative_path);
+ if (lang_index < 0
+ && strncmp (srcdir_relative_path, "c-family", 8) == 0)
+ r = "c-family";
+ else if (lang_index >= 0)
+ r = lang_dir_names [lang_index];
+ else
+ r = NULL;
- return (lang_index >= 0) ? lang_dir_names [lang_index] : NULL;
+ return r;
}
/* The gt- output file name for F. */
@@ -1743,8 +1751,10 @@ get_output_file_with_visibility (const char *input_file)
(and gengtype doesn't know how to direct spewage into multiple
gtype-<lang>.h headers at this time). Instead, we pair up these
headers with source files (and their special purpose gt-*.h headers). */
- else if (strcmp (basename, "c-common.h") == 0)
- output_name = "gt-c-common.h", for_name = "c-common.c";
+ else if (strncmp (basename, "c-family", 8) == 0
+ && IS_DIR_SEPARATOR (basename[8])
+ && strcmp (basename + 9, "c-common.h") == 0)
+ output_name = "gt-c-family-c-common.h", for_name = "c-family/c-common.c";
else if (strcmp (basename, "c-lang.h") == 0)
output_name = "gt-c-decl.h", for_name = "c-decl.c";
else if (strcmp (basename, "c-tree.h") == 0)
@@ -1885,9 +1895,8 @@ static void output_escaped_param (struct walk_type_data *d,
const char *, const char *);
static void output_mangled_typename (outf_p, const_type_p);
static void walk_type (type_p t, struct walk_type_data *d);
-static void write_func_for_structure
- (type_p orig_s, type_p s, type_p * param,
- const struct write_types_data *wtd);
+static void write_func_for_structure (type_p orig_s, type_p s, type_p * param,
+ const struct write_types_data *wtd);
static void write_types_process_field
(type_p f, const struct walk_type_data *d);
static void write_types (outf_p output_header,
@@ -2078,6 +2087,8 @@ walk_type (type_p t, struct walk_type_data *d)
;
else if (strcmp (oo->name, "reorder") == 0)
;
+ else if (strcmp (oo->name, "variable_size") == 0)
+ ;
else
error_at_line (d->line, "unknown option `%s'\n", oo->name);
@@ -3016,6 +3027,20 @@ write_local (outf_p output_header, type_p structures, type_p param_structs)
}
}
+/* Nonzero if S is a type for which typed GC allocators should be output. */
+
+#define USED_BY_TYPED_GC_P(s) \
+ (((s->kind == TYPE_POINTER) \
+ && ((s->u.p->gc_used == GC_POINTED_TO) \
+ || (s->u.p->gc_used == GC_USED))) \
+ || (UNION_OR_STRUCT_P (s) && \
+ (((s)->gc_used == GC_POINTED_TO) \
+ || ((s)->gc_used == GC_MAYBE_POINTED_TO \
+ && s->u.s.line.file != NULL) \
+ || ((s)->gc_used == GC_USED \
+ && strncmp (s->u.s.tag, "anonymous", strlen ("anonymous"))))))
+
+
/* Write out the 'enum' definition for gt_types_enum. */
static void
@@ -3028,23 +3053,18 @@ write_enum_defn (type_p structures, type_p param_structs)
oprintf (header_file, "\n/* Enumeration of types known. */\n");
oprintf (header_file, "enum gt_types_enum {\n");
for (s = structures; s; s = s->next)
- if (s->gc_used == GC_POINTED_TO
- || s->gc_used == GC_MAYBE_POINTED_TO)
+ if (USED_BY_TYPED_GC_P (s))
{
- if (s->gc_used == GC_MAYBE_POINTED_TO
- && s->u.s.line.file == NULL)
- continue;
-
oprintf (header_file, " gt_ggc_e_");
output_mangled_typename (header_file, s);
- oprintf (header_file, ", \n");
+ oprintf (header_file, ",\n");
}
for (s = param_structs; s; s = s->next)
if (s->gc_used == GC_POINTED_TO)
{
oprintf (header_file, " gt_e_");
output_mangled_typename (header_file, s);
- oprintf (header_file, ", \n");
+ oprintf (header_file, ",\n");
}
oprintf (header_file, " gt_types_enum_last\n");
oprintf (header_file, "};\n");
@@ -3691,6 +3711,213 @@ note_def_vec_alloc (const char *type, const char *astrat, struct fileloc *pos)
do_typedef (astratname, new_structure (astratname, 0, pos, field, 0), pos);
}
+/* Returns the specifier keyword for a string or union type S, empty string
+ otherwise. */
+
+static const char *
+get_type_specifier (const type_p s)
+{
+ if (s->kind == TYPE_STRUCT || s->kind == TYPE_LANG_STRUCT)
+ return "struct ";
+ if (s->kind == TYPE_UNION)
+ return "union ";
+ return "";
+}
+
+/* TRUE if type S has the GTY variable_size annotation. */
+
+static bool
+variable_size_p (const type_p s)
+{
+ options_p o;
+ for (o = s->u.s.opt; o; o = o->next)
+ if (strcmp (o->name, "variable_size") == 0)
+ return true;
+ return false;
+}
+
+enum alloc_quantity { single, vector };
+enum alloc_zone { any_zone, specific_zone };
+
+/* Writes one typed allocator definition for type identifier TYPE_NAME with
+ optional type specifier TYPE_SPECIFIER. The allocator name will contain
+ ALLOCATOR_TYPE. If VARIABLE_SIZE is true, the allocator will have an extra
+ parameter specifying number of bytes to allocate. If QUANTITY is set to
+ VECTOR, a vector allocator will be output, if ZONE is set to SPECIFIC_ZONE,
+ the allocator will be zone-specific. */
+
+static void
+write_typed_alloc_def (bool variable_size, const char * type_specifier,
+ const char * type_name, const char * allocator_type,
+ enum alloc_quantity quantity, enum alloc_zone zone)
+{
+ bool two_args = variable_size && (quantity == vector);
+ bool third_arg = ((zone == specific_zone)
+ && (variable_size || (quantity == vector)));
+
+ oprintf (header_file, "#define ggc_alloc_%s%s",allocator_type, type_name);
+ oprintf (header_file, "(%s%s%s%s%s) ",
+ (variable_size ? "SIZE" : ""),
+ (two_args ? ", " : ""),
+ (quantity == vector) ? "n" : "",
+ (third_arg ? ", " : ""), (zone == specific_zone) ? "z" : "");
+ oprintf (header_file, "((%s%s *)", type_specifier, type_name);
+ oprintf (header_file, "(ggc_internal_%salloc_stat (", allocator_type);
+ if (zone == specific_zone)
+ oprintf (header_file, "z, ");
+ if (variable_size)
+ oprintf (header_file, "SIZE");
+ else
+ oprintf (header_file, "sizeof (%s%s)", type_specifier, type_name);
+ if (quantity == vector)
+ oprintf (header_file, ", n");
+ oprintf (header_file, " MEM_STAT_INFO)))\n");
+}
+
+/* Writes a typed allocator definition for a struct or union S. */
+
+static void
+write_typed_struct_alloc_def (const type_p s, const char * allocator_type,
+ enum alloc_quantity quantity,
+ enum alloc_zone zone)
+{
+ write_typed_alloc_def (variable_size_p (s), get_type_specifier (s),
+ s->u.s.tag, allocator_type, quantity, zone);
+}
+
+/* Writes a typed allocator definition for a typedef P. */
+
+static void
+write_typed_typedef_alloc_def (const pair_p p, const char * allocator_type,
+ enum alloc_quantity quantity,
+ enum alloc_zone zone)
+{
+ write_typed_alloc_def (variable_size_p (p->type), "", p->name,
+ allocator_type, quantity, zone);
+}
+
+/* Writes typed allocator definitions for the types in STRUCTURES and
+ TYPEDEFS that are used by GC. */
+
+static void
+write_typed_alloc_defns (const type_p structures, const pair_p typedefs)
+{
+ type_p s;
+ pair_p p;
+
+ oprintf (header_file,
+ "\n/* Allocators for known structs and unions. */\n\n");
+ for (s = structures; s; s = s->next)
+ {
+ if (!USED_BY_TYPED_GC_P (s))
+ continue;
+ write_typed_struct_alloc_def (s, "", single, any_zone);
+ write_typed_struct_alloc_def (s, "cleared_", single, any_zone);
+ write_typed_struct_alloc_def (s, "vec_", vector, any_zone);
+ write_typed_struct_alloc_def (s, "cleared_vec_", vector, any_zone);
+ write_typed_struct_alloc_def (s, "zone_", single, specific_zone);
+ write_typed_struct_alloc_def (s, "zone_cleared_", single,
+ specific_zone);
+ write_typed_struct_alloc_def (s, "zone_vec_", vector, specific_zone);
+ write_typed_struct_alloc_def (s, "zone_cleared_vec_", vector,
+ specific_zone);
+ }
+
+ oprintf (header_file, "\n/* Allocators for known typedefs. */\n");
+ for (p = typedefs; p; p = p->next)
+ {
+ s = p->type;
+ if (!USED_BY_TYPED_GC_P (s) || (strcmp (p->name, s->u.s.tag) == 0))
+ continue;
+ write_typed_typedef_alloc_def (p, "", single, any_zone);
+ write_typed_typedef_alloc_def (p, "cleared_", single, any_zone);
+ write_typed_typedef_alloc_def (p, "vec_", vector, any_zone);
+ write_typed_typedef_alloc_def (p, "cleared_vec_", vector, any_zone);
+ write_typed_typedef_alloc_def (p, "zone_", single, specific_zone);
+ write_typed_typedef_alloc_def (p, "zone_cleared_", single,
+ specific_zone);
+ write_typed_typedef_alloc_def (p, "zone_cleared_vec_", vector,
+ specific_zone);
+ }
+}
+
+/* Prints not-as-ugly version of a typename of T to OF. Trades the uniquness
+ guaranteee for somewhat increased readability. If name conflicts do happen,
+ this funcion will have to be adjusted to be more like
+ output_mangled_typename. */
+
+static void
+output_typename (outf_p of, const_type_p t)
+{
+ switch (t->kind)
+ {
+ case TYPE_STRING:
+ oprintf (of, "str");
+ break;
+ case TYPE_SCALAR:
+ oprintf (of, "scalar");
+ break;
+ case TYPE_POINTER:
+ output_typename (of, t->u.p);
+ break;
+ case TYPE_STRUCT:
+ case TYPE_UNION:
+ case TYPE_LANG_STRUCT:
+ oprintf (of, "%s", t->u.s.tag);
+ break;
+ case TYPE_PARAM_STRUCT:
+ {
+ int i;
+ for (i = 0; i < NUM_PARAM; i++)
+ if (t->u.param_struct.param[i] != NULL) {
+ output_typename (of, t->u.param_struct.param[i]);
+ oprintf (of, "_");
+ }
+ output_typename (of, t->u.param_struct.stru);
+ break;
+ }
+ default:
+ gcc_unreachable();
+ }
+}
+
+/* Writes a typed GC allocator for type S that is suitable as a callback for
+ the splay tree implementation in libiberty. */
+
+static void
+write_splay_tree_allocator_def (const_type_p s)
+{
+ outf_p of = get_output_file_for_structure(s, NULL);
+ oprintf (of, "void * ggc_alloc_splay_tree_");
+ output_typename (of, s);
+ oprintf (of, " (int sz, void * nl)\n");
+ oprintf (of, "{\n");
+ oprintf (of, " return ggc_splay_alloc (");
+ oprintf (of, "gt_e_");
+ output_mangled_typename (of, s);
+ oprintf (of, ", sz, nl);\n");
+ oprintf (of, "}\n\n");
+}
+
+/* Writes typed GC allocators for PARAM_STRUCTS that are suitable as callbacks
+ for the splay tree implementation in libiberty. */
+
+static void
+write_splay_tree_allocators (const_type_p param_structs)
+{
+ const_type_p s;
+
+ oprintf (header_file, "\n/* Splay tree callback allocators. */\n");
+ for (s = param_structs; s; s = s->next)
+ if (s->gc_used == GC_POINTED_TO)
+ {
+ oprintf (header_file, "extern void * ggc_alloc_splay_tree_");
+ output_typename (header_file, s);
+ oprintf (header_file, " (int, void *);\n");
+ write_splay_tree_allocator_def (s);
+ }
+}
+
static void dump_pair (int indent, pair_p p);
static void dump_type (int indent, type_p p);
static void dump_type_list (int indent, type_p p);
@@ -4011,6 +4238,7 @@ main (int argc, char **argv)
open_base_files ();
write_enum_defn (structures, param_structs);
+ write_typed_alloc_defns (structures, typedefs);
output_header = plugin_output ? plugin_output : header_file;
write_types (output_header, structures, param_structs, &ggc_wtd);
if (plugin_files == NULL)
@@ -4018,6 +4246,7 @@ main (int argc, char **argv)
write_types (header_file, structures, param_structs, &pch_wtd);
write_local (header_file, structures, param_structs);
}
+ write_splay_tree_allocators (param_structs);
write_roots (variables, plugin_files == NULL);
write_rtx_next ();
close_output_files ();
diff --git a/gcc/genhooks.c b/gcc/genhooks.c
new file mode 100644
index 00000000000..a9eecd79a92
--- /dev/null
+++ b/gcc/genhooks.c
@@ -0,0 +1,343 @@
+/* Process target.def to create initialization macros definition in
+ target-hooks-def.h and documentation in target-hooks.texi.
+ Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+#include "bconfig.h"
+#include "system.h"
+#include <string.h>
+#include "hashtab.h"
+#include "errors.h"
+
+struct hook_desc { const char *doc, *type, *name, *param, *init; };
+static struct hook_desc hook_array[] = {
+#define HOOK_VECTOR_1(NAME, FRAGMENT) \
+ { 0, 0, #NAME, 0, 0 },
+#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) \
+ { DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT },
+#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) \
+ { DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
+#define DEFHOOK_UNDOC(NAME, DOC, TYPE, PARAMS, INIT) \
+ { "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
+#include "target.def"
+#undef DEFHOOK
+};
+
+/* For each @Fcode in the the first paragraph of the documentation string DOC,
+ print an @findex directive. HOOK_NAME is the name of the hook this bit of
+ documentation pertains to. */
+static void
+emit_findices (const char *doc, const char *hook_name)
+{
+ const char *end = strstr (doc, "\n\n");
+ const char *fcode;
+
+ while ((fcode = strstr (doc, "@Fcode{")) && (!end || fcode < end))
+ {
+ fcode += strlen ("@Fcode{");
+ doc = strchr (fcode, '}');
+ if (!doc)
+ fatal ("Malformed @Fcode for hook %s\n", hook_name);
+ printf ("@findex %.*s\n", (int) (doc - fcode), fcode);
+ doc = fcode;
+ }
+}
+
+/* Return an upper-case copy of IN. */
+static char *
+upstrdup (const char *in)
+{
+ char *p, *ret = xstrdup (in);
+ for (p = ret; *p; p++)
+ *p = TOUPPER (*p);
+ return ret;
+}
+
+/* Struct for 'start hooks' which start a sequence of consecutive hooks
+ that are defined in target.def and to be documented in tm.texi. */
+struct s_hook
+{
+ char *name;
+ int pos;
+};
+
+static hashval_t
+s_hook_hash (const void *p)
+{
+ const struct s_hook *s_hook = (const struct s_hook *)p;
+ return htab_hash_string (s_hook->name);
+}
+
+static int
+s_hook_eq_p (const void *p1, const void *p2)
+{
+ return (strcmp (((const struct s_hook *) p1)->name,
+ ((const struct s_hook *) p2)->name) == 0);
+}
+
+/* Read the documentation file with name IN_FNAME, perform substitutions
+ to incorporate informtion from hook_array, and emit the result on stdout.
+ Hooks defined with DEFHOOK / DEFHOOKPOD are emitted at the place of a
+ matching @hook in the input file; if there is no matching @hook, the
+ hook is emitted after the hook that precedes it in target.def .
+ Usually, the emitted hook documentation starts with the hook
+ signature, followed by the string from the doc field.
+ The documentation is bracketed in @deftypefn / @deftypevr and a matching
+ @end.
+ While emitting the doc field, @Fcode is translated to @code, and an
+ @findex entry is added to the affected paragraph.
+ If the doc field starts with '*', the leading '*' is stripped, and the doc
+ field is otherwise emitted unaltered; no function signature/
+ @deftypefn/deftypevr/@end is emitted.
+ In particular, a doc field of "*" means not to emit any ocumentation for
+ this target.def / hook_array entry at all (there might be documentation
+ for this hook in the file named IN_FNAME, though).
+ A doc field of 0 is used to append the hook signature after the previous
+ hook's signture, so that one description can be used for a group of hooks.
+ When the doc field is "", @deftypefn/@deftypevr and the hook signature
+ is emitted, but not the matching @end. This allows all the free-form
+ documentation to be placed in IN_FNAME, to work around GPL/GFDL
+ licensing incompatibility issues. */
+static void
+emit_documentation (const char *in_fname)
+{
+ int i, j;
+ char buf[1000];
+ htab_t start_hooks = htab_create (99, s_hook_hash, s_hook_eq_p, (htab_del) 0);
+ FILE *f;
+ bool found_start = false;
+
+ /* Enter all the start hooks in start_hooks. */
+ f = fopen (in_fname, "r");
+ if (!f)
+ {
+ perror ("");
+ fatal ("Couldn't open input file");
+ }
+ while (fscanf (f, "%*[^@]"), buf[0] = '\0',
+ fscanf (f, "@%5[^ \n]", buf) != EOF)
+ {
+ void **p;
+ struct s_hook *shp;
+
+ if (strcmp (buf, "hook") != 0)
+ continue;
+ buf[0] = '\0';
+ fscanf (f, "%999s", buf);
+ shp = XNEW (struct s_hook);
+ shp->name = upstrdup (buf);
+ shp->pos = -1;
+ p = htab_find_slot (start_hooks, shp, INSERT);
+ if (*p != HTAB_EMPTY_ENTRY)
+ fatal ("Duplicate placement for hook %s\n", shp->name);
+ *(struct s_hook **) p = shp;
+ }
+ fclose (f);
+ /* For each hook in hook_array, if it is a start hook, store its position. */
+ for (i = 0; i < (int) (sizeof hook_array / sizeof hook_array[0]); i++)
+ {
+ struct s_hook sh, *shp;
+ void *p;
+
+ if (!hook_array[i].doc || strcmp (hook_array[i].doc, "*") == 0)
+ continue;
+ sh.name = upstrdup (hook_array[i].name);
+ p = htab_find (start_hooks, &sh);
+ if (p)
+ {
+ shp = (struct s_hook *) p;
+ if (shp->pos >= 0)
+ fatal ("Duplicate hook %s\n", sh.name);
+ shp->pos = i;
+ found_start = true;
+ }
+ else if (!found_start)
+ fatal ("No place specified to document hook %s\n", sh.name);
+ free (sh.name);
+ }
+ /* Copy input file to stdout, substituting @hook directives with the
+ corresponding hook documentation sequences. */
+ f = fopen (in_fname, "r");
+ if (!f)
+ {
+ perror ("");
+ fatal ("Couldn't open input file");
+ }
+ for (;;)
+ {
+ struct s_hook sh, *shp;
+ int c = getc (f);
+ char *name;
+
+ if (c == EOF)
+ break;
+ if (c != '@')
+ {
+ putchar (c);
+ continue;
+ }
+ buf[0] = '\0';
+ fscanf (f, "%5[^ \n]", buf);
+ if (strcmp (buf, "hook") != 0)
+ {
+ printf ("@%s", buf);
+ continue;
+ }
+ fscanf (f, "%999s", buf);
+ sh.name = name = upstrdup (buf);
+ shp = (struct s_hook *) htab_find (start_hooks, &sh);
+ if (!shp || shp->pos < 0)
+ fatal ("No documentation for hook %s\n", sh.name);
+ i = shp->pos;
+ do
+ {
+ const char *q, *e;
+ const char *deftype;
+ const char *doc, *fcode, *p_end;
+
+ /* A leading '*' means to output the documentation string without
+ further processing. */
+ if (*hook_array[i].doc == '*')
+ printf ("%s", hook_array[i].doc + 1);
+ else
+ {
+ if (i != shp->pos)
+ printf ("\n\n");
+ emit_findices (hook_array[i].doc, name);
+
+ /* Print header. Function-valued hooks have a parameter list,
+ unlike POD-valued ones. */
+ deftype = hook_array[i].param ? "deftypefn" : "deftypevr";
+ printf ("@%s {Target Hook} ", deftype);
+ if (strchr (hook_array[i].type, ' '))
+ printf ("{%s}", hook_array[i].type);
+ else
+ printf ("%s", hook_array[i].type);
+ printf (" %s", name);
+ if (hook_array[i].param)
+ {
+ /* Print the parameter list, with the parameter names
+ enclosed in @var{}. */
+ printf (" ");
+ for (q = hook_array[i].param; (e = strpbrk (q, " *,)"));
+ q = e + 1)
+ /* Type names like 'int' are followed by a space, sometimes
+ also by '*'. 'void' should appear only in "(void)". */
+ if (*e == ' ' || *e == '*' || *q == '(')
+ printf ("%.*s", (int) (e - q + 1), q);
+ else
+ printf ("@var{%.*s}%c", (int) (e - q), q, *e);
+ }
+ /* POD-valued hooks sometimes come in groups with common
+ documentation.*/
+ for (j = i + 1;
+ j < (int) (sizeof hook_array / sizeof hook_array[0])
+ && hook_array[j].doc == 0 && hook_array[j].type; j++)
+ {
+ char *namex = upstrdup (hook_array[j].name);
+
+ printf ("\n@%sx {Target Hook} {%s} %s",
+ deftype, hook_array[j].type, namex);
+ }
+ if (hook_array[i].doc[0])
+ {
+ printf ("\n");
+ /* Print each documentation paragraph in turn. */
+ for (doc = hook_array[i].doc; *doc; doc = p_end)
+ {
+ /* Find paragraph end. */
+ p_end = strstr (doc, "\n\n");
+ p_end = (p_end ? p_end + 2 : doc + strlen (doc));
+ /* Print paragraph, emitting @Fcode as @code. */
+ for (; (fcode = strstr (doc, "@Fcode{")) && fcode < p_end;
+ doc = fcode + 2)
+ printf ("%.*s@", (int) (fcode - doc), doc);
+ printf ("%.*s", (int) (p_end - doc), doc);
+ /* Emit function indices for next paragraph. */
+ emit_findices (p_end, name);
+ }
+ printf ("\n@end %s", deftype);
+ }
+ }
+ if (++i >= (int) (sizeof hook_array / sizeof hook_array[0])
+ || !hook_array[i].doc)
+ break;
+ free (name);
+ sh.name = name = upstrdup (hook_array[i].name);
+ }
+ while (!htab_find (start_hooks, &sh));
+ free (name);
+ }
+}
+
+/* Emit #defines to stdout (this will be redirected to generate
+ target-hook-def.h) which set target hooks initializer macros
+ to their default values. */
+static void
+emit_init_macros (void)
+{
+ int i;
+ const int MAX_NEST = 2;
+ int print_nest, nest = 0;
+
+ for (print_nest = 0; print_nest <= MAX_NEST; print_nest++)
+ {
+ for (i = 0; i < (int) (sizeof hook_array / sizeof hook_array[0]); i++)
+ {
+ char *name = upstrdup (hook_array[i].name);
+
+ if (!hook_array[i].type)
+ {
+ if (*name)
+ {
+ if (nest && nest == print_nest)
+ printf (" %s, \\\n", name);
+ nest++;
+ if (nest > MAX_NEST)
+ fatal ("Unexpected nesting of %s\n", name);
+ if (nest == print_nest)
+ printf ("\n#define %s \\\n { \\\n", name);
+ }
+ else
+ {
+ if (nest == print_nest)
+ printf (" }\n");
+ nest--;
+ }
+ continue;
+ }
+ if (0 == print_nest)
+ {
+ /* Output default definitions of target hooks. */
+ printf ("#ifndef %s\n#define %s %s\n#endif\n",
+ name, name, hook_array[i].init);
+ }
+ if (nest == print_nest)
+ printf (" %s, \\\n", name);
+ }
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc >= 2)
+ emit_documentation (argv[1]);
+ else
+ emit_init_macros ();
+ return 0;
+}
diff --git a/gcc/genmddeps.c b/gcc/genmddeps.c
index fb5c3113e54..15311eeaed6 100644
--- a/gcc/genmddeps.c
+++ b/gcc/genmddeps.c
@@ -18,10 +18,8 @@
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
-#include "rtl.h"
-#include "gensupport.h"
#include "errors.h"
+#include "read-md.h"
struct filedep
@@ -49,8 +47,8 @@ main (int argc, char **argv)
progname = "genmddeps";
include_callback = add_filedep;
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
- return (FATAL_EXIT_CODE);
+ if (!read_md_files (argc, argv, NULL, NULL))
+ return FATAL_EXIT_CODE;
*last = NULL;
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index d28baabba7f..d0ec274842a 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -472,7 +472,7 @@ main (int argc, char **argv)
progname = "genopinit";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
printf ("/* Generated automatically by the program `genopinit'\n\
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index b65e1dbe6cc..a5d6a128379 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
/* This program reads the machine description for the compiler target machine
and produces a file containing these things:
- 1. An array of `struct insn_data', which is indexed by insn code number,
+ 1. An array of `struct insn_data_d', which is indexed by insn code number,
which contains:
a. `name' is the name for that pattern. Nameless patterns are
@@ -88,6 +88,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
+#include "read-md.h"
#include "gensupport.h"
/* No instruction can have more operands than this. Sorry for this
@@ -292,7 +293,7 @@ output_insn_data (void)
}
printf ("#if GCC_VERSION >= 2007\n__extension__\n#endif\n");
- printf ("\nconst struct insn_data insn_data[] = \n{\n");
+ printf ("\nconst struct insn_data_d insn_data[] = \n{\n");
for (d = idata; d; d = d->next)
{
@@ -445,17 +446,11 @@ scan_operands (struct data *d, rtx part, int this_address_p,
max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS)
{
- message_with_line (d->lineno,
- "maximum number of operands exceeded");
- have_error = 1;
+ error_with_line (d->lineno, "maximum number of operands exceeded");
return;
}
if (d->operand[opno].seen)
- {
- message_with_line (d->lineno,
- "repeated operand number %d\n", opno);
- have_error = 1;
- }
+ error_with_line (d->lineno, "repeated operand number %d\n", opno);
d->operand[opno].seen = 1;
d->operand[opno].mode = GET_MODE (part);
@@ -474,17 +469,11 @@ scan_operands (struct data *d, rtx part, int this_address_p,
max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS)
{
- message_with_line (d->lineno,
- "maximum number of operands exceeded");
- have_error = 1;
+ error_with_line (d->lineno, "maximum number of operands exceeded");
return;
}
if (d->operand[opno].seen)
- {
- message_with_line (d->lineno,
- "repeated operand number %d\n", opno);
- have_error = 1;
- }
+ error_with_line (d->lineno, "repeated operand number %d\n", opno);
d->operand[opno].seen = 1;
d->operand[opno].mode = GET_MODE (part);
@@ -504,17 +493,11 @@ scan_operands (struct data *d, rtx part, int this_address_p,
max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS)
{
- message_with_line (d->lineno,
- "maximum number of operands exceeded");
- have_error = 1;
+ error_with_line (d->lineno, "maximum number of operands exceeded");
return;
}
if (d->operand[opno].seen)
- {
- message_with_line (d->lineno,
- "repeated operand number %d\n", opno);
- have_error = 1;
- }
+ error_with_line (d->lineno, "repeated operand number %d\n", opno);
d->operand[opno].seen = 1;
d->operand[opno].mode = GET_MODE (part);
@@ -672,7 +655,7 @@ process_template (struct data *d, const char *template_code)
printf ("output_%d (rtx *operands ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED)\n",
d->code_number);
puts ("{");
- print_rtx_ptr_loc (template_code);
+ print_md_ptr_loc (template_code);
puts (template_code + 1);
puts ("}");
}
@@ -716,11 +699,8 @@ process_template (struct data *d, const char *template_code)
message_with_line (d->lineno,
"'@' is redundant for output template with single alternative");
if (i != d->n_alternatives)
- {
- message_with_line (d->lineno,
- "wrong number of alternatives in the output template");
- have_error = 1;
- }
+ error_with_line (d->lineno,
+ "wrong number of alternatives in the output template");
printf ("};\n");
}
@@ -769,11 +749,11 @@ validate_insn_alternatives (struct data *d)
if (len < 1 || (len > 1 && strchr (",#*+=&%!0123456789", c)))
{
- message_with_line (d->lineno,
- "invalid length %d for char '%c' in alternative %d of operand %d",
- len, c, which_alternative, start);
+ error_with_line (d->lineno,
+ "invalid length %d for char '%c' in"
+ " alternative %d of operand %d",
+ len, c, which_alternative, start);
len = 1;
- have_error = 1;
}
#endif
@@ -786,30 +766,28 @@ validate_insn_alternatives (struct data *d)
for (i = 1; i < len; i++)
if (p[i] == '\0')
{
- message_with_line (d->lineno,
- "NUL in alternative %d of operand %d",
- which_alternative, start);
+ error_with_line (d->lineno,
+ "NUL in alternative %d of operand %d",
+ which_alternative, start);
alternative_count_unsure = 1;
break;
}
else if (strchr (",#*", p[i]))
{
- message_with_line (d->lineno,
- "'%c' in alternative %d of operand %d",
- p[i], which_alternative, start);
+ error_with_line (d->lineno,
+ "'%c' in alternative %d of operand %d",
+ p[i], which_alternative, start);
alternative_count_unsure = 1;
}
}
- if (alternative_count_unsure)
- have_error = 1;
- else if (n == 0)
- n = d->operand[start].n_alternatives;
- else if (n != d->operand[start].n_alternatives)
+ if (!alternative_count_unsure)
{
- message_with_line (d->lineno,
+ if (n == 0)
+ n = d->operand[start].n_alternatives;
+ else if (n != d->operand[start].n_alternatives)
+ error_with_line (d->lineno,
"wrong number of alternatives in operand %d",
start);
- have_error = 1;
}
}
@@ -826,10 +804,7 @@ validate_insn_operands (struct data *d)
for (i = 0; i < d->n_operands; ++i)
if (d->operand[i].seen == 0)
- {
- message_with_line (d->lineno, "missing operand %d", i);
- have_error = 1;
- }
+ error_with_line (d->lineno, "missing operand %d", i);
}
static void
@@ -860,7 +835,7 @@ gen_insn (rtx insn, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
- d->filename = read_rtx_filename;
+ d->filename = read_md_filename;
d->lineno = lineno;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
@@ -905,7 +880,7 @@ gen_peephole (rtx peep, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
- d->filename = read_rtx_filename;
+ d->filename = read_md_filename;
d->lineno = lineno;
d->name = 0;
@@ -944,7 +919,7 @@ gen_expand (rtx insn, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
- d->filename = read_rtx_filename;
+ d->filename = read_md_filename;
d->lineno = lineno;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
@@ -989,7 +964,7 @@ gen_split (rtx split, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
- d->filename = read_rtx_filename;
+ d->filename = read_md_filename;
d->lineno = lineno;
d->name = 0;
@@ -1027,7 +1002,7 @@ main (int argc, char **argv)
progname = "genoutput";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
output_prologue ();
@@ -1147,13 +1122,12 @@ note_constraint (rtx exp, int lineno)
if (strchr (indep_constraints, name[0]) && name[0] != 'm')
{
if (name[1] == '\0')
- message_with_line (lineno, "constraint letter '%s' cannot be "
- "redefined by the machine description", name);
+ error_with_line (lineno, "constraint letter '%s' cannot be "
+ "redefined by the machine description", name);
else
- message_with_line (lineno, "constraint name '%s' cannot be defined by "
- "the machine description, as it begins with '%c'",
- name, name[0]);
- have_error = 1;
+ error_with_line (lineno, "constraint name '%s' cannot be defined by "
+ "the machine description, as it begins with '%c'",
+ name, name[0]);
return;
}
@@ -1170,25 +1144,22 @@ note_constraint (rtx exp, int lineno)
if (!strcmp ((*iter)->name, name))
{
- message_with_line (lineno, "redefinition of constraint '%s'", name);
+ error_with_line (lineno, "redefinition of constraint '%s'", name);
message_with_line ((*iter)->lineno, "previous definition is here");
- have_error = 1;
return;
}
else if (!strncmp ((*iter)->name, name, (*iter)->namelen))
{
- message_with_line (lineno, "defining constraint '%s' here", name);
+ error_with_line (lineno, "defining constraint '%s' here", name);
message_with_line ((*iter)->lineno, "renders constraint '%s' "
"(defined here) a prefix", (*iter)->name);
- have_error = 1;
return;
}
else if (!strncmp ((*iter)->name, name, namelen))
{
- message_with_line (lineno, "constraint '%s' is a prefix", name);
+ error_with_line (lineno, "constraint '%s' is a prefix", name);
message_with_line ((*iter)->lineno, "of constraint '%s' "
"(defined here)", (*iter)->name);
- have_error = 1;
return;
}
}
@@ -1216,11 +1187,10 @@ mdep_constraint_len (const char *s, int lineno, int opno)
if (!strncmp (s, p->name, p->namelen))
return p->namelen;
- message_with_line (lineno,
- "error: undefined machine-specific constraint "
- "at this point: \"%s\"", s);
+ error_with_line (lineno,
+ "error: undefined machine-specific constraint "
+ "at this point: \"%s\"", s);
message_with_line (lineno, "note: in operand %d", opno);
- have_error = 1;
return 1; /* safe */
}
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index 0fec59f317c..b129f94b020 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -358,7 +358,7 @@ main (int argc, char **argv)
progname = "genpeep";
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
printf ("/* Generated automatically by the program `genpeep'\n\
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index 3e7070ee380..c69647042c7 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "rtl.h"
#include "errors.h"
#include "obstack.h"
+#include "read-md.h"
#include "gensupport.h"
/* Given a predicate expression EXP, from form NAME at line LINENO,
@@ -66,9 +67,8 @@ validate_exp (rtx exp, const char *name, int lineno)
{
if (!ISDIGIT (*p) && !ISLOWER (*p))
{
- message_with_line (lineno, "%s: invalid character in path "
- "string '%s'", name, XSTR (exp, 1));
- have_error = 1;
+ error_with_line (lineno, "%s: invalid character in path "
+ "string '%s'", name, XSTR (exp, 1));
return true;
}
}
@@ -81,10 +81,9 @@ validate_exp (rtx exp, const char *name, int lineno)
return false;
default:
- message_with_line (lineno,
- "%s: cannot use '%s' in a predicate expression",
- name, GET_RTX_NAME (GET_CODE (exp)));
- have_error = 1;
+ error_with_line (lineno,
+ "%s: cannot use '%s' in a predicate expression",
+ name, GET_RTX_NAME (GET_CODE (exp)));
return true;
}
}
@@ -118,10 +117,9 @@ process_define_predicate (rtx defn, int lineno)
return;
bad_name:
- message_with_line (lineno,
- "%s: predicate name must be a valid C function name",
- XSTR (defn, 0));
- have_error = 1;
+ error_with_line (lineno,
+ "%s: predicate name must be a valid C function name",
+ XSTR (defn, 0));
return;
}
@@ -183,7 +181,7 @@ write_predicate_subfunction (struct pred_data *p)
printf ("static inline int\n"
"%s_1 (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)\n",
p->name);
- print_rtx_ptr_loc (p->c_block);
+ print_md_ptr_loc (p->c_block);
if (p->c_block[0] == '{')
fputs (p->c_block, stdout);
else
@@ -764,12 +762,11 @@ add_constraint (const char *name, const char *regclass,
if (!ISALPHA (name[0]) && name[0] != '_')
{
if (name[1] == '\0')
- message_with_line (lineno, "constraint name '%s' is not "
- "a letter or underscore", name);
+ error_with_line (lineno, "constraint name '%s' is not "
+ "a letter or underscore", name);
else
- message_with_line (lineno, "constraint name '%s' does not begin "
- "with a letter or underscore", name);
- have_error = 1;
+ error_with_line (lineno, "constraint name '%s' does not begin "
+ "with a letter or underscore", name);
return;
}
for (p = name; *p; p++)
@@ -779,11 +776,10 @@ add_constraint (const char *name, const char *regclass,
need_mangled_name = true;
else
{
- message_with_line (lineno,
- "constraint name '%s' must be composed of "
- "letters, digits, underscores, and "
- "angle brackets", name);
- have_error = 1;
+ error_with_line (lineno,
+ "constraint name '%s' must be composed of "
+ "letters, digits, underscores, and "
+ "angle brackets", name);
return;
}
}
@@ -791,13 +787,12 @@ add_constraint (const char *name, const char *regclass,
if (strchr (generic_constraint_letters, name[0]))
{
if (name[1] == '\0')
- message_with_line (lineno, "constraint letter '%s' cannot be "
- "redefined by the machine description", name);
+ error_with_line (lineno, "constraint letter '%s' cannot be "
+ "redefined by the machine description", name);
else
- message_with_line (lineno, "constraint name '%s' cannot be defined by "
- "the machine description, as it begins with '%c'",
- name, name[0]);
- have_error = 1;
+ error_with_line (lineno, "constraint name '%s' cannot be defined by "
+ "the machine description, as it begins with '%c'",
+ name, name[0]);
return;
}
@@ -816,25 +811,22 @@ add_constraint (const char *name, const char *regclass,
if (!strcmp ((*iter)->name, name))
{
- message_with_line (lineno, "redefinition of constraint '%s'", name);
+ error_with_line (lineno, "redefinition of constraint '%s'", name);
message_with_line ((*iter)->lineno, "previous definition is here");
- have_error = 1;
return;
}
else if (!strncmp ((*iter)->name, name, (*iter)->namelen))
{
- message_with_line (lineno, "defining constraint '%s' here", name);
+ error_with_line (lineno, "defining constraint '%s' here", name);
message_with_line ((*iter)->lineno, "renders constraint '%s' "
"(defined here) a prefix", (*iter)->name);
- have_error = 1;
return;
}
else if (!strncmp ((*iter)->name, name, namelen))
{
- message_with_line (lineno, "constraint '%s' is a prefix", name);
+ error_with_line (lineno, "constraint '%s' is a prefix", name);
message_with_line ((*iter)->lineno, "of constraint '%s' "
"(defined here)", (*iter)->name);
- have_error = 1;
return;
}
}
@@ -855,43 +847,36 @@ add_constraint (const char *name, const char *regclass,
GET_RTX_NAME (appropriate_code)))
{
if (name[1] == '\0')
- message_with_line (lineno, "constraint letter '%c' is reserved "
- "for %s constraints",
- name[0], GET_RTX_NAME (appropriate_code));
+ error_with_line (lineno, "constraint letter '%c' is reserved "
+ "for %s constraints",
+ name[0], GET_RTX_NAME (appropriate_code));
else
- message_with_line (lineno, "constraint names beginning with '%c' "
- "(%s) are reserved for %s constraints",
- name[0], name,
- GET_RTX_NAME (appropriate_code));
-
- have_error = 1;
+ error_with_line (lineno, "constraint names beginning with '%c' "
+ "(%s) are reserved for %s constraints",
+ name[0], name, GET_RTX_NAME (appropriate_code));
return;
}
if (is_memory)
{
if (name[1] == '\0')
- message_with_line (lineno, "constraint letter '%c' cannot be a "
- "memory constraint", name[0]);
+ error_with_line (lineno, "constraint letter '%c' cannot be a "
+ "memory constraint", name[0]);
else
- message_with_line (lineno, "constraint name '%s' begins with '%c', "
- "and therefore cannot be a memory constraint",
- name, name[0]);
-
- have_error = 1;
+ error_with_line (lineno, "constraint name '%s' begins with '%c', "
+ "and therefore cannot be a memory constraint",
+ name, name[0]);
return;
}
else if (is_address)
{
if (name[1] == '\0')
- message_with_line (lineno, "constraint letter '%c' cannot be a "
- "memory constraint", name[0]);
+ error_with_line (lineno, "constraint letter '%c' cannot be a "
+ "memory constraint", name[0]);
else
- message_with_line (lineno, "constraint name '%s' begins with '%c', "
- "and therefore cannot be a memory constraint",
- name, name[0]);
-
- have_error = 1;
+ error_with_line (lineno, "constraint name '%s' begins with '%c', "
+ "and therefore cannot be a memory constraint",
+ name, name[0]);
return;
}
}
@@ -1408,7 +1393,7 @@ main (int argc, char **argv)
progname = argv[0];
if (argc <= 1)
fatal ("no input file name");
- if (init_md_reader_args_cb (argc, argv, parse_option) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args_cb (argc, argv, parse_option))
return FATAL_EXIT_CODE;
while ((defn = read_md_rtx (&pattern_lineno, &next_insn_code)) != 0)
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index b299b7c55fc..bc7767f192c 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -56,6 +56,7 @@
#include "tm.h"
#include "rtl.h"
#include "errors.h"
+#include "read-md.h"
#include "gensupport.h"
#define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \
@@ -169,9 +170,6 @@ static int max_depth;
/* The line number of the start of the pattern currently being processed. */
static int pattern_lineno;
-
-/* Count of errors. */
-static int error_count;
/* Predicate handling.
@@ -288,8 +286,7 @@ compute_predicate_codes (rtx exp, char codes[NUM_RTX_CODE])
if (*next_code == '\0')
{
- message_with_line (pattern_lineno, "empty match_code expression");
- error_count++;
+ error_with_line (pattern_lineno, "empty match_code expression");
break;
}
@@ -308,9 +305,9 @@ compute_predicate_codes (rtx exp, char codes[NUM_RTX_CODE])
}
if (!found_it)
{
- message_with_line (pattern_lineno, "match_code \"%.*s\" matches nothing",
- (int) n, code);
- error_count ++;
+ error_with_line (pattern_lineno,
+ "match_code \"%.*s\" matches nothing",
+ (int) n, code);
for (i = 0; i < NUM_RTX_CODE; i++)
if (!strncasecmp (code, GET_RTX_NAME (i), n)
&& GET_RTX_NAME (i)[n] == '\0'
@@ -332,10 +329,9 @@ compute_predicate_codes (rtx exp, char codes[NUM_RTX_CODE])
struct pred_data *p = lookup_predicate (XSTR (exp, 1));
if (!p)
{
- message_with_line (pattern_lineno,
- "reference to unknown predicate '%s'",
- XSTR (exp, 1));
- error_count++;
+ error_with_line (pattern_lineno,
+ "reference to unknown predicate '%s'",
+ XSTR (exp, 1));
break;
}
for (i = 0; i < NUM_RTX_CODE; i++)
@@ -350,10 +346,9 @@ compute_predicate_codes (rtx exp, char codes[NUM_RTX_CODE])
break;
default:
- message_with_line (pattern_lineno,
- "'%s' cannot be used in a define_predicate expression",
- GET_RTX_NAME (GET_CODE (exp)));
- error_count++;
+ error_with_line (pattern_lineno,
+ "'%s' cannot be used in a define_predicate expression",
+ GET_RTX_NAME (GET_CODE (exp)));
memset (codes, I, NUM_RTX_CODE);
break;
}
@@ -633,12 +628,9 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
case MATCH_OP_DUP:
case MATCH_PAR_DUP:
if (find_operand (insn, XINT (pattern, 0), pattern) == pattern)
- {
- message_with_line (pattern_lineno,
- "operand %i duplicated before defined",
- XINT (pattern, 0));
- error_count++;
- }
+ error_with_line (pattern_lineno,
+ "operand %i duplicated before defined",
+ XINT (pattern, 0));
break;
case MATCH_OPERAND:
case MATCH_OPERATOR:
@@ -694,20 +686,14 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
&& find_matching_operand (insn, XINT (pattern, 0)))
;
else
- {
- message_with_line (pattern_lineno,
- "operand %d missing in-out reload",
- XINT (pattern, 0));
- error_count++;
- }
- }
- else if (constraints0 != '=' && constraints0 != '+')
- {
- message_with_line (pattern_lineno,
- "operand %d missing output reload",
+ error_with_line (pattern_lineno,
+ "operand %d missing in-out reload",
XINT (pattern, 0));
- error_count++;
}
+ else if (constraints0 != '=' && constraints0 != '+')
+ error_with_line (pattern_lineno,
+ "operand %d missing output reload",
+ XINT (pattern, 0));
}
}
@@ -781,12 +767,9 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
/* The operands of a SET must have the same mode unless one
is VOIDmode. */
else if (dmode != VOIDmode && smode != VOIDmode && dmode != smode)
- {
- message_with_line (pattern_lineno,
- "mode mismatch in set: %smode vs %smode",
- GET_MODE_NAME (dmode), GET_MODE_NAME (smode));
- error_count++;
- }
+ error_with_line (pattern_lineno,
+ "mode mismatch in set: %smode vs %smode",
+ GET_MODE_NAME (dmode), GET_MODE_NAME (smode));
/* If only one of the operands is VOIDmode, and PC or CC0 is
not involved, it's probably a mistake. */
@@ -827,12 +810,9 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
case LABEL_REF:
if (GET_MODE (XEXP (pattern, 0)) != VOIDmode)
- {
- message_with_line (pattern_lineno,
- "operand to label_ref %smode not VOIDmode",
- GET_MODE_NAME (GET_MODE (XEXP (pattern, 0))));
- error_count++;
- }
+ error_with_line (pattern_lineno,
+ "operand to label_ref %smode not VOIDmode",
+ GET_MODE_NAME (GET_MODE (XEXP (pattern, 0))));
break;
default:
@@ -1493,12 +1473,11 @@ merge_accept_insn (struct decision *oldd, struct decision *addd)
}
else
{
- message_with_line (add->u.insn.lineno, "`%s' matches `%s'",
- get_insn_name (add->u.insn.code_number),
- get_insn_name (old->u.insn.code_number));
+ error_with_line (add->u.insn.lineno, "`%s' matches `%s'",
+ get_insn_name (add->u.insn.code_number),
+ get_insn_name (old->u.insn.code_number));
message_with_line (old->u.insn.lineno, "previous definition of `%s'",
get_insn_name (old->u.insn.code_number));
- error_count++;
}
}
@@ -1782,20 +1761,11 @@ change_state (const char *oldpos, const char *newpos, const char *indent)
int odepth = strlen (oldpos);
int ndepth = strlen (newpos);
int depth;
- int old_has_insn, new_has_insn;
/* Pop up as many levels as necessary. */
for (depth = odepth; strncmp (oldpos, newpos, depth) != 0; --depth)
continue;
- /* Hunt for the last [A-Z] in both strings. */
- for (old_has_insn = odepth - 1; old_has_insn >= 0; --old_has_insn)
- if (ISUPPER (oldpos[old_has_insn]))
- break;
- for (new_has_insn = ndepth - 1; new_has_insn >= 0; --new_has_insn)
- if (ISUPPER (newpos[new_has_insn]))
- break;
-
/* Go down to desired level. */
while (depth < ndepth)
{
@@ -2729,7 +2699,7 @@ main (int argc, char **argv)
memset (&split_tree, 0, sizeof split_tree);
memset (&peephole2_tree, 0, sizeof peephole2_tree);
- if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
+ if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
next_insn_code = 0;
@@ -2770,7 +2740,7 @@ main (int argc, char **argv)
}
}
- if (error_count || have_error)
+ if (have_error)
return FATAL_EXIT_CODE;
puts ("\n\n");
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index 74b1d256ba2..206e96b7c61 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -26,6 +26,7 @@
#include "obstack.h"
#include "errors.h"
#include "hashtab.h"
+#include "read-md.h"
#include "gensupport.h"
@@ -34,17 +35,10 @@ int target_flags;
int insn_elision = 1;
-const char *in_fname;
-
-/* This callback will be invoked whenever an rtl include directive is
- processed. To be used for creation of the dependency file. */
-void (*include_callback) (const char *);
-
static struct obstack obstack;
struct obstack *rtl_obstack = &obstack;
static int sequence_num;
-static int errors;
static int predicable_default;
static const char *predicable_true;
@@ -52,8 +46,6 @@ static const char *predicable_false;
static htab_t condition_table;
-static char *base_dir = NULL;
-
/* We initially queue all patterns, process the define_insn and
define_cond_exec patterns, then return them one at a time. */
@@ -82,22 +74,6 @@ static struct queue_elem **other_tail = &other_queue;
static struct queue_elem *queue_pattern (rtx, struct queue_elem ***,
const char *, int);
-/* Current maximum length of directory names in the search path
- for include files. (Altered as we get more of them.) */
-
-size_t max_include_len;
-
-struct file_name_list
- {
- struct file_name_list *next;
- const char *fname;
- };
-
-struct file_name_list *first_dir_md_include = 0; /* First dir to search */
- /* First dir to search for <file> */
-struct file_name_list *first_bracket_include = 0;
-struct file_name_list *last_dir_md_include = 0; /* Last in chain */
-
static void remove_constraints (rtx);
static void process_rtx (rtx, int);
@@ -114,25 +90,9 @@ static const char *alter_output_for_insn (struct queue_elem *,
int, int);
static void process_one_cond_exec (struct queue_elem *);
static void process_define_cond_exec (void);
-static void process_include (rtx, int);
-static char *save_string (const char *, int);
static void init_predicate_table (void);
static void record_insn_name (int, const char *);
-void
-message_with_line (int lineno, const char *msg, ...)
-{
- va_list ap;
-
- va_start (ap, msg);
-
- fprintf (stderr, "%s:%d: ", read_rtx_filename, lineno);
- vfprintf (stderr, msg, ap);
- fputc ('\n', stderr);
-
- va_end (ap);
-}
-
/* Make a version of gen_rtx_CONST_INT so that GEN_INT can be used in
the gensupport programs. */
@@ -197,74 +157,6 @@ remove_constraints (rtx part)
}
}
-/* Process an include file assuming that it lives in gcc/config/{target}/
- if the include looks like (include "file"). */
-
-static void
-process_include (rtx desc, int lineno)
-{
- const char *filename = XSTR (desc, 0);
- const char *old_filename;
- int old_lineno;
- char *pathname;
- FILE *input_file;
-
- /* If specified file name is absolute, skip the include stack. */
- if (! IS_ABSOLUTE_PATH (filename))
- {
- struct file_name_list *stackp;
-
- /* Search directory path, trying to open the file. */
- for (stackp = first_dir_md_include; stackp; stackp = stackp->next)
- {
- static const char sep[2] = { DIR_SEPARATOR, '\0' };
-
- pathname = concat (stackp->fname, sep, filename, NULL);
- input_file = fopen (pathname, "r");
- if (input_file != NULL)
- goto success;
- free (pathname);
- }
- }
-
- if (base_dir)
- pathname = concat (base_dir, filename, NULL);
- else
- pathname = xstrdup (filename);
- input_file = fopen (pathname, "r");
- if (input_file == NULL)
- {
- free (pathname);
- message_with_line (lineno, "include file `%s' not found", filename);
- errors = 1;
- return;
- }
- success:
-
- /* Save old cursor; setup new for the new file. Note that "lineno" the
- argument to this function is the beginning of the include statement,
- while read_rtx_lineno has already been advanced. */
- old_filename = read_rtx_filename;
- old_lineno = read_rtx_lineno;
- read_rtx_filename = pathname;
- read_rtx_lineno = 1;
-
- if (include_callback)
- include_callback (pathname);
-
- /* Read the entire file. */
- while (read_rtx (input_file, &desc, &lineno))
- process_rtx (desc, lineno);
-
- /* Do not free pathname. It is attached to the various rtx queue
- elements. */
-
- read_rtx_filename = old_filename;
- read_rtx_lineno = old_lineno;
-
- fclose (input_file);
-}
-
/* Process a top level rtx in some way, queuing as appropriate. */
static void
@@ -273,15 +165,16 @@ process_rtx (rtx desc, int lineno)
switch (GET_CODE (desc))
{
case DEFINE_INSN:
- queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
+ queue_pattern (desc, &define_insn_tail, read_md_filename, lineno);
break;
case DEFINE_COND_EXEC:
- queue_pattern (desc, &define_cond_exec_tail, read_rtx_filename, lineno);
+ queue_pattern (desc, &define_cond_exec_tail, read_md_filename, lineno);
break;
case DEFINE_ATTR:
- queue_pattern (desc, &define_attr_tail, read_rtx_filename, lineno);
+ case DEFINE_ENUM_ATTR:
+ queue_pattern (desc, &define_attr_tail, read_md_filename, lineno);
break;
case DEFINE_PREDICATE:
@@ -290,11 +183,7 @@ process_rtx (rtx desc, int lineno)
case DEFINE_REGISTER_CONSTRAINT:
case DEFINE_MEMORY_CONSTRAINT:
case DEFINE_ADDRESS_CONSTRAINT:
- queue_pattern (desc, &define_pred_tail, read_rtx_filename, lineno);
- break;
-
- case INCLUDE:
- process_include (desc, lineno);
+ queue_pattern (desc, &define_pred_tail, read_md_filename, lineno);
break;
case DEFINE_INSN_AND_SPLIT:
@@ -322,7 +211,7 @@ process_rtx (rtx desc, int lineno)
split_cond = XSTR (desc, 4);
if (split_cond[0] == '&' && split_cond[1] == '&')
{
- copy_rtx_ptr_loc (split_cond + 2, split_cond);
+ copy_md_ptr_loc (split_cond + 2, split_cond);
split_cond = join_c_conditions (XSTR (desc, 2), split_cond + 2);
}
XSTR (split, 1) = split_cond;
@@ -336,16 +225,16 @@ process_rtx (rtx desc, int lineno)
/* Queue them. */
insn_elem
- = queue_pattern (desc, &define_insn_tail, read_rtx_filename,
+ = queue_pattern (desc, &define_insn_tail, read_md_filename,
lineno);
split_elem
- = queue_pattern (split, &other_tail, read_rtx_filename, lineno);
+ = queue_pattern (split, &other_tail, read_md_filename, lineno);
insn_elem->split = split_elem;
break;
}
default:
- queue_pattern (desc, &other_tail, read_rtx_filename, lineno);
+ queue_pattern (desc, &other_tail, read_md_filename, lineno);
break;
}
}
@@ -379,9 +268,8 @@ is_predicable (struct queue_elem *elem)
case SET_ATTR_ALTERNATIVE:
if (strcmp (XSTR (sub, 0), "predicable") == 0)
{
- message_with_line (elem->lineno,
- "multiple alternatives for `predicable'");
- errors = 1;
+ error_with_line (elem->lineno,
+ "multiple alternatives for `predicable'");
return 0;
}
break;
@@ -400,9 +288,8 @@ is_predicable (struct queue_elem *elem)
/* ??? It would be possible to handle this if we really tried.
It's not easy though, and I'm not going to bother until it
really proves necessary. */
- message_with_line (elem->lineno,
- "non-constant value for `predicable'");
- errors = 1;
+ error_with_line (elem->lineno,
+ "non-constant value for `predicable'");
return 0;
default:
@@ -419,9 +306,7 @@ is_predicable (struct queue_elem *elem)
to do this. Delay this until we've got the basics solid. */
if (strchr (value, ',') != NULL)
{
- message_with_line (elem->lineno,
- "multiple alternatives for `predicable'");
- errors = 1;
+ error_with_line (elem->lineno, "multiple alternatives for `predicable'");
return 0;
}
@@ -431,10 +316,8 @@ is_predicable (struct queue_elem *elem)
if (strcmp (value, predicable_false) == 0)
return 0;
- message_with_line (elem->lineno,
- "unknown value `%s' for `predicable' attribute",
- value);
- errors = 1;
+ error_with_line (elem->lineno,
+ "unknown value `%s' for `predicable' attribute", value);
return 0;
}
@@ -453,9 +336,8 @@ identify_predicable_attribute (void)
if (strcmp (XSTR (elem->data, 0), "predicable") == 0)
goto found;
- message_with_line (define_cond_exec_queue->lineno,
- "attribute `predicable' not defined");
- errors = 1;
+ error_with_line (define_cond_exec_queue->lineno,
+ "attribute `predicable' not defined");
return;
found:
@@ -464,9 +346,7 @@ identify_predicable_attribute (void)
p_true = strchr (p_false, ',');
if (p_true == NULL || strchr (++p_true, ',') != NULL)
{
- message_with_line (elem->lineno,
- "attribute `predicable' is not a boolean");
- errors = 1;
+ error_with_line (elem->lineno, "attribute `predicable' is not a boolean");
if (p_false)
free (p_false);
return;
@@ -483,17 +363,14 @@ identify_predicable_attribute (void)
break;
case CONST:
- message_with_line (elem->lineno,
- "attribute `predicable' cannot be const");
- errors = 1;
+ error_with_line (elem->lineno, "attribute `predicable' cannot be const");
if (p_false)
free (p_false);
return;
default:
- message_with_line (elem->lineno,
- "attribute `predicable' must have a constant default");
- errors = 1;
+ error_with_line (elem->lineno,
+ "attribute `predicable' must have a constant default");
if (p_false)
free (p_false);
return;
@@ -505,10 +382,8 @@ identify_predicable_attribute (void)
predicable_default = 0;
else
{
- message_with_line (elem->lineno,
- "unknown value `%s' for `predicable' attribute",
- value);
- errors = 1;
+ error_with_line (elem->lineno,
+ "unknown value `%s' for `predicable' attribute", value);
if (p_false)
free (p_false);
}
@@ -602,10 +477,8 @@ alter_predicate_for_insn (rtx pattern, int alt, int max_op, int lineno)
if (n_alternatives (c) != 1)
{
- message_with_line (lineno,
- "too many alternatives for operand %d",
- XINT (pattern, 0));
- errors = 1;
+ error_with_line (lineno, "too many alternatives for operand %d",
+ XINT (pattern, 0));
return NULL;
}
@@ -793,9 +666,7 @@ process_one_cond_exec (struct queue_elem *ce_elem)
if (XVECLEN (ce_elem->data, 0) != 1)
{
- message_with_line (ce_elem->lineno,
- "too many patterns in predicate");
- errors = 1;
+ error_with_line (ce_elem->lineno, "too many patterns in predicate");
return;
}
@@ -878,7 +749,7 @@ process_one_cond_exec (struct queue_elem *ce_elem)
XVECEXP (split, 2, i) = pattern;
}
/* Add the new split to the queue. */
- queue_pattern (split, &other_tail, read_rtx_filename,
+ queue_pattern (split, &other_tail, read_md_filename,
insn_elem->split->lineno);
}
}
@@ -892,186 +763,52 @@ process_define_cond_exec (void)
struct queue_elem *elem;
identify_predicable_attribute ();
- if (errors)
+ if (have_error)
return;
for (elem = define_cond_exec_queue; elem ; elem = elem->next)
process_one_cond_exec (elem);
}
+
+/* A read_md_files callback for reading an rtx. */
-static char *
-save_string (const char *s, int len)
+static void
+rtx_handle_directive (int lineno, const char *rtx_name)
{
- char *result = XNEWVEC (char, len + 1);
+ rtx queue, x;
- memcpy (result, s, len);
- result[len] = 0;
- return result;
+ if (read_rtx (rtx_name, &queue))
+ for (x = queue; x; x = XEXP (x, 1))
+ process_rtx (XEXP (x, 0), lineno);
}
-
/* The entry point for initializing the reader. */
-int
-init_md_reader_args_cb (int argc, char **argv, bool (*parse_opt)(const char *))
+bool
+init_rtx_reader_args_cb (int argc, char **argv,
+ bool (*parse_opt) (const char *))
{
- FILE *input_file;
- int c, i, lineno;
- char *lastsl;
- rtx desc;
- bool no_more_options;
- bool already_read_stdin;
-
- /* Unlock the stdio streams. */
- unlock_std_streams ();
-
- /* First we loop over all the options. */
- for (i = 1; i < argc; i++)
- {
- if (argv[i][0] != '-')
- continue;
-
- c = argv[i][1];
- switch (c)
- {
- case 'I': /* Add directory to path for includes. */
- {
- struct file_name_list *dirtmp;
-
- dirtmp = XNEW (struct file_name_list);
- dirtmp->next = 0; /* New one goes on the end */
- if (first_dir_md_include == 0)
- first_dir_md_include = dirtmp;
- else
- last_dir_md_include->next = dirtmp;
- last_dir_md_include = dirtmp; /* Tail follows the last one */
- if (argv[i][1] == 'I' && argv[i][2] != 0)
- dirtmp->fname = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("directory name missing after -I option");
- else
- dirtmp->fname = argv[++i];
- if (strlen (dirtmp->fname) > max_include_len)
- max_include_len = strlen (dirtmp->fname);
- }
- break;
-
- case '\0':
- /* An argument consisting of exactly one dash is a request to
- read stdin. This will be handled in the second loop. */
- continue;
-
- case '-':
- /* An argument consisting of just two dashes causes option
- parsing to cease. */
- if (argv[i][2] == '\0')
- goto stop_parsing_options;
-
- default:
- /* The program may have provided a callback so it can
- accept its own options. */
- if (parse_opt && parse_opt (argv[i]))
- break;
-
- fatal ("invalid option `%s'", argv[i]);
- }
- }
-
- stop_parsing_options:
-
/* Prepare to read input. */
condition_table = htab_create (500, hash_c_test, cmp_c_test, NULL);
init_predicate_table ();
obstack_init (rtl_obstack);
- errors = 0;
sequence_num = 0;
- no_more_options = false;
- already_read_stdin = false;
-
-
- /* Now loop over all input files. */
- for (i = 1; i < argc; i++)
- {
- if (argv[i][0] == '-')
- {
- if (argv[i][1] == '\0')
- {
- /* Read stdin. */
- if (already_read_stdin)
- fatal ("cannot read standard input twice");
-
- base_dir = NULL;
- read_rtx_filename = in_fname = "<stdin>";
- read_rtx_lineno = 1;
- input_file = stdin;
- already_read_stdin = true;
-
- while (read_rtx (input_file, &desc, &lineno))
- process_rtx (desc, lineno);
- fclose (input_file);
- continue;
- }
- else if (argv[i][1] == '-' && argv[i][2] == '\0')
- {
- /* No further arguments are to be treated as options. */
- no_more_options = true;
- continue;
- }
- else if (!no_more_options)
- continue;
- }
-
- /* If we get here we are looking at a non-option argument, i.e.
- a file to be processed. */
-
- in_fname = argv[i];
- lastsl = strrchr (in_fname, '/');
- if (lastsl != NULL)
- base_dir = save_string (in_fname, lastsl - in_fname + 1 );
- else
- base_dir = NULL;
-
- read_rtx_filename = in_fname;
- read_rtx_lineno = 1;
- input_file = fopen (in_fname, "r");
- if (input_file == 0)
- {
- perror (in_fname);
- return FATAL_EXIT_CODE;
- }
- while (read_rtx (input_file, &desc, &lineno))
- process_rtx (desc, lineno);
- fclose (input_file);
- }
-
- /* If we get to this point without having seen any files to process,
- read standard input now. */
- if (!in_fname)
- {
- base_dir = NULL;
- read_rtx_filename = in_fname = "<stdin>";
- read_rtx_lineno = 1;
- input_file = stdin;
-
- while (read_rtx (input_file, &desc, &lineno))
- process_rtx (desc, lineno);
- fclose (input_file);
- }
+ read_md_files (argc, argv, parse_opt, rtx_handle_directive);
/* Process define_cond_exec patterns. */
if (define_cond_exec_queue != NULL)
process_define_cond_exec ();
- return errors ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;
+ return !have_error;
}
/* Programs that don't have their own options can use this entry point
instead. */
-int
-init_md_reader_args (int argc, char **argv)
+bool
+init_rtx_reader_args (int argc, char **argv)
{
- return init_md_reader_args_cb (argc, argv, 0);
+ return init_rtx_reader_args_cb (argc, argv, 0);
}
/* The entry point for reading a single rtx from an md file. */
@@ -1099,7 +836,7 @@ read_md_rtx (int *lineno, int *seqnr)
elem = *queue;
*queue = elem->next;
desc = elem->data;
- read_rtx_filename = elem->filename;
+ read_md_filename = elem->filename;
*lineno = elem->lineno;
*seqnr = sequence_num;
@@ -1227,53 +964,6 @@ traverse_c_tests (htab_trav callback, void *info)
htab_traverse (condition_table, callback, info);
}
-
-/* Given a string, return the number of comma-separated elements in it.
- Return 0 for the null string. */
-int
-n_comma_elts (const char *s)
-{
- int n;
-
- if (*s == '\0')
- return 0;
-
- for (n = 1; *s; s++)
- if (*s == ',')
- n++;
-
- return n;
-}
-
-/* Given a pointer to a (char *), return a pointer to the beginning of the
- next comma-separated element in the string. Advance the pointer given
- to the end of that element. Return NULL if at end of string. Caller
- is responsible for copying the string if necessary. White space between
- a comma and an element is ignored. */
-
-const char *
-scan_comma_elt (const char **pstr)
-{
- const char *start;
- const char *p = *pstr;
-
- if (*p == ',')
- p++;
- while (ISSPACE(*p))
- p++;
-
- if (*p == '\0')
- return NULL;
-
- start = p;
-
- while (*p != ',' && *p != '\0')
- p++;
-
- *pstr = p;
- return start;
-}
-
/* Helper functions for define_predicate and define_special_predicate
processing. Shared between genrecog.c and genpreds.c. */
diff --git a/gcc/gensupport.h b/gcc/gensupport.h
index 140f669b18f..f2fcce56ea3 100644
--- a/gcc/gensupport.h
+++ b/gcc/gensupport.h
@@ -23,15 +23,11 @@ along with GCC; see the file COPYING3. If not see
struct obstack;
extern struct obstack *rtl_obstack;
-extern const char *in_fname;
-extern int init_md_reader_args_cb (int, char **, bool (*)(const char *));
-extern int init_md_reader_args (int, char **);
+extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
+extern bool init_rtx_reader_args (int, char **);
extern rtx read_md_rtx (int *, int *);
-extern void message_with_line (int, const char *, ...)
- ATTRIBUTE_PRINTF_2;
-
/* Set this to 0 to disable automatic elision of insn patterns which
can never be used in this configuration. See genconditions.c.
Must be set before calling init_md_reader. */
@@ -60,9 +56,6 @@ extern int cmp_c_test (const void *, const void *);
extern void traverse_c_tests (htab_trav, void *);
#endif
-extern int n_comma_elts (const char *);
-extern const char *scan_comma_elt (const char **);
-
/* Predicate handling: helper functions and data structures. */
struct pred_data
@@ -90,8 +83,4 @@ extern void add_predicate (struct pred_data *);
#define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
-/* This callback will be invoked whenever an rtl include directive is
- processed. To be used for creation of the dependency file. */
-extern void (*include_callback) (const char *);
-
#endif /* GCC_GENSUPPORT_H */
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 76bf975c86f..175629b3129 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "hashtab.h"
#include "ggc.h"
+#include "ggc-internal.h"
#include "toplev.h"
#include "params.h"
#include "hosthooks.h"
@@ -193,9 +194,9 @@ ggc_mark_roots (void)
/* Allocate a block of memory, then clear it. */
void *
-ggc_alloc_cleared_stat (size_t size MEM_STAT_DECL)
+ggc_internal_cleared_alloc_stat (size_t size MEM_STAT_DECL)
{
- void *buf = ggc_alloc_stat (size PASS_MEM_STAT);
+ void *buf = ggc_internal_alloc_stat (size PASS_MEM_STAT);
memset (buf, 0, size);
return buf;
}
@@ -208,7 +209,7 @@ ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
size_t old_size;
if (x == NULL)
- return ggc_alloc_stat (size PASS_MEM_STAT);
+ return ggc_internal_alloc_stat (size PASS_MEM_STAT);
old_size = ggc_get_size (x);
@@ -230,7 +231,7 @@ ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
return x;
}
- r = ggc_alloc_stat (size PASS_MEM_STAT);
+ r = ggc_internal_alloc_stat (size PASS_MEM_STAT);
/* Since ggc_get_size returns the size of the pool, not the size of the
individually allocated object, we'd access parts of the old object
@@ -246,19 +247,30 @@ ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
return r;
}
-/* Like ggc_alloc_cleared, but performs a multiplication. */
void *
-ggc_calloc (size_t s1, size_t s2)
+ggc_cleared_alloc_htab_ignore_args (size_t c ATTRIBUTE_UNUSED,
+ size_t n ATTRIBUTE_UNUSED)
{
- return ggc_alloc_cleared (s1 * s2);
+ gcc_assert (c * n == sizeof (struct htab));
+ return ggc_alloc_cleared_htab ();
+}
+
+/* TODO: once we actually use type information in GGC, create a new tag
+ gt_gcc_ptr_array and use it for pointer arrays. */
+void *
+ggc_cleared_alloc_ptr_array_two_args (size_t c, size_t n)
+{
+ gcc_assert (sizeof (PTR *) == n);
+ return ggc_internal_cleared_vec_alloc (sizeof (PTR *), c);
}
/* These are for splay_tree_new_ggc. */
void *
-ggc_splay_alloc (int sz, void *nl)
+ggc_splay_alloc (enum gt_types_enum obj_type ATTRIBUTE_UNUSED, int sz,
+ void *nl)
{
gcc_assert (!nl);
- return ggc_alloc (sz);
+ return ggc_internal_alloc (sz);
}
void
@@ -516,7 +528,7 @@ gt_pch_save (FILE *f)
/* Prepare the objects for writing, determine addresses and such. */
state.f = f;
- state.d = init_ggc_pch();
+ state.d = init_ggc_pch ();
state.count = 0;
htab_traverse (saving_htab, call_count, &state);
@@ -825,7 +837,7 @@ ggc_min_heapsize_heuristic (void)
the limit, whichever is larger. If GCC does hit the data limit,
compilation will fail, so this tries to be conservative. */
limit_kbytes = MAX (0, limit_kbytes - MAX (limit_kbytes / 4, 20 * 1024));
- limit_kbytes = (limit_kbytes * 100) / (110 + ggc_min_expand_heuristic());
+ limit_kbytes = (limit_kbytes * 100) / (110 + ggc_min_expand_heuristic ());
phys_kbytes = MIN (phys_kbytes, limit_kbytes);
phys_kbytes = MAX (phys_kbytes, 4 * 1024);
@@ -839,8 +851,8 @@ void
init_ggc_heuristics (void)
{
#if !defined ENABLE_GC_CHECKING && !defined ENABLE_GC_ALWAYS_COLLECT
- set_param_value ("ggc-min-expand", ggc_min_expand_heuristic());
- set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic());
+ set_param_value ("ggc-min-expand", ggc_min_expand_heuristic ());
+ set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic ());
#endif
}
diff --git a/gcc/ggc-internal.h b/gcc/ggc-internal.h
new file mode 100644
index 00000000000..7b875eec9cb
--- /dev/null
+++ b/gcc/ggc-internal.h
@@ -0,0 +1,121 @@
+/* Garbage collection for the GNU compiler. Internal definitions
+ for ggc-*.c and stringpool.c.
+
+ Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_GGC_INTERNAL_H
+#define GCC_GGC_INTERNAL_H
+
+#include "ggc.h"
+
+/* Call ggc_set_mark on all the roots. */
+extern void ggc_mark_roots (void);
+
+/* Stringpool. */
+
+/* Mark the entries in the string pool. */
+extern void ggc_mark_stringpool (void);
+
+/* Purge the entries in the string pool. */
+extern void ggc_purge_stringpool (void);
+
+/* Save and restore the string pool entries for PCH. */
+
+extern void gt_pch_save_stringpool (void);
+extern void gt_pch_fixup_stringpool (void);
+extern void gt_pch_restore_stringpool (void);
+
+/* PCH and GGC handling for strings, mostly trivial. */
+extern void gt_pch_p_S (void *, void *, gt_pointer_operator, void *);
+
+/* PCH. */
+
+struct ggc_pch_data;
+
+/* Return a new ggc_pch_data structure. */
+extern struct ggc_pch_data *init_ggc_pch (void);
+
+/* The second parameter and third parameters give the address and size
+ of an object. Update the ggc_pch_data structure with as much of
+ that information as is necessary. The bool argument should be true
+ if the object is a string. */
+extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool,
+ enum gt_types_enum);
+
+/* Return the total size of the data to be written to hold all
+ the objects previously passed to ggc_pch_count_object. */
+extern size_t ggc_pch_total_size (struct ggc_pch_data *);
+
+/* The objects, when read, will most likely be at the address
+ in the second parameter. */
+extern void ggc_pch_this_base (struct ggc_pch_data *, void *);
+
+/* Assuming that the objects really do end up at the address
+ passed to ggc_pch_this_base, return the address of this object.
+ The bool argument should be true if the object is a string. */
+extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool,
+ enum gt_types_enum);
+
+/* Write out any initial information required. */
+extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *);
+
+/* Write out this object, including any padding. The last argument should be
+ true if the object is a string. */
+extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *,
+ void *, size_t, bool);
+
+/* All objects have been written, write out any final information
+ required. */
+extern void ggc_pch_finish (struct ggc_pch_data *, FILE *);
+
+/* A PCH file has just been read in at the address specified second
+ parameter. Set up the GC implementation for the new objects. */
+extern void ggc_pch_read (FILE *, void *);
+
+
+/* Allocation and collection. */
+
+/* When set, ggc_collect will do collection. */
+extern bool ggc_force_collect;
+
+extern void ggc_record_overhead (size_t, size_t, void * MEM_STAT_DECL);
+
+extern void ggc_free_overhead (void *);
+
+extern void ggc_prune_overhead_list (void);
+
+/* Return the number of bytes allocated at the indicated address. */
+extern size_t ggc_get_size (const void *);
+
+
+/* Statistics. */
+
+/* This structure contains the statistics common to all collectors.
+ Particular collectors can extend this structure. */
+typedef struct ggc_statistics
+{
+ /* At present, we don't really gather any interesting statistics. */
+ int unused;
+} ggc_statistics;
+
+/* Used by the various collectors to gather and print statistics that
+ do not depend on the collector in use. */
+extern void ggc_print_common_statistics (FILE *, ggc_statistics *);
+
+#endif
diff --git a/gcc/ggc-none.c b/gcc/ggc-none.c
index 2d45a61ca5f..f9c48cb8cc5 100644
--- a/gcc/ggc-none.c
+++ b/gcc/ggc-none.c
@@ -1,5 +1,5 @@
/* Null garbage collection for the GNU compiler.
- Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005, 2007
+ Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005, 2007, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -40,13 +40,13 @@ ggc_alloc_typed_stat (enum gt_types_enum ARG_UNUSED (gte), size_t size
}
void *
-ggc_alloc_stat (size_t size MEM_STAT_DECL)
+ggc_internal_alloc_stat (size_t size MEM_STAT_DECL)
{
return xmalloc (size);
}
void *
-ggc_alloc_cleared_stat (size_t size MEM_STAT_DECL)
+ggc_internal_cleared_alloc_stat (size_t size MEM_STAT_DECL)
{
return xcalloc (size, 1);
}
@@ -62,3 +62,12 @@ ggc_free (void *p)
{
free (p);
}
+
+struct alloc_zone
+{
+ int dummy;
+};
+
+struct alloc_zone rtl_zone;
+struct alloc_zone tree_zone;
+struct alloc_zone tree_id_zone;
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 67483f19349..27862be8ef4 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -1,6 +1,6 @@
/* "Bag-of-pages" garbage collector for the GNU compiler.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "flags.h"
#include "ggc.h"
+#include "ggc-internal.h"
#include "timevar.h"
#include "params.h"
#include "tree-flow.h"
@@ -437,9 +438,9 @@ static struct globals
#ifdef GATHER_STATISTICS
struct
{
- /* Total memory allocated with ggc_alloc. */
+ /* Total GC-allocated memory. */
unsigned long long total_allocated;
- /* Total overhead for memory to be allocated with ggc_alloc. */
+ /* Total overhead for GC-allocated memory. */
unsigned long long total_overhead;
/* Total allocations and overhead for sizes less than 32, 64 and 128.
@@ -689,7 +690,7 @@ alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size)
G.bytes_mapped += size;
/* Pretend we don't have access to the allocated pages. We'll enable
- access to smaller pieces of the area in ggc_alloc. Discard the
+ access to smaller pieces of the area in ggc_internal_alloc. Discard the
handle to avoid handle leak. */
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (page, size));
@@ -1074,13 +1075,13 @@ void *
ggc_alloc_typed_stat (enum gt_types_enum type ATTRIBUTE_UNUSED, size_t size
MEM_STAT_DECL)
{
- return ggc_alloc_stat (size PASS_MEM_STAT);
+ return ggc_internal_alloc_stat (size PASS_MEM_STAT);
}
/* Allocate a chunk of memory of SIZE bytes. Its contents are undefined. */
void *
-ggc_alloc_stat (size_t size MEM_STAT_DECL)
+ggc_internal_alloc_stat (size_t size MEM_STAT_DECL)
{
size_t order, word, bit, object_offset, object_size;
struct page_entry *entry;
@@ -1605,20 +1606,6 @@ init_ggc (void)
G.save_in_use = XNEWVEC (unsigned long *, G.by_depth_max);
}
-/* Start a new GGC zone. */
-
-struct alloc_zone *
-new_ggc_zone (const char *name ATTRIBUTE_UNUSED)
-{
- return NULL;
-}
-
-/* Destroy a GGC zone. */
-void
-destroy_ggc_zone (struct alloc_zone *zone ATTRIBUTE_UNUSED)
-{
-}
-
/* Merge the SAVE_IN_USE_P and IN_USE_P arrays in P so that IN_USE_P
reflects reality. Recalculate NUM_FREE_OBJECTS as well. */
@@ -2383,3 +2370,12 @@ ggc_pch_read (FILE *f, void *addr)
/* Update the statistics. */
G.allocated = G.allocated_last_gc = offs - (char *)addr;
}
+
+struct alloc_zone
+{
+ int dummy;
+};
+
+struct alloc_zone rtl_zone;
+struct alloc_zone tree_zone;
+struct alloc_zone tree_id_zone;
diff --git a/gcc/ggc-zone.c b/gcc/ggc-zone.c
index a8154cc4de0..12dc8740529 100644
--- a/gcc/ggc-zone.c
+++ b/gcc/ggc-zone.c
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "flags.h"
#include "ggc.h"
+#include "ggc-internal.h"
#include "timevar.h"
#include "params.h"
#include "bitmap.h"
@@ -417,9 +418,9 @@ struct alloc_zone
#ifdef GATHER_STATISTICS
struct
{
- /* Total memory allocated with ggc_alloc. */
+ /* Total GC-allocated memory. */
unsigned long long total_allocated;
- /* Total overhead for memory to be allocated with ggc_alloc. */
+ /* Total overhead for GC-allocated memory. */
unsigned long long total_overhead;
/* Total allocations and overhead for sizes less than 32, 64 and 128.
@@ -860,7 +861,7 @@ alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size, struct alloc_zone *zone)
zone->bytes_mapped += size;
/* Pretend we don't have access to the allocated pages. We'll enable
- access to smaller pieces of the area in ggc_alloc. Discard the
+ access to smaller pieces of the area in ggc_internal_alloc. Discard the
handle to avoid handle leak. */
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (page, size));
@@ -1089,8 +1090,8 @@ free_chunk (char *ptr, size_t size, struct alloc_zone *zone)
/* Allocate a chunk of memory of at least ORIG_SIZE bytes, in ZONE. */
void *
-ggc_alloc_zone_stat (size_t orig_size, struct alloc_zone *zone
- MEM_STAT_DECL)
+ggc_internal_alloc_zone_stat (size_t orig_size, struct alloc_zone *zone
+ MEM_STAT_DECL)
{
size_t bin;
size_t csize;
@@ -1352,6 +1353,19 @@ ggc_alloc_zone_stat (size_t orig_size, struct alloc_zone *zone
return result;
}
+#define ggc_internal_alloc_zone_pass_stat(s,z) \
+ ggc_internal_alloc_zone_stat (s,z PASS_MEM_STAT)
+
+void *
+ggc_internal_cleared_alloc_zone_stat (size_t orig_size,
+ struct alloc_zone *zone MEM_STAT_DECL)
+{
+ void * result = ggc_internal_alloc_zone_pass_stat (orig_size, zone);
+ memset (result, 0, orig_size);
+ return result;
+}
+
+
/* Allocate a SIZE of chunk memory of GTE type, into an appropriate zone
for that type. */
@@ -1362,25 +1376,25 @@ ggc_alloc_typed_stat (enum gt_types_enum gte, size_t size
switch (gte)
{
case gt_ggc_e_14lang_tree_node:
- return ggc_alloc_zone_pass_stat (size, &tree_zone);
+ return ggc_internal_alloc_zone_pass_stat (size, &tree_zone);
case gt_ggc_e_7rtx_def:
- return ggc_alloc_zone_pass_stat (size, &rtl_zone);
+ return ggc_internal_alloc_zone_pass_stat (size, &rtl_zone);
case gt_ggc_e_9rtvec_def:
- return ggc_alloc_zone_pass_stat (size, &rtl_zone);
+ return ggc_internal_alloc_zone_pass_stat (size, &rtl_zone);
default:
- return ggc_alloc_zone_pass_stat (size, &main_zone);
+ return ggc_internal_alloc_zone_pass_stat (size, &main_zone);
}
}
-/* Normal ggc_alloc simply allocates into the main zone. */
+/* Normal GC allocation simply allocates into the main zone. */
void *
-ggc_alloc_stat (size_t size MEM_STAT_DECL)
+ggc_internal_alloc_stat (size_t size MEM_STAT_DECL)
{
- return ggc_alloc_zone_pass_stat (size, &main_zone);
+ return ggc_internal_alloc_zone_pass_stat (size, &main_zone);
}
/* Poison the chunk. */
@@ -1715,31 +1729,6 @@ new_ggc_zone_1 (struct alloc_zone *new_zone, const char * name)
G.zones->next_zone = new_zone;
}
-struct alloc_zone *
-new_ggc_zone (const char * name)
-{
- struct alloc_zone *new_zone = XCNEW (struct alloc_zone);
- new_ggc_zone_1 (new_zone, name);
- return new_zone;
-}
-
-/* Destroy a GGC zone. */
-void
-destroy_ggc_zone (struct alloc_zone * dead_zone)
-{
- struct alloc_zone *z;
-
- for (z = G.zones; z && z->next_zone != dead_zone; z = z->next_zone)
- /* Just find that zone. */
- continue;
-
- /* We should have found the zone in the list. Anything else is fatal. */
- gcc_assert (z);
-
- /* z is dead, baby. z is dead. */
- z->dead = true;
-}
-
/* Free all empty pages and objects within a page for a given zone */
static void
@@ -2488,6 +2477,12 @@ ggc_pch_read (FILE *f, void *addr)
/* We've just read in a PCH file. So, every object that used to be
allocated is now free. */
+#ifdef 0 && GATHER_STATISTICS
+ zone_allocate_marks ();
+ ggc_prune_overhead_list ();
+ zone_free_marks ();
+#endif
+
for (zone = G.zones; zone; zone = zone->next_zone)
{
struct small_page_entry *page, *next_page;
diff --git a/gcc/ggc.h b/gcc/ggc.h
index 33b78f1b03d..7f2144c0f12 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -1,7 +1,7 @@
/* Garbage collection for the GNU compiler.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007,
- 2008, 2009 Free Software Foundation, Inc.
+ 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -28,11 +28,9 @@ along with GCC; see the file COPYING3. If not see
/* Constants for general use. */
extern const char empty_string[]; /* empty string */
-extern const char digit_vector[]; /* "0" .. "9" */
-#define digit_string(d) (digit_vector + ((d) * 2))
/* Internal functions and data structures used by the GTY
- machinery. */
+ machinery, including the generated gt*.[hc] files. */
/* The first parameter is a pointer to a pointer, the second a cookie. */
typedef void (*gt_pointer_operator) (void *, void *);
@@ -118,112 +116,48 @@ extern int ggc_set_mark (const void *);
static objects, stack variables, or memory allocated with malloc. */
extern int ggc_marked_p (const void *);
-/* Mark the entries in the string pool. */
-extern void ggc_mark_stringpool (void);
-
-/* Purge the entries in the string pool. */
-extern void ggc_purge_stringpool (void);
-
-/* Call ggc_set_mark on all the roots. */
-
-extern void ggc_mark_roots (void);
-
-/* Save and restore the string pool entries for PCH. */
-
-extern void gt_pch_save_stringpool (void);
-extern void gt_pch_fixup_stringpool (void);
-extern void gt_pch_restore_stringpool (void);
-
/* PCH and GGC handling for strings, mostly trivial. */
-
-extern void gt_pch_p_S (void *, void *, gt_pointer_operator, void *);
extern void gt_pch_n_S (const void *);
extern void gt_ggc_m_S (const void *);
-/* Initialize the string pool. */
-extern void init_stringpool (void);
+/* End of GTY machinery API. */
-/* A GC implementation must provide these functions. They are internal
- to the GC system. */
-
-/* Forward declare the zone structure. Only ggc_zone implements this. */
struct alloc_zone;
+/* Initialize the string pool. */
+extern void init_stringpool (void);
+
/* Initialize the garbage collector. */
extern void init_ggc (void);
-/* Start a new GGC zone. */
-extern struct alloc_zone *new_ggc_zone (const char *);
-
-/* Free a complete GGC zone, destroying everything in it. */
-extern void destroy_ggc_zone (struct alloc_zone *);
-
-struct ggc_pch_data;
-
-/* Return a new ggc_pch_data structure. */
-extern struct ggc_pch_data *init_ggc_pch (void);
-
-/* The second parameter and third parameters give the address and size
- of an object. Update the ggc_pch_data structure with as much of
- that information as is necessary. The bool argument should be true
- if the object is a string. */
-extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool,
- enum gt_types_enum);
-
-/* Return the total size of the data to be written to hold all
- the objects previously passed to ggc_pch_count_object. */
-extern size_t ggc_pch_total_size (struct ggc_pch_data *);
-
-/* The objects, when read, will most likely be at the address
- in the second parameter. */
-extern void ggc_pch_this_base (struct ggc_pch_data *, void *);
-
-/* Assuming that the objects really do end up at the address
- passed to ggc_pch_this_base, return the address of this object.
- The bool argument should be true if the object is a string. */
-extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool,
- enum gt_types_enum);
-
-/* Write out any initial information required. */
-extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *);
-/* Write out this object, including any padding. The last argument should be
- true if the object is a string. */
-extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *,
- void *, size_t, bool);
-/* All objects have been written, write out any final information
- required. */
-extern void ggc_pch_finish (struct ggc_pch_data *, FILE *);
-
-/* A PCH file has just been read in at the address specified second
- parameter. Set up the GC implementation for the new objects. */
-extern void ggc_pch_read (FILE *, void *);
-
-
-/* Allocation. */
-
-/* When set, ggc_collect will do collection. */
-extern bool ggc_force_collect;
-
/* When true, identifier nodes are considered as GC roots. When
false, identifier nodes are treated like any other GC-allocated
object, and the identifier hash table is treated as a weak
hash. */
extern bool ggc_protect_identifiers;
+/* Write out all GCed objects to F. */
+extern void gt_pch_save (FILE *f);
+
+
+/* Allocation. */
+
/* The internal primitive. */
-extern void *ggc_alloc_stat (size_t MEM_STAT_DECL);
-#define ggc_alloc(s) ggc_alloc_stat (s MEM_STAT_INFO)
+extern void *ggc_internal_alloc_stat (size_t MEM_STAT_DECL);
+
+#define ggc_internal_alloc(s) ggc_internal_alloc_stat (s MEM_STAT_INFO)
+
/* Allocate an object of the specified type and size. */
extern void *ggc_alloc_typed_stat (enum gt_types_enum, size_t MEM_STAT_DECL);
-#define ggc_alloc_typed(s,z) ggc_alloc_typed_stat (s,z MEM_STAT_INFO)
-/* Like ggc_alloc, but allocates cleared memory. */
-extern void *ggc_alloc_cleared_stat (size_t MEM_STAT_DECL);
-#define ggc_alloc_cleared(s) ggc_alloc_cleared_stat (s MEM_STAT_INFO)
+
+#define ggc_alloc_typed(s, z) ggc_alloc_typed_stat (s, z MEM_STAT_INFO)
+
+/* Allocates cleared memory. */
+extern void *ggc_internal_cleared_alloc_stat (size_t MEM_STAT_DECL);
+
/* Resize a block. */
extern void *ggc_realloc_stat (void *, size_t MEM_STAT_DECL);
-#define ggc_realloc(s,z) ggc_realloc_stat (s,z MEM_STAT_INFO)
-/* Like ggc_alloc_cleared, but performs a multiplication. */
-extern void *ggc_calloc (size_t, size_t);
+
/* Free a block. To be used when known for certain it's not reachable. */
extern void ggc_free (void *);
@@ -233,39 +167,67 @@ extern void ggc_prune_overhead_list (void);
extern void dump_ggc_loc_statistics (bool);
-/* Type-safe, C++-friendly versions of ggc_alloc() and gcc_calloc(). */
-#define GGC_NEW(T) ((T *) ggc_alloc (sizeof (T)))
-#define GGC_CNEW(T) ((T *) ggc_alloc_cleared (sizeof (T)))
-#define GGC_NEWVEC(T, N) ((T *) ggc_alloc ((N) * sizeof(T)))
-#define GGC_CNEWVEC(T, N) ((T *) ggc_alloc_cleared ((N) * sizeof(T)))
-#define GGC_RESIZEVEC(T, P, N) ((T *) ggc_realloc ((P), (N) * sizeof (T)))
-#define GGC_NEWVAR(T, S) ((T *) ggc_alloc ((S)))
-#define GGC_CNEWVAR(T, S) ((T *) ggc_alloc_cleared ((S)))
-#define GGC_RESIZEVAR(T, P, N) ((T *) ggc_realloc ((P), (N)))
+/* Reallocators. */
+#define GGC_RESIZEVEC(T, P, N) \
+ ((T *) ggc_realloc_stat ((P), (N) * sizeof (T) MEM_STAT_INFO))
+
+#define GGC_RESIZEVAR(T, P, N) \
+ ((T *) ggc_realloc_stat ((P), (N) MEM_STAT_INFO))
+
+static inline void *
+ggc_internal_vec_alloc_stat (size_t s, size_t c MEM_STAT_DECL)
+{
+ return ggc_internal_alloc_stat (c * s PASS_MEM_STAT);
+}
+
+static inline void *
+ggc_internal_cleared_vec_alloc_stat (size_t s, size_t c MEM_STAT_DECL)
+{
+ return ggc_internal_cleared_alloc_stat (c * s PASS_MEM_STAT);
+}
+
+#define ggc_internal_cleared_vec_alloc(s, c) \
+ (ggc_internal_cleared_vec_alloc_stat ((s), (c) MEM_STAT_INFO))
+
+static inline void *
+ggc_alloc_atomic_stat (size_t s MEM_STAT_DECL)
+{
+ return ggc_internal_alloc_stat (s PASS_MEM_STAT);
+}
+
+#define ggc_alloc_atomic(S) (ggc_alloc_atomic_stat ((S) MEM_STAT_INFO))
+
+#define ggc_alloc_cleared_atomic(S) \
+ (ggc_internal_cleared_alloc_stat ((S) MEM_STAT_INFO))
-#define ggc_alloc_rtvec(NELT) \
- ((rtvec) ggc_alloc_zone (sizeof (struct rtvec_def) + ((NELT) - 1) \
- * sizeof (rtx), &rtl_zone))
+extern void * ggc_cleared_alloc_htab_ignore_args (size_t, size_t);
-#define ggc_alloc_tree(LENGTH) ((tree) ggc_alloc_zone (LENGTH, &tree_zone))
+extern void * ggc_cleared_alloc_ptr_array_two_args (size_t, size_t);
#define htab_create_ggc(SIZE, HASH, EQ, DEL) \
- htab_create_alloc (SIZE, HASH, EQ, DEL, ggc_calloc, ggc_free)
+ htab_create_typed_alloc (SIZE, HASH, EQ, DEL, \
+ ggc_cleared_alloc_htab_ignore_args, \
+ ggc_cleared_alloc_ptr_array_two_args, \
+ ggc_free)
+
+#define splay_tree_new_ggc(COMPARE, ALLOC_TREE, ALLOC_NODE) \
+ splay_tree_new_typed_alloc (COMPARE, NULL, NULL, &ALLOC_TREE, &ALLOC_NODE, \
+ &ggc_splay_dont_free, NULL)
+
+extern void *ggc_splay_alloc (enum gt_types_enum, int, void *);
-#define splay_tree_new_ggc(COMPARE) \
- splay_tree_new_with_allocator (COMPARE, NULL, NULL, \
- &ggc_splay_alloc, &ggc_splay_dont_free, \
- NULL)
-extern void *ggc_splay_alloc (int, void *);
extern void ggc_splay_dont_free (void *, void *);
/* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS.
If LENGTH is -1, then CONTENTS is assumed to be a
null-terminated string and the memory sized accordingly. */
-extern const char *ggc_alloc_string (const char *contents, int length);
+extern const char *ggc_alloc_string_stat (const char *contents, int length
+ MEM_STAT_DECL);
+
+#define ggc_alloc_string(c, l) ggc_alloc_string_stat (c, l MEM_STAT_INFO)
/* Make a copy of S, in GC-able memory. */
-#define ggc_strdup(S) ggc_alloc_string((S), -1)
+#define ggc_strdup(S) ggc_alloc_string_stat ((S), -1 MEM_STAT_INFO)
/* Invoke the collector. Garbage collection occurs only when this
function is called, not during allocations. */
@@ -279,55 +241,117 @@ extern void ggc_register_root_tab (const struct ggc_root_tab *);
plugins. Does nothing if the passed pointer is NULL. */
extern void ggc_register_cache_tab (const struct ggc_cache_tab *);
-/* Return the number of bytes allocated at the indicated address. */
-extern size_t ggc_get_size (const void *);
-
-/* Write out all GCed objects to F. */
-extern void gt_pch_save (FILE *f);
-
/* Read objects previously saved with gt_pch_save from F. */
extern void gt_pch_restore (FILE *f);
/* Statistics. */
-/* This structure contains the statistics common to all collectors.
- Particular collectors can extend this structure. */
-typedef struct ggc_statistics
-{
- /* At present, we don't really gather any interesting statistics. */
- int unused;
-} ggc_statistics;
-
-/* Used by the various collectors to gather and print statistics that
- do not depend on the collector in use. */
-extern void ggc_print_common_statistics (FILE *, ggc_statistics *);
-
/* Print allocation statistics. */
extern void ggc_print_statistics (void);
+
extern void stringpool_statistics (void);
/* Heuristics. */
extern void init_ggc_heuristics (void);
/* Zone collection. */
-#if defined (GGC_ZONE) && !defined (GENERATOR_FILE)
/* For regular rtl allocations. */
extern struct alloc_zone rtl_zone;
+
/* For regular tree allocations. */
extern struct alloc_zone tree_zone;
+
/* For IDENTIFIER_NODE allocations. */
extern struct alloc_zone tree_id_zone;
+#define ggc_alloc_rtvec_sized(NELT) \
+ (ggc_alloc_zone_vec_rtvec_def (sizeof (rtx), \
+ sizeof (struct rtvec_def) + ((NELT) - 1), \
+ &rtl_zone))
+
+#if defined (GGC_ZONE) && !defined (GENERATOR_FILE)
+
/* Allocate an object into the specified allocation zone. */
-extern void *ggc_alloc_zone_stat (size_t, struct alloc_zone * MEM_STAT_DECL);
-# define ggc_alloc_zone(s,z) ggc_alloc_zone_stat (s,z MEM_STAT_INFO)
-# define ggc_alloc_zone_pass_stat(s,z) ggc_alloc_zone_stat (s,z PASS_MEM_STAT)
+extern void *ggc_internal_alloc_zone_stat (size_t,
+ struct alloc_zone * MEM_STAT_DECL);
+
+extern void *ggc_internal_cleared_alloc_zone_stat (size_t,
+ struct alloc_zone * MEM_STAT_DECL);
+
+static inline void *
+ggc_internal_zone_alloc_stat (struct alloc_zone * z, size_t s MEM_STAT_DECL)
+{
+ return ggc_internal_alloc_zone_stat (s, z PASS_MEM_STAT);
+}
+
+static inline void *
+ggc_internal_zone_cleared_alloc_stat (struct alloc_zone * z, size_t s
+ MEM_STAT_DECL)
+{
+ return ggc_internal_cleared_alloc_zone_stat (s, z PASS_MEM_STAT);
+}
+
+static inline void *
+ggc_internal_zone_vec_alloc_stat (struct alloc_zone * z, size_t s, size_t n
+ MEM_STAT_DECL)
+{
+ return ggc_internal_alloc_zone_stat (s * n, z PASS_MEM_STAT);
+}
+
+
#else
-# define ggc_alloc_zone(s, z) ggc_alloc (s)
-# define ggc_alloc_zone_pass_stat(s, z) ggc_alloc_stat (s PASS_MEM_STAT)
+static inline void *
+ggc_internal_zone_alloc_stat (struct alloc_zone * z ATTRIBUTE_UNUSED,
+ size_t s MEM_STAT_DECL)
+{
+ return ggc_internal_alloc_stat (s PASS_MEM_STAT);
+}
+
+static inline void *
+ggc_internal_zone_cleared_alloc_stat (struct alloc_zone * z ATTRIBUTE_UNUSED,
+ size_t s MEM_STAT_DECL)
+{
+ return ggc_internal_cleared_alloc_stat (s PASS_MEM_STAT);
+}
+
+static inline void *
+ggc_internal_zone_vec_alloc_stat (struct alloc_zone * z ATTRIBUTE_UNUSED,
+ size_t s, size_t n MEM_STAT_DECL)
+{
+ return ggc_internal_vec_alloc_stat (s, n PASS_MEM_STAT);
+}
#endif
+/* Memory statistics passing versions of some allocators. Too few of them to
+ make gengtype produce them, so just define the needed ones here. */
+static inline struct rtx_def *
+ggc_alloc_zone_rtx_def_stat (struct alloc_zone * z, size_t s MEM_STAT_DECL)
+{
+ return (struct rtx_def *) ggc_internal_zone_alloc_stat (z, s PASS_MEM_STAT);
+}
+
+static inline union tree_node *
+ggc_alloc_zone_tree_node_stat (struct alloc_zone * z, size_t s MEM_STAT_DECL)
+{
+ return (union tree_node *) ggc_internal_zone_alloc_stat (z, s PASS_MEM_STAT);
+}
+
+static inline union tree_node *
+ggc_alloc_zone_cleared_tree_node_stat (struct alloc_zone * z, size_t s
+ MEM_STAT_DECL)
+{
+ return (union tree_node *)
+ ggc_internal_zone_cleared_alloc_stat (z, s PASS_MEM_STAT);
+}
+
+static inline union gimple_statement_d *
+ggc_alloc_cleared_gimple_statement_d_stat (size_t s MEM_STAT_DECL)
+{
+ return (union gimple_statement_d *)
+ ggc_internal_cleared_alloc_stat (s PASS_MEM_STAT);
+}
+
#endif
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 2f64beb6733..6af65114000 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -82,7 +82,7 @@ get_symbol_constant_value (tree sym)
bool
may_propagate_address_into_dereference (tree addr, tree deref)
{
- gcc_assert (INDIRECT_REF_P (deref)
+ gcc_assert (TREE_CODE (deref) == MEM_REF
&& TREE_CODE (addr) == ADDR_EXPR);
/* Don't propagate if ADDR's operand has incomplete type. */
@@ -108,15 +108,12 @@ may_propagate_address_into_dereference (tree addr, tree deref)
/* A subroutine of fold_stmt. Attempts to fold *(A+O) to A[X].
- BASE is an array type. OFFSET is a byte displacement. ORIG_TYPE
- is the desired result type.
+ BASE is an array type. OFFSET is a byte displacement.
LOC is the location of the original expression. */
static tree
-maybe_fold_offset_to_array_ref (location_t loc, tree base, tree offset,
- tree orig_type,
- bool allow_negative_idx)
+maybe_fold_offset_to_array_ref (location_t loc, tree base, tree offset)
{
tree min_idx, idx, idx_type, elt_offset = integer_zero_node;
tree array_type, elt_type, elt_size;
@@ -145,8 +142,6 @@ maybe_fold_offset_to_array_ref (location_t loc, tree base, tree offset,
if (TREE_CODE (array_type) != ARRAY_TYPE)
return NULL_TREE;
elt_type = TREE_TYPE (array_type);
- if (!useless_type_conversion_p (orig_type, elt_type))
- return NULL_TREE;
/* Use signed size type for intermediate computation on the index. */
idx_type = ssizetype;
@@ -219,34 +214,22 @@ maybe_fold_offset_to_array_ref (location_t loc, tree base, tree offset,
char *(c[4]);
c[3][2];
should not be simplified into (*c)[14] or tree-vrp will
- give false warnings. The same is true for
- struct A { long x; char d[0]; } *a;
- (char *)a - 4;
- which should be not folded to &a->d[-8]. */
- if (domain_type
- && TYPE_MAX_VALUE (domain_type)
- && TREE_CODE (TYPE_MAX_VALUE (domain_type)) == INTEGER_CST)
+ give false warnings.
+ This is only an issue for multi-dimensional arrays. */
+ if (TREE_CODE (elt_type) == ARRAY_TYPE
+ && domain_type)
{
- tree up_bound = TYPE_MAX_VALUE (domain_type);
-
- if (tree_int_cst_lt (up_bound, idx)
- /* Accesses after the end of arrays of size 0 (gcc
- extension) and 1 are likely intentional ("struct
- hack"). */
- && compare_tree_int (up_bound, 1) > 0)
+ if (TYPE_MAX_VALUE (domain_type)
+ && TREE_CODE (TYPE_MAX_VALUE (domain_type)) == INTEGER_CST
+ && tree_int_cst_lt (TYPE_MAX_VALUE (domain_type), idx))
return NULL_TREE;
- }
- if (domain_type
- && TYPE_MIN_VALUE (domain_type))
- {
- if (!allow_negative_idx
- && TREE_CODE (TYPE_MIN_VALUE (domain_type)) == INTEGER_CST
- && tree_int_cst_lt (idx, TYPE_MIN_VALUE (domain_type)))
+ else if (TYPE_MIN_VALUE (domain_type)
+ && TREE_CODE (TYPE_MIN_VALUE (domain_type)) == INTEGER_CST
+ && tree_int_cst_lt (idx, TYPE_MIN_VALUE (domain_type)))
+ return NULL_TREE;
+ else if (compare_tree_int (idx, 0) < 0)
return NULL_TREE;
}
- else if (!allow_negative_idx
- && compare_tree_int (idx, 0) < 0)
- return NULL_TREE;
{
tree t = build4 (ARRAY_REF, elt_type, base, idx, NULL_TREE, NULL_TREE);
@@ -256,340 +239,55 @@ maybe_fold_offset_to_array_ref (location_t loc, tree base, tree offset,
}
-/* Attempt to fold *(S+O) to S.X.
- BASE is a record type. OFFSET is a byte displacement. ORIG_TYPE
- is the desired result type.
-
- LOC is the location of the original expression. */
-
-static tree
-maybe_fold_offset_to_component_ref (location_t loc, tree record_type,
- tree base, tree offset, tree orig_type)
-{
- tree f, t, field_type, tail_array_field, field_offset;
- tree ret;
- tree new_base;
-
- if (TREE_CODE (record_type) != RECORD_TYPE
- && TREE_CODE (record_type) != UNION_TYPE
- && TREE_CODE (record_type) != QUAL_UNION_TYPE)
- return NULL_TREE;
-
- /* Short-circuit silly cases. */
- if (useless_type_conversion_p (record_type, orig_type))
- return NULL_TREE;
-
- tail_array_field = NULL_TREE;
- for (f = TYPE_FIELDS (record_type); f ; f = TREE_CHAIN (f))
- {
- int cmp;
-
- if (TREE_CODE (f) != FIELD_DECL)
- continue;
- if (DECL_BIT_FIELD (f))
- continue;
-
- if (!DECL_FIELD_OFFSET (f))
- continue;
- field_offset = byte_position (f);
- if (TREE_CODE (field_offset) != INTEGER_CST)
- continue;
-
- /* ??? Java creates "interesting" fields for representing base classes.
- They have no name, and have no context. With no context, we get into
- trouble with nonoverlapping_component_refs_p. Skip them. */
- if (!DECL_FIELD_CONTEXT (f))
- continue;
-
- /* The previous array field isn't at the end. */
- tail_array_field = NULL_TREE;
-
- /* Check to see if this offset overlaps with the field. */
- cmp = tree_int_cst_compare (field_offset, offset);
- if (cmp > 0)
- continue;
-
- field_type = TREE_TYPE (f);
-
- /* Here we exactly match the offset being checked. If the types match,
- then we can return that field. */
- if (cmp == 0
- && useless_type_conversion_p (orig_type, field_type))
- {
- t = fold_build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
- return t;
- }
-
- /* Don't care about offsets into the middle of scalars. */
- if (!AGGREGATE_TYPE_P (field_type))
- continue;
-
- /* Check for array at the end of the struct. This is often
- used as for flexible array members. We should be able to
- turn this into an array access anyway. */
- if (TREE_CODE (field_type) == ARRAY_TYPE)
- tail_array_field = f;
-
- /* Check the end of the field against the offset. */
- if (!DECL_SIZE_UNIT (f)
- || TREE_CODE (DECL_SIZE_UNIT (f)) != INTEGER_CST)
- continue;
- t = int_const_binop (MINUS_EXPR, offset, field_offset, 1);
- if (!tree_int_cst_lt (t, DECL_SIZE_UNIT (f)))
- continue;
-
- /* If we matched, then set offset to the displacement into
- this field. */
- new_base = fold_build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
- SET_EXPR_LOCATION (new_base, loc);
-
- /* Recurse to possibly find the match. */
- ret = maybe_fold_offset_to_array_ref (loc, new_base, t, orig_type,
- f == TYPE_FIELDS (record_type));
- if (ret)
- return ret;
- ret = maybe_fold_offset_to_component_ref (loc, field_type, new_base, t,
- orig_type);
- if (ret)
- return ret;
- }
-
- if (!tail_array_field)
- return NULL_TREE;
-
- f = tail_array_field;
- field_type = TREE_TYPE (f);
- offset = int_const_binop (MINUS_EXPR, offset, byte_position (f), 1);
-
- /* If we get here, we've got an aggregate field, and a possibly
- nonzero offset into them. Recurse and hope for a valid match. */
- base = fold_build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
- SET_EXPR_LOCATION (base, loc);
-
- t = maybe_fold_offset_to_array_ref (loc, base, offset, orig_type,
- f == TYPE_FIELDS (record_type));
- if (t)
- return t;
- return maybe_fold_offset_to_component_ref (loc, field_type, base, offset,
- orig_type);
-}
-
-/* Attempt to express (ORIG_TYPE)BASE+OFFSET as BASE->field_of_orig_type
- or BASE[index] or by combination of those.
-
+/* Attempt to express (ORIG_TYPE)BASE+OFFSET as BASE[index].
LOC is the location of original expression.
- Before attempting the conversion strip off existing ADDR_EXPRs and
- handled component refs. */
+ Before attempting the conversion strip off existing ADDR_EXPRs. */
tree
maybe_fold_offset_to_reference (location_t loc, tree base, tree offset,
tree orig_type)
{
tree ret;
- tree type;
STRIP_NOPS (base);
if (TREE_CODE (base) != ADDR_EXPR)
return NULL_TREE;
base = TREE_OPERAND (base, 0);
-
- /* Handle case where existing COMPONENT_REF pick e.g. wrong field of union,
- so it needs to be removed and new COMPONENT_REF constructed.
- The wrong COMPONENT_REF are often constructed by folding the
- (type *)&object within the expression (type *)&object+offset */
- if (handled_component_p (base))
- {
- HOST_WIDE_INT sub_offset, size, maxsize;
- tree newbase;
- newbase = get_ref_base_and_extent (base, &sub_offset,
- &size, &maxsize);
- gcc_assert (newbase);
- if (size == maxsize
- && size != -1
- && !(sub_offset & (BITS_PER_UNIT - 1)))
- {
- base = newbase;
- if (sub_offset)
- offset = int_const_binop (PLUS_EXPR, offset,
- build_int_cst (TREE_TYPE (offset),
- sub_offset / BITS_PER_UNIT), 1);
- }
- }
- if (useless_type_conversion_p (orig_type, TREE_TYPE (base))
+ if (types_compatible_p (orig_type, TREE_TYPE (base))
&& integer_zerop (offset))
return base;
- type = TREE_TYPE (base);
- ret = maybe_fold_offset_to_component_ref (loc, type, base, offset, orig_type);
- if (!ret)
- ret = maybe_fold_offset_to_array_ref (loc, base, offset, orig_type, true);
-
- return ret;
+ ret = maybe_fold_offset_to_array_ref (loc, base, offset);
+ if (ret && types_compatible_p (orig_type, TREE_TYPE (ret)))
+ return ret;
+ return NULL_TREE;
}
-/* Attempt to express (ORIG_TYPE)&BASE+OFFSET as &BASE->field_of_orig_type
- or &BASE[index] or by combination of those.
-
- LOC is the location of the original expression.
-
- Before attempting the conversion strip off existing component refs. */
+/* Attempt to express (ORIG_TYPE)ADDR+OFFSET as (*ADDR)[index].
+ LOC is the location of the original expression. */
tree
maybe_fold_offset_to_address (location_t loc, tree addr, tree offset,
tree orig_type)
{
- tree t;
-
- gcc_assert (POINTER_TYPE_P (TREE_TYPE (addr))
- && POINTER_TYPE_P (orig_type));
-
- t = maybe_fold_offset_to_reference (loc, addr, offset,
- TREE_TYPE (orig_type));
- if (t != NULL_TREE)
- {
- tree orig = addr;
- tree ptr_type;
-
- /* For __builtin_object_size to function correctly we need to
- make sure not to fold address arithmetic so that we change
- reference from one array to another. This would happen for
- example for
-
- struct X { char s1[10]; char s2[10] } s;
- char *foo (void) { return &s.s2[-4]; }
-
- where we need to avoid generating &s.s1[6]. As the C and
- C++ frontends create different initial trees
- (char *) &s.s1 + -4 vs. &s.s1[-4] we have to do some
- sophisticated comparisons here. Note that checking for the
- condition after the fact is easier than trying to avoid doing
- the folding. */
- STRIP_NOPS (orig);
- if (TREE_CODE (orig) == ADDR_EXPR)
- orig = TREE_OPERAND (orig, 0);
- if ((TREE_CODE (orig) == ARRAY_REF
- || (TREE_CODE (orig) == COMPONENT_REF
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (orig, 1))) == ARRAY_TYPE))
- && (TREE_CODE (t) == ARRAY_REF
- || TREE_CODE (t) == COMPONENT_REF)
- && !operand_equal_p (TREE_CODE (orig) == ARRAY_REF
- ? TREE_OPERAND (orig, 0) : orig,
- TREE_CODE (t) == ARRAY_REF
- ? TREE_OPERAND (t, 0) : t, 0))
- return NULL_TREE;
-
- ptr_type = build_pointer_type (TREE_TYPE (t));
- if (!useless_type_conversion_p (orig_type, ptr_type))
- return NULL_TREE;
- return build_fold_addr_expr_with_type_loc (loc, t, ptr_type);
- }
-
- return NULL_TREE;
-}
-
-/* A subroutine of fold_stmt. Attempt to simplify *(BASE+OFFSET).
- Return the simplified expression, or NULL if nothing could be done. */
+ tree base, ret;
-static tree
-maybe_fold_stmt_indirect (tree expr, tree base, tree offset)
-{
- tree t;
- bool volatile_p = TREE_THIS_VOLATILE (expr);
- location_t loc = EXPR_LOCATION (expr);
-
- /* We may well have constructed a double-nested PLUS_EXPR via multiple
- substitutions. Fold that down to one. Remove NON_LVALUE_EXPRs that
- are sometimes added. */
- base = fold (base);
- STRIP_TYPE_NOPS (base);
- TREE_OPERAND (expr, 0) = base;
-
- /* One possibility is that the address reduces to a string constant. */
- t = fold_read_from_constant_string (expr);
- if (t)
- return t;
-
- /* Add in any offset from a POINTER_PLUS_EXPR. */
- if (TREE_CODE (base) == POINTER_PLUS_EXPR)
+ STRIP_NOPS (addr);
+ if (TREE_CODE (addr) != ADDR_EXPR)
+ return NULL_TREE;
+ base = TREE_OPERAND (addr, 0);
+ ret = maybe_fold_offset_to_array_ref (loc, base, offset);
+ if (ret)
{
- tree offset2;
-
- offset2 = TREE_OPERAND (base, 1);
- if (TREE_CODE (offset2) != INTEGER_CST)
+ ret = build_fold_addr_expr (ret);
+ if (!useless_type_conversion_p (orig_type, TREE_TYPE (ret)))
return NULL_TREE;
- base = TREE_OPERAND (base, 0);
-
- offset = fold_convert (sizetype,
- int_const_binop (PLUS_EXPR, offset, offset2, 1));
- }
-
- if (TREE_CODE (base) == ADDR_EXPR)
- {
- tree base_addr = base;
-
- /* Strip the ADDR_EXPR. */
- base = TREE_OPERAND (base, 0);
-
- /* Fold away CONST_DECL to its value, if the type is scalar. */
- if (TREE_CODE (base) == CONST_DECL
- && is_gimple_min_invariant (DECL_INITIAL (base)))
- return DECL_INITIAL (base);
-
- /* If there is no offset involved simply return the folded base. */
- if (integer_zerop (offset))
- return base;
-
- /* Try folding *(&B+O) to B.X. */
- t = maybe_fold_offset_to_reference (loc, base_addr, offset,
- TREE_TYPE (expr));
- if (t)
- {
- /* Preserve volatileness of the original expression.
- We can end up with a plain decl here which is shared
- and we shouldn't mess with its flags. */
- if (!SSA_VAR_P (t))
- TREE_THIS_VOLATILE (t) = volatile_p;
- return t;
- }
- }
- else
- {
- /* We can get here for out-of-range string constant accesses,
- such as "_"[3]. Bail out of the entire substitution search
- and arrange for the entire statement to be replaced by a
- call to __builtin_trap. In all likelihood this will all be
- constant-folded away, but in the meantime we can't leave with
- something that get_expr_operands can't understand. */
-
- t = base;
- STRIP_NOPS (t);
- if (TREE_CODE (t) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST)
- {
- /* FIXME: Except that this causes problems elsewhere with dead
- code not being deleted, and we die in the rtl expanders
- because we failed to remove some ssa_name. In the meantime,
- just return zero. */
- /* FIXME2: This condition should be signaled by
- fold_read_from_constant_string directly, rather than
- re-checking for it here. */
- return integer_zero_node;
- }
-
- /* Try folding *(B+O) to B->X. Still an improvement. */
- if (POINTER_TYPE_P (TREE_TYPE (base)))
- {
- t = maybe_fold_offset_to_reference (loc, base, offset,
- TREE_TYPE (expr));
- if (t)
- return t;
- }
+ SET_EXPR_LOCATION (ret, loc);
}
- /* Otherwise we had an offset that we could not simplify. */
- return NULL_TREE;
+ return ret;
}
@@ -622,18 +320,17 @@ maybe_fold_stmt_addition (location_t loc, tree res_type, tree op0, tree op1)
/* Or op0 should now be A[0] and the non-constant offset defined
via a multiplication by the array element size. */
if (TREE_CODE (op0) == ARRAY_REF
- && integer_zerop (TREE_OPERAND (op0, 1))
- && TREE_CODE (op1) == SSA_NAME
- && host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (op0)), 1))
- {
- gimple offset_def = SSA_NAME_DEF_STMT (op1);
- if (!is_gimple_assign (offset_def))
- return NULL_TREE;
-
/* As we will end up creating a variable index array access
in the outermost array dimension make sure there isn't
a more inner array that the index could overflow to. */
- if (TREE_CODE (TREE_OPERAND (op0, 0)) == ARRAY_REF)
+ && TREE_CODE (TREE_OPERAND (op0, 0)) != ARRAY_REF
+ && integer_zerop (TREE_OPERAND (op0, 1))
+ && TREE_CODE (op1) == SSA_NAME)
+ {
+ gimple offset_def = SSA_NAME_DEF_STMT (op1);
+ tree elsz = TYPE_SIZE_UNIT (TREE_TYPE (op0));
+ if (!host_integerp (elsz, 1)
+ || !is_gimple_assign (offset_def))
return NULL_TREE;
/* Do not build array references of something that we can't
@@ -644,15 +341,14 @@ maybe_fold_stmt_addition (location_t loc, tree res_type, tree op0, tree op1)
if (gimple_assign_rhs_code (offset_def) == MULT_EXPR
&& TREE_CODE (gimple_assign_rhs2 (offset_def)) == INTEGER_CST
- && tree_int_cst_equal (gimple_assign_rhs2 (offset_def),
- TYPE_SIZE_UNIT (TREE_TYPE (op0))))
+ && tree_int_cst_equal (gimple_assign_rhs2 (offset_def), elsz))
return build_fold_addr_expr
(build4 (ARRAY_REF, TREE_TYPE (op0),
TREE_OPERAND (op0, 0),
gimple_assign_rhs1 (offset_def),
TREE_OPERAND (op0, 2),
TREE_OPERAND (op0, 3)));
- else if (integer_onep (TYPE_SIZE_UNIT (TREE_TYPE (op0)))
+ else if (integer_onep (elsz)
&& gimple_assign_rhs_code (offset_def) != MULT_EXPR)
return build_fold_addr_expr
(build4 (ARRAY_REF, TREE_TYPE (op0),
@@ -661,6 +357,38 @@ maybe_fold_stmt_addition (location_t loc, tree res_type, tree op0, tree op1)
TREE_OPERAND (op0, 2),
TREE_OPERAND (op0, 3)));
}
+ else if (TREE_CODE (TREE_TYPE (op0)) == ARRAY_TYPE
+ /* Dto. */
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (op0))) != ARRAY_TYPE
+ && TREE_CODE (op1) == SSA_NAME)
+ {
+ gimple offset_def = SSA_NAME_DEF_STMT (op1);
+ tree elsz = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (op0)));
+ if (!host_integerp (elsz, 1)
+ || !is_gimple_assign (offset_def))
+ return NULL_TREE;
+
+ /* Do not build array references of something that we can't
+ see the true number of array dimensions for. */
+ if (!DECL_P (op0)
+ && !handled_component_p (op0))
+ return NULL_TREE;
+
+ if (gimple_assign_rhs_code (offset_def) == MULT_EXPR
+ && TREE_CODE (gimple_assign_rhs2 (offset_def)) == INTEGER_CST
+ && tree_int_cst_equal (gimple_assign_rhs2 (offset_def), elsz))
+ return build_fold_addr_expr
+ (build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (op0)),
+ op0, gimple_assign_rhs1 (offset_def),
+ integer_zero_node, NULL_TREE));
+ else if (integer_onep (elsz)
+ && gimple_assign_rhs_code (offset_def) != MULT_EXPR)
+ return build_fold_addr_expr
+ (build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (op0)),
+ op0, op1,
+ integer_zero_node, NULL_TREE));
+ }
+
return NULL_TREE;
}
@@ -715,13 +443,12 @@ maybe_fold_stmt_addition (location_t loc, tree res_type, tree op0, tree op1)
ptd_type = TREE_TYPE (TREE_TYPE (op0));
/* At which point we can try some of the same things as for indirects. */
- t = maybe_fold_offset_to_array_ref (loc, op0, op1, ptd_type, true);
- if (!t)
- t = maybe_fold_offset_to_component_ref (loc, TREE_TYPE (op0), op0, op1,
- ptd_type);
+ t = maybe_fold_offset_to_array_ref (loc, op0, op1);
if (t)
{
- t = build1 (ADDR_EXPR, res_type, t);
+ t = build_fold_addr_expr (t);
+ if (!useless_type_conversion_p (res_type, TREE_TYPE (t)))
+ return NULL_TREE;
SET_EXPR_LOCATION (t, loc);
}
@@ -759,19 +486,39 @@ maybe_fold_reference (tree expr, bool is_lhs)
while (handled_component_p (*t))
t = &TREE_OPERAND (*t, 0);
- if (TREE_CODE (*t) == INDIRECT_REF)
+ /* Fold back MEM_REFs to reference trees. */
+ if (TREE_CODE (*t) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (*t, 0)) == ADDR_EXPR
+ && integer_zerop (TREE_OPERAND (*t, 1))
+ && (TREE_THIS_VOLATILE (*t)
+ == TREE_THIS_VOLATILE (TREE_OPERAND (TREE_OPERAND (*t, 0), 0)))
+ && !TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (*t, 1)))
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (*t))
+ == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (TREE_OPERAND (*t, 1)))))
+ /* We have to look out here to not drop a required conversion
+ from the rhs to the lhs if is_lhs, but we don't have the
+ rhs here to verify that. Thus require strict type
+ compatibility. */
+ && types_compatible_p (TREE_TYPE (*t),
+ TREE_TYPE (TREE_OPERAND
+ (TREE_OPERAND (*t, 0), 0))))
{
- tree tem = maybe_fold_stmt_indirect (*t, TREE_OPERAND (*t, 0),
- integer_zero_node);
- /* Avoid folding *"abc" = 5 into 'a' = 5. */
- if (is_lhs && tem && CONSTANT_CLASS_P (tem))
- tem = NULL_TREE;
- if (!tem
- && TREE_CODE (TREE_OPERAND (*t, 0)) == ADDR_EXPR)
- /* If we had a good reason for propagating the address here,
- make sure we end up with valid gimple. See PR34989. */
- tem = TREE_OPERAND (TREE_OPERAND (*t, 0), 0);
-
+ tree tem;
+ *t = TREE_OPERAND (TREE_OPERAND (*t, 0), 0);
+ tem = maybe_fold_reference (expr, is_lhs);
+ if (tem)
+ return tem;
+ return expr;
+ }
+ /* Canonicalize MEM_REFs invariant address operand. */
+ else if (TREE_CODE (*t) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (*t, 0)) == ADDR_EXPR
+ && !DECL_P (TREE_OPERAND (TREE_OPERAND (*t, 0), 0))
+ && !CONSTANT_CLASS_P (TREE_OPERAND (TREE_OPERAND (*t, 0), 0)))
+ {
+ tree tem = fold_binary (MEM_REF, TREE_TYPE (*t),
+ TREE_OPERAND (*t, 0),
+ TREE_OPERAND (*t, 1));
if (tem)
{
*t = tem;
@@ -863,10 +610,18 @@ fold_gimple_assign (gimple_stmt_iterator *si)
else if (TREE_CODE (rhs) == ADDR_EXPR)
{
- tree tem = maybe_fold_reference (TREE_OPERAND (rhs, 0), true);
- if (tem)
+ tree ref = TREE_OPERAND (rhs, 0);
+ tree tem = maybe_fold_reference (ref, true);
+ if (tem
+ && TREE_CODE (tem) == MEM_REF
+ && integer_zerop (TREE_OPERAND (tem, 1)))
+ result = fold_convert (TREE_TYPE (rhs), TREE_OPERAND (tem, 0));
+ else if (tem)
result = fold_convert (TREE_TYPE (rhs),
build_fold_addr_expr_loc (loc, tem));
+ else if (TREE_CODE (ref) == MEM_REF
+ && integer_zerop (TREE_OPERAND (ref, 1)))
+ result = fold_convert (TREE_TYPE (rhs), TREE_OPERAND (ref, 0));
}
else if (TREE_CODE (rhs) == CONSTRUCTOR
@@ -986,6 +741,33 @@ fold_gimple_assign (gimple_stmt_iterator *si)
}
break;
+ case GIMPLE_TERNARY_RHS:
+ result = fold_ternary_loc (loc, subcode,
+ TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ gimple_assign_rhs3 (stmt));
+
+ if (result)
+ {
+ STRIP_USELESS_TYPE_CONVERSION (result);
+ if (valid_gimple_rhs_p (result))
+ return result;
+
+ /* Fold might have produced non-GIMPLE, so if we trust it blindly
+ we lose canonicalization opportunities. Do not go again
+ through fold here though, or the same non-GIMPLE will be
+ produced. */
+ if (commutative_ternary_tree_code (subcode)
+ && tree_swap_operands_p (gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt), false))
+ return build3 (subcode, TREE_TYPE (gimple_assign_lhs (stmt)),
+ gimple_assign_rhs2 (stmt),
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs3 (stmt));
+ }
+ break;
+
case GIMPLE_INVALID_RHS:
gcc_unreachable ();
}
@@ -1026,7 +808,9 @@ fold_gimple_cond (gimple stmt)
is replaced. If the call is expected to produces a result, then it
is replaced by an assignment of the new RHS to the result variable.
If the result is to be ignored, then the call is replaced by a
- GIMPLE_NOP. */
+ GIMPLE_NOP. A proper VDEF chain is retained by making the first
+ VUSE and the last VDEF of the whole sequence be the same as the replaced
+ statement and using new SSA names for stores in between. */
void
gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
@@ -1038,12 +822,15 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
gimple_seq stmts = gimple_seq_alloc();
struct gimplify_ctx gctx;
gimple last = NULL;
+ gimple laststore = NULL;
+ tree reaching_vuse;
stmt = gsi_stmt (*si_p);
gcc_assert (is_gimple_call (stmt));
lhs = gimple_call_lhs (stmt);
+ reaching_vuse = gimple_vuse (stmt);
push_gimplify_context (&gctx);
@@ -1068,13 +855,48 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
new_stmt = gsi_stmt (i);
find_new_referenced_vars (new_stmt);
mark_symbols_for_renaming (new_stmt);
+ /* If the new statement has a VUSE, update it with exact SSA name we
+ know will reach this one. */
+ if (gimple_vuse (new_stmt))
+ {
+ /* If we've also seen a previous store create a new VDEF for
+ the latter one, and make that the new reaching VUSE. */
+ if (laststore)
+ {
+ reaching_vuse = make_ssa_name (gimple_vop (cfun), laststore);
+ gimple_set_vdef (laststore, reaching_vuse);
+ update_stmt (laststore);
+ laststore = NULL;
+ }
+ gimple_set_vuse (new_stmt, reaching_vuse);
+ gimple_set_modified (new_stmt, true);
+ }
+ if (gimple_assign_single_p (new_stmt)
+ && !is_gimple_reg (gimple_assign_lhs (new_stmt)))
+ {
+ laststore = new_stmt;
+ }
last = new_stmt;
}
if (lhs == NULL_TREE)
{
- unlink_stmt_vdef (stmt);
- release_defs (stmt);
+ /* If we replace a call without LHS that has a VDEF and our new
+ sequence ends with a store we must make that store have the same
+ vdef in order not to break the sequencing. This can happen
+ for instance when folding memcpy calls into assignments. */
+ if (gimple_vdef (stmt) && laststore)
+ {
+ gimple_set_vdef (laststore, gimple_vdef (stmt));
+ if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
+ update_stmt (laststore);
+ }
+ else
+ {
+ unlink_stmt_vdef (stmt);
+ release_defs (stmt);
+ }
new_stmt = last;
}
else
@@ -1084,10 +906,30 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
gsi_insert_before (si_p, last, GSI_NEW_STMT);
gsi_next (si_p);
}
+ if (laststore && is_gimple_reg (lhs))
+ {
+ gimple_set_vdef (laststore, gimple_vdef (stmt));
+ update_stmt (laststore);
+ if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
+ laststore = NULL;
+ }
+ else if (laststore)
+ {
+ reaching_vuse = make_ssa_name (gimple_vop (cfun), laststore);
+ gimple_set_vdef (laststore, reaching_vuse);
+ update_stmt (laststore);
+ laststore = NULL;
+ }
new_stmt = gimple_build_assign (lhs, tmp);
- gimple_set_vuse (new_stmt, gimple_vuse (stmt));
- gimple_set_vdef (new_stmt, gimple_vdef (stmt));
- move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+ if (!is_gimple_reg (tmp))
+ gimple_set_vuse (new_stmt, reaching_vuse);
+ if (!is_gimple_reg (lhs))
+ {
+ gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+ if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = new_stmt;
+ }
}
gimple_set_location (new_stmt, gimple_location (stmt));
@@ -1403,6 +1245,22 @@ gimple_fold_builtin (gimple stmt)
return result;
}
+/* Return the first of the base binfos of BINFO that has virtual functions. */
+
+static tree
+get_first_base_binfo_with_virtuals (tree binfo)
+{
+ int i;
+ tree base_binfo;
+
+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
+ if (BINFO_VIRTUALS (base_binfo))
+ return base_binfo;
+
+ return NULL_TREE;
+}
+
+
/* Search for a base binfo of BINFO that corresponds to TYPE and return it if
it is found or NULL_TREE if it is not. */
@@ -1458,8 +1316,8 @@ gimple_get_relevant_ref_binfo (tree ref, tree known_binfo)
|| BINFO_N_BASE_BINFOS (binfo) == 0)
return NULL_TREE;
- base_binfo = BINFO_BASE_BINFO (binfo, 0);
- if (BINFO_TYPE (base_binfo) != TREE_TYPE (field))
+ base_binfo = get_first_base_binfo_with_virtuals (binfo);
+ if (base_binfo && BINFO_TYPE (base_binfo) != TREE_TYPE (field))
{
tree d_binfo;
@@ -1477,7 +1335,7 @@ gimple_get_relevant_ref_binfo (tree ref, tree known_binfo)
return TYPE_BINFO (TREE_TYPE (ref));
else if (known_binfo
&& (TREE_CODE (ref) == SSA_NAME
- || TREE_CODE (ref) == INDIRECT_REF))
+ || TREE_CODE (ref) == MEM_REF))
return known_binfo;
else
return NULL_TREE;
@@ -1716,3 +1574,1052 @@ fold_stmt_inplace (gimple stmt)
return changed;
}
+/* Canonicalize and possibly invert the boolean EXPR; return NULL_TREE
+ if EXPR is null or we don't know how.
+ If non-null, the result always has boolean type. */
+
+static tree
+canonicalize_bool (tree expr, bool invert)
+{
+ if (!expr)
+ return NULL_TREE;
+ else if (invert)
+ {
+ if (integer_nonzerop (expr))
+ return boolean_false_node;
+ else if (integer_zerop (expr))
+ return boolean_true_node;
+ else if (TREE_CODE (expr) == SSA_NAME)
+ return fold_build2 (EQ_EXPR, boolean_type_node, expr,
+ build_int_cst (TREE_TYPE (expr), 0));
+ else if (TREE_CODE_CLASS (TREE_CODE (expr)) == tcc_comparison)
+ return fold_build2 (invert_tree_comparison (TREE_CODE (expr), false),
+ boolean_type_node,
+ TREE_OPERAND (expr, 0),
+ TREE_OPERAND (expr, 1));
+ else
+ return NULL_TREE;
+ }
+ else
+ {
+ if (TREE_CODE (TREE_TYPE (expr)) == BOOLEAN_TYPE)
+ return expr;
+ if (integer_nonzerop (expr))
+ return boolean_true_node;
+ else if (integer_zerop (expr))
+ return boolean_false_node;
+ else if (TREE_CODE (expr) == SSA_NAME)
+ return fold_build2 (NE_EXPR, boolean_type_node, expr,
+ build_int_cst (TREE_TYPE (expr), 0));
+ else if (TREE_CODE_CLASS (TREE_CODE (expr)) == tcc_comparison)
+ return fold_build2 (TREE_CODE (expr),
+ boolean_type_node,
+ TREE_OPERAND (expr, 0),
+ TREE_OPERAND (expr, 1));
+ else
+ return NULL_TREE;
+ }
+}
+
+/* Check to see if a boolean expression EXPR is logically equivalent to the
+ comparison (OP1 CODE OP2). Check for various identities involving
+ SSA_NAMEs. */
+
+static bool
+same_bool_comparison_p (const_tree expr, enum tree_code code,
+ const_tree op1, const_tree op2)
+{
+ gimple s;
+
+ /* The obvious case. */
+ if (TREE_CODE (expr) == code
+ && operand_equal_p (TREE_OPERAND (expr, 0), op1, 0)
+ && operand_equal_p (TREE_OPERAND (expr, 1), op2, 0))
+ return true;
+
+ /* Check for comparing (name, name != 0) and the case where expr
+ is an SSA_NAME with a definition matching the comparison. */
+ if (TREE_CODE (expr) == SSA_NAME
+ && TREE_CODE (TREE_TYPE (expr)) == BOOLEAN_TYPE)
+ {
+ if (operand_equal_p (expr, op1, 0))
+ return ((code == NE_EXPR && integer_zerop (op2))
+ || (code == EQ_EXPR && integer_nonzerop (op2)));
+ s = SSA_NAME_DEF_STMT (expr);
+ if (is_gimple_assign (s)
+ && gimple_assign_rhs_code (s) == code
+ && operand_equal_p (gimple_assign_rhs1 (s), op1, 0)
+ && operand_equal_p (gimple_assign_rhs2 (s), op2, 0))
+ return true;
+ }
+
+ /* If op1 is of the form (name != 0) or (name == 0), and the definition
+ of name is a comparison, recurse. */
+ if (TREE_CODE (op1) == SSA_NAME
+ && TREE_CODE (TREE_TYPE (op1)) == BOOLEAN_TYPE)
+ {
+ s = SSA_NAME_DEF_STMT (op1);
+ if (is_gimple_assign (s)
+ && TREE_CODE_CLASS (gimple_assign_rhs_code (s)) == tcc_comparison)
+ {
+ enum tree_code c = gimple_assign_rhs_code (s);
+ if ((c == NE_EXPR && integer_zerop (op2))
+ || (c == EQ_EXPR && integer_nonzerop (op2)))
+ return same_bool_comparison_p (expr, c,
+ gimple_assign_rhs1 (s),
+ gimple_assign_rhs2 (s));
+ if ((c == EQ_EXPR && integer_zerop (op2))
+ || (c == NE_EXPR && integer_nonzerop (op2)))
+ return same_bool_comparison_p (expr,
+ invert_tree_comparison (c, false),
+ gimple_assign_rhs1 (s),
+ gimple_assign_rhs2 (s));
+ }
+ }
+ return false;
+}
+
+/* Check to see if two boolean expressions OP1 and OP2 are logically
+ equivalent. */
+
+static bool
+same_bool_result_p (const_tree op1, const_tree op2)
+{
+ /* Simple cases first. */
+ if (operand_equal_p (op1, op2, 0))
+ return true;
+
+ /* Check the cases where at least one of the operands is a comparison.
+ These are a bit smarter than operand_equal_p in that they apply some
+ identifies on SSA_NAMEs. */
+ if (TREE_CODE_CLASS (TREE_CODE (op2)) == tcc_comparison
+ && same_bool_comparison_p (op1, TREE_CODE (op2),
+ TREE_OPERAND (op2, 0),
+ TREE_OPERAND (op2, 1)))
+ return true;
+ if (TREE_CODE_CLASS (TREE_CODE (op1)) == tcc_comparison
+ && same_bool_comparison_p (op2, TREE_CODE (op1),
+ TREE_OPERAND (op1, 0),
+ TREE_OPERAND (op1, 1)))
+ return true;
+
+ /* Default case. */
+ return false;
+}
+
+/* Forward declarations for some mutually recursive functions. */
+
+static tree
+and_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
+ enum tree_code code2, tree op2a, tree op2b);
+static tree
+and_var_with_comparison (tree var, bool invert,
+ enum tree_code code2, tree op2a, tree op2b);
+static tree
+and_var_with_comparison_1 (gimple stmt,
+ enum tree_code code2, tree op2a, tree op2b);
+static tree
+or_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
+ enum tree_code code2, tree op2a, tree op2b);
+static tree
+or_var_with_comparison (tree var, bool invert,
+ enum tree_code code2, tree op2a, tree op2b);
+static tree
+or_var_with_comparison_1 (gimple stmt,
+ enum tree_code code2, tree op2a, tree op2b);
+
+/* Helper function for and_comparisons_1: try to simplify the AND of the
+ ssa variable VAR with the comparison specified by (OP2A CODE2 OP2B).
+ If INVERT is true, invert the value of the VAR before doing the AND.
+ Return NULL_EXPR if we can't simplify this to a single expression. */
+
+static tree
+and_var_with_comparison (tree var, bool invert,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ tree t;
+ gimple stmt = SSA_NAME_DEF_STMT (var);
+
+ /* We can only deal with variables whose definitions are assignments. */
+ if (!is_gimple_assign (stmt))
+ return NULL_TREE;
+
+ /* If we have an inverted comparison, apply DeMorgan's law and rewrite
+ !var AND (op2a code2 op2b) => !(var OR !(op2a code2 op2b))
+ Then we only have to consider the simpler non-inverted cases. */
+ if (invert)
+ t = or_var_with_comparison_1 (stmt,
+ invert_tree_comparison (code2, false),
+ op2a, op2b);
+ else
+ t = and_var_with_comparison_1 (stmt, code2, op2a, op2b);
+ return canonicalize_bool (t, invert);
+}
+
+/* Try to simplify the AND of the ssa variable defined by the assignment
+ STMT with the comparison specified by (OP2A CODE2 OP2B).
+ Return NULL_EXPR if we can't simplify this to a single expression. */
+
+static tree
+and_var_with_comparison_1 (gimple stmt,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ tree var = gimple_assign_lhs (stmt);
+ tree true_test_var = NULL_TREE;
+ tree false_test_var = NULL_TREE;
+ enum tree_code innercode = gimple_assign_rhs_code (stmt);
+
+ /* Check for identities like (var AND (var == 0)) => false. */
+ if (TREE_CODE (op2a) == SSA_NAME
+ && TREE_CODE (TREE_TYPE (var)) == BOOLEAN_TYPE)
+ {
+ if ((code2 == NE_EXPR && integer_zerop (op2b))
+ || (code2 == EQ_EXPR && integer_nonzerop (op2b)))
+ {
+ true_test_var = op2a;
+ if (var == true_test_var)
+ return var;
+ }
+ else if ((code2 == EQ_EXPR && integer_zerop (op2b))
+ || (code2 == NE_EXPR && integer_nonzerop (op2b)))
+ {
+ false_test_var = op2a;
+ if (var == false_test_var)
+ return boolean_false_node;
+ }
+ }
+
+ /* If the definition is a comparison, recurse on it. */
+ if (TREE_CODE_CLASS (innercode) == tcc_comparison)
+ {
+ tree t = and_comparisons_1 (innercode,
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ code2,
+ op2a,
+ op2b);
+ if (t)
+ return t;
+ }
+
+ /* If the definition is an AND or OR expression, we may be able to
+ simplify by reassociating. */
+ if (innercode == TRUTH_AND_EXPR
+ || innercode == TRUTH_OR_EXPR
+ || (TREE_CODE (TREE_TYPE (var)) == BOOLEAN_TYPE
+ && (innercode == BIT_AND_EXPR || innercode == BIT_IOR_EXPR)))
+ {
+ tree inner1 = gimple_assign_rhs1 (stmt);
+ tree inner2 = gimple_assign_rhs2 (stmt);
+ gimple s;
+ tree t;
+ tree partial = NULL_TREE;
+ bool is_and = (innercode == TRUTH_AND_EXPR || innercode == BIT_AND_EXPR);
+
+ /* Check for boolean identities that don't require recursive examination
+ of inner1/inner2:
+ inner1 AND (inner1 AND inner2) => inner1 AND inner2 => var
+ inner1 AND (inner1 OR inner2) => inner1
+ !inner1 AND (inner1 AND inner2) => false
+ !inner1 AND (inner1 OR inner2) => !inner1 AND inner2
+ Likewise for similar cases involving inner2. */
+ if (inner1 == true_test_var)
+ return (is_and ? var : inner1);
+ else if (inner2 == true_test_var)
+ return (is_and ? var : inner2);
+ else if (inner1 == false_test_var)
+ return (is_and
+ ? boolean_false_node
+ : and_var_with_comparison (inner2, false, code2, op2a, op2b));
+ else if (inner2 == false_test_var)
+ return (is_and
+ ? boolean_false_node
+ : and_var_with_comparison (inner1, false, code2, op2a, op2b));
+
+ /* Next, redistribute/reassociate the AND across the inner tests.
+ Compute the first partial result, (inner1 AND (op2a code op2b)) */
+ if (TREE_CODE (inner1) == SSA_NAME
+ && is_gimple_assign (s = SSA_NAME_DEF_STMT (inner1))
+ && TREE_CODE_CLASS (gimple_assign_rhs_code (s)) == tcc_comparison
+ && (t = maybe_fold_and_comparisons (gimple_assign_rhs_code (s),
+ gimple_assign_rhs1 (s),
+ gimple_assign_rhs2 (s),
+ code2, op2a, op2b)))
+ {
+ /* Handle the AND case, where we are reassociating:
+ (inner1 AND inner2) AND (op2a code2 op2b)
+ => (t AND inner2)
+ If the partial result t is a constant, we win. Otherwise
+ continue on to try reassociating with the other inner test. */
+ if (is_and)
+ {
+ if (integer_onep (t))
+ return inner2;
+ else if (integer_zerop (t))
+ return boolean_false_node;
+ }
+
+ /* Handle the OR case, where we are redistributing:
+ (inner1 OR inner2) AND (op2a code2 op2b)
+ => (t OR (inner2 AND (op2a code2 op2b))) */
+ else
+ {
+ if (integer_onep (t))
+ return boolean_true_node;
+ else
+ /* Save partial result for later. */
+ partial = t;
+ }
+ }
+
+ /* Compute the second partial result, (inner2 AND (op2a code op2b)) */
+ if (TREE_CODE (inner2) == SSA_NAME
+ && is_gimple_assign (s = SSA_NAME_DEF_STMT (inner2))
+ && TREE_CODE_CLASS (gimple_assign_rhs_code (s)) == tcc_comparison
+ && (t = maybe_fold_and_comparisons (gimple_assign_rhs_code (s),
+ gimple_assign_rhs1 (s),
+ gimple_assign_rhs2 (s),
+ code2, op2a, op2b)))
+ {
+ /* Handle the AND case, where we are reassociating:
+ (inner1 AND inner2) AND (op2a code2 op2b)
+ => (inner1 AND t) */
+ if (is_and)
+ {
+ if (integer_onep (t))
+ return inner1;
+ else if (integer_zerop (t))
+ return boolean_false_node;
+ }
+
+ /* Handle the OR case. where we are redistributing:
+ (inner1 OR inner2) AND (op2a code2 op2b)
+ => (t OR (inner1 AND (op2a code2 op2b)))
+ => (t OR partial) */
+ else
+ {
+ if (integer_onep (t))
+ return boolean_true_node;
+ else if (partial)
+ {
+ /* We already got a simplification for the other
+ operand to the redistributed OR expression. The
+ interesting case is when at least one is false.
+ Or, if both are the same, we can apply the identity
+ (x OR x) == x. */
+ if (integer_zerop (partial))
+ return t;
+ else if (integer_zerop (t))
+ return partial;
+ else if (same_bool_result_p (t, partial))
+ return t;
+ }
+ }
+ }
+ }
+ return NULL_TREE;
+}
+
+/* Try to simplify the AND of two comparisons defined by
+ (OP1A CODE1 OP1B) and (OP2A CODE2 OP2B), respectively.
+ If this can be done without constructing an intermediate value,
+ return the resulting tree; otherwise NULL_TREE is returned.
+ This function is deliberately asymmetric as it recurses on SSA_DEFs
+ in the first comparison but not the second. */
+
+static tree
+and_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ /* First check for ((x CODE1 y) AND (x CODE2 y)). */
+ if (operand_equal_p (op1a, op2a, 0)
+ && operand_equal_p (op1b, op2b, 0))
+ {
+ tree t = combine_comparisons (UNKNOWN_LOCATION,
+ TRUTH_ANDIF_EXPR, code1, code2,
+ boolean_type_node, op1a, op1b);
+ if (t)
+ return t;
+ }
+
+ /* Likewise the swapped case of the above. */
+ if (operand_equal_p (op1a, op2b, 0)
+ && operand_equal_p (op1b, op2a, 0))
+ {
+ tree t = combine_comparisons (UNKNOWN_LOCATION,
+ TRUTH_ANDIF_EXPR, code1,
+ swap_tree_comparison (code2),
+ boolean_type_node, op1a, op1b);
+ if (t)
+ return t;
+ }
+
+ /* If both comparisons are of the same value against constants, we might
+ be able to merge them. */
+ if (operand_equal_p (op1a, op2a, 0)
+ && TREE_CODE (op1b) == INTEGER_CST
+ && TREE_CODE (op2b) == INTEGER_CST)
+ {
+ int cmp = tree_int_cst_compare (op1b, op2b);
+
+ /* If we have (op1a == op1b), we should either be able to
+ return that or FALSE, depending on whether the constant op1b
+ also satisfies the other comparison against op2b. */
+ if (code1 == EQ_EXPR)
+ {
+ bool done = true;
+ bool val;
+ switch (code2)
+ {
+ case EQ_EXPR: val = (cmp == 0); break;
+ case NE_EXPR: val = (cmp != 0); break;
+ case LT_EXPR: val = (cmp < 0); break;
+ case GT_EXPR: val = (cmp > 0); break;
+ case LE_EXPR: val = (cmp <= 0); break;
+ case GE_EXPR: val = (cmp >= 0); break;
+ default: done = false;
+ }
+ if (done)
+ {
+ if (val)
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ else
+ return boolean_false_node;
+ }
+ }
+ /* Likewise if the second comparison is an == comparison. */
+ else if (code2 == EQ_EXPR)
+ {
+ bool done = true;
+ bool val;
+ switch (code1)
+ {
+ case EQ_EXPR: val = (cmp == 0); break;
+ case NE_EXPR: val = (cmp != 0); break;
+ case LT_EXPR: val = (cmp > 0); break;
+ case GT_EXPR: val = (cmp < 0); break;
+ case LE_EXPR: val = (cmp >= 0); break;
+ case GE_EXPR: val = (cmp <= 0); break;
+ default: done = false;
+ }
+ if (done)
+ {
+ if (val)
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ else
+ return boolean_false_node;
+ }
+ }
+
+ /* Same business with inequality tests. */
+ else if (code1 == NE_EXPR)
+ {
+ bool val;
+ switch (code2)
+ {
+ case EQ_EXPR: val = (cmp != 0); break;
+ case NE_EXPR: val = (cmp == 0); break;
+ case LT_EXPR: val = (cmp >= 0); break;
+ case GT_EXPR: val = (cmp <= 0); break;
+ case LE_EXPR: val = (cmp > 0); break;
+ case GE_EXPR: val = (cmp < 0); break;
+ default:
+ val = false;
+ }
+ if (val)
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ }
+ else if (code2 == NE_EXPR)
+ {
+ bool val;
+ switch (code1)
+ {
+ case EQ_EXPR: val = (cmp == 0); break;
+ case NE_EXPR: val = (cmp != 0); break;
+ case LT_EXPR: val = (cmp <= 0); break;
+ case GT_EXPR: val = (cmp >= 0); break;
+ case LE_EXPR: val = (cmp < 0); break;
+ case GE_EXPR: val = (cmp > 0); break;
+ default:
+ val = false;
+ }
+ if (val)
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ }
+
+ /* Chose the more restrictive of two < or <= comparisons. */
+ else if ((code1 == LT_EXPR || code1 == LE_EXPR)
+ && (code2 == LT_EXPR || code2 == LE_EXPR))
+ {
+ if ((cmp < 0) || (cmp == 0 && code1 == LT_EXPR))
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ else
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ }
+
+ /* Likewise chose the more restrictive of two > or >= comparisons. */
+ else if ((code1 == GT_EXPR || code1 == GE_EXPR)
+ && (code2 == GT_EXPR || code2 == GE_EXPR))
+ {
+ if ((cmp > 0) || (cmp == 0 && code1 == GT_EXPR))
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ else
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ }
+
+ /* Check for singleton ranges. */
+ else if (cmp == 0
+ && ((code1 == LE_EXPR && code2 == GE_EXPR)
+ || (code1 == GE_EXPR && code2 == LE_EXPR)))
+ return fold_build2 (EQ_EXPR, boolean_type_node, op1a, op2b);
+
+ /* Check for disjoint ranges. */
+ else if (cmp <= 0
+ && (code1 == LT_EXPR || code1 == LE_EXPR)
+ && (code2 == GT_EXPR || code2 == GE_EXPR))
+ return boolean_false_node;
+ else if (cmp >= 0
+ && (code1 == GT_EXPR || code1 == GE_EXPR)
+ && (code2 == LT_EXPR || code2 == LE_EXPR))
+ return boolean_false_node;
+ }
+
+ /* Perhaps the first comparison is (NAME != 0) or (NAME == 1) where
+ NAME's definition is a truth value. See if there are any simplifications
+ that can be done against the NAME's definition. */
+ if (TREE_CODE (op1a) == SSA_NAME
+ && (code1 == NE_EXPR || code1 == EQ_EXPR)
+ && (integer_zerop (op1b) || integer_onep (op1b)))
+ {
+ bool invert = ((code1 == EQ_EXPR && integer_zerop (op1b))
+ || (code1 == NE_EXPR && integer_onep (op1b)));
+ gimple stmt = SSA_NAME_DEF_STMT (op1a);
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ /* Try to simplify by copy-propagating the definition. */
+ return and_var_with_comparison (op1a, invert, code2, op2a, op2b);
+
+ case GIMPLE_PHI:
+ /* If every argument to the PHI produces the same result when
+ ANDed with the second comparison, we win.
+ Do not do this unless the type is bool since we need a bool
+ result here anyway. */
+ if (TREE_CODE (TREE_TYPE (op1a)) == BOOLEAN_TYPE)
+ {
+ tree result = NULL_TREE;
+ unsigned i;
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
+ {
+ tree arg = gimple_phi_arg_def (stmt, i);
+
+ /* If this PHI has itself as an argument, ignore it.
+ If all the other args produce the same result,
+ we're still OK. */
+ if (arg == gimple_phi_result (stmt))
+ continue;
+ else if (TREE_CODE (arg) == INTEGER_CST)
+ {
+ if (invert ? integer_nonzerop (arg) : integer_zerop (arg))
+ {
+ if (!result)
+ result = boolean_false_node;
+ else if (!integer_zerop (result))
+ return NULL_TREE;
+ }
+ else if (!result)
+ result = fold_build2 (code2, boolean_type_node,
+ op2a, op2b);
+ else if (!same_bool_comparison_p (result,
+ code2, op2a, op2b))
+ return NULL_TREE;
+ }
+ else if (TREE_CODE (arg) == SSA_NAME)
+ {
+ tree temp = and_var_with_comparison (arg, invert,
+ code2, op2a, op2b);
+ if (!temp)
+ return NULL_TREE;
+ else if (!result)
+ result = temp;
+ else if (!same_bool_result_p (result, temp))
+ return NULL_TREE;
+ }
+ else
+ return NULL_TREE;
+ }
+ return result;
+ }
+
+ default:
+ break;
+ }
+ }
+ return NULL_TREE;
+}
+
+/* Try to simplify the AND of two comparisons, specified by
+ (OP1A CODE1 OP1B) and (OP2B CODE2 OP2B), respectively.
+ If this can be simplified to a single expression (without requiring
+ introducing more SSA variables to hold intermediate values),
+ return the resulting tree. Otherwise return NULL_TREE.
+ If the result expression is non-null, it has boolean type. */
+
+tree
+maybe_fold_and_comparisons (enum tree_code code1, tree op1a, tree op1b,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ tree t = and_comparisons_1 (code1, op1a, op1b, code2, op2a, op2b);
+ if (t)
+ return t;
+ else
+ return and_comparisons_1 (code2, op2a, op2b, code1, op1a, op1b);
+}
+
+/* Helper function for or_comparisons_1: try to simplify the OR of the
+ ssa variable VAR with the comparison specified by (OP2A CODE2 OP2B).
+ If INVERT is true, invert the value of VAR before doing the OR.
+ Return NULL_EXPR if we can't simplify this to a single expression. */
+
+static tree
+or_var_with_comparison (tree var, bool invert,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ tree t;
+ gimple stmt = SSA_NAME_DEF_STMT (var);
+
+ /* We can only deal with variables whose definitions are assignments. */
+ if (!is_gimple_assign (stmt))
+ return NULL_TREE;
+
+ /* If we have an inverted comparison, apply DeMorgan's law and rewrite
+ !var OR (op2a code2 op2b) => !(var AND !(op2a code2 op2b))
+ Then we only have to consider the simpler non-inverted cases. */
+ if (invert)
+ t = and_var_with_comparison_1 (stmt,
+ invert_tree_comparison (code2, false),
+ op2a, op2b);
+ else
+ t = or_var_with_comparison_1 (stmt, code2, op2a, op2b);
+ return canonicalize_bool (t, invert);
+}
+
+/* Try to simplify the OR of the ssa variable defined by the assignment
+ STMT with the comparison specified by (OP2A CODE2 OP2B).
+ Return NULL_EXPR if we can't simplify this to a single expression. */
+
+static tree
+or_var_with_comparison_1 (gimple stmt,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ tree var = gimple_assign_lhs (stmt);
+ tree true_test_var = NULL_TREE;
+ tree false_test_var = NULL_TREE;
+ enum tree_code innercode = gimple_assign_rhs_code (stmt);
+
+ /* Check for identities like (var OR (var != 0)) => true . */
+ if (TREE_CODE (op2a) == SSA_NAME
+ && TREE_CODE (TREE_TYPE (var)) == BOOLEAN_TYPE)
+ {
+ if ((code2 == NE_EXPR && integer_zerop (op2b))
+ || (code2 == EQ_EXPR && integer_nonzerop (op2b)))
+ {
+ true_test_var = op2a;
+ if (var == true_test_var)
+ return var;
+ }
+ else if ((code2 == EQ_EXPR && integer_zerop (op2b))
+ || (code2 == NE_EXPR && integer_nonzerop (op2b)))
+ {
+ false_test_var = op2a;
+ if (var == false_test_var)
+ return boolean_true_node;
+ }
+ }
+
+ /* If the definition is a comparison, recurse on it. */
+ if (TREE_CODE_CLASS (innercode) == tcc_comparison)
+ {
+ tree t = or_comparisons_1 (innercode,
+ gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ code2,
+ op2a,
+ op2b);
+ if (t)
+ return t;
+ }
+
+ /* If the definition is an AND or OR expression, we may be able to
+ simplify by reassociating. */
+ if (innercode == TRUTH_AND_EXPR
+ || innercode == TRUTH_OR_EXPR
+ || (TREE_CODE (TREE_TYPE (var)) == BOOLEAN_TYPE
+ && (innercode == BIT_AND_EXPR || innercode == BIT_IOR_EXPR)))
+ {
+ tree inner1 = gimple_assign_rhs1 (stmt);
+ tree inner2 = gimple_assign_rhs2 (stmt);
+ gimple s;
+ tree t;
+ tree partial = NULL_TREE;
+ bool is_or = (innercode == TRUTH_OR_EXPR || innercode == BIT_IOR_EXPR);
+
+ /* Check for boolean identities that don't require recursive examination
+ of inner1/inner2:
+ inner1 OR (inner1 OR inner2) => inner1 OR inner2 => var
+ inner1 OR (inner1 AND inner2) => inner1
+ !inner1 OR (inner1 OR inner2) => true
+ !inner1 OR (inner1 AND inner2) => !inner1 OR inner2
+ */
+ if (inner1 == true_test_var)
+ return (is_or ? var : inner1);
+ else if (inner2 == true_test_var)
+ return (is_or ? var : inner2);
+ else if (inner1 == false_test_var)
+ return (is_or
+ ? boolean_true_node
+ : or_var_with_comparison (inner2, false, code2, op2a, op2b));
+ else if (inner2 == false_test_var)
+ return (is_or
+ ? boolean_true_node
+ : or_var_with_comparison (inner1, false, code2, op2a, op2b));
+
+ /* Next, redistribute/reassociate the OR across the inner tests.
+ Compute the first partial result, (inner1 OR (op2a code op2b)) */
+ if (TREE_CODE (inner1) == SSA_NAME
+ && is_gimple_assign (s = SSA_NAME_DEF_STMT (inner1))
+ && TREE_CODE_CLASS (gimple_assign_rhs_code (s)) == tcc_comparison
+ && (t = maybe_fold_or_comparisons (gimple_assign_rhs_code (s),
+ gimple_assign_rhs1 (s),
+ gimple_assign_rhs2 (s),
+ code2, op2a, op2b)))
+ {
+ /* Handle the OR case, where we are reassociating:
+ (inner1 OR inner2) OR (op2a code2 op2b)
+ => (t OR inner2)
+ If the partial result t is a constant, we win. Otherwise
+ continue on to try reassociating with the other inner test. */
+ if (innercode == TRUTH_OR_EXPR)
+ {
+ if (integer_onep (t))
+ return boolean_true_node;
+ else if (integer_zerop (t))
+ return inner2;
+ }
+
+ /* Handle the AND case, where we are redistributing:
+ (inner1 AND inner2) OR (op2a code2 op2b)
+ => (t AND (inner2 OR (op2a code op2b))) */
+ else
+ {
+ if (integer_zerop (t))
+ return boolean_false_node;
+ else
+ /* Save partial result for later. */
+ partial = t;
+ }
+ }
+
+ /* Compute the second partial result, (inner2 OR (op2a code op2b)) */
+ if (TREE_CODE (inner2) == SSA_NAME
+ && is_gimple_assign (s = SSA_NAME_DEF_STMT (inner2))
+ && TREE_CODE_CLASS (gimple_assign_rhs_code (s)) == tcc_comparison
+ && (t = maybe_fold_or_comparisons (gimple_assign_rhs_code (s),
+ gimple_assign_rhs1 (s),
+ gimple_assign_rhs2 (s),
+ code2, op2a, op2b)))
+ {
+ /* Handle the OR case, where we are reassociating:
+ (inner1 OR inner2) OR (op2a code2 op2b)
+ => (inner1 OR t) */
+ if (innercode == TRUTH_OR_EXPR)
+ {
+ if (integer_zerop (t))
+ return inner1;
+ else if (integer_onep (t))
+ return boolean_true_node;
+ }
+
+ /* Handle the AND case, where we are redistributing:
+ (inner1 AND inner2) OR (op2a code2 op2b)
+ => (t AND (inner1 OR (op2a code2 op2b)))
+ => (t AND partial) */
+ else
+ {
+ if (integer_zerop (t))
+ return boolean_false_node;
+ else if (partial)
+ {
+ /* We already got a simplification for the other
+ operand to the redistributed AND expression. The
+ interesting case is when at least one is true.
+ Or, if both are the same, we can apply the identity
+ (x AND x) == true. */
+ if (integer_onep (partial))
+ return t;
+ else if (integer_onep (t))
+ return partial;
+ else if (same_bool_result_p (t, partial))
+ return boolean_true_node;
+ }
+ }
+ }
+ }
+ return NULL_TREE;
+}
+
+/* Try to simplify the OR of two comparisons defined by
+ (OP1A CODE1 OP1B) and (OP2A CODE2 OP2B), respectively.
+ If this can be done without constructing an intermediate value,
+ return the resulting tree; otherwise NULL_TREE is returned.
+ This function is deliberately asymmetric as it recurses on SSA_DEFs
+ in the first comparison but not the second. */
+
+static tree
+or_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ /* First check for ((x CODE1 y) OR (x CODE2 y)). */
+ if (operand_equal_p (op1a, op2a, 0)
+ && operand_equal_p (op1b, op2b, 0))
+ {
+ tree t = combine_comparisons (UNKNOWN_LOCATION,
+ TRUTH_ORIF_EXPR, code1, code2,
+ boolean_type_node, op1a, op1b);
+ if (t)
+ return t;
+ }
+
+ /* Likewise the swapped case of the above. */
+ if (operand_equal_p (op1a, op2b, 0)
+ && operand_equal_p (op1b, op2a, 0))
+ {
+ tree t = combine_comparisons (UNKNOWN_LOCATION,
+ TRUTH_ORIF_EXPR, code1,
+ swap_tree_comparison (code2),
+ boolean_type_node, op1a, op1b);
+ if (t)
+ return t;
+ }
+
+ /* If both comparisons are of the same value against constants, we might
+ be able to merge them. */
+ if (operand_equal_p (op1a, op2a, 0)
+ && TREE_CODE (op1b) == INTEGER_CST
+ && TREE_CODE (op2b) == INTEGER_CST)
+ {
+ int cmp = tree_int_cst_compare (op1b, op2b);
+
+ /* If we have (op1a != op1b), we should either be able to
+ return that or TRUE, depending on whether the constant op1b
+ also satisfies the other comparison against op2b. */
+ if (code1 == NE_EXPR)
+ {
+ bool done = true;
+ bool val;
+ switch (code2)
+ {
+ case EQ_EXPR: val = (cmp == 0); break;
+ case NE_EXPR: val = (cmp != 0); break;
+ case LT_EXPR: val = (cmp < 0); break;
+ case GT_EXPR: val = (cmp > 0); break;
+ case LE_EXPR: val = (cmp <= 0); break;
+ case GE_EXPR: val = (cmp >= 0); break;
+ default: done = false;
+ }
+ if (done)
+ {
+ if (val)
+ return boolean_true_node;
+ else
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ }
+ }
+ /* Likewise if the second comparison is a != comparison. */
+ else if (code2 == NE_EXPR)
+ {
+ bool done = true;
+ bool val;
+ switch (code1)
+ {
+ case EQ_EXPR: val = (cmp == 0); break;
+ case NE_EXPR: val = (cmp != 0); break;
+ case LT_EXPR: val = (cmp > 0); break;
+ case GT_EXPR: val = (cmp < 0); break;
+ case LE_EXPR: val = (cmp >= 0); break;
+ case GE_EXPR: val = (cmp <= 0); break;
+ default: done = false;
+ }
+ if (done)
+ {
+ if (val)
+ return boolean_true_node;
+ else
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ }
+ }
+
+ /* See if an equality test is redundant with the other comparison. */
+ else if (code1 == EQ_EXPR)
+ {
+ bool val;
+ switch (code2)
+ {
+ case EQ_EXPR: val = (cmp == 0); break;
+ case NE_EXPR: val = (cmp != 0); break;
+ case LT_EXPR: val = (cmp < 0); break;
+ case GT_EXPR: val = (cmp > 0); break;
+ case LE_EXPR: val = (cmp <= 0); break;
+ case GE_EXPR: val = (cmp >= 0); break;
+ default:
+ val = false;
+ }
+ if (val)
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ }
+ else if (code2 == EQ_EXPR)
+ {
+ bool val;
+ switch (code1)
+ {
+ case EQ_EXPR: val = (cmp == 0); break;
+ case NE_EXPR: val = (cmp != 0); break;
+ case LT_EXPR: val = (cmp > 0); break;
+ case GT_EXPR: val = (cmp < 0); break;
+ case LE_EXPR: val = (cmp >= 0); break;
+ case GE_EXPR: val = (cmp <= 0); break;
+ default:
+ val = false;
+ }
+ if (val)
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ }
+
+ /* Chose the less restrictive of two < or <= comparisons. */
+ else if ((code1 == LT_EXPR || code1 == LE_EXPR)
+ && (code2 == LT_EXPR || code2 == LE_EXPR))
+ {
+ if ((cmp < 0) || (cmp == 0 && code1 == LT_EXPR))
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ else
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ }
+
+ /* Likewise chose the less restrictive of two > or >= comparisons. */
+ else if ((code1 == GT_EXPR || code1 == GE_EXPR)
+ && (code2 == GT_EXPR || code2 == GE_EXPR))
+ {
+ if ((cmp > 0) || (cmp == 0 && code1 == GT_EXPR))
+ return fold_build2 (code2, boolean_type_node, op2a, op2b);
+ else
+ return fold_build2 (code1, boolean_type_node, op1a, op1b);
+ }
+
+ /* Check for singleton ranges. */
+ else if (cmp == 0
+ && ((code1 == LT_EXPR && code2 == GT_EXPR)
+ || (code1 == GT_EXPR && code2 == LT_EXPR)))
+ return fold_build2 (NE_EXPR, boolean_type_node, op1a, op2b);
+
+ /* Check for less/greater pairs that don't restrict the range at all. */
+ else if (cmp >= 0
+ && (code1 == LT_EXPR || code1 == LE_EXPR)
+ && (code2 == GT_EXPR || code2 == GE_EXPR))
+ return boolean_true_node;
+ else if (cmp <= 0
+ && (code1 == GT_EXPR || code1 == GE_EXPR)
+ && (code2 == LT_EXPR || code2 == LE_EXPR))
+ return boolean_true_node;
+ }
+
+ /* Perhaps the first comparison is (NAME != 0) or (NAME == 1) where
+ NAME's definition is a truth value. See if there are any simplifications
+ that can be done against the NAME's definition. */
+ if (TREE_CODE (op1a) == SSA_NAME
+ && (code1 == NE_EXPR || code1 == EQ_EXPR)
+ && (integer_zerop (op1b) || integer_onep (op1b)))
+ {
+ bool invert = ((code1 == EQ_EXPR && integer_zerop (op1b))
+ || (code1 == NE_EXPR && integer_onep (op1b)));
+ gimple stmt = SSA_NAME_DEF_STMT (op1a);
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ /* Try to simplify by copy-propagating the definition. */
+ return or_var_with_comparison (op1a, invert, code2, op2a, op2b);
+
+ case GIMPLE_PHI:
+ /* If every argument to the PHI produces the same result when
+ ORed with the second comparison, we win.
+ Do not do this unless the type is bool since we need a bool
+ result here anyway. */
+ if (TREE_CODE (TREE_TYPE (op1a)) == BOOLEAN_TYPE)
+ {
+ tree result = NULL_TREE;
+ unsigned i;
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
+ {
+ tree arg = gimple_phi_arg_def (stmt, i);
+
+ /* If this PHI has itself as an argument, ignore it.
+ If all the other args produce the same result,
+ we're still OK. */
+ if (arg == gimple_phi_result (stmt))
+ continue;
+ else if (TREE_CODE (arg) == INTEGER_CST)
+ {
+ if (invert ? integer_zerop (arg) : integer_nonzerop (arg))
+ {
+ if (!result)
+ result = boolean_true_node;
+ else if (!integer_onep (result))
+ return NULL_TREE;
+ }
+ else if (!result)
+ result = fold_build2 (code2, boolean_type_node,
+ op2a, op2b);
+ else if (!same_bool_comparison_p (result,
+ code2, op2a, op2b))
+ return NULL_TREE;
+ }
+ else if (TREE_CODE (arg) == SSA_NAME)
+ {
+ tree temp = or_var_with_comparison (arg, invert,
+ code2, op2a, op2b);
+ if (!temp)
+ return NULL_TREE;
+ else if (!result)
+ result = temp;
+ else if (!same_bool_result_p (result, temp))
+ return NULL_TREE;
+ }
+ else
+ return NULL_TREE;
+ }
+ return result;
+ }
+
+ default:
+ break;
+ }
+ }
+ return NULL_TREE;
+}
+
+/* Try to simplify the OR of two comparisons, specified by
+ (OP1A CODE1 OP1B) and (OP2B CODE2 OP2B), respectively.
+ If this can be simplified to a single expression (without requiring
+ introducing more SSA variables to hold intermediate values),
+ return the resulting tree. Otherwise return NULL_TREE.
+ If the result expression is non-null, it has boolean type. */
+
+tree
+maybe_fold_or_comparisons (enum tree_code code1, tree op1a, tree op1b,
+ enum tree_code code2, tree op2a, tree op2b)
+{
+ tree t = or_comparisons_1 (code1, op1a, op1b, code2, op2a, op2b);
+ if (t)
+ return t;
+ else
+ return or_comparisons_1 (code2, op2a, op2b, code1, op1a, op1b);
+}
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index be5171bfc28..1402c0d8c39 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -381,8 +381,12 @@ gsi_replace (gimple_stmt_iterator *gsi, gimple stmt, bool update_eh_info)
maybe_clean_or_replace_eh_stmt (orig_stmt, stmt);
gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);
+
+ /* Free all the data flow information for ORIG_STMT. */
+ gimple_set_bb (orig_stmt, NULL);
gimple_remove_stmt_histograms (cfun, orig_stmt);
delink_stmt_imm_use (orig_stmt);
+
*gsi_stmt_ptr (gsi) = stmt;
gimple_set_modified (stmt, true);
update_modified_stmt (stmt);
@@ -404,7 +408,7 @@ gsi_insert_before_without_update (gimple_stmt_iterator *i, gimple stmt,
{
gimple_seq_node n;
- n = GGC_NEW (struct gimple_seq_node_d);
+ n = ggc_alloc_gimple_seq_node_d ();
n->prev = n->next = NULL;
n->stmt = stmt;
gsi_insert_seq_nodes_before (i, n, n, m);
@@ -439,7 +443,7 @@ gsi_insert_after_without_update (gimple_stmt_iterator *i, gimple stmt,
{
gimple_seq_node n;
- n = GGC_NEW (struct gimple_seq_node_d);
+ n = ggc_alloc_gimple_seq_node_d ();
n->prev = n->next = NULL;
n->stmt = stmt;
gsi_insert_seq_nodes_after (i, n, n, m);
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index bf3bb723943..491eae3b51b 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -377,6 +377,34 @@ dump_binary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
}
}
+/* Helper for dump_gimple_assign. Print the ternary RHS of the
+ assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
+
+static void
+dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ const char *p;
+ enum tree_code code = gimple_assign_rhs_code (gs);
+ switch (code)
+ {
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
+ for (p = tree_code_name [(int) code]; *p; p++)
+ pp_character (buffer, TOUPPER (*p));
+ pp_string (buffer, " <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_character (buffer, '>');
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
dump_gimple_stmt. */
@@ -419,6 +447,8 @@ dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags)
dump_unary_rhs (buffer, gs, spc, flags);
else if (gimple_num_ops (gs) == 3)
dump_binary_rhs (buffer, gs, spc, flags);
+ else if (gimple_num_ops (gs) == 4)
+ dump_ternary_rhs (buffer, gs, spc, flags);
else
gcc_unreachable ();
if (!(flags & TDF_RHS_ONLY))
diff --git a/gcc/gimple.c b/gcc/gimple.c
index f4c57b2861c..2359e0e954a 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -145,7 +145,7 @@ gimple_alloc_stat (enum gimple_code code, unsigned num_ops MEM_STAT_DECL)
}
#endif
- stmt = (gimple) ggc_alloc_cleared_stat (size PASS_MEM_STAT);
+ stmt = ggc_alloc_cleared_gimple_statement_d_stat (size PASS_MEM_STAT);
gimple_set_code (stmt, code);
gimple_set_num_ops (stmt, num_ops);
@@ -305,31 +305,40 @@ gimple_build_call_from_tree (tree t)
/* Extract the operands and code for expression EXPR into *SUBCODE_P,
- *OP1_P and *OP2_P respectively. */
+ *OP1_P, *OP2_P and *OP3_P respectively. */
void
-extract_ops_from_tree (tree expr, enum tree_code *subcode_p, tree *op1_p,
- tree *op2_p)
+extract_ops_from_tree_1 (tree expr, enum tree_code *subcode_p, tree *op1_p,
+ tree *op2_p, tree *op3_p)
{
enum gimple_rhs_class grhs_class;
*subcode_p = TREE_CODE (expr);
grhs_class = get_gimple_rhs_class (*subcode_p);
- if (grhs_class == GIMPLE_BINARY_RHS)
+ if (grhs_class == GIMPLE_TERNARY_RHS)
{
*op1_p = TREE_OPERAND (expr, 0);
*op2_p = TREE_OPERAND (expr, 1);
+ *op3_p = TREE_OPERAND (expr, 2);
+ }
+ else if (grhs_class == GIMPLE_BINARY_RHS)
+ {
+ *op1_p = TREE_OPERAND (expr, 0);
+ *op2_p = TREE_OPERAND (expr, 1);
+ *op3_p = NULL_TREE;
}
else if (grhs_class == GIMPLE_UNARY_RHS)
{
*op1_p = TREE_OPERAND (expr, 0);
*op2_p = NULL_TREE;
+ *op3_p = NULL_TREE;
}
else if (grhs_class == GIMPLE_SINGLE_RHS)
{
*op1_p = expr;
*op2_p = NULL_TREE;
+ *op3_p = NULL_TREE;
}
else
gcc_unreachable ();
@@ -345,10 +354,10 @@ gimple
gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
{
enum tree_code subcode;
- tree op1, op2;
+ tree op1, op2, op3;
- extract_ops_from_tree (rhs, &subcode, &op1, &op2);
- return gimple_build_assign_with_ops_stat (subcode, lhs, op1, op2
+ extract_ops_from_tree_1 (rhs, &subcode, &op1, &op2, &op3);
+ return gimple_build_assign_with_ops_stat (subcode, lhs, op1, op2, op3
PASS_MEM_STAT);
}
@@ -359,7 +368,7 @@ gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
gimple
gimple_build_assign_with_ops_stat (enum tree_code subcode, tree lhs, tree op1,
- tree op2 MEM_STAT_DECL)
+ tree op2, tree op3 MEM_STAT_DECL)
{
unsigned num_ops;
gimple p;
@@ -378,6 +387,12 @@ gimple_build_assign_with_ops_stat (enum tree_code subcode, tree lhs, tree op1,
gimple_assign_set_rhs2 (p, op2);
}
+ if (op3)
+ {
+ gcc_assert (num_ops > 3);
+ gimple_assign_set_rhs3 (p, op3);
+ }
+
return p;
}
@@ -824,7 +839,8 @@ gimple_build_omp_for (gimple_seq body, tree clauses, size_t collapse,
gimple_omp_set_body (p, body);
gimple_omp_for_set_clauses (p, clauses);
p->gimple_omp_for.collapse = collapse;
- p->gimple_omp_for.iter = GGC_CNEWVEC (struct gimple_omp_for_iter, collapse);
+ p->gimple_omp_for.iter
+ = ggc_alloc_cleared_vec_gimple_omp_for_iter (collapse);
if (pre_body)
gimple_omp_for_set_pre_body (p, pre_body);
@@ -1074,7 +1090,7 @@ gimple_seq_alloc (void)
}
else
{
- seq = (gimple_seq) ggc_alloc_cleared (sizeof (*seq));
+ seq = ggc_alloc_cleared_gimple_seq_d ();
#ifdef GATHER_STATISTICS
gimple_alloc_counts[(int) gimple_alloc_kind_seq]++;
gimple_alloc_sizes[(int) gimple_alloc_kind_seq] += sizeof (*seq);
@@ -1954,22 +1970,22 @@ void
gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *gsi, tree expr)
{
enum tree_code subcode;
- tree op1, op2;
+ tree op1, op2, op3;
- extract_ops_from_tree (expr, &subcode, &op1, &op2);
- gimple_assign_set_rhs_with_ops (gsi, subcode, op1, op2);
+ extract_ops_from_tree_1 (expr, &subcode, &op1, &op2, &op3);
+ gimple_assign_set_rhs_with_ops_1 (gsi, subcode, op1, op2, op3);
}
/* Set the RHS of assignment statement pointed-to by GSI to CODE with
- operands OP1 and OP2.
+ operands OP1, OP2 and OP3.
NOTE: The statement pointed-to by GSI may be reallocated if it
did not have enough operand slots. */
void
-gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
- tree op1, tree op2)
+gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *gsi, enum tree_code code,
+ tree op1, tree op2, tree op3)
{
unsigned new_rhs_ops = get_gimple_rhs_num_ops (code);
gimple stmt = gsi_stmt (*gsi);
@@ -1993,6 +2009,8 @@ gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
gimple_assign_set_rhs1 (stmt, op1);
if (new_rhs_ops > 1)
gimple_assign_set_rhs2 (stmt, op2);
+ if (new_rhs_ops > 2)
+ gimple_assign_set_rhs3 (stmt, op3);
}
@@ -2122,8 +2140,8 @@ gimple_copy (gimple stmt)
t = unshare_expr (gimple_omp_for_clauses (stmt));
gimple_omp_for_set_clauses (copy, t);
copy->gimple_omp_for.iter
- = GGC_NEWVEC (struct gimple_omp_for_iter,
- gimple_omp_for_collapse (stmt));
+ = ggc_alloc_vec_gimple_omp_for_iter
+ (gimple_omp_for_collapse (stmt));
for (i = 0; i < gimple_omp_for_collapse (stmt); i++)
{
gimple_omp_for_set_cond (copy, i,
@@ -2472,6 +2490,8 @@ get_gimple_rhs_num_ops (enum tree_code code)
return 1;
else if (rhs_class == GIMPLE_BINARY_RHS)
return 2;
+ else if (rhs_class == GIMPLE_TERNARY_RHS)
+ return 3;
else
gcc_unreachable ();
}
@@ -2488,6 +2508,8 @@ get_gimple_rhs_num_ops (enum tree_code code)
|| (SYM) == TRUTH_OR_EXPR \
|| (SYM) == TRUTH_XOR_EXPR) ? GIMPLE_BINARY_RHS \
: (SYM) == TRUTH_NOT_EXPR ? GIMPLE_UNARY_RHS \
+ : ((SYM) == WIDEN_MULT_PLUS_EXPR \
+ || (SYM) == WIDEN_MULT_MINUS_EXPR) ? GIMPLE_TERNARY_RHS \
: ((SYM) == COND_EXPR \
|| (SYM) == CONSTRUCTOR \
|| (SYM) == OBJ_TYPE_REF \
@@ -2573,7 +2595,8 @@ is_gimple_condexpr (tree t)
bool
is_gimple_addressable (tree t)
{
- return (is_gimple_id (t) || handled_component_p (t) || INDIRECT_REF_P (t));
+ return (is_gimple_id (t) || handled_component_p (t)
+ || TREE_CODE (t) == MEM_REF);
}
/* Return true if T is a valid gimple constant. */
@@ -2624,7 +2647,7 @@ is_gimple_address (const_tree t)
op = TREE_OPERAND (op, 0);
}
- if (CONSTANT_CLASS_P (op) || INDIRECT_REF_P (op))
+ if (CONSTANT_CLASS_P (op) || TREE_CODE (op) == MEM_REF)
return true;
switch (TREE_CODE (op))
@@ -2684,8 +2707,18 @@ is_gimple_invariant_address (const_tree t)
return false;
op = strip_invariant_refs (TREE_OPERAND (t, 0));
+ if (!op)
+ return false;
+
+ if (TREE_CODE (op) == MEM_REF)
+ {
+ const_tree op0 = TREE_OPERAND (op, 0);
+ return (TREE_CODE (op0) == ADDR_EXPR
+ && (CONSTANT_CLASS_P (TREE_OPERAND (op0, 0))
+ || decl_address_invariant_p (TREE_OPERAND (op0, 0))));
+ }
- return op && (CONSTANT_CLASS_P (op) || decl_address_invariant_p (op));
+ return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op);
}
/* Return true if T is a gimple invariant address at IPA level
@@ -2902,7 +2935,7 @@ is_gimple_min_lval (tree t)
{
if (!(t = CONST_CAST_TREE (strip_invariant_refs (t))))
return false;
- return (is_gimple_id (t) || TREE_CODE (t) == INDIRECT_REF);
+ return (is_gimple_id (t) || TREE_CODE (t) == MEM_REF);
}
/* Return true if T is a typecast operation. */
@@ -2922,6 +2955,18 @@ is_gimple_call_addr (tree t)
return (TREE_CODE (t) == OBJ_TYPE_REF || is_gimple_val (t));
}
+/* Return true if T is a valid address operand of a MEM_REF. */
+
+bool
+is_gimple_mem_ref_addr (tree t)
+{
+ return (is_gimple_reg (t)
+ || TREE_CODE (t) == INTEGER_CST
+ || (TREE_CODE (t) == ADDR_EXPR
+ && (CONSTANT_CLASS_P (TREE_OPERAND (t, 0))
+ || decl_address_invariant_p (TREE_OPERAND (t, 0)))));
+}
+
/* If T makes a function call, return the corresponding CALL_EXPR operand.
Otherwise, return NULL_TREE. */
@@ -2953,10 +2998,15 @@ get_base_address (tree t)
while (handled_component_p (t))
t = TREE_OPERAND (t, 0);
+ if (TREE_CODE (t) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR)
+ t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
+
if (SSA_VAR_P (t)
|| TREE_CODE (t) == STRING_CST
|| TREE_CODE (t) == CONSTRUCTOR
- || INDIRECT_REF_P (t))
+ || INDIRECT_REF_P (t)
+ || TREE_CODE (t) == MEM_REF)
return t;
else
return NULL_TREE;
@@ -3084,14 +3134,8 @@ gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
gimple_set_block (new_stmt, gimple_block (stmt));
if (gimple_has_location (stmt))
gimple_set_location (new_stmt, gimple_location (stmt));
-
- /* Carry all the flags to the new GIMPLE_CALL. */
+ gimple_call_copy_flags (new_stmt, stmt);
gimple_call_set_chain (new_stmt, gimple_call_chain (stmt));
- gimple_call_set_tail (new_stmt, gimple_call_tail_p (stmt));
- gimple_call_set_cannot_inline (new_stmt, gimple_call_cannot_inline_p (stmt));
- gimple_call_set_return_slot_opt (new_stmt, gimple_call_return_slot_opt_p (stmt));
- gimple_call_set_from_thunk (new_stmt, gimple_call_from_thunk_p (stmt));
- gimple_call_set_va_arg_pack (new_stmt, gimple_call_va_arg_pack_p (stmt));
gimple_set_modified (new_stmt, true);
@@ -3592,12 +3636,6 @@ gimple_types_compatible_p (tree t1, tree t2)
{
tree f1, f2;
- /* If one type requires structural equality checks and the
- other doesn't, do not merge the types. */
- if (TYPE_STRUCTURAL_EQUALITY_P (t1)
- != TYPE_STRUCTURAL_EQUALITY_P (t2))
- goto different_types;
-
/* The struct tags shall compare equal. */
if (!compare_type_names_p (TYPE_MAIN_VARIANT (t1),
TYPE_MAIN_VARIANT (t2), false))
@@ -3954,6 +3992,11 @@ gimple_register_type (tree t)
gcc_assert (TYPE_P (t));
+ /* In TYPE_CANONICAL we cache the result of gimple_register_type.
+ It is initially set to NULL during LTO streaming. */
+ if (TYPE_CANONICAL (t))
+ return TYPE_CANONICAL (t);
+
/* Always register the main variant first. This is important so we
pick up the non-typedef variants as canonical, otherwise we'll end
up taking typedef ids for structure tags during comparison. */
@@ -4017,10 +4060,14 @@ gimple_register_type (tree t)
TYPE_NEXT_REF_TO (t) = NULL_TREE;
}
+ TYPE_CANONICAL (t) = new_type;
t = new_type;
}
else
- *slot = (void *) t;
+ {
+ TYPE_CANONICAL (t) = t;
+ *slot = (void *) t;
+ }
return t;
}
@@ -4399,7 +4446,7 @@ count_ptr_derefs (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
- if (INDIRECT_REF_P (*tp) && TREE_OPERAND (*tp, 0) == count_p->ptr)
+ if (TREE_CODE (*tp) == MEM_REF && TREE_OPERAND (*tp, 0) == count_p->ptr)
{
if (wi_p->is_lhs)
count_p->num_stores++;
@@ -4472,6 +4519,7 @@ get_base_loadstore (tree op)
op = TREE_OPERAND (op, 0);
if (DECL_P (op)
|| INDIRECT_REF_P (op)
+ || TREE_CODE (op) == MEM_REF
|| TREE_CODE (op) == TARGET_MEM_REF)
return op;
return NULL_TREE;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 1a4dacd2331..7d2289b5ddd 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -33,6 +33,10 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-operands.h"
#include "tree-ssa-alias.h"
+struct gimple_seq_node_d;
+typedef struct gimple_seq_node_d *gimple_seq_node;
+typedef const struct gimple_seq_node_d *const_gimple_seq_node;
+
/* For each block, the PHI nodes that need to be rewritten are stored into
these vectors. */
typedef VEC(gimple, heap) *gimple_vec;
@@ -51,6 +55,7 @@ extern const unsigned char gimple_rhs_class_table[];
/* Error out if a gimple tuple is addressed incorrectly. */
#if defined ENABLE_GIMPLE_CHECKING
+#define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
extern void gimple_check_failed (const_gimple, const char *, int, \
const char *, enum gimple_code, \
enum tree_code) ATTRIBUTE_NORETURN;
@@ -63,6 +68,7 @@ extern void gimple_check_failed (const_gimple, const char *, int, \
(CODE), ERROR_MARK); \
} while (0)
#else /* not ENABLE_GIMPLE_CHECKING */
+#define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
#define GIMPLE_CHECK(GS, CODE) (void)0
#endif
@@ -71,6 +77,7 @@ extern void gimple_check_failed (const_gimple, const char *, int, \
enum gimple_rhs_class
{
GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
+ GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
@@ -244,7 +251,7 @@ bb_seq (const_basic_block bb)
static inline void
set_bb_seq (basic_block bb, gimple_seq seq)
{
- gcc_assert (!(bb->flags & BB_RTL));
+ gcc_checking_assert (!(bb->flags & BB_RTL));
bb->il.gimple->seq = seq;
}
@@ -752,7 +759,7 @@ enum gimple_statement_structure_enum {
/* Define the overall contents of a gimple tuple. It may be any of the
structures declared above for various types of tuples. */
-union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d {
+union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
@@ -797,12 +804,14 @@ gimple gimple_build_return (tree);
gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
#define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
-void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
+void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
- tree MEM_STAT_DECL);
-#define gimple_build_assign_with_ops(c,o1,o2,o3) \
- gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
+ tree, tree MEM_STAT_DECL);
+#define gimple_build_assign_with_ops(c,o1,o2,o3) \
+ gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
+#define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
+ gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
#define gimple_build_debug_bind(var,val,stmt) \
@@ -864,8 +873,8 @@ bool gimple_assign_single_p (gimple);
bool gimple_assign_unary_nop_p (gimple);
void gimple_set_bb (gimple, struct basic_block_def *);
void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
-void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
- tree, tree);
+void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
+ tree, tree, tree);
tree gimple_get_lhs (const_gimple);
void gimple_set_lhs (gimple, tree);
void gimple_replace_lhs (gimple, tree);
@@ -924,6 +933,8 @@ extern bool is_gimple_ip_invariant (const_tree);
extern bool is_gimple_val (tree);
/* Returns true iff T is a GIMPLE asm statement input. */
extern bool is_gimple_asm_val (tree);
+/* Returns true iff T is a valid address operand of a MEM_REF. */
+bool is_gimple_mem_ref_addr (tree);
/* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
GIMPLE temporary, a renamed user variable, or something else,
respectively. */
@@ -1084,9 +1095,7 @@ gimple_code (const_gimple g)
static inline enum gimple_statement_structure_enum
gss_for_code (enum gimple_code code)
{
-#ifdef ENABLE_CHECKING
- gcc_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
-#endif
+ gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
return gss_for_code_[code];
}
@@ -1326,7 +1335,7 @@ gimple_def_ops (const_gimple g)
static inline void
gimple_set_def_ops (gimple g, struct def_optype_d *def)
{
- gcc_assert (gimple_has_ops (g));
+ gcc_gimple_checking_assert (gimple_has_ops (g));
g->gsops.opbase.def_ops = def;
}
@@ -1347,7 +1356,7 @@ gimple_use_ops (const_gimple g)
static inline void
gimple_set_use_ops (gimple g, struct use_optype_d *use)
{
- gcc_assert (gimple_has_ops (g));
+ gcc_gimple_checking_assert (gimple_has_ops (g));
g->gsops.opbase.use_ops = use;
}
@@ -1428,7 +1437,7 @@ gimple_vdef_ptr (gimple g)
static inline void
gimple_set_vuse (gimple g, tree vuse)
{
- gcc_assert (gimple_has_mem_ops (g));
+ gcc_gimple_checking_assert (gimple_has_mem_ops (g));
g->gsmembase.vuse = vuse;
}
@@ -1437,7 +1446,7 @@ gimple_set_vuse (gimple g, tree vuse)
static inline void
gimple_set_vdef (gimple g, tree vdef)
{
- gcc_assert (gimple_has_mem_ops (g));
+ gcc_gimple_checking_assert (gimple_has_mem_ops (g));
g->gsmembase.vdef = vdef;
}
@@ -1464,10 +1473,11 @@ gimple_expr_code (const_gimple stmt)
enum gimple_code code = gimple_code (stmt);
if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
return (enum tree_code) stmt->gsbase.subcode;
- else if (code == GIMPLE_CALL)
- return CALL_EXPR;
else
- gcc_unreachable ();
+ {
+ gcc_gimple_checking_assert (code == GIMPLE_CALL);
+ return CALL_EXPR;
+ }
}
@@ -1528,7 +1538,7 @@ gimple_references_memory_p (gimple stmt)
static inline unsigned
gimple_omp_subcode (const_gimple s)
{
- gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
+ gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
&& gimple_code (s) <= GIMPLE_OMP_SINGLE);
return s->gsbase.subcode;
}
@@ -1540,7 +1550,7 @@ gimple_omp_set_subcode (gimple s, unsigned int subcode)
{
/* We only have 16 bits for the subcode. Assert that we are not
overflowing it. */
- gcc_assert (subcode < (1 << 16));
+ gcc_gimple_checking_assert (subcode < (1 << 16));
s->gsbase.subcode = subcode;
}
@@ -1640,7 +1650,7 @@ gimple_ops (gimple gs)
of the structure. Note that those structures that do not
have an operand vector have a zero offset. */
off = gimple_ops_offset_[gimple_statement_structure (gs)];
- gcc_assert (off != 0);
+ gcc_gimple_checking_assert (off != 0);
return (tree *) ((char *) gs + off);
}
@@ -1653,9 +1663,7 @@ gimple_op (const_gimple gs, unsigned i)
{
if (gimple_has_ops (gs))
{
-#ifdef ENABLE_CHECKING
- gcc_assert (i < gimple_num_ops (gs));
-#endif
+ gcc_gimple_checking_assert (i < gimple_num_ops (gs));
return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
}
else
@@ -1669,9 +1677,7 @@ gimple_op_ptr (const_gimple gs, unsigned i)
{
if (gimple_has_ops (gs))
{
-#ifdef ENABLE_CHECKING
- gcc_assert (i < gimple_num_ops (gs));
-#endif
+ gcc_gimple_checking_assert (i < gimple_num_ops (gs));
return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
}
else
@@ -1683,7 +1689,7 @@ gimple_op_ptr (const_gimple gs, unsigned i)
static inline void
gimple_set_op (gimple gs, unsigned i, tree op)
{
- gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
+ gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
/* Note. It may be tempting to assert that OP matches
is_gimple_operand, but that would be wrong. Different tuples
@@ -1809,6 +1815,63 @@ gimple_assign_set_rhs2 (gimple gs, tree rhs)
gimple_set_op (gs, 2, rhs);
}
+/* Return the third operand on the RHS of assignment statement GS.
+ If GS does not have two operands, NULL is returned instead. */
+
+static inline tree
+gimple_assign_rhs3 (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+
+ if (gimple_num_ops (gs) >= 4)
+ return gimple_op (gs, 3);
+ else
+ return NULL_TREE;
+}
+
+/* Return a pointer to the third operand on the RHS of assignment
+ statement GS. */
+
+static inline tree *
+gimple_assign_rhs3_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+ return gimple_op_ptr (gs, 3);
+}
+
+
+/* Set RHS to be the third operand on the RHS of assignment statement GS. */
+
+static inline void
+gimple_assign_set_rhs3 (gimple gs, tree rhs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
+
+ gimple_set_op (gs, 3, rhs);
+}
+
+/* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
+ to see only a maximum of two operands. */
+
+static inline void
+gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
+ tree op1, tree op2)
+{
+ gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
+}
+
+/* A wrapper around extract_ops_from_tree_1, for callers which expect
+ to see only a maximum of two operands. */
+
+static inline void
+extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
+ tree *op1)
+{
+ tree op2;
+ extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
+ gcc_assert (op2 == NULL_TREE);
+}
+
/* Returns true if GS is a nontemporal move. */
static inline bool
@@ -1976,7 +2039,18 @@ gimple_call_fndecl (const_gimple gs)
{
tree addr = gimple_call_fn (gs);
if (TREE_CODE (addr) == ADDR_EXPR)
- return TREE_OPERAND (addr, 0);
+ {
+ tree fndecl = TREE_OPERAND (addr, 0);
+ if (TREE_CODE (fndecl) == MEM_REF)
+ {
+ if (TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
+ && integer_zerop (TREE_OPERAND (fndecl, 1)))
+ return TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
+ else
+ return NULL_TREE;
+ }
+ return TREE_OPERAND (addr, 0);
+ }
return NULL_TREE;
}
@@ -2626,7 +2700,8 @@ static inline void
gimple_bind_set_block (gimple gs, tree block)
{
GIMPLE_CHECK (gs, GIMPLE_BIND);
- gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
+ gcc_gimple_checking_assert (block == NULL_TREE
+ || TREE_CODE (block) == BLOCK);
gs->gimple_bind.block = block;
}
@@ -2675,7 +2750,7 @@ static inline tree
gimple_asm_input_op (const_gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.ni);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
return gimple_op (gs, index);
}
@@ -2685,7 +2760,7 @@ static inline tree *
gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.ni);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
return gimple_op_ptr (gs, index);
}
@@ -2696,8 +2771,8 @@ static inline void
gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.ni);
- gcc_assert (TREE_CODE (in_op) == TREE_LIST);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
+ && TREE_CODE (in_op) == TREE_LIST);
gimple_set_op (gs, index, in_op);
}
@@ -2708,7 +2783,7 @@ static inline tree
gimple_asm_output_op (const_gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.no);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
return gimple_op (gs, index + gs->gimple_asm.ni);
}
@@ -2718,7 +2793,7 @@ static inline tree *
gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.no);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
}
@@ -2729,8 +2804,8 @@ static inline void
gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.no);
- gcc_assert (TREE_CODE (out_op) == TREE_LIST);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.no
+ && TREE_CODE (out_op) == TREE_LIST);
gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
}
@@ -2741,7 +2816,7 @@ static inline tree
gimple_asm_clobber_op (const_gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.nc);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
}
@@ -2752,8 +2827,8 @@ static inline void
gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.nc);
- gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
+ && TREE_CODE (clobber_op) == TREE_LIST);
gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
}
@@ -2763,7 +2838,7 @@ static inline tree
gimple_asm_label_op (const_gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.nl);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
}
@@ -2773,8 +2848,8 @@ static inline void
gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
{
GIMPLE_CHECK (gs, GIMPLE_ASM);
- gcc_assert (index <= gs->gimple_asm.nl);
- gcc_assert (TREE_CODE (label_op) == TREE_LIST);
+ gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
+ && TREE_CODE (label_op) == TREE_LIST);
gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
}
@@ -2987,7 +3062,8 @@ static inline void
gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
{
GIMPLE_CHECK (gs, GIMPLE_TRY);
- gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
+ gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
+ || kind == GIMPLE_TRY_FINALLY);
if (gimple_try_kind (gs) != kind)
gs->gsbase.subcode = (unsigned int) kind;
}
@@ -2998,7 +3074,7 @@ gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
static inline bool
gimple_try_catch_is_cleanup (const_gimple gs)
{
- gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
+ gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
}
@@ -3029,7 +3105,7 @@ gimple_try_cleanup (gimple gs)
static inline void
gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
{
- gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
+ gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
if (catch_is_cleanup)
g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
else
@@ -3156,7 +3232,7 @@ static inline struct phi_arg_d *
gimple_phi_arg (gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_PHI);
- gcc_assert (index <= gs->gimple_phi.capacity);
+ gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
return &(gs->gimple_phi.args[index]);
}
@@ -3167,8 +3243,8 @@ static inline void
gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
{
GIMPLE_CHECK (gs, GIMPLE_PHI);
- gcc_assert (index <= gs->gimple_phi.nargs);
- memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
+ gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
+ gs->gimple_phi.args[index] = *phiarg;
}
/* Return the region number for GIMPLE_RESX GS. */
@@ -3215,7 +3291,7 @@ gimple_switch_num_labels (const_gimple gs)
unsigned num_ops;
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
num_ops = gimple_num_ops (gs);
- gcc_assert (num_ops > 1);
+ gcc_gimple_checking_assert (num_ops > 1);
return num_ops - 1;
}
@@ -3256,7 +3332,7 @@ static inline void
gimple_switch_set_index (gimple gs, tree index)
{
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
- gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
+ gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
gimple_set_op (gs, 0, index);
}
@@ -3268,7 +3344,7 @@ static inline tree
gimple_switch_label (const_gimple gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
- gcc_assert (gimple_num_ops (gs) > index + 1);
+ gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
return gimple_op (gs, index + 1);
}
@@ -3278,8 +3354,9 @@ static inline void
gimple_switch_set_label (gimple gs, unsigned index, tree label)
{
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
- gcc_assert (gimple_num_ops (gs) > index + 1);
- gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
+ gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
+ && (label == NULL_TREE
+ || TREE_CODE (label) == CASE_LABEL_EXPR));
gimple_set_op (gs, index + 1, label);
}
@@ -3324,9 +3401,7 @@ static inline tree
gimple_debug_bind_get_var (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op (dbg, 0);
}
@@ -3337,9 +3412,7 @@ static inline tree
gimple_debug_bind_get_value (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op (dbg, 1);
}
@@ -3350,9 +3423,7 @@ static inline tree *
gimple_debug_bind_get_value_ptr (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op_ptr (dbg, 1);
}
@@ -3362,9 +3433,7 @@ static inline void
gimple_debug_bind_set_var (gimple dbg, tree var)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
gimple_set_op (dbg, 0, var);
}
@@ -3375,9 +3444,7 @@ static inline void
gimple_debug_bind_set_value (gimple dbg, tree value)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
gimple_set_op (dbg, 1, value);
}
@@ -3392,9 +3459,7 @@ static inline void
gimple_debug_bind_reset_value (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
}
@@ -3405,9 +3470,7 @@ static inline bool
gimple_debug_bind_has_value_p (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
}
@@ -3506,7 +3569,7 @@ static inline tree
gimple_omp_for_index (const_gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return gs->gimple_omp_for.iter[i].index;
}
@@ -3517,7 +3580,7 @@ static inline tree *
gimple_omp_for_index_ptr (gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return &gs->gimple_omp_for.iter[i].index;
}
@@ -3528,7 +3591,7 @@ static inline void
gimple_omp_for_set_index (gimple gs, size_t i, tree index)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
gs->gimple_omp_for.iter[i].index = index;
}
@@ -3539,7 +3602,7 @@ static inline tree
gimple_omp_for_initial (const_gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return gs->gimple_omp_for.iter[i].initial;
}
@@ -3550,7 +3613,7 @@ static inline tree *
gimple_omp_for_initial_ptr (gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return &gs->gimple_omp_for.iter[i].initial;
}
@@ -3561,7 +3624,7 @@ static inline void
gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
gs->gimple_omp_for.iter[i].initial = initial;
}
@@ -3572,7 +3635,7 @@ static inline tree
gimple_omp_for_final (const_gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return gs->gimple_omp_for.iter[i].final;
}
@@ -3583,7 +3646,7 @@ static inline tree *
gimple_omp_for_final_ptr (gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return &gs->gimple_omp_for.iter[i].final;
}
@@ -3594,7 +3657,7 @@ static inline void
gimple_omp_for_set_final (gimple gs, size_t i, tree final)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
gs->gimple_omp_for.iter[i].final = final;
}
@@ -3605,7 +3668,7 @@ static inline tree
gimple_omp_for_incr (const_gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return gs->gimple_omp_for.iter[i].incr;
}
@@ -3616,7 +3679,7 @@ static inline tree *
gimple_omp_for_incr_ptr (gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return &gs->gimple_omp_for.iter[i].incr;
}
@@ -3627,7 +3690,7 @@ static inline void
gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
gs->gimple_omp_for.iter[i].incr = incr;
}
@@ -4129,8 +4192,8 @@ static inline void
gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
+ && i < gs->gimple_omp_for.collapse);
gs->gimple_omp_for.iter[i].cond = cond;
}
@@ -4141,7 +4204,7 @@ static inline enum tree_code
gimple_omp_for_cond (const_gimple gs, size_t i)
{
GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
- gcc_assert (i < gs->gimple_omp_for.collapse);
+ gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
return gs->gimple_omp_for.iter[i].cond;
}
@@ -4807,11 +4870,14 @@ void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
tree gimple_fold_builtin (gimple);
bool fold_stmt (gimple_stmt_iterator *);
bool fold_stmt_inplace (gimple);
-tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
+tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
tree get_symbol_constant_value (tree);
bool may_propagate_address_into_dereference (tree, tree);
-
+extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
+ enum tree_code, tree, tree);
+extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
+ enum tree_code, tree, tree);
#endif /* GCC_GIMPLE_H */
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index cb4358ca9bd..a9c93ac972d 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -110,10 +110,13 @@ mark_addressable (tree x)
{
while (handled_component_p (x))
x = TREE_OPERAND (x, 0);
+ if (TREE_CODE (x) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (x, 0)) == ADDR_EXPR)
+ x = TREE_OPERAND (TREE_OPERAND (x, 0), 0);
if (TREE_CODE (x) != VAR_DECL
&& TREE_CODE (x) != PARM_DECL
&& TREE_CODE (x) != RESULT_DECL)
- return ;
+ return;
TREE_ADDRESSABLE (x) = 1;
}
@@ -534,7 +537,7 @@ lookup_tmp_var (tree val, bool is_formal)
/* Return true if T is a CALL_EXPR or an expression that can be
- assignmed to a temporary. Note that this predicate should only be
+ assigned to a temporary. Note that this predicate should only be
used during gimplification. See the rationale for this in
gimplify_modify_expr. */
@@ -1153,14 +1156,9 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
/* Preliminarily mark non-addressed complex variables as eligible
for promotion to gimple registers. We'll transform their uses
- as we find them.
- We exclude complex types if not optimizing because they can be
- subject to partial stores in GNU C by means of the __real__ and
- __imag__ operators and we cannot promote them to total stores
- (see gimplify_modify_expr_complex_part). */
- if (optimize
- && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+ as we find them. */
+ if ((TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
&& !TREE_THIS_VOLATILE (t)
&& (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t))
&& !needs_to_live_in_memory (t))
@@ -2966,7 +2964,7 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
= build3 (COND_EXPR, type, TREE_OPERAND (expr, 0), then_, else_);
tmp = create_tmp_var (type, "iftmp");
- result = build_fold_indirect_ref_loc (loc, tmp);
+ result = build_simple_mem_ref_loc (loc, tmp);
}
/* Build the new then clause, `tmp = then_;'. But don't build the
@@ -3190,7 +3188,7 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value,
gimple_call_set_lhs (gs, t);
gimplify_seq_add_stmt (seq_p, gs);
- *expr_p = build1 (INDIRECT_REF, TREE_TYPE (to), t);
+ *expr_p = build_simple_mem_ref (t);
return GS_ALL_DONE;
}
@@ -3274,13 +3272,16 @@ gimplify_init_ctor_preeval_1 (tree *tp, int *walk_subtrees, void *xdata)
/* If the constructor component is indirect, determine if we have a
potential overlap with the lhs. The only bits of information we
have to go on at this point are addressability and alias sets. */
- if (TREE_CODE (t) == INDIRECT_REF
+ if ((INDIRECT_REF_P (t)
+ || TREE_CODE (t) == MEM_REF)
&& (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl))
&& alias_sets_conflict_p (data->lhs_alias_set, get_alias_set (t)))
return t;
/* If the constructor component is a call, determine if it can hide a
- potential overlap with the lhs through an INDIRECT_REF like above. */
+ potential overlap with the lhs through an INDIRECT_REF like above.
+ ??? Ugh - this is completely broken. In fact this whole analysis
+ doesn't look conservative. */
if (TREE_CODE (t) == CALL_EXPR)
{
tree type, fntype = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (t)));
@@ -4009,7 +4010,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
tree
gimple_fold_indirect_ref (tree t)
{
- tree type = TREE_TYPE (TREE_TYPE (t));
+ tree ptype = TREE_TYPE (t), type = TREE_TYPE (ptype);
tree sub = t;
tree subtype;
@@ -4052,51 +4053,52 @@ gimple_fold_indirect_ref (tree t)
}
}
- /* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF<vectorfoo,...> */
+ /* *(p + CST) -> ... */
if (TREE_CODE (sub) == POINTER_PLUS_EXPR
&& TREE_CODE (TREE_OPERAND (sub, 1)) == INTEGER_CST)
{
- tree op00 = TREE_OPERAND (sub, 0);
- tree op01 = TREE_OPERAND (sub, 1);
- tree op00type;
+ tree addr = TREE_OPERAND (sub, 0);
+ tree off = TREE_OPERAND (sub, 1);
+ tree addrtype;
+
+ STRIP_NOPS (addr);
+ addrtype = TREE_TYPE (addr);
- STRIP_NOPS (op00);
- op00type = TREE_TYPE (op00);
- if (TREE_CODE (op00) == ADDR_EXPR
- && TREE_CODE (TREE_TYPE (op00type)) == VECTOR_TYPE
- && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (op00type))))
+ /* ((foo*)&vectorfoo)[1] -> BIT_FIELD_REF<vectorfoo,...> */
+ if (TREE_CODE (addr) == ADDR_EXPR
+ && TREE_CODE (TREE_TYPE (addrtype)) == VECTOR_TYPE
+ && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (addrtype))))
{
- HOST_WIDE_INT offset = tree_low_cst (op01, 0);
- tree part_width = TYPE_SIZE (type);
- unsigned HOST_WIDE_INT part_widthi
- = tree_low_cst (part_width, 0) / BITS_PER_UNIT;
- unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT;
- tree index = bitsize_int (indexi);
- if (offset / part_widthi
- <= TYPE_VECTOR_SUBPARTS (TREE_TYPE (op00type)))
- return fold_build3 (BIT_FIELD_REF, type, TREE_OPERAND (op00, 0),
- part_width, index);
+ HOST_WIDE_INT offset = tree_low_cst (off, 0);
+ tree part_width = TYPE_SIZE (type);
+ unsigned HOST_WIDE_INT part_widthi
+ = tree_low_cst (part_width, 0) / BITS_PER_UNIT;
+ unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT;
+ tree index = bitsize_int (indexi);
+ if (offset / part_widthi
+ <= TYPE_VECTOR_SUBPARTS (TREE_TYPE (addrtype)))
+ return fold_build3 (BIT_FIELD_REF, type, TREE_OPERAND (addr, 0),
+ part_width, index);
}
- }
- /* ((foo*)&complexfoo)[1] => __imag__ complexfoo */
- if (TREE_CODE (sub) == POINTER_PLUS_EXPR
- && TREE_CODE (TREE_OPERAND (sub, 1)) == INTEGER_CST)
- {
- tree op00 = TREE_OPERAND (sub, 0);
- tree op01 = TREE_OPERAND (sub, 1);
- tree op00type;
+ /* ((foo*)&complexfoo)[1] -> __imag__ complexfoo */
+ if (TREE_CODE (addr) == ADDR_EXPR
+ && TREE_CODE (TREE_TYPE (addrtype)) == COMPLEX_TYPE
+ && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (addrtype))))
+ {
+ tree size = TYPE_SIZE_UNIT (type);
+ if (tree_int_cst_equal (size, off))
+ return fold_build1 (IMAGPART_EXPR, type, TREE_OPERAND (addr, 0));
+ }
- STRIP_NOPS (op00);
- op00type = TREE_TYPE (op00);
- if (TREE_CODE (op00) == ADDR_EXPR
- && TREE_CODE (TREE_TYPE (op00type)) == COMPLEX_TYPE
- && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (op00type))))
- {
- tree size = TYPE_SIZE_UNIT (type);
- if (tree_int_cst_equal (size, op01))
- return fold_build1 (IMAGPART_EXPR, type, TREE_OPERAND (op00, 0));
- }
+ /* *(p + CST) -> MEM_REF <p, CST>. */
+ if (TREE_CODE (addr) != ADDR_EXPR
+ || DECL_P (TREE_OPERAND (addr, 0)))
+ return fold_build2 (MEM_REF, type,
+ addr,
+ build_int_cst_wide (ptype,
+ TREE_INT_CST_LOW (off),
+ TREE_INT_CST_HIGH (off)));
}
/* *(foo *)fooarrptr => (*fooarrptr)[0] */
@@ -5140,9 +5142,10 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p)
{
/* Note that gsi_insert_seq_before and gsi_remove do not
scan operands, unlike some other sequence mutators. */
- gsi_insert_seq_before_without_update (&iter,
- gimple_wce_cleanup (wce),
- GSI_SAME_STMT);
+ if (!gimple_wce_cleanup_eh_only (wce))
+ gsi_insert_seq_before_without_update (&iter,
+ gimple_wce_cleanup (wce),
+ GSI_SAME_STMT);
gsi_remove (&iter, true);
break;
}
@@ -5585,7 +5588,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
{
case OMP_CLAUSE_DEFAULT_NONE:
error ("%qE not specified in enclosing parallel",
- DECL_NAME (decl));
+ DECL_NAME (lang_hooks.decls.omp_report_decl (decl)));
if ((ctx->region_type & ORT_TASK) != 0)
error_at (ctx->location, "enclosing task");
else
@@ -6513,7 +6516,7 @@ gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p)
GIMPLE_TEST_F points to a function that takes a tree T and
returns nonzero if T is in the GIMPLE form requested by the
- caller. The GIMPLE predicates are in tree-gimple.c.
+ caller. The GIMPLE predicates are in gimple.c.
FALLBACK tells the function what sort of a temporary we want if
gimplification cannot produce an expression that complies with
@@ -6562,7 +6565,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
|| gimple_test_f == is_gimple_mem_rhs_or_call
|| gimple_test_f == is_gimple_reg_rhs
|| gimple_test_f == is_gimple_reg_rhs_or_call
- || gimple_test_f == is_gimple_asm_val)
+ || gimple_test_f == is_gimple_asm_val
+ || gimple_test_f == is_gimple_mem_ref_addr)
gcc_assert (fallback & fb_rvalue);
else if (gimple_test_f == is_gimple_min_lval
|| gimple_test_f == is_gimple_lvalue)
@@ -6768,19 +6772,57 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
recalculate_side_effects (*expr_p);
break;
+ case ALIGN_INDIRECT_REF:
+ case MISALIGNED_INDIRECT_REF:
+ /* We can only reach this through re-gimplification from
+ tree optimizers. */
+ ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+ is_gimple_reg, fb_rvalue);
+ recalculate_side_effects (*expr_p);
+ break;
+
case INDIRECT_REF:
- *expr_p = fold_indirect_ref_loc (input_location, *expr_p);
- if (*expr_p != save_expr)
+ {
+ bool volatilep = TREE_THIS_VOLATILE (*expr_p);
+ tree saved_ptr_type = TREE_TYPE (TREE_OPERAND (*expr_p, 0));
+
+ *expr_p = fold_indirect_ref_loc (input_location, *expr_p);
+ if (*expr_p != save_expr)
+ {
+ ret = GS_OK;
+ break;
+ }
+
+ ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+ is_gimple_reg, fb_rvalue);
+ recalculate_side_effects (*expr_p);
+
+ *expr_p = fold_build2_loc (input_location, MEM_REF,
+ TREE_TYPE (*expr_p),
+ TREE_OPERAND (*expr_p, 0),
+ build_int_cst (saved_ptr_type, 0));
+ TREE_THIS_VOLATILE (*expr_p) = volatilep;
+ ret = GS_OK;
+ break;
+ }
+
+ /* We arrive here through the various re-gimplifcation paths. */
+ case MEM_REF:
+ /* First try re-folding the whole thing. */
+ tmp = fold_binary (MEM_REF, TREE_TYPE (*expr_p),
+ TREE_OPERAND (*expr_p, 0),
+ TREE_OPERAND (*expr_p, 1));
+ if (tmp)
{
+ *expr_p = tmp;
+ recalculate_side_effects (*expr_p);
ret = GS_OK;
break;
}
- /* else fall through. */
- case ALIGN_INDIRECT_REF:
- case MISALIGNED_INDIRECT_REF:
ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
- is_gimple_reg, fb_rvalue);
+ is_gimple_mem_ref_addr, fb_rvalue);
recalculate_side_effects (*expr_p);
+ ret = GS_ALL_DONE;
break;
/* Constants need not be gimplified. */
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 3240c37f8cf..b6b8d3134b1 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -469,11 +469,10 @@ precision_for_interval (mpz_t low, mpz_t up)
return precision;
}
-/* Return a type that could represent the integer value VAL, or
- otherwise return NULL_TREE. */
+/* Return a type that could represent the integer value VAL. */
static tree
-gcc_type_for_interval (mpz_t low, mpz_t up, tree old_type)
+gcc_type_for_interval (mpz_t low, mpz_t up)
{
bool unsigned_p = true;
int precision, prec_up, prec_int;
@@ -482,14 +481,12 @@ gcc_type_for_interval (mpz_t low, mpz_t up, tree old_type)
gcc_assert (value_le (low, up));
- /* Preserve the signedness of the old IV. */
- if ((old_type && !TYPE_UNSIGNED (old_type))
- || value_neg_p (low))
+ if (value_neg_p (low))
unsigned_p = false;
prec_up = precision_for_value (up);
prec_int = precision_for_interval (low, up);
- precision = prec_up > prec_int ? prec_up : prec_int;
+ precision = MAX (prec_up, prec_int);
if (precision > BITS_PER_WORD)
{
@@ -516,7 +513,7 @@ gcc_type_for_interval (mpz_t low, mpz_t up, tree old_type)
static tree
gcc_type_for_value (mpz_t val)
{
- return gcc_type_for_interval (val, val, NULL_TREE);
+ return gcc_type_for_interval (val, val);
}
/* Return the type for the clast_term T used in STMT. */
@@ -726,11 +723,10 @@ compute_bounds_for_level (poly_bb_p pbb, int level, mpz_t low, mpz_t up)
}
/* Compute the type for the induction variable at LEVEL for the
- statement PBB, based on the transformed schedule of PBB. OLD_TYPE
- is the type of the old induction variable for that loop. */
+ statement PBB, based on the transformed schedule of PBB. */
static tree
-compute_type_for_level_1 (poly_bb_p pbb, int level, tree old_type)
+compute_type_for_level (poly_bb_p pbb, int level)
{
mpz_t low, up;
tree type;
@@ -739,39 +735,13 @@ compute_type_for_level_1 (poly_bb_p pbb, int level, tree old_type)
value_init (up);
compute_bounds_for_level (pbb, level, low, up);
- type = gcc_type_for_interval (low, up, old_type);
+ type = gcc_type_for_interval (low, up);
value_clear (low);
value_clear (up);
return type;
}
-/* Compute the type for the induction variable at LEVEL for the
- statement PBB, based on the transformed schedule of PBB. */
-
-static tree
-compute_type_for_level (poly_bb_p pbb, int level)
-{
- tree oldiv = pbb_to_depth_to_oldiv (pbb, level);
- tree type = TREE_TYPE (oldiv);
-
- if (type && POINTER_TYPE_P (type))
- {
-#ifdef ENABLE_CHECKING
- tree ctype = compute_type_for_level_1 (pbb, level, type);
-
- /* In the case of a pointer type, check that after the loop
- transform, the lower and the upper bounds of the type fit the
- oldiv pointer type. */
- gcc_assert (TYPE_PRECISION (type) >= TYPE_PRECISION (ctype)
- && integer_zerop (lower_bound_in_type (ctype, ctype)));
-#endif
- return type;
- }
-
- return compute_type_for_level_1 (pbb, level, type);
-}
-
/* Walks a CLAST and returns the first statement in the body of a
loop. */
@@ -1021,6 +991,7 @@ translate_clast_user (sese region, struct clast_user_stmt *stmt, edge next_e,
/* Creates a new if region protecting the loop to be executed, if the execution
count is zero (lb > ub). */
+
static edge
graphite_create_new_loop_guard (sese region, edge entry_edge,
struct clast_for *stmt,
@@ -1038,22 +1009,14 @@ graphite_create_new_loop_guard (sese region, edge entry_edge,
newivs_index, params_index);
tree ub = clast_to_gcc_expression (type, stmt->UB, region, newivs,
newivs_index, params_index);
- tree ub_one;
-
+ tree one = POINTER_TYPE_P (type) ? size_one_node
+ : fold_convert (type, integer_one_node);
/* Adding +1 and using LT_EXPR helps with loop latches that have a
loop iteration count of "PARAMETER - 1". For PARAMETER == 0 this becomes
2^{32|64}, and the condition lb <= ub is true, even if we do not want this.
However lb < ub + 1 is false, as expected. */
- tree one;
- mpz_t gmp_one;
-
- mpz_init (gmp_one);
- mpz_set_si (gmp_one, 1);
- one = gmp_cst_to_tree (type, gmp_one);
- mpz_clear (gmp_one);
-
- ub_one = fold_build2 (POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR : PLUS_EXPR,
- type, ub, one);
+ tree ub_one = fold_build2 (POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR
+ : PLUS_EXPR, type, ub, one);
/* When ub + 1 wraps around, use lb <= ub. */
if (integer_zerop (ub_one))
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 8ab24f9022c..5f858ebaad5 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -388,6 +388,7 @@ number_of_write_pdrs (poly_bb_p pbb)
}
/* The basic block of the PBB. */
+
static inline basic_block
pbb_bb (poly_bb_p pbb)
{
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index e2d4192c471..7f83ffcf5df 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1328,8 +1328,7 @@ add_condition_to_pbb (poly_bb_p pbb, gimple stmt, enum tree_code code)
(&right, left);
add_condition_to_domain (left, stmt, pbb, LT_EXPR);
add_condition_to_domain (right, stmt, pbb, GT_EXPR);
- ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (left,
- right);
+ ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (left, right);
ppl_delete_Pointset_Powerset_C_Polyhedron (right);
}
else
@@ -1344,12 +1343,11 @@ add_conditions_to_domain (poly_bb_p pbb)
unsigned int i;
gimple stmt;
gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
- VEC (gimple, heap) *conditions = GBB_CONDITIONS (gbb);
- if (VEC_empty (gimple, conditions))
+ if (VEC_empty (gimple, GBB_CONDITIONS (gbb)))
return;
- for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
+ for (i = 0; VEC_iterate (gimple, GBB_CONDITIONS (gbb), i, stmt); i++)
switch (gimple_code (stmt))
{
case GIMPLE_COND:
@@ -1357,7 +1355,7 @@ add_conditions_to_domain (poly_bb_p pbb)
enum tree_code code = gimple_cond_code (stmt);
/* The conditions for ELSE-branches are inverted. */
- if (VEC_index (gimple, gbb->condition_cases, i) == NULL)
+ if (!VEC_index (gimple, GBB_CONDITION_CASES (gbb), i))
code = invert_tree_comparison (code, false);
add_condition_to_pbb (pbb, stmt, code);
@@ -1381,21 +1379,28 @@ struct bsc
sese region;
};
-/* Returns non NULL when BB has a single predecessor and the last
- statement of that predecessor is a COND_EXPR. */
+/* Returns a COND_EXPR statement when BB has a single predecessor, the
+ edge between BB and its predecessor is not a loop exit edge, and
+ the last statement of the single predecessor is a COND_EXPR. */
static gimple
-single_pred_cond (basic_block bb)
+single_pred_cond_non_loop_exit (basic_block bb)
{
if (single_pred_p (bb))
{
edge e = single_pred_edge (bb);
basic_block pred = e->src;
- gimple stmt = last_stmt (pred);
+ gimple stmt;
+
+ if (loop_depth (pred->loop_father) > loop_depth (bb->loop_father))
+ return NULL;
+
+ stmt = last_stmt (pred);
if (stmt && gimple_code (stmt) == GIMPLE_COND)
return stmt;
}
+
return NULL;
}
@@ -1409,12 +1414,14 @@ build_sese_conditions_before (struct dom_walk_data *dw_data,
struct bsc *data = (struct bsc *) dw_data->global_data;
VEC (gimple, heap) **conditions = data->conditions;
VEC (gimple, heap) **cases = data->cases;
- gimple_bb_p gbb = gbb_from_bb (bb);
- gimple stmt = single_pred_cond (bb);
+ gimple_bb_p gbb;
+ gimple stmt;
if (!bb_in_sese_p (bb, data->region))
return;
+ stmt = single_pred_cond_non_loop_exit (bb);
+
if (stmt)
{
edge e = single_pred_edge (bb);
@@ -1427,6 +1434,8 @@ build_sese_conditions_before (struct dom_walk_data *dw_data,
VEC_safe_push (gimple, heap, *cases, NULL);
}
+ gbb = gbb_from_bb (bb);
+
if (gbb)
{
GBB_CONDITIONS (gbb) = VEC_copy (gimple, heap, *conditions);
@@ -1448,7 +1457,7 @@ build_sese_conditions_after (struct dom_walk_data *dw_data,
if (!bb_in_sese_p (bb, data->region))
return;
- if (single_pred_cond (bb))
+ if (single_pred_cond_non_loop_exit (bb))
{
VEC_pop (gimple, *conditions);
VEC_pop (gimple, *cases);
@@ -1769,10 +1778,11 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
accesses);
ppl_delete_Polyhedron (accesses);
- if (dr->aux)
- dr_base_object_set = ((base_alias_pair *)(dr->aux))->base_obj_set;
+ gcc_assert (dr->aux);
+ dr_base_object_set = ((base_alias_pair *)(dr->aux))->base_obj_set;
- new_poly_dr (pbb, dr_base_object_set, accesses_ps, DR_IS_READ (dr) ? PDR_READ : PDR_WRITE,
+ new_poly_dr (pbb, dr_base_object_set, accesses_ps,
+ DR_IS_READ (dr) ? PDR_READ : PDR_WRITE,
dr, DR_NUM_DIMENSIONS (dr));
}
@@ -1914,8 +1924,8 @@ build_alias_set_optimal_p (VEC (data_reference_p, heap) *drs)
data_reference_p dr = VEC_index (data_reference_p, drs, i);
base_alias_pair *bap;
- if (dr->aux)
- bap = (base_alias_pair *)(dr->aux);
+ gcc_assert (dr->aux);
+ bap = (base_alias_pair *)(dr->aux);
bap->alias_set = XNEW (int);
*(bap->alias_set) = g->vertices[i].component + 1;
@@ -1993,8 +2003,8 @@ build_base_obj_set_for_drs (VEC (data_reference_p, heap) *drs)
data_reference_p dr = VEC_index (data_reference_p, drs, i);
base_alias_pair *bap;
- if (dr->aux)
- bap = (base_alias_pair *)(dr->aux);
+ gcc_assert (dr->aux);
+ bap = (base_alias_pair *)(dr->aux);
bap->base_obj_set = g->vertices[i].component + 1;
}
@@ -2924,6 +2934,7 @@ scop_canonicalize_loops (scop_p scop)
/* Can all ivs be represented by a signed integer?
As CLooG might generate negative values in its expressions, signed loop ivs
are required in the backend. */
+
static bool
scop_ivs_can_be_represented (scop_p scop)
{
@@ -2941,7 +2952,7 @@ scop_ivs_can_be_represented (scop_p scop)
if (!loop->single_iv)
continue;
- type = TREE_TYPE(loop->single_iv);
+ type = TREE_TYPE (loop->single_iv);
precision = TYPE_PRECISION (type);
if (TYPE_UNSIGNED (type)
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 2effed24046..a5e1d3ffcf4 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1124,6 +1124,8 @@ setup_insn_reg_pressure_info (rtx insn)
struct reg_use_data *use;
static int death[N_REG_CLASSES];
+ gcc_checking_assert (!DEBUG_INSN_P (insn));
+
excess_cost_change = 0;
for (i = 0; i < ira_reg_class_cover_size; i++)
death[ira_reg_class_cover[i]] = 0;
@@ -1500,7 +1502,8 @@ ready_sort (struct ready_list *ready)
if (sched_pressure_p)
{
for (i = 0; i < ready->n_ready; i++)
- setup_insn_reg_pressure_info (first[i]);
+ if (!DEBUG_INSN_P (first[i]))
+ setup_insn_reg_pressure_info (first[i]);
}
SCHED_SORT (first, ready->n_ready);
}
@@ -1564,6 +1567,8 @@ update_register_pressure (rtx insn)
struct reg_use_data *use;
struct reg_set_data *set;
+ gcc_checking_assert (!DEBUG_INSN_P (insn));
+
for (use = INSN_REG_USE_LIST (insn); use != NULL; use = use->next_insn_use)
if (dying_use_p (use) && bitmap_bit_p (curr_reg_live, use->regno))
mark_regno_birth_or_death (use->regno, false);
@@ -1684,7 +1689,7 @@ schedule_insn (rtx insn)
fputc ('\n', sched_dump);
}
- if (sched_pressure_p)
+ if (sched_pressure_p && !DEBUG_INSN_P (insn))
update_reg_and_insn_max_reg_pressure (insn);
/* Scheduling instruction should have all its dependencies resolved and
@@ -1793,7 +1798,7 @@ schedule_insn (rtx insn)
forward dependencies for INSN anymore. Nevertheless they are used in
heuristics in rank_for_schedule (), early_queue_to_ready () and in
some targets (e.g. rs6000). Thus the earliest place where we *can*
- remove dependencies is after targetm.sched.md_finish () call in
+ remove dependencies is after targetm.sched.finish () call in
schedule_block (). But, on the other side, the safest place to remove
dependencies is when we are finishing scheduling entire region. As we
don't generate [many] dependencies during scheduling itself, we won't
@@ -2803,8 +2808,8 @@ schedule_block (basic_block *target_bb)
/* It is used for first cycle multipass scheduling. */
temp_state = alloca (dfa_state_size);
- if (targetm.sched.md_init)
- targetm.sched.md_init (sched_dump, sched_verbose, ready.veclen);
+ if (targetm.sched.init)
+ targetm.sched.init (sched_dump, sched_verbose, ready.veclen);
/* We start inserting insns after PREV_HEAD. */
last_scheduled_insn = prev_head;
@@ -3278,9 +3283,9 @@ schedule_block (basic_block *target_bb)
fix_inter_tick (NEXT_INSN (prev_head), last_scheduled_insn);
}
- if (targetm.sched.md_finish)
+ if (targetm.sched.finish)
{
- targetm.sched.md_finish (sched_dump, sched_verbose);
+ targetm.sched.finish (sched_dump, sched_verbose);
/* Target might have added some instructions to the scheduled block
in its md_finish () hook. These new insns don't have any data
initialized and to identify them we extend h_i_d so that they'll
@@ -3439,9 +3444,8 @@ sched_init (void)
regstat_compute_calls_crossed ();
- if (targetm.sched.md_init_global)
- targetm.sched.md_init_global (sched_dump, sched_verbose,
- get_max_uid () + 1);
+ if (targetm.sched.init_global)
+ targetm.sched.init_global (sched_dump, sched_verbose, get_max_uid () + 1);
if (sched_pressure_p)
{
@@ -3566,8 +3570,8 @@ sched_finish (void)
}
free (curr_state);
- if (targetm.sched.md_finish_global)
- targetm.sched.md_finish_global (sched_dump, sched_verbose);
+ if (targetm.sched.finish_global)
+ targetm.sched.finish_global (sched_dump, sched_verbose);
end_alias_analysis ();
diff --git a/gcc/implicit-zee.c b/gcc/implicit-zee.c
index 3344d7f8af2..46029cdac38 100644
--- a/gcc/implicit-zee.c
+++ b/gcc/implicit-zee.c
@@ -858,7 +858,7 @@ find_removable_zero_extends (void)
{
FOR_BB_INSNS (curr_block, curr_insn)
{
- if (!INSN_P (curr_insn))
+ if (!NONDEBUG_INSN_P (curr_insn))
continue;
type = for_each_rtx (&PATTERN (curr_insn),
diff --git a/gcc/integrate.c b/gcc/integrate.c
index e3decfbfe19..b4c1362b3a1 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -246,10 +246,10 @@ get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
ivs = crtl->hard_reg_initial_vals;
if (ivs == 0)
{
- ivs = GGC_NEW (initial_value_struct);
+ ivs = ggc_alloc_initial_value_struct ();
ivs->num_entries = 0;
ivs->max_entries = 5;
- ivs->entries = GGC_NEWVEC (initial_value_pair, 5);
+ ivs->entries = ggc_alloc_vec_initial_value_pair (5);
crtl->hard_reg_initial_vals = ivs;
}
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f5a6fcbdf1d..8f9937320a1 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -172,23 +172,14 @@ static void
ipcp_init_cloned_node (struct cgraph_node *orig_node,
struct cgraph_node *new_node)
{
- ipa_check_create_node_params ();
- ipa_initialize_node_params (new_node);
+ gcc_checking_assert (ipa_node_params_vector
+ && (VEC_length (ipa_node_params_t,
+ ipa_node_params_vector)
+ > (unsigned) cgraph_max_uid));
+ gcc_checking_assert (IPA_NODE_REF (new_node)->params);
IPA_NODE_REF (new_node)->ipcp_orig_node = orig_node;
}
-/* Perform intraprocedrual analysis needed for ipcp. */
-static void
-ipcp_analyze_node (struct cgraph_node *node)
-{
- /* Unreachable nodes should have been eliminated before ipcp. */
- gcc_assert (node->needed || node->reachable);
-
- node->local.versionable = tree_versionable_function_p (node->decl);
- ipa_initialize_node_params (node);
- ipa_detect_param_modifications (node);
-}
-
/* Return scale for NODE. */
static inline gcov_type
ipcp_get_node_scale (struct cgraph_node *node)
@@ -611,6 +602,7 @@ ipcp_compute_node_scale (struct cgraph_node *node)
/* Initialization and computation of IPCP data structures. This is the initial
intraprocedural analysis of functions, which gathers information to be
propagated later on. */
+
static void
ipcp_init_stage (void)
{
@@ -618,16 +610,13 @@ ipcp_init_stage (void)
for (node = cgraph_nodes; node; node = node->next)
if (node->analyzed)
- ipcp_analyze_node (node);
- for (node = cgraph_nodes; node; node = node->next)
- {
- if (!node->analyzed)
- continue;
+ {
+ /* Unreachable nodes should have been eliminated before ipcp. */
+ gcc_assert (node->needed || node->reachable);
- ipa_analyze_params_uses (node);
- /* building jump functions */
- ipa_compute_jump_functions (node);
- }
+ node->local.versionable = tree_versionable_function_p (node->decl);
+ ipa_analyze_node (node);
+ }
}
/* Return true if there are some formal parameters whose value is IPA_TOP (in
@@ -838,7 +827,7 @@ ipcp_create_replace_map (tree parm_tree, struct ipcp_lattice *lat)
struct ipa_replace_map *replace_map;
tree const_val;
- replace_map = GGC_NEW (struct ipa_replace_map);
+ replace_map = ggc_alloc_ipa_replace_map ();
const_val = build_const_val (lat, TREE_TYPE (parm_tree));
if (dump_file)
{
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 46bce87b16f..691bf6ca771 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -968,7 +968,9 @@ add_new_edges_to_heap (fibheap_t heap, VEC (cgraph_edge_p, heap) *new_edges)
struct cgraph_edge *edge = VEC_pop (cgraph_edge_p, new_edges);
gcc_assert (!edge->aux);
- edge->aux = fibheap_insert (heap, cgraph_edge_badness (edge, false), edge);
+ if (edge->callee->local.inlinable
+ && cgraph_default_inline_p (edge->callee, &edge->inline_failed))
+ edge->aux = fibheap_insert (heap, cgraph_edge_badness (edge, false), edge);
}
}
@@ -1830,10 +1832,12 @@ likely_eliminated_by_inlining_p (gimple stmt)
bool rhs_free = false;
bool lhs_free = false;
- while (handled_component_p (inner_lhs) || TREE_CODE (inner_lhs) == INDIRECT_REF)
+ while (handled_component_p (inner_lhs)
+ || TREE_CODE (inner_lhs) == MEM_REF)
inner_lhs = TREE_OPERAND (inner_lhs, 0);
while (handled_component_p (inner_rhs)
- || TREE_CODE (inner_rhs) == ADDR_EXPR || TREE_CODE (inner_rhs) == INDIRECT_REF)
+ || TREE_CODE (inner_rhs) == ADDR_EXPR
+ || TREE_CODE (inner_rhs) == MEM_REF)
inner_rhs = TREE_OPERAND (inner_rhs, 0);
@@ -1853,7 +1857,8 @@ likely_eliminated_by_inlining_p (gimple stmt)
|| (TREE_CODE (inner_lhs) == SSA_NAME
&& TREE_CODE (SSA_NAME_VAR (inner_lhs)) == RESULT_DECL))
lhs_free = true;
- if (lhs_free && (is_gimple_reg (rhs) || is_gimple_min_invariant (rhs)))
+ if (lhs_free
+ && (is_gimple_reg (rhs) || is_gimple_min_invariant (rhs)))
rhs_free = true;
if (lhs_free && rhs_free)
return true;
@@ -2011,12 +2016,8 @@ struct gimple_opt_pass pass_inline_parameters =
static void
inline_indirect_intraprocedural_analysis (struct cgraph_node *node)
{
- ipa_initialize_node_params (node);
- ipa_detect_param_modifications (node);
- ipa_analyze_params_uses (node);
- ipa_compute_jump_functions (node);
-
- if (dump_file)
+ ipa_analyze_node (node);
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
ipa_print_node_params (dump_file, node);
ipa_print_node_jump_functions (dump_file, node);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index b3e8cfa61dc..9bd07f039b9 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -39,6 +39,16 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "lto-streamer.h"
+
+/* Intermediate information about a parameter that is only useful during the
+ run of ipa_analyze_node and is not kept afterwards. */
+
+struct param_analysis_info
+{
+ bool modified;
+ bitmap visited_statements;
+};
+
/* Vector where the parameter infos are actually stored. */
VEC (ipa_node_params_t, heap) *ipa_node_params_vector;
/* Vector where the parameter infos are actually stored. */
@@ -196,101 +206,10 @@ ipa_initialize_node_params (struct cgraph_node *node)
}
}
-/* Callback of walk_stmt_load_store_addr_ops for the visit_store and visit_addr
- parameters. If OP is a parameter declaration, mark it as modified in the
- info structure passed in DATA. */
-
-static bool
-visit_store_addr_for_mod_analysis (gimple stmt ATTRIBUTE_UNUSED,
- tree op, void *data)
-{
- struct ipa_node_params *info = (struct ipa_node_params *) data;
-
- op = get_base_address (op);
- if (op
- && TREE_CODE (op) == PARM_DECL)
- {
- int index = ipa_get_param_decl_index (info, op);
- gcc_assert (index >= 0);
- info->params[index].modified = true;
- info->params[index].used = true;
- }
-
- return false;
-}
-
-/* Callback of walk_stmt_load_store_addr_ops for the visit_load.
- If OP is a parameter declaration, mark it as used in the info structure
- passed in DATA. */
-
-static bool
-visit_load_for_mod_analysis (gimple stmt ATTRIBUTE_UNUSED,
- tree op, void *data)
-{
- struct ipa_node_params *info = (struct ipa_node_params *) data;
-
- op = get_base_address (op);
- if (op
- && TREE_CODE (op) == PARM_DECL)
- {
- int index = ipa_get_param_decl_index (info, op);
- gcc_assert (index >= 0);
- info->params[index].used = true;
- }
-
- return false;
-}
-
-/* Compute which formal parameters of function associated with NODE are locally
- modified or their address is taken. Note that this does not apply on
- parameters with SSA names but those can and should be analyzed
- differently. */
-
-void
-ipa_detect_param_modifications (struct cgraph_node *node)
-{
- tree decl = node->decl;
- basic_block bb;
- struct function *func;
- gimple_stmt_iterator gsi;
- struct ipa_node_params *info = IPA_NODE_REF (node);
- int i;
-
- if (ipa_get_param_count (info) == 0 || info->modification_analysis_done)
- return;
-
- for (i = 0; i < ipa_get_param_count (info); i++)
- {
- tree parm = ipa_get_param (info, i);
- /* For SSA regs see if parameter is used. For non-SSA we compute
- the flag during modification analysis. */
- if (is_gimple_reg (parm)
- && gimple_default_def (DECL_STRUCT_FUNCTION (node->decl), parm))
- info->params[i].used = true;
- }
-
- func = DECL_STRUCT_FUNCTION (decl);
- FOR_EACH_BB_FN (bb, func)
- {
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info,
- visit_load_for_mod_analysis,
- visit_store_addr_for_mod_analysis,
- visit_store_addr_for_mod_analysis);
- for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info,
- visit_load_for_mod_analysis,
- visit_store_addr_for_mod_analysis,
- visit_store_addr_for_mod_analysis);
- }
-
- info->modification_analysis_done = 1;
-}
-
/* Count number of arguments callsite CS has and store it in
ipa_edge_args structure corresponding to this callsite. */
-void
+static void
ipa_count_arguments (struct cgraph_edge *cs)
{
gimple stmt;
@@ -486,11 +405,12 @@ compute_complex_assign_jump_func (struct ipa_node_params *info,
if (TREE_CODE (type) != RECORD_TYPE)
return;
op1 = get_ref_base_and_extent (op1, &offset, &size, &max_size);
- if (TREE_CODE (op1) != INDIRECT_REF
+ if (TREE_CODE (op1) != MEM_REF
/* If this is a varying address, punt. */
|| max_size == -1
|| max_size != size)
return;
+ offset += mem_ref_offset (op1).low * BITS_PER_UNIT;
op1 = TREE_OPERAND (op1, 0);
if (TREE_CODE (op1) != SSA_NAME
|| !SSA_NAME_IS_DEFAULT_DEF (op1))
@@ -562,11 +482,12 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info,
expr = TREE_OPERAND (expr, 0);
expr = get_ref_base_and_extent (expr, &offset, &size, &max_size);
- if (TREE_CODE (expr) != INDIRECT_REF
+ if (TREE_CODE (expr) != MEM_REF
/* If this is a varying address, punt. */
|| max_size == -1
|| max_size != size)
return;
+ offset += mem_ref_offset (expr).low * BITS_PER_UNIT;
parm = TREE_OPERAND (expr, 0);
if (TREE_CODE (parm) != SSA_NAME
|| !SSA_NAME_IS_DEFAULT_DEF (parm))
@@ -707,14 +628,53 @@ type_like_member_ptr_p (tree type, tree *method_ptr, tree *delta)
return true;
}
+/* Callback of walk_aliased_vdefs. Flags that it has been invoked to the
+ boolean variable pointed to by DATA. */
+
+static bool
+mark_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef ATTRIBUTE_UNUSED,
+ void *data)
+{
+ bool *b = (bool *) data;
+ *b = true;
+ return true;
+}
+
+/* Return true if the formal parameter PARM might have been modified in this
+ function before reaching the statement CALL. PARM_INFO is a pointer to a
+ structure containing intermediate information about PARM. */
+
+static bool
+is_parm_modified_before_call (struct param_analysis_info *parm_info,
+ gimple call, tree parm)
+{
+ bool modified = false;
+ ao_ref refd;
+
+ if (parm_info->modified)
+ return true;
+
+ ao_ref_init (&refd, parm);
+ walk_aliased_vdefs (&refd, gimple_vuse (call), mark_modified,
+ &modified, &parm_info->visited_statements);
+ if (modified)
+ {
+ parm_info->modified = true;
+ return true;
+ }
+ return false;
+}
+
/* Go through arguments of the CALL and for every one that looks like a member
pointer, check whether it can be safely declared pass-through and if so,
mark that to the corresponding item of jump FUNCTIONS. Return true iff
there are non-pass-through member pointers within the arguments. INFO
- describes formal parameters of the caller. */
+ describes formal parameters of the caller. PARMS_INFO is a pointer to a
+ vector containing intermediate information about each formal parameter. */
static bool
compute_pass_through_member_ptrs (struct ipa_node_params *info,
+ struct param_analysis_info *parms_info,
struct ipa_jump_func *functions,
gimple call)
{
@@ -733,7 +693,7 @@ compute_pass_through_member_ptrs (struct ipa_node_params *info,
int index = ipa_get_param_decl_index (info, arg);
gcc_assert (index >=0);
- if (!ipa_is_param_modified (info, index))
+ if (!is_parm_modified_before_call (&parms_info[index], call, arg))
{
functions[num].type = IPA_JF_PASS_THROUGH;
functions[num].value.pass_through.formal_id = index;
@@ -806,6 +766,8 @@ determine_cst_member_ptr (gimple call, tree arg, tree method_field,
gimple stmt = gsi_stmt (gsi);
tree lhs, rhs, fld;
+ if (!stmt_may_clobber_ref_p (stmt, arg))
+ continue;
if (!gimple_assign_single_p (stmt))
return;
@@ -814,7 +776,7 @@ determine_cst_member_ptr (gimple call, tree arg, tree method_field,
if (TREE_CODE (lhs) != COMPONENT_REF
|| TREE_OPERAND (lhs, 0) != arg)
- continue;
+ return;
fld = TREE_OPERAND (lhs, 1);
if (!method && fld == method_field)
@@ -884,7 +846,8 @@ compute_cst_member_ptr_arguments (struct ipa_jump_func *functions,
to this callsite. */
static void
-ipa_compute_jump_functions_for_edge (struct cgraph_edge *cs)
+ipa_compute_jump_functions_for_edge (struct param_analysis_info *parms_info,
+ struct cgraph_edge *cs)
{
struct ipa_node_params *info = IPA_NODE_REF (cs->caller);
struct ipa_edge_args *arguments = IPA_EDGE_REF (cs);
@@ -892,8 +855,8 @@ ipa_compute_jump_functions_for_edge (struct cgraph_edge *cs)
if (ipa_get_cs_argument_count (arguments) == 0 || arguments->jump_functions)
return;
- arguments->jump_functions = GGC_CNEWVEC (struct ipa_jump_func,
- ipa_get_cs_argument_count (arguments));
+ arguments->jump_functions = ggc_alloc_cleared_vec_ipa_jump_func
+ (ipa_get_cs_argument_count (arguments));
call = cs->call_stmt;
gcc_assert (is_gimple_call (call));
@@ -903,7 +866,8 @@ ipa_compute_jump_functions_for_edge (struct cgraph_edge *cs)
/* Let's check whether there are any potential member pointers and if so,
whether we can determine their functions as pass_through. */
- if (!compute_pass_through_member_ptrs (info, arguments->jump_functions, call))
+ if (!compute_pass_through_member_ptrs (info, parms_info,
+ arguments->jump_functions, call))
return;
/* Finally, let's check whether we actually pass a new constant member
@@ -914,8 +878,9 @@ ipa_compute_jump_functions_for_edge (struct cgraph_edge *cs)
/* Compute jump functions for all edges - both direct and indirect - outgoing
from NODE. Also count the actual arguments in the process. */
-void
-ipa_compute_jump_functions (struct cgraph_node *node)
+static void
+ipa_compute_jump_functions (struct cgraph_node *node,
+ struct param_analysis_info *parms_info)
{
struct cgraph_edge *cs;
@@ -926,16 +891,20 @@ ipa_compute_jump_functions (struct cgraph_node *node)
if (!cs->callee->analyzed && !flag_lto && !flag_whopr)
continue;
ipa_count_arguments (cs);
+ /* If the descriptor of the callee is not initialized yet, we have to do
+ it now. */
+ if (cs->callee->analyzed)
+ ipa_initialize_node_params (cs->callee);
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
!= ipa_get_param_count (IPA_NODE_REF (cs->callee)))
ipa_set_called_with_variable_arg (IPA_NODE_REF (cs->callee));
- ipa_compute_jump_functions_for_edge (cs);
+ ipa_compute_jump_functions_for_edge (parms_info, cs);
}
for (cs = node->indirect_calls; cs; cs = cs->next_callee)
{
ipa_count_arguments (cs);
- ipa_compute_jump_functions_for_edge (cs);
+ ipa_compute_jump_functions_for_edge (parms_info, cs);
}
}
@@ -1019,17 +988,23 @@ ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt,
}
/* Analyze the CALL and examine uses of formal parameters of the caller NODE
- (described by INFO). Currently it checks whether the call calls a pointer
- that is a formal parameter and if so, the parameter is marked with the
- called flag and an indirect call graph edge describing the call is created.
- This is very simple for ordinary pointers represented in SSA but not-so-nice
- when it comes to member pointers. The ugly part of this function does
- nothing more than trying to match the pattern of such a call. An example of
- such a pattern is the gimple dump below, the call is on the last line:
+ (described by INFO). PARMS_INFO is a pointer to a vector containing
+ intermediate information about each formal parameter. Currently it checks
+ whether the call calls a pointer that is a formal parameter and if so, the
+ parameter is marked with the called flag and an indirect call graph edge
+ describing the call is created. This is very simple for ordinary pointers
+ represented in SSA but not-so-nice when it comes to member pointers. The
+ ugly part of this function does nothing more than trying to match the
+ pattern of such a call. An example of such a pattern is the gimple dump
+ below, the call is on the last line:
<bb 2>:
f$__delta_5 = f.__delta;
f$__pfn_24 = f.__pfn;
+
+ ...
+
+ <bb 5>
D.2496_3 = (int) f$__pfn_24;
D.2497_4 = D.2496_3 & 1;
if (D.2497_4 != 0)
@@ -1037,7 +1012,7 @@ ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt,
else
goto <bb 4>;
- <bb 3>:
+ <bb 6>:
D.2500_7 = (unsigned int) f$__delta_5;
D.2501_8 = &S + D.2500_7;
D.2502_9 = (int (*__vtbl_ptr_type) (void) * *) D.2501_8;
@@ -1048,7 +1023,7 @@ ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt,
D.2507_15 = *D.2506_14;
iftmp.11_16 = (String:: *) D.2507_15;
- <bb 4>:
+ <bb 7>:
# iftmp.11_1 = PHI <iftmp.11_16(3), f$__pfn_24(2)>
D.2500_19 = (unsigned int) f$__delta_5;
D.2508_20 = &S + D.2500_19;
@@ -1067,6 +1042,7 @@ ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt,
static void
ipa_analyze_indirect_call_uses (struct cgraph_node *node,
struct ipa_node_params *info,
+ struct param_analysis_info *parms_info,
gimple call, tree target)
{
gimple def;
@@ -1109,17 +1085,18 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node,
d1 = SSA_NAME_DEF_STMT (n1);
d2 = SSA_NAME_DEF_STMT (n2);
+ join = gimple_bb (def);
if ((rec = ipa_get_stmt_member_ptr_load_param (d1, false)))
{
if (ipa_get_stmt_member_ptr_load_param (d2, false))
return;
- bb = gimple_bb (d1);
+ bb = EDGE_PRED (join, 0)->src;
virt_bb = gimple_bb (d2);
}
else if ((rec = ipa_get_stmt_member_ptr_load_param (d2, false)))
{
- bb = gimple_bb (d2);
+ bb = EDGE_PRED (join, 1)->src;
virt_bb = gimple_bb (d1);
}
else
@@ -1128,7 +1105,6 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node,
/* Second, we need to check that the basic blocks are laid out in the way
corresponding to the pattern. */
- join = gimple_bb (def);
if (!single_pred_p (virt_bb) || !single_succ_p (virt_bb)
|| single_pred (virt_bb) != bb
|| single_succ (virt_bb) != join)
@@ -1138,7 +1114,7 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node,
significant bit of the pfn. */
branch = last_stmt (bb);
- if (gimple_code (branch) != GIMPLE_COND)
+ if (!branch || gimple_code (branch) != GIMPLE_COND)
return;
if (gimple_cond_code (branch) != NE_EXPR
@@ -1178,7 +1154,8 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node,
return;
index = ipa_get_param_decl_index (info, rec);
- if (index >= 0 && !ipa_is_param_modified (info, index))
+ if (index >= 0 && !is_parm_modified_before_call (&parms_info[index],
+ call, rec))
ipa_note_param_call (node, index, call, false);
return;
@@ -1204,7 +1181,7 @@ ipa_analyze_virtual_call_uses (struct cgraph_node *node,
obj = TREE_OPERAND (obj, 0);
}
while (TREE_CODE (obj) == COMPONENT_REF);
- if (TREE_CODE (obj) != INDIRECT_REF)
+ if (TREE_CODE (obj) != MEM_REF)
return;
obj = TREE_OPERAND (obj, 0);
}
@@ -1221,16 +1198,18 @@ ipa_analyze_virtual_call_uses (struct cgraph_node *node,
}
/* Analyze a call statement CALL whether and how it utilizes formal parameters
- of the caller (described by INFO). */
+ of the caller (described by INFO). PARMS_INFO is a pointer to a vector
+ containing intermediate information about each formal parameter. */
static void
ipa_analyze_call_uses (struct cgraph_node *node,
- struct ipa_node_params *info, gimple call)
+ struct ipa_node_params *info,
+ struct param_analysis_info *parms_info, gimple call)
{
tree target = gimple_call_fn (call);
if (TREE_CODE (target) == SSA_NAME)
- ipa_analyze_indirect_call_uses (node, info, call, target);
+ ipa_analyze_indirect_call_uses (node, info, parms_info, call, target);
else if (TREE_CODE (target) == OBJ_TYPE_REF)
ipa_analyze_virtual_call_uses (node, info, call, target);
}
@@ -1238,45 +1217,120 @@ ipa_analyze_call_uses (struct cgraph_node *node,
/* Analyze the call statement STMT with respect to formal parameters (described
in INFO) of caller given by NODE. Currently it only checks whether formal
- parameters are called. */
+ parameters are called. PARMS_INFO is a pointer to a vector containing
+ intermediate information about each formal parameter. */
static void
ipa_analyze_stmt_uses (struct cgraph_node *node, struct ipa_node_params *info,
- gimple stmt)
+ struct param_analysis_info *parms_info, gimple stmt)
{
if (is_gimple_call (stmt))
- ipa_analyze_call_uses (node, info, stmt);
+ ipa_analyze_call_uses (node, info, parms_info, stmt);
+}
+
+/* Callback of walk_stmt_load_store_addr_ops for the visit_load.
+ If OP is a parameter declaration, mark it as used in the info structure
+ passed in DATA. */
+
+static bool
+visit_ref_for_mod_analysis (gimple stmt ATTRIBUTE_UNUSED,
+ tree op, void *data)
+{
+ struct ipa_node_params *info = (struct ipa_node_params *) data;
+
+ op = get_base_address (op);
+ if (op
+ && TREE_CODE (op) == PARM_DECL)
+ {
+ int index = ipa_get_param_decl_index (info, op);
+ gcc_assert (index >= 0);
+ info->params[index].used = true;
+ }
+
+ return false;
}
/* Scan the function body of NODE and inspect the uses of formal parameters.
Store the findings in various structures of the associated ipa_node_params
- structure, such as parameter flags, notes etc. */
+ structure, such as parameter flags, notes etc. PARMS_INFO is a pointer to a
+ vector containing intermediate information about each formal parameter. */
-void
-ipa_analyze_params_uses (struct cgraph_node *node)
+static void
+ipa_analyze_params_uses (struct cgraph_node *node,
+ struct param_analysis_info *parms_info)
{
tree decl = node->decl;
basic_block bb;
struct function *func;
gimple_stmt_iterator gsi;
struct ipa_node_params *info = IPA_NODE_REF (node);
+ int i;
if (ipa_get_param_count (info) == 0 || info->uses_analysis_done)
return;
+ for (i = 0; i < ipa_get_param_count (info); i++)
+ {
+ tree parm = ipa_get_param (info, i);
+ /* For SSA regs see if parameter is used. For non-SSA we compute
+ the flag during modification analysis. */
+ if (is_gimple_reg (parm)
+ && gimple_default_def (DECL_STRUCT_FUNCTION (node->decl), parm))
+ info->params[i].used = true;
+ }
+
func = DECL_STRUCT_FUNCTION (decl);
FOR_EACH_BB_FN (bb, func)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
- ipa_analyze_stmt_uses (node, info, stmt);
+
+ if (is_gimple_debug (stmt))
+ continue;
+
+ ipa_analyze_stmt_uses (node, info, parms_info, stmt);
+ walk_stmt_load_store_addr_ops (stmt, info,
+ visit_ref_for_mod_analysis,
+ visit_ref_for_mod_analysis,
+ visit_ref_for_mod_analysis);
}
+ for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))
+ walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info,
+ visit_ref_for_mod_analysis,
+ visit_ref_for_mod_analysis,
+ visit_ref_for_mod_analysis);
}
info->uses_analysis_done = 1;
}
+/* Initialize the array describing properties of of formal parameters of NODE,
+ analyze their uses and and compute jump functions associated witu actual
+ arguments of calls from within NODE. */
+
+void
+ipa_analyze_node (struct cgraph_node *node)
+{
+ struct ipa_node_params *info = IPA_NODE_REF (node);
+ struct param_analysis_info *parms_info;
+ int i, param_count;
+
+ ipa_initialize_node_params (node);
+
+ param_count = ipa_get_param_count (info);
+ parms_info = XALLOCAVEC (struct param_analysis_info, param_count);
+ memset (parms_info, 0, sizeof (struct param_analysis_info) * param_count);
+
+ ipa_analyze_params_uses (node, parms_info);
+ ipa_compute_jump_functions (node, parms_info);
+
+ for (i = 0; i < param_count; i++)
+ if (parms_info[i].visited_statements)
+ BITMAP_FREE (parms_info[i].visited_statements);
+}
+
+
/* Update the jump function DST when the call graph edge correspondng to SRC is
is being inlined, knowing that DST is of type ancestor and src of known
type. */
@@ -1696,18 +1750,16 @@ duplicate_array (void *src, size_t n)
return p;
}
-/* Like duplicate_array byt in GGC memory. */
-
-static void *
-duplicate_ggc_array (void *src, size_t n)
+static struct ipa_jump_func *
+duplicate_ipa_jump_func_array (const struct ipa_jump_func * src, size_t n)
{
- void *p;
+ struct ipa_jump_func *p;
if (!src)
return NULL;
- p = ggc_alloc (n);
- memcpy (p, src, n);
+ p = ggc_alloc_vec_ipa_jump_func (n);
+ memcpy (p, src, n * sizeof (struct ipa_jump_func));
return p;
}
@@ -1727,9 +1779,8 @@ ipa_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
arg_count = ipa_get_cs_argument_count (old_args);
ipa_set_cs_argument_count (new_args, arg_count);
- new_args->jump_functions = (struct ipa_jump_func *)
- duplicate_ggc_array (old_args->jump_functions,
- sizeof (struct ipa_jump_func) * arg_count);
+ new_args->jump_functions =
+ duplicate_ipa_jump_func_array (old_args->jump_functions, arg_count);
if (iinlining_processed_edges
&& bitmap_bit_p (iinlining_processed_edges, src->uid))
@@ -1851,8 +1902,6 @@ ipa_print_node_params (FILE * f, struct cgraph_node *node)
(DECL_NAME (temp)
? (*lang_hooks.decl_printable_name) (temp, 2)
: "(unnamed)"));
- if (ipa_is_param_modified (info, i))
- fprintf (f, " modified");
if (ipa_is_param_used (info, i))
fprintf (f, " used");
fprintf (f, "\n");
@@ -2040,6 +2089,13 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
DECL_VINDEX (fndecl) = NULL_TREE;
}
+ /* When signature changes, we need to clear builtin info. */
+ if (DECL_BUILT_IN (fndecl))
+ {
+ DECL_BUILT_IN_CLASS (fndecl) = NOT_BUILT_IN;
+ DECL_FUNCTION_CODE (fndecl) = (enum built_in_function) 0;
+ }
+
/* This is a new type, not a copy of an old type. Need to reassociate
variants. We can handle everything except the main variant lazily. */
t = TYPE_MAIN_VARIANT (orig_type);
@@ -2406,14 +2462,13 @@ ipa_write_indirect_edge_info (struct output_block *ob,
struct cgraph_edge *cs)
{
struct cgraph_indirect_call_info *ii = cs->indirect_info;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
lto_output_sleb128_stream (ob->main_stream, ii->param_index);
lto_output_sleb128_stream (ob->main_stream, ii->anc_offset);
- bp = bitpack_create ();
- bp_pack_value (bp, ii->polymorphic, 1);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, ii->polymorphic, 1);
+ lto_output_bitpack (&bp);
if (ii->polymorphic)
{
@@ -2431,13 +2486,12 @@ ipa_read_indirect_edge_info (struct lto_input_block *ib,
struct cgraph_edge *cs)
{
struct cgraph_indirect_call_info *ii = cs->indirect_info;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
ii->param_index = (int) lto_input_sleb128 (ib);
ii->anc_offset = (HOST_WIDE_INT) lto_input_sleb128 (ib);
bp = lto_input_bitpack (ib);
- ii->polymorphic = bp_unpack_value (bp, 1);
- bitpack_delete (bp);
+ ii->polymorphic = bp_unpack_value (&bp, 1);
if (ii->polymorphic)
{
ii->otr_token = (HOST_WIDE_INT) lto_input_sleb128 (ib);
@@ -2455,26 +2509,21 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
struct ipa_node_params *info = IPA_NODE_REF (node);
int j;
struct cgraph_edge *e;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
encoder = ob->decl_state->cgraph_node_encoder;
node_ref = lto_cgraph_encoder_encode (encoder, node);
lto_output_uleb128_stream (ob->main_stream, node_ref);
- bp = bitpack_create ();
- bp_pack_value (bp, info->called_with_var_arguments, 1);
- bp_pack_value (bp, info->uses_analysis_done, 1);
- gcc_assert (info->modification_analysis_done
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, info->called_with_var_arguments, 1);
+ gcc_assert (info->uses_analysis_done
|| ipa_get_param_count (info) == 0);
gcc_assert (!info->node_enqueued);
gcc_assert (!info->ipcp_orig_node);
for (j = 0; j < ipa_get_param_count (info); j++)
- {
- bp_pack_value (bp, info->params[j].modified, 1);
- bp_pack_value (bp, info->params[j].used, 1);
- }
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp_pack_value (&bp, info->params[j].used, 1);
+ lto_output_bitpack (&bp);
for (e = node->callees; e; e = e->next_callee)
{
struct ipa_edge_args *args = IPA_EDGE_REF (e);
@@ -2497,25 +2546,17 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
struct ipa_node_params *info = IPA_NODE_REF (node);
int k;
struct cgraph_edge *e;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
ipa_initialize_node_params (node);
bp = lto_input_bitpack (ib);
- info->called_with_var_arguments = bp_unpack_value (bp, 1);
- info->uses_analysis_done = bp_unpack_value (bp, 1);
+ info->called_with_var_arguments = bp_unpack_value (&bp, 1);
if (ipa_get_param_count (info) != 0)
- {
- info->modification_analysis_done = true;
- info->uses_analysis_done = true;
- }
+ info->uses_analysis_done = true;
info->node_enqueued = false;
for (k = 0; k < ipa_get_param_count (info); k++)
- {
- info->params[k].modified = bp_unpack_value (bp, 1);
- info->params[k].used = bp_unpack_value (bp, 1);
- }
- bitpack_delete (bp);
+ info->params[k].used = bp_unpack_value (&bp, 1);
for (e = node->callees; e; e = e->next_callee)
{
struct ipa_edge_args *args = IPA_EDGE_REF (e);
@@ -2525,8 +2566,8 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
if (!count)
continue;
- args->jump_functions = GGC_CNEWVEC (struct ipa_jump_func,
- ipa_get_cs_argument_count (args));
+ args->jump_functions = ggc_alloc_cleared_vec_ipa_jump_func
+ (ipa_get_cs_argument_count (args));
for (k = 0; k < ipa_get_cs_argument_count (args); k++)
ipa_read_jump_function (ib, ipa_get_ith_jump_func (args, k), data_in);
}
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 110044e4da4..c73367a4945 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -161,8 +161,6 @@ struct ipa_param_descriptor
struct ipcp_lattice ipcp_lattice;
/* PARAM_DECL of this parameter. */
tree decl;
- /* Whether the value parameter has been modified within the function. */
- unsigned modified : 1;
/* The parameter is used. */
unsigned used : 1;
};
@@ -179,8 +177,6 @@ struct ipa_node_params
/* Whether this function is called with variable number of actual
arguments. */
unsigned called_with_var_arguments : 1;
- /* Whether the modification analysis has already been performed. */
- unsigned modification_analysis_done : 1;
/* Whether the param uses analysis has already been performed. */
unsigned uses_analysis_done : 1;
/* Whether the function is enqueued in an ipa_func_list. */
@@ -228,17 +224,6 @@ ipa_get_param (struct ipa_node_params *info, int i)
return info->params[i].decl;
}
-/* Return the modification flag corresponding to the Ith formal parameter of
- the function associated with INFO. Note that there is no setter method as
- the goal is to set all flags when building the array in
- ipa_detect_param_modifications. */
-
-static inline bool
-ipa_is_param_modified (struct ipa_node_params *info, int i)
-{
- return info->params[i].modified;
-}
-
/* Return the used flag corresponding to the Ith formal parameter of
the function associated with INFO. */
@@ -412,14 +397,10 @@ ipa_push_func_to_list (struct ipa_func_list **wl, struct cgraph_node *node)
ipa_push_func_to_list_1 (wl, node, info);
}
-/* Callsite related calculations. */
-void ipa_compute_jump_functions (struct cgraph_node *);
-void ipa_count_arguments (struct cgraph_edge *);
+void ipa_analyze_node (struct cgraph_node *);
/* Function formal parameters related computations. */
void ipa_initialize_node_params (struct cgraph_node *node);
-void ipa_detect_param_modifications (struct cgraph_node *);
-void ipa_analyze_params_uses (struct cgraph_node *);
bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
VEC (cgraph_edge_p, heap) **new_edges);
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index d785389191a..741742961cb 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -177,6 +177,16 @@ warn_function_const (tree decl, bool known_finite)
= suggest_attribute (OPT_Wsuggest_attribute_const, decl,
known_finite, warned_about, "const");
}
+
+void
+warn_function_noreturn (tree decl)
+{
+ static struct pointer_set_t *warned_about;
+ if (!lang_hooks.missing_noreturn_ok_p (decl))
+ warned_about
+ = suggest_attribute (OPT_Wsuggest_attribute_noreturn, decl,
+ true, warned_about, "noreturn");
+}
/* Init the function state. */
static void
@@ -227,7 +237,7 @@ set_function_state (struct cgraph_node *node, funct_state s)
static inline void
check_decl (funct_state local,
- tree t, bool checking_write)
+ tree t, bool checking_write, bool ipa)
{
/* Do not want to do anything with volatile except mark any
function that uses one to be not const or pure. */
@@ -253,6 +263,11 @@ check_decl (funct_state local,
return;
}
+ /* In IPA mode we are not interested in checking actual loads and stores;
+ they will be processed at propagation time using ipa_ref. */
+ if (ipa)
+ return;
+
/* Since we have dealt with the locals and params cases above, if we
are CHECKING_WRITE, this cannot be a pure or constant
function. */
@@ -309,7 +324,7 @@ check_op (funct_state local, tree t, bool checking_write)
return;
}
else if (t
- && INDIRECT_REF_P (t)
+ && (INDIRECT_REF_P (t) || TREE_CODE (t) == MEM_REF)
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
&& !ptr_deref_may_alias_global_p (TREE_OPERAND (t, 0)))
{
@@ -333,6 +348,112 @@ check_op (funct_state local, tree t, bool checking_write)
}
}
+/* compute state based on ECF FLAGS and store to STATE and LOOPING. */
+
+static void
+state_from_flags (enum pure_const_state_e *state, bool *looping,
+ int flags, bool cannot_lead_to_return)
+{
+ *looping = false;
+ if (flags & ECF_LOOPING_CONST_OR_PURE)
+ {
+ *looping = true;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " looping");
+ }
+ if (flags & ECF_CONST)
+ {
+ *state = IPA_CONST;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " const\n");
+ }
+ else if (flags & ECF_PURE)
+ {
+ *state = IPA_PURE;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " pure\n");
+ }
+ else if (cannot_lead_to_return)
+ {
+ *state = IPA_PURE;
+ *looping = true;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " ignoring side effects->pure looping\n");
+ }
+ else
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " neihter\n");
+ *state = IPA_NEITHER;
+ *looping = true;
+ }
+}
+
+/* Merge STATE and STATE2 and LOOPING and LOOPING2 and store
+ into STATE and LOOPING better of the two variants.
+ Be sure to merge looping correctly. IPA_NEITHER functions
+ have looping 0 even if they don't have to return. */
+
+static inline void
+better_state (enum pure_const_state_e *state, bool *looping,
+ enum pure_const_state_e state2, bool looping2)
+{
+ if (state2 < *state)
+ {
+ if (*state == IPA_NEITHER)
+ *looping = looping2;
+ else
+ *looping = MIN (*looping, looping2);
+ }
+ else if (state2 != IPA_NEITHER)
+ *looping = MIN (*looping, looping2);
+}
+
+/* Merge STATE and STATE2 and LOOPING and LOOPING2 and store
+ into STATE and LOOPING worse of the two variants. */
+
+static inline void
+worse_state (enum pure_const_state_e *state, bool *looping,
+ enum pure_const_state_e state2, bool looping2)
+{
+ *state = MAX (*state, state2);
+ *looping = MAX (*looping, looping2);
+}
+
+/* Recognize special cases of builtins that are by themself not pure or const
+ but function using them is. */
+static bool
+special_builtlin_state (enum pure_const_state_e *state, bool *looping,
+ tree callee)
+{
+ if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (callee))
+ {
+ case BUILT_IN_RETURN:
+ case BUILT_IN_UNREACHABLE:
+ case BUILT_IN_ALLOCA:
+ case BUILT_IN_STACK_SAVE:
+ case BUILT_IN_STACK_RESTORE:
+ case BUILT_IN_EH_POINTER:
+ case BUILT_IN_EH_FILTER:
+ case BUILT_IN_UNWIND_RESUME:
+ case BUILT_IN_CXA_END_CLEANUP:
+ case BUILT_IN_EH_COPY_VALUES:
+ case BUILT_IN_FRAME_ADDRESS:
+ case BUILT_IN_APPLY:
+ case BUILT_IN_APPLY_ARGS:
+ case BUILT_IN_ARGS_INFO:
+ *looping = false;
+ *state = IPA_CONST;
+ return true;
+ case BUILT_IN_PREFETCH:
+ *looping = true;
+ *state = IPA_CONST;
+ return true;
+ }
+ return false;
+}
+
/* Check the parameters of a function call to CALL_EXPR to see if
there are any references in the parameters that are not allowed for
pure or const functions. Also check to see if this is either an
@@ -383,9 +504,15 @@ check_call (funct_state local, gimple call, bool ipa)
graph. */
if (callee_t)
{
- /* built_in_return is really just an return statemnt. */
- if (gimple_call_builtin_p (call, BUILT_IN_RETURN))
- return;
+ enum pure_const_state_e call_state;
+ bool call_looping;
+
+ if (special_builtlin_state (&call_state, &call_looping, callee_t))
+ {
+ worse_state (&local->pure_const_state, &local->looping,
+ call_state, call_looping);
+ return;
+ }
/* When bad things happen to bad functions, they cannot be const
or pure. */
if (setjmp_call_p (callee_t))
@@ -422,8 +549,10 @@ check_call (funct_state local, gimple call, bool ipa)
Look to see if there are any bits available for the callee (such as by
declaration or because it is builtin) and process solely on the basis of
those bits. */
- else if (!ipa || !callee_t)
+ else if (!ipa)
{
+ enum pure_const_state_e call_state;
+ bool call_looping;
if (possibly_throws && cfun->can_throw_non_call_exceptions)
{
if (dump_file)
@@ -442,68 +571,61 @@ check_call (funct_state local, gimple call, bool ipa)
}
local->can_throw = true;
}
- if (flags & ECF_CONST)
- {
- if (callee_t && DECL_LOOPING_CONST_OR_PURE_P (callee_t))
- {
- if (dump_file)
- fprintf (dump_file, " calls looping pure.\n");
- local->looping = true;
- }
- }
- else if (flags & ECF_PURE)
- {
- if (callee_t && DECL_LOOPING_CONST_OR_PURE_P (callee_t))
- {
- if (dump_file)
- fprintf (dump_file, " calls looping const.\n");
- local->looping = true;
- }
- if (dump_file)
- fprintf (dump_file, " pure function call in not const\n");
- if (local->pure_const_state == IPA_CONST)
- local->pure_const_state = IPA_PURE;
- }
- else if ((flags & (ECF_NORETURN | ECF_NOTHROW))
- == (ECF_NORETURN | ECF_NOTHROW)
- || (!flag_exceptions && (flags & ECF_NORETURN)))
- {
- if (dump_file)
- fprintf (dump_file, " noreturn nothrow call is looping pure\n");
- if (local->pure_const_state == IPA_CONST)
- local->pure_const_state = IPA_PURE;
- local->looping = true;
- }
- else
- {
- if (dump_file)
- fprintf (dump_file, " uknown function call is not const/pure\n");
- local->pure_const_state = IPA_NEITHER;
- local->looping = true;
- }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " checking flags for call:");
+ state_from_flags (&call_state, &call_looping, flags,
+ ((flags & (ECF_NORETURN | ECF_NOTHROW))
+ == (ECF_NORETURN | ECF_NOTHROW))
+ || (!flag_exceptions && (flags & ECF_NORETURN)));
+ worse_state (&local->pure_const_state, &local->looping,
+ call_state, call_looping);
}
/* Direct functions calls are handled by IPA propagation. */
}
-/* Wrapper around check_decl for loads. */
+/* Wrapper around check_decl for loads in local more. */
static bool
check_load (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data)
{
if (DECL_P (op))
- check_decl ((funct_state)data, op, false);
+ check_decl ((funct_state)data, op, false, false);
else
check_op ((funct_state)data, op, false);
return false;
}
-/* Wrapper around check_decl for stores. */
+/* Wrapper around check_decl for stores in local more. */
static bool
check_store (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data)
{
if (DECL_P (op))
- check_decl ((funct_state)data, op, true);
+ check_decl ((funct_state)data, op, true, false);
+ else
+ check_op ((funct_state)data, op, true);
+ return false;
+}
+
+/* Wrapper around check_decl for loads in ipa mode. */
+
+static bool
+check_ipa_load (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data)
+{
+ if (DECL_P (op))
+ check_decl ((funct_state)data, op, false, true);
+ else
+ check_op ((funct_state)data, op, false);
+ return false;
+}
+
+/* Wrapper around check_decl for stores in ipa mode. */
+
+static bool
+check_ipa_store (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data)
+{
+ if (DECL_P (op))
+ check_decl ((funct_state)data, op, true, true);
else
check_op ((funct_state)data, op, true);
return false;
@@ -527,7 +649,9 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
}
/* Look for loads and stores. */
- walk_stmt_load_store_ops (stmt, local, check_load, check_store);
+ walk_stmt_load_store_ops (stmt, local,
+ ipa ? check_ipa_load : check_load,
+ ipa ? check_ipa_store : check_store);
if (gimple_code (stmt) != GIMPLE_CALL
&& stmt_could_throw_p (stmt))
@@ -669,21 +793,15 @@ end:
}
}
- if (TREE_READONLY (decl))
- {
- l->pure_const_state = IPA_CONST;
- l->state_previously_known = IPA_CONST;
- if (!DECL_LOOPING_CONST_OR_PURE_P (decl))
- l->looping = false, l->looping_previously_known = false;
- }
- if (DECL_PURE_P (decl))
- {
- if (l->pure_const_state != IPA_CONST)
- l->pure_const_state = IPA_PURE;
- l->state_previously_known = IPA_PURE;
- if (!DECL_LOOPING_CONST_OR_PURE_P (decl))
- l->looping = false, l->looping_previously_known = false;
- }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " checking previously known:");
+ state_from_flags (&l->state_previously_known, &l->looping_previously_known,
+ flags_from_decl_or_type (fn->decl),
+ cgraph_node_cannot_return (fn));
+
+ better_state (&l->pure_const_state, &l->looping,
+ l->state_previously_known,
+ l->looping_previously_known);
if (TREE_NOTHROW (decl))
l->can_throw = false;
@@ -825,7 +943,7 @@ pure_const_write_summary (cgraph_node_set set,
node = csi_node (csi);
if (node->analyzed && has_function_state (node))
{
- struct bitpack_d *bp;
+ struct bitpack_d bp;
funct_state fs;
int node_ref;
lto_cgraph_encoder_t encoder;
@@ -838,14 +956,13 @@ pure_const_write_summary (cgraph_node_set set,
/* Note that flags will need to be read in the opposite
order as we are pushing the bitflags into FLAGS. */
- bp = bitpack_create ();
- bp_pack_value (bp, fs->pure_const_state, 2);
- bp_pack_value (bp, fs->state_previously_known, 2);
- bp_pack_value (bp, fs->looping_previously_known, 1);
- bp_pack_value (bp, fs->looping, 1);
- bp_pack_value (bp, fs->can_throw, 1);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, fs->pure_const_state, 2);
+ bp_pack_value (&bp, fs->state_previously_known, 2);
+ bp_pack_value (&bp, fs->looping_previously_known, 1);
+ bp_pack_value (&bp, fs->looping, 1);
+ bp_pack_value (&bp, fs->can_throw, 1);
+ lto_output_bitpack (&bp);
}
}
@@ -880,7 +997,7 @@ pure_const_read_summary (void)
{
unsigned int index;
struct cgraph_node *node;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
funct_state fs;
lto_cgraph_encoder_t encoder;
@@ -895,12 +1012,12 @@ pure_const_read_summary (void)
pushed into FLAGS). */
bp = lto_input_bitpack (ib);
fs->pure_const_state
- = (enum pure_const_state_e) bp_unpack_value (bp, 2);
+ = (enum pure_const_state_e) bp_unpack_value (&bp, 2);
fs->state_previously_known
- = (enum pure_const_state_e) bp_unpack_value (bp, 2);
- fs->looping_previously_known = bp_unpack_value (bp, 1);
- fs->looping = bp_unpack_value (bp, 1);
- fs->can_throw = bp_unpack_value (bp, 1);
+ = (enum pure_const_state_e) bp_unpack_value (&bp, 2);
+ fs->looping_previously_known = bp_unpack_value (&bp, 1);
+ fs->looping = bp_unpack_value (&bp, 1);
+ fs->can_throw = bp_unpack_value (&bp, 1);
if (dump_file)
{
int flags = flags_from_decl_or_type (node->decl);
@@ -924,7 +1041,6 @@ pure_const_read_summary (void)
if (fs->can_throw)
fprintf (dump_file," function is locally throwing\n");
}
- bitpack_delete (bp);
}
lto_destroy_simple_input_block (file_data,
@@ -953,13 +1069,11 @@ self_recursive_p (struct cgraph_node *node)
return false;
}
-/* Produce the global information by preforming a transitive closure
- on the local information that was produced by generate_summary.
- Note that there is no function_transform pass since this only
- updates the function_decl. */
+/* Produce transitive closure over the callgraph and compute pure/const
+ attributes. */
-static unsigned int
-propagate (void)
+static void
+propagate_pure_const (void)
{
struct cgraph_node *node;
struct cgraph_node *w;
@@ -969,9 +1083,6 @@ propagate (void)
int i;
struct ipa_dfs_info * w_info;
- cgraph_remove_function_insertion_hook (function_insertion_hook_holder);
- cgraph_remove_node_duplication_hook (node_duplication_hook_holder);
- cgraph_remove_node_removal_hook (node_removal_hook_holder);
order_pos = ipa_utils_reduced_inorder (order, true, false, NULL);
if (dump_file)
{
@@ -995,9 +1106,13 @@ propagate (void)
/* Find the worst state for any node in the cycle. */
w = node;
- while (w)
+ while (w && pure_const_state != IPA_NEITHER)
{
struct cgraph_edge *e;
+ struct cgraph_edge *ie;
+ int i;
+ struct ipa_ref *ref;
+
funct_state w_l = get_function_state (w);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Visiting %s/%i state:%s looping %i\n",
@@ -1005,16 +1120,19 @@ propagate (void)
w->uid,
pure_const_names[w_l->pure_const_state],
w_l->looping);
- if (pure_const_state < w_l->pure_const_state)
- pure_const_state = w_l->pure_const_state;
- if (w_l->looping)
- looping = true;
+ /* First merge in function body properties. */
+ worse_state (&pure_const_state, &looping,
+ w_l->pure_const_state, w_l->looping);
+ if (pure_const_state == IPA_NEITHER)
+ break;
+
+ /* For overwritable nodes we can not assume anything. */
if (cgraph_function_body_availability (w) == AVAIL_OVERWRITABLE)
{
- looping |= w_l->looping_previously_known;
- if (pure_const_state < w_l->state_previously_known)
- pure_const_state = w_l->state_previously_known;
+ worse_state (&pure_const_state, &looping,
+ w_l->state_previously_known,
+ w_l->looping_previously_known);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file,
@@ -1022,16 +1140,18 @@ propagate (void)
pure_const_names[w_l->state_previously_known],
w_l->looping_previously_known);
}
+ break;
}
- if (pure_const_state == IPA_NEITHER)
- break;
-
count++;
+ /* We consider recursive cycles as possibly infinite.
+ This might be relaxed since infinite recursion leads to stack
+ overflow. */
if (count > 1)
looping = true;
+ /* Now walk the edges and merge in callee properties. */
for (e = w->callees; e; e = e->next_callee)
{
struct cgraph_node *y = e->callee;
@@ -1055,14 +1175,13 @@ propagate (void)
pure_const_names[y_l->pure_const_state],
y_l->looping);
}
- if (y_l->pure_const_state > ECF_PURE
+ if (y_l->pure_const_state > IPA_PURE
&& cgraph_edge_cannot_lead_to_return (e))
{
if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file,
- " Ignoring side effects -> pure, looping\n");
- }
+ fprintf (dump_file,
+ " Ignoring side effects"
+ " -> pure, looping\n");
edge_state = IPA_PURE;
edge_looping = true;
}
@@ -1072,49 +1191,82 @@ propagate (void)
edge_looping = y_l->looping;
}
}
+ else if (special_builtlin_state (&edge_state, &edge_looping,
+ y->decl))
+ ;
else
- {
- int flags = flags_from_decl_or_type (y->decl);
+ state_from_flags (&edge_state, &edge_looping,
+ flags_from_decl_or_type (y->decl),
+ cgraph_edge_cannot_lead_to_return (e));
+
+ /* Merge the results with what we already know. */
+ better_state (&edge_state, &edge_looping,
+ w_l->state_previously_known,
+ w_l->looping_previously_known);
+ worse_state (&pure_const_state, &looping,
+ edge_state, edge_looping);
+ if (pure_const_state == IPA_NEITHER)
+ break;
+ }
+ if (pure_const_state == IPA_NEITHER)
+ break;
- if (flags & ECF_LOOPING_CONST_OR_PURE)
- {
- edge_looping = true;
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " unavailable looping");
- }
- if (flags & ECF_CONST)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " const\n");
- }
- else if (flags & ECF_PURE)
- {
- edge_state = IPA_PURE;
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " pure\n");
- }
- else if (cgraph_edge_cannot_lead_to_return (e))
- {
- edge_state = IPA_PURE;
- edge_looping = true;
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " ignoring side effects->pure looping\n");
- }
- else
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " neihter\n");
- edge_state = IPA_NEITHER;
- edge_looping = true;
- }
- }
- pure_const_state = MAX (pure_const_state, MIN (edge_state,
- w_l->state_previously_known));
- looping = MAX (looping, MIN (edge_looping,
- w_l->looping_previously_known));
+ /* Now process the indirect call. */
+ for (ie = node->indirect_calls; ie; ie = ie->next_callee)
+ {
+ enum pure_const_state_e edge_state = IPA_CONST;
+ bool edge_looping = false;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " Indirect call");
+ state_from_flags (&edge_state, &edge_looping,
+ ie->indirect_info->ecf_flags,
+ cgraph_edge_cannot_lead_to_return (ie));
+ /* Merge the results with what we already know. */
+ better_state (&edge_state, &edge_looping,
+ w_l->state_previously_known,
+ w_l->looping_previously_known);
+ worse_state (&pure_const_state, &looping,
+ edge_state, edge_looping);
if (pure_const_state == IPA_NEITHER)
break;
}
+ if (pure_const_state == IPA_NEITHER)
+ break;
+
+ /* And finally all loads and stores. */
+ for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++)
+ {
+ enum pure_const_state_e ref_state = IPA_CONST;
+ bool ref_looping = false;
+ switch (ref->use)
+ {
+ case IPA_REF_LOAD:
+ /* readonly reads are safe. */
+ if (TREE_READONLY (ipa_ref_varpool_node (ref)->decl))
+ break;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " nonreadonly global var read\n");
+ ref_state = IPA_PURE;
+ break;
+ case IPA_REF_STORE:
+ if (ipa_ref_cannot_lead_to_return (ref))
+ break;
+ ref_state = IPA_NEITHER;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " global var write\n");
+ break;
+ case IPA_REF_ADDR:
+ break;
+ }
+ better_state (&ref_state, &ref_looping,
+ w_l->state_previously_known,
+ w_l->looping_previously_known);
+ worse_state (&pure_const_state, &looping,
+ ref_state, ref_looping);
+ if (pure_const_state == IPA_NEITHER)
+ break;
+ }
w_info = (struct ipa_dfs_info *) w->aux;
w = w_info->next_cycle;
}
@@ -1134,7 +1286,10 @@ propagate (void)
if (w_l->state_previously_known != IPA_NEITHER
&& this_state > w_l->state_previously_known)
- this_state = w_l->state_previously_known;
+ {
+ this_state = w_l->state_previously_known;
+ this_looping |= w_l->looping_previously_known;
+ }
if (!this_looping && self_recursive_p (w))
this_looping = true;
if (!w_l->looping_previously_known)
@@ -1191,12 +1346,31 @@ propagate (void)
node->aux = NULL;
}
}
+
+ free (order);
+}
+
+/* Produce transitive closure over the callgraph and compute nothrow
+ attributes. */
+
+static void
+propagate_nothrow (void)
+{
+ struct cgraph_node *node;
+ struct cgraph_node *w;
+ struct cgraph_node **order =
+ XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
+ int order_pos;
+ int i;
+ struct ipa_dfs_info * w_info;
+
order_pos = ipa_utils_reduced_inorder (order, true, false, ignore_edge);
if (dump_file)
{
dump_cgraph (dump_file);
ipa_utils_print_order(dump_file, "reduced for nothrow", order, order_pos);
}
+
/* Propagate the local information thru the call graph to produce
the global information. All the nodes within a cycle will have
the same info so we collapse cycles first. Then we can do the
@@ -1210,7 +1384,7 @@ propagate (void)
w = node;
while (w)
{
- struct cgraph_edge *e;
+ struct cgraph_edge *e, *ie;
funct_state w_l = get_function_state (w);
if (w_l->can_throw
@@ -1237,6 +1411,9 @@ propagate (void)
else if (e->can_throw_external && !TREE_NOTHROW (y->decl))
can_throw = true;
}
+ for (ie = node->indirect_calls; ie; ie = ie->next_callee)
+ if (ie->can_throw_external)
+ can_throw = true;
w_info = (struct ipa_dfs_info *) w->aux;
w = w_info->next_cycle;
}
@@ -1274,12 +1451,33 @@ propagate (void)
free (node->aux);
node->aux = NULL;
}
- if (cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE
- && has_function_state (node))
- free (get_function_state (node));
}
free (order);
+}
+
+
+/* Produce the global information by preforming a transitive closure
+ on the local information that was produced by generate_summary. */
+
+static unsigned int
+propagate (void)
+{
+ struct cgraph_node *node;
+
+ cgraph_remove_function_insertion_hook (function_insertion_hook_holder);
+ cgraph_remove_node_duplication_hook (node_duplication_hook_holder);
+ cgraph_remove_node_removal_hook (node_removal_hook_holder);
+
+ /* Nothrow makes more function to not lead to return and improve
+ later analysis. */
+ propagate_nothrow ();
+ propagate_pure_const ();
+
+ /* Cleanup. */
+ for (node = cgraph_nodes; node; node = node->next)
+ if (has_function_state (node))
+ free (get_function_state (node));
VEC_free (funct_state, heap, funct_state_vec);
finish_state ();
return 0;
@@ -1367,11 +1565,7 @@ local_pure_const (void)
if (!skip && !TREE_THIS_VOLATILE (current_function_decl)
&& EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0)
{
- if (warn_missing_noreturn
- && !lang_hooks.missing_noreturn_ok_p (cfun->decl))
- warning_at (DECL_SOURCE_LOCATION (cfun->decl), OPT_Wmissing_noreturn,
- "function might be possible candidate "
- "for attribute %<noreturn%>");
+ warn_function_noreturn (cfun->decl);
if (dump_file)
fprintf (dump_file, "Function found to be noreturn: %s\n",
lang_hooks.decl_printable_name (current_function_decl, 2));
diff --git a/gcc/ipa-ref.c b/gcc/ipa-ref.c
index dd6b009ce58..27c32dcd3d6 100644
--- a/gcc/ipa-ref.c
+++ b/gcc/ipa-ref.c
@@ -233,3 +233,11 @@ ipa_clone_refering (struct cgraph_node *dest_node,
dest_node, dest_varpool_node,
ref->use, ref->stmt);
}
+
+/* Return true when execution of REF can load to return from
+ function. */
+bool
+ipa_ref_cannot_lead_to_return (struct ipa_ref *ref)
+{
+ return cgraph_node_cannot_return (ipa_ref_refering_node (ref));
+}
diff --git a/gcc/ipa-ref.h b/gcc/ipa-ref.h
index 98912db1851..2be73536f8e 100644
--- a/gcc/ipa-ref.h
+++ b/gcc/ipa-ref.h
@@ -88,4 +88,5 @@ void ipa_dump_references (FILE *, struct ipa_ref_list *);
void ipa_dump_refering (FILE *, struct ipa_ref_list *);
void ipa_clone_references (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
void ipa_clone_refering (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
+bool ipa_ref_cannot_lead_to_return (struct ipa_ref *);
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 2fc9bed2cab..64ccb4ead27 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -74,14 +74,6 @@ struct ipa_reference_local_vars_info_d
{
bitmap statics_read;
bitmap statics_written;
-
- /* Set when this function calls another function external to the
- compilation unit or if the function has a asm clobber of memory.
- In general, such calls are modeled as reading and writing all
- variables (both bits on) but sometime there are attributes on the
- called function so we can do better. */
- bool calls_read_all;
- bool calls_write_all;
};
/* Statics that are read and written by some set of functions. The
@@ -160,7 +152,7 @@ get_reference_optimization_summary (struct cgraph_node *node)
{
if (!ipa_reference_opt_sum_vector
|| (VEC_length (ipa_reference_optimization_summary_t,
- ipa_reference_opt_sum_vector)
+ ipa_reference_opt_sum_vector)
<= (unsigned int) node->uid))
return NULL;
return VEC_index (ipa_reference_optimization_summary_t, ipa_reference_opt_sum_vector,
@@ -254,6 +246,7 @@ is_proper_for_analysis (tree t)
/* We handle only variables whose address is never taken. */
if (TREE_ADDRESSABLE (t))
return false;
+
/* If the variable has the "used" attribute, treat it as if it had a
been touched by the devil. */
if (DECL_PRESERVE_P (t))
@@ -264,6 +257,11 @@ is_proper_for_analysis (tree t)
if (TREE_THIS_VOLATILE (t))
return false;
+ /* We do not need to analyze readonly vars, we already know they do not
+ alias. */
+ if (TREE_READONLY (t))
+ return false;
+
/* We cannot touch decls where the type needs constructing. */
if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (t)))
return false;
@@ -305,6 +303,7 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x
/* Only look into nodes we can propagate something. */
if (cgraph_function_body_availability (e->callee) > AVAIL_OVERWRITABLE)
{
+ int flags = flags_from_decl_or_type (e->callee->decl);
if (get_reference_vars_info (y))
{
ipa_reference_vars_info_t y_info
@@ -315,6 +314,11 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x
if (!y_global->statics_read)
continue;
+ /* If function is declared const, it reads no memory even if it
+ seems so to local analysis. */
+ if (flags & ECF_CONST)
+ continue;
+
if (x_global->statics_read
!= all_module_statics)
{
@@ -333,6 +337,13 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x
y_global->statics_read);
}
+ /* If function is declared pure, it has no stores even if it
+ seems so to local analysis; If we can not return from here,
+ we can safely ignore the call. */
+ if ((flags & ECF_PURE)
+ || cgraph_edge_cannot_lead_to_return (e))
+ continue;
+
if (x_global->statics_written
!= all_module_statics)
{
@@ -374,7 +385,7 @@ ipa_init (void)
bitmap_obstack_initialize (&local_info_obstack);
bitmap_obstack_initialize (&optimization_summary_obstack);
- all_module_statics = BITMAP_ALLOC (&local_info_obstack);
+ all_module_statics = BITMAP_ALLOC (&optimization_summary_obstack);
node_removal_hook_holder =
cgraph_add_node_removal_hook (&remove_node_data, NULL);
@@ -411,20 +422,8 @@ analyze_function (struct cgraph_node *fn)
struct ipa_ref *ref;
int i;
tree var;
- struct cgraph_edge *ie;
local = init_function_info (fn);
- /* Process indirect calls. All direct calles are handled at propagation
- time. */
- for (ie = fn->indirect_calls; ie; ie = ie->next_callee)
- if (!(ie->indirect_info->ecf_flags & ECF_CONST))
- {
- local->calls_read_all = true;
- if (!(ie->indirect_info->ecf_flags & ECF_PURE)
- && ((ie->indirect_info->ecf_flags & (ECF_NOTHROW | ECF_NORETURN))
- != (ECF_NOTHROW | ECF_NORETURN)))
- local->calls_write_all = true;
- }
for (i = 0; ipa_ref_list_reference_iterate (&fn->ref_list, i, ref); i++)
{
if (ref->refered_type != IPA_REF_VARPOOL)
@@ -440,25 +439,18 @@ analyze_function (struct cgraph_node *fn)
bitmap_set_bit (local->statics_read, DECL_UID (var));
break;
case IPA_REF_STORE:
+ if (ipa_ref_cannot_lead_to_return (ref))
+ break;
bitmap_set_bit (local->statics_written, DECL_UID (var));
break;
case IPA_REF_ADDR:
+ gcc_unreachable ();
break;
}
}
- if ((flags_from_decl_or_type (fn->decl) & (ECF_NOTHROW | ECF_NORETURN))
- == (ECF_NOTHROW | ECF_NORETURN))
- {
- local->calls_write_all = false;
- bitmap_clear (local->statics_written);
- }
-
- /* Free bitmaps of direct references if we can not use them anyway. */
- if (local->calls_write_all)
- BITMAP_FREE (local->statics_written);
- if (local->calls_read_all)
- BITMAP_FREE (local->statics_read);
+ if (cgraph_node_cannot_return (fn))
+ bitmap_clear (local->statics_written);
}
static bitmap
@@ -467,6 +459,8 @@ copy_global_bitmap (bitmap src)
bitmap dst;
if (!src)
return NULL;
+ if (src == all_module_statics)
+ return all_module_statics;
dst = BITMAP_ALLOC (&optimization_summary_obstack);
bitmap_copy (dst, src);
return dst;
@@ -568,33 +562,28 @@ generate_summary (void)
fprintf(dump_file, "%s ",
get_static_name (index));
}
- if (l->calls_read_all)
- fprintf (dump_file, "\n calls read all: ");
- if (l->calls_write_all)
- fprintf (dump_file, "\n calls read all: ");
}
}
-/* Set READ_ALL/WRITE_ALL based on DECL flags. */
+/* Set READ_ALL/WRITE_ALL based on decl flags of NODE. */
static void
-read_write_all_from_decl (tree decl, bool * read_all, bool * write_all)
+read_write_all_from_decl (struct cgraph_node *node, bool * read_all,
+ bool * write_all)
{
+ tree decl = node->decl;
int flags = flags_from_decl_or_type (decl);
if (flags & ECF_CONST)
;
- else if (flags & ECF_PURE)
+ else if ((flags & ECF_PURE)
+ || cgraph_node_cannot_return (node))
*read_all = true;
else
{
/* TODO: To be able to produce sane results, we should also handle
common builtins, in particular throw. */
*read_all = true;
- /* When function does not return, it is safe to ignore anythign it writes
- to, because the effect will never happen. */
- if ((flags & (ECF_NOTHROW | ECF_NORETURN))
- != (ECF_NOTHROW | ECF_NORETURN))
- *write_all = true;
+ *write_all = true;
}
}
@@ -630,7 +619,7 @@ propagate (void)
ipa_reference_vars_info_t node_info;
ipa_reference_global_vars_info_t node_g;
ipa_reference_local_vars_info_t node_l;
- struct cgraph_edge *e;
+ struct cgraph_edge *e, *ie;
bool read_all;
bool write_all;
@@ -638,47 +627,54 @@ propagate (void)
node = order[i];
node_info = get_reference_vars_info (node);
- if (!node_info)
- {
- dump_cgraph_node (stderr, node);
- dump_cgraph (stderr);
- gcc_unreachable ();
- }
+ gcc_assert (node_info);
node_l = &node_info->local;
node_g = &node_info->global;
- read_all = node_l->calls_read_all;
- write_all = node_l->calls_write_all;
+ read_all = false;
+ write_all = false;
/* When function is overwrittable, we can not assume anything. */
if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
- read_write_all_from_decl (node->decl, &read_all, &write_all);
+ read_write_all_from_decl (node, &read_all, &write_all);
for (e = node->callees; e; e = e->next_callee)
if (cgraph_function_body_availability (e->callee) <= AVAIL_OVERWRITABLE)
- read_write_all_from_decl (e->callee->decl, &read_all, &write_all);
+ read_write_all_from_decl (e->callee, &read_all, &write_all);
+
+ for (ie = node->indirect_calls; ie; ie = ie->next_callee)
+ if (!(ie->indirect_info->ecf_flags & ECF_CONST))
+ {
+ read_all = true;
+ if (!cgraph_edge_cannot_lead_to_return (ie)
+ && !(ie->indirect_info->ecf_flags & ECF_PURE))
+ write_all = true;
+ }
- /* If any node in a cycle is calls_read_all or calls_write_all
+ /* If any node in a cycle is read_all or write_all
they all are. */
w_info = (struct ipa_dfs_info *) node->aux;
w = w_info->next_cycle;
- while (w)
+ while (w && (!read_all || !write_all))
{
- ipa_reference_local_vars_info_t w_l =
- &get_reference_vars_info (w)->local;
-
/* When function is overwrittable, we can not assume anything. */
if (cgraph_function_body_availability (w) <= AVAIL_OVERWRITABLE)
- read_write_all_from_decl (w->decl, &read_all, &write_all);
+ read_write_all_from_decl (w, &read_all, &write_all);
for (e = w->callees; e; e = e->next_callee)
if (cgraph_function_body_availability (e->callee) <= AVAIL_OVERWRITABLE)
- read_write_all_from_decl (e->callee->decl, &read_all, &write_all);
+ read_write_all_from_decl (e->callee, &read_all, &write_all);
- read_all |= w_l->calls_read_all;
- write_all |= w_l->calls_write_all;
+ for (ie = w->indirect_calls; ie; ie = ie->next_callee)
+ if (!(ie->indirect_info->ecf_flags & ECF_CONST))
+ {
+ read_all = true;
+ if (!cgraph_edge_cannot_lead_to_return (ie)
+ && !(ie->indirect_info->ecf_flags & ECF_PURE))
+ write_all = true;
+ }
w_info = (struct ipa_dfs_info *) w->aux;
w = w_info->next_cycle;
@@ -706,20 +702,23 @@ propagate (void)
propagate_bits (node_g, node);
w_info = (struct ipa_dfs_info *) node->aux;
w = w_info->next_cycle;
- while (w)
+ while (w && (!read_all || !write_all))
{
ipa_reference_vars_info_t w_ri =
get_reference_vars_info (w);
ipa_reference_local_vars_info_t w_l = &w_ri->local;
+ int flags = flags_from_decl_or_type (w->decl);
/* These global bitmaps are initialized from the local info
of all of the nodes in the region. However there is no
need to do any work if the bitmaps were set to
all_module_statics. */
- if (!read_all)
+ if (!read_all && !(flags & ECF_CONST))
bitmap_ior_into (node_g->statics_read,
w_l->statics_read);
- if (!write_all)
+ if (!write_all
+ && !(flags & ECF_PURE)
+ && !cgraph_node_cannot_return (w))
bitmap_ior_into (node_g->statics_written,
w_l->statics_written);
propagate_bits (node_g, w);
@@ -850,19 +849,30 @@ propagate (void)
set_reference_optimization_summary (node, opt);
/* Create the complimentary sets. */
- opt->statics_not_read = BITMAP_ALLOC (&optimization_summary_obstack);
- opt->statics_not_written = BITMAP_ALLOC (&optimization_summary_obstack);
-
- if (node_g->statics_read != all_module_statics)
- bitmap_and_compl (opt->statics_not_read,
- all_module_statics,
- node_g->statics_read);
-
- if (node_g->statics_written
- != all_module_statics)
- bitmap_and_compl (opt->statics_not_written,
- all_module_statics,
- node_g->statics_written);
+
+ if (bitmap_empty_p (node_g->statics_read))
+ opt->statics_not_read = all_module_statics;
+ else
+ {
+ opt->statics_not_read
+ = BITMAP_ALLOC (&optimization_summary_obstack);
+ if (node_g->statics_read != all_module_statics)
+ bitmap_and_compl (opt->statics_not_read,
+ all_module_statics,
+ node_g->statics_read);
+ }
+
+ if (bitmap_empty_p (node_g->statics_written))
+ opt->statics_not_written = all_module_statics;
+ else
+ {
+ opt->statics_not_written
+ = BITMAP_ALLOC (&optimization_summary_obstack);
+ if (node_g->statics_written != all_module_statics)
+ bitmap_and_compl (opt->statics_not_written,
+ all_module_statics,
+ node_g->statics_written);
+ }
}
if (node_info)
free (node_info);
@@ -881,7 +891,6 @@ propagate (void)
if (dump_file)
splay_tree_delete (reference_vars_to_consider);
reference_vars_to_consider = NULL;
- all_module_statics = NULL;
return 0;
}
@@ -920,18 +929,32 @@ write_node_summary_p (struct cgraph_node *node,
return true;
}
-/* Stream out BITS&LTRANS_STATICS as list of decls to OB. */
+/* Stream out BITS&LTRANS_STATICS as list of decls to OB.
+ LTRANS_STATICS_BITCOUNT specify number of bits in LTRANS_STATICS
+ or -1. When it is positive, just output -1 when
+ BITS&LTRANS_STATICS == BITS&LTRANS_STATICS. */
static void
stream_out_bitmap (struct lto_simple_output_block *ob,
- bitmap bits, bitmap ltrans_statics)
+ bitmap bits, bitmap ltrans_statics,
+ int ltrans_statics_bitcount)
{
- unsigned int count = 0;
+ int count = 0;
unsigned int index;
bitmap_iterator bi;
+ if (bits == all_module_statics)
+ {
+ lto_output_sleb128_stream (ob->main_stream, -1);
+ return;
+ }
EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
count ++;
- lto_output_uleb128_stream (ob->main_stream, count);
+ if (count == ltrans_statics_bitcount)
+ {
+ lto_output_sleb128_stream (ob->main_stream, -1);
+ return;
+ }
+ lto_output_sleb128_stream (ob->main_stream, count);
if (!count)
return;
EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
@@ -948,47 +971,65 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
varpool_node_set vset)
{
struct cgraph_node *node;
- struct varpool_node *vnode;
struct lto_simple_output_block *ob
= lto_create_simple_output_block (LTO_section_ipa_reference);
unsigned int count = 0;
+ int ltrans_statics_bitcount = 0;
lto_cgraph_encoder_t encoder = ob->decl_state->cgraph_node_encoder;
+ lto_varpool_encoder_t varpool_encoder = ob->decl_state->varpool_node_encoder;
bitmap ltrans_statics = BITMAP_ALLOC (NULL);
+ int i;
reference_vars_to_consider = splay_tree_new (splay_tree_compare_ints, 0, 0);
/* See what variables we are interested in. */
- for (vnode = varpool_nodes; vnode; vnode = vnode->next)
- if (!vnode->externally_visible
- && vnode->analyzed
- && is_proper_for_analysis (vnode->decl)
- && referenced_from_this_partition_p (&vnode->ref_list, set, vset))
- {
- tree decl = vnode->decl;
- bitmap_set_bit (ltrans_statics, DECL_UID (decl));
- splay_tree_insert (reference_vars_to_consider,
- DECL_UID (decl), (splay_tree_value)decl);
- }
+ for (i = 0; i < lto_varpool_encoder_size (varpool_encoder); i++)
+ {
+ struct varpool_node *vnode = lto_varpool_encoder_deref (varpool_encoder, i);
+ if (!vnode->externally_visible
+ && vnode->analyzed
+ && bitmap_bit_p (all_module_statics, DECL_UID (vnode->decl))
+ && referenced_from_this_partition_p (&vnode->ref_list, set, vset))
+ {
+ tree decl = vnode->decl;
+ bitmap_set_bit (ltrans_statics, DECL_UID (decl));
+ splay_tree_insert (reference_vars_to_consider,
+ DECL_UID (decl), (splay_tree_value)decl);
+ ltrans_statics_bitcount ++;
+ }
+ }
- for (node = cgraph_nodes; node; node = node->next)
- if (write_node_summary_p (node, set, vset, ltrans_statics))
- count++;
+
+ if (ltrans_statics_bitcount)
+ for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
+ if (write_node_summary_p (lto_cgraph_encoder_deref (encoder, i),
+ set, vset, ltrans_statics))
+ count++;
lto_output_uleb128_stream (ob->main_stream, count);
+ if (count)
+ stream_out_bitmap (ob, ltrans_statics, ltrans_statics,
+ -1);
/* Process all of the functions. */
- for (node = cgraph_nodes; node; node = node->next)
- if (write_node_summary_p (node, set, vset, ltrans_statics))
+ if (ltrans_statics_bitcount)
+ for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
{
- ipa_reference_optimization_summary_t info;
- int node_ref;
-
- info = get_reference_optimization_summary (node);
- node_ref = lto_cgraph_encoder_encode (encoder, node);
- lto_output_uleb128_stream (ob->main_stream, node_ref);
-
- stream_out_bitmap (ob, info->statics_not_read, ltrans_statics);
- stream_out_bitmap (ob, info->statics_not_written, ltrans_statics);
+ node = lto_cgraph_encoder_deref (encoder, i);
+ if (write_node_summary_p (node, set, vset, ltrans_statics))
+ {
+ ipa_reference_optimization_summary_t info;
+ int node_ref;
+
+ info = get_reference_optimization_summary (node);
+ node_ref = lto_cgraph_encoder_encode (encoder, node);
+ lto_output_uleb128_stream (ob->main_stream, node_ref);
+
+ stream_out_bitmap (ob, info->statics_not_read, ltrans_statics,
+ ltrans_statics_bitcount);
+ stream_out_bitmap (ob, info->statics_not_written, ltrans_statics,
+ ltrans_statics_bitcount);
+ }
}
BITMAP_FREE (ltrans_statics);
lto_destroy_simple_output_block (ob);
@@ -1010,6 +1051,7 @@ ipa_reference_read_optimization_summary (void)
cgraph_add_node_removal_hook (&remove_node_data, NULL);
node_duplication_hook_holder =
cgraph_add_node_duplication_hook (&duplicate_node_data, NULL);
+ all_module_statics = BITMAP_ALLOC (&optimization_summary_obstack);
while ((file_data = file_data_vec[j++]))
{
@@ -1023,6 +1065,22 @@ ipa_reference_read_optimization_summary (void)
{
unsigned int i;
unsigned int f_count = lto_input_uleb128 (ib);
+ int b_count;
+ if (!f_count)
+ continue;
+ b_count = lto_input_sleb128 (ib);
+ if (dump_file)
+ fprintf (dump_file, "all module statics:");
+ for (i = 0; i < (unsigned int)b_count; i++)
+ {
+ unsigned int var_index = lto_input_uleb128 (ib);
+ tree v_decl = lto_file_decl_data_get_var_decl (file_data,
+ var_index);
+ bitmap_set_bit (all_module_statics, DECL_UID (v_decl));
+ if (dump_file)
+ fprintf (dump_file, " %s",
+ lang_hooks.decl_printable_name (v_decl, 2));
+ }
for (i = 0; i < f_count; i++)
{
@@ -1045,33 +1103,47 @@ ipa_reference_read_optimization_summary (void)
cgraph_node_name (node), node->uid);
/* Set the statics not read. */
- v_count = lto_input_uleb128 (ib);
- for (j = 0; j < (unsigned int)v_count; j++)
+ v_count = lto_input_sleb128 (ib);
+ if (v_count == -1)
{
- unsigned int var_index = lto_input_uleb128 (ib);
- tree v_decl = lto_file_decl_data_get_var_decl (file_data,
- var_index);
- bitmap_set_bit (info->statics_not_read, DECL_UID (v_decl));
+ info->statics_not_read = all_module_statics;
if (dump_file)
- fprintf (dump_file, " %s",
- lang_hooks.decl_printable_name (v_decl, 2));
+ fprintf (dump_file, " all module statics");
}
+ else
+ for (j = 0; j < (unsigned int)v_count; j++)
+ {
+ unsigned int var_index = lto_input_uleb128 (ib);
+ tree v_decl = lto_file_decl_data_get_var_decl (file_data,
+ var_index);
+ bitmap_set_bit (info->statics_not_read, DECL_UID (v_decl));
+ if (dump_file)
+ fprintf (dump_file, " %s",
+ lang_hooks.decl_printable_name (v_decl, 2));
+ }
if (dump_file)
fprintf (dump_file,
"\n static not written:");
/* Set the statics not written. */
- v_count = lto_input_uleb128 (ib);
- for (j = 0; j < (unsigned int)v_count; j++)
+ v_count = lto_input_sleb128 (ib);
+ if (v_count == -1)
{
- unsigned int var_index = lto_input_uleb128 (ib);
- tree v_decl = lto_file_decl_data_get_var_decl (file_data,
- var_index);
- bitmap_set_bit (info->statics_not_written, DECL_UID (v_decl));
+ info->statics_not_written = all_module_statics;
if (dump_file)
- fprintf (dump_file, " %s",
- lang_hooks.decl_printable_name (v_decl, 2));
+ fprintf (dump_file, " all module statics");
}
+ else
+ for (j = 0; j < (unsigned int)v_count; j++)
+ {
+ unsigned int var_index = lto_input_uleb128 (ib);
+ tree v_decl = lto_file_decl_data_get_var_decl (file_data,
+ var_index);
+ bitmap_set_bit (info->statics_not_written, DECL_UID (v_decl));
+ if (dump_file)
+ fprintf (dump_file, " %s",
+ lang_hooks.decl_printable_name (v_decl, 2));
+ }
if (dump_file)
fprintf (dump_file, "\n");
}
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
new file mode 100644
index 00000000000..289a7b38beb
--- /dev/null
+++ b/gcc/ipa-split.c
@@ -0,0 +1,1112 @@
+/* Function splitting pass
+ Copyright (C) 2010
+ Free Software Foundation, Inc.
+ Contributed by Jan Hubicka <jh@suse.cz>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+/* The purpose of this pass is to split function bodies to improve
+ inlining. I.e. for function of the form:
+
+ func (...)
+ {
+ if (cheap_test)
+ something_small
+ else
+ something_big
+ }
+
+ Produce:
+
+ func.part (...)
+ {
+ something_big
+ }
+
+ func (...)
+ {
+ if (cheap_test)
+ something_small
+ else
+ func.part (...);
+ }
+
+ When func becomes inlinable and when cheap_test is often true, inlining func,
+ but not fund.part leads to performance imrovement similar as inlining
+ original func while the code size growth is smaller.
+
+ The pass is organized in three stages:
+ 1) Collect local info about basic block into BB_INFO structure and
+ compute function body estimated size and time.
+ 2) Via DFS walk find all possible basic blocks where we can split
+ and chose best one.
+ 3) If split point is found, split at the specified BB by creating a clone
+ and updating function to call it.
+
+ The decisions what functions to split are in execute_split_functions
+ and consider_split.
+
+ There are several possible future improvements for this pass including:
+
+ 1) Splitting to break up large functions
+ 2) Splitting to reduce stack frame usage
+ 3) Allow split part of function to use values computed in the header part.
+ The values needs to be passed to split function, perhaps via same
+ interface as for nested functions or as argument.
+ 4) Support for simple rematerialization. I.e. when split part use
+ value computed in header from function parameter in very cheap way, we
+ can just recompute it.
+ 5) Support splitting of nested functions.
+ 6) Support non-SSA arguments.
+ 7) There is nothing preventing us from producing multiple parts of single function
+ when needed or splitting also the parts. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "target.h"
+#include "cgraph.h"
+#include "ipa-prop.h"
+#include "tree-flow.h"
+#include "tree-pass.h"
+#include "flags.h"
+#include "timevar.h"
+#include "diagnostic.h"
+#include "tree-dump.h"
+#include "tree-inline.h"
+#include "fibheap.h"
+#include "params.h"
+#include "gimple-pretty-print.h"
+
+/* Per basic block info. */
+
+typedef struct
+{
+ unsigned int size;
+ unsigned int time;
+} bb_info;
+DEF_VEC_O(bb_info);
+DEF_VEC_ALLOC_O(bb_info,heap);
+
+static VEC(bb_info, heap) *bb_info_vec;
+
+/* Description of split point. */
+
+struct split_point
+{
+ /* Size of the partitions. */
+ unsigned int header_time, header_size, split_time, split_size;
+
+ /* SSA names that need to be passed into spit funciton. */
+ bitmap ssa_names_to_pass;
+
+ /* Basic block where we split (that will become entry point of new function. */
+ basic_block entry_bb;
+
+ /* Basic blocks we are splitting away. */
+ bitmap split_bbs;
+};
+
+/* Best split point found. */
+
+struct split_point best_split_point;
+
+/* Callback for walk_stmt_load_store_addr_ops. If T is non-ssa automatic
+ variable, check it if it is present in bitmap passed via DATA. */
+
+static bool
+test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t,
+ void *data ATTRIBUTE_UNUSED)
+{
+ t = get_base_address (t);
+
+ if (t && !is_gimple_reg (t)
+ && ((TREE_CODE (t) == VAR_DECL
+ && auto_var_in_fn_p (t, current_function_decl))
+ || (TREE_CODE (t) == RESULT_DECL)
+ || (TREE_CODE (t) == PARM_DECL)))
+ return bitmap_bit_p ((bitmap)data, DECL_UID (t));
+ return false;
+}
+
+/* Dump split point CURRENT. */
+
+static void
+dump_split_point (FILE * file, struct split_point *current)
+{
+ fprintf (file,
+ "Split point at BB %i header time:%i header size: %i"
+ " split time: %i split size: %i\n bbs: ",
+ current->entry_bb->index, current->header_time,
+ current->header_size, current->split_time, current->split_size);
+ dump_bitmap (file, current->split_bbs);
+ fprintf (file, " SSA names to pass: ");
+ dump_bitmap (file, current->ssa_names_to_pass);
+}
+
+/* We found an split_point CURRENT. NON_SSA_VARS is bitmap of all non ssa
+ variables used and RETURN_BB is return basic block.
+ See if we can split function here. */
+
+static void
+consider_split (struct split_point *current, bitmap non_ssa_vars,
+ basic_block return_bb)
+{
+ tree parm;
+ unsigned int num_args = 0;
+ unsigned int call_overhead;
+ edge e;
+ edge_iterator ei;
+ gimple_stmt_iterator bsi;
+ unsigned int i;
+ int incomming_freq = 0;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ dump_split_point (dump_file, current);
+
+ FOR_EACH_EDGE (e, ei, current->entry_bb->preds)
+ if (!bitmap_bit_p (current->split_bbs, e->src->index))
+ incomming_freq += EDGE_FREQUENCY (e);
+
+ /* Do not split when we would end up calling function anyway. */
+ if (incomming_freq
+ >= (ENTRY_BLOCK_PTR->frequency
+ * PARAM_VALUE (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY) / 100))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: incomming frequency is too large.\n");
+ return;
+ }
+
+ if (!current->header_size)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " Refused: header empty\n");
+ gcc_unreachable ();
+ return;
+ }
+
+ /* Verify that PHI args on entry are either virutal or all their operands
+ incomming from header are the same. */
+ for (bsi = gsi_start_phis (current->entry_bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ tree val = NULL;
+
+ if (!is_gimple_reg (gimple_phi_result (stmt)))
+ continue;
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
+ {
+ edge e = gimple_phi_arg_edge (stmt, i);
+ if (!bitmap_bit_p (current->split_bbs, e->src->index))
+ {
+ tree edge_val = gimple_phi_arg_def (stmt, i);
+ if (val && edge_val != val)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: entry BB has PHI with multiple variants\n");
+ return;
+ }
+ val = edge_val;
+ }
+ }
+ }
+
+
+ /* See what argument we will pass to the split function and compute
+ call overhead. */
+ call_overhead = eni_size_weights.call_cost;
+ for (parm = DECL_ARGUMENTS (current_function_decl); parm;
+ parm = TREE_CHAIN (parm))
+ {
+ if (!is_gimple_reg (parm))
+ {
+ if (bitmap_bit_p (non_ssa_vars, DECL_UID (parm)))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: need to pass non-ssa param values\n");
+ return;
+ }
+ }
+ else if (gimple_default_def (cfun, parm)
+ && bitmap_bit_p (current->ssa_names_to_pass,
+ SSA_NAME_VERSION (gimple_default_def
+ (cfun, parm))))
+ {
+ if (!VOID_TYPE_P (TREE_TYPE (parm)))
+ call_overhead += estimate_move_cost (TREE_TYPE (parm));
+ num_args++;
+ }
+ }
+ if (!VOID_TYPE_P (TREE_TYPE (current_function_decl)))
+ call_overhead += estimate_move_cost (TREE_TYPE (current_function_decl));
+
+ if (current->split_size <= call_overhead)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: split size is smaller than call overhead\n");
+ return;
+ }
+ if (current->header_size + call_overhead
+ >= (unsigned int)(DECL_DECLARED_INLINE_P (current_function_decl)
+ ? MAX_INLINE_INSNS_SINGLE
+ : MAX_INLINE_INSNS_AUTO))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: header size is too large for inline candidate\n");
+ return;
+ }
+
+ /* FIXME: we currently can pass only SSA function parameters to the split
+ arguments. Once parm_adjustment infrastructure is supported by cloning,
+ we can pass more than that. */
+ if (num_args != bitmap_count_bits (current->ssa_names_to_pass))
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: need to pass non-param values\n");
+ return;
+ }
+
+ /* When there are non-ssa vars used in the split region, see if they
+ are used in the header region. If so, reject the split.
+ FIXME: we can use nested function support to access both. */
+ if (!bitmap_empty_p (non_ssa_vars))
+ {
+ basic_block bb;
+ FOR_EACH_BB (bb)
+ {
+ gimple_stmt_iterator bsi;
+ if (!bitmap_bit_p (current->split_bbs, bb->index))
+ continue;
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ if (is_gimple_debug (gsi_stmt (bsi)))
+ continue;
+ if (walk_stmt_load_store_addr_ops
+ (gsi_stmt (bsi), non_ssa_vars, test_nonssa_use,
+ test_nonssa_use, test_nonssa_use))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: split part has non-ssa uses\n");
+ return;
+ }
+ }
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ if (walk_stmt_load_store_addr_ops
+ (gsi_stmt (bsi), non_ssa_vars, test_nonssa_use,
+ test_nonssa_use, test_nonssa_use))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: split part has non-ssa uses\n");
+ return;
+ }
+ }
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ {
+ if (e->dest != return_bb)
+ continue;
+ for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ tree op = gimple_phi_arg_def (stmt, e->dest_idx);
+
+ if (!is_gimple_reg (gimple_phi_result (stmt)))
+ continue;
+ if (TREE_CODE (op) != SSA_NAME
+ && test_nonssa_use (stmt, op, non_ssa_vars))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: split part has non-ssa uses\n");
+ return;
+ }
+ }
+ }
+ }
+ return;
+ }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " Accepted!\n");
+
+ /* At the moment chose split point with lowest frequency and that leaves
+ out smallest size of header.
+ In future we might re-consider this heuristics. */
+ if (!best_split_point.split_bbs
+ || best_split_point.entry_bb->frequency > current->entry_bb->frequency
+ || (best_split_point.entry_bb->frequency == current->entry_bb->frequency
+ && best_split_point.split_size < current->split_size))
+
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " New best split point!\n");
+ if (best_split_point.ssa_names_to_pass)
+ {
+ BITMAP_FREE (best_split_point.ssa_names_to_pass);
+ BITMAP_FREE (best_split_point.split_bbs);
+ }
+ best_split_point = *current;
+ best_split_point.ssa_names_to_pass = BITMAP_ALLOC (NULL);
+ bitmap_copy (best_split_point.ssa_names_to_pass,
+ current->ssa_names_to_pass);
+ best_split_point.split_bbs = BITMAP_ALLOC (NULL);
+ bitmap_copy (best_split_point.split_bbs, current->split_bbs);
+ }
+}
+
+/* Return basic block containing RETURN statement, or EXIT_BLOCK_PTR if none
+ found.
+ When there are multiple RETURN statement, chose one with return value,
+ since that one is more likely shared by multiple code paths.
+ TODO: We might support multiple return blocks. */
+
+static basic_block
+find_return_bb (void)
+{
+ edge e;
+ edge_iterator ei;
+ basic_block return_bb = EXIT_BLOCK_PTR;
+
+ if (EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 1)
+ FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
+ {
+ gimple_stmt_iterator bsi;
+ bool found_return = false;
+ tree retval = NULL_TREE;
+
+ for (bsi = gsi_start_bb (e->src); !gsi_end_p (bsi); gsi_next (&bsi))
+ if (gimple_code (gsi_stmt (bsi)) != GIMPLE_RETURN
+ && gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
+ && !is_gimple_debug (gsi_stmt (bsi)))
+ break;
+ else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
+ {
+ found_return = true;
+ retval = gimple_return_retval (gsi_stmt (bsi));
+ }
+ if (gsi_end_p (bsi) && found_return)
+ {
+ if (retval)
+ return e->src;
+ else
+ return_bb = e->src;
+ }
+ }
+ return return_bb;
+}
+
+/* Callback for walk_stmt_load_store_addr_ops. If T is non-ssa automatic
+ variable, mark it as used in bitmap passed via DATA.
+ Return true when access to T prevents splitting the function. */
+
+static bool
+mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t,
+ void *data ATTRIBUTE_UNUSED)
+{
+ t = get_base_address (t);
+
+ if (!t || is_gimple_reg (t))
+ return false;
+
+ /* At present we can't pass non-SSA arguments to split function.
+ FIXME: this can be relaxed by passing references to arguments. */
+ if (TREE_CODE (t) == PARM_DECL)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Can not split use of non-ssa function parameter.\n");
+ return true;
+ }
+
+ if ((TREE_CODE (t) == VAR_DECL && auto_var_in_fn_p (t, current_function_decl))
+ || (TREE_CODE (t) == RESULT_DECL))
+ bitmap_set_bit ((bitmap)data, DECL_UID (t));
+ return false;
+}
+
+/* Compute local properties of basic block BB we collect when looking for
+ split points. We look for ssa defs and store them in SET_SSA_NAMES,
+ for ssa uses and store them in USED_SSA_NAMES and for any non-SSA automatic
+ vars stored in NON_SSA_VARS.
+
+ When BB has edge to RETURN_BB, collect uses in RETURN_BB too.
+
+ Return false when BB contains something that prevents it from being put into
+ split function. */
+
+static bool
+visit_bb (basic_block bb, basic_block return_bb,
+ bitmap set_ssa_names, bitmap used_ssa_names,
+ bitmap non_ssa_vars)
+{
+ gimple_stmt_iterator bsi;
+ edge e;
+ edge_iterator ei;
+ bool can_split = true;
+
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ tree op;
+ ssa_op_iter iter;
+ tree decl;
+
+ if (is_gimple_debug (stmt))
+ continue;
+
+ /* FIXME: We can split regions containing EH. We can not however
+ split RESX, EH_DISPATCH and EH_POINTER referring to same region
+ into different partitions. This would require tracking of
+ EH regions and checking in consider_split_point if they
+ are not used elsewhere. */
+ if (gimple_code (stmt) == GIMPLE_RESX
+ && stmt_can_throw_external (stmt))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Can not split external resx.\n");
+ can_split = false;
+ }
+ if (gimple_code (stmt) == GIMPLE_EH_DISPATCH)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Can not split eh dispatch.\n");
+ can_split = false;
+ }
+
+ /* Check builtins that prevent splitting. */
+ if (gimple_code (stmt) == GIMPLE_CALL
+ && (decl = gimple_call_fndecl (stmt)) != NULL_TREE
+ && DECL_BUILT_IN (decl)
+ && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (decl))
+ {
+ /* FIXME: once we will allow passing non-parm values to split part,
+ we need to be sure to handle correct builtin_stack_save and
+ builtin_stack_restore. At the moment we are safe; there is no
+ way to store builtin_stack_save result in non-SSA variable
+ since all calls to those are compiler generated. */
+ case BUILT_IN_APPLY:
+ case BUILT_IN_VA_START:
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Can not split builtin_apply and va_start.\n");
+ can_split = false;
+ break;
+ case BUILT_IN_EH_POINTER:
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Can not split builtin_eh_pointer.\n");
+ can_split = false;
+ break;
+ default:
+ break;
+ }
+
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
+ bitmap_set_bit (set_ssa_names, SSA_NAME_VERSION (op));
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
+ bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
+ can_split &= !walk_stmt_load_store_addr_ops (stmt, non_ssa_vars,
+ mark_nonssa_use,
+ mark_nonssa_use,
+ mark_nonssa_use);
+ }
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ unsigned int i;
+
+ if (is_gimple_debug (stmt))
+ continue;
+ if (!is_gimple_reg (gimple_phi_result (stmt)))
+ continue;
+ bitmap_set_bit (set_ssa_names,
+ SSA_NAME_VERSION (gimple_phi_result (stmt)));
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
+ {
+ tree op = gimple_phi_arg_def (stmt, i);
+ if (TREE_CODE (op) == SSA_NAME)
+ bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
+ }
+ can_split &= !walk_stmt_load_store_addr_ops (stmt, non_ssa_vars,
+ mark_nonssa_use,
+ mark_nonssa_use,
+ mark_nonssa_use);
+ }
+ /* Record also uses comming from PHI operand in return BB. */
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (e->dest == return_bb)
+ {
+ bool found_phi = false;
+ for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ tree op = gimple_phi_arg_def (stmt, e->dest_idx);
+
+ if (is_gimple_debug (stmt))
+ continue;
+ if (!is_gimple_reg (gimple_phi_result (stmt)))
+ continue;
+ found_phi = true;
+ if (TREE_CODE (op) == SSA_NAME)
+ bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
+ else
+ can_split &= !mark_nonssa_use (stmt, op, non_ssa_vars);
+ }
+ if (!gsi_end_p (gsi_last_bb (return_bb)))
+ {
+ ssa_op_iter iter;
+ gimple stmt = gsi_stmt (gsi_last_bb (return_bb));
+ tree op;
+ if (!found_phi)
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
+ bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
+ can_split &= !walk_stmt_load_store_addr_ops (stmt, non_ssa_vars,
+ mark_nonssa_use,
+ mark_nonssa_use,
+ mark_nonssa_use);
+ }
+ }
+ return can_split;
+}
+
+/* Stack entry for recursive DFS walk in find_split_point. */
+
+typedef struct
+{
+ /* Basic block we are examining. */
+ basic_block bb;
+
+ /* SSA names set and used by the BB and all BBs reachable
+ from it via DFS walk. */
+ bitmap set_ssa_names, used_ssa_names;
+ bitmap non_ssa_vars;
+
+ /* All BBS visited from this BB via DFS walk. */
+ bitmap bbs_visited;
+
+ /* Last examined edge in DFS walk. Since we walk unoriented graph,
+ the value is up to sum of incomming and outgoing edges of BB. */
+ unsigned int edge_num;
+
+ /* Stack entry index of earliest BB reachable from current BB
+ or any BB visited later in DFS valk. */
+ int earliest;
+
+ /* Overall time and size of all BBs reached from this BB in DFS walk. */
+ int overall_time, overall_size;
+
+ /* When false we can not split on this BB. */
+ bool can_split;
+} stack_entry;
+DEF_VEC_O(stack_entry);
+DEF_VEC_ALLOC_O(stack_entry,heap);
+
+
+/* Find all articulations and call consider_split on them.
+ OVERALL_TIME and OVERALL_SIZE is time and size of the function.
+
+ We perform basic algorithm for finding an articulation in a graph
+ created from CFG by considering it to be an unoriented graph.
+
+ The articulation is discovered via DFS walk. We collect earliest
+ basic block on stack that is reachable via backward edge. Articulation
+ is any basic block such that there is no backward edge bypassing it.
+ To reduce stack usage we maintain heap allocated stack in STACK vector.
+ AUX pointer of BB is set to index it appears in the stack or -1 once
+ it is visited and popped off the stack.
+
+ The algorithm finds articulation after visiting the whole component
+ reachable by it. This makes it convenient to collect information about
+ the component used by consider_split. */
+
+static void
+find_split_points (int overall_time, int overall_size)
+{
+ stack_entry first;
+ VEC(stack_entry, heap) *stack = NULL;
+ basic_block bb;
+ basic_block return_bb = find_return_bb ();
+ struct split_point current;
+
+ current.header_time = overall_time;
+ current.header_size = overall_size;
+ current.split_time = 0;
+ current.split_size = 0;
+ current.ssa_names_to_pass = BITMAP_ALLOC (NULL);
+
+ first.bb = ENTRY_BLOCK_PTR;
+ first.edge_num = 0;
+ first.overall_time = 0;
+ first.overall_size = 0;
+ first.earliest = INT_MAX;
+ first.set_ssa_names = 0;
+ first.used_ssa_names = 0;
+ first.bbs_visited = 0;
+ VEC_safe_push (stack_entry, heap, stack, &first);
+ ENTRY_BLOCK_PTR->aux = (void *)(intptr_t)-1;
+
+ while (!VEC_empty (stack_entry, stack))
+ {
+ stack_entry *entry = VEC_last (stack_entry, stack);
+
+ /* We are walking an acyclic graph, so edge_num counts
+ succ and pred edges together. However when considering
+ articulation, we want to have processed everything reachable
+ from articulation but nothing that reaches into it. */
+ if (entry->edge_num == EDGE_COUNT (entry->bb->succs)
+ && entry->bb != ENTRY_BLOCK_PTR)
+ {
+ int pos = VEC_length (stack_entry, stack);
+ entry->can_split &= visit_bb (entry->bb, return_bb,
+ entry->set_ssa_names,
+ entry->used_ssa_names,
+ entry->non_ssa_vars);
+ if (pos <= entry->earliest && !entry->can_split
+ && dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "found articulation at bb %i but can not split\n",
+ entry->bb->index);
+ if (pos <= entry->earliest && entry->can_split)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "found articulation at bb %i\n",
+ entry->bb->index);
+ current.entry_bb = entry->bb;
+ current.ssa_names_to_pass = BITMAP_ALLOC (NULL);
+ bitmap_and_compl (current.ssa_names_to_pass,
+ entry->used_ssa_names, entry->set_ssa_names);
+ current.header_time = overall_time - entry->overall_time;
+ current.header_size = overall_size - entry->overall_size;
+ current.split_time = entry->overall_time;
+ current.split_size = entry->overall_size;
+ current.split_bbs = entry->bbs_visited;
+ consider_split (&current, entry->non_ssa_vars, return_bb);
+ BITMAP_FREE (current.ssa_names_to_pass);
+ }
+ }
+ /* Do actual DFS walk. */
+ if (entry->edge_num
+ < (EDGE_COUNT (entry->bb->succs)
+ + EDGE_COUNT (entry->bb->preds)))
+ {
+ edge e;
+ basic_block dest;
+ if (entry->edge_num < EDGE_COUNT (entry->bb->succs))
+ {
+ e = EDGE_SUCC (entry->bb, entry->edge_num);
+ dest = e->dest;
+ }
+ else
+ {
+ e = EDGE_PRED (entry->bb, entry->edge_num
+ - EDGE_COUNT (entry->bb->succs));
+ dest = e->src;
+ }
+
+ entry->edge_num++;
+
+ /* New BB to visit, push it to the stack. */
+ if (dest != return_bb && dest != EXIT_BLOCK_PTR
+ && !dest->aux)
+ {
+ stack_entry new_entry;
+
+ new_entry.bb = dest;
+ new_entry.edge_num = 0;
+ new_entry.overall_time
+ = VEC_index (bb_info, bb_info_vec, dest->index)->time;
+ new_entry.overall_size
+ = VEC_index (bb_info, bb_info_vec, dest->index)->size;
+ new_entry.earliest = INT_MAX;
+ new_entry.set_ssa_names = BITMAP_ALLOC (NULL);
+ new_entry.used_ssa_names = BITMAP_ALLOC (NULL);
+ new_entry.bbs_visited = BITMAP_ALLOC (NULL);
+ new_entry.non_ssa_vars = BITMAP_ALLOC (NULL);
+ new_entry.can_split = true;
+ bitmap_set_bit (new_entry.bbs_visited, dest->index);
+ VEC_safe_push (stack_entry, heap, stack, &new_entry);
+ dest->aux = (void *)(intptr_t)VEC_length (stack_entry, stack);
+ }
+ /* Back edge found, record the earliest point. */
+ else if ((intptr_t)dest->aux > 0
+ && (intptr_t)dest->aux < entry->earliest)
+ entry->earliest = (intptr_t)dest->aux;
+ }
+ /* We are done with examing the edges. pop off the value from stack and
+ merge stuff we cummulate during the walk. */
+ else if (entry->bb != ENTRY_BLOCK_PTR)
+ {
+ stack_entry *prev = VEC_index (stack_entry, stack,
+ VEC_length (stack_entry, stack) - 2);
+
+ entry->bb->aux = (void *)(intptr_t)-1;
+ prev->can_split &= entry->can_split;
+ if (prev->set_ssa_names)
+ {
+ bitmap_ior_into (prev->set_ssa_names, entry->set_ssa_names);
+ bitmap_ior_into (prev->used_ssa_names, entry->used_ssa_names);
+ bitmap_ior_into (prev->bbs_visited, entry->bbs_visited);
+ bitmap_ior_into (prev->non_ssa_vars, entry->non_ssa_vars);
+ }
+ if (prev->earliest > entry->earliest)
+ prev->earliest = entry->earliest;
+ prev->overall_time += entry->overall_time;
+ prev->overall_size += entry->overall_size;
+ BITMAP_FREE (entry->set_ssa_names);
+ BITMAP_FREE (entry->used_ssa_names);
+ BITMAP_FREE (entry->bbs_visited);
+ BITMAP_FREE (entry->non_ssa_vars);
+ VEC_pop (stack_entry, stack);
+ }
+ else
+ VEC_pop (stack_entry, stack);
+ }
+ ENTRY_BLOCK_PTR->aux = NULL;
+ FOR_EACH_BB (bb)
+ bb->aux = NULL;
+ BITMAP_FREE (current.ssa_names_to_pass);
+}
+
+/* Split function at SPLIT_POINT. */
+
+static void
+split_function (struct split_point *split_point)
+{
+ VEC (tree, heap) *args_to_pass = NULL;
+ bitmap args_to_skip = BITMAP_ALLOC (NULL);
+ tree parm;
+ int num = 0;
+ struct cgraph_node *node;
+ basic_block return_bb = find_return_bb ();
+ basic_block call_bb;
+ gimple_stmt_iterator gsi;
+ gimple call;
+ edge e;
+ edge_iterator ei;
+ tree retval = NULL, real_retval = NULL;
+ bool split_part_return_p = false;
+ gimple last_stmt = NULL;
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n\nSplitting function at:\n");
+ dump_split_point (dump_file, split_point);
+ }
+
+ /* Collect the parameters of new function and args_to_skip bitmap. */
+ for (parm = DECL_ARGUMENTS (current_function_decl);
+ parm; parm = TREE_CHAIN (parm), num++)
+ if (!is_gimple_reg (parm)
+ || !gimple_default_def (cfun, parm)
+ || !bitmap_bit_p (split_point->ssa_names_to_pass,
+ SSA_NAME_VERSION (gimple_default_def (cfun, parm))))
+ bitmap_set_bit (args_to_skip, num);
+ else
+ VEC_safe_push (tree, heap, args_to_pass, gimple_default_def (cfun, parm));
+
+ /* See if the split function will return. */
+ FOR_EACH_EDGE (e, ei, return_bb->preds)
+ if (bitmap_bit_p (split_point->split_bbs, e->src->index))
+ break;
+ if (e)
+ split_part_return_p = true;
+
+ /* If we return, we will need the return block. */
+ if (return_bb != EXIT_BLOCK_PTR && split_part_return_p)
+ bitmap_set_bit (split_point->split_bbs, return_bb->index);
+
+ /* Now create the actual clone. */
+ rebuild_cgraph_edges ();
+ node = cgraph_function_versioning (cgraph_node (current_function_decl),
+ NULL, NULL,
+ args_to_skip,
+ split_point->split_bbs,
+ split_point->entry_bb, "_part");
+ /* For usual cloning it is enough to clear builtin only when signature
+ changes. For partial inlining we however can not expect the part
+ of builtin implementation to have same semantic as the whole. */
+ if (DECL_BUILT_IN (node->decl))
+ {
+ DECL_BUILT_IN_CLASS (node->decl) = NOT_BUILT_IN;
+ DECL_FUNCTION_CODE (node->decl) = (enum built_in_function) 0;
+ }
+ cgraph_node_remove_callees (cgraph_node (current_function_decl));
+ if (!split_part_return_p)
+ TREE_THIS_VOLATILE (node->decl) = 1;
+ if (dump_file)
+ dump_function_to_file (node->decl, dump_file, dump_flags);
+
+ /* Create the basic block we place call into. It is the entry basic block
+ split after last label. */
+ call_bb = split_point->entry_bb;
+ for (gsi = gsi_start_bb (call_bb); !gsi_end_p (gsi);)
+ if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
+ {
+ last_stmt = gsi_stmt (gsi);
+ gsi_next (&gsi);
+ }
+ else
+ break;
+ e = split_block (split_point->entry_bb, last_stmt);
+ remove_edge (e);
+
+ /* Produce the call statement. */
+ gsi = gsi_last_bb (call_bb);
+ call = gimple_build_call_vec (node->decl, args_to_pass);
+ gimple_set_block (call, DECL_INITIAL (current_function_decl));
+
+ /* Update return value. This is bit tricky. When we do not return,
+ do nothing. When we return we might need to update return_bb
+ or produce a new return statement. */
+ if (!split_part_return_p)
+ gsi_insert_after (&gsi, call, GSI_NEW_STMT);
+ else
+ {
+ e = make_edge (call_bb, return_bb,
+ return_bb == EXIT_BLOCK_PTR ? 0 : EDGE_FALLTHRU);
+ e->count = call_bb->count;
+ e->probability = REG_BR_PROB_BASE;
+ if (return_bb != EXIT_BLOCK_PTR)
+ {
+ gimple return_stmt = gsi_stmt (gsi_last_bb (return_bb));
+ gcc_assert (gimple_code (return_stmt) == GIMPLE_RETURN);
+
+ if ((real_retval = retval = gimple_return_retval (return_stmt))
+ && !is_gimple_min_invariant (retval)
+ && (TREE_CODE (retval) != SSA_NAME
+ || !SSA_NAME_IS_DEFAULT_DEF (retval)))
+ {
+ gimple_stmt_iterator psi;
+
+ /* See if there is PHI definind return value. */
+ for (psi = gsi_start_phis (return_bb);
+ !gsi_end_p (psi); gsi_next (&psi))
+ if (is_gimple_reg (gimple_phi_result (gsi_stmt (psi))))
+ break;
+
+ /* When we have PHI, update PHI. When there is no PHI,
+ update the return statement itself. */
+ if (TREE_CODE (retval) == SSA_NAME)
+ {
+ retval = make_ssa_name (SSA_NAME_VAR (retval), call);
+ if (TREE_CODE (retval) == SSA_NAME
+ && !gsi_end_p (psi))
+ add_phi_arg (gsi_stmt (psi), retval, e, UNKNOWN_LOCATION);
+ else if (TREE_CODE (retval) == SSA_NAME)
+ {
+ gimple_return_set_retval (return_stmt, retval);
+ update_stmt (return_stmt);
+ }
+ }
+ gimple_call_set_lhs (call, retval);
+ }
+ gsi_insert_after (&gsi, call, GSI_NEW_STMT);
+ }
+ else
+ {
+ gimple ret;
+ if (!VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))))
+ {
+ retval = DECL_RESULT (current_function_decl);
+
+ /* We use temporary register to hold value when aggregate_value_p
+ is false. Similarly for DECL_BY_REFERENCE we must avoid extra
+ copy. */
+ if (!aggregate_value_p (retval, TREE_TYPE (current_function_decl))
+ && !DECL_BY_REFERENCE (retval))
+ retval = create_tmp_reg (TREE_TYPE (retval), NULL);
+ if (is_gimple_reg (retval))
+ retval = make_ssa_name (retval, call);
+ gimple_call_set_lhs (call, retval);
+ }
+ gsi_insert_after (&gsi, call, GSI_NEW_STMT);
+ ret = gimple_build_return (retval);
+ gsi_insert_after (&gsi, ret, GSI_NEW_STMT);
+ }
+ }
+ free_dominance_info (CDI_DOMINATORS);
+ free_dominance_info (CDI_POST_DOMINATORS);
+ compute_inline_parameters (node);
+}
+
+/* Execute function splitting pass. */
+
+static unsigned int
+execute_split_functions (void)
+{
+ gimple_stmt_iterator bsi;
+ basic_block bb;
+ int overall_time = 0, overall_size = 0;
+ int todo = 0;
+ struct cgraph_node *node = cgraph_node (current_function_decl);
+
+ if (flags_from_decl_or_type (current_function_decl) & ECF_NORETURN)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: noreturn function.\n");
+ return 0;
+ }
+ if (MAIN_NAME_P (DECL_NAME (current_function_decl)))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: main function.\n");
+ return 0;
+ }
+ /* This can be relaxed; function might become inlinable after splitting
+ away the uninlinable part. */
+ if (!node->local.inlinable)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: not inlinable.\n");
+ return 0;
+ }
+ if (node->local.disregard_inline_limits)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: disregading inline limits.\n");
+ return 0;
+ }
+ /* This can be relaxed; most of versioning tests actually prevents
+ a duplication. */
+ if (!tree_versionable_function_p (current_function_decl))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: not versionable.\n");
+ return 0;
+ }
+ /* FIXME: we could support this. */
+ if (DECL_STRUCT_FUNCTION (current_function_decl)->static_chain_decl)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: nested function.\n");
+ return 0;
+ }
+ /* FIXME: Should be easy to support. */
+ if (DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: returns value by reference.\n");
+ return 0;
+ }
+
+ /* See if it makes sense to try to split.
+ It makes sense to split if we inline, that is if we have direct calls to
+ handle or direct calls are possibly going to appear as result of indirect
+ inlining or LTO.
+ Note that we are not completely conservative about disqualifying functions
+ called once. It is possible that the caller is called more then once and
+ then inlining would still benefit. */
+ if ((!node->callers || !node->callers->next_caller)
+ && !node->address_taken
+ && ((!flag_lto && !flag_whopr) || !node->local.externally_visible))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: not called directly "
+ "or called once.\n");
+ return 0;
+ }
+
+ /* FIXME: We can actually split if splitting reduces call overhead. */
+ if (!flag_inline_small_functions
+ && !DECL_DECLARED_INLINE_P (current_function_decl))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Not splitting: not autoinlining and function"
+ " is not inline.\n");
+ return 0;
+ }
+
+ /* Compute local info about basic blocks and determine function size/time. */
+ VEC_safe_grow_cleared (bb_info, heap, bb_info_vec, last_basic_block + 1);
+ memset (&best_split_point, 0, sizeof (best_split_point));
+ FOR_EACH_BB (bb)
+ {
+ int time = 0;
+ int size = 0;
+ int freq = compute_call_stmt_bb_frequency (current_function_decl, bb);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Basic block %i\n", bb->index);
+
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ int this_time, this_size;
+ gimple stmt = gsi_stmt (bsi);
+
+ this_size = estimate_num_insns (stmt, &eni_size_weights);
+ this_time = estimate_num_insns (stmt, &eni_time_weights) * freq;
+ size += this_size;
+ time += this_time;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " freq:%6i size:%3i time:%3i ",
+ freq, this_size, this_time);
+ print_gimple_stmt (dump_file, stmt, 0, 0);
+ }
+ }
+ overall_time += time;
+ overall_size += size;
+ VEC_index (bb_info, bb_info_vec, bb->index)->time = time;
+ VEC_index (bb_info, bb_info_vec, bb->index)->size = size;
+ }
+ find_split_points (overall_time, overall_size);
+ if (best_split_point.split_bbs)
+ {
+ split_function (&best_split_point);
+ BITMAP_FREE (best_split_point.ssa_names_to_pass);
+ BITMAP_FREE (best_split_point.split_bbs);
+ todo = TODO_update_ssa | TODO_cleanup_cfg;
+ }
+ VEC_free (bb_info, heap, bb_info_vec);
+ bb_info_vec = NULL;
+ return todo;
+}
+
+static bool
+gate_split_functions (void)
+{
+ return flag_partial_inlining;
+}
+
+struct gimple_opt_pass pass_split_functions =
+{
+ {
+ GIMPLE_PASS,
+ "fnsplit", /* name */
+ gate_split_functions, /* gate */
+ execute_split_functions, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_IPA_FNSPLIT, /* tv_id */
+ PROP_cfg, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+ }
+};
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index 6ace2fcd0d7..98ad91f8508 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -421,6 +421,10 @@ decompose_indirect_ref_acc (tree str_decl, struct field_access_site *acc)
if (!is_result_of_mult (before_cast, &acc->num, struct_size))
return false;
+ /* ??? Add TREE_OPERAND (acc->ref, 1) to acc->offset. */
+ if (!integer_zerop (TREE_OPERAND (acc->ref, 1)))
+ return false;
+
return true;
}
@@ -434,7 +438,7 @@ decompose_access (tree str_decl, struct field_access_site *acc)
{
gcc_assert (acc->ref);
- if (TREE_CODE (acc->ref) == INDIRECT_REF)
+ if (TREE_CODE (acc->ref) == MEM_REF)
return decompose_indirect_ref_acc (str_decl, acc);
else if (TREE_CODE (acc->ref) == ARRAY_REF)
return true;
@@ -969,12 +973,12 @@ replace_field_acc (struct field_access_site *acc, tree new_type)
type_wrapper_t *wr_p = NULL;
struct ref_pos r_pos;
- while (TREE_CODE (ref_var) == INDIRECT_REF
+ while (TREE_CODE (ref_var) == MEM_REF
|| TREE_CODE (ref_var) == ARRAY_REF)
{
type_wrapper_t wr;
- if ( TREE_CODE (ref_var) == INDIRECT_REF)
+ if (TREE_CODE (ref_var) == MEM_REF)
{
wr.wrap = 0;
wr.domain = 0;
@@ -1001,7 +1005,7 @@ replace_field_acc (struct field_access_site *acc, tree new_type)
new_ref = build4 (ARRAY_REF, type, new_ref,
wr_p->domain, NULL_TREE, NULL_TREE);
else /* Pointer. */
- new_ref = build1 (INDIRECT_REF, type, new_ref);
+ new_ref = build_simple_mem_ref (new_ref);
VEC_pop (type_wrapper_t, wrapper);
}
@@ -1041,7 +1045,7 @@ static void
replace_field_access_stmt (struct field_access_site *acc, tree new_type)
{
- if (TREE_CODE (acc->ref) == INDIRECT_REF
+ if (TREE_CODE (acc->ref) == MEM_REF
||TREE_CODE (acc->ref) == ARRAY_REF
||TREE_CODE (acc->ref) == VAR_DECL)
replace_field_acc (acc, new_type);
@@ -1277,13 +1281,11 @@ insert_new_var_in_stmt (gimple stmt, tree var, tree new_var)
pos = find_pos_in_stmt (stmt, var, &r_pos);
gcc_assert (pos);
- while (r_pos.container && (TREE_CODE(r_pos.container) == INDIRECT_REF
+ while (r_pos.container && (TREE_CODE(r_pos.container) == MEM_REF
|| TREE_CODE(r_pos.container) == ADDR_EXPR))
{
- tree type = TREE_TYPE (TREE_TYPE (new_var));
-
- if (TREE_CODE(r_pos.container) == INDIRECT_REF)
- new_var = build1 (INDIRECT_REF, type, new_var);
+ if (TREE_CODE(r_pos.container) == MEM_REF)
+ new_var = build_simple_mem_ref (new_var);
else
new_var = build_fold_addr_expr (new_var);
pos = find_pos_in_stmt (stmt, r_pos.container, &r_pos);
@@ -2530,7 +2532,7 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
tree field_decl = TREE_OPERAND (t, 1);
- if ((TREE_CODE (ref) == INDIRECT_REF
+ if ((TREE_CODE (ref) == MEM_REF
|| TREE_CODE (ref) == ARRAY_REF
|| TREE_CODE (ref) == VAR_DECL)
&& TREE_CODE (field_decl) == FIELD_DECL)
@@ -4031,7 +4033,10 @@ reorg_structs (void)
static unsigned int
reorg_structs_drive (void)
{
- reorg_structs ();
+ /* IPA struct-reorg is completely broken - its analysis phase is
+ non-conservative (which is not the only reason it is broken). */
+ if (0)
+ reorg_structs ();
return 0;
}
diff --git a/gcc/ipa.c b/gcc/ipa.c
index fcd0253e5eb..05e164271db 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -512,8 +512,9 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
FIXME: This can not be done in between gimplify and omp_expand since
readonly flag plays role on what is shared and what is not. Currently we do
- this transformation as part of ipa-reference pass, but it would make sense
- to do it before early optimizations. */
+ this transformation as part of whole program visibility and re-do at
+ ipa-reference pass (to take into account clonning), but it would
+ make sense to do it before early optimizations. */
void
ipa_discover_readonly_nonaddressable_vars (void)
@@ -575,6 +576,8 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program)
return false;
if (!whole_program)
return true;
+ if (node->local.used_from_object_file)
+ return true;
if (DECL_PRESERVE_P (node->decl))
return true;
/* COMDAT functions must be shared only if they have address taken,
@@ -728,6 +731,7 @@ function_and_variable_visibility (bool whole_program)
we start reordering datastructures. */
|| DECL_COMDAT (vnode->decl)
|| DECL_WEAK (vnode->decl)
+ || vnode->used_from_object_file
|| lookup_attribute ("externally_visible",
DECL_ATTRIBUTES (vnode->decl))))
vnode->externally_visible = true;
@@ -825,6 +829,8 @@ whole_program_function_and_variable_visibility (void)
fprintf (dump_file, " %s", varpool_node_name (vnode));
fprintf (dump_file, "\n\n");
}
+ if (optimize)
+ ipa_discover_readonly_nonaddressable_vars ();
return 0;
}
@@ -884,7 +890,7 @@ cgraph_node_set_new (void)
{
cgraph_node_set new_node_set;
- new_node_set = GGC_NEW (struct cgraph_node_set_def);
+ new_node_set = ggc_alloc_cgraph_node_set_def ();
new_node_set->hashtab = htab_create_ggc (10,
hash_cgraph_node_set_element,
eq_cgraph_node_set_element,
@@ -915,8 +921,7 @@ cgraph_node_set_add (cgraph_node_set set, struct cgraph_node *node)
}
/* Insert node into hash table. */
- element =
- (cgraph_node_set_element) GGC_NEW (struct cgraph_node_set_element_def);
+ element = ggc_alloc_cgraph_node_set_element_def ();
element->node = node;
element->index = VEC_length (cgraph_node_ptr, set->nodes);
*slot = element;
@@ -1042,7 +1047,7 @@ varpool_node_set_new (void)
{
varpool_node_set new_node_set;
- new_node_set = GGC_NEW (struct varpool_node_set_def);
+ new_node_set = ggc_alloc_varpool_node_set_def ();
new_node_set->hashtab = htab_create_ggc (10,
hash_varpool_node_set_element,
eq_varpool_node_set_element,
@@ -1073,8 +1078,7 @@ varpool_node_set_add (varpool_node_set set, struct varpool_node *node)
}
/* Insert node into hash table. */
- element =
- (varpool_node_set_element) GGC_NEW (struct varpool_node_set_element_def);
+ element = ggc_alloc_varpool_node_set_element_def ();
element->node = node;
element->index = VEC_length (varpool_node_ptr, set->nodes);
*slot = element;
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 502b0f63442..6936cec3048 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -383,8 +383,8 @@ rebuild_regno_allocno_maps (void)
-/* Pools for allocnos and allocno live ranges. */
-static alloc_pool allocno_pool, allocno_live_range_pool;
+/* Pools for allocnos and live ranges. */
+static alloc_pool allocno_pool, live_range_pool;
/* Vec containing references to all created allocnos. It is a
container of array allocnos. */
@@ -398,9 +398,9 @@ static VEC(ira_allocno_t,heap) *ira_conflict_id_allocno_map_vec;
static void
initiate_allocnos (void)
{
- allocno_live_range_pool
- = create_alloc_pool ("allocno live ranges",
- sizeof (struct ira_allocno_live_range), 100);
+ live_range_pool
+ = create_alloc_pool ("live ranges",
+ sizeof (struct live_range), 100);
allocno_pool
= create_alloc_pool ("allocnos", sizeof (struct ira_allocno), 100);
allocno_vec = VEC_alloc (ira_allocno_t, heap, max_reg_num () * 2);
@@ -504,6 +504,25 @@ ira_set_allocno_cover_class (ira_allocno_t a, enum reg_class cover_class)
reg_class_contents[cover_class]);
}
+/* Merge hard register conflicts from allocno FROM into allocno TO. If
+ TOTAL_ONLY is true, we ignore ALLOCNO_CONFLICT_HARD_REGS. */
+static void
+merge_hard_reg_conflicts (ira_allocno_t from, ira_allocno_t to,
+ bool total_only)
+{
+ if (!total_only)
+ IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (to),
+ ALLOCNO_CONFLICT_HARD_REGS (from));
+ IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (to),
+ ALLOCNO_TOTAL_CONFLICT_HARD_REGS (from));
+#ifdef STACK_REGS
+ if (!total_only && ALLOCNO_NO_STACK_REG_P (from))
+ ALLOCNO_NO_STACK_REG_P (to) = true;
+ if (ALLOCNO_TOTAL_NO_STACK_REG_P (from))
+ ALLOCNO_TOTAL_NO_STACK_REG_P (to) = true;
+#endif
+}
+
/* Return TRUE if the conflict vector with NUM elements is more
profitable than conflict bit vector for A. */
bool
@@ -651,7 +670,7 @@ add_to_allocno_conflicts (ira_allocno_t a1, ira_allocno_t a2)
}
ALLOCNO_MAX (a1) = id;
}
- SET_ALLOCNO_SET_BIT (vec, id, ALLOCNO_MIN (a1), ALLOCNO_MAX (a1));
+ SET_MINMAX_SET_BIT (vec, id, ALLOCNO_MIN (a1), ALLOCNO_MAX (a1));
}
}
@@ -781,15 +800,8 @@ create_cap_allocno (ira_allocno_t a)
ALLOCNO_NREFS (cap) = ALLOCNO_NREFS (a);
ALLOCNO_FREQ (cap) = ALLOCNO_FREQ (a);
ALLOCNO_CALL_FREQ (cap) = ALLOCNO_CALL_FREQ (a);
- IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (cap),
- ALLOCNO_CONFLICT_HARD_REGS (a));
- IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (cap),
- ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a));
+ merge_hard_reg_conflicts (a, cap, false);
ALLOCNO_CALLS_CROSSED_NUM (cap) = ALLOCNO_CALLS_CROSSED_NUM (a);
-#ifdef STACK_REGS
- ALLOCNO_NO_STACK_REG_P (cap) = ALLOCNO_NO_STACK_REG_P (a);
- ALLOCNO_TOTAL_NO_STACK_REG_P (cap) = ALLOCNO_TOTAL_NO_STACK_REG_P (a);
-#endif
if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
{
fprintf (ira_dump_file, " Creating cap ");
@@ -800,13 +812,13 @@ create_cap_allocno (ira_allocno_t a)
}
/* Create and return allocno live range with given attributes. */
-allocno_live_range_t
+live_range_t
ira_create_allocno_live_range (ira_allocno_t a, int start, int finish,
- allocno_live_range_t next)
+ live_range_t next)
{
- allocno_live_range_t p;
+ live_range_t p;
- p = (allocno_live_range_t) pool_alloc (allocno_live_range_pool);
+ p = (live_range_t) pool_alloc (live_range_pool);
p->allocno = a;
p->start = start;
p->finish = finish;
@@ -815,22 +827,22 @@ ira_create_allocno_live_range (ira_allocno_t a, int start, int finish,
}
/* Copy allocno live range R and return the result. */
-static allocno_live_range_t
-copy_allocno_live_range (allocno_live_range_t r)
+static live_range_t
+copy_allocno_live_range (live_range_t r)
{
- allocno_live_range_t p;
+ live_range_t p;
- p = (allocno_live_range_t) pool_alloc (allocno_live_range_pool);
+ p = (live_range_t) pool_alloc (live_range_pool);
*p = *r;
return p;
}
/* Copy allocno live range list given by its head R and return the
result. */
-allocno_live_range_t
-ira_copy_allocno_live_range_list (allocno_live_range_t r)
+live_range_t
+ira_copy_allocno_live_range_list (live_range_t r)
{
- allocno_live_range_t p, first, last;
+ live_range_t p, first, last;
if (r == NULL)
return NULL;
@@ -849,11 +861,10 @@ ira_copy_allocno_live_range_list (allocno_live_range_t r)
/* Merge ranges R1 and R2 and returns the result. The function
maintains the order of ranges and tries to minimize number of the
result ranges. */
-allocno_live_range_t
-ira_merge_allocno_live_ranges (allocno_live_range_t r1,
- allocno_live_range_t r2)
+live_range_t
+ira_merge_allocno_live_ranges (live_range_t r1, live_range_t r2)
{
- allocno_live_range_t first, last, temp;
+ live_range_t first, last, temp;
if (r1 == NULL)
return r2;
@@ -927,8 +938,7 @@ ira_merge_allocno_live_ranges (allocno_live_range_t r1,
/* Return TRUE if live ranges R1 and R2 intersect. */
bool
-ira_allocno_live_ranges_intersect_p (allocno_live_range_t r1,
- allocno_live_range_t r2)
+ira_allocno_live_ranges_intersect_p (live_range_t r1, live_range_t r2)
{
/* Remember the live ranges are always kept ordered. */
while (r1 != NULL && r2 != NULL)
@@ -945,16 +955,16 @@ ira_allocno_live_ranges_intersect_p (allocno_live_range_t r1,
/* Free allocno live range R. */
void
-ira_finish_allocno_live_range (allocno_live_range_t r)
+ira_finish_allocno_live_range (live_range_t r)
{
- pool_free (allocno_live_range_pool, r);
+ pool_free (live_range_pool, r);
}
/* Free list of allocno live ranges starting with R. */
void
-ira_finish_allocno_live_range_list (allocno_live_range_t r)
+ira_finish_allocno_live_range_list (live_range_t r)
{
- allocno_live_range_t next_r;
+ live_range_t next_r;
for (; r != NULL; r = next_r)
{
@@ -1015,7 +1025,7 @@ finish_allocnos (void)
VEC_free (ira_allocno_t, heap, ira_conflict_id_allocno_map_vec);
VEC_free (ira_allocno_t, heap, allocno_vec);
free_alloc_pool (allocno_pool);
- free_alloc_pool (allocno_live_range_pool);
+ free_alloc_pool (live_range_pool);
}
@@ -1603,12 +1613,7 @@ propagate_allocno_info (void)
ALLOCNO_NREFS (parent_a) += ALLOCNO_NREFS (a);
ALLOCNO_FREQ (parent_a) += ALLOCNO_FREQ (a);
ALLOCNO_CALL_FREQ (parent_a) += ALLOCNO_CALL_FREQ (a);
-#ifdef STACK_REGS
- if (ALLOCNO_TOTAL_NO_STACK_REG_P (a))
- ALLOCNO_TOTAL_NO_STACK_REG_P (parent_a) = true;
-#endif
- IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (parent_a),
- ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a));
+ merge_hard_reg_conflicts (a, parent_a, true);
ALLOCNO_CALLS_CROSSED_NUM (parent_a)
+= ALLOCNO_CALLS_CROSSED_NUM (a);
ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (parent_a)
@@ -1651,12 +1656,52 @@ create_allocnos (void)
/* The function changes allocno in range list given by R onto A. */
static void
-change_allocno_in_range_list (allocno_live_range_t r, ira_allocno_t a)
+change_allocno_in_range_list (live_range_t r, ira_allocno_t a)
{
for (; r != NULL; r = r->next)
r->allocno = a;
}
+/* Move all live ranges associated with allocno FROM to allocno TO. */
+static void
+move_allocno_live_ranges (ira_allocno_t from, ira_allocno_t to)
+{
+ live_range_t lr = ALLOCNO_LIVE_RANGES (from);
+
+ if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
+ {
+ fprintf (ira_dump_file,
+ " Moving ranges of a%dr%d to a%dr%d: ",
+ ALLOCNO_NUM (from), ALLOCNO_REGNO (from),
+ ALLOCNO_NUM (to), ALLOCNO_REGNO (to));
+ ira_print_live_range_list (ira_dump_file, lr);
+ }
+ change_allocno_in_range_list (lr, to);
+ ALLOCNO_LIVE_RANGES (to)
+ = ira_merge_allocno_live_ranges (lr, ALLOCNO_LIVE_RANGES (to));
+ ALLOCNO_LIVE_RANGES (from) = NULL;
+}
+
+/* Copy all live ranges associated with allocno FROM to allocno TO. */
+static void
+copy_allocno_live_ranges (ira_allocno_t from, ira_allocno_t to)
+{
+ live_range_t lr = ALLOCNO_LIVE_RANGES (from);
+
+ if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
+ {
+ fprintf (ira_dump_file,
+ " Copying ranges of a%dr%d to a%dr%d: ",
+ ALLOCNO_NUM (from), ALLOCNO_REGNO (from),
+ ALLOCNO_NUM (to), ALLOCNO_REGNO (to));
+ ira_print_live_range_list (ira_dump_file, lr);
+ }
+ lr = ira_copy_allocno_live_range_list (lr);
+ change_allocno_in_range_list (lr, to);
+ ALLOCNO_LIVE_RANGES (to)
+ = ira_merge_allocno_live_ranges (lr, ALLOCNO_LIVE_RANGES (to));
+}
+
/* Return TRUE if NODE represents a loop with low register
pressure. */
static bool
@@ -1890,26 +1935,15 @@ propagate_some_info_from_allocno (ira_allocno_t a, ira_allocno_t from_a)
{
enum reg_class cover_class;
- IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
- ALLOCNO_CONFLICT_HARD_REGS (from_a));
-#ifdef STACK_REGS
- if (ALLOCNO_NO_STACK_REG_P (from_a))
- ALLOCNO_NO_STACK_REG_P (a) = true;
-#endif
+ merge_hard_reg_conflicts (from_a, a, false);
ALLOCNO_NREFS (a) += ALLOCNO_NREFS (from_a);
ALLOCNO_FREQ (a) += ALLOCNO_FREQ (from_a);
ALLOCNO_CALL_FREQ (a) += ALLOCNO_CALL_FREQ (from_a);
- IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a),
- ALLOCNO_TOTAL_CONFLICT_HARD_REGS (from_a));
ALLOCNO_CALLS_CROSSED_NUM (a) += ALLOCNO_CALLS_CROSSED_NUM (from_a);
ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (a)
+= ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (from_a);
if (! ALLOCNO_BAD_SPILL_P (from_a))
ALLOCNO_BAD_SPILL_P (a) = false;
-#ifdef STACK_REGS
- if (ALLOCNO_TOTAL_NO_STACK_REG_P (from_a))
- ALLOCNO_TOTAL_NO_STACK_REG_P (a) = true;
-#endif
cover_class = ALLOCNO_COVER_CLASS (from_a);
ira_assert (cover_class == ALLOCNO_COVER_CLASS (a));
ira_allocate_and_accumulate_costs (&ALLOCNO_HARD_REG_COSTS (a), cover_class,
@@ -1930,7 +1964,6 @@ remove_unnecessary_allocnos (void)
bool merged_p, rebuild_p;
ira_allocno_t a, prev_a, next_a, parent_a;
ira_loop_tree_node_t a_node, parent;
- allocno_live_range_t r;
merged_p = false;
regno_allocnos = NULL;
@@ -1971,13 +2004,8 @@ remove_unnecessary_allocnos (void)
ira_regno_allocno_map[regno] = next_a;
else
ALLOCNO_NEXT_REGNO_ALLOCNO (prev_a) = next_a;
- r = ALLOCNO_LIVE_RANGES (a);
- change_allocno_in_range_list (r, parent_a);
- ALLOCNO_LIVE_RANGES (parent_a)
- = ira_merge_allocno_live_ranges
- (r, ALLOCNO_LIVE_RANGES (parent_a));
+ move_allocno_live_ranges (a, parent_a);
merged_p = true;
- ALLOCNO_LIVE_RANGES (a) = NULL;
propagate_some_info_from_allocno (parent_a, a);
/* Remove it from the corresponding regno allocno
map to avoid info propagation of subsequent
@@ -2011,7 +2039,6 @@ remove_low_level_allocnos (void)
bool merged_p, propagate_p;
ira_allocno_t a, top_a;
ira_loop_tree_node_t a_node, parent;
- allocno_live_range_t r;
ira_allocno_iterator ai;
merged_p = false;
@@ -2030,12 +2057,8 @@ remove_low_level_allocnos (void)
propagate_p = a_node->parent->regno_allocno_map[regno] == NULL;
/* Remove the allocno and update info of allocno in the upper
region. */
- r = ALLOCNO_LIVE_RANGES (a);
- change_allocno_in_range_list (r, top_a);
- ALLOCNO_LIVE_RANGES (top_a)
- = ira_merge_allocno_live_ranges (r, ALLOCNO_LIVE_RANGES (top_a));
+ move_allocno_live_ranges (a, top_a);
merged_p = true;
- ALLOCNO_LIVE_RANGES (a) = NULL;
if (propagate_p)
propagate_some_info_from_allocno (top_a, a);
}
@@ -2123,7 +2146,7 @@ update_bad_spill_attribute (void)
int i;
ira_allocno_t a;
ira_allocno_iterator ai;
- allocno_live_range_t r;
+ live_range_t r;
enum reg_class cover_class;
bitmap_head dead_points[N_REG_CLASSES];
@@ -2174,7 +2197,7 @@ setup_min_max_allocno_live_range_point (void)
int i;
ira_allocno_t a, parent_a, cap;
ira_allocno_iterator ai;
- allocno_live_range_t r;
+ live_range_t r;
ira_loop_tree_node_t parent;
FOR_EACH_ALLOCNO (a, ai)
@@ -2391,6 +2414,34 @@ create_caps (void)
IR with one region. */
static ira_allocno_t *regno_top_level_allocno_map;
+/* Find the allocno that corresponds to A at a level one higher up in the
+ loop tree. Returns NULL if A is a cap, or if it has no parent. */
+ira_allocno_t
+ira_parent_allocno (ira_allocno_t a)
+{
+ ira_loop_tree_node_t parent;
+
+ if (ALLOCNO_CAP (a) != NULL)
+ return NULL;
+
+ parent = ALLOCNO_LOOP_TREE_NODE (a)->parent;
+ if (parent == NULL)
+ return NULL;
+
+ return parent->regno_allocno_map[ALLOCNO_REGNO (a)];
+}
+
+/* Find the allocno that corresponds to A at a level one higher up in the
+ loop tree. If ALLOCNO_CAP is set for A, return that. */
+ira_allocno_t
+ira_parent_or_cap_allocno (ira_allocno_t a)
+{
+ if (ALLOCNO_CAP (a) != NULL)
+ return ALLOCNO_CAP (a);
+
+ return ira_parent_allocno (a);
+}
+
/* Process all allocnos originated from pseudo REGNO and copy live
ranges, hard reg conflicts, and allocno stack reg attributes from
low level allocnos to final allocnos which are destinations of
@@ -2402,7 +2453,6 @@ copy_info_to_removed_store_destinations (int regno)
ira_allocno_t a;
ira_allocno_t parent_a = NULL;
ira_loop_tree_node_t parent;
- allocno_live_range_t r;
bool merged_p;
merged_p = false;
@@ -2425,26 +2475,8 @@ copy_info_to_removed_store_destinations (int regno)
break;
if (parent == NULL || parent_a == NULL)
continue;
- if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
- {
- fprintf
- (ira_dump_file,
- " Coping ranges of a%dr%d to a%dr%d: ",
- ALLOCNO_NUM (a), REGNO (ALLOCNO_REG (a)),
- ALLOCNO_NUM (parent_a), REGNO (ALLOCNO_REG (parent_a)));
- ira_print_live_range_list (ira_dump_file,
- ALLOCNO_LIVE_RANGES (a));
- }
- r = ira_copy_allocno_live_range_list (ALLOCNO_LIVE_RANGES (a));
- change_allocno_in_range_list (r, parent_a);
- ALLOCNO_LIVE_RANGES (parent_a)
- = ira_merge_allocno_live_ranges (r, ALLOCNO_LIVE_RANGES (parent_a));
- IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (parent_a),
- ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a));
-#ifdef STACK_REGS
- if (ALLOCNO_TOTAL_NO_STACK_REG_P (a))
- ALLOCNO_TOTAL_NO_STACK_REG_P (parent_a) = true;
-#endif
+ copy_allocno_live_ranges (a, parent_a);
+ merge_hard_reg_conflicts (a, parent_a, true);
ALLOCNO_CALL_FREQ (parent_a) += ALLOCNO_CALL_FREQ (a);
ALLOCNO_CALLS_CROSSED_NUM (parent_a)
+= ALLOCNO_CALLS_CROSSED_NUM (a);
@@ -2472,8 +2504,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit)
enum reg_class cover_class;
ira_allocno_t a, parent_a, first, second, node_first, node_second;
ira_copy_t cp;
- ira_loop_tree_node_t parent, node;
- allocno_live_range_t r;
+ ira_loop_tree_node_t node;
+ live_range_t r;
ira_allocno_iterator ai;
ira_copy_iterator ci;
sparseset allocnos_live;
@@ -2507,10 +2539,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit)
ira_assert (ALLOCNO_CAP_MEMBER (a) == NULL);
if (ALLOCNO_SOMEWHERE_RENAMED_P (a))
new_pseudos_p = true;
- if (ALLOCNO_CAP (a) != NULL
- || (parent = ALLOCNO_LOOP_TREE_NODE (a)->parent) == NULL
- || ((parent_a = parent->regno_allocno_map[ALLOCNO_REGNO (a)])
- == NULL))
+ parent_a = ira_parent_allocno (a);
+ if (parent_a == NULL)
{
ALLOCNO_COPIES (a) = NULL;
regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] = a;
@@ -2522,28 +2552,9 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit)
mem_dest_p = true;
if (REGNO (ALLOCNO_REG (a)) == REGNO (ALLOCNO_REG (parent_a)))
{
- IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (parent_a),
- ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a));
-#ifdef STACK_REGS
- if (ALLOCNO_TOTAL_NO_STACK_REG_P (a))
- ALLOCNO_TOTAL_NO_STACK_REG_P (parent_a) = true;
-#endif
- if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
- {
- fprintf (ira_dump_file,
- " Moving ranges of a%dr%d to a%dr%d: ",
- ALLOCNO_NUM (a), REGNO (ALLOCNO_REG (a)),
- ALLOCNO_NUM (parent_a),
- REGNO (ALLOCNO_REG (parent_a)));
- ira_print_live_range_list (ira_dump_file,
- ALLOCNO_LIVE_RANGES (a));
- }
- change_allocno_in_range_list (ALLOCNO_LIVE_RANGES (a), parent_a);
- ALLOCNO_LIVE_RANGES (parent_a)
- = ira_merge_allocno_live_ranges
- (ALLOCNO_LIVE_RANGES (a), ALLOCNO_LIVE_RANGES (parent_a));
+ merge_hard_reg_conflicts (a, parent_a, true);
+ move_allocno_live_ranges (a, parent_a);
merged_p = true;
- ALLOCNO_LIVE_RANGES (a) = NULL;
ALLOCNO_MEM_OPTIMIZED_DEST_P (parent_a)
= (ALLOCNO_MEM_OPTIMIZED_DEST_P (parent_a)
|| ALLOCNO_MEM_OPTIMIZED_DEST_P (a));
@@ -2577,11 +2588,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit)
ALLOCNO_COVER_CLASS_COST (parent_a)
-= ALLOCNO_COVER_CLASS_COST (a);
ALLOCNO_MEMORY_COST (parent_a) -= ALLOCNO_MEMORY_COST (a);
- if (ALLOCNO_CAP (parent_a) != NULL
- || (parent
- = ALLOCNO_LOOP_TREE_NODE (parent_a)->parent) == NULL
- || (parent_a = (parent->regno_allocno_map
- [ALLOCNO_REGNO (parent_a)])) == NULL)
+ parent_a = ira_parent_allocno (parent_a);
+ if (parent_a == NULL)
break;
}
ALLOCNO_COPIES (a) = NULL;
@@ -2865,7 +2873,7 @@ ira_build (bool loops_p)
{
int n, nr;
ira_allocno_t a;
- allocno_live_range_t r;
+ live_range_t r;
ira_allocno_iterator ai;
n = 0;
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index b46801ce9a7..4a841d787d9 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -485,9 +485,8 @@ assign_hard_reg (ira_allocno_t allocno, bool retry_p)
#ifdef STACK_REGS
no_stack_reg_p = no_stack_reg_p || ALLOCNO_TOTAL_NO_STACK_REG_P (a);
#endif
- for (cost = ALLOCNO_UPDATED_COVER_CLASS_COST (a), i = 0;
- i < class_size;
- i++)
+ cost = ALLOCNO_UPDATED_COVER_CLASS_COST (a);
+ for (i = 0; i < class_size; i++)
if (a_costs != NULL)
{
costs[i] += a_costs[i];
@@ -2494,7 +2493,7 @@ collect_spilled_coalesced_allocnos (int *pseudo_regnos, int n,
/* Array of live ranges of size IRA_ALLOCNOS_NUM. Live range for
given slot contains live ranges of coalesced allocnos assigned to
given slot. */
-static allocno_live_range_t *slot_coalesced_allocnos_live_ranges;
+static live_range_t *slot_coalesced_allocnos_live_ranges;
/* Return TRUE if coalesced allocnos represented by ALLOCNO has live
ranges intersected with live ranges of coalesced allocnos assigned
@@ -2523,7 +2522,7 @@ setup_slot_coalesced_allocno_live_ranges (ira_allocno_t allocno)
{
int n;
ira_allocno_t a;
- allocno_live_range_t r;
+ live_range_t r;
n = ALLOCNO_TEMP (allocno);
for (a = ALLOCNO_NEXT_COALESCED_ALLOCNO (allocno);;
@@ -2552,10 +2551,9 @@ coalesce_spill_slots (ira_allocno_t *spilled_coalesced_allocnos, int num)
bitmap set_jump_crosses = regstat_get_setjmp_crosses ();
slot_coalesced_allocnos_live_ranges
- = (allocno_live_range_t *) ira_allocate (sizeof (allocno_live_range_t)
- * ira_allocnos_num);
+ = (live_range_t *) ira_allocate (sizeof (live_range_t) * ira_allocnos_num);
memset (slot_coalesced_allocnos_live_ranges, 0,
- sizeof (allocno_live_range_t) * ira_allocnos_num);
+ sizeof (live_range_t) * ira_allocnos_num);
last_coalesced_allocno_num = 0;
/* Coalesce non-conflicting spilled allocnos preferring most
frequently used. */
@@ -3245,7 +3243,7 @@ fast_allocation (void)
enum machine_mode mode;
ira_allocno_t a;
ira_allocno_iterator ai;
- allocno_live_range_t r;
+ live_range_t r;
HARD_REG_SET conflict_hard_regs, *used_hard_regs;
sorted_allocnos = (ira_allocno_t *) ira_allocate (sizeof (ira_allocno_t)
diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c
index 70100acbb7f..9e9927a9059 100644
--- a/gcc/ira-conflicts.c
+++ b/gcc/ira-conflicts.c
@@ -54,10 +54,10 @@ static IRA_INT_TYPE **conflicts;
#define CONFLICT_ALLOCNO_P(A1, A2) \
(ALLOCNO_MIN (A1) <= ALLOCNO_CONFLICT_ID (A2) \
&& ALLOCNO_CONFLICT_ID (A2) <= ALLOCNO_MAX (A1) \
- && TEST_ALLOCNO_SET_BIT (conflicts[ALLOCNO_NUM (A1)], \
- ALLOCNO_CONFLICT_ID (A2), \
- ALLOCNO_MIN (A1), \
- ALLOCNO_MAX (A1)))
+ && TEST_MINMAX_SET_BIT (conflicts[ALLOCNO_NUM (A1)], \
+ ALLOCNO_CONFLICT_ID (A2), \
+ ALLOCNO_MIN (A1), \
+ ALLOCNO_MAX (A1)))
@@ -71,7 +71,7 @@ build_conflict_bit_table (void)
unsigned int j;
enum reg_class cover_class;
ira_allocno_t allocno, live_a;
- allocno_live_range_t r;
+ live_range_t r;
ira_allocno_iterator ai;
sparseset allocnos_live;
int allocno_set_words;
@@ -142,13 +142,13 @@ build_conflict_bit_table (void)
/* Don't set up conflict for the allocno with itself. */
&& num != (int) j)
{
- SET_ALLOCNO_SET_BIT (conflicts[num],
- ALLOCNO_CONFLICT_ID (live_a),
- ALLOCNO_MIN (allocno),
- ALLOCNO_MAX (allocno));
- SET_ALLOCNO_SET_BIT (conflicts[j], id,
- ALLOCNO_MIN (live_a),
- ALLOCNO_MAX (live_a));
+ SET_MINMAX_SET_BIT (conflicts[num],
+ ALLOCNO_CONFLICT_ID (live_a),
+ ALLOCNO_MIN (allocno),
+ ALLOCNO_MAX (allocno));
+ SET_MINMAX_SET_BIT (conflicts[j], id,
+ ALLOCNO_MIN (live_a),
+ ALLOCNO_MAX (live_a));
}
}
}
@@ -346,7 +346,6 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p,
enum reg_class rclass, cover_class;
enum machine_mode mode;
ira_copy_t cp;
- ira_loop_tree_node_t parent;
gcc_assert (REG_SUBREG_P (reg1) && REG_SUBREG_P (reg2));
only_regs_p = REG_P (reg1) && REG_P (reg2);
@@ -397,7 +396,7 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p,
cost = ira_get_register_move_cost (mode, cover_class, rclass) * freq;
else
cost = ira_get_register_move_cost (mode, rclass, cover_class) * freq;
- for (;;)
+ do
{
ira_allocate_and_set_costs
(&ALLOCNO_HARD_REG_COSTS (a), cover_class,
@@ -408,12 +407,9 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p,
ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[index] -= cost;
if (ALLOCNO_HARD_REG_COSTS (a)[index] < ALLOCNO_COVER_CLASS_COST (a))
ALLOCNO_COVER_CLASS_COST (a) = ALLOCNO_HARD_REG_COSTS (a)[index];
- if (ALLOCNO_CAP (a) != NULL)
- a = ALLOCNO_CAP (a);
- else if ((parent = ALLOCNO_LOOP_TREE_NODE (a)->parent) == NULL
- || (a = parent->regno_allocno_map[ALLOCNO_REGNO (a)]) == NULL)
- break;
+ a = ira_parent_or_cap_allocno (a);
}
+ while (a != NULL);
return true;
}
@@ -533,7 +529,6 @@ propagate_copies (void)
ira_copy_t cp;
ira_copy_iterator ci;
ira_allocno_t a1, a2, parent_a1, parent_a2;
- ira_loop_tree_node_t parent;
FOR_EACH_COPY (cp, ci)
{
@@ -542,11 +537,8 @@ propagate_copies (void)
if (ALLOCNO_LOOP_TREE_NODE (a1) == ira_loop_tree_root)
continue;
ira_assert ((ALLOCNO_LOOP_TREE_NODE (a2) != ira_loop_tree_root));
- parent = ALLOCNO_LOOP_TREE_NODE (a1)->parent;
- if ((parent_a1 = ALLOCNO_CAP (a1)) == NULL)
- parent_a1 = parent->regno_allocno_map[ALLOCNO_REGNO (a1)];
- if ((parent_a2 = ALLOCNO_CAP (a2)) == NULL)
- parent_a2 = parent->regno_allocno_map[ALLOCNO_REGNO (a2)];
+ parent_a1 = ira_parent_or_cap_allocno (a1);
+ parent_a2 = ira_parent_or_cap_allocno (a2);
ira_assert (parent_a1 != NULL && parent_a2 != NULL);
if (! CONFLICT_ALLOCNO_P (parent_a1, parent_a2))
ira_add_allocno_copy (parent_a1, parent_a2, cp->freq,
@@ -565,16 +557,15 @@ build_allocno_conflicts (ira_allocno_t a)
{
int i, px, parent_num;
int conflict_bit_vec_words_num;
- ira_loop_tree_node_t parent;
ira_allocno_t parent_a, another_a, another_parent_a;
ira_allocno_t *vec;
IRA_INT_TYPE *allocno_conflicts;
- ira_allocno_set_iterator asi;
+ minmax_set_iterator asi;
allocno_conflicts = conflicts[ALLOCNO_NUM (a)];
px = 0;
- FOR_EACH_ALLOCNO_IN_SET (allocno_conflicts,
- ALLOCNO_MIN (a), ALLOCNO_MAX (a), i, asi)
+ FOR_EACH_BIT_IN_MINMAX_SET (allocno_conflicts,
+ ALLOCNO_MIN (a), ALLOCNO_MAX (a), i, asi)
{
another_a = ira_conflict_id_allocno_map[i];
ira_assert (ira_reg_classes_intersect_p
@@ -601,32 +592,27 @@ build_allocno_conflicts (ira_allocno_t a)
ALLOCNO_CONFLICT_ALLOCNO_ARRAY_SIZE (a)
= conflict_bit_vec_words_num * sizeof (IRA_INT_TYPE);
}
- parent = ALLOCNO_LOOP_TREE_NODE (a)->parent;
- if ((parent_a = ALLOCNO_CAP (a)) == NULL
- && (parent == NULL
- || (parent_a = parent->regno_allocno_map[ALLOCNO_REGNO (a)])
- == NULL))
+ parent_a = ira_parent_or_cap_allocno (a);
+ if (parent_a == NULL)
return;
- ira_assert (parent != NULL);
ira_assert (ALLOCNO_COVER_CLASS (a) == ALLOCNO_COVER_CLASS (parent_a));
parent_num = ALLOCNO_NUM (parent_a);
- FOR_EACH_ALLOCNO_IN_SET (allocno_conflicts,
- ALLOCNO_MIN (a), ALLOCNO_MAX (a), i, asi)
+ FOR_EACH_BIT_IN_MINMAX_SET (allocno_conflicts,
+ ALLOCNO_MIN (a), ALLOCNO_MAX (a), i, asi)
{
another_a = ira_conflict_id_allocno_map[i];
ira_assert (ira_reg_classes_intersect_p
[ALLOCNO_COVER_CLASS (a)][ALLOCNO_COVER_CLASS (another_a)]);
- if ((another_parent_a = ALLOCNO_CAP (another_a)) == NULL
- && (another_parent_a = (parent->regno_allocno_map
- [ALLOCNO_REGNO (another_a)])) == NULL)
+ another_parent_a = ira_parent_or_cap_allocno (another_a);
+ if (another_parent_a == NULL)
continue;
ira_assert (ALLOCNO_NUM (another_parent_a) >= 0);
ira_assert (ALLOCNO_COVER_CLASS (another_a)
== ALLOCNO_COVER_CLASS (another_parent_a));
- SET_ALLOCNO_SET_BIT (conflicts[parent_num],
- ALLOCNO_CONFLICT_ID (another_parent_a),
- ALLOCNO_MIN (parent_a),
- ALLOCNO_MAX (parent_a));
+ SET_MINMAX_SET_BIT (conflicts[parent_num],
+ ALLOCNO_CONFLICT_ID (another_parent_a),
+ ALLOCNO_MIN (parent_a),
+ ALLOCNO_MAX (parent_a));
}
}
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 491b86bb841..da26ad3d8c9 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "addresses.h"
#include "insn-config.h"
#include "recog.h"
+#include "reload.h"
#include "toplev.h"
#include "target.h"
#include "params.h"
@@ -123,6 +124,10 @@ static enum reg_class *pref_buffer;
/* Record cover register class of each allocno with the same regno. */
static enum reg_class *regno_cover_class;
+/* Record cost gains for not allocating a register with an invariant
+ equivalence. */
+static int *regno_equiv_gains;
+
/* Execution frequency of the current insn. */
static int frequency;
@@ -151,7 +156,8 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
copy it. */
sri.prev_sri = prev_sri;
sri.extra_cost = 0;
- secondary_class = targetm.secondary_reload (to_p, x, rclass, mode, &sri);
+ secondary_class
+ = (enum reg_class) targetm.secondary_reload (to_p, x, rclass, mode, &sri);
if (secondary_class != NO_REGS)
{
@@ -1263,6 +1269,7 @@ find_costs_and_classes (FILE *dump_file)
#ifdef FORBIDDEN_INC_DEC_CLASSES
int inc_dec_p = false;
#endif
+ int equiv_savings = regno_equiv_gains[i];
if (! allocno_p)
{
@@ -1311,6 +1318,15 @@ find_costs_and_classes (FILE *dump_file)
#endif
}
}
+ if (equiv_savings < 0)
+ temp_costs->mem_cost = -equiv_savings;
+ else if (equiv_savings > 0)
+ {
+ temp_costs->mem_cost = 0;
+ for (k = 0; k < cost_classes_num; k++)
+ temp_costs->cost[k] += equiv_savings;
+ }
+
best_cost = (1 << (HOST_BITS_PER_INT - 2)) - 1;
best = ALL_REGS;
alt_class = NO_REGS;
@@ -1680,6 +1696,8 @@ init_costs (void)
regno_cover_class
= (enum reg_class *) ira_allocate (sizeof (enum reg_class)
* max_reg_num ());
+ regno_equiv_gains = (int *) ira_allocate (sizeof (int) * max_reg_num ());
+ memset (regno_equiv_gains, 0, sizeof (int) * max_reg_num ());
}
/* Common finalization function for ira_costs and
@@ -1687,6 +1705,7 @@ init_costs (void)
static void
finish_costs (void)
{
+ ira_free (regno_equiv_gains);
ira_free (regno_cover_class);
ira_free (pref_buffer);
ira_free (costs);
@@ -1702,6 +1721,7 @@ ira_costs (void)
init_costs ();
total_allocno_costs = (struct costs *) ira_allocate (max_struct_costs_size
* ira_allocnos_num);
+ calculate_elim_costs_all_insns ();
find_costs_and_classes (ira_dump_file);
setup_allocno_cover_class_and_costs ();
finish_costs ();
@@ -1802,3 +1822,16 @@ ira_tune_allocno_costs_and_cover_classes (void)
}
}
}
+
+/* Add COST to the estimated gain for eliminating REGNO with its
+ equivalence. If COST is zero, record that no such elimination is
+ possible. */
+
+void
+ira_adjust_equiv_reg_cost (unsigned regno, int cost)
+{
+ if (cost == 0)
+ regno_equiv_gains[regno] = 0;
+ else
+ regno_equiv_gains[regno] += cost;
+}
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index 18f2e2404ac..705a306654c 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -913,7 +913,7 @@ add_range_and_copies_from_move_list (move_t list, ira_loop_tree_node_t node,
move_t move;
ira_allocno_t to, from, a;
ira_copy_t cp;
- allocno_live_range_t r;
+ live_range_t r;
bitmap_iterator bi;
HARD_REG_SET hard_regs_live;
diff --git a/gcc/ira-int.h b/gcc/ira-int.h
index e56e0518945..1da087cecdb 100644
--- a/gcc/ira-int.h
+++ b/gcc/ira-int.h
@@ -59,7 +59,7 @@ extern FILE *ira_dump_file;
/* Typedefs for pointers to allocno live range, allocno, and copy of
allocnos. */
-typedef struct ira_allocno_live_range *allocno_live_range_t;
+typedef struct live_range *live_range_t;
typedef struct ira_allocno *ira_allocno_t;
typedef struct ira_allocno_copy *ira_copy_t;
@@ -196,7 +196,7 @@ extern ira_loop_tree_node_t ira_loop_nodes;
conflicts for other allocnos (e.g. to assign stack memory slot) we
use the live ranges. If the live ranges of two allocnos are
intersected, the allocnos are in conflict. */
-struct ira_allocno_live_range
+struct live_range
{
/* Allocno whose live range is described by given structure. */
ira_allocno_t allocno;
@@ -204,9 +204,9 @@ struct ira_allocno_live_range
int start, finish;
/* Next structure describing program points where the allocno
lives. */
- allocno_live_range_t next;
+ live_range_t next;
/* Pointer to structures with the same start/finish. */
- allocno_live_range_t start_next, finish_next;
+ live_range_t start_next, finish_next;
};
/* Program points are enumerated by numbers from range
@@ -220,7 +220,7 @@ extern int ira_max_point;
/* Arrays of size IRA_MAX_POINT mapping a program point to the allocno
live ranges with given start/finish point. */
-extern allocno_live_range_t *ira_start_point_ranges, *ira_finish_point_ranges;
+extern live_range_t *ira_start_point_ranges, *ira_finish_point_ranges;
/* A structure representing an allocno (allocation entity). Allocno
represents a pseudo-register in an allocation region. If
@@ -305,7 +305,7 @@ struct ira_allocno
allocno lives. We always maintain the list in such way that *the
ranges in the list are not intersected and ordered by decreasing
their program points*. */
- allocno_live_range_t live_ranges;
+ live_range_t live_ranges;
/* Before building conflicts the two member values are
correspondingly minimal and maximal points of the accumulated
allocno live ranges. After building conflicts the values are
@@ -567,10 +567,16 @@ extern int ira_move_loops_num, ira_additional_jumps_num;
/* Maximal value of element of array ira_reg_class_nregs. */
extern int ira_max_nregs;
-
-/* The number of bits in each element of array used to implement a bit
- vector of allocnos and what type that element has. We use the
- largest integer format on the host machine. */
+
+/* This page contains a bitset implementation called 'min/max sets' used to
+ record conflicts in IRA.
+ They are named min/maxs set since we keep track of a minimum and a maximum
+ bit number for each set representing the bounds of valid elements. Otherwise,
+ the implementation resembles sbitmaps in that we store an array of integers
+ whose bits directly represent the members of the set. */
+
+/* The type used as elements in the array, and the number of bits in
+ this type. */
#define IRA_INT_BITS HOST_BITS_PER_WIDE_INT
#define IRA_INT_TYPE HOST_WIDE_INT
@@ -579,7 +585,7 @@ extern int ira_max_nregs;
MAX. */
#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
-#define SET_ALLOCNO_SET_BIT(R, I, MIN, MAX) __extension__ \
+#define SET_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
(({ int _min = (MIN), _max = (MAX), _i = (I); \
if (_i < _min || _i > _max) \
{ \
@@ -592,7 +598,7 @@ extern int ira_max_nregs;
|= ((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
-#define CLEAR_ALLOCNO_SET_BIT(R, I, MIN, MAX) __extension__ \
+#define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
(({ int _min = (MIN), _max = (MAX), _i = (I); \
if (_i < _min || _i > _max) \
{ \
@@ -604,7 +610,7 @@ extern int ira_max_nregs;
((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \
&= ~((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
-#define TEST_ALLOCNO_SET_BIT(R, I, MIN, MAX) __extension__ \
+#define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
(({ int _min = (MIN), _max = (MAX), _i = (I); \
if (_i < _min || _i > _max) \
{ \
@@ -618,25 +624,24 @@ extern int ira_max_nregs;
#else
-#define SET_ALLOCNO_SET_BIT(R, I, MIN, MAX) \
+#define SET_MINMAX_SET_BIT(R, I, MIN, MAX) \
((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
|= ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
-#define CLEAR_ALLOCNO_SET_BIT(R, I, MIN, MAX) \
+#define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) \
((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
&= ~((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
-#define TEST_ALLOCNO_SET_BIT(R, I, MIN, MAX) \
+#define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) \
((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
& ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
#endif
-/* The iterator for allocno set implemented ed as allocno bit
- vector. */
+/* The iterator for min/max sets. */
typedef struct {
- /* Array containing the allocno bit vector. */
+ /* Array containing the bit vector. */
IRA_INT_TYPE *vec;
/* The number of the current element in the vector. */
@@ -653,13 +658,13 @@ typedef struct {
/* The word of the bit vector currently visited. */
unsigned IRA_INT_TYPE word;
-} ira_allocno_set_iterator;
+} minmax_set_iterator;
-/* Initialize the iterator I for allocnos bit vector VEC containing
- minimal and maximal values MIN and MAX. */
+/* Initialize the iterator I for bit vector VEC containing minimal and
+ maximal values MIN and MAX. */
static inline void
-ira_allocno_set_iter_init (ira_allocno_set_iterator *i,
- IRA_INT_TYPE *vec, int min, int max)
+minmax_set_iter_init (minmax_set_iterator *i, IRA_INT_TYPE *vec, int min,
+ int max)
{
i->vec = vec;
i->word_num = 0;
@@ -669,11 +674,11 @@ ira_allocno_set_iter_init (ira_allocno_set_iterator *i,
i->word = i->nel == 0 ? 0 : vec[0];
}
-/* Return TRUE if we have more allocnos to visit, in which case *N is
- set to the allocno number to be visited. Otherwise, return
+/* Return TRUE if we have more elements to visit, in which case *N is
+ set to the number of the element to be visited. Otherwise, return
FALSE. */
static inline bool
-ira_allocno_set_iter_cond (ira_allocno_set_iterator *i, int *n)
+minmax_set_iter_cond (minmax_set_iterator *i, int *n)
{
/* Skip words that are zeros. */
for (; i->word == 0; i->word = i->vec[i->word_num])
@@ -695,23 +700,23 @@ ira_allocno_set_iter_cond (ira_allocno_set_iterator *i, int *n)
return true;
}
-/* Advance to the next allocno in the set. */
+/* Advance to the next element in the set. */
static inline void
-ira_allocno_set_iter_next (ira_allocno_set_iterator *i)
+minmax_set_iter_next (minmax_set_iterator *i)
{
i->word >>= 1;
i->bit_num++;
}
-/* Loop over all elements of allocno set given by bit vector VEC and
+/* Loop over all elements of a min/max set given by bit vector VEC and
their minimal and maximal values MIN and MAX. In each iteration, N
is set to the number of next allocno. ITER is an instance of
- ira_allocno_set_iterator used to iterate the allocnos in the set. */
-#define FOR_EACH_ALLOCNO_IN_SET(VEC, MIN, MAX, N, ITER) \
- for (ira_allocno_set_iter_init (&(ITER), (VEC), (MIN), (MAX)); \
- ira_allocno_set_iter_cond (&(ITER), &(N)); \
- ira_allocno_set_iter_next (&(ITER)))
-
+ minmax_set_iterator used to iterate over the set. */
+#define FOR_EACH_BIT_IN_MINMAX_SET(VEC, MIN, MAX, N, ITER) \
+ for (minmax_set_iter_init (&(ITER), (VEC), (MIN), (MAX)); \
+ minmax_set_iter_cond (&(ITER), &(N)); \
+ minmax_set_iter_next (&(ITER)))
+
/* ira.c: */
/* Map: hard regs X modes -> set of hard registers for storing value
@@ -719,7 +724,7 @@ ira_allocno_set_iter_next (ira_allocno_set_iterator *i)
extern HARD_REG_SET ira_reg_mode_hard_regset
[FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES];
-/* Array analogous to macro REGISTER_MOVE_COST. Don't use
+/* Array based on TARGET_REGISTER_MOVE_COST. Don't use
ira_register_move_cost directly. Use function of
ira_get_may_move_cost instead. */
extern move_table *ira_register_move_cost[MAX_MACHINE_MODE];
@@ -838,6 +843,8 @@ extern void ira_debug_allocno_copies (ira_allocno_t);
extern void ira_traverse_loop_tree (bool, ira_loop_tree_node_t,
void (*) (ira_loop_tree_node_t),
void (*) (ira_loop_tree_node_t));
+extern ira_allocno_t ira_parent_allocno (ira_allocno_t);
+extern ira_allocno_t ira_parent_or_cap_allocno (ira_allocno_t);
extern ira_allocno_t ira_create_allocno (int, bool, ira_loop_tree_node_t);
extern void ira_set_allocno_cover_class (ira_allocno_t, enum reg_class);
extern bool ira_conflict_vector_profitable_p (ira_allocno_t, int);
@@ -845,16 +852,13 @@ extern void ira_allocate_allocno_conflict_vec (ira_allocno_t, int);
extern void ira_allocate_allocno_conflicts (ira_allocno_t, int);
extern void ira_add_allocno_conflict (ira_allocno_t, ira_allocno_t);
extern void ira_print_expanded_allocno (ira_allocno_t);
-extern allocno_live_range_t ira_create_allocno_live_range
- (ira_allocno_t, int, int, allocno_live_range_t);
-extern allocno_live_range_t ira_copy_allocno_live_range_list
- (allocno_live_range_t);
-extern allocno_live_range_t ira_merge_allocno_live_ranges
- (allocno_live_range_t, allocno_live_range_t);
-extern bool ira_allocno_live_ranges_intersect_p (allocno_live_range_t,
- allocno_live_range_t);
-extern void ira_finish_allocno_live_range (allocno_live_range_t);
-extern void ira_finish_allocno_live_range_list (allocno_live_range_t);
+extern live_range_t ira_create_allocno_live_range (ira_allocno_t, int, int,
+ live_range_t);
+extern live_range_t ira_copy_allocno_live_range_list (live_range_t);
+extern live_range_t ira_merge_allocno_live_ranges (live_range_t, live_range_t);
+extern bool ira_allocno_live_ranges_intersect_p (live_range_t, live_range_t);
+extern void ira_finish_allocno_live_range (live_range_t);
+extern void ira_finish_allocno_live_range_list (live_range_t);
extern void ira_free_allocno_updated_costs (ira_allocno_t);
extern ira_copy_t ira_create_copy (ira_allocno_t, ira_allocno_t,
int, bool, rtx, ira_loop_tree_node_t);
@@ -881,8 +885,8 @@ extern void ira_tune_allocno_costs_and_cover_classes (void);
/* ira-lives.c */
extern void ira_rebuild_start_finish_chains (void);
-extern void ira_print_live_range_list (FILE *, allocno_live_range_t);
-extern void ira_debug_live_range_list (allocno_live_range_t);
+extern void ira_print_live_range_list (FILE *, live_range_t);
+extern void ira_debug_live_range_list (live_range_t);
extern void ira_debug_allocno_live_ranges (ira_allocno_t);
extern void ira_debug_live_ranges (void);
extern void ira_create_allocno_live_ranges (void);
diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index 7ced1a7a73d..f879068aa5e 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -54,7 +54,7 @@ int ira_max_point;
/* Arrays of size IRA_MAX_POINT mapping a program point to the allocno
live ranges with given start/finish point. */
-allocno_live_range_t *ira_start_point_ranges, *ira_finish_point_ranges;
+live_range_t *ira_start_point_ranges, *ira_finish_point_ranges;
/* Number of the current program point. */
static int curr_point;
@@ -81,33 +81,44 @@ static int last_call_num;
/* The number of last call at which given allocno was saved. */
static int *allocno_saved_at_call;
-/* The function processing birth of register REGNO. It updates living
- hard regs and conflict hard regs for living allocnos or starts a
- new live range for the allocno corresponding to REGNO if it is
- necessary. */
+/* Record the birth of hard register REGNO, updating hard_regs_live
+ and hard reg conflict information for living allocno. */
static void
-make_regno_born (int regno)
+make_hard_regno_born (int regno)
{
unsigned int i;
- ira_allocno_t a;
- allocno_live_range_t p;
- if (regno < FIRST_PSEUDO_REGISTER)
+ SET_HARD_REG_BIT (hard_regs_live, regno);
+ EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i)
{
- SET_HARD_REG_BIT (hard_regs_live, regno);
- EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i)
- {
- SET_HARD_REG_BIT (ALLOCNO_CONFLICT_HARD_REGS (ira_allocnos[i]),
- regno);
- SET_HARD_REG_BIT (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (ira_allocnos[i]),
- regno);
- }
- return;
+ SET_HARD_REG_BIT (ALLOCNO_CONFLICT_HARD_REGS (ira_allocnos[i]),
+ regno);
+ SET_HARD_REG_BIT (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (ira_allocnos[i]),
+ regno);
}
- a = ira_curr_regno_allocno_map[regno];
- if (a == NULL)
- return;
- if ((p = ALLOCNO_LIVE_RANGES (a)) == NULL
+}
+
+/* Process the death of hard register REGNO. This updates
+ hard_regs_live. */
+static void
+make_hard_regno_dead (int regno)
+{
+ CLEAR_HARD_REG_BIT (hard_regs_live, regno);
+}
+
+/* Record the birth of allocno A, starting a new live range for
+ it if necessary, and updating hard reg conflict information. We also
+ record it in allocnos_live. */
+static void
+make_allocno_born (ira_allocno_t a)
+{
+ live_range_t p = ALLOCNO_LIVE_RANGES (a);
+
+ sparseset_set_bit (allocnos_live, ALLOCNO_NUM (a));
+ IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a), hard_regs_live);
+ IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a), hard_regs_live);
+
+ if (p == NULL
|| (p->finish != curr_point && p->finish + 1 != curr_point))
ALLOCNO_LIVE_RANGES (a)
= ira_create_allocno_live_range (a, curr_point, -1,
@@ -120,7 +131,7 @@ update_allocno_pressure_excess_length (ira_allocno_t a)
{
int start, i;
enum reg_class cover_class, cl;
- allocno_live_range_t p;
+ live_range_t p;
cover_class = ALLOCNO_COVER_CLASS (a);
for (i = 0;
@@ -137,56 +148,39 @@ update_allocno_pressure_excess_length (ira_allocno_t a)
}
}
-/* Process the death of register REGNO. This updates hard_regs_live
- or finishes the current live range for the allocno corresponding to
- REGNO. */
+/* Process the death of allocno A. This finishes the current live
+ range for it. */
static void
-make_regno_dead (int regno)
+make_allocno_dead (ira_allocno_t a)
{
- ira_allocno_t a;
- allocno_live_range_t p;
+ live_range_t p;
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- CLEAR_HARD_REG_BIT (hard_regs_live, regno);
- return;
- }
- a = ira_curr_regno_allocno_map[regno];
- if (a == NULL)
- return;
p = ALLOCNO_LIVE_RANGES (a);
ira_assert (p != NULL);
p->finish = curr_point;
update_allocno_pressure_excess_length (a);
+ sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (a));
}
/* The current register pressures for each cover class for the current
basic block. */
static int curr_reg_pressure[N_REG_CLASSES];
-/* Mark allocno A as currently living and update current register
- pressure, maximal register pressure for the current BB, start point
- of the register pressure excess, and conflicting hard registers of
- A. */
+/* Record that register pressure for COVER_CLASS increased by N
+ registers. Update the current register pressure, maximal register
+ pressure for the current BB and the start point of the register
+ pressure excess. */
static void
-set_allocno_live (ira_allocno_t a)
+inc_register_pressure (enum reg_class cover_class, int n)
{
int i;
- enum reg_class cover_class, cl;
+ enum reg_class cl;
- /* Invalidate because it is referenced. */
- allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
- if (sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a)))
- return;
- sparseset_set_bit (allocnos_live, ALLOCNO_NUM (a));
- IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a), hard_regs_live);
- IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a), hard_regs_live);
- cover_class = ALLOCNO_COVER_CLASS (a);
for (i = 0;
(cl = ira_reg_class_super_classes[cover_class][i]) != LIM_REG_CLASSES;
i++)
{
- curr_reg_pressure[cl] += ira_reg_class_nregs[cl][ALLOCNO_MODE (a)];
+ curr_reg_pressure[cl] += n;
if (high_pressure_start_point[cl] < 0
&& (curr_reg_pressure[cl] > ira_available_class_regs[cl]))
high_pressure_start_point[cl] = curr_point;
@@ -195,110 +189,87 @@ set_allocno_live (ira_allocno_t a)
}
}
-/* Mark allocno A as currently not living and update current register
- pressure, start point of the register pressure excess, and register
- pressure excess length for living allocnos. */
+/* Record that register pressure for COVER_CLASS has decreased by
+ NREGS registers; update current register pressure, start point of
+ the register pressure excess, and register pressure excess length
+ for living allocnos. */
+
static void
-clear_allocno_live (ira_allocno_t a)
+dec_register_pressure (enum reg_class cover_class, int nregs)
{
int i;
unsigned int j;
- enum reg_class cover_class, cl;
- bool set_p;
+ enum reg_class cl;
+ bool set_p = false;
- /* Invalidate because it is referenced. */
- allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
- if (sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a)))
+ for (i = 0;
+ (cl = ira_reg_class_super_classes[cover_class][i]) != LIM_REG_CLASSES;
+ i++)
{
- cover_class = ALLOCNO_COVER_CLASS (a);
- set_p = false;
+ curr_reg_pressure[cl] -= nregs;
+ ira_assert (curr_reg_pressure[cl] >= 0);
+ if (high_pressure_start_point[cl] >= 0
+ && curr_reg_pressure[cl] <= ira_available_class_regs[cl])
+ set_p = true;
+ }
+ if (set_p)
+ {
+ EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, j)
+ update_allocno_pressure_excess_length (ira_allocnos[j]);
for (i = 0;
(cl = ira_reg_class_super_classes[cover_class][i])
!= LIM_REG_CLASSES;
i++)
- {
- curr_reg_pressure[cl] -= ira_reg_class_nregs[cl][ALLOCNO_MODE (a)];
- ira_assert (curr_reg_pressure[cl] >= 0);
- if (high_pressure_start_point[cl] >= 0
- && curr_reg_pressure[cl] <= ira_available_class_regs[cl])
- set_p = true;
- }
- if (set_p)
- {
- EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, j)
- update_allocno_pressure_excess_length (ira_allocnos[j]);
- for (i = 0;
- (cl = ira_reg_class_super_classes[cover_class][i])
- != LIM_REG_CLASSES;
- i++)
- if (high_pressure_start_point[cl] >= 0
- && curr_reg_pressure[cl] <= ira_available_class_regs[cl])
- high_pressure_start_point[cl] = -1;
-
- }
+ if (high_pressure_start_point[cl] >= 0
+ && curr_reg_pressure[cl] <= ira_available_class_regs[cl])
+ high_pressure_start_point[cl] = -1;
}
- sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (a));
}
-/* Mark the register REG as live. Store a 1 in hard_regs_live or
- allocnos_live for this register or the corresponding allocno,
- record how many consecutive hardware registers it actually
- needs. */
+/* Mark the pseudo register REGNO as live. Update all information about
+ live ranges and register pressure. */
static void
-mark_reg_live (rtx reg)
+mark_pseudo_regno_live (int regno)
{
- int i, regno;
+ ira_allocno_t a = ira_curr_regno_allocno_map[regno];
+ enum reg_class cl;
+ int nregs;
- gcc_assert (REG_P (reg));
- regno = REGNO (reg);
+ if (a == NULL)
+ return;
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- ira_allocno_t a = ira_curr_regno_allocno_map[regno];
+ /* Invalidate because it is referenced. */
+ allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
- if (a != NULL)
- {
- if (sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a)))
- {
- /* Invalidate because it is referenced. */
- allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
- return;
- }
- set_allocno_live (a);
- }
- make_regno_born (regno);
- }
- else if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
+ if (sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a)))
+ return;
+
+ cl = ALLOCNO_COVER_CLASS (a);
+ nregs = ira_reg_class_nregs[cl][ALLOCNO_MODE (a)];
+ inc_register_pressure (cl, nregs);
+ make_allocno_born (a);
+}
+
+/* Mark the hard register REG as live. Store a 1 in hard_regs_live
+ for this register, record how many consecutive hardware registers
+ it actually needs. */
+static void
+mark_hard_reg_live (rtx reg)
+{
+ int regno = REGNO (reg);
+
+ if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
{
int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
- enum reg_class cover_class, cl;
while (regno < last)
{
if (! TEST_HARD_REG_BIT (hard_regs_live, regno)
&& ! TEST_HARD_REG_BIT (eliminable_regset, regno))
{
- cover_class = ira_hard_regno_cover_class[regno];
- for (i = 0;
- (cl = ira_reg_class_super_classes[cover_class][i])
- != LIM_REG_CLASSES;
- i++)
- {
- curr_reg_pressure[cl]++;
- if (high_pressure_start_point[cl] < 0
- && (curr_reg_pressure[cl]
- > ira_available_class_regs[cl]))
- high_pressure_start_point[cl] = curr_point;
- }
- make_regno_born (regno);
- for (i = 0;
- (cl = ira_reg_class_super_classes[cover_class][i])
- != LIM_REG_CLASSES;
- i++)
- {
- if (curr_bb_node->reg_pressure[cl] < curr_reg_pressure[cl])
- curr_bb_node->reg_pressure[cl] = curr_reg_pressure[cl];
- }
+ enum reg_class cover_class = ira_hard_regno_cover_class[regno];
+ inc_register_pressure (cover_class, 1);
+ make_hard_regno_born (regno);
}
regno++;
}
@@ -314,74 +285,55 @@ mark_ref_live (df_ref ref)
reg = DF_REF_REG (ref);
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
- mark_reg_live (reg);
+ if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
+ mark_pseudo_regno_live (REGNO (reg));
+ else
+ mark_hard_reg_live (reg);
}
-/* Mark the register REG as dead. Store a 0 in hard_regs_live or
- allocnos_live for the register. */
+/* Mark the pseudo register REGNO as dead. Update all information about
+ live ranges and register pressure. */
static void
-mark_reg_dead (rtx reg)
+mark_pseudo_regno_dead (int regno)
{
- int regno;
+ ira_allocno_t a = ira_curr_regno_allocno_map[regno];
+ enum reg_class cl;
+ int nregs;
- gcc_assert (REG_P (reg));
- regno = REGNO (reg);
+ if (a == NULL)
+ return;
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- ira_allocno_t a = ira_curr_regno_allocno_map[regno];
+ /* Invalidate because it is referenced. */
+ allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
- if (a != NULL)
- {
- if (! sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a)))
- {
- /* Invalidate because it is referenced. */
- allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
- return;
- }
- clear_allocno_live (a);
- }
- make_regno_dead (regno);
- }
- else if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
+ if (! sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a)))
+ return;
+
+ cl = ALLOCNO_COVER_CLASS (a);
+ nregs = ira_reg_class_nregs[cl][ALLOCNO_MODE (a)];
+ dec_register_pressure (cl, nregs);
+
+ make_allocno_dead (a);
+}
+
+/* Mark the hard register REG as dead. Store a 0 in hard_regs_live
+ for the register. */
+static void
+mark_hard_reg_dead (rtx reg)
+{
+ int regno = REGNO (reg);
+
+ if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
{
- int i;
- unsigned int j;
int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
- enum reg_class cover_class, cl;
- bool set_p;
while (regno < last)
{
if (TEST_HARD_REG_BIT (hard_regs_live, regno))
{
- set_p = false;
- cover_class = ira_hard_regno_cover_class[regno];
- for (i = 0;
- (cl = ira_reg_class_super_classes[cover_class][i])
- != LIM_REG_CLASSES;
- i++)
- {
- curr_reg_pressure[cl]--;
- if (high_pressure_start_point[cl] >= 0
- && curr_reg_pressure[cl] <= ira_available_class_regs[cl])
- set_p = true;
- ira_assert (curr_reg_pressure[cl] >= 0);
- }
- if (set_p)
- {
- EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, j)
- update_allocno_pressure_excess_length (ira_allocnos[j]);
- for (i = 0;
- (cl = ira_reg_class_super_classes[cover_class][i])
- != LIM_REG_CLASSES;
- i++)
- if (high_pressure_start_point[cl] >= 0
- && (curr_reg_pressure[cl]
- <= ira_available_class_regs[cl]))
- high_pressure_start_point[cl] = -1;
- }
- make_regno_dead (regno);
+ enum reg_class cover_class = ira_hard_regno_cover_class[regno];
+ dec_register_pressure (cover_class, 1);
+ make_hard_regno_dead (regno);
}
regno++;
}
@@ -402,7 +354,10 @@ mark_ref_dead (df_ref def)
reg = DF_REF_REG (def);
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
- mark_reg_dead (reg);
+ if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
+ mark_pseudo_regno_dead (REGNO (reg));
+ else
+ mark_hard_reg_dead (reg);
}
/* Make pseudo REG conflicting with pseudo DREG, if the 1st pseudo
@@ -427,10 +382,10 @@ make_pseudo_conflict (rtx reg, enum reg_class cl, rtx dreg, bool advance_p)
if (advance_p)
curr_point++;
- mark_reg_live (reg);
- mark_reg_live (dreg);
- mark_reg_dead (reg);
- mark_reg_dead (dreg);
+ mark_pseudo_regno_live (REGNO (reg));
+ mark_pseudo_regno_live (REGNO (dreg));
+ mark_pseudo_regno_dead (REGNO (reg));
+ mark_pseudo_regno_dead (REGNO (dreg));
return false;
}
@@ -961,15 +916,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
}
}
EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi)
- {
- ira_allocno_t a = ira_curr_regno_allocno_map[j];
-
- if (a == NULL)
- continue;
- ira_assert (! sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a)));
- set_allocno_live (a);
- make_regno_born (j);
- }
+ mark_pseudo_regno_live (j);
freq = REG_FREQ_FROM_BB (bb);
if (freq == 0)
@@ -1137,7 +1084,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
unsigned int regno = EH_RETURN_DATA_REGNO (j);
if (regno == INVALID_REGNUM)
break;
- make_regno_born (regno);
+ make_hard_regno_born (regno);
}
#endif
@@ -1155,7 +1102,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
ALLOCNO_TOTAL_NO_STACK_REG_P (ira_allocnos[px]) = true;
}
for (px = FIRST_STACK_REG; px <= LAST_STACK_REG; px++)
- make_regno_born (px);
+ make_hard_regno_born (px);
#endif
/* No need to record conflicts for call clobbered regs if we
have nonlocal labels around, as we don't ever try to
@@ -1163,13 +1110,11 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
if (!cfun->has_nonlocal_label && bb_has_abnormal_call_pred (bb))
for (px = 0; px < FIRST_PSEUDO_REGISTER; px++)
if (call_used_regs[px])
- make_regno_born (px);
+ make_hard_regno_born (px);
}
EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i)
- {
- make_regno_dead (ALLOCNO_REGNO (ira_allocnos[i]));
- }
+ make_allocno_dead (ira_allocnos[i]);
curr_point++;
@@ -1195,18 +1140,18 @@ create_start_finish_chains (void)
{
ira_allocno_t a;
ira_allocno_iterator ai;
- allocno_live_range_t r;
+ live_range_t r;
ira_start_point_ranges
- = (allocno_live_range_t *) ira_allocate (ira_max_point
- * sizeof (allocno_live_range_t));
+ = (live_range_t *) ira_allocate (ira_max_point
+ * sizeof (live_range_t));
memset (ira_start_point_ranges, 0,
- ira_max_point * sizeof (allocno_live_range_t));
+ ira_max_point * sizeof (live_range_t));
ira_finish_point_ranges
- = (allocno_live_range_t *) ira_allocate (ira_max_point
- * sizeof (allocno_live_range_t));
+ = (live_range_t *) ira_allocate (ira_max_point
+ * sizeof (live_range_t));
memset (ira_finish_point_ranges, 0,
- ira_max_point * sizeof (allocno_live_range_t));
+ ira_max_point * sizeof (live_range_t));
FOR_EACH_ALLOCNO (a, ai)
{
for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
@@ -1240,7 +1185,7 @@ remove_some_program_points_and_update_live_ranges (void)
int *map;
ira_allocno_t a;
ira_allocno_iterator ai;
- allocno_live_range_t r;
+ live_range_t r;
bitmap born_or_died;
bitmap_iterator bi;
@@ -1278,7 +1223,7 @@ remove_some_program_points_and_update_live_ranges (void)
/* Print live ranges R to file F. */
void
-ira_print_live_range_list (FILE *f, allocno_live_range_t r)
+ira_print_live_range_list (FILE *f, live_range_t r)
{
for (; r != NULL; r = r->next)
fprintf (f, " [%d..%d]", r->start, r->finish);
@@ -1287,7 +1232,7 @@ ira_print_live_range_list (FILE *f, allocno_live_range_t r)
/* Print live ranges R to stderr. */
void
-ira_debug_live_range_list (allocno_live_range_t r)
+ira_debug_live_range_list (live_range_t r)
{
ira_print_live_range_list (stderr, r);
}
diff --git a/gcc/ira.c b/gcc/ira.c
index 84d7bc1643b..0f0b70ab473 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -331,9 +331,6 @@ int internal_flag_ira_verbose;
/* Dump file of the allocator if it is not NULL. */
FILE *ira_dump_file;
-/* Pools for allocnos, copies, allocno live ranges. */
-alloc_pool allocno_pool, copy_pool, allocno_live_range_pool;
-
/* The number of elements in the following array. */
int ira_spilled_reg_stack_slots_num;
@@ -358,9 +355,10 @@ HARD_REG_SET eliminable_regset;
of given mode starting with given hard register. */
HARD_REG_SET ira_reg_mode_hard_regset[FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES];
-/* The following two variables are array analogs of the macros
- MEMORY_MOVE_COST and REGISTER_MOVE_COST. */
+/* Array analogous to target hook TARGET_MEMORY_MOVE_COST. */
short int ira_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2];
+
+/* Array based on TARGET_REGISTER_MOVE_COST. */
move_table *ira_register_move_cost[MAX_MACHINE_MODE];
/* Similar to may_move_in_cost but it is calculated in IRA instead of
@@ -527,11 +525,11 @@ setup_class_subset_and_memory_move_costs (void)
for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
{
ira_memory_move_cost[mode][cl][0] =
- MEMORY_MOVE_COST ((enum machine_mode) mode,
- (enum reg_class) cl, 0);
+ memory_move_cost ((enum machine_mode) mode,
+ (enum reg_class) cl, false);
ira_memory_move_cost[mode][cl][1] =
- MEMORY_MOVE_COST ((enum machine_mode) mode,
- (enum reg_class) cl, 1);
+ memory_move_cost ((enum machine_mode) mode,
+ (enum reg_class) cl, true);
/* Costs for NO_REGS are used in cost calculation on the
1st pass when the preferred register classes are not
known yet. In this case we take the best scenario. */
@@ -742,7 +740,7 @@ setup_cover_and_important_classes (void)
{
int i, j, n, cl;
bool set_p;
- const enum reg_class *cover_classes;
+ const reg_class_t *cover_classes;
HARD_REG_SET temp_hard_regset2;
static enum reg_class classes[LIM_REG_CLASSES + 1];
@@ -1585,12 +1583,8 @@ find_reg_equiv_invariant_const (void)
x = XEXP (note, 0);
- if (! function_invariant_p (x)
- || ! flag_pic
- /* A function invariant is often CONSTANT_P but may
- include a register. We promise to only pass CONSTANT_P
- objects to LEGITIMATE_PIC_OPERAND_P. */
- || (CONSTANT_P (x) && LEGITIMATE_PIC_OPERAND_P (x)))
+ if (! CONSTANT_P (x)
+ || ! flag_pic || LEGITIMATE_PIC_OPERAND_P (x))
{
/* It can happen that a REG_EQUIV note contains a MEM
that is not a legitimate memory operand. As later
@@ -1790,8 +1784,7 @@ fix_reg_equiv_init (void)
if (reg_equiv_init_size < max_regno)
{
- reg_equiv_init
- = (rtx *) ggc_realloc (reg_equiv_init, max_regno * sizeof (rtx));
+ reg_equiv_init = GGC_RESIZEVEC (rtx, reg_equiv_init, max_regno);
while (reg_equiv_init_size < max_regno)
reg_equiv_init[reg_equiv_init_size++] = NULL_RTX;
for (i = FIRST_PSEUDO_REGISTER; i < reg_equiv_init_size; i++)
@@ -2370,7 +2363,7 @@ update_equiv_regs (void)
recorded_label_ref = 0;
reg_equiv = XCNEWVEC (struct equivalence, max_regno);
- reg_equiv_init = GGC_CNEWVEC (rtx, max_regno);
+ reg_equiv_init = ggc_alloc_cleared_vec_rtx (max_regno);
reg_equiv_init_size = max_regno;
init_alias_analysis ();
@@ -3149,8 +3142,19 @@ build_insn_chain (void)
if (dump_file)
print_insn_chains (dump_file);
}
-
+/* Allocate memory for reg_equiv_memory_loc. */
+static void
+init_reg_equiv_memory_loc (void)
+{
+ max_regno = max_reg_num ();
+
+ /* And the reg_equiv_memory_loc array. */
+ VEC_safe_grow (rtx, gc, reg_equiv_memory_loc_vec, max_regno);
+ memset (VEC_address (rtx, reg_equiv_memory_loc_vec), 0,
+ sizeof (rtx) * max_regno);
+ reg_equiv_memory_loc = VEC_address (rtx, reg_equiv_memory_loc_vec);
+}
/* All natural loops. */
struct loops ira_loops;
@@ -3255,6 +3259,8 @@ ira (FILE *f)
record_loop_exits ();
current_loops = &ira_loops;
+ init_reg_equiv_memory_loc ();
+
if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
fprintf (ira_dump_file, "Building IRA IR\n");
loops_p = ira_build (optimize
@@ -3315,13 +3321,8 @@ ira (FILE *f)
#endif
delete_trivially_dead_insns (get_insns (), max_reg_num ());
- max_regno = max_reg_num ();
- /* And the reg_equiv_memory_loc array. */
- VEC_safe_grow (rtx, gc, reg_equiv_memory_loc_vec, max_regno);
- memset (VEC_address (rtx, reg_equiv_memory_loc_vec), 0,
- sizeof (rtx) * max_regno);
- reg_equiv_memory_loc = VEC_address (rtx, reg_equiv_memory_loc_vec);
+ init_reg_equiv_memory_loc ();
if (max_regno != max_regno_before_ira)
{
diff --git a/gcc/ira.h b/gcc/ira.h
index 8c9734b8be3..12b4b42017a 100644
--- a/gcc/ira.h
+++ b/gcc/ira.h
@@ -58,7 +58,7 @@ extern HARD_REG_SET ira_no_alloc_regs;
mode or when the conflict table is too big. */
extern bool ira_conflicts_p;
-/* Array analogous to macro MEMORY_MOVE_COST. */
+/* Array analogous to target hook TARGET_MEMORY_MOVE_COST. */
extern short ira_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2];
/* Array of number of hard registers of given class which are
@@ -88,3 +88,4 @@ extern void ira_mark_new_stack_slot (rtx, int, unsigned int);
extern bool ira_better_spill_reload_regno_p (int *, int *, rtx, rtx, rtx);
extern bool ira_bad_reload_regno (int, rtx, rtx);
+extern void ira_adjust_equiv_reg_cost (unsigned, int);
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index f001cfb50e7..e7589638f54 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,75 @@
+2010-06-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * java-tree.h (struct lang_type) [catch_classes]: Change type to a
+ VEC.
+ * except.c (prepare_eh_table_type): Call CONSTRUCTOR_APPEND_ELT
+ instead of tree_cons.
+ * class.c (make_class): Add dummy entry to TYPE_CATCH_CLASSES.
+ (emit_catch_table): Adjust for new type of TYPE_CATCH_CLASSES.
+
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * lang.c: Do not include except.h
+ * except.c: Likewise.
+ (doing_eh): New, moved from except.c (in gcc/) but removed the
+ do_warning flag.
+ (maybe_start_try): Update doing_eh call.
+ * Make-lang.in: Update dependencies.
+
+2010-06-23 Anatoly Sokolov <aesok@post.ru>
+
+ * decl.c (java_init_decl_processing): Use double_int_to_tree instead
+ of build_int_cst_wide.
+ * boehm.c (set_bit): Remove.
+ (mark_reference_fields): Use double_int type for 'mask' argument.
+ Use double_int_setbit instead of set_bit.
+ (get_boehm_type_descriptor): Use double_int_setbit instead of
+ set_bit. Use double_int_to_tree instead of build_int_cst_wide.
+
+2010-06-10 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * gcj.texi: Move to GFDL version 1.3. Fix copyright years.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation.
+
+ * jcf-parse.c (java_parse_file): Likewise.
+ (process_zip_dir): Likewise.
+
+ * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise.
+ (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise.
+
+ * expr.c (add_type_assertion): Likewise.
+
+ * decl.c (make_binding_level): Likewise.
+ (java_dup_lang_specific_decl): Likewise.
+
+ * constants.c (set_constant_entry): Likewise.
+ (cpool_for_class): Likewise.
+
+ * class.c (add_method_1): Likewise.
+ (java_treetreehash_new): Likewise.
+
+ * java-tree.h (struct lang_type): Add variable_size GTY option.
+ (struct lang_decl): Likewise.
+
+ * jch.h (struct cpool_entry): Likewise.
+
+ * java-tree.h (java_treetreehash_create): Remove parameter ggc.
+
+ * except.c (prepare_eh_table_type): Update
+ java_treetreehash_create call.
+
+ * class.c (add_method_1): Update java_treetreehash_create call.
+ (java_treetreehash_create): Remove parameter gc. Use
+ htab_create_ggc.
+
+2010-06-04 Joseph Myers <joseph@codesourcery.com>
+
+ * jvspec.c (lang_specific_driver): Use GCC-specific formats in
+ diagnostics.
+
2010-05-30 Steven Bosscher <steven@gcc.gnu.org>
* except.c: Include tm.h.
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index 26a81bab79a..5e240ed0743 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -285,7 +285,7 @@ java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
libfuncs.h java/java-except.h $(GGC_H) $(REAL_H) gt-java-decl.h \
$(TARGET_H) $(CGRAPH_H) langhooks.h
java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
- java/javaop.h java/java-opcodes.h except.h java/java-except.h \
+ java/javaop.h java/java-opcodes.h java/java-except.h \
toplev.h $(SYSTEM_H) coretypes.h
java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
java/javaop.h java/java-opcodes.h \
@@ -302,7 +302,7 @@ java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
coretypes.h $(TM_H) intl.h
java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_H) \
- langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h $(EXCEPT_H)
+ langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h
java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H)
java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
diff --git a/gcc/java/boehm.c b/gcc/java/boehm.c
index 04af74b5948..35ba68d0fb3 100644
--- a/gcc/java/boehm.c
+++ b/gcc/java/boehm.c
@@ -27,17 +27,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "system.h"
#include "coretypes.h"
+#include "double-int.h"
#include "tm.h"
#include "tree.h"
#include "java-tree.h"
#include "parse.h"
#include "toplev.h"
-static void mark_reference_fields (tree, unsigned HOST_WIDE_INT *,
- unsigned HOST_WIDE_INT *, unsigned int,
+static void mark_reference_fields (tree, double_int *, unsigned int,
int *, int *, int *, HOST_WIDE_INT *);
-static void set_bit (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
- unsigned int);
/* A procedure-based object descriptor. We know that our
`kind' is 0, and `env' is likewise 0, so we have a simple
@@ -47,30 +45,10 @@ static void set_bit (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
Here DS_PROC == 2. */
#define PROCEDURE_OBJECT_DESCRIPTOR 2
-/* Treat two HOST_WIDE_INT's as a contiguous bitmap, with bit 0 being
- the least significant. This function sets bit N in the bitmap. */
-static void
-set_bit (unsigned HOST_WIDE_INT *low, unsigned HOST_WIDE_INT *high,
- unsigned int n)
-{
- unsigned HOST_WIDE_INT *which;
-
- if (n >= HOST_BITS_PER_WIDE_INT)
- {
- n -= HOST_BITS_PER_WIDE_INT;
- which = high;
- }
- else
- which = low;
-
- *which |= (unsigned HOST_WIDE_INT) 1 << n;
-}
-
/* Recursively mark reference fields. */
static void
mark_reference_fields (tree field,
- unsigned HOST_WIDE_INT *low,
- unsigned HOST_WIDE_INT *high,
+ double_int *mask,
unsigned int ubit,
int *pointer_after_end,
int *all_bits_set,
@@ -81,7 +59,7 @@ mark_reference_fields (tree field,
if (DECL_NAME (field) == NULL_TREE)
{
mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)),
- low, high, ubit,
+ mask, ubit,
pointer_after_end, all_bits_set,
last_set_index, last_view_index);
field = TREE_CHAIN (field);
@@ -130,7 +108,7 @@ mark_reference_fields (tree field,
bits for all words in the record. This is conservative, but the
size_words != 1 case is impossible in regular java code. */
for (i = 0; i < size_words; ++i)
- set_bit (low, high, ubit - count - i - 1);
+ *mask = double_int_setbit (*mask, ubit - count - i - 1);
if (count >= ubit - 2)
*pointer_after_end = 1;
@@ -159,9 +137,11 @@ get_boehm_type_descriptor (tree type)
int last_set_index = 0;
HOST_WIDE_INT last_view_index = -1;
int pointer_after_end = 0;
- unsigned HOST_WIDE_INT low = 0, high = 0;
+ double_int mask;
tree field, value, value_type;
+ mask = double_int_zero;
+
/* If the GC wasn't requested, just use a null pointer. */
if (! flag_use_boehm_gc)
return null_pointer_node;
@@ -192,7 +172,7 @@ get_boehm_type_descriptor (tree type)
goto procedure_object_descriptor;
field = TYPE_FIELDS (type);
- mark_reference_fields (field, &low, &high, ubit,
+ mark_reference_fields (field, &mask, ubit,
&pointer_after_end, &all_bits_set,
&last_set_index, &last_view_index);
@@ -215,23 +195,22 @@ get_boehm_type_descriptor (tree type)
that we don't have to emit reflection data for run time
marking. */
count = 0;
- low = 0;
- high = 0;
+ mask = double_int_zero;
++last_set_index;
while (last_set_index)
{
if ((last_set_index & 1))
- set_bit (&low, &high, log2_size + count);
+ mask = double_int_setbit (mask, log2_size + count);
last_set_index >>= 1;
++count;
}
- value = build_int_cst_wide (value_type, low, high);
+ value = double_int_to_tree (value_type, mask);
}
else if (! pointer_after_end)
{
/* Bottom two bits for bitmap mark type are 01. */
- set_bit (&low, &high, 0);
- value = build_int_cst_wide (value_type, low, high);
+ mask = double_int_setbit (mask, 0);
+ value = double_int_to_tree (value_type, mask);
}
else
{
diff --git a/gcc/java/class.c b/gcc/java/class.c
index f346ad420f7..7d90a032a81 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -382,6 +382,12 @@ make_class (void)
loading works. */
TYPE_BINFO (type) = make_tree_binfo (0);
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
+ TYPE_CATCH_CLASSES (type) = NULL;
+ /* Push a dummy entry; we can't call make_catch_class_record here
+ because other infrastructure may not be set up yet. We'll come
+ back and fill it in later once said infrastructure is
+ initialized. */
+ CONSTRUCTOR_APPEND_ELT (TYPE_CATCH_CLASSES (type), NULL_TREE, NULL_TREE);
return type;
}
@@ -763,13 +769,12 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type)
DECL_CONTEXT (fndecl) = this_class;
DECL_LANG_SPECIFIC (fndecl)
- = GGC_CNEW (struct lang_decl);
+ = ggc_alloc_cleared_lang_decl(sizeof (struct lang_decl));
DECL_LANG_SPECIFIC (fndecl)->desc = LANG_DECL_FUNC;
/* Initialize the static initializer test table. */
-
- DECL_FUNCTION_INIT_TEST_TABLE (fndecl) =
- java_treetreehash_create (10, 1);
+
+ DECL_FUNCTION_INIT_TEST_TABLE (fndecl) = java_treetreehash_create (10);
/* Initialize the initialized (static) class table. */
if (access_flags & ACC_STATIC)
@@ -2961,18 +2966,17 @@ tree
emit_catch_table (tree this_class)
{
tree table, table_size, array_type;
- TYPE_CATCH_CLASSES (this_class) =
- tree_cons (NULL,
- make_catch_class_record (null_pointer_node, null_pointer_node),
- TYPE_CATCH_CLASSES (this_class));
- TYPE_CATCH_CLASSES (this_class) = nreverse (TYPE_CATCH_CLASSES (this_class));
- TYPE_CATCH_CLASSES (this_class) =
- tree_cons (NULL,
- make_catch_class_record (null_pointer_node, null_pointer_node),
- TYPE_CATCH_CLASSES (this_class));
- table_size = build_index_type
- (build_int_cst (NULL_TREE,
- list_length (TYPE_CATCH_CLASSES (this_class))));
+ int n_catch_classes;
+ constructor_elt *e;
+ /* Fill in the dummy entry that make_class created. */
+ e = VEC_index (constructor_elt, TYPE_CATCH_CLASSES (this_class), 0);
+ e->value = make_catch_class_record (null_pointer_node, null_pointer_node);
+ CONSTRUCTOR_APPEND_ELT (TYPE_CATCH_CLASSES (this_class), NULL_TREE,
+ make_catch_class_record (null_pointer_node,
+ null_pointer_node));
+ n_catch_classes = VEC_length (constructor_elt,
+ TYPE_CATCH_CLASSES (this_class));
+ table_size = build_index_type (build_int_cst (NULL_TREE, n_catch_classes));
array_type
= build_array_type (TREE_TYPE (TREE_TYPE (TYPE_CTABLE_DECL (this_class))),
table_size);
@@ -2980,7 +2984,7 @@ emit_catch_table (tree this_class)
build_decl (input_location,
VAR_DECL, DECL_NAME (TYPE_CTABLE_DECL (this_class)), array_type);
DECL_INITIAL (table) =
- build_constructor_from_list (array_type, TYPE_CATCH_CLASSES (this_class));
+ build_constructor (array_type, TYPE_CATCH_CLASSES (this_class));
TREE_STATIC (table) = 1;
TREE_READONLY (table) = 1;
DECL_IGNORED_P (table) = 1;
@@ -3144,7 +3148,7 @@ java_treetreehash_new (htab_t ht, tree t)
e = htab_find_slot_with_hash (ht, t, hv, INSERT);
if (*e == NULL)
{
- tthe = (struct treetreehash_entry *) (*ht->alloc_f) (1, sizeof (*tthe));
+ tthe = ggc_alloc_cleared_treetreehash_entry ();
tthe->key = t;
*e = tthe;
}
@@ -3154,14 +3158,10 @@ java_treetreehash_new (htab_t ht, tree t)
}
htab_t
-java_treetreehash_create (size_t size, int gc)
+java_treetreehash_create (size_t size)
{
- if (gc)
- return htab_create_ggc (size, java_treetreehash_hash,
- java_treetreehash_compare, NULL);
- else
- return htab_create_alloc (size, java_treetreehash_hash,
- java_treetreehash_compare, free, xcalloc, free);
+ return htab_create_ggc (size, java_treetreehash_hash,
+ java_treetreehash_compare, NULL);
}
/* Break down qualified IDENTIFIER into package and class-name components.
diff --git a/gcc/java/constants.c b/gcc/java/constants.c
index ca5eb77ce30..f018a707911 100644
--- a/gcc/java/constants.c
+++ b/gcc/java/constants.c
@@ -44,8 +44,11 @@ set_constant_entry (CPool *cpool, int index, int tag, jword value)
if (cpool->data == NULL)
{
cpool->capacity = 100;
- cpool->tags = GGC_CNEWVEC (uint8, cpool->capacity);
- cpool->data = GGC_CNEWVEC (union cpool_entry, cpool->capacity);
+ cpool->tags = (uint8 *) ggc_alloc_cleared_atomic (sizeof (uint8)
+ * cpool->capacity);
+ cpool->data = ggc_alloc_cleared_vec_cpool_entry (sizeof
+ (union cpool_entry),
+ cpool->capacity);
cpool->count = 1;
}
if (index >= cpool->capacity)
@@ -333,7 +336,7 @@ cpool_for_class (tree klass)
if (cpool == NULL)
{
- cpool = GGC_CNEW (struct CPool);
+ cpool = ggc_alloc_cleared_CPool ();
TYPE_CPOOL (klass) = cpool;
}
return cpool;
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index f78d68359eb..d3e671067a6 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -619,15 +619,9 @@ java_init_decl_processing (void)
/* A few values used for range checking in the lexer. */
decimal_int_max = build_int_cstu (unsigned_int_type_node, 0x80000000);
-#if HOST_BITS_PER_WIDE_INT == 64
- decimal_long_max = build_int_cstu (unsigned_long_type_node,
- 0x8000000000000000LL);
-#elif HOST_BITS_PER_WIDE_INT == 32
- decimal_long_max = build_int_cst_wide (unsigned_long_type_node,
- 0, 0x80000000);
-#else
- #error "unsupported size"
-#endif
+ decimal_long_max
+ = double_int_to_tree (unsigned_long_type_node,
+ double_int_setbit (double_int_zero, 64));
size_zero_node = size_int (0);
size_one_node = size_int (1);
@@ -1354,7 +1348,7 @@ static struct binding_level *
make_binding_level (void)
{
/* NOSTRICT */
- return GGC_CNEW (struct binding_level);
+ return ggc_alloc_cleared_binding_level ();
}
void
@@ -1696,7 +1690,7 @@ java_dup_lang_specific_decl (tree node)
return;
lang_decl_size = sizeof (struct lang_decl);
- x = GGC_NEW (struct lang_decl);
+ x = ggc_alloc_lang_decl (lang_decl_size);
memcpy (x, DECL_LANG_SPECIFIC (node), lang_decl_size);
DECL_LANG_SPECIFIC (node) = x;
}
diff --git a/gcc/java/except.c b/gcc/java/except.c
index 03bf4e6853b..0033da30653 100644
--- a/gcc/java/except.c
+++ b/gcc/java/except.c
@@ -31,7 +31,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "javaop.h"
#include "java-opcodes.h"
#include "jcf.h"
-#include "except.h" /* for doing_eh. */
#include "java-except.h"
#include "toplev.h"
#include "tree-iterator.h"
@@ -381,7 +380,7 @@ prepare_eh_table_type (tree type)
return NULL_TREE;
if (TYPE_TO_RUNTIME_MAP (output_class) == NULL)
- TYPE_TO_RUNTIME_MAP (output_class) = java_treetreehash_create (10, 1);
+ TYPE_TO_RUNTIME_MAP (output_class) = java_treetreehash_create (10);
slot = java_treetreehash_new (TYPE_TO_RUNTIME_MAP (output_class), type);
if (*slot != NULL)
@@ -420,9 +419,9 @@ prepare_eh_table_type (tree type)
layout_decl (decl, 0);
pushdecl (decl);
exp = build1 (ADDR_EXPR, build_pointer_type (utf8const_ptr_type), decl);
- TYPE_CATCH_CLASSES (output_class) =
- tree_cons (NULL, make_catch_class_record (exp, utf8_ref),
- TYPE_CATCH_CLASSES (output_class));
+ CONSTRUCTOR_APPEND_ELT (TYPE_CATCH_CLASSES (output_class),
+ NULL_TREE,
+ make_catch_class_record (exp, utf8_ref));
}
exp = convert (ptr_type_node, exp);
@@ -565,6 +564,29 @@ check_start_handlers (struct eh_range *range, int pc)
}
+/* Routine to see if exception handling is turned on.
+ DO_WARN is nonzero if we want to inform the user that exception
+ handling is turned off.
+
+ This is used to ensure that -fexceptions has been specified if the
+ compiler tries to use any exception-specific functions. */
+
+static inline int
+doing_eh (void)
+{
+ if (! flag_exceptions)
+ {
+ static int warned = 0;
+ if (! warned)
+ {
+ error ("exception handling disabled, use -fexceptions to enable");
+ warned = 1;
+ }
+ return 0;
+ }
+ return 1;
+}
+
static struct eh_range *current_range;
/* Emit any start-of-try-range starting at start_pc and ending after
@@ -574,7 +596,7 @@ void
maybe_start_try (int start_pc, int end_pc)
{
struct eh_range *range;
- if (! doing_eh (1))
+ if (! doing_eh ())
return;
range = find_handler (start_pc);
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 0abcb0d1de7..042ed1b7297 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -463,7 +463,7 @@ add_type_assertion (tree klass, int assertion_code, tree op1, tree op2)
if (*as_pp)
return;
- *as_pp = ggc_alloc (sizeof (type_assertion));
+ *as_pp = ggc_alloc_type_assertion ();
**(type_assertion **)as_pp = as;
}
diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi
index 46b0899e800..01acf4344cb 100644
--- a/gcc/java/gcj.texi
+++ b/gcc/java/gcj.texi
@@ -17,14 +17,14 @@
@c the word ``Java'.
@c When this manual is copyrighted.
-@set copyrights-gcj 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+@set copyrights-gcj 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
@copying
@c man begin COPYRIGHT
Copyright @copyright{} @value{copyrights-gcj} Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, the Front-Cover Texts being (a) (see below), and
with the Back-Cover Texts being (b) (see below).
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index f48e4215925..ccaa0e34eb7 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -750,11 +750,12 @@ union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
(DECL_LANG_SPECIFIC (NODE)->u.v.vtable)
/* Create a DECL_LANG_SPECIFIC if necessary. */
-#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \
- if (DECL_LANG_SPECIFIC (T) == NULL) \
- { \
- DECL_LANG_SPECIFIC ((T)) = GGC_CNEW (struct lang_decl); \
- DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \
+#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \
+ if (DECL_LANG_SPECIFIC (T) == NULL) \
+ { \
+ DECL_LANG_SPECIFIC ((T)) \
+ = ggc_alloc_cleared_lang_decl (sizeof (struct lang_decl)); \
+ DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \
}
/* A ConstantExpression, after folding and name resolution. */
@@ -840,7 +841,7 @@ typedef struct GTY(()) type_assertion {
extern tree java_treetreehash_find (htab_t, tree);
extern tree * java_treetreehash_new (htab_t, tree);
-extern htab_t java_treetreehash_create (size_t size, int ggc);
+extern htab_t java_treetreehash_create (size_t size);
/* DECL_LANG_SPECIFIC for VAR_DECL, PARM_DECL and sometimes FIELD_DECL
(access methods on outer class fields) and final fields. */
@@ -861,7 +862,7 @@ struct GTY(()) lang_decl_var {
enum lang_decl_desc {LANG_DECL_FUNC, LANG_DECL_VAR};
-struct GTY(()) lang_decl {
+struct GTY((variable_size)) lang_decl {
enum lang_decl_desc desc;
union lang_decl_u
{
@@ -879,7 +880,7 @@ struct GTY(()) lang_decl {
#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \
if (TYPE_LANG_SPECIFIC ((T)) == NULL) \
TYPE_LANG_SPECIFIC ((T)) \
- = GGC_CNEW (struct lang_type);
+ = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
#define TYPE_DUMMY(T) (TYPE_LANG_SPECIFIC(T)->dummy_class)
@@ -924,7 +925,10 @@ typedef struct GTY(()) method_entry_d {
DEF_VEC_O(method_entry);
DEF_VEC_ALLOC_O(method_entry,gc);
-struct GTY(()) lang_type {
+/* FIXME: the variable_size annotation here is needed because these types are
+ variable-sized in some other frontends. Due to gengtype deficiency the GTY
+ options of such types have to agree across all frontends. */
+struct GTY((variable_size)) lang_type {
tree signature;
struct JCF *jcf;
struct CPool *cpool;
@@ -948,7 +952,7 @@ struct GTY(()) lang_type {
tree ctable_decl; /* The table of classes for the runtime
type matcher. */
- tree catch_classes;
+ VEC(constructor_elt,gc) *catch_classes;
htab_t GTY ((param_is (struct treetreehash_entry))) type_to_runtime_map;
/* The mapping of classes to exception region
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index eef75aa2516..37d27b41b43 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1906,8 +1906,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
if (magic == 0xcafebabe)
{
CLASS_FILE_P (node) = 1;
- current_jcf = GGC_NEW (JCF);
- JCF_ZERO (current_jcf);
+ current_jcf = ggc_alloc_cleared_JCF ();
current_jcf->read_state = finput;
current_jcf->filbuf = jcf_filbuf_from_stdio;
jcf_parse (current_jcf);
@@ -1924,8 +1923,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
}
else if (magic == (JCF_u4)ZIPMAGIC)
{
- main_jcf = GGC_NEW (JCF);
- JCF_ZERO (main_jcf);
+ main_jcf = ggc_alloc_cleared_JCF ();
main_jcf->read_state = finput;
main_jcf->filbuf = jcf_filbuf_from_stdio;
linemap_add (line_table, LC_ENTER, false, filename, 0);
@@ -2181,8 +2179,7 @@ process_zip_dir (FILE *finput)
class_name = compute_class_name (zdir);
file_name = XNEWVEC (char, zdir->filename_length+1);
- jcf = GGC_NEW (JCF);
- JCF_ZERO (jcf);
+ jcf = ggc_alloc_cleared_JCF ();
strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
file_name [zdir->filename_length] = '\0';
diff --git a/gcc/java/jcf-reader.c b/gcc/java/jcf-reader.c
index 8970104708b..069b29bf277 100644
--- a/gcc/java/jcf-reader.c
+++ b/gcc/java/jcf-reader.c
@@ -331,8 +331,8 @@ jcf_parse_constant_pool (JCF* jcf)
{
int i, n;
JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
- jcf->cpool.tags = GGC_NEWVAR (uint8, JPOOL_SIZE (jcf));
- jcf->cpool.data = GGC_NEWVAR (union cpool_entry, sizeof (jword) * JPOOL_SIZE (jcf));
+ jcf->cpool.tags = (uint8 *) ggc_alloc_atomic (JPOOL_SIZE (jcf));
+ jcf->cpool.data = ggc_alloc_cpool_entry (sizeof (jword) * JPOOL_SIZE (jcf));
jcf->cpool.tags[0] = 0;
#ifdef HANDLE_START_CONSTANT_POOL
HANDLE_START_CONSTANT_POOL (JPOOL_SIZE (jcf));
diff --git a/gcc/java/jcf.h b/gcc/java/jcf.h
index 7e8d18d9b3f..c7a789d6f2b 100644
--- a/gcc/java/jcf.h
+++ b/gcc/java/jcf.h
@@ -66,7 +66,7 @@ jcf_open_exact_case (const char* filename, int oflag);
struct JCF;
typedef int (*jcf_filbuf_t) (struct JCF*, int needed);
-union GTY(()) cpool_entry {
+union GTY((variable_size)) cpool_entry {
jword GTY ((tag ("0"))) w;
tree GTY ((tag ("1"))) t;
};
diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c
index e197e2854b0..1987138a687 100644
--- a/gcc/java/jvspec.c
+++ b/gcc/java/jvspec.c
@@ -400,13 +400,13 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
}
if (quote)
- fatal_error ("argument to '%s' missing\n", quote);
+ fatal_error ("argument to %qs missing", quote);
if (saw_D && ! main_class_name)
- fatal_error ("can't specify '-D' without '--main'\n");
+ fatal_error ("can't specify %<-D%> without %<--main%>");
if (main_class_name && ! verify_class_name (main_class_name))
- fatal_error ("'%s' is not a valid class name", main_class_name);
+ fatal_error ("%qs is not a valid class name", main_class_name);
num_args = argc + added;
if (saw_resource)
@@ -582,7 +582,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
if (strncmp (argv[i], "-fmain=", 7) == 0)
{
if (! will_link)
- fatal_error ("cannot specify 'main' class when not linking");
+ fatal_error ("cannot specify %<main%> class when not linking");
--j;
continue;
}
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 351952de1a6..6c31947c6a4 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -43,7 +43,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "tree-dump.h"
#include "opts.h"
#include "options.h"
-#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
static bool java_init (void);
static void java_finish (void);
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 2b287a184d7..4a291935fbf 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1703,7 +1703,7 @@ remove_iv (gimple iv_stmt)
TRANSFORM is the matrix transform that was applied to OLD_LOOPNEST to get
NEW_LOOPNEST. */
-void
+void
lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
VEC(tree,heap) *old_ivs,
VEC(tree,heap) *invariants,
@@ -2131,7 +2131,7 @@ replace_uses_equiv_to_x_with_y (struct loop *loop, gimple stmt, tree x,
gsi_insert_before (firstbsi, setstmt, GSI_SAME_STMT);
update_stmt (setstmt);
SET_USE (use_p, var);
- h = GGC_NEW (struct tree_map);
+ h = ggc_alloc_tree_map ();
h->hash = in.hash;
h->base.from = use;
h->to = var;
diff --git a/gcc/lambda.h b/gcc/lambda.h
index c819027f582..8ef11b9dc6c 100644
--- a/gcc/lambda.h
+++ b/gcc/lambda.h
@@ -238,7 +238,7 @@ static inline void print_lambda_vector (FILE *, lambda_vector, int);
static inline lambda_vector
lambda_vector_new (int size)
{
- return GGC_CNEWVEC (int, size);
+ return (lambda_vector) ggc_alloc_cleared_atomic (sizeof (int) * size);
}
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 68b5b72bfc6..68085c72c9e 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -110,6 +110,7 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_INIT_TS lhd_do_nothing
#define LANG_HOOKS_EH_PERSONALITY lhd_gcc_personality
#define LANG_HOOKS_EH_RUNTIME_TYPE lhd_pass_through_t
+#define LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS NULL
#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false
#define LANG_HOOKS_DEEP_UNSHARING false
@@ -202,6 +203,7 @@ extern tree lhd_make_node (enum tree_code);
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_const_tree_false
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING lhd_omp_predetermined_sharing
+#define LANG_HOOKS_OMP_REPORT_DECL lhd_pass_through_t
#define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR hook_bool_tree_bool_false
#define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE hook_bool_tree_bool_false
#define LANG_HOOKS_OMP_PRIVATE_OUTER_REF hook_bool_tree_false
@@ -224,6 +226,7 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, \
LANG_HOOKS_OMP_PREDETERMINED_SHARING, \
+ LANG_HOOKS_OMP_REPORT_DECL, \
LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR, \
LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE, \
LANG_HOOKS_OMP_PRIVATE_OUTER_REF, \
@@ -297,6 +300,7 @@ extern void lhd_end_section (void);
LANG_HOOKS_EXPR_TO_DECL, \
LANG_HOOKS_EH_PERSONALITY, \
LANG_HOOKS_EH_RUNTIME_TYPE, \
+ LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS, \
LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \
LANG_HOOKS_DEEP_UNSHARING \
}
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index c0744e87898..483a8dcdd77 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -195,6 +195,10 @@ struct lang_hooks_for_decls
predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise. */
enum omp_clause_default_kind (*omp_predetermined_sharing) (tree);
+ /* Return decl that should be reported for DEFAULT(NONE) failure
+ diagnostics. Usually the DECL passed in. */
+ tree (*omp_report_decl) (tree);
+
/* Return true if DECL's DECL_VALUE_EXPR (if any) should be
disregarded in OpenMP construct, because it is going to be
remapped during OpenMP lowering. SHARED is true if DECL
@@ -442,6 +446,14 @@ struct lang_hooks
/* Map a type to a runtime object to match type. */
tree (*eh_runtime_type) (tree);
+ /* If non-NULL, this is a function that returns a function decl to be
+ executed if an unhandled exception is propagated out of a cleanup
+ region. For example, in C++, an exception thrown by a destructor
+ during stack unwinding is required to result in a call to
+ `std::terminate', so the C++ version of this function returns a
+ FUNCTION_DECL for `std::terminate'. */
+ tree (*eh_protect_cleanup_actions) (void);
+
/* True if this language uses __cxa_end_cleanup when the ARM EABI
is enabled. */
bool eh_use_cxa_end_cleanup;
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 854bb970879..2a2fbc35912 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -45,7 +45,7 @@ loop_optimizer_init (unsigned flags)
struct loops *loops;
gcc_assert (!current_loops);
- loops = GGC_CNEW (struct loops);
+ loops = ggc_alloc_cleared_loops ();
/* Find the loops. */
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 16e9a52697d..141b51fc322 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -304,7 +304,7 @@ latch_dominating_def (rtx reg, df_ref *def)
for (adef = DF_REG_DEF_CHAIN (regno); adef; adef = DF_REF_NEXT_REG (adef))
{
if (!bitmap_bit_p (df->blocks_to_analyze, DF_REF_BBNO (adef))
- || !bitmap_bit_p (bb_info->out, DF_REF_ID (adef)))
+ || !bitmap_bit_p (&bb_info->out, DF_REF_ID (adef)))
continue;
/* More than one reaching definition. */
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index edf62fa8aa8..77524d8bfe3 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -110,6 +110,7 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
gcc_assert (rtx_equal_p (op1, XEXP (cond, 1)));
emit_jump_insn (copy_insn (PATTERN (cinsn)));
jump = get_last_insn ();
+ gcc_assert (JUMP_P (jump));
JUMP_LABEL (jump) = JUMP_LABEL (cinsn);
LABEL_NUSES (JUMP_LABEL (jump))++;
redirect_jump (jump, label, 0);
@@ -123,6 +124,7 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
do_compare_rtx_and_jump (op0, op1, comp, 0,
mode, NULL_RTX, NULL_RTX, label, -1);
jump = get_last_insn ();
+ gcc_assert (JUMP_P (jump));
JUMP_LABEL (jump) = label;
LABEL_NUSES (label)++;
}
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 67a847e63dc..9722a807842 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -234,14 +234,6 @@ lto_varpool_encoder_deref (lto_varpool_encoder_t encoder, int ref)
}
-/* Return number of encoded nodes in ENCODER. */
-
-static int
-lto_varpool_encoder_size (lto_varpool_encoder_t encoder)
-{
- return VEC_length (varpool_node_ptr, encoder->nodes);
-}
-
/* Return TRUE if we should encode initializer of NODE (if any). */
bool
@@ -268,7 +260,7 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
{
unsigned int uid;
intptr_t ref;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
if (edge->indirect_unknown_callee)
lto_output_uleb128_stream (ob->main_stream, LTO_cgraph_indirect_edge);
@@ -288,32 +280,31 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
lto_output_sleb128_stream (ob->main_stream, edge->count);
- bp = bitpack_create ();
+ bp = bitpack_create (ob->main_stream);
uid = flag_wpa ? edge->lto_stmt_uid : gimple_uid (edge->call_stmt);
- bp_pack_value (bp, uid, HOST_BITS_PER_INT);
- bp_pack_value (bp, edge->inline_failed, HOST_BITS_PER_INT);
- bp_pack_value (bp, edge->frequency, HOST_BITS_PER_INT);
- bp_pack_value (bp, edge->loop_nest, 30);
- bp_pack_value (bp, edge->indirect_inlining_edge, 1);
- bp_pack_value (bp, edge->call_stmt_cannot_inline_p, 1);
- bp_pack_value (bp, edge->can_throw_external, 1);
+ bp_pack_value (&bp, uid, HOST_BITS_PER_INT);
+ bp_pack_value (&bp, edge->inline_failed, HOST_BITS_PER_INT);
+ bp_pack_value (&bp, edge->frequency, HOST_BITS_PER_INT);
+ bp_pack_value (&bp, edge->loop_nest, 30);
+ bp_pack_value (&bp, edge->indirect_inlining_edge, 1);
+ bp_pack_value (&bp, edge->call_stmt_cannot_inline_p, 1);
+ bp_pack_value (&bp, edge->can_throw_external, 1);
if (edge->indirect_unknown_callee)
{
int flags = edge->indirect_info->ecf_flags;
- bp_pack_value (bp, (flags & ECF_CONST) != 0, 1);
- bp_pack_value (bp, (flags & ECF_PURE) != 0, 1);
- bp_pack_value (bp, (flags & ECF_NORETURN) != 0, 1);
- bp_pack_value (bp, (flags & ECF_MALLOC) != 0, 1);
- bp_pack_value (bp, (flags & ECF_NOTHROW) != 0, 1);
- bp_pack_value (bp, (flags & ECF_RETURNS_TWICE) != 0, 1);
+ bp_pack_value (&bp, (flags & ECF_CONST) != 0, 1);
+ bp_pack_value (&bp, (flags & ECF_PURE) != 0, 1);
+ bp_pack_value (&bp, (flags & ECF_NORETURN) != 0, 1);
+ bp_pack_value (&bp, (flags & ECF_MALLOC) != 0, 1);
+ bp_pack_value (&bp, (flags & ECF_NOTHROW) != 0, 1);
+ bp_pack_value (&bp, (flags & ECF_RETURNS_TWICE) != 0, 1);
/* Flags that should not appear on indirect calls. */
gcc_assert (!(flags & (ECF_LOOPING_CONST_OR_PURE
| ECF_MAY_BE_ALLOCA
| ECF_SIBCALL
| ECF_NOVOPS)));
}
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ lto_output_bitpack (&bp);
}
/* Return if LIST contain references from other partitions. */
@@ -412,7 +403,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
varpool_node_set vset)
{
unsigned int tag;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
bool boundary_p;
intptr_t ref;
bool in_other_partition = false;
@@ -466,30 +457,6 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
lto_output_fn_decl_index (ob->decl_state, ob->main_stream, node->decl);
lto_output_sleb128_stream (ob->main_stream, node->count);
- bp = bitpack_create ();
- bp_pack_value (bp, node->local.local, 1);
- bp_pack_value (bp, node->local.externally_visible, 1);
- bp_pack_value (bp, node->local.finalized, 1);
- bp_pack_value (bp, node->local.inlinable, 1);
- bp_pack_value (bp, node->local.versionable, 1);
- bp_pack_value (bp, node->local.disregard_inline_limits, 1);
- bp_pack_value (bp, node->local.redefined_extern_inline, 1);
- bp_pack_value (bp, node->local.vtable_method, 1);
- bp_pack_value (bp, node->needed, 1);
- bp_pack_value (bp, node->address_taken, 1);
- bp_pack_value (bp, node->abstract_and_needed, 1);
- bp_pack_value (bp, tag == LTO_cgraph_analyzed_node
- && !DECL_EXTERNAL (node->decl)
- && (reachable_from_other_partition_p (node, set)
- || referenced_from_other_partition_p (&node->ref_list, set, vset)), 1);
- bp_pack_value (bp, node->lowered, 1);
- bp_pack_value (bp, in_other_partition, 1);
- bp_pack_value (bp, node->alias, 1);
- bp_pack_value (bp, node->finalized_by_frontend, 1);
- bp_pack_value (bp, node->frequency, 2);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
-
if (tag == LTO_cgraph_analyzed_node)
{
lto_output_sleb128_stream (ob->main_stream,
@@ -522,6 +489,29 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
ref = LCC_NOT_FOUND;
lto_output_sleb128_stream (ob->main_stream, ref);
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, node->local.local, 1);
+ bp_pack_value (&bp, node->local.externally_visible, 1);
+ bp_pack_value (&bp, node->local.finalized, 1);
+ bp_pack_value (&bp, node->local.inlinable, 1);
+ bp_pack_value (&bp, node->local.versionable, 1);
+ bp_pack_value (&bp, node->local.disregard_inline_limits, 1);
+ bp_pack_value (&bp, node->local.redefined_extern_inline, 1);
+ bp_pack_value (&bp, node->local.vtable_method, 1);
+ bp_pack_value (&bp, node->needed, 1);
+ bp_pack_value (&bp, node->address_taken, 1);
+ bp_pack_value (&bp, node->abstract_and_needed, 1);
+ bp_pack_value (&bp, tag == LTO_cgraph_analyzed_node
+ && !DECL_EXTERNAL (node->decl)
+ && (reachable_from_other_partition_p (node, set)
+ || referenced_from_other_partition_p (&node->ref_list, set, vset)), 1);
+ bp_pack_value (&bp, node->lowered, 1);
+ bp_pack_value (&bp, in_other_partition, 1);
+ bp_pack_value (&bp, node->alias, 1);
+ bp_pack_value (&bp, node->finalized_by_frontend, 1);
+ bp_pack_value (&bp, node->frequency, 2);
+ lto_output_bitpack (&bp);
+
if (node->same_body)
{
struct cgraph_node *alias;
@@ -569,17 +559,17 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
cgraph_node_set set, varpool_node_set vset)
{
bool boundary_p = !varpool_node_in_set_p (node, vset) && node->analyzed;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
struct varpool_node *alias;
int count = 0;
int ref;
lto_output_var_decl_index (ob->decl_state, ob->main_stream, node->decl);
- bp = bitpack_create ();
- bp_pack_value (bp, node->externally_visible, 1);
- bp_pack_value (bp, node->force_output, 1);
- bp_pack_value (bp, node->finalized, 1);
- bp_pack_value (bp, node->alias, 1);
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, node->externally_visible, 1);
+ bp_pack_value (&bp, node->force_output, 1);
+ bp_pack_value (&bp, node->finalized, 1);
+ bp_pack_value (&bp, node->alias, 1);
gcc_assert (!node->alias || !node->extra_name);
gcc_assert (node->finalized || !node->analyzed);
gcc_assert (node->needed);
@@ -588,22 +578,21 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
labels and share them across LTRANS partitions. */
if (DECL_IN_CONSTANT_POOL (node->decl))
{
- bp_pack_value (bp, 0, 1); /* used_from_other_parition. */
- bp_pack_value (bp, 0, 1); /* in_other_partition. */
+ bp_pack_value (&bp, 0, 1); /* used_from_other_parition. */
+ bp_pack_value (&bp, 0, 1); /* in_other_partition. */
}
else
{
- bp_pack_value (bp, node->analyzed
+ bp_pack_value (&bp, node->analyzed
&& referenced_from_other_partition_p (&node->ref_list,
set, vset), 1);
- bp_pack_value (bp, boundary_p, 1); /* in_other_partition. */
+ bp_pack_value (&bp, boundary_p, 1); /* in_other_partition. */
}
/* Also emit any extra name aliases. */
for (alias = node->extra_name; alias; alias = alias->next)
count++;
- bp_pack_value (bp, count != 0, 1);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp_pack_value (&bp, count != 0, 1);
+ lto_output_bitpack (&bp);
if (node->same_comdat_group && !boundary_p)
{
ref = lto_varpool_encoder_lookup (varpool_encoder, node->same_comdat_group);
@@ -629,11 +618,11 @@ lto_output_ref (struct lto_simple_output_block *ob, struct ipa_ref *ref,
lto_cgraph_encoder_t encoder,
lto_varpool_encoder_t varpool_encoder)
{
- struct bitpack_d *bp = bitpack_create ();
- bp_pack_value (bp, ref->refered_type, 1);
- bp_pack_value (bp, ref->use, 2);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ struct bitpack_d bp;
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, ref->refered_type, 1);
+ bp_pack_value (&bp, ref->use, 2);
+ lto_output_bitpack (&bp);
if (ref->refered_type == IPA_REF_CGRAPH)
{
int nref = lto_cgraph_encoder_lookup (encoder, ipa_ref_node (ref));
@@ -989,7 +978,7 @@ input_node (struct lto_file_decl_data *file_data,
{
tree fn_decl;
struct cgraph_node *node;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
int stack_size = 0;
unsigned decl_index;
int ref = LCC_NOT_FOUND, ref2 = LCC_NOT_FOUND;
@@ -1014,7 +1003,6 @@ input_node (struct lto_file_decl_data *file_data,
node = cgraph_node (fn_decl);
node->count = lto_input_sleb128 (ib);
- bp = lto_input_bitpack (ib);
if (tag == LTO_cgraph_analyzed_node)
{
@@ -1028,7 +1016,6 @@ input_node (struct lto_file_decl_data *file_data,
}
ref2 = lto_input_sleb128 (ib);
- same_body_count = lto_input_uleb128 (ib);
/* Make sure that we have not read this node before. Nodes that
have already been read will have their tag stored in the 'aux'
@@ -1038,10 +1025,10 @@ input_node (struct lto_file_decl_data *file_data,
internal_error ("bytecode stream: found multiple instances of cgraph "
"node %d", node->uid);
- input_overwrite_node (file_data, node, tag, bp, stack_size, self_time,
+ bp = lto_input_bitpack (ib);
+ input_overwrite_node (file_data, node, tag, &bp, stack_size, self_time,
time_inlining_benefit, self_size,
size_inlining_benefit);
- bitpack_delete (bp);
/* Store a reference for now, and fix up later to be a pointer. */
node->global.inlined_to = (cgraph_node_ptr) (intptr_t) ref;
@@ -1049,6 +1036,7 @@ input_node (struct lto_file_decl_data *file_data,
/* Store a reference for now, and fix up later to be a pointer. */
node->same_comdat_group = (cgraph_node_ptr) (intptr_t) ref2;
+ same_body_count = lto_input_uleb128 (ib);
while (same_body_count-- > 0)
{
tree alias_decl;
@@ -1089,7 +1077,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
int decl_index;
tree var_decl;
struct varpool_node *node;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
bool aliases_p;
int count;
int ref = LCC_NOT_FOUND;
@@ -1097,19 +1085,19 @@ input_varpool_node (struct lto_file_decl_data *file_data,
decl_index = lto_input_uleb128 (ib);
var_decl = lto_file_decl_data_get_var_decl (file_data, decl_index);
node = varpool_node (var_decl);
+ node->lto_file_data = file_data;
bp = lto_input_bitpack (ib);
- node->externally_visible = bp_unpack_value (bp, 1);
- node->force_output = bp_unpack_value (bp, 1);
- node->finalized = bp_unpack_value (bp, 1);
- node->alias = bp_unpack_value (bp, 1);
+ node->externally_visible = bp_unpack_value (&bp, 1);
+ node->force_output = bp_unpack_value (&bp, 1);
+ node->finalized = bp_unpack_value (&bp, 1);
+ node->alias = bp_unpack_value (&bp, 1);
node->analyzed = node->finalized;
- node->used_from_other_partition = bp_unpack_value (bp, 1);
- node->in_other_partition = bp_unpack_value (bp, 1);
- aliases_p = bp_unpack_value (bp, 1);
+ node->used_from_other_partition = bp_unpack_value (&bp, 1);
+ node->in_other_partition = bp_unpack_value (&bp, 1);
+ aliases_p = bp_unpack_value (&bp, 1);
if (node->finalized)
varpool_mark_needed_node (node);
- bitpack_delete (bp);
ref = lto_input_sleb128 (ib);
/* Store a reference for now, and fix up later to be a pointer. */
node->same_comdat_group = (struct varpool_node *) (intptr_t) ref;
@@ -1138,14 +1126,13 @@ input_ref (struct lto_input_block *ib,
{
struct cgraph_node *node = NULL;
struct varpool_node *varpool_node = NULL;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
enum ipa_ref_type type;
enum ipa_ref_use use;
bp = lto_input_bitpack (ib);
- type = (enum ipa_ref_type) bp_unpack_value (bp, 1);
- use = (enum ipa_ref_use) bp_unpack_value (bp, 2);
- bitpack_delete (bp);
+ type = (enum ipa_ref_type) bp_unpack_value (&bp, 1);
+ use = (enum ipa_ref_use) bp_unpack_value (&bp, 2);
if (type == IPA_REF_CGRAPH)
node = VEC_index (cgraph_node_ptr, nodes, lto_input_sleb128 (ib));
else
@@ -1170,7 +1157,7 @@ input_edge (struct lto_input_block *ib, VEC(cgraph_node_ptr, heap) *nodes,
int freq;
unsigned int nest;
cgraph_inline_failed_t inline_failed;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
enum ld_plugin_symbol_resolution caller_resolution;
int ecf_flags = 0;
@@ -1190,11 +1177,11 @@ input_edge (struct lto_input_block *ib, VEC(cgraph_node_ptr, heap) *nodes,
count = (gcov_type) lto_input_sleb128 (ib);
bp = lto_input_bitpack (ib);
- stmt_id = (unsigned int) bp_unpack_value (bp, HOST_BITS_PER_INT);
- inline_failed = (cgraph_inline_failed_t) bp_unpack_value (bp,
+ stmt_id = (unsigned int) bp_unpack_value (&bp, HOST_BITS_PER_INT);
+ inline_failed = (cgraph_inline_failed_t) bp_unpack_value (&bp,
HOST_BITS_PER_INT);
- freq = (int) bp_unpack_value (bp, HOST_BITS_PER_INT);
- nest = (unsigned) bp_unpack_value (bp, 30);
+ freq = (int) bp_unpack_value (&bp, HOST_BITS_PER_INT);
+ nest = (unsigned) bp_unpack_value (&bp, 30);
/* If the caller was preempted, don't create the edge.
??? Should we ever have edges from a preempted caller? */
@@ -1208,28 +1195,27 @@ input_edge (struct lto_input_block *ib, VEC(cgraph_node_ptr, heap) *nodes,
else
edge = cgraph_create_edge (caller, callee, NULL, count, freq, nest);
- edge->indirect_inlining_edge = bp_unpack_value (bp, 1);
+ edge->indirect_inlining_edge = bp_unpack_value (&bp, 1);
edge->lto_stmt_uid = stmt_id;
edge->inline_failed = inline_failed;
- edge->call_stmt_cannot_inline_p = bp_unpack_value (bp, 1);
- edge->can_throw_external = bp_unpack_value (bp, 1);
+ edge->call_stmt_cannot_inline_p = bp_unpack_value (&bp, 1);
+ edge->can_throw_external = bp_unpack_value (&bp, 1);
if (indirect)
{
- if (bp_unpack_value (bp, 1))
+ if (bp_unpack_value (&bp, 1))
ecf_flags |= ECF_CONST;
- if (bp_unpack_value (bp, 1))
+ if (bp_unpack_value (&bp, 1))
ecf_flags |= ECF_PURE;
- if (bp_unpack_value (bp, 1))
+ if (bp_unpack_value (&bp, 1))
ecf_flags |= ECF_NORETURN;
- if (bp_unpack_value (bp, 1))
+ if (bp_unpack_value (&bp, 1))
ecf_flags |= ECF_MALLOC;
- if (bp_unpack_value (bp, 1))
+ if (bp_unpack_value (&bp, 1))
ecf_flags |= ECF_NOTHROW;
- if (bp_unpack_value (bp, 1))
+ if (bp_unpack_value (&bp, 1))
ecf_flags |= ECF_RETURNS_TWICE;
edge->indirect_info->ecf_flags = ecf_flags;
}
- bitpack_delete (bp);
}
@@ -1477,7 +1463,7 @@ output_node_opt_summary (struct output_block *ob,
unsigned int index;
bitmap_iterator bi;
struct ipa_replace_map *map;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
int i;
lto_output_uleb128_stream (ob->main_stream,
@@ -1504,11 +1490,10 @@ output_node_opt_summary (struct output_block *ob,
gcc_assert (parm);
lto_output_uleb128_stream (ob->main_stream, parm_num);
lto_output_tree (ob, map->new_tree, true);
- bp = bitpack_create ();
- bp_pack_value (bp, map->replace_p, 1);
- bp_pack_value (bp, map->ref_p, 1);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, map->replace_p, 1);
+ bp_pack_value (&bp, map->ref_p, 1);
+ lto_output_bitpack (&bp);
}
}
@@ -1554,7 +1539,7 @@ input_node_opt_summary (struct cgraph_node *node,
int i;
int count;
int bit;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
count = lto_input_uleb128 (ib_main);
if (count)
@@ -1577,7 +1562,7 @@ input_node_opt_summary (struct cgraph_node *node,
{
int parm_num;
tree parm;
- struct ipa_replace_map *map = GGC_NEW (struct ipa_replace_map);
+ struct ipa_replace_map *map = ggc_alloc_ipa_replace_map ();
VEC_safe_push (ipa_replace_map_p, gc, node->clone.tree_map, map);
for (parm_num = 0, parm = DECL_ARGUMENTS (node->decl); parm_num;
@@ -1587,9 +1572,8 @@ input_node_opt_summary (struct cgraph_node *node,
map->old_tree = NULL;
map->new_tree = lto_input_tree (ib_main, data_in);
bp = lto_input_bitpack (ib_main);
- map->replace_p = bp_unpack_value (bp, 1);
- map->ref_p = bp_unpack_value (bp, 1);
- bitpack_delete (bp);
+ map->replace_p = bp_unpack_value (&bp, 1);
+ map->ref_p = bp_unpack_value (&bp, 1);
}
}
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index 9d6d8a36029..7f4065e6df6 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -433,11 +433,7 @@ lto_get_decl_name_mapping (struct lto_file_decl_data *decl_data,
struct lto_in_decl_state *
lto_new_in_decl_state (void)
{
- struct lto_in_decl_state *state;
-
- state = ((struct lto_in_decl_state *) ggc_alloc (sizeof (*state)));
- memset (state, 0, sizeof (*state));
- return state;
+ return ggc_alloc_cleared_lto_in_decl_state ();
}
/* Delete STATE and its components. */
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 90e6e3937ee..635cff4d3f5 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -389,7 +389,7 @@ lto_input_eh_catch_list (struct lto_input_block *ib, struct data_in *data_in,
lto_tag_check_range (tag, LTO_eh_catch, LTO_eh_catch);
/* Read the catch node. */
- n = GGC_CNEW (struct eh_catch_d);
+ n = ggc_alloc_cleared_eh_catch_d ();
n->type_list = lto_input_tree (ib, data_in);
n->filter_list = lto_input_tree (ib, data_in);
n->label = lto_input_tree (ib, data_in);
@@ -429,7 +429,7 @@ input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
if (tag == LTO_null)
return NULL;
- r = GGC_CNEW (struct eh_region_d);
+ r = ggc_alloc_cleared_eh_region_d ();
r->index = lto_input_sleb128 (ib);
gcc_assert (r->index == ix);
@@ -502,7 +502,7 @@ input_eh_lp (struct lto_input_block *ib, struct data_in *data_in, int ix)
lto_tag_check_range (tag, LTO_eh_landing_pad, LTO_eh_landing_pad);
- lp = GGC_CNEW (struct eh_landing_pad_d);
+ lp = ggc_alloc_cleared_eh_landing_pad_d ();
lp->index = lto_input_sleb128 (ib);
gcc_assert (lp->index == ix);
lp->next_lp = (eh_landing_pad) (intptr_t) lto_input_sleb128 (ib);
@@ -707,7 +707,7 @@ make_new_block (struct function *fn, unsigned int index)
basic_block bb = alloc_block ();
bb->index = index;
SET_BASIC_BLOCK_FOR_FUNCTION (fn, index, bb);
- bb->il.gimple = GGC_CNEW (struct gimple_bb_info);
+ bb->il.gimple = ggc_alloc_cleared_gimple_bb_info ();
n_basic_blocks_for_function (fn)++;
bb->flags = 0;
set_bb_seq (bb, gimple_seq_alloc ());
@@ -1001,20 +1001,19 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
enum gimple_code code;
unsigned HOST_WIDE_INT num_ops;
size_t i;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
code = lto_tag_to_gimple_code (tag);
/* Read the tuple header. */
bp = lto_input_bitpack (ib);
- num_ops = bp_unpack_value (bp, sizeof (unsigned) * 8);
+ num_ops = bp_unpack_value (&bp, sizeof (unsigned) * 8);
stmt = gimple_alloc (code, num_ops);
- stmt->gsbase.no_warning = bp_unpack_value (bp, 1);
+ stmt->gsbase.no_warning = bp_unpack_value (&bp, 1);
if (is_gimple_assign (stmt))
- stmt->gsbase.nontemporal_move = bp_unpack_value (bp, 1);
- stmt->gsbase.has_volatile_ops = bp_unpack_value (bp, 1);
- stmt->gsbase.subcode = bp_unpack_value (bp, 16);
- bitpack_delete (bp);
+ stmt->gsbase.nontemporal_move = bp_unpack_value (&bp, 1);
+ stmt->gsbase.has_volatile_ops = bp_unpack_value (&bp, 1);
+ stmt->gsbase.subcode = bp_unpack_value (&bp, 16);
/* Read location information. */
gimple_set_location (stmt, lto_input_location (ib, data_in));
@@ -1205,13 +1204,6 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
{
gimple stmt = input_gimple_stmt (ib, data_in, fn, tag);
- /* Change debug stmts to nops on-the-fly if we do not have VTA enabled.
- This allows us to build for example static libs with debugging
- enabled and do the final link without. */
- if (!MAY_HAVE_DEBUG_STMTS
- && is_gimple_debug (stmt))
- stmt = gimple_build_nop ();
-
find_referenced_vars_in (stmt);
gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
@@ -1291,7 +1283,7 @@ input_function (tree fn_decl, struct data_in *data_in,
enum LTO_tags tag;
gimple *stmts;
basic_block bb;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
struct cgraph_node *node;
tree args, narg, oarg;
@@ -1304,22 +1296,21 @@ input_function (tree fn_decl, struct data_in *data_in,
/* Read all the attributes for FN. */
bp = lto_input_bitpack (ib);
- fn->is_thunk = bp_unpack_value (bp, 1);
- fn->has_local_explicit_reg_vars = bp_unpack_value (bp, 1);
- fn->after_tree_profile = bp_unpack_value (bp, 1);
- fn->returns_pcc_struct = bp_unpack_value (bp, 1);
- fn->returns_struct = bp_unpack_value (bp, 1);
- fn->can_throw_non_call_exceptions = bp_unpack_value (bp, 1);
- fn->always_inline_functions_inlined = bp_unpack_value (bp, 1);
- fn->after_inlining = bp_unpack_value (bp, 1);
- fn->dont_save_pending_sizes_p = bp_unpack_value (bp, 1);
- fn->stdarg = bp_unpack_value (bp, 1);
- fn->has_nonlocal_label = bp_unpack_value (bp, 1);
- fn->calls_alloca = bp_unpack_value (bp, 1);
- fn->calls_setjmp = bp_unpack_value (bp, 1);
- fn->va_list_fpr_size = bp_unpack_value (bp, 8);
- fn->va_list_gpr_size = bp_unpack_value (bp, 8);
- bitpack_delete (bp);
+ fn->is_thunk = bp_unpack_value (&bp, 1);
+ fn->has_local_explicit_reg_vars = bp_unpack_value (&bp, 1);
+ fn->after_tree_profile = bp_unpack_value (&bp, 1);
+ fn->returns_pcc_struct = bp_unpack_value (&bp, 1);
+ fn->returns_struct = bp_unpack_value (&bp, 1);
+ fn->can_throw_non_call_exceptions = bp_unpack_value (&bp, 1);
+ fn->always_inline_functions_inlined = bp_unpack_value (&bp, 1);
+ fn->after_inlining = bp_unpack_value (&bp, 1);
+ fn->dont_save_pending_sizes_p = bp_unpack_value (&bp, 1);
+ fn->stdarg = bp_unpack_value (&bp, 1);
+ fn->has_nonlocal_label = bp_unpack_value (&bp, 1);
+ fn->calls_alloca = bp_unpack_value (&bp, 1);
+ fn->calls_setjmp = bp_unpack_value (&bp, 1);
+ fn->va_list_fpr_size = bp_unpack_value (&bp, 8);
+ fn->va_list_gpr_size = bp_unpack_value (&bp, 8);
/* Input the current IL state of the function. */
fn->curr_properties = lto_input_uleb128 (ib);
@@ -1372,11 +1363,26 @@ input_function (tree fn_decl, struct data_in *data_in,
stmts = (gimple *) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple));
FOR_ALL_BB (bb)
{
- gimple_stmt_iterator bsi;
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ gimple_stmt_iterator bsi = gsi_start_bb (bb);
+ while (!gsi_end_p (bsi))
{
gimple stmt = gsi_stmt (bsi);
- stmts[gimple_uid (stmt)] = stmt;
+ /* If we're recompiling LTO objects with debug stmts but
+ we're not supposed to have debug stmts, remove them now.
+ We can't remove them earlier because this would cause uid
+ mismatches in fixups, but we can do it at this point, as
+ long as debug stmts don't require fixups. */
+ if (!MAY_HAVE_DEBUG_STMTS && is_gimple_debug (stmt))
+ {
+ gimple_stmt_iterator gsi = bsi;
+ gsi_next (&bsi);
+ gsi_remove (&gsi, true);
+ }
+ else
+ {
+ gsi_next (&bsi);
+ stmts[gimple_uid (stmt)] = stmt;
+ }
}
}
@@ -1581,12 +1587,16 @@ unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
so we skip it here. */
TREE_PUBLIC (expr) = (unsigned) bp_unpack_value (bp, 1);
}
+ else
+ bp_unpack_value (bp, 4);
TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1);
if (DECL_P (expr))
DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
else if (TYPE_P (expr))
TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
+ else
+ bp_unpack_value (bp, 1);
TREE_ASM_WRITTEN (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_USED (expr) = (unsigned) bp_unpack_value (bp, 1);
@@ -1597,8 +1607,10 @@ unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1);
if (TYPE_P (expr))
TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1);
- if (TREE_CODE (expr) == SSA_NAME)
+ else if (TREE_CODE (expr) == SSA_NAME)
SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
+ else
+ bp_unpack_value (bp, 1);
}
@@ -1621,7 +1633,7 @@ unpack_ts_real_cst_value_fields (struct bitpack_d *bp, tree expr)
for (i = 0; i < SIGSZ; i++)
r.sig[i] = (unsigned long) bp_unpack_value (bp, HOST_BITS_PER_LONG);
- rp = GGC_NEW (REAL_VALUE_TYPE);
+ rp = ggc_alloc_real_value ();
memcpy (rp, &r, sizeof (REAL_VALUE_TYPE));
TREE_REAL_CST_PTR (expr) = rp;
}
@@ -1858,32 +1870,6 @@ unpack_value_fields (struct bitpack_d *bp, tree expr)
}
-/* Read a bitpack from input block IB. */
-
-struct bitpack_d *
-lto_input_bitpack (struct lto_input_block *ib)
-{
- unsigned i, num_words;
- struct bitpack_d *bp;
-
- bp = bitpack_create ();
-
- /* If we are about to read more than a handful of words, something
- is wrong. This check is overly strict, but it acts as an early
- warning. No streamed object has hundreds of bits in its fields. */
- num_words = lto_input_uleb128 (ib);
- gcc_assert (num_words < 20);
-
- for (i = 0; i < num_words; i++)
- {
- bitpack_word_t w = lto_input_uleb128 (ib);
- VEC_safe_push (bitpack_word_t, heap, bp->values, w);
- }
-
- return bp;
-}
-
-
/* Materialize a new tree from input block IB using descriptors in
DATA_IN. The code for the new tree should match TAG. Store in
*IX_P the index into the reader cache where the new tree is stored. */
@@ -1892,7 +1878,7 @@ static tree
lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in,
enum LTO_tags tag, int *ix_p)
{
- struct bitpack_d *bp;
+ struct bitpack_d bp;
enum tree_code code;
tree result;
#ifdef LTO_STREAMER_DEBUG
@@ -1957,12 +1943,11 @@ lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in,
/* The first word in BP contains the code of the tree that we
are about to read. */
- code = (enum tree_code) bp_unpack_value (bp, 16);
+ code = (enum tree_code) bp_unpack_value (&bp, 16);
lto_tag_check (lto_tree_code_to_tag (code), tag);
/* Unpack all the value fields from BP. */
- unpack_value_fields (bp, result);
- bitpack_delete (bp);
+ unpack_value_fields (&bp, result);
/* Enter RESULT in the reader cache. This will make RESULT
available so that circular references in the rest of the tree
@@ -2192,7 +2177,8 @@ lto_input_ts_type_tree_pointers (struct lto_input_block *ib,
if (RECORD_OR_UNION_TYPE_P (expr))
TYPE_BINFO (expr) = lto_input_tree (ib, data_in);
TYPE_CONTEXT (expr) = lto_input_tree (ib, data_in);
- TYPE_CANONICAL (expr) = lto_input_tree (ib, data_in);
+ /* TYPE_CANONICAL gets re-computed during type merging. */
+ TYPE_CANONICAL (expr) = NULL_TREE;
TYPE_STUB_DECL (expr) = lto_input_tree (ib, data_in);
}
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index d43de21616a..6ee2eda2784 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -151,20 +151,6 @@ destroy_output_block (struct output_block *ob)
}
-/* Output bitpack BP to output stream S. */
-
-void
-lto_output_bitpack (struct lto_output_stream *s, struct bitpack_d *bp)
-{
- unsigned i;
- bitpack_word_t v;
-
- lto_output_uleb128_stream (s, VEC_length (bitpack_word_t, bp->values));
- for (i = 0; VEC_iterate (bitpack_word_t, bp->values, i, v); i++)
- lto_output_uleb128_stream (s, v);
-}
-
-
/* Output STRING of LEN characters to the string
table in OB. The string might or might not include a trailing '\0'.
Then put the index onto the INDEX_STREAM. */
@@ -335,12 +321,16 @@ pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
so we skip it here. */
bp_pack_value (bp, TREE_PUBLIC (expr), 1);
}
+ else
+ bp_pack_value (bp, 0, 4);
bp_pack_value (bp, TREE_ADDRESSABLE (expr), 1);
bp_pack_value (bp, TREE_THIS_VOLATILE (expr), 1);
if (DECL_P (expr))
bp_pack_value (bp, DECL_UNSIGNED (expr), 1);
else if (TYPE_P (expr))
bp_pack_value (bp, TYPE_UNSIGNED (expr), 1);
+ else
+ bp_pack_value (bp, 0, 1);
/* We write debug info two times, do not confuse the second one. */
bp_pack_value (bp, TYPE_P (expr) ? 0 : TREE_ASM_WRITTEN (expr), 1);
bp_pack_value (bp, TREE_NO_WARNING (expr), 1);
@@ -352,8 +342,10 @@ pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
bp_pack_value (bp, TREE_DEPRECATED (expr), 1);
if (TYPE_P (expr))
bp_pack_value (bp, TYPE_SATURATING (expr), 1);
- if (TREE_CODE (expr) == SSA_NAME)
+ else if (TREE_CODE (expr) == SSA_NAME)
bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
+ else
+ bp_pack_value (bp, 0, 1);
}
@@ -544,14 +536,12 @@ pack_ts_block_value_fields (struct bitpack_d *bp, tree expr)
/* Pack all the non-pointer fields in EXPR into a bit pack. */
-static struct bitpack_d *
-pack_value_fields (tree expr)
+static void
+pack_value_fields (struct bitpack_d *bp, tree expr)
{
enum tree_code code;
- struct bitpack_d *bp;
code = TREE_CODE (expr);
- bp = bitpack_create ();
/* Note that all these functions are highly sensitive to changes in
the types and sizes of each of the fields being packed. */
@@ -598,8 +588,6 @@ pack_value_fields (tree expr)
/* This is only used by High GIMPLE. */
gcc_unreachable ();
}
-
- return bp;
}
@@ -986,7 +974,8 @@ lto_output_ts_type_tree_pointers (struct output_block *ob, tree expr,
if (RECORD_OR_UNION_TYPE_P (expr))
lto_output_tree_or_ref (ob, TYPE_BINFO (expr), ref_p);
lto_output_tree_or_ref (ob, TYPE_CONTEXT (expr), ref_p);
- lto_output_tree_or_ref (ob, TYPE_CANONICAL (expr), ref_p);
+ /* TYPE_CANONICAL is re-computed during type merging, so no need
+ to stream it here. */
lto_output_tree_or_ref (ob, TYPE_STUB_DECL (expr), ref_p);
}
@@ -1293,7 +1282,7 @@ lto_output_builtin_tree (struct output_block *ob, tree expr, int ix)
static void
lto_write_tree (struct output_block *ob, tree expr, bool ref_p, int ix)
{
- struct bitpack_d *bp;
+ struct bitpack_d bp;
/* Write the header, containing everything needed to materialize
EXPR on the reading side. */
@@ -1301,9 +1290,9 @@ lto_write_tree (struct output_block *ob, tree expr, bool ref_p, int ix)
/* Pack all the non-pointer fields in EXPR into a bitpack and write
the resulting bitpack. */
- bp = pack_value_fields (expr);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp = bitpack_create (ob->main_stream);
+ pack_value_fields (&bp, expr);
+ lto_output_bitpack (&bp);
/* Write all the pointer fields in EXPR. */
lto_output_tree_pointers (ob, expr, ref_p);
@@ -1660,7 +1649,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
unsigned i;
enum gimple_code code;
enum LTO_tags tag;
- struct bitpack_d *bp;
+ struct bitpack_d bp;
/* Emit identifying tag. */
code = gimple_code (stmt);
@@ -1668,15 +1657,14 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
output_record_start (ob, tag);
/* Emit the tuple header. */
- bp = bitpack_create ();
- bp_pack_value (bp, gimple_num_ops (stmt), sizeof (unsigned) * 8);
- bp_pack_value (bp, gimple_no_warning_p (stmt), 1);
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, gimple_num_ops (stmt), sizeof (unsigned) * 8);
+ bp_pack_value (&bp, gimple_no_warning_p (stmt), 1);
if (is_gimple_assign (stmt))
- bp_pack_value (bp, gimple_assign_nontemporal_move_p (stmt), 1);
- bp_pack_value (bp, gimple_has_volatile_ops (stmt), 1);
- bp_pack_value (bp, stmt->gsbase.subcode, 16);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
+ bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
+ bp_pack_value (&bp, stmt->gsbase.subcode, 16);
+ lto_output_bitpack (&bp);
/* Emit location information for the statement. */
lto_output_location (ob, gimple_location (stmt));
@@ -1847,7 +1835,7 @@ produce_asm (struct output_block *ob, tree fn)
static void
output_function (struct cgraph_node *node)
{
- struct bitpack_d *bp;
+ struct bitpack_d bp;
tree function;
struct function *fn;
basic_block bb;
@@ -1872,24 +1860,23 @@ output_function (struct cgraph_node *node)
output_record_start (ob, LTO_function);
/* Write all the attributes for FN. */
- bp = bitpack_create ();
- bp_pack_value (bp, fn->is_thunk, 1);
- bp_pack_value (bp, fn->has_local_explicit_reg_vars, 1);
- bp_pack_value (bp, fn->after_tree_profile, 1);
- bp_pack_value (bp, fn->returns_pcc_struct, 1);
- bp_pack_value (bp, fn->returns_struct, 1);
- bp_pack_value (bp, fn->can_throw_non_call_exceptions, 1);
- bp_pack_value (bp, fn->always_inline_functions_inlined, 1);
- bp_pack_value (bp, fn->after_inlining, 1);
- bp_pack_value (bp, fn->dont_save_pending_sizes_p, 1);
- bp_pack_value (bp, fn->stdarg, 1);
- bp_pack_value (bp, fn->has_nonlocal_label, 1);
- bp_pack_value (bp, fn->calls_alloca, 1);
- bp_pack_value (bp, fn->calls_setjmp, 1);
- bp_pack_value (bp, fn->va_list_fpr_size, 8);
- bp_pack_value (bp, fn->va_list_gpr_size, 8);
- lto_output_bitpack (ob->main_stream, bp);
- bitpack_delete (bp);
+ bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, fn->is_thunk, 1);
+ bp_pack_value (&bp, fn->has_local_explicit_reg_vars, 1);
+ bp_pack_value (&bp, fn->after_tree_profile, 1);
+ bp_pack_value (&bp, fn->returns_pcc_struct, 1);
+ bp_pack_value (&bp, fn->returns_struct, 1);
+ bp_pack_value (&bp, fn->can_throw_non_call_exceptions, 1);
+ bp_pack_value (&bp, fn->always_inline_functions_inlined, 1);
+ bp_pack_value (&bp, fn->after_inlining, 1);
+ bp_pack_value (&bp, fn->dont_save_pending_sizes_p, 1);
+ bp_pack_value (&bp, fn->stdarg, 1);
+ bp_pack_value (&bp, fn->has_nonlocal_label, 1);
+ bp_pack_value (&bp, fn->calls_alloca, 1);
+ bp_pack_value (&bp, fn->calls_setjmp, 1);
+ bp_pack_value (&bp, fn->va_list_fpr_size, 8);
+ bp_pack_value (&bp, fn->va_list_gpr_size, 8);
+ lto_output_bitpack (&bp);
/* Output current IL state of the function. */
output_uleb128 (ob, fn->curr_properties);
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index a086d918004..406096015f4 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -266,147 +266,6 @@ print_lto_report (void)
lto_section_name[i], lto_stats.section_size[i]);
}
-/* We cache a single bitpack assuming that usually at most one is
- life. This saves repeated re-allocations. */
-static struct bitpack_d *cached_bp;
-
-/* Create a new bitpack. */
-
-struct bitpack_d *
-bitpack_create (void)
-{
- if (cached_bp)
- {
- struct bitpack_d *bp = cached_bp;
- cached_bp = NULL;
- return bp;
- }
- return XCNEW (struct bitpack_d);
-}
-
-
-/* Free the memory used by bitpack BP. */
-
-void
-bitpack_delete (struct bitpack_d *bp)
-{
- if (!cached_bp)
- {
- bp->num_bits = 0;
- bp->first_unused_bit = 0;
- VEC_truncate (bitpack_word_t, bp->values, 0);
- cached_bp = bp;
- return;
- }
- VEC_free (bitpack_word_t, heap, bp->values);
- free (bp);
-}
-
-
-/* Return an index to the word in bitpack BP that contains the
- next NBITS. */
-
-static inline unsigned
-bp_get_next_word (struct bitpack_d *bp, unsigned nbits)
-{
- unsigned last, ix;
-
- /* In principle, the next word to use is determined by the
- number of bits already processed in BP. */
- ix = bp->num_bits / BITS_PER_BITPACK_WORD;
-
- /* All the encoded bit patterns in BP are contiguous, therefore if
- the next NBITS would straddle over two different words, move the
- index to the next word and update the number of encoded bits
- by adding up the hole of unused bits created by this move. */
- bp->first_unused_bit %= BITS_PER_BITPACK_WORD;
- last = bp->first_unused_bit + nbits - 1;
- if (last >= BITS_PER_BITPACK_WORD)
- {
- ix++;
- bp->num_bits += (BITS_PER_BITPACK_WORD - bp->first_unused_bit);
- bp->first_unused_bit = 0;
- }
-
- return ix;
-}
-
-
-/* Pack NBITS of value VAL into bitpack BP. */
-
-void
-bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
-{
- unsigned ix;
- bitpack_word_t word;
-
- /* We cannot encode more bits than BITS_PER_BITPACK_WORD. */
-#ifdef ENABLE_CHECKING
- gcc_assert (nbits > 0 && nbits <= BITS_PER_BITPACK_WORD);
-#endif
-
- /* Compute which word will contain the next NBITS. */
- ix = bp_get_next_word (bp, nbits);
- if (ix >= VEC_length (bitpack_word_t, bp->values))
- {
- /* If there is no room left in the last word of the values
- array, add a new word. Additionally, we should only
- need to add a single word, since every pack operation cannot
- use more bits than fit in a single word. */
- VEC_safe_push (bitpack_word_t, heap, bp->values, 0);
- }
-
- /* Grab the last word to pack VAL into. */
- word = VEC_index (bitpack_word_t, bp->values, ix);
-
- /* To fit VAL in WORD, we need to shift VAL to the left to
- skip the bottom BP->FIRST_UNUSED_BIT bits. */
- val <<= bp->first_unused_bit;
-
- /* Update WORD with VAL. */
- word |= val;
-
- /* Update BP. */
- VEC_replace (bitpack_word_t, bp->values, ix, word);
- bp->num_bits += nbits;
- bp->first_unused_bit += nbits;
-}
-
-
-/* Unpack the next NBITS from bitpack BP. */
-
-bitpack_word_t
-bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
-{
- bitpack_word_t val, word, mask;
- unsigned ix;
-
- /* We cannot decode more bits than BITS_PER_BITPACK_WORD. */
- gcc_assert (nbits > 0 && nbits <= BITS_PER_BITPACK_WORD);
-
- /* Compute which word contains the next NBITS. */
- ix = bp_get_next_word (bp, nbits);
- word = VEC_index (bitpack_word_t, bp->values, ix);
-
- /* Compute the mask to get NBITS from WORD. */
- mask = (nbits == BITS_PER_BITPACK_WORD)
- ? (bitpack_word_t) -1
- : ((bitpack_word_t) 1 << nbits) - 1;
-
- /* Shift WORD to the right to skip over the bits already decoded
- in word. */
- word >>= bp->first_unused_bit;
-
- /* Apply the mask to obtain the requested value. */
- val = word & mask;
-
- /* Update BP->NUM_BITS for the next unpack operation. */
- bp->num_bits += nbits;
- bp->first_unused_bit += nbits;
-
- return val;
-}
-
/* Check that all the TS_* structures handled by the lto_output_* and
lto_input_* routines are exactly ALL the structures defined in
@@ -674,7 +533,12 @@ lto_record_common_node (tree *nodep, VEC(tree, heap) **common_nodes,
return;
if (TYPE_P (node))
- *nodep = node = gimple_register_type (node);
+ {
+ /* Type merging will get confused by the canonical types as they
+ are set by the middle-end. */
+ TYPE_CANONICAL (node) = NULL_TREE;
+ *nodep = node = gimple_register_type (node);
+ }
/* Return if node is already seen. */
if (pointer_set_insert (seen_nodes, node))
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index b7c0c367d0c..cc38b22d179 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -156,17 +156,14 @@ DEF_VEC_ALLOC_I(bitpack_word_t, heap);
struct bitpack_d
{
- /* Total number of bits packed/unpacked so far. */
- size_t num_bits;
+ /* The position of the first unused or unconsumed bit in the word. */
+ unsigned pos;
- /* Values are stored contiguously, so there may be internal
- fragmentation (words with unused bits). Therefore, we need to
- keep track of the first available bit in the last word of the
- bitpack. */
- size_t first_unused_bit;
+ /* The current word we are (un)packing. */
+ bitpack_word_t word;
- /* Vector of words holding the packed values. */
- VEC(bitpack_word_t, heap) *values;
+ /* The lto_output_stream or the lto_input_block we are streaming to/from. */
+ void *stream;
};
/* Tags representing the various IL objects written to the bytecode file
@@ -498,6 +495,14 @@ struct lto_varpool_encoder_d
};
typedef struct lto_varpool_encoder_d *lto_varpool_encoder_t;
+/* Return number of encoded nodes in ENCODER. */
+
+static inline int
+lto_varpool_encoder_size (lto_varpool_encoder_t encoder)
+{
+ return VEC_length (varpool_node_ptr, encoder->nodes);
+}
+
/* Mapping from indices to trees. */
struct GTY(()) lto_tree_ref_table
{
@@ -597,6 +602,8 @@ struct GTY(()) lto_file_decl_data
htab_t GTY((skip)) renaming_hash_table;
};
+typedef struct lto_file_decl_data *lto_file_decl_data_ptr;
+
struct lto_char_ptr_base
{
char *ptr;
@@ -810,10 +817,6 @@ extern bitmap lto_bitmap_alloc (void);
extern void lto_bitmap_free (bitmap);
extern char *lto_get_section_name (int, const char *);
extern void print_lto_report (void);
-extern struct bitpack_d *bitpack_create (void);
-extern void bitpack_delete (struct bitpack_d *);
-extern void bp_pack_value (struct bitpack_d *, bitpack_word_t, unsigned);
-extern bitpack_word_t bp_unpack_value (struct bitpack_d *, unsigned);
extern bool lto_streamer_cache_insert (struct lto_streamer_cache_d *, tree,
int *, unsigned *);
extern bool lto_streamer_cache_insert_at (struct lto_streamer_cache_d *, tree,
@@ -841,7 +844,6 @@ extern void lto_input_function_body (struct lto_file_decl_data *, tree,
const char *);
extern void lto_input_constructors_and_inits (struct lto_file_decl_data *,
const char *);
-extern struct bitpack_d *lto_input_bitpack (struct lto_input_block *);
extern void lto_init_reader (void);
extern struct data_in *lto_data_in_create (struct lto_file_decl_data *,
const char *, unsigned,
@@ -854,7 +856,6 @@ extern void lto_register_decl_definition (tree, struct lto_file_decl_data *);
extern struct output_block *create_output_block (enum lto_section_type);
extern void destroy_output_block (struct output_block *);
extern void lto_output_tree (struct output_block *, tree, bool);
-extern void lto_output_bitpack (struct lto_output_stream *, struct bitpack_d *);
extern void produce_asm (struct output_block *ob, tree fn);
@@ -1067,4 +1068,85 @@ DEFINE_DECL_STREAM_FUNCS (TYPE_DECL, type_decl)
DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl)
DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl)
+/* Returns a new bit-packing context for bit-packing into S. */
+static inline struct bitpack_d
+bitpack_create (struct lto_output_stream *s)
+{
+ struct bitpack_d bp;
+ bp.pos = 0;
+ bp.word = 0;
+ bp.stream = (void *)s;
+ return bp;
+}
+
+/* Pack the NBITS bit sized value VAL into the bit-packing context BP. */
+static inline void
+bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
+{
+ bitpack_word_t word = bp->word;
+ int pos = bp->pos;
+ /* If val does not fit into the current bitpack word switch to the
+ next one. */
+ if (pos + nbits > BITS_PER_BITPACK_WORD)
+ {
+ lto_output_uleb128_stream ((struct lto_output_stream *) bp->stream, word);
+ word = val;
+ pos = nbits;
+ }
+ else
+ {
+ word |= val << pos;
+ pos += nbits;
+ }
+ bp->word = word;
+ bp->pos = pos;
+}
+
+/* Finishes bit-packing of BP. */
+static inline void
+lto_output_bitpack (struct bitpack_d *bp)
+{
+ lto_output_uleb128_stream ((struct lto_output_stream *) bp->stream,
+ bp->word);
+ bp->word = 0;
+ bp->pos = 0;
+}
+
+/* Returns a new bit-packing context for bit-unpacking from IB. */
+static inline struct bitpack_d
+lto_input_bitpack (struct lto_input_block *ib)
+{
+ struct bitpack_d bp;
+ bp.word = lto_input_uleb128 (ib);
+ bp.pos = 0;
+ bp.stream = (void *)ib;
+ return bp;
+}
+
+/* Unpacks NBITS bits from the bit-packing context BP and returns them. */
+static inline bitpack_word_t
+bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
+{
+ bitpack_word_t mask, val;
+ int pos = bp->pos;
+
+ mask = (nbits == BITS_PER_BITPACK_WORD
+ ? (bitpack_word_t) -1
+ : ((bitpack_word_t) 1 << nbits) - 1);
+
+ /* If there are not continuous nbits in the current bitpack word
+ switch to the next one. */
+ if (pos + nbits > BITS_PER_BITPACK_WORD)
+ {
+ bp->word = val = lto_input_uleb128 ((struct lto_input_block *)bp->stream);
+ bp->pos = nbits;
+ return val & mask;
+ }
+ val = bp->word;
+ val >>= pos;
+ bp->pos = pos + nbits;
+
+ return val & mask;
+}
+
#endif /* GCC_LTO_STREAMER_H */
diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c
index f02824d1f45..e94bc204b22 100644
--- a/gcc/lto-symtab.c
+++ b/gcc/lto-symtab.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "tree.h"
#include "gimple.h"
-#include "ggc.h" /* lambda.h needs this */
+#include "ggc.h"
#include "lambda.h" /* gcd */
#include "hashtab.h"
#include "plugin-api.h"
@@ -152,7 +152,7 @@ lto_symtab_register_decl (tree decl,
if (TREE_CODE (decl) == FUNCTION_DECL)
gcc_assert (!DECL_ABSTRACT (decl));
- new_entry = GGC_CNEW (struct lto_symtab_entry_def);
+ new_entry = ggc_alloc_cleared_lto_symtab_entry_def ();
new_entry->id = DECL_ASSEMBLER_NAME (decl);
new_entry->decl = decl;
new_entry->resolution = resolution;
@@ -530,11 +530,20 @@ lto_symtab_resolve_symbols (void **slot)
return;
found:
- if (TREE_CODE (prevailing->decl) == VAR_DECL
- && TREE_READONLY (prevailing->decl))
+ /* If current lto files represent the whole program,
+ it is correct to use LDPR_PREVALING_DEF_IRONLY.
+ If current lto files are part of whole program, internal
+ resolver doesn't know if it is LDPR_PREVAILING_DEF
+ or LDPR_PREVAILING_DEF_IRONLY. Use IRONLY conforms to
+ using -fwhole-program. Otherwise, it doesn't
+ matter using either LDPR_PREVAILING_DEF or
+ LDPR_PREVAILING_DEF_IRONLY
+
+ FIXME: above workaround due to gold plugin makes some
+ variables IRONLY, which are indeed PREVAILING_DEF in
+ resolution file. These variables still need manual
+ externally_visible attribute. */
prevailing->resolution = LDPR_PREVAILING_DEF_IRONLY;
- else
- prevailing->resolution = LDPR_PREVAILING_DEF;
}
/* Merge all decls in the symbol table chain to the prevailing decl and
@@ -698,6 +707,24 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED)
&& TREE_CODE (prevailing->decl) != VAR_DECL)
prevailing->next = NULL;
+ /* Set externally_visible flags for declaration of LDPR_PREVAILING_DEF */
+ if (flag_whole_program)
+ {
+ if (prevailing->resolution == LDPR_PREVAILING_DEF)
+ {
+ if (TREE_CODE (prevailing->decl) == FUNCTION_DECL)
+ prevailing->node->local.used_from_object_file = true;
+ else
+ prevailing->vnode->used_from_object_file = true;
+ }
+ else if (prevailing->resolution == LDPR_PREVAILING_DEF_IRONLY)
+ {
+ if (TREE_CODE (prevailing->decl) == FUNCTION_DECL)
+ prevailing->node->local.used_from_object_file = false;
+ else
+ prevailing->vnode->used_from_object_file = false;
+ }
+ }
return 1;
}
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index fe5b3464efe..da120b38e58 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -39,12 +39,12 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
+#include "coretypes.h"
#include <errno.h>
#include <signal.h>
#if ! defined( SIGCHLD ) && defined( SIGCLD )
# define SIGCHLD SIGCLD
#endif
-#include "defaults.h"
#include "intl.h"
#include "libiberty.h"
#include "obstack.h"
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index c67cee78d9f..c3618b6ab4a 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,30 @@
+2010-06-13 Richard Guenther <rguenther@suse.de>
+
+ * lto.c (lto_fixup_type): Do not register or fixup TYPE_CANONICAL.
+
+2010-06-09 Kai Tietz <kai.tietz@onevision.com>
+
+ * lto.c (lto_resolution_read): Pre-initialize local variable r.
+ * lto-coff.c (coff_write_object_file): Add braces to if.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * lto.c (lto_read_in_decl_state): Use typed GC allocation.
+ (lto_file_read): Likewise.
+ (new_partition): Likewise.
+ (read_cgraph_and_symbols): Likewise.
+
+2010-06-07 Joseph Myers <joseph@codesourcery.com>
+
+ * lto-lang.c (flag_no_builtin, flag_no_nonansi_builtin): Remove.
+ (lto_handle_option): Don't set flag_signed_char here.
+
+2010-06-04 Richard Guenther <rguenther@suse.de>
+
+ PR lto/41584
+ * lto.c (lto_1_to_1_map): Use the proper file_data for
+ varpool nodes.
+
2010-05-30 Jan Hubicka <jh@suse.cz>
* lto.c (promote_var, promote_fn, lto_wpa_write_files): Dump
diff --git a/gcc/lto/lto-coff.c b/gcc/lto/lto-coff.c
index 0eca8936d20..1f4264e6d24 100644
--- a/gcc/lto/lto-coff.c
+++ b/gcc/lto/lto-coff.c
@@ -770,12 +770,14 @@ coff_write_object_file (lto_coff_file *coff_file)
if (!write_err)
write_err = (write (coff_file->fd, outlen, 4) != 4);
if (stringsec)
- COFF_FOR_ALL_DATA(stringsec, data)
- if (!write_err)
- write_err = (write (coff_file->fd, data->d_buf, data->d_size)
- != data->d_size);
- else
- break;
+ {
+ COFF_FOR_ALL_DATA(stringsec, data)
+ if (!write_err)
+ write_err = (write (coff_file->fd, data->d_buf, data->d_size)
+ != data->d_size);
+ else
+ break;
+ }
}
return write_err;
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 974e3d7328b..636b62aec58 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -1,5 +1,5 @@
/* Language-dependent hooks for LTO.
- Copyright 2009 Free Software Foundation, Inc.
+ Copyright 2009, 2010 Free Software Foundation, Inc.
Contributed by CodeSourcery, Inc.
This file is part of GCC.
@@ -154,8 +154,6 @@ static GTY(()) tree uintmax_type_node;
static GTY(()) tree signed_size_type_node;
/* Flags needed to process builtins.def. */
-int flag_no_builtin;
-int flag_no_nonansi_builtin;
int flag_isoc94;
int flag_isoc99;
@@ -632,14 +630,6 @@ lto_handle_option (size_t scode, const char *arg,
warn_psabi = value;
break;
- case OPT_fsigned_char:
- flag_signed_char = value;
- break;
-
- case OPT_funsigned_char:
- flag_signed_char = !value;
- break;
-
default:
break;
}
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 5031659d740..d969a1042d7 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -158,7 +158,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
{
uint32_t size = *data++;
- tree *decls = GGC_NEWVEC (tree, size);
+ tree *decls = ggc_alloc_vec_tree (size);
for (j = 0; j < size; j++)
{
@@ -317,7 +317,7 @@ lto_resolution_read (FILE *resolution, lto_file *file)
int t;
unsigned index;
char r_str[27];
- enum ld_plugin_symbol_resolution r;
+ enum ld_plugin_symbol_resolution r = (enum ld_plugin_symbol_resolution) 0;
unsigned int j;
unsigned int lto_resolution_str_len =
sizeof (lto_resolution_str) / sizeof (char *);
@@ -364,7 +364,7 @@ lto_file_read (lto_file *file, FILE *resolution_file)
resolutions = lto_resolution_read (resolution_file, file);
- file_data = GGC_NEW (struct lto_file_decl_data);
+ file_data = ggc_alloc_lto_file_decl_data ();
file_data->file_name = file->filename;
file_data->section_hash_table = lto_obj_build_section_table (file);
file_data->renaming_hash_table = lto_create_renaming_table ();
@@ -529,7 +529,7 @@ static GTY (()) VEC(ltrans_partition, gc) *ltrans_partitions;
static ltrans_partition
new_partition (const char *name)
{
- ltrans_partition part = GGC_NEW (struct ltrans_partition_def);
+ ltrans_partition part = ggc_alloc_ltrans_partition_def ();
part->cgraph_set = cgraph_node_set_new ();
part->varpool_set = varpool_node_set_new ();
part->name = name;
@@ -599,6 +599,7 @@ lto_1_to_1_map (void)
{
if (vnode->alias || !vnode->needed)
continue;
+ file_data = vnode->lto_file_data;
slot = pointer_map_contains (pmap, file_data);
if (slot)
partition = (ltrans_partition) *slot;
@@ -1086,7 +1087,11 @@ lto_fixup_type (tree t, void *data)
else
LTO_FIXUP_SUBTREE (TYPE_CONTEXT (t));
}
- LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE (TYPE_CANONICAL (t));
+
+ /* TYPE_CANONICAL does not need to be fixed up, instead it should
+ always point to ourselves at this time as we never fixup
+ non-canonical ones. */
+ gcc_assert (TYPE_CANONICAL (t) == t);
/* The following re-creates proper variant lists while fixing up
the variant leaders. We do not stream TYPE_NEXT_VARIANT so the
@@ -1434,7 +1439,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_push (TV_IPA_LTO_DECL_IO);
/* Set the hooks so that all of the ipa passes can read in their data. */
- all_file_decl_data = GGC_CNEWVEC (struct lto_file_decl_data *, nfiles + 1);
+ all_file_decl_data
+ = ggc_alloc_cleared_vec_lto_file_decl_data_ptr (nfiles + 1);
lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data);
/* Read the resolution file. */
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index 4958762169f..84c6e6ea3c2 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -218,7 +218,7 @@ collect_data_for_malloc_call (gimple stmt, struct malloc_call_data *m_data)
initial address and index of each dimension. */
struct access_site_info
{
- /* The statement (INDIRECT_REF or POINTER_PLUS_EXPR). */
+ /* The statement (MEM_REF or POINTER_PLUS_EXPR). */
gimple stmt;
/* In case of POINTER_PLUS_EXPR, what is the offset. */
@@ -334,7 +334,7 @@ struct ssa_acc_in_tree
/* The variable whose accesses in the tree we are looking for. */
tree ssa_var;
/* The tree and code inside it the ssa_var is accessed, currently
- it could be an INDIRECT_REF or CALL_EXPR. */
+ it could be an MEM_REF or CALL_EXPR. */
enum tree_code t_code;
tree t_tree;
/* The place in the containing tree. */
@@ -413,33 +413,18 @@ mtt_info_eq (const void *mtt1, const void *mtt2)
static bool
may_flatten_matrices_1 (gimple stmt)
{
- tree t;
-
switch (gimple_code (stmt))
{
case GIMPLE_ASSIGN:
- if (!gimple_assign_cast_p (stmt))
+ case GIMPLE_CALL:
+ if (!gimple_has_lhs (stmt))
return true;
-
- t = gimple_assign_rhs1 (stmt);
- while (CONVERT_EXPR_P (t))
+ if (TREE_CODE (TREE_TYPE (gimple_get_lhs (stmt))) == VECTOR_TYPE)
{
- if (TREE_TYPE (t) && POINTER_TYPE_P (TREE_TYPE (t)))
- {
- tree pointee;
-
- pointee = TREE_TYPE (t);
- while (POINTER_TYPE_P (pointee))
- pointee = TREE_TYPE (pointee);
- if (TREE_CODE (pointee) == VECTOR_TYPE)
- {
- if (dump_file)
- fprintf (dump_file,
- "Found vector type, don't flatten matrix\n");
- return false;
- }
- }
- t = TREE_OPERAND (t, 0);
+ if (dump_file)
+ fprintf (dump_file,
+ "Found vector type, don't flatten matrix\n");
+ return false;
}
break;
case GIMPLE_ASM:
@@ -602,7 +587,7 @@ mark_min_matrix_escape_level (struct matrix_info *mi, int l, gimple s)
/* Find if the SSA variable is accessed inside the
tree and record the tree containing it.
The only relevant uses are the case of SSA_NAME, or SSA inside
- INDIRECT_REF, PLUS_EXPR, POINTER_PLUS_EXPR, MULT_EXPR. */
+ MEM_REF, PLUS_EXPR, POINTER_PLUS_EXPR, MULT_EXPR. */
static void
ssa_accessed_in_tree (tree t, struct ssa_acc_in_tree *a)
{
@@ -613,7 +598,7 @@ ssa_accessed_in_tree (tree t, struct ssa_acc_in_tree *a)
if (t == a->ssa_var)
a->var_found = true;
break;
- case INDIRECT_REF:
+ case MEM_REF:
if (SSA_VAR_P (TREE_OPERAND (t, 0))
&& TREE_OPERAND (t, 0) == a->ssa_var)
a->var_found = true;
@@ -660,7 +645,7 @@ ssa_accessed_in_assign_rhs (gimple stmt, struct ssa_acc_in_tree *a)
tree op1, op2;
case SSA_NAME:
- case INDIRECT_REF:
+ case MEM_REF:
CASE_CONVERT:
case VIEW_CONVERT_EXPR:
ssa_accessed_in_tree (gimple_assign_rhs1 (stmt), a);
@@ -984,7 +969,7 @@ get_index_from_offset (tree offset, gimple def_stmt)
/* update MI->dimension_type_size[CURRENT_INDIRECT_LEVEL] with the size
of the type related to the SSA_VAR, or the type related to the
- lhs of STMT, in the case that it is an INDIRECT_REF. */
+ lhs of STMT, in the case that it is an MEM_REF. */
static void
update_type_size (struct matrix_info *mi, gimple stmt, tree ssa_var,
int current_indirect_level)
@@ -992,9 +977,9 @@ update_type_size (struct matrix_info *mi, gimple stmt, tree ssa_var,
tree lhs;
HOST_WIDE_INT type_size;
- /* Update type according to the type of the INDIRECT_REF expr. */
+ /* Update type according to the type of the MEM_REF expr. */
if (is_gimple_assign (stmt)
- && TREE_CODE (gimple_assign_lhs (stmt)) == INDIRECT_REF)
+ && TREE_CODE (gimple_assign_lhs (stmt)) == MEM_REF)
{
lhs = gimple_assign_lhs (stmt);
gcc_assert (POINTER_TYPE_P
@@ -1073,7 +1058,7 @@ analyze_accesses_for_call_stmt (struct matrix_info *mi, tree ssa_var,
at this level because in this case we cannot calculate the
address correctly. */
if ((lhs_acc.var_found && rhs_acc.var_found
- && lhs_acc.t_code == INDIRECT_REF)
+ && lhs_acc.t_code == MEM_REF)
|| (!rhs_acc.var_found && !lhs_acc.var_found))
{
mark_min_matrix_escape_level (mi, current_indirect_level, use_stmt);
@@ -1087,7 +1072,7 @@ analyze_accesses_for_call_stmt (struct matrix_info *mi, tree ssa_var,
{
int l = current_indirect_level + 1;
- gcc_assert (lhs_acc.t_code == INDIRECT_REF);
+ gcc_assert (lhs_acc.t_code == MEM_REF);
mark_min_matrix_escape_level (mi, l, use_stmt);
return current_indirect_level;
}
@@ -1213,7 +1198,7 @@ analyze_accesses_for_assign_stmt (struct matrix_info *mi, tree ssa_var,
at this level because in this case we cannot calculate the
address correctly. */
if ((lhs_acc.var_found && rhs_acc.var_found
- && lhs_acc.t_code == INDIRECT_REF)
+ && lhs_acc.t_code == MEM_REF)
|| (!rhs_acc.var_found && !lhs_acc.var_found))
{
mark_min_matrix_escape_level (mi, current_indirect_level, use_stmt);
@@ -1227,7 +1212,7 @@ analyze_accesses_for_assign_stmt (struct matrix_info *mi, tree ssa_var,
{
int l = current_indirect_level + 1;
- gcc_assert (lhs_acc.t_code == INDIRECT_REF);
+ gcc_assert (lhs_acc.t_code == MEM_REF);
if (!(gimple_assign_copy_p (use_stmt)
|| gimple_assign_cast_p (use_stmt))
@@ -1248,7 +1233,7 @@ analyze_accesses_for_assign_stmt (struct matrix_info *mi, tree ssa_var,
is used. */
if (rhs_acc.var_found)
{
- if (rhs_acc.t_code != INDIRECT_REF
+ if (rhs_acc.t_code != MEM_REF
&& rhs_acc.t_code != POINTER_PLUS_EXPR && rhs_acc.t_code != SSA_NAME)
{
mark_min_matrix_escape_level (mi, current_indirect_level, use_stmt);
@@ -1256,7 +1241,7 @@ analyze_accesses_for_assign_stmt (struct matrix_info *mi, tree ssa_var,
}
/* If the access in the RHS has an indirection increase the
indirection level. */
- if (rhs_acc.t_code == INDIRECT_REF)
+ if (rhs_acc.t_code == MEM_REF)
{
if (record_accesses)
record_access_alloc_site_info (mi, use_stmt, NULL_TREE,
@@ -1309,7 +1294,7 @@ analyze_accesses_for_assign_stmt (struct matrix_info *mi, tree ssa_var,
}
/* If we are storing this level of indirection mark it as
escaping. */
- if (lhs_acc.t_code == INDIRECT_REF || TREE_CODE (lhs) != SSA_NAME)
+ if (lhs_acc.t_code == MEM_REF || TREE_CODE (lhs) != SSA_NAME)
{
int l = current_indirect_level;
@@ -1369,8 +1354,8 @@ analyze_matrix_accesses (struct matrix_info *mi, tree ssa_var,
return;
/* Now go over the uses of the SSA_NAME and check how it is used in
- each one of them. We are mainly looking for the pattern INDIRECT_REF,
- then a POINTER_PLUS_EXPR, then INDIRECT_REF etc. while in between there could
+ each one of them. We are mainly looking for the pattern MEM_REF,
+ then a POINTER_PLUS_EXPR, then MEM_REF etc. while in between there could
be any number of copies and casts. */
gcc_assert (TREE_CODE (ssa_var) == SSA_NAME);
@@ -1856,7 +1841,7 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
gimple new_stmt;
gcc_assert (gimple_assign_rhs_code (acc_info->stmt)
- == INDIRECT_REF);
+ == MEM_REF);
/* Emit convert statement to convert to type of use. */
tmp = create_tmp_var (TREE_TYPE (lhs), "new");
add_referenced_var (tmp);
@@ -1878,10 +1863,10 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
continue;
}
code = gimple_assign_rhs_code (acc_info->stmt);
- if (code == INDIRECT_REF
+ if (code == MEM_REF
&& acc_info->level < min_escape_l - 1)
{
- /* Replace the INDIRECT_REF with NOP (cast) usually we are casting
+ /* Replace the MEM_REF with NOP (cast) usually we are casting
from "pointer to type" to "type". */
tree t =
build1 (NOP_EXPR, TREE_TYPE (gimple_assign_rhs1 (acc_info->stmt)),
@@ -2206,7 +2191,6 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
for (i = 1; i < mi->min_indirect_level_escape; i++)
{
gimple_stmt_iterator gsi;
- gimple use_stmt1 = NULL;
gimple call_stmt = mi->malloc_for_level[i];
gcc_assert (is_gimple_call (call_stmt));
@@ -2216,17 +2200,9 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
gsi = gsi_for_stmt (call_stmt);
/* Remove the call stmt. */
gsi_remove (&gsi, true);
- /* remove the type cast stmt. */
- FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter,
- gimple_call_lhs (call_stmt))
- {
- use_stmt1 = use_stmt;
- gsi = gsi_for_stmt (use_stmt);
- gsi_remove (&gsi, true);
- }
/* Remove the assignment of the allocated area. */
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter,
- gimple_get_lhs (use_stmt1))
+ gimple_call_lhs (call_stmt))
{
gsi = gsi_for_stmt (use_stmt);
gsi_remove (&gsi, true);
diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
index 9647ad7ec16..cfa5a56467e 100644
--- a/gcc/mkconfig.sh
+++ b/gcc/mkconfig.sh
@@ -63,6 +63,10 @@ done
# The first entry in HEADERS may be auto-FOO.h ;
# it wants to be included even when not -DIN_GCC.
+# Postpone including defaults.h until after the insn-*
+# headers, so that the HAVE_* flags are available
+# when defaults.h gets included.
+postpone_defaults_h="no"
if [ -n "$HEADERS" ]; then
set $HEADERS
case "$1" in auto-* )
@@ -73,27 +77,35 @@ if [ -n "$HEADERS" ]; then
if [ $# -ge 1 ]; then
echo '#ifdef IN_GCC' >> ${output}T
for file in "$@"; do
- echo "# include \"$file\"" >> ${output}T
+ if test x"$file" = x"defaults.h"; then
+ postpone_defaults_h="yes"
+ else
+ echo "# include \"$file\"" >> ${output}T
+ fi
done
echo '#endif' >> ${output}T
fi
fi
-# If this is tm.h, now include insn-constants.h and insn-flags.h only
-# if IN_GCC is defined but neither GENERATOR_FILE nor USED_FOR_TARGET
-# is defined. (Much of this is temporary.)
+# If this is tm.h, now include insn-flags.h only if IN_GCC is defined
+# but neither GENERATOR_FILE nor USED_FOR_TARGET is defined. (Much of
+# this is temporary.)
case $output in
tm.h )
cat >> ${output}T <<EOF
#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET
-# include "insn-constants.h"
# include "insn-flags.h"
#endif
EOF
;;
esac
+# If we postponed including defaults.h, add the #include now.
+if test x"$postpone_defaults_h" = x"yes"; then
+ echo "# include \"defaults.h\"" >> ${output}T
+fi
+
# Add multiple inclusion protection guard, part two.
echo "#endif /* ${header_guard} */" >> ${output}T
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 1a4241cc8ab..099bc6595ac 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,26 @@
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * objc-act.c: Do not include except.h.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
+ allocation.
+
+ * objc-act.c (objc_volatilize_decl): Likewise.
+ (objc_build_string_object): Likewise.
+ (hash_init): Likewise.
+ (hash_enter): Likewise.
+ (hash_add_attr): Likewise.
+ (add_class): Likewise.
+ (start_class): Likewise.
+
+2010-06-05 Steven Bosscher <steven@gcc.gnu.org>
+
+ * objc-act.c: Update include path for moved files.
+ * objc-lang.c: Likewise.
+ * config-lang.in: Update paths in gtfiles for files in c-family/.
+
2010-06-01 Nathan Froyd <froydnj@codesourcery.com>
* objc-act.c (build_next_objc_exception_stuff): Give setjmp a
diff --git a/gcc/objc/config-lang.in b/gcc/objc/config-lang.in
index 760b87a1923..1a02b7fe7b1 100644
--- a/gcc/objc/config-lang.in
+++ b/gcc/objc/config-lang.in
@@ -33,4 +33,4 @@ target_libs=target-libobjc
# Most of the object files for cc1obj actually come from C.
lang_requires="c"
-gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/c-parser.c \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-objc-common.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.h \$(srcdir)/c-pragma.c \$(srcdir)/objc/objc-act.c"
+gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/c-parser.c \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-objc-common.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/objc/objc-act.c"
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 37289a28d2b..45b10207629 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -53,13 +53,12 @@ along with GCC; see the file COPYING3. If not see
#include "c-lang.h"
#endif
-#include "c-common.h"
-#include "c-pragma.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
#include "flags.h"
#include "langhooks.h"
#include "objc-act.h"
#include "input.h"
-#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
#include "function.h"
#include "output.h"
#include "toplev.h"
@@ -976,7 +975,7 @@ objc_volatilize_decl (tree decl)
if (!*loc)
{
- *loc = ggc_alloc (sizeof (key));
+ *loc = ggc_alloc_volatilized_type ();
((struct volatilized_type *) *loc)->type = t;
}
@@ -1986,7 +1985,7 @@ objc_build_string_object (tree string)
{
tree var;
VEC(constructor_elt,gc) *v = NULL;
- *loc = desc = GGC_NEW (struct string_descriptor);
+ *loc = desc = ggc_alloc_string_descriptor ();
desc->literal = string;
/* GNU: (NXConstantString *) & ((__builtin_ObjCString) { NULL, string, length }) */
@@ -6843,10 +6842,8 @@ hash_func (tree sel_name)
static void
hash_init (void)
{
- nst_method_hash_list
- = (hash *) ggc_alloc_cleared (SIZEHASHTABLE * sizeof (hash));
- cls_method_hash_list
- = (hash *) ggc_alloc_cleared (SIZEHASHTABLE * sizeof (hash));
+ nst_method_hash_list = ggc_alloc_cleared_vec_hash (SIZEHASHTABLE);
+ cls_method_hash_list = ggc_alloc_cleared_vec_hash (SIZEHASHTABLE);
/* Initialize the hash table used to hold the constant string objects. */
string_htab = htab_create_ggc (31, string_hash,
@@ -6868,7 +6865,7 @@ hash_enter (hash *hashlist, tree method)
hash obj;
int slot = hash_func (METHOD_SEL_NAME (method)) % SIZEHASHTABLE;
- obj = (hash) ggc_alloc (sizeof (struct hashed_entry));
+ obj = ggc_alloc_hashed_entry ();
obj->list = 0;
obj->next = hashlist[slot];
obj->key = method;
@@ -6898,7 +6895,7 @@ hash_add_attr (hash entry, tree value)
{
attr obj;
- obj = (attr) ggc_alloc (sizeof (struct hashed_attribute));
+ obj = ggc_alloc_hashed_attribute ();
obj->next = entry->list;
obj->value = value;
@@ -7096,7 +7093,7 @@ add_class (tree class_name, tree name)
INSERT);
if (!*slot)
{
- *slot = (struct interface_tuple *) ggc_alloc_cleared (sizeof (struct interface_tuple));
+ *slot = ggc_alloc_cleared_interface_tuple ();
(*slot)->id = name;
}
(*slot)->class_name = class_name;
@@ -7735,7 +7732,7 @@ continue_class (tree klass)
uprivate_record = CLASS_STATIC_TEMPLATE (implementation_template);
objc_instance_type = build_pointer_type (uprivate_record);
- imp_entry = (struct imp_entry *) ggc_alloc (sizeof (struct imp_entry));
+ imp_entry = ggc_alloc_imp_entry ();
imp_entry->next = imp_list;
imp_entry->imp_context = klass;
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index d8bf0f62f93..c8edd64bcf2 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -81,7 +81,8 @@ tree objc_eh_personality (void);
#define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type)
#define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \
do { \
- TYPE_LANG_SPECIFIC (NODE) = GGC_CNEW (struct lang_type); \
+ TYPE_LANG_SPECIFIC (NODE) \
+ = ggc_alloc_cleared_lang_type (sizeof (struct lang_type)); \
} while (0)
#define TYPE_HAS_OBJC_INFO(TYPE) \
diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c
index 04cea974f45..fa7496475fb 100644
--- a/gcc/objc/objc-lang.c
+++ b/gcc/objc/objc-lang.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "c-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "ggc.h"
#include "objc-act.h"
#include "langhooks.h"
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index 8623bb59104..109d2327ed6 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,22 @@
+2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
+
+ * objcp-lang.c: Do not include except.h.
+ * Make-lang.in: Update dependencies.
+
+2010-06-25 Joseph Myers <joseph@codesourcery.com>
+
+ * lang-specs.h: Remove +e handling.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
+ allocation.
+
+2010-06-05 Steven Bosscher <steven@gcc.gnu.org>
+
+ * objcp-lang.c: Update include path for moved files.
+ * config-lang.in: Update paths in gtfiles for files in c-family/.
+
2010-05-25 Steven Bosscher <steven@gcc.gnu.org>
* objcp-decl.c: Do not include tm.h, rtl.h, expr.h, c-common.h,
diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in
index 873b9080ebf..22dc30f366e 100644
--- a/gcc/objcp/Make-lang.in
+++ b/gcc/objcp/Make-lang.in
@@ -73,7 +73,7 @@ cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBDEPS)
objcp/objcp-lang.o : objcp/objcp-lang.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
$(C_COMMON_H) $(LANGHOOKS_DEF_H) objc/objc-act.h cp/cp-objcp-common.h \
- gtype-objcp.h $(EXCEPT_H)
+ gtype-objcp.h
objcp/objcp-decl.o : objcp/objcp-decl.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in
index 3d9232e4b91..febcb635da7 100644
--- a/gcc/objcp/config-lang.in
+++ b/gcc/objcp/config-lang.in
@@ -37,4 +37,4 @@ build_by_default="no"
lang_requires="objc c++"
subdir_requires="objc cp"
-gtfiles="\$(srcdir)/objcp/objcp-decl.c \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-act.h \$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.h \$(srcdir)/c-pragma.c \$(srcdir)/cp/cp-objcp-common.c"
+gtfiles="\$(srcdir)/objcp/objcp-decl.c \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-act.h \$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/cp-objcp-common.c"
diff --git a/gcc/objcp/lang-specs.h b/gcc/objcp/lang-specs.h
index ec8cfee42a4..1644e5a3047 100644
--- a/gcc/objcp/lang-specs.h
+++ b/gcc/objcp/lang-specs.h
@@ -1,5 +1,5 @@
/* Definitions for specs for Objective-C++.
- Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2010 Free Software Foundation, Inc.
Contributed by Ziemowit Laski <zlaski@apple.com>
This file is part of GCC.
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see
%(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\
cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\
%{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2 %{+e1*}\
+ %(cc1_options) %2\
-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@objective-c++",
@@ -46,15 +46,15 @@ along with GCC; see the file COPYING3. If not see
%(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\
cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\
%{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2 %{+e1*}\
+ %(cc1_options) %2\
%{!fsyntax-only:%(invoke_as)}}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{".mii", "@objective-c++-cpp-output", 0, 0, 0},
{"@objective-c++-cpp-output",
"%{!M:%{!MM:%{!E:\
- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
+ cc1objplus -fpreprocessed %i %(cc1_options) %2\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
{"@objc++-cpp-output",
"%{!M:%{!MM:%{!E:\
- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
+ cc1objplus -fpreprocessed %i %(cc1_options) %2\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/gcc/objcp/objcp-decl.h b/gcc/objcp/objcp-decl.h
index 50d98287662..1f9f36c6a3f 100644
--- a/gcc/objcp/objcp-decl.h
+++ b/gcc/objcp/objcp-decl.h
@@ -73,8 +73,8 @@ extern tree objcp_end_compound_stmt (tree, int);
#undef ALLOC_OBJC_TYPE_LANG_SPECIFIC
#define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \
do { \
- TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \
- (struct lang_type, sizeof (struct lang_type_class)); \
+ TYPE_LANG_SPECIFIC (NODE) = ggc_alloc_cleared_lang_type \
+ (sizeof (struct lang_type_class)); \
TYPE_LANG_SPECIFIC (NODE)->u.c.h.is_lang_type_class = 1; \
} while (0)
diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c
index 4708229f261..70a605bb87e 100644
--- a/gcc/objcp/objcp-lang.c
+++ b/gcc/objcp/objcp-lang.c
@@ -25,12 +25,11 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
-#include "c-common.h"
+#include "c-family/c-common.h"
#include "objc-act.h"
#include "langhooks.h"
#include "langhooks-def.h"
#include "cp-objcp-common.h"
-#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
enum c_language_kind c_language = clk_objcxx;
static void objcxx_init_ts (void);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 3a93cdeb798..68bc84a881c 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -864,10 +864,10 @@ build_receiver_ref (tree var, bool by_ref, omp_context *ctx)
if (x != NULL)
field = x;
- x = build_fold_indirect_ref (ctx->receiver_decl);
+ x = build_simple_mem_ref (ctx->receiver_decl);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL);
if (by_ref)
- x = build_fold_indirect_ref (x);
+ x = build_simple_mem_ref (x);
return x;
}
@@ -887,7 +887,7 @@ build_outer_var_ref (tree var, omp_context *ctx)
{
x = TREE_OPERAND (DECL_VALUE_EXPR (var), 0);
x = build_outer_var_ref (x, ctx);
- x = build_fold_indirect_ref (x);
+ x = build_simple_mem_ref (x);
}
else if (is_taskreg_ctx (ctx))
{
@@ -904,7 +904,7 @@ build_outer_var_ref (tree var, omp_context *ctx)
gcc_unreachable ();
if (is_reference (var))
- x = build_fold_indirect_ref (x);
+ x = build_simple_mem_ref (x);
return x;
}
@@ -1916,7 +1916,18 @@ scan_omp_1_op (tree *tp, int *walk_subtrees, void *data)
{
*walk_subtrees = 1;
if (ctx)
- TREE_TYPE (t) = remap_type (TREE_TYPE (t), &ctx->cb);
+ {
+ tree tem = remap_type (TREE_TYPE (t), &ctx->cb);
+ if (tem != TREE_TYPE (t))
+ {
+ if (TREE_CODE (t) == INTEGER_CST)
+ *tp = build_int_cst_wide (tem,
+ TREE_INT_CST_LOW (t),
+ TREE_INT_CST_HIGH (t));
+ else
+ TREE_TYPE (t) = tem;
+ }
+ }
}
break;
}
@@ -2337,7 +2348,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
x = fold_convert_loc (clause_loc, TREE_TYPE (new_var), x);
gimplify_assign (new_var, x, ilist);
- new_var = build_fold_indirect_ref_loc (clause_loc, new_var);
+ new_var = build_simple_mem_ref_loc (clause_loc, new_var);
}
else if (c_kind == OMP_CLAUSE_REDUCTION
&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
@@ -2555,7 +2566,7 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list,
x = build_outer_var_ref (var, ctx);
if (is_reference (var))
- new_var = build_fold_indirect_ref_loc (clause_loc, new_var);
+ new_var = build_simple_mem_ref_loc (clause_loc, new_var);
x = lang_hooks.decls.omp_clause_assign_op (c, x, new_var);
gimplify_and_add (x, stmt_list);
}
@@ -2622,7 +2633,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
var = OMP_CLAUSE_DECL (c);
new_var = lookup_decl (var, ctx);
if (is_reference (var))
- new_var = build_fold_indirect_ref_loc (clause_loc, new_var);
+ new_var = build_simple_mem_ref_loc (clause_loc, new_var);
ref = build_outer_var_ref (var, ctx);
code = OMP_CLAUSE_REDUCTION_CODE (c);
@@ -2714,8 +2725,8 @@ lower_copyprivate_clauses (tree clauses, gimple_seq *slist, gimple_seq *rlist,
if (is_reference (var))
{
ref = fold_convert_loc (clause_loc, TREE_TYPE (new_var), ref);
- ref = build_fold_indirect_ref_loc (clause_loc, ref);
- new_var = build_fold_indirect_ref_loc (clause_loc, new_var);
+ ref = build_simple_mem_ref_loc (clause_loc, ref);
+ new_var = build_simple_mem_ref_loc (clause_loc, new_var);
}
x = lang_hooks.decls.omp_clause_assign_op (c, new_var, ref);
gimplify_and_add (x, rlist);
@@ -3112,8 +3123,8 @@ maybe_catch_exception (gimple_seq body)
if (!flag_exceptions)
return body;
- if (lang_protect_cleanup_actions)
- decl = lang_protect_cleanup_actions ();
+ if (lang_hooks.eh_protect_cleanup_actions != NULL)
+ decl = lang_hooks.eh_protect_cleanup_actions ();
else
decl = built_in_decls[BUILT_IN_TRAP];
@@ -5067,8 +5078,12 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
loadedi = loaded_val;
}
- initial = force_gimple_operand_gsi (&si, build_fold_indirect_ref (iaddr),
- true, NULL_TREE, true, GSI_SAME_STMT);
+ initial
+ = force_gimple_operand_gsi (&si,
+ build2 (MEM_REF, TREE_TYPE (TREE_TYPE (iaddr)),
+ iaddr,
+ build_int_cst (TREE_TYPE (iaddr), 0)),
+ true, NULL_TREE, true, GSI_SAME_STMT);
/* Move the value to the LOADEDI temporary. */
if (gimple_in_ssa_p (cfun))
@@ -5212,15 +5227,15 @@ expand_omp_atomic_mutex (basic_block load_bb, basic_block store_bb,
t = build_function_call_expr (UNKNOWN_LOCATION, t, 0);
force_gimple_operand_gsi (&si, t, true, NULL_TREE, true, GSI_SAME_STMT);
- stmt = gimple_build_assign (loaded_val, build_fold_indirect_ref (addr));
+ stmt = gimple_build_assign (loaded_val, build_simple_mem_ref (addr));
gsi_insert_before (&si, stmt, GSI_SAME_STMT);
gsi_remove (&si, true);
si = gsi_last_bb (store_bb);
gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_STORE);
- stmt = gimple_build_assign (build_fold_indirect_ref (unshare_expr (addr)),
- stored_val);
+ stmt = gimple_build_assign (build_simple_mem_ref (unshare_expr (addr)),
+ stored_val);
gsi_insert_before (&si, stmt, GSI_SAME_STMT);
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
@@ -5887,7 +5902,9 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (!critical_name_mutexes)
critical_name_mutexes
- = splay_tree_new_ggc (splay_tree_compare_pointers);
+ = splay_tree_new_ggc (splay_tree_compare_pointers,
+ ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_s,
+ ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_node_s);
n = splay_tree_lookup (critical_name_mutexes, (splay_tree_key) name);
if (n == NULL)
@@ -6267,7 +6284,7 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
n = splay_tree_lookup (ctx->sfield_map, (splay_tree_key) decl);
sf = (tree) n->value;
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
- src = build_fold_indirect_ref_loc (loc, sarg);
+ src = build_simple_mem_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (*p), *p, src);
append_to_statement_list (t, &list);
@@ -6290,9 +6307,9 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
sf = (tree) n->value;
if (tcctx.cb.decl_map)
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
- src = build_fold_indirect_ref_loc (loc, sarg);
+ src = build_simple_mem_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
- dst = build_fold_indirect_ref_loc (loc, arg);
+ dst = build_simple_mem_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
append_to_statement_list (t, &list);
@@ -6313,14 +6330,14 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
sf = (tree) n->value;
if (tcctx.cb.decl_map)
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
- src = build_fold_indirect_ref_loc (loc, sarg);
+ src = build_simple_mem_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
if (use_pointer_for_field (decl, NULL) || is_reference (decl))
- src = build_fold_indirect_ref_loc (loc, src);
+ src = build_simple_mem_ref_loc (loc, src);
}
else
src = decl;
- dst = build_fold_indirect_ref_loc (loc, arg);
+ dst = build_simple_mem_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src);
append_to_statement_list (t, &list);
@@ -6339,14 +6356,14 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
sf = (tree) n->value;
if (tcctx.cb.decl_map)
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
- src = build_fold_indirect_ref_loc (loc, sarg);
+ src = build_simple_mem_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
if (use_pointer_for_field (decl, NULL))
- src = build_fold_indirect_ref_loc (loc, src);
+ src = build_simple_mem_ref_loc (loc, src);
}
else
src = decl;
- dst = build_fold_indirect_ref_loc (loc, arg);
+ dst = build_simple_mem_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
append_to_statement_list (t, &list);
@@ -6378,10 +6395,10 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
(splay_tree_key) TREE_OPERAND (ind, 0));
sf = (tree) n->value;
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
- src = build_fold_indirect_ref_loc (loc, sarg);
+ src = build_simple_mem_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
- src = build_fold_indirect_ref_loc (loc, src);
- dst = build_fold_indirect_ref_loc (loc, arg);
+ src = build_simple_mem_ref_loc (loc, src);
+ dst = build_simple_mem_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src);
append_to_statement_list (t, &list);
@@ -6389,7 +6406,7 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
(splay_tree_key) TREE_OPERAND (ind, 0));
df = (tree) n->value;
df = *(tree *) pointer_map_contains (tcctx.cb.decl_map, df);
- ptr = build_fold_indirect_ref_loc (loc, arg);
+ ptr = build_simple_mem_ref_loc (loc, arg);
ptr = build3 (COMPONENT_REF, TREE_TYPE (df), ptr, df, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (ptr), ptr,
build_fold_addr_expr_loc (loc, dst));
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 52b4cb9fa85..38de4916c10 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -407,6 +407,20 @@ optab_for_tree_code (enum tree_code code, const_tree type,
case DOT_PROD_EXPR:
return TYPE_UNSIGNED (type) ? udot_prod_optab : sdot_prod_optab;
+ case WIDEN_MULT_PLUS_EXPR:
+ return (TYPE_UNSIGNED (type)
+ ? (TYPE_SATURATING (type)
+ ? usmadd_widen_optab : umadd_widen_optab)
+ : (TYPE_SATURATING (type)
+ ? ssmadd_widen_optab : smadd_widen_optab));
+
+ case WIDEN_MULT_MINUS_EXPR:
+ return (TYPE_UNSIGNED (type)
+ ? (TYPE_SATURATING (type)
+ ? usmsub_widen_optab : umsub_widen_optab)
+ : (TYPE_SATURATING (type)
+ ? ssmsub_widen_optab : smsub_widen_optab));
+
case REDUC_MAX_EXPR:
return TYPE_UNSIGNED (type) ? reduc_umax_optab : reduc_smax_optab;
@@ -546,7 +560,12 @@ expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op,
tmode0 = TYPE_MODE (TREE_TYPE (oprnd0));
widen_pattern_optab =
optab_for_tree_code (ops->code, TREE_TYPE (oprnd0), optab_default);
- icode = (int) optab_handler (widen_pattern_optab, tmode0)->insn_code;
+ if (ops->code == WIDEN_MULT_PLUS_EXPR
+ || ops->code == WIDEN_MULT_MINUS_EXPR)
+ icode = (int) optab_handler (widen_pattern_optab,
+ TYPE_MODE (TREE_TYPE (ops->op2)))->insn_code;
+ else
+ icode = (int) optab_handler (widen_pattern_optab, tmode0)->insn_code;
gcc_assert (icode != CODE_FOR_nothing);
xmode0 = insn_data[icode].operand[1].mode;
@@ -6083,7 +6102,7 @@ init_one_libfunc (const char *name)
/* See if we have already created a libfunc decl for this function. */
id = get_identifier (name);
- hash = htab_hash_string (name);
+ hash = IDENTIFIER_HASH_VALUE (id);
slot = htab_find_slot_with_hash (libfunc_decls, id, hash, INSERT);
decl = (tree) *slot;
if (decl == NULL)
@@ -6106,7 +6125,7 @@ set_user_assembler_libfunc (const char *name, const char *asmspec)
hashval_t hash;
id = get_identifier (name);
- hash = htab_hash_string (name);
+ hash = IDENTIFIER_HASH_VALUE (id);
slot = htab_find_slot_with_hash (libfunc_decls, id, hash, NO_INSERT);
gcc_assert (slot);
decl = (tree) *slot;
@@ -6132,7 +6151,7 @@ set_optab_libfunc (optab optable, enum machine_mode mode, const char *name)
val = 0;
slot = (struct libfunc_entry **) htab_find_slot (libfunc_hash, &e, INSERT);
if (*slot == NULL)
- *slot = GGC_NEW (struct libfunc_entry);
+ *slot = ggc_alloc_libfunc_entry ();
(*slot)->optab = (size_t) (optable - &optab_table[0]);
(*slot)->mode1 = mode;
(*slot)->mode2 = VOIDmode;
@@ -6159,7 +6178,7 @@ set_conv_libfunc (convert_optab optable, enum machine_mode tmode,
val = 0;
slot = (struct libfunc_entry **) htab_find_slot (libfunc_hash, &e, INSERT);
if (*slot == NULL)
- *slot = GGC_NEW (struct libfunc_entry);
+ *slot = ggc_alloc_libfunc_entry ();
(*slot)->optab = (size_t) (optable - &convert_optab_table[0]);
(*slot)->mode1 = tmode;
(*slot)->mode2 = fmode;
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index cf2ef9683c8..19af0ef0f0c 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -358,7 +358,10 @@ for (i = 0; i < n_opts; i++) {
print " " enum "," s "/* -" opts[i] " */"
}
-print " N_OPTS"
+print " N_OPTS,"
+print " OPT_SPECIAL_unknown,"
+print " OPT_SPECIAL_program_name,"
+print " OPT_SPECIAL_input_file"
print "};"
print ""
print "#endif /* OPTIONS_H */"
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index b70b823db16..cde8ccfe29b 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1,5 +1,5 @@
/* Command line option handling.
- Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -22,10 +22,11 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "coretypes.h"
#include "opts.h"
+#include "options.h"
/* Perform a binary search to find which option the command-line INPUT
- matches. Returns its index in the option array, and N_OPTS
- (cl_options_count) on failure.
+ matches. Returns its index in the option array, and
+ OPT_SPECIAL_unknown on failure.
This routine is quite subtle. A normal binary search is not good
enough because some options can be suffixed with an argument, and
@@ -72,8 +73,8 @@ find_opt (const char *input, int lang_mask)
}
/* This is the switch that is the best match but for a different
- front end, or cl_options_count if there is no match at all. */
- match_wrong_lang = cl_options_count;
+ front end, or OPT_SPECIAL_unknown if there is no match at all. */
+ match_wrong_lang = OPT_SPECIAL_unknown;
/* Backtrace the chain of possible matches, returning the longest
one, if any, that fits best. With current GCC switches, this
@@ -93,7 +94,7 @@ find_opt (const char *input, int lang_mask)
/* If we haven't remembered a prior match, remember this
one. Any prior match is necessarily better. */
- if (match_wrong_lang == cl_options_count)
+ if (match_wrong_lang == OPT_SPECIAL_unknown)
match_wrong_lang = mn;
}
@@ -103,10 +104,213 @@ find_opt (const char *input, int lang_mask)
}
while (mn != cl_options_count);
- /* Return the best wrong match, or cl_options_count if none. */
+ /* Return the best wrong match, or OPT_SPECIAL_unknown if none. */
return match_wrong_lang;
}
+/* If ARG is a non-negative integer made up solely of digits, return its
+ value, otherwise return -1. */
+
+int
+integral_argument (const char *arg)
+{
+ const char *p = arg;
+
+ while (*p && ISDIGIT (*p))
+ p++;
+
+ if (*p == '\0')
+ return atoi (arg);
+
+ return -1;
+}
+
+/* Decode the switch beginning at ARGV for the language indicated by
+ LANG_MASK, into the structure *DECODED. Returns the number of
+ switches consumed. */
+
+static unsigned int
+decode_cmdline_option (const char **argv, unsigned int lang_mask,
+ struct cl_decoded_option *decoded)
+{
+ size_t opt_index;
+ const char *opt, *arg = 0;
+ char *dup = 0;
+ int value = 1;
+ unsigned int result = 1;
+ const struct cl_option *option;
+ int errors = 0;
+
+ opt = argv[0];
+
+ opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
+ if (opt_index == OPT_SPECIAL_unknown
+ && (opt[1] == 'W' || opt[1] == 'f' || opt[1] == 'm')
+ && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-')
+ {
+ /* Drop the "no-" from negative switches. */
+ size_t len = strlen (opt) - 3;
+
+ dup = XNEWVEC (char, len + 1);
+ dup[0] = '-';
+ dup[1] = opt[1];
+ memcpy (dup + 2, opt + 5, len - 2 + 1);
+ opt = dup;
+ value = 0;
+ opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
+ }
+
+ if (opt_index == OPT_SPECIAL_unknown)
+ {
+ arg = argv[0];
+ goto done;
+ }
+
+ option = &cl_options[opt_index];
+
+ /* Reject negative form of switches that don't take negatives as
+ unrecognized. */
+ if (!value && (option->flags & CL_REJECT_NEGATIVE))
+ {
+ opt_index = OPT_SPECIAL_unknown;
+ arg = argv[0];
+ goto done;
+ }
+
+ /* Check to see if the option is disabled for this configuration. */
+ if (option->flags & CL_DISABLED)
+ errors |= CL_ERR_DISABLED;
+
+ /* Sort out any argument the switch takes. */
+ if (option->flags & CL_JOINED)
+ {
+ /* Have arg point to the original switch. This is because
+ some code, such as disable_builtin_function, expects its
+ argument to be persistent until the program exits. */
+ arg = argv[0] + cl_options[opt_index].opt_len + 1;
+ if (!value)
+ arg += strlen ("no-");
+
+ if (*arg == '\0' && !(option->flags & CL_MISSING_OK))
+ {
+ if (option->flags & CL_SEPARATE)
+ {
+ arg = argv[1];
+ result = 2;
+ if (arg == NULL)
+ result = 1;
+ }
+ else
+ /* Missing argument. */
+ arg = NULL;
+ }
+ }
+ else if (option->flags & CL_SEPARATE)
+ {
+ arg = argv[1];
+ result = 2;
+ if (arg == NULL)
+ result = 1;
+ }
+
+ /* Check if this is a switch for a different front end. */
+ if (!(option->flags & (lang_mask | CL_COMMON | CL_TARGET)))
+ errors |= CL_ERR_WRONG_LANG;
+ else if ((option->flags & CL_TARGET)
+ && (option->flags & CL_LANG_ALL)
+ && !(option->flags & lang_mask))
+ /* Complain for target flag language mismatches if any languages
+ are specified. */
+ errors |= CL_ERR_WRONG_LANG;
+
+ if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
+ errors |= CL_ERR_MISSING_ARG;
+
+ /* If the switch takes an integer, convert it. */
+ if (arg && (option->flags & CL_UINTEGER))
+ {
+ value = integral_argument (arg);
+ if (value == -1)
+ errors |= CL_ERR_UINT_ARG;
+ }
+
+ done:
+ if (dup)
+ free (dup);
+ decoded->opt_index = opt_index;
+ decoded->arg = arg;
+ decoded->value = value;
+ decoded->errors = errors;
+ switch (result)
+ {
+ case 1:
+ decoded->orig_option_with_args_text = argv[0];
+ break;
+ case 2:
+ decoded->orig_option_with_args_text = concat (argv[0], " ",
+ argv[1], NULL);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ return result;
+}
+
+/* Decode command-line options (ARGC and ARGV being the arguments of
+ main) into an array, setting *DECODED_OPTIONS to a pointer to that
+ array and *DECODED_OPTIONS_COUNT to the number of entries in the
+ array. The first entry in the array is always one for the program
+ name (OPT_SPECIAL_program_name). LANG_MASK indicates the language
+ applicable for decoding. Do not produce any diagnostics or set
+ state outside of these variables. */
+
+void
+decode_cmdline_options_to_array (unsigned int argc, const char **argv,
+ unsigned int lang_mask,
+ struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count)
+{
+ unsigned int n, i;
+ struct cl_decoded_option *opt_array;
+ unsigned int num_decoded_options;
+
+ opt_array = XNEWVEC (struct cl_decoded_option, argc);
+
+ opt_array[0].opt_index = OPT_SPECIAL_program_name;
+ opt_array[0].arg = argv[0];
+ opt_array[0].orig_option_with_args_text = argv[0];
+ opt_array[0].value = 1;
+ opt_array[0].errors = 0;
+ num_decoded_options = 1;
+
+ for (i = 1; i < argc; i += n)
+ {
+ const char *opt = argv[i];
+
+ /* Interpret "-" or a non-switch as a file name. */
+ if (opt[0] != '-' || opt[1] == '\0')
+ {
+ opt_array[num_decoded_options].opt_index = OPT_SPECIAL_input_file;
+ opt_array[num_decoded_options].arg = opt;
+ opt_array[num_decoded_options].orig_option_with_args_text = opt;
+ opt_array[num_decoded_options].value = 1;
+ opt_array[num_decoded_options].errors = 0;
+ num_decoded_options++;
+ n = 1;
+ continue;
+ }
+
+ n = decode_cmdline_option (argv + i, lang_mask,
+ &opt_array[num_decoded_options]);
+ num_decoded_options++;
+ }
+
+ opt_array = XRESIZEVEC (struct cl_decoded_option, opt_array,
+ num_decoded_options);
+ *decoded_options = opt_array;
+ *decoded_options_count = num_decoded_options;
+}
+
/* Return true if NEXT_OPT_IDX cancels OPT_IDX. Return false if the
next one is the same as ORIG_NEXT_OPT_IDX. */
@@ -132,6 +336,10 @@ prune_options (int *argcp, char ***argvp)
{
int argc = *argcp;
int *options = XNEWVEC (int, argc);
+ /* We will only return this replacement argv if we remove at least
+ one argument, so it does not need to be size (argc + 1) to
+ make room for the terminating NULL because we will always have
+ freed up at least one slot when we end up using it at all. */
char **argv = XNEWVEC (char *, argc);
int i, arg_count, need_prune = 0;
const struct cl_option *option;
@@ -144,7 +352,7 @@ prune_options (int *argcp, char ***argvp)
const char *opt = (*argvp) [i];
opt_index = find_opt (opt + 1, -1);
- if (opt_index == cl_options_count
+ if (opt_index == OPT_SPECIAL_unknown
&& (opt[1] == 'W' || opt[1] == 'f' || opt[1] == 'm')
&& opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-')
{
@@ -163,7 +371,7 @@ prune_options (int *argcp, char ***argvp)
free (dup);
}
- if (opt_index == cl_options_count)
+ if (opt_index == OPT_SPECIAL_unknown)
{
cont:
options [i] = 0;
@@ -225,6 +433,9 @@ keep:
{
*argcp = arg_count;
*argvp = argv;
+ /* Add NULL-termination. Guaranteed not to overflow because
+ arg_count here can only be less than argc. */
+ argv[arg_count] = 0;
}
else
{
diff --git a/gcc/opts.c b/gcc/opts.c
index 8699ec33703..07d7a23ae38 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -381,22 +381,6 @@ static void complain_wrong_lang (const char *, const struct cl_option *,
static void set_debug_level (enum debug_info_type type, int extended,
const char *arg);
-/* If ARG is a non-negative integer made up solely of digits, return its
- value, otherwise return -1. */
-static int
-integral_argument (const char *arg)
-{
- const char *p = arg;
-
- while (*p && ISDIGIT (*p))
- p++;
-
- if (*p == '\0')
- return atoi (arg);
-
- return -1;
-}
-
/* Return a malloced slash-separated list of languages in MASK. */
static char *
write_langs (unsigned int mask)
@@ -531,137 +515,63 @@ handle_option (int opt_index, int value, const char *arg,
return true;
}
-/* Handle the switch beginning at ARGV for the language indicated by
- LANG_MASK. Returns the number of switches consumed. */
-static unsigned int
-read_cmdline_option (const char **argv, unsigned int lang_mask)
+/* Handle the switch DECODED for the language indicated by
+ LANG_MASK. */
+static void
+read_cmdline_option (struct cl_decoded_option *decoded,
+ unsigned int lang_mask)
{
- size_t opt_index;
- const char *opt, *arg = 0;
- char *dup = 0;
- int value = 1;
- unsigned int result = 0;
const struct cl_option *option;
+ const char *opt;
- opt = argv[0];
-
- opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
- if (opt_index == cl_options_count
- && (opt[1] == 'W' || opt[1] == 'f' || opt[1] == 'm')
- && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-')
+ if (decoded->opt_index == OPT_SPECIAL_unknown)
{
- /* Drop the "no-" from negative switches. */
- size_t len = strlen (opt) - 3;
-
- dup = XNEWVEC (char, len + 1);
- dup[0] = '-';
- dup[1] = opt[1];
- memcpy (dup + 2, opt + 5, len - 2 + 1);
- opt = dup;
- value = 0;
- opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
- if (opt_index == cl_options_count && opt[1] == 'W')
- {
- /* We don't generate warnings for unknown -Wno-* options
- unless we issue diagnostics. */
- postpone_unknown_option_warning (argv[0]);
- result = 1;
- goto done;
- }
- }
-
- if (opt_index == cl_options_count)
- goto done;
+ opt = decoded->arg;
- option = &cl_options[opt_index];
-
- /* Reject negative form of switches that don't take negatives as
- unrecognized. */
- if (!value && (option->flags & CL_REJECT_NEGATIVE))
- goto done;
+ if (opt[1] == 'W' && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-')
+ /* We don't generate warnings for unknown -Wno-* options
+ unless we issue diagnostics. */
+ postpone_unknown_option_warning (opt);
+ else
+ error ("unrecognized command line option %qs", opt);
+ return;
+ }
- /* We've recognized this switch. */
- result = 1;
+ option = &cl_options[decoded->opt_index];
+ opt = decoded->orig_option_with_args_text;
- /* Check to see if the option is disabled for this configuration. */
- if (option->flags & CL_DISABLED)
+ if (decoded->errors & CL_ERR_DISABLED)
{
error ("command line option %qs"
" is not supported by this configuration", opt);
- goto done;
- }
-
- /* Sort out any argument the switch takes. */
- if (option->flags & CL_JOINED)
- {
- /* Have arg point to the original switch. This is because
- some code, such as disable_builtin_function, expects its
- argument to be persistent until the program exits. */
- arg = argv[0] + cl_options[opt_index].opt_len + 1;
- if (!value)
- arg += strlen ("no-");
-
- if (*arg == '\0' && !(option->flags & CL_MISSING_OK))
- {
- if (option->flags & CL_SEPARATE)
- {
- arg = argv[1];
- result = 2;
- }
- else
- /* Missing argument. */
- arg = NULL;
- }
- }
- else if (option->flags & CL_SEPARATE)
- {
- arg = argv[1];
- result = 2;
+ return;
}
- /* Now we've swallowed any potential argument, complain if this
- is a switch for a different front end. */
- if (!(option->flags & (lang_mask | CL_COMMON | CL_TARGET)))
+ if (decoded->errors & CL_ERR_WRONG_LANG)
{
- complain_wrong_lang (argv[0], option, lang_mask);
- goto done;
- }
- else if ((option->flags & CL_TARGET)
- && (option->flags & CL_LANG_ALL)
- && !(option->flags & lang_mask))
- {
- /* Complain for target flag language mismatches if any languages
- are specified. */
- complain_wrong_lang (argv[0], option, lang_mask);
- goto done;
+ complain_wrong_lang (opt, option, lang_mask);
+ return;
}
- if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
+ if (decoded->errors & CL_ERR_MISSING_ARG)
{
- if (!lang_hooks.missing_argument (opt, opt_index))
- error ("missing argument to \"%s\"", opt);
- goto done;
+ if (!lang_hooks.missing_argument (opt, decoded->opt_index))
+ error ("missing argument to %qs", opt);
+ return;
}
- /* If the switch takes an integer, convert it. */
- if (arg && (option->flags & CL_UINTEGER))
+ if (decoded->errors & CL_ERR_UINT_ARG)
{
- value = integral_argument (arg);
- if (value == -1)
- {
- error ("argument to \"%s\" should be a non-negative integer",
- option->opt_text);
- goto done;
- }
+ error ("argument to %qs should be a non-negative integer",
+ option->opt_text);
+ return;
}
- if (!handle_option (opt_index, value, arg, lang_mask, DK_UNSPECIFIED))
- result = 0;
+ gcc_assert (!decoded->errors);
- done:
- if (dup)
- free (dup);
- return result;
+ if (!handle_option (decoded->opt_index, decoded->value, decoded->arg,
+ lang_mask, DK_UNSPECIFIED))
+ error ("unrecognized command line option %qs", opt);
}
/* Handle FILENAME from the command line. */
@@ -753,46 +663,41 @@ flag_instrument_functions_exclude_p (tree fndecl)
}
-/* Decode and handle the vector of command line options. LANG_MASK
+/* Handle the vector of command line options. LANG_MASK
contains has a single bit set representing the current
language. */
static void
-read_cmdline_options (unsigned int argc, const char **argv, unsigned int lang_mask)
+read_cmdline_options (struct cl_decoded_option *decoded_options,
+ unsigned int decoded_options_count,
+ unsigned int lang_mask)
{
- unsigned int n, i;
+ unsigned int i;
- for (i = 1; i < argc; i += n)
+ for (i = 1; i < decoded_options_count; i++)
{
- const char *opt = argv[i];
-
- /* Interpret "-" or a non-switch as a file name. */
- if (opt[0] != '-' || opt[1] == '\0')
+ if (decoded_options[i].opt_index == OPT_SPECIAL_input_file)
{
if (main_input_filename == NULL)
{
- main_input_filename = opt;
+ main_input_filename = decoded_options[i].arg;
main_input_baselength
= base_of_path (main_input_filename, &main_input_basename);
}
- add_input_filename (opt);
- n = 1;
+ add_input_filename (decoded_options[i].arg);
continue;
}
- n = read_cmdline_option (argv + i, lang_mask);
-
- if (!n)
- {
- n = 1;
- error ("unrecognized command line option \"%s\"", opt);
- }
+ read_cmdline_option (decoded_options + i, lang_mask);
}
}
/* Parse command line options and set default flag values. Do minimal
- options processing. */
+ options processing. The decoded options are placed in *DECODED_OPTIONS
+ and *DECODED_OPTIONS_COUNT. */
void
-decode_options (unsigned int argc, const char **argv)
+decode_options (unsigned int argc, const char **argv,
+ struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count)
{
static bool first_time_p = true;
static int initial_min_crossjump_insns;
@@ -825,40 +730,30 @@ decode_options (unsigned int argc, const char **argv)
else
lang_mask = initial_lang_mask;
+ decode_cmdline_options_to_array (argc, argv, lang_mask,
+ decoded_options, decoded_options_count);
+
/* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */
- for (i = 1; i < argc; i++)
+ for (i = 1; i < *decoded_options_count; i++)
{
- if (!strcmp (argv[i], "-O"))
- {
- optimize = 1;
- optimize_size = 0;
- ofast = 0;
- }
- else if (argv[i][0] == '-' && argv[i][1] == 'O')
+ struct cl_decoded_option *opt = &(*decoded_options)[i];
+ switch (opt->opt_index)
{
- /* Handle -Os, -O2, -O3, -O69, ... */
- const char *p = &argv[i][2];
-
- if ((p[0] == 's') && (p[1] == 0))
- {
- optimize_size = 1;
-
- /* Optimizing for size forces optimize to be 2. */
- optimize = 2;
- ofast = 0;
- }
- else if (strcmp (p, "fast") == 0)
+ case OPT_O:
+ if (*opt->arg == '\0')
{
- /* -Ofast only adds flags to -O3. */
+ optimize = 1;
optimize_size = 0;
- optimize = 3;
- ofast = 1;
+ ofast = 0;
}
else
{
- const int optimize_val = read_integral_parameter (p, p - 2, -1);
- if (optimize_val != -1)
+ const int optimize_val = integral_argument (opt->arg);
+ if (optimize_val == -1)
+ error ("argument to %qs should be a non-negative integer",
+ "-O");
+ else
{
optimize = optimize_val;
if ((unsigned int) optimize > 255)
@@ -867,6 +762,26 @@ decode_options (unsigned int argc, const char **argv)
ofast = 0;
}
}
+ break;
+
+ case OPT_Os:
+ optimize_size = 1;
+
+ /* Optimizing for size forces optimize to be 2. */
+ optimize = 2;
+ ofast = 0;
+ break;
+
+ case OPT_Ofast:
+ /* -Ofast only adds flags to -O3. */
+ optimize_size = 0;
+ optimize = 3;
+ ofast = 1;
+ break;
+
+ default:
+ /* Ignore other options in this prescan. */
+ break;
}
}
@@ -910,6 +825,7 @@ decode_options (unsigned int argc, const char **argv)
opt2 = (optimize >= 2);
flag_inline_small_functions = opt2;
flag_indirect_inlining = opt2;
+ flag_partial_inlining = opt2;
flag_thread_jumps = opt2;
flag_crossjumping = opt2;
flag_optimize_sibling_calls = opt2;
@@ -1019,7 +935,7 @@ decode_options (unsigned int argc, const char **argv)
OPTIMIZATION_OPTIONS (optimize, optimize_size);
#endif
- read_cmdline_options (argc, argv, lang_mask);
+ read_cmdline_options (*decoded_options, *decoded_options_count, lang_mask);
if (dump_base_name && ! IS_ABSOLUTE_PATH (dump_base_name))
{
@@ -1062,6 +978,11 @@ decode_options (unsigned int argc, const char **argv)
"is disabled.");
flag_toplevel_reorder = 0;
}
+
+ /* -Wmissing-noreturn is alias for -Wsuggest-attribute=noreturn. */
+ if (warn_missing_noreturn)
+ warn_suggest_attribute_noreturn = true;
+
/* Unless the user has asked for section anchors, we disable toplevel
reordering at -O0 to disable transformations that might be surprising
to end users and to get -fno-toplevel-reorder tested. */
@@ -1552,8 +1473,8 @@ common_handle_option (size_t scode, const char *arg, int value,
exit_after_options = true;
/* Allow the target a chance to give the user some additional information. */
- if (targetm.target_help)
- targetm.target_help ();
+ if (targetm.help)
+ targetm.help ();
break;
case OPT_fhelp_:
@@ -2476,7 +2397,8 @@ set_option (int opt_index, int value, const char *arg, int kind)
}
if ((diagnostic_t)kind != DK_UNSPECIFIED)
- diagnostic_classify_diagnostic (global_dc, opt_index, (diagnostic_t)kind);
+ diagnostic_classify_diagnostic (global_dc, opt_index, (diagnostic_t)kind,
+ UNKNOWN_LOCATION);
}
@@ -2506,7 +2428,7 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask)
new_option[0] = 'W';
strcpy (new_option + 1, arg);
option_index = find_opt (new_option, lang_mask);
- if (option_index == N_OPTS)
+ if (option_index == OPT_SPECIAL_unknown)
{
error ("-Werror=%s: No option -%s", arg, new_option);
}
@@ -2514,7 +2436,8 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask)
{
const diagnostic_t kind = value ? DK_ERROR : DK_WARNING;
- diagnostic_classify_diagnostic (global_dc, option_index, kind);
+ diagnostic_classify_diagnostic (global_dc, option_index, kind,
+ UNKNOWN_LOCATION);
if (kind == DK_ERROR)
{
const struct cl_option * const option = cl_options + option_index;
diff --git a/gcc/opts.h b/gcc/opts.h
index af3c6e2abe6..554bb235b3d 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -1,5 +1,5 @@
/* Command line option handling.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -90,6 +90,42 @@ extern const unsigned int cl_lang_count;
#define CL_UINTEGER (1 << 29) /* Argument is an integer >=0. */
#define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */
+/* Possible ways in which a command-line option may be erroneous.
+ These do not include not being known at all; an option index of
+ OPT_SPECIAL_unknown is used for that. */
+
+#define CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. */
+#define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */
+#define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. */
+#define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. */
+
+/* Structure describing the result of decoding an option. */
+
+struct cl_decoded_option
+{
+ /* The index of this option, or an OPT_SPECIAL_* value for
+ non-options and unknown options. */
+ size_t opt_index;
+
+ /* The string argument, or NULL if none. For OPT_SPECIAL_* cases,
+ the option or non-option command-line argument. */
+ const char *arg;
+
+ /* The original text of option plus arguments, with separate argv
+ elements concatenated into one string with spaces separating
+ them. This is for such uses as diagnostics and
+ -frecord-gcc-switches. */
+ const char *orig_option_with_args_text;
+
+ /* For a boolean option, 1 for the true case and 0 for the "no-"
+ case. For an unsigned integer option, the value of the
+ argument. 1 in all other cases. */
+ int value;
+
+ /* Any flags describing errors detected in this option. */
+ int errors;
+};
+
/* Input file names. */
extern const char **in_fnames;
@@ -99,8 +135,16 @@ extern const char **in_fnames;
extern unsigned num_in_fnames;
size_t find_opt (const char *input, int lang_mask);
+extern int integral_argument (const char *arg);
+extern void decode_cmdline_options_to_array (unsigned int argc,
+ const char **argv,
+ unsigned int lang_mask,
+ struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count);
extern void prune_options (int *argcp, char ***argvp);
-extern void decode_options (unsigned int argc, const char **argv);
+extern void decode_options (unsigned int argc, const char **argv,
+ struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count);
extern int option_enabled (int opt_idx);
extern bool get_option_state (int, struct cl_option_state *);
extern void set_option (int opt_index, int value, const char *arg, int);
diff --git a/gcc/output.h b/gcc/output.h
index 8215ac25b98..d1e5f245bf6 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -1,7 +1,8 @@
/* Declarations for insn-output.c. These functions are defined in recog.c,
final.c, and varasm.c.
Copyright (C) 1987, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -77,6 +78,9 @@ extern rtx final_scan_insn (rtx, FILE *, int, int, int *);
subreg of. */
extern rtx alter_subreg (rtx *);
+/* Print an operand using machine-dependent assembler syntax. */
+extern void output_operand (rtx, int);
+
/* Report inconsistency between the assembler template and the operands.
In an `asm', it's the user's fault; otherwise, the compiler's fault. */
extern void output_operand_lossage (const char *, ...) ATTRIBUTE_PRINTF_1;
@@ -227,7 +231,7 @@ extern void assemble_string (const char *, int);
extern void assemble_external_libcall (rtx);
/* Assemble a label named NAME. */
-extern void assemble_label (const char *);
+extern void assemble_label (FILE *, const char *);
/* Output to FILE (an assembly file) a reference to NAME. If NAME
starts with a *, the rest of NAME is output verbatim. Otherwise
@@ -627,6 +631,8 @@ extern void default_globalize_decl_name (FILE *, tree);
extern void default_emit_unwind_label (FILE *, tree, int, int);
extern void default_emit_except_table_label (FILE *);
extern void default_internal_label (FILE *, const char *, unsigned long);
+extern void default_asm_declare_constant_name (FILE *, const char *,
+ const_tree, HOST_WIDE_INT);
extern void default_file_start (void);
extern void file_end_indicate_exec_stack (void);
diff --git a/gcc/params.def b/gcc/params.def
index 35650ff91b7..767ecd9e512 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -78,11 +78,11 @@ DEFPARAM (PARAM_MAX_INLINE_INSNS_SINGLE,
that is applied to functions marked inlined (or defined in the
class declaration in C++) given by the "max-inline-insns-single"
parameter.
- The default value is 90. */
+ The default value is 40. */
DEFPARAM (PARAM_MAX_INLINE_INSNS_AUTO,
"max-inline-insns-auto",
"The maximum number of instructions when automatically inlining",
- 50, 0, 0)
+ 40, 0, 0)
DEFPARAM (PARAM_MAX_INLINE_INSNS_RECURSIVE,
"max-inline-insns-recursive",
@@ -117,6 +117,12 @@ DEFPARAM (PARAM_EARLY_INLINER_MAX_ITERATIONS,
"The maximum number of nested indirect inlining performed by early inliner",
10, 0, 0)
+/* Limit on probability of entry BB. */
+DEFPARAM (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY,
+ "partial-inlining-entry-probability",
+ "Maximum probability of the entry BB of split region (in percent relative to entry BB of the function) to make partial inlining happen",
+ 70, 0, 0)
+
/* Limit the number of expansions created by the variable expansion
optimization to avoid register pressure. */
DEFPARAM (PARAM_MAX_VARIABLE_EXPANSIONS,
diff --git a/gcc/passes.c b/gcc/passes.c
index fe005199d8c..8828967d0d8 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -795,6 +795,10 @@ init_optimization_passes (void)
NEXT_PASS (pass_cleanup_eh);
NEXT_PASS (pass_profile);
NEXT_PASS (pass_local_pure_const);
+ /* Split functions creates parts that are not run through
+ early optimizations again. It is thus good idea to do this
+ late. */
+ NEXT_PASS (pass_split_functions);
}
NEXT_PASS (pass_release_ssa_names);
NEXT_PASS (pass_rebuild_cgraph_edges);
@@ -809,8 +813,8 @@ init_optimization_passes (void)
NEXT_PASS (pass_ipa_profile);
NEXT_PASS (pass_ipa_cp);
NEXT_PASS (pass_ipa_inline);
- NEXT_PASS (pass_ipa_reference);
NEXT_PASS (pass_ipa_pure_const);
+ NEXT_PASS (pass_ipa_reference);
NEXT_PASS (pass_ipa_type_escape);
NEXT_PASS (pass_ipa_pta);
NEXT_PASS (pass_ipa_struct_reorg);
@@ -1120,7 +1124,7 @@ do_per_function (void (*callback) (void *data), void *data)
keep the array visible to garbage collector to avoid reading collected
out nodes. */
static int nnodes;
-static GTY ((length ("nnodes"))) struct cgraph_node **order;
+static GTY ((length ("nnodes"))) cgraph_node_ptr *order;
/* If we are in IPA mode (i.e., current_function_decl is NULL), call
function CALLBACK for every function in the call graph. Otherwise,
@@ -1136,7 +1140,7 @@ do_per_function_toporder (void (*callback) (void *data), void *data)
else
{
gcc_assert (!order);
- order = GGC_NEWVEC (struct cgraph_node *, cgraph_n_nodes);
+ order = ggc_alloc_vec_cgraph_node_ptr (cgraph_n_nodes);
nnodes = cgraph_postorder (order);
for (i = nnodes - 1; i >= 0; i--)
order[i]->process = 1;
@@ -1175,8 +1179,6 @@ execute_function_todo (void *data)
if (!flags)
return;
- statistics_fini_pass ();
-
/* Always cleanup the CFG before trying to update SSA. */
if (flags & TODO_cleanup_cfg)
{
@@ -1241,22 +1243,7 @@ execute_function_todo (void *data)
}
if (flags & TODO_rebuild_frequencies)
- {
- if (profile_status == PROFILE_GUESSED)
- {
- loop_optimizer_init (0);
- add_noreturn_fake_exit_edges ();
- mark_irreducible_loops ();
- connect_infinite_loops_to_exit ();
- estimate_bb_frequencies ();
- remove_fake_exit_edges ();
- loop_optimizer_finalize ();
- }
- else if (profile_status == PROFILE_READ)
- counts_to_freqs ();
- else
- gcc_unreachable ();
- }
+ rebuild_frequencies ();
#if defined ENABLE_CHECKING
if (flags & TODO_verify_ssa
@@ -1288,6 +1275,8 @@ execute_todo (unsigned int flags)
/* Inform the pass whether it is the first time it is run. */
first_pass_instance = (flags & TODO_mark_first_instance) != 0;
+ statistics_fini_pass ();
+
do_per_function (execute_function_todo, (void *)(size_t) flags);
/* Always remove functions just as before inlining: IPA passes might be
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 369a85732c9..2bd47546476 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR other/44034
+ * EXCLUDES: Add genhooks.c.
+
2010-05-01 Joseph Myers <joseph@codesourcery.com>
* sv.po: Update.
diff --git a/gcc/po/EXCLUDES b/gcc/po/EXCLUDES
index 742320bd2c0..69ab994c94b 100644
--- a/gcc/po/EXCLUDES
+++ b/gcc/po/EXCLUDES
@@ -74,6 +74,7 @@ genextract.c
genflags.c
gengenrtl.c
gengtype.c
+genhooks.c
genmodes.c
genopinit.c
genoutput.c
diff --git a/gcc/po/exgettext b/gcc/po/exgettext
index a85f705f820..e0658302ac8 100644
--- a/gcc/po/exgettext
+++ b/gcc/po/exgettext
@@ -84,7 +84,7 @@ echo "scanning for keywords, %e and %n strings..." >&2
( cd $srcdir
lang_subdirs=`echo */config-lang.in */*/config-lang.in | sed -e 's|config-lang\.in||g'`
- { for dir in "" config/ config/*/ $lang_subdirs
+ { for dir in "" c-family/ config/ config/*/ $lang_subdirs
do for glob in '*.c' '*.h' '*.def'
do eval echo $dir$glob
done
diff --git a/gcc/postreload.c b/gcc/postreload.c
index a03cdfacee3..3882719ccd3 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -262,9 +262,9 @@ reload_cse_simplify_set (rtx set, rtx insn)
/* If memory loads are cheaper than register copies, don't change them. */
if (MEM_P (src))
- old_cost = MEMORY_MOVE_COST (GET_MODE (src), dclass, 1);
+ old_cost = memory_move_cost (GET_MODE (src), dclass, true);
else if (REG_P (src))
- old_cost = REGISTER_MOVE_COST (GET_MODE (src),
+ old_cost = register_move_cost (GET_MODE (src),
REGNO_REG_CLASS (REGNO (src)), dclass);
else
old_cost = rtx_cost (src, SET, speed);
@@ -314,7 +314,7 @@ reload_cse_simplify_set (rtx set, rtx insn)
}
else
#endif
- this_cost = REGISTER_MOVE_COST (GET_MODE (this_rtx),
+ this_cost = register_move_cost (GET_MODE (this_rtx),
REGNO_REG_CLASS (REGNO (this_rtx)),
dclass);
}
diff --git a/gcc/predict.c b/gcc/predict.c
index 1bccd4d2c26..5d61140e4e6 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1855,9 +1855,6 @@ propagate_freq (basic_block head, bitmap tovisit)
edge_iterator ei;
int count = 0;
- /* The outermost "loop" includes the exit block, which we can not
- look up via BASIC_BLOCK. Detect this and use EXIT_BLOCK_PTR
- directly. Do the same for the entry block. */
bb = BASIC_BLOCK (i);
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -1872,6 +1869,9 @@ propagate_freq (basic_block head, bitmap tovisit)
e->src->index, bb->index);
}
BLOCK_INFO (bb)->npredecessors = count;
+ /* When function never returns, we will never process exit block. */
+ if (!count && bb == EXIT_BLOCK_PTR)
+ bb->count = bb->frequency = 0;
}
memcpy (&BLOCK_INFO (head)->frequency, &real_one, sizeof (real_one));
@@ -2282,3 +2282,27 @@ struct gimple_opt_pass pass_strip_predict_hints =
TODO_ggc_collect | TODO_verify_ssa /* todo_flags_finish */
}
};
+
+/* Rebuild function frequencies. Passes are in general expected to
+ maintain profile by hand, however in some cases this is not possible:
+ for example when inlining several functions with loops freuqencies might run
+ out of scale and thus needs to be recomputed. */
+
+void
+rebuild_frequencies (void)
+{
+ if (profile_status == PROFILE_GUESSED)
+ {
+ loop_optimizer_init (0);
+ add_noreturn_fake_exit_edges ();
+ mark_irreducible_loops ();
+ connect_infinite_loops_to_exit ();
+ estimate_bb_frequencies ();
+ remove_fake_exit_edges ();
+ loop_optimizer_finalize ();
+ }
+ else if (profile_status == PROFILE_READ)
+ counts_to_freqs ();
+ else
+ gcc_unreachable ();
+}
diff --git a/gcc/predict.h b/gcc/predict.h
index 18e57d77065..a0ca3a29071 100644
--- a/gcc/predict.h
+++ b/gcc/predict.h
@@ -42,5 +42,6 @@ extern const char *predictor_name (enum br_predictor);
extern tree build_predict_expr (enum br_predictor, enum prediction);
extern void tree_estimate_probability (void);
extern void compute_function_frequency (void);
+extern void rebuild_frequencies (void);
#endif /* GCC_PREDICT_H */
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index aa8924cad9f..8aa99787c59 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -29,9 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include <iconv.h>
#endif
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
/* A pointer to the formatted diagnostic message. */
#define pp_formatted_text_data(PP) \
((const char *) obstack_base (pp_base (PP)->buffer->obstack))
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 5cf0f9b6185..96e1485b6ae 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -411,6 +411,21 @@ print_rtx (const_rtx in_rtx)
if (NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_LABEL)
fprintf (outfile, " %d", XINT (in_rtx, i));
}
+#if !defined(GENERATOR_FILE) && NUM_UNSPECV_VALUES > 0
+ else if (i == 1
+ && GET_CODE (in_rtx) == UNSPEC_VOLATILE
+ && XINT (in_rtx, 1) >= 0
+ && XINT (in_rtx, 1) < NUM_UNSPECV_VALUES)
+ fprintf (outfile, " %s", unspecv_strings[XINT (in_rtx, 1)]);
+#endif
+#if !defined(GENERATOR_FILE) && NUM_UNSPEC_VALUES > 0
+ else if (i == 1
+ && (GET_CODE (in_rtx) == UNSPEC
+ || GET_CODE (in_rtx) == UNSPEC_VOLATILE)
+ && XINT (in_rtx, 1) >= 0
+ && XINT (in_rtx, 1) < NUM_UNSPEC_VALUES)
+ fprintf (outfile, " %s", unspec_strings[XINT (in_rtx, 1)]);
+#endif
else
{
int value = XINT (in_rtx, i);
diff --git a/gcc/read-md.c b/gcc/read-md.c
new file mode 100644
index 00000000000..9c622912b3a
--- /dev/null
+++ b/gcc/read-md.c
@@ -0,0 +1,1139 @@
+/* MD reader for GCC.
+ Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2005, 2006, 2007, 2008, 2010
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "bconfig.h"
+#include "system.h"
+#include "coretypes.h"
+#include "hashtab.h"
+#include "errors.h"
+#include "read-md.h"
+
+/* Associates PTR (which can be a string, etc.) with the file location
+ specified by FILENAME and LINENO. */
+struct ptr_loc {
+ const void *ptr;
+ const char *filename;
+ int lineno;
+};
+
+/* A singly-linked list of filenames. */
+struct file_name_list {
+ struct file_name_list *next;
+ const char *fname;
+};
+
+/* Obstack used for allocating MD strings. */
+struct obstack string_obstack;
+
+/* A table of ptr_locs, hashed on the PTR field. */
+static htab_t ptr_locs;
+
+/* An obstack for the above. Plain xmalloc is a bit heavyweight for a
+ small structure like ptr_loc. */
+static struct obstack ptr_loc_obstack;
+
+/* A hash table of triples (A, B, C), where each of A, B and C is a condition
+ and A is equivalent to "B && C". This is used to keep track of the source
+ of conditions that are made up of separate MD strings (such as the split
+ condition of a define_insn_and_split). */
+static htab_t joined_conditions;
+
+/* An obstack for allocating joined_conditions entries. */
+static struct obstack joined_conditions_obstack;
+
+/* The file we are reading. */
+FILE *read_md_file;
+
+/* The filename of READ_MD_FILE. */
+const char *read_md_filename;
+
+/* The current line number in READ_MD_FILE. */
+int read_md_lineno;
+
+/* The name of the toplevel file that indirectly included READ_MD_FILE. */
+const char *in_fname;
+
+/* The directory part of IN_FNAME. NULL if IN_FNAME is a bare filename. */
+static char *base_dir;
+
+/* The first directory to search. */
+static struct file_name_list *first_dir_md_include;
+
+/* A pointer to the null terminator of the md include chain. */
+static struct file_name_list **last_dir_md_include_ptr = &first_dir_md_include;
+
+/* This callback will be invoked whenever an md include directive is
+ processed. To be used for creation of the dependency file. */
+void (*include_callback) (const char *);
+
+/* The current maximum length of directory names in the search path
+ for include files. (Altered as we get more of them.) */
+static size_t max_include_len;
+
+/* A table of md_constant structures, hashed by name. Null if no
+ constant expansion should occur. */
+static htab_t md_constants;
+
+/* A table of enum_type structures, hashed by name. */
+static htab_t enum_types;
+
+static void handle_file (directive_handler_t);
+
+/* Given an object that starts with a char * name field, return a hash
+ code for its name. */
+
+hashval_t
+leading_string_hash (const void *def)
+{
+ return htab_hash_string (*(const char *const *) def);
+}
+
+/* Given two objects that start with char * name fields, return true if
+ they have the same name. */
+
+int
+leading_string_eq_p (const void *def1, const void *def2)
+{
+ return strcmp (*(const char *const *) def1,
+ *(const char *const *) def2) == 0;
+}
+
+/* Return a hash value for the pointer pointed to by DEF. */
+
+static hashval_t
+leading_ptr_hash (const void *def)
+{
+ return htab_hash_pointer (*(const void *const *) def);
+}
+
+/* Return true if DEF1 and DEF2 are pointers to the same pointer. */
+
+static int
+leading_ptr_eq_p (const void *def1, const void *def2)
+{
+ return *(const void *const *) def1 == *(const void *const *) def2;
+}
+
+/* Associate PTR with the file position given by FILENAME and LINENO. */
+
+static void
+set_md_ptr_loc (const void *ptr, const char *filename, int lineno)
+{
+ struct ptr_loc *loc;
+
+ loc = (struct ptr_loc *) obstack_alloc (&ptr_loc_obstack,
+ sizeof (struct ptr_loc));
+ loc->ptr = ptr;
+ loc->filename = filename;
+ loc->lineno = lineno;
+ *htab_find_slot (ptr_locs, loc, INSERT) = loc;
+}
+
+/* Return the position associated with pointer PTR. Return null if no
+ position was set. */
+
+static const struct ptr_loc *
+get_md_ptr_loc (const void *ptr)
+{
+ return (const struct ptr_loc *) htab_find (ptr_locs, &ptr);
+}
+
+/* Associate NEW_PTR with the same file position as OLD_PTR. */
+
+void
+copy_md_ptr_loc (const void *new_ptr, const void *old_ptr)
+{
+ const struct ptr_loc *loc = get_md_ptr_loc (old_ptr);
+ if (loc != 0)
+ set_md_ptr_loc (new_ptr, loc->filename, loc->lineno);
+}
+
+/* If PTR is associated with a known file position, print a #line
+ directive for it. */
+
+void
+print_md_ptr_loc (const void *ptr)
+{
+ const struct ptr_loc *loc = get_md_ptr_loc (ptr);
+ if (loc != 0)
+ printf ("#line %d \"%s\"\n", loc->lineno, loc->filename);
+}
+
+/* Return a condition that satisfies both COND1 and COND2. Either string
+ may be null or empty. */
+
+const char *
+join_c_conditions (const char *cond1, const char *cond2)
+{
+ char *result;
+ const void **entry;
+
+ if (cond1 == 0 || cond1[0] == 0)
+ return cond2;
+
+ if (cond2 == 0 || cond2[0] == 0)
+ return cond1;
+
+ if (strcmp (cond1, cond2) == 0)
+ return cond1;
+
+ result = concat ("(", cond1, ") && (", cond2, ")", NULL);
+ obstack_ptr_grow (&joined_conditions_obstack, result);
+ obstack_ptr_grow (&joined_conditions_obstack, cond1);
+ obstack_ptr_grow (&joined_conditions_obstack, cond2);
+ entry = XOBFINISH (&joined_conditions_obstack, const void **);
+ *htab_find_slot (joined_conditions, entry, INSERT) = entry;
+ return result;
+}
+
+/* Print condition COND, wrapped in brackets. If COND was created by
+ join_c_conditions, recursively invoke this function for the original
+ conditions and join the result with "&&". Otherwise print a #line
+ directive for COND if its original file position is known. */
+
+void
+print_c_condition (const char *cond)
+{
+ const char **halves = (const char **) htab_find (joined_conditions, &cond);
+ if (halves != 0)
+ {
+ printf ("(");
+ print_c_condition (halves[1]);
+ printf (" && ");
+ print_c_condition (halves[2]);
+ printf (")");
+ }
+ else
+ {
+ putc ('\n', stdout);
+ print_md_ptr_loc (cond);
+ printf ("(%s)", cond);
+ }
+}
+
+/* A vfprintf-like function for reporting an error against line LINENO
+ of the current MD file. */
+
+static void ATTRIBUTE_PRINTF(2,0)
+message_with_line_1 (int lineno, const char *msg, va_list ap)
+{
+ fprintf (stderr, "%s:%d: ", read_md_filename, lineno);
+ vfprintf (stderr, msg, ap);
+ fputc ('\n', stderr);
+}
+
+/* A printf-like function for reporting an error against line LINENO
+ in the current MD file. */
+
+void
+message_with_line (int lineno, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start (ap, msg);
+ message_with_line_1 (lineno, msg, ap);
+ va_end (ap);
+}
+
+/* Like message_with_line, but treat the condition as an error. */
+
+void
+error_with_line (int lineno, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start (ap, msg);
+ message_with_line_1 (lineno, msg, ap);
+ va_end (ap);
+ have_error = 1;
+}
+
+/* A printf-like function for reporting an error against the current
+ position in the MD file. */
+
+void
+fatal_with_file_and_line (const char *msg, ...)
+{
+ char context[64];
+ size_t i;
+ int c;
+ va_list ap;
+
+ va_start (ap, msg);
+
+ fprintf (stderr, "%s:%d: ", read_md_filename, read_md_lineno);
+ vfprintf (stderr, msg, ap);
+ putc ('\n', stderr);
+
+ /* Gather some following context. */
+ for (i = 0; i < sizeof (context)-1; ++i)
+ {
+ c = read_char ();
+ if (c == EOF)
+ break;
+ if (c == '\r' || c == '\n')
+ {
+ unread_char (c);
+ break;
+ }
+ context[i] = c;
+ }
+ context[i] = '\0';
+
+ fprintf (stderr, "%s:%d: following context is `%s'\n",
+ read_md_filename, read_md_lineno, context);
+
+ va_end (ap);
+ exit (1);
+}
+
+/* Report that we found character ACTUAL when we expected to find
+ character EXPECTED. */
+
+void
+fatal_expected_char (int expected, int actual)
+{
+ if (actual == EOF)
+ fatal_with_file_and_line ("expected character `%c', found EOF",
+ expected);
+ else
+ fatal_with_file_and_line ("expected character `%c', found `%c'",
+ expected, actual);
+}
+
+/* Read chars from the MD file until a non-whitespace char and return that.
+ Comments, both Lisp style and C style, are treated as whitespace. */
+
+int
+read_skip_spaces (void)
+{
+ int c;
+
+ while (1)
+ {
+ c = read_char ();
+ switch (c)
+ {
+ case ' ': case '\t': case '\f': case '\r': case '\n':
+ break;
+
+ case ';':
+ do
+ c = read_char ();
+ while (c != '\n' && c != EOF);
+ break;
+
+ case '/':
+ {
+ int prevc;
+ c = read_char ();
+ if (c != '*')
+ {
+ unread_char (c);
+ fatal_with_file_and_line ("stray '/' in file");
+ }
+
+ prevc = 0;
+ while ((c = read_char ()) && c != EOF)
+ {
+ if (prevc == '*' && c == '/')
+ break;
+ prevc = c;
+ }
+ }
+ break;
+
+ default:
+ return c;
+ }
+ }
+}
+
+/* Read an rtx code name into NAME. It is terminated by any of the
+ punctuation chars of rtx printed syntax. */
+
+void
+read_name (struct md_name *name)
+{
+ int c;
+ size_t i;
+
+ c = read_skip_spaces ();
+
+ i = 0;
+ while (1)
+ {
+ if (c == ' ' || c == '\n' || c == '\t' || c == '\f' || c == '\r'
+ || c == EOF)
+ break;
+ if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
+ || c == '(' || c == '[')
+ {
+ unread_char (c);
+ break;
+ }
+
+ if (i == sizeof (name->buffer) - 1)
+ fatal_with_file_and_line ("name too long");
+ name->buffer[i++] = c;
+
+ c = read_char ();
+ }
+
+ if (i == 0)
+ fatal_with_file_and_line ("missing name or number");
+
+ name->buffer[i] = 0;
+ name->string = name->buffer;
+
+ if (md_constants)
+ {
+ /* Do constant expansion. */
+ struct md_constant *def;
+
+ do
+ {
+ struct md_constant tmp_def;
+
+ tmp_def.name = name->string;
+ def = (struct md_constant *) htab_find (md_constants, &tmp_def);
+ if (def)
+ name->string = def->value;
+ }
+ while (def);
+ }
+}
+
+/* Subroutine of the string readers. Handles backslash escapes.
+ Caller has read the backslash, but not placed it into the obstack. */
+
+static void
+read_escape (void)
+{
+ int c = read_char ();
+
+ switch (c)
+ {
+ /* Backslash-newline is replaced by nothing, as in C. */
+ case '\n':
+ return;
+
+ /* \" \' \\ are replaced by the second character. */
+ case '\\':
+ case '"':
+ case '\'':
+ break;
+
+ /* Standard C string escapes:
+ \a \b \f \n \r \t \v
+ \[0-7] \x
+ all are passed through to the output string unmolested.
+ In normal use these wind up in a string constant processed
+ by the C compiler, which will translate them appropriately.
+ We do not bother checking that \[0-7] are followed by up to
+ two octal digits, or that \x is followed by N hex digits.
+ \? \u \U are left out because they are not in traditional C. */
+ case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v':
+ case '0': case '1': case '2': case '3': case '4': case '5': case '6':
+ case '7': case 'x':
+ obstack_1grow (&string_obstack, '\\');
+ break;
+
+ /* \; makes stuff for a C string constant containing
+ newline and tab. */
+ case ';':
+ obstack_grow (&string_obstack, "\\n\\t", 4);
+ return;
+
+ /* pass anything else through, but issue a warning. */
+ default:
+ fprintf (stderr, "%s:%d: warning: unrecognized escape \\%c\n",
+ read_md_filename, read_md_lineno, c);
+ obstack_1grow (&string_obstack, '\\');
+ break;
+ }
+
+ obstack_1grow (&string_obstack, c);
+}
+
+/* Read a double-quoted string onto the obstack. Caller has scanned
+ the leading quote. */
+
+char *
+read_quoted_string (void)
+{
+ int c;
+
+ while (1)
+ {
+ c = read_char (); /* Read the string */
+ if (c == '\\')
+ {
+ read_escape ();
+ continue;
+ }
+ else if (c == '"' || c == EOF)
+ break;
+
+ obstack_1grow (&string_obstack, c);
+ }
+
+ obstack_1grow (&string_obstack, 0);
+ return XOBFINISH (&string_obstack, char *);
+}
+
+/* Read a braced string (a la Tcl) onto the string obstack. Caller
+ has scanned the leading brace. Note that unlike quoted strings,
+ the outermost braces _are_ included in the string constant. */
+
+static char *
+read_braced_string (void)
+{
+ int c;
+ int brace_depth = 1; /* caller-processed */
+ unsigned long starting_read_md_lineno = read_md_lineno;
+
+ obstack_1grow (&string_obstack, '{');
+ while (brace_depth)
+ {
+ c = read_char (); /* Read the string */
+
+ if (c == '{')
+ brace_depth++;
+ else if (c == '}')
+ brace_depth--;
+ else if (c == '\\')
+ {
+ read_escape ();
+ continue;
+ }
+ else if (c == EOF)
+ fatal_with_file_and_line
+ ("missing closing } for opening brace on line %lu",
+ starting_read_md_lineno);
+
+ obstack_1grow (&string_obstack, c);
+ }
+
+ obstack_1grow (&string_obstack, 0);
+ return XOBFINISH (&string_obstack, char *);
+}
+
+/* Read some kind of string constant. This is the high-level routine
+ used by read_rtx. It handles surrounding parentheses, leading star,
+ and dispatch to the appropriate string constant reader. */
+
+char *
+read_string (int star_if_braced)
+{
+ char *stringbuf;
+ int saw_paren = 0;
+ int c, old_lineno;
+
+ c = read_skip_spaces ();
+ if (c == '(')
+ {
+ saw_paren = 1;
+ c = read_skip_spaces ();
+ }
+
+ old_lineno = read_md_lineno;
+ if (c == '"')
+ stringbuf = read_quoted_string ();
+ else if (c == '{')
+ {
+ if (star_if_braced)
+ obstack_1grow (&string_obstack, '*');
+ stringbuf = read_braced_string ();
+ }
+ else
+ fatal_with_file_and_line ("expected `\"' or `{', found `%c'", c);
+
+ if (saw_paren)
+ {
+ c = read_skip_spaces ();
+ if (c != ')')
+ fatal_expected_char (')', c);
+ }
+
+ set_md_ptr_loc (stringbuf, read_md_filename, old_lineno);
+ return stringbuf;
+}
+
+/* Skip the rest of a construct that started at line LINENO and that
+ is currently nested by DEPTH levels of parentheses. */
+
+void
+read_skip_construct (int depth, int lineno)
+{
+ struct md_name name;
+ int c;
+
+ do
+ {
+ c = read_skip_spaces ();
+ if (c == EOF)
+ {
+ error_with_line (lineno, "unterminated construct");
+ exit (1);
+ }
+ switch (c)
+ {
+ case '(':
+ depth++;
+ break;
+
+ case ')':
+ depth--;
+ break;
+
+ case ':':
+ case '[':
+ case ']':
+ case '/':
+ break;
+
+ case '\"':
+ case '{':
+ unread_char (c);
+ read_string (false);
+ break;
+
+ default:
+ unread_char (c);
+ read_name (&name);
+ break;
+ }
+ }
+ while (depth > 0);
+ unread_char (c);
+}
+
+/* Given a string, return the number of comma-separated elements in it.
+ Return 0 for the null string. */
+
+int
+n_comma_elts (const char *s)
+{
+ int n;
+
+ if (*s == '\0')
+ return 0;
+
+ for (n = 1; *s; s++)
+ if (*s == ',')
+ n++;
+
+ return n;
+}
+
+/* Given a pointer to a (char *), return a pointer to the beginning of the
+ next comma-separated element in the string. Advance the pointer given
+ to the end of that element. Return NULL if at end of string. Caller
+ is responsible for copying the string if necessary. White space between
+ a comma and an element is ignored. */
+
+const char *
+scan_comma_elt (const char **pstr)
+{
+ const char *start;
+ const char *p = *pstr;
+
+ if (*p == ',')
+ p++;
+ while (ISSPACE(*p))
+ p++;
+
+ if (*p == '\0')
+ return NULL;
+
+ start = p;
+
+ while (*p != ',' && *p != '\0')
+ p++;
+
+ *pstr = p;
+ return start;
+}
+
+/* Convert STRING to uppercase. */
+
+void
+upcase_string (char *string)
+{
+ int i;
+
+ for (i = 0; string[i]; i++)
+ string[i] = TOUPPER (string[i]);
+}
+
+/* Add a NAME = VALUE definition to md_constants-style hash table DEFS,
+ where both NAME and VALUE are malloc()ed strings. PARENT_ENUM is the
+ enum to which NAME belongs, or null if NAME is a stand-alone constant. */
+
+static struct md_constant *
+add_constant (htab_t defs, char *name, char *value,
+ struct enum_type *parent_enum)
+{
+ struct md_constant *def, tmp_def;
+ void **entry_ptr;
+
+ tmp_def.name = name;
+ entry_ptr = htab_find_slot (defs, &tmp_def, INSERT);
+ if (*entry_ptr)
+ {
+ def = (struct md_constant *) *entry_ptr;
+ if (strcmp (def->value, value) != 0)
+ fatal_with_file_and_line ("redefinition of `%s', was `%s', now `%s'",
+ def->name, def->value, value);
+ else if (parent_enum || def->parent_enum)
+ fatal_with_file_and_line ("redefinition of `%s'", def->name);
+ free (name);
+ free (value);
+ }
+ else
+ {
+ def = XNEW (struct md_constant);
+ def->name = name;
+ def->value = value;
+ def->parent_enum = parent_enum;
+ *entry_ptr = def;
+ }
+ return def;
+}
+
+/* Process a define_constants directive, starting with the optional space
+ after the "define_constants". */
+
+static void
+handle_constants (void)
+{
+ int c;
+ htab_t defs;
+
+ c = read_skip_spaces ();
+ if (c != '[')
+ fatal_expected_char ('[', c);
+
+ /* Disable constant expansion during definition processing. */
+ defs = md_constants;
+ md_constants = 0;
+ while ( (c = read_skip_spaces ()) != ']')
+ {
+ struct md_name name, value;
+
+ if (c != '(')
+ fatal_expected_char ('(', c);
+
+ read_name (&name);
+ read_name (&value);
+ add_constant (defs, xstrdup (name.string), xstrdup (value.string), 0);
+
+ c = read_skip_spaces ();
+ if (c != ')')
+ fatal_expected_char (')', c);
+ }
+ md_constants = defs;
+}
+
+/* For every constant definition, call CALLBACK with two arguments:
+ a pointer a pointer to the constant definition and INFO.
+ Stop when CALLBACK returns zero. */
+
+void
+traverse_md_constants (htab_trav callback, void *info)
+{
+ htab_traverse (md_constants, callback, info);
+}
+
+/* Return a malloc()ed decimal string that represents number NUMBER. */
+
+static char *
+decimal_string (int number)
+{
+ /* A safe overestimate. +1 for sign, +1 for null terminator. */
+ char buffer[sizeof (int) * CHAR_BIT + 1 + 1];
+
+ sprintf (buffer, "%d", number);
+ return xstrdup (buffer);
+}
+
+/* Process a define_enum or define_c_enum directive, starting with
+ the optional space after the "define_enum". LINENO is the line
+ number on which the directive started and MD_P is true if the
+ directive is a define_enum rather than a define_c_enum. */
+
+static void
+handle_enum (int lineno, bool md_p)
+{
+ char *enum_name, *value_name;
+ struct md_name name;
+ struct enum_type *def;
+ struct enum_value *ev;
+ void **slot;
+ int c;
+
+ enum_name = read_string (false);
+ slot = htab_find_slot (enum_types, &enum_name, INSERT);
+ if (*slot)
+ {
+ def = (struct enum_type *) *slot;
+ if (def->md_p != md_p)
+ error_with_line (lineno, "redefining `%s' as a different type of enum",
+ enum_name);
+ }
+ else
+ {
+ def = XNEW (struct enum_type);
+ def->name = enum_name;
+ def->md_p = md_p;
+ def->values = 0;
+ def->tail_ptr = &def->values;
+ def->num_values = 0;
+ *slot = def;
+ }
+
+ c = read_skip_spaces ();
+ if (c != '[')
+ fatal_expected_char ('[', c);
+
+ while ((c = read_skip_spaces ()) != ']')
+ {
+ if (c == EOF)
+ {
+ error_with_line (lineno, "unterminated construct");
+ exit (1);
+ }
+ unread_char (c);
+ read_name (&name);
+
+ ev = XNEW (struct enum_value);
+ ev->next = 0;
+ if (md_p)
+ {
+ value_name = concat (def->name, "_", name.string, NULL);
+ upcase_string (value_name);
+ ev->name = xstrdup (name.string);
+ }
+ else
+ {
+ value_name = xstrdup (name.string);
+ ev->name = value_name;
+ }
+ ev->def = add_constant (md_constants, value_name,
+ decimal_string (def->num_values), def);
+
+ *def->tail_ptr = ev;
+ def->tail_ptr = &ev->next;
+ def->num_values++;
+ }
+}
+
+/* Try to find the definition of the given enum. Return null on failure. */
+
+struct enum_type *
+lookup_enum_type (const char *name)
+{
+ return (struct enum_type *) htab_find (enum_types, &name);
+}
+
+/* For every enum definition, call CALLBACK with two arguments:
+ a pointer to the constant definition and INFO. Stop when CALLBACK
+ returns zero. */
+
+void
+traverse_enum_types (htab_trav callback, void *info)
+{
+ htab_traverse (enum_types, callback, info);
+}
+
+/* Process an "include" directive, starting with the optional space
+ after the "include". Read in the file and use HANDLE_DIRECTIVE
+ to process each unknown directive. LINENO is the line number on
+ which the "include" occured. */
+
+static void
+handle_include (int lineno, directive_handler_t handle_directive)
+{
+ const char *filename;
+ const char *old_filename;
+ int old_lineno;
+ char *pathname;
+ FILE *input_file, *old_file;
+
+ filename = read_string (false);
+ input_file = NULL;
+
+ /* If the specified file name is absolute, skip the include stack. */
+ if (!IS_ABSOLUTE_PATH (filename))
+ {
+ struct file_name_list *stackp;
+
+ /* Search the directory path, trying to open the file. */
+ for (stackp = first_dir_md_include; stackp; stackp = stackp->next)
+ {
+ static const char sep[2] = { DIR_SEPARATOR, '\0' };
+
+ pathname = concat (stackp->fname, sep, filename, NULL);
+ input_file = fopen (pathname, "r");
+ if (input_file != NULL)
+ break;
+ free (pathname);
+ }
+ }
+
+ /* If we haven't managed to open the file yet, try combining the
+ filename with BASE_DIR. */
+ if (input_file == NULL)
+ {
+ if (base_dir)
+ pathname = concat (base_dir, filename, NULL);
+ else
+ pathname = xstrdup (filename);
+ input_file = fopen (pathname, "r");
+ }
+
+ if (input_file == NULL)
+ {
+ free (pathname);
+ error_with_line (lineno, "include file `%s' not found", filename);
+ return;
+ }
+
+ /* Save the old cursor. Note that the LINENO argument to this
+ function is the beginning of the include statement, while
+ read_md_lineno has already been advanced. */
+ old_file = read_md_file;
+ old_filename = read_md_filename;
+ old_lineno = read_md_lineno;
+
+ if (include_callback)
+ include_callback (pathname);
+
+ read_md_file = input_file;
+ read_md_filename = pathname;
+ handle_file (handle_directive);
+
+ /* Restore the old cursor. */
+ read_md_file = old_file;
+ read_md_filename = old_filename;
+ read_md_lineno = old_lineno;
+
+ /* Do not free the pathname. It is attached to the various rtx
+ queue elements. */
+}
+
+/* Process the current file, assuming that read_md_file and
+ read_md_filename are valid. Use HANDLE_DIRECTIVE to handle
+ unknown directives. */
+
+static void
+handle_file (directive_handler_t handle_directive)
+{
+ struct md_name directive;
+ int c, lineno;
+
+ read_md_lineno = 1;
+ while ((c = read_skip_spaces ()) != EOF)
+ {
+ lineno = read_md_lineno;
+ if (c != '(')
+ fatal_expected_char ('(', c);
+
+ read_name (&directive);
+ if (strcmp (directive.string, "define_constants") == 0)
+ handle_constants ();
+ else if (strcmp (directive.string, "define_enum") == 0)
+ handle_enum (lineno, true);
+ else if (strcmp (directive.string, "define_c_enum") == 0)
+ handle_enum (lineno, false);
+ else if (strcmp (directive.string, "include") == 0)
+ handle_include (lineno, handle_directive);
+ else if (handle_directive)
+ handle_directive (lineno, directive.string);
+ else
+ read_skip_construct (1, lineno);
+
+ c = read_skip_spaces ();
+ if (c != ')')
+ fatal_expected_char (')', c);
+ }
+ fclose (read_md_file);
+}
+
+/* Like handle_file, but for top-level files. Set up in_fname and
+ base_dir accordingly. */
+
+static void
+handle_toplevel_file (directive_handler_t handle_directive)
+{
+ char *lastsl;
+
+ in_fname = read_md_filename;
+ lastsl = strrchr (in_fname, '/');
+ if (lastsl != NULL)
+ base_dir = xstrndup (in_fname, lastsl - in_fname + 1);
+ else
+ base_dir = NULL;
+
+ handle_file (handle_directive);
+}
+
+/* Parse a -I option with argument ARG. */
+
+static void
+parse_include (const char *arg)
+{
+ struct file_name_list *dirtmp;
+
+ dirtmp = XNEW (struct file_name_list);
+ dirtmp->next = 0;
+ dirtmp->fname = arg;
+ *last_dir_md_include_ptr = dirtmp;
+ last_dir_md_include_ptr = &dirtmp->next;
+ if (strlen (dirtmp->fname) > max_include_len)
+ max_include_len = strlen (dirtmp->fname);
+}
+
+/* The main routine for reading .md files. Try to process all the .md
+ files specified on the command line and return true if no error occured.
+
+ ARGC and ARGV are the arguments to main.
+
+ PARSE_OPT, if nonnull, is passed all unknown command-line arguments.
+ It should return true if it recognizes the argument or false if a
+ generic error should be reported.
+
+ If HANDLE_DIRECTIVE is nonnull, the parser calls it for each
+ unknown directive, otherwise it just skips such directives.
+ See the comment above the directive_handler_t definition for
+ details about the callback's interface. */
+
+bool
+read_md_files (int argc, char **argv, bool (*parse_opt) (const char *),
+ directive_handler_t handle_directive)
+{
+ int i;
+ bool no_more_options;
+ bool already_read_stdin;
+ int num_files;
+
+ /* Initialize global data. */
+ obstack_init (&string_obstack);
+ ptr_locs = htab_create (161, leading_ptr_hash, leading_ptr_eq_p, 0);
+ obstack_init (&ptr_loc_obstack);
+ joined_conditions = htab_create (161, leading_ptr_hash, leading_ptr_eq_p, 0);
+ obstack_init (&joined_conditions_obstack);
+ md_constants = htab_create (31, leading_string_hash,
+ leading_string_eq_p, (htab_del) 0);
+ enum_types = htab_create (31, leading_string_hash,
+ leading_string_eq_p, (htab_del) 0);
+
+ /* Unlock the stdio streams. */
+ unlock_std_streams ();
+
+ /* First we loop over all the options. */
+ for (i = 1; i < argc; i++)
+ if (argv[i][0] == '-')
+ {
+ /* An argument consisting of exactly one dash is a request to
+ read stdin. This will be handled in the second loop. */
+ if (argv[i][1] == '\0')
+ continue;
+
+ /* An argument consisting of just two dashes causes option
+ parsing to cease. */
+ if (argv[i][1] == '-' && argv[i][2] == '\0')
+ break;
+
+ if (argv[i][1] == 'I')
+ {
+ if (argv[i][2] != '\0')
+ parse_include (argv[i] + 2);
+ else if (++i < argc)
+ parse_include (argv[i]);
+ else
+ fatal ("directory name missing after -I option");
+ continue;
+ }
+
+ /* The program may have provided a callback so it can
+ accept its own options. */
+ if (parse_opt && parse_opt (argv[i]))
+ continue;
+
+ fatal ("invalid option `%s'", argv[i]);
+ }
+
+ /* Now loop over all input files. */
+ num_files = 0;
+ no_more_options = false;
+ already_read_stdin = false;
+ for (i = 1; i < argc; i++)
+ {
+ if (argv[i][0] == '-')
+ {
+ if (argv[i][1] == '\0')
+ {
+ /* Read stdin. */
+ if (already_read_stdin)
+ fatal ("cannot read standard input twice");
+
+ read_md_file = stdin;
+ read_md_filename = "<stdin>";
+ handle_toplevel_file (handle_directive);
+ already_read_stdin = true;
+ continue;
+ }
+ else if (argv[i][1] == '-' && argv[i][2] == '\0')
+ {
+ /* No further arguments are to be treated as options. */
+ no_more_options = true;
+ continue;
+ }
+ else if (!no_more_options)
+ continue;
+ }
+
+ /* If we get here we are looking at a non-option argument, i.e.
+ a file to be processed. */
+ read_md_filename = argv[i];
+ read_md_file = fopen (read_md_filename, "r");
+ if (read_md_file == 0)
+ {
+ perror (read_md_filename);
+ return false;
+ }
+ handle_toplevel_file (handle_directive);
+ num_files++;
+ }
+
+ /* If we get to this point without having seen any files to process,
+ read the standard input now. */
+ if (num_files == 0 && !already_read_stdin)
+ {
+ read_md_file = stdin;
+ read_md_filename = "<stdin>";
+ handle_toplevel_file (handle_directive);
+ }
+
+ return !have_error;
+}
diff --git a/gcc/read-md.h b/gcc/read-md.h
new file mode 100644
index 00000000000..abcca51ac72
--- /dev/null
+++ b/gcc/read-md.h
@@ -0,0 +1,140 @@
+/* MD reader definitions.
+ Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "obstack.h"
+#include "hashtab.h"
+
+/* Holds one symbol or number in the .md file. */
+struct md_name {
+ /* The name as it appeared in the .md file. Names are syntactically
+ limited to the length of this buffer. */
+ char buffer[256];
+
+ /* The name that should actually be used by the generator programs.
+ This is an expansion of NAME, after things like constant substitution. */
+ char *string;
+};
+
+/* This structure represents a constant defined by define_constant,
+ define_enum, or such-like. */
+struct md_constant {
+ /* The name of the constant. */
+ char *name;
+
+ /* The string to which the constants expands. */
+ char *value;
+
+ /* If the constant is associated with a enumeration, this field
+ points to that enumeration, otherwise it is null. */
+ struct enum_type *parent_enum;
+};
+
+/* This structure represents one value in an enum_type. */
+struct enum_value {
+ /* The next value in the enum, or null if this is the last. */
+ struct enum_value *next;
+
+ /* The name of the value as it appears in the .md file. */
+ char *name;
+
+ /* The definition of the related C value. */
+ struct md_constant *def;
+};
+
+/* This structure represents an enum defined by define_enum or the like. */
+struct enum_type {
+ /* The C name of the enumeration. */
+ char *name;
+
+ /* True if this is an md-style enum (DEFINE_ENUM) rather than
+ a C-style enum (DEFINE_C_ENUM). */
+ bool md_p;
+
+ /* The values of the enumeration. There is always at least one. */
+ struct enum_value *values;
+
+ /* A pointer to the null terminator in VALUES. */
+ struct enum_value **tail_ptr;
+
+ /* The number of enumeration values. */
+ unsigned int num_values;
+};
+
+/* A callback that handles a single .md-file directive, up to but not
+ including the closing ')'. It takes two arguments: the line number on
+ which the directive started, and the name of the directive. The next
+ unread character is the optional space after the directive name. */
+typedef void (*directive_handler_t) (int, const char *);
+
+extern const char *in_fname;
+extern FILE *read_md_file;
+extern int read_md_lineno;
+extern const char *read_md_filename;
+extern struct obstack string_obstack;
+extern void (*include_callback) (const char *);
+
+/* Read the next character from the MD file. */
+
+static inline int
+read_char (void)
+{
+ int ch;
+
+ ch = getc (read_md_file);
+ if (ch == '\n')
+ read_md_lineno++;
+ return ch;
+}
+
+/* Put back CH, which was the last character read from the MD file. */
+
+static inline void
+unread_char (int ch)
+{
+ if (ch == '\n')
+ read_md_lineno--;
+ ungetc (ch, read_md_file);
+}
+
+extern hashval_t leading_string_hash (const void *);
+extern int leading_string_eq_p (const void *, const void *);
+extern void copy_md_ptr_loc (const void *, const void *);
+extern void print_md_ptr_loc (const void *);
+extern const char *join_c_conditions (const char *, const char *);
+extern void print_c_condition (const char *);
+extern void message_with_line (int, const char *, ...) ATTRIBUTE_PRINTF_2;
+extern void error_with_line (int, const char *, ...) ATTRIBUTE_PRINTF_2;
+extern void fatal_with_file_and_line (const char *, ...)
+ ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+extern void fatal_expected_char (int, int) ATTRIBUTE_NORETURN;
+extern int read_skip_spaces (void);
+extern void read_name (struct md_name *);
+extern char *read_quoted_string (void);
+extern char *read_string (int);
+extern void read_skip_construct (int, int);
+extern int n_comma_elts (const char *);
+extern const char *scan_comma_elt (const char **);
+extern void upcase_string (char *);
+extern void traverse_md_constants (htab_trav, void *);
+extern void traverse_enum_types (htab_trav, void *);
+extern struct enum_type *lookup_enum_type (const char *);
+extern bool read_md_files (int, char **, bool (*) (const char *),
+ directive_handler_t);
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index 1a0160d3589..d49cbdabf7a 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -30,10 +30,9 @@ along with GCC; see the file COPYING3. If not see
#include "rtl.h"
#include "obstack.h"
#include "hashtab.h"
+#include "read-md.h"
#include "gensupport.h"
-static htab_t md_constants;
-
/* One element in a singly-linked list of (integer, string) pairs. */
struct map_value {
struct map_value *next;
@@ -69,8 +68,8 @@ struct iterator_group {
int num_builtins;
/* Treat the given string as the name of a standard mode or code and
- return its integer value. Use the given file for error reporting. */
- int (*find_builtin) (const char *, FILE *);
+ return its integer value. */
+ int (*find_builtin) (const char *);
/* Return true if the given rtx uses the given mode or code. */
bool (*uses_iterator_p) (rtx, int);
@@ -79,14 +78,6 @@ struct iterator_group {
void (*apply_iterator) (rtx, int);
};
-/* Associates PTR (which can be a string, etc.) with the file location
- specified by FILENAME and LINENO. */
-struct ptr_loc {
- const void *ptr;
- const char *filename;
- int lineno;
-};
-
/* A structure used to pass data from read_rtx to apply_iterator_traverse
via htab_traverse. */
struct iterator_traverse_data {
@@ -94,8 +85,6 @@ struct iterator_traverse_data {
rtx queue;
/* Attributes seen for modes. */
struct map_value *mode_maps;
- /* Input file. */
- FILE *infile;
/* The last unknown attribute used as a mode. */
const char *unknown_mode_attr;
};
@@ -105,46 +94,32 @@ struct iterator_traverse_data {
#define BELLWETHER_CODE(CODE) \
((CODE) < NUM_RTX_CODE ? CODE : bellwether_codes[CODE - NUM_RTX_CODE])
-static void fatal_with_file_and_line (FILE *, const char *, ...)
- ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN;
-static void fatal_expected_char (FILE *, int, int) ATTRIBUTE_NORETURN;
-static int find_mode (const char *, FILE *);
+static int find_mode (const char *);
static bool uses_mode_iterator_p (rtx, int);
static void apply_mode_iterator (rtx, int);
-static int find_code (const char *, FILE *);
+static int find_code (const char *);
static bool uses_code_iterator_p (rtx, int);
static void apply_code_iterator (rtx, int);
static const char *apply_iterator_to_string (const char *, struct mapping *, int);
static rtx apply_iterator_to_rtx (rtx, struct mapping *, int,
- struct map_value *, FILE *, const char **);
+ struct map_value *, const char **);
static bool uses_iterator_p (rtx, struct mapping *);
static const char *add_condition_to_string (const char *, const char *);
static void add_condition_to_rtx (rtx, const char *);
static int apply_iterator_traverse (void **, void *);
static struct mapping *add_mapping (struct iterator_group *, htab_t t,
- const char *, FILE *);
+ const char *);
static struct map_value **add_map_value (struct map_value **,
int, const char *);
static void initialize_iterators (void);
-static void read_name (char *, FILE *);
-static hashval_t leading_ptr_hash (const void *);
-static int leading_ptr_eq_p (const void *, const void *);
-static void set_rtx_ptr_loc (const void *, const char *, int);
-static const struct ptr_loc *get_rtx_ptr_loc (const void *);
-static char *read_string (FILE *, int);
-static char *read_quoted_string (FILE *);
-static char *read_braced_string (FILE *);
-static void read_escape (FILE *);
-static hashval_t def_hash (const void *);
-static int def_name_eq_p (const void *, const void *);
-static void read_constants (FILE *infile, char *tmp_char);
-static void read_conditions (FILE *infile, char *tmp_char);
-static void validate_const_int (FILE *, const char *);
-static int find_iterator (struct iterator_group *, const char *, FILE *);
-static struct mapping *read_mapping (struct iterator_group *, htab_t, FILE *);
-static void check_code_iterator (struct mapping *, FILE *);
-static rtx read_rtx_1 (FILE *, struct map_value **);
-static rtx read_rtx_variadic (FILE *, struct map_value **, rtx);
+static void read_conditions (void);
+static void validate_const_int (const char *);
+static int find_iterator (struct iterator_group *, const char *);
+static struct mapping *read_mapping (struct iterator_group *, htab_t);
+static void check_code_iterator (struct mapping *);
+static rtx read_rtx_code (const char *, struct map_value **);
+static rtx read_nested_rtx (struct map_value **);
+static rtx read_rtx_variadic (struct map_value **, rtx);
/* The mode and code iterator structures. */
static struct iterator_group modes, codes;
@@ -152,84 +127,10 @@ static struct iterator_group modes, codes;
/* Index I is the value of BELLWETHER_CODE (I + NUM_RTX_CODE). */
static enum rtx_code *bellwether_codes;
-/* Obstack used for allocating RTL strings. */
-static struct obstack string_obstack;
-
-/* A table of ptr_locs, hashed on the PTR field. */
-static htab_t ptr_locs;
-
-/* An obstack for the above. Plain xmalloc is a bit heavyweight for a
- small structure like ptr_loc. */
-static struct obstack ptr_loc_obstack;
-
-/* A hash table of triples (A, B, C), where each of A, B and C is a condition
- and A is equivalent to "B && C". This is used to keep track of the source
- of conditions that are made up of separate rtx strings (such as the split
- condition of a define_insn_and_split). */
-static htab_t joined_conditions;
-
-/* An obstack for allocating joined_conditions entries. */
-static struct obstack joined_conditions_obstack;
-
-/* Subroutines of read_rtx. */
-
-/* The current line number for the file. */
-int read_rtx_lineno = 1;
-
-/* The filename for error reporting. */
-const char *read_rtx_filename = "<unknown>";
-
-static void
-fatal_with_file_and_line (FILE *infile, const char *msg, ...)
-{
- char context[64];
- size_t i;
- int c;
- va_list ap;
-
- va_start (ap, msg);
-
- fprintf (stderr, "%s:%d: ", read_rtx_filename, read_rtx_lineno);
- vfprintf (stderr, msg, ap);
- putc ('\n', stderr);
-
- /* Gather some following context. */
- for (i = 0; i < sizeof (context)-1; ++i)
- {
- c = getc (infile);
- if (c == EOF)
- break;
- if (c == '\r' || c == '\n')
- break;
- context[i] = c;
- }
- context[i] = '\0';
-
- fprintf (stderr, "%s:%d: following context is `%s'\n",
- read_rtx_filename, read_rtx_lineno, context);
-
- va_end (ap);
- exit (1);
-}
-
-/* Dump code after printing a message. Used when read_rtx finds
- invalid data. */
-
-static void
-fatal_expected_char (FILE *infile, int expected_c, int actual_c)
-{
- if (actual_c == EOF)
- fatal_with_file_and_line (infile, "expected character `%c', found EOF",
- expected_c);
- else
- fatal_with_file_and_line (infile, "expected character `%c', found `%c'",
- expected_c, actual_c);
-}
-
/* Implementations of the iterator_group callbacks for modes. */
static int
-find_mode (const char *name, FILE *infile)
+find_mode (const char *name)
{
int i;
@@ -237,7 +138,7 @@ find_mode (const char *name, FILE *infile)
if (strcmp (GET_MODE_NAME (i), name) == 0)
return i;
- fatal_with_file_and_line (infile, "unknown mode `%s'", name);
+ fatal_with_file_and_line ("unknown mode `%s'", name);
}
static bool
@@ -255,7 +156,7 @@ apply_mode_iterator (rtx x, int mode)
/* Implementations of the iterator_group callbacks for codes. */
static int
-find_code (const char *name, FILE *infile)
+find_code (const char *name)
{
int i;
@@ -263,7 +164,7 @@ find_code (const char *name, FILE *infile)
if (strcmp (GET_RTX_NAME (i), name) == 0)
return i;
- fatal_with_file_and_line (infile, "unknown rtx code `%s'", name);
+ fatal_with_file_and_line ("unknown rtx code `%s'", name);
}
static bool
@@ -344,13 +245,12 @@ mode_attr_index (struct map_value **mode_maps, const char *string)
/* Apply MODE_MAPS to the top level of X, expanding cases where an
attribute is used for a mode. ITERATOR is the current iterator we are
expanding, and VALUE is the value to which we are expanding it.
- INFILE is used for error messages. This sets *UNKNOWN to true if
- we find a mode attribute which has not yet been defined, and does
- not change it otherwise. */
+ This sets *UNKNOWN to true if we find a mode attribute which has not
+ yet been defined, and does not change it otherwise. */
static void
apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *iterator,
- int value, FILE *infile, const char **unknown)
+ int value, const char **unknown)
{
unsigned int offset;
int indx;
@@ -369,7 +269,7 @@ apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *iterator,
v = map_attr_string (pm->string, iterator, value);
if (v)
- PUT_MODE (x, (enum machine_mode) find_mode (v->string, infile));
+ PUT_MODE (x, (enum machine_mode) find_mode (v->string));
else
*unknown = pm->string;
return;
@@ -411,7 +311,7 @@ apply_iterator_to_string (const char *string, struct mapping *iterator, int valu
{
obstack_grow (&string_obstack, base, strlen (base) + 1);
copy = XOBFINISH (&string_obstack, char *);
- copy_rtx_ptr_loc (copy, string);
+ copy_md_ptr_loc (copy, string);
return copy;
}
return string;
@@ -419,13 +319,12 @@ apply_iterator_to_string (const char *string, struct mapping *iterator, int valu
/* Return a copy of ORIGINAL in which all uses of ITERATOR have been
replaced by VALUE. MODE_MAPS holds information about attribute
- strings used for modes. INFILE is used for error messages. This
- sets *UNKNOWN_MODE_ATTR to the value of an unknown mode attribute,
- and does not change it otherwise. */
+ strings used for modes. This sets *UNKNOWN_MODE_ATTR to the value of
+ an unknown mode attribute, and does not change it otherwise. */
static rtx
apply_iterator_to_rtx (rtx original, struct mapping *iterator, int value,
- struct map_value *mode_maps, FILE *infile,
+ struct map_value *mode_maps,
const char **unknown_mode_attr)
{
struct iterator_group *group;
@@ -448,7 +347,7 @@ apply_iterator_to_rtx (rtx original, struct mapping *iterator, int value,
group->apply_iterator (x, value);
if (mode_maps)
- apply_mode_maps (x, mode_maps, iterator, value, infile, unknown_mode_attr);
+ apply_mode_maps (x, mode_maps, iterator, value, unknown_mode_attr);
/* Change each string and recursively change each rtx. */
format_ptr = GET_RTX_FORMAT (bellwether_code);
@@ -466,8 +365,7 @@ apply_iterator_to_rtx (rtx original, struct mapping *iterator, int value,
case 'e':
XEXP (x, i) = apply_iterator_to_rtx (XEXP (x, i), iterator, value,
- mode_maps, infile,
- unknown_mode_attr);
+ mode_maps, unknown_mode_attr);
break;
case 'V':
@@ -478,7 +376,6 @@ apply_iterator_to_rtx (rtx original, struct mapping *iterator, int value,
for (j = 0; j < XVECLEN (x, i); j++)
XVECEXP (x, i, j) = apply_iterator_to_rtx (XVECEXP (original, i, j),
iterator, value, mode_maps,
- infile,
unknown_mode_attr);
}
break;
@@ -597,7 +494,7 @@ apply_iterator_traverse (void **slot, void *data)
for (v = iterator->values; v != 0; v = v->next)
{
x = apply_iterator_to_rtx (original, iterator, v->number,
- mtd->mode_maps, mtd->infile,
+ mtd->mode_maps,
&mtd->unknown_mode_attr);
add_condition_to_rtx (x, v->string);
if (v != iterator->values)
@@ -616,12 +513,10 @@ apply_iterator_traverse (void **slot, void *data)
}
/* Add a new "mapping" structure to hashtable TABLE. NAME is the name
- of the mapping, GROUP is the group to which it belongs, and INFILE
- is the file that defined the mapping. */
+ of the mapping and GROUP is the group to which it belongs. */
static struct mapping *
-add_mapping (struct iterator_group *group, htab_t table,
- const char *name, FILE *infile)
+add_mapping (struct iterator_group *group, htab_t table, const char *name)
{
struct mapping *m;
void **slot;
@@ -634,7 +529,7 @@ add_mapping (struct iterator_group *group, htab_t table,
slot = htab_find_slot (table, m, INSERT);
if (*slot != 0)
- fatal_with_file_and_line (infile, "`%s' already defined", name);
+ fatal_with_file_and_line ("`%s' already defined", name);
*slot = m;
return m;
@@ -668,22 +563,24 @@ initialize_iterators (void)
char *copy, *p;
int i;
- modes.attrs = htab_create (13, def_hash, def_name_eq_p, 0);
- modes.iterators = htab_create (13, def_hash, def_name_eq_p, 0);
+ modes.attrs = htab_create (13, leading_string_hash, leading_string_eq_p, 0);
+ modes.iterators = htab_create (13, leading_string_hash,
+ leading_string_eq_p, 0);
modes.num_builtins = MAX_MACHINE_MODE;
modes.find_builtin = find_mode;
modes.uses_iterator_p = uses_mode_iterator_p;
modes.apply_iterator = apply_mode_iterator;
- codes.attrs = htab_create (13, def_hash, def_name_eq_p, 0);
- codes.iterators = htab_create (13, def_hash, def_name_eq_p, 0);
+ codes.attrs = htab_create (13, leading_string_hash, leading_string_eq_p, 0);
+ codes.iterators = htab_create (13, leading_string_hash,
+ leading_string_eq_p, 0);
codes.num_builtins = NUM_RTX_CODE;
codes.find_builtin = find_code;
codes.uses_iterator_p = uses_code_iterator_p;
codes.apply_iterator = apply_code_iterator;
- lower = add_mapping (&modes, modes.attrs, "mode", 0);
- upper = add_mapping (&modes, modes.attrs, "MODE", 0);
+ lower = add_mapping (&modes, modes.attrs, "mode");
+ upper = add_mapping (&modes, modes.attrs, "MODE");
lower_ptr = &lower->values;
upper_ptr = &upper->values;
for (i = 0; i < MAX_MACHINE_MODE; i++)
@@ -696,8 +593,8 @@ initialize_iterators (void)
lower_ptr = add_map_value (lower_ptr, i, copy);
}
- lower = add_mapping (&codes, codes.attrs, "code", 0);
- upper = add_mapping (&codes, codes.attrs, "CODE", 0);
+ lower = add_mapping (&codes, codes.attrs, "code");
+ upper = add_mapping (&codes, codes.attrs, "CODE");
lower_ptr = &lower->values;
upper_ptr = &upper->values;
for (i = 0; i < NUM_RTX_CODE; i++)
@@ -710,384 +607,6 @@ initialize_iterators (void)
upper_ptr = add_map_value (upper_ptr, i, copy);
}
}
-
-/* Return a hash value for the pointer pointed to by DEF. */
-
-static hashval_t
-leading_ptr_hash (const void *def)
-{
- return htab_hash_pointer (*(const void *const *) def);
-}
-
-/* Return true if DEF1 and DEF2 are pointers to the same pointer. */
-
-static int
-leading_ptr_eq_p (const void *def1, const void *def2)
-{
- return *(const void *const *) def1 == *(const void *const *) def2;
-}
-
-/* Associate PTR with the file position given by FILENAME and LINENO. */
-
-static void
-set_rtx_ptr_loc (const void *ptr, const char *filename, int lineno)
-{
- struct ptr_loc *loc;
-
- loc = (struct ptr_loc *) obstack_alloc (&ptr_loc_obstack,
- sizeof (struct ptr_loc));
- loc->ptr = ptr;
- loc->filename = filename;
- loc->lineno = lineno;
- *htab_find_slot (ptr_locs, loc, INSERT) = loc;
-}
-
-/* Return the position associated with pointer PTR. Return null if no
- position was set. */
-
-static const struct ptr_loc *
-get_rtx_ptr_loc (const void *ptr)
-{
- return (const struct ptr_loc *) htab_find (ptr_locs, &ptr);
-}
-
-/* Associate NEW_PTR with the same file position as OLD_PTR. */
-
-void
-copy_rtx_ptr_loc (const void *new_ptr, const void *old_ptr)
-{
- const struct ptr_loc *loc = get_rtx_ptr_loc (old_ptr);
- if (loc != 0)
- set_rtx_ptr_loc (new_ptr, loc->filename, loc->lineno);
-}
-
-/* If PTR is associated with a known file position, print a #line
- directive for it. */
-
-void
-print_rtx_ptr_loc (const void *ptr)
-{
- const struct ptr_loc *loc = get_rtx_ptr_loc (ptr);
- if (loc != 0)
- printf ("#line %d \"%s\"\n", loc->lineno, loc->filename);
-}
-
-/* Return a condition that satisfies both COND1 and COND2. Either string
- may be null or empty. */
-
-const char *
-join_c_conditions (const char *cond1, const char *cond2)
-{
- char *result;
- const void **entry;
-
- if (cond1 == 0 || cond1[0] == 0)
- return cond2;
-
- if (cond2 == 0 || cond2[0] == 0)
- return cond1;
-
- if (strcmp (cond1, cond2) == 0)
- return cond1;
-
- result = concat ("(", cond1, ") && (", cond2, ")", NULL);
- obstack_ptr_grow (&joined_conditions_obstack, result);
- obstack_ptr_grow (&joined_conditions_obstack, cond1);
- obstack_ptr_grow (&joined_conditions_obstack, cond2);
- entry = XOBFINISH (&joined_conditions_obstack, const void **);
- *htab_find_slot (joined_conditions, entry, INSERT) = entry;
- return result;
-}
-
-/* Print condition COND, wrapped in brackets. If COND was created by
- join_c_conditions, recursively invoke this function for the original
- conditions and join the result with "&&". Otherwise print a #line
- directive for COND if its original file position is known. */
-
-void
-print_c_condition (const char *cond)
-{
- const char **halves = (const char **) htab_find (joined_conditions, &cond);
- if (halves != 0)
- {
- printf ("(");
- print_c_condition (halves[1]);
- printf (" && ");
- print_c_condition (halves[2]);
- printf (")");
- }
- else
- {
- putc ('\n', stdout);
- print_rtx_ptr_loc (cond);
- printf ("(%s)", cond);
- }
-}
-
-/* Read chars from INFILE until a non-whitespace char
- and return that. Comments, both Lisp style and C style,
- are treated as whitespace.
- Tools such as genflags use this function. */
-
-int
-read_skip_spaces (FILE *infile)
-{
- int c;
-
- while (1)
- {
- c = getc (infile);
- switch (c)
- {
- case '\n':
- read_rtx_lineno++;
- break;
-
- case ' ': case '\t': case '\f': case '\r':
- break;
-
- case ';':
- do
- c = getc (infile);
- while (c != '\n' && c != EOF);
- read_rtx_lineno++;
- break;
-
- case '/':
- {
- int prevc;
- c = getc (infile);
- if (c != '*')
- fatal_expected_char (infile, '*', c);
-
- prevc = 0;
- while ((c = getc (infile)) && c != EOF)
- {
- if (c == '\n')
- read_rtx_lineno++;
- else if (prevc == '*' && c == '/')
- break;
- prevc = c;
- }
- }
- break;
-
- default:
- return c;
- }
- }
-}
-
-/* Read an rtx code name into the buffer STR[].
- It is terminated by any of the punctuation chars of rtx printed syntax. */
-
-static void
-read_name (char *str, FILE *infile)
-{
- char *p;
- int c;
-
- c = read_skip_spaces (infile);
-
- p = str;
- while (1)
- {
- if (c == ' ' || c == '\n' || c == '\t' || c == '\f' || c == '\r' || c == EOF)
- break;
- if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
- || c == '(' || c == '[')
- {
- ungetc (c, infile);
- break;
- }
- *p++ = c;
- c = getc (infile);
- }
- if (p == str)
- fatal_with_file_and_line (infile, "missing name or number");
- if (c == '\n')
- read_rtx_lineno++;
-
- *p = 0;
-
- if (md_constants)
- {
- /* Do constant expansion. */
- struct md_constant *def;
-
- p = str;
- do
- {
- struct md_constant tmp_def;
-
- tmp_def.name = p;
- def = (struct md_constant *) htab_find (md_constants, &tmp_def);
- if (def)
- p = def->value;
- } while (def);
- if (p != str)
- strcpy (str, p);
- }
-}
-
-/* Subroutine of the string readers. Handles backslash escapes.
- Caller has read the backslash, but not placed it into the obstack. */
-static void
-read_escape (FILE *infile)
-{
- int c = getc (infile);
-
- switch (c)
- {
- /* Backslash-newline is replaced by nothing, as in C. */
- case '\n':
- read_rtx_lineno++;
- return;
-
- /* \" \' \\ are replaced by the second character. */
- case '\\':
- case '"':
- case '\'':
- break;
-
- /* Standard C string escapes:
- \a \b \f \n \r \t \v
- \[0-7] \x
- all are passed through to the output string unmolested.
- In normal use these wind up in a string constant processed
- by the C compiler, which will translate them appropriately.
- We do not bother checking that \[0-7] are followed by up to
- two octal digits, or that \x is followed by N hex digits.
- \? \u \U are left out because they are not in traditional C. */
- case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v':
- case '0': case '1': case '2': case '3': case '4': case '5': case '6':
- case '7': case 'x':
- obstack_1grow (&string_obstack, '\\');
- break;
-
- /* \; makes stuff for a C string constant containing
- newline and tab. */
- case ';':
- obstack_grow (&string_obstack, "\\n\\t", 4);
- return;
-
- /* pass anything else through, but issue a warning. */
- default:
- fprintf (stderr, "%s:%d: warning: unrecognized escape \\%c\n",
- read_rtx_filename, read_rtx_lineno, c);
- obstack_1grow (&string_obstack, '\\');
- break;
- }
-
- obstack_1grow (&string_obstack, c);
-}
-
-
-/* Read a double-quoted string onto the obstack. Caller has scanned
- the leading quote. */
-static char *
-read_quoted_string (FILE *infile)
-{
- int c;
-
- while (1)
- {
- c = getc (infile); /* Read the string */
- if (c == '\n')
- read_rtx_lineno++;
- else if (c == '\\')
- {
- read_escape (infile);
- continue;
- }
- else if (c == '"' || c == EOF)
- break;
-
- obstack_1grow (&string_obstack, c);
- }
-
- obstack_1grow (&string_obstack, 0);
- return XOBFINISH (&string_obstack, char *);
-}
-
-/* Read a braced string (a la Tcl) onto the string obstack. Caller
- has scanned the leading brace. Note that unlike quoted strings,
- the outermost braces _are_ included in the string constant. */
-static char *
-read_braced_string (FILE *infile)
-{
- int c;
- int brace_depth = 1; /* caller-processed */
- unsigned long starting_read_rtx_lineno = read_rtx_lineno;
-
- obstack_1grow (&string_obstack, '{');
- while (brace_depth)
- {
- c = getc (infile); /* Read the string */
-
- if (c == '\n')
- read_rtx_lineno++;
- else if (c == '{')
- brace_depth++;
- else if (c == '}')
- brace_depth--;
- else if (c == '\\')
- {
- read_escape (infile);
- continue;
- }
- else if (c == EOF)
- fatal_with_file_and_line
- (infile, "missing closing } for opening brace on line %lu",
- starting_read_rtx_lineno);
-
- obstack_1grow (&string_obstack, c);
- }
-
- obstack_1grow (&string_obstack, 0);
- return XOBFINISH (&string_obstack, char *);
-}
-
-/* Read some kind of string constant. This is the high-level routine
- used by read_rtx. It handles surrounding parentheses, leading star,
- and dispatch to the appropriate string constant reader. */
-
-static char *
-read_string (FILE *infile, int star_if_braced)
-{
- char *stringbuf;
- int saw_paren = 0;
- int c, old_lineno;
-
- c = read_skip_spaces (infile);
- if (c == '(')
- {
- saw_paren = 1;
- c = read_skip_spaces (infile);
- }
-
- old_lineno = read_rtx_lineno;
- if (c == '"')
- stringbuf = read_quoted_string (infile);
- else if (c == '{')
- {
- if (star_if_braced)
- obstack_1grow (&string_obstack, '*');
- stringbuf = read_braced_string (infile);
- }
- else
- fatal_with_file_and_line (infile, "expected `\"' or `{', found `%c'", c);
-
- if (saw_paren)
- {
- c = read_skip_spaces (infile);
- if (c != ')')
- fatal_expected_char (infile, ')', c);
- }
-
- set_rtx_ptr_loc (stringbuf, read_rtx_filename, old_lineno);
- return stringbuf;
-}
/* Provide a version of a function to read a long long if the system does
not provide one. */
@@ -1126,99 +645,9 @@ atoll (const char *p)
return tmp_wide;
}
#endif
-
-/* Given an object that starts with a char * name field, return a hash
- code for its name. */
-static hashval_t
-def_hash (const void *def)
-{
- unsigned result, i;
- const char *string = *(const char *const *) def;
-
- for (result = i = 0; *string++ != '\0'; i++)
- result += ((unsigned char) *string << (i % CHAR_BIT));
- return result;
-}
-
-/* Given two objects that start with char * name fields, return true if
- they have the same name. */
-static int
-def_name_eq_p (const void *def1, const void *def2)
-{
- return ! strcmp (*(const char *const *) def1,
- *(const char *const *) def2);
-}
-
-/* INFILE is a FILE pointer to read text from. TMP_CHAR is a buffer suitable
- to read a name or number into. Process a define_constants directive,
- starting with the optional space after the "define_constants". */
-static void
-read_constants (FILE *infile, char *tmp_char)
-{
- int c;
- htab_t defs;
-
- c = read_skip_spaces (infile);
- if (c != '[')
- fatal_expected_char (infile, '[', c);
- defs = md_constants;
- if (! defs)
- defs = htab_create (32, def_hash, def_name_eq_p, (htab_del) 0);
- /* Disable constant expansion during definition processing. */
- md_constants = 0;
- while ( (c = read_skip_spaces (infile)) != ']')
- {
- struct md_constant *def;
- void **entry_ptr;
-
- if (c != '(')
- fatal_expected_char (infile, '(', c);
- def = XNEW (struct md_constant);
- def->name = tmp_char;
- read_name (tmp_char, infile);
- entry_ptr = htab_find_slot (defs, def, INSERT);
- if (! *entry_ptr)
- def->name = xstrdup (tmp_char);
- c = read_skip_spaces (infile);
- ungetc (c, infile);
- read_name (tmp_char, infile);
- if (! *entry_ptr)
- {
- def->value = xstrdup (tmp_char);
- *entry_ptr = def;
- }
- else
- {
- def = (struct md_constant *) *entry_ptr;
- if (strcmp (def->value, tmp_char))
- fatal_with_file_and_line (infile,
- "redefinition of %s, was %s, now %s",
- def->name, def->value, tmp_char);
- }
- c = read_skip_spaces (infile);
- if (c != ')')
- fatal_expected_char (infile, ')', c);
- }
- md_constants = defs;
- c = read_skip_spaces (infile);
- if (c != ')')
- fatal_expected_char (infile, ')', c);
-}
-
-/* For every constant definition, call CALLBACK with two arguments:
- a pointer a pointer to the constant definition and INFO.
- Stops when CALLBACK returns zero. */
-void
-traverse_md_constants (htab_trav callback, void *info)
-{
- if (md_constants)
- htab_traverse (md_constants, callback, info);
-}
-/* INFILE is a FILE pointer to read text from. TMP_CHAR is a buffer
- suitable to read a name or number into. Process a
- define_conditions directive, starting with the optional space after
- the "define_conditions". The directive looks like this:
+/* Process a define_conditions directive, starting with the optional
+ space after the "define_conditions". The directive looks like this:
(define_conditions [
(number "string")
@@ -1231,44 +660,42 @@ traverse_md_constants (htab_trav callback, void *info)
slipped in at the beginning of the sequence of MD files read by
most of the other generators. */
static void
-read_conditions (FILE *infile, char *tmp_char)
+read_conditions (void)
{
int c;
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
if (c != '[')
- fatal_expected_char (infile, '[', c);
+ fatal_expected_char ('[', c);
- while ( (c = read_skip_spaces (infile)) != ']')
+ while ( (c = read_skip_spaces ()) != ']')
{
+ struct md_name name;
char *expr;
int value;
if (c != '(')
- fatal_expected_char (infile, '(', c);
+ fatal_expected_char ('(', c);
- read_name (tmp_char, infile);
- validate_const_int (infile, tmp_char);
- value = atoi (tmp_char);
+ read_name (&name);
+ validate_const_int (name.string);
+ value = atoi (name.string);
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
if (c != '"')
- fatal_expected_char (infile, '"', c);
- expr = read_quoted_string (infile);
+ fatal_expected_char ('"', c);
+ expr = read_quoted_string ();
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
if (c != ')')
- fatal_expected_char (infile, ')', c);
+ fatal_expected_char (')', c);
add_c_test (expr, value);
}
- c = read_skip_spaces (infile);
- if (c != ')')
- fatal_expected_char (infile, ')', c);
}
static void
-validate_const_int (FILE *infile, const char *string)
+validate_const_int (const char *string)
{
const char *cp;
int valid = 1;
@@ -1284,82 +711,78 @@ validate_const_int (FILE *infile, const char *string)
if (! ISDIGIT (*cp))
valid = 0;
if (!valid)
- fatal_with_file_and_line (infile, "invalid decimal constant \"%s\"\n", string);
+ fatal_with_file_and_line ("invalid decimal constant \"%s\"\n", string);
}
/* Search GROUP for a mode or code called NAME and return its numerical
- identifier. INFILE is the file that contained NAME. */
+ identifier. */
static int
-find_iterator (struct iterator_group *group, const char *name, FILE *infile)
+find_iterator (struct iterator_group *group, const char *name)
{
struct mapping *m;
m = (struct mapping *) htab_find (group->iterators, &name);
if (m != 0)
return m->index + group->num_builtins;
- return group->find_builtin (name, infile);
+ return group->find_builtin (name);
}
/* Finish reading a declaration of the form:
(define... <name> [<value1> ... <valuen>])
- from INFILE, where each <valuei> is either a bare symbol name or a
+ from the MD file, where each <valuei> is either a bare symbol name or a
"(<name> <string>)" pair. The "(define..." part has already been read.
Represent the declaration as a "mapping" structure; add it to TABLE
(which belongs to GROUP) and return it. */
static struct mapping *
-read_mapping (struct iterator_group *group, htab_t table, FILE *infile)
+read_mapping (struct iterator_group *group, htab_t table)
{
- char tmp_char[256];
+ struct md_name name;
struct mapping *m;
struct map_value **end_ptr;
const char *string;
int number, c;
/* Read the mapping name and create a structure for it. */
- read_name (tmp_char, infile);
- m = add_mapping (group, table, tmp_char, infile);
+ read_name (&name);
+ m = add_mapping (group, table, name.string);
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
if (c != '[')
- fatal_expected_char (infile, '[', c);
+ fatal_expected_char ('[', c);
/* Read each value. */
end_ptr = &m->values;
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
do
{
if (c != '(')
{
/* A bare symbol name that is implicitly paired to an
empty string. */
- ungetc (c, infile);
- read_name (tmp_char, infile);
+ unread_char (c);
+ read_name (&name);
string = "";
}
else
{
/* A "(name string)" pair. */
- read_name (tmp_char, infile);
- string = read_string (infile, false);
- c = read_skip_spaces (infile);
+ read_name (&name);
+ string = read_string (false);
+ c = read_skip_spaces ();
if (c != ')')
- fatal_expected_char (infile, ')', c);
+ fatal_expected_char (')', c);
}
- number = group->find_builtin (tmp_char, infile);
+ number = group->find_builtin (name.string);
end_ptr = add_map_value (end_ptr, number, string);
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
}
while (c != ']');
- c = read_skip_spaces (infile);
- if (c != ')')
- fatal_expected_char (infile, ')', c);
-
return m;
}
@@ -1367,7 +790,7 @@ read_mapping (struct iterator_group *group, htab_t table, FILE *infile)
same format. Initialize the iterator's entry in bellwether_codes. */
static void
-check_code_iterator (struct mapping *iterator, FILE *infile)
+check_code_iterator (struct mapping *iterator)
{
struct map_value *v;
enum rtx_code bellwether;
@@ -1375,7 +798,7 @@ check_code_iterator (struct mapping *iterator, FILE *infile)
bellwether = (enum rtx_code) iterator->values->number;
for (v = iterator->values->next; v != 0; v = v->next)
if (strcmp (GET_RTX_FORMAT (bellwether), GET_RTX_FORMAT (v->number)) != 0)
- fatal_with_file_and_line (infile, "code iterator `%s' combines "
+ fatal_with_file_and_line ("code iterator `%s' combines "
"different rtx formats", iterator->name);
bellwether_codes = XRESIZEVEC (enum rtx_code, bellwether_codes,
@@ -1383,89 +806,81 @@ check_code_iterator (struct mapping *iterator, FILE *infile)
bellwether_codes[iterator->index] = bellwether;
}
-/* Read an rtx in printed representation from INFILE and store its
- core representation in *X. Also store the line number of the
- opening '(' in *LINENO. Return true on success or false if the
- end of file has been reached.
-
- read_rtx is not used in the compiler proper, but rather in
- the utilities gen*.c that construct C code from machine descriptions. */
+/* Read an rtx-related declaration from the MD file, given that it
+ starts with directive name RTX_NAME. Return true if it expands to
+ one or more rtxes (as defined by rtx.def). When returning true,
+ store the list of rtxes as an EXPR_LIST in *X. */
bool
-read_rtx (FILE *infile, rtx *x, int *lineno)
+read_rtx (const char *rtx_name, rtx *x)
{
- static rtx queue_head, queue_next;
- static int queue_lineno;
- int c;
+ static rtx queue_head;
+ struct map_value *mode_maps;
+ struct iterator_traverse_data mtd;
/* Do one-time initialization. */
if (queue_head == 0)
{
initialize_iterators ();
- obstack_init (&string_obstack);
queue_head = rtx_alloc (EXPR_LIST);
- ptr_locs = htab_create (161, leading_ptr_hash, leading_ptr_eq_p, 0);
- obstack_init (&ptr_loc_obstack);
- joined_conditions = htab_create (161, leading_ptr_hash,
- leading_ptr_eq_p, 0);
- obstack_init (&joined_conditions_obstack);
}
- if (queue_next == 0)
+ /* Handle various rtx-related declarations that aren't themselves
+ encoded as rtxes. */
+ if (strcmp (rtx_name, "define_conditions") == 0)
+ {
+ read_conditions ();
+ return false;
+ }
+ if (strcmp (rtx_name, "define_mode_attr") == 0)
+ {
+ read_mapping (&modes, modes.attrs);
+ return false;
+ }
+ if (strcmp (rtx_name, "define_mode_iterator") == 0)
+ {
+ read_mapping (&modes, modes.iterators);
+ return false;
+ }
+ if (strcmp (rtx_name, "define_code_attr") == 0)
+ {
+ read_mapping (&codes, codes.attrs);
+ return false;
+ }
+ if (strcmp (rtx_name, "define_code_iterator") == 0)
{
- struct map_value *mode_maps;
- struct iterator_traverse_data mtd;
- rtx from_file;
-
- c = read_skip_spaces (infile);
- if (c == EOF)
- return false;
- ungetc (c, infile);
-
- queue_lineno = read_rtx_lineno;
- mode_maps = 0;
- from_file = read_rtx_1 (infile, &mode_maps);
- if (from_file == 0)
- return false; /* This confuses a top level (nil) with end of
- file, but a top level (nil) would have
- crashed our caller anyway. */
-
- queue_next = queue_head;
- XEXP (queue_next, 0) = from_file;
- XEXP (queue_next, 1) = 0;
-
- mtd.queue = queue_next;
- mtd.mode_maps = mode_maps;
- mtd.infile = infile;
- mtd.unknown_mode_attr = mode_maps ? mode_maps->string : NULL;
- htab_traverse (modes.iterators, apply_iterator_traverse, &mtd);
- htab_traverse (codes.iterators, apply_iterator_traverse, &mtd);
- if (mtd.unknown_mode_attr)
- fatal_with_file_and_line (infile,
- "undefined attribute '%s' used for mode",
- mtd.unknown_mode_attr);
+ check_code_iterator (read_mapping (&codes, codes.iterators));
+ return false;
}
- *x = XEXP (queue_next, 0);
- *lineno = queue_lineno;
- queue_next = XEXP (queue_next, 1);
+ mode_maps = 0;
+ XEXP (queue_head, 0) = read_rtx_code (rtx_name, &mode_maps);
+ XEXP (queue_head, 1) = 0;
+
+ mtd.queue = queue_head;
+ mtd.mode_maps = mode_maps;
+ mtd.unknown_mode_attr = mode_maps ? mode_maps->string : NULL;
+ htab_traverse (modes.iterators, apply_iterator_traverse, &mtd);
+ htab_traverse (codes.iterators, apply_iterator_traverse, &mtd);
+ if (mtd.unknown_mode_attr)
+ fatal_with_file_and_line ("undefined attribute '%s' used for mode",
+ mtd.unknown_mode_attr);
+ *x = queue_head;
return true;
}
-/* Subroutine of read_rtx that reads one construct from INFILE but
- doesn't apply any iterators. */
+/* Subroutine of read_rtx and read_nested_rtx. CODE_NAME is the name of
+ either an rtx code or a code iterator. Parse the rest of the rtx and
+ return it. MODE_MAPS is as for iterator_traverse_data. */
static rtx
-read_rtx_1 (FILE *infile, struct map_value **mode_maps)
+read_rtx_code (const char *code_name, struct map_value **mode_maps)
{
int i;
RTX_CODE real_code, bellwether_code;
const char *format_ptr;
- /* tmp_char is a buffer used for reading decimal integers
- and names of rtx types and machine modes.
- Therefore, 256 must be enough. */
- char tmp_char[256];
+ struct md_name name;
rtx return_rtx;
int c;
int tmp_int;
@@ -1478,56 +893,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
rtx value; /* Value of this node. */
};
- again:
- c = read_skip_spaces (infile); /* Should be open paren. */
-
- if (c == EOF)
- return 0;
-
- if (c != '(')
- fatal_expected_char (infile, '(', c);
-
- read_name (tmp_char, infile);
- if (strcmp (tmp_char, "nil") == 0)
- {
- /* (nil) stands for an expression that isn't there. */
- c = read_skip_spaces (infile);
- if (c != ')')
- fatal_expected_char (infile, ')', c);
- return 0;
- }
- if (strcmp (tmp_char, "define_constants") == 0)
- {
- read_constants (infile, tmp_char);
- goto again;
- }
- if (strcmp (tmp_char, "define_conditions") == 0)
- {
- read_conditions (infile, tmp_char);
- goto again;
- }
- if (strcmp (tmp_char, "define_mode_attr") == 0)
- {
- read_mapping (&modes, modes.attrs, infile);
- goto again;
- }
- if (strcmp (tmp_char, "define_mode_iterator") == 0)
- {
- read_mapping (&modes, modes.iterators, infile);
- goto again;
- }
- if (strcmp (tmp_char, "define_code_attr") == 0)
- {
- read_mapping (&codes, codes.attrs, infile);
- goto again;
- }
- if (strcmp (tmp_char, "define_code_iterator") == 0)
- {
- check_code_iterator (read_mapping (&codes, codes.iterators, infile),
- infile);
- goto again;
- }
- real_code = (enum rtx_code) find_iterator (&codes, tmp_char, infile);
+ real_code = (enum rtx_code) find_iterator (&codes, code_name);
bellwether_code = BELLWETHER_CODE (real_code);
/* If we end up with an insn expression then we free this space below. */
@@ -1538,22 +904,22 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
/* If what follows is `: mode ', read it and
store the mode in the rtx. */
- i = read_skip_spaces (infile);
+ i = read_skip_spaces ();
if (i == ':')
{
unsigned int mode;
- read_name (tmp_char, infile);
- if (tmp_char[0] != '<' || tmp_char[strlen (tmp_char) - 1] != '>')
- mode = find_iterator (&modes, tmp_char, infile);
+ read_name (&name);
+ if (name.string[0] != '<' || name.string[strlen (name.string) - 1] != '>')
+ mode = find_iterator (&modes, name.string);
else
- mode = mode_attr_index (mode_maps, tmp_char);
+ mode = mode_attr_index (mode_maps, name.string);
PUT_MODE (return_rtx, (enum machine_mode) mode);
if (GET_MODE (return_rtx) != mode)
- fatal_with_file_and_line (infile, "mode too large");
+ fatal_with_file_and_line ("mode too large");
}
else
- ungetc (i, infile);
+ unread_char (i);
for (i = 0; format_ptr[i] != 0; i++)
switch (format_ptr[i])
@@ -1565,14 +931,14 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
case 'e':
case 'u':
- XEXP (return_rtx, i) = read_rtx_1 (infile, mode_maps);
+ XEXP (return_rtx, i) = read_nested_rtx (mode_maps);
break;
case 'V':
/* 'V' is an optional vector: if a closeparen follows,
just store NULL for this element. */
- c = read_skip_spaces (infile);
- ungetc (c, infile);
+ c = read_skip_spaces ();
+ unread_char (c);
if (c == ')')
{
XVEC (return_rtx, i) = 0;
@@ -1587,19 +953,19 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
int list_counter = 0;
rtvec return_vec = NULL_RTVEC;
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
if (c != '[')
- fatal_expected_char (infile, '[', c);
+ fatal_expected_char ('[', c);
/* Add expressions to a list, while keeping a count. */
obstack_init (&vector_stack);
- while ((c = read_skip_spaces (infile)) && c != ']')
+ while ((c = read_skip_spaces ()) && c != ']')
{
if (c == EOF)
- fatal_expected_char (infile, ']', c);
- ungetc (c, infile);
+ fatal_expected_char (']', c);
+ unread_char (c);
list_counter++;
- obstack_ptr_grow (&vector_stack, read_rtx_1 (infile, mode_maps));
+ obstack_ptr_grow (&vector_stack, read_nested_rtx (mode_maps));
}
if (list_counter > 0)
{
@@ -1608,8 +974,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
list_counter * sizeof (rtx));
}
else if (format_ptr[i] == 'E')
- fatal_with_file_and_line (infile,
- "vector must have at least one element");
+ fatal_with_file_and_line ("vector must have at least one element");
XVEC (return_rtx, i) = return_vec;
obstack_free (&vector_stack, NULL);
/* close bracket gotten */
@@ -1623,8 +988,8 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
char *stringbuf;
int star_if_braced;
- c = read_skip_spaces (infile);
- ungetc (c, infile);
+ c = read_skip_spaces ();
+ unread_char (c);
if (c == ')')
{
/* 'S' fields are optional and should be NULL if no string
@@ -1640,7 +1005,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
written with a brace block instead of a string constant. */
star_if_braced = (format_ptr[i] == 'T');
- stringbuf = read_string (infile, star_if_braced);
+ stringbuf = read_string (star_if_braced);
/* For insn patterns, we want to provide a default name
based on the file and line, like "*foo.md:12", if the
@@ -1652,14 +1017,14 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
|| GET_CODE (return_rtx) == DEFINE_INSN_AND_SPLIT))
{
char line_name[20];
- const char *fn = (read_rtx_filename ? read_rtx_filename : "rtx");
+ const char *fn = (read_md_filename ? read_md_filename : "rtx");
const char *slash;
for (slash = fn; *slash; slash ++)
if (*slash == '/' || *slash == '\\' || *slash == ':')
fn = slash + 1;
obstack_1grow (&string_obstack, '*');
obstack_grow (&string_obstack, fn, strlen (fn));
- sprintf (line_name, ":%d", read_rtx_lineno);
+ sprintf (line_name, ":%d", read_md_lineno);
obstack_grow (&string_obstack, line_name, strlen (line_name)+1);
stringbuf = XOBFINISH (&string_obstack, char *);
}
@@ -1672,20 +1037,20 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
break;
case 'w':
- read_name (tmp_char, infile);
- validate_const_int (infile, tmp_char);
+ read_name (&name);
+ validate_const_int (name.string);
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- tmp_wide = atoi (tmp_char);
+ tmp_wide = atoi (name.string);
#else
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
- tmp_wide = atol (tmp_char);
+ tmp_wide = atol (name.string);
#else
/* Prefer atoll over atoq, since the former is in the ISO C99 standard.
But prefer not to use our hand-rolled function above either. */
#if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ)
- tmp_wide = atoll (tmp_char);
+ tmp_wide = atoll (name.string);
#else
- tmp_wide = atoq (tmp_char);
+ tmp_wide = atoq (name.string);
#endif
#endif
#endif
@@ -1694,9 +1059,9 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
case 'i':
case 'n':
- read_name (tmp_char, infile);
- validate_const_int (infile, tmp_char);
- tmp_int = atoi (tmp_char);
+ read_name (&name);
+ validate_const_int (name.string);
+ tmp_int = atoi (name.string);
XINT (return_rtx, i) = tmp_int;
break;
@@ -1704,17 +1069,41 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
gcc_unreachable ();
}
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
+ /* Syntactic sugar for AND and IOR, allowing Lisp-like
+ arbitrary number of arguments for them. */
+ if (c == '('
+ && (GET_CODE (return_rtx) == AND
+ || GET_CODE (return_rtx) == IOR))
+ return read_rtx_variadic (mode_maps, return_rtx);
+
+ unread_char (c);
+ return return_rtx;
+}
+
+/* Read a nested rtx construct from the MD file and return it.
+ MODE_MAPS is as for iterator_traverse_data. */
+
+static rtx
+read_nested_rtx (struct map_value **mode_maps)
+{
+ struct md_name name;
+ int c;
+ rtx return_rtx;
+
+ c = read_skip_spaces ();
+ if (c != '(')
+ fatal_expected_char ('(', c);
+
+ read_name (&name);
+ if (strcmp (name.string, "nil") == 0)
+ return_rtx = NULL;
+ else
+ return_rtx = read_rtx_code (name.string, mode_maps);
+
+ c = read_skip_spaces ();
if (c != ')')
- {
- /* Syntactic sugar for AND and IOR, allowing Lisp-like
- arbitrary number of arguments for them. */
- if (c == '(' && (GET_CODE (return_rtx) == AND
- || GET_CODE (return_rtx) == IOR))
- return read_rtx_variadic (infile, mode_maps, return_rtx);
- else
- fatal_expected_char (infile, ')', c);
- }
+ fatal_expected_char (')', c);
return return_rtx;
}
@@ -1726,29 +1115,26 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
is just past the leading parenthesis of x3. Only works
for THINGs which are dyadic expressions, e.g. AND, IOR. */
static rtx
-read_rtx_variadic (FILE *infile, struct map_value **mode_maps, rtx form)
+read_rtx_variadic (struct map_value **mode_maps, rtx form)
{
char c = '(';
rtx p = form, q;
do
{
- ungetc (c, infile);
+ unread_char (c);
q = rtx_alloc (GET_CODE (p));
PUT_MODE (q, GET_MODE (p));
XEXP (q, 0) = XEXP (p, 1);
- XEXP (q, 1) = read_rtx_1 (infile, mode_maps);
+ XEXP (q, 1) = read_nested_rtx (mode_maps);
XEXP (p, 1) = q;
p = q;
- c = read_skip_spaces (infile);
+ c = read_skip_spaces ();
}
while (c == '(');
-
- if (c != ')')
- fatal_expected_char (infile, ')', c);
-
+ unread_char (c);
return form;
}
diff --git a/gcc/recog.c b/gcc/recog.c
index 1847c236fec..68485060204 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "tm_p.h"
#include "insn-config.h"
#include "insn-attr.h"
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3. If not see
#include "expr.h"
#include "function.h"
#include "flags.h"
-#include "toplev.h"
#include "basic-block.h"
#include "output.h"
#include "reload.h"
@@ -43,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "tree-pass.h"
#include "df.h"
+#include "toplev.h" /* exact_log2 may be used by targets */
#ifndef STACK_PUSH_CODE
#ifdef STACK_GROWS_DOWNWARD
@@ -1601,6 +1601,9 @@ int
asm_operand_ok (rtx op, const char *constraint, const char **constraints)
{
int result = 0;
+#ifdef AUTO_INC_DEC
+ bool incdec_ok = false;
+#endif
/* Use constrain_operands after reload. */
gcc_assert (!reload_completed);
@@ -1608,7 +1611,7 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
/* Empty constraint string is the same as "X,...,X", i.e. X for as
many alternatives as required to match the other operands. */
if (*constraint == '\0')
- return 1;
+ result = 1;
while (*constraint)
{
@@ -1685,6 +1688,9 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
|| GET_CODE (XEXP (op, 0)) == PRE_DEC
|| GET_CODE (XEXP (op, 0)) == POST_DEC))
result = 1;
+#ifdef AUTO_INC_DEC
+ incdec_ok = true;
+#endif
break;
case '>':
@@ -1693,6 +1699,9 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
|| GET_CODE (XEXP (op, 0)) == PRE_INC
|| GET_CODE (XEXP (op, 0)) == POST_INC))
result = 1;
+#ifdef AUTO_INC_DEC
+ incdec_ok = true;
+#endif
break;
case 'E':
@@ -1814,6 +1823,23 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
return 0;
}
+#ifdef AUTO_INC_DEC
+ /* For operands without < or > constraints reject side-effects. */
+ if (!incdec_ok && result && MEM_P (op))
+ switch (GET_CODE (XEXP (op, 0)))
+ {
+ case PRE_INC:
+ case POST_INC:
+ case PRE_DEC:
+ case POST_DEC:
+ case PRE_MODIFY:
+ case POST_MODIFY:
+ return 0;
+ default:
+ break;
+ }
+#endif
+
return result;
}
@@ -2039,6 +2065,7 @@ extract_insn (rtx insn)
recog_data.n_operands = 0;
recog_data.n_alternatives = 0;
recog_data.n_dups = 0;
+ recog_data.is_asm = false;
switch (GET_CODE (body))
{
@@ -2085,6 +2112,7 @@ extract_insn (rtx insn)
while (*p)
recog_data.n_alternatives += (*p++ == ',');
}
+ recog_data.is_asm = true;
break;
}
fatal_insn_not_found (insn);
@@ -2699,6 +2727,30 @@ constrain_operands (int strict)
= recog_data.operand[funny_match[funny_match_index].this_op];
}
+#ifdef AUTO_INC_DEC
+ /* For operands without < or > constraints reject side-effects. */
+ if (recog_data.is_asm)
+ {
+ for (opno = 0; opno < recog_data.n_operands; opno++)
+ if (MEM_P (recog_data.operand[opno]))
+ switch (GET_CODE (XEXP (recog_data.operand[opno], 0)))
+ {
+ case PRE_INC:
+ case POST_INC:
+ case PRE_DEC:
+ case POST_DEC:
+ case PRE_MODIFY:
+ case POST_MODIFY:
+ if (strchr (recog_data.constraints[opno], '<') == NULL
+ || strchr (recog_data.constraints[opno], '>')
+ == NULL)
+ return 0;
+ break;
+ default:
+ break;
+ }
+ }
+#endif
return 1;
}
}
@@ -2906,6 +2958,10 @@ struct peep2_insn_data
static struct peep2_insn_data peep2_insn_data[MAX_INSNS_PER_PEEP2 + 1];
static int peep2_current;
+
+static bool peep2_do_rebuild_jump_labels;
+static bool peep2_do_cleanup_cfg;
+
/* The number of instructions available to match a peep2. */
int peep2_current_count;
@@ -2914,6 +2970,16 @@ int peep2_current_count;
DF_LIVE_OUT for the block. */
#define PEEP2_EOB pc_rtx
+/* Wrap N to fit into the peep2_insn_data buffer. */
+
+static int
+peep2_buf_position (int n)
+{
+ if (n >= MAX_INSNS_PER_PEEP2 + 1)
+ n -= MAX_INSNS_PER_PEEP2 + 1;
+ return n;
+}
+
/* Return the Nth non-note insn after `current', or return NULL_RTX if it
does not exist. Used by the recognizer to find the next insn to match
in a multi-insn pattern. */
@@ -2923,9 +2989,7 @@ peep2_next_insn (int n)
{
gcc_assert (n <= peep2_current_count);
- n += peep2_current;
- if (n >= MAX_INSNS_PER_PEEP2 + 1)
- n -= MAX_INSNS_PER_PEEP2 + 1;
+ n = peep2_buf_position (peep2_current + n);
return peep2_insn_data[n].insn;
}
@@ -2938,9 +3002,7 @@ peep2_regno_dead_p (int ofs, int regno)
{
gcc_assert (ofs < MAX_INSNS_PER_PEEP2 + 1);
- ofs += peep2_current;
- if (ofs >= MAX_INSNS_PER_PEEP2 + 1)
- ofs -= MAX_INSNS_PER_PEEP2 + 1;
+ ofs = peep2_buf_position (peep2_current + ofs);
gcc_assert (peep2_insn_data[ofs].insn != NULL_RTX);
@@ -2956,9 +3018,7 @@ peep2_reg_dead_p (int ofs, rtx reg)
gcc_assert (ofs < MAX_INSNS_PER_PEEP2 + 1);
- ofs += peep2_current;
- if (ofs >= MAX_INSNS_PER_PEEP2 + 1)
- ofs -= MAX_INSNS_PER_PEEP2 + 1;
+ ofs = peep2_buf_position (peep2_current + ofs);
gcc_assert (peep2_insn_data[ofs].insn != NULL_RTX);
@@ -2993,12 +3053,8 @@ peep2_find_free_register (int from, int to, const char *class_str,
gcc_assert (from < MAX_INSNS_PER_PEEP2 + 1);
gcc_assert (to < MAX_INSNS_PER_PEEP2 + 1);
- from += peep2_current;
- if (from >= MAX_INSNS_PER_PEEP2 + 1)
- from -= MAX_INSNS_PER_PEEP2 + 1;
- to += peep2_current;
- if (to >= MAX_INSNS_PER_PEEP2 + 1)
- to -= MAX_INSNS_PER_PEEP2 + 1;
+ from = peep2_buf_position (peep2_current + from);
+ to = peep2_buf_position (peep2_current + to);
gcc_assert (peep2_insn_data[from].insn != NULL_RTX);
REG_SET_TO_HARD_REG_SET (live, peep2_insn_data[from].live_before);
@@ -3007,8 +3063,7 @@ peep2_find_free_register (int from, int to, const char *class_str,
{
HARD_REG_SET this_live;
- if (++from >= MAX_INSNS_PER_PEEP2 + 1)
- from = 0;
+ from = peep2_buf_position (from + 1);
gcc_assert (peep2_insn_data[from].insn != NULL_RTX);
REG_SET_TO_HARD_REG_SET (this_live, peep2_insn_data[from].live_before);
IOR_HARD_REG_SET (live, this_live);
@@ -3101,19 +3156,234 @@ peep2_reinit_state (regset live)
COPY_REG_SET (peep2_insn_data[MAX_INSNS_PER_PEEP2].live_before, live);
}
+/* While scanning basic block BB, we found a match of length MATCH_LEN,
+ starting at INSN. Perform the replacement, removing the old insns and
+ replacing them with ATTEMPT. Returns the last insn emitted. */
+
+static rtx
+peep2_attempt (basic_block bb, rtx insn, int match_len, rtx attempt)
+{
+ int i;
+ rtx last, note, before_try, x;
+ bool was_call = false;
+
+ /* If we are splitting a CALL_INSN, look for the CALL_INSN
+ in SEQ and copy our CALL_INSN_FUNCTION_USAGE and other
+ cfg-related call notes. */
+ for (i = 0; i <= match_len; ++i)
+ {
+ int j;
+ rtx old_insn, new_insn, note;
+
+ j = peep2_buf_position (peep2_current + i);
+ old_insn = peep2_insn_data[j].insn;
+ if (!CALL_P (old_insn))
+ continue;
+ was_call = true;
+
+ new_insn = attempt;
+ while (new_insn != NULL_RTX)
+ {
+ if (CALL_P (new_insn))
+ break;
+ new_insn = NEXT_INSN (new_insn);
+ }
+
+ gcc_assert (new_insn != NULL_RTX);
+
+ CALL_INSN_FUNCTION_USAGE (new_insn)
+ = CALL_INSN_FUNCTION_USAGE (old_insn);
+
+ for (note = REG_NOTES (old_insn);
+ note;
+ note = XEXP (note, 1))
+ switch (REG_NOTE_KIND (note))
+ {
+ case REG_NORETURN:
+ case REG_SETJMP:
+ add_reg_note (new_insn, REG_NOTE_KIND (note),
+ XEXP (note, 0));
+ break;
+ default:
+ /* Discard all other reg notes. */
+ break;
+ }
+
+ /* Croak if there is another call in the sequence. */
+ while (++i <= match_len)
+ {
+ j = peep2_buf_position (peep2_current + i);
+ old_insn = peep2_insn_data[j].insn;
+ gcc_assert (!CALL_P (old_insn));
+ }
+ break;
+ }
+
+ i = peep2_buf_position (peep2_current + match_len);
+
+ note = find_reg_note (peep2_insn_data[i].insn, REG_EH_REGION, NULL_RTX);
+
+ /* Replace the old sequence with the new. */
+ last = emit_insn_after_setloc (attempt,
+ peep2_insn_data[i].insn,
+ INSN_LOCATOR (peep2_insn_data[i].insn));
+ before_try = PREV_INSN (insn);
+ delete_insn_chain (insn, peep2_insn_data[i].insn, false);
+
+ /* Re-insert the EH_REGION notes. */
+ if (note || (was_call && nonlocal_goto_handler_labels))
+ {
+ edge eh_edge;
+ edge_iterator ei;
+
+ FOR_EACH_EDGE (eh_edge, ei, bb->succs)
+ if (eh_edge->flags & (EDGE_EH | EDGE_ABNORMAL_CALL))
+ break;
+
+ if (note)
+ copy_reg_eh_region_note_backward (note, last, before_try);
+
+ if (eh_edge)
+ for (x = last; x != before_try; x = PREV_INSN (x))
+ if (x != BB_END (bb)
+ && (can_throw_internal (x)
+ || can_nonlocal_goto (x)))
+ {
+ edge nfte, nehe;
+ int flags;
+
+ nfte = split_block (bb, x);
+ flags = (eh_edge->flags
+ & (EDGE_EH | EDGE_ABNORMAL));
+ if (CALL_P (x))
+ flags |= EDGE_ABNORMAL_CALL;
+ nehe = make_edge (nfte->src, eh_edge->dest,
+ flags);
+
+ nehe->probability = eh_edge->probability;
+ nfte->probability
+ = REG_BR_PROB_BASE - nehe->probability;
+
+ peep2_do_cleanup_cfg |= purge_dead_edges (nfte->dest);
+ bb = nfte->src;
+ eh_edge = nehe;
+ }
+
+ /* Converting possibly trapping insn to non-trapping is
+ possible. Zap dummy outgoing edges. */
+ peep2_do_cleanup_cfg |= purge_dead_edges (bb);
+ }
+
+ /* If we generated a jump instruction, it won't have
+ JUMP_LABEL set. Recompute after we're done. */
+ for (x = last; x != before_try; x = PREV_INSN (x))
+ if (JUMP_P (x))
+ {
+ peep2_do_rebuild_jump_labels = true;
+ break;
+ }
+
+ return last;
+}
+
+/* After performing a replacement in basic block BB, fix up the life
+ information in our buffer. LAST is the last of the insns that we
+ emitted as a replacement. PREV is the insn before the start of
+ the replacement. MATCH_LEN is the number of instructions that were
+ matched, and which now need to be replaced in the buffer. */
+
+static void
+peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
+{
+ int i = peep2_buf_position (peep2_current + match_len + 1);
+ rtx x;
+ regset_head live;
+
+ INIT_REG_SET (&live);
+ COPY_REG_SET (&live, peep2_insn_data[i].live_before);
+
+ gcc_assert (peep2_current_count >= match_len + 1);
+ peep2_current_count -= match_len + 1;
+
+ x = last;
+ do
+ {
+ if (INSN_P (x))
+ {
+ df_insn_rescan (x);
+ if (peep2_current_count < MAX_INSNS_PER_PEEP2)
+ {
+ peep2_current_count++;
+ if (--i < 0)
+ i = MAX_INSNS_PER_PEEP2;
+ peep2_insn_data[i].insn = x;
+ df_simulate_one_insn_backwards (bb, x, &live);
+ COPY_REG_SET (peep2_insn_data[i].live_before, &live);
+ }
+ }
+ x = PREV_INSN (x);
+ }
+ while (x != prev);
+ CLEAR_REG_SET (&live);
+
+ peep2_current = i;
+}
+
+/* Add INSN, which is in BB, at the end of the peep2 insn buffer if possible.
+ Return true if we added it, false otherwise. The caller will try to match
+ peepholes against the buffer if we return false; otherwise it will try to
+ add more instructions to the buffer. */
+
+static bool
+peep2_fill_buffer (basic_block bb, rtx insn, regset live)
+{
+ int pos;
+
+ /* Once we have filled the maximum number of insns the buffer can hold,
+ allow the caller to match the insns against peepholes. We wait until
+ the buffer is full in case the target has similar peepholes of different
+ length; we always want to match the longest if possible. */
+ if (peep2_current_count == MAX_INSNS_PER_PEEP2)
+ return false;
+
+ /* If an insn has RTX_FRAME_RELATED_P set, peephole substitution would lose
+ the REG_FRAME_RELATED_EXPR that is attached. */
+ if (RTX_FRAME_RELATED_P (insn))
+ {
+ /* Let the buffer drain first. */
+ if (peep2_current_count > 0)
+ return false;
+ /* Step over the insn then return true without adding the insn
+ to the buffer; this will cause us to process the next
+ insn. */
+ df_simulate_one_insn_forwards (bb, insn, live);
+ return true;
+ }
+
+ pos = peep2_buf_position (peep2_current + peep2_current_count);
+ peep2_insn_data[pos].insn = insn;
+ COPY_REG_SET (peep2_insn_data[pos].live_before, live);
+ peep2_current_count++;
+
+ df_simulate_one_insn_forwards (bb, insn, live);
+ return true;
+}
+
/* Perform the peephole2 optimization pass. */
static void
peephole2_optimize (void)
{
- rtx insn, prev;
+ rtx insn;
bitmap live;
int i;
basic_block bb;
- bool do_cleanup_cfg = false;
- bool do_rebuild_jump_labels = false;
+
+ peep2_do_cleanup_cfg = false;
+ peep2_do_rebuild_jump_labels = false;
df_set_flags (DF_LR_RUN_DCE);
+ df_note_add_problem ();
df_analyze ();
/* Initialize the regsets we're going to use. */
@@ -3123,214 +3393,59 @@ peephole2_optimize (void)
FOR_EACH_BB_REVERSE (bb)
{
+ bool past_end = false;
+ int pos;
+
rtl_profile_for_bb (bb);
/* Start up propagation. */
- bitmap_copy (live, DF_LR_OUT (bb));
- df_simulate_initialize_backwards (bb, live);
+ bitmap_copy (live, DF_LR_IN (bb));
+ df_simulate_initialize_forwards (bb, live);
peep2_reinit_state (live);
- for (insn = BB_END (bb); ; insn = prev)
+ insn = BB_HEAD (bb);
+ for (;;)
{
- prev = PREV_INSN (insn);
- if (NONDEBUG_INSN_P (insn))
- {
- rtx attempt, before_try, x;
- int match_len;
- rtx note;
- bool was_call = false;
-
- /* Record this insn. */
- if (--peep2_current < 0)
- peep2_current = MAX_INSNS_PER_PEEP2;
- if (peep2_current_count < MAX_INSNS_PER_PEEP2
- && peep2_insn_data[peep2_current].insn == NULL_RTX)
- peep2_current_count++;
- peep2_insn_data[peep2_current].insn = insn;
- df_simulate_one_insn_backwards (bb, insn, live);
- COPY_REG_SET (peep2_insn_data[peep2_current].live_before, live);
-
- if (RTX_FRAME_RELATED_P (insn))
- {
- /* If an insn has RTX_FRAME_RELATED_P set, peephole
- substitution would lose the
- REG_FRAME_RELATED_EXPR that is attached. */
- peep2_reinit_state (live);
- attempt = NULL;
- }
- else
- /* Match the peephole. */
- attempt = peephole2_insns (PATTERN (insn), insn, &match_len);
-
- if (attempt != NULL)
- {
- /* If we are splitting a CALL_INSN, look for the CALL_INSN
- in SEQ and copy our CALL_INSN_FUNCTION_USAGE and other
- cfg-related call notes. */
- for (i = 0; i <= match_len; ++i)
- {
- int j;
- rtx old_insn, new_insn, note;
-
- j = i + peep2_current;
- if (j >= MAX_INSNS_PER_PEEP2 + 1)
- j -= MAX_INSNS_PER_PEEP2 + 1;
- old_insn = peep2_insn_data[j].insn;
- if (!CALL_P (old_insn))
- continue;
- was_call = true;
-
- new_insn = attempt;
- while (new_insn != NULL_RTX)
- {
- if (CALL_P (new_insn))
- break;
- new_insn = NEXT_INSN (new_insn);
- }
-
- gcc_assert (new_insn != NULL_RTX);
-
- CALL_INSN_FUNCTION_USAGE (new_insn)
- = CALL_INSN_FUNCTION_USAGE (old_insn);
-
- for (note = REG_NOTES (old_insn);
- note;
- note = XEXP (note, 1))
- switch (REG_NOTE_KIND (note))
- {
- case REG_NORETURN:
- case REG_SETJMP:
- add_reg_note (new_insn, REG_NOTE_KIND (note),
- XEXP (note, 0));
- break;
- default:
- /* Discard all other reg notes. */
- break;
- }
-
- /* Croak if there is another call in the sequence. */
- while (++i <= match_len)
- {
- j = i + peep2_current;
- if (j >= MAX_INSNS_PER_PEEP2 + 1)
- j -= MAX_INSNS_PER_PEEP2 + 1;
- old_insn = peep2_insn_data[j].insn;
- gcc_assert (!CALL_P (old_insn));
- }
- break;
- }
-
- i = match_len + peep2_current;
- if (i >= MAX_INSNS_PER_PEEP2 + 1)
- i -= MAX_INSNS_PER_PEEP2 + 1;
-
- note = find_reg_note (peep2_insn_data[i].insn,
- REG_EH_REGION, NULL_RTX);
-
- /* Replace the old sequence with the new. */
- attempt = emit_insn_after_setloc (attempt,
- peep2_insn_data[i].insn,
- INSN_LOCATOR (peep2_insn_data[i].insn));
- before_try = PREV_INSN (insn);
- delete_insn_chain (insn, peep2_insn_data[i].insn, false);
+ rtx attempt, head;
+ int match_len;
- /* Re-insert the EH_REGION notes. */
- if (note || (was_call && nonlocal_goto_handler_labels))
- {
- edge eh_edge;
- edge_iterator ei;
-
- FOR_EACH_EDGE (eh_edge, ei, bb->succs)
- if (eh_edge->flags & (EDGE_EH | EDGE_ABNORMAL_CALL))
- break;
+ if (!past_end && !NONDEBUG_INSN_P (insn))
+ {
+ next_insn:
+ insn = NEXT_INSN (insn);
+ if (insn == NEXT_INSN (BB_END (bb)))
+ past_end = true;
+ continue;
+ }
+ if (!past_end && peep2_fill_buffer (bb, insn, live))
+ goto next_insn;
- if (note)
- copy_reg_eh_region_note_backward (note, attempt,
- before_try);
-
- if (eh_edge)
- for (x = attempt ; x != before_try ; x = PREV_INSN (x))
- if (x != BB_END (bb)
- && (can_throw_internal (x)
- || can_nonlocal_goto (x)))
- {
- edge nfte, nehe;
- int flags;
-
- nfte = split_block (bb, x);
- flags = (eh_edge->flags
- & (EDGE_EH | EDGE_ABNORMAL));
- if (CALL_P (x))
- flags |= EDGE_ABNORMAL_CALL;
- nehe = make_edge (nfte->src, eh_edge->dest,
- flags);
-
- nehe->probability = eh_edge->probability;
- nfte->probability
- = REG_BR_PROB_BASE - nehe->probability;
-
- do_cleanup_cfg |= purge_dead_edges (nfte->dest);
- bb = nfte->src;
- eh_edge = nehe;
- }
-
- /* Converting possibly trapping insn to non-trapping is
- possible. Zap dummy outgoing edges. */
- do_cleanup_cfg |= purge_dead_edges (bb);
- }
+ /* If we did not fill an empty buffer, it signals the end of the
+ block. */
+ if (peep2_current_count == 0)
+ break;
- if (targetm.have_conditional_execution ())
- {
- for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
- peep2_insn_data[i].insn = NULL_RTX;
- peep2_insn_data[peep2_current].insn = PEEP2_EOB;
- peep2_current_count = 0;
- }
- else
- {
- /* Back up lifetime information past the end of the
- newly created sequence. */
- if (++i >= MAX_INSNS_PER_PEEP2 + 1)
- i = 0;
- bitmap_copy (live, peep2_insn_data[i].live_before);
-
- /* Update life information for the new sequence. */
- x = attempt;
- do
- {
- if (INSN_P (x))
- {
- if (--i < 0)
- i = MAX_INSNS_PER_PEEP2;
- if (peep2_current_count < MAX_INSNS_PER_PEEP2
- && peep2_insn_data[i].insn == NULL_RTX)
- peep2_current_count++;
- peep2_insn_data[i].insn = x;
- df_insn_rescan (x);
- df_simulate_one_insn_backwards (bb, x, live);
- bitmap_copy (peep2_insn_data[i].live_before,
- live);
- }
- x = PREV_INSN (x);
- }
- while (x != prev);
+ /* The buffer filled to the current maximum, so try to match. */
- peep2_current = i;
- }
+ pos = peep2_buf_position (peep2_current + peep2_current_count);
+ peep2_insn_data[pos].insn = PEEP2_EOB;
+ COPY_REG_SET (peep2_insn_data[pos].live_before, live);
- /* If we generated a jump instruction, it won't have
- JUMP_LABEL set. Recompute after we're done. */
- for (x = attempt; x != before_try; x = PREV_INSN (x))
- if (JUMP_P (x))
- {
- do_rebuild_jump_labels = true;
- break;
- }
- }
+ /* Match the peephole. */
+ head = peep2_insn_data[peep2_current].insn;
+ attempt = peephole2_insns (PATTERN (head), head, &match_len);
+ if (attempt != NULL)
+ {
+ rtx last;
+ last = peep2_attempt (bb, head, match_len, attempt);
+ peep2_update_life (bb, match_len, last, PREV_INSN (attempt));
+ }
+ else
+ {
+ /* If no match, advance the buffer by one insn. */
+ peep2_current = peep2_buf_position (peep2_current + 1);
+ peep2_current_count--;
}
-
- if (insn == BB_HEAD (bb))
- break;
}
}
@@ -3338,7 +3453,7 @@ peephole2_optimize (void)
for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
BITMAP_FREE (peep2_insn_data[i].live_before);
BITMAP_FREE (live);
- if (do_rebuild_jump_labels)
+ if (peep2_do_rebuild_jump_labels)
rebuild_jump_labels (get_insns ());
}
#endif /* HAVE_peephole2 */
diff --git a/gcc/recog.h b/gcc/recog.h
index 5e820cc0103..71dba91fc05 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -230,6 +230,9 @@ struct recog_data
/* The number of alternatives in the constraints for the insn. */
char n_alternatives;
+ /* True if insn is ASM_OPERANDS. */
+ bool is_asm;
+
/* Specifies whether an insn alternative is enabled using the
`enabled' attribute in the insn pattern definition. For back
ends not using the `enabled' attribute the array fields are
@@ -275,7 +278,7 @@ struct insn_operand_data
#define INSN_OUTPUT_FORMAT_MULTI 2 /* const char * const * */
#define INSN_OUTPUT_FORMAT_FUNCTION 3 /* const char * (*)(...) */
-struct insn_data
+struct insn_data_d
{
const char *const name;
#if HAVE_DESIGNATED_INITIALIZERS
@@ -300,5 +303,5 @@ struct insn_data
const char output_format;
};
-extern const struct insn_data insn_data[];
+extern const struct insn_data_d insn_data[];
extern int peep2_current_count;
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 43af91dff54..e692584bb6b 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -156,14 +156,13 @@
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "tm_p.h"
#include "function.h"
#include "insn-config.h"
#include "regs.h"
#include "hard-reg-set.h"
#include "flags.h"
-#include "toplev.h"
#include "recog.h"
#include "output.h"
#include "basic-block.h"
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 4cfcf843a05..bf2d8025b3c 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -183,7 +183,7 @@ bool have_regs_of_mode [MAX_MACHINE_MODE];
char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE];
/* Maximum cost of moving from a register in one class to a register in
- another class. Based on REGISTER_MOVE_COST. */
+ another class. Based on TARGET_REGISTER_MOVE_COST. */
move_table *move_cost[MAX_MACHINE_MODE];
/* Similar, but here we don't have to move if the first index is a subset
@@ -274,7 +274,7 @@ init_move_cost (enum machine_mode m)
cost = 65535;
else
{
- cost = REGISTER_MOVE_COST (m, (enum reg_class) i,
+ cost = register_move_cost (m, (enum reg_class) i,
(enum reg_class) j);
gcc_assert (cost < 65535);
}
@@ -530,11 +530,12 @@ init_reg_sets_1 (void)
/* There are a couple of fixed registers that we know are safe to
exclude from being clobbered by calls:
- The frame pointer is always preserved across calls. The arg pointer
- is if it is fixed. The stack pointer usually is, unless
- RETURN_POPS_ARGS, in which case an explicit CLOBBER will be present.
- If we are generating PIC code, the PIC offset table register is
- preserved across calls, though the target can override that. */
+ The frame pointer is always preserved across calls. The arg
+ pointer is if it is fixed. The stack pointer usually is,
+ unless TARGET_RETURN_POPS_ARGS, in which case an explicit
+ CLOBBER will be present. If we are generating PIC code, the
+ PIC offset table register is preserved across calls, though the
+ target can override that. */
if (i == STACK_POINTER_REGNUM)
;
@@ -682,11 +683,28 @@ init_fake_stack_mems (void)
}
+/* Compute cost of moving data from a register of class FROM to one of
+ TO, using MODE. */
+
+int
+register_move_cost (enum machine_mode mode, enum reg_class from,
+ enum reg_class to)
+{
+ return targetm.register_move_cost (mode, from, to);
+}
+
+/* Compute cost of moving registers to/from memory. */
+int
+memory_move_cost (enum machine_mode mode, enum reg_class rclass, bool in)
+{
+ return targetm.memory_move_cost (mode, rclass, in);
+}
+
/* Compute extra cost of moving registers to/from memory due to reloads.
Only needed if secondary reloads are required for memory moves. */
int
memory_move_secondary_cost (enum machine_mode mode, enum reg_class rclass,
- int in)
+ bool in)
{
enum reg_class altclass;
int partial_cost = 0;
@@ -700,14 +718,14 @@ memory_move_secondary_cost (enum machine_mode mode, enum reg_class rclass,
return 0;
if (in)
- partial_cost = REGISTER_MOVE_COST (mode, altclass, rclass);
+ partial_cost = register_move_cost (mode, altclass, rclass);
else
- partial_cost = REGISTER_MOVE_COST (mode, rclass, altclass);
+ partial_cost = register_move_cost (mode, rclass, altclass);
if (rclass == altclass)
/* This isn't simply a copy-to-temporary situation. Can't guess
- what it is, so MEMORY_MOVE_COST really ought not to be calling
- here in that case.
+ what it is, so TARGET_MEMORY_MOVE_COST really ought not to be
+ calling here in that case.
I'm tempted to put in an assert here, but returning this will
probably only give poor estimates, which is what we would've
diff --git a/gcc/regrename.c b/gcc/regrename.c
index a5df6ee4f57..191e3b4278f 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -22,7 +22,7 @@
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
@@ -34,7 +34,6 @@
#include "function.h"
#include "recog.h"
#include "flags.h"
-#include "toplev.h"
#include "obstack.h"
#include "timevar.h"
#include "tree-pass.h"
diff --git a/gcc/reload.c b/gcc/reload.c
index d4b7982bc0a..ea907619aa7 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -94,7 +94,7 @@ a register with any other reload. */
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "tm_p.h"
#include "insn-config.h"
#include "expr.h"
@@ -108,10 +108,10 @@ a register with any other reload. */
#include "flags.h"
#include "output.h"
#include "function.h"
-#include "toplev.h"
#include "params.h"
#include "target.h"
#include "ira.h"
+#include "toplev.h" /* exact_log2 may be used by targets */
/* True if X is a constant that can be forced into the constant pool. */
#define CONST_POOL_OK_P(X) \
@@ -363,7 +363,8 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
sri.icode = CODE_FOR_nothing;
sri.prev_sri = prev_sri;
- rclass = targetm.secondary_reload (in_p, x, reload_class, reload_mode, &sri);
+ rclass = (enum reg_class) targetm.secondary_reload (in_p, x, reload_class,
+ reload_mode, &sri);
icode = (enum insn_code) sri.icode;
/* If we don't need any secondary registers, done. */
@@ -526,7 +527,8 @@ secondary_reload_class (bool in_p, enum reg_class rclass,
sri.icode = CODE_FOR_nothing;
sri.prev_sri = NULL;
- rclass = targetm.secondary_reload (in_p, x, rclass, mode, &sri);
+ rclass
+ = (enum reg_class) targetm.secondary_reload (in_p, x, rclass, mode, &sri);
icode = (enum insn_code) sri.icode;
/* If there are no secondary reloads at all, we return NO_REGS.
@@ -688,7 +690,7 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED,
if (bad || !good)
continue;
- cost = REGISTER_MOVE_COST (outer, (enum reg_class) rclass, dest_class);
+ cost = register_move_cost (outer, (enum reg_class) rclass, dest_class);
if ((reg_class_size[rclass] > best_size
&& (best_cost < 0 || best_cost >= cost))
@@ -696,7 +698,7 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED,
{
best_class = (enum reg_class) rclass;
best_size = reg_class_size[rclass];
- best_cost = REGISTER_MOVE_COST (outer, (enum reg_class) rclass,
+ best_cost = register_move_cost (outer, (enum reg_class) rclass,
dest_class);
}
}
@@ -2651,7 +2653,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
&& REGNO (SET_DEST (body)) < FIRST_PSEUDO_REGISTER
&& REG_P (SET_SRC (body))
&& REGNO (SET_SRC (body)) < FIRST_PSEUDO_REGISTER
- && REGISTER_MOVE_COST (GET_MODE (SET_SRC (body)),
+ && register_move_cost (GET_MODE (SET_SRC (body)),
REGNO_REG_CLASS (REGNO (SET_SRC (body))),
REGNO_REG_CLASS (REGNO (SET_DEST (body)))) == 2)
return 0;
diff --git a/gcc/reload.h b/gcc/reload.h
index a28567014d3..a3c1f07bd9f 100644
--- a/gcc/reload.h
+++ b/gcc/reload.h
@@ -30,12 +30,11 @@ along with GCC; see the file COPYING3. If not see
SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
#endif
-/* If MEMORY_MOVE_COST isn't defined, give it a default here. */
-#ifndef MEMORY_MOVE_COST
-#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
- (4 + memory_move_secondary_cost ((MODE), (CLASS), (IN)))
-#endif
-extern int memory_move_secondary_cost (enum machine_mode, enum reg_class, int);
+extern int register_move_cost (enum machine_mode, enum reg_class,
+ enum reg_class);
+extern int memory_move_cost (enum machine_mode, enum reg_class, bool);
+extern int memory_move_secondary_cost (enum machine_mode, enum reg_class,
+ bool);
/* Maximum number of reloads we can need. */
#define MAX_RELOADS (2 * MAX_RECOG_OPERANDS * (MAX_REGS_PER_ADDRESS + 1))
@@ -349,6 +348,10 @@ extern void mark_home_live (int);
extern rtx eliminate_regs (rtx, enum machine_mode, rtx);
extern bool elimination_target_reg_p (rtx);
+/* Called from the register allocator to estimate costs of eliminating
+ invariant registers. */
+extern void calculate_elim_costs_all_insns (void);
+
/* Deallocate the reload register used by reload number R. */
extern void deallocate_reload_reg (int r);
diff --git a/gcc/reload1.c b/gcc/reload1.c
index f385fbb757a..412f45d10d8 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "machmode.h"
#include "hard-reg-set.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "tm_p.h"
#include "obstack.h"
#include "insn-config.h"
@@ -41,7 +41,6 @@ along with GCC; see the file COPYING3. If not see
#include "reload.h"
#include "recog.h"
#include "output.h"
-#include "toplev.h"
#include "except.h"
#include "tree.h"
#include "ira.h"
@@ -412,6 +411,7 @@ static void alter_reg (int, int, bool);
static void set_label_offsets (rtx, rtx, int);
static void check_eliminable_occurrences (rtx);
static void elimination_effects (rtx, enum machine_mode);
+static rtx eliminate_regs_1 (rtx, enum machine_mode, rtx, bool, bool);
static int eliminate_regs_in_insn (rtx, int);
static void update_eliminable_offsets (void);
static void mark_not_eliminable (rtx, const_rtx, void *);
@@ -419,8 +419,11 @@ static void set_initial_elim_offsets (void);
static bool verify_initial_elim_offsets (void);
static void set_initial_label_offsets (void);
static void set_offsets_for_label (rtx);
+static void init_eliminable_invariants (rtx, bool);
static void init_elim_table (void);
+static void free_reg_equiv (void);
static void update_eliminables (HARD_REG_SET *);
+static void elimination_costs_in_insn (rtx);
static void spill_hard_reg (unsigned int, int);
static int finish_spills (int);
static void scan_paradoxical_subregs (rtx);
@@ -697,6 +700,9 @@ has_nonexceptional_receiver (void)
/* Global variables used by reload and its subroutines. */
+/* The current basic block while in calculate_elim_costs_all_insns. */
+static basic_block elim_bb;
+
/* Set during calculate_needs if an insn needs register elimination. */
static int something_needs_elimination;
/* Set during calculate_needs if an insn needs an operand changed. */
@@ -777,22 +783,6 @@ reload (rtx first, int global)
if (! call_used_regs[i] && ! fixed_regs[i] && ! LOCAL_REGNO (i))
df_set_regs_ever_live (i, true);
- /* Find all the pseudo registers that didn't get hard regs
- but do have known equivalent constants or memory slots.
- These include parameters (known equivalent to parameter slots)
- and cse'd or loop-moved constant memory addresses.
-
- Record constant equivalents in reg_equiv_constant
- so they will be substituted by find_reloads.
- Record memory equivalents in reg_mem_equiv so they can
- be substituted eventually by altering the REG-rtx's. */
-
- reg_equiv_constant = XCNEWVEC (rtx, max_regno);
- reg_equiv_invariant = XCNEWVEC (rtx, max_regno);
- reg_equiv_mem = XCNEWVEC (rtx, max_regno);
- reg_equiv_alt_mem_list = XCNEWVEC (rtx, max_regno);
- reg_equiv_address = XCNEWVEC (rtx, max_regno);
- reg_max_ref_width = XCNEWVEC (unsigned int, max_regno);
reg_old_renumber = XCNEWVEC (short, max_regno);
memcpy (reg_old_renumber, reg_renumber, max_regno * sizeof (short));
pseudo_forbidden_regs = XNEWVEC (HARD_REG_SET, max_regno);
@@ -800,115 +790,9 @@ reload (rtx first, int global)
CLEAR_HARD_REG_SET (bad_spill_regs_global);
- /* Look for REG_EQUIV notes; record what each pseudo is equivalent
- to. Also find all paradoxical subregs and find largest such for
- each pseudo. */
-
- num_eliminable_invariants = 0;
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- rtx set = single_set (insn);
-
- /* We may introduce USEs that we want to remove at the end, so
- we'll mark them with QImode. Make sure there are no
- previously-marked insns left by say regmove. */
- if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE
- && GET_MODE (insn) != VOIDmode)
- PUT_MODE (insn, VOIDmode);
-
- if (NONDEBUG_INSN_P (insn))
- scan_paradoxical_subregs (PATTERN (insn));
-
- if (set != 0 && REG_P (SET_DEST (set)))
- {
- rtx note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
- rtx x;
-
- if (! note)
- continue;
-
- i = REGNO (SET_DEST (set));
- x = XEXP (note, 0);
-
- if (i <= LAST_VIRTUAL_REGISTER)
- continue;
-
- if (! function_invariant_p (x)
- || ! flag_pic
- /* A function invariant is often CONSTANT_P but may
- include a register. We promise to only pass
- CONSTANT_P objects to LEGITIMATE_PIC_OPERAND_P. */
- || (CONSTANT_P (x)
- && LEGITIMATE_PIC_OPERAND_P (x)))
- {
- /* It can happen that a REG_EQUIV note contains a MEM
- that is not a legitimate memory operand. As later
- stages of reload assume that all addresses found
- in the reg_equiv_* arrays were originally legitimate,
- we ignore such REG_EQUIV notes. */
- if (memory_operand (x, VOIDmode))
- {
- /* Always unshare the equivalence, so we can
- substitute into this insn without touching the
- equivalence. */
- reg_equiv_memory_loc[i] = copy_rtx (x);
- }
- else if (function_invariant_p (x))
- {
- if (GET_CODE (x) == PLUS)
- {
- /* This is PLUS of frame pointer and a constant,
- and might be shared. Unshare it. */
- reg_equiv_invariant[i] = copy_rtx (x);
- num_eliminable_invariants++;
- }
- else if (x == frame_pointer_rtx || x == arg_pointer_rtx)
- {
- reg_equiv_invariant[i] = x;
- num_eliminable_invariants++;
- }
- else if (LEGITIMATE_CONSTANT_P (x))
- reg_equiv_constant[i] = x;
- else
- {
- reg_equiv_memory_loc[i]
- = force_const_mem (GET_MODE (SET_DEST (set)), x);
- if (! reg_equiv_memory_loc[i])
- reg_equiv_init[i] = NULL_RTX;
- }
- }
- else
- {
- reg_equiv_init[i] = NULL_RTX;
- continue;
- }
- }
- else
- reg_equiv_init[i] = NULL_RTX;
- }
- }
-
- if (dump_file)
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_equiv_init[i])
- {
- fprintf (dump_file, "init_insns for %u: ", i);
- print_inline_rtx (dump_file, reg_equiv_init[i], 20);
- fprintf (dump_file, "\n");
- }
-
+ init_eliminable_invariants (first, true);
init_elim_table ();
- first_label_num = get_first_label_num ();
- num_labels = max_label_num () - first_label_num;
-
- /* Allocate the tables used to store offset information at labels. */
- /* We used to use alloca here, but the size of what it would try to
- allocate would occasionally cause it to exceed the stack limit and
- cause a core dump. */
- offsets_known_at = XNEWVEC (char, num_labels);
- offsets_at = (HOST_WIDE_INT (*)[NUM_ELIMINABLE_REGS]) xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (HOST_WIDE_INT));
-
/* Alter each pseudo-reg rtx to contain its hard reg number. Assign
stack slots to the pseudos that lack hard regs or equivalents.
Do not touch virtual registers. */
@@ -1413,31 +1297,11 @@ reload (rtx first, int global)
}
}
- /* Indicate that we no longer have known memory locations or constants. */
- if (reg_equiv_constant)
- free (reg_equiv_constant);
- if (reg_equiv_invariant)
- free (reg_equiv_invariant);
- reg_equiv_constant = 0;
- reg_equiv_invariant = 0;
- VEC_free (rtx, gc, reg_equiv_memory_loc_vec);
- reg_equiv_memory_loc = 0;
-
free (temp_pseudo_reg_arr);
- if (offsets_known_at)
- free (offsets_known_at);
- if (offsets_at)
- free (offsets_at);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (reg_equiv_alt_mem_list[i])
- free_EXPR_LIST_list (&reg_equiv_alt_mem_list[i]);
- free (reg_equiv_alt_mem_list);
-
- free (reg_equiv_mem);
+ /* Indicate that we no longer have known memory locations or constants. */
+ free_reg_equiv ();
reg_equiv_init = 0;
- free (reg_equiv_address);
free (reg_max_ref_width);
free (reg_old_renumber);
free (pseudo_previous_regs);
@@ -1730,6 +1594,100 @@ calculate_needs_all_insns (int global)
*pprev_reload = 0;
}
+/* This function is called from the register allocator to set up estimates
+ for the cost of eliminating pseudos which have REG_EQUIV equivalences to
+ an invariant. The structure is similar to calculate_needs_all_insns. */
+
+void
+calculate_elim_costs_all_insns (void)
+{
+ int *reg_equiv_init_cost;
+ basic_block bb;
+ int i;
+
+ reg_equiv_init_cost = XCNEWVEC (int, max_regno);
+ init_elim_table ();
+ init_eliminable_invariants (get_insns (), false);
+
+ set_initial_elim_offsets ();
+ set_initial_label_offsets ();
+
+ FOR_EACH_BB (bb)
+ {
+ rtx insn;
+ elim_bb = bb;
+
+ FOR_BB_INSNS (bb, insn)
+ {
+ /* If this is a label, a JUMP_INSN, or has REG_NOTES (which might
+ include REG_LABEL_OPERAND and REG_LABEL_TARGET), we need to see
+ what effects this has on the known offsets at labels. */
+
+ if (LABEL_P (insn) || JUMP_P (insn)
+ || (INSN_P (insn) && REG_NOTES (insn) != 0))
+ set_label_offsets (insn, insn, 0);
+
+ if (INSN_P (insn))
+ {
+ rtx set = single_set (insn);
+
+ /* Skip insns that only set an equivalence. */
+ if (set && REG_P (SET_DEST (set))
+ && reg_renumber[REGNO (SET_DEST (set))] < 0
+ && (reg_equiv_constant[REGNO (SET_DEST (set))]
+ || (reg_equiv_invariant[REGNO (SET_DEST (set))])))
+ {
+ unsigned regno = REGNO (SET_DEST (set));
+ rtx init = reg_equiv_init[regno];
+ if (init)
+ {
+ rtx t = eliminate_regs_1 (SET_SRC (set), VOIDmode, insn,
+ false, true);
+ int cost = rtx_cost (t, SET,
+ optimize_bb_for_speed_p (bb));
+ int freq = REG_FREQ_FROM_BB (bb);
+
+ reg_equiv_init_cost[regno] = cost * freq;
+ continue;
+ }
+ }
+ /* If needed, eliminate any eliminable registers. */
+ if (num_eliminable || num_eliminable_invariants)
+ elimination_costs_in_insn (insn);
+
+ if (num_eliminable)
+ update_eliminable_offsets ();
+ }
+ }
+ }
+ for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
+ {
+ if (reg_equiv_invariant[i])
+ {
+ if (reg_equiv_init[i])
+ {
+ int cost = reg_equiv_init_cost[i];
+ if (dump_file)
+ fprintf (dump_file,
+ "Reg %d has equivalence, initial gains %d\n", i, cost);
+ if (cost != 0)
+ ira_adjust_equiv_reg_cost (i, cost);
+ }
+ else
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Reg %d had equivalence, but can't be eliminated\n",
+ i);
+ ira_adjust_equiv_reg_cost (i, 0);
+ }
+ }
+ }
+
+ free_reg_equiv ();
+ free (reg_equiv_init_cost);
+}
+
/* Comparison function for qsort to decide which of two reloads
should be handled first. *P1 and *P2 are the reload numbers. */
@@ -2518,6 +2476,36 @@ set_label_offsets (rtx x, rtx insn, int initial_p)
}
}
+/* Called through for_each_rtx, this function examines every reg that occurs
+ in PX and adjusts the costs for its elimination which are gathered by IRA.
+ DATA is the insn in which PX occurs. We do not recurse into MEM
+ expressions. */
+
+static int
+note_reg_elim_costly (rtx *px, void *data)
+{
+ rtx insn = (rtx)data;
+ rtx x = *px;
+
+ if (MEM_P (x))
+ return -1;
+
+ if (REG_P (x)
+ && REGNO (x) >= FIRST_PSEUDO_REGISTER
+ && reg_equiv_init[REGNO (x)]
+ && reg_equiv_invariant[REGNO (x)])
+ {
+ rtx t = reg_equiv_invariant[REGNO (x)];
+ rtx new_rtx = eliminate_regs_1 (t, Pmode, insn, true, true);
+ int cost = rtx_cost (new_rtx, SET, optimize_bb_for_speed_p (elim_bb));
+ int freq = REG_FREQ_FROM_BB (elim_bb);
+
+ if (cost != 0)
+ ira_adjust_equiv_reg_cost (REGNO (x), -cost * freq);
+ }
+ return 0;
+}
+
/* Scan X and replace any eliminable registers (such as fp) with a
replacement (such as sp), plus an offset.
@@ -2537,6 +2525,9 @@ set_label_offsets (rtx x, rtx insn, int initial_p)
This means, do not set ref_outside_mem even if the reference
is outside of MEMs.
+ If FOR_COSTS is true, we are being called before reload in order to
+ estimate the costs of keeping registers with an equivalence unallocated.
+
REG_EQUIV_MEM and REG_EQUIV_ADDRESS contain address that have had
replacements done assuming all offsets are at their initial values. If
they are not, or if REG_EQUIV_ADDRESS is nonzero for a pseudo we
@@ -2545,7 +2536,7 @@ set_label_offsets (rtx x, rtx insn, int initial_p)
static rtx
eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
- bool may_use_invariant)
+ bool may_use_invariant, bool for_costs)
{
enum rtx_code code = GET_CODE (x);
struct elim_table *ep;
@@ -2593,11 +2584,12 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
{
if (may_use_invariant || (insn && DEBUG_INSN_P (insn)))
return eliminate_regs_1 (copy_rtx (reg_equiv_invariant[regno]),
- mem_mode, insn, true);
+ mem_mode, insn, true, for_costs);
/* There exists at least one use of REGNO that cannot be
eliminated. Prevent the defining insn from being deleted. */
reg_equiv_init[regno] = NULL_RTX;
- alter_reg (regno, -1, true);
+ if (!for_costs)
+ alter_reg (regno, -1, true);
}
return x;
@@ -2658,8 +2650,10 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
operand of a load-address insn. */
{
- rtx new0 = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true);
- rtx new1 = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true);
+ rtx new0 = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true,
+ for_costs);
+ rtx new1 = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true,
+ for_costs);
if (reg_renumber && (new0 != XEXP (x, 0) || new1 != XEXP (x, 1)))
{
@@ -2733,9 +2727,11 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
case GE: case GT: case GEU: case GTU:
case LE: case LT: case LEU: case LTU:
{
- rtx new0 = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false);
+ rtx new0 = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false,
+ for_costs);
rtx new1 = XEXP (x, 1)
- ? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, false) : 0;
+ ? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, false,
+ for_costs) : 0;
if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1))
return gen_rtx_fmt_ee (code, GET_MODE (x), new0, new1);
@@ -2746,7 +2742,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
/* If we have something in XEXP (x, 0), the usual case, eliminate it. */
if (XEXP (x, 0))
{
- new_rtx = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true);
+ new_rtx = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true,
+ for_costs);
if (new_rtx != XEXP (x, 0))
{
/* If this is a REG_DEAD note, it is not valid anymore.
@@ -2754,7 +2751,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
REG_DEAD note for the stack or frame pointer. */
if (REG_NOTE_KIND (x) == REG_DEAD)
return (XEXP (x, 1)
- ? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true)
+ ? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true,
+ for_costs)
: NULL_RTX);
x = alloc_reg_note (REG_NOTE_KIND (x), new_rtx, XEXP (x, 1));
@@ -2769,7 +2767,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
strictly needed, but it simplifies the code. */
if (XEXP (x, 1))
{
- new_rtx = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true);
+ new_rtx = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true,
+ for_costs);
if (new_rtx != XEXP (x, 1))
return
gen_rtx_fmt_ee (GET_CODE (x), GET_MODE (x), XEXP (x, 0), new_rtx);
@@ -2795,7 +2794,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
&& XEXP (XEXP (x, 1), 0) == XEXP (x, 0))
{
rtx new_rtx = eliminate_regs_1 (XEXP (XEXP (x, 1), 1), mem_mode,
- insn, true);
+ insn, true, for_costs);
if (new_rtx != XEXP (XEXP (x, 1), 1))
return gen_rtx_fmt_ee (code, GET_MODE (x), XEXP (x, 0),
@@ -2818,7 +2817,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
case POPCOUNT:
case PARITY:
case BSWAP:
- new_rtx = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false);
+ new_rtx = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false,
+ for_costs);
if (new_rtx != XEXP (x, 0))
return gen_rtx_fmt_e (code, GET_MODE (x), new_rtx);
return x;
@@ -2839,7 +2839,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
new_rtx = SUBREG_REG (x);
}
else
- new_rtx = eliminate_regs_1 (SUBREG_REG (x), mem_mode, insn, false);
+ new_rtx = eliminate_regs_1 (SUBREG_REG (x), mem_mode, insn, false,
+ for_costs);
if (new_rtx != SUBREG_REG (x))
{
@@ -2873,14 +2874,20 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
/* Our only special processing is to pass the mode of the MEM to our
recursive call and copy the flags. While we are here, handle this
case more efficiently. */
- return
- replace_equiv_address_nv (x,
- eliminate_regs_1 (XEXP (x, 0), GET_MODE (x),
- insn, true));
+
+ new_rtx = eliminate_regs_1 (XEXP (x, 0), GET_MODE (x), insn, true,
+ for_costs);
+ if (for_costs
+ && memory_address_p (GET_MODE (x), XEXP (x, 0))
+ && !memory_address_p (GET_MODE (x), new_rtx))
+ for_each_rtx (&XEXP (x, 0), note_reg_elim_costly, insn);
+
+ return replace_equiv_address_nv (x, new_rtx);
case USE:
/* Handle insn_list USE that a call to a pure function may generate. */
- new_rtx = eliminate_regs_1 (XEXP (x, 0), VOIDmode, insn, false);
+ new_rtx = eliminate_regs_1 (XEXP (x, 0), VOIDmode, insn, false,
+ for_costs);
if (new_rtx != XEXP (x, 0))
return gen_rtx_USE (GET_MODE (x), new_rtx);
return x;
@@ -2904,7 +2911,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
{
if (*fmt == 'e')
{
- new_rtx = eliminate_regs_1 (XEXP (x, i), mem_mode, insn, false);
+ new_rtx = eliminate_regs_1 (XEXP (x, i), mem_mode, insn, false,
+ for_costs);
if (new_rtx != XEXP (x, i) && ! copied)
{
x = shallow_copy_rtx (x);
@@ -2917,7 +2925,8 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
int copied_vec = 0;
for (j = 0; j < XVECLEN (x, i); j++)
{
- new_rtx = eliminate_regs_1 (XVECEXP (x, i, j), mem_mode, insn, false);
+ new_rtx = eliminate_regs_1 (XVECEXP (x, i, j), mem_mode, insn, false,
+ for_costs);
if (new_rtx != XVECEXP (x, i, j) && ! copied_vec)
{
rtvec new_v = gen_rtvec_v (XVECLEN (x, i),
@@ -2941,7 +2950,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
rtx
eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
{
- return eliminate_regs_1 (x, mem_mode, insn, false);
+ return eliminate_regs_1 (x, mem_mode, insn, false, false);
}
/* Scan rtx X for modifications of elimination target registers. Update
@@ -3459,7 +3468,8 @@ eliminate_regs_in_insn (rtx insn, int replace)
/* Companion to the above plus substitution, we can allow
invariants as the source of a plain move. */
is_set_src = false;
- if (old_set && recog_data.operand_loc[i] == &SET_SRC (old_set))
+ if (old_set
+ && recog_data.operand_loc[i] == &SET_SRC (old_set))
is_set_src = true;
in_plus = false;
if (plus_src
@@ -3470,7 +3480,7 @@ eliminate_regs_in_insn (rtx insn, int replace)
substed_operand[i]
= eliminate_regs_1 (recog_data.operand[i], VOIDmode,
replace ? insn : NULL_RTX,
- is_set_src || in_plus);
+ is_set_src || in_plus, false);
if (substed_operand[i] != orig_operand[i])
val = 1;
/* Terminate the search in check_eliminable_occurrences at
@@ -3601,11 +3611,167 @@ eliminate_regs_in_insn (rtx insn, int replace)
the pre-passes. */
if (val && REG_NOTES (insn) != 0)
REG_NOTES (insn)
- = eliminate_regs_1 (REG_NOTES (insn), VOIDmode, REG_NOTES (insn), true);
+ = eliminate_regs_1 (REG_NOTES (insn), VOIDmode, REG_NOTES (insn), true,
+ false);
return val;
}
+/* Like eliminate_regs_in_insn, but only estimate costs for the use of the
+ register allocator. INSN is the instruction we need to examine, we perform
+ eliminations in its operands and record cases where eliminating a reg with
+ an invariant equivalence would add extra cost. */
+
+static void
+elimination_costs_in_insn (rtx insn)
+{
+ int icode = recog_memoized (insn);
+ rtx old_body = PATTERN (insn);
+ int insn_is_asm = asm_noperands (old_body) >= 0;
+ rtx old_set = single_set (insn);
+ int i;
+ rtx orig_operand[MAX_RECOG_OPERANDS];
+ rtx orig_dup[MAX_RECOG_OPERANDS];
+ struct elim_table *ep;
+ rtx plus_src, plus_cst_src;
+ bool sets_reg_p;
+
+ if (! insn_is_asm && icode < 0)
+ {
+ gcc_assert (GET_CODE (PATTERN (insn)) == USE
+ || GET_CODE (PATTERN (insn)) == CLOBBER
+ || GET_CODE (PATTERN (insn)) == ADDR_VEC
+ || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
+ || GET_CODE (PATTERN (insn)) == ASM_INPUT
+ || DEBUG_INSN_P (insn));
+ return;
+ }
+
+ if (old_set != 0 && REG_P (SET_DEST (old_set))
+ && REGNO (SET_DEST (old_set)) < FIRST_PSEUDO_REGISTER)
+ {
+ /* Check for setting an eliminable register. */
+ for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
+ if (ep->from_rtx == SET_DEST (old_set) && ep->can_eliminate)
+ return;
+ }
+
+ /* We allow one special case which happens to work on all machines we
+ currently support: a single set with the source or a REG_EQUAL
+ note being a PLUS of an eliminable register and a constant. */
+ plus_src = plus_cst_src = 0;
+ sets_reg_p = false;
+ if (old_set && REG_P (SET_DEST (old_set)))
+ {
+ sets_reg_p = true;
+ if (GET_CODE (SET_SRC (old_set)) == PLUS)
+ plus_src = SET_SRC (old_set);
+ /* First see if the source is of the form (plus (...) CST). */
+ if (plus_src
+ && CONST_INT_P (XEXP (plus_src, 1)))
+ plus_cst_src = plus_src;
+ else if (REG_P (SET_SRC (old_set))
+ || plus_src)
+ {
+ /* Otherwise, see if we have a REG_EQUAL note of the form
+ (plus (...) CST). */
+ rtx links;
+ for (links = REG_NOTES (insn); links; links = XEXP (links, 1))
+ {
+ if ((REG_NOTE_KIND (links) == REG_EQUAL
+ || REG_NOTE_KIND (links) == REG_EQUIV)
+ && GET_CODE (XEXP (links, 0)) == PLUS
+ && CONST_INT_P (XEXP (XEXP (links, 0), 1)))
+ {
+ plus_cst_src = XEXP (links, 0);
+ break;
+ }
+ }
+ }
+ }
+
+ /* Determine the effects of this insn on elimination offsets. */
+ elimination_effects (old_body, VOIDmode);
+
+ /* Eliminate all eliminable registers occurring in operands that
+ can be handled by reload. */
+ extract_insn (insn);
+ for (i = 0; i < recog_data.n_dups; i++)
+ orig_dup[i] = *recog_data.dup_loc[i];
+
+ for (i = 0; i < recog_data.n_operands; i++)
+ {
+ orig_operand[i] = recog_data.operand[i];
+
+ /* For an asm statement, every operand is eliminable. */
+ if (insn_is_asm || insn_data[icode].operand[i].eliminable)
+ {
+ bool is_set_src, in_plus;
+
+ /* Check for setting a register that we know about. */
+ if (recog_data.operand_type[i] != OP_IN
+ && REG_P (orig_operand[i]))
+ {
+ /* If we are assigning to a register that can be eliminated, it
+ must be as part of a PARALLEL, since the code above handles
+ single SETs. We must indicate that we can no longer
+ eliminate this reg. */
+ for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
+ ep++)
+ if (ep->from_rtx == orig_operand[i])
+ ep->can_eliminate = 0;
+ }
+
+ /* Companion to the above plus substitution, we can allow
+ invariants as the source of a plain move. */
+ is_set_src = false;
+ if (old_set && recog_data.operand_loc[i] == &SET_SRC (old_set))
+ is_set_src = true;
+ if (is_set_src && !sets_reg_p)
+ note_reg_elim_costly (&SET_SRC (old_set), insn);
+ in_plus = false;
+ if (plus_src && sets_reg_p
+ && (recog_data.operand_loc[i] == &XEXP (plus_src, 0)
+ || recog_data.operand_loc[i] == &XEXP (plus_src, 1)))
+ in_plus = true;
+
+ eliminate_regs_1 (recog_data.operand[i], VOIDmode,
+ NULL_RTX,
+ is_set_src || in_plus, true);
+ /* Terminate the search in check_eliminable_occurrences at
+ this point. */
+ *recog_data.operand_loc[i] = 0;
+ }
+ }
+
+ for (i = 0; i < recog_data.n_dups; i++)
+ *recog_data.dup_loc[i]
+ = *recog_data.operand_loc[(int) recog_data.dup_num[i]];
+
+ /* If any eliminable remain, they aren't eliminable anymore. */
+ check_eliminable_occurrences (old_body);
+
+ /* Restore the old body. */
+ for (i = 0; i < recog_data.n_operands; i++)
+ *recog_data.operand_loc[i] = orig_operand[i];
+ for (i = 0; i < recog_data.n_dups; i++)
+ *recog_data.dup_loc[i] = orig_dup[i];
+
+ /* Update all elimination pairs to reflect the status after the current
+ insn. The changes we make were determined by the earlier call to
+ elimination_effects. */
+
+ for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
+ {
+ if (ep->previous_offset != ep->offset && ep->ref_outside_mem)
+ ep->can_eliminate = 0;
+
+ ep->ref_outside_mem = 0;
+ }
+
+ return;
+}
+
/* Loop through all elimination pairs.
Recalculate the number not at initial offset.
@@ -3915,6 +4081,168 @@ init_elim_table (void)
ep->to_rtx = gen_rtx_REG (Pmode, ep->to);
}
}
+
+/* Find all the pseudo registers that didn't get hard regs
+ but do have known equivalent constants or memory slots.
+ These include parameters (known equivalent to parameter slots)
+ and cse'd or loop-moved constant memory addresses.
+
+ Record constant equivalents in reg_equiv_constant
+ so they will be substituted by find_reloads.
+ Record memory equivalents in reg_mem_equiv so they can
+ be substituted eventually by altering the REG-rtx's. */
+
+static void
+init_eliminable_invariants (rtx first, bool do_subregs)
+{
+ int i;
+ rtx insn;
+
+ reg_equiv_constant = XCNEWVEC (rtx, max_regno);
+ reg_equiv_invariant = XCNEWVEC (rtx, max_regno);
+ reg_equiv_mem = XCNEWVEC (rtx, max_regno);
+ reg_equiv_alt_mem_list = XCNEWVEC (rtx, max_regno);
+ reg_equiv_address = XCNEWVEC (rtx, max_regno);
+ if (do_subregs)
+ reg_max_ref_width = XCNEWVEC (unsigned int, max_regno);
+ else
+ reg_max_ref_width = NULL;
+
+ num_eliminable_invariants = 0;
+
+ first_label_num = get_first_label_num ();
+ num_labels = max_label_num () - first_label_num;
+
+ /* Allocate the tables used to store offset information at labels. */
+ offsets_known_at = XNEWVEC (char, num_labels);
+ offsets_at = (HOST_WIDE_INT (*)[NUM_ELIMINABLE_REGS]) xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (HOST_WIDE_INT));
+
+/* Look for REG_EQUIV notes; record what each pseudo is equivalent
+ to. If DO_SUBREGS is true, also find all paradoxical subregs and
+ find largest such for each pseudo. FIRST is the head of the insn
+ list. */
+
+ for (insn = first; insn; insn = NEXT_INSN (insn))
+ {
+ rtx set = single_set (insn);
+
+ /* We may introduce USEs that we want to remove at the end, so
+ we'll mark them with QImode. Make sure there are no
+ previously-marked insns left by say regmove. */
+ if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE
+ && GET_MODE (insn) != VOIDmode)
+ PUT_MODE (insn, VOIDmode);
+
+ if (do_subregs && NONDEBUG_INSN_P (insn))
+ scan_paradoxical_subregs (PATTERN (insn));
+
+ if (set != 0 && REG_P (SET_DEST (set)))
+ {
+ rtx note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
+ rtx x;
+
+ if (! note)
+ continue;
+
+ i = REGNO (SET_DEST (set));
+ x = XEXP (note, 0);
+
+ if (i <= LAST_VIRTUAL_REGISTER)
+ continue;
+
+ /* If flag_pic and we have constant, verify it's legitimate. */
+ if (!CONSTANT_P (x)
+ || !flag_pic || LEGITIMATE_PIC_OPERAND_P (x))
+ {
+ /* It can happen that a REG_EQUIV note contains a MEM
+ that is not a legitimate memory operand. As later
+ stages of reload assume that all addresses found
+ in the reg_equiv_* arrays were originally legitimate,
+ we ignore such REG_EQUIV notes. */
+ if (memory_operand (x, VOIDmode))
+ {
+ /* Always unshare the equivalence, so we can
+ substitute into this insn without touching the
+ equivalence. */
+ reg_equiv_memory_loc[i] = copy_rtx (x);
+ }
+ else if (function_invariant_p (x))
+ {
+ if (GET_CODE (x) == PLUS)
+ {
+ /* This is PLUS of frame pointer and a constant,
+ and might be shared. Unshare it. */
+ reg_equiv_invariant[i] = copy_rtx (x);
+ num_eliminable_invariants++;
+ }
+ else if (x == frame_pointer_rtx || x == arg_pointer_rtx)
+ {
+ reg_equiv_invariant[i] = x;
+ num_eliminable_invariants++;
+ }
+ else if (LEGITIMATE_CONSTANT_P (x))
+ reg_equiv_constant[i] = x;
+ else
+ {
+ reg_equiv_memory_loc[i]
+ = force_const_mem (GET_MODE (SET_DEST (set)), x);
+ if (! reg_equiv_memory_loc[i])
+ reg_equiv_init[i] = NULL_RTX;
+ }
+ }
+ else
+ {
+ reg_equiv_init[i] = NULL_RTX;
+ continue;
+ }
+ }
+ else
+ reg_equiv_init[i] = NULL_RTX;
+ }
+ }
+
+ if (dump_file)
+ for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
+ if (reg_equiv_init[i])
+ {
+ fprintf (dump_file, "init_insns for %u: ", i);
+ print_inline_rtx (dump_file, reg_equiv_init[i], 20);
+ fprintf (dump_file, "\n");
+ }
+}
+
+/* Indicate that we no longer have known memory locations or constants.
+ Free all data involved in tracking these. */
+
+static void
+free_reg_equiv (void)
+{
+ int i;
+
+ if (reg_equiv_constant)
+ free (reg_equiv_constant);
+ if (reg_equiv_invariant)
+ free (reg_equiv_invariant);
+ reg_equiv_constant = 0;
+ reg_equiv_invariant = 0;
+ VEC_free (rtx, gc, reg_equiv_memory_loc_vec);
+ reg_equiv_memory_loc = 0;
+
+ if (offsets_known_at)
+ free (offsets_known_at);
+ if (offsets_at)
+ free (offsets_at);
+ offsets_at = 0;
+ offsets_known_at = 0;
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (reg_equiv_alt_mem_list[i])
+ free_EXPR_LIST_list (&reg_equiv_alt_mem_list[i]);
+ free (reg_equiv_alt_mem_list);
+
+ free (reg_equiv_mem);
+ free (reg_equiv_address);
+}
/* Kick all pseudos out of hard register REGNO.
@@ -5671,7 +5999,7 @@ function_invariant_p (const_rtx x)
return 1;
if (GET_CODE (x) == PLUS
&& (XEXP (x, 0) == frame_pointer_rtx || XEXP (x, 0) == arg_pointer_rtx)
- && CONSTANT_P (XEXP (x, 1)))
+ && GET_CODE (XEXP (x, 1)) == CONST_INT)
return 1;
return 0;
}
@@ -6167,8 +6495,8 @@ choose_reload_regs (struct insn_chain *chain)
register, we might use it for reload_override_in,
if copying it to the desired class is cheap
enough. */
- || ((REGISTER_MOVE_COST (mode, last_class, rclass)
- < MEMORY_MOVE_COST (mode, rclass, 1))
+ || ((register_move_cost (mode, last_class, rclass)
+ < memory_move_cost (mode, rclass, true))
&& (secondary_reload_class (1, rclass, mode,
last_reg)
== NO_REGS)
@@ -7178,8 +7506,10 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl,
sri.icode = CODE_FOR_nothing;
sri.prev_sri = NULL;
- new_class = targetm.secondary_reload (1, real_oldequiv, rl->rclass,
- mode, &sri);
+ new_class
+ = (enum reg_class) targetm.secondary_reload (1, real_oldequiv,
+ rl->rclass, mode,
+ &sri);
if (new_class == NO_REGS && sri.icode == CODE_FOR_nothing)
second_reload_reg = 0;
@@ -7205,8 +7535,10 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl,
{
sri2.icode = CODE_FOR_nothing;
sri2.prev_sri = &sri;
- new_t_class = targetm.secondary_reload (1, real_oldequiv,
- new_class, mode, &sri);
+ new_t_class
+ = (enum reg_class) targetm.secondary_reload (1, real_oldequiv,
+ new_class, mode,
+ &sri);
if (new_t_class == NO_REGS && sri2.icode == CODE_FOR_nothing)
{
if (reload_adjust_reg_for_temp (&second_reload_reg,
diff --git a/gcc/rtl-error.c b/gcc/rtl-error.c
index 098666d3415..6cf44d16ab2 100644
--- a/gcc/rtl-error.c
+++ b/gcc/rtl-error.c
@@ -22,11 +22,10 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "insn-attr.h"
#include "insn-config.h"
#include "input.h"
-#include "toplev.h"
#include "intl.h"
#include "diagnostic.h"
diff --git a/gcc/rtl-error.h b/gcc/rtl-error.h
new file mode 100644
index 00000000000..1ff58256b70
--- /dev/null
+++ b/gcc/rtl-error.h
@@ -0,0 +1,24 @@
+/* RTL specific diagnostic subroutines for GCC
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "rtl.h"
+#include "diagnostic-core.h"
+
+extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
diff --git a/gcc/rtl.c b/gcc/rtl.c
index dda701e8aed..d886e9381d2 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -149,7 +149,7 @@ rtvec_alloc (int n)
{
rtvec rt;
- rt = ggc_alloc_rtvec (n);
+ rt = ggc_alloc_rtvec_sized (n);
/* Clear out the vector. */
memset (&rt->elem[0], 0, n * sizeof (rtx));
@@ -193,9 +193,8 @@ rtx_size (const_rtx x)
rtx
rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL)
{
- rtx rt;
-
- rt = (rtx) ggc_alloc_zone_pass_stat (RTX_CODE_SIZE (code), &rtl_zone);
+ rtx rt = ggc_alloc_zone_rtx_def_stat (&rtl_zone, RTX_CODE_SIZE (code)
+ PASS_MEM_STAT);
/* We want to clear everything up to the FLD array. Normally, this
is one int, but we don't want to assume that and it isn't very
@@ -337,7 +336,7 @@ rtx
shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL)
{
const unsigned int size = rtx_size (orig);
- rtx const copy = (rtx) ggc_alloc_zone_pass_stat (size, &rtl_zone);
+ rtx const copy = ggc_alloc_zone_rtx_def_stat (&rtl_zone, size PASS_MEM_STAT);
return (rtx) memcpy (copy, orig, size);
}
diff --git a/gcc/rtl.def b/gcc/rtl.def
index c9ef1af001a..c4a3646afea 100644
--- a/gcc/rtl.def
+++ b/gcc/rtl.def
@@ -715,9 +715,6 @@ DEF_RTL_EXPR(VAR_LOCATION, "var_location", "tei", RTX_EXTRA)
descriptions. */
#ifdef GENERATOR_FILE
-/* Include a secondary machine-description file at this point. */
-DEF_RTL_EXPR(INCLUDE, "include", "s", RTX_EXTRA)
-
/* Pattern-matching operators: */
/* Use the function named by the second arg (the string)
@@ -1201,6 +1198,12 @@ DEF_RTL_EXPR(DEFINE_INSN_RESERVATION, "define_insn_reservation", "sies", RTX_EXT
3rd operand: expression for the default value of the attribute. */
DEF_RTL_EXPR(DEFINE_ATTR, "define_attr", "sse", RTX_EXTRA)
+/* Definition of an insn attribute that uses an existing enumerated type.
+ 1st operand: name of the attribute
+ 2nd operand: the name of the enumerated type
+ 3rd operand: expression for the default value of the attribute. */
+DEF_RTL_EXPR(DEFINE_ENUM_ATTR, "define_enum_attr", "sse", RTX_EXTRA)
+
/* Marker for the name of an attribute. */
DEF_RTL_EXPR(ATTR, "attr", "s", RTX_EXTRA)
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 107bb9c05a0..02f74f575c3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -233,7 +233,7 @@ struct GTY(()) object_block {
/* RTL expression ("rtx"). */
struct GTY((chain_next ("RTX_NEXT (&%h)"),
- chain_prev ("RTX_PREV (&%h)"))) rtx_def {
+ chain_prev ("RTX_PREV (&%h)"), variable_size)) rtx_def {
/* The kind of expression this is. */
ENUM_BITFIELD(rtx_code) code: 16;
@@ -352,7 +352,7 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"),
for a variable number of things. The principle use is inside
PARALLEL expressions. */
-struct GTY(()) rtvec_def {
+struct GTY((variable_size)) rtvec_def {
int num_elem; /* number of elements */
rtx GTY ((length ("%h.num_elem"))) elem[1];
};
@@ -2356,19 +2356,8 @@ extern void init_varasm_once (void);
extern rtx make_debug_expr_from_rtl (const_rtx);
-/* In rtl.c */
-extern void traverse_md_constants (int (*) (void **, void *), void *);
-struct md_constant { char *name, *value; };
-
/* In read-rtl.c */
-extern int read_skip_spaces (FILE *);
-extern bool read_rtx (FILE *, rtx *, int *);
-extern void copy_rtx_ptr_loc (const void *, const void *);
-extern void print_rtx_ptr_loc (const void *);
-extern const char *join_c_conditions (const char *, const char *);
-extern void print_c_condition (const char *);
-extern const char *read_rtx_filename;
-extern int read_rtx_lineno;
+extern bool read_rtx (const char *, rtx *);
/* In alias.c */
extern rtx canon_rtx (rtx);
@@ -2451,4 +2440,17 @@ extern int curr_insn_locator (void);
extern bool optimize_insn_for_size_p (void);
extern bool optimize_insn_for_speed_p (void);
+/* rtl-error.c */
+extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
+ ATTRIBUTE_NORETURN;
+extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
+ ATTRIBUTE_NORETURN;
+
+#define fatal_insn(msgid, insn) \
+ _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
+#define fatal_insn_not_found(insn) \
+ _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
+
+
+
#endif /* ! GCC_RTL_H */
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index a3608732dbb..a26bf3b2272 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1694,7 +1694,7 @@ find_reg_note (const_rtx insn, enum reg_note kind, const_rtx datum)
{
rtx link;
- gcc_assert (insn);
+ gcc_checking_assert (insn);
/* Ignore anything that is not an INSN, JUMP_INSN or CALL_INSN. */
if (! INSN_P (insn))
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 556c38a4fb0..4577c8e1c51 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -1407,7 +1407,10 @@ add_dependence_list_and_free (struct deps_desc *deps, rtx insn, rtx *listp,
{
rtx list, next;
- if (deps->readonly)
+ /* We don't want to short-circuit dependencies involving debug
+ insns, because they may cause actual dependencies to be
+ disregarded. */
+ if (deps->readonly || DEBUG_INSN_P (insn))
{
add_dependence_list (insn, *listp, uncond, dep_type);
return;
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 87a00b4a61e..f0e54bf4052 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -1,6 +1,6 @@
/* Output sdb-format symbol table information from GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -325,6 +325,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
sdbout_begin_prologue, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
#endif
+ debug_nothing_int_charstar, /* begin_epilogue */
sdbout_end_epilogue, /* end_epilogue */
sdbout_begin_function, /* begin_function */
sdbout_end_function, /* end_function */
@@ -1719,6 +1720,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
0, /* source_line */
0, /* begin_prologue */
0, /* end_prologue */
+ 0, /* begin_epilogue */
0, /* end_epilogue */
0, /* begin_function */
0, /* end_function */
diff --git a/gcc/sel-sched-dump.c b/gcc/sel-sched-dump.c
index 1042a6e8e49..e9b486f332b 100644
--- a/gcc/sel-sched-dump.c
+++ b/gcc/sel-sched-dump.c
@@ -566,7 +566,7 @@ replace_str_in_buf (char *buf, const char *str1, const char *str2)
}
/* Replace characters in BUF that have special meaning in .dot file. */
-void
+static void
sel_prepare_string_for_dot_label (char *buf)
{
static char specials_from[7][2] = { "<", ">", "{", "|", "}", "\"",
@@ -579,6 +579,28 @@ sel_prepare_string_for_dot_label (char *buf)
replace_str_in_buf (buf, specials_from[i], specials_to[i]);
}
+/* This function acts like printf but dumps to the sched_dump file. */
+void
+sel_print (const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ if (sched_dump_to_dot_p)
+ {
+ char *message;
+ if (vasprintf (&message, fmt, ap) >= 0 && message != NULL)
+ {
+ message = (char *) xrealloc (message, 2 * strlen (message) + 1);
+ sel_prepare_string_for_dot_label (message);
+ fprintf (sched_dump, "%s", message);
+ free (message);
+ }
+ }
+ else
+ vfprintf (sched_dump, fmt, ap);
+ va_end (ap);
+}
+
/* Dump INSN with FLAGS. */
static void
sel_dump_cfg_insn (insn_t insn, int flags)
diff --git a/gcc/sel-sched-dump.h b/gcc/sel-sched-dump.h
index d4ebd779a7a..52d7aea693a 100644
--- a/gcc/sel-sched-dump.h
+++ b/gcc/sel-sched-dump.h
@@ -177,34 +177,13 @@ extern void dump_insn_1 (insn_t, int);
extern void dump_insn (insn_t);
extern void debug_insn (insn_t);
-extern void sel_prepare_string_for_dot_label (char *);
-
/* When this flag is on, we are dumping to the .dot file.
When it is off, we are dumping to log. */
extern bool sched_dump_to_dot_p;
-
-/* This macro acts like printf but dumps information to the .dot file.
- Used when dumping control flow. */
-#define sel_print_to_dot(...) \
- do { \
- int __j = 1 + 2 * snprintf (NULL, 0, __VA_ARGS__); \
- char *__s = XALLOCAVEC (char, __j); \
- snprintf (__s, __j, __VA_ARGS__); \
- sel_prepare_string_for_dot_label (__s); \
- fprintf (sched_dump, "%s", __s); \
- } while (0)
-
-/* This macro acts like printf but dumps to the sched_dump file. */
-#define sel_print(...) \
- do { \
- if (sched_dump_to_dot_p) \
- sel_print_to_dot (__VA_ARGS__); \
- else \
- fprintf (sched_dump, __VA_ARGS__); \
- } while (0)
/* Functions from sel-sched-dump.c. */
+extern void sel_print (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
extern const char * sel_print_insn (const_rtx, int);
extern void free_sel_dump_data (void);
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 8590b8a0549..3a86e22feef 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -21,8 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "toplev.h"
-#include "rtl.h"
+#include "rtl-error.h"
#include "tm_p.h"
#include "hard-reg-set.h"
#include "regs.h"
@@ -31,7 +30,6 @@ along with GCC; see the file COPYING3. If not see
#include "insn-config.h"
#include "insn-attr.h"
#include "except.h"
-#include "toplev.h"
#include "recog.h"
#include "params.h"
#include "target.h"
@@ -6863,11 +6861,11 @@ sel_region_init (int rgn)
/* Set hooks so that no newly generated insn will go out unnoticed. */
sel_register_cfg_hooks ();
- /* !!! We call target.sched.md_init () for the whole region, but we invoke
- targetm.sched.md_finish () for every ebb. */
- if (targetm.sched.md_init)
+ /* !!! We call target.sched.init () for the whole region, but we invoke
+ targetm.sched.finish () for every ebb. */
+ if (targetm.sched.init)
/* None of the arguments are actually used in any target. */
- targetm.sched.md_init (sched_dump, sched_verbose, -1);
+ targetm.sched.init (sched_dump, sched_verbose, -1);
first_emitted_uid = get_max_uid () + 1;
preheader_removed = false;
@@ -6949,11 +6947,11 @@ reset_sched_cycles_in_current_ebb (void)
int haifa_clock = 0;
insn_t insn;
- if (targetm.sched.md_init)
+ if (targetm.sched.init)
{
/* None of the arguments are actually used in any target.
NB: We should have md_reset () hook for cases like this. */
- targetm.sched.md_init (sched_dump, sched_verbose, -1);
+ targetm.sched.init (sched_dump, sched_verbose, -1);
}
state_reset (curr_state);
@@ -7131,14 +7129,14 @@ sel_region_target_finish (bool reset_sched_cycles_p)
if (reset_sched_cycles_p)
reset_sched_cycles_in_current_ebb ();
- if (targetm.sched.md_init)
- targetm.sched.md_init (sched_dump, sched_verbose, -1);
+ if (targetm.sched.init)
+ targetm.sched.init (sched_dump, sched_verbose, -1);
put_TImodes ();
- if (targetm.sched.md_finish)
+ if (targetm.sched.finish)
{
- targetm.sched.md_finish (sched_dump, sched_verbose);
+ targetm.sched.finish (sched_dump, sched_verbose);
/* Extend luids so that insns generated by the target will
get zero luid. */
diff --git a/gcc/sese.c b/gcc/sese.c
index 7e9bd91f2d7..2ed6485beed 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -1493,7 +1493,7 @@ if_region_set_false_region (ifsese if_region, sese region)
if (slot)
{
- struct loop_exit *loop_exit = GGC_CNEW (struct loop_exit);
+ struct loop_exit *loop_exit = ggc_alloc_cleared_loop_exit ();
memcpy (loop_exit, *((struct loop_exit **) slot), sizeof (struct loop_exit));
htab_clear_slot (current_loops->exits, slot);
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index b38ab2e5991..3a30e882907 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -208,10 +208,11 @@ avoid_constant_pool_reference (rtx x)
rtx
delegitimize_mem_from_attrs (rtx x)
{
+ /* MEMs without MEM_OFFSETs may have been offset, so we can't just
+ use their base addresses as equivalent. */
if (MEM_P (x)
&& MEM_EXPR (x)
- && (!MEM_OFFSET (x)
- || GET_CODE (MEM_OFFSET (x)) == CONST_INT))
+ && MEM_OFFSET (x))
{
tree decl = MEM_EXPR (x);
enum machine_mode mode = GET_MODE (x);
@@ -264,8 +265,7 @@ delegitimize_mem_from_attrs (rtx x)
{
rtx newx;
- if (MEM_OFFSET (x))
- offset += INTVAL (MEM_OFFSET (x));
+ offset += INTVAL (MEM_OFFSET (x));
newx = DECL_RTL (decl);
@@ -3268,141 +3268,124 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
/* We can fold some multi-word operations. */
if (GET_MODE_CLASS (mode) == MODE_INT
- && width == HOST_BITS_PER_WIDE_INT * 2
- && (GET_CODE (op0) == CONST_DOUBLE || CONST_INT_P (op0))
- && (GET_CODE (op1) == CONST_DOUBLE || CONST_INT_P (op1)))
+ && width == HOST_BITS_PER_DOUBLE_INT
+ && (CONST_DOUBLE_P (op0) || CONST_INT_P (op0))
+ && (CONST_DOUBLE_P (op1) || CONST_INT_P (op1)))
{
- unsigned HOST_WIDE_INT l1, l2, lv, lt;
- HOST_WIDE_INT h1, h2, hv, ht;
+ double_int o0, o1, res, tmp;
- if (GET_CODE (op0) == CONST_DOUBLE)
- l1 = CONST_DOUBLE_LOW (op0), h1 = CONST_DOUBLE_HIGH (op0);
- else
- l1 = INTVAL (op0), h1 = HWI_SIGN_EXTEND (l1);
-
- if (GET_CODE (op1) == CONST_DOUBLE)
- l2 = CONST_DOUBLE_LOW (op1), h2 = CONST_DOUBLE_HIGH (op1);
- else
- l2 = INTVAL (op1), h2 = HWI_SIGN_EXTEND (l2);
+ o0 = rtx_to_double_int (op0);
+ o1 = rtx_to_double_int (op1);
switch (code)
{
case MINUS:
/* A - B == A + (-B). */
- neg_double (l2, h2, &lv, &hv);
- l2 = lv, h2 = hv;
+ o1 = double_int_neg (o1);
/* Fall through.... */
case PLUS:
- add_double (l1, h1, l2, h2, &lv, &hv);
+ res = double_int_add (o0, o1);
break;
case MULT:
- mul_double (l1, h1, l2, h2, &lv, &hv);
+ res = double_int_mul (o0, o1);
break;
case DIV:
- if (div_and_round_double (TRUNC_DIV_EXPR, 0, l1, h1, l2, h2,
- &lv, &hv, &lt, &ht))
+ if (div_and_round_double (TRUNC_DIV_EXPR, 0,
+ o0.low, o0.high, o1.low, o1.high,
+ &res.low, &res.high,
+ &tmp.low, &tmp.high))
return 0;
break;
case MOD:
- if (div_and_round_double (TRUNC_DIV_EXPR, 0, l1, h1, l2, h2,
- &lt, &ht, &lv, &hv))
+ if (div_and_round_double (TRUNC_DIV_EXPR, 0,
+ o0.low, o0.high, o1.low, o1.high,
+ &tmp.low, &tmp.high,
+ &res.low, &res.high))
return 0;
break;
case UDIV:
- if (div_and_round_double (TRUNC_DIV_EXPR, 1, l1, h1, l2, h2,
- &lv, &hv, &lt, &ht))
+ if (div_and_round_double (TRUNC_DIV_EXPR, 1,
+ o0.low, o0.high, o1.low, o1.high,
+ &res.low, &res.high,
+ &tmp.low, &tmp.high))
return 0;
break;
case UMOD:
- if (div_and_round_double (TRUNC_DIV_EXPR, 1, l1, h1, l2, h2,
- &lt, &ht, &lv, &hv))
+ if (div_and_round_double (TRUNC_DIV_EXPR, 1,
+ o0.low, o0.high, o1.low, o1.high,
+ &tmp.low, &tmp.high,
+ &res.low, &res.high))
return 0;
break;
case AND:
- lv = l1 & l2, hv = h1 & h2;
+ res = double_int_and (o0, o1);
break;
case IOR:
- lv = l1 | l2, hv = h1 | h2;
+ res = double_int_ior (o0, o1);
break;
case XOR:
- lv = l1 ^ l2, hv = h1 ^ h2;
+ res = double_int_xor (o0, o1);
break;
case SMIN:
- if (h1 < h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- < (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
+ res = double_int_smin (o0, o1);
break;
case SMAX:
- if (h1 > h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- > (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
+ res = double_int_smax (o0, o1);
break;
case UMIN:
- if ((unsigned HOST_WIDE_INT) h1 < (unsigned HOST_WIDE_INT) h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- < (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
+ res = double_int_umin (o0, o1);
break;
case UMAX:
- if ((unsigned HOST_WIDE_INT) h1 > (unsigned HOST_WIDE_INT) h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- > (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
+ res = double_int_umax (o0, o1);
break;
case LSHIFTRT: case ASHIFTRT:
case ASHIFT:
case ROTATE: case ROTATERT:
- if (SHIFT_COUNT_TRUNCATED)
- l2 &= (GET_MODE_BITSIZE (mode) - 1), h2 = 0;
-
- if (h2 != 0 || l2 >= GET_MODE_BITSIZE (mode))
- return 0;
-
- if (code == LSHIFTRT || code == ASHIFTRT)
- rshift_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv,
- code == ASHIFTRT);
- else if (code == ASHIFT)
- lshift_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv, 1);
- else if (code == ROTATE)
- lrotate_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv);
- else /* code == ROTATERT */
- rrotate_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv);
+ {
+ unsigned HOST_WIDE_INT cnt;
+
+ if (SHIFT_COUNT_TRUNCATED)
+ o1 = double_int_zext (o1, GET_MODE_BITSIZE (mode));
+
+ if (!double_int_fits_in_uhwi_p (o1)
+ || double_int_to_uhwi (o1) >= GET_MODE_BITSIZE (mode))
+ return 0;
+
+ cnt = double_int_to_uhwi (o1);
+
+ if (code == LSHIFTRT || code == ASHIFTRT)
+ res = double_int_rshift (o0, cnt, GET_MODE_BITSIZE (mode),
+ code == ASHIFTRT);
+ else if (code == ASHIFT)
+ res = double_int_lshift (o0, cnt, GET_MODE_BITSIZE (mode),
+ true);
+ else if (code == ROTATE)
+ res = double_int_lrotate (o0, cnt, GET_MODE_BITSIZE (mode));
+ else /* code == ROTATERT */
+ res = double_int_rrotate (o0, cnt, GET_MODE_BITSIZE (mode));
+ }
break;
default:
return 0;
}
- return immed_double_const (lv, hv, mode);
+ return immed_double_int_const (res, mode);
}
if (CONST_INT_P (op0) && CONST_INT_P (op1)
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 4b91ab6522e..952388aff91 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1319,7 +1319,7 @@ resolve_asm_operand_names (tree string, tree outputs, tree inputs, tree labels)
break;
else
{
- c += 1;
+ c += 1 + (c[1] == '%');
continue;
}
}
@@ -1341,7 +1341,7 @@ resolve_asm_operand_names (tree string, tree outputs, tree inputs, tree labels)
p += 2;
else
{
- p += 1;
+ p += 1 + (p[1] == '%');
continue;
}
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 3780a7f94db..89f5fa986a7 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -342,7 +342,7 @@ self_referential_size (tree size)
VEC_safe_push (tree, gc, size_functions, fndecl);
/* Replace the original expression with a call to the size function. */
- return build_function_call_expr (input_location, fndecl, arg_list);
+ return build_function_call_expr (UNKNOWN_LOCATION, fndecl, arg_list);
}
/* Take, queue and compile all the size functions. It is essential that
@@ -369,10 +369,6 @@ finalize_size_functions (void)
VEC_free (tree, gc, size_functions);
}
-#ifndef MAX_FIXED_MODE_SIZE
-#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode)
-#endif
-
/* Return the machine mode to use for a nonscalar of SIZE bits. The
mode must be in class MCLASS, and have exactly that many value bits;
it may have padding as well. If LIMIT is nonzero, modes of wider
@@ -747,7 +743,7 @@ start_record_layout (tree t)
rli->offset = size_zero_node;
rli->bitpos = bitsize_zero_node;
rli->prev_field = 0;
- rli->pending_statics = 0;
+ rli->pending_statics = NULL;
rli->packed_maybe_necessary = 0;
rli->remaining_in_alignment = 0;
@@ -831,10 +827,10 @@ debug_rli (record_layout_info rli)
if (rli->packed_maybe_necessary)
fprintf (stderr, "packed may be necessary\n");
- if (rli->pending_statics)
+ if (!VEC_empty (tree, rli->pending_statics))
{
fprintf (stderr, "pending statics:\n");
- debug_tree (rli->pending_statics);
+ debug_vec_tree (rli->pending_statics);
}
}
@@ -1045,8 +1041,7 @@ place_field (record_layout_info rli, tree field)
it *after* the record is laid out. */
if (TREE_CODE (field) == VAR_DECL)
{
- rli->pending_statics = tree_cons (NULL_TREE, field,
- rli->pending_statics);
+ VEC_safe_push (tree, gc, rli->pending_statics, field);
return;
}
@@ -1722,15 +1717,15 @@ finish_record_layout (record_layout_info rli, int free_p)
/* Lay out any static members. This is done now because their type
may use the record's type. */
- while (rli->pending_statics)
- {
- layout_decl (TREE_VALUE (rli->pending_statics), 0);
- rli->pending_statics = TREE_CHAIN (rli->pending_statics);
- }
+ while (!VEC_empty (tree, rli->pending_statics))
+ layout_decl (VEC_pop (tree, rli->pending_statics), 0);
/* Clean up. */
if (free_p)
- free (rli);
+ {
+ VEC_free (tree, gc, rli->pending_statics);
+ free (rli);
+ }
}
diff --git a/gcc/stringpool.c b/gcc/stringpool.c
index 79f8cb2c8d1..8d45a26befc 100644
--- a/gcc/stringpool.c
+++ b/gcc/stringpool.c
@@ -1,5 +1,5 @@
/* String pool for GCC.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "ggc.h"
+#include "ggc-internal.h"
#include "tree.h"
#include "symtab.h"
#include "cpplib.h"
@@ -40,11 +41,13 @@ const char empty_string[] = "";
/* Character strings, each containing a single decimal digit.
Written this way to save space. */
-const char digit_vector[] = {
+static const char digit_vector[] = {
'0', 0, '1', 0, '2', 0, '3', 0, '4', 0,
'5', 0, '6', 0, '7', 0, '8', 0, '9', 0
};
+#define digit_string(d) (digit_vector + ((d) * 2))
+
struct ht *ident_hash;
static hashnode alloc_node (hash_table *);
@@ -53,7 +56,7 @@ static int mark_ident (struct cpp_reader *, hashnode, const void *);
static void *
stringpool_ggc_alloc (size_t x)
{
- return ggc_alloc (x);
+ return ggc_alloc_atomic (x);
}
/* Initialize the string pool. */
@@ -78,7 +81,7 @@ alloc_node (hash_table *table ATTRIBUTE_UNUSED)
nul-terminated string, and the length is calculated using strlen. */
const char *
-ggc_alloc_string (const char *contents, int length)
+ggc_alloc_string_stat (const char *contents, int length MEM_STAT_DECL)
{
char *result;
@@ -90,7 +93,7 @@ ggc_alloc_string (const char *contents, int length)
if (length == 1 && ISDIGIT (contents[0]))
return digit_string (contents[0] - '0');
- result = GGC_NEWVAR (char, length + 1);
+ result = (char *) ggc_alloc_atomic_stat (length + 1 PASS_MEM_STAT);
memcpy (result, contents, length);
result[length] = '\0';
return (const char *) result;
@@ -215,7 +218,7 @@ gt_pch_n_S (const void *x)
to restore the string pool. */
struct GTY(()) string_pool_data {
- struct ht_identifier * *
+ ht_identifier_ptr *
GTY((length ("%h.nslots"),
nested_ptr (union tree_node, "%h ? GCC_IDENT_TO_HT_IDENT (%h) : NULL",
"%h ? HT_IDENT_TO_GCC_IDENT (%h) : NULL")))
@@ -231,10 +234,10 @@ static GTY(()) struct string_pool_data * spd;
void
gt_pch_save_stringpool (void)
{
- spd = GGC_NEW (struct string_pool_data);
+ spd = ggc_alloc_string_pool_data ();
spd->nslots = ident_hash->nslots;
spd->nelements = ident_hash->nelements;
- spd->entries = GGC_NEWVEC (struct ht_identifier *, spd->nslots);
+ spd->entries = ggc_alloc_vec_ht_identifier_ptr (spd->nslots);
memcpy (spd->entries, ident_hash->entries,
spd->nslots * sizeof (spd->entries[0]));
}
diff --git a/gcc/system.h b/gcc/system.h
index a6bc93085c4..dd72d07fa3d 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -1,7 +1,7 @@
/* Get common system includes and various definitions and declarations based
on autoconf macros.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
- 2009
+ 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -601,6 +601,12 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
#endif
+#ifdef ENABLE_CHECKING
+#define gcc_checking_assert(EXPR) gcc_assert (EXPR)
+#else
+#define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
+#endif
+
/* Use gcc_unreachable() to mark unreachable locations (like an
unreachable default case of a switch. Do not use gcc_assert(0). */
#if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
@@ -708,7 +714,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL \
ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS FRAME_POINTER_REQUIRED \
CAN_ELIMINATE TRAMPOLINE_TEMPLATE INITIALIZE_TRAMPOLINE \
- TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING
+ TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING \
+ RETURN_POPS_ARGS
/* Other obsolete target macros, or macros that used to be in target
headers and were not used, and may be obsolete or may never have
@@ -762,7 +769,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
SMALL_ARG_MAX ASM_OUTPUT_SHARED_BSS ASM_OUTPUT_SHARED_COMMON \
ASM_OUTPUT_SHARED_LOCAL ASM_MAKE_LABEL_LINKONCE \
STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD \
- ORDER_REGS_FOR_LOCAL_ALLOC
+ ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE \
+ ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES
/* Hooks that are no longer used. */
#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \
@@ -792,7 +800,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
/* Front ends should never have to include middle-end headers. Enforce
this by poisoning the header double-include protection defines. */
#ifdef IN_GCC_FRONTEND
-#pragma GCC poison GCC_RTL_H
+#pragma GCC poison GCC_RTL_H GCC_EXCEPT_H
#endif
/* Note: not all uses of the `index' token (e.g. variable names and
@@ -828,6 +836,20 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
/* GCC 4.0.x has a bug where it may ICE on this expression,
so does GCC 3.4.x (PR17436). */
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
+#elif defined(__GNUC__)
+static inline char *
+helper_const_non_const_cast (const char *p)
+{
+ union {
+ const char *const_c;
+ char *c;
+ } val;
+ val.const_c = p;
+ return val.c;
+}
+
+#define CONST_CAST2(TOTYPE,FROMTYPE,X) \
+ ((TOTYPE) helper_const_non_const_cast ((const char *) (FROMTYPE) (X)))
#else
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
#endif
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 109772329d6..0aad7ce51a9 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -20,7 +20,7 @@
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
-/* See target.h for a description of what this file contains and how to
+/* See target.def for a description of what this file contains and how to
use it.
We want to have non-NULL default definitions of all hook functions,
@@ -30,16 +30,6 @@
rather than the .c file, then we need to wrap the default
definition in a #ifndef, since files include tm.h before this one. */
-/* Assembler output. */
-#ifndef TARGET_ASM_OPEN_PAREN
-#define TARGET_ASM_OPEN_PAREN "("
-#endif
-#ifndef TARGET_ASM_CLOSE_PAREN
-#define TARGET_ASM_CLOSE_PAREN ")"
-#endif
-
-#define TARGET_ASM_BYTE_OP "\t.byte\t"
-
#define TARGET_ASM_ALIGNED_HI_OP "\t.short\t"
#define TARGET_ASM_ALIGNED_SI_OP "\t.long\t"
#define TARGET_ASM_ALIGNED_DI_OP NULL
@@ -58,65 +48,6 @@
#define TARGET_ASM_UNALIGNED_TI_OP NULL
#endif /* OBJECT_FORMAT_ELF */
-#define TARGET_ASM_INTEGER default_assemble_integer
-
-#ifndef TARGET_ASM_GLOBALIZE_LABEL
-#define TARGET_ASM_GLOBALIZE_LABEL default_globalize_label
-#endif
-
-#ifndef TARGET_ASM_GLOBALIZE_DECL_NAME
-#define TARGET_ASM_GLOBALIZE_DECL_NAME default_globalize_decl_name
-#endif
-
-#ifndef TARGET_ASM_EMIT_UNWIND_LABEL
-#define TARGET_ASM_EMIT_UNWIND_LABEL default_emit_unwind_label
-#endif
-
-#ifndef TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL
-#define TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL default_emit_except_table_label
-#endif
-
-#ifndef TARGET_UNWIND_EMIT
-#define TARGET_UNWIND_EMIT default_unwind_emit
-#endif
-
-#ifndef TARGET_ASM_INTERNAL_LABEL
-#define TARGET_ASM_INTERNAL_LABEL default_internal_label
-#endif
-
-#ifndef TARGET_ASM_TTYPE
-#define TARGET_ASM_TTYPE hook_bool_rtx_false
-#endif
-
-#ifndef TARGET_ASM_ASSEMBLE_VISIBILITY
-#define TARGET_ASM_ASSEMBLE_VISIBILITY default_assemble_visibility
-#endif
-
-#define TARGET_ASM_FUNCTION_PROLOGUE default_function_pro_epilogue
-#define TARGET_ASM_FUNCTION_EPILOGUE default_function_pro_epilogue
-#define TARGET_ASM_FUNCTION_END_PROLOGUE no_asm_to_stream
-#define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE no_asm_to_stream
-
-#ifndef TARGET_ASM_RELOC_RW_MASK
-#define TARGET_ASM_RELOC_RW_MASK default_reloc_rw_mask
-#endif
-
-#ifndef TARGET_ASM_SELECT_SECTION
-#define TARGET_ASM_SELECT_SECTION default_select_section
-#endif
-
-#ifndef TARGET_ASM_UNIQUE_SECTION
-#define TARGET_ASM_UNIQUE_SECTION default_unique_section
-#endif
-
-#ifndef TARGET_ASM_FUNCTION_RODATA_SECTION
-#define TARGET_ASM_FUNCTION_RODATA_SECTION default_function_rodata_section
-#endif
-
-#ifndef TARGET_ASM_SELECT_RTX_SECTION
-#define TARGET_ASM_SELECT_RTX_SECTION default_select_rtx_section
-#endif
-
#if !defined(TARGET_ASM_CONSTRUCTOR) && !defined(USE_COLLECT2)
# ifdef CTORS_SECTION_ASM_OP
# define TARGET_ASM_CONSTRUCTOR default_ctor_section_asm_out_constructor
@@ -141,125 +72,25 @@
# endif
#endif
-#define TARGET_ASM_OUTPUT_MI_THUNK NULL
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_false
-
#if !defined(TARGET_HAVE_CTORS_DTORS)
# if defined(TARGET_ASM_CONSTRUCTOR) && defined(TARGET_ASM_DESTRUCTOR)
# define TARGET_HAVE_CTORS_DTORS true
-# else
-# define TARGET_HAVE_CTORS_DTORS false
-# define TARGET_ASM_CONSTRUCTOR NULL
-# define TARGET_ASM_DESTRUCTOR NULL
# endif
#endif
-#ifndef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
-#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS false
-#endif
-
-#ifndef TARGET_ASM_INIT_SECTIONS
-#define TARGET_ASM_INIT_SECTIONS hook_void_void
-#endif
-
#ifdef TARGET_ASM_NAMED_SECTION
#define TARGET_HAVE_NAMED_SECTIONS true
-#else
-#define TARGET_ASM_NAMED_SECTION default_no_named_section
-#define TARGET_HAVE_NAMED_SECTIONS false
-#endif
-
-#ifndef TARGET_INVALID_WITHIN_DOLOOP
-#define TARGET_INVALID_WITHIN_DOLOOP default_invalid_within_doloop
-#endif
-
-#ifndef TARGET_VALID_DLLIMPORT_ATTRIBUTE_P
-#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P hook_bool_const_tree_true
-#endif
-
-#ifndef TARGET_HAVE_TLS
-#define TARGET_HAVE_TLS false
-#endif
-
-#ifndef TARGET_HAVE_SRODATA_SECTION
-#define TARGET_HAVE_SRODATA_SECTION false
#endif
#ifndef TARGET_TERMINATE_DW2_EH_FRAME_INFO
#ifdef EH_FRAME_SECTION_NAME
#define TARGET_TERMINATE_DW2_EH_FRAME_INFO false
-#else
-#define TARGET_TERMINATE_DW2_EH_FRAME_INFO true
-#endif
#endif
-
-#define TARGET_DWARF_REGISTER_SPAN hook_rtx_rtx_null
-#define TARGET_INIT_DWARF_REG_SIZES_EXTRA hook_void_tree
-
-#ifndef TARGET_ASM_FILE_START
-#define TARGET_ASM_FILE_START default_file_start
-#endif
-
-#ifndef TARGET_ASM_FILE_END
-#define TARGET_ASM_FILE_END hook_void_void
-#endif
-
-#ifndef TARGET_ASM_LTO_START
-#define TARGET_ASM_LTO_START hook_void_void
-#endif
-
-#ifndef TARGET_ASM_LTO_END
-#define TARGET_ASM_LTO_END hook_void_void
-#endif
-
-#ifndef TARGET_ASM_CODE_END
-#define TARGET_ASM_CODE_END hook_void_void
-#endif
-
-#ifndef TARGET_EXTRA_LIVE_ON_ENTRY
-#define TARGET_EXTRA_LIVE_ON_ENTRY hook_void_bitmap
-#endif
-
-#ifndef TARGET_ASM_FILE_START_APP_OFF
-#define TARGET_ASM_FILE_START_APP_OFF false
-#endif
-
-#ifndef TARGET_ASM_FILE_START_FILE_DIRECTIVE
-#define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
#endif
-#ifndef TARGET_ASM_EXTERNAL_LIBCALL
-#define TARGET_ASM_EXTERNAL_LIBCALL default_external_libcall
-#endif
-
-#ifndef TARGET_ASM_MARK_DECL_PRESERVED
-#define TARGET_ASM_MARK_DECL_PRESERVED hook_void_constcharptr
-#endif
-
-#ifndef TARGET_ASM_OUTPUT_ANCHOR
-#ifdef ASM_OUTPUT_DEF
-#define TARGET_ASM_OUTPUT_ANCHOR default_asm_output_anchor
-#else
+#if !defined(TARGET_ASM_OUTPUT_ANCHOR) && !defined(ASM_OUTPUT_DEF)
#define TARGET_ASM_OUTPUT_ANCHOR NULL
#endif
-#endif
-
-#ifndef TARGET_ASM_OUTPUT_DWARF_DTPREL
-#define TARGET_ASM_OUTPUT_DWARF_DTPREL NULL
-#endif
-
-#ifndef TARGET_ASM_FINAL_POSTSCAN_INSN
-#define TARGET_ASM_FINAL_POSTSCAN_INSN NULL
-#endif
-
-#ifndef TARGET_ASM_RECORD_GCC_SWITCHES
-#define TARGET_ASM_RECORD_GCC_SWITCHES NULL
-#endif
-#ifndef TARGET_ASM_RECORD_GCC_SWITCHES_SECTION
-#define TARGET_ASM_RECORD_GCC_SWITCHES_SECTION ".GCC.command.line"
-#endif
-
-#define TARGET_ASM_TRAMPOLINE_TEMPLATE NULL
#define TARGET_ASM_ALIGNED_INT_OP \
{TARGET_ASM_ALIGNED_HI_OP, \
@@ -273,802 +104,15 @@
TARGET_ASM_UNALIGNED_DI_OP, \
TARGET_ASM_UNALIGNED_TI_OP}
-#define TARGET_ASM_OUT {TARGET_ASM_OPEN_PAREN, \
- TARGET_ASM_CLOSE_PAREN, \
- TARGET_ASM_BYTE_OP, \
- TARGET_ASM_ALIGNED_INT_OP, \
- TARGET_ASM_UNALIGNED_INT_OP, \
- TARGET_ASM_INTEGER, \
- TARGET_ASM_GLOBALIZE_LABEL, \
- TARGET_ASM_GLOBALIZE_DECL_NAME, \
- TARGET_ASM_EMIT_UNWIND_LABEL, \
- TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL, \
- TARGET_UNWIND_EMIT, \
- TARGET_ASM_INTERNAL_LABEL, \
- TARGET_ASM_TTYPE, \
- TARGET_ASM_ASSEMBLE_VISIBILITY, \
- TARGET_ASM_FUNCTION_PROLOGUE, \
- TARGET_ASM_FUNCTION_END_PROLOGUE, \
- TARGET_ASM_FUNCTION_BEGIN_EPILOGUE, \
- TARGET_ASM_FUNCTION_EPILOGUE, \
- TARGET_ASM_INIT_SECTIONS, \
- TARGET_ASM_NAMED_SECTION, \
- TARGET_ASM_RELOC_RW_MASK, \
- TARGET_ASM_SELECT_SECTION, \
- TARGET_ASM_SELECT_RTX_SECTION, \
- TARGET_ASM_UNIQUE_SECTION, \
- TARGET_ASM_FUNCTION_RODATA_SECTION, \
- TARGET_ASM_CONSTRUCTOR, \
- TARGET_ASM_DESTRUCTOR, \
- TARGET_ASM_OUTPUT_MI_THUNK, \
- TARGET_ASM_CAN_OUTPUT_MI_THUNK, \
- TARGET_ASM_FILE_START, \
- TARGET_ASM_FILE_END, \
- TARGET_ASM_LTO_START, \
- TARGET_ASM_LTO_END, \
- TARGET_ASM_CODE_END, \
- TARGET_ASM_EXTERNAL_LIBCALL, \
- TARGET_ASM_MARK_DECL_PRESERVED, \
- TARGET_ASM_RECORD_GCC_SWITCHES, \
- TARGET_ASM_RECORD_GCC_SWITCHES_SECTION, \
- TARGET_ASM_OUTPUT_ANCHOR, \
- TARGET_ASM_OUTPUT_DWARF_DTPREL, \
- TARGET_ASM_FINAL_POSTSCAN_INSN, \
- TARGET_ASM_TRAMPOLINE_TEMPLATE }
-
-/* Scheduler hooks. All of these default to null pointers, which
- haifa-sched.c looks for and handles. */
-#define TARGET_SCHED_ADJUST_COST 0
-#define TARGET_SCHED_ADJUST_PRIORITY 0
-#define TARGET_SCHED_ISSUE_RATE 0
-#define TARGET_SCHED_VARIABLE_ISSUE 0
-#define TARGET_SCHED_INIT 0
-#define TARGET_SCHED_FINISH 0
-#define TARGET_SCHED_INIT_GLOBAL 0
-#define TARGET_SCHED_FINISH_GLOBAL 0
-#define TARGET_SCHED_REORDER 0
-#define TARGET_SCHED_REORDER2 0
-#define TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK 0
-#define TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN 0
-#define TARGET_SCHED_DFA_PRE_CYCLE_INSN 0
-#define TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN 0
-#define TARGET_SCHED_DFA_POST_CYCLE_INSN 0
-#define TARGET_SCHED_DFA_PRE_ADVANCE_CYCLE 0
-#define TARGET_SCHED_DFA_POST_ADVANCE_CYCLE 0
-#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD 0
-#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD 0
-#define TARGET_SCHED_DFA_NEW_CYCLE 0
-#define TARGET_SCHED_IS_COSTLY_DEPENDENCE 0
-#define TARGET_SCHED_ADJUST_COST_2 0
-#define TARGET_SCHED_H_I_D_EXTENDED 0
-#define TARGET_SCHED_ALLOC_SCHED_CONTEXT 0
-#define TARGET_SCHED_INIT_SCHED_CONTEXT 0
-#define TARGET_SCHED_SET_SCHED_CONTEXT 0
-#define TARGET_SCHED_CLEAR_SCHED_CONTEXT 0
-#define TARGET_SCHED_FREE_SCHED_CONTEXT 0
-#define TARGET_SCHED_SPECULATE_INSN 0
-#define TARGET_SCHED_NEEDS_BLOCK_P 0
-#define TARGET_SCHED_GEN_SPEC_CHECK 0
-#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD_SPEC 0
-#define TARGET_SCHED_SET_SCHED_FLAGS 0
-#define TARGET_SCHED_GET_INSN_SPEC_DS 0
-#define TARGET_SCHED_GET_INSN_CHECKED_DS 0
-#define TARGET_SCHED_SKIP_RTX_P 0
-#define TARGET_SCHED_SMS_RES_MII 0
-
-#define TARGET_SCHED \
- {TARGET_SCHED_ADJUST_COST, \
- TARGET_SCHED_ADJUST_PRIORITY, \
- TARGET_SCHED_ISSUE_RATE, \
- TARGET_SCHED_VARIABLE_ISSUE, \
- TARGET_SCHED_INIT, \
- TARGET_SCHED_FINISH, \
- TARGET_SCHED_INIT_GLOBAL, \
- TARGET_SCHED_FINISH_GLOBAL, \
- TARGET_SCHED_REORDER, \
- TARGET_SCHED_REORDER2, \
- TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK, \
- TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN, \
- TARGET_SCHED_DFA_PRE_CYCLE_INSN, \
- TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN, \
- TARGET_SCHED_DFA_POST_CYCLE_INSN, \
- TARGET_SCHED_DFA_PRE_ADVANCE_CYCLE, \
- TARGET_SCHED_DFA_POST_ADVANCE_CYCLE, \
- TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD, \
- TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD, \
- TARGET_SCHED_DFA_NEW_CYCLE, \
- TARGET_SCHED_IS_COSTLY_DEPENDENCE, \
- TARGET_SCHED_ADJUST_COST_2, \
- TARGET_SCHED_H_I_D_EXTENDED, \
- TARGET_SCHED_ALLOC_SCHED_CONTEXT, \
- TARGET_SCHED_INIT_SCHED_CONTEXT, \
- TARGET_SCHED_SET_SCHED_CONTEXT, \
- TARGET_SCHED_CLEAR_SCHED_CONTEXT, \
- TARGET_SCHED_FREE_SCHED_CONTEXT, \
- TARGET_SCHED_SPECULATE_INSN, \
- TARGET_SCHED_NEEDS_BLOCK_P, \
- TARGET_SCHED_GEN_SPEC_CHECK, \
- TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD_SPEC, \
- TARGET_SCHED_SET_SCHED_FLAGS, \
- TARGET_SCHED_GET_INSN_SPEC_DS, \
- TARGET_SCHED_GET_INSN_CHECKED_DS, \
- TARGET_SCHED_SKIP_RTX_P, \
- TARGET_SCHED_SMS_RES_MII}
-
-#define TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD 0
-#define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \
- default_builtin_vectorized_function
-#define TARGET_VECTORIZE_BUILTIN_CONVERSION \
- default_builtin_vectorized_conversion
-#define TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN 0
-#define TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD 0
-#define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST 0
-#define TARGET_VECTOR_ALIGNMENT_REACHABLE \
- default_builtin_vector_alignment_reachable
-#define TARGET_VECTORIZE_BUILTIN_VEC_PERM 0
-#define TARGET_VECTORIZE_BUILTIN_VEC_PERM_OK \
- hook_bool_tree_tree_true
-#define TARGET_SUPPORT_VECTOR_MISALIGNMENT \
- default_builtin_support_vector_misalignment
-
-
-#define TARGET_VECTORIZE \
- { \
- TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD, \
- TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION, \
- TARGET_VECTORIZE_BUILTIN_CONVERSION, \
- TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN, \
- TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD, \
- TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST, \
- TARGET_VECTOR_ALIGNMENT_REACHABLE, \
- TARGET_VECTORIZE_BUILTIN_VEC_PERM, \
- TARGET_VECTORIZE_BUILTIN_VEC_PERM_OK, \
- TARGET_SUPPORT_VECTOR_MISALIGNMENT \
- }
-
-#define TARGET_DEFAULT_TARGET_FLAGS 0
-
-#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook_void_void
-
-#define TARGET_HANDLE_OPTION hook_bool_size_t_constcharptr_int_true
-#define TARGET_HANDLE_OFAST hook_void_void
-#define TARGET_HELP NULL
-
-/* In except.c */
-#define TARGET_EH_RETURN_FILTER_MODE default_eh_return_filter_mode
-
-/* In libgcc2.c */
-#define TARGET_LIBGCC_CMP_RETURN_MODE default_libgcc_cmp_return_mode
-#define TARGET_LIBGCC_SHIFT_COUNT_MODE default_libgcc_shift_count_mode
-
-/* In unwind-generic.h. */
-#define TARGET_UNWIND_WORD_MODE default_unwind_word_mode
-
-/* In tree.c. */
-#define TARGET_MERGE_DECL_ATTRIBUTES merge_decl_attributes
-#define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes
-#define TARGET_ATTRIBUTE_TABLE NULL
-
-/* In cse.c. */
-#define TARGET_ADDRESS_COST default_address_cost
-#define TARGET_CONST_ANCHOR 0
-
-/* In builtins.c. */
-#define TARGET_INIT_BUILTINS hook_void_void
-#define TARGET_EXPAND_BUILTIN default_expand_builtin
-#define TARGET_RESOLVE_OVERLOADED_BUILTIN NULL
-#define TARGET_FOLD_BUILTIN hook_tree_tree_int_treep_bool_null
-#define TARGET_BUILTIN_DECL NULL
-
-/* In tree-ssa-math-opts.c */
-#define TARGET_BUILTIN_RECIPROCAL default_builtin_reciprocal
-
-/* In varasm.c. */
-#ifndef TARGET_SECTION_TYPE_FLAGS
-#define TARGET_SECTION_TYPE_FLAGS default_section_type_flags
-#endif
-
-#ifndef TARGET_STRIP_NAME_ENCODING
-#define TARGET_STRIP_NAME_ENCODING default_strip_name_encoding
-#endif
-
-#ifndef TARGET_BINDS_LOCAL_P
-#define TARGET_BINDS_LOCAL_P default_binds_local_p
-#endif
-
-#ifndef TARGET_SHIFT_TRUNCATION_MASK
-#define TARGET_SHIFT_TRUNCATION_MASK default_shift_truncation_mask
-#endif
-
-#ifndef TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
-#define TARGET_MIN_DIVISIONS_FOR_RECIP_MUL default_min_divisions_for_recip_mul
-#endif
-
-#ifndef TARGET_MODE_REP_EXTENDED
-#define TARGET_MODE_REP_EXTENDED default_mode_rep_extended
-#endif
-
-#ifndef TARGET_VALID_POINTER_MODE
-#define TARGET_VALID_POINTER_MODE default_valid_pointer_mode
-#endif
-
-#ifndef TARGET_ADDR_SPACE_POINTER_MODE
-#define TARGET_ADDR_SPACE_POINTER_MODE default_addr_space_pointer_mode
-#endif
-
-#ifndef TARGET_ADDR_SPACE_ADDRESS_MODE
-#define TARGET_ADDR_SPACE_ADDRESS_MODE default_addr_space_address_mode
-#endif
-
-#ifndef TARGET_ADDR_SPACE_VALID_POINTER_MODE
-#define TARGET_ADDR_SPACE_VALID_POINTER_MODE \
- default_addr_space_valid_pointer_mode
-#endif
-
-#ifndef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
-#define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \
- default_addr_space_legitimate_address_p
-#endif
-
-#ifndef TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS
-#define TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS \
- default_addr_space_legitimize_address
-#endif
-
-#ifndef TARGET_ADDR_SPACE_SUBSET_P
-#define TARGET_ADDR_SPACE_SUBSET_P default_addr_space_subset_p
-#endif
-
-#ifndef TARGET_ADDR_SPACE_CONVERT
-#define TARGET_ADDR_SPACE_CONVERT default_addr_space_convert
-#endif
-
-#define TARGET_ADDR_SPACE_HOOKS \
- { \
- TARGET_ADDR_SPACE_POINTER_MODE, \
- TARGET_ADDR_SPACE_ADDRESS_MODE, \
- TARGET_ADDR_SPACE_VALID_POINTER_MODE, \
- TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P, \
- TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS, \
- TARGET_ADDR_SPACE_SUBSET_P, \
- TARGET_ADDR_SPACE_CONVERT, \
- }
-
-#ifndef TARGET_SCALAR_MODE_SUPPORTED_P
-#define TARGET_SCALAR_MODE_SUPPORTED_P default_scalar_mode_supported_p
-#endif
-
-#ifndef TARGET_ENUM_VA_LIST_P
-#define TARGET_ENUM_VA_LIST_P NULL
-#endif
-
-#ifndef TARGET_DECIMAL_FLOAT_SUPPORTED_P
-#define TARGET_DECIMAL_FLOAT_SUPPORTED_P default_decimal_float_supported_p
-#endif
-
-#ifndef TARGET_FIXED_POINT_SUPPORTED_P
-#define TARGET_FIXED_POINT_SUPPORTED_P default_fixed_point_supported_p
-#endif
-
-#ifndef TARGET_VECTOR_MODE_SUPPORTED_P
-#define TARGET_VECTOR_MODE_SUPPORTED_P hook_bool_mode_false
-#endif
-
-#ifndef TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P
-#define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_false
-#endif
-
-/* In hooks.c. */
-#define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false
-#define TARGET_BRANCH_TARGET_REGISTER_CLASS \
- default_branch_target_register_class
-#define TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED hook_bool_bool_false
-#define TARGET_HAVE_CONDITIONAL_EXECUTION default_have_conditional_execution
-#define TARGET_LOOP_UNROLL_ADJUST NULL
-#define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_rtx_false
-#define TARGET_CANNOT_COPY_INSN_P NULL
-#define TARGET_COMMUTATIVE_P hook_bool_const_rtx_commutative_p
-#define TARGET_LEGITIMIZE_ADDRESS default_legitimize_address
-#define TARGET_DELEGITIMIZE_ADDRESS delegitimize_mem_from_attrs
-#define TARGET_LEGITIMATE_ADDRESS_P default_legitimate_address_p
-#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_false
-#define TARGET_MIN_ANCHOR_OFFSET 0
-#define TARGET_MAX_ANCHOR_OFFSET 0
-#define TARGET_USE_ANCHORS_FOR_SYMBOL_P default_use_anchors_for_symbol_p
-#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false
-#define TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P hook_bool_const_tree_false
-#define TARGET_COMP_TYPE_ATTRIBUTES hook_int_const_tree_const_tree_1
-#ifndef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
-#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
-#endif
-#define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
-#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_const_tree_false
-#define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_const_tree_false
-#define TARGET_ALIGN_ANON_BITFIELD hook_bool_void_false
-#define TARGET_NARROW_VOLATILE_BITFIELD hook_bool_void_false
-#define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_bool_false
-#define TARGET_MANGLE_TYPE hook_constcharptr_const_tree_null
-#define TARGET_ALLOCATE_INITIAL_VALUE NULL
-
-#define TARGET_UNSPEC_MAY_TRAP_P default_unspec_may_trap_p
-
-#ifndef TARGET_SET_CURRENT_FUNCTION
-#define TARGET_SET_CURRENT_FUNCTION hook_void_tree
-#endif
-
-#ifndef TARGET_INIT_LIBFUNCS
-#define TARGET_INIT_LIBFUNCS hook_void_void
-#endif
-
-#ifndef TARGET_IN_SMALL_DATA_P
-#define TARGET_IN_SMALL_DATA_P hook_bool_const_tree_false
-#endif
-
-#ifndef TARGET_MODE_DEPENDENT_ADDRESS_P
-#define TARGET_MODE_DEPENDENT_ADDRESS_P default_mode_dependent_address_p
-#endif
-
-#ifndef TARGET_MANGLE_DECL_ASSEMBLER_NAME
-#define TARGET_MANGLE_DECL_ASSEMBLER_NAME default_mangle_decl_assembler_name
-#endif
-
-#ifndef TARGET_ENCODE_SECTION_INFO
-#define TARGET_ENCODE_SECTION_INFO default_encode_section_info
-#endif
-
-#ifndef TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN
-#define TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN hook_invalid_arg_for_unprototyped_fn
-#endif
-
-#define TARGET_INVALID_CONVERSION hook_constcharptr_const_tree_const_tree_null
-#define TARGET_INVALID_UNARY_OP hook_constcharptr_int_const_tree_null
-#define TARGET_INVALID_BINARY_OP hook_constcharptr_int_const_tree_const_tree_null
-#define TARGET_INVALID_PARAMETER_TYPE hook_constcharptr_const_tree_null
-#define TARGET_INVALID_RETURN_TYPE hook_constcharptr_const_tree_null
-#define TARGET_PROMOTED_TYPE hook_tree_const_tree_null
-#define TARGET_CONVERT_TO_TYPE hook_tree_tree_tree_null
-
-#define TARGET_FIXED_CONDITION_CODE_REGS hook_bool_uintp_uintp_false
-
-#define TARGET_CC_MODES_COMPATIBLE default_cc_modes_compatible
-
-#define TARGET_MACHINE_DEPENDENT_REORG 0
-
-#define TARGET_BUILD_BUILTIN_VA_LIST std_build_builtin_va_list
-#define TARGET_FN_ABI_VA_LIST std_fn_abi_va_list
-#define TARGET_CANONICAL_VA_LIST_TYPE std_canonical_va_list_type
-#define TARGET_EXPAND_BUILTIN_VA_START 0
-
-#define TARGET_GET_PCH_VALIDITY default_get_pch_validity
-#define TARGET_PCH_VALID_P default_pch_valid_p
-#define TARGET_CHECK_PCH_TARGET_FLAGS NULL
-
-#define TARGET_DEFAULT_SHORT_ENUMS hook_bool_void_false
-
-#define TARGET_BUILTIN_SETJMP_FRAME_VALUE default_builtin_setjmp_frame_value
-
-#define TARGET_MD_ASM_CLOBBERS hook_tree_tree_tree_tree_3rd_identity
-
-#define TARGET_DWARF_CALLING_CONVENTION hook_int_const_tree_0
-
-#define TARGET_DWARF_HANDLE_FRAME_UNSPEC 0
-
-#define TARGET_STDARG_OPTIMIZE_HOOK 0
-
-#define TARGET_STACK_PROTECT_GUARD default_stack_protect_guard
-#define TARGET_STACK_PROTECT_FAIL default_external_stack_protect_fail
-
-#define TARGET_ARM_EABI_UNWINDER false
-
-#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_false
-
-#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null
-#define TARGET_RETURN_IN_MEMORY default_return_in_memory
-#define TARGET_RETURN_IN_MSB hook_bool_const_tree_false
-
-#define TARGET_EXPAND_BUILTIN_SAVEREGS default_expand_builtin_saveregs
-#define TARGET_SETUP_INCOMING_VARARGS default_setup_incoming_varargs
-#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_false
-#define TARGET_PRETEND_OUTGOING_VARARGS_NAMED \
- default_pretend_outgoing_varargs_named
-#define TARGET_SPLIT_COMPLEX_ARG NULL
-
-#define TARGET_GIMPLIFY_VA_ARG_EXPR std_gimplify_va_arg_expr
-#define TARGET_PASS_BY_REFERENCE hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
-
-#define TARGET_RELAXED_ORDERING false
-
-#define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size_or_pad
-#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
-#define TARGET_ARG_PARTIAL_BYTES hook_int_CUMULATIVE_ARGS_mode_tree_bool_0
-
-#define TARGET_FUNCTION_VALUE default_function_value
-#define TARGET_LIBCALL_VALUE default_libcall_value
-#define TARGET_FUNCTION_VALUE_REGNO_P default_function_value_regno_p
-#define TARGET_INTERNAL_ARG_POINTER default_internal_arg_pointer
-#define TARGET_UPDATE_STACK_BOUNDARY NULL
-#define TARGET_GET_DRAP_RTX NULL
-#define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS hook_bool_void_true
-#define TARGET_STATIC_CHAIN default_static_chain
-#define TARGET_TRAMPOLINE_INIT default_trampoline_init
-#define TARGET_TRAMPOLINE_ADJUST_ADDRESS NULL
-
-#define TARGET_CALLS { \
- TARGET_PROMOTE_FUNCTION_MODE, \
- TARGET_PROMOTE_PROTOTYPES, \
- TARGET_STRUCT_VALUE_RTX, \
- TARGET_RETURN_IN_MEMORY, \
- TARGET_RETURN_IN_MSB, \
- TARGET_PASS_BY_REFERENCE, \
- TARGET_EXPAND_BUILTIN_SAVEREGS, \
- TARGET_SETUP_INCOMING_VARARGS, \
- TARGET_STRICT_ARGUMENT_NAMING, \
- TARGET_PRETEND_OUTGOING_VARARGS_NAMED, \
- TARGET_SPLIT_COMPLEX_ARG, \
- TARGET_MUST_PASS_IN_STACK, \
- TARGET_CALLEE_COPIES, \
- TARGET_ARG_PARTIAL_BYTES, \
- TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN, \
- TARGET_FUNCTION_VALUE, \
- TARGET_LIBCALL_VALUE, \
- TARGET_FUNCTION_VALUE_REGNO_P, \
- TARGET_INTERNAL_ARG_POINTER, \
- TARGET_UPDATE_STACK_BOUNDARY, \
- TARGET_GET_DRAP_RTX, \
- TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS, \
- TARGET_STATIC_CHAIN, \
- TARGET_TRAMPOLINE_INIT, \
- TARGET_TRAMPOLINE_ADJUST_ADDRESS \
- }
-
-#ifndef TARGET_UNWIND_TABLES_DEFAULT
-#define TARGET_UNWIND_TABLES_DEFAULT false
-#endif
-
-#ifndef TARGET_HANDLE_PRAGMA_EXTERN_PREFIX
-#define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 0
-#endif
-
-#ifdef IRA_COVER_CLASSES
-#define TARGET_IRA_COVER_CLASSES default_ira_cover_classes
-#else
+#ifndef IRA_COVER_CLASSES
#define TARGET_IRA_COVER_CLASSES 0
#endif
-#ifndef TARGET_SECONDARY_RELOAD
-#define TARGET_SECONDARY_RELOAD default_secondary_reload
-#endif
-
-#ifndef TARGET_EXPAND_TO_RTL_HOOK
-#define TARGET_EXPAND_TO_RTL_HOOK hook_void_void
-#endif
-
-#ifndef TARGET_INSTANTIATE_DECLS
-#define TARGET_INSTANTIATE_DECLS hook_void_void
-#endif
-
-#ifndef TARGET_HARD_REGNO_SCRATCH_OK
-#define TARGET_HARD_REGNO_SCRATCH_OK default_hard_regno_scratch_ok
-#endif
-
-#ifndef TARGET_CASE_VALUES_THRESHOLD
-#define TARGET_CASE_VALUES_THRESHOLD default_case_values_threshold
-#endif
-
-#ifndef TARGET_FRAME_POINTER_REQUIRED
-#define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_false
-#endif
-
-#ifndef TARGET_CAN_ELIMINATE
-#define TARGET_CAN_ELIMINATE hook_bool_const_int_const_int_true
-#endif
-
-/* C specific. */
-#ifndef TARGET_C_MODE_FOR_SUFFIX
-#define TARGET_C_MODE_FOR_SUFFIX default_mode_for_suffix
-#endif
-
-#define TARGET_C \
- { \
- TARGET_C_MODE_FOR_SUFFIX \
- }
-
-/* C++ specific. */
-#ifndef TARGET_CXX_GUARD_TYPE
-#define TARGET_CXX_GUARD_TYPE default_cxx_guard_type
-#endif
-
-#ifndef TARGET_CXX_GUARD_MASK_BIT
-#define TARGET_CXX_GUARD_MASK_BIT hook_bool_void_false
-#endif
-
-#ifndef TARGET_CXX_GET_COOKIE_SIZE
-#define TARGET_CXX_GET_COOKIE_SIZE default_cxx_get_cookie_size
-#endif
-
-#ifndef TARGET_CXX_COOKIE_HAS_SIZE
-#define TARGET_CXX_COOKIE_HAS_SIZE hook_bool_void_false
-#endif
-
-#ifndef TARGET_CXX_IMPORT_EXPORT_CLASS
-#define TARGET_CXX_IMPORT_EXPORT_CLASS NULL
-#endif
-
-#ifndef TARGET_CXX_CDTOR_RETURNS_THIS
-#define TARGET_CXX_CDTOR_RETURNS_THIS hook_bool_void_false
-#endif
-
-#ifndef TARGET_CXX_KEY_METHOD_MAY_BE_INLINE
-#define TARGET_CXX_KEY_METHOD_MAY_BE_INLINE hook_bool_void_true
-#endif
-
-#ifndef TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY
-#define TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY hook_void_tree
-#endif
-
-#ifndef TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT
-#define TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT hook_bool_void_true
-#endif
-
-#ifndef TARGET_CXX_LIBRARY_RTTI_COMDAT
-#define TARGET_CXX_LIBRARY_RTTI_COMDAT hook_bool_void_true
-#endif
-
-#ifndef TARGET_CXX_USE_AEABI_ATEXIT
-#define TARGET_CXX_USE_AEABI_ATEXIT hook_bool_void_false
-#endif
-
-#ifndef TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT
-#define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_false
-#endif
-
-#ifndef TARGET_CXX_ADJUST_CLASS_AT_DEFINITION
-#define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION hook_void_tree
-#endif
-
-#define TARGET_CXX \
- { \
- TARGET_CXX_GUARD_TYPE, \
- TARGET_CXX_GUARD_MASK_BIT, \
- TARGET_CXX_GET_COOKIE_SIZE, \
- TARGET_CXX_COOKIE_HAS_SIZE, \
- TARGET_CXX_IMPORT_EXPORT_CLASS, \
- TARGET_CXX_CDTOR_RETURNS_THIS, \
- TARGET_CXX_KEY_METHOD_MAY_BE_INLINE, \
- TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY, \
- TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT, \
- TARGET_CXX_LIBRARY_RTTI_COMDAT, \
- TARGET_CXX_USE_AEABI_ATEXIT, \
- TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT, \
- TARGET_CXX_ADJUST_CLASS_AT_DEFINITION \
- }
-
-/* EMUTLS specific */
-#ifndef TARGET_EMUTLS_GET_ADDRESS
-#define TARGET_EMUTLS_GET_ADDRESS "__builtin___emutls_get_address"
-#endif
-
-#ifndef TARGET_EMUTLS_REGISTER_COMMON
-#define TARGET_EMUTLS_REGISTER_COMMON "__builtin___emutls_register_common"
-#endif
-
-#ifndef TARGET_EMUTLS_VAR_SECTION
-#define TARGET_EMUTLS_VAR_SECTION NULL
-#endif
-
-#ifndef TARGET_EMUTLS_TMPL_SECTION
-#define TARGET_EMUTLS_TMPL_SECTION NULL
-#endif
-
-#ifndef TARGET_EMUTLS_VAR_PREFIX
-#define TARGET_EMUTLS_VAR_PREFIX NULL
-#endif
-
-#ifndef TARGET_EMUTLS_TMPL_PREFIX
-#define TARGET_EMUTLS_TMPL_PREFIX NULL
-#endif
-
-#ifndef TARGET_EMUTLS_VAR_FIELDS
-#define TARGET_EMUTLS_VAR_FIELDS default_emutls_var_fields
-#endif
-
-#ifndef TARGET_EMUTLS_VAR_INIT
-#define TARGET_EMUTLS_VAR_INIT default_emutls_var_init
-#endif
-
-#ifndef TARGET_EMUTLS_VAR_ALIGN_FIXED
-#define TARGET_EMUTLS_VAR_ALIGN_FIXED false
-#endif
-
-#ifndef TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS
-#define TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS false
-#endif
-
-#define TARGET_EMUTLS \
- { \
- TARGET_EMUTLS_GET_ADDRESS, \
- TARGET_EMUTLS_REGISTER_COMMON, \
- TARGET_EMUTLS_VAR_SECTION, \
- TARGET_EMUTLS_TMPL_SECTION, \
- TARGET_EMUTLS_VAR_PREFIX, \
- TARGET_EMUTLS_TMPL_PREFIX, \
- TARGET_EMUTLS_VAR_FIELDS, \
- TARGET_EMUTLS_VAR_INIT, \
- TARGET_EMUTLS_VAR_ALIGN_FIXED, \
- TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS \
- }
-
-/* Function specific option attribute support. */
-#ifndef TARGET_OPTION_VALID_ATTRIBUTE_P
-#define TARGET_OPTION_VALID_ATTRIBUTE_P \
- default_target_option_valid_attribute_p
-#endif
-
-#ifndef TARGET_OPTION_SAVE
-#define TARGET_OPTION_SAVE NULL
-#endif
-
-#ifndef TARGET_OPTION_RESTORE
-#define TARGET_OPTION_RESTORE NULL
+#if !defined (TARGET_FUNCTION_INCOMING_ARG) && !defined (FUNCTION_INCOMING_ARG)
+#define TARGET_FUNCTION_INCOMING_ARG TARGET_FUNCTION_ARG
#endif
-#ifndef TARGET_OPTION_PRINT
-#define TARGET_OPTION_PRINT NULL
-#endif
-
-#ifndef TARGET_OPTION_PRAGMA_PARSE
-#define TARGET_OPTION_PRAGMA_PARSE default_target_option_pragma_parse
-#endif
-
-#ifndef TARGET_CAN_INLINE_P
-#define TARGET_CAN_INLINE_P default_target_can_inline_p
-#endif
-
-#define TARGET_OPTION_HOOKS \
- { \
- TARGET_OPTION_VALID_ATTRIBUTE_P, \
- TARGET_OPTION_SAVE, \
- TARGET_OPTION_RESTORE, \
- TARGET_OPTION_PRINT, \
- TARGET_OPTION_PRAGMA_PARSE, \
- TARGET_CAN_INLINE_P, \
- }
-
-/* The whole shebang. */
-#define TARGET_INITIALIZER \
-{ \
- TARGET_ASM_OUT, \
- TARGET_SCHED, \
- TARGET_VECTORIZE, \
- TARGET_DEFAULT_TARGET_FLAGS, \
- TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE, \
- TARGET_HANDLE_OPTION, \
- TARGET_HANDLE_OFAST, \
- TARGET_HELP, \
- TARGET_EH_RETURN_FILTER_MODE, \
- TARGET_LIBGCC_CMP_RETURN_MODE, \
- TARGET_LIBGCC_SHIFT_COUNT_MODE, \
- TARGET_UNWIND_WORD_MODE, \
- TARGET_MERGE_DECL_ATTRIBUTES, \
- TARGET_MERGE_TYPE_ATTRIBUTES, \
- TARGET_ATTRIBUTE_TABLE, \
- TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P, \
- TARGET_COMP_TYPE_ATTRIBUTES, \
- TARGET_SET_DEFAULT_TYPE_ATTRIBUTES, \
- TARGET_INSERT_ATTRIBUTES, \
- TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P, \
- TARGET_MS_BITFIELD_LAYOUT_P, \
- TARGET_DECIMAL_FLOAT_SUPPORTED_P, \
- TARGET_FIXED_POINT_SUPPORTED_P, \
- TARGET_ALIGN_ANON_BITFIELD, \
- TARGET_NARROW_VOLATILE_BITFIELD, \
- TARGET_INIT_BUILTINS, \
- TARGET_BUILTIN_DECL, \
- TARGET_EXPAND_BUILTIN, \
- TARGET_RESOLVE_OVERLOADED_BUILTIN, \
- TARGET_FOLD_BUILTIN, \
- TARGET_BUILTIN_RECIPROCAL, \
- TARGET_MANGLE_TYPE, \
- TARGET_INIT_LIBFUNCS, \
- TARGET_SECTION_TYPE_FLAGS, \
- TARGET_CANNOT_MODIFY_JUMPS_P, \
- TARGET_BRANCH_TARGET_REGISTER_CLASS, \
- TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED, \
- TARGET_HAVE_CONDITIONAL_EXECUTION, \
- TARGET_LOOP_UNROLL_ADJUST, \
- TARGET_CANNOT_FORCE_CONST_MEM, \
- TARGET_CANNOT_COPY_INSN_P, \
- TARGET_COMMUTATIVE_P, \
- TARGET_MODE_DEPENDENT_ADDRESS_P, \
- TARGET_LEGITIMIZE_ADDRESS, \
- TARGET_DELEGITIMIZE_ADDRESS, \
- TARGET_LEGITIMATE_ADDRESS_P, \
- TARGET_USE_BLOCKS_FOR_CONSTANT_P, \
- TARGET_MIN_ANCHOR_OFFSET, \
- TARGET_MAX_ANCHOR_OFFSET, \
- TARGET_USE_ANCHORS_FOR_SYMBOL_P, \
- TARGET_FUNCTION_OK_FOR_SIBCALL, \
- TARGET_SET_CURRENT_FUNCTION, \
- TARGET_IN_SMALL_DATA_P, \
- TARGET_BINDS_LOCAL_P, \
- TARGET_MANGLE_DECL_ASSEMBLER_NAME, \
- TARGET_ENCODE_SECTION_INFO, \
- TARGET_STRIP_NAME_ENCODING, \
- TARGET_SHIFT_TRUNCATION_MASK, \
- TARGET_MIN_DIVISIONS_FOR_RECIP_MUL, \
- TARGET_MODE_REP_EXTENDED, \
- TARGET_VALID_POINTER_MODE, \
- TARGET_ADDR_SPACE_HOOKS, \
- TARGET_SCALAR_MODE_SUPPORTED_P, \
- TARGET_VECTOR_MODE_SUPPORTED_P, \
- TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P, \
- TARGET_RTX_COSTS, \
- TARGET_ADDRESS_COST, \
- TARGET_ALLOCATE_INITIAL_VALUE, \
- TARGET_UNSPEC_MAY_TRAP_P, \
- TARGET_DWARF_REGISTER_SPAN, \
- TARGET_INIT_DWARF_REG_SIZES_EXTRA, \
- TARGET_FIXED_CONDITION_CODE_REGS, \
- TARGET_CC_MODES_COMPATIBLE, \
- TARGET_MACHINE_DEPENDENT_REORG, \
- TARGET_BUILD_BUILTIN_VA_LIST, \
- TARGET_ENUM_VA_LIST_P, \
- TARGET_FN_ABI_VA_LIST, \
- TARGET_CANONICAL_VA_LIST_TYPE, \
- TARGET_EXPAND_BUILTIN_VA_START, \
- TARGET_GIMPLIFY_VA_ARG_EXPR, \
- TARGET_GET_PCH_VALIDITY, \
- TARGET_PCH_VALID_P, \
- TARGET_CHECK_PCH_TARGET_FLAGS, \
- TARGET_DEFAULT_SHORT_ENUMS, \
- TARGET_BUILTIN_SETJMP_FRAME_VALUE, \
- TARGET_MD_ASM_CLOBBERS, \
- TARGET_DWARF_CALLING_CONVENTION, \
- TARGET_DWARF_HANDLE_FRAME_UNSPEC, \
- TARGET_STDARG_OPTIMIZE_HOOK, \
- TARGET_STACK_PROTECT_GUARD, \
- TARGET_STACK_PROTECT_FAIL, \
- TARGET_INVALID_WITHIN_DOLOOP, \
- TARGET_VALID_DLLIMPORT_ATTRIBUTE_P, \
- TARGET_CONST_ANCHOR, \
- TARGET_CALLS, \
- TARGET_INVALID_CONVERSION, \
- TARGET_INVALID_UNARY_OP, \
- TARGET_INVALID_BINARY_OP, \
- TARGET_INVALID_PARAMETER_TYPE, \
- TARGET_INVALID_RETURN_TYPE, \
- TARGET_PROMOTED_TYPE, \
- TARGET_CONVERT_TO_TYPE, \
- TARGET_IRA_COVER_CLASSES, \
- TARGET_SECONDARY_RELOAD, \
- TARGET_EXPAND_TO_RTL_HOOK, \
- TARGET_INSTANTIATE_DECLS, \
- TARGET_HARD_REGNO_SCRATCH_OK, \
- TARGET_CASE_VALUES_THRESHOLD, \
- TARGET_FRAME_POINTER_REQUIRED, \
- TARGET_CAN_ELIMINATE, \
- TARGET_C, \
- TARGET_CXX, \
- TARGET_EMUTLS, \
- TARGET_OPTION_HOOKS, \
- TARGET_EXTRA_LIVE_ON_ENTRY, \
- TARGET_UNWIND_TABLES_DEFAULT, \
- TARGET_HAVE_NAMED_SECTIONS, \
- TARGET_HAVE_SWITCHABLE_BSS_SECTIONS, \
- TARGET_HAVE_CTORS_DTORS, \
- TARGET_HAVE_TLS, \
- TARGET_HAVE_SRODATA_SECTION, \
- TARGET_TERMINATE_DW2_EH_FRAME_INFO, \
- TARGET_ASM_FILE_START_APP_OFF, \
- TARGET_ASM_FILE_START_FILE_DIRECTIVE, \
- TARGET_HANDLE_PRAGMA_EXTERN_PREFIX, \
- TARGET_RELAXED_ORDERING, \
- TARGET_ARM_EABI_UNWINDER \
-}
-
-#define TARGET_HANDLE_C_OPTION default_handle_c_option
-#define TARGETCM_INITIALIZER { TARGET_HANDLE_C_OPTION }
+#include "target-hooks-def.h"
#include "hooks.h"
#include "targhooks.h"
diff --git a/gcc/target.def b/gcc/target.def
new file mode 100644
index 00000000000..8bcf877359c
--- /dev/null
+++ b/gcc/target.def
@@ -0,0 +1,2358 @@
+/* Target hook definitions.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 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 the
+ Free Software Foundation; either version 3, 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; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them. Help stamp out software-hoarding! */
+
+/* The following macros should be provided by the including file:
+
+ DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
+ DEFHOOKPOD(DOC, TYPE, NAME, INIT): Define a piece-of-data 'hook'. */
+
+/* Defaults for optional macros:
+ DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
+ with the previous 'hook'. */
+#ifndef DEFHOOKPODX
+#define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
+#endif
+
+/* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
+ members into a struct gcc_target, which in turn contains several
+ sub-structs. */
+#ifndef HOOKSTRUCT
+#define HOOKSTRUCT(FRAGMENT)
+#endif
+/* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
+ HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
+ name for nested use. */
+#ifndef HOOK_VECTOR_1
+#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT(FRAGMENT)
+#endif
+#define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
+#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
+
+HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
+
+/* FIXME: For pre-existing hooks, we can't place the documentation in the
+ documentation field here till we get permission from the FSF to include
+ it in GPLed software - the target hook documentation is so far only
+ available under the GFDL. */
+
+/* A hook should generally be documented by a string in the DOC parameter,
+ which should contain texinfo markup. If the documentation is only available
+ under the GPL, but not under the GFDL, put it in a comment above the hook
+ definition. If the function declaration is available both under GPL and
+ GFDL, but the documentation is only available under the GFDL, put the
+ documentaton in tm.texi.in, heading with @hook <hookname> and closing
+ the paragraph with @end deftypefn / deftypevr as appropriate, and marking
+ the next autogenerated hook with @hook <hookname>.
+ In both these cases, leave the DOC string empty, i.e. "".
+ Sometimes, for some historic reason the function declaration
+ has to be documented differently
+ than what it is. In that case, use DEFHOOK_UNDOC to supress auto-generation
+ of documentation. DEFHOOK_UNDOC takes a DOC string which it ignores, so
+ you can put GPLed documentation string there if you have hopes that you
+ can clear the declaration & documentation for GFDL distribution later,
+ in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
+ to turn on the autogeneration of the documentation.
+
+ A documentation string of "*" means not to emit any documentation at all,
+ and is mainly used internally for DEFHOOK_UNDOC. It should generally not
+ be used otherwise, but it has its use for exceptional cases where automatic
+ documentation is not wanted, and the real documentation is elsewere, like
+ for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
+ purposes; they refer to structs, the components of which are documented as
+ separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
+ A DOC string of 0 is for internal use of DEFHOOKPODX and special table
+ entries only. */
+
+/* Functions that output assembler for the target. */
+#define HOOK_PREFIX "TARGET_ASM_"
+HOOK_VECTOR (TARGET_ASM_OUT, asm_out)
+
+/* Opening and closing parentheses for asm expression grouping. */
+DEFHOOKPOD
+(open_paren,
+ "",
+ const char *, "(")
+DEFHOOKPODX (close_paren, const char *, ")")
+
+/* Assembler instructions for creating various kinds of integer object. */
+DEFHOOKPOD
+(byte_op,
+ "",
+ const char *, "\t.byte\t")
+DEFHOOKPOD (aligned_op, "*", struct asm_int_op, TARGET_ASM_ALIGNED_INT_OP)
+DEFHOOKPOD (unaligned_op, "*", struct asm_int_op, TARGET_ASM_UNALIGNED_INT_OP)
+
+/* Try to output the assembler code for an integer object whose
+ value is given by X. SIZE is the size of the object in bytes and
+ ALIGNED_P indicates whether it is aligned. Return true if
+ successful. Only handles cases for which BYTE_OP, ALIGNED_OP
+ and UNALIGNED_OP are NULL. */
+DEFHOOK
+(integer,
+ "",
+ /* Only handles cases for which BYTE_OP, ALIGNED_OP and UNALIGNED_OP are
+ NULL. */
+ bool, (rtx x, unsigned int size, int aligned_p),
+ default_assemble_integer)
+
+/* Output code that will globalize a label. */
+DEFHOOK
+(globalize_label,
+ "",
+ void, (FILE *stream, const char *name),
+ default_globalize_label)
+
+/* Output code that will globalize a declaration. */
+DEFHOOK
+(globalize_decl_name,
+ "",
+ void, (FILE *stream, tree decl), default_globalize_decl_name)
+
+/* Output code that will emit a label for unwind info, if this
+ target requires such labels. Second argument is the decl the
+ unwind info is associated with, third is a boolean: true if
+ this is for exception handling, fourth is a boolean: true if
+ this is only a placeholder for an omitted FDE. */
+DEFHOOK
+(emit_unwind_label,
+ "",
+ void, (FILE *stream, tree decl, int for_eh, int empty),
+ default_emit_unwind_label)
+
+/* Output code that will emit a label to divide up the exception table. */
+DEFHOOK
+(emit_except_table_label,
+ "",
+ void, (FILE *stream),
+ default_emit_except_table_label)
+
+/* Emit any directives required to unwind this instruction. */
+DEFHOOK
+(unwind_emit,
+ "",
+ void, (FILE *stream, rtx insn),
+ default_unwind_emit)
+
+/* Output an internal label. */
+DEFHOOK
+(internal_label,
+ "",
+ void, (FILE *stream, const char *prefix, unsigned long labelno),
+ default_internal_label)
+
+/* Output label for the constant. */
+DEFHOOK
+(declare_constant_name,
+ "",
+ void, (FILE *file, const char *name, const_tree expr, HOST_WIDE_INT size),
+ default_asm_declare_constant_name)
+
+/* Emit a ttype table reference to a typeinfo object. */
+DEFHOOK
+(ttype,
+ "",
+ bool, (rtx sym),
+ hook_bool_rtx_false)
+
+/* Emit an assembler directive to set visibility for the symbol
+ associated with the tree decl. */
+DEFHOOK
+(assemble_visibility,
+ "",
+ void, (tree decl, int visibility),
+ default_assemble_visibility)
+
+/* Output the assembler code for entry to a function. */
+DEFHOOK
+(function_prologue,
+ "",
+ void, (FILE *file, HOST_WIDE_INT size),
+ default_function_pro_epilogue)
+
+/* Output the assembler code for end of prologue. */
+DEFHOOK
+(function_end_prologue,
+ "",
+ void, (FILE *file),
+ no_asm_to_stream)
+
+/* Output the assembler code for start of epilogue. */
+DEFHOOK
+(function_begin_epilogue,
+ "",
+ void, (FILE *file),
+ no_asm_to_stream)
+
+/* Output the assembler code for function exit. */
+DEFHOOK
+(function_epilogue,
+ "",
+ void, (FILE *file, HOST_WIDE_INT size),
+ default_function_pro_epilogue)
+
+/* Initialize target-specific sections. */
+DEFHOOK
+(init_sections,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Tell assembler to change to section NAME with attributes FLAGS.
+ If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
+ which this section is associated. */
+DEFHOOK
+(named_section,
+ "",
+ void, (const char *name, unsigned int flags, tree decl),
+ default_no_named_section)
+
+/* Return a mask describing how relocations should be treated when
+ selecting sections. Bit 1 should be set if global relocations
+ should be placed in a read-write section; bit 0 should be set if
+ local relocations should be placed in a read-write section. */
+DEFHOOK
+(reloc_rw_mask,
+ "",
+ int, (void),
+ default_reloc_rw_mask)
+
+ /* Return a section for EXP. It may be a DECL or a constant. RELOC
+ is nonzero if runtime relocations must be applied; bit 1 will be
+ set if the runtime relocations require non-local name resolution.
+ ALIGN is the required alignment of the data. */
+DEFHOOK
+(select_section,
+ "",
+ section *, (tree exp, int reloc, unsigned HOST_WIDE_INT align),
+ default_select_section)
+
+/* Return a section for X. MODE is X's mode and ALIGN is its
+ alignment in bits. */
+DEFHOOK
+(select_rtx_section,
+ "",
+ section *, (enum machine_mode mode, rtx x, unsigned HOST_WIDE_INT align),
+ default_select_rtx_section)
+
+/* Select a unique section name for DECL. RELOC is the same as
+ for SELECT_SECTION. */
+DEFHOOK
+(unique_section,
+ "",
+ void, (tree decl, int reloc),
+ default_unique_section)
+
+/* Return the readonly data section associated with function DECL. */
+DEFHOOK
+(function_rodata_section,
+ "",
+ section *, (tree decl),
+ default_function_rodata_section)
+
+/* Output a constructor for a symbol with a given priority. */
+DEFHOOK
+(constructor,
+ "",
+ void, (rtx symbol, int priority), NULL)
+
+/* Output a destructor for a symbol with a given priority. */
+DEFHOOK
+(destructor,
+ "",
+ void, (rtx symbol, int priority), NULL)
+
+/* Output the assembler code for a thunk function. THUNK_DECL is the
+ declaration for the thunk function itself, FUNCTION is the decl for
+ the target function. DELTA is an immediate constant offset to be
+ added to THIS. If VCALL_OFFSET is nonzero, the word at
+ *(*this + vcall_offset) should be added to THIS. */
+DEFHOOK
+(output_mi_thunk,
+ "",
+ void, (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta,
+ HOST_WIDE_INT vcall_offset, tree function),
+ NULL)
+
+/* Determine whether output_mi_thunk would succeed. */
+/* ??? Ideally, this hook would not exist, and success or failure
+ would be returned from output_mi_thunk directly. But there's
+ too much undo-able setup involved in invoking output_mi_thunk.
+ Could be fixed by making output_mi_thunk emit rtl instead of
+ text to the output file. */
+DEFHOOK
+(can_output_mi_thunk,
+ "",
+ bool, (const_tree thunk_fndecl, HOST_WIDE_INT delta,
+ HOST_WIDE_INT vcall_offset, const_tree function),
+ hook_bool_const_tree_hwi_hwi_const_tree_false)
+
+/* Output any boilerplate text needed at the beginning of a
+ translation unit. */
+DEFHOOK
+(file_start,
+ "",
+ void, (void),
+ default_file_start)
+
+/* Output any boilerplate text needed at the end of a translation unit. */
+DEFHOOK
+(file_end,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Output any boilerplate text needed at the beginning of an
+ LTO output stream. */
+DEFHOOK
+(lto_start,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Output any boilerplate text needed at the end of an
+ LTO output stream. */
+DEFHOOK
+(lto_end,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Output any boilerplace text needed at the end of a
+ translation unit before debug and unwind info is emitted. */
+DEFHOOK
+(code_end,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Output an assembler pseudo-op to declare a library function name
+ external. */
+DEFHOOK
+(external_libcall,
+ "",
+ void, (rtx symref),
+ default_external_libcall)
+
+/* Output an assembler directive to mark decl live. This instructs
+ linker to not dead code strip this symbol. */
+DEFHOOK
+(mark_decl_preserved,
+ "",
+ void, (const char *symbol),
+ hook_void_constcharptr)
+
+/* Output a record of the command line switches that have been passed. */
+DEFHOOK
+(record_gcc_switches,
+ "",
+ int, (print_switch_type type, const char *text),
+ NULL)
+
+/* The name of the section that the example ELF implementation of
+ record_gcc_switches will use to store the information. Target
+ specific versions of record_gcc_switches may or may not use
+ this information. */
+DEFHOOKPOD
+(record_gcc_switches_section,
+ "",
+ const char *, ".GCC.command.line")
+
+/* Output the definition of a section anchor. */
+DEFHOOK
+(output_anchor,
+ "",
+ void, (rtx x),
+ default_asm_output_anchor)
+
+/* Output a DTP-relative reference to a TLS symbol. */
+DEFHOOK
+(output_dwarf_dtprel,
+ "",
+ void, (FILE *file, int size, rtx x),
+ NULL)
+
+/* Some target machines need to postscan each insn after it is output. */
+DEFHOOK
+(final_postscan_insn,
+ "",
+ void, (FILE *file, rtx insn, rtx *opvec, int noperands),
+ NULL)
+
+/* Emit the trampoline template. This hook may be NULL. */
+DEFHOOK
+(trampoline_template,
+ "",
+ void, (FILE *f),
+ NULL)
+
+/* ??? The TARGET_PRINT_OPERAND* hooks are part of the asm_out struct,
+ even though that is not reflected in the macro name to override their
+ initializers. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_"
+
+/* Emit a machine-specific insn operand. */
+/* ??? tm.texi only documents the old macro PRINT_OPERAND,
+ not this hook, and uses a different name for the argument FILE. */
+DEFHOOK_UNDOC
+(print_operand,
+ "",
+ void, (FILE *file, rtx x, int code),
+ default_print_operand)
+
+/* Emit a machine-specific memory address. */
+/* ??? tm.texi only documents the old macro PRINT_OPERAND_ADDRESS,
+ not this hook, and uses different argument names. */
+DEFHOOK_UNDOC
+(print_operand_address,
+ "",
+ void, (FILE *file, rtx addr),
+ default_print_operand_address)
+
+/* Determine whether CODE is a valid punctuation character for the
+ `print_operand' hook. */
+/* ??? tm.texi only documents the old macro PRINT_OPERAND_PUNCT_VALID_P,
+ not this hook. */
+DEFHOOK_UNDOC
+(print_operand_punct_valid_p,
+ "",
+ bool ,(unsigned char code),
+ default_print_operand_punct_valid_p)
+
+HOOK_VECTOR_END (asm_out)
+
+/* Functions relating to instruction scheduling. All of these
+ default to null pointers, which haifa-sched.c looks for and handles. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_SCHED_"
+HOOK_VECTOR (TARGET_SCHED, sched)
+
+/* Given the current cost, COST, of an insn, INSN, calculate and
+ return a new cost based on its relationship to DEP_INSN through
+ the dependence LINK. The default is to make no adjustment. */
+DEFHOOK
+(adjust_cost,
+ "",
+ int, (rtx insn, rtx link, rtx dep_insn, int cost), NULL)
+
+/* Adjust the priority of an insn as you see fit. Returns the new priority. */
+DEFHOOK
+(adjust_priority,
+ "",
+ int, (rtx insn, int priority), NULL)
+
+/* Function which returns the maximum number of insns that can be
+ scheduled in the same machine cycle. This must be constant
+ over an entire compilation. The default is 1. */
+DEFHOOK
+(issue_rate,
+ "",
+ int, (void), NULL)
+
+/* Calculate how much this insn affects how many more insns we
+ can emit this cycle. Default is they all cost the same. */
+DEFHOOK
+(variable_issue,
+ "",
+ int, (FILE *file, int verbose, rtx insn, int more), NULL)
+
+/* Initialize machine-dependent scheduling code. */
+DEFHOOK
+(init,
+ "",
+ void, (FILE *file, int verbose, int max_ready), NULL)
+
+/* Finalize machine-dependent scheduling code. */
+DEFHOOK
+(finish,
+ "",
+ void, (FILE *file, int verbose), NULL)
+
+ /* Initialize machine-dependent function wide scheduling code. */
+DEFHOOK
+(init_global,
+ "",
+ void, (FILE *file, int verbose, int old_max_uid), NULL)
+
+/* Finalize machine-dependent function wide scheduling code. */
+DEFHOOK
+(finish_global,
+ "",
+ void, (FILE *file, int verbose), NULL)
+
+/* Reorder insns in a machine-dependent fashion, in two different
+ places. Default does nothing. */
+DEFHOOK
+(reorder,
+ "",
+ int, (FILE *file, int verbose, rtx *ready, int *n_readyp, int clock), NULL)
+
+DEFHOOK
+(reorder2,
+ "",
+ int, (FILE *file, int verbose, rtx *ready, int *n_readyp, int clock), NULL)
+
+/* The following member value is a pointer to a function called
+ after evaluation forward dependencies of insns in chain given
+ by two parameter values (head and tail correspondingly). */
+DEFHOOK
+(dependencies_evaluation_hook,
+ "",
+ void, (rtx head, rtx tail), NULL)
+
+/* The values of the following four members are pointers to functions
+ used to simplify the automaton descriptions. dfa_pre_cycle_insn and
+ dfa_post_cycle_insn give functions returning insns which are used to
+ change the pipeline hazard recognizer state when the new simulated
+ processor cycle correspondingly starts and finishes. The function
+ defined by init_dfa_pre_cycle_insn and init_dfa_post_cycle_insn are
+ used to initialize the corresponding insns. The default values of
+ the members result in not changing the automaton state when the
+ new simulated processor cycle correspondingly starts and finishes. */
+
+DEFHOOK
+(init_dfa_pre_cycle_insn,
+ "",
+ void, (void), NULL)
+
+DEFHOOK
+(dfa_pre_cycle_insn,
+ "",
+ rtx, (void), NULL)
+
+DEFHOOK
+(init_dfa_post_cycle_insn,
+ "",
+ void, (void), NULL)
+
+DEFHOOK
+(dfa_post_cycle_insn,
+ "",
+ rtx, (void), NULL)
+
+/* The values of the following two members are pointers to
+ functions used to simplify the automaton descriptions.
+ dfa_pre_advance_cycle and dfa_post_advance_cycle are getting called
+ immediately before and after cycle is advanced. */
+
+DEFHOOK
+(dfa_pre_advance_cycle,
+ "",
+ void, (void), NULL)
+
+DEFHOOK
+(dfa_post_advance_cycle,
+ "",
+ void, (void), NULL)
+
+/* The following member value is a pointer to a function returning value
+ which defines how many insns in queue `ready' will we try for
+ multi-pass scheduling. If the member value is nonzero and the
+ function returns positive value, the DFA based scheduler will make
+ multi-pass scheduling for the first cycle. In other words, we will
+ try to choose ready insn which permits to start maximum number of
+ insns on the same cycle. */
+DEFHOOK
+(first_cycle_multipass_dfa_lookahead,
+ "",
+ int, (void), NULL)
+
+/* The following member value is pointer to a function controlling
+ what insns from the ready insn queue will be considered for the
+ multipass insn scheduling. If the hook returns zero for insn
+ passed as the parameter, the insn will be not chosen to be issued. */
+DEFHOOK
+(first_cycle_multipass_dfa_lookahead_guard,
+ "",
+ int, (rtx insn), NULL)
+
+/* The following member value is pointer to a function called by
+ the insn scheduler before issuing insn passed as the third
+ parameter on given cycle. If the hook returns nonzero, the
+ insn is not issued on given processors cycle. Instead of that,
+ the processor cycle is advanced. If the value passed through
+ the last parameter is zero, the insn ready queue is not sorted
+ on the new cycle start as usually. The first parameter passes
+ file for debugging output. The second one passes the scheduler
+ verbose level of the debugging output. The forth and the fifth
+ parameter values are correspondingly processor cycle on which
+ the previous insn has been issued and the current processor cycle. */
+DEFHOOK
+(dfa_new_cycle,
+ "",
+ int, (FILE *dump, int verbose, rtx insn, int last_clock,
+ int clock, int *sort_p),
+ NULL)
+
+/* The following member value is a pointer to a function called by the
+ insn scheduler. It should return true if there exists a dependence
+ which is considered costly by the target, between the insn
+ DEP_PRO (&_DEP), and the insn DEP_CON (&_DEP). The first parameter is
+ the dep that represents the dependence between the two insns. The
+ second argument is the cost of the dependence as estimated by
+ the scheduler. The last argument is the distance in cycles
+ between the already scheduled insn (first parameter) and the
+ second insn (second parameter). */
+DEFHOOK
+(is_costly_dependence,
+ "",
+ bool, (struct _dep *_dep, int cost, int distance), NULL)
+
+DEFHOOK_UNDOC
+(adjust_cost_2,
+ "Given the current cost, @var{cost}, of an insn, @var{insn}, calculate and\
+ return a new cost based on its relationship to @var{dep_insn} through the\
+ dependence of weakness @var{dw}. The default is to make no adjustment.",
+ int, (rtx insn, int dep_type1, rtx dep_insn, int cost, int dw), NULL)
+
+/* The following member value is a pointer to a function called
+ by the insn scheduler. This hook is called to notify the backend
+ that new instructions were emitted. */
+DEFHOOK
+(h_i_d_extended,
+ "",
+ void, (void), NULL)
+
+/* Next 5 functions are for multi-point scheduling. */
+
+/* Allocate memory for scheduler context. */
+DEFHOOK
+(alloc_sched_context,
+ "",
+ void *, (void), NULL)
+
+/* Fills the context from the local machine scheduler context. */
+DEFHOOK
+(init_sched_context,
+ "",
+ void, (void *tc, bool clean_p), NULL)
+
+/* Sets local machine scheduler context to a saved value. */
+DEFHOOK
+(set_sched_context,
+ "",
+ void, (void *tc), NULL)
+
+/* Clears a scheduler context so it becomes like after init. */
+DEFHOOK
+(clear_sched_context,
+ "",
+ void, (void *tc), NULL)
+
+/* Frees the scheduler context. */
+DEFHOOK
+(free_sched_context,
+ "",
+ void, (void *tc), NULL)
+
+/* The following member value is a pointer to a function called
+ by the insn scheduler.
+ The first parameter is an instruction, the second parameter is the type
+ of the requested speculation, and the third parameter is a pointer to the
+ speculative pattern of the corresponding type (set if return value == 1).
+ It should return
+ -1, if there is no pattern, that will satisfy the requested speculation type,
+ 0, if current pattern satisfies the requested speculation type,
+ 1, if pattern of the instruction should be changed to the newly
+ generated one. */
+DEFHOOK
+(speculate_insn,
+ "",
+ int, (rtx insn, int request, rtx *new_pat), NULL)
+
+/* The following member value is a pointer to a function called
+ by the insn scheduler. It should return true if the check instruction
+ passed as the parameter needs a recovery block. */
+DEFHOOK
+(needs_block_p,
+ "",
+ bool, (int dep_status), NULL)
+
+/* The following member value is a pointer to a function called
+ by the insn scheduler. It should return a pattern for the check
+ instruction.
+ The first parameter is a speculative instruction, the second parameter
+ is the label of the corresponding recovery block (or null, if it is a
+ simple check). If the mutation of the check is requested (e.g. from
+ ld.c to chk.a), the third parameter is true - in this case the first
+ parameter is the previous check. */
+DEFHOOK
+(gen_spec_check,
+ "",
+ rtx, (rtx insn, rtx label, int mutate_p), NULL)
+
+/* The following member value is a pointer to a function controlling
+ what insns from the ready insn queue will be considered for the
+ multipass insn scheduling. If the hook returns zero for the insn
+ passed as the parameter, the insn will not be chosen to be
+ issued. This hook is used to discard speculative instructions,
+ that stand at the first position of the ready list. */
+DEFHOOK
+(first_cycle_multipass_dfa_lookahead_guard_spec,
+ "",
+ bool, (const_rtx insn), NULL)
+
+/* The following member value is a pointer to a function that provides
+ information about the speculation capabilities of the target.
+ The parameter is a pointer to spec_info variable. */
+DEFHOOK
+(set_sched_flags,
+ "",
+ void, (struct spec_info_def *spec_info), NULL)
+
+DEFHOOK_UNDOC
+(get_insn_spec_ds,
+ "Return speculation types of instruction @var{insn}.",
+ int, (rtx insn), NULL)
+
+DEFHOOK_UNDOC
+(get_insn_checked_ds,
+ "Return speculation types that are checked for instruction @var{insn}",
+ int, (rtx insn), NULL)
+
+DEFHOOK_UNDOC
+(skip_rtx_p,
+ "Return bool if rtx scanning should just skip current layer and\
+ advance to the inner rtxes.",
+ bool, (const_rtx x), NULL)
+
+/* The following member value is a pointer to a function that provides
+ information about the target resource-based lower bound which is
+ used by the swing modulo scheduler. The parameter is a pointer
+ to ddg variable. */
+DEFHOOK
+(sms_res_mii,
+ "",
+ int, (struct ddg *g), NULL)
+
+HOOK_VECTOR_END (sched)
+
+/* Functions relating to vectorization. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_VECTORIZE_"
+HOOK_VECTOR (TARGET_VECTORIZE, vectorize)
+
+/* The following member value is a pointer to a function called
+ by the vectorizer, and return the decl of the target builtin
+ function. */
+DEFHOOK
+(builtin_mask_for_load,
+ "",
+ tree, (void), NULL)
+
+/* Returns a code for builtin that realizes vectorized version of
+ function, or NULL_TREE if not available. */
+DEFHOOK
+(builtin_vectorized_function,
+ "",
+ tree, (tree fndecl, tree vec_type_out, tree vec_type_in),
+ default_builtin_vectorized_function)
+
+/* Returns a function declaration for a builtin that realizes the
+ vector conversion, or NULL_TREE if not available. */
+DEFHOOK
+(builtin_conversion,
+ "",
+ tree, (unsigned code, tree dest_type, tree src_type),
+ default_builtin_vectorized_conversion)
+
+/* Target builtin that implements vector widening multiplication.
+ builtin_mul_widen_eve computes the element-by-element products
+ for the even elements, and builtin_mul_widen_odd computes the
+ element-by-element products for the odd elements. */
+DEFHOOK
+(builtin_mul_widen_even,
+ "",
+ tree, (tree x), NULL)
+
+DEFHOOK
+(builtin_mul_widen_odd,
+ "",
+ tree, (tree x), NULL)
+
+/* Cost of different vector/scalar statements in vectorization cost model. */
+DEFHOOK
+(builtin_vectorization_cost,
+ "",
+ int, (enum vect_cost_for_stmt type_of_cost),
+ default_builtin_vectorization_cost)
+
+/* Return true if vector alignment is reachable (by peeling N
+ iterations) for the given type. */
+DEFHOOK
+(vector_alignment_reachable,
+ "",
+ bool, (const_tree type, bool is_packed),
+ default_builtin_vector_alignment_reachable)
+
+/* Target builtin that implements vector permute. */
+DEFHOOK
+(builtin_vec_perm,
+ "",
+ tree, (tree type, tree *mask_element_type), NULL)
+
+/* Return true if a vector created for builtin_vec_perm is valid. */
+DEFHOOK
+(builtin_vec_perm_ok,
+ "",
+ bool, (tree vec_type, tree mask),
+ hook_bool_tree_tree_true)
+
+/* Return true if the target supports misaligned store/load of a
+ specific factor denoted in the third parameter. The last parameter
+ is true if the access is defined in a packed struct. */
+DEFHOOK
+(support_vector_misalignment,
+ "",
+ bool,
+ (enum machine_mode mode, const_tree type, int misalignment, bool is_packed),
+ default_builtin_support_vector_misalignment)
+
+HOOK_VECTOR_END (vectorize)
+
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_"
+
+/* The initial value of target_flags. */
+DEFHOOKPOD
+(default_target_flags,
+ "",
+ int, 0)
+
+/* Allow target specific overriding of option settings after options have
+ been changed by an attribute or pragma or when it is reset at the
+ end of the code affected by an attribute or pragma. */
+DEFHOOK
+(override_options_after_change,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Handle target switch CODE (an OPT_* value). ARG is the argument
+ passed to the switch; it is NULL if no argument was. VALUE is the
+ value of ARG if CODE specifies a UInteger option, otherwise it is
+ 1 if the positive form of the switch was used and 0 if the negative
+ form was. Return true if the switch was valid. */
+DEFHOOK
+(handle_option,
+ "",
+ bool, (size_t code, const char *arg, int value),
+ hook_bool_size_t_constcharptr_int_true)
+
+/* ??? Documenting this hook requires a GFDL license grant. */
+DEFHOOK_UNDOC
+(handle_ofast,
+ "Handle target-specific parts of specifying -Ofast.",
+ void, (void),
+ hook_void_void)
+
+/* Display extra, target specific information in response to a
+ --target-help switch. */
+DEFHOOK
+(help,
+ "",
+ void, (void), NULL)
+
+DEFHOOK_UNDOC
+(eh_return_filter_mode,
+ "Return machine mode for filter value.",
+ enum machine_mode, (void),
+ default_eh_return_filter_mode)
+
+/* Return machine mode for libgcc expanded cmp instructions. */
+DEFHOOK
+(libgcc_cmp_return_mode,
+ "",
+ enum machine_mode, (void),
+ default_libgcc_cmp_return_mode)
+
+/* Return machine mode for libgcc expanded shift instructions. */
+DEFHOOK
+(libgcc_shift_count_mode,
+ "",
+ enum machine_mode, (void),
+ default_libgcc_shift_count_mode)
+
+/* Return machine mode to be used for _Unwind_Word type. */
+DEFHOOK
+(unwind_word_mode,
+ "",
+ enum machine_mode, (void),
+ default_unwind_word_mode)
+
+/* Given two decls, merge their attributes and return the result. */
+DEFHOOK
+(merge_decl_attributes,
+ "",
+ tree, (tree olddecl, tree newdecl),
+ merge_decl_attributes)
+
+/* Given two types, merge their attributes and return the result. */
+DEFHOOK
+(merge_type_attributes,
+ "",
+ tree, (tree type1, tree type2),
+ merge_type_attributes)
+
+/* Table of machine attributes and functions to handle them.
+ Ignored if NULL. */
+DEFHOOKPOD
+(attribute_table,
+ "",
+ const struct attribute_spec *, NULL)
+
+/* Return true iff attribute NAME expects a plain identifier as its first
+ argument. */
+DEFHOOK
+(attribute_takes_identifier_p,
+ "",
+ bool, (const_tree name),
+ hook_bool_const_tree_false)
+
+/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
+ one if they are compatible and two if they are nearly compatible
+ (which causes a warning to be generated). */
+DEFHOOK
+(comp_type_attributes,
+ "",
+ int, (const_tree type1, const_tree type2),
+ hook_int_const_tree_const_tree_1)
+
+/* Assign default attributes to the newly defined TYPE. */
+DEFHOOK
+(set_default_type_attributes,
+ "",
+ void, (tree type),
+ hook_void_tree)
+
+/* Insert attributes on the newly created DECL. */
+DEFHOOK
+(insert_attributes,
+ "",
+ void, (tree node, tree *attr_ptr),
+ hook_void_tree_treeptr)
+
+/* Return true if FNDECL (which has at least one machine attribute)
+ can be inlined despite its machine attributes, false otherwise. */
+DEFHOOK
+(function_attribute_inlinable_p,
+ "",
+ bool, (const_tree fndecl),
+ hook_bool_const_tree_false)
+
+/* Return true if bitfields in RECORD_TYPE should follow the
+ Microsoft Visual C++ bitfield layout rules. */
+DEFHOOK
+(ms_bitfield_layout_p,
+ "",
+ bool, (const_tree record_type),
+ hook_bool_const_tree_false)
+
+/* True if the target supports decimal floating point. */
+DEFHOOK
+(decimal_float_supported_p,
+ "",
+ bool, (void),
+ default_decimal_float_supported_p)
+
+/* True if the target supports fixed-point. */
+DEFHOOK
+(fixed_point_supported_p,
+ "",
+ bool, (void),
+ default_fixed_point_supported_p)
+
+/* Return true if anonymous bitfields affect structure alignment. */
+DEFHOOK
+(align_anon_bitfield,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Return true if volatile bitfields should use the narrowest type possible.
+ Return false if they should use the container type. */
+DEFHOOK
+(narrow_volatile_bitfield,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Set up target-specific built-in functions. */
+DEFHOOK
+(init_builtins,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Initialize (if INITIALIZE_P is true) and return the target-specific
+ built-in function decl for CODE.
+ Return NULL if that is not possible. Return error_mark_node if CODE
+ is outside of the range of valid target builtin function codes. */
+DEFHOOK
+(builtin_decl,
+ "",
+ tree, (unsigned code, bool initialize_p), NULL)
+
+/* Expand a target-specific builtin. */
+DEFHOOK
+(expand_builtin,
+ "",
+ rtx,
+ (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore),
+ default_expand_builtin)
+
+/* Select a replacement for a target-specific builtin. This is done
+ *before* regular type checking, and so allows the target to
+ implement a crude form of function overloading. The result is a
+ complete expression that implements the operation. PARAMS really
+ has type VEC(tree,gc)*, but we don't want to include tree.h here. */
+DEFHOOK
+(resolve_overloaded_builtin,
+ "",
+ tree, (unsigned int /*location_t*/ loc, tree fndecl, void *arglist), NULL)
+
+/* Fold a target-specific builtin. */
+DEFHOOK
+(fold_builtin,
+ "",
+ tree, (tree fndecl, int n_args, tree *argp, bool ignore),
+ hook_tree_tree_int_treep_bool_null)
+
+/* Returns a code for a target-specific builtin that implements
+ reciprocal of the function, or NULL_TREE if not available. */
+DEFHOOK
+(builtin_reciprocal,
+ "",
+ tree, (unsigned fn, bool md_fn, bool sqrt),
+ default_builtin_reciprocal)
+
+/* For a vendor-specific TYPE, return a pointer to a statically-allocated
+ string containing the C++ mangling for TYPE. In all other cases, return
+ NULL. */
+DEFHOOK
+(mangle_type,
+ "",
+ const char *, (const_tree type),
+ hook_constcharptr_const_tree_null)
+
+/* Make any adjustments to libfunc names needed for this target. */
+DEFHOOK
+(init_libfuncs,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Given a decl, a section name, and whether the decl initializer
+ has relocs, choose attributes for the section. */
+/* ??? Should be merged with SELECT_SECTION and UNIQUE_SECTION. */
+DEFHOOK
+(section_type_flags,
+ "",
+ unsigned int, (tree decl, const char *name, int reloc),
+ default_section_type_flags)
+
+/* True if new jumps cannot be created, to replace existing ones or
+ not, at the current point in the compilation. */
+DEFHOOK
+(cannot_modify_jumps_p,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Return a register class for which branch target register
+ optimizations should be applied. */
+DEFHOOK
+(branch_target_register_class,
+ "",
+ reg_class_t, (void),
+ default_branch_target_register_class)
+
+/* Return true if branch target register optimizations should include
+ callee-saved registers that are not already live during the current
+ function. AFTER_PE_GEN is true if prologues and epilogues have
+ already been generated. */
+DEFHOOK
+(branch_target_register_callee_saved,
+ "",
+ bool, (bool after_prologue_epilogue_gen),
+ hook_bool_bool_false)
+
+/* Return true if the target supports conditional execution. */
+DEFHOOK
+(have_conditional_execution,
+ "",
+ bool, (void),
+ default_have_conditional_execution)
+
+/* Return a new value for loop unroll size. */
+DEFHOOK
+(loop_unroll_adjust,
+ "",
+ unsigned, (unsigned nunroll, struct loop *loop),
+ NULL)
+
+/* True if the constant X cannot be placed in the constant pool. */
+DEFHOOK
+(cannot_force_const_mem,
+ "",
+ bool, (rtx x),
+ hook_bool_rtx_false)
+
+DEFHOOK_UNDOC
+(cannot_copy_insn_p,
+ "True if the insn @var{x} cannot be duplicated.",
+ bool, (rtx), NULL)
+
+/* True if X is considered to be commutative. */
+DEFHOOK
+(commutative_p,
+ "",
+ bool, (const_rtx x, int outer_code),
+ hook_bool_const_rtx_commutative_p)
+
+/* True if ADDR is an address-expression whose effect depends
+ on the mode of the memory reference it is used in. */
+DEFHOOK
+(mode_dependent_address_p,
+ "",
+ bool, (const_rtx addr),
+ default_mode_dependent_address_p)
+
+/* Given an invalid address X for a given machine mode, try machine-specific
+ ways to make it legitimate. Return X or an invalid address on failure. */
+DEFHOOK
+(legitimize_address,
+ "",
+ rtx, (rtx x, rtx oldx, enum machine_mode mode),
+ default_legitimize_address)
+
+/* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */
+DEFHOOK
+(delegitimize_address,
+ "",
+ rtx, (rtx x),
+ delegitimize_mem_from_attrs)
+
+/* Given an address RTX, say whether it is valid. */
+DEFHOOK
+(legitimate_address_p,
+ "",
+ bool, (enum machine_mode mode, rtx x, bool strict),
+ default_legitimate_address_p)
+
+/* True if the given constant can be put into an object_block. */
+DEFHOOK
+(use_blocks_for_constant_p,
+ "",
+ bool, (enum machine_mode mode, const_rtx x),
+ hook_bool_mode_const_rtx_false)
+
+/* The minimum and maximum byte offsets for anchored addresses. */
+DEFHOOKPOD
+(min_anchor_offset,
+ "",
+ HOST_WIDE_INT, 0)
+
+DEFHOOKPOD
+(max_anchor_offset,
+ "",
+ HOST_WIDE_INT, 0)
+
+/* True if section anchors can be used to access the given symbol. */
+DEFHOOK
+(use_anchors_for_symbol_p,
+ "",
+ bool, (const_rtx x),
+ default_use_anchors_for_symbol_p)
+
+/* True if it is OK to do sibling call optimization for the specified
+ call expression EXP. DECL will be the called function, or NULL if
+ this is an indirect call. */
+DEFHOOK
+(function_ok_for_sibcall,
+ "",
+ bool, (tree decl, tree exp),
+ hook_bool_tree_tree_false)
+
+/* Establish appropriate back-end context for processing the function
+ FNDECL. The argument might be NULL to indicate processing at top
+ level, outside of any function scope. */
+DEFHOOK
+(set_current_function,
+ "",
+ void, (tree decl), hook_void_tree)
+
+/* True if EXP should be placed in a "small data" section. */
+DEFHOOK
+(in_small_data_p,
+ "",
+ bool, (const_tree exp),
+ hook_bool_const_tree_false)
+
+/* True if EXP names an object for which name resolution must resolve
+ to the current executable or shared library. */
+DEFHOOK
+(binds_local_p,
+ "",
+ bool, (const_tree exp),
+ default_binds_local_p)
+
+/* Modify and return the identifier of a DECL's external name,
+ originally identified by ID, as required by the target,
+ (eg, append @nn to windows32 stdcall function names).
+ The default is to return ID without modification. */
+DEFHOOK
+(mangle_decl_assembler_name,
+ "",
+ tree, (tree decl, tree id),
+ default_mangle_decl_assembler_name)
+
+/* Do something target-specific to record properties of the DECL into
+ the associated SYMBOL_REF. */
+DEFHOOK
+(encode_section_info,
+ "",
+ void, (tree decl, rtx rtl, int new_decl_p),
+ default_encode_section_info)
+
+/* Undo the effects of encode_section_info on the symbol string. */
+DEFHOOK
+(strip_name_encoding,
+ "",
+ const char *, (const char *name),
+ default_strip_name_encoding)
+
+/* If shift optabs for MODE are known to always truncate the shift count,
+ return the mask that they apply. Return 0 otherwise. */
+DEFHOOK
+(shift_truncation_mask,
+ "",
+ unsigned HOST_WIDE_INT, (enum machine_mode mode),
+ default_shift_truncation_mask)
+
+/* Return the number of divisions in the given MODE that should be present,
+ so that it is profitable to turn the division into a multiplication by
+ the reciprocal. */
+DEFHOOK
+(min_divisions_for_recip_mul,
+ "",
+ unsigned int, (enum machine_mode mode),
+ default_min_divisions_for_recip_mul)
+
+/* If the representation of integral MODE is such that values are
+ always sign-extended to a wider mode MODE_REP then return
+ SIGN_EXTEND. Return UNKNOWN otherwise. */
+/* Note that the return type ought to be RTX_CODE, but that's not
+ necessarily defined at this point. */
+DEFHOOK
+(mode_rep_extended,
+ "",
+ int, (enum machine_mode mode, enum machine_mode rep_mode),
+ default_mode_rep_extended)
+
+/* True if MODE is valid for a pointer in __attribute__((mode("MODE"))). */
+DEFHOOK
+(valid_pointer_mode,
+ "",
+ bool, (enum machine_mode mode),
+ default_valid_pointer_mode)
+
+/* Support for named address spaces. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_ADDR_SPACE_"
+HOOK_VECTOR (TARGET_ADDR_SPACE_HOOKS, addr_space)
+
+/* MODE to use for a pointer into another address space. */
+DEFHOOK
+(pointer_mode,
+ "",
+ enum machine_mode, (addr_space_t address_space),
+ default_addr_space_pointer_mode)
+
+/* MODE to use for an address in another address space. */
+DEFHOOK
+(address_mode,
+ "",
+ enum machine_mode, (addr_space_t address_space),
+ default_addr_space_address_mode)
+
+/* True if MODE is valid for a pointer in __attribute__((mode("MODE")))
+ in another address space. */
+DEFHOOK
+(valid_pointer_mode,
+ "",
+ bool, (enum machine_mode mode, addr_space_t as),
+ default_addr_space_valid_pointer_mode)
+
+/* True if an address is a valid memory address to a given named address
+ space for a given mode. */
+DEFHOOK
+(legitimate_address_p,
+ "",
+ bool, (enum machine_mode mode, rtx exp, bool strict, addr_space_t as),
+ default_addr_space_legitimate_address_p)
+
+/* Return an updated address to convert an invalid pointer to a named
+ address space to a valid one. If NULL_RTX is returned use machine
+ independent methods to make the address valid. */
+DEFHOOK
+(legitimize_address,
+ "",
+ rtx, (rtx x, rtx oldx, enum machine_mode mode, addr_space_t as),
+ default_addr_space_legitimize_address)
+
+/* True if one named address space is a subset of another named address. */
+DEFHOOK
+(subset_p,
+ "",
+ bool, (addr_space_t superset, addr_space_t subset),
+ default_addr_space_subset_p)
+
+/* Function to convert an rtl expression from one address space to another. */
+DEFHOOK
+(convert,
+ "",
+ rtx, (rtx op, tree from_type, tree to_type),
+ default_addr_space_convert)
+
+HOOK_VECTOR_END (addr_space)
+
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_"
+
+/* True if MODE is valid for the target. By "valid", we mean able to
+ be manipulated in non-trivial ways. In particular, this means all
+ the arithmetic is supported. */
+DEFHOOK
+(scalar_mode_supported_p,
+ "",
+ bool, (enum machine_mode mode),
+ default_scalar_mode_supported_p)
+
+/* Similarly for vector modes. "Supported" here is less strict. At
+ least some operations are supported; need to check optabs or builtins
+ for further details. */
+DEFHOOK
+(vector_mode_supported_p,
+ "",
+ bool, (enum machine_mode mode),
+ hook_bool_mode_false)
+
+/* Compute cost of moving data from a register of class FROM to one of
+ TO, using MODE. */
+DEFHOOK
+(register_move_cost,
+ "",
+ int, (enum machine_mode mode, reg_class_t from, reg_class_t to),
+ default_register_move_cost)
+
+/* Compute cost of moving registers to/from memory. */
+/* ??? Documenting the argument types for this hook requires a GFDL
+ license grant. Also, the documentation uses a different name for RCLASS. */
+DEFHOOK
+(memory_move_cost,
+ "",
+ int, (enum machine_mode mode, reg_class_t rclass, bool in),
+ default_memory_move_cost)
+
+/* True for MODE if the target expects that registers in this mode will
+ be allocated to registers in a small register class. The compiler is
+ allowed to use registers explicitly used in the rtl as spill registers
+ but it should prevent extending the lifetime of these registers. */
+DEFHOOK
+(small_register_classes_for_mode_p,
+ "",
+ bool, (enum machine_mode mode),
+ hook_bool_mode_false)
+
+/* Compute a (partial) cost for rtx X. Return true if the complete
+ cost has been computed, and false if subexpressions should be
+ scanned. In either case, *TOTAL contains the cost result. */
+/* Note that CODE and OUTER_CODE ought to be RTX_CODE, but that's
+ not necessarily defined at this point. */
+DEFHOOK
+(rtx_costs,
+ "",
+ bool, (rtx x, int code, int outer_code, int *total, bool speed),
+ hook_bool_rtx_int_int_intp_bool_false)
+
+/* Compute the cost of X, used as an address. Never called with
+ invalid addresses. */
+DEFHOOK
+(address_cost,
+ "",
+ int, (rtx address, bool speed),
+ default_address_cost)
+
+/* Return where to allocate pseudo for a given hard register initial value. */
+DEFHOOK
+(allocate_initial_value,
+ "",
+ rtx, (rtx hard_reg), NULL)
+
+/* Return nonzero if evaluating UNSPEC[_VOLATILE] X might cause a trap.
+ FLAGS has the same meaning as in rtlanal.c: may_trap_p_1. */
+DEFHOOK
+(unspec_may_trap_p,
+ "",
+ int, (const_rtx x, unsigned flags),
+ default_unspec_may_trap_p)
+
+/* Given a register, this hook should return a parallel of registers
+ to represent where to find the register pieces. Define this hook
+ if the register and its mode are represented in Dwarf in
+ non-contiguous locations, or if the register should be
+ represented in more than one register in Dwarf. Otherwise, this
+ hook should return NULL_RTX. */
+DEFHOOK
+(dwarf_register_span,
+ "",
+ rtx, (rtx reg),
+ hook_rtx_rtx_null)
+
+/* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
+ entries not corresponding directly to registers below
+ FIRST_PSEUDO_REGISTER, this hook should generate the necessary
+ code, given the address of the table. */
+DEFHOOK
+(init_dwarf_reg_sizes_extra,
+ "",
+ void, (tree address),
+ hook_void_tree)
+
+/* Fetch the fixed register(s) which hold condition codes, for
+ targets where it makes sense to look for duplicate assignments to
+ the condition codes. This should return true if there is such a
+ register, false otherwise. The arguments should be set to the
+ fixed register numbers. Up to two condition code registers are
+ supported. If there is only one for this target, the int pointed
+ at by the second argument should be set to -1. */
+DEFHOOK
+(fixed_condition_code_regs,
+ "",
+ bool, (unsigned int *p1, unsigned int *p2),
+ hook_bool_uintp_uintp_false)
+
+/* If two condition code modes are compatible, return a condition
+ code mode which is compatible with both, such that a comparison
+ done in the returned mode will work for both of the original
+ modes. If the condition code modes are not compatible, return
+ VOIDmode. */
+DEFHOOK
+(cc_modes_compatible,
+ "",
+ enum machine_mode, (enum machine_mode m1, enum machine_mode m2),
+ default_cc_modes_compatible)
+
+/* Do machine-dependent code transformations. Called just before
+ delayed-branch scheduling. */
+DEFHOOK
+(machine_dependent_reorg,
+ "",
+ void, (void), NULL)
+
+/* Create the __builtin_va_list type. */
+DEFHOOK
+(build_builtin_va_list,
+ "",
+ tree, (void),
+ std_build_builtin_va_list)
+
+/* Enumerate the va list variants. */
+DEFHOOK
+(enum_va_list_p,
+ "",
+ int, (int idx, const char **pname, tree *ptree),
+ NULL)
+
+/* Get the cfun/fndecl calling abi __builtin_va_list type. */
+DEFHOOK
+(fn_abi_va_list,
+ "",
+ tree, (tree fndecl),
+ std_fn_abi_va_list)
+
+/* Get the __builtin_va_list type dependent on input type. */
+DEFHOOK
+(canonical_va_list_type,
+ "",
+ tree, (tree type),
+ std_canonical_va_list_type)
+
+/* ??? Documenting this hook requires a GFDL license grant. */
+DEFHOOK_UNDOC
+(expand_builtin_va_start,
+"Expand the @code{__builtin_va_start} builtin.",
+ void, (tree valist, rtx nextarg), NULL)
+
+/* Gimplifies a VA_ARG_EXPR. */
+DEFHOOK
+(gimplify_va_arg_expr,
+ "",
+ tree, (tree valist, tree type, gimple_seq *pre_p, gimple_seq *post_p),
+ std_gimplify_va_arg_expr)
+
+/* Validity-checking routines for PCH files, target-specific.
+ get_pch_validity returns a pointer to the data to be stored,
+ and stores the size in its argument. pch_valid_p gets the same
+ information back and returns NULL if the PCH is valid,
+ or an error message if not. */
+DEFHOOK
+(get_pch_validity,
+ "",
+ void *, (size_t *sz),
+ default_get_pch_validity)
+
+DEFHOOK
+(pch_valid_p,
+ "",
+ const char *, (const void *data, size_t sz),
+ default_pch_valid_p)
+
+/* If nonnull, this function checks whether a PCH file with the
+ given set of target flags can be used. It returns NULL if so,
+ otherwise it returns an error message. */
+DEFHOOK
+(check_pch_target_flags,
+ "",
+ const char *, (int pch_flags), NULL)
+
+/* True if the compiler should give an enum type only as many
+ bytes as it takes to represent the range of possible values of
+ that type. */
+DEFHOOK
+(default_short_enums,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* This target hook returns an rtx that is used to store the address
+ of the current frame into the built-in setjmp buffer. */
+DEFHOOK
+(builtin_setjmp_frame_value,
+ "",
+ rtx, (void),
+ default_builtin_setjmp_frame_value)
+
+/* This target hook should add STRING_CST trees for any hard regs
+ the port wishes to automatically clobber for an asm. */
+DEFHOOK
+(md_asm_clobbers,
+ "",
+ tree, (tree outputs, tree inputs, tree clobbers),
+ hook_tree_tree_tree_tree_3rd_identity)
+
+/* This target hook allows the backend to specify a calling convention
+ in the debug information. This function actually returns an
+ enum dwarf_calling_convention, but because of forward declarations
+ and not wanting to include dwarf2.h everywhere target.h is included
+ the function is being declared as an int. */
+DEFHOOK
+(dwarf_calling_convention,
+ "",
+ int, (const_tree function),
+ hook_int_const_tree_0)
+
+/* This target hook allows the backend to emit frame-related insns that
+ contain UNSPECs or UNSPEC_VOLATILEs. The call frame debugging info
+ engine will invoke it on insns of the form
+ (set (reg) (unspec [...] UNSPEC_INDEX))
+ and
+ (set (reg) (unspec_volatile [...] UNSPECV_INDEX))
+ to let the backend emit the call frame instructions. */
+DEFHOOK
+(dwarf_handle_frame_unspec,
+ "",
+ void, (const char *label, rtx pattern, int index), NULL)
+
+/* ??? Documenting this hook requires a GFDL license grant. */
+DEFHOOK_UNDOC
+(stdarg_optimize_hook,
+"Perform architecture specific checking of statements gimplified\
+ from @code{VA_ARG_EXPR}. @var{stmt} is the statement. Returns true if\
+ the statement doesn't need to be checked for @code{va_list} references.",
+ bool, (struct stdarg_info *ai, const_gimple stmt), NULL)
+
+/* This target hook allows the operating system to override the DECL
+ that represents the external variable that contains the stack
+ protection guard variable. The type of this DECL is ptr_type_node. */
+DEFHOOK
+(stack_protect_guard,
+ "",
+ tree, (void),
+ default_stack_protect_guard)
+
+/* This target hook allows the operating system to override the CALL_EXPR
+ that is invoked when a check vs the guard variable fails. */
+DEFHOOK
+(stack_protect_fail,
+ "",
+ tree, (void),
+ default_external_stack_protect_fail)
+
+/* Returns NULL if target supports the insn within a doloop block,
+ otherwise it returns an error message. */
+DEFHOOK
+(invalid_within_doloop,
+ "",
+ const char *, (const_rtx insn),
+ default_invalid_within_doloop)
+
+DEFHOOK
+(valid_dllimport_attribute_p,
+"@var{decl} is a variable or function with @code{__attribute__((dllimport))}\
+ specified. Use this hook if the target needs to add extra validation\
+ checks to @code{handle_dll_attribute}.",
+ bool, (const_tree decl),
+ hook_bool_const_tree_true)
+
+/* If non-zero, align constant anchors in CSE to a multiple of this
+ value. */
+DEFHOOKPOD
+(const_anchor,
+ "",
+ unsigned HOST_WIDE_INT, 0)
+
+/* Functions relating to calls - argument passing, returns, etc. */
+/* Members of struct call have no special macro prefix. */
+HOOK_VECTOR (TARGET_CALLS, calls)
+
+DEFHOOK
+(promote_function_mode,
+ "",
+ enum machine_mode, (const_tree type, enum machine_mode mode, int *punsignedp,
+ const_tree funtype, int for_return),
+ default_promote_function_mode)
+
+DEFHOOK
+(promote_prototypes,
+ "",
+ bool, (const_tree fntype),
+ hook_bool_const_tree_false)
+
+DEFHOOK
+(struct_value_rtx,
+ "",
+ rtx, (tree fndecl, int incoming),
+ hook_rtx_tree_int_null)
+DEFHOOK
+(return_in_memory,
+ "",
+ bool, (const_tree type, const_tree fntype),
+ default_return_in_memory)
+
+DEFHOOK
+(return_in_msb,
+ "",
+ bool, (const_tree type),
+ hook_bool_const_tree_false)
+
+/* Return true if a parameter must be passed by reference. TYPE may
+ be null if this is a libcall. CA may be null if this query is
+ from __builtin_va_arg. */
+DEFHOOK
+(pass_by_reference,
+ "",
+ bool,
+ (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type, bool named),
+ hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
+
+DEFHOOK
+(expand_builtin_saveregs,
+ "",
+ rtx, (void),
+ default_expand_builtin_saveregs)
+
+/* Returns pretend_argument_size. */
+DEFHOOK
+(setup_incoming_varargs,
+ "",
+ void, (CUMULATIVE_ARGS *args_so_far, enum machine_mode mode, tree type,
+ int *pretend_args_size, int second_time),
+ default_setup_incoming_varargs)
+
+DEFHOOK
+(strict_argument_naming,
+ "",
+ bool, (CUMULATIVE_ARGS *ca),
+ hook_bool_CUMULATIVE_ARGS_false)
+
+/* Returns true if we should use
+ targetm.calls.setup_incoming_varargs() and/or
+ targetm.calls.strict_argument_naming(). */
+DEFHOOK
+(pretend_outgoing_varargs_named,
+ "",
+ bool, (CUMULATIVE_ARGS *ca),
+ default_pretend_outgoing_varargs_named)
+
+/* Given a complex type T, return true if a parameter of type T
+ should be passed as two scalars. */
+DEFHOOK
+(split_complex_arg,
+ "",
+ bool, (const_tree type), NULL)
+
+/* Return true if type T, mode MODE, may not be passed in registers,
+ but must be passed on the stack. */
+/* ??? This predicate should be applied strictly after pass-by-reference.
+ Need audit to verify that this is the case. */
+DEFHOOK
+(must_pass_in_stack,
+ "",
+ bool, (enum machine_mode mode, const_tree type),
+ must_pass_in_stack_var_size_or_pad)
+
+/* Return true if type TYPE, mode MODE, which is passed by reference,
+ should have the object copy generated by the callee rather than
+ the caller. It is never called for TYPE requiring constructors. */
+DEFHOOK
+(callee_copies,
+ "",
+ bool,
+ (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type, bool named),
+ hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
+
+/* Return zero for arguments passed entirely on the stack or entirely
+ in registers. If passed in both, return the number of bytes passed
+ in registers; the balance is therefore passed on the stack. */
+DEFHOOK
+(arg_partial_bytes,
+ "",
+ int, (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, bool named),
+ hook_int_CUMULATIVE_ARGS_mode_tree_bool_0)
+
+/* Update the state in CA to advance past an argument in the
+ argument list. The values MODE, TYPE, and NAMED describe that
+ argument. */
+/* ??? tm.texi still only describes the old macro. */
+DEFHOOK_UNDOC
+(function_arg_advance,
+ "",
+ void,
+ (CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type, bool named),
+ default_function_arg_advance)
+
+/* Return zero if the argument described by the state of CA should
+ be placed on a stack, or a hard register in which to store the
+ argument. The values MODE, TYPE, and NAMED describe that
+ argument. */
+/* ??? tm.texi still only describes the old macro. */
+DEFHOOK_UNDOC
+(function_arg,
+ "",
+ rtx, (const CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type,
+ bool named),
+ default_function_arg)
+
+/* Likewise, but for machines with register windows. Return the
+ location where the argument will appear to the callee. */
+/* ??? tm.texi still only describes the old macro. */
+DEFHOOK_UNDOC
+(function_incoming_arg,
+ "",
+ rtx, (const CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type,
+ bool named),
+ default_function_incoming_arg)
+
+/* Return the diagnostic message string if function without a prototype
+ is not allowed for this 'val' argument; NULL otherwise. */
+DEFHOOK
+(invalid_arg_for_unprototyped_fn,
+ "",
+ const char *, (const_tree typelist, const_tree funcdecl, const_tree val),
+ hook_invalid_arg_for_unprototyped_fn)
+
+/* Return an rtx for the return value location of the function
+ specified by FN_DECL_OR_TYPE with a return type of RET_TYPE. */
+DEFHOOK
+(function_value,
+ "",
+ rtx, (const_tree ret_type, const_tree fn_decl_or_type, bool outgoing),
+ default_function_value)
+
+/* Return the rtx for the result of a libcall of mode MODE,
+ calling the function FN_NAME. */
+DEFHOOK
+(libcall_value,
+ "",
+ rtx, (enum machine_mode mode, const_rtx fun),
+ default_libcall_value)
+
+/* Return true if REGNO is a possible register number for
+ a function value as seen by the caller. */
+DEFHOOK
+(function_value_regno_p,
+ "",
+ bool, (const unsigned int regno),
+ default_function_value_regno_p)
+
+/* ??? Documenting this hook requires a GFDL license grant. */
+DEFHOOK_UNDOC
+(internal_arg_pointer,
+"Return an rtx for the argument pointer incoming to the\
+ current function.",
+ rtx, (void),
+ default_internal_arg_pointer)
+
+/* Update the current function stack boundary if needed. */
+DEFHOOK
+(update_stack_boundary,
+ "",
+ void, (void), NULL)
+
+/* Handle stack alignment and return an rtx for Dynamic Realign
+ Argument Pointer if necessary. */
+DEFHOOK
+(get_drap_rtx,
+ "",
+ rtx, (void), NULL)
+
+/* Return true if all function parameters should be spilled to the
+ stack. */
+DEFHOOK
+(allocate_stack_slots_for_args,
+ "",
+ bool, (void),
+ hook_bool_void_true)
+
+/* Return an rtx for the static chain for FNDECL. If INCOMING_P is true,
+ then it should be for the callee; otherwise for the caller. */
+DEFHOOK
+(static_chain,
+ "",
+ rtx, (const_tree fndecl, bool incoming_p),
+ default_static_chain)
+
+/* Fill in the trampoline at MEM with a call to FNDECL and a
+ static chain value of CHAIN. */
+DEFHOOK
+(trampoline_init,
+ "",
+ void, (rtx m_tramp, tree fndecl, rtx static_chain),
+ default_trampoline_init)
+
+/* Adjust the address of the trampoline in a target-specific way. */
+DEFHOOK
+(trampoline_adjust_address,
+ "",
+ rtx, (rtx addr), NULL)
+
+/* Return the number of bytes of its own arguments that a function
+ pops on returning, or 0 if the function pops no arguments and the
+ caller must therefore pop them all after the function returns. */
+/* ??? tm.texi has no types for the parameters. */
+DEFHOOK
+(return_pops_args,
+ "",
+ int, (tree fundecl, tree funtype, int size),
+ default_return_pops_args)
+
+HOOK_VECTOR_END (calls)
+
+/* Return the diagnostic message string if conversion from FROMTYPE
+ to TOTYPE is not allowed, NULL otherwise. */
+DEFHOOK
+(invalid_conversion,
+ "",
+ const char *, (const_tree fromtype, const_tree totype),
+ hook_constcharptr_const_tree_const_tree_null)
+
+/* Return the diagnostic message string if the unary operation OP is
+ not permitted on TYPE, NULL otherwise. */
+DEFHOOK
+(invalid_unary_op,
+ "",
+ const char *, (int op, const_tree type),
+ hook_constcharptr_int_const_tree_null)
+
+/* Return the diagnostic message string if the binary operation OP
+ is not permitted on TYPE1 and TYPE2, NULL otherwise. */
+DEFHOOK
+(invalid_binary_op,
+ "",
+ const char *, (int op, const_tree type1, const_tree type2),
+ hook_constcharptr_int_const_tree_const_tree_null)
+
+/* Return the diagnostic message string if TYPE is not valid as a
+ function parameter type, NULL otherwise. */
+DEFHOOK
+(invalid_parameter_type,
+ "",
+ const char *, (const_tree type),
+ hook_constcharptr_const_tree_null)
+
+/* Return the diagnostic message string if TYPE is not valid as a
+ function return type, NULL otherwise. */
+DEFHOOK
+(invalid_return_type,
+ "",
+ const char *, (const_tree type),
+ hook_constcharptr_const_tree_null)
+
+/* If values of TYPE are promoted to some other type when used in
+ expressions (analogous to the integer promotions), return that type,
+ or NULL_TREE otherwise. */
+DEFHOOK
+(promoted_type,
+ "",
+ tree, (const_tree type),
+ hook_tree_const_tree_null)
+
+/* Convert EXPR to TYPE, if target-specific types with special conversion
+ rules are involved. Return the converted expression, or NULL to apply
+ the standard conversion rules. */
+DEFHOOK
+(convert_to_type,
+ "",
+ tree, (tree type, tree expr),
+ hook_tree_tree_tree_null)
+
+/* Return the array of IRA cover classes for the current target. */
+DEFHOOK
+(ira_cover_classes,
+ "",
+ const reg_class_t *, (void),
+ default_ira_cover_classes)
+
+/* Return the class for a secondary reload, and fill in extra information. */
+DEFHOOK
+(secondary_reload,
+ "",
+ reg_class_t,
+ (bool in_p, rtx x, reg_class_t reload_class, enum machine_mode reload_mode,
+ secondary_reload_info *sri),
+ default_secondary_reload)
+
+/* This target hook allows the backend to perform additional
+ processing while initializing for variable expansion. */
+DEFHOOK
+(expand_to_rtl_hook,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* This target hook allows the backend to perform additional
+ instantiations on rtx that are not actually in insns yet,
+ but will be later. */
+DEFHOOK
+(instantiate_decls,
+ "",
+ void, (void),
+ hook_void_void)
+
+/* Return true if is OK to use a hard register REGNO as scratch register
+ in peephole2. */
+DEFHOOK
+(hard_regno_scratch_ok,
+ "",
+ bool, (unsigned int regno),
+ default_hard_regno_scratch_ok)
+
+/* Return the smallest number of different values for which it is best to
+ use a jump-table instead of a tree of conditional branches. */
+DEFHOOK
+(case_values_threshold,
+ "",
+ unsigned int, (void),
+ default_case_values_threshold)
+
+/* Retutn true if a function must have and use a frame pointer. */
+DEFHOOK
+(frame_pointer_required,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Returns true if the compiler is allowed to try to replace register number
+ from-reg with register number to-reg. */
+DEFHOOK
+(can_eliminate,
+ "",
+ bool, (const int from_reg, const int to_reg),
+ hook_bool_const_int_const_int_true)
+
+/* Functions specific to the C family of frontends. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_C_"
+HOOK_VECTOR (TARGET_C, c)
+
+/* ??? Documenting this hook requires a GFDL license grant. */
+DEFHOOK_UNDOC
+(mode_for_suffix,
+"Return machine mode for non-standard constant literal suffix @var{c},\
+ or VOIDmode if non-standard suffixes are unsupported.",
+ enum machine_mode, (char c),
+ default_mode_for_suffix)
+
+HOOK_VECTOR_END (c)
+
+/* Functions specific to the C++ frontend. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_CXX_"
+HOOK_VECTOR (TARGET_CXX, cxx)
+
+/* Return the integer type used for guard variables. */
+DEFHOOK
+(guard_type,
+ "",
+ tree, (void),
+ default_cxx_guard_type)
+
+/* Return true if only the low bit of the guard should be tested. */
+DEFHOOK
+(guard_mask_bit,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Returns the size of the array cookie for an array of type. */
+DEFHOOK
+(get_cookie_size,
+ "",
+ tree, (tree type),
+ default_cxx_get_cookie_size)
+
+/* Returns true if the element size should be stored in the array cookie. */
+DEFHOOK
+(cookie_has_size,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Allows backends to perform additional processing when
+ deciding if a class should be exported or imported. */
+DEFHOOK
+(import_export_class,
+ "",
+ int, (tree type, int import_export), NULL)
+
+/* Returns true if constructors and destructors return "this". */
+DEFHOOK
+(cdtor_returns_this,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Returns true if the key method for a class can be an inline
+ function, so long as it is not declared inline in the class
+ itself. Returning true is the behavior required by the Itanium C++ ABI. */
+DEFHOOK
+(key_method_may_be_inline,
+ "",
+ bool, (void),
+ hook_bool_void_true)
+
+DEFHOOK
+(determine_class_data_visibility,
+"@var{decl} is a virtual table, virtual table table, typeinfo object,\
+ or other similar implicit class data object that will be emitted with\
+ external linkage in this translation unit. No ELF visibility has been\
+ explicitly specified. If the target needs to specify a visibility\
+ other than that of the containing class, use this hook to set\
+ @code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}.",
+ void, (tree decl),
+ hook_void_tree)
+
+/* Returns true (the default) if virtual tables and other
+ similar implicit class data objects are always COMDAT if they
+ have external linkage. If this hook returns false, then
+ class data for classes whose virtual table will be emitted in
+ only one translation unit will not be COMDAT. */
+DEFHOOK
+(class_data_always_comdat,
+ "",
+ bool, (void),
+ hook_bool_void_true)
+
+/* Returns true (the default) if the RTTI for the basic types,
+ which is always defined in the C++ runtime, should be COMDAT;
+ false if it should not be COMDAT. */
+DEFHOOK
+(library_rtti_comdat,
+ "",
+ bool, (void),
+ hook_bool_void_true)
+
+/* Returns true if __aeabi_atexit should be used to register static
+ destructors. */
+DEFHOOK
+(use_aeabi_atexit,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+/* Returns true if target may use atexit in the same manner as
+ __cxa_atexit to register static destructors. */
+DEFHOOK
+(use_atexit_for_cxa_atexit,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
+DEFHOOK
+(adjust_class_at_definition,
+"@var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just\
+ been defined. Use this hook to make adjustments to the class (eg, tweak\
+ visibility or perform any other required target modifications).",
+ void, (tree type),
+ hook_void_tree)
+
+HOOK_VECTOR_END (cxx)
+
+/* Functions and data for emulated TLS support. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_EMUTLS_"
+HOOK_VECTOR (TARGET_EMUTLS, emutls)
+
+/* Name of the address and common functions. */
+DEFHOOKPOD
+(get_address,
+ "",
+ const char *, "__builtin___emutls_get_address")
+
+DEFHOOKPOD
+(register_common,
+ "",
+ const char *, "__builtin___emutls_register_common")
+
+/* Prefixes for proxy variable and template. */
+DEFHOOKPOD
+(var_section,
+ "",
+ const char *, NULL)
+
+DEFHOOKPOD
+(tmpl_section,
+ "",
+ const char *, NULL)
+
+/* Prefixes for proxy variable and template. */
+DEFHOOKPOD
+(var_prefix,
+ "",
+ const char *, NULL)
+
+DEFHOOKPOD
+(tmpl_prefix,
+ "",
+ const char *, NULL)
+
+/* Function to generate field definitions of the proxy variable. */
+DEFHOOK
+(var_fields,
+ "",
+ tree, (tree type, tree *name),
+ default_emutls_var_fields)
+
+/* Function to initialize a proxy variable. */
+DEFHOOK
+(var_init,
+ "",
+ tree, (tree var, tree decl, tree tmpl_addr),
+ default_emutls_var_init)
+
+/* Whether we are allowed to alter the usual alignment of the
+ proxy variable. */
+DEFHOOKPOD
+(var_align_fixed,
+ "",
+ bool, false)
+
+/* Whether we can emit debug information for TLS vars. */
+DEFHOOKPOD
+(debug_form_tls_address,
+ "",
+ bool, false)
+
+HOOK_VECTOR_END (emutls)
+
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_OPTION_"
+HOOK_VECTOR (TARGET_OPTION_HOOKS, target_option_hooks)
+
+/* Function to validate the attribute((option(...))) strings or NULL. If
+ the option is validated, it is assumed that DECL_FUNCTION_SPECIFIC will
+ be filled in in the function decl node. */
+DEFHOOK
+(valid_attribute_p,
+ "",
+ bool, (tree fndecl, tree name, tree args, int flags),
+ default_target_option_valid_attribute_p)
+
+/* Function to save any extra target state in the target options structure. */
+DEFHOOK
+(save,
+ "",
+ void, (struct cl_target_option *ptr), NULL)
+
+/* Function to restore any extra target state from the target options
+ structure. */
+DEFHOOK
+(restore,
+ "",
+ void, (struct cl_target_option *ptr), NULL)
+
+/* Function to print any extra target state from the target options
+ structure. */
+DEFHOOK
+(print,
+ "",
+ void, (FILE *file, int indent, struct cl_target_option *ptr), NULL)
+
+/* Function to parse arguments to be validated for #pragma option, and to
+ change the state if the options are valid. If the first argument is
+ NULL, the second argument specifies the default options to use. Return
+ true if the options are valid, and set the current state. */
+/* ??? The documentation in tm.texi is incomplete. */
+DEFHOOK
+(pragma_parse,
+ "",
+ bool, (tree args, tree pop_target),
+ default_target_option_pragma_parse)
+
+/* Do option overrides for the target. */
+DEFHOOK
+(override,
+ "",
+ void, (void),
+ default_target_option_override)
+
+/* Function to determine if one function can inline another function. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_"
+DEFHOOK
+(can_inline_p,
+ "",
+ bool, (tree caller, tree callee),
+ default_target_can_inline_p)
+
+HOOK_VECTOR_END (target_option)
+
+/* For targets that need to mark extra registers as live on entry to
+ the function, they should define this target hook and set their
+ bits in the bitmap passed in. */
+DEFHOOK
+(extra_live_on_entry,
+ "",
+ void, (bitmap regs),
+ hook_void_bitmap)
+
+/* Leave the boolean fields at the end. */
+
+/* True if unwinding tables should be generated by default. */
+DEFHOOKPOD
+(unwind_tables_default,
+ "",
+ bool, false)
+
+/* True if arbitrary sections are supported. */
+DEFHOOKPOD
+(have_named_sections,
+ "",
+ bool, false)
+
+/* True if we can create zeroed data by switching to a BSS section
+ and then using ASM_OUTPUT_SKIP to allocate the space. */
+DEFHOOKPOD
+(have_switchable_bss_sections,
+ "",
+ bool, false)
+
+/* True if "native" constructors and destructors are supported,
+ false if we're using collect2 for the job. */
+DEFHOOKPOD
+(have_ctors_dtors,
+ "",
+ bool, false)
+
+/* True if thread-local storage is supported. */
+DEFHOOKPOD
+(have_tls,
+ "",
+ bool, false)
+
+/* True if a small readonly data section is supported. */
+DEFHOOKPOD
+(have_srodata_section,
+ "",
+ bool, false)
+
+/* True if EH frame info sections should be zero-terminated. */
+DEFHOOKPOD
+(terminate_dw2_eh_frame_info,
+ "",
+ bool, true)
+
+/* True if #NO_APP should be emitted at the beginning of assembly output. */
+DEFHOOKPOD
+(asm_file_start_app_off,
+ "",
+ bool, false)
+
+/* True if output_file_directive should be called for main_input_filename
+ at the beginning of assembly output. */
+DEFHOOKPOD
+(asm_file_start_file_directive,
+ "",
+ bool, false)
+
+DEFHOOKPOD
+(handle_pragma_extern_prefix,
+"True if @code{#pragma extern_prefix} is to be supported.",
+ bool, 0)
+
+/* True if the target is allowed to reorder memory accesses unless
+ synchronization is explicitly requested. */
+DEFHOOKPOD
+(relaxed_ordering,
+ "",
+ bool, false)
+
+/* Returns true if we should generate exception tables for use with the
+ ARM EABI. The effects the encoding of function exception specifications. */
+DEFHOOKPOD
+(arm_eabi_unwinder,
+ "",
+ bool, false)
+
+/* Leave the boolean fields at the end. */
+
+/* Empty macro arguments are undefined in C90, so use an empty macro. */
+#define C90_EMPTY_HACK
+/* Close the 'struct gcc_target' definition. */
+HOOK_VECTOR_END (C90_EMPTY_HACK)
+
+HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
+
+/* Handle target switch CODE (an OPT_* value). ARG is the argument
+ passed to the switch; it is NULL if no argument was. VALUE is the
+ value of ARG if CODE specifies a UInteger option, otherwise it is
+ 1 if the positive form of the switch was used and 0 if the negative
+ form was. Return true if the switch was valid. */
+DEFHOOK
+(handle_c_option,
+ "",
+ bool, (size_t code, const char *arg, int value),
+ default_handle_c_option)
+
+HOOK_VECTOR_END (C90_EMPTY_HACK)
diff --git a/gcc/target.h b/gcc/target.h
index e17cc21f9fc..18d160dbeb2 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -110,1164 +110,33 @@ struct asm_int_op
const char *ti;
};
-/* The target structure. This holds all the backend hooks. */
-
-struct gcc_target
+/* Types of costs for vectorizer cost model. */
+enum vect_cost_for_stmt
{
- /* Functions that output assembler for the target. */
- struct asm_out
- {
- /* Opening and closing parentheses for asm expression grouping. */
- const char *open_paren, *close_paren;
-
- /* Assembler instructions for creating various kinds of integer object. */
- const char *byte_op;
- struct asm_int_op aligned_op, unaligned_op;
-
- /* Try to output the assembler code for an integer object whose
- value is given by X. SIZE is the size of the object in bytes and
- ALIGNED_P indicates whether it is aligned. Return true if
- successful. Only handles cases for which BYTE_OP, ALIGNED_OP
- and UNALIGNED_OP are NULL. */
- bool (* integer) (rtx x, unsigned int size, int aligned_p);
-
- /* Output code that will globalize a label. */
- void (* globalize_label) (FILE *, const char *);
-
- /* Output code that will globalize a declaration. */
- void (* globalize_decl_name) (FILE *, tree);
-
- /* Output code that will emit a label for unwind info, if this
- target requires such labels. Second argument is the decl the
- unwind info is associated with, third is a boolean: true if
- this is for exception handling, fourth is a boolean: true if
- this is only a placeholder for an omitted FDE. */
- void (* unwind_label) (FILE *, tree, int, int);
-
- /* Output code that will emit a label to divide up the exception
- table. */
- void (* except_table_label) (FILE *);
-
- /* Emit any directives required to unwind this instruction. */
- void (* unwind_emit) (FILE *, rtx);
-
- /* Output an internal label. */
- void (* internal_label) (FILE *, const char *, unsigned long);
-
- /* Emit a ttype table reference to a typeinfo object. */
- bool (* ttype) (rtx);
-
- /* Emit an assembler directive to set visibility for the symbol
- associated with the tree decl. */
- void (* visibility) (tree, int);
-
- /* Output the assembler code for entry to a function. */
- void (* function_prologue) (FILE *, HOST_WIDE_INT);
-
- /* Output the assembler code for end of prologue. */
- void (* function_end_prologue) (FILE *);
-
- /* Output the assembler code for start of epilogue. */
- void (* function_begin_epilogue) (FILE *);
-
- /* Output the assembler code for function exit. */
- void (* function_epilogue) (FILE *, HOST_WIDE_INT);
-
- /* Initialize target-specific sections. */
- void (* init_sections) (void);
-
- /* Tell assembler to change to section NAME with attributes FLAGS.
- If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
- which this section is associated. */
- void (* named_section) (const char *name, unsigned int flags, tree decl);
-
- /* Return a mask describing how relocations should be treated when
- selecting sections. Bit 1 should be set if global relocations
- should be placed in a read-write section; bit 0 should be set if
- local relocations should be placed in a read-write section. */
- int (*reloc_rw_mask) (void);
-
- /* Return a section for EXP. It may be a DECL or a constant. RELOC
- is nonzero if runtime relocations must be applied; bit 1 will be
- set if the runtime relocations require non-local name resolution.
- ALIGN is the required alignment of the data. */
- section *(* select_section) (tree, int, unsigned HOST_WIDE_INT);
-
- /* Return a section for X. MODE is X's mode and ALIGN is its
- alignment in bits. */
- section *(* select_rtx_section) (enum machine_mode, rtx,
- unsigned HOST_WIDE_INT);
-
- /* Select a unique section name for DECL. RELOC is the same as
- for SELECT_SECTION. */
- void (* unique_section) (tree, int);
-
- /* Return the readonly data section associated with function DECL. */
- section *(* function_rodata_section) (tree);
-
- /* Output a constructor for a symbol with a given priority. */
- void (* constructor) (rtx, int);
-
- /* Output a destructor for a symbol with a given priority. */
- void (* destructor) (rtx, int);
-
- /* Output the assembler code for a thunk function. THUNK_DECL is the
- declaration for the thunk function itself, FUNCTION is the decl for
- the target function. DELTA is an immediate constant offset to be
- added to THIS. If VCALL_OFFSET is nonzero, the word at
- *(*this + vcall_offset) should be added to THIS. */
- void (* output_mi_thunk) (FILE *file, tree thunk_decl,
- HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
- tree function_decl);
-
- /* Determine whether output_mi_thunk would succeed. */
- /* ??? Ideally, this hook would not exist, and success or failure
- would be returned from output_mi_thunk directly. But there's
- too much undo-able setup involved in invoking output_mi_thunk.
- Could be fixed by making output_mi_thunk emit rtl instead of
- text to the output file. */
- bool (* can_output_mi_thunk) (const_tree thunk_decl, HOST_WIDE_INT delta,
- HOST_WIDE_INT vcall_offset,
- const_tree function_decl);
-
- /* Output any boilerplate text needed at the beginning of a
- translation unit. */
- void (*file_start) (void);
-
- /* Output any boilerplate text needed at the end of a
- translation unit. */
- void (*file_end) (void);
-
- /* Output any boilerplate text needed at the beginning of an
- LTO output stream. */
- void (*lto_start) (void);
-
- /* Output any boilerplate text needed at the end of an
- LTO output stream. */
- void (*lto_end) (void);
-
- /* Output any boilerplace text needed at the end of a
- translation unit before debug and unwind info is emitted. */
- void (*code_end) (void);
-
- /* Output an assembler pseudo-op to declare a library function name
- external. */
- void (*external_libcall) (rtx);
-
- /* Output an assembler directive to mark decl live. This instructs
- linker to not dead code strip this symbol. */
- void (*mark_decl_preserved) (const char *);
-
- /* Output a record of the command line switches that have been passed. */
- print_switch_fn_type record_gcc_switches;
- /* The name of the section that the example ELF implementation of
- record_gcc_switches will use to store the information. Target
- specific versions of record_gcc_switches may or may not use
- this information. */
- const char * record_gcc_switches_section;
-
- /* Output the definition of a section anchor. */
- void (*output_anchor) (rtx);
-
- /* Output a DTP-relative reference to a TLS symbol. */
- void (*output_dwarf_dtprel) (FILE *file, int size, rtx x);
-
- /* Some target machines need to postscan each insn after it is output. */
- void (*final_postscan_insn) (FILE *, rtx, rtx *, int);
-
- /* Emit the trampoline template. This hook may be NULL. */
- void (*trampoline_template) (FILE *);
- } asm_out;
-
- /* Functions relating to instruction scheduling. */
- struct sched
- {
- /* Given the current cost, COST, of an insn, INSN, calculate and
- return a new cost based on its relationship to DEP_INSN through
- the dependence LINK. The default is to make no adjustment. */
- int (* adjust_cost) (rtx insn, rtx link, rtx dep_insn, int cost);
-
- /* Adjust the priority of an insn as you see fit. Returns the new
- priority. */
- int (* adjust_priority) (rtx, int);
-
- /* Function which returns the maximum number of insns that can be
- scheduled in the same machine cycle. This must be constant
- over an entire compilation. The default is 1. */
- int (* issue_rate) (void);
-
- /* Calculate how much this insn affects how many more insns we
- can emit this cycle. Default is they all cost the same. */
- int (* variable_issue) (FILE *, int, rtx, int);
-
- /* Initialize machine-dependent scheduling code. */
- void (* md_init) (FILE *, int, int);
-
- /* Finalize machine-dependent scheduling code. */
- void (* md_finish) (FILE *, int);
-
- /* Initialize machine-dependent function wide scheduling code. */
- void (* md_init_global) (FILE *, int, int);
-
- /* Finalize machine-dependent function wide scheduling code. */
- void (* md_finish_global) (FILE *, int);
-
- /* Reorder insns in a machine-dependent fashion, in two different
- places. Default does nothing. */
- int (* reorder) (FILE *, int, rtx *, int *, int);
- int (* reorder2) (FILE *, int, rtx *, int *, int);
-
- /* The following member value is a pointer to a function called
- after evaluation forward dependencies of insns in chain given
- by two parameter values (head and tail correspondingly). */
- void (* dependencies_evaluation_hook) (rtx, rtx);
-
- /* The values of the following four members are pointers to
- functions used to simplify the automaton descriptions.
- dfa_pre_cycle_insn and dfa_post_cycle_insn give functions
- returning insns which are used to change the pipeline hazard
- recognizer state when the new simulated processor cycle
- correspondingly starts and finishes. The function defined by
- init_dfa_pre_cycle_insn and init_dfa_post_cycle_insn are used
- to initialize the corresponding insns. The default values of
- the members result in not changing the automaton state when
- the new simulated processor cycle correspondingly starts and
- finishes. */
- void (* init_dfa_pre_cycle_insn) (void);
- rtx (* dfa_pre_cycle_insn) (void);
- void (* init_dfa_post_cycle_insn) (void);
- rtx (* dfa_post_cycle_insn) (void);
-
- /* The values of the following two members are pointers to
- functions used to simplify the automaton descriptions.
- dfa_pre_advance_cycle and dfa_post_advance_cycle are getting called
- immediately before and after cycle is advanced. */
- void (* dfa_pre_advance_cycle) (void);
- void (* dfa_post_advance_cycle) (void);
-
- /* The following member value is a pointer to a function returning value
- which defines how many insns in queue `ready' will we try for
- multi-pass scheduling. If the member value is nonzero and the
- function returns positive value, the DFA based scheduler will make
- multi-pass scheduling for the first cycle. In other words, we will
- try to choose ready insn which permits to start maximum number of
- insns on the same cycle. */
- int (* first_cycle_multipass_dfa_lookahead) (void);
-
- /* The following member value is pointer to a function controlling
- what insns from the ready insn queue will be considered for the
- multipass insn scheduling. If the hook returns zero for insn
- passed as the parameter, the insn will be not chosen to be
- issued. */
- int (* first_cycle_multipass_dfa_lookahead_guard) (rtx);
-
- /* The following member value is pointer to a function called by
- the insn scheduler before issuing insn passed as the third
- parameter on given cycle. If the hook returns nonzero, the
- insn is not issued on given processors cycle. Instead of that,
- the processor cycle is advanced. If the value passed through
- the last parameter is zero, the insn ready queue is not sorted
- on the new cycle start as usually. The first parameter passes
- file for debugging output. The second one passes the scheduler
- verbose level of the debugging output. The forth and the fifth
- parameter values are correspondingly processor cycle on which
- the previous insn has been issued and the current processor
- cycle. */
- int (* dfa_new_cycle) (FILE *, int, rtx, int, int, int *);
-
- /* The following member value is a pointer to a function called by the
- insn scheduler. It should return true if there exists a dependence
- which is considered costly by the target, between the insn
- DEP_PRO (&_DEP), and the insn DEP_CON (&_DEP). The first parameter is
- the dep that represents the dependence between the two insns. The
- second argument is the cost of the dependence as estimated by
- the scheduler. The last argument is the distance in cycles
- between the already scheduled insn (first parameter) and the
- second insn (second parameter). */
- bool (* is_costly_dependence) (struct _dep *_dep, int, int);
-
- /* Given the current cost, COST, of an insn, INSN, calculate and
- return a new cost based on its relationship to DEP_INSN through the
- dependence of type DEP_TYPE. The default is to make no adjustment. */
- int (* adjust_cost_2) (rtx insn, int, rtx dep_insn, int cost, int dw);
-
- /* The following member value is a pointer to a function called
- by the insn scheduler. This hook is called to notify the backend
- that new instructions were emitted. */
- void (* h_i_d_extended) (void);
-
- /* Next 5 functions are for multi-point scheduling. */
-
- /* Allocate memory for scheduler context. */
- void *(* alloc_sched_context) (void);
-
- /* Fills the context from the local machine scheduler context. */
- void (* init_sched_context) (void *, bool);
-
- /* Sets local machine scheduler context to a saved value. */
- void (* set_sched_context) (void *);
-
- /* Clears a scheduler context so it becomes like after init. */
- void (* clear_sched_context) (void *);
-
- /* Frees the scheduler context. */
- void (* free_sched_context) (void *);
-
- /* The following member value is a pointer to a function called
- by the insn scheduler.
- The first parameter is an instruction, the second parameter is the type
- of the requested speculation, and the third parameter is a pointer to the
- speculative pattern of the corresponding type (set if return value == 1).
- It should return
- -1, if there is no pattern, that will satisfy the requested speculation
- type,
- 0, if current pattern satisfies the requested speculation type,
- 1, if pattern of the instruction should be changed to the newly
- generated one. */
- int (* speculate_insn) (rtx, int, rtx *);
-
- /* The following member value is a pointer to a function called
- by the insn scheduler. It should return true if the check instruction
- passed as the parameter needs a recovery block. */
- bool (* needs_block_p) (int);
-
- /* The following member value is a pointer to a function called
- by the insn scheduler. It should return a pattern for the check
- instruction.
- The first parameter is a speculative instruction, the second parameter
- is the label of the corresponding recovery block (or null, if it is a
- simple check). If the mutation of the check is requested (e.g. from
- ld.c to chk.a), the third parameter is true - in this case the first
- parameter is the previous check. */
- rtx (* gen_spec_check) (rtx, rtx, int);
-
- /* The following member value is a pointer to a function controlling
- what insns from the ready insn queue will be considered for the
- multipass insn scheduling. If the hook returns zero for the insn
- passed as the parameter, the insn will not be chosen to be
- issued. This hook is used to discard speculative instructions,
- that stand at the first position of the ready list. */
- bool (* first_cycle_multipass_dfa_lookahead_guard_spec) (const_rtx);
-
- /* The following member value is a pointer to a function that provides
- information about the speculation capabilities of the target.
- The parameter is a pointer to spec_info variable. */
- void (* set_sched_flags) (struct spec_info_def *);
-
- /* Return speculation types of the instruction passed as the parameter. */
- int (* get_insn_spec_ds) (rtx);
-
- /* Return speculation types that are checked for the instruction passed as
- the parameter. */
- int (* get_insn_checked_ds) (rtx);
-
- /* Return bool if rtx scanning should just skip current layer and
- advance to the inner rtxes. */
- bool (* skip_rtx_p) (const_rtx);
-
- /* The following member value is a pointer to a function that provides
- information about the target resource-based lower bound which is
- used by the swing modulo scheduler. The parameter is a pointer
- to ddg variable. */
- int (* sms_res_mii) (struct ddg *);
- } sched;
-
- /* Functions relating to vectorization. */
- struct vectorize
- {
- /* The following member value is a pointer to a function called
- by the vectorizer, and return the decl of the target builtin
- function. */
- tree (* builtin_mask_for_load) (void);
-
- /* Returns a code for builtin that realizes vectorized version of
- function, or NULL_TREE if not available. */
- tree (* builtin_vectorized_function) (tree, tree, tree);
-
- /* Returns a function declaration for a builtin that realizes the
- vector conversion, or NULL_TREE if not available. */
- tree (* builtin_conversion) (unsigned, tree, tree);
-
- /* Target builtin that implements vector widening multiplication.
- builtin_mul_widen_eve computes the element-by-element products
- for the even elements, and builtin_mul_widen_odd computes the
- element-by-element products for the odd elements. */
- tree (* builtin_mul_widen_even) (tree);
- tree (* builtin_mul_widen_odd) (tree);
-
- /* Returns the cost to be added to the overheads involved with
- executing the vectorized version of a loop. */
- int (*builtin_vectorization_cost) (bool);
-
- /* Return true if vector alignment is reachable (by peeling N
- iterations) for the given type. */
- bool (* vector_alignment_reachable) (const_tree, bool);
-
- /* Target builtin that implements vector permute. */
- tree (* builtin_vec_perm) (tree, tree*);
-
- /* Return true if a vector created for builtin_vec_perm is valid. */
- bool (* builtin_vec_perm_ok) (tree, tree);
-
- /* Return true if the target supports misaligned store/load of a
- specific factor denoted in the third parameter. The last parameter
- is true if the access is defined in a packed struct. */
- bool (* builtin_support_vector_misalignment) (enum machine_mode,
- const_tree, int, bool);
- } vectorize;
-
- /* The initial value of target_flags. */
- int default_target_flags;
-
- /* Allow target specific overriding of option settings after options have
- been changed by an attribute or pragma or when it is reset at the
- end of the code affected by an attribute or pragma. */
- void (* override_options_after_change) (void);
-
- /* Handle target switch CODE (an OPT_* value). ARG is the argument
- passed to the switch; it is NULL if no argument was. VALUE is the
- value of ARG if CODE specifies a UInteger option, otherwise it is
- 1 if the positive form of the switch was used and 0 if the negative
- form was. Return true if the switch was valid. */
- bool (* handle_option) (size_t code, const char *arg, int value);
-
- /* Handle target-specific parts of specifying -Ofast. */
- void (* handle_ofast) (void);
-
- /* Display extra, target specific information in response to a
- --target-help switch. */
- void (* target_help) (void);
-
- /* Return machine mode for filter value. */
- enum machine_mode (* eh_return_filter_mode) (void);
-
- /* Return machine mode for libgcc expanded cmp instructions. */
- enum machine_mode (* libgcc_cmp_return_mode) (void);
-
- /* Return machine mode for libgcc expanded shift instructions. */
- enum machine_mode (* libgcc_shift_count_mode) (void);
-
- /* Return machine mode to be used for _Unwind_Word type. */
- enum machine_mode (* unwind_word_mode) (void);
-
- /* Given two decls, merge their attributes and return the result. */
- tree (* merge_decl_attributes) (tree, tree);
-
- /* Given two types, merge their attributes and return the result. */
- tree (* merge_type_attributes) (tree, tree);
-
- /* Table of machine attributes and functions to handle them.
- Ignored if NULL. */
- const struct attribute_spec *attribute_table;
-
- /* Return true iff attribute NAME expects a plain identifier as its first
- argument. */
- bool (*attribute_takes_identifier_p) (const_tree name);
-
- /* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
- one if they are compatible and two if they are nearly compatible
- (which causes a warning to be generated). */
- int (* comp_type_attributes) (const_tree type1, const_tree type2);
-
- /* Assign default attributes to the newly defined TYPE. */
- void (* set_default_type_attributes) (tree type);
-
- /* Insert attributes on the newly created DECL. */
- void (* insert_attributes) (tree decl, tree *attributes);
-
- /* Return true if FNDECL (which has at least one machine attribute)
- can be inlined despite its machine attributes, false otherwise. */
- bool (* function_attribute_inlinable_p) (const_tree fndecl);
-
- /* Return true if bitfields in RECORD_TYPE should follow the
- Microsoft Visual C++ bitfield layout rules. */
- bool (* ms_bitfield_layout_p) (const_tree record_type);
-
- /* True if the target supports decimal floating point. */
- bool (* decimal_float_supported_p) (void);
-
- /* True if the target supports fixed-point. */
- bool (* fixed_point_supported_p) (void);
-
- /* Return true if anonymous bitfields affect structure alignment. */
- bool (* align_anon_bitfield) (void);
-
- /* Return true if volatile bitfields should use the narrowest type possible.
- Return false if they should use the container type. */
- bool (* narrow_volatile_bitfield) (void);
-
- /* Set up target-specific built-in functions. */
- void (* init_builtins) (void);
-
- /* Initialize (if INITIALIZE_P is true) and return the target-specific
- built-in function decl for CODE.
- Return NULL if that is not possible. Return error_mark_node if CODE
- is outside of the range of valid target builtin function codes. */
- tree (* builtin_decl) (unsigned code, bool initialize_p);
-
- /* Expand a target-specific builtin. */
- rtx (* expand_builtin) (tree exp, rtx target, rtx subtarget,
- enum machine_mode mode, int ignore);
-
- /* Select a replacement for a target-specific builtin. This is done
- *before* regular type checking, and so allows the target to
- implement a crude form of function overloading. The result is a
- complete expression that implements the operation. PARAMS really
- has type VEC(tree,gc)*, but we don't want to include tree.h
- here. */
- tree (*resolve_overloaded_builtin) (unsigned int /*location_t*/,
- tree decl, void *params);
-
- /* Fold a target-specific builtin. */
- tree (* fold_builtin) (tree fndecl, int nargs, tree *argp, bool ignore);
-
- /* Returns a code for a target-specific builtin that implements
- reciprocal of the function, or NULL_TREE if not available. */
- tree (* builtin_reciprocal) (unsigned, bool, bool);
-
- /* For a vendor-specific TYPE, return a pointer to a statically-allocated
- string containing the C++ mangling for TYPE. In all other cases, return
- NULL. */
- const char * (* mangle_type) (const_tree type);
-
- /* Make any adjustments to libfunc names needed for this target. */
- void (* init_libfuncs) (void);
-
- /* Given a decl, a section name, and whether the decl initializer
- has relocs, choose attributes for the section. */
- /* ??? Should be merged with SELECT_SECTION and UNIQUE_SECTION. */
- unsigned int (* section_type_flags) (tree, const char *, int);
-
- /* True if new jumps cannot be created, to replace existing ones or
- not, at the current point in the compilation. */
- bool (* cannot_modify_jumps_p) (void);
-
- /* Return a register class for which branch target register
- optimizations should be applied. */
- enum reg_class (* branch_target_register_class) (void);
-
- /* Return true if branch target register optimizations should include
- callee-saved registers that are not already live during the current
- function. AFTER_PE_GEN is true if prologues and epilogues have
- already been generated. */
- bool (* branch_target_register_callee_saved) (bool after_pe_gen);
-
- /* Return true if the target supports conditional execution. */
- bool (* have_conditional_execution) (void);
-
- /* Return a new value for loop unroll size. */
- unsigned (* loop_unroll_adjust) (unsigned nunroll, struct loop *loop);
-
- /* True if the constant X cannot be placed in the constant pool. */
- bool (* cannot_force_const_mem) (rtx);
-
- /* True if the insn X cannot be duplicated. */
- bool (* cannot_copy_insn_p) (rtx);
-
- /* True if X is considered to be commutative. */
- bool (* commutative_p) (const_rtx, int);
-
- /* True if ADDR is an address-expression whose effect depends
- on the mode of the memory reference it is used in. */
- bool (* mode_dependent_address_p) (const_rtx addr);
-
- /* Given an invalid address X for a given machine mode, try machine-specific
- ways to make it legitimate. Return X or an invalid address on failure. */
- rtx (* legitimize_address) (rtx, rtx, enum machine_mode);
-
- /* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */
- rtx (* delegitimize_address) (rtx);
-
- /* Given an address RTX, say whether it is valid. */
- bool (* legitimate_address_p) (enum machine_mode, rtx, bool);
-
- /* True if the given constant can be put into an object_block. */
- bool (* use_blocks_for_constant_p) (enum machine_mode, const_rtx);
-
- /* The minimum and maximum byte offsets for anchored addresses. */
- HOST_WIDE_INT min_anchor_offset;
- HOST_WIDE_INT max_anchor_offset;
-
- /* True if section anchors can be used to access the given symbol. */
- bool (* use_anchors_for_symbol_p) (const_rtx);
-
- /* True if it is OK to do sibling call optimization for the specified
- call expression EXP. DECL will be the called function, or NULL if
- this is an indirect call. */
- bool (*function_ok_for_sibcall) (tree decl, tree exp);
-
- /* Establish appropriate back-end context for processing the function
- FNDECL. The argument might be NULL to indicate processing at top
- level, outside of any function scope. */
- void (*set_current_function) (tree fndecl);
-
- /* True if EXP should be placed in a "small data" section. */
- bool (* in_small_data_p) (const_tree);
-
- /* True if EXP names an object for which name resolution must resolve
- to the current executable or shared library. */
- bool (* binds_local_p) (const_tree);
-
- /* Modify and return the identifier of a DECL's external name,
- originally identified by ID, as required by the target,
- (eg, append @nn to windows32 stdcall function names).
- The default is to return ID without modification. */
- tree (* mangle_decl_assembler_name) (tree decl, tree id);
-
- /* Do something target-specific to record properties of the DECL into
- the associated SYMBOL_REF. */
- void (* encode_section_info) (tree, rtx, int);
-
- /* Undo the effects of encode_section_info on the symbol string. */
- const char * (* strip_name_encoding) (const char *);
-
- /* If shift optabs for MODE are known to always truncate the shift count,
- return the mask that they apply. Return 0 otherwise. */
- unsigned HOST_WIDE_INT (* shift_truncation_mask) (enum machine_mode mode);
-
- /* Return the number of divisions in the given MODE that should be present,
- so that it is profitable to turn the division into a multiplication by
- the reciprocal. */
- unsigned int (* min_divisions_for_recip_mul) (enum machine_mode mode);
-
- /* If the representation of integral MODE is such that values are
- always sign-extended to a wider mode MODE_REP then return
- SIGN_EXTEND. Return UNKNOWN otherwise. */
- /* Note that the return type ought to be RTX_CODE, but that's not
- necessarily defined at this point. */
- int (* mode_rep_extended) (enum machine_mode mode,
- enum machine_mode mode_rep);
-
- /* True if MODE is valid for a pointer in __attribute__((mode("MODE"))). */
- bool (* valid_pointer_mode) (enum machine_mode mode);
-
- /* Support for named address spaces. */
- struct addr_space {
- /* MODE to use for a pointer into another address space. */
- enum machine_mode (* pointer_mode) (addr_space_t);
-
- /* MODE to use for an address in another address space. */
- enum machine_mode (* address_mode) (addr_space_t);
-
- /* True if MODE is valid for a pointer in __attribute__((mode("MODE")))
- in another address space. */
- bool (* valid_pointer_mode) (enum machine_mode, addr_space_t);
-
- /* True if an address is a valid memory address to a given named address
- space for a given mode. */
- bool (* legitimate_address_p) (enum machine_mode, rtx, bool, addr_space_t);
-
- /* Return an updated address to convert an invalid pointer to a named
- address space to a valid one. If NULL_RTX is returned use machine
- independent methods to make the address valid. */
- rtx (* legitimize_address) (rtx, rtx, enum machine_mode, addr_space_t);
-
- /* True if one named address space is a subset of another named address. */
- bool (* subset_p) (addr_space_t, addr_space_t);
-
- /* Function to convert an rtl expression from one address space to
- another. */
- rtx (* convert) (rtx, tree, tree);
-
- } addr_space;
-
- /* True if MODE is valid for the target. By "valid", we mean able to
- be manipulated in non-trivial ways. In particular, this means all
- the arithmetic is supported. */
- bool (* scalar_mode_supported_p) (enum machine_mode mode);
-
- /* Similarly for vector modes. "Supported" here is less strict. At
- least some operations are supported; need to check optabs or builtins
- for further details. */
- bool (* vector_mode_supported_p) (enum machine_mode mode);
-
- /* True for MODE if the target expects that registers in this mode will
- be allocated to registers in a small register class. The compiler is
- allowed to use registers explicitly used in the rtl as spill registers
- but it should prevent extending the lifetime of these registers. */
- bool (* small_register_classes_for_mode_p) (enum machine_mode mode);
-
- /* Compute a (partial) cost for rtx X. Return true if the complete
- cost has been computed, and false if subexpressions should be
- scanned. In either case, *TOTAL contains the cost result. */
- /* Note that CODE and OUTER_CODE ought to be RTX_CODE, but that's
- not necessarily defined at this point. */
- bool (* rtx_costs) (rtx x, int code, int outer_code, int *total, bool speed);
-
- /* Compute the cost of X, used as an address. Never called with
- invalid addresses. */
- int (* address_cost) (rtx x, bool speed);
-
- /* Return where to allocate pseudo for a given hard register initial
- value. */
- rtx (* allocate_initial_value) (rtx x);
-
- /* Return nonzero if evaluating UNSPEC[_VOLATILE] X might cause a trap.
- FLAGS has the same meaning as in rtlanal.c: may_trap_p_1. */
- int (* unspec_may_trap_p) (const_rtx x, unsigned flags);
-
- /* Given a register, this hook should return a parallel of registers
- to represent where to find the register pieces. Define this hook
- if the register and its mode are represented in Dwarf in
- non-contiguous locations, or if the register should be
- represented in more than one register in Dwarf. Otherwise, this
- hook should return NULL_RTX. */
- rtx (* dwarf_register_span) (rtx);
-
- /* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
- entries not corresponding directly to registers below
- FIRST_PSEUDO_REGISTER, this hook should generate the necessary
- code, given the address of the table. */
- void (* init_dwarf_reg_sizes_extra) (tree);
-
- /* Fetch the fixed register(s) which hold condition codes, for
- targets where it makes sense to look for duplicate assignments to
- the condition codes. This should return true if there is such a
- register, false otherwise. The arguments should be set to the
- fixed register numbers. Up to two condition code registers are
- supported. If there is only one for this target, the int pointed
- at by the second argument should be set to -1. */
- bool (* fixed_condition_code_regs) (unsigned int *, unsigned int *);
-
- /* If two condition code modes are compatible, return a condition
- code mode which is compatible with both, such that a comparison
- done in the returned mode will work for both of the original
- modes. If the condition code modes are not compatible, return
- VOIDmode. */
- enum machine_mode (* cc_modes_compatible) (enum machine_mode,
- enum machine_mode);
-
- /* Do machine-dependent code transformations. Called just before
- delayed-branch scheduling. */
- void (* machine_dependent_reorg) (void);
-
- /* Create the __builtin_va_list type. */
- tree (* build_builtin_va_list) (void);
-
- /* Enumerate the va list variants. */
- int (* enum_va_list) (int, const char **, tree *);
-
- /* Get the cfun/fndecl calling abi __builtin_va_list type. */
- tree (* fn_abi_va_list) (tree);
-
- /* Get the __builtin_va_list type dependent on input type. */
- tree (* canonical_va_list_type) (tree);
-
- /* Expand the __builtin_va_start builtin. */
- void (* expand_builtin_va_start) (tree valist, rtx nextarg);
-
- /* Gimplifies a VA_ARG_EXPR. */
- tree (* gimplify_va_arg_expr) (tree valist, tree type, gimple_seq *pre_p,
- gimple_seq *post_p);
-
- /* Validity-checking routines for PCH files, target-specific.
- get_pch_validity returns a pointer to the data to be stored,
- and stores the size in its argument. pch_valid_p gets the same
- information back and returns NULL if the PCH is valid,
- or an error message if not.
- */
- void * (* get_pch_validity) (size_t *);
- const char * (* pch_valid_p) (const void *, size_t);
-
- /* If nonnull, this function checks whether a PCH file with the
- given set of target flags can be used. It returns NULL if so,
- otherwise it returns an error message. */
- const char *(*check_pch_target_flags) (int);
-
- /* True if the compiler should give an enum type only as many
- bytes as it takes to represent the range of possible values of
- that type. */
- bool (* default_short_enums) (void);
-
- /* This target hook returns an rtx that is used to store the address
- of the current frame into the built-in setjmp buffer. */
- rtx (* builtin_setjmp_frame_value) (void);
-
- /* This target hook should add STRING_CST trees for any hard regs
- the port wishes to automatically clobber for an asm. */
- tree (* md_asm_clobbers) (tree, tree, tree);
-
- /* This target hook allows the backend to specify a calling convention
- in the debug information. This function actually returns an
- enum dwarf_calling_convention, but because of forward declarations
- and not wanting to include dwarf2.h everywhere target.h is included
- the function is being declared as an int. */
- int (* dwarf_calling_convention) (const_tree);
-
- /* This target hook allows the backend to emit frame-related insns that
- contain UNSPECs or UNSPEC_VOLATILEs. The call frame debugging info
- engine will invoke it on insns of the form
- (set (reg) (unspec [...] UNSPEC_INDEX))
- and
- (set (reg) (unspec_volatile [...] UNSPECV_INDEX))
- to let the backend emit the call frame instructions. */
- void (* dwarf_handle_frame_unspec) (const char *, rtx, int);
-
- /* Perform architecture specific checking of statements gimplified
- from VA_ARG_EXPR. STMT is the statement. Returns true if the statement
- doesn't need to be checked for va_list references. */
- bool (* stdarg_optimize_hook) (struct stdarg_info *ai, const_gimple stmt);
-
- /* This target hook allows the operating system to override the DECL
- that represents the external variable that contains the stack
- protection guard variable. The type of this DECL is ptr_type_node. */
- tree (* stack_protect_guard) (void);
-
- /* This target hook allows the operating system to override the CALL_EXPR
- that is invoked when a check vs the guard variable fails. */
- tree (* stack_protect_fail) (void);
-
- /* Returns NULL if target supports the insn within a doloop block,
- otherwise it returns an error message. */
- const char * (*invalid_within_doloop) (const_rtx);
-
- /* DECL is a variable or function with __attribute__((dllimport))
- specified. Use this hook if the target needs to add extra validation
- checks to handle_dll_attribute (). */
- bool (* valid_dllimport_attribute_p) (const_tree decl);
-
- /* If non-zero, align constant anchors in CSE to a multiple of this
- value. */
- unsigned HOST_WIDE_INT const_anchor;
-
- /* Functions relating to calls - argument passing, returns, etc. */
- struct calls {
- enum machine_mode (*promote_function_mode) (const_tree type,
- enum machine_mode mode,
- int *punsignedp,
- const_tree fntype,
- int for_return);
- bool (*promote_prototypes) (const_tree fntype);
- rtx (*struct_value_rtx) (tree fndecl, int incoming);
- bool (*return_in_memory) (const_tree type, const_tree fndecl);
- bool (*return_in_msb) (const_tree type);
-
- /* Return true if a parameter must be passed by reference. TYPE may
- be null if this is a libcall. CA may be null if this query is
- from __builtin_va_arg. */
- bool (*pass_by_reference) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
- const_tree type, bool named_arg);
-
- rtx (*expand_builtin_saveregs) (void);
- /* Returns pretend_argument_size. */
- void (*setup_incoming_varargs) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
- tree type, int *pretend_arg_size,
- int second_time);
- bool (*strict_argument_naming) (CUMULATIVE_ARGS *ca);
- /* Returns true if we should use
- targetm.calls.setup_incoming_varargs() and/or
- targetm.calls.strict_argument_naming(). */
- bool (*pretend_outgoing_varargs_named) (CUMULATIVE_ARGS *ca);
-
- /* Given a complex type T, return true if a parameter of type T
- should be passed as two scalars. */
- bool (* split_complex_arg) (const_tree type);
-
- /* Return true if type T, mode MODE, may not be passed in registers,
- but must be passed on the stack. */
- /* ??? This predicate should be applied strictly after pass-by-reference.
- Need audit to verify that this is the case. */
- bool (* must_pass_in_stack) (enum machine_mode mode, const_tree t);
-
- /* Return true if type TYPE, mode MODE, which is passed by reference,
- should have the object copy generated by the callee rather than
- the caller. It is never called for TYPE requiring constructors. */
- bool (* callee_copies) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
- const_tree type, bool named);
-
- /* Return zero for arguments passed entirely on the stack or entirely
- in registers. If passed in both, return the number of bytes passed
- in registers; the balance is therefore passed on the stack. */
- int (* arg_partial_bytes) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
- tree type, bool named);
-
- /* Return the diagnostic message string if function without a prototype
- is not allowed for this 'val' argument; NULL otherwise. */
- const char *(*invalid_arg_for_unprototyped_fn) (const_tree typelist,
- const_tree funcdecl,
- const_tree val);
-
- /* Return an rtx for the return value location of the function
- specified by FN_DECL_OR_TYPE with a return type of RET_TYPE. */
- rtx (*function_value) (const_tree ret_type, const_tree fn_decl_or_type,
- bool outgoing);
-
- /* Return the rtx for the result of a libcall of mode MODE,
- calling the function FN_NAME. */
- rtx (*libcall_value) (enum machine_mode, const_rtx);
-
- /* Return true if REGNO is a possible register number for
- a function value as seen by the caller. */
- bool (*function_value_regno_p) (const unsigned int);
-
- /* Return an rtx for the argument pointer incoming to the
- current function. */
- rtx (*internal_arg_pointer) (void);
-
- /* Update the current function stack boundary if needed. */
- void (*update_stack_boundary) (void);
-
- /* Handle stack alignment and return an rtx for Dynamic Realign
- Argument Pointer if necessary. */
- rtx (*get_drap_rtx) (void);
-
- /* Return true if all function parameters should be spilled to the
- stack. */
- bool (*allocate_stack_slots_for_args) (void);
-
- /* Return an rtx for the static chain for FNDECL. If INCOMING_P is true,
- then it should be for the callee; otherwise for the caller. */
- rtx (*static_chain) (const_tree fndecl, bool incoming_p);
-
- /* Fill in the trampoline at MEM with a call to FNDECL and a
- static chain value of CHAIN. */
- void (*trampoline_init) (rtx mem, tree fndecl, rtx chain);
-
- /* Adjust the address of the trampoline in a target-specific way. */
- rtx (*trampoline_adjust_address) (rtx addr);
- } calls;
-
- /* Return the diagnostic message string if conversion from FROMTYPE
- to TOTYPE is not allowed, NULL otherwise. */
- const char *(*invalid_conversion) (const_tree fromtype, const_tree totype);
-
- /* Return the diagnostic message string if the unary operation OP is
- not permitted on TYPE, NULL otherwise. */
- const char *(*invalid_unary_op) (int op, const_tree type);
-
- /* Return the diagnostic message string if the binary operation OP
- is not permitted on TYPE1 and TYPE2, NULL otherwise. */
- const char *(*invalid_binary_op) (int op, const_tree type1, const_tree type2);
-
- /* Return the diagnostic message string if TYPE is not valid as a
- function parameter type, NULL otherwise. */
- const char *(*invalid_parameter_type) (const_tree type);
-
- /* Return the diagnostic message string if TYPE is not valid as a
- function return type, NULL otherwise. */
- const char *(*invalid_return_type) (const_tree type);
-
- /* If values of TYPE are promoted to some other type when used in
- expressions (analogous to the integer promotions), return that type,
- or NULL_TREE otherwise. */
- tree (*promoted_type) (const_tree type);
-
- /* Convert EXPR to TYPE, if target-specific types with special conversion
- rules are involved. Return the converted expression, or NULL to apply
- the standard conversion rules. */
- tree (*convert_to_type) (tree type, tree expr);
-
- /* Return the array of IRA cover classes for the current target. */
- const enum reg_class *(*ira_cover_classes) (void);
-
- /* Return the class for a secondary reload, and fill in extra information. */
- enum reg_class (*secondary_reload) (bool, rtx, enum reg_class,
- enum machine_mode,
- secondary_reload_info *);
-
- /* This target hook allows the backend to perform additional
- processing while initializing for variable expansion. */
- void (* expand_to_rtl_hook) (void);
-
- /* This target hook allows the backend to perform additional
- instantiations on rtx that are not actually in insns yet,
- but will be later. */
- void (* instantiate_decls) (void);
-
- /* Return true if is OK to use a hard register REGNO as scratch register
- in peephole2. */
- bool (* hard_regno_scratch_ok) (unsigned int regno);
-
- /* Return the smallest number of different values for which it is best to
- use a jump-table instead of a tree of conditional branches. */
- unsigned int (* case_values_threshold) (void);
-
- /* Retutn true if a function must have and use a frame pointer. */
- bool (* frame_pointer_required) (void);
-
- /* Returns true if the compiler is allowed to try to replace register number
- from-reg with register number to-reg. */
- bool (* can_eliminate) (const int, const int);
-
- /* Functions specific to the C family of frontends. */
- struct c {
- /* Return machine mode for non-standard suffix
- or VOIDmode if non-standard suffixes are unsupported. */
- enum machine_mode (*mode_for_suffix) (char);
- } c;
-
- /* Functions specific to the C++ frontend. */
- struct cxx {
- /* Return the integer type used for guard variables. */
- tree (*guard_type) (void);
- /* Return true if only the low bit of the guard should be tested. */
- bool (*guard_mask_bit) (void);
- /* Returns the size of the array cookie for an array of type. */
- tree (*get_cookie_size) (tree);
- /* Returns true if the element size should be stored in the
- array cookie. */
- bool (*cookie_has_size) (void);
- /* Allows backends to perform additional processing when
- deciding if a class should be exported or imported. */
- int (*import_export_class) (tree, int);
- /* Returns true if constructors and destructors return "this". */
- bool (*cdtor_returns_this) (void);
- /* Returns true if the key method for a class can be an inline
- function, so long as it is not declared inline in the class
- itself. Returning true is the behavior required by the Itanium
- C++ ABI. */
- bool (*key_method_may_be_inline) (void);
- /* DECL is a virtual table, virtual table table, typeinfo object,
- or other similar implicit class data object that will be
- emitted with external linkage in this translation unit. No ELF
- visibility has been explicitly specified. If the target needs
- to specify a visibility other than that of the containing class,
- use this hook to set DECL_VISIBILITY and
- DECL_VISIBILITY_SPECIFIED. */
- void (*determine_class_data_visibility) (tree decl);
- /* Returns true (the default) if virtual tables and other
- similar implicit class data objects are always COMDAT if they
- have external linkage. If this hook returns false, then
- class data for classes whose virtual table will be emitted in
- only one translation unit will not be COMDAT. */
- bool (*class_data_always_comdat) (void);
- /* Returns true (the default) if the RTTI for the basic types,
- which is always defined in the C++ runtime, should be COMDAT;
- false if it should not be COMDAT. */
- bool (*library_rtti_comdat) (void);
- /* Returns true if __aeabi_atexit should be used to register static
- destructors. */
- bool (*use_aeabi_atexit) (void);
- /* Returns true if target may use atexit in the same manner as
- __cxa_atexit to register static destructors. */
- bool (*use_atexit_for_cxa_atexit) (void);
- /* TYPE is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that
- has just been defined. Use this hook to make adjustments to the
- class (eg, tweak visibility or perform any other required
- target modifications). */
- void (*adjust_class_at_definition) (tree type);
- } cxx;
-
- /* Functions and data for emulated TLS support. */
- struct emutls {
- /* Name of the address and common functions. */
- const char *get_address;
- const char *register_common;
-
- /* Prefixes for proxy variable and template. */
- const char *var_section;
- const char *tmpl_section;
-
- /* Prefixes for proxy variable and template. */
- const char *var_prefix;
- const char *tmpl_prefix;
-
- /* Function to generate field definitions of the proxy variable. */
- tree (*var_fields) (tree, tree *);
-
- /* Function to initialize a proxy variable. */
- tree (*var_init) (tree, tree, tree);
-
- /* Whether we are allowed to alter the usual alignment of the
- proxy variable. */
- bool var_align_fixed;
-
- /* Whether we can emit debug information for TLS vars. */
- bool debug_form_tls_address;
- } emutls;
-
- struct target_option_hooks {
- /* Function to validate the attribute((option(...))) strings or NULL. If
- the option is validated, it is assumed that DECL_FUNCTION_SPECIFIC will
- be filled in in the function decl node. */
- bool (*valid_attribute_p) (tree, tree, tree, int);
-
- /* Function to save any extra target state in the target options
- structure. */
- void (*save) (struct cl_target_option *);
-
- /* Function to restore any extra target state from the target options
- structure. */
- void (*restore) (struct cl_target_option *);
-
- /* Function to print any extra target state from the target options
- structure. */
- void (*print) (FILE *, int, struct cl_target_option *);
-
- /* Function to parse arguments to be validated for #pragma option, and to
- change the state if the options are valid. If the first argument is
- NULL, the second argument specifies the default options to use. Return
- true if the options are valid, and set the current state. */
- bool (*pragma_parse) (tree, tree);
-
- /* Function to determine if one function can inline another function. */
- bool (*can_inline_p) (tree, tree);
- } target_option;
-
- /* For targets that need to mark extra registers as live on entry to
- the function, they should define this target hook and set their
- bits in the bitmap passed in. */
- void (*live_on_entry) (bitmap);
-
- /* True if unwinding tables should be generated by default. */
- bool unwind_tables_default;
-
- /* Leave the boolean fields at the end. */
-
- /* True if arbitrary sections are supported. */
- bool have_named_sections;
-
- /* True if we can create zeroed data by switching to a BSS section
- and then using ASM_OUTPUT_SKIP to allocate the space. */
- bool have_switchable_bss_sections;
-
- /* True if "native" constructors and destructors are supported,
- false if we're using collect2 for the job. */
- bool have_ctors_dtors;
-
- /* True if thread-local storage is supported. */
- bool have_tls;
-
- /* True if a small readonly data section is supported. */
- bool have_srodata_section;
-
- /* True if EH frame info sections should be zero-terminated. */
- bool terminate_dw2_eh_frame_info;
-
- /* True if #NO_APP should be emitted at the beginning of
- assembly output. */
- bool file_start_app_off;
-
- /* True if output_file_directive should be called for main_input_filename
- at the beginning of assembly output. */
- bool file_start_file_directive;
-
- /* True if #pragma extern_prefix is to be supported. */
- bool handle_pragma_extern_prefix;
+ scalar_stmt,
+ scalar_load,
+ scalar_store,
+ vector_stmt,
+ vector_load,
+ unaligned_load,
+ vector_store,
+ vec_to_scalar,
+ scalar_to_vec,
+ cond_branch_not_taken,
+ cond_branch_taken,
+ vec_perm
+};
- /* True if the target is allowed to reorder memory accesses unless
- synchronization is explicitly requested. */
- bool relaxed_ordering;
+/* The target structure. This holds all the backend hooks. */
+#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME;
+#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS;
+#define DEFHOOK_UNDOC DEFHOOK
+#define HOOKSTRUCT(FRAGMENT) FRAGMENT
- /* Returns true if we should generate exception tables for use with the
- ARM EABI. The effects the encoding of function exception specifications.
- */
- bool arm_eabi_unwinder;
-
- /* Leave the boolean fields at the end. */
-};
+#include "target.def"
extern struct gcc_target targetm;
-struct gcc_targetcm {
- /* Handle target switch CODE (an OPT_* value). ARG is the argument
- passed to the switch; it is NULL if no argument was. VALUE is the
- value of ARG if CODE specifies a UInteger option, otherwise it is
- 1 if the positive form of the switch was used and 0 if the negative
- form was. Return true if the switch was valid. */
- bool (*handle_c_option) (size_t code, const char *arg, int value);
-};
-
/* Each target can provide their own. */
extern struct gcc_targetcm targetcm;
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index da840190a2b..9271db829bf 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -325,6 +325,46 @@ default_unwind_emit (FILE * stream ATTRIBUTE_UNUSED,
gcc_unreachable ();
}
+/* Emit to STREAM the assembler syntax for insn operand X. */
+
+void
+default_print_operand (FILE *stream ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
+ int code ATTRIBUTE_UNUSED)
+{
+#ifdef PRINT_OPERAND
+ PRINT_OPERAND (stream, x, code);
+#else
+ gcc_unreachable ();
+#endif
+}
+
+/* Emit to STREAM the assembler syntax for an insn operand whose memory
+ address is X. */
+
+void
+default_print_operand_address (FILE *stream ATTRIBUTE_UNUSED,
+ rtx x ATTRIBUTE_UNUSED)
+{
+#ifdef PRINT_OPERAND_ADDRESS
+ PRINT_OPERAND_ADDRESS (stream, x);
+#else
+ gcc_unreachable ();
+#endif
+}
+
+/* Return true if CODE is a valid punctuation character for the
+ `print_operand' hook. */
+
+bool
+default_print_operand_punct_valid_p (unsigned char code ATTRIBUTE_UNUSED)
+{
+#ifdef PRINT_OPERAND_PUNCT_VALID_P
+ return PRINT_OPERAND_PUNCT_VALID_P (code);
+#else
+ return false;
+#endif
+}
+
/* True if MODE is valid for the target. By "valid", we mean able to
be manipulated in non-trivial ways. In particular, this means all
the arithmetic is supported.
@@ -436,6 +476,36 @@ default_builtin_vectorized_conversion (unsigned int code ATTRIBUTE_UNUSED,
return NULL_TREE;
}
+/* Default vectorizer cost model values. */
+
+int
+default_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost)
+{
+ switch (type_of_cost)
+ {
+ case scalar_stmt:
+ case scalar_load:
+ case scalar_store:
+ case vector_stmt:
+ case vector_load:
+ case vector_store:
+ case vec_to_scalar:
+ case scalar_to_vec:
+ case cond_branch_not_taken:
+ case vec_perm:
+ return 1;
+
+ case unaligned_load:
+ return 2;
+
+ case cond_branch_taken:
+ return 3;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Reciprocal. */
tree
@@ -474,6 +544,49 @@ hook_int_CUMULATIVE_ARGS_mode_tree_bool_0 (
}
void
+default_function_arg_advance (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED,
+ bool named ATTRIBUTE_UNUSED)
+{
+#ifdef FUNCTION_ARG_ADVANCE
+ CUMULATIVE_ARGS args = *ca;
+ FUNCTION_ARG_ADVANCE (args, mode, CONST_CAST_TREE (type), named);
+ *ca = args;
+#else
+ gcc_unreachable ();
+#endif
+}
+
+rtx
+default_function_arg (const CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED,
+ bool named ATTRIBUTE_UNUSED)
+{
+#ifdef FUNCTION_ARG
+ return FUNCTION_ARG (*(CONST_CAST (CUMULATIVE_ARGS *, ca)), mode,
+ CONST_CAST_TREE (type), named);
+#else
+ gcc_unreachable ();
+#endif
+}
+
+rtx
+default_function_incoming_arg (const CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED,
+ bool named ATTRIBUTE_UNUSED)
+{
+#ifdef FUNCTION_INCOMING_ARG
+ return FUNCTION_INCOMING_ARG (*(CONST_CAST (CUMULATIVE_ARGS *, ca)), mode,
+ CONST_CAST_TREE (type), named);
+#else
+ gcc_unreachable ();
+#endif
+}
+
+void
hook_void_bitmap (bitmap regs ATTRIBUTE_UNUSED)
{
}
@@ -603,11 +716,6 @@ default_function_value (const_tree ret_type ATTRIBUTE_UNUSED,
&& !DECL_P (fn_decl_or_type))
fn_decl_or_type = NULL;
-#ifdef FUNCTION_OUTGOING_VALUE
- if (outgoing)
- return FUNCTION_OUTGOING_VALUE (ret_type, fn_decl_or_type);
-#endif
-
#ifdef FUNCTION_VALUE
return FUNCTION_VALUE (ret_type, fn_decl_or_type);
#else
@@ -691,28 +799,37 @@ default_trampoline_init (rtx ARG_UNUSED (m_tramp), tree ARG_UNUSED (t_func),
sorry ("nested function trampolines not supported on this target");
}
-enum reg_class
+int
+default_return_pops_args (tree fundecl ATTRIBUTE_UNUSED,
+ tree funtype ATTRIBUTE_UNUSED,
+ int size ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+reg_class_t
default_branch_target_register_class (void)
{
return NO_REGS;
}
#ifdef IRA_COVER_CLASSES
-const enum reg_class *
+const reg_class_t *
default_ira_cover_classes (void)
{
- static enum reg_class classes[] = IRA_COVER_CLASSES;
+ static reg_class_t classes[] = IRA_COVER_CLASSES;
return classes;
}
#endif
-enum reg_class
+reg_class_t
default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
- enum reg_class reload_class ATTRIBUTE_UNUSED,
+ reg_class_t reload_class_i ATTRIBUTE_UNUSED,
enum machine_mode reload_mode ATTRIBUTE_UNUSED,
secondary_reload_info *sri)
{
enum reg_class rclass = NO_REGS;
+ enum reg_class reload_class = (enum reg_class) reload_class_i;
if (sri->prev_sri && sri->prev_sri->t_icode != CODE_FOR_nothing)
{
@@ -794,6 +911,14 @@ default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
return rclass;
}
+void
+default_target_option_override (void)
+{
+#ifdef OVERRIDE_OPTIONS
+ OVERRIDE_OPTIONS;
+#endif
+}
+
bool
default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
const char *arg ATTRIBUTE_UNUSED,
@@ -1048,4 +1173,33 @@ default_have_conditional_execution (void)
#endif
}
+/* Compute cost of moving registers to/from memory. */
+
+int
+default_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+ reg_class_t rclass ATTRIBUTE_UNUSED,
+ bool in ATTRIBUTE_UNUSED)
+{
+#ifndef MEMORY_MOVE_COST
+ return (4 + memory_move_secondary_cost (mode, (enum reg_class) rclass, in));
+#else
+ return MEMORY_MOVE_COST (mode, (enum reg_class) rclass, in);
+#endif
+}
+
+/* Compute cost of moving data from a register of class FROM to one of
+ TO, using MODE. */
+
+int
+default_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+ reg_class_t from ATTRIBUTE_UNUSED,
+ reg_class_t to ATTRIBUTE_UNUSED)
+{
+#ifndef REGISTER_MOVE_COST
+ return 2;
+#else
+ return REGISTER_MOVE_COST (mode, (enum reg_class) from, (enum reg_class) to);
+#endif
+}
+
#include "gt-targhooks.h"
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index be167e5e0db..f491dbd4d29 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -63,6 +63,9 @@ extern bool hook_callee_copies_named
(CUMULATIVE_ARGS *ca, enum machine_mode, const_tree, bool);
extern void default_unwind_emit (FILE *, rtx);
+extern void default_print_operand (FILE *, rtx, int);
+extern void default_print_operand_address (FILE *, rtx);
+extern bool default_print_operand_punct_valid_p (unsigned char);
extern bool default_scalar_mode_supported_p (enum machine_mode);
extern bool default_decimal_float_supported_p (void);
@@ -74,6 +77,8 @@ extern tree default_builtin_vectorized_function (tree, tree, tree);
extern tree default_builtin_vectorized_conversion (unsigned int, tree, tree);
+extern int default_builtin_vectorization_cost (enum vect_cost_for_stmt);
+
extern tree default_builtin_reciprocal (unsigned int, bool, bool);
extern bool default_builtin_vector_alignment_reachable (const_tree, bool);
@@ -96,6 +101,12 @@ extern int hook_int_CUMULATIVE_ARGS_mode_tree_bool_0
(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
extern const char *hook_invalid_arg_for_unprototyped_fn
(const_tree, const_tree, const_tree);
+extern void default_function_arg_advance
+ (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
+extern rtx default_function_arg
+ (const CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
+extern rtx default_function_incoming_arg
+ (const CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
extern rtx default_function_value (const_tree, const_tree, bool);
extern rtx default_libcall_value (enum machine_mode, const_rtx);
@@ -103,13 +114,15 @@ extern bool default_function_value_regno_p (const unsigned int);
extern rtx default_internal_arg_pointer (void);
extern rtx default_static_chain (const_tree, bool);
extern void default_trampoline_init (rtx, tree, rtx);
-extern enum reg_class default_branch_target_register_class (void);
+extern int default_return_pops_args (tree, tree, int);
+extern reg_class_t default_branch_target_register_class (void);
#ifdef IRA_COVER_CLASSES
-extern const enum reg_class *default_ira_cover_classes (void);
+extern const reg_class_t *default_ira_cover_classes (void);
#endif
-extern enum reg_class default_secondary_reload (bool, rtx, enum reg_class,
- enum machine_mode,
- secondary_reload_info *);
+extern reg_class_t default_secondary_reload (bool, rtx, reg_class_t,
+ enum machine_mode,
+ secondary_reload_info *);
+extern void default_target_option_override (void);
extern void hook_void_bitmap (bitmap);
extern bool default_handle_c_option (size_t, const char *, int);
extern int default_reloc_rw_mask (void);
@@ -134,3 +147,7 @@ extern bool default_addr_space_subset_p (addr_space_t, addr_space_t);
extern rtx default_addr_space_convert (rtx, tree, tree);
extern unsigned int default_case_values_threshold (void);
extern bool default_have_conditional_execution (void);
+extern int default_memory_move_cost (enum machine_mode, reg_class_t, bool);
+extern int default_register_move_cost (enum machine_mode, reg_class_t,
+ reg_class_t);
+
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4f97f01350f..9c91245d613 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,1077 @@
+2010-06-30 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/nullptr04.C: Use __INTPTR_TYPE__.
+ * g++.dg/other/pr25632.C: Likewise.
+
+2010-07-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/40421
+ * gfortran.fortran-torture/compile/pr40421.f90: New test.
+
+2010-07-01 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/42834
+ PR middle-end/44468
+ * gcc.c-torture/execute/20100316-1.c: New testcase.
+ * gcc.c-torture/execute/pr44468.c: Likewise.
+ * gcc.c-torture/compile/20100609-1.c: Likewise.
+ * gcc.dg/volatile2.c: Adjust.
+ * gcc.dg/plugin/selfassign.c: Likewise.
+ * gcc.dg/pr36902.c: Likewise.
+ * gcc.dg/tree-ssa/foldaddr-2.c: Remove.
+ * gcc.dg/tree-ssa/foldaddr-3.c: Likewise.
+ * gcc.dg/tree-ssa/forwprop-8.c: Adjust.
+ * gcc.dg/tree-ssa/pr17141-1.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise.
+ * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise.
+ * gcc.dg/tree-ssa/20030807-7.c: Likewise.
+ * gcc.dg/tree-ssa/forwprop-10.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise.
+ * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise.
+ * gcc.dg/tree-ssa/forwprop-1.c: Likewise.
+ * gcc.dg/tree-ssa/forwprop-2.c: Likewise.
+ * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise.
+ * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise.
+ * gcc.dg/tree-ssa/forwprop-5.c: Likewise.
+ * gcc.dg/struct/w_prof_two_strs.c: XFAIL.
+ * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise.
+ * gcc.dg/struct/wo_prof_global_var.c: Likewise.
+ * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise.
+ * gcc.dg/struct/w_prof_local_array.c: Likewise.
+ * gcc.dg/struct/w_prof_single_str_global.c: Likewise.
+ * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise.
+ * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise.
+ * gcc.dg/struct/w_prof_global_array.c: Likewise.
+ * gcc.dg/struct/wo_prof_array_field.c: Likewise.
+ * gcc.dg/struct/wo_prof_single_str_local.c: Likewise.
+ * gcc.dg/struct/w_prof_local_var.c: Likewise.
+ * gcc.dg/struct/wo_prof_two_strs.c: Likewise.
+ * gcc.dg/struct/wo_prof_empty_str.c: Likewise.
+ * gcc.dg/struct/wo_prof_local_array.c: Likewise.
+ * gcc.dg/struct/w_prof_global_var.c: Likewise.
+ * gcc.dg/struct/wo_prof_single_str_global.c: Likewise.
+ * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise.
+ * gcc.dg/struct/wo_prof_global_array.c: Likewise.
+ * gcc.dg/struct/wo_prof_escape_return.c: Likewise.
+ * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise.
+ * gcc.dg/struct/wo_prof_double_malloc.c: Likewise.
+ * gcc.dg/struct/w_ratio_cold_str.c: Likewise.
+ * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise.
+ * gcc.dg/struct/wo_prof_local_var.c: Likewise.
+ * gcc.dg/tree-prof/stringop-1.c: Adjust.
+ * g++.dg/tree-ssa/pr31146.C: Likewise.
+ * g++.dg/tree-ssa/copyprop-1.C: Likewise.
+ * g++.dg/tree-ssa/pr33604.C: Likewise.
+ * g++.dg/plugin/selfassign.c: Likewise.
+ * gfortran.dg/array_memcpy_3.f90: Likewise.
+ * gfortran.dg/array_memcpy_4.f90: Likewise.
+ * c-c++-common/torture/pr42834.c: New testcase.
+
+2010-06-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44628
+ * g++.dg/template/crash100.C: New.
+
+2010-06-30 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/ipa-split-4.c: New testcase.
+
+2010-06-30 Michael Matz <matz@suse.de>
+
+ PR bootstrap/44699
+ * gcc.dg/pr44699.c: New test.
+
+2010-06-30 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR tree-optimization/39799
+ * c-c++-common/uninit-17.c: New test.
+
+2010-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/43298
+ * gfortran.dg/read_infnan_1.f90: New test.
+
+2010-06-29 Jason Merrill <jason@redhat.com>
+
+ Enable implicitly declared move constructor/operator= (N3053).
+ * g++.dg/cpp0x/implicit3.C: New.
+ * g++.dg/cpp0x/implicit4.C: New.
+ * g++.dg/cpp0x/implicit5.C: New.
+ * g++.dg/cpp0x/implicit-copy.C: Adjust.
+ * g++.dg/cpp0x/not_special.C: Adjust.
+ * g++.dg/cpp0x/rv-trivial-bug.C: Adjust.
+ * g++.dg/cpp0x/rv1n.C: Adjust.
+ * g++.dg/cpp0x/rv1p.C: Adjust.
+ * g++.dg/cpp0x/rv2n.C: Adjust.
+ * g++.dg/cpp0x/rv2p.C: Adjust.
+ * g++.dg/cpp0x/rv3n.C: Adjust.
+ * g++.dg/cpp0x/rv3p.C: Adjust.
+ * g++.dg/cpp0x/rv4n.C: Adjust.
+ * g++.dg/cpp0x/rv4p.C: Adjust.
+ * g++.dg/cpp0x/rv5n.C: Adjust.
+ * g++.dg/cpp0x/rv5p.C: Adjust.
+ * g++.dg/cpp0x/rv6n.C: Adjust.
+ * g++.dg/cpp0x/rv6p.C: Adjust.
+ * g++.dg/cpp0x/rv7n.C: Adjust.
+ * g++.dg/cpp0x/rv7p.C: Adjust.
+ * g++.dg/cpp0x/rv8p.C: Adjust.
+ * g++.dg/gomp/pr26690-1.C: Adjust.
+ * g++.dg/other/error20.C: Adjust.
+ * g++.dg/other/error31.C: Adjust.
+ * g++.dg/parse/error19.C: Adjust.
+ * g++.dg/template/qualttp5.C: Adjust.
+ * g++.old-deja/g++.law/ctors5.C: Adjust.
+
+ Enable implicitly deleted functions (N2346)
+ * g++.dg/cpp0x/defaulted17.C: New.
+ * g++.dg/cpp0x/implicit1.C: New.
+ * g++.dg/cpp0x/implicit2.C: New.
+ * g++.dg/cpp0x/lambda/lambda-ctor-neg.C: Adjust.
+ * g++.dg/ext/has_virtual_destructor.C: Adjust.
+ * g++.dg/init/ctor4.C: Adjust.
+ * g++.dg/init/synth2.C: Adjust.
+ * g++.dg/lto/20081118_1.C: Adjust.
+ * g++.dg/other/error13.C: Adjust.
+ * g++.dg/other/unused1.C: Adjust.
+ * g++.old-deja/g++.bob/inherit2.C: Adjust.
+ * g++.old-deja/g++.bugs/900205_04.C: Adjust.
+ * g++.old-deja/g++.jason/opeq3.C: Adjust.
+ * g++.old-deja/g++.law/ctors17.C: Adjust.
+ * g++.old-deja/g++.oliva/delete1.C: Adjust.
+ * g++.old-deja/g++.pt/assign1.C: Adjust.
+ * g++.old-deja/g++.pt/crash20.C: Adjust.
+
+ * g++.dg/cpp0x/defaulted10.C: Adjust for new deleted message.
+ * g++.dg/cpp0x/defaulted13.C: Adjust.
+ * g++.dg/cpp0x/defaulted2.C: Adjust.
+ * g++.dg/cpp0x/defaulted3.C: Adjust.
+ * g++.dg/cpp0x/initlist9.C: Adjust.
+ * g++.dg/cpp0x/lambda/lambda-errloc.C: Adjust.
+ * g++.dg/cpp0x/lambda/lambda-errloc2.C: Adjust.
+ * g++.dg/init/synth2.C: Adjust.
+
+ * g++.dg/cpp0x/defaulted19.C: New.
+
+ * g++.dg/expr/string-1.C: Fix for -std=c++0x.
+ * g++.dg/template/error23.C: Fix for -std=c++0x.
+
+2010-06-29 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44718
+ * gfortran.dg/proc_ptr_28.f90: New.
+
+2010-06-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/43801
+ * g++.dg/torture/pr43801.C: New test.
+
+ PR debug/44668
+ * g++.dg/debug/dwarf2/accessibility1.C: New test.
+
+2010-06-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/44587
+ * g++.dg/template/qualified-id2.C: New.
+ * g++.dg/template/qualified-id3.C: New.
+
+2010-06-29 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44696
+ * gfortran.dg/associated_target_4.f90: New.
+
+2010-06-29 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/44582
+ * gfortran.dg/aliasing_array_result_1.f90 : New test.
+
+2010-06-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * lib/lto.exp (lto_prune_warns): Also accept leading single quote.
+
+2010-06-29 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/ipa-split-3.c: New testcase.
+
+2010-06-29 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR target/43902
+ * gcc.target/arm/wmul-1.c: Test for smlabb instead of smulbb.
+ * gcc.target/arm/wmul-3.c: New test.
+ * gcc.target/arm/wmul-4.c: New test.
+
+2010-06-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR rtl-optimization/44659
+ * gcc.target/i386/extract-1.c: New.
+ * gcc.target/i386/extract-2.c: Likewise.
+ * gcc.target/i386/extract-3.c: Likewise.
+ * gcc.target/i386/extract-4.c: Likewise.
+ * gcc.target/i386/extract-5.c: Likewise.
+ * gcc.target/i386/extract-6.c: Likewise.
+
+2010-06-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44682
+ * g++.dg/warn/Wunused-var-14.C: New test.
+
+2010-06-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/43298
+ * gfortran.dg/nan_6.f90: New.
+
+2010-06-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR tree-optimization/43781
+ * gcc.dg/torture/pr43781.c: New.
+
+2010-06-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40158
+ * gfortran.dg/actual_rank_check_1.f90: New test.
+
+2010-06-28 Martin Jambor <mjambor@suse.cz>
+
+ * testsuite/gcc.dg/ipa/ipa-sra-6.c: New test.
+
+2010-06-28 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimization/44687
+ * gcc.c-torture/compile/pr44687.c
+
+2010-06-28 Martin Jambor <mjambor@suse.cz>
+
+ PR c++/44535
+ * g++.dg/torture/pr44535.C: New test.
+
+2010-06-28 Michael Matz <matz@suse.de>
+
+ PR middle-end/44592
+ * gfortran.dg/pr44592.f90: New test.
+
+2010-06-28 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimization/44357
+ * g++.dg/torture/pr44357.C: New testcase.
+
+2010-06-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * gcc.dg/tree-ssa/ltrans-1.c: Add -march=i486 for i?86-*-* && ilp32.
+ * gcc.dg/tree-ssa/ltrans-3.c: Likewise.
+ * gcc.dg/tree-ssa/ltrans-4.c: Likewise.
+ * gcc.dg/tree-ssa/ltrans-5.c: Likewise.
+ * gcc.dg/tree-ssa/ltrans-6.c: Likewise.
+ * gcc.dg/tree-ssa/ltrans-8.c: Likewise.
+ * gcc.dg/tree-ssa/vrp47.c: Add -march=i586 for i?86-*-* && ilp32.
+ * gfortran.dg/ltrans-7.f90: Add -march=i486 for i?86-*-* && ilp32.
+
+2010-06-27 Jan Hubicka <jh@suse.cz>
+
+ * gcc.c-torture/compile/pr44686.c: New file.
+
+2010-06-27 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44683
+ * gcc.c-torture/execute/pr44683.c: New testcase.
+
+2010-06-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/noreturn3.ad[sb]: New test.
+
+2010-06-26 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/explicit5.C: New.
+
+2010-06-26 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44393
+ * gcc.dg/pr44393.c: New testcase.
+
+2010-06-26 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/ipa-split-2.c: New testcase.
+
+2010-06-26 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/44674
+ * gcc.dg/pr44674.c: New testcase.
+
+2010-06-26 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/opts-3.c: New test.
+
+2010-06-26 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/type_decl_1.f90: New.
+ * gfortran.dg/type_decl_2.f90: New.
+
+2010-06-26 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/semicolon_fixed.f: Fix dg syntax..
+ * gfortran.dg/semicolon_fixed_2.f: Ditto.
+
+2010-06-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR testsuite/38946
+ * gfortran.dg/array_constructor_23.f: Update test to allow for small
+ error in comparing reals.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * selected_real_kind_2.f90: New.
+ * selected_real_kind_3.f90: New.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/entry_19.f90: New.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/end_subroutine_1.f90: New.
+ * gfortran.dg/end_subroutine_2.f90: New.
+ * gfortran.dg/interface_proc_end.f90: Update.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/semicolon_fixed.f: Update.
+ * gfortran.dg/semicolon_fixed_2.f: New.
+ * gfortran.dg/semicolon_free_2.f90: New.
+ * gfortran.dg/semicolon_free.f90: Update.
+
+2010-06-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/44448
+ * gfortran.dg/atan2_1.f90: Add -ffloat-store.
+
+2010-06-25 Martin Jambor <mjambor@suse.cz>
+
+ * g++.dg/ipa/iinline-3.C: New test.
+ * gcc.dg/ipa/modif-1.c: Removed.
+
+2010-06-25 Jan Hubicka <jh@suse.cz>
+
+ * testsuite/gcc.dg/tree-ssa/ipa-split-1.c
+
+2010-06-25 Martin Jambor <mjambor@suse.cz>
+
+ * g++.dg/ipa/iinline-2.C: New test.
+
+2010-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/43866
+ * gfortran.dg/pr43866.f90: New test.
+
+ PR tree-optimization/44539
+ * gcc.dg/pr44539.c: New test.
+
+2010-06-25 Bernd Schmidt <bernds@codesourcery.com>
+
+ From Jim Wilson:
+ PR target/43902
+ * gcc.target/mips/madd-9.c: New test.
+
+2010-06-25 Shujing Zhao <pearly.zhao@oracle.com>
+
+ PR c/44517
+ * gcc.dg/noncompile/pr44517.c: New.
+ * gcc.dg/noncompile/990416-1.c: Adjust expected error.
+
+2010-06-24 Steve Ellcey <sje@cup.hp.com>
+
+ PR testsuite/43283
+ * gcc.dg/lto/20091216-1_0.c: Use newline instead of semicolon
+ and add argument to nop for IA64.
+
+2010-06-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44588
+ * gcc.target/i386/mod-1.c: New.
+ * gcc.target/i386/umod-1.c: Likewise.
+ * gcc.target/i386/umod-2.c: Likewise.
+ * gcc.target/i386/umod-3.c: Likewise.
+
+2010-06-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/44492
+ * g++.dg/torture/pr44492.C: New test.
+
+2010-06-24 Andi Kleen <ak@linux.intel.com>
+
+ * c-c++-common/warn-omitted-condop.c: New.
+
+2010-06-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/44614
+ * gfortran.dg/import8.f90: New.
+
+2010-06-23 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/not_null.adb: Update test case.
+
+2010-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44619
+ * g++.dg/warn/Wunused-var-13.C: New test.
+
+ PR c++/44627
+ * g++.dg/diagnostic/method1.C: New test.
+
+2010-06-22 Cary Coutant <ccoutant@google.com>
+
+ * g++.dg/debug/dwarf2/dwarf4-typedef.C: New test.
+
+2010-06-22 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44616
+ * gfortran.dg/abstract_type_8.f03: New.
+
+2010-06-21 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/noexcept08.C: New.
+
+ * g++.dg/ext/unary_trait_incomplete.C: Adjust.
+
+2010-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44615
+ * gcc.target/i386/sse2-vec-2a.c: New.
+
+2010-06-21 DJ Delorie <dj@redhat.com>
+
+ * gcc.dg/pragma-diag-1.c: New.
+
+2010-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44615
+ * gcc.target/i386/amd64-abi-3.c: Add -mtune=k8.
+
+2010-06-21 Alan Modra <amodra@gmail.com>
+
+ PR testsuite/44505
+ * gcc.c-torture/execute/frame-address.c (check_fa): Avoid
+ tail call to check_fa_mid.
+
+2010-06-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/44575
+ * gcc.c-torture/execute/pr44575.c: New test.
+
+2010-06-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40632
+ * gfortran.dg/contiguous_1.f90: New.
+ * gfortran.dg/contiguous_2.f90: New.
+ * gfortran.dg/contiguous_3.f90: New.
+
+2010-06-21 Kai Tietz <kai.tietz@onevision.com>
+
+ * gcc.target/x86_64/abi/callabi/leaf-1.c: New.
+ * gcc.target/x86_64/abi/callabi/leaf-2.c: New.
+
+2010-06-20 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/44546
+ * gcc.target/i386/pr44546.c: New test.
+
+2010-06-20 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/opts-2.c: New test.
+
+2010-06-19 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44584
+ * gfortran.dg/typebound_proc_15.f03: Modified.
+
+2010-06-19 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/44072
+ * gcc.target/arm/thumb2-cmpneg2add-1.c: New test.
+ * gcc.target/arm/thumb2-cmpneg2add-2.c: New test.
+
+2010-06-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * g++.dg/ext/label13.C: Fix typo in last change.
+
+2010-06-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/44477
+ * gfortran.dg/eof_3.f90
+ * gfortran.dg/endfile_2.f90
+ * gfortran.dg/endfile_4.f90
+ * gfortran.dg/endfile_3.f90
+
+2010-06-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR c++/41090
+ * g++.dg/ext/label13.C: xfail on 32-bit hppa*-*-hpux*.
+
+2010-06-18 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/44556
+ * gfortran.dg/allocate_alloc_opt_11.f90: New.
+
+2010-06-18 Bernd Schmidt <bernds@codesourcery.com>
+
+ * gcc.target/arm/pr40900.c: New test.
+
+2010-06-18 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/class_wide2.adb: Remove bogus message, no longer generated.
+
+2010-06-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44558
+ * gfortran.dg/typebound_call_15.f03: New.
+
+2010-06-17 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/44486
+ * g++.dg/pr44486.C: New.
+
+2010-06-16 DJ Delorie <dj@redhat.com>
+
+ * gcc.target/i386/volatile-bitfields-1.c: New.
+ * gcc.target/i386/volatile-bitfields-2.c: New.
+
+2010-06-16 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/noexcept03.C: Test -Wnoexcept.
+
+ * g++.dg/cpp0x/noexcept01.C: Test defaulted fns.
+
+2010-06-16 Richard Guenther <rguenther@suse.de>
+
+ PR c/44555
+ * gcc.c-torture/execute/pr44555.c: New testcase.
+
+2010-06-16 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44549
+ * gfortran.dg/typebound_proc_16.f03: New.
+
+2010-06-16 Martin Jambor <mjambor@suse.cz>
+
+ * g++.dg/torture/pr43905.C: New test.
+
+2010-06-16 Mikael Pettersson <mikpe@it.uu.se>
+
+ PR testsuite/44538
+ * gcc.dg/vect/slp-perm-5.c (main): Prevent
+ initialization loop from being vectorized.
+ * gcc.dg/vect/slp-perm-6.c (main): Likewise.
+
+2010-06-16 Alan Modra <amodra@gmail.com>
+
+ PR tree-optimization/44507
+ * gcc.dg/vect/pr44507.c (seeIf256ByteArrayIsConstant): Correct cast.
+
+2010-06-15 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/overload/arg3.C: Adjust error locations.
+ * g++.dg/overload/copy1.C: Likewise.
+ * g++.dg/tc1/dr152.C: Likewise.
+ * g++.dg/template/incomplete4.C: Likewise.
+ * g++.dg/template/incomplete5.C: Likewise.
+ * g++.old-deja/g++.bob/inherit2.C: Likewise.
+ * g++.old-deja/g++.pt/auto_ptr.C: Likewise.
+ * g++.old-deja/g++.pt/crash9.C: Likewise.
+
+ * g++.dg/inherit/virtual5.C: New.
+
+ * g++.dg/cpp0x/defaulted18.C: New.
+
+ * g++.dg/cpp0x/initlist40.C: New.
+
+ * g++.dg/cpp0x/initlist39.C: New.
+
+2010-06-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/44391
+ * gcc.dg/graphite/pr44391.c: New.
+
+2010-06-15 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/43388
+ * gfortran.dg/allocate_alloc_opt_8.f90: New.
+ * gfortran.dg/allocate_alloc_opt_9.f90: New.
+ * gfortran.dg/allocate_alloc_opt_10.f90: New.
+ * gfortran.dg/class_allocate_2.f03: Modified an error message.
+
+2010-06-15 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-sccvn-4.c: Adjust.
+
+2010-06-15 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-21.c: Adjust.
+ * gcc.dg/vect/bb-slp-13.c: Likewise
+ * gcc.dg/vect/bb-slp-4.c: Likewise
+ * gcc.dg/vect/bb-slp-22.c: Likewise
+ * gcc.dg/vect/bb-slp-14.c: Likewise
+ * gcc.dg/vect/bb-slp-23.c: Likewise
+ * gcc.dg/vect/bb-slp-15.c: Likewise
+ * gcc.dg/vect/bb-slp-17.c: Likewise
+ * gcc.dg/vect/bb-slp-18.c: Likewise
+ * gcc.dg/vect/bb-slp-19.c: Likewise
+ * gcc.dg/vect/bb-slp-10.c: Likewise
+ * gcc.dg/vect/bb-slp-11.c: Likewise
+ * gcc.dg/vect/bb-slp-20.c: Likewise
+ * gcc.dg/vect/bb-slp-3.c: Likewise
+
+2010-06-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/44536
+ * gfortran.dg/gomp/pr44536.f90: New test.
+ * gfortran.dg/gomp/sharing-3.f90: Remove xfail.
+
+2010-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44534
+ * gcc.target/i386/avx-vextractf128-256-3.c: New.
+ * gcc.target/i386/avx-vextractf128-256-4.c: Likewise.
+
+2010-06-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/44508
+ * gcc.dg/tree-ssa/pr21086.c: Adjust.
+
+ PR bootstrap/44509
+ * gcc.dg/pr44509.c: New test.
+
+2010-06-14 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/44507
+ * gcc.dg/vect/pr44507.c: New test.
+
+2010-06-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * g++.dg/plugin/header_plugin.c: Add "c-family/" to c-common.h
+ and c-pretty-print.h.
+
+ * g++.dg/plugin/pragma_plugin.c: Add "c-family/" to c-pragma.h.
+
+2010-06-13 Daniel Franke <franke.daniel@gmail.com>
+
+ * gfortran.dg/whole_file_18.f90: Updated error message.
+
+2010-06-12 Daniel Franke <franke.daniel@gmail.com>
+
+ * gfortran.dg/whole_file_20.f03: New.
+
+2010-06-12 Jan Hubicka <jh@suse.cz>
+
+ * gcc.c-torture/compile/pc44485.c: New testcase.
+
+2010-06-12 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40117
+ * gfortran.dg/typebound_proc_4.f03: Modified error message.
+ * gfortran.dg/typebound_proc_14.f03: New.
+ * gfortran.dg/typebound_proc_15.f03: New.
+
+2010-06-11 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/opts-1.c: New test.
+
+2010-06-11 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/funroll-loops-all.c: Update expected error.
+
+2010-06-11 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/44481
+ * gcc.target/i386/pr44481.c: New test.
+
+2010-06-11 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/pr42461.c: Compile at -O2 instead of -O.
+
+2010-06-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/44483
+ * gcc.dg/tree-ssa/pr44483.c: New.
+
+2010-06-11 Paul Brook <paul@codesourcery.com>
+
+ * g++.dg/other/arm-neon-1.C: New test.
+
+2010-06-11 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/42051
+ PR fortran/43896
+ * gfortran.dg/class_23.f03: New test.
+
+2010-06-11 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/ipa/pure-const-2.c: New testcase.
+
+2010-06-11 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/noreturn-7.c: Update.
+ * gcc.dg/noreturn-4.c: Update.
+
+2010-06-10 Dodji Seketeli <dodji@redhat.com>
+
+ Fix MIPS bootstrap
+ * g++.dg/other/typedef4.C: New test.
+
+2010-06-10 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44207
+ * gfortran.dg/allocate_alloc_opt_7.f90: New test.
+
+2010-06-10 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/44457
+ * gfortran.dg/asynchronous_3.f03
+
+2010-06-10 Changpeng Fang <changpeng.fang@amd.com>
+
+ PR middle-end/44185
+ * gcc.dg/tree-ssa/prefetch-7.c: take the loops that will generate
+ non-temporal stores out of the tests to form new test cases. As a
+ result, no non-temporal store should be generated in this case.
+
+ * gcc.dg/tree-ssa/prefetch-8.c: New. Test from original
+ prefetch-7.c that generate one non-temporal store.
+
+ * gcc.dg/tree-ssa/prefetch-9.c: New. Test from original
+ prefetch-7.c that generate one non-temporal store and one
+ one-temporal prefetch.
+
+2010-06-10 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/44258
+ * gcc.dg/tree-ssa/pr44258.c: New test.
+
+2010-06-10 Daniel Kraft <d@domob.eu>
+
+ PR fortran/38936
+ * gfortran.dg/associate_1.f03: New test.
+ * gfortran.dg/associate_2.f95: New test.
+ * gfortran.dg/associate_3.f03: New test.
+ * gfortran.dg/associate_4.f08: New test.
+
+2010-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gfortran.dg/selected_char_kind_4.f90: New test.
+
+2010-06-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/pr42461.c: New test.
+
+2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/44347
+ * gfortran.dg/selected_real_kind_1.f90: New.
+
+2010-06-09 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/44359
+ * gfortran.dg/warn_conversion.f90: Removed check for redundant
+ warning.
+ * gfortran.dg/warn_conversion_2.f90: Use non-constant expression to
+ check for warning.
+
+2010-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ * gfortran.dg/data_namelist_conflict.f90: New test.
+
+2010-06-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * g++.old-deja/g++.oliva/dwarf2.C: Don't xfail on i386-pc-solaris*.
+ * g++.old-deja/g++.oliva/dwarf3.C: Likewise.
+ * g++.old-deja/g++.other/init19.C: Don't xfail on *-*-solaris2*.
+
+2010-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ * testsuite/gfortran.dg/mvbits_9.f90: New test.
+ * testsuite/gfortran.dg/ibset_1.f90: Ditto.
+ * testsuite/gfortran.dg/ibits_1.f90: Ditto.
+ * testsuite/gfortran.dg/btest_1.f90: Ditto.
+ * testsuite/gfortran.dg/ibclr_1.f90: Ditto.
+
+2010-06-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/44366
+ * g++.dg/cpp0x/decltype23.C: Move to...
+ * g++.dg/diagnostic/parm1.C: ...here, and remove decltype.
+
+2010-06-09 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/44211
+ * gfortran.dg/typebound_call_14.f03: New test.
+
+2010-06-09 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/44423
+ * gcc.dg/tree-ssa/pr44423.c: New test.
+
+2010-06-09 Joern Rennecke <amylaar@spamcop.net>
+
+ PR testsuite/42843
+ * gcc.dg/plugin/selfassign.c (pass_warn_self_assign): Use enumerator
+ TV_NONE to initialize tv_id field.
+ * g++.dg/plugin/selfassign.c (pass_warn_self_assign): Likewise.
+ * gcc.dg/plugin/one_time_plugin.c (one_pass): Likewise.
+ * g++.dg/plugin/dumb_plugin.c (pass_dumb_plugin_example): Likewise.
+ Include toplev.h .
+ * gcc.dg/plugin/finish_unit_plugin.c: Include cgraph.h.
+ * g++.dg/plugin/attribute_plugin.c: Include toplev.h and plugin.h .
+ * g++.dg/plugin/pragma_plugin.c: Include toplev.h .
+
+2010-06-08 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR tree-optimization/39874
+ PR middle-end/28685
+ * gcc.dg/pr39874.c: New file.
+
+2010-06-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/ext/attr-alias-1.C: New.
+ * g++.dg/ext/attr-alias-2.C: New.
+
+2010-06-07 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/44446
+ * gfortran.dg/proc_ptr_27.f90: New.
+
+2010-06-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/44366
+ * g++.dg/cpp0x/decltype23.C: New.
+
+2010-06-08 Andrew Pinski <pinskia@gmail.com>
+ Shujing Zhao <pearly.zhao@oracle.com>
+
+ PR c/37724
+ * gcc.dg/c90-const-expr-10.c: Adjust.
+ * gcc.dg/c99-const-expr-10.c: Adjust.
+ * gcc.dg/init-bad-7.c: New.
+
+2010-06-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * lib/target-supports.exp (check_effective_target_gas): New proc.
+ * gcc.c-torture/execute/960321-1.x: New file.
+
+2010-06-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/44401
+ * g++.dg/tc1/dr147.C: Test case of member with same name as class.
+
+2010-06-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44444
+ * g++.dg/warn/Wunused-var-12.C: New test.
+
+ PR c++/44443
+ * c-c++-common/Wunused-var-11.c: New test.
+
+2010-06-07 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/ipa/pure-const-1.c: New testcase.
+
+2010-06-07 Kazu Hirata <kazu@codesourcery.com>
+
+ PR rtl-optimization/44404
+ * gcc.dg/pr44404.c: New.
+
+2010-06-07 Kai Tietz <kai.tietz@onevision.com>
+
+ PR target/44159
+ * gcc.target/i386/abi-2.c: Check sysv abi here.
+ * gcc.target/i386/aes-avx-check.h: Call test in noinline
+ function to avoid failures by different ABIs.
+ * gcc.target/i386/aes-check.h: Likewise.
+ * gcc.target/i386/avx-check.h: Likewise.
+ * gcc.target/i386/fma4-check.h: Likewise.
+ * gcc.target/i386/mmx-3dnow-check.h: Likewise.
+ * gcc.target/i386/mmx-check.h: Likewise.
+ * gcc.target/i386/pclmul-avx-check.h: Likewise.
+ * gcc.target/i386/pclmul-check.h: Likewise.
+ * gcc.target/i386/sse-check.h: Likewise.
+ * gcc.target/i386/sse2-check.h: Likewise.
+ * gcc.target/i386/sse3-check.h: Likewise.
+ * gcc.target/i386/sse4_1-check.h: Likewise.
+ * gcc.target/i386/sse4_2-check.h: Likewise.
+ * gcc.target/i386/sse4a-check.h: Likewise.
+ * gcc.target/i386/ssse3-check.h: Likewise.
+ * gcc.target/i386/xop-check.h: Likewise.
+ * gcc.target/i386/pr27971.c: Fix for LLP64.
+ * gcc.target/i386/pr39139.c: Likewise.
+ * gcc.target/i386/pr39315-check.c: Likewise.
+ * gcc.target/i386/vararg-1.c: Likewise.
+ * gcc.target/i386/vararg-2.c: Likewise.
+ Additional add dg-compile to avoid failure due
+ missing foo symbol.
+
+ * gcc.dg/compound-literal-1.c: Fix for llp64.
+ * gcc.dg/pr32370.c: Likewise.
+ * gcc.dg/pr37561.c: Likewise.
+ * gcc.dg/pr41340.c: Likewise.
+ * gcc.dg/pr41551.c: Likewise.
+
+2010-05-25 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/44188
+ * g++.dg/debug/dwarf2/typedef3.C: New test.
+
+2010-06-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/20000
+ * c-c++-common/pr20000.c: New.
+
+2010-06-05 Fabien Chêne <fabien@gcc.gnu.org>
+
+ PR c++/44086
+ * g++.dg/init/pr44086.C: New.
+ * g++.dg/cpp0x/decltype4.C: Adjust.
+
+2010-06-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/43945
+ * gfortran.dg/generic_23.f03: New test.
+
+2010-06-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/43895
+ * gfortran.dg/alloc_comp_class_1.f90 : New test.
+
+2010-06-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44361
+ * c-c++-common/Wunused-var-9.c: New test.
+
+2010-06-05 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/noexcept06.C: Call set_unexpected.
+
+2010-06-05 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/44322
+ * gcc.dg/c99-restrict-4.c: New test.
+
+2010-06-04 Magnus Fromreide <magfr@lysator.liu.se>
+
+ * g++.dg/cpp0x/nullptr01.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr02.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr03.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr04.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr05.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr06.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr07.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr08.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr09.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr10.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr11.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr12.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr13.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr14.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr15.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr16.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr17.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr18.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr19.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr20.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr21.C: Test nullptr_t variable.
+ * g++.dg/cpp0x/nullptr22.C: Test nullptr_t variable.
+
+2010-06-04 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/noexcept06.C: New.
+ * g++.dg/cpp0x/noexcept07.C: New.
+
+ * g++.dg/cpp0x/noexcept01.C: New.
+ * g++.dg/cpp0x/noexcept02.C: New.
+ * g++.dg/cpp0x/noexcept03.C: New.
+ * g++.dg/cpp0x/noexcept04.C: New.
+ * g++.dg/cpp0x/noexcept05.C: New.
+
+2010-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44412
+ * g++.dg/warn/Wunused-var-10.C: New test.
+ * g++.dg/warn/Wunused-var-11.C: New test.
+
+ PR c++/44362
+ * c-c++-common/Wunused-var-10.c: New test.
+
+2010-06-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/25880
+ * gcc.dg/assign-warn-2.c: Update.
+ * gcc.dg/cpp/line3.c: Update.
+ * gcc.dg/c99-array-lval-8.c: Update.
+ * gcc.dg/cast-qual-2.c: Update.
+ * gcc.dg/c99-arraydecl-3.c: Update.
+ * gcc.dg/assign-warn-1.c: Update.
+ * gcc.dg/format/gcc_diag-1.c: Update.
+
+2010-06-04 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR rtl-optimization/39871
+ PR rtl-optimization/40615
+ PR rtl-optimization/42500
+ PR rtl-optimization/42502
+ * gcc.target/arm/eliminate.c: New test.
+
+2010-06-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44410
+ * g++.old-deja/g++.jason/new.C: Qualify size_t with std::.
+ * g++.old-deja/g++.other/delete3.C: Likewise.
+ * g++.old-deja/g++.other/new.C: Likewise.
+ * g++.old-deja/g++.law/operators27.C: Likewise.
+ * g++.old-deja/g++.mike/p755.C: Likewise.
+ * g++.dg/eh/new1.C: Likewise.
+ * g++.dg/init/new5.C: Likewise.
+
+2010-06-03 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ * gfortran.dg/unpack_bounds_1.f90: Remove execute property.
+ * gfortran.dg/unpack_bounds_2.f90: Likewise.
+ * gfortran.dg/unpack_bounds_3.f90: Likewise.
+
+2010-06-03 Richard Guenther <rguenther@suse.de>
+
+ PR lto/41921
+ * lib/lto.exp: Always load gcc.exp.
+ (lto-obj): For C source files invoke gcc_target_compile.
+ * g++.dg/lto/20100603-1_0.C: New testcase.
+ * g++.dg/lto/20100603-1_1.c: Likewise.
+
+2010-06-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR tree-optimization/43688
+ * gfortran.dg/pr43688.f90: New.
+
+2010-06-03 Richard Guenther <rguenther@suse.de>
+
+ PR lto/41584
+ * gcc.dg/lto/20100603-1_0.c: New testcase.
+ * gcc.dg/lto/20100603-2_0.c: Likewise.
+ * gcc.dg/lto/20100603-3_0.c: Likewise.
+
+2010-06-02 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/44218
+ * gcc.target/powerpc/recip-1.c: New test for -mrecip support.
+ * gcc.target/powerpc/recip-2.c: Ditto.
+ * gcc.target/powerpc/recip-3.c: Ditto.
+ * gcc.target/powerpc/recip-4.c: Ditto.
+ * gcc.target/powerpc/recip-5.c: Ditto.
+ * gcc.target/powerpc/recip-6.c: Ditto.
+ * gcc.target/powerpc/recip-7.c: Ditto.
+ * gcc.target/powerpc/recip-test.h: Ditto.
+ * gcc.target/powerpc/recip-test2.h: Ditto.
+
2010-06-02 H.J. Lu <hongjiu.lu@intel.com>
* g++.dg/torture/pr44295.C (size_t): Use __SIZE_TYPE__.
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-10.c b/gcc/testsuite/c-c++-common/Wunused-var-10.c
new file mode 100644
index 00000000000..16d5171d0bf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-10.c
@@ -0,0 +1,68 @@
+/* PR c++/44362 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+f1 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b;
+ h = 0 ? c : d;
+ i = 1 ? e : f;
+ return g + h + i;
+}
+
+int
+f2 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a + 1 : b;
+ h = 0 ? c + 1 : d;
+ i = 1 ? e + 1 : f;
+ return g + h + i;
+}
+
+int
+f3 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b + 1;
+ h = 0 ? c : d + 1;
+ i = 1 ? e : f + 1;
+ return g + h + i;
+}
+
+int
+f4 (int u, int v)
+{
+ int a, c, e, g, h, i;
+ long b, d, f;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b;
+ h = 0 ? c : d;
+ i = 1 ? e : f;
+ return g + h + i;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-11.c b/gcc/testsuite/c-c++-common/Wunused-var-11.c
new file mode 100644
index 00000000000..a59ef814938
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-11.c
@@ -0,0 +1,12 @@
+/* PR c++/44443 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int i;
+
+void
+f1 ()
+{
+ const int * __attribute__((unused)) a = &i;
+ const int *b __attribute__((unused)) = &i;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-9.c b/gcc/testsuite/c-c++-common/Wunused-var-9.c
new file mode 100644
index 00000000000..b2cdc4510e1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-9.c
@@ -0,0 +1,80 @@
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int f1 (int *, int);
+int f2 (int *);
+int f3 (int *);
+
+int
+f4 (int x)
+{
+ int a, n = 0;
+ int b;
+ for (a = f1 (&b, x); f2 (&b); (void) (a = f3 (&b)))
+ n++;
+ return n;
+}
+
+void
+f5 (int x)
+{
+ int a;
+ a = x;
+ (void) (a = x);
+}
+
+void
+f6 (int x)
+{
+ int a; /* { dg-warning "set but not used" } */
+ a = x;
+}
+
+void
+f7 (int x)
+{
+ int a;
+ ({ a = x; });
+}
+
+int
+f8 (int x)
+{
+ int a;
+ int b = ({ a = x; });
+ return b;
+}
+
+int v;
+
+void
+f9 (int x)
+{
+ int a;
+ ({ v++, a = x; });
+}
+
+int
+f10 (int x)
+{
+ int a;
+ int b = ({ v++, a = x; });
+ return b;
+}
+
+void
+f11 (int x)
+{
+ int a;
+ a = x;
+ ({ v++, a; });
+}
+
+int
+f12 (int x)
+{
+ int a;
+ a = x;
+ int b = ({ v++, a; });
+ return b;
+}
diff --git a/gcc/testsuite/c-c++-common/pr20000.c b/gcc/testsuite/c-c++-common/pr20000.c
new file mode 100644
index 00000000000..1fcd17877e8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr20000.c
@@ -0,0 +1,32 @@
+/* PR c/20000 We only want to warn if the function returns
+ explicitly. We do not care about the return type. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int g(void) __attribute__((noreturn));
+int g2(void) __attribute__((noreturn)); /* { dg-bogus ".noreturn. function returns non-void value" } */
+void h(void) __attribute__((noreturn));
+
+
+int g(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */
+} /* { dg-warning "'noreturn' function does return" } */
+
+int g2(void) {
+ h();
+}
+
+typedef int ft(void);
+volatile ft vg;
+volatile ft vg2;
+
+int vg(void);
+int vg2(void); /* { dg-bogus ".noreturn. function returns non-void value" } */
+
+int vg(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" "" { target c } 27 } */
+} /* { dg-warning "'noreturn' function does return" "" { target c } 28 } */
+
+int vg2(void) {
+ h();
+}
diff --git a/gcc/testsuite/c-c++-common/torture/pr42834.c b/gcc/testsuite/c-c++-common/torture/pr42834.c
new file mode 100644
index 00000000000..a1ba49e46d4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/pr42834.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+void __attribute__((noinline,noclone))
+foo(int *p, float *q) { __asm__ volatile ("" : : : "memory"); }
+
+int main()
+{
+ if (sizeof (int) == sizeof (float))
+ {
+ int i;
+ float f;
+ int *p;
+ /* Prevent i and f from being rewritten into SSA form. */
+ foo (&i, &f);
+ i = 0;
+ f = 1.0;
+ p = (int *)&f;
+ __builtin_memcpy (&i, p, 4);
+ if (*(float *)&i != 1.0)
+ __builtin_abort ();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/uninit-17.c b/gcc/testsuite/c-c++-common/uninit-17.c
new file mode 100644
index 00000000000..b895ac7dcd9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/uninit-17.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+inline int foo(int x)
+{
+ return x;
+}
+static void bar(int a, int *ptr)
+{
+ do
+ {
+ int b; /* { dg-message "note: 'b' was declared here" } */
+ if (b < 40) {
+ ptr[0] = b; /* { dg-warning "may be used uninitialized" } */
+ }
+ b += 1;
+ ptr++;
+ }
+ while (--a != 0);
+}
+void foobar(int a, int *ptr)
+{
+ bar(foo(a), ptr);
+}
+
diff --git a/gcc/testsuite/c-c++-common/warn-ommitted-condop.c b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
new file mode 100644
index 00000000000..de92b8f2cdc
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
@@ -0,0 +1,29 @@
+/* { dg-options "-Wparentheses" } */
+
+extern void f2 (int);
+
+void bar (int x, int y, int z)
+{
+#define T(op) f2 (x op y ? : 1)
+#define T2(op) f2 (x op y ? 2 : 1)
+
+ T(<); /* { dg-warning "omitted middle operand" } */
+ T(>); /* { dg-warning "omitted middle operand" } */
+ T(<=); /* { dg-warning "omitted middle operand" } */
+ T(>=); /* { dg-warning "omitted middle operand" } */
+ T(==); /* { dg-warning "omitted middle operand" } */
+ T(!=); /* { dg-warning "omitted middle operand" } */
+ T(||); /* { dg-warning "omitted middle operand" } */
+ T(&&); /* { dg-warning "omitted middle operand" } */
+ f2 (!x ? : 1); /* { dg-warning "omitted middle operand" } */
+ T2(<); /* { dg-bogus "omitted middle operand" } */
+ T2(>); /* { dg-bogus "omitted middle operand" } */
+ T2(==); /* { dg-bogus "omitted middle operand" } */
+ T2(||); /* { dg-bogus "omitted middle operand" } */
+ T2(&&); /* { dg-bogus "omitted middle operand" } */
+ T(+); /* { dg-bogus "omitted middle operand" } */
+ T(-); /* { dg-bogus "omitted middle operand" } */
+ T(*); /* { dg-bogus "omitted middle operand" } */
+ T(/); /* { dg-bogus "omitted middle operand" } */
+ T(^); /* { dg-bogus "omitted middle operand" } */
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype4.C b/gcc/testsuite/g++.dg/cpp0x/decltype4.C
index 23a34344e17..32fbc2b2ec2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype4.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype4.C
@@ -62,6 +62,7 @@ void wibble() {
}
struct B {
+ B () : bit(), cbit() {}
int bit : 2;
const int cbit : 3;
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted10.C b/gcc/testsuite/g++.dg/cpp0x/defaulted10.C
index d169e0c6007..64fa5f01930 100644
--- a/gcc/testsuite/g++.dg/cpp0x/defaulted10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted10.C
@@ -3,12 +3,12 @@
struct A
{
- template<typename T> void foo(T) = delete; // { dg-error "previously|deleted" }
+ template<typename T> void foo(T) = delete; // { dg-error "previously|declared" }
};
template<typename T> void A::foo(T) {} // { dg-error "redefinition" }
void bar()
{
- A().foo(0); // { dg-error "used" }
+ A().foo(0); // { dg-error "use" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted13.C b/gcc/testsuite/g++.dg/cpp0x/defaulted13.C
index 87b8100ac77..8b23579217e 100644
--- a/gcc/testsuite/g++.dg/cpp0x/defaulted13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted13.C
@@ -7,22 +7,22 @@ struct NonCopyable {
};
template<>
-NonCopyable<int>::NonCopyable(NonCopyable<int> const&) = delete; // { dg-error "deleted" }
+NonCopyable<int>::NonCopyable(NonCopyable<int> const&) = delete; // { dg-error "declared" }
template<typename T>
NonCopyable<T>::NonCopyable(NonCopyable<T> const&) = default;
template<>
-NonCopyable<double>::NonCopyable(NonCopyable<double> const&) = delete; // { dg-error "deleted" }
+NonCopyable<double>::NonCopyable(NonCopyable<double> const&) = delete; // { dg-error "declared" }
int main()
{
NonCopyable<double> nc_dbl;
- NonCopyable<double> nc_dbl_cpy(nc_dbl); // { dg-error "used here" }
+ NonCopyable<double> nc_dbl_cpy(nc_dbl); // { dg-error "use" }
NonCopyable<int> nc_int;
- NonCopyable<int> nc_int_cpy(nc_int); // { dg-error "used here" }
+ NonCopyable<int> nc_int_cpy(nc_int); // { dg-error "use" }
NonCopyable<char> nc_char;
NonCopyable<char> nc_char_cpy(nc_char);
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted17.C b/gcc/testsuite/g++.dg/cpp0x/defaulted17.C
new file mode 100644
index 00000000000..79e91a0eb61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted17.C
@@ -0,0 +1,12 @@
+// { dg-options -std=c++0x }
+
+struct A // { dg-error "const|operator=" }
+{
+ const int i;
+};
+
+int main()
+{
+ A a = { 0 };
+ a = a; // { dg-error "deleted" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted18.C b/gcc/testsuite/g++.dg/cpp0x/defaulted18.C
new file mode 100644
index 00000000000..ae055e3bc63
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted18.C
@@ -0,0 +1,9 @@
+// { dg-options "-std=c++0x" }
+
+void f(char i, int j) = delete; // { dg-message "<deleted>" }
+void f(int i, ...); // { dg-message "void f" }
+
+int main()
+{
+ f(1,1); // { dg-error "ambiguous" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted19.C b/gcc/testsuite/g++.dg/cpp0x/defaulted19.C
new file mode 100644
index 00000000000..ea33df39838
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted19.C
@@ -0,0 +1,21 @@
+// We allocate a cookie to help us run the destructor even if it's deleted.
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+struct A
+{
+ ~A() = delete;
+};
+
+void *p = 0;
+void *operator new[](__SIZE_TYPE__ t)
+{
+ p = ::operator new (t);
+ return p;
+}
+
+int main()
+{
+ A* ap = new A[5];
+ return ap == p;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C
index ad3274a2ea9..909ebc5e6e0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C
@@ -41,7 +41,7 @@ struct E
struct F
{
F() = default;
- F(const F&) = delete; // { dg-error "deleted" }
+ F(const F&) = delete; // { dg-error "declared" }
};
struct G
@@ -60,7 +60,7 @@ union U
int main()
{
F f;
- F f2(f); // { dg-error "used" }
+ F f2(f); // { dg-error "use" }
B* b = new const B; // { dg-error "uninitialized const" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted3.C b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C
index efde415936d..5e2116b53b3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/defaulted3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C
@@ -4,7 +4,7 @@
template<class T>
struct A {
template<class U>
- bool operator==(const A<U>&) = delete; // { dg-error "deleted function" }
+ bool operator==(const A<U>&) = delete; // { dg-error "declared" }
operator bool () { return true; }
};
@@ -12,5 +12,5 @@ int main()
{
A<int> a1;
A<void> a2;
- if(a1 == a2) {} // { dg-error "used here" }
+ if(a1 == a2) {} // { dg-error "use" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit5.C b/gcc/testsuite/g++.dg/cpp0x/explicit5.C
new file mode 100644
index 00000000000..88a47071db1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/explicit5.C
@@ -0,0 +1,25 @@
+// test for extension of DR 899 to handle template ctors
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+int r = 1;
+
+struct C {
+ C() { }
+ template <class T = int> C(C&, T = 0) { r = 0; }
+};
+
+C c;
+
+struct A
+{
+ explicit operator C&() const { return c; }
+};
+
+int main()
+{
+ A a;
+ C c2 (a);
+
+ return r;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit-copy.C b/gcc/testsuite/g++.dg/cpp0x/implicit-copy.C
index ea680a8961b..861fe201f10 100644
--- a/gcc/testsuite/g++.dg/cpp0x/implicit-copy.C
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit-copy.C
@@ -3,13 +3,13 @@ struct S
{
S();
private:
- S(S const &&);
- S & operator=(S const &&);
+ S(S const &&); // { dg-error "" }
+ S & operator=(S const &&); // { dg-error "" }
};
void f()
{
S a;
- S b(a);
- a = b;
+ S b(a); // { dg-error "" }
+ a = b; // { dg-error "" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit1.C b/gcc/testsuite/g++.dg/cpp0x/implicit1.C
new file mode 100644
index 00000000000..2efbde6a93a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit1.C
@@ -0,0 +1,26 @@
+// Test for implicitly deleted destructors.
+// { dg-options "-std=c++0x" }
+// { dg-prune-output "default definition would be ill-formed" }
+// { dg-prune-output "within this context" }
+
+class C
+{
+ void operator delete (void *); // { dg-error "private" }
+public:
+ virtual ~C(); // { dg-error "overriding" }
+};
+
+struct D: C { }; // { dg-error "deleted" }
+D d; // { dg-error "deleted" }
+
+struct E
+{
+ ~E() = delete; // { dg-error "declared here" }
+};
+
+struct F
+{
+ virtual ~F(); // { dg-error "overriding" }
+};
+
+struct G: E, F { }; // { dg-error "deleted" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit2.C b/gcc/testsuite/g++.dg/cpp0x/implicit2.C
new file mode 100644
index 00000000000..f24a78838fa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit2.C
@@ -0,0 +1,33 @@
+// Test that the synthesized C copy constructor calls the A template
+// constructor and has the appropriate exception specification.
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+int r = 1;
+
+struct A
+{
+ A() {}
+ A(const A&) throw () { }
+ template <class T>
+ A(T& t) { r = 0; }
+};
+
+struct B
+{
+ B() {}
+ B(B&) throw () { }
+};
+
+struct C: A, B { };
+
+#define SA(E) static_assert(E, #E)
+
+C c;
+SA (!noexcept(C(c)));
+
+int main()
+{
+ (C(c));
+ return r;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit3.C b/gcc/testsuite/g++.dg/cpp0x/implicit3.C
new file mode 100644
index 00000000000..a43eca708c0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit3.C
@@ -0,0 +1,56 @@
+// Basic runtime test for implicit move constructor
+// { dg-do run }
+// { dg-options -std=c++0x }
+
+int m;
+
+struct A
+{
+ A() = default;
+ A(A&&) { ++m; }
+ A& operator=(A&&) { ++m; return *this; }
+};
+
+struct B
+{
+ B() = default;
+ B(const B&);
+ B(B&&) { ++m; }
+ B& operator=(const B&);
+ B& operator=(B&&) { ++m; return *this; }
+};
+
+struct C
+{
+ C() = default;
+ C(C&);
+ C(C&&) { ++m; }
+ C& operator=(C&);
+ C& operator=(C&&) { ++m; return *this; }
+};
+
+struct D: public A, public B
+{
+ C c;
+ int i;
+};
+
+struct E: public A, public B
+{
+ C c;
+ int i;
+ E() = default;
+ E(E&&) = default;
+ E& operator=(E&&) = default;
+};
+
+int main()
+{
+ D d1;
+ D d2 (static_cast<D&&>(d1));
+ d1 = static_cast<D&&>(d2);
+ E e1;
+ E e2 (static_cast<E&&>(e1));
+ e1 = static_cast<E&&>(e2);
+ return m != 12;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit4.C b/gcc/testsuite/g++.dg/cpp0x/implicit4.C
new file mode 100644
index 00000000000..75606a3ce7e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit4.C
@@ -0,0 +1,20 @@
+// Test that a base with only a move constructor causes the implicit copy
+// constructor to be deleted.
+// { dg-options "-std=c++0x" }
+
+struct A
+{
+ A(); // { dg-message "A::A" }
+ A(A&&); // { dg-message "A::A" }
+};
+
+struct B: A // { dg-error "implicit|no match" }
+{
+};
+
+int main()
+{
+ B b1;
+ B b2(b1); // { dg-error "deleted function .B::B.const" }
+ B b3(static_cast<B&&>(b1));
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit5.C b/gcc/testsuite/g++.dg/cpp0x/implicit5.C
new file mode 100644
index 00000000000..f25c08530db
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit5.C
@@ -0,0 +1,19 @@
+// Test that the default B copy constructor calls the A member template
+// constructor.
+// { dg-options -std=c++0x }
+
+struct A
+{
+ A() = default;
+ A(A&&) = default;
+ template <class T>
+ A(const T& t) { t.i; } // { dg-error "no member" }
+};
+
+struct B: A { };
+
+int main()
+{
+ B b;
+ B b2(b);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist15.C b/gcc/testsuite/g++.dg/cpp0x/initlist15.C
index d59e5af640b..b75cc81729f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist15.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist15.C
@@ -1,5 +1,8 @@
// { dg-options "-std=c++0x" }
+// Just discard errors pointing at header files
+// { dg-prune-output "include" }
+
#include <vector>
#include <typeinfo>
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist19.C b/gcc/testsuite/g++.dg/cpp0x/initlist19.C
index 418cddc618a..9cb197c9be2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist19.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist19.C
@@ -1,8 +1,10 @@
// { dg-options "-std=c++0x" }
+// Allow other errors, too
+// { dg-prune-output "error" }
+
void f(double);
int main()
{
f({{1}}); // { dg-error "too many braces" }
- // { dg-error "" "" { target *-*-* } 6 } allow other errors, too
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist39.C b/gcc/testsuite/g++.dg/cpp0x/initlist39.C
new file mode 100644
index 00000000000..a6dd1ec43d1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist39.C
@@ -0,0 +1,15 @@
+// { dg-options -std=c++0x }
+
+struct A { int i; };
+
+void f (const A &);
+void f (A &&);
+
+void g (A, int);
+void g (A, double);
+
+int main()
+{
+ f ( { 1 } );
+ g ( { 1 }, 1 );
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist40.C b/gcc/testsuite/g++.dg/cpp0x/initlist40.C
new file mode 100644
index 00000000000..f2703602c9e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist40.C
@@ -0,0 +1,12 @@
+// { dg-options "-std=c++0x" }
+
+struct A
+{
+ explicit A(int = 42);
+};
+
+int main()
+{
+ A a1 = { };
+ A a2 = { 24 }; // { dg-error "explicit" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist9.C b/gcc/testsuite/g++.dg/cpp0x/initlist9.C
index 2bc2d1782f9..d596b391508 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist9.C
@@ -8,7 +8,7 @@ struct b
b() = default;
~b() = default;
b& operator=(const b&) = delete;
- b(const b&) = delete; // { dg-error "deleted" }
+ b(const b&) = delete; // { dg-error "declared" }
b(bool _t): t (_t) { }
};
@@ -19,7 +19,7 @@ int main()
b tst1 = { false };
// copy initialization.
- b tst2 = false; // { dg-error "used here" }
+ b tst2 = false; // { dg-error "use" }
// direct list initialization
b tst3 { false };
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C
index c38f2955d46..76ed7445f45 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C
@@ -3,7 +3,7 @@
void f()
{
int i;
- auto lam = [i]{}; // { dg-message "note" }
+ auto lam = [i]{}; // { dg-message "" }
decltype(lam) lam2 = { 1 }; // { dg-error "" "not an aggregate" }
decltype(lam) lam3; // { dg-error "" "deleted default ctor" }
lam3 = lam; // { dg-error "" "deleted assignment op" }
@@ -12,7 +12,7 @@ void f()
template <class T>
void g(T i)
{
- auto lam = [i]{}; // { dg-message "note" }
+ auto lam = [i]{}; // { dg-message "" }
decltype(lam) lam2 = { 1 }; // { dg-error "" "not an aggregate" }
decltype(lam) lam3; // { dg-error "" "deleted default ctor" }
lam3 = lam; // { dg-error "" "deleted assignment op" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C
index 4037331ee37..f4766691eec 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C
@@ -5,7 +5,7 @@
struct A
{
A();
- A(const A& a) = delete; // { dg-error "deleted" }
+ A(const A& a) = delete; // { dg-error "declared" }
};
int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C
index 3d53c139fe6..dab53f1276e 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C
@@ -3,14 +3,14 @@
struct A {
A();
- A(const A&) = delete; // { dg-error "deleted function" }
+ A(const A&) = delete; // { dg-error "declared" }
};
template <class T>
void f()
{
T t;
- [t] { return 0; }; // { dg-error "used here" }
+ [t] { return 0; }; // { dg-error "use" }
}
int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept01.C b/gcc/testsuite/g++.dg/cpp0x/noexcept01.C
new file mode 100644
index 00000000000..f314684eae8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept01.C
@@ -0,0 +1,83 @@
+// Test for noexcept-expression
+// { dg-options "-std=c++0x -O2" }
+
+#include <typeinfo>
+
+#define SA(X) static_assert(X, #X)
+
+void f();
+void g() throw();
+SA(noexcept(g()));
+SA(!noexcept(f()));
+SA(!noexcept(throw 1));
+SA(noexcept(42));
+
+struct A
+{
+ virtual ~A();
+};
+
+struct B: public A
+{
+ virtual ~B();
+};
+
+A* ap;
+
+struct C { };
+C* cp;
+
+SA (noexcept (dynamic_cast<B*>(ap)));
+SA (!noexcept (dynamic_cast<B&>(*ap)));
+SA (!noexcept (typeid (*ap)));
+SA (noexcept (typeid (*cp)));
+
+SA (!noexcept (true ? 1 : throw 1));
+SA (!noexcept (true || true ? 1 : throw 1));
+
+SA (noexcept (C()));
+
+struct D
+{
+ D() throw();
+};
+
+SA (noexcept (D()));
+
+struct E
+{
+ E() throw();
+ ~E();
+};
+
+SA (!noexcept (E()));
+
+struct F
+{
+ virtual void f();
+};
+
+SA (noexcept (F()));
+
+struct G
+{
+ G() = default;
+ ~G() = default;
+};
+
+SA (noexcept (G()));
+
+template <class T, bool b>
+void tf()
+{
+ SA (noexcept (T()) == b);
+}
+
+template void tf<int,true>();
+template void tf<E, false>();
+
+// Make sure that noexcept uses the declared exception-specification, not
+// any knowledge we might have about whether or not the function really
+// throws.
+void h() { }
+SA(!noexcept(h()));
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept02.C b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C
new file mode 100644
index 00000000000..be6fa00dd09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C
@@ -0,0 +1,52 @@
+// Test for noexcept-specification
+// { dg-options "-std=c++0x" }
+
+#define SA(X) static_assert(X, #X)
+
+void f();
+void f() noexcept(false);
+void f() noexcept(1 == 0);
+void f();
+
+SA(!noexcept(f()));
+
+void g() throw (int);
+void g() noexcept(false); // { dg-error "previous declaration" }
+void g(); // { dg-error "different exception" }
+
+void h() throw();
+void h() noexcept;
+void h() throw();
+void h() noexcept;
+
+template <class T>
+void g (T) noexcept(noexcept(T())); // { dg-error "previous declaration" }
+template <class T>
+void g (T) noexcept(noexcept(T(0))); // { dg-error "different exception" }
+
+template <class T>
+void f (T) noexcept(noexcept(T()) && noexcept(T()));
+template <class T>
+void f (T) noexcept(noexcept(T()) && noexcept(T()));
+template <class T>
+void f2(T a) noexcept (noexcept (f (a)));
+
+struct A { A(); };
+SA(noexcept(f(1)));
+SA(!noexcept(f(A())));
+SA(noexcept(f2(1)));
+SA(!noexcept(f2(A())));
+
+template <class... Ts>
+void f3(Ts... ts) noexcept (noexcept (f(ts...)));
+
+SA(noexcept(f3(1)));
+SA(!noexcept(f3(A())));
+
+template <class T1, class T2>
+void f (T1, T2) noexcept(noexcept(T1(), T2()));
+
+SA(noexcept(f3(1,1)));
+SA(!noexcept(f3(1,A())));
+SA(!noexcept(f3(A(),1)));
+SA(!noexcept(f3(A(),A())));
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept03.C b/gcc/testsuite/g++.dg/cpp0x/noexcept03.C
new file mode 100644
index 00000000000..c759f6fb21d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept03.C
@@ -0,0 +1,68 @@
+// Runtime test for noexcept-specification.
+// { dg-options "-std=c++0x -Wnoexcept" }
+// { dg-do run }
+
+#include <exception>
+#include <cstdlib>
+
+void my_terminate ()
+{
+ std::exit (0);
+}
+
+void my_unexpected ()
+{
+ throw;
+}
+
+void g() { throw 1; }
+void (*p)() = g;
+void f () noexcept (false)
+{
+ p();
+}
+
+template <class T>
+void f(T) noexcept (noexcept (T())) // { dg-warning "false" }
+{
+ p();
+}
+
+template <class T>
+void f2(T a) noexcept (noexcept (f (a)))
+{
+ f(a);
+}
+
+struct A { A() { } }; // { dg-warning "does not throw" }
+
+// throw(int) overrides noexcept(false) in either order.
+void h() throw (int, std::bad_exception);
+void h() noexcept (false)
+{
+ throw 1.0;
+}
+
+void i() noexcept (false);
+void i() throw (int, std::bad_exception)
+{
+ throw 1.0;
+}
+
+int main()
+{
+ // noexcept(false) allows throw.
+ try { f(); } catch (int) { }
+ // noexcept(noexcept(A())) == noexcept(false).
+ try { f(A()); } catch (int) { }
+ try { f2(A()); } catch (int) { }
+
+ std::set_unexpected (my_unexpected);
+ try { h(); } catch (std::bad_exception) { }
+ try { i(); } catch (std::bad_exception) { }
+
+ std::set_terminate (my_terminate);
+ // noexcept(noexcept(int())) == noexcept(true).
+ try { f2(1); } catch (...) { }
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept04.C b/gcc/testsuite/g++.dg/cpp0x/noexcept04.C
new file mode 100644
index 00000000000..8df818610f5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept04.C
@@ -0,0 +1,31 @@
+// Make sure that we call terminate when a noexcept spec is violated.
+// The function pointers are there to make sure that
+// the compiler doesn't get clever about optimizing the calls based on
+// knowledge about the called functions.
+
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+#include <exception>
+#include <cstdlib>
+
+void my_terminate ()
+{
+ std::exit (0);
+}
+
+void g() { throw 1; }
+void (*p1)() = g;
+void f() noexcept { p1(); }
+void (*p2)() = f;
+void h() { p2(); }
+
+int main()
+{
+ std::set_terminate (my_terminate);
+
+ try { h(); }
+ catch (int) { }
+
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept05.C b/gcc/testsuite/g++.dg/cpp0x/noexcept05.C
new file mode 100644
index 00000000000..6acea432736
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept05.C
@@ -0,0 +1,19 @@
+// Make sure that we force an LSDA for a noexcept spec so
+// that the personality routine will call terminate. Also check that we
+// optimize away the EH cleanup for var because the personality routine
+// will call terminate before unwinding: there should not be an EH region
+// (i.e. LEHB/LEHE labels) around the call to g().
+
+// { dg-final { scan-assembler-not "_ZSt9terminatev" } }
+// { dg-final { scan-assembler-not "EHB" } }
+// { dg-final { scan-assembler "LSDA" } }
+
+// { dg-options "-std=c++0x" }
+
+struct A { ~A(); };
+void g();
+void f() noexcept
+{
+ A var;
+ g();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept06.C b/gcc/testsuite/g++.dg/cpp0x/noexcept06.C
new file mode 100644
index 00000000000..3babdffdad5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept06.C
@@ -0,0 +1,30 @@
+// Test that checking of a nothrow specification uses the one on the
+// definition.
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+#include <exception>
+#include <cstdlib>
+
+void my_unexpected ()
+{
+ std::abort ();
+}
+void my_terminate ()
+{
+ std::exit (0);
+}
+
+void f() throw();
+void f() noexcept
+{
+ throw 1;
+}
+
+int main()
+{
+ std::set_unexpected (my_unexpected);
+ std::set_terminate (my_terminate);
+ f();
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept07.C b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C
new file mode 100644
index 00000000000..0a5773fc86b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C
@@ -0,0 +1,25 @@
+// Test that checking of a nothrow specification uses the one on the
+// definition.
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+#include <exception>
+#include <cstdlib>
+
+void my_unexpected ()
+{
+ std::exit (0);
+}
+
+void f() noexcept;
+void f() throw()
+{
+ throw 1;
+}
+
+int main()
+{
+ std::set_unexpected (my_unexpected);
+ f();
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept08.C b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C
new file mode 100644
index 00000000000..c45033246eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C
@@ -0,0 +1,56 @@
+// { dg-options "-std=c++0x" }
+// { dg-prune-output "overriding" }
+
+struct A
+{
+ virtual void f();
+ virtual void g() throw();
+ virtual void h() noexcept;
+ virtual void i() noexcept(false);
+ virtual void j() throw(int);
+};
+
+struct B: A
+{
+ void f() noexcept;
+ void g() noexcept;
+ void h() noexcept;
+ void i() noexcept;
+ void j() noexcept;
+};
+
+struct C: A
+{
+ void f() throw();
+ void g() throw();
+ void h() throw();
+ void i() throw();
+ void j() throw();
+};
+
+struct D: A
+{
+ void f() noexcept(false);
+ void g() noexcept(false); // { dg-error "looser" }
+ void h() noexcept(false); // { dg-error "looser" }
+ void i() noexcept(false);
+ void j() noexcept(false); // compatible; treated as throw(int)
+};
+
+struct E: A
+{
+ void f() throw(int);
+ void g() throw(int); // { dg-error "looser" }
+ void h() throw(int); // { dg-error "looser" }
+ void i() throw(int);
+ void j() throw(int);
+};
+
+struct F: A
+{
+ void f();
+ void g(); // { dg-error "looser" }
+ void h(); // { dg-error "looser" }
+ void i();
+ void j(); // { dg-error "looser" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/not_special.C b/gcc/testsuite/g++.dg/cpp0x/not_special.C
index f94b82a0c1a..6d73bd086ca 100644
--- a/gcc/testsuite/g++.dg/cpp0x/not_special.C
+++ b/gcc/testsuite/g++.dg/cpp0x/not_special.C
@@ -1,11 +1,9 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test that move constructor and move assignement are not special.
-// That is, their presence should not inhibit compiler generated
-// copy ctor or assignment. Rather they should overload with the
-// compiler generated special members.
+// Test that move constructor and move assignement are special.
+// That is, their presence should inhibit compiler generated
+// copy ctor or assignment.
-// { dg-do run }
// { dg-options "-std=c++0x" }
#include <assert.h>
@@ -30,8 +28,8 @@ struct derived
: base
{
derived() {}
- derived(derived&&) {}
- derived& operator=(derived&&) {return *this;}
+ derived(derived&&) {} // { dg-error "argument 1" }
+ derived& operator=(derived&&) {return *this;} // { dg-error "argument 1" }
};
int test1()
@@ -39,11 +37,11 @@ int test1()
derived d;
derived d2(static_cast<derived&&>(d)); // should not call base::(const base&)
assert(copy == 0);
- derived d3(d); // should call base::(const base&)
+ derived d3(d); // { dg-error "lvalue" }
assert(copy == 1);
d2 = static_cast<derived&&>(d); // should not call base::operator=
assert(assign == 0);
- d3 = d; // should call base::operator=
+ d3 = d; // { dg-error "lvalue" }
assert(assign == 1);
return 0;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr01.C b/gcc/testsuite/g++.dg/cpp0x/nullptr01.C
index 8de877bab50..de3860c9ea4 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr01.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr01.C
@@ -6,3 +6,5 @@
char* const cp1 = nullptr;
char* const cp2 = __null;
char* const cp3 = 0;
+decltype(nullptr) mynull = 0;
+char* const cp4 = mynull;
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr02.C b/gcc/testsuite/g++.dg/cpp0x/nullptr02.C
index 2272152cf73..80977cb2f00 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr02.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr02.C
@@ -8,3 +8,9 @@ typedef decltype(nullptr) nullptr_t;
const nullptr_t np1 = nullptr;
const nullptr_t np2 = __null;
const nullptr_t np3 = 0;
+const nullptr_t np4 = np1;
+const nullptr_t np5 = np2;
+const nullptr_t np6 = np3;
+const nullptr_t np7 = np4;
+const nullptr_t np8 = np5;
+const nullptr_t np9 = np6;
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr03.C b/gcc/testsuite/g++.dg/cpp0x/nullptr03.C
index 1c9e521bd88..b6df8963740 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr03.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr03.C
@@ -3,4 +3,7 @@
// Test assignment to int
-const int n = nullptr; // { dg-error "cannot convert " }
+const int n1 = nullptr; // { dg-error "cannot convert " }
+decltype(nullptr) mynull = 0;
+const int n2 = mynull; // { dg-error "cannot convert " }
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C
index 28e37156f8c..be581bcb6e3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C
@@ -3,11 +3,15 @@
// Test cast to int
-#define unsigned
-__extension__ typedef __SIZE_TYPE__ ssize_t;
-#undef unsigned
+__extension__ typedef __INTPTR_TYPE__ intptr_t;
const int n4 = static_cast<const int>(nullptr); // { dg-error "invalid static_cast " }
const short int n5 = reinterpret_cast<short int>(nullptr); // { dg-error "loses precision" }
-const ssize_t n6 = reinterpret_cast<ssize_t>(nullptr);
-const ssize_t n7 = (ssize_t)nullptr;
+const intptr_t n6 = reinterpret_cast<intptr_t>(nullptr);
+const intptr_t n7 = (intptr_t)nullptr;
+
+decltype(nullptr) mynull = 0;
+const int n8 = static_cast<const int>(mynull); // { dg-error "invalid static_cast " }
+const short int n9 = reinterpret_cast<short int>(mynull); // { dg-error "loses precision" }
+const intptr_t n10 = reinterpret_cast<intptr_t>(mynull);
+const intptr_t n11 = (intptr_t)mynull;
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr05.C b/gcc/testsuite/g++.dg/cpp0x/nullptr05.C
index 7c3f8b7093d..22a8b51c1c7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr05.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr05.C
@@ -10,3 +10,5 @@ typedef void (F::*pmf)();
const pmf pmf1 = nullptr;
const pmf pmf2 = __null;
const pmf pmf3 = 0;
+decltype(nullptr) mynull = 0;
+const pmf pmf4 = mynull;
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr06.C b/gcc/testsuite/g++.dg/cpp0x/nullptr06.C
index 5dea1fbf171..c50bb9bc113 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr06.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr06.C
@@ -10,4 +10,6 @@ char* const cp1 = nullptr;
void fun()
{
assert_true(cp1 == nullptr);
+ decltype(nullptr) mynull = 0;
+ assert_true(cp1 == mynull);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr07.C b/gcc/testsuite/g++.dg/cpp0x/nullptr07.C
index cebed8862df..64d442be331 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr07.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr07.C
@@ -9,4 +9,7 @@ void fun()
if( n == nullptr ); // { dg-error "invalid operands of types " }
const int m = 1;
if( m == nullptr ); // { dg-error "invalid operands of types " }
+ decltype(nullptr) mynull = 0;
+ if( n == mynull ); // { dg-error "invalid operands of types " }
+ if( m == mynull ); // { dg-error "invalid operands of types " }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr08.C b/gcc/testsuite/g++.dg/cpp0x/nullptr08.C
index d7d9169f5a1..1e5db278ddf 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr08.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr08.C
@@ -8,4 +8,6 @@
void fun()
{
assert_true(nullptr ? false : true);
+ decltype(nullptr) mynull = 0;
+ assert_true(mynull ? false : true);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr09.C b/gcc/testsuite/g++.dg/cpp0x/nullptr09.C
index a42821cbfa6..b35a3c3207d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr09.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr09.C
@@ -6,4 +6,6 @@
void fun()
{
if( nullptr == 0 );
+ decltype(nullptr) mynull = 0;
+ if( mynull == 0 );
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr10.C b/gcc/testsuite/g++.dg/cpp0x/nullptr10.C
index cd131864a33..fa32267ec02 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr10.C
@@ -7,4 +7,8 @@ void fun()
{
nullptr = 0; // { dg-error "lvalue required as left operand" }
nullptr + 2; // { dg-error "invalid operands of types " }
+ decltype(nullptr) mynull = 0;
+ mynull = 1; // { dg-error "cannot convert" }
+ mynull = 0;
+ mynull + 2; // { dg-error "invalid operands of types " }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr11.C b/gcc/testsuite/g++.dg/cpp0x/nullptr11.C
index 85402a1a2a3..5907816a847 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr11.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr11.C
@@ -14,4 +14,27 @@ void fun()
assert_false(nullptr > nullptr);
assert_true(nullptr <= nullptr);
assert_true(nullptr >= nullptr);
+
+ decltype(nullptr) mynull = 0;
+
+ assert_true(mynull == nullptr);
+ assert_false(mynull != nullptr);
+ assert_false(mynull < nullptr);
+ assert_false(mynull > nullptr);
+ assert_true(mynull <= nullptr);
+ assert_true(mynull >= nullptr);
+
+ assert_true(nullptr == mynull);
+ assert_false(nullptr != mynull);
+ assert_false(nullptr < mynull);
+ assert_false(nullptr > mynull);
+ assert_true(nullptr <= mynull);
+ assert_true(nullptr >= mynull);
+
+ assert_true(mynull == mynull);
+ assert_false(mynull != mynull);
+ assert_false(mynull < mynull);
+ assert_false(mynull > mynull);
+ assert_true(mynull <= mynull);
+ assert_true(mynull >= mynull);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr12.C b/gcc/testsuite/g++.dg/cpp0x/nullptr12.C
index f68652c999e..1713259f103 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr12.C
@@ -4,3 +4,5 @@
// Test sizeof
static_assert(sizeof(nullptr) == sizeof(void*), "sizeof(nullptr) is wrong");
+const decltype(nullptr) mynull = 0;
+static_assert(sizeof(mynull) == sizeof(void*), "sizeof(nullptr) is wrong");
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr13.C b/gcc/testsuite/g++.dg/cpp0x/nullptr13.C
index 633e971feca..a9377584c56 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr13.C
@@ -5,7 +5,12 @@
#include <typeinfo>
+#define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0)
+
void fun()
{
typeid(nullptr);
+ const decltype(nullptr) mynull = 0;
+ typeid(mynull);
+ assert_true(typeid(nullptr) == typeid(mynull));
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr14.C b/gcc/testsuite/g++.dg/cpp0x/nullptr14.C
index 0493bcca006..4c4627b541b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr14.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr14.C
@@ -20,4 +20,6 @@ void test_f()
//
type_equal<char*>(f(nullptr));
type_equal<int>(f(0));
+ decltype(nullptr) mynull = 0;
+ type_equal<char*>(f(mynull));
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr15.C b/gcc/testsuite/g++.dg/cpp0x/nullptr15.C
index abb45f4e937..67d9d4a2311 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr15.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr15.C
@@ -18,4 +18,7 @@ void test_g()
//
g(nullptr); // { dg-error "no matching function for call to " }
type_equal<float*>(g((float*)nullptr));
+ decltype(nullptr) mynull = 0;
+ g(mynull); // { dg-error "no matching function for call to " }
+ type_equal<float*>(g((float*)mynull));
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr16.C b/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
index 7561b21cfe3..0ec0b6a12b6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
@@ -19,4 +19,7 @@ void test_h()
type_equal<int>(h(0));
type_equal<nullptr_t>(h(nullptr));
type_equal<float*>(h((float*)nullptr));
+ nullptr_t mynull = 0;
+ type_equal<nullptr_t>(h(mynull));
+ type_equal<float*>(h((float*)mynull));
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr17.C b/gcc/testsuite/g++.dg/cpp0x/nullptr17.C
index acedbae3787..2e580557bc3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr17.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr17.C
@@ -18,4 +18,6 @@ void test_i()
{
// Overload to bool, not int
type_equal<bool>(i(nullptr));
+ decltype(nullptr) mynull = 0;
+ type_equal<bool>(i(mynull));
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr18.C b/gcc/testsuite/g++.dg/cpp0x/nullptr18.C
index 192b646efb4..b8fa38c718d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr18.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr18.C
@@ -16,4 +16,6 @@ bool j( bool );
void test_j()
{
type_equal<char*>(j(nullptr));
+ decltype(nullptr) mynull = 0;
+ type_equal<char*>(j(mynull));
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr20.C b/gcc/testsuite/g++.dg/cpp0x/nullptr20.C
index a959b00786f..3e58406770d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr20.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr20.C
@@ -10,8 +10,11 @@ int main()
{
char buf1[64];
char buf2[64];
+ char buf3[64];
std::sprintf(buf1, "%p", (void*)0);
std::sprintf(buf2, "%p", nullptr);
- return std::strcmp(buf1, buf2) != 0;
+ decltype(nullptr) mynull = 0;
+ std::sprintf(buf3, "%p", nullptr);
+ return std::strcmp(buf1, buf2) != 0 || std::strcmp(buf1, buf3) != 0;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr21.C b/gcc/testsuite/g++.dg/cpp0x/nullptr21.C
index 84c34dd1e0a..c30cb3c8b6d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr21.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr21.C
@@ -24,4 +24,21 @@ int main()
} catch (...) {
printf("Test 1 Fail");
} // { dg-output "Test 1 OK" }
+
+ nullptr_t mynull = 0;
+ try {
+ throw mynull;
+ } catch (void*) {
+ printf("Test 2 Fail");
+ } catch (bool) {
+ printf("Test 2 Fail");
+ } catch (int) {
+ printf("Test 2 Fail");
+ } catch (long int) {
+ printf("Test 2 Fail");
+ } catch (nullptr_t) {
+ printf("Test 2 OK");
+ } catch (...) {
+ printf("Test 2 Fail");
+ } // { dg-output "Test 2 OK" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr22.C b/gcc/testsuite/g++.dg/cpp0x/nullptr22.C
index 13cb8e3aab1..d800f9869d2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr22.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr22.C
@@ -13,4 +13,8 @@ void f()
f2(nullptr); // { dg-warning "null argument where non-null required " }
f3("x", "y", __null); // { dg-warning "missing sentinel in function call" }
f3("x", "y", nullptr);
+ decltype(nullptr) mynull = 0;
+ f1("%p", mynull);
+ f2(mynull); // { dg-warning "null argument where non-null required " }
+ f3("x", "y", mynull);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C b/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C
index beb8acb5a50..2765b5f3c30 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C
@@ -1,4 +1,3 @@
-// { dg-do "run" }
// { dg-options "-std=c++0x" }
// PR c++/33235
#include <cassert>
@@ -9,19 +8,19 @@ int move_assign = 0;
struct base2
{
base2() {}
- base2(base2&&) {++move_construct;}
- base2& operator=(base2&&) {++move_assign; return *this;}
+ base2(base2&&) {++move_construct;} // { dg-error "argument 1" }
+ base2& operator=(base2&&) {++move_assign; return *this;} // { dg-error "argument 1" }
};
int test2()
{
base2 b;
- base2 b2(b);
+ base2 b2(b); // { dg-error "lvalue" }
assert(move_construct == 0);
base2 b3(static_cast<base2&&>(b));
base2 b4 = static_cast<base2&&>(b);
assert(move_construct == 2);
- b = b2;
+ b = b2; // { dg-error "lvalue" }
assert(move_assign == 0);
b = static_cast<base2&&>(b2);
assert(move_assign == 1);
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv1n.C b/gcc/testsuite/g++.dg/cpp0x/rv1n.C
index b7b9b6e25ce..5224d3eb70e 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv1n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv1n.C
@@ -20,7 +20,7 @@ struct eight {char x[8];};
struct A
{
A();
- A(const volatile A&&);
+ A(const volatile A&&); // { dg-error "argument 1" }
};
A source();
@@ -35,9 +35,9 @@ one sink_1_1( A&); // { dg-error "" }
int test1_1()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "cannot bind" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "cannot bind" }
sink_1_1(ca); // { dg-error "invalid initialization" }
sink_1_1(va); // { dg-error "invalid initialization" }
sink_1_1(cva); // { dg-error "invalid initialization" }
@@ -53,9 +53,9 @@ two sink_1_2(const A&); // { dg-error "" }
int test1_2()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_1_2(va); // { dg-error "invalid initialization" }
sink_1_2(cva); // { dg-error "invalid initialization" }
sink_1_2(v_source()); // { dg-error "invalid initialization" }
@@ -68,9 +68,9 @@ three sink_1_3(volatile A&); // { dg-error "" }
int test1_3()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_1_3(ca); // { dg-error "invalid initialization" }
sink_1_3(cva); // { dg-error "invalid initialization" }
sink_1_3(source()); // { dg-error "invalid initialization" }
@@ -85,9 +85,9 @@ four sink_1_4(const volatile A&); // { dg-error "" }
int test1_4()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_1_4(source()); // { dg-error "invalid initialization" }
sink_1_4(c_source()); // { dg-error "invalid initialization" }
sink_1_4(v_source()); // { dg-error "invalid initialization" }
@@ -100,9 +100,9 @@ five sink_1_5( A&&); // { dg-error "" }
int test1_5()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_1_5(a); // { dg-error "lvalue" }
sink_1_5(ca); // { dg-error "invalid initialization" }
sink_1_5(va); // { dg-error "invalid initialization" }
@@ -118,9 +118,9 @@ six sink_1_6(const A&&); // { dg-error "" }
int test1_6()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_1_6(a); // { dg-error "lvalue" }
sink_1_6(ca); // { dg-error "lvalue" }
sink_1_6(va); // { dg-error "invalid initialization" }
@@ -135,9 +135,9 @@ seven sink_1_7(volatile A&&); // { dg-error "" }
int test1_7()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_1_7(a); // { dg-error "lvalue" }
sink_1_7(ca); // { dg-error "invalid initialization" }
sink_1_7(va); // { dg-error "lvalue" }
@@ -152,9 +152,9 @@ eight sink_1_8(const volatile A&&); // { dg-error "" }
int test1_8()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_1_8(a); // { dg-error "lvalue" }
sink_1_8(ca); // { dg-error "lvalue" }
sink_1_8(va); // { dg-error "lvalue" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv1p.C b/gcc/testsuite/g++.dg/cpp0x/rv1p.C
index b2770ef33d5..4990165a465 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv1p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv1p.C
@@ -35,9 +35,9 @@ one sink_1_1( A&);
int test1_1()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_1(a)) == 1> t1;
return 0;
}
@@ -47,9 +47,9 @@ two sink_1_2(const A&);
int test1_2()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_2(a)) == 2> t1;
sa<sizeof(sink_1_2(ca)) == 2> t2;
sa<sizeof(sink_1_2(source())) == 2> t5;
@@ -62,9 +62,9 @@ three sink_1_3(volatile A&);
int test1_3()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_3(a)) == 3> t1;
sa<sizeof(sink_1_3(va)) == 3> t3;
return 0;
@@ -75,9 +75,9 @@ four sink_1_4(const volatile A&);
int test1_4()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_4(a)) == 4> t1;
sa<sizeof(sink_1_4(ca)) == 4> t2;
sa<sizeof(sink_1_4(va)) == 4> t3;
@@ -90,9 +90,9 @@ five sink_1_5( A&&);
int test1_5()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_5(source())) == 5> t5;
return 0;
}
@@ -102,9 +102,9 @@ six sink_1_6(const A&&);
int test1_6()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_6(source())) == 6> t5;
sa<sizeof(sink_1_6(c_source())) == 6> t6;
return 0;
@@ -115,9 +115,9 @@ seven sink_1_7(volatile A&&);
int test1_7()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_7(source())) == 7> t5;
sa<sizeof(sink_1_7(v_source())) == 7> t7;
return 0;
@@ -128,9 +128,9 @@ eight sink_1_8(const volatile A&&);
int test1_8()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_1_8(source())) == 8> t5;
sa<sizeof(sink_1_8(c_source())) == 8> t6;
sa<sizeof(sink_1_8(v_source())) == 8> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
index 5eee82c4bcf..a5c51778e34 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
@@ -20,7 +20,7 @@ struct eight {char x[8];};
struct A
{
A();
- A(const volatile A&&);
+ A(const volatile A&&); // { dg-error "argument 1" }
};
A source();
@@ -36,9 +36,9 @@ two sink_2_12(const A&); // { dg-message "note|argument" }
int test2_12()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_12(va); // { dg-error "no match" }
sink_2_12(cva); // { dg-error "no match" }
sink_2_12(v_source()); // { dg-error "no match" }
@@ -52,9 +52,9 @@ three sink_2_13(volatile A&); // { dg-message "note|argument" }
int test2_13()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_13(ca); // { dg-error "no match" }
sink_2_13(cva); // { dg-error "no match" }
sink_2_13(source()); // { dg-error "no match" }
@@ -70,9 +70,9 @@ four sink_2_14(const volatile A&); // { dg-message "note|argument" }
int test2_14()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_14(source()); // { dg-error "no match" }
sink_2_14(c_source()); // { dg-error "no match" }
sink_2_14(v_source()); // { dg-error "no match" }
@@ -86,9 +86,9 @@ five sink_2_15( A&&); // { dg-message "note|argument" }
int test2_15()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_15(ca); // { dg-error "no match" }
sink_2_15(va); // { dg-error "no match" }
sink_2_15(cva); // { dg-error "no match" }
@@ -104,9 +104,9 @@ six sink_2_16(const A&&); // { dg-message "note|argument" }
int test2_16()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_16(ca); // { dg-error "lvalue" }
sink_2_16(va); // { dg-error "no match" }
sink_2_16(cva); // { dg-error "no match" }
@@ -121,9 +121,9 @@ seven sink_2_17(volatile A&&); // { dg-message "note|argument" }
int test2_17()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_17(ca); // { dg-error "no match" }
sink_2_17(va); // { dg-error "lvalue" }
sink_2_17(cva); // { dg-error "no match" }
@@ -138,9 +138,9 @@ eight sink_2_18(const volatile A&&); // { dg-error "argument" }
int test2_18()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_18(ca); // { dg-error "lvalue" }
sink_2_18(va); // { dg-error "lvalue" }
sink_2_18(cva); // { dg-error "lvalue" }
@@ -152,9 +152,9 @@ three sink_2_23(volatile A&); // { dg-message "note|argument" }
int test2_23()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_23(a); // { dg-error "ambiguous" }
sink_2_23(cva); // { dg-error "no match" }
sink_2_23(v_source()); // { dg-error "no match" }
@@ -168,9 +168,9 @@ four sink_2_24(const volatile A&); // { dg-message "note|argument" }
int test2_24()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_24(v_source()); // { dg-error "no match" }
sink_2_24(cv_source()); // { dg-error "no match" }
return 0;
@@ -182,9 +182,9 @@ four sink_2_34(const volatile A&); // { dg-message "note|argument" }
int test2_34()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_34(source()); // { dg-error "no match" }
sink_2_34(c_source()); // { dg-error "no match" }
sink_2_34(v_source()); // { dg-error "no match" }
@@ -198,9 +198,9 @@ five sink_2_25( A&&); // { dg-message "note|argument" }
int test2_25()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_25(va); // { dg-error "no match" }
sink_2_25(cva); // { dg-error "no match" }
sink_2_25(v_source()); // { dg-error "no match" }
@@ -214,9 +214,9 @@ six sink_2_26(const A&&); // { dg-message "note|argument" }
int test2_26()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_26(va); // { dg-error "no match" }
sink_2_26(cva); // { dg-error "no match" }
sink_2_26(v_source()); // { dg-error "no match" }
@@ -230,9 +230,9 @@ seven sink_2_27(volatile A&&); // { dg-message "note|argument" }
int test2_27()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_27(va); // { dg-error "lvalue" }
sink_2_27(cva); // { dg-error "no match" }
sink_2_27(cv_source()); // { dg-error "no match" }
@@ -245,9 +245,9 @@ eight sink_2_28(const volatile A&&); // { dg-error "argument" }
int test2_28()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_28(va); // { dg-error "lvalue" }
sink_2_28(cva); // { dg-error "lvalue" }
}
@@ -258,9 +258,9 @@ five sink_2_35( A&&); // { dg-message "note|argument" }
int test2_35()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_35(ca); // { dg-error "no match" }
sink_2_35(cva); // { dg-error "no match" }
sink_2_35(c_source()); // { dg-error "no match" }
@@ -275,9 +275,9 @@ six sink_2_36(const A&&); // { dg-message "note|argument" }
int test2_36()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_36(ca); // { dg-error "lvalue" }
sink_2_36(cva); // { dg-error "no match" }
sink_2_36(v_source()); // { dg-error "no match" }
@@ -291,9 +291,9 @@ seven sink_2_37(volatile A&&); // { dg-message "note|argument" }
int test2_37()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_37(ca); // { dg-error "no match" }
sink_2_37(cva); // { dg-error "no match" }
sink_2_37(c_source()); // { dg-error "no match" }
@@ -307,9 +307,9 @@ eight sink_2_38(const volatile A&&); // { dg-error "argument" }
int test2_38()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_38(ca); // { dg-error "lvalue" }
sink_2_38(cva); // { dg-error "lvalue" }
}
@@ -320,9 +320,9 @@ five sink_2_45( A&&); // { dg-message "note|argument" }
int test2_45()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_45(c_source()); // { dg-error "no match" }
sink_2_45(v_source()); // { dg-error "no match" }
sink_2_45(cv_source()); // { dg-error "no match" }
@@ -335,9 +335,9 @@ six sink_2_46(const A&&); // { dg-message "note|argument" }
int test2_46()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_46(v_source()); // { dg-error "no match" }
sink_2_46(cv_source()); // { dg-error "no match" }
return 0;
@@ -349,9 +349,9 @@ seven sink_2_47(volatile A&&); // { dg-message "note|argument" }
int test2_47()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_47(c_source()); // { dg-error "no match" }
sink_2_47(cv_source()); // { dg-error "no match" }
return 0;
@@ -363,9 +363,9 @@ six sink_2_56(const A&&); // { dg-message "note|argument" }
int test2_56()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_56(a); // { dg-error "lvalue" }
sink_2_56(ca); // { dg-error "lvalue" }
sink_2_56(va); // { dg-error "no match" }
@@ -381,9 +381,9 @@ seven sink_2_57(volatile A&&); // { dg-message "note|argument" }
int test2_57()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_57(a); // { dg-error "lvalue" }
sink_2_57(va); // { dg-error "lvalue" }
sink_2_57(ca); // { dg-error "no match" }
@@ -399,9 +399,9 @@ eight sink_2_58(const volatile A&&); // { dg-error "argument" }
int test2_58()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_58(a); // { dg-error "lvalue" }
sink_2_58(ca); // { dg-error "lvalue" }
sink_2_58(va); // { dg-error "lvalue" }
@@ -414,9 +414,9 @@ seven sink_2_67(volatile A&&); // { dg-message "note|argument" }
int test2_67()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_67(a); // { dg-error "ambiguous" }
sink_2_67(ca); // { dg-error "lvalue" }
sink_2_67(va); // { dg-error "lvalue" }
@@ -432,9 +432,9 @@ eight sink_2_68(const volatile A&&); // { dg-error "argument" }
int test2_68()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_68(a); // { dg-error "lvalue" }
sink_2_68(ca); // { dg-error "lvalue" }
sink_2_68(va); // { dg-error "lvalue" }
@@ -447,9 +447,9 @@ eight sink_2_78(const volatile A&&); // { dg-error "argument" }
int test2_78()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_2_78(a); // { dg-error "lvalue" }
sink_2_78(ca); // { dg-error "lvalue" }
sink_2_78(va); // { dg-error "lvalue" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2p.C b/gcc/testsuite/g++.dg/cpp0x/rv2p.C
index 61c4fb046b6..4ed9238a1a1 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2p.C
@@ -36,9 +36,9 @@ two sink_2_12(const A&);
int test2_12()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_12(a)) == 1> t1;
sa<sizeof(sink_2_12(ca)) == 2> t2;
sa<sizeof(sink_2_12(source())) == 2> t5;
@@ -52,9 +52,9 @@ three sink_2_13(volatile A&);
int test2_13()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_13(a)) == 1> t1;
sa<sizeof(sink_2_13(va)) == 3> t3;
return 0;
@@ -66,9 +66,9 @@ four sink_2_14(const volatile A&);
int test2_14()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_14(a)) == 1> t1;
sa<sizeof(sink_2_14(ca)) == 4> t2;
sa<sizeof(sink_2_14(va)) == 4> t3;
@@ -82,9 +82,9 @@ five sink_2_15( A&&);
int test2_15()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_15(a)) == 1> t1;
sa<sizeof(sink_2_15(source())) == 5> t5;
return 0;
@@ -96,9 +96,9 @@ six sink_2_16(const A&&);
int test2_16()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_16(a)) == 1> t1;
sa<sizeof(sink_2_16(source())) == 6> t5;
sa<sizeof(sink_2_16(c_source())) == 6> t6;
@@ -111,9 +111,9 @@ seven sink_2_17(volatile A&&);
int test2_17()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_17(a)) == 1> t1;
sa<sizeof(sink_2_17(source())) == 7> t5;
sa<sizeof(sink_2_17(v_source())) == 7> t7;
@@ -126,9 +126,9 @@ eight sink_2_18(const volatile A&&);
int test2_18()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_18(a)) == 1> t1;
sa<sizeof(sink_2_18(source())) == 8> t5;
sa<sizeof(sink_2_18(c_source())) == 8> t6;
@@ -143,9 +143,9 @@ three sink_2_23(volatile A&);
int test2_23()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_23(ca)) == 2> t2;
sa<sizeof(sink_2_23(va)) == 3> t3;
sa<sizeof(sink_2_23(source())) == 2> t5;
@@ -159,9 +159,9 @@ four sink_2_24(const volatile A&);
int test2_24()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_24(a)) == 2> t1;
sa<sizeof(sink_2_24(ca)) == 2> t2;
sa<sizeof(sink_2_24(va)) == 4> t3;
@@ -179,9 +179,9 @@ five sink_2_25( A&&);
int test2_25()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_25(a)) == 2> t1;
sa<sizeof(sink_2_25(ca)) == 2> t2;
sa<sizeof(sink_2_25(source())) == 5> t5;
@@ -195,9 +195,9 @@ six sink_2_26(const A&&);
int test2_26()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_26(a)) == 2> t1;
sa<sizeof(sink_2_26(ca)) == 2> t2;
sa<sizeof(sink_2_26(source())) == 6> t5;
@@ -211,9 +211,9 @@ seven sink_2_27(volatile A&&);
int test2_27()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_27(a)) == 2> t1;
sa<sizeof(sink_2_27(ca)) == 2> t2;
sa<sizeof(sink_2_27(source())) == 7> t5;
@@ -228,9 +228,9 @@ eight sink_2_28(const volatile A&&);
int test2_28()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_28(a)) == 2> t1;
sa<sizeof(sink_2_28(ca)) == 2> t2;
sa<sizeof(sink_2_28(source())) == 8> t5;
@@ -246,9 +246,9 @@ four sink_2_34(const volatile A&);
int test2_34()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_34(a)) == 3> t1;
sa<sizeof(sink_2_34(ca)) == 4> t2;
sa<sizeof(sink_2_34(va)) == 3> t3;
@@ -266,9 +266,9 @@ five sink_2_35( A&&);
int test2_35()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_35(a)) == 3> t1;
sa<sizeof(sink_2_35(va)) == 3> t3;
sa<sizeof(sink_2_35(source())) == 5> t5;
@@ -281,9 +281,9 @@ six sink_2_36(const A&&);
int test2_36()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_36(a)) == 3> t1;
sa<sizeof(sink_2_36(va)) == 3> t3;
sa<sizeof(sink_2_36(source())) == 6> t5;
@@ -297,9 +297,9 @@ seven sink_2_37(volatile A&&);
int test2_37()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_37(a)) == 3> t1;
sa<sizeof(sink_2_37(va)) == 3> t3;
sa<sizeof(sink_2_37(source())) == 7> t5;
@@ -313,9 +313,9 @@ eight sink_2_38(const volatile A&&);
int test2_38()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_38(a)) == 3> t1;
sa<sizeof(sink_2_38(va)) == 3> t3;
sa<sizeof(sink_2_38(source())) == 8> t5;
@@ -331,9 +331,9 @@ five sink_2_45( A&&);
int test2_45()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_45(a)) == 4> t1;
sa<sizeof(sink_2_45(ca)) == 4> t2;
sa<sizeof(sink_2_45(va)) == 4> t3;
@@ -351,9 +351,9 @@ six sink_2_46(const A&&);
int test2_46()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_46(a)) == 4> t1;
sa<sizeof(sink_2_46(ca)) == 4> t2;
sa<sizeof(sink_2_46(va)) == 4> t3;
@@ -371,9 +371,9 @@ seven sink_2_47(volatile A&&);
int test2_47()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_47(a)) == 4> t1;
sa<sizeof(sink_2_47(ca)) == 4> t2;
sa<sizeof(sink_2_47(va)) == 4> t3;
@@ -391,9 +391,9 @@ eight sink_2_48(const volatile A&&);
int test2_48()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_48(a)) == 4> t1;
sa<sizeof(sink_2_48(ca)) == 4> t2;
sa<sizeof(sink_2_48(va)) == 4> t3;
@@ -411,9 +411,9 @@ six sink_2_56(const A&&);
int test2_56()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_56(source())) == 5> t5;
sa<sizeof(sink_2_56(c_source())) == 6> t6;
return 0;
@@ -425,9 +425,9 @@ seven sink_2_57(volatile A&&);
int test2_57()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_57(source())) == 5> t5;
sa<sizeof(sink_2_57(v_source())) == 7> t7;
return 0;
@@ -439,9 +439,9 @@ eight sink_2_58(const volatile A&&);
int test2_58()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_58(source())) == 5> t5;
sa<sizeof(sink_2_58(c_source())) == 8> t6;
sa<sizeof(sink_2_58(v_source())) == 8> t7;
@@ -455,9 +455,9 @@ seven sink_2_67(volatile A&&);
int test2_67()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_67(c_source())) == 6> t6;
sa<sizeof(sink_2_67(v_source())) == 7> t7;
return 0;
@@ -469,9 +469,9 @@ eight sink_2_68(const volatile A&&);
int test2_68()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_68(source())) == 6> t5;
sa<sizeof(sink_2_68(c_source())) == 6> t6;
sa<sizeof(sink_2_68(v_source())) == 8> t7;
@@ -485,9 +485,9 @@ eight sink_2_78(const volatile A&&);
int test2_78()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_2_78(source())) == 7> t5;
sa<sizeof(sink_2_78(c_source())) == 8> t6;
sa<sizeof(sink_2_78(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3n.C b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
index 0c208ab6ed0..cacbdb395e7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
@@ -20,7 +20,7 @@ struct eight {char x[8];};
struct A
{
A();
- A(const volatile A&&);
+ A(const volatile A&&); // { dg-error "argument 1" }
};
A source();
@@ -37,9 +37,9 @@ three sink_3_123(volatile A&); // { dg-message "note" }
int test3_123()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_123(cva); // { dg-error "no match" }
sink_3_123(v_source()); // { dg-error "no match" }
sink_3_123(cv_source()); // { dg-error "no match" }
@@ -57,9 +57,9 @@ four sink_3_124(const volatile A&); // { dg-message "note" }
int test3_124()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_124(v_source()); // { dg-error "no match" }
sink_3_124(cv_source()); // { dg-error "no match" }
return 0;
@@ -68,9 +68,9 @@ int test3_124()
int test3_125()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_125(va); // { dg-error "no match" }
sink_3_125(cva); // { dg-error "no match" }
sink_3_125(v_source()); // { dg-error "no match" }
@@ -85,9 +85,9 @@ six sink_3_126(const A&&); // { dg-message "note" }
int test3_126()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_126(va); // { dg-error "no match" }
sink_3_126(cva); // { dg-error "no match" }
sink_3_126(v_source()); // { dg-error "no match" }
@@ -102,9 +102,9 @@ seven sink_3_127(volatile A&&); // { dg-message "" }
int test3_127()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_127(va); // { dg-error "lvalue" }
sink_3_127(cva); // { dg-error "no match" }
sink_3_127(cv_source()); // { dg-error "no match" }
@@ -118,9 +118,9 @@ eight sink_3_128(const volatile A&&); // { dg-message "" }
int test3_128()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_128(va); // { dg-error "lvalue" }
sink_3_128(cva); // { dg-error "lvalue" }
@@ -133,9 +133,9 @@ four sink_3_134(const volatile A&); // { dg-message "note" }
int test3_134()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_134(source()); // { dg-error "no match" }
sink_3_134(c_source()); // { dg-error "no match" }
sink_3_134(v_source()); // { dg-error "no match" }
@@ -150,9 +150,9 @@ five sink_3_135( A&&); // { dg-message "note" }
int test3_135()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_135(ca); // { dg-error "no match" }
sink_3_135(cva); // { dg-error "no match" }
sink_3_135(c_source()); // { dg-error "no match" }
@@ -168,9 +168,9 @@ six sink_3_136(const A&&); // { dg-message "" }
int test3_136()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_136(ca); // { dg-error "lvalue" }
sink_3_136(cva); // { dg-error "no match" }
sink_3_136(v_source()); // { dg-error "no match" }
@@ -185,9 +185,9 @@ seven sink_3_137(volatile A&&); // { dg-message "note" }
int test3_137()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_137(ca); // { dg-error "no match" }
sink_3_137(cva); // { dg-error "no match" }
sink_3_137(c_source()); // { dg-error "no match" }
@@ -202,9 +202,9 @@ eight sink_3_138(const volatile A&&); // { dg-message "" }
int test3_138()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_138(ca); // { dg-error "lvalue" }
sink_3_138(cva); // { dg-error "lvalue" }
return 0;
@@ -217,9 +217,9 @@ five sink_3_145( A&&); // { dg-message "note" }
int test3_145()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_145(c_source()); // { dg-error "no match" }
sink_3_145(v_source()); // { dg-error "no match" }
sink_3_145(cv_source()); // { dg-error "no match" }
@@ -233,9 +233,9 @@ six sink_3_146(const A&&); // { dg-message "note" }
int test3_146()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_146(v_source()); // { dg-error "no match" }
sink_3_146(cv_source()); // { dg-error "no match" }
return 0;
@@ -248,9 +248,9 @@ seven sink_3_147(volatile A&&); // { dg-message "note" }
int test3_147()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_147(c_source()); // { dg-error "no match" }
sink_3_147(cv_source()); // { dg-error "no match" }
return 0;
@@ -263,9 +263,9 @@ six sink_3_156(const A&&); // { dg-message "" }
int test3_156()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_156(ca); // { dg-error "lvalue" }
sink_3_156(va); // { dg-error "no match" }
sink_3_156(cva); // { dg-error "no match" }
@@ -281,9 +281,9 @@ seven sink_3_157(volatile A&&); // { dg-message "" }
int test3_157()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_157(ca); // { dg-error "no match" }
sink_3_157(va); // { dg-error "lvalue" }
sink_3_157(cva); // { dg-error "no match" }
@@ -299,9 +299,9 @@ eight sink_3_158(const volatile A&&); // { dg-message "" }
int test3_158()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_158(ca); // { dg-error "lvalue" }
sink_3_158(va); // { dg-error "lvalue" }
sink_3_158(cva); // { dg-error "lvalue" }
@@ -315,9 +315,9 @@ seven sink_3_167(volatile A&&); // { dg-message "" }
int test3_167()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_167(ca); // { dg-error "lvalue" }
sink_3_167(va); // { dg-error "lvalue" }
sink_3_167(cva); // { dg-error "no match" }
@@ -333,9 +333,9 @@ eight sink_3_168(const volatile A&&); // { dg-message "" }
int test3_168()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_168(ca); // { dg-error "lvalue" }
sink_3_168(va); // { dg-error "lvalue" }
sink_3_168(cva); // { dg-error "lvalue" }
@@ -349,9 +349,9 @@ eight sink_3_178(const volatile A&&); // { dg-message "" }
int test3_178()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_178(ca); // { dg-error "lvalue" }
sink_3_178(va); // { dg-error "lvalue" }
sink_3_178(cva); // { dg-error "lvalue" }
@@ -365,9 +365,9 @@ four sink_3_234(const volatile A&); // { dg-message "note" }
int test3_234()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_234(a); // { dg-error "ambiguous" }
sink_3_234(v_source()); // { dg-error "no match" }
sink_3_234(cv_source()); // { dg-error "no match" }
@@ -381,9 +381,9 @@ five sink_3_235( A&&); // { dg-message "note" }
int test3_235()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_235(a); // { dg-error "ambiguous" }
sink_3_235(cva); // { dg-error "no match" }
sink_3_235(v_source()); // { dg-error "no match" }
@@ -398,9 +398,9 @@ six sink_3_236(const A&&); // { dg-message "note" }
int test3_236()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_236(a); // { dg-error "ambiguous" }
sink_3_236(cva); // { dg-error "no match" }
sink_3_236(v_source()); // { dg-error "no match" }
@@ -415,9 +415,9 @@ seven sink_3_237(volatile A&&); // { dg-message "note" }
int test3_237()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_237(a); // { dg-error "ambiguous" }
sink_3_237(cva); // { dg-error "no match" }
sink_3_237(cv_source()); // { dg-error "no match" }
@@ -431,9 +431,9 @@ eight sink_3_238(const volatile A&&); // { dg-message "" }
int test3_238()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_238(a); // { dg-error "ambiguous" }
sink_3_238(cva); // { dg-error "lvalue" }
return 0;
@@ -446,9 +446,9 @@ five sink_3_245( A&&); // { dg-message "note" }
int test3_245()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_245(v_source()); // { dg-error "no match" }
sink_3_245(cv_source()); // { dg-error "no match" }
return 0;
@@ -461,9 +461,9 @@ six sink_3_246(const A&&); // { dg-message "note" }
int test3_246()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_246(v_source()); // { dg-error "no match" }
sink_3_246(cv_source()); // { dg-error "no match" }
return 0;
@@ -476,9 +476,9 @@ seven sink_3_247(volatile A&&); // { dg-message "note" }
int test3_247()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_247(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -490,9 +490,9 @@ six sink_3_256(const A&&); // { dg-message "note" }
int test3_256()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_256(va); // { dg-error "no match" }
sink_3_256(cva); // { dg-error "no match" }
sink_3_256(v_source()); // { dg-error "no match" }
@@ -507,9 +507,9 @@ seven sink_3_257(volatile A&&); // { dg-message "" }
int test3_257()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_257(va); // { dg-error "lvalue" }
sink_3_257(cva); // { dg-error "no match" }
sink_3_257(cv_source()); // { dg-error "no match" }
@@ -523,9 +523,9 @@ eight sink_3_258(const volatile A&&); // { dg-message "" }
int test3_258()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_258(va); // { dg-error "lvalue" }
sink_3_258(cva); // { dg-error "lvalue" }
return 0;
@@ -538,9 +538,9 @@ seven sink_3_267(volatile A&&); // { dg-message "" }
int test3_267()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_267(va); // { dg-error "lvalue" }
sink_3_267(cva); // { dg-error "no match" }
sink_3_267(source()); // { dg-error "ambiguous" }
@@ -555,9 +555,9 @@ eight sink_3_268(const volatile A&&); // { dg-message "" }
int test3_268()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_268(va); // { dg-error "lvalue" }
sink_3_268(cva); // { dg-error "lvalue" }
return 0;
@@ -570,9 +570,9 @@ eight sink_3_278(const volatile A&&); // { dg-message "" }
int test3_278()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_278(va); // { dg-error "lvalue" }
sink_3_278(cva); // { dg-error "lvalue" }
return 0;
@@ -585,9 +585,9 @@ five sink_3_345( A&&); // { dg-message "note" }
int test3_345()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_345(c_source()); // { dg-error "no match" }
sink_3_345(v_source()); // { dg-error "no match" }
sink_3_345(cv_source()); // { dg-error "no match" }
@@ -601,9 +601,9 @@ six sink_3_346(const A&&); // { dg-message "note" }
int test3_346()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_346(v_source()); // { dg-error "no match" }
sink_3_346(cv_source()); // { dg-error "no match" }
return 0;
@@ -616,9 +616,9 @@ seven sink_3_347(volatile A&&); // { dg-message "note" }
int test3_347()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_347(c_source()); // { dg-error "no match" }
sink_3_347(cv_source()); // { dg-error "no match" }
return 0;
@@ -631,9 +631,9 @@ six sink_3_356(const A&&); // { dg-message "" }
int test3_356()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_356(ca); // { dg-error "lvalue" }
sink_3_356(cva); // { dg-error "no match" }
sink_3_356(v_source()); // { dg-error "no match" }
@@ -648,9 +648,9 @@ seven sink_3_357(volatile A&&); // { dg-message "note" }
int test3_357()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_357(ca); // { dg-error "no match" }
sink_3_357(cva); // { dg-error "no match" }
sink_3_357(c_source()); // { dg-error "no match" }
@@ -665,9 +665,9 @@ eight sink_3_358(const volatile A&&); // { dg-message "" }
int test3_358()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_358(ca); // { dg-error "lvalue" }
sink_3_358(cva); // { dg-error "lvalue" }
return 0;
@@ -680,9 +680,9 @@ seven sink_3_367(volatile A&&); // { dg-message "note" }
int test3_367()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_367(ca); // { dg-error "lvalue" }
sink_3_367(cva); // { dg-error "no match" }
sink_3_367(source()); // { dg-error "ambiguous" }
@@ -697,9 +697,9 @@ eight sink_3_368(const volatile A&&); // { dg-message "" }
int test3_368()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_368(ca); // { dg-error "lvalue" }
sink_3_368(cva); // { dg-error "lvalue" }
return 0;
@@ -712,9 +712,9 @@ eight sink_3_378(const volatile A&&); // { dg-message "" }
int test3_378()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_378(ca); // { dg-error "lvalue" }
sink_3_378(cva); // { dg-error "lvalue" }
return 0;
@@ -727,9 +727,9 @@ six sink_3_456(const A&&); // { dg-message "note" }
int test3_456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_456(v_source()); // { dg-error "no match" }
sink_3_456(cv_source()); // { dg-error "no match" }
return 0;
@@ -742,9 +742,9 @@ seven sink_3_457(volatile A&&); // { dg-message "note" }
int test3_457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_457(c_source()); // { dg-error "no match" }
sink_3_457(cv_source()); // { dg-error "no match" }
return 0;
@@ -757,9 +757,9 @@ seven sink_3_467(volatile A&&); // { dg-message "note" }
int test3_467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_467(source()); // { dg-error "ambiguous" }
sink_3_467(cv_source()); // { dg-error "no match" }
return 0;
@@ -772,9 +772,9 @@ seven sink_3_567(volatile A&&); // { dg-message "" }
int test3_567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_567(a); // { dg-error "lvalue" }
sink_3_567(ca); // { dg-error "lvalue" }
sink_3_567(va); // { dg-error "lvalue" }
@@ -790,9 +790,9 @@ eight sink_3_568(const volatile A&&); // { dg-message "" }
int test3_568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_568(a); // { dg-error "lvalue" }
sink_3_568(ca); // { dg-error "lvalue" }
sink_3_568(va); // { dg-error "lvalue" }
@@ -807,9 +807,9 @@ eight sink_3_578(const volatile A&&); // { dg-message "" }
int test3_578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_578(a); // { dg-error "lvalue" }
sink_3_578(ca); // { dg-error "lvalue" }
sink_3_578(va); // { dg-error "lvalue" }
@@ -824,9 +824,9 @@ eight sink_3_678(const volatile A&&); // { dg-message "" }
int test3_678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_3_678(a); // { dg-error "ambiguous" }
sink_3_678(ca); // { dg-error "lvalue" }
sink_3_678(va); // { dg-error "lvalue" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3p.C b/gcc/testsuite/g++.dg/cpp0x/rv3p.C
index 5ab171f2655..5f59920bba6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3p.C
@@ -37,9 +37,9 @@ three sink_3_123(volatile A&);
int test3_123()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_123(a)) == 1> t1;
sa<sizeof(sink_3_123(ca)) == 2> t2;
sa<sizeof(sink_3_123(va)) == 3> t3;
@@ -55,9 +55,9 @@ four sink_3_124(const volatile A&);
int test3_124()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_124(a)) == 1> t1;
sa<sizeof(sink_3_124(ca)) == 2> t2;
sa<sizeof(sink_3_124(va)) == 4> t3;
@@ -74,9 +74,9 @@ five sink_3_125( A&&);
int test3_125()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_125(a)) == 1> t1;
sa<sizeof(sink_3_125(ca)) == 2> t2;
sa<sizeof(sink_3_125(source())) == 5> t5;
@@ -91,9 +91,9 @@ six sink_3_126(const A&&);
int test3_126()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_126(a)) == 1> t1;
sa<sizeof(sink_3_126(ca)) == 2> t2;
sa<sizeof(sink_3_126(source())) == 6> t5;
@@ -108,9 +108,9 @@ seven sink_3_127(volatile A&&);
int test3_127()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_127(a)) == 1> t1;
sa<sizeof(sink_3_127(ca)) == 2> t2;
sa<sizeof(sink_3_127(source())) == 7> t5;
@@ -126,9 +126,9 @@ eight sink_3_128(const volatile A&&);
int test3_128()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_128(a)) == 1> t1;
sa<sizeof(sink_3_128(ca)) == 2> t2;
sa<sizeof(sink_3_128(source())) == 8> t5;
@@ -145,9 +145,9 @@ four sink_3_134(const volatile A&);
int test3_134()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_134(a)) == 1> t1;
sa<sizeof(sink_3_134(ca)) == 4> t2;
sa<sizeof(sink_3_134(va)) == 3> t3;
@@ -162,9 +162,9 @@ five sink_3_135( A&&);
int test3_135()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_135(a)) == 1> t1;
sa<sizeof(sink_3_135(va)) == 3> t3;
sa<sizeof(sink_3_135(source())) == 5> t5;
@@ -178,9 +178,9 @@ six sink_3_136(const A&&);
int test3_136()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_136(a)) == 1> t1;
sa<sizeof(sink_3_136(va)) == 3> t3;
sa<sizeof(sink_3_136(source())) == 6> t5;
@@ -195,9 +195,9 @@ seven sink_3_137(volatile A&&);
int test3_137()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_137(a)) == 1> t1;
sa<sizeof(sink_3_137(va)) == 3> t3;
sa<sizeof(sink_3_137(source())) == 7> t5;
@@ -212,9 +212,9 @@ eight sink_3_138(const volatile A&&);
int test3_138()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_138(a)) == 1> t1;
sa<sizeof(sink_3_138(va)) == 3> t3;
sa<sizeof(sink_3_138(source())) == 8> t5;
@@ -231,9 +231,9 @@ five sink_3_145( A&&);
int test3_145()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_145(a)) == 1> t1;
sa<sizeof(sink_3_145(ca)) == 4> t2;
sa<sizeof(sink_3_145(va)) == 4> t3;
@@ -249,9 +249,9 @@ six sink_3_146(const A&&);
int test3_146()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_146(a)) == 1> t1;
sa<sizeof(sink_3_146(ca)) == 4> t2;
sa<sizeof(sink_3_146(va)) == 4> t3;
@@ -268,9 +268,9 @@ seven sink_3_147(volatile A&&);
int test3_147()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_147(a)) == 1> t1;
sa<sizeof(sink_3_147(ca)) == 4> t2;
sa<sizeof(sink_3_147(va)) == 4> t3;
@@ -287,9 +287,9 @@ eight sink_3_148(const volatile A&&);
int test3_148()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_148(a)) == 1> t1;
sa<sizeof(sink_3_148(ca)) == 4> t2;
sa<sizeof(sink_3_148(va)) == 4> t3;
@@ -308,9 +308,9 @@ six sink_3_156(const A&&);
int test3_156()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_156(a)) == 1> t1;
sa<sizeof(sink_3_156(source())) == 5> t5;
sa<sizeof(sink_3_156(c_source())) == 6> t6;
@@ -324,9 +324,9 @@ seven sink_3_157(volatile A&&);
int test3_157()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_157(a)) == 1> t1;
sa<sizeof(sink_3_157(source())) == 5> t5;
sa<sizeof(sink_3_157(v_source())) == 7> t7;
@@ -340,9 +340,9 @@ eight sink_3_158(const volatile A&&);
int test3_158()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_158(a)) == 1> t1;
sa<sizeof(sink_3_158(source())) == 5> t5;
sa<sizeof(sink_3_158(c_source())) == 8> t6;
@@ -358,9 +358,9 @@ seven sink_3_167(volatile A&&);
int test3_167()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_167(a)) == 1> t1;
sa<sizeof(sink_3_167(c_source())) == 6> t6;
sa<sizeof(sink_3_167(v_source())) == 7> t7;
@@ -374,9 +374,9 @@ eight sink_3_168(const volatile A&&);
int test3_168()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_168(a)) == 1> t1;
sa<sizeof(sink_3_168(source())) == 6> t5;
sa<sizeof(sink_3_168(c_source())) == 6> t6;
@@ -392,9 +392,9 @@ eight sink_3_178(const volatile A&&);
int test3_178()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_178(a)) == 1> t1;
sa<sizeof(sink_3_178(source())) == 7> t5;
sa<sizeof(sink_3_178(c_source())) == 8> t6;
@@ -410,9 +410,9 @@ four sink_3_234(const volatile A&);
int test3_234()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_234(ca)) == 2> t2;
sa<sizeof(sink_3_234(va)) == 3> t3;
sa<sizeof(sink_3_234(cva)) == 4> t4;
@@ -428,9 +428,9 @@ five sink_3_235( A&&);
int test3_235()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_235(ca)) == 2> t2;
sa<sizeof(sink_3_235(va)) == 3> t3;
sa<sizeof(sink_3_235(source())) == 5> t5;
@@ -445,9 +445,9 @@ six sink_3_236(const A&&);
int test3_236()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_236(ca)) == 2> t2;
sa<sizeof(sink_3_236(va)) == 3> t3;
sa<sizeof(sink_3_236(source())) == 6> t5;
@@ -462,9 +462,9 @@ seven sink_3_237(volatile A&&);
int test3_237()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_237(ca)) == 2> t2;
sa<sizeof(sink_3_237(va)) == 3> t3;
sa<sizeof(sink_3_237(source())) == 7> t5;
@@ -480,9 +480,9 @@ eight sink_3_238(const volatile A&&);
int test3_238()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_238(ca)) == 2> t2;
sa<sizeof(sink_3_238(va)) == 3> t3;
sa<sizeof(sink_3_238(source())) == 8> t5;
@@ -499,9 +499,9 @@ five sink_3_245( A&&);
int test3_245()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_245(a)) == 2> t1;
sa<sizeof(sink_3_245(ca)) == 2> t2;
sa<sizeof(sink_3_245(va)) == 4> t3;
@@ -518,9 +518,9 @@ six sink_3_246(const A&&);
int test3_246()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_246(a)) == 2> t1;
sa<sizeof(sink_3_246(ca)) == 2> t2;
sa<sizeof(sink_3_246(va)) == 4> t3;
@@ -537,9 +537,9 @@ seven sink_3_247(volatile A&&);
int test3_247()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_247(a)) == 2> t1;
sa<sizeof(sink_3_247(ca)) == 2> t2;
sa<sizeof(sink_3_247(va)) == 4> t3;
@@ -557,9 +557,9 @@ eight sink_3_248(const volatile A&&);
int test3_248()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_248(a)) == 2> t1;
sa<sizeof(sink_3_248(ca)) == 2> t2;
sa<sizeof(sink_3_248(va)) == 4> t3;
@@ -578,9 +578,9 @@ six sink_3_256(const A&&);
int test3_256()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_256(a)) == 2> t1;
sa<sizeof(sink_3_256(ca)) == 2> t2;
sa<sizeof(sink_3_256(source())) == 5> t5;
@@ -595,9 +595,9 @@ seven sink_3_257(volatile A&&);
int test3_257()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_257(a)) == 2> t1;
sa<sizeof(sink_3_257(ca)) == 2> t2;
sa<sizeof(sink_3_257(source())) == 5> t5;
@@ -613,9 +613,9 @@ eight sink_3_258(const volatile A&&);
int test3_258()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_258(a)) == 2> t1;
sa<sizeof(sink_3_258(ca)) == 2> t2;
sa<sizeof(sink_3_258(source())) == 5> t5;
@@ -632,9 +632,9 @@ seven sink_3_267(volatile A&&);
int test3_267()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_267(a)) == 2> t1;
sa<sizeof(sink_3_267(ca)) == 2> t2;
sa<sizeof(sink_3_267(c_source())) == 6> t6;
@@ -649,9 +649,9 @@ eight sink_3_268(const volatile A&&);
int test3_268()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_268(a)) == 2> t1;
sa<sizeof(sink_3_268(ca)) == 2> t2;
sa<sizeof(sink_3_268(source())) == 6> t5;
@@ -668,9 +668,9 @@ eight sink_3_278(const volatile A&&);
int test3_278()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_278(a)) == 2> t1;
sa<sizeof(sink_3_278(ca)) == 2> t2;
sa<sizeof(sink_3_278(source())) == 7> t5;
@@ -687,9 +687,9 @@ five sink_3_345( A&&);
int test3_345()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_345(a)) == 3> t1;
sa<sizeof(sink_3_345(ca)) == 4> t2;
sa<sizeof(sink_3_345(va)) == 3> t3;
@@ -705,9 +705,9 @@ six sink_3_346(const A&&);
int test3_346()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_346(a)) == 3> t1;
sa<sizeof(sink_3_346(ca)) == 4> t2;
sa<sizeof(sink_3_346(va)) == 3> t3;
@@ -724,9 +724,9 @@ seven sink_3_347(volatile A&&);
int test3_347()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_347(a)) == 3> t1;
sa<sizeof(sink_3_347(ca)) == 4> t2;
sa<sizeof(sink_3_347(va)) == 3> t3;
@@ -743,9 +743,9 @@ eight sink_3_348(const volatile A&&);
int test3_348()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_348(a)) == 3> t1;
sa<sizeof(sink_3_348(ca)) == 4> t2;
sa<sizeof(sink_3_348(va)) == 3> t3;
@@ -764,9 +764,9 @@ six sink_3_356(const A&&);
int test3_356()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_356(a)) == 3> t1;
sa<sizeof(sink_3_356(va)) == 3> t3;
sa<sizeof(sink_3_356(source())) == 5> t5;
@@ -781,9 +781,9 @@ seven sink_3_357(volatile A&&);
int test3_357()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_357(a)) == 3> t1;
sa<sizeof(sink_3_357(va)) == 3> t3;
sa<sizeof(sink_3_357(source())) == 5> t5;
@@ -798,9 +798,9 @@ eight sink_3_358(const volatile A&&);
int test3_358()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_358(a)) == 3> t1;
sa<sizeof(sink_3_358(va)) == 3> t3;
sa<sizeof(sink_3_358(source())) == 5> t5;
@@ -817,9 +817,9 @@ seven sink_3_367(volatile A&&);
int test3_367()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_367(a)) == 3> t1;
sa<sizeof(sink_3_367(va)) == 3> t3;
sa<sizeof(sink_3_367(c_source())) == 6> t6;
@@ -834,9 +834,9 @@ eight sink_3_368(const volatile A&&);
int test3_368()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_368(a)) == 3> t1;
sa<sizeof(sink_3_368(va)) == 3> t3;
sa<sizeof(sink_3_368(source())) == 6> t5;
@@ -853,9 +853,9 @@ eight sink_3_378(const volatile A&&);
int test3_378()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_378(a)) == 3> t1;
sa<sizeof(sink_3_378(va)) == 3> t3;
sa<sizeof(sink_3_378(source())) == 7> t5;
@@ -872,9 +872,9 @@ six sink_3_456(const A&&);
int test3_456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_456(a)) == 4> t1;
sa<sizeof(sink_3_456(ca)) == 4> t2;
sa<sizeof(sink_3_456(va)) == 4> t3;
@@ -891,9 +891,9 @@ seven sink_3_457(volatile A&&);
int test3_457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_457(a)) == 4> t1;
sa<sizeof(sink_3_457(ca)) == 4> t2;
sa<sizeof(sink_3_457(va)) == 4> t3;
@@ -910,9 +910,9 @@ eight sink_3_458(const volatile A&&);
int test3_458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_458(a)) == 4> t1;
sa<sizeof(sink_3_458(ca)) == 4> t2;
sa<sizeof(sink_3_458(va)) == 4> t3;
@@ -931,9 +931,9 @@ seven sink_3_467(volatile A&&);
int test3_467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_467(a)) == 4> t1;
sa<sizeof(sink_3_467(ca)) == 4> t2;
sa<sizeof(sink_3_467(va)) == 4> t3;
@@ -950,9 +950,9 @@ eight sink_3_468(const volatile A&&);
int test3_468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_468(a)) == 4> t1;
sa<sizeof(sink_3_468(ca)) == 4> t2;
sa<sizeof(sink_3_468(va)) == 4> t3;
@@ -971,9 +971,9 @@ eight sink_3_478(const volatile A&&);
int test3_478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_478(a)) == 4> t1;
sa<sizeof(sink_3_478(ca)) == 4> t2;
sa<sizeof(sink_3_478(va)) == 4> t3;
@@ -992,9 +992,9 @@ seven sink_3_567(volatile A&&);
int test3_567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_567(source())) == 5> t5;
sa<sizeof(sink_3_567(c_source())) == 6> t6;
sa<sizeof(sink_3_567(v_source())) == 7> t7;
@@ -1008,9 +1008,9 @@ eight sink_3_568(const volatile A&&);
int test3_568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_568(source())) == 5> t5;
sa<sizeof(sink_3_568(c_source())) == 6> t6;
sa<sizeof(sink_3_568(v_source())) == 8> t7;
@@ -1025,9 +1025,9 @@ eight sink_3_578(const volatile A&&);
int test3_578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_578(source())) == 5> t5;
sa<sizeof(sink_3_578(c_source())) == 8> t6;
sa<sizeof(sink_3_578(v_source())) == 7> t7;
@@ -1042,9 +1042,9 @@ eight sink_3_678(const volatile A&&);
int test3_678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_3_678(c_source())) == 6> t6;
sa<sizeof(sink_3_678(v_source())) == 7> t7;
sa<sizeof(sink_3_678(cv_source())) == 8> t8;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv4n.C b/gcc/testsuite/g++.dg/cpp0x/rv4n.C
index cf627aed3f0..524885f1d60 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv4n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv4n.C
@@ -20,7 +20,7 @@ struct eight {char x[8];};
struct A
{
A();
- A(const volatile A&&);
+ A(const volatile A&&); // { dg-error "argument 1" }
};
A source();
@@ -38,9 +38,9 @@ four sink_4_1234(const volatile A&); // { dg-message "note" }
int test4_1234()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1234(v_source()); // { dg-error "no match" }
sink_4_1234(cv_source()); // { dg-error "no match" }
return 0;
@@ -54,9 +54,9 @@ five sink_4_1235( A&&); // { dg-message "note" }
int test4_1235()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1235(cva); // { dg-error "no match" }
sink_4_1235(v_source()); // { dg-error "no match" }
sink_4_1235(cv_source()); // { dg-error "no match" }
@@ -71,9 +71,9 @@ six sink_4_1236(const A&&); // { dg-message "note" }
int test4_1236()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1236(cva); // { dg-error "no match" }
sink_4_1236(v_source()); // { dg-error "no match" }
sink_4_1236(cv_source()); // { dg-error "no match" }
@@ -88,9 +88,9 @@ seven sink_4_1237(volatile A&&); // { dg-message "note" }
int test4_1237()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1237(cva); // { dg-error "no match" }
sink_4_1237(cv_source()); // { dg-error "no match" }
return 0;
@@ -104,9 +104,9 @@ eight sink_4_1238(const volatile A&&); // { dg-message "" }
int test4_1238()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1238(cva); // { dg-error "lvalue" }
return 0;
}
@@ -119,9 +119,9 @@ five sink_4_1245( A&&); // { dg-message "note" }
int test4_1245()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1245(v_source()); // { dg-error "no match" }
sink_4_1245(cv_source()); // { dg-error "no match" }
return 0;
@@ -135,9 +135,9 @@ six sink_4_1246(const A&&); // { dg-message "note" }
int test4_1246()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1246(v_source()); // { dg-error "no match" }
sink_4_1246(cv_source()); // { dg-error "no match" }
return 0;
@@ -151,9 +151,9 @@ seven sink_4_1247(volatile A&&); // { dg-message "note" }
int test4_1247()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1247(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -166,9 +166,9 @@ six sink_4_1256(const A&&); // { dg-message "note" }
int test4_1256()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1256(va); // { dg-error "no match" }
sink_4_1256(cva); // { dg-error "no match" }
sink_4_1256(v_source()); // { dg-error "no match" }
@@ -184,9 +184,9 @@ seven sink_4_1257(volatile A&&); // { dg-message "" }
int test4_1257()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1257(va); // { dg-error "lvalue" }
sink_4_1257(cva); // { dg-error "no match" }
sink_4_1257(cv_source()); // { dg-error "no match" }
@@ -201,9 +201,9 @@ eight sink_4_1258(const volatile A&&); // { dg-message "" }
int test4_1258()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1258(va); // { dg-error "lvalue" }
sink_4_1258(cva); // { dg-error "lvalue" }
return 0;
@@ -217,9 +217,9 @@ seven sink_4_1267(volatile A&&); // { dg-message "" }
int test4_1267()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1267(va); // { dg-error "lvalue" }
sink_4_1267(cva); // { dg-error "no match" }
sink_4_1267(source()); // { dg-error "ambiguous" }
@@ -235,9 +235,9 @@ eight sink_4_1268(const volatile A&&); // { dg-message "" }
int test4_1268()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1268(va); // { dg-error "lvalue" }
sink_4_1268(cva); // { dg-error "lvalue" }
return 0;
@@ -251,9 +251,9 @@ eight sink_4_1278(const volatile A&&); // { dg-message "" }
int test4_1278()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1278(va); // { dg-error "lvalue" }
sink_4_1278(cva); // { dg-error "lvalue" }
return 0;
@@ -267,9 +267,9 @@ five sink_4_1345( A&&); // { dg-message "note" }
int test4_1345()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1345(c_source()); // { dg-error "no match" }
sink_4_1345(v_source()); // { dg-error "no match" }
sink_4_1345(cv_source()); // { dg-error "no match" }
@@ -284,9 +284,9 @@ six sink_4_1346(const A&&); // { dg-message "note" }
int test4_1346()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1346(v_source()); // { dg-error "no match" }
sink_4_1346(cv_source()); // { dg-error "no match" }
return 0;
@@ -300,9 +300,9 @@ seven sink_4_1347(volatile A&&); // { dg-message "note" }
int test4_1347()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1347(c_source()); // { dg-error "no match" }
sink_4_1347(cv_source()); // { dg-error "no match" }
return 0;
@@ -316,9 +316,9 @@ six sink_4_1356(const A&&); // { dg-message "" }
int test4_1356()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1356(ca); // { dg-error "lvalue" }
sink_4_1356(cva); // { dg-error "no match" }
sink_4_1356(v_source()); // { dg-error "no match" }
@@ -334,9 +334,9 @@ seven sink_4_1357(volatile A&&); // { dg-message "note" }
int test4_1357()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1357(ca); // { dg-error "no match" }
sink_4_1357(cva); // { dg-error "no match" }
sink_4_1357(c_source()); // { dg-error "no match" }
@@ -352,9 +352,9 @@ eight sink_4_1358(const volatile A&&); // { dg-message "" }
int test4_1358()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1358(ca); // { dg-error "lvalue" }
sink_4_1358(cva); // { dg-error "lvalue" }
return 0;
@@ -368,9 +368,9 @@ seven sink_4_1367(volatile A&&); // { dg-message "note" }
int test4_1367()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1367(ca); // { dg-error "lvalue" }
sink_4_1367(cva); // { dg-error "no match" }
sink_4_1367(source()); // { dg-error "ambiguous" }
@@ -386,9 +386,9 @@ eight sink_4_1368(const volatile A&&); // { dg-message "" }
int test4_1368()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1368(ca); // { dg-error "lvalue" }
sink_4_1368(cva); // { dg-error "lvalue" }
return 0;
@@ -402,9 +402,9 @@ eight sink_4_1378(const volatile A&&); // { dg-message "" }
int test4_1378()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1378(ca); // { dg-error "lvalue" }
sink_4_1378(cva); // { dg-error "lvalue" }
return 0;
@@ -418,9 +418,9 @@ six sink_4_1456(const A&&); // { dg-message "note" }
int test4_1456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1456(v_source()); // { dg-error "no match" }
sink_4_1456(cv_source()); // { dg-error "no match" }
return 0;
@@ -434,9 +434,9 @@ seven sink_4_1457(volatile A&&); // { dg-message "note" }
int test4_1457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1457(c_source()); // { dg-error "no match" }
sink_4_1457(cv_source()); // { dg-error "no match" }
return 0;
@@ -450,9 +450,9 @@ seven sink_4_1467(volatile A&&); // { dg-message "note" }
int test4_1467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1467(source()); // { dg-error "ambiguous" }
sink_4_1467(cv_source()); // { dg-error "no match" }
return 0;
@@ -466,9 +466,9 @@ seven sink_4_1567(volatile A&&); // { dg-message "" }
int test4_1567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1567(ca); // { dg-error "lvalue" }
sink_4_1567(va); // { dg-error "lvalue" }
sink_4_1567(cva); // { dg-error "no match" }
@@ -484,9 +484,9 @@ eight sink_4_1568(const volatile A&&); // { dg-message "" }
int test4_1568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1568(ca); // { dg-error "lvalue" }
sink_4_1568(va); // { dg-error "lvalue" }
sink_4_1568(cva); // { dg-error "lvalue" }
@@ -501,9 +501,9 @@ eight sink_4_1578(const volatile A&&); // { dg-message "" }
int test4_1578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1578(ca); // { dg-error "lvalue" }
sink_4_1578(va); // { dg-error "lvalue" }
sink_4_1578(cva); // { dg-error "lvalue" }
@@ -518,9 +518,9 @@ eight sink_4_1678(const volatile A&&); // { dg-message "" }
int test4_1678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_1678(ca); // { dg-error "lvalue" }
sink_4_1678(va); // { dg-error "lvalue" }
sink_4_1678(cva); // { dg-error "lvalue" }
@@ -536,9 +536,9 @@ five sink_4_2345( A&&); // { dg-message "note" }
int test4_2345()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2345(a); // { dg-error "ambiguous" }
sink_4_2345(v_source()); // { dg-error "no match" }
sink_4_2345(cv_source()); // { dg-error "no match" }
@@ -553,9 +553,9 @@ six sink_4_2346(const A&&); // { dg-message "note" }
int test4_2346()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2346(a); // { dg-error "ambiguous" }
sink_4_2346(v_source()); // { dg-error "no match" }
sink_4_2346(cv_source()); // { dg-error "no match" }
@@ -570,9 +570,9 @@ seven sink_4_2347(volatile A&&); // { dg-message "note" }
int test4_2347()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2347(a); // { dg-error "ambiguous" }
sink_4_2347(cv_source()); // { dg-error "no match" }
return 0;
@@ -586,9 +586,9 @@ eight sink_4_2348(const volatile A&&); // { dg-message "note" }
int test4_2348()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2348(a); // { dg-error "ambiguous" }
return 0;
}
@@ -601,9 +601,9 @@ six sink_4_2356(const A&&); // { dg-message "note" }
int test4_2356()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2356(a); // { dg-error "ambiguous" }
sink_4_2356(cva); // { dg-error "no match" }
sink_4_2356(v_source()); // { dg-error "no match" }
@@ -619,9 +619,9 @@ seven sink_4_2357(volatile A&&); // { dg-message "note" }
int test4_2357()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2357(a); // { dg-error "ambiguous" }
sink_4_2357(cva); // { dg-error "no match" }
sink_4_2357(cv_source()); // { dg-error "no match" }
@@ -636,9 +636,9 @@ eight sink_4_2358(const volatile A&&); // { dg-message "" }
int test4_2358()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2358(a); // { dg-error "ambiguous" }
sink_4_2358(cva); // { dg-error "lvalue" }
return 0;
@@ -652,9 +652,9 @@ seven sink_4_2367(volatile A&&); // { dg-message "note" }
int test4_2367()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2367(a); // { dg-error "ambiguous" }
sink_4_2367(cva); // { dg-error "no match" }
sink_4_2367(source()); // { dg-error "ambiguous" }
@@ -670,9 +670,9 @@ eight sink_4_2368(const volatile A&&); // { dg-message "" }
int test4_2368()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2368(a); // { dg-error "ambiguous" }
sink_4_2368(cva); // { dg-error "lvalue" }
return 0;
@@ -686,9 +686,9 @@ eight sink_4_2378(const volatile A&&); // { dg-message "" }
int test4_2378()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2378(a); // { dg-error "ambiguous" }
sink_4_2378(cva); // { dg-error "lvalue" }
return 0;
@@ -702,9 +702,9 @@ six sink_4_2456(const A&&); // { dg-message "note" }
int test4_2456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2456(v_source()); // { dg-error "no match" }
sink_4_2456(cv_source()); // { dg-error "no match" }
return 0;
@@ -718,9 +718,9 @@ seven sink_4_2457(volatile A&&); // { dg-message "note" }
int test4_2457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2457(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -733,9 +733,9 @@ seven sink_4_2467(volatile A&&); // { dg-message "note" }
int test4_2467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2467(source()); // { dg-error "ambiguous" }
sink_4_2467(cv_source()); // { dg-error "no match" }
return 0;
@@ -749,9 +749,9 @@ seven sink_4_2567(volatile A&&); // { dg-message "" }
int test4_2567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2567(va); // { dg-error "lvalue" }
sink_4_2567(cva); // { dg-error "no match" }
sink_4_2567(cv_source()); // { dg-error "no match" }
@@ -766,9 +766,9 @@ eight sink_4_2568(const volatile A&&); // { dg-message "" }
int test4_2568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2568(va); // { dg-error "lvalue" }
sink_4_2568(cva); // { dg-error "lvalue" }
return 0;
@@ -782,9 +782,9 @@ eight sink_4_2578(const volatile A&&); // { dg-message "" }
int test4_2578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2578(va); // { dg-error "lvalue" }
sink_4_2578(cva); // { dg-error "lvalue" }
return 0;
@@ -798,9 +798,9 @@ eight sink_4_2678(const volatile A&&); // { dg-message "" }
int test4_2678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_2678(va); // { dg-error "lvalue" }
sink_4_2678(cva); // { dg-error "lvalue" }
sink_4_2678(source()); // { dg-error "ambiguous" }
@@ -815,9 +815,9 @@ six sink_4_3456(const A&&); // { dg-message "note" }
int test4_3456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_3456(v_source()); // { dg-error "no match" }
sink_4_3456(cv_source()); // { dg-error "no match" }
return 0;
@@ -831,9 +831,9 @@ seven sink_4_3457(volatile A&&); // { dg-message "note" }
int test4_3457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_3457(c_source()); // { dg-error "no match" }
sink_4_3457(cv_source()); // { dg-error "no match" }
return 0;
@@ -847,9 +847,9 @@ seven sink_4_3467(volatile A&&); // { dg-message "note" }
int test4_3467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_3467(source()); // { dg-error "ambiguous" }
sink_4_3467(cv_source()); // { dg-error "no match" }
return 0;
@@ -863,9 +863,9 @@ seven sink_4_3567(volatile A&&); // { dg-message "note" }
int test4_3567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_3567(ca); // { dg-error "lvalue" }
sink_4_3567(cva); // { dg-error "no match" }
sink_4_3567(cv_source()); // { dg-error "no match" }
@@ -880,9 +880,9 @@ eight sink_4_3568(const volatile A&&); // { dg-message "" }
int test4_3568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_3568(ca); // { dg-error "lvalue" }
sink_4_3568(cva); // { dg-error "lvalue" }
return 0;
@@ -896,9 +896,9 @@ eight sink_4_3578(const volatile A&&); // { dg-message "" }
int test4_3578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_3578(ca); // { dg-error "lvalue" }
sink_4_3578(cva); // { dg-error "lvalue" }
return 0;
@@ -912,9 +912,9 @@ eight sink_4_3678(const volatile A&&); // { dg-message "" }
int test4_3678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_3678(ca); // { dg-error "lvalue" }
sink_4_3678(cva); // { dg-error "lvalue" }
sink_4_3678(source()); // { dg-error "ambiguous" }
@@ -929,9 +929,9 @@ seven sink_4_4567(volatile A&&); // { dg-message "note" }
int test4_4567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_4567(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -944,9 +944,9 @@ eight sink_4_4678(const volatile A&&); // { dg-message "note" }
int test4_4678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_4678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -959,9 +959,9 @@ eight sink_4_5678(const volatile A&&); // { dg-message "" }
int test4_5678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_4_5678(a); // { dg-error "lvalue" }
sink_4_5678(ca); // { dg-error "lvalue" }
sink_4_5678(va); // { dg-error "lvalue" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv4p.C b/gcc/testsuite/g++.dg/cpp0x/rv4p.C
index 03ad9734614..33a90f854d1 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv4p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv4p.C
@@ -38,9 +38,9 @@ four sink_4_1234(const volatile A&);
int test4_1234()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1234(a)) == 1> t1;
sa<sizeof(sink_4_1234(ca)) == 2> t2;
sa<sizeof(sink_4_1234(va)) == 3> t3;
@@ -58,9 +58,9 @@ five sink_4_1235( A&&);
int test4_1235()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1235(a)) == 1> t1;
sa<sizeof(sink_4_1235(ca)) == 2> t2;
sa<sizeof(sink_4_1235(va)) == 3> t3;
@@ -77,9 +77,9 @@ six sink_4_1236(const A&&);
int test4_1236()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1236(a)) == 1> t1;
sa<sizeof(sink_4_1236(ca)) == 2> t2;
sa<sizeof(sink_4_1236(va)) == 3> t3;
@@ -96,9 +96,9 @@ seven sink_4_1237(volatile A&&);
int test4_1237()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1237(a)) == 1> t1;
sa<sizeof(sink_4_1237(ca)) == 2> t2;
sa<sizeof(sink_4_1237(va)) == 3> t3;
@@ -116,9 +116,9 @@ eight sink_4_1238(const volatile A&&);
int test4_1238()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1238(a)) == 1> t1;
sa<sizeof(sink_4_1238(ca)) == 2> t2;
sa<sizeof(sink_4_1238(va)) == 3> t3;
@@ -137,9 +137,9 @@ five sink_4_1245( A&&);
int test4_1245()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1245(a)) == 1> t1;
sa<sizeof(sink_4_1245(ca)) == 2> t2;
sa<sizeof(sink_4_1245(va)) == 4> t3;
@@ -157,9 +157,9 @@ six sink_4_1246(const A&&);
int test4_1246()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1246(a)) == 1> t1;
sa<sizeof(sink_4_1246(ca)) == 2> t2;
sa<sizeof(sink_4_1246(va)) == 4> t3;
@@ -177,9 +177,9 @@ seven sink_4_1247(volatile A&&);
int test4_1247()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1247(a)) == 1> t1;
sa<sizeof(sink_4_1247(ca)) == 2> t2;
sa<sizeof(sink_4_1247(va)) == 4> t3;
@@ -198,9 +198,9 @@ eight sink_4_1248(const volatile A&&);
int test4_1248()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1248(a)) == 1> t1;
sa<sizeof(sink_4_1248(ca)) == 2> t2;
sa<sizeof(sink_4_1248(va)) == 4> t3;
@@ -220,9 +220,9 @@ six sink_4_1256(const A&&);
int test4_1256()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1256(a)) == 1> t1;
sa<sizeof(sink_4_1256(ca)) == 2> t2;
sa<sizeof(sink_4_1256(source())) == 5> t5;
@@ -238,9 +238,9 @@ seven sink_4_1257(volatile A&&);
int test4_1257()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1257(a)) == 1> t1;
sa<sizeof(sink_4_1257(ca)) == 2> t2;
sa<sizeof(sink_4_1257(source())) == 5> t5;
@@ -257,9 +257,9 @@ eight sink_4_1258(const volatile A&&);
int test4_1258()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1258(a)) == 1> t1;
sa<sizeof(sink_4_1258(ca)) == 2> t2;
sa<sizeof(sink_4_1258(source())) == 5> t5;
@@ -277,9 +277,9 @@ seven sink_4_1267(volatile A&&);
int test4_1267()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1267(a)) == 1> t1;
sa<sizeof(sink_4_1267(ca)) == 2> t2;
sa<sizeof(sink_4_1267(c_source())) == 6> t6;
@@ -295,9 +295,9 @@ eight sink_4_1268(const volatile A&&);
int test4_1268()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1268(a)) == 1> t1;
sa<sizeof(sink_4_1268(ca)) == 2> t2;
sa<sizeof(sink_4_1268(source())) == 6> t5;
@@ -315,9 +315,9 @@ eight sink_4_1278(const volatile A&&);
int test4_1278()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1278(a)) == 1> t1;
sa<sizeof(sink_4_1278(ca)) == 2> t2;
sa<sizeof(sink_4_1278(source())) == 7> t5;
@@ -335,9 +335,9 @@ five sink_4_1345( A&&);
int test4_1345()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1345(a)) == 1> t1;
sa<sizeof(sink_4_1345(ca)) == 4> t2;
sa<sizeof(sink_4_1345(va)) == 3> t3;
@@ -354,9 +354,9 @@ six sink_4_1346(const A&&);
int test4_1346()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1346(a)) == 1> t1;
sa<sizeof(sink_4_1346(ca)) == 4> t2;
sa<sizeof(sink_4_1346(va)) == 3> t3;
@@ -374,9 +374,9 @@ seven sink_4_1347(volatile A&&);
int test4_1347()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1347(a)) == 1> t1;
sa<sizeof(sink_4_1347(ca)) == 4> t2;
sa<sizeof(sink_4_1347(va)) == 3> t3;
@@ -394,9 +394,9 @@ eight sink_4_1348(const volatile A&&);
int test4_1348()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1348(a)) == 1> t1;
sa<sizeof(sink_4_1348(ca)) == 4> t2;
sa<sizeof(sink_4_1348(va)) == 3> t3;
@@ -416,9 +416,9 @@ six sink_4_1356(const A&&);
int test4_1356()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1356(a)) == 1> t1;
sa<sizeof(sink_4_1356(va)) == 3> t3;
sa<sizeof(sink_4_1356(source())) == 5> t5;
@@ -434,9 +434,9 @@ seven sink_4_1357(volatile A&&);
int test4_1357()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1357(a)) == 1> t1;
sa<sizeof(sink_4_1357(va)) == 3> t3;
sa<sizeof(sink_4_1357(source())) == 5> t5;
@@ -452,9 +452,9 @@ eight sink_4_1358(const volatile A&&);
int test4_1358()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1358(a)) == 1> t1;
sa<sizeof(sink_4_1358(va)) == 3> t3;
sa<sizeof(sink_4_1358(source())) == 5> t5;
@@ -472,9 +472,9 @@ seven sink_4_1367(volatile A&&);
int test4_1367()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1367(a)) == 1> t1;
sa<sizeof(sink_4_1367(va)) == 3> t3;
sa<sizeof(sink_4_1367(c_source())) == 6> t6;
@@ -490,9 +490,9 @@ eight sink_4_1368(const volatile A&&);
int test4_1368()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1368(a)) == 1> t1;
sa<sizeof(sink_4_1368(va)) == 3> t3;
sa<sizeof(sink_4_1368(source())) == 6> t5;
@@ -510,9 +510,9 @@ eight sink_4_1378(const volatile A&&);
int test4_1378()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1378(a)) == 1> t1;
sa<sizeof(sink_4_1378(va)) == 3> t3;
sa<sizeof(sink_4_1378(source())) == 7> t5;
@@ -530,9 +530,9 @@ six sink_4_1456(const A&&);
int test4_1456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1456(a)) == 1> t1;
sa<sizeof(sink_4_1456(ca)) == 4> t2;
sa<sizeof(sink_4_1456(va)) == 4> t3;
@@ -550,9 +550,9 @@ seven sink_4_1457(volatile A&&);
int test4_1457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1457(a)) == 1> t1;
sa<sizeof(sink_4_1457(ca)) == 4> t2;
sa<sizeof(sink_4_1457(va)) == 4> t3;
@@ -570,9 +570,9 @@ eight sink_4_1458(const volatile A&&);
int test4_1458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1458(a)) == 1> t1;
sa<sizeof(sink_4_1458(ca)) == 4> t2;
sa<sizeof(sink_4_1458(va)) == 4> t3;
@@ -592,9 +592,9 @@ seven sink_4_1467(volatile A&&);
int test4_1467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1467(a)) == 1> t1;
sa<sizeof(sink_4_1467(ca)) == 4> t2;
sa<sizeof(sink_4_1467(va)) == 4> t3;
@@ -612,9 +612,9 @@ eight sink_4_1468(const volatile A&&);
int test4_1468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1468(a)) == 1> t1;
sa<sizeof(sink_4_1468(ca)) == 4> t2;
sa<sizeof(sink_4_1468(va)) == 4> t3;
@@ -634,9 +634,9 @@ eight sink_4_1478(const volatile A&&);
int test4_1478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1478(a)) == 1> t1;
sa<sizeof(sink_4_1478(ca)) == 4> t2;
sa<sizeof(sink_4_1478(va)) == 4> t3;
@@ -656,9 +656,9 @@ seven sink_4_1567(volatile A&&);
int test4_1567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1567(a)) == 1> t1;
sa<sizeof(sink_4_1567(source())) == 5> t5;
sa<sizeof(sink_4_1567(c_source())) == 6> t6;
@@ -674,9 +674,9 @@ eight sink_4_1568(const volatile A&&);
int test4_1568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1568(a)) == 1> t1;
sa<sizeof(sink_4_1568(source())) == 5> t5;
sa<sizeof(sink_4_1568(c_source())) == 6> t6;
@@ -693,9 +693,9 @@ eight sink_4_1578(const volatile A&&);
int test4_1578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1578(a)) == 1> t1;
sa<sizeof(sink_4_1578(source())) == 5> t5;
sa<sizeof(sink_4_1578(c_source())) == 8> t6;
@@ -712,9 +712,9 @@ eight sink_4_1678(const volatile A&&);
int test4_1678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_1678(a)) == 1> t1;
sa<sizeof(sink_4_1678(c_source())) == 6> t6;
sa<sizeof(sink_4_1678(v_source())) == 7> t7;
@@ -730,9 +730,9 @@ five sink_4_2345( A&&);
int test4_2345()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2345(ca)) == 2> t2;
sa<sizeof(sink_4_2345(va)) == 3> t3;
sa<sizeof(sink_4_2345(cva)) == 4> t4;
@@ -749,9 +749,9 @@ six sink_4_2346(const A&&);
int test4_2346()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2346(ca)) == 2> t2;
sa<sizeof(sink_4_2346(va)) == 3> t3;
sa<sizeof(sink_4_2346(cva)) == 4> t4;
@@ -768,9 +768,9 @@ seven sink_4_2347(volatile A&&);
int test4_2347()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2347(ca)) == 2> t2;
sa<sizeof(sink_4_2347(va)) == 3> t3;
sa<sizeof(sink_4_2347(cva)) == 4> t4;
@@ -788,9 +788,9 @@ eight sink_4_2348(const volatile A&&);
int test4_2348()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2348(ca)) == 2> t2;
sa<sizeof(sink_4_2348(va)) == 3> t3;
sa<sizeof(sink_4_2348(cva)) == 4> t4;
@@ -809,9 +809,9 @@ six sink_4_2356(const A&&);
int test4_2356()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2356(ca)) == 2> t2;
sa<sizeof(sink_4_2356(va)) == 3> t3;
sa<sizeof(sink_4_2356(source())) == 5> t5;
@@ -827,9 +827,9 @@ seven sink_4_2357(volatile A&&);
int test4_2357()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2357(ca)) == 2> t2;
sa<sizeof(sink_4_2357(va)) == 3> t3;
sa<sizeof(sink_4_2357(source())) == 5> t5;
@@ -846,9 +846,9 @@ eight sink_4_2358(const volatile A&&);
int test4_2358()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2358(ca)) == 2> t2;
sa<sizeof(sink_4_2358(va)) == 3> t3;
sa<sizeof(sink_4_2358(source())) == 5> t5;
@@ -866,9 +866,9 @@ seven sink_4_2367(volatile A&&);
int test4_2367()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2367(ca)) == 2> t2;
sa<sizeof(sink_4_2367(va)) == 3> t3;
sa<sizeof(sink_4_2367(c_source())) == 6> t6;
@@ -884,9 +884,9 @@ eight sink_4_2368(const volatile A&&);
int test4_2368()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2368(ca)) == 2> t2;
sa<sizeof(sink_4_2368(va)) == 3> t3;
sa<sizeof(sink_4_2368(source())) == 6> t5;
@@ -904,9 +904,9 @@ eight sink_4_2378(const volatile A&&);
int test4_2378()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2378(ca)) == 2> t2;
sa<sizeof(sink_4_2378(va)) == 3> t3;
sa<sizeof(sink_4_2378(source())) == 7> t5;
@@ -924,9 +924,9 @@ six sink_4_2456(const A&&);
int test4_2456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2456(a)) == 2> t1;
sa<sizeof(sink_4_2456(ca)) == 2> t2;
sa<sizeof(sink_4_2456(va)) == 4> t3;
@@ -944,9 +944,9 @@ seven sink_4_2457(volatile A&&);
int test4_2457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2457(a)) == 2> t1;
sa<sizeof(sink_4_2457(ca)) == 2> t2;
sa<sizeof(sink_4_2457(va)) == 4> t3;
@@ -965,9 +965,9 @@ eight sink_4_2458(const volatile A&&);
int test4_2458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2458(a)) == 2> t1;
sa<sizeof(sink_4_2458(ca)) == 2> t2;
sa<sizeof(sink_4_2458(va)) == 4> t3;
@@ -987,9 +987,9 @@ seven sink_4_2467(volatile A&&);
int test4_2467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2467(a)) == 2> t1;
sa<sizeof(sink_4_2467(ca)) == 2> t2;
sa<sizeof(sink_4_2467(va)) == 4> t3;
@@ -1007,9 +1007,9 @@ eight sink_4_2468(const volatile A&&);
int test4_2468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2468(a)) == 2> t1;
sa<sizeof(sink_4_2468(ca)) == 2> t2;
sa<sizeof(sink_4_2468(va)) == 4> t3;
@@ -1029,9 +1029,9 @@ eight sink_4_2478(const volatile A&&);
int test4_2478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2478(a)) == 2> t1;
sa<sizeof(sink_4_2478(ca)) == 2> t2;
sa<sizeof(sink_4_2478(va)) == 4> t3;
@@ -1051,9 +1051,9 @@ seven sink_4_2567(volatile A&&);
int test4_2567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2567(a)) == 2> t1;
sa<sizeof(sink_4_2567(ca)) == 2> t2;
sa<sizeof(sink_4_2567(source())) == 5> t5;
@@ -1070,9 +1070,9 @@ eight sink_4_2568(const volatile A&&);
int test4_2568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2568(a)) == 2> t1;
sa<sizeof(sink_4_2568(ca)) == 2> t2;
sa<sizeof(sink_4_2568(source())) == 5> t5;
@@ -1090,9 +1090,9 @@ eight sink_4_2578(const volatile A&&);
int test4_2578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2578(a)) == 2> t1;
sa<sizeof(sink_4_2578(ca)) == 2> t2;
sa<sizeof(sink_4_2578(source())) == 5> t5;
@@ -1110,9 +1110,9 @@ eight sink_4_2678(const volatile A&&);
int test4_2678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_2678(a)) == 2> t1;
sa<sizeof(sink_4_2678(ca)) == 2> t2;
sa<sizeof(sink_4_2678(c_source())) == 6> t6;
@@ -1129,9 +1129,9 @@ six sink_4_3456(const A&&);
int test4_3456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3456(a)) == 3> t1;
sa<sizeof(sink_4_3456(ca)) == 4> t2;
sa<sizeof(sink_4_3456(va)) == 3> t3;
@@ -1149,9 +1149,9 @@ seven sink_4_3457(volatile A&&);
int test4_3457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3457(a)) == 3> t1;
sa<sizeof(sink_4_3457(ca)) == 4> t2;
sa<sizeof(sink_4_3457(va)) == 3> t3;
@@ -1169,9 +1169,9 @@ eight sink_4_3458(const volatile A&&);
int test4_3458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3458(a)) == 3> t1;
sa<sizeof(sink_4_3458(ca)) == 4> t2;
sa<sizeof(sink_4_3458(va)) == 3> t3;
@@ -1191,9 +1191,9 @@ seven sink_4_3467(volatile A&&);
int test4_3467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3467(a)) == 3> t1;
sa<sizeof(sink_4_3467(ca)) == 4> t2;
sa<sizeof(sink_4_3467(va)) == 3> t3;
@@ -1211,9 +1211,9 @@ eight sink_4_3468(const volatile A&&);
int test4_3468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3468(a)) == 3> t1;
sa<sizeof(sink_4_3468(ca)) == 4> t2;
sa<sizeof(sink_4_3468(va)) == 3> t3;
@@ -1233,9 +1233,9 @@ eight sink_4_3478(const volatile A&&);
int test4_3478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3478(a)) == 3> t1;
sa<sizeof(sink_4_3478(ca)) == 4> t2;
sa<sizeof(sink_4_3478(va)) == 3> t3;
@@ -1255,9 +1255,9 @@ seven sink_4_3567(volatile A&&);
int test4_3567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3567(a)) == 3> t1;
sa<sizeof(sink_4_3567(va)) == 3> t3;
sa<sizeof(sink_4_3567(source())) == 5> t5;
@@ -1274,9 +1274,9 @@ eight sink_4_3568(const volatile A&&);
int test4_3568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3568(a)) == 3> t1;
sa<sizeof(sink_4_3568(va)) == 3> t3;
sa<sizeof(sink_4_3568(source())) == 5> t5;
@@ -1294,9 +1294,9 @@ eight sink_4_3578(const volatile A&&);
int test4_3578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3578(a)) == 3> t1;
sa<sizeof(sink_4_3578(va)) == 3> t3;
sa<sizeof(sink_4_3578(source())) == 5> t5;
@@ -1314,9 +1314,9 @@ eight sink_4_3678(const volatile A&&);
int test4_3678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_3678(a)) == 3> t1;
sa<sizeof(sink_4_3678(va)) == 3> t3;
sa<sizeof(sink_4_3678(c_source())) == 6> t6;
@@ -1333,9 +1333,9 @@ seven sink_4_4567(volatile A&&);
int test4_4567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_4567(a)) == 4> t1;
sa<sizeof(sink_4_4567(ca)) == 4> t2;
sa<sizeof(sink_4_4567(va)) == 4> t3;
@@ -1354,9 +1354,9 @@ eight sink_4_4568(const volatile A&&);
int test4_4568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_4568(a)) == 4> t1;
sa<sizeof(sink_4_4568(ca)) == 4> t2;
sa<sizeof(sink_4_4568(va)) == 4> t3;
@@ -1376,9 +1376,9 @@ eight sink_4_4578(const volatile A&&);
int test4_4578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_4578(a)) == 4> t1;
sa<sizeof(sink_4_4578(ca)) == 4> t2;
sa<sizeof(sink_4_4578(va)) == 4> t3;
@@ -1398,9 +1398,9 @@ eight sink_4_4678(const volatile A&&);
int test4_4678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_4678(a)) == 4> t1;
sa<sizeof(sink_4_4678(ca)) == 4> t2;
sa<sizeof(sink_4_4678(va)) == 4> t3;
@@ -1419,9 +1419,9 @@ eight sink_4_5678(const volatile A&&);
int test4_5678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_4_5678(source())) == 5> t5;
sa<sizeof(sink_4_5678(c_source())) == 6> t6;
sa<sizeof(sink_4_5678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv5n.C b/gcc/testsuite/g++.dg/cpp0x/rv5n.C
index c31a30b2d6f..92ec1d925e1 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv5n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv5n.C
@@ -20,7 +20,7 @@ struct eight {char x[8];};
struct A
{
A();
- A(const volatile A&&);
+ A(const volatile A&&); // { dg-error "argument 1" }
};
A source();
@@ -39,9 +39,9 @@ five sink_5_12345( A&&); // { dg-message "note" }
int test5_12345()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12345(v_source()); // { dg-error "no match" }
sink_5_12345(cv_source()); // { dg-error "no match" }
return 0;
@@ -56,9 +56,9 @@ six sink_5_12346(const A&&); // { dg-message "note" }
int test5_12346()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12346(v_source()); // { dg-error "no match" }
sink_5_12346(cv_source()); // { dg-error "no match" }
return 0;
@@ -73,9 +73,9 @@ seven sink_5_12347(volatile A&&); // { dg-message "note" }
int test5_12347()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12347(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -89,9 +89,9 @@ six sink_5_12356(const A&&); // { dg-message "note" }
int test5_12356()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12356(cva); // { dg-error "no match" }
sink_5_12356(v_source()); // { dg-error "no match" }
sink_5_12356(cv_source()); // { dg-error "no match" }
@@ -107,9 +107,9 @@ seven sink_5_12357(volatile A&&); // { dg-message "note" }
int test5_12357()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12357(cva); // { dg-error "no match" }
sink_5_12357(cv_source()); // { dg-error "no match" }
return 0;
@@ -124,9 +124,9 @@ eight sink_5_12358(const volatile A&&); // { dg-message "" }
int test5_12358()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12358(cva); // { dg-error "lvalue" }
return 0;
}
@@ -140,9 +140,9 @@ seven sink_5_12367(volatile A&&); // { dg-message "note" }
int test5_12367()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12367(cva); // { dg-error "no match" }
sink_5_12367(source()); // { dg-error "ambiguous" }
sink_5_12367(cv_source()); // { dg-error "no match" }
@@ -158,9 +158,9 @@ eight sink_5_12368(const volatile A&&); // { dg-message "" }
int test5_12368()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12368(cva); // { dg-error "lvalue" }
return 0;
}
@@ -174,9 +174,9 @@ eight sink_5_12378(const volatile A&&); // { dg-message "" }
int test5_12378()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12378(cva); // { dg-error "lvalue" }
return 0;
}
@@ -190,9 +190,9 @@ six sink_5_12456(const A&&); // { dg-message "note" }
int test5_12456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12456(v_source()); // { dg-error "no match" }
sink_5_12456(cv_source()); // { dg-error "no match" }
return 0;
@@ -207,9 +207,9 @@ seven sink_5_12457(volatile A&&); // { dg-message "note" }
int test5_12457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12457(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -223,9 +223,9 @@ seven sink_5_12467(volatile A&&); // { dg-message "note" }
int test5_12467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12467(source()); // { dg-error "ambiguous" }
sink_5_12467(cv_source()); // { dg-error "no match" }
return 0;
@@ -240,9 +240,9 @@ seven sink_5_12567(volatile A&&); // { dg-message "" }
int test5_12567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12567(va); // { dg-error "lvalue" }
sink_5_12567(cva); // { dg-error "no match" }
sink_5_12567(cv_source()); // { dg-error "no match" }
@@ -258,9 +258,9 @@ eight sink_5_12568(const volatile A&&); // { dg-message "" }
int test5_12568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12568(va); // { dg-error "lvalue" }
sink_5_12568(cva); // { dg-error "lvalue" }
return 0;
@@ -275,9 +275,9 @@ eight sink_5_12578(const volatile A&&); // { dg-message "" }
int test5_12578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12578(va); // { dg-error "lvalue" }
sink_5_12578(cva); // { dg-error "lvalue" }
return 0;
@@ -292,9 +292,9 @@ eight sink_5_12678(const volatile A&&); // { dg-message "" }
int test5_12678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_12678(va); // { dg-error "lvalue" }
sink_5_12678(cva); // { dg-error "lvalue" }
sink_5_12678(source()); // { dg-error "ambiguous" }
@@ -310,9 +310,9 @@ six sink_5_13456(const A&&); // { dg-message "note" }
int test5_13456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_13456(v_source()); // { dg-error "no match" }
sink_5_13456(cv_source()); // { dg-error "no match" }
return 0;
@@ -327,9 +327,9 @@ seven sink_5_13457(volatile A&&); // { dg-message "note" }
int test5_13457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_13457(c_source()); // { dg-error "no match" }
sink_5_13457(cv_source()); // { dg-error "no match" }
return 0;
@@ -344,9 +344,9 @@ seven sink_5_13467(volatile A&&); // { dg-message "note" }
int test5_13467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_13467(source()); // { dg-error "ambiguous" }
sink_5_13467(cv_source()); // { dg-error "no match" }
return 0;
@@ -361,9 +361,9 @@ seven sink_5_13567(volatile A&&); // { dg-message "note" }
int test5_13567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_13567(ca); // { dg-error "lvalue" }
sink_5_13567(cva); // { dg-error "no match" }
sink_5_13567(cv_source()); // { dg-error "no match" }
@@ -379,9 +379,9 @@ eight sink_5_13568(const volatile A&&); // { dg-message "" }
int test5_13568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_13568(ca); // { dg-error "lvalue" }
sink_5_13568(cva); // { dg-error "lvalue" }
return 0;
@@ -396,9 +396,9 @@ eight sink_5_13578(const volatile A&&); // { dg-message "" }
int test5_13578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_13578(ca); // { dg-error "lvalue" }
sink_5_13578(cva); // { dg-error "lvalue" }
return 0;
@@ -413,9 +413,9 @@ eight sink_5_13678(const volatile A&&); // { dg-message "" }
int test5_13678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_13678(ca); // { dg-error "lvalue" }
sink_5_13678(cva); // { dg-error "lvalue" }
sink_5_13678(source()); // { dg-error "ambiguous" }
@@ -431,9 +431,9 @@ seven sink_5_14567(volatile A&&); // { dg-message "note" }
int test5_14567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_14567(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -447,9 +447,9 @@ eight sink_5_14678(const volatile A&&); // { dg-message "note" }
int test5_14678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_14678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -463,9 +463,9 @@ eight sink_5_15678(const volatile A&&); // { dg-message "" }
int test5_15678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_15678(ca); // { dg-error "lvalue" }
sink_5_15678(va); // { dg-error "lvalue" }
sink_5_15678(cva); // { dg-error "lvalue" }
@@ -481,9 +481,9 @@ six sink_5_23456(const A&&); // { dg-message "note" }
int test5_23456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23456(a); // { dg-error "ambiguous" }
sink_5_23456(v_source()); // { dg-error "no match" }
sink_5_23456(cv_source()); // { dg-error "no match" }
@@ -499,9 +499,9 @@ seven sink_5_23457(volatile A&&); // { dg-message "note" }
int test5_23457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23457(a); // { dg-error "ambiguous" }
sink_5_23457(cv_source()); // { dg-error "no match" }
return 0;
@@ -516,9 +516,9 @@ eight sink_5_23458(const volatile A&&); // { dg-message "note" }
int test5_23458()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23458(a); // { dg-error "ambiguous" }
return 0;
}
@@ -532,9 +532,9 @@ seven sink_5_23467(volatile A&&); // { dg-message "note" }
int test5_23467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23467(a); // { dg-error "ambiguous" }
sink_5_23467(source()); // { dg-error "ambiguous" }
sink_5_23467(cv_source()); // { dg-error "no match" }
@@ -550,9 +550,9 @@ eight sink_5_23468(const volatile A&&); // { dg-message "note" }
int test5_23468()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23468(a); // { dg-error "ambiguous" }
return 0;
}
@@ -566,9 +566,9 @@ eight sink_5_23478(const volatile A&&); // { dg-message "note" }
int test5_23478()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23478(a); // { dg-error "ambiguous" }
return 0;
}
@@ -582,9 +582,9 @@ seven sink_5_23567(volatile A&&); // { dg-message "note" }
int test5_23567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23567(a); // { dg-error "ambiguous" }
sink_5_23567(cva); // { dg-error "no match" }
sink_5_23567(cv_source()); // { dg-error "no match" }
@@ -600,9 +600,9 @@ eight sink_5_23568(const volatile A&&); // { dg-message "" }
int test5_23568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23568(cva); // { dg-error "lvalue" }
sink_5_23568(a); // { dg-error "ambiguous" }
return 0;
@@ -617,9 +617,9 @@ eight sink_5_23578(const volatile A&&); // { dg-message "" }
int test5_23578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23578(cva); // { dg-error "lvalue" }
sink_5_23578(a); // { dg-error "ambiguous" }
return 0;
@@ -634,9 +634,9 @@ eight sink_5_23678(const volatile A&&); // { dg-message "" }
int test5_23678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_23678(a); // { dg-error "ambiguous" }
sink_5_23678(cva); // { dg-error "lvalue" }
sink_5_23678(source()); // { dg-error "ambiguous" }
@@ -652,9 +652,9 @@ seven sink_5_24567(volatile A&&); // { dg-message "note" }
int test5_24567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_24567(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -668,9 +668,9 @@ eight sink_5_24678(const volatile A&&); // { dg-message "note" }
int test5_24678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_24678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -684,9 +684,9 @@ eight sink_5_25678(const volatile A&&); // { dg-message "" }
int test5_25678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_25678(va); // { dg-error "lvalue" }
sink_5_25678(cva); // { dg-error "lvalue" }
return 0;
@@ -701,9 +701,9 @@ seven sink_5_34567(volatile A&&); // { dg-message "note" }
int test5_34567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_34567(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -717,9 +717,9 @@ eight sink_5_34678(const volatile A&&); // { dg-message "note" }
int test5_34678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_34678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -733,9 +733,9 @@ eight sink_5_35678(const volatile A&&); // { dg-message "" }
int test5_35678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_5_35678(ca); // { dg-error "lvalue" }
sink_5_35678(cva); // { dg-error "lvalue" }
return 0;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv5p.C b/gcc/testsuite/g++.dg/cpp0x/rv5p.C
index 7555867f709..cd12028fc93 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv5p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv5p.C
@@ -39,9 +39,9 @@ five sink_5_12345( A&&);
int test5_12345()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12345(a)) == 1> t1;
sa<sizeof(sink_5_12345(ca)) == 2> t2;
sa<sizeof(sink_5_12345(va)) == 3> t3;
@@ -60,9 +60,9 @@ six sink_5_12346(const A&&);
int test5_12346()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12346(a)) == 1> t1;
sa<sizeof(sink_5_12346(ca)) == 2> t2;
sa<sizeof(sink_5_12346(va)) == 3> t3;
@@ -81,9 +81,9 @@ seven sink_5_12347(volatile A&&);
int test5_12347()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12347(a)) == 1> t1;
sa<sizeof(sink_5_12347(ca)) == 2> t2;
sa<sizeof(sink_5_12347(va)) == 3> t3;
@@ -103,9 +103,9 @@ eight sink_5_12348(const volatile A&&);
int test5_12348()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12348(a)) == 1> t1;
sa<sizeof(sink_5_12348(ca)) == 2> t2;
sa<sizeof(sink_5_12348(va)) == 3> t3;
@@ -126,9 +126,9 @@ six sink_5_12356(const A&&);
int test5_12356()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12356(a)) == 1> t1;
sa<sizeof(sink_5_12356(ca)) == 2> t2;
sa<sizeof(sink_5_12356(va)) == 3> t3;
@@ -146,9 +146,9 @@ seven sink_5_12357(volatile A&&);
int test5_12357()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12357(a)) == 1> t1;
sa<sizeof(sink_5_12357(ca)) == 2> t2;
sa<sizeof(sink_5_12357(va)) == 3> t3;
@@ -167,9 +167,9 @@ eight sink_5_12358(const volatile A&&);
int test5_12358()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12358(a)) == 1> t1;
sa<sizeof(sink_5_12358(ca)) == 2> t2;
sa<sizeof(sink_5_12358(va)) == 3> t3;
@@ -189,9 +189,9 @@ seven sink_5_12367(volatile A&&);
int test5_12367()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12367(a)) == 1> t1;
sa<sizeof(sink_5_12367(ca)) == 2> t2;
sa<sizeof(sink_5_12367(va)) == 3> t3;
@@ -209,9 +209,9 @@ eight sink_5_12368(const volatile A&&);
int test5_12368()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12368(a)) == 1> t1;
sa<sizeof(sink_5_12368(ca)) == 2> t2;
sa<sizeof(sink_5_12368(va)) == 3> t3;
@@ -231,9 +231,9 @@ eight sink_5_12378(const volatile A&&);
int test5_12378()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12378(a)) == 1> t1;
sa<sizeof(sink_5_12378(ca)) == 2> t2;
sa<sizeof(sink_5_12378(va)) == 3> t3;
@@ -253,9 +253,9 @@ six sink_5_12456(const A&&);
int test5_12456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12456(a)) == 1> t1;
sa<sizeof(sink_5_12456(ca)) == 2> t2;
sa<sizeof(sink_5_12456(va)) == 4> t3;
@@ -274,9 +274,9 @@ seven sink_5_12457(volatile A&&);
int test5_12457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12457(a)) == 1> t1;
sa<sizeof(sink_5_12457(ca)) == 2> t2;
sa<sizeof(sink_5_12457(va)) == 4> t3;
@@ -296,9 +296,9 @@ eight sink_5_12458(const volatile A&&);
int test5_12458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12458(a)) == 1> t1;
sa<sizeof(sink_5_12458(ca)) == 2> t2;
sa<sizeof(sink_5_12458(va)) == 4> t3;
@@ -319,9 +319,9 @@ seven sink_5_12467(volatile A&&);
int test5_12467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12467(a)) == 1> t1;
sa<sizeof(sink_5_12467(ca)) == 2> t2;
sa<sizeof(sink_5_12467(va)) == 4> t3;
@@ -340,9 +340,9 @@ eight sink_5_12468(const volatile A&&);
int test5_12468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12468(a)) == 1> t1;
sa<sizeof(sink_5_12468(ca)) == 2> t2;
sa<sizeof(sink_5_12468(va)) == 4> t3;
@@ -363,9 +363,9 @@ eight sink_5_12478(const volatile A&&);
int test5_12478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12478(a)) == 1> t1;
sa<sizeof(sink_5_12478(ca)) == 2> t2;
sa<sizeof(sink_5_12478(va)) == 4> t3;
@@ -386,9 +386,9 @@ seven sink_5_12567(volatile A&&);
int test5_12567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12567(a)) == 1> t1;
sa<sizeof(sink_5_12567(ca)) == 2> t2;
sa<sizeof(sink_5_12567(source())) == 5> t5;
@@ -406,9 +406,9 @@ eight sink_5_12568(const volatile A&&);
int test5_12568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12568(a)) == 1> t1;
sa<sizeof(sink_5_12568(ca)) == 2> t2;
sa<sizeof(sink_5_12568(source())) == 5> t5;
@@ -427,9 +427,9 @@ eight sink_5_12578(const volatile A&&);
int test5_12578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12578(a)) == 1> t1;
sa<sizeof(sink_5_12578(ca)) == 2> t2;
sa<sizeof(sink_5_12578(source())) == 5> t5;
@@ -448,9 +448,9 @@ eight sink_5_12678(const volatile A&&);
int test5_12678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_12678(a)) == 1> t1;
sa<sizeof(sink_5_12678(ca)) == 2> t2;
sa<sizeof(sink_5_12678(c_source())) == 6> t6;
@@ -468,9 +468,9 @@ six sink_5_13456(const A&&);
int test5_13456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13456(a)) == 1> t1;
sa<sizeof(sink_5_13456(ca)) == 4> t2;
sa<sizeof(sink_5_13456(va)) == 3> t3;
@@ -489,9 +489,9 @@ seven sink_5_13457(volatile A&&);
int test5_13457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13457(a)) == 1> t1;
sa<sizeof(sink_5_13457(ca)) == 4> t2;
sa<sizeof(sink_5_13457(va)) == 3> t3;
@@ -510,9 +510,9 @@ eight sink_5_13458(const volatile A&&);
int test5_13458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13458(a)) == 1> t1;
sa<sizeof(sink_5_13458(ca)) == 4> t2;
sa<sizeof(sink_5_13458(va)) == 3> t3;
@@ -533,9 +533,9 @@ seven sink_5_13467(volatile A&&);
int test5_13467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13467(a)) == 1> t1;
sa<sizeof(sink_5_13467(ca)) == 4> t2;
sa<sizeof(sink_5_13467(va)) == 3> t3;
@@ -554,9 +554,9 @@ eight sink_5_13468(const volatile A&&);
int test5_13468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13468(a)) == 1> t1;
sa<sizeof(sink_5_13468(ca)) == 4> t2;
sa<sizeof(sink_5_13468(va)) == 3> t3;
@@ -577,9 +577,9 @@ eight sink_5_13478(const volatile A&&);
int test5_13478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13478(a)) == 1> t1;
sa<sizeof(sink_5_13478(ca)) == 4> t2;
sa<sizeof(sink_5_13478(va)) == 3> t3;
@@ -600,9 +600,9 @@ seven sink_5_13567(volatile A&&);
int test5_13567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13567(a)) == 1> t1;
sa<sizeof(sink_5_13567(va)) == 3> t3;
sa<sizeof(sink_5_13567(source())) == 5> t5;
@@ -620,9 +620,9 @@ eight sink_5_13568(const volatile A&&);
int test5_13568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13568(a)) == 1> t1;
sa<sizeof(sink_5_13568(va)) == 3> t3;
sa<sizeof(sink_5_13568(source())) == 5> t5;
@@ -641,9 +641,9 @@ eight sink_5_13578(const volatile A&&);
int test5_13578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13578(a)) == 1> t1;
sa<sizeof(sink_5_13578(va)) == 3> t3;
sa<sizeof(sink_5_13578(source())) == 5> t5;
@@ -662,9 +662,9 @@ eight sink_5_13678(const volatile A&&);
int test5_13678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_13678(a)) == 1> t1;
sa<sizeof(sink_5_13678(va)) == 3> t3;
sa<sizeof(sink_5_13678(c_source())) == 6> t6;
@@ -682,9 +682,9 @@ seven sink_5_14567(volatile A&&);
int test5_14567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_14567(a)) == 1> t1;
sa<sizeof(sink_5_14567(ca)) == 4> t2;
sa<sizeof(sink_5_14567(va)) == 4> t3;
@@ -704,9 +704,9 @@ eight sink_5_14568(const volatile A&&);
int test5_14568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_14568(a)) == 1> t1;
sa<sizeof(sink_5_14568(ca)) == 4> t2;
sa<sizeof(sink_5_14568(va)) == 4> t3;
@@ -727,9 +727,9 @@ eight sink_5_14578(const volatile A&&);
int test5_14578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_14578(a)) == 1> t1;
sa<sizeof(sink_5_14578(ca)) == 4> t2;
sa<sizeof(sink_5_14578(va)) == 4> t3;
@@ -750,9 +750,9 @@ eight sink_5_14678(const volatile A&&);
int test5_14678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_14678(a)) == 1> t1;
sa<sizeof(sink_5_14678(ca)) == 4> t2;
sa<sizeof(sink_5_14678(va)) == 4> t3;
@@ -772,9 +772,9 @@ eight sink_5_15678(const volatile A&&);
int test5_15678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_15678(a)) == 1> t1;
sa<sizeof(sink_5_15678(source())) == 5> t5;
sa<sizeof(sink_5_15678(c_source())) == 6> t6;
@@ -792,9 +792,9 @@ six sink_5_23456(const A&&);
int test5_23456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23456(ca)) == 2> t2;
sa<sizeof(sink_5_23456(va)) == 3> t3;
sa<sizeof(sink_5_23456(cva)) == 4> t4;
@@ -812,9 +812,9 @@ seven sink_5_23457(volatile A&&);
int test5_23457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23457(ca)) == 2> t2;
sa<sizeof(sink_5_23457(va)) == 3> t3;
sa<sizeof(sink_5_23457(cva)) == 4> t4;
@@ -833,9 +833,9 @@ eight sink_5_23458(const volatile A&&);
int test5_23458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23458(ca)) == 2> t2;
sa<sizeof(sink_5_23458(va)) == 3> t3;
sa<sizeof(sink_5_23458(cva)) == 4> t4;
@@ -855,9 +855,9 @@ seven sink_5_23467(volatile A&&);
int test5_23467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23467(ca)) == 2> t2;
sa<sizeof(sink_5_23467(va)) == 3> t3;
sa<sizeof(sink_5_23467(cva)) == 4> t4;
@@ -875,9 +875,9 @@ eight sink_5_23468(const volatile A&&);
int test5_23468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23468(ca)) == 2> t2;
sa<sizeof(sink_5_23468(va)) == 3> t3;
sa<sizeof(sink_5_23468(cva)) == 4> t4;
@@ -897,9 +897,9 @@ eight sink_5_23478(const volatile A&&);
int test5_23478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23478(ca)) == 2> t2;
sa<sizeof(sink_5_23478(va)) == 3> t3;
sa<sizeof(sink_5_23478(cva)) == 4> t4;
@@ -919,9 +919,9 @@ seven sink_5_23567(volatile A&&);
int test5_23567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23567(ca)) == 2> t2;
sa<sizeof(sink_5_23567(va)) == 3> t3;
sa<sizeof(sink_5_23567(source())) == 5> t5;
@@ -939,9 +939,9 @@ eight sink_5_23568(const volatile A&&);
int test5_23568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23568(ca)) == 2> t2;
sa<sizeof(sink_5_23568(va)) == 3> t3;
sa<sizeof(sink_5_23568(source())) == 5> t5;
@@ -960,9 +960,9 @@ eight sink_5_23578(const volatile A&&);
int test5_23578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23578(ca)) == 2> t2;
sa<sizeof(sink_5_23578(va)) == 3> t3;
sa<sizeof(sink_5_23578(source())) == 5> t5;
@@ -981,9 +981,9 @@ eight sink_5_23678(const volatile A&&);
int test5_23678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_23678(ca)) == 2> t2;
sa<sizeof(sink_5_23678(va)) == 3> t3;
sa<sizeof(sink_5_23678(c_source())) == 6> t6;
@@ -1001,9 +1001,9 @@ seven sink_5_24567(volatile A&&);
int test5_24567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_24567(a)) == 2> t1;
sa<sizeof(sink_5_24567(ca)) == 2> t2;
sa<sizeof(sink_5_24567(va)) == 4> t3;
@@ -1023,9 +1023,9 @@ eight sink_5_24568(const volatile A&&);
int test5_24568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_24568(a)) == 2> t1;
sa<sizeof(sink_5_24568(ca)) == 2> t2;
sa<sizeof(sink_5_24568(va)) == 4> t3;
@@ -1046,9 +1046,9 @@ eight sink_5_24578(const volatile A&&);
int test5_24578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_24578(a)) == 2> t1;
sa<sizeof(sink_5_24578(ca)) == 2> t2;
sa<sizeof(sink_5_24578(va)) == 4> t3;
@@ -1069,9 +1069,9 @@ eight sink_5_24678(const volatile A&&);
int test5_24678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_24678(a)) == 2> t1;
sa<sizeof(sink_5_24678(ca)) == 2> t2;
sa<sizeof(sink_5_24678(va)) == 4> t3;
@@ -1091,9 +1091,9 @@ eight sink_5_25678(const volatile A&&);
int test5_25678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_25678(a)) == 2> t1;
sa<sizeof(sink_5_25678(ca)) == 2> t2;
sa<sizeof(sink_5_25678(source())) == 5> t5;
@@ -1112,9 +1112,9 @@ seven sink_5_34567(volatile A&&);
int test5_34567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_34567(a)) == 3> t1;
sa<sizeof(sink_5_34567(ca)) == 4> t2;
sa<sizeof(sink_5_34567(va)) == 3> t3;
@@ -1134,9 +1134,9 @@ eight sink_5_34568(const volatile A&&);
int test5_34568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_34568(a)) == 3> t1;
sa<sizeof(sink_5_34568(ca)) == 4> t2;
sa<sizeof(sink_5_34568(va)) == 3> t3;
@@ -1157,9 +1157,9 @@ eight sink_5_34578(const volatile A&&);
int test5_34578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_34578(a)) == 3> t1;
sa<sizeof(sink_5_34578(ca)) == 4> t2;
sa<sizeof(sink_5_34578(va)) == 3> t3;
@@ -1180,9 +1180,9 @@ eight sink_5_34678(const volatile A&&);
int test5_34678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_34678(a)) == 3> t1;
sa<sizeof(sink_5_34678(ca)) == 4> t2;
sa<sizeof(sink_5_34678(va)) == 3> t3;
@@ -1202,9 +1202,9 @@ eight sink_5_35678(const volatile A&&);
int test5_35678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_35678(a)) == 3> t1;
sa<sizeof(sink_5_35678(va)) == 3> t3;
sa<sizeof(sink_5_35678(source())) == 5> t5;
@@ -1223,9 +1223,9 @@ eight sink_5_45678(const volatile A&&);
int test5_45678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_5_45678(a)) == 4> t1;
sa<sizeof(sink_5_45678(ca)) == 4> t2;
sa<sizeof(sink_5_45678(va)) == 4> t3;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv6n.C b/gcc/testsuite/g++.dg/cpp0x/rv6n.C
index 2a2520c7599..6a81f66fa5c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv6n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv6n.C
@@ -20,7 +20,7 @@ struct eight {char x[8];};
struct A
{
A();
- A(const volatile A&&);
+ A(const volatile A&&); // { dg-error "argument 1" }
};
A source();
@@ -40,9 +40,9 @@ six sink_6_123456(const A&&); // { dg-message "note" }
int test6_123456()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_123456(v_source()); // { dg-error "no match" }
sink_6_123456(cv_source()); // { dg-error "no match" }
return 0;
@@ -58,9 +58,9 @@ seven sink_6_123457(volatile A&&); // { dg-message "note" }
int test6_123457()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_123457(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -75,9 +75,9 @@ eight sink_6_235678(const volatile A&&); // { dg-message "" }
int test6_235678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_235678(a); // { dg-error "ambiguous" }
sink_6_235678(cva); // { dg-error "lvalue" }
return 0;
@@ -93,9 +93,9 @@ eight sink_6_234678(const volatile A&&); // { dg-message "note" }
int test6_234678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_234678(a); // { dg-error "ambiguous" }
sink_6_234678(source()); // { dg-error "ambiguous" }
return 0;
@@ -111,9 +111,9 @@ eight sink_6_234578(const volatile A&&); // { dg-message "note" }
int test6_234578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_234578(a); // { dg-error "ambiguous" }
return 0;
}
@@ -128,9 +128,9 @@ eight sink_6_234568(const volatile A&&); // { dg-message "note" }
int test6_234568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_234568(a); // { dg-error "ambiguous" }
return 0;
}
@@ -145,9 +145,9 @@ seven sink_6_234567(volatile A&&); // { dg-message "note" }
int test6_234567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_234567(a); // { dg-error "ambiguous" }
sink_6_234567(cv_source()); // { dg-error "no match" }
return 0;
@@ -163,9 +163,9 @@ eight sink_6_134678(const volatile A&&); // { dg-message "note" }
int test6_134678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_134678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -180,9 +180,9 @@ eight sink_6_124678(const volatile A&&); // { dg-message "note" }
int test6_124678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_124678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -197,9 +197,9 @@ eight sink_6_123678(const volatile A&&); // { dg-message "" }
int test6_123678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_123678(cva); // { dg-error "lvalue" }
sink_6_123678(source()); // { dg-error "ambiguous" }
return 0;
@@ -215,9 +215,9 @@ seven sink_6_123567(volatile A&&); // { dg-message "note" }
int test6_123567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_123567(cva); // { dg-error "no match" }
sink_6_123567(cv_source()); // { dg-error "no match" }
return 0;
@@ -233,9 +233,9 @@ eight sink_6_123568(const volatile A&&); // { dg-message "" }
int test6_123568()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_123568(cva); // { dg-error "lvalue" }
return 0;
}
@@ -250,9 +250,9 @@ eight sink_6_123578(const volatile A&&); // { dg-message "" }
int test6_123578()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_123578(cva); // { dg-error "lvalue" }
return 0;
}
@@ -267,9 +267,9 @@ seven sink_6_123467(volatile A&&); // { dg-message "note" }
int test6_123467()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_123467(source()); // { dg-error "ambiguous" }
sink_6_123467(cv_source()); // { dg-error "no match" }
return 0;
@@ -285,9 +285,9 @@ seven sink_6_124567(volatile A&&); // { dg-message "note" }
int test6_124567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_124567(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -302,9 +302,9 @@ eight sink_6_125678(const volatile A&&); // { dg-message "" }
int test6_125678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_125678(va); // { dg-error "lvalue" }
sink_6_125678(cva); // { dg-error "lvalue" }
return 0;
@@ -320,9 +320,9 @@ seven sink_6_134567(volatile A&&); // { dg-message "note" }
int test6_134567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_134567(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -337,9 +337,9 @@ eight sink_6_135678(const volatile A&&); // { dg-message "" }
int test6_135678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_6_135678(ca); // { dg-error "lvalue" }
sink_6_135678(cva); // { dg-error "lvalue" }
return 0;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv6p.C b/gcc/testsuite/g++.dg/cpp0x/rv6p.C
index 0e5352bf8b1..bb17d7929fe 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv6p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv6p.C
@@ -40,9 +40,9 @@ six sink_6_123456(const A&&);
int test6_123456()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123456(a)) == 1> t1;
sa<sizeof(sink_6_123456(ca)) == 2> t2;
sa<sizeof(sink_6_123456(va)) == 3> t3;
@@ -62,9 +62,9 @@ seven sink_6_123457(volatile A&&);
int test6_123457()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123457(a)) == 1> t1;
sa<sizeof(sink_6_123457(ca)) == 2> t2;
sa<sizeof(sink_6_123457(va)) == 3> t3;
@@ -85,9 +85,9 @@ eight sink_6_123458(const volatile A&&);
int test6_123458()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123458(a)) == 1> t1;
sa<sizeof(sink_6_123458(ca)) == 2> t2;
sa<sizeof(sink_6_123458(va)) == 3> t3;
@@ -109,9 +109,9 @@ seven sink_6_123467(volatile A&&);
int test6_123467()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123467(a)) == 1> t1;
sa<sizeof(sink_6_123467(ca)) == 2> t2;
sa<sizeof(sink_6_123467(va)) == 3> t3;
@@ -131,9 +131,9 @@ eight sink_6_123468(const volatile A&&);
int test6_123468()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123468(a)) == 1> t1;
sa<sizeof(sink_6_123468(ca)) == 2> t2;
sa<sizeof(sink_6_123468(va)) == 3> t3;
@@ -155,9 +155,9 @@ eight sink_6_123478(const volatile A&&);
int test6_123478()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123478(a)) == 1> t1;
sa<sizeof(sink_6_123478(ca)) == 2> t2;
sa<sizeof(sink_6_123478(va)) == 3> t3;
@@ -179,9 +179,9 @@ seven sink_6_123567(volatile A&&);
int test6_123567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123567(a)) == 1> t1;
sa<sizeof(sink_6_123567(ca)) == 2> t2;
sa<sizeof(sink_6_123567(va)) == 3> t3;
@@ -201,9 +201,9 @@ eight sink_6_123568(const volatile A&&);
int test6_123568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123568(a)) == 1> t1;
sa<sizeof(sink_6_123568(ca)) == 2> t2;
sa<sizeof(sink_6_123568(va)) == 3> t3;
@@ -224,9 +224,9 @@ eight sink_6_123578(const volatile A&&);
int test6_123578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123578(a)) == 1> t1;
sa<sizeof(sink_6_123578(ca)) == 2> t2;
sa<sizeof(sink_6_123578(va)) == 3> t3;
@@ -247,9 +247,9 @@ eight sink_6_123678(const volatile A&&);
int test6_123678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_123678(a)) == 1> t1;
sa<sizeof(sink_6_123678(ca)) == 2> t2;
sa<sizeof(sink_6_123678(va)) == 3> t3;
@@ -269,9 +269,9 @@ seven sink_6_124567(volatile A&&);
int test6_124567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_124567(a)) == 1> t1;
sa<sizeof(sink_6_124567(ca)) == 2> t2;
sa<sizeof(sink_6_124567(va)) == 4> t3;
@@ -292,9 +292,9 @@ eight sink_6_124568(const volatile A&&);
int test6_124568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_124568(a)) == 1> t1;
sa<sizeof(sink_6_124568(ca)) == 2> t2;
sa<sizeof(sink_6_124568(va)) == 4> t3;
@@ -316,9 +316,9 @@ eight sink_6_124578(const volatile A&&);
int test6_124578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_124578(a)) == 1> t1;
sa<sizeof(sink_6_124578(ca)) == 2> t2;
sa<sizeof(sink_6_124578(va)) == 4> t3;
@@ -340,9 +340,9 @@ eight sink_6_124678(const volatile A&&);
int test6_124678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_124678(a)) == 1> t1;
sa<sizeof(sink_6_124678(ca)) == 2> t2;
sa<sizeof(sink_6_124678(va)) == 4> t3;
@@ -363,9 +363,9 @@ eight sink_6_125678(const volatile A&&);
int test6_125678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_125678(a)) == 1> t1;
sa<sizeof(sink_6_125678(ca)) == 2> t2;
sa<sizeof(sink_6_125678(source())) == 5> t5;
@@ -385,9 +385,9 @@ seven sink_6_134567(volatile A&&);
int test6_134567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_134567(a)) == 1> t1;
sa<sizeof(sink_6_134567(ca)) == 4> t2;
sa<sizeof(sink_6_134567(va)) == 3> t3;
@@ -408,9 +408,9 @@ eight sink_6_134568(const volatile A&&);
int test6_134568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_134568(a)) == 1> t1;
sa<sizeof(sink_6_134568(ca)) == 4> t2;
sa<sizeof(sink_6_134568(va)) == 3> t3;
@@ -432,9 +432,9 @@ eight sink_6_134578(const volatile A&&);
int test6_134578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_134578(a)) == 1> t1;
sa<sizeof(sink_6_134578(ca)) == 4> t2;
sa<sizeof(sink_6_134578(va)) == 3> t3;
@@ -456,9 +456,9 @@ eight sink_6_134678(const volatile A&&);
int test6_134678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_134678(a)) == 1> t1;
sa<sizeof(sink_6_134678(ca)) == 4> t2;
sa<sizeof(sink_6_134678(va)) == 3> t3;
@@ -479,9 +479,9 @@ eight sink_6_135678(const volatile A&&);
int test6_135678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_135678(a)) == 1> t1;
sa<sizeof(sink_6_135678(va)) == 3> t3;
sa<sizeof(sink_6_135678(source())) == 5> t5;
@@ -501,9 +501,9 @@ eight sink_6_145678(const volatile A&&);
int test6_145678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_145678(a)) == 1> t1;
sa<sizeof(sink_6_145678(ca)) == 4> t2;
sa<sizeof(sink_6_145678(va)) == 4> t3;
@@ -525,9 +525,9 @@ seven sink_6_234567(volatile A&&);
int test6_234567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_234567(ca)) == 2> t2;
sa<sizeof(sink_6_234567(va)) == 3> t3;
sa<sizeof(sink_6_234567(cva)) == 4> t4;
@@ -547,9 +547,9 @@ eight sink_6_234568(const volatile A&&);
int test6_234568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_234568(ca)) == 2> t2;
sa<sizeof(sink_6_234568(va)) == 3> t3;
sa<sizeof(sink_6_234568(cva)) == 4> t4;
@@ -570,9 +570,9 @@ eight sink_6_234578(const volatile A&&);
int test6_234578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_234578(ca)) == 2> t2;
sa<sizeof(sink_6_234578(va)) == 3> t3;
sa<sizeof(sink_6_234578(cva)) == 4> t4;
@@ -593,9 +593,9 @@ eight sink_6_234678(const volatile A&&);
int test6_234678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_234678(ca)) == 2> t2;
sa<sizeof(sink_6_234678(va)) == 3> t3;
sa<sizeof(sink_6_234678(cva)) == 4> t4;
@@ -615,9 +615,9 @@ eight sink_6_235678(const volatile A&&);
int test6_235678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_235678(ca)) == 2> t2;
sa<sizeof(sink_6_235678(va)) == 3> t3;
sa<sizeof(sink_6_235678(source())) == 5> t5;
@@ -637,9 +637,9 @@ eight sink_6_245678(const volatile A&&);
int test6_245678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_245678(a)) == 2> t1;
sa<sizeof(sink_6_245678(ca)) == 2> t2;
sa<sizeof(sink_6_245678(va)) == 4> t3;
@@ -661,9 +661,9 @@ eight sink_6_345678(const volatile A&&);
int test6_345678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_6_345678(a)) == 3> t1;
sa<sizeof(sink_6_345678(ca)) == 4> t2;
sa<sizeof(sink_6_345678(va)) == 3> t3;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv7n.C b/gcc/testsuite/g++.dg/cpp0x/rv7n.C
index 102730bc7f0..94254b5824b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv7n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv7n.C
@@ -20,7 +20,7 @@ struct eight {char x[8];};
struct A
{
A();
- A(const volatile A&&);
+ A(const volatile A&&); // { dg-error "argument 1" }
};
A source();
@@ -41,9 +41,9 @@ seven sink_7_1234567(volatile A&&); // { dg-message "note" }
int test7_1234567()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_7_1234567(cv_source()); // { dg-error "no match" }
return 0;
}
@@ -59,9 +59,9 @@ eight sink_7_1235678(const volatile A&&); // { dg-message "" }
int test7_1235678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_7_1235678(cva); // { dg-error "lvalue" }
return 0;
}
@@ -77,9 +77,9 @@ eight sink_7_2345678(const volatile A&&); // { dg-message "note" }
int test7_2345678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_7_2345678(a); // { dg-error "ambiguous" }
return 0;
}
@@ -95,9 +95,9 @@ eight sink_7_1234678(const volatile A&&); // { dg-message "note" }
int test7_1234678()
{
A a;
- const A ca = a;
+ const A ca = a; // { dg-error "lvalue" }
volatile A va;
- const volatile A cva = a;
+ const volatile A cva = a; // { dg-error "lvalue" }
sink_7_1234678(source()); // { dg-error "ambiguous" }
return 0;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv7p.C b/gcc/testsuite/g++.dg/cpp0x/rv7p.C
index d25488f94f1..710f1cf048d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv7p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv7p.C
@@ -41,9 +41,9 @@ seven sink_7_1234567(volatile A&&);
int test7_1234567()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_1234567(a)) == 1> t1;
sa<sizeof(sink_7_1234567(ca)) == 2> t2;
sa<sizeof(sink_7_1234567(va)) == 3> t3;
@@ -65,9 +65,9 @@ eight sink_7_1234568(const volatile A&&);
int test7_1234568()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_1234568(a)) == 1> t1;
sa<sizeof(sink_7_1234568(ca)) == 2> t2;
sa<sizeof(sink_7_1234568(va)) == 3> t3;
@@ -90,9 +90,9 @@ eight sink_7_1234578(const volatile A&&);
int test7_1234578()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_1234578(a)) == 1> t1;
sa<sizeof(sink_7_1234578(ca)) == 2> t2;
sa<sizeof(sink_7_1234578(va)) == 3> t3;
@@ -115,9 +115,9 @@ eight sink_7_1234678(const volatile A&&);
int test7_1234678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_1234678(a)) == 1> t1;
sa<sizeof(sink_7_1234678(ca)) == 2> t2;
sa<sizeof(sink_7_1234678(va)) == 3> t3;
@@ -139,9 +139,9 @@ eight sink_7_1235678(const volatile A&&);
int test7_1235678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_1235678(a)) == 1> t1;
sa<sizeof(sink_7_1235678(ca)) == 2> t2;
sa<sizeof(sink_7_1235678(va)) == 3> t3;
@@ -163,9 +163,9 @@ eight sink_7_1245678(const volatile A&&);
int test7_1245678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_1245678(a)) == 1> t1;
sa<sizeof(sink_7_1245678(ca)) == 2> t2;
sa<sizeof(sink_7_1245678(va)) == 4> t3;
@@ -188,9 +188,9 @@ eight sink_7_1345678(const volatile A&&);
int test7_1345678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_1345678(a)) == 1> t1;
sa<sizeof(sink_7_1345678(ca)) == 4> t2;
sa<sizeof(sink_7_1345678(va)) == 3> t3;
@@ -213,9 +213,9 @@ eight sink_7_2345678(const volatile A&&);
int test7_2345678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_7_2345678(ca)) == 2> t2;
sa<sizeof(sink_7_2345678(va)) == 3> t3;
sa<sizeof(sink_7_2345678(cva)) == 4> t4;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv8p.C b/gcc/testsuite/g++.dg/cpp0x/rv8p.C
index cc7ff8a6ef3..8ee993854b8 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv8p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv8p.C
@@ -42,9 +42,9 @@ eight sink_8_12345678(const volatile A&&);
int test8_12345678()
{
A a;
- const A ca = a;
+ const A ca;
volatile A va;
- const volatile A cva = a;
+ const volatile A cva;
sa<sizeof(sink_8_12345678(a)) == 1> t1;
sa<sizeof(sink_8_12345678(ca)) == 2> t2;
sa<sizeof(sink_8_12345678(va)) == 3> t3;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C b/gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C
new file mode 100644
index 00000000000..4992f41913f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C
@@ -0,0 +1,24 @@
+// PR debug/44668
+// { dg-do compile }
+// { dg-options "-g -dA" }
+
+struct C
+{
+private:
+ typedef int a;
+ a b;
+ enum g { g1, g2 } h;
+ struct D { int i; } i;
+protected:
+ typedef int c;
+ c d;
+public:
+ typedef int e;
+ e f;
+} c;
+
+// 3 private DW_TAG_member dies, 1 private DW_TAG_typedef,
+// 1 private DW_TAG_enumeration_type and 1 private DW_TAG_structure_type
+// { dg-final { scan-assembler-times "3\[^\\r\\n\]* DW_AT_accessibility" 6 } }
+// 1 private DW_TAG_member die, 1 private DW_TAG_typedef
+// { dg-final { scan-assembler-times "2\[^\\r\\n\]* DW_AT_accessibility" 2 } }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C
new file mode 100644
index 00000000000..c5520fa72b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-4" } */
+
+/* Regression test for an ICE in output_die when using -gdwarf-4. */
+
+namespace {
+
+struct A {
+ virtual ~A();
+};
+
+struct B : public A {
+ template <typename A>
+ bool foo(A x[2]) { }
+};
+
+template <typename T>
+struct C {
+ T v[2];
+};
+
+template <typename T>
+bool X(T &b) {
+ typedef C<int> D;
+ D x[2];
+ return b.foo(x);
+}
+
+void f() {
+ B b;
+ X<B>(b);
+}
+
+}
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/typedef3.C b/gcc/testsuite/g++.dg/debug/dwarf2/typedef3.C
new file mode 100644
index 00000000000..ca70d9cacfa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/typedef3.C
@@ -0,0 +1,19 @@
+// Origin: PR debug/44188
+// { dg-options "-g -dA" }
+// { dg-do compile }
+
+// { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_typedef\\)" 1 } }
+
+// { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)" 1 } }
+
+typedef struct
+{
+ int i;
+} AAA;
+
+int
+main(void)
+{
+ AAA aa;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/method1.C b/gcc/testsuite/g++.dg/diagnostic/method1.C
new file mode 100644
index 00000000000..8e1225d0722
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/method1.C
@@ -0,0 +1,20 @@
+// PR c++/44627
+// { dg-do compile }
+
+struct A
+{
+ A *foo ();
+};
+
+template <class T>
+void
+bar ()
+{
+ A::foo ().anything; // { dg-error "request for member" }
+}
+
+void
+baz ()
+{
+ bar <int> ();
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/parm1.C b/gcc/testsuite/g++.dg/diagnostic/parm1.C
new file mode 100644
index 00000000000..2e553e2d4c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/parm1.C
@@ -0,0 +1,11 @@
+// PR c++/44366
+// While printing the operand of sizeof We were trying to print f as the
+// scope of t, causing infinite recursion.
+
+template <typename T>
+void f(T t, int(*)[sizeof(t)])
+{
+ struct A { void g() {
+ foo; // { dg-error "foo" }
+ } };
+}
diff --git a/gcc/testsuite/g++.dg/eh/new1.C b/gcc/testsuite/g++.dg/eh/new1.C
index 4c5c684b5f2..0f86fccdc93 100644
--- a/gcc/testsuite/g++.dg/eh/new1.C
+++ b/gcc/testsuite/g++.dg/eh/new1.C
@@ -9,7 +9,7 @@
int ret = 1;
void *ptr;
-void * operator new[] (size_t s) throw (std::bad_alloc)
+void * operator new[] (std::size_t s) throw (std::bad_alloc)
{
ptr = operator new (s);
return ptr;
diff --git a/gcc/testsuite/g++.dg/eh/spec8.C b/gcc/testsuite/g++.dg/eh/spec8.C
index 7a35e6e8072..72dadff2257 100644
--- a/gcc/testsuite/g++.dg/eh/spec8.C
+++ b/gcc/testsuite/g++.dg/eh/spec8.C
@@ -3,9 +3,9 @@
struct exception {};
template <typename T> void foo() throw(exception); // { dg-error "declaration" }
-template <typename T> void foo(); // { dg-error "exceptions" }
+template <typename T> void foo(); // { dg-error "exception" }
struct bar
{
- template <typename T> friend void foo(); // { dg-error "exceptions" }
+ template <typename T> friend void foo(); // { dg-error "exception" }
};
diff --git a/gcc/testsuite/g++.dg/expr/cond8.C b/gcc/testsuite/g++.dg/expr/cond8.C
index f05c81a26ce..11708ec0f6f 100644
--- a/gcc/testsuite/g++.dg/expr/cond8.C
+++ b/gcc/testsuite/g++.dg/expr/cond8.C
@@ -3,11 +3,11 @@
struct A
{
- A(void*);
+ A(void*); // { dg-error "initializing" }
~A();
};
void foo(const int i, bool b)
{
- b ? A(0) : i; // { dg-error "conversion|initializing" }
+ b ? A(0) : i; // { dg-error "conversion" }
}
diff --git a/gcc/testsuite/g++.dg/expr/string-1.C b/gcc/testsuite/g++.dg/expr/string-1.C
index 3901427f439..9a0a5ff7b45 100644
--- a/gcc/testsuite/g++.dg/expr/string-1.C
+++ b/gcc/testsuite/g++.dg/expr/string-1.C
@@ -1,9 +1,11 @@
// { dg-do compile }
// This testcase used to seg fault (PR c++/38648)
+// { dg-prune-output "initializer lists" }
+
char a[1];
-int foo( // { dg-error "extended initializer lists only available" }
+int foo(
{
a = ""; // { dg-error "" }
return 0; // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/ext/attr-alias-1.C b/gcc/testsuite/g++.dg/ext/attr-alias-1.C
new file mode 100644
index 00000000000..1427267e517
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-alias-1.C
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-require-alias "" } */
+
+#include <typeinfo>
+
+struct Klass
+{
+ int implementation () const;
+ int magic () const;
+};
+
+int Klass::implementation (void) const
+{
+ return 0;
+}
+
+int Klass::magic () const
+ __attribute__ ((alias ("_ZNK5Klass14implementationEv")));
+
+int __attribute__ ((noinline))
+ Foo (Klass const *ptr)
+{
+ if (ptr->magic () != 0)
+ return 1;
+
+ if (typeid (*ptr) != typeid (Klass))
+ return 2;
+
+ return 0;
+}
+
+int main ()
+{
+ Klass obj;
+
+ return Foo (&obj);
+}
diff --git a/gcc/testsuite/g++.dg/ext/attr-alias-2.C b/gcc/testsuite/g++.dg/ext/attr-alias-2.C
new file mode 100644
index 00000000000..61a132f77a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-alias-2.C
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-require-alias "" } */
+
+#include <typeinfo>
+
+struct Klass
+{
+ int implementation () const;
+ virtual int magic () const;
+};
+
+int Klass::implementation (void) const
+{
+ return 0;
+}
+
+int Klass::magic () const
+ __attribute__ ((alias ("_ZNK5Klass14implementationEv")));
+
+int __attribute__ ((noinline))
+ Foo (Klass const *ptr)
+{
+ if (ptr->magic () != 0)
+ return 1;
+
+ if (typeid (*ptr) != typeid (Klass))
+ return 2;
+
+ return 0;
+}
+
+int main ()
+{
+ Klass obj;
+
+ return Foo (&obj);
+}
diff --git a/gcc/testsuite/g++.dg/ext/has_virtual_destructor.C b/gcc/testsuite/g++.dg/ext/has_virtual_destructor.C
index c263a94fd04..093e7f5004d 100644
--- a/gcc/testsuite/g++.dg/ext/has_virtual_destructor.C
+++ b/gcc/testsuite/g++.dg/ext/has_virtual_destructor.C
@@ -14,15 +14,15 @@ union U
double b;
};
-class B
+struct B
{
virtual ~B() { }
};
-class C
+struct C
: public B { };
-class D
+struct D
{
~D() { }
};
diff --git a/gcc/testsuite/g++.dg/ext/label13.C b/gcc/testsuite/g++.dg/ext/label13.C
index 7a2665c59d9..d932a9a5051 100644
--- a/gcc/testsuite/g++.dg/ext/label13.C
+++ b/gcc/testsuite/g++.dg/ext/label13.C
@@ -8,7 +8,7 @@ struct C
C();
};
-C::C() // { dg-bogus "can never be copied" "" { xfail *-apple-darwin* alpha*-dec-osf* } }
+C::C() // { dg-bogus "can never be copied" "" { xfail { { *-apple-darwin* alpha*-dec-osf* } || { hppa*-*-hpux* && { ! hppa*64*-*-* } } } } }
{
static void *labelref = &&label;
goto *labelref;
diff --git a/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C b/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C
index d5148bebbc6..51cc80cd2ac 100644
--- a/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C
+++ b/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C
@@ -5,72 +5,72 @@ struct C { };
bool nas1 = __has_nothrow_assign(I); // { dg-error "incomplete type" }
bool nas2 = __has_nothrow_assign(C[]);
-bool nas3 = __has_nothrow_assign(I[]);
+bool nas3 = __has_nothrow_assign(I[]); // { dg-error "incomplete type" }
bool nas4 = __has_nothrow_assign(void);
bool nas5 = __has_nothrow_assign(const void);
bool tas1 = __has_trivial_assign(I); // { dg-error "incomplete type" }
bool tas2 = __has_trivial_assign(C[]);
-bool tas3 = __has_trivial_assign(I[]);
+bool tas3 = __has_trivial_assign(I[]); // { dg-error "incomplete type" }
bool tas4 = __has_trivial_assign(void);
bool tas5 = __has_trivial_assign(const void);
bool nco1 = __has_nothrow_constructor(I); // { dg-error "incomplete type" }
bool nco2 = __has_nothrow_constructor(C[]);
-bool nco3 = __has_nothrow_constructor(I[]);
+bool nco3 = __has_nothrow_constructor(I[]); // { dg-error "incomplete type" }
bool nco4 = __has_nothrow_constructor(void);
bool nco5 = __has_nothrow_constructor(const void);
bool tco1 = __has_trivial_constructor(I); // { dg-error "incomplete type" }
bool tco2 = __has_trivial_constructor(C[]);
-bool tco3 = __has_trivial_constructor(I[]);
+bool tco3 = __has_trivial_constructor(I[]); // { dg-error "incomplete type" }
bool tco4 = __has_trivial_constructor(void);
bool tco5 = __has_trivial_constructor(const void);
bool ncp1 = __has_nothrow_copy(I); // { dg-error "incomplete type" }
bool ncp2 = __has_nothrow_copy(C[]);
-bool ncp3 = __has_nothrow_copy(I[]);
+bool ncp3 = __has_nothrow_copy(I[]); // { dg-error "incomplete type" }
bool ncp4 = __has_nothrow_copy(void);
bool ncp5 = __has_nothrow_copy(const void);
bool tcp1 = __has_trivial_copy(I); // { dg-error "incomplete type" }
bool tcp2 = __has_trivial_copy(C[]);
-bool tcp3 = __has_trivial_copy(I[]);
+bool tcp3 = __has_trivial_copy(I[]); // { dg-error "incomplete type" }
bool tcp4 = __has_trivial_copy(void);
bool tcp5 = __has_trivial_copy(const void);
bool vde1 = __has_virtual_destructor(I); // { dg-error "incomplete type" }
bool vde2 = __has_virtual_destructor(C[]);
-bool vde3 = __has_virtual_destructor(I[]);
+bool vde3 = __has_virtual_destructor(I[]); // { dg-error "incomplete type" }
bool vde4 = __has_virtual_destructor(void);
bool vde5 = __has_virtual_destructor(const void);
bool tde1 = __has_trivial_destructor(I); // { dg-error "incomplete type" }
bool tde2 = __has_trivial_destructor(C[]);
-bool tde3 = __has_trivial_destructor(I[]);
+bool tde3 = __has_trivial_destructor(I[]); // { dg-error "incomplete type" }
bool tde4 = __has_trivial_destructor(void);
bool tde5 = __has_trivial_destructor(const void);
bool abs1 = __is_abstract(I); // { dg-error "incomplete type" }
bool abs2 = __is_abstract(C[]);
-bool abs3 = __is_abstract(I[]);
+bool abs3 = __is_abstract(I[]); // { dg-error "incomplete type" }
bool abs4 = __is_abstract(void);
bool abs5 = __is_abstract(const void);
bool pod1 = __is_pod(I); // { dg-error "incomplete type" }
bool pod2 = __is_pod(C[]);
-bool pod3 = __is_pod(I[]);
+bool pod3 = __is_pod(I[]); // { dg-error "incomplete type" }
bool pod4 = __is_pod(void);
bool pod5 = __is_pod(const void);
bool emp1 = __is_empty(I); // { dg-error "incomplete type" }
bool emp2 = __is_empty(C[]);
-bool emp3 = __is_empty(I[]);
+bool emp3 = __is_empty(I[]); // { dg-error "incomplete type" }
bool emp4 = __is_empty(void);
bool emp5 = __is_empty(const void);
bool pol1 = __is_polymorphic(I); // { dg-error "incomplete type" }
bool pol2 = __is_polymorphic(C[]);
-bool pol3 = __is_polymorphic(I[]);
+bool pol3 = __is_polymorphic(I[]); // { dg-error "incomplete type" }
bool pol4 = __is_polymorphic(void);
bool pol5 = __is_polymorphic(const void);
diff --git a/gcc/testsuite/g++.dg/gomp/pr26690-1.C b/gcc/testsuite/g++.dg/gomp/pr26690-1.C
index c49c8b72180..71f1eb311ee 100644
--- a/gcc/testsuite/g++.dg/gomp/pr26690-1.C
+++ b/gcc/testsuite/g++.dg/gomp/pr26690-1.C
@@ -1,7 +1,7 @@
// PR c++/26690
// { dg-do compile }
-struct A // { dg-message "A::A\\(const A&\\)" }
+struct A // { dg-message "A::A" }
{
A (int); // { dg-message "candidates" }
};
diff --git a/gcc/testsuite/g++.dg/inherit/virtual5.C b/gcc/testsuite/g++.dg/inherit/virtual5.C
new file mode 100644
index 00000000000..bed0ef3a07b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/virtual5.C
@@ -0,0 +1,29 @@
+// Test that a synthesized op= can override one from a base.
+// { dg-do run }
+
+struct B;
+
+struct A
+{
+ virtual B& operator=(const B&);
+};
+
+struct B: A
+{
+ B(int i): i(i) { }
+ int i;
+ // implicitly-declared op=
+};
+
+B& A::operator=(const B& b) { return static_cast<B&>(*this); }
+
+int main()
+{
+ B b1 (123);
+ B b2 (0);
+
+ A& ar = b1;
+ ar = b2;
+
+ return b1.i;
+}
diff --git a/gcc/testsuite/g++.dg/init/ctor4.C b/gcc/testsuite/g++.dg/init/ctor4.C
index 0671dd8537d..1c92bb973d3 100644
--- a/gcc/testsuite/g++.dg/init/ctor4.C
+++ b/gcc/testsuite/g++.dg/init/ctor4.C
@@ -6,7 +6,7 @@ public:
foo();
};
-class bar: public foo {// { dg-error "uninitialized" }
+class bar: public foo { // { dg-error "reference|bar::bar" }
private:
int &a;
};
@@ -16,5 +16,5 @@ foo::foo() {
int main(int argc, char **argv)
{
- bar x; // { dg-message "synthesized" }
+ bar x; // { dg-message "synthesized|deleted" }
}
diff --git a/gcc/testsuite/g++.dg/init/new5.C b/gcc/testsuite/g++.dg/init/new5.C
index 3a5981e075c..0d99f93c634 100644
--- a/gcc/testsuite/g++.dg/init/new5.C
+++ b/gcc/testsuite/g++.dg/init/new5.C
@@ -2,8 +2,8 @@
#include <new>
-void * operator new[](size_t, std::nothrow_t const &) throw()
-{ return NULL; }
+void * operator new[](std::size_t, std::nothrow_t const &) throw()
+{ return 0; }
struct X {
struct Inner { ~Inner() {} };
diff --git a/gcc/testsuite/g++.dg/init/pr44086.C b/gcc/testsuite/g++.dg/init/pr44086.C
new file mode 100644
index 00000000000..e3304f4a27b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/pr44086.C
@@ -0,0 +1,15 @@
+// PR c++/44086
+// { dg-do compile }
+
+struct A
+{
+ int const i : 2; // { dg-message "should be initialized" }
+};
+
+void f()
+{
+ A a; // { dg-error "uninitialized const" }
+ new A; // { dg-error "uninitialized const" }
+ A();
+ new A();
+}
diff --git a/gcc/testsuite/g++.dg/init/synth2.C b/gcc/testsuite/g++.dg/init/synth2.C
index 624f10b2a4d..9e8a08a6ea3 100644
--- a/gcc/testsuite/g++.dg/init/synth2.C
+++ b/gcc/testsuite/g++.dg/init/synth2.C
@@ -5,7 +5,7 @@ struct G {
G(G&); // { dg-message "" "candidate" }
};
-class A // { dg-error "no match" }
+class A // { dg-error "" }
{
const G g;
};
@@ -13,5 +13,5 @@ class A // { dg-error "no match" }
int main()
{
A a;
- A b = a; // { dg-message "required here" }
+ A b = a; // { dg-message "required here|deleted" }
}
diff --git a/gcc/testsuite/g++.dg/ipa/iinline-2.C b/gcc/testsuite/g++.dg/ipa/iinline-2.C
new file mode 100644
index 00000000000..670a5dd9522
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/iinline-2.C
@@ -0,0 +1,61 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+extern void non_existent (const char *, int);
+
+class String
+{
+private:
+ const char *data;
+
+public:
+ String (const char *d) : data(d)
+ {}
+
+ int funcOne (int delim) const;
+ int printStuffTwice (int delim) const;
+};
+
+
+int String::funcOne (int delim) const
+{
+ int i;
+ for (i = 0; i < delim; i++)
+ non_existent(data, i);
+
+ return 1;
+}
+
+extern int global;
+
+int docalling (int c, int (String::* f)(int delim) const)
+{
+ String S ("muhehehe");
+
+ if (c > 2)
+ global = 3;
+ else
+ global = 5;
+
+ return (S.*f)(4);
+}
+
+int __attribute__ ((noinline,noclone)) get_input (void)
+{
+ return 1;
+}
+
+int main (int argc, char *argv[])
+{
+ int i = 0;
+ while (i < 1000)
+ i += docalling (get_input (), &String::funcOne);
+ non_existent ("done", i);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "String::funcOne\[^\\n\]*inline copy in int main" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/iinline-3.C b/gcc/testsuite/g++.dg/ipa/iinline-3.C
new file mode 100644
index 00000000000..3daee9a8681
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/iinline-3.C
@@ -0,0 +1,64 @@
+/* Verify that we do not indirect-inline using member pointer
+ parameters which have been modified. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+extern "C" void abort (void);
+
+class String
+{
+private:
+ const char *data;
+
+public:
+ String (const char *d) : data(d)
+ {}
+
+ int funcOne (int stuff) const;
+ int funcTwo (int stuff) const;
+};
+
+
+int String::funcOne (int stuff) const
+{
+ return stuff + 1;
+}
+
+int String::funcTwo (int stuff) const
+{
+ return stuff + 100;
+}
+
+int (String::* gmp)(int stuff) const = &String::funcTwo;
+
+int docalling_1 (int (String::* f)(int stuff) const)
+{
+ String S ("muhehehe");
+
+ return (S.*f)(4);
+}
+
+int docalling (int a, int (String::* f)(int stuff) const)
+{
+ if (a < 200)
+ f = gmp;
+
+ return docalling_1 (f);
+}
+
+int __attribute__ ((noinline,noclone)) get_input (void)
+{
+ return 1;
+}
+
+int main (int argc, char *argv[])
+{
+ int i = 0;
+ while (i < 10)
+ i += docalling (get_input (), &String::funcOne);
+
+ if (i != 104)
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118_1.C b/gcc/testsuite/g++.dg/lto/20081118_1.C
index b9e56a48b9b..a1bf08186df 100644
--- a/gcc/testsuite/g++.dg/lto/20081118_1.C
+++ b/gcc/testsuite/g++.dg/lto/20081118_1.C
@@ -1,4 +1,5 @@
class object {
+public:
virtual ~object() {}
};
diff --git a/gcc/testsuite/g++.dg/lto/20100603-1_0.C b/gcc/testsuite/g++.dg/lto/20100603-1_0.C
new file mode 100644
index 00000000000..8fe11a2f17c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100603-1_0.C
@@ -0,0 +1,14 @@
+/* { dg-lto-do link } */
+
+extern "C" {
+ typedef struct {} CvImage;
+ extern CvImage* Cv_ImageNew(void);
+}
+void __attribute__((noinline,noclone))
+_Raytrace(CvImage* LImage) { __asm volatile (""); }
+int main(int LArgC, char** LArgV)
+{
+ CvImage* LImage = Cv_ImageNew();
+ _Raytrace(LImage);
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20100603-1_1.c b/gcc/testsuite/g++.dg/lto/20100603-1_1.c
new file mode 100644
index 00000000000..fddce5d4b1e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100603-1_1.c
@@ -0,0 +1,2 @@
+typedef struct {} CvImage;
+CvImage* Cv_ImageNew(void) { }
diff --git a/gcc/testsuite/g++.dg/other/arm-neon-1.C b/gcc/testsuite/g++.dg/other/arm-neon-1.C
new file mode 100644
index 00000000000..33cc04b69dc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/arm-neon-1.C
@@ -0,0 +1,18 @@
+/* Basic smoke test for arm_neon.h */
+
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-add-options arm_neon } */
+
+#include "arm_neon.h"
+
+float a[4];
+
+void test(void)
+{
+ float32x2x2_t v;
+ float32x2_t res;
+ v = vld2_f32(a);
+ res = vadd_f32(v.val[0], v.val[1]);
+ vst1_f32(a, res);
+}
diff --git a/gcc/testsuite/g++.dg/other/error13.C b/gcc/testsuite/g++.dg/other/error13.C
index 89e88478679..784550180ff 100644
--- a/gcc/testsuite/g++.dg/other/error13.C
+++ b/gcc/testsuite/g++.dg/other/error13.C
@@ -5,6 +5,6 @@ struct A // { dg-message "note" }
A(void x); // { dg-error "invalid use|incomplete type|candidates" }
};
-struct B : A {}; // { dg-error "no matching function for call" }
+struct B : A {}; // { dg-error "no matching function for call|deleted" }
-B b; // { dg-message "synthesized method" }
+B b; // { dg-message "synthesized method|deleted" }
diff --git a/gcc/testsuite/g++.dg/other/error20.C b/gcc/testsuite/g++.dg/other/error20.C
index 6f3f778ab84..e546b3726e3 100644
--- a/gcc/testsuite/g++.dg/other/error20.C
+++ b/gcc/testsuite/g++.dg/other/error20.C
@@ -1,7 +1,7 @@
// PR c++/34275
// { dg-do compile }
-struct A // { dg-message "candidate is" }
+struct A // { dg-message "operator=" }
{
virtual A foo ();
};
diff --git a/gcc/testsuite/g++.dg/other/error31.C b/gcc/testsuite/g++.dg/other/error31.C
index c4095504d6d..d3e3e09a37c 100644
--- a/gcc/testsuite/g++.dg/other/error31.C
+++ b/gcc/testsuite/g++.dg/other/error31.C
@@ -3,7 +3,7 @@
// { dg-options "" }
// { dg-bogus "not supported by" "" { target *-*-* } 0 }
-struct A {}; // { dg-message "note: candidate is" }
+struct A {}; // { dg-message "operator=" }
void
foo ()
diff --git a/gcc/testsuite/g++.dg/other/pr25632.C b/gcc/testsuite/g++.dg/other/pr25632.C
index fe0ad7a2497..e66ae3b51ec 100644
--- a/gcc/testsuite/g++.dg/other/pr25632.C
+++ b/gcc/testsuite/g++.dg/other/pr25632.C
@@ -2,14 +2,12 @@
/* { dg-do compile } */
-#define unsigned
-__extension__ typedef __SIZE_TYPE__ ssize_t;
-#undef unsigned
+__extension__ typedef __INTPTR_TYPE__ intptr_t;
struct sockaddr_un {
char sun_path[1];
};
-const unsigned SI_SUN_HEAD_LEN = (ssize_t)(((struct sockaddr_un *)0)->sun_path);
+const unsigned SI_SUN_HEAD_LEN = (intptr_t)(((struct sockaddr_un *)0)->sun_path);
int SiGetPeerName ()
{
return SI_SUN_HEAD_LEN;
diff --git a/gcc/testsuite/g++.dg/other/typedef4.C b/gcc/testsuite/g++.dg/other/typedef4.C
new file mode 100644
index 00000000000..b752f2cae7a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/typedef4.C
@@ -0,0 +1,7 @@
+// { dg-options "-g" }
+// { dg-do compile }
+
+// On some platforms like MIPS, __builtin_va_list is a
+// RECORD_TYPE. Make sure we don't wrongly try to generate debug info
+// for its TYPE_DECL and crash.
+typedef __builtin_va_list foo;
diff --git a/gcc/testsuite/g++.dg/other/unused1.C b/gcc/testsuite/g++.dg/other/unused1.C
index d652f41a1de..2a3ca1be749 100644
--- a/gcc/testsuite/g++.dg/other/unused1.C
+++ b/gcc/testsuite/g++.dg/other/unused1.C
@@ -32,7 +32,7 @@ int bar4 (void)
return const_cast<printer *>(dotmatrix)->i;
}
-class class1 { virtual ~class1(); } *c1;
+class class1 { public: virtual ~class1(); } *c1;
class class2 : class1 { char j; };
int bar5 (void)
{
diff --git a/gcc/testsuite/g++.dg/overload/arg3.C b/gcc/testsuite/g++.dg/overload/arg3.C
index 8ece6a6f3ca..eb65271752e 100644
--- a/gcc/testsuite/g++.dg/overload/arg3.C
+++ b/gcc/testsuite/g++.dg/overload/arg3.C
@@ -14,10 +14,9 @@ struct B : A
B(B&); // { dg-message "candidates" "" }
};
-void foo(B);
+void foo(B); // { dg-error "initializing" }
void bar()
{
foo(0); // { dg-error "no matching function" "no matching" }
- // { dg-error "initializing" "initializing" { target *-*-* } 21 }
}
diff --git a/gcc/testsuite/g++.dg/overload/copy1.C b/gcc/testsuite/g++.dg/overload/copy1.C
index 6a774c6770b..2bd8e539dd1 100644
--- a/gcc/testsuite/g++.dg/overload/copy1.C
+++ b/gcc/testsuite/g++.dg/overload/copy1.C
@@ -10,12 +10,11 @@ struct B
struct A
{
- A (B);
+ A (B); // { dg-error "initializing" }
};
B
f (B const& b)
{
return b; // { dg-error "matching" "matching" }
- // { dg-error "initializing" "initializing" { target *-*-* } 19 }
}
diff --git a/gcc/testsuite/g++.dg/parse/error19.C b/gcc/testsuite/g++.dg/parse/error19.C
index 0955e6a9076..3b7e7175b17 100644
--- a/gcc/testsuite/g++.dg/parse/error19.C
+++ b/gcc/testsuite/g++.dg/parse/error19.C
@@ -1,7 +1,7 @@
// { dg-options "-fshow-column -fmessage-length=0 -ansi -pedantic-errors -Wno-long-long " }
// PR C++/17867
-struct A // { dg-message "8:candidate is:" }
+struct A // { dg-message "8:operator=" }
{
A(int);
};
diff --git a/gcc/testsuite/g++.dg/plugin/attribute_plugin.c b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c
index d62ab90542c..6327095f7cd 100644
--- a/gcc/testsuite/g++.dg/plugin/attribute_plugin.c
+++ b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c
@@ -8,6 +8,8 @@
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
+#include "toplev.h"
+#include "plugin.h"
int plugin_is_GPL_compatible;
diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
index 3aee8db840c..f12a6a0d35b 100644
--- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
+++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
@@ -9,6 +9,7 @@
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
+#include "toplev.h"
int plugin_is_GPL_compatible;
@@ -65,7 +66,7 @@ static struct gimple_opt_pass pass_dumb_plugin_example =
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
- 0, /* tv_id */
+ TV_NONE, /* tv_id */
PROP_cfg, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
diff --git a/gcc/testsuite/g++.dg/plugin/header_plugin.c b/gcc/testsuite/g++.dg/plugin/header_plugin.c
index 71a0c3bf2f4..a464827dee9 100644
--- a/gcc/testsuite/g++.dg/plugin/header_plugin.c
+++ b/gcc/testsuite/g++.dg/plugin/header_plugin.c
@@ -13,8 +13,8 @@
/* gcc/ headers. */
#include "cp/cp-tree.h"
#include "diagnostic.h"
-#include "c-common.h"
-#include "c-pretty-print.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pretty-print.h"
#include "tree-iterator.h"
#include "plugin.h"
#include "tree-flow.h"
diff --git a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c
index 237fcdddfa9..4a9ea47195d 100644
--- a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c
+++ b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c
@@ -9,10 +9,11 @@
#include "rtl.h"
#include "tree.h"
#include "function.h"
-#include "c-pragma.h"
+#include "c-family/c-pragma.h"
#include "cpplib.h"
#include "tree-pass.h"
#include "intl.h"
+#include "toplev.h"
int plugin_is_GPL_compatible;
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index 8d76301d815..eb8f24a45a8 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -52,9 +52,7 @@ get_real_ref_rhs (tree expr)
/* We are only interested in an assignment with a single
rhs operand because if it is not, the original assignment
will not possibly be a self-assignment. */
- if (is_gimple_assign (def_stmt)
- && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
- == GIMPLE_SINGLE_RHS))
+ if (gimple_assign_single_p (def_stmt))
return get_real_ref_rhs (gimple_assign_rhs1 (def_stmt));
else
return NULL_TREE;
@@ -66,7 +64,7 @@ get_real_ref_rhs (tree expr)
case PARM_DECL:
case FIELD_DECL:
case COMPONENT_REF:
- case INDIRECT_REF:
+ case MEM_REF:
case ARRAY_REF:
return expr;
default:
@@ -116,17 +114,18 @@ get_non_ssa_expr (tree expr)
else
return expr;
}
- case INDIRECT_REF:
+ case MEM_REF:
{
tree orig_base = TREE_OPERAND (expr, 0);
- tree base = get_non_ssa_expr (orig_base);
- if (!base)
- return NULL_TREE;
- /* If BASE is converted, build a new indirect reference tree. */
- if (base != orig_base)
- return build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (base)), base);
- else
- return expr;
+ if (TREE_CODE (orig_base) == SSA_NAME)
+ {
+ tree base = get_non_ssa_expr (orig_base);
+ if (!base)
+ return NULL_TREE;
+ return fold_build2 (MEM_REF, TREE_TYPE (expr),
+ base, TREE_OPERAND (expr, 1));
+ }
+ return expr;
}
case ARRAY_REF:
{
@@ -153,9 +152,7 @@ get_non_ssa_expr (tree expr)
&& !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
{
gimple def_stmt = SSA_NAME_DEF_STMT (expr);
- if (is_gimple_assign (def_stmt)
- && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
- == GIMPLE_SINGLE_RHS))
+ if (gimple_assign_single_p (def_stmt))
vdecl = gimple_assign_rhs1 (def_stmt);
}
return get_non_ssa_expr (vdecl);
@@ -201,9 +198,7 @@ warn_self_assign (gimple stmt)
tree rhs, lhs;
/* Check assigment statement. */
- if (is_gimple_assign (stmt)
- && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
- == GIMPLE_SINGLE_RHS))
+ if (gimple_assign_single_p (stmt))
{
rhs = get_real_ref_rhs (gimple_assign_rhs1 (stmt));
if (!rhs)
@@ -275,7 +270,7 @@ static struct gimple_opt_pass pass_warn_self_assign =
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
- 0, /* tv_id */
+ TV_NONE, /* tv_id */
PROP_ssa, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
diff --git a/gcc/testsuite/g++.dg/pr44486.C b/gcc/testsuite/g++.dg/pr44486.C
new file mode 100644
index 00000000000..01e84289f0b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr44486.C
@@ -0,0 +1,10 @@
+// PR c++/44486 missing space in __PRETTY_FUNCTION__ expansion in anonymous namespace
+// { dg-do compile }
+// { dg-options "" }
+
+struct S { };
+namespace { S f() { const char * s = __PRETTY_FUNCTION__; return S(); } }
+
+int main() { f(); }
+
+// { dg-final { scan-assembler "S \{anonymous\}::f" } }
diff --git a/gcc/testsuite/g++.dg/tc1/dr147.C b/gcc/testsuite/g++.dg/tc1/dr147.C
index a29986b5559..6799b7dccad 100644
--- a/gcc/testsuite/g++.dg/tc1/dr147.C
+++ b/gcc/testsuite/g++.dg/tc1/dr147.C
@@ -54,3 +54,13 @@ struct D: C::C
{
D(): C::C() { }
};
+
+// And if lookup doesn't find the injected-class-name, we aren't naming the
+// constructor (c++/44401).
+
+struct E
+{
+ int E;
+};
+
+int E::*p = &E::E;
diff --git a/gcc/testsuite/g++.dg/tc1/dr152.C b/gcc/testsuite/g++.dg/tc1/dr152.C
index cac7aacc0eb..fdf4f124bb1 100644
--- a/gcc/testsuite/g++.dg/tc1/dr152.C
+++ b/gcc/testsuite/g++.dg/tc1/dr152.C
@@ -7,12 +7,11 @@ namespace N1 {
X(); // { dg-message "candidate" }
explicit X(const X&);
};
- void f(X);
+ void f(X); // { dg-error "initializing" }
int foo()
{
X x;
f(x); // { dg-error "matching" "matching" }
- // { dg-error "initializing" "initializing" { target *-*-* } 14 }
}
}
@@ -24,14 +23,13 @@ namespace N2 {
};
template <class T>
- void f(T ) {}
+ void f(T ) {} // { dg-error "initializing" }
template <class T>
int foo()
{
X<T> x;
N2::f(x); // { dg-error "matching" "matching" }
- // { dg-error "initializing " initializing" { target *-*-* } 33 }
}
template int foo<float>(); // { dg-message "instantiated from here" }
diff --git a/gcc/testsuite/g++.dg/template/crash100.C b/gcc/testsuite/g++.dg/template/crash100.C
new file mode 100644
index 00000000000..c67ae2eca38
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash100.C
@@ -0,0 +1,24 @@
+// PR c++/44628
+
+template <typename T>
+class Temp
+{
+ int Val;
+ public:
+ operator T&(void) { return Val; }
+
+ virtual T& operator=(T a ) // { dg-error "overriding" }
+ {
+ Val = a;
+ return Val;
+ }
+};
+
+class Int : public Temp<int>
+{
+ public:
+ Int& operator=(int a) // { dg-error "conflicting return type" }
+ {
+ return (*this);
+ }
+};
diff --git a/gcc/testsuite/g++.dg/template/error23.C b/gcc/testsuite/g++.dg/template/error23.C
index 8e5dee76dda..f21d8d9d07c 100644
--- a/gcc/testsuite/g++.dg/template/error23.C
+++ b/gcc/testsuite/g++.dg/template/error23.C
@@ -8,10 +8,10 @@ struct nullptr_type {
operator T* ( void ) const {
return ( 0 );
}
-} const nullptr;
+} const nullptr_ob;
int main ( void ) {
- 0 == nullptr; // { dg-error "match" }
+ 0 == nullptr_ob; // { dg-error "match" }
}
diff --git a/gcc/testsuite/g++.dg/template/incomplete4.C b/gcc/testsuite/g++.dg/template/incomplete4.C
index 6129e0d6fd0..f2832a73c4c 100644
--- a/gcc/testsuite/g++.dg/template/incomplete4.C
+++ b/gcc/testsuite/g++.dg/template/incomplete4.C
@@ -5,12 +5,12 @@ class A; // { dg-error "forward declaration" }
template <typename T> struct X
{
- static int f (T);
+ static int f (T); // { dg-error "initializing" }
static const T &make ();
};
int
main ()
{
- return X<A>::f (X<A>::make ()); // { dg-error "invalid use of incomplete type|initializing argument" }
+ return X<A>::f (X<A>::make ()); // { dg-error "invalid use of incomplete type" }
}
diff --git a/gcc/testsuite/g++.dg/template/incomplete5.C b/gcc/testsuite/g++.dg/template/incomplete5.C
index 9641003ddda..f7802825fde 100644
--- a/gcc/testsuite/g++.dg/template/incomplete5.C
+++ b/gcc/testsuite/g++.dg/template/incomplete5.C
@@ -5,9 +5,9 @@ class A; // { dg-error "forward declaration" }
template <typename T> struct X
{
- static int f (T);
+ static int f (T); // { dg-error "initializing" }
static const T &make ();
- static const bool value = sizeof (f (make ())) == sizeof (int); // { dg-error "invalid use of incomplete type|initializing argument" }
+ static const bool value = sizeof (f (make ())) == sizeof (int); // { dg-error "invalid use of incomplete type" }
};
int
diff --git a/gcc/testsuite/g++.dg/template/qualified-id2.C b/gcc/testsuite/g++.dg/template/qualified-id2.C
new file mode 100644
index 00000000000..e88e8547457
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/qualified-id2.C
@@ -0,0 +1,27 @@
+// PR c++/44587
+// { dg-do run }
+
+template <const char *N> struct A { static const char *p; };
+template <const char *N> const char *A<N>::p = N;
+template <class T> struct B { static const char c[1]; typedef A<B<T>::c> C; };
+template <class T> const char B<T>::c[1] = "";
+template <class T> struct D { static const char c[1]; typedef A<c> C; };
+template <class T> const char D<T>::c[1] = "";
+
+template <int& I> struct E { static int *ip; };
+template <int& I> int* E<I>::ip = &I;
+template <class T> struct F { static int i; typedef E<F<T>::i> C; };
+template <class T> int F<T>::i;
+template <class T> struct G { static int i; typedef E<i> C; };
+template <class T> int G<T>::i;
+
+#define AS(X) if (!(X)) return 1;
+int main()
+{
+ AS(B<int>::C::p == B<int>::c);
+ AS(B<float>::C::p == B<float>::c);
+ AS(B<float>::C::p != B<int>::c);
+ AS(D<int>::C::p == D<int>::c);
+ AS(D<float>::C::p == D<float>::c);
+ AS(D<float>::C::p != D<int>::c);
+}
diff --git a/gcc/testsuite/g++.dg/template/qualified-id3.C b/gcc/testsuite/g++.dg/template/qualified-id3.C
new file mode 100644
index 00000000000..d97ef5c592b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/qualified-id3.C
@@ -0,0 +1,14 @@
+// PR c++/44587
+
+template <const int N> struct A { };
+template <class T> struct B {
+ static const int c;
+ typedef A<B<T>::c> C; // { dg-error "non-constant" }
+};
+template <class T> const int B<T>::c = sizeof (T);
+
+template <const int N> struct D { };
+template <class T> struct E {
+ static const int c = sizeof (T);
+ typedef D<E<T>::c> F; // OK
+};
diff --git a/gcc/testsuite/g++.dg/template/qualttp5.C b/gcc/testsuite/g++.dg/template/qualttp5.C
index fc93f462835..c3ebd8c82f6 100644
--- a/gcc/testsuite/g++.dg/template/qualttp5.C
+++ b/gcc/testsuite/g++.dg/template/qualttp5.C
@@ -4,7 +4,7 @@
template <class U> struct A
{
- template <class T> class B {}; // { dg-message "candidate is" }
+ template <class T> class B {}; // { dg-message "operator=" }
};
template <template <class> class TT> void f()
diff --git a/gcc/testsuite/g++.dg/torture/pr43801.C b/gcc/testsuite/g++.dg/torture/pr43801.C
new file mode 100644
index 00000000000..3b52d4abcc6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43801.C
@@ -0,0 +1,22 @@
+// PR tree-optimization/43801
+// { dg-do compile }
+// { dg-options "-fipa-cp -fipa-cp-clone" }
+
+struct A
+{
+ virtual void f (int);
+};
+struct B : virtual A
+{
+ virtual void f (int i) { if (i) A::f(0); }
+};
+struct C : virtual B
+{
+ virtual void f (int) { B::f(0); }
+};
+
+void
+foo ()
+{
+ C ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr43905.C b/gcc/testsuite/g++.dg/torture/pr43905.C
new file mode 100644
index 00000000000..0e49a32a1dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43905.C
@@ -0,0 +1,13 @@
+extern void sf ( __const char *);
+struct Matrix{
+ int operator[](int n){
+ sf ( __PRETTY_FUNCTION__);
+ }
+ int operator[](int n)const{
+ sf ( __PRETTY_FUNCTION__);
+ }
+};
+void calcmy(Matrix const &b, Matrix &c, int k){
+ b[k];
+ c[k];
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44357.C b/gcc/testsuite/g++.dg/torture/pr44357.C
new file mode 100644
index 00000000000..3380350e81b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44357.C
@@ -0,0 +1,228 @@
+/* { dg-do compile } */
+extern "C"
+{
+ typedef long unsigned int size_t;
+}
+namespace llvm
+{
+ namespace dont_use
+ {
+ template < typename T > double is_class_helper (...);
+ }
+ template < typename T > struct is_class
+ {
+ public:enum
+ { value = sizeof (char) == sizeof (dont_use::is_class_helper < T > (0)) };
+ };
+ template < typename T > struct isPodLike
+ {
+ static const bool value = !is_class < T >::value;
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Iterator > struct iterator_traits
+ {
+ };
+ template < typename _Tp > struct iterator_traits <_Tp * >
+ {
+ typedef _Tp value_type;
+ };
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp > class new_allocator
+ {
+ public:typedef size_t size_type;
+ typedef const _Tp & const_reference;
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
+ _Tp >
+ {
+ public:typedef size_t size_type;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef allocator < _Tp1 > other;
+ };
+ };
+ template < typename _Tp, typename _Alloc > struct _Vector_base
+ {
+ typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
+ };
+template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp,
+ _Alloc
+ >
+ {
+ typedef _Vector_base < _Tp, _Alloc > _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef size_t size_type;
+ size_type size () const
+ {
+ } const_reference operator[] (size_type __n) const
+ {
+ }};
+}
+
+namespace llvm
+{
+ struct LandingPadInfo;
+ class DwarfException
+ {
+ static bool PadLT (const LandingPadInfo * L, const LandingPadInfo * R);
+ struct CallSiteEntry
+ {
+ };
+ void EmitExceptionTable ();
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _RandomAccessIterator,
+ typename _Compare >
+ void __unguarded_linear_insert (_RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typename iterator_traits < _RandomAccessIterator >::value_type __val =
+ (*__last);
+ _RandomAccessIterator __next = __last;
+ while (__comp (__val, *__next))
+ {
+ }
+ }
+ template < typename _RandomAccessIterator,
+ typename _Compare > void __insertion_sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+ {
+ if (__comp (*__i, *__first))
+ {
+ }
+ else
+ std::__unguarded_linear_insert (__i, __comp);
+ }
+ }
+ enum
+ { _S_threshold = 16 };
+ template < typename _RandomAccessIterator,
+ typename _Compare >
+ void __final_insertion_sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ if (__last - __first > int (_S_threshold))
+ {
+ std::__insertion_sort (__first, __first + int (_S_threshold), __comp);
+ }
+ }
+ template < typename _RandomAccessIterator,
+ typename _Compare > inline void sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ if (__first != __last)
+ {
+ std::__final_insertion_sort (__first, __last, __comp);
+ }
+ }
+}
+
+namespace llvm
+{
+ class SmallVectorBase
+ {
+ protected:void *BeginX, *EndX, *CapacityX;
+ struct U
+ {
+ } FirstEl;
+ protected: SmallVectorBase (size_t Size):BeginX (&FirstEl), EndX (&FirstEl),
+ CapacityX ((char *) &FirstEl + Size)
+ {
+ }};
+template < typename T > class SmallVectorTemplateCommon:public
+ SmallVectorBase
+ {
+ public: SmallVectorTemplateCommon (size_t Size):SmallVectorBase (Size)
+ {
+ } typedef size_t size_type;
+ typedef T *iterator;
+ iterator begin ()
+ {
+ } iterator end ()
+ {
+ } size_type size () const
+ {
+ }};
+template < typename T, bool isPodLike > class SmallVectorTemplateBase:public SmallVectorTemplateCommon <
+ T >
+ {
+ public: SmallVectorTemplateBase (size_t Size):SmallVectorTemplateCommon < T >
+ (Size)
+ {
+ }};
+template < typename T > class SmallVectorImpl:public SmallVectorTemplateBase < T,
+ isPodLike < T >::value >
+ {
+ typedef SmallVectorTemplateBase < T, isPodLike < T >::value > SuperClass;
+ public:typedef typename SuperClass::iterator iterator;
+ explicit SmallVectorImpl (unsigned N):SmallVectorTemplateBase < T,
+ isPodLike < T >::value > (N * sizeof (T))
+ {
+ }
+ };
+ template < typename T,
+ unsigned N > class SmallVector:public SmallVectorImpl < T >
+ {
+ typedef typename SmallVectorImpl < T >::U U;
+ enum
+ { MinUs =
+ (static_cast < unsigned int >(sizeof (T)) * N + static_cast <
+ unsigned int >(sizeof (U)) - 1) /static_cast <
+ unsigned int >(sizeof (U)), NumInlineEltsElts =
+ MinUs > 1 ? (MinUs - 1) : 1, NumTsAvailable =
+ (NumInlineEltsElts + 1) * static_cast <
+ unsigned int >(sizeof (U)) / static_cast <
+ unsigned int >(sizeof (T)) };
+ public: SmallVector ():SmallVectorImpl < T > (NumTsAvailable)
+ {
+ }
+ };
+ struct LandingPadInfo
+ {
+ std::vector < int >TypeIds;
+ union
+ {
+ } Contents;
+ };
+}
+
+using namespace llvm;
+bool
+DwarfException::PadLT (const LandingPadInfo * L, const LandingPadInfo * R)
+{
+ const std::vector < int >&LIds = L->TypeIds, &RIds = R->TypeIds;
+ unsigned LSize = LIds.size (), RSize = RIds.size ();
+ unsigned MinSize = LSize < RSize ? LSize : RSize;
+ for (unsigned i = 0; i != MinSize; ++i)
+ if (LIds[i] != RIds[i])
+ return LIds[i] < RIds[i];
+}
+
+void
+DwarfException::EmitExceptionTable ()
+{
+ SmallVector < const LandingPadInfo *, 64 > LandingPads;
+ std::sort (LandingPads.begin (), LandingPads.end (), PadLT);
+ SmallVector < CallSiteEntry, 64 > CallSites;
+ for (unsigned i = 0, e = CallSites.size (); i < e; ++i)
+ {
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44492.C b/gcc/testsuite/g++.dg/torture/pr44492.C
new file mode 100644
index 00000000000..41669241e7e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44492.C
@@ -0,0 +1,31 @@
+// PR middle-end/44492
+// { dg-do run }
+
+struct T { unsigned long p; };
+struct S { T a, b, c; unsigned d; };
+
+__attribute__((noinline))
+void
+bar (const T &x, const T &y)
+{
+ if (x.p != 0x2348 || y.p != 0x2346)
+ __builtin_abort ();
+}
+
+__attribute__((noinline))
+void
+foo (S &s, T e)
+{
+ unsigned long a = e.p;
+ unsigned long b = s.b.p;
+ __asm__ volatile ("" : : "rm" (a), "rm" (b));
+ bar (e, s.b);
+}
+
+int
+main ()
+{
+ S s = { { 0x2345 }, { 0x2346 }, { 0x2347 }, 6 };
+ T t = { 0x2348 };
+ foo (s, t);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44535.C b/gcc/testsuite/g++.dg/torture/pr44535.C
new file mode 100644
index 00000000000..9126f3997fb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44535.C
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+
+namespace FOO {
+
+template <typename T>
+class A
+{
+public:
+ void Enum();
+ virtual void OnProv() = 0;
+ virtual ~A() { }
+};
+typedef A<char> B;
+
+template<typename T>
+void A<T>::Enum ()
+{
+ OnProv ();
+}
+} // namespace FOO
+
+class C {};
+
+class D: public C, public FOO::B {
+public:
+ void OnProv() {}
+};
+
+int main(int argc, char *argv[])
+{
+ D x;
+ x.Enum();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C b/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C
index 2be04691537..03f6b1207c7 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C
@@ -25,5 +25,7 @@ int foo(Object&o)
return o[0];
}
-/* { dg-final { scan-tree-dump-not ".* = \[^>;\]*;" "dce2" } } */
+/* Remaining should be two loads. */
+
+/* { dg-final { scan-tree-dump-times " = \[^\n\]*;" 2 "dce2" } } */
/* { dg-final { cleanup-tree-dump "dce2" } } */
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr31146.C b/gcc/testsuite/g++.dg/tree-ssa/pr31146.C
index 96790239693..478a488e3c2 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr31146.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr31146.C
@@ -12,5 +12,5 @@ void foo (int j)
*q = 1;
}
-/* { dg-final { scan-tree-dump "i\\\[j.*\\\] =.* 1;" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "MEM\\\[.*&i\\\]\\\[j.*\\\] =.* 1;" "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop?" } } */
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
index d78006220ed..7e820d3ef16 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-optimized-vops" } */
struct Value
{
@@ -35,12 +35,14 @@ int main(int argc, char *argv[])
return 0;
}
-/* Check that we forward propagated
+/* Check that we propagate
D.2182_13 = (struct Ref *) &D.2137.lhs;
to
D.2182_13->lhs.m ={v} &I;
yielding
- D.2137.lhs.m ={v} &I; */
+ D.2137.lhs.m ={v} &I;
+ so that SRA can promote all locals to registers and we end up
+ referencing a single virtual operand at abort () after optimization. */
-/* { dg-final { scan-tree-dump-times "D\\\.....\\\..hs\\\.m =" 2 "forwprop1" } } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times ".MEM_\[0-9\]*\\\(D\\\)" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-10.C b/gcc/testsuite/g++.dg/warn/Wunused-var-10.C
new file mode 100644
index 00000000000..ffdb8932790
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-10.C
@@ -0,0 +1,42 @@
+// PR c++/44412
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+struct S
+{
+ static const int a = 3;
+ static int b;
+ int c;
+};
+
+const int S::a;
+int S::b = 4;
+
+int
+f1 ()
+{
+ S s;
+ return s.a;
+}
+
+int
+f2 ()
+{
+ S s;
+ return s.b;
+}
+
+void
+f3 ()
+{
+ S s; // { dg-warning "set but not used" }
+ s.c = 6;
+}
+
+int
+f4 ()
+{
+ S s;
+ s.c = 6;
+ return s.c;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-11.C b/gcc/testsuite/g++.dg/warn/Wunused-var-11.C
new file mode 100644
index 00000000000..c7c1bf35ff7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-11.C
@@ -0,0 +1,33 @@
+// PR c++/44412
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+struct S
+{
+ int foo ();
+ static int bar ();
+};
+
+int S::foo ()
+{
+ return 5;
+}
+
+int S::bar ()
+{
+ return 6;
+}
+
+int
+f1 ()
+{
+ S s;
+ return s.foo ();
+}
+
+int
+f2 ()
+{
+ S s;
+ return s.bar ();
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-12.C b/gcc/testsuite/g++.dg/warn/Wunused-var-12.C
new file mode 100644
index 00000000000..3300cbe3d8a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-12.C
@@ -0,0 +1,36 @@
+// PR c++/44444
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+struct S
+{
+ const int &u;
+ const int &v;
+ S (const int &a, const int &b) : u(a), v(b) { }
+};
+
+bool
+f1 ()
+{
+ bool t = false;
+ S z = S (1, 2);
+ t |= z.u == 1;
+ t |= z.v == 2;
+ return t;
+}
+
+void
+f2 ()
+{
+ S z = S (1, 2);
+ z.u; // { dg-warning "no effect" }
+}
+
+int i;
+
+void
+f3 ()
+{
+ S z = S (1, 2);
+ i++, z.u; // { dg-warning "no effect" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-13.C b/gcc/testsuite/g++.dg/warn/Wunused-var-13.C
new file mode 100644
index 00000000000..43df81d888c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-13.C
@@ -0,0 +1,22 @@
+// PR c++/44619
+// { dg-do compile }
+// { dg-options "-Wunused -W" }
+
+struct S { int x, y; };
+
+int
+f1 ()
+{
+ struct S p;
+ int S::*q = &S::x;
+ p.*q = 5;
+ return p.*q;
+}
+
+int
+f2 (struct S *p, int S::*q)
+{
+ struct S *r = p;
+ int S::*s = q;
+ return r->*s;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-14.C b/gcc/testsuite/g++.dg/warn/Wunused-var-14.C
new file mode 100644
index 00000000000..a552b56dad1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-14.C
@@ -0,0 +1,17 @@
+// PR c++/44682
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+struct S { virtual ~S () {} };
+struct T { virtual ~T () {} };
+struct U : S, T {};
+
+void f (U &);
+
+void
+g (void *v)
+{
+ T *t = static_cast <T *> (v);
+ U *u = static_cast <U *> (t);
+ f (*u);
+}
diff --git a/gcc/testsuite/g++.dg/warn/incomplete2.C b/gcc/testsuite/g++.dg/warn/incomplete2.C
index 9fdfcba9479..30be26749c9 100644
--- a/gcc/testsuite/g++.dg/warn/incomplete2.C
+++ b/gcc/testsuite/g++.dg/warn/incomplete2.C
@@ -3,11 +3,11 @@
class A; // { dg-error "forward declaration" }
-int f (A);
+int f (A); // { dg-error "initializing" }
const A &make ();
int
main ()
{
- return f (make ()); // { dg-error "invalid use of incomplete type|initializing argument" }
+ return f (make ()); // { dg-error "invalid use of incomplete type" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.bob/inherit2.C b/gcc/testsuite/g++.old-deja/g++.bob/inherit2.C
index 14bc32b6a78..6e26ecfa639 100644
--- a/gcc/testsuite/g++.old-deja/g++.bob/inherit2.C
+++ b/gcc/testsuite/g++.old-deja/g++.bob/inherit2.C
@@ -10,16 +10,15 @@ private:
const A& operator =(const A &) { abort(); }
};
-class B : public A { // { dg-error "within" }
+class B : public A { // { dg-error "" }
public:
B(void) {}
};
-void f(B b) {
+void f(B b) { // { dg-error "initializing" }
}
void g() {
B h;
- f(h); // { dg-error "argument" "arg" }
- // { dg-message "synthesized" "synth" { target *-*-* } 23 }
+ f(h); // { dg-message "synthesized|deleted" "synth" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900205_04.C b/gcc/testsuite/g++.old-deja/g++.bugs/900205_04.C
index 8d91db67ae8..4290144f89f 100644
--- a/gcc/testsuite/g++.old-deja/g++.bugs/900205_04.C
+++ b/gcc/testsuite/g++.old-deja/g++.bugs/900205_04.C
@@ -23,9 +23,9 @@ struct0::struct0 (int, void *) // { dg-message "note" }
{
}
-struct struct0_derived_struct_0 : public struct0 { // { dg-error "no matching" }
+struct struct0_derived_struct_0 : public struct0 { // { dg-error "no matching|deleted" }
};
-struct0_derived_struct_0 object; // { dg-message "synthesized" }
+struct0_derived_struct_0 object; // { dg-message "synthesized|deleted" }
int main () { return 0; }
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C
index 3826e08e009..c06cef18380 100644
--- a/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C
+++ b/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C
@@ -16,7 +16,7 @@
struct t_0_st_0;
-struct t_0_st_1 {
+struct t_0_st_1 { // { dg-error "initializing" }
int member;
t_0_st_1 (t_0_st_0&);// { dg-message "note" }
@@ -83,7 +83,7 @@ void t_1_local_init ()
struct t_2_st_0;
-struct t_2_st_1 {
+struct t_2_st_1 { // { dg-error "initializing" }
int member;
t_2_st_1 (t_2_st_0); // { dg-message "note" }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new.C b/gcc/testsuite/g++.old-deja/g++.jason/new.C
index d5260ce8eca..905739b1ba3 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/new.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/new.C
@@ -3,10 +3,10 @@
#include <new>
extern "C" int printf (const char *, ...);
-extern "C" void *malloc (size_t);
-size_t s;
+extern "C" void *malloc (std::size_t);
+std::size_t s;
-void * operator new (size_t siz) throw (std::bad_alloc) {
+void * operator new (std::size_t siz) throw (std::bad_alloc) {
if (s == 0)
s = siz;
else
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opeq3.C b/gcc/testsuite/g++.old-deja/g++.jason/opeq3.C
index 7a50abb2567..b4e6e2550c0 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/opeq3.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/opeq3.C
@@ -1,7 +1,7 @@
// { dg-do assemble }
// Bug: g++ generates code for assignment in invalid situations.
-class X { // { dg-error "assignment" }
+class X { // { dg-error "reference|operator=" }
int& a;
public:
X(int& i): a(i) { }
@@ -11,5 +11,5 @@ void foo ()
{
int one=1, two=2;
X a(one), b(two);
- a = b; // { dg-message "synthesized" }
+ a = b; // { dg-message "synthesized|deleted" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors17.C b/gcc/testsuite/g++.old-deja/g++.law/ctors17.C
index 3d63d01c0a9..0d61c49abd7 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/ctors17.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/ctors17.C
@@ -6,10 +6,12 @@
// Subject: gcc 2.4.3.1: illegal constructor call not rejected
// Date: Tue, 15 Jun 1993 18:34:14 +0200 (MET DST)
+// C++0x mode doesn't print the deleted copy constructor as a candidate.
+// { dg-prune-output ":14:" }
#include <fstream>
-class X : public std::ifstream { // { dg-message "note" } candidate
+class X : public std::ifstream {
public:
X(int a, const char *b) {} // { dg-message "note" } candidate
};
diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors5.C b/gcc/testsuite/g++.old-deja/g++.law/ctors5.C
index 7c376229b69..7b2c782b30b 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/ctors5.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/ctors5.C
@@ -5,7 +5,7 @@
// Subject: bug in handling static const object of the enclosing class
// Date: Tue, 1 Sep 92 10:38:44 EDT
-class X // { dg-message "7:X::X\\(const X&\\)" } implicit constructor
+class X // { dg-message "7:X::X" } implicit constructor
{
private:
int x;
diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators27.C b/gcc/testsuite/g++.old-deja/g++.law/operators27.C
index c284a2a3cde..5fb3a74cbfa 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/operators27.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/operators27.C
@@ -12,7 +12,7 @@ int FLAG=0;
extern "C" int printf( const char *, ...);
-void * operator new(size_t, const std::nothrow_t&) throw() { FLAG=1; return 0; }
+void * operator new(std::size_t, const std::nothrow_t&) throw() { FLAG=1; return 0; }
class K {
private:
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p755.C b/gcc/testsuite/g++.old-deja/g++.mike/p755.C
index bf4302b797e..28eeefad43d 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p755.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p755.C
@@ -6,7 +6,7 @@
extern "C" void _exit(int);
-void* operator new(size_t sz) throw (std::bad_alloc) {
+void* operator new(std::size_t sz) throw (std::bad_alloc) {
void* p = 0;
_exit(0);
return p;
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/delete1.C b/gcc/testsuite/g++.old-deja/g++.oliva/delete1.C
index 3912dbad5ed..368a87a2a9a 100644
--- a/gcc/testsuite/g++.old-deja/g++.oliva/delete1.C
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/delete1.C
@@ -28,5 +28,4 @@ struct baz : foo {
virtual ~baz() {} // { dg-error "" } delete is private in vdtor
} baz_;
-struct bad : baz {} bad_; // { dg-error "" } delete is private in vdtor
-// { dg-message "synthesized" "note" { target *-*-* } 31 }
+struct bad : baz {} bad_; // { dg-message "" } delete is private in vdtor
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C
index 4c1db253bbc..c50b1b7d6be 100644
--- a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C
@@ -1,5 +1,4 @@
// { dg-do assemble }
-// { dg-xfail-if "" { i386-pc-solaris* } { "*" } { "" } }
// Copyright (C) 1999 Free Software Foundation
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C
index 3c01238a38e..bbe5b0c9c57 100644
--- a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C
@@ -1,5 +1,4 @@
// { dg-do assemble }
-// { dg-xfail-if "" { i386-pc-solaris* } { "*" } { "" } }
// Copyright (C) 1999 Free Software Foundation
diff --git a/gcc/testsuite/g++.old-deja/g++.other/delete3.C b/gcc/testsuite/g++.old-deja/g++.other/delete3.C
index 469d6382eae..9c6c58e966e 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/delete3.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/delete3.C
@@ -16,7 +16,7 @@ map<T, U>::~map ()
struct SomeClass { };
-void* operator new(size_t numBytes, SomeClass&, const std::nothrow_t&) throw()
+void* operator new(std::size_t numBytes, SomeClass&, const std::nothrow_t&) throw()
{
return operator new(numBytes, std::nothrow);
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/init19.C b/gcc/testsuite/g++.old-deja/g++.other/init19.C
index 6d9c8290ed3..1c686841243 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/init19.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/init19.C
@@ -1,4 +1,4 @@
-// { dg-do run { xfail { ! cxa_atexit } } }
+// { dg-do run { xfail { { ! cxa_atexit } && { ! *-*-solaris2* } } } }
#include <stdlib.h>
#define assert(x) do { if (! (x)) abort(); } while (0)
diff --git a/gcc/testsuite/g++.old-deja/g++.other/new.C b/gcc/testsuite/g++.old-deja/g++.other/new.C
index c3d77c6ca63..3c3494ef759 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/new.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/new.C
@@ -3,12 +3,12 @@
#include <new>
inline void *
-operator new(size_t alloc_sz, const char *fname, unsigned lineno)
+operator new(std::size_t alloc_sz, const char *fname, unsigned lineno)
{
return ::operator new (alloc_sz);
}
inline void *
-operator new[](size_t alloc_sz, const char *fname, unsigned lineno)
+operator new[](std::size_t alloc_sz, const char *fname, unsigned lineno)
{
return ::operator new[] (alloc_sz);
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/assign1.C b/gcc/testsuite/g++.old-deja/g++.pt/assign1.C
index 464b7c692d0..854d8ee27a9 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/assign1.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/assign1.C
@@ -2,7 +2,7 @@
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-struct S { // { dg-error "assignment" }
+struct S { // { dg-error "const|operator=" }
S();
T t;
};
@@ -10,5 +10,5 @@ struct S { // { dg-error "assignment" }
void f()
{
S<const int> s;
- s = s; // { dg-message "synthesized" }
+ s = s; // { dg-message "synthesized|deleted" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/auto_ptr.C b/gcc/testsuite/g++.old-deja/g++.pt/auto_ptr.C
index 37af9ca434e..3a587d8738e 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/auto_ptr.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/auto_ptr.C
@@ -44,7 +44,7 @@ struct Derived : Base { Derived() {} };
auto_ptr<Derived> f() { auto_ptr<Derived> null(0); return null; }
void g(auto_ptr<Derived>) { }
-void h(auto_ptr<Base>) { }
+void h(auto_ptr<Base>) { } // { dg-error "initializing" }
int main() {
auto_ptr<Base> x(f());
@@ -52,5 +52,4 @@ int main() {
x = y;
g(f());
h(f()); // { dg-error "match" "match" } no usable copy ctor
-// { dg-error "initializing" "init" { target *-*-* } 54 }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash20.C b/gcc/testsuite/g++.old-deja/g++.pt/crash20.C
index 0a3220921ce..a5175b9909b 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash20.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash20.C
@@ -1,8 +1,7 @@
// { dg-do compile }
template <class T = int>
-struct A { // { dg-error "assignment" "assignment" }
-// { dg-message "instantiated" "inst" { target *-*-* } 4 }
+struct A { // { dg-message "const|operator=" "assignment" }
const T x;
A() : x(0) { } A(T x) : x(x) { }
};
@@ -11,7 +10,7 @@ template <class B>
void func ()
{
B y;
- y = B(); // { dg-message "synthesized" }
+ y = B(); // { dg-message "synthesized|deleted" }
}
int main (void) { func< A<> >(); }
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash9.C b/gcc/testsuite/g++.old-deja/g++.pt/crash9.C
index 20bd7584fdd..f2d811dda1a 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash9.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash9.C
@@ -1,11 +1,11 @@
// { dg-do assemble }
template <class T>
-void f(T) {}
+void f(T) {} // { dg-error "initializing" }
class C; // { dg-error "forward declaration" }
void g(const C& c)
{
- f(c); // { dg-error "invalid use of incomplete type|initializing argument" }
+ f(c); // { dg-error "invalid use of incomplete type" }
}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20100609-1.c b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c
new file mode 100644
index 00000000000..8e1175faa32
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c
@@ -0,0 +1,8 @@
+extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base);
+int find_reloads (int i, char *p)
+{
+ int c;
+ while ((c = *p++))
+ return strtoul (p - 1, &p, 10);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pc44485.c b/gcc/testsuite/gcc.c-torture/compile/pc44485.c
new file mode 100644
index 00000000000..fc959257dd3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pc44485.c
@@ -0,0 +1,46 @@
+static int
+foo (int si1, int si2)
+{
+ return si1 > 0 && si2 > 0 && si1 > -si2 || si1 < 0 && si2 < 0
+ && si1 < -si2 ? : si1 + si2;
+}
+
+struct S0
+{
+ unsigned short f1;
+};
+int g_4;
+struct S0 g_54 = {
+ 3428
+};
+
+int
+func_21 (int * p_22, int * const int32p_24, unsigned p_25,
+ const int * p_26);
+
+void int324 (unsigned p_15, int * p_16, int * p_17, int * p_18)
+{
+ if (foo (g_4, func_21 (p_18, &g_4, 0, 0)))
+ {
+ for (g_54.f1; g_54.f1; g_54.f1 += 1)
+ {
+ }
+ }
+}
+
+int
+func_21 (int * p_22, int * const int32p_24, unsigned p_25,
+ const int * p_26)
+{
+ for (0; 1; p_25 += 1)
+ lbl_29:if (p_25)
+ goto lbl_28;
+lbl_28:for (p_25 = 0; p_25 < 9; p_25 += 1)
+ if (p_25)
+ goto lbl_29;
+ unsigned short l_53;
+ for (0; l_53; l_53 = foo)
+ {
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44686.c b/gcc/testsuite/gcc.c-torture/compile/pr44686.c
new file mode 100644
index 00000000000..eacd83d3130
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44686.c
@@ -0,0 +1,7 @@
+/* { dg-options "-O2 -fipa-pta -fprofile-generate" } */
+void *
+memcpy (void *a, const void *b, __SIZE_TYPE__ len)
+{
+ if (a == b)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44687.c b/gcc/testsuite/gcc.c-torture/compile/pr44687.c
new file mode 100644
index 00000000000..f59c2efd0f5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44687.c
@@ -0,0 +1,32 @@
+typedef int int32_t;
+typedef unsigned char uint8_t;
+struct S0
+{
+ uint8_t f0;
+};
+struct S0 *g_18[7][5][1][1] = {
+};
+
+struct S0 **g_17 = &g_18[0][3][0][0];
+int32_t g_86;
+struct S0 func_72 (uint8_t p_73, struct S0 p_74);
+
+void int326 (struct S0 **p_67, int32_t p_68, int32_t * *const p_69,
+ struct S0 *p_70)
+{
+ struct S0 l_95 = {
+ -1L
+ };
+ func_72 (1L, func_72 (0, l_95));
+}
+
+struct S0
+func_72 (uint8_t p_73, struct S0 p_74)
+{
+ int32_t *l_85 = &g_86;
+ if (*l_85)
+ lbl_94:*l_85 ^= 0;
+ if (g_86)
+ goto lbl_94;
+ return **g_17;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20100316-1.c b/gcc/testsuite/gcc.c-torture/execute/20100316-1.c
new file mode 100644
index 00000000000..8367d7273d2
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20100316-1.c
@@ -0,0 +1,24 @@
+struct Foo {
+ int i;
+ unsigned precision : 10;
+ unsigned blah : 3;
+} f;
+
+int __attribute__((noinline,noclone))
+foo (struct Foo *p)
+{
+ struct Foo *q = p;
+ return (*q).precision;
+}
+
+extern void abort (void);
+
+int main()
+{
+ f.i = -1;
+ f.precision = 0;
+ f.blah = -1;
+ if (foo (&f) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/960321-1.x b/gcc/testsuite/gcc.c-torture/execute/960321-1.x
new file mode 100644
index 00000000000..44cc702686d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/960321-1.x
@@ -0,0 +1,15 @@
+# This test fails to link on 64-bit Solaris 2/x86 due to a Sun as bug.
+if { [istarget "i?86-*-solaris2*"]
+ && ! [check_effective_target_ilp32]
+ && ! [check_effective_target_gas] } {
+ set torture_eval_before_compile {
+ global compiler_conditional_xfail_data
+ set compiler_conditional_xfail_data {
+ "64-bit Sun as bug" \
+ { "i?86-*-solaris2*" } \
+ { "-O[1-3s]" } \
+ { "" }
+ }
+ }
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/frame-address.c b/gcc/testsuite/gcc.c-torture/execute/frame-address.c
index 942f5c5d653..109c2b229c8 100644
--- a/gcc/testsuite/gcc.c-torture/execute/frame-address.c
+++ b/gcc/testsuite/gcc.c-torture/execute/frame-address.c
@@ -25,7 +25,8 @@ int check_fa (char *unused)
{
const char c = 0;
- return check_fa_mid (&c);
+ /* Prevent a tail call to check_fa_mid, eliding the current stack frame. */
+ return check_fa_mid (&c) != 0;
}
int how_much (void)
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44468.c b/gcc/testsuite/gcc.c-torture/execute/pr44468.c
new file mode 100644
index 00000000000..c4bd492656d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr44468.c
@@ -0,0 +1,60 @@
+#include <stddef.h>
+
+struct S {
+ int i;
+ int j;
+};
+struct R {
+ int k;
+ struct S a;
+};
+struct Q {
+ float k;
+ struct S a;
+};
+struct Q s;
+int __attribute__((noinline,noclone))
+test1 (void *q)
+{
+ struct S *b = (struct S *)((char *)q + sizeof (int));
+ s.a.i = 0;
+ b->i = 3;
+ return s.a.i;
+}
+int __attribute__((noinline,noclone))
+test2 (void *q)
+{
+ struct S *b = &((struct R *)q)->a;
+ s.a.i = 0;
+ b->i = 3;
+ return s.a.i;
+}
+int __attribute__((noinline,noclone))
+test3 (void *q)
+{
+ s.a.i = 0;
+ ((struct S *)((char *)q + sizeof (int)))->i = 3;
+ return s.a.i;
+}
+extern void abort (void);
+int
+main()
+{
+ if (sizeof (float) != sizeof (int)
+ || offsetof (struct R, a) != sizeof (int)
+ || offsetof (struct Q, a) != sizeof (int))
+ return 0;
+ s.a.i = 1;
+ s.a.j = 2;
+ if (test1 ((void *)&s) != 3)
+ abort ();
+ s.a.i = 1;
+ s.a.j = 2;
+ if (test2 ((void *)&s) != 3)
+ abort ();
+ s.a.i = 1;
+ s.a.j = 2;
+ if (test3 ((void *)&s) != 3)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44555.c b/gcc/testsuite/gcc.c-torture/execute/pr44555.c
new file mode 100644
index 00000000000..6ba8e491971
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr44555.c
@@ -0,0 +1,16 @@
+struct a {
+ char b[100];
+};
+int foo(struct a *a)
+{
+ if (&a->b)
+ return 1;
+ return 0;
+}
+extern void abort (void);
+int main()
+{
+ if (foo((struct a *)0) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44575.c b/gcc/testsuite/gcc.c-torture/execute/pr44575.c
new file mode 100644
index 00000000000..62a7d7800b0
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr44575.c
@@ -0,0 +1,49 @@
+/* PR target/44575 */
+
+#include <stdarg.h>
+
+int fails = 0;
+struct S { float a[3]; };
+struct S a[5];
+
+void
+check (int z, ...)
+{
+ struct S arg, *p;
+ va_list ap;
+ int j = 0, k = 0;
+ int i;
+ va_start (ap, z);
+ for (i = 2; i < 4; ++i)
+ {
+ p = 0;
+ j++;
+ k += 2;
+ switch ((z << 4) | i)
+ {
+ case 0x12:
+ case 0x13:
+ p = &a[2];
+ arg = va_arg (ap, struct S);
+ break;
+ default:
+ ++fails;
+ break;
+ }
+ if (p && p->a[2] != arg.a[2])
+ ++fails;
+ if (fails)
+ break;
+ }
+ va_end (ap);
+}
+
+int
+main ()
+{
+ a[2].a[2] = -49026;
+ check (1, a[2], a[2]);
+ if (fails)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44683.c b/gcc/testsuite/gcc.c-torture/execute/pr44683.c
new file mode 100644
index 00000000000..d0fd446f004
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr44683.c
@@ -0,0 +1,18 @@
+int __attribute__((noinline,noclone))
+copysign_bug (double x)
+{
+ if (x != 0.0 && (x * 0.5 == x))
+ return 1;
+ if (__builtin_copysign(1.0, x) < 0.0)
+ return 2;
+ else
+ return 3;
+}
+int main(void)
+{
+ double x = -0.0;
+ if (copysign_bug (x) != 2)
+ __builtin_abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/assign-warn-1.c b/gcc/testsuite/gcc.dg/assign-warn-1.c
index a0cfd890f10..ae70242edd4 100644
--- a/gcc/testsuite/gcc.dg/assign-warn-1.c
+++ b/gcc/testsuite/gcc.dg/assign-warn-1.c
@@ -12,11 +12,11 @@
typedef void (*fp)(void);
typedef void (*nrfp)(void) __attribute__((noreturn));
-TESTARG(fqa, nrfp, fp); /* { dg-warning "passing argument 1 of 'fqaF' makes qualified function pointer from unqualified" } */
-TESTARP(fqb, nrfp, fp); /* { dg-warning "passing argument 1 of 'fqbFp.x' makes qualified function pointer from unqualified" } */
-TESTASS(fqc, nrfp, fp); /* { dg-warning "assignment makes qualified function pointer from unqualified" } */
-TESTINI(fqd, nrfp, fp); /* { dg-warning "initialization makes qualified function pointer from unqualified" } */
-TESTRET(fqe, nrfp, fp); /* { dg-warning "return makes qualified function pointer from unqualified" } */
+TESTARG(fqa, nrfp, fp); /* { dg-warning "passing argument 1 of 'fqaF' makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTARP(fqb, nrfp, fp); /* { dg-warning "passing argument 1 of 'fqbFp.x' makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTASS(fqc, nrfp, fp); /* { dg-warning "assignment makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTINI(fqd, nrfp, fp); /* { dg-warning "initialization makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTRET(fqe, nrfp, fp); /* { dg-warning "return makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
TESTARG(ofqa, fp, nrfp);
TESTARP(ofqb, fp, nrfp);
@@ -24,11 +24,11 @@ TESTASS(ofqc, fp, nrfp);
TESTINI(ofqd, fp, nrfp);
TESTRET(ofqe, fp, nrfp);
-TESTARG(qa, char *, const char *); /* { dg-warning "passing argument 1 of 'qaF' discards qualifiers from pointer target type" } */
-TESTARP(qb, char *, const char *); /* { dg-warning "passing argument 1 of 'qbFp.x' discards qualifiers from pointer target type" } */
-TESTASS(qc, char *, const char *); /* { dg-warning "assignment discards qualifiers from pointer target type" } */
-TESTINI(qd, char *, const char *); /* { dg-warning "initialization discards qualifiers from pointer target type" } */
-TESTRET(qe, char *, const char *); /* { dg-warning "return discards qualifiers from pointer target type" } */
+TESTARG(qa, char *, const char *); /* { dg-warning "passing argument 1 of 'qaF' discards 'const' qualifier from pointer target type" } */
+TESTARP(qb, char *, const char *); /* { dg-warning "passing argument 1 of 'qbFp.x' discards 'const' qualifier from pointer target type" } */
+TESTASS(qc, char *, const char *); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */
+TESTINI(qd, char *, const char *); /* { dg-warning "initialization discards 'const' qualifier from pointer target type" } */
+TESTRET(qe, char *, const char *); /* { dg-warning "return discards 'const' qualifier from pointer target type" } */
TESTARG(oqa, const char *, char *);
TESTARP(oqb, const char *, char *);
diff --git a/gcc/testsuite/gcc.dg/assign-warn-2.c b/gcc/testsuite/gcc.dg/assign-warn-2.c
index f3d861d7405..7813b72869d 100644
--- a/gcc/testsuite/gcc.dg/assign-warn-2.c
+++ b/gcc/testsuite/gcc.dg/assign-warn-2.c
@@ -13,11 +13,11 @@
typedef void (*fp)(void);
typedef void (*nrfp)(void) __attribute__((noreturn));
-TESTARG(fqa, nrfp, fp); /* { dg-error "passing argument 1 of 'fqaF' makes qualified function pointer from unqualified" } */
-TESTARP(fqb, nrfp, fp); /* { dg-error "passing argument 1 of 'fqbFp.x' makes qualified function pointer from unqualified" } */
-TESTASS(fqc, nrfp, fp); /* { dg-error "assignment makes qualified function pointer from unqualified" } */
-TESTINI(fqd, nrfp, fp); /* { dg-error "initialization makes qualified function pointer from unqualified" } */
-TESTRET(fqe, nrfp, fp); /* { dg-error "return makes qualified function pointer from unqualified" } */
+TESTARG(fqa, nrfp, fp); /* { dg-error "passing argument 1 of 'fqaF' makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTARP(fqb, nrfp, fp); /* { dg-error "passing argument 1 of 'fqbFp.x' makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTASS(fqc, nrfp, fp); /* { dg-error "assignment makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTINI(fqd, nrfp, fp); /* { dg-error "initialization makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
+TESTRET(fqe, nrfp, fp); /* { dg-error "return makes '__attribute__..noreturn..' qualified function pointer from unqualified" } */
TESTARG(ofqa, fp, nrfp);
TESTARP(ofqb, fp, nrfp);
@@ -25,11 +25,11 @@ TESTASS(ofqc, fp, nrfp);
TESTINI(ofqd, fp, nrfp);
TESTRET(ofqe, fp, nrfp);
-TESTARG(qa, char *, const char *); /* { dg-error "passing argument 1 of 'qaF' discards qualifiers from pointer target type" } */
-TESTARP(qb, char *, const char *); /* { dg-error "passing argument 1 of 'qbFp.x' discards qualifiers from pointer target type" } */
-TESTASS(qc, char *, const char *); /* { dg-error "assignment discards qualifiers from pointer target type" } */
-TESTINI(qd, char *, const char *); /* { dg-error "initialization discards qualifiers from pointer target type" } */
-TESTRET(qe, char *, const char *); /* { dg-error "return discards qualifiers from pointer target type" } */
+TESTARG(qa, char *, const char *); /* { dg-error "passing argument 1 of 'qaF' discards 'const' qualifier from pointer target type" } */
+TESTARP(qb, char *, const char *); /* { dg-error "passing argument 1 of 'qbFp.x' discards 'const' qualifier from pointer target type" } */
+TESTASS(qc, char *, const char *); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */
+TESTINI(qd, char *, const char *); /* { dg-error "initialization discards 'const' qualifier from pointer target type" } */
+TESTRET(qe, char *, const char *); /* { dg-error "return discards 'const' qualifier from pointer target type" } */
TESTARG(oqa, const char *, char *);
TESTARP(oqb, const char *, char *);
diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-10.c b/gcc/testsuite/gcc.dg/c90-const-expr-10.c
index bad388c90b1..30c60e31f90 100644
--- a/gcc/testsuite/gcc.dg/c90-const-expr-10.c
+++ b/gcc/testsuite/gcc.dg/c90-const-expr-10.c
@@ -8,7 +8,7 @@
__extension__ typedef __SIZE_TYPE__ size_t;
void *p = (size_t)(void *)0; /* { dg-error "without a cast" } */
-struct s { void *a; } q = { (size_t)(void *)0 }; /* { dg-error "without a cast" } */
+struct s { void *a; } q = { (size_t)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
void *
f (void)
{
diff --git a/gcc/testsuite/gcc.dg/c99-array-lval-8.c b/gcc/testsuite/gcc.dg/c99-array-lval-8.c
index b5048b66a77..c4e202ef301 100644
--- a/gcc/testsuite/gcc.dg/c99-array-lval-8.c
+++ b/gcc/testsuite/gcc.dg/c99-array-lval-8.c
@@ -12,15 +12,15 @@ f (void)
const struct {
int a[1];
} s;
- int *p1 = s.a; /* { dg-error "qualifiers" } */
+ int *p1 = s.a; /* { dg-error "qualifier" } */
int *p2 = (a ? s : s).a;
/* In this case, the qualifier is properly on the array element type
not on the rvalue structure and so is not discarded. */
struct {
const int a[1];
} t;
- int *p3 = t.a; /* { dg-error "qualifiers" } */
- int *p4 = (a ? t : t).a; /* { dg-error "qualifiers" } */
+ int *p3 = t.a; /* { dg-error "qualifier" } */
+ int *p4 = (a ? t : t).a; /* { dg-error "qualifier" } */
/* The issue could also lead to code being wrongly accepted. */
const struct {
int a[1][1];
diff --git a/gcc/testsuite/gcc.dg/c99-arraydecl-3.c b/gcc/testsuite/gcc.dg/c99-arraydecl-3.c
index 2ab927d6ab2..9f383b9c3bb 100644
--- a/gcc/testsuite/gcc.dg/c99-arraydecl-3.c
+++ b/gcc/testsuite/gcc.dg/c99-arraydecl-3.c
@@ -7,7 +7,7 @@
void
f0 (int a[restrict])
{
- int **b = &a; /* { dg-error "discards qualifiers" } */
+ int **b = &a; /* { dg-error "discards 'restrict' qualifier" } */
int *restrict *c = &a;
}
@@ -15,6 +15,6 @@ void
f1 (a)
int a[restrict];
{
- int **b = &a; /* { dg-error "discards qualifiers" } */
+ int **b = &a; /* { dg-error "discards 'restrict' qualifier" } */
int *restrict *c = &a;
}
diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-10.c b/gcc/testsuite/gcc.dg/c99-const-expr-10.c
index 8e5a1043d29..2aca6106a47 100644
--- a/gcc/testsuite/gcc.dg/c99-const-expr-10.c
+++ b/gcc/testsuite/gcc.dg/c99-const-expr-10.c
@@ -6,7 +6,7 @@
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
void *p = (__SIZE_TYPE__)(void *)0; /* { dg-error "without a cast" } */
-struct s { void *a; } q = { (__SIZE_TYPE__)(void *)0 }; /* { dg-error "without a cast" } */
+struct s { void *a; } q = { (__SIZE_TYPE__)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
void *
f (void)
{
diff --git a/gcc/testsuite/gcc.dg/c99-restrict-4.c b/gcc/testsuite/gcc.dg/c99-restrict-4.c
new file mode 100644
index 00000000000..5852d0a1127
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-restrict-4.c
@@ -0,0 +1,17 @@
+/* Qualifiers lost when taking the address of a const restrict object.
+ PR 44322. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+void * restrict const a[2];
+void * restrict const (*p2)[2];
+
+void foo(void) {
+ p2 = &a;
+}
+
+void * restrict volatile b[2];
+void * restrict volatile (*q2)[2];
+
+void bar(void) {
+ q2 = &b;
+}
diff --git a/gcc/testsuite/gcc.dg/cast-qual-2.c b/gcc/testsuite/gcc.dg/cast-qual-2.c
index 0be1d617176..5fd2b854d61 100644
--- a/gcc/testsuite/gcc.dg/cast-qual-2.c
+++ b/gcc/testsuite/gcc.dg/cast-qual-2.c
@@ -18,8 +18,8 @@ intfn_t *i2 = (intfn_t *) intfn;
intfn_t *i3 = constfn;
intfn_t *i4 = (intfn_t *) constfn; /* { dg-bogus "discards qualifier" } */
-constfn_t p1 = intfn; /* { dg-warning "makes qualified function" } */
-constfn_t p2 = (constfn_t) intfn; /* { dg-warning "new qualifier" } */
+constfn_t p1 = intfn; /* { dg-warning "makes '__attribute__..const..' qualified function" } */
+constfn_t p2 = (constfn_t) intfn; /* { dg-warning "adds '__attribute__..const..' qualifier" } */
constfn_t p3 = constfn;
constfn_t p4 = (constfn_t) constfn;
@@ -28,7 +28,7 @@ voidfn_t *v2 = (voidfn_t *) voidfn;
voidfn_t *v3 = noreturnfn;
voidfn_t *v4 = (voidfn_t *) noreturnfn; /* { dg-bogus "discards qualifier" } */
-noreturnfn_t n1 = voidfn; /* { dg-warning "makes qualified function" } */
-noreturnfn_t n2 = (noreturnfn_t) voidfn; /* { dg-warning "new qualifier" } */
+noreturnfn_t n1 = voidfn; /* { dg-warning "makes '__attribute__..noreturn..' qualified function" } */
+noreturnfn_t n2 = (noreturnfn_t) voidfn; /* { dg-warning "adds '__attribute__..noreturn..' qualifier" } */
noreturnfn_t n3 = noreturnfn;
noreturnfn_t n4 = (noreturnfn_t) noreturnfn;
diff --git a/gcc/testsuite/gcc.dg/compound-literal-1.c b/gcc/testsuite/gcc.dg/compound-literal-1.c
index 6c644d46ea3..9b3b24e254e 100644
--- a/gcc/testsuite/gcc.dg/compound-literal-1.c
+++ b/gcc/testsuite/gcc.dg/compound-literal-1.c
@@ -2,7 +2,7 @@
/* PR c/43248 */
-int foo(__SIZE_TYPE__ i)
+__extension__ int foo(__SIZE_TYPE__ i)
{
i ? : (void *){}; /* { dg-error "" } */
}
diff --git a/gcc/testsuite/gcc.dg/cpp/line3.c b/gcc/testsuite/gcc.dg/cpp/line3.c
index 7a1061478d4..4b40e4a6a95 100644
--- a/gcc/testsuite/gcc.dg/cpp/line3.c
+++ b/gcc/testsuite/gcc.dg/cpp/line3.c
@@ -13,14 +13,14 @@ main(void)
{
char *A;
- A = "text"; /* { dg-warning "discards qualifiers" "case zero" } */
- A = one("text" /* { dg-warning "discards qualifiers" "case one" } */
+ A = "text"; /* { dg-warning "discards 'const' qualifier" "case zero" } */
+ A = one("text" /* { dg-warning "discards 'const' qualifier" "case one" } */
"text")
;
- A = two("text" /* { dg-warning "discards qualifiers" "case two" } */
+ A = two("text" /* { dg-warning "discards 'const' qualifier" "case two" } */
"text")
;
- A = four("text" /* { dg-warning "discards qualifiers" "case four" } */
+ A = four("text" /* { dg-warning "discards 'const' qualifier" "case four" } */
"text")
;
diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c
index 46013c8699e..f88965fe659 100644
--- a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c
+++ b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c
@@ -70,13 +70,13 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
cdiag ("%m");
cxxdiag ("%m");
- tdiag ("%D%F%T", t1, t1, t1);
- tdiag ("%+D%+F%+T", t1, t1, t1);
- tdiag ("%q+D%q+F%q+T", t1, t1, t1);
+ tdiag ("%D%F%T%V", t1, t1, t1, t1);
+ tdiag ("%+D%+F%+T%+V", t1, t1, t1, t1);
+ tdiag ("%q+D%q+F%q+T%q+V", t1, t1, t1, t1);
tdiag ("%D%D%D%D", t1, t2, *t3, t4[5]);
- cdiag ("%D%F%T", t1, t1, t1);
- cdiag ("%+D%+F%+T", t1, t1, t1);
- cdiag ("%q+D%q+F%q+T", t1, t1, t1);
+ cdiag ("%D%F%T%V", t1, t1, t1, t1);
+ cdiag ("%+D%+F%+T%+V", t1, t1, t1, t1);
+ cdiag ("%q+D%q+F%q+T%q+V", t1, t1, t1, t1);
cdiag ("%D%D%D%D", t1, t2, *t3, t4[5]);
cdiag ("%E", t1);
cxxdiag ("%A%D%E%F%T%V", t1, t1, t1, t1, t1, t1);
@@ -86,6 +86,10 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
cxxdiag ("%+#A%+#D%+#E%+#F%+#T%+#V", t1, t1, t1, t1, t1, t1);
cxxdiag ("%C%L%O%P%Q", i, i, i, i, i);
+ tdiag ("%v%qv%#v", i, i, i);
+ cdiag ("%v%qv%#v", i, i, i);
+ cxxdiag ("%v%qv%#v", i, i, i);
+
/* Bad stuff with extensions. */
diag ("%m", i); /* { dg-warning "format" "extra arg" } */
tdiag ("%m", i); /* { dg-warning "format" "extra arg" } */
@@ -121,6 +125,14 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
cdiag ("%D", t1, t1); /* { dg-warning "format" "extra arg" } */
cxxdiag ("%D", t1, t1); /* { dg-warning "format" "extra arg" } */
+ tdiag ("%V", i); /* { dg-warning "format" "wrong arg" } */
+ cdiag ("%V", i); /* { dg-warning "format" "wrong arg" } */
+ cxxdiag ("%V", i); /* { dg-warning "format" "wrong arg" } */
+
+ tdiag ("%v", t1); /* { dg-warning "format" "wrong arg" } */
+ cdiag ("%v", t1); /* { dg-warning "format" "wrong arg" } */
+ cxxdiag ("%v", t1); /* { dg-warning "format" "wrong arg" } */
+
/* Standard specifiers not accepted in the diagnostic framework. */
diag ("%X\n", u); /* { dg-warning "format" "HEX" } */
diag ("%f\n", d); /* { dg-warning "format" "float" } */
diff --git a/gcc/testsuite/gcc.dg/funroll-loops-all.c b/gcc/testsuite/gcc.dg/funroll-loops-all.c
index c6276759e6c..9cdc9017255 100644
--- a/gcc/testsuite/gcc.dg/funroll-loops-all.c
+++ b/gcc/testsuite/gcc.dg/funroll-loops-all.c
@@ -1,4 +1,4 @@
/* PR 17594 */
/* { dg-do compile } */
/* { dg-options "-funroll-loops-all" } */
-/* { dg-error "unrecognized command line option \"-funroll-loops-all\"" "" { target *-*-* } 0 } */
+/* { dg-error "unrecognized command line option '-funroll-loops-all'" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/graphite/pr44391.c b/gcc/testsuite/gcc.dg/graphite/pr44391.c
new file mode 100644
index 00000000000..91b3afa175a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr44391.c
@@ -0,0 +1,7 @@
+/* { dg-options "-Os -m32 -fgraphite-identity -ffast-math" } */
+
+void byte_insert_op1 (unsigned char *loc, unsigned char *end, unsigned *pto)
+{
+ while (end != loc)
+ *pto = *--end;
+}
diff --git a/gcc/testsuite/gcc.dg/init-bad-7.c b/gcc/testsuite/gcc.dg/init-bad-7.c
new file mode 100644
index 00000000000..738ed605060
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/init-bad-7.c
@@ -0,0 +1,11 @@
+/* PR c/37724 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -pedantic" } */
+
+struct f
+{
+ int *a;
+};
+
+char b[10];
+struct f g = {b}; /* { dg-warning "initialization from incompatible pointer type|near initialization for" } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c
new file mode 100644
index 00000000000..c9a766d9e8f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-slim" } */
+
+struct bovid
+{
+ float a;
+ int b;
+ struct bovid *next;
+};
+
+static int
+__attribute__((noinline))
+foo (struct bovid *cow, int i)
+{
+ i++;
+ if (cow->next)
+ foo (cow->next, i);
+ return i;
+}
+
+int main (int argc, char *argv[])
+{
+ struct bovid cow;
+
+ cow.a = 7.4;
+ cow.b = 6;
+ cow.next = (struct bovid *) 0;
+
+ return foo (&cow, 0);
+}
+
+/* { dg-final { scan-tree-dump-times "foo " 1 "eipa_sra" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/modif-1.c b/gcc/testsuite/gcc.dg/ipa/modif-1.c
deleted file mode 100644
index db6915a9d9e..00000000000
--- a/gcc/testsuite/gcc.dg/ipa/modif-1.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Verify that modification analysis detects modfications. */
-/* { dg-do compile } */
-/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining" } */
-
-struct whatever
-{
- int first;
- unsigned second;
-};
-
-void func1 (struct whatever w);
-void func2 (struct whatever *pw);
-void func3 (int i);
-void func4 (int *pi);
-
-void the_test (struct whatever u, struct whatever v,
- struct whatever w, struct whatever x,
- int i, int k, int l)
-{
- struct whatever *pw = &w;
- int *pk = &k;
-
- v.first = 9;
-
- func1 (u);
- func1 (v);
- func2 (pw);
- func2 (&x);
- func3 (i);
- func4 (pk);
- func4 (&l);
-}
-
-/* { dg-final { scan-ipa-dump-not "param 0\[^\\n\]*modified" "inline" } } */
-/* { dg-final { scan-ipa-dump "param 1\[^\\n\]*modified" "inline" } } */
-/* { dg-final { scan-ipa-dump "param 2\[^\\n\]*modified" "inline" } } */
-/* { dg-final { scan-ipa-dump "param 3\[^\\n\]*modified" "inline" } } */
-/* { dg-final { scan-ipa-dump-not "param 4\[^\\n\]*modified" "inline" } } */
-/* { dg-final { scan-ipa-dump "param 5\[^\\n\]*modified" "inline" } } */
-/* { dg-final { scan-ipa-dump "param 6\[^\\n\]*modified" "inline" } } */
-/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/pure-const-1.c b/gcc/testsuite/gcc.dg/ipa/pure-const-1.c
new file mode 100644
index 00000000000..51837ea9bad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pure-const-1.c
@@ -0,0 +1,80 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-local-pure-const1 -fdump-ipa-pure-const -fdump-tree-optimized -fno-early-inlining" } */
+void abort (void);
+int error_code;
+static int val;
+__attribute__ ((noinline, noclone))
+static int
+i_am_pure1 (int a)
+{
+ if (a > 50)
+ abort ();
+ return a;
+}
+
+__attribute__ ((noinline, noclone))
+static int
+i_am_const2 (int a)
+{
+ return a+val;
+}
+
+__attribute__ ((noinline, noclone))
+int
+call_me(int a)
+{
+ return a;
+}
+
+inline int
+call_callback(int (*fn)(int), int a)
+{
+ return fn(a);
+}
+
+__attribute__ ((noinline, noclone))
+i_am_const3(int a)
+{
+ return call_callback (call_me, a);
+}
+
+__attribute__ ((noinline))
+explode_badly()
+{
+ error_code = 0xbad;
+ abort ();
+}
+
+__attribute__ ((noinline, noclone))
+i_am_pure4(int a)
+{
+ if (a > 50)
+ explode_badly ();
+ return a;
+}
+
+test()
+{
+ int s;
+ s = i_am_pure1(5);
+ s += i_am_pure1(5);
+ s += i_am_const2(5);
+ s += i_am_const2(5);
+ s += i_am_const3(5);
+ s += i_am_const3(5);
+ s += i_am_pure4(5);
+ s += i_am_pure4(5);
+ return s;
+}
+/* { dg-final { scan-tree-dump-times "i_am_pure1 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "i_am_const2 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "i_am_const3 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "i_am_pure4 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump "found to be looping pure: i_am_pure1" "local-pure-const1"} } */
+/* { dg-final { scan-tree-dump "found to be looping pure: i_am_pure4" "local-pure-const1"} } */
+/* { dg-final { scan-ipa-dump "found to be const: i_am_const2" "pure-const"} } */
+/* { dg-final { scan-ipa-dump "found to be const: i_am_const3" "pure-const"} } */
+/* { dg-final { cleanup-tree-dump "local-pure-const1" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "pure-const" } } */
+
diff --git a/gcc/testsuite/gcc.dg/ipa/pure-const-2.c b/gcc/testsuite/gcc.dg/ipa/pure-const-2.c
new file mode 100644
index 00000000000..51d779776bc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pure-const-2.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-local-pure-const1 -fdump-tree-optimized" } */
+static __attribute__ ((noinline, noclone))
+int i_am_pure(char *c, int n)
+{
+ char *d=__builtin_alloca (n);
+ int i;
+ int sum;
+ for (i=0;i<n;i++)
+ d[i] = c[i];
+ for (i=0;i<n;i++)
+ d[i] *= c[n-i];
+ for (i=0;i<n;i++)
+ sum+=d[i];
+ if (sum)
+ __builtin_unreachable ();
+ return sum;
+}
+char array[11];
+int
+main(void)
+{
+ i_am_pure (array,5);
+ i_am_pure (array,11);
+ return 0;
+}
+/* { dg-final { scan-tree-dump "found to be pure: i_am_pure" "local-pure-const1"} } */
+/* { dg-final { scan-tree-dump-not "i_am_pure" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/lto/20091216-1_0.c b/gcc/testsuite/gcc.dg/lto/20091216-1_0.c
index ee3b6c73c6b..054330bbe23 100644
--- a/gcc/testsuite/gcc.dg/lto/20091216-1_0.c
+++ b/gcc/testsuite/gcc.dg/lto/20091216-1_0.c
@@ -1,6 +1,10 @@
/* { dg-lto-do run } */
-asm (".globl start_; start_: nop");
+#ifdef __ia64
+asm (".globl start_\nstart_: nop 0");
+#else
+asm (".globl start_\nstart_: nop");
+#endif
int
main ()
diff --git a/gcc/testsuite/gcc.dg/lto/20100603-1_0.c b/gcc/testsuite/gcc.dg/lto/20100603-1_0.c
new file mode 100644
index 00000000000..cc35c78cfae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20100603-1_0.c
@@ -0,0 +1,4 @@
+/* { dg-lto-do link } */
+/* { dg-extra-ld-options {-r -nostdlib} } */
+
+/* This file intentionally left empty. */
diff --git a/gcc/testsuite/gcc.dg/lto/20100603-2_0.c b/gcc/testsuite/gcc.dg/lto/20100603-2_0.c
new file mode 100644
index 00000000000..11bee496d9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20100603-2_0.c
@@ -0,0 +1,5 @@
+/* { dg-lto-do link } */
+/* { dg-extra-ld-options {-r -nostdlib} } */
+
+int foo;
+int *i = &foo;
diff --git a/gcc/testsuite/gcc.dg/lto/20100603-3_0.c b/gcc/testsuite/gcc.dg/lto/20100603-3_0.c
new file mode 100644
index 00000000000..3fc08fdbf6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20100603-3_0.c
@@ -0,0 +1,4 @@
+/* { dg-lto-do link } */
+/* { dg-extra-ld-options {-r -nostdlib} } */
+
+int i = 42;
diff --git a/gcc/testsuite/gcc.dg/noncompile/990416-1.c b/gcc/testsuite/gcc.dg/noncompile/990416-1.c
index 49f5569394e..91801910bc3 100644
--- a/gcc/testsuite/gcc.dg/noncompile/990416-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/990416-1.c
@@ -2,11 +2,11 @@ extern void *memcpy (void *, const void *, __SIZE_TYPE__);
typedef int word_type;
static void
-copy_reg (unsigned int reg, frame_state *udata, /* { dg-error "parse|syntax|expected" } */
- frame_state *target_udata) /* { dg-error "expected" } */
+copy_reg (unsigned int reg, frame_state *udata, /* { dg-error "unknown type name" } */
+ frame_state *target_udata) /* { dg-error "unknown type name" } */
{
- word_type *preg = get_reg_addr (reg, udata, 0); /* { dg-error "undeclared|function|without a cast" } */
- word_type *ptreg = get_reg_addr (reg, target_udata, 0); /* { dg-error "undeclared|without a cast" } */
+ word_type *preg = ge_reg_addr (reg, udata, 0);
+ word_type *ptreg = ge_reg_addr (reg, target_udata, 0);
memcpy (ptreg, preg, __builtin_dwarf_reg_size (reg));
}
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr44517.c b/gcc/testsuite/gcc.dg/noncompile/pr44517.c
new file mode 100644
index 00000000000..5977d68fef8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/pr44517.c
@@ -0,0 +1,18 @@
+/* PR c/44517: Improve diagnostic for misspelled typename in function declaration. */
+int f1(int x, pid_t y, long z, in t) {
+/* { dg-error "unknown type name 'pid_t'" "" { target *-*-* } 2 } */
+/* { dg-error "unknown type name 'in'" "" { target *-*-* } 2 } */
+ return x + y + z + t;
+}
+
+int f2(int x, lon y, long z, ...){ /* { dg-error "unknown type name 'lon'" } */
+ return;
+}
+
+void f3(int n, int a[n], pid_t x); /* { dg-error "unknown type name 'pid_t'" } */
+void f4() {}
+void f5(int a, *b); /* { dg-error "expected declaration specifiers or" } */
+void f6(int a, b); /* { dg-error "expected declaration specifiers or" } */
+void f7(int a, goto b); /* { dg-error "expected declaration specifiers or" } */
+void f8(int a, in goto); /* { dg-error "unknown type name 'in'" } */
+void f9(int a, in 1); /* { dg-error "unknown type name 'in'" } */
diff --git a/gcc/testsuite/gcc.dg/noreturn-4.c b/gcc/testsuite/gcc.dg/noreturn-4.c
index bcc29dac69a..6fe144754d0 100644
--- a/gcc/testsuite/gcc.dg/noreturn-4.c
+++ b/gcc/testsuite/gcc.dg/noreturn-4.c
@@ -4,7 +4,7 @@
extern void exit (int) __attribute__ ((__noreturn__));
int
-main (void) /* { dg-warning "function might be possible candidate for attribute 'noreturn'" "warn for main" } */
+main (void) /* { dg-warning "function might be candidate for attribute 'noreturn'" "warn for main" } */
{
exit (0);
}
diff --git a/gcc/testsuite/gcc.dg/noreturn-7.c b/gcc/testsuite/gcc.dg/noreturn-7.c
index 1913be1fe1d..fd2be2d56c0 100644
--- a/gcc/testsuite/gcc.dg/noreturn-7.c
+++ b/gcc/testsuite/gcc.dg/noreturn-7.c
@@ -13,7 +13,7 @@ void _exit(int status) __attribute__ ((__noreturn__));
int z = 0;
-void g() /* { dg-warning "possible candidate" } */
+void g() /* { dg-warning "might be candidate" } */
{
if (++z > 10)
_exit(0);
@@ -27,14 +27,14 @@ void f()
f();
} /* { dg-bogus "does return" } */
-int h() /* { dg-warning "possible candidate" } */
+int h() /* { dg-warning "might be candidate" } */
{
if (++z > 10)
_exit(0);
return h();
} /* { dg-bogus "end of non-void function" } */
-int k() /* { dg-warning "possible candidate" } */
+int k() /* { dg-warning "might be candidate" } */
{
if (++z > 10)
_exit(0);
diff --git a/gcc/testsuite/gcc.dg/opts-1.c b/gcc/testsuite/gcc.dg/opts-1.c
new file mode 100644
index 00000000000..0d16c3ded6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/opts-1.c
@@ -0,0 +1,9 @@
+/* Test negative forms of various options are rejected. */
+/* { dg-do compile } */
+/* { dg-options "-Wno-strict-aliasing=1 -Wno-strict-overflow=1 -fno-abi-version=1 -fno-lto-compression-level=1 -fno-tree-parallelize-loops=1" } */
+
+/* { dg-error "-fno-abi-version" "-fno-abi-version" { target *-*-* } 0 } */
+/* { dg-error "-fno-lto-compression-level" "-fno-lto-compression-level" { target *-*-* } 0 } */
+/* { dg-error "-fno-tree-parallelize-loops" "-fno-tree-parallelize-loops" { target *-*-* } 0 } */
+/* { dg-warning "-Wno-strict-overflow" "-Wno-strict-overflow" { target *-*-* } 0 } */
+/* { dg-warning "-Wno-strict-aliasing" "-Wno-strict-aliasing" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/opts-2.c b/gcc/testsuite/gcc.dg/opts-2.c
new file mode 100644
index 00000000000..f7683635a0e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/opts-2.c
@@ -0,0 +1,8 @@
+/* -O as an operand to another option should not take effect as an
+ optimization option. */
+/* { dg-do compile } */
+/* { dg-options "-I -O" } */
+
+#ifdef __OPTIMIZE__
+#error "__OPTIMIZE__ defined"
+#endif
diff --git a/gcc/testsuite/gcc.dg/opts-3.c b/gcc/testsuite/gcc.dg/opts-3.c
new file mode 100644
index 00000000000..50cd1db52d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/opts-3.c
@@ -0,0 +1,7 @@
+/* Parameters of -Xassembler should not be interpreted as driver
+ options (and so cause the driver to exit prematurely, as in this
+ testcase, or have other unintended effects). */
+/* { dg-do compile } */
+/* { dg-options "-Xassembler -dumpmachine" } */
+
+int int x; /* { dg-error "two or more data types" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
index 634daeeda13..26496a2e695 100644
--- a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
@@ -12,6 +12,7 @@
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
+#include "cgraph.h"
int plugin_is_GPL_compatible;
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
index 4a6a8a61969..2c4cd497192 100644
--- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
@@ -37,7 +37,7 @@ struct gimple_opt_pass one_pass =
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
- 0, /* tv_id */
+ TV_NONE, /* tv_id */
PROP_gimple_any, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index 8d76301d815..eb8f24a45a8 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -52,9 +52,7 @@ get_real_ref_rhs (tree expr)
/* We are only interested in an assignment with a single
rhs operand because if it is not, the original assignment
will not possibly be a self-assignment. */
- if (is_gimple_assign (def_stmt)
- && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
- == GIMPLE_SINGLE_RHS))
+ if (gimple_assign_single_p (def_stmt))
return get_real_ref_rhs (gimple_assign_rhs1 (def_stmt));
else
return NULL_TREE;
@@ -66,7 +64,7 @@ get_real_ref_rhs (tree expr)
case PARM_DECL:
case FIELD_DECL:
case COMPONENT_REF:
- case INDIRECT_REF:
+ case MEM_REF:
case ARRAY_REF:
return expr;
default:
@@ -116,17 +114,18 @@ get_non_ssa_expr (tree expr)
else
return expr;
}
- case INDIRECT_REF:
+ case MEM_REF:
{
tree orig_base = TREE_OPERAND (expr, 0);
- tree base = get_non_ssa_expr (orig_base);
- if (!base)
- return NULL_TREE;
- /* If BASE is converted, build a new indirect reference tree. */
- if (base != orig_base)
- return build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (base)), base);
- else
- return expr;
+ if (TREE_CODE (orig_base) == SSA_NAME)
+ {
+ tree base = get_non_ssa_expr (orig_base);
+ if (!base)
+ return NULL_TREE;
+ return fold_build2 (MEM_REF, TREE_TYPE (expr),
+ base, TREE_OPERAND (expr, 1));
+ }
+ return expr;
}
case ARRAY_REF:
{
@@ -153,9 +152,7 @@ get_non_ssa_expr (tree expr)
&& !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
{
gimple def_stmt = SSA_NAME_DEF_STMT (expr);
- if (is_gimple_assign (def_stmt)
- && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
- == GIMPLE_SINGLE_RHS))
+ if (gimple_assign_single_p (def_stmt))
vdecl = gimple_assign_rhs1 (def_stmt);
}
return get_non_ssa_expr (vdecl);
@@ -201,9 +198,7 @@ warn_self_assign (gimple stmt)
tree rhs, lhs;
/* Check assigment statement. */
- if (is_gimple_assign (stmt)
- && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
- == GIMPLE_SINGLE_RHS))
+ if (gimple_assign_single_p (stmt))
{
rhs = get_real_ref_rhs (gimple_assign_rhs1 (stmt));
if (!rhs)
@@ -275,7 +270,7 @@ static struct gimple_opt_pass pass_warn_self_assign =
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
- 0, /* tv_id */
+ TV_NONE, /* tv_id */
PROP_ssa, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
diff --git a/gcc/testsuite/gcc.dg/pr32370.c b/gcc/testsuite/gcc.dg/pr32370.c
index 80a7c545d47..f039bdf98e7 100644
--- a/gcc/testsuite/gcc.dg/pr32370.c
+++ b/gcc/testsuite/gcc.dg/pr32370.c
@@ -2,15 +2,19 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
/* { dg-options "" { target ia64-*-* } } */
/* { dg-options "-ffixed-esi" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-mabi=sysv -ffixed-esi" { target x86_64-*-mingw* } } */
-#if defined __i386__ || defined __x86_64__
+#if (defined __i386__ || defined __x86_64__) && ! defined _WIN64
# define C "=S"
# define TYPE unsigned long
-#elif defined __ia64__
+#elif defined __ia64__ || defined _WIN64
# define C "=a"
# define TYPE unsigned long long
#endif
+#ifdef _WIN64
+__extension__
+#endif
unsigned int
foo (TYPE port)
{
diff --git a/gcc/testsuite/gcc.dg/pr36902.c b/gcc/testsuite/gcc.dg/pr36902.c
index 8b4ba6fcdb2..43a2d14f981 100644
--- a/gcc/testsuite/gcc.dg/pr36902.c
+++ b/gcc/testsuite/gcc.dg/pr36902.c
@@ -44,7 +44,7 @@ foo2(unsigned char * to, const unsigned char * from, int n)
*to = *from;
break;
case 5:
- to[4] = from [4]; /* { dg-warning "20:array subscript is above array bounds" } */
+ to[4] = from [4]; /* { dg-warning "array subscript is above array bounds" } */
break;
}
return to;
diff --git a/gcc/testsuite/gcc.dg/pr37561.c b/gcc/testsuite/gcc.dg/pr37561.c
index 82eca964008..ec712a7841d 100644
--- a/gcc/testsuite/gcc.dg/pr37561.c
+++ b/gcc/testsuite/gcc.dg/pr37561.c
@@ -1,7 +1,7 @@
/* PR c++/37561 */
/* { dg-do compile } */
-__PTRDIFF_TYPE__ p;
+__extension__ __PTRDIFF_TYPE__ p;
char q;
void
diff --git a/gcc/testsuite/gcc.dg/pr39874.c b/gcc/testsuite/gcc.dg/pr39874.c
new file mode 100644
index 00000000000..ca452831016
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr39874.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+extern void func();
+
+void test1(char *signature)
+{
+ char ch = signature[0];
+ if (ch == 15 || ch == 3)
+ {
+ if (ch == 15) func();
+ }
+}
+
+
+void test2(char *signature)
+{
+ char ch = signature[0];
+ if (ch == 15 || ch == 3)
+ {
+ if (ch > 14) func();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times " == 15" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-not " == 3" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/pr41340.c b/gcc/testsuite/gcc.dg/pr41340.c
index 72ad9296894..b86f40bf467 100644
--- a/gcc/testsuite/gcc.dg/pr41340.c
+++ b/gcc/testsuite/gcc.dg/pr41340.c
@@ -10,6 +10,8 @@ struct S2 { struct S1 s2; };
struct S3 { unsigned s3; struct S2 **s4; };
struct S5 { struct S2 *s5; };
+__extension__ typedef __INTPTR_TYPE__ ssize_t;
+
extern void fn0 (void) __attribute__ ((__noreturn__));
T fn6 (struct S3);
void fn7 (void);
@@ -45,7 +47,7 @@ fn5 (struct S3 x, T *y)
{
if (!fn3 (x))
{
- *y = (T) (long) fn4 (x);
+ *y = (T) (ssize_t) fn4 (x);
return 1;
}
return 0;
diff --git a/gcc/testsuite/gcc.dg/pr41551.c b/gcc/testsuite/gcc.dg/pr41551.c
index 25a8e717fb8..e24fbc33db4 100644
--- a/gcc/testsuite/gcc.dg/pr41551.c
+++ b/gcc/testsuite/gcc.dg/pr41551.c
@@ -3,8 +3,10 @@
/* Make sure we do not ICE. */
+__extension__ typedef __SIZE_TYPE__ size_t;
+
int main(void)
{
int var, *p = &var;
- return (double)(unsigned long)(p);
+ return (double)(size_t)(p);
}
diff --git a/gcc/testsuite/gcc.dg/pr42461.c b/gcc/testsuite/gcc.dg/pr42461.c
new file mode 100644
index 00000000000..0518bfd9736
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr42461.c
@@ -0,0 +1,14 @@
+/* PR rtl-optimization/42461 */
+/* Reported by Patrick Pelissier <patrick.pelissier@gmail.com> */
+
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+extern int link_failure (int) __attribute__ ((pure));
+
+int main (void)
+{
+ if (link_failure (0) < 1)
+ __builtin_unreachable ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr44393.c b/gcc/testsuite/gcc.dg/pr44393.c
new file mode 100644
index 00000000000..906d5932a0f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44393.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -ftree-loop-distribution" } */
+
+int i;
+void foo ()
+{
+ int **pp = 0, *p = 0;
+ while (--i)
+ {
+ *p++ = 0;
+ *pp++ = p;
+ }
+ i = *p;
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr44404.c b/gcc/testsuite/gcc.dg/pr44404.c
new file mode 100644
index 00000000000..a0b4ceb98ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44404.c
@@ -0,0 +1,35 @@
+/* PR rtl-optimization/44404
+ foo() used to be miscompiled on ARM due to a bug in auto-inc-dec.c,
+ which resulted in "strb r1, [r1], #-36". */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-unroll-loops" } */
+
+extern char *strcpy (char *, const char *);
+extern int strcmp (const char*, const char*);
+extern void abort (void);
+
+char buf[128];
+
+void __attribute__((noinline))
+bar (int a, const char *p)
+{
+ if (strcmp (p, "0123456789abcdefghijklmnopqrstuvwxyz") != 0)
+ abort ();
+}
+
+void __attribute__((noinline))
+foo (int a)
+{
+ if (a)
+ bar (0, buf);
+ strcpy (buf, "0123456789abcdefghijklmnopqrstuvwxyz");
+ bar (0, buf);
+}
+
+int
+main (void)
+{
+ foo (0);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr44509.c b/gcc/testsuite/gcc.dg/pr44509.c
new file mode 100644
index 00000000000..7c50bd0fc28
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44509.c
@@ -0,0 +1,9 @@
+/* PR bootstrap/44509 */
+/* { dg-do compile } */
+/* { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" } */
+
+double
+foo (void)
+{
+ return __DBL_MAX__ - __FLT_MAX__;
+}
diff --git a/gcc/testsuite/gcc.dg/pr44539.c b/gcc/testsuite/gcc.dg/pr44539.c
new file mode 100644
index 00000000000..9cfff7a3ae5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44539.c
@@ -0,0 +1,29 @@
+/* PR tree-optimization/44539 */
+/* { dg-do compile } */
+/* { dg-options "-ftracer -freorder-blocks -O2" } */
+
+void bar (int file);
+extern int baz (void);
+
+void noret1 ()
+{
+ bar (0);
+ __builtin_exit (0);
+}
+
+void noret2 ()
+{
+ __builtin_exit (0);
+}
+
+void bar (int i)
+{
+ if (baz ())
+ noret1 (i);
+}
+
+void foo (int i)
+{
+ if (~i) bar (i);
+ i ? noret1 () : noret2 ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr44674.c b/gcc/testsuite/gcc.dg/pr44674.c
new file mode 100644
index 00000000000..c3f16ff20ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44674.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fprofile-generate" } */
+
+void
+jumpfunc (void *p)
+{
+ void *l = &&jumplabel;
+jumplabel:
+ __builtin_memcpy (p, l, 1);
+}
diff --git a/gcc/testsuite/gcc.dg/pr44699.c b/gcc/testsuite/gcc.dg/pr44699.c
new file mode 100644
index 00000000000..601cc78f572
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44699.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+typedef long unsigned int size_t;
+typedef long int intmax_t;
+typedef long unsigned int uintmax_t;
+extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+extern const char *trim_filename (const char *);
+
+static __inline void *
+__inline_memcpy_chk (void *__dest, const void *__src, size_t __len)
+{
+ return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+}
+
+typedef unsigned int hashval_t;
+typedef hashval_t (*htab_hash) (const void *);
+typedef int (*htab_eq) (const void *, const void *);
+typedef void (*htab_del) (void *);
+typedef int (*htab_trav) (void **, void *);
+typedef void *(*htab_alloc) (size_t, size_t);
+typedef void (*htab_free) (void *);
+
+typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
+typedef void (*htab_free_with_arg) (void *, void *);
+struct htab {
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+ void ** entries;
+ size_t size;
+ size_t n_elements;
+ size_t n_deleted;
+ unsigned int searches;
+ unsigned int collisions;
+ htab_alloc alloc_f;
+ htab_free free_f;
+ void * alloc_arg;
+ htab_alloc_with_arg alloc_with_arg_f;
+ htab_free_with_arg free_with_arg_f;
+ unsigned int size_prime_index;
+};
+
+typedef struct htab *htab_t;
+enum insert_option {NO_INSERT, INSERT};
+extern void * htab_find (htab_t, const void *);
+extern void ** htab_find_slot (htab_t, const void *, enum insert_option);
+
+enum mode_class { MODE_RANDOM, MODE_CC, MODE_INT, MODE_PARTIAL_INT, MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM, MODE_FLOAT, MODE_DECIMAL_FLOAT, MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MODE_VECTOR_INT, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM, MODE_VECTOR_FLOAT, MAX_MODE_CLASS };
+
+static const char *const mode_class_names[MAX_MODE_CLASS] =
+{
+ "MODE_RANDOM", "MODE_CC", "MODE_INT", "MODE_PARTIAL_INT", "MODE_FRACT", "MODE_UFRACT", "MODE_ACCUM", "MODE_UACCUM", "MODE_FLOAT", "MODE_DECIMAL_FLOAT", "MODE_COMPLEX_INT", "MODE_COMPLEX_FLOAT", "MODE_VECTOR_INT", "MODE_VECTOR_FRACT", "MODE_VECTOR_UFRACT", "MODE_VECTOR_ACCUM", "MODE_VECTOR_UACCUM", "MODE_VECTOR_FLOAT"
+};
+struct mode_data
+{
+ struct mode_data *next;
+
+ const char *name;
+ enum mode_class cl;
+ unsigned int precision;
+ unsigned int bytesize;
+ unsigned int ncomponents;
+ unsigned int alignment;
+ const char *format;
+
+ struct mode_data *component;
+ struct mode_data *wider;
+ struct mode_data *wider_2x;
+
+ struct mode_data *contained;
+
+ struct mode_data *next_cont;
+
+ const char *file;
+ unsigned int line;
+ unsigned int counter;
+ unsigned int ibit;
+ unsigned int fbit;
+};
+
+static struct mode_data *modes[MAX_MODE_CLASS];
+static unsigned int n_modes[MAX_MODE_CLASS];
+static struct mode_data *void_mode;
+
+static const struct mode_data blank_mode = {
+ 0, "<unknown>", MAX_MODE_CLASS,
+ -1U, -1U, -1U, -1U,
+ 0, 0, 0, 0, 0, 0,
+ "<unknown>", 0, 0, 0, 0
+};
+
+static htab_t modes_by_name;
+
+static __inline__ struct mode_data *
+find_mode (const char *name)
+{
+ struct mode_data key;
+
+ key.name = name;
+ return (struct mode_data *) htab_find (modes_by_name, &key);
+}
+
+static struct mode_data *
+new_mode (enum mode_class cl, const char *name,
+ const char *file, unsigned int line)
+{
+ struct mode_data *m;
+ static unsigned int count = 0;
+
+ m = find_mode (name);
+ if (m)
+ {
+ error ("%s:%d: duplicate definition of mode \"%s\"",
+ trim_filename (file), line, name);
+ error ("%s:%d: previous definition here", m->file, m->line);
+ return m;
+ }
+
+ m = ((struct mode_data *) xmalloc (sizeof (struct mode_data)));
+ ((__builtin_object_size (m, 0) != (size_t) -1) ? __builtin___memcpy_chk (m, &blank_mode, sizeof (struct mode_data), __builtin_object_size (m, 0)) : __inline_memcpy_chk (m, &blank_mode, sizeof (struct mode_data)));
+ m->cl = cl;
+ m->name = name;
+ if (file)
+ m->file = trim_filename (file);
+ m->line = line;
+ m->counter = count++;
+
+ m->next = modes[cl];
+ modes[cl] = m;
+ n_modes[cl]++;
+
+ *htab_find_slot (modes_by_name, m, INSERT) = m;
+
+ return m;
+}
+
+static void
+make_int_mode (const char *name,
+ unsigned int precision, unsigned int bytesize,
+ const char *file, unsigned int line)
+{
+ struct mode_data *m = new_mode (MODE_INT, name, file, line);
+ m->bytesize = bytesize;
+ m->precision = precision;
+}
+
+static void
+create_modes (void)
+{
+make_int_mode ("HI", -1U, 2, "../../work/gcc/machmode.def", 182);
+}
+
+int
+main (int argc, char **argv)
+{
+ create_modes ();
+}
diff --git a/gcc/testsuite/gcc.dg/pragma-diag-1.c b/gcc/testsuite/gcc.dg/pragma-diag-1.c
new file mode 100644
index 00000000000..b6d294d9ab5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pragma-diag-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -O2" } */
+/* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
+
+main()
+{
+ int a;
+ int b;
+ int c;
+ int d;
+
+#pragma GCC diagnostic error "-Wuninitialized"
+ foo(a); /* { dg-error "uninitialized" } */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+ foo(b);
+#pragma GCC diagnostic pop
+ foo(c); /* { dg-error "uninitialized" } */
+#pragma GCC diagnostic pop
+ foo(d); /* { dg-warning "uninitialized" } */
+}
diff --git a/gcc/testsuite/gcc.dg/struct/w_prof_global_array.c b/gcc/testsuite/gcc.dg/struct/w_prof_global_array.c
index cbfd0bc72bb..ca3643e43de 100644
--- a/gcc/testsuite/gcc.dg/struct/w_prof_global_array.c
+++ b/gcc/testsuite/gcc.dg/struct/w_prof_global_array.c
@@ -26,5 +26,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/w_prof_global_var.c b/gcc/testsuite/gcc.dg/struct/w_prof_global_var.c
index c51648c4ef0..baff45d917d 100644
--- a/gcc/testsuite/gcc.dg/struct/w_prof_global_var.c
+++ b/gcc/testsuite/gcc.dg/struct/w_prof_global_var.c
@@ -39,5 +39,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/w_prof_local_array.c b/gcc/testsuite/gcc.dg/struct/w_prof_local_array.c
index 1a798e399d3..8953264fea1 100644
--- a/gcc/testsuite/gcc.dg/struct/w_prof_local_array.c
+++ b/gcc/testsuite/gcc.dg/struct/w_prof_local_array.c
@@ -34,5 +34,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/w_prof_local_var.c b/gcc/testsuite/gcc.dg/struct/w_prof_local_var.c
index 82f24a1a4b1..9a23f8d53a8 100644
--- a/gcc/testsuite/gcc.dg/struct/w_prof_local_var.c
+++ b/gcc/testsuite/gcc.dg/struct/w_prof_local_var.c
@@ -37,5 +37,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c b/gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c
index b2223c88b8b..b0202399104 100644
--- a/gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c
+++ b/gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c
@@ -28,6 +28,6 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c b/gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c
index 308c30e4fd7..e9de98c3b8a 100644
--- a/gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c
+++ b/gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c
@@ -61,6 +61,6 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c b/gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c
index 19de595e8ed..3c26e3be7b6 100644
--- a/gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c
+++ b/gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c
@@ -39,5 +39,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c b/gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c
index 12c217aad97..5d5e37b4f0e 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c
@@ -23,5 +23,5 @@ int main()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c b/gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c
index abf50a54fec..efb68be8bdd 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c
@@ -35,5 +35,5 @@ main ()
return 0;
}
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c b/gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c
index b1508eec5c7..77226b449c5 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c
@@ -26,5 +26,5 @@ int main()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c b/gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c
index db7f6b09cb5..58411202767 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c
@@ -43,5 +43,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c
index e6638b73a60..781a847f9f7 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c
@@ -42,5 +42,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is passed to local function...Excluded." "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is passed to local function...Excluded." "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c
index 8830c55601d..8892fa99098 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c
@@ -29,5 +29,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is return type of function...Excluded" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is return type of function...Excluded" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c
index 5f634fc119c..6da3420f6e8 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c
@@ -28,6 +28,6 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is initialized...Excluded" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is initialized...Excluded" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c
index 55a644e1971..bd03ec42f05 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c
@@ -30,5 +30,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c
index 4cb94afc5df..59e0e48321a 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c
@@ -45,5 +45,5 @@ main (void)
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c
index bade3153909..a6b32ddd688 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c
@@ -42,5 +42,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c b/gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c
index 4ffd4b5a265..b61e26b1248 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c
@@ -29,5 +29,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c b/gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c
index 4c00d02434a..39351e072e2 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c
@@ -42,5 +42,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c b/gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c
index 3d92da40517..18d5a734740 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c
@@ -37,5 +37,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c b/gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c
index a6fd7be4371..26a9dbd7314 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c
@@ -40,5 +40,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c b/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
index 04b8b6621fb..6caadcf1230 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
@@ -44,5 +44,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c b/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c
index 22193f2ae57..812763d53ff 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c
@@ -31,5 +31,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c b/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c
index e17ca56ee8b..313af1080c1 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c
@@ -31,5 +31,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c b/gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c
index 24dae559829..92da94d2923 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c
@@ -64,5 +64,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr43781.c b/gcc/testsuite/gcc.dg/torture/pr43781.c
new file mode 100644
index 00000000000..37fe5a36769
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr43781.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+
+typedef int int32_t;
+typedef unsigned char uint8_t;
+
+struct S0
+{
+ uint8_t f3;
+};
+
+struct S2
+{
+ uint8_t f5;
+};
+
+struct S0 g_22 = {
+ 0
+};
+
+int32_t g_91;
+const struct S2 *g_314;
+const struct S2 **g_313 = &g_314;
+struct S2 g_320[2] = {
+ 0
+};
+
+void
+int32func (uint64p_34)
+{
+ for (g_22.f3 = 0; g_22.f3 <= 0; g_22.f3)
+ {
+ lbl_491:{
+ if (1)
+ {
+ int32_t *l_453[2][7][7][1][1];
+ int i, j, k, l, m;
+ for (m; m; m++)
+ l_453[i][j][k][l][m];
+ }
+ *g_313 = 0;
+ if (g_91)
+ goto lbl_491;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c b/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
index d32a6cedc7a..0f477b2376c 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
@@ -16,7 +16,7 @@ main()
/* { dg-final-use { scan-tree-dump "Single value 4 stringop" "tree_profile"} } */
/* Really this ought to simplify into assignment, but we are not there yet. */
/* a[0] = b[0] is what we fold the resulting memcpy into. */
-/* { dg-final-use { scan-tree-dump "a.0. = " "optimized"} } */
-/* { dg-final-use { scan-tree-dump "= b.0." "optimized"} } */
+/* { dg-final-use { scan-tree-dump " = MEM.*&b" "optimized"} } */
+/* { dg-final-use { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */
/* { dg-final-use { cleanup-tree-dump "optimized" } } */
/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c b/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
index f9f5fb798ef..ed6f7c0d5d5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
@@ -33,5 +33,5 @@ simplify_condition (cond_p)
}
/* There should be exactly one IF conditional. */
-/* { dg-final { scan-tree-dump-times "if " 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "if " 1 "vrp1" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c b/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c
deleted file mode 100644
index dc764c3d79e..00000000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
-struct a{
- int a;
- int b;
-} a;
-int *
-t()
-{
- return (int *)&a;
-}
-/* { dg-final { scan-tree-dump "a.a" "optimized"} } */
-/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c b/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c
deleted file mode 100644
index b764187a029..00000000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
-union a
-{
- struct s1
- {
- long long a;
- long long b;
- } s1;
- struct s2
- {
- int c;
- int d;
- } s2;
- struct s3
- {
- unsigned long long e;
- unsigned long long f;
- } s3;
-} a;
-int *
-t ()
-{
- return (int *) &a;
-}
-
-/* { dg-final { scan-tree-dump "a.s2.c" "optimized"} } */
-/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
index ee3cb0ebfe5..7b07d7f488f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
@@ -15,5 +15,5 @@ void f(struct a * b, __SIZE_TYPE__ i)
c[i] = 1;
}
-/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\] =.* 1;" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\].* = 1;" 1 "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c
index 0b865245a96..b46b8ece816 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-fre-details" } */
int b;
unsigned a;
@@ -15,9 +15,8 @@ void test2(void)
}
/* The indirect load should be replaced by a load from a and a
- conversion to int. */
+ conversion to int. FRE should then be able to replace
+ the rhs of the store to b by 1. */
-/* { dg-final { scan-tree-dump "= a;" "forwprop1" } } */
-/* { dg-final { scan-tree-dump "= \\\(int\\\) " "forwprop1" } } */
-/* { dg-final { scan-tree-dump-not "= \\\*" "forwprop1" } } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
+/* { dg-final { scan-tree-dump "Replaced\[^\\n\]*with 1" "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
index fe04e66fa1a..2aefb9ace63 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
@@ -17,5 +17,5 @@ void f(__SIZE_TYPE__ i)
c[i] = 1;
}
-/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\] =.* 1;" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\].* = 1;" 1 "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop?" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c
index 710bc5dd114..1b68d5a35f0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-forwprop1 -w" } */
+/* { dg-options "-O1 -fdump-tree-esra -w" } */
#define vector __attribute__((vector_size(16) ))
struct VecClass
@@ -15,7 +15,8 @@ vector float foo( vector float v )
return y.v;
}
-/* We should be able to convert the cast to a VCE in forwprop1. */
-/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "forwprop1"} } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
-
+/* We should be able to remove the intermediate struct and directly
+ return x. As we do not fold VIEW_CONVERT_EXPR<struct VecClass>(x).v
+ that doesn't happen right now. */
+/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "esra"} } */
+/* { dg-final { cleanup-tree-dump "esra" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c
index 4e0751f8119..fc74297242c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c
@@ -12,5 +12,5 @@ int foo(struct X *q)
/* We should have propragated &q->a into (*pointer). */
/* { dg-final { scan-tree-dump-times "pointer" 0 "forwprop1"} } */
-/* { dg-final { scan-tree-dump "->a\\\[0\\\]" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "\\\[0\\\]" "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-1.c
new file mode 100644
index 00000000000..a31e8ea7a47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-fnsplit" } */
+int test2(a)
+{
+ if (a<100)
+ return 1;
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ do_something_big ();
+ return 0;
+}
+
+test()
+{
+ test2(10);
+ test2(20);
+}
+/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */
+/* { dg-final { cleanup-tree-dump "fnsplit" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-2.c
new file mode 100644
index 00000000000..bbde73d6c7c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-2.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-fnsplit" } */
+int b;
+int c;
+int d;
+split_me(int a)
+{
+ int t = 0;
+ if (d>4)
+ return;
+ do
+ {
+ long_function (t);
+ long_function (t);
+ long_function (t);
+ long_function (t);
+ long_function (t);
+ long_function (t);
+ make_me_irregular:
+ long_function (t);
+ long_function (t);
+ long_function (t);
+ long_function (t);
+ long_function (t);
+ t=b;
+ }
+ while (t);
+ if (c)
+ goto make_me_irregular;
+}
+
+main()
+{
+ split_me (1);
+ split_me (2);
+ split_me (3);
+ split_me (4);
+ split_me (5);
+}
+/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */
+/* { dg-final { cleanup-tree-dump "fnsplit" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-3.c
new file mode 100644
index 00000000000..05a37f81027
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-3.c
@@ -0,0 +1,21 @@
+int baz (void);
+static int
+foo (int x)
+{
+ if (__builtin_expect (x <= 0, 0))
+ {
+ __builtin_printf ("foo\n");
+ __builtin_printf ("foo\n");
+ __builtin_printf ("foo\n");
+ __builtin_abort ();
+ }
+ return 6;
+}
+
+int a,b,c;
+
+int
+bar (int x)
+{
+ return foo (a) + foo (b) + foo (c);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-4.c
new file mode 100644
index 00000000000..9d5864bad3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-4.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-fnsplit" } */
+int make_me_big (void);
+void abort (void);
+
+int
+split_me (int a)
+{
+ if (__builtin_expect(a<10, 1))
+ {
+ abort ();
+ }
+ else
+ {
+ make_me_big ();
+ make_me_big ();
+ make_me_big ();
+ make_me_big ();
+ return a+1;
+ }
+}
+
+int
+test(void)
+{
+ return split_me (0)+split_me(1)+split_me(2);
+}
+/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */
+/* { dg-final { cleanup-tree-dump "fnsplit" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c b/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
index 9733d8f99d8..4b8239e4531 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+/* { dg-options "-O2 -fdump-tree-pre-stats -fdump-tree-fre" } */
#include <stddef.h>
union tree_node;
@@ -72,7 +72,9 @@ main (void)
remove_useless_vars (&unexpanded_var_list, 0);
return 0;
}
-/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */
+
+/* See PR44656. The last elimination is only done by PRE. */
+/* { dg-final { scan-tree-dump-not "= unexpanded_var_list;" "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "pre" } } */
/* { dg-final { scan-tree-dump-times "Insertions: 2" 1 "pre" } } */
/* { dg-final { cleanup-tree-dump "pre" } } */
-
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-1.c
index 736a4d95577..bff58f6a41d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
+/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all -march=i486" { target { i?86-*-* && ilp32} } } */
/* { dg-require-effective-target size32plus } */
double u[1782225];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-3.c
index 51508f98a61..d7dd211e9bc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
+/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all -march=i486" { target { i?86-*-* && ilp32} } } */
/* { dg-require-effective-target size32plus } */
double u[1782225];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-4.c
index e2d6abced60..6682538a2ed 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
+/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all -march=i486" { target { i?86-*-* && ilp32} } } */
/* { dg-require-effective-target size32plus } */
double u[1782225];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-5.c b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-5.c
index 2f64925e901..3540723dc56 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-5.c
@@ -1,5 +1,6 @@
/* { dg-do compile { target { size32plus } } } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
+/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all -march=i486" { target { i?86-*-* && ilp32} } } */
int foo ()
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-6.c
index edf30a3d573..e6a290a6a13 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-6.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
+/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all -march=i486" { target { i?86-*-* && ilp32} } } */
/* { dg-require-effective-target size32plus } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c
index 21f8ffafce6..67569d8a316 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
+/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all -march=i486" { target { i?86-*-* && ilp32} } } */
double foo(double *a)
{
int i,j;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c
index af867515002..853fe70c623 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-forwprop1" } */
struct A { int i; };
int
@@ -11,5 +11,7 @@ foo(struct A *locp, int str)
return locp->i;
}
-/* { dg-final { scan-tree-dump "locp.*->i =" "forwprop1" } } */
+/* We should have propagated &locp->i into its dereference. */
+
+/* { dg-final { scan-tree-dump "locp_\[^\\n\]* =" "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c
index 2409608d9da..f924d26cca2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dce1" } */
int
foo (int *p)
@@ -16,8 +16,9 @@ foo (int *p)
}
/* Target with fno-delete-null-pointer-checks should not fold checks */
-/* { dg-final { scan-tree-dump-times "Folding predicate " 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
+/* { dg-final { scan-tree-dump "Folding predicate " "vrp1" { target { ! keeps_null_pointer_checks } } } } */
/* { dg-final { scan-tree-dump-times "Folding predicate " 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
-/* { dg-final { scan-tree-dump-not "b_. =" "vrp1" { target { ! avr-*-* } } } } */
-/* { dg-final { scan-tree-dump "b_. =" "vrp1" { target { avr-*-* } } } } */
+/* { dg-final { scan-tree-dump-not "b_. =" "dce1" { target { ! avr-*-* } } } } */
+/* { dg-final { scan-tree-dump "b_. =" "dce1" { target { avr-*-* } } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
+/* { dg-final { cleanup-tree-dump "dce1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr44258.c b/gcc/testsuite/gcc.dg/tree-ssa/pr44258.c
new file mode 100644
index 00000000000..a98d3ceccbf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr44258.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-esra-details" } */
+
+struct blah
+{
+ char a[4];
+};
+
+struct str
+{
+ struct blah b1;
+ char x;
+};
+
+struct val
+{
+ char y;
+ struct blah b2;
+};
+
+union U
+{
+ struct str str;
+ struct val val;
+};
+
+
+extern struct blah e_b1, e_b2;
+extern union U *e_u;
+
+int foo (int b)
+{
+ union U u;
+
+ u.str.b1 = e_b1;
+ u.val.b2 = e_b2;
+ u.str.b1.a[3] = 0;
+
+ *e_u = u;
+}
+
+/* { dg-final { scan-tree-dump-times "Created a replacement" 0 "esra"} } */
+/* { dg-final { cleanup-tree-dump "esra" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr44423.c b/gcc/testsuite/gcc.dg/tree-ssa/pr44423.c
new file mode 100644
index 00000000000..6232d64963a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr44423.c
@@ -0,0 +1,47 @@
+/* { dg-do compile { target x86_64-*-* } } */
+/* { dg-options "-O2 -fdump-tree-esra-details" } */
+
+#include "xmmintrin.h"
+
+typedef __m128 v4sf; // vector of 4 floats (SSE1)
+
+#define ARRSZ 1024
+
+typedef union {
+ float f[4];
+ v4sf v;
+} V4SF;
+
+struct COLOUR {
+ float r,g,b;
+};
+
+void func (float *pre1, float pre2, struct COLOUR *a, V4SF *lpic)
+ {
+ V4SF va;
+ int y;
+ va.f[0]=a->r;va.f[1]=a->g;va.f[2]=a->b;va.f[3]=0.f;
+ for (y=0; y<20; ++y)
+ {
+ float att = pre1[y]*pre2;
+ v4sf tmpatt=_mm_load1_ps(&att);
+ tmpatt=_mm_mul_ps(tmpatt,va.v);
+ lpic[y].v=_mm_add_ps(tmpatt,lpic[y].v);
+ }
+ }
+
+int main()
+ {
+ V4SF lpic[ARRSZ];
+ float pre1[ARRSZ];
+ int i;
+ struct COLOUR col={0.,2.,4.};
+ for (i=0; i<20; ++i)
+ pre1[i]=0.4;
+ for (i=0;i<10000000;++i)
+ func(&pre1[0],0.3,&col,&lpic[0]);
+ return 0;
+ }
+
+/* { dg-final { scan-tree-dump-times "Created a replacement" 0 "esra"} } */
+/* { dg-final { cleanup-tree-dump "esra" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr44483.c b/gcc/testsuite/gcc.dg/tree-ssa/pr44483.c
new file mode 100644
index 00000000000..cdae91a9098
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr44483.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-c -O3" { target *-*-* } } */
+
+int ffesum (void) {
+ int ch[4], ii, jj, kk;
+ char asc[32];
+
+ for (ii = 0; ii < 4; ii++)
+ {
+ for (jj = 0; jj < 4; jj++)
+ ch[jj] = ii;
+ for (kk = 0; kk < 13; kk++)
+ for (jj = 0; jj < 4; jj += 2)
+ if ((unsigned char) ch[jj] || (unsigned char) ch[jj + 1])
+ ch[jj]++;
+ for (jj = 0; jj < 4; jj++)
+ asc[4 * jj + ii] = ch[jj];
+ }
+ return asc[0];
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c
index 3b9e19fe5e5..9e453a7c08a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c
@@ -5,20 +5,12 @@
/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */
#define K 1000000
-int a[K], b[K];
+int a[K];
void test(int *p)
{
unsigned i;
- /* Nontemporal store should be used for a. */
- for (i = 0; i < K; i++)
- a[i] = 0;
-
- /* Nontemporal store should be used for a, nontemporal prefetch for b. */
- for (i = 0; i < K; i++)
- a[i] = b[i];
-
/* Nontemporal store should not be used here (only write and read temporal
prefetches). */
for (i = 0; i < K - 10000; i++)
@@ -44,18 +36,14 @@ void test(int *p)
}
/* { dg-final { scan-tree-dump-times "Issued prefetch" 5 "aprefetch" } } */
-/* { dg-final { scan-tree-dump-times "Issued nontemporal prefetch" 3 "aprefetch" } } */
-/* { dg-final { scan-tree-dump-times "a nontemporal store" 2 "aprefetch" } } */
+/* { dg-final { scan-tree-dump-times "Issued nontemporal prefetch" 2 "aprefetch" } } */
+/* { dg-final { scan-tree-dump-times "a nontemporal store" 0 "aprefetch" } } */
-/* { dg-final { scan-tree-dump-times "builtin_prefetch" 8 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "=\\{nt\\}" 18 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "__builtin_ia32_mfence" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "builtin_prefetch" 7 "optimized" } } */
/* { dg-final { scan-assembler-times "prefetchw" 5 } } */
/* { dg-final { scan-assembler-times "prefetcht" 1 } } */
-/* { dg-final { scan-assembler-times "prefetchnta" 2 } } */
-/* { dg-final { scan-assembler-times "movnti" 18 } } */
-/* { dg-final { scan-assembler-times "mfence" 2 } } */
+/* { dg-final { scan-assembler-times "prefetchnta" 1 } } */
/* { dg-final { cleanup-tree-dump "aprefetch" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c
new file mode 100644
index 00000000000..a05d552ace1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c
@@ -0,0 +1,28 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target sse2 } */
+/* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=athlon" } } */
+/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */
+
+#define K 1000000
+int a[K];
+
+void test()
+{
+ unsigned i;
+
+ /* Nontemporal store should be used for a. */
+ for (i = 0; i < K; i++)
+ a[i] = 0;
+}
+
+/* { dg-final { scan-tree-dump-times "a nontemporal store" 1 "aprefetch" } } */
+
+/* { dg-final { scan-tree-dump "=\\{nt\\}" "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_ia32_mfence" 1 "optimized" } } */
+
+/* { dg-final { scan-assembler "movnti" } } */
+/* { dg-final { scan-assembler-times "mfence" 1 } } */
+
+/* { dg-final { cleanup-tree-dump "aprefetch" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c
new file mode 100644
index 00000000000..eb22a660e43
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c
@@ -0,0 +1,32 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target sse2 } */
+/* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=athlon" } } */
+/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */
+
+#define K 1000000
+int a[K], b[K];
+
+void test()
+{
+ unsigned i;
+
+ /* Nontemporal store should be used for a, nontemporal prefetch for b. */
+ for (i = 0; i < K; i++)
+ a[i] = b[i];
+
+}
+
+/* { dg-final { scan-tree-dump-times "Issued nontemporal prefetch" 1 "aprefetch" } } */
+/* { dg-final { scan-tree-dump-times "a nontemporal store" 1 "aprefetch" } } */
+
+/* { dg-final { scan-tree-dump-times "builtin_prefetch" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump "=\\{nt\\}" "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_ia32_mfence" 1 "optimized" } } */
+
+/* { dg-final { scan-assembler-times "prefetchnta" 1 } } */
+/* { dg-final { scan-assembler "movnti" } } */
+/* { dg-final { scan-assembler-times "mfence" 1 } } */
+
+/* { dg-final { cleanup-tree-dump "aprefetch" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
index b61674dff3a..6db9ba0d871 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */
+/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
extern void abort (void);
struct X {
@@ -22,5 +22,5 @@ foo(int i, int j, int k, int off)
return *q;
}
-/* { dg-final { scan-tree-dump "q_., points-to vars: { k }" "alias" } } */
-/* { dg-final { cleanup-tree-dump "alias" } } */
+/* { dg-final { scan-tree-dump "q_., points-to vars: { k }" "ealias" } } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
index adb01b23165..85b96b190e2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */
+/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
extern void abort (void);
struct X {
@@ -22,5 +22,5 @@ foo(int i, int j, int k, int off)
return *q;
}
-/* { dg-final { scan-tree-dump "q_., points-to vars: { i }" "alias" } } */
-/* { dg-final { cleanup-tree-dump "alias" } } */
+/* { dg-final { scan-tree-dump "q_., points-to vars: { i }" "ealias" } } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
index 3b23c36238e..3f4adf43483 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
@@ -21,5 +21,9 @@ int bar (void)
return q->i;
}
-/* { dg-final { scan-tree-dump-times "a.b.i" 2 "ccp1" } } */
+/* The first access is through struct A, so a.b.i is fine,
+ the second access needs to preserve the original access type struct B. */
+
+/* { dg-final { scan-tree-dump-times "a.b.i" 1 "ccp1" } } */
+/* { dg-final { scan-tree-dump-times "MEM\\\[\\\(struct B \\\*\\\)&a\\\].i" 1 "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
index ac7f068cfd1..fb4af2d484d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
@@ -15,5 +15,5 @@ int foo (void)
return *x;
}
-/* { dg-final { scan-tree-dump "a.i\\\[1\\\]" "ccp1" } } */
+/* { dg-final { scan-tree-dump "MEM\\\[\\\(int \\\*\\\)&a \\\+ 4B\\\]" "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c
index f29c4942ace..7912a57f09e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c
@@ -9,6 +9,6 @@ int foo(int i)
}
/* { dg-final { scan-tree-dump "&a\\\[\[iD\]\\\." "ccp1" } } */
-/* { dg-final { scan-tree-dump "= a\\\[\[iD\]\\\." "forwprop1" } } */
+/* { dg-final { scan-tree-dump "= .*&a\\\]\\\[\[iD\]\\\." "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c
index 542c4293960..c0a548155cb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c
@@ -7,5 +7,5 @@ int foo(int i)
return (a + 1)[i];
}
-/* { dg-final { scan-tree-dump "= a\\\[D\\\." "forwprop1" } } */
+/* { dg-final { scan-tree-dump "=.*&a\\\]\\\[D\\\." "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
index 0cb63242c0e..b9ec6bc720f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
@@ -11,6 +11,5 @@ int f(int *a)
return *c + t;
}
-/* { dg-final { scan-tree-dump "Replaced \\\(int \\\*\\\) b_.*with a_" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced \\\*c_.*with t_" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced \\\*a_\[^\n\].*with t_" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
index ae9eb5a2002..972e6c69ef9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
@@ -23,6 +23,5 @@ void foo(double (*q)[4], struct Foo *tmp1)
}
}
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data with &a" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
index 81b82fe4880..9d1b3f2ba92 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
@@ -27,6 +27,5 @@ void foo(double (*q)[4])
bar(a);
}
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1.data with &a" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c
index 978b7abab3a..b986bdd92a9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-Os -fdump-tree-pre-details" } */
+/* { dg-options "-O -fdump-tree-fre-details" } */
typedef union
{
@@ -23,5 +23,5 @@ void foo(SA* pResult, SB* method, SC* self)
pResult->data = pResult->data;
}
-/* { dg-final { scan-tree-dump "Deleted redundant store" "pre" } } */
-/* { dg-final { cleanup-tree-dump "pre" } } */
+/* { dg-final { scan-tree-dump "Deleted redundant store" "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c
index c87f62e69c6..f87476a3a9f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c
@@ -7,6 +7,6 @@ foo (int *array)
return array[1];
return 0;
}
-/* We should eliminate one address calculation, and one load. */
-/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "fre"} } */
+/* We should eliminate one load. */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "fre"} } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
index 27ccda5264a..7caf4eec6f8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
@@ -23,5 +23,5 @@ int vnum_test8(int *data)
}
/* We should eliminate m - n, n + k, set data[5] = 0, eliminate the
address arithmetic for data[5], and set p = 0.
-/* { dg-final { scan-tree-dump-times "Eliminated: 6" 1 "fre"} } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 5" 1 "fre"} } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
index 78e92d769e4..7dc7833647b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
@@ -1,5 +1,5 @@
/* { dg-do "compile" } */
-/* { dg-options "-O2 -fdump-tree-fre" } */
+/* { dg-options "-O2 -fdump-tree-fre-details" } */
struct S { float f; };
int __attribute__((noinline))
@@ -11,5 +11,5 @@ foo (float *r, struct S *p)
return i + *q;
}
-/* { dg-final { scan-tree-dump-times "\\\*q" 1 "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced\[^\n\]*with i_." "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
index aa9e142bba0..812dac928da 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
@@ -12,7 +12,8 @@ foo ( struct S *p)
}
-/* There should only be one load of p->f because fwprop can change *(int *)&p->f into just (int)p->f. */
-/* { dg-final { scan-tree-dump-times "p_.\\\(D\\\)->f" 1 "fre" } } */
+/* There should only be one load of p->f because fwprop can change
+ *(int *)&p->f into just (int)p->f. */
+/* { dg-final { scan-tree-dump-times "= \[^\n\]*p_.\\\(D\\\)" 1 "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
index 73382941488..25b77201c59 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
@@ -5,6 +5,7 @@
this. */
/* { dg-do compile { target { ! "mips*-*-* s390*-*-* avr-*-*" } } } */
/* { dg-options "-O2 -fdump-tree-vrp -fdump-tree-dom" } */
+/* { dg-options "-O2 -fdump-tree-vrp -fdump-tree-dom -march=i586" { target { i?86-*-* && ilp32 } } } */
int h(int x, int y)
{
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-10.c b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c
index 1a678ca3677..d31ffb47c34 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-10.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c
@@ -28,6 +28,9 @@ main1 (unsigned int x, unsigned int y)
*pout++ = a2 * x;
*pout++ = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[1] != (in[0] + 23) * x
|| out[2] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-11.c b/gcc/testsuite/gcc.dg/vect/bb-slp-11.c
index 92a86cd242a..14c4f3a82c6 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-11.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-11.c
@@ -27,6 +27,9 @@ main1 (unsigned int x, unsigned int y)
*pout++ = a2 * x;
*pout++ = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-13.c b/gcc/testsuite/gcc.dg/vect/bb-slp-13.c
index 5005ae5019f..7e1d3ff798b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-13.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-13.c
@@ -25,6 +25,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-14.c b/gcc/testsuite/gcc.dg/vect/bb-slp-14.c
index 673a163c92f..6ffbe28741a 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-14.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-14.c
@@ -26,6 +26,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-15.c b/gcc/testsuite/gcc.dg/vect/bb-slp-15.c
index ba8bc757e86..b927348c810 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-15.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-15.c
@@ -30,6 +30,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-17.c b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c
index 36227391d2e..bb4bd5d8bc5 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-17.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c
@@ -34,6 +34,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-18.c b/gcc/testsuite/gcc.dg/vect/bb-slp-18.c
index ab99f822aff..c5da3516c46 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-18.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-18.c
@@ -25,6 +25,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != a0 * x
|| out[1] != a1 * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-19.c b/gcc/testsuite/gcc.dg/vect/bb-slp-19.c
index 5ee83a1945e..2cb1568488a 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-19.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-19.c
@@ -9,10 +9,10 @@
unsigned short out[N];
unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+int i;
__attribute__ ((noinline)) int
main1 ()
{
- int i;
unsigned short *pin = &in[0];
unsigned short *pout = &out[0];
@@ -27,6 +27,9 @@ main1 ()
*pout++ = *pin++;
*pout++ = *pin++;
+ if (i)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != in[0]
|| out[1] != in[1]
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-20.c b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c
index 910eae5baff..ec12051e00a 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-20.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c
@@ -37,6 +37,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-21.c b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c
index f0b4f6b1ac8..697914ab053 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-21.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c
@@ -37,6 +37,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-22.c b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c
index 3e6e685f118..7463bc653d9 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-22.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c
@@ -36,6 +36,9 @@ main1 (unsigned int x, unsigned int y)
out[3] = a3 * y;
}
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if ((x <= y
&& (out[0] != (in[0] + 23) * x
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-23.c b/gcc/testsuite/gcc.dg/vect/bb-slp-23.c
index 640d81a2560..d125f9d7115 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-23.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-23.c
@@ -30,6 +30,9 @@ main1 (unsigned int x, unsigned int y)
out[2] = a2 * x;
out[3] = a3 * y;
+ if (x)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != (in[0] + 23) * x
|| out[1] != (in[1] + 142) * y
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-3.c b/gcc/testsuite/gcc.dg/vect/bb-slp-3.c
index 07ad7129ad7..c35f035e0f2 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-3.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-3.c
@@ -9,10 +9,10 @@
unsigned int out[N];
unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+int i;
__attribute__ ((noinline)) int
main1 ()
{
- int i;
unsigned int *pin = &in[0];
unsigned int *pout = &out[0];
@@ -21,6 +21,9 @@ main1 ()
*pout++ = *pin++;
*pout++ = *pin++;
+ if (i)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != in[0]
|| out[1] != in[1]
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-4.c b/gcc/testsuite/gcc.dg/vect/bb-slp-4.c
index 4ed8d7c6b39..faa90f3dfde 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-4.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-4.c
@@ -9,16 +9,19 @@
unsigned short out[N];
unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+int i;
__attribute__ ((noinline)) int
main1 ()
{
- int i;
unsigned short *pin = &in[0];
unsigned short *pout = &out[0];
*pout++ = *pin++;
*pout++ = *pin++;
+ if (i)
+ __asm__ volatile ("" : : : "memory");
+
/* Check results. */
if (out[0] != in[0]
|| out[1] != in[1])
diff --git a/gcc/testsuite/gcc.dg/vect/pr44507.c b/gcc/testsuite/gcc.dg/vect/pr44507.c
new file mode 100644
index 00000000000..50c485399a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr44507.c
@@ -0,0 +1,55 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include "tree-vect.h"
+
+int seeIf256ByteArrayIsConstant(
+ unsigned char *pArray)
+{
+ int index;
+ unsigned int curVal, orVal, andVal;
+ int bytesAreEqual = 0;
+
+ if (pArray != 0)
+ {
+ for (index = 0, orVal = 0, andVal = 0xFFFFFFFF;
+ index < 64;
+ index += (int)sizeof(unsigned int))
+ {
+ curVal = *((unsigned int *)(&pArray[index]));
+ orVal = orVal | curVal;
+ andVal = andVal & curVal;
+ }
+
+ if (!((orVal == andVal)
+ && ((orVal >> 8) == (andVal & 0x00FFFFFF))))
+ abort ();
+ }
+
+ return 0;
+}
+
+
+int main(int argc, char** argv)
+{
+ unsigned char array1[64] = {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ };
+
+ argv = argv;
+ argc = argc;
+
+ check_vect ();
+
+ return seeIf256ByteArrayIsConstant(&array1[0]);
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-5.c b/gcc/testsuite/gcc.dg/vect/slp-perm-5.c
index e7c9f7feaa8..4e0c145ef1f 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-perm-5.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-perm-5.c
@@ -61,8 +61,7 @@ int main (int argc, const char* argv[])
input2[i] = i%256;
output[i] = 0;
output2[i] = 0;
- if (input[i] > 256)
- abort ();
+ __asm__ volatile ("");
}
foo (input, output, input2, output2);
diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-6.c b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
index 430415c5a33..27e60369c6c 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
@@ -60,8 +60,7 @@ int main (int argc, const char* argv[])
input2[i] = i%256;
output[i] = 0;
output2[i] = 0;
- if (input[i] > 256)
- abort ();
+ __asm__ volatile ("");
}
foo (input, output, input2, output2);
diff --git a/gcc/testsuite/gcc.dg/volatile2.c b/gcc/testsuite/gcc.dg/volatile2.c
index 4bfc441c862..d663123c83d 100644
--- a/gcc/testsuite/gcc.dg/volatile2.c
+++ b/gcc/testsuite/gcc.dg/volatile2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-gimple -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
struct GTeth_desc
{
@@ -12,14 +12,11 @@ struct GTeth_softc
void foo(struct GTeth_softc *sc)
{
- /* Verify that we retain the cast to (volatile struct GTeth_desc *)
- after gimplification and that we keep the volatileness on the
+ /* Verify that we retain the volatileness on the
store until after optimization. */
volatile struct GTeth_desc *p = &sc->txq_desc[0];
p->ed_cmdsts = 0;
}
-/* { dg-final { scan-tree-dump "\\(volatile struct GTeth_desc \\*\\) D" "gimple" } } */
/* { dg-final { scan-tree-dump "{v}" "optimized" } } */
-/* { dg-final { cleanup-tree-dump "gimple" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/arm/eliminate.c b/gcc/testsuite/gcc.target/arm/eliminate.c
new file mode 100644
index 00000000000..f254dd811d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/eliminate.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct X
+{
+ int c;
+};
+
+extern void bar(struct X *);
+
+void foo ()
+{
+ struct X x;
+ bar (&x);
+ bar (&x);
+ bar (&x);
+}
+
+/* { dg-final { scan-assembler-times "r0,\[\\t \]*sp" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/pr40900.c b/gcc/testsuite/gcc.target/arm/pr40900.c
new file mode 100644
index 00000000000..278bc370223
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr40900.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-optimize-sibling-calls" } */
+
+extern short shortv2();
+short shortv1()
+{
+ return shortv2();
+}
+
+/* { dg-final { scan-assembler-not "lsl" } } */
+/* { dg-final { scan-assembler-not "asr" } } */
+/* { dg-final { scan-assembler-not "sxth" } } */
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-1.c b/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-1.c
new file mode 100644
index 00000000000..d75f13aa089
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-1.c
@@ -0,0 +1,12 @@
+/* Use ADDS clobbering source operand, rather than CMN */
+/* { dg-options "-mthumb -Os" } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-final { scan-assembler "adds" } } */
+/* { dg-final { scan-assembler-not "cmn" } } */
+
+void foo1(void);
+void bar5(int x)
+{
+ if (x == -15)
+ foo1();
+}
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-2.c b/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-2.c
new file mode 100644
index 00000000000..358bc6e143c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-2.c
@@ -0,0 +1,12 @@
+/* Use ADDS with a scratch, rather than CMN */
+/* { dg-options "-mthumb -Os" } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-final { scan-assembler "adds" } } */
+/* { dg-final { scan-assembler-not "cmn" } } */
+
+void foo1(int);
+void bar5(int x)
+{
+ if (x == -1)
+ foo1(x);
+}
diff --git a/gcc/testsuite/gcc.target/arm/wmul-1.c b/gcc/testsuite/gcc.target/arm/wmul-1.c
index df85e7cb285..ccb3041551a 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-1.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-1.c
@@ -15,4 +15,4 @@ int mac(const short *a, const short *b, int sqr, int *sum)
return sqr;
}
-/* { dg-final { scan-assembler-times "smulbb" 2 } } */
+/* { dg-final { scan-assembler-times "smlabb" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/wmul-3.c b/gcc/testsuite/gcc.target/arm/wmul-3.c
new file mode 100644
index 00000000000..325dcebbbda
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/wmul-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=armv6t2" } */
+
+int mac(const short *a, const short *b, int sqr, int *sum)
+{
+ int i;
+ int dotp = *sum;
+
+ for (i = 0; i < 150; i++) {
+ dotp -= b[i] * a[i];
+ sqr -= b[i] * b[i];
+ }
+
+ *sum = dotp;
+ return sqr;
+}
+
+/* { dg-final { scan-assembler-times "smulbb" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/wmul-4.c b/gcc/testsuite/gcc.target/arm/wmul-4.c
new file mode 100644
index 00000000000..e8642f8aed1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/wmul-4.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=armv6t2" } */
+
+int mac(const int *a, const int *b, long long sqr, long long *sum)
+{
+ int i;
+ long long dotp = *sum;
+
+ for (i = 0; i < 150; i++) {
+ dotp += (long long) b[i] * a[i];
+ sqr += (long long) b[i] * b[i];
+ }
+
+ *sum = dotp;
+ return sqr;
+}
+
+/* { dg-final { scan-assembler-times "smlal" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/abi-2.c b/gcc/testsuite/gcc.target/i386/abi-2.c
index 5ed6b4a56dd..39eafc25039 100644
--- a/gcc/testsuite/gcc.target/i386/abi-2.c
+++ b/gcc/testsuite/gcc.target/i386/abi-2.c
@@ -1,6 +1,7 @@
/* Make certain that we pass __m256i in the correct register for AVX. */
/* { dg-do compile } */
/* { dg-options "-O1 -mavx" } */
+/* { dg-options "-mabi=sysv -O1 -mavx" { target x86_64-*-mingw* } } */
typedef long long __m256i __attribute__ ((__vector_size__ (32)));
__m256i foo (void) { return (__m256i){ 1, 2, 3, 4 }; }
diff --git a/gcc/testsuite/gcc.target/i386/aes-avx-check.h b/gcc/testsuite/gcc.target/i386/aes-avx-check.h
index e73e36eab25..e91e88173cf 100644
--- a/gcc/testsuite/gcc.target/i386/aes-avx-check.h
+++ b/gcc/testsuite/gcc.target/i386/aes-avx-check.h
@@ -6,6 +6,13 @@
static void aes_avx_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ aes_avx_test ();
+}
+
int
main ()
{
@@ -17,7 +24,7 @@ main ()
/* Run AES + AVX test only if host has AES + AVX support. */
if ((ecx & (bit_AVX | bit_AES)) == (bit_AVX | bit_AES))
{
- aes_avx_test ();
+ do_test ();
#ifdef DEBUG
printf ("PASSED\n");
#endif
diff --git a/gcc/testsuite/gcc.target/i386/aes-check.h b/gcc/testsuite/gcc.target/i386/aes-check.h
index f56f1adeb3e..7e794423e47 100644
--- a/gcc/testsuite/gcc.target/i386/aes-check.h
+++ b/gcc/testsuite/gcc.target/i386/aes-check.h
@@ -5,6 +5,13 @@
static void aes_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ aes_test ();
+}
+
int
main ()
{
@@ -16,7 +23,7 @@ main ()
/* Run AES test only if host has AES support. */
if (ecx & bit_AES)
{
- aes_test ();
+ do_test ();
#ifdef DEBUG
printf ("PASSED\n");
#endif
diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-3.c b/gcc/testsuite/gcc.target/i386/amd64-abi-3.c
index 8db7f13b1ea..6b7bf6a6e5f 100644
--- a/gcc/testsuite/gcc.target/i386/amd64-abi-3.c
+++ b/gcc/testsuite/gcc.target/i386/amd64-abi-3.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target lp64 } */
-/* { dg-options "-O2 -fomit-frame-pointer -mno-sse" } */
+/* { dg-options "-O2 -fomit-frame-pointer -mno-sse -mtune=k8" } */
/* { dg-final { scan-assembler "subq\[\\t \]*\\\$88,\[\\t \]*%rsp" } } */
/* { dg-final { scan-assembler-not "subq\[\\t \]*\\\$216,\[\\t \]*%rsp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-check.h b/gcc/testsuite/gcc.target/i386/avx-check.h
index 8db55a10357..7736fc9f40b 100644
--- a/gcc/testsuite/gcc.target/i386/avx-check.h
+++ b/gcc/testsuite/gcc.target/i386/avx-check.h
@@ -4,6 +4,13 @@
static void avx_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ avx_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run AVX test only if host has AVX support. */
if (ecx & bit_AVX)
{
- avx_test ();
+ do_test ();
#ifdef DEBUG
printf ("PASSED\n");
#endif
diff --git a/gcc/testsuite/gcc.target/i386/avx-vextractf128-256-3.c b/gcc/testsuite/gcc.target/i386/avx-vextractf128-256-3.c
new file mode 100644
index 00000000000..b7d4a373101
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vextractf128-256-3.c
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O2 -mavx" } */
+
+#define OFFSET 0
+
+#include "avx-vextractf128-256-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx-vextractf128-256-4.c b/gcc/testsuite/gcc.target/i386/avx-vextractf128-256-4.c
new file mode 100644
index 00000000000..973fa58b12a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vextractf128-256-4.c
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O2 -mavx" } */
+
+#define OFFSET 0
+
+#include "avx-vextractf128-256-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/extract-1.c b/gcc/testsuite/gcc.target/i386/extract-1.c
new file mode 100644
index 00000000000..102beb230ac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/extract-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+int
+foo (unsigned char x, unsigned char y)
+{
+ return (x % y) != 0;
+}
+
+/* { dg-final { scan-assembler-not "test\[b\]?\[^\\n\]*%\[a-d\]l" } } */
diff --git a/gcc/testsuite/gcc.target/i386/extract-2.c b/gcc/testsuite/gcc.target/i386/extract-2.c
new file mode 100644
index 00000000000..3bb5f154c4e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/extract-2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+int
+foo (unsigned char x, unsigned char y)
+{
+ return (x % y) > 4;
+}
+
+/* { dg-final { scan-assembler-times "cmp\[b\]?\[^\\n\]*%\[a-d\]h" 1 } } */
+/* { dg-final { scan-assembler-not "cmp\[b\]?\[^\\n\]*%\[a-d\]l" } } */
diff --git a/gcc/testsuite/gcc.target/i386/extract-3.c b/gcc/testsuite/gcc.target/i386/extract-3.c
new file mode 100644
index 00000000000..520bf3bb557
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/extract-3.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+typedef struct
+{
+ unsigned char c1;
+ unsigned char c2;
+ unsigned char c3;
+ unsigned char c4;
+} foo_t;
+
+int
+#ifndef __x86_64__
+__attribute__((regparm(3)))
+#endif
+foo (foo_t x)
+{
+ return x.c2 != 0;
+}
+
+/* { dg-final { scan-assembler-not "test\[b\]?\[^\\n\]*%\[a-z0-9\]+l" } } */
diff --git a/gcc/testsuite/gcc.target/i386/extract-4.c b/gcc/testsuite/gcc.target/i386/extract-4.c
new file mode 100644
index 00000000000..716ae2299ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/extract-4.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+typedef struct
+{
+ unsigned char c1;
+ unsigned char c2;
+ unsigned char c3;
+ unsigned char c4;
+} foo_t;
+
+int
+#ifndef __x86_64__
+__attribute__((regparm(3)))
+#endif
+foo (foo_t x)
+{
+ return x.c2 > 4;
+}
+
+/* { dg-final { scan-assembler-times "cmp\[b\]?\[^\\n\]*%\[a-z0-9\]+h" 1 } } */
+/* { dg-final { scan-assembler-not "cmp\[b\]?\[^\\n\]*%\[a-z0-9\]+l" } } */
diff --git a/gcc/testsuite/gcc.target/i386/extract-5.c b/gcc/testsuite/gcc.target/i386/extract-5.c
new file mode 100644
index 00000000000..a488dafa20f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/extract-5.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+typedef struct
+{
+ unsigned int c1:8;
+ unsigned int c2:8;
+ unsigned int c3:8;
+ unsigned int c4:8;
+} foo_t;
+
+int
+#ifndef __x86_64__
+__attribute__((regparm(3)))
+#endif
+foo (foo_t x)
+{
+ return x.c2 != 0;
+}
+
+/* { dg-final { scan-assembler-not "test\[b\]?\[^\\n\]*%\[a-z0-9\]+l" } } */
diff --git a/gcc/testsuite/gcc.target/i386/extract-6.c b/gcc/testsuite/gcc.target/i386/extract-6.c
new file mode 100644
index 00000000000..1440ec3be35
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/extract-6.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+typedef struct
+{
+ unsigned int c1:8;
+ unsigned int c2:8;
+ unsigned int c3:8;
+ unsigned int c4:8;
+
+} foo_t;
+
+int
+#ifndef __x86_64__
+__attribute__((regparm(3)))
+#endif
+foo (foo_t x)
+{
+ return x.c2 > 4;
+}
+
+/* { dg-final { scan-assembler-times "cmp\[b\]?\[^\\n\]*%\[a-z0-9\]+h" 1 } } */
+/* { dg-final { scan-assembler-not "cmp\[b\]?\[^\\n\]*%\[a-z0-9\]+l" } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma4-check.h b/gcc/testsuite/gcc.target/i386/fma4-check.h
index 76fcdef99b6..dc7ee574878 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-check.h
+++ b/gcc/testsuite/gcc.target/i386/fma4-check.h
@@ -4,6 +4,13 @@
static void fma4_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ fma4_test ();
+}
+
int
main ()
{
@@ -14,7 +21,7 @@ main ()
/* Run FMA4 test only if host has FMA4 support. */
if (ecx & bit_FMA4)
- fma4_test ();
+ do_test ();
exit (0);
}
diff --git a/gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h b/gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h
index 458e7cda898..4f2f7f3ac40 100644
--- a/gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h
+++ b/gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h
@@ -5,6 +5,13 @@
static void mmx_3dnow_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ mmx_3dnow_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run 3DNow! test only if host has 3DNow! support. */
if (edx & bit_3DNOW)
- mmx_3dnow_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/mmx-check.h b/gcc/testsuite/gcc.target/i386/mmx-check.h
index aefdc4e8799..faf9b876f38 100644
--- a/gcc/testsuite/gcc.target/i386/mmx-check.h
+++ b/gcc/testsuite/gcc.target/i386/mmx-check.h
@@ -5,6 +5,13 @@
static void mmx_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ mmx_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run MMX test only if host has MMX support. */
if (edx & bit_MMX)
- mmx_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/mod-1.c b/gcc/testsuite/gcc.target/i386/mod-1.c
new file mode 100644
index 00000000000..a7b1a92258d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mod-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -mtune=generic" } */
+
+typedef struct {
+ int a;
+} VCR;
+
+typedef struct {
+ VCR vcr[8];
+} VCRC;
+
+typedef struct {
+ char vcr;
+} OWN;
+
+OWN Own[16];
+
+void
+f (VCRC *x, OWN *own)
+{
+ x[own->vcr / 8].vcr[own->vcr % 8].a--;
+ x[own->vcr / 8].vcr[own->vcr % 8].a = x[own->vcr / 8].vcr[own->vcr % 8].a;
+}
+
+/* { dg-final { scan-assembler-times "idivb" 1 } } */
+/* { dg-final { scan-assembler-not "incl" } } */
+/* { dg-final { scan-assembler-not "orl" } } */
+/* { dg-final { scan-assembler-not "andb" } } */
+/* { dg-final { scan-assembler-not "jns" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h b/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h
index de633336157..550e49904d9 100644
--- a/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h
+++ b/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h
@@ -6,6 +6,13 @@
static void pclmul_avx_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ pclmul_avx_test ();
+}
+
int
main ()
{
@@ -17,7 +24,7 @@ main ()
/* Run PCLMUL + AVX test only if host has PCLMUL + AVX support. */
if ((ecx & (bit_AVX | bit_PCLMUL)) == (bit_AVX | bit_PCLMUL))
{
- pclmul_avx_test ();
+ do_test ();
#ifdef DEBUG
printf ("PASSED\n");
#endif
diff --git a/gcc/testsuite/gcc.target/i386/pclmul-check.h b/gcc/testsuite/gcc.target/i386/pclmul-check.h
index 706fd640034..7526cbe2ddf 100644
--- a/gcc/testsuite/gcc.target/i386/pclmul-check.h
+++ b/gcc/testsuite/gcc.target/i386/pclmul-check.h
@@ -5,6 +5,13 @@
static void pclmul_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ pclmul_test ();
+}
+
int
main ()
{
@@ -16,7 +23,7 @@ main ()
/* Run PCLMULQDQ test only if host has PCLMULQDQ support. */
if (ecx & bit_PCLMUL)
{
- pclmul_test ();
+ do_test ();
#ifdef DEBUG
printf ("PASSED\n");
#endif
diff --git a/gcc/testsuite/gcc.target/i386/pr27971.c b/gcc/testsuite/gcc.target/i386/pr27971.c
index 8c706adda59..27888de6d2f 100644
--- a/gcc/testsuite/gcc.target/i386/pr27971.c
+++ b/gcc/testsuite/gcc.target/i386/pr27971.c
@@ -3,7 +3,13 @@
unsigned array[4];
-unsigned foo(unsigned long x)
+#ifdef _WIN64
+__extension__ typedef unsigned long long TYPE;
+#else
+#define TYPE unsigned long
+#endif
+
+unsigned foo(TYPE x)
{
return array[(x>>2)&3ul];
}
diff --git a/gcc/testsuite/gcc.target/i386/pr39139.c b/gcc/testsuite/gcc.target/i386/pr39139.c
index 95ea7fda9ba..e4cb845f9ec 100644
--- a/gcc/testsuite/gcc.target/i386/pr39139.c
+++ b/gcc/testsuite/gcc.target/i386/pr39139.c
@@ -12,22 +12,24 @@
# define SI_REG asm ("esi")
#endif
+__extension__ typedef __SIZE_TYPE__ size_t;
+
static inline int
foo (unsigned int x, void *y)
{
- register unsigned long r AX_REG;
- register unsigned long a1 DI_REG;
- register unsigned long a2 SI_REG;
- a1 = (unsigned long) x;
- a2 = (unsigned long) y;
+ register size_t r AX_REG;
+ register size_t a1 DI_REG;
+ register size_t a2 SI_REG;
+ a1 = (size_t) x;
+ a2 = (size_t) y;
asm volatile ("" : "=r" (r), "+r" (a1), "+r" (a2) : : "memory");
return (int) r;
}
-struct T { unsigned long t1, t2; unsigned int t3, t4, t5; };
+struct T { size_t t1, t2; unsigned int t3, t4, t5; };
int
-bar (unsigned long x, unsigned int y, unsigned long u, unsigned int v)
+bar (size_t x, unsigned int y, size_t u, unsigned int v)
{
long r;
struct T e = { .t1 = x, .t2 = u };
diff --git a/gcc/testsuite/gcc.target/i386/pr39315-check.c b/gcc/testsuite/gcc.target/i386/pr39315-check.c
index ff926057536..8f7376015d0 100644
--- a/gcc/testsuite/gcc.target/i386/pr39315-check.c
+++ b/gcc/testsuite/gcc.target/i386/pr39315-check.c
@@ -1,4 +1,6 @@
+/* { dg-compile } */
typedef float __m128 __attribute__ ((__vector_size__ (16)));
+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
extern void foo (__m128 *);
extern void abort (void);
@@ -8,7 +10,7 @@ __m128 y = { 0.0, 1.0, 2.0, 3.0 };
void
bar (__m128 *x, int align)
{
- if ((((__PTRDIFF_TYPE__) x) & (align - 1)) != 0)
+ if ((((ptrdiff_t) x) & (align - 1)) != 0)
abort ();
if (__builtin_memcmp (x, &y, sizeof (y)) != 0)
abort ();
diff --git a/gcc/testsuite/gcc.target/i386/pr44481.c b/gcc/testsuite/gcc.target/i386/pr44481.c
new file mode 100644
index 00000000000..701268b5656
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr44481.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+static inline unsigned
+parity (unsigned x)
+{
+ return (unsigned) __builtin_parity (x);
+}
+
+unsigned
+f (unsigned rpoly)
+{
+ return parity (rpoly & 1) ^ parity (rpoly & 6);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr44546.c b/gcc/testsuite/gcc.target/i386/pr44546.c
new file mode 100644
index 00000000000..517446fdc8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr44546.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -ffast-math -mfpmath=387" } */
+
+typedef __SIZE_TYPE__ size_t;
+typedef struct
+{
+ float *ewgts;
+} vtx_data;
+
+extern void *zmalloc (size_t);
+extern int whatever (vtx_data *);
+
+float *
+compute_apsp_artifical_weights_packed (vtx_data * graph, int n)
+{
+ float *weights;
+
+ weights = (float *) zmalloc (n * sizeof (float));
+ weights[n] =
+ whatever (graph) > graph[n].ewgts[n] ?
+ whatever (graph) : graph[n].ewgts[n];
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse-check.h b/gcc/testsuite/gcc.target/i386/sse-check.h
index 79ea4815517..85629cc71b9 100644
--- a/gcc/testsuite/gcc.target/i386/sse-check.h
+++ b/gcc/testsuite/gcc.target/i386/sse-check.h
@@ -6,6 +6,13 @@
static void sse_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ sse_test ();
+}
+
int
main ()
{
@@ -16,7 +23,7 @@ main ()
/* Run SSE test only if host has SSE support. */
if (edx & bit_SSE)
- sse_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-check.h b/gcc/testsuite/gcc.target/i386/sse2-check.h
index a69333e391a..e9f17f04079 100644
--- a/gcc/testsuite/gcc.target/i386/sse2-check.h
+++ b/gcc/testsuite/gcc.target/i386/sse2-check.h
@@ -4,6 +4,13 @@
static void sse2_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ sse2_test ();
+}
+
int
main ()
{
@@ -14,7 +21,7 @@ main ()
/* Run SSE2 test only if host has SSE2 support. */
if (edx & bit_SSE2)
- sse2_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-vec-2a.c b/gcc/testsuite/gcc.target/i386/sse2-vec-2a.c
new file mode 100644
index 00000000000..f230f27d45a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-vec-2a.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msse2 -mtune=atom" } */
+/* { dg-require-effective-target sse2 } */
+
+#include "sse2-vec-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/sse3-check.h b/gcc/testsuite/gcc.target/i386/sse3-check.h
index 92930d10a3f..df0e63a4575 100644
--- a/gcc/testsuite/gcc.target/i386/sse3-check.h
+++ b/gcc/testsuite/gcc.target/i386/sse3-check.h
@@ -5,6 +5,13 @@
static void sse3_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ sse3_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run SSE3 test only if host has SSE3 support. */
if (ecx & bit_SSE3)
- sse3_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-check.h b/gcc/testsuite/gcc.target/i386/sse4_1-check.h
index 2d1c4e835a3..788f65d61cb 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-check.h
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-check.h
@@ -7,6 +7,13 @@ static void sse4_1_test (void);
#define MASK 0x2
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ sse4_1_test ();
+}
+
int
main ()
{
@@ -17,7 +24,7 @@ main ()
/* Run SSE4.1 test only if host has SSE4.1 support. */
if (ecx & bit_SSE4_1)
- sse4_1_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/sse4_2-check.h b/gcc/testsuite/gcc.target/i386/sse4_2-check.h
index 2a397e88683..d10e6c7d7e2 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_2-check.h
+++ b/gcc/testsuite/gcc.target/i386/sse4_2-check.h
@@ -5,6 +5,13 @@
static void sse4_2_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ sse4_2_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run SSE4.2 test only if host has SSE4.2 support. */
if (ecx & bit_SSE4_2)
- sse4_2_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/sse4a-check.h b/gcc/testsuite/gcc.target/i386/sse4a-check.h
index d6140e8969c..d43b4b222b1 100644
--- a/gcc/testsuite/gcc.target/i386/sse4a-check.h
+++ b/gcc/testsuite/gcc.target/i386/sse4a-check.h
@@ -5,6 +5,13 @@
static void sse4a_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ sse4a_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run SSE4a test only if host has SSE4a support. */
if (ecx & bit_SSE4a)
- sse4a_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/ssse3-check.h b/gcc/testsuite/gcc.target/i386/ssse3-check.h
index 78df15db7d7..3ca79333c7f 100644
--- a/gcc/testsuite/gcc.target/i386/ssse3-check.h
+++ b/gcc/testsuite/gcc.target/i386/ssse3-check.h
@@ -5,6 +5,13 @@
static void ssse3_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ ssse3_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run SSSE3 test only if host has SSSE3 support. */
if (ecx & bit_SSSE3)
- ssse3_test ();
+ do_test ();
return 0;
}
diff --git a/gcc/testsuite/gcc.target/i386/umod-1.c b/gcc/testsuite/gcc.target/i386/umod-1.c
new file mode 100644
index 00000000000..54edf139d5a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/umod-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=atom" } */
+
+unsigned char
+foo (unsigned char x, unsigned char y)
+{
+ return x % y;
+}
+
+/* { dg-final { scan-assembler-times "divb" 1 } } */
+/* { dg-final { scan-assembler-not "divw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/umod-2.c b/gcc/testsuite/gcc.target/i386/umod-2.c
new file mode 100644
index 00000000000..6fe73846833
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/umod-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=atom" } */
+
+extern unsigned char z;
+
+unsigned char
+foo (unsigned char x, unsigned char y)
+{
+ z = x/y;
+ return x % y;
+}
+
+/* { dg-final { scan-assembler-times "divb" 1 } } */
+/* { dg-final { scan-assembler-not "divw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/umod-3.c b/gcc/testsuite/gcc.target/i386/umod-3.c
new file mode 100644
index 00000000000..7123bc9f256
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/umod-3.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=atom" } */
+
+extern void abort (void);
+extern void exit (int);
+
+unsigned char cx = 7;
+
+int
+main ()
+{
+ unsigned char cy;
+
+ cy = cx / 6; if (cy != 1) abort ();
+ cy = cx % 6; if (cy != 1) abort ();
+
+ exit(0);
+}
+
+/* { dg-final { scan-assembler-times "divb" 1 } } */
+/* { dg-final { scan-assembler-not "divw" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vararg-1.c b/gcc/testsuite/gcc.target/i386/vararg-1.c
index cfb1e30ab07..9ed9ab087d0 100644
--- a/gcc/testsuite/gcc.target/i386/vararg-1.c
+++ b/gcc/testsuite/gcc.target/i386/vararg-1.c
@@ -1,6 +1,7 @@
/* PR middle-end/36858 */
/* { dg-do run } */
/* { dg-options "-w" { target { lp64 } } } */
+/* { dg-options "-w" { target { llp64 } } } */
/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" { target { ilp32 } } } */
/* { dg-require-effective-target sse2 } */
diff --git a/gcc/testsuite/gcc.target/i386/vararg-2.c b/gcc/testsuite/gcc.target/i386/vararg-2.c
index 60793173d6c..804801256f1 100644
--- a/gcc/testsuite/gcc.target/i386/vararg-2.c
+++ b/gcc/testsuite/gcc.target/i386/vararg-2.c
@@ -1,6 +1,7 @@
/* PR middle-end/36859 */
/* { dg-do run } */
/* { dg-options "-w" { target { lp64 } } } */
+/* { dg-options "-w" { target { llp64 } } } */
/* { dg-options "-w -msse2 -mpreferred-stack-boundary=2" { target { ilp32 } } } */
/* { dg-require-effective-target sse2 } */
diff --git a/gcc/testsuite/gcc.target/i386/volatile-bitfields-1.c b/gcc/testsuite/gcc.target/i386/volatile-bitfields-1.c
new file mode 100644
index 00000000000..01a35f9f920
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/volatile-bitfields-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fstrict-volatile-bitfields" } */
+
+typedef struct {
+ char a:1;
+ char b:7;
+ int c;
+} BitStruct;
+
+volatile BitStruct bits;
+
+int foo ()
+{
+ return bits.b;
+}
+
+/* { dg-final { scan-assembler "movzbl.*bits" } } */
diff --git a/gcc/testsuite/gcc.target/i386/volatile-bitfields-2.c b/gcc/testsuite/gcc.target/i386/volatile-bitfields-2.c
new file mode 100644
index 00000000000..302625a199b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/volatile-bitfields-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-strict-volatile-bitfields" } */
+
+typedef struct {
+ char a:1;
+ char b:7;
+ int c;
+} BitStruct;
+
+volatile BitStruct bits;
+
+int foo ()
+{
+ return bits.b;
+}
+
+/* { dg-final { scan-assembler "movl.*bits" } } */
diff --git a/gcc/testsuite/gcc.target/i386/xop-check.h b/gcc/testsuite/gcc.target/i386/xop-check.h
index fb98c6d4bd4..7e8e665c79f 100644
--- a/gcc/testsuite/gcc.target/i386/xop-check.h
+++ b/gcc/testsuite/gcc.target/i386/xop-check.h
@@ -5,6 +5,13 @@
static void xop_test (void);
+static void
+__attribute__ ((noinline))
+do_test (void)
+{
+ xop_test ();
+}
+
int
main ()
{
@@ -15,7 +22,7 @@ main ()
/* Run XOP test only if host has XOP support. */
if (ecx & bit_XOP)
- xop_test ();
+ do_test ();
exit (0);
}
diff --git a/gcc/testsuite/gcc.target/mips/madd-9.c b/gcc/testsuite/gcc.target/mips/madd-9.c
new file mode 100644
index 00000000000..25dbd18a510
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/madd-9.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 isa_rev>=1 -mgp32" } */
+/* { dg-final { scan-assembler-not "\tmul\t" } } */
+/* { dg-final { scan-assembler "\tmadd\t" } } */
+
+NOMIPS16 long long
+f1 (int *a, int *b, int n)
+{
+ long long int x;
+ int i;
+
+ x = 0;
+ for (i = 0; i < n; i++)
+ x += (long long) a[i] * b[i];
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-1.c b/gcc/testsuite/gcc.target/powerpc/recip-1.c
new file mode 100644
index 00000000000..d1e383dc4ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2 -mrecip -ffast-math -mcpu=power6" } */
+/* { dg-final { scan-assembler-times "frsqrte" 2 } } */
+/* { dg-final { scan-assembler-times "fmsub" 2 } } */
+/* { dg-final { scan-assembler-times "fmul" 8 } } */
+/* { dg-final { scan-assembler-times "fnmsub" 4 } } */
+
+double
+rsqrt_d (double a)
+{
+ return 1.0 / __builtin_sqrt (a);
+}
+
+float
+rsqrt_f (float a)
+{
+ return 1.0f / __builtin_sqrtf (a);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-2.c b/gcc/testsuite/gcc.target/powerpc/recip-2.c
new file mode 100644
index 00000000000..69442733aab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2 -mrecip -ffast-math -mcpu=power5" } */
+/* { dg-final { scan-assembler-times "frsqrtes" 1 } } */
+/* { dg-final { scan-assembler-times "fmsubs" 1 } } */
+/* { dg-final { scan-assembler-times "fmuls" 6 } } */
+/* { dg-final { scan-assembler-times "fnmsubs" 3 } } */
+/* { dg-final { scan-assembler-times "fsqrt" 1 } } */
+
+/* power5 resqrte is not accurate enough, and should not be generated by
+ default for -mrecip. */
+double
+rsqrt_d (double a)
+{
+ return 1.0 / __builtin_sqrt (a);
+}
+
+float
+rsqrt_f (float a)
+{
+ return 1.0f / __builtin_sqrtf (a);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-3.c b/gcc/testsuite/gcc.target/powerpc/recip-3.c
new file mode 100644
index 00000000000..80a34e8ee59
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-3.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2 -mrecip -ffast-math -mcpu=power7" } */
+/* { dg-final { scan-assembler-times "xsrsqrtedp" 1 } } */
+/* { dg-final { scan-assembler-times "xsmsub.dp" 1 } } */
+/* { dg-final { scan-assembler-times "xsmuldp" 4 } } */
+/* { dg-final { scan-assembler-times "xsnmsub.dp" 2 } } */
+/* { dg-final { scan-assembler-times "frsqrtes" 1 } } */
+/* { dg-final { scan-assembler-times "fmsubs" 1 } } */
+/* { dg-final { scan-assembler-times "fmuls" 4 } } */
+/* { dg-final { scan-assembler-times "fnmsubs" 2 } } */
+
+double
+rsqrt_d (double a)
+{
+ return 1.0 / __builtin_sqrt (a);
+}
+
+float
+rsqrt_f (float a)
+{
+ return 1.0f / __builtin_sqrtf (a);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-4.c b/gcc/testsuite/gcc.target/powerpc/recip-4.c
new file mode 100644
index 00000000000..bd496d70e25
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-4.c
@@ -0,0 +1,36 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O3 -ftree-vectorize -mrecip -ffast-math -mcpu=power7 -fno-unroll-loops" } */
+/* { dg-final { scan-assembler-times "xvrsqrtedp" 1 } } */
+/* { dg-final { scan-assembler-times "xvmsub.dp" 1 } } */
+/* { dg-final { scan-assembler-times "xvmuldp" 4 } } */
+/* { dg-final { scan-assembler-times "xvnmsub.dp" 2 } } */
+/* { dg-final { scan-assembler-times "xvrsqrtesp" 1 } } */
+/* { dg-final { scan-assembler-times "xvmsub.sp" 1 } } */
+/* { dg-final { scan-assembler-times "xvmulsp" 4 } } */
+/* { dg-final { scan-assembler-times "xvnmsub.sp" 2 } } */
+
+#define SIZE 1024
+
+extern double a_d[SIZE] __attribute__((__aligned__(32)));
+extern double b_d[SIZE] __attribute__((__aligned__(32)));
+
+void
+vectorize_rsqrt_d (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a_d[i] = 1.0 / __builtin_sqrt (b_d[i]);
+}
+
+extern float a_f[SIZE] __attribute__((__aligned__(32)));
+extern float b_f[SIZE] __attribute__((__aligned__(32)));
+
+void
+vectorize_rsqrt_f (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a_f[i] = 1.0f / __builtin_sqrtf (b_f[i]);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-5.c b/gcc/testsuite/gcc.target/powerpc/recip-5.c
new file mode 100644
index 00000000000..4a9c496201a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-5.c
@@ -0,0 +1,94 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */
+/* { dg-final { scan-assembler-times "xvredp" 4 } } */
+/* { dg-final { scan-assembler-times "xvresp" 5 } } */
+/* { dg-final { scan-assembler-times "xsredp" 2 } } */
+/* { dg-final { scan-assembler-times "fres" 2 } } */
+
+#include <altivec.h>
+
+float f_recip (float a, float b) { return __builtin_recipdivf (a, b); }
+double d_recip (double a, double b) { return __builtin_recipdiv (a, b); }
+
+float f_div (float a, float b) { return a / b; }
+double d_div (double a, double b) { return a / b; }
+
+#define SIZE 1024
+
+double d_a[SIZE] __attribute__((__aligned__(32)));
+double d_b[SIZE] __attribute__((__aligned__(32)));
+double d_c[SIZE] __attribute__((__aligned__(32)));
+
+float f_a[SIZE] __attribute__((__aligned__(32)));
+float f_b[SIZE] __attribute__((__aligned__(32)));
+float f_c[SIZE] __attribute__((__aligned__(32)));
+
+void vec_f_recip (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ f_a[i] = __builtin_recipdivf (f_b[i], f_c[i]);
+}
+
+void vec_d_recip (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ d_a[i] = __builtin_recipdiv (d_b[i], d_c[i]);
+}
+
+void vec_f_div (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ f_a[i] = f_b[i] / f_c[i];
+}
+
+void vec_f_div2 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ f_a[i] = f_b[i] / 2.0f;
+}
+
+void vec_f_div53 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ f_a[i] = f_b[i] / 53.0f;
+}
+
+void vec_d_div (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ d_a[i] = d_b[i] / d_c[i];
+}
+
+void vec_d_div2 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ d_a[i] = d_b[i] / 2.0;
+}
+
+void vec_d_div53 (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ d_a[i] = d_b[i] / 53.0;
+}
+
+vector float v4sf_recip1 (vector float a, vector float b) { return vec_recipdiv (a, b); }
+vector float v4sf_recip2 (vector float a, vector float b) { return __builtin_altivec_vrecipdivfp (a, b); }
+vector double v2df_recip1 (vector double a, vector double b) { return vec_recipdiv (a, b); }
+vector float v4sf_recip3 (vector float a, vector float b) { return __builtin_vsx_xvrecipdivsp (a, b); }
+vector double v2df_recip2 (vector double a, vector double b) { return __builtin_vsx_xvrecipdivdp (a, b); }
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-6.c b/gcc/testsuite/gcc.target/powerpc/recip-6.c
new file mode 100644
index 00000000000..7d71df6709d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-6.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-mcpu=power7 -O3 -ftree-vectorize -ffast-math -mrecip=all -mrecip-precision" } */
+
+/* Check reciprocal estimate functions for accuracy. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <math.h>
+#include <float.h>
+#include <string.h>
+
+#include "recip-test.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-7.c b/gcc/testsuite/gcc.target/powerpc/recip-7.c
new file mode 100644
index 00000000000..7b32ba076a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-7.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
+/* { dg-require-effective-target ppc_recip_hw } */
+/* { dg-options "-O3 -ftree-vectorize -ffast-math -mrecip -mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb" } */
+
+/* Check reciprocal estimate functions for accuracy. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <math.h>
+#include <float.h>
+#include <string.h>
+
+#include "recip-test.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-test.h b/gcc/testsuite/gcc.target/powerpc/recip-test.h
new file mode 100644
index 00000000000..7a42df5757d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-test.h
@@ -0,0 +1,149 @@
+/* Check reciprocal estimate functions for accuracy. */
+
+#ifdef _ARCH_PPC64
+typedef unsigned long uns64_t;
+#define UNUM64(x) x ## L
+
+#else
+typedef unsigned long long uns64_t;
+#define UNUM64(x) x ## LL
+#endif
+
+typedef unsigned int uns32_t;
+
+#define TNAME2(x) #x
+#define TNAME(x) TNAME2(x)
+
+/*
+ * Float functions.
+ */
+
+#define TYPE float
+#define NAME(PREFIX) PREFIX ## _float
+#define UNS_TYPE uns32_t
+#define UNS_ABS __builtin_abs
+#define EXP_SIZE 8
+#define MAN_SIZE 23
+#define FABS __builtin_fabsf
+#define FMAX __builtin_fmaxf
+#define FMIN __builtin_fminf
+#define SQRT __builtin_sqrtf
+#define RMIN 1.0e-10
+#define RMAX 1.0e+10
+#define BDIV 1
+#define BRSQRT 2
+#define ASMDIV "fdivs"
+#define ASMSQRT "fsqrts"
+
+#define INIT_DIV \
+{ \
+ { 0x4fffffff }, /* 8589934080 */ \
+ { 0x4effffff }, /* 2147483520 */ \
+ { 0x40ffffff }, /* 7.99999952316284 */ \
+ { 0x3fffffff }, /* 1.99999988079071 */ \
+ { 0x417fffff }, /* 15.9999990463257 */ \
+ { 0x42ffffff }, /* 127.999992370605 */ \
+ { 0x3dffffff }, /* 0.124999992549419 */ \
+ { 0x3effffff }, /* 0.499999970197678 */ \
+}
+
+#define INIT_RSQRT \
+{ \
+ { 0x457ffffe }, /* 4096 - small amount */ \
+ { 0x4c7fffff }, /* 6.71089e+07 */ \
+ { 0x3d7fffff }, /* 0.0625 - small amount */ \
+ { 0x307ffffe }, /* 9.31322e-10 */ \
+ { 0x4c7ffffe }, /* 6.71089e+07 */ \
+ { 0x397ffffe }, /* 0.000244141 */ \
+ { 0x2e7fffff }, /* 5.82077e-11 */ \
+ { 0x2f7fffff }, /* 2.32831e-10 */ \
+}
+
+
+#include "recip-test2.h"
+
+/*
+ * Double functions.
+ */
+
+#undef TYPE
+#undef NAME
+#undef UNS_TYPE
+#undef UNS_ABS
+#undef EXP_SIZE
+#undef MAN_SIZE
+#undef FABS
+#undef FMAX
+#undef FMIN
+#undef SQRT
+#undef RMIN
+#undef RMAX
+#undef BDIV
+#undef BRSQRT
+#undef ASMDIV
+#undef ASMSQRT
+#undef INIT_DIV
+#undef INIT_RSQRT
+
+#define TYPE double
+#define NAME(PREFIX) PREFIX ## _double
+#define UNS_TYPE uns64_t
+#define UNS_ABS __builtin_imaxabs
+#define EXP_SIZE 11
+#define MAN_SIZE 52
+#define FABS __builtin_fabs
+#define FMAX __builtin_fmax
+#define FMIN __builtin_fmin
+#define SQRT __builtin_sqrt
+#define RMIN 1.0e-100
+#define RMAX 1.0e+100
+#define BDIV 1
+#define BRSQRT 2
+#define ASMDIV "fdiv"
+#define ASMSQRT "fsqrt"
+
+#define INIT_DIV \
+{ \
+ { UNUM64 (0x2b57be53f2a2f3a0) }, /* 6.78462e-100 */ \
+ { UNUM64 (0x2b35f8e8ea553e52) }, /* 1.56963e-100 */ \
+ { UNUM64 (0x2b5b9d861d2fe4fb) }, /* 7.89099e-100 */ \
+ { UNUM64 (0x2b45dc44a084e682) }, /* 3.12327e-100 */ \
+ { UNUM64 (0x2b424ce16945d777) }, /* 2.61463e-100 */ \
+ { UNUM64 (0x2b20b5023d496b50) }, /* 5.96749e-101 */ \
+ { UNUM64 (0x2b61170547f57caa) }, /* 9.76678e-100 */ \
+ { UNUM64 (0x2b543b9d498aac37) }, /* 5.78148e-100 */ \
+}
+
+#define INIT_RSQRT \
+{ \
+ { UNUM64 (0x2b616f2d8cbbc646) }, /* 9.96359e-100 */ \
+ { UNUM64 (0x2b5c4db2da0a011d) }, /* 8.08764e-100 */ \
+ { UNUM64 (0x2b55a82d5735b262) }, /* 6.1884e-100 */ \
+ { UNUM64 (0x2b50b52908258cb8) }, /* 4.77416e-100 */ \
+ { UNUM64 (0x2b363989a4fb29af) }, /* 1.58766e-100 */ \
+ { UNUM64 (0x2b508b9f6f4180a9) }, /* 4.7278e-100 */ \
+ { UNUM64 (0x2b4f7a1d48accb40) }, /* 4.49723e-100 */ \
+ { UNUM64 (0x2b1146a37372a81f) }, /* 3.08534e-101 */ \
+ { UNUM64 (0x2b33f876a8c48050) }, /* 1.42663e-100 */ \
+}
+
+#include "recip-test2.h"
+
+int
+main (int argc __attribute__((__unused__)),
+ char *argv[] __attribute__((__unused__)))
+{
+ srand48 (1);
+ run_float ();
+
+#ifdef VERBOSE
+ printf ("\n");
+#endif
+
+ run_double ();
+
+ if (error_count_float != 0 || error_count_double != 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-test2.h b/gcc/testsuite/gcc.target/powerpc/recip-test2.h
new file mode 100644
index 00000000000..3ec356cdfd8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/recip-test2.h
@@ -0,0 +1,432 @@
+/*
+ * Included file to common source float/double checking
+ * The following macros should be defined:
+ * TYPE -- floating point type
+ * NAME -- convert a name to include the type
+ * UNS_TYPE -- type to hold TYPE as an unsigned number
+ * EXP_SIZE -- size in bits of the exponent
+ * MAN_SIZE -- size in bits of the mantissa
+ * UNS_ABS -- absolute value for UNS_TYPE
+ * FABS -- absolute value function for TYPE
+ * FMAX -- maximum function for TYPE
+ * FMIN -- minimum function for TYPE
+ * SQRT -- square root function for TYPE
+ * RMIN -- minimum random number to generate
+ * RMAX -- maximum random number to generate
+ * ASMDIV -- assembler instruction to do divide
+ * ASMSQRT -- assembler instruction to do square root
+ * BDIV -- # of bits of inaccuracy to allow for division
+ * BRSQRT -- # of bits of inaccuracy to allow for 1/sqrt
+ * INIT_DIV -- Initial values to test 1/x against
+ * INIT_RSQRT -- Initial values to test 1/sqrt(x) against
+ */
+
+typedef union
+{
+ UNS_TYPE i;
+ TYPE x;
+} NAME (union);
+
+/*
+ * Input/output arrays.
+ */
+
+static NAME (union) NAME (div_input) [] __attribute__((__aligned__(32))) = INIT_DIV;
+static NAME (union) NAME (rsqrt_input)[] __attribute__((__aligned__(32))) = INIT_RSQRT;
+
+#define DIV_SIZE (sizeof (NAME (div_input)) / sizeof (TYPE))
+#define RSQRT_SIZE (sizeof (NAME (rsqrt_input)) / sizeof (TYPE))
+
+static TYPE NAME (div_expected)[DIV_SIZE] __attribute__((__aligned__(32)));
+static TYPE NAME (div_output) [DIV_SIZE] __attribute__((__aligned__(32)));
+
+static TYPE NAME (rsqrt_expected)[RSQRT_SIZE] __attribute__((__aligned__(32)));
+static TYPE NAME (rsqrt_output) [RSQRT_SIZE] __attribute__((__aligned__(32)));
+
+
+/*
+ * Crack a floating point number into sign bit, exponent, and mantissa.
+ */
+
+static void
+NAME (crack) (TYPE number, unsigned int *p_sign, unsigned *p_exponent, UNS_TYPE *p_mantissa)
+{
+ NAME (union) u;
+ UNS_TYPE bits;
+
+ u.x = number;
+ bits = u.i;
+
+ *p_sign = (unsigned int)((bits >> (EXP_SIZE + MAN_SIZE)) & 0x1);
+ *p_exponent = (unsigned int)((bits >> MAN_SIZE) & ((((UNS_TYPE)1) << EXP_SIZE) - 1));
+ *p_mantissa = bits & ((((UNS_TYPE)1) << MAN_SIZE) - 1);
+ return;
+}
+
+
+/*
+ * Prevent optimizer from eliminating + 0.0 to remove -0.0.
+ */
+
+volatile TYPE NAME (math_diff_0) = ((TYPE) 0.0);
+
+/*
+ * Return negative if two numbers are significanly different or return the
+ * number of bits that are different in the mantissa.
+ */
+
+static int
+NAME (math_diff) (TYPE a, TYPE b, int bits)
+{
+ TYPE zero = NAME (math_diff_0);
+ unsigned int sign_a, sign_b;
+ unsigned int exponent_a, exponent_b;
+ UNS_TYPE mantissa_a, mantissa_b, diff;
+ int i;
+
+ /* eliminate signed zero. */
+ a += zero;
+ b += zero;
+
+ /* special case Nan. */
+ if (__builtin_isnan (a))
+ return (__builtin_isnan (b) ? 0 : -1);
+
+ if (a == b)
+ return 0;
+
+ /* special case infinity. */
+ if (__builtin_isinf (a))
+ return (__builtin_isinf (b) ? 0 : -1);
+
+ /* punt on denormal numbers. */
+ if (!__builtin_isnormal (a) || !__builtin_isnormal (b))
+ return -1;
+
+ NAME (crack) (a, &sign_a, &exponent_a, &mantissa_a);
+ NAME (crack) (b, &sign_b, &exponent_b, &mantissa_b);
+
+ /* If the sign is different, there is no hope. */
+ if (sign_a != sign_b)
+ return -1;
+
+ /* If the exponent is off by 1, see if the values straddle the power of two,
+ and adjust things to do the mantassa check if we can. */
+ if ((exponent_a == (exponent_b+1)) || (exponent_a == (exponent_b-1)))
+ {
+ TYPE big = FMAX (a, b);
+ TYPE small = FMIN (a, b);
+ TYPE diff = FABS (a - b);
+ unsigned int sign_big, sign_small, sign_test;
+ unsigned int exponent_big, exponent_small, exponent_test;
+ UNS_TYPE mantissa_big, mantissa_small, mantissa_test;
+
+ NAME (crack) (big, &sign_big, &exponent_big, &mantissa_big);
+ NAME (crack) (small, &sign_small, &exponent_small, &mantissa_small);
+
+ NAME (crack) (small - diff, &sign_test, &exponent_test, &mantissa_test);
+ if ((sign_test == sign_small) && (exponent_test == exponent_small))
+ {
+ mantissa_a = mantissa_small;
+ mantissa_b = mantissa_test;
+ }
+
+ else
+ {
+ NAME (crack) (big + diff, &sign_test, &exponent_test, &mantissa_test);
+ if ((sign_test == sign_big) && (exponent_test == exponent_big))
+ {
+ mantissa_a = mantissa_big;
+ mantissa_b = mantissa_test;
+ }
+
+ else
+ return -1;
+ }
+ }
+
+ else if (exponent_a != exponent_b)
+ return -1;
+
+ diff = UNS_ABS (mantissa_a - mantissa_b);
+ for (i = MAN_SIZE; i > 0; i--)
+ {
+ if ((diff & ((UNS_TYPE)1) << (i-1)) != 0)
+ return i;
+ }
+
+ return -1;
+}
+
+
+/*
+ * Turn off inlining to make code inspection easier.
+ */
+
+static void NAME (asm_div) (void) __attribute__((__noinline__));
+static void NAME (vector_div) (void) __attribute__((__noinline__));
+static void NAME (scalar_div) (void) __attribute__((__noinline__));
+static void NAME (asm_rsqrt) (void) __attribute__((__noinline__));
+static void NAME (vector_rsqrt) (void) __attribute__((__noinline__));
+static void NAME (scalar_rsqrt) (void) __attribute__((__noinline__));
+static void NAME (check_div) (const char *) __attribute__((__noinline__));
+static void NAME (check_rsqrt) (const char *) __attribute__((__noinline__));
+static void NAME (run) (void) __attribute__((__noinline__));
+
+
+/*
+ * Division function that might be vectorized.
+ */
+
+static void
+NAME (vector_div) (void)
+{
+ size_t i;
+
+ for (i = 0; i < DIV_SIZE; i++)
+ NAME (div_output)[i] = ((TYPE) 1.0) / NAME (div_input)[i].x;
+}
+
+/*
+ * Division function that is not vectorized.
+ */
+
+static void
+NAME (scalar_div) (void)
+{
+ size_t i;
+
+ for (i = 0; i < DIV_SIZE; i++)
+ {
+ TYPE x = ((TYPE) 1.0) / NAME (div_input)[i].x;
+ TYPE y;
+ __asm__ ("" : "=d" (y) : "0" (x));
+ NAME (div_output)[i] = y;
+ }
+}
+
+/*
+ * Generate the division instruction via asm.
+ */
+
+static void
+NAME (asm_div) (void)
+{
+ size_t i;
+
+ for (i = 0; i < DIV_SIZE; i++)
+ {
+ TYPE x;
+ __asm__ (ASMDIV " %0,%1,%2"
+ : "=d" (x)
+ : "d" ((TYPE) 1.0), "d" (NAME (div_input)[i].x));
+ NAME (div_expected)[i] = x;
+ }
+}
+
+/*
+ * Reciprocal square root function that might be vectorized.
+ */
+
+static void
+NAME (vector_rsqrt) (void)
+{
+ size_t i;
+
+ for (i = 0; i < RSQRT_SIZE; i++)
+ NAME (rsqrt_output)[i] = ((TYPE) 1.0) / SQRT (NAME (rsqrt_input)[i].x);
+}
+
+/*
+ * Reciprocal square root function that is not vectorized.
+ */
+
+static void
+NAME (scalar_rsqrt) (void)
+{
+ size_t i;
+
+ for (i = 0; i < RSQRT_SIZE; i++)
+ {
+ TYPE x = ((TYPE) 1.0) / SQRT (NAME (rsqrt_input)[i].x);
+ TYPE y;
+ __asm__ ("" : "=d" (y) : "0" (x));
+ NAME (rsqrt_output)[i] = y;
+ }
+}
+
+/*
+ * Generate the 1/sqrt instructions via asm.
+ */
+
+static void
+NAME (asm_rsqrt) (void)
+{
+ size_t i;
+
+ for (i = 0; i < RSQRT_SIZE; i++)
+ {
+ TYPE x;
+ TYPE y;
+ __asm__ (ASMSQRT " %0,%1" : "=d" (x) : "d" (NAME (rsqrt_input)[i].x));
+ __asm__ (ASMDIV " %0,%1,%2" : "=d" (y) : "d" ((TYPE) 1.0), "d" (x));
+ NAME (rsqrt_expected)[i] = y;
+ }
+}
+
+
+/*
+ * Functions to abort or report errors.
+ */
+
+static int NAME (error_count) = 0;
+
+#ifdef VERBOSE
+static int NAME (max_bits_div) = 0;
+static int NAME (max_bits_rsqrt) = 0;
+#endif
+
+
+/*
+ * Compare the expected value with the value we got.
+ */
+
+static void
+NAME (check_div) (const char *test)
+{
+ size_t i;
+ int b;
+
+ for (i = 0; i < DIV_SIZE; i++)
+ {
+ TYPE exp = NAME (div_expected)[i];
+ TYPE out = NAME (div_output)[i];
+ b = NAME (math_diff) (exp, out, BDIV);
+
+#ifdef VERBOSE
+ if (b != 0)
+ {
+ NAME (union) u_in = NAME (div_input)[i];
+ NAME (union) u_exp;
+ NAME (union) u_out;
+ char explanation[64];
+ const char *p_exp;
+
+ if (b < 0)
+ p_exp = "failed";
+ else
+ {
+ p_exp = explanation;
+ sprintf (explanation, "%d bit error%s", b, (b > BDIV) ? ", failed" : "");
+ }
+
+ u_exp.x = exp;
+ u_out.x = out;
+ printf ("%s %s %s for 1.0 / %g [0x%llx], expected %g [0x%llx], got %g [0x%llx]\n",
+ TNAME (TYPE), test, p_exp,
+ (double) u_in.x, (unsigned long long) u_in.i,
+ (double) exp, (unsigned long long) u_exp.i,
+ (double) out, (unsigned long long) u_out.i);
+ }
+#endif
+
+ if (b < 0 || b > BDIV)
+ NAME (error_count)++;
+
+#ifdef VERBOSE
+ if (b > NAME (max_bits_div))
+ NAME (max_bits_div) = b;
+#endif
+ }
+}
+
+static void
+NAME (check_rsqrt) (const char *test)
+{
+ size_t i;
+ int b;
+
+ for (i = 0; i < RSQRT_SIZE; i++)
+ {
+ TYPE exp = NAME (rsqrt_expected)[i];
+ TYPE out = NAME (rsqrt_output)[i];
+ b = NAME (math_diff) (exp, out, BRSQRT);
+
+#ifdef VERBOSE
+ if (b != 0)
+ {
+ NAME (union) u_in = NAME (rsqrt_input)[i];
+ NAME (union) u_exp;
+ NAME (union) u_out;
+ char explanation[64];
+ const char *p_exp;
+
+ if (b < 0)
+ p_exp = "failed";
+ else
+ {
+ p_exp = explanation;
+ sprintf (explanation, "%d bit error%s", b, (b > BDIV) ? ", failed" : "");
+ }
+
+ u_exp.x = exp;
+ u_out.x = out;
+ printf ("%s %s %s for 1 / sqrt (%g) [0x%llx], expected %g [0x%llx], got %g [0x%llx]\n",
+ TNAME (TYPE), test, p_exp,
+ (double) u_in.x, (unsigned long long) u_in.i,
+ (double) exp, (unsigned long long) u_exp.i,
+ (double) out, (unsigned long long) u_out.i);
+ }
+#endif
+
+ if (b < 0 || b > BRSQRT)
+ NAME (error_count)++;
+
+#ifdef VERBOSE
+ if (b > NAME (max_bits_rsqrt))
+ NAME (max_bits_rsqrt) = b;
+#endif
+ }
+}
+
+
+/*
+ * Now do everything.
+ */
+
+static void
+NAME (run) (void)
+{
+#ifdef VERBOSE
+ printf ("start run_%s, divide size = %ld, rsqrt size = %ld, %d bit%s for a/b, %d bit%s for 1/sqrt(a)\n",
+ TNAME (TYPE),
+ (long)DIV_SIZE,
+ (long)RSQRT_SIZE,
+ BDIV, (BDIV == 1) ? "" : "s",
+ BRSQRT, (BRSQRT == 1) ? "" : "s");
+#endif
+
+ NAME (asm_div) ();
+
+ NAME (scalar_div) ();
+ NAME (check_div) ("scalar");
+
+ NAME (vector_div) ();
+ NAME (check_div) ("vector");
+
+ NAME (asm_rsqrt) ();
+
+ NAME (scalar_rsqrt) ();
+ NAME (check_rsqrt) ("scalar");
+
+ NAME (vector_rsqrt) ();
+ NAME (check_rsqrt) ("vector");
+
+#ifdef VERBOSE
+ printf ("end run_%s, errors = %d, max div bits = %d, max rsqrt bits = %d\n",
+ TNAME (TYPE),
+ NAME (error_count),
+ NAME (max_bits_div),
+ NAME (max_bits_rsqrt));
+#endif
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c
new file mode 100644
index 00000000000..35f8b53cac1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mabi=sysv" } */
+
+__attribute__ ((ms_abi))
+int foo (void)
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "%rsp" } } */
+
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c
new file mode 100644
index 00000000000..2a54bc89cfc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mabi=sysv" } */
+
+extern int glb1, gbl2, gbl3;
+
+__attribute__ ((ms_abi))
+int foo (void)
+{
+ int r = 1;
+ int i, j, k;
+ for (i = 0; i < glb1; i++)
+ {
+ r *= (i + 1);
+ for (j = gbl2; j > 0; --j)
+ {
+ for (k = 0; k < gbl3; k++)
+ r += (i + k * j);
+ }
+ }
+
+ return r;
+}
+
+/* { dg-final { scan-assembler-not "%rsp" } } */
+
diff --git a/gcc/testsuite/gfortran.dg/abstract_type_8.f03 b/gcc/testsuite/gfortran.dg/abstract_type_8.f03
new file mode 100644
index 00000000000..c924abac9af
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/abstract_type_8.f03
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! PR 44616: [OOP] ICE if CLASS(foo) is used before its definition
+!
+! Contributed by bd satish <bdsatish@gmail.com>
+
+module factory_pattern
+implicit none
+
+type First_Factory
+ character(len=20) :: factory_type
+ class(Connection), pointer :: connection_type
+ contains
+end type First_Factory
+
+type, abstract :: Connection
+ contains
+ procedure(generic_desc), deferred :: description
+end type Connection
+
+abstract interface
+ subroutine generic_desc(self)
+ import ! Required, cf. PR 44614
+ class(Connection) :: self
+ end subroutine generic_desc
+end interface
+end module factory_pattern
+
+! { dg-final { cleanup-modules "factory_pattern" } }
diff --git a/gcc/testsuite/gfortran.dg/actual_rank_check_1.f90 b/gcc/testsuite/gfortran.dg/actual_rank_check_1.f90
new file mode 100644
index 00000000000..7167de4270c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/actual_rank_check_1.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! Test the fix for PR40158, where the errro message was not clear about scalars.
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+!
+ implicit none
+ integer :: i(4,5),j
+ i = 0
+ call sub1(i)
+ call sub1(j) ! { dg-error "rank-1 and scalar" }
+ call sub2(i) ! { dg-error "scalar and rank-2" }
+ call sub2(j)
+ print '(5i0)', i
+contains
+ subroutine sub1(i1)
+ integer :: i1(*)
+ i1(1) = 2
+ end subroutine sub1
+ subroutine sub2(i2)
+ integer :: i2
+ i2 = 2
+ end subroutine sub2
+end
diff --git a/gcc/testsuite/gfortran.dg/aliasing_array_result_1.f90 b/gcc/testsuite/gfortran.dg/aliasing_array_result_1.f90
new file mode 100644
index 00000000000..d8899d2ecf8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/aliasing_array_result_1.f90
@@ -0,0 +1,164 @@
+! { dg-do run }
+! Tests the fic for PR44582, where gfortran was found to
+! produce an incorrect result when the result of a function
+! was aliased by a host or use associated variable, to which
+! the function is assigned. In these cases a temporary is
+! required in the function assignments. The check has to be
+! rather restrictive. Whilst the cases marked below might
+! not need temporaries, the TODOs are going to be tough.
+!
+! Reported by Yin Ma <yin@absoft.com> and
+! elaborated by Tobias Burnus <burnus@gcc.gnu.org>
+!
+module foo
+ INTEGER, PARAMETER :: ONE = 1
+ INTEGER, PARAMETER :: TEN = 10
+ INTEGER, PARAMETER :: FIVE = TEN/2
+ INTEGER, PARAMETER :: TWO = 2
+ integer :: foo_a(ONE)
+ integer :: check(ONE) = TEN
+ LOGICAL :: abort_flag = .false.
+contains
+ function foo_f()
+ integer :: foo_f(ONE)
+ foo_f = -FIVE
+ foo_f = foo_a - foo_f
+ end function foo_f
+ subroutine bar
+ foo_a = FIVE
+! This aliases 'foo_a' by host association.
+ foo_a = foo_f ()
+ if (any (foo_a .ne. check)) call myabort (0)
+ end subroutine bar
+ subroutine myabort(fl)
+ integer :: fl
+ print *, fl
+ abort_flag = .true.
+ end subroutine myabort
+end module foo
+
+function h_ext()
+ use foo
+ integer :: h_ext(ONE)
+ h_ext = -FIVE
+ h_ext = FIVE - h_ext
+end function h_ext
+
+function i_ext() result (h)
+ use foo
+ integer :: h(ONE)
+ h = -FIVE
+ h = FIVE - h
+end function i_ext
+
+subroutine tobias
+ use foo
+ integer :: a(ONE)
+ a = FIVE
+ call sub1(a)
+ if (any (a .ne. check)) call myabort (1)
+contains
+ subroutine sub1(x)
+ integer :: x(ONE)
+! 'x' is aliased by host association in 'f'.
+ x = f()
+ end subroutine sub1
+ function f()
+ integer :: f(ONE)
+ f = ONE
+ f = a + FIVE
+ end function f
+end subroutine tobias
+
+program test
+ use foo
+ implicit none
+ common /foo_bar/ c
+ integer :: a(ONE), b(ONE), c(ONE), d(ONE)
+ interface
+ function h_ext()
+ use foo
+ integer :: h_ext(ONE)
+ end function h_ext
+ end interface
+ interface
+ function i_ext() result (h)
+ use foo
+ integer :: h(ONE)
+ end function i_ext
+ end interface
+
+ a = FIVE
+! This aliases 'a' by host association
+ a = f()
+ if (any (a .ne. check)) call myabort (2)
+ a = FIVE
+ if (any (f() .ne. check)) call myabort (3)
+ call bar
+ foo_a = FIVE
+! This aliases 'foo_a' by host association.
+ foo_a = g ()
+ if (any (foo_a .ne. check)) call myabort (4)
+ a = FIVE
+ a = h() ! TODO: Needs no temporary
+ if (any (a .ne. check)) call myabort (5)
+ a = FIVE
+ a = i() ! TODO: Needs no temporary
+ if (any (a .ne. check)) call myabort (6)
+ a = FIVE
+ a = h_ext() ! Needs no temporary - was OK
+ if (any (a .ne. check)) call myabort (15)
+ a = FIVE
+ a = i_ext() ! Needs no temporary - was OK
+ if (any (a .ne. check)) call myabort (16)
+ c = FIVE
+! This aliases 'c' through the common block.
+ c = j()
+ if (any (c .ne. check)) call myabort (7)
+ call aaa
+ call tobias
+ if (abort_flag) call abort
+contains
+ function f()
+ integer :: f(ONE)
+ f = -FIVE
+ f = a - f
+ end function f
+ function g()
+ integer :: g(ONE)
+ g = -FIVE
+ g = foo_a - g
+ end function g
+ function h()
+ integer :: h(ONE)
+ h = -FIVE
+ h = FIVE - h
+ end function h
+ function i() result (h)
+ integer :: h(ONE)
+ h = -FIVE
+ h = FIVE - h
+ end function i
+ function j()
+ common /foo_bar/ cc
+ integer :: j(ONE), cc(ONE)
+ j = -FIVE
+ j = cc - j
+ end function j
+ subroutine aaa()
+ d = TEN - TWO
+! This aliases 'd' through 'get_d'.
+ d = bbb()
+ if (any (d .ne. check)) call myabort (8)
+ end subroutine aaa
+ function bbb()
+ integer :: bbb(ONE)
+ bbb = TWO
+ bbb = bbb + get_d()
+ end function bbb
+ function get_d()
+ integer :: get_d(ONE)
+ get_d = d
+ end function get_d
+end program test
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_class_1.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_class_1.f90
new file mode 100644
index 00000000000..c783f49ff77
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_class_1.f90
@@ -0,0 +1,33 @@
+! { dg-do run }
+! Test the fix for PR43895, in which the dummy 'a' was not
+! dereferenced for the deallocation of component 'a', as required
+! for INTENT(OUT).
+!
+! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
+!
+module d_mat_mod
+ type :: base_sparse_mat
+ end type base_sparse_mat
+
+ type, extends(base_sparse_mat) :: d_base_sparse_mat
+ integer :: i
+ end type d_base_sparse_mat
+
+ type :: d_sparse_mat
+ class(d_base_sparse_mat), allocatable :: a
+ end type d_sparse_mat
+end module d_mat_mod
+
+ use d_mat_mod
+ type(d_sparse_mat) :: b
+ allocate (b%a)
+ b%a%i = 42
+ call bug14 (b)
+ if (allocated (b%a)) call abort
+contains
+ subroutine bug14(a)
+ implicit none
+ type(d_sparse_mat), intent(out) :: a
+ end subroutine bug14
+end
+! { dg-final { cleanup-modules "d_mat_mod " } }
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_10.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_10.f90
new file mode 100644
index 00000000000..5bccefaaf15
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_10.f90
@@ -0,0 +1,46 @@
+! { dg-do run }
+!
+! PR 43388: [F2008][OOP] ALLOCATE with MOLD=
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+type :: t1
+ integer :: i
+end type
+
+type,extends(t1) :: t2
+ integer :: j = 4
+end type
+
+class(t1),allocatable :: x,y
+type(t2) :: z
+
+
+!!! first example (works)
+
+z%j = 5
+allocate(x,MOLD=z)
+
+select type (x)
+type is (t2)
+ print *,x%j
+ if (x%j/=4) call abort
+class default
+ call abort()
+end select
+
+
+!!! second example (fails)
+!!! FIXME: uncomment once implemented (cf. PR 44541)
+
+! allocate(y,MOLD=x)
+!
+! select type (y)
+! type is (t2)
+! print *,y%j
+! if (y%j/=4) call abort
+! class default
+! call abort()
+! end select
+
+end
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_11.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_11.f90
new file mode 100644
index 00000000000..c8c7ac633cd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_11.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+!
+! PR fortran/44556
+!
+! Contributed by Jonathan Hogg and Steve Kargl.
+!
+program oh_my
+ implicit none
+ type a
+ integer, allocatable :: b(:), d(:)
+ character(len=80) :: err
+ character(len=80), allocatable :: str(:)
+ integer :: src
+ end type a
+
+ integer j
+ type(a) :: c
+ c%err = 'ok'
+ allocate(c%d(1))
+ allocate(c%b(2), errmsg=c%err, stat=c%d(1)) ! OK
+ deallocate(c%b, errmsg=c%err, stat=c%d(1)) ! OK
+ allocate(c%b(2), errmsg=c%err, stat=c%b(1)) ! { dg-error "the same ALLOCATE statement" }
+ deallocate(c%b, errmsg=c%err, stat=c%b(1)) ! { dg-error "the same DEALLOCATE statement" }
+ allocate(c%str(2), errmsg=c%str(1), stat=j) ! { dg-error "the same ALLOCATE statement" }
+ deallocate(c%str, errmsg=c%str(1), stat=j) ! { dg-error "the same DEALLOCATE statement" }
+end program oh_my
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_7.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_7.f90
new file mode 100644
index 00000000000..e77f6b7c638
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_7.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR 44207: ICE with ALLOCATABLE components and SOURCE
+!
+! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
+
+program ice_prog
+
+type::ice_type
+ integer,dimension(:),allocatable::list
+end type ice_type
+
+type(ice_type)::this
+integer::dim=10,i
+
+allocate(this%list(dim),source=[(i,i=1,dim)])
+
+end program ice_prog
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_8.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_8.f90
new file mode 100644
index 00000000000..39aa3638b46
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_8.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR 43388: [F2008][OOP] ALLOCATE with MOLD=
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+type :: t
+end type
+
+class(t),allocatable :: x
+type(t) :: z
+
+allocate(x,MOLD=z) ! { dg-error "MOLD tag at" }
+
+end
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_9.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_9.f90
new file mode 100644
index 00000000000..e51a7ec868a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_9.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+!
+! PR 43388: [F2008][OOP] ALLOCATE with MOLD=
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+type :: t
+end type
+
+type :: u
+end type
+
+class(t),allocatable :: x
+type(t) :: z1,z2
+type(u) :: z3
+
+allocate(x,MOLD=z1,MOLD=z2) ! { dg-error "Redundant MOLD tag" }
+allocate(x,SOURCE=z1,MOLD=z2) ! { dg-error "conflicts with SOURCE tag" }
+allocate(t::x,MOLD=z1) ! { dg-error "conflicts with the typespec" }
+
+allocate(x,MOLD=z3) ! { dg-error "is type incompatible" }
+
+end
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_23.f b/gcc/testsuite/gfortran.dg/array_constructor_23.f
index ac57efc2440..fa0a28a1f17 100644
--- a/gcc/testsuite/gfortran.dg/array_constructor_23.f
+++ b/gcc/testsuite/gfortran.dg/array_constructor_23.f
@@ -20,7 +20,7 @@
DDA1 = ATAN2 ((/(REAL(J1,KV),J1=1,10)/),
$ REAL((/(J1,J1=nf10,nf1,mf1)/), KV)) !fails
DDA2 = ATAN2 (DDA, DDA(10:1:-1))
- if (any (DDA1 .ne. DDA2)) call abort ()
+ if (any (DDA1 - DDA2 .gt. epsilon(dval))) call abort ()
END
subroutine FA6077 (nf10,nf1,mf1, ida)
@@ -42,7 +42,7 @@
QDA1 = MOD ( 1.1_k*( QDA(1) -5.0_k), P=( QDA -2.5_k))
DO J1 = 1,10
QVAL = MOD(1.1_k*(QDA(1)-5.0_k),P=(QDA(J1)-2.5_k))
- if (qval .ne. qda1(j1)) call abort ()
+ if (qval - qda1(j1) .gt. epsilon(qval)) call abort ()
ENDDO
END
diff --git a/gcc/testsuite/gfortran.dg/array_memcpy_3.f90 b/gcc/testsuite/gfortran.dg/array_memcpy_3.f90
index df6bd49ef26..78097308030 100644
--- a/gcc/testsuite/gfortran.dg/array_memcpy_3.f90
+++ b/gcc/testsuite/gfortran.dg/array_memcpy_3.f90
@@ -11,5 +11,5 @@ subroutine bar(x)
x = (/ 3, 1, 4, 1 /)
end subroutine
-! { dg-final { scan-tree-dump-times "memcpy|ref-all" 2 "original" } }
+! { dg-final { scan-tree-dump-times "memcpy|(ref-all.*ref-all)" 2 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/array_memcpy_4.f90 b/gcc/testsuite/gfortran.dg/array_memcpy_4.f90
index 0f8b5cb15b0..9f2279d881c 100644
--- a/gcc/testsuite/gfortran.dg/array_memcpy_4.f90
+++ b/gcc/testsuite/gfortran.dg/array_memcpy_4.f90
@@ -9,5 +9,5 @@
d = s
end
-! { dg-final { scan-tree-dump-times "d = " 1 "original" } }
+! { dg-final { scan-tree-dump-times "MEM.*d\\\] = MEM" 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/associate_1.f03 b/gcc/testsuite/gfortran.dg/associate_1.f03
new file mode 100644
index 00000000000..90579c99ce3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associate_1.f03
@@ -0,0 +1,49 @@
+! { dg-do run }
+! { dg-options "-std=f2003 -fall-intrinsics" }
+
+! PR fortran/38936
+! Check the basic semantics of the ASSOCIATE construct.
+
+PROGRAM main
+ IMPLICIT NONE
+ REAL :: a, b, c
+ INTEGER, ALLOCATABLE :: arr(:)
+
+ a = -2.0
+ b = 3.0
+ c = 4.0
+
+ ! Simple association to expressions.
+ ASSOCIATE (r => SQRT (a**2 + b**2 + c**2), t => a + b)
+ PRINT *, t, a, b
+ IF (ABS (r - SQRT (4.0 + 9.0 + 16.0)) > 1.0e-3) CALL abort ()
+ IF (ABS (t - a - b) > 1.0e-3) CALL abort ()
+ END ASSOCIATE
+
+ ! TODO: Test association to variables when that is supported.
+ ! TODO: Test association to derived types.
+
+ ! Test association to arrays.
+ ! TODO: Enable when working.
+ !ALLOCATE (arr(3))
+ !arr = (/ 1, 2, 3 /)
+ !ASSOCIATE (doubled => 2 * arr)
+ ! IF (doubled(1) /= 2 .OR. doubled(2) /= 4 .OR. doubled(3) /= 6) &
+ ! CALL abort ()
+ !END ASSOCIATE
+
+ ! Named and nested associate.
+ myname: ASSOCIATE (x => a - b * c)
+ ASSOCIATE (y => 2.0 * x)
+ IF (ABS (y - 2.0 * (a - b * c)) > 1.0e-3) CALL abort ()
+ END ASSOCIATE
+ END ASSOCIATE myname ! Matching end-label.
+
+ ! Correct behaviour when shadowing already existing names.
+ ASSOCIATE (a => 1 * b, b => 1 * a, x => 1, y => 2)
+ IF (ABS (a - 3.0) > 1.0e-3 .OR. ABS (b + 2.0) > 1.0e-3) CALL abort ()
+ ASSOCIATE (x => 1 * y, y => 1 * x)
+ IF (x /= 2 .OR. y /= 1) CALL abort ()
+ END ASSOCIATE
+ END ASSOCIATE
+END PROGRAM main
diff --git a/gcc/testsuite/gfortran.dg/associate_2.f95 b/gcc/testsuite/gfortran.dg/associate_2.f95
new file mode 100644
index 00000000000..a41398d7850
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associate_2.f95
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+
+! PR fortran/38936
+! Test that F95 rejects ASSOCIATE.
+
+PROGRAM main
+ IMPLICIT NONE
+
+ ASSOCIATE (a => 5) ! { dg-error "Fortran 2003" }
+ END ASSOCIATE
+END PROGRAM main
diff --git a/gcc/testsuite/gfortran.dg/associate_3.f03 b/gcc/testsuite/gfortran.dg/associate_3.f03
new file mode 100644
index 00000000000..c53bd559fb8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associate_3.f03
@@ -0,0 +1,41 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+
+! PR fortran/38936
+! Check for errors with ASSOCIATE.
+
+PROGRAM main
+ IMPLICIT NONE
+
+ ASSOCIATE ! { dg-error "Expected association list" }
+
+ ASSOCIATE () ! { dg-error "Expected association" }
+
+ ASSOCIATE (a => 1) 5 ! { dg-error "Junk after ASSOCIATE" }
+
+ ASSOCIATE (x =>) ! { dg-error "Expected association" }
+
+ ASSOCIATE (=> 5) ! { dg-error "Expected association" }
+
+ ASSOCIATE (x => 5, ) ! { dg-error "Expected association" }
+
+ myname: ASSOCIATE (a => 1)
+ END ASSOCIATE ! { dg-error "Expected block name of 'myname'" }
+
+ ASSOCIATE (b => 2)
+ END ASSOCIATE myname ! { dg-error "Syntax error in END ASSOCIATE" }
+
+ myname2: ASSOCIATE (c => 3)
+ END ASSOCIATE myname3 ! { dg-error "Expected label 'myname2'" }
+
+ ASSOCIATE (a => 1, b => 2, a => 3) ! { dg-error "Duplicate name 'a'" }
+
+ ASSOCIATE (a => 5)
+ a = 4 ! { dg-error "variable definition context" }
+ ENd ASSOCIATE
+
+ ASSOCIATE (a => 5)
+ INTEGER :: b ! { dg-error "Unexpected data declaration statement" }
+ END ASSOCIATE
+END PROGRAM main ! { dg-error "Expecting END ASSOCIATE" }
+! { dg-excess-errors "Unexpected end of file" }
diff --git a/gcc/testsuite/gfortran.dg/associate_4.f08 b/gcc/testsuite/gfortran.dg/associate_4.f08
new file mode 100644
index 00000000000..c336af2ab13
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associate_4.f08
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f2008 -fcoarray=single" }
+
+! PR fortran/38936
+! Check for error with coindexed target.
+
+PROGRAM main
+ IMPLICIT NONE
+ INTEGER :: a[*]
+
+ ASSOCIATE (x => a[1]) ! { dg-error "must not be coindexed" }
+END PROGRAM main
diff --git a/gcc/testsuite/gfortran.dg/associated_target_4.f90 b/gcc/testsuite/gfortran.dg/associated_target_4.f90
new file mode 100644
index 00000000000..24f331785e8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associated_target_4.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+!
+! PR 44696: [OOP] ASSOCIATED fails on polymorphic variables
+!
+! Original test case by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+program rte1
+ implicit none
+ type::node_type
+ class(node_type),pointer::parent,child
+ integer::id
+ end type node_type
+ class(node_type),pointer::root
+ allocate(root)
+ allocate(root%child)
+ root%child%parent=>root
+ root%id=1
+ root%child%id=2
+ print *,root%child%id," is child of ",root%id,":"
+ print *,root%child%parent%id,root%id
+ if (.not. associated(root%child%parent,root)) call abort()
+end program rte1
diff --git a/gcc/testsuite/gfortran.dg/asynchronous_3.f03 b/gcc/testsuite/gfortran.dg/asynchronous_3.f03
new file mode 100644
index 00000000000..7b83374a6e5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/asynchronous_3.f03
@@ -0,0 +1,15 @@
+! { dg-do "compile" }
+!
+! PR fortran/44457 - no array-subscript actual argument
+! for an asynchronous dummy
+!
+
+ integer :: a(10), sect(3)
+ sect = [1,2,3]
+ call f(a(sect)) ! { dg-error "incompatible" }
+ call f(a(::2))
+contains
+ subroutine f(x)
+ integer, asynchronous :: x(:)
+ end subroutine f
+end
diff --git a/gcc/testsuite/gfortran.dg/atan2_1.f90 b/gcc/testsuite/gfortran.dg/atan2_1.f90
index 1f998a1ccde..65da63cd2d3 100644
--- a/gcc/testsuite/gfortran.dg/atan2_1.f90
+++ b/gcc/testsuite/gfortran.dg/atan2_1.f90
@@ -1,4 +1,5 @@
! { dg-do run }
+! { dg-options "-ffloat-store" }
!
! PR fortran/33197
!
diff --git a/gcc/testsuite/gfortran.dg/btest_1.f90 b/gcc/testsuite/gfortran.dg/btest_1.f90
new file mode 100644
index 00000000000..8a72c314cd5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/btest_1.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+program a
+ integer :: i = 42
+ logical l
+ l = btest(i, -1) ! { dg-error "must be nonnegative" }
+ l = btest(i, 65) ! { dg-error "must be less than" }
+end program a
diff --git a/gcc/testsuite/gfortran.dg/class_23.f03 b/gcc/testsuite/gfortran.dg/class_23.f03
new file mode 100644
index 00000000000..e1e35176294
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_23.f03
@@ -0,0 +1,24 @@
+! { dg-do compile }
+!
+! PR 42051: [OOP] ICE on array-valued function with CLASS formal argument
+!
+! Original test case by Damian Rouson <damian@rouson.net>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+ type grid
+ end type
+
+contains
+
+ function return_x(this) result(this_x)
+ class(grid) :: this
+ real ,dimension(1) :: this_x
+ end function
+
+ subroutine output()
+ type(grid) :: mesh
+ real ,dimension(1) :: x
+ x = return_x(mesh)
+ end subroutine
+
+end
diff --git a/gcc/testsuite/gfortran.dg/class_allocate_2.f03 b/gcc/testsuite/gfortran.dg/class_allocate_2.f03
index 754faa9a9f4..cec05f17a1f 100644
--- a/gcc/testsuite/gfortran.dg/class_allocate_2.f03
+++ b/gcc/testsuite/gfortran.dg/class_allocate_2.f03
@@ -18,6 +18,6 @@ end type t2
class(t), allocatable :: a,c,d
type(t2) :: b
-allocate(a) ! { dg-error "requires a type-spec or SOURCE" }
-allocate(b%t) ! { dg-error "requires a type-spec or SOURCE" }
+allocate(a) ! { dg-error "requires a type-spec or source-expr" }
+allocate(b%t) ! { dg-error "requires a type-spec or source-expr" }
end
diff --git a/gcc/testsuite/gfortran.dg/contiguous_1.f90 b/gcc/testsuite/gfortran.dg/contiguous_1.f90
new file mode 100644
index 00000000000..e75c08d8ef4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/contiguous_1.f90
@@ -0,0 +1,177 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! PR fortran/40632
+!
+! CONTIGUOUS compile-time tests
+!
+
+! C448: Must be an array with POINTER attribute
+type t1
+ integer, contiguous :: ca(5) ! { dg-error "Component .ca. at .1. has the CONTIGUOUS" }
+end type t1
+type t2
+ integer, contiguous, allocatable :: cb(:) ! { dg-error "Component .cb. at .1. has the CONTIGUOUS" }
+end type t2
+type t3
+ integer, contiguous, pointer :: cc(:) ! OK
+end type t3
+type t4
+ integer, pointer, contiguous :: cd ! { dg-error "Component .cd. at .1. has the CONTIGUOUS" }
+end type t4
+end
+
+! C530: Must be an array and (a) a POINTER or (b) assumed shape.
+subroutine test(x, y)
+ integer, pointer :: x(:)
+ integer, intent(in) :: y(:)
+ contiguous :: x, y
+
+ integer, contiguous :: a(5) ! { dg-error ".a. at .1. has the CONTIGUOUS attribute" }
+ integer, contiguous, allocatable :: b(:) ! { dg-error ".b. at .1. has the CONTIGUOUS attribute" }
+ integer, contiguous, pointer :: c(:) ! OK
+ integer, pointer, contiguous :: d ! { dg-error ".d. at .1. has the CONTIGUOUS attribute" }
+end
+
+! Pointer assignment check:
+! If the pointer object has the CONTIGUOUS attribute, the pointer target shall be contiguous.
+! Note: This is not compile-time checkable; but F2008, 5.3.7 except in a very few cases.
+subroutine ptr_assign()
+ integer, pointer, contiguous :: ptr1(:)
+ integer, target :: tgt(5)
+ ptr1 => tgt
+end subroutine
+
+
+! C1239 (R1223) If an actual argument is a nonpointer array that has the ASYNCHRONOUS or VOLATILE
+! attribute but is not simply contiguous (6.5.4), and the corresponding dummy argument has either the
+! VOLATILE or ASYNCHRONOUS attribute, that dummy argument shall be an assumed-shape array
+! that does not have the CONTIGUOUS attribute.
+
+subroutine C1239
+ type t
+ integer :: e(4)
+ end type t
+ type(t), volatile :: f
+ integer, asynchronous :: a(4), b(4)
+ integer, volatile :: c(4), d(4)
+ call test (a,b,c) ! OK
+ call test (a,b(::2),c) ! { dg-error "array without CONTIGUOUS" }
+ call test (a(::2),b,c) ! { dg-error "array without CONTIGUOUS" }
+
+ call test (a,b,f%e) ! OK
+ call test (a,f%e,c) ! OK
+ call test (f%e,b,c) ! OK
+ call test (a,b,f%e(::2)) ! OK
+ call test (a,f%e(::2),c) ! { dg-error "array without CONTIGUOUS" }
+ call test (f%e(::2),b,c) ! { dg-error "array without CONTIGUOUS" }
+contains
+ subroutine test(u, v, w)
+ integer, asynchronous :: u(:), v(*)
+ integer, volatile :: w(:)
+ contiguous :: u
+ end subroutine test
+end subroutine C1239
+
+
+! C1240 (R1223) If an actual argument is an array pointer that has the ASYNCHRONOUS or VOLATILE
+! attribute but does not have the CONTIGUOUS attribute, and the corresponding dummy argument has
+! either the VOLATILE or ASYNCHRONOUS attribute, that dummy argument shall be an array pointer
+! or an assumed-shape array that does not have the CONTIGUOUS attribute.
+
+subroutine C1240
+ type t
+ integer,pointer :: e(:)
+ end type t
+ type(t), volatile :: f
+ integer, pointer, asynchronous :: a(:), b(:)
+ integer,pointer, volatile :: c(:), d(:)
+ call test (a,b,c) ! { dg-error "array without CONTIGUOUS" }
+ call test (a,b(::2),c) ! { dg-error "array without CONTIGUOUS" }
+ call test (a(::2),b,c) ! { dg-error "array without CONTIGUOUS" }
+
+ call test (a,b,f%e) ! { dg-error "array without CONTIGUOUS" }
+ call test (a,f%e,c) ! { dg-error "array without CONTIGUOUS" }
+ call test (f%e,b,c) ! { dg-error "array without CONTIGUOUS" }
+ call test (a,b,f%e(::2)) ! { dg-error "array without CONTIGUOUS" }
+ call test (a,f%e(::2),c) ! { dg-error "array without CONTIGUOUS" }
+ call test (f%e(::2),b,c) ! { dg-error "array without CONTIGUOUS" }
+
+ call test2(a,b)
+ call test3(a,b)
+ call test2(c,d)
+ call test3(c,d)
+ call test2(f%e,d)
+ call test3(c,f%e)
+contains
+ subroutine test(u, v, w)
+ integer, asynchronous :: u(:), v(*)
+ integer, volatile :: w(:)
+ contiguous :: u
+ end subroutine test
+ subroutine test2(x,y)
+ integer, asynchronous :: x(:)
+ integer, volatile :: y(:)
+ end subroutine test2
+ subroutine test3(x,y)
+ integer, pointer, asynchronous :: x(:)
+ integer, pointer, volatile :: y(:)
+ end subroutine test3
+end subroutine C1240
+
+
+
+! 12.5.2.7 Pointer dummy variables
+! C1241 The actual argument corresponding to a dummy pointer with the CONTIGUOUS attribute shall be
+! simply contiguous (6.5.4).
+
+subroutine C1241
+ integer, pointer, contiguous :: a(:)
+ integer, pointer :: b(:)
+ call test(a)
+ call test(b) ! { dg-error "must be simply contigous" }
+contains
+ subroutine test(x)
+ integer, pointer, contiguous :: x(:)
+ end subroutine test
+end subroutine C1241
+
+
+! 12.5.2.8 Coarray dummy variables
+! If the dummy argument is an array coarray that has the CONTIGUOUS attribute or is not of assumed shape,
+! the corresponding actual argument shall be simply contiguous
+
+subroutine sect12528(cob)
+ integer, save :: coa(6)[*]
+ integer :: cob(:)[*]
+
+ call test(coa)
+ call test2(coa)
+ call test3(coa)
+
+ call test(cob) ! { dg-error "must be simply contiguous" }
+ call test2(cob) ! { dg-error "must be simply contiguous" }
+ call test3(cob)
+contains
+ subroutine test(x)
+ integer, contiguous :: x(:)[*]
+ end subroutine test
+ subroutine test2(x)
+ integer :: x(*)[*]
+ end subroutine test2
+ subroutine test3(x)
+ integer :: x(:)[*]
+ end subroutine test3
+end subroutine sect12528
+
+
+
+subroutine test34
+ implicit none
+ integer, volatile,pointer :: a(:,:),i
+ call foo(a(2,2:3:2)) ! { dg-error "must be simply contigous" }
+contains
+ subroutine foo(x)
+ integer, pointer, contiguous, volatile :: x(:)
+ end subroutine
+end subroutine test34
diff --git a/gcc/testsuite/gfortran.dg/contiguous_2.f90 b/gcc/testsuite/gfortran.dg/contiguous_2.f90
new file mode 100644
index 00000000000..782d23dc7cd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/contiguous_2.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/40632
+!
+! CONTIGUOUS compile-time tests
+!
+
+integer, pointer, contiguous :: a(:) ! { dg-error "Fortran 2008:" }
+integer, pointer :: b(:)
+contiguous :: b ! { dg-error "Fortran 2008:" }
+end
diff --git a/gcc/testsuite/gfortran.dg/contiguous_3.f90 b/gcc/testsuite/gfortran.dg/contiguous_3.f90
new file mode 100644
index 00000000000..aac55367a45
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/contiguous_3.f90
@@ -0,0 +1,65 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! PR fortran/40632
+!
+! CONTIGUOUS compile-time tests: Check that contigous
+! works properly.
+
+subroutine test1(a,b)
+ integer, pointer, contiguous :: test1_a(:)
+ call foo(test1_a)
+ call foo(test1_a(::1))
+ call foo(test1_a(::2))
+contains
+ subroutine foo(b)
+ integer :: b(*)
+ end subroutine foo
+end subroutine test1
+
+! For the first two no pack is done; for the third one, an array descriptor
+! (cf. below test3) is created for packing.
+!
+! { dg-final { scan-tree-dump-times "_internal_pack.*test1_a" 0 "original" } }
+! { dg-final { scan-tree-dump-times "_internal_unpack.*test1_a" 0 "original" } }
+
+
+subroutine t2(a1,b1,c2,d2)
+ integer, pointer, contiguous :: a1(:), b1(:)
+ integer, pointer :: c2(:), d2(:)
+ a1 = b1
+ c2 = d2
+end subroutine t2
+
+! { dg-final { scan-tree-dump-times "= a1->dim.0..stride;" 0 "original" } }
+! { dg-final { scan-tree-dump-times "= b1->dim.0..stride;" 0 "original" } }
+! { dg-final { scan-tree-dump-times "= c2->dim.0..stride;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "= d2->dim.0..stride;" 1 "original" } }
+
+
+subroutine test3()
+ implicit none
+ integer :: test3_a(8),i
+ test3_a = [(i,i=1,8)]
+ call foo(test3_a(::1))
+ call foo(test3_a(::2))
+ call bar(test3_a(::1))
+ call bar(test3_a(::2))
+contains
+ subroutine foo(x)
+ integer, contiguous :: x(:)
+ print *, x
+ end subroutine
+ subroutine bar(x)
+ integer :: x(:)
+ print *, x
+ end subroutine bar
+end subroutine test3
+
+! Once for test1 (third call), once for test3 (second call)
+! { dg-final { scan-tree-dump-times "data = origptr" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_internal_pack .&parm" 2 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_internal_unpack .&parm" 2 "original" } }
+
+
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/data_namelist_conflict.f90 b/gcc/testsuite/gfortran.dg/data_namelist_conflict.f90
new file mode 100644
index 00000000000..b09f167fc7c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/data_namelist_conflict.f90
@@ -0,0 +1,26 @@
+! { dg-do run }
+! Problem report: http://gcc.gnu.org/ml/fortran/2010-05/msg00139.html
+!
+module globals
+ implicit none
+ integer j
+ data j/1/
+end module
+
+program test
+ use globals
+ implicit none
+ character(len=80) str
+ integer :: i
+ data i/0/
+ namelist /nl/i,j
+ open(unit=10,status='scratch')
+ write(10,nl)
+ i = 42
+ j = 42
+ rewind(10)
+ read(10,nl)
+ if (i /= 0 .or. j /= 1) call abort
+ close(10)
+end program
+! { dg-final { cleanup-modules "globals" } }
diff --git a/gcc/testsuite/gfortran.dg/end_subroutine_1.f90 b/gcc/testsuite/gfortran.dg/end_subroutine_1.f90
new file mode 100644
index 00000000000..b42f950546b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/end_subroutine_1.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+!
+interface
+ subroutine foo()
+ end
+ integer function bar()
+ end
+end interface
+contains
+ subroutine test()
+ end
+ integer function f()
+ f = 42
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/end_subroutine_2.f90 b/gcc/testsuite/gfortran.dg/end_subroutine_2.f90
new file mode 100644
index 00000000000..8f2e3d10a13
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/end_subroutine_2.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+program main
+interface
+ subroutine foo()
+ end
+ integer function bar()
+ end
+end interface
+contains
+ subroutine test()
+ end ! { dg-error "Fortran 2008: END statement instead of END SUBROUTINE" }
+ end subroutine ! To silence successive errors
+end program
+
+subroutine test2()
+contains
+ integer function f()
+ f = 42
+ end ! { dg-error "Fortran 2008: END statement instead of END FUNCTION" }
+ end function ! To silence successive errors
+end subroutine test2
+
diff --git a/gcc/testsuite/gfortran.dg/endfile_2.f90 b/gcc/testsuite/gfortran.dg/endfile_2.f90
index e91e80eb2aa..ee911e89e9e 100644
--- a/gcc/testsuite/gfortran.dg/endfile_2.f90
+++ b/gcc/testsuite/gfortran.dg/endfile_2.f90
@@ -5,7 +5,7 @@
integer i
endfile(8)
rewind(8)
- read(8,end=0023)i
+ read(8,*,end=0023)i
call abort ! should never get here
stop
0023 continue
diff --git a/gcc/testsuite/gfortran.dg/endfile_3.f90 b/gcc/testsuite/gfortran.dg/endfile_3.f90
new file mode 100644
index 00000000000..0c413145c5d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/endfile_3.f90
@@ -0,0 +1,9 @@
+! { dg-do run }
+! pr44477 READ/WRITE not allowed after ENDFILE
+!-------------------------------------------
+ open(10, form='formatted', &
+ action='write', position='rewind', status="scratch")
+ endfile(10)
+ write(10,'(a)') "aa" ! { dg-shouldfail "Cannot perform ENDFILE" }
+end
+
diff --git a/gcc/testsuite/gfortran.dg/endfile_4.f90 b/gcc/testsuite/gfortran.dg/endfile_4.f90
new file mode 100644
index 00000000000..a2462c9f878
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/endfile_4.f90
@@ -0,0 +1,8 @@
+! { dg-do run }
+! pr44477 ENDFILE not allowed after ENDFILE
+!-------------------------------------------
+ open(10, form='formatted', &
+ action='write', position='rewind', status="scratch")
+ endfile(10)
+ endfile(10) ! { dg-shouldfail "Cannot perform ENDFILE" }
+end
diff --git a/gcc/testsuite/gfortran.dg/entry_19.f90 b/gcc/testsuite/gfortran.dg/entry_19.f90
new file mode 100644
index 00000000000..b7b8bfa2f2e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/entry_19.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+!
+!
+! Entry is obsolete in Fortran 2008
+!
+subroutine foo()
+entry bar() ! { dg-error "Fortran 2008 obsolescent feature: ENTRY" }
+end
diff --git a/gcc/testsuite/gfortran.dg/eof_3.f90 b/gcc/testsuite/gfortran.dg/eof_3.f90
index 83d652912bc..f1d5098c77b 100644
--- a/gcc/testsuite/gfortran.dg/eof_3.f90
+++ b/gcc/testsuite/gfortran.dg/eof_3.f90
@@ -4,5 +4,6 @@ program test
open(unit=32,status="scratch",access="sequential",form="unformatted")
read(32,end=100)
100 continue
+backspace(32)
write (32)
end program test
diff --git a/gcc/testsuite/gfortran.dg/generic_23.f03 b/gcc/testsuite/gfortran.dg/generic_23.f03
new file mode 100644
index 00000000000..eab185b483d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_23.f03
@@ -0,0 +1,67 @@
+! { dg-do run }
+! Test the fix for PR43945 in which the over-ridding of 'doit' and
+! 'getit' in type 'foo2' was missed in the specific binding to 'do' and 'get'.
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+! and reported to clf by Salvatore Filippone <sfilippone@uniroma2.it>
+!
+module foo_mod
+ type foo
+ integer :: i
+ contains
+ procedure, pass(a) :: doit
+ procedure, pass(a) :: getit
+ generic, public :: do => doit
+ generic, public :: get => getit
+ end type foo
+ private doit,getit
+contains
+ subroutine doit(a)
+ class(foo) :: a
+ a%i = 1
+ write(*,*) 'FOO%DOIT base version'
+ end subroutine doit
+ function getit(a) result(res)
+ class(foo) :: a
+ integer :: res
+ res = a%i
+ end function getit
+end module foo_mod
+
+module foo2_mod
+ use foo_mod
+ type, extends(foo) :: foo2
+ integer :: j
+ contains
+ procedure, pass(a) :: doit => doit2
+ procedure, pass(a) :: getit => getit2
+!!$ generic, public :: do => doit
+!!$ generic, public :: get => getit
+ end type foo2
+ private doit2, getit2
+
+contains
+
+ subroutine doit2(a)
+ class(foo2) :: a
+ a%i = 2
+ a%j = 3
+ end subroutine doit2
+ function getit2(a) result(res)
+ class(foo2) :: a
+ integer :: res
+ res = a%j
+ end function getit2
+end module foo2_mod
+
+program testd15
+ use foo2_mod
+ type(foo2) :: af2
+
+ call af2%do()
+ if (af2%i .ne. 2) call abort
+ if (af2%get() .ne. 3) call abort
+
+end program testd15
+
+! { dg-final { cleanup-modules "foo_mod foo2_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr44536.f90 b/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
new file mode 100644
index 00000000000..0dc896dccea
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
@@ -0,0 +1,10 @@
+! PR fortran/44536
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+ subroutine foo (a, i, j)
+ integer, dimension(:) :: a
+ integer :: i, j
+!$omp parallel default(none) shared(i, j) ! { dg-error "enclosing parallel" }
+ j=a(i) ! { dg-error "not specified in" }
+!$omp end parallel
+ end subroutine
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
index 5c1581454b2..05be38283a9 100644
--- a/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
@@ -29,7 +29,7 @@ subroutine foo (vara, varb, varc, vard, n)
!$omp master
vara(1) = 1 ! { dg-error "not specified" }
varb(1) = 1 ! Assumed-size is predetermined
- varc(1) = 1 ! { dg-error "not specified" "" { xfail *-*-* } }
+ varc(1) = 1 ! { dg-error "not specified" }
vard(1) = 1 ! { dg-error "not specified" }
vare(1) = 1 ! { dg-error "not specified" }
!$omp end master
diff --git a/gcc/testsuite/gfortran.dg/ibclr_1.f90 b/gcc/testsuite/gfortran.dg/ibclr_1.f90
new file mode 100644
index 00000000000..3932789ec4f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ibclr_1.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+program a
+ integer :: i = 42
+ integer l
+ l = ibclr(i, -1) ! { dg-error "must be nonnegative" }
+ l = ibclr(i, 65) ! { dg-error "must be less than" }
+end program a
diff --git a/gcc/testsuite/gfortran.dg/ibits_1.f90 b/gcc/testsuite/gfortran.dg/ibits_1.f90
new file mode 100644
index 00000000000..2bcbe829b86
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ibits_1.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+!
+! PR fortran/44346
+! Original test sumbitted by Vittorio Zecca, zeccav at gmail dot com.
+! Modified by Steven G. Kargl for dejagnu testsuite.
+!
+program a
+ integer :: j, i = 42
+ j = ibits(i, -1, 1) ! { dg-error "must be nonnegative" }
+ j = ibits(i, 1, -1) ! { dg-error "must be nonnegative" }
+ j = ibits(i, 100, 100) ! { dg-error "must be less than" }
+end program a
+
diff --git a/gcc/testsuite/gfortran.dg/ibset_1.f90 b/gcc/testsuite/gfortran.dg/ibset_1.f90
new file mode 100644
index 00000000000..2ff261dbd2b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ibset_1.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+program a
+ integer :: i = 42
+ integer l
+ l = ibset(i, -1) ! { dg-error "must be nonnegative" }
+ l = ibset(i, 65) ! { dg-error "must be less than" }
+end program a
diff --git a/gcc/testsuite/gfortran.dg/import8.f90 b/gcc/testsuite/gfortran.dg/import8.f90
new file mode 100644
index 00000000000..0d88e625b81
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/import8.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR fortran/44614
+!
+!
+
+implicit none
+
+type, abstract :: Connection
+end type Connection
+
+abstract interface
+ subroutine generic_desc(self)
+ ! <<< missing IMPORT
+ class(Connection) :: self ! { dg-error "has not been declared within the interface" }
+ end subroutine generic_desc
+end interface
+end
diff --git a/gcc/testsuite/gfortran.dg/interface_proc_end.f90 b/gcc/testsuite/gfortran.dg/interface_proc_end.f90
index ab95b794268..2fc9921df41 100644
--- a/gcc/testsuite/gfortran.dg/interface_proc_end.f90
+++ b/gcc/testsuite/gfortran.dg/interface_proc_end.f90
@@ -14,6 +14,5 @@
REAL :: TLS1,TLS2
END ! OK
END INTERFACE
- end ! { dg-error "END SUBROUTINE statement" }
- end module ! { dg-error "END SUBROUTINE statement" }
-! { dg-error "Unexpected end of file" "" { target "*-*-*" } 0 }
+ end subroutine
+ end module
diff --git a/gcc/testsuite/gfortran.dg/ltrans-7.f90 b/gcc/testsuite/gfortran.dg/ltrans-7.f90
index 2829b2cda18..9c9bcf939eb 100644
--- a/gcc/testsuite/gfortran.dg/ltrans-7.f90
+++ b/gcc/testsuite/gfortran.dg/ltrans-7.f90
@@ -1,5 +1,6 @@
! { dg-do compile }
! { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" }
+! { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all -march=i486" { target { i?86-*-* && ilp32 } } }
Program FOO
IMPLICIT INTEGER (I-N)
diff --git a/gcc/testsuite/gfortran.dg/mvbits_9.f90 b/gcc/testsuite/gfortran.dg/mvbits_9.f90
new file mode 100644
index 00000000000..952286b09a6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/mvbits_9.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! PR fortran/44346
+! Original test sumbitted by Vittorio Zecca, zeccav at gmail dot com.
+! Modified by Steven G. Kargl for dejagnu testsuite.
+!
+program a
+ integer :: n = 42
+ ! 64 + 3 > bitsize(n)
+ call mvbits(n, 64, 3, n, 1) ! { dg-error "must be less than" }
+ ! 64 + 2 > bitsize(n)
+ call mvbits(n, 30, 2, n, 64) ! { dg-error "must be less than" }
+ ! LEN negative
+ call mvbits(n, 30, -2, n, 30) ! { dg-error "must be nonnegative" }
+ ! TOPOS negative
+ call mvbits(n, 30, 2, n, -3) ! { dg-error "must be nonnegative" }
+ ! FROMPOS negative
+ call mvbits(n, -1, 2, n, 3) ! { dg-error "must be nonnegative" }
+end program a
diff --git a/gcc/testsuite/gfortran.dg/nan_6.f90 b/gcc/testsuite/gfortran.dg/nan_6.f90
new file mode 100644
index 00000000000..8f0af294420
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/nan_6.f90
@@ -0,0 +1,99 @@
+! { dg-do run }
+! { dg-add-options ieee }
+! { dg-skip-if "NaN not supported" { spu-*-* } { "*" } { "" } }
+!
+! List-directed part of PR fortran/43298
+! and follow up to PR fortran/34319.
+!
+! Check handling of "NAN(alphanum)"
+!
+character(len=200) :: str
+real :: r
+complex :: z
+
+! read_real:
+
+r = 1.0
+str = 'INfinity' ; read(str,*) r
+if (r < 0 .or. r /= r*1.1) call abort()
+
+r = 1.0
+str = '-INF' ; read(str,*) r
+if (r > 0 .or. r /= r*1.1) call abort()
+
+r = 1.0
+str = '+INF' ; read(str,*) r
+if (r < 0 .or. r /= r*1.1) call abort()
+
+r = 1.0
+str = '-inFiniTY' ; read(str,*) r
+if (r > 0 .or. r /= r*1.1) call abort()
+
+r = 1.0
+str = 'NAN' ; read(str,*) r
+if (.not. isnan(r)) call abort()
+
+r = 1.0
+str = '-NAN' ; read(str,*) r
+if (.not. isnan(r)) call abort()
+
+r = 1.0
+str = '+NAN' ; read(str,*) r
+if (.not. isnan(r)) call abort()
+
+r = 1.0
+str = 'NAN(0x111)' ; read(str,*) r
+if (.not. isnan(r)) call abort()
+
+r = 1.0
+str = '-NAN(123)' ; read(str,*) r
+if (.not. isnan(r)) call abort()
+
+r = 1.0
+str = '+NAN(0xFFE)' ; read(str,*) r
+if (.not. isnan(r)) call abort()
+
+
+! parse_real
+
+z = cmplx(-2.0,-4.0)
+str = '(0.0,INfinity)' ; read(str,*) z
+if (aimag(z) < 0 .or. aimag(z) /= aimag(z)*1.1) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(-INF,0.0)' ; read(str,*) z
+if (real(z) > 0 .or. real(z) /= real(z)*1.1) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(0.0,+INF)' ; read(str,*) z
+if (aimag(z) < 0 .or. aimag(z) /= aimag(z)*1.1) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(-inFiniTY,0.0)' ; read(str,*) z
+if (real(z) > 0 .or. real(z) /= real(z)*1.1) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(NAN,0.0)' ; read(str,*) z
+if (.not. isnan(real(z))) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(0.0,-NAN)' ; read(str,*) z
+if (.not. isnan(aimag(z))) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(+NAN,0.0)' ; read(str,*) z
+if (.not. isnan(real(z))) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(NAN(0x111),0.0)' ; read(str,*) z
+if (.not. isnan(real(z))) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(0.0,-NaN(123))' ; read(str,*) z
+if (.not. isnan(aimag(z))) call abort()
+
+z = cmplx(-2.0,-4.0)
+str = '(+nan(0xFFE),0.0)' ; read(str,*) z
+if (.not. isnan(real(z))) call abort()
+
+end
diff --git a/gcc/testsuite/gfortran.dg/pr43688.f90 b/gcc/testsuite/gfortran.dg/pr43688.f90
new file mode 100644
index 00000000000..face02212b8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr43688.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-O0 -fipa-reference" }
+
+ subroutine sub
+ type :: a
+ integer :: i = 42
+ end type a
+ type(a), target :: dt(2)
+ integer, pointer :: ip(:)
+ ip => dt%i
+ end subroutine
diff --git a/gcc/testsuite/gfortran.dg/pr43866.f90 b/gcc/testsuite/gfortran.dg/pr43866.f90
new file mode 100644
index 00000000000..abfdaa1557f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr43866.f90
@@ -0,0 +1,44 @@
+! PR middle-end/43866
+! { dg-do run }
+! { dg-options "-funswitch-loops -fbounds-check" }
+
+MODULE PR43866
+ IMPLICIT NONE
+ TYPE TT
+ REAL(KIND=4), DIMENSION(:,:), POINTER :: A
+ REAL(KIND=8), DIMENSION(:,:), POINTER :: B
+ END TYPE
+CONTAINS
+ SUBROUTINE FOO(M,X,Y,T)
+ TYPE(TT), POINTER :: M
+ INTEGER, INTENT(IN) :: Y, X
+ INTEGER :: C, D
+ LOGICAL :: T
+ REAL(KIND = 4), DIMENSION(:,:), POINTER :: P
+ REAL(KIND = 8), DIMENSION(:,:), POINTER :: Q
+
+ Q => M%B
+ P => M%A
+ DO C=1,X
+ DO D=C+1,Y
+ IF (T) THEN
+ P(D,C)=P(C,D)
+ ELSE
+ Q(D,C)=Q(C,D)
+ ENDIF
+ ENDDO
+ ENDDO
+ END SUBROUTINE FOO
+END MODULE PR43866
+
+ USE PR43866
+ TYPE(TT), POINTER :: Q
+ INTEGER, PARAMETER :: N=17
+ ALLOCATE (Q)
+ NULLIFY (Q%A)
+ ALLOCATE (Q%B(N,N))
+ Q%B=0
+ CALL FOO (Q,N,N,.FALSE.)
+END
+
+! { dg-final { cleanup-modules "pr43866" } }
diff --git a/gcc/testsuite/gfortran.dg/pr44592.f90 b/gcc/testsuite/gfortran.dg/pr44592.f90
new file mode 100644
index 00000000000..8b043ba33ed
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr44592.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+! { dg-options "-O3" }
+! From forall_12.f90
+! Fails with loop reversal at -O3
+!
+ character(len=1) :: b(4) = (/"1","2","3","4"/), c(4)
+ c = b
+ i = 1
+ ! This statement must be here for the abort below
+ b(1:3)(i:i) = b(2:4)(i:i)
+
+ b = c
+ b(4:2:-1)(i:i) = b(3:1:-1)(i:i)
+
+ ! This fails. If the condition is printed, the result is F F F F
+ if (any (b .ne. (/"1","1","2","3"/))) i = 2
+ print *, b
+ print *, b .ne. (/"1","1","2","3"/)
+ if (i == 2) call abort
+end
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_27.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_27.f90
new file mode 100644
index 00000000000..83f09598110
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_27.f90
@@ -0,0 +1,20 @@
+! { dg-do compile }
+!
+! PR fortran/44446
+!
+! Contributed by Marco Restelli.
+!
+! Procedure pointer with PROTECTED was wrongly rejected.
+!
+module m
+ implicit none
+ abstract interface
+ pure function i_f(x) result(y)
+ real, intent(in) :: x
+ real :: y
+ end function i_f
+ end interface
+ procedure(i_f), pointer, protected :: p_f => null()
+end module m
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_28.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_28.f90
new file mode 100644
index 00000000000..8754d8e2982
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_28.f90
@@ -0,0 +1,39 @@
+! { dg-do compile }
+!
+! PR 44718: Procedure-pointer name is wrongly regarded as "external procedure"
+!
+! Contributed by John McFarland <john.mcfarland@swri.org>
+
+MODULE m
+
+ IMPLICIT NONE
+
+CONTAINS
+
+ FUNCTION func(x) RESULT(y)
+ INTEGER :: x,y
+ y = x *2
+ END FUNCTION func
+
+ SUBROUTINE sub(x)
+ INTEGER :: x
+ PRINT*, x
+ END SUBROUTINE sub
+
+
+ SUBROUTINE use_func()
+ PROCEDURE(func), POINTER :: f
+ INTEGER :: y
+ f => func
+ y = f(2)
+ END SUBROUTINE use_func
+
+ SUBROUTINE use_sub()
+ PROCEDURE(sub), POINTER :: f
+ f => sub
+ CALL f(2)
+ END SUBROUTINE use_sub
+
+END MODULE m
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/read_infnan_1.f90 b/gcc/testsuite/gfortran.dg/read_infnan_1.f90
new file mode 100644
index 00000000000..515a6900270
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/read_infnan_1.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+! { dg-add-options ieee }
+! { dg-skip-if "NaN not supported" { spu-*-* } { "*" } { "" } }
+
+! PR43298 Fortran library does not read in NaN, NaN(), -Inf, or Inf
+
+! Formatted READ part of PR fortran/43298
+
+! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program pr43298
+ real(4) :: x4(7)
+ real(8) :: x8(7)
+ character(80) :: output
+
+open(10, status='scratch')
+! 0123456789012345678901234567890123456789012345678901234567890123456789
+write(10,'(a)') "inf nan infinity NaN(dx) -INf NAN InFiNiTy"
+rewind(10)
+x4 = 0.0_4
+x8 = 0.0_8
+read(10,'(7f10.3)') x4
+rewind(10)
+read(10,'(7f10.3)') x8
+write (output, '("x4 =",7G6.0)') x4
+if (output.ne."x4 = +Inf NaN +Inf NaN -Inf NaN +Inf") call abort
+write (output, '("x8 =",7G6.0)') x8
+if (output.ne."x8 = +Inf NaN +Inf NaN -Inf NaN +Inf") call abort
+!print '("x4 =",7G6.0)', x4
+!print '("x8 =",7G6.0)', x8
+end program pr43298
+
diff --git a/gcc/testsuite/gfortran.dg/selected_char_kind_4.f90 b/gcc/testsuite/gfortran.dg/selected_char_kind_4.f90
new file mode 100644
index 00000000000..046ddf0e74c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/selected_char_kind_4.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+!
+! Check that runtime result values of SELECTED_CHAR_KIND agree with
+! front-end simplification results.
+!
+ implicit none
+ character(len=20) :: s
+
+ s = "ascii"
+ if (selected_char_kind(s) /= selected_char_kind("ascii")) call abort
+
+ s = "default"
+ if (selected_char_kind(s) /= selected_char_kind("default")) call abort
+
+ s = "iso_10646"
+ if (selected_char_kind(s) /= selected_char_kind("iso_10646")) call abort
+
+ s = ""
+ if (selected_char_kind(s) /= selected_char_kind("")) call abort
+
+ s = "invalid"
+ if (selected_char_kind(s) /= selected_char_kind("invalid")) call abort
+
+end
diff --git a/gcc/testsuite/gfortran.dg/selected_real_kind_1.f90 b/gcc/testsuite/gfortran.dg/selected_real_kind_1.f90
new file mode 100644
index 00000000000..0f40a595d2f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/selected_real_kind_1.f90
@@ -0,0 +1,10 @@
+! { dg-do "compile" }
+!
+! PR fortran/44347 - arguments of SELECTED_REAL_KIND shall be scalar
+! Testcase contributed by Vittorio Zecca <zeccav AT gmail DOT com>
+!
+
+ dimension ip(1), ir(1)
+ i = selected_real_kind(ip, i) ! { dg-error "must be a scalar" }
+ j = selected_real_kind(i, ir) ! { dg-error "must be a scalar" }
+end
diff --git a/gcc/testsuite/gfortran.dg/selected_real_kind_2.f90 b/gcc/testsuite/gfortran.dg/selected_real_kind_2.f90
new file mode 100644
index 00000000000..cf73520f930
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/selected_real_kind_2.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+! { dg-options "-std=f2008 -fall-intrinsics" }
+!
+
+integer :: p, r, rdx
+
+! Compile-time version
+
+if (selected_real_kind(radix=2) /= 4) call should_not_fail()
+if (selected_real_kind(radix=4) /= -5) call should_not_fail()
+if (selected_real_kind(precision(0.0),range(0.0),radix(0.0)) /= kind(0.0)) &
+ call should_not_fail()
+if (selected_real_kind(precision(0.0d0),range(0.0d0),radix(0.0d0)) /= kind(0.0d0)) &
+ call should_not_fail()
+
+! Run-time version
+
+rdx = 2
+if (selected_real_kind(radix=rdx) /= 4) call abort()
+rdx = 4
+if (selected_real_kind(radix=rdx) /= -5) call abort()
+
+rdx = radix(0.0)
+p = precision(0.0)
+r = range(0.0)
+if (selected_real_kind(p,r,rdx) /= kind(0.0)) call abort()
+
+rdx = radix(0.0d0)
+p = precision(0.0d0)
+r = range(0.0d0)
+if (selected_real_kind(p,r,rdx) /= kind(0.0d0)) call abort()
+end
diff --git a/gcc/testsuite/gfortran.dg/selected_real_kind_3.f90 b/gcc/testsuite/gfortran.dg/selected_real_kind_3.f90
new file mode 100644
index 00000000000..d24d877acfe
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/selected_real_kind_3.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+print *, selected_real_kind(p=precision(0.0),radix=2) ! { dg-error "Fortran 2008" }
+print *, selected_real_kind() ! { dg-error "neither 'P' nor 'R' argument" }
+end
diff --git a/gcc/testsuite/gfortran.dg/semicolon_fixed.f b/gcc/testsuite/gfortran.dg/semicolon_fixed.f
index 2c667ae0cb9..7bd0ada825c 100644
--- a/gcc/testsuite/gfortran.dg/semicolon_fixed.f
+++ b/gcc/testsuite/gfortran.dg/semicolon_fixed.f
@@ -1,9 +1,11 @@
! { dg-do compile }
-! PR 19259 Semicolon cannot start a line
+! { dg-options "-std=f2003" }
+!
+! PR 19259 Semicolon cannot start a line (in F2003)
x=1; y=1;
x=2;;
x=3;
- ; ! { dg-error "Semicolon at" }
- ;; ! { dg-error "Semicolon at" }
+ ; ! { dg-error "Fortran 2008: Semicolon at" }
+ ;; ! { dg-error "Fortran 2008: Semicolon at" }
900 ; ! { dg-error "Semicolon at" }
end
diff --git a/gcc/testsuite/gfortran.dg/semicolon_fixed_2.f b/gcc/testsuite/gfortran.dg/semicolon_fixed_2.f
new file mode 100644
index 00000000000..8ee444c3ff5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/semicolon_fixed_2.f
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+
+! PR 19259 Semicolon cannot start a line
+! but it F2008 it can!
+ x=1; y=1;
+ x=2;;
+ x=3;
+ ; ! OK
+ ;; ! OK
+ 900 ; ! { dg-error "Semicolon at" }
+ end
diff --git a/gcc/testsuite/gfortran.dg/semicolon_free.f90 b/gcc/testsuite/gfortran.dg/semicolon_free.f90
index 28e8da2b285..4d05d83f86b 100644
--- a/gcc/testsuite/gfortran.dg/semicolon_free.f90
+++ b/gcc/testsuite/gfortran.dg/semicolon_free.f90
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=f2003" }
! PR 19259 Semicolon cannot start a line
x=1; y=1;
x=2;;
diff --git a/gcc/testsuite/gfortran.dg/semicolon_free_2.f90 b/gcc/testsuite/gfortran.dg/semicolon_free_2.f90
new file mode 100644
index 00000000000..2fae26e1607
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/semicolon_free_2.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+! PR 19259 Semicolon cannot start a line
+x=1; y=1;
+x=2;;
+x=3;
+ ; ! OK
+;; ! OK
+111 ; ! { dg-error "Semicolon at" }
+end
diff --git a/gcc/testsuite/gfortran.dg/type_decl_1.f90 b/gcc/testsuite/gfortran.dg/type_decl_1.f90
new file mode 100644
index 00000000000..93928652a05
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/type_decl_1.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+!
+! Fortran 2008: TYPE ( intrinsic-type-spec )
+!
+implicit none
+type(integer) :: a
+type(real) :: b
+type(logical ) :: c
+type(character) :: d
+type(double precision) :: e
+
+type(integer(8)) :: f
+type(real(kind=4)) :: g
+type(logical ( kind = 1 ) ) :: h
+type(character (len=10,kind=1) ) :: i
+
+type(double complex) :: j ! { dg-error "Extension: DOUBLE COMPLEX" }
+end
+
+module m
+ integer, parameter :: k4 = 4
+end module m
+
+type(integer (kind=k4)) function f()
+ use m
+ f = 42
+end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/type_decl_2.f90 b/gcc/testsuite/gfortran.dg/type_decl_2.f90
new file mode 100644
index 00000000000..6525880e06e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/type_decl_2.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! Fortran 2008: TYPE ( intrinsic-type-spec )
+!
+implicit none
+type(integer) :: a ! { dg-error "Fortran 2008" }
+type(real) :: b ! { dg-error "Fortran 2008" }
+type(logical) :: c ! { dg-error "Fortran 2008" }
+type(character) :: d ! { dg-error "Fortran 2008" }
+type(double precision) :: e ! { dg-error "Fortran 2008" }
+end
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_14.f03 b/gcc/testsuite/gfortran.dg/typebound_call_14.f03
new file mode 100644
index 00000000000..e8cbf846e5d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_call_14.f03
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! PR 44211: [OOP] ICE with TBP of pointer component of derived type array
+!
+! Original test case by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+module ice_module
+ type::ice_type
+ class(ice_type),pointer::next
+ contains
+ procedure::ice_sub
+ procedure::ice_fun
+ end type ice_type
+contains
+ subroutine ice_sub(this)
+ class(ice_type)::this
+ end subroutine
+ integer function ice_fun(this)
+ class(ice_type)::this
+ end function
+ subroutine ice()
+ type(ice_type),dimension(2)::ice_array
+ call ice_array(1)%next%ice_sub()
+ print *,ice_array(2)%next%ice_fun()
+ end subroutine
+end module ice_module
+
+! { dg-final { cleanup-modules "ice_module" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_15.f03 b/gcc/testsuite/gfortran.dg/typebound_call_15.f03
new file mode 100644
index 00000000000..ac6a668cc46
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_call_15.f03
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR 44558: [OOP] ICE on invalid code: called TBP subroutine as TBP function
+!
+! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
+
+module ice5
+ type::a_type
+ contains
+ procedure::a_subroutine_1
+ procedure::a_subroutine_2
+ end type a_type
+contains
+ real function a_subroutine_1(this)
+ class(a_type)::this
+ real::res
+ res=this%a_subroutine_2() ! { dg-error "should be a FUNCTION" }
+ end function
+ subroutine a_subroutine_2(this)
+ class(a_type)::this
+ call this%a_subroutine_1() ! { dg-error "should be a SUBROUTINE" }
+ end subroutine
+end module ice5
+
+! { dg-final { cleanup-modules "ice5" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_14.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_14.f03
new file mode 100644
index 00000000000..766a0ef66c1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_14.f03
@@ -0,0 +1,33 @@
+! { dg-do compile }
+!
+! PR 40117: [OOP][F2008] Type-bound procedure: allow list after PROCEDURE
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+module m
+
+implicit none
+
+type :: t
+contains
+ procedure :: foo, bar, baz
+end type
+
+contains
+
+ subroutine foo (this)
+ class(t) :: this
+ end subroutine
+
+ real function bar (this)
+ class(t) :: this
+ end function
+
+ subroutine baz (this, par)
+ class(t) :: this
+ integer :: par
+ end subroutine
+
+end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_15.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_15.f03
new file mode 100644
index 00000000000..37907b3f4df
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_15.f03
@@ -0,0 +1,34 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR 40117: [OOP][F2008] Type-bound procedure: allow list after PROCEDURE
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+module m
+
+implicit none
+
+type :: t
+contains
+ procedure :: foo
+ procedure :: bar, baz ! { dg-error "PROCEDURE list" }
+end type
+
+contains
+
+ subroutine foo (this)
+ class(t) :: this
+ end subroutine
+
+ subroutine bar (this)
+ class(t) :: this
+ end subroutine
+
+ subroutine baz (this)
+ class(t) :: this
+ end subroutine
+
+end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_16.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_16.f03
new file mode 100644
index 00000000000..828f5102204
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_16.f03
@@ -0,0 +1,58 @@
+! { dg-do compile }
+!
+! PR 44549: [OOP][F2008] Type-bound procedure: bogus error from list after PROCEDURE
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+
+MODULE rational_numbers
+ IMPLICIT NONE
+ PRIVATE
+ TYPE,PUBLIC :: rational
+ PRIVATE
+ INTEGER n,d
+
+ CONTAINS
+ ! ordinary type-bound procedure
+ PROCEDURE :: real => rat_to_real
+ ! specific type-bound procedures for generic support
+ PROCEDURE,PRIVATE :: rat_asgn_i, rat_plus_rat, rat_plus_i
+ PROCEDURE,PRIVATE,PASS(b) :: i_plus_rat
+ ! generic type-bound procedures
+ GENERIC :: ASSIGNMENT(=) => rat_asgn_i
+ GENERIC :: OPERATOR(+) => rat_plus_rat, rat_plus_i, i_plus_rat
+ END TYPE
+ CONTAINS
+ ELEMENTAL REAL FUNCTION rat_to_real(this) RESULT(r)
+ CLASS(rational),INTENT(IN) :: this
+ r = REAL(this%n)/this%d
+ END FUNCTION
+
+ ELEMENTAL SUBROUTINE rat_asgn_i(a,b)
+ CLASS(rational),INTENT(OUT) :: a
+ INTEGER,INTENT(IN) :: b
+ a%n = b
+ a%d = 1
+ END SUBROUTINE
+
+ ELEMENTAL TYPE(rational) FUNCTION rat_plus_i(a,b) RESULT(r)
+ CLASS(rational),INTENT(IN) :: a
+ INTEGER,INTENT(IN) :: b
+ r%n = a%n + b*a%d
+ r%d = a%d
+ END FUNCTION
+
+ ELEMENTAL TYPE(rational) FUNCTION i_plus_rat(a,b) RESULT(r)
+ INTEGER,INTENT(IN) :: a
+ CLASS(rational),INTENT(IN) :: b
+ r%n = b%n + a*b%d
+ r%d = b%d
+ END FUNCTION
+
+ ELEMENTAL TYPE(rational) FUNCTION rat_plus_rat(a,b) RESULT(r)
+ CLASS(rational),INTENT(IN) :: a,b
+ r%n = a%n*b%d + b%n*a%d
+ r%d = a%d*b%d
+ END FUNCTION
+END
+
+! { dg-final { cleanup-modules "rational_numbers" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_4.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_4.f03
index 92adc1a852a..60aa728a40f 100644
--- a/gcc/testsuite/gfortran.dg/typebound_proc_4.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_4.f03
@@ -17,12 +17,12 @@ MODULE testmod
PROCEDURE ? ! { dg-error "Expected binding name" }
PROCEDURE :: p2 => ! { dg-error "Expected binding target" }
PROCEDURE :: p3 =>, ! { dg-error "Expected binding target" }
- PROCEDURE p4, ! { dg-error "Junk after" }
- PROCEDURE :: p5 => proc2, ! { dg-error "Junk after" }
+ PROCEDURE p4, ! { dg-error "Expected binding name" }
+ PROCEDURE :: p5 => proc2, ! { dg-error "Expected binding name" }
PROCEDURE :: p0 => proc3 ! { dg-error "already a procedure" }
PROCEDURE, PASS p6 ! { dg-error "::" }
PROCEDURE, PASS NON_OVERRIDABLE ! { dg-error "Expected" }
- PROCEDURE PASS :: ! { dg-error "Junk after" }
+ PROCEDURE PASS :: ! { dg-error "Syntax error" }
PROCEDURE, PASS (x ! { dg-error "Expected" }
PROCEDURE, PASS () ! { dg-error "Expected" }
PROCEDURE, NOPASS, PASS ! { dg-error "illegal PASS" }
diff --git a/gcc/testsuite/gfortran.dg/unpack_bounds_1.f90 b/gcc/testsuite/gfortran.dg/unpack_bounds_1.f90
index 360790b5705..360790b5705 100755..100644
--- a/gcc/testsuite/gfortran.dg/unpack_bounds_1.f90
+++ b/gcc/testsuite/gfortran.dg/unpack_bounds_1.f90
diff --git a/gcc/testsuite/gfortran.dg/unpack_bounds_2.f90 b/gcc/testsuite/gfortran.dg/unpack_bounds_2.f90
index fd049f5abbb..fd049f5abbb 100755..100644
--- a/gcc/testsuite/gfortran.dg/unpack_bounds_2.f90
+++ b/gcc/testsuite/gfortran.dg/unpack_bounds_2.f90
diff --git a/gcc/testsuite/gfortran.dg/unpack_bounds_3.f90 b/gcc/testsuite/gfortran.dg/unpack_bounds_3.f90
index c6734b14c1f..c6734b14c1f 100755..100644
--- a/gcc/testsuite/gfortran.dg/unpack_bounds_3.f90
+++ b/gcc/testsuite/gfortran.dg/unpack_bounds_3.f90
diff --git a/gcc/testsuite/gfortran.dg/warn_conversion.f90 b/gcc/testsuite/gfortran.dg/warn_conversion.f90
index f658b655cae..c8f0e23e2ff 100644
--- a/gcc/testsuite/gfortran.dg/warn_conversion.f90
+++ b/gcc/testsuite/gfortran.dg/warn_conversion.f90
@@ -18,7 +18,6 @@ SUBROUTINE pr27866c4
integer(kind=4) :: i4
i4 = 2.3 ! { dg-warning "conversion" }
i1 = 500 ! { dg-error "overflow" }
- ! { dg-warning "conversion" "" { target *-*-* } 20 }
a = 2**26-1 ! assignment INTEGER(4) to REAL(4) - no warning
b = 1d999 ! { dg-error "overflow" }
diff --git a/gcc/testsuite/gfortran.dg/warn_conversion_2.f90 b/gcc/testsuite/gfortran.dg/warn_conversion_2.f90
index cb3b760a5e2..c0222983a0f 100644
--- a/gcc/testsuite/gfortran.dg/warn_conversion_2.f90
+++ b/gcc/testsuite/gfortran.dg/warn_conversion_2.f90
@@ -2,5 +2,10 @@
! { dg-options "-Wconversion-extra" }
real(8) :: sqrt2
- sqrt2 = sqrt(2.0) ! { dg-warning "conversion" }
+ real x
+
+ x = 2.0
+ sqrt2 = sqrt(x) ! { dg-warning "Conversion" }
+
+ sqrt2 = sqrt(2.0) ! no warning; simplified to a constant and range checked
end
diff --git a/gcc/testsuite/gfortran.dg/whole_file_18.f90 b/gcc/testsuite/gfortran.dg/whole_file_18.f90
index dbff1859216..fac15d6ca4f 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_18.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_18.f90
@@ -5,7 +5,7 @@
!
PROGRAM MAIN
REAL A
- CALL SUB(A) ! { dg-error "must have an explicit interface" }
+ CALL SUB(A) ! { dg-error "requires an explicit interface" }
END PROGRAM
SUBROUTINE SUB(A,I)
diff --git a/gcc/testsuite/gfortran.dg/whole_file_20.f03 b/gcc/testsuite/gfortran.dg/whole_file_20.f03
new file mode 100644
index 00000000000..231a5aaf283
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_20.f03
@@ -0,0 +1,33 @@
+! { dg-do "compile" }
+! { dg-options "-fwhole-file -fcoarray=single" }
+!
+! Procedures with dummy arguments that are coarrays or polymorphic
+! must have an explicit interface in the calling routine.
+!
+
+MODULE classtype
+ type :: t
+ integer :: comp
+ end type
+END MODULE
+
+PROGRAM main
+ USE classtype
+ CLASS(t), POINTER :: tt
+
+ INTEGER :: coarr[*]
+
+ CALL coarray(coarr) ! { dg-error " must have an explicit interface" }
+ CALL polymorph(tt) ! { dg-error " must have an explicit interface" }
+END PROGRAM
+
+SUBROUTINE coarray(a)
+ INTEGER :: a[*]
+END SUBROUTINE
+
+SUBROUTINE polymorph(b)
+ USE classtype
+ CLASS(t) :: b
+END SUBROUTINE
+
+! { dg-final { cleanup-modules "classtype" } }
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f90
new file mode 100644
index 00000000000..64b129efc3c
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f90
@@ -0,0 +1,15 @@
+subroutine pr40421 (j, q, r)
+ double precision :: q(1,1), r(1,1,3)
+ save
+ integer :: i, j, m, n
+ double precision :: s, t, u
+ do i=1,2
+ do m=1,j
+ do n=1,1
+ s=q(n,m)*r(n,m,1)
+ t=q(n,m)*r(n,m,2)
+ u=q(n,m)*r(n,m,3)
+ end do
+ end do
+ end do
+end
diff --git a/gcc/testsuite/gnat.dg/class_wide2.adb b/gcc/testsuite/gnat.dg/class_wide2.adb
index b82289d5ef5..9df54bf9071 100644
--- a/gcc/testsuite/gnat.dg/class_wide2.adb
+++ b/gcc/testsuite/gnat.dg/class_wide2.adb
@@ -4,7 +4,7 @@ package body Class_Wide2 is
procedure Initialize is
Var_Acc : Class_Acc := new Grand_Child;
- Var : Grand_Child'Class := Grand_Child'Class (Var_Acc.all); -- { dg-bogus "already constrained" "" { xfail *-*-* } }
+ Var : Grand_Child'Class := Grand_Child'Class (Var_Acc.all);
begin
Var := Grand_Child'Class (Var_Acc.all);
diff --git a/gcc/testsuite/gnat.dg/noreturn3.adb b/gcc/testsuite/gnat.dg/noreturn3.adb
new file mode 100644
index 00000000000..4457373c308
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/noreturn3.adb
@@ -0,0 +1,27 @@
+-- { dg-do compile }
+
+with Ada.Exceptions;
+
+package body Noreturn3 is
+
+ procedure Raise_Error (E : Enum; ErrorMessage : String) is
+
+ function Msg return String is
+ begin
+ return "Error :" & ErrorMessage;
+ end;
+
+ begin
+ case E is
+ when One =>
+ Ada.Exceptions.Raise_Exception (Exc1'Identity, Msg);
+
+ when Two =>
+ Ada.Exceptions.Raise_Exception (Exc2'Identity, Msg);
+
+ when others =>
+ Ada.Exceptions.Raise_Exception (Exc3'Identity, Msg);
+ end case;
+ end;
+
+end Noreturn3;
diff --git a/gcc/testsuite/gnat.dg/noreturn3.ads b/gcc/testsuite/gnat.dg/noreturn3.ads
new file mode 100644
index 00000000000..d830a14910e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/noreturn3.ads
@@ -0,0 +1,12 @@
+package Noreturn3 is
+
+ Exc1 : Exception;
+ Exc2 : Exception;
+ Exc3 : Exception;
+
+ type Enum is (One, Two, Three);
+
+ procedure Raise_Error (E : Enum; ErrorMessage : String);
+ pragma No_Return (Raise_Error);
+
+end Noreturn3;
diff --git a/gcc/testsuite/gnat.dg/not_null.adb b/gcc/testsuite/gnat.dg/not_null.adb
index 7d3c63dc9cd..3cbd86c1633 100644
--- a/gcc/testsuite/gnat.dg/not_null.adb
+++ b/gcc/testsuite/gnat.dg/not_null.adb
@@ -11,10 +11,8 @@ procedure not_null is
begin
declare
pragma Warnings (Off, "*null not allowed in null-excluding objects");
- pragma Warnings (Off, """Constraint_Error"" will be raised at run time");
package Inst_2 is new GPack (null);
pragma Warnings (On, "*null not allowed in null-excluding objects");
- pragma Warnings (On, """Constraint_Error"" will be raised at run time");
begin
null;
end;
diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
index 7b51fdd2f6f..7d0620faa0e 100644
--- a/gcc/testsuite/lib/lto.exp
+++ b/gcc/testsuite/lib/lto.exp
@@ -32,7 +32,7 @@ proc lto_prune_warns { text } {
# Sun ld warns about common symbols with differing sizes. Unlike GNU ld
# --warn-common (off by default), they cannot be disabled.
- regsub -all "(^|\n)ld: warning: symbol `\[^\n\]*' has differing sizes:" $text "" text
+ regsub -all "(^|\n)ld: warning: symbol \[`'\]\[^\n\]*' has differing sizes:" $text "" text
regsub -all "(^|\n)\[ \t\]*\[\(\]file \[^\n\]* value=\[^\n\]*; file \[^\n\]* value=\[^\n\]*\[)\];" $text "" text
regsub -all "(^|\n)\[ \t\]*\[^\n\]* definition taken" $text "" text
@@ -110,6 +110,7 @@ set lto_skip_list $LTO_SKIPS
load_lib dg.exp
load_lib gcc-dg.exp
+load_lib gcc.exp
# lto-obj -- compile to an object file
#
@@ -137,7 +138,13 @@ proc lto-obj { source dest optall optfile optstr xfaildata } {
lappend options "additional_flags=$optall $optfile"
set compiler_conditional_xfail_data $xfaildata
- set comp_output [${tool}_target_compile "$source" "$dest" object $options]
+
+ # Allow C source files to mix freely with other languages
+ if [ string match "*.c" $source ] then {
+ set comp_output [gcc_target_compile "$source" "$dest" object $options]
+ } else {
+ set comp_output [${tool}_target_compile "$source" "$dest" object $options]
+ }
# Prune unimportant visibility warnings before checking output.
set comp_output [lto_prune_warns $comp_output]
${tool}_check_compile "$testcase $dest assemble" $optstr $dest $comp_output
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 1a36127e95b..1cdc53b4983 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -992,6 +992,30 @@ proc check_vmx_hw_available { } {
}]
}
+proc check_ppc_recip_hw_available { } {
+ return [check_cached_effective_target ppc_recip_hw_available {
+ # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
+ # For now, disable on Darwin
+ if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
+ expr 0
+ } else {
+ set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
+ check_runtime_nocache ppc_recip_hw_available {
+ volatile double d_recip, d_rsqrt, d_four = 4.0;
+ volatile float f_recip, f_rsqrt, f_four = 4.0f;
+ int main()
+ {
+ asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
+ asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
+ asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
+ asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
+ return 0;
+ }
+ } $options
+ }
+ }]
+}
+
# Return 1 if the target supports executing AltiVec and Cell PPU
# instructions, 0 otherwise. Cache the result.
@@ -2972,6 +2996,8 @@ proc is-effective-target { arg } {
} else {
switch $arg {
"vmx_hw" { set selected [check_vmx_hw_available] }
+ "vsx_hw" { set selected [check_vsx_hw_available] }
+ "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
"named_sections" { set selected [check_named_sections_available] }
"gc_sections" { set selected [check_gc_sections_available] }
"cxa_atexit" { set selected [check_cxa_atexit_available] }
@@ -2991,6 +3017,8 @@ proc is-effective-target-keyword { arg } {
# These have different names for their check_* procs.
switch $arg {
"vmx_hw" { return 1 }
+ "vsx_hw" { return 1 }
+ "ppc_recip_hw" { return 1 }
"named_sections" { return 1 }
"gc_sections" { return 1 }
"cxa_atexit" { return 1 }
@@ -3305,6 +3333,28 @@ proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
}]
}
+# Return 1 if GNU as is used.
+
+proc check_effective_target_gas { } {
+ global use_gas_saved
+ global tool
+
+ if {![info exists use_gas_saved]} {
+ # Check if the as used by gcc is GNU as.
+ set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0]
+ # Provide /dev/null as input, otherwise gas times out reading from
+ # stdin.
+ set status [remote_exec host "$gcc_as" "-v /dev/null"]
+ set as_output [lindex $status 1]
+ if { [ string first "GNU" $as_output ] >= 0 } {
+ set use_gas_saved 1
+ } else {
+ set use_gas_saved 0
+ }
+ }
+ return $use_gas_saved
+}
+
# Return 1 if the compiler has been configure with link-time optimization
# (LTO) support.
diff --git a/gcc/timevar.def b/gcc/timevar.def
index 2a124e6a949..e4e61fb2f1a 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -52,6 +52,7 @@ DEFTIMEVAR (TV_CGRAPH , "callgraph construction")
DEFTIMEVAR (TV_CGRAPHOPT , "callgraph optimization")
DEFTIMEVAR (TV_VARPOOL , "varpool construction")
DEFTIMEVAR (TV_IPA_CONSTANT_PROP , "ipa cp")
+DEFTIMEVAR (TV_IPA_FNSPLIT , "ipa function splitting")
DEFTIMEVAR (TV_IPA_LTO_GIMPLE_IO , "ipa lto gimple I/O")
DEFTIMEVAR (TV_IPA_LTO_DECL_IO , "ipa lto decl I/O")
DEFTIMEVAR (TV_IPA_LTO_DECL_INIT_IO , "ipa lto decl init I/O")
diff --git a/gcc/toplev.c b/gcc/toplev.c
index ff4c8504907..276ae7ed4f1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -126,8 +126,9 @@ static bool no_backend;
/* Length of line when printing switch values. */
#define MAX_LINE 75
-/* Copy of argument vector to toplev_main. */
-static const char **save_argv;
+/* Decoded options, and number of such options. */
+static struct cl_decoded_option *save_decoded_options;
+static unsigned int save_decoded_options_count;
/* Name of top-level original source file (what was input to cpp).
This comes from the #-command at the beginning of the actual input.
@@ -208,10 +209,6 @@ tree current_function_decl;
if none. */
const char * current_function_func_begin_label;
-/* Nonzero means to collect statistics which might be expensive
- and to print them when we are done. */
-int flag_detailed_statistics = 0;
-
/* A random sequence of characters, unless overridden by user. */
static const char *flag_random_seed;
@@ -222,28 +219,6 @@ unsigned local_tick;
/* -f flags. */
-/* Nonzero means `char' should be signed. */
-
-int flag_signed_char;
-
-/* Nonzero means give an enum type only as many bytes as it needs. A value
- of 2 means it has not yet been initialized. */
-
-int flag_short_enums;
-
-/* Nonzero if structures and unions should be returned in memory.
-
- This should only be defined if compatibility with another compiler or
- with an ABI is needed, because it results in slower code. */
-
-#ifndef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 1
-#endif
-
-/* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
-
-int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
-
/* 0 means straightforward implementation of complex divide acceptable.
1 means wide ranges of inputs must work for complex divide.
2 means C99-like requirements for complex multiply and divide. */
@@ -281,10 +256,6 @@ enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
enum ira_algorithm flag_ira_algorithm = IRA_ALGORITHM_CB;
enum ira_region flag_ira_region = IRA_REGION_MIXED;
-/* Set the default value for -fira-verbose. */
-
-unsigned int flag_ira_verbose = 5;
-
/* Set the default for excess precision. */
enum excess_precision flag_excess_precision_cmdline = EXCESS_PRECISION_DEFAULT;
@@ -518,34 +489,6 @@ set_random_seed (const char *val)
return old;
}
-/* Decode the string P as an integral parameter.
- If the string is indeed an integer return its numeric value else
- issue an Invalid Option error for the option PNAME and return DEFVAL.
- If PNAME is zero just return DEFVAL, do not call error. */
-
-int
-read_integral_parameter (const char *p, const char *pname, const int defval)
-{
- const char *endp = p;
-
- while (*endp)
- {
- if (ISDIGIT (*endp))
- endp++;
- else
- break;
- }
-
- if (*endp != 0)
- {
- if (pname != 0)
- error ("invalid option argument %qs", pname);
- return defval;
- }
-
- return atoi (p);
-}
-
#if GCC_VERSION < 3004
/* The functions floor_log2 and exact_log2 are defined as inline
@@ -1368,7 +1311,6 @@ print_switch_values (print_switch_fn_type print_fn)
{
int pos = 0;
size_t j;
- const char **p;
/* Fill in the -frandom-seed option, if the user didn't pass it, so
that it can be printed below. This helps reproducibility. */
@@ -1379,30 +1321,23 @@ print_switch_values (print_switch_fn_type print_fn)
pos = print_single_switch (print_fn, pos,
SWITCH_TYPE_DESCRIPTIVE, _("options passed: "));
- for (p = &save_argv[1]; *p != NULL; p++)
+ for (j = 1; j < save_decoded_options_count; j++)
{
- if (**p == '-')
+ switch (save_decoded_options[j].opt_index)
{
+ case OPT_o:
+ case OPT_d:
+ case OPT_dumpbase:
+ case OPT_dumpdir:
+ case OPT_auxbase:
+ case OPT_quiet:
+ case OPT_version:
/* Ignore these. */
- if (strcmp (*p, "-o") == 0
- || strcmp (*p, "-dumpbase") == 0
- || strcmp (*p, "-dumpdir") == 0
- || strcmp (*p, "-auxbase") == 0)
- {
- if (p[1] != NULL)
- p++;
- continue;
- }
-
- if (strcmp (*p, "-quiet") == 0
- || strcmp (*p, "-version") == 0)
- continue;
-
- if ((*p)[1] == 'd')
- continue;
+ continue;
}
- pos = print_single_switch (print_fn, pos, SWITCH_TYPE_PASSED, *p);
+ pos = print_single_switch (print_fn, pos, SWITCH_TYPE_PASSED,
+ save_decoded_options[j].orig_option_with_args_text);
}
if (pos > 0)
@@ -1657,7 +1592,7 @@ default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
static void *
realloc_for_line_map (void *ptr, size_t len)
{
- return ggc_realloc (ptr, len);
+ return GGC_RESIZEVAR (void, ptr, len);
}
/* A helper function: used as the allocator function for
@@ -1665,7 +1600,7 @@ realloc_for_line_map (void *ptr, size_t len)
static void *
alloc_for_identifier_to_locale (size_t len)
{
- return ggc_alloc (len);
+ return ggc_alloc_atomic (len);
}
/* Initialization of the front end environment, before command line
@@ -1733,7 +1668,7 @@ general_init (const char *argv0)
table. */
init_ggc ();
init_stringpool ();
- line_table = GGC_NEW (struct line_maps);
+ line_table = ggc_alloc_line_maps ();
linemap_init (line_table);
line_table->reallocator = realloc_for_line_map;
init_ttree ();
@@ -1826,10 +1761,8 @@ process_options (void)
so we can correctly initialize debug output. */
no_backend = lang_hooks.post_options (&main_input_filename);
-#ifdef OVERRIDE_OPTIONS
/* Some machines may reject certain combinations of options. */
- OVERRIDE_OPTIONS;
-#endif
+ targetm.target_option.override ();
/* Avoid any informative notes in the second run of -fcompare-debug. */
if (flag_compare_debug)
@@ -2078,13 +2011,13 @@ process_options (void)
}
#ifndef HAVE_prefetch
- if (flag_prefetch_loop_arrays)
+ if (flag_prefetch_loop_arrays > 0)
{
warning (0, "-fprefetch-loop-arrays not supported for this target");
flag_prefetch_loop_arrays = 0;
}
#else
- if (flag_prefetch_loop_arrays && !HAVE_prefetch)
+ if (flag_prefetch_loop_arrays > 0 && !HAVE_prefetch)
{
warning (0, "-fprefetch-loop-arrays not supported for this target (try -march switches)");
flag_prefetch_loop_arrays = 0;
@@ -2093,7 +2026,7 @@ process_options (void)
/* This combination of options isn't handled for i386 targets and doesn't
make much sense anyway, so don't allow it. */
- if (flag_prefetch_loop_arrays && optimize_size)
+ if (flag_prefetch_loop_arrays > 0 && optimize_size)
{
warning (0, "-fprefetch-loop-arrays is not supported with -Os");
flag_prefetch_loop_arrays = 0;
@@ -2425,14 +2358,13 @@ toplev_main (int argc, char **argv)
{
expandargv (&argc, &argv);
- save_argv = CONST_CAST2 (const char **, char **, argv);
-
/* Initialization of GCC's environment, and diagnostics. */
general_init (argv[0]);
/* Parse the options and do minimal processing; basically just
enough to default flags appropriately. */
- decode_options (argc, CONST_CAST2 (const char **, char **, argv));
+ decode_options (argc, CONST_CAST2 (const char **, char **, argv),
+ &save_decoded_options, &save_decoded_options_count);
init_local_tick ();
diff --git a/gcc/toplev.h b/gcc/toplev.h
index b7152f7b9e1..517d359dbb4 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -31,18 +31,7 @@ along with GCC; see the file COPYING3. If not see
(strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
extern int toplev_main (int, char **);
-extern int read_integral_parameter (const char *, const char *, const int);
extern void strip_off_ending (char *, int);
-extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
- ATTRIBUTE_NORETURN;
-extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
- ATTRIBUTE_NORETURN;
-
-#define fatal_insn(msgid, insn) \
- _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
-#define fatal_insn_not_found(insn) \
- _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
-
extern void rest_of_decl_compilation (tree, int, int);
extern void rest_of_type_compilation (tree, int);
extern void tree_rest_of_compilation (tree);
@@ -50,10 +39,13 @@ extern void init_optimization_passes (void);
extern void finish_optimization_passes (void);
extern bool enable_rtl_dump_file (void);
+/* In except.c. Initialize exception handling. This is used by the Ada
+ and LTO front ends to initialize EH "on demand". See lto-streamer-in.c
+ and ada/gcc-interface/misc.c. */
+extern void init_eh (void);
+
extern void announce_function (tree);
-extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warn_deprecated_use (tree, tree);
extern bool parse_optimize_options (tree, bool);
@@ -94,25 +86,7 @@ extern bool exit_after_options;
extern bool user_defined_section_attribute;
/* See toplev.c. */
-extern int flag_crossjumping;
-extern int flag_if_conversion;
-extern int flag_if_conversion2;
-extern int flag_keep_static_consts;
-extern int flag_peel_loops;
extern int flag_rerun_cse_after_global_opts;
-extern int flag_rerun_cse_after_loop;
-extern int flag_thread_jumps;
-extern int flag_tracer;
-extern int flag_unroll_loops;
-extern int flag_unroll_all_loops;
-extern int flag_unswitch_loops;
-extern int flag_cprop_registers;
-extern int time_report;
-extern int flag_ira_loop_pressure;
-extern int flag_ira_coalesce;
-extern int flag_ira_move_spills;
-extern int flag_ira_share_save_slots;
-extern int flag_ira_share_spill_slots;
/* Things to do with target switches. */
extern void print_version (FILE *, const char *);
diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c
index 4d63de381c4..a02d56cdc8d 100644
--- a/gcc/tree-affine.c
+++ b/gcc/tree-affine.c
@@ -309,6 +309,15 @@ tree_to_aff_combination (tree expr, tree type, aff_tree *comb)
return;
case ADDR_EXPR:
+ /* Handle &MEM[ptr + CST] which is equivalent to POINTER_PLUS_EXPR. */
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == MEM_REF)
+ {
+ expr = TREE_OPERAND (expr, 0);
+ tree_to_aff_combination (TREE_OPERAND (expr, 0), type, comb);
+ tree_to_aff_combination (TREE_OPERAND (expr, 1), sizetype, &tmp);
+ aff_combination_add (comb, &tmp);
+ return;
+ }
core = get_inner_reference (TREE_OPERAND (expr, 0), &bitsize, &bitpos,
&toffset, &mode, &unsignedp, &volatilep,
false);
@@ -331,6 +340,25 @@ tree_to_aff_combination (tree expr, tree type, aff_tree *comb)
}
return;
+ case MEM_REF:
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR)
+ tree_to_aff_combination (TREE_OPERAND (TREE_OPERAND (expr, 0), 0),
+ type, comb);
+ else if (integer_zerop (TREE_OPERAND (expr, 1)))
+ {
+ aff_combination_elt (comb, type, expr);
+ return;
+ }
+ else
+ aff_combination_elt (comb, type,
+ build2 (MEM_REF, TREE_TYPE (expr),
+ TREE_OPERAND (expr, 0),
+ build_int_cst
+ (TREE_TYPE (TREE_OPERAND (expr, 1)), 0)));
+ tree_to_aff_combination (TREE_OPERAND (expr, 1), sizetype, &tmp);
+ aff_combination_add (comb, &tmp);
+ return;
+
default:
break;
}
diff --git a/gcc/tree-browser.c b/gcc/tree-browser.c
index a7c80c991ec..3803a504185 100644
--- a/gcc/tree-browser.c
+++ b/gcc/tree-browser.c
@@ -108,7 +108,7 @@ void browse_tree (tree);
/* Static variables. */
static htab_t TB_up_ht;
-static tree TB_history_stack = NULL_TREE;
+static VEC(tree,gc) *TB_history_stack;
static int TB_verbose = 1;
@@ -126,7 +126,7 @@ browse_tree (tree begin)
fprintf (TB_OUT_FILE, "\nTree Browser\n");
#define TB_SET_HEAD(N) do { \
- TB_history_stack = tree_cons (NULL_TREE, (N), TB_history_stack); \
+ VEC_safe_push (tree, gc, TB_history_stack, N); \
head = N; \
if (TB_verbose) \
if (head) \
@@ -876,11 +876,11 @@ find_node_with_code (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
static tree
TB_history_prev (void)
{
- if (TB_history_stack)
+ if (!VEC_empty (tree, TB_history_stack))
{
- TB_history_stack = TREE_CHAIN (TB_history_stack);
- if (TB_history_stack)
- return TREE_VALUE (TB_history_stack);
+ tree last = VEC_last (tree, TB_history_stack);
+ VEC_pop (tree, TB_history_stack);
+ return last;
}
return NULL_TREE;
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 7db5192a2ea..3b8ab9d9e7d 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -436,13 +436,13 @@ create_bb (void *h, void *e, basic_block after)
gcc_assert (!e);
/* Create and initialize a new basic block. Since alloc_block uses
- ggc_alloc_cleared to allocate a basic block, we do not have to
- clear the newly allocated basic block here. */
+ GC allocation that clears memory to allocate a basic block, we do
+ not have to clear the newly allocated basic block here. */
bb = alloc_block ();
bb->index = last_basic_block;
bb->flags = BB_NEW;
- bb->il.gimple = GGC_CNEW (struct gimple_bb_info);
+ bb->il.gimple = ggc_alloc_cleared_gimple_bb_info ();
set_bb_seq (bb, h ? (gimple_seq) h : gimple_seq_alloc ());
/* Add the new block to the linked list of blocks. */
@@ -1475,6 +1475,23 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
&& name_mappings_registered_p ())
return false;
+ /* When not optimizing, don't merge if we'd lose goto_locus. */
+ if (!optimize
+ && single_succ_edge (a)->goto_locus != UNKNOWN_LOCATION)
+ {
+ location_t goto_locus = single_succ_edge (a)->goto_locus;
+ gimple_stmt_iterator prev, next;
+ prev = gsi_last_nondebug_bb (a);
+ next = gsi_after_labels (b);
+ if (!gsi_end_p (next) && is_gimple_debug (gsi_stmt (next)))
+ gsi_next_nondebug (&next);
+ if ((gsi_end_p (prev)
+ || gimple_location (gsi_stmt (prev)) != goto_locus)
+ && (gsi_end_p (next)
+ || gimple_location (gsi_stmt (next)) != goto_locus))
+ return false;
+ }
+
return true;
}
@@ -2516,6 +2533,49 @@ gimple_split_edge (edge edge_in)
return new_bb;
}
+
+/* Verify properties of the address expression T with base object BASE. */
+
+static tree
+verify_address (tree t, tree base)
+{
+ bool old_constant;
+ bool old_side_effects;
+ bool new_constant;
+ bool new_side_effects;
+
+ old_constant = TREE_CONSTANT (t);
+ old_side_effects = TREE_SIDE_EFFECTS (t);
+
+ recompute_tree_invariant_for_addr_expr (t);
+ new_side_effects = TREE_SIDE_EFFECTS (t);
+ new_constant = TREE_CONSTANT (t);
+
+ if (old_constant != new_constant)
+ {
+ error ("constant not recomputed when ADDR_EXPR changed");
+ return t;
+ }
+ if (old_side_effects != new_side_effects)
+ {
+ error ("side effects not recomputed when ADDR_EXPR changed");
+ return t;
+ }
+
+ if (!(TREE_CODE (base) == VAR_DECL
+ || TREE_CODE (base) == PARM_DECL
+ || TREE_CODE (base) == RESULT_DECL))
+ return NULL_TREE;
+
+ if (DECL_GIMPLE_REG_P (base))
+ {
+ error ("DECL_GIMPLE_REG_P set on a variable with address taken");
+ return base;
+ }
+
+ return NULL_TREE;
+}
+
/* Callback for walk_tree, check that all elements with address taken are
properly noticed as such. The DATA is an int* that is 1 if TP was seen
inside a PHI node. */
@@ -2544,12 +2604,26 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
break;
case INDIRECT_REF:
+ error ("INDIRECT_REF in gimple IL");
+ return t;
+
+ case MEM_REF:
x = TREE_OPERAND (t, 0);
- if (!is_gimple_reg (x) && !is_gimple_min_invariant (x))
+ if (!is_gimple_mem_ref_addr (x))
{
- error ("Indirect reference's operand is not a register or a constant.");
+ error ("Invalid first operand of MEM_REF.");
return x;
}
+ if (TREE_CODE (TREE_OPERAND (t, 1)) != INTEGER_CST
+ || !POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 1))))
+ {
+ error ("Invalid offset operand of MEM_REF.");
+ return TREE_OPERAND (t, 1);
+ }
+ if (TREE_CODE (x) == ADDR_EXPR
+ && (x = verify_address (x, TREE_OPERAND (x, 0))))
+ return x;
+ *walk_subtrees = 0;
break;
case ASSERT_EXPR:
@@ -2567,31 +2641,10 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
case ADDR_EXPR:
{
- bool old_constant;
- bool old_side_effects;
- bool new_constant;
- bool new_side_effects;
+ tree tem;
gcc_assert (is_gimple_address (t));
- old_constant = TREE_CONSTANT (t);
- old_side_effects = TREE_SIDE_EFFECTS (t);
-
- recompute_tree_invariant_for_addr_expr (t);
- new_side_effects = TREE_SIDE_EFFECTS (t);
- new_constant = TREE_CONSTANT (t);
-
- if (old_constant != new_constant)
- {
- error ("constant not recomputed when ADDR_EXPR changed");
- return t;
- }
- if (old_side_effects != new_side_effects)
- {
- error ("side effects not recomputed when ADDR_EXPR changed");
- return t;
- }
-
/* Skip any references (they will be checked when we recurse down the
tree) and ensure that any variable used as a prefix is marked
addressable. */
@@ -2600,20 +2653,19 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
x = TREE_OPERAND (x, 0))
;
+ if ((tem = verify_address (t, x)))
+ return tem;
+
if (!(TREE_CODE (x) == VAR_DECL
|| TREE_CODE (x) == PARM_DECL
|| TREE_CODE (x) == RESULT_DECL))
return NULL;
+
if (!TREE_ADDRESSABLE (x))
{
error ("address taken, but ADDRESSABLE bit not set");
return x;
}
- if (DECL_GIMPLE_REG_P (x))
- {
- error ("DECL_GIMPLE_REG_P set on a variable with address taken");
- return x;
- }
break;
}
@@ -2798,8 +2850,10 @@ verify_types_in_gimple_min_lval (tree expr)
if (is_gimple_id (expr))
return false;
- if (!INDIRECT_REF_P (expr)
- && TREE_CODE (expr) != TARGET_MEM_REF)
+ if (TREE_CODE (expr) != ALIGN_INDIRECT_REF
+ && TREE_CODE (expr) != MISALIGNED_INDIRECT_REF
+ && TREE_CODE (expr) != TARGET_MEM_REF
+ && TREE_CODE (expr) != MEM_REF)
{
error ("invalid expression for min lvalue");
return true;
@@ -2816,14 +2870,7 @@ verify_types_in_gimple_min_lval (tree expr)
debug_generic_stmt (op);
return true;
}
- if (!useless_type_conversion_p (TREE_TYPE (expr),
- TREE_TYPE (TREE_TYPE (op))))
- {
- error ("type mismatch in indirect reference");
- debug_generic_stmt (TREE_TYPE (expr));
- debug_generic_stmt (TREE_TYPE (TREE_TYPE (op)));
- return true;
- }
+ /* Memory references now generally can involve a value conversion. */
return false;
}
@@ -2910,6 +2957,13 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue)
debug_generic_stmt (expr);
return true;
}
+ else if (TREE_CODE (op) == SSA_NAME
+ && TYPE_SIZE (TREE_TYPE (expr)) != TYPE_SIZE (TREE_TYPE (op)))
+ {
+ error ("Conversion of register to a different size.");
+ debug_generic_stmt (expr);
+ return true;
+ }
else if (!handled_component_p (op))
return false;
}
@@ -2917,6 +2971,23 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue)
expr = op;
}
+ if (TREE_CODE (expr) == MEM_REF)
+ {
+ if (!is_gimple_mem_ref_addr (TREE_OPERAND (expr, 0)))
+ {
+ error ("Invalid address operand in MEM_REF.");
+ debug_generic_stmt (expr);
+ return true;
+ }
+ if (TREE_CODE (TREE_OPERAND (expr, 1)) != INTEGER_CST
+ || !POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 1))))
+ {
+ error ("Invalid offset operand in MEM_REF.");
+ debug_generic_stmt (expr);
+ return true;
+ }
+ }
+
return ((require_lvalue || !is_gimple_min_invariant (expr))
&& verify_types_in_gimple_min_lval (expr));
}
@@ -3516,6 +3587,65 @@ do_pointer_plus_expr_check:
return false;
}
+/* Verify a gimple assignment statement STMT with a ternary rhs.
+ Returns true if anything is wrong. */
+
+static bool
+verify_gimple_assign_ternary (gimple stmt)
+{
+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree lhs_type = TREE_TYPE (lhs);
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs1_type = TREE_TYPE (rhs1);
+ tree rhs2 = gimple_assign_rhs2 (stmt);
+ tree rhs2_type = TREE_TYPE (rhs2);
+ tree rhs3 = gimple_assign_rhs3 (stmt);
+ tree rhs3_type = TREE_TYPE (rhs3);
+
+ if (!is_gimple_reg (lhs)
+ && !(optimize == 0
+ && TREE_CODE (lhs_type) == COMPLEX_TYPE))
+ {
+ error ("non-register as LHS of ternary operation");
+ return true;
+ }
+
+ if (!is_gimple_val (rhs1)
+ || !is_gimple_val (rhs2)
+ || !is_gimple_val (rhs3))
+ {
+ error ("invalid operands in ternary operation");
+ return true;
+ }
+
+ /* First handle operations that involve different types. */
+ switch (rhs_code)
+ {
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
+ if ((!INTEGRAL_TYPE_P (rhs1_type)
+ && !FIXED_POINT_TYPE_P (rhs1_type))
+ || !useless_type_conversion_p (rhs1_type, rhs2_type)
+ || !useless_type_conversion_p (lhs_type, rhs3_type)
+ || 2 * TYPE_PRECISION (rhs1_type) != TYPE_PRECISION (lhs_type)
+ || TYPE_PRECISION (rhs1_type) != TYPE_PRECISION (rhs2_type))
+ {
+ error ("type mismatch in widening multiply-accumulate expression");
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
+ debug_generic_expr (rhs2_type);
+ debug_generic_expr (rhs3_type);
+ return true;
+ }
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ return false;
+}
+
/* Verify a gimple assignment statement STMT with a single rhs.
Returns true if anything is wrong. */
@@ -3566,9 +3696,12 @@ verify_gimple_assign_single (gimple stmt)
}
/* tcc_reference */
+ case INDIRECT_REF:
+ error ("INDIRECT_REF in gimple IL");
+ return true;
+
case COMPONENT_REF:
case BIT_FIELD_REF:
- case INDIRECT_REF:
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
case ARRAY_REF:
@@ -3577,6 +3710,7 @@ verify_gimple_assign_single (gimple stmt)
case REALPART_EXPR:
case IMAGPART_EXPR:
case TARGET_MEM_REF:
+ case MEM_REF:
if (!is_gimple_reg (lhs)
&& is_gimple_reg_type (TREE_TYPE (lhs)))
{
@@ -3662,6 +3796,9 @@ verify_gimple_assign (gimple stmt)
case GIMPLE_BINARY_RHS:
return verify_gimple_assign_binary (stmt);
+ case GIMPLE_TERNARY_RHS:
+ return verify_gimple_assign_ternary (stmt);
+
default:
gcc_unreachable ();
}
@@ -5713,21 +5850,6 @@ move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
return NULL_TREE;
}
-/* Marks virtual operands of all statements in basic blocks BBS for
- renaming. */
-
-void
-mark_virtual_ops_in_bb (basic_block bb)
-{
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- mark_virtual_ops_for_renaming (gsi_stmt (gsi));
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- mark_virtual_ops_for_renaming (gsi_stmt (gsi));
-}
-
/* Move basic block BB from function CFUN to function DEST_FN. The
block is moved out of the original linked list and placed after
block AFTER in the new list. Also, the block is removed from the
@@ -7239,22 +7361,24 @@ struct gimple_opt_pass pass_warn_function_return =
static unsigned int
execute_warn_function_noreturn (void)
{
- if (warn_missing_noreturn
- && !TREE_THIS_VOLATILE (cfun->decl)
- && EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0
- && !lang_hooks.missing_noreturn_ok_p (cfun->decl))
- warning_at (DECL_SOURCE_LOCATION (cfun->decl), OPT_Wmissing_noreturn,
- "function might be possible candidate "
- "for attribute %<noreturn%>");
+ if (!TREE_THIS_VOLATILE (current_function_decl)
+ && EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0)
+ warn_function_noreturn (current_function_decl);
return 0;
}
+static bool
+gate_warn_function_noreturn (void)
+{
+ return warn_suggest_attribute_noreturn;
+}
+
struct gimple_opt_pass pass_warn_function_noreturn =
{
{
GIMPLE_PASS,
"*warn_function_noreturn", /* name */
- NULL, /* gate */
+ gate_warn_function_noreturn, /* gate */
execute_warn_function_noreturn, /* execute */
NULL, /* sub */
NULL, /* next */
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index fc2141f48c1..7f8498a4483 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -559,22 +559,41 @@ fixup_noreturn_call (gimple stmt)
{
tree op = gimple_call_lhs (stmt);
gimple_call_set_lhs (stmt, NULL_TREE);
- /* We need to remove SSA name to avoid checking.
+
+ /* We need to remove SSA name to avoid checking errors.
All uses are dominated by the noreturn and thus will
- be removed afterwards. */
+ be removed afterwards.
+ We proactively remove affected non-PHI statements to avoid
+ fixup_cfg from trying to update them and crashing. */
if (TREE_CODE (op) == SSA_NAME)
{
use_operand_p use_p;
imm_use_iterator iter;
gimple use_stmt;
+ bitmap_iterator bi;
+ unsigned int bb_index;
+
+ bitmap blocks = BITMAP_ALLOC (NULL);
FOR_EACH_IMM_USE_STMT (use_stmt, iter, op)
- FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
- SET_USE (use_p, error_mark_node);
+ {
+ if (gimple_code (use_stmt) != GIMPLE_PHI)
+ bitmap_set_bit (blocks, gimple_bb (use_stmt)->index);
+ else
+ FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+ SET_USE (use_p, error_mark_node);
+ }
+ EXECUTE_IF_SET_IN_BITMAP (blocks, 0, bb_index, bi)
+ delete_basic_block (BASIC_BLOCK (bb_index));
+ BITMAP_FREE (blocks);
+ release_ssa_name (op);
}
update_stmt (stmt);
changed = true;
}
+ /* Similarly remove VDEF if there is any. */
+ else if (gimple_vdef (stmt))
+ update_stmt (stmt);
return changed;
}
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 24e1944da69..2d152858c4d 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -1230,13 +1230,15 @@ convert_affine_scev (struct loop *loop, tree type,
}
-/* Convert CHREC for the right hand side of a CREC.
+/* Convert CHREC for the right hand side of a CHREC.
The increment for a pointer type is always sizetype. */
+
tree
chrec_convert_rhs (tree type, tree chrec, gimple at_stmt)
{
if (POINTER_TYPE_P (type))
- type = sizetype;
+ type = sizetype;
+
return chrec_convert (type, chrec, at_stmt);
}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index c491ac8173c..77b5c6a85fd 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -596,10 +596,10 @@ extract_component (gimple_stmt_iterator *gsi, tree t, bool imagpart_p,
case VAR_DECL:
case RESULT_DECL:
case PARM_DECL:
- case INDIRECT_REF:
case COMPONENT_REF:
case ARRAY_REF:
case VIEW_CONVERT_EXPR:
+ case MEM_REF:
{
tree inner_type = TREE_TYPE (TREE_TYPE (t));
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index c41cf51f775..7ab7779c569 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -746,7 +746,22 @@ dr_analyze_innermost (struct data_reference *dr)
return false;
}
- base = build_fold_addr_expr (base);
+ if (TREE_CODE (base) == MEM_REF)
+ {
+ if (!integer_zerop (TREE_OPERAND (base, 1)))
+ {
+ if (!poffset)
+ {
+ double_int moff = mem_ref_offset (base);
+ poffset = double_int_to_tree (sizetype, moff);
+ }
+ else
+ poffset = size_binop (PLUS_EXPR, poffset, TREE_OPERAND (base, 1));
+ }
+ base = TREE_OPERAND (base, 0);
+ }
+ else
+ base = build_fold_addr_expr (base);
if (in_loop)
{
if (!simple_iv (loop, loop_containing_stmt (stmt), base, &base_iv,
@@ -844,13 +859,18 @@ dr_analyze_indices (struct data_reference *dr, struct loop *nest)
aref = TREE_OPERAND (aref, 0);
}
- if (nest && INDIRECT_REF_P (aref))
+ if (nest
+ && (INDIRECT_REF_P (aref)
+ || TREE_CODE (aref) == MEM_REF))
{
op = TREE_OPERAND (aref, 0);
access_fn = analyze_scalar_evolution (loop, op);
access_fn = instantiate_scev (before_loop, loop, access_fn);
base = initial_condition (access_fn);
split_constant_offset (base, &base, &off);
+ if (TREE_CODE (aref) == MEM_REF)
+ off = size_binop (PLUS_EXPR, off,
+ fold_convert (ssizetype, TREE_OPERAND (aref, 1)));
access_fn = chrec_replace_initial_condition (access_fn,
fold_convert (TREE_TYPE (base), off));
@@ -858,6 +878,22 @@ dr_analyze_indices (struct data_reference *dr, struct loop *nest)
VEC_safe_push (tree, heap, access_fns, access_fn);
}
+ if (TREE_CODE (aref) == MEM_REF)
+ TREE_OPERAND (aref, 1)
+ = build_int_cst (TREE_TYPE (TREE_OPERAND (aref, 1)), 0);
+
+ if (TREE_CODE (ref) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (ref, 0)) == ADDR_EXPR
+ && integer_zerop (TREE_OPERAND (ref, 1)))
+ ref = TREE_OPERAND (TREE_OPERAND (ref, 0), 0);
+
+ /* For canonicalization purposes we'd like to strip all outermost
+ zero-offset component-refs.
+ ??? For now simply handle zero-index array-refs. */
+ while (TREE_CODE (ref) == ARRAY_REF
+ && integer_zerop (TREE_OPERAND (ref, 1)))
+ ref = TREE_OPERAND (ref, 0);
+
DR_BASE_OBJECT (dr) = ref;
DR_ACCESS_FNS (dr) = access_fns;
}
@@ -870,7 +906,8 @@ dr_analyze_alias (struct data_reference *dr)
tree ref = DR_REF (dr);
tree base = get_base_address (ref), addr;
- if (INDIRECT_REF_P (base))
+ if (INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF)
{
addr = TREE_OPERAND (base, 0);
if (TREE_CODE (addr) == SSA_NAME)
@@ -1188,7 +1225,8 @@ object_address_invariant_in_loop_p (const struct loop *loop, const_tree obj)
obj = TREE_OPERAND (obj, 0);
}
- if (!INDIRECT_REF_P (obj))
+ if (!INDIRECT_REF_P (obj)
+ && TREE_CODE (obj) != MEM_REF)
return true;
return !chrec_contains_symbols_defined_in_loop (TREE_OPERAND (obj, 0),
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index ad03cd235c6..467a6781d7c 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
+#include "toplev.h"
#include "hashtab.h"
#include "pointer-set.h"
#include "tree.h"
@@ -134,7 +135,7 @@ create_var_ann (tree t)
|| TREE_CODE (t) == PARM_DECL
|| TREE_CODE (t) == RESULT_DECL);
- ann = GGC_CNEW (struct var_ann_d);
+ ann = ggc_alloc_cleared_var_ann_d ();
*DECL_VAR_ANN_PTR (t) = ann;
return ann;
@@ -242,8 +243,6 @@ debug_referenced_vars (void)
void
dump_variable (FILE *file, tree var)
{
- var_ann_t ann;
-
if (TREE_CODE (var) == SSA_NAME)
{
if (POINTER_TYPE_P (TREE_TYPE (var)))
@@ -259,8 +258,6 @@ dump_variable (FILE *file, tree var)
print_generic_expr (file, var, dump_flags);
- ann = var_ann (var);
-
fprintf (file, ", UID D.%u", (unsigned) DECL_UID (var));
if (DECL_PT_UID (var) != DECL_UID (var))
fprintf (file, ", PT-UID D.%u", (unsigned) DECL_PT_UID (var));
@@ -277,14 +274,6 @@ dump_variable (FILE *file, tree var)
if (TREE_THIS_VOLATILE (var))
fprintf (file, ", is volatile");
- if (ann && ann->noalias_state == NO_ALIAS)
- fprintf (file, ", NO_ALIAS (does not alias other NO_ALIAS symbols)");
- else if (ann && ann->noalias_state == NO_ALIAS_GLOBAL)
- fprintf (file, ", NO_ALIAS_GLOBAL (does not alias other NO_ALIAS symbols"
- " and global vars)");
- else if (ann && ann->noalias_state == NO_ALIAS_ANYTHING)
- fprintf (file, ", NO_ALIAS_ANYTHING (does not alias any other symbols)");
-
if (cfun && gimple_default_def (cfun, var))
{
fprintf (file, ", default def: ");
@@ -867,6 +856,29 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
case VIEW_CONVERT_EXPR:
break;
+ case MEM_REF:
+ /* Hand back the decl for MEM[&decl, off]. */
+ if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR)
+ {
+ if (integer_zerop (TREE_OPERAND (exp, 1)))
+ exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
+ else
+ {
+ double_int off = mem_ref_offset (exp);
+ off = double_int_lshift (off,
+ BITS_PER_UNIT == 8
+ ? 3 : exact_log2 (BITS_PER_UNIT),
+ HOST_BITS_PER_DOUBLE_INT, true);
+ off = double_int_add (off, shwi_to_double_int (bit_offset));
+ if (double_int_fits_in_shwi_p (off))
+ {
+ bit_offset = double_int_to_shwi (off);
+ exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
+ }
+ }
+ }
+ goto done;
+
default:
goto done;
}
@@ -913,6 +925,104 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
return exp;
}
+/* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that
+ denotes the starting address of the memory access EXP.
+ Returns NULL_TREE if the offset is not constant or any component
+ is not BITS_PER_UNIT-aligned. */
+
+tree
+get_addr_base_and_unit_offset (tree exp, HOST_WIDE_INT *poffset)
+{
+ HOST_WIDE_INT byte_offset = 0;
+
+ /* Compute cumulative byte-offset for nested component-refs and array-refs,
+ and find the ultimate containing object. */
+ while (1)
+ {
+ switch (TREE_CODE (exp))
+ {
+ case BIT_FIELD_REF:
+ return NULL_TREE;
+
+ case COMPONENT_REF:
+ {
+ tree field = TREE_OPERAND (exp, 1);
+ tree this_offset = component_ref_field_offset (exp);
+ HOST_WIDE_INT hthis_offset;
+
+ if (!this_offset
+ || TREE_CODE (this_offset) != INTEGER_CST
+ || (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))
+ % BITS_PER_UNIT))
+ return NULL_TREE;
+
+ hthis_offset = TREE_INT_CST_LOW (this_offset);
+ hthis_offset += (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))
+ / BITS_PER_UNIT);
+ byte_offset += hthis_offset;
+ }
+ break;
+
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ {
+ tree index = TREE_OPERAND (exp, 1);
+ tree low_bound, unit_size;
+
+ /* If the resulting bit-offset is constant, track it. */
+ if (TREE_CODE (index) == INTEGER_CST
+ && (low_bound = array_ref_low_bound (exp),
+ TREE_CODE (low_bound) == INTEGER_CST)
+ && (unit_size = array_ref_element_size (exp),
+ TREE_CODE (unit_size) == INTEGER_CST))
+ {
+ HOST_WIDE_INT hindex = TREE_INT_CST_LOW (index);
+
+ hindex -= TREE_INT_CST_LOW (low_bound);
+ hindex *= TREE_INT_CST_LOW (unit_size);
+ byte_offset += hindex;
+ }
+ else
+ return NULL_TREE;
+ }
+ break;
+
+ case REALPART_EXPR:
+ break;
+
+ case IMAGPART_EXPR:
+ byte_offset += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (exp)));
+ break;
+
+ case VIEW_CONVERT_EXPR:
+ break;
+
+ case MEM_REF:
+ /* Hand back the decl for MEM[&decl, off]. */
+ if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR)
+ {
+ if (!integer_zerop (TREE_OPERAND (exp, 1)))
+ {
+ double_int off = mem_ref_offset (exp);
+ gcc_assert (off.high == -1 || off.high == 0);
+ byte_offset += double_int_to_shwi (off);
+ }
+ exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
+ }
+ goto done;
+
+ default:
+ goto done;
+ }
+
+ exp = TREE_OPERAND (exp, 0);
+ }
+done:
+
+ *poffset = byte_offset;
+ return exp;
+}
+
/* Returns true if STMT references an SSA_NAME that has
SSA_NAME_OCCURS_IN_ABNORMAL_PHI set, otherwise false. */
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 9c17c1e092e..c117013810d 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -96,7 +96,7 @@ add_stmt_to_eh_lp_fn (struct function *ifun, gimple t, int num)
gcc_assert (num != 0);
- n = GGC_NEW (struct throw_stmt_node);
+ n = ggc_alloc_throw_stmt_node ();
n->stmt = t;
n->lp_nr = num;
@@ -951,12 +951,12 @@ lower_try_finally_fallthru_label (struct leh_tf_state *tf)
return label;
}
-/* A subroutine of lower_try_finally. If lang_protect_cleanup_actions
- returns non-null, then the language requires that the exception path out
- of a try_finally be treated specially. To wit: the code within the
- finally block may not itself throw an exception. We have two choices here.
- First we can duplicate the finally block and wrap it in a must_not_throw
- region. Second, we can generate code like
+/* A subroutine of lower_try_finally. If the eh_protect_cleanup_actions
+ langhook returns non-null, then the language requires that the exception
+ path out of a try_finally be treated specially. To wit: the code within
+ the finally block may not itself throw an exception. We have two choices
+ here. First we can duplicate the finally block and wrap it in a
+ must_not_throw region. Second, we can generate code like
try {
finally_block;
@@ -983,9 +983,9 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
gimple x;
/* First check for nothing to do. */
- if (lang_protect_cleanup_actions == NULL)
+ if (lang_hooks.eh_protect_cleanup_actions == NULL)
return;
- protect_cleanup_actions = lang_protect_cleanup_actions ();
+ protect_cleanup_actions = lang_hooks.eh_protect_cleanup_actions ();
if (protect_cleanup_actions == NULL)
return;
@@ -2437,6 +2437,10 @@ tree_could_trap_p (tree expr)
return false;
return !in_array_bounds_p (expr);
+ case MEM_REF:
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR)
+ return false;
+ /* Fallthru. */
case INDIRECT_REF:
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index f7609ea7911..7e935378c81 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -48,7 +48,7 @@ gimple_referenced_vars (const struct function *fun)
static inline tree
gimple_vop (const struct function *fun)
{
- gcc_assert (fun && fun->gimple_df);
+ gcc_checking_assert (fun && fun->gimple_df);
return fun->gimple_df->vop;
}
@@ -141,7 +141,7 @@ static inline var_ann_t
get_var_ann (tree var)
{
var_ann_t *p = DECL_VAR_ANN_PTR (var);
- gcc_assert (p);
+ gcc_checking_assert (p);
return *p ? *p : create_var_ann (var);
}
@@ -222,7 +222,7 @@ link_imm_use (ssa_use_operand_t *linknode, tree def)
root = &(SSA_NAME_IMM_USE_NODE (def));
#ifdef ENABLE_CHECKING
if (linknode->use)
- gcc_assert (*(linknode->use) == def);
+ gcc_checking_assert (*(linknode->use) == def);
#endif
link_imm_use_to_list (linknode, root);
}
@@ -254,7 +254,7 @@ static inline void
relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old)
{
/* The node one had better be in the same list. */
- gcc_assert (*(old->use) == *(node->use));
+ gcc_checking_assert (*(old->use) == *(node->use));
node->prev = old->prev;
node->next = old->next;
if (old->prev)
@@ -507,7 +507,7 @@ gimple_phi_arg_has_location (gimple gs, size_t i)
static inline gimple_seq
phi_nodes (const_basic_block bb)
{
- gcc_assert (!(bb->flags & BB_RTL));
+ gcc_checking_assert (!(bb->flags & BB_RTL));
if (!bb->il.gimple)
return NULL;
return bb->il.gimple->phi_nodes;
@@ -520,7 +520,7 @@ set_phi_nodes (basic_block bb, gimple_seq seq)
{
gimple_stmt_iterator i;
- gcc_assert (!(bb->flags & BB_RTL));
+ gcc_checking_assert (!(bb->flags & BB_RTL));
bb->il.gimple->phi_nodes = seq;
if (seq)
for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
@@ -541,7 +541,6 @@ phi_arg_index_from_use (use_operand_p use)
pointer arithmetic. */
phi = USE_STMT (use);
- gcc_assert (gimple_code (phi) == GIMPLE_PHI);
element = (struct phi_arg_d *)use;
root = gimple_phi_arg (phi, 0);
@@ -641,9 +640,7 @@ static inline use_operand_p
op_iter_next_use (ssa_op_iter *ptr)
{
use_operand_p use_p;
-#ifdef ENABLE_CHECKING
- gcc_assert (ptr->iter_type == ssa_op_iter_use);
-#endif
+ gcc_checking_assert (ptr->iter_type == ssa_op_iter_use);
if (ptr->uses)
{
use_p = USE_OP_PTR (ptr->uses);
@@ -663,9 +660,7 @@ static inline def_operand_p
op_iter_next_def (ssa_op_iter *ptr)
{
def_operand_p def_p;
-#ifdef ENABLE_CHECKING
- gcc_assert (ptr->iter_type == ssa_op_iter_def);
-#endif
+ gcc_checking_assert (ptr->iter_type == ssa_op_iter_def);
if (ptr->defs)
{
def_p = DEF_OP_PTR (ptr->defs);
@@ -681,9 +676,7 @@ static inline tree
op_iter_next_tree (ssa_op_iter *ptr)
{
tree val;
-#ifdef ENABLE_CHECKING
- gcc_assert (ptr->iter_type == ssa_op_iter_tree);
-#endif
+ gcc_checking_assert (ptr->iter_type == ssa_op_iter_tree);
if (ptr->uses)
{
val = USE_OP (ptr->uses);
@@ -725,8 +718,8 @@ op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags)
{
/* We do not support iterating over virtual defs or uses without
iterating over defs or uses at the same time. */
- gcc_assert ((!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF))
- && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE)));
+ gcc_checking_assert ((!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF))
+ && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE)));
ptr->defs = (flags & (SSA_OP_DEF|SSA_OP_VDEF)) ? gimple_def_ops (stmt) : NULL;
if (!(flags & SSA_OP_VDEF)
&& ptr->defs
@@ -749,8 +742,8 @@ op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags)
static inline use_operand_p
op_iter_init_use (ssa_op_iter *ptr, gimple stmt, int flags)
{
- gcc_assert ((flags & SSA_OP_ALL_DEFS) == 0
- && (flags & SSA_OP_USE));
+ gcc_checking_assert ((flags & SSA_OP_ALL_DEFS) == 0
+ && (flags & SSA_OP_USE));
op_iter_init (ptr, stmt, flags);
ptr->iter_type = ssa_op_iter_use;
return op_iter_next_use (ptr);
@@ -761,8 +754,8 @@ op_iter_init_use (ssa_op_iter *ptr, gimple stmt, int flags)
static inline def_operand_p
op_iter_init_def (ssa_op_iter *ptr, gimple stmt, int flags)
{
- gcc_assert ((flags & SSA_OP_ALL_USES) == 0
- && (flags & SSA_OP_DEF));
+ gcc_checking_assert ((flags & SSA_OP_ALL_USES) == 0
+ && (flags & SSA_OP_DEF));
op_iter_init (ptr, stmt, flags);
ptr->iter_type = ssa_op_iter_def;
return op_iter_next_def (ptr);
@@ -897,7 +890,7 @@ op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags)
clear_and_done_ssa_iter (ptr);
ptr->done = false;
- gcc_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
+ gcc_checking_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
@@ -926,7 +919,7 @@ op_iter_init_phidef (ssa_op_iter *ptr, gimple phi, int flags)
clear_and_done_ssa_iter (ptr);
ptr->done = false;
- gcc_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
+ gcc_checking_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS);
@@ -1120,27 +1113,13 @@ unmodifiable_var_p (const_tree var)
return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
}
-/* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it. */
-
-static inline bool
-array_ref_contains_indirect_ref (const_tree ref)
-{
- gcc_assert (TREE_CODE (ref) == ARRAY_REF);
-
- do {
- ref = TREE_OPERAND (ref, 0);
- } while (handled_component_p (ref));
-
- return TREE_CODE (ref) == INDIRECT_REF;
-}
-
/* Return true if REF, a handled component reference, has an ARRAY_REF
somewhere in it. */
static inline bool
ref_contains_array_ref (const_tree ref)
{
- gcc_assert (handled_component_p (ref));
+ gcc_checking_assert (handled_component_p (ref));
do {
if (TREE_CODE (ref) == ARRAY_REF)
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index f28ef31c2a9..fb1373a1ad0 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -147,29 +147,6 @@ enum need_phi_state {
};
-/* The "no alias" attribute allows alias analysis to make more
- aggressive assumptions when assigning alias sets, computing
- points-to information and memory partitions. These attributes
- are the result of user annotations or flags (e.g.,
- -fargument-noalias). */
-enum noalias_state {
- /* Default state. No special assumptions can be made about this
- symbol. */
- MAY_ALIAS = 0,
-
- /* The symbol does not alias with other symbols that have a
- NO_ALIAS* attribute. */
- NO_ALIAS,
-
- /* The symbol does not alias with other symbols that have a
- NO_ALIAS*, and it may not alias with global symbols. */
- NO_ALIAS_GLOBAL,
-
- /* The symbol does not alias with any other symbols. */
- NO_ALIAS_ANYTHING
-};
-
-
struct GTY(()) var_ann_d {
/* Used when building base variable structures in a var_map. */
unsigned base_var_processed : 1;
@@ -187,11 +164,6 @@ struct GTY(()) var_ann_d {
the memory area allocated by a call to malloc. */
unsigned is_heapvar : 1;
- /* This field describes several "no alias" attributes that some
- symbols are known to have. See the enum's definition for more
- information on each attribute. */
- ENUM_BITFIELD (noalias_state) noalias_state : 2;
-
/* Used by var_map for the base index of ssa base variables. */
unsigned base_index;
@@ -486,7 +458,6 @@ extern void end_recording_case_labels (void);
extern basic_block move_sese_region_to_fn (struct function *, basic_block,
basic_block, tree);
void remove_edge_and_dominated_blocks (edge);
-void mark_virtual_ops_in_bb (basic_block);
bool tree_node_can_be_shared (tree);
/* In tree-cfgcleanup.c */
@@ -520,6 +491,7 @@ extern tree gimple_default_def (struct function *, tree);
extern bool stmt_references_abnormal_ssa_name (gimple);
extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
HOST_WIDE_INT *, HOST_WIDE_INT *);
+extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
extern void find_referenced_vars_in (gimple);
/* In tree-phinodes.c */
@@ -541,7 +513,6 @@ extern void phinodes_print_statistics (void);
/* In gimple-low.c */
extern void record_vars_into (tree, tree);
extern void record_vars (tree);
-extern bool block_may_fallthru (const_tree);
extern bool gimple_seq_may_fallthru (gimple_seq);
extern bool gimple_stmt_may_fallthru (gimple);
extern bool gimple_check_call_args (gimple);
@@ -602,6 +573,7 @@ void release_ssa_name_after_update_ssa (tree);
void compute_global_livein (bitmap, bitmap);
void mark_sym_for_renaming (tree);
void mark_set_for_renaming (bitmap);
+bool symbol_marked_for_renaming (tree);
tree get_current_def (tree);
void set_current_def (tree, tree);
@@ -779,7 +751,6 @@ char *get_lsm_tmp_name (tree, unsigned);
static inline void set_is_used (tree);
static inline bool unmodifiable_var_p (const_tree);
static inline bool ref_contains_array_ref (const_tree);
-static inline bool array_ref_contains_indirect_ref (const_tree);
/* In tree-eh.c */
extern void make_eh_edges (gimple);
@@ -872,6 +843,9 @@ unsigned int execute_free_datastructures (void);
unsigned int execute_fixup_cfg (void);
bool fixup_noreturn_call (gimple stmt);
+/* In ipa-pure-const.c */
+void warn_function_noreturn (tree);
+
#include "tree-flow-inline.h"
void swap_tree_operands (gimple, tree *, tree *);
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 25cb9183739..8d5d2268ec5 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -98,10 +98,121 @@ along with GCC; see the file COPYING3. If not see
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-pass.h"
+#include "dbgcnt.h"
/* List of basic blocks in if-conversion-suitable order. */
static basic_block *ifc_bbs;
+/* Structure used to predicate basic blocks. This is attached to the
+ ->aux field of the BBs in the loop to be if-converted. */
+typedef struct bb_predicate_s {
+
+ /* The condition under which this basic block is executed. */
+ tree predicate;
+
+ /* PREDICATE is gimplified, and the sequence of statements is
+ recorded here, in order to avoid the duplication of computations
+ that occur in previous conditions. See PR44483. */
+ gimple_seq predicate_gimplified_stmts;
+} *bb_predicate_p;
+
+/* Returns true when the basic block BB has a predicate. */
+
+static inline bool
+bb_has_predicate (basic_block bb)
+{
+ return bb->aux != NULL;
+}
+
+/* Returns the gimplified predicate for basic block BB. */
+
+static inline tree
+bb_predicate (basic_block bb)
+{
+ return ((bb_predicate_p) bb->aux)->predicate;
+}
+
+/* Sets the gimplified predicate COND for basic block BB. */
+
+static inline void
+set_bb_predicate (basic_block bb, tree cond)
+{
+ ((bb_predicate_p) bb->aux)->predicate = cond;
+}
+
+/* Returns the sequence of statements of the gimplification of the
+ predicate for basic block BB. */
+
+static inline gimple_seq
+bb_predicate_gimplified_stmts (basic_block bb)
+{
+ return ((bb_predicate_p) bb->aux)->predicate_gimplified_stmts;
+}
+
+/* Sets the sequence of statements STMTS of the gimplification of the
+ predicate for basic block BB. */
+
+static inline void
+set_bb_predicate_gimplified_stmts (basic_block bb, gimple_seq stmts)
+{
+ ((bb_predicate_p) bb->aux)->predicate_gimplified_stmts = stmts;
+}
+
+/* Adds the sequence of statements STMTS to the sequence of statements
+ of the predicate for basic block BB. */
+
+static inline void
+add_bb_predicate_gimplified_stmts (basic_block bb, gimple_seq stmts)
+{
+ gimple_seq_add_seq
+ (&(((bb_predicate_p) bb->aux)->predicate_gimplified_stmts), stmts);
+}
+
+/* Initializes to TRUE the predicate of basic block BB. */
+
+static inline void
+init_bb_predicate (basic_block bb)
+{
+ bb->aux = XNEW (struct bb_predicate_s);
+ set_bb_predicate_gimplified_stmts (bb, NULL);
+ set_bb_predicate (bb, boolean_true_node);
+}
+
+/* Free the predicate of basic block BB. */
+
+static inline void
+free_bb_predicate (basic_block bb)
+{
+ gimple_seq stmts;
+
+ if (!bb_has_predicate (bb))
+ return;
+
+ /* Release the SSA_NAMEs created for the gimplification of the
+ predicate. */
+ stmts = bb_predicate_gimplified_stmts (bb);
+ if (stmts)
+ {
+ gimple_stmt_iterator i;
+
+ for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
+ free_stmt_operands (gsi_stmt (i));
+ }
+
+ free (bb->aux);
+ bb->aux = NULL;
+}
+
+/* Free the predicate of BB and reinitialize it with the true
+ predicate. */
+
+static inline void
+reset_bb_predicate (basic_block bb)
+{
+ free_bb_predicate (bb);
+ init_bb_predicate (bb);
+}
+
/* Create a new temp variable of type TYPE. Add GIMPLE_ASSIGN to assign EXP
to the new variable. */
@@ -145,7 +256,7 @@ is_true_predicate (tree cond)
static inline bool
is_predicated (basic_block bb)
{
- return !is_true_predicate ((tree) bb->aux);
+ return !is_true_predicate (bb_predicate (bb));
}
/* Add condition NEW_COND to the predicate list of basic block BB. */
@@ -153,12 +264,12 @@ is_predicated (basic_block bb)
static inline void
add_to_predicate_list (basic_block bb, tree new_cond)
{
- tree cond = (tree) bb->aux;
+ tree cond = bb_predicate (bb);
- bb->aux = is_true_predicate (cond) ? new_cond :
- fold_build2_loc (EXPR_LOCATION (cond),
- TRUTH_OR_EXPR, boolean_type_node,
- cond, new_cond);
+ set_bb_predicate (bb, is_true_predicate (cond) ? new_cond :
+ fold_build2_loc (EXPR_LOCATION (cond),
+ TRUTH_OR_EXPR, boolean_type_node,
+ cond, new_cond));
}
/* Add the condition COND to the previous condition PREV_COND, and add
@@ -471,7 +582,7 @@ get_loop_body_in_if_conv_order (const struct loop *loop)
/* Returns true when the analysis of the predicates for all the basic
blocks in LOOP succeeded.
- predicate_bbs first clears the ->aux fields of the basic blocks.
+ predicate_bbs first allocates the predicates of the basic blocks.
These fields are then initialized with the tree expressions
representing the predicates under which a basic block is executed
in the LOOP. As the loop->header is executed at each iteration, it
@@ -492,14 +603,32 @@ predicate_bbs (loop_p loop)
unsigned int i;
for (i = 0; i < loop->num_nodes; i++)
- ifc_bbs[i]->aux = NULL;
+ init_bb_predicate (ifc_bbs[i]);
for (i = 0; i < loop->num_nodes; i++)
{
- basic_block bb = ifc_bbs [i];
- tree cond = (tree) bb->aux;
+ basic_block bb = ifc_bbs[i];
+ tree cond;
gimple_stmt_iterator itr;
+ /* The loop latch is always executed and has no extra conditions
+ to be processed: skip it. */
+ if (bb == loop->latch)
+ {
+ reset_bb_predicate (loop->latch);
+ continue;
+ }
+
+ cond = bb_predicate (bb);
+ if (cond
+ && bb != loop->header)
+ {
+ gimple_seq stmts;
+
+ cond = force_gimple_operand (cond, &stmts, true, NULL_TREE);
+ add_bb_predicate_gimplified_stmts (bb, stmts);
+ }
+
for (itr = gsi_start_bb (bb); !gsi_end_p (itr); gsi_next (&itr))
{
gimple stmt = gsi_stmt (itr);
@@ -522,11 +651,10 @@ predicate_bbs (loop_p loop)
gimple_cond_lhs (stmt),
gimple_cond_rhs (stmt));
+ /* Add new condition into destination's predicate list. */
extract_true_false_edges_from_block (gimple_bb (stmt),
&true_edge, &false_edge);
- /* Add new condition into destination's predicate list. */
-
/* If C is true, then TRUE_EDGE is taken. */
add_to_dst_predicate_list (loop, true_edge, cond, c);
@@ -561,7 +689,9 @@ predicate_bbs (loop_p loop)
}
/* The loop header is always executed. */
- loop->header->aux = boolean_true_node;
+ reset_bb_predicate (loop->header);
+ gcc_assert (bb_predicate_gimplified_stmts (loop->header) == NULL
+ && bb_predicate_gimplified_stmts (loop->latch) == NULL);
return true;
}
@@ -679,27 +809,12 @@ if_convertible_loop_p (struct loop *loop)
return true;
}
-/* During if-conversion, the bb->aux field is used to hold a predicate
- list. This function cleans for all the basic blocks in the given
- LOOP their predicate list. */
-
-static void
-clean_predicate_lists (struct loop *loop)
-{
- unsigned int i;
- basic_block *bbs = get_loop_body (loop);
-
- for (i = 0; i < loop->num_nodes; i++)
- bbs[i]->aux = NULL;
-
- free (bbs);
-}
-
-/* Basic block BB has two predecessors. Using predecessor's bb->aux
- field, set appropriate condition COND for the PHI node replacement.
- Return true block whose phi arguments are selected when cond is
- true. LOOP is the loop containing the if-converted region, GSI is
- the place to insert the code for the if-conversion. */
+/* Basic block BB has two predecessors. Using predecessor's bb
+ predicate, set an appropriate condition COND for the PHI node
+ replacement. Return the true block whose phi arguments are
+ selected when cond is true. LOOP is the loop containing the
+ if-converted region, GSI is the place to insert the code for the
+ if-conversion. */
static basic_block
find_phi_replacement_condition (struct loop *loop,
@@ -738,7 +853,7 @@ find_phi_replacement_condition (struct loop *loop,
See PR23115. */
/* Select condition that is not TRUTH_NOT_EXPR. */
- tmp_cond = (tree) (first_edge->src)->aux;
+ tmp_cond = bb_predicate (first_edge->src);
gcc_assert (tmp_cond);
if (TREE_CODE (tmp_cond) == TRUTH_NOT_EXPR)
@@ -756,7 +871,7 @@ find_phi_replacement_condition (struct loop *loop,
|| dominated_by_p (CDI_DOMINATORS,
second_edge->src, first_edge->src))
{
- *cond = (tree) (second_edge->src)->aux;
+ *cond = bb_predicate (second_edge->src);
if (TREE_CODE (*cond) == TRUTH_NOT_EXPR)
*cond = invert_truthvalue (*cond);
@@ -765,7 +880,7 @@ find_phi_replacement_condition (struct loop *loop,
first_edge = second_edge;
}
else
- *cond = (tree) (first_edge->src)->aux;
+ *cond = bb_predicate (first_edge->src);
/* Gimplify the condition: the vectorizer prefers to have gimple
values as conditions. Various targets use different means to
@@ -851,11 +966,11 @@ replace_phi_with_cond_gimple_assign_stmt (gimple phi, tree cond,
}
}
-/* Process phi nodes for the given LOOP. Replace phi nodes with
- conditional modify expressions. */
+/* Replaces in LOOP all the phi nodes other than those in the
+ LOOP->header block with conditional modify expressions. */
static void
-process_phi_nodes (struct loop *loop)
+ifconvert_phi_nodes (struct loop *loop)
{
basic_block bb;
unsigned int orig_loop_num_nodes = loop->num_nodes;
@@ -873,12 +988,13 @@ process_phi_nodes (struct loop *loop)
continue;
phi_gsi = gsi_start_phis (bb);
- gsi = gsi_after_labels (bb);
+ if (gsi_end_p (phi_gsi))
+ continue;
/* BB has two predecessors. Using predecessor's aux field, set
appropriate condition for the PHI node replacement. */
- if (!gsi_end_p (phi_gsi))
- true_bb = find_phi_replacement_condition (loop, bb, &cond, &gsi);
+ gsi = gsi_after_labels (bb);
+ true_bb = find_phi_replacement_condition (loop, bb, &cond, &gsi);
while (!gsi_end_p (phi_gsi))
{
@@ -887,10 +1003,49 @@ process_phi_nodes (struct loop *loop)
release_phi_node (phi);
gsi_next (&phi_gsi);
}
+
set_phi_nodes (bb, NULL);
}
}
+/* Insert in each basic block of LOOP the statements produced by the
+ gimplification of the predicates. */
+
+static void
+insert_gimplified_predicates (loop_p loop)
+{
+ unsigned int i;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ basic_block bb = ifc_bbs[i];
+ gimple_seq stmts = bb_predicate_gimplified_stmts (bb);
+
+ if (!is_predicated (bb))
+ {
+ /* Do not insert statements for a basic block that is not
+ predicated. Also make sure that the predicate of the
+ basic block is set to true. */
+ reset_bb_predicate (bb);
+ continue;
+ }
+
+ if (stmts)
+ {
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
+
+ if (gsi_end_p (gsi)
+ || gimple_code (gsi_stmt (gsi)) == GIMPLE_COND)
+ gsi_insert_seq_before (&gsi, stmts, GSI_SAME_STMT);
+ else
+ gsi_insert_seq_after (&gsi, stmts, GSI_SAME_STMT);
+
+ /* Once the sequence is code generated, set it to NULL. */
+ set_bb_predicate_gimplified_stmts (bb, NULL);
+ }
+ }
+}
+
/* Remove all GIMPLE_CONDs and GIMPLE_LABELs of all the basic blocks
other than the exit and latch of the LOOP. Also resets the
GIMPLE_DEBUG information. */
@@ -903,7 +1058,7 @@ remove_conditions_and_labels (loop_p loop)
for (i = 0; i < loop->num_nodes; i++)
{
- basic_block bb = ifc_bbs [i];
+ basic_block bb = ifc_bbs[i];
if (bb_with_exit_edge_p (loop, bb)
|| bb == loop->latch)
@@ -946,9 +1101,8 @@ combine_blocks (struct loop *loop)
edge_iterator ei;
remove_conditions_and_labels (loop);
-
- /* Process phi nodes to prepare blocks for merge. */
- process_phi_nodes (loop);
+ insert_gimplified_predicates (loop);
+ ifconvert_phi_nodes (loop);
/* Merge basic blocks: first remove all the edges in the loop,
except for those from the exit block. */
@@ -1026,9 +1180,7 @@ combine_blocks (struct loop *loop)
/* If possible, merge loop header to the block with the exit edge.
This reduces the number of basic blocks to two, to please the
- vectorizer that handles only loops with two nodes.
-
- FIXME: Call cleanup_tree_cfg. */
+ vectorizer that handles only loops with two nodes. */
if (exit_bb
&& exit_bb != loop->header
&& can_merge_blocks_p (loop->header, exit_bb))
@@ -1036,28 +1188,37 @@ combine_blocks (struct loop *loop)
}
/* If-convert LOOP when it is legal. For the moment this pass has no
- profitability analysis. */
+ profitability analysis. Returns true when something changed. */
-static void
+static bool
tree_if_conversion (struct loop *loop)
{
+ bool changed = false;
ifc_bbs = NULL;
- if (!if_convertible_loop_p (loop))
+ if (!if_convertible_loop_p (loop)
+ || !dbg_cnt (if_conversion_tree))
goto cleanup;
/* Now all statements are if-convertible. Combine all the basic
blocks into one huge basic block doing the if-conversion
on-the-fly. */
combine_blocks (loop);
+ changed = true;
cleanup:
- clean_predicate_lists (loop);
if (ifc_bbs)
{
+ unsigned int i;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ free_bb_predicate (ifc_bbs[i]);
+
free (ifc_bbs);
ifc_bbs = NULL;
}
+
+ return changed;
}
/* Tree if-conversion pass management. */
@@ -1067,14 +1228,15 @@ main_tree_if_conversion (void)
{
loop_iterator li;
struct loop *loop;
+ bool changed = false;
if (number_of_loops () <= 1)
return 0;
FOR_EACH_LOOP (li, loop, 0)
- tree_if_conversion (loop);
+ changed |= tree_if_conversion (loop);
- return 0;
+ return changed ? TODO_cleanup_cfg : 0;
}
static bool
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 696cb00fbfd..3b1c459128f 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -234,6 +234,7 @@ remap_ssa_name (tree name, copy_body_data *id)
regions of the CFG, but this is expensive to test. */
if (id->entry_bb
&& is_gimple_reg (SSA_NAME_VAR (name))
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)
&& TREE_CODE (SSA_NAME_VAR (name)) != PARM_DECL
&& (id->entry_bb != EDGE_SUCC (ENTRY_BLOCK_PTR, 0)->dest
|| EDGE_COUNT (id->entry_bb->preds) != 1))
@@ -810,48 +811,49 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
{
/* Otherwise, just copy the node. Note that copy_tree_r already
knows not to copy VAR_DECLs, etc., so this is safe. */
- if (TREE_CODE (*tp) == INDIRECT_REF)
+ if (TREE_CODE (*tp) == MEM_REF)
{
- /* Get rid of *& from inline substitutions that can happen when a
- pointer argument is an ADDR_EXPR. */
+ /* We need to re-canonicalize MEM_REFs from inline substitutions
+ that can happen when a pointer argument is an ADDR_EXPR. */
tree decl = TREE_OPERAND (*tp, 0);
tree *n;
n = (tree *) pointer_map_contains (id->decl_map, decl);
if (n)
{
- tree type, new_tree, old;
-
- /* If we happen to get an ADDR_EXPR in n->value, strip
- it manually here as we'll eventually get ADDR_EXPRs
- which lie about their types pointed to. In this case
- build_fold_indirect_ref wouldn't strip the
- INDIRECT_REF, but we absolutely rely on that. As
- fold_indirect_ref does other useful transformations,
- try that first, though. */
- type = TREE_TYPE (TREE_TYPE (*n));
- new_tree = unshare_expr (*n);
- old = *tp;
- *tp = gimple_fold_indirect_ref (new_tree);
- if (!*tp)
- {
- if (TREE_CODE (new_tree) == ADDR_EXPR)
- {
- *tp = fold_indirect_ref_1 (EXPR_LOCATION (new_tree),
- type, new_tree);
- /* ??? We should either assert here or build
- a VIEW_CONVERT_EXPR instead of blindly leaking
- incompatible types to our IL. */
- if (! *tp)
- *tp = TREE_OPERAND (new_tree, 0);
- }
- else
- {
- *tp = build1 (INDIRECT_REF, type, new_tree);
- TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
- TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
- }
+ tree old = *tp;
+ tree ptr = unshare_expr (*n);
+ tree tem;
+ if ((tem = maybe_fold_offset_to_reference (EXPR_LOCATION (*tp),
+ ptr,
+ TREE_OPERAND (*tp, 1),
+ TREE_TYPE (*tp)))
+ && TREE_THIS_VOLATILE (tem) == TREE_THIS_VOLATILE (old))
+ {
+ tree *tem_basep = &tem;
+ while (handled_component_p (*tem_basep))
+ tem_basep = &TREE_OPERAND (*tem_basep, 0);
+ if (TREE_CODE (*tem_basep) == MEM_REF)
+ *tem_basep
+ = build2 (MEM_REF, TREE_TYPE (*tem_basep),
+ TREE_OPERAND (*tem_basep, 0),
+ fold_convert (TREE_TYPE (TREE_OPERAND (*tp, 1)),
+ TREE_OPERAND (*tem_basep, 1)));
+ else
+ *tem_basep
+ = build2 (MEM_REF, TREE_TYPE (*tem_basep),
+ build_fold_addr_expr (*tem_basep),
+ build_int_cst
+ (TREE_TYPE (TREE_OPERAND (*tp, 1)), 0));
+ *tp = tem;
+ }
+ else
+ {
+ *tp = fold_build2 (MEM_REF, TREE_TYPE (*tp),
+ ptr, TREE_OPERAND (*tp, 1));
+ TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
}
+ TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
*walk_subtrees = 0;
return NULL;
}
@@ -886,21 +888,15 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
else if (TREE_CODE (*tp) == ADDR_EXPR)
{
/* Variable substitution need not be simple. In particular,
- the INDIRECT_REF substitution above. Make sure that
+ the MEM_REF substitution above. Make sure that
TREE_CONSTANT and friends are up-to-date. But make sure
to not improperly set TREE_BLOCK on some sub-expressions. */
int invariant = is_gimple_min_invariant (*tp);
tree block = id->block;
id->block = NULL_TREE;
- walk_tree (&TREE_OPERAND (*tp, 0), copy_tree_body_r, id, NULL);
+ walk_tree (&TREE_OPERAND (*tp, 0), remap_gimple_op_r, data, NULL);
id->block = block;
-
- /* Handle the case where we substituted an INDIRECT_REF
- into the operand of the ADDR_EXPR. */
- if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
- *tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
- else
- recompute_tree_invariant_for_addr_expr (*tp);
+ recompute_tree_invariant_for_addr_expr (*tp);
/* If this used to be invariant, but is not any longer,
then regimplification is probably needed. */
@@ -1091,6 +1087,25 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
return NULL;
}
}
+ else if (TREE_CODE (*tp) == MEM_REF)
+ {
+ /* We need to re-canonicalize MEM_REFs from inline substitutions
+ that can happen when a pointer argument is an ADDR_EXPR. */
+ tree decl = TREE_OPERAND (*tp, 0);
+ tree *n;
+
+ n = (tree *) pointer_map_contains (id->decl_map, decl);
+ if (n)
+ {
+ tree old = *tp;
+ *tp = fold_build2 (MEM_REF, TREE_TYPE (*tp),
+ unshare_expr (*n), TREE_OPERAND (*tp, 1));
+ TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
+ TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
+ *walk_subtrees = 0;
+ return NULL;
+ }
+ }
/* Here is the "usual case". Copy this tree node, and then
tweak some special cases. */
@@ -1604,7 +1619,6 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
gimple_call_set_lhs (new_call, gimple_call_lhs (stmt));
gsi_replace (&copy_gsi, new_call, false);
- gimple_set_bb (stmt, NULL);
stmt = new_call;
}
else if (is_gimple_call (stmt)
@@ -1713,7 +1727,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
/* We have missing edge in the callgraph. This can happen
when previous inlining turned an indirect call into a
direct call by constant propagating arguments or we are
- producing dead clone (for further clonning). In all
+ producing dead clone (for further cloning). In all
other cases we hit a bug (incorrect node sharing is the
most common reason for missing edges). */
gcc_assert (dest->needed || !dest->analyzed
@@ -1970,11 +1984,22 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
= new_phi = create_phi_node (new_res, new_bb);
FOR_EACH_EDGE (new_edge, ei, new_bb->preds)
{
- edge const old_edge
- = find_edge ((basic_block) new_edge->src->aux, bb);
- tree arg = PHI_ARG_DEF_FROM_EDGE (phi, old_edge);
- tree new_arg = arg;
+ edge old_edge = find_edge ((basic_block) new_edge->src->aux, bb);
+ tree arg;
+ tree new_arg;
tree block = id->block;
+ edge_iterator ei2;
+
+ /* When doing partial cloning, we allow PHIs on the entry block
+ as long as all the arguments are the same. Find any input
+ edge to see argument to copy. */
+ if (!old_edge)
+ FOR_EACH_EDGE (old_edge, ei2, bb->preds)
+ if (!old_edge->src->aux)
+ break;
+
+ arg = PHI_ARG_DEF_FROM_EDGE (phi, old_edge);
+ new_arg = arg;
id->block = NULL_TREE;
walk_tree (&new_arg, copy_tree_body_r, id, NULL);
id->block = block;
@@ -2032,7 +2057,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count)
gcc_assert (cfun->cfg == NULL);
gcc_assert (cfun->decl == new_fndecl);
- /* Copy items we preserve during clonning. */
+ /* Copy items we preserve during cloning. */
cfun->static_chain_decl = src_cfun->static_chain_decl;
cfun->nonlocal_goto_save_area = src_cfun->nonlocal_goto_save_area;
cfun->function_end_locus = src_cfun->function_end_locus;
@@ -2149,6 +2174,8 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
bool need_debug_cleanup = false;
gcov_type count_scale;
int last;
+ int incoming_frequency = 0;
+ gcov_type incoming_count = 0;
if (ENTRY_BLOCK_PTR_FOR_FUNCTION (src_cfun)->count)
count_scale = (REG_BR_PROB_BASE * count
@@ -2159,6 +2186,28 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
/* Register specific tree functions. */
gimple_register_cfg_hooks ();
+ /* If we are inlining just region of the function, make sure to connect new entry
+ to ENTRY_BLOCK_PTR. Since new entry can be part of loop, we must compute
+ frequency and probability of ENTRY_BLOCK_PTR based on the frequencies and
+ probabilities of edges incoming from nonduplicated region. */
+ if (new_entry)
+ {
+ edge e;
+ edge_iterator ei;
+
+ FOR_EACH_EDGE (e, ei, new_entry->preds)
+ if (!e->src->aux)
+ {
+ incoming_frequency += EDGE_FREQUENCY (e);
+ incoming_count += e->count;
+ }
+ incoming_count = incoming_count * count_scale / REG_BR_PROB_BASE;
+ incoming_frequency
+ = incoming_frequency * frequency_scale / REG_BR_PROB_BASE;
+ ENTRY_BLOCK_PTR->count = incoming_count;
+ ENTRY_BLOCK_PTR->frequency = incoming_frequency;
+ }
+
/* Must have a CFG here at this point. */
gcc_assert (ENTRY_BLOCK_PTR_FOR_FUNCTION
(DECL_STRUCT_FUNCTION (callee_fndecl)));
@@ -2192,20 +2241,19 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
|| (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
need_debug_cleanup |= copy_edges_for_bb (bb, count_scale, exit_block_map);
+ if (new_entry)
+ {
+ edge e = make_edge (entry_block_map, (basic_block)new_entry->aux, EDGE_FALLTHRU);
+ e->probability = REG_BR_PROB_BASE;
+ e->count = incoming_count;
+ }
+
if (gimple_in_ssa_p (cfun))
FOR_ALL_BB_FN (bb, cfun_to_copy)
if (!blocks_to_copy
|| (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
copy_phis_for_bb (bb, id);
- if (new_entry)
- {
- edge e;
- e = make_edge (entry_block_map, (basic_block)new_entry->aux, EDGE_FALLTHRU);
- e->probability = REG_BR_PROB_BASE;
- e->count = entry_block_map->count;
- }
-
FOR_ALL_BB_FN (bb, cfun_to_copy)
if (bb->aux)
{
@@ -2632,6 +2680,32 @@ initialize_inlined_parameters (copy_body_data *id, gimple stmt,
val = i < gimple_call_num_args (stmt) ? gimple_call_arg (stmt, i) : NULL;
setup_one_parameter (id, p, val, fn, bb, &vars);
}
+ /* After remapping parameters remap their types. This has to be done
+ in a second loop over all parameters to appropriately remap
+ variable sized arrays when the size is specified in a
+ parameter following the array. */
+ for (p = parms, i = 0; p; p = TREE_CHAIN (p), i++)
+ {
+ tree *varp = (tree *) pointer_map_contains (id->decl_map, p);
+ if (varp
+ && TREE_CODE (*varp) == VAR_DECL)
+ {
+ tree def = (gimple_in_ssa_p (cfun)
+ ? gimple_default_def (id->src_cfun, p) : NULL);
+ TREE_TYPE (*varp) = remap_type (TREE_TYPE (*varp), id);
+ /* Also remap the default definition if it was remapped
+ to the default definition of the parameter replacement
+ by the parameter setup. */
+ if (def && gimple_in_ssa_p (cfun) && is_gimple_reg (p))
+ {
+ tree *defp = (tree *) pointer_map_contains (id->decl_map, def);
+ if (defp
+ && TREE_CODE (*defp) == SSA_NAME
+ && SSA_NAME_VAR (*defp) == *varp)
+ TREE_TYPE (*defp) = TREE_TYPE (*varp);
+ }
+ }
+ }
/* Initialize the static chain. */
p = DECL_STRUCT_FUNCTION (fn)->static_chain_decl;
@@ -2701,25 +2775,6 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest)
via return slot optimization are not believed to have address
taken by alias analysis. */
gcc_assert (TREE_CODE (return_slot) != SSA_NAME);
- if (gimple_in_ssa_p (cfun))
- {
- HOST_WIDE_INT bitsize;
- HOST_WIDE_INT bitpos;
- tree offset;
- enum machine_mode mode;
- int unsignedp;
- int volatilep;
- tree base;
- base = get_inner_reference (return_slot, &bitsize, &bitpos,
- &offset,
- &mode, &unsignedp, &volatilep,
- false);
- if (TREE_CODE (base) == INDIRECT_REF)
- base = TREE_OPERAND (base, 0);
- if (TREE_CODE (base) == SSA_NAME)
- base = SSA_NAME_VAR (base);
- mark_sym_for_renaming (base);
- }
var = return_slot_addr;
}
else
@@ -3258,6 +3313,8 @@ estimate_operator_cost (enum tree_code code, eni_weights *weights,
case WIDEN_SUM_EXPR:
case WIDEN_MULT_EXPR:
case DOT_PROD_EXPR:
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
case VEC_WIDEN_MULT_HI_EXPR:
case VEC_WIDEN_MULT_LO_EXPR:
@@ -3774,7 +3831,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
&& cgraph_global_info_ready)
{
sorry ("inlining failed in call to %q+F: %s", fn,
- cgraph_inline_failed_string (reason));
+ _(cgraph_inline_failed_string (reason)));
sorry ("called from here");
}
else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
@@ -3785,7 +3842,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
&& cgraph_global_info_ready)
{
warning (OPT_Winline, "inlining failed in call to %q+F: %s",
- fn, cgraph_inline_failed_string (reason));
+ fn, _(cgraph_inline_failed_string (reason)));
warning (OPT_Winline, "called from here");
}
goto egress;
@@ -4040,7 +4097,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
/* Expand call statements reachable from STMT_P.
We can only have CALL_EXPRs as the "toplevel" tree code or nested
- in a MODIFY_EXPR. See tree-gimple.c:get_call_expr_in(). We can
+ in a MODIFY_EXPR. See gimple.c:get_call_expr_in(). We can
unfortunately not use that function here because we need a pointer
to the CALL_EXPR, not the tree itself. */
@@ -5187,6 +5244,23 @@ tree_function_versioning (tree old_decl, tree new_decl,
if (id.dst_node->analyzed)
cgraph_rebuild_references ();
update_ssa (TODO_update_ssa);
+
+ /* After partial cloning we need to rescale frequencies, so they are
+ within proper range in the cloned function. */
+ if (new_entry)
+ {
+ struct cgraph_edge *e;
+ rebuild_frequencies ();
+
+ new_version_node->count = ENTRY_BLOCK_PTR->count;
+ for (e = new_version_node->callees; e; e = e->next_callee)
+ {
+ basic_block bb = gimple_bb (e->call_stmt);
+ e->frequency = compute_call_stmt_bb_frequency (current_function_decl, bb);
+ e->count = bb->count;
+ }
+ }
+
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index a095ffd634d..e49fb035bc1 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -452,9 +452,8 @@ static void
mark_block_for_update (basic_block bb)
{
gcc_assert (blocks_to_update != NULL);
- if (bitmap_bit_p (blocks_to_update, bb->index))
+ if (!bitmap_set_bit (blocks_to_update, bb->index))
return;
- bitmap_set_bit (blocks_to_update, bb->index);
initialize_flags_in_bb (bb);
}
@@ -557,7 +556,7 @@ set_livein_block (tree var, basic_block bb)
/* Return true if symbol SYM is marked for renaming. */
-static inline bool
+bool
symbol_marked_for_renaming (tree sym)
{
return bitmap_bit_p (SYMS_TO_RENAME (cfun), DECL_UID (sym));
@@ -1144,7 +1143,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
the flowgraph. */
static void
-insert_phi_nodes (bitmap *dfs)
+insert_phi_nodes (bitmap_head *dfs)
{
referenced_var_iterator rvi;
bitmap_iterator bi;
@@ -2350,7 +2349,7 @@ fini_ssa_renamer (void)
static unsigned int
rewrite_into_ssa (void)
{
- bitmap *dfs;
+ bitmap_head *dfs;
basic_block bb;
timevar_push (TV_TREE_SSA_OTHER);
@@ -2368,9 +2367,9 @@ rewrite_into_ssa (void)
sbitmap_zero (interesting_blocks);
/* Initialize dominance frontier. */
- dfs = XNEWVEC (bitmap, last_basic_block);
+ dfs = XNEWVEC (bitmap_head, last_basic_block);
FOR_EACH_BB (bb)
- dfs[bb->index] = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
/* 1- Compute dominance frontiers. */
calculate_dominance_info (CDI_DOMINATORS);
@@ -2387,7 +2386,7 @@ rewrite_into_ssa (void)
/* Free allocated memory. */
FOR_EACH_BB (bb)
- BITMAP_FREE (dfs[bb->index]);
+ bitmap_clear (&dfs[bb->index]);
free (dfs);
sbitmap_free (interesting_blocks);
@@ -3006,7 +3005,7 @@ release_ssa_name_after_update_ssa (tree name)
names is not pruned. PHI nodes are inserted at every IDF block. */
static void
-insert_updated_phi_nodes_for (tree var, bitmap *dfs, bitmap blocks,
+insert_updated_phi_nodes_for (tree var, bitmap_head *dfs, bitmap blocks,
unsigned update_flags)
{
basic_block entry;
@@ -3333,13 +3332,13 @@ update_ssa (unsigned update_flags)
and for symbols in SYMS_TO_RENAME. */
if (insert_phi_p)
{
- bitmap *dfs;
+ bitmap_head *dfs;
/* If the caller requested PHI nodes to be added, compute
dominance frontiers. */
- dfs = XNEWVEC (bitmap, last_basic_block);
+ dfs = XNEWVEC (bitmap_head, last_basic_block);
FOR_EACH_BB (bb)
- dfs[bb->index] = BITMAP_ALLOC (NULL);
+ bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
compute_dominance_frontiers (dfs);
if (sbitmap_first_set_bit (old_ssa_names) >= 0)
@@ -3364,7 +3363,7 @@ update_ssa (unsigned update_flags)
update_flags);
FOR_EACH_BB (bb)
- BITMAP_FREE (dfs[bb->index]);
+ bitmap_clear (&dfs[bb->index]);
free (dfs);
/* Insertion of PHI nodes may have added blocks to the region.
diff --git a/gcc/tree-iterator.c b/gcc/tree-iterator.c
index d5343b44760..1d0a40a30ab 100644
--- a/gcc/tree-iterator.c
+++ b/gcc/tree-iterator.c
@@ -1,5 +1,5 @@
/* Iterator routines for manipulating GENERIC and GIMPLE tree statements.
- Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Andrew MacLeod <amacleod@redhat.com>
This file is part of GCC.
@@ -130,7 +130,7 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
}
else
{
- head = GGC_NEW (struct tree_statement_list_node);
+ head = ggc_alloc_tree_statement_list_node ();
head->prev = NULL;
head->next = NULL;
head->stmt = t;
@@ -206,7 +206,7 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
}
else
{
- head = GGC_NEW (struct tree_statement_list_node);
+ head = ggc_alloc_tree_statement_list_node ();
head->prev = NULL;
head->next = NULL;
head->stmt = t;
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 5379709261e..099a7fe479f 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -195,18 +195,28 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
if (!bitmap_bit_p (partition, x++))
- remove_phi_node (&bsi, true);
+ {
+ gimple phi = gsi_stmt (bsi);
+ if (!is_gimple_reg (gimple_phi_result (phi)))
+ mark_virtual_phi_result_for_renaming (phi);
+ remove_phi_node (&bsi, true);
+ }
else
gsi_next (&bsi);
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
- if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
- && !bitmap_bit_p (partition, x++))
- gsi_remove (&bsi, false);
- else
- gsi_next (&bsi);
-
- mark_virtual_ops_in_bb (bb);
+ {
+ gimple stmt = gsi_stmt (bsi);
+ if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
+ && !bitmap_bit_p (partition, x++))
+ {
+ unlink_stmt_vdef (stmt);
+ gsi_remove (&bsi, true);
+ release_defs (stmt);
+ }
+ else
+ gsi_next (&bsi);
+ }
}
free (bbs);
@@ -240,7 +250,6 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
gimple_seq stmt_list = NULL, stmts;
gimple fn_call;
tree mem, fn;
- gimple_stmt_iterator i;
struct data_reference *dr = XCNEW (struct data_reference);
location_t loc = gimple_location (stmt);
@@ -291,13 +300,6 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
fn = build_fold_addr_expr (implicit_built_in_decls [BUILT_IN_MEMSET]);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call);
-
- for (i = gsi_start (stmt_list); !gsi_end_p (i); gsi_next (&i))
- {
- gimple s = gsi_stmt (i);
- update_stmt_if_modified (s);
- }
-
gsi_insert_seq_after (&bsi, stmt_list, GSI_CONTINUE_LINKING);
res = true;
@@ -395,7 +397,7 @@ generate_builtin (struct loop *loop, bitmap partition, bool copy_p)
op1 = gimple_assign_rhs1 (write);
if (!(TREE_CODE (op0) == ARRAY_REF
- || TREE_CODE (op0) == INDIRECT_REF))
+ || TREE_CODE (op0) == MEM_REF))
goto end;
/* The new statements will be placed before LOOP. */
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 2437bc48470..e70524543c5 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -790,7 +790,8 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
}
else if (TREE_CODE (var) == COMPONENT_REF)
var = TREE_OPERAND (var, 0);
- else if (INDIRECT_REF_P (var))
+ else if (INDIRECT_REF_P (var)
+ || TREE_CODE (var) == MEM_REF)
{
base = TREE_OPERAND (var, 0);
break;
@@ -868,6 +869,18 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
size_int (-1));
break;
+ case MEM_REF:
+ addr = build2 (POINTER_PLUS_EXPR, TREE_TYPE (TREE_OPERAND (t, 1)),
+ TREE_OPERAND (t, 0),
+ fold_convert (sizetype, TREE_OPERAND (t, 1)));
+ base = addr;
+ limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
+ fold_build2_loc (location,
+ POINTER_PLUS_EXPR, ptr_type_node, base,
+ size),
+ size_int (-1));
+ break;
+
case TARGET_MEM_REF:
addr = tree_mem_ref_addr (ptr_type_node, t);
base = addr;
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index cd153074095..db704b79055 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -84,6 +84,7 @@ struct nesting_info
struct pointer_map_t *field_map;
struct pointer_map_t *var_map;
+ struct pointer_set_t *mem_refs;
bitmap suppress_expansion;
tree context;
@@ -717,6 +718,7 @@ create_nesting_tree (struct cgraph_node *cgn)
struct nesting_info *info = XCNEW (struct nesting_info);
info->field_map = pointer_map_create ();
info->var_map = pointer_map_create ();
+ info->mem_refs = pointer_set_create ();
info->suppress_expansion = BITMAP_ALLOC (&nesting_info_bitmap_obstack);
info->context = cgn->decl;
@@ -758,7 +760,7 @@ get_static_chain (struct nesting_info *info, tree target_context,
{
tree field = get_chain_field (i);
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build_simple_mem_ref (x);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
x = init_tmp_var (info, x, gsi);
}
@@ -793,12 +795,12 @@ get_frame_field (struct nesting_info *info, tree target_context,
{
tree field = get_chain_field (i);
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build_simple_mem_ref (x);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
x = init_tmp_var (info, x, gsi);
}
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build_simple_mem_ref (x);
}
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
@@ -841,16 +843,16 @@ get_nonlocal_debug_decl (struct nesting_info *info, tree decl)
for (i = info->outer; i->context != target_context; i = i->outer)
{
field = get_chain_field (i);
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build_simple_mem_ref (x);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
}
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build_simple_mem_ref (x);
}
field = lookup_field_for_decl (i, decl, INSERT);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
if (use_pointer_in_frame (decl))
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build_simple_mem_ref (x);
/* ??? We should be remapping types as well, surely. */
new_decl = build_decl (DECL_SOURCE_LOCATION (decl),
@@ -927,7 +929,7 @@ convert_nonlocal_reference_op (tree *tp, int *walk_subtrees, void *data)
if (use_pointer_in_frame (t))
{
x = init_tmp_var (info, x, &wi->gsi);
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build_simple_mem_ref (x);
}
}
@@ -1498,6 +1500,21 @@ convert_local_reference_op (tree *tp, int *walk_subtrees, void *data)
wi->val_only = save_val_only;
break;
+ case MEM_REF:
+ save_val_only = wi->val_only;
+ wi->val_only = true;
+ wi->is_lhs = false;
+ walk_tree (&TREE_OPERAND (t, 0), convert_local_reference_op,
+ wi, NULL);
+ /* We need to re-fold the MEM_REF as component references as
+ part of a ADDR_EXPR address are not allowed. But we cannot
+ fold here, as the chain record type is not yet finalized. */
+ if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
+ && !DECL_P (TREE_OPERAND (TREE_OPERAND (t, 0), 0)))
+ pointer_set_insert (info->mem_refs, tp);
+ wi->val_only = save_val_only;
+ break;
+
case VIEW_CONVERT_EXPR:
/* Just request to look at the subtrees, leaving val_only and lhs
untouched. This might actually be for !val_only + lhs, in which
@@ -2247,6 +2264,15 @@ remap_vla_decls (tree block, struct nesting_info *root)
pointer_map_destroy (id.cb.decl_map);
}
+/* Fold the MEM_REF *E. */
+static bool
+fold_mem_refs (const void *e, void *data ATTRIBUTE_UNUSED)
+{
+ tree *ref_p = CONST_CAST2(tree *, const tree *, (const tree *)e);
+ *ref_p = fold (*ref_p);
+ return true;
+}
+
/* Do "everything else" to clean up or complete state collected by the
various walking passes -- lay out the types and decls, generate code
to initialize the frame decl, store critical expressions in the
@@ -2461,6 +2487,9 @@ finalize_nesting_tree_1 (struct nesting_info *root)
root->debug_var_chain);
}
+ /* Fold the rewritten MEM_REF trees. */
+ pointer_set_traverse (root->mem_refs, fold_mem_refs, NULL);
+
/* Dump the translated tree function. */
if (dump_file)
{
@@ -2514,6 +2543,7 @@ free_nesting_tree (struct nesting_info *root)
next = iter_nestinfo_next (node);
pointer_map_destroy (node->var_map);
pointer_map_destroy (node->field_map);
+ pointer_set_destroy (node->mem_refs);
free (node);
node = next;
}
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 5c7d6f599c8..58e8ee47a7d 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -141,6 +141,10 @@ compute_object_offset (const_tree expr, const_tree var)
off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
break;
+ case MEM_REF:
+ gcc_assert (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR);
+ return TREE_OPERAND (expr, 1);
+
default:
return error_mark_node;
}
@@ -166,15 +170,21 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
pt_var = get_base_address (pt_var);
if (pt_var
- && TREE_CODE (pt_var) == INDIRECT_REF
+ && TREE_CODE (pt_var) == MEM_REF
&& TREE_CODE (TREE_OPERAND (pt_var, 0)) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (pt_var, 0))))
{
unsigned HOST_WIDE_INT sz;
if (!osi || (object_size_type & 1) != 0)
- sz = compute_builtin_object_size (TREE_OPERAND (pt_var, 0),
- object_size_type & ~1);
+ {
+ sz = compute_builtin_object_size (TREE_OPERAND (pt_var, 0),
+ object_size_type & ~1);
+ if (host_integerp (TREE_OPERAND (pt_var, 1), 0))
+ sz -= TREE_INT_CST_LOW (TREE_OPERAND (pt_var, 1));
+ else
+ sz = offset_limit;
+ }
else
{
tree var = TREE_OPERAND (pt_var, 0);
@@ -185,6 +195,10 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
sz = object_sizes[object_size_type][SSA_NAME_VERSION (var)];
else
sz = unknown[object_size_type];
+ if (host_integerp (TREE_OPERAND (pt_var, 1), 0))
+ sz -= TREE_INT_CST_LOW (TREE_OPERAND (pt_var, 1));
+ else
+ sz = offset_limit;
}
if (sz != unknown[object_size_type] && sz < offset_limit)
@@ -225,7 +239,7 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
&& tree_int_cst_lt (pt_var_size,
TYPE_SIZE_UNIT (TREE_TYPE (var)))))
var = pt_var;
- else if (var != pt_var && TREE_CODE (pt_var) == INDIRECT_REF)
+ else if (var != pt_var && TREE_CODE (pt_var) == MEM_REF)
{
tree v = var;
/* For &X->fld, compute object size only if fld isn't the last
@@ -328,12 +342,14 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
}
if (var != pt_var
&& pt_var_size
- && TREE_CODE (pt_var) == INDIRECT_REF
+ && TREE_CODE (pt_var) == MEM_REF
&& bytes != error_mark_node)
{
tree bytes2 = compute_object_offset (TREE_OPERAND (ptr, 0), pt_var);
if (bytes2 != error_mark_node)
{
+ bytes2 = size_binop (PLUS_EXPR, bytes2,
+ TREE_OPERAND (pt_var, 1));
if (TREE_CODE (bytes2) == INTEGER_CST
&& tree_int_cst_lt (pt_var_size, bytes2))
bytes2 = size_zero_node;
@@ -746,10 +762,20 @@ plus_stmt_object_size (struct object_size_info *osi, tree var, gimple stmt)
unsigned HOST_WIDE_INT bytes;
tree op0, op1;
- gcc_assert (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR);
-
- op0 = gimple_assign_rhs1 (stmt);
- op1 = gimple_assign_rhs2 (stmt);
+ if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ {
+ op0 = gimple_assign_rhs1 (stmt);
+ op1 = gimple_assign_rhs2 (stmt);
+ }
+ else if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
+ {
+ tree rhs = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+ gcc_assert (TREE_CODE (rhs) == MEM_REF);
+ op0 = TREE_OPERAND (rhs, 0);
+ op1 = TREE_OPERAND (rhs, 1);
+ }
+ else
+ gcc_unreachable ();
if (object_sizes[object_size_type][varno] == unknown[object_size_type])
return false;
@@ -897,13 +923,14 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
{
case GIMPLE_ASSIGN:
{
- if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ tree rhs = gimple_assign_rhs1 (stmt);
+ if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
+ || (gimple_assign_rhs_code (stmt) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (rhs, 0)) == MEM_REF))
reexamine = plus_stmt_object_size (osi, var, stmt);
else if (gimple_assign_single_p (stmt)
|| gimple_assign_unary_nop_p (stmt))
{
- tree rhs = gimple_assign_rhs1 (stmt);
-
if (TREE_CODE (rhs) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (rhs)))
reexamine = merge_object_sizes (osi, var, rhs, 0);
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index a17655ed699..af2708667d2 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -357,7 +357,7 @@ take_address_of (tree obj, tree type, edge entry, htab_t decl_address)
if (var_p != &obj)
{
- *var_p = build1 (INDIRECT_REF, TREE_TYPE (*var_p), name);
+ *var_p = build_simple_mem_ref (name);
name = force_gimple_operand (build_addr (obj, current_function_decl),
&stmts, true, NULL_TREE);
if (!gimple_seq_empty_p (stmts))
@@ -456,7 +456,7 @@ eliminate_local_variables_1 (tree *tp, int *walk_subtrees, void *data)
type = TREE_TYPE (t);
addr_type = build_pointer_type (type);
addr = take_address_of (t, addr_type, dta->entry, dta->decl_address);
- *tp = build1 (INDIRECT_REF, TREE_TYPE (*tp), addr);
+ *tp = build_simple_mem_ref (addr);
dta->changed = true;
return NULL_TREE;
@@ -857,7 +857,6 @@ create_call_for_reduction_1 (void **slot, void *data)
struct clsn_data *const clsn_data = (struct clsn_data *) data;
gimple_stmt_iterator gsi;
tree type = TREE_TYPE (PHI_RESULT (reduc->reduc_phi));
- tree struct_type = TREE_TYPE (TREE_TYPE (clsn_data->load));
tree load_struct;
basic_block bb;
basic_block new_bb;
@@ -866,7 +865,7 @@ create_call_for_reduction_1 (void **slot, void *data)
tree tmp_load, name;
gimple load;
- load_struct = fold_build1 (INDIRECT_REF, struct_type, clsn_data->load);
+ load_struct = build_simple_mem_ref (clsn_data->load);
t = build3 (COMPONENT_REF, type, load_struct, reduc->field, NULL_TREE);
addr = build_addr (t, current_function_decl);
@@ -925,13 +924,12 @@ create_loads_for_reductions (void **slot, void *data)
gimple stmt;
gimple_stmt_iterator gsi;
tree type = TREE_TYPE (gimple_assign_lhs (red->reduc_stmt));
- tree struct_type = TREE_TYPE (TREE_TYPE (clsn_data->load));
tree load_struct;
tree name;
tree x;
gsi = gsi_after_labels (clsn_data->load_bb);
- load_struct = fold_build1 (INDIRECT_REF, struct_type, clsn_data->load);
+ load_struct = build_simple_mem_ref (clsn_data->load);
load_struct = build3 (COMPONENT_REF, type, load_struct, red->field,
NULL_TREE);
@@ -1012,7 +1010,6 @@ create_loads_and_stores_for_name (void **slot, void *data)
gimple stmt;
gimple_stmt_iterator gsi;
tree type = TREE_TYPE (elt->new_name);
- tree struct_type = TREE_TYPE (TREE_TYPE (clsn_data->load));
tree load_struct;
gsi = gsi_last_bb (clsn_data->store_bb);
@@ -1022,7 +1019,7 @@ create_loads_and_stores_for_name (void **slot, void *data)
gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
gsi = gsi_last_bb (clsn_data->load_bb);
- load_struct = fold_build1 (INDIRECT_REF, struct_type, clsn_data->load);
+ load_struct = build_simple_mem_ref (clsn_data->load);
t = build3 (COMPONENT_REF, type, load_struct, elt->field, NULL_TREE);
stmt = gimple_build_assign (elt->new_name, t);
SSA_NAME_DEF_STMT (elt->new_name) = stmt;
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index b5971d5433a..a4c97b39155 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -442,6 +442,7 @@ extern struct gimple_opt_pass pass_build_cgraph_edges;
extern struct gimple_opt_pass pass_local_pure_const;
extern struct gimple_opt_pass pass_tracer;
extern struct gimple_opt_pass pass_warn_unused_result;
+extern struct gimple_opt_pass pass_split_functions;
/* IPA Passes */
extern struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility;
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index c97ace88c8b..05b63fbea88 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -153,7 +153,7 @@ allocate_phi_node (size_t len)
}
else
{
- phi = (gimple) ggc_alloc (size);
+ phi = ggc_alloc_gimple_statement_d (size);
#ifdef GATHER_STATISTICS
phi_nodes_created++;
{
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index de147e7ec96..4af074ff5e5 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1345,14 +1345,16 @@ ref_at_iteration (struct loop *loop, tree ref, int iter)
if (!op0)
return NULL_TREE;
}
- else if (!INDIRECT_REF_P (ref))
+ else if (!INDIRECT_REF_P (ref)
+ && TREE_CODE (ref) != MEM_REF)
return unshare_expr (ref);
- if (INDIRECT_REF_P (ref))
+ if (INDIRECT_REF_P (ref)
+ || TREE_CODE (ref) == MEM_REF)
{
- /* Take care for INDIRECT_REF and MISALIGNED_INDIRECT_REF at
+ /* Take care for MEM_REF and MISALIGNED_INDIRECT_REF at
the same time. */
- ret = copy_node (ref);
+ ret = unshare_expr (ref);
idx = TREE_OPERAND (ref, 0);
idx_p = &TREE_OPERAND (ret, 0);
}
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index bbdb38de10d..03cc1024581 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -794,6 +794,55 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
NIY;
break;
+ case MEM_REF:
+ {
+ if (integer_zerop (TREE_OPERAND (node, 1))
+ /* Same pointer types, but ignoring POINTER_TYPE vs.
+ REFERENCE_TYPE. */
+ && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 0)))
+ == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))
+ && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 0)))
+ == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 1))))
+ && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 0)))
+ == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 1))))
+ && (TYPE_QUALS (TREE_TYPE (TREE_OPERAND (node, 0)))
+ == TYPE_QUALS (TREE_TYPE (TREE_OPERAND (node, 1))))
+ /* Same value types ignoring qualifiers. */
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
+ == TYPE_MAIN_VARIANT
+ (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))))
+ {
+ if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
+ {
+ pp_string (buffer, "*");
+ dump_generic_node (buffer, TREE_OPERAND (node, 0),
+ spc, flags, false);
+ }
+ else
+ dump_generic_node (buffer,
+ TREE_OPERAND (TREE_OPERAND (node, 0), 0),
+ spc, flags, false);
+ }
+ else
+ {
+ pp_string (buffer, "MEM[");
+ pp_string (buffer, "(");
+ dump_generic_node (buffer, TREE_TYPE (TREE_OPERAND (node, 1)),
+ spc, flags, false);
+ pp_string (buffer, ")");
+ dump_generic_node (buffer, TREE_OPERAND (node, 0),
+ spc, flags, false);
+ if (!integer_zerop (TREE_OPERAND (node, 1)))
+ {
+ pp_string (buffer, " + ");
+ dump_generic_node (buffer, TREE_OPERAND (node, 1),
+ spc, flags, false);
+ }
+ pp_string (buffer, "]");
+ }
+ break;
+ }
+
case TARGET_MEM_REF:
{
const char *sep = "";
@@ -1100,7 +1149,25 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case COMPONENT_REF:
op0 = TREE_OPERAND (node, 0);
str = ".";
- if (op0 && TREE_CODE (op0) == INDIRECT_REF)
+ if (op0
+ && (TREE_CODE (op0) == INDIRECT_REF
+ || (TREE_CODE (op0) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (op0, 0)) != ADDR_EXPR
+ && integer_zerop (TREE_OPERAND (op0, 1))
+ /* Same pointer types, but ignoring POINTER_TYPE vs.
+ REFERENCE_TYPE. */
+ && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
+ == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
+ && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))
+ == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
+ && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
+ == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
+ && (TYPE_QUALS (TREE_TYPE (TREE_OPERAND (op0, 0)))
+ == TYPE_QUALS (TREE_TYPE (TREE_OPERAND (op0, 1))))
+ /* Same value types ignoring qualifiers. */
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
+ == TYPE_MAIN_VARIANT
+ (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))))))
{
op0 = TREE_OPERAND (op0, 0);
str = "->";
@@ -1947,6 +2014,26 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_string (buffer, " > ");
break;
+ case WIDEN_MULT_PLUS_EXPR:
+ pp_string (buffer, " WIDEN_MULT_PLUS_EXPR < ");
+ dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
+ pp_string (buffer, " > ");
+ break;
+
+ case WIDEN_MULT_MINUS_EXPR:
+ pp_string (buffer, " WIDEN_MULT_MINUS_EXPR < ");
+ dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
+ pp_string (buffer, " > ");
+ break;
+
case OMP_PARALLEL:
pp_string (buffer, "#pragma omp parallel");
dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
@@ -2440,6 +2527,8 @@ op_code_prio (enum tree_code code)
case VEC_WIDEN_MULT_LO_EXPR:
case WIDEN_MULT_EXPR:
case DOT_PROD_EXPR:
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
case MULT_EXPR:
case TRUNC_DIV_EXPR:
case CEIL_DIV_EXPR:
@@ -2738,6 +2827,13 @@ print_call_name (pretty_printer *buffer, tree node, int flags)
dump_generic_node (buffer, op0, 0, flags, false);
break;
+ case MEM_REF:
+ if (integer_zerop (TREE_OPERAND (op0, 1)))
+ {
+ op0 = TREE_OPERAND (op0, 0);
+ goto again;
+ }
+ /* Fallthru. */
case COMPONENT_REF:
case SSA_NAME:
case OBJ_TYPE_REF:
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index ca15001fead..127082e1530 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -467,6 +467,10 @@ tree_profiling (void)
|| cfun->after_tree_profile)
return 0;
+ /* Don't profile functions produced for builtin stuff. */
+ if (DECL_SOURCE_LOCATION (current_function_decl) == BUILTINS_LOCATION)
+ return 0;
+
/* Re-set global shared temporary variable for edge-counters. */
gcov_type_tmp_var = NULL_TREE;
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index bf564d8dab5..0e372567c89 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -314,7 +314,7 @@ new_scev_info_str (basic_block instantiated_below, tree var)
{
struct scev_info_str *res;
- res = GGC_NEW (struct scev_info_str);
+ res = ggc_alloc_scev_info_str ();
res->var = var;
res->chrec = chrec_not_analyzed_yet;
res->instantiated_below = instantiated_below;
@@ -1170,6 +1170,24 @@ follow_ssa_edge_expr (struct loop *loop, gimple at_stmt, tree expr,
halting_phi, evolution_of_loop, limit);
break;
+ case ADDR_EXPR:
+ /* Handle &MEM[ptr + CST] which is equivalent to POINTER_PLUS_EXPR. */
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == MEM_REF)
+ {
+ expr = TREE_OPERAND (expr, 0);
+ rhs0 = TREE_OPERAND (expr, 0);
+ rhs1 = TREE_OPERAND (expr, 1);
+ type = TREE_TYPE (rhs0);
+ STRIP_USELESS_TYPE_CONVERSION (rhs0);
+ STRIP_USELESS_TYPE_CONVERSION (rhs1);
+ res = follow_ssa_edge_binary (loop, at_stmt, type,
+ rhs0, POINTER_PLUS_EXPR, rhs1,
+ halting_phi, evolution_of_loop, limit);
+ }
+ else
+ res = t_false;
+ break;
+
case ASSERT_EXPR:
/* This assignment is of the form: "a_1 = ASSERT_EXPR <a_2, ...>"
It must be handled as a copy assignment of the form a_1 = a_2. */
@@ -2172,9 +2190,19 @@ instantiate_scev_name (basic_block instantiate_below,
else
res = chrec;
- if (res == NULL_TREE
- || !dominated_by_p (CDI_DOMINATORS, instantiate_below,
- gimple_bb (SSA_NAME_DEF_STMT (res))))
+ /* When there is no loop_closed_phi_def, it means that the
+ variable is not used after the loop: try to still compute the
+ value of the variable when exiting the loop. */
+ if (res == NULL_TREE)
+ {
+ loop_p loop = loop_containing_stmt (SSA_NAME_DEF_STMT (chrec));
+ res = analyze_scalar_evolution (loop, chrec);
+ res = compute_overall_effect_of_inner_loop (loop, res);
+ res = instantiate_scev_r (instantiate_below, evolution_loop, res,
+ fold_conversions, cache, size_expr);
+ }
+ else if (!dominated_by_p (CDI_DOMINATORS, instantiate_below,
+ gimple_bb (SSA_NAME_DEF_STMT (res))))
res = chrec_dont_know;
}
@@ -3017,12 +3045,9 @@ scev_initialize (void)
loop_iterator li;
struct loop *loop;
- scalar_evolution_info = htab_create_alloc (100,
- hash_scev_info,
- eq_scev_info,
- del_scev_info,
- ggc_calloc,
- ggc_free);
+
+ scalar_evolution_info = htab_create_ggc (100, hash_scev_info, eq_scev_info,
+ del_scev_info);
initialize_scalar_evolutions_analyzer ();
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 702187c355d..05e3cf800aa 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -88,6 +88,8 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "target.h"
#include "flags.h"
+#include "dbgcnt.h"
+#include "tree-inline.h"
/* Enumeration of all aggregate reductions we can do. */
enum sra_mode { SRA_MODE_EARLY_IPA, /* early call regularization */
@@ -356,13 +358,13 @@ dump_access (FILE *f, struct access *access, bool grp)
print_generic_expr (f, access->type, 0);
if (grp)
fprintf (f, ", grp_write = %d, total_scalarization = %d, "
- "grp_read = %d, grp_hint = %d, "
+ "grp_read = %d, grp_hint = %d, grp_assignment_read = %d,"
"grp_covered = %d, grp_unscalarizable_region = %d, "
"grp_unscalarized_data = %d, grp_partial_lhs = %d, "
"grp_to_be_replaced = %d, grp_maybe_modified = %d, "
"grp_not_necessarilly_dereferenced = %d\n",
access->grp_write, access->total_scalarization,
- access->grp_read, access->grp_hint,
+ access->grp_read, access->grp_hint, access->grp_assignment_read,
access->grp_covered, access->grp_unscalarizable_region,
access->grp_unscalarized_data, access->grp_partial_lhs,
access->grp_to_be_replaced, access->grp_maybe_modified,
@@ -749,7 +751,8 @@ create_access (tree expr, gimple stmt, bool write)
base = get_ref_base_and_extent (expr, &offset, &size, &max_size);
- if (sra_mode == SRA_MODE_EARLY_IPA && INDIRECT_REF_P (base))
+ if (sra_mode == SRA_MODE_EARLY_IPA
+ && TREE_CODE (base) == MEM_REF)
{
base = get_ssa_base_param (TREE_OPERAND (base, 0));
if (!base)
@@ -883,15 +886,10 @@ completely_scalarize_record (tree base, tree decl, HOST_WIDE_INT offset)
static void
disqualify_base_of_expr (tree t, const char *reason)
{
- while (handled_component_p (t))
- t = TREE_OPERAND (t, 0);
-
- if (sra_mode == SRA_MODE_EARLY_IPA)
- {
- if (INDIRECT_REF_P (t))
- t = TREE_OPERAND (t, 0);
- t = get_ssa_base_param (t);
- }
+ t = get_base_address (t);
+ if (sra_mode == SRA_MODE_EARLY_IPA
+ && TREE_CODE (t) == MEM_REF)
+ t = get_ssa_base_param (TREE_OPERAND (t, 0));
if (t && DECL_P (t))
disqualify_candidate (t, reason);
@@ -933,8 +931,9 @@ build_access_from_expr_1 (tree expr, gimple stmt, bool write)
switch (TREE_CODE (expr))
{
- case INDIRECT_REF:
- if (sra_mode != SRA_MODE_EARLY_IPA)
+ case MEM_REF:
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) != ADDR_EXPR
+ && sra_mode != SRA_MODE_EARLY_IPA)
return NULL;
/* fall through */
case VAR_DECL:
@@ -1283,7 +1282,21 @@ make_fancy_name_1 (tree expr)
break;
sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, TREE_INT_CST_LOW (index));
obstack_grow (&name_obstack, buffer, strlen (buffer));
+ break;
+
+ case ADDR_EXPR:
+ make_fancy_name_1 (TREE_OPERAND (expr, 0));
+ break;
+ case MEM_REF:
+ make_fancy_name_1 (TREE_OPERAND (expr, 0));
+ if (!integer_zerop (TREE_OPERAND (expr, 1)))
+ {
+ obstack_1grow (&name_obstack, '$');
+ sprintf (buffer, HOST_WIDE_INT_PRINT_DEC,
+ TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)));
+ obstack_grow (&name_obstack, buffer, strlen (buffer));
+ }
break;
case BIT_FIELD_REF:
@@ -1306,7 +1319,11 @@ make_fancy_name (tree expr)
return XOBFINISH (&name_obstack, char *);
}
-/* Helper function for build_ref_for_offset. */
+/* Helper function for build_ref_for_offset.
+
+ FIXME: Eventually this should be rewritten to either re-use the
+ original access expression unshared (which is good for alias
+ analysis) or to build a MEM_REF expression. */
static bool
build_ref_for_offset_1 (tree *res, tree type, HOST_WIDE_INT offset,
@@ -1404,12 +1421,7 @@ build_ref_for_offset_1 (tree *res, tree type, HOST_WIDE_INT offset,
type TYPE at the given OFFSET of the type EXP_TYPE. If EXPR is NULL, the
function only determines whether it can build such a reference without
actually doing it, otherwise, the tree it points to is unshared first and
- then used as a base for furhter sub-references.
-
- FIXME: Eventually this should be replaced with
- maybe_fold_offset_to_reference() from tree-ssa-ccp.c but that requires a
- minor rewrite of fold_stmt.
- */
+ then used as a base for furhter sub-references. */
bool
build_ref_for_offset (tree *expr, tree type, HOST_WIDE_INT offset,
@@ -1424,7 +1436,7 @@ build_ref_for_offset (tree *expr, tree type, HOST_WIDE_INT offset,
{
type = TREE_TYPE (type);
if (expr)
- *expr = fold_build1_loc (loc, INDIRECT_REF, type, *expr);
+ *expr = build_simple_mem_ref_loc (loc, *expr);
}
return build_ref_for_offset_1 (expr, type, offset, exp_type);
@@ -1689,9 +1701,10 @@ get_unrenamed_access_replacement (struct access *access)
/* Build a subtree of accesses rooted in *ACCESS, and move the pointer in the
linked list along the way. Stop when *ACCESS is NULL or the access pointed
- to it is not "within" the root. */
+ to it is not "within" the root. Return false iff some accesses partially
+ overlap. */
-static void
+static bool
build_access_subtree (struct access **access)
{
struct access *root = *access, *last_child = NULL;
@@ -1706,24 +1719,32 @@ build_access_subtree (struct access **access)
last_child->next_sibling = *access;
last_child = *access;
- build_access_subtree (access);
+ if (!build_access_subtree (access))
+ return false;
}
+
+ if (*access && (*access)->offset < limit)
+ return false;
+
+ return true;
}
/* Build a tree of access representatives, ACCESS is the pointer to the first
- one, others are linked in a list by the next_grp field. Decide about scalar
- replacements on the way, return true iff any are to be created. */
+ one, others are linked in a list by the next_grp field. Return false iff
+ some accesses partially overlap. */
-static void
+static bool
build_access_trees (struct access *access)
{
while (access)
{
struct access *root = access;
- build_access_subtree (&access);
+ if (!build_access_subtree (&access))
+ return false;
root->next_grp = access;
}
+ return true;
}
/* Return true if expr contains some ARRAY_REFs into a variable bounded
@@ -1791,7 +1812,8 @@ analyze_access_subtree (struct access *root, bool allow_replacements,
else
covered_to += child->size;
- sth_created |= analyze_access_subtree (child, allow_replacements,
+ sth_created |= analyze_access_subtree (child,
+ allow_replacements && !scalar,
mark_read, mark_write);
root->grp_unscalarized_data |= child->grp_unscalarized_data;
@@ -2061,9 +2083,7 @@ analyze_all_variable_accesses (void)
struct access *access;
access = sort_and_splice_var_accesses (var);
- if (access)
- build_access_trees (access);
- else
+ if (!access || !build_access_trees (access))
disqualify_candidate (var,
"No or inhibitingly overlapping accesses.");
}
@@ -2928,7 +2948,7 @@ late_intra_sra (void)
static bool
gate_intra_sra (void)
{
- return flag_tree_sra != 0;
+ return flag_tree_sra != 0 && dbg_cnt (tree_sra);
}
@@ -3016,8 +3036,11 @@ ptr_parm_has_direct_uses (tree parm)
tree lhs = gimple_get_lhs (stmt);
while (handled_component_p (lhs))
lhs = TREE_OPERAND (lhs, 0);
- if (INDIRECT_REF_P (lhs)
- && TREE_OPERAND (lhs, 0) == name)
+ if (TREE_CODE (lhs) == MEM_REF
+ && TREE_OPERAND (lhs, 0) == name
+ && integer_zerop (TREE_OPERAND (lhs, 1))
+ && types_compatible_p (TREE_TYPE (lhs),
+ TREE_TYPE (TREE_TYPE (name))))
uses_ok++;
}
if (gimple_assign_single_p (stmt))
@@ -3025,8 +3048,11 @@ ptr_parm_has_direct_uses (tree parm)
tree rhs = gimple_assign_rhs1 (stmt);
while (handled_component_p (rhs))
rhs = TREE_OPERAND (rhs, 0);
- if (INDIRECT_REF_P (rhs)
- && TREE_OPERAND (rhs, 0) == name)
+ if (TREE_CODE (rhs) == MEM_REF
+ && TREE_OPERAND (rhs, 0) == name
+ && integer_zerop (TREE_OPERAND (rhs, 1))
+ && types_compatible_p (TREE_TYPE (rhs),
+ TREE_TYPE (TREE_TYPE (name))))
uses_ok++;
}
else if (is_gimple_call (stmt))
@@ -3037,8 +3063,11 @@ ptr_parm_has_direct_uses (tree parm)
tree arg = gimple_call_arg (stmt, i);
while (handled_component_p (arg))
arg = TREE_OPERAND (arg, 0);
- if (INDIRECT_REF_P (arg)
- && TREE_OPERAND (arg, 0) == name)
+ if (TREE_CODE (arg) == MEM_REF
+ && TREE_OPERAND (arg, 0) == name
+ && integer_zerop (TREE_OPERAND (arg, 1))
+ && types_compatible_p (TREE_TYPE (arg),
+ TREE_TYPE (TREE_TYPE (name))))
uses_ok++;
}
}
@@ -3873,6 +3902,7 @@ replace_removed_params_ssa_names (gimple stmt,
gimple_phi_set_result (stmt, name);
replace_uses_by (lhs, name);
+ release_ssa_name (lhs);
return true;
}
@@ -3906,8 +3936,11 @@ sra_ipa_modify_expr (tree *expr, bool convert,
if (!base || size == -1 || max_size == -1)
return false;
- if (INDIRECT_REF_P (base))
- base = TREE_OPERAND (base, 0);
+ if (TREE_CODE (base) == MEM_REF)
+ {
+ offset += mem_ref_offset (base).low * BITS_PER_UNIT;
+ base = TREE_OPERAND (base, 0);
+ }
base = get_ssa_base_param (base);
if (!base || TREE_CODE (base) != PARM_DECL)
@@ -3928,14 +3961,7 @@ sra_ipa_modify_expr (tree *expr, bool convert,
return false;
if (cand->by_ref)
- {
- tree folded;
- src = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (cand->reduction)),
- cand->reduction);
- folded = gimple_fold_indirect_ref (src);
- if (folded)
- src = folded;
- }
+ src = build_simple_mem_ref (cand->reduction);
else
src = cand->reduction;
@@ -4156,7 +4182,8 @@ all_callers_have_enough_arguments_p (struct cgraph_node *node)
/* Convert all callers of NODE to pass parameters as given in ADJUSTMENTS. */
static void
-convert_callers (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
+convert_callers (struct cgraph_node *node, tree old_decl,
+ ipa_parm_adjustment_vec adjustments)
{
tree old_cur_fndecl = current_function_decl;
struct cgraph_edge *cs;
@@ -4203,10 +4230,11 @@ convert_callers (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
if (gimple_code (stmt) != GIMPLE_CALL)
continue;
call_fndecl = gimple_call_fndecl (stmt);
- if (call_fndecl && cgraph_get_node (call_fndecl) == node)
+ if (call_fndecl == old_decl)
{
if (dump_file)
fprintf (dump_file, "Adjusting recursive call");
+ gimple_call_set_fndecl (stmt, node->decl);
ipa_modify_call_arguments (NULL, stmt, adjustments);
}
}
@@ -4215,43 +4243,38 @@ convert_callers (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
return;
}
-/* Create an abstract origin declaration for OLD_DECL and make it an abstract
- origin of the provided decl so that there are preserved parameters for debug
- information. */
-
-static void
-create_abstract_origin (tree old_decl)
-{
- if (!DECL_ABSTRACT_ORIGIN (old_decl))
- {
- tree new_decl = copy_node (old_decl);
-
- DECL_ABSTRACT (new_decl) = 1;
- SET_DECL_ASSEMBLER_NAME (new_decl, NULL_TREE);
- SET_DECL_RTL (new_decl, NULL);
- DECL_STRUCT_FUNCTION (new_decl) = NULL;
- DECL_ARTIFICIAL (old_decl) = 1;
- DECL_ABSTRACT_ORIGIN (old_decl) = new_decl;
- }
-}
-
/* Perform all the modification required in IPA-SRA for NODE to have parameters
as given in ADJUSTMENTS. */
static void
modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
{
- struct cgraph_node *alias;
- for (alias = node->same_body; alias; alias = alias->next)
- ipa_modify_formal_parameters (alias->decl, adjustments, "ISRA");
- /* current_function_decl must be handled last, after same_body aliases,
- as following functions will use what it computed. */
- create_abstract_origin (current_function_decl);
+ struct cgraph_node *new_node;
+ struct cgraph_edge *cs;
+ VEC (cgraph_edge_p, heap) * redirect_callers;
+ int node_callers;
+
+ node_callers = 0;
+ for (cs = node->callers; cs != NULL; cs = cs->next_caller)
+ node_callers++;
+ redirect_callers = VEC_alloc (cgraph_edge_p, heap, node_callers);
+ for (cs = node->callers; cs != NULL; cs = cs->next_caller)
+ VEC_quick_push (cgraph_edge_p, redirect_callers, cs);
+
+ rebuild_cgraph_edges ();
+ pop_cfun ();
+ current_function_decl = NULL_TREE;
+
+ new_node = cgraph_function_versioning (node, redirect_callers, NULL, NULL,
+ NULL, NULL, "isra");
+ current_function_decl = new_node->decl;
+ push_cfun (DECL_STRUCT_FUNCTION (new_node->decl));
+
ipa_modify_formal_parameters (current_function_decl, adjustments, "ISRA");
ipa_sra_modify_function_body (adjustments);
sra_ipa_reset_debug_stmts (adjustments);
- convert_callers (node, adjustments);
- cgraph_make_node_local (node);
+ convert_callers (new_node, node->decl, adjustments);
+ cgraph_make_node_local (new_node);
return;
}
@@ -4269,6 +4292,13 @@ ipa_sra_preliminary_function_checks (struct cgraph_node *node)
return false;
}
+ if (!tree_versionable_function_p (node->decl))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Function not local to this compilation unit.\n");
+ return false;
+ }
+
if (DECL_VIRTUAL_P (current_function_decl))
{
if (dump_file)
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index d3890c5b57c..78eb362ca5c 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -182,7 +182,8 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl)
{
tree base = get_base_address (TREE_OPERAND (ptr, 0));
if (base
- && INDIRECT_REF_P (base))
+ && (INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF))
ptr = TREE_OPERAND (base, 0);
else if (base
&& SSA_VAR_P (base))
@@ -238,7 +239,8 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2)
{
tree base = get_base_address (TREE_OPERAND (ptr1, 0));
if (base
- && INDIRECT_REF_P (base))
+ && (INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF))
ptr1 = TREE_OPERAND (base, 0);
else if (base
&& SSA_VAR_P (base))
@@ -250,7 +252,8 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2)
{
tree base = get_base_address (TREE_OPERAND (ptr2, 0));
if (base
- && INDIRECT_REF_P (base))
+ && (INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF))
ptr2 = TREE_OPERAND (base, 0);
else if (base
&& SSA_VAR_P (base))
@@ -299,7 +302,8 @@ ptr_deref_may_alias_ref_p_1 (tree ptr, ao_ref *ref)
{
tree base = ao_ref_base (ref);
- if (INDIRECT_REF_P (base))
+ if (INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF)
return ptr_derefs_may_alias_p (ptr, TREE_OPERAND (base, 0));
else if (SSA_VAR_P (base))
return ptr_deref_may_alias_decl_p (ptr, base);
@@ -376,7 +380,7 @@ get_ptr_info (tree t)
pi = SSA_NAME_PTR_INFO (t);
if (pi == NULL)
{
- pi = GGC_CNEW (struct ptr_info_def);
+ pi = ggc_alloc_cleared_ptr_info_def ();
pt_solution_reset (&pi->pt);
SSA_NAME_PTR_INFO (t) = pi;
}
@@ -470,12 +474,18 @@ ao_ref_base (ao_ref *ref)
/* Returns the base object alias set of the memory reference *REF. */
-static alias_set_type ATTRIBUTE_UNUSED
+static alias_set_type
ao_ref_base_alias_set (ao_ref *ref)
{
+ tree base_ref;
if (ref->base_alias_set != -1)
return ref->base_alias_set;
- ref->base_alias_set = get_alias_set (ao_ref_base (ref));
+ if (!ref->ref)
+ return 0;
+ base_ref = ref->ref;
+ while (handled_component_p (base_ref))
+ base_ref = TREE_OPERAND (base_ref, 0);
+ ref->base_alias_set = get_alias_set (base_ref);
return ref->base_alias_set;
}
@@ -505,7 +515,8 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
&ref->offset, &t1, &t2);
else
{
- ref->base = build1 (INDIRECT_REF, char_type_node, ptr);
+ ref->base = build2 (MEM_REF, char_type_node,
+ ptr, build_int_cst (ptr_type_node, 0));
ref->offset = 0;
}
if (size
@@ -665,33 +676,45 @@ decl_refs_may_alias_p (tree base1,
if non-NULL are the complete memory reference trees. */
static bool
-indirect_ref_may_alias_decl_p (tree ref1, tree ptr1,
- HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1,
+indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
+ HOST_WIDE_INT offset1,
+ HOST_WIDE_INT max_size1 ATTRIBUTE_UNUSED,
alias_set_type ref1_alias_set,
alias_set_type base1_alias_set,
- tree ref2, tree base2,
+ tree ref2 ATTRIBUTE_UNUSED, tree base2,
HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2,
alias_set_type ref2_alias_set,
- alias_set_type base2_alias_set)
+ alias_set_type base2_alias_set, bool tbaa_p)
{
+ tree ptr1 = TREE_OPERAND (base1, 0);
+ tree ptrtype1;
+ HOST_WIDE_INT offset1p = offset1;
+
+ if (TREE_CODE (base1) == MEM_REF)
+ offset1p = offset1 + mem_ref_offset (base1).low * BITS_PER_UNIT;
+
/* If only one reference is based on a variable, they cannot alias if
the pointer access is beyond the extent of the variable access.
(the pointer base cannot validly point to an offset less than zero
of the variable).
They also cannot alias if the pointer may not point to the decl. */
- if (max_size2 != -1
- && !ranges_overlap_p (offset1, max_size1, 0, offset2 + max_size2))
+ if (!ranges_overlap_p (MAX (0, offset1p), -1, offset2, max_size2))
return false;
if (!ptr_deref_may_alias_decl_p (ptr1, base2))
return false;
/* Disambiguations that rely on strict aliasing rules follow. */
- if (!flag_strict_aliasing)
+ if (!flag_strict_aliasing || !tbaa_p)
return true;
+ if (TREE_CODE (base1) == MEM_REF)
+ ptrtype1 = TREE_TYPE (TREE_OPERAND (base1, 1));
+ else
+ ptrtype1 = TREE_TYPE (ptr1);
+
/* If the alias set for a pointer access is zero all bets are off. */
if (base1_alias_set == -1)
- base1_alias_set = get_deref_alias_set (ptr1);
+ base1_alias_set = get_deref_alias_set (ptrtype1);
if (base1_alias_set == 0)
return true;
if (base2_alias_set == -1)
@@ -699,22 +722,52 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1,
/* If both references are through the same type, they do not alias
if the accesses do not overlap. This does extra disambiguation
- for mixed/pointer accesses but requires strict aliasing. */
- if (same_type_for_tbaa (TREE_TYPE (TREE_TYPE (ptr1)),
- TREE_TYPE (base2)) == 1)
+ for mixed/pointer accesses but requires strict aliasing.
+ For MEM_REFs we require that the component-ref offset we computed
+ is relative to the start of the type which we ensure by
+ comparing rvalue and access type and disregarding the constant
+ pointer offset. */
+ if ((TREE_CODE (base1) != MEM_REF
+ || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1)
+ && same_type_for_tbaa (TREE_TYPE (ptrtype1), TREE_TYPE (base2)) == 1)
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
- /* The only way to access a variable is through a pointer dereference
- of the same alias set or a subset of it. */
+ /* When we are trying to disambiguate an access with a pointer dereference
+ as base versus one with a decl as base we can use both the size
+ of the decl and its dynamic type for extra disambiguation.
+ ??? We do not know anything about the dynamic type of the decl
+ other than that its alias-set contains base2_alias_set as a subset
+ which does not help us here. */
+ /* As we know nothing useful about the dynamic type of the decl just
+ use the usual conflict check rather than a subset test.
+ ??? We could introduce -fvery-strict-aliasing when the language
+ does not allow decls to have a dynamic type that differs from their
+ static type. Then we can check
+ !alias_set_subset_of (base1_alias_set, base2_alias_set) instead. */
if (base1_alias_set != base2_alias_set
- && !alias_set_subset_of (base1_alias_set, base2_alias_set))
+ && !alias_sets_conflict_p (base1_alias_set, base2_alias_set))
+ return false;
+ /* If the size of the access relevant for TBAA through the pointer
+ is bigger than the size of the decl we can't possibly access the
+ decl via that pointer. */
+ if (DECL_SIZE (base2) && COMPLETE_TYPE_P (TREE_TYPE (ptrtype1))
+ && TREE_CODE (DECL_SIZE (base2)) == INTEGER_CST
+ && TREE_CODE (TYPE_SIZE (TREE_TYPE (ptrtype1))) == INTEGER_CST
+ /* ??? This in turn may run afoul when a decl of type T which is
+ a member of union type U is accessed through a pointer to
+ type U and sizeof T is smaller than sizeof U. */
+ && TREE_CODE (TREE_TYPE (ptrtype1)) != UNION_TYPE
+ && TREE_CODE (TREE_TYPE (ptrtype1)) != QUAL_UNION_TYPE
+ && tree_int_cst_lt (DECL_SIZE (base2), TYPE_SIZE (TREE_TYPE (ptrtype1))))
return false;
/* Do access-path based disambiguation. */
if (ref1 && ref2
&& handled_component_p (ref1)
- && handled_component_p (ref2))
- return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)),
+ && handled_component_p (ref2)
+ && (TREE_CODE (base1) != MEM_REF
+ || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1))
+ return aliasing_component_refs_p (ref1, TREE_TYPE (ptrtype1),
ref1_alias_set, base1_alias_set,
offset1, max_size1,
ref2, TREE_TYPE (base2),
@@ -732,42 +785,65 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1,
if non-NULL are the complete memory reference trees. */
static bool
-indirect_refs_may_alias_p (tree ref1, tree ptr1,
+indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1,
alias_set_type ref1_alias_set,
alias_set_type base1_alias_set,
- tree ref2, tree ptr2,
+ tree ref2 ATTRIBUTE_UNUSED, tree base2,
HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2,
alias_set_type ref2_alias_set,
- alias_set_type base2_alias_set)
+ alias_set_type base2_alias_set, bool tbaa_p)
{
+ tree ptr1 = TREE_OPERAND (base1, 0);
+ tree ptr2 = TREE_OPERAND (base2, 0);
+ tree ptrtype1, ptrtype2;
+
/* If both bases are based on pointers they cannot alias if they may not
point to the same memory object or if they point to the same object
and the accesses do not overlap. */
if (operand_equal_p (ptr1, ptr2, 0))
- return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
+ {
+ if (TREE_CODE (base1) == MEM_REF)
+ offset1 += mem_ref_offset (base1).low * BITS_PER_UNIT;
+ if (TREE_CODE (base2) == MEM_REF)
+ offset2 += mem_ref_offset (base2).low * BITS_PER_UNIT;
+ return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
+ }
if (!ptr_derefs_may_alias_p (ptr1, ptr2))
return false;
/* Disambiguations that rely on strict aliasing rules follow. */
- if (!flag_strict_aliasing)
+ if (!flag_strict_aliasing || !tbaa_p)
return true;
+ if (TREE_CODE (base1) == MEM_REF)
+ ptrtype1 = TREE_TYPE (TREE_OPERAND (base1, 1));
+ else
+ ptrtype1 = TREE_TYPE (ptr1);
+ if (TREE_CODE (base2) == MEM_REF)
+ ptrtype2 = TREE_TYPE (TREE_OPERAND (base2, 1));
+ else
+ ptrtype2 = TREE_TYPE (ptr2);
+
/* If the alias set for a pointer access is zero all bets are off. */
if (base1_alias_set == -1)
- base1_alias_set = get_deref_alias_set (ptr1);
+ base1_alias_set = get_deref_alias_set (ptrtype1);
if (base1_alias_set == 0)
return true;
if (base2_alias_set == -1)
- base2_alias_set = get_deref_alias_set (ptr2);
+ base2_alias_set = get_deref_alias_set (ptrtype2);
if (base2_alias_set == 0)
return true;
/* If both references are through the same type, they do not alias
if the accesses do not overlap. This does extra disambiguation
for mixed/pointer accesses but requires strict aliasing. */
- if (same_type_for_tbaa (TREE_TYPE (TREE_TYPE (ptr1)),
- TREE_TYPE (TREE_TYPE (ptr2))) == 1)
+ if ((TREE_CODE (base1) != MEM_REF
+ || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1)
+ && (TREE_CODE (base2) != MEM_REF
+ || same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1)
+ && same_type_for_tbaa (TREE_TYPE (ptrtype1),
+ TREE_TYPE (ptrtype2)) == 1)
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
/* Do type-based disambiguation. */
@@ -778,11 +854,15 @@ indirect_refs_may_alias_p (tree ref1, tree ptr1,
/* Do access-path based disambiguation. */
if (ref1 && ref2
&& handled_component_p (ref1)
- && handled_component_p (ref2))
- return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)),
+ && handled_component_p (ref2)
+ && (TREE_CODE (base1) != MEM_REF
+ || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1)
+ && (TREE_CODE (base2) != MEM_REF
+ || same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1))
+ return aliasing_component_refs_p (ref1, TREE_TYPE (ptrtype1),
ref1_alias_set, base1_alias_set,
offset1, max_size1,
- ref2, TREE_TYPE (TREE_TYPE (ptr2)),
+ ref2, TREE_TYPE (ptrtype2),
ref2_alias_set, base2_alias_set,
offset2, max_size2, false);
@@ -798,20 +878,21 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
HOST_WIDE_INT offset1 = 0, offset2 = 0;
HOST_WIDE_INT max_size1 = -1, max_size2 = -1;
bool var1_p, var2_p, ind1_p, ind2_p;
- alias_set_type set;
-
- gcc_assert ((!ref1->ref
- || SSA_VAR_P (ref1->ref)
- || handled_component_p (ref1->ref)
- || INDIRECT_REF_P (ref1->ref)
- || TREE_CODE (ref1->ref) == TARGET_MEM_REF
- || TREE_CODE (ref1->ref) == CONST_DECL)
- && (!ref2->ref
- || SSA_VAR_P (ref2->ref)
- || handled_component_p (ref2->ref)
- || INDIRECT_REF_P (ref2->ref)
- || TREE_CODE (ref2->ref) == TARGET_MEM_REF
- || TREE_CODE (ref2->ref) == CONST_DECL));
+
+ gcc_checking_assert ((!ref1->ref
+ || TREE_CODE (ref1->ref) == SSA_NAME
+ || DECL_P (ref1->ref)
+ || handled_component_p (ref1->ref)
+ || INDIRECT_REF_P (ref1->ref)
+ || TREE_CODE (ref1->ref) == MEM_REF
+ || TREE_CODE (ref1->ref) == TARGET_MEM_REF)
+ && (!ref2->ref
+ || TREE_CODE (ref2->ref) == SSA_NAME
+ || DECL_P (ref2->ref)
+ || handled_component_p (ref2->ref)
+ || INDIRECT_REF_P (ref2->ref)
+ || TREE_CODE (ref2->ref) == MEM_REF
+ || TREE_CODE (ref2->ref) == TARGET_MEM_REF));
/* Decompose the references into their base objects and the access. */
base1 = ao_ref_base (ref1);
@@ -832,10 +913,13 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
|| is_gimple_min_invariant (base2))
return false;
- /* We can end up refering to code via function decls. As we likely
- do not properly track code aliases conservatively bail out. */
+ /* We can end up refering to code via function and label decls.
+ As we likely do not properly track code aliases conservatively
+ bail out. */
if (TREE_CODE (base1) == FUNCTION_DECL
- || TREE_CODE (base2) == FUNCTION_DECL)
+ || TREE_CODE (base2) == FUNCTION_DECL
+ || TREE_CODE (base1) == LABEL_DECL
+ || TREE_CODE (base2) == LABEL_DECL)
return true;
/* Defer to simple offset based disambiguation if we have
@@ -848,8 +932,9 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
return decl_refs_may_alias_p (base1, offset1, max_size1,
base2, offset2, max_size2);
- ind1_p = INDIRECT_REF_P (base1);
- ind2_p = INDIRECT_REF_P (base2);
+ ind1_p = INDIRECT_REF_P (base1) || (TREE_CODE (base1) == MEM_REF);
+ ind2_p = INDIRECT_REF_P (base2) || (TREE_CODE (base2) == MEM_REF);
+
/* Canonicalize the pointer-vs-decl case. */
if (ind1_p && var2_p)
{
@@ -866,59 +951,6 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
ind2_p = true;
}
- /* If we are about to disambiguate pointer-vs-decl try harder to
- see must-aliases and give leeway to some invalid cases.
- This covers a pretty minimal set of cases only and does not
- when called from the RTL oracle. It handles cases like
-
- int i = 1;
- return *(float *)&i;
-
- and also fixes gfortran.dg/lto/pr40725. */
- if (var1_p && ind2_p
- && cfun
- && gimple_in_ssa_p (cfun)
- && TREE_CODE (TREE_OPERAND (base2, 0)) == SSA_NAME)
- {
- gimple def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (base2, 0));
- while (is_gimple_assign (def_stmt)
- && (gimple_assign_rhs_code (def_stmt) == SSA_NAME
- || CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))))
- {
- tree rhs = gimple_assign_rhs1 (def_stmt);
- HOST_WIDE_INT offset, size, max_size;
-
- /* Look through SSA name copies and pointer conversions. */
- if (TREE_CODE (rhs) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (rhs)))
- {
- def_stmt = SSA_NAME_DEF_STMT (rhs);
- continue;
- }
- if (TREE_CODE (rhs) != ADDR_EXPR)
- break;
-
- /* If the pointer is defined as an address based on a decl
- use plain offset disambiguation and ignore TBAA. */
- rhs = TREE_OPERAND (rhs, 0);
- rhs = get_ref_base_and_extent (rhs, &offset, &size, &max_size);
- if (SSA_VAR_P (rhs))
- {
- base2 = rhs;
- offset2 += offset;
- if (size != max_size
- || max_size == -1)
- max_size2 = -1;
- return decl_refs_may_alias_p (base1, offset1, max_size1,
- base2, offset2, max_size2);
- }
-
- /* Do not continue looking through &p->x to limit time
- complexity. */
- break;
- }
- }
-
/* First defer to TBAA if possible. */
if (tbaa_p
&& flag_strict_aliasing
@@ -934,21 +966,23 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
return true;
/* Dispatch to the pointer-vs-decl or pointer-vs-pointer disambiguators. */
- set = tbaa_p ? -1 : 0;
if (var1_p && ind2_p)
- return indirect_ref_may_alias_decl_p (ref2->ref, TREE_OPERAND (base2, 0),
+ return indirect_ref_may_alias_decl_p (ref2->ref, base2,
offset2, max_size2,
- ao_ref_alias_set (ref2), set,
+ ao_ref_alias_set (ref2), -1,
ref1->ref, base1,
offset1, max_size1,
- ao_ref_alias_set (ref1), set);
+ ao_ref_alias_set (ref1),
+ ao_ref_base_alias_set (ref1),
+ tbaa_p);
else if (ind1_p && ind2_p)
- return indirect_refs_may_alias_p (ref1->ref, TREE_OPERAND (base1, 0),
+ return indirect_refs_may_alias_p (ref1->ref, base1,
offset1, max_size1,
- ao_ref_alias_set (ref1), set,
- ref2->ref, TREE_OPERAND (base2, 0),
+ ao_ref_alias_set (ref1), -1,
+ ref2->ref, base2,
offset2, max_size2,
- ao_ref_alias_set (ref2), set);
+ ao_ref_alias_set (ref2), -1,
+ tbaa_p);
gcc_unreachable ();
}
@@ -1107,7 +1141,8 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
if (pt_solution_includes (gimple_call_use_set (call), base))
return true;
}
- else if (INDIRECT_REF_P (base)
+ else if ((INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF)
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
{
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0));
@@ -1278,7 +1313,8 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
if (DECL_P (base)
&& !TREE_STATIC (base))
return true;
- else if (INDIRECT_REF_P (base)
+ else if ((INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF)
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME
&& (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0))))
return pi->pt.anything || pi->pt.nonlocal;
@@ -1357,7 +1393,8 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
/* Check if the base variable is call-clobbered. */
if (DECL_P (base))
return pt_solution_includes (gimple_call_clobber_set (call), base);
- else if (INDIRECT_REF_P (base)
+ else if ((INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF)
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
{
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0));
@@ -1408,11 +1445,15 @@ stmt_may_clobber_ref_p_1 (gimple stmt, ao_ref *ref)
return call_may_clobber_ref_p_1 (stmt, ref);
}
- else if (is_gimple_assign (stmt))
+ else if (gimple_assign_single_p (stmt))
{
- ao_ref r;
- ao_ref_init (&r, gimple_assign_lhs (stmt));
- return refs_may_alias_p_1 (ref, &r, true);
+ tree lhs = gimple_assign_lhs (stmt);
+ if (!is_gimple_reg (lhs))
+ {
+ ao_ref r;
+ ao_ref_init (&r, gimple_assign_lhs (stmt));
+ return refs_may_alias_p_1 (ref, &r, true);
+ }
}
else if (gimple_code (stmt) == GIMPLE_ASM)
return true;
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 44e284f6896..912c5059363 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -682,7 +682,7 @@ ccp_finalize (void)
do_dbg_cnt ();
/* Perform substitutions based on the known constant values. */
- something_changed = substitute_and_fold (const_val, ccp_fold_stmt);
+ something_changed = substitute_and_fold (const_val, ccp_fold_stmt, true);
free (const_val);
const_val = NULL;
@@ -839,6 +839,23 @@ ccp_visit_phi_node (gimple phi)
return SSA_PROP_NOT_INTERESTING;
}
+/* Get operand number OPNR from the rhs of STMT. Before returning it,
+ simplify it to a constant if possible. */
+
+static tree
+get_rhs_assign_op_for_ccp (gimple stmt, int opnr)
+{
+ tree op = gimple_op (stmt, opnr);
+
+ if (TREE_CODE (op) == SSA_NAME)
+ {
+ prop_value_t *val = get_value (op);
+ if (val->lattice_val == CONSTANT)
+ op = get_value (op)->value;
+ }
+ return op;
+}
+
/* CCP specific front-end to the non-destructive constant folding
routines.
@@ -879,20 +896,22 @@ ccp_fold (gimple stmt)
base = &TREE_OPERAND (rhs, 0);
while (handled_component_p (*base))
base = &TREE_OPERAND (*base, 0);
- if (TREE_CODE (*base) == INDIRECT_REF
+ if (TREE_CODE (*base) == MEM_REF
&& TREE_CODE (TREE_OPERAND (*base, 0)) == SSA_NAME)
{
prop_value_t *val = get_value (TREE_OPERAND (*base, 0));
if (val->lattice_val == CONSTANT
- && TREE_CODE (val->value) == ADDR_EXPR
- && may_propagate_address_into_dereference
- (val->value, *base))
+ && TREE_CODE (val->value) == ADDR_EXPR)
{
+ tree ret, save = *base;
+ tree new_base;
+ new_base = fold_build2 (MEM_REF, TREE_TYPE (*base),
+ unshare_expr (val->value),
+ TREE_OPERAND (*base, 1));
/* We need to return a new tree, not modify the IL
or share parts of it. So play some tricks to
avoid manually building it. */
- tree ret, save = *base;
- *base = TREE_OPERAND (val->value, 0);
+ *base = new_base;
ret = unshare_expr (rhs);
recompute_tree_invariant_for_addr_expr (ret);
*base = save;
@@ -938,15 +957,19 @@ ccp_fold (gimple stmt)
TREE_CODE (rhs),
TREE_TYPE (rhs), val->value);
}
- else if (TREE_CODE (rhs) == INDIRECT_REF
+ else if (TREE_CODE (rhs) == MEM_REF
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
{
prop_value_t *val = get_value (TREE_OPERAND (rhs, 0));
if (val->lattice_val == CONSTANT
- && TREE_CODE (val->value) == ADDR_EXPR
- && useless_type_conversion_p (TREE_TYPE (rhs),
- TREE_TYPE (TREE_TYPE (val->value))))
- rhs = TREE_OPERAND (val->value, 0);
+ && TREE_CODE (val->value) == ADDR_EXPR)
+ {
+ tree tem = fold_build2 (MEM_REF, TREE_TYPE (rhs),
+ unshare_expr (val->value),
+ TREE_OPERAND (rhs, 1));
+ if (tem)
+ rhs = tem;
+ }
}
return fold_const_aggregate_ref (rhs);
}
@@ -961,15 +984,7 @@ ccp_fold (gimple stmt)
Note that we know the single operand must be a constant,
so this should almost always return a simplified RHS. */
tree lhs = gimple_assign_lhs (stmt);
- tree op0 = gimple_assign_rhs1 (stmt);
-
- /* Simplify the operand down to a constant. */
- if (TREE_CODE (op0) == SSA_NAME)
- {
- prop_value_t *val = get_value (op0);
- if (val->lattice_val == CONSTANT)
- op0 = get_value (op0)->value;
- }
+ tree op0 = get_rhs_assign_op_for_ccp (stmt, 1);
/* Conversions are useless for CCP purposes if they are
value-preserving. Thus the restrictions that
@@ -978,16 +993,10 @@ ccp_fold (gimple stmt)
allowed places. */
if (CONVERT_EXPR_CODE_P (subcode)
&& POINTER_TYPE_P (TREE_TYPE (lhs))
- && POINTER_TYPE_P (TREE_TYPE (op0))
- /* Do not allow differences in volatile qualification
- as this might get us confused as to whether a
- propagation destination statement is volatile
- or not. See PR36988. */
- && (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (lhs)))
- == TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (op0)))))
+ && POINTER_TYPE_P (TREE_TYPE (op0)))
{
tree tem;
- /* Still try to generate a constant of correct type. */
+ /* Try to re-construct array references on-the-fly. */
if (!useless_type_conversion_p (TREE_TYPE (lhs),
TREE_TYPE (op0))
&& ((tem = maybe_fold_offset_to_address
@@ -1006,37 +1015,35 @@ ccp_fold (gimple stmt)
case GIMPLE_BINARY_RHS:
{
/* Handle binary operators that can appear in GIMPLE form. */
- tree op0 = gimple_assign_rhs1 (stmt);
- tree op1 = gimple_assign_rhs2 (stmt);
-
- /* Simplify the operands down to constants when appropriate. */
- if (TREE_CODE (op0) == SSA_NAME)
- {
- prop_value_t *val = get_value (op0);
- if (val->lattice_val == CONSTANT)
- op0 = val->value;
- }
-
- if (TREE_CODE (op1) == SSA_NAME)
- {
- prop_value_t *val = get_value (op1);
- if (val->lattice_val == CONSTANT)
- op1 = val->value;
- }
+ tree op0 = get_rhs_assign_op_for_ccp (stmt, 1);
+ tree op1 = get_rhs_assign_op_for_ccp (stmt, 2);
- /* Fold &foo + CST into an invariant reference if possible. */
+ /* Translate &x + CST into an invariant form suitable for
+ further propagation. */
if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
&& TREE_CODE (op0) == ADDR_EXPR
&& TREE_CODE (op1) == INTEGER_CST)
{
- tree tem = maybe_fold_offset_to_address
- (loc, op0, op1, TREE_TYPE (op0));
- if (tem != NULL_TREE)
- return tem;
+ tree off = fold_convert (ptr_type_node, op1);
+ return build_fold_addr_expr
+ (fold_build2 (MEM_REF,
+ TREE_TYPE (TREE_TYPE (op0)),
+ unshare_expr (op0), off));
}
return fold_binary_loc (loc, subcode,
- gimple_expr_type (stmt), op0, op1);
+ gimple_expr_type (stmt), op0, op1);
+ }
+
+ case GIMPLE_TERNARY_RHS:
+ {
+ /* Handle binary operators that can appear in GIMPLE form. */
+ tree op0 = get_rhs_assign_op_for_ccp (stmt, 1);
+ tree op1 = get_rhs_assign_op_for_ccp (stmt, 2);
+ tree op2 = get_rhs_assign_op_for_ccp (stmt, 3);
+
+ return fold_ternary_loc (loc, subcode,
+ gimple_expr_type (stmt), op0, op1, op2);
}
default:
@@ -1294,18 +1301,97 @@ fold_const_aggregate_ref (tree t)
break;
}
- case INDIRECT_REF:
- {
- tree base = TREE_OPERAND (t, 0);
- if (TREE_CODE (base) == SSA_NAME
- && (value = get_value (base))
- && value->lattice_val == CONSTANT
- && TREE_CODE (value->value) == ADDR_EXPR
- && useless_type_conversion_p (TREE_TYPE (t),
- TREE_TYPE (TREE_TYPE (value->value))))
- return fold_const_aggregate_ref (TREE_OPERAND (value->value, 0));
- break;
- }
+ case MEM_REF:
+ /* Get the base object we are accessing. */
+ base = TREE_OPERAND (t, 0);
+ if (TREE_CODE (base) == SSA_NAME
+ && (value = get_value (base))
+ && value->lattice_val == CONSTANT)
+ base = value->value;
+ if (TREE_CODE (base) != ADDR_EXPR)
+ return NULL_TREE;
+ base = TREE_OPERAND (base, 0);
+ switch (TREE_CODE (base))
+ {
+ case VAR_DECL:
+ if (DECL_P (base)
+ && !AGGREGATE_TYPE_P (TREE_TYPE (base))
+ && integer_zerop (TREE_OPERAND (t, 1)))
+ return get_symbol_constant_value (base);
+
+ if (!TREE_READONLY (base)
+ || TREE_CODE (TREE_TYPE (base)) != ARRAY_TYPE
+ || !targetm.binds_local_p (base))
+ return NULL_TREE;
+
+ ctor = DECL_INITIAL (base);
+ break;
+
+ case STRING_CST:
+ case CONSTRUCTOR:
+ ctor = base;
+ break;
+
+ default:
+ return NULL_TREE;
+ }
+
+ if (ctor == NULL_TREE
+ || (TREE_CODE (ctor) != CONSTRUCTOR
+ && TREE_CODE (ctor) != STRING_CST)
+ || !TREE_STATIC (ctor))
+ return NULL_TREE;
+
+ /* Get the byte offset. */
+ idx = TREE_OPERAND (t, 1);
+
+ /* Fold read from constant string. */
+ if (TREE_CODE (ctor) == STRING_CST)
+ {
+ if ((TYPE_MODE (TREE_TYPE (t))
+ == TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor))))
+ && (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor))))
+ == MODE_INT)
+ && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor)))) == 1
+ && compare_tree_int (idx, TREE_STRING_LENGTH (ctor)) < 0)
+ return build_int_cst_type (TREE_TYPE (t),
+ (TREE_STRING_POINTER (ctor)
+ [TREE_INT_CST_LOW (idx)]));
+ return NULL_TREE;
+ }
+
+ /* ??? Implement byte-offset indexing into a non-array CONSTRUCTOR. */
+ if (TREE_CODE (TREE_TYPE (ctor)) == ARRAY_TYPE
+ && (TYPE_MODE (TREE_TYPE (t))
+ == TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor))))
+ && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (t))) != 0
+ && integer_zerop
+ (int_const_binop
+ (TRUNC_MOD_EXPR, idx,
+ size_int (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (t)))), 0)))
+ {
+ idx = int_const_binop (TRUNC_DIV_EXPR, idx,
+ size_int (GET_MODE_SIZE
+ (TYPE_MODE (TREE_TYPE (t)))), 0);
+ FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), cnt, cfield, cval)
+ if (tree_int_cst_equal (cfield, idx))
+ {
+ STRIP_NOPS (cval);
+ if (TREE_CODE (cval) == ADDR_EXPR)
+ {
+ tree base = get_base_address (TREE_OPERAND (cval, 0));
+ if (base && TREE_CODE (base) == VAR_DECL)
+ add_referenced_var (base);
+ }
+ if (useless_type_conversion_p (TREE_TYPE (t), TREE_TYPE (cval)))
+ return cval;
+ else if (CONSTANT_CLASS_P (cval))
+ return fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (t), cval);
+ else
+ return NULL_TREE;
+ }
+ }
+ break;
default:
break;
@@ -1493,7 +1579,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
{
tree rhs = unshare_expr (val->value);
if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs)))
- rhs = fold_convert (TREE_TYPE (lhs), rhs);
+ rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs);
gimple_assign_set_rhs_from_tree (gsi, rhs);
return true;
}
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 7a4c0995514..87d896842f9 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -854,7 +854,7 @@ fini_copy_prop (void)
duplicate_ssa_name_ptr_info (tmp[i].value, SSA_NAME_PTR_INFO (var));
}
- substitute_and_fold (tmp, NULL);
+ substitute_and_fold (tmp, NULL, true);
free (cached_last_copy_of);
free (copy_of);
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index ae44ef189a6..edec49d374f 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -77,8 +77,8 @@ static VEC(gimple,heap) *worklist;
as necessary. */
static sbitmap processed;
-/* Vector indicating that last_stmt if a basic block has already been
- marked as necessary. */
+/* Vector indicating that the last statement of a basic block has already
+ been marked as necessary. */
static sbitmap last_stmt_necessary;
/* Vector indicating that BB contains statements that are live. */
@@ -197,6 +197,7 @@ find_all_control_dependences (struct edge_list *el)
/* If STMT is not already marked necessary, mark it, and add it to the
worklist if ADD_TO_WORKLIST is true. */
+
static inline void
mark_stmt_necessary (gimple stmt, bool add_to_worklist)
{
@@ -365,13 +366,30 @@ mark_stmt_if_obviously_necessary (gimple stmt, bool aggressive)
}
-/* Make corresponding control dependent edges necessary. We only
- have to do this once for each basic block, so we clear the bitmap
- after we're done.
+/* Mark the last statement of BB as necessary. */
- When IGNORE_SELF it true, ignore BB from the list of control dependences. */
static void
-mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el, bool ignore_self)
+mark_last_stmt_necessary (basic_block bb)
+{
+ gimple stmt = last_stmt (bb);
+
+ SET_BIT (last_stmt_necessary, bb->index);
+ SET_BIT (bb_contains_live_stmts, bb->index);
+
+ /* We actually mark the statement only if it is a control statement. */
+ if (stmt && is_ctrl_stmt (stmt))
+ mark_stmt_necessary (stmt, true);
+}
+
+
+/* Mark control dependent edges of BB as necessary. We have to do this only
+ once for each basic block so we set the appropriate bit after we're done.
+
+ When IGNORE_SELF is true, ignore BB in the list of control dependences. */
+
+static void
+mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el,
+ bool ignore_self)
{
bitmap_iterator bi;
unsigned edge_number;
@@ -384,7 +402,6 @@ mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el, bo
EXECUTE_IF_CONTROL_DEPENDENT (bi, bb->index, edge_number)
{
- gimple stmt;
basic_block cd_bb = INDEX_EDGE_PRED_BB (el, edge_number);
if (ignore_self && cd_bb == bb)
@@ -393,15 +410,10 @@ mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el, bo
continue;
}
- if (TEST_BIT (last_stmt_necessary, cd_bb->index))
- continue;
- SET_BIT (last_stmt_necessary, cd_bb->index);
- SET_BIT (bb_contains_live_stmts, cd_bb->index);
-
- stmt = last_stmt (cd_bb);
- if (stmt && is_ctrl_stmt (stmt))
- mark_stmt_necessary (stmt, true);
+ if (!TEST_BIT (last_stmt_necessary, cd_bb->index))
+ mark_last_stmt_necessary (cd_bb);
}
+
if (!skipped)
SET_BIT (visited_control_parents, bb->index);
}
@@ -487,6 +499,9 @@ ref_may_be_aliased (tree ref)
{
while (handled_component_p (ref))
ref = TREE_OPERAND (ref, 0);
+ if (TREE_CODE (ref) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (ref, 0)) == ADDR_EXPR)
+ ref = TREE_OPERAND (TREE_OPERAND (ref, 0), 0);
return !(DECL_P (ref)
&& !may_be_aliased (ref));
}
@@ -652,12 +667,12 @@ propagate_necessity (struct edge_list *el)
if (aggressive)
{
- /* Mark the last statements of the basic blocks that the block
- containing STMT is control dependent on, but only if we haven't
+ /* Mark the last statement of the basic blocks on which the block
+ containing STMT is control dependent, but only if we haven't
already done so. */
basic_block bb = gimple_bb (stmt);
if (bb != ENTRY_BLOCK_PTR
- && ! TEST_BIT (visited_control_parents, bb->index))
+ && !TEST_BIT (visited_control_parents, bb->index))
mark_control_dependent_edges_necessary (bb, el, false);
}
@@ -760,18 +775,11 @@ propagate_necessity (struct edge_list *el)
!= get_immediate_dominator (CDI_POST_DOMINATORS, arg_bb))
{
if (!TEST_BIT (last_stmt_necessary, arg_bb->index))
- {
- gimple stmt2;
- SET_BIT (last_stmt_necessary, arg_bb->index);
- SET_BIT (bb_contains_live_stmts, arg_bb->index);
-
- stmt2 = last_stmt (arg_bb);
- if (stmt2 && is_ctrl_stmt (stmt2))
- mark_stmt_necessary (stmt2, true);
- }
+ mark_last_stmt_necessary (arg_bb);
}
else if (arg_bb != ENTRY_BLOCK_PTR
- && ! TEST_BIT (visited_control_parents, arg_bb->index))
+ && !TEST_BIT (visited_control_parents,
+ arg_bb->index))
mark_control_dependent_edges_necessary (arg_bb, el, true);
}
}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 25eb306369d..68338206a8a 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -51,6 +51,7 @@ enum expr_kind
EXPR_SINGLE,
EXPR_UNARY,
EXPR_BINARY,
+ EXPR_TERNARY,
EXPR_CALL
};
@@ -61,7 +62,8 @@ struct hashable_expr
union {
struct { tree rhs; } single;
struct { enum tree_code op; tree opnd; } unary;
- struct { enum tree_code op; tree opnd0; tree opnd1; } binary;
+ struct { enum tree_code op; tree opnd0, opnd1; } binary;
+ struct { enum tree_code op; tree opnd0, opnd1, opnd2; } ternary;
struct { tree fn; bool pure; size_t nargs; tree *args; } call;
} ops;
};
@@ -211,22 +213,30 @@ initialize_hash_element (gimple stmt, tree lhs,
switch (get_gimple_rhs_class (subcode))
{
case GIMPLE_SINGLE_RHS:
- expr->kind = EXPR_SINGLE;
- expr->ops.single.rhs = gimple_assign_rhs1 (stmt);
- break;
+ expr->kind = EXPR_SINGLE;
+ expr->ops.single.rhs = gimple_assign_rhs1 (stmt);
+ break;
case GIMPLE_UNARY_RHS:
- expr->kind = EXPR_UNARY;
+ expr->kind = EXPR_UNARY;
expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
- expr->ops.unary.op = subcode;
- expr->ops.unary.opnd = gimple_assign_rhs1 (stmt);
- break;
+ expr->ops.unary.op = subcode;
+ expr->ops.unary.opnd = gimple_assign_rhs1 (stmt);
+ break;
case GIMPLE_BINARY_RHS:
- expr->kind = EXPR_BINARY;
+ expr->kind = EXPR_BINARY;
expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
- expr->ops.binary.op = subcode;
- expr->ops.binary.opnd0 = gimple_assign_rhs1 (stmt);
- expr->ops.binary.opnd1 = gimple_assign_rhs2 (stmt);
- break;
+ expr->ops.binary.op = subcode;
+ expr->ops.binary.opnd0 = gimple_assign_rhs1 (stmt);
+ expr->ops.binary.opnd1 = gimple_assign_rhs2 (stmt);
+ break;
+ case GIMPLE_TERNARY_RHS:
+ expr->kind = EXPR_TERNARY;
+ expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
+ expr->ops.ternary.op = subcode;
+ expr->ops.ternary.opnd0 = gimple_assign_rhs1 (stmt);
+ expr->ops.ternary.opnd1 = gimple_assign_rhs2 (stmt);
+ expr->ops.ternary.opnd2 = gimple_assign_rhs3 (stmt);
+ break;
default:
gcc_unreachable ();
}
@@ -371,23 +381,40 @@ hashable_expr_equal_p (const struct hashable_expr *expr0,
expr1->ops.unary.opnd, 0);
case EXPR_BINARY:
- {
- if (expr0->ops.binary.op != expr1->ops.binary.op)
- return false;
-
- if (operand_equal_p (expr0->ops.binary.opnd0,
- expr1->ops.binary.opnd0, 0)
- && operand_equal_p (expr0->ops.binary.opnd1,
- expr1->ops.binary.opnd1, 0))
- return true;
-
- /* For commutative ops, allow the other order. */
- return (commutative_tree_code (expr0->ops.binary.op)
- && operand_equal_p (expr0->ops.binary.opnd0,
- expr1->ops.binary.opnd1, 0)
- && operand_equal_p (expr0->ops.binary.opnd1,
- expr1->ops.binary.opnd0, 0));
- }
+ if (expr0->ops.binary.op != expr1->ops.binary.op)
+ return false;
+
+ if (operand_equal_p (expr0->ops.binary.opnd0,
+ expr1->ops.binary.opnd0, 0)
+ && operand_equal_p (expr0->ops.binary.opnd1,
+ expr1->ops.binary.opnd1, 0))
+ return true;
+
+ /* For commutative ops, allow the other order. */
+ return (commutative_tree_code (expr0->ops.binary.op)
+ && operand_equal_p (expr0->ops.binary.opnd0,
+ expr1->ops.binary.opnd1, 0)
+ && operand_equal_p (expr0->ops.binary.opnd1,
+ expr1->ops.binary.opnd0, 0));
+
+ case EXPR_TERNARY:
+ if (expr0->ops.ternary.op != expr1->ops.ternary.op
+ || !operand_equal_p (expr0->ops.ternary.opnd2,
+ expr1->ops.ternary.opnd2, 0))
+ return false;
+
+ if (operand_equal_p (expr0->ops.ternary.opnd0,
+ expr1->ops.ternary.opnd0, 0)
+ && operand_equal_p (expr0->ops.ternary.opnd1,
+ expr1->ops.ternary.opnd1, 0))
+ return true;
+
+ /* For commutative ops, allow the other order. */
+ return (commutative_ternary_tree_code (expr0->ops.ternary.op)
+ && operand_equal_p (expr0->ops.ternary.opnd0,
+ expr1->ops.ternary.opnd1, 0)
+ && operand_equal_p (expr0->ops.ternary.opnd1,
+ expr1->ops.ternary.opnd0, 0));
case EXPR_CALL:
{
@@ -450,8 +477,8 @@ iterative_hash_hashable_expr (const struct hashable_expr *expr, hashval_t val)
case EXPR_BINARY:
val = iterative_hash_object (expr->ops.binary.op, val);
if (commutative_tree_code (expr->ops.binary.op))
- val = iterative_hash_exprs_commutative (expr->ops.binary.opnd0,
- expr->ops.binary.opnd1, val);
+ val = iterative_hash_exprs_commutative (expr->ops.binary.opnd0,
+ expr->ops.binary.opnd1, val);
else
{
val = iterative_hash_expr (expr->ops.binary.opnd0, val);
@@ -459,6 +486,19 @@ iterative_hash_hashable_expr (const struct hashable_expr *expr, hashval_t val)
}
break;
+ case EXPR_TERNARY:
+ val = iterative_hash_object (expr->ops.ternary.op, val);
+ if (commutative_ternary_tree_code (expr->ops.ternary.op))
+ val = iterative_hash_exprs_commutative (expr->ops.ternary.opnd0,
+ expr->ops.ternary.opnd1, val);
+ else
+ {
+ val = iterative_hash_expr (expr->ops.ternary.opnd0, val);
+ val = iterative_hash_expr (expr->ops.ternary.opnd1, val);
+ }
+ val = iterative_hash_expr (expr->ops.ternary.opnd2, val);
+ break;
+
case EXPR_CALL:
{
size_t i;
@@ -511,6 +551,16 @@ print_expr_hash_elt (FILE * stream, const struct expr_hash_elt *element)
print_generic_expr (stream, element->expr.ops.binary.opnd1, 0);
break;
+ case EXPR_TERNARY:
+ fprintf (stream, " %s <", tree_code_name[element->expr.ops.ternary.op]);
+ print_generic_expr (stream, element->expr.ops.ternary.opnd0, 0);
+ fputs (", ", stream);
+ print_generic_expr (stream, element->expr.ops.ternary.opnd1, 0);
+ fputs (", ", stream);
+ print_generic_expr (stream, element->expr.ops.ternary.opnd2, 0);
+ fputs (">", stream);
+ break;
+
case EXPR_CALL:
{
size_t i;
@@ -1585,7 +1635,7 @@ record_edge_info (basic_block bb)
edge_info = allocate_edge_info (false_edge);
record_conditions (edge_info, inverted, cond);
- if (code == NE_EXPR)
+ if (TREE_CODE (inverted) == EQ_EXPR)
{
edge_info->lhs = op1;
edge_info->rhs = op0;
@@ -1612,7 +1662,7 @@ record_edge_info (basic_block bb)
edge_info = allocate_edge_info (false_edge);
record_conditions (edge_info, inverted, cond);
- if (TREE_CODE (cond) == NE_EXPR)
+ if (TREE_CODE (inverted) == EQ_EXPR)
{
edge_info->lhs = op0;
edge_info->rhs = op1;
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index eb6c831f7c8..5044afffcd9 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -628,9 +628,14 @@ forward_propagate_addr_into_variable_array_index (tree offset,
{
tree index, tunit;
gimple offset_def, use_stmt = gsi_stmt (*use_stmt_gsi);
- tree tmp;
+ tree new_rhs, tmp;
- tunit = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (def_rhs)));
+ if (TREE_CODE (TREE_OPERAND (def_rhs, 0)) == ARRAY_REF)
+ tunit = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (def_rhs)));
+ else if (TREE_CODE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))) == ARRAY_TYPE)
+ tunit = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (TREE_TYPE (def_rhs))));
+ else
+ return false;
if (!host_integerp (tunit, 1))
return false;
@@ -697,10 +702,28 @@ forward_propagate_addr_into_variable_array_index (tree offset,
/* Replace the pointer addition with array indexing. */
index = force_gimple_operand_gsi (use_stmt_gsi, index, true, NULL_TREE,
true, GSI_SAME_STMT);
- gimple_assign_set_rhs_from_tree (use_stmt_gsi, unshare_expr (def_rhs));
+ if (TREE_CODE (TREE_OPERAND (def_rhs, 0)) == ARRAY_REF)
+ {
+ new_rhs = unshare_expr (def_rhs);
+ TREE_OPERAND (TREE_OPERAND (new_rhs, 0), 1) = index;
+ }
+ else
+ {
+ new_rhs = build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (TREE_TYPE (def_rhs))),
+ unshare_expr (TREE_OPERAND (def_rhs, 0)),
+ index, integer_zero_node, NULL_TREE);
+ new_rhs = build_fold_addr_expr (new_rhs);
+ if (!useless_type_conversion_p (TREE_TYPE (gimple_assign_lhs (use_stmt)),
+ TREE_TYPE (new_rhs)))
+ {
+ new_rhs = force_gimple_operand_gsi (use_stmt_gsi, new_rhs, true,
+ NULL_TREE, true, GSI_SAME_STMT);
+ new_rhs = fold_convert (TREE_TYPE (gimple_assign_lhs (use_stmt)),
+ new_rhs);
+ }
+ }
+ gimple_assign_set_rhs_from_tree (use_stmt_gsi, new_rhs);
use_stmt = gsi_stmt (*use_stmt_gsi);
- TREE_OPERAND (TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0), 1)
- = index;
/* That should have created gimple, so there is no need to
record information to undo the propagation. */
@@ -725,11 +748,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
bool single_use_p)
{
tree lhs, rhs, rhs2, array_ref;
- tree *rhsp, *lhsp;
gimple use_stmt = gsi_stmt (*use_stmt_gsi);
enum tree_code rhs_code;
bool res = true;
- bool addr_p = false;
gcc_assert (TREE_CODE (def_rhs) == ADDR_EXPR);
@@ -767,31 +788,120 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
return true;
}
+ /* Propagate through constant pointer adjustments. */
+ if (TREE_CODE (lhs) == SSA_NAME
+ && rhs_code == POINTER_PLUS_EXPR
+ && rhs == name
+ && TREE_CODE (gimple_assign_rhs2 (use_stmt)) == INTEGER_CST)
+ {
+ tree new_def_rhs;
+ /* As we come here with non-invariant addresses in def_rhs we need
+ to make sure we can build a valid constant offsetted address
+ for further propagation. Simply rely on fold building that
+ and check after the fact. */
+ new_def_rhs = fold_build2 (MEM_REF, TREE_TYPE (TREE_TYPE (rhs)),
+ def_rhs,
+ fold_convert (ptr_type_node,
+ gimple_assign_rhs2 (use_stmt)));
+ if (TREE_CODE (new_def_rhs) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (new_def_rhs, 0)) == ADDR_EXPR
+ && !DECL_P (TREE_OPERAND (TREE_OPERAND (new_def_rhs, 0), 0))
+ && !CONSTANT_CLASS_P (TREE_OPERAND (TREE_OPERAND (new_def_rhs, 0), 0)))
+ return false;
+ new_def_rhs = build_fold_addr_expr_with_type (new_def_rhs,
+ TREE_TYPE (rhs));
+
+ /* Recurse. If we could propagate into all uses of lhs do not
+ bother to replace into the current use but just pretend we did. */
+ if (TREE_CODE (new_def_rhs) == ADDR_EXPR
+ && forward_propagate_addr_expr (lhs, new_def_rhs))
+ return true;
+
+ if (useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (new_def_rhs)))
+ gimple_assign_set_rhs_with_ops (use_stmt_gsi, TREE_CODE (new_def_rhs),
+ new_def_rhs, NULL_TREE);
+ else if (is_gimple_min_invariant (new_def_rhs))
+ gimple_assign_set_rhs_with_ops (use_stmt_gsi, NOP_EXPR,
+ new_def_rhs, NULL_TREE);
+ else
+ return false;
+ gcc_assert (gsi_stmt (*use_stmt_gsi) == use_stmt);
+ update_stmt (use_stmt);
+ return true;
+ }
+
/* Now strip away any outer COMPONENT_REF/ARRAY_REF nodes from the LHS.
ADDR_EXPR will not appear on the LHS. */
- lhsp = gimple_assign_lhs_ptr (use_stmt);
- while (handled_component_p (*lhsp))
- lhsp = &TREE_OPERAND (*lhsp, 0);
- lhs = *lhsp;
+ lhs = gimple_assign_lhs (use_stmt);
+ while (handled_component_p (lhs))
+ lhs = TREE_OPERAND (lhs, 0);
- /* Now see if the LHS node is an INDIRECT_REF using NAME. If so,
+ /* Now see if the LHS node is a MEM_REF using NAME. If so,
propagate the ADDR_EXPR into the use of NAME and fold the result. */
- if (TREE_CODE (lhs) == INDIRECT_REF
+ if (TREE_CODE (lhs) == MEM_REF
&& TREE_OPERAND (lhs, 0) == name)
{
- if (may_propagate_address_into_dereference (def_rhs, lhs)
- && (lhsp != gimple_assign_lhs_ptr (use_stmt)
- || useless_type_conversion_p
- (TREE_TYPE (TREE_OPERAND (def_rhs, 0)), TREE_TYPE (rhs))))
+ tree def_rhs_base;
+ HOST_WIDE_INT def_rhs_offset;
+ /* If the address is invariant we can always fold it. */
+ if ((def_rhs_base = get_addr_base_and_unit_offset (TREE_OPERAND (def_rhs, 0),
+ &def_rhs_offset)))
{
- *lhsp = unshare_expr (TREE_OPERAND (def_rhs, 0));
- fold_stmt_inplace (use_stmt);
+ double_int off = mem_ref_offset (lhs);
+ tree new_ptr;
+ off = double_int_add (off,
+ shwi_to_double_int (def_rhs_offset));
+ if (TREE_CODE (def_rhs_base) == MEM_REF)
+ {
+ off = double_int_add (off, mem_ref_offset (def_rhs_base));
+ new_ptr = TREE_OPERAND (def_rhs_base, 0);
+ }
+ else
+ new_ptr = build_fold_addr_expr (def_rhs_base);
+ TREE_OPERAND (lhs, 0) = new_ptr;
+ TREE_OPERAND (lhs, 1)
+ = double_int_to_tree (TREE_TYPE (TREE_OPERAND (lhs, 1)), off);
tidy_after_forward_propagate_addr (use_stmt);
-
/* Continue propagating into the RHS if this was not the only use. */
if (single_use_p)
return true;
}
+ /* If the LHS is a plain dereference and the value type is the same as
+ that of the pointed-to type of the address we can put the
+ dereferenced address on the LHS preserving the original alias-type. */
+ else if (gimple_assign_lhs (use_stmt) == lhs
+ && useless_type_conversion_p
+ (TREE_TYPE (TREE_OPERAND (def_rhs, 0)),
+ TREE_TYPE (gimple_assign_rhs1 (use_stmt))))
+ {
+ tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0);
+ tree new_offset, new_base, saved;
+ while (handled_component_p (*def_rhs_basep))
+ def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0);
+ saved = *def_rhs_basep;
+ if (TREE_CODE (*def_rhs_basep) == MEM_REF)
+ {
+ new_base = TREE_OPERAND (*def_rhs_basep, 0);
+ new_offset
+ = int_const_binop (PLUS_EXPR, TREE_OPERAND (lhs, 1),
+ TREE_OPERAND (*def_rhs_basep, 1), 0);
+ }
+ else
+ {
+ new_base = build_fold_addr_expr (*def_rhs_basep);
+ new_offset = TREE_OPERAND (lhs, 1);
+ }
+ *def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep),
+ new_base, new_offset);
+ gimple_assign_set_lhs (use_stmt,
+ unshare_expr (TREE_OPERAND (def_rhs, 0)));
+ *def_rhs_basep = saved;
+ tidy_after_forward_propagate_addr (use_stmt);
+ /* Continue propagating into the RHS if this was not the
+ only use. */
+ if (single_use_p)
+ return true;
+ }
else
/* We can have a struct assignment dereferencing our name twice.
Note that we didn't propagate into the lhs to not falsely
@@ -801,79 +911,76 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
/* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
nodes from the RHS. */
- rhsp = gimple_assign_rhs1_ptr (use_stmt);
- if (TREE_CODE (*rhsp) == ADDR_EXPR)
- {
- rhsp = &TREE_OPERAND (*rhsp, 0);
- addr_p = true;
- }
- while (handled_component_p (*rhsp))
- rhsp = &TREE_OPERAND (*rhsp, 0);
- rhs = *rhsp;
+ rhs = gimple_assign_rhs1 (use_stmt);
+ if (TREE_CODE (rhs) == ADDR_EXPR)
+ rhs = TREE_OPERAND (rhs, 0);
+ while (handled_component_p (rhs))
+ rhs = TREE_OPERAND (rhs, 0);
- /* Now see if the RHS node is an INDIRECT_REF using NAME. If so,
+ /* Now see if the RHS node is a MEM_REF using NAME. If so,
propagate the ADDR_EXPR into the use of NAME and fold the result. */
- if (TREE_CODE (rhs) == INDIRECT_REF
- && TREE_OPERAND (rhs, 0) == name
- && may_propagate_address_into_dereference (def_rhs, rhs))
+ if (TREE_CODE (rhs) == MEM_REF
+ && TREE_OPERAND (rhs, 0) == name)
{
- *rhsp = unshare_expr (TREE_OPERAND (def_rhs, 0));
- fold_stmt_inplace (use_stmt);
- tidy_after_forward_propagate_addr (use_stmt);
- return res;
+ tree def_rhs_base;
+ HOST_WIDE_INT def_rhs_offset;
+ if ((def_rhs_base = get_addr_base_and_unit_offset (TREE_OPERAND (def_rhs, 0),
+ &def_rhs_offset)))
+ {
+ double_int off = mem_ref_offset (rhs);
+ tree new_ptr;
+ off = double_int_add (off,
+ shwi_to_double_int (def_rhs_offset));
+ if (TREE_CODE (def_rhs_base) == MEM_REF)
+ {
+ off = double_int_add (off, mem_ref_offset (def_rhs_base));
+ new_ptr = TREE_OPERAND (def_rhs_base, 0);
+ }
+ else
+ new_ptr = build_fold_addr_expr (def_rhs_base);
+ TREE_OPERAND (rhs, 0) = new_ptr;
+ TREE_OPERAND (rhs, 1)
+ = double_int_to_tree (TREE_TYPE (TREE_OPERAND (rhs, 1)), off);
+ fold_stmt_inplace (use_stmt);
+ tidy_after_forward_propagate_addr (use_stmt);
+ return res;
+ }
+ /* If the LHS is a plain dereference and the value type is the same as
+ that of the pointed-to type of the address we can put the
+ dereferenced address on the LHS preserving the original alias-type. */
+ else if (gimple_assign_rhs1 (use_stmt) == rhs
+ && useless_type_conversion_p
+ (TREE_TYPE (gimple_assign_lhs (use_stmt)),
+ TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
+ {
+ tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0);
+ tree new_offset, new_base, saved;
+ while (handled_component_p (*def_rhs_basep))
+ def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0);
+ saved = *def_rhs_basep;
+ if (TREE_CODE (*def_rhs_basep) == MEM_REF)
+ {
+ new_base = TREE_OPERAND (*def_rhs_basep, 0);
+ new_offset
+ = int_const_binop (PLUS_EXPR, TREE_OPERAND (rhs, 1),
+ TREE_OPERAND (*def_rhs_basep, 1), 0);
+ }
+ else
+ {
+ new_base = build_fold_addr_expr (*def_rhs_basep);
+ new_offset = TREE_OPERAND (rhs, 1);
+ }
+ *def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep),
+ new_base, new_offset);
+ gimple_assign_set_rhs1 (use_stmt,
+ unshare_expr (TREE_OPERAND (def_rhs, 0)));
+ *def_rhs_basep = saved;
+ fold_stmt_inplace (use_stmt);
+ tidy_after_forward_propagate_addr (use_stmt);
+ return res;
+ }
}
- /* Now see if the RHS node is an INDIRECT_REF using NAME. If so,
- propagate the ADDR_EXPR into the use of NAME and try to
- create a VCE and fold the result. */
- if (TREE_CODE (rhs) == INDIRECT_REF
- && TREE_OPERAND (rhs, 0) == name
- && TYPE_SIZE (TREE_TYPE (rhs))
- && TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0)))
- /* Function decls should not be used for VCE either as it could be a
- function descriptor that we want and not the actual function code. */
- && TREE_CODE (TREE_OPERAND (def_rhs, 0)) != FUNCTION_DECL
- /* We should not convert volatile loads to non volatile loads. */
- && !TYPE_VOLATILE (TREE_TYPE (rhs))
- && !TYPE_VOLATILE (TREE_TYPE (TREE_OPERAND (def_rhs, 0)))
- && operand_equal_p (TYPE_SIZE (TREE_TYPE (rhs)),
- TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))), 0)
- /* Make sure we only do TBAA compatible replacements. */
- && get_alias_set (TREE_OPERAND (def_rhs, 0)) == get_alias_set (rhs))
- {
- tree def_rhs_base, new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
- new_rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (rhs), new_rhs);
- if (TREE_CODE (new_rhs) != VIEW_CONVERT_EXPR)
- {
- /* If we have folded the VIEW_CONVERT_EXPR then the result is only
- valid if we can replace the whole rhs of the use statement. */
- if (rhs != gimple_assign_rhs1 (use_stmt))
- return false;
- new_rhs = force_gimple_operand_gsi (use_stmt_gsi, new_rhs, true, NULL,
- true, GSI_NEW_STMT);
- gimple_assign_set_rhs1 (use_stmt, new_rhs);
- tidy_after_forward_propagate_addr (use_stmt);
- return res;
- }
- /* If the defining rhs comes from an indirect reference, then do not
- convert into a VIEW_CONVERT_EXPR. Likewise if we'll end up taking
- the address of a V_C_E of a constant. */
- def_rhs_base = TREE_OPERAND (def_rhs, 0);
- while (handled_component_p (def_rhs_base))
- def_rhs_base = TREE_OPERAND (def_rhs_base, 0);
- if (!INDIRECT_REF_P (def_rhs_base)
- && (!addr_p
- || !is_gimple_min_invariant (def_rhs)))
- {
- /* We may have arbitrary VIEW_CONVERT_EXPRs in a nested component
- reference. Place it there and fold the thing. */
- *rhsp = new_rhs;
- fold_stmt_inplace (use_stmt);
- tidy_after_forward_propagate_addr (use_stmt);
- return res;
- }
- }
-
/* If the use of the ADDR_EXPR is not a POINTER_PLUS_EXPR, there
is nothing to do. */
if (gimple_assign_rhs_code (use_stmt) != POINTER_PLUS_EXPR
@@ -885,9 +992,10 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
element zero in an array. If that is not the case then there
is nothing to do. */
array_ref = TREE_OPERAND (def_rhs, 0);
- if (TREE_CODE (array_ref) != ARRAY_REF
- || TREE_CODE (TREE_TYPE (TREE_OPERAND (array_ref, 0))) != ARRAY_TYPE
- || TREE_CODE (TREE_OPERAND (array_ref, 1)) != INTEGER_CST)
+ if ((TREE_CODE (array_ref) != ARRAY_REF
+ || TREE_CODE (TREE_TYPE (TREE_OPERAND (array_ref, 0))) != ARRAY_TYPE
+ || TREE_CODE (TREE_OPERAND (array_ref, 1)) != INTEGER_CST)
+ && TREE_CODE (TREE_TYPE (array_ref)) != ARRAY_TYPE)
return false;
rhs2 = gimple_assign_rhs2 (use_stmt);
@@ -923,7 +1031,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
array elements, then the result is converted into the proper
type for the arithmetic. */
if (TREE_CODE (rhs2) == SSA_NAME
- && integer_zerop (TREE_OPERAND (array_ref, 1))
+ && (TREE_CODE (array_ref) != ARRAY_REF
+ || integer_zerop (TREE_OPERAND (array_ref, 1)))
&& useless_type_conversion_p (TREE_TYPE (name), TREE_TYPE (def_rhs))
/* Avoid problems with IVopts creating PLUS_EXPRs with a
different type than their operands. */
@@ -1300,13 +1409,35 @@ tree_ssa_forward_propagate_single_use_vars (void)
else
gsi_next (&gsi);
}
- else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
- && is_gimple_min_invariant (rhs))
+ else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
{
- /* Make sure to fold &a[0] + off_1 here. */
- fold_stmt_inplace (stmt);
- update_stmt (stmt);
- if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
+ /* ??? Better adjust the interface to that function
+ instead of building new trees here. */
+ && forward_propagate_addr_expr
+ (lhs,
+ build1 (ADDR_EXPR,
+ TREE_TYPE (rhs),
+ fold_build2 (MEM_REF,
+ TREE_TYPE (TREE_TYPE (rhs)),
+ rhs,
+ fold_convert
+ (ptr_type_node,
+ gimple_assign_rhs2 (stmt))))))
+ {
+ release_defs (stmt);
+ todoflags |= TODO_remove_unused_locals;
+ gsi_remove (&gsi, true);
+ }
+ else if (is_gimple_min_invariant (rhs))
+ {
+ /* Make sure to fold &a[0] + off_1 here. */
+ fold_stmt_inplace (stmt);
+ update_stmt (stmt);
+ if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+ gsi_next (&gsi);
+ }
+ else
gsi_next (&gsi);
}
else if ((gimple_assign_rhs_code (stmt) == BIT_NOT_EXPR
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index a20f7040403..bc551b2231c 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -366,21 +366,16 @@ ifcombine_ifandif (basic_block inner_cond_bb, basic_block outer_cond_bb)
/* See if we have two comparisons that we can merge into one. */
else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
- && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison
- && operand_equal_p (gimple_cond_lhs (inner_cond),
- gimple_cond_lhs (outer_cond), 0)
- && operand_equal_p (gimple_cond_rhs (inner_cond),
- gimple_cond_rhs (outer_cond), 0))
+ && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison)
{
- enum tree_code code1 = gimple_cond_code (inner_cond);
- enum tree_code code2 = gimple_cond_code (outer_cond);
tree t;
- if (!(t = combine_comparisons (UNKNOWN_LOCATION,
- TRUTH_ANDIF_EXPR, code1, code2,
- boolean_type_node,
- gimple_cond_lhs (outer_cond),
- gimple_cond_rhs (outer_cond))))
+ if (!(t = maybe_fold_and_comparisons (gimple_cond_code (inner_cond),
+ gimple_cond_lhs (inner_cond),
+ gimple_cond_rhs (inner_cond),
+ gimple_cond_code (outer_cond),
+ gimple_cond_lhs (outer_cond),
+ gimple_cond_rhs (outer_cond))))
return false;
t = canonicalize_cond_expr_cond (t);
if (!t)
@@ -518,22 +513,17 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
/* See if we have two comparisons that we can merge into one.
This happens for C++ operator overloading where for example
GE_EXPR is implemented as GT_EXPR || EQ_EXPR. */
- else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
- && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison
- && operand_equal_p (gimple_cond_lhs (inner_cond),
- gimple_cond_lhs (outer_cond), 0)
- && operand_equal_p (gimple_cond_rhs (inner_cond),
- gimple_cond_rhs (outer_cond), 0))
+ else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
+ && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison)
{
- enum tree_code code1 = gimple_cond_code (inner_cond);
- enum tree_code code2 = gimple_cond_code (outer_cond);
tree t;
- if (!(t = combine_comparisons (UNKNOWN_LOCATION,
- TRUTH_ORIF_EXPR, code1, code2,
- boolean_type_node,
- gimple_cond_lhs (outer_cond),
- gimple_cond_rhs (outer_cond))))
+ if (!(t = maybe_fold_or_comparisons (gimple_cond_code (inner_cond),
+ gimple_cond_lhs (inner_cond),
+ gimple_cond_rhs (inner_cond),
+ gimple_cond_code (outer_cond),
+ gimple_cond_lhs (outer_cond),
+ gimple_cond_rhs (outer_cond))))
return false;
t = canonicalize_cond_expr_cond (t);
if (!t)
diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h
index f49f065d69d..c2af48b9850 100644
--- a/gcc/tree-ssa-live.h
+++ b/gcc/tree-ssa-live.h
@@ -144,7 +144,6 @@ var_to_partition (var_map map, tree var)
{
int part;
- gcc_assert (TREE_CODE (var) == SSA_NAME);
part = partition_find (map->var_partition, SSA_NAME_VERSION (var));
if (map->partition_to_view)
part = map->partition_to_view[part];
@@ -172,8 +171,8 @@ var_to_partition_to_var (var_map map, tree var)
static inline int
basevar_index (var_map map, int partition)
{
- gcc_assert (partition >= 0
- && partition <= (int) num_var_partitions (map));
+ gcc_checking_assert (partition >= 0
+ && partition <= (int) num_var_partitions (map));
return map->partition_to_base_index[partition];
}
@@ -271,7 +270,7 @@ extern void dump_live_info (FILE *, tree_live_info_p, int);
static inline int
partition_is_global (tree_live_info_p live, int p)
{
- gcc_assert (live->global);
+ gcc_checking_assert (live->global);
return bitmap_bit_p (live->global, p);
}
@@ -282,9 +281,9 @@ partition_is_global (tree_live_info_p live, int p)
static inline bitmap
live_on_entry (tree_live_info_p live, basic_block bb)
{
- gcc_assert (live->livein);
- gcc_assert (bb != ENTRY_BLOCK_PTR);
- gcc_assert (bb != EXIT_BLOCK_PTR);
+ gcc_checking_assert (live->livein
+ && bb != ENTRY_BLOCK_PTR
+ && bb != EXIT_BLOCK_PTR);
return live->livein[bb->index];
}
@@ -296,9 +295,9 @@ live_on_entry (tree_live_info_p live, basic_block bb)
static inline bitmap
live_on_exit (tree_live_info_p live, basic_block bb)
{
- gcc_assert (live->liveout);
- gcc_assert (bb != ENTRY_BLOCK_PTR);
- gcc_assert (bb != EXIT_BLOCK_PTR);
+ gcc_checking_assert (live->liveout
+ && bb != ENTRY_BLOCK_PTR
+ && bb != EXIT_BLOCK_PTR);
return live->liveout[bb->index];
}
@@ -319,8 +318,7 @@ live_var_map (tree_live_info_p live)
static inline void
live_merge_and_clear (tree_live_info_p live, int p1, int p2)
{
- gcc_assert (live->livein[p1]);
- gcc_assert (live->livein[p2]);
+ gcc_checking_assert (live->livein[p1] && live->livein[p2]);
bitmap_ior_into (live->livein[p1], live->livein[p2]);
bitmap_zero (live->livein[p2]);
}
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index ce8bc34ebba..6aaeaa09b59 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -274,7 +274,7 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data)
case MISALIGNED_INDIRECT_REF:
case ALIGN_INDIRECT_REF:
- case INDIRECT_REF:
+ case MEM_REF:
nxt = &TREE_OPERAND (*addr_p, 0);
return cbck (*addr_p, nxt, data);
@@ -1985,11 +1985,15 @@ gen_lsm_tmp_name (tree ref)
{
case MISALIGNED_INDIRECT_REF:
case ALIGN_INDIRECT_REF:
- case INDIRECT_REF:
+ case MEM_REF:
gen_lsm_tmp_name (TREE_OPERAND (ref, 0));
lsm_tmp_name_add ("_");
break;
+ case ADDR_EXPR:
+ gen_lsm_tmp_name (TREE_OPERAND (ref, 0));
+ break;
+
case BIT_FIELD_REF:
case VIEW_CONVERT_EXPR:
case ARRAY_RANGE_REF:
@@ -2150,7 +2154,8 @@ ref_always_accessed_p (struct loop *loop, mem_ref_p ref, bool stored_p)
tree base;
base = get_base_address (ref->mem);
- if (INDIRECT_REF_P (base))
+ if (INDIRECT_REF_P (base)
+ || TREE_CODE (base) == MEM_REF)
base = TREE_OPERAND (base, 0);
get_all_locs_in_loop (loop, ref, &locs);
@@ -2169,7 +2174,8 @@ ref_always_accessed_p (struct loop *loop, mem_ref_p ref, bool stored_p)
lhs = get_base_address (gimple_get_lhs (loc->stmt));
if (!lhs)
continue;
- if (INDIRECT_REF_P (lhs))
+ if (INDIRECT_REF_P (lhs)
+ || TREE_CODE (lhs) == MEM_REF)
lhs = TREE_OPERAND (lhs, 0);
if (lhs != base)
continue;
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 094e9cc8fe2..46356588c94 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -813,7 +813,7 @@ determine_base_object (tree expr)
if (!base)
return expr;
- if (TREE_CODE (base) == INDIRECT_REF)
+ if (TREE_CODE (base) == MEM_REF)
return determine_base_object (TREE_OPERAND (base, 0));
return fold_convert (ptr_type_node,
@@ -1694,9 +1694,11 @@ find_interesting_uses_address (struct ivopts_data *data, gimple stmt, tree *op_p
tree *ref = &TREE_OPERAND (base, 0);
while (handled_component_p (*ref))
ref = &TREE_OPERAND (*ref, 0);
- if (TREE_CODE (*ref) == INDIRECT_REF)
+ if (TREE_CODE (*ref) == MEM_REF)
{
- tree tem = gimple_fold_indirect_ref (TREE_OPERAND (*ref, 0));
+ tree tem = fold_binary (MEM_REF, TREE_TYPE (*ref),
+ TREE_OPERAND (*ref, 0),
+ TREE_OPERAND (*ref, 1));
if (tem)
*ref = tem;
}
@@ -2018,7 +2020,8 @@ strip_offset_1 (tree expr, bool inside_addr, bool top_compref,
expr = build_fold_addr_expr (op0);
return fold_convert (orig_type, expr);
- case INDIRECT_REF:
+ case MEM_REF:
+ /* ??? Offset operand? */
inside_addr = false;
break;
@@ -2936,6 +2939,20 @@ get_computation (struct loop *loop, struct iv_use *use, struct iv_cand *cand)
return get_computation_at (loop, use, cand, use->stmt);
}
+/* Adjust the cost COST for being in loop setup rather than loop body.
+ If we're optimizing for space, the loop setup overhead is constant;
+ if we're optimizing for speed, amortize it over the per-iteration cost. */
+static unsigned
+adjust_setup_cost (struct ivopts_data *data, unsigned cost)
+{
+ if (cost == INFTY)
+ return cost;
+ else if (optimize_loop_for_speed_p (data->current_loop))
+ return cost / AVG_LOOP_NITER (data->current_loop);
+ else
+ return cost;
+}
+
/* Returns cost of addition in MODE. */
static unsigned
@@ -3848,8 +3865,8 @@ get_computation_cost_at (struct ivopts_data *data,
/* Symbol + offset should be compile-time computable so consider that they
are added once to the variable, if present. */
if (var_present && (symbol_present || offset))
- cost.cost += add_cost (TYPE_MODE (ctype), speed)
- / AVG_LOOP_NITER (data->current_loop);
+ cost.cost += adjust_setup_cost (data,
+ add_cost (TYPE_MODE (ctype), speed));
/* Having offset does not affect runtime cost in case it is added to
symbol, but it increases complexity. */
@@ -3861,6 +3878,7 @@ get_computation_cost_at (struct ivopts_data *data,
aratio = ratio > 0 ? ratio : -ratio;
if (aratio != 1)
cost.cost += multiply_by_cost (aratio, TYPE_MODE (ctype), speed);
+ return cost;
fallback:
if (can_autoinc)
@@ -3874,7 +3892,7 @@ fallback:
return infinite_cost;
if (address_p)
- comp = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (comp)), comp);
+ comp = build_simple_mem_ref (comp);
return new_cost (computation_cost (comp, speed), 0);
}
@@ -4114,7 +4132,7 @@ determine_use_iv_cost_condition (struct ivopts_data *data,
elim_cost = force_var_cost (data, bound, &depends_on_elim);
/* The bound is a loop invariant, so it will be only computed
once. */
- elim_cost.cost /= AVG_LOOP_NITER (data->current_loop);
+ elim_cost.cost = adjust_setup_cost (data, elim_cost.cost);
}
else
elim_cost = infinite_cost;
@@ -4361,7 +4379,7 @@ determine_iv_cost (struct ivopts_data *data, struct iv_cand *cand)
cost_base = force_var_cost (data, base, NULL);
cost_step = add_cost (TYPE_MODE (TREE_TYPE (base)), data->speed);
- cost = cost_step + cost_base.cost / AVG_LOOP_NITER (current_loop);
+ cost = cost_step + adjust_setup_cost (data, cost_base.cost);
/* Prefer the original ivs unless we may gain something by replacing it.
The reason is to make debugging simpler; so this is not relevant for
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 219c71b9a96..c6dc8ed55ea 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -1081,7 +1081,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
/* Finally create the new counter for number of iterations and add the new
exit instruction. */
- bsi = gsi_last_bb (exit_bb);
+ bsi = gsi_last_nondebug_bb (exit_bb);
exit_if = gsi_stmt (bsi);
create_iv (exit_base, exit_step, NULL_TREE, loop,
&bsi, false, &ctr_before, &ctr_after);
@@ -1217,7 +1217,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
}
- gsi = gsi_last_bb (bump_in_latch ? loop->latch : loop->header);
+ gsi = gsi_last_nondebug_bb (bump_in_latch ? loop->latch : loop->header);
create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE,
loop, &gsi, bump_in_latch, &var_before, NULL);
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 279718ee5e4..9956cc551b4 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -875,11 +875,11 @@ assert_loop_rolls_lt (tree type, affine_iv *iv0, affine_iv *iv1,
-step + 1 <= (iv1->base - iv0->base) <= MAX - step + 1
(where MAX is the maximum value of the unsigned variant of TYPE, and
- the computations in this formula are performed in full precision
- (without overflows).
+ the computations in this formula are performed in full precision,
+ i.e., without overflows).
Usually, for loops with exit condition iv0->base + step * i < iv1->base,
- we have a condition of form iv0->base - step < iv1->base before the loop,
+ we have a condition of the form iv0->base - step < iv1->base before the loop,
and for loops iv0->base < iv1->base - step * i the condition
iv0->base < iv1->base + step, due to loop header copying, which enable us
to prove the lower bound.
@@ -1374,6 +1374,10 @@ simplify_replace_tree (tree expr, tree old, tree new_tree)
if (!expr)
return NULL_TREE;
+ /* Do not bother to replace constants. */
+ if (CONSTANT_CLASS_P (old))
+ return expr;
+
if (expr == old
|| operand_equal_p (expr, old, 0))
return unshare_expr (new_tree);
@@ -2521,7 +2525,7 @@ record_estimate (struct loop *loop, tree bound, double_int i_bound,
list. */
if (upper)
{
- struct nb_iter_bound *elt = GGC_NEW (struct nb_iter_bound);
+ struct nb_iter_bound *elt = ggc_alloc_nb_iter_bound ();
elt->bound = i_bound;
elt->stmt = at_stmt;
@@ -2621,7 +2625,7 @@ array_at_struct_end_p (tree ref)
/* Unless the reference is through a pointer, the size of the array matches
its declaration. */
- if (!base || !INDIRECT_REF_P (base))
+ if (!base || (!INDIRECT_REF_P (base) && TREE_CODE (base) != MEM_REF))
return false;
for (;handled_component_p (ref); ref = parent)
@@ -2647,7 +2651,6 @@ array_at_struct_end_p (tree ref)
Therefore, continue checking. */
}
- gcc_assert (INDIRECT_REF_P (ref));
return true;
}
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 9ccf72e18b2..65474898ad9 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -228,13 +228,13 @@ struct mem_ref_group
/* Do not generate a prefetch if the unroll factor is significantly less
than what is required by the prefetch. This is to avoid redundant
- prefetches. For example, if prefetch_mod is 16 and unroll_factor is
- 1, this means prefetching requires unrolling the loop 16 times, but
- the loop is not going to be unrolled. In this case (ratio = 16),
+ prefetches. For example, when prefetch_mod is 16 and unroll_factor is
+ 2, prefetching requires unrolling the loop 16 times, but
+ the loop is actually unrolled twice. In this case (ratio = 8),
prefetching is not likely to be beneficial. */
#ifndef PREFETCH_MOD_TO_UNROLL_FACTOR_RATIO
-#define PREFETCH_MOD_TO_UNROLL_FACTOR_RATIO 8
+#define PREFETCH_MOD_TO_UNROLL_FACTOR_RATIO 4
#endif
/* The memory reference. */
@@ -513,6 +513,10 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
if (step == NULL_TREE)
return false;
+ /* Limit non-constant step prefetching only to the innermost loops. */
+ if (!cst_and_fits_in_hwi (step) && loop->inner != NULL)
+ return false;
+
/* Now we know that REF = &BASE + STEP * iter + DELTA, where DELTA and STEP
are integer constants. */
agrp = find_or_create_group (refs, base, step);
@@ -990,18 +994,40 @@ schedule_prefetches (struct mem_ref_group *groups, unsigned unroll_factor,
return any;
}
-/* Estimate the number of prefetches in the given GROUPS. */
+/* Return TRUE if no prefetch is going to be generated in the given
+ GROUPS. */
+
+static bool
+nothing_to_prefetch_p (struct mem_ref_group *groups)
+{
+ struct mem_ref *ref;
+
+ for (; groups; groups = groups->next)
+ for (ref = groups->refs; ref; ref = ref->next)
+ if (should_issue_prefetch_p (ref))
+ return false;
+
+ return true;
+}
+
+/* Estimate the number of prefetches in the given GROUPS.
+ UNROLL_FACTOR is the factor by which LOOP was unrolled. */
static int
-estimate_prefetch_count (struct mem_ref_group *groups)
+estimate_prefetch_count (struct mem_ref_group *groups, unsigned unroll_factor)
{
struct mem_ref *ref;
+ unsigned n_prefetches;
int prefetch_count = 0;
for (; groups; groups = groups->next)
for (ref = groups->refs; ref; ref = ref->next)
if (should_issue_prefetch_p (ref))
- prefetch_count++;
+ {
+ n_prefetches = ((unroll_factor + ref->prefetch_mod - 1)
+ / ref->prefetch_mod);
+ prefetch_count += n_prefetches;
+ }
return prefetch_count;
}
@@ -1712,8 +1738,7 @@ loop_prefetch_arrays (struct loop *loop)
/* Step 2: estimate the reuse effects. */
prune_by_reuse (refs);
- prefetch_count = estimate_prefetch_count (refs);
- if (prefetch_count == 0)
+ if (nothing_to_prefetch_p (refs))
goto fail;
determine_loop_nest_reuse (loop, refs, no_other_refs);
@@ -1729,6 +1754,12 @@ loop_prefetch_arrays (struct loop *loop)
ninsns = tree_num_loop_insns (loop, &eni_size_weights);
unroll_factor = determine_unroll_factor (loop, refs, ninsns, &desc,
est_niter);
+
+ /* Estimate prefetch count for the unrolled loop. */
+ prefetch_count = estimate_prefetch_count (refs, unroll_factor);
+ if (prefetch_count == 0)
+ goto fail;
+
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Ahead %d, unroll factor %d, trip count "
HOST_WIDE_INT_PRINT_DEC "\n"
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 6bc40af263c..b6b32dcd99a 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -1,5 +1,5 @@
/* Loop unswitching.
- Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -129,6 +129,12 @@ tree_may_unswitch_on (basic_block bb, struct loop *loop)
if (!stmt || gimple_code (stmt) != GIMPLE_COND)
return NULL_TREE;
+ /* To keep the things simple, we do not directly remove the conditions,
+ but just replace tests with 0 != 0 resp. 1 != 0. Prevent the infinite
+ loop where we would unswitch again on such a condition. */
+ if (gimple_cond_true_p (stmt) || gimple_cond_false_p (stmt))
+ return NULL_TREE;
+
/* Condition must be invariant. */
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
{
@@ -142,12 +148,6 @@ tree_may_unswitch_on (basic_block bb, struct loop *loop)
cond = build2 (gimple_cond_code (stmt), boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
- /* To keep the things simple, we do not directly remove the conditions,
- but just replace tests with 0/1. Prevent the infinite loop where we
- would unswitch again on such a condition. */
- if (integer_zerop (cond) || integer_nonzerop (cond))
- return NULL_TREE;
-
return cond;
}
@@ -193,21 +193,14 @@ tree_unswitch_single_loop (struct loop *loop, int num)
{
basic_block *bbs;
struct loop *nloop;
- unsigned i;
+ unsigned i, found;
tree cond = NULL_TREE;
gimple stmt;
bool changed = false;
- /* Do not unswitch too much. */
- if (num > PARAM_VALUE (PARAM_MAX_UNSWITCH_LEVEL))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
- return false;
- }
-
i = 0;
bbs = get_loop_body (loop);
+ found = loop->num_nodes;
while (1)
{
@@ -218,8 +211,17 @@ tree_unswitch_single_loop (struct loop *loop, int num)
if (i == loop->num_nodes)
{
- free (bbs);
- return changed;
+ if (dump_file
+ && num > PARAM_VALUE (PARAM_MAX_UNSWITCH_LEVEL)
+ && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
+
+ if (found == loop->num_nodes)
+ {
+ free (bbs);
+ return changed;
+ }
+ break;
}
cond = simplify_using_entry_checks (loop, cond);
@@ -236,19 +238,107 @@ tree_unswitch_single_loop (struct loop *loop, int num)
gimple_cond_set_condition_from_tree (stmt, boolean_false_node);
changed = true;
}
+ /* Do not unswitch too much. */
+ else if (num > PARAM_VALUE (PARAM_MAX_UNSWITCH_LEVEL))
+ {
+ i++;
+ continue;
+ }
+ /* In nested tree_unswitch_single_loop first optimize all conditions
+ using entry checks, then discover still reachable blocks in the
+ loop and find the condition only among those still reachable bbs. */
+ else if (num != 0)
+ {
+ if (found == loop->num_nodes)
+ found = i;
+ i++;
+ continue;
+ }
else
- break;
+ {
+ found = i;
+ break;
+ }
update_stmt (stmt);
i++;
}
+ if (num != 0)
+ {
+ basic_block *tos, *worklist;
+
+ /* When called recursively, first do a quick discovery
+ of reachable bbs after the above changes and only
+ consider conditions in still reachable bbs. */
+ tos = worklist = XNEWVEC (basic_block, loop->num_nodes);
+
+ for (i = 0; i < loop->num_nodes; i++)
+ bbs[i]->flags &= ~BB_REACHABLE;
+
+ /* Start with marking header. */
+ *tos++ = bbs[0];
+ bbs[0]->flags |= BB_REACHABLE;
+
+ /* Iterate: find everything reachable from what we've already seen
+ within the same innermost loop. Don't look through false edges
+ if condition is always true or true edges if condition is
+ always false. */
+ while (tos != worklist)
+ {
+ basic_block b = *--tos;
+ edge e;
+ edge_iterator ei;
+ int flags = 0;
+
+ if (EDGE_COUNT (b->succs) == 2)
+ {
+ gimple stmt = last_stmt (b);
+ if (stmt
+ && gimple_code (stmt) == GIMPLE_COND)
+ {
+ if (gimple_cond_true_p (stmt))
+ flags = EDGE_FALSE_VALUE;
+ else if (gimple_cond_false_p (stmt))
+ flags = EDGE_TRUE_VALUE;
+ }
+ }
+
+ FOR_EACH_EDGE (e, ei, b->succs)
+ {
+ basic_block dest = e->dest;
+
+ if (dest->loop_father == loop
+ && !(dest->flags & BB_REACHABLE)
+ && !(e->flags & flags))
+ {
+ *tos++ = dest;
+ dest->flags |= BB_REACHABLE;
+ }
+ }
+ }
+
+ free (worklist);
+
+ /* Find a bb to unswitch on. */
+ for (; found < loop->num_nodes; found++)
+ if ((bbs[found]->flags & BB_REACHABLE)
+ && (cond = tree_may_unswitch_on (bbs[found], loop)))
+ break;
+
+ if (found == loop->num_nodes)
+ {
+ free (bbs);
+ return changed;
+ }
+ }
+
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, ";; Unswitching loop\n");
initialize_original_copy_tables ();
/* Unswitch the loop on this condition. */
- nloop = tree_unswitch_loop (loop, bbs[i], cond);
+ nloop = tree_unswitch_loop (loop, bbs[found], cond);
if (!nloop)
{
free_original_copy_tables ();
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 344cfa8acbe..c9c5bbd0f0c 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -600,7 +600,7 @@ tree_ssa_loop_prefetch (void)
static bool
gate_tree_ssa_loop_prefetch (void)
{
- return flag_prefetch_loop_arrays != 0;
+ return flag_prefetch_loop_arrays > 0;
}
struct gimple_opt_pass pass_loop_prefetch =
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 9e67ea924d3..c8c64928273 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1262,6 +1262,190 @@ struct gimple_opt_pass pass_optimize_bswap =
}
};
+/* Process a single gimple statement STMT, which has a MULT_EXPR as
+ its rhs, and try to convert it into a WIDEN_MULT_EXPR. The return
+ value is true iff we converted the statement. */
+
+static bool
+convert_mult_to_widen (gimple stmt)
+{
+ gimple rhs1_stmt = NULL, rhs2_stmt = NULL;
+ tree type1 = NULL, type2 = NULL;
+ tree rhs1, rhs2, rhs1_convop = NULL, rhs2_convop = NULL;
+ enum tree_code rhs1_code, rhs2_code;
+ tree type;
+
+ type = TREE_TYPE (gimple_assign_lhs (stmt));
+
+ if (TREE_CODE (type) != INTEGER_TYPE)
+ return false;
+
+ rhs1 = gimple_assign_rhs1 (stmt);
+ rhs2 = gimple_assign_rhs2 (stmt);
+
+ if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ rhs1_stmt = SSA_NAME_DEF_STMT (rhs1);
+ if (!is_gimple_assign (rhs1_stmt))
+ return false;
+ rhs1_code = gimple_assign_rhs_code (rhs1_stmt);
+ if (!CONVERT_EXPR_CODE_P (rhs1_code))
+ return false;
+ rhs1_convop = gimple_assign_rhs1 (rhs1_stmt);
+ type1 = TREE_TYPE (rhs1_convop);
+ if (TYPE_PRECISION (type1) * 2 != TYPE_PRECISION (type))
+ return false;
+ }
+ else if (TREE_CODE (rhs1) != INTEGER_CST)
+ return false;
+
+ if (TREE_CODE (rhs2) == SSA_NAME)
+ {
+ rhs2_stmt = SSA_NAME_DEF_STMT (rhs2);
+ if (!is_gimple_assign (rhs2_stmt))
+ return false;
+ rhs2_code = gimple_assign_rhs_code (rhs2_stmt);
+ if (!CONVERT_EXPR_CODE_P (rhs2_code))
+ return false;
+ rhs2_convop = gimple_assign_rhs1 (rhs2_stmt);
+ type2 = TREE_TYPE (rhs2_convop);
+ if (TYPE_PRECISION (type2) * 2 != TYPE_PRECISION (type))
+ return false;
+ }
+ else if (TREE_CODE (rhs2) != INTEGER_CST)
+ return false;
+
+ if (rhs1_stmt == NULL && rhs2_stmt == NULL)
+ return false;
+
+ /* Verify that the machine can perform a widening multiply in this
+ mode/signedness combination, otherwise this transformation is
+ likely to pessimize code. */
+ if ((rhs1_stmt == NULL || TYPE_UNSIGNED (type1))
+ && (rhs2_stmt == NULL || TYPE_UNSIGNED (type2))
+ && (optab_handler (umul_widen_optab, TYPE_MODE (type))
+ ->insn_code == CODE_FOR_nothing))
+ return false;
+ else if ((rhs1_stmt == NULL || !TYPE_UNSIGNED (type1))
+ && (rhs2_stmt == NULL || !TYPE_UNSIGNED (type2))
+ && (optab_handler (smul_widen_optab, TYPE_MODE (type))
+ ->insn_code == CODE_FOR_nothing))
+ return false;
+ else if (rhs1_stmt != NULL && rhs2_stmt != NULL
+ && (TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2))
+ && (optab_handler (usmul_widen_optab, TYPE_MODE (type))
+ ->insn_code == CODE_FOR_nothing))
+ return false;
+
+ if ((rhs1_stmt == NULL && !int_fits_type_p (rhs1, type2))
+ || (rhs2_stmt == NULL && !int_fits_type_p (rhs2, type1)))
+ return false;
+
+ if (rhs1_stmt == NULL)
+ gimple_assign_set_rhs1 (stmt, fold_convert (type2, rhs1));
+ else
+ gimple_assign_set_rhs1 (stmt, rhs1_convop);
+ if (rhs2_stmt == NULL)
+ gimple_assign_set_rhs2 (stmt, fold_convert (type1, rhs2));
+ else
+ gimple_assign_set_rhs2 (stmt, rhs2_convop);
+ gimple_assign_set_rhs_code (stmt, WIDEN_MULT_EXPR);
+ update_stmt (stmt);
+ return true;
+}
+
+/* Process a single gimple statement STMT, which is found at the
+ iterator GSI and has a either a PLUS_EXPR or a MINUS_EXPR as its
+ rhs (given by CODE), and try to convert it into a
+ WIDEN_MULT_PLUS_EXPR or a WIDEN_MULT_MINUS_EXPR. The return value
+ is true iff we converted the statement. */
+
+static bool
+convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple stmt,
+ enum tree_code code)
+{
+ gimple rhs1_stmt = NULL, rhs2_stmt = NULL;
+ tree type;
+ tree lhs, rhs1, rhs2, mult_rhs1, mult_rhs2, add_rhs;
+ enum tree_code rhs1_code = ERROR_MARK, rhs2_code = ERROR_MARK;
+ optab this_optab;
+ enum tree_code wmult_code;
+
+ lhs = gimple_assign_lhs (stmt);
+ type = TREE_TYPE (lhs);
+ if (TREE_CODE (type) != INTEGER_TYPE)
+ return false;
+
+ if (code == MINUS_EXPR)
+ wmult_code = WIDEN_MULT_MINUS_EXPR;
+ else
+ wmult_code = WIDEN_MULT_PLUS_EXPR;
+
+ /* Verify that the machine can perform a widening multiply
+ accumulate in this mode/signedness combination, otherwise
+ this transformation is likely to pessimize code. */
+ this_optab = optab_for_tree_code (wmult_code, type, optab_default);
+ if (optab_handler (this_optab, TYPE_MODE (type))->insn_code
+ == CODE_FOR_nothing)
+ return false;
+
+ rhs1 = gimple_assign_rhs1 (stmt);
+ rhs2 = gimple_assign_rhs2 (stmt);
+
+ if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ rhs1_stmt = SSA_NAME_DEF_STMT (rhs1);
+ if (is_gimple_assign (rhs1_stmt))
+ rhs1_code = gimple_assign_rhs_code (rhs1_stmt);
+ }
+ else
+ return false;
+
+ if (TREE_CODE (rhs2) == SSA_NAME)
+ {
+ rhs2_stmt = SSA_NAME_DEF_STMT (rhs2);
+ if (is_gimple_assign (rhs2_stmt))
+ rhs2_code = gimple_assign_rhs_code (rhs2_stmt);
+ }
+ else
+ return false;
+
+ if (rhs1_code == MULT_EXPR)
+ {
+ if (!convert_mult_to_widen (rhs1_stmt))
+ return false;
+ rhs1_code = gimple_assign_rhs_code (rhs1_stmt);
+ }
+ if (rhs2_code == MULT_EXPR)
+ {
+ if (!convert_mult_to_widen (rhs2_stmt))
+ return false;
+ rhs2_code = gimple_assign_rhs_code (rhs2_stmt);
+ }
+
+ if (code == PLUS_EXPR && rhs1_code == WIDEN_MULT_EXPR)
+ {
+ mult_rhs1 = gimple_assign_rhs1 (rhs1_stmt);
+ mult_rhs2 = gimple_assign_rhs2 (rhs1_stmt);
+ add_rhs = rhs2;
+ }
+ else if (rhs2_code == WIDEN_MULT_EXPR)
+ {
+ mult_rhs1 = gimple_assign_rhs1 (rhs2_stmt);
+ mult_rhs2 = gimple_assign_rhs2 (rhs2_stmt);
+ add_rhs = rhs1;
+ }
+ else
+ return false;
+
+ /* ??? May need some type verification here? */
+
+ gimple_assign_set_rhs_with_ops_1 (gsi, wmult_code, mult_rhs1, mult_rhs2,
+ add_rhs);
+ update_stmt (gsi_stmt (*gsi));
+ return true;
+}
+
/* Find integer multiplications where the operands are extended from
smaller types, and replace the MULT_EXPR with a WIDEN_MULT_EXPR
where appropriate. */
@@ -1279,94 +1463,19 @@ execute_optimize_widening_mul (void)
for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
- gimple rhs1_stmt = NULL, rhs2_stmt = NULL;
- tree type, type1 = NULL, type2 = NULL;
- tree rhs1, rhs2, rhs1_convop = NULL, rhs2_convop = NULL;
- enum tree_code rhs1_code, rhs2_code;
-
- if (!is_gimple_assign (stmt)
- || gimple_assign_rhs_code (stmt) != MULT_EXPR)
- continue;
-
- type = TREE_TYPE (gimple_assign_lhs (stmt));
+ enum tree_code code;
- if (TREE_CODE (type) != INTEGER_TYPE)
+ if (!is_gimple_assign (stmt))
continue;
- rhs1 = gimple_assign_rhs1 (stmt);
- rhs2 = gimple_assign_rhs2 (stmt);
-
- if (TREE_CODE (rhs1) == SSA_NAME)
- {
- rhs1_stmt = SSA_NAME_DEF_STMT (rhs1);
- if (!is_gimple_assign (rhs1_stmt))
- continue;
- rhs1_code = gimple_assign_rhs_code (rhs1_stmt);
- if (!CONVERT_EXPR_CODE_P (rhs1_code))
- continue;
- rhs1_convop = gimple_assign_rhs1 (rhs1_stmt);
- type1 = TREE_TYPE (rhs1_convop);
- if (TYPE_PRECISION (type1) * 2 != TYPE_PRECISION (type))
- continue;
- }
- else if (TREE_CODE (rhs1) != INTEGER_CST)
- continue;
-
- if (TREE_CODE (rhs2) == SSA_NAME)
- {
- rhs2_stmt = SSA_NAME_DEF_STMT (rhs2);
- if (!is_gimple_assign (rhs2_stmt))
- continue;
- rhs2_code = gimple_assign_rhs_code (rhs2_stmt);
- if (!CONVERT_EXPR_CODE_P (rhs2_code))
- continue;
- rhs2_convop = gimple_assign_rhs1 (rhs2_stmt);
- type2 = TREE_TYPE (rhs2_convop);
- if (TYPE_PRECISION (type2) * 2 != TYPE_PRECISION (type))
- continue;
- }
- else if (TREE_CODE (rhs2) != INTEGER_CST)
- continue;
-
- if (rhs1_stmt == NULL && rhs2_stmt == NULL)
- continue;
-
- /* Verify that the machine can perform a widening multiply in this
- mode/signedness combination, otherwise this transformation is
- likely to pessimize code. */
- if ((rhs1_stmt == NULL || TYPE_UNSIGNED (type1))
- && (rhs2_stmt == NULL || TYPE_UNSIGNED (type2))
- && (optab_handler (umul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
- continue;
- else if ((rhs1_stmt == NULL || !TYPE_UNSIGNED (type1))
- && (rhs2_stmt == NULL || !TYPE_UNSIGNED (type2))
- && (optab_handler (smul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
- continue;
- else if (rhs1_stmt != NULL && rhs2_stmt != 0
- && (TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2))
- && (optab_handler (usmul_widen_optab, TYPE_MODE (type))
- ->insn_code == CODE_FOR_nothing))
- continue;
-
- if ((rhs1_stmt == NULL && !int_fits_type_p (rhs1, type2))
- || (rhs2_stmt == NULL && !int_fits_type_p (rhs2, type1)))
- continue;
-
- if (rhs1_stmt == NULL)
- gimple_assign_set_rhs1 (stmt, fold_convert (type2, rhs1));
- else
- gimple_assign_set_rhs1 (stmt, rhs1_convop);
- if (rhs2_stmt == NULL)
- gimple_assign_set_rhs2 (stmt, fold_convert (type1, rhs2));
- else
- gimple_assign_set_rhs2 (stmt, rhs2_convop);
- gimple_assign_set_rhs_code (stmt, WIDEN_MULT_EXPR);
- update_stmt (stmt);
- changed = true;
+ code = gimple_assign_rhs_code (stmt);
+ if (code == MULT_EXPR)
+ changed |= convert_mult_to_widen (stmt);
+ else if (code == PLUS_EXPR || code == MINUS_EXPR)
+ changed |= convert_plusminus_to_widen (&gsi, stmt, code);
}
}
+
return (changed ? TODO_dump_func | TODO_update_ssa | TODO_verify_ssa
| TODO_verify_stmts : 0);
}
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 68be8fae8f4..fdc906a8b1b 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -127,6 +127,12 @@ static struct
clobbering sites like function calls or ASM_EXPRs. */
#define opf_implicit (1 << 2)
+/* Operand is in a place where address-taken does not imply addressable. */
+#define opf_non_addressable (1 << 3)
+
+/* Operand is in a place where opf_non_addressable does not apply. */
+#define opf_not_non_addressable (1 << 4)
+
/* Array for building all the def operands. */
static VEC(tree,heap) *build_defs;
@@ -320,9 +326,10 @@ ssa_operand_alloc (unsigned size)
gcc_unreachable ();
}
- ptr = (struct ssa_operand_memory_d *)
- ggc_alloc (sizeof (void *)
- + gimple_ssa_operands (cfun)->ssa_operand_mem_size);
+
+ ptr = ggc_alloc_ssa_operand_memory_d (sizeof (void *)
+ + gimple_ssa_operands (cfun)->ssa_operand_mem_size);
+
ptr->next = gimple_ssa_operands (cfun)->operand_memory;
gimple_ssa_operands (cfun)->operand_memory = ptr;
gimple_ssa_operands (cfun)->operand_memory_index = 0;
@@ -692,15 +699,22 @@ mark_address_taken (tree ref)
be referenced using pointer arithmetic. See PR 21407 and the
ensuing mailing list discussion. */
var = get_base_address (ref);
- if (var && DECL_P (var))
- TREE_ADDRESSABLE (var) = 1;
+ if (var)
+ {
+ if (DECL_P (var))
+ TREE_ADDRESSABLE (var) = 1;
+ else if (TREE_CODE (var) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (var, 0)) == ADDR_EXPR
+ && DECL_P (TREE_OPERAND (TREE_OPERAND (var, 0), 0)))
+ TREE_ADDRESSABLE (TREE_OPERAND (TREE_OPERAND (var, 0), 0)) = 1;
+ }
}
-/* A subroutine of get_expr_operands to handle INDIRECT_REF,
+/* A subroutine of get_expr_operands to handle MEM_REF,
ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF.
- STMT is the statement being processed, EXPR is the INDIRECT_REF
+ STMT is the statement being processed, EXPR is the MEM_REF
that got us here.
FLAGS is as in get_expr_operands.
@@ -724,7 +738,8 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags,
/* If requested, add a USE operand for the base pointer. */
if (recurse_on_base)
get_expr_operands (stmt, pptr,
- opf_use | (flags & opf_no_vops));
+ opf_non_addressable | opf_use
+ | (flags & (opf_no_vops|opf_not_non_addressable)));
}
@@ -801,7 +816,7 @@ get_asm_expr_operands (gimple stmt)
if (!allows_reg && allows_mem)
mark_address_taken (TREE_VALUE (link));
- get_expr_operands (stmt, &TREE_VALUE (link), opf_def);
+ get_expr_operands (stmt, &TREE_VALUE (link), opf_def | opf_not_non_addressable);
}
/* Gather all input operands. */
@@ -817,7 +832,7 @@ get_asm_expr_operands (gimple stmt)
if (!allows_reg && allows_mem)
mark_address_taken (TREE_VALUE (link));
- get_expr_operands (stmt, &TREE_VALUE (link), 0);
+ get_expr_operands (stmt, &TREE_VALUE (link), opf_not_non_addressable);
}
/* Clobber all memory and addressable symbols for asm ("" : : : "memory"); */
@@ -861,7 +876,9 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
reference to it, but the fact that the statement takes its
address will be of interest to some passes (e.g. alias
resolution). */
- if (!is_gimple_debug (stmt))
+ if ((!(flags & opf_non_addressable)
+ || (flags & opf_not_non_addressable))
+ && !is_gimple_debug (stmt))
mark_address_taken (TREE_OPERAND (expr, 0));
/* If the address is invariant, there may be no interesting
@@ -875,7 +892,8 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
here are ARRAY_REF indices which will always be real operands
(GIMPLE does not allow non-registers as array indices). */
flags |= opf_no_vops;
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 0),
+ flags | opf_not_non_addressable);
return;
case SSA_NAME:
@@ -897,7 +915,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
/* fall through */
case ALIGN_INDIRECT_REF:
- case INDIRECT_REF:
+ case MEM_REF:
get_indirect_ref_operands (stmt, expr, flags, true);
return;
@@ -987,11 +1005,13 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
case DOT_PROD_EXPR:
case REALIGN_LOAD_EXPR:
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
{
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 1), flags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 2), flags);
- return;
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 1), flags);
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 2), flags);
+ return;
}
case FUNCTION_DECL:
diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h
index 13d29c3ab01..4c586f7fb27 100644
--- a/gcc/tree-ssa-operands.h
+++ b/gcc/tree-ssa-operands.h
@@ -54,7 +54,7 @@ typedef struct use_optype_d *use_optype_p;
operand memory manager. Operands are suballocated out of this block. The
MEM array varies in size. */
-struct GTY((chain_next("%h.next"))) ssa_operand_memory_d {
+struct GTY((chain_next("%h.next"), variable_size)) ssa_operand_memory_d {
struct ssa_operand_memory_d *next;
char mem[1];
};
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 53ab31a15df..482f267a648 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -994,10 +994,10 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
/* Auxiliary functions to determine the set of memory accesses which
can't trap because they are preceded by accesses to the same memory
- portion. We do that for INDIRECT_REFs, so we only need to track
+ portion. We do that for MEM_REFs, so we only need to track
the SSA_NAME of the pointer indirectly referenced. The algorithm
simply is a walk over all instructions in dominator order. When
- we see an INDIRECT_REF we determine if we've already seen a same
+ we see an MEM_REF we determine if we've already seen a same
ref anywhere up to the root of the dominator tree. If we do the
current access can't trap. If we don't see any dominating access
the current access might trap, but might also make later accesses
@@ -1011,7 +1011,7 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
trap even if a store doesn't (write-only memory). This probably is
overly conservative. */
-/* A hash-table of SSA_NAMEs, and in which basic block an INDIRECT_REF
+/* A hash-table of SSA_NAMEs, and in which basic block an MEM_REF
through it was seen, which would constitute a no-trap region for
same accesses. */
struct name_to_bb
@@ -1024,7 +1024,7 @@ struct name_to_bb
/* The hash table for remembering what we've seen. */
static htab_t seen_ssa_names;
-/* The set of INDIRECT_REFs which can't trap. */
+/* The set of MEM_REFs which can't trap. */
static struct pointer_set_t *nontrap_set;
/* The hash function, based on the pointer to the pointer SSA_NAME. */
@@ -1047,7 +1047,7 @@ name_to_bb_eq (const void *p1, const void *p2)
}
/* We see the expression EXP in basic block BB. If it's an interesting
- expression (an INDIRECT_REF through an SSA_NAME) possibly insert the
+ expression (an MEM_REF through an SSA_NAME) possibly insert the
expression into the set NONTRAP or the hash table of seen expressions.
STORE is true if this expression is on the LHS, otherwise it's on
the RHS. */
@@ -1055,7 +1055,7 @@ static void
add_or_mark_expr (basic_block bb, tree exp,
struct pointer_set_t *nontrap, bool store)
{
- if (INDIRECT_REF_P (exp)
+ if (TREE_CODE (exp) == MEM_REF
&& TREE_CODE (TREE_OPERAND (exp, 0)) == SSA_NAME)
{
tree name = TREE_OPERAND (exp, 0);
@@ -1064,7 +1064,7 @@ add_or_mark_expr (basic_block bb, tree exp,
struct name_to_bb *n2bb;
basic_block found_bb = 0;
- /* Try to find the last seen INDIRECT_REF through the same
+ /* Try to find the last seen MEM_REF through the same
SSA_NAME, which can trap. */
map.ssa_name = name;
map.bb = 0;
@@ -1074,7 +1074,7 @@ add_or_mark_expr (basic_block bb, tree exp,
if (n2bb)
found_bb = n2bb->bb;
- /* If we've found a trapping INDIRECT_REF, _and_ it dominates EXP
+ /* If we've found a trapping MEM_REF, _and_ it dominates EXP
(it's in a basic block on the path from us to the dominator root)
then we can't trap. */
if (found_bb && found_bb->aux == (void *)1)
@@ -1135,7 +1135,7 @@ nt_fini_block (struct dom_walk_data *data ATTRIBUTE_UNUSED, basic_block bb)
/* This is the entry point of gathering non trapping memory accesses.
It will do a dominator walk over the whole function, and it will
make use of the bb->aux pointers. It returns a set of trees
- (the INDIRECT_REFs itself) which can't trap. */
+ (the MEM_REFs itself) which can't trap. */
static struct pointer_set_t *
get_non_trapping (void)
{
@@ -1200,7 +1200,8 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
locus = gimple_location (assign);
lhs = gimple_assign_lhs (assign);
rhs = gimple_assign_rhs1 (assign);
- if (!INDIRECT_REF_P (lhs))
+ if (TREE_CODE (lhs) != MEM_REF
+ || TREE_CODE (TREE_OPERAND (lhs, 0)) != SSA_NAME)
return false;
/* RHS is either a single SSA_NAME or a constant. */
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index dc1cb28f7c3..6595515e1ad 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -139,7 +139,7 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
edge e;
gcc_assert (is_gimple_assign (use_stmt)
- && gimple_assign_rhs_code (use_stmt) == INDIRECT_REF);
+ && gimple_assign_rhs_code (use_stmt) == MEM_REF);
/* Build a new PHI node to replace the definition of
the indirect reference lhs. */
@@ -295,8 +295,11 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
/* Check whether this is a load of *ptr. */
if (!(is_gimple_assign (use_stmt)
&& TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
- && gimple_assign_rhs_code (use_stmt) == INDIRECT_REF
+ && gimple_assign_rhs_code (use_stmt) == MEM_REF
&& TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0) == ptr
+ && integer_zerop (TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 1))
+ && types_compatible_p (TREE_TYPE (gimple_assign_rhs1 (use_stmt)),
+ TREE_TYPE (TREE_TYPE (ptr)))
/* We cannot replace a load that may throw or is volatile. */
&& !stmt_can_throw_internal (use_stmt)))
continue;
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 3d186fd70fa..97eb7d2c188 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -356,15 +356,15 @@ static bool in_fre = false;
expressions. */
typedef struct bitmap_set
{
- bitmap expressions;
- bitmap values;
+ bitmap_head expressions;
+ bitmap_head values;
} *bitmap_set_t;
#define FOR_EACH_EXPR_ID_IN_SET(set, id, bi) \
- EXECUTE_IF_SET_IN_BITMAP((set)->expressions, 0, (id), (bi))
+ EXECUTE_IF_SET_IN_BITMAP(&(set)->expressions, 0, (id), (bi))
#define FOR_EACH_VALUE_ID_IN_SET(set, id, bi) \
- EXECUTE_IF_SET_IN_BITMAP((set)->values, 0, (id), (bi))
+ EXECUTE_IF_SET_IN_BITMAP(&(set)->values, 0, (id), (bi))
/* Mapping from value id to expressions with that value_id. */
DEF_VEC_P (bitmap_set_t);
@@ -615,8 +615,8 @@ static bitmap_set_t
bitmap_set_new (void)
{
bitmap_set_t ret = (bitmap_set_t) pool_alloc (bitmap_set_pool);
- ret->expressions = BITMAP_ALLOC (&grand_bitmap_obstack);
- ret->values = BITMAP_ALLOC (&grand_bitmap_obstack);
+ bitmap_initialize (&ret->expressions, &grand_bitmap_obstack);
+ bitmap_initialize (&ret->values, &grand_bitmap_obstack);
return ret;
}
@@ -657,8 +657,8 @@ bitmap_remove_from_set (bitmap_set_t set, pre_expr expr)
unsigned int val = get_expr_value_id (expr);
if (!value_id_constant_p (val))
{
- bitmap_clear_bit (set->values, val);
- bitmap_clear_bit (set->expressions, get_expression_id (expr));
+ bitmap_clear_bit (&set->values, val);
+ bitmap_clear_bit (&set->expressions, get_expression_id (expr));
}
}
@@ -670,8 +670,8 @@ bitmap_insert_into_set_1 (bitmap_set_t set, pre_expr expr,
{
/* We specifically expect this and only this function to be able to
insert constants into a set. */
- bitmap_set_bit (set->values, val);
- bitmap_set_bit (set->expressions, get_or_alloc_expression_id (expr));
+ bitmap_set_bit (&set->values, val);
+ bitmap_set_bit (&set->expressions, get_or_alloc_expression_id (expr));
}
}
@@ -688,8 +688,8 @@ bitmap_insert_into_set (bitmap_set_t set, pre_expr expr)
static void
bitmap_set_copy (bitmap_set_t dest, bitmap_set_t orig)
{
- bitmap_copy (dest->expressions, orig->expressions);
- bitmap_copy (dest->values, orig->values);
+ bitmap_copy (&dest->expressions, &orig->expressions);
+ bitmap_copy (&dest->values, &orig->values);
}
@@ -697,8 +697,8 @@ bitmap_set_copy (bitmap_set_t dest, bitmap_set_t orig)
static void
bitmap_set_free (bitmap_set_t set)
{
- BITMAP_FREE (set->expressions);
- BITMAP_FREE (set->values);
+ bitmap_clear (&set->expressions);
+ bitmap_clear (&set->values);
}
@@ -712,7 +712,7 @@ sorted_array_from_bitmap_set (bitmap_set_t set)
VEC(pre_expr, heap) *result;
/* Pre-allocate roughly enough space for the array. */
- result = VEC_alloc (pre_expr, heap, bitmap_count_bits (set->values));
+ result = VEC_alloc (pre_expr, heap, bitmap_count_bits (&set->values));
FOR_EACH_VALUE_ID_IN_SET (set, i, bi)
{
@@ -729,7 +729,7 @@ sorted_array_from_bitmap_set (bitmap_set_t set)
bitmap_set_t exprset = VEC_index (bitmap_set_t, value_expressions, i);
FOR_EACH_EXPR_ID_IN_SET (exprset, j, bj)
{
- if (bitmap_bit_p (set->expressions, j))
+ if (bitmap_bit_p (&set->expressions, j))
VEC_safe_push (pre_expr, heap, result, expression_for_id (j));
}
}
@@ -747,18 +747,19 @@ bitmap_set_and (bitmap_set_t dest, bitmap_set_t orig)
if (dest != orig)
{
- bitmap temp = BITMAP_ALLOC (&grand_bitmap_obstack);
+ bitmap_head temp;
+ bitmap_initialize (&temp, &grand_bitmap_obstack);
- bitmap_and_into (dest->values, orig->values);
- bitmap_copy (temp, dest->expressions);
- EXECUTE_IF_SET_IN_BITMAP (temp, 0, i, bi)
+ bitmap_and_into (&dest->values, &orig->values);
+ bitmap_copy (&temp, &dest->expressions);
+ EXECUTE_IF_SET_IN_BITMAP (&temp, 0, i, bi)
{
pre_expr expr = expression_for_id (i);
unsigned int value_id = get_expr_value_id (expr);
- if (!bitmap_bit_p (dest->values, value_id))
- bitmap_clear_bit (dest->expressions, i);
+ if (!bitmap_bit_p (&dest->values, value_id))
+ bitmap_clear_bit (&dest->expressions, i);
}
- BITMAP_FREE (temp);
+ bitmap_clear (&temp);
}
}
@@ -771,14 +772,14 @@ bitmap_set_subtract (bitmap_set_t dest, bitmap_set_t orig)
bitmap_iterator bi;
unsigned int i;
- bitmap_and_compl (result->expressions, dest->expressions,
- orig->expressions);
+ bitmap_and_compl (&result->expressions, &dest->expressions,
+ &orig->expressions);
FOR_EACH_EXPR_ID_IN_SET (result, i, bi)
{
pre_expr expr = expression_for_id (i);
unsigned int value_id = get_expr_value_id (expr);
- bitmap_set_bit (result->values, value_id);
+ bitmap_set_bit (&result->values, value_id);
}
return result;
@@ -791,16 +792,18 @@ bitmap_set_subtract_values (bitmap_set_t a, bitmap_set_t b)
{
unsigned int i;
bitmap_iterator bi;
- bitmap temp = BITMAP_ALLOC (&grand_bitmap_obstack);
+ bitmap_head temp;
- bitmap_copy (temp, a->expressions);
- EXECUTE_IF_SET_IN_BITMAP (temp, 0, i, bi)
+ bitmap_initialize (&temp, &grand_bitmap_obstack);
+
+ bitmap_copy (&temp, &a->expressions);
+ EXECUTE_IF_SET_IN_BITMAP (&temp, 0, i, bi)
{
pre_expr expr = expression_for_id (i);
if (bitmap_set_contains_value (b, get_expr_value_id (expr)))
bitmap_remove_from_set (a, expr);
}
- BITMAP_FREE (temp);
+ bitmap_clear (&temp);
}
@@ -812,16 +815,16 @@ bitmap_set_contains_value (bitmap_set_t set, unsigned int value_id)
if (value_id_constant_p (value_id))
return true;
- if (!set || bitmap_empty_p (set->expressions))
+ if (!set || bitmap_empty_p (&set->expressions))
return false;
- return bitmap_bit_p (set->values, value_id);
+ return bitmap_bit_p (&set->values, value_id);
}
static inline bool
bitmap_set_contains_expr (bitmap_set_t set, const pre_expr expr)
{
- return bitmap_bit_p (set->expressions, get_expression_id (expr));
+ return bitmap_bit_p (&set->expressions, get_expression_id (expr));
}
/* Replace an instance of value LOOKFOR with expression EXPR in SET. */
@@ -852,10 +855,10 @@ bitmap_set_replace_value (bitmap_set_t set, unsigned int lookfor,
exprset = VEC_index (bitmap_set_t, value_expressions, lookfor);
FOR_EACH_EXPR_ID_IN_SET (exprset, i, bi)
{
- if (bitmap_bit_p (set->expressions, i))
+ if (bitmap_bit_p (&set->expressions, i))
{
- bitmap_clear_bit (set->expressions, i);
- bitmap_set_bit (set->expressions, get_expression_id (expr));
+ bitmap_clear_bit (&set->expressions, i);
+ bitmap_set_bit (&set->expressions, get_expression_id (expr));
return;
}
}
@@ -866,7 +869,7 @@ bitmap_set_replace_value (bitmap_set_t set, unsigned int lookfor,
static bool
bitmap_set_equal (bitmap_set_t a, bitmap_set_t b)
{
- return bitmap_equal_p (a->values, b->values);
+ return bitmap_equal_p (&a->values, &b->values);
}
/* Replace an instance of EXPR's VALUE with EXPR in SET if it exists,
@@ -900,8 +903,8 @@ bitmap_value_insert_into_set (bitmap_set_t set, pre_expr expr)
return;
/* If the value membership changed, add the expression. */
- if (bitmap_set_bit (set->values, val))
- bitmap_set_bit (set->expressions, expr->id);
+ if (bitmap_set_bit (&set->values, val))
+ bitmap_set_bit (&set->expressions, expr->id);
}
/* Print out EXPR to outfile. */
@@ -1626,12 +1629,28 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
newop.op0 = op0;
newop.op1 = op1;
newop.op2 = op2;
+ /* If it transforms a non-constant ARRAY_REF into a constant
+ one, adjust the constant offset. */
+ if (newop.opcode == ARRAY_REF
+ && newop.off == -1
+ && TREE_CODE (op0) == INTEGER_CST
+ && TREE_CODE (op1) == INTEGER_CST
+ && TREE_CODE (op2) == INTEGER_CST)
+ {
+ double_int off = tree_to_double_int (op0);
+ off = double_int_add (off,
+ double_int_neg
+ (tree_to_double_int (op1)));
+ off = double_int_mul (off, tree_to_double_int (op2));
+ if (double_int_fits_in_shwi_p (off))
+ newop.off = off.low;
+ }
VEC_replace (vn_reference_op_s, newoperands, j, &newop);
/* If it transforms from an SSA_NAME to an address, fold with
a preceding indirect reference. */
if (j > 0 && op0 && TREE_CODE (op0) == ADDR_EXPR
&& VEC_index (vn_reference_op_s,
- newoperands, j - 1)->opcode == INDIRECT_REF)
+ newoperands, j - 1)->opcode == MEM_REF)
vn_reference_fold_indirect (&newoperands, &j);
}
if (i != VEC_length (vn_reference_op_s, operands))
@@ -1658,6 +1677,7 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
{
unsigned int new_val_id;
pre_expr constant;
+ bool converted = false;
tree result = vn_reference_lookup_pieces (newvuse, ref->set,
ref->type,
@@ -1666,6 +1686,13 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
if (result)
VEC_free (vn_reference_op_s, heap, newoperands);
+ if (result
+ && !useless_type_conversion_p (ref->type, TREE_TYPE (result)))
+ {
+ result = fold_build1 (VIEW_CONVERT_EXPR, ref->type, result);
+ converted = true;
+ }
+
if (result && is_gimple_min_invariant (result))
{
gcc_assert (!newoperands);
@@ -1676,7 +1703,54 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
expr->kind = REFERENCE;
expr->id = 0;
- if (newref)
+ if (converted)
+ {
+ vn_nary_op_t nary;
+ tree nresult;
+
+ gcc_assert (CONVERT_EXPR_P (result)
+ || TREE_CODE (result) == VIEW_CONVERT_EXPR);
+
+ nresult = vn_nary_op_lookup_pieces (1, TREE_CODE (result),
+ TREE_TYPE (result),
+ TREE_OPERAND (result, 0),
+ NULL_TREE, NULL_TREE,
+ NULL_TREE,
+ &nary);
+ if (nresult && is_gimple_min_invariant (nresult))
+ return get_or_alloc_expr_for_constant (nresult);
+
+ expr->kind = NARY;
+ if (nary)
+ {
+ PRE_EXPR_NARY (expr) = nary;
+ constant = fully_constant_expression (expr);
+ if (constant != expr)
+ return constant;
+
+ new_val_id = nary->value_id;
+ get_or_alloc_expression_id (expr);
+ }
+ else
+ {
+ new_val_id = get_next_value_id ();
+ VEC_safe_grow_cleared (bitmap_set_t, heap,
+ value_expressions,
+ get_max_value_id() + 1);
+ nary = vn_nary_op_insert_pieces (1, TREE_CODE (result),
+ TREE_TYPE (result),
+ TREE_OPERAND (result, 0),
+ NULL_TREE, NULL_TREE,
+ NULL_TREE, NULL_TREE,
+ new_val_id);
+ PRE_EXPR_NARY (expr) = nary;
+ constant = fully_constant_expression (expr);
+ if (constant != expr)
+ return constant;
+ get_or_alloc_expression_id (expr);
+ }
+ }
+ else if (newref)
{
PRE_EXPR_REFERENCE (expr) = newref;
constant = fully_constant_expression (expr);
@@ -1870,8 +1944,8 @@ bitmap_find_leader (bitmap_set_t set, unsigned int val, gimple stmt)
bitmap_iterator bi;
bitmap_set_t exprset = VEC_index (bitmap_set_t, value_expressions, val);
- EXECUTE_IF_AND_IN_BITMAP (exprset->expressions,
- set->expressions, 0, i, bi)
+ EXECUTE_IF_AND_IN_BITMAP (&exprset->expressions,
+ &set->expressions, 0, i, bi)
{
pre_expr val = expression_for_id (i);
/* At the point where stmt is not null, there should always
@@ -2291,8 +2365,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
clean (ANTIC_IN (block), block);
- /* !old->expressions can happen when we deferred a block. */
- if (!old->expressions || !bitmap_set_equal (old, ANTIC_IN (block)))
+ if (!bitmap_set_equal (old, ANTIC_IN (block)))
{
changed = true;
SET_BIT (changed_blocks, block->index);
@@ -2367,7 +2440,7 @@ compute_partial_antic_aux (basic_block block,
before the translation starts. */
if (max_pa
&& single_succ_p (block)
- && bitmap_count_bits (PA_IN (single_succ (block))->values) > max_pa)
+ && bitmap_count_bits (&PA_IN (single_succ (block))->values) > max_pa)
goto maybe_dump_sets;
old_PA_IN = PA_IN (block);
@@ -2437,8 +2510,8 @@ compute_partial_antic_aux (basic_block block,
/* For partial antic, we want to put back in the phi results, since
we will properly avoid making them partially antic over backedges. */
- bitmap_ior_into (PA_IN (block)->values, PHI_GEN (block)->values);
- bitmap_ior_into (PA_IN (block)->expressions, PHI_GEN (block)->expressions);
+ bitmap_ior_into (&PA_IN (block)->values, &PHI_GEN (block)->values);
+ bitmap_ior_into (&PA_IN (block)->expressions, &PHI_GEN (block)->expressions);
/* PA_IN[block] = PA_IN[block] - ANTIC_IN[block] */
bitmap_set_subtract_values (PA_IN (block), ANTIC_IN (block));
@@ -2596,7 +2669,7 @@ can_PRE_operation (tree op)
return UNARY_CLASS_P (op)
|| BINARY_CLASS_P (op)
|| COMPARISON_CLASS_P (op)
- || TREE_CODE (op) == INDIRECT_REF
+ || TREE_CODE (op) == MEM_REF
|| TREE_CODE (op) == COMPONENT_REF
|| TREE_CODE (op) == VIEW_CONVERT_EXPR
|| TREE_CODE (op) == CALL_EXPR
@@ -2672,6 +2745,29 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
return folded;
}
break;
+ case MEM_REF:
+ {
+ tree baseop = create_component_ref_by_pieces_1 (block, ref, operand,
+ stmts, domstmt);
+ tree offset = currop->op0;
+ if (!baseop)
+ return NULL_TREE;
+ if (TREE_CODE (baseop) == ADDR_EXPR
+ && handled_component_p (TREE_OPERAND (baseop, 0)))
+ {
+ HOST_WIDE_INT off;
+ tree base;
+ base = get_addr_base_and_unit_offset (TREE_OPERAND (baseop, 0),
+ &off);
+ gcc_assert (base);
+ offset = int_const_binop (PLUS_EXPR, offset,
+ build_int_cst (TREE_TYPE (offset),
+ off), 0);
+ baseop = build_fold_addr_expr (base);
+ }
+ return fold_build2 (MEM_REF, currop->type, baseop, offset);
+ }
+ break;
case TARGET_MEM_REF:
{
vn_reference_op_t nextop = VEC_index (vn_reference_op_s, ref->operands,
@@ -2726,7 +2822,6 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
break;
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
- case INDIRECT_REF:
{
tree folded;
tree genop1 = create_component_ref_by_pieces_1 (block, ref,
@@ -2878,7 +2973,7 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
}
/* For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the
- COMPONENT_REF or INDIRECT_REF or ARRAY_REF portion, because we'd end up with
+ COMPONENT_REF or MEM_REF or ARRAY_REF portion, because we'd end up with
trying to rename aggregates into ssa form directly, which is a no no.
Thus, this routine doesn't create temporaries, it just builds a
@@ -3129,7 +3224,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
VN_INFO (name)->value_id = value_id;
nameexpr = get_or_alloc_expr_for_name (name);
add_to_value (value_id, nameexpr);
- if (!in_fre)
+ if (NEW_SETS (block))
bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
bitmap_value_replace_in_set (AVAIL_OUT (block), nameexpr);
@@ -3308,6 +3403,8 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
avail[bprime->index] = get_or_alloc_expr_for_name (forcedexpr);
}
}
+ else
+ avail[bprime->index] = get_or_alloc_expr_for_constant (builtexpr);
}
}
else if (eprime->kind == NAME)
@@ -4328,7 +4425,14 @@ eliminate (void)
else
gcc_unreachable ();
}
- if (!sprimeexpr
+ if (!sprime && is_gimple_min_invariant (VN_INFO (res)->valnum))
+ {
+ sprime = VN_INFO (res)->valnum;
+ if (!useless_type_conversion_p (TREE_TYPE (res),
+ TREE_TYPE (sprime)))
+ sprime = fold_convert (TREE_TYPE (res), sprime);
+ }
+ if (!sprime
|| sprime == res)
{
gsi_next (&gsi);
@@ -4714,7 +4818,7 @@ execute_pre (bool do_fre)
if (!do_fre)
loop_optimizer_init (LOOPS_NORMAL);
- if (!run_scc_vn (do_fre))
+ if (!run_scc_vn ())
{
if (!do_fre)
loop_optimizer_finalize ();
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 879e0db10ea..5f2ecce08b6 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -964,10 +964,13 @@ replace_phi_args_in (gimple phi, prop_value_t *prop_value)
If FOLD_FN is non-NULL the function will be invoked on all statements
before propagating values for pass specific simplification.
+ DO_DCE is true if trivially dead stmts can be removed.
+
Return TRUE when something changed. */
bool
-substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn)
+substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn,
+ bool do_dce)
{
basic_block bb;
bool something_changed = false;
@@ -1012,8 +1015,12 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn)
continue;
/* No point propagating into a stmt whose result is not used,
- but instead we might be able to remove a trivially dead stmt. */
- if (gimple_get_lhs (stmt)
+ but instead we might be able to remove a trivially dead stmt.
+ Don't do this when called from VRP, since the SSA_NAME which
+ is going to be released could be still referenced in VRP
+ ranges. */
+ if (do_dce
+ && gimple_get_lhs (stmt)
&& TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME
&& has_zero_uses (gimple_get_lhs (stmt))
&& !stmt_could_throw_p (stmt)
diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h
index e8f4f03dfb3..029d28a2650 100644
--- a/gcc/tree-ssa-propagate.h
+++ b/gcc/tree-ssa-propagate.h
@@ -1,6 +1,6 @@
/* Data structures and function declarations for the SSA value propagation
engine.
- Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@@ -120,6 +120,6 @@ bool valid_gimple_call_p (tree);
void move_ssa_defining_stmt_for_defs (gimple, gimple);
bool update_call_from_tree (gimple_stmt_iterator *, tree);
bool stmt_makes_single_store (gimple);
-bool substitute_and_fold (prop_value_t *, ssa_prop_fold_stmt_fn);
+bool substitute_and_fold (prop_value_t *, ssa_prop_fold_stmt_fn, bool);
#endif /* _TREE_SSA_PROPAGATE_H */
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 0911c56a9bd..caad908129b 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1261,23 +1261,27 @@ eliminate_redundant_comparison (enum tree_code opcode,
rcode = gimple_assign_rhs_code (def2);
if (TREE_CODE_CLASS (rcode) != tcc_comparison)
continue;
- if (operand_equal_p (op1, gimple_assign_rhs1 (def2), 0)
- && operand_equal_p (op2, gimple_assign_rhs2 (def2), 0))
- ;
- else if (operand_equal_p (op1, gimple_assign_rhs2 (def2), 0)
- && operand_equal_p (op2, gimple_assign_rhs1 (def2), 0))
- rcode = swap_tree_comparison (rcode);
- else
- continue;
/* If we got here, we have a match. See if we can combine the
two comparisons. */
- t = combine_comparisons (UNKNOWN_LOCATION,
- (opcode == BIT_IOR_EXPR
- ? TRUTH_OR_EXPR : TRUTH_AND_EXPR),
- lcode, rcode, TREE_TYPE (curr->op), op1, op2);
+ if (opcode == BIT_IOR_EXPR)
+ t = maybe_fold_or_comparisons (lcode, op1, op2,
+ rcode, gimple_assign_rhs1 (def2),
+ gimple_assign_rhs2 (def2));
+ else
+ t = maybe_fold_and_comparisons (lcode, op1, op2,
+ rcode, gimple_assign_rhs1 (def2),
+ gimple_assign_rhs2 (def2));
if (!t)
continue;
+
+ /* maybe_fold_and_comparisons and maybe_fold_or_comparisons
+ always give us a boolean_type_node value back. If the original
+ BIT_AND_EXPR or BIT_IOR_EXPR was of a wider integer type,
+ we need to convert. */
+ if (!useless_type_conversion_p (TREE_TYPE (curr->op), TREE_TYPE (t)))
+ t = fold_convert (TREE_TYPE (curr->op), t);
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Equivalence: ");
@@ -1303,7 +1307,7 @@ eliminate_redundant_comparison (enum tree_code opcode,
VEC_ordered_remove (operand_entry_t, *ops, currindex);
add_to_ops_vec (ops, t);
}
- else if (TREE_CODE (t) != lcode)
+ else if (!operand_equal_p (t, curr->op, 0))
{
tree tmpvar;
gimple sum;
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 24088557054..cc667207ee0 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -156,8 +156,6 @@ static unsigned int next_value_id;
static unsigned int next_dfs_num;
static VEC (tree, heap) *sccstack;
-static bool may_insert;
-
DEF_VEC_P(vn_ssa_aux_t);
DEF_VEC_ALLOC_P(vn_ssa_aux_t, heap);
@@ -176,7 +174,7 @@ VN_INFO (tree name)
{
vn_ssa_aux_t res = VEC_index (vn_ssa_aux_t, vn_ssa_aux_table,
SSA_NAME_VERSION (name));
- gcc_assert (res);
+ gcc_checking_assert (res);
return res;
}
@@ -431,9 +429,41 @@ vn_reference_compute_hash (const vn_reference_t vr1)
hashval_t result = 0;
int i;
vn_reference_op_t vro;
+ HOST_WIDE_INT off = -1;
+ bool deref = false;
for (i = 0; VEC_iterate (vn_reference_op_s, vr1->operands, i, vro); i++)
- result = vn_reference_op_compute_hash (vro, result);
+ {
+ if (vro->opcode == MEM_REF)
+ deref = true;
+ else if (vro->opcode != ADDR_EXPR)
+ deref = false;
+ if (vro->off != -1)
+ {
+ if (off == -1)
+ off = 0;
+ off += vro->off;
+ }
+ else
+ {
+ if (off != -1
+ && off != 0)
+ result = iterative_hash_hashval_t (off, result);
+ off = -1;
+ if (deref
+ && vro->opcode == ADDR_EXPR)
+ {
+ if (vro->op0)
+ {
+ tree op = TREE_OPERAND (vro->op0, 0);
+ result = iterative_hash_hashval_t (TREE_CODE (op), result);
+ result = iterative_hash_expr (op, result);
+ }
+ }
+ else
+ result = vn_reference_op_compute_hash (vro, result);
+ }
+ }
if (vr1->vuse)
result += SSA_NAME_VERSION (vr1->vuse);
@@ -446,8 +476,7 @@ vn_reference_compute_hash (const vn_reference_t vr1)
int
vn_reference_eq (const void *p1, const void *p2)
{
- int i;
- vn_reference_op_t vro;
+ unsigned i, j;
const_vn_reference_t const vr1 = (const_vn_reference_t) p1;
const_vn_reference_t const vr2 = (const_vn_reference_t) p2;
@@ -466,17 +495,58 @@ vn_reference_eq (const void *p1, const void *p2)
if (vr1->operands == vr2->operands)
return true;
- /* We require that address operands be canonicalized in a way that
- two memory references will have the same operands if they are
- equivalent. */
- if (VEC_length (vn_reference_op_s, vr1->operands)
- != VEC_length (vn_reference_op_s, vr2->operands))
+ if (!expressions_equal_p (TYPE_SIZE (vr1->type), TYPE_SIZE (vr2->type)))
return false;
- for (i = 0; VEC_iterate (vn_reference_op_s, vr1->operands, i, vro); i++)
- if (!vn_reference_op_eq (VEC_index (vn_reference_op_s, vr2->operands, i),
- vro))
- return false;
+ i = 0;
+ j = 0;
+ do
+ {
+ HOST_WIDE_INT off1 = 0, off2 = 0;
+ vn_reference_op_t vro1, vro2;
+ vn_reference_op_s tem1, tem2;
+ bool deref1 = false, deref2 = false;
+ for (; VEC_iterate (vn_reference_op_s, vr1->operands, i, vro1); i++)
+ {
+ if (vro1->opcode == MEM_REF)
+ deref1 = true;
+ if (vro1->off == -1)
+ break;
+ off1 += vro1->off;
+ }
+ for (; VEC_iterate (vn_reference_op_s, vr2->operands, j, vro2); j++)
+ {
+ if (vro2->opcode == MEM_REF)
+ deref2 = true;
+ if (vro2->off == -1)
+ break;
+ off2 += vro2->off;
+ }
+ if (off1 != off2)
+ return false;
+ if (deref1 && vro1->opcode == ADDR_EXPR)
+ {
+ memset (&tem1, 0, sizeof (tem1));
+ tem1.op0 = TREE_OPERAND (vro1->op0, 0);
+ tem1.type = TREE_TYPE (tem1.op0);
+ tem1.opcode = TREE_CODE (tem1.op0);
+ vro1 = &tem1;
+ }
+ if (deref2 && vro2->opcode == ADDR_EXPR)
+ {
+ memset (&tem2, 0, sizeof (tem2));
+ tem2.op0 = TREE_OPERAND (vro2->op0, 0);
+ tem2.type = TREE_TYPE (tem2.op0);
+ tem2.opcode = TREE_CODE (tem2.op0);
+ vro2 = &tem2;
+ }
+ if (!vn_reference_op_eq (vro1, vro2))
+ return false;
+ ++j;
+ ++i;
+ }
+ while (VEC_length (vn_reference_op_s, vr1->operands) != i
+ || VEC_length (vn_reference_op_s, vr2->operands) != j);
return true;
}
@@ -503,6 +573,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
temp.op0 = TMR_INDEX (ref);
temp.op1 = TMR_STEP (ref);
temp.op2 = TMR_OFFSET (ref);
+ temp.off = -1;
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
memset (&temp, 0, sizeof (temp));
@@ -510,6 +581,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
temp.opcode = TREE_CODE (base);
temp.op0 = base;
temp.op1 = TMR_ORIGINAL (ref);
+ temp.off = -1;
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
return;
}
@@ -524,17 +596,23 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
/* We do not care for spurious type qualifications. */
temp.type = TYPE_MAIN_VARIANT (TREE_TYPE (ref));
temp.opcode = TREE_CODE (ref);
+ temp.off = -1;
switch (temp.opcode)
{
case ALIGN_INDIRECT_REF:
- case INDIRECT_REF:
/* The only operand is the address, which gets its own
vn_reference_op_s structure. */
break;
case MISALIGNED_INDIRECT_REF:
temp.op0 = TREE_OPERAND (ref, 1);
break;
+ case MEM_REF:
+ /* The base address gets its own vn_reference_op_s structure. */
+ temp.op0 = TREE_OPERAND (ref, 1);
+ if (host_integerp (TREE_OPERAND (ref, 1), 0))
+ temp.off = TREE_INT_CST_LOW (TREE_OPERAND (ref, 1));
+ break;
case BIT_FIELD_REF:
/* Record bits and position. */
temp.op0 = TREE_OPERAND (ref, 1);
@@ -547,17 +625,25 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
temp.type = NULL_TREE;
temp.op0 = TREE_OPERAND (ref, 1);
temp.op1 = TREE_OPERAND (ref, 2);
- /* If this is a reference to a union member, record the union
- member size as operand. Do so only if we are doing
- expression insertion (during FRE), as PRE currently gets
- confused with this. */
- if (may_insert
- && temp.op1 == NULL_TREE
- && TREE_CODE (DECL_CONTEXT (temp.op0)) == UNION_TYPE
- && integer_zerop (DECL_FIELD_OFFSET (temp.op0))
- && integer_zerop (DECL_FIELD_BIT_OFFSET (temp.op0))
- && host_integerp (DECL_SIZE (temp.op0), 0))
- temp.op0 = DECL_SIZE (temp.op0);
+ {
+ tree this_offset = component_ref_field_offset (ref);
+ if (this_offset
+ && TREE_CODE (this_offset) == INTEGER_CST)
+ {
+ tree bit_offset = DECL_FIELD_BIT_OFFSET (TREE_OPERAND (ref, 1));
+ if (TREE_INT_CST_LOW (bit_offset) % BITS_PER_UNIT == 0)
+ {
+ double_int off
+ = double_int_add (tree_to_double_int (this_offset),
+ double_int_sdiv
+ (tree_to_double_int (bit_offset),
+ uhwi_to_double_int (BITS_PER_UNIT),
+ TRUNC_DIV_EXPR));
+ if (double_int_fits_in_shwi_p (off))
+ temp.off = off.low;
+ }
+ }
+ }
break;
case ARRAY_RANGE_REF:
case ARRAY_REF:
@@ -566,6 +652,18 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
/* Always record lower bounds and element size. */
temp.op1 = array_ref_low_bound (ref);
temp.op2 = array_ref_element_size (ref);
+ if (TREE_CODE (temp.op0) == INTEGER_CST
+ && TREE_CODE (temp.op1) == INTEGER_CST
+ && TREE_CODE (temp.op2) == INTEGER_CST)
+ {
+ double_int off = tree_to_double_int (temp.op0);
+ off = double_int_add (off,
+ double_int_neg
+ (tree_to_double_int (temp.op1)));
+ off = double_int_mul (off, tree_to_double_int (temp.op2));
+ if (double_int_fits_in_shwi_p (off))
+ temp.off = off.low;
+ }
break;
case STRING_CST:
case INTEGER_CST:
@@ -592,9 +690,13 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
ref in the chain of references (IE they require an
operand), so we don't have to put anything
for op* as it will be handled by the iteration */
- case IMAGPART_EXPR:
case REALPART_EXPR:
case VIEW_CONVERT_EXPR:
+ temp.off = 0;
+ break;
+ case IMAGPART_EXPR:
+ /* This is only interesting for its constant offset. */
+ temp.off = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (ref)));
break;
default:
gcc_unreachable ();
@@ -627,16 +729,12 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
HOST_WIDE_INT max_size;
HOST_WIDE_INT size = -1;
tree size_tree = NULL_TREE;
+ alias_set_type base_alias_set = -1;
/* First get the final access size from just the outermost expression. */
op = VEC_index (vn_reference_op_s, ops, 0);
if (op->opcode == COMPONENT_REF)
- {
- if (TREE_CODE (op->op0) == INTEGER_CST)
- size_tree = op->op0;
- else
- size_tree = DECL_SIZE (op->op0);
- }
+ size_tree = DECL_SIZE (op->op0);
else if (op->opcode == BIT_FIELD_REF)
size_tree = op->op0;
else
@@ -667,13 +765,31 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
{
/* These may be in the reference ops, but we cannot do anything
sensible with them here. */
- case CALL_EXPR:
case ADDR_EXPR:
+ /* Apart from ADDR_EXPR arguments to MEM_REF. */
+ if (base != NULL_TREE
+ && TREE_CODE (base) == MEM_REF
+ && op->op0
+ && DECL_P (TREE_OPERAND (op->op0, 0)))
+ {
+ vn_reference_op_t pop = VEC_index (vn_reference_op_s, ops, i-1);
+ base = TREE_OPERAND (op->op0, 0);
+ if (pop->off == -1)
+ {
+ max_size = -1;
+ offset = 0;
+ }
+ else
+ offset += pop->off * BITS_PER_UNIT;
+ op0_p = NULL;
+ break;
+ }
+ /* Fallthru. */
+ case CALL_EXPR:
return false;
/* Record the base objects. */
case ALIGN_INDIRECT_REF:
- case INDIRECT_REF:
*op0_p = build1 (op->opcode, op->type, NULL_TREE);
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
@@ -684,11 +800,19 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
op0_p = &TREE_OPERAND (*op0_p, 0);
break;
+ case MEM_REF:
+ base_alias_set = get_deref_alias_set (op->op0);
+ *op0_p = build2 (MEM_REF, op->type,
+ NULL_TREE, op->op0);
+ op0_p = &TREE_OPERAND (*op0_p, 0);
+ break;
+
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
case SSA_NAME:
*op0_p = op->op0;
+ op0_p = NULL;
break;
/* And now the usual component-reference style ops. */
@@ -703,11 +827,8 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
cannot use component_ref_field_offset. Do the interesting
parts manually. */
- /* Our union trick, done for offset zero only. */
- if (TREE_CODE (field) == INTEGER_CST)
- ;
- else if (op->op1
- || !host_integerp (DECL_FIELD_OFFSET (field), 1))
+ if (op->op1
+ || !host_integerp (DECL_FIELD_OFFSET (field), 1))
max_size = -1;
else
{
@@ -768,7 +889,10 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
ref->size = size;
ref->max_size = max_size;
ref->ref_alias_set = set;
- ref->base_alias_set = -1;
+ if (base_alias_set != -1)
+ ref->base_alias_set = base_alias_set;
+ else
+ ref->base_alias_set = get_alias_set (base);
return true;
}
@@ -789,6 +913,7 @@ copy_reference_ops_from_call (gimple call,
temp.opcode = CALL_EXPR;
temp.op0 = gimple_call_fn (call);
temp.op1 = gimple_call_chain (call);
+ temp.off = -1;
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
/* Copy the call arguments. As they can be references as well,
@@ -830,62 +955,30 @@ void
vn_reference_fold_indirect (VEC (vn_reference_op_s, heap) **ops,
unsigned int *i_p)
{
- VEC(vn_reference_op_s, heap) *mem = NULL;
- vn_reference_op_t op;
unsigned int i = *i_p;
- unsigned int j;
-
- /* Get ops for the addressed object. */
- op = VEC_index (vn_reference_op_s, *ops, i);
- /* ??? If this is our usual typeof &ARRAY vs. &ARRAY[0] problem, work
- around it to avoid later ICEs. */
- if (TREE_CODE (TREE_TYPE (TREE_OPERAND (op->op0, 0))) == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (op->op0))) != ARRAY_TYPE)
- {
- vn_reference_op_s aref;
- tree dom;
- aref.type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (op->op0)));
- aref.opcode = ARRAY_REF;
- aref.op0 = integer_zero_node;
- if ((dom = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (op->op0, 0))))
- && TYPE_MIN_VALUE (dom))
- aref.op0 = TYPE_MIN_VALUE (dom);
- aref.op1 = aref.op0;
- aref.op2 = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (op->op0)));
- VEC_safe_push (vn_reference_op_s, heap, mem, &aref);
- }
- copy_reference_ops_from_ref (TREE_OPERAND (op->op0, 0), &mem);
-
- /* Do the replacement - we should have at least one op in mem now. */
- if (VEC_length (vn_reference_op_s, mem) == 1)
- {
- VEC_replace (vn_reference_op_s, *ops, i - 1,
- VEC_index (vn_reference_op_s, mem, 0));
- VEC_ordered_remove (vn_reference_op_s, *ops, i);
- i--;
- }
- else if (VEC_length (vn_reference_op_s, mem) == 2)
- {
- VEC_replace (vn_reference_op_s, *ops, i - 1,
- VEC_index (vn_reference_op_s, mem, 0));
- VEC_replace (vn_reference_op_s, *ops, i,
- VEC_index (vn_reference_op_s, mem, 1));
- }
- else if (VEC_length (vn_reference_op_s, mem) > 2)
- {
- VEC_replace (vn_reference_op_s, *ops, i - 1,
- VEC_index (vn_reference_op_s, mem, 0));
- VEC_replace (vn_reference_op_s, *ops, i,
- VEC_index (vn_reference_op_s, mem, 1));
- /* ??? There is no VEC_splice. */
- for (j = 2; VEC_iterate (vn_reference_op_s, mem, j, op); j++)
- VEC_safe_insert (vn_reference_op_s, heap, *ops, ++i, op);
+ vn_reference_op_t op = VEC_index (vn_reference_op_s, *ops, i);
+ vn_reference_op_t mem_op = VEC_index (vn_reference_op_s, *ops, i - 1);
+ tree addr_base;
+ HOST_WIDE_INT addr_offset;
+
+ /* The only thing we have to do is from &OBJ.foo.bar add the offset
+ from .foo.bar to the preceeding MEM_REF offset and replace the
+ address with &OBJ. */
+ addr_base = get_addr_base_and_unit_offset (TREE_OPERAND (op->op0, 0),
+ &addr_offset);
+ gcc_checking_assert (addr_base && TREE_CODE (addr_base) != MEM_REF);
+ if (addr_base != op->op0)
+ {
+ double_int off = tree_to_double_int (mem_op->op0);
+ off = double_int_sext (off, TYPE_PRECISION (TREE_TYPE (mem_op->op0)));
+ off = double_int_add (off, shwi_to_double_int (addr_offset));
+ mem_op->op0 = double_int_to_tree (TREE_TYPE (mem_op->op0), off);
+ op->op0 = build_fold_addr_expr (addr_base);
+ if (host_integerp (mem_op->op0, 0))
+ mem_op->off = TREE_INT_CST_LOW (mem_op->op0);
+ else
+ mem_op->off = -1;
}
- else
- gcc_unreachable ();
-
- VEC_free (vn_reference_op_s, heap, mem);
- *i_p = i;
}
/* Optimize the reference REF to a constant if possible or return
@@ -978,20 +1071,35 @@ valueize_refs (VEC (vn_reference_op_s, heap) *orig)
the opcode. */
if (TREE_CODE (vro->op0) != SSA_NAME && vro->opcode == SSA_NAME)
vro->opcode = TREE_CODE (vro->op0);
- /* If it transforms from an SSA_NAME to an address, fold with
- a preceding indirect reference. */
- if (i > 0 && TREE_CODE (vro->op0) == ADDR_EXPR
- && VEC_index (vn_reference_op_s,
- orig, i - 1)->opcode == INDIRECT_REF)
- {
- vn_reference_fold_indirect (&orig, &i);
- continue;
- }
}
if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
vro->op1 = SSA_VAL (vro->op1);
if (vro->op2 && TREE_CODE (vro->op2) == SSA_NAME)
vro->op2 = SSA_VAL (vro->op2);
+ /* If it transforms from an SSA_NAME to an address, fold with
+ a preceding indirect reference. */
+ if (i > 0
+ && vro->op0
+ && TREE_CODE (vro->op0) == ADDR_EXPR
+ && VEC_index (vn_reference_op_s,
+ orig, i - 1)->opcode == MEM_REF)
+ vn_reference_fold_indirect (&orig, &i);
+ /* If it transforms a non-constant ARRAY_REF into a constant
+ one, adjust the constant offset. */
+ else if (vro->opcode == ARRAY_REF
+ && vro->off == -1
+ && TREE_CODE (vro->op0) == INTEGER_CST
+ && TREE_CODE (vro->op1) == INTEGER_CST
+ && TREE_CODE (vro->op2) == INTEGER_CST)
+ {
+ double_int off = tree_to_double_int (vro->op0);
+ off = double_int_add (off,
+ double_int_neg
+ (tree_to_double_int (vro->op1)));
+ off = double_int_mul (off, tree_to_double_int (vro->op2));
+ if (double_int_fits_in_shwi_p (off))
+ vro->off = off.low;
+ }
}
return orig;
@@ -1172,7 +1280,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
the copy kills ref. */
else if (gimple_assign_single_p (def_stmt)
&& (DECL_P (gimple_assign_rhs1 (def_stmt))
- || INDIRECT_REF_P (gimple_assign_rhs1 (def_stmt))
+ || TREE_CODE (gimple_assign_rhs1 (def_stmt)) == MEM_REF
|| handled_component_p (gimple_assign_rhs1 (def_stmt))))
{
tree base2;
@@ -2092,9 +2200,9 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt)
result = vn_nary_op_lookup (val, NULL);
/* If the expression is not yet available, value-number lhs to
a new SSA_NAME we create. */
- if (!result && may_insert)
+ if (!result)
{
- result = make_ssa_name (SSA_NAME_VAR (lhs), NULL);
+ result = make_ssa_name (SSA_NAME_VAR (lhs), gimple_build_nop ());
/* Initialize value-number information properly. */
VN_INFO_GET (result)->valnum = result;
VN_INFO (result)->value_id = get_next_value_id ();
@@ -2352,6 +2460,10 @@ stmt_has_constants (gimple stmt)
case GIMPLE_BINARY_RHS:
return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt))
|| is_gimple_min_invariant (gimple_assign_rhs2 (stmt)));
+ case GIMPLE_TERNARY_RHS:
+ return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt))
+ || is_gimple_min_invariant (gimple_assign_rhs2 (stmt))
+ || is_gimple_min_invariant (gimple_assign_rhs3 (stmt)));
case GIMPLE_SINGLE_RHS:
/* Constants inside reference ops are rarely interesting, but
it can take a lot of looking to find them. */
@@ -3262,14 +3374,12 @@ set_hashtable_value_ids (void)
due to resource constraints. */
bool
-run_scc_vn (bool may_insert_arg)
+run_scc_vn (void)
{
size_t i;
tree param;
bool changed = true;
- may_insert = may_insert_arg;
-
init_scc_vn ();
current_info = valid_info;
@@ -3293,7 +3403,6 @@ run_scc_vn (bool may_insert_arg)
if (!DFS (name))
{
free_scc_vn ();
- may_insert = false;
return false;
}
}
@@ -3355,7 +3464,6 @@ run_scc_vn (bool may_insert_arg)
}
}
- may_insert = false;
return true;
}
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index 8f93b0b2518..ba7fc5c3e49 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -72,6 +72,8 @@ typedef const struct vn_phi_s *const_vn_phi_t;
typedef struct vn_reference_op_struct
{
enum tree_code opcode;
+ /* Constant offset this op adds or -1 if it is variable. */
+ HOST_WIDE_INT off;
tree type;
tree op0;
tree op1;
@@ -167,7 +169,7 @@ typedef struct vn_ssa_aux
extern vn_ssa_aux_t VN_INFO (tree);
extern vn_ssa_aux_t VN_INFO_GET (tree);
tree vn_get_expr_for (tree);
-bool run_scc_vn (bool);
+bool run_scc_vn (void);
void free_scc_vn (void);
tree vn_nary_op_lookup (tree, vn_nary_op_t *);
tree vn_nary_op_lookup_stmt (gimple, vn_nary_op_t *);
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index ac31781e198..9deec26b11d 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -190,8 +190,11 @@ is_hidden_global_store (gimple stmt)
return true;
}
- else if (INDIRECT_REF_P (lhs))
+ else if (INDIRECT_REF_P (lhs)
+ || TREE_CODE (lhs) == MEM_REF)
return ptr_deref_may_alias_global_p (TREE_OPERAND (lhs, 0));
+ else if (CONSTANT_CLASS_P (lhs))
+ return true;
else
gcc_unreachable ();
}
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index f22605626d3..77ff17a6962 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -197,8 +197,7 @@
keep the set of called functions for indirect calls.
And probably more. */
-
-static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
+static GTY ((if_marked ("tree_map_marked_p"), param_is (struct heapvar_map)))
htab_t heapvar_for_stmt;
static bool use_field_sensitive = true;
@@ -379,7 +378,7 @@ heapvar_insert (tree from, unsigned HOST_WIDE_INT offset, tree to)
struct heapvar_map *h;
void **loc;
- h = GGC_NEW (struct heapvar_map);
+ h = ggc_alloc_heapvar_map ();
h->map.base.from = from;
h->offset = offset;
h->map.hash = heapvar_map_hash (h);
@@ -3108,7 +3107,8 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
&0->a.b */
forzero = t;
while (handled_component_p (forzero)
- || INDIRECT_REF_P (forzero))
+ || INDIRECT_REF_P (forzero)
+ || TREE_CODE (forzero) == MEM_REF)
forzero = TREE_OPERAND (forzero, 0);
if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero))
@@ -3335,9 +3335,10 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
{
switch (TREE_CODE (t))
{
- case INDIRECT_REF:
+ case MEM_REF:
{
- get_constraint_for_1 (TREE_OPERAND (t, 0), results, address_p);
+ get_constraint_for_ptr_offset (TREE_OPERAND (t, 0),
+ TREE_OPERAND (t, 1), results);
do_deref (results);
return;
}
@@ -4573,7 +4574,11 @@ find_func_clobbers (gimple origt)
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
&& !auto_var_in_fn_p (tem, cfun->decl))
- || INDIRECT_REF_P (tem))
+ || INDIRECT_REF_P (tem)
+ || (TREE_CODE (tem) == MEM_REF
+ && !(TREE_CODE (TREE_OPERAND (tem, 0)) == ADDR_EXPR
+ && auto_var_in_fn_p
+ (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), cfun->decl))))
{
struct constraint_expr lhsc, *rhsp;
unsigned i;
@@ -4597,7 +4602,11 @@ find_func_clobbers (gimple origt)
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
&& !auto_var_in_fn_p (tem, cfun->decl))
- || INDIRECT_REF_P (tem))
+ || INDIRECT_REF_P (tem)
+ || (TREE_CODE (tem) == MEM_REF
+ && !(TREE_CODE (TREE_OPERAND (tem, 0)) == ADDR_EXPR
+ && auto_var_in_fn_p
+ (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), cfun->decl))))
{
struct constraint_expr lhs, *rhsp;
unsigned i;
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index 2f5b8305f74..a997f7884b0 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -616,6 +616,24 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
}
}
+ /* If the stmt does a memory store and the replacement
+ is a load aliasing it avoid creating overlapping
+ assignments which we cannot expand correctly. */
+ if (gimple_vdef (stmt)
+ && gimple_assign_single_p (stmt))
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (use);
+ while (is_gimple_assign (def_stmt)
+ && gimple_assign_rhs_code (def_stmt) == SSA_NAME)
+ def_stmt
+ = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt));
+ if (gimple_vuse (def_stmt)
+ && gimple_assign_single_p (def_stmt)
+ && refs_may_alias_p (gimple_assign_lhs (stmt),
+ gimple_assign_rhs1 (def_stmt)))
+ same_root_var = true;
+ }
+
/* Mark expression as replaceable unless stmt is volatile or the
def variable has the same root variable as something in the
substitution list. */
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 0113d3ae8bd..9aca36ced62 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -242,14 +242,14 @@ fold_assignment_stmt (gimple stmt)
return fold (rhs);
}
- break;
+
case GIMPLE_UNARY_RHS:
{
tree lhs = gimple_assign_lhs (stmt);
tree op0 = gimple_assign_rhs1 (stmt);
return fold_unary (subcode, TREE_TYPE (lhs), op0);
}
- break;
+
case GIMPLE_BINARY_RHS:
{
tree lhs = gimple_assign_lhs (stmt);
@@ -257,7 +257,16 @@ fold_assignment_stmt (gimple stmt)
tree op1 = gimple_assign_rhs2 (stmt);
return fold_binary (subcode, TREE_TYPE (lhs), op0, op1);
}
- break;
+
+ case GIMPLE_TERNARY_RHS:
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tree op0 = gimple_assign_rhs1 (stmt);
+ tree op1 = gimple_assign_rhs2 (stmt);
+ tree op2 = gimple_assign_rhs3 (stmt);
+ return fold_ternary (subcode, TREE_TYPE (lhs), op0, op1, op2);
+ }
+
default:
gcc_unreachable ();
}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index ec9c50ceb77..2ea2e685b9d 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1114,7 +1114,7 @@ uid_ssaname_map_hash (const void *item)
void
init_tree_ssa (struct function *fn)
{
- fn->gimple_df = GGC_CNEW (struct gimple_df);
+ fn->gimple_df = ggc_alloc_cleared_gimple_df ();
fn->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash,
uid_decl_map_eq, NULL);
fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash,
@@ -1204,6 +1204,12 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
!= TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
return false;
+ /* Do not lose casts to restrict qualified pointers. */
+ if ((TYPE_RESTRICT (outer_type)
+ != TYPE_RESTRICT (inner_type))
+ && TYPE_RESTRICT (outer_type))
+ return false;
+
/* If the outer type is (void *) or a pointer to an incomplete
record type or a pointer to an unprototyped function,
then the conversion is not necessary. */
@@ -1216,12 +1222,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
&& useless_type_conversion_p (TREE_TYPE (TREE_TYPE (outer_type)),
TREE_TYPE (TREE_TYPE (inner_type)))))
return true;
-
- /* Do not lose casts to restrict qualified pointers. */
- if ((TYPE_RESTRICT (outer_type)
- != TYPE_RESTRICT (inner_type))
- && TYPE_RESTRICT (outer_type))
- return false;
}
/* From now on qualifiers on value types do not matter. */
@@ -1273,41 +1273,18 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
{
- /* Don't lose casts between pointers to volatile and non-volatile
- qualified types. Doing so would result in changing the semantics
- of later accesses. For function types the volatile qualifier
- is used to indicate noreturn functions. */
- if (TREE_CODE (TREE_TYPE (outer_type)) != FUNCTION_TYPE
- && TREE_CODE (TREE_TYPE (outer_type)) != METHOD_TYPE
- && TREE_CODE (TREE_TYPE (inner_type)) != FUNCTION_TYPE
- && TREE_CODE (TREE_TYPE (inner_type)) != METHOD_TYPE
- && (TYPE_VOLATILE (TREE_TYPE (outer_type))
- != TYPE_VOLATILE (TREE_TYPE (inner_type)))
- && TYPE_VOLATILE (TREE_TYPE (outer_type)))
- return false;
-
- /* We require explicit conversions from incomplete target types. */
- if (!COMPLETE_TYPE_P (TREE_TYPE (inner_type))
- && COMPLETE_TYPE_P (TREE_TYPE (outer_type)))
- return false;
-
- /* Do not lose casts between pointers that when dereferenced access
- memory with different alias sets. */
- if (get_deref_alias_set (inner_type) != get_deref_alias_set (outer_type))
+ /* Do not lose casts to function pointer types. */
+ if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
+ && !useless_type_conversion_p (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type)))
return false;
/* We do not care for const qualification of the pointed-to types
as const qualification has no semantic value to the middle-end. */
- /* Otherwise pointers/references are equivalent if their pointed
- to types are effectively the same. We can strip qualifiers
- on pointed-to types for further comparison, which is done in
- the callee. Note we have to use true compatibility here
- because addresses are subject to propagation into dereferences
- and thus might get the original type exposed which is equivalent
- to a reverse conversion. */
- return types_compatible_p (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type));
+ /* Otherwise pointers/references are equivalent. */
+ return true;
}
/* Recurse for complex types. */
@@ -1673,8 +1650,9 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_)
/* We do not care about LHS. */
if (wi->is_lhs)
{
- /* Except for operands of INDIRECT_REF. */
- if (!INDIRECT_REF_P (t))
+ /* Except for operands of dereferences. */
+ if (!INDIRECT_REF_P (t)
+ && TREE_CODE (t) != MEM_REF)
return NULL_TREE;
t = TREE_OPERAND (t, 0);
}
@@ -1822,6 +1800,34 @@ struct gimple_opt_pass pass_early_warn_uninitialized =
}
};
+
+/* If necessary, rewrite the base of the reference tree *TP from
+ a MEM_REF to a plain or converted symbol. */
+
+static void
+maybe_rewrite_mem_ref_base (tree *tp)
+{
+ tree sym;
+
+ while (handled_component_p (*tp))
+ tp = &TREE_OPERAND (*tp, 0);
+ if (TREE_CODE (*tp) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (*tp, 0)) == ADDR_EXPR
+ && integer_zerop (TREE_OPERAND (*tp, 1))
+ && (sym = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0))
+ && DECL_P (sym)
+ && !TREE_ADDRESSABLE (sym)
+ && symbol_marked_for_renaming (sym))
+ {
+ if (!useless_type_conversion_p (TREE_TYPE (*tp),
+ TREE_TYPE (sym)))
+ *tp = build1 (VIEW_CONVERT_EXPR,
+ TREE_TYPE (*tp), sym);
+ else
+ *tp = sym;
+ }
+}
+
/* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */
void
@@ -1853,17 +1859,50 @@ execute_update_addresses_taken (bool do_optimize)
{
tree lhs = gimple_get_lhs (stmt);
- /* We may not rewrite TMR_SYMBOL to SSA. */
- if (lhs && TREE_CODE (lhs) == TARGET_MEM_REF
- && TMR_SYMBOL (lhs))
- bitmap_set_bit (not_reg_needs, DECL_UID (TMR_SYMBOL (lhs)));
+ /* A plain decl does not need it set. */
+ if (lhs && !DECL_P (lhs))
+ {
+ if (handled_component_p (lhs))
+ lhs = get_base_address (lhs);
+
+ if (DECL_P (lhs))
+ bitmap_set_bit (not_reg_needs, DECL_UID (lhs));
+ else if (TREE_CODE (lhs) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR)
+ {
+ tree decl = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0);
+ if (DECL_P (decl)
+ && (!integer_zerop (TREE_OPERAND (lhs, 1))
+ || (DECL_SIZE (decl)
+ != TYPE_SIZE (TREE_TYPE (lhs)))))
+ bitmap_set_bit (not_reg_needs, DECL_UID (decl));
+ }
+ }
+ }
+
+ if (gimple_assign_single_p (stmt))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
/* A plain decl does not need it set. */
- else if (lhs && handled_component_p (lhs))
- {
- var = get_base_address (lhs);
- if (DECL_P (var))
- bitmap_set_bit (not_reg_needs, DECL_UID (var));
+ if (!DECL_P (rhs))
+ {
+ tree base = rhs;
+ while (handled_component_p (base))
+ base = TREE_OPERAND (base, 0);
+
+ /* But watch out for MEM_REFs we cannot lower to a
+ VIEW_CONVERT_EXPR. */
+ if (TREE_CODE (base) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR)
+ {
+ tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
+ if (DECL_P (decl)
+ && (!integer_zerop (TREE_OPERAND (base, 1))
+ || (DECL_SIZE (decl)
+ != TYPE_SIZE (TREE_TYPE (base)))))
+ bitmap_set_bit (not_reg_needs, DECL_UID (decl));
+ }
}
}
}
@@ -1937,14 +1976,73 @@ execute_update_addresses_taken (bool do_optimize)
if (update_vops)
{
FOR_EACH_BB (bb)
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple stmt = gsi_stmt (gsi);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
- if (gimple_references_memory_p (stmt)
- || is_gimple_debug (stmt))
- update_stmt (stmt);
- }
+ /* Re-write TARGET_MEM_REFs of symbols we want to
+ rewrite into SSA form. */
+ if (gimple_assign_single_p (stmt))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs, *rhsp = gimple_assign_rhs1_ptr (stmt);
+ tree sym;
+
+ /* We shouldn't have any fancy wrapping of
+ component-refs on the LHS, but look through
+ VIEW_CONVERT_EXPRs as that is easy. */
+ while (TREE_CODE (lhs) == VIEW_CONVERT_EXPR)
+ lhs = TREE_OPERAND (lhs, 0);
+ if (TREE_CODE (lhs) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR
+ && integer_zerop (TREE_OPERAND (lhs, 1))
+ && (sym = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0))
+ && DECL_P (sym)
+ && !TREE_ADDRESSABLE (sym)
+ && symbol_marked_for_renaming (sym))
+ lhs = sym;
+ else
+ lhs = gimple_assign_lhs (stmt);
+
+ /* Rewrite the RHS and make sure the resulting assignment
+ is validly typed. */
+ maybe_rewrite_mem_ref_base (rhsp);
+ rhs = gimple_assign_rhs1 (stmt);
+ if (gimple_assign_lhs (stmt) != lhs
+ && !useless_type_conversion_p (TREE_TYPE (lhs),
+ TREE_TYPE (rhs)))
+ rhs = fold_build1 (VIEW_CONVERT_EXPR,
+ TREE_TYPE (lhs), rhs);
+
+ if (gimple_assign_lhs (stmt) != lhs)
+ gimple_assign_set_lhs (stmt, lhs);
+
+ if (gimple_assign_rhs1 (stmt) != rhs)
+ {
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
+ gimple_assign_set_rhs_from_tree (&gsi, rhs);
+ }
+ }
+
+ if (gimple_code (stmt) == GIMPLE_ASM)
+ {
+ unsigned i;
+ for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ {
+ tree link = gimple_asm_output_op (stmt, i);
+ maybe_rewrite_mem_ref_base (&TREE_VALUE (link));
+ }
+ for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
+ {
+ tree link = gimple_asm_input_op (stmt, i);
+ maybe_rewrite_mem_ref_base (&TREE_VALUE (link));
+ }
+ }
+
+ if (gimple_references_memory_p (stmt)
+ || is_gimple_debug (stmt))
+ update_stmt (stmt);
+ }
/* Update SSA form here, we are called as non-pass as well. */
update_ssa (TODO_update_ssa);
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index cc7683dfabe..79b844ffe7c 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -269,7 +269,7 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info)
if (!ptr_info)
return;
- new_ptr_info = GGC_NEW (struct ptr_info_def);
+ new_ptr_info = ggc_alloc_ptr_info_def ();
*new_ptr_info = *ptr_info;
SSA_NAME_PTR_INFO (name) = new_ptr_info;
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 3bfbfc2dc19..dae14f54a60 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -512,7 +512,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
/* x = *ap_temp; */
- if (gimple_assign_rhs_code (stmt) == INDIRECT_REF
+ if (gimple_assign_rhs_code (stmt) == MEM_REF
&& TREE_OPERAND (rhs, 0) == use
&& TYPE_SIZE_UNIT (TREE_TYPE (rhs))
&& host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (rhs)), 1)
@@ -522,6 +522,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
tree access_size = TYPE_SIZE_UNIT (TREE_TYPE (rhs));
gpr_size = si->offsets[SSA_NAME_VERSION (use)]
+ + tree_low_cst (TREE_OPERAND (rhs, 1), 0)
+ tree_low_cst (access_size, 1);
if (gpr_size >= VA_LIST_MAX_GPR_SIZE)
cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 5ad8351e000..3be231ac267 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -2386,6 +2386,7 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
tree vect_ptr_type;
tree step = TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr)));
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
+ tree base;
if (loop_vinfo && loop && loop != (gimple_bb (stmt))->loop_father)
{
@@ -2441,15 +2442,18 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
data_ref_base, base_offset);
else
{
- if (TREE_CODE (DR_REF (dr)) == INDIRECT_REF)
- addr_base = unshare_expr (TREE_OPERAND (DR_REF (dr), 0));
- else
- addr_base = build1 (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (DR_REF (dr))),
- unshare_expr (DR_REF (dr)));
+ addr_base = build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (DR_REF (dr))),
+ unshare_expr (DR_REF (dr)));
}
vect_ptr_type = build_pointer_type (STMT_VINFO_VECTYPE (stmt_info));
+ base = get_base_address (DR_REF (dr));
+ if (base
+ && INDIRECT_REF_P (base))
+ vect_ptr_type
+ = build_qualified_type (vect_ptr_type,
+ TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
vec_stmt = fold_convert (vect_ptr_type, addr_base);
addr_expr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
@@ -2542,6 +2546,7 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
tree step;
bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
+ tree base;
if (loop_vinfo)
{
@@ -2599,6 +2604,12 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
/** (1) Create the new vector-pointer variable: **/
vect_ptr_type = build_pointer_type (vectype);
+ base = get_base_address (DR_REF (dr));
+ if (base
+ && INDIRECT_REF_P (base))
+ vect_ptr_type
+ = build_qualified_type (vect_ptr_type,
+ TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
vect_ptr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
get_name (base_name));
@@ -3716,8 +3727,8 @@ vect_supportable_dr_alignment (struct data_reference *dr)
}
if (targetm.vectorize.
- builtin_support_vector_misalignment (mode, type,
- DR_MISALIGNMENT (dr), is_packed))
+ support_vector_misalignment (mode, type,
+ DR_MISALIGNMENT (dr), is_packed))
/* Can't software pipeline the loads, but can at least do them. */
return dr_unaligned_supported;
}
@@ -3735,8 +3746,8 @@ vect_supportable_dr_alignment (struct data_reference *dr)
}
if (targetm.vectorize.
- builtin_support_vector_misalignment (mode, type,
- DR_MISALIGNMENT (dr), is_packed))
+ support_vector_misalignment (mode, type,
+ DR_MISALIGNMENT (dr), is_packed))
return dr_unaligned_supported;
}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 83cd35b308c..02e00dd1820 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-chrec.h"
#include "tree-scalar-evolution.h"
#include "tree-vectorizer.h"
+#include "target.h"
/* Loop Vectorization Pass.
@@ -1265,6 +1266,15 @@ vect_analyze_loop_form (struct loop *loop)
}
+/* Get cost by calling cost target builtin. */
+
+static inline
+int vect_get_cost (enum vect_cost_for_stmt type_of_cost)
+{
+ return targetm.vectorize.builtin_vectorization_cost (type_of_cost);
+}
+
+
/* Function vect_analyze_loop_operations.
Scan the loop stmts and make sure they are all vectorizable. */
@@ -2227,7 +2237,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo)
|| LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo))
- vec_outside_cost += TARG_COND_TAKEN_BRANCH_COST;
+ vec_outside_cost += vect_get_cost (cond_branch_taken);
/* Count statements in scalar loop. Using this as scalar cost for a single
iteration for now.
@@ -2296,8 +2306,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
branch per peeled loop. Even if scalar loop iterations are known,
vector iterations are not known since peeled prologue iterations are
not known. Hence guards remain the same. */
- peel_guard_costs += 2 * (TARG_COND_TAKEN_BRANCH_COST
- + TARG_COND_NOT_TAKEN_BRANCH_COST);
+ peel_guard_costs += 2 * (vect_get_cost (cond_branch_taken)
+ + vect_get_cost (cond_branch_not_taken));
}
else
{
@@ -2323,8 +2333,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
/* If peeled iterations are known but number of scalar loop
iterations are unknown, count a taken branch per peeled loop. */
- peel_guard_costs += 2 * TARG_COND_TAKEN_BRANCH_COST;
-
+ peel_guard_costs += 2 * vect_get_cost (cond_branch_taken);
}
else
{
@@ -2399,16 +2408,16 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
/* Cost model check occurs at versioning. */
if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo)
|| LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo))
- scalar_outside_cost += TARG_COND_NOT_TAKEN_BRANCH_COST;
+ scalar_outside_cost += vect_get_cost (cond_branch_not_taken);
else
{
/* Cost model check occurs at prologue generation. */
if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0)
- scalar_outside_cost += 2 * TARG_COND_TAKEN_BRANCH_COST
- + TARG_COND_NOT_TAKEN_BRANCH_COST;
+ scalar_outside_cost += 2 * vect_get_cost (cond_branch_taken)
+ + vect_get_cost (cond_branch_not_taken);
/* Cost model check occurs at epilogue generation. */
else
- scalar_outside_cost += 2 * TARG_COND_TAKEN_BRANCH_COST;
+ scalar_outside_cost += 2 * vect_get_cost (cond_branch_taken);
}
}
@@ -2518,7 +2527,8 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
/* Cost of reduction op inside loop. */
- STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) += ncopies * TARG_VEC_STMT_COST;
+ STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info)
+ += ncopies * vect_get_cost (vector_stmt);
stmt = STMT_VINFO_STMT (stmt_info);
@@ -2558,7 +2568,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
code = gimple_assign_rhs_code (orig_stmt);
/* Add in cost for initial definition. */
- outer_cost += TARG_SCALAR_TO_VEC_COST;
+ outer_cost += vect_get_cost (scalar_to_vec);
/* Determine cost of epilogue code.
@@ -2568,7 +2578,8 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
if (!nested_in_vect_loop_p (loop, orig_stmt))
{
if (reduc_code != ERROR_MARK)
- outer_cost += TARG_VEC_STMT_COST + TARG_VEC_TO_SCALAR_COST;
+ outer_cost += vect_get_cost (vector_stmt)
+ + vect_get_cost (vec_to_scalar);
else
{
int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
@@ -2585,12 +2596,14 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
&& optab_handler (vec_shr_optab, mode)->insn_code != CODE_FOR_nothing)
/* Final reduction via vector shifts and the reduction operator. Also
requires scalar extract. */
- outer_cost += ((exact_log2(nelements) * 2) * TARG_VEC_STMT_COST
- + TARG_VEC_TO_SCALAR_COST);
+ outer_cost += ((exact_log2(nelements) * 2)
+ * vect_get_cost (vector_stmt)
+ + vect_get_cost (vec_to_scalar));
else
/* Use extracts and reduction op for final reduction. For N elements,
we have N extracts and N-1 reduction ops. */
- outer_cost += ((nelements + nelements - 1) * TARG_VEC_STMT_COST);
+ outer_cost += ((nelements + nelements - 1)
+ * vect_get_cost (vector_stmt));
}
}
@@ -2613,9 +2626,11 @@ static void
vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies)
{
/* loop cost for vec_loop. */
- STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) = ncopies * TARG_VEC_STMT_COST;
+ STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info)
+ = ncopies * vect_get_cost (vector_stmt);
/* prologue cost for vec_init and vec_step. */
- STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = 2 * TARG_SCALAR_TO_VEC_COST;
+ STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info)
+ = 2 * vect_get_cost (scalar_to_vec);
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_induction_cost: inside_cost = %d, "
@@ -3028,12 +3043,15 @@ get_initial_def_for_reduction (gimple stmt, tree init_val,
*adjustment_def = init_val;
}
- if (code == MULT_EXPR || code == BIT_AND_EXPR)
+ if (code == MULT_EXPR)
{
real_init_val = dconst1;
int_init_val = 1;
}
+ if (code == BIT_AND_EXPR)
+ int_init_val = -1;
+
if (SCALAR_FLOAT_TYPE_P (scalar_type))
def_for_init = build_real (scalar_type, real_init_val);
else
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 64e39f1a4db..3336cf09c27 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -702,6 +702,8 @@ vect_pattern_recog_1 (
type_out = get_vectype_for_scalar_type (type_out, vectorization_factor);
else
type_out = type_in;
+ if (!type_out)
+ return;
pattern_vectype = type_out;
if (is_gimple_assign (pattern_stmt))
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 7b453bfc5aa..abca8d62126 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -649,7 +649,9 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if (permutation)
{
VEC_safe_push (slp_tree, heap, *loads, *node);
- *inside_cost += TARG_VEC_PERMUTE_COST * group_size;
+ *inside_cost
+ += targetm.vectorize.builtin_vectorization_cost (vec_perm)
+ * group_size;
}
return true;
@@ -1712,7 +1714,6 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
break;
case MULT_EXPR:
- case BIT_AND_EXPR:
if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (op)))
neutral_op = build_real (TREE_TYPE (op), dconst1);
else
@@ -1720,6 +1721,10 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
break;
+ case BIT_AND_EXPR:
+ neutral_op = build_int_cst (TREE_TYPE (op), -1);
+ break;
+
default:
neutral_op = NULL;
}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 98673c0f3ca..1b8adf25b8d 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -553,9 +553,9 @@ cost_for_stmt (gimple stmt)
switch (STMT_VINFO_TYPE (stmt_info))
{
case load_vec_info_type:
- return TARG_SCALAR_LOAD_COST;
+ return targetm.vectorize.builtin_vectorization_cost (scalar_load);
case store_vec_info_type:
- return TARG_SCALAR_STORE_COST;
+ return targetm.vectorize.builtin_vectorization_cost (scalar_store);
case op_vec_info_type:
case condition_vec_info_type:
case assignment_vec_info_type:
@@ -565,7 +565,7 @@ cost_for_stmt (gimple stmt)
case type_demotion_vec_info_type:
case type_conversion_vec_info_type:
case call_vec_info_type:
- return TARG_SCALAR_STMT_COST;
+ return targetm.vectorize.builtin_vectorization_cost (scalar_stmt);
case undef_vec_info_type:
default:
gcc_unreachable ();
@@ -589,13 +589,15 @@ vect_model_simple_cost (stmt_vec_info stmt_info, int ncopies,
if (PURE_SLP_STMT (stmt_info))
return;
- inside_cost = ncopies * TARG_VEC_STMT_COST;
+ inside_cost = ncopies
+ * targetm.vectorize.builtin_vectorization_cost (vector_stmt);
/* FORNOW: Assuming maximum 2 args per stmts. */
for (i = 0; i < 2; i++)
{
if (dt[i] == vect_constant_def || dt[i] == vect_external_def)
- outside_cost += TARG_SCALAR_TO_VEC_COST;
+ outside_cost
+ += targetm.vectorize.builtin_vectorization_cost (vector_stmt);
}
if (vect_print_dump_info (REPORT_COST))
@@ -643,7 +645,8 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
return;
if (dt == vect_constant_def || dt == vect_external_def)
- outside_cost = TARG_SCALAR_TO_VEC_COST;
+ outside_cost
+ = targetm.vectorize.builtin_vectorization_cost (scalar_to_vec);
/* Strided access? */
if (DR_GROUP_FIRST_DR (stmt_info) && !slp_node)
@@ -658,7 +661,7 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
{
/* Uses a high and low interleave operation for each needed permute. */
inside_cost = ncopies * exact_log2(group_size) * group_size
- * TARG_VEC_STMT_COST;
+ * targetm.vectorize.builtin_vectorization_cost (vector_stmt);
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_store_cost: strided group_size = %d .",
@@ -667,7 +670,8 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
}
/* Costs of the stores. */
- inside_cost += ncopies * TARG_VEC_STORE_COST;
+ inside_cost += ncopies
+ * targetm.vectorize.builtin_vectorization_cost (vector_store);
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_store_cost: inside_cost = %d, "
@@ -722,7 +726,7 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, slp_tree slp_node)
{
/* Uses an even and odd extract operations for each needed permute. */
inside_cost = ncopies * exact_log2(group_size) * group_size
- * TARG_VEC_STMT_COST;
+ * targetm.vectorize.builtin_vectorization_cost (vector_stmt);
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_load_cost: strided group_size = %d .",
@@ -735,7 +739,8 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, slp_tree slp_node)
{
case dr_aligned:
{
- inside_cost += ncopies * TARG_VEC_LOAD_COST;
+ inside_cost += ncopies
+ * targetm.vectorize.builtin_vectorization_cost (vector_load);
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_load_cost: aligned.");
@@ -745,7 +750,8 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, slp_tree slp_node)
case dr_unaligned_supported:
{
/* Here, we assign an additional cost for the unaligned load. */
- inside_cost += ncopies * TARG_VEC_UNALIGNED_LOAD_COST;
+ inside_cost += ncopies
+ * targetm.vectorize.builtin_vectorization_cost (unaligned_load);
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_load_cost: unaligned supported by "
@@ -755,13 +761,16 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, slp_tree slp_node)
}
case dr_explicit_realign:
{
- inside_cost += ncopies * (2*TARG_VEC_LOAD_COST + TARG_VEC_STMT_COST);
+ inside_cost += ncopies * (2
+ * targetm.vectorize.builtin_vectorization_cost (vector_load)
+ + targetm.vectorize.builtin_vectorization_cost (vector_stmt));
/* FIXME: If the misalignment remains fixed across the iterations of
the containing loop, the following cost should be added to the
outside costs. */
if (targetm.vectorize.builtin_mask_for_load)
- inside_cost += TARG_VEC_STMT_COST;
+ inside_cost
+ += targetm.vectorize.builtin_vectorization_cost (vector_stmt);
break;
}
@@ -780,13 +789,16 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, slp_tree slp_node)
if ((!DR_GROUP_FIRST_DR (stmt_info)) || group_size > 1 || slp_node)
{
- outside_cost = 2*TARG_VEC_STMT_COST;
+ outside_cost = 2
+ * targetm.vectorize.builtin_vectorization_cost (vector_stmt);
if (targetm.vectorize.builtin_mask_for_load)
- outside_cost += TARG_VEC_STMT_COST;
+ outside_cost
+ += targetm.vectorize.builtin_vectorization_cost (vector_stmt);
}
- inside_cost += ncopies * (TARG_VEC_LOAD_COST + TARG_VEC_STMT_COST);
-
+ inside_cost += ncopies
+ * (targetm.vectorize.builtin_vectorization_cost (vector_load)
+ + targetm.vectorize.builtin_vectorization_cost (vector_stmt));
break;
}
@@ -3017,7 +3029,8 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
&& TREE_CODE (scalar_dest) != INDIRECT_REF
&& TREE_CODE (scalar_dest) != COMPONENT_REF
&& TREE_CODE (scalar_dest) != IMAGPART_EXPR
- && TREE_CODE (scalar_dest) != REALPART_EXPR)
+ && TREE_CODE (scalar_dest) != REALPART_EXPR
+ && TREE_CODE (scalar_dest) != MEM_REF)
return false;
gcc_assert (gimple_assign_single_p (stmt));
@@ -3273,7 +3286,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
vec_oprnd = VEC_index (tree, result_chain, i);
if (aligned_access_p (first_dr))
- data_ref = build_fold_indirect_ref (dataref_ptr);
+ data_ref = build_simple_mem_ref (dataref_ptr);
else
{
int mis = DR_MISALIGNMENT (first_dr);
@@ -3412,7 +3425,8 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
&& code != INDIRECT_REF
&& code != COMPONENT_REF
&& code != IMAGPART_EXPR
- && code != REALPART_EXPR)
+ && code != REALPART_EXPR
+ && code != MEM_REF)
return false;
if (!STMT_VINFO_DATA_REF (stmt_info))
@@ -3650,7 +3664,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
case dr_aligned:
gcc_assert (aligned_access_p (first_dr));
- data_ref = build_fold_indirect_ref (dataref_ptr);
+ data_ref = build_simple_mem_ref (dataref_ptr);
break;
case dr_unaligned_supported:
{
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 58c1609eb8c..8fdfbee18fa 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -543,70 +543,6 @@ typedef struct _stmt_vec_info {
#define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)
#define STMT_SLP_TYPE(S) (S)->slp_type
-/* These are some defines for the initial implementation of the vectorizer's
- cost model. These will later be target specific hooks. */
-
-/* Cost of conditional taken branch. */
-#ifndef TARG_COND_TAKEN_BRANCH_COST
-#define TARG_COND_TAKEN_BRANCH_COST 3
-#endif
-
-/* Cost of conditional not taken branch. */
-#ifndef TARG_COND_NOT_TAKEN_BRANCH_COST
-#define TARG_COND_NOT_TAKEN_BRANCH_COST 1
-#endif
-
-/* Cost of any scalar operation, excluding load and store. */
-#ifndef TARG_SCALAR_STMT_COST
-#define TARG_SCALAR_STMT_COST 1
-#endif
-
-/* Cost of scalar load. */
-#ifndef TARG_SCALAR_LOAD_COST
-#define TARG_SCALAR_LOAD_COST 1
-#endif
-
-/* Cost of scalar store. */
-#ifndef TARG_SCALAR_STORE_COST
-#define TARG_SCALAR_STORE_COST 1
-#endif
-
-/* Cost of any vector operation, excluding load, store or vector to scalar
- operation. */
-#ifndef TARG_VEC_STMT_COST
-#define TARG_VEC_STMT_COST 1
-#endif
-
-/* Cost of vector to scalar operation. */
-#ifndef TARG_VEC_TO_SCALAR_COST
-#define TARG_VEC_TO_SCALAR_COST 1
-#endif
-
-/* Cost of scalar to vector operation. */
-#ifndef TARG_SCALAR_TO_VEC_COST
-#define TARG_SCALAR_TO_VEC_COST 1
-#endif
-
-/* Cost of aligned vector load. */
-#ifndef TARG_VEC_LOAD_COST
-#define TARG_VEC_LOAD_COST 1
-#endif
-
-/* Cost of misaligned vector load. */
-#ifndef TARG_VEC_UNALIGNED_LOAD_COST
-#define TARG_VEC_UNALIGNED_LOAD_COST 2
-#endif
-
-/* Cost of vector store. */
-#ifndef TARG_VEC_STORE_COST
-#define TARG_VEC_STORE_COST 1
-#endif
-
-/* Cost of vector permutation. */
-#ifndef TARG_VEC_PERMUTE_COST
-#define TARG_VEC_PERMUTE_COST 1
-#endif
-
/* The maximum number of intermediate steps required in multi-step type
conversion. */
#define MAX_INTERM_CVT_STEPS 3
@@ -631,7 +567,6 @@ vinfo_for_stmt (gimple stmt)
if (uid == 0)
return NULL;
- gcc_assert (uid <= VEC_length (vec_void_p, stmt_vec_info_vec));
return (stmt_vec_info) VEC_index (vec_void_p, stmt_vec_info_vec, uid - 1);
}
@@ -641,7 +576,7 @@ set_vinfo_for_stmt (gimple stmt, stmt_vec_info info)
unsigned int uid = gimple_uid (stmt);
if (uid == 0)
{
- gcc_assert (info);
+ gcc_checking_assert (info);
uid = VEC_length (vec_void_p, stmt_vec_info_vec) + 1;
gimple_set_uid (stmt, uid);
VEC_safe_push (vec_void_p, heap, stmt_vec_info_vec, (vec_void_p) info);
@@ -667,8 +602,8 @@ get_earlier_stmt (gimple stmt1, gimple stmt2)
if (uid1 == 0 || uid2 == 0)
return NULL;
- gcc_assert (uid1 <= VEC_length (vec_void_p, stmt_vec_info_vec));
- gcc_assert (uid2 <= VEC_length (vec_void_p, stmt_vec_info_vec));
+ gcc_checking_assert (uid1 <= VEC_length (vec_void_p, stmt_vec_info_vec)
+ && uid2 <= VEC_length (vec_void_p, stmt_vec_info_vec));
if (uid1 < uid2)
return stmt1;
@@ -696,7 +631,7 @@ is_loop_header_bb_p (basic_block bb)
{
if (bb == (bb->loop_father)->header)
return true;
- gcc_assert (EDGE_COUNT (bb->preds) == 1);
+ gcc_checking_assert (EDGE_COUNT (bb->preds) == 1);
return false;
}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index f0e9ce64d64..4f5db8069f5 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -865,6 +865,8 @@ gimple_assign_nonnegative_warnv_p (gimple stmt, bool *strict_overflow_p)
gimple_assign_rhs1 (stmt),
gimple_assign_rhs2 (stmt),
strict_overflow_p);
+ case GIMPLE_TERNARY_RHS:
+ return false;
case GIMPLE_SINGLE_RHS:
return tree_single_nonnegative_warnv_p (gimple_assign_rhs1 (stmt),
strict_overflow_p);
@@ -936,6 +938,8 @@ gimple_assign_nonzero_warnv_p (gimple stmt, bool *strict_overflow_p)
gimple_assign_rhs1 (stmt),
gimple_assign_rhs2 (stmt),
strict_overflow_p);
+ case GIMPLE_TERNARY_RHS:
+ return false;
case GIMPLE_SINGLE_RHS:
return tree_single_nonzero_warnv_p (gimple_assign_rhs1 (stmt),
strict_overflow_p);
@@ -983,7 +987,7 @@ vrp_stmt_computes_nonzero (gimple stmt, bool *strict_overflow_p)
tree base = get_base_address (TREE_OPERAND (expr, 0));
if (base != NULL_TREE
- && TREE_CODE (base) == INDIRECT_REF
+ && TREE_CODE (base) == MEM_REF
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
{
value_range_t *vr = get_value_range (TREE_OPERAND (base, 0));
@@ -1507,10 +1511,10 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
/* Make sure to not set TREE_OVERFLOW on the final type
conversion. We are willingly interpreting large positive
unsigned values as negative singed values here. */
- min = force_fit_type_double (TREE_TYPE (var), TREE_INT_CST_LOW (min),
- TREE_INT_CST_HIGH (min), 0, false);
- max = force_fit_type_double (TREE_TYPE (var), TREE_INT_CST_LOW (max),
- TREE_INT_CST_HIGH (max), 0, false);
+ min = force_fit_type_double (TREE_TYPE (var), tree_to_double_int (min),
+ 0, false);
+ max = force_fit_type_double (TREE_TYPE (var), tree_to_double_int (max),
+ 0, false);
/* We can transform a max, min range to an anti-range or
vice-versa. Use set_and_canonicalize_value_range which does
@@ -2783,11 +2787,11 @@ extract_range_from_unary_expr (value_range_t *vr, enum tree_code code,
{
tree new_min, new_max;
new_min = force_fit_type_double (outer_type,
- TREE_INT_CST_LOW (vr0.min),
- TREE_INT_CST_HIGH (vr0.min), 0, 0);
+ tree_to_double_int (vr0.min),
+ 0, false);
new_max = force_fit_type_double (outer_type,
- TREE_INT_CST_LOW (vr0.max),
- TREE_INT_CST_HIGH (vr0.max), 0, 0);
+ tree_to_double_int (vr0.max),
+ 0, false);
if (is_overflow_infinity (vr0.min))
new_min = negative_overflow_infinity (outer_type);
if (is_overflow_infinity (vr0.max))
@@ -5071,8 +5075,7 @@ check_array_ref (location_t location, tree ref, bool ignore_off_by_one)
/* Accesses to trailing arrays via pointers may access storage
beyond the types array bounds. */
base = get_base_address (ref);
- if (base
- && INDIRECT_REF_P (base))
+ if (base && TREE_CODE (base) == MEM_REF)
{
tree cref, next = NULL_TREE;
@@ -5171,6 +5174,51 @@ search_for_addr_array (tree t, location_t location)
t = TREE_OPERAND (t, 0);
}
while (handled_component_p (t));
+
+ if (TREE_CODE (t) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
+ && !TREE_NO_WARNING (t))
+ {
+ tree tem = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
+ tree low_bound, up_bound, el_sz;
+ double_int idx;
+ if (TREE_CODE (TREE_TYPE (tem)) != ARRAY_TYPE
+ || TREE_CODE (TREE_TYPE (TREE_TYPE (tem))) == ARRAY_TYPE
+ || !TYPE_DOMAIN (TREE_TYPE (tem)))
+ return;
+
+ low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (tem)));
+ up_bound = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tem)));
+ el_sz = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (tem)));
+ if (!low_bound
+ || TREE_CODE (low_bound) != INTEGER_CST
+ || !up_bound
+ || TREE_CODE (up_bound) != INTEGER_CST
+ || !el_sz
+ || TREE_CODE (el_sz) != INTEGER_CST)
+ return;
+
+ idx = mem_ref_offset (t);
+ idx = double_int_sdiv (idx, tree_to_double_int (el_sz), TRUNC_DIV_EXPR);
+ if (double_int_scmp (idx, double_int_zero) < 0)
+ {
+ warning_at (location, OPT_Warray_bounds,
+ "array subscript is below array bounds");
+ TREE_NO_WARNING (t) = 1;
+ }
+ else if (double_int_scmp (idx,
+ double_int_add
+ (double_int_add
+ (tree_to_double_int (up_bound),
+ double_int_neg
+ (tree_to_double_int (low_bound))),
+ double_int_one)) > 0)
+ {
+ warning_at (location, OPT_Warray_bounds,
+ "array subscript is above array bounds");
+ TREE_NO_WARNING (t) = 1;
+ }
+ }
}
/* walk_tree() callback that checks if *TP is
@@ -5199,7 +5247,7 @@ check_array_bounds (tree *tp, int *walk_subtree, void *data)
if (TREE_CODE (t) == ARRAY_REF)
check_array_ref (location, t, false /*ignore_off_by_one*/);
- if (TREE_CODE (t) == INDIRECT_REF
+ if (TREE_CODE (t) == MEM_REF
|| (TREE_CODE (t) == RETURN_EXPR && TREE_OPERAND (t, 0)))
search_for_addr_array (TREE_OPERAND (t, 0), location);
@@ -7311,6 +7359,7 @@ vrp_finalize (void)
size_t i;
prop_value_t *single_val_range;
bool do_value_subst_p;
+ unsigned num = num_ssa_names;
if (dump_file)
{
@@ -7322,10 +7371,10 @@ vrp_finalize (void)
/* We may have ended with ranges that have exactly one value. Those
values can be substituted as any other const propagated
value using substitute_and_fold. */
- single_val_range = XCNEWVEC (prop_value_t, num_ssa_names);
+ single_val_range = XCNEWVEC (prop_value_t, num);
do_value_subst_p = false;
- for (i = 0; i < num_ssa_names; i++)
+ for (i = 0; i < num; i++)
if (vr_value[i]
&& vr_value[i]->type == VR_RANGE
&& vr_value[i]->min == vr_value[i]->max
@@ -7343,7 +7392,7 @@ vrp_finalize (void)
single_val_range = NULL;
}
- substitute_and_fold (single_val_range, vrp_fold_stmt);
+ substitute_and_fold (single_val_range, vrp_fold_stmt, false);
if (warn_array_bounds)
check_all_array_refs ();
@@ -7353,7 +7402,7 @@ vrp_finalize (void)
identify_jump_threads ();
/* Free allocated memory. */
- for (i = 0; i < num_ssa_names; i++)
+ for (i = 0; i < num; i++)
if (vr_value[i])
{
BITMAP_FREE (vr_value[i]->equiv);
diff --git a/gcc/tree.c b/gcc/tree.c
index 67e2f417cb9..17accb2f912 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -853,13 +853,9 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
tree_node_sizes[(int) kind] += length;
#endif
- if (code == IDENTIFIER_NODE)
- t = (tree) ggc_alloc_zone_pass_stat (length, &tree_id_zone);
- else
- t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone);
-
- memset (t, 0, length);
-
+ t = ggc_alloc_zone_cleared_tree_node_stat (
+ (code == IDENTIFIER_NODE) ? &tree_id_zone : &tree_zone,
+ length PASS_MEM_STAT);
TREE_SET_CODE (t, code);
switch (type)
@@ -952,7 +948,7 @@ copy_node_stat (tree node MEM_STAT_DECL)
gcc_assert (code != STATEMENT_LIST);
length = tree_size (node);
- t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone);
+ t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT);
memcpy (t, node, length);
TREE_CHAIN (t) = 0;
@@ -1096,6 +1092,52 @@ double_int_fits_to_tree_p (const_tree type, double_int cst)
return double_int_equal_p (cst, ext);
}
+/* We force the double_int CST to the range of the type TYPE by sign or
+ zero extending it. OVERFLOWABLE indicates if we are interested in
+ overflow of the value, when >0 we are only interested in signed
+ overflow, for <0 we are interested in any overflow. OVERFLOWED
+ indicates whether overflow has already occurred. CONST_OVERFLOWED
+ indicates whether constant overflow has already occurred. We force
+ T's value to be within range of T's type (by setting to 0 or 1 all
+ the bits outside the type's range). We set TREE_OVERFLOWED if,
+ OVERFLOWED is nonzero,
+ or OVERFLOWABLE is >0 and signed overflow occurs
+ or OVERFLOWABLE is <0 and any overflow occurs
+ We return a new tree node for the extended double_int. The node
+ is shared if no overflow flags are set. */
+
+
+tree
+force_fit_type_double (tree type, double_int cst, int overflowable,
+ bool overflowed)
+{
+ bool sign_extended_type;
+
+ /* Size types *are* sign extended. */
+ sign_extended_type = (!TYPE_UNSIGNED (type)
+ || (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (type)));
+
+ /* If we need to set overflow flags, return a new unshared node. */
+ if (overflowed || !double_int_fits_to_tree_p(type, cst))
+ {
+ if (overflowed
+ || overflowable < 0
+ || (overflowable > 0 && sign_extended_type))
+ {
+ tree t = make_node (INTEGER_CST);
+ TREE_INT_CST (t) = double_int_ext (cst, TYPE_PRECISION (type),
+ !sign_extended_type);
+ TREE_TYPE (t) = type;
+ TREE_OVERFLOW (t) = 1;
+ return t;
+ }
+ }
+
+ /* Else build a shared node. */
+ return double_int_to_tree (type, cst);
+}
+
/* These are the hash table functions for the hash table of INTEGER_CST
nodes of a sizetype. */
@@ -1385,7 +1427,7 @@ build_fixed (tree type, FIXED_VALUE_TYPE f)
FIXED_VALUE_TYPE *fp;
v = make_node (FIXED_CST);
- fp = GGC_NEW (FIXED_VALUE_TYPE);
+ fp = ggc_alloc_fixed_value ();
memcpy (fp, &f, sizeof (FIXED_VALUE_TYPE));
TREE_TYPE (v) = type;
@@ -1406,7 +1448,7 @@ build_real (tree type, REAL_VALUE_TYPE d)
Consider doing it via real_convert now. */
v = make_node (REAL_CST);
- dp = GGC_NEW (REAL_VALUE_TYPE);
+ dp = ggc_alloc_real_value ();
memcpy (dp, &d, sizeof (REAL_VALUE_TYPE));
TREE_TYPE (v) = type;
@@ -1466,7 +1508,7 @@ build_string (int len, const char *str)
tree_node_sizes[(int) c_kind] += length;
#endif
- s = ggc_alloc_tree (length);
+ s = ggc_alloc_tree_node (length);
memset (s, 0, sizeof (struct tree_common));
TREE_SET_CODE (s, STRING_CST);
@@ -1555,7 +1597,7 @@ make_tree_binfo_stat (unsigned base_binfos MEM_STAT_DECL)
tree_node_sizes[(int) binfo_kind] += length;
#endif
- t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone);
+ t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT);
memset (t, 0, offsetof (struct tree_binfo, base_binfos));
@@ -1580,9 +1622,7 @@ make_tree_vec_stat (int len MEM_STAT_DECL)
tree_node_sizes[(int) vec_kind] += length;
#endif
- t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone);
-
- memset (t, 0, length);
+ t = ggc_alloc_zone_cleared_tree_node_stat (&tree_zone, length PASS_MEM_STAT);
TREE_SET_CODE (t, TREE_VEC);
TREE_VEC_LENGTH (t) = len;
@@ -1923,6 +1963,19 @@ purpose_member (const_tree elem, tree list)
return NULL_TREE;
}
+/* Return true if ELEM is in V. */
+
+bool
+vec_member (const_tree elem, VEC(tree,gc) *v)
+{
+ unsigned ix;
+ tree t;
+ for (ix = 0; VEC_iterate (tree, v, ix, t); ix++)
+ if (elem == t)
+ return true;
+ return false;
+}
+
/* Returns element number IDX (zero-origin) of chain CHAIN, or
NULL_TREE. */
@@ -2093,13 +2146,13 @@ build_tree_list_vec_stat (const VEC(tree,gc) *vec MEM_STAT_DECL)
purpose and value fields are PURPOSE and VALUE
and whose TREE_CHAIN is CHAIN. */
-tree
+tree
tree_cons_stat (tree purpose, tree value, tree chain MEM_STAT_DECL)
{
tree node;
- node = (tree) ggc_alloc_zone_pass_stat (sizeof (struct tree_list), &tree_zone);
-
+ node = ggc_alloc_zone_tree_node_stat (&tree_zone, sizeof (struct tree_list)
+ PASS_MEM_STAT);
memset (node, 0, sizeof (struct tree_common));
#ifdef GATHER_STATISTICS
@@ -3511,7 +3564,8 @@ do { tree _node = (NODE); \
address is constant too. If it's a decl, its address is constant if the
decl is static. Everything else is not constant and, furthermore,
taking the address of a volatile variable is not volatile. */
- if (TREE_CODE (node) == INDIRECT_REF)
+ if (TREE_CODE (node) == INDIRECT_REF
+ || TREE_CODE (node) == MEM_REF)
UPDATE_FLAGS (TREE_OPERAND (node, 0));
else if (CONSTANT_CLASS_P (node))
;
@@ -3578,7 +3632,7 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
gcc_assert (TREE_CODE_LENGTH (code) == 1);
- t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone);
+ t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT);
memset (t, 0, sizeof (struct tree_common));
@@ -3825,6 +3879,42 @@ build6_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
return t;
}
+/* Build a simple MEM_REF tree with the sematics of a plain INDIRECT_REF
+ on the pointer PTR. */
+
+tree
+build_simple_mem_ref_loc (location_t loc, tree ptr)
+{
+ HOST_WIDE_INT offset = 0;
+ tree ptype = TREE_TYPE (ptr);
+ tree tem;
+ /* For convenience allow addresses that collapse to a simple base
+ and offset. */
+ if (TREE_CODE (ptr) == ADDR_EXPR
+ && (handled_component_p (TREE_OPERAND (ptr, 0))
+ || TREE_CODE (TREE_OPERAND (ptr, 0)) == MEM_REF))
+ {
+ ptr = get_addr_base_and_unit_offset (TREE_OPERAND (ptr, 0), &offset);
+ gcc_assert (ptr);
+ ptr = build_fold_addr_expr (ptr);
+ gcc_assert (is_gimple_reg (ptr) || is_gimple_min_invariant (ptr));
+ }
+ tem = build2 (MEM_REF, TREE_TYPE (ptype),
+ ptr, build_int_cst (ptype, offset));
+ SET_EXPR_LOCATION (tem, loc);
+ return tem;
+}
+
+/* Return the constant offset of a MEM_REF tree T. */
+
+double_int
+mem_ref_offset (const_tree t)
+{
+ tree toff = TREE_OPERAND (t, 1);
+ return double_int_sext (tree_to_double_int (toff),
+ TYPE_PRECISION (TREE_TYPE (toff)));
+}
+
/* Similar except don't specify the TREE_TYPE
and leave the TREE_SIDE_EFFECTS as 0.
It is permissible for arguments to be null,
@@ -5638,7 +5728,7 @@ decl_priority_info (tree decl)
h = (struct tree_priority_map *) *loc;
if (!h)
{
- h = GGC_CNEW (struct tree_priority_map);
+ h = ggc_alloc_cleared_tree_priority_map ();
*loc = h;
h->base.from = decl;
h->init = DEFAULT_INIT_PRIORITY;
@@ -5717,7 +5807,7 @@ decl_debug_expr_insert (tree from, tree to)
struct tree_decl_map *h;
void **loc;
- h = GGC_NEW (struct tree_decl_map);
+ h = ggc_alloc_tree_decl_map ();
h->base.from = from;
h->to = to;
loc = htab_find_slot_with_hash (debug_expr_for_decl, h, DECL_UID (from),
@@ -5748,7 +5838,7 @@ decl_value_expr_insert (tree from, tree to)
struct tree_decl_map *h;
void **loc;
- h = GGC_NEW (struct tree_decl_map);
+ h = ggc_alloc_tree_decl_map ();
h->base.from = from;
h->to = to;
loc = htab_find_slot_with_hash (value_expr_for_decl, h, DECL_UID (from),
@@ -5921,7 +6011,7 @@ type_hash_add (hashval_t hashcode, tree type)
struct type_hash *h;
void **loc;
- h = GGC_NEW (struct type_hash);
+ h = ggc_alloc_type_hash ();
h->hash = hashcode;
h->type = type;
loc = htab_find_slot_with_hash (type_hash_table, h, hashcode, INSERT);
@@ -6533,6 +6623,23 @@ commutative_tree_code (enum tree_code code)
return false;
}
+/* Return true if CODE represents a ternary tree code for which the
+ first two operands are commutative. Otherwise return false. */
+bool
+commutative_ternary_tree_code (enum tree_code code)
+{
+ switch (code)
+ {
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
+ return true;
+
+ default:
+ break;
+ }
+ return false;
+}
+
/* Generate a hash value for an expression. This can be used iteratively
by passing a previous result as the VAL argument.
@@ -7279,6 +7386,13 @@ build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip)
we expect first argument to be THIS pointer. */
if (bitmap_bit_p (args_to_skip, 0))
DECL_VINDEX (new_decl) = NULL_TREE;
+
+ /* When signature changes, we need to clear builtin info. */
+ if (DECL_BUILT_IN (new_decl) && !bitmap_empty_p (args_to_skip))
+ {
+ DECL_BUILT_IN_CLASS (new_decl) = NOT_BUILT_IN;
+ DECL_FUNCTION_CODE (new_decl) = (enum built_in_function) 0;
+ }
return new_decl;
}
@@ -9422,7 +9536,7 @@ build_omp_clause (location_t loc, enum omp_clause_code code)
length = omp_clause_num_ops[code];
size = (sizeof (struct tree_omp_clause) + (length - 1) * sizeof (tree));
- t = GGC_NEWVAR (union tree_node, size);
+ t = ggc_alloc_tree_node (size);
memset (t, 0, size);
TREE_SET_CODE (t, OMP_CLAUSE);
OMP_CLAUSE_SET_CODE (t, code);
@@ -9455,9 +9569,7 @@ build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL)
tree_node_sizes[(int) e_kind] += length;
#endif
- t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone);
-
- memset (t, 0, length);
+ t = ggc_alloc_zone_cleared_tree_node_stat (&tree_zone, length PASS_MEM_STAT);
TREE_SET_CODE (t, code);
@@ -10818,4 +10930,21 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
return binfo;
}
+/* Returns true if X is a typedef decl. */
+
+bool
+is_typedef_decl (tree x)
+{
+ return (x && TREE_CODE (x) == TYPE_DECL
+ && DECL_ORIGINAL_TYPE (x) != NULL_TREE);
+}
+
+/* Returns true iff TYPE is a type variant created for a typedef. */
+
+bool
+typedef_variant_p (tree type)
+{
+ return is_typedef_decl (TYPE_NAME (type));
+}
+
#include "gt-tree.h"
diff --git a/gcc/tree.def b/gcc/tree.def
index 1f6ad82fe0c..9a7b1ec8199 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -970,6 +970,16 @@ DEFTREECODE (REALIGN_LOAD_EXPR, "realign_load", tcc_expression, 3)
DEFTREECODE (TARGET_MEM_REF, "target_mem_ref", tcc_reference, 6)
+/* Memory addressing. Operands are a pointer and a tree constant integer
+ byte offset of the pointer type that when dereferenced yields the
+ type of the base object the pointer points into and which is used for
+ TBAA purposes.
+ The type of the MEM_REF is the type the bytes at the memory location
+ are interpreted as.
+ MEM_REF <p, c> is equivalent to ((typeof(c))p)->x... where x... is a
+ chain of component references offsetting p by c. */
+DEFTREECODE (MEM_REF, "mem_ref", tcc_reference, 2)
+
/* The ordering of the codes between OMP_PARALLEL and OMP_CRITICAL is
exposed to TREE_RANGE_CHECK. */
/* OpenMP - #pragma omp parallel [clause1 ... clauseN]
@@ -1080,6 +1090,18 @@ DEFTREECODE (WIDEN_SUM_EXPR, "widen_sum_expr", tcc_binary, 2)
the arguments from type t1 to type t2, and then multiplying them. */
DEFTREECODE (WIDEN_MULT_EXPR, "widen_mult_expr", tcc_binary, 2)
+/* Widening multiply-accumulate.
+ The first two arguments are of type t1.
+ The third argument and the result are of type t2, such as t2 is at least
+ twice the size of t1. t1 and t2 must be integral or fixed-point types.
+ The expression is equivalent to a WIDEN_MULT_EXPR operation
+ of the first two operands followed by an add or subtract of the third
+ operand. */
+DEFTREECODE (WIDEN_MULT_PLUS_EXPR, "widen_mult_plus_expr", tcc_expression, 3)
+/* This is like the above, except in the final expression the multiply result
+ is subtracted from t3. */
+DEFTREECODE (WIDEN_MULT_MINUS_EXPR, "widen_mult_plus_expr", tcc_expression, 3)
+
/* Whole vector left/right shift in bits.
Operand 0 is a vector to be shifted.
Operand 1 is an integer shift amount in bits. */
diff --git a/gcc/tree.h b/gcc/tree.h
index 13c684af37a..75b3dcfccf1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1887,11 +1887,8 @@ struct GTY(()) tree_exp {
#define SSA_NAME_PTR_INFO(N) \
SSA_NAME_CHECK (N)->ssa_name.ptr_info
-#ifndef _TREE_FLOW_H
+/* Defined in tree-flow.h. */
struct ptr_info_def;
-#endif
-
-
/* Immediate use linking structure. This structure is used for maintaining
a doubly linked list of uses of an SSA_NAME. */
@@ -2090,26 +2087,34 @@ extern enum machine_mode vector_type_mode (const_tree);
#define SET_TYPE_MODE(NODE, MODE) \
(TYPE_CHECK (NODE)->type.mode = (MODE))
-/* The "canonical" type for this type node, which can be used to
- compare the type for equality with another type. If two types are
+/* The "canonical" type for this type node, which is used by frontends to
+ compare the type for equality with another type. If two types are
equal (based on the semantics of the language), then they will have
equivalent TYPE_CANONICAL entries.
- As a special case, if TYPE_CANONICAL is NULL_TREE, then it cannot
- be used for comparison against other types. Instead, the type is
+ As a special case, if TYPE_CANONICAL is NULL_TREE, and thus
+ TYPE_STRUCTURAL_EQUALITY_P is true, then it cannot
+ be used for comparison against other types. Instead, the type is
said to require structural equality checks, described in
- TYPE_STRUCTURAL_EQUALITY_P. */
+ TYPE_STRUCTURAL_EQUALITY_P.
+
+ For unqualified aggregate and function types the middle-end relies on
+ TYPE_CANONICAL to tell whether two variables can be assigned
+ to each other without a conversion. The middle-end also makes sure
+ to assign the same alias-sets to the type partition with equal
+ TYPE_CANONICAL of their unqualified variants. */
#define TYPE_CANONICAL(NODE) (TYPE_CHECK (NODE)->type.canonical)
/* Indicates that the type node requires structural equality
- checks. The compiler will need to look at the composition of the
+ checks. The compiler will need to look at the composition of the
type to determine whether it is equal to another type, rather than
- just comparing canonical type pointers. For instance, we would need
+ just comparing canonical type pointers. For instance, we would need
to look at the return and parameter types of a FUNCTION_TYPE
- node. */
+ node. */
#define TYPE_STRUCTURAL_EQUALITY_P(NODE) (TYPE_CANONICAL (NODE) == NULL_TREE)
/* Sets the TYPE_CANONICAL field to NULL_TREE, indicating that the
- type node requires structural equality. */
+ type node requires structural equality. */
#define SET_TYPE_STRUCTURAL_EQUALITY(NODE) (TYPE_CANONICAL (NODE) = NULL_TREE)
+
#define TYPE_LANG_SPECIFIC(NODE) (TYPE_CHECK (NODE)->type.lang_specific)
#define TYPE_IBIT(NODE) (GET_MODE_IBIT (TYPE_MODE (NODE)))
#define TYPE_FBIT(NODE) (GET_MODE_FBIT (TYPE_MODE (NODE)))
@@ -3458,7 +3463,7 @@ extern tree build_target_option_node (void);
for various types of node. */
union GTY ((ptr_alias (union lang_tree_node),
- desc ("tree_node_structure (&%h)"))) tree_node {
+ desc ("tree_node_structure (&%h)"), variable_size)) tree_node {
struct tree_base GTY ((tag ("TS_BASE"))) base;
struct tree_common GTY ((tag ("TS_COMMON"))) common;
struct tree_int_cst GTY ((tag ("TS_INT_CST"))) int_cst;
@@ -4006,6 +4011,7 @@ tree_to_double_int (const_tree cst)
extern tree double_int_to_tree (tree, double_int);
extern bool double_int_fits_to_tree_p (const_tree, double_int);
+extern tree force_fit_type_double (tree, double_int, int, bool);
/* Create an INT_CST node with a CST value zero extended. */
@@ -4086,6 +4092,7 @@ extern bool range_in_array_bounds_p (tree);
extern tree value_member (tree, tree);
extern tree purpose_member (const_tree, tree);
+extern bool vec_member (const_tree, VEC(tree,gc) *);
extern tree chain_index (int, tree);
extern int attribute_list_equal (const_tree, const_tree);
@@ -4325,7 +4332,7 @@ typedef struct record_layout_info_s
tree prev_field;
/* The static variables (i.e., class variables, as opposed to
instance variables) encountered in T. */
- tree pending_statics;
+ VEC(tree,gc) *pending_statics;
/* Bits remaining in the current alignment group */
int remaining_in_alignment;
/* True if we've seen a packed field that didn't have normal
@@ -4811,6 +4818,7 @@ extern tree get_callee_fndecl (const_tree);
extern int type_num_arguments (const_tree);
extern bool associative_tree_code (enum tree_code);
extern bool commutative_tree_code (enum tree_code);
+extern bool commutative_ternary_tree_code (enum tree_code);
extern tree upper_bound_in_type (tree, tree);
extern tree lower_bound_in_type (tree, tree);
extern int operand_equal_for_phi_arg_p (const_tree, const_tree);
@@ -4820,6 +4828,8 @@ extern tree create_artificial_label (location_t);
extern const char *get_name (tree);
extern bool stdarg_p (tree);
extern bool prototype_p (tree);
+extern bool is_typedef_decl (tree x);
+extern bool typedef_variant_p (tree);
extern bool auto_var_in_fn_p (const_tree, const_tree);
extern tree build_low_bits_mask (tree, unsigned);
extern tree tree_strip_nop_conversions (tree);
@@ -4953,6 +4963,10 @@ extern tree build_fold_indirect_ref_loc (location_t, tree);
#define fold_indirect_ref(T)\
fold_indirect_ref_loc (UNKNOWN_LOCATION, T)
extern tree fold_indirect_ref_loc (location_t, tree);
+extern tree build_simple_mem_ref_loc (location_t, tree);
+#define build_simple_mem_ref(T)\
+ build_simple_mem_ref_loc (UNKNOWN_LOCATION, T)
+extern double_int mem_ref_offset (const_tree);
extern tree constant_boolean_node (int, tree);
extern tree div_if_zero_remainder (enum tree_code, const_tree, const_tree);
@@ -5007,9 +5021,8 @@ extern bool fold_builtin_next_arg (tree, bool);
extern enum built_in_function builtin_mathfn_code (const_tree);
extern tree build_function_call_expr (location_t, tree, tree);
extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *);
-#define build_call_expr(...)\
- build_call_expr_loc (UNKNOWN_LOCATION, __VA_ARGS__)
extern tree build_call_expr_loc (location_t, tree, int, ...);
+extern tree build_call_expr (tree, int, ...);
extern tree mathfn_built_in (tree, enum built_in_function fn);
extern tree c_strlen (tree, int);
extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
@@ -5559,4 +5572,7 @@ is_lang_specific (tree t)
return TREE_CODE (t) == LANG_TYPE || TREE_CODE (t) >= NUM_TREE_CODES;
}
+/* In gimple-low.c. */
+extern bool block_may_fallthru (const_tree);
+
#endif /* GCC_TREE_H */
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 967661274ce..a90ca3884d9 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -798,8 +798,9 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data)
switch (GET_CODE (loc))
{
case REG:
- /* Don't do any sp or fp replacements outside of MEM addresses. */
- if (amd->mem_mode == VOIDmode)
+ /* Don't do any sp or fp replacements outside of MEM addresses
+ on the LHS. */
+ if (amd->mem_mode == VOIDmode && amd->store)
return loc;
if (loc == stack_pointer_rtx
&& !frame_pointer_needed)
@@ -1167,7 +1168,7 @@ variable_htab_free (void *elem)
variable var = (variable) elem;
location_chain node, next;
- gcc_assert (var->refcount > 0);
+ gcc_checking_assert (var->refcount > 0);
var->refcount--;
if (var->refcount > 0)
@@ -1370,7 +1371,7 @@ shared_hash_copy (shared_hash vars)
static void
shared_hash_destroy (shared_hash vars)
{
- gcc_assert (vars->refcount > 0);
+ gcc_checking_assert (vars->refcount > 0);
if (--vars->refcount == 0)
{
htab_delete (vars->htab);
@@ -2479,7 +2480,8 @@ dv_changed_p (decl_or_value dv)
/* Return a location list node whose loc is rtx_equal to LOC, in the
location list of a one-part variable or value VAR, or in that of
- any values recursively mentioned in the location lists. */
+ any values recursively mentioned in the location lists. VARS must
+ be in star-canonical form. */
static location_chain
find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
@@ -2499,11 +2501,15 @@ find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
#ifdef ENABLE_CHECKING
gcc_assert (var->var_part[0].offset == 0);
+ gcc_assert (loc != dv_as_opaque (var->dv));
#endif
loc_code = GET_CODE (loc);
for (node = var->var_part[0].loc_chain; node; node = node->next)
{
+ decl_or_value dv;
+ variable rvar;
+
if (GET_CODE (node->loc) != loc_code)
{
if (GET_CODE (node->loc) != VALUE)
@@ -2517,24 +2523,35 @@ find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
return node;
continue;
}
- if (!VALUE_RECURSED_INTO (node->loc))
- {
- decl_or_value dv = dv_from_value (node->loc);
- variable var = (variable)
- htab_find_with_hash (vars, dv, dv_htab_hash (dv));
- if (var)
+ /* Since we're in star-canonical form, we don't need to visit
+ non-canonical nodes: one-part variables and non-canonical
+ values would only point back to the canonical node. */
+ if (dv_is_value_p (var->dv)
+ && !canon_value_cmp (node->loc, dv_as_value (var->dv)))
+ {
+ /* Skip all subsequent VALUEs. */
+ while (node->next && GET_CODE (node->next->loc) == VALUE)
{
- location_chain where;
- VALUE_RECURSED_INTO (node->loc) = true;
- if ((where = find_loc_in_1pdv (loc, var, vars)))
- {
- VALUE_RECURSED_INTO (node->loc) = false;
- return where;
- }
- VALUE_RECURSED_INTO (node->loc) = false;
+ node = node->next;
+#ifdef ENABLE_CHECKING
+ gcc_assert (!canon_value_cmp (node->loc,
+ dv_as_value (var->dv)));
+#endif
+ if (loc == node->loc)
+ return node;
}
+ continue;
}
+
+#ifdef ENABLE_CHECKING
+ gcc_assert (node == var->var_part[0].loc_chain);
+ gcc_assert (!node->next);
+#endif
+
+ dv = dv_from_value (node->loc);
+ rvar = (variable) htab_find_with_hash (vars, dv, dv_htab_hash (dv));
+ return find_loc_in_1pdv (loc, rvar, vars);
}
return NULL;
@@ -3050,7 +3067,7 @@ canonicalize_values_mark (void **slot, void *data)
if (!dv_is_value_p (dv))
return 1;
- gcc_assert (var->n_var_parts == 1);
+ gcc_checking_assert (var->n_var_parts == 1);
val = dv_as_value (dv);
@@ -3093,7 +3110,7 @@ canonicalize_values_star (void **slot, void *data)
if (!dv_onepart_p (dv))
return 1;
- gcc_assert (var->n_var_parts == 1);
+ gcc_checking_assert (var->n_var_parts == 1);
if (dv_is_value_p (dv))
{
@@ -3283,8 +3300,8 @@ canonicalize_values_star (void **slot, void *data)
/* Variable may have been unshared. */
var = (variable)*slot;
- gcc_assert (var->n_var_parts && var->var_part[0].loc_chain->loc == cval
- && var->var_part[0].loc_chain->next == NULL);
+ gcc_checking_assert (var->n_var_parts && var->var_part[0].loc_chain->loc == cval
+ && var->var_part[0].loc_chain->next == NULL);
if (VALUE_RECURSED_INTO (cval))
goto restart_with_cval;
@@ -3373,14 +3390,14 @@ variable_merge_over_cur (variable s1var, struct dfset_merge *dsm)
/* If the incoming onepart variable has an empty location list, then
the intersection will be just as empty. For other variables,
it's always union. */
- gcc_assert (s1var->n_var_parts
- && s1var->var_part[0].loc_chain);
+ gcc_checking_assert (s1var->n_var_parts
+ && s1var->var_part[0].loc_chain);
if (!onepart)
return variable_union (s1var, dst);
- gcc_assert (s1var->n_var_parts == 1
- && s1var->var_part[0].offset == 0);
+ gcc_checking_assert (s1var->n_var_parts == 1
+ && s1var->var_part[0].offset == 0);
dvhash = dv_htab_hash (dv);
if (dv_is_value_p (dv))
@@ -3694,6 +3711,11 @@ dataflow_set_equiv_regs (dataflow_set *set)
{
rtx canon[NUM_MACHINE_MODES];
+ /* If the list is empty or one entry, no need to canonicalize
+ anything. */
+ if (set->regs[i] == NULL || set->regs[i]->next == NULL)
+ continue;
+
memset (canon, 0, sizeof (canon));
for (list = set->regs[i]; list; list = list->next)
@@ -3966,6 +3988,12 @@ variable_post_merge_perm_vals (void **pslot, void *info)
var = shared_hash_find (set->vars, dv);
if (var)
{
+ /* Although variable_post_merge_new_vals may have made decls
+ non-star-canonical, values that pre-existed in canonical form
+ remain canonical, and newly-created values reference a single
+ REG, so they are canonical as well. Since VAR has the
+ location list for a VALUE, using find_loc_in_1pdv for it is
+ fine, since VALUEs don't map back to DECLs. */
if (find_loc_in_1pdv (pnode->loc, var, shared_hash_htab (set->vars)))
return 1;
val_reset (set, dv);
@@ -5166,7 +5194,9 @@ reverse_op (rtx val, const_rtx expr)
return NULL_RTX;
}
- if (!REG_P (XEXP (src, 0)) || !SCALAR_INT_MODE_P (GET_MODE (src)))
+ if (!REG_P (XEXP (src, 0))
+ || !SCALAR_INT_MODE_P (GET_MODE (src))
+ || XEXP (src, 0) == cfa_base_rtx)
return NULL_RTX;
v = cselib_lookup (XEXP (src, 0), GET_MODE (XEXP (src, 0)), 0);
@@ -8136,7 +8166,7 @@ vt_init_cfa_base (void)
val = cselib_lookup_from_insn (cfa_base_rtx, GET_MODE (cfa_base_rtx), 1,
get_insns ());
preserve_value (val);
- cselib_preserve_cfa_base_value (val);
+ cselib_preserve_cfa_base_value (val, REGNO (cfa_base_rtx));
var_reg_decl_set (&VTI (ENTRY_BLOCK_PTR)->out, cfa_base_rtx,
VAR_INIT_STATUS_INITIALIZED, dv_from_value (val->val_rtx),
0, NULL_RTX, INSERT);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 3f8fd02aa8f..f9a9d976b54 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -378,7 +378,7 @@ emutls_decl (tree decl)
VAR_DECL, get_emutls_object_name (name),
get_emutls_object_type ());
- h = GGC_NEW (struct tree_map);
+ h = ggc_alloc_tree_map ();
h->hash = in.hash;
h->base.from = decl;
h->to = to;
@@ -553,7 +553,7 @@ get_unnamed_section (unsigned int flags, void (*callback) (const void *),
{
section *sect;
- sect = GGC_NEW (section);
+ sect = ggc_alloc_section ();
sect->unnamed.common.flags = flags | SECTION_UNNAMED;
sect->unnamed.callback = callback;
sect->unnamed.data = data;
@@ -570,7 +570,7 @@ get_noswitch_section (unsigned int flags, noswitch_section_callback callback)
{
section *sect;
- sect = GGC_NEW (section);
+ sect = ggc_alloc_section ();
sect->noswitch.common.flags = flags | SECTION_NOSWITCH;
sect->noswitch.callback = callback;
@@ -591,7 +591,7 @@ get_section (const char *name, unsigned int flags, tree decl)
flags |= SECTION_NAMED;
if (*slot == NULL)
{
- sect = GGC_NEW (section);
+ sect = ggc_alloc_section ();
sect->named.common.flags = flags;
sect->named.name = ggc_strdup (name);
sect->named.decl = decl;
@@ -640,8 +640,7 @@ get_block_for_section (section *sect)
block = (struct object_block *) *slot;
if (block == NULL)
{
- block = (struct object_block *)
- ggc_alloc_cleared (sizeof (struct object_block));
+ block = ggc_alloc_cleared_object_block ();
block->sect = sect;
*slot = block;
}
@@ -661,7 +660,7 @@ create_block_symbol (const char *label, struct object_block *block,
/* Create the extended SYMBOL_REF. */
size = RTX_HDR_SIZE + sizeof (struct block_symbol);
- symbol = (rtx) ggc_alloc_zone (size, &rtl_zone);
+ symbol = ggc_alloc_zone_rtx_def (size, &rtl_zone);
/* Initialize the normal SYMBOL_REF fields. */
memset (symbol, 0, size);
@@ -2462,9 +2461,9 @@ assemble_external_libcall (rtx fun)
/* Assemble a label named NAME. */
void
-assemble_label (const char *name)
+assemble_label (FILE *file, const char *name)
{
- ASM_OUTPUT_LABEL (asm_out_file, name);
+ ASM_OUTPUT_LABEL (file, name);
}
/* Set the symbol_referenced flag for ID. */
@@ -3324,7 +3323,7 @@ build_constant_desc (tree exp)
int labelno;
tree decl;
- desc = GGC_NEW (struct constant_descriptor_tree);
+ desc = ggc_alloc_constant_descriptor_tree ();
desc->value = copy_constant (exp);
/* Propagate marked-ness to copied constant. */
@@ -3476,12 +3475,7 @@ assemble_constant_contents (tree exp, const char *label, unsigned int align)
size = get_constant_size (exp);
/* Do any machine/system dependent processing of the constant. */
-#ifdef ASM_DECLARE_CONSTANT_NAME
- ASM_DECLARE_CONSTANT_NAME (asm_out_file, label, exp, size);
-#else
- /* Standard thing is just output label for the constant. */
- ASM_OUTPUT_LABEL (asm_out_file, label);
-#endif /* ASM_DECLARE_CONSTANT_NAME */
+ targetm.asm_out.declare_constant_name (asm_out_file, label, exp, size);
/* Output the value of EXP. */
output_constant (exp, size, align);
@@ -3724,7 +3718,7 @@ create_constant_pool (void)
{
struct rtx_constant_pool *pool;
- pool = GGC_NEW (struct rtx_constant_pool);
+ pool = ggc_alloc_rtx_constant_pool ();
pool->const_rtx_htab = htab_create_ggc (31, const_desc_rtx_hash,
const_desc_rtx_eq, NULL);
pool->first = NULL;
@@ -3790,7 +3784,7 @@ force_const_mem (enum machine_mode mode, rtx x)
return copy_rtx (desc->mem);
/* Otherwise, create a new descriptor. */
- desc = GGC_NEW (struct constant_descriptor_rtx);
+ desc = ggc_alloc_constant_descriptor_rtx ();
*slot = desc;
/* Align the location counter as required by EXP's data type. */
@@ -5985,7 +5979,7 @@ maybe_assemble_visibility (tree decl)
if (vis != VISIBILITY_DEFAULT)
{
- targetm.asm_out.visibility (decl, vis);
+ targetm.asm_out.assemble_visibility (decl, vis);
return 1;
}
else
@@ -6895,16 +6889,27 @@ default_internal_label (FILE *stream, const char *prefix,
ASM_OUTPUT_INTERNAL_LABEL (stream, buf);
}
+
+/* The default implementation of ASM_DECLARE_CONSTANT_NAME. */
+
+void
+default_asm_declare_constant_name (FILE *file, const char *name,
+ const_tree exp ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT size ATTRIBUTE_UNUSED)
+{
+ assemble_label (file, name);
+}
+
/* This is the default behavior at the beginning of a file. It's
controlled by two other target-hook toggles. */
void
default_file_start (void)
{
- if (targetm.file_start_app_off
+ if (targetm.asm_file_start_app_off
&& !(flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm))
fputs (ASM_APP_OFF, asm_out_file);
- if (targetm.file_start_file_directive)
+ if (targetm.asm_file_start_file_directive)
output_file_directive (asm_out_file, main_input_filename);
}
@@ -7194,50 +7199,11 @@ output_object_blocks (void)
int
elf_record_gcc_switches (print_switch_type type, const char * name)
{
- static char buffer[1024];
-
- /* This variable is used as part of a simplistic heuristic to detect
- command line switches which take an argument:
-
- "If a command line option does not start with a dash then
- it is an argument for the previous command line option."
-
- This fails in the case of the command line option which is the name
- of the file to compile, but otherwise it is pretty reasonable. */
- static bool previous_name_held_back = FALSE;
-
switch (type)
{
case SWITCH_TYPE_PASSED:
- if (* name != '-')
- {
- if (previous_name_held_back)
- {
- unsigned int len = strlen (buffer);
-
- snprintf (buffer + len, sizeof buffer - len, " %s", name);
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- previous_name_held_back = FALSE;
- }
- else
- {
- strncpy (buffer, name, sizeof buffer);
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- }
- }
- else
- {
- if (previous_name_held_back)
- {
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- }
-
- strncpy (buffer, name, sizeof buffer);
- previous_name_held_back = TRUE;
- }
+ ASM_OUTPUT_ASCII (asm_out_file, name, strlen (name));
+ ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
break;
case SWITCH_TYPE_DESCRIPTIVE:
@@ -7246,15 +7212,7 @@ elf_record_gcc_switches (print_switch_type type, const char * name)
/* Distinguish between invocations where name is NULL. */
static bool started = false;
- if (started)
- {
- if (previous_name_held_back)
- {
- ASM_OUTPUT_ASCII (asm_out_file, buffer, strlen (buffer));
- ASM_OUTPUT_SKIP (asm_out_file, (unsigned HOST_WIDE_INT) 1);
- }
- }
- else
+ if (!started)
{
section * sec;
diff --git a/gcc/varpool.c b/gcc/varpool.c
index a3be2629ce1..94c949e3550 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -139,7 +139,7 @@ varpool_node (tree decl)
htab_find_slot (varpool_hash, &key, INSERT);
if (*slot)
return *slot;
- node = GGC_CNEW (struct varpool_node);
+ node = ggc_alloc_cleared_varpool_node ();
node->decl = decl;
node->order = cgraph_order++;
node->next = varpool_nodes;
@@ -651,7 +651,7 @@ varpool_extra_name_alias (tree alias, tree decl)
if (*slot)
return false;
- alias_node = GGC_CNEW (struct varpool_node);
+ alias_node = ggc_alloc_cleared_varpool_node ();
alias_node->decl = alias;
alias_node->alias = 1;
alias_node->extra_name = decl_node;
diff --git a/gcc/vec.h b/gcc/vec.h
index c32bf8829e3..93a432df839 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -436,7 +436,8 @@ extern void dump_vec_loc_statistics (void);
#ifdef GATHER_STATISTICS
void vec_heap_free (void *);
#else
-#define vec_heap_free(V) free (V)
+/* Avoid problems with frontends that #define free(x). */
+#define vec_heap_free(V) (free) (V)
#endif
#if ENABLE_CHECKING
diff --git a/gcc/vmsdbg.h b/gcc/vmsdbg.h
index b2039e41fe3..18fb58597d5 100644
--- a/gcc/vmsdbg.h
+++ b/gcc/vmsdbg.h
@@ -1,5 +1,5 @@
/* Definitions for the data structures and codes used in VMS debugging.
- Copyright (C) 2001, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2007, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -28,7 +28,8 @@ along with GCC; see the file COPYING3. If not see
size of the struct. */
/* Header type codes. */
-typedef enum _DST_TYPE {DST_K_SOURCE = 155, DST_K_PROLOG = 162,
+typedef enum _DST_TYPE {DST_K_TBG = 0x17,
+ DST_K_SOURCE = 155, DST_K_PROLOG = 162,
DST_K_BLKBEG = 176, DST_K_BLKEND = 177,
DST_K_LINE_NUM = 185, DST_K_MODBEG = 188,
DST_K_MODEND = 189, DST_K_RTNBEG = 190,
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index 44e4dc8cb90..129ee78cdd3 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -1,6 +1,6 @@
/* Output VMS debug format symbol table information from GCC.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Douglas B. Rupp (rupp@gnat.com).
Updated by Bernard W. Giroud (bgiroud@users.sourceforge.net).
@@ -106,25 +106,13 @@ static unsigned int file_info_table_in_use;
table. */
#define FILE_TABLE_INCREMENT 64
-/* A structure to hold basic information for the VMS end
- routine. */
+typedef char *char_p;
+DEF_VEC_P(char_p);
+DEF_VEC_ALLOC_P(char_p,heap);
-typedef struct vms_func_struct
-{
- const char *vms_func_name;
- unsigned funcdef_number;
-}
-vms_func_node;
-
-typedef struct vms_func_struct *vms_func_ref;
-
-static unsigned int func_table_allocated;
-static unsigned int func_table_in_use;
-#define FUNC_TABLE_INCREMENT 256
-
-/* A pointer to the base of a table that contains frame description
- information for each routine. */
-static vms_func_ref func_table;
+static VEC(char_p,heap) *funcnam_table;
+static VEC(unsigned,heap) *funcnum_table;
+#define FUNC_TABLE_INITIAL 256
/* Local pointer to the name of the main input file. Initialized in
vmsdbgout_init. */
@@ -149,7 +137,6 @@ static unsigned int line_info_table_in_use;
/* Forward declarations for functions defined in this file. */
static char *full_name (const char *);
static unsigned int lookup_filename (const char *);
-static void addr_const_to_string (char *, rtx);
static int write_debug_header (DST_HEADER *, const char *, int);
static int write_debug_addr (const char *, const char *, int);
static int write_debug_data1 (unsigned int, const char *, int);
@@ -180,10 +167,12 @@ static void vmsdbgout_source_line (unsigned int, const char *, int, bool);
static void vmsdbgout_begin_prologue (unsigned int, const char *);
static void vmsdbgout_end_prologue (unsigned int, const char *);
static void vmsdbgout_end_function (unsigned int);
+static void vmsdbgout_begin_epilogue (unsigned int, const char *);
static void vmsdbgout_end_epilogue (unsigned int, const char *);
static void vmsdbgout_begin_function (tree);
static void vmsdbgout_decl (tree);
static void vmsdbgout_global_decl (tree);
+static void vmsdbgout_type_decl (tree, int);
static void vmsdbgout_abstract_function (tree);
/* The debug hooks structure. */
@@ -202,12 +191,13 @@ const struct gcc_debug_hooks vmsdbg_debug_hooks
vmsdbgout_source_line,
vmsdbgout_begin_prologue,
vmsdbgout_end_prologue,
+ vmsdbgout_begin_epilogue,
vmsdbgout_end_epilogue,
vmsdbgout_begin_function,
vmsdbgout_end_function,
vmsdbgout_decl,
vmsdbgout_global_decl,
- debug_nothing_tree_int, /* type_decl */
+ vmsdbgout_type_decl, /* type_decl */
debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */
debug_nothing_tree, /* deferred_inline_function */
vmsdbgout_abstract_function,
@@ -285,6 +275,9 @@ static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
#ifndef FUNC_PROLOG_LABEL
#define FUNC_PROLOG_LABEL "LVFP"
#endif
+#ifndef FUNC_EPILOG_LABEL
+#define FUNC_EPILOG_LABEL "LVEB"
+#endif
#ifndef FUNC_END_LABEL
#define FUNC_END_LABEL "LVFE"
#endif
@@ -424,136 +417,6 @@ static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
#endif
-/* General utility functions. */
-
-/* Convert an integer constant expression into assembler syntax. Addition and
- subtraction are the only arithmetic that may appear in these expressions.
- This is an adaptation of output_addr_const in final.c. Here, the target
- of the conversion is a string buffer. We can't use output_addr_const
- directly, because it writes to a file. */
-
-static void
-addr_const_to_string (char *str, rtx x)
-{
- char buf1[256];
- char buf2[256];
-
- restart:
- str[0] = '\0';
- switch (GET_CODE (x))
- {
- case PC:
- gcc_assert (flag_pic);
- strcat (str, ",");
- break;
-
- case SYMBOL_REF:
- ASM_NAME_TO_STRING (buf1, XSTR (x, 0));
- strcat (str, buf1);
- break;
-
- case LABEL_REF:
- ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
- ASM_NAME_TO_STRING (buf2, buf1);
- strcat (str, buf2);
- break;
-
- case CODE_LABEL:
- ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (x));
- ASM_NAME_TO_STRING (buf2, buf1);
- strcat (str, buf2);
- break;
-
- case CONST_INT:
- sprintf (buf1, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
- strcat (str, buf1);
- break;
-
- case CONST:
- /* This used to output parentheses around the expression, but that does
- not work on the 386 (either ATT or BSD assembler). */
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- break;
-
- case CONST_DOUBLE:
- if (GET_MODE (x) == VOIDmode)
- {
- /* We can use %d if the number is one word and positive. */
- if (CONST_DOUBLE_HIGH (x))
- sprintf (buf1, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
- else if (CONST_DOUBLE_LOW (x) < 0)
- sprintf (buf1, HOST_WIDE_INT_PRINT_HEX, CONST_DOUBLE_LOW (x));
- else
- sprintf (buf1, HOST_WIDE_INT_PRINT_DEC,
- CONST_DOUBLE_LOW (x));
- strcat (str, buf1);
- }
- else
- /* We can't handle floating point constants; PRINT_OPERAND must
- handle them. */
- output_operand_lossage ("floating constant misused");
- break;
-
- case PLUS:
- /* Some assemblers need integer constants to appear last (eg masm). */
- if (CONST_INT_P (XEXP (x, 0)))
- {
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- if (INTVAL (XEXP (x, 0)) >= 0)
- strcat (str, "+");
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- }
- else
- {
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- if (INTVAL (XEXP (x, 1)) >= 0)
- strcat (str, "+");
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- }
- break;
-
- case MINUS:
- /* Avoid outputting things like x-x or x+5-x, since some assemblers
- can't handle that. */
- x = simplify_subtraction (x);
- if (GET_CODE (x) != MINUS)
- goto restart;
-
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- strcat (str, "-");
- if (CONST_INT_P (XEXP (x, 1))
- && INTVAL (XEXP (x, 1)) < 0)
- {
- strcat (str, "(");
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- strcat (str, ")");
- }
- else
- {
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- }
- break;
-
- case ZERO_EXTEND:
- case SIGN_EXTEND:
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- break;
-
- default:
- output_operand_lossage ("invalid expression as operand");
- }
-}
-
/* Output the debug header HEADER. Also output COMMENT if flag_verbose_asm is
set. Return the header size. Just return the size if DOSIZEONLY is
nonzero. */
@@ -743,7 +606,7 @@ write_modbeg (int dosizeonly)
modbeg.dst_b_modbeg_flags.dst_v_modbeg_version = 1;
modbeg.dst_b_modbeg_flags.dst_v_modbeg_unused = 0;
modbeg.dst_b_modbeg_unused = 0;
- modbeg.dst_l_modbeg_language = module_language;
+ modbeg.dst_l_modbeg_language = (DST_LANGUAGE) module_language;
modbeg.dst_w_version_major = DST_K_VERSION_MAJOR;
modbeg.dst_w_version_minor = DST_K_VERSION_MINOR;
modbeg.dst_b_modbeg_name = strlen (module_name);
@@ -804,9 +667,8 @@ write_rtnbeg (int rtnnum, int dosizeonly)
char label[MAX_ARTIFICIAL_LABEL_BYTES];
DST_ROUTINE_BEGIN rtnbeg;
DST_PROLOG prolog;
- vms_func_ref fde = &func_table[rtnnum];
- rtnname = fde->vms_func_name;
+ rtnname = VEC_index (char_p, funcnam_table, rtnnum);
rtnnamelen = strlen (rtnname);
rtnentryname = concat (rtnname, "..en", NULL);
@@ -822,7 +684,7 @@ write_rtnbeg (int rtnnum, int dosizeonly)
+ string count byte + string length */
header.dst__header_length.dst_w_length
= DST_K_DST_HEADER_SIZE - 1 + 1 + 4 + 1 + strlen (go);
- header.dst__header_type.dst_w_type = 0x17;
+ header.dst__header_type.dst_w_type = DST_K_TBG;
totsize += write_debug_header (&header, "transfer", dosizeonly);
@@ -877,7 +739,9 @@ write_rtnbeg (int rtnnum, int dosizeonly)
totsize += write_debug_header (&prolog.dst_a_prolog_header, "prolog",
dosizeonly);
- ASM_GENERATE_INTERNAL_LABEL (label, FUNC_PROLOG_LABEL, fde->funcdef_number);
+ ASM_GENERATE_INTERNAL_LABEL
+ (label, FUNC_PROLOG_LABEL,
+ VEC_index (unsigned, funcnum_table, rtnnum));
totsize += write_debug_addr (label, "prolog breakpoint addr",
dosizeonly);
}
@@ -895,8 +759,6 @@ write_rtnend (int rtnnum, int dosizeonly)
char label1[MAX_ARTIFICIAL_LABEL_BYTES];
char label2[MAX_ARTIFICIAL_LABEL_BYTES];
int totsize;
- vms_func_ref fde = &func_table[rtnnum];
- int corrected_rtnnum = fde->funcdef_number;
totsize = 0;
@@ -911,8 +773,12 @@ write_rtnend (int rtnnum, int dosizeonly)
totsize += write_debug_data1 (rtnend.dst_b_rtnend_unused, "unused",
dosizeonly);
- ASM_GENERATE_INTERNAL_LABEL (label1, FUNC_BEGIN_LABEL, corrected_rtnnum);
- ASM_GENERATE_INTERNAL_LABEL (label2, FUNC_END_LABEL, corrected_rtnnum);
+ ASM_GENERATE_INTERNAL_LABEL
+ (label1, FUNC_BEGIN_LABEL,
+ VEC_index (unsigned, funcnum_table, rtnnum));
+ ASM_GENERATE_INTERNAL_LABEL
+ (label2, FUNC_END_LABEL,
+ VEC_index (unsigned, funcnum_table, rtnnum));
totsize += write_debug_delta4 (label2, label1, "routine size", dosizeonly);
return totsize;
@@ -1318,6 +1184,38 @@ vmsdbgout_end_function (unsigned int line)
(*dwarf2_debug_hooks.end_function) (line);
}
+/* Output a marker (i.e. a label) for the beginning of the epilogue.
+ This gets called *before* the epilogue code has been generated. */
+
+static void
+vmsdbgout_begin_epilogue (unsigned int line, const char *file)
+{
+ char label[MAX_ARTIFICIAL_LABEL_BYTES];
+ static int save_current_function_funcdef_no = -1;
+
+ if (write_symbols == VMS_AND_DWARF2_DEBUG)
+ (*dwarf2_debug_hooks.begin_epilogue) (line, file);
+
+ if (debug_info_level > DINFO_LEVEL_NONE)
+ {
+ if (save_current_function_funcdef_no != current_function_funcdef_no)
+ {
+ /* Output a label to mark the endpoint of the code generated for this
+ function. */
+ ASM_GENERATE_INTERNAL_LABEL (label, FUNC_EPILOG_LABEL,
+ current_function_funcdef_no);
+
+ ASM_OUTPUT_LABEL (asm_out_file, label);
+
+ save_current_function_funcdef_no = current_function_funcdef_no;
+
+ /* VMS PCA expects every PC range to correlate to some line and
+ file. */
+ vmsdbgout_source_line (line, file, 0, true);
+ }
+ }
+}
+
/* Output a marker (i.e. a label) for the absolute end of the generated code
for a function definition. This gets called *after* the epilogue code has
been generated. */
@@ -1382,30 +1280,20 @@ vmsdbgout_ignore_block (const_tree block)
return retval;
}
-/* Add an entry for function DECL into the func_table. */
+/* Add an entry for function DECL into the funcnam_table. */
static void
vmsdbgout_begin_function (tree decl)
{
const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
- vms_func_ref fde;
if (write_symbols == VMS_AND_DWARF2_DEBUG)
(*dwarf2_debug_hooks.begin_function) (decl);
- if (func_table_in_use == func_table_allocated)
- {
- func_table_allocated += FUNC_TABLE_INCREMENT;
- func_table
- = (vms_func_ref) xrealloc (func_table,
- func_table_allocated * sizeof (vms_func_node));
- }
-
/* Add the new entry to the end of the function name table. */
- fde = &func_table[func_table_in_use++];
- fde->vms_func_name = xstrdup (name);
- fde->funcdef_number = current_function_funcdef_no;
-
+ VEC_safe_push (char_p, heap, funcnam_table, xstrdup (name));
+ VEC_safe_push (unsigned, heap, funcnum_table,
+ current_function_funcdef_no);
}
static char fullname_buff [4096];
@@ -1422,13 +1310,9 @@ full_name (const char *filename)
fgetname (fp, fullname_buff, 1);
fclose (fp);
#else
- getcwd (fullname_buff, sizeof (fullname_buff));
-
- strcat (fullname_buff, "/");
- strcat (fullname_buff, filename);
-
- /* ??? Insert hairy code here to translate Unix style file specification
- to VMS style. */
+ /* Unix paths really mess up VMS debug. Better to just output the
+ base filename. */
+ strcpy (fullname_buff, filename);
#endif
return fullname_buff;
@@ -1585,13 +1469,11 @@ vmsdbgout_init (const char *main_input_filename)
/* Allocate the initial hunk of the file_info_table. */
file_info_table = XCNEWVEC (dst_file_info_entry, FILE_TABLE_INCREMENT);
file_info_table_allocated = FILE_TABLE_INCREMENT;
-
- /* Skip the first entry - file numbers begin at 1 */
+ /* Skip the first entry - file numbers begin at 1. */
file_info_table_in_use = 1;
- func_table = (vms_func_ref) xcalloc (FUNC_TABLE_INCREMENT, sizeof (vms_func_node));
- func_table_allocated = FUNC_TABLE_INCREMENT;
- func_table_in_use = 1;
+ funcnam_table = VEC_alloc (char_p, heap, FUNC_TABLE_INITIAL);
+ funcnum_table = VEC_alloc (unsigned, heap, FUNC_TABLE_INITIAL);
/* Allocate the initial hunk of the line_info_table. */
line_info_table = XCNEWVEC (dst_line_info_entry, LINE_INFO_TABLE_INCREMENT);
@@ -1666,6 +1548,15 @@ vmsdbgout_global_decl (tree decl)
/* Not implemented in VMS Debug. */
static void
+vmsdbgout_type_decl (tree decl, int local)
+{
+ if (write_symbols == VMS_AND_DWARF2_DEBUG)
+ (*dwarf2_debug_hooks.type_decl) (decl, local);
+}
+
+/* Not implemented in VMS Debug. */
+
+static void
vmsdbgout_abstract_function (tree decl)
{
if (write_symbols == VMS_AND_DWARF2_DEBUG)
@@ -1678,7 +1569,7 @@ vmsdbgout_abstract_function (tree decl)
static void
vmsdbgout_finish (const char *main_input_filename ATTRIBUTE_UNUSED)
{
- unsigned int i;
+ unsigned int i, ifunc;
int totsize;
if (write_symbols == VMS_AND_DWARF2_DEBUG)
@@ -1698,7 +1589,7 @@ vmsdbgout_finish (const char *main_input_filename ATTRIBUTE_UNUSED)
ASM_OUTPUT_ALIGN (asm_out_file, 0);
totsize = write_modbeg (1);
- for (i = 1; i < func_table_in_use; i++)
+ for (i = 0; VEC_iterate (unsigned, funcnum_table, i, ifunc); i++)
{
totsize += write_rtnbeg (i, 1);
totsize += write_rtnend (i, 1);
@@ -1706,7 +1597,7 @@ vmsdbgout_finish (const char *main_input_filename ATTRIBUTE_UNUSED)
totsize += write_pclines (1);
write_modbeg (0);
- for (i = 1; i < func_table_in_use; i++)
+ for (i = 0; VEC_iterate (unsigned, funcnum_table, i, ifunc); i++)
{
write_rtnbeg (i, 0);
write_rtnend (i, 0);
diff --git a/include/ChangeLog b/include/ChangeLog
index e65a8f2b9ac..a9fb359cd3d 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,45 @@
+2010-06-21 Rafael Espindola <espindola@google.com>
+
+ * plugin-api.h (ld_plugin_set_extra_library_path): New.
+ (ld_plugin_tag): Add LDPT_SET_EXTRA_LIBRARY_PATH.
+ (ld_plugin_tv): Add tv_set_extra_library_path.
+
+2010-06-21 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2.h (enum dwarf_type): Add DW_ATE_UTF.
+
+2010-06-18 Rafael Espindola <espindola@google.com>
+
+ * plugin.h (ld_plugin_add_input_file, ld_plugin_add_input_library):
+ Make argument const.
+
+2010-06-08 Tristan Gingold <gingold@adacore.com>
+
+ * dwarf2.h (enum dwarf_tag): Add DW_TAG_HP_Bliss_field and
+ DW_TAG_HP_Bliss_field_set.
+ (enum dwarf_attribute): Add DW_AT_HP_prologue, DW_AT_HP_epilogue,
+ DW_AT_HP_unit_name, DW_AT_HP_unit_size, DW_AT_HP_widened_byte_size,
+ DW_AT_HP_definition_points, DW_AT_HP_default_location and
+ DW_AT_HP_is_result_param.
+ (enum dwarf_type): Add DW_ATE_HP_VAX_float, DW_ATE_HP_VAX_float_d,
+ DW_ATE_HP_packed_decimal, DW_ATE_HP_zoned_decimal, DW_ATE_HP_edited,
+ DW_ATE_HP_signed_fixed, DW_ATE_HP_unsigned_fixed,
+ DW_ATE_HP_VAX_complex_float and DW_ATE_HP_VAX_complex_float_d.
+ (enum dwarf_line_number_x_ops): Add
+ DW_LNE_HP_source_file_correlation.
+ (enum dwarf_source_language): Add DW_LANG_HP_Bliss,
+ DW_LANG_HP_Basic91, DW_LANG_HP_Pascal91, DW_LANG_HP_IMacro,
+ DW_LANG_HP_Assembler.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * splay-tree.h: Update copyright years.
+ (splay_tree_s): Document fields.
+ (splay_tree_new_typed_alloc): New.
+
+ * hashtab.h: Update copyright years.
+ (htab_create_typed_alloc): New.
+
2010-06-01 Rafael Espindola <espindola@google.com>
* plugin-api.h (ld_plugin_tag): Add LDPT_OUTPUT_NAME.
diff --git a/include/dwarf2.h b/include/dwarf2.h
index 0b0355232be..03c25812d09 100644
--- a/include/dwarf2.h
+++ b/include/dwarf2.h
@@ -206,8 +206,12 @@ enum dwarf_tag
/* SGI/MIPS Extensions. */
DW_TAG_MIPS_loop = 0x4081,
+
/* HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . */
DW_TAG_HP_array_descriptor = 0x4090,
+ DW_TAG_HP_Bliss_field = 0x4091,
+ DW_TAG_HP_Bliss_field_set = 0x4092,
+
/* GNU extensions. */
DW_TAG_format_label = 0x4101, /* For FORTRAN 77 and Fortran 90. */
DW_TAG_function_template = 0x4102, /* For C++. */
@@ -390,6 +394,8 @@ enum dwarf_attribute
/* HP extensions. */
DW_AT_HP_block_index = 0x2000,
DW_AT_HP_unmodifiable = 0x2001, /* Same as DW_AT_MIPS_fde. */
+ DW_AT_HP_prologue = 0x2005, /* Same as DW_AT_MIPS_loop_unroll. */
+ DW_AT_HP_epilogue = 0x2008, /* Same as DW_AT_MIPS_stride. */
DW_AT_HP_actuals_stmt_list = 0x2010,
DW_AT_HP_proc_per_section = 0x2011,
DW_AT_HP_raw_data_ptr = 0x2012,
@@ -402,6 +408,13 @@ enum dwarf_attribute
DW_AT_HP_all_variables_modifiable = 0x2019,
DW_AT_HP_linkage_name = 0x201a,
DW_AT_HP_prof_flags = 0x201b, /* In comp unit of procs_info for -g. */
+ DW_AT_HP_unit_name = 0x201f,
+ DW_AT_HP_unit_size = 0x2020,
+ DW_AT_HP_widened_byte_size = 0x2021,
+ DW_AT_HP_definition_points = 0x2022,
+ DW_AT_HP_default_location = 0x2023,
+ DW_AT_HP_is_result_param = 0x2029,
+
/* GNU extensions. */
DW_AT_sf_names = 0x2101,
DW_AT_src_info = 0x2102,
@@ -641,18 +654,29 @@ enum dwarf_type
DW_ATE_signed_fixed = 0xd,
DW_ATE_unsigned_fixed = 0xe,
DW_ATE_decimal_float = 0xf,
+ /* DWARF 4. */
+ DW_ATE_UTF = 0x10,
DW_ATE_lo_user = 0x80,
DW_ATE_hi_user = 0xff,
/* HP extensions. */
- DW_ATE_HP_float80 = 0x80, /* Floating-point (80 bit). */
- DW_ATE_HP_complex_float80 = 0x81, /* Complex floating-point (80 bit). */
- DW_ATE_HP_float128 = 0x82, /* Floating-point (128 bit). */
- DW_ATE_HP_complex_float128 = 0x83, /* Complex floating-point (128 bit). */
- DW_ATE_HP_floathpintel = 0x84, /* Floating-point (82 bit IA64). */
- DW_ATE_HP_imaginary_float80 = 0x85,
- DW_ATE_HP_imaginary_float128 = 0x86
+ DW_ATE_HP_float80 = 0x80, /* Floating-point (80 bit). */
+ DW_ATE_HP_complex_float80 = 0x81, /* Complex floating-point (80 bit). */
+ DW_ATE_HP_float128 = 0x82, /* Floating-point (128 bit). */
+ DW_ATE_HP_complex_float128 = 0x83, /* Complex fp (128 bit). */
+ DW_ATE_HP_floathpintel = 0x84, /* Floating-point (82 bit IA64). */
+ DW_ATE_HP_imaginary_float80 = 0x85,
+ DW_ATE_HP_imaginary_float128 = 0x86,
+ DW_ATE_HP_VAX_float = 0x88, /* F or G floating. */
+ DW_ATE_HP_VAX_float_d = 0x89, /* D floating. */
+ DW_ATE_HP_packed_decimal = 0x8a, /* Cobol. */
+ DW_ATE_HP_zoned_decimal = 0x8b, /* Cobol. */
+ DW_ATE_HP_edited = 0x8c, /* Cobol. */
+ DW_ATE_HP_signed_fixed = 0x8d, /* Cobol. */
+ DW_ATE_HP_unsigned_fixed = 0x8e, /* Cobol. */
+ DW_ATE_HP_VAX_complex_float = 0x8f, /* F or G floating complex. */
+ DW_ATE_HP_VAX_complex_float_d = 0x90 /* D floating complex. */
};
/* Decimal sign encodings. */
@@ -785,6 +809,7 @@ enum dwarf_line_number_x_ops
DW_LNE_HP_negate_function_exit = 0x18,
DW_LNE_HP_negate_front_end_logical = 0x19,
DW_LNE_HP_define_proc = 0x20,
+ DW_LNE_HP_source_file_correlation = 0x80,
DW_LNE_lo_user = 0x80,
DW_LNE_hi_user = 0xff
@@ -875,7 +900,13 @@ enum dwarf_source_language
/* MIPS. */
DW_LANG_Mips_Assembler = 0x8001,
/* UPC. */
- DW_LANG_Upc = 0x8765
+ DW_LANG_Upc = 0x8765,
+ /* HP extensions. */
+ DW_LANG_HP_Bliss = 0x8003,
+ DW_LANG_HP_Basic91 = 0x8004,
+ DW_LANG_HP_Pascal91 = 0x8005,
+ DW_LANG_HP_IMacro = 0x8006,
+ DW_LANG_HP_Assembler = 0x8007
};
/* Names and codes for macro information. */
diff --git a/include/hashtab.h b/include/hashtab.h
index 1cd406daf31..4bb65d6c7a2 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -1,5 +1,5 @@
/* An expandable hash tables datatype.
- Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2009
+ Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2009, 2010
Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
@@ -157,6 +157,9 @@ extern htab_t htab_create_alloc_ex (size_t, htab_hash,
void *, htab_alloc_with_arg,
htab_free_with_arg);
+extern htab_t htab_create_typed_alloc (size_t, htab_hash, htab_eq, htab_del,
+ htab_alloc, htab_alloc, htab_free);
+
/* Backward-compatibility functions. */
extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del);
extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del);
diff --git a/include/plugin-api.h b/include/plugin-api.h
index 582178554b3..a0cf5f4583d 100644
--- a/include/plugin-api.h
+++ b/include/plugin-api.h
@@ -220,13 +220,19 @@ enum ld_plugin_status
typedef
enum ld_plugin_status
-(*ld_plugin_add_input_file) (char *pathname);
+(*ld_plugin_add_input_file) (const char *pathname);
/* The linker's interface for adding a library that should be searched. */
typedef
enum ld_plugin_status
-(*ld_plugin_add_input_library) (char *libname);
+(*ld_plugin_add_input_library) (const char *libname);
+
+/* The linker's interface for adding a library path that should be searched. */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_set_extra_library_path) (const char *path);
/* The linker's interface for issuing a warning or error message. */
@@ -261,7 +267,8 @@ enum ld_plugin_tag
LDPT_GET_INPUT_FILE,
LDPT_RELEASE_INPUT_FILE,
LDPT_ADD_INPUT_LIBRARY,
- LDPT_OUTPUT_NAME
+ LDPT_OUTPUT_NAME,
+ LDPT_SET_EXTRA_LIBRARY_PATH
};
/* The plugin transfer vector. */
@@ -283,6 +290,7 @@ struct ld_plugin_tv
ld_plugin_get_input_file tv_get_input_file;
ld_plugin_release_input_file tv_release_input_file;
ld_plugin_add_input_library tv_add_input_library;
+ ld_plugin_set_extra_library_path tv_set_extra_library_path;
} tv_u;
};
diff --git a/include/splay-tree.h b/include/splay-tree.h
index 57a96c4a3de..480b2c43e7d 100644
--- a/include/splay-tree.h
+++ b/include/splay-tree.h
@@ -1,5 +1,5 @@
/* A splay-tree datatype.
- Copyright 1998, 1999, 2000, 2002, 2005, 2007, 2009
+ Copyright 1998, 1999, 2000, 2002, 2005, 2007, 2009, 2010
Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
@@ -119,9 +119,13 @@ struct GTY(()) splay_tree_s {
/* The deallocate-value function. NULL if no cleanup is necessary. */
splay_tree_delete_value_fn delete_value;
- /* Allocate/free functions, and a data pointer to pass to them. */
+ /* Node allocate function. Takes allocate_data as a parameter. */
splay_tree_allocate_fn allocate;
+
+ /* Free function for nodes and trees. Takes allocate_data as a parameter. */
splay_tree_deallocate_fn deallocate;
+
+ /* Parameter for allocate/free functions. */
void * GTY((skip)) allocate_data;
};
@@ -136,6 +140,13 @@ extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn,
splay_tree_allocate_fn,
splay_tree_deallocate_fn,
void *);
+extern splay_tree splay_tree_new_typed_alloc (splay_tree_compare_fn,
+ splay_tree_delete_key_fn,
+ splay_tree_delete_value_fn,
+ splay_tree_allocate_fn,
+ splay_tree_allocate_fn,
+ splay_tree_deallocate_fn,
+ void *);
extern void splay_tree_delete (splay_tree);
extern splay_tree_node splay_tree_insert (splay_tree,
splay_tree_key,
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index cc77ca013bc..2b3d224913f 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,41 @@
+2010-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ * include/cpplib.h (struct cpp_callbacks): Add user_builtin_macro
+ callback.
+ (enum cpp_builtin_type): Add BT_FIRST_USER and BT_LAST_USER.
+ (cpp_macro_definition): Remove const qual from second argument.
+ * macro.c (enter_macro_context): Call user_builtin_macro callback for
+ NODE_BUILTIN !NODE_USED macros.
+ (warn_of_redefinition): Likewise. Remove const qual from second
+ argument.
+ (cpp_macro_definition): Likewise.
+ * pch.c (write_macdef, save_macros): Call user_builtin_macro callback
+ for NODE_BUILTIN !NODE_USED macros.
+
+2010-06-10 Joseph Myers <joseph@codesourcery.com>
+
+ * include/cpplib.h (struct cpp_options): Remove show_column.
+ * init.c (cpp_create_reader, post_options): Don't set show_column.
+
+2010-06-09 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR bootstrap/44432
+ * configure.ac: Before using ZW_PROG_COMPILER_DEPENDENCIES for C++,
+ check that C++ compiler works.
+ * configure: Regenerate.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * include/symtab.h (ht_identifier_ptr): New.
+
+2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com>
+ Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ PR bootstrap/42798
+ * configure.ac: Check for declaration of 'basename(char *)'.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
2010-04-25 Joseph Myers <joseph@codesourcery.com>
* include/cpplib.h (enum c_lang): Add CLK_GNUC1X and CLK_STDC1X.
diff --git a/libcpp/config.in b/libcpp/config.in
index 4c71ec3cea5..996993405db 100644
--- a/libcpp/config.in
+++ b/libcpp/config.in
@@ -33,8 +33,8 @@
don't. */
#undef HAVE_DECL_ASPRINTF
-/* Define to 1 if you have the declaration of `basename', and to 0 if you
- don't. */
+/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
+ you don't. */
#undef HAVE_DECL_BASENAME
/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if
diff --git a/libcpp/configure b/libcpp/configure
index 00cbd7a583d..a4700e63a92 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -2239,8 +2239,10 @@ $as_echo "$ac_res" >&6; }
ac_fn_cxx_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
@@ -2250,8 +2252,12 @@ $4
int
main ()
{
-#ifndef $2
- (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
#endif
;
@@ -4394,6 +4400,29 @@ else CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
fi
else
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int i;
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ as_fn_error "C++ compiler missing or inoperational" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
depcc="$CXX" am_compiler_list=
am_depcomp=$ac_aux_dir/depcomp
@@ -4991,8 +5020,7 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-ac_ext=cpp
+ ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -5480,8 +5508,8 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_ASPRINTF $ac_have_decl
_ACEOF
-ac_fn_cxx_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default"
-if test "x$ac_cv_have_decl_basename" = x""yes; then :
+ac_fn_cxx_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
+if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
ac_have_decl=1
else
ac_have_decl=0
@@ -5510,6 +5538,17 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_GETOPT $ac_have_decl
_ACEOF
+ac_fn_cxx_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vasprintf" = x""yes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VASPRINTF $ac_have_decl
+_ACEOF
+
ac_fn_cxx_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default"
if test "x$ac_cv_have_decl_clearerr_unlocked" = x""yes; then :
ac_have_decl=1
@@ -5670,16 +5709,6 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_PUTC_UNLOCKED $ac_have_decl
_ACEOF
-ac_fn_cxx_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
-if test "x$ac_cv_have_decl_vasprintf" = x""yes; then :
- ac_have_decl=1
-else
- ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_VASPRINTF $ac_have_decl
-_ACEOF
# Checks for library functions.
diff --git a/libcpp/configure.ac b/libcpp/configure.ac
index d520e933c90..ceea29ce165 100644
--- a/libcpp/configure.ac
+++ b/libcpp/configure.ac
@@ -45,6 +45,10 @@ ZW_CREATE_DEPDIR
if test "$ENABLE_BUILD_WITH_CXX" = "no"; then
ZW_PROG_COMPILER_DEPENDENCIES([CC])
else
+AC_LANG_PUSH([C++])
+AC_COMPILE_IFELSE([[int i;]], [],
+ [AC_MSG_ERROR([C++ compiler missing or inoperational])])
+AC_LANG_POP([C++])
ZW_PROG_COMPILER_DEPENDENCIES([CXX])
fi
@@ -81,8 +85,8 @@ define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
putchar_unlocked putc_unlocked)
AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS)
-AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno getopt \
- libcpp_UNLOCKED_FUNCS vasprintf)))
+AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, getopt, vasprintf])
+AC_CHECK_DECLS(m4_split(m4_normalize(libcpp_UNLOCKED_FUNCS)))
# Checks for library functions.
AC_FUNC_ALLOCA
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 0828ea40f93..87d368e2925 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -1,6 +1,6 @@
/* Definitions for CPP library.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2007, 2008, 2009
+ 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
@@ -389,9 +389,6 @@ struct cpp_options
bother trying to do macro expansion and whatnot. */
unsigned char preprocessed;
- /* Print column number in error messages. */
- unsigned char show_column;
-
/* Nonzero means handle C++ alternate operator names. */
unsigned char operator_names;
@@ -512,6 +509,9 @@ struct cpp_callbacks
/* Called whenever a macro is expanded or tested.
Second argument is the location of the start of the current expansion. */
void (*used) (cpp_reader *, source_location, cpp_hashnode *);
+
+ /* Callback that can change a user builtin into normal macro. */
+ bool (*user_builtin_macro) (cpp_reader *, cpp_hashnode *);
};
#ifdef VMS
@@ -602,7 +602,9 @@ enum cpp_builtin_type
BT_STDC, /* `__STDC__' */
BT_PRAGMA, /* `_Pragma' operator */
BT_TIMESTAMP, /* `__TIMESTAMP__' */
- BT_COUNTER /* `__COUNTER__' */
+ BT_COUNTER, /* `__COUNTER__' */
+ BT_FIRST_USER, /* User defined builtin macros. */
+ BT_LAST_USER = BT_FIRST_USER + 31
};
#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))
@@ -729,7 +731,7 @@ extern const cpp_token *cpp_get_token (cpp_reader *);
extern const cpp_token *cpp_get_token_with_location (cpp_reader *,
source_location *);
extern const unsigned char *cpp_macro_definition (cpp_reader *,
- const cpp_hashnode *);
+ cpp_hashnode *);
extern void _cpp_backup_tokens (cpp_reader *, unsigned int);
extern const cpp_token *cpp_peek_token (cpp_reader *, int);
diff --git a/libcpp/include/symtab.h b/libcpp/include/symtab.h
index ebb56007a03..b0a2f2697aa 100644
--- a/libcpp/include/symtab.h
+++ b/libcpp/include/symtab.h
@@ -28,6 +28,7 @@ along with this program; see the file COPYING3. If not see
/* This is what each hash table entry points to. It may be embedded
deeply within another object. */
typedef struct ht_identifier ht_identifier;
+typedef struct ht_identifier *ht_identifier_ptr;
struct GTY(()) ht_identifier {
const unsigned char *str;
unsigned int len;
diff --git a/libcpp/init.c b/libcpp/init.c
index ae5ae4548c8..c5b8c28e342 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -156,7 +156,6 @@ cpp_create_reader (enum c_lang lang, hash_table *table,
CPP_OPTION (pfile, warn_multichar) = 1;
CPP_OPTION (pfile, discard_comments) = 1;
CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1;
- CPP_OPTION (pfile, show_column) = 1;
CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, operator_names) = 1;
CPP_OPTION (pfile, warn_trigraphs) = 2;
@@ -717,8 +716,6 @@ post_options (cpp_reader *pfile)
{
CPP_OPTION (pfile, cplusplus_comments) = 0;
- /* Traditional CPP does not accurately track column information. */
- CPP_OPTION (pfile, show_column) = 0;
CPP_OPTION (pfile, trigraphs) = 0;
CPP_OPTION (pfile, warn_trigraphs) = 0;
}
diff --git a/libcpp/macro.c b/libcpp/macro.c
index cbb0b0e7159..31de4156c64 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -65,7 +65,7 @@ static bool create_iso_definition (cpp_reader *, cpp_macro *);
static cpp_token *alloc_expansion_token (cpp_reader *, cpp_macro *);
static cpp_token *lex_expansion_token (cpp_reader *, cpp_macro *);
-static bool warn_of_redefinition (cpp_reader *, const cpp_hashnode *,
+static bool warn_of_redefinition (cpp_reader *, cpp_hashnode *,
const cpp_macro *);
static bool parse_params (cpp_reader *, cpp_macro *);
static void check_trad_stringification (cpp_reader *, const cpp_macro *,
@@ -835,7 +835,9 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
if ((node->flags & NODE_BUILTIN) && !(node->flags & NODE_USED))
{
node->flags |= NODE_USED;
- if (pfile->cb.used_define)
+ if ((!pfile->cb.user_builtin_macro
+ || !pfile->cb.user_builtin_macro (pfile, node))
+ && pfile->cb.used_define)
pfile->cb.used_define (pfile, pfile->directive_line, node);
}
@@ -1430,7 +1432,7 @@ _cpp_backup_tokens (cpp_reader *pfile, unsigned int count)
/* Returns nonzero if a macro redefinition warning is required. */
static bool
-warn_of_redefinition (cpp_reader *pfile, const cpp_hashnode *node,
+warn_of_redefinition (cpp_reader *pfile, cpp_hashnode *node,
const cpp_macro *macro2)
{
const cpp_macro *macro1;
@@ -1442,7 +1444,11 @@ warn_of_redefinition (cpp_reader *pfile, const cpp_hashnode *node,
/* Suppress warnings for builtins that lack the NODE_WARN flag. */
if (node->flags & NODE_BUILTIN)
- return false;
+ {
+ if (!pfile->cb.user_builtin_macro
+ || !pfile->cb.user_builtin_macro (pfile, node))
+ return false;
+ }
/* Redefinitions of conditional (context-sensitive) macros, on
the other hand, must be allowed silently. */
@@ -1982,19 +1988,26 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro,
Caller is expected to generate the "#define" bit if needed. The
returned text is temporary, and automatically freed later. */
const unsigned char *
-cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
+cpp_macro_definition (cpp_reader *pfile, cpp_hashnode *node)
{
unsigned int i, len;
- const cpp_macro *macro = node->value.macro;
+ const cpp_macro *macro;
unsigned char *buffer;
if (node->type != NT_MACRO || (node->flags & NODE_BUILTIN))
{
- cpp_error (pfile, CPP_DL_ICE,
- "invalid hash type %d in cpp_macro_definition", node->type);
- return 0;
+ if (node->type != NT_MACRO
+ || !pfile->cb.user_builtin_macro
+ || !pfile->cb.user_builtin_macro (pfile, node))
+ {
+ cpp_error (pfile, CPP_DL_ICE,
+ "invalid hash type %d in cpp_macro_definition",
+ node->type);
+ return 0;
+ }
}
+ macro = node->value.macro;
/* Calculate length. */
len = NODE_LEN (node) + 2; /* ' ' and NUL. */
if (macro->fun_like)
diff --git a/libcpp/pch.c b/libcpp/pch.c
index 2fb7ba543e7..a6d8cea38d3 100644
--- a/libcpp/pch.c
+++ b/libcpp/pch.c
@@ -58,7 +58,9 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
return 1;
case NT_MACRO:
- if ((hn->flags & NODE_BUILTIN))
+ if ((hn->flags & NODE_BUILTIN)
+ && (!pfile->cb.user_builtin_macro
+ || !pfile->cb.user_builtin_macro (pfile, hn)))
return 1;
{
@@ -759,6 +761,12 @@ static int
save_macros (cpp_reader *r, cpp_hashnode *h, void *data_p)
{
struct save_macro_data *data = (struct save_macro_data *)data_p;
+
+ if ((h->flags & NODE_BUILTIN)
+ && h->type == NT_MACRO
+ && r->cb.user_builtin_macro)
+ r->cb.user_builtin_macro (r, h);
+
if (h->type != NT_VOID
&& (h->flags & NODE_BUILTIN) == 0)
{
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index a0e88458d96..a261a056f69 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-06-12 Kazu Hirata <kazu@codesourcery.com>
+
+ * config.host (mips64*-*-linux*, mips*-*-linux*): Add mips/t-crtfm
+ to tmake_file. Add crtfastmath.o to extra_parts.
+ * config/mips/t-crtfm: New.
+
2010-05-19 Joel Sherrill <joel.sherrill@oarcorp.com>
* config.host (sparc64-*-rtems*): New target.
diff --git a/libgcc/config.host b/libgcc/config.host
index 1e76b19b0bf..6784147d6d7 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -400,8 +400,12 @@ mips-sgi-irix[56]*)
mips*-*-netbsd*) # NetBSD/mips, either endian.
;;
mips64*-*-linux*)
+ extra_parts="$extra_parts crtfastmath.o"
+ tmake_file="{$tmake_file} mips/t-crtfm"
;;
mips*-*-linux*) # Linux MIPS, either endian.
+ extra_parts="$extra_parts crtfastmath.o"
+ tmake_file="{$tmake_file} mips/t-crtfm"
;;
mips*-*-openbsd*)
;;
diff --git a/libgcc/config/mips/t-crtfm b/libgcc/config/mips/t-crtfm
new file mode 100644
index 00000000000..fe2e06619b1
--- /dev/null
+++ b/libgcc/config/mips/t-crtfm
@@ -0,0 +1,3 @@
+crtfastmath.o: $(gcc_srcdir)/config/mips/crtfastmath.c
+ $(gcc_compile) -c $(gcc_srcdir)/config/mips/crtfastmath.c
+
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index e90848cf57f..0e5eb36da5f 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,67 @@
+2010-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/43298
+ * io/read.c: Add code to parse and read Inf, Infinity, NaN, and Nan with
+ optional parenthesis.
+
+2010-06-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/43298
+ * list_read.c (parse_real, read_real): Support NAN(alphanum).
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * intrinsics/selected_real_kind.f90
+ (_gfortran_selected_real_kind2008): Add function.
+ (_gfortran_selected_real_kind): Stub which calls
+ _gfortran_selected_real_kind2008.
+ * gfortran.map (GFORTRAN_1.4): Add
+ _gfortran_selected_real_kind2008.
+ * mk-srk-inc.sh: Save also RADIX.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
+ * runtime/compile_options.c (init_compile_options): Update
+ compile_options.allow_std for GFC_STD_F2008_OBS.
+ * io/transfer.c (formatted_transfer_scalar_read,
+ formatted_transfer_scalar_write): Fix allow_std check.
+ * io/list_read.c (nml_parse_qualifier): Ditto.
+
+2010-06-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/44477
+ * io/file_pos.c (st_endfile): Add check for ENDFILE when file is
+ already positioned after the EOF marker. Use find_or_create_unit
+ instead of find_unit. If unit is not connected, connect it and create
+ the file with default settings.
+ * io/transfer.c (data_transfer_init): Add check for attempted READ or
+ WRITE when file is already positioned after the EOF marker.
+
+2010-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * intrinsics/selected_char_kind.c (selected_char_kind): Fix
+ return value for ISO_10646.
+
+2010-06-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * mk-kinds-h.sh: Define GFC_REAL_*_LITERAL_SUFFIX and
+ GFC_REAL_*_LITERAL macros for each kind.
+ * intrinsics/cpu_time.c (cpu_time_4, cpu_time_8, cpu_time_10,
+ cpu_time_16): Use them.
+ * intrinsics/random.c (rnumber_4, rnumber_8, rnumber_10,
+ rnumber_16): Likewise.
+
+2010-06-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * intrinsics/system_clock.c (system_clock_4, system_clock_8):
+ Undefine TCK.
+
+2010-06-04 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/34670
+ * intrinsics/date_and_time.c: Replace assert with runtime_error
+ when VALUE is too small.
+
2010-05-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/43851
@@ -23,31 +87,31 @@
2010-05-07 Janne Blomqvist <jb@gcc.gnu.org>
- * libgfortran.h (free_mem): Remove prototype.
- * runtime/memory.c (free_mem): Remove function.
- * intrinsics/date_and_time.c (secnds): Replace free_mem() with
- free().
- * io/fbuf.c (fbuf_destroy): Likewise.
- * io/format.c (free_format_hash_table): Likewise.
- (save_parsed_format): Likewise.
- (free_format_data): Likewise.
- * io/list_read.c (free_saved): Likewise.
- (free_line): Likewise.
- (nml_touch_nodes): Likewise.
- (nml_read_obj): Likewise
- * io/lock.c (free_ionml): Likewise.
- * io/open.c (new_unit): Likewise.
- (already_open): Likewise.
- * io/unit.c (destroy_unit_mutex): Likewise.
- (free_internal_unit): Likewise.
- (close_unit_1): Likewise.
- * io/unix.c (raw_close): Likewise.
- (buf_close): Likewise.
- (mem_close): Likewise.
- (tempfile): Likewise.
- * io/write.c (nml_write_obj): Likewise.
- * io/write_float.def (output_float_FMT_G_##): Likewise.
- * runtime/error.c (show_locus): Likewise.
+ * libgfortran.h (free_mem): Remove prototype.
+ * runtime/memory.c (free_mem): Remove function.
+ * intrinsics/date_and_time.c (secnds): Replace free_mem() with
+ free().
+ * io/fbuf.c (fbuf_destroy): Likewise.
+ * io/format.c (free_format_hash_table): Likewise.
+ (save_parsed_format): Likewise.
+ (free_format_data): Likewise.
+ * io/list_read.c (free_saved): Likewise.
+ (free_line): Likewise.
+ (nml_touch_nodes): Likewise.
+ (nml_read_obj): Likewise
+ * io/lock.c (free_ionml): Likewise.
+ * io/open.c (new_unit): Likewise.
+ (already_open): Likewise.
+ * io/unit.c (destroy_unit_mutex): Likewise.
+ (free_internal_unit): Likewise.
+ (close_unit_1): Likewise.
+ * io/unix.c (raw_close): Likewise.
+ (buf_close): Likewise.
+ (mem_close): Likewise.
+ (tempfile): Likewise.
+ * io/write.c (nml_write_obj): Likewise.
+ * io/write_float.def (output_float_FMT_G_##): Likewise.
+ * runtime/error.c (show_locus): Likewise.
2010-05-04 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 3e854eb0eae..ce5aa77b02d 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -1106,6 +1106,7 @@ GFORTRAN_1.3 {
GFORTRAN_1.4 {
global:
_gfortran_error_stop_numeric;
+ _gfortran_selected_real_kind2008;
} GFORTRAN_1.3;
F2C_1.0 {
diff --git a/libgfortran/intrinsics/cpu_time.c b/libgfortran/intrinsics/cpu_time.c
index 0ac502340ac..3580bba0928 100644
--- a/libgfortran/intrinsics/cpu_time.c
+++ b/libgfortran/intrinsics/cpu_time.c
@@ -78,7 +78,7 @@ void cpu_time_4 (GFC_REAL_4 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_4)1.e-6;
+ *time = sec + usec * GFC_REAL_4_LITERAL(1.e-6);
}
iexport(cpu_time_4);
@@ -89,7 +89,7 @@ void cpu_time_8 (GFC_REAL_8 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_8)1.e-6;
+ *time = sec + usec * GFC_REAL_8_LITERAL(1.e-6);
}
#ifdef HAVE_GFC_REAL_10
@@ -100,7 +100,7 @@ void cpu_time_10 (GFC_REAL_10 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_10)1.e-6;
+ *time = sec + usec * GFC_REAL_10_LITERAL(1.e-6);
}
#endif
@@ -112,7 +112,7 @@ void cpu_time_16 (GFC_REAL_16 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_16)1.e-6;
+ *time = sec + usec * GFC_REAL_16_LITERAL(1.e-6);
}
#endif
diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c
index 647dd9ad7a3..21e4320e134 100644
--- a/libgfortran/intrinsics/date_and_time.c
+++ b/libgfortran/intrinsics/date_and_time.c
@@ -280,8 +280,12 @@ date_and_time (char *__date, char *__time, char *__zone,
delta = GFC_DESCRIPTOR_STRIDE(__values,0);
if (delta == 0)
delta = 1;
+
+ if (unlikely (len < VALUES_SIZE))
+ runtime_error ("Incorrect extent in VALUE argument to"
+ " DATE_AND_TIME intrinsic: is %ld, should"
+ " be >=%ld", (long int) len, (long int) VALUES_SIZE);
- assert (len >= VALUES_SIZE);
/* Cope with different type kinds. */
if (elt_size == 4)
{
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
index 803049b065f..cbe4f90322b 100644
--- a/libgfortran/intrinsics/random.c
+++ b/libgfortran/intrinsics/random.c
@@ -85,7 +85,7 @@ rnumber_4 (GFC_REAL_4 *f, GFC_UINTEGER_4 v)
#error "GFC_REAL_4_RADIX has unknown value"
#endif
v = v & mask;
- *f = (GFC_REAL_4) v * (GFC_REAL_4) 0x1.p-32f;
+ *f = (GFC_REAL_4) v * GFC_REAL_4_LITERAL(0x1.p-32);
}
static inline void
@@ -100,7 +100,7 @@ rnumber_8 (GFC_REAL_8 *f, GFC_UINTEGER_8 v)
#error "GFC_REAL_8_RADIX has unknown value"
#endif
v = v & mask;
- *f = (GFC_REAL_8) v * (GFC_REAL_8) 0x1.p-64;
+ *f = (GFC_REAL_8) v * GFC_REAL_8_LITERAL(0x1.p-64);
}
#ifdef HAVE_GFC_REAL_10
@@ -117,7 +117,7 @@ rnumber_10 (GFC_REAL_10 *f, GFC_UINTEGER_8 v)
#error "GFC_REAL_10_RADIX has unknown value"
#endif
v = v & mask;
- *f = (GFC_REAL_10) v * (GFC_REAL_10) 0x1.p-64;
+ *f = (GFC_REAL_10) v * GFC_REAL_10_LITERAL(0x1.p-64);
}
#endif
@@ -137,8 +137,8 @@ rnumber_16 (GFC_REAL_16 *f, GFC_UINTEGER_8 v1, GFC_UINTEGER_8 v2)
#error "GFC_REAL_16_RADIX has unknown value"
#endif
v2 = v2 & mask;
- *f = (GFC_REAL_16) v1 * (GFC_REAL_16) 0x1.p-64
- + (GFC_REAL_16) v2 * (GFC_REAL_16) 0x1.p-128;
+ *f = (GFC_REAL_16) v1 * GFC_REAL_16_LITERAL(0x1.p-64)
+ + (GFC_REAL_16) v2 * GFC_REAL_16_LITERAL(0x1.p-128);
}
#endif
/* libgfortran previously had a Mersenne Twister, taken from the paper:
diff --git a/libgfortran/intrinsics/selected_char_kind.c b/libgfortran/intrinsics/selected_char_kind.c
index 35cf453402a..25259979fcb 100644
--- a/libgfortran/intrinsics/selected_char_kind.c
+++ b/libgfortran/intrinsics/selected_char_kind.c
@@ -40,7 +40,7 @@ selected_char_kind (gfc_charlen_type name_len, char *name)
|| (len == 7 && strncasecmp (name, "default", 7) == 0))
return 1;
else if (len == 9 && strncasecmp (name, "iso_10646", 9) == 0)
- return 1;
+ return 4;
else
return -1;
}
diff --git a/libgfortran/intrinsics/selected_real_kind.f90 b/libgfortran/intrinsics/selected_real_kind.f90
index ea3b46aabdd..92708d7205f 100644
--- a/libgfortran/intrinsics/selected_real_kind.f90
+++ b/libgfortran/intrinsics/selected_real_kind.f90
@@ -1,7 +1,7 @@
-! Copyright 2003, 2004, 2009 Free Software Foundation, Inc.
+! Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc.
! Contributed by Kejia Zhao <kejia_zh@yahoo.com.cn>
!
-!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!This file is part of the GNU Fortran runtime library (libgfortran).
!
!Libgfortran is free software; you can redistribute it and/or
!modify it under the terms of the GNU General Public
@@ -22,43 +22,74 @@
!see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
!<http://www.gnu.org/licenses/>.
-function _gfortran_selected_real_kind (p, r)
+function _gfortran_selected_real_kind2008 (p, r, rdx)
implicit none
- integer, optional, intent (in) :: p, r
- integer :: _gfortran_selected_real_kind
- integer :: i, p2, r2
- logical :: found_p, found_r
+ integer, optional, intent (in) :: p, r, rdx
+ integer :: _gfortran_selected_real_kind2008
+ integer :: i, p2, r2, radix2
+ logical :: found_p, found_r, found_radix
! Real kind_precision_range table
type :: real_info
integer :: kind
integer :: precision
integer :: range
+ integer :: radix
end type real_info
include "selected_real_kind.inc"
- _gfortran_selected_real_kind = 0
+ _gfortran_selected_real_kind2008 = 0
p2 = 0
r2 = 0
+ radix2 = 0
found_p = .false.
found_r = .false.
+ found_radix = .false.
if (present (p)) p2 = p
if (present (r)) r2 = r
+ if (present (rdx)) radix2 = rdx
! Assumes each type has a greater precision and range than previous one.
do i = 1, c
if (p2 <= real_infos (i) % precision) found_p = .true.
if (r2 <= real_infos (i) % range) found_r = .true.
- if (found_p .and. found_r) then
- _gfortran_selected_real_kind = real_infos (i) % kind
+ if (radix2 <= real_infos (i) % radix) found_radix = .true.
+
+ if (p2 <= real_infos (i) % precision &
+ .and. r2 <= real_infos (i) % range &
+ .and. radix2 <= real_infos (i) % radix) then
+ _gfortran_selected_real_kind2008 = real_infos (i) % kind
return
end if
end do
- if (.not. (found_p)) _gfortran_selected_real_kind = _gfortran_selected_real_kind - 1
- if (.not. (found_r)) _gfortran_selected_real_kind = _gfortran_selected_real_kind - 2
+ if (found_radix .and. found_r .and. .not. found_p) then
+ _gfortran_selected_real_kind2008 = -1
+ elseif (found_radix .and. found_p .and. .not. found_r) then
+ _gfortran_selected_real_kind2008 = -2
+ elseif (found_radix .and. .not. found_p .and. .not. found_r) then
+ _gfortran_selected_real_kind2008 = -3
+ elseif (found_radix) then
+ _gfortran_selected_real_kind2008 = -4
+ else
+ _gfortran_selected_real_kind2008 = -5
+ end if
+end function _gfortran_selected_real_kind2008
+
+function _gfortran_selected_real_kind (p, r)
+ implicit none
+ integer, optional, intent (in) :: p, r
+ integer :: _gfortran_selected_real_kind
+
+ interface
+ function _gfortran_selected_real_kind2008 (p, r, rdx)
+ implicit none
+ integer, optional, intent (in) :: p, r, rdx
+ integer :: _gfortran_selected_real_kind2008
+ end function _gfortran_selected_real_kind2008
+ end interface
- return
+ _gfortran_selected_real_kind = _gfortran_selected_real_kind2008 (p, r)
end function
diff --git a/libgfortran/intrinsics/system_clock.c b/libgfortran/intrinsics/system_clock.c
index 7806059ccdf..7cc82d0c8cd 100644
--- a/libgfortran/intrinsics/system_clock.c
+++ b/libgfortran/intrinsics/system_clock.c
@@ -56,6 +56,7 @@ system_clock_4(GFC_INTEGER_4 *count, GFC_INTEGER_4 *count_rate,
GFC_INTEGER_4 mx;
#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
+#undef TCK
#define TCK 1000
struct timeval tp1;
@@ -117,6 +118,7 @@ system_clock_8 (GFC_INTEGER_8 *count, GFC_INTEGER_8 *count_rate,
GFC_INTEGER_8 mx;
#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
+#undef TCK
#define TCK 1000000
struct timeval tp1;
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index f7d94996163..e7fbab4c8cc 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -283,8 +283,17 @@ st_endfile (st_parameter_filepos *fpp)
if (u->flags.access == ACCESS_DIRECT)
{
generate_error (&fpp->common, LIBERROR_OPTION_CONFLICT,
- "Cannot perform ENDFILE on a file opened"
- " for DIRECT access");
+ "Cannot perform ENDFILE on a file opened "
+ "for DIRECT access");
+ goto done;
+ }
+
+ if (u->flags.access == ACCESS_SEQUENTIAL
+ && u->endfile == AFTER_ENDFILE)
+ {
+ generate_error (&fpp->common, LIBERROR_OPTION_CONFLICT,
+ "Cannot perform ENDFILE on a file already "
+ "positioned after the EOF marker");
goto done;
}
@@ -309,9 +318,49 @@ st_endfile (st_parameter_filepos *fpp)
u->endfile = AFTER_ENDFILE;
if (0 == stell (u->s))
u->flags.position = POSITION_REWIND;
- done:
- unlock_unit (u);
}
+ else
+ {
+ if (fpp->common.unit < 0)
+ {
+ generate_error (&fpp->common, LIBERROR_BAD_OPTION,
+ "Bad unit number in statement");
+ return;
+ }
+
+ u = find_or_create_unit (fpp->common.unit);
+ if (u->s == NULL)
+ {
+ /* Open the unit with some default flags. */
+ st_parameter_open opp;
+ unit_flags u_flags;
+
+ memset (&u_flags, '\0', sizeof (u_flags));
+ u_flags.access = ACCESS_SEQUENTIAL;
+ u_flags.action = ACTION_READWRITE;
+ u_flags.form = FORM_UNSPECIFIED;
+ u_flags.delim = DELIM_UNSPECIFIED;
+ u_flags.blank = BLANK_UNSPECIFIED;
+ u_flags.pad = PAD_UNSPECIFIED;
+ u_flags.decimal = DECIMAL_UNSPECIFIED;
+ u_flags.encoding = ENCODING_UNSPECIFIED;
+ u_flags.async = ASYNC_UNSPECIFIED;
+ u_flags.round = ROUND_UNSPECIFIED;
+ u_flags.sign = SIGN_UNSPECIFIED;
+ u_flags.status = STATUS_UNKNOWN;
+ u_flags.convert = GFC_CONVERT_NATIVE;
+
+ opp.common = fpp->common;
+ opp.common.flags &= IOPARM_COMMON_MASK;
+ u = new_unit (&opp, u, &u_flags);
+ if (u == NULL)
+ return;
+ u->endfile = AFTER_ENDFILE;
+ }
+ }
+
+ done:
+ unlock_unit (u);
library_end ();
}
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 2f0f931ab5a..72016b73e29 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1199,6 +1199,21 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
push_char (dtp, 'n');
push_char (dtp, 'a');
push_char (dtp, 'n');
+
+ /* Match "NAN(alphanum)". */
+ if (c == '(')
+ {
+ for ( ; c != ')'; c = next_char (dtp))
+ if (is_separator (c))
+ goto bad;
+ else
+ push_char (dtp, c);
+
+ push_char (dtp, ')');
+ c = next_char (dtp);
+ if (is_separator (c))
+ unget_char (dtp, c);
+ }
goto done;
}
@@ -1576,6 +1591,20 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
goto unwind;
c = next_char (dtp);
l_push_char (dtp, c);
+
+ /* Match NAN(alphanum). */
+ if (c == '(')
+ {
+ for (c = next_char (dtp); c != ')'; c = next_char (dtp))
+ if (is_separator (c))
+ goto unwind;
+ else
+ l_push_char (dtp, c);
+
+ l_push_char (dtp, ')');
+ c = next_char (dtp);
+ l_push_char (dtp, c);
+ }
}
if (!is_separator (c))
@@ -2077,7 +2106,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
/* If -std=f95/2003 or an array section is specified,
do not allow excess data to be processed. */
if (is_array_section == 1
- || compile_options.allow_std < GFC_STD_GNU)
+ || !(compile_options.allow_std & GFC_STD_GNU))
ls[dim].end = ls[dim].start;
else
dtp->u.p.expanded_read = 1;
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index 6aaa506d3f7..873d26c4d83 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -810,6 +810,66 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
if (w == 0)
goto zero;
+ /* Check for Infinity or NaN. */
+ if (unlikely ((w >= 3 && (*p == 'i' || *p == 'I' || *p == 'n' || *p == 'N'))))
+ {
+ int seen_paren = 0;
+ char *save = out;
+
+ /* Scan through the buffer keeping track of spaces and parenthesis. We
+ null terminate the string as soon as we see a left paren or if we are
+ BLANK_NULL mode. Leading spaces have already been skipped above,
+ trailing spaces are ignored by converting to '\0'. A space
+ between "NaN" and the optional perenthesis is not permitted. */
+ while (w > 0)
+ {
+ *out = tolower (*p);
+ switch (*p)
+ {
+ case ' ':
+ if (dtp->u.p.blank_status == BLANK_ZERO)
+ {
+ *out = '0';
+ break;
+ }
+ *out = '\0';
+ if (seen_paren == 1)
+ goto bad_float;
+ break;
+ case '(':
+ seen_paren++;
+ *out = '\0';
+ break;
+ case ')':
+ if (seen_paren++ != 1)
+ goto bad_float;
+ break;
+ default:
+ if (!isalnum (*out))
+ goto bad_float;
+ }
+ --w;
+ ++p;
+ ++out;
+ }
+
+ *out = '\0';
+
+ if (seen_paren != 0 && seen_paren != 2)
+ goto bad_float;
+
+ if ((strcmp (save, "inf") == 0) || (strcmp (save, "infinity") == 0))
+ {
+ if (seen_paren)
+ goto bad_float;
+ }
+ else if (strcmp (save, "nan") != 0)
+ goto bad_float;
+
+ convert_real (dtp, dest, buffer, length);
+ return;
+ }
+
/* Process the mantissa string. */
while (w > 0)
{
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 982d7d0b433..f44c02538a9 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -4,7 +4,7 @@
Namelist transfer functions contributed by Paul Thomas
F2003 I/O support contributed by Jerry DeLisle
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1042,7 +1042,7 @@ formatted_transfer_scalar_read (st_parameter_dt *dtp, bt type, void *p, int kind
case FMT_B:
if (n == 0)
goto need_read_data;
- if (compile_options.allow_std < GFC_STD_GNU
+ if (!(compile_options.allow_std & GFC_STD_GNU)
&& require_type (dtp, BT_INTEGER, type, f))
return;
read_radix (dtp, f, p, kind, 2);
@@ -1051,7 +1051,7 @@ formatted_transfer_scalar_read (st_parameter_dt *dtp, bt type, void *p, int kind
case FMT_O:
if (n == 0)
goto need_read_data;
- if (compile_options.allow_std < GFC_STD_GNU
+ if (!(compile_options.allow_std & GFC_STD_GNU)
&& require_type (dtp, BT_INTEGER, type, f))
return;
read_radix (dtp, f, p, kind, 8);
@@ -1060,7 +1060,7 @@ formatted_transfer_scalar_read (st_parameter_dt *dtp, bt type, void *p, int kind
case FMT_Z:
if (n == 0)
goto need_read_data;
- if (compile_options.allow_std < GFC_STD_GNU
+ if (!(compile_options.allow_std & GFC_STD_GNU)
&& require_type (dtp, BT_INTEGER, type, f))
return;
read_radix (dtp, f, p, kind, 16);
@@ -1443,7 +1443,7 @@ formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kin
case FMT_B:
if (n == 0)
goto need_data;
- if (compile_options.allow_std < GFC_STD_GNU
+ if (!(compile_options.allow_std & GFC_STD_GNU)
&& require_type (dtp, BT_INTEGER, type, f))
return;
write_b (dtp, f, p, kind);
@@ -1452,7 +1452,7 @@ formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kin
case FMT_O:
if (n == 0)
goto need_data;
- if (compile_options.allow_std < GFC_STD_GNU
+ if (!(compile_options.allow_std & GFC_STD_GNU)
&& require_type (dtp, BT_INTEGER, type, f))
return;
write_o (dtp, f, p, kind);
@@ -1461,7 +1461,7 @@ formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kin
case FMT_Z:
if (n == 0)
goto need_data;
- if (compile_options.allow_std < GFC_STD_GNU
+ if (!(compile_options.allow_std & GFC_STD_GNU)
&& require_type (dtp, BT_INTEGER, type, f))
return;
write_z (dtp, f, p, kind);
@@ -2267,15 +2267,25 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
return;
}
- if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL
- && (cf & IOPARM_DT_HAS_REC) != 0)
+ if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL)
{
- generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
- "Record number not allowed for sequential access "
- "data transfer");
- return;
- }
+ if ((cf & IOPARM_DT_HAS_REC) != 0)
+ {
+ generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
+ "Record number not allowed for sequential access "
+ "data transfer");
+ return;
+ }
+ if (dtp->u.p.current_unit->endfile == AFTER_ENDFILE)
+ {
+ generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
+ "Sequential READ or WRITE not allowed after "
+ "EOF marker, possibly use REWIND or BACKSPACE");
+ return;
+ }
+
+ }
/* Process the ADVANCE option. */
dtp->u.p.advance_status
diff --git a/libgfortran/mk-kinds-h.sh b/libgfortran/mk-kinds-h.sh
index c5d20fe12c5..a16f9850254 100755
--- a/libgfortran/mk-kinds-h.sh
+++ b/libgfortran/mk-kinds-h.sh
@@ -82,6 +82,12 @@ for k in $possible_real_kinds; do
echo "#define HAVE_GFC_REAL_${k}"
echo "#define HAVE_GFC_COMPLEX_${k}"
echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}"
+ echo "#define GFC_REAL_${k}_LITERAL_SUFFIX ${suffix}"
+ if [ "x$suffix" = "x" ]; then
+ echo "#define GFC_REAL_${k}_LITERAL(X) (X)"
+ else
+ echo "#define GFC_REAL_${k}_LITERAL(X) (X ## ${suffix})"
+ fi
echo "#define GFC_REAL_${k}_DIGITS ${digits}"
echo "#define GFC_REAL_${k}_RADIX ${radix}"
echo ""
diff --git a/libgfortran/mk-srk-inc.sh b/libgfortran/mk-srk-inc.sh
index 10c428f02d6..402441ce6f2 100755
--- a/libgfortran/mk-srk-inc.sh
+++ b/libgfortran/mk-srk-inc.sh
@@ -22,7 +22,7 @@ echo " type (real_info), parameter :: real_infos(c) = (/ &"
i=0
for k in $kinds; do
# echo -n is not portable
- str=" real_info ($k, precision(0.0_$k), range(0.0_$k))"
+ str=" real_info ($k, precision(0.0_$k), range(0.0_$k), radix(0.0_$k))"
i=`expr $i + 1`
if [ $i -lt $c ]; then
echo "$str, &"
diff --git a/libgfortran/runtime/compile_options.c b/libgfortran/runtime/compile_options.c
index c3d26f4148d..62c401be6b3 100644
--- a/libgfortran/runtime/compile_options.c
+++ b/libgfortran/runtime/compile_options.c
@@ -1,7 +1,7 @@
/* Handling of compile-time options that influence the library.
- Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -138,7 +138,7 @@ init_compile_options (void)
compile_options.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
compile_options.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
- | GFC_STD_GNU | GFC_STD_LEGACY;
+ | GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY;
compile_options.pedantic = 0;
compile_options.dump_core = 0;
compile_options.backtrace = 0;
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index c298ce95743..e2127b02702 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-10 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * libgomp.texi: Move to GFDL version 1.3. Update copyright years.
+
+2010-06-09 Iain Sandoe <iains@gcc.gnu.org>
+
+ PR bootstrap/43170
+ * configure: Regenerate.
+
2010-05-04 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR other/43620
diff --git a/libgomp/configure b/libgomp/configure
index 3b5b3494798..e9b3a656291 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -15380,7 +15380,7 @@ else
/* end confdefs.h. */
#include <pthread.h>
__thread int a;
- static int *a_in_other_thread;
+ static int *volatile a_in_other_thread;
static void *
thread_func (void *arg)
{
@@ -15392,11 +15392,11 @@ main ()
{
pthread_t thread;
void *thread_retval;
- int *a_in_main_thread;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
if (pthread_create (&thread, (pthread_attr_t *)0,
thread_func, (void *)0))
return 0;
- a_in_main_thread = &a;
if (pthread_join (thread, &thread_retval))
return 0;
return (a_in_other_thread == a_in_main_thread);
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index 5e68aad62ab..c7d7a15233c 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -7,10 +7,10 @@
@copying
-Copyright @copyright{} 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright @copyright{} 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
texts being (a) (see below), and with the Back-Cover Texts being (b)
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 520d5dc4a7b..a16e393d027 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,4 +1,40 @@
-2ß1ß-05-26 Kai Tietz <kai.tietz@onevision.com>
+2010-06-14 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * libiberty.texi: Remove reference to GCC 3 and 2001 (thrice).
+ Update copyright years.
+ Move to GFDL 1.3.
+
+2010-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR other/43838
+ * cp-demangle.c (struct d_print_info): Add flush_count field.
+ (d_print_init): Initialize it to 0.
+ (d_print_flush): Increment it.
+ (d_print_comp): If needed flush before appending ", ". Only
+ decrement dpi->len if no flushes happened during the recursive
+ call.
+ * testsuite/demangle-expected: Add a test for this.
+
+2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * splay-tree.c: Update copyright years.
+ (splay_tree_new_typed_alloc): New.
+ (splay_tree_new_with_allocator): Use it.
+
+ * hashtab.c: Update copyright years.
+ (htab_create_typed_alloc): New.
+ (htab_create_alloc): Use it.
+
+ * functions.texi: Regenerate.
+
+2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com>
+ Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ PR bootstrap/42798
+ * configure.ac: Check for declaration of 'basename(char *)'.
+ * configure: Regenerate.
+
+2010-05-26 Kai Tietz <kai.tietz@onevision.com>
* testsuite/demangle-expected: Add tests for __int128
and unsigned __int128 types.
diff --git a/libiberty/configure b/libiberty/configure
index 77aeb56c707..b47bc94248d 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -1904,8 +1904,10 @@ $as_echo "$ac_res" >&6; }
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
@@ -1915,8 +1917,12 @@ $4
int
main ()
{
-#ifndef $2
- (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
#endif
;
@@ -5310,8 +5316,8 @@ _ACEOF
fi
done
- ac_fn_c_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default"
-if test "x$ac_cv_have_decl_basename" = x""yes; then :
+ ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
+if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
ac_have_decl=1
else
ac_have_decl=0
@@ -6349,8 +6355,8 @@ _ACEOF
fi
done
- ac_fn_c_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default"
-if test "x$ac_cv_have_decl_basename" = x""yes; then :
+ ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
+if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
ac_have_decl=1
else
ac_have_decl=0
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index 515bb338441..32ec8d9c095 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -379,7 +379,7 @@ if test "x" = "y"; then
table times tmpnam \
vasprintf vfprintf vprintf vsprintf \
wait3 wait4 waitpid)
- AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf])
+ AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
@@ -663,7 +663,7 @@ if test -z "${setobjs}"; then
[AC_MSG_RESULT([no])])
AC_CHECK_FUNCS($checkfuncs)
- AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf])
+ AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk])
AC_CHECK_DECLS([strverscmp])
libiberty_NEED_DECLARATION(canonicalize_file_name)
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 6db1f78be3c..d2d15e9b91a 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -302,6 +302,8 @@ struct d_print_info
/* The current index into any template argument packs we are using
for printing. */
int pack_index;
+ /* Number of d_print_flush calls so far. */
+ unsigned long int flush_count;
};
#ifdef CP_DEMANGLE_DEBUG
@@ -3285,6 +3287,7 @@ d_print_init (struct d_print_info *dpi, int options,
dpi->last_char = '\0';
dpi->templates = NULL;
dpi->modifiers = NULL;
+ dpi->flush_count = 0;
dpi->callback = callback;
dpi->opaque = opaque;
@@ -3314,6 +3317,7 @@ d_print_flush (struct d_print_info *dpi)
dpi->buf[dpi->len] = '\0';
dpi->callback (dpi->buf, dpi->len, dpi->opaque);
dpi->len = 0;
+ dpi->flush_count++;
}
/* Append characters and buffers for printing. */
@@ -4047,12 +4051,18 @@ d_print_comp (struct d_print_info *dpi,
if (d_right (dc) != NULL)
{
size_t len;
+ unsigned long int flush_count;
+ /* Make sure ", " isn't flushed by d_append_string, otherwise
+ dpi->len -= 2 wouldn't work. */
+ if (dpi->len >= sizeof (dpi->buf) - 2)
+ d_print_flush (dpi);
d_append_string (dpi, ", ");
len = dpi->len;
+ flush_count = dpi->flush_count;
d_print_comp (dpi, d_right (dc));
/* If that didn't print anything (which can happen with empty
template argument packs), remove the comma and space. */
- if (dpi->len == len)
+ if (dpi->flush_count == flush_count && dpi->len == len)
dpi->len -= 2;
}
return;
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index 72ca56cbd44..d9fef8cb7b3 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -3,7 +3,7 @@
@c Edit the *.c files, configure with --enable-maintainer-mode,
@c run 'make stamp-functions' and gather-docs will build a new copy.
-@c safe-ctype.c:25
+@c splay-tree.c:277
@defvr Extension HOST_CHARSET
This macro indicates the basic character set and encoding used by the
host: more precisely, the encoding used for character constants in
@@ -24,6 +24,25 @@ The host character set is some variant of EBCDIC. (Only one of the
nineteen EBCDIC varying characters is tested; exercise caution.)
@end ftable
@end defvr
+@deftypefn Supplemental splay_tree splay_tree_new_with_typed_alloc
+(splay_tree_compare_fn @var{compare_fn},
+splay_tree_delete_key_fn @var{delete_key_fn},
+splay_tree_delete_value_fn @var{delete_value_fn},
+splay_tree_allocate_fn @var{tree_allocate_fn},
+splay_tree_allocate_fn @var{node_allocate_fn},
+splay_tree_deallocate_fn @var{deallocate_fn},
+void * @var{allocate_data})
+
+This function creates a splay tree that uses two different allocators
+@var{tree_allocate_fn} and @var{node_allocate_fn} to use for allocating the
+tree itself and its nodes respectively. This is useful when variables of
+different types need to be allocated with different allocators.
+
+The splay tree will use @var{compare_fn} to compare nodes,
+@var{delete_key_fn} to deallocate keys, and @var{delete_value_fn} to
+deallocate values.
+
+@end deftypefn
@c alloca.c:26
@deftypefn Replacement void* alloca (size_t @var{size})
@@ -477,6 +496,24 @@ systems.
@end deftypefn
+@c hashtab.c:336
+@deftypefn Supplemental htab_t htab_create_typed_alloc (size_t @var{size},
+htab_hash @var{hash_f}, htab_eq @var{eq_f}, htab_del @var{del_f},
+htab_alloc @var{alloc_tab_f}, htab_alloc @var{alloc_f},
+htab_free @var{free_f})
+
+This function creates a hash table that uses two different allocators
+@var{alloc_tab_f} and @var{alloc_f} to use for allocating the table itself
+and its entries respectively. This is useful when variables of different
+types need to be allocated with different allocators.
+
+The created hash table is slightly larger than @var{size} and it is
+initially empty (all the hash table entries are @code{HTAB_EMPTY_ENTRY}).
+The function returns the created hash table, or @code{NULL} if memory
+allocation fails.
+
+@end deftypefn
+
@c index.c:5
@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 8c89bfcd839..359e3ea569e 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -1,5 +1,5 @@
/* An expandable hash tables datatype.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
@@ -291,20 +291,33 @@ htab_t
htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f,
htab_del del_f, htab_alloc alloc_f, htab_free free_f)
{
+ return htab_create_typed_alloc (size, hash_f, eq_f, del_f, alloc_f, alloc_f,
+ free_f);
+}
+
+/* As above, but uses the variants of ALLOC_F and FREE_F which accept
+ an extra argument. */
+
+htab_t
+htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f,
+ htab_del del_f, void *alloc_arg,
+ htab_alloc_with_arg alloc_f,
+ htab_free_with_arg free_f)
+{
htab_t result;
unsigned int size_prime_index;
size_prime_index = higher_prime_index (size);
size = prime_tab[size_prime_index].prime;
- result = (htab_t) (*alloc_f) (1, sizeof (struct htab));
+ result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab));
if (result == NULL)
return NULL;
- result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR));
+ result->entries = (PTR *) (*alloc_f) (alloc_arg, size, sizeof (PTR));
if (result->entries == NULL)
{
if (free_f != NULL)
- (*free_f) (result);
+ (*free_f) (alloc_arg, result);
return NULL;
}
result->size = size;
@@ -312,19 +325,37 @@ htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f,
result->hash_f = hash_f;
result->eq_f = eq_f;
result->del_f = del_f;
- result->alloc_f = alloc_f;
- result->free_f = free_f;
+ result->alloc_arg = alloc_arg;
+ result->alloc_with_arg_f = alloc_f;
+ result->free_with_arg_f = free_f;
return result;
}
-/* As above, but use the variants of alloc_f and free_f which accept
- an extra argument. */
+/*
+
+@deftypefn Supplemental htab_t htab_create_typed_alloc (size_t @var{size},
+htab_hash @var{hash_f}, htab_eq @var{eq_f}, htab_del @var{del_f},
+htab_alloc @var{alloc_tab_f}, htab_alloc @var{alloc_f},
+htab_free @var{free_f})
+
+This function creates a hash table that uses two different allocators
+@var{alloc_tab_f} and @var{alloc_f} to use for allocating the table itself
+and its entries respectively. This is useful when variables of different
+types need to be allocated with different allocators.
+
+The created hash table is slightly larger than @var{size} and it is
+initially empty (all the hash table entries are @code{HTAB_EMPTY_ENTRY}).
+The function returns the created hash table, or @code{NULL} if memory
+allocation fails.
+
+@end deftypefn
+
+*/
htab_t
-htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f,
- htab_del del_f, void *alloc_arg,
- htab_alloc_with_arg alloc_f,
- htab_free_with_arg free_f)
+htab_create_typed_alloc (size_t size, htab_hash hash_f, htab_eq eq_f,
+ htab_del del_f, htab_alloc alloc_tab_f,
+ htab_alloc alloc_f, htab_free free_f)
{
htab_t result;
unsigned int size_prime_index;
@@ -332,14 +363,14 @@ htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f,
size_prime_index = higher_prime_index (size);
size = prime_tab[size_prime_index].prime;
- result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab));
+ result = (htab_t) (*alloc_tab_f) (1, sizeof (struct htab));
if (result == NULL)
return NULL;
- result->entries = (PTR *) (*alloc_f) (alloc_arg, size, sizeof (PTR));
+ result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR));
if (result->entries == NULL)
{
if (free_f != NULL)
- (*free_f) (alloc_arg, result);
+ (*free_f) (result);
return NULL;
}
result->size = size;
@@ -347,12 +378,12 @@ htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f,
result->hash_f = hash_f;
result->eq_f = eq_f;
result->del_f = del_f;
- result->alloc_arg = alloc_arg;
- result->alloc_with_arg_f = alloc_f;
- result->free_with_arg_f = free_f;
+ result->alloc_f = alloc_f;
+ result->free_f = free_f;
return result;
}
+
/* Update the function pointers and allocation parameter in the htab_t. */
void
diff --git a/libiberty/libiberty.texi b/libiberty/libiberty.texi
index 9fd6f786b48..74f70d2bd5a 100644
--- a/libiberty/libiberty.texi
+++ b/libiberty/libiberty.texi
@@ -21,15 +21,14 @@
@code{libiberty}
@end macro
-@c The edition date is written in three locations. Search for 'thedate'.
@ifinfo
This manual describes the GNU @libib library of utility subroutines.
-This edition accompanies GCC 3, September 2001.
-Copyright @copyright{} 2001 Free Software Foundation, Inc.
+Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+2009, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.2
+ under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
@@ -45,20 +44,18 @@ notice identical to this one except for the removal of this paragraph
@end ifinfo
-@c The edition date is written in three locations. Search for 'thedate'.
@titlepage
@title @sc{gnu} libiberty
-@subtitle September 2001
-@subtitle for GCC 3
@author Phil Edwards et al.
@page
@vskip 0pt plus 1filll
-Copyright @copyright{} 2001 Free Software Foundation, Inc.
+Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+2009, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.2
+ under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
@@ -76,9 +73,6 @@ The @libib{} library is a collection of subroutines used by various
GNU programs. It is available under the Library General Public
License; for more information, see @ref{Library Copying}.
-@c The edition date is written in three locations. Search for 'thedate'.
-This edition accompanies GCC 3, September 2001.
-
@end ifnottex
@menu
diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c
index d7ed86813dc..bf1a0f3f151 100644
--- a/libiberty/splay-tree.c
+++ b/libiberty/splay-tree.c
@@ -1,5 +1,6 @@
/* A splay-tree datatype.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2009,
+ 2010 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC.
@@ -265,13 +266,53 @@ splay_tree_new_with_allocator (splay_tree_compare_fn compare_fn,
splay_tree_deallocate_fn deallocate_fn,
void *allocate_data)
{
- splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s),
- allocate_data);
+ return
+ splay_tree_new_typed_alloc (compare_fn, delete_key_fn, delete_value_fn,
+ allocate_fn, allocate_fn, deallocate_fn,
+ allocate_data);
+}
+
+/*
+
+@deftypefn Supplemental splay_tree splay_tree_new_with_typed_alloc
+(splay_tree_compare_fn @var{compare_fn},
+splay_tree_delete_key_fn @var{delete_key_fn},
+splay_tree_delete_value_fn @var{delete_value_fn},
+splay_tree_allocate_fn @var{tree_allocate_fn},
+splay_tree_allocate_fn @var{node_allocate_fn},
+splay_tree_deallocate_fn @var{deallocate_fn},
+void * @var{allocate_data})
+
+This function creates a splay tree that uses two different allocators
+@var{tree_allocate_fn} and @var{node_allocate_fn} to use for allocating the
+tree itself and its nodes respectively. This is useful when variables of
+different types need to be allocated with different allocators.
+
+The splay tree will use @var{compare_fn} to compare nodes,
+@var{delete_key_fn} to deallocate keys, and @var{delete_value_fn} to
+deallocate values.
+
+@end deftypefn
+
+*/
+
+splay_tree
+splay_tree_new_typed_alloc (splay_tree_compare_fn compare_fn,
+ splay_tree_delete_key_fn delete_key_fn,
+ splay_tree_delete_value_fn delete_value_fn,
+ splay_tree_allocate_fn tree_allocate_fn,
+ splay_tree_allocate_fn node_allocate_fn,
+ splay_tree_deallocate_fn deallocate_fn,
+ void * allocate_data)
+{
+ splay_tree sp = (splay_tree) (*tree_allocate_fn)
+ (sizeof (struct splay_tree_s), allocate_data);
+
sp->root = 0;
sp->comp = compare_fn;
sp->delete_key = delete_key_fn;
sp->delete_value = delete_value_fn;
- sp->allocate = allocate_fn;
+ sp->allocate = node_allocate_fn;
sp->deallocate = deallocate_fn;
sp->allocate_data = allocate_data;
@@ -313,10 +354,10 @@ splay_tree_insert (splay_tree sp, splay_tree_key key, splay_tree_value value)
{
/* Create a new node, and insert it at the root. */
splay_tree_node node;
-
+
node = ((splay_tree_node)
- (*sp->allocate) (sizeof (struct splay_tree_node_s),
- sp->allocate_data));
+ (*sp->allocate) (sizeof (struct splay_tree_node_s),
+ sp->allocate_data));
node->key = key;
node->value = value;
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index ef84bc113a8..15a0fe75509 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -3951,6 +3951,9 @@ decltype (({parm#1}.(operator-))()) h<A>(A)
--format=gnu-v3
_Z1fDn
f(decltype(nullptr))
+--format=gnu-v3
+_ZN5aaaaa6bbbbbb5cccccIN23ddddddddddddddddddddddd3eeeENS2_4ffff16ggggggggggggggggENS0_9hhhhhhhhhES6_S6_S6_S6_S6_S6_S6_EE
+aaaaa::bbbbbb::ccccc<ddddddddddddddddddddddd::eee, ddddddddddddddddddddddd::ffff::gggggggggggggggg, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh>
#
# Ada (GNAT) tests.
#
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 1aaefa4e103..f90cd353ea0 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,22 @@
+2010-06-10 Peter O'Gorman <peter@pogma.com>
+
+ * configure.ac: Set SYSTEMSPEC so that -allow_stack_execute is not
+ passed to the linker for -dynamiclib or -bundle on darwin.
+ * configure: Regenerate.
+
+2010-06-09 Iain Sandoe <iains@gcc.gnu.org>
+
+ PR bootstrap/43170
+ * configure: Regenerate.
+
+2010-06-03 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure: Regenerate.
+
+2010-06-03 Matthias Klose <doko@ubuntu.com>
+
+ * libtool-version: Bump soversion.
+
2010-05-29 Mike Stump <mikestump@comcast.net>
* configure.ac: Add multilib support for gmp. Proper -I and -L
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index a12288ce72c..b7a9a4c92cd 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-04 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * scripts/check_jni_methods.sh.in: Don't use diff -U.
+ Adapt grep regex, ignore file and problem message.
+
+2010-06-03 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure: Regenerate.
+
2010-05-04 Andrew Haley <aph@redhat.com>
* lib/gen-classlist.sh.in: Use absolute pathnames for all the
diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj
index 43efda4dc3c..25a4d4da08f 100644
--- a/libjava/classpath/ChangeLog.gcj
+++ b/libjava/classpath/ChangeLog.gcj
@@ -1,3 +1,8 @@
+2010-06-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * doc/Makefile.am (POD2MAN): Provide --date from ChangeLog.
+ * doc/Makefile.in: Regenerate.
+
2010-04-07 Jakub Jelinek <jakub@redhat.com>
* native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index e452d98c4c4..b98c8e84a67 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -2312,8 +2312,10 @@ $as_echo "$ac_res" >&6; }
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
@@ -2323,8 +2325,12 @@ $4
int
main ()
{
-#ifndef $2
- (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
#endif
;
@@ -11812,7 +11818,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11815 "configure"
+#line 11821 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11918,7 +11924,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11921 "configure"
+#line 11927 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -21937,10 +21943,10 @@ fi
gmplibs=-lgmp
gmpinc=
gmplibs="-L$with_gmp/lib $gmplibs"
+ gmpinc="-I$with_gmp/include $gmpinc"
if test "x$with_gmp_include" != x; then
gmpinc="-I$with_gmp_include $gmpinc"
fi
- gmpinc="-I$with_gmp/include $gmpinc"
if test "x$with_gmp_lib" != x; then
gmplibs="-L$with_gmp_lib $gmplibs"
fi
@@ -23728,7 +23734,7 @@ EOF
if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes
else
- echo "configure: 23731: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
+ echo "configure: 23737: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5
cat Test.uue >&5
ac_cv_prog_uudecode_base64=no
@@ -23873,7 +23879,7 @@ else
JAVA_TEST=Object.java
CLASS_TEST=Object.class
cat << \EOF > $JAVA_TEST
-/* #line 23876 "configure" */
+/* #line 23882 "configure" */
package java.lang;
public class Object
@@ -23920,7 +23926,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class
TEST=Test
cat << \EOF > $JAVA_TEST
-/* [#]line 23923 "configure" */
+/* [#]line 23929 "configure" */
public class Test {
public static void main (String args[]) {
System.exit (0);
@@ -24246,7 +24252,7 @@ else
JAVA_TEST=Object.java
CLASS_TEST=Object.class
cat << \EOF > $JAVA_TEST
-/* #line 24249 "configure" */
+/* #line 24255 "configure" */
package java.lang;
public class Object
@@ -24285,7 +24291,7 @@ fi
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
- /* #line 24288 "configure" */
+ /* #line 24294 "configure" */
public class Test
{
public static void main(String args)
diff --git a/libjava/classpath/doc/Makefile.am b/libjava/classpath/doc/Makefile.am
index aca54315859..a5f19b7e5da 100644
--- a/libjava/classpath/doc/Makefile.am
+++ b/libjava/classpath/doc/Makefile.am
@@ -31,7 +31,7 @@ TOOLS_MANFILES = \
gtnameserv.1 \
gjdoc.1
-POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
+POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date=$(shell sed -n '1s/ .*//p' <$(srcdir)/../ChangeLog)
TEXI2POD = perl $(srcdir)/texi2pod.pl
STAMP = echo timestamp >
diff --git a/libjava/classpath/doc/Makefile.in b/libjava/classpath/doc/Makefile.in
index 9055bb2bcbf..f5955e12234 100644
--- a/libjava/classpath/doc/Makefile.in
+++ b/libjava/classpath/doc/Makefile.in
@@ -376,7 +376,7 @@ TOOLS_MANFILES = \
gtnameserv.1 \
gjdoc.1
-POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
+POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date=$(shell sed -n '1s/ .*//p' <$(srcdir)/../ChangeLog)
TEXI2POD = perl $(srcdir)/texi2pod.pl
STAMP = echo timestamp >
@GENINSRC_FALSE@STAMP_GENINSRC =
diff --git a/libjava/classpath/scripts/check_jni_methods.sh.in b/libjava/classpath/scripts/check_jni_methods.sh.in
index cf300941876..facf34b345b 100644
--- a/libjava/classpath/scripts/check_jni_methods.sh.in
+++ b/libjava/classpath/scripts/check_jni_methods.sh.in
@@ -36,23 +36,23 @@ rm $TMPFILE3
# Write temporary ignore file.
cat > $TMPFILE3 << EOF
--Java_gnu_java_awt_peer_gtk_GtkMenuComponentPeer_dispose
--Java_java_lang_VMSystem_arraycopy
--Java_java_lang_VMSystem_identityHashCode
+< Java_gnu_java_awt_peer_gtk_GtkMenuComponentPeer_dispose
+< Java_java_lang_VMSystem_arraycopy
+< Java_java_lang_VMSystem_identityHashCode
EOF
# Compare again silently.
# Use fgrep and direct the output to /dev/null for compatibility with older
# grep instead of using the non portable -q.
-if diff -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | \
+if diff $TMPFILE $TMPFILE2 | grep '^[<>] Java' | \
fgrep -v -f $TMPFILE3 > /dev/null;
then
PROBLEM=1
echo "Found a problem with the JNI methods declared and implemented."
- echo "(-) missing in implementation, (+) missing in header files"
+ echo "(<) missing in implementation, (>) missing in header files"
# Compare the found method lists.
- diff -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | fgrep -v -f $TMPFILE3
+ diff $TMPFILE $TMPFILE2 | grep '^[<>] Java' | fgrep -v -f $TMPFILE3
fi
# Cleanup.
diff --git a/libjava/configure b/libjava/configure
index 06ba4e98b41..7ca3dcfb5b3 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -2315,8 +2315,10 @@ $as_echo "$ac_res" >&6; }
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
@@ -2326,8 +2328,12 @@ $4
int
main ()
{
-#ifndef $2
- (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
#endif
;
@@ -13339,7 +13345,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13342 "configure"
+#line 13348 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13445,7 +13451,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13448 "configure"
+#line 13454 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19424,7 +19430,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then :
enableval=$enable_sjlj_exceptions; :
else
cat > conftest.$ac_ext << EOF
-#line 19427 "configure"
+#line 19433 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -19755,7 +19761,7 @@ case "${host}" in
fi
;;
*-*-darwin[912]*)
- SYSTEMSPEC="-allow_stack_execute"
+ SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}"
;;
*)
SYSTEMSPEC=
@@ -24384,7 +24390,7 @@ else
/* end confdefs.h. */
#include <pthread.h>
__thread int a;
- static int *a_in_other_thread;
+ static int *volatile a_in_other_thread;
static void *
thread_func (void *arg)
{
@@ -24396,11 +24402,11 @@ main ()
{
pthread_t thread;
void *thread_retval;
- int *a_in_main_thread;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
if (pthread_create (&thread, (pthread_attr_t *)0,
thread_func, (void *)0))
return 0;
- a_in_main_thread = &a;
if (pthread_join (thread, &thread_retval))
return 0;
return (a_in_other_thread == a_in_main_thread);
diff --git a/libjava/configure.ac b/libjava/configure.ac
index a359afed7bd..f21ae91d18a 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -883,7 +883,7 @@ case "${host}" in
fi
;;
*-*-darwin[[912]]*)
- SYSTEMSPEC="-allow_stack_execute"
+ SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}"
;;
*)
SYSTEMSPEC=
diff --git a/libjava/libtool-version b/libjava/libtool-version
index 7af63f67bad..834eb964fd8 100644
--- a/libjava/libtool-version
+++ b/libjava/libtool-version
@@ -3,4 +3,4 @@
# a separate file so that version updates don't involve re-running
# automake.
# CURRENT:REVISION:AGE
-11:0:0
+12:0:0
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index 8ea482cd37d..aa88a7326eb 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-09 Iain Sandoe <iains@gcc.gnu.org>
+
+ PR bootstrap/43170
+ * configure: Regenerate.
+
2010-05-16 Uros Bizjak <ubizjak@gmail.com>
* testsuite/libmudflap.c/pass46-frag.c (dg-options): Remove -Wall.
diff --git a/libmudflap/configure b/libmudflap/configure
index 65b2daa3979..03aec3f3729 100755
--- a/libmudflap/configure
+++ b/libmudflap/configure
@@ -11479,7 +11479,7 @@ else
/* end confdefs.h. */
#include <pthread.h>
__thread int a;
- static int *a_in_other_thread;
+ static int *volatile a_in_other_thread;
static void *
thread_func (void *arg)
{
@@ -11491,11 +11491,11 @@ main ()
{
pthread_t thread;
void *thread_retval;
- int *a_in_main_thread;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
if (pthread_create (&thread, (pthread_attr_t *)0,
thread_func, (void *)0))
return 0;
- a_in_main_thread = &a;
if (pthread_join (thread, &thread_retval))
return 0;
return (a_in_other_thread == a_in_main_thread);
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a986e8d6325..dfb651e96a1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,1347 @@
+2010-06-29 Jason Merrill <jason@redhat.com>
+
+ Enable implicitly declared move constructor/operator= (N3053).
+ * include/bits/unordered_map.h: Explicitly default copy constructors.
+ * include/bits/unordered_set.h: Likewise.
+
+ * 19_diagnostics/error_category/cons/copy_neg.cc: Adjust expected
+ errors, use dg-prune-output.
+ * 20_util/function/cmp/cmp_neg.cc: Likewise.
+ * 20_util/unique_ptr/assign/assign_neg.cc: Likewise.
+ * 20_util/unique_ptr/cons/pointer_array_convertible.cc: Likewise.
+ * 20_util/unique_ptr/modifiers/reset_neg.cc: Likewise.
+ * 29_atomics/atomic/cons/assign_neg.cc: Likewise.
+ * 29_atomics/atomic/cons/copy_neg.cc: Likewise.
+ * 29_atomics/atomic_address/cons/assign_neg.cc: Likewise.
+ * 29_atomics/atomic_address/cons/copy_neg.cc: Likewise.
+ * 29_atomics/atomic_flag/cons/assign_neg.cc: Likewise.
+ * 29_atomics/atomic_flag/cons/copy_neg.cc: Likewise.
+ * 29_atomics/atomic_integral/cons/assign_neg.cc: Likewise.
+ * 29_atomics/atomic_integral/cons/copy_neg.cc: Likewise.
+ * 29_atomics/condition_variable/cons/assign_neg.cc: Likewise.
+ * 30_threads/condition_variable/cons/copy_neg.cc: Likewise.
+ * 30_threads/condition_variable_any/cons/assign_neg.cc: Likewise.
+ * 30_threads/condition_variable_any/cons/copy_neg.cc: Likewise.
+ * 30_threads/future/cons/assign_neg.cc: Likewise.
+ * 30_threads/future/cons/copy_neg.cc: Likewise.
+ * 30_threads/mutex/cons/assign_neg.cc: Likewise.
+ * 30_threads/mutex/cons/copy_neg.cc: Likewise.
+ * 30_threads/packaged_task/cons/assign_neg.cc: Likewise.
+ * 30_threads/packaged_task/cons/copy_neg.cc: Likewise.
+ * 30_threads/promise/cons/assign_neg.cc: Likewise.
+ * 30_threads/promise/cons/copy_neg.cc: Likewise.
+ * 30_threads/recursive_mutex/cons/assign_neg.cc: Likewise.
+ * 30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
+ * 30_threads/recursive_timed_mutex/cons/assign_neg.cc: Likewise.
+ * 30_threads/recursive_timed_mutex/cons/copy_neg.cc: Likewise.
+ * 30_threads/thread/cons/assign_neg.cc: Likewise.
+ * 30_threads/thread/cons/copy_neg.cc: Likewise.
+ * 30_threads/timed_mutex/cons/assign_neg.cc: Likewise.
+ * 30_threads/timed_mutex/cons/copy_neg.cc: Likewise.
+ * ext/ext_pointer/1_neg.cc: Likewise.
+
+2010-06-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44708
+ * include/ext/algorithm (copy_n): Qualify __copy_n call with
+ __gnu_cxx::
+ * testsuite/ext/rope/44708.cc: New.
+
+2010-06-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/regex_compiler.h: Trivial formatting / stylistic fixes.
+ * include/bits/regex_grep_matcher.tcc: Likewise.
+ * include/bits/regex_cursor.h: Likewise.
+ * include/bits/regex.h: Likewise.
+
+2010-06-26 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/util/testsuite_hooks.h: Cast fn to bool.
+
+2010-06-26 Kees Cook <kees.cook@canonical.com>
+
+ * testsuite/27_io/ios_base/sync_with_stdio/1.cc: Verify freopen.
+ * testsuite/27_io/objects/wchar_t/9520.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/9661-1.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/12048-2.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/12048-4.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/11.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/12048-1.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/12048-3.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/10.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/12048-5.cc: Likewise.
+ * testsuite/27_io/objects/char/9661-1.cc: Likewise.
+ * testsuite/27_io/objects/char/12048-2.cc: Likewise.
+ * testsuite/27_io/objects/char/12048-4.cc: Likewise.
+ * testsuite/27_io/objects/char/9.cc: Likewise.
+ * testsuite/27_io/objects/char/12048-1.cc: Likewise.
+ * testsuite/27_io/objects/char/12048-3.cc: Likewise.
+ * testsuite/27_io/objects/char/12048-5.cc: Likewise.
+ * testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/setbuf/char/12875-2.cc: Verify fgets.
+ * testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-2.cc: Verify
+ fwrite.
+ * testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc: Likewise.
+ * testsuite/ext/stdio_sync_filebuf/char/1.cc: Likewise.
+
+2010-06-26 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * doc/xml/faq.xml: Fix typo.
+ * doc/html/faq.xml: Likewise.
+
+2010-06-25 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+
+ Initial regex implementation.
+ * include/std/regex: Modified to use bits/regex_* headers.
+ * include/bits/regex_compiler.h: New.
+ * include/bits/regex_constants.h: Likewise.
+ * include/bits/regex_cursor.h: Likewise.
+ * include/bits/regex_error.h: Likewise.
+ * include/bits/regex_grep_matcher.h: Likewise.
+ * include/bits/regex_grep_matcher.tcc: Likewise.
+ * include/bits/regex.h: Likewise.
+ * include/bits/regex_nfa.h: Likewise.
+ * include/bits/regex_nfa.tcc: Likewise.
+ * include/Makefile.am: Add.
+ * include/Makefile.in: Regenerated.
+ * testsuite/28_regex/02_definitions: New.
+ * testsuite/28_regex/03_requirements: Likewise.
+ * testsuite/28_regex/03_requirements/typedefs.cc: Likewise.
+ * testsuite/28_regex/04_header: Likewise.
+ * testsuite/28_regex/04_header/regex: Likewise.
+ * testsuite/28_regex/04_header/regex/std_c++0x_neg.cc: Likewise.
+ * testsuite/28_regex/05_constants: Likewise.
+ * testsuite/28_regex/05_constants/error_type.cc: Likewise.
+ * testsuite/28_regex/05_constants/match_flag_type.cc: Likewise.
+ * testsuite/28_regex/05_constants/syntax_option_type.cc: Likewise.
+ * testsuite/28_regex/06_exception_type: Likewise.
+ * testsuite/28_regex/06_exception_type/regex_error.cc: Likewise.
+ * testsuite/28_regex/07_traits: Likewise.
+ * testsuite/28_regex/07_traits/char: Likewise.
+ * testsuite/28_regex/07_traits/char/ctor.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/isctype.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/length.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/lookup_classname.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/lookup_collatename.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/transform.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/transform_primary.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/translate.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/translate_nocase.cc: Likewise.
+ * testsuite/28_regex/07_traits/char/value.cc: Likewise.
+ * testsuite/28_regex/07_traits/wchar_t: Likewise.
+ * testsuite/28_regex/07_traits/wchar_t/ctor.cc: Likewise.
+ * testsuite/28_regex/07_traits/wchar_t/length.cc: Likewise.
+ * testsuite/28_regex/07_traits/wchar_t/transform.cc: Likewise.
+ * testsuite/28_regex/07_traits/wchar_t/translate.cc: Likewise.
+ * testsuite/28_regex/07_traits/wchar_t/translate_nocase.cc: Likewise.
+ * testsuite/28_regex/07_traits/wchar_t/value.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char/cstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char/cstring_op.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char/moveable.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char/pstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char/range.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char/string.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/char/string_op.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/wchar_t: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring_op.cc:
+ Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/wchar_t/pstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/wchar_t/range.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/wchar_t/string.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/assign/wchar_t/string_op.cc:
+ Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/basic: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/basic/cstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/basic/pstring_char.cc:
+ Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/basic/pstring_wchar_t.cc:
+ Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/basic/
+ string_range_01_02_03.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char/cstring_awk.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char/cstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char/cstring_ecma.cc:
+ Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char/cstring_egrep.cc:
+ Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char/cstring_grep.cc:
+ Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char/default.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/char/range.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/copy_char.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/extended: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/extended/cstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/extended/
+ string_range_01_02_03.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/move_char.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/string_char.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/string_wchar_t.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/wchar_t: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/wchar_t/cstring.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/wchar_t/default.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/ctors/wchar_t/range.cc: Likewise.
+ * testsuite/28_regex/08_basic_regex/regex.cc: Likewise.
+ * testsuite/28_regex/09_sub_match: Likewise.
+ * testsuite/28_regex/09_sub_match/cast_char.cc: Likewise.
+ * testsuite/28_regex/09_sub_match/cast_wchar_t.cc: Likewise.
+ * testsuite/28_regex/09_sub_match/length.cc: Likewise.
+ * testsuite/28_regex/09_sub_match/typedefs.cc: Likewise.
+ * testsuite/28_regex/10_match_results: Likewise.
+ * testsuite/28_regex/10_match_results/ctors: Likewise.
+ * testsuite/28_regex/10_match_results/ctors/char: Likewise.
+ * testsuite/28_regex/10_match_results/ctors/char/default.cc: Likewise.
+ * testsuite/28_regex/10_match_results/ctors/wchar_t: Likewise.
+ * testsuite/28_regex/10_match_results/ctors/wchar_t/default.cc:
+ Likewise.
+ * testsuite/28_regex/10_match_results/typedefs.cc: Likewise.
+ * testsuite/28_regex/11_algorithms: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/basic: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/basic/string_01.cc:
+ Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/basic/
+ string_range_00_03.cc: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/basic/
+ string_range_01_03.cc: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/basic/
+ string_range_02_03.cc: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/extended: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/extended/cstring_plus.cc:
+ Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/extended/
+ cstring_questionmark.cc: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/extended/string_any.cc:
+ Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/extended/
+ string_range_00_03.cc: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/extended/
+ string_range_01_03.cc: Likewise.
+ * testsuite/28_regex/11_algorithms/02_match/extended/
+ string_range_02_03.cc: Likewise.
+ * testsuite/28_regex/12_iterators: Likewise.
+ * testsuite/28_regex/12_iterators/regex_iterator: Likewise.
+ * testsuite/28_regex/12_iterators/regex_iterator/ctors: Likewise.
+ * testsuite/28_regex/12_iterators/regex_iterator/ctors/char: Likewise.
+ * testsuite/28_regex/12_iterators/regex_iterator/ctors/char/
+ default.cc: Likewise.
+ * testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t:
+ Likewise.
+ * testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t/
+ default.cc: Likewise.
+ * testsuite/28_regex/12_iterators/regex_iterator/typedefs.cc: Likewise.
+ * testsuite/28_regex/12_iterators/regex_token_iterator: Likewise.
+ * testsuite/28_regex/12_iterators/regex_token_iterator/ctors: Likewise.
+ * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char:
+ Likewise.
+ * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char/
+ default.cc: Likewise.
+ * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/
+ wchar_t: Likewise.
+ * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/
+ wchar_t/default.cc: Likewise.
+ * testsuite/28_regex/12_iterators/regex_token_iterator/
+ typedefs.cc: Likewise.
+ * testsuite/28_regex/13_ecmascript: Likewise.
+
+2010-06-25 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/profile/impl/profiler_list_to_slist.h: Remove spurious
+ semicolon; prefer pre-increment.
+ * include/profile/impl/profiler_container_size.h: Use everywhere
+ qualified std::size_t.
+ * include/profile/impl/profiler_trace.h (__trace_base<>::
+ __collect_warnings): Tidy loop.
+ * include/profile/impl/profiler_vector_to_list.h: Minor formatting
+ changes.
+
+2010-06-25 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/profile/impl/profiler_trace.h: Uglify it to __it, use
+ everywhere std::size_t instead of size_t.
+
+2010-06-24 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/profile/impl/profiler_trace.h (__trace_base<>::
+ __trace_base()): Move inline, simplify; formatting tweaks.
+ * include/profile/impl/profiler_hash_func.h: Formatting tweaks.
+
+2010-06-24 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/profile/impl/profiler_trace.h (__warning_data::
+ __warning_message): Change to std::string; clean-up includes,
+ qualify size_t, fprintf, etc, with std everywhere.
+ (struct __warn::operator()): Adjust.
+ * include/profile/impl/profiler_list_to_slist.h
+ (__list2slist_info::__advice): Change to return a std::string;
+ clean-up includes, qualify size_t, fprintf, etc, with std.
+ * include/profile/impl/profiler_container_size.h
+ (__container_size_info::__advice): Likewise.
+ * include/profile/impl/profiler_hash_func.h (__hashfunc_info::
+ __advice): Likewise.
+ * include/profile/impl/profiler_list_to_vector.h
+ (__list2vector_info::__advice): Likewise.
+ * include/profile/impl/profiler_vector_to_list.h
+ (__vector2list_info::__advice): Likewise.
+ * include/profile/impl/profiler_map_to_unordered_map.h
+ (__map2umap_info::__advice): Likewise.
+ * include/profile/impl/profiler.h: Likewise.
+ * include/profile/impl/profiler_hashtable_size.h: Likewise.
+ * include/profile/impl/profiler_node.h: Likewise.
+ * include/profile/impl/profiler_vector_size.h: Likewise.
+
+ * include/profile/iterator_tracker.h: Formatting and stylistic
+ tweaks.
+ * include/profile/base.h: Likewise.
+ * include/profile/map.h: Likewise.
+
+2010-06-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/stl_tree.h (erase(iterator), erase(const_iterator)):
+ Remove inline specifier.
+
+2010-06-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/profile/impl/profiler_list_to_slist.h: Fix formatting,
+ other minor stylistic changes.
+ * include/profile/impl/profiler_container_size.h: Likewise.
+ * include/profile/impl/profiler_vector_size.h: Likewise.
+ * include/profile/impl/profiler_hash_func.h: Likewise.
+ * include/profile/impl/profiler_trace.h: Likewise.
+ * include/profile/impl/profiler_list_to_vector.h: Likewise.
+ * include/profile/impl/profiler_vector_to_list.h: Likewise.
+ * include/profile/impl/profiler_state.h: Likewise.
+ * include/profile/impl/profiler_map_to_unordered_map.h: Likewise.
+ * include/profile/impl/profiler_hashtable_size.h: Likewise.
+ * include/profile/impl/profiler_node.h: Likewise.
+
+2010-06-22 Matthias Klose <doko@ubuntu.com>
+
+ * python/libstdcxx/v6/printers.py: Don't use string exceptions.
+
+2010-06-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44630
+ * include/profile/impl/profiler_trace.h (__min, __max): Remove,
+ use std::min, std::max everywhere.
+ * include/profile/impl/profiler_container_size.h: Use std::min and
+ std::max.
+ * include/profile/impl/profiler_hash_func.h: Likewise.
+ * include/profile/impl/profiler_list_to_vector.h: Likewise.
+
+2010-06-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc:
+ Add *-*-solaris2.1[0-9]* to dg-xfail-if, dg-excess-errors.
+
+2010-06-20 Paolo Carlini <paolo.carlini@oracle.com>
+ Kai-Uwe Bux <bux@kubux.net>
+
+ * include/bits/random.tcc (uniform_int_distribution<>::operator()):
+ Fix to work well for arbitrary urng.max() and urng.min().
+
+2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/32618
+ * include/bits/stl_list.h (vector<>::_M_default_initialize,
+ _M_default_append): Declare.
+ (list<>::list(size_type), resize(size_type)): Add in C++0x mode,
+ use the latter.
+ * include/bits/list.tcc (list<>::resize, _M_default_append): Define.
+ * include/bits/stl_vector.h (vector<>::_M_default_initialize,
+ _M_default_append): Declare.
+ (vector<>::vector(size_type), resize(size_type)): Add in C++0x mode,
+ use the latter.
+ * include/bits/vector.tcc (vector<>::_M_default_append): Define.
+ * include/bits/stl_deque.h (deque<>::_M_default_initialize,
+ _M_default_append): Declare.
+ (deque<>::deque(size_type), resize(size_type)): Add in C++0x mode,
+ use the latter.
+ * include/bits/deque.tcc (deque<>::_M_default_append): Define.
+ * include/debug/vector: Update.
+ * include/debug/deque: Likewise.
+ * include/debug/list: Likewise.
+ * include/profile/vector: Likewise.
+ * include/profile/deque: Likewise.
+ * include/profile/list: Likewise.
+ * include/bits/forward_list.h (_M_default_initialize,
+ _M_default_insert_after): Declare.
+ (forward_list<>::forward_list(size_type), resize(size_type)): Fix,
+ use the latter.
+ * include/bits/forward_list.tcc (forward_list<>::_M_default_append,
+ _M_default_insert_after): Define.
+ * testsuite/util/testsuite_api.h (NonCopyConstructible): Add.
+ * testsuite/23_containers/forward_list/modifiers/6.cc: Move to...
+ * testsuite/23_containers/forward_list/capacity/resize_size.cc:
+ ... here.
+ * testsuite/23_containers/forward_list/cons/10.cc: Move to...
+ * testsuite/23_containers/forward_list/cons/cons_size.cc: ... here.
+ * testsuite/23_containers/vector/resize/1.cc: Move to...
+ * testsuite/23_containers/vector/capacity/resize/1.cc: ... here.
+ * testsuite/23_containers/vector/resize/moveable.cc: Move to...
+ * testsuite/23_containers/vector/resize/capacity/moveable.cc: ... here.
+ * testsuite/23_containers/vector/cons/cons_size.cc: New.
+ * testsuite/23_containers/vector/capacity/resize/resize_size.cc:
+ Likewise.
+ * testsuite/23_containers/deque/cons/cons_size.cc: Likewise.
+ * testsuite/23_containers/deque/capacity/resize_size.cc: Likewise.
+ * testsuite/23_containers/list/cons/cons_size.cc: Likewise.
+ * testsuite/23_containers/list/capacity/resize_size.cc: Likewise.
+ * testsuite/23_containers/vector/capacity/resize/moveable.cc: Adjust.
+ * testsuite/23_containers/deque/capacity/moveable.cc: Likewise.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ assign_neg.cc: Adjust dg-error line numbers.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ insert_neg.cc: Likewise.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ assign_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
+ Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/
+ assign_neg.cc: Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
+ Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/list/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+
+2010-06-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/stl_uninitialized.h (__uninitialized_default,
+ __uninitialized_default_n, __uninitialized_default_a,
+ __uninitialized_default_n_a): Add.
+
+ * include/bits/stl_uninitialized.h (uninitialized_copy,
+ uninitialized_fill, uninitialized_fill_n): Use __is_trivial
+ instead of __is_pod.
+ * include/bits/valarray_array.h: Likewise.
+ * include/bits/stl_algobase.h (__copy_move_backward_a,
+ __copy_move_a): Likewise.
+
+2010-06-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/stl_construct.h (_Construct): Change to variadic in
+ C++0x mode, consistently with allocator::construct.
+ * include/bits/stl_uninitialized.h (__uninitialized_copy_n): Use
+ _Construct.
+ (__uninitialized_construct_range): Move to...
+ * include/bits/stl_tempbuf.h (__uninitialized_construct_buf): ... here.
+
+2010-06-16 Matthias Klose <doko@ubuntu.com>
+
+ * src/compatibility.cc: Export long double versions of "C" math
+ library for arm-linux-gnueabi, m68k-linux-gnu (ColdFire),
+ mips*-linux-gnu (o32 ABI), sh*-linux-gnu (32 bit).
+
+2010-06-15 Jason Merrill <jason@redhat.com>
+
+ * testsuite/lib/libstdc++.exp: Set additional_prunes.
+ (libstdc++-dg-test): Don't prune here.
+ * testsuite/lib/prune.exp (dg-prune-output): New.
+ (libstdc++-dg-prune): Rename from prune_g++_output.
+ Add a bunch of prunes from gcc's prune.exp.
+ * testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc:
+ Remove dg-excess-errors.
+ * testsuite/18_support/headers/cstdint/std_c++0x_neg.cc: Likewise.
+ * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Likewise.
+ * testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc:
+ Likewise.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
+ * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
+ * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
+ * testsuite/20_util/headers/type_traits/std_c++0x_neg.cc: Likewise.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise.
+ * testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc: Likewise.
+ * testsuite/20_util/shared_ptr/cons/43820.cc: Likewise.
+ * testsuite/23_containers/headers/array/std_c++0x_neg.cc: Likewise.
+ * testsuite/23_containers/headers/tuple/std_c++0x_neg.cc: Likewise.
+ * testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc:
+ Likewise.
+ * testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc:
+ Likewise.
+ * testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Likewise.
+ * testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc: Likewise.
+ * testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Likewise.
+ * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Likewise.
+ * testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Likewise.
+ * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc:
+ Likewise.
+ * testsuite/29_atomics/atomic_integral/operators/increment_neg.cc:
+ Likewise.
+ * testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc:
+ Likewise.
+ * testsuite/30_threads/headers/future/std_c++0x_neg.cc: Likewise.
+ * testsuite/30_threads/headers/mutex/std_c++0x_neg.cc: Likewise.
+ * testsuite/30_threads/headers/thread/std_c++0x_neg.cc: Likewise.
+ * testsuite/ext/pb_ds/example/hash_resize_neg.cc: Likewise.
+ * testsuite/ext/profile/mutex_extensions.cc: Likewise.
+ * testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Likewise.
+ * testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Likewise.
+ * testsuite/tr1/2_general_utilities/shared_ptr/assign/
+ shared_ptr_neg.cc: Likewise.
+ * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc: Likewise.
+
+2010-06-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/parallel/base.h (min, max): Mark inline.
+ * include/parallel/set_operations.h (__parallel_set_operation):
+ Uglify the Operation template parameter.
+
+2010-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/shared_ptr.h (hash<shared_ptr>): Add.
+ * include/bits/shared_ptr_base.h (hash<__shared_ptr>): Likewise.
+ * include/bits/unique_ptr.h (hash<unique_ptr>): Likewise.
+ * testsuite/20_util/shared_ptr/hash/1.cc: New.
+ * testsuite/20_util/unique_ptr/hash/1.cc: Likewise.
+
+2010-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * doc/xml/manual/appendix_contributing.xml: Indent code examples
+ to match original C++STYLE document. Fix typos and syntax errors.
+ Add some basic docbook markup.
+ * doc/html/*: Regenerate.
+
+2010-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/44268
+ * doc/xml/manual/abi.xml: Fix libgcc version for hppa-linux.
+
+2010-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/tuple (_Swallow_assign::operator=): Add const.
+ (ignore): Replace anonymous namespace member with const instance.
+
+2010-06-10 Suresh Gumpula <suresh.gumpula@amd.com>
+
+ PR libstdc++/43918
+ * config/os/djgpp/error_constants.h: New.
+ * configure.host: Use it.
+
+2010-06-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/tuple (tuple(const tuple&)): Define explicitly-defaulted.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Tweak dg-warning
+ line number.
+
+2010-06-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44487
+ * include/bits/stl_pair.h (pair(pair&&)): Remove.
+ (pair(pair<_U1, _U2>&&): Use forward, consistently with Bullet 5
+ of LWG 1326.
+ * include/std/tuple (tuple(pair<_U1, _U2>&&)): Likewise.
+ * testsuite/20_util/pair/44487.cc: Add.
+ * testsuite/20_util/tuple/cons/44487.cc: Likewise.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning
+ line numbers.
+
+2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/type_traits (is_nothrow_constructible): Add.
+ (declval): Add noexcept specification.
+ * testsuite/util/testsuite_tr1.h (struct NothrowExplicitClass,
+ ThrowExplicitClass, NoexceptExplicitClass, ExceptExplicitClass):
+ Add.
+ * testsuite/20_util/is_nothrow_constructible/value.cc: New.
+ * testsuite/20_util/is_nothrow_constructible/requirements/
+ typedefs.cc: Likewise.
+ * testsuite/20_util/is_nothrow_constructible/requirements/
+ explicit_instantiation.cc: Likewise.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
+ Adjust dg-error line numbers.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
+
+2010-06-09 Khem Raj <raj.khem@gmail.com>
+
+ PR libstdc++/44461
+ * libsupc++/eh_arm.cc (__cxa_end_cleanup): Use .pushsection/.popsection
+ to emit inline assembly into .text section.
+
+2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ Revert:
+ 2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44413
+ * include/ext/vstring_util.h (__vstring_utility<>::_S_compare):
+ Simplify, just return -1, 0, 1.
+
+2010-06-09 Iain Sandoe <iains@gcc.gnu.org>
+
+ PR bootstrap/43170
+ * configure: Regenerate.
+
+2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44413
+ * include/ext/vstring_util.h (__vstring_utility<>::_S_compare):
+ Simplify, just return -1, 0, 1.
+
+2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/type_traits (has_nothrow_assign): Rename to
+ has_nothrow_copy_assign.
+ (has_trivial_assign): Rename to has_trivial_copy_assign.
+ * testsuite/20_util/has_nothrow_copy_assign/value.cc: New.
+ * testsuite/20_util/has_nothrow_copy_assign/requirements/
+ typedefs.cc: Likewise.
+ * testsuite/20_util/has_nothrow_copy_assign/requirements/
+ explicit_instantiation.cc: Likewise.
+ * testsuite/20_util/has_trivial_copy_assign/value.cc: Likewise.
+ * testsuite/20_util/has_trivial_copy_assign/requirements/
+ typedefs.cc: Likewise.
+ * testsuite/20_util/has_trivial_copy_assign/requirements/
+ explicit_instantiation.cc: Likewise.
+
+2010-06-08 Johannes Singler <singler@kit.edu>
+
+ * include/parallel/find.h
+ (__find_template(.., growing_blocks_tag)): Make block size
+ proportional to current position.
+ * include/parallel/settings.h (_Settings): Introduce new tuning
+ parameter find_scale_factor to the end of the struct, defaults to
+ 0.01f.
+
+2010-06-08 Johannes Singler <singler@kit.edu>
+
+ * include/parallel/partial_sum.h
+ (__parallel_partial_sum_linear):
+ Correctly calculate part lengths for partial_sum_dilation!=1.
+
+2010-06-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/44417
+ * include/c_std/cwctype: Provide a workaround for bug glibc
+ BZ 9694 affecting glibc 2.9 and older.
+ * include/c_global/cwctype: Likewise.
+ * testsuite/util/testsuite_abi.h: Remove temporary workaround.
+ * testsuite/util/testsuite_allocator.h: Use everywhere std::size_t
+ and std::ptrdiff_t, don't include <cstddef>.
+
+ * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
+ error_code.cc: Minor tweak, prefer <cwchar> to <wchar.h>.
+
+2010-06-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp:
+ Avoid -Wall warnings.
+ * testsuite/27_io/ios_base/failure/what-3.cc: Likewise.
+ * testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_ostringstream/str/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sputbackc/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sgetn/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/seekoff/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/snextc/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sgetc/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sgetc/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sungetc/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sungetc/char/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/seekpos/char/1.cc: Likewise.
+ * testsuite/27_io/types/2.cc: Likewise.
+ * testsuite/27_io/basic_istream/ignore/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/ignore/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/peek/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/peek/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/ws/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/ws/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/seekg/wchar_t/8348-2.cc: Likewise.
+ * testsuite/27_io/basic_istream/seekg/char/8348-2.cc: Likewise.
+ * testsuite/27_io/basic_istream/tellg/wchar_t/8348.cc: Likewise.
+ * testsuite/27_io/basic_istream/tellg/char/8348.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc:
+ Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc:
+ Likewise.
+ * testsuite/27_io/fpos/mbstate_t/4_neg.cc: Likewise.
+ * testsuite/27_io/fpos/mbstate_t/2.cc: Likewise.
+ * testsuite/27_io/fpos/mbstate_t/3.cc: Likewise.
+ * testsuite/27_io/fpos/mbstate_t/5.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc:
+ Likewise.
+ * testsuite/27_io/basic_ostream/inserters_character/char/4.cc:
+ Likewise.
+ * testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/seekoff/12790-4.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/sungetc/char/2-io.cc: Likewise.
+ * testsuite/25_algorithms/minmax/3.cc: Likewise.
+ * testsuite/19_diagnostics/logic_error/what-3.cc: Likewise.
+ * testsuite/19_diagnostics/runtime_error/what-3.cc: Likewise.
+ * testsuite/19_diagnostics/system_error/what-3.cc: Likewise.
+ * testsuite/24_iterators/front_insert_iterator/2.cc: Likewise.
+ * testsuite/24_iterators/back_insert_iterator/2.cc: Likewise.
+ * testsuite/24_iterators/insert_iterator/2.cc: Likewise.
+ * testsuite/18_support/exception_ptr/make_exception_ptr.cc: Likewise.
+ * testsuite/21_strings/c_strings/wchar_t/1.cc: Likewise.
+ * testsuite/21_strings/c_strings/wchar_t/2.cc: Likewise.
+ * testsuite/21_strings/c_strings/char/1.cc: Likewise.
+ * testsuite/21_strings/c_strings/char/2.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/cons/
+ copy.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ cons/copy.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ requirements/constants.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/
+ cons/copy.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ cons/copy.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ requirements/constants.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ cons/copy.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ requirements/constants.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/
+ cons/copy.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/
+ requirements/constants.cc: Likewise.
+ * testsuite/26_numerics/complex/complex_value.cc: Likewise.
+ * testsuite/26_numerics/headers/cmath/overloads.cc: Likewise.
+ * testsuite/26_numerics/headers/cmath/
+ c99_classification_macros_c++.cc: Likewise.
+ * testsuite/26_numerics/slice_array/array_assignment.cc: Likewise.
+ * testsuite/22_locale/money_put/put/wchar_t/1.cc: Likewise.
+ * testsuite/22_locale/money_put/put/wchar_t/2.cc: Likewise.
+ * testsuite/22_locale/money_put/put/wchar_t/3.cc: Likewise.
+ * testsuite/22_locale/money_put/put/wchar_t/12971.cc: Likewise.
+ * testsuite/22_locale/money_put/put/char/1.cc: Likewise.
+ * testsuite/22_locale/money_put/put/char/2.cc: Likewise.
+ * testsuite/22_locale/money_put/put/char/3.cc: Likewise.
+ * testsuite/22_locale/money_put/put/char/12971.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/1.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/2.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/3.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/4.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/5.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/6.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/7.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/8.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/17038.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/1.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/2.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/3.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/4.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/5.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/6.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/7.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/8.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/17038.cc: Likewise.
+ * testsuite/22_locale/num_put/put/wchar_t/1.cc: Likewise.
+ * testsuite/22_locale/num_put/put/char/1.cc: Likewise.
+ * testsuite/22_locale/time_get/get_year/wchar_t/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_year/char/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_monthname/wchar_t/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_monthname/char/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_weekday/wchar_t/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_weekday/char/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_date/wchar_t/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_date/char/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_time/wchar_t/5.cc: Likewise.
+ * testsuite/22_locale/time_get/get_time/char/5.cc: Likewise.
+ * testsuite/22_locale/num_get/get/wchar_t/1.cc: Likewise.
+ * testsuite/22_locale/num_get/get/char/1.cc: Likewise.
+ * testsuite/22_locale/moneypunct/members/wchar_t/1.cc: Likewise.
+ * testsuite/22_locale/moneypunct/members/char/1.cc: Likewise.
+ * testsuite/22_locale/ctype_base/mask.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ subtract_with_carry/requirements/constants.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ subtract_with_carry_01/requirements/constants.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ discard_block/requirements/constants.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ linear_congruential/requirements/constants.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ mersenne_twister/requirements/constants.cc: Likewise.
+ * testsuite/tr1/5_numerical_facilities/random/
+ xor_combine/requirements/constants.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cfenv/functions.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cstdio/functions.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cctype/functions.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cwchar/functions.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cmath/templates.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cmath/functions.cc: Likewise.
+ * testsuite/tr1/8_c_compatibility/cwctype/functions.cc: Likewise.
+ * testsuite/tr1/6_containers/utility/pair.cc: Likewise.
+ * testsuite/29_atomics/atomic_address/cons/aggregate.cc: Likewise.
+ * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic_integral/operators/
+ increment_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic_integral/operators/
+ bitwise_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic_integral/operators/
+ decrement_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic_flag/cons/1.cc: Likewise.
+ * testsuite/29_atomics/atomic/cons/assign_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise.
+ * testsuite/23_containers/priority_queue/members/7161.cc
+ * testsuite/23_containers/set/dr130.cc: Likewise.
+ * testsuite/23_containers/list/pthread5.cc: Likewise.
+ * testsuite/23_containers/map/dr130.cc: Likewise.
+ * testsuite/util/exception/safety.h: Likewise.
+ * testsuite/util/testsuite_common_types.h: Likewise.
+ * testsuite/20_util/clocks/1.cc: Likewise.
+
+2010-06-06 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * doc/Makefile.am, doc/Makefile.in (xml_sources_extra): Add
+ fdl-1.3.xml.
+ * doc/xml/manual/intro.xml: Update FDL link.
+ * doc/xml/manual/spine.xml: Update FDL include.
+ * doc/xml/gnu/fdl-1.3.xml: Add.
+ * doc/html/*: Regenerate.
+
+2010-06-06 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/ext/pointer.h (_Pointer_adapter::operator++): Remove
+ name of unused parameter.
+
+2010-06-06 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/40296
+ * libsupc++/exception_ptr.h (exception_ptr::exception_ptr): Replace
+ __safe_bool constructor with nullptr_t constructor in C++0x mode.
+ (exception_ptr::operator bool): Add explicit conversion to bool.
+ (swap(exception_ptr&, exception_ptr&)): Add.
+ (exception_ptr::_M_safe_bool_dummy): Only declare for old ABI.
+ * libsupc++/eh_ptr.cc (exception_ptr::_M_safe_bool_dummy): Move
+ next to other functions retained for ABI compatibility.
+ * testsuite/18_support/exception_ptr/requirements.cc: New.
+ * testsuite/18_support/exception_ptr/requirements_neg.cc: New.
+
+2010-06-05 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/bits/shared_ptr_base.h (_Sp_counted_ptr::_M_dispose): Make
+ nullptr_t specializations inline.
+
+2010-06-05 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * doc/xml/manual/status_cxx200x.xml: Update.
+
+2010-06-05 Magnus Fromreide <magfr@lysator.liu.se>
+ Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/functional (function): Add nullptr_t support.
+ * include/bits/shared_ptr.h (shared_ptr): Likewise.
+ * include/bits/unique_ptr.h (unique_ptr): Likewise.
+
+2010-06-05 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/bits/shared_ptr_base.h (__shared_ptr): Add nullptr_t support.
+ (__shared_count): Add nullptr_t support and make constructors explicit.
+ * testsuite/20_util/shared_ptr/cons/43820.cc: Adjust.
+ * testsuite/20_util/shared_ptr/cons/nullptr.cc: New.
+ * testsuite/20_util/unique_ptr/cons/nullptr.cc: New.
+ * testsuite/20_util/unique_ptr/assign/nullptr.cc: New.
+ * testsuite/20_util/unique_ptr/assign/assign_neg.cc: Adjust.
+ * testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: Adjust.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust.
+
+2010-06-04 Jason Merrill <jason@redhat.com>
+
+ * testsuite/util/testsuite_abi.h: Work around glibc BZ 9694.
+
+2010-06-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/util/testsuite_iterators.h: Don't include <cstddef>,
+ don't use NULL, use std::size_t and std::ptrdiff_t.
+ * testsuite/18_support/exception/38732.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/12439_1.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/12439_2.cc: Likewise.
+ * testsuite/22_locale/time_put/put/wchar_t/12439_3.cc: Likewise.
+ * testsuite/22_locale/locale/cons/12658_thread-2.cc: Likewise.
+ * testsuite/22_locale/locale/cons/12658_thread-2.cc: Likewise.
+ * testsuite/23_containers/list/pthread1.cc: Likewise.
+ * testsuite/23_containers/map/pthread6.cc: Likewise.
+ * testsuite/util/testsuite_hooks.cc: Likewise.
+ * config/locale/gnu/codecvt_members.cc: Likewise.
+ * config/locale/gnu/messages_members.cc: Likewise.
+ * config/locale/gnu/c_locale.h: Likewise.
+ * config/locale/gnu/messages_members.h: Likewise.
+ * config/locale/gnu/monetary_members.cc: Likewise.
+ * config/locale/gnu/time_members.cc: Likewise.
+ * config/locale/gnu/time_members.h: Likewise.
+ * config/locale/generic/c_locale.cc: Likewise.
+ * config/locale/generic/codecvt_members.cc: Likewise.
+ * config/locale/generic/c_locale.h: Likewise.
+ * config/locale/generic/time_members.cc: Likewise.
+ * config/locale/generic/time_members.h: Likewise.
+
+2010-06-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/c++config (std::size_t, std::ptrdiff_t,
+ std::nullptr_t): Provide typedefs.
+ * include/c_std/cstddef: Don't provide std::size_t and
+ std::ptrdiff_t here.
+ * include/c_global/cstddef: Likewise.
+ * src/condition_variable.cc: Don't include <cstddef>,
+ don't use NULL, use std::size_t and std::ptrdiff_t.
+ * src/mt_allocator.cc: Likewise.
+ * src/localename.cc: Likewise.
+ * src/chrono.cc: Likewise.
+ * src/thread.cc: Likewise.
+ * include/debug/formatter.h: Likewise.
+ * include/debug/functions.h: Likewise.
+ * include/std/valarray: Likewise.
+ * include/std/thread: Likewise.
+ * include/std/type_traits: Likewise.
+ * include/std/atomic: Likewise.
+ * include/std/iterator: Likewise.
+ * include/std/bitset: Likewise.
+ * include/std/fstream: Likewise.
+ * include/std/mutex: Likewise.
+ * include/c_std/cstdlib: Likewise.
+ * include/c_std/cstdio: Likewise.
+ * include/c_std/ctime: Likewise.
+ * include/c_std/cwchar: Likewise.
+ * include/c_std/cstring: Likewise.
+ * include/parallel/multiway_merge.h: Likewise.
+ * include/parallel/multiseq_selection.h: Likewise.
+ * include/parallel/base.h: Likewise.
+ * include/parallel/basic_iterator.h: Likewise.
+ * include/parallel/multiway_mergesort.h
+ * include/parallel/partition.h: Likewise.
+ * include/ext/string_conversions.h: Likewise.
+ * include/ext/pb_ds/assoc_container.hpp: Likewise.
+ * include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/resize_policy/
+ hash_prime_size_policy_imp.hpp: Likewise.
+ * include/ext/pb_ds/detail/resize_policy/
+ sample_resize_policy.hpp: Likewise.
+ * include/ext/pb_ds/detail/resize_policy/
+ sample_resize_trigger.hpp: Likewise.
+ * include/ext/pb_ds/detail/binomial_heap_base_/
+ erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/binomial_heap_base_/
+ find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/binomial_heap_base_/
+ insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/binomial_heap_base_/
+ constructors_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/binomial_heap_base_/
+ debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/binomial_heap_base_/
+ split_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ erase_store_hash_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/d: Likewise.etail/cc_hash_table_map_/
+ insert_no_store_hash_fn_imps.hpp
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ cmp_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ insert_store_hash_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ info_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ entry_list_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ trace_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ cc_ht_map_.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ resize_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ constructor_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/
+ erase_no_store_hash_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/unordered_iterator/
+ iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/unordered_iterator/
+ const_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/unordered_iterator/
+ point_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/unordered_iterator/
+ const_point_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/
+ insert_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/
+ constructors_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/
+ const_child_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/internal_node.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp: Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ r_erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ constructors_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ rotate_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ node_iterators.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ point_iterators.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ split_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/
+ iterators_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/gp_hash_table_map_/
+ find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/gp_hash_table_map_/
+ gp_ht_map_.hpp: Likewise.
+ * include/ext/pb_ds/detail/gp_hash_table_map_/
+ resize_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/gp_hash_table_map_/
+ standard_policies.hpp: Likewise.
+ * include/ext/pb_ds/detail/tree_policy/
+ sample_tree_node_update.hpp: Likewise.
+ * include/ext/pb_ds/detail/basic_tree_policy/
+ null_node_metadata.hpp: Likewise.
+ * include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/binary_heap_/
+ const_point_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/binary_heap_/
+ split_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/trie_policy/
+ sample_trie_node_update.hpp: Likewise.
+ * include/ext/pb_ds/detail/trie_policy/
+ sample_trie_e_access_traits.hpp: Likewise.
+ * include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/pairing_heap_/
+ split_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_policy/
+ counter_lu_metadata.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ trace_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ null_metadata.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ const_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ constructors_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ iterators_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ const_point_iterator.hpp: Likewise.
+ * include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/thin_heap_/
+ constructors_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/thin_heap_/
+ split_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/
+ constructors_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp: Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/
+ iterators_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp: Likewise.
+ * include/ext/pb_ds/detail/hash_fn/
+ sample_ranged_probe_fn.hpp: Likewise.
+ * include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp: Likewise.
+ * include/ext/pb_ds/detail/hash_fn/
+ sample_ranged_hash_fn.hpp: Likewise.
+ * include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/splay_tree_/
+ split_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/
+ trace_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/
+ erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/
+ find_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/
+ constructor_destructor_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/
+ insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/
+ info_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/
+ iterators_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rc_binomial_heap_/
+ erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rc_binomial_heap_/
+ insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rc_binomial_heap_/
+ debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rb_tree_map_/
+ split_join_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/list_update_policy.hpp: Likewise.
+ * include/ext/pb_ds/exception.hpp: Likewise.
+ * include/ext/pb_ds/tree_policy.hpp: Likewise.
+ * include/ext/pb_ds/tag_and_trait.hpp: Likewise.
+ * include/ext/pb_ds/hash_policy.hpp: Likewise.
+ * include/ext/pb_ds/trie_policy.hpp: Likewise.
+ * include/ext/pb_ds/priority_queue.hpp: Likewise.
+ * include/ext/throw_allocator.h: Likewis: Likewise.e.
+ * include/ext/bitmap_allocator.h
+ * include/ext/rc_string_base.h: Likewise.
+ * include/ext/new_allocator.h: Likewise.
+ * include/ext/codecvt_specializations.h: Likewise.
+ * include/ext/functional: Likewise.: Likewise.
+ * include/ext/array_allocator.h: Likewise.
+ * include/ext/mt_allocator.h: Likewise.
+ * include/ext/sso_string_base.h: Likewise.
+ * include/profile/impl/profiler_trace.h: Likewise.
+ * include/profile/impl/profiler_node.h: Likewise.
+ * include/bits/stl_algobase.h: Likewise.
+ * include/bits/functional_hash.h: Likewise.
+ * include/bits/locale_facets.tcc: Likewise.
+ * include/bits/locale_facets.h: Likewise.
+ * include/bits/stl_iterator_base_types.h: Likewise.
+ * include/bits/move.h: Likewise.
+ * include/bits/boost_concept_check.h: Likewise.
+ * include/bits/basic_string.tcc: Likewise.
+ * include/bits/locale_facets_nonio.tcc: Likewise.
+ * include/bits/fstream.tcc: Likewise.
+ * include/bits/locale_facets_nonio.h: Likewise.
+ * include/c_global/cstdlib: Likewise.
+ * include/c_global/cstdio: Likewise.
+ * include/c_global/ctime: Likewise.
+ * include/c_global/cwchar: Likewise.
+ * include/c_global/cstring
+ * include/tr1/type_traits: Likewise.
+ * include/backward/hash_fun.h: Likewise.
+ * libsupc++/new: Likewise.
+ * libsupc++/initializer_list: Likewise.
+ * testsuite/27_io/basic_ofstream/pthread2.cc: Likewise.
+ * testsuite/27_io/basic_iostream/cons/2020.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sgetn/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sgetn/char/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/overflow/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/overflow/char/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sgetc/char/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sputn/wchar_t/1057.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sputn/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sputn/char/1057.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sputn/char/1.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sputc/wchar_t/1057.cc: Likewise.
+ * testsuite/27_io/basic_streambuf/sputc/char/1057.cc: Likewise.
+ * testsuite/27_io/objects/wchar_t/5268.cc: Likewise.
+ * testsuite/27_io/objects/char/9661-1.cc: Likewise.
+ * testsuite/27_io/objects/char/5268.cc: Likewise.
+ * testsuite/27_io/objects/char/10.cc: Likewise.
+ * testsuite/27_io/basic_ios/copyfmt/char/1.cc: Likewise.
+ * testsuite/27_io/basic_ios/copyfmt/char/2.cc: Likewise.
+ * testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
+ * testsuite/27_io/basic_ios/locales/char/1.cc: Likewise.
+ * testsuite/27_io/basic_ios/clear/char/1.cc: Likewise.
+ * testsuite/27_io/basic_ostringstream/pthread3.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sputc/wchar_t/1057.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sputc/char/1057.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sputn/wchar_t/1057.cc: Likewise.
+ * testsuite/27_io/basic_stringbuf/sputn/char/1057.cc: Likewise.
+ * testsuite/27_io/basic_istream/get/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/get/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/ignore/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/ignore/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/peek/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/peek/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/getline/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/getline/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ exceptions_null.cc
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ 1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/char/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/cons/3.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/
+ wchar_t/01.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/
+ char/01.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/
+ wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/
+ wchar_t/2.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/
+ wchar_t/3.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/
+ char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/
+ char/2.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/
+ char/3.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/
+ char/9826.cc: Likewise.
+ * testsuite/27_io/basic_istream/read/wchar_t/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/read/char/1.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
+ 1.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/char/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/char/1.cc: Likewise.
+ * testsuite/27_io/basic_ostream/cons/2020.cc: Likewise.
+ * testsuite/27_io/basic_ostream/sentry/pod/1.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_character/
+ wchar_t/8.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_character/
+ char/8.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/setbuf/char/1.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/sputc/char/1057.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/open/char/1.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/open/char/2.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/open/char/9507.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-1.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-2.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-3.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-4.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/close/char/9964.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/close/char/1.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/close/char/2.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/close/char/12790-3.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/sputn/char/1057.cc: Likewise.
+ * testsuite/24_iterators/ostreambuf_iterator/2.cc: Likewise.
+ * testsuite/18_support/bad_exception/23591_thread-1.c
+ * testsuite/18_support/new_delete_placement.cc: Likewise.
+ * testsuite/18_support/pthread_guard.cc: Likewise.
+ * testsuite/21_strings/basic_string/operations/wchar_t/1.cc: Likewise.
+ * testsuite/21_strings/basic_string/operations/char/1.cc: Likewise.
+ * testsuite/21_strings/basic_string/pthread4.cc: Likewise.
+ * testsuite/21_strings/basic_string/cons/wchar_t/5.cc: Likewise.
+ * testsuite/21_strings/basic_string/cons/char/5.cc: Likewise.
+ * testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise.
+ * testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise.
+ * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise.
+ * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
+ * testsuite/30_threads/mutex/cons/assign_neg.cc: Likewise.
+ * testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise.
+ * testsuite/30_threads/thread/cons/assign_neg.cc: Likewise.
+ * testsuite/30_threads/thread/cons/copy_neg.cc: Likewise.
+ * testsuite/30_threads/recursive_timed_mutex/cons/
+ assign_neg.cc: Likewise.
+ * testsuite/30_threads/recursive_timed_mutex/cons/
+ copy_neg.cc: Likewise.
+ * testsuite/ext/mt_allocator/22309_thread.cc: Likewise.
+ * testsuite/ext/slist/23781.cc: Likewise.
+ * testsuite/ext/rope/pthread7-rope.cc: Likewise.
+ * testsuite/ext/stdio_filebuf/char/10063-2.cc: Likewise.
+ * testsuite/22_locale/ctype/is/wchar_t/1.cc: Likewise.
+ * testsuite/22_locale/ctype/is/char/1.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/12439_1.cc: Likewise.
+ * testsuite/22_locale/time_put/put/char/12439_3.cc: Likewise.
+ * testsuite/22_locale/locale/cons/2.cc: Likewise.
+ * testsuite/22_locale/locale/cons/12658_thread-1.cc: Likewise.
+ * testsuite/22_locale/locale/cons/29217.cc: Likewise.
+ * testsuite/22_locale/locale/global_locale_objects/14071.cc: Likewise.
+ * testsuite/22_locale/locale/global_locale_objects/2.cc: Likewise.
+ * testsuite/tr1/6_containers/unordered_multimap/
+ requirements/iterator_null_neg.cc: Likewise.
+ * testsuite/tr1/6_containers/unordered_multiset/
+ requirements/iterator_null_neg.cc: Likewise.
+ * testsuite/29_atomics/atomic_address/cons/single_value.cc: Likewise.
+ * testsuite/29_atomics/atomic_address/cons/aggregate.cc: Likewise.
+ * testsuite/23_containers/multimap/23781.cc: Likewise.
+ * testsuite/23_containers/set/23781.cc: Likewise.
+ * testsuite/23_containers/multiset/23781.cc: Likewise.
+ * testsuite/23_containers/list/pthread1.cc: Likewise.
+ * testsuite/23_containers/list/23781.cc: Likewise.
+ * testsuite/23_containers/map/pthread6.cc: Likewise.
+ * testsuite/23_containers/map/23781.cc: Likewise.
+ * testsuite/util/regression/rand/priority_queue/
+ rand_regression_test.hpp: Likewise.
+ * testsuite/util/regression/rand/priority_queue/
+ container_rand_regression_test.tcc: Likewise.
+ * testsuite/util/regression/rand/assoc/
+ rand_regression_test.hpp: Likewise.
+ * testsuite/util/regression/rand/assoc/
+ container_rand_regression_test.tcc: Likewise.
+ * testsuite/util/testsuite_hooks.cc: Likewise.
+ * testsuite/util/testsuite_io.h: Likewise.
+ * testsuite/util/testsuite_iterators.h: Likewise.
+ * testsuite/util/replacement_memory_operators.h: Likewise.
+ * testsuite/util/testsuite_allocator.h: Likewise.
+ * testsuite/util/testsuite_performance.h: Likewise.
+
2010-06-02 Jonathan Wakely <jwakely.gcc@gmail.com>
* testsuite/tr1/2_general_utilities/shared_ptr/cons/pointer.cc: Fix
diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
index 4ae951e7711..468816092d7 100644
--- a/libstdc++-v3/config/locale/generic/c_locale.cc
+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
@@ -36,7 +36,6 @@
#include <cstdio>
#include <locale>
#include <limits>
-#include <cstddef>
#ifdef _GLIBCXX_HAVE_IEEEFP_H
#include <ieeefp.h>
@@ -50,7 +49,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const __c_locale&) throw()
{
// Assumes __s formatted for "C" locale.
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __len = strlen(__old) + 1;
char* __sav = new char[__len];
memcpy(__sav, __old, __len);
@@ -115,7 +114,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const __c_locale&) throw()
{
// Assumes __s formatted for "C" locale.
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __len = strlen(__old) + 1;
char* __sav = new char[__len];
memcpy(__sav, __old, __len);
@@ -160,7 +159,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
ios_base::iostate& __err, const __c_locale&) throw()
{
// Assumes __s formatted for "C" locale.
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __len = strlen(__old) + 1;
char* __sav = new char[__len];
memcpy(__sav, __old, __len);
@@ -212,7 +211,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
// Currently, the generic model only supports the "C" locale.
// See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
- __cloc = NULL;
+ __cloc = 0;
if (strcmp(__s, "C"))
__throw_runtime_error(__N("locale::facet::_S_create_c_locale "
"name not valid"));
@@ -220,7 +219,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void
locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
- { __cloc = NULL; }
+ { __cloc = 0; }
__c_locale
locale::facet::_S_clone_c_locale(__c_locale&) throw()
diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h
index 472ef550530..7d685b8b607 100644
--- a/libstdc++-v3/config/locale/generic/c_locale.h
+++ b/libstdc++-v3/config/locale/generic/c_locale.h
@@ -1,6 +1,6 @@
// Wrapper for underlying C-language localization -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,7 +40,6 @@
#pragma GCC system_header
#include <clocale>
-#include <cstddef>
#define _GLIBCXX_NUM_CATEGORIES 0
@@ -57,8 +56,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const int __size __attribute__((__unused__)),
const char* __fmt, ...)
{
- char* __old = std::setlocale(LC_NUMERIC, NULL);
- char* __sav = NULL;
+ char* __old = std::setlocale(LC_NUMERIC, 0);
+ char* __sav = 0;
if (__builtin_strcmp(__old, "C"))
{
const size_t __len = __builtin_strlen(__old) + 1;
diff --git a/libstdc++-v3/config/locale/generic/codecvt_members.cc b/libstdc++-v3/config/locale/generic/codecvt_members.cc
index b68e18aaf54..655ce822666 100644
--- a/libstdc++-v3/config/locale/generic/codecvt_members.cc
+++ b/libstdc++-v3/config/locale/generic/codecvt_members.cc
@@ -1,6 +1,6 @@
// std::codecvt implementation details, generic version -*- C++ -*-
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
while (__from < __end && __max)
{
- size_t __conv = mbrtowc(NULL, __from, __end - __from, &__tmp_state);
+ size_t __conv = mbrtowc(0, __from, __end - __from, &__tmp_state);
if (__conv == static_cast<size_t>(-1))
{
// Invalid source character
diff --git a/libstdc++-v3/config/locale/generic/time_members.cc b/libstdc++-v3/config/locale/generic/time_members.cc
index 225bc3c247c..040e228fd05 100644
--- a/libstdc++-v3/config/locale/generic/time_members.cc
+++ b/libstdc++-v3/config/locale/generic/time_members.cc
@@ -42,7 +42,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_put(char* __s, size_t __maxlen, const char* __format,
const tm* __tm) const throw()
{
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __llen = strlen(__old) + 1;
char* __sav = new char[__llen];
memcpy(__sav, __old, __llen);
@@ -127,7 +127,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
const tm* __tm) const throw()
{
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __llen = strlen(__old) + 1;
char* __sav = new char[__llen];
memcpy(__sav, __old, __llen);
diff --git a/libstdc++-v3/config/locale/generic/time_members.h b/libstdc++-v3/config/locale/generic/time_members.h
index d06faf409b1..394989edd11 100644
--- a/libstdc++-v3/config/locale/generic/time_members.h
+++ b/libstdc++-v3/config/locale/generic/time_members.h
@@ -1,6 +1,7 @@
// std::time_get, std::time_put implementation, generic version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -39,7 +40,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
- : facet(__refs), _M_data(NULL)
+ : facet(__refs), _M_data(0)
{
_M_name_timepunct = _S_get_c_name();
_M_initialize_timepunct();
@@ -56,7 +57,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
- : facet(__refs), _M_data(NULL)
+ : facet(__refs), _M_data(0)
{
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
{
diff --git a/libstdc++-v3/config/locale/gnu/c_locale.h b/libstdc++-v3/config/locale/gnu/c_locale.h
index 749a97ad6af..1809119d384 100644
--- a/libstdc++-v3/config/locale/gnu/c_locale.h
+++ b/libstdc++-v3/config/locale/gnu/c_locale.h
@@ -1,6 +1,6 @@
// Wrapper for underlying C-language localization -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,7 +40,6 @@
#pragma GCC system_header
#include <clocale>
-#include <cstddef>
#define _GLIBCXX_C_LOCALE_GNU 1
@@ -71,8 +70,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
- char* __old = std::setlocale(LC_NUMERIC, NULL);
- char* __sav = NULL;
+ char* __old = std::setlocale(LC_NUMERIC, 0);
+ char* __sav = 0;
if (__builtin_strcmp(__old, "C"))
{
const size_t __len = __builtin_strlen(__old) + 1;
diff --git a/libstdc++-v3/config/locale/gnu/codecvt_members.cc b/libstdc++-v3/config/locale/gnu/codecvt_members.cc
index 1215e4816e4..7cc12edc191 100644
--- a/libstdc++-v3/config/locale/gnu/codecvt_members.cc
+++ b/libstdc++-v3/config/locale/gnu/codecvt_members.cc
@@ -1,6 +1,6 @@
// std::codecvt implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -268,7 +268,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// mbrtowc.
for (__from = __tmp_from;; __from += __conv)
{
- __conv = mbrtowc(NULL, __from, __end - __from,
+ __conv = mbrtowc(0, __from, __end - __from,
&__tmp_state);
if (__conv == static_cast<size_t>(-1)
|| __conv == static_cast<size_t>(-2))
diff --git a/libstdc++-v3/config/locale/gnu/messages_members.cc b/libstdc++-v3/config/locale/gnu/messages_members.cc
index 1a42b38983a..94ebcb5fa7f 100644
--- a/libstdc++-v3/config/locale/gnu/messages_members.cc
+++ b/libstdc++-v3/config/locale/gnu/messages_members.cc
@@ -1,6 +1,6 @@
// std::messages implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -44,7 +44,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__uselocale(__old);
return string(__msg);
#else
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __len = strlen(__old) + 1;
char* __sav = new char[__len];
memcpy(__sav, __old, __len);
@@ -67,7 +67,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__uselocale(__old);
return _M_convert_from_char(__msg);
# else
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __len = strlen(__old) + 1;
char* __sav = new char[__len];
memcpy(__sav, __old, __len);
diff --git a/libstdc++-v3/config/locale/gnu/messages_members.h b/libstdc++-v3/config/locale/gnu/messages_members.h
index 8773562b0c4..b633efa54fd 100644
--- a/libstdc++-v3/config/locale/gnu/messages_members.h
+++ b/libstdc++-v3/config/locale/gnu/messages_members.h
@@ -1,6 +1,6 @@
// std::messages implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT>
messages<_CharT>::messages(__c_locale __cloc, const char* __s,
size_t __refs)
- : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
+ : facet(__refs), _M_c_locale_messages(0), _M_name_messages(0)
{
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
{
diff --git a/libstdc++-v3/config/locale/gnu/monetary_members.cc b/libstdc++-v3/config/locale/gnu/monetary_members.cc
index 159eb97cad5..e5f90ca5b0f 100644
--- a/libstdc++-v3/config/locale/gnu/monetary_members.cc
+++ b/libstdc++-v3/config/locale/gnu/monetary_members.cc
@@ -574,7 +574,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__c_locale __old = __uselocale(__cloc);
#else
// Switch to named locale so that mbsrtowcs will work.
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __llen = strlen(__old) + 1;
char* __sav = new char[__llen];
memcpy(__sav, __old, __llen);
@@ -757,7 +757,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__c_locale __old = __uselocale(__cloc);
#else
// Switch to named locale so that mbsrtowcs will work.
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __llen = strlen(__old) + 1;
char* __sav = new char[__llen];
memcpy(__sav, __old, __llen);
diff --git a/libstdc++-v3/config/locale/gnu/time_members.cc b/libstdc++-v3/config/locale/gnu/time_members.cc
index 43cab22964c..cf139716ee9 100644
--- a/libstdc++-v3/config/locale/gnu/time_members.cc
+++ b/libstdc++-v3/config/locale/gnu/time_members.cc
@@ -45,7 +45,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
_M_c_locale_timepunct);
#else
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __llen = strlen(__old) + 1;
char* __sav = new char[__llen];
memcpy(__sav, __old, __llen);
@@ -201,7 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
_M_c_locale_timepunct);
#else
- char* __old = setlocale(LC_ALL, NULL);
+ char* __old = setlocale(LC_ALL, 0);
const size_t __llen = strlen(__old) + 1;
char* __sav = new char[__llen];
memcpy(__sav, __old, __llen);
diff --git a/libstdc++-v3/config/locale/gnu/time_members.h b/libstdc++-v3/config/locale/gnu/time_members.h
index 90bc0cec329..5b81d9ce2fc 100644
--- a/libstdc++-v3/config/locale/gnu/time_members.h
+++ b/libstdc++-v3/config/locale/gnu/time_members.h
@@ -1,6 +1,7 @@
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -39,21 +40,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
- : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
+ : facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
_M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
- : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0),
_M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
- : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
- _M_name_timepunct(NULL)
+ : facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
+ _M_name_timepunct(0)
{
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
{
diff --git a/libstdc++-v3/config/os/djgpp/error_constants.h b/libstdc++-v3/config/os/djgpp/error_constants.h
new file mode 100644
index 00000000000..3efe540d302
--- /dev/null
+++ b/libstdc++-v3/config/os/djgpp/error_constants.h
@@ -0,0 +1,124 @@
+// Specific definitions for DJGPP platform -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file error_constants.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ERROR_CONSTANTS
+#define _GLIBCXX_ERROR_CONSTANTS 1
+
+#include <bits/c++config.h>
+#include <cerrno>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+// Most of the commented-out error codes are socket-related and could be
+// replaced by Winsock WSA-prefixed equivalents.
+ enum class errc
+ {
+// address_family_not_supported = EAFNOSUPPORT,
+// address_in_use = EADDRINUSE,
+// address_not_available = EADDRNOTAVAIL,
+// already_connected = EISCONN,
+ argument_list_too_long = E2BIG,
+ argument_out_of_domain = EDOM,
+ bad_address = EFAULT,
+ bad_file_descriptor = EBADF,
+// bad_message = EBADMSG,
+ broken_pipe = EPIPE,
+// connection_aborted = ECONNABORTED,
+// connection_already_in_progress = EALREADY,
+// connection_refused = ECONNREFUSED,
+// connection_reset = ECONNRESET,
+// cross_device_link = EXDEV,
+// destination_address_required = EDESTADDRREQ,
+ device_or_resource_busy = EBUSY,
+ directory_not_empty = ENOTEMPTY,
+ executable_format_error = ENOEXEC,
+ file_exists = EEXIST,
+ file_too_large = EFBIG,
+ filename_too_long = ENAMETOOLONG,
+ function_not_supported = ENOSYS,
+// host_unreachable = EHOSTUNREACH,
+// identifier_removed = EIDRM,
+ illegal_byte_sequence = EILSEQ,
+ inappropriate_io_control_operation = ENOTTY,
+ interrupted = EINTR,
+ invalid_argument = EINVAL,
+ invalid_seek = ESPIPE,
+ io_error = EIO,
+ is_a_directory = EISDIR,
+// message_size = EMSGSIZE,
+// network_down = ENETDOWN,
+// network_reset = ENETRESET,
+// network_unreachable = ENETUNREACH,
+// no_buffer_space = ENOBUFS,
+// no_child_process = ECHILD,
+// no_link = ENOLINK,
+ no_lock_available = ENOLCK,
+// no_message_available = ENODATA,
+// no_message = ENOMSG,
+// no_protocol_option = ENOPROTOOPT,
+// no_space_on_device = ENOSPC,
+// no_stream_resources = ENOSR,
+ no_such_device_or_address = ENXIO,
+ no_such_device = ENODEV,
+ no_such_file_or_directory = ENOENT,
+ no_such_process = ESRCH,
+ not_a_directory = ENOTDIR,
+// not_a_socket = ENOTSOCK,
+// not_a_stream = ENOSTR,
+// not_connected = ENOTCONN,
+ not_enough_memory = ENOMEM,
+// not_supported = ENOTSUP,
+// operation_canceled = ECANCELED,
+// operation_in_progress = EINPROGRESS,
+// operation_not_permitted = EPERM,
+// operation_not_supported = EOPNOTSUPP,
+// operation_would_block = EWOULDBLOCK,
+// owner_dead = EOWNERDEAD,
+ permission_denied = EACCES,
+// protocol_error = EPROTO,
+// protocol_not_supported = EPROTONOSUPPORT,
+ read_only_file_system = EROFS,
+ resource_deadlock_would_occur = EDEADLK,
+ resource_unavailable_try_again = EAGAIN,
+ result_out_of_range = ERANGE,
+// state_not_recoverable = ENOTRECOVERABLE,
+// stream_timeout = ETIME,
+// text_file_busy = ETXTBSY,
+// timed_out = ETIMEDOUT,
+ too_many_files_open_in_system = ENFILE,
+ too_many_files_open = EMFILE,
+ too_many_links = EMLINK
+ // too_many_symbolic_link_levels = ELOOP,
+ // value_too_large = EOVERFLOW,
+ // wrong_protocol_type = EPROTOTYPE
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 53f0ce3a7f0..06504044fa0 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -25548,7 +25548,7 @@ else
/* end confdefs.h. */
#include <pthread.h>
__thread int a;
- static int *a_in_other_thread;
+ static int *volatile a_in_other_thread;
static void *
thread_func (void *arg)
{
@@ -25560,11 +25560,11 @@ main ()
{
pthread_t thread;
void *thread_retval;
- int *a_in_main_thread;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
if (pthread_create (&thread, (pthread_attr_t *)0,
thread_func, (void *)0))
return 0;
- a_in_main_thread = &a;
if (pthread_join (thread, &thread_retval))
return 0;
return (a_in_other_thread == a_in_main_thread);
@@ -44486,7 +44486,7 @@ else
/* end confdefs.h. */
#include <pthread.h>
__thread int a;
- static int *a_in_other_thread;
+ static int *volatile a_in_other_thread;
static void *
thread_func (void *arg)
{
@@ -44498,11 +44498,11 @@ main ()
{
pthread_t thread;
void *thread_retval;
- int *a_in_main_thread;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
if (pthread_create (&thread, (pthread_attr_t *)0,
thread_func, (void *)0))
return 0;
- a_in_main_thread = &a;
if (pthread_join (thread, &thread_retval))
return 0;
return (a_in_other_thread == a_in_main_thread);
@@ -50571,7 +50571,7 @@ else
/* end confdefs.h. */
#include <pthread.h>
__thread int a;
- static int *a_in_other_thread;
+ static int *volatile a_in_other_thread;
static void *
thread_func (void *arg)
{
@@ -50583,11 +50583,11 @@ main ()
{
pthread_t thread;
void *thread_retval;
- int *a_in_main_thread;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
if (pthread_create (&thread, (pthread_attr_t *)0,
thread_func, (void *)0))
return 0;
- a_in_main_thread = &a;
if (pthread_join (thread, &thread_retval))
return 0;
return (a_in_other_thread == a_in_main_thread);
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index 5cd2a217b6c..444f672e7be 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -231,6 +231,7 @@ case "${host_os}" in
;;
*djgpp*) # leading * picks up "msdosdjgpp"
os_include_dir="os/djgpp"
+ error_constants_dir="os/djgpp"
;;
freebsd*)
os_include_dir="os/bsd/freebsd"
diff --git a/libstdc++-v3/doc/Makefile.am b/libstdc++-v3/doc/Makefile.am
index 4f79f9b187f..d48e7a30de8 100644
--- a/libstdc++-v3/doc/Makefile.am
+++ b/libstdc++-v3/doc/Makefile.am
@@ -172,6 +172,7 @@ xml_sources_manual = \
xml_sources_extra = \
${xml_dir}/gnu/fdl-1.2.xml \
+ ${xml_dir}/gnu/fdl-1.3.xml \
${xml_dir}/gnu/gpl-2.0.xml \
${xml_dir}/gnu/gpl-3.0.xml
diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in
index 71f4d63070e..482bbb1f614 100644
--- a/libstdc++-v3/doc/Makefile.in
+++ b/libstdc++-v3/doc/Makefile.in
@@ -333,6 +333,7 @@ xml_sources_manual = \
xml_sources_extra = \
${xml_dir}/gnu/fdl-1.2.xml \
+ ${xml_dir}/gnu/fdl-1.3.xml \
${xml_dir}/gnu/gpl-2.0.xml \
${xml_dir}/gnu/gpl-3.0.xml
diff --git a/libstdc++-v3/doc/html/api.html b/libstdc++-v3/doc/html/api.html
index b96eb6eeffa..624339674bb 100644
--- a/libstdc++-v3/doc/html/api.html
+++ b/libstdc++-v3/doc/html/api.html
@@ -7,7 +7,7 @@
<a class="ulink" href="http://www.fsf.org/" target="_top">FSF
</a>
- </p></div><div><div class="legalnotice" title="Legal Notice"><a id="id508660"></a><p>
+ </p></div><div><div class="legalnotice" title="Legal Notice"><a id="id491737"></a><p>
<a class="link" href="manual/license.html" title="License">License
</a>
</p></div></div></div><hr /></div><p>
diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html
index 12d91a8e678..76f318c969d 100644
--- a/libstdc++-v3/doc/html/faq.html
+++ b/libstdc++-v3/doc/html/faq.html
@@ -4,7 +4,7 @@
2008
<a class="ulink" href="http://www.fsf.org" target="_top">FSF</a>
- </p></div></div><hr /></div><div class="qandaset" title="Frequently Asked Questions"><a id="id523703"></a><dl><dt>1. <a href="faq.html#faq.info">General Information</a></dt><dd><dl><dt>1.1. <a href="faq.html#faq.what">
+ </p></div></div><hr /></div><div class="qandaset" title="Frequently Asked Questions"><a id="id573102"></a><dl><dt>1. <a href="faq.html#faq.info">General Information</a></dt><dd><dl><dt>1.1. <a href="faq.html#faq.what">
What is libstdc++?
</a></dt><dt>1.2. <a href="faq.html#faq.why">
Why should I use libstdc++?
@@ -396,7 +396,7 @@
non-standard features of g++ that are not present in older
versions of proprietary compilers. It may take as much as a year or two
after an official release of GCC that contains these features for
- proprietary tools support these constructs.
+ proprietary tools to support these constructs.
</p><p>
In the near past, specific released versions of libstdc++ have
been known to work with versions of the EDG C++ compiler, and
@@ -475,6 +475,8 @@
5.0.1) and later uses localization and formatting code from the system
C library (glibc) version 2.2.5 which contains necessary bugfixes.
Most GNU/Linux distros make more recent versions available now.
+ libstdc++ 4.6.0 and later require glibc 2.3 or later for this
+ localization and formatting code.
</p><p>The guideline is simple: the more recent the C++ library, the
more recent the C library. (This is also documented in the main
GCC installation instructions.)
diff --git a/libstdc++-v3/doc/html/manual/abi.html b/libstdc++-v3/doc/html/manual/abi.html
index f8e14c56ab7..051d83196d2 100644
--- a/libstdc++-v3/doc/html/manual/abi.html
+++ b/libstdc++-v3/doc/html/manual/abi.html
@@ -87,10 +87,13 @@ compatible.
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Release versioning on the libgcc_s.so binary. </p><p>This is implemented via file names and the ELF
<code class="constant">DT_SONAME</code> mechanism (at least on ELF
systems). It is versioned as follows:
- </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>gcc-3.0.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.2: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.3: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.4: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.1.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.1.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.2: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.3: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.2: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.3: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.4.x, gcc-4.[0-5].x: on m68k-linux and
- hppa-linux this is either libgcc_s.so.1 (when configuring
- <code class="code">--with-sjlj-exceptions</code>) or libgcc_s.so.2. For all
- others, this is libgcc_s.so.1. </p></li></ul></div></li><li class="listitem"><p>Symbol versioning on the libgcc_s.so binary.</p><p>It is versioned with the following labels and version
+ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>gcc-3.0.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.2: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.3: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.0.4: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.1.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.1.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.2: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.2.3: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.0: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.1: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.2: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.3.3: libgcc_s.so.1</p></li><li class="listitem"><p>gcc-3.4.x, gcc-4.[0-5].x: libgcc_s.so.1</p></li></ul></div><p>For m68k-linux the versions differ as follows: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>gcc-3.4.x, gcc-4.[0-5].x: libgcc_s.so.1
+ when configuring <code class="code">--with-sjlj-exceptions</code>, or
+ libgcc_s.so.2 </p></li></ul></div><p>For hppa-linux the versions differ as follows: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>gcc-3.4.x, gcc-4.[0-1].x: either libgcc_s.so.1
+ when configuring <code class="code">--with-sjlj-exceptions</code>, or
+ libgcc_s.so.2 </p></li><li class="listitem"><p>gcc-4.[2-5].x: either libgcc_s.so.3 when configuring
+ <code class="code">--with-sjlj-exceptions</code>) or libgcc_s.so.4
+ </p></li></ul></div></li><li class="listitem"><p>Symbol versioning on the libgcc_s.so binary.</p><p>It is versioned with the following labels and version
definitions, where the version definition is the maximum for a
particular release. Labels are cumulative. If a particular release
is not listed, it has the same version labels as the preceding
@@ -464,49 +467,49 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.
<a class="ulink" href="http://gcc.gnu.org/PR24660" target="_top">24660: versioning weak symbols in libstdc++</a>
</p><p>
<a class="ulink" href="http://gcc.gnu.org/PR19664" target="_top">19664: libstdc++ headers should have pop/push of the visibility around the declarations</a>
-</p></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="abi.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id530725"></a><p><span class="biblioid">
+</p></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="abi.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id528502"></a><p><span class="biblioid">
<a class="ulink" href="http://abicheck.sourceforge.net/" target="_top">
<em class="citetitle">
ABIcheck, a vague idea of checking ABI compatibility
</em>
</a>
- . </span></p></div><div class="biblioentry"><a id="id659057"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id528522"></a><p><span class="biblioid">
<a class="ulink" href="http://www.codesourcery.com/public/cxx-abi/" target="_top">
<em class="citetitle">
C++ ABI Reference
</em>
</a>
- . </span></p></div><div class="biblioentry"><a id="id659077"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id528541"></a><p><span class="biblioid">
<a class="ulink" href="http://www.intel.com/cd/software/products/asmo-na/eng/284736.htm" target="_top">
<em class="citetitle">
Intel Compilers for Linux Compatibility with the GNU Compilers
</em>
</a>
- . </span></p></div><div class="biblioentry"><a id="id659097"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id528561"></a><p><span class="biblioid">
<a class="ulink" href="http://docs.sun.com/app/docs/doc/817-1984" target="_top">
<em class="citetitle">
Sun Solaris 2.9 : Linker and Libraries Guide (document 816-1386)
</em>
</a>
- . </span></p></div><div class="biblioentry"><a id="id659116"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id528581"></a><p><span class="biblioid">
<a class="ulink" href="http://docs.sun.com/app/docs/doc/819-5266" target="_top">
<em class="citetitle">
Sun Solaris 2.9 : C++ Migration Guide (document 816-2459)
</em>
</a>
- . </span></p></div><div class="biblioentry"><a id="id659136"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id528600"></a><p><span class="biblioid">
<a class="ulink" href="http://people.redhat.com/drepper/dsohowto.pdf" target="_top">
<em class="citetitle">
How to Write Shared Libraries
</em>
</a>
- . </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span></p></div><div class="biblioentry"><a id="id659166"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span></p></div><div class="biblioentry"><a id="id528631"></a><p><span class="biblioid">
<a class="ulink" href="http://www.arm.com/miscPDFs/8033.pdf" target="_top">
<em class="citetitle">
C++ ABI for the ARM Architecture
</em>
</a>
- . </span></p></div><div class="biblioentry"><a id="id659186"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id528651"></a><p><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1976.html" target="_top">
<em class="citetitle">
Dynamic Shared Objects: Survey and Issues
@@ -514,7 +517,7 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.
</a>
. </span><span class="subtitle">
ISO C++ J16/06-0046
- . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="id659221"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="id528685"></a><p><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2013.html" target="_top">
<em class="citetitle">
Versioning With Namespaces
@@ -522,7 +525,7 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.
</a>
. </span><span class="subtitle">
ISO C++ J16/06-0083
- . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="id659256"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="id639657"></a><p><span class="biblioid">
<a class="ulink" href="http://syrcose.ispras.ru/2009/files/SYRCoSE2009-CfP.pdf" target="_top">
<em class="citetitle">
Binary Compatibility of Shared Libraries Implemented in C++
diff --git a/libstdc++-v3/doc/html/manual/algorithms.html b/libstdc++-v3/doc/html/manual/algorithms.html
index c7910e8224d..0ef261f85c9 100644
--- a/libstdc++-v3/doc/html/manual/algorithms.html
+++ b/libstdc++-v3/doc/html/manual/algorithms.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="numerics.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 11.  Algorithms"><div class="titlepage"><div><div><h2 class="title"><a id="std.algorithms"></a>Chapter 11. 
Algorithms
- <a id="id658154" class="indexterm"></a>
+ <a id="id539624" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="algorithms.html#std.algorithms.mutating">Mutating</a></span></dt><dd><dl><dt><span class="sect2"><a href="algorithms.html#algorithms.mutating.swap"><code class="function">swap</code></a></span></dt></dl></dd></dl></div><p>
The neatest accomplishment of the algorithms sect1 is that all the
work is done via iterators, not containers directly. This means two
diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html
index 6a3b094b5b5..45b2b378b24 100644
--- a/libstdc++-v3/doc/html/manual/api.html
+++ b/libstdc++-v3/doc/html/manual/api.html
@@ -75,11 +75,11 @@ _Alloc_traits</code> have been removed.
<span class="type">__alloc</span> to select an underlying allocator that
satisfied memory allocation requests. The selection of this
underlying allocator was not user-configurable.
- </p><div class="table"><a id="id654608"></a><p class="title"><b>Table B.1. Extension Allocators</b></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template&lt;int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template&lt;bool,int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection
+ </p><div class="table"><a id="id659684"></a><p class="title"><b>Table B.1. Extension Allocators</b></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template&lt;int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template&lt;bool,int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection
of available allocators. All of these new allocators are
standard-style. The following table includes details, along with
the first released version of GCC that included the extension allocator.
- </p><div class="table"><a id="id534867"></a><p class="title"><b>Table B.2. Extension Allocators Continued</b></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p>
+ </p><div class="table"><a id="id651845"></a><p class="title"><b>Table B.2. Extension Allocators Continued</b></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p>
Debug mode first appears.
</p><p>
Precompiled header support <acronym class="acronym">PCH</acronym> support.
diff --git a/libstdc++-v3/doc/html/manual/appendix_contributing.html b/libstdc++-v3/doc/html/manual/appendix_contributing.html
index fc792adc087..1864b97d84c 100644
--- a/libstdc++-v3/doc/html/manual/appendix_contributing.html
+++ b/libstdc++-v3/doc/html/manual/appendix_contributing.html
@@ -7,7 +7,7 @@
Appendices
</th><td width="20%" align="right"> <a accesskey="n" href="source_organization.html">Next</a></td></tr></table><hr /></div><div class="appendix" title="Appendix A.  Contributing"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.contrib"></a>Appendix A. 
Contributing
- <a id="id535897" class="indexterm"></a>
+ <a id="id572634" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="source_organization.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="source_code_style.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="source_code_style.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="sect2"><a href="source_code_style.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="documentation_style.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="documentation_style.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="documentation_style.html#doc_style.docbook">Docbook</a></span></dt><dt><span class="sect2"><a href="documentation_style.html#doc_style.combines">Combines</a></span></dt></dl></dd><dt><span class="sect1"><a href="source_design_notes.html">Design Notes</a></span></dt></dl></div><p>
The GNU C++ Library follows an open development model. Active
contributors are assigned maintainer-ship responsibility, and given
@@ -25,7 +25,7 @@
organization is ANSI and their web-site is right
<a class="ulink" href="http://www.ansi.org" target="_top">here.</a>
(And if you've already registered with them, clicking this link will take you to directly to the place where you can
- <a class="ulink" href="http://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC+14882:2003" target="_top">buy the standard on-line.)</a>
+ <a class="ulink" href="http://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC+14882:2003" target="_top">buy the standard on-line</a>.)
</p></li><li class="listitem"><p>
The library working group bugs, and known defects, can
be obtained here:
diff --git a/libstdc++-v3/doc/html/manual/appendix_free.html b/libstdc++-v3/doc/html/manual/appendix_free.html
index 827ff6288cc..15db4da3b0d 100644
--- a/libstdc++-v3/doc/html/manual/appendix_free.html
+++ b/libstdc++-v3/doc/html/manual/appendix_free.html
@@ -7,7 +7,7 @@
Appendices
</th><td width="20%" align="right"> <a accesskey="n" href="appendix_gpl.html">Next</a></td></tr></table><hr /></div><div class="appendix" title="Appendix C.  Free Software Needs Free Documentation"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.free"></a>Appendix C. 
Free Software Needs Free Documentation
- <a id="id636730" class="indexterm"></a>
+ <a id="id536958" class="indexterm"></a>
</h2></div></div></div><p>
The biggest deficiency in free operating systems is not in the
software--it is the lack of good free manuals that we can include in
diff --git a/libstdc++-v3/doc/html/manual/appendix_gfdl.html b/libstdc++-v3/doc/html/manual/appendix_gfdl.html
index edb2f0c3f4d..ab34a73c02a 100644
--- a/libstdc++-v3/doc/html/manual/appendix_gfdl.html
+++ b/libstdc++-v3/doc/html/manual/appendix_gfdl.html
@@ -2,149 +2,153 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix E. GNU Free Documentation License</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="bk01pt04.html" title="Part IV.  Appendices" /><link rel="prev" href="appendix_gpl.html" title="Appendix D.  GNU General Public License version 3" /><link rel="next" href="../bk02.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix E. GNU Free Documentation License</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_gpl.html">Prev</a> </td><th width="60%" align="center">Part IV. 
Appendices
-</th><td width="20%" align="right"> <a accesskey="n" href="../bk02.html">Next</a></td></tr></table><hr /></div><div class="appendix" title="Appendix E. GNU Free Documentation License"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.gfdl-1.2"></a>Appendix E. GNU Free Documentation License</h2></div></div></div><p>
- Copyright (C) 2000, 2001, 2002 Free Software Foundation,
- <abbr class="abbrev">Inc.</abbr> 51 Franklin <abbr class="abbrev">St</abbr>, Fifth Floor,
- Boston, <abbr class="abbrev">MA</abbr> 02110-1301 <abbr class="abbrev">USA</abbr>. Everyone is permitted to copy and
- distribute verbatim copies of this license document, but changing it is
- not allowed.
- </p><h2><a id="fdl-1-preamble"></a>
+</th><td width="20%" align="right"> <a accesskey="n" href="../bk02.html">Next</a></td></tr></table><hr /></div><div class="appendix" title="Appendix E. GNU Free Documentation License"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.gfdl-1.3"></a>Appendix E. GNU Free Documentation License</h2></div></div></div><p>Version 1.3, 3 November 2008</p><p>
+ Copyright © 2000, 2001, 2002, 2007, 2008
+ <a class="ulink" href="http://www.fsf.org/" target="_top">Free Software Foundation, Inc.</a>
+ </p><p>
+ Everyone is permitted to copy and distribute verbatim copies of this
+ license document, but changing it is not allowed.
+ </p><h3><a id="fdl-1-section0"></a>
0. PREAMBLE
- </h2><p>
+ </h3><p>
The purpose of this License is to make a manual, textbook, or other
- functional and useful document "free" in the sense of freedom: to assure
- everyone the effective freedom to copy and redistribute it, with or
- without modifying it, either commercially or noncommercially.
- Secondarily, this License preserves for the author and publisher a way to
- get credit for their work, while not being considered responsible for
- modifications made by others.
- </p><p>
- This License is a kind of "copyleft", which means that derivative works of
- the document must themselves be free in the same sense. It complements
- the GNU General Public License, which is a copyleft license designed for
- free software.
+ functional and useful document “free†in the sense of freedom:
+ to assure everyone the effective freedom to copy and redistribute it, with
+ or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the author and
+ publisher a way to get credit for their work, while not being considered
+ responsible for modifications made by others.
+ </p><p>
+ This License is a kind of “copyleftâ€, which means that
+ derivative works of the document must themselves be free in the same
+ sense. It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
</p><p>
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free program
should come with manuals providing the same freedoms that the software
- does. But this License is not limited to software manuals; it can be used
+ does. But this License is not limited to software manuals; it can be used
for any textual work, regardless of subject matter or whether it is
- published as a printed book. We recommend this License principally for
- works whose purpose is instruction or reference.</p><h2><a id="fdl-1-definitions"></a>
+ published as a printed book. We recommend this License principally for
+ works whose purpose is instruction or reference.
+ </p><h3><a id="fdl-1-section1"></a>
1. APPLICABILITY AND DEFINITIONS
- </h2><p>
+ </h3><p>
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
- distributed under the terms of this License. Such a notice grants a
+ distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that work
- under the conditions stated herein. The "Document", below, refers to any
- such manual or work. Any member of the public is a licensee, and is
- addressed as "you". You accept the license if you copy, modify or
- distribute the work in a way requiring permission under copyright
- law.
- </p><p>
- A "Modified Version" of the Document means any work containing the
- Document or a portion of it, either copied verbatim, or with modifications
- and/or translated into another language.
- </p><p>
- A "Secondary Section" is a named appendix or a front-matter section of the
- Document that deals exclusively with the relationship of the publishers or
- authors of the Document to the Document's overall subject (or to related
- matters) and contains nothing that could fall directly within that overall
- subject. (Thus, if the Document is in part a textbook of mathematics, a
- Secondary Section may not explain any mathematics.) The relationship
- could be a matter of historical connection with the subject or with
- related matters, or of legal, commercial, philosophical, ethical or
- political position regarding them.
- </p><p>
- The "Invariant Sections" are certain Secondary Sections whose titles are
- designated, as being those of Invariant Sections, in the notice that says
- that the Document is released under this License. If a section does not
- fit the above definition of Secondary then it is not allowed to be
- designated as Invariant. The Document may contain zero Invariant
- Sections. If the Document does not identify any Invariant Sections then
+ under the conditions stated herein. The “Documentâ€, below,
+ refers to any such manual or work. Any member of the public is a licensee,
+ and is addressed as “youâ€. You accept the license if you copy,
+ modify or distribute the work in a way requiring permission under
+ copyright law.
+ </p><p>
+ A “Modified Version†of the Document means any work containing
+ the Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+ </p><p>
+ A “Secondary Section†is a named appendix or a front-matter
+ section of the Document that deals exclusively with the relationship of
+ the publishers or authors of the Document to the Document’s overall
+ subject (or to related matters) and contains nothing that could fall
+ directly within that overall subject. (Thus, if the Document is in part a
+ textbook of mathematics, a Secondary Section may not explain any
+ mathematics.) The relationship could be a matter of historical connection
+ with the subject or with related matters, or of legal, commercial,
+ philosophical, ethical or political position regarding them.
+ </p><p>
+ The “Invariant Sections†are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in the notice
+ that says that the Document is released under this License. If a section
+ does not fit the above definition of Secondary then it is not allowed to
+ be designated as Invariant. The Document may contain zero Invariant
+ Sections. If the Document does not identify any Invariant Sections then
there are none.
</p><p>
- The "Cover Texts" are certain short passages of text that are listed, as
- Front-Cover Texts or Back-Cover Texts, in the notice that says that the
- Document is released under this License. A Front-Cover Text may be at
- most 5 words, and a Back-Cover Text may be at most 25 words.
- </p><p>
- A "Transparent" copy of the Document means a machine-readable copy,
- represented in a format whose specification is available to the general
- public, that is suitable for revising the document straightforwardly with
- generic text editors or (for images composed of pixels) generic paint
- programs or (for drawings) some widely available drawing editor, and that
- is suitable for input to text formatters or for automatic translation to a
- variety of formats suitable for input to text formatters. A copy made in
- an otherwise Transparent file format whose markup, or absence of markup,
- has been arranged to thwart or discourage subsequent modification by
- readers is not Transparent. An image format is not Transparent if used
- for any substantial amount of text. A copy that is not "Transparent" is
- called "Opaque".
+ The “Cover Texts†are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says
+ that the Document is released under this License. A Front-Cover Text may
+ be at most 5 words, and a Back-Cover Text may be at most 25 words.
+ </p><p>
+ A “Transparent†copy of the Document means a machine-readable
+ copy, represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images composed of
+ pixels) generic paint programs or (for drawings) some widely available
+ drawing editor, and that is suitable for input to text formatters or for
+ automatic translation to a variety of formats suitable for input to text
+ formatters. A copy made in an otherwise Transparent file format whose
+ markup, or absence of markup, has been arranged to thwart or discourage
+ subsequent modification by readers is not Transparent. An image format is
+ not Transparent if used for any substantial amount of text. A copy that is
+ not “Transparent†is called “Opaqueâ€.
</p><p>
Examples of suitable formats for Transparent copies include plain ASCII
without markup, Texinfo input format, LaTeX input format, SGML or XML
using a publicly available DTD, and standard-conforming simple HTML,
- PostScript or PDF designed for human modification. Examples of
- transparent image formats include PNG, XCF and JPG. Opaque formats
- include proprietary formats that can be read and edited only by
- proprietary word processors, SGML or XML for which the DTD and/or
- processing tools are not generally available, and the machine-generated
- HTML, PostScript or PDF produced by some word processors for output
- purposes only.
- </p><p>
- The "Title Page" means, for a printed book, the title page itself, plus
- such following pages as are needed to hold, legibly, the material this
- License requires to appear in the title page. For works in formats which
- do not have any title page as such, "Title Page" means the text near the
- most prominent appearance of the work's title, preceding the beginning of
- the body of the text.
- </p><p>
- A section "Entitled XYZ" means a named subunit of the Document whose title
- either is precisely XYZ or contains XYZ in parentheses following text that
- translates XYZ in another language. (Here XYZ stands for a specific
- section name mentioned below, such as "Acknowledgements", "Dedications",
- "Endorsements", or "History".) To "Preserve the Title" of such a section
- when you modify the Document means that it remains a section "Entitled
- XYZ" according to this definition.
+ PostScript or PDF designed for human modification. Examples of transparent
+ image formats include PNG, XCF and JPG. Opaque formats include proprietary
+ formats that can be read and edited only by proprietary word processors,
+ SGML or XML for which the DTD and/or processing tools are not generally
+ available, and the machine-generated HTML, PostScript or PDF produced by
+ some word processors for output purposes only.
+ </p><p>
+ The “Title Page†means, for a printed book, the title page
+ itself, plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For works in
+ formats which do not have any title page as such, “Title Pageâ€
+ means the text near the most prominent appearance of the work’s
+ title, preceding the beginning of the body of the text.
+ </p><p>
+ The “publisher†means any person or entity that distributes
+ copies of the Document to the public.
+ </p><p>
+ A section “Entitled XYZ†means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ stands
+ for a specific section name mentioned below, such as
+ “Acknowledgementsâ€, “Dedicationsâ€,
+ “Endorsementsâ€, or “Historyâ€.) To “Preserve
+ the Title†of such a section when you modify the Document means that
+ it remains a section “Entitled XYZ†according to this
+ definition.
</p><p>
The Document may include Warranty Disclaimers next to the notice which
- states that this License applies to the Document. These Warranty
+ states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this License,
but only as regards disclaiming warranties: any other implication that
these Warranty Disclaimers may have is void and has no effect on the
meaning of this License.
- </p><h2><a id="VerbatimCopying"></a>
+ </p><h3><a id="fdl-1-section2"></a>
2. VERBATIM COPYING
- </h2><p>
+ </h3><p>
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the copyright
notices, and the license notice saying this License applies to the
Document are reproduced in all copies, and that you add no other
- conditions whatsoever to those of this License. You may not use technical
+ conditions whatsoever to those of this License. You may not use technical
measures to obstruct or control the reading or further copying of the
- copies you make or distribute. However, you may accept compensation in
- exchange for copies. If you distribute a large enough number of copies
- you must also follow the conditions in section 3.
+ copies you make or distribute. However, you may accept compensation in
+ exchange for copies. If you distribute a large enough number of copies you
+ must also follow the conditions in section 3.
</p><p>
You may also lend copies, under the same conditions stated above, and you
may publicly display copies.
- </p><h2><a id="QuantityCopying"></a>
+ </p><h3><a id="fdl-1-section3"></a>
3. COPYING IN QUANTITY
- </h2><p>
+ </h3><p>
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
- Document's license notice requires Cover Texts, you must enclose the
- copies in covers that carry, clearly and legibly, all these Cover Texts:
- Front-Cover Texts on the front cover, and Back-Cover Texts on the back
- cover. Both covers must also clearly and legibly identify you as the
- publisher of these copies. The front cover must present the full title
- with all words of the title equally prominent and visible. You may add
- other material on the covers in addition. Copying with changes limited to
+ Document’s license notice requires Cover Texts, you must enclose
+ the copies in covers that carry, clearly and legibly, all these Cover
+ Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the
+ back cover. Both covers must also clearly and legibly identify you as the
+ publisher of these copies. The front cover must present the full title
+ with all words of the title equally prominent and visible. You may add
+ other material on the covers in addition. Copying with changes limited to
the covers, as long as they preserve the title of the Document and satisfy
- these conditions, can be treated as verbatim copying in other
- respects.
+ these conditions, can be treated as verbatim copying in other respects.
</p><p>
If the required texts for either cover are too voluminous to fit legibly,
you should put the first ones listed (as many as fit reasonably) on the
@@ -155,7 +159,7 @@
along with each Opaque copy, or state in or with each Opaque copy a
computer-network location from which the general network-using public has
access to download using public-standard network protocols a complete
- Transparent copy of the Document, free of added material. If you use the
+ Transparent copy of the Document, free of added material. If you use the
latter option, you must take reasonably prudent steps, when you begin
distribution of Opaque copies in quantity, to ensure that this Transparent
copy will remain thus accessible at the stated location until at least one
@@ -164,24 +168,23 @@
</p><p>
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
- them a chance to provide you with an updated version of the
- Document.
- </p><h2><a id="Modifications"></a>
+ them a chance to provide you with an updated version of the Document.
+ </p><h3><a id="fdl-1-section4"></a>
4. MODIFICATIONS
- </h2><p>
+ </h3><p>
You may copy and distribute a Modified Version of the Document under the
conditions of sections 2 and 3 above, provided that you release the
Modified Version under precisely this License, with the Modified Version
filling the role of the Document, thus licensing distribution and
- modification of the Modified Version to whoever possesses a copy of it.
- In addition, you must do these things in the Modified Version:
+ modification of the Modified Version to whoever possesses a copy of it. In
+ addition, you must do these things in the Modified Version:
</p><div class="orderedlist"><ol class="orderedlist" type="A"><li class="listitem">
Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions (which
should, if there were any, be listed in the History section of the
- Document). You may use the same title as a previous version if the
+ Document). You may use the same title as a previous version if the
original publisher of that version gives permission.
- </li><li class="listitem">
+ </li><li class="listitem">
List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
@@ -201,60 +204,63 @@
terms of this License, in the form shown in the Addendum below.
</li><li class="listitem">
Preserve in that license notice the full lists of Invariant Sections
- and required Cover Texts given in the Document's license notice.
+ and required Cover Texts given in the Document’s license
+ notice.
</li><li class="listitem">
Include an unaltered copy of this License.
</li><li class="listitem">
- Preserve the section Entitled "History", Preserve its Title, and add
- to it an item stating at least the title, year, new authors, and
- publisher of the Modified Version as given on the Title Page. If
- there is no section Entitled "History" in the Document, create one
- stating the title, year, authors, and publisher of the Document as
- given on its Title Page, then add an item describing the Modified
- Version as stated in the previous sentence.
+ Preserve the section Entitled “Historyâ€, Preserve its
+ Title, and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on the Title
+ Page. If there is no section Entitled “History†in the
+ Document, create one stating the title, year, authors, and publisher
+ of the Document as given on its Title Page, then add an item
+ describing the Modified Version as stated in the previous sentence.
</li><li class="listitem">
Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise the
network locations given in the Document for previous versions it was
- based on. These may be placed in the "History" section. You may omit
- a network location for a work that was published at least four years
- before the Document itself, or if the original publisher of the
- version it refers to gives permission.
+ based on. These may be placed in the “Historyâ€
+ section. You may omit a network location for a work that was published
+ at least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.
</li><li class="listitem">
- For any section Entitled "Acknowledgements" or "Dedications", Preserve
- the Title of the section, and preserve in the section all the
- substance and tone of each of the contributor acknowledgements and/or
- dedications given therein.
+ For any section Entitled “Acknowledgements†or
+ “Dedicationsâ€, Preserve the Title of the section, and
+ preserve in the section all the substance and tone of each of the
+ contributor acknowledgements and/or dedications given therein.
</li><li class="listitem">
Preserve all the Invariant Sections of the Document, unaltered in
- their text and in their titles. Section numbers or the equivalent are
+ their text and in their titles. Section numbers or the equivalent are
not considered part of the section titles.
</li><li class="listitem">
- Delete any section Entitled "Endorsements". Such a section may not be
- included in the Modified Version.
+ Delete any section Entitled “Endorsementsâ€. Such a section
+ may not be included in the Modified Version.
</li><li class="listitem">
- Do not retitle any existing section to be Entitled "Endorsements" or
- to conflict in title with any Invariant Section.
+ Do not retitle any existing section to be Entitled
+ “Endorsements†or to conflict in title with any Invariant
+ Section.
</li><li class="listitem">
Preserve any Warranty Disclaimers.
</li></ol></div><p>
If the Modified Version includes new front-matter sections or appendices
that qualify as Secondary Sections and contain no material copied from the
Document, you may at your option designate some or all of these sections
- as invariant. To do this, add their titles to the list of Invariant
- Sections in the Modified Version's license notice. These titles must be
- distinct from any other section titles.
+ as invariant. To do this, add their titles to the list of Invariant
+ Sections in the Modified Version’s license notice. These titles
+ must be distinct from any other section titles.
</p><p>
- You may add a section Entitled "Endorsements", provided it contains
- nothing but endorsements of your Modified Version by various parties--for
- example, statements of peer review or that the text has been approved by
- an organization as the authoritative definition of a standard.
+ You may add a section Entitled “Endorsementsâ€, provided it
+ contains nothing but endorsements of your Modified Version by various
+ parties — for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative definition of a
+ standard.
</p><p>
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list of
- Cover Texts in the Modified Version. Only one passage of Front-Cover Text
+ Cover Texts in the Modified Version. Only one passage of Front-Cover Text
and one of Back-Cover Text may be added by (or through arrangements made
- by) any one entity. If the Document already includes a cover text for the
+ by) any one entity. If the Document already includes a cover text for the
same cover, previously added by you or by arrangement made by the same
entity you are acting on behalf of, you may not add another; but you may
replace the old one, on explicit permission from the previous publisher
@@ -263,9 +269,9 @@
The author(s) and publisher(s) of the Document do not by this License give
permission to use their names for publicity for or to assert or imply
endorsement of any Modified Version.
- </p><h2><a id="Combining"></a>
+ </p><h3><a id="fdl-1-section5"></a>
5. COMBINING DOCUMENTS
- </h2><p>
+ </h3><p>
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified versions,
provided that you include in the combination all of the Invariant Sections
@@ -274,22 +280,23 @@
you preserve all their Warranty Disclaimers.
</p><p>
The combined work need only contain one copy of this License, and multiple
- identical Invariant Sections may be replaced with a single copy. If there
+ identical Invariant Sections may be replaced with a single copy. If there
are multiple Invariant Sections with the same name but different contents,
make the title of each such section unique by adding at the end of it, in
parentheses, the name of the original author or publisher of that section
- if known, or else a unique number. Make the same adjustment to the
- section titles in the list of Invariant Sections in the license notice of
- the combined work.
- </p><p>
- In the combination, you must combine any sections Entitled "History" in
- the various original documents, forming one section Entitled "History";
- likewise combine any sections Entitled "Acknowledgements", and any
- sections Entitled "Dedications". You must delete all sections Entitled
- "Endorsements".
- </p><h2><a id="Collections"></a>
+ if known, or else a unique number. Make the same adjustment to the section
+ titles in the list of Invariant Sections in the license notice of the
+ combined work.
+ </p><p>
+ In the combination, you must combine any sections Entitled
+ “History†in the various original documents, forming one
+ section Entitled “Historyâ€; likewise combine any sections
+ Entitled “Acknowledgementsâ€, and any sections Entitled
+ “Dedicationsâ€. You must delete all sections Entitled
+ “Endorsementsâ€.
+ </p><h3><a id="fdl-1-section6"></a>
6. COLLECTIONS OF DOCUMENTS
- </h2><p>
+ </h3><p>
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
@@ -300,90 +307,135 @@
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all other
respects regarding verbatim copying of that document.
- </p><h2><a id="Aggregation"></a>
+ </p><h3><a id="fdl-1-section7"></a>
7. AGGREGATION WITH INDEPENDENT WORKS
- </h2><p>
+ </h3><p>
A compilation of the Document or its derivatives with other separate and
independent documents or works, in or on a volume of a storage or
- distribution medium, is called an "aggregate" if the copyright resulting
- from the compilation is not used to limit the legal rights of the
- compilation's users beyond what the individual works permit. When the
- Document is included in an aggregate, this License does not apply to the
- other works in the aggregate which are not themselves derivative works of
- the Document.
+ distribution medium, is called an “aggregate†if the copyright
+ resulting from the compilation is not used to limit the legal rights of
+ the compilation’s users beyond what the individual works
+ permit. When the Document is included in an aggregate, this License does
+ not apply to the other works in the aggregate which are not themselves
+ derivative works of the Document.
</p><p>
If the Cover Text requirement of section 3 is applicable to these copies
of the Document, then if the Document is less than one half of the entire
- aggregate, the Document's Cover Texts may be placed on covers that bracket
- the Document within the aggregate, or the electronic equivalent of covers
- if the Document is in electronic form. Otherwise they must appear on
- printed covers that bracket the whole aggregate.
- </p><h2><a id="Translation"></a>
+ aggregate, the Document’s Cover Texts may be placed on covers that
+ bracket the Document within the aggregate, or the electronic equivalent of
+ covers if the Document is in electronic form. Otherwise they must appear
+ on printed covers that bracket the whole aggregate.
+ </p><h3><a id="fdl-1-section8"></a>
8. TRANSLATION
- </h2><p>
+ </h3><p>
Translation is considered a kind of modification, so you may distribute
- translations of the Document under the terms of section 4. Replacing
+ translations of the Document under the terms of section 4. Replacing
Invariant Sections with translations requires special permission from
their copyright holders, but you may include translations of some or all
Invariant Sections in addition to the original versions of these Invariant
- Sections. You may include a translation of this License, and all the
+ Sections. You may include a translation of this License, and all the
license notices in the Document, and any Warranty Disclaimers, provided
that you also include the original English version of this License and the
- original versions of those notices and disclaimers. In case of a
+ original versions of those notices and disclaimers. In case of a
disagreement between the translation and the original version of this
License or a notice or disclaimer, the original version will prevail.
</p><p>
- If a section in the Document is Entitled "Acknowledgements",
- "Dedications", or "History", the requirement (section 4) to Preserve its
- Title (section 1) will typically require changing the actual title.
- </p><h2><a id="fdl-1-termination"></a>
+ If a section in the Document is Entitled “Acknowledgementsâ€,
+ “Dedicationsâ€, or “Historyâ€, the requirement
+ (section 4) to Preserve its Title (section 1) will typically require
+ changing the actual title.
+ </p><h3><a id="fdl-1-section9"></a>
9. TERMINATION
- </h2><p>
+ </h3><p>
You may not copy, modify, sublicense, or distribute the Document except as
- expressly provided for under this License. Any other attempt to copy,
- modify, sublicense or distribute the Document is void, and will
- automatically terminate your rights under this License. However, parties
- who have received copies, or rights, from you under this License will not
- have their licenses terminated so long as such parties remain in full
- compliance.
- </p><h2><a id="FutureRevisions"></a>
+ expressly provided under this License. Any attempt otherwise to copy,
+ modify, sublicense, or distribute it is void, and will automatically
+ terminate your rights under this License.
+ </p><p>
+ However, if you cease all violation of this License, then your license
+ from a particular copyright holder is reinstated (a) provisionally, unless
+ and until the copyright holder explicitly and finally terminates your
+ license, and (b) permanently, if the copyright holder fails to notify you
+ of the violation by some reasonable means prior to 60 days after the
+ cessation.
+ </p><p>
+ Moreover, your license from a particular copyright holder is reinstated
+ permanently if the copyright holder notifies you of the violation by some
+ reasonable means, this is the first time you have received notice of
+ violation of this License (for any work) from that copyright holder, and
+ you cure the violation prior to 30 days after your receipt of the notice.
+ </p><p>
+ Termination of your rights under this section does not terminate the
+ licenses of parties who have received copies or rights from you under this
+ License. If your rights have been terminated and not permanently
+ reinstated, receipt of a copy of some or all of the same material does not
+ give you any rights to use it.
+ </p><h3><a id="fdl-1-section10"></a>
10. FUTURE REVISIONS OF THIS LICENSE
- </h2><p>
+ </h3><p>
The Free Software Foundation may publish new, revised versions of the GNU
- Free Documentation License from time to time. Such new versions will be
+ Free Documentation License from time to time. Such new versions will be
similar in spirit to the present version, but may differ in detail to
- address new problems or concerns. See <a class="ulink" href="http://www.gnu.org/copyleft/" target="_top">http://www.gnu.org/copyleft/</a>.
+ address new problems or concerns. See
+ <a class="ulink" href="http://www.gnu.org/copyleft/" target="_top">Copyleft</a>.
</p><p>
- Each version of the License is given a distinguishing version number. If
+ Each version of the License is given a distinguishing version number. If
the Document specifies that a particular numbered version of this License
- "or any later version" applies to it, you have the option of following the
- terms and conditions either of that specified version or of any later
- version that has been published (not as a draft) by the Free Software
- Foundation. If the Document does not specify a version number of this
- License, you may choose any version ever published (not as a draft) by the
- Free Software Foundation.
- </p><h2><a id="HowToUse"></a>
+ “or any later version†applies to it, you have the option of
+ following the terms and conditions either of that specified version or of
+ any later version that has been published (not as a draft) by the Free
+ Software Foundation. If the Document does not specify a version number of
+ this License, you may choose any version ever published (not as a draft)
+ by the Free Software Foundation. If the Document specifies that a proxy
+ can decide which future versions of this License can be used, that
+ proxy’s public statement of acceptance of a version permanently
+ authorizes you to choose that version for the Document.
+ </p><h3><a id="fdl-1-section11"></a>
+ 11. RELICENSING
+ </h3><p>
+ “Massive Multiauthor Collaboration Site†(or “MMC
+ Siteâ€) means any World Wide Web server that publishes copyrightable
+ works and also provides prominent facilities for anybody to edit those
+ works. A public wiki that anybody can edit is an example of such a
+ server. A “Massive Multiauthor Collaboration†(or
+ “MMCâ€) contained in the site means any set of copyrightable
+ works thus published on the MMC site.
+ </p><p>
+ “CC-BY-SA†means the Creative Commons Attribution-Share Alike
+ 3.0 license published by Creative Commons Corporation, a not-for-profit
+ corporation with a principal place of business in San Francisco,
+ California, as well as future copyleft versions of that license published
+ by that same organization.
+ </p><p>
+ “Incorporate†means to publish or republish a Document, in
+ whole or in part, as part of another Document.
+ </p><p>
+ An MMC is “eligible for relicensing†if it is licensed under
+ this License, and if all works that were first published under this
+ License somewhere other than this MMC, and subsequently incorporated in
+ whole or in part into the MMC, (1) had no cover texts or invariant
+ sections, and (2) were thus incorporated prior to November 1, 2008.
+ </p><p>
+ The operator of an MMC Site may republish an MMC contained in the site
+ under CC-BY-SA on the same site at any time before August 1, 2009,
+ provided the MMC is eligible for relicensing.
+ </p><h3><a id="fdl-1-addendum"></a>
ADDENDUM: How to use this License for your documents
- </h2><p>
+ </h3><p>
To use this License in a document you have written, include a copy of the
License in the document and put the following copyright and license
notices just after the title page:
- </p><div class="blockquote"><blockquote class="blockquote"><p>
- Copyright (C) YEAR YOUR NAME.
- </p><p>
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.2 or
- any later version published by the Free Software Foundation; with no
- Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
- copy of the license is included in the section entitled "GNU Free
- Documentation License".
- </p></blockquote></div><p>
+ </p><pre class="screen">Copyright © YEAR YOUR NAME
+
+Permission is granted to copy, distribute and/or modify this document under the
+terms of the GNU Free Documentation License, Version 1.3 or any later version
+published by the Free Software Foundation; with no Invariant Sections, no
+Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in
+the section entitled “GNU Free Documentation Licenseâ€.</pre><p>
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
- replace the "with...Texts." line with this:
- </p><div class="blockquote"><blockquote class="blockquote"><p>
- with the Invariant Sections being LIST THEIR TITLES, with the
- Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
- </p></blockquote></div><p>
+ replace the “with… Texts.†line with this:
+ </p><pre class="screen">with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts
+being LIST, and with the Back-Cover Texts being LIST.</pre><p>
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
diff --git a/libstdc++-v3/doc/html/manual/appendix_gpl.html b/libstdc++-v3/doc/html/manual/appendix_gpl.html
index 012c9086be4..e2258ccf2d3 100644
--- a/libstdc++-v3/doc/html/manual/appendix_gpl.html
+++ b/libstdc++-v3/doc/html/manual/appendix_gpl.html
@@ -78,7 +78,7 @@
</p><p>
The precise terms and conditions for copying, distribution and modification
follow.
- </p><h2><a id="id637048"></a>
+ </p><h2><a id="id537276"></a>
TERMS AND CONDITIONS
</h2><h2><a id="gpl-3-definitions"></a>
0. Definitions.
@@ -619,7 +619,7 @@
waiver of all civil liability in connection with the Program, unless a
warranty or assumption of liability accompanies a copy of the Program in
return for a fee.
- </p><h2><a id="id591865"></a>
+ </p><h2><a id="id566887"></a>
END OF TERMS AND CONDITIONS
</h2><h2><a id="HowToApply"></a>
How to Apply These Terms to Your New Programs
diff --git a/libstdc++-v3/doc/html/manual/appendix_porting.html b/libstdc++-v3/doc/html/manual/appendix_porting.html
index 46ee854f2c1..9a3e94b7ace 100644
--- a/libstdc++-v3/doc/html/manual/appendix_porting.html
+++ b/libstdc++-v3/doc/html/manual/appendix_porting.html
@@ -7,7 +7,7 @@
Appendices
</th><td width="20%" align="right"> <a accesskey="n" href="internals.html">Next</a></td></tr></table><hr /></div><div class="appendix" title="Appendix B.  Porting and Maintenance"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.porting"></a>Appendix B. 
Porting and Maintenance
- <a id="id573879" class="indexterm"></a>
+ <a id="id549164" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.map">Overview: What Comes from Where</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.enable"><code class="constant">GLIBCXX_ENABLE</code>, the <code class="literal">--enable</code> maker</a></span></dt></dl></dd><dt><span class="sect1"><a href="internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="sect2"><a href="internals.html#internals.os">Operating System</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.cpu">CPU</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="sect1"><a href="test.html">Test</a></span></dt><dd><dl><dt><span class="sect2"><a href="test.html#test.organization">Organization</a></span></dt><dt><span class="sect2"><a href="test.html#test.run">Running the Testsuite</a></span></dt><dt><span class="sect2"><a href="test.html#test.new_tests">Writing a new test case</a></span></dt><dt><span class="sect2"><a href="test.html#test.harness">Test Harness and Utilities</a></span></dt><dt><span class="sect2"><a href="test.html#test.special">Special Topics</a></span></dt></dl></dd><dt><span class="sect1"><a href="abi.html">ABI Policy and Guidelines</a></span></dt><dd><dl><dt><span class="sect2"><a href="abi.html#abi.cxx_interface">The C++ Interface</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.versioning">Versioning</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_allowed">Allowed Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_no">Prohibited Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.testing">Testing</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.issues">Outstanding Issues</a></span></dt></dl></dd><dt><span class="sect1"><a href="api.html">API Evolution and Deprecation History</a></span></dt><dd><dl><dt><span class="sect2"><a href="api.html#api.rel_300"><code class="constant">3.0</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_310"><code class="constant">3.1</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_320"><code class="constant">3.2</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_330"><code class="constant">3.3</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_340"><code class="constant">3.4</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_400"><code class="constant">4.0</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_410"><code class="constant">4.1</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_420"><code class="constant">4.2</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_430"><code class="constant">4.3</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_440"><code class="constant">4.4</code></a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_450"><code class="constant">4.5</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="backwards.html">Backwards Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="backwards.html#backwards.first">First</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.second">Second</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.third">Third</a></span></dt></dl></dd></dl></div><div class="sect1" title="Configure and Build Hacking"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="appendix.porting.build_hacking"></a>Configure and Build Hacking</h2></div></div></div><div class="sect2" title="Prerequisites"><div class="titlepage"><div><div><h3 class="title"><a id="build_hacking.prereq"></a>Prerequisites</h3></div></div></div><p>
As noted <a class="ulink" href="http://gcc.gnu.org/install/prerequisites.html" target="_top">previously</a>,
certain other tools are necessary for hacking on files that
diff --git a/libstdc++-v3/doc/html/manual/atomics.html b/libstdc++-v3/doc/html/manual/atomics.html
index a01126003fa..317d66fce72 100644
--- a/libstdc++-v3/doc/html/manual/atomics.html
+++ b/libstdc++-v3/doc/html/manual/atomics.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="concurrency.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 14.  Atomics"><div class="titlepage"><div><div><h2 class="title"><a id="std.atomics"></a>Chapter 14. 
Atomics
- <a id="id546403" class="indexterm"></a>
+ <a id="id601538" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="atomics.html#std.atomics.api">API Reference</a></span></dt></dl></div><p>
Facilities for atomic operations.
</p><div class="sect1" title="API Reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.atomics.api"></a>API Reference</h2></div></div></div><p>
diff --git a/libstdc++-v3/doc/html/manual/backwards.html b/libstdc++-v3/doc/html/manual/backwards.html
index dc8e7d1cdc8..02517c6cd94 100644
--- a/libstdc++-v3/doc/html/manual/backwards.html
+++ b/libstdc++-v3/doc/html/manual/backwards.html
@@ -17,8 +17,8 @@ ISO Standard (e.g., statistical analysis). While there are a lot of
really useful things that are used by a lot of people, the Standards
Committee couldn't include everything, and so a lot of those
<span class="quote">“<span class="quote">obvious</span>â€</span> classes didn't get included.
-</p><p>Known Issues include many of the limitations of its immediate ancestor.</p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" title="No ios_base"><div class="titlepage"><div><div><h4 class="title"><a id="id638290"></a>No <code class="code">ios_base</code></h4></div></div></div><p> At least some older implementations don't have <code class="code">std::ios_base</code>, so you should use <code class="code">std::ios::badbit</code>, <code class="code">std::ios::failbit</code> and <code class="code">std::ios::eofbit</code> and <code class="code">std::ios::goodbit</code>.
-</p></div><div class="sect3" title="No cout in ostream.h, no cin in istream.h"><div class="titlepage"><div><div><h4 class="title"><a id="id638322"></a>No <code class="code">cout</code> in <code class="code">ostream.h</code>, no <code class="code">cin</code> in <code class="code">istream.h</code></h4></div></div></div><p>
+</p><p>Known Issues include many of the limitations of its immediate ancestor.</p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" title="No ios_base"><div class="titlepage"><div><div><h4 class="title"><a id="id591781"></a>No <code class="code">ios_base</code></h4></div></div></div><p> At least some older implementations don't have <code class="code">std::ios_base</code>, so you should use <code class="code">std::ios::badbit</code>, <code class="code">std::ios::failbit</code> and <code class="code">std::ios::eofbit</code> and <code class="code">std::ios::goodbit</code>.
+</p></div><div class="sect3" title="No cout in ostream.h, no cin in istream.h"><div class="titlepage"><div><div><h4 class="title"><a id="id591813"></a>No <code class="code">cout</code> in <code class="code">ostream.h</code>, no <code class="code">cin</code> in <code class="code">istream.h</code></h4></div></div></div><p>
In earlier versions of the standard,
<code class="filename">fstream.h</code>,
<code class="filename">ostream.h</code>
@@ -44,7 +44,7 @@ considered replaced and rewritten.
archived. The code is considered replaced and rewritten.
</p><p>
Portability notes and known implementation limitations are as follows.
-</p><div class="sect3" title="Namespace std:: not supported"><div class="titlepage"><div><div><h4 class="title"><a id="id651614"></a>Namespace <code class="code">std::</code> not supported</h4></div></div></div><p>
+</p><div class="sect3" title="Namespace std:: not supported"><div class="titlepage"><div><div><h4 class="title"><a id="id659770"></a>Namespace <code class="code">std::</code> not supported</h4></div></div></div><p>
Some care is required to support C++ compiler and or library
implementation that do not have the standard library in
<code class="code">namespace std</code>.
@@ -108,7 +108,7 @@ AC_DEFUN([AC_CXX_NAMESPACE_STD], [
AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ])
fi
])
-</pre></div><div class="sect3" title="Illegal iterator usage"><div class="titlepage"><div><div><h4 class="title"><a id="id651737"></a>Illegal iterator usage</h4></div></div></div><p>
+</pre></div><div class="sect3" title="Illegal iterator usage"><div class="titlepage"><div><div><h4 class="title"><a id="id659892"></a>Illegal iterator usage</h4></div></div></div><p>
The following illustrate implementation-allowed illegal iterator
use, and then correct use.
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
@@ -121,7 +121,7 @@ AC_DEFUN([AC_CXX_NAMESPACE_STD], [
</p></li><li class="listitem"><p>
<code class="code">if (iterator)</code> won't work any more =&gt; use
<code class="code">if (iterator != iterator_type())</code>
- </p></li></ul></div></div><div class="sect3" title="isspace from cctype is a macro"><div class="titlepage"><div><div><h4 class="title"><a id="id651798"></a><code class="code">isspace</code> from <code class="filename">cctype</code> is a macro
+ </p></li></ul></div></div><div class="sect3" title="isspace from cctype is a macro"><div class="titlepage"><div><div><h4 class="title"><a id="id659954"></a><code class="code">isspace</code> from <code class="filename">cctype</code> is a macro
</h4></div></div></div><p>
Glibc 2.0.x and 2.1.x define <code class="filename">ctype.h</code> functionality as macros
(isspace, isalpha etc.).
@@ -154,7 +154,7 @@ std:: (__ctype_b[(int) ( ( 'X' ) )] &amp; (unsigned short int) _ISspace ) ;
(<code class="filename">ctype.h</code>) and the
definitions in namespace <code class="code">std::</code>
(<code class="code">&lt;cctype&gt;</code>).
-</p></div><div class="sect3" title="No vector::at, deque::at, string::at"><div class="titlepage"><div><div><h4 class="title"><a id="id590368"></a>No <code class="code">vector::at</code>, <code class="code">deque::at</code>, <code class="code">string::at</code></h4></div></div></div><p>
+</p></div><div class="sect3" title="No vector::at, deque::at, string::at"><div class="titlepage"><div><div><h4 class="title"><a id="id660047"></a>No <code class="code">vector::at</code>, <code class="code">deque::at</code>, <code class="code">string::at</code></h4></div></div></div><p>
One solution is to add an autoconf-test for this:
</p><pre class="programlisting">
AC_MSG_CHECKING(for container::at)
@@ -180,7 +180,7 @@ AC_DEFINE(HAVE_CONTAINER_AT)],
</pre><p>
If you are using other (non-GNU) compilers it might be a good idea
to check for <code class="code">string::at</code> separately.
-</p></div><div class="sect3" title="No std::char_traits&lt;char&gt;::eof"><div class="titlepage"><div><div><h4 class="title"><a id="id590406"></a>No <code class="code">std::char_traits&lt;char&gt;::eof</code></h4></div></div></div><p>
+</p></div><div class="sect3" title="No std::char_traits&lt;char&gt;::eof"><div class="titlepage"><div><div><h4 class="title"><a id="id660085"></a>No <code class="code">std::char_traits&lt;char&gt;::eof</code></h4></div></div></div><p>
Use some kind of autoconf test, plus this:
</p><pre class="programlisting">
#ifdef HAVE_CHAR_TRAITS
@@ -188,7 +188,7 @@ AC_DEFINE(HAVE_CONTAINER_AT)],
#else
#define CPP_EOF EOF
#endif
-</pre></div><div class="sect3" title="No string::clear"><div class="titlepage"><div><div><h4 class="title"><a id="id590424"></a>No <code class="code">string::clear</code></h4></div></div></div><p>
+</pre></div><div class="sect3" title="No string::clear"><div class="titlepage"><div><div><h4 class="title"><a id="id660103"></a>No <code class="code">string::clear</code></h4></div></div></div><p>
There are two functions for deleting the contents of a string:
<code class="code">clear</code> and <code class="code">erase</code> (the latter returns the
string).
@@ -206,12 +206,12 @@ erase(size_type __pos = 0, size_type __n = npos)
Unfortunately, <code class="code">clear</code> is not implemented in this
version, so you should use <code class="code">erase</code> (which is probably
faster than <code class="code">operator=(charT*)</code>).
-</p></div><div class="sect3" title="Removal of ostream::form and istream::scan extensions"><div class="titlepage"><div><div><h4 class="title"><a id="id590469"></a>
+</p></div><div class="sect3" title="Removal of ostream::form and istream::scan extensions"><div class="titlepage"><div><div><h4 class="title"><a id="id660148"></a>
Removal of <code class="code">ostream::form</code> and <code class="code">istream::scan</code>
extensions
</h4></div></div></div><p>
These are no longer supported. Please use stringstreams instead.
-</p></div><div class="sect3" title="No basic_stringbuf, basic_stringstream"><div class="titlepage"><div><div><h4 class="title"><a id="id590488"></a>No <code class="code">basic_stringbuf</code>, <code class="code">basic_stringstream</code></h4></div></div></div><p>
+</p></div><div class="sect3" title="No basic_stringbuf, basic_stringstream"><div class="titlepage"><div><div><h4 class="title"><a id="id590365"></a>No <code class="code">basic_stringbuf</code>, <code class="code">basic_stringstream</code></h4></div></div></div><p>
Although the ISO standard <code class="code">i/ostringstream</code>-classes are
provided, (<code class="filename">sstream</code>), for
compatibility with older implementations the pre-ISO
@@ -299,14 +299,14 @@ any = temp;
Another example of using stringstreams is in <a class="link" href="strings.html#strings.string.shrink" title="Shrink to Fit">this howto</a>.
</p><p> There is additional information in the libstdc++-v2 info files, in
particular <span class="quote">“<span class="quote">info iostream</span>â€</span>.
-</p></div><div class="sect3" title="Little or no wide character support"><div class="titlepage"><div><div><h4 class="title"><a id="id590639"></a>Little or no wide character support</h4></div></div></div><p>
+</p></div><div class="sect3" title="Little or no wide character support"><div class="titlepage"><div><div><h4 class="title"><a id="id590515"></a>Little or no wide character support</h4></div></div></div><p>
Classes <code class="classname">wstring</code> and
<code class="classname">char_traits&lt;wchar_t&gt;</code> are
not supported.
- </p></div><div class="sect3" title="No templatized iostreams"><div class="titlepage"><div><div><h4 class="title"><a id="id590658"></a>No templatized iostreams</h4></div></div></div><p>
+ </p></div><div class="sect3" title="No templatized iostreams"><div class="titlepage"><div><div><h4 class="title"><a id="id590534"></a>No templatized iostreams</h4></div></div></div><p>
Classes <code class="classname">wfilebuf</code> and
<code class="classname">wstringstream</code> are not supported.
- </p></div><div class="sect3" title="Thread safety issues"><div class="titlepage"><div><div><h4 class="title"><a id="id653932"></a>Thread safety issues</h4></div></div></div><p>
+ </p></div><div class="sect3" title="Thread safety issues"><div class="titlepage"><div><div><h4 class="title"><a id="id590553"></a>Thread safety issues</h4></div></div></div><p>
Earlier GCC releases had a somewhat different approach to
threading configuration and proper compilation. Before GCC 3.0,
configuration of the threading model was dictated by compiler
@@ -364,7 +364,7 @@ libstdc++-v3.
of the SGI STL (version 3.3), with extensive changes.
</p><p>A more formal description of the V3 goals can be found in the
official <a class="link" href="source_design_notes.html" title="Design Notes">design document</a>.
- </p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" title="Pre-ISO headers moved to backwards or removed"><div class="titlepage"><div><div><h4 class="title"><a id="id654048"></a>Pre-ISO headers moved to backwards or removed</h4></div></div></div><p> The pre-ISO C++ headers
+ </p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" title="Pre-ISO headers moved to backwards or removed"><div class="titlepage"><div><div><h4 class="title"><a id="id590669"></a>Pre-ISO headers moved to backwards or removed</h4></div></div></div><p> The pre-ISO C++ headers
(<code class="code">iostream.h</code>, <code class="code">defalloc.h</code> etc.) are
available, unlike previous libstdc++ versions, but inclusion
generates a warning that you are using deprecated headers.
@@ -436,7 +436,7 @@ like <code class="filename">vector.h</code> can be replaced with <code class="fi
directive <code class="code">using namespace std;</code> can be put at the global
scope. This should be enough to get this code compiling, assuming the
other usage is correct.
-</p></div><div class="sect3" title="Extension headers hash_map, hash_set moved to ext or backwards"><div class="titlepage"><div><div><h4 class="title"><a id="id654131"></a>Extension headers hash_map, hash_set moved to ext or backwards</h4></div></div></div><p>At this time most of the features of the SGI STL extension have been
+</p></div><div class="sect3" title="Extension headers hash_map, hash_set moved to ext or backwards"><div class="titlepage"><div><div><h4 class="title"><a id="id590752"></a>Extension headers hash_map, hash_set moved to ext or backwards</h4></div></div></div><p>At this time most of the features of the SGI STL extension have been
replaced by standardized libraries.
In particular, the unordered_map and unordered_set containers of TR1
are suitable replacement for the non-standard hash_map and hash_set
@@ -508,7 +508,7 @@ AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ])
fi
])
-</pre></div><div class="sect3" title="No ios::nocreate/ios::noreplace."><div class="titlepage"><div><div><h4 class="title"><a id="id654232"></a>No <code class="code">ios::nocreate/ios::noreplace</code>.
+</pre></div><div class="sect3" title="No ios::nocreate/ios::noreplace."><div class="titlepage"><div><div><h4 class="title"><a id="id532406"></a>No <code class="code">ios::nocreate/ios::noreplace</code>.
</h4></div></div></div><p> The existence of <code class="code">ios::nocreate</code> being used for
input-streams has been confirmed, most probably because the author
thought it would be more correct to specify nocreate explicitly. So
@@ -519,7 +519,7 @@ open the file for reading, check if it has been opened, and then
decide whether you want to create/replace or not. To my knowledge,
even older implementations support <code class="code">app</code>, <code class="code">ate</code>
and <code class="code">trunc</code> (except for <code class="code">app</code> ?).
-</p></div><div class="sect3" title="No stream::attach(int fd)"><div class="titlepage"><div><div><h4 class="title"><a id="id536658"></a>
+</p></div><div class="sect3" title="No stream::attach(int fd)"><div class="titlepage"><div><div><h4 class="title"><a id="id532453"></a>
No <code class="code">stream::attach(int fd)</code>
</h4></div></div></div><p>
Phil Edwards writes: It was considered and rejected for the ISO
@@ -542,7 +542,7 @@ No <code class="code">stream::attach(int fd)</code>
For another example of this, refer to
<a class="ulink" href="http://www.josuttis.com/cppcode/fdstream.html" target="_top">fdstream example</a>
by Nicolai Josuttis.
-</p></div><div class="sect3" title="Support for C++98 dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id536722"></a>
+</p></div><div class="sect3" title="Support for C++98 dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id532517"></a>
Support for C++98 dialect.
</h4></div></div></div><p>Check for complete library coverage of the C++1998/2003 standard.
</p><pre class="programlisting">
@@ -610,7 +610,7 @@ AC_DEFUN([AC_HEADER_STDCXX_98], [
AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
fi
])
-</pre></div><div class="sect3" title="Support for C++TR1 dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id536749"></a>
+</pre></div><div class="sect3" title="Support for C++TR1 dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id532545"></a>
Support for C++TR1 dialect.
</h4></div></div></div><p>Check for library coverage of the TR1 standard.
</p><pre class="programlisting">
@@ -687,7 +687,7 @@ AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
fi
])
-</pre></div><div class="sect3" title="Support for C++0x dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id536793"></a>
+</pre></div><div class="sect3" title="Support for C++0x dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id532588"></a>
Support for C++0x dialect.
</h4></div></div></div><p>Check for baseline language coverage in the compiler for the C++0xstandard.
</p><pre class="programlisting">
@@ -899,25 +899,25 @@ AC_DEFUN([AC_HEADER_UNORDERED_SET], [
AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
fi
])
-</pre></div><div class="sect3" title="Container::iterator_type is not necessarily Container::value_type*"><div class="titlepage"><div><div><h4 class="title"><a id="id536870"></a>
+</pre></div><div class="sect3" title="Container::iterator_type is not necessarily Container::value_type*"><div class="titlepage"><div><div><h4 class="title"><a id="id532666"></a>
Container::iterator_type is not necessarily Container::value_type*
</h4></div></div></div><p>
This is a change in behavior from the previous version. Now, most
<span class="type">iterator_type</span> typedefs in container classes are POD
objects, not <span class="type">value_type</span> pointers.
-</p></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id536900"></a><p><span class="biblioid">
+</p></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id532695"></a><p><span class="biblioid">
<a class="ulink" href="http://www.kegel.com/gcc/gcc4.html" target="_top">
<em class="citetitle">
Migrating to GCC 4.1
</em>
</a>
- . </span><span class="author"><span class="firstname">Dan</span> <span class="surname">Kegel</span>. </span></p></div><div class="biblioentry"><a id="id536931"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Dan</span> <span class="surname">Kegel</span>. </span></p></div><div class="biblioentry"><a id="id532726"></a><p><span class="biblioid">
<a class="ulink" href="http://lists.debian.org/debian-gcc/2006/03/msg00405.html" target="_top">
<em class="citetitle">
Building the Whole Debian Archive with GCC 4.1: A Summary
</em>
</a>
- . </span><span class="author"><span class="firstname">Martin</span> <span class="surname">Michlmayr</span>. </span></p></div><div class="biblioentry"><a id="id536962"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Martin</span> <span class="surname">Michlmayr</span>. </span></p></div><div class="biblioentry"><a id="id536896"></a><p><span class="biblioid">
<a class="ulink" href="http://annwm.lbl.gov/~leggett/Atlas/gcc-3.2.html" target="_top">
<em class="citetitle">
Migration guide for GCC-3.2
diff --git a/libstdc++-v3/doc/html/manual/bitmap_allocator.html b/libstdc++-v3/doc/html/manual/bitmap_allocator.html
index ae4a27930d8..aa81c34f038 100644
--- a/libstdc++-v3/doc/html/manual/bitmap_allocator.html
+++ b/libstdc++-v3/doc/html/manual/bitmap_allocator.html
@@ -103,7 +103,7 @@ else return false.</p></li></ol></div><p>
</p><p>
Consider a block of size 64 ints. In memory, it would look like this:
(assume a 32-bit system where, size_t is a 32-bit entity).
- </p><div class="table"><a id="id572573"></a><p class="title"><b>Table 20.1. Bitmap Allocator Memory Map</b></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -&gt; Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p>
+ </p><div class="table"><a id="id661907"></a><p class="title"><b>Table 20.1. Bitmap Allocator Memory Map</b></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -&gt; Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p>
The first Column(268) represents the size of the Block in bytes as
seen by the Bitmap Allocator. Internally, a global free list is
used to keep track of the free blocks used and given back by the
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html
index 5ea9732886e..c7a65a08a7a 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html
@@ -19,6 +19,6 @@
mode or with debug mode. The
following table provides the names and headers of the debugging
containers:
-</p><div class="table"><a id="id641002"></a><p class="title"><b>Table 17.1. Debugging Containers</b></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename">&lt;debug/bitset&gt;</code></td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename">&lt;debug/deque&gt;</code></td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename">&lt;debug/list&gt;</code></td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename">&lt;debug/map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename">&lt;debug/map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename">&lt;debug/set&gt;</code></td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename">&lt;debug/set&gt;</code></td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename">&lt;debug/string&gt;</code></td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename">&lt;debug/string&gt;</code></td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename">&lt;debug/string&gt;</code></td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename">&lt;debug/vector&gt;</code></td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++0x mode, these additional
+</p><div class="table"><a id="id533025"></a><p class="title"><b>Table 17.1. Debugging Containers</b></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename">&lt;debug/bitset&gt;</code></td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename">&lt;debug/deque&gt;</code></td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename">&lt;debug/list&gt;</code></td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename">&lt;debug/map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename">&lt;debug/map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename">&lt;debug/set&gt;</code></td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename">&lt;debug/set&gt;</code></td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename">&lt;debug/string&gt;</code></td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename">&lt;debug/string&gt;</code></td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename">&lt;debug/string&gt;</code></td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename">&lt;debug/vector&gt;</code></td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++0x mode, these additional
containers have additional debug capability.
-</p><div class="table"><a id="id573570"></a><p class="title"><b>Table 17.2. Debugging Containers C++0x</b></p><div class="table-contents"><table summary="Debugging Containers C++0x" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename">&lt;debug/unordered_map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename">&lt;debug/unordered_map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename">&lt;debug/unordered_set&gt;</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename">&lt;debug/unordered_set&gt;</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt03ch17s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt03ch17s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
+</p><div class="table"><a id="id661132"></a><p class="title"><b>Table 17.2. Debugging Containers C++0x</b></p><div class="table-contents"><table summary="Debugging Containers C++0x" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename">&lt;debug/unordered_map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename">&lt;debug/unordered_map&gt;</code></td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename">&lt;debug/unordered_set&gt;</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename">&lt;debug/unordered_set&gt;</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt03ch17s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt03ch17s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html
index 76645a52876..848eb0f4cca 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html
@@ -63,4 +63,4 @@ Then compile this code with the prerequisite compiler flags
flags for atomic operations.)
</p><p> The following table provides the names and headers of all the
parallel algorithms that can be used in a similar manner:
-</p><div class="table"><a id="id570004"></a><p class="title"><b>Table 18.1. Parallel Algorithms</b></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt03ch18s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt03ch18s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
+</p><div class="table"><a id="id660606"></a><p class="title"><b>Table 18.1. Parallel Algorithms</b></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt03ch18s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt03ch18s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html
index 1dc6efe132b..1bf9fcf5f42 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><meta name="keywords" content="&#10; C++&#10; , &#10; library&#10; , &#10; profile&#10; " /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="next" href="bk01pt03ch19s03.html" title="Extensions for Custom Containers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt03ch19s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Design"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.design"></a>Design</h2></div></div></div><p>
-</p><div class="table"><a id="id584531"></a><p class="title"><b>Table 19.1. Profile Code Location</b></p><div class="table-contents"><table summary="Profile Code Location" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Code Location</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left"><code class="code">libstdc++-v3/include/std/*</code></td><td align="left">Preprocessor code to redirect to profile extension headers.</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/*</code></td><td align="left">Profile extension public headers (map, vector, ...).</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/impl/*</code></td><td align="left">Profile extension internals. Implementation files are
+</p><div class="table"><a id="id556845"></a><p class="title"><b>Table 19.1. Profile Code Location</b></p><div class="table-contents"><table summary="Profile Code Location" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Code Location</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left"><code class="code">libstdc++-v3/include/std/*</code></td><td align="left">Preprocessor code to redirect to profile extension headers.</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/*</code></td><td align="left">Profile extension public headers (map, vector, ...).</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/impl/*</code></td><td align="left">Profile extension internals. Implementation files are
only included from <code class="code">impl/profiler.h</code>, which is the only
file included from the public headers.</td></tr></tbody></table></div></div><br class="table-break" /><p>
</p><div class="sect2" title="Wrapper Model"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.design.wrapper"></a>Wrapper Model</h3></div></div></div><p>
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html
index ec719afd244..7a81a561503 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html
@@ -18,7 +18,7 @@
A high accuracy means that the diagnostic is unlikely to be wrong.
These grades are not perfect. They are just meant to guide users with
specific needs or time budgets.
- </p><div class="table"><a id="id638005"></a><p class="title"><b>Table 19.2. Profile Diagnostics</b></p><div class="table-contents"><table summary="Profile Diagnostics" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Group</th><th align="left">Flag</th><th align="left">Benefit</th><th align="left">Cost</th><th align="left">Freq.</th><th align="left">Implemented</th><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><a class="ulink" href="#manual.ext.profile_mode.analysis.containers" target="_top">
+ </p><div class="table"><a id="id501260"></a><p class="title"><b>Table 19.2. Profile Diagnostics</b></p><div class="table-contents"><table summary="Profile Diagnostics" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Group</th><th align="left">Flag</th><th align="left">Benefit</th><th align="left">Cost</th><th align="left">Freq.</th><th align="left">Implemented</th><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><a class="ulink" href="#manual.ext.profile_mode.analysis.containers" target="_top">
CONTAINERS</a></td><td align="left"><a class="ulink" href="#manual.ext.profile_mode.analysis.hashtable_too_small" target="_top">
HASHTABLE_TOO_SMALL</a></td><td align="left">10</td><td align="left">1</td><td align="left"> </td><td align="left">10</td><td align="left">yes</td></tr><tr><td align="left"> </td><td align="left"><a class="ulink" href="#manual.ext.profile_mode.analysis.hashtable_too_large" target="_top">
HASHTABLE_TOO_LARGE</a></td><td align="left">5</td><td align="left">1</td><td align="left"> </td><td align="left">10</td><td align="left">yes</td></tr><tr><td align="left"> </td><td align="left"><a class="ulink" href="#manual.ext.profile_mode.analysis.inefficient_hash" target="_top">
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03pr01.html b/libstdc++-v3/doc/html/manual/bk01pt03pr01.html
index 720b22dafc6..80acbcf8755 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt03pr01.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt03pr01.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part III.  Extensions" /><link rel="prev" href="extensions.html" title="Part III.  Extensions" /><link rel="next" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><th width="60%" align="center">Part III. 
Extensions
-</th><td width="20%" align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr></table><hr /></div><div class="preface"><div class="titlepage"><div><div><h2 class="title"><a id="id555265"></a></h2></div></div></div><p>
+</th><td width="20%" align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr></table><hr /></div><div class="preface"><div class="titlepage"><div><div><h2 class="title"><a id="id644091"></a></h2></div></div></div><p>
Here we will make an attempt at describing the non-Standard extensions to
the library. Some of these are from SGI's STL, some of these are GNU's,
and some just seemed to appear on the doorstep.
diff --git a/libstdc++-v3/doc/html/manual/concurrency.html b/libstdc++-v3/doc/html/manual/concurrency.html
index 0265da4c443..e65c5b3574f 100644
--- a/libstdc++-v3/doc/html/manual/concurrency.html
+++ b/libstdc++-v3/doc/html/manual/concurrency.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="extensions.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 15.  Concurrency"><div class="titlepage"><div><div><h2 class="title"><a id="std.concurrency"></a>Chapter 15. 
Concurrency
- <a id="id658402" class="indexterm"></a>
+ <a id="id622379" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="concurrency.html#std.concurrency.api">API Reference</a></span></dt></dl></div><p>
Facilities for concurrent operation, and control thereof.
</p><div class="sect1" title="API Reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.concurrency.api"></a>API Reference</h2></div></div></div><p>
diff --git a/libstdc++-v3/doc/html/manual/configure.html b/libstdc++-v3/doc/html/manual/configure.html
index 47f58f47f89..2b8c49a09b4 100644
--- a/libstdc++-v3/doc/html/manual/configure.html
+++ b/libstdc++-v3/doc/html/manual/configure.html
@@ -59,8 +59,7 @@
</p><p>If not explicitly specified, the configure proccess tries
to guess the most suitable package from the choices above. The
default is 'generic'. On glibc-based systems of sufficient
- vintage (2.2.5 and newer) and capability (with installed DE and
- FR locale data), 'gnu' is automatically selected. This option
+ vintage (2.3 and newer), 'gnu' is automatically selected. This option
can change the library ABI.
</p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-allocator</code></span></dt><dd><p>This is an abbreviated form of
<code class="code">'--enable-libstdcxx-allocator=auto'</code> (described
diff --git a/libstdc++-v3/doc/html/manual/containers.html b/libstdc++-v3/doc/html/manual/containers.html
index c427178f494..185fa96bb60 100644
--- a/libstdc++-v3/doc/html/manual/containers.html
+++ b/libstdc++-v3/doc/html/manual/containers.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="associative.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 9.  Containers"><div class="titlepage"><div><div><h2 class="title"><a id="std.containers"></a>Chapter 9. 
Containers
- <a id="id549505" class="indexterm"></a>
+ <a id="id538555" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="containers.html#std.containers.sequences">Sequences</a></span></dt><dd><dl><dt><span class="sect2"><a href="containers.html#containers.sequences.list">list</a></span></dt><dt><span class="sect2"><a href="containers.html#containers.sequences.vector">vector</a></span></dt></dl></dd><dt><span class="sect1"><a href="associative.html">Associative</a></span></dt><dd><dl><dt><span class="sect2"><a href="associative.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="sect2"><a href="associative.html#containers.associative.bitset">bitset</a></span></dt></dl></dd><dt><span class="sect1"><a href="containers_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="sect2"><a href="containers_and_c.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></div><div class="sect1" title="Sequences"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.containers.sequences"></a>Sequences</h2></div></div></div><div class="sect2" title="list"><div class="titlepage"><div><div><h3 class="title"><a id="containers.sequences.list"></a>list</h3></div></div></div><div class="sect3" title="list::size() is O(n)"><div class="titlepage"><div><div><h4 class="title"><a id="sequences.list.size"></a>list::size() is O(n)</h4></div></div></div><p>
Yes it is, and that's okay. This is a decision that we preserved
when we imported SGI's STL implementation. The following is
diff --git a/libstdc++-v3/doc/html/manual/diagnostics.html b/libstdc++-v3/doc/html/manual/diagnostics.html
index 0cdf35293d0..77f99ec3bdd 100644
--- a/libstdc++-v3/doc/html/manual/diagnostics.html
+++ b/libstdc++-v3/doc/html/manual/diagnostics.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt02ch05s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 5.  Diagnostics"><div class="titlepage"><div><div><h2 class="title"><a id="std.diagnostics"></a>Chapter 5. 
Diagnostics
- <a id="id546534" class="indexterm"></a>
+ <a id="id564773" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="diagnostics.html#std.diagnostics.exceptions">Exceptions</a></span></dt><dd><dl><dt><span class="sect2"><a href="diagnostics.html#std.diagnostics.exceptions.api">API Reference</a></span></dt><dt><span class="sect2"><a href="diagnostics.html#std.diagnostics.exceptions.data">Adding Data to <code class="classname">exception</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt02ch05s02.html">Concept Checking</a></span></dt></dl></div><div class="sect1" title="Exceptions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.diagnostics.exceptions"></a>Exceptions</h2></div></div></div><div class="sect2" title="API Reference"><div class="titlepage"><div><div><h3 class="title"><a id="std.diagnostics.exceptions.api"></a>API Reference</h3></div></div></div><p>
All exception objects are defined in one of the standard header
files: <code class="filename">exception</code>,
diff --git a/libstdc++-v3/doc/html/manual/documentation_style.html b/libstdc++-v3/doc/html/manual/documentation_style.html
index 8292e253165..3ff11d186d2 100644
--- a/libstdc++-v3/doc/html/manual/documentation_style.html
+++ b/libstdc++-v3/doc/html/manual/documentation_style.html
@@ -108,7 +108,7 @@
writing Doxygen comments. Single and double quotes, and
separators in filenames are two common trouble spots. When in
doubt, consult the following table.
- </p><div class="table"><a id="id569176"></a><p class="title"><b>Table A.1. HTML to Doxygen Markup Comparison</b></p><div class="table-contents"><table summary="HTML to Doxygen Markup Comparison" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Doxygen</th></tr></thead><tbody><tr><td align="left">\</td><td align="left">\\</td></tr><tr><td align="left">"</td><td align="left">\"</td></tr><tr><td align="left">'</td><td align="left">\'</td></tr><tr><td align="left">&lt;i&gt;</td><td align="left">@a word</td></tr><tr><td align="left">&lt;b&gt;</td><td align="left">@b word</td></tr><tr><td align="left">&lt;code&gt;</td><td align="left">@c word</td></tr><tr><td align="left">&lt;em&gt;</td><td align="left">@a word</td></tr><tr><td align="left">&lt;em&gt;</td><td align="left">&lt;em&gt;two words or more&lt;/em&gt;</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="sect2" title="Docbook"><div class="titlepage"><div><div><h3 class="title"><a id="doc_style.docbook"></a>Docbook</h3></div></div></div><div class="sect3" title="Prerequisites"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.prereq"></a>Prerequisites</h4></div></div></div><p>
+ </p><div class="table"><a id="id640202"></a><p class="title"><b>Table A.1. HTML to Doxygen Markup Comparison</b></p><div class="table-contents"><table summary="HTML to Doxygen Markup Comparison" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Doxygen</th></tr></thead><tbody><tr><td align="left">\</td><td align="left">\\</td></tr><tr><td align="left">"</td><td align="left">\"</td></tr><tr><td align="left">'</td><td align="left">\'</td></tr><tr><td align="left">&lt;i&gt;</td><td align="left">@a word</td></tr><tr><td align="left">&lt;b&gt;</td><td align="left">@b word</td></tr><tr><td align="left">&lt;code&gt;</td><td align="left">@c word</td></tr><tr><td align="left">&lt;em&gt;</td><td align="left">@a word</td></tr><tr><td align="left">&lt;em&gt;</td><td align="left">&lt;em&gt;two words or more&lt;/em&gt;</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="sect2" title="Docbook"><div class="titlepage"><div><div><h3 class="title"><a id="doc_style.docbook"></a>Docbook</h3></div></div></div><div class="sect3" title="Prerequisites"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.prereq"></a>Prerequisites</h4></div></div></div><p>
Editing the DocBook sources requires an XML editor. Many
exist: some notable options
include <span class="command"><strong>emacs</strong></span>, <span class="application">Kate</span>,
@@ -238,11 +238,11 @@ xmllint --noout --valid <code class="filename">xml/index.xml</code>
<a class="ulink" href="http://www.docbook.org/tdg/en/html/part2.html" target="_top">online</a>.
An incomplete reference for HTML to Docbook conversion is
detailed in the table below.
- </p><div class="table"><a id="id662369"></a><p class="title"><b>Table A.2. HTML to Docbook XML Markup Comparison</b></p><div class="table-contents"><table summary="HTML to Docbook XML Markup Comparison" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Docbook</th></tr></thead><tbody><tr><td align="left">&lt;p&gt;</td><td align="left">&lt;para&gt;</td></tr><tr><td align="left">&lt;pre&gt;</td><td align="left">&lt;computeroutput&gt;, &lt;programlisting&gt;,
+ </p><div class="table"><a id="id542838"></a><p class="title"><b>Table A.2. HTML to Docbook XML Markup Comparison</b></p><div class="table-contents"><table summary="HTML to Docbook XML Markup Comparison" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Docbook</th></tr></thead><tbody><tr><td align="left">&lt;p&gt;</td><td align="left">&lt;para&gt;</td></tr><tr><td align="left">&lt;pre&gt;</td><td align="left">&lt;computeroutput&gt;, &lt;programlisting&gt;,
&lt;literallayout&gt;</td></tr><tr><td align="left">&lt;ul&gt;</td><td align="left">&lt;itemizedlist&gt;</td></tr><tr><td align="left">&lt;ol&gt;</td><td align="left">&lt;orderedlist&gt;</td></tr><tr><td align="left">&lt;il&gt;</td><td align="left">&lt;listitem&gt;</td></tr><tr><td align="left">&lt;dl&gt;</td><td align="left">&lt;variablelist&gt;</td></tr><tr><td align="left">&lt;dt&gt;</td><td align="left">&lt;term&gt;</td></tr><tr><td align="left">&lt;dd&gt;</td><td align="left">&lt;listitem&gt;</td></tr><tr><td align="left">&lt;a href=""&gt;</td><td align="left">&lt;ulink url=""&gt;</td></tr><tr><td align="left">&lt;code&gt;</td><td align="left">&lt;literal&gt;, &lt;programlisting&gt;</td></tr><tr><td align="left">&lt;strong&gt;</td><td align="left">&lt;emphasis&gt;</td></tr><tr><td align="left">&lt;em&gt;</td><td align="left">&lt;emphasis&gt;</td></tr><tr><td align="left">"</td><td align="left">&lt;quote&gt;</td></tr></tbody></table></div></div><br class="table-break" /><p>
And examples of detailed markup for which there are no real HTML
equivalents are listed in the table below.
-</p><div class="table"><a id="id640551"></a><p class="title"><b>Table A.3. Docbook XML Element Use</b></p><div class="table-contents"><table summary="Docbook XML Element Use" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Element</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left">&lt;structname&gt;</td><td align="left">&lt;structname&gt;char_traits&lt;/structname&gt;</td></tr><tr><td align="left">&lt;classname&gt;</td><td align="left">&lt;classname&gt;string&lt;/classname&gt;</td></tr><tr><td align="left">&lt;function&gt;</td><td align="left">
+</p><div class="table"><a id="id535867"></a><p class="title"><b>Table A.3. Docbook XML Element Use</b></p><div class="table-contents"><table summary="Docbook XML Element Use" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Element</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left">&lt;structname&gt;</td><td align="left">&lt;structname&gt;char_traits&lt;/structname&gt;</td></tr><tr><td align="left">&lt;classname&gt;</td><td align="left">&lt;classname&gt;string&lt;/classname&gt;</td></tr><tr><td align="left">&lt;function&gt;</td><td align="left">
<p>&lt;function&gt;clear()&lt;/function&gt;</p>
<p>&lt;function&gt;fs.clear()&lt;/function&gt;</p>
</td></tr><tr><td align="left">&lt;type&gt;</td><td align="left">&lt;type&gt;long long&lt;/type&gt;</td></tr><tr><td align="left">&lt;varname&gt;</td><td align="left">&lt;varname&gt;fs&lt;/varname&gt;</td></tr><tr><td align="left">&lt;literal&gt;</td><td align="left">
diff --git a/libstdc++-v3/doc/html/manual/extensions.html b/libstdc++-v3/doc/html/manual/extensions.html
index e1967c062d7..18c4401b0d5 100644
--- a/libstdc++-v3/doc/html/manual/extensions.html
+++ b/libstdc++-v3/doc/html/manual/extensions.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="facets.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt03pr01.html">Next</a></td></tr></table><hr /></div><div class="part" title="Part III.  Extensions"><div class="titlepage"><div><div><h1 class="title"><a id="manual.ext"></a>Part III. 
Extensions
- <a id="id555257" class="indexterm"></a>
+ <a id="id568141" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="bk01pt03pr01.html"></a></span></dt><dt><span class="chapter"><a href="ext_compile_checks.html">16. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">17. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch17s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch17s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch17s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch17s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch17s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch17s04.html#debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch17s04.html#debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch17s04.html#debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="parallel_mode.html">18. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch18s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch18s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch18s03.html#parallel_mode.using.prereq_flags">Prerequisite Compiler Flags</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch18s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch18s03.html#parallel_mode.using.specific">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch18s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch18s04.html#parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch18s04.html#parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch18s04.html#parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch18s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="profile_mode.html">19. Profile Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="profile_mode.html#manual.ext.profile_mode.intro">Intro</a></span></dt><dd><dl><dt><span class="sect2"><a href="profile_mode.html#manual.ext.profile_mode.using">Using the Profile Mode</a></span></dt><dt><span class="sect2"><a href="profile_mode.html#manual.ext.profile_mode.tuning">Tuning the Profile Mode</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch19s02.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch19s02.html#manual.ext.profile_mode.design.wrapper">Wrapper Model</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s02.html#manual.ext.profile_mode.design.instrumentation">Instrumentation</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s02.html#manual.ext.profile_mode.design.rtlib">Run Time Behavior</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s02.html#manual.ext.profile_mode.design.analysis">Analysis and Diagnostics</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s02.html#manual.ext.profile_mode.design.cost-model">Cost Model</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s02.html#manual.ext.profile_mode.design.reports">Reports</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s02.html#manual.ext.profile_mode.design.testing">Testing</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch19s03.html">Extensions for Custom Containers</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch19s04.html">Empirical Cost Model</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch19s05.html">Implementation Issues</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch19s05.html#manual.ext.profile_mode.implementation.stack">Stack Traces</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s05.html#manual.ext.profile_mode.implementation.symbols">Symbolization of Instruction Addresses</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s05.html#manual.ext.profile_mode.implementation.concurrency">Concurrency</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s05.html#manual.ext.profile_mode.implementation.stdlib-in-proflib">Using the Standard Library in the Instrumentation Implementation</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s05.html#manual.ext.profile_mode.implementation.malloc-hooks">Malloc Hooks</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s05.html#manual.ext.profile_mode.implementation.construction-destruction">Construction and Destruction of Global Objects</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch19s06.html">Developer Information</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch19s06.html#manual.ext.profile_mode.developer.bigpic">Big Picture</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s06.html#manual.ext.profile_mode.developer.howto">How To Add A Diagnostic</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch19s07.html">Diagnostics</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch19s07.html#manual.ext.profile_mode.analysis.template">Diagnostic Template</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s07.html#manual.ext.profile_mode.analysis.containers">Containers</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s07.html#manual.ext.profile_mode.analysis.algorithms">Algorithms</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s07.html#manual.ext.profile_mode.analysis.locality">Data Locality</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s07.html#manual.ext.profile_mode.analysis.mthread">Multithreaded Data Access</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch19s07.html#manual.ext.profile_mode.analysis.statistics">Statistics</a></span></dt></dl></dd><dt><span class="bibliography"><a href="profile_mode.html#profile_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="ext_allocators.html">20. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_allocators.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="ext_containers.html">21. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_containers.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch21s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch21s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="ext_utilities.html">22. Utilities</a></span></dt><dt><span class="chapter"><a href="ext_algorithms.html">23. Algorithms</a></span></dt><dt><span class="chapter"><a href="ext_numerics.html">24. Numerics</a></span></dt><dt><span class="chapter"><a href="ext_iterators.html">25. Iterators</a></span></dt><dt><span class="chapter"><a href="ext_io.html">26. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_io.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="ext_demangling.html">27. Demangling</a></span></dt><dt><span class="chapter"><a href="ext_concurrency.html">28. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="ext_concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="ext_concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch28s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt03ch28s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt03ch28s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt03ch28s03.html">Use</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="facets.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt03pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Facets </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/facets.html b/libstdc++-v3/doc/html/manual/facets.html
index c51a54f5478..00758626fac 100644
--- a/libstdc++-v3/doc/html/manual/facets.html
+++ b/libstdc++-v3/doc/html/manual/facets.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Facets</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="localization.html" title="Chapter 8.  Localization" /><link rel="prev" href="localization.html" title="Chapter 8.  Localization" /><link rel="next" href="containers.html" title="Chapter 9.  Containers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Facets</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="localization.html">Prev</a> </td><th width="60%" align="center">Chapter 8. 
Localization
-</th><td width="20%" align="right"> <a accesskey="n" href="containers.html">Next</a></td></tr></table><hr /></div><div class="section" title="Facets"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.localization.facet"></a>Facets</h2></div></div></div><div class="section" title="ctype"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.facet.ctype"></a>ctype</h3></div></div></div><div class="section" title="Implementation"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.impl"></a>Implementation</h4></div></div></div><div class="section" title="Specializations"><div class="titlepage"><div><div><h5 class="title"><a id="id551356"></a>Specializations</h5></div></div></div><p>
+</th><td width="20%" align="right"> <a accesskey="n" href="containers.html">Next</a></td></tr></table><hr /></div><div class="section" title="Facets"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.localization.facet"></a>Facets</h2></div></div></div><div class="section" title="ctype"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.facet.ctype"></a>ctype</h3></div></div></div><div class="section" title="Implementation"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.impl"></a>Implementation</h4></div></div></div><div class="section" title="Specializations"><div class="titlepage"><div><div><h5 class="title"><a id="id628428"></a>Specializations</h5></div></div></div><p>
For the required specialization codecvt&lt;wchar_t, char, mbstate_t&gt; ,
conversions are made between the internal character set (always UCS4
on GNU/Linux) and whatever the currently selected locale for the
@@ -50,26 +50,26 @@ characters.
</p></li><li class="listitem"><p>
Rename abstract base class. See if just smash-overriding is a
better approach. Clarify, add sanity to naming.
- </p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id561523"></a><p><span class="title"><i>
+ </p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id663422"></a><p><span class="title"><i>
The GNU C Library
- </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry" title="Correspondence"><a id="id628801"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry" title="Correspondence"><a id="id557724"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id539764"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id628256"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id539782"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id628275"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id539800"></a><p><span class="biblioid">
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id651486"></a><p><span class="biblioid">
<a class="ulink" href="http://www.unix.org/version3/ieee_std.html" target="_top">
<em class="citetitle">
The Open Group Base Specifications, Issue 6 (IEEE Std. 1003.1-2004)
</em>
</a>
. </span><span class="copyright">Copyright © 1999
- The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id629862"></a><p><span class="title"><i>
+ The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id546468"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id629076"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id648185"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
@@ -412,17 +412,17 @@ codecvt usage.
</p></li><li class="listitem"><p>
wchar_t/char internal buffers and conversions between
internal/external buffers?
- </p></li></ul></div></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id554787"></a><p><span class="title"><i>
+ </p></li></ul></div></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id651424"></a><p><span class="title"><i>
The GNU C Library
</i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">
Chapters 6 Character Set Handling and 7 Locales and Internationalization
- . </span></p></div><div class="biblioentry" title="Correspondence"><a id="id609273"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry" title="Correspondence"><a id="id622952"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id609301"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id616285"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id569551"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id616304"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id569570"></a><p><span class="biblioid">
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id616322"></a><p><span class="biblioid">
<a class="ulink" href="http://www.opengroup.org/austin" target="_top">
<em class="citetitle">
System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008)
@@ -431,29 +431,29 @@ codecvt usage.
. </span><span class="copyright">Copyright © 2008
The Open Group/The Institute of Electrical and Electronics
Engineers, Inc.
- . </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id609215"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id658821"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id559036"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id592168"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername">
Addison Wesley Longman
- . </span></span></p></div><div class="biblioentry"><a id="id528037"></a><p><span class="biblioid">
+ . </span></span></p></div><div class="biblioentry"><a id="id554048"></a><p><span class="biblioid">
<a class="ulink" href="http://www.lysator.liu.se/c/na1.html" target="_top">
<em class="citetitle">
A brief description of Normative Addendum 1
</em>
</a>
- . </span><span class="author"><span class="firstname">Clive</span> <span class="surname">Feather</span>. </span><span class="pagenums">Extended Character Sets. </span></p></div><div class="biblioentry"><a id="id543193"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Clive</span> <span class="surname">Feather</span>. </span><span class="pagenums">Extended Character Sets. </span></p></div><div class="biblioentry"><a id="id569562"></a><p><span class="biblioid">
<a class="ulink" href="http://tldp.org/HOWTO/Unicode-HOWTO.html" target="_top">
<em class="citetitle">
The Unicode HOWTO
</em>
</a>
- . </span><span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span>. </span></p></div><div class="biblioentry"><a id="id543223"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span>. </span></p></div><div class="biblioentry"><a id="id652216"></a><p><span class="biblioid">
<a class="ulink" href="http://www.cl.cam.ac.uk/~mgk25/unicode.html" target="_top">
<em class="citetitle">
UTF-8 and Unicode FAQ for Unix/Linux
@@ -700,16 +700,16 @@ void test01()
model. As of this writing, it is unknown how to query to see
if a specified message catalog exists using the gettext
package.
- </p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.messages.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id558607"></a><p><span class="title"><i>
+ </p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.messages.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id502869"></a><p><span class="title"><i>
The GNU C Library
</i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling, and 7 Locales and Internationalization
- . </span></p></div><div class="biblioentry" title="Correspondence"><a id="id539940"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry" title="Correspondence"><a id="id538908"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id592904"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id533345"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id592922"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id533363"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id592941"></a><p><span class="biblioid">
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id654168"></a><p><span class="biblioid">
<a class="ulink" href="http://www.opengroup.org/austin" target="_top">
<em class="citetitle">
System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008)
@@ -718,17 +718,17 @@ void test01()
. </span><span class="copyright">Copyright © 2008
The Open Group/The Institute of Electrical and Electronics
Engineers, Inc.
- . </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id592852"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id571065"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id656367"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id571106"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername">
Addison Wesley Longman
- . </span></span></p></div><div class="biblioentry"><a id="id621852"></a><p><span class="biblioid">
+ . </span></span></p></div><div class="biblioentry"><a id="id576320"></a><p><span class="biblioid">
<a class="ulink" href="http://java.sun.com/reference/api/index.html" target="_top">
<em class="citetitle">
API Specifications, Java Platform
@@ -736,7 +736,7 @@ void test01()
</a>
. </span><span class="pagenums">java.util.Properties, java.text.MessageFormat,
java.util.Locale, java.util.ResourceBundle
- . </span></p></div><div class="biblioentry"><a id="id552972"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id576344"></a><p><span class="biblioid">
<a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">
<em class="citetitle">
GNU gettext tools, version 0.10.38, Native Language Support
diff --git a/libstdc++-v3/doc/html/manual/intro.html b/libstdc++-v3/doc/html/manual/intro.html
index 654eb414548..eaf97bc2255 100644
--- a/libstdc++-v3/doc/html/manual/intro.html
+++ b/libstdc++-v3/doc/html/manual/intro.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="spine.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr></table><hr /></div><div class="part" title="Part I.  Introduction"><div class="titlepage"><div><div><h1 class="title"><a id="manual.intro"></a>Part I. 
Introduction
- <a id="id614606" class="indexterm"></a>
+ <a id="id611766" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="sect1"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="sect2"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dt><span class="sect2"><a href="status.html#status.iso.200x">C++ 200x</a></span></dt><dt><span class="sect2"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dt><span class="sect2"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="sect1"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="sect2"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="sect2"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="sect1"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="sect2"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="sect2"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="sect1"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="sect1"><a href="configure.html">Configure</a></span></dt><dt><span class="sect1"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="sect1"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="sect1"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="using_macros.html">Macros</a></span></dt><dt><span class="sect1"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="sect2"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="sect2"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="sect1"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="sect2"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt></dl></dd><dt><span class="sect1"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="sect2"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="sect2"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="sect2"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt></dl></dd><dt><span class="sect1"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="sect2"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="sect2"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="sect2"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="spine.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Status</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/io.html b/libstdc++-v3/doc/html/manual/io.html
index ab1d88338a4..9825e4cf206 100644
--- a/libstdc++-v3/doc/html/manual/io.html
+++ b/libstdc++-v3/doc/html/manual/io.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="streambufs.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 13.  Input and Output"><div class="titlepage"><div><div><h2 class="title"><a id="std.io"></a>Chapter 13. 
Input and Output
- <a id="id552516" class="indexterm"></a>
+ <a id="id647716" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="io.html#std.io.objects">Iostream Objects</a></span></dt><dt><span class="sect1"><a href="streambufs.html">Stream Buffers</a></span></dt><dd><dl><dt><span class="sect2"><a href="streambufs.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="sect2"><a href="streambufs.html#io.streambuf.buffering">Buffering</a></span></dt></dl></dd><dt><span class="sect1"><a href="stringstreams.html">Memory Based Streams</a></span></dt><dd><dl><dt><span class="sect2"><a href="stringstreams.html#std.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="sect1"><a href="fstreams.html">File Based Streams</a></span></dt><dd><dl><dt><span class="sect2"><a href="fstreams.html#std.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="sect2"><a href="fstreams.html#std.io.filestreams.binary">Binary Input and Output</a></span></dt></dl></dd><dt><span class="sect1"><a href="io_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="sect2"><a href="io_and_c.html#std.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="sect2"><a href="io_and_c.html#std.io.c.sync">Performance</a></span></dt></dl></dd></dl></div><div class="sect1" title="Iostream Objects"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.io.objects"></a>Iostream Objects</h2></div></div></div><p>To minimize the time you have to wait on the compiler, it's good to
only include the headers you really need. Many people simply include
&lt;iostream&gt; when they don't need to -- and that can <span class="emphasis"><em>penalize
diff --git a/libstdc++-v3/doc/html/manual/iterators.html b/libstdc++-v3/doc/html/manual/iterators.html
index ab4848eb0b5..8e0680bc6f1 100644
--- a/libstdc++-v3/doc/html/manual/iterators.html
+++ b/libstdc++-v3/doc/html/manual/iterators.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="algorithms.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 10.  Iterators"><div class="titlepage"><div><div><h2 class="title"><a id="std.iterators"></a>Chapter 10. 
Iterators
- <a id="id640879" class="indexterm"></a>
+ <a id="id573150" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="iterators.html#std.iterators.predefined">Predefined</a></span></dt><dd><dl><dt><span class="sect2"><a href="iterators.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="sect2"><a href="iterators.html#iterators.predefined.end">One Past the End</a></span></dt></dl></dd></dl></div><div class="sect1" title="Predefined"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.iterators.predefined"></a>Predefined</h2></div></div></div><div class="sect2" title="Iterators vs. Pointers"><div class="titlepage"><div><div><h3 class="title"><a id="iterators.predefined.vs_pointers"></a>Iterators vs. Pointers</h3></div></div></div><p>
The following
FAQ <a class="link" href="../faq.html#faq.iterator_as_pod" title="7.1.">entry</a> points out that
diff --git a/libstdc++-v3/doc/html/manual/license.html b/libstdc++-v3/doc/html/manual/license.html
index 04c971a059b..9029df21735 100644
--- a/libstdc++-v3/doc/html/manual/license.html
+++ b/libstdc++-v3/doc/html/manual/license.html
@@ -92,7 +92,7 @@ requirements of the license of GCC.<br />
the web, excluding the pages generated from source comments, are
copyrighted by the Free Software Foundation, and placed under the
<a class="link" href="appendix_gfdl.html" title="Appendix E. GNU Free Documentation License"> GNU Free Documentation
- License version 1.2</a>. There are no Front-Cover Texts, no
+ License version 1.3</a>. There are no Front-Cover Texts, no
Back-Cover Texts, and no Invariant Sections.
</p><p>
For documentation generated by doxygen or other automated tools
diff --git a/libstdc++-v3/doc/html/manual/localization.html b/libstdc++-v3/doc/html/manual/localization.html
index fdae02ae1c2..e8ee2189cad 100644
--- a/libstdc++-v3/doc/html/manual/localization.html
+++ b/libstdc++-v3/doc/html/manual/localization.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="facets.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 8.  Localization"><div class="titlepage"><div><div><h2 class="title"><a id="std.localization"></a>Chapter 8. 
Localization
- <a id="id550585" class="indexterm"></a>
+ <a id="id601252" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt></dl></dd></dl></div><div class="section" title="Locales"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.localization.locales"></a>Locales</h2></div></div></div><div class="section" title="locale"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.locales.locale"></a>locale</h3></div></div></div><p>
Describes the basic locale object, including nested
classes id, facet, and the reference-counted implementation object,
@@ -403,18 +403,18 @@ global locale" (emphasis Paolo), that is:
What should non-required facet instantiations do? If the
generic implementation is provided, then how to end-users
provide specializations?
- </p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id594448"></a><p><span class="title"><i>
+ </p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="The GNU C Library"><a id="id541662"></a><p><span class="title"><i>
The GNU C Library
</i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">
Chapters 6 Character Set Handling and 7 Locales and
Internationalization
- . </span></p></div><div class="biblioentry" title="Correspondence"><a id="id660743"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry" title="Correspondence"><a id="id567498"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id619270"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id628132"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id619288"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry" title="ISO/IEC 9899:1999 Programming languages - C"><a id="id602622"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id657601"></a><p><span class="biblioid">
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id602640"></a><p><span class="biblioid">
<a class="ulink" href="http://www.opengroup.org/austin" target="_top">
<em class="citetitle">
System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008)
@@ -423,11 +423,11 @@ global locale" (emphasis Paolo), that is:
. </span><span class="copyright">Copyright © 2008
The Open Group/The Institute of Electrical and Electronics
Engineers, Inc.
- . </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id553265"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry" title="The C++ Programming Language, Special Edition"><a id="id551395"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id584975"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry" title="Standard C++ IOStreams and Locales"><a id="id560241"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
diff --git a/libstdc++-v3/doc/html/manual/memory.html b/libstdc++-v3/doc/html/manual/memory.html
index bbc0e941272..90899d16a29 100644
--- a/libstdc++-v3/doc/html/manual/memory.html
+++ b/libstdc++-v3/doc/html/manual/memory.html
@@ -93,7 +93,7 @@
or loading and unloading shared objects in memory. As such, using
caching allocators on systems that do not support
<code class="function">abi::__cxa_atexit</code> is not recommended.
- </p></div><div class="section" title="Implementation"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.impl"></a>Implementation</h4></div></div></div><div class="section" title="Interface Design"><div class="titlepage"><div><div><h5 class="title"><a id="id596578"></a>Interface Design</h5></div></div></div><p>
+ </p></div><div class="section" title="Implementation"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.impl"></a>Implementation</h4></div></div></div><div class="section" title="Interface Design"><div class="titlepage"><div><div><h5 class="title"><a id="id585444"></a>Interface Design</h5></div></div></div><p>
The only allocator interface that
is supported is the standard C++ interface. As such, all STL
containers have been adjusted, and all external allocators have
@@ -106,7 +106,7 @@
</p><p>
The base class that <code class="classname">allocator</code> is derived from
may not be user-configurable.
-</p></div><div class="section" title="Selecting Default Allocation Policy"><div class="titlepage"><div><div><h5 class="title"><a id="id621931"></a>Selecting Default Allocation Policy</h5></div></div></div><p>
+</p></div><div class="section" title="Selecting Default Allocation Policy"><div class="titlepage"><div><div><h5 class="title"><a id="id571671"></a>Selecting Default Allocation Policy</h5></div></div></div><p>
It's difficult to pick an allocation strategy that will provide
maximum utility, without excessively penalizing some behavior. In
fact, it's difficult just deciding which typical actions to measure
@@ -143,7 +143,7 @@
The current default choice for
<code class="classname">allocator</code> is
<code class="classname">__gnu_cxx::new_allocator</code>.
- </p></div><div class="section" title="Disabling Memory Caching"><div class="titlepage"><div><div><h5 class="title"><a id="id623241"></a>Disabling Memory Caching</h5></div></div></div><p>
+ </p></div><div class="section" title="Disabling Memory Caching"><div class="titlepage"><div><div><h5 class="title"><a id="id594539"></a>Disabling Memory Caching</h5></div></div></div><p>
In use, <code class="classname">allocator</code> may allocate and
deallocate using implementation-specified strategies and
heuristics. Because of this, every call to an allocator object's
@@ -308,11 +308,11 @@
A high-performance allocator that uses a bit-map to keep track
of the used and unused memory locations. It has its own
documentation, found <a class="link" href="bitmap_allocator.html" title="bitmap_allocator">here</a>.
- </p></li></ol></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id586118"></a><p><span class="title"><i>
+ </p></li></ol></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry" title="ISO/IEC 14882:1998 Programming languages - C++"><a id="id577136"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
</i>. </span>
isoc++_1998
- <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="id586133"></a><p><span class="biblioid">
+ <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="id577150"></a><p><span class="biblioid">
<a class="ulink" href="http://www.drdobbs.com/cpp/184403759" target="_top">
<em class="citetitle">
The Standard Librarian: What Are Allocators Good For?
@@ -320,19 +320,19 @@
</a>
. </span><span class="author"><span class="firstname">Matt</span> <span class="surname">Austern</span>. </span><span class="publisher"><span class="publishername">
C/C++ Users Journal
- . </span></span></p></div><div class="biblioentry"><a id="id575589"></a><p><span class="biblioid">
+ . </span></span></p></div><div class="biblioentry"><a id="id621845"></a><p><span class="biblioid">
<a class="ulink" href="http://www.cs.umass.edu/~emery/hoard/" target="_top">
<em class="citetitle">
The Hoard Memory Allocator
</em>
</a>
- . </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span></p></div><div class="biblioentry"><a id="id553897"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span></p></div><div class="biblioentry"><a id="id553878"></a><p><span class="biblioid">
<a class="ulink" href="http://www.cs.umass.edu/~emery/pubs/berger-oopsla2002.pdf" target="_top">
<em class="citetitle">
Reconsidering Custom Memory Allocation
</em>
</a>
- . </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="author"><span class="firstname">Ben</span> <span class="surname">Zorn</span>. </span><span class="author"><span class="firstname">Kathryn</span> <span class="surname">McKinley</span>. </span><span class="copyright">Copyright © 2002 OOPSLA. </span></p></div><div class="biblioentry"><a id="id543446"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="author"><span class="firstname">Ben</span> <span class="surname">Zorn</span>. </span><span class="author"><span class="firstname">Kathryn</span> <span class="surname">McKinley</span>. </span><span class="copyright">Copyright © 2002 OOPSLA. </span></p></div><div class="biblioentry"><a id="id576265"></a><p><span class="biblioid">
<a class="ulink" href="http://www.angelikalanger.com/Articles/C++Report/Allocators/Allocators.html" target="_top">
<em class="citetitle">
Allocator Types
@@ -340,9 +340,9 @@
</a>
. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="publisher"><span class="publishername">
C/C++ Users Journal
- . </span></span></p></div><div class="biblioentry" title="The C++ Programming Language"><a id="id602880"></a><p><span class="title"><i>The C++ Programming Language</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 . </span><span class="pagenums">19.4 Allocators. </span><span class="publisher"><span class="publishername">
+ . </span></span></p></div><div class="biblioentry" title="The C++ Programming Language"><a id="id564944"></a><p><span class="title"><i>The C++ Programming Language</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 . </span><span class="pagenums">19.4 Allocators. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry" title="Yalloc: A Recycling C++ Allocator"><a id="id554889"></a><p><span class="title"><i>Yalloc: A Recycling C++ Allocator</i>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Yen</span>. </span></p></div></div></div><div class="section" title="auto_ptr"><div class="titlepage"><div><div><h3 class="title"><a id="std.util.memory.auto_ptr"></a>auto_ptr</h3></div></div></div><div class="section" title="Limitations"><div class="titlepage"><div><div><h4 class="title"><a id="auto_ptr.limitations"></a>Limitations</h4></div></div></div><p>Explaining all of the fun and delicious things that can
+ . </span></span></p></div><div class="biblioentry" title="Yalloc: A Recycling C++ Allocator"><a id="id564390"></a><p><span class="title"><i>Yalloc: A Recycling C++ Allocator</i>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Yen</span>. </span></p></div></div></div><div class="section" title="auto_ptr"><div class="titlepage"><div><div><h3 class="title"><a id="std.util.memory.auto_ptr"></a>auto_ptr</h3></div></div></div><div class="section" title="Limitations"><div class="titlepage"><div><div><h4 class="title"><a id="auto_ptr.limitations"></a>Limitations</h4></div></div></div><p>Explaining all of the fun and delicious things that can
happen with misuse of the <code class="classname">auto_ptr</code> class
template (called <acronym class="acronym">AP</acronym> here) would take some
time. Suffice it to say that the use of <acronym class="acronym">AP</acronym>
@@ -458,7 +458,7 @@ drops to zero.
Derived classes override those functions to destroy resources in a context
where the correct dynamic type is known. This is an application of the
technique known as type erasure.
- </p></div><div class="section" title="Implementation"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.impl"></a>Implementation</h4></div></div></div><div class="section" title="Class Hierarchy"><div class="titlepage"><div><div><h5 class="title"><a id="id545398"></a>Class Hierarchy</h5></div></div></div><p>
+ </p></div><div class="section" title="Implementation"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.impl"></a>Implementation</h4></div></div></div><div class="section" title="Class Hierarchy"><div class="titlepage"><div><div><h5 class="title"><a id="id536213"></a>Class Hierarchy</h5></div></div></div><p>
A <code class="classname">shared_ptr&lt;T&gt;</code> contains a pointer of
type <span class="type">T*</span> and an object of type
<code class="classname">__shared_count</code>. The shared_count contains a
@@ -500,7 +500,7 @@ be forwarded to <span class="type">Tp</span>'s constructor.
Unlike the other <code class="classname">_Sp_counted_*</code> classes, this one is parameterized on the
type of object, not the type of pointer; this is purely a convenience
that simplifies the implementation slightly.
- </p></dd></dl></div></div><div class="section" title="Thread Safety"><div class="titlepage"><div><div><h5 class="title"><a id="id552877"></a>Thread Safety</h5></div></div></div><p>
+ </p></dd></dl></div></div><div class="section" title="Thread Safety"><div class="titlepage"><div><div><h5 class="title"><a id="id622537"></a>Thread Safety</h5></div></div></div><p>
The interface of <code class="classname">tr1::shared_ptr</code> was extended for C++0x
with support for rvalue-references and the other features from
N2351. As with other libstdc++ headers shared by TR1 and C++0x,
@@ -558,7 +558,7 @@ compiler, standard library, platform etc. For the version of
shared_ptr in libstdc++ the compiler and library are fixed, which
makes things much simpler: we have an atomic CAS or we don't, see Lock
Policy below for details.
-</p></div><div class="section" title="Selecting Lock Policy"><div class="titlepage"><div><div><h5 class="title"><a id="id620315"></a>Selecting Lock Policy</h5></div></div></div><p>
+</p></div><div class="section" title="Selecting Lock Policy"><div class="titlepage"><div><div><h5 class="title"><a id="id574548"></a>Selecting Lock Policy</h5></div></div></div><p>
</p><p>
There is a single <code class="classname">_Sp_counted_base</code> class,
which is a template parameterized on the enum
@@ -599,7 +599,7 @@ used when libstdc++ is built without <code class="literal">--enable-threads</cod
<code class="filename">ext/atomicity.h</code>, which detect if the program
is multi-threaded. If only one thread of execution exists in
the program then less expensive non-atomic operations are used.
- </p></div><div class="section" title="Dual C++0x and TR1 Implementation"><div class="titlepage"><div><div><h5 class="title"><a id="id642095"></a>Dual C++0x and TR1 Implementation</h5></div></div></div><p>
+ </p></div><div class="section" title="Dual C++0x and TR1 Implementation"><div class="titlepage"><div><div><h5 class="title"><a id="id552414"></a>Dual C++0x and TR1 Implementation</h5></div></div></div><p>
The classes derived from <code class="classname">_Sp_counted_base</code> (see Class Hierarchy
below) and <code class="classname">__shared_count</code> are implemented separately for C++0x
and TR1, in <code class="filename">bits/boost_sp_shared_count.h</code> and
@@ -610,7 +610,7 @@ The TR1 implementation is considered relatively stable, so is unlikely to
change unless bug fixes require it. If the code that is common to both
C++0x and TR1 modes needs to diverge further then it might be necessary to
duplicate additional classes and only make changes to the C++0x versions.
-</p></div><div class="section" title="Related functions and classes"><div class="titlepage"><div><div><h5 class="title"><a id="id628651"></a>Related functions and classes</h5></div></div></div><div class="variablelist"><dl><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>,
+</p></div><div class="section" title="Related functions and classes"><div class="titlepage"><div><div><h5 class="title"><a id="id530167"></a>Related functions and classes</h5></div></div></div><div class="variablelist"><dl><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>,
<code class="code">const_pointer_cast</code></span></dt><dd><p>
As noted in N2351, these functions can be implemented non-intrusively using
the alias constructor. However the aliasing constructor is only available
@@ -643,10 +643,10 @@ is called. Users should not try to use this.
As well as the extra constructors, this implementation also needs some
members of _Sp_counted_deleter to be protected where they could otherwise
be private.
- </p></dd></dl></div></div></div><div class="section" title="Use"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.using"></a>Use</h4></div></div></div><div class="section" title="Examples"><div class="titlepage"><div><div><h5 class="title"><a id="id595512"></a>Examples</h5></div></div></div><p>
+ </p></dd></dl></div></div></div><div class="section" title="Use"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.using"></a>Use</h4></div></div></div><div class="section" title="Examples"><div class="titlepage"><div><div><h5 class="title"><a id="id558154"></a>Examples</h5></div></div></div><p>
Examples of use can be found in the testsuite, under
<code class="filename">testsuite/tr1/2_general_utilities/shared_ptr</code>.
- </p></div><div class="section" title="Unresolved Issues"><div class="titlepage"><div><div><h5 class="title"><a id="id595527"></a>Unresolved Issues</h5></div></div></div><p>
+ </p></div><div class="section" title="Unresolved Issues"><div class="titlepage"><div><div><h5 class="title"><a id="id558170"></a>Unresolved Issues</h5></div></div></div><p>
The resolution to C++ Standard Library issue <a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#674" target="_top">674</a>,
"shared_ptr interface changes for consistency with N1856" will
need to be implemented after it is accepted into the working
@@ -694,7 +694,7 @@ be private.
code to work with, Peter Dimov in particular for his help and
invaluable advice on thread safety. Phillip Jordan and Paolo
Carlini for the lock policy implementation.
- </p></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="id605443"></a><p><span class="biblioid">
+ </p></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="id569700"></a><p><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2351.htm" target="_top">
<em class="citetitle">
Improving shared_ptr for C++0x, Revision 2
@@ -702,7 +702,7 @@ be private.
</a>
. </span><span class="subtitle">
N2351
- . </span></p></div><div class="biblioentry"><a id="id557167"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id552965"></a><p><span class="biblioid">
<a class="ulink" href="http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2456.html" target="_top">
<em class="citetitle">
C++ Standard Library Active Issues List
@@ -710,7 +710,7 @@ be private.
</a>
. </span><span class="subtitle">
N2456
- . </span></p></div><div class="biblioentry"><a id="id560776"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id552988"></a><p><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf" target="_top">
<em class="citetitle">
Working Draft, Standard for Programming Language C++
@@ -718,7 +718,7 @@ be private.
</a>
. </span><span class="subtitle">
N2461
- . </span></p></div><div class="biblioentry"><a id="id560798"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id554228"></a><p><span class="biblioid">
<a class="ulink" href="http://boost.org/libs/smart_ptr/shared_ptr.htm" target="_top">shared_ptr
<em class="citetitle">
Boost C++ Libraries documentation, shared_ptr
diff --git a/libstdc++-v3/doc/html/manual/numerics.html b/libstdc++-v3/doc/html/manual/numerics.html
index 9b0ca1e65a3..ea8ab1558dd 100644
--- a/libstdc++-v3/doc/html/manual/numerics.html
+++ b/libstdc++-v3/doc/html/manual/numerics.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="generalized_numeric_operations.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 12.  Numerics"><div class="titlepage"><div><div><h2 class="title"><a id="std.numerics"></a>Chapter 12. 
Numerics
- <a id="id568408" class="indexterm"></a>
+ <a id="id528822" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="numerics.html#std.numerics.complex">Complex</a></span></dt><dd><dl><dt><span class="sect2"><a href="numerics.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="sect1"><a href="generalized_numeric_operations.html">Generalized Operations</a></span></dt><dt><span class="sect1"><a href="numerics_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="sect2"><a href="numerics_and_c.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="sect2"><a href="numerics_and_c.html#numerics.c.c99">C99</a></span></dt></dl></dd></dl></div><div class="sect1" title="Complex"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.numerics.complex"></a>Complex</h2></div></div></div><p>
</p><div class="sect2" title="complex Processing"><div class="titlepage"><div><div><h3 class="title"><a id="numerics.complex.processing"></a>complex Processing</h3></div></div></div><p>
</p><p>Using <code class="code">complex&lt;&gt;</code> becomes even more comple- er, sorry,
diff --git a/libstdc++-v3/doc/html/manual/parallel_mode.html b/libstdc++-v3/doc/html/manual/parallel_mode.html
index 0b4decfc067..7e42ddce272 100644
--- a/libstdc++-v3/doc/html/manual/parallel_mode.html
+++ b/libstdc++-v3/doc/html/manual/parallel_mode.html
@@ -13,11 +13,11 @@ explicit source declaration or by compiling existing sources with a
specific compiler flag.
</p><div class="sect1" title="Intro"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.intro"></a>Intro</h2></div></div></div><p>The following library components in the include
<code class="filename">numeric</code> are included in the parallel mode:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="function">std::accumulate</code></p></li><li class="listitem"><p><code class="function">std::adjacent_difference</code></p></li><li class="listitem"><p><code class="function">std::inner_product</code></p></li><li class="listitem"><p><code class="function">std::partial_sum</code></p></li></ul></div><p>The following library components in the include
-<code class="filename">algorithm</code> are included in the parallel mode:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="function">std::adjacent_find</code></p></li><li class="listitem"><p><code class="function">std::count</code></p></li><li class="listitem"><p><code class="function">std::count_if</code></p></li><li class="listitem"><p><code class="function">std::equal</code></p></li><li class="listitem"><p><code class="function">std::find</code></p></li><li class="listitem"><p><code class="function">std::find_if</code></p></li><li class="listitem"><p><code class="function">std::find_first_of</code></p></li><li class="listitem"><p><code class="function">std::for_each</code></p></li><li class="listitem"><p><code class="function">std::generate</code></p></li><li class="listitem"><p><code class="function">std::generate_n</code></p></li><li class="listitem"><p><code class="function">std::lexicographical_compare</code></p></li><li class="listitem"><p><code class="function">std::mismatch</code></p></li><li class="listitem"><p><code class="function">std::search</code></p></li><li class="listitem"><p><code class="function">std::search_n</code></p></li><li class="listitem"><p><code class="function">std::transform</code></p></li><li class="listitem"><p><code class="function">std::replace</code></p></li><li class="listitem"><p><code class="function">std::replace_if</code></p></li><li class="listitem"><p><code class="function">std::max_element</code></p></li><li class="listitem"><p><code class="function">std::merge</code></p></li><li class="listitem"><p><code class="function">std::min_element</code></p></li><li class="listitem"><p><code class="function">std::nth_element</code></p></li><li class="listitem"><p><code class="function">std::partial_sort</code></p></li><li class="listitem"><p><code class="function">std::partition</code></p></li><li class="listitem"><p><code class="function">std::random_shuffle</code></p></li><li class="listitem"><p><code class="function">std::set_union</code></p></li><li class="listitem"><p><code class="function">std::set_intersection</code></p></li><li class="listitem"><p><code class="function">std::set_symmetric_difference</code></p></li><li class="listitem"><p><code class="function">std::set_difference</code></p></li><li class="listitem"><p><code class="function">std::sort</code></p></li><li class="listitem"><p><code class="function">std::stable_sort</code></p></li><li class="listitem"><p><code class="function">std::unique_copy</code></p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry" title="Parallelization of Bulk Operations for STL Dictionaries"><a id="id602261"></a><p><span class="title"><i>
+<code class="filename">algorithm</code> are included in the parallel mode:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="function">std::adjacent_find</code></p></li><li class="listitem"><p><code class="function">std::count</code></p></li><li class="listitem"><p><code class="function">std::count_if</code></p></li><li class="listitem"><p><code class="function">std::equal</code></p></li><li class="listitem"><p><code class="function">std::find</code></p></li><li class="listitem"><p><code class="function">std::find_if</code></p></li><li class="listitem"><p><code class="function">std::find_first_of</code></p></li><li class="listitem"><p><code class="function">std::for_each</code></p></li><li class="listitem"><p><code class="function">std::generate</code></p></li><li class="listitem"><p><code class="function">std::generate_n</code></p></li><li class="listitem"><p><code class="function">std::lexicographical_compare</code></p></li><li class="listitem"><p><code class="function">std::mismatch</code></p></li><li class="listitem"><p><code class="function">std::search</code></p></li><li class="listitem"><p><code class="function">std::search_n</code></p></li><li class="listitem"><p><code class="function">std::transform</code></p></li><li class="listitem"><p><code class="function">std::replace</code></p></li><li class="listitem"><p><code class="function">std::replace_if</code></p></li><li class="listitem"><p><code class="function">std::max_element</code></p></li><li class="listitem"><p><code class="function">std::merge</code></p></li><li class="listitem"><p><code class="function">std::min_element</code></p></li><li class="listitem"><p><code class="function">std::nth_element</code></p></li><li class="listitem"><p><code class="function">std::partial_sort</code></p></li><li class="listitem"><p><code class="function">std::partition</code></p></li><li class="listitem"><p><code class="function">std::random_shuffle</code></p></li><li class="listitem"><p><code class="function">std::set_union</code></p></li><li class="listitem"><p><code class="function">std::set_intersection</code></p></li><li class="listitem"><p><code class="function">std::set_symmetric_difference</code></p></li><li class="listitem"><p><code class="function">std::set_difference</code></p></li><li class="listitem"><p><code class="function">std::sort</code></p></li><li class="listitem"><p><code class="function">std::stable_sort</code></p></li><li class="listitem"><p><code class="function">std::unique_copy</code></p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry" title="Parallelization of Bulk Operations for STL Dictionaries"><a id="id563790"></a><p><span class="title"><i>
Parallelization of Bulk Operations for STL Dictionaries
</i>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Leonor</span> <span class="surname">Frias</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername">
Workshop on Highly Parallel Processing on a Chip (HPPC) 2007. (LNCS)
- . </span></span></p></div><div class="biblioentry" title="The Multi-Core Standard Template Library"><a id="id563911"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry" title="The Multi-Core Standard Template Library"><a id="id536431"></a><p><span class="title"><i>
The Multi-Core Standard Template Library
</i>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Peter</span> <span class="surname">Sanders</span>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Putze</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername">
Euro-Par 2007: Parallel Processing. (LNCS 4641)
diff --git a/libstdc++-v3/doc/html/manual/profile_mode.html b/libstdc++-v3/doc/html/manual/profile_mode.html
index 78e8a52a489..81c732621e0 100644
--- a/libstdc++-v3/doc/html/manual/profile_mode.html
+++ b/libstdc++-v3/doc/html/manual/profile_mode.html
@@ -138,7 +138,7 @@ vector-size: improvement = 3: call stack = 0x804842c ...
call context.
(Environment variable not supported.)
</p></li></ul></div><p>
- </p></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="profile_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry" title="Perflint: A Context Sensitive Performance Advisor for C++ Programs"><a id="id643281"></a><p><span class="title"><i>
+ </p></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="profile_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry" title="Perflint: A Context Sensitive Performance Advisor for C++ Programs"><a id="id653695"></a><p><span class="title"><i>
Perflint: A Context Sensitive Performance Advisor for C++ Programs
</i>. </span><span class="author"><span class="firstname">Lixia</span> <span class="surname">Liu</span>. </span><span class="author"><span class="firstname">Silvius</span> <span class="surname">Rus</span>. </span><span class="copyright">Copyright © 2009 . </span><span class="publisher"><span class="publishername">
Proceedings of the 2009 International Symposium on Code Generation
diff --git a/libstdc++-v3/doc/html/manual/setup.html b/libstdc++-v3/doc/html/manual/setup.html
index 23de8cc5219..749662d555b 100644
--- a/libstdc++-v3/doc/html/manual/setup.html
+++ b/libstdc++-v3/doc/html/manual/setup.html
@@ -48,14 +48,8 @@
</p><div class="variablelist"><dl><dt><span class="term">linux</span></dt><dd><p>
If gcc 3.1.0 or later on is being used on linux, an attempt
will be made to use "C" library functionality necessary for
- C++ named locale support. For gcc 3.2.1 and later, this
- means that glibc 2.2.5 or later is required and the "C"
- library de_DE locale information must be installed.
- </p><p>
- Note however that the sanity checks involving the de_DE
- locale are skipped when an explicit --enable-clocale=gnu
- configure option is used: only the basic checks are carried
- out, defending against misconfigurations.
+ C++ named locale support. For gcc 4.6.0 and later, this
+ means that glibc 2.3 or later is required.
</p><p>
If the 'gnu' locale model is being used, the following
locales are used and tested in the libstdc++ testsuites.
diff --git a/libstdc++-v3/doc/html/manual/source_code_style.html b/libstdc++-v3/doc/html/manual/source_code_style.html
index dc4e49067ff..8a45fe7dfd9 100644
--- a/libstdc++-v3/doc/html/manual/source_code_style.html
+++ b/libstdc++-v3/doc/html/manual/source_code_style.html
@@ -191,58 +191,66 @@
      __embedded_cplusplus<br />
      // long double conversion members mangled as __opr<br />
      // http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00060.html<br />
-      _opr<br />
+      __opr<br />
    </p></div></div><div class="sect2" title="By Example"><div class="titlepage"><div><div><h3 class="title"><a id="coding_style.example"></a>By Example</h3></div></div></div><div class="literallayout"><p><br />
      This library is written to appropriate C++ coding standards. As such,<br />
      it is intended to precede the recommendations of the GNU Coding<br />
      Standard, which can be referenced in full here:<br />
<br />
-      http://www.gnu.org/prep/standards/standards.html#Formatting<br />
+      <a class="ulink" href="http://www.gnu.org/prep/standards/standards.html#Formatting" target="_top">http://www.gnu.org/prep/standards/standards.html#Formatting</a><br />
<br />
      The rest of this is also interesting reading, but skip the "Design<br />
      Advice" part.<br />
<br />
      The GCC coding conventions are here, and are also useful:<br />
-      http://gcc.gnu.org/codingconventions.html<br />
+      <a class="ulink" href="http://gcc.gnu.org/codingconventions.html" target="_top">http://gcc.gnu.org/codingconventions.html</a><br />
<br />
      In addition, because it doesn't seem to be stated explicitly anywhere<br />
      else, there is an 80 column source limit.<br />
<br />
-      ChangeLog entries for member functions should use the<br />
+      <code class="filename">ChangeLog</code> entries for member functions should use the<br />
      classname::member function name syntax as follows:<br />
<br />
-      1999-04-15  Dennis Ritchie  &lt;dr@att.com&gt;<br />
+<code class="code"><br />
+1999-04-15  Dennis Ritchie  &lt;dr@att.com&gt;<br />
<br />
      * src/basic_file.cc (__basic_file::open): Fix thinko in<br />
      _G_HAVE_IO_FILE_OPEN bits.<br />
+</code><br />
<br />
      Notable areas of divergence from what may be previous local practice<br />
      (particularly for GNU C) include:<br />
<br />
      01. Pointers and references<br />
-      char* p = "flop";<br />
-      char&amp; c = *p;<br />
-      -NOT-<br />
-      char *p = "flop";  // wrong<br />
-      char &amp;c = *p;      // wrong<br />
+      <code class="code"><br />
+        char* p = "flop";<br />
+        char&amp; c = *p;<br />
+          -NOT-<br />
+        char *p = "flop";  // wrong<br />
+        char &amp;c = *p;      // wrong<br />
+      </code><br />
<br />
      Reason: In C++, definitions are mixed with executable code. Here,<br />
-      p is being initialized, not *p. This is near-universal<br />
+      <code class="code">p</code> is being initialized, not <code class="code">*p</code>.  This is near-universal<br />
      practice among C++ programmers; it is normal for C hackers<br />
      to switch spontaneously as they gain experience.<br />
<br />
      02. Operator names and parentheses<br />
-      operator==(type)<br />
-      -NOT-<br />
-      operator == (type)  // wrong<br />
+      <code class="code"><br />
+        operator==(type)<br />
+          -NOT-<br />
+        operator == (type)  // wrong<br />
+      </code><br />
<br />
-      Reason: The == is part of the function name. Separating<br />
+      Reason: The <code class="code">==</code> is part of the function name. Separating<br />
      it makes the declaration look like an expression.<br />
<br />
      03. Function names and parentheses<br />
-      void mangle()<br />
-      -NOT-<br />
-      void mangle ()  // wrong<br />
+      <code class="code"><br />
+        void mangle()<br />
+          -NOT-<br />
+        void mangle ()  // wrong<br />
+      </code><br />
<br />
      Reason: no space before parentheses (except after a control-flow<br />
      keyword) is near-universal practice for C++. It identifies the<br />
@@ -250,86 +258,98 @@
      opposed to an expression or other overloaded use of parentheses.<br />
<br />
      04. Template function indentation<br />
-      template&lt;typename T&gt;<br />
-      void<br />
-      template_function(args)<br />
-      { }<br />
-      -NOT-<br />
-      template&lt;class T&gt;<br />
-      void template_function(args) {};<br />
+      <code class="code"><br />
+        template&lt;typename T&gt;<br />
+          void<br />
+          template_function(args)<br />
+          { }<br />
+          -NOT-<br />
+        template&lt;class T&gt;<br />
+        void template_function(args) {};<br />
+      </code><br />
<br />
      Reason: In class definitions, without indentation whitespace is<br />
      needed both above and below the declaration to distinguish<br />
      it visually from other members. (Also, re: "typename"<br />
-      rather than "class".)  T often could be int, which is<br />
+      rather than "class".)  <code class="code">T</code> often could be <code class="code">int</code>, which is<br />
      not a class. ("class", here, is an anachronism.)<br />
<br />
      05. Template class indentation<br />
-      template&lt;typename _CharT, typename _Traits&gt;<br />
-      class basic_ios : public ios_base<br />
-      {<br />
-      public:<br />
-      // Types:<br />
-      };<br />
-      -NOT-<br />
-      template&lt;class _CharT, class _Traits&gt;<br />
-      class basic_ios : public ios_base<br />
-      {<br />
-      public:<br />
-      // Types:<br />
-      };<br />
-      -NOT-<br />
-      template&lt;class _CharT, class _Traits&gt;<br />
-      class basic_ios : public ios_base<br />
-      {<br />
-      public:<br />
-      // Types:<br />
-      };<br />
+      <code class="code"><br />
+        template&lt;typename _CharT, typename _Traits&gt;<br />
+          class basic_ios : public ios_base<br />
+          {<br />
+          public:<br />
+            // Types:<br />
+          };<br />
+          -NOT-<br />
+        template&lt;class _CharT, class _Traits&gt;<br />
+        class basic_ios : public ios_base<br />
+          {<br />
+          public:<br />
+            // Types:<br />
+          };<br />
+          -NOT-<br />
+        template&lt;class _CharT, class _Traits&gt;<br />
+          class basic_ios : public ios_base<br />
+        {<br />
+          public:<br />
+            // Types:<br />
+        };<br />
+      </code><br />
<br />
      06. Enumerators<br />
-      enum<br />
-      {<br />
-      space = _ISspace,<br />
-      print = _ISprint,<br />
-      cntrl = _IScntrl<br />
-      };<br />
-      -NOT-<br />
-      enum { space = _ISspace, print = _ISprint, cntrl = _IScntrl };<br />
+      <code class="code"><br />
+        enum<br />
+        {<br />
+          space = _ISspace,<br />
+          print = _ISprint,<br />
+          cntrl = _IScntrl<br />
+        };<br />
+          -NOT-<br />
+        enum { space = _ISspace, print = _ISprint, cntrl = _IScntrl };<br />
+      </code><br />
<br />
      07. Member initialization lists<br />
      All one line, separate from class name.<br />
<br />
-      gribble::gribble()<br />
-      : _M_private_data(0), _M_more_stuff(0), _M_helper(0);<br />
-      { }<br />
-      -NOT-<br />
-      gribble::gribble() : _M_private_data(0), _M_more_stuff(0), _M_helper(0);<br />
-      { }<br />
+      <code class="code"><br />
+        gribble::gribble()<br />
+        : _M_private_data(0), _M_more_stuff(0), _M_helper(0)<br />
+        { }<br />
+          -NOT-<br />
+        gribble::gribble() : _M_private_data(0), _M_more_stuff(0), _M_helper(0)<br />
+        { }<br />
+      </code><br />
<br />
      08. Try/Catch blocks<br />
-      try<br />
-      {<br />
-      //<br />
-      }<br />
-      catch (...)<br />
-      {<br />
-      //<br />
-      }<br />
-      -NOT-<br />
-      try {<br />
-      //<br />
-      } catch(...) {<br />
-      //<br />
-      }<br />
+      <code class="code"><br />
+        try<br />
+          {<br />
+            //<br />
+          }<br />
+        catch (...)<br />
+          {<br />
+            //<br />
+          }<br />
+          -NOT-<br />
+        try {<br />
+          //<br />
+        } catch(...) {<br />
+          //<br />
+        }<br />
+      </code><br />
<br />
      09. Member functions declarations and definitions<br />
      Keywords such as extern, static, export, explicit, inline, etc<br />
      go on the line above the function name. Thus<br />
<br />
+      <code class="code"><br />
      virtual int<br />
      foo()<br />
      -NOT-<br />
      virtual int foo()<br />
+      </code><br />
<br />
      Reason: GNU coding conventions dictate return types for functions<br />
      are on a separate line than the function name and parameter list<br />
@@ -340,42 +360,49 @@
<br />
<br />
      10. Invocation of member functions with "this-&gt;"<br />
-      For non-uglified names, use this-&gt;name to call the function.<br />
+      For non-uglified names, use <code class="code">this-&gt;name</code> to call the function.<br />
<br />
+      <code class="code"><br />
      this-&gt;sync()<br />
      -NOT-<br />
      sync()<br />
+      </code><br />
<br />
      Reason: Koenig lookup.<br />
<br />
      11. Namespaces<br />
+      <code class="code"><br />
      namespace std<br />
      {<br />
-      blah blah blah;<br />
+        blah blah blah;<br />
      } // namespace std<br />
<br />
      -NOT-<br />
<br />
      namespace std {<br />
-      blah blah blah;<br />
+        blah blah blah;<br />
      } // namespace std<br />
+      </code><br />
<br />
      12. Spacing under protected and private in class declarations:<br />
      space above, none below<br />
      i.e.<br />
<br />
+      <code class="code"><br />
      public:<br />
-      int foo;<br />
+        int foo;<br />
<br />
      -NOT-<br />
      public:<br />
<br />
-      int foo;<br />
+        int foo;<br />
+      </code><br />
<br />
      13. Spacing WRT return statements.<br />
      no extra spacing before returns, no parenthesis<br />
      i.e.<br />
<br />
+      <code class="code"><br />
      }<br />
      return __ret;<br />
<br />
@@ -388,21 +415,22 @@
<br />
      }<br />
      return (__ret);<br />
+      </code><br />
<br />
<br />
      14. Location of global variables.<br />
      All global variables of class type, whether in the "user visible"<br />
-      space (e.g., cin) or the implementation namespace, must be defined<br />
+      space (e.g., <code class="code">cin</code>) or the implementation namespace, must be defined<br />
      as a character array with the appropriate alignment and then later<br />
      re-initialized to the correct value.<br />
<br />
      This is due to startup issues on certain platforms, such as AIX.<br />
-      For more explanation and examples, see src/globals.cc. All such<br />
+      For more explanation and examples, see <code class="filename">src/globals.cc</code>. All such<br />
      variables should be contained in that file, for simplicity.<br />
<br />
      15. Exception abstractions<br />
-      Use the exception abstractions found in functexcept.h, which allow<br />
-      C++ programmers to use this library with -fno-exceptions. (Even if<br />
+      Use the exception abstractions found in <code class="filename">functexcept.h</code>, which allow<br />
+      C++ programmers to use this library with <code class="literal">-fno-exceptions</code>.  (Even if<br />
      that is rarely advisable, it's a necessary evil for backwards<br />
      compatibility.)<br />
<br />
@@ -410,9 +438,11 @@
      All start with the name of the function where the exception is<br />
      thrown, and then (optional) descriptive text is added. Example:<br />
<br />
+      <code class="code"><br />
      __throw_logic_error(__N("basic_string::_S_construct NULL not valid"));<br />
+      </code><br />
<br />
-      Reason: The verbose terminate handler prints out exception::what(),<br />
+      Reason: The verbose terminate handler prints out <code class="code">exception::what()</code>,<br />
      as well as the typeinfo for the thrown exception. As this is the<br />
      default terminate handler, by putting location info into the<br />
      exception string, a very useful error message is printed out for<br />
@@ -432,21 +462,21 @@
      to use names that begin with underscores. This is called "uglification".<br />
      The convention is:<br />
<br />
-      Local and argument names:  __[a-z].*<br />
+      Local and argument names:  <code class="literal">__[a-z].*</code><br />
<br />
-      Examples:  __count  __ix  __s1<br />
+      Examples:  <code class="code">__count  __ix  __s1</code><br />
<br />
-      Type names and template formal-argument names: _[A-Z][^_].*<br />
+      Type names and template formal-argument names: <code class="literal">_[A-Z][^_].*</code><br />
<br />
-      Examples:  _Helper  _CharT  _N<br />
+      Examples:  <code class="code">_Helper  _CharT  _N</code><br />
<br />
-      Member data and function names: _M_.*<br />
+      Member data and function names: <code class="literal">_M_.*</code><br />
<br />
-      Examples:  _M_num_elements  _M_initialize ()<br />
+      Examples:  <code class="code">_M_num_elements  _M_initialize ()</code><br />
<br />
-      Static data members, constants, and enumerations: _S_.*<br />
+      Static data members, constants, and enumerations: <code class="literal">_S_.*</code><br />
<br />
-      Examples: _S_max_elements  _S_default_value<br />
+      Examples: <code class="code">_S_max_elements  _S_default_value</code><br />
<br />
      Don't use names in the same scope that differ only in the prefix,<br />
      e.g. _S_top and _M_top. See BADNAMES for a list of forbidden names.<br />
@@ -458,87 +488,88 @@
      --------------------------<br />
<br />
      [BY EXAMPLE]<br />
+      <code class="code"><br />
<br />
      #ifndef  _HEADER_<br />
      #define  _HEADER_ 1<br />
<br />
      namespace std<br />
      {<br />
-      class gribble<br />
-      {<br />
-      public:<br />
-      gribble() throw();<br />
+        class gribble<br />
+        {<br />
+        public:<br />
+          gribble() throw();<br />
<br />
-      gribble(const gribble&amp;);<br />
+          gribble(const gribble&amp;);<br />
<br />
-      explicit<br />
-      gribble(int __howmany);<br />
+          explicit<br />
+          gribble(int __howmany);<br />
<br />
-      gribble&amp;<br />
-      operator=(const gribble&amp;);<br />
+          gribble&amp;<br />
+          operator=(const gribble&amp;);<br />
<br />
-      virtual<br />
-      ~gribble() throw ();<br />
+          virtual<br />
+          ~gribble() throw ();<br />
<br />
-      // Start with a capital letter, end with a period.<br />
-      inline void<br />
-      public_member(const char* __arg) const;<br />
+          // Start with a capital letter, end with a period.<br />
+          inline void<br />
+          public_member(const char* __arg) const;<br />
<br />
-      // In-class function definitions should be restricted to one-liners.<br />
-      int<br />
-      one_line() { return 0 }<br />
+          // In-class function definitions should be restricted to one-liners.<br />
+          int<br />
+          one_line() { return 0 }<br />
<br />
-      int<br />
-      two_lines(const char* arg)<br />
-      { return strchr(arg, 'a'); }<br />
+          int<br />
+          two_lines(const char* arg)<br />
+          { return strchr(arg, 'a'); }<br />
<br />
-      inline int<br />
-      three_lines();  // inline, but defined below.<br />
+          inline int<br />
+          three_lines();  // inline, but defined below.<br />
<br />
-      // Note indentation.<br />
-      template&lt;typename _Formal_argument&gt;<br />
-      void<br />
-      public_template() const throw();<br />
+          // Note indentation.<br />
+          template&lt;typename _Formal_argument&gt;<br />
+            void<br />
+            public_template() const throw();<br />
<br />
-      template&lt;typename _Iterator&gt;<br />
-      void<br />
-      other_template();<br />
+          template&lt;typename _Iterator&gt;<br />
+            void<br />
+            other_template();<br />
<br />
-      private:<br />
-      class _Helper;<br />
+        private:<br />
+          class _Helper;<br />
<br />
-      int _M_private_data;<br />
-      int _M_more_stuff;<br />
-      _Helper* _M_helper;<br />
-      int _M_private_function();<br />
+          int _M_private_data;<br />
+          int _M_more_stuff;<br />
+          _Helper* _M_helper;<br />
+          int _M_private_function();<br />
<br />
-      enum _Enum<br />
-      {<br />
-      _S_one,<br />
-      _S_two<br />
-      };<br />
+          enum _Enum<br />
+            {<br />
+              _S_one,<br />
+              _S_two<br />
+            };<br />
<br />
-      static void<br />
-      _S_initialize_library();<br />
-      };<br />
+          static void<br />
+          _S_initialize_library();<br />
+        };<br />
<br />
-      // More-or-less-standard language features described by lack, not presence.<br />
+        // More-or-less-standard language features described by lack, not presence.<br />
      # ifndef _G_NO_LONGLONG<br />
-      extern long long _G_global_with_a_good_long_name;  // avoid globals!<br />
+        extern long long _G_global_with_a_good_long_name;  // avoid globals!<br />
      # endif<br />
<br />
-      // Avoid in-class inline definitions, define separately;<br />
-      // likewise for member class definitions:<br />
-      inline int<br />
-      gribble::public_member() const<br />
-      { int __local = 0; return __local; }<br />
+        // Avoid in-class inline definitions, define separately;<br />
+        // likewise for member class definitions:<br />
+        inline int<br />
+        gribble::public_member() const<br />
+        { int __local = 0; return __local; }<br />
<br />
-      class gribble::_Helper<br />
-      {<br />
-      int _M_stuff;<br />
+        class gribble::_Helper<br />
+        {<br />
+          int _M_stuff;<br />
<br />
-      friend class gribble;<br />
-      };<br />
+          friend class gribble;<br />
+        };<br />
      }<br />
<br />
      // Names beginning with "__": only for arguments and<br />
@@ -550,39 +581,40 @@
<br />
      namespace std<br />
      {<br />
-      template&lt;typename T&gt;  // notice: "typename", not "class", no space<br />
-      long_return_value_type&lt;with_many, args&gt;<br />
-      function_name(char* pointer,               // "char *pointer" is wrong.<br />
-      char* argument,<br />
-      const Reference&amp; ref)<br />
-      {<br />
-      // int a_local;  /* wrong; see below. */<br />
-      if (test)<br />
-      {<br />
-      nested code<br />
-      }<br />
-<br />
-      int a_local = 0;  // declare variable at first use.<br />
-<br />
-      //  char a, b, *p;   /* wrong */<br />
-      char a = 'a';<br />
-      char b = a + 1;<br />
-      char* c = "abc";  // each variable goes on its own line, always.<br />
-<br />
-      // except maybe here...<br />
-      for (unsigned i = 0, mask = 1; mask; ++i, mask &lt;&lt;= 1) {<br />
-      // ...<br />
-      }<br />
-      }<br />
-<br />
-      gribble::gribble()<br />
-      : _M_private_data(0), _M_more_stuff(0), _M_helper(0);<br />
-      { }<br />
-<br />
-      inline int<br />
-      gribble::three_lines()<br />
-      {<br />
-      // doesn't fit in one line.<br />
-      }<br />
+        template&lt;typename T&gt;  // notice: "typename", not "class", no space<br />
+          long_return_value_type&lt;with_many, args&gt;<br />
+          function_name(char* pointer,               // "char *pointer" is wrong.<br />
+                        char* argument,<br />
+                        const Reference&amp; ref)<br />
+          {<br />
+            // int a_local;  /* wrong; see below. */<br />
+            if (test)<br />
+            {<br />
+              nested code<br />
+            }<br />
+<br />
+            int a_local = 0;  // declare variable at first use.<br />
+<br />
+            //  char a, b, *p;   /* wrong */<br />
+            char a = 'a';<br />
+            char b = a + 1;<br />
+            char* c = "abc";  // each variable goes on its own line, always.<br />
+<br />
+            // except maybe here...<br />
+            for (unsigned i = 0, mask = 1; mask; ++i, mask &lt;&lt;= 1) {<br />
+              // ...<br />
+            }<br />
+          }<br />
+<br />
+        gribble::gribble()<br />
+        : _M_private_data(0), _M_more_stuff(0), _M_helper(0)<br />
+        { }<br />
+<br />
+        int<br />
+        gribble::three_lines()<br />
+        {<br />
+          // doesn't fit in one line.<br />
+        }<br />
      } // namespace std<br />
+      </code><br />
    </p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="source_organization.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="appendix_contributing.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="documentation_style.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Directory Layout and Source Conventions </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Documentation Style</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/spine.html b/libstdc++-v3/doc/html/manual/spine.html
index 9de2812422f..81745a9563e 100644
--- a/libstdc++-v3/doc/html/manual/spine.html
+++ b/libstdc++-v3/doc/html/manual/spine.html
@@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="prev" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="next" href="intro.html" title="Part I.  Introduction" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr></table><hr /></div><div class="book" title="The GNU C++ Library"><div class="titlepage"><div><div><h1 class="title"><a id="manual-index"></a>The GNU C++ Library</h1></div><div><p class="copyright">Copyright © 2009, 2010
<a class="ulink" href="http://www.fsf.org" target="_top">FSF</a>
- </p></div><div><div class="legalnotice" title="Legal Notice"><a id="id617538"></a><p>
+ </p></div><div><div class="legalnotice" title="Legal Notice"><a id="id603935"></a><p>
<a class="link" href="license.html" title="License">License</a>
</p></div></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="part"><a href="intro.html">I.
Introduction
@@ -61,7 +61,7 @@
</a></span></dt><dt><span class="appendix"><a href="appendix_gpl.html">D.
<acronym class="acronym">GNU</acronym> General Public License version 3
- </a></span></dt><dt><span class="appendix"><a href="appendix_gfdl.html">E. GNU Free Documentation License</a></span></dt></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>1.1. <a href="status.html#id627700">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#id555318">C++ 200x Implementation Status</a></dt><dt>1.3. <a href="status.html#id564268">C++ TR1 Implementation Status</a></dt><dt>1.4. <a href="status.html#id554510">C++ TR 24733 Implementation Status</a></dt><dt>3.1. <a href="using.html#id533607">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#id560709">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#id553960">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#id599672">C++ 200x Library Headers</a></dt><dt>3.5. <a href="using_headers.html#id540099">C++ 200x Library Headers for C Library Facilities</a></dt><dt>3.6. <a href="using_headers.html#id534176">C++ TR 1 Library Headers</a></dt><dt>3.7. <a href="using_headers.html#id550605">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.8. <a href="using_headers.html#id560186">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.9. <a href="using_headers.html#id575732">C++ ABI Headers</a></dt><dt>3.10. <a href="using_headers.html#id553851">Extension Headers</a></dt><dt>3.11. <a href="using_headers.html#id543893">Extension Debug Headers</a></dt><dt>3.12. <a href="using_headers.html#id563676">Extension Profile Headers</a></dt><dt>3.13. <a href="using_headers.html#id538169">Extension Parallel Headers</a></dt><dt>17.1. <a href="bk01pt03ch17s03.html#id641002">Debugging Containers</a></dt><dt>17.2. <a href="bk01pt03ch17s03.html#id573570">Debugging Containers C++0x</a></dt><dt>18.1. <a href="bk01pt03ch18s03.html#id570004">Parallel Algorithms</a></dt><dt>19.1. <a href="bk01pt03ch19s02.html#id584531">Profile Code Location</a></dt><dt>19.2. <a href="bk01pt03ch19s07.html#id638005">Profile Diagnostics</a></dt><dt>20.1. <a href="bitmap_allocator.html#id572573">Bitmap Allocator Memory Map</a></dt><dt>A.1. <a href="documentation_style.html#id569176">HTML to Doxygen Markup Comparison</a></dt><dt>A.2. <a href="documentation_style.html#id662369">HTML to Docbook XML Markup Comparison</a></dt><dt>A.3. <a href="documentation_style.html#id640551">Docbook XML Element Use</a></dt><dt>B.1. <a href="api.html#id654608">Extension Allocators</a></dt><dt>B.2. <a href="api.html#id534867">Extension Allocators Continued</a></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Documentation </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Part I. 
+ </a></span></dt><dt><span class="appendix"><a href="appendix_gfdl.html">E. GNU Free Documentation License</a></span></dt></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>1.1. <a href="status.html#id616155">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#id545724">C++ 200x Implementation Status</a></dt><dt>1.3. <a href="status.html#id563255">C++ TR1 Implementation Status</a></dt><dt>1.4. <a href="status.html#id621410">C++ TR 24733 Implementation Status</a></dt><dt>3.1. <a href="using.html#id536642">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#id616437">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#id530054">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#id575199">C++ 200x Library Headers</a></dt><dt>3.5. <a href="using_headers.html#id549895">C++ 200x Library Headers for C Library Facilities</a></dt><dt>3.6. <a href="using_headers.html#id561380">C++ TR 1 Library Headers</a></dt><dt>3.7. <a href="using_headers.html#id605097">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.8. <a href="using_headers.html#id543860">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.9. <a href="using_headers.html#id599870">C++ ABI Headers</a></dt><dt>3.10. <a href="using_headers.html#id576171">Extension Headers</a></dt><dt>3.11. <a href="using_headers.html#id563137">Extension Debug Headers</a></dt><dt>3.12. <a href="using_headers.html#id553282">Extension Profile Headers</a></dt><dt>3.13. <a href="using_headers.html#id550322">Extension Parallel Headers</a></dt><dt>17.1. <a href="bk01pt03ch17s03.html#id533025">Debugging Containers</a></dt><dt>17.2. <a href="bk01pt03ch17s03.html#id661132">Debugging Containers C++0x</a></dt><dt>18.1. <a href="bk01pt03ch18s03.html#id660606">Parallel Algorithms</a></dt><dt>19.1. <a href="bk01pt03ch19s02.html#id556845">Profile Code Location</a></dt><dt>19.2. <a href="bk01pt03ch19s07.html#id501260">Profile Diagnostics</a></dt><dt>20.1. <a href="bitmap_allocator.html#id661907">Bitmap Allocator Memory Map</a></dt><dt>A.1. <a href="documentation_style.html#id640202">HTML to Doxygen Markup Comparison</a></dt><dt>A.2. <a href="documentation_style.html#id542838">HTML to Docbook XML Markup Comparison</a></dt><dt>A.3. <a href="documentation_style.html#id535867">Docbook XML Element Use</a></dt><dt>B.1. <a href="api.html#id659684">Extension Allocators</a></dt><dt>B.2. <a href="api.html#id651845">Extension Allocators Continued</a></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Documentation </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Part I. 
Introduction
</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html
index 257a1f32593..6603fafb45d 100644
--- a/libstdc++-v3/doc/html/manual/status.html
+++ b/libstdc++-v3/doc/html/manual/status.html
@@ -8,7 +8,7 @@ This status table is based on the table of contents of ISO/IEC 14882:2003.
</p><p>
This page describes the C++ support in mainline GCC SVN, not in any
particular release.
-</p><div class="table"><a id="id627700"></a><p class="title"><b>Table 1.1. C++ 1998/2003 Implementation Status</b></p><div class="table-contents"><table summary="C++ 1998/2003 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
+</p><div class="table"><a id="id616155"></a><p class="title"><b>Table 1.1. C++ 1998/2003 Implementation Status</b></p><div class="table-contents"><table summary="C++ 1998/2003 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
<span class="emphasis"><em>18</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Language support</em></span>
@@ -157,11 +157,11 @@ presence of the required flag.
</p><p>
This page describes the C++0x support in mainline GCC SVN, not in any
particular release.
-</p><div class="table"><a id="id555318"></a><p class="title"><b>Table 1.2. C++ 200x Implementation Status</b></p><div class="table-contents"><table summary="C++ 200x Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
+</p><div class="table"><a id="id545724"></a><p class="title"><b>Table 1.2. C++ 200x Implementation Status</b></p><div class="table-contents"><table summary="C++ 200x Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
<span class="emphasis"><em>18</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Language support</em></span>
- </td></tr><tr><td align="left">18.1</td><td align="left">General</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">18.2</td><td align="left">Types</td><td align="left">Partial</td><td align="left">Missing offsetof, max_align_t, nullptr_t</td></tr><tr><td align="left">18.3</td><td align="left">Implementation properties</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.3.1</td><td align="left">Numeric Limits</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.3.1.1</td><td align="left">Class template <code class="code">numeric_limits</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">18.3.1.2</td><td align="left"><code class="code">numeric_limits</code> members</td><td align="left">Partial</td><td align="left">Missing constexpr</td></tr><tr bgcolor="#C8B0B0"><td align="left">18.3.1.3</td><td align="left"><code class="code">float_round_style</code></td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">18.3.1.4</td><td align="left"><code class="code">float_denorm_style</code></td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">18.3.1.5</td><td align="left"><code class="code">numeric_limits</code> specializations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.3.2</td><td align="left">C Library</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.4</td><td align="left">Integer types</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.4.1</td><td align="left">Header <code class="code">&lt;cstdint&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">18.5</td><td align="left">Start and termination</td><td align="left">Partial</td><td align="left">C library dependency for quick_exit, at_quick_exit</td></tr><tr><td align="left">18.6</td><td align="left">Dynamic memory management</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.7</td><td align="left">Type identification</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.7.1</td><td align="left">Class type_info</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.7.2</td><td align="left">Class bad_cast</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.7.3</td><td align="left">Class bad_typeid</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8</td><td align="left">Exception handling</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.8.1</td><td align="left">Class exception</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.2</td><td align="left">Violating exception-specifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.3</td><td align="left">Abnormal termination</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.4</td><td align="left"><code class="code">uncaught_exception</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.5</td><td align="left">Exception Propagation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.6</td><td align="left"><code class="code">nested_exception</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.9</td><td align="left">Initializer lists</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.9.1</td><td align="left">Initializer list constructors</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.9.2</td><td align="left">Initializer list access</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">18.9.3</td><td align="left">Initializer list range access</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">18.10</td><td align="left">Other runtime support</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">
+ </td></tr><tr><td align="left">18.1</td><td align="left">General</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">18.2</td><td align="left">Types</td><td align="left">Partial</td><td align="left">Missing offsetof, max_align_t</td></tr><tr><td align="left">18.3</td><td align="left">Implementation properties</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.3.1</td><td align="left">Numeric Limits</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.3.1.1</td><td align="left">Class template <code class="code">numeric_limits</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">18.3.1.2</td><td align="left"><code class="code">numeric_limits</code> members</td><td align="left">Partial</td><td align="left">Missing constexpr</td></tr><tr bgcolor="#C8B0B0"><td align="left">18.3.1.3</td><td align="left"><code class="code">float_round_style</code></td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">18.3.1.4</td><td align="left"><code class="code">float_denorm_style</code></td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">18.3.1.5</td><td align="left"><code class="code">numeric_limits</code> specializations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.3.2</td><td align="left">C Library</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.4</td><td align="left">Integer types</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.4.1</td><td align="left">Header <code class="code">&lt;cstdint&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">18.5</td><td align="left">Start and termination</td><td align="left">Partial</td><td align="left">C library dependency for quick_exit, at_quick_exit</td></tr><tr><td align="left">18.6</td><td align="left">Dynamic memory management</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.7</td><td align="left">Type identification</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.7.1</td><td align="left">Class type_info</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.7.2</td><td align="left">Class bad_cast</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.7.3</td><td align="left">Class bad_typeid</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8</td><td align="left">Exception handling</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.8.1</td><td align="left">Class exception</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.2</td><td align="left">Violating exception-specifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.3</td><td align="left">Abnormal termination</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.4</td><td align="left"><code class="code">uncaught_exception</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.5</td><td align="left">Exception Propagation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.8.6</td><td align="left"><code class="code">nested_exception</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.9</td><td align="left">Initializer lists</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">18.9.1</td><td align="left">Initializer list constructors</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">18.9.2</td><td align="left">Initializer list access</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">18.9.3</td><td align="left">Initializer list range access</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">18.10</td><td align="left">Other runtime support</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">
<span class="emphasis"><em>19</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Diagnostics</em></span>
@@ -169,7 +169,7 @@ particular release.
<span class="emphasis"><em>20</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>General utilities</em></span>
- </td></tr><tr><td align="left">20.1</td><td align="left">General</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.2</td><td align="left">Requirements</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3</td><td align="left">Utility components</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1</td><td align="left">Operators</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.2</td><td align="left">Swap</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.3</td><td align="left"><code class="code">forward</code> and <code class="code">move</code> helpers</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.4</td><td align="left">Function template <code class="code">declval</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.5</td><td align="left">Pairs</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.5.1</td><td align="left">In general</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.3.5.2</td><td align="left">Class template <code class="code">pair</code></td><td align="left">Partial</td><td align="left">Missing constexpr</td></tr><tr><td align="left">20.3.5.3</td><td align="left">Tuple-like access to <code class="code">pair</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.3.5.4</td><td align="left"><code class="code">pair</code> range access</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.3.5.5</td><td align="left">Piecewise construction</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.4</td><td align="left">Tuples</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.1</td><td align="left">In general</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.4.2</td><td align="left">Class template <code class="code">tuple</code></td><td align="left">Partial</td><td align="left">Missing constexpr and range access</td></tr><tr><td align="left">20.5</td><td align="left">Class template <code class="code">bitset</code></td><td align="left">Partial</td><td align="left">Missing constexpr</td></tr><tr><td align="left">20.6</td><td align="left">Compile-time rational arithmetic</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.1</td><td align="left">Class template <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.6.2</td><td align="left">Arithmetic on <code class="code">ratio</code> types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.6.3</td><td align="left">Comparison of <code class="code">ratio</code> types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.6.4</td><td align="left">SI types for <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7</td><td align="left">Metaprogramming and type traits</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.7.1</td><td align="left">Requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.2</td><td align="left">Header <code class="code">&lt;type_traits&gt;</code> synopsis</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.7.3</td><td align="left">Helper classes</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.4</td><td align="left">Unary Type Traits</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.4.1</td><td align="left">Primary type categories</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.4.2</td><td align="left">Composite type traits</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.7.4.3</td><td align="left">Type properties</td><td align="left">Partial</td><td align="left">Missing is_system_layout</td></tr><tr><td align="left">20.7.5</td><td align="left">Relationships between types</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.7.6</td><td align="left">Transformations between types</td><td align="left">Partial</td><td align="left">Missing underlying_type</td></tr><tr><td align="left">20.7.6.1</td><td align="left">Const-volatile modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.2</td><td align="left">Reference modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.3</td><td align="left">Sign modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.4</td><td align="left">Array modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.5</td><td align="left">Pointer modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.6</td><td align="left">Other transformations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8</td><td align="left">Function objects</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.8.1</td><td align="left">Definitions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.2</td><td align="left">Requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.3</td><td align="left">Base</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.4</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.5</td><td align="left">Arithmetic operation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.6</td><td align="left">Comparisons</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.7</td><td align="left">Logical operations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.8</td><td align="left">Bitwise operations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.9</td><td align="left">Negators</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.10</td><td align="left">Function template <code class="code">bind</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.11</td><td align="left">Adaptors for pointers to functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.12</td><td align="left">Adaptors for pointers to members</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.13</td><td align="left">Function template <code class="code">mem_fn</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.14</td><td align="left">Polymorphic function wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.8.14.1</td><td align="left">Class <code class="code">bad_function_call</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.14.2</td><td align="left">Class template <code class="code">function</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.15</td><td align="left">Class template <code class="code">hash</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9</td><td align="left">Memory</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.1</td><td align="left">Allocator argument tag</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.2</td><td align="left"><code class="code">uses_allocator</code></td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.3</td><td align="left">Pointer traits</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.4</td><td align="left">Allocator traits</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.9.5</td><td align="left">The default allocator</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6</td><td align="left">Scoped allocator adaptor</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6.1</td><td align="left">Scoped allocator adaptor member types</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6.2</td><td align="left">Scoped allocator adaptor constructors</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6.3</td><td align="left">Scoped allocator adaptor members</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.9.7</td><td align="left">Raw storage iterator</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.8</td><td align="left">Temporary buffers</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.9</td><td align="left">Specialized algorithms</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.9.1</td><td align="left"><code class="code">addressof</code></td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.9.9.2</td><td align="left"><code class="code">uninitialized_copy</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.9.3</td><td align="left"><code class="code">uninitialized_fill</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.9.4</td><td align="left"><code class="code">uninitialized_fill_n</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.10</td><td align="left">Class template <code class="code">unique_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.11</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.9.11.1</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.11.2</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left">Y</td><td align="left">
+ </td></tr><tr><td align="left">20.1</td><td align="left">General</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.2</td><td align="left">Requirements</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3</td><td align="left">Utility components</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.1</td><td align="left">Operators</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.2</td><td align="left">Swap</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.3</td><td align="left"><code class="code">forward</code> and <code class="code">move</code> helpers</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.4</td><td align="left">Function template <code class="code">declval</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.3.5</td><td align="left">Pairs</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.3.5.1</td><td align="left">In general</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.3.5.2</td><td align="left">Class template <code class="code">pair</code></td><td align="left">Partial</td><td align="left">Missing constexpr</td></tr><tr><td align="left">20.3.5.3</td><td align="left">Tuple-like access to <code class="code">pair</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.3.5.4</td><td align="left"><code class="code">pair</code> range access</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.3.5.5</td><td align="left">Piecewise construction</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.4</td><td align="left">Tuples</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.4.1</td><td align="left">In general</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.4.2</td><td align="left">Class template <code class="code">tuple</code></td><td align="left">Partial</td><td align="left">Missing constexpr and range access</td></tr><tr><td align="left">20.5</td><td align="left">Class template <code class="code">bitset</code></td><td align="left">Partial</td><td align="left">Missing constexpr</td></tr><tr><td align="left">20.6</td><td align="left">Compile-time rational arithmetic</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.6.1</td><td align="left">Class template <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.6.2</td><td align="left">Arithmetic on <code class="code">ratio</code> types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.6.3</td><td align="left">Comparison of <code class="code">ratio</code> types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.6.4</td><td align="left">SI types for <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7</td><td align="left">Metaprogramming and type traits</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.7.1</td><td align="left">Requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.2</td><td align="left">Header <code class="code">&lt;type_traits&gt;</code> synopsis</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.7.3</td><td align="left">Helper classes</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.4</td><td align="left">Unary Type Traits</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.4.1</td><td align="left">Primary type categories</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.4.2</td><td align="left">Composite type traits</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.7.4.3</td><td align="left">Type properties</td><td align="left">Partial</td><td align="left">Missing is_trivially_copyable, is_literal_type, is_nothrow_constructible</td></tr><tr><td align="left">20.7.5</td><td align="left">Relationships between types</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.7.6</td><td align="left">Transformations between types</td><td align="left">Partial</td><td align="left">Missing underlying_type</td></tr><tr><td align="left">20.7.6.1</td><td align="left">Const-volatile modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.2</td><td align="left">Reference modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.3</td><td align="left">Sign modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.4</td><td align="left">Array modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.5</td><td align="left">Pointer modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.7.6.6</td><td align="left">Other transformations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8</td><td align="left">Function objects</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.8.1</td><td align="left">Definitions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.2</td><td align="left">Requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.3</td><td align="left">Base</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.4</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.5</td><td align="left">Arithmetic operation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.6</td><td align="left">Comparisons</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.7</td><td align="left">Logical operations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.8</td><td align="left">Bitwise operations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.9</td><td align="left">Negators</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.10</td><td align="left">Function template <code class="code">bind</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.11</td><td align="left">Adaptors for pointers to functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.12</td><td align="left">Adaptors for pointers to members</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.13</td><td align="left">Function template <code class="code">mem_fn</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.14</td><td align="left">Polymorphic function wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.8.14.1</td><td align="left">Class <code class="code">bad_function_call</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.14.2</td><td align="left">Class template <code class="code">function</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.8.15</td><td align="left">Class template <code class="code">hash</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9</td><td align="left">Memory</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.1</td><td align="left">Allocator argument tag</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.2</td><td align="left"><code class="code">uses_allocator</code></td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.3</td><td align="left">Pointer traits</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.4</td><td align="left">Allocator traits</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.9.5</td><td align="left">The default allocator</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6</td><td align="left">Scoped allocator adaptor</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6.1</td><td align="left">Scoped allocator adaptor member types</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6.2</td><td align="left">Scoped allocator adaptor constructors</td><td align="left">N</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.6.3</td><td align="left">Scoped allocator adaptor members</td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.9.7</td><td align="left">Raw storage iterator</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.8</td><td align="left">Temporary buffers</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.9</td><td align="left">Specialized algorithms</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">20.9.9.1</td><td align="left"><code class="code">addressof</code></td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">20.9.9.2</td><td align="left"><code class="code">uninitialized_copy</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.9.3</td><td align="left"><code class="code">uninitialized_fill</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.9.4</td><td align="left"><code class="code">uninitialized_fill_n</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.10</td><td align="left">Class template <code class="code">unique_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.11</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.9.11.1</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.11.2</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left">Y</td><td align="left">
<p>
Uses code from
<a class="ulink" href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top">boost::shared_ptr</a>.
@@ -214,7 +214,7 @@ particular release.
<span class="emphasis"><em>30</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Thread support</em></span>
- </td></tr><tr><td align="left">30.1</td><td align="left">General</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.2</td><td align="left">Requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.3</td><td align="left">Threads</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.3.1</td><td align="left">Class <code class="code">thread</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.3.2</td><td align="left">Namespace <code class="code">this_thread</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4</td><td align="left">Mutual exclusion</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.1</td><td align="left">Mutex requirements</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.1.1</td><td align="left">Class <code class="code">mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.1.2</td><td align="left">Class <code class="code">recursive_mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.2</td><td align="left">Timed mutex requirements</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.2.1</td><td align="left">Class <code class="code">timed_mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.2.2</td><td align="left">Class <code class="code">recursive_timed_mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.3</td><td align="left">Locks</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.3.1</td><td align="left">Class template <code class="code">lock_guard</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.3.2</td><td align="left">Class template <code class="code">unique_lock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.4</td><td align="left">Generic locking algorithms</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.5</td><td align="left">Call once</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.5.1</td><td align="left"><code class="code">once_flag</code></td><td align="left">Y</td><td align="left">Missing constexpr</td></tr><tr><td align="left">30.4.5.2</td><td align="left"><code class="code">call_once</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.5</td><td align="left">Condition variables</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.5.1</td><td align="left">Class <code class="code">condition_variable</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.5.2</td><td align="left">Class <code class="code">condition_variable_any</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.6</td><td align="left">Futures</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.6.1</td><td align="left">Overview</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.6.2</td><td align="left">Error handling</td><td align="left">Y</td><td align="left">Missing constexpr</td></tr><tr><td align="left">30.6.3</td><td align="left">Class <code class="code">future_error</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.6.4</td><td align="left">Associated asynchronous state</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">30.6.5</td><td align="left">Class template <code class="code">promise</code></td><td align="left">Partial</td><td align="left">Missing <code class="code">allocator_arg_t</code></td></tr><tr><td align="left">30.6.6</td><td align="left">Class template <code class="code">future</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.6.7</td><td align="left">Class template <code class="code">shared_future</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">30.6.8</td><td align="left">Class template <code class="code">atomic_future</code></td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">30.6.9</td><td align="left">Function template <code class="code">async</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">30.6.10</td><td align="left">Class template <code class="code">packaged_task</code></td><td align="left">Partial</td><td align="left">Missing <code class="code">allocator_arg_t</code></td></tr><tr><td align="left">
+ </td></tr><tr><td align="left">30.1</td><td align="left">General</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.2</td><td align="left">Requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.3</td><td align="left">Threads</td><td align="left"> </td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">30.3.1</td><td align="left">Class <code class="code">thread</code></td><td align="left">Partial</td><td align="left"><code class="code">thread::id</code> is not trivially copyable</td></tr><tr><td align="left">30.3.2</td><td align="left">Namespace <code class="code">this_thread</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4</td><td align="left">Mutual exclusion</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.1</td><td align="left">Mutex requirements</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.1.1</td><td align="left">Class <code class="code">mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.1.2</td><td align="left">Class <code class="code">recursive_mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.2</td><td align="left">Timed mutex requirements</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.2.1</td><td align="left">Class <code class="code">timed_mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.2.2</td><td align="left">Class <code class="code">recursive_timed_mutex</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.3</td><td align="left">Locks</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.3.1</td><td align="left">Class template <code class="code">lock_guard</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.3.2</td><td align="left">Class template <code class="code">unique_lock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.4</td><td align="left">Generic locking algorithms</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.4.5</td><td align="left">Call once</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.4.5.1</td><td align="left"><code class="code">once_flag</code></td><td align="left">Y</td><td align="left">Missing constexpr</td></tr><tr><td align="left">30.4.5.2</td><td align="left"><code class="code">call_once</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.5</td><td align="left">Condition variables</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.5.1</td><td align="left">Class <code class="code">condition_variable</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.5.2</td><td align="left">Class <code class="code">condition_variable_any</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.6</td><td align="left">Futures</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.6.1</td><td align="left">Overview</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">30.6.2</td><td align="left">Error handling</td><td align="left">Y</td><td align="left">Missing constexpr</td></tr><tr><td align="left">30.6.3</td><td align="left">Class <code class="code">future_error</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.6.4</td><td align="left">Associated asynchronous state</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">30.6.5</td><td align="left">Class template <code class="code">promise</code></td><td align="left">Partial</td><td align="left">Missing <code class="code">allocator_arg_t</code></td></tr><tr><td align="left">30.6.6</td><td align="left">Class template <code class="code">future</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">30.6.7</td><td align="left">Class template <code class="code">shared_future</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#C8B0B0"><td align="left">30.6.8</td><td align="left">Class template <code class="code">atomic_future</code></td><td align="left">N</td><td align="left"> </td></tr><tr><td align="left">30.6.9</td><td align="left">Function template <code class="code">async</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">30.6.10</td><td align="left">Class template <code class="code">packaged_task</code></td><td align="left">Partial</td><td align="left">Missing <code class="code">allocator_arg_t</code></td></tr><tr><td align="left">
<span class="emphasis"><em>Appendix D</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Compatibility features</em></span>
@@ -229,7 +229,7 @@ In this implementation the header names are prefixed by
</p><p>
This page describes the TR1 support in mainline GCC SVN, not in any particular
release.
-</p><div class="table"><a id="id564268"></a><p class="title"><b>Table 1.3. C++ TR1 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="3" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code">&lt;functional&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code">&lt;memory&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left"> </td><td align="left">
+</p><div class="table"><a id="id563255"></a><p class="title"><b>Table 1.3. C++ TR1 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="3" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code">&lt;functional&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code">&lt;memory&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left"> </td><td align="left">
<p>
Uses code from
<a class="ulink" href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top">boost::shared_ptr</a>.
@@ -242,7 +242,7 @@ decimal floating-point arithmetic
</p><p>
This page describes the TR 24733 support in mainline GCC SVN, not in any
particular release.
-</p><div class="table"><a id="id554510"></a><p class="title"><b>Table 1.4. C++ TR 24733 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR 24733 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
+</p><div class="table"><a id="id621410"></a><p class="title"><b>Table 1.4. C++ TR 24733 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR 24733 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
<span class="emphasis"><em>0</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Introduction</em></span>
diff --git a/libstdc++-v3/doc/html/manual/strings.html b/libstdc++-v3/doc/html/manual/strings.html
index 847ee3fb353..3c3e7f6044d 100644
--- a/libstdc++-v3/doc/html/manual/strings.html
+++ b/libstdc++-v3/doc/html/manual/strings.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="localization.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 7.  Strings"><div class="titlepage"><div><div><h2 class="title"><a id="std.strings"></a>Chapter 7. 
Strings
- <a id="id617201" class="indexterm"></a>
+ <a id="id624894" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="strings.html#std.strings.string">String Classes</a></span></dt><dd><dl><dt><span class="sect2"><a href="strings.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect2"><a href="strings.html#strings.string.case">Case Sensitivity</a></span></dt><dt><span class="sect2"><a href="strings.html#strings.string.character_types">Arbitrary Character Types</a></span></dt><dt><span class="sect2"><a href="strings.html#strings.string.token">Tokenizing</a></span></dt><dt><span class="sect2"><a href="strings.html#strings.string.shrink">Shrink to Fit</a></span></dt><dt><span class="sect2"><a href="strings.html#strings.string.Cstring">CString (MFC)</a></span></dt></dl></dd></dl></div><div class="sect1" title="String Classes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.strings.string"></a>String Classes</h2></div></div></div><div class="sect2" title="Simple Transformations"><div class="titlepage"><div><div><h3 class="title"><a id="strings.string.simple"></a>Simple Transformations</h3></div></div></div><p>
Here are Standard, simple, and portable ways to perform common
transformations on a <code class="code">string</code> instance, such as
diff --git a/libstdc++-v3/doc/html/manual/support.html b/libstdc++-v3/doc/html/manual/support.html
index d351fdf8ee5..5a7897bd8c0 100644
--- a/libstdc++-v3/doc/html/manual/support.html
+++ b/libstdc++-v3/doc/html/manual/support.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="dynamic_memory.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 4.  Support"><div class="titlepage"><div><div><h2 class="title"><a id="std.support"></a>Chapter 4. 
Support
- <a id="id551158" class="indexterm"></a>
+ <a id="id593549" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="support.html#std.support.types">Types</a></span></dt><dd><dl><dt><span class="sect2"><a href="support.html#std.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="sect2"><a href="support.html#std.support.types.numeric_limits">Numeric Properties</a></span></dt><dt><span class="sect2"><a href="support.html#std.support.types.null">NULL</a></span></dt></dl></dd><dt><span class="sect1"><a href="dynamic_memory.html">Dynamic Memory</a></span></dt><dt><span class="sect1"><a href="termination.html">Termination</a></span></dt><dd><dl><dt><span class="sect2"><a href="termination.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="sect2"><a href="termination.html#support.termination.verbose">Verbose Terminate Handler</a></span></dt></dl></dd></dl></div><p>
This part deals with the functions called and objects created
automatically during the course of a program's existence.
diff --git a/libstdc++-v3/doc/html/manual/test.html b/libstdc++-v3/doc/html/manual/test.html
index 31665b18de4..920a2f16126 100644
--- a/libstdc++-v3/doc/html/manual/test.html
+++ b/libstdc++-v3/doc/html/manual/test.html
@@ -493,7 +493,7 @@ only default variables.
reporting functions including:
</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>time_counter</p></li><li class="listitem"><p>resource_counter</p></li><li class="listitem"><p>report_performance</p></li></ul></div></li></ul></div></div></div><div class="sect2" title="Special Topics"><div class="titlepage"><div><div><h3 class="title"><a id="test.special"></a>Special Topics</h3></div></div></div><div class="sect3" title="Qualifying Exception Safety Guarantees"><div class="titlepage"><div><div><h4 class="title"><a id="test.exception.safety"></a>
Qualifying Exception Safety Guarantees
- <a id="id643454" class="indexterm"></a>
+ <a id="id638697" class="indexterm"></a>
</h4></div></div></div><div class="sect4" title="Overview"><div class="titlepage"><div><div><h5 class="title"><a id="test.exception.safety.overview"></a>Overview</h5></div></div></div><p>
Testing is composed of running a particular test sequence,
and looking at what happens to the surrounding code when
diff --git a/libstdc++-v3/doc/html/manual/using.html b/libstdc++-v3/doc/html/manual/using.html
index 3739db60910..2d438bcc9ad 100644
--- a/libstdc++-v3/doc/html/manual/using.html
+++ b/libstdc++-v3/doc/html/manual/using.html
@@ -11,5 +11,5 @@
enumerated and detailed in the table below.
</p><p>
By default, <span class="command"><strong>g++</strong></span> is equivalent to <span class="command"><strong>g++ -std=gnu++98</strong></span>. The standard library also defaults to this dialect.
- </p><div class="table"><a id="id533607"></a><p class="title"><b>Table 3.1. C++ Command Options</b></p><div class="table-contents"><table summary="C++ Command Options" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Option Flags</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><code class="literal">-std=c++98</code></td><td align="left">Use the 1998 ISO C++ standard plus amendments.</td></tr><tr><td align="left"><code class="literal">-std=gnu++98</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++0x</code></td><td align="left">Use the working draft of the upcoming ISO C++0x standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++0x</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-fexceptions</code></td><td align="left">See <a class="link" href="using_exceptions.html#intro.using.exception.no" title="Doing without">exception-free dialect</a></td></tr><tr><td align="left"><code class="literal">-frtti</code></td><td align="left">As above, but RTTI-free dialect.</td></tr><tr><td align="left"><code class="literal">-pthread</code> or <code class="literal">-pthreads</code></td><td align="left">For ISO C++0x &lt;thread&gt;, &lt;future&gt;,
+ </p><div class="table"><a id="id536642"></a><p class="title"><b>Table 3.1. C++ Command Options</b></p><div class="table-contents"><table summary="C++ Command Options" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Option Flags</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><code class="literal">-std=c++98</code></td><td align="left">Use the 1998 ISO C++ standard plus amendments.</td></tr><tr><td align="left"><code class="literal">-std=gnu++98</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++0x</code></td><td align="left">Use the working draft of the upcoming ISO C++0x standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++0x</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-fexceptions</code></td><td align="left">See <a class="link" href="using_exceptions.html#intro.using.exception.no" title="Doing without">exception-free dialect</a></td></tr><tr><td align="left"><code class="literal">-frtti</code></td><td align="left">As above, but RTTI-free dialect.</td></tr><tr><td align="left"><code class="literal">-pthread</code> or <code class="literal">-pthreads</code></td><td align="left">For ISO C++0x &lt;thread&gt;, &lt;future&gt;,
&lt;mutex&gt;, or &lt;condition_variable&gt;.</td></tr><tr><td align="left"><code class="literal">-fopenmp</code></td><td align="left">For <a class="link" href="parallel_mode.html" title="Chapter 18. Parallel Mode">parallel</a> mode.</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="make.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="intro.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="using_headers.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Make </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Headers</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/using_exceptions.html b/libstdc++-v3/doc/html/manual/using_exceptions.html
index 9a9db87e243..1a6be8fcdc4 100644
--- a/libstdc++-v3/doc/html/manual/using_exceptions.html
+++ b/libstdc++-v3/doc/html/manual/using_exceptions.html
@@ -266,7 +266,7 @@ is called.
}
catch(...)
{ this-&gt;_M_setstate(ios_base::badbit); }
-</pre></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="using.exceptions.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id577352"></a><p><span class="biblioid">
+</pre></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="using.exceptions.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id557334"></a><p><span class="biblioid">
<a class="ulink" href="http://www.opengroup.org/austin" target="_top">
<em class="citetitle">
System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008)
@@ -277,7 +277,7 @@ is called.
. </span><span class="copyright">Copyright © 2008
The Open Group/The Institute of Electrical and Electronics
Engineers, Inc.
- . </span></p></div><div class="biblioentry"><a id="id596020"></a><p><span class="biblioid">
+ . </span></p></div><div class="biblioentry"><a id="id564741"></a><p><span class="biblioid">
<a class="ulink" href="http://www.boost.org/community/error_handling.html" target="_top">
<em class="citetitle">
Error and Exception Handling
@@ -285,7 +285,7 @@ is called.
</a>
. </span><span class="author"><span class="firstname">David</span> <span class="surname">Abrahams </span>. </span><span class="publisher"><span class="publishername">
Boost
- . </span></span></p></div><div class="biblioentry"><a id="id631410"></a><p><span class="biblioid">
+ . </span></span></p></div><div class="biblioentry"><a id="id549572"></a><p><span class="biblioid">
<a class="ulink" href="http://www.boost.org/community/exception_safety.html" target="_top">
<em class="citetitle">
Exception-Safety in Generic Components
@@ -293,7 +293,7 @@ is called.
</a>
. </span><span class="author"><span class="firstname">David</span> <span class="surname">Abrahams</span>. </span><span class="publisher"><span class="publishername">
Boost
- . </span></span></p></div><div class="biblioentry"><a id="id585635"></a><p><span class="biblioid">
+ . </span></span></p></div><div class="biblioentry"><a id="id534395"></a><p><span class="biblioid">
<a class="ulink" href="www.open-std.org/jtc1/sc22/wg21/docs/papers/1997/N1077.pdf" target="_top">
<em class="citetitle">
Standard Library Exception Policy
@@ -301,7 +301,7 @@ is called.
</a>
. </span><span class="author"><span class="firstname">Matt</span> <span class="surname">Austern</span>. </span><span class="publisher"><span class="publishername">
WG21 N1077
- . </span></span></p></div><div class="biblioentry"><a id="id560315"></a><p><span class="biblioid">
+ . </span></span></p></div><div class="biblioentry"><a id="id621209"></a><p><span class="biblioid">
<a class="ulink" href="http://gcc.gnu.org/ml/gcc-patches/2001-03/msg00661.html" target="_top">
<em class="citetitle">
ia64 c++ abi exception handling
@@ -309,17 +309,17 @@ is called.
</a>
. </span><span class="author"><span class="firstname">Richard</span> <span class="surname">Henderson</span>. </span><span class="publisher"><span class="publishername">
GNU
- . </span></span></p></div><div class="biblioentry"><a id="id576380"></a><p><span class="biblioid">
+ . </span></span></p></div><div class="biblioentry"><a id="id555169"></a><p><span class="biblioid">
<a class="ulink" href="http://www.research.att.com/~bs/3rd_safe.pdf" target="_top">
<em class="citetitle">
Appendix E: Standard-Library Exception Safety
</em>
</a>
- . </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span></p></div><div class="biblioentry" title="Exceptional C++"><a id="id608258"></a><p><span class="title"><i>
+ . </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span></p></div><div class="biblioentry" title="Exceptional C++"><a id="id540372"></a><p><span class="title"><i>
Exceptional C++
</i>. </span><span class="pagenums">
Exception-Safety Issues and Techniques
- . </span><span class="author"><span class="firstname">Herb</span> <span class="surname">Sutter</span>. </span></p></div><div class="biblioentry"><a id="id566207"></a><p><span class="biblioid">
+ . </span><span class="author"><span class="firstname">Herb</span> <span class="surname">Sutter</span>. </span></p></div><div class="biblioentry"><a id="id546269"></a><p><span class="biblioid">
<a class="ulink" href="http://gcc.gnu.org/PR25191" target="_top">
<em class="citetitle">
GCC Bug 25191: exception_defines.h #defines try/catch
diff --git a/libstdc++-v3/doc/html/manual/using_headers.html b/libstdc++-v3/doc/html/manual/using_headers.html
index 3fa370449b4..8aba28b50c2 100644
--- a/libstdc++-v3/doc/html/manual/using_headers.html
+++ b/libstdc++-v3/doc/html/manual/using_headers.html
@@ -20,19 +20,19 @@
upcoming 200x standard.
</p><p>
C++98/03 include files. These are available in the default compilation mode, i.e. <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>.
- </p><div class="table"><a id="id560709"></a><p class="title"><b>Table 3.2. C++ 1998 Library Headers</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id553960"></a><p class="title"><b>Table 3.3. C++ 1998 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
+ </p><div class="table"><a id="id616437"></a><p class="title"><b>Table 3.2. C++ 1998 Library Headers</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id530054"></a><p class="title"><b>Table 3.3. C++ 1998 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
C++0x include files. These are only available in C++0x compilation
mode, i.e. <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code>.
-</p><p></p><div class="table"><a id="id599672"></a><p class="title"><b>Table 3.4. C++ 200x Library Headers</b></p><div class="table-contents"><table summary="C++ 200x Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">complex</code></td></tr><tr><td align="left"><code class="filename">condition_variable</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">fstream</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">future</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td></tr><tr><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td></tr><tr><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">mutex</code></td></tr><tr><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">random</code></td></tr><tr><td align="left"><code class="filename">ratio</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td></tr><tr><td align="left"><code class="filename">tuple</code></td><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">typeinfo</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id540099"></a><p class="title"><b>Table 3.5. C++ 200x Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 200x Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cfenv</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td></tr><tr><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdbool</code></td></tr><tr><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cuchar</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td></tr><tr><td align="left"><code class="filename">stdatomic.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
+</p><p></p><div class="table"><a id="id575199"></a><p class="title"><b>Table 3.4. C++ 200x Library Headers</b></p><div class="table-contents"><table summary="C++ 200x Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">complex</code></td></tr><tr><td align="left"><code class="filename">condition_variable</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">fstream</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">future</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td></tr><tr><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td></tr><tr><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">mutex</code></td></tr><tr><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">random</code></td></tr><tr><td align="left"><code class="filename">ratio</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td></tr><tr><td align="left"><code class="filename">tuple</code></td><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">typeinfo</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id549895"></a><p class="title"><b>Table 3.5. C++ 200x Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 200x Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cfenv</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td></tr><tr><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdbool</code></td></tr><tr><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cuchar</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td></tr><tr><td align="left"><code class="filename">stdatomic.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
In addition, TR1 includes as:
-</p><div class="table"><a id="id534176"></a><p class="title"><b>Table 3.6. C++ TR 1 Library Headers</b></p><div class="table-contents"><table summary="C++ TR 1 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id550605"></a><p class="title"><b>Table 3.7. C++ TR 1 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ TR 1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>Decimal floating-point arithmetic is available if the C++
+</p><div class="table"><a id="id561380"></a><p class="title"><b>Table 3.6. C++ TR 1 Library Headers</b></p><div class="table-contents"><table summary="C++ TR 1 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id605097"></a><p class="title"><b>Table 3.7. C++ TR 1 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ TR 1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>Decimal floating-point arithmetic is available if the C++
compiler supports scalar decimal floating-point types defined via
<code class="code">__attribute__((mode(SD|DD|LD)))</code>.
-</p><div class="table"><a id="id560186"></a><p class="title"><b>Table 3.8. C++ TR 24733 Decimal Floating-Point Header</b></p><div class="table-contents"><table summary="C++ TR 24733 Decimal Floating-Point Header" border="1"><colgroup><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">decimal/decimal</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
+</p><div class="table"><a id="id543860"></a><p class="title"><b>Table 3.8. C++ TR 24733 Decimal Floating-Point Header</b></p><div class="table-contents"><table summary="C++ TR 24733 Decimal Floating-Point Header" border="1"><colgroup><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">decimal/decimal</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
Also included are files for the C++ ABI interface:
-</p><div class="table"><a id="id575732"></a><p class="title"><b>Table 3.9. C++ ABI Headers</b></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
+</p><div class="table"><a id="id599870"></a><p class="title"><b>Table 3.9. C++ ABI Headers</b></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
And a large variety of extensions.
-</p><div class="table"><a id="id553851"></a><p class="title"><b>Table 3.10. Extension Headers</b></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id543893"></a><p class="title"><b>Table 3.11. Extension Debug Headers</b></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td></tr><tr><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td align="left"><code class="filename">debug/vector</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id563676"></a><p class="title"><b>Table 3.12. Extension Profile Headers</b></p><div class="table-contents"><table summary="Extension Profile Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">profile/bitset</code></td><td align="left"><code class="filename">profile/deque</code></td><td align="left"><code class="filename">profile/list</code></td><td align="left"><code class="filename">profile/map</code></td></tr><tr><td align="left"><code class="filename">profile/set</code></td><td align="left"><code class="filename">profile/unordered_map</code></td><td align="left"><code class="filename">profile/unordered_set</code></td><td align="left"><code class="filename">profile/vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id538169"></a><p class="title"><b>Table 3.13. Extension Parallel Headers</b></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" title="Mixing Headers"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules.
+</p><div class="table"><a id="id576171"></a><p class="title"><b>Table 3.10. Extension Headers</b></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id563137"></a><p class="title"><b>Table 3.11. Extension Debug Headers</b></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td></tr><tr><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td align="left"><code class="filename">debug/vector</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id553282"></a><p class="title"><b>Table 3.12. Extension Profile Headers</b></p><div class="table-contents"><table summary="Extension Profile Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">profile/bitset</code></td><td align="left"><code class="filename">profile/deque</code></td><td align="left"><code class="filename">profile/list</code></td><td align="left"><code class="filename">profile/map</code></td></tr><tr><td align="left"><code class="filename">profile/set</code></td><td align="left"><code class="filename">profile/unordered_map</code></td><td align="left"><code class="filename">profile/unordered_set</code></td><td align="left"><code class="filename">profile/vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id550322"></a><p class="title"><b>Table 3.13. Extension Parallel Headers</b></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" title="Mixing Headers"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules.
</p><p>First, mixing different dialects of the standard headers is not
possible. It's an all-or-nothing affair. Thus, code like
</p><pre class="programlisting">
diff --git a/libstdc++-v3/doc/html/manual/utilities.html b/libstdc++-v3/doc/html/manual/utilities.html
index 85bf5ace352..86537fbfd19 100644
--- a/libstdc++-v3/doc/html/manual/utilities.html
+++ b/libstdc++-v3/doc/html/manual/utilities.html
@@ -7,7 +7,7 @@
Standard Contents
</th><td width="20%" align="right"> <a accesskey="n" href="pairs.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 6.  Utilities"><div class="titlepage"><div><div><h2 class="title"><a id="std.util"></a>Chapter 6. 
Utilities
- <a id="id607585" class="indexterm"></a>
+ <a id="id533234" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#std.util.memory.allocator">Allocators</a></span></dt><dt><span class="section"><a href="memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dt><span class="section"><a href="memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt></dl></dd><dt><span class="section"><a href="traits.html">Traits</a></span></dt></dl></div><div class="section" title="Functors"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.util.functors"></a>Functors</h2></div></div></div><p>If you don't know what functors are, you're not alone. Many people
get slightly the wrong idea. In the interest of not reinventing
the wheel, we will refer you to the introduction to the functor
diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml
index 57f08041789..5ed2777337c 100644
--- a/libstdc++-v3/doc/xml/faq.xml
+++ b/libstdc++-v3/doc/xml/faq.xml
@@ -491,7 +491,7 @@
non-standard features of g++ that are not present in older
versions of proprietary compilers. It may take as much as a year or two
after an official release of GCC that contains these features for
- proprietary tools support these constructs.
+ proprietary tools to support these constructs.
</para>
<para>
In the near past, specific released versions of libstdc++ have
diff --git a/libstdc++-v3/doc/xml/gnu/fdl-1.3.xml b/libstdc++-v3/doc/xml/gnu/fdl-1.3.xml
new file mode 100644
index 00000000000..4abbd1d779f
--- /dev/null
+++ b/libstdc++-v3/doc/xml/gnu/fdl-1.3.xml
@@ -0,0 +1,560 @@
+<appendix id="appendix.gfdl-1.3">
+ <?dbhtml filename="appendix_gfdl.html"?>
+ <title>GNU Free Documentation License</title>
+ <simpara>Version 1.3, 3 November 2008</simpara>
+ <simpara>
+ Copyright &#169; 2000, 2001, 2002, 2007, 2008
+ <ulink url="http://www.fsf.org/">Free Software Foundation, Inc.</ulink>
+ </simpara>
+ <simpara>
+ Everyone is permitted to copy and distribute verbatim copies of this
+ license document, but changing it is not allowed.
+ </simpara>
+ <bridgehead id="fdl-1-section0" renderas="sect2">
+ 0. PREAMBLE
+ </bridgehead>
+ <simpara>
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document &#8220;free&#8221; in the sense of freedom:
+ to assure everyone the effective freedom to copy and redistribute it, with
+ or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the author and
+ publisher a way to get credit for their work, while not being considered
+ responsible for modifications made by others.
+ </simpara>
+ <simpara>
+ This License is a kind of &#8220;copyleft&#8221;, which means that
+ derivative works of the document must themselves be free in the same
+ sense. It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+ </simpara>
+ <simpara>
+ We have designed this License in order to use it for manuals for free
+ software, because free software needs free documentation: a free program
+ should come with manuals providing the same freedoms that the software
+ does. But this License is not limited to software manuals; it can be used
+ for any textual work, regardless of subject matter or whether it is
+ published as a printed book. We recommend this License principally for
+ works whose purpose is instruction or reference.
+ </simpara>
+ <bridgehead id="fdl-1-section1" renderas="sect2">
+ 1. APPLICABILITY AND DEFINITIONS
+ </bridgehead>
+ <simpara>
+ This License applies to any manual or other work, in any medium, that
+ contains a notice placed by the copyright holder saying it can be
+ distributed under the terms of this License. Such a notice grants a
+ world-wide, royalty-free license, unlimited in duration, to use that work
+ under the conditions stated herein. The &#8220;Document&#8221;, below,
+ refers to any such manual or work. Any member of the public is a licensee,
+ and is addressed as &#8220;you&#8221;. You accept the license if you copy,
+ modify or distribute the work in a way requiring permission under
+ copyright law.
+ </simpara>
+ <simpara>
+ A &#8220;Modified Version&#8221; of the Document means any work containing
+ the Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+ </simpara>
+ <simpara>
+ A &#8220;Secondary Section&#8221; is a named appendix or a front-matter
+ section of the Document that deals exclusively with the relationship of
+ the publishers or authors of the Document to the Document&#x2019;s overall
+ subject (or to related matters) and contains nothing that could fall
+ directly within that overall subject. (Thus, if the Document is in part a
+ textbook of mathematics, a Secondary Section may not explain any
+ mathematics.) The relationship could be a matter of historical connection
+ with the subject or with related matters, or of legal, commercial,
+ philosophical, ethical or political position regarding them.
+ </simpara>
+ <simpara>
+ The &#8220;Invariant Sections&#8221; are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in the notice
+ that says that the Document is released under this License. If a section
+ does not fit the above definition of Secondary then it is not allowed to
+ be designated as Invariant. The Document may contain zero Invariant
+ Sections. If the Document does not identify any Invariant Sections then
+ there are none.
+ </simpara>
+ <simpara>
+ The &#8220;Cover Texts&#8221; are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says
+ that the Document is released under this License. A Front-Cover Text may
+ be at most 5 words, and a Back-Cover Text may be at most 25 words.
+ </simpara>
+ <simpara>
+ A &#8220;Transparent&#8221; copy of the Document means a machine-readable
+ copy, represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images composed of
+ pixels) generic paint programs or (for drawings) some widely available
+ drawing editor, and that is suitable for input to text formatters or for
+ automatic translation to a variety of formats suitable for input to text
+ formatters. A copy made in an otherwise Transparent file format whose
+ markup, or absence of markup, has been arranged to thwart or discourage
+ subsequent modification by readers is not Transparent. An image format is
+ not Transparent if used for any substantial amount of text. A copy that is
+ not &#8220;Transparent&#8221; is called &#8220;Opaque&#8221;.
+ </simpara>
+ <simpara>
+ Examples of suitable formats for Transparent copies include plain ASCII
+ without markup, Texinfo input format, LaTeX input format, SGML or XML
+ using a publicly available DTD, and standard-conforming simple HTML,
+ PostScript or PDF designed for human modification. Examples of transparent
+ image formats include PNG, XCF and JPG. Opaque formats include proprietary
+ formats that can be read and edited only by proprietary word processors,
+ SGML or XML for which the DTD and/or processing tools are not generally
+ available, and the machine-generated HTML, PostScript or PDF produced by
+ some word processors for output purposes only.
+ </simpara>
+ <simpara>
+ The &#8220;Title Page&#8221; means, for a printed book, the title page
+ itself, plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For works in
+ formats which do not have any title page as such, &#8220;Title Page&#8221;
+ means the text near the most prominent appearance of the work&#x2019;s
+ title, preceding the beginning of the body of the text.
+ </simpara>
+ <simpara>
+ The &#8220;publisher&#8221; means any person or entity that distributes
+ copies of the Document to the public.
+ </simpara>
+ <simpara>
+ A section &#8220;Entitled XYZ&#8221; means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ stands
+ for a specific section name mentioned below, such as
+ &#8220;Acknowledgements&#8221;, &#8220;Dedications&#8221;,
+ &#8220;Endorsements&#8221;, or &#8220;History&#8221;.) To &#8220;Preserve
+ the Title&#8221; of such a section when you modify the Document means that
+ it remains a section &#8220;Entitled XYZ&#8221; according to this
+ definition.
+ </simpara>
+ <simpara>
+ The Document may include Warranty Disclaimers next to the notice which
+ states that this License applies to the Document. These Warranty
+ Disclaimers are considered to be included by reference in this License,
+ but only as regards disclaiming warranties: any other implication that
+ these Warranty Disclaimers may have is void and has no effect on the
+ meaning of this License.
+ </simpara>
+ <bridgehead id="fdl-1-section2" renderas="sect2">
+ 2. VERBATIM COPYING
+ </bridgehead>
+ <simpara>
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the copyright
+ notices, and the license notice saying this License applies to the
+ Document are reproduced in all copies, and that you add no other
+ conditions whatsoever to those of this License. You may not use technical
+ measures to obstruct or control the reading or further copying of the
+ copies you make or distribute. However, you may accept compensation in
+ exchange for copies. If you distribute a large enough number of copies you
+ must also follow the conditions in section 3.
+ </simpara>
+ <simpara>
+ You may also lend copies, under the same conditions stated above, and you
+ may publicly display copies.
+ </simpara>
+ <bridgehead id="fdl-1-section3" renderas="sect2">
+ 3. COPYING IN QUANTITY
+ </bridgehead>
+ <simpara>
+ If you publish printed copies (or copies in media that commonly have
+ printed covers) of the Document, numbering more than 100, and the
+ Document&#x2019;s license notice requires Cover Texts, you must enclose
+ the copies in covers that carry, clearly and legibly, all these Cover
+ Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the
+ back cover. Both covers must also clearly and legibly identify you as the
+ publisher of these copies. The front cover must present the full title
+ with all words of the title equally prominent and visible. You may add
+ other material on the covers in addition. Copying with changes limited to
+ the covers, as long as they preserve the title of the Document and satisfy
+ these conditions, can be treated as verbatim copying in other respects.
+ </simpara>
+ <simpara>
+ If the required texts for either cover are too voluminous to fit legibly,
+ you should put the first ones listed (as many as fit reasonably) on the
+ actual cover, and continue the rest onto adjacent pages.
+ </simpara>
+ <simpara>
+ If you publish or distribute Opaque copies of the Document numbering more
+ than 100, you must either include a machine-readable Transparent copy
+ along with each Opaque copy, or state in or with each Opaque copy a
+ computer-network location from which the general network-using public has
+ access to download using public-standard network protocols a complete
+ Transparent copy of the Document, free of added material. If you use the
+ latter option, you must take reasonably prudent steps, when you begin
+ distribution of Opaque copies in quantity, to ensure that this Transparent
+ copy will remain thus accessible at the stated location until at least one
+ year after the last time you distribute an Opaque copy (directly or
+ through your agents or retailers) of that edition to the public.
+ </simpara>
+ <simpara>
+ It is requested, but not required, that you contact the authors of the
+ Document well before redistributing any large number of copies, to give
+ them a chance to provide you with an updated version of the Document.
+ </simpara>
+ <bridgehead id="fdl-1-section4" renderas="sect2">
+ 4. MODIFICATIONS
+ </bridgehead>
+ <simpara>
+ You may copy and distribute a Modified Version of the Document under the
+ conditions of sections 2 and 3 above, provided that you release the
+ Modified Version under precisely this License, with the Modified Version
+ filling the role of the Document, thus licensing distribution and
+ modification of the Modified Version to whoever possesses a copy of it. In
+ addition, you must do these things in the Modified Version:
+ </simpara>
+ <orderedlist numeration="upperalpha">
+ <listitem>
+ <simpara>
+ Use in the Title Page (and on the covers, if any) a title distinct
+ from that of the Document, and from those of previous versions (which
+ should, if there were any, be listed in the History section of the
+ Document). You may use the same title as a previous version if the
+ original publisher of that version gives permission.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ List on the Title Page, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the Modified
+ Version, together with at least five of the principal authors of the
+ Document (all of its principal authors, if it has fewer than five),
+ unless they release you from this requirement.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ State on the Title page the name of the publisher of the Modified
+ Version, as the publisher.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Preserve all the copyright notices of the Document.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Add an appropriate copyright notice for your modifications adjacent to
+ the other copyright notices.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Include, immediately after the copyright notices, a license notice
+ giving the public permission to use the Modified Version under the
+ terms of this License, in the form shown in the Addendum below.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Preserve in that license notice the full lists of Invariant Sections
+ and required Cover Texts given in the Document&#x2019;s license
+ notice.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Include an unaltered copy of this License.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Preserve the section Entitled &#8220;History&#8221;, Preserve its
+ Title, and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on the Title
+ Page. If there is no section Entitled &#8220;History&#8221; in the
+ Document, create one stating the title, year, authors, and publisher
+ of the Document as given on its Title Page, then add an item
+ describing the Modified Version as stated in the previous sentence.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Preserve the network location, if any, given in the Document for
+ public access to a Transparent copy of the Document, and likewise the
+ network locations given in the Document for previous versions it was
+ based on. These may be placed in the &#8220;History&#8221;
+ section. You may omit a network location for a work that was published
+ at least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ For any section Entitled &#8220;Acknowledgements&#8221; or
+ &#8220;Dedications&#8221;, Preserve the Title of the section, and
+ preserve in the section all the substance and tone of each of the
+ contributor acknowledgements and/or dedications given therein.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Preserve all the Invariant Sections of the Document, unaltered in
+ their text and in their titles. Section numbers or the equivalent are
+ not considered part of the section titles.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Delete any section Entitled &#8220;Endorsements&#8221;. Such a section
+ may not be included in the Modified Version.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Do not retitle any existing section to be Entitled
+ &#8220;Endorsements&#8221; or to conflict in title with any Invariant
+ Section.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Preserve any Warranty Disclaimers.
+ </simpara>
+ </listitem>
+ </orderedlist>
+ <simpara>
+ If the Modified Version includes new front-matter sections or appendices
+ that qualify as Secondary Sections and contain no material copied from the
+ Document, you may at your option designate some or all of these sections
+ as invariant. To do this, add their titles to the list of Invariant
+ Sections in the Modified Version&#x2019;s license notice. These titles
+ must be distinct from any other section titles.
+ </simpara>
+ <simpara>
+ You may add a section Entitled &#8220;Endorsements&#8221;, provided it
+ contains nothing but endorsements of your Modified Version by various
+ parties &#8212; for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative definition of a
+ standard.
+ </simpara>
+ <simpara>
+ You may add a passage of up to five words as a Front-Cover Text, and a
+ passage of up to 25 words as a Back-Cover Text, to the end of the list of
+ Cover Texts in the Modified Version. Only one passage of Front-Cover Text
+ and one of Back-Cover Text may be added by (or through arrangements made
+ by) any one entity. If the Document already includes a cover text for the
+ same cover, previously added by you or by arrangement made by the same
+ entity you are acting on behalf of, you may not add another; but you may
+ replace the old one, on explicit permission from the previous publisher
+ that added the old one.
+ </simpara>
+ <simpara>
+ The author(s) and publisher(s) of the Document do not by this License give
+ permission to use their names for publicity for or to assert or imply
+ endorsement of any Modified Version.
+ </simpara>
+ <bridgehead id="fdl-1-section5" renderas="sect2">
+ 5. COMBINING DOCUMENTS
+ </bridgehead>
+ <simpara>
+ You may combine the Document with other documents released under this
+ License, under the terms defined in section 4 above for modified versions,
+ provided that you include in the combination all of the Invariant Sections
+ of all of the original documents, unmodified, and list them all as
+ Invariant Sections of your combined work in its license notice, and that
+ you preserve all their Warranty Disclaimers.
+ </simpara>
+ <simpara>
+ The combined work need only contain one copy of this License, and multiple
+ identical Invariant Sections may be replaced with a single copy. If there
+ are multiple Invariant Sections with the same name but different contents,
+ make the title of each such section unique by adding at the end of it, in
+ parentheses, the name of the original author or publisher of that section
+ if known, or else a unique number. Make the same adjustment to the section
+ titles in the list of Invariant Sections in the license notice of the
+ combined work.
+ </simpara>
+ <simpara>
+ In the combination, you must combine any sections Entitled
+ &#8220;History&#8221; in the various original documents, forming one
+ section Entitled &#8220;History&#8221;; likewise combine any sections
+ Entitled &#8220;Acknowledgements&#8221;, and any sections Entitled
+ &#8220;Dedications&#8221;. You must delete all sections Entitled
+ &#8220;Endorsements&#8221;.
+ </simpara>
+ <bridgehead id="fdl-1-section6" renderas="sect2">
+ 6. COLLECTIONS OF DOCUMENTS
+ </bridgehead>
+ <simpara>
+ You may make a collection consisting of the Document and other documents
+ released under this License, and replace the individual copies of this
+ License in the various documents with a single copy that is included in
+ the collection, provided that you follow the rules of this License for
+ verbatim copying of each of the documents in all other respects.
+ </simpara>
+ <simpara>
+ You may extract a single document from such a collection, and distribute
+ it individually under this License, provided you insert a copy of this
+ License into the extracted document, and follow this License in all other
+ respects regarding verbatim copying of that document.
+ </simpara>
+ <bridgehead id="fdl-1-section7" renderas="sect2">
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+ </bridgehead>
+ <simpara>
+ A compilation of the Document or its derivatives with other separate and
+ independent documents or works, in or on a volume of a storage or
+ distribution medium, is called an &#8220;aggregate&#8221; if the copyright
+ resulting from the compilation is not used to limit the legal rights of
+ the compilation&#x2019;s users beyond what the individual works
+ permit. When the Document is included in an aggregate, this License does
+ not apply to the other works in the aggregate which are not themselves
+ derivative works of the Document.
+ </simpara>
+ <simpara>
+ If the Cover Text requirement of section 3 is applicable to these copies
+ of the Document, then if the Document is less than one half of the entire
+ aggregate, the Document&#x2019;s Cover Texts may be placed on covers that
+ bracket the Document within the aggregate, or the electronic equivalent of
+ covers if the Document is in electronic form. Otherwise they must appear
+ on printed covers that bracket the whole aggregate.
+ </simpara>
+ <bridgehead id="fdl-1-section8" renderas="sect2">
+ 8. TRANSLATION
+ </bridgehead>
+ <simpara>
+ Translation is considered a kind of modification, so you may distribute
+ translations of the Document under the terms of section 4. Replacing
+ Invariant Sections with translations requires special permission from
+ their copyright holders, but you may include translations of some or all
+ Invariant Sections in addition to the original versions of these Invariant
+ Sections. You may include a translation of this License, and all the
+ license notices in the Document, and any Warranty Disclaimers, provided
+ that you also include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of this
+ License or a notice or disclaimer, the original version will prevail.
+ </simpara>
+ <simpara>
+ If a section in the Document is Entitled &#8220;Acknowledgements&#8221;,
+ &#8220;Dedications&#8221;, or &#8220;History&#8221;, the requirement
+ (section 4) to Preserve its Title (section 1) will typically require
+ changing the actual title.
+ </simpara>
+ <bridgehead id="fdl-1-section9" renderas="sect2">
+ 9. TERMINATION
+ </bridgehead>
+ <simpara>
+ You may not copy, modify, sublicense, or distribute the Document except as
+ expressly provided under this License. Any attempt otherwise to copy,
+ modify, sublicense, or distribute it is void, and will automatically
+ terminate your rights under this License.
+ </simpara>
+ <simpara>
+ However, if you cease all violation of this License, then your license
+ from a particular copyright holder is reinstated (a) provisionally, unless
+ and until the copyright holder explicitly and finally terminates your
+ license, and (b) permanently, if the copyright holder fails to notify you
+ of the violation by some reasonable means prior to 60 days after the
+ cessation.
+ </simpara>
+ <simpara>
+ Moreover, your license from a particular copyright holder is reinstated
+ permanently if the copyright holder notifies you of the violation by some
+ reasonable means, this is the first time you have received notice of
+ violation of this License (for any work) from that copyright holder, and
+ you cure the violation prior to 30 days after your receipt of the notice.
+ </simpara>
+ <simpara>
+ Termination of your rights under this section does not terminate the
+ licenses of parties who have received copies or rights from you under this
+ License. If your rights have been terminated and not permanently
+ reinstated, receipt of a copy of some or all of the same material does not
+ give you any rights to use it.
+ </simpara>
+ <bridgehead id="fdl-1-section10" renderas="sect2">
+ 10. FUTURE REVISIONS OF THIS LICENSE
+ </bridgehead>
+ <simpara>
+ The Free Software Foundation may publish new, revised versions of the GNU
+ Free Documentation License from time to time. Such new versions will be
+ similar in spirit to the present version, but may differ in detail to
+ address new problems or concerns. See
+ <ulink url="http://www.gnu.org/copyleft/">Copyleft</ulink>.
+ </simpara>
+ <simpara>
+ Each version of the License is given a distinguishing version number. If
+ the Document specifies that a particular numbered version of this License
+ &#8220;or any later version&#8221; applies to it, you have the option of
+ following the terms and conditions either of that specified version or of
+ any later version that has been published (not as a draft) by the Free
+ Software Foundation. If the Document does not specify a version number of
+ this License, you may choose any version ever published (not as a draft)
+ by the Free Software Foundation. If the Document specifies that a proxy
+ can decide which future versions of this License can be used, that
+ proxy&#x2019;s public statement of acceptance of a version permanently
+ authorizes you to choose that version for the Document.
+ </simpara>
+ <bridgehead id="fdl-1-section11" renderas="sect2">
+ 11. RELICENSING
+ </bridgehead>
+ <simpara>
+ &#8220;Massive Multiauthor Collaboration Site&#8221; (or &#8220;MMC
+ Site&#8221;) means any World Wide Web server that publishes copyrightable
+ works and also provides prominent facilities for anybody to edit those
+ works. A public wiki that anybody can edit is an example of such a
+ server. A &#8220;Massive Multiauthor Collaboration&#8221; (or
+ &#8220;MMC&#8221;) contained in the site means any set of copyrightable
+ works thus published on the MMC site.
+ </simpara>
+ <simpara>
+ &#8220;CC-BY-SA&#8221; means the Creative Commons Attribution-Share Alike
+ 3.0 license published by Creative Commons Corporation, a not-for-profit
+ corporation with a principal place of business in San Francisco,
+ California, as well as future copyleft versions of that license published
+ by that same organization.
+ </simpara>
+ <simpara>
+ &#8220;Incorporate&#8221; means to publish or republish a Document, in
+ whole or in part, as part of another Document.
+ </simpara>
+ <simpara>
+ An MMC is &#8220;eligible for relicensing&#8221; if it is licensed under
+ this License, and if all works that were first published under this
+ License somewhere other than this MMC, and subsequently incorporated in
+ whole or in part into the MMC, (1) had no cover texts or invariant
+ sections, and (2) were thus incorporated prior to November 1, 2008.
+ </simpara>
+ <simpara>
+ The operator of an MMC Site may republish an MMC contained in the site
+ under CC-BY-SA on the same site at any time before August 1, 2009,
+ provided the MMC is eligible for relicensing.
+ </simpara>
+ <bridgehead id="fdl-1-addendum" renderas="sect2">
+ ADDENDUM: How to use this License for your documents
+ </bridgehead>
+ <simpara>
+ To use this License in a document you have written, include a copy of the
+ License in the document and put the following copyright and license
+ notices just after the title page:
+ </simpara>
+ <screen>Copyright &#169; YEAR YOUR NAME
+
+Permission is granted to copy, distribute and/or modify this document under the
+terms of the GNU Free Documentation License, Version 1.3 or any later version
+published by the Free Software Foundation; with no Invariant Sections, no
+Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in
+the section entitled &#8220;GNU Free Documentation License&#8221;.</screen>
+ <simpara>
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+ replace the &#8220;with&#8230; Texts.&#8221; line with this:
+ </simpara>
+ <screen>with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts
+being LIST, and with the Back-Cover Texts being LIST.</screen>
+ <simpara>
+ If you have Invariant Sections without Cover Texts, or some other
+ combination of the three, merge those two alternatives to suit the
+ situation.
+ </simpara>
+ <simpara>
+ If your document contains nontrivial examples of program code, we
+ recommend releasing these examples in parallel under your choice of free
+ software license, such as the GNU General Public License, to permit their
+ use in free software.
+ </simpara>
+</appendix>
diff --git a/libstdc++-v3/doc/xml/manual/abi.xml b/libstdc++-v3/doc/xml/manual/abi.xml
index cc5370e26ac..8777bc72e6d 100644
--- a/libstdc++-v3/doc/xml/manual/abi.xml
+++ b/libstdc++-v3/doc/xml/manual/abi.xml
@@ -179,11 +179,26 @@ compatible.
<listitem><para>gcc-3.3.1: libgcc_s.so.1</para></listitem>
<listitem><para>gcc-3.3.2: libgcc_s.so.1</para></listitem>
<listitem><para>gcc-3.3.3: libgcc_s.so.1</para></listitem>
- <listitem><para>gcc-3.4.x, gcc-4.[0-5].x: on m68k-linux and
- hppa-linux this is either libgcc_s.so.1 (when configuring
- <code>--with-sjlj-exceptions</code>) or libgcc_s.so.2. For all
- others, this is libgcc_s.so.1. </para>
- </listitem>
+ <listitem><para>gcc-3.4.x, gcc-4.[0-5].x: libgcc_s.so.1</para></listitem>
+ </itemizedlist>
+
+ <para>For m68k-linux the versions differ as follows: </para>
+
+ <itemizedlist>
+ <listitem><para>gcc-3.4.x, gcc-4.[0-5].x: libgcc_s.so.1
+ when configuring <code>--with-sjlj-exceptions</code>, or
+ libgcc_s.so.2 </para> </listitem>
+ </itemizedlist>
+
+ <para>For hppa-linux the versions differ as follows: </para>
+
+ <itemizedlist>
+ <listitem><para>gcc-3.4.x, gcc-4.[0-1].x: either libgcc_s.so.1
+ when configuring <code>--with-sjlj-exceptions</code>, or
+ libgcc_s.so.2 </para> </listitem>
+ <listitem><para>gcc-4.[2-5].x: either libgcc_s.so.3 when configuring
+ <code>--with-sjlj-exceptions</code>) or libgcc_s.so.4
+ </para> </listitem>
</itemizedlist>
</listitem>
diff --git a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
index 393b7f509c3..b73b8f4c3fb 100644
--- a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
+++ b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
@@ -52,7 +52,7 @@
organization is ANSI and their web-site is right
<ulink url="http://www.ansi.org">here.</ulink>
(And if you've already registered with them, clicking this link will take you to directly to the place where you can
- <ulink url="http://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC+14882:2003">buy the standard on-line.)</ulink>
+ <ulink url="http://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC+14882:2003">buy the standard on-line</ulink>.)
</para>
</listitem>
@@ -509,7 +509,7 @@ indicate a place that may require attention for multi-thread safety.
__embedded_cplusplus
// long double conversion members mangled as __opr
// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00060.html
- _opr
+ __opr
</literallayout>
</sect2>
@@ -520,52 +520,60 @@ indicate a place that may require attention for multi-thread safety.
it is intended to precede the recommendations of the GNU Coding
Standard, which can be referenced in full here:
- http://www.gnu.org/prep/standards/standards.html#Formatting
+ <ulink url="http://www.gnu.org/prep/standards/standards.html#Formatting">http://www.gnu.org/prep/standards/standards.html#Formatting</ulink>
The rest of this is also interesting reading, but skip the "Design
Advice" part.
The GCC coding conventions are here, and are also useful:
- http://gcc.gnu.org/codingconventions.html
+ <ulink url="http://gcc.gnu.org/codingconventions.html">http://gcc.gnu.org/codingconventions.html</ulink>
In addition, because it doesn't seem to be stated explicitly anywhere
else, there is an 80 column source limit.
- ChangeLog entries for member functions should use the
+ <filename>ChangeLog</filename> entries for member functions should use the
classname::member function name syntax as follows:
- 1999-04-15 Dennis Ritchie &lt;dr@att.com&gt;
+<code>
+1999-04-15 Dennis Ritchie &lt;dr@att.com&gt;
* src/basic_file.cc (__basic_file::open): Fix thinko in
_G_HAVE_IO_FILE_OPEN bits.
+</code>
Notable areas of divergence from what may be previous local practice
(particularly for GNU C) include:
01. Pointers and references
- char* p = "flop";
- char&amp; c = *p;
- -NOT-
- char *p = "flop"; // wrong
- char &amp;c = *p; // wrong
+ <code>
+ char* p = "flop";
+ char&amp; c = *p;
+ -NOT-
+ char *p = "flop"; // wrong
+ char &amp;c = *p; // wrong
+ </code>
Reason: In C++, definitions are mixed with executable code. Here,
- p is being initialized, not *p. This is near-universal
+ <code>p</code> is being initialized, not <code>*p</code>. This is near-universal
practice among C++ programmers; it is normal for C hackers
to switch spontaneously as they gain experience.
02. Operator names and parentheses
- operator==(type)
- -NOT-
- operator == (type) // wrong
+ <code>
+ operator==(type)
+ -NOT-
+ operator == (type) // wrong
+ </code>
- Reason: The == is part of the function name. Separating
+ Reason: The <code>==</code> is part of the function name. Separating
it makes the declaration look like an expression.
03. Function names and parentheses
- void mangle()
- -NOT-
- void mangle () // wrong
+ <code>
+ void mangle()
+ -NOT-
+ void mangle () // wrong
+ </code>
Reason: no space before parentheses (except after a control-flow
keyword) is near-universal practice for C++. It identifies the
@@ -573,86 +581,98 @@ indicate a place that may require attention for multi-thread safety.
opposed to an expression or other overloaded use of parentheses.
04. Template function indentation
- template&lt;typename T&gt;
- void
- template_function(args)
- { }
- -NOT-
- template&lt;class T&gt;
- void template_function(args) {};
+ <code>
+ template&lt;typename T&gt;
+ void
+ template_function(args)
+ { }
+ -NOT-
+ template&lt;class T&gt;
+ void template_function(args) {};
+ </code>
Reason: In class definitions, without indentation whitespace is
needed both above and below the declaration to distinguish
it visually from other members. (Also, re: "typename"
- rather than "class".) T often could be int, which is
+ rather than "class".) <code>T</code> often could be <code>int</code>, which is
not a class. ("class", here, is an anachronism.)
05. Template class indentation
- template&lt;typename _CharT, typename _Traits&gt;
- class basic_ios : public ios_base
- {
- public:
- // Types:
- };
- -NOT-
- template&lt;class _CharT, class _Traits&gt;
- class basic_ios : public ios_base
- {
- public:
- // Types:
- };
- -NOT-
- template&lt;class _CharT, class _Traits&gt;
- class basic_ios : public ios_base
- {
- public:
- // Types:
- };
+ <code>
+ template&lt;typename _CharT, typename _Traits&gt;
+ class basic_ios : public ios_base
+ {
+ public:
+ // Types:
+ };
+ -NOT-
+ template&lt;class _CharT, class _Traits&gt;
+ class basic_ios : public ios_base
+ {
+ public:
+ // Types:
+ };
+ -NOT-
+ template&lt;class _CharT, class _Traits&gt;
+ class basic_ios : public ios_base
+ {
+ public:
+ // Types:
+ };
+ </code>
06. Enumerators
- enum
- {
- space = _ISspace,
- print = _ISprint,
- cntrl = _IScntrl
- };
- -NOT-
- enum { space = _ISspace, print = _ISprint, cntrl = _IScntrl };
+ <code>
+ enum
+ {
+ space = _ISspace,
+ print = _ISprint,
+ cntrl = _IScntrl
+ };
+ -NOT-
+ enum { space = _ISspace, print = _ISprint, cntrl = _IScntrl };
+ </code>
07. Member initialization lists
All one line, separate from class name.
- gribble::gribble()
- : _M_private_data(0), _M_more_stuff(0), _M_helper(0);
- { }
- -NOT-
- gribble::gribble() : _M_private_data(0), _M_more_stuff(0), _M_helper(0);
- { }
+ <code>
+ gribble::gribble()
+ : _M_private_data(0), _M_more_stuff(0), _M_helper(0)
+ { }
+ -NOT-
+ gribble::gribble() : _M_private_data(0), _M_more_stuff(0), _M_helper(0)
+ { }
+ </code>
08. Try/Catch blocks
- try
- {
- //
- }
- catch (...)
- {
- //
- }
- -NOT-
- try {
- //
- } catch(...) {
- //
- }
+ <code>
+ try
+ {
+ //
+ }
+ catch (...)
+ {
+ //
+ }
+ -NOT-
+ try {
+ //
+ } catch(...) {
+ //
+ }
+ </code>
09. Member functions declarations and definitions
Keywords such as extern, static, export, explicit, inline, etc
go on the line above the function name. Thus
+ <code>
virtual int
foo()
-NOT-
virtual int foo()
+ </code>
Reason: GNU coding conventions dictate return types for functions
are on a separate line than the function name and parameter list
@@ -663,42 +683,49 @@ indicate a place that may require attention for multi-thread safety.
10. Invocation of member functions with "this-&gt;"
- For non-uglified names, use this-&gt;name to call the function.
+ For non-uglified names, use <code>this-&gt;name</code> to call the function.
+ <code>
this-&gt;sync()
-NOT-
sync()
+ </code>
Reason: Koenig lookup.
11. Namespaces
+ <code>
namespace std
{
- blah blah blah;
+ blah blah blah;
} // namespace std
-NOT-
namespace std {
- blah blah blah;
+ blah blah blah;
} // namespace std
+ </code>
12. Spacing under protected and private in class declarations:
space above, none below
i.e.
+ <code>
public:
- int foo;
+ int foo;
-NOT-
public:
- int foo;
+ int foo;
+ </code>
13. Spacing WRT return statements.
no extra spacing before returns, no parenthesis
i.e.
+ <code>
}
return __ret;
@@ -711,21 +738,22 @@ indicate a place that may require attention for multi-thread safety.
}
return (__ret);
+ </code>
14. Location of global variables.
All global variables of class type, whether in the "user visible"
- space (e.g., cin) or the implementation namespace, must be defined
+ space (e.g., <code>cin</code>) or the implementation namespace, must be defined
as a character array with the appropriate alignment and then later
re-initialized to the correct value.
This is due to startup issues on certain platforms, such as AIX.
- For more explanation and examples, see src/globals.cc. All such
+ For more explanation and examples, see <filename>src/globals.cc</filename>. All such
variables should be contained in that file, for simplicity.
15. Exception abstractions
- Use the exception abstractions found in functexcept.h, which allow
- C++ programmers to use this library with -fno-exceptions. (Even if
+ Use the exception abstractions found in <filename class="headerfile">functexcept.h</filename>, which allow
+ C++ programmers to use this library with <literal>-fno-exceptions</literal>. (Even if
that is rarely advisable, it's a necessary evil for backwards
compatibility.)
@@ -733,9 +761,11 @@ indicate a place that may require attention for multi-thread safety.
All start with the name of the function where the exception is
thrown, and then (optional) descriptive text is added. Example:
+ <code>
__throw_logic_error(__N("basic_string::_S_construct NULL not valid"));
+ </code>
- Reason: The verbose terminate handler prints out exception::what(),
+ Reason: The verbose terminate handler prints out <code>exception::what()</code>,
as well as the typeinfo for the thrown exception. As this is the
default terminate handler, by putting location info into the
exception string, a very useful error message is printed out for
@@ -755,21 +785,21 @@ indicate a place that may require attention for multi-thread safety.
to use names that begin with underscores. This is called "uglification".
The convention is:
- Local and argument names: __[a-z].*
+ Local and argument names: <literal>__[a-z].*</literal>
- Examples: __count __ix __s1
+ Examples: <code>__count __ix __s1</code>
- Type names and template formal-argument names: _[A-Z][^_].*
+ Type names and template formal-argument names: <literal>_[A-Z][^_].*</literal>
- Examples: _Helper _CharT _N
+ Examples: <code>_Helper _CharT _N</code>
- Member data and function names: _M_.*
+ Member data and function names: <literal>_M_.*</literal>
- Examples: _M_num_elements _M_initialize ()
+ Examples: <code>_M_num_elements _M_initialize ()</code>
- Static data members, constants, and enumerations: _S_.*
+ Static data members, constants, and enumerations: <literal>_S_.*</literal>
- Examples: _S_max_elements _S_default_value
+ Examples: <code>_S_max_elements _S_default_value</code>
Don't use names in the same scope that differ only in the prefix,
e.g. _S_top and _M_top. See BADNAMES for a list of forbidden names.
@@ -781,87 +811,88 @@ indicate a place that may require attention for multi-thread safety.
--------------------------
[BY EXAMPLE]
+ <code>
#ifndef _HEADER_
#define _HEADER_ 1
namespace std
{
- class gribble
- {
- public:
- gribble() throw();
+ class gribble
+ {
+ public:
+ gribble() throw();
- gribble(const gribble&amp;);
+ gribble(const gribble&amp;);
- explicit
- gribble(int __howmany);
+ explicit
+ gribble(int __howmany);
- gribble&amp;
- operator=(const gribble&amp;);
+ gribble&amp;
+ operator=(const gribble&amp;);
- virtual
- ~gribble() throw ();
+ virtual
+ ~gribble() throw ();
- // Start with a capital letter, end with a period.
- inline void
- public_member(const char* __arg) const;
+ // Start with a capital letter, end with a period.
+ inline void
+ public_member(const char* __arg) const;
- // In-class function definitions should be restricted to one-liners.
- int
- one_line() { return 0 }
+ // In-class function definitions should be restricted to one-liners.
+ int
+ one_line() { return 0 }
- int
- two_lines(const char* arg)
- { return strchr(arg, 'a'); }
+ int
+ two_lines(const char* arg)
+ { return strchr(arg, 'a'); }
- inline int
- three_lines(); // inline, but defined below.
+ inline int
+ three_lines(); // inline, but defined below.
- // Note indentation.
- template&lt;typename _Formal_argument&gt;
- void
- public_template() const throw();
+ // Note indentation.
+ template&lt;typename _Formal_argument&gt;
+ void
+ public_template() const throw();
- template&lt;typename _Iterator&gt;
- void
- other_template();
+ template&lt;typename _Iterator&gt;
+ void
+ other_template();
- private:
- class _Helper;
+ private:
+ class _Helper;
- int _M_private_data;
- int _M_more_stuff;
- _Helper* _M_helper;
- int _M_private_function();
+ int _M_private_data;
+ int _M_more_stuff;
+ _Helper* _M_helper;
+ int _M_private_function();
- enum _Enum
- {
- _S_one,
- _S_two
- };
+ enum _Enum
+ {
+ _S_one,
+ _S_two
+ };
- static void
- _S_initialize_library();
- };
+ static void
+ _S_initialize_library();
+ };
- // More-or-less-standard language features described by lack, not presence.
+ // More-or-less-standard language features described by lack, not presence.
# ifndef _G_NO_LONGLONG
- extern long long _G_global_with_a_good_long_name; // avoid globals!
+ extern long long _G_global_with_a_good_long_name; // avoid globals!
# endif
- // Avoid in-class inline definitions, define separately;
- // likewise for member class definitions:
- inline int
- gribble::public_member() const
- { int __local = 0; return __local; }
+ // Avoid in-class inline definitions, define separately;
+ // likewise for member class definitions:
+ inline int
+ gribble::public_member() const
+ { int __local = 0; return __local; }
- class gribble::_Helper
- {
- int _M_stuff;
+ class gribble::_Helper
+ {
+ int _M_stuff;
- friend class gribble;
- };
+ friend class gribble;
+ };
}
// Names beginning with "__": only for arguments and
@@ -873,41 +904,42 @@ indicate a place that may require attention for multi-thread safety.
namespace std
{
- template&lt;typename T&gt; // notice: "typename", not "class", no space
- long_return_value_type&lt;with_many, args&gt;
- function_name(char* pointer, // "char *pointer" is wrong.
- char* argument,
- const Reference&amp; ref)
- {
- // int a_local; /* wrong; see below. */
- if (test)
- {
- nested code
- }
-
- int a_local = 0; // declare variable at first use.
-
- // char a, b, *p; /* wrong */
- char a = 'a';
- char b = a + 1;
- char* c = "abc"; // each variable goes on its own line, always.
-
- // except maybe here...
- for (unsigned i = 0, mask = 1; mask; ++i, mask &lt;&lt;= 1) {
- // ...
- }
- }
-
- gribble::gribble()
- : _M_private_data(0), _M_more_stuff(0), _M_helper(0);
- { }
-
- inline int
- gribble::three_lines()
- {
- // doesn't fit in one line.
- }
+ template&lt;typename T&gt; // notice: "typename", not "class", no space
+ long_return_value_type&lt;with_many, args&gt;
+ function_name(char* pointer, // "char *pointer" is wrong.
+ char* argument,
+ const Reference&amp; ref)
+ {
+ // int a_local; /* wrong; see below. */
+ if (test)
+ {
+ nested code
+ }
+
+ int a_local = 0; // declare variable at first use.
+
+ // char a, b, *p; /* wrong */
+ char a = 'a';
+ char b = a + 1;
+ char* c = "abc"; // each variable goes on its own line, always.
+
+ // except maybe here...
+ for (unsigned i = 0, mask = 1; mask; ++i, mask &lt;&lt;= 1) {
+ // ...
+ }
+ }
+
+ gribble::gribble()
+ : _M_private_data(0), _M_more_stuff(0), _M_helper(0)
+ { }
+
+ int
+ gribble::three_lines()
+ {
+ // doesn't fit in one line.
+ }
} // namespace std
+ </code>
</literallayout>
</sect2>
</sect1>
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index c1c1ee4de04..a6dff4daf15 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -166,8 +166,8 @@ requirements of the license of GCC.
The documentation shipped with the library and made available over
the web, excluding the pages generated from source comments, are
copyrighted by the Free Software Foundation, and placed under the
- <link linkend="appendix.gfdl-1.2"> GNU Free Documentation
- License version 1.2</link>. There are no Front-Cover Texts, no
+ <link linkend="appendix.gfdl-1.3"> GNU Free Documentation
+ License version 1.3</link>. There are no Front-Cover Texts, no
Back-Cover Texts, and no Invariant Sections.
</para>
diff --git a/libstdc++-v3/doc/xml/manual/spine.xml b/libstdc++-v3/doc/xml/manual/spine.xml
index 1c806ca18b8..edb650c879c 100644
--- a/libstdc++-v3/doc/xml/manual/spine.xml
+++ b/libstdc++-v3/doc/xml/manual/spine.xml
@@ -131,7 +131,7 @@
<!-- Appendix E -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- parse="xml" href="../gnu/fdl-1.2.xml">
+ parse="xml" href="../gnu/fdl-1.3.xml">
</xi:include>
</part>
diff --git a/libstdc++-v3/doc/xml/manual/status_cxx200x.xml b/libstdc++-v3/doc/xml/manual/status_cxx200x.xml
index d6a73e94a7b..718e47bb098 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx200x.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx200x.xml
@@ -82,7 +82,7 @@ particular release.
<entry>18.2</entry>
<entry>Types</entry>
<entry>Partial</entry>
- <entry>Missing offsetof, max_align_t, nullptr_t</entry>
+ <entry>Missing offsetof, max_align_t</entry>
</row>
<row>
<entry>18.3</entry>
@@ -519,7 +519,7 @@ particular release.
<entry>20.7.4.3</entry>
<entry>Type properties</entry>
<entry>Partial</entry>
- <entry>Missing is_system_layout</entry>
+ <entry>Missing is_trivially_copyable, is_literal_type, is_nothrow_constructible</entry>
</row>
<row>
<entry>20.7.5</entry>
@@ -2236,10 +2236,11 @@ particular release.
<entry></entry>
</row>
<row>
+ <?dbhtml bgcolor="#B0B0B0" ?>
<entry>30.3.1</entry>
<entry>Class <code>thread</code></entry>
- <entry>Y</entry>
- <entry></entry>
+ <entry>Partial</entry>
+ <entry><code>thread::id</code> is not trivially copyable</entry>
</row>
<row>
<entry>30.3.2</entry>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 1ced7813c1c..6c0230ad292 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -121,6 +121,15 @@ bits_headers = \
${bits_srcdir}/postypes.h \
${bits_srcdir}/random.h \
${bits_srcdir}/random.tcc \
+ ${bits_srcdir}/regex.h \
+ ${bits_srcdir}/regex_compiler.h \
+ ${bits_srcdir}/regex_constants.h \
+ ${bits_srcdir}/regex_cursor.h \
+ ${bits_srcdir}/regex_error.h \
+ ${bits_srcdir}/regex_grep_matcher.h \
+ ${bits_srcdir}/regex_grep_matcher.tcc \
+ ${bits_srcdir}/regex_nfa.h \
+ ${bits_srcdir}/regex_nfa.tcc \
${bits_srcdir}/stream_iterator.h \
${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/shared_ptr.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index fd45a43e9da..631561c585e 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -361,6 +361,15 @@ bits_headers = \
${bits_srcdir}/postypes.h \
${bits_srcdir}/random.h \
${bits_srcdir}/random.tcc \
+ ${bits_srcdir}/regex.h \
+ ${bits_srcdir}/regex_compiler.h \
+ ${bits_srcdir}/regex_constants.h \
+ ${bits_srcdir}/regex_cursor.h \
+ ${bits_srcdir}/regex_error.h \
+ ${bits_srcdir}/regex_grep_matcher.h \
+ ${bits_srcdir}/regex_grep_matcher.tcc \
+ ${bits_srcdir}/regex_nfa.h \
+ ${bits_srcdir}/regex_nfa.tcc \
${bits_srcdir}/stream_iterator.h \
${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/shared_ptr.h \
diff --git a/libstdc++-v3/include/backward/hash_fun.h b/libstdc++-v3/include/backward/hash_fun.h
index b7b14a1e418..66e31d844cd 100644
--- a/libstdc++-v3/include/backward/hash_fun.h
+++ b/libstdc++-v3/include/backward/hash_fun.h
@@ -57,7 +57,7 @@
#ifndef _BACKWARD_HASH_FUN_H
#define _BACKWARD_HASH_FUN_H 1
-#include <cstddef>
+#include <bits/c++config.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index d450a4717de..ab71ad67e17 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1,7 +1,7 @@
// Components for manipulating sequences of characters -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009
+// 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -130,7 +130,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#endif
// NB: Not required, but considered best practice.
if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)
- __throw_logic_error(__N("basic_string::_S_construct NULL not valid"));
+ __throw_logic_error(__N("basic_string::_S_construct null not valid"));
const size_type __dnew = static_cast<size_type>(std::distance(__beg,
__end));
diff --git a/libstdc++-v3/include/bits/boost_concept_check.h b/libstdc++-v3/include/bits/boost_concept_check.h
index 054fcf27e5e..cffd7fb2d05 100644
--- a/libstdc++-v3/include/bits/boost_concept_check.h
+++ b/libstdc++-v3/include/bits/boost_concept_check.h
@@ -1,6 +1,7 @@
// -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +42,7 @@
#pragma GCC system_header
-#include <cstddef> // for ptrdiff_t, used next
+#include <bits/c++config.h>
#include <bits/stl_iterator_base_types.h> // for traits and tags
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 3746696458a..9dc9ac24cd8 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -1,7 +1,7 @@
// Predefined symbols and macros -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -376,4 +376,19 @@ _GLIBCXX_END_NAMESPACE
# endif
#endif
+#ifdef __cplusplus
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ typedef __SIZE_TYPE__ size_t;
+ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ typedef decltype(nullptr) nullptr_t;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // __cplusplus
+
// End of prewritten config; the discovered settings follow.
diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc
index cde067cf382..d8c27870647 100644
--- a/libstdc++-v3/include/bits/deque.tcc
+++ b/libstdc++-v3/include/bits/deque.tcc
@@ -1,6 +1,7 @@
// Deque implementation (out of line) -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -59,6 +60,33 @@
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_default_initialize()
+ {
+ _Map_pointer __cur;
+ __try
+ {
+ for (__cur = this->_M_impl._M_start._M_node;
+ __cur < this->_M_impl._M_finish._M_node;
+ ++__cur)
+ std::__uninitialized_default_a(*__cur, *__cur + _S_buffer_size(),
+ _M_get_Tp_allocator());
+ std::__uninitialized_default_a(this->_M_impl._M_finish._M_first,
+ this->_M_impl._M_finish._M_cur,
+ _M_get_Tp_allocator());
+ }
+ __catch(...)
+ {
+ std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur),
+ _M_get_Tp_allocator());
+ __throw_exception_again;
+ }
+ }
+#endif
+
template <typename _Tp, typename _Alloc>
deque<_Tp, _Alloc>&
deque<_Tp, _Alloc>::
@@ -271,6 +299,32 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_insert_aux(__pos, __n, __x);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_default_append(size_type __n)
+ {
+ if (__n)
+ {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ __try
+ {
+ std::__uninitialized_default_a(this->_M_impl._M_finish,
+ __new_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __new_finish;
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
+ __new_finish._M_node + 1);
+ __throw_exception_again;
+ }
+ }
+ }
+#endif
+
template <typename _Tp, typename _Alloc>
void
deque<_Tp, _Alloc>::
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index c0c135cd1b3..3708a62c37d 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -463,7 +463,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* constructed elements.
*/
explicit
- forward_list(size_type __n);
+ forward_list(size_type __n)
+ : _Base()
+ { _M_default_initialize(__n); }
/**
* @brief Creates a %forward_list with copies of an exemplar element.
@@ -1209,6 +1211,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Called by splice_after and insert_after.
iterator
_M_splice_after(const_iterator __pos, forward_list&& __list);
+
+ // Called by forward_list(n).
+ void
+ _M_default_initialize(size_type __n);
+
+ // Called by resize(sz).
+ void
+ _M_default_insert_after(const_iterator __pos, size_type __n);
};
/**
diff --git a/libstdc++-v3/include/bits/forward_list.tcc b/libstdc++-v3/include/bits/forward_list.tcc
index 7468a90d1af..a3719a8698d 100644
--- a/libstdc++-v3/include/bits/forward_list.tcc
+++ b/libstdc++-v3/include/bits/forward_list.tcc
@@ -114,7 +114,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_fill_initialize(size_type __n, const value_type& __value)
{
_Node_base* __to = &this->_M_impl._M_head;
- for (; __n > 0; --__n)
+ for (; __n; --__n)
{
__to->_M_next = this->_M_create_node(__value);
__to = __to->_M_next;
@@ -122,12 +122,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
template<typename _Tp, typename _Alloc>
+ void
forward_list<_Tp, _Alloc>::
- forward_list(size_type __n)
- : _Base()
+ _M_default_initialize(size_type __n)
{
_Node_base* __to = &this->_M_impl._M_head;
- for (; __n > 0; --__n)
+ for (; __n; --__n)
{
__to->_M_next = this->_M_create_node();
__to = __to->_M_next;
@@ -164,6 +164,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp, typename _Alloc>
void
forward_list<_Tp, _Alloc>::
+ _M_default_insert_after(const_iterator __pos, size_type __n)
+ {
+ const_iterator __saved_pos = __pos;
+ __try
+ {
+ for (; __n; --__n)
+ __pos = emplace_after(__pos);
+ }
+ __catch(...)
+ {
+ erase_after(__saved_pos, ++__pos);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ forward_list<_Tp, _Alloc>::
resize(size_type __sz)
{
iterator __k = before_begin();
@@ -177,10 +195,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (__len == __sz)
erase_after(__k, end());
else
- {
- forward_list __tmp(__sz - __len);
- splice_after(__k, std::move(__tmp));
- }
+ _M_default_insert_after(__k, __sz - __len);
}
template<typename _Tp, typename _Alloc>
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index c5f7f8c52af..c498f48caee 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -64,21 +64,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (_M_buf_allocated)
{
delete [] _M_buf;
- _M_buf = NULL;
+ _M_buf = 0;
_M_buf_allocated = false;
}
delete [] _M_ext_buf;
- _M_ext_buf = NULL;
+ _M_ext_buf = 0;
_M_ext_buf_size = 0;
- _M_ext_next = NULL;
- _M_ext_end = NULL;
+ _M_ext_next = 0;
+ _M_ext_end = 0;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::
basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),
_M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(),
- _M_state_last(), _M_buf(NULL), _M_buf_size(BUFSIZ),
+ _M_state_last(), _M_buf(0), _M_buf_size(BUFSIZ),
_M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_pback(),
_M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false),
_M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0),
@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
basic_filebuf<_CharT, _Traits>::
open(const char* __s, ios_base::openmode __mode)
{
- __filebuf_type *__ret = NULL;
+ __filebuf_type *__ret = 0;
if (!this->is_open())
{
_M_file.open(__s, __mode);
@@ -128,7 +128,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
close()
{
if (!this->is_open())
- return NULL;
+ return 0;
bool __testfail = false;
{
@@ -167,7 +167,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__testfail = true;
if (__testfail)
- return NULL;
+ return 0;
else
return this;
}
diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h
index aaa05aad689..a207ffa6bd0 100644
--- a/libstdc++-v3/include/bits/functional_hash.h
+++ b/libstdc++-v3/include/bits/functional_hash.h
@@ -32,7 +32,7 @@
#pragma GCC system_header
-#include <cstddef>
+#include <bits/c++config.h>
#include <bits/stl_function.h>
namespace std
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index f1c4a10dd66..3446c42a85b 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -112,6 +112,56 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
return __ret;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ _M_default_append(size_type __n)
+ {
+ size_type __i = 0;
+ __try
+ {
+ for (; __i < __n; ++__i)
+ emplace_back();
+ }
+ __catch(...)
+ {
+ for (; __i; --__i)
+ pop_back();
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ resize(size_type __new_size)
+ {
+ iterator __i = begin();
+ size_type __len = 0;
+ for (; __i != end() && __len < __new_size; ++__i, ++__len)
+ ;
+ if (__len == __new_size)
+ erase(__i, end());
+ else // __i == end()
+ _M_default_append(__new_size - __len);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ resize(size_type __new_size, const value_type& __x)
+ {
+ iterator __i = begin();
+ size_type __len = 0;
+ for (; __i != end() && __len < __new_size; ++__i, ++__len)
+ ;
+ if (__len == __new_size)
+ erase(__i, end());
+ else // __i == end()
+ insert(end(), __new_size - __len, __x);
+ }
+#else
template<typename _Tp, typename _Alloc>
void
list<_Tp, _Alloc>::
@@ -126,6 +176,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
else // __i == end()
insert(end(), __new_size - __len, __x);
}
+#endif
template<typename _Tp, typename _Alloc>
list<_Tp, _Alloc>&
diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h
index 2e18f7da8ed..79bfd03026d 100644
--- a/libstdc++-v3/include/bits/locale_facets.h
+++ b/libstdc++-v3/include/bits/locale_facets.h
@@ -1587,12 +1587,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
bool _M_allocated;
- __numpunct_cache(size_t __refs = 0) : facet(__refs),
- _M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),
- _M_truename(NULL), _M_truename_size(0), _M_falsename(NULL),
- _M_falsename_size(0), _M_decimal_point(_CharT()),
- _M_thousands_sep(_CharT()), _M_allocated(false)
- { }
+ __numpunct_cache(size_t __refs = 0)
+ : facet(__refs), _M_grouping(0), _M_grouping_size(0),
+ _M_use_grouping(false),
+ _M_truename(0), _M_truename_size(0), _M_falsename(0),
+ _M_falsename_size(0), _M_decimal_point(_CharT()),
+ _M_thousands_sep(_CharT()), _M_allocated(false)
+ { }
~__numpunct_cache();
@@ -1657,7 +1658,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @param refs Refcount to pass to the base class.
*/
explicit
- numpunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
+ numpunct(size_t __refs = 0)
+ : facet(__refs), _M_data(0)
{ _M_initialize_numpunct(); }
/**
@@ -1685,7 +1687,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*/
explicit
numpunct(__c_locale __cloc, size_t __refs = 0)
- : facet(__refs), _M_data(NULL)
+ : facet(__refs), _M_data(0)
{ _M_initialize_numpunct(__cloc); }
/**
@@ -1841,7 +1843,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// For use at construction time only.
void
- _M_initialize_numpunct(__c_locale __cloc = NULL);
+ _M_initialize_numpunct(__c_locale __cloc = 0);
};
template<typename _CharT>
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 1608e2c42da..52bafd36dfe 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -1,7 +1,7 @@
// Locale support -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009
+// 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -56,7 +56,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const locale::facet** __caches = __loc._M_impl->_M_caches;
if (!__caches[__i])
{
- __numpunct_cache<_CharT>* __tmp = NULL;
+ __numpunct_cache<_CharT>* __tmp = 0;
__try
{
__tmp = new __numpunct_cache<_CharT>;
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h
index a25e0acd2c0..fdc810d12be 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.h
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.h
@@ -118,20 +118,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
bool _M_allocated;
__timepunct_cache(size_t __refs = 0) : facet(__refs),
- _M_date_format(NULL), _M_date_era_format(NULL), _M_time_format(NULL),
- _M_time_era_format(NULL), _M_date_time_format(NULL),
- _M_date_time_era_format(NULL), _M_am(NULL), _M_pm(NULL),
- _M_am_pm_format(NULL), _M_day1(NULL), _M_day2(NULL), _M_day3(NULL),
- _M_day4(NULL), _M_day5(NULL), _M_day6(NULL), _M_day7(NULL),
- _M_aday1(NULL), _M_aday2(NULL), _M_aday3(NULL), _M_aday4(NULL),
- _M_aday5(NULL), _M_aday6(NULL), _M_aday7(NULL), _M_month01(NULL),
- _M_month02(NULL), _M_month03(NULL), _M_month04(NULL), _M_month05(NULL),
- _M_month06(NULL), _M_month07(NULL), _M_month08(NULL), _M_month09(NULL),
- _M_month10(NULL), _M_month11(NULL), _M_month12(NULL), _M_amonth01(NULL),
- _M_amonth02(NULL), _M_amonth03(NULL), _M_amonth04(NULL),
- _M_amonth05(NULL), _M_amonth06(NULL), _M_amonth07(NULL),
- _M_amonth08(NULL), _M_amonth09(NULL), _M_amonth10(NULL),
- _M_amonth11(NULL), _M_amonth12(NULL), _M_allocated(false)
+ _M_date_format(0), _M_date_era_format(0), _M_time_format(0),
+ _M_time_era_format(0), _M_date_time_format(0),
+ _M_date_time_era_format(0), _M_am(0), _M_pm(0),
+ _M_am_pm_format(0), _M_day1(0), _M_day2(0), _M_day3(0),
+ _M_day4(0), _M_day5(0), _M_day6(0), _M_day7(0),
+ _M_aday1(0), _M_aday2(0), _M_aday3(0), _M_aday4(0),
+ _M_aday5(0), _M_aday6(0), _M_aday7(0), _M_month01(0),
+ _M_month02(0), _M_month03(0), _M_month04(0), _M_month05(0),
+ _M_month06(0), _M_month07(0), _M_month08(0), _M_month09(0),
+ _M_month10(0), _M_month11(0), _M_month12(0), _M_amonth01(0),
+ _M_amonth02(0), _M_amonth03(0), _M_amonth04(0),
+ _M_amonth05(0), _M_amonth06(0), _M_amonth07(0),
+ _M_amonth08(0), _M_amonth09(0), _M_amonth10(0),
+ _M_amonth11(0), _M_amonth12(0), _M_allocated(false)
{ }
~__timepunct_cache();
@@ -313,7 +313,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// For use at construction time only.
void
- _M_initialize_timepunct(__c_locale __cloc = NULL);
+ _M_initialize_timepunct(__c_locale __cloc = 0);
};
template<typename _CharT>
@@ -883,11 +883,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
bool _M_allocated;
__moneypunct_cache(size_t __refs = 0) : facet(__refs),
- _M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),
+ _M_grouping(0), _M_grouping_size(0), _M_use_grouping(false),
_M_decimal_point(_CharT()), _M_thousands_sep(_CharT()),
- _M_curr_symbol(NULL), _M_curr_symbol_size(0),
- _M_positive_sign(NULL), _M_positive_sign_size(0),
- _M_negative_sign(NULL), _M_negative_sign_size(0),
+ _M_curr_symbol(0), _M_curr_symbol_size(0),
+ _M_positive_sign(0), _M_positive_sign_size(0),
+ _M_negative_sign(0), _M_negative_sign_size(0),
_M_frac_digits(0),
_M_pos_format(money_base::pattern()),
_M_neg_format(money_base::pattern()), _M_allocated(false)
@@ -955,7 +955,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @param refs Passed to the base facet class.
*/
explicit
- moneypunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
+ moneypunct(size_t __refs = 0)
+ : facet(__refs), _M_data(0)
{ _M_initialize_moneypunct(); }
/**
@@ -983,7 +984,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*/
explicit
moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
- : facet(__refs), _M_data(NULL)
+ : facet(__refs), _M_data(0)
{ _M_initialize_moneypunct(__cloc, __s); }
/**
@@ -1271,8 +1272,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// For use at construction time only.
void
- _M_initialize_moneypunct(__c_locale __cloc = NULL,
- const char* __name = NULL);
+ _M_initialize_moneypunct(__c_locale __cloc = 0,
+ const char* __name = 0);
};
template<typename _CharT, bool _Intl>
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 48a913901e7..b5c77b9d7c0 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -44,7 +44,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const locale::facet** __caches = __loc._M_impl->_M_caches;
if (!__caches[__i])
{
- __moneypunct_cache<_CharT, _Intl>* __tmp = NULL;
+ __moneypunct_cache<_CharT, _Intl>* __tmp = 0;
__try
{
__tmp = new __moneypunct_cache<_CharT, _Intl>;
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index a137f982bed..98755dc7e57 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -31,7 +31,6 @@
#define _MOVE_H 1
#include <bits/c++config.h>
-#include <cstddef>
#include <bits/concept_check.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
index 5a66bd6b2e2..690af186f96 100644
--- a/libstdc++-v3/include/bits/random.tcc
+++ b/libstdc++-v3/include/bits/random.tcc
@@ -828,27 +828,61 @@ namespace std
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
- // XXX Must be fixed to work well for *arbitrary* __urng.max(),
- // __urng.min(), __param.b(), __param.a(). Currently works fine only
- // in the most common case __urng.max() - __urng.min() >=
- // __param.b() - __param.a(), with __urng.max() > __urng.min() >= 0.
typedef typename std::make_unsigned<typename
- _UniformRandomNumberGenerator::result_type>::type __urntype;
+ _UniformRandomNumberGenerator::result_type>::type __urngtype;
typedef typename std::make_unsigned<result_type>::type __utype;
- typedef typename std::conditional<(sizeof(__urntype) > sizeof(__utype)),
- __urntype, __utype>::type __uctype;
+ typedef typename std::conditional<(sizeof(__urngtype)
+ > sizeof(__utype)),
+ __urngtype, __utype>::type __uctype;
- result_type __ret;
+ const __uctype __urngmin = __urng.min();
+ const __uctype __urngmax = __urng.max();
+ const __uctype __urngrange = __urngmax - __urngmin;
+ const __uctype __urange
+ = __uctype(__param.b()) - __uctype(__param.a());
- const __urntype __urnmin = __urng.min();
- const __urntype __urnmax = __urng.max();
- const __urntype __urnrange = __urnmax - __urnmin;
- const __uctype __urange = __param.b() - __param.a();
- const __uctype __udenom = (__urnrange <= __urange
- ? 1 : __urnrange / (__urange + 1));
- do
- __ret = (__urntype(__urng()) - __urnmin) / __udenom;
- while (__ret > __param.b() - __param.a());
+ __uctype __ret;
+
+ if (__urngrange > __urange)
+ {
+ // downscaling
+ const __uctype __uerange = __urange + 1; // __urange can be zero
+ const __uctype __scaling = __urngrange / __uerange;
+ const __uctype __past = __uerange * __scaling;
+ do
+ __ret = __uctype(__urng()) - __urngmin;
+ while (__ret >= __past);
+ __ret /= __scaling;
+ }
+ else if (__urngrange < __urange)
+ {
+ // upscaling
+ /*
+ Note that every value in [0, urange]
+ can be written uniquely as
+
+ (urngrange + 1) * high + low
+
+ where
+
+ high in [0, urange / (urngrange + 1)]
+
+ and
+
+ low in [0, urngrange].
+ */
+ __uctype __tmp; // wraparound control
+ do
+ {
+ const __uctype __uerngrange = __urngrange + 1;
+ __tmp = (__uerngrange * operator()
+ (__urng, param_type(0, __urange / __uerngrange)));
+ __ret = __tmp + (__uctype(__urng()) - __urngmin);
+ }
+ while (__ret > __urange || __ret < __tmp);
+ }
+ else
+ __ret = __uctype(__urng()) - __urngmin;
return __ret + __param.a();
}
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
new file mode 100644
index 00000000000..f035fd4ade4
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex.h
@@ -0,0 +1,2428 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file bits/regex
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+
+/**
+ * @defgroup regex Regular Expressions
+ * A facility for performing regular expression pattern matching.
+ */
+ //@{
+
+ // [7.7] Class regex_traits
+ /**
+ * @brief Describes aspects of a regular expression.
+ *
+ * A regular expression traits class that satisfies the requirements of
+ * section [28.7].
+ *
+ * The class %regex is parameterized around a set of related types and
+ * functions used to complete the definition of its semantics. This class
+ * satisfies the requirements of such a traits class.
+ */
+ template<typename _Ch_type>
+ struct regex_traits
+ {
+ public:
+ typedef _Ch_type char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef std::locale locale_type;
+ typedef std::ctype_base::mask char_class_type;
+
+ public:
+ /**
+ * @brief Constructs a default traits object.
+ */
+ regex_traits()
+ { }
+
+ /**
+ * @brief Gives the length of a C-style string starting at @p __p.
+ *
+ * @param __p a pointer to the start of a character sequence.
+ *
+ * @returns the number of characters between @p *__p and the first
+ * default-initialized value of type @p char_type. In other words, uses
+ * the C-string algorithm for determining the length of a sequence of
+ * characters.
+ */
+ static std::size_t
+ length(const char_type* __p)
+ { return string_type::traits_type::length(__p); }
+
+ /**
+ * @brief Performs the identity translation.
+ *
+ * @param c A character to the locale-specific character set.
+ *
+ * @returns c.
+ */
+ char_type
+ translate(char_type __c) const
+ { return __c; }
+
+ /**
+ * @brief Translates a character into a case-insensitive equivalent.
+ *
+ * @param c A character to the locale-specific character set.
+ *
+ * @returns the locale-specific lower-case equivalent of c.
+ * @throws std::bad_cast if the imbued locale does not support the ctype
+ * facet.
+ */
+ char_type
+ translate_nocase(char_type __c) const
+ {
+ using std::ctype;
+ using std::use_facet;
+ return use_facet<ctype<char_type> >(_M_locale).tolower(__c);
+ }
+
+ /**
+ * @brief Gets a sort key for a character sequence.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * Returns a sort key for the character sequence designated by the
+ * iterator range [F1, F2) such that if the character sequence [G1, G2)
+ * sorts before the character sequence [H1, H2) then
+ * v.transform(G1, G2) < v.transform(H1, H2).
+ *
+ * What this really does is provide a more efficient way to compare a
+ * string to multiple other strings in locales with fancy collation
+ * rules and equivalence classes.
+ *
+ * @returns a locale-specific sort key equivalent to the input range.
+ *
+ * @throws std::bad_cast if the current locale does not have a collate
+ * facet.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ transform(_Fwd_iter __first, _Fwd_iter __last) const
+ {
+ using std::collate;
+ using std::use_facet;
+ const collate<_Ch_type>& __c(use_facet<
+ collate<_Ch_type> >(_M_locale));
+ string_type __s(__first, __last);
+ return __c.transform(__s.data(), __s.data() + __s.size());
+ }
+
+ /**
+ * @brief Gets a sort key for a character sequence, independant of case.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * Effects: if typeid(use_facet<collate<_Ch_type> >) ==
+ * typeid(collate_byname<_Ch_type>) and the form of the sort key
+ * returned by collate_byname<_Ch_type>::transform(first, last) is known
+ * and can be converted into a primary sort key then returns that key,
+ * otherwise returns an empty string.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
+ { return string_type(); }
+
+ /**
+ * @brief Gets a collation element by name.
+ *
+ * @param first beginning of the collation element name.
+ * @param last one-past-the-end of the collation element name.
+ *
+ * @returns a sequence of one or more characters that represents the
+ * collating element consisting of the character sequence designated by
+ * the iterator range [first, last). Returns an empty string if the
+ * character sequence is not a valid collating element.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
+ { return string_type(); }
+
+ /**
+ * @brief Maps one or more characters to a named character
+ * classification.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ * @param icase ignores the case of the classification name.
+ *
+ * @returns an unspecified value that represents the character
+ * classification named by the character sequence designated by the
+ * iterator range [first, last). If @p icase is true, the returned mask
+ * identifies the classification regardless of the case of the characters
+ * to be matched (for example, [[:lower:]] is the same as [[:alpha:]]),
+ * otherwise a case-dependant classification is returned. The value
+ * returned shall be independent of the case of the characters in the
+ * character sequence. If the name is not recognized then returns a value
+ * that compares equal to 0.
+ *
+ * At least the following names (or their wide-character equivalent) are
+ * supported.
+ * - d
+ * - w
+ * - s
+ * - alnum
+ * - alpha
+ * - blank
+ * - cntrl
+ * - digit
+ * - graph
+ * - lower
+ * - print
+ * - punct
+ * - space
+ * - upper
+ * - xdigit
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ char_class_type
+ lookup_classname(_Fwd_iter __first, _Fwd_iter __last,
+ bool __icase = false) const
+ { return 0; }
+
+ /**
+ * @brief Determines if @p c is a member of an identified class.
+ *
+ * @param c a character.
+ * @param f a class type (as returned from lookup_classname).
+ *
+ * @returns true if the character @p c is a member of the classification
+ * represented by @p f, false otherwise.
+ *
+ * @throws std::bad_cast if the current locale does not have a ctype
+ * facet.
+ */
+ bool
+ isctype(_Ch_type __c, char_class_type __f) const;
+
+ /**
+ * @brief Converts a digit to an int.
+ *
+ * @param ch a character representing a digit.
+ * @param radix the radix if the numeric conversion (limited to 8, 10,
+ * or 16).
+ *
+ * @returns the value represented by the digit ch in base radix if the
+ * character ch is a valid digit in base radix; otherwise returns -1.
+ */
+ int
+ value(_Ch_type __ch, int __radix) const;
+
+ /**
+ * @brief Imbues the regex_traits object with a copy of a new locale.
+ *
+ * @param loc A locale.
+ *
+ * @returns a copy of the previous locale in use by the regex_traits
+ * object.
+ *
+ * @note Calling imbue with a different locale than the one currently in
+ * use invalidates all cached data held by *this.
+ */
+ locale_type
+ imbue(locale_type __loc)
+ {
+ std::swap(_M_locale, __loc);
+ return __loc;
+ }
+
+ /**
+ * @brief Gets a copy of the current locale in use by the regex_traits
+ * object.
+ */
+ locale_type
+ getloc() const
+ { return _M_locale; }
+
+ protected:
+ locale_type _M_locale;
+ };
+
+ template<typename _Ch_type>
+ bool
+ regex_traits<_Ch_type>::
+ isctype(_Ch_type __c, char_class_type __f) const
+ {
+ using std::ctype;
+ using std::use_facet;
+ const ctype<_Ch_type>& __ctype(use_facet<
+ ctype<_Ch_type> >(_M_locale));
+
+ if (__ctype.is(__c, __f))
+ return true;
+
+ // special case of underscore in [[:w:]]
+ if (__c == __ctype.widen('_'))
+ {
+ const char __wb[] = "w";
+ char_class_type __wt = this->lookup_classname(__wb,
+ __wb + sizeof(__wb));
+ if (__f | __wt)
+ return true;
+ }
+
+ // special case of [[:space:]] in [[:blank:]]
+ if (__ctype.is(std::ctype_base::space, __c))
+ {
+ const char __bb[] = "blank";
+ char_class_type __bt = this->lookup_classname(__bb,
+ __bb + sizeof(__bb));
+ if (__f | __bt)
+ return true;
+ }
+
+ return false;
+ }
+
+ template<typename _Ch_type>
+ int
+ regex_traits<_Ch_type>::
+ value(_Ch_type __ch, int __radix) const
+ {
+ std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
+ int __v;
+ if (__radix == 8)
+ __is >> std::oct;
+ else if (__radix == 16)
+ __is >> std::hex;
+ __is >> __v;
+ return __is.fail() ? -1 : __v;
+ }
+
+ // [7.8] Class basic_regex
+ /**
+ * Objects of specializations of this class represent regular expressions
+ * constructed from sequences of character type @p _Ch_type.
+ *
+ * Storage for the regular expression is allocated and deallocated as
+ * necessary by the member functions of this class.
+ */
+ template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> >
+ class basic_regex
+ {
+ public:
+ // types:
+ typedef _Ch_type value_type;
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef typename _Rx_traits::locale_type locale_type;
+ typedef typename _Rx_traits::string_type string_type;
+
+ /**
+ * @name Constants
+ * std [28.8.1](1)
+ * @todo These should be constexpr.
+ */
+ //@{
+ static const regex_constants::syntax_option_type icase
+ = regex_constants::icase;
+ static const regex_constants::syntax_option_type nosubs
+ = regex_constants::nosubs;
+ static const regex_constants::syntax_option_type optimize
+ = regex_constants::optimize;
+ static const regex_constants::syntax_option_type collate
+ = regex_constants::collate;
+ static const regex_constants::syntax_option_type ECMAScript
+ = regex_constants::ECMAScript;
+ static const regex_constants::syntax_option_type basic
+ = regex_constants::basic;
+ static const regex_constants::syntax_option_type extended
+ = regex_constants::extended;
+ static const regex_constants::syntax_option_type awk
+ = regex_constants::awk;
+ static const regex_constants::syntax_option_type grep
+ = regex_constants::grep;
+ static const regex_constants::syntax_option_type egrep
+ = regex_constants::egrep;
+ //@}
+
+ // [7.8.2] construct/copy/destroy
+ /**
+ * Constructs a basic regular expression that does not match any
+ * character sequence.
+ */
+ basic_regex()
+ : _M_flags(regex_constants::ECMAScript),
+ _M_automaton(__regex::__compile<const _Ch_type*, _Rx_traits>(0, 0,
+ _M_traits, _M_flags))
+ { }
+
+ /**
+ * @brief Constructs a basic regular expression from the sequence
+ * [p, p + char_traits<_Ch_type>::length(p)) interpreted according to the
+ * flags in @p f.
+ *
+ * @param p A pointer to the start of a C-style null-terminated string
+ * containing a regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p p is not a valid regular expression.
+ */
+ explicit
+ basic_regex(const _Ch_type* __p,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f),
+ _M_automaton(__regex::__compile(__p, __p + _Rx_traits::length(__p),
+ _M_traits, _M_flags))
+ { }
+
+ /**
+ * @brief Constructs a basic regular expression from the sequence
+ * [p, p + len) interpreted according to the flags in @p f.
+ *
+ * @param p A pointer to the start of a string containing a regular
+ * expression.
+ * @param len The length of the string containing the regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p p is not a valid regular expression.
+ */
+ basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f)
+ : _M_flags(__f),
+ _M_automaton(__regex::__compile(__p, __p + __len, _M_traits, _M_flags))
+ { }
+
+ /**
+ * @brief Copy-constructs a basic regular expression.
+ *
+ * @param rhs A @p regex object.
+ */
+ basic_regex(const basic_regex& __rhs)
+ : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
+ _M_automaton(__rhs._M_automaton)
+ { }
+
+ /**
+ * @brief Move-constructs a basic regular expression.
+ *
+ * @param rhs A @p regex object.
+ */
+ basic_regex(const basic_regex&& __rhs)
+ : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
+ _M_automaton(std::move(__rhs._M_automaton))
+ { }
+
+ /**
+ * @brief Constructs a basic regular expression from the string
+ * @p s interpreted according to the flags in @p f.
+ *
+ * @param s A string containing a regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p s is not a valid regular expression.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc>
+ explicit
+ basic_regex(const std::basic_string<_Ch_type, _Ch_traits,
+ _Ch_alloc>& __s,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f),
+ _M_automaton(__regex::__compile(__s.begin(), __s.end(),
+ _M_traits, _M_flags))
+ { }
+
+ /**
+ * @brief Constructs a basic regular expression from the range
+ * [first, last) interpreted according to the flags in @p f.
+ *
+ * @param first The start of a range containing a valid regular
+ * expression.
+ * @param last The end of a range containing a valid regular
+ * expression.
+ * @param f The format flags of the regular expression.
+ *
+ * @throws regex_error if @p [first, last) is not a valid regular
+ * expression.
+ */
+ template<typename _InputIterator>
+ basic_regex(_InputIterator __first, _InputIterator __last,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f),
+ _M_automaton(__regex::__compile(__first, __last, _M_traits, _M_flags))
+ { }
+
+ /**
+ * @brief Constructs a basic regular expression from an initializer list.
+ *
+ * @param l The initializer list.
+ * @param f The format flags of the regular expression.
+ *
+ * @throws regex_error if @p l is not a valid regular expression.
+ */
+ basic_regex(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f),
+ _M_automaton(__regex::__compile(__l.begin(), __l.end(),
+ _M_traits, _M_flags))
+ { }
+
+ /**
+ * @brief Destroys a basic regular expression.
+ */
+ ~basic_regex()
+ { }
+
+ /**
+ * @brief Assigns one regular expression to another.
+ */
+ basic_regex&
+ operator=(const basic_regex& __rhs)
+ { return this->assign(__rhs); }
+
+ /**
+ * @brief Move-assigns one regular expression to another.
+ */
+ basic_regex&
+ operator=(basic_regex&& __rhs)
+ { return this->assign(std::move(__rhs)); }
+
+ /**
+ * @brief Replaces a regular expression with a new one constructed from
+ * a C-style null-terminated string.
+ *
+ * @param A pointer to the start of a null-terminated C-style string
+ * containing a regular expression.
+ */
+ basic_regex&
+ operator=(const _Ch_type* __p)
+ { return this->assign(__p, flags()); }
+
+ /**
+ * @brief Replaces a regular expression with a new one constructed from
+ * a string.
+ *
+ * @param A pointer to a string containing a regular expression.
+ */
+ template<typename _Ch_typeraits, typename _Allocator>
+ basic_regex&
+ operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s)
+ { return this->assign(__s, flags()); }
+
+ // [7.8.3] assign
+ /**
+ * @brief the real assignment operator.
+ *
+ * @param rhs Another regular expression object.
+ */
+ basic_regex&
+ assign(const basic_regex& __rhs)
+ {
+ basic_regex __tmp(__rhs);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief The move-assignment operator.
+ *
+ * @param rhs Another regular expression object.
+ */
+ basic_regex&
+ assign(basic_regex&& __rhs)
+ {
+ basic_regex __tmp(std::move(__rhs));
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * C-style null-terminated string containing a regular expression
+ * pattern.
+ *
+ * @param p A pointer to a C-style null-terminated string containing
+ * a regular expression pattern.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ basic_regex&
+ assign(const _Ch_type* __p,
+ flag_type __flags = regex_constants::ECMAScript)
+ { return this->assign(string_type(__p), __flags); }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * C-style string containing a regular expression pattern.
+ *
+ * @param p A pointer to a C-style string containing a
+ * regular expression pattern.
+ * @param len The length of the regular expression pattern string.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ basic_regex&
+ assign(const _Ch_type* __p, std::size_t __len, flag_type __flags)
+ { return this->assign(string_type(__p, __len), __flags); }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * string containing a regular expression pattern.
+ *
+ * @param s A string containing a regular expression pattern.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ template<typename _Ch_typeraits, typename _Allocator>
+ basic_regex&
+ assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s,
+ flag_type __f = regex_constants::ECMAScript)
+ {
+ basic_regex __tmp(__s, __f);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object.
+ *
+ * @param first The start of a range containing a valid regular
+ * expression.
+ * @param last The end of a range containing a valid regular
+ * expression.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * the object remains unchanged.
+ */
+ template<typename _InputIterator>
+ basic_regex&
+ assign(_InputIterator __first, _InputIterator __last,
+ flag_type __flags = regex_constants::ECMAScript)
+ { return this->assign(string_type(__first, __last), __flags); }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object.
+ *
+ * @param l An initializer list representing a regular expression.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if @p l does not contain a valid regular
+ * expression pattern interpreted according to @p flags. If regex_error
+ * is thrown, the object remains unchanged.
+ */
+ basic_regex&
+ assign(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ { return this->assign(__l.begin(), __l.end(), __f); }
+
+ // [7.8.4] const operations
+ /**
+ * @brief Gets the number of marked subexpressions within the regular
+ * expression.
+ */
+ unsigned int
+ mark_count() const
+ { return _M_automaton->_M_sub_count() - 1; }
+
+ /**
+ * @brief Gets the flags used to construct the regular expression
+ * or in the last call to assign().
+ */
+ flag_type
+ flags() const
+ { return _M_flags; }
+
+ // [7.8.5] locale
+ /**
+ * @brief Imbues the regular expression object with the given locale.
+ *
+ * @param loc A locale.
+ */
+ locale_type
+ imbue(locale_type __loc)
+ { return _M_traits.imbue(__loc); }
+
+ /**
+ * @brief Gets the locale currently imbued in the regular expression
+ * object.
+ */
+ locale_type
+ getloc() const
+ { return _M_traits.getloc(); }
+
+ // [7.8.6] swap
+ /**
+ * @brief Swaps the contents of two regular expression objects.
+ *
+ * @param rhs Another regular expression object.
+ */
+ void
+ swap(basic_regex& __rhs)
+ {
+ std::swap(_M_flags, __rhs._M_flags);
+ std::swap(_M_traits, __rhs._M_traits);
+ std::swap(_M_automaton, __rhs._M_automaton);
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ _M_dot(std::ostream& __ostr)
+ { _M_automaton->_M_dot(__ostr); }
+#endif
+
+ const __regex::_AutomatonPtr&
+ _M_get_automaton() const
+ { return _M_automaton; }
+
+ protected:
+ flag_type _M_flags;
+ _Rx_traits _M_traits;
+ __regex::_AutomatonPtr _M_automaton;
+ };
+
+ /** @brief Standard regular expressions. */
+ typedef basic_regex<char> regex;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Standard wide-character regular expressions. */
+ typedef basic_regex<wchar_t> wregex;
+#endif
+
+
+ // [7.8.6] basic_regex swap
+ /**
+ * @brief Swaps the contents of two regular expression objects.
+ * @param lhs First regular expression.
+ * @param rhs Second regular expression.
+ */
+ template<typename _Ch_type, typename _Rx_traits>
+ inline void
+ swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
+ basic_regex<_Ch_type, _Rx_traits>& __rhs)
+ { __lhs.swap(__rhs); }
+
+
+ // [7.9] Class template sub_match
+ /**
+ * A sequence of characters matched by a particular marked sub-expression.
+ *
+ * An object of this class is essentially a pair of iterators marking a
+ * matched subexpression within a regular expression pattern match. Such
+ * objects can be converted to and compared with std::basic_string objects
+ * of a similar base character type as the pattern matched by the regular
+ * expression.
+ *
+ * The iterators that make up the pair are the usual half-open interval
+ * referencing the actual original pattern matched.
+ */
+ template<typename _BiIter>
+ class sub_match : public std::pair<_BiIter, _BiIter>
+ {
+ public:
+ typedef typename iterator_traits<_BiIter>::value_type value_type;
+ typedef typename iterator_traits<_BiIter>::difference_type
+ difference_type;
+ typedef _BiIter iterator;
+ typedef std::basic_string<value_type> string_type;
+
+ public:
+ bool matched;
+
+ /**
+ * Gets the length of the matching sequence.
+ */
+ difference_type
+ length() const
+ { return this->matched ? std::distance(this->first, this->second) : 0; }
+
+ /**
+ * @brief Gets the matching sequence as a string.
+ *
+ * @returns the matching sequence as a string.
+ *
+ * This is the implicit conversion operator. It is identical to the
+ * str() member function except that it will want to pop up in
+ * unexpected places and cause a great deal of confusion and cursing
+ * from the unwary.
+ */
+ operator string_type() const
+ {
+ return this->matched
+ ? string_type(this->first, this->second)
+ : string_type();
+ }
+
+ /**
+ * @brief Gets the matching sequence as a string.
+ *
+ * @returns the matching sequence as a string.
+ */
+ string_type
+ str() const
+ {
+ return this->matched
+ ? string_type(this->first, this->second)
+ : string_type();
+ }
+
+ /**
+ * @brief Compares this and another matched sequence.
+ *
+ * @param s Another matched sequence to compare to this one.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const sub_match& __s) const
+ { return this->str().compare(__s.str()); }
+
+ /**
+ * @brief Compares this sub_match to a string.
+ *
+ * @param s A string to compare to this sub_match.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const string_type& __s) const
+ { return this->str().compare(__s); }
+
+ /**
+ * @brief Compares this sub_match to a C-style string.
+ *
+ * @param s A C-style string to compare to this sub_match.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const value_type* __s) const
+ { return this->str().compare(__s); }
+ };
+
+
+ /** @brief Standard regex submatch over a C-style null-terminated string. */
+ typedef sub_match<const char*> csub_match;
+ /** @brief Standard regex submatch over a standard string. */
+ typedef sub_match<string::const_iterator> ssub_match;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Regex submatch over a C-style null-terminated wide string. */
+ typedef sub_match<const wchar_t*> wcsub_match;
+ /** @brief Regex submatch over a standard wide string. */
+ typedef sub_match<wstring::const_iterator> wssub_match;
+#endif
+
+ // [7.9.2] sub_match non-member operators
+
+ /**
+ * @brief Tests the equivalence of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator==(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ /**
+ * @brief Tests the inequivalence of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator!=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) != 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator<(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator<=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator>=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator>(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ /**
+ * @brief Tests the equivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator==(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator!=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator<(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator>(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator>=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator<=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Tests the equivalence of a C string and a regular expression
+ * submatch.
+ * @param lhs A C string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of an iterator value and a regular
+ * expression submatch.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A pointer to a string?
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A pointer to a string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Tests the equivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Inserts a matched string into an output stream.
+ *
+ * @param os The output stream.
+ * @param m A submatch string.
+ *
+ * @returns the output stream with the submatch string inserted.
+ */
+ template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter>
+ inline
+ basic_ostream<_Ch_type, _Ch_traits>&
+ operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
+ const sub_match<_Bi_iter>& __m)
+ { return __os << __m.str(); }
+
+ // [7.10] Class template match_results
+
+ /*
+ * Special sub_match object representing an unmatched sub-expression.
+ */
+ template<typename _Bi_iter>
+ inline const sub_match<_Bi_iter>&
+ __unmatched_sub()
+ {
+ static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
+ return __unmatched;
+ }
+
+ /**
+ * @brief The results of a match or search operation.
+ *
+ * A collection of character sequences representing the result of a regular
+ * expression match. Storage for the collection is allocated and freed as
+ * necessary by the member functions of class template match_results.
+ *
+ * This class satisfies the Sequence requirements, with the exception that
+ * only the operations defined for a const-qualified Sequence are supported.
+ *
+ * The sub_match object stored at index 0 represents sub-expression 0, i.e.
+ * the whole match. In this case the %sub_match member matched is always true.
+ * The sub_match object stored at index n denotes what matched the marked
+ * sub-expression n within the matched expression. If the sub-expression n
+ * participated in a regular expression match then the %sub_match member
+ * matched evaluates to true, and members first and second denote the range
+ * of characters [first, second) which formed that match. Otherwise matched
+ * is false, and members first and second point to the end of the sequence
+ * that was searched.
+ *
+ * @nosubgrouping
+ */
+ template<typename _Bi_iter,
+ typename _Allocator = allocator<sub_match<_Bi_iter> > >
+ class match_results
+ : private std::vector<std::sub_match<_Bi_iter>, _Allocator>
+ {
+ private:
+ /*
+ * The vector base is empty if this does not represent a successful match.
+ * Otherwise it contains n+3 elements where n is the number of marked
+ * sub-expressions:
+ * [0] entire match
+ * [1] 1st marked subexpression
+ * ...
+ * [n] nth marked subexpression
+ * [n+1] prefix
+ * [n+2] suffix
+ */
+ typedef std::vector<std::sub_match<_Bi_iter>, _Allocator>
+ _Base_type;
+
+ public:
+ /**
+ * @name 10.? Public Types
+ */
+ //@{
+ typedef sub_match<_Bi_iter> value_type;
+ typedef const value_type& const_reference;
+ typedef const_reference reference;
+ typedef typename _Base_type::const_iterator const_iterator;
+ typedef const_iterator iterator;
+ typedef typename std::iterator_traits<_Bi_iter>::difference_type
+ difference_type;
+ /* TODO: needs allocator_traits */
+ typedef typename _Allocator::size_type size_type;
+ typedef _Allocator allocator_type;
+ typedef typename std::iterator_traits<_Bi_iter>::value_type
+ char_type;
+ typedef std::basic_string<char_type> string_type;
+ //@}
+
+ public:
+ /**
+ * @name 10.1 Construction, Copying, and Destruction
+ */
+ //@{
+
+ /**
+ * @brief Constructs a default %match_results container.
+ * @post size() returns 0 and str() returns an empty string.
+ */
+ explicit
+ match_results(const _Allocator& __a = _Allocator())
+ : _Base_type(__a)
+ { }
+
+ /**
+ * @brief Copy constructs a %match_results.
+ */
+ match_results(const match_results& __rhs)
+ : _Base_type(__rhs)
+ { }
+
+ /**
+ * @brief Assigns rhs to *this.
+ */
+ match_results&
+ operator=(const match_results __rhs)
+ {
+ match_results(__rhs).swap(*this);
+ return *this;
+ }
+
+ /**
+ * @brief Destroys a %match_results object.
+ */
+ ~match_results()
+ { }
+
+ //@}
+
+ /**
+ * @name 10.2 Size
+ */
+ //@{
+
+ /**
+ * @brief Gets the number of matches and submatches.
+ *
+ * The number of matches for a given regular expression will be either 0
+ * if there was no match or mark_count() + 1 if a match was successful.
+ * Some matches may be empty.
+ *
+ * @returns the number of matches found.
+ */
+ size_type
+ size() const
+ {
+ size_type __size = _Base_type::size();
+ return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
+ }
+
+ size_type
+ max_size() const
+ { return _Base_type::max_size(); }
+
+ /**
+ * @brief Indicates if the %match_results contains no results.
+ * @retval true The %match_results object is empty.
+ * @retval false The %match_results object is not empty.
+ */
+ bool
+ empty() const
+ { return _Base_type::empty(); }
+
+ //@}
+
+ /**
+ * @name 10.3 Element Access
+ */
+ //@{
+
+ /**
+ * @brief Gets the length of the indicated submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function returns the length of the indicated submatch, or the
+ * length of the entire match if @p sub is zero (the default).
+ */
+ difference_type
+ length(size_type __sub = 0) const
+ { return this[__sub].length(); }
+
+ /**
+ * @brief Gets the offset of the beginning of the indicated submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function returns the offset from the beginning of the target
+ * sequence to the beginning of the submatch, unless the value of @p sub
+ * is zero (the default), in which case this function returns the offset
+ * from the beginning of the target sequence to the beginning of the
+ * match.
+ *
+ * Returns -1 if @p sub is out of range.
+ */
+ difference_type
+ position(size_type __sub = 0) const
+ {
+ return __sub < size() ? std::distance(this->prefix().first,
+ (*this)[__sub].first) : -1;
+ }
+
+ /**
+ * @brief Gets the match or submatch converted to a string type.
+ * @param sub indicates the submatch.
+ *
+ * This function gets the submatch (or match, if @p sub is zero) extracted
+ * from the target range and converted to the associated string type.
+ */
+ string_type
+ str(size_type __sub = 0) const
+ { return (*this)[__sub].str(); }
+
+ /**
+ * @brief Gets a %sub_match reference for the match or submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function gets a reference to the indicated submatch, or the entire
+ * match if @p sub is zero.
+ *
+ * If @p sub >= size() then this function returns a %sub_match with a
+ * special value indicating no submatch.
+ */
+ const_reference
+ operator[](size_type __sub) const
+ {
+ return __sub < size()
+ ? _Base_type::operator[](__sub)
+ : __unmatched_sub<_Bi_iter>();
+ }
+
+ /**
+ * @brief Gets a %sub_match representing the match prefix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the start of the target range and the
+ * start of the match.
+ */
+ const_reference
+ prefix() const
+ {
+ return !empty()
+ ? _Base_type::operator[](_Base_type::size() - 2)
+ : __unmatched_sub<_Bi_iter>();
+ }
+
+ /**
+ * @brief Gets a %sub_match representing the match suffix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the end of the match and the end of
+ * the target range.
+ */
+ const_reference
+ suffix() const
+ {
+ return !empty()
+ ? _Base_type::operator[](_Base_type::size() - 1)
+ : __unmatched_sub<_Bi_iter>();
+ }
+
+ /**
+ * @brief Gets an iterator to the start of the %sub_match collection.
+ */
+ const_iterator
+ begin() const
+ { return _Base_type::begin(); }
+
+ /**
+ * @brief Gets an iterator to the start of the %sub_match collection.
+ */
+ const_iterator
+ cbegin() const
+ { return _Base_type::cbegin(); }
+
+ /**
+ * @brief Gets an iterator to one-past-the-end of the collection.
+ */
+ const_iterator
+ end() const
+ {
+ return !empty()
+ ? _Base_type::end() - 2
+ : _Base_type::end();
+ }
+
+ /**
+ * @brief Gets an iterator to one-past-the-end of the collection.
+ */
+ const_iterator
+ cend() const
+ {
+ return !empty()
+ ? _Base_type::cend() - 2
+ : _Base_type::cend();
+ }
+
+ //@}
+
+ /**
+ * @name 10.4 Formatting
+ *
+ * These functions perform formatted substitution of the matched character
+ * sequences into their target. The format specifiers and escape sequences
+ * accepted by these functions are determined by their @p flags parameter
+ * as documented above.
+ */
+ //@{
+
+ /**
+ * @todo Implement this function.
+ */
+ template<typename _Out_iter>
+ _Out_iter
+ format(_Out_iter __out, const string_type& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::format_default) const
+ { return __out; }
+
+ /**
+ * @todo Implement this function.
+ */
+ string_type
+ format(const string_type& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::format_default) const;
+
+ //@}
+
+ /**
+ * @name 10.5 Allocator
+ */
+ //@{
+
+ /**
+ * @brief Gets a copy of the allocator.
+ */
+ allocator_type
+ get_allocator() const
+ { return _Base_type::get_allocator(); }
+
+ //@}
+
+ /**
+ * @name 10.6 Swap
+ */
+ //@{
+
+ /**
+ * @brief Swaps the contents of two match_results.
+ */
+ void
+ swap(match_results& __that)
+ { _Base_type::swap(__that); }
+ //@}
+
+ private:
+ friend class __regex::_SpecializedResults<_Bi_iter, _Allocator>;
+ };
+
+ typedef match_results<const char*> cmatch;
+ typedef match_results<string::const_iterator> smatch;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef match_results<const wchar_t*> wcmatch;
+ typedef match_results<wstring::const_iterator> wsmatch;
+#endif
+
+ // match_results comparisons
+ /**
+ * @brief Compares two match_results for equality.
+ * @returns true if the two objects refer to the same match,
+ * false otherwise.
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator>
+ inline bool
+ operator==(const match_results<_Bi_iter, _Allocator>& __m1,
+ const match_results<_Bi_iter, _Allocator>& __m2);
+
+ /**
+ * @brief Compares two match_results for inequality.
+ * @returns true if the two objects do not refer to the same match,
+ * false otherwise.
+ */
+ template<typename _Bi_iter, class _Allocator>
+ inline bool
+ operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
+ const match_results<_Bi_iter, _Allocator>& __m2)
+ { return !(__m1 == __m2); }
+
+ // [7.10.6] match_results swap
+ /**
+ * @brief Swaps two match results.
+ * @param lhs A match result.
+ * @param rhs A match result.
+ *
+ * The contents of the two match_results objects are swapped.
+ */
+ template<typename _Bi_iter, typename _Allocator>
+ inline void
+ swap(match_results<_Bi_iter, _Allocator>& __lhs,
+ match_results<_Bi_iter, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ // [7.11.2] Function template regex_match
+ /**
+ * @name Matching, Searching, and Replacing
+ */
+ //@{
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and all of the character sequence [first, last).
+ *
+ * @param s Start of the character sequence to match.
+ * @param e One-past-the-end of the character sequence to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator,
+ typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_match(_Bi_iter __s,
+ _Bi_iter __e,
+ match_results<_Bi_iter, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ __regex::_AutomatonPtr __a = __re._M_get_automaton();
+ __regex::_Automaton::_SizeT __sz = __a->_M_sub_count();
+ __regex::_SpecializedCursor<_Bi_iter> __cs(__s, __e);
+ __regex::_SpecializedResults<_Bi_iter, _Allocator> __r(__sz, __cs, __m);
+ __regex::_Grep_matcher __matcher(__cs, __r, __a, __flags);
+ return __m[0].matched;
+ }
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and all of the character sequence [first, last).
+ *
+ * @param first Beginning of the character sequence to match.
+ * @param last One-past-the-end of the character sequence to match.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_match(_Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ match_results<_Bi_iter> __what;
+ return regex_match(__first, __last, __what, __re, __flags);
+ }
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and a C-style null-terminated string.
+ *
+ * @param s The C-style null-terminated string to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param f Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
+ inline bool
+ regex_match(const _Ch_type* __s,
+ match_results<const _Ch_type*, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and a string.
+ *
+ * @param s The string to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc,
+ typename _Allocator, typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ match_results<typename basic_string<_Ch_type,
+ _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); }
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and a C-style null-terminated string.
+ *
+ * @param s The C-style null-terminated string to match.
+ * @param re The regular expression.
+ * @param f Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, class _Rx_traits>
+ inline bool
+ regex_match(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and a string.
+ *
+ * @param s [IN] The string to match.
+ * @param re [IN] The regular expression.
+ * @param flags [IN] Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Str_allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_match(__s.begin(), __s.end(), __re, __flags); }
+
+ // [7.11.3] Function template regex_search
+ /**
+ * Searches for a regular expression within a range.
+ * @param first [IN] The start of the string to search.
+ * @param last [IN] One-past-the-end of the string to search.
+ * @param m [OUT] The match results.
+ * @param re [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ *
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(_Bi_iter __first, _Bi_iter __last,
+ match_results<_Bi_iter, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return false; }
+
+ /**
+ * Searches for a regular expression within a range.
+ * @param first [IN] The start of the string to search.
+ * @param last [IN] One-past-the-end of the string to search.
+ * @param re [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(_Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ match_results<_Bi_iter> __what;
+ return regex_search(__first, __last, __what, __re, __flags);
+ }
+
+ /**
+ * @brief Searches for a regular expression within a C-string.
+ * @param s [IN] A C-string to search for the regex.
+ * @param m [OUT] The set of regex matches.
+ * @param e [IN] The regex to search for in @p s.
+ * @param f [IN] The search flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, class _Allocator, class _Rx_traits>
+ inline bool
+ regex_search(const _Ch_type* __s,
+ match_results<const _Ch_type*, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
+
+ /**
+ * @brief Searches for a regular expression within a C-string.
+ * @param s [IN] The C-string to search.
+ * @param e [IN] The regular expression to search for.
+ * @param f [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
+
+ /**
+ * @brief Searches for a regular expression within a string.
+ * @param s [IN] The string to search.
+ * @param e [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _String_allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(const basic_string<_Ch_type, _Ch_traits,
+ _String_allocator>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_search(__s.begin(), __s.end(), __e, __flags); }
+
+ /**
+ * @brief Searches for a regular expression within a string.
+ * @param s [IN] A C++ string to search for the regex.
+ * @param m [OUT] The set of regex matches.
+ * @param e [IN] The regex to search for in @p s.
+ * @param f [IN] The search flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc,
+ typename _Allocator, typename _Ch_type,
+ typename _Rx_traits>
+ inline bool
+ regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ match_results<typename basic_string<_Ch_type,
+ _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
+
+ // std [28.11.4] Function template regex_replace
+ /**
+ * @doctodo
+ * @param out
+ * @param first
+ * @param last
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns out
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Out_iter, typename _Bi_iter,
+ typename _Rx_traits, typename _Ch_type>
+ inline _Out_iter
+ regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return __out; }
+
+ /**
+ * @doctodo
+ * @param s
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns a copy of string @p s with replacements.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Rx_traits, typename _Ch_type>
+ inline basic_string<_Ch_type>
+ regex_replace(const basic_string<_Ch_type>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ std::string __result;
+ regex_replace(std::back_inserter(__result),
+ __s.begin(), __s.end(), __e, __fmt, __flags);
+ return __result;
+ }
+
+ //@}
+
+ // std [28.12] Class template regex_iterator
+ /**
+ * An iterator adaptor that will provide repeated calls of regex_search over
+ * a range until no more matches remain.
+ */
+ template<typename _Bi_iter,
+ typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
+ typename _Rx_traits = regex_traits<_Ch_type> >
+ class regex_iterator
+ {
+ public:
+ typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
+ typedef match_results<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ public:
+ /**
+ * @brief Provides a singular iterator, useful for indicating
+ * one-past-the-end of a range.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator();
+
+ /**
+ * Constructs a %regex_iterator...
+ * @param a [IN] The start of a text range to search.
+ * @param b [IN] One-past-the-end of the text range to search.
+ * @param re [IN] The regular expression to match.
+ * @param m [IN] Policy flags for match rules.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Copy constructs a %regex_iterator.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator&
+ operator=(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ bool
+ operator==(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ bool
+ operator!=(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ const value_type&
+ operator*();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ const value_type*
+ operator->();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator&
+ operator++();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator
+ operator++(int);
+
+ private:
+ // these members are shown for exposition only:
+ _Bi_iter begin;
+ _Bi_iter end;
+ const regex_type* pregex;
+ regex_constants::match_flag_type flags;
+ match_results<_Bi_iter> match;
+ };
+
+ typedef regex_iterator<const char*> cregex_iterator;
+ typedef regex_iterator<string::const_iterator> sregex_iterator;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef regex_iterator<const wchar_t*> wcregex_iterator;
+ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
+#endif
+
+ // [7.12.2] Class template regex_token_iterator
+ /**
+ * Iterates over submatches in a range (or @a splits a text string).
+ *
+ * The purpose of this iterator is to enumerate all, or all specified,
+ * matches of a regular expression within a text range. The dereferenced
+ * value of an iterator of this class is a std::sub_match object.
+ */
+ template<typename _Bi_iter,
+ typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
+ typename _Rx_traits = regex_traits<_Ch_type> >
+ class regex_token_iterator
+ {
+ public:
+ typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
+ typedef sub_match<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ public:
+ /**
+ * @brief Default constructs a %regex_token_iterator.
+ * @todo Implement this function.
+ *
+ * A default-constructed %regex_token_iterator is a singular iterator
+ * that will compare equal to the one-past-the-end value for any
+ * iterator of the same type.
+ */
+ regex_token_iterator();
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatch [IN] Which submatch to return. There are some
+ * special values for this parameter:
+ * - -1 each enumerated subexpression does NOT
+ * match the regular expression (aka field
+ * splitting)
+ * - 0 the entire string matching the
+ * subexpression is returned for each match
+ * within the text.
+ * - >0 enumerates only the indicated
+ * subexpression from a match within the text.
+ * @param m [IN] Policy flags for match rules.
+ *
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
+ int __submatch = 0,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatches [IN] A list of subexpressions to return for each
+ * regular expression match within the text.
+ * @param m [IN] Policy flags for match rules.
+ *
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
+ const regex_type& __re,
+ const std::vector<int>& __submatches,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatches [IN] A list of subexpressions to return for each
+ * regular expression match within the text.
+ * @param m [IN] Policy flags for match rules.
+
+ * @todo Implement this function.
+ * @doctodo
+ */
+ template<std::size_t _Nm>
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
+ const regex_type& __re,
+ const int (&__submatches)[_Nm],
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * @brief Copy constructs a %regex_token_iterator.
+ * @param rhs [IN] A %regex_token_iterator to copy.
+ * @todo Implement this function.
+ */
+ regex_token_iterator(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Assigns a %regex_token_iterator to another.
+ * @param rhs [IN] A %regex_token_iterator to copy.
+ * @todo Implement this function.
+ */
+ regex_token_iterator&
+ operator=(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Compares a %regex_token_iterator to another for equality.
+ * @todo Implement this function.
+ */
+ bool
+ operator==(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Compares a %regex_token_iterator to another for inequality.
+ * @todo Implement this function.
+ */
+ bool
+ operator!=(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Dereferences a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ const value_type&
+ operator*();
+
+ /**
+ * @brief Selects a %regex_token_iterator member.
+ * @todo Implement this function.
+ */
+ const value_type*
+ operator->();
+
+ /**
+ * @brief Increments a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ regex_token_iterator&
+ operator++();
+
+ /**
+ * @brief Postincrements a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ regex_token_iterator
+ operator++(int);
+
+ private: // data members for exposition only:
+ typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
+
+ position_iterator __position;
+ const value_type* __result;
+ value_type __suffix;
+ std::size_t __n;
+ std::vector<int> __subs;
+ };
+
+ /** @brief Token iterator for C-style NULL-terminated strings. */
+ typedef regex_token_iterator<const char*> cregex_token_iterator;
+ /** @brief Token iterator for standard strings. */
+ typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Token iterator for C-style NULL-terminated wide strings. */
+ typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+ /** @brief Token iterator for standard wide-character strings. */
+ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
+#endif
+
+ //@} // group regex
+
+}
+
diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
new file mode 100644
index 00000000000..0bc362dc77e
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -0,0 +1,1115 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file bits/regex_parser.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+namespace __regex
+{
+ struct _Scanner_base
+ {
+ // FIXME: replace these constanst with constexpr
+ typedef unsigned int _StateT;
+
+ static const _StateT _S_state_at_start = 1 << 0;
+ static const _StateT _S_state_in_brace = 1 << 2;
+ static const _StateT _S_state_in_bracket = 1 << 3;
+ };
+
+ //
+ // @brief Scans an input range for regex tokens.
+ //
+ // The %_Scanner class interprets the regular expression pattern in the input
+ // range passed to its constructor as a sequence of parse tokens passed to
+ // the regular expression compiler. The sequence of tokens provided depends
+ // on the flag settings passed to the constructor: different regular
+ // expression gramars will interpret the same input pattern in syntactically
+ // different ways.
+ //
+ template<typename _InputIterator>
+ class _Scanner: public _Scanner_base
+ {
+ public:
+ typedef _InputIterator _IteratorT;
+ typedef typename std::iterator_traits<_IteratorT>::value_type _CharT;
+ typedef std::basic_string<_CharT> _StringT;
+ typedef regex_constants::syntax_option_type _FlagT;
+ typedef const std::ctype<_CharT> _CtypeT;
+
+ // Token types returned from the scanner.
+ enum _TokenT
+ {
+ _S_token_anychar,
+ _S_token_backref,
+ _S_token_bracket_begin,
+ _S_token_bracket_end,
+ _S_token_inverse_class,
+ _S_token_char_class_name,
+ _S_token_closure0,
+ _S_token_closure1,
+ _S_token_collelem_multi,
+ _S_token_collelem_single,
+ _S_token_collsymbol,
+ _S_token_comma,
+ _S_token_dash,
+ _S_token_dup_count,
+ _S_token_eof,
+ _S_token_equiv_class_name,
+ _S_token_interval_begin,
+ _S_token_interval_end,
+ _S_token_line_begin,
+ _S_token_line_end,
+ _S_token_opt,
+ _S_token_or,
+ _S_token_ord_char,
+ _S_token_quoted_char,
+ _S_token_subexpr_begin,
+ _S_token_subexpr_end,
+ _S_token_word_begin,
+ _S_token_word_end,
+ _S_token_unknown
+ };
+
+ public:
+ _Scanner(_IteratorT __begin, _IteratorT __end, _FlagT __flags,
+ std::locale __loc)
+ : _M_current(__begin) , _M_end(__end) , _M_flags(__flags),
+ _M_ctype(std::use_facet<_CtypeT>(__loc)), _M_state(_S_state_at_start)
+ { _M_advance(); }
+
+ void
+ _M_advance();
+
+ _TokenT
+ _M_token() const
+ { return _M_curToken; }
+
+ const _StringT&
+ _M_value() const
+ { return _M_curValue; }
+
+#ifdef _GLIBCXX_DEBUG
+ std::ostream&
+ _M_print(std::ostream&);
+#endif
+
+ private:
+ void
+ _M_eat_escape();
+
+ void
+ _M_scan_in_brace();
+
+ void
+ _M_scan_in_bracket();
+
+ void
+ _M_eat_charclass();
+
+ void
+ _M_eat_equivclass();
+
+ void
+ _M_eat_collsymbol();
+
+ private:
+ _IteratorT _M_current;
+ _IteratorT _M_end;
+ _FlagT _M_flags;
+ _CtypeT& _M_ctype;
+ _TokenT _M_curToken;
+ _StringT _M_curValue;
+ _StateT _M_state;
+ };
+
+ template<typename _InputIterator>
+ void
+ _Scanner<_InputIterator>::
+ _M_advance()
+ {
+ if (_M_current == _M_end)
+ {
+ _M_curToken = _S_token_eof;
+ return;
+ }
+
+ _CharT __c = *_M_current;
+ if (_M_state & _S_state_in_bracket)
+ {
+ _M_scan_in_bracket();
+ return;
+ }
+ if (_M_state & _S_state_in_brace)
+ {
+ _M_scan_in_brace();
+ return;
+ }
+ else if (_M_state & _S_state_at_start && __c == _M_ctype.widen('^'))
+ {
+ _M_curToken = _S_token_line_begin;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('$'))
+ {
+ _M_curToken = _S_token_line_end;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('.'))
+ {
+ _M_curToken = _S_token_anychar;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('*'))
+ {
+ _M_curToken = _S_token_closure0;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('+'))
+ {
+ _M_curToken = _S_token_closure1;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('|'))
+ {
+ _M_curToken = _S_token_or;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('['))
+ {
+ _M_curToken = _S_token_bracket_begin;
+ _M_state |= (_S_state_in_bracket | _S_state_at_start);
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('\\'))
+ {
+ _M_eat_escape();
+ return;
+ }
+ else if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+ {
+ if (__c == _M_ctype.widen('('))
+ {
+ _M_curToken = _S_token_subexpr_begin;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen(')'))
+ {
+ _M_curToken = _S_token_subexpr_end;
+ ++_M_current;
+ return;
+ }
+ else if (__c == _M_ctype.widen('{'))
+ {
+ _M_curToken = _S_token_interval_begin;
+ _M_state |= _S_state_in_brace;
+ ++_M_current;
+ return;
+ }
+ }
+
+ _M_curToken = _S_token_ord_char;
+ _M_curValue.assign(1, __c);
+ ++_M_current;
+ }
+
+
+ template<typename _InputIterator>
+ void
+ _Scanner<_InputIterator>::
+ _M_scan_in_brace()
+ {
+ if (_M_ctype.is(_CtypeT::digit, *_M_current))
+ {
+ _M_curToken = _S_token_dup_count;
+ _M_curValue.assign(1, *_M_current);
+ ++_M_current;
+ while (_M_current != _M_end
+ && _M_ctype.is(_CtypeT::digit, *_M_current))
+ {
+ _M_curValue += *_M_current;
+ ++_M_current;
+ }
+ return;
+ }
+ else if (*_M_current == _M_ctype.widen(','))
+ {
+ _M_curToken = _S_token_comma;
+ ++_M_current;
+ return;
+ }
+ if (_M_flags & (regex_constants::basic | regex_constants::grep))
+ {
+ if (*_M_current == _M_ctype.widen('\\'))
+ _M_eat_escape();
+ }
+ else
+ {
+ if (*_M_current == _M_ctype.widen('}'))
+ {
+ _M_curToken = _S_token_interval_end;
+ _M_state &= ~_S_state_in_brace;
+ ++_M_current;
+ return;
+ }
+ }
+ }
+
+ template<typename _InputIterator>
+ void
+ _Scanner<_InputIterator>::
+ _M_scan_in_bracket()
+ {
+ if (_M_state & _S_state_at_start && *_M_current == _M_ctype.widen('^'))
+ {
+ _M_curToken = _S_token_inverse_class;
+ _M_state &= ~_S_state_at_start;
+ ++_M_current;
+ return;
+ }
+ else if (*_M_current == _M_ctype.widen('['))
+ {
+ ++_M_current;
+ if (_M_current == _M_end)
+ {
+ _M_curToken = _S_token_eof;
+ return;
+ }
+
+ if (*_M_current == _M_ctype.widen('.'))
+ {
+ _M_curToken = _S_token_collsymbol;
+ _M_eat_collsymbol();
+ return;
+ }
+ else if (*_M_current == _M_ctype.widen(':'))
+ {
+ _M_curToken = _S_token_char_class_name;
+ _M_eat_charclass();
+ return;
+ }
+ else if (*_M_current == _M_ctype.widen('='))
+ {
+ _M_curToken = _S_token_equiv_class_name;
+ _M_eat_equivclass();
+ return;
+ }
+ }
+ else if (*_M_current == _M_ctype.widen('-'))
+ {
+ _M_curToken = _S_token_dash;
+ ++_M_current;
+ return;
+ }
+ else if (*_M_current == _M_ctype.widen(']'))
+ {
+ if (!(_M_flags & regex_constants::ECMAScript)
+ || !(_M_state & _S_state_at_start))
+ {
+ // special case: only if _not_ chr first after
+ // '[' or '[^' and if not ECMAscript
+ _M_curToken = _S_token_bracket_end;
+ ++_M_current;
+ return;
+ }
+ }
+ _M_curToken = _S_token_collelem_single;
+ _M_curValue.assign(1, *_M_current);
+ ++_M_current;
+ }
+
+ template<typename _InputIterator>
+ void
+ _Scanner<_InputIterator>::
+ _M_eat_escape()
+ {
+ ++_M_current;
+ if (_M_current == _M_end)
+ {
+ _M_curToken = _S_token_eof;
+ return;
+ }
+ _CharT __c = *_M_current;
+ ++_M_current;
+
+ if (__c == _M_ctype.widen('('))
+ {
+ if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+ {
+ _M_curToken = _S_token_ord_char;
+ _M_curValue.assign(1, __c);
+ }
+ else
+ _M_curToken = _S_token_subexpr_begin;
+ }
+ else if (__c == _M_ctype.widen(')'))
+ {
+ if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+ {
+ _M_curToken = _S_token_ord_char;
+ _M_curValue.assign(1, __c);
+ }
+ else
+ _M_curToken = _S_token_subexpr_end;
+ }
+ else if (__c == _M_ctype.widen('{'))
+ {
+ if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+ {
+ _M_curToken = _S_token_ord_char;
+ _M_curValue.assign(1, __c);
+ }
+ else
+ {
+ _M_curToken = _S_token_interval_begin;
+ _M_state |= _S_state_in_brace;
+ }
+ }
+ else if (__c == _M_ctype.widen('}'))
+ {
+ if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+ {
+ _M_curToken = _S_token_ord_char;
+ _M_curValue.assign(1, __c);
+ }
+ else
+ {
+ if (!(_M_state && _S_state_in_brace))
+ __throw_regex_error(regex_constants::error_badbrace);
+ _M_state &= ~_S_state_in_brace;
+ _M_curToken = _S_token_interval_end;
+ }
+ }
+ else if (__c == _M_ctype.widen('x'))
+ {
+ ++_M_current;
+ if (_M_current == _M_end)
+ {
+ _M_curToken = _S_token_eof;
+ return;
+ }
+ if (_M_ctype.is(_CtypeT::digit, *_M_current))
+ {
+ _M_curValue.assign(1, *_M_current);
+ ++_M_current;
+ if (_M_current == _M_end)
+ {
+ _M_curToken = _S_token_eof;
+ return;
+ }
+ if (_M_ctype.is(_CtypeT::digit, *_M_current))
+ {
+ _M_curValue += *_M_current;
+ ++_M_current;
+ return;
+ }
+ }
+ }
+ else if (__c == _M_ctype.widen('^')
+ || __c == _M_ctype.widen('.')
+ || __c == _M_ctype.widen('*')
+ || __c == _M_ctype.widen('$')
+ || __c == _M_ctype.widen('\\'))
+ {
+ _M_curToken = _S_token_ord_char;
+ _M_curValue.assign(1, __c);
+ }
+ else if (_M_ctype.is(_CtypeT::digit, __c))
+ {
+ _M_curToken = _S_token_backref;
+ _M_curValue.assign(1, __c);
+ }
+ else
+ __throw_regex_error(regex_constants::error_escape);
+ }
+
+
+ // Eats a character class or throwns an exception.
+ // current point to ':' delimiter on entry, char after ']' on return
+ template<typename _InputIterator>
+ void
+ _Scanner<_InputIterator>::
+ _M_eat_charclass()
+ {
+ ++_M_current; // skip ':'
+ if (_M_current == _M_end)
+ __throw_regex_error(regex_constants::error_ctype);
+ for (_M_curValue.clear();
+ _M_current != _M_end && *_M_current != _M_ctype.widen(':');
+ ++_M_current)
+ _M_curValue += *_M_current;
+ if (_M_current == _M_end)
+ __throw_regex_error(regex_constants::error_ctype);
+ ++_M_current; // skip ':'
+ if (*_M_current != _M_ctype.widen(']'))
+ __throw_regex_error(regex_constants::error_ctype);
+ ++_M_current; // skip ']'
+ }
+
+
+ template<typename _InputIterator>
+ void
+ _Scanner<_InputIterator>::
+ _M_eat_equivclass()
+ {
+ ++_M_current; // skip '='
+ if (_M_current == _M_end)
+ __throw_regex_error(regex_constants::error_collate);
+ for (_M_curValue.clear();
+ _M_current != _M_end && *_M_current != _M_ctype.widen('=');
+ ++_M_current)
+ _M_curValue += *_M_current;
+ if (_M_current == _M_end)
+ __throw_regex_error(regex_constants::error_collate);
+ ++_M_current; // skip '='
+ if (*_M_current != _M_ctype.widen(']'))
+ __throw_regex_error(regex_constants::error_collate);
+ ++_M_current; // skip ']'
+ }
+
+
+ template<typename _InputIterator>
+ void
+ _Scanner<_InputIterator>::
+ _M_eat_collsymbol()
+ {
+ ++_M_current; // skip '.'
+ if (_M_current == _M_end)
+ __throw_regex_error(regex_constants::error_collate);
+ for (_M_curValue.clear();
+ _M_current != _M_end && *_M_current != _M_ctype.widen('.');
+ ++_M_current)
+ _M_curValue += *_M_current;
+ if (_M_current == _M_end)
+ __throw_regex_error(regex_constants::error_collate);
+ ++_M_current; // skip '.'
+ if (*_M_current != _M_ctype.widen(']'))
+ __throw_regex_error(regex_constants::error_collate);
+ ++_M_current; // skip ']'
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ template<typename _InputIterator>
+ std::ostream&
+ _Scanner<_InputIterator>::
+ _M_print(std::ostream& ostr)
+ {
+ switch (_M_curToken)
+ {
+ case _S_token_anychar:
+ ostr << "any-character\n";
+ break;
+ case _S_token_backref:
+ ostr << "backref\n";
+ break;
+ case _S_token_bracket_begin:
+ ostr << "bracket-begin\n";
+ break;
+ case _S_token_bracket_end:
+ ostr << "bracket-end\n";
+ break;
+ case _S_token_char_class_name:
+ ostr << "char-class-name \"" << _M_curValue << "\"\n";
+ break;
+ case _S_token_closure0:
+ ostr << "closure0\n";
+ break;
+ case _S_token_closure1:
+ ostr << "closure1\n";
+ break;
+ case _S_token_collelem_multi:
+ ostr << "coll-elem-multi \"" << _M_curValue << "\"\n";
+ break;
+ case _S_token_collelem_single:
+ ostr << "coll-elem-single \"" << _M_curValue << "\"\n";
+ break;
+ case _S_token_collsymbol:
+ ostr << "collsymbol \"" << _M_curValue << "\"\n";
+ break;
+ case _S_token_comma:
+ ostr << "comma\n";
+ break;
+ case _S_token_dash:
+ ostr << "dash\n";
+ break;
+ case _S_token_dup_count:
+ ostr << "dup count: " << _M_curValue << "\n";
+ break;
+ case _S_token_eof:
+ ostr << "EOF\n";
+ break;
+ case _S_token_equiv_class_name:
+ ostr << "equiv-class-name \"" << _M_curValue << "\"\n";
+ break;
+ case _S_token_interval_begin:
+ ostr << "interval begin\n";
+ break;
+ case _S_token_interval_end:
+ ostr << "interval end\n";
+ break;
+ case _S_token_line_begin:
+ ostr << "line begin\n";
+ break;
+ case _S_token_line_end:
+ ostr << "line end\n";
+ break;
+ case _S_token_opt:
+ ostr << "opt\n";
+ break;
+ case _S_token_or:
+ ostr << "or\n";
+ break;
+ case _S_token_ord_char:
+ ostr << "ordinary character: \"" << _M_value() << "\"\n";
+ break;
+ case _S_token_quoted_char:
+ ostr << "quoted char\n";
+ break;
+ case _S_token_subexpr_begin:
+ ostr << "subexpr begin\n";
+ break;
+ case _S_token_subexpr_end:
+ ostr << "subexpr end\n";
+ break;
+ case _S_token_word_begin:
+ ostr << "word begin\n";
+ break;
+ case _S_token_word_end:
+ ostr << "word end\n";
+ break;
+ case _S_token_unknown:
+ ostr << "-- unknown token --\n";
+ break;
+ }
+ return ostr;
+ }
+#endif
+
+ // Builds an NFA from an input iterator interval.
+ template<typename _InIter, typename _TraitsT>
+ class _Compiler
+ {
+ public:
+ typedef _InIter _IterT;
+ typedef typename std::iterator_traits<_InIter>::value_type _CharT;
+ typedef std::basic_string<_CharT> _StringT;
+ typedef regex_constants::syntax_option_type _FlagT;
+
+ public:
+ _Compiler(const _InIter& __b, const _InIter& __e,
+ _TraitsT& __traits, _FlagT __flags);
+
+ const _Nfa&
+ _M_nfa() const
+ { return _M_state_store; }
+
+ private:
+ typedef _Scanner<_InIter> _ScannerT;
+ typedef typename _ScannerT::_TokenT _TokenT;
+ typedef std::stack<_StateSeq, std::vector<_StateSeq> > _StackT;
+ typedef _RangeMatcher<_InIter, _TraitsT> _RMatcherT;
+
+ // accepts a specific token or returns false.
+ bool
+ _M_match_token(_TokenT __token);
+
+ void
+ _M_disjunction();
+
+ bool
+ _M_alternative();
+
+ bool
+ _M_term();
+
+ bool
+ _M_assertion();
+
+ bool
+ _M_quantifier();
+
+ bool
+ _M_atom();
+
+ bool
+ _M_bracket_expression();
+
+ bool
+ _M_bracket_list(_RMatcherT& __matcher);
+
+ bool
+ _M_follow_list(_RMatcherT& __matcher);
+
+ bool
+ _M_follow_list2(_RMatcherT& __matcher);
+
+ bool
+ _M_expression_term(_RMatcherT& __matcher);
+
+ bool
+ _M_range_expression(_RMatcherT& __matcher);
+
+ bool
+ _M_start_range(_RMatcherT& __matcher);
+
+ bool
+ _M_collating_symbol(_RMatcherT& __matcher);
+
+ bool
+ _M_equivalence_class(_RMatcherT& __matcher);
+
+ bool
+ _M_character_class(_RMatcherT& __matcher);
+
+ int
+ _M_cur_int_value(int __radix);
+
+ private:
+ _TraitsT& _M_traits;
+ _ScannerT _M_scanner;
+ _StringT _M_cur_value;
+ _Nfa _M_state_store;
+ _StackT _M_stack;
+ };
+
+ template<typename _InIter, typename _TraitsT>
+ _Compiler<_InIter, _TraitsT>::
+ _Compiler(const _InIter& __b, const _InIter& __e, _TraitsT& __traits,
+ _Compiler<_InIter, _TraitsT>::_FlagT __flags)
+ : _M_traits(__traits), _M_scanner(__b, __e, __flags, _M_traits.getloc()),
+ _M_state_store(__flags)
+ {
+ using std::bind;
+ using std::placeholders::_1;
+ using std::placeholders::_2;
+ typedef _StartTagger<_InIter, _TraitsT> _Start;
+ typedef _EndTagger<_InIter, _TraitsT> _End;
+
+ _StateSeq __r(_M_state_store,
+ _M_state_store._M_insert_subexpr_begin(
+ bind(_Start(0), _1, _2)));
+ _M_disjunction();
+ if (!_M_stack.empty())
+ {
+ __r._M_append(_M_stack.top());
+ _M_stack.pop();
+ }
+ __r._M_append(_M_state_store.
+ _M_insert_subexpr_end(0, bind(_End(0), _1, _2)));
+ __r._M_append(_M_state_store._M_insert_accept());
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_match_token(_Compiler<_InIter, _TraitsT>::_TokenT token)
+ {
+ if (token == _M_scanner._M_token())
+ {
+ _M_cur_value = _M_scanner._M_value();
+ _M_scanner._M_advance();
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ void
+ _Compiler<_InIter, _TraitsT>::
+ _M_disjunction()
+ {
+ this->_M_alternative();
+ if (_M_match_token(_ScannerT::_S_token_or))
+ {
+ _StateSeq __alt1 = _M_stack.top(); _M_stack.pop();
+ this->_M_disjunction();
+ _StateSeq __alt2 = _M_stack.top(); _M_stack.pop();
+ _M_stack.push(_StateSeq(__alt1, __alt2));
+ }
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_alternative()
+ {
+ if (this->_M_term())
+ {
+ _StateSeq __re = _M_stack.top(); _M_stack.pop();
+ this->_M_alternative();
+ if (!_M_stack.empty())
+ {
+ __re._M_append(_M_stack.top());
+ _M_stack.pop();
+ }
+ _M_stack.push(__re);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_term()
+ {
+ if (this->_M_assertion())
+ return true;
+ if (this->_M_atom())
+ {
+ this->_M_quantifier();
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_assertion()
+ {
+ if (_M_match_token(_ScannerT::_S_token_line_begin))
+ {
+ // __m.push(_Matcher::_S_opcode_line_begin);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_line_end))
+ {
+ // __m.push(_Matcher::_S_opcode_line_end);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_word_begin))
+ {
+ // __m.push(_Matcher::_S_opcode_word_begin);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_word_end))
+ {
+ // __m.push(_Matcher::_S_opcode_word_end);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_quantifier()
+ {
+ if (_M_match_token(_ScannerT::_S_token_closure0))
+ {
+ if (_M_stack.empty())
+ __throw_regex_error(regex_constants::error_badrepeat);
+ _StateSeq __r(_M_stack.top(), -1);
+ __r._M_append(__r._M_front());
+ _M_stack.pop();
+ _M_stack.push(__r);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_closure1))
+ {
+ if (_M_stack.empty())
+ __throw_regex_error(regex_constants::error_badrepeat);
+ _StateSeq __r(_M_state_store,
+ _M_state_store.
+ _M_insert_alt(_S_invalid_state_id,
+ _M_stack.top()._M_front()));
+ _M_stack.top()._M_append(__r);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_opt))
+ {
+ if (_M_stack.empty())
+ __throw_regex_error(regex_constants::error_badrepeat);
+ _StateSeq __r(_M_stack.top(), -1);
+ _M_stack.pop();
+ _M_stack.push(__r);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_interval_begin))
+ {
+ if (_M_stack.empty())
+ __throw_regex_error(regex_constants::error_badrepeat);
+ if (!_M_match_token(_ScannerT::_S_token_dup_count))
+ __throw_regex_error(regex_constants::error_badbrace);
+ _StateSeq __r(_M_stack.top());
+ int __min_rep = _M_cur_int_value(10);
+ for (int __i = 1; __i < __min_rep; ++__i)
+ _M_stack.top()._M_append(__r._M_clone());
+ if (_M_match_token(_ScannerT::_S_token_comma))
+ if (_M_match_token(_ScannerT::_S_token_dup_count))
+ {
+ int __n = _M_cur_int_value(10) - __min_rep;
+ if (__n < 0)
+ __throw_regex_error(regex_constants::error_badbrace);
+ for (int __i = 0; __i < __n; ++__i)
+ {
+ _StateSeq __r(_M_state_store,
+ _M_state_store.
+ _M_insert_alt(_S_invalid_state_id,
+ _M_stack.top()._M_front()));
+ _M_stack.top()._M_append(__r);
+ }
+ }
+ else
+ {
+ _StateSeq __r(_M_stack.top(), -1);
+ __r._M_push_back(__r._M_front());
+ _M_stack.pop();
+ _M_stack.push(__r);
+ }
+ if (!_M_match_token(_ScannerT::_S_token_interval_end))
+ __throw_regex_error(regex_constants::error_brace);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_atom()
+ {
+ using std::bind;
+ using std::placeholders::_1;
+ using std::placeholders::_2;
+ typedef _CharMatcher<_InIter, _TraitsT> _CMatcher;
+ typedef _StartTagger<_InIter, _TraitsT> _Start;
+ typedef _EndTagger<_InIter, _TraitsT> _End;
+
+ if (_M_match_token(_ScannerT::_S_token_anychar))
+ {
+ _M_stack.push(_StateSeq(_M_state_store,
+ _M_state_store.
+ _M_insert_matcher(bind(_AnyMatcher, _1))));
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_ord_char))
+ {
+ _M_stack.push(_StateSeq
+ (_M_state_store, _M_state_store.
+ _M_insert_matcher
+ (bind(_CMatcher(_M_cur_value[0], _M_traits), _1))));
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_quoted_char))
+ {
+ // note that in the ECMA grammar, this case covers backrefs.
+ _M_stack.push(_StateSeq(_M_state_store,
+ _M_state_store.
+ _M_insert_matcher
+ (bind(_CMatcher(_M_cur_value[0], _M_traits),
+ _1))));
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_backref))
+ {
+ // __m.push(_Matcher::_S_opcode_ordchar, _M_cur_value);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_subexpr_begin))
+ {
+ int __mark = _M_state_store._M_sub_count();
+ _StateSeq __r(_M_state_store,
+ _M_state_store.
+ _M_insert_subexpr_begin(bind(_Start(__mark), _1, _2)));
+ this->_M_disjunction();
+ if (!_M_match_token(_ScannerT::_S_token_subexpr_end))
+ __throw_regex_error(regex_constants::error_paren);
+ if (!_M_stack.empty())
+ {
+ __r._M_append(_M_stack.top());
+ _M_stack.pop();
+ }
+ __r._M_append(_M_state_store._M_insert_subexpr_end
+ (__mark, bind(_End(__mark), _1, _2)));
+ _M_stack.push(__r);
+ return true;
+ }
+ return _M_bracket_expression();
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_bracket_expression()
+ {
+ using std::bind;
+ using std::placeholders::_1;
+ if (_M_match_token(_ScannerT::_S_token_bracket_begin))
+ {
+ _RMatcherT __matcher(_M_match_token(_ScannerT::_S_token_line_begin),
+ _M_traits);
+ if (!_M_bracket_list(__matcher)
+ || !_M_match_token(_ScannerT::_S_token_bracket_end))
+ __throw_regex_error(regex_constants::error_brack);
+ _M_stack.push(_StateSeq(_M_state_store,
+ _M_state_store._M_insert_matcher
+ (bind(__matcher, _1))));
+ return true;
+ }
+ return false;
+ }
+
+ // If the dash is the last character in the bracket expression, it is not
+ // special.
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_bracket_list(_RMatcherT& __matcher)
+ {
+ if (_M_follow_list(__matcher))
+ {
+ if (_M_match_token(_ScannerT::_S_token_dash))
+ __matcher._M_add_char(_M_cur_value[0]);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_follow_list(_RMatcherT& __matcher)
+ { return _M_expression_term(__matcher) && _M_follow_list2(__matcher); }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_follow_list2(_RMatcherT& __matcher)
+ {
+ if (_M_expression_term(__matcher))
+ return _M_follow_list2(__matcher);
+ return true;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_expression_term(_RMatcherT& __matcher)
+ {
+ return (_M_collating_symbol(__matcher)
+ || _M_character_class(__matcher)
+ || _M_equivalence_class(__matcher)
+ || (_M_start_range(__matcher)
+ && _M_range_expression(__matcher)));
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_range_expression(_RMatcherT& __matcher)
+ {
+ if (!_M_collating_symbol(__matcher))
+ if (!_M_match_token(_ScannerT::_S_token_dash))
+ __throw_regex_error(regex_constants::error_range);
+ __matcher._M_make_range();
+ return true;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_start_range(_RMatcherT& __matcher)
+ { return _M_match_token(_ScannerT::_S_token_dash); }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_collating_symbol(_RMatcherT& __matcher)
+ {
+ if (_M_match_token(_ScannerT::_S_token_collelem_single))
+ {
+ __matcher._M_add_char(_M_cur_value[0]);
+ return true;
+ }
+ if (_M_match_token(_ScannerT::_S_token_collsymbol))
+ {
+ __matcher._M_add_collating_element(_M_cur_value);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_equivalence_class(_RMatcherT& __matcher)
+ {
+ if (_M_match_token(_ScannerT::_S_token_equiv_class_name))
+ {
+ __matcher._M_add_equivalence_class(_M_cur_value);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ bool
+ _Compiler<_InIter, _TraitsT>::
+ _M_character_class(_RMatcherT& __matcher)
+ {
+ if (_M_match_token(_ScannerT::_S_token_char_class_name))
+ {
+ __matcher._M_add_character_class(_M_cur_value);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ int
+ _Compiler<_InIter, _TraitsT>::
+ _M_cur_int_value(int __radix)
+ {
+ int __v = 0;
+ for (typename _StringT::size_type __i = 0;
+ __i < _M_cur_value.length(); ++__i)
+ __v =__v * __radix + _M_traits.value(_M_cur_value[__i], __radix);
+ return __v;
+ }
+
+ template<typename _InIter, typename _TraitsT>
+ _AutomatonPtr
+ __compile(const _InIter& __b, const _InIter& __e, _TraitsT& __t,
+ regex_constants::syntax_option_type __f)
+ { return _AutomatonPtr(new _Nfa(_Compiler<_InIter, _TraitsT>(__b, __e, __t,
+ __f)._M_nfa())); }
+
+} // namespace __regex
+} // namespace std
+
+/* vim: set ts=8 sw=2 sts=2: */
diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h
new file mode 100644
index 00000000000..787b88b8cd4
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_constants.h
@@ -0,0 +1,299 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file bits/regex_constants
+ * @brief Constant definitions for the std regex library.
+ *
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+
+/**
+ * @namespace std::regex_constants
+ * @brief ISO C++-0x entities sub namespace for regex.
+ */
+namespace regex_constants
+{
+ /**
+ * @name 5.1 Regular Expression Syntax Options
+ */
+ //@{
+ enum __syntax_option
+ {
+ _S_icase,
+ _S_nosubs,
+ _S_optimize,
+ _S_collate,
+ _S_ECMAScript,
+ _S_basic,
+ _S_extended,
+ _S_awk,
+ _S_grep,
+ _S_egrep,
+ _S_syntax_last
+ };
+
+ /**
+ * @brief This is a bitmask type indicating how to interpret the regex.
+ *
+ * The @c syntax_option_type is implementation defined but it is valid to
+ * perform bitwise operations on these values and expect the right thing to
+ * happen.
+ *
+ * A valid value of type syntax_option_type shall have exactly one of the
+ * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
+ * %set.
+ */
+ typedef unsigned int syntax_option_type;
+
+ /**
+ * Specifies that the matching of regular expressions against a character
+ * sequence shall be performed without regard to case.
+ */
+ static const syntax_option_type icase = 1 << _S_icase;
+
+ /**
+ * Specifies that when a regular expression is matched against a character
+ * container sequence, no sub-expression matches are to be stored in the
+ * supplied match_results structure.
+ */
+ static const syntax_option_type nosubs = 1 << _S_nosubs;
+
+ /**
+ * Specifies that the regular expression engine should pay more attention to
+ * the speed with which regular expressions are matched, and less to the
+ * speed with which regular expression objects are constructed. Otherwise
+ * it has no detectable effect on the program output.
+ */
+ static const syntax_option_type optimize = 1 << _S_optimize;
+
+ /**
+ * Specifies that character ranges of the form [a-b] should be locale
+ * sensitive.
+ */
+ static const syntax_option_type collate = 1 << _S_collate;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
+ * Language Specification, Standard Ecma-262, third edition, 1999], as
+ * modified in section [28.13]. This grammar is similar to that defined
+ * in the PERL scripting language but extended with elements found in the
+ * POSIX regular expression grammar.
+ */
+ static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and
+ * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
+ * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ static const syntax_option_type basic = 1 << _S_basic;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and Headers,
+ * Section 9, Regular Expressions.
+ */
+ static const syntax_option_type extended = 1 << _S_extended;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type extended, except that C-style escape
+ * sequences are supported. These sequences are:
+ * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos;, &apos;,
+ * and \\ddd (where ddd is one, two, or three octal digits).
+ */
+ static const syntax_option_type awk = 1 << _S_awk;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type basic, except that newlines are treated
+ * as whitespace.
+ */
+ static const syntax_option_type grep = 1 << _S_grep;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep when given the -E option in
+ * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
+ * extended, except that newlines are treated as whitespace.
+ */
+ static const syntax_option_type egrep = 1 << _S_egrep;
+
+ //@}
+
+ /**
+ * @name 5.2 Matching Rules
+ *
+ * Matching a regular expression against a sequence of characters [first,
+ * last) proceeds according to the rules of the grammar specified for the
+ * regular expression object, modified according to the effects listed
+ * below for any bitmask elements set.
+ *
+ */
+ //@{
+
+ enum __match_flag
+ {
+ _S_not_bol,
+ _S_not_eol,
+ _S_not_bow,
+ _S_not_eow,
+ _S_any,
+ _S_not_null,
+ _S_continuous,
+ _S_prev_avail,
+ _S_sed,
+ _S_no_copy,
+ _S_first_only,
+ _S_match_flag_last
+ };
+
+ /**
+ * @brief This is a bitmask type indicating regex matching rules.
+ *
+ * The @c match_flag_type is implementation defined but it is valid to
+ * perform bitwise operations on these values and expect the right thing to
+ * happen.
+ */
+ typedef std::bitset<_S_match_flag_last> match_flag_type;
+
+ /**
+ * The default matching rules.
+ */
+ static const match_flag_type match_default = 0;
+
+ /**
+ * The first character in the sequence [first, last) is treated as though it
+ * is not at the beginning of a line, so the character (^) in the regular
+ * expression shall not match [first, first).
+ */
+ static const match_flag_type match_not_bol = 1 << _S_not_bol;
+
+ /**
+ * The last character in the sequence [first, last) is treated as though it
+ * is not at the end of a line, so the character ($) in the regular
+ * expression shall not match [last, last).
+ */
+ static const match_flag_type match_not_eol = 1 << _S_not_eol;
+
+ /**
+ * The expression \\b is not matched against the sub-sequence
+ * [first,first).
+ */
+ static const match_flag_type match_not_bow = 1 << _S_not_bow;
+
+ /**
+ * The expression \\b should not be matched against the sub-sequence
+ * [last,last).
+ */
+ static const match_flag_type match_not_eow = 1 << _S_not_eow;
+
+ /**
+ * If more than one match is possible then any match is an acceptable
+ * result.
+ */
+ static const match_flag_type match_any = 1 << _S_any;
+
+ /**
+ * The expression does not match an empty sequence.
+ */
+ static const match_flag_type match_not_null = 1 << _S_not_null;
+
+ /**
+ * The expression only matches a sub-sequence that begins at first .
+ */
+ static const match_flag_type match_continuous = 1 << _S_continuous;
+
+ /**
+ * --first is a valid iterator position. When this flag is set then the
+ * flags match_not_bol and match_not_bow are ignored by the regular
+ * expression algorithms 7.11 and iterators 7.12.
+ */
+ static const match_flag_type match_prev_avail = 1 << _S_prev_avail;
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the ECMAScript replace
+ * function in ECMA- 262 [Ecma International, ECMAScript Language
+ * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
+ * String.prototype.replace. In addition, during search and replace
+ * operations all non-overlapping occurrences of the regular expression
+ * are located and replaced, and sections of the input that did not match
+ * the expression are copied unchanged to the output string.
+ *
+ * Format strings (from ECMA-262 [15.5.4.11]):
+ * @li $$ The dollar-sign itself ($)
+ * @li $& The matched substring.
+ * @li $` The portion of @a string that precedes the matched substring.
+ * This would be match_results::prefix().
+ * @li $' The portion of @a string that follows the matched substring.
+ * This would be match_results::suffix().
+ * @li $n The nth capture, where n is in [1,9] and $n is not followed by a
+ * decimal digit. If n <= match_results::size() and the nth capture
+ * is undefined, use the empty string instead. If n >
+ * match_results::size(), the result is implementation-defined.
+ * @li $nn The nnth capture, where nn is a two-digit decimal number on
+ * [01, 99]. If nn <= match_results::size() and the nth capture is
+ * undefined, use the empty string instead. If
+ * nn > match_results::size(), the result is implementation-defined.
+ */
+ static const match_flag_type format_default = 0;
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the POSIX sed utility
+ * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
+ * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ static const match_flag_type format_sed = 1 << _S_sed;
+
+ /**
+ * During a search and replace operation, sections of the character
+ * container sequence being searched that do not match the regular
+ * expression shall not be copied to the output string.
+ */
+ static const match_flag_type format_no_copy = 1 << _S_no_copy;
+
+ /**
+ * When specified during a search and replace operation, only the first
+ * occurrence of the regular expression shall be replaced.
+ */
+ static const match_flag_type format_first_only = 1 << _S_first_only;
+
+ //@}
+
+} // namespace regex_constants
+} // namespace std
+
diff --git a/libstdc++-v3/include/bits/regex_cursor.h b/libstdc++-v3/include/bits/regex_cursor.h
new file mode 100644
index 00000000000..e8330fb7885
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_cursor.h
@@ -0,0 +1,92 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file bits/regex_cursor.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+namespace __regex
+{
+ // ABC for pattern matching
+ struct _PatternCursor
+ {
+ virtual ~_PatternCursor() { };
+ virtual void _M_next() = 0;
+ virtual bool _M_at_end() const = 0;
+ };
+
+ // Provides a cursor into the specific target string.
+ template<typename _FwdIterT>
+ class _SpecializedCursor
+ : public _PatternCursor
+ {
+ public:
+ _SpecializedCursor(const _FwdIterT& __b, const _FwdIterT __e)
+ : _M_b(__b), _M_c(__b), _M_e(__e)
+ { }
+
+ typename std::iterator_traits<_FwdIterT>::value_type
+ _M_current() const
+ { return *_M_c; }
+
+ void
+ _M_next()
+ { ++_M_c; }
+
+ _FwdIterT
+ _M_pos() const
+ { return _M_c; }
+
+ const _FwdIterT&
+ _M_begin() const
+ { return _M_b; }
+
+ const _FwdIterT&
+ _M_end() const
+ { return _M_e; }
+
+ bool
+ _M_at_end() const
+ { return _M_c == _M_e; }
+
+ private:
+ _FwdIterT _M_b;
+ _FwdIterT _M_c;
+ _FwdIterT _M_e;
+ };
+
+ // Helper funxtion to create a cursor specialized for an iterator class.
+ template<typename _FwdIterT>
+ inline _SpecializedCursor<_FwdIterT>
+ __cursor(const _FwdIterT& __b, const _FwdIterT __e)
+ { return _SpecializedCursor<_FwdIterT>(__b, __e); }
+
+} // namespace __regex
+} // namespace std
+
+/* vim: set ts=8 sw=2 sts=2: */
diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
new file mode 100644
index 00000000000..56bfae4cc66
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_error.h
@@ -0,0 +1,160 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file bits/regex_error
+ * @brief Error and exception objects for the std regex library.
+ *
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+
+namespace regex_constants
+{
+ /**
+ * @name 5.3 Error Types
+ */
+ //@{
+
+ enum error_type
+ {
+ _S_error_collate,
+ _S_error_ctype,
+ _S_error_escape,
+ _S_error_backref,
+ _S_error_brack,
+ _S_error_paren,
+ _S_error_brace,
+ _S_error_badbrace,
+ _S_error_range,
+ _S_error_space,
+ _S_error_badrepeat,
+ _S_error_complexity,
+ _S_error_stack,
+ _S_error_last
+ };
+
+ /** The expression contained an invalid collating element name. */
+ static const error_type error_collate(_S_error_collate);
+
+ /** The expression contained an invalid character class name. */
+ static const error_type error_ctype(_S_error_ctype);
+
+ /**
+ * The expression contained an invalid escaped character, or a trailing
+ * escape.
+ */
+ static const error_type error_escape(_S_error_escape);
+
+ /** The expression contained an invalid back reference. */
+ static const error_type error_backref(_S_error_backref);
+
+ /** The expression contained mismatched [ and ]. */
+ static const error_type error_brack(_S_error_brack);
+
+ /** The expression contained mismatched ( and ). */
+ static const error_type error_paren(_S_error_paren);
+
+ /** The expression contained mismatched { and } */
+ static const error_type error_brace(_S_error_brace);
+
+ /** The expression contained an invalid range in a {} expression. */
+ static const error_type error_badbrace(_S_error_badbrace);
+
+ /**
+ * The expression contained an invalid character range,
+ * such as [b-a] in most encodings.
+ */
+ static const error_type error_range(_S_error_range);
+
+ /**
+ * There was insufficient memory to convert the expression into a
+ * finite state machine.
+ */
+ static const error_type error_space(_S_error_space);
+
+ /**
+ * One of <em>*?+{<em> was not preceded by a valid regular expression.
+ */
+ static const error_type error_badrepeat(_S_error_badrepeat);
+
+ /**
+ * The complexity of an attempted match against a regular expression
+ * exceeded a pre-set level.
+ */
+ static const error_type error_complexity(_S_error_complexity);
+
+ /**
+ * There was insufficient memory to determine whether the
+ * regular expression could match the specified character sequence.
+ */
+ static const error_type error_stack(_S_error_stack);
+
+ //@}
+}
+
+ // [7.8] Class regex_error
+ /**
+ * @brief A regular expression exception class.
+ * @ingroup exceptions
+ *
+ * The regular expression library throws objects of this class on error.
+ */
+ class regex_error
+ : public std::runtime_error
+ {
+ public:
+ /**
+ * @brief Constructs a regex_error object.
+ *
+ * @param ecode the regex error code.
+ */
+ explicit
+ regex_error(regex_constants::error_type __ecode)
+ : std::runtime_error("regex_error"), _M_code(__ecode)
+ { }
+
+ /**
+ * @brief Gets the regex error code.
+ *
+ * @returns the regex error code.
+ */
+ regex_constants::error_type
+ code() const
+ { return _M_code; }
+
+ protected:
+ regex_constants::error_type _M_code;
+ };
+
+
+ inline void
+ __throw_regex_error(regex_constants::error_type __ecode)
+ { throw regex_error(__ecode); }
+
+} // namespace std
+
diff --git a/libstdc++-v3/include/bits/regex_grep_matcher.h b/libstdc++-v3/include/bits/regex_grep_matcher.h
new file mode 100644
index 00000000000..f243c92406b
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_grep_matcher.h
@@ -0,0 +1,131 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file bits/regex_executor.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+
+namespace std
+{
+ template<typename _BiIter>
+ class sub_match;
+
+ template<typename _Bi_iter, typename _Allocator>
+ class match_results;
+
+namespace __regex
+{
+ // A _Results facade specialized for wrapping a templated sub_match.
+ template<typename _FwdIterT, typename _Alloc>
+ class _SpecializedResults
+ : public _Results
+ {
+ public:
+ _SpecializedResults(const _Automaton::_SizeT __size,
+ const _SpecializedCursor<_FwdIterT>& __cursor,
+ match_results<_FwdIterT, _Alloc>& __m);
+
+ void
+ _M_set_pos(int __i, int __j, const _PatternCursor& __pc);
+
+ void
+ _M_set_matched(int __i, bool __is_matched)
+ { _M_results.at(__i).matched = __is_matched; }
+
+ private:
+ match_results<_FwdIterT, _Alloc>& _M_results;
+ };
+
+ template<typename _FwdIterT, typename _Alloc>
+ _SpecializedResults<_FwdIterT, _Alloc>::
+ _SpecializedResults(const _Automaton::_SizeT __size,
+ const _SpecializedCursor<_FwdIterT>& __cursor,
+ match_results<_FwdIterT, _Alloc>& __m)
+ : _M_results(__m)
+ {
+ typedef typename match_results<_FwdIterT, _Alloc>::size_type size_type;
+ _M_results.clear();
+ std::sub_match<_FwdIterT> __sm;
+ __sm.matched = false;
+ size_type __result_count = __size + 2;
+ for (size_type __i = 0; __i < __result_count; ++__i)
+ _M_results.push_back(__sm);
+ _M_results.at(__size+0).first = __cursor._M_begin();
+ _M_results.at(__size+0).second = __cursor._M_begin();
+ _M_results.at(__size+1).first = __cursor._M_end();
+ _M_results.at(__size+1).second = __cursor._M_end();
+ }
+
+ template<typename _FwdIterT, typename _Alloc>
+ void
+ _SpecializedResults<_FwdIterT, _Alloc>::
+ _M_set_pos(int __i, int __j, const _PatternCursor& __pc)
+ {
+ typedef const _SpecializedCursor<_FwdIterT>& _CursorT;
+ _CursorT __c = static_cast<_CursorT>(__pc);
+ if (__j == 0)
+ _M_results.at(__i).first = __c._M_pos();
+ else
+ _M_results.at(__i).second = __c._M_pos()+1;
+ }
+
+ // A stack of states used in evaluating the NFA.
+ typedef std::stack<_StateIdT, std::vector<_StateIdT> > _StateStack;
+
+ // Executes a regular expression NFA/DFA over a range using a variant of
+ // the parallel execution algorithm featured in the grep utility, modified
+ // to use Laurikari tags.
+ class _Grep_matcher
+ {
+ public:
+ _Grep_matcher(_PatternCursor& __p,
+ _Results& __r,
+ const _AutomatonPtr& __automaton,
+ regex_constants::match_flag_type __flags);
+
+ private:
+ _StateSet
+ _M_e_closure(_StateIdT __i);
+
+ _StateSet
+ _M_e_closure(const _StateSet& __s);
+
+ _StateSet
+ _M_e_closure(_StateStack& __stack, const _StateSet& __s);
+
+ private:
+ const std::shared_ptr<_Nfa> _M_nfa;
+ _PatternCursor& _M_pattern;
+ _Results& _M_results;
+ };
+
+} // namespace __regex
+} // namespace std
+
+#include <bits/regex_grep_matcher.tcc>
+
+/* vim: set ts=8 sw=2 sts=2: */
diff --git a/libstdc++-v3/include/bits/regex_grep_matcher.tcc b/libstdc++-v3/include/bits/regex_grep_matcher.tcc
new file mode 100644
index 00000000000..17d1e6449dc
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_grep_matcher.tcc
@@ -0,0 +1,177 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file regex_grep_matcher.cc
+ */
+#include <regex>
+
+namespace std
+{
+
+namespace
+{
+
+ // A stack of states used in evaluating the NFA.
+ typedef std::stack<std::__regex::_StateIdT,
+ std::vector<std::__regex::_StateIdT>
+ > _StateStack;
+
+ // Obtains the next state set given the current state set __s and the current
+ // input character.
+ inline std::__regex::_StateSet
+ __move(const std::__regex::_PatternCursor& __p,
+ const std::__regex::_Nfa& __nfa,
+ const std::__regex::_StateSet& __s)
+ {
+ std::__regex::_StateSet __m;
+ for (std::__regex::_StateSet::const_iterator __i = __s.begin();
+ __i != __s.end(); ++__i)
+ {
+ if (*__i == std::__regex::_S_invalid_state_id)
+ continue;
+
+ const std::__regex::_State& __state = __nfa[*__i];
+ if (__state._M_opcode == std::__regex::_S_opcode_match
+ && __state._M_matches(__p))
+ __m.insert(__state._M_next);
+ }
+ return __m;
+ }
+
+ // returns true if (__s intersect __t) is not empty
+ inline bool
+ __includes_some(const std::__regex::_StateSet& __s,
+ const std::__regex::_StateSet& __t)
+ {
+ if (__s.size() > 0 && __t.size() > 0)
+ {
+ std::__regex::_StateSet::const_iterator __first = __s.begin();
+ std::__regex::_StateSet::const_iterator __second = __t.begin();
+ while (__first != __s.end() && __second != __t.end())
+ {
+ if (*__first < *__second)
+ ++__first;
+ else if (*__second < *__first)
+ ++__second;
+ else
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // If an identified state __u is not already in the current state set __e,
+ // insert it and push it on the current state stack __s.
+ inline void
+ __add_visited_state(const std::__regex::_StateIdT __u,
+ _StateStack& __s,
+ std::__regex::_StateSet& __e)
+ {
+ if (__e.count(__u) == 0)
+ {
+ __e.insert(__u);
+ __s.push(__u);
+ }
+ }
+
+} // anonymous namespace
+
+namespace __regex
+{
+ inline _Grep_matcher::
+ _Grep_matcher(_PatternCursor& __p, _Results& __r,
+ const _AutomatonPtr& __nfa,
+ regex_constants::match_flag_type __flags)
+ : _M_nfa(static_pointer_cast<_Nfa>(__nfa)), _M_pattern(__p), _M_results(__r)
+ {
+ __regex::_StateSet __t = this->_M_e_closure(_M_nfa->_M_start());
+ for (; !_M_pattern._M_at_end(); _M_pattern._M_next())
+ __t = this->_M_e_closure(__move(_M_pattern, *_M_nfa, __t));
+
+ _M_results._M_set_matched(0,
+ __includes_some(_M_nfa->_M_final_states(), __t));
+ }
+
+ // Creates the e-closure set for the initial state __i.
+ inline _StateSet _Grep_matcher::
+ _M_e_closure(_StateIdT __i)
+ {
+ _StateSet __s;
+ __s.insert(__i);
+ _StateStack __stack;
+ __stack.push(__i);
+ return this->_M_e_closure(__stack, __s);
+ }
+
+ // Creates the e-closure set for an arbitrary state set __s.
+ inline _StateSet _Grep_matcher::
+ _M_e_closure(const _StateSet& __s)
+ {
+ _StateStack __stack;
+ for (_StateSet::const_iterator __i = __s.begin(); __i != __s.end(); ++__i)
+ __stack.push(*__i);
+ return this->_M_e_closure(__stack, __s);
+ }
+
+ inline _StateSet _Grep_matcher::
+ _M_e_closure(_StateStack& __stack, const _StateSet& __s)
+ {
+ _StateSet __e = __s;
+ while (!__stack.empty())
+ {
+ _StateIdT __t = __stack.top(); __stack.pop();
+ if (__t == _S_invalid_state_id)
+ continue;
+ // for each __u with edge from __t to __u labeled e do ...
+ const _State& __state = _M_nfa->operator[](__t);
+ switch (__state._M_opcode)
+ {
+ case _S_opcode_alternative:
+ __add_visited_state(__state._M_next, __stack, __e);
+ __add_visited_state(__state._M_alt, __stack, __e);
+ break;
+ case _S_opcode_subexpr_begin:
+ __add_visited_state(__state._M_next, __stack, __e);
+ __state._M_tagger(_M_pattern, _M_results);
+ break;
+ case _S_opcode_subexpr_end:
+ __add_visited_state(__state._M_next, __stack, __e);
+ __state._M_tagger(_M_pattern, _M_results);
+ _M_results._M_set_matched(__state._M_subexpr, true);
+ break;
+ case _S_opcode_accept:
+ __add_visited_state(__state._M_next, __stack, __e);
+ break;
+ default:
+ break;
+ }
+ }
+ return __e;
+ }
+
+} // namespace __regex
+} // namespace std
+
+/* vim: set ts=8 sw=2 sts=2: */
diff --git a/libstdc++-v3/include/bits/regex_nfa.h b/libstdc++-v3/include/bits/regex_nfa.h
new file mode 100644
index 00000000000..2a938915b97
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_nfa.h
@@ -0,0 +1,403 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file bits/regex_nfa.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+namespace __regex
+{
+
+ // Base class for, um, automata. Could be an NFA or a DFA. Your choice.
+ class _Automaton
+ {
+ public:
+ typedef unsigned int _SizeT;
+
+ public:
+ virtual
+ ~_Automaton()
+ { }
+
+ virtual _SizeT
+ _M_sub_count() const = 0;
+
+#ifdef _GLIBCXX_DEBUG
+ virtual std::ostream&
+ _M_dot(std::ostream& __ostr) const = 0;
+#endif
+ };
+
+ // Generic shred pointer to an automaton.
+ typedef std::shared_ptr<_Automaton> _AutomatonPtr;
+
+ // Operation codes that define the type of transitions within the base NFA
+ // that represents the regular expression.
+ enum _Opcode
+ {
+ _S_opcode_unknown = 0,
+ _S_opcode_alternative = 1,
+ _S_opcode_subexpr_begin = 4,
+ _S_opcode_subexpr_end = 5,
+ _S_opcode_match = 100,
+ _S_opcode_accept = 255
+ };
+
+ // Provides a generic facade for a templated match_results.
+ struct _Results
+ {
+ virtual void _M_set_pos(int __i, int __j, const _PatternCursor& __p) = 0;
+ virtual void _M_set_matched(int __i, bool __is_matched) = 0;
+ };
+
+ // Tags current state (for subexpr begin/end).
+ typedef std::function<void (const _PatternCursor&, _Results&)> _Tagger;
+
+ template<typename _FwdIterT, typename _TraitsT>
+ struct _StartTagger
+ : public _Tagger
+ {
+ explicit
+ _StartTagger(int __i)
+ : _M_index(__i)
+ { }
+
+ void
+ operator()(const _PatternCursor& __pc, _Results& __r)
+ { __r._M_set_pos(_M_index, 0, __pc); }
+
+ int _M_index;
+ };
+
+ template<typename _FwdIterT, typename _TraitsT>
+ struct _EndTagger
+ : public _Tagger
+ {
+ explicit
+ _EndTagger(int __i)
+ : _M_index(__i)
+ { }
+
+ void
+ operator()(const _PatternCursor& __pc, _Results& __r)
+ { __r._M_set_pos(_M_index, 1, __pc); }
+
+ int _M_index;
+ _FwdIterT _M_pos;
+ };
+ // Indicates if current state matches cursor current.
+ typedef std::function<bool (const _PatternCursor&)> _Matcher;
+
+ // Matches any character
+ inline bool
+ _AnyMatcher(const _PatternCursor&)
+ { return true; }
+
+ // Matches a single character
+ template<typename _InIterT, typename _TraitsT>
+ struct _CharMatcher
+ : public _Matcher
+ {
+ typedef typename _TraitsT::char_type char_type;
+
+ explicit
+ _CharMatcher(char_type __c, const _TraitsT& __t = _TraitsT())
+ : _M_traits(__t), _M_c(_M_traits.translate(__c))
+ { }
+
+ bool
+ operator()(const _PatternCursor& __pc) const
+ {
+ typedef const _SpecializedCursor<_InIterT>& _CursorT;
+ _CursorT __c = static_cast<_CursorT>(__pc);
+ return _M_traits.translate(__c._M_current()) == _M_c;
+ }
+
+ const _TraitsT& _M_traits;
+ char_type _M_c;
+ };
+
+ // Matches a character range (bracket expression)
+ template<typename _InIterT, typename _TraitsT>
+ struct _RangeMatcher
+ : public _Matcher
+ {
+ typedef typename _TraitsT::char_type _CharT;
+ typedef std::basic_string<_CharT> _StringT;
+
+ explicit
+ _RangeMatcher(bool __is_non_matching, const _TraitsT& __t = _TraitsT())
+ : _M_traits(__t), _M_is_non_matching(__is_non_matching)
+ { }
+
+ bool
+ operator()(const _PatternCursor& __pc) const
+ {
+ typedef const _SpecializedCursor<_InIterT>& _CursorT;
+ _CursorT __c = static_cast<_CursorT>(__pc);
+ return true;
+ }
+
+ void
+ _M_add_char(_CharT __c)
+ { }
+
+ void
+ _M_add_collating_element(const _StringT& __s)
+ { }
+
+ void
+ _M_add_equivalence_class(const _StringT& __s)
+ { }
+
+ void
+ _M_add_character_class(const _StringT& __s)
+ { }
+
+ void
+ _M_make_range()
+ { }
+
+ const _TraitsT& _M_traits;
+ bool _M_is_non_matching;
+ };
+
+ // Identifies a state in the NFA.
+ typedef int _StateIdT;
+
+ // The special case in which a state identifier is not an index.
+ static const _StateIdT _S_invalid_state_id = -1;
+
+
+ // An individual state in an NFA
+ //
+ // In this case a "state" is an entry in the NFA definition coupled with its
+ // outgoing transition(s). All states have a single outgoing transition,
+ // except for accepting states (which have no outgoing transitions) and alt
+ // states, which have two outgoing transitions.
+ //
+ struct _State
+ {
+ typedef int _OpcodeT;
+
+ _OpcodeT _M_opcode; // type of outgoing transition
+ _StateIdT _M_next; // outgoing tranition
+ _StateIdT _M_alt; // for _S_opcode_alternative
+ unsigned int _M_subexpr; // for _S_opcode_subexpr_*
+ _Tagger _M_tagger; // for _S_opcode_subexpr_*
+ _Matcher _M_matches; // for _S_opcode_match
+
+ explicit _State(_OpcodeT __opcode)
+ : _M_opcode(__opcode), _M_next(_S_invalid_state_id)
+ { }
+
+ _State(const _Matcher& __m)
+ : _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id), _M_matches(__m)
+ { }
+
+ _State(_OpcodeT __opcode, unsigned int __s, const _Tagger& __t)
+ : _M_opcode(__opcode), _M_next(_S_invalid_state_id), _M_subexpr(__s),
+ _M_tagger(__t)
+ { }
+
+ _State(_StateIdT __next, _StateIdT __alt)
+ : _M_opcode(_S_opcode_alternative), _M_next(__next), _M_alt(__alt)
+ { }
+
+#ifdef _GLIBCXX_DEBUG
+ std::ostream&
+ _M_print(std::ostream& ostr) const;
+
+ // Prints graphviz dot commands for state.
+ std::ostream&
+ _M_dot(std::ostream& __ostr, _StateIdT __id) const;
+#endif
+ };
+
+
+ // The Grep Matcher works on sets of states. Here are sets of states.
+ typedef std::set<_StateIdT> _StateSet;
+
+ // A collection of all states making up an NFA
+ //
+ // An NFA is a 4-tuple M = (K, S, s, F), where
+ // K is a finite set of states,
+ // S is the alphabet of the NFA,
+ // s is the initial state,
+ // F is a set of final (accepting) states.
+ //
+ // This NFA class is templated on S, a type that will hold values of the
+ // underlying alphabet (without regard to semantics of that alphabet). The
+ // other elements of the tuple are generated during construction of the NFA
+ // and are available through accessor member functions.
+ //
+ class _Nfa
+ : public _Automaton, public std::vector<_State>
+ {
+ public:
+ typedef _State _StateT;
+ typedef unsigned int _SizeT;
+ typedef regex_constants::syntax_option_type _FlagT;
+
+ public:
+ _Nfa(_FlagT __f)
+ : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0)
+ { }
+
+ ~_Nfa()
+ { }
+
+ _FlagT
+ _M_options() const
+ { return _M_flags; }
+
+ _StateIdT
+ _M_start() const
+ { return _M_start_state; }
+
+ const _StateSet&
+ _M_final_states() const
+ { return _M_accepting_states; }
+
+ _SizeT
+ _M_sub_count() const
+ { return _M_subexpr_count; }
+
+ _StateIdT
+ _M_insert_accept()
+ {
+ this->push_back(_StateT(_S_opcode_accept));
+ _M_accepting_states.insert(this->size()-1);
+ return this->size()-1;
+ }
+
+ _StateIdT
+ _M_insert_alt(_StateIdT __next, _StateIdT __alt)
+ {
+ this->push_back(_StateT(__next, __alt));
+ return this->size()-1;
+ }
+
+ _StateIdT
+ _M_insert_matcher(_Matcher __m)
+ {
+ this->push_back(_StateT(__m));
+ return this->size()-1;
+ }
+
+ _StateIdT
+ _M_insert_subexpr_begin(const _Tagger& __t)
+ {
+ this->push_back(_StateT(_S_opcode_subexpr_begin, _M_subexpr_count++, __t));
+ return this->size()-1;
+ }
+
+ _StateIdT
+ _M_insert_subexpr_end(unsigned int __i, const _Tagger& __t)
+ {
+ this->push_back(_StateT(_S_opcode_subexpr_end, __i, __t));
+ return this->size()-1;
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ std::ostream&
+ _M_dot(std::ostream& __ostr) const;
+#endif
+
+ private:
+ _FlagT _M_flags;
+ _StateIdT _M_start_state;
+ _StateSet _M_accepting_states;
+ _SizeT _M_subexpr_count;
+ };
+
+ // Describes a sequence of one or more %_State, its current start and end(s).
+ //
+ // This structure contains fragments of an NFA during construction.
+ class _StateSeq
+ {
+ public:
+ // Constructs a single-node sequence
+ _StateSeq(_Nfa& __ss, _StateIdT __s, _StateIdT __e = _S_invalid_state_id)
+ : _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e)
+ { }
+ // Constructs a split sequence from two other sequencces
+ _StateSeq(const _StateSeq& __e1, const _StateSeq& __e2)
+ : _M_nfa(__e1._M_nfa),
+ _M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)),
+ _M_end1(__e1._M_end1), _M_end2(__e2._M_end1)
+ { }
+
+ // Constructs a split sequence from a single sequence
+ _StateSeq(const _StateSeq& __e, _StateIdT __id)
+ : _M_nfa(__e._M_nfa),
+ _M_start(_M_nfa._M_insert_alt(__id, __e._M_start)),
+ _M_end1(__id), _M_end2(__e._M_end1)
+ { }
+
+ // Constructs a copy of a %_StateSeq
+ _StateSeq(const _StateSeq& __rhs)
+ : _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start),
+ _M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2)
+ { }
+
+
+ _StateSeq& operator=(const _StateSeq& __rhs);
+
+ _StateIdT
+ _M_front() const
+ { return _M_start; }
+
+ // Extends a sequence by one.
+ void
+ _M_push_back(_StateIdT __id);
+
+ // Extends and maybe joins a sequence.
+ void
+ _M_append(_StateIdT __id);
+
+ void
+ _M_append(_StateSeq& __rhs);
+
+ // Clones an entire sequence.
+ _StateIdT
+ _M_clone();
+
+ private:
+ _Nfa& _M_nfa;
+ _StateIdT _M_start;
+ _StateIdT _M_end1;
+ _StateIdT _M_end2;
+
+ };
+
+} // namespace __regex
+} // namespace std
+
+#include <bits/regex_nfa.tcc>
+
diff --git a/libstdc++-v3/include/bits/regex_nfa.tcc b/libstdc++-v3/include/bits/regex_nfa.tcc
new file mode 100644
index 00000000000..38ab7e0b2ae
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex_nfa.tcc
@@ -0,0 +1,170 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file regex_nfa.cc
+ */
+#include <regex>
+
+namespace std
+{
+namespace __regex
+{
+#ifdef _GLIBCXX_DEBUG
+inline std::ostream& _State::
+_M_print(std::ostream& ostr) const
+{
+ switch (_M_opcode)
+ {
+ case _S_opcode_alternative:
+ ostr << "alt next=" << _M_next << " alt=" << _M_alt;
+ break;
+ case _S_opcode_subexpr_begin:
+ ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr;
+ break;
+ case _S_opcode_subexpr_end:
+ ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr;
+ break;
+ case _S_opcode_match:
+ ostr << "match next=" << _M_next;
+ break;
+ case _S_opcode_accept:
+ ostr << "accept next=" << _M_next;
+ break;
+ default:
+ ostr << "unknown next=" << _M_next;
+ break;
+ }
+ return ostr;
+}
+
+// Prints graphviz dot commands for state.
+inline std::ostream& _State::
+_M_dot(std::ostream& __ostr, _StateIdT __id) const
+{
+ switch (_M_opcode)
+ {
+ case _S_opcode_alternative:
+ __ostr << __id << " [label=\"" << __id << "\\nALT\"];\n"
+ << __id << " -> " << _M_next
+ << " [label=\"epsilon\", tailport=\"s\"];\n"
+ << __id << " -> " << _M_alt
+ << " [label=\"epsilon\", tailport=\"n\"];\n";
+ break;
+ case _S_opcode_subexpr_begin:
+ __ostr << __id << " [label=\"" << __id << "\\nSBEGIN "
+ << _M_subexpr << "\"];\n"
+ << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
+ break;
+ case _S_opcode_subexpr_end:
+ __ostr << __id << " [label=\"" << __id << "\\nSEND "
+ << _M_subexpr << "\"];\n"
+ << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
+ break;
+ case _S_opcode_match:
+ __ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n"
+ << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
+ break;
+ case _S_opcode_accept:
+ __ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ;
+ break;
+ default:
+ __ostr << __id << " [label=\"" << __id << "\\nUNK\"];\n"
+ << __id << " -> " << _M_next << " [label=\"?\"];\n";
+ break;
+ }
+ return __ostr;
+}
+
+inline std::ostream& _Nfa::
+_M_dot(std::ostream& __ostr) const
+{
+ __ostr << "digraph _Nfa {\n"
+ << " rankdir=LR;\n";
+ for (unsigned int __i = 0; __i < this->size(); ++__i)
+ { this->at(__i)._M_dot(__ostr, __i); }
+ __ostr << "}\n";
+ return __ostr;
+}
+#endif
+
+inline _StateSeq& _StateSeq::
+operator=(const _StateSeq& __rhs)
+{
+ _M_start = __rhs._M_start;
+ _M_end1 = __rhs._M_end1;
+ _M_end2 = __rhs._M_end2;
+ return *this;
+}
+
+inline void _StateSeq::
+_M_push_back(_StateIdT __id)
+{
+ if (_M_end1 != _S_invalid_state_id)
+ _M_nfa[_M_end1]._M_next = __id;
+ _M_end1 = __id;
+}
+
+inline void _StateSeq::
+_M_append(_StateIdT __id)
+{
+ if (_M_end2 != _S_invalid_state_id)
+ {
+ if (_M_end2 == _M_end1)
+ _M_nfa[_M_end2]._M_alt = __id;
+ else
+ _M_nfa[_M_end2]._M_next = __id;
+ _M_end2 = _S_invalid_state_id;
+ }
+ if (_M_end1 != _S_invalid_state_id)
+ _M_nfa[_M_end1]._M_next = __id;
+ _M_end1 = __id;
+}
+
+inline void _StateSeq::
+_M_append(_StateSeq& __rhs)
+{
+ if (_M_end2 != _S_invalid_state_id)
+ {
+ if (_M_end2 == _M_end1)
+ _M_nfa[_M_end2]._M_alt = __rhs._M_start;
+ else
+ _M_nfa[_M_end2]._M_next = __rhs._M_start;
+ _M_end2 = _S_invalid_state_id;
+ }
+ if (__rhs._M_end2 != _S_invalid_state_id)
+ _M_end2 = __rhs._M_end2;
+ if (_M_end1 != _S_invalid_state_id)
+ _M_nfa[_M_end1]._M_next = __rhs._M_start;
+ _M_end1 = __rhs._M_end1;
+}
+
+// @todo implement this function.
+inline _StateIdT _StateSeq::
+_M_clone()
+{ return 0; }
+
+} // namespace __regex
+} // namespace std
+
diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h
index 5e1960012c9..4f87dd459cf 100644
--- a/libstdc++-v3/include/bits/shared_ptr.h
+++ b/libstdc++-v3/include/bits/shared_ptr.h
@@ -123,6 +123,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
shared_ptr(_Tp1* __p, _Deleter __d) : __shared_ptr<_Tp>(__p, __d) { }
/**
+ * @brief Construct a %shared_ptr that owns a null pointer
+ * and the deleter @a __d.
+ * @param __p A null pointer constant.
+ * @param __d A deleter.
+ * @post use_count() == 1 && get() == __p
+ * @throw std::bad_alloc, in which case @a __d(__p) is called.
+ *
+ * Requirements: _Deleter's copy constructor and destructor must
+ * not throw
+ *
+ * The last owner will call __d(__p)
+ */
+ template<typename _Deleter>
+ shared_ptr(nullptr_t __p, _Deleter __d)
+ : __shared_ptr<_Tp>(__p, __d) { }
+
+ /**
* @brief Construct a %shared_ptr that owns the pointer @a __p
* and the deleter @a __d.
* @param __p A pointer.
@@ -141,6 +158,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
: __shared_ptr<_Tp>(__p, __d, __a) { }
+ /**
+ * @brief Construct a %shared_ptr that owns a null pointer
+ * and the deleter @a __d.
+ * @param __p A null pointer constant.
+ * @param __d A deleter.
+ * @param __a An allocator.
+ * @post use_count() == 1 && get() == __p
+ * @throw std::bad_alloc, in which case @a __d(__p) is called.
+ *
+ * Requirements: _Deleter's copy constructor and destructor must
+ * not throw _Alloc's copy constructor and destructor must not
+ * throw.
+ *
+ * The last owner will call __d(__p)
+ */
+ template<typename _Deleter, typename _Alloc>
+ shared_ptr(nullptr_t __p, _Deleter __d, const _Alloc& __a)
+ : __shared_ptr<_Tp>(__p, __d, __a) { }
+
// Aliasing constructor
/**
@@ -212,6 +248,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
: __shared_ptr<_Tp>(std::move(__r)) { }
+ /**
+ * @brief Construct an empty %shared_ptr.
+ * @param __p A null pointer constant.
+ * @post use_count() == 0 && get() == nullptr
+ */
+ shared_ptr(nullptr_t __p) : __shared_ptr<_Tp>(__p) { }
+
template<typename _Tp1>
shared_ptr&
operator=(const shared_ptr<_Tp1>& __r) // never throws
@@ -471,6 +514,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
std::forward<_Args>(__args)...);
}
+ /// std::hash specialization for shared_ptr.
+ template<typename _Tp>
+ struct hash<shared_ptr<_Tp>>
+ : public std::unary_function<shared_ptr<_Tp>, size_t>
+ {
+ size_t
+ operator()(const shared_ptr<_Tp>& __s) const
+ { return std::hash<_Tp*>()(__s.get()); }
+ };
+
// @} group pointer_abstractions
_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 0c366b8ef1a..0a69d2b2411 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -85,6 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
class _Sp_counted_ptr : public _Sp_counted_base<_Lp>
{
public:
+ explicit
_Sp_counted_ptr(_Ptr __p)
: _M_ptr(__p) { }
@@ -107,6 +108,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Ptr _M_ptr; // copy constructor must not throw
};
+ template<>
+ inline void
+ _Sp_counted_ptr<nullptr_t, _S_single>::_M_dispose() { }
+
+ template<>
+ inline void
+ _Sp_counted_ptr<nullptr_t, _S_mutex>::_M_dispose() { }
+
+ template<>
+ inline void
+ _Sp_counted_ptr<nullptr_t, _S_atomic>::_M_dispose() { }
+
// Support for custom deleter and/or allocator
template<typename _Ptr, typename _Deleter, typename _Alloc, _Lock_policy _Lp>
class _Sp_counted_deleter : public _Sp_counted_ptr<_Ptr, _Lp>
@@ -181,6 +194,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Base_type;
public:
+ explicit
_Sp_counted_ptr_inplace(_Alloc __a)
: _Base_type(static_cast<_Tp*>(0), _Sp_destroy_inplace<_Tp>(), __a)
, _M_storage()
@@ -237,6 +251,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ }
template<typename _Ptr>
+ explicit
__shared_count(_Ptr __p) : _M_pi(0)
{
__try
@@ -316,6 +331,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#if _GLIBCXX_DEPRECATED
// Special case for auto_ptr<_Tp> to provide the strong guarantee.
template<typename _Tp>
+ explicit
__shared_count(std::auto_ptr<_Tp>&& __r)
: _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get()))
{ __r.release(); }
@@ -323,6 +339,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee.
template<typename _Tp, typename _Del>
+ explicit
__shared_count(std::unique_ptr<_Tp, _Del>&& __r)
: _M_pi(_S_create_from_up(std::move(__r)))
{ __r.release(); }
@@ -567,6 +584,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__enable_shared_from_this_helper(_M_refcount, __p, __p);
}
+ template<typename _Deleter>
+ __shared_ptr(nullptr_t __p, _Deleter __d)
+ : _M_ptr(0), _M_refcount(__p, __d)
+ { }
+
+ template<typename _Deleter, typename _Alloc>
+ __shared_ptr(nullptr_t __p, _Deleter __d, const _Alloc& __a)
+ : _M_ptr(0), _M_refcount(__p, __d, __a)
+ { }
+
template<typename _Tp1>
__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, _Tp* __p)
: _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws
@@ -631,6 +658,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
#endif
+ /* TODO: use delegating constructor */
+ __shared_ptr(nullptr_t) : _M_ptr(0), _M_refcount() // never throws
+ { }
+
template<typename _Tp1>
__shared_ptr&
operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
@@ -1133,6 +1164,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
std::forward<_Args>(__args)...);
}
+ /// std::hash specialization for __shared_ptr.
+ template<typename _Tp, _Lock_policy _Lp>
+ struct hash<__shared_ptr<_Tp, _Lp>>
+ : public std::unary_function<__shared_ptr<_Tp, _Lp>, size_t>
+ {
+ size_t
+ operator()(const __shared_ptr<_Tp, _Lp>& __s) const
+ { return std::hash<_Tp*>()(__s.get()); }
+ };
+
_GLIBCXX_END_NAMESPACE
#endif // _SHARED_PTR_BASE_H
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 0489c413b95..cfaeef8f645 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -58,7 +58,6 @@
#define _STL_ALGOBASE_H 1
#include <bits/c++config.h>
-#include <cstddef>
#include <bits/functexcept.h>
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
@@ -395,7 +394,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename iterator_traits<_II>::value_type _ValueTypeI;
typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
typedef typename iterator_traits<_II>::iterator_category _Category;
- const bool __simple = (__is_pod(_ValueTypeI)
+ const bool __simple = (__is_trivial(_ValueTypeI)
&& __is_pointer<_II>::__value
&& __is_pointer<_OI>::__value
&& __are_same<_ValueTypeI, _ValueTypeO>::__value);
@@ -590,7 +589,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename iterator_traits<_BI1>::value_type _ValueType1;
typedef typename iterator_traits<_BI2>::value_type _ValueType2;
typedef typename iterator_traits<_BI1>::iterator_category _Category;
- const bool __simple = (__is_pod(_ValueType1)
+ const bool __simple = (__is_trivial(_ValueType1)
&& __is_pointer<_BI1>::__value
&& __is_pointer<_BI2>::__value
&& __are_same<_ValueType1, _ValueType2>::__value);
diff --git a/libstdc++-v3/include/bits/stl_construct.h b/libstdc++-v3/include/bits/stl_construct.h
index 06a2902ca69..d84b8f164fd 100644
--- a/libstdc++-v3/include/bits/stl_construct.h
+++ b/libstdc++-v3/include/bits/stl_construct.h
@@ -67,19 +67,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* Constructs an object in existing memory by invoking an allocated
* object's constructor with an initializer.
*/
- template<typename _T1, typename _T2>
- inline void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- // Allow perfect forwarding
- _Construct(_T1* __p, _T2&& __value)
+ template<typename _T1, typename... _Args>
+ inline void
+ _Construct(_T1* __p, _Args&&... __args)
+ { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
#else
+ template<typename _T1, typename _T2>
+ inline void
_Construct(_T1* __p, const _T2& __value)
-#endif
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_]allocator::construct
- ::new(static_cast<void*>(__p)) _T1(_GLIBCXX_FORWARD(_T2, __value));
+ ::new(static_cast<void*>(__p)) _T1(__value);
}
+#endif
/**
* Destroy the object pointed to by a pointer type.
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index 19022b0cf34..d3cd73997e9 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -449,6 +449,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
: _M_impl()
{ _M_initialize_map(0); }
+ _Deque_base(size_t __num_elements)
+ : _M_impl()
+ { _M_initialize_map(__num_elements); }
+
_Deque_base(const allocator_type& __a, size_t __num_elements)
: _M_impl(__a)
{ _M_initialize_map(__num_elements); }
@@ -773,6 +777,32 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
deque(const allocator_type& __a)
: _Base(__a, 0) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Creates a %deque with default constructed elements.
+ * @param n The number of elements to initially create.
+ *
+ * This constructor fills the %deque with @a n default
+ * constructed elements.
+ */
+ explicit
+ deque(size_type __n)
+ : _Base(__n)
+ { _M_default_initialize(); }
+
+ /**
+ * @brief Creates a %deque with copies of an exemplar element.
+ * @param n The number of elements to initially create.
+ * @param value An element to copy.
+ * @param a An allocator.
+ *
+ * This constructor fills the %deque with @a n copies of @a value.
+ */
+ deque(size_type __n, const value_type& __value,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a, __n)
+ { _M_fill_initialize(__value); }
+#else
/**
* @brief Creates a %deque with copies of an exemplar element.
* @param n The number of elements to initially create.
@@ -786,6 +816,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
const allocator_type& __a = allocator_type())
: _Base(__a, __n)
{ _M_fill_initialize(__value); }
+#endif
/**
* @brief %Deque copy constructor.
@@ -824,11 +855,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
deque(initializer_list<value_type> __l,
const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- _M_range_initialize(__l.begin(), __l.end(),
- random_access_iterator_tag());
- }
+ : _Base(__a)
+ {
+ _M_range_initialize(__l.begin(), __l.end(),
+ random_access_iterator_tag());
+ }
#endif
/**
@@ -1086,6 +1117,49 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
max_size() const
{ return _M_get_Tp_allocator().max_size(); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Resizes the %deque to the specified number of elements.
+ * @param new_size Number of elements the %deque should contain.
+ *
+ * This function will %resize the %deque to the specified
+ * number of elements. If the number is smaller than the
+ * %deque's current size the %deque is truncated, otherwise
+ * default constructed elements are appended.
+ */
+ void
+ resize(size_type __new_size)
+ {
+ const size_type __len = size();
+ if (__new_size > __len)
+ _M_default_append(__new_size - __len);
+ else if (__new_size < __len)
+ _M_erase_at_end(this->_M_impl._M_start
+ + difference_type(__new_size));
+ }
+
+ /**
+ * @brief Resizes the %deque to the specified number of elements.
+ * @param new_size Number of elements the %deque should contain.
+ * @param x Data with which new elements should be populated.
+ *
+ * This function will %resize the %deque to the specified
+ * number of elements. If the number is smaller than the
+ * %deque's current size the %deque is truncated, otherwise the
+ * %deque is extended and new elements are populated with given
+ * data.
+ */
+ void
+ resize(size_type __new_size, const value_type& __x)
+ {
+ const size_type __len = size();
+ if (__new_size > __len)
+ insert(this->_M_impl._M_finish, __new_size - __len, __x);
+ else if (__new_size < __len)
+ _M_erase_at_end(this->_M_impl._M_start
+ + difference_type(__new_size));
+ }
+#else
/**
* @brief Resizes the %deque to the specified number of elements.
* @param new_size Number of elements the %deque should contain.
@@ -1101,11 +1175,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
resize(size_type __new_size, value_type __x = value_type())
{
const size_type __len = size();
- if (__new_size < __len)
- _M_erase_at_end(this->_M_impl._M_start + difference_type(__new_size));
- else
+ if (__new_size > __len)
insert(this->_M_impl._M_finish, __new_size - __len, __x);
+ else if (__new_size < __len)
+ _M_erase_at_end(this->_M_impl._M_start
+ + difference_type(__new_size));
}
+#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/** A non-binding request to reduce memory use. */
@@ -1564,6 +1640,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
_M_fill_initialize(const value_type& __value);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // called by deque(n).
+ void
+ _M_default_initialize();
+#endif
+
// Internal assign functions follow. The *_aux functions do the actual
// assignment work for the range versions.
@@ -1752,6 +1834,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->_M_impl._M_finish = __pos;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Called by resize(sz).
+ void
+ _M_default_append(size_type __n);
+#endif
+
//@{
/// Memory-handling helpers for the previous internal insert functions.
iterator
diff --git a/libstdc++-v3/include/bits/stl_iterator_base_types.h b/libstdc++-v3/include/bits/stl_iterator_base_types.h
index 07687bd2cd3..d934f434e6d 100644
--- a/libstdc++-v3/include/bits/stl_iterator_base_types.h
+++ b/libstdc++-v3/include/bits/stl_iterator_base_types.h
@@ -63,7 +63,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
_GLIBCXX_BEGIN_NAMESPACE(std)
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index 56357ed07da..d6f9255752f 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -508,6 +508,32 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
list(const allocator_type& __a)
: _Base(__a) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Creates a %list with default constructed elements.
+ * @param n The number of elements to initially create.
+ *
+ * This constructor fills the %list with @a n default
+ * constructed elements.
+ */
+ explicit
+ list(size_type __n)
+ : _Base()
+ { _M_default_initialize(__n); }
+
+ /**
+ * @brief Creates a %list with copies of an exemplar element.
+ * @param n The number of elements to initially create.
+ * @param value An element to copy.
+ * @param a An allocator object.
+ *
+ * This constructor fills the %list with @a n copies of @a value.
+ */
+ list(size_type __n, const value_type& __value,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ { _M_fill_initialize(__n, __value); }
+#else
/**
* @brief Creates a %list with copies of an exemplar element.
* @param n The number of elements to initially create.
@@ -521,6 +547,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
const allocator_type& __a = allocator_type())
: _Base(__a)
{ _M_fill_initialize(__n, __value); }
+#endif
/**
* @brief %List copy constructor.
@@ -811,6 +838,32 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
max_size() const
{ return _M_get_Node_allocator().max_size(); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Resizes the %list to the specified number of elements.
+ * @param new_size Number of elements the %list should contain.
+ *
+ * This function will %resize the %list to the specified number
+ * of elements. If the number is smaller than the %list's
+ * current size the %list is truncated, otherwise default
+ * constructed elements are appended.
+ */
+ void
+ resize(size_type __new_size);
+
+ /**
+ * @brief Resizes the %list to the specified number of elements.
+ * @param new_size Number of elements the %list should contain.
+ * @param x Data with which new elements should be populated.
+ *
+ * This function will %resize the %list to the specified number
+ * of elements. If the number is smaller than the %list's
+ * current size the %list is truncated, otherwise the %list is
+ * extended and new elements are populated with given data.
+ */
+ void
+ resize(size_type __new_size, const value_type& __x);
+#else
/**
* @brief Resizes the %list to the specified number of elements.
* @param new_size Number of elements the %list should contain.
@@ -823,6 +876,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
void
resize(size_type __new_size, value_type __x = value_type());
+#endif
// element access
/**
@@ -1394,10 +1448,23 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
_M_fill_initialize(size_type __n, const value_type& __x)
{
- for (; __n > 0; --__n)
+ for (; __n; --__n)
push_back(__x);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Called by list(n).
+ void
+ _M_default_initialize(size_type __n)
+ {
+ for (; __n; --__n)
+ emplace_back();
+ }
+
+ // Called by resize(sz).
+ void
+ _M_default_append(size_type __n);
+#endif
// Internal assign functions follow.
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 6c2b51e4c6b..c5f2986fb77 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -120,10 +120,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
: first(std::forward<_U1>(__x)),
second(std::forward<_U2>(__y)) { }
- pair(pair&& __p)
- : first(std::move(__p.first)),
- second(std::move(__p.second)) { }
-
template<class... _Args1, class... _Args2>
pair(piecewise_construct_t,
tuple<_Args1...> __first_args,
@@ -141,8 +137,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _U1, class _U2>
pair(pair<_U1, _U2>&& __p)
- : first(std::move(__p.first)),
- second(std::move(__p.second)) { }
+ : first(std::forward<_U1>(__p.first)),
+ second(std::forward<_U2>(__p.second)) { }
pair&
operator=(pair&& __p)
diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h
index a08b1ee1324..47571179c87 100644
--- a/libstdc++-v3/include/bits/stl_tempbuf.h
+++ b/libstdc++-v3/include/bits/stl_tempbuf.h
@@ -59,7 +59,6 @@
#include <bits/stl_algobase.h>
#include <bits/stl_construct.h>
-#include <bits/stl_uninitialized.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -176,6 +175,70 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
operator=(const _Temporary_buffer&);
};
+
+ template<bool>
+ struct __uninitialized_construct_buf_dispatch
+ {
+ template<typename _ForwardIterator, typename _Tp>
+ static void
+ __ucr(_ForwardIterator __first, _ForwardIterator __last,
+ _Tp& __value)
+ {
+ if(__first == __last)
+ return;
+
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ std::_Construct(std::__addressof(*__first),
+ _GLIBCXX_MOVE(__value));
+ _ForwardIterator __prev = __cur;
+ ++__cur;
+ for(; __cur != __last; ++__cur, ++__prev)
+ std::_Construct(std::__addressof(*__cur),
+ _GLIBCXX_MOVE(*__prev));
+ __value = _GLIBCXX_MOVE(*__prev);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_construct_buf_dispatch<true>
+ {
+ template<typename _ForwardIterator, typename _Tp>
+ static void
+ __ucr(_ForwardIterator, _ForwardIterator, _Tp&) { }
+ };
+
+ // Constructs objects in the range [first, last).
+ // Note that while these new objects will take valid values,
+ // their exact value is not defined. In particular they may
+ // be 'moved from'.
+ //
+ // While __value may altered during this algorithm, it will have
+ // the same value when the algorithm finishes, unless one of the
+ // constructions throws.
+ //
+ // Requirements: _ForwardIterator::value_type(_Tp&&) is valid.
+ template<typename _ForwardIterator, typename _Tp>
+ inline void
+ __uninitialized_construct_buf(_ForwardIterator __first,
+ _ForwardIterator __last,
+ _Tp& __value)
+ {
+ typedef typename std::iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::__uninitialized_construct_buf_dispatch<
+ __has_trivial_constructor(_ValueType)>::
+ __ucr(__first, __last, __value);
+ }
+
template<typename _ForwardIterator, typename _Tp>
_Temporary_buffer<_ForwardIterator, _Tp>::
_Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
@@ -189,8 +252,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_buffer = __p.first;
_M_len = __p.second;
if(_M_buffer)
- std::__uninitialized_construct_range(_M_buffer, _M_buffer + _M_len,
- *__first);
+ std::__uninitialized_construct_buf(_M_buffer, _M_buffer + _M_len,
+ *__first);
}
__catch(...)
{
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 58c63cf4376..4e9fdf73b55 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -1358,7 +1358,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// DR 130. Associative erase should return an iterator.
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- inline typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(iterator __position)
{
@@ -1377,7 +1377,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// DR 130. Associative erase should return an iterator.
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- inline typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(const_iterator __position)
{
diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h
index b78f92025c3..c5cbde0c1a4 100644
--- a/libstdc++-v3/include/bits/stl_uninitialized.h
+++ b/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -60,13 +60,13 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
- template<bool>
+ template<bool _TrivialValueTypes>
struct __uninitialized_copy
{
template<typename _InputIterator, typename _ForwardIterator>
static _ForwardIterator
- uninitialized_copy(_InputIterator __first, _InputIterator __last,
- _ForwardIterator __result)
+ __uninit_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
{
_ForwardIterator __cur = __result;
__try
@@ -88,8 +88,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
template<typename _InputIterator, typename _ForwardIterator>
static _ForwardIterator
- uninitialized_copy(_InputIterator __first, _InputIterator __last,
- _ForwardIterator __result)
+ __uninit_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
{ return std::copy(__first, __last, __result); }
};
@@ -112,19 +112,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType2;
- return std::__uninitialized_copy<(__is_pod(_ValueType1)
- && __is_pod(_ValueType2))>::
- uninitialized_copy(__first, __last, __result);
+ return std::__uninitialized_copy<(__is_trivial(_ValueType1)
+ && __is_trivial(_ValueType2))>::
+ __uninit_copy(__first, __last, __result);
}
- template<bool>
+ template<bool _TrivialValueType>
struct __uninitialized_fill
{
template<typename _ForwardIterator, typename _Tp>
static void
- uninitialized_fill(_ForwardIterator __first,
- _ForwardIterator __last, const _Tp& __x)
+ __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __x)
{
_ForwardIterator __cur = __first;
__try
@@ -145,8 +145,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
template<typename _ForwardIterator, typename _Tp>
static void
- uninitialized_fill(_ForwardIterator __first,
- _ForwardIterator __last, const _Tp& __x)
+ __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __x)
{ std::fill(__first, __last, __x); }
};
@@ -167,82 +167,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- std::__uninitialized_fill<__is_pod(_ValueType)>::
- uninitialized_fill(__first, __last, __x);
+ std::__uninitialized_fill<__is_trivial(_ValueType)>::
+ __uninit_fill(__first, __last, __x);
}
- template<bool>
- struct __uninitialized_construct_range_dispatch
- {
- template<typename _ForwardIterator, typename _Tp>
- static void
- __ucr(_ForwardIterator __first, _ForwardIterator __last,
- _Tp& __value)
- {
- if(__first == __last)
- return;
-
- _ForwardIterator __cur = __first;
- __try
- {
- std::_Construct(std::__addressof(*__first),
- _GLIBCXX_MOVE(__value));
- _ForwardIterator __prev = __cur;
- ++__cur;
- for(; __cur != __last; ++__cur, ++__prev)
- std::_Construct(std::__addressof(*__cur),
- _GLIBCXX_MOVE(*__prev));
- __value = _GLIBCXX_MOVE(*__prev);
- }
- __catch(...)
- {
- std::_Destroy(__first, __cur);
- __throw_exception_again;
- }
- }
- };
-
- template<>
- struct __uninitialized_construct_range_dispatch<true>
- {
- template<typename _ForwardIterator, typename _Tp>
- static void
- __ucr(_ForwardIterator, _ForwardIterator, _Tp&) { }
- };
-
- // Constructs objects in the range [first, last).
- // Note that while these new objects will take valid values,
- // their exact value is not defined. In particular they may
- // be 'moved from'.
- //
- // While __value may altered during this algorithm, it will have
- // the same value when the algorithm finishes, unless one of the
- // constructions throws.
- //
- // Requirements: _ForwardIterator::value_type(_Tp&&) is valid.
- template<typename _ForwardIterator, typename _Tp>
- inline void
- __uninitialized_construct_range(_ForwardIterator __first,
- _ForwardIterator __last,
- _Tp& __value)
- {
- typedef typename std::iterator_traits<_ForwardIterator>::value_type
- _ValueType;
-
- std::__uninitialized_construct_range_dispatch<
- __has_trivial_constructor(_ValueType)>::
- __ucr(__first, __last, __value);
- }
-
-
- template<bool>
+ template<bool _TrivialValueType>
struct __uninitialized_fill_n
{
template<typename _ForwardIterator, typename _Size, typename _Tp>
static void
- uninitialized_fill_n(_ForwardIterator __first, _Size __n,
- const _Tp& __x)
+ __uninit_fill_n(_ForwardIterator __first, _Size __n,
+ const _Tp& __x)
{
_ForwardIterator __cur = __first;
__try
@@ -263,8 +199,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
template<typename _ForwardIterator, typename _Size, typename _Tp>
static void
- uninitialized_fill_n(_ForwardIterator __first, _Size __n,
- const _Tp& __x)
+ __uninit_fill_n(_ForwardIterator __first, _Size __n,
+ const _Tp& __x)
{ std::fill_n(__first, __n, __x); }
};
@@ -284,8 +220,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- std::__uninitialized_fill_n<__is_pod(_ValueType)>::
- uninitialized_fill_n(__first, __n, __x);
+ std::__uninitialized_fill_n<__is_trivial(_ValueType)>::
+ __uninit_fill_n(__first, __n, __x);
}
// Extensions: versions of uninitialized_copy, uninitialized_fill,
@@ -491,6 +427,166 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Extensions: __uninitialized_default, __uninitialized_default_n,
+ // __uninitialized_default_a, __uninitialized_default_n_a.
+
+ template<bool _TrivialValueType>
+ struct __uninitialized_default_1
+ {
+ template<typename _ForwardIterator>
+ static void
+ __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __cur != __last; ++__cur)
+ std::_Construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_default_1<true>
+ {
+ template<typename _ForwardIterator>
+ static void
+ __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::fill(__first, __last, _ValueType());
+ }
+ };
+
+ template<bool _TrivialValueType>
+ struct __uninitialized_default_n_1
+ {
+ template<typename _ForwardIterator, typename _Size>
+ static void
+ __uninit_default_n(_ForwardIterator __first, _Size __n)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __n > 0; --__n, ++__cur)
+ std::_Construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_default_n_1<true>
+ {
+ template<typename _ForwardIterator, typename _Size>
+ static void
+ __uninit_default_n(_ForwardIterator __first, _Size __n)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::fill_n(__first, __n, _ValueType());
+ }
+ };
+
+ // __uninitialized_default
+ // Fills [first, last) with std::distance(first, last) default
+ // constructed value_types(s).
+ template<typename _ForwardIterator>
+ inline void
+ __uninitialized_default(_ForwardIterator __first,
+ _ForwardIterator __last)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::__uninitialized_default_1<__is_trivial(_ValueType)>::
+ __uninit_default(__first, __last);
+ }
+
+ // __uninitialized_default_n
+ // Fills [first, first + n) with n default constructed value_type(s).
+ template<typename _ForwardIterator, typename _Size>
+ inline void
+ __uninitialized_default_n(_ForwardIterator __first, _Size __n)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::__uninitialized_default_n_1<__is_trivial(_ValueType)>::
+ __uninit_default_n(__first, __n);
+ }
+
+
+ // __uninitialized_default_a
+ // Fills [first, last) with std::distance(first, last) default
+ // constructed value_types(s), constructed with the allocator alloc.
+ template<typename _ForwardIterator, typename _Allocator>
+ void
+ __uninitialized_default_a(_ForwardIterator __first,
+ _ForwardIterator __last,
+ _Allocator& __alloc)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __cur != __last; ++__cur)
+ __alloc.construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _ForwardIterator, typename _Tp>
+ inline void
+ __uninitialized_default_a(_ForwardIterator __first,
+ _ForwardIterator __last,
+ allocator<_Tp>&)
+ { std::__uninitialized_default(__first, __last); }
+
+
+ // __uninitialized_default_n_a
+ // Fills [first, first + n) with n default constructed value_types(s),
+ // constructed with the allocator alloc.
+ template<typename _ForwardIterator, typename _Size, typename _Allocator>
+ void
+ __uninitialized_default_n_a(_ForwardIterator __first, _Size __n,
+ _Allocator& __alloc)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __n > 0; --__n, ++__cur)
+ __alloc.construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _ForwardIterator, typename _Size, typename _Tp>
+ inline void
+ __uninitialized_default_n_a(_ForwardIterator __first, _Size __n,
+ allocator<_Tp>&)
+ { std::__uninitialized_default_n(__first, __n); }
+
+
template<typename _InputIterator, typename _Size,
typename _ForwardIterator>
_ForwardIterator
@@ -501,8 +597,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
for (; __n > 0; --__n, ++__first, ++__cur)
- ::new(static_cast<void*>(std::__addressof(*__cur))) typename
- iterator_traits<_ForwardIterator>::value_type(*__first);
+ std::_Construct(std::__addressof(*__cur), *__first);
return __cur;
}
__catch(...)
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index f025b4eeb45..d51578c9e05 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -107,6 +107,14 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_Vector_base(const allocator_type& __a)
: _M_impl(__a) { }
+ _Vector_base(size_t __n)
+ : _M_impl()
+ {
+ this->_M_impl._M_start = this->_M_allocate(__n);
+ this->_M_impl._M_finish = this->_M_impl._M_start;
+ this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
+ }
+
_Vector_base(size_t __n, const allocator_type& __a)
: _M_impl(__a)
{
@@ -215,6 +223,32 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
vector(const allocator_type& __a)
: _Base(__a) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Creates a %vector with default constructed elements.
+ * @param n The number of elements to initially create.
+ *
+ * This constructor fills the %vector with @a n default
+ * constructed elements.
+ */
+ explicit
+ vector(size_type __n)
+ : _Base(__n)
+ { _M_default_initialize(__n); }
+
+ /**
+ * @brief Creates a %vector with copies of an exemplar element.
+ * @param n The number of elements to initially create.
+ * @param value An element to copy.
+ * @param a An allocator.
+ *
+ * This constructor fills the %vector with @a n copies of @a value.
+ */
+ vector(size_type __n, const value_type& __value,
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __a)
+ { _M_fill_initialize(__n, __value); }
+#else
/**
* @brief Creates a %vector with copies of an exemplar element.
* @param n The number of elements to initially create.
@@ -228,6 +262,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
const allocator_type& __a = allocator_type())
: _Base(__n, __a)
{ _M_fill_initialize(__n, __value); }
+#endif
/**
* @brief %Vector copy constructor.
@@ -538,6 +573,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
max_size() const
{ return _M_get_Tp_allocator().max_size(); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Resizes the %vector to the specified number of elements.
+ * @param new_size Number of elements the %vector should contain.
+ *
+ * This function will %resize the %vector to the specified
+ * number of elements. If the number is smaller than the
+ * %vector's current size the %vector is truncated, otherwise
+ * default constructed elements are appended.
+ */
+ void
+ resize(size_type __new_size)
+ {
+ if (__new_size > size())
+ _M_default_append(__new_size - size());
+ else if (__new_size < size())
+ _M_erase_at_end(this->_M_impl._M_start + __new_size);
+ }
+
/**
* @brief Resizes the %vector to the specified number of elements.
* @param new_size Number of elements the %vector should contain.
@@ -550,13 +604,34 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* given data.
*/
void
- resize(size_type __new_size, value_type __x = value_type())
+ resize(size_type __new_size, const value_type& __x)
{
- if (__new_size < size())
+ if (__new_size > size())
+ insert(end(), __new_size - size(), __x);
+ else if (__new_size < size())
_M_erase_at_end(this->_M_impl._M_start + __new_size);
- else
+ }
+#else
+ /**
+ * @brief Resizes the %vector to the specified number of elements.
+ * @param new_size Number of elements the %vector should contain.
+ * @param x Data with which new elements should be populated.
+ *
+ * This function will %resize the %vector to the specified
+ * number of elements. If the number is smaller than the
+ * %vector's current size the %vector is truncated, otherwise
+ * the %vector is extended and new elements are populated with
+ * given data.
+ */
+ void
+ resize(size_type __new_size, value_type __x = value_type())
+ {
+ if (__new_size > size())
insert(end(), __new_size - size(), __x);
+ else if (__new_size < size())
+ _M_erase_at_end(this->_M_impl._M_start + __new_size);
}
+#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/** A non-binding request to reduce capacity() to size(). */
@@ -1049,6 +1124,16 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Called by the vector(n) constructor.
+ void
+ _M_default_initialize(size_type __n)
+ {
+ std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
+ }
+#endif
// Internal assign functions follow. The *_aux functions do the actual
// assignment work for the range versions.
@@ -1131,6 +1216,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
_M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Called by resize(n).
+ void
+ _M_default_append(size_type __n);
+#endif
+
// Called by insert(p,x)
#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h
index 7b07ca477f4..ac62ff7f304 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -81,7 +81,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
class unique_ptr
{
typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
- typedef _Tp* unique_ptr::* __unspecified_pointer_type;
// use SFINAE to determine whether _Del::pointer exists
class _Pointer
@@ -126,6 +125,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); }
+ unique_ptr(nullptr_t)
+ : _M_t(pointer(), deleter_type())
+ { }
+
// Move constructors.
unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
@@ -157,7 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
unique_ptr&
- operator=(__unspecified_pointer_type)
+ operator=(nullptr_t)
{
reset();
return *this;
@@ -230,11 +233,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// [unique.ptr.runtime]
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 740 - omit specialization for array objects with a compile time length
- template<typename _Tp, typename _Tp_Deleter>
+ template<typename _Tp, typename _Tp_Deleter>
class unique_ptr<_Tp[], _Tp_Deleter>
{
typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
- typedef _Tp* unique_ptr::* __unspecified_pointer_type;
public:
typedef _Tp* pointer;
@@ -264,6 +266,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); }
+ /* TODO: use delegating constructor */
+ unique_ptr(nullptr_t)
+ : _M_t(pointer(), deleter_type())
+ { }
+
// Move constructors.
unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
@@ -295,7 +302,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
unique_ptr&
- operator=(__unspecified_pointer_type)
+ operator=(nullptr_t)
{
reset();
return *this;
@@ -338,7 +345,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
using std::swap;
swap(std::get<0>(_M_t), __p);
- if (__p != pointer())
+ if (__p != nullptr)
+ get_deleter()(__p);
+ }
+
+ void
+ reset(nullptr_t)
+ {
+ pointer __p = get();
+ std::get<0>(_M_t) = pointer();
+ if (__p != nullptr)
get_deleter()(__p);
}
@@ -428,6 +444,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const unique_ptr<_Up, _Up_Deleter>& __y)
{ return !(__x.get() < __y.get()); }
+ /// std::hash specialization for unique_ptr.
+ template<typename _Tp, typename _Tp_Deleter>
+ struct hash<unique_ptr<_Tp, _Tp_Deleter>>
+ : public std::unary_function<unique_ptr<_Tp, _Tp_Deleter>, size_t>
+ {
+ size_t
+ operator()(const unique_ptr<_Tp, _Tp_Deleter>& __u) const
+ {
+ typedef unique_ptr<_Tp, _Tp_Deleter> _UP;
+ return std::hash<typename _UP::pointer>()(__u.get());
+ }
+ };
+
// @} group pointer_abstractions
_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 74998ff7725..80b970c8cf5 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -82,6 +82,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
+ __unordered_map(const __unordered_map& __x) = default;
+
__unordered_map(__unordered_map&& __x)
: _Base(std::forward<_Base>(__x)) { }
};
@@ -137,6 +139,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
+ __unordered_multimap(const __unordered_multimap& __x) = default;
+
__unordered_multimap(__unordered_multimap&& __x)
: _Base(std::forward<_Base>(__x)) { }
};
@@ -246,6 +250,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+ unordered_map(const unordered_map& __x) = default;
+
unordered_map(unordered_map&& __x)
: _Base(std::forward<_Base>(__x)) { }
@@ -258,6 +264,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ }
unordered_map&
+ operator=(const unordered_map& __x) = default;
+
+ unordered_map&
operator=(unordered_map&& __x)
{
// NB: DR 1204.
@@ -328,6 +337,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+ unordered_multimap(const unordered_multimap& __x) = default;
+
unordered_multimap(unordered_multimap&& __x)
: _Base(std::forward<_Base>(__x)) { }
@@ -340,6 +351,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ }
unordered_multimap&
+ operator=(const unordered_multimap& __x) = default;
+
+ unordered_multimap&
operator=(unordered_multimap&& __x)
{
// NB: DR 1204.
diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h
index 50dee215e16..8682f2d7237 100644
--- a/libstdc++-v3/include/bits/unordered_set.h
+++ b/libstdc++-v3/include/bits/unordered_set.h
@@ -82,6 +82,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
std::_Identity<_Value>(), __a)
{ }
+ __unordered_set(const __unordered_set& __x) = default;
+
__unordered_set(__unordered_set&& __x)
: _Base(std::forward<_Base>(__x)) { }
};
@@ -135,6 +137,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
std::_Identity<_Value>(), __a)
{ }
+ __unordered_multiset(const __unordered_multiset& __x) = default;
+
__unordered_multiset(__unordered_multiset&& __x)
: _Base(std::forward<_Base>(__x)) { }
};
@@ -239,6 +243,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+ unordered_set(const unordered_set& __x) = default;
+
unordered_set(unordered_set&& __x)
: _Base(std::forward<_Base>(__x)) { }
@@ -251,6 +257,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ }
unordered_set&
+ operator=(const unordered_set& __x) = default;
+
+ unordered_set&
operator=(unordered_set&& __x)
{
// NB: DR 1204.
@@ -318,6 +327,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+ unordered_multiset(const unordered_multiset& __x) = default;
+
unordered_multiset(unordered_multiset&& __x)
: _Base(std::forward<_Base>(__x)) { }
@@ -330,6 +341,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ }
unordered_multiset&
+ operator=(const unordered_multiset& __x) = default;
+
+ unordered_multiset&
operator=(unordered_multiset&& __x)
{
// NB: DR 1204.
diff --git a/libstdc++-v3/include/bits/valarray_array.h b/libstdc++-v3/include/bits/valarray_array.h
index a12b3347b9d..7aa61f14d81 100644
--- a/libstdc++-v3/include/bits/valarray_array.h
+++ b/libstdc++-v3/include/bits/valarray_array.h
@@ -1,7 +1,7 @@
// The template and inlines for the -*- C++ -*- internal _Array helper class.
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009
+// 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -127,7 +127,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
inline void
__valarray_fill_construct(_Tp* __b, _Tp* __e, const _Tp __t)
{
- _Array_init_ctor<_Tp, __is_pod(_Tp)>::_S_do_it(__b, __e, __t);
+ _Array_init_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __t);
}
//
@@ -160,7 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__valarray_copy_construct(const _Tp* __b, const _Tp* __e,
_Tp* __restrict__ __o)
{
- _Array_copy_ctor<_Tp, __is_pod(_Tp)>::_S_do_it(__b, __e, __o);
+ _Array_copy_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __o);
}
// copy-construct raw array [__o, *) from strided array __a[<__n : __s>]
@@ -169,7 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n,
size_t __s, _Tp* __restrict__ __o)
{
- if (__is_pod(_Tp))
+ if (__is_trivial(_Tp))
while (__n--)
{
*__o++ = *__a;
@@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_t* __restrict__ __i,
_Tp* __restrict__ __o, size_t __n)
{
- if (__is_pod(_Tp))
+ if (__is_trivial(_Tp))
while (__n--)
*__o++ = __a[*__i++];
else
@@ -203,7 +203,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
inline void
__valarray_destroy_elements(_Tp* __b, _Tp* __e)
{
- if (!__is_pod(_Tp))
+ if (!__is_trivial(_Tp))
while (__b != __e)
{
__b->~_Tp();
@@ -267,7 +267,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__valarray_copy(const _Tp* __restrict__ __a, size_t __n,
_Tp* __restrict__ __b)
{
- _Array_copier<_Tp, __is_pod(_Tp)>::_S_do_it(__a, __n, __b);
+ _Array_copier<_Tp, __is_trivial(_Tp)>::_S_do_it(__a, __n, __b);
}
// Copy strided array __a[<__n : __s>] in plain __b[<__n>]
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index e1097931048..846a0645d57 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -458,6 +458,59 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
}
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ void
+ vector<_Tp, _Alloc>::
+ _M_default_append(size_type __n)
+ {
+ if (__n != 0)
+ {
+ if (size_type(this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_finish) >= __n)
+ {
+ std::__uninitialized_default_n_a(this->_M_impl._M_finish,
+ __n, _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __n;
+ }
+ else
+ {
+ const size_type __len =
+ _M_check_len(__n, "vector::_M_default_append");
+ const size_type __old_size = this->size();
+ pointer __new_start(this->_M_allocate(__len));
+ pointer __new_finish(__new_start);
+ __try
+ {
+ __new_finish =
+ std::__uninitialized_move_a(this->_M_impl._M_start,
+ this->_M_impl._M_finish,
+ __new_start,
+ _M_get_Tp_allocator());
+ std::__uninitialized_default_n_a(__new_finish, __n,
+ _M_get_Tp_allocator());
+ __new_finish += __n;
+ }
+ __catch(...)
+ {
+ std::_Destroy(__new_start, __new_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(__new_start, __len);
+ __throw_exception_again;
+ }
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(this->_M_impl._M_start,
+ this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ this->_M_impl._M_start = __new_start;
+ this->_M_impl._M_finish = __new_finish;
+ this->_M_impl._M_end_of_storage = __new_start + __len;
+ }
+ }
+ }
+#endif
+
template<typename _Tp, typename _Alloc>
template<typename _InputIterator>
void
diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef
index ce2d310244c..d9a7383e68d 100644
--- a/libstdc++-v3/include/c_global/cstddef
+++ b/libstdc++-v3/include/c_global/cstddef
@@ -42,15 +42,3 @@
#include <bits/c++config.h>
#include <stddef.h>
-
-#ifndef _GLIBCXX_CSTDDEF
-#define _GLIBCXX_CSTDDEF 1
-
-_GLIBCXX_BEGIN_NAMESPACE(std)
-
- using ::ptrdiff_t;
- using ::size_t;
-
-_GLIBCXX_END_NAMESPACE
-
-#endif
diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
index f87af196936..b547fbe40b8 100644
--- a/libstdc++-v3/include/c_global/cstdio
+++ b/libstdc++-v3/include/c_global/cstdio
@@ -41,7 +41,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#include <stdio.h>
#ifndef _GLIBCXX_CSTDIO
@@ -151,13 +150,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
extern "C" int
- (snprintf)(char * restrict, size_t, const char * restrict, ...) throw ();
+ (snprintf)(char * restrict, std::size_t, const char * restrict, ...) throw ();
extern "C" int
(vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
extern "C" int
- (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list)
- throw ();
+ (vsnprintf)(char * restrict, std::size_t, const char * restrict,
+ __gnuc_va_list) throw ();
extern "C" int
(vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list)
throw ();
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index f4ff810cf71..da95c0fe56c 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -41,7 +41,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#ifndef _GLIBCXX_CSTDLIB
#define _GLIBCXX_CSTDLIB 1
diff --git a/libstdc++-v3/include/c_global/cstring b/libstdc++-v3/include/c_global/cstring
index 445202035d5..21721be67ed 100644
--- a/libstdc++-v3/include/c_global/cstring
+++ b/libstdc++-v3/include/c_global/cstring
@@ -41,7 +41,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#include <string.h>
#ifndef _GLIBCXX_CSTRING
diff --git a/libstdc++-v3/include/c_global/ctime b/libstdc++-v3/include/c_global/ctime
index 55f1f069766..f5bb49ccbc9 100644
--- a/libstdc++-v3/include/c_global/ctime
+++ b/libstdc++-v3/include/c_global/ctime
@@ -40,7 +40,7 @@
#pragma GCC system_header
-#include <cstddef>
+#include <bits/c++config.h>
#include <time.h>
#ifndef _GLIBCXX_CTIME
diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar
index 537f39a023b..b16eb468572 100644
--- a/libstdc++-v3/include/c_global/cwchar
+++ b/libstdc++-v3/include/c_global/cwchar
@@ -41,7 +41,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#if _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
diff --git a/libstdc++-v3/include/c_global/cwctype b/libstdc++-v3/include/c_global/cwctype
index be649a28950..2ac1155aa9b 100644
--- a/libstdc++-v3/include/c_global/cwctype
+++ b/libstdc++-v3/include/c_global/cwctype
@@ -43,9 +43,15 @@
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_WCTYPE_H
-#include <wctype.h>
+
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10
+// Work around glibc BZ 9694
+#include <stddef.h>
#endif
+#include <wctype.h>
+#endif // _GLIBCXX_HAVE_WCTYPE_H
+
#ifndef _GLIBCXX_CWCTYPE
#define _GLIBCXX_CWCTYPE 1
diff --git a/libstdc++-v3/include/c_std/cstddef b/libstdc++-v3/include/c_std/cstddef
index 93fed5db6ac..006c432d7bc 100644
--- a/libstdc++-v3/include/c_std/cstddef
+++ b/libstdc++-v3/include/c_std/cstddef
@@ -45,11 +45,4 @@
#include <bits/c++config.h>
#include <stddef.h>
-_GLIBCXX_BEGIN_NAMESPACE(std)
-
- using ::ptrdiff_t;
- using ::size_t;
-
-_GLIBCXX_END_NAMESPACE
-
#endif
diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
index a697437a662..4a8acdddb62 100644
--- a/libstdc++-v3/include/c_std/cstdio
+++ b/libstdc++-v3/include/c_std/cstdio
@@ -43,8 +43,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
-
#include <stdio.h>
// Get rid of those macros defined in <stdio.h> in lieu of real functions.
@@ -151,13 +149,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
extern "C" int
- (snprintf)(char * restrict, size_t, const char * restrict, ...) throw ();
+ (snprintf)(char * restrict, std::size_t, const char * restrict, ...) throw ();
extern "C" int
(vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
extern "C" int
- (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list)
- throw ();
+ (vsnprintf)(char * restrict, std::size_t, const char * restrict,
+ __gnuc_va_list) throw ();
extern "C" int
(vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list)
throw ();
diff --git a/libstdc++-v3/include/c_std/cstdlib b/libstdc++-v3/include/c_std/cstdlib
index c1e3379c121..734745a6775 100644
--- a/libstdc++-v3/include/c_std/cstdlib
+++ b/libstdc++-v3/include/c_std/cstdlib
@@ -43,7 +43,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#if !_GLIBCXX_HOSTED
// The C standard does not require a freestanding implementation to
diff --git a/libstdc++-v3/include/c_std/cstring b/libstdc++-v3/include/c_std/cstring
index 914365655ec..06bf12fba9d 100644
--- a/libstdc++-v3/include/c_std/cstring
+++ b/libstdc++-v3/include/c_std/cstring
@@ -44,7 +44,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#include <string.h>
// Get rid of those macros defined in <string.h> in lieu of real functions.
diff --git a/libstdc++-v3/include/c_std/ctime b/libstdc++-v3/include/c_std/ctime
index dca90eb8d88..459c8fc7b60 100644
--- a/libstdc++-v3/include/c_std/ctime
+++ b/libstdc++-v3/include/c_std/ctime
@@ -42,7 +42,7 @@
#pragma GCC system_header
-#include <cstddef>
+#include <bits/c++config.h>
#include <time.h>
// Get rid of those macros defined in <time.h> in lieu of real functions.
diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar
index 3d503674ed1..20c6ca3512a 100644
--- a/libstdc++-v3/include/c_std/cwchar
+++ b/libstdc++-v3/include/c_std/cwchar
@@ -44,7 +44,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#if _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
diff --git a/libstdc++-v3/include/c_std/cwctype b/libstdc++-v3/include/c_std/cwctype
index 4af425067b9..d6750390a0a 100644
--- a/libstdc++-v3/include/c_std/cwctype
+++ b/libstdc++-v3/include/c_std/cwctype
@@ -45,9 +45,15 @@
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_WCTYPE_H
-#include <wctype.h>
+
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10
+// Work around glibc BZ 9694
+#include <stddef.h>
#endif
+#include <wctype.h>
+#endif // _GLIBCXX_HAVE_WCTYPE_H
+
// Get rid of those macros defined in <wctype.h> in lieu of real functions.
#undef iswalnum
#undef iswalpha
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 0c98006badb..31f708a9c9d 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -67,12 +67,24 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.1.1 construct/copy/destroy:
- explicit deque(const _Allocator& __a = _Allocator())
+ explicit
+ deque(const _Allocator& __a = _Allocator())
: _Base(__a) { }
- explicit deque(size_type __n, const _Tp& __value = _Tp(),
- const _Allocator& __a = _Allocator())
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ deque(size_type __n)
+ : _Base(__n) { }
+
+ deque(size_type __n, const _Tp& __value,
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a) { }
+#else
+ explicit
+ deque(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
+#endif
template<class _InputIterator>
deque(_InputIterator __first, _InputIterator __last,
@@ -208,6 +220,39 @@ namespace __debug
using _Base::size;
using _Base::max_size;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ resize(size_type __sz)
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
+
+ bool __invalidate_all = __sz > this->size();
+ if (__sz < this->size())
+ this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));
+
+ _Base::resize(__sz);
+
+ if (__invalidate_all)
+ this->_M_invalidate_all();
+ }
+
+ void
+ resize(size_type __sz, const _Tp& __c)
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
+
+ bool __invalidate_all = __sz > this->size();
+ if (__sz < this->size())
+ this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));
+
+ _Base::resize(__sz, __c);
+
+ if (__invalidate_all)
+ this->_M_invalidate_all();
+ }
+#else
void
resize(size_type __sz, _Tp __c = _Tp())
{
@@ -223,6 +268,7 @@ namespace __debug
if (__invalidate_all)
this->_M_invalidate_all();
}
+#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
using _Base::shrink_to_fit;
diff --git a/libstdc++-v3/include/debug/formatter.h b/libstdc++-v3/include/debug/formatter.h
index b4b43896d04..a98ebd84a8d 100644
--- a/libstdc++-v3/include/debug/formatter.h
+++ b/libstdc++-v3/include/debug/formatter.h
@@ -338,7 +338,7 @@ namespace __gnu_debug
const _Error_formatter&
_M_iterator(const _Iterator& __it, const char* __name = 0) const
{
- if (_M_num_parameters < size_t(__max_parameters))
+ if (_M_num_parameters < std::size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__it, __name,
_Is_iterator());
return *this;
@@ -347,7 +347,7 @@ namespace __gnu_debug
const _Error_formatter&
_M_integer(long __value, const char* __name = 0) const
{
- if (_M_num_parameters < size_t(__max_parameters))
+ if (_M_num_parameters < std::size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
return *this;
}
@@ -355,7 +355,7 @@ namespace __gnu_debug
const _Error_formatter&
_M_string(const char* __value, const char* __name = 0) const
{
- if (_M_num_parameters < size_t(__max_parameters))
+ if (_M_num_parameters < std::size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
return *this;
}
@@ -364,7 +364,7 @@ namespace __gnu_debug
const _Error_formatter&
_M_sequence(const _Sequence& __seq, const char* __name = 0) const
{
- if (_M_num_parameters < size_t(__max_parameters))
+ if (_M_num_parameters < std::size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
_Is_sequence());
return *this;
@@ -381,7 +381,7 @@ namespace __gnu_debug
_M_error() const;
private:
- _Error_formatter(const char* __file, size_t __line)
+ _Error_formatter(const char* __file, std::size_t __line)
: _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0),
_M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false)
{ _M_get_max_length(); }
@@ -402,19 +402,19 @@ namespace __gnu_debug
enum { __max_parameters = 9 };
const char* _M_file;
- size_t _M_line;
+ std::size_t _M_line;
mutable _Parameter _M_parameters[__max_parameters];
- mutable size_t _M_num_parameters;
+ mutable std::size_t _M_num_parameters;
mutable const char* _M_text;
- mutable size_t _M_max_length;
+ mutable std::size_t _M_max_length;
enum { _M_indent = 4 } ;
- mutable size_t _M_column;
+ mutable std::size_t _M_column;
mutable bool _M_first_line;
mutable bool _M_wordwrap;
public:
static _Error_formatter
- _M_at(const char* __file, size_t __line)
+ _M_at(const char* __file, std::size_t __line)
{ return _Error_formatter(__file, __line); }
};
} // namespace __gnu_debug
diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h
index a4b1d785844..237c0e66909 100644
--- a/libstdc++-v3/include/debug/functions.h
+++ b/libstdc++-v3/include/debug/functions.h
@@ -1,6 +1,6 @@
// Debugging support implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -31,7 +31,6 @@
#define _GLIBCXX_DEBUG_FUNCTIONS_H 1
#include <bits/c++config.h>
-#include <cstddef> // for ptrdiff_t
#include <bits/stl_iterator_base_types.h> // for iterator_traits, categories
#include <bits/cpp_type_traits.h> // for __is_integer
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index 39a64818830..c65ed5829f2 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -67,12 +67,24 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.2.1 construct/copy/destroy:
- explicit list(const _Allocator& __a = _Allocator())
+ explicit
+ list(const _Allocator& __a = _Allocator())
: _Base(__a) { }
- explicit list(size_type __n, const _Tp& __value = _Tp(),
- const _Allocator& __a = _Allocator())
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ list(size_type __n)
+ : _Base(__n) { }
+
+ list(size_type __n, const _Tp& __value,
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a) { }
+#else
+ explicit
+ list(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
+#endif
template<class _InputIterator>
list(_InputIterator __first, _InputIterator __last,
@@ -208,6 +220,63 @@ namespace __debug
using _Base::size;
using _Base::max_size;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ resize(size_type __sz)
+ {
+ this->_M_detach_singular();
+
+ // if __sz < size(), invalidate all iterators in [begin+__sz, end())
+ iterator __victim = begin();
+ iterator __end = end();
+ for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+ ++__victim;
+
+ while (__victim != __end)
+ {
+ iterator __real_victim = __victim++;
+ __real_victim._M_invalidate();
+ }
+
+ __try
+ {
+ _Base::resize(__sz);
+ }
+ __catch(...)
+ {
+ this->_M_revalidate_singular();
+ __throw_exception_again;
+ }
+ }
+
+ void
+ resize(size_type __sz, const _Tp& __c)
+ {
+ this->_M_detach_singular();
+
+ // if __sz < size(), invalidate all iterators in [begin+__sz, end())
+ iterator __victim = begin();
+ iterator __end = end();
+ for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+ ++__victim;
+
+ while (__victim != __end)
+ {
+ iterator __real_victim = __victim++;
+ __real_victim._M_invalidate();
+ }
+
+ __try
+ {
+ _Base::resize(__sz, __c);
+ }
+ __catch(...)
+ {
+ this->_M_revalidate_singular();
+ __throw_exception_again;
+ }
+ }
+#else
void
resize(size_type __sz, _Tp __c = _Tp())
{
@@ -235,6 +304,7 @@ namespace __debug
__throw_exception_again;
}
}
+#endif
// element access:
reference
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index ea55b080442..c81f956212e 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -72,12 +72,24 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.4.1 construct/copy/destroy:
- explicit vector(const _Allocator& __a = _Allocator())
+ explicit
+ vector(const _Allocator& __a = _Allocator())
: _Base(__a), _M_guaranteed_capacity(0) { }
- explicit vector(size_type __n, const _Tp& __value = _Tp(),
- const _Allocator& __a = _Allocator())
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ vector(size_type __n)
+ : _Base(__n), _M_guaranteed_capacity(__n) { }
+
+ vector(size_type __n, const _Tp& __value,
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { }
+#else
+ explicit
+ vector(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { }
+#endif
template<class _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
@@ -226,6 +238,31 @@ namespace __debug
using _Base::size;
using _Base::max_size;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ resize(size_type __sz)
+ {
+ bool __realloc = _M_requires_reallocation(__sz);
+ if (__sz < this->size())
+ this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));
+ _Base::resize(__sz);
+ if (__realloc)
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+
+ void
+ resize(size_type __sz, const _Tp& __c)
+ {
+ bool __realloc = _M_requires_reallocation(__sz);
+ if (__sz < this->size())
+ this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));
+ _Base::resize(__sz, __c);
+ if (__realloc)
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+#else
void
resize(size_type __sz, _Tp __c = _Tp())
{
@@ -237,6 +274,7 @@ namespace __debug
this->_M_invalidate_all();
_M_update_guaranteed_capacity();
}
+#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
using _Base::shrink_to_fit;
diff --git a/libstdc++-v3/include/ext/algorithm b/libstdc++-v3/include/ext/algorithm
index 5956e24bcd0..cac4ff70e8e 100644
--- a/libstdc++-v3/include/ext/algorithm
+++ b/libstdc++-v3/include/ext/algorithm
@@ -123,8 +123,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_InputIterator>::value_type>)
- return __copy_n(__first, __count, __result,
- std::__iterator_category(__first));
+ return __gnu_cxx::__copy_n(__first, __count, __result,
+ std::__iterator_category(__first));
}
template<typename _InputIterator1, typename _InputIterator2>
diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h
index 36f15fe936c..ca4d0d19b01 100644
--- a/libstdc++-v3/include/ext/array_allocator.h
+++ b/libstdc++-v3/include/ext/array_allocator.h
@@ -30,7 +30,7 @@
#ifndef _ARRAY_ALLOCATOR_H
#define _ARRAY_ALLOCATOR_H 1
-#include <cstddef>
+#include <bits/c++config.h>
#include <new>
#include <bits/functexcept.h>
#include <tr1/array>
@@ -114,7 +114,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
struct rebind
{ typedef array_allocator<_Tp1, _Array1> other; };
- array_allocator(array_type* __array = NULL) throw()
+ array_allocator(array_type* __array = 0) throw()
: _M_array(__array), _M_used(size_type()) { }
array_allocator(const array_allocator& __o) throw()
@@ -122,7 +122,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
template<typename _Tp1, typename _Array1>
array_allocator(const array_allocator<_Tp1, _Array1>&) throw()
- : _M_array(NULL), _M_used(size_type()) { }
+ : _M_array(0), _M_used(size_type()) { }
~array_allocator() throw() { }
diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h
index 05285f548cc..2aa08706c9d 100644
--- a/libstdc++-v3/include/ext/bitmap_allocator.h
+++ b/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -30,9 +30,8 @@
#ifndef _BITMAP_ALLOCATOR_H
#define _BITMAP_ALLOCATOR_H 1
-#include <cstddef> // For std::size_t, and ptrdiff_t.
-#include <bits/functexcept.h> // For __throw_bad_alloc().
#include <utility> // For std::pair.
+#include <bits/functexcept.h> // For __throw_bad_alloc().
#include <functional> // For greater_equal, and less_equal.
#include <new> // For operator new.
#include <debug/debug.h> // _GLIBCXX_DEBUG_ASSERT
diff --git a/libstdc++-v3/include/ext/codecvt_specializations.h b/libstdc++-v3/include/ext/codecvt_specializations.h
index 89adb3f20d4..53295891bac 100644
--- a/libstdc++-v3/include/ext/codecvt_specializations.h
+++ b/libstdc++-v3/include/ext/codecvt_specializations.h
@@ -1,7 +1,8 @@
// Locale support (codecvt) -*- C++ -*-
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
-// Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -381,7 +382,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Argument list for iconv specifies a byte sequence. Thus,
// all to/from arrays must be brutally casted to char*.
char* __cto = reinterpret_cast<char*>(__to);
- size_t __conv = __iconv_adaptor(iconv,__desc, NULL, NULL,
+ size_t __conv = __iconv_adaptor(iconv,__desc, 0, 0,
&__cto, &__tlen);
if (__conv != size_t(-1))
diff --git a/libstdc++-v3/include/ext/functional b/libstdc++-v3/include/ext/functional
index 546b9c68d6c..7cf6a45a0a3 100644
--- a/libstdc++-v3/include/ext/functional
+++ b/libstdc++-v3/include/ext/functional
@@ -1,6 +1,6 @@
// Functional extensions -*- C++ -*-
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -60,7 +60,6 @@
#pragma GCC system_header
#include <functional>
-#include <cstddef>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 8fdb2f6393b..1f6561db464 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -154,11 +154,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
explicit
__pool_base()
- : _M_options(_Tune()), _M_binmap(NULL), _M_init(false) { }
+ : _M_options(_Tune()), _M_binmap(0), _M_init(false) { }
explicit
__pool_base(const _Tune& __options)
- : _M_options(__options), _M_binmap(NULL), _M_init(false) { }
+ : _M_options(__options), _M_binmap(0), _M_init(false) { }
private:
explicit
@@ -235,10 +235,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ }
explicit __pool()
- : _M_bin(NULL), _M_bin_size(1) { }
+ : _M_bin(0), _M_bin_size(1) { }
explicit __pool(const __pool_base::_Tune& __tune)
- : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1) { }
+ : __pool_base(__tune), _M_bin(0), _M_bin_size(1) { }
private:
// An "array" of bin_records each of which represents a specific
@@ -358,12 +358,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_M_get_thread_id();
explicit __pool()
- : _M_bin(NULL), _M_bin_size(1), _M_thread_freelist(NULL)
+ : _M_bin(0), _M_bin_size(1), _M_thread_freelist(0)
{ }
explicit __pool(const __pool_base::_Tune& __tune)
- : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1),
- _M_thread_freelist(NULL)
+ : __pool_base(__tune), _M_bin(0), _M_bin_size(1),
+ _M_thread_freelist(0)
{ }
private:
diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h
index beaddddf9ee..54505654207 100644
--- a/libstdc++-v3/include/ext/new_allocator.h
+++ b/libstdc++-v3/include/ext/new_allocator.h
@@ -30,6 +30,7 @@
#ifndef _NEW_ALLOCATOR_H
#define _NEW_ALLOCATOR_H 1
+#include <bits/c++config.h>
#include <new>
#include <bits/functexcept.h>
#include <bits/move.h>
diff --git a/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp b/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp
index dca953b4911..9cec3b72c54 100644
--- a/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp
@@ -41,6 +41,7 @@
#ifndef PB_DS_ASSOC_CNTNR_HPP
#define PB_DS_ASSOC_CNTNR_HPP
+#include <bits/c++config.h>
#include <ext/typelist.h>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
index 757b90956de..d9cc2dbfc44 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
@@ -38,8 +38,8 @@
* Contains an implementation class for tree-like classes.
*/
-#ifndef PB_DS_NULL_NODE_METADATA_HPP
-#define PB_DS_NULL_NODE_METADATA_HPP
+#ifndef PB_DS_0_NODE_METADATA_HPP
+#define PB_DS_0_NODE_METADATA_HPP
#include <ext/pb_ds/detail/types_traits.hpp>
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
index 925d204dc6b..b9f80e960aa 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
@@ -92,7 +92,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
__try
{
m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);
- if (m_p_head->m_p_parent != NULL)
+ if (m_p_head->m_p_parent != 0)
m_p_head->m_p_parent->m_p_parent = m_p_head;
m_size = other.m_size;
initialize_min_max();
@@ -142,7 +142,7 @@ void
PB_DS_CLASS_C_DEC::
initialize()
{
- m_p_head->m_p_parent = NULL;
+ m_p_head->m_p_parent = 0;
m_p_head->m_p_left = m_p_head;
m_p_head->m_p_right = m_p_head;
m_size = 0;
@@ -153,8 +153,8 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
recursive_copy_node(const node_pointer p_nd)
{
- if (p_nd == NULL)
- return (NULL);
+ if (p_nd == 0)
+ return (0);
node_pointer p_ret = s_node_allocator.allocate(1);
__try
@@ -167,7 +167,7 @@ recursive_copy_node(const node_pointer p_nd)
__throw_exception_again;
}
- p_ret->m_p_left = p_ret->m_p_right = NULL;
+ p_ret->m_p_left = p_ret->m_p_right = 0;
__try
{
@@ -180,10 +180,10 @@ recursive_copy_node(const node_pointer p_nd)
__throw_exception_again;
}
- if (p_ret->m_p_left != NULL)
+ if (p_ret->m_p_left != 0)
p_ret->m_p_left->m_p_parent = p_ret;
- if (p_ret->m_p_right != NULL)
+ if (p_ret->m_p_right != 0)
p_ret->m_p_right->m_p_parent = p_ret;
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_ret);)
@@ -195,7 +195,7 @@ void
PB_DS_CLASS_C_DEC::
initialize_min_max()
{
- if (m_p_head->m_p_parent == NULL)
+ if (m_p_head->m_p_parent == 0)
{
m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
return;
@@ -203,14 +203,14 @@ initialize_min_max()
{
node_pointer p_min = m_p_head->m_p_parent;
- while (p_min->m_p_left != NULL)
+ while (p_min->m_p_left != 0)
p_min = p_min->m_p_left;
m_p_head->m_p_left = p_min;
}
{
node_pointer p_max = m_p_head->m_p_parent;
- while (p_max->m_p_right != NULL)
+ while (p_max->m_p_right != 0)
p_max = p_max->m_p_right;
m_p_head->m_p_right = p_max;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
index e3447bd4bec..e1013e78f1b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
@@ -49,7 +49,7 @@ assert_valid() const
assert_consistent_with_debug_base();
assert_size();
assert_iterators();
- if (m_p_head->m_p_parent == NULL)
+ if (m_p_head->m_p_parent == 0)
{
_GLIBCXX_DEBUG_ASSERT(m_size == 0);
}
@@ -64,8 +64,8 @@ void
PB_DS_CLASS_C_DEC::
structure_only_assert_valid() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_head != NULL);
- if (m_p_head->m_p_parent == NULL)
+ _GLIBCXX_DEBUG_ASSERT(m_p_head != 0);
+ if (m_p_head->m_p_parent == 0)
{
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left == m_p_head);
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right == m_p_head);
@@ -77,7 +77,7 @@ structure_only_assert_valid() const
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right != m_p_head);
}
- if (m_p_head->m_p_parent != NULL)
+ if (m_p_head->m_p_parent != 0)
assert_node_consistent(m_p_head->m_p_parent);
assert_min();
assert_max();
@@ -96,8 +96,8 @@ typename PB_DS_CLASS_C_DEC::node_consistent_t
PB_DS_CLASS_C_DEC::
assert_node_consistent_(const node_pointer p_nd) const
{
- if (p_nd == NULL)
- return (std::make_pair((const_pointer)NULL,(const_pointer)NULL));
+ if (p_nd == 0)
+ return (std::make_pair((const_pointer)0,(const_pointer)0));
assert_node_consistent_with_left(p_nd);
assert_node_consistent_with_right(p_nd);
@@ -105,18 +105,18 @@ assert_node_consistent_(const node_pointer p_nd) const
const std::pair<const_pointer, const_pointer>
l_range = assert_node_consistent_(p_nd->m_p_left);
- if (l_range.second != NULL)
+ if (l_range.second != 0)
_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*l_range.second),
PB_DS_V2F(p_nd->m_value)));
const std::pair<const_pointer, const_pointer>
r_range = assert_node_consistent_(p_nd->m_p_right);
- if (r_range.first != NULL)
+ if (r_range.first != 0)
_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
PB_DS_V2F(*r_range.first)));
- return (std::make_pair((l_range.first != NULL)? l_range.first :& p_nd->m_value,(r_range.second != NULL)? r_range.second :& p_nd->m_value));
+ return (std::make_pair((l_range.first != 0)? l_range.first :& p_nd->m_value,(r_range.second != 0)? r_range.second :& p_nd->m_value));
}
PB_DS_CLASS_T_DEC
@@ -124,7 +124,7 @@ void
PB_DS_CLASS_C_DEC::
assert_node_consistent_with_left(const node_pointer p_nd) const
{
- if (p_nd->m_p_left == NULL)
+ if (p_nd->m_p_left == 0)
return;
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left->m_p_parent == p_nd);
_GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
@@ -136,7 +136,7 @@ void
PB_DS_CLASS_C_DEC::
assert_node_consistent_with_right(const node_pointer p_nd) const
{
- if (p_nd->m_p_right == NULL)
+ if (p_nd->m_p_right == 0)
return;
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right->m_p_parent == p_nd);
_GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_p_right->m_value),
@@ -156,13 +156,13 @@ void
PB_DS_CLASS_C_DEC::
assert_min_imp(const node_pointer p_nd) const
{
- if (p_nd == NULL)
+ if (p_nd == 0)
{
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left == m_p_head);
return;
}
- if (p_nd->m_p_left == NULL)
+ if (p_nd->m_p_left == 0)
{
_GLIBCXX_DEBUG_ASSERT(p_nd == m_p_head->m_p_left);
return;
@@ -183,13 +183,13 @@ void
PB_DS_CLASS_C_DEC::
assert_max_imp(const node_pointer p_nd) const
{
- if (p_nd == NULL)
+ if (p_nd == 0)
{
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right == m_p_head);
return;
}
- if (p_nd->m_p_right == NULL)
+ if (p_nd->m_p_right == 0)
{
_GLIBCXX_DEBUG_ASSERT(p_nd == m_p_head->m_p_right);
return;
@@ -254,7 +254,7 @@ void
PB_DS_CLASS_C_DEC::
assert_consistent_with_debug_base(const node_pointer p_nd) const
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value));
assert_consistent_with_debug_base(p_nd->m_p_left);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
index a000c744cc3..a050a4be7b1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
@@ -106,7 +106,7 @@ void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
clear_imp(p_nd->m_p_left);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
index 413304b80a0..74af48a7327 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
@@ -46,7 +46,7 @@ lower_bound(const_key_reference r_key) const
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (Cmp_Fn::operator()(
PB_DS_V2F(p_nd->m_value),
r_key))
@@ -69,7 +69,7 @@ lower_bound(const_key_reference r_key)
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (Cmp_Fn::operator()(
PB_DS_V2F(p_nd->m_value),
r_key))
@@ -92,7 +92,7 @@ upper_bound(const_key_reference r_key) const
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (Cmp_Fn::operator()(r_key,
PB_DS_V2F(p_nd->m_value)))
{
@@ -114,7 +114,7 @@ upper_bound(const_key_reference r_key)
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (Cmp_Fn::operator()(r_key,
PB_DS_V2F(p_nd->m_value)))
{
@@ -138,7 +138,7 @@ find(const_key_reference r_key)
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
p_pot = p_nd;
@@ -164,7 +164,7 @@ find(const_key_reference r_key) const
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
p_pot = p_nd;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
index 3abf0a08d3c..6714c6f10be 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
@@ -53,7 +53,7 @@ insert_leaf(const_reference r_value)
node_pointer p_nd = m_p_head->m_p_parent;
node_pointer p_pot = m_p_head;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (!Cmp_Fn::operator()(
PB_DS_V2F(p_nd->m_value),
PB_DS_V2F(r_value)))
@@ -86,12 +86,12 @@ insert_leaf(const_reference r_value)
PB_DS_V2F(r_value)));
p_nd = p_pot->m_p_left;
- if (p_nd == NULL)
+ if (p_nd == 0)
return (std::make_pair(
insert_leaf_new(r_value, p_pot, true),
true));
- while (p_nd->m_p_right != NULL)
+ while (p_nd->m_p_right != 0)
p_nd = p_nd->m_p_right;
return (std::make_pair(
@@ -109,7 +109,7 @@ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
if (left_nd)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == 0);
_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
PB_DS_V2F(r_value),
PB_DS_V2F(p_nd->m_value)));
@@ -121,7 +121,7 @@ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
}
else
{
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == 0);
_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
PB_DS_V2F(p_nd->m_value),
PB_DS_V2F(r_value)));
@@ -134,7 +134,7 @@ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
p_new_nd->m_p_parent = p_nd;
- p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;
+ p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_nd));
@@ -159,7 +159,7 @@ insert_imp_empty(const_reference r_value)
p_new_node->m_p_parent = m_p_head;
- p_new_node->m_p_left = p_new_node->m_p_right = NULL;
+ p_new_node->m_p_left = p_new_node->m_p_right = 0;
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(
PB_DS_V2F(r_value)));
@@ -184,7 +184,7 @@ get_new_node_for_leaf_insert(const_reference r_val, false_type)
cond.set_no_action();
- p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;
+ p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
++m_size;
@@ -202,7 +202,7 @@ get_new_node_for_leaf_insert(const_reference r_val, true_type)
static_cast<const void* >(&p_new_nd->m_value)))
typename node::value_type(r_val);
- p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;
+ p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
++m_size;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
index ed7f1b172c8..e20a4134a8b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
@@ -123,7 +123,7 @@ inline typename PB_DS_CLASS_C_DEC::const_node_iterator
PB_DS_CLASS_C_DEC::
node_end() const
{
- return (const_node_iterator(NULL));
+ return (const_node_iterator(0));
}
PB_DS_CLASS_T_DEC
@@ -131,6 +131,6 @@ inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_end()
{
- return (node_iterator(NULL));
+ return (node_iterator(0));
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
index 365f02b6ef8..284c0e9bcc9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
@@ -105,7 +105,7 @@ namespace __gnu_pbds
*/
inline
- bin_search_tree_const_node_it_(const node_pointer p_nd = NULL) : m_p_nd(const_cast<node_pointer>(p_nd))
+ bin_search_tree_const_node_it_(const node_pointer p_nd = 0) : m_p_nd(const_cast<node_pointer>(p_nd))
{ }
// Access.
@@ -197,7 +197,7 @@ namespace __gnu_pbds
*/
inline
- bin_search_tree_node_it_(const node_pointer p_nd = NULL) : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(
+ bin_search_tree_node_it_(const node_pointer p_nd = 0) : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(
const_cast<node_pointer>(p_nd))
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
index bb249e07057..5bf3f229f5d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
@@ -124,7 +124,7 @@ namespace __gnu_pbds
public:
inline
- bin_search_tree_const_it_(const Node_Pointer p_nd = NULL)
+ bin_search_tree_const_it_(const Node_Pointer p_nd = 0)
: m_p_nd(const_cast<Node_Pointer>(p_nd))
{ }
@@ -152,14 +152,14 @@ namespace __gnu_pbds
inline const_pointer
operator->() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return &m_p_nd->m_value;
}
inline const_reference
operator*() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return m_p_nd->m_value;
}
@@ -182,7 +182,7 @@ namespace __gnu_pbds
inline PB_DS_TREE_CONST_IT_C_DEC&
operator++()
{
- _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
inc(integral_constant<int,Is_Forward_Iterator>());
return *this;
}
@@ -225,10 +225,10 @@ namespace __gnu_pbds
return;
}
- if (m_p_nd->m_p_right != NULL)
+ if (m_p_nd->m_p_right != 0)
{
m_p_nd = m_p_nd->m_p_right;
- while (m_p_nd->m_p_left != NULL)
+ while (m_p_nd->m_p_left != 0)
m_p_nd = m_p_nd->m_p_left;
return;
}
@@ -257,10 +257,10 @@ namespace __gnu_pbds
return;
}
- if (m_p_nd->m_p_left != NULL)
+ if (m_p_nd->m_p_left != 0)
{
Node_Pointer p_y = m_p_nd->m_p_left;
- while (p_y->m_p_right != NULL)
+ while (p_y->m_p_right != 0)
p_y = p_y->m_p_right;
m_p_nd = p_y;
return;
@@ -297,7 +297,7 @@ namespace __gnu_pbds
public:
inline
- bin_search_tree_it_(const Node_Pointer p_nd = NULL)
+ bin_search_tree_it_(const Node_Pointer p_nd = 0)
: PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)
{ }
@@ -325,14 +325,14 @@ namespace __gnu_pbds
inline typename PB_DS_TREE_CONST_IT_C_DEC::pointer
operator->() const
{
- _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);
return &base_it_type::m_p_nd->m_value;
}
inline typename PB_DS_TREE_CONST_IT_C_DEC::reference
operator*() const
{
- _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);
return base_it_type::m_p_nd->m_value;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
index 667ef84704f..76c543f149a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
@@ -106,7 +106,7 @@ void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
clear_imp(p_nd->m_p_left);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
index 0598657fe04..b21e98102df 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
@@ -47,7 +47,7 @@ rotate_left(node_pointer p_x)
p_x->m_p_right = p_y->m_p_left;
- if (p_y->m_p_left != NULL)
+ if (p_y->m_p_left != 0)
p_y->m_p_left->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
@@ -78,7 +78,7 @@ rotate_right(node_pointer p_x)
p_x->m_p_left = p_y->m_p_right;
- if (p_y->m_p_right != NULL)
+ if (p_y->m_p_right != 0)
p_y->m_p_right->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
@@ -131,7 +131,7 @@ apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
{
node_update::operator()(
node_iterator(p_nd),
- const_node_iterator(static_cast<node_pointer>(NULL)));
+ const_node_iterator(static_cast<node_pointer>(0)));
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
index 9d2bd6d742d..2c027f6ab98 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
@@ -139,7 +139,7 @@ typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
recursive_count(node_pointer p) const
{
- if (p == NULL)
+ if (p == 0)
return 0;
return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
index 9cb13f99cca..76cf80bd544 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
@@ -125,7 +125,7 @@ namespace __gnu_pbds
inline PB_DS_CLASS_C_DEC&
operator++()
{
- _GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != 0);
inc();
return *this;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
index d4013db16fe..ab5efe2bb64 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
@@ -92,7 +92,7 @@ namespace __gnu_pbds
// Default constructor.
inline
- binary_heap_const_point_iterator_() : m_p_e(NULL) { }
+ binary_heap_const_point_iterator_() : m_p_e(0) { }
// Copy constructor.
inline
@@ -104,7 +104,7 @@ namespace __gnu_pbds
inline const_pointer
operator->() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_e != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_e != 0);
return to_ptr(integral_constant<int, Simple>());
}
@@ -112,7 +112,7 @@ namespace __gnu_pbds
inline const_reference
operator*() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_e != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_e != 0);
return *to_ptr(integral_constant<int, Simple>());
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
index 04b7d548f2e..dfceb689132 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
@@ -68,8 +68,8 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
const size_type other_actual_size =
other.get_new_size_for_arbitrary(ersd);
- entry_pointer a_entries = NULL;
- entry_pointer a_other_entries = NULL;
+ entry_pointer a_entries = 0;
+ entry_pointer a_other_entries = 0;
__try
{
@@ -79,10 +79,10 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
}
__catch(...)
{
- if (a_entries != NULL)
+ if (a_entries != 0)
s_entry_allocator.deallocate(a_entries, actual_size);
- if (a_other_entries != NULL)
+ if (a_other_entries != 0)
s_entry_allocator.deallocate(a_other_entries, other_actual_size);
__throw_exception_again;
@@ -128,8 +128,8 @@ join(PB_DS_CLASS_C_DEC& other)
const size_type len = m_size + other.m_size;
const size_type actual_size = resize_policy::get_new_size_for_arbitrary(len);
- entry_pointer a_entries = NULL;
- entry_pointer a_other_entries = NULL;
+ entry_pointer a_entries = 0;
+ entry_pointer a_other_entries = 0;
__try
{
@@ -138,10 +138,10 @@ join(PB_DS_CLASS_C_DEC& other)
}
__catch(...)
{
- if (a_entries != NULL)
+ if (a_entries != 0)
s_entry_allocator.deallocate(a_entries, actual_size);
- if (a_other_entries != NULL)
+ if (a_other_entries != 0)
s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
__throw_exception_again;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
index 274c93378fd..983df099dd7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
@@ -53,7 +53,7 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap_base_() :
- m_p_max(NULL)
+ m_p_max(0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(false);)
}
@@ -62,7 +62,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap_base_(const Cmp_Fn& r_cmp_fn) :
PB_DS_BASE_C_DEC(r_cmp_fn),
- m_p_max(NULL)
+ m_p_max(0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(false);)
}
@@ -71,7 +71,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap_base_(const PB_DS_CLASS_C_DEC& other) :
PB_DS_BASE_C_DEC(other),
- m_p_max(NULL)
+ m_p_max(0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(false);)
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
index 9a07f0e7d51..1ccee551402 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
@@ -55,9 +55,9 @@ void
PB_DS_CLASS_C_DEC::
assert_max() const
{
- if (m_p_max == NULL)
+ if (m_p_max == 0)
return;
- _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == 0);
for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)
_GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value,
it.m_p_nd->m_value));
@@ -71,14 +71,14 @@ assert_node_consistent(const_node_pointer p_nd, bool strictly_binomial,
{
_GLIBCXX_DEBUG_ASSERT(increasing || strictly_binomial);
base_type::assert_node_consistent(p_nd, false);
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == base_type::degree(p_nd));
_GLIBCXX_DEBUG_ASSERT(base_type::size_under_node(p_nd) ==
static_cast<size_type>(1 << p_nd->m_metadata));
assert_node_consistent(p_nd->m_p_next_sibling, strictly_binomial, increasing);
assert_node_consistent(p_nd->m_p_l_child, true, false);
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
{
if (increasing)
{
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
index a4cf90c20f1..d6ead1e51c3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
@@ -46,10 +46,10 @@ pop()
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
- if (m_p_max == NULL)
+ if (m_p_max == 0)
find_max();
- _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
node_pointer p_nd = m_p_max;
@@ -57,7 +57,7 @@ pop()
base_type::actual_erase_node(p_nd);
- m_p_max = NULL;
+ m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
}
@@ -67,33 +67,33 @@ void
PB_DS_CLASS_C_DEC::
remove_parentless_node(node_pointer p_nd)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
- _GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
+ _GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == 0);
node_pointer p_cur_root = p_nd == base_type::m_p_root?
p_nd->m_p_next_sibling :
base_type::m_p_root;
- if (p_cur_root != NULL)
- p_cur_root->m_p_prev_or_parent = NULL;
+ if (p_cur_root != 0)
+ p_cur_root->m_p_prev_or_parent = 0;
- if (p_nd->m_p_prev_or_parent != NULL)
+ if (p_nd->m_p_prev_or_parent != 0)
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
node_pointer p_child = p_nd->m_p_l_child;
- if (p_child != NULL)
+ if (p_child != 0)
{
- p_child->m_p_prev_or_parent = NULL;
+ p_child->m_p_prev_or_parent = 0;
- while (p_child->m_p_next_sibling != NULL)
+ while (p_child->m_p_next_sibling != 0)
p_child = p_child->m_p_next_sibling;
}
- m_p_max = NULL;
+ m_p_max = 0;
base_type::m_p_root = join(p_cur_root, p_child);
}
@@ -105,7 +105,7 @@ clear()
{
base_type::clear();
- m_p_max = NULL;
+ m_p_max = 0;
}
PB_DS_CLASS_T_DEC
@@ -122,7 +122,7 @@ erase(point_iterator it)
base_type::actual_erase_node(it.m_p_nd);
- m_p_max = NULL;
+ m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
}
@@ -148,7 +148,7 @@ erase_if(Pred pred)
size_type ersd = 0;
- while (p_out != NULL)
+ while (p_out != 0)
{
++ersd;
@@ -161,19 +161,19 @@ erase_if(Pred pred)
node_pointer p_cur = base_type::m_p_root;
- base_type::m_p_root = NULL;
+ base_type::m_p_root = 0;
- while (p_cur != NULL)
+ while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
- p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = NULL;
+ p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
p_cur->m_metadata = 0;
p_cur->m_p_next_sibling = base_type::m_p_root;
- if (base_type::m_p_root != NULL)
+ if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_cur;
base_type::m_p_root = p_cur;
@@ -183,7 +183,7 @@ erase_if(Pred pred)
p_cur = p_next;
}
- m_p_max = NULL;
+ m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
index ad7f65129ba..3c8ff109def 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
@@ -46,10 +46,10 @@ top() const
_GLIBCXX_DEBUG_ONLY(assert_valid(false);)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
- if (m_p_max == NULL)
+ if (m_p_max == 0)
const_cast<PB_DS_CLASS_C_DEC* >(this)->find_max();
- _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
return m_p_max->m_value;
}
@@ -62,7 +62,7 @@ find_max()
m_p_max = p_cur;
- while (p_cur != NULL)
+ while (p_cur != 0)
{
if (Cmp_Fn::operator()(m_p_max->m_value, p_cur->m_value))
m_p_max = p_cur;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
index e67d0df148f..735bddbb71a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
@@ -49,7 +49,7 @@ push(const_reference r_val)
insert_node(p_nd);
- m_p_max = NULL;
+ m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
@@ -61,10 +61,10 @@ inline void
PB_DS_CLASS_C_DEC::
insert_node(node_pointer p_nd)
{
- if (base_type::m_p_root == NULL)
+ if (base_type::m_p_root == 0)
{
p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent =
- p_nd->m_p_l_child = NULL;
+ p_nd->m_p_l_child = 0;
p_nd->m_metadata = 0;
@@ -75,7 +75,7 @@ insert_node(node_pointer p_nd)
if (base_type::m_p_root->m_metadata > 0)
{
- p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = NULL;
+ p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;
p_nd->m_p_next_sibling = base_type::m_p_root;
@@ -92,7 +92,7 @@ insert_node(node_pointer p_nd)
{
p_nd->m_p_next_sibling = base_type::m_p_root->m_p_next_sibling;
- p_nd->m_p_prev_or_parent = NULL;
+ p_nd->m_p_prev_or_parent = 0;
p_nd->m_metadata = 1;
@@ -100,15 +100,15 @@ insert_node(node_pointer p_nd)
base_type::m_p_root->m_p_prev_or_parent = p_nd;
- base_type::m_p_root->m_p_next_sibling = NULL;
+ base_type::m_p_root->m_p_next_sibling = 0;
base_type::m_p_root = p_nd;
}
else
{
- p_nd->m_p_next_sibling = NULL;
+ p_nd->m_p_next_sibling = 0;
- p_nd->m_p_l_child = NULL;
+ p_nd->m_p_l_child = 0;
p_nd->m_p_prev_or_parent = base_type::m_p_root;
@@ -128,7 +128,7 @@ inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
fix(node_pointer p_nd) const
{
- while (p_nd->m_p_next_sibling != NULL&&
+ while (p_nd->m_p_next_sibling != 0&&
p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata)
{
node_pointer p_next = p_nd->m_p_next_sibling;
@@ -138,7 +138,7 @@ fix(node_pointer p_nd) const
p_next->m_p_prev_or_parent =
p_nd->m_p_prev_or_parent;
- if (p_nd->m_p_prev_or_parent != NULL)
+ if (p_nd->m_p_prev_or_parent != 0)
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_next;
base_type::make_child_of(p_nd, p_next);
@@ -151,8 +151,8 @@ fix(node_pointer p_nd) const
{
p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
- if (p_nd->m_p_next_sibling != NULL)
- p_next->m_p_next_sibling = NULL;
+ if (p_nd->m_p_next_sibling != 0)
+ p_next->m_p_next_sibling = 0;
base_type::make_child_of(p_next, p_nd);
@@ -160,7 +160,7 @@ fix(node_pointer p_nd) const
}
}
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
return p_nd;
@@ -174,7 +174,7 @@ modify(point_iterator it, const_reference r_new_val)
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
node_pointer p_nd = it.m_p_nd;
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false);)
const bool bubble_up = Cmp_Fn::operator()(p_nd->m_value, r_new_val);
@@ -185,7 +185,7 @@ modify(point_iterator it, const_reference r_new_val)
{
node_pointer p_parent = base_type::parent(p_nd);
- while (p_parent != NULL&&
+ while (p_parent != 0&&
Cmp_Fn::operator()(p_parent->m_value, p_nd->m_value))
{
base_type::swap_with_parent(p_nd, p_parent);
@@ -193,10 +193,10 @@ modify(point_iterator it, const_reference r_new_val)
p_parent = base_type::parent(p_nd);
}
- if (p_nd->m_p_prev_or_parent == NULL)
+ if (p_nd->m_p_prev_or_parent == 0)
base_type::m_p_root = p_nd;
- m_p_max = NULL;
+ m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
@@ -209,7 +209,7 @@ modify(point_iterator it, const_reference r_new_val)
insert_node(p_nd);
- m_p_max = NULL;
+ m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
index a701937cb99..2a96236fb9e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
@@ -61,7 +61,7 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_out = base_type::prune(pred);
- while (p_out != NULL)
+ while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
@@ -70,13 +70,13 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_next = p_out->m_p_next_sibling;
- p_out->m_p_l_child = p_out->m_p_prev_or_parent = NULL;
+ p_out->m_p_l_child = p_out->m_p_prev_or_parent = 0;
p_out->m_metadata = 0;
p_out->m_p_next_sibling = other.m_p_root;
- if (other.m_p_root != NULL)
+ if (other.m_p_root != 0)
other.m_p_root->m_p_prev_or_parent = p_out;
other.m_p_root = p_out;
@@ -90,19 +90,19 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_cur = base_type::m_p_root;
- base_type::m_p_root = NULL;
+ base_type::m_p_root = 0;
- while (p_cur != NULL)
+ while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
- p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = NULL;
+ p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
p_cur->m_metadata = 0;
p_cur->m_p_next_sibling = base_type::m_p_root;
- if (base_type::m_p_root != NULL)
+ if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_cur;
base_type::m_p_root = p_cur;
@@ -112,7 +112,7 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
p_cur = p_next;
}
- m_p_max = NULL;
+ m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
_GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
@@ -128,7 +128,7 @@ join(PB_DS_CLASS_C_DEC& other)
node_pointer p_other = other.m_p_root;
- if (p_other != NULL)
+ if (p_other != 0)
do
{
node_pointer p_next = p_other->m_p_next_sibling;
@@ -137,15 +137,15 @@ join(PB_DS_CLASS_C_DEC& other)
p_other = p_next;
}
- while (p_other != NULL);
+ while (p_other != 0);
base_type::m_p_root = join(base_type::m_p_root, other.m_p_root);
base_type::m_size += other.m_size;
- m_p_max = NULL;
+ m_p_max = 0;
- other.m_p_root = NULL;
+ other.m_p_root = 0;
other.m_size = 0;
- other.m_p_max = NULL;
+ other.m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid(true);)
_GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
@@ -156,15 +156,15 @@ inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
join(node_pointer p_lhs, node_pointer p_rhs) const
{
- node_pointer p_ret = NULL;
+ node_pointer p_ret = 0;
- node_pointer p_cur = NULL;
+ node_pointer p_cur = 0;
- while (p_lhs != NULL || p_rhs != NULL)
+ while (p_lhs != 0 || p_rhs != 0)
{
- if (p_rhs == NULL)
+ if (p_rhs == 0)
{
- if (p_cur == NULL)
+ if (p_cur == 0)
p_ret = p_cur = p_lhs;
else
{
@@ -173,11 +173,11 @@ join(node_pointer p_lhs, node_pointer p_rhs) const
p_lhs->m_p_prev_or_parent = p_cur;
}
- p_cur = p_lhs = NULL;
+ p_cur = p_lhs = 0;
}
- else if (p_lhs == NULL || p_rhs->m_metadata < p_lhs->m_metadata)
+ else if (p_lhs == 0 || p_rhs->m_metadata < p_lhs->m_metadata)
{
- if (p_cur == NULL)
+ if (p_cur == 0)
{
p_ret = p_cur = p_rhs;
@@ -196,7 +196,7 @@ join(node_pointer p_lhs, node_pointer p_rhs) const
}
else if (p_lhs->m_metadata < p_rhs->m_metadata)
{
- if (p_cur == NULL)
+ if (p_cur == 0)
p_ret = p_cur = p_lhs;
else
{
@@ -221,11 +221,11 @@ join(node_pointer p_lhs, node_pointer p_rhs) const
}
}
- if (p_cur != NULL)
- p_cur->m_p_next_sibling = NULL;
+ if (p_cur != 0)
+ p_cur->m_p_next_sibling = 0;
- if (p_ret != NULL)
- p_ret->m_p_prev_or_parent = NULL;
+ if (p_ret != 0)
+ p_ret->m_p_prev_or_parent = 0;
return p_ret;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
index f5efabe0840..2bace9c5ebd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
@@ -374,7 +374,7 @@ namespace __gnu_pbds
entry_pointer p_e = m_entries[pos];
resize_base::notify_insert_search_start();
- while (p_e != NULL
+ while (p_e != 0
&& !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))
{
resize_base::notify_insert_search_collision();
@@ -382,7 +382,7 @@ namespace __gnu_pbds
}
resize_base::notify_insert_search_end();
- if (p_e != NULL)
+ if (p_e != 0)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return (p_e->m_value.second);
@@ -399,7 +399,7 @@ namespace __gnu_pbds
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_insert_search_start();
- while (p_e != NULL &&
+ while (p_e != 0 &&
!hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash, r_key, pos_hash_pair.second))
{
resize_base::notify_insert_search_collision();
@@ -407,7 +407,7 @@ namespace __gnu_pbds
}
resize_base::notify_insert_search_end();
- if (p_e != NULL)
+ if (p_e != 0)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return p_e->m_value.second;
@@ -468,7 +468,7 @@ namespace __gnu_pbds
{
entry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)];
resize_base::notify_find_search_start();
- while (p_e != NULL &&
+ while (p_e != 0 &&
!hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
resize_base::notify_find_search_collision();
@@ -478,7 +478,7 @@ namespace __gnu_pbds
resize_base::notify_find_search_end();
#ifdef _GLIBCXX_DEBUG
- if (p_e == NULL)
+ if (p_e == 0)
debug_base::check_key_does_not_exist(r_key);
else
debug_base::check_key_exists(r_key);
@@ -492,7 +492,7 @@ namespace __gnu_pbds
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_find_search_start();
- while (p_e != NULL &&
+ while (p_e != 0 &&
!hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
p_e->m_hash,
r_key, pos_hash_pair.second))
@@ -504,7 +504,7 @@ namespace __gnu_pbds
resize_base::notify_find_search_end();
#ifdef _GLIBCXX_DEBUG
- if (p_e == NULL)
+ if (p_e == 0)
debug_base::check_key_does_not_exist(r_key);
else
debug_base::check_key_exists(r_key);
@@ -534,22 +534,22 @@ namespace __gnu_pbds
inc_it_state(const_pointer& r_p_value,
std::pair<entry_pointer, size_type>& r_pos) const
{
- _GLIBCXX_DEBUG_ASSERT(r_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(r_p_value != 0);
r_pos.first = r_pos.first->m_p_next;
- if (r_pos.first != NULL)
+ if (r_pos.first != 0)
{
r_p_value = &r_pos.first->m_value;
return;
}
for (++r_pos.second; r_pos.second < m_num_e; ++r_pos.second)
- if (m_entries[r_pos.second] != NULL)
+ if (m_entries[r_pos.second] != 0)
{
r_pos.first = m_entries[r_pos.second];
r_p_value = &r_pos.first->m_value;
return;
}
- r_p_value = NULL;
+ r_p_value = 0;
}
void
@@ -557,13 +557,13 @@ namespace __gnu_pbds
std::pair<entry_pointer, size_type>& r_pos) const
{
for (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second)
- if (m_entries[r_pos.second] != NULL)
+ if (m_entries[r_pos.second] != 0)
{
r_pos.first = m_entries[r_pos.second];
r_p_value = &r_pos.first->m_value;
return;
}
- r_p_value = NULL;
+ r_p_value = 0;
}
#ifdef _GLIBCXX_DEBUG
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
index 1a61893d105..c5268447232 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
@@ -64,7 +64,7 @@ cmp_with_other(const Other_Map_Type& other) const
const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_extra_indicator);
- if (p_mapped_value == NULL)
+ if (p_mapped_value == 0)
return false;
#ifdef PB_DS_DATA_TRUE_INDICATOR
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
index 24294ad9135..f67254169b7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -87,7 +87,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
{
- std::fill(m_entries, m_entries + m_num_e, (entry_pointer)NULL);
+ std::fill(m_entries, m_entries + m_num_e, (entry_pointer)0);
Resize_Policy::notify_cleared();
ranged_hash_fn_base::notify_resized(m_num_e);
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
@@ -184,7 +184,7 @@ void
PB_DS_CLASS_C_DEC::
initialize()
{
- std::fill(m_entries, m_entries + m_num_e, entry_pointer(NULL));
+ std::fill(m_entries, m_entries + m_num_e, entry_pointer(0));
Resize_Policy::notify_resized(m_num_e);
Resize_Policy::notify_cleared();
ranged_hash_fn_base::notify_resized(m_num_e);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
index 4219eef3885..81d68e3311e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
@@ -58,7 +58,7 @@ assert_entry_pointer_array_valid(const entry_pointer_array a_p_entries) const
for (size_type pos = 0; pos < m_num_e; ++pos)
{
entry_pointer p_e = a_p_entries[pos];
- while (p_e != NULL)
+ while (p_e != 0)
{
++iterated_num_used_e;
assert_entry_pointer_valid(p_e, traits_base::m_store_extra_indicator);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
index fa09f734843..912535f9390 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
@@ -43,7 +43,7 @@ void
PB_DS_CLASS_C_DEC::
deallocate_links_in_list(entry_pointer p_e)
{
- while (p_e != NULL)
+ while (p_e != 0)
{
entry_pointer p_dealloc_e = p_e;
p_e = p_e->m_p_next;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
index 9f9178bc911..e1260c0d9bd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
@@ -61,7 +61,7 @@ erase_if(Pred pred)
size_type num_ersd = 0;
for (size_type pos = 0; pos < m_num_e; ++pos)
{
- while (m_entries[pos] != NULL && pred(m_entries[pos]->m_value))
+ while (m_entries[pos] != 0 && pred(m_entries[pos]->m_value))
{
++num_ersd;
entry_pointer p_next_e = m_entries[pos]->m_p_next;
@@ -70,7 +70,7 @@ erase_if(Pred pred)
}
entry_pointer p_e = m_entries[pos];
- while (p_e != NULL && p_e->m_p_next != NULL)
+ while (p_e != 0 && p_e->m_p_next != 0)
{
if (pred(p_e->m_p_next->m_value))
{
@@ -92,7 +92,7 @@ PB_DS_CLASS_C_DEC::
clear()
{
for (size_type pos = 0; pos < m_num_e; ++pos)
- while (m_entries[pos] != NULL)
+ while (m_entries[pos] != 0)
erase_entry_pointer(m_entries[pos]);
do_resize_if_needed_no_throw();
resize_base::notify_cleared();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
index d24fc31f9dc..1f8fa06bda3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
@@ -56,7 +56,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
entry_pointer p_e = m_entries[pos];
resize_base::notify_erase_search_start();
- if (p_e == NULL)
+ if (p_e == 0)
{
resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
@@ -77,7 +77,7 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos)
while (true)
{
entry_pointer p_next_e = p_e->m_p_next;
- if (p_next_e == NULL)
+ if (p_next_e == 0)
{
resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
index d72df696221..01192b4cefd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
@@ -47,7 +47,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
entry_pointer p_e = m_entries[r_pos_hash_pair.first];
resize_base::notify_erase_search_start();
- if (p_e == NULL)
+ if (p_e == 0)
{
resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(debug_base:: check_key_does_not_exist(r_key);)
@@ -69,7 +69,7 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
while (true)
{
entry_pointer p_next_e = p_e->m_p_next;
- if (p_next_e == NULL)
+ if (p_next_e == 0)
{
resize_base::notify_erase_search_end();
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
index 6ca9a03b4fa..03db9f84f28 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
@@ -61,11 +61,11 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find_end()
-{ return NULL; }
+{ return 0; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_point_iterator
PB_DS_CLASS_C_DEC::
find_end() const
-{ return NULL; }
+{ return 0; }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
index dc1519df7b3..5722c775def 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
@@ -81,7 +81,7 @@ cmp_with_other(const Other_Map_Type& other) const
const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_extra_indicator);
- if (p_mapped_value == NULL)
+ if (p_mapped_value == 0)
return false;
#ifdef PB_DS_DATA_TRUE_INDICATOR
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
index 7215ccd86bc..3d23eab5c35 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
@@ -50,7 +50,7 @@ insert_imp(const_reference r_val, false_type)
entry_pointer p_e = m_entries[pos];
resize_base::notify_insert_search_start();
- while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
+ while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
r_key))
{
resize_base::notify_insert_search_collision();
@@ -58,7 +58,7 @@ insert_imp(const_reference r_val, false_type)
}
resize_base::notify_insert_search_end();
- if (p_e != NULL)
+ if (p_e != 0)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
return std::make_pair(&p_e->m_value, false);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
index fbc284f80b9..b35570690af 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
@@ -50,7 +50,7 @@ insert_imp(const_reference r_val, true_type)
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_insert_search_start();
- while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
+ while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
p_e->m_hash,
key, pos_hash_pair.second))
{
@@ -59,7 +59,7 @@ insert_imp(const_reference r_val, true_type)
}
resize_base::notify_insert_search_end();
- if (p_e != NULL)
+ if (p_e != 0)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
return std::make_pair(&p_e->m_value, false);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
index 66333ec85c2..11e2583bc47 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
@@ -112,12 +112,12 @@ PB_DS_CLASS_C_DEC::
resize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size)
{
std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e,
- entry_pointer(NULL));
+ entry_pointer(0));
for (size_type pos = 0; pos < old_size; ++pos)
{
entry_pointer p_e = m_entries[pos];
- while (p_e != NULL)
+ while (p_e != 0)
p_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized, traits_base::m_store_extra_indicator);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
index 6fa5676b9df..77735aeafdd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
@@ -62,7 +62,7 @@ PB_DS_CLASS_C_DEC::
trace_list(const_entry_pointer p_l) const
{
size_type iterated_num_used_e = 0;
- while (p_l != NULL)
+ while (p_l != 0)
{
std::cerr << PB_DS_V2F(p_l->m_value) << " ";
p_l = p_l->m_p_next;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
index 69d53763ad5..d39735c5632 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
@@ -60,11 +60,11 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find_end()
-{ return NULL; }
+{ return 0; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_point_iterator
PB_DS_CLASS_C_DEC::
find_end() const
-{ return NULL; }
+{ return 0; }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
index 4741afec090..5b2df85a8c2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
@@ -490,7 +490,7 @@ namespace __gnu_pbds
resize_base::notify_find_search_end();
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
- return NULL;
+ return 0;
}
break;
case valid_entry_status:
@@ -513,7 +513,7 @@ namespace __gnu_pbds
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
resize_base::notify_find_search_end();
- return NULL;
+ return 0;
}
inline pointer
@@ -538,7 +538,7 @@ namespace __gnu_pbds
resize_base::notify_find_search_end();
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
- return NULL;
+ return 0;
}
break;
case valid_entry_status:
@@ -562,7 +562,7 @@ namespace __gnu_pbds
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
resize_base::notify_find_search_end();
- return NULL;
+ return 0;
}
inline bool
@@ -583,7 +583,7 @@ namespace __gnu_pbds
void
inc_it_state(const_pointer& r_p_value, size_type& r_pos) const
{
- _GLIBCXX_DEBUG_ASSERT(r_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(r_p_value != 0);
for (++r_pos; r_pos < m_num_e; ++r_pos)
{
const_entry_pointer p_e =& m_entries[r_pos];
@@ -593,7 +593,7 @@ namespace __gnu_pbds
return;
}
}
- r_p_value = NULL;
+ r_p_value = 0;
}
void
@@ -608,7 +608,7 @@ namespace __gnu_pbds
return;
}
}
- r_p_value = NULL;
+ r_p_value = 0;
}
void
@@ -623,7 +623,7 @@ namespace __gnu_pbds
return;
}
}
- r_p_value = NULL;
+ r_p_value = 0;
}
#ifdef _GLIBCXX_DEBUG
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
index 0492a47928b..115a8bf0dda 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
@@ -87,7 +87,7 @@ resize_imp(size_type new_size)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
const size_type old_size = m_num_e;
- entry_array a_entries_resized = NULL;
+ entry_array a_entries_resized = 0;
// Following line might throw an exception.
a_entries_resized = s_entry_allocator.allocate(new_size);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
index 479725fd51b..dac063927f6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -60,7 +60,7 @@ namespace __gnu_pbds
typedef
typename __conditional_type<
is_same<
- __gnu_pbds::direct_mask_range_hashing<size_t>,
+ __gnu_pbds::direct_mask_range_hashing<std::size_t>,
Comb_Probe_Fn>::value,
__gnu_pbds::linear_probe_fn<size_type>,
__gnu_pbds::quadratic_probe_fn<size_type> >::__type
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
index dad6451d06f..7dcd82588c1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,7 +48,7 @@ class sample_probe_fn
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
public:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
index 0912e7f27e8..988f111ea20 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,7 +48,7 @@ class sample_range_hashing
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
public:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
index 6120231e2e2..8fa04d140e5 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,7 +48,7 @@ class sample_ranged_hash_fn
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
public:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
index 915f108df83..2bcfdf51a54 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,7 +48,7 @@ class sample_ranged_probe_fn
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
public:
@@ -70,7 +70,7 @@ protected:
// Transforms the const key reference r_key into the i-th position within the table. This method is called for each collision within the probe sequence.
inline size_type
- operator()(const_key_reference r_key, size_t hash, size_type i) const;
+ operator()(const_key_reference r_key, std::size_t hash, size_type i) const;
};
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
index 5955df16164..4c085d4c69d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
@@ -118,7 +118,7 @@ namespace __gnu_pbds
inline PB_DS_CLASS_C_DEC&
operator++()
{
- _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != 0);
inc();
return (*this);
}
@@ -135,10 +135,10 @@ namespace __gnu_pbds
void
inc()
{
- if (base_type::m_p_nd->m_p_next_sibling != NULL)
+ if (base_type::m_p_nd->m_p_next_sibling != 0)
{
base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling;
- while (base_type::m_p_nd->m_p_l_child != NULL)
+ while (base_type::m_p_nd->m_p_l_child != 0)
base_type::m_p_nd = base_type::m_p_nd->m_p_l_child;
return;
}
@@ -147,7 +147,7 @@ namespace __gnu_pbds
{
node_pointer p_next = base_type::m_p_nd;
base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;
- if (base_type::m_p_nd == NULL || base_type::m_p_nd->m_p_l_child == p_next)
+ if (base_type::m_p_nd == 0 || base_type::m_p_nd->m_p_l_child == p_next)
return;
}
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
index 7d682526b4c..8eb1574446b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
@@ -107,7 +107,7 @@ namespace __gnu_pbds
// Default constructor.
inline
- left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(NULL)
+ left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(0)
{ }
// Copy constructor.
@@ -119,7 +119,7 @@ namespace __gnu_pbds
inline const_pointer
operator->() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return &m_p_nd->m_value;
}
@@ -127,7 +127,7 @@ namespace __gnu_pbds
inline const_reference
operator*() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return m_p_nd->m_value;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
index ea0572527c2..536ac66ea4b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
@@ -49,7 +49,7 @@ PB_DS_CLASS_C_DEC::s_no_throw_copies_ind;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
left_child_next_sibling_heap_() :
- m_p_root(NULL),
+ m_p_root(0),
m_size(0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
@@ -59,7 +59,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :
Cmp_Fn(r_cmp_fn),
- m_p_root(NULL),
+ m_p_root(0),
m_size(0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
@@ -68,7 +68,7 @@ left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other)
-: Cmp_Fn(other), m_p_root(NULL), m_size(0)
+: Cmp_Fn(other), m_p_root(0), m_size(0)
{
m_size = other.m_size;
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
@@ -111,8 +111,8 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
recursive_copy_node(const_node_pointer p_nd)
{
- if (p_nd == NULL)
- return (NULL);
+ if (p_nd == 0)
+ return (0);
node_pointer p_ret = s_node_allocator.allocate(1);
@@ -127,7 +127,7 @@ recursive_copy_node(const_node_pointer p_nd)
}
p_ret->m_p_l_child = p_ret->m_p_next_sibling =
- p_ret->m_p_prev_or_parent = NULL;
+ p_ret->m_p_prev_or_parent = 0;
__try
{
@@ -140,12 +140,12 @@ recursive_copy_node(const_node_pointer p_nd)
__throw_exception_again;
}
- if (p_ret->m_p_l_child != NULL)
+ if (p_ret->m_p_l_child != 0)
p_ret->m_p_l_child->m_p_prev_or_parent = p_ret;
- if (p_ret->m_p_next_sibling != NULL)
+ if (p_ret->m_p_next_sibling != 0)
p_ret->m_p_next_sibling->m_p_prev_or_parent =
- p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : NULL;
+ p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : 0;
return p_ret;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
index 86871ac3817..16b8217bd61 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
@@ -45,9 +45,9 @@ void
PB_DS_CLASS_C_DEC::
assert_valid() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_root == NULL || m_p_root->m_p_prev_or_parent == NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_root == 0 || m_p_root->m_p_prev_or_parent == 0);
- if (m_p_root != NULL)
+ if (m_p_root != 0)
assert_node_consistent(m_p_root, Single_Link_Roots);
assert_size();
assert_iterators();
@@ -58,22 +58,22 @@ void
PB_DS_CLASS_C_DEC::
assert_node_consistent(const_node_pointer p_nd, bool single_link) const
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
assert_node_consistent(p_nd->m_p_l_child, false);
assert_node_consistent(p_nd->m_p_next_sibling, single_link);
if (single_link)
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent == NULL);
- else if (p_nd->m_p_next_sibling != NULL)
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent == 0);
+ else if (p_nd->m_p_next_sibling != 0)
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd);
- if (p_nd->m_p_l_child == NULL)
+ if (p_nd->m_p_l_child == 0)
return;
const_node_pointer p_child = p_nd->m_p_l_child;
- while (p_child != NULL)
+ while (p_child != 0)
{
const_node_pointer p_next_child = p_child->m_p_next_sibling;
_GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value));
@@ -115,7 +115,7 @@ PB_DS_CLASS_C_DEC::
size_from_node(const_node_pointer p_nd)
{
size_type ret = 0;
- while (p_nd != NULL)
+ while (p_nd != 0)
{
ret += 1 + size_from_node(p_nd->m_p_l_child);
p_nd = p_nd->m_p_next_sibling;
@@ -130,7 +130,7 @@ degree(const_node_pointer p_nd)
{
size_type ret = 0;
const_node_pointer p_child = p_nd->m_p_l_child;
- while (p_child != NULL)
+ while (p_child != 0)
{
++ret;
p_child = p_child->m_p_next_sibling;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
index 9fa09f49bbb..605457fd4cb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
@@ -45,7 +45,7 @@ clear()
{
clear_imp(m_p_root);
_GLIBCXX_DEBUG_ASSERT(m_size == 0);
- m_p_root = NULL;
+ m_p_root = 0;
}
PB_DS_CLASS_T_DEC
@@ -64,7 +64,7 @@ void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
- while (p_nd != NULL)
+ while (p_nd != 0)
{
clear_imp(p_nd->m_p_l_child);
node_pointer p_next = p_nd->m_p_next_sibling;
@@ -80,8 +80,8 @@ to_linked_list()
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
node_pointer p_cur = m_p_root;
- while (p_cur != NULL)
- if (p_cur->m_p_l_child != NULL)
+ while (p_cur != 0)
+ if (p_cur->m_p_l_child != 0)
{
node_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling;
p_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling;
@@ -94,10 +94,10 @@ to_linked_list()
#ifdef _GLIBCXX_DEBUG
const_node_pointer p_counter = m_p_root;
size_type count = 0;
- while (p_counter != NULL)
+ while (p_counter != 0)
{
++count;
- _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == 0);
p_counter = p_counter->m_p_next_sibling;
}
_GLIBCXX_DEBUG_ASSERT(count == m_size);
@@ -111,22 +111,22 @@ PB_DS_CLASS_C_DEC::
prune(Pred pred)
{
node_pointer p_cur = m_p_root;
- m_p_root = NULL;
- node_pointer p_out = NULL;
- while (p_cur != NULL)
+ m_p_root = 0;
+ node_pointer p_out = 0;
+ while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
if (pred(p_cur->m_value))
{
p_cur->m_p_next_sibling = p_out;
- if (p_out != NULL)
+ if (p_out != 0)
p_out->m_p_prev_or_parent = p_cur;
p_out = p_cur;
}
else
{
p_cur->m_p_next_sibling = m_p_root;
- if (m_p_root != NULL)
+ if (m_p_root != 0)
m_p_root->m_p_prev_or_parent = p_cur;
m_p_root = p_cur;
}
@@ -141,7 +141,7 @@ PB_DS_CLASS_C_DEC::
bubble_to_top(node_pointer p_nd)
{
node_pointer p_parent = parent(p_nd);
- while (p_parent != NULL)
+ while (p_parent != 0)
{
swap_with_parent(p_nd, p_parent);
p_parent = parent(p_nd);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
index 926ccd39c22..478abe018b0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
@@ -87,12 +87,12 @@ inline void
PB_DS_CLASS_C_DEC::
make_child_of(node_pointer p_nd, node_pointer p_new_parent)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_new_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_new_parent != 0);
p_nd->m_p_next_sibling = p_new_parent->m_p_l_child;
- if (p_new_parent->m_p_l_child != NULL)
+ if (p_new_parent->m_p_l_child != 0)
p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd;
p_nd->m_p_prev_or_parent = p_new_parent;
@@ -109,7 +109,7 @@ parent(node_pointer p_nd)
{
node_pointer p_pot = p_nd->m_p_prev_or_parent;
- if (p_pot == NULL || p_pot->m_p_l_child == p_nd)
+ if (p_pot == 0 || p_pot->m_p_l_child == p_nd)
return p_pot;
p_nd = p_pot;
@@ -124,12 +124,12 @@ swap_with_parent(node_pointer p_nd, node_pointer p_parent)
if (p_parent == m_p_root)
m_p_root = p_nd;
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_parent != 0);
_GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent);
const bool nd_direct_child = p_parent->m_p_l_child == p_nd;
- const bool parent_root = p_parent->m_p_prev_or_parent == NULL;
+ const bool parent_root = p_parent->m_p_prev_or_parent == 0;
const bool parent_direct_child =
!parent_root&& p_parent->m_p_prev_or_parent->m_p_l_child == p_parent;
@@ -138,16 +138,16 @@ swap_with_parent(node_pointer p_nd, node_pointer p_parent)
std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child);
std::swap(p_parent->m_metadata, p_nd->m_metadata);
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != 0);
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
- if (p_parent->m_p_next_sibling != NULL)
+ if (p_parent->m_p_next_sibling != 0)
p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent;
- if (p_parent->m_p_l_child != NULL)
+ if (p_parent->m_p_l_child != 0)
p_parent->m_p_l_child->m_p_prev_or_parent = p_parent;
if (parent_direct_child)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
index dca70fdd509..b6587e229f2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
@@ -45,10 +45,10 @@ begin()
{
node_pointer p_nd = m_p_root;
- if (p_nd == NULL)
- return (iterator(NULL));
+ if (p_nd == 0)
+ return (iterator(0));
- while (p_nd->m_p_l_child != NULL)
+ while (p_nd->m_p_l_child != 0)
p_nd = p_nd->m_p_l_child;
return (iterator(p_nd));
@@ -61,10 +61,10 @@ begin() const
{
node_pointer p_nd = m_p_root;
- if (p_nd == NULL)
- return (const_iterator(NULL));
+ if (p_nd == 0)
+ return (const_iterator(0));
- while (p_nd->m_p_l_child != NULL)
+ while (p_nd->m_p_l_child != 0)
p_nd = p_nd->m_p_l_child;
return (const_iterator(p_nd));
@@ -75,7 +75,7 @@ inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{
- return (iterator(NULL));
+ return (iterator(0));
}
PB_DS_CLASS_T_DEC
@@ -83,6 +83,6 @@ inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{
- return (const_iterator(NULL));
+ return (const_iterator(0));
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
index 040466e8e84..7ba4bf6ee8b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
@@ -38,8 +38,8 @@
* Contains an implementation struct for this type of heap's node.
*/
-#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP
-#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP
+#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
namespace __gnu_pbds
{
@@ -52,4 +52,4 @@ namespace __gnu_pbds
} // namespace detail
} // namespace __gnu_pbds
-#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP
+#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
index 2b90cfa1dc0..8d33baa10ac 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
@@ -57,7 +57,7 @@ void
PB_DS_CLASS_C_DEC::
trace_node(const_node_pointer p_nd, size_type level)
{
- while (p_nd != NULL)
+ while (p_nd != 0)
{
for (size_type i = 0; i < level; ++i)
std::cerr << ' ';
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
index c998c3e67c1..662f40f34e8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
@@ -67,13 +67,13 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME() : m_p_l(NULL)
+PB_DS_CLASS_NAME() : m_p_l(0)
{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
PB_DS_CLASS_T_DEC
template<typename It>
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(NULL)
+PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(0)
{
copy_from_range(first_it, last_it);
_GLIBCXX_DEBUG_ONLY(assert_valid(););
@@ -85,7 +85,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
debug_base(),
#endif
-m_p_l(NULL)
+m_p_l(0)
{
__try
{
@@ -125,13 +125,13 @@ PB_DS_CLASS_C_DEC::
deallocate_all()
{
entry_pointer p_l = m_p_l;
- while (p_l != NULL)
+ while (p_l != 0)
{
entry_pointer p_next_l = p_l->m_p_next;
actual_erase_entry(p_l);
p_l = p_next_l;
}
- m_p_l = NULL;
+ m_p_l = 0;
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
index cdc59208fa3..a7d0fbadf89 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
@@ -44,7 +44,7 @@ PB_DS_CLASS_C_DEC::
erase(const_key_reference r_key)
{
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
- if (m_p_l == NULL)
+ if (m_p_l == 0)
return false;
if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
@@ -56,7 +56,7 @@ erase(const_key_reference r_key)
}
entry_pointer p_l = m_p_l;
- while (p_l->m_p_next != NULL)
+ while (p_l->m_p_next != 0)
if (s_eq_fn(r_key, PB_DS_V2F(p_l->m_p_next->m_value)))
{
erase_next(p_l);
@@ -83,7 +83,7 @@ erase_if(Pred pred)
{
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
size_type num_ersd = 0;
- while (m_p_l != NULL && pred(m_p_l->m_value))
+ while (m_p_l != 0 && pred(m_p_l->m_value))
{
entry_pointer p_next = m_p_l->m_p_next;
++num_ersd;
@@ -91,11 +91,11 @@ erase_if(Pred pred)
m_p_l = p_next;
}
- if (m_p_l == NULL)
+ if (m_p_l == 0)
return num_ersd;
entry_pointer p_l = m_p_l;
- while (p_l->m_p_next != NULL)
+ while (p_l->m_p_next != 0)
{
if (pred(p_l->m_p_next->m_value))
{
@@ -115,9 +115,9 @@ void
PB_DS_CLASS_C_DEC::
erase_next(entry_pointer p_l)
{
- _GLIBCXX_DEBUG_ASSERT(p_l != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_l != 0);
_GLIBCXX_DEBUG_ASSERT(p_l != m_p_l);
- _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != 0);
entry_pointer p_next_l = p_l->m_p_next->m_p_next;
actual_erase_entry(p_l->m_p_next);
p_l->m_p_next = p_next_l;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
index 50347ac5fca..e7f5ed1d3f8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
@@ -43,8 +43,8 @@ inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
find_imp(const_key_reference r_key) const
{
- if (m_p_l == NULL)
- return NULL;
+ if (m_p_l == 0)
+ return 0;
if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
{
apply_update(m_p_l, s_metadata_type_indicator);
@@ -53,7 +53,7 @@ find_imp(const_key_reference r_key) const
}
entry_pointer p_l = m_p_l;
- while (p_l->m_p_next != NULL)
+ while (p_l->m_p_next != 0)
{
entry_pointer p_next = p_l->m_p_next;
if (s_eq_fn(r_key, PB_DS_V2F(p_next->m_value)))
@@ -72,7 +72,7 @@ find_imp(const_key_reference r_key) const
}
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
- return NULL;
+ return 0;
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
index 5ad39709d5d..1aaaf1edd92 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
@@ -54,4 +54,4 @@ PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
-{ return (m_p_l == NULL); }
+{ return (m_p_l == 0); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
index 5efe2a13a66..197cfbc6d18 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
@@ -48,7 +48,7 @@ insert(const_reference r_val)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
entry_pointer p_l = find_imp(PB_DS_V2F(r_val));
- if (p_l != NULL)
+ if (p_l != 0)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(r_val));)
return std::make_pair(point_iterator(&p_l->m_value), false);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
index e3247c5b080..4d4e0b417c2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
@@ -43,7 +43,7 @@ inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{
- if (m_p_l == NULL)
+ if (m_p_l == 0)
{
_GLIBCXX_DEBUG_ASSERT(empty());
return end();
@@ -56,7 +56,7 @@ inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{
- if (m_p_l == NULL)
+ if (m_p_l == 0)
{
_GLIBCXX_DEBUG_ASSERT(empty());
return end();
@@ -68,13 +68,13 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
-{ return iterator(NULL, NULL, this); }
+{ return iterator(0, 0, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{
- return const_iterator(NULL, NULL, const_cast<PB_DS_CLASS_C_DEC* const>(this));
+ return const_iterator(0, 0, const_cast<PB_DS_CLASS_C_DEC* const>(this));
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
index 0e9336b57ca..cf43064e504 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
@@ -233,7 +233,7 @@ namespace __gnu_pbds
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
entry_pointer p_e = find_imp(r_key);
- return point_iterator(p_e == NULL ? NULL: &p_e->m_value);
+ return point_iterator(p_e == 0 ? 0: &p_e->m_value);
}
inline const_point_iterator
@@ -241,7 +241,7 @@ namespace __gnu_pbds
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
entry_pointer p_e = find_imp(r_key);
- return const_point_iterator(p_e == NULL ? NULL: &p_e->m_value);
+ return const_point_iterator(p_e == 0 ? 0: &p_e->m_value);
}
inline bool
@@ -315,7 +315,7 @@ namespace __gnu_pbds
inc_it_state(const_pointer& r_p_value, entry_pointer& r_pos) const
{
r_pos = r_pos->m_p_next;
- r_p_value = (r_pos == NULL) ? NULL : &r_pos->m_value;
+ r_p_value = (r_pos == 0) ? 0 : &r_pos->m_value;
}
template<typename Metadata>
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
index 908aacc19cd..7c8defcdf06 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
@@ -47,7 +47,7 @@ trace() const
{
std::cerr << m_p_l << std::endl << std::endl;
const_entry_pointer p_l = m_p_l;
- while (p_l != NULL)
+ while (p_l != 0)
{
std::cerr << PB_DS_V2F(p_l->m_value) << std::endl;
p_l = p_l->m_p_next;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
index 4ef7fe48a82..8e476cb91b9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -47,7 +47,7 @@ namespace __gnu_pbds
// A list-update metadata type that moves elements to the front of
// the list based on the counter algorithm.
- template<typename Size_Type = size_t>
+ template<typename Size_Type = std::size_t>
class counter_lu_metadata
{
public:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
index 545b9816293..3245566e39a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
@@ -49,9 +49,9 @@ PB_DS_CLASS_C_DEC::s_metadata_alloc;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_CLASS_NAME() :
- m_a_values(NULL),
- m_a_metadata(NULL),
- m_end_it(NULL),
+ m_a_values(0),
+ m_a_metadata(0),
+ m_end_it(0),
m_size(0)
{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }
@@ -59,9 +59,9 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
cmp_fn_base(r_cmp_fn),
- m_a_values(NULL),
- m_a_metadata(NULL),
- m_end_it(NULL),
+ m_a_values(0),
+ m_a_metadata(0),
+ m_end_it(0),
m_size(0)
{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }
@@ -70,9 +70,9 @@ PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
cmp_fn_base(r_cmp_fn),
node_update(r_node_update),
- m_a_values(NULL),
- m_a_metadata(NULL),
- m_end_it(NULL),
+ m_a_values(0),
+ m_a_metadata(0),
+ m_end_it(0),
m_size(0)
{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }
@@ -87,9 +87,9 @@ PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
#endif
cmp_fn_base(other),
node_update(other),
- m_a_values(NULL),
- m_a_metadata(NULL),
- m_end_it(NULL),
+ m_a_values(0),
+ m_a_metadata(0),
+ m_end_it(0),
m_size(0)
{
copy_from_ordered_range(other.begin(), other.end());
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
index c32a8af48c7..9b7011b1ff6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
@@ -47,8 +47,8 @@ assert_valid() const
{
std::cout << "av1" << std::endl;
- if (m_a_values == NULL || m_end_it == NULL || m_size == 0)
- _GLIBCXX_DEBUG_ASSERT(m_a_values == NULL && m_end_it == NULL && m_size == 0);
+ if (m_a_values == 0 || m_end_it == 0 || m_size == 0)
+ _GLIBCXX_DEBUG_ASSERT(m_a_values == 0 && m_end_it == 0 && m_size == 0);
std::cout << "av2" << std::endl;
assert_iterators();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
index 05e7d1a1107..dd24114f490 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
@@ -56,7 +56,7 @@ clear()
}
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
- m_a_values = NULL;
+ m_a_values = 0;
m_size = 0;
m_end_it = m_a_values;
_GLIBCXX_DEBUG_ONLY(assert_valid();)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
index 91d277b0cae..08d6bfc2293 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
@@ -50,9 +50,9 @@ void
PB_DS_CLASS_C_DEC::
reallocate_metadata(Node_Update_* , size_type new_size)
{
- metadata_pointer a_new_metadata_vec =(new_size == 0) ? NULL : s_metadata_alloc.allocate(new_size);
+ metadata_pointer a_new_metadata_vec =(new_size == 0) ? 0 : s_metadata_alloc.allocate(new_size);
- if (m_a_metadata != NULL)
+ if (m_a_metadata != 0)
{
for (size_type i = 0; i < m_size; ++i)
m_a_metadata[i].~metadata_type();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
index 7652c4c2ea2..0417ae1dd9e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
@@ -69,8 +69,8 @@ PB_DS_node_begin_imp() const
{
return const_node_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
const_cast<pointer>(begin()),
- const_cast<pointer>(end()),(m_a_metadata == NULL)?
- NULL :
+ const_cast<pointer>(end()),(m_a_metadata == 0)?
+ 0 :
mid_pointer(m_a_metadata, m_a_metadata + m_size));
}
@@ -80,7 +80,7 @@ PB_DS_CLASS_C_DEC::
PB_DS_node_end_imp() const
{
return const_node_iterator(end(), end(), end(),
- (m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);
+ (m_a_metadata == 0) ? 0 : m_a_metadata + m_size);
}
PB_DS_CLASS_T_DEC
@@ -89,7 +89,7 @@ PB_DS_CLASS_C_DEC::
PB_DS_node_begin_imp()
{
return node_iterator(mid_pointer(begin(), end()), begin(), end(),
- (m_a_metadata == NULL) ? NULL : mid_pointer(m_a_metadata, m_a_metadata + m_size));
+ (m_a_metadata == 0) ? 0 : mid_pointer(m_a_metadata, m_a_metadata + m_size));
}
PB_DS_CLASS_T_DEC
@@ -98,6 +98,6 @@ PB_DS_CLASS_C_DEC::
PB_DS_node_end_imp()
{
return node_iterator(end(), end(),
- end(),(m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);
+ end(),(m_a_metadata == 0) ? 0 : m_a_metadata + m_size);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
index 68fedc0eb05..1c45c51c1d8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
@@ -118,7 +118,7 @@ namespace __gnu_pbds
public:
inline
- ov_tree_node_const_it_(const_pointer p_nd = NULL, const_pointer p_begin_nd = NULL, const_pointer p_end_nd = NULL, const_metadata_pointer p_metadata = NULL) : m_p_value(const_cast<pointer>(p_nd)), m_p_begin_value(const_cast<pointer>(p_begin_nd)), m_p_end_value(const_cast<pointer>(p_end_nd)), m_p_metadata(p_metadata)
+ ov_tree_node_const_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : m_p_value(const_cast<pointer>(p_nd)), m_p_begin_value(const_cast<pointer>(p_begin_nd)), m_p_end_value(const_cast<pointer>(p_end_nd)), m_p_metadata(p_metadata)
{ }
inline const_reference
@@ -134,7 +134,7 @@ namespace __gnu_pbds
};
PB_DS_STATIC_ASSERT(should_have_metadata, has_metadata);
- _GLIBCXX_DEBUG_ASSERT(m_p_metadata != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_metadata != 0);
return *m_p_metadata;
}
@@ -164,8 +164,8 @@ namespace __gnu_pbds
return (this_type(mid_pointer(m_p_value + 1, m_p_end_value),
m_p_value + 1,
- m_p_end_value,(m_p_metadata == NULL) ?
- NULL : mid_pointer(m_p_metadata + 1, p_end_metadata)));
+ m_p_end_value,(m_p_metadata == 0) ?
+ 0 : mid_pointer(m_p_metadata + 1, p_end_metadata)));
}
inline bool
@@ -241,7 +241,7 @@ namespace __gnu_pbds
public:
inline
- ov_tree_node_it_(const_pointer p_nd = NULL, const_pointer p_begin_nd = NULL, const_pointer p_end_nd = NULL, const_metadata_pointer p_metadata = NULL) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata)
+ ov_tree_node_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata)
{ }
// Access.
@@ -277,8 +277,8 @@ namespace __gnu_pbds
return (this_type(base_type::mid_pointer(base_type::m_p_value + 1, base_type::m_p_end_value),
base_type::m_p_value + 1,
- base_type::m_p_end_value,(base_type::m_p_metadata == NULL)?
- NULL : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata)));
+ base_type::m_p_end_value,(base_type::m_p_metadata == 0)?
+ 0 : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata)));
}
};
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
index 7c9fc13456a..51afa4fab92 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
@@ -45,8 +45,8 @@ void
PB_DS_CLASS_C_DEC::
assert_valid() const
{
- _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root == NULL
- || base_type::m_p_root->m_p_next_sibling == NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root == 0
+ || base_type::m_p_root->m_p_next_sibling == 0);
base_type::assert_valid();
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
index 905be1098cf..226e9531ada 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
@@ -48,8 +48,8 @@ pop()
node_pointer p_new_root = join_node_children(base_type::m_p_root);
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_new_root, false);)
- if (p_new_root != NULL)
- p_new_root->m_p_prev_or_parent = NULL;
+ if (p_new_root != 0)
+ p_new_root->m_p_prev_or_parent = 0;
base_type::actual_erase_node(base_type::m_p_root);
base_type::m_p_root = p_new_root;
@@ -78,27 +78,27 @@ remove_node(node_pointer p_nd)
node_pointer p_new_child = join_node_children(p_nd);
#ifdef _GLIBCXX_DEBUG
- if (p_new_child != NULL)
+ if (p_new_child != 0)
base_type::assert_node_consistent(p_new_child, false);
#endif
if (p_nd == base_type::m_p_root)
{
- if (p_new_child != NULL)
- p_new_child->m_p_prev_or_parent = NULL;
+ if (p_new_child != 0)
+ p_new_child->m_p_prev_or_parent = 0;
base_type::m_p_root = p_new_child;
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(base_type::m_p_root, false);)
return;
}
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent != 0);
if (p_nd->m_p_prev_or_parent->m_p_l_child == p_nd)
{
- if (p_new_child != NULL)
+ if (p_new_child != 0)
{
p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;
- if (p_new_child->m_p_next_sibling != NULL)
+ if (p_new_child->m_p_next_sibling != 0)
p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;
p_nd->m_p_prev_or_parent->m_p_l_child = p_new_child;
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
@@ -106,17 +106,17 @@ remove_node(node_pointer p_nd)
}
p_nd->m_p_prev_or_parent->m_p_l_child = p_nd->m_p_next_sibling;
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
return;
}
- if (p_new_child != NULL)
+ if (p_new_child != 0)
{
p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;
- if (p_new_child->m_p_next_sibling != NULL)
+ if (p_new_child->m_p_next_sibling != 0)
p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;
p_new_child->m_p_prev_or_parent->m_p_next_sibling = p_new_child;
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
@@ -124,7 +124,7 @@ remove_node(node_pointer p_nd)
}
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
}
@@ -134,11 +134,11 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
join_node_children(node_pointer p_nd)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
node_pointer p_ret = p_nd->m_p_l_child;
- if (p_ret == NULL)
- return NULL;
- while (p_ret->m_p_next_sibling != NULL)
+ if (p_ret == 0)
+ return 0;
+ while (p_ret->m_p_next_sibling != 0)
p_ret = forward_join(p_ret, p_ret->m_p_next_sibling);
while (p_ret->m_p_prev_or_parent != p_nd)
p_ret = back_join(p_ret->m_p_prev_or_parent, p_ret);
@@ -151,17 +151,17 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
forward_join(node_pointer p_nd, node_pointer p_next)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == p_next);
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
{
p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
base_type::make_child_of(p_nd, p_next);
- return p_next->m_p_next_sibling == NULL
+ return p_next->m_p_next_sibling == 0
? p_next : p_next->m_p_next_sibling;
}
- if (p_next->m_p_next_sibling != NULL)
+ if (p_next->m_p_next_sibling != 0)
{
p_next->m_p_next_sibling->m_p_prev_or_parent = p_nd;
p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
@@ -169,7 +169,7 @@ forward_join(node_pointer p_nd, node_pointer p_next)
return p_nd->m_p_next_sibling;
}
- p_nd->m_p_next_sibling = NULL;
+ p_nd->m_p_next_sibling = 0;
base_type::make_child_of(p_next, p_nd);
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));
return p_nd;
@@ -180,8 +180,8 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
back_join(node_pointer p_nd, node_pointer p_next)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == 0);
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
{
@@ -191,7 +191,7 @@ back_join(node_pointer p_nd, node_pointer p_next)
return p_next;
}
- p_nd->m_p_next_sibling = NULL;
+ p_nd->m_p_next_sibling = 0;
base_type::make_child_of(p_next, p_nd);
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));
return p_nd;
@@ -212,7 +212,7 @@ erase_if(Pred pred)
base_type::to_linked_list();
node_pointer p_out = base_type::prune(pred);
size_type ersd = 0;
- while (p_out != NULL)
+ while (p_out != 0)
{
++ersd;
node_pointer p_next = p_out->m_p_next_sibling;
@@ -221,11 +221,11 @@ erase_if(Pred pred)
}
node_pointer p_cur = base_type::m_p_root;
- base_type::m_p_root = NULL;
- while (p_cur != NULL)
+ base_type::m_p_root = 0;
+ while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
- p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = NULL;
+ p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0;
push_imp(p_cur);
p_cur = p_next;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
index b00e9d13cdf..af929e58131 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
@@ -59,17 +59,17 @@ inline void
PB_DS_CLASS_C_DEC::
push_imp(node_pointer p_nd)
{
- p_nd->m_p_l_child = NULL;
+ p_nd->m_p_l_child = 0;
- if (base_type::m_p_root == NULL)
+ if (base_type::m_p_root == 0)
{
- p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = NULL;
+ p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;
base_type::m_p_root = p_nd;
}
else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))
{
- p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = NULL;
+ p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;
base_type::make_child_of(base_type::m_p_root, p_nd);
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
index 85d4ddf074a..12032734f4e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
@@ -61,7 +61,7 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_out = base_type::prune(pred);
- while (p_out != NULL)
+ while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
@@ -70,7 +70,7 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_next = p_out->m_p_next_sibling;
- p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = NULL;
+ p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = 0;
other.push_imp(p_out);
@@ -81,13 +81,13 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_cur = base_type::m_p_root;
- base_type::m_p_root = NULL;
+ base_type::m_p_root = 0;
- while (p_cur != NULL)
+ while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
- p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = NULL;
+ p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0;
push_imp(p_cur);
@@ -106,7 +106,7 @@ join(PB_DS_CLASS_C_DEC& other)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
- if (other.m_p_root == NULL)
+ if (other.m_p_root == 0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
@@ -114,7 +114,7 @@ join(PB_DS_CLASS_C_DEC& other)
return;
}
- if (base_type::m_p_root == NULL)
+ if (base_type::m_p_root == 0)
base_type::m_p_root = other.m_p_root;
else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, other.m_p_root->m_value))
{
@@ -131,7 +131,7 @@ join(PB_DS_CLASS_C_DEC& other)
base_type::m_size += other.m_size;
- other.m_p_root = NULL;
+ other.m_p_root = 0;
other.m_size = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid();)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
index 15f349efbed..8decad5a7f0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
@@ -48,8 +48,8 @@ public:
typedef node_pointer_reference reference;
inline
- iterator(node_pointer_pointer p_p_cur = NULL,
- node_pointer_pointer p_p_end = NULL)
+ iterator(node_pointer_pointer p_p_cur = 0,
+ node_pointer_pointer p_p_end = 0)
: const_iterator(p_p_cur, p_p_end)
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
index bc349cf2dbd..5cc9c2234c6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
@@ -53,8 +53,8 @@ public:
public:
inline
- const_iterator(node_pointer_pointer p_p_cur = NULL,
- node_pointer_pointer p_p_end = NULL)
+ const_iterator(node_pointer_pointer p_p_cur = 0,
+ node_pointer_pointer p_p_end = 0)
: m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)
{ }
@@ -71,7 +71,7 @@ public:
{
do
++m_p_p_cur;
- while (m_p_p_cur != m_p_p_end&& * m_p_p_cur == NULL);
+ while (m_p_p_cur != m_p_p_end&& * m_p_p_cur == 0);
return *this;
}
@@ -101,7 +101,7 @@ protected:
#ifdef _GLIBCXX_DEBUG
void
assert_referencible() const
- { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end&& * m_p_p_cur != NULL); }
+ { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end&& * m_p_p_cur != 0); }
#endif
public:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
index ca38f932a62..4d4b52a55eb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
@@ -85,7 +85,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
initialize();
m_size = other.m_size;
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
- if (other.m_p_head->m_p_parent == NULL)
+ if (other.m_p_head->m_p_parent == 0)
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
return;
@@ -143,7 +143,7 @@ PB_DS_CLASS_C_DEC::
initialize()
{
new (m_p_head) head();
- m_p_head->m_p_parent = NULL;
+ m_p_head->m_p_parent = 0;
m_p_head->m_p_min = m_p_head;
m_p_head->m_p_max = m_p_head;
m_size = 0;
@@ -164,7 +164,7 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
recursive_copy_node(const_node_pointer p_other_nd)
{
- _GLIBCXX_DEBUG_ASSERT(p_other_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_other_nd != 0);
if (p_other_nd->m_type == pat_trie_leaf_node_type)
{
const_leaf_pointer p_other_leaf = static_cast<const_leaf_pointer>(p_other_nd);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
index de75657881b..664206499b2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
@@ -45,11 +45,11 @@ void
PB_DS_CLASS_C_DEC::
assert_valid() const
{
- if (m_p_head->m_p_parent != NULL)
+ if (m_p_head->m_p_parent != 0)
m_p_head->m_p_parent->assert_valid(this);
assert_iterators();
assert_reverse_iterators();
- if (m_p_head->m_p_parent == NULL)
+ if (m_p_head->m_p_parent == 0)
{
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_min == m_p_head);
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_max == m_p_head);
@@ -99,7 +99,7 @@ typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
recursive_count_leafs(const_node_pointer p_nd)
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return (0);
if (p_nd->m_type == pat_trie_leaf_node_type)
return (1);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
index 90988184a8d..57e998981a8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
@@ -44,7 +44,7 @@ PB_DS_CLASS_C_DEC::
erase(const_key_reference r_key)
{
node_pointer p_nd = find_imp(r_key);
- if (p_nd == NULL || p_nd->m_type == pat_trie_internal_node_type)
+ if (p_nd == 0 || p_nd->m_type == pat_trie_internal_node_type)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
return false;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
index 2552ead8bc5..f53af256339 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
@@ -46,7 +46,7 @@ find(const_key_reference r_key)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
node_pointer p_nd = find_imp(r_key);
- if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)
+ if (p_nd == 0 || p_nd->m_type != pat_trie_leaf_node_type)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return end();
@@ -71,7 +71,7 @@ find(const_key_reference r_key) const
const_node_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
- if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)
+ if (p_nd == 0 || p_nd->m_type != pat_trie_leaf_node_type)
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
return end();
@@ -93,7 +93,7 @@ PB_DS_CLASS_C_DEC::
find_imp(const_key_reference r_key)
{
if (empty())
- return (NULL);
+ return (0);
typename synth_e_access_traits::const_iterator b_it =
synth_e_access_traits::begin(r_key);
@@ -101,14 +101,14 @@ find_imp(const_key_reference r_key)
synth_e_access_traits::end(r_key);
node_pointer p_nd = m_p_head->m_p_parent;
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
while (p_nd->m_type != pat_trie_leaf_node_type)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
node_pointer p_next_nd = static_cast<internal_node_pointer>(p_nd)->get_child_node(b_it, e_it, this);
- if (p_next_nd == NULL)
+ if (p_next_nd == 0)
return p_nd;
p_nd = p_next_nd;
}
@@ -124,7 +124,7 @@ lower_bound_imp(const_key_reference r_key)
return (m_p_head);
node_pointer p_nd = m_p_head->m_p_parent;
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
typename PB_DS_CLASS_C_DEC::const_e_iterator b_it =
synth_e_access_traits::begin(r_key);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
index e6049743f61..de3cb35276b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
@@ -165,7 +165,7 @@ rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
it != p_r->end(); ++ it)
{
const_node_pointer p_l_join_child = p_l->get_join_child(*it, this);
- if (p_l_join_child != NULL)
+ if (p_l_join_child != 0)
rec_join_prep(p_l_join_child, * it, r_bag);
}
return;
@@ -175,7 +175,7 @@ rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
- if (p_r_join_child != NULL)
+ if (p_r_join_child != 0)
rec_join_prep(p_r_join_child, p_l, r_bag);
return;
}
@@ -184,7 +184,7 @@ rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
- if (p_r_join_child != NULL)
+ if (p_r_join_child != 0)
rec_join_prep(p_r_join_child, p_l, r_bag);
return;
}
@@ -196,8 +196,8 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
{
- _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
- if (p_l == NULL)
+ _GLIBCXX_DEBUG_ASSERT(p_r != 0);
+ if (p_l == 0)
{
apply_update(p_r, (node_update* )this);
return (p_r);
@@ -245,8 +245,8 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(leaf_pointer p_l, leaf_pointer p_r, split_join_branch_bag& r_bag)
{
- _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
- if (p_l == NULL)
+ _GLIBCXX_DEBUG_ASSERT(p_r != 0);
+ if (p_l == 0)
return (p_r);
node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
_GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == 2);
@@ -264,7 +264,7 @@ rec_join(leaf_pointer p_l, internal_node_pointer p_r, size_type checked_ind,
const size_type rhs_leafs = recursive_count_leafs(p_r);
#endif
- _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_r != 0);
node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag);
_GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == lhs_leafs + rhs_leafs);
return p_ret;
@@ -275,8 +275,8 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
{
- _GLIBCXX_DEBUG_ASSERT(p_l != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_l != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_r != 0);
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = recursive_count_leafs(p_l);
@@ -313,8 +313,8 @@ typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch_bag& r_bag)
{
- _GLIBCXX_DEBUG_ASSERT(p_l != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_l != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_r != 0);
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = recursive_count_leafs(p_l);
@@ -378,7 +378,7 @@ PB_DS_CLASS_C_DEC::
insert(const_reference r_val)
{
node_pointer p_lf = find_imp(PB_DS_V2F(r_val));
- if (p_lf != NULL && p_lf->m_type == pat_trie_leaf_node_type &&
+ if (p_lf != 0 && p_lf->m_type == pat_trie_leaf_node_type &&
synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
{
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(r_val)));
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
index bf2f42916dd..56cf1330497 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -226,7 +226,7 @@ namespace __gnu_pbds
get_pref_pos(const_e_iterator b_it, const_e_iterator e_it,
const_e_access_traits_pointer p_traits) const
{
- if (static_cast<size_t>(std::distance(b_it, e_it)) <= m_e_ind)
+ if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind)
return 0;
std::advance(b_it, m_e_ind);
return 1 + p_traits->e_pos(*b_it);
@@ -240,7 +240,7 @@ namespace __gnu_pbds
{
std::advance(m_pref_e_it, m_e_ind);
std::fill(m_a_p_children, m_a_p_children + arr_size,
- static_cast<node_pointer>(NULL));
+ static_cast<node_pointer>(0));
}
PB_DS_CLASS_T_DEC
@@ -317,7 +317,7 @@ namespace __gnu_pbds
{
const size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
- _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0);
return iterator(m_a_p_children + i, m_a_p_children + i);
}
@@ -345,11 +345,11 @@ namespace __gnu_pbds
size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
- if (m_a_p_children[i] != NULL)
+ if (m_a_p_children[i] != 0)
return m_a_p_children[i];
while (++i < arr_size)
- if (m_a_p_children[i] != NULL)
+ if (m_a_p_children[i] != 0)
{
if (m_a_p_children[i]->m_type == pat_trie_leaf_node_type)
return m_a_p_children[i];
@@ -370,7 +370,7 @@ namespace __gnu_pbds
{
const size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
- if (m_a_p_children[i] == NULL)
+ if (m_a_p_children[i] == 0)
{
m_a_p_children[i] = p_nd;
p_nd->m_p_parent = this;
@@ -423,7 +423,7 @@ namespace __gnu_pbds
for (; i < arr_size; ++i)
if (m_a_p_children[i] == p_nd)
{
- m_a_p_children[i] = NULL;
+ m_a_p_children[i] = 0;
return;
}
_GLIBCXX_DEBUG_ASSERT(i != arr_size);
@@ -436,7 +436,7 @@ namespace __gnu_pbds
{
iterator ret = it;
++ret;
- * it.m_p_p_cur = NULL;
+ * it.m_p_p_cur = 0;
return ret;
}
@@ -558,7 +558,7 @@ namespace __gnu_pbds
get_begin_pos() const
{
size_type i;
- for (i = 0; i < arr_size && m_a_p_children[i] == NULL; ++i)
+ for (i = 0; i < arr_size && m_a_p_children[i] == 0; ++i)
;
return i;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
index 9902d96dbb1..893a762056d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
@@ -110,11 +110,11 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_node_iterator
PB_DS_CLASS_C_DEC::
node_end() const
-{ return const_node_iterator(NULL, this); }
+{ return const_node_iterator(0, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_end()
-{ return node_iterator(NULL, this); }
+{ return node_iterator(0, this); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
index 37250091d00..eb5e0002b9f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
@@ -180,8 +180,8 @@ namespace __gnu_pbds
pat_trie_const_node_it_()
*/
inline
- pat_trie_const_node_it_(node_pointer p_nd = NULL,
- const_e_access_traits_pointer p_traits = NULL)
+ pat_trie_const_node_it_(node_pointer p_nd = 0,
+ const_e_access_traits_pointer p_traits = 0)
: m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
{ }
@@ -299,7 +299,7 @@ namespace __gnu_pbds
*/
inline
- pat_trie_node_it_(node_pointer p_nd = NULL, const_e_access_traits_pointer p_traits = NULL) : base_type(p_nd, p_traits)
+ pat_trie_node_it_(node_pointer p_nd = 0, const_e_access_traits_pointer p_traits = 0) : base_type(p_nd, p_traits)
{ }
// Access; returns the iterator* associated with the current leaf.
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
index cada9071c51..0a142478eb8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
@@ -145,7 +145,7 @@ namespace __gnu_pbds
public:
inline
- pat_trie_const_it_(node_pointer p_nd = NULL) : m_p_nd(p_nd)
+ pat_trie_const_it_(node_pointer p_nd = 0) : m_p_nd(p_nd)
{ }
inline
@@ -245,7 +245,7 @@ namespace __gnu_pbds
node_pointer p_y = m_p_nd->m_p_parent;
while (p_y->m_type != pat_trie_head_node_type &&
- get_larger_sibling(m_p_nd) == NULL)
+ get_larger_sibling(m_p_nd) == 0)
{
m_p_nd = p_y;
p_y = p_y->m_p_parent;
@@ -274,7 +274,7 @@ namespace __gnu_pbds
node_pointer p_y = m_p_nd->m_p_parent;
while (p_y->m_type != pat_trie_head_node_type &&
- get_smaller_sibling(m_p_nd) == NULL)
+ get_smaller_sibling(m_p_nd) == 0)
{
m_p_nd = p_y;
p_y = p_y->m_p_parent;
@@ -300,7 +300,7 @@ namespace __gnu_pbds
typename Internal_Node::iterator next_it = it;
++next_it;
- return ((next_it == p_parent->end())? NULL :* next_it);
+ return ((next_it == p_parent->end())? 0 :* next_it);
}
inline static node_pointer
@@ -312,7 +312,7 @@ namespace __gnu_pbds
typename Internal_Node::iterator it = p_parent->begin();
if (*it == p_nd)
- return (NULL);
+ return (0);
typename Internal_Node::iterator prev_it;
do
{
@@ -324,7 +324,7 @@ namespace __gnu_pbds
while (true);
_GLIBCXX_DEBUG_ASSERT(false);
- return (NULL);
+ return (0);
}
inline static leaf_pointer
@@ -397,7 +397,7 @@ namespace __gnu_pbds
typedef typename Type_Traits::reference reference;
inline
- pat_trie_it_(node_pointer p_nd = NULL) : PB_DS_CONST_IT_C_DEC((node_pointer)p_nd)
+ pat_trie_it_(node_pointer p_nd = 0) : PB_DS_CONST_IT_C_DEC((node_pointer)p_nd)
{ }
inline
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
index 52edf250635..bfb456392b2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
@@ -93,7 +93,7 @@ void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
clear_imp(p_nd->m_p_left);
clear_imp(p_nd->m_p_right);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
index c0809fa48bc..40dc38c71b4 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
@@ -46,7 +46,7 @@ rotate_left(node_pointer p_x)
node_pointer p_y = p_x->m_p_right;
p_x->m_p_right = p_y->m_p_left;
- if (p_y->m_p_left != NULL)
+ if (p_y->m_p_left != 0)
p_y->m_p_left->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
@@ -75,7 +75,7 @@ rotate_right(node_pointer p_x)
node_pointer p_y = p_x->m_p_left;
p_x->m_p_left = p_y->m_p_right;
- if (p_y->m_p_right != NULL)
+ if (p_y->m_p_right != 0)
p_y->m_p_right->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
@@ -122,10 +122,10 @@ inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer p_nd, Node_Update_* p_update)
{
- p_update->operator()(& PB_DS_V2F(p_nd->m_value),(p_nd->m_p_left == NULL) ?
- NULL :
- & PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == NULL) ?
- NULL :
+ p_update->operator()(& PB_DS_V2F(p_nd->m_value),(p_nd->m_p_left == 0) ?
+ 0 :
+ & PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == 0) ?
+ 0 :
& PB_DS_V2F(p_nd->m_p_right->m_value));
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
index 9779a4bcd22..320d32c0667 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
@@ -47,7 +47,7 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
_GLIBCXX_DEBUG_ONLY(other.assert_valid(););
split_join_branch_bag bag;
leaf_pointer p_split_lf = split_prep(r_key, other, bag);
- if (p_split_lf == NULL)
+ if (p_split_lf == 0)
{
_GLIBCXX_DEBUG_ASSERT(bag.empty());
_GLIBCXX_DEBUG_ONLY(assert_valid();)
@@ -88,7 +88,7 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branc
other.clear();
_GLIBCXX_DEBUG_ONLY(assert_valid(););
_GLIBCXX_DEBUG_ONLY(other.assert_valid(););
- return (NULL);
+ return (0);
}
if (synth_e_access_traits::cmp_keys(r_key,
@@ -98,7 +98,7 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branc
value_swap(other);
_GLIBCXX_DEBUG_ONLY(assert_valid(););
_GLIBCXX_DEBUG_ONLY(other.assert_valid(););
- return (NULL);
+ return (0);
}
if (!synth_e_access_traits::cmp_keys(r_key,
@@ -106,7 +106,7 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branc
{
_GLIBCXX_DEBUG_ONLY(assert_valid(););
_GLIBCXX_DEBUG_ONLY(other.assert_valid(););
- return (NULL);
+ return (0);
}
iterator it = lower_bound(r_key);
@@ -134,7 +134,7 @@ rec_split(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it, PB_DS
{
if (p_nd->m_type == pat_trie_leaf_node_type)
{
- _GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == NULL);
+ _GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == 0);
return (p_nd);
}
@@ -202,27 +202,27 @@ PB_DS_CLASS_C_DEC::
split_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_node::iterator child_b_it, size_type num_children, split_join_branch_bag& r_bag)
{
#ifdef _GLIBCXX_DEBUG
- if (m_p_head->m_p_parent != NULL)
+ if (m_p_head->m_p_parent != 0)
m_p_head->m_p_parent->assert_valid(this);
#endif
- const size_type total_num_children =((m_p_head->m_p_parent == NULL)? 0 : 1) + num_children;
+ const size_type total_num_children =((m_p_head->m_p_parent == 0)? 0 : 1) + num_children;
if (total_num_children == 0)
{
- _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
return;
}
if (total_num_children == 1)
{
- if (m_p_head->m_p_parent != NULL)
+ if (m_p_head->m_p_parent != 0)
{
_GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)
return;
}
- _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
m_p_head->m_p_parent =* child_b_it;
m_p_head->m_p_parent->m_p_parent = m_p_head;
apply_update(m_p_head->m_p_parent, (node_update* )this);
@@ -242,7 +242,7 @@ split_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_no
++child_b_it;
}
- if (m_p_head->m_p_parent != NULL)
+ if (m_p_head->m_p_parent != 0)
p_new_root->add_child(m_p_head->m_p_parent,
pref_begin(m_p_head->m_p_parent),
pref_end(m_p_head->m_p_parent), this);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
index e4b20943be6..e6af80413a4 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
@@ -46,7 +46,7 @@ PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << std::endl;
- if (m_p_head->m_p_parent == NULL)
+ if (m_p_head->m_p_parent == 0)
return;
trace_node(m_p_head->m_p_parent, 0);
std::cerr << std::endl;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
index 6d275e731d1..1eecdc10990 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
@@ -51,5 +51,5 @@ PB_DS_CLASS_C_DEC::
apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
{
Node_Update_::operator()(node_iterator(p_nd, this),
- const_node_iterator(NULL, this));
+ const_node_iterator(0, this));
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
index 18ecc4230ed..7cdadfc5f83 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
@@ -45,7 +45,7 @@ typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
assert_node_consistent(const node_pointer p_nd) const
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return 1;
const size_type l_height = assert_node_consistent(p_nd->m_p_left);
@@ -67,7 +67,7 @@ assert_valid() const
base_type::assert_valid();
const node_pointer p_head = base_type::m_p_head;
_GLIBCXX_DEBUG_ASSERT(p_head->m_red);
- if (p_head->m_p_parent != NULL)
+ if (p_head->m_p_parent != 0)
{
_GLIBCXX_DEBUG_ASSERT(!p_head->m_p_parent->m_red);
assert_node_consistent(p_head->m_p_parent);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
index 685b8a51b6b..2ae4cef072c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
@@ -123,17 +123,17 @@ remove_node(node_pointer p_z)
{
update_min_max_for_erased_node(p_z);
node_pointer p_y = p_z;
- node_pointer p_x = NULL;
- node_pointer p_new_x_parent = NULL;
+ node_pointer p_x = 0;
+ node_pointer p_new_x_parent = 0;
- if (p_y->m_p_left == NULL)
+ if (p_y->m_p_left == 0)
p_x = p_y->m_p_right;
- else if (p_y->m_p_right == NULL)
+ else if (p_y->m_p_right == 0)
p_x = p_y->m_p_left;
else
{
p_y = p_y->m_p_right;
- while (p_y->m_p_left != NULL)
+ while (p_y->m_p_left != 0)
p_y = p_y->m_p_left;
p_x = p_y->m_p_right;
}
@@ -141,7 +141,7 @@ remove_node(node_pointer p_z)
if (p_y == p_z)
{
p_new_x_parent = p_y->m_p_parent;
- if (p_x != NULL)
+ if (p_x != 0)
p_x->m_p_parent = p_y->m_p_parent;
if (base_type::m_p_head->m_p_parent == p_z)
@@ -153,7 +153,7 @@ remove_node(node_pointer p_z)
}
else
{
- p_y->m_p_left = NULL;
+ p_y->m_p_left = 0;
p_z->m_p_parent->m_p_right = p_x;
}
}
@@ -164,7 +164,7 @@ remove_node(node_pointer p_z)
if (p_y != p_z->m_p_right)
{
p_new_x_parent = p_y->m_p_parent;
- if (p_x != NULL)
+ if (p_x != 0)
p_x->m_p_parent = p_y->m_p_parent;
p_y->m_p_parent->m_p_left = p_x;
p_y->m_p_right = p_z->m_p_right;
@@ -198,7 +198,7 @@ void
PB_DS_CLASS_C_DEC::
remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
{
- _GLIBCXX_DEBUG_ASSERT(p_x == NULL || p_x->m_p_parent == p_new_x_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_x == 0 || p_x->m_p_parent == p_new_x_parent);
while (p_x != base_type::m_p_head->m_p_parent && is_effectively_black(p_x))
if (p_x == p_new_x_parent->m_p_left)
@@ -223,7 +223,7 @@ remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
{
if (is_effectively_black(p_w->m_p_right))
{
- if (p_w->m_p_left != NULL)
+ if (p_w->m_p_left != 0)
p_w->m_p_left->m_red = false;
p_w->m_red = true;
@@ -234,7 +234,7 @@ remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
p_w->m_red = p_new_x_parent->m_red;
p_new_x_parent->m_red = false;
- if (p_w->m_p_right != NULL)
+ if (p_w->m_p_right != 0)
p_w->m_p_right->m_red = false;
base_type::rotate_left(p_new_x_parent);
@@ -264,7 +264,7 @@ remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
{
if (is_effectively_black(p_w->m_p_left))
{
- if (p_w->m_p_right != NULL)
+ if (p_w->m_p_right != 0)
p_w->m_p_right->m_red = false;
p_w->m_red = true;
@@ -275,7 +275,7 @@ remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
p_w->m_red = p_new_x_parent->m_red;
p_new_x_parent->m_red = false;
- if (p_w->m_p_left != NULL)
+ if (p_w->m_p_left != 0)
p_w->m_p_left->m_red = false;
base_type::rotate_right(p_new_x_parent);
@@ -284,6 +284,6 @@ remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
}
}
- if (p_x != NULL)
+ if (p_x != 0)
p_x->m_red = false;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
index 6b43b1a994c..97eba22f6f8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
@@ -42,5 +42,5 @@ PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
is_effectively_black(const node_pointer p_nd)
-{ return (p_nd == NULL || !p_nd->m_red); }
+{ return (p_nd == 0 || !p_nd->m_red); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
index 16a5d1edb29..a6a60160cca 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
@@ -67,7 +67,7 @@ insert_fixup(node_pointer p_nd)
if (p_nd->m_p_parent == p_nd->m_p_parent->m_p_parent->m_p_left)
{
node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_right;
- if (p_y != NULL && p_y->m_red)
+ if (p_y != 0 && p_y->m_red)
{
p_nd->m_p_parent->m_red = false;
p_y->m_red = false;
@@ -89,7 +89,7 @@ insert_fixup(node_pointer p_nd)
else
{
node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_left;
- if (p_y != NULL && p_y->m_red)
+ if (p_y != 0 && p_y->m_red)
{
p_nd->m_p_parent->m_red = false;
p_y->m_red = false;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
index 9776a8d9a34..96280564dd2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
@@ -67,8 +67,8 @@ void
PB_DS_CLASS_C_DEC::
join_imp(node_pointer p_x, node_pointer p_r)
{
- _GLIBCXX_DEBUG_ASSERT(p_x != NULL);
- if (p_r != NULL)
+ _GLIBCXX_DEBUG_ASSERT(p_x != 0);
+ if (p_r != 0)
p_r->m_red = false;
const size_type h = black_height(base_type::m_p_head->m_p_parent);
@@ -88,7 +88,7 @@ join_imp(node_pointer p_x, node_pointer p_r)
{
p_x_l = base_type::m_p_head->m_p_parent;
base_type::m_p_head->m_p_parent = p_r;
- if (p_r != NULL)
+ if (p_r != 0)
p_r->m_p_parent = base_type::m_p_head;
join_pos = find_join_pos_left(base_type::m_p_head->m_p_parent,
@@ -112,11 +112,11 @@ join_imp(node_pointer p_x, node_pointer p_r)
}
p_x->m_p_left = p_x_l;
- if (p_x_l != NULL)
+ if (p_x_l != 0)
p_x_l->m_p_parent = p_x;
p_x->m_p_right = p_x_r;
- if (p_x_r != NULL)
+ if (p_x_r != 0)
p_x_r->m_p_parent = p_x;
p_x->m_red = true;
@@ -153,8 +153,8 @@ find_join_pos_right(node_pointer p_l, size_type h_l, size_type h_r)
{
_GLIBCXX_DEBUG_ASSERT(h_l >= h_r);
- if (base_type::m_p_head->m_p_parent == NULL)
- return (std::make_pair((node_pointer)NULL, base_type::m_p_head));
+ if (base_type::m_p_head->m_p_parent == 0)
+ return (std::make_pair((node_pointer)0, base_type::m_p_head));
node_pointer p_l_parent = base_type::m_p_head;
while (h_l > h_r)
@@ -177,7 +177,7 @@ find_join_pos_right(node_pointer p_l, size_type h_l, size_type h_r)
_GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_l));
_GLIBCXX_DEBUG_ASSERT(black_height(p_l) == h_r);
- _GLIBCXX_DEBUG_ASSERT(p_l == NULL || p_l->m_p_parent == p_l_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_l == 0 || p_l->m_p_parent == p_l_parent);
return std::make_pair(p_l, p_l_parent);
}
@@ -189,8 +189,8 @@ PB_DS_CLASS_C_DEC::
find_join_pos_left(node_pointer p_r, size_type h_l, size_type h_r)
{
_GLIBCXX_DEBUG_ASSERT(h_r > h_l);
- if (base_type::m_p_head->m_p_parent == NULL)
- return (std::make_pair((node_pointer)NULL,
+ if (base_type::m_p_head->m_p_parent == 0)
+ return (std::make_pair((node_pointer)0,
base_type::m_p_head));
node_pointer p_r_parent = base_type::m_p_head;
while (h_r > h_l)
@@ -213,7 +213,7 @@ find_join_pos_left(node_pointer p_r, size_type h_l, size_type h_r)
_GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_r));
_GLIBCXX_DEBUG_ASSERT(black_height(p_r) == h_l);
- _GLIBCXX_DEBUG_ASSERT(p_r == NULL || p_r->m_p_parent == p_r_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_r == 0 || p_r->m_p_parent == p_r_parent);
return std::make_pair(p_r, p_r_parent);
}
@@ -223,7 +223,7 @@ PB_DS_CLASS_C_DEC::
black_height(node_pointer p_nd)
{
size_type h = 1;
- while (p_nd != NULL)
+ while (p_nd != 0)
{
if (p_nd->m_red == false)
++h;
@@ -275,7 +275,7 @@ void
PB_DS_CLASS_C_DEC::
split_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
node_pointer p_l = p_nd->m_p_left;
node_pointer p_r = p_nd->m_p_right;
@@ -283,7 +283,7 @@ split_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other)
if (p_parent == base_type::m_p_head)
{
base_type::m_p_head->m_p_parent = p_l;
- if (p_l != NULL)
+ if (p_l != 0)
{
p_l->m_p_parent = base_type::m_p_head;
p_l->m_red = false;
@@ -296,7 +296,7 @@ split_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other)
else
p_parent->m_p_right = p_l;
- if (p_l != NULL)
+ if (p_l != 0)
p_l->m_p_parent = p_parent;
update_to_top(p_parent, (node_update* )this);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
index 0194905c4c7..4b8878ee84c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
@@ -48,7 +48,7 @@ assert_valid() const
base_type::assert_valid(false);
if (!base_type::empty())
{
- _GLIBCXX_DEBUG_ASSERT(base_type::m_p_max != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_max != 0);
base_type::assert_max();
}
@@ -57,7 +57,7 @@ assert_valid() const
if (m_rc.empty())
{
base_type::assert_valid(true);
- _GLIBCXX_DEBUG_ASSERT(next_2_pointer(base_type::m_p_root) == NULL);
+ _GLIBCXX_DEBUG_ASSERT(next_2_pointer(base_type::m_p_root) == 0);
return;
}
@@ -65,13 +65,13 @@ assert_valid() const
typename rc_t::const_iterator it = m_rc.end();
--it;
- while (p_nd != NULL)
+ while (p_nd != 0)
{
_GLIBCXX_DEBUG_ASSERT(*it == p_nd);
const_node_pointer p_next = p_nd->m_p_next_sibling;
- _GLIBCXX_DEBUG_ASSERT(p_next != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_next != 0);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_next->m_metadata);
- _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == NULL ||
+ _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == 0 ||
p_next->m_metadata < p_next->m_p_next_sibling->m_metadata);
--it;
@@ -85,13 +85,13 @@ typename PB_DS_CLASS_C_DEC::const_node_pointer
PB_DS_CLASS_C_DEC::
next_2_pointer(const_node_pointer p_nd)
{
- if (p_nd == NULL)
- return NULL;
+ if (p_nd == 0)
+ return 0;
node_pointer p_next = p_nd->m_p_next_sibling;
- if (p_next == NULL)
- return NULL;
+ if (p_next == 0)
+ return 0;
if (p_nd->m_metadata == p_next->m_metadata)
return p_nd;
@@ -104,13 +104,13 @@ typename PB_DS_CLASS_C_DEC::const_node_pointer
PB_DS_CLASS_C_DEC::
next_after_0_pointer(const_node_pointer p_nd)
{
- if (p_nd == NULL)
- return NULL;
+ if (p_nd == 0)
+ return 0;
node_pointer p_next = p_nd->m_p_next_sibling;
- if (p_next == NULL)
- return NULL;
+ if (p_next == 0)
+ return 0;
if (p_nd->m_metadata < p_next->m_metadata)
return p_next;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
index 1113ffa6669..1f187a55749 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
@@ -64,10 +64,10 @@ PB_DS_CLASS_C_DEC::
make_binomial_heap()
{
node_pointer p_nd = base_type::m_p_root;
- while (p_nd != NULL)
+ while (p_nd != 0)
{
node_pointer p_next = p_nd->m_p_next_sibling;
- if (p_next == NULL)
+ if (p_next == 0)
p_nd = p_next;
else if (p_nd->m_metadata == p_next->m_metadata)
p_nd = link_with_next_sibling(p_nd);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
index aef4b928e16..2a3badccb5b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
@@ -51,20 +51,20 @@ push(const_reference r_val)
node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
- p_nd->m_p_l_child = p_nd->m_p_prev_or_parent = NULL;
+ p_nd->m_p_l_child = p_nd->m_p_prev_or_parent = 0;
p_nd->m_metadata = 0;
- if (base_type::m_p_max == NULL || Cmp_Fn::operator()(base_type::m_p_max->m_value, r_val))
+ if (base_type::m_p_max == 0 || Cmp_Fn::operator()(base_type::m_p_max->m_value, r_val))
base_type::m_p_max = p_nd;
p_nd->m_p_next_sibling = base_type::m_p_root;
- if (base_type::m_p_root != NULL)
+ if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_nd;
base_type::m_p_root = p_nd;
- if (p_nd->m_p_next_sibling != NULL&& p_nd->m_p_next_sibling->m_metadata == 0)
+ if (p_nd->m_p_next_sibling != 0&& p_nd->m_p_next_sibling->m_metadata == 0)
m_rc.push(p_nd);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
@@ -95,14 +95,14 @@ link_with_next_sibling(node_pointer p_nd)
{
node_pointer p_next = p_nd->m_p_next_sibling;
- _GLIBCXX_DEBUG_ASSERT(p_next != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_next != 0);
_GLIBCXX_DEBUG_ASSERT(p_next->m_p_prev_or_parent == p_nd);
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
{
p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
- if (p_next->m_p_prev_or_parent == NULL)
+ if (p_next->m_p_prev_or_parent == 0)
base_type::m_p_root = p_next;
else
p_next->m_p_prev_or_parent->m_p_next_sibling = p_next;
@@ -119,7 +119,7 @@ link_with_next_sibling(node_pointer p_nd)
p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
if (base_type::m_p_max == p_next)
@@ -144,11 +144,11 @@ make_0_exposed()
m_rc.pop();
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling != 0);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata);
node_pointer p_res = link_with_next_sibling(p_nd);
- if (p_res->m_p_next_sibling != NULL&& p_res->m_metadata == p_res->m_p_next_sibling->m_metadata)
+ if (p_res->m_p_next_sibling != 0&& p_res->m_metadata == p_res->m_p_next_sibling->m_metadata)
m_rc.push(p_res);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
index a28f5ede5e6..c816cfdeac8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -150,7 +150,7 @@ inline PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
get_nearest_smaller_size(size_type n) const
{
- const size_t* p_lower = std::lower_bound(detail::g_a_sizes,
+ const std::size_t* p_lower = std::lower_bound(detail::g_a_sizes,
detail::g_a_sizes + detail::num_distinct_sizes, n);
if (*p_lower >= n && p_lower != detail::g_a_sizes)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
index ed70b951121..33aecdf5fcc 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -47,7 +47,7 @@ class sample_resize_policy
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
// Default constructor.
sample_resize_policy();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
index a27dd942702..963c5530a46 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
@@ -1,6 +1,7 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -47,7 +48,7 @@ class sample_resize_trigger
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
// Default constructor.
sample_resize_trigger();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
index 1f2d3a9c125..9b3ba031c4b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -47,7 +47,7 @@ class sample_size_policy
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
// Default constructor.
sample_size_policy();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
index 084e25d26de..f673877aed2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
@@ -55,7 +55,7 @@ void
PB_DS_CLASS_C_DEC::
assert_special_imp(const node_pointer p_nd) const
{
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
if (p_nd == base_type::m_p_head)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
index 508f586d78d..507b8ba407c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
@@ -108,7 +108,7 @@ void
PB_DS_CLASS_C_DEC::
erase_node(node_pointer p_nd)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
splay(p_nd);
_GLIBCXX_DEBUG_ONLY(assert_valid();)
@@ -119,27 +119,27 @@ erase_node(node_pointer p_nd)
base_type::update_min_max_for_erased_node(p_nd);
base_type::actual_erase_node(p_nd);
- if (p_r == NULL)
+ if (p_r == 0)
{
base_type::m_p_head->m_p_parent = p_l;
- if (p_l != NULL)
+ if (p_l != 0)
p_l->m_p_parent = base_type::m_p_head;
_GLIBCXX_DEBUG_ONLY(assert_valid();)
return;
}
node_pointer p_target_r = leftmost(p_r);
- _GLIBCXX_DEBUG_ASSERT(p_target_r != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r != 0);
p_r->m_p_parent = base_type::m_p_head;
base_type::m_p_head->m_p_parent = p_r;
splay(p_target_r);
- _GLIBCXX_DEBUG_ONLY(p_target_r->m_p_left = NULL);
+ _GLIBCXX_DEBUG_ONLY(p_target_r->m_p_left = 0);
_GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_parent == this->m_p_head);
_GLIBCXX_DEBUG_ASSERT(this->m_p_head->m_p_parent == p_target_r);
p_target_r->m_p_left = p_l;
- if (p_l != NULL)
+ if (p_l != 0)
p_l->m_p_parent = p_target_r;
_GLIBCXX_DEBUG_ONLY(assert_valid();)
apply_update(p_target_r, (node_update* )this);
@@ -150,8 +150,8 @@ inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
leftmost(node_pointer p_nd)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
- while (p_nd->m_p_left != NULL)
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
+ while (p_nd->m_p_left != 0)
p_nd = p_nd->m_p_left;
return p_nd;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
index 182425a8f30..e27142c17ec 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
@@ -67,7 +67,7 @@ find_imp(const_key_reference r_key)
{
_GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)
node_pointer p_nd = base_type::m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
@@ -86,7 +86,7 @@ find_imp(const_key_reference r_key) const
{
_GLIBCXX_DEBUG_ONLY(assert_valid();)
node_pointer p_nd = base_type::m_p_head->m_p_parent;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
index e9ae987b09d..8381174d29f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
@@ -64,7 +64,7 @@ insert_leaf_imp(const_reference r_value)
node_pointer p_nd = base_type::m_p_head->m_p_parent;
node_pointer p_pot = base_type::m_p_head;
- while (p_nd != NULL)
+ while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value)))
{
if (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value)))
@@ -83,10 +83,10 @@ insert_leaf_imp(const_reference r_value)
_GLIBCXX_DEBUG_ONLY(base_type::check_key_does_not_exist(PB_DS_V2F(r_value)));
p_nd = p_pot->m_p_left;
- if (p_nd == NULL)
+ if (p_nd == 0)
return (std::make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true));
- while (p_nd->m_p_right != NULL)
+ while (p_nd->m_p_right != 0)
p_nd = p_nd->m_p_right;
return std::make_pair(insert_leaf_new(r_value, p_nd, false), true);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
index e4f3556a5f0..b6993590acb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
@@ -114,11 +114,11 @@ splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,
p_grandparent->m_p_parent = p_nd;
p_parent->m_p_left = p_b;
- if (p_b != NULL)
+ if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_right = p_c;
- if (p_c != NULL)
+ if (p_c != 0)
p_c->m_p_parent = p_grandparent;
splay_zz_end(p_nd, p_parent, p_grandparent);
@@ -150,11 +150,11 @@ splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,
p_grandparent->m_p_parent = p_nd;
p_parent->m_p_right = p_b;
- if (p_b != NULL)
+ if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_left = p_c;
- if (p_c != NULL)
+ if (p_c != 0)
p_c->m_p_parent = p_grandparent;
splay_zz_end(p_nd, p_parent, p_grandparent);
@@ -186,11 +186,11 @@ splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,
p_grandparent->m_p_parent = p_parent;
p_parent->m_p_left = p_b;
- if (p_b != NULL)
+ if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_left = p_c;
- if (p_c != NULL)
+ if (p_c != 0)
p_c->m_p_parent = p_grandparent;
splay_zz_end(p_nd, p_parent, p_grandparent);
@@ -220,11 +220,11 @@ splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent,
p_grandparent->m_p_parent = p_parent;
p_parent->m_p_right = p_b;
- if (p_b != NULL)
+ if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_right = p_c;
- if (p_c != NULL)
+ if (p_c != 0)
p_c->m_p_parent = p_grandparent;
base_type::update_to_top(p_grandparent, (node_update* )this);
@@ -242,9 +242,9 @@ splay_zz_start(node_pointer p_nd,
#endif
node_pointer p_grandparent)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_parent != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_grandparent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_parent != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_grandparent != 0);
const bool grandparent_head = p_grandparent->m_p_parent == base_type::m_p_head;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
index 7f0b2cb205d..401f22c0369 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
@@ -53,15 +53,15 @@ join(PB_DS_CLASS_C_DEC& other)
}
node_pointer p_target_r = other.leftmost(other.m_p_head);
- _GLIBCXX_DEBUG_ASSERT(p_target_r != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r != 0);
other.splay(p_target_r);
_GLIBCXX_DEBUG_ASSERT(p_target_r == other.m_p_head->m_p_parent);
- _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == 0);
p_target_r->m_p_left = base_type::m_p_head->m_p_parent;
- _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != 0);
p_target_r->m_p_left->m_p_parent = p_target_r;
base_type::m_p_head->m_p_parent = p_target_r;
@@ -90,19 +90,19 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
}
node_pointer p_upper_bound = upper_bound(r_key).m_p_nd;
- _GLIBCXX_DEBUG_ASSERT(p_upper_bound != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_upper_bound != 0);
splay(p_upper_bound);
_GLIBCXX_DEBUG_ASSERT(p_upper_bound->m_p_parent == this->m_p_head);
node_pointer p_new_root = p_upper_bound->m_p_left;
- _GLIBCXX_DEBUG_ASSERT(p_new_root != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_new_root != 0);
base_type::m_p_head->m_p_parent = p_new_root;
p_new_root->m_p_parent = base_type::m_p_head;
other.m_p_head->m_p_parent = p_upper_bound;
p_upper_bound->m_p_parent = other.m_p_head;
- p_upper_bound->m_p_left = NULL;
+ p_upper_bound->m_p_left = 0;
apply_update(p_upper_bound, (node_update* )this);
base_type::split_finish(other);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
index 4d2c45ce047..5a09f7c4020 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
@@ -52,7 +52,7 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
thin_heap_() :
- m_p_max(NULL)
+ m_p_max(0)
{
initialize();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
@@ -62,7 +62,7 @@ PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
thin_heap_(const Cmp_Fn& r_cmp_fn) :
PB_DS_BASE_C_DEC(r_cmp_fn),
- m_p_max(NULL)
+ m_p_max(0)
{
initialize();
_GLIBCXX_DEBUG_ONLY(assert_valid();)
@@ -75,7 +75,7 @@ thin_heap_(const PB_DS_CLASS_C_DEC& other) :
{
initialize();
m_p_max = base_type::m_p_root;
- for (node_pointer p_nd = base_type::m_p_root; p_nd != NULL; p_nd = p_nd->m_p_next_sibling)
+ for (node_pointer p_nd = base_type::m_p_root; p_nd != 0; p_nd = p_nd->m_p_next_sibling)
if (Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
m_p_max = p_nd;
@@ -102,5 +102,5 @@ PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
-{ std::fill(m_a_aux, m_a_aux + max_rank, static_cast<node_pointer>(NULL)); }
+{ std::fill(m_a_aux, m_a_aux + max_rank, static_cast<node_pointer>(0)); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
index f7abe35279c..0aedadb9f84 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
@@ -57,7 +57,7 @@ PB_DS_CLASS_C_DEC::
assert_aux_null() const
{
for (size_type i = 0; i < max_rank; ++i)
- _GLIBCXX_DEBUG_ASSERT(m_a_aux[i] == NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_a_aux[i] == 0);
}
PB_DS_CLASS_T_DEC
@@ -65,15 +65,15 @@ void
PB_DS_CLASS_C_DEC::
assert_max() const
{
- if (m_p_max == NULL)
+ if (m_p_max == 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::empty());
return;
}
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
- _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == NULL);
- _GLIBCXX_DEBUG_ASSERT(m_p_max->m_p_prev_or_parent == NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == 0);
+ _GLIBCXX_DEBUG_ASSERT(m_p_max->m_p_prev_or_parent == 0);
for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)
_GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value));
}
@@ -84,7 +84,7 @@ PB_DS_CLASS_C_DEC::
assert_node_consistent(const_node_pointer p_nd, bool root) const
{
base_type::assert_node_consistent(p_nd, root);
- if (p_nd == NULL)
+ if (p_nd == 0)
return;
assert_node_consistent(p_nd->m_p_next_sibling, root);
@@ -92,17 +92,17 @@ assert_node_consistent(const_node_pointer p_nd, bool root) const
if (!root)
{
if (p_nd->m_metadata == 0)
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == 0);
else
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata + 1);
}
- if (p_nd->m_p_l_child != NULL)
+ if (p_nd->m_p_l_child != 0)
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child->m_metadata + 1 == base_type::degree(p_nd));
- const bool unmarked_valid =(p_nd->m_p_l_child == NULL&& p_nd->m_metadata == 0) ||(p_nd->m_p_l_child != NULL&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1);
+ const bool unmarked_valid =(p_nd->m_p_l_child == 0&& p_nd->m_metadata == 0) ||(p_nd->m_p_l_child != 0&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1);
- const bool marked_valid =(p_nd->m_p_l_child == NULL&& p_nd->m_metadata == 1) ||(p_nd->m_p_l_child != NULL&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 2);
+ const bool marked_valid =(p_nd->m_p_l_child == 0&& p_nd->m_metadata == 1) ||(p_nd->m_p_l_child != 0&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 2);
_GLIBCXX_DEBUG_ASSERT(unmarked_valid || marked_valid);
if (root)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
index 69afcd39f15..6f1b20b441a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
@@ -46,7 +46,7 @@ pop()
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
- _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
node_pointer p_nd = m_p_max;
@@ -85,11 +85,11 @@ to_aux_except_max()
p_add = m_p_max->m_p_l_child;
- while (p_add != NULL)
+ while (p_add != 0)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
- p_add->m_metadata = p_add->m_p_l_child == NULL?
+ p_add->m_metadata = p_add->m_p_l_child == 0?
0 :
p_add->m_p_l_child->m_metadata + 1;
@@ -100,7 +100,7 @@ to_aux_except_max()
p_add = m_p_max->m_p_next_sibling;
- while (p_add != NULL)
+ while (p_add != 0)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
@@ -117,7 +117,7 @@ add_to_aux(node_pointer p_nd)
{
size_type r = p_nd->m_metadata;
- while (m_a_aux[r] != NULL)
+ while (m_a_aux[r] != 0)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
@@ -130,7 +130,7 @@ add_to_aux(node_pointer p_nd)
p_nd = m_a_aux[r];
}
- m_a_aux[r] = NULL;
+ m_a_aux[r] = 0;
++r;
}
@@ -159,7 +159,7 @@ inline void
PB_DS_CLASS_C_DEC::
make_from_aux()
{
- base_type::m_p_root = m_p_max = NULL;
+ base_type::m_p_root = m_p_max = 0;
const size_type rnk_bnd = rank_bound();
@@ -167,11 +167,11 @@ make_from_aux()
while (i < rnk_bnd)
{
- if (m_a_aux[i] != NULL)
+ if (m_a_aux[i] != 0)
{
make_root_and_link(m_a_aux[i]);
- m_a_aux[i] = NULL;
+ m_a_aux[i] = 0;
}
++i;
@@ -186,7 +186,7 @@ PB_DS_CLASS_C_DEC::
remove_node(node_pointer p_nd)
{
node_pointer p_parent = p_nd;
- while (base_type::parent(p_parent) != NULL)
+ while (base_type::parent(p_parent) != 0)
p_parent = base_type::parent(p_parent);
base_type::bubble_to_top(p_nd);
@@ -194,10 +194,10 @@ remove_node(node_pointer p_nd)
m_p_max = p_nd;
node_pointer p_fix = base_type::m_p_root;
- while (p_fix != NULL&& p_fix->m_p_next_sibling != p_parent)
+ while (p_fix != 0&& p_fix->m_p_next_sibling != p_parent)
p_fix = p_fix->m_p_next_sibling;
- if (p_fix != NULL)
+ if (p_fix != 0)
p_fix->m_p_next_sibling = p_nd;
remove_max_node();
@@ -210,7 +210,7 @@ clear()
{
base_type::clear();
- m_p_max = NULL;
+ m_p_max = 0;
}
PB_DS_CLASS_T_DEC
@@ -251,7 +251,7 @@ erase_if(Pred pred)
size_type ersd = 0;
- while (p_out != NULL)
+ while (p_out != 0)
{
++ersd;
@@ -264,9 +264,9 @@ erase_if(Pred pred)
node_pointer p_cur = base_type::m_p_root;
- m_p_max = base_type::m_p_root = NULL;
+ m_p_max = base_type::m_p_root = 0;
- while (p_cur != NULL)
+ while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
index 52407e6d0ae..700486a60d7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
@@ -46,6 +46,6 @@ top() const
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
- _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
return m_p_max->m_value;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
index 7a6952fdad4..4e8a1c2d8cc 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
@@ -49,11 +49,11 @@ push(const_reference r_val)
p_nd->m_metadata = 0;
- p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = NULL;
+ p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;
- if (base_type::m_p_root == NULL)
+ if (base_type::m_p_root == 0)
{
- p_nd->m_p_next_sibling = NULL;
+ p_nd->m_p_next_sibling = 0;
m_p_max = base_type::m_p_root = p_nd;
@@ -64,7 +64,7 @@ push(const_reference r_val)
p_nd->m_p_next_sibling = base_type::m_p_root;
- base_type::m_p_root->m_p_prev_or_parent = NULL;
+ base_type::m_p_root->m_p_prev_or_parent = 0;
base_type::m_p_root = p_nd;
@@ -81,7 +81,7 @@ PB_DS_CLASS_C_DEC::
make_root(node_pointer p_nd)
{
p_nd->m_metadata =
- p_nd->m_p_l_child == NULL?
+ p_nd->m_p_l_child == 0?
0 :
1 + p_nd->m_p_l_child->m_metadata;
}
@@ -93,12 +93,12 @@ make_root_and_link(node_pointer p_nd)
{
make_root(p_nd);
- p_nd->m_p_prev_or_parent = NULL;
+ p_nd->m_p_prev_or_parent = 0;
p_nd->m_p_next_sibling = base_type::m_p_root;
- if (base_type::m_p_root != NULL)
- base_type::m_p_root->m_p_prev_or_parent = NULL;
+ if (base_type::m_p_root != 0)
+ base_type::m_p_root->m_p_prev_or_parent = 0;
base_type::m_p_root = p_nd;
@@ -112,15 +112,15 @@ fix(node_pointer p_y)
{
while (true)
{
- if (p_y->m_p_prev_or_parent == NULL)
+ if (p_y->m_p_prev_or_parent == 0)
{
fix_root(p_y);
return;
}
- else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == NULL)
+ else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == 0)
{
- if (p_y->m_p_l_child != NULL)
+ if (p_y->m_p_l_child != 0)
{
fix_sibling_rank_1_unmarked(p_y);
@@ -133,7 +133,7 @@ fix(node_pointer p_y)
}
else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1)
{
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != 0);
if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2)
{
@@ -146,8 +146,8 @@ fix(node_pointer p_y)
p_y = p_y->m_p_prev_or_parent;
}
- else if ((p_y->m_p_l_child == NULL&&
- p_y->m_metadata == 2) ||(p_y->m_p_l_child != NULL&&
+ else if ((p_y->m_p_l_child == 0&&
+ p_y->m_metadata == 2) ||(p_y->m_p_l_child != 0&&
p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3))
{
node_pointer p_z = p_y->m_p_prev_or_parent;
@@ -166,7 +166,7 @@ inline void
PB_DS_CLASS_C_DEC::
fix_root(node_pointer p_y)
{
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == 0);
make_root(p_y);
@@ -178,18 +178,18 @@ inline void
PB_DS_CLASS_C_DEC::
fix_sibling_rank_1_unmarked(node_pointer p_y)
{
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
_GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;)
- _GLIBCXX_DEBUG_ASSERT(p_w != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == NULL);
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_w != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == 0);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == 0);
p_y->m_p_next_sibling = p_y->m_p_l_child;
p_y->m_p_next_sibling->m_p_prev_or_parent = p_y;
- p_y->m_p_l_child = NULL;
+ p_y->m_p_l_child = 0;
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)
}
@@ -199,8 +199,8 @@ inline void
PB_DS_CLASS_C_DEC::
fix_sibling_rank_1_marked(node_pointer p_y)
{
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == 0);
p_y->m_metadata = 0;
@@ -212,17 +212,17 @@ inline void
PB_DS_CLASS_C_DEC::
fix_sibling_general_unmarked(node_pointer p_y)
{
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
node_pointer p_w = p_y->m_p_l_child;
- _GLIBCXX_DEBUG_ASSERT(p_w != NULL);
- _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_w != 0);
+ _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0);
p_y->m_p_l_child = p_w->m_p_next_sibling;
p_w->m_p_next_sibling->m_p_prev_or_parent = p_y;
p_w->m_p_next_sibling = p_y->m_p_next_sibling;
- _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0);
p_w->m_p_next_sibling->m_p_prev_or_parent = p_w;
p_y->m_p_next_sibling = p_w;
@@ -236,7 +236,7 @@ inline void
PB_DS_CLASS_C_DEC::
fix_sibling_general_marked(node_pointer p_y)
{
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
--p_y->m_metadata;
@@ -248,9 +248,9 @@ inline void
PB_DS_CLASS_C_DEC::
fix_child(node_pointer p_y)
{
- _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
- if (p_y->m_p_next_sibling != NULL)
+ if (p_y->m_p_next_sibling != 0)
p_y->m_p_next_sibling->m_p_prev_or_parent = p_y->m_p_prev_or_parent;
if (p_y->m_p_prev_or_parent->m_p_l_child == p_y)
@@ -269,7 +269,7 @@ modify(point_iterator it, const_reference r_new_val)
_GLIBCXX_DEBUG_ONLY(assert_valid();)
node_pointer p_nd = it.m_p_nd;
- _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value);
@@ -279,7 +279,7 @@ modify(point_iterator it, const_reference r_new_val)
{
remove_node(p_nd);
- p_nd->m_p_l_child = NULL;
+ p_nd->m_p_l_child = 0;
make_root_and_link(p_nd);
@@ -288,7 +288,7 @@ modify(point_iterator it, const_reference r_new_val)
return;
}
- if (p_nd->m_p_prev_or_parent == NULL)
+ if (p_nd->m_p_prev_or_parent == 0)
{
update_max(p_nd);
@@ -298,9 +298,9 @@ modify(point_iterator it, const_reference r_new_val)
}
node_pointer p_y = p_nd->m_p_prev_or_parent;
- _GLIBCXX_DEBUG_ASSERT(p_y != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y != 0);
- if (p_nd->m_p_next_sibling != NULL)
+ if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_y;
if (p_y->m_p_l_child == p_nd)
@@ -320,7 +320,7 @@ inline void
PB_DS_CLASS_C_DEC::
update_max(node_pointer p_nd)
{
- if (m_p_max == NULL || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
+ if (m_p_max == 0 || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
m_p_max = p_nd;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
index 6acb7bd7571..85ebe4cb400 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
@@ -61,7 +61,7 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_out = base_type::prune(pred);
- while (p_out != NULL)
+ while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
@@ -79,11 +79,11 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
node_pointer p_cur = base_type::m_p_root;
- m_p_max = NULL;
+ m_p_max = 0;
- base_type::m_p_root = NULL;
+ base_type::m_p_root = 0;
- while (p_cur != NULL)
+ while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
@@ -106,7 +106,7 @@ join(PB_DS_CLASS_C_DEC& other)
node_pointer p_other = other.m_p_root;
- while (p_other != NULL)
+ while (p_other != 0)
{
node_pointer p_next = p_other->m_p_next_sibling;
@@ -117,9 +117,9 @@ join(PB_DS_CLASS_C_DEC& other)
base_type::m_size += other.m_size;
- other.m_p_root = NULL;
+ other.m_p_root = 0;
other.m_size = 0;
- other.m_p_max = NULL;
+ other.m_p_max = 0;
_GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
index 6ea68995e53..b8c19a587f8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -56,7 +56,7 @@ class sample_tree_node_update
public:
// Metadata type.
- typedef size_t metadata_type;
+ typedef std::size_t metadata_type;
protected:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
index 4e27ac21e62..cb8e2474121 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -50,8 +50,6 @@ find_by_order(size_type order)
node_iterator nd_it = node_begin();
- node_iterator end_nd_it = node_end();
-
while (true)
{
if (order > nd_it.get_metadata())
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
index 34fbe0cc3e2..2ecad89c9a7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,7 +48,7 @@ class sample_trie_e_access_traits
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
// Key type.
typedef std::string key_type;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
index 55fd99787fb..8b2c6b591f7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -56,7 +56,7 @@ class sample_trie_node_update
public:
// Metadata type.
- typedef size_t metadata_type;
+ typedef std::size_t metadata_type;
protected:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
index 38d4eb1cfbc..71e26261794 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
@@ -74,7 +74,7 @@ public:
inline
const_iterator_()
- : m_p_tbl(NULL)
+ : m_p_tbl(0)
{ }
// Increments.
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
index bc0b2ad624a..5574b28e1e1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
@@ -78,7 +78,7 @@ public:
inline
const_point_iterator_()
- : m_p_value(NULL)
+ : m_p_value(0)
{ }
// Copy constructor.
@@ -99,7 +99,7 @@ public:
inline const_pointer
operator->() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return (m_p_value);
}
@@ -108,7 +108,7 @@ public:
inline const_reference
operator*() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return (*m_p_value);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
index 3e21aba8bad..2836c17bea5 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
@@ -74,7 +74,7 @@ public:
inline
iterator_()
- : const_iterator_(NULL, PB_DS_GEN_POS(), NULL)
+ : const_iterator_(0, PB_DS_GEN_POS(), 0)
{ }
// Conversion to a point-type iterator.
@@ -97,7 +97,7 @@ public:
inline pointer
operator->() const
{
- _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);
return (const_cast<pointer>(base_type::m_p_value));
}
@@ -106,7 +106,7 @@ public:
inline reference
operator*() const
{
- _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);
return (const_cast<reference>(*base_type::m_p_value));
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
index 37ce90069cf..c009106e0dd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
@@ -72,7 +72,7 @@ public:
inline
point_iterator_()
- : m_p_value(NULL)
+ : m_p_value(0)
{ }
// Copy constructor.
@@ -86,7 +86,7 @@ public:
inline pointer
operator->() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return (m_p_value);
}
@@ -95,7 +95,7 @@ public:
inline reference
operator*() const
{
- _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return (*m_p_value);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/exception.hpp b/libstdc++-v3/include/ext/pb_ds/exception.hpp
index 4f796b1ef33..b34e3ed26f2 100644
--- a/libstdc++-v3/include/ext/pb_ds/exception.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/exception.hpp
@@ -1,6 +1,7 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,6 +42,7 @@
#ifndef PB_DS_EXCEPTION_HPP
#define PB_DS_EXCEPTION_HPP
+#include <bits/c++config.h>
#include <stdexcept>
#include <cstdlib>
diff --git a/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp b/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp
index 24c0c4562cc..f3bc86e9731 100644
--- a/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,6 +41,7 @@
#ifndef PB_DS_HASH_POLICY_HPP
#define PB_DS_HASH_POLICY_HPP
+#include <bits/c++config.h>
#include <algorithm>
#include <vector>
#include <cmath>
@@ -66,7 +67,7 @@ namespace __gnu_pbds
#define PB_DS_CLASS_C_DEC linear_probe_fn<Size_Type>
// A probe sequence policy using fixed increments.
- template<typename Size_Type = size_t>
+ template<typename Size_Type = std::size_t>
class linear_probe_fn
{
public:
@@ -90,7 +91,7 @@ namespace __gnu_pbds
#define PB_DS_CLASS_C_DEC quadratic_probe_fn<Size_Type>
// A probe sequence policy using square increments.
- template<typename Size_Type = size_t>
+ template<typename Size_Type = std::size_t>
class quadratic_probe_fn
{
public:
@@ -114,7 +115,7 @@ namespace __gnu_pbds
#define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type>
// A mask range-hashing class (uses a bit-mask).
- template<typename Size_Type = size_t>
+ template<typename Size_Type = std::size_t>
class direct_mask_range_hashing
: public detail::mask_based_range_hashing<Size_Type>
{
@@ -146,7 +147,7 @@ namespace __gnu_pbds
#define PB_DS_CLASS_C_DEC direct_mod_range_hashing<Size_Type>
// A mod range-hashing class (uses the modulo function).
- template<typename Size_Type = size_t>
+ template<typename Size_Type = std::size_t>
class direct_mod_range_hashing
: public detail::mod_based_range_hashing<Size_Type>
{
@@ -180,7 +181,7 @@ namespace __gnu_pbds
// A resize trigger policy based on a load check. It keeps the
// load factor between some load factors load_min and load_max.
- template<bool External_Load_Access = false, typename Size_Type = size_t>
+ template<bool External_Load_Access = false, typename Size_Type = std::size_t>
class hash_load_check_resize_trigger : private PB_DS_SIZE_BASE_C_DEC
{
public:
@@ -295,7 +296,7 @@ namespace __gnu_pbds
// A resize trigger policy based on collision checks. It keeps the
// simulated load factor lower than some given load factor.
- template<bool External_Load_Access = false, typename Size_Type = size_t>
+ template<bool External_Load_Access = false, typename Size_Type = std::size_t>
class cc_hash_max_collision_check_resize_trigger
{
public:
@@ -396,7 +397,7 @@ namespace __gnu_pbds
// A size policy whose sequence of sizes form an exponential
// sequence (typically powers of 2.
- template<typename Size_Type = size_t>
+ template<typename Size_Type = std::size_t>
class hash_exponential_size_policy
{
public:
@@ -438,7 +439,7 @@ namespace __gnu_pbds
{
public:
// Size type.
- typedef size_t size_type;
+ typedef std::size_t size_type;
// Default constructor, or onstructor taking a start_size The
// policy will use the sequence of sizes approximately
@@ -472,7 +473,7 @@ namespace __gnu_pbds
template<typename Size_Policy = hash_exponential_size_policy<>,
typename Trigger_Policy = hash_load_check_resize_trigger<>,
bool External_Size_Access = false,
- typename Size_Type = size_t>
+ typename Size_Type = std::size_t>
class hash_standard_resize_policy
: public Size_Policy, public Trigger_Policy
{
diff --git a/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp b/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp
index ec05b69c7e6..54a67c6e563 100644
--- a/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp
@@ -1,6 +1,7 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,6 +42,7 @@
#ifndef PB_DS_LU_POLICY_HPP
#define PB_DS_LU_POLICY_HPP
+#include <bits/c++config.h>
#include <cstdlib>
#include <ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp>
@@ -87,12 +89,13 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
-#define PB_DS_CLASS_T_DEC template<size_t Max_Count, class Allocator>
+#define PB_DS_CLASS_T_DEC template<std::size_t Max_Count, class Allocator>
#define PB_DS_CLASS_C_DEC counter_lu_policy<Max_Count, Allocator>
// A list-update policy that moves elements to the front of the list
// based on the counter algorithm.
- template<size_t Max_Count = 5, typename Allocator = std::allocator<char> >
+ template<std::size_t Max_Count = 5,
+ typename Allocator = std::allocator<char> >
class counter_lu_policy
: private detail::counter_lu_policy_base<typename Allocator::size_type>
{
diff --git a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp
index 531f70c65ce..b6088e7d73a 100644
--- a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,6 +41,7 @@
#ifndef PB_DS_PRIORITY_QUEUE_HPP
#define PB_DS_PRIORITY_QUEUE_HPP
+#include <bits/c++config.h>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
@@ -53,10 +54,13 @@ namespace __gnu_pbds
typename Tag = pairing_heap_tag,
typename Allocator = std::allocator<char> >
class priority_queue
- : public detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type
+ : public detail::priority_queue_base_dispatch<Value_Type,
+ Cmp_Fn,Tag,Allocator>::type
{
private:
- typedef typename detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type base_type;
+ typedef typename
+ detail::priority_queue_base_dispatch<Value_Type, Cmp_Fn,
+ Tag, Allocator>::type base_type;
public:
typedef Value_Type value_type;
diff --git a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
index ccd2533cc4f..ef445336137 100644
--- a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -42,6 +42,7 @@
#ifndef PB_DS_TAG_AND_TRAIT_HPP
#define PB_DS_TAG_AND_TRAIT_HPP
+#include <bits/c++config.h>
#include <ext/pb_ds/detail/type_utils.hpp>
/**
diff --git a/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp b/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp
index 990860ec020..4af1adbde70 100644
--- a/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,6 +41,7 @@
#ifndef PB_DS_TREE_POLICY_HPP
#define PB_DS_TREE_POLICY_HPP
+#include <bits/c++config.h>
#include <iterator>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
diff --git a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp b/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp
index c10591bb7f3..fc452104f75 100644
--- a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,6 +41,7 @@
#ifndef PB_DS_TRIE_POLICY_HPP
#define PB_DS_TRIE_POLICY_HPP
+#include <bits/c++config.h>
#include <string>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp>
diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h
index ddb5f3c84a8..8055df226f2 100644
--- a/libstdc++-v3/include/ext/pointer.h
+++ b/libstdc++-v3/include/ext/pointer.h
@@ -1,6 +1,6 @@
// Custom pointer adapter and sample storage policies
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -447,7 +447,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
inline _Pointer_adapter
- operator++(int __unused)
+ operator++(int)
{
_Pointer_adapter tmp(*this);
_Storage_policy::set(_Storage_policy::get() + 1);
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index a18b274fa88..dd18738dc57 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -554,7 +554,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// NB: Not required, but considered best practice.
if (__is_null_pointer(__beg) && __beg != __end)
std::__throw_logic_error(__N("__rc_string_base::"
- "_S_construct NULL not valid"));
+ "_S_construct null not valid"));
const size_type __dnew = static_cast<size_type>(std::distance(__beg,
__end));
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index b0500cf17e0..43d44528999 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -434,7 +434,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// NB: Not required, but considered best practice.
if (__is_null_pointer(__beg) && __beg != __end)
std::__throw_logic_error(__N("__sso_string_base::"
- "_M_construct NULL not valid"));
+ "_M_construct null not valid"));
size_type __dnew = static_cast<size_type>(std::distance(__beg, __end));
diff --git a/libstdc++-v3/include/ext/string_conversions.h b/libstdc++-v3/include/ext/string_conversions.h
index 36c19e0a97a..a4276f30ba2 100644
--- a/libstdc++-v3/include/ext/string_conversions.h
+++ b/libstdc++-v3/include/ext/string_conversions.h
@@ -1,6 +1,6 @@
// String Conversions -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,9 +27,9 @@
#pragma GCC system_header
+#include <bits/c++config.h>
#include <ext/numeric_traits.h>
#include <bits/functexcept.h>
-#include <cstddef>
#include <cstdlib>
#include <cwchar>
#include <cstdio>
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index 70b197a705d..669d433e272 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -110,7 +110,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
void
insert(void* p, size_t size)
{
- if (p == NULL)
+ if (!p)
{
std::string error("annotate_base::insert null insert!\n");
log_to_string(error, make_entry(p, size));
diff --git a/libstdc++-v3/include/parallel/base.h b/libstdc++-v3/include/parallel/base.h
index 1a8c3cb60a8..3e3041d27df 100644
--- a/libstdc++-v3/include/parallel/base.h
+++ b/libstdc++-v3/include/parallel/base.h
@@ -140,13 +140,13 @@ namespace __gnu_parallel
/** @brief Equivalent to std::min. */
template<typename _Tp>
- const _Tp&
+ inline const _Tp&
min(const _Tp& __a, const _Tp& __b)
{ return (__a < __b) ? __a : __b; }
/** @brief Equivalent to std::max. */
template<typename _Tp>
- const _Tp&
+ inline const _Tp&
max(const _Tp& __a, const _Tp& __b)
{ return (__a > __b) ? __a : __b; }
@@ -267,8 +267,8 @@ namespace __gnu_parallel
/** @brief Similar to std::plus, but allows two different types. */
template<typename _Tp1, typename _Tp2, typename _Result
- = __typeof__(*static_cast<_Tp1*>(NULL)
- + *static_cast<_Tp2*>(NULL))>
+ = __typeof__(*static_cast<_Tp1*>(0)
+ + *static_cast<_Tp2*>(0))>
struct _Plus : public std::binary_function<_Tp1, _Tp2, _Result>
{
_Result
@@ -283,8 +283,8 @@ namespace __gnu_parallel
/** @brief Similar to std::multiplies, but allows two different types. */
template<typename _Tp1, typename _Tp2, typename _Result
- = __typeof__(*static_cast<_Tp1*>(NULL)
- * *static_cast<_Tp2*>(NULL))>
+ = __typeof__(*static_cast<_Tp1*>(0)
+ * *static_cast<_Tp2*>(0))>
struct _Multiplies : public std::binary_function<_Tp1, _Tp2, _Result>
{
_Result
@@ -300,7 +300,7 @@ namespace __gnu_parallel
/** @brief _Iterator associated with __gnu_parallel::_PseudoSequence.
* If features the usual random-access iterator functionality.
* @param _Tp Sequence _M_value type.
- * @param _DifferenceType Sequence difference type.
+ * @param _DifferenceTp Sequence difference type.
*/
template<typename _Tp, typename _DifferenceTp>
class _PseudoSequenceIterator
@@ -353,7 +353,7 @@ namespace __gnu_parallel
the same element.
* The copies are not stored explicitly, of course.
* @param _Tp Sequence _M_value type.
- * @param _DifferenceType Sequence difference type.
+ * @param _DifferenceTp Sequence difference type.
*/
template<typename _Tp, typename _DifferenceTp>
class _PseudoSequence
diff --git a/libstdc++-v3/include/parallel/basic_iterator.h b/libstdc++-v3/include/parallel/basic_iterator.h
index c5c067a0b0d..a624edc1a3b 100644
--- a/libstdc++-v3/include/parallel/basic_iterator.h
+++ b/libstdc++-v3/include/parallel/basic_iterator.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,6 @@
#define _GLIBCXX_PARALLEL_BASIC_ITERATOR_H 1
#include <bits/c++config.h>
-#include <cstddef>
#include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#include <bits/stl_iterator.h>
diff --git a/libstdc++-v3/include/parallel/find.h b/libstdc++-v3/include/parallel/find.h
index b4e581488ae..eb37d8aace1 100644
--- a/libstdc++-v3/include/parallel/find.h
+++ b/libstdc++-v3/include/parallel/find.h
@@ -168,9 +168,7 @@ namespace __gnu_parallel
* @param __selector _Functionality (e. g. std::find_if(), std::equal(),...)
* @return Place of finding in both sequences.
* @see __gnu_parallel::_Settings::find_sequential_search_size
- * @see __gnu_parallel::_Settings::find_initial_block_size
- * @see __gnu_parallel::_Settings::find_maximum_block_size
- * @see __gnu_parallel::_Settings::find_increasing_factor
+ * @see __gnu_parallel::_Settings::find_scale_factor
*
* There are two main differences between the growing blocks and
* the constant-size blocks variants.
@@ -218,6 +216,8 @@ namespace __gnu_parallel
omp_lock_t __result_lock;
omp_init_lock(&__result_lock);
+ const float __scale_factor = __s.find_scale_factor;
+
_ThreadIndex __num_threads = __get_max_threads();
# pragma omp parallel shared(__result) num_threads(__num_threads)
{
@@ -227,7 +227,8 @@ namespace __gnu_parallel
// Not within first __k elements -> start parallel.
_ThreadIndex __iam = omp_get_thread_num();
- _DifferenceType __block_size = __s.find_initial_block_size;
+ _DifferenceType __block_size =
+ std::max<_DifferenceType>(1, __scale_factor * __next_block_start);
_DifferenceType __start = __fetch_and_add<_DifferenceType>
(&__next_block_start, __block_size);
@@ -265,15 +266,14 @@ namespace __gnu_parallel
omp_unset_lock(&__result_lock);
}
- __block_size = std::min<_DifferenceType>
- (__block_size * __s.find_increasing_factor,
- __s.find_maximum_block_size);
+ _DifferenceType __block_size =
+ std::max<_DifferenceType>(1, __scale_factor * __next_block_start);
// Get new block, update pointer to next block.
__start = __fetch_and_add<_DifferenceType>(&__next_block_start,
__block_size);
- __stop = (__length < (__start + __block_size)
- ? __length : (__start + __block_size));
+ __stop =
+ std::min<_DifferenceType>(__length, __start + __block_size);
}
} //parallel
diff --git a/libstdc++-v3/include/parallel/multiseq_selection.h b/libstdc++-v3/include/parallel/multiseq_selection.h
index 1fab257ccdd..e77653aeefa 100644
--- a/libstdc++-v3/include/parallel/multiseq_selection.h
+++ b/libstdc++-v3/include/parallel/multiseq_selection.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -230,7 +230,7 @@ namespace __gnu_parallel
__n /= 2;
_SeqNumber __lmax_seq = -1; // to avoid warning
- const _ValueType* __lmax = NULL; // impossible to avoid the warning?
+ const _ValueType* __lmax = 0; // impossible to avoid the warning?
for (_SeqNumber __i = 0; __i < __m; __i++)
{
if (__a[__i] > 0)
@@ -332,8 +332,8 @@ namespace __gnu_parallel
// Compare the keys on both edges of the border.
// Maximum of left edge, minimum of right edge.
- _ValueType* __maxleft = NULL;
- _ValueType* __minright = NULL;
+ _ValueType* __maxleft = 0;
+ _ValueType* __minright = 0;
for (_SeqNumber __i = 0; __i < __m; __i++)
{
if (__a[__i] > 0)
@@ -482,7 +482,7 @@ namespace __gnu_parallel
{
__n /= 2;
- const _Tp* __lmax = NULL;
+ const _Tp* __lmax = 0;
for (_SeqNumber __i = 0; __i < __m; ++__i)
{
if (__a[__i] > 0)
diff --git a/libstdc++-v3/include/parallel/multiway_merge.h b/libstdc++-v3/include/parallel/multiway_merge.h
index 445184ae5ec..1baf76beb9c 100644
--- a/libstdc++-v3/include/parallel/multiway_merge.h
+++ b/libstdc++-v3/include/parallel/multiway_merge.h
@@ -502,11 +502,11 @@ namespace __gnu_parallel
_LT __lt(__k, __comp);
// Default value for potentially non-default-constructible types.
- _ValueType* __arbitrary_element = NULL;
+ _ValueType* __arbitrary_element = 0;
for (_SeqNumber __t = 0; __t < __k; ++__t)
{
- if(__arbitrary_element == NULL
+ if(!__arbitrary_element
&& _GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__t]) > 0)
__arbitrary_element = &(*__seqs_begin[__t].first);
}
diff --git a/libstdc++-v3/include/parallel/multiway_mergesort.h b/libstdc++-v3/include/parallel/multiway_mergesort.h
index 85894719dc0..8e2c53ec661 100644
--- a/libstdc++-v3/include/parallel/multiway_mergesort.h
+++ b/libstdc++-v3/include/parallel/multiway_mergesort.h
@@ -434,7 +434,7 @@ namespace __gnu_parallel
(::operator new(__size * sizeof(_ValueType)));
}
else
- __sd._M_samples = NULL;
+ __sd._M_samples = 0;
__sd._M_offsets = new _DifferenceType[__num_threads - 1];
__sd._M_pieces
diff --git a/libstdc++-v3/include/parallel/partial_sum.h b/libstdc++-v3/include/parallel/partial_sum.h
index 966d9db0572..d398c4585a2 100644
--- a/libstdc++-v3/include/parallel/partial_sum.h
+++ b/libstdc++-v3/include/parallel/partial_sum.h
@@ -127,10 +127,13 @@ namespace __gnu_parallel
equally_split(__n, __num_threads + 1, __borders);
else
{
+ _DifferenceType __first_part_length =
+ std::max<_DifferenceType>(1,
+ __n / (1.0f + __s.partial_sum_dilation * __num_threads));
_DifferenceType __chunk_length =
- ((double)__n
- / ((double)__num_threads + __s.partial_sum_dilation)),
- __borderstart = __n - __num_threads * __chunk_length;
+ (__n - __first_part_length) / __num_threads;
+ _DifferenceType __borderstart =
+ __n - __num_threads * __chunk_length;
__borders[0] = 0;
for (_ThreadIndex __i = 1; __i < (__num_threads + 1); ++__i)
{
diff --git a/libstdc++-v3/include/parallel/partition.h b/libstdc++-v3/include/parallel/partition.h
index 0d5a139968c..27b3871f41b 100644
--- a/libstdc++-v3/include/parallel/partition.h
+++ b/libstdc++-v3/include/parallel/partition.h
@@ -73,7 +73,7 @@ namespace __gnu_parallel
__leftnew, __rightnew;
// just 0 or 1, but int to allow atomic operations
- int* __reserved_left = NULL, * __reserved_right = NULL;
+ int* __reserved_left = 0, * __reserved_right = 0;
_DifferenceType __chunk_size = __s.partition_chunk_size;
diff --git a/libstdc++-v3/include/parallel/set_operations.h b/libstdc++-v3/include/parallel/set_operations.h
index 346fb97775d..f6b076f0655 100644
--- a/libstdc++-v3/include/parallel/set_operations.h
+++ b/libstdc++-v3/include/parallel/set_operations.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -345,11 +345,11 @@ namespace __gnu_parallel
template<typename _IIter,
typename _OutputIterator,
- typename Operation>
+ typename _Operation>
_OutputIterator
__parallel_set_operation(_IIter __begin1, _IIter __end1,
_IIter __begin2, _IIter __end2,
- _OutputIterator __result, Operation __op)
+ _OutputIterator __result, _Operation __op)
{
_GLIBCXX_CALL((__end1 - __begin1) + (__end2 - __begin2))
diff --git a/libstdc++-v3/include/parallel/settings.h b/libstdc++-v3/include/parallel/settings.h
index 3b326ff8e47..5d00b026944 100644
--- a/libstdc++-v3/include/parallel/settings.h
+++ b/libstdc++-v3/include/parallel/settings.h
@@ -272,6 +272,9 @@ namespace __gnu_parallel
/// Minimal input size for search and search_n.
_SequenceIndex search_minimal_n;
+ /// Block size scale-down factor with respect to current position.
+ float find_scale_factor;
+
/// Get the global settings.
_GLIBCXX_CONST static const _Settings&
get() throw();
@@ -331,7 +334,8 @@ namespace __gnu_parallel
TLB_size(128),
cache_line_size(64),
qsb_steals(0),
- search_minimal_n(1000)
+ search_minimal_n(1000),
+ find_scale_factor(0.01f)
{ }
};
}
diff --git a/libstdc++-v3/include/profile/base.h b/libstdc++-v3/include/profile/base.h
index de7bfe9a56f..88dd0b1f197 100644
--- a/libstdc++-v3/include/profile/base.h
+++ b/libstdc++-v3/include/profile/base.h
@@ -38,9 +38,7 @@
#ifndef _GLIBCXX_PROFILE_BASE_H
#define _GLIBCXX_PROFILE_BASE_H 1
-#include <cstdio>
#include <functional>
-#include <bits/c++config.h>
#include <profile/impl/profiler.h>
// Profiling mode namespaces.
diff --git a/libstdc++-v3/include/profile/deque b/libstdc++-v3/include/profile/deque
index 55e8d49d686..9f8ce70c9db 100644
--- a/libstdc++-v3/include/profile/deque
+++ b/libstdc++-v3/include/profile/deque
@@ -60,12 +60,24 @@ namespace __profile
typedef typename _Base::const_pointer const_pointer;
// 23.2.1.1 construct/copy/destroy:
- explicit deque(const _Allocator& __a = _Allocator())
+ explicit
+ deque(const _Allocator& __a = _Allocator())
: _Base(__a) { }
- explicit deque(size_type __n, const _Tp& __value = _Tp(),
- const _Allocator& __a = _Allocator())
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ deque(size_type __n)
+ : _Base(__n) { }
+
+ deque(size_type __n, const _Tp& __value,
+ const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
+#else
+ explicit
+ deque(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a) { }
+#endif
template<class _InputIterator>
deque(_InputIterator __first, _InputIterator __last,
@@ -195,11 +207,25 @@ namespace __profile
using _Base::size;
using _Base::max_size;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ resize(size_type __sz)
+ {
+ _Base::resize(__sz);
+ }
+
+ void
+ resize(size_type __sz, const _Tp& __c)
+ {
+ _Base::resize(__sz, __c);
+ }
+#else
void
resize(size_type __sz, _Tp __c = _Tp())
{
_Base::resize(__sz, __c);
}
+#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
using _Base::shrink_to_fit;
diff --git a/libstdc++-v3/include/profile/impl/profiler.h b/libstdc++-v3/include/profile/impl/profiler.h
index 07ed50d8e4c..ab9cd903030 100644
--- a/libstdc++-v3/include/profile/impl/profiler.h
+++ b/libstdc++-v3/include/profile/impl/profiler.h
@@ -37,11 +37,7 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_H
#define _GLIBCXX_PROFILE_PROFILER_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstddef>
-#else
-#include <stddef.h>
-#endif
+#include <bits/c++config.h>
// Mechanism to define data with inline linkage.
#define _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__type, __name) \
@@ -109,47 +105,50 @@ namespace __gnu_profile
bool __is_on();
bool __is_off();
void __report(void);
- void __trace_hashtable_size_resize(const void*, size_t, size_t);
- void __trace_hashtable_size_destruct(const void*, size_t, size_t);
- void __trace_hashtable_size_construct(const void*, size_t);
- void __trace_vector_size_resize(const void*, size_t, size_t);
- void __trace_vector_size_destruct(const void*, size_t, size_t);
- void __trace_vector_size_construct(const void*, size_t);
- void __trace_hash_func_destruct(const void*, size_t, size_t, size_t);
+ void __trace_hashtable_size_resize(const void*, std::size_t, std::size_t);
+ void __trace_hashtable_size_destruct(const void*, std::size_t, std::size_t);
+ void __trace_hashtable_size_construct(const void*, std::size_t);
+ void __trace_vector_size_resize(const void*, std::size_t, std::size_t);
+ void __trace_vector_size_destruct(const void*, std::size_t, std::size_t);
+ void __trace_vector_size_construct(const void*, std::size_t);
+ void __trace_hash_func_destruct(const void*, std::size_t, std::size_t,
+ std::size_t);
void __trace_hash_func_construct(const void*);
void __trace_vector_to_list_destruct(const void*);
void __trace_vector_to_list_construct(const void*);
- void __trace_vector_to_list_insert(const void*, size_t, size_t);
- void __trace_vector_to_list_iterate(const void*, size_t);
+ void __trace_vector_to_list_insert(const void*, std::size_t, std::size_t);
+ void __trace_vector_to_list_iterate(const void*, std::size_t);
void __trace_vector_to_list_invalid_operator(const void*);
- void __trace_vector_to_list_resize(const void*, size_t, size_t);
- void __trace_vector_to_list_find(const void*, size_t);
+ void __trace_vector_to_list_resize(const void*, std::size_t, std::size_t);
+ void __trace_vector_to_list_find(const void*, std::size_t);
void __trace_list_to_slist_destruct(const void*);
void __trace_list_to_slist_construct(const void*);
- void __trace_list_to_slist_rewind(const void*);
+ void __trace_list_to_slist_rewind(const void*);
void __trace_list_to_slist_operation(const void*);
void __trace_list_to_vector_destruct(const void*);
void __trace_list_to_vector_construct(const void*);
- void __trace_list_to_vector_insert(const void*, size_t, size_t);
- void __trace_list_to_vector_iterate(const void*, size_t);
+ void __trace_list_to_vector_insert(const void*, std::size_t, std::size_t);
+ void __trace_list_to_vector_iterate(const void*, std::size_t);
void __trace_list_to_vector_invalid_operator(const void*);
- void __trace_list_to_vector_resize(const void*, size_t, size_t);
+ void __trace_list_to_vector_resize(const void*, std::size_t, std::size_t);
void __trace_list_to_set_destruct(const void*);
void __trace_list_to_set_construct(const void*);
- void __trace_list_to_set_insert(const void*, size_t, size_t);
- void __trace_list_to_set_iterate(const void*, size_t);
+ void __trace_list_to_set_insert(const void*, std::size_t, std::size_t);
+ void __trace_list_to_set_iterate(const void*, std::size_t);
void __trace_list_to_set_invalid_operator(const void*);
- void __trace_list_to_set_find(const void*, size_t);
+ void __trace_list_to_set_find(const void*, std::size_t);
void __trace_map_to_unordered_map_construct(const void*);
void __trace_map_to_unordered_map_invalidate(const void*);
- void __trace_map_to_unordered_map_insert(const void*, size_t, size_t);
- void __trace_map_to_unordered_map_erase(const void*, size_t, size_t);
- void __trace_map_to_unordered_map_iterate(const void*, size_t);
- void __trace_map_to_unordered_map_find(const void*, size_t);
+ void __trace_map_to_unordered_map_insert(const void*, std::size_t,
+ std::size_t);
+ void __trace_map_to_unordered_map_erase(const void*, std::size_t,
+ std::size_t);
+ void __trace_map_to_unordered_map_iterate(const void*, std::size_t);
+ void __trace_map_to_unordered_map_find(const void*, std::size_t);
void __trace_map_to_unordered_map_destruct(const void*);
} // namespace __gnu_profile
diff --git a/libstdc++-v3/include/profile/impl/profiler_container_size.h b/libstdc++-v3/include/profile/impl/profiler_container_size.h
index bfbab85199b..5c7d08b92b9 100644
--- a/libstdc++-v3/include/profile/impl/profiler_container_size.h
+++ b/libstdc++-v3/include/profile/impl/profiler_container_size.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,16 +37,6 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H
#define _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-#else
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
-
#include <sstream>
#include "profile/impl/profiler.h"
@@ -55,188 +45,178 @@
namespace __gnu_profile
{
-
-/** @brief A container size instrumentation line in the object table. */
-class __container_size_info: public __object_info_base
-{
- public:
- __container_size_info();
- __container_size_info(const __container_size_info& __o);
- __container_size_info(__stack_t __stack, size_t __num);
- virtual ~__container_size_info() {}
-
- void __write(FILE* f) const;
- float __magnitude() const { return static_cast<float>(_M_cost); }
- const char* __advice() const;
-
- void __merge(const __container_size_info& __o);
- // Call if a container is destructed or cleaned.
- void __destruct(size_t __num, size_t __inum);
- // Estimate the cost of resize/rehash.
- float __resize_cost(size_t __from, size_t __to) { return __from; }
- // Call if container is resized.
- void __resize(size_t __from, size_t __to);
-
- private:
- size_t _M_init;
- size_t _M_max; // range of # buckets
- size_t _M_min;
- size_t _M_total;
- size_t _M_item_min; // range of # items
- size_t _M_item_max;
- size_t _M_item_total;
- size_t _M_count;
- size_t _M_resize;
- size_t _M_cost;
-};
-
-inline const char* __container_size_info::__advice() const
-{
- std::stringstream __message;
- if (_M_init < _M_item_max)
- __message << "change initial container size from " << _M_init
- << " to " << _M_item_max;
-
- return strdup(__message.str().c_str());
-}
-
-inline void __container_size_info::__destruct(size_t __num, size_t __inum)
-{
- _M_max = __max(_M_max, __num);
- _M_item_max = __max(_M_item_max, __inum);
- if (_M_min == 0) {
- _M_min = __num;
- _M_item_min = __inum;
- } else {
- _M_min = __min(_M_min, __num);
- _M_item_min = __min(_M_item_min, __inum);
- }
- _M_total += __num;
- _M_item_total += __inum;
- _M_count += 1;
-}
-
-inline void __container_size_info::__resize(size_t __from, size_t __to)
-{
- _M_cost += this->__resize_cost(__from, __to);
- _M_resize += 1;
- _M_max = __max(_M_max, __to);
-}
-
-inline __container_size_info::__container_size_info(__stack_t __stack,
- size_t __num)
- : __object_info_base(__stack), _M_init(0), _M_max(0), _M_item_max(0),
- _M_min(0), _M_item_min(0), _M_total(0), _M_item_total(0), _M_cost(0),
- _M_count(0), _M_resize(0)
-{
- _M_init = _M_max = __num;
- _M_item_min = _M_item_max = _M_item_total = _M_total = 0;
- _M_min = 0;
- _M_count = 0;
- _M_resize = 0;
-}
-
-inline void __container_size_info::__merge(const __container_size_info& __o)
-{
- _M_init = __max(_M_init, __o._M_init);
- _M_max = __max(_M_max, __o._M_max);
- _M_item_max = __max(_M_item_max, __o._M_item_max);
- _M_min = __min(_M_min, __o._M_min);
- _M_item_min = __min(_M_item_min, __o._M_item_min);
- _M_total += __o._M_total;
- _M_item_total += __o._M_item_total;
- _M_count += __o._M_count;
- _M_cost += __o._M_cost;
- _M_resize += __o._M_resize;
-}
-
-inline __container_size_info::__container_size_info()
- : _M_init(0), _M_max(0), _M_item_max(0), _M_min(0), _M_item_min(0),
- _M_total(0), _M_item_total(0), _M_cost(0), _M_count(0), _M_resize(0)
-{
-}
-
-inline __container_size_info::__container_size_info(
- const __container_size_info& __o)
- : __object_info_base(__o)
-{
- _M_init = __o._M_init;
- _M_max = __o._M_max;
- _M_item_max = __o._M_item_max;
- _M_min = __o._M_min;
- _M_item_min = __o._M_item_min;
- _M_total = __o._M_total;
- _M_item_total = __o._M_item_total;
- _M_cost = __o._M_cost;
- _M_count = __o._M_count;
- _M_resize = __o._M_resize;
-}
-
-/** @brief A container size instrumentation line in the stack table. */
-class __container_size_stack_info: public __container_size_info
-{
- public:
- __container_size_stack_info(const __container_size_info& __o)
- : __container_size_info(__o) {}
-};
-
-/** @brief Container size instrumentation trace producer. */
-class __trace_container_size
- : public __trace_base<__container_size_info, __container_size_stack_info>
-{
- public:
- ~__trace_container_size() {}
- __trace_container_size()
- : __trace_base<__container_size_info, __container_size_stack_info>() {};
-
- // Insert a new node at construct with object, callstack and initial size.
- void __insert(const __object_t __obj, __stack_t __stack, size_t __num);
- // Call at destruction/clean to set container final size.
- void __destruct(const void* __obj, size_t __num, size_t __inum);
- void __construct(const void* __obj, size_t __inum);
- // Call at resize to set resize/cost information.
- void __resize(const void* __obj, int __from, int __to);
-};
-
-inline void __trace_container_size::__insert(const __object_t __obj,
- __stack_t __stack, size_t __num)
-{
- __add_object(__obj, __container_size_info(__stack, __num));
-}
-
-inline void __container_size_info::__write(FILE* __f) const
-{
- fprintf(__f, "%Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu\n",
- _M_init, _M_count, _M_cost, _M_resize, _M_min, _M_max, _M_total,
- _M_item_min, _M_item_max, _M_item_total);
-}
-
-inline void __trace_container_size::__destruct(const void* __obj,
- size_t __num, size_t __inum)
-{
- if (!__is_on()) return;
-
- __object_t __obj_handle = static_cast<__object_t>(__obj);
-
- __container_size_info* __object_info = __get_object_info(__obj_handle);
- if (!__object_info)
- return;
-
- __object_info->__destruct(__num, __inum);
- __retire_object(__obj_handle);
-}
-
-inline void __trace_container_size::__resize(const void* __obj, int __from,
- int __to)
-{
- if (!__is_on()) return;
-
- __container_size_info* __object_info = __get_object_info(__obj);
- if (!__object_info)
- return;
-
- __object_info->__resize(__from, __to);
-}
+ /** @brief A container size instrumentation line in the object table. */
+ class __container_size_info
+ : public __object_info_base
+ {
+ public:
+ __container_size_info()
+ : _M_init(0), _M_max(0), _M_min(0), _M_total(0), _M_item_min(0),
+ _M_item_max(0), _M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0)
+ { }
+
+ __container_size_info(const __container_size_info& __o)
+ : __object_info_base(__o), _M_init(__o._M_init), _M_max(__o._M_max),
+ _M_min(__o._M_min), _M_total(__o._M_total),
+ _M_item_min(__o._M_item_min), _M_item_max(__o._M_item_max),
+ _M_item_total(__o._M_item_total), _M_count(__o._M_count),
+ _M_resize(__o._M_resize), _M_cost(__o._M_cost)
+ { }
+
+ __container_size_info(__stack_t __stack, std::size_t __num)
+ : __object_info_base(__stack), _M_init(__num), _M_max(__num),
+ _M_min(0), _M_total(0), _M_item_min(0), _M_item_max(0),
+ _M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0)
+ { }
+
+ virtual ~__container_size_info() { }
+
+ void
+ __write(FILE* __f) const
+ {
+ std::fprintf(__f, "%Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu\n",
+ _M_init, _M_count, _M_cost, _M_resize, _M_min, _M_max,
+ _M_total, _M_item_min, _M_item_max, _M_item_total);
+ }
+
+ float
+ __magnitude() const
+ { return static_cast<float>(_M_cost); }
+
+ std::string
+ __advice() const
+ {
+ std::stringstream __message;
+ if (_M_init < _M_item_max)
+ __message << "change initial container size from " << _M_init
+ << " to " << _M_item_max;
+ return __message.str();
+ }
+
+ void
+ __merge(const __container_size_info& __o)
+ {
+ _M_init = std::max(_M_init, __o._M_init);
+ _M_max = std::max(_M_max, __o._M_max);
+ _M_item_max = std::max(_M_item_max, __o._M_item_max);
+ _M_min = std::min(_M_min, __o._M_min);
+ _M_item_min = std::min(_M_item_min, __o._M_item_min);
+ _M_total += __o._M_total;
+ _M_item_total += __o._M_item_total;
+ _M_count += __o._M_count;
+ _M_cost += __o._M_cost;
+ _M_resize += __o._M_resize;
+ }
+
+ // Call if a container is destructed or cleaned.
+ void
+ __destruct(std::size_t __num, std::size_t __inum)
+ {
+ _M_max = std::max(_M_max, __num);
+ _M_item_max = std::max(_M_item_max, __inum);
+ if (_M_min == 0)
+ {
+ _M_min = __num;
+ _M_item_min = __inum;
+ }
+ else
+ {
+ _M_min = std::min(_M_min, __num);
+ _M_item_min = std::min(_M_item_min, __inum);
+ }
+ _M_total += __num;
+ _M_item_total += __inum;
+ _M_count += 1;
+ }
+
+ // Estimate the cost of resize/rehash.
+ float
+ __resize_cost(std::size_t __from, std::size_t)
+ { return __from; }
+
+ // Call if container is resized.
+ void
+ __resize(std::size_t __from, std::size_t __to)
+ {
+ _M_cost += this->__resize_cost(__from, __to);
+ _M_resize += 1;
+ _M_max = std::max(_M_max, __to);
+ }
+
+ private:
+ std::size_t _M_init;
+ std::size_t _M_max; // range of # buckets
+ std::size_t _M_min;
+ std::size_t _M_total;
+ std::size_t _M_item_min; // range of # items
+ std::size_t _M_item_max;
+ std::size_t _M_item_total;
+ std::size_t _M_count;
+ std::size_t _M_resize;
+ std::size_t _M_cost;
+ };
+
+
+ /** @brief A container size instrumentation line in the stack table. */
+ class __container_size_stack_info
+ : public __container_size_info
+ {
+ public:
+ __container_size_stack_info(const __container_size_info& __o)
+ : __container_size_info(__o) { }
+ };
+
+
+ /** @brief Container size instrumentation trace producer. */
+ class __trace_container_size
+ : public __trace_base<__container_size_info, __container_size_stack_info>
+ {
+ public:
+ ~__trace_container_size() { }
+
+ __trace_container_size()
+ : __trace_base<__container_size_info, __container_size_stack_info>() { };
+
+ // Insert a new node at construct with object, callstack and initial size.
+ void
+ __insert(const __object_t __obj, __stack_t __stack, std::size_t __num)
+ { __add_object(__obj, __container_size_info(__stack, __num)); }
+
+ // XXX Undefined?
+ void
+ __construct(const void* __obj, std::size_t __inum);
+
+ // Call at destruction/clean to set container final size.
+ void
+ __destruct(const void* __obj, std::size_t __num, std::size_t __inum)
+ {
+ if (!__is_on())
+ return;
+
+ __object_t __obj_handle = static_cast<__object_t>(__obj);
+
+ __container_size_info* __object_info = __get_object_info(__obj_handle);
+ if (!__object_info)
+ return;
+
+ __object_info->__destruct(__num, __inum);
+ __retire_object(__obj_handle);
+ }
+
+ // Call at resize to set resize/cost information.
+ void
+ __resize(const void* __obj, int __from, int __to)
+ {
+ if (!__is_on())
+ return;
+
+ __container_size_info* __object_info = __get_object_info(__obj);
+ if (!__object_info)
+ return;
+
+ __object_info->__resize(__from, __to);
+ }
+ };
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H */
diff --git a/libstdc++-v3/include/profile/impl/profiler_hash_func.h b/libstdc++-v3/include/profile/impl/profiler_hash_func.h
index 95fad192590..3e01760afba 100644
--- a/libstdc++-v3/include/profile/impl/profiler_hash_func.h
+++ b/libstdc++-v3/include/profile/impl/profiler_hash_func.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,149 +37,145 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H
#define _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-#else
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
-
-/** @brief A hash performance instrumentation line in the object table. */
-class __hashfunc_info: public __object_info_base
-{
- public:
- __hashfunc_info()
- :_M_longest_chain(0), _M_accesses(0), _M_hops(0) {}
- __hashfunc_info(const __hashfunc_info& o);
- __hashfunc_info(__stack_t __stack)
- : __object_info_base(__stack),
- _M_longest_chain(0), _M_accesses(0), _M_hops(0){}
- virtual ~__hashfunc_info() {}
-
- void __merge(const __hashfunc_info& __o);
- void __destruct(size_t __chain, size_t __accesses, size_t __hops);
- void __write(FILE* __f) const;
- float __magnitude() const { return static_cast<float>(_M_hops); }
- const char* __advice() const { return strdup("change hash function"); }
-
-private:
- size_t _M_longest_chain;
- size_t _M_accesses;
- size_t _M_hops;
-};
-
-inline __hashfunc_info::__hashfunc_info(const __hashfunc_info& __o)
- : __object_info_base(__o)
-{
- _M_longest_chain = __o._M_longest_chain;
- _M_accesses = __o._M_accesses;
- _M_hops = __o._M_hops;
-}
-
-inline void __hashfunc_info::__merge(const __hashfunc_info& __o)
-{
- _M_longest_chain = __max(_M_longest_chain, __o._M_longest_chain);
- _M_accesses += __o._M_accesses;
- _M_hops += __o._M_hops;
-}
-
-inline void __hashfunc_info::__destruct(size_t __chain, size_t __accesses,
- size_t __hops)
-{
- _M_longest_chain = __max(_M_longest_chain, __chain);
- _M_accesses += __accesses;
- _M_hops += __hops;
-}
-
-/** @brief A hash performance instrumentation line in the stack table. */
-class __hashfunc_stack_info: public __hashfunc_info {
- public:
- __hashfunc_stack_info(const __hashfunc_info& __o) : __hashfunc_info(__o) {}
-};
-
-/** @brief Hash performance instrumentation producer. */
-class __trace_hash_func
- : public __trace_base<__hashfunc_info, __hashfunc_stack_info>
-{
- public:
- __trace_hash_func();
- ~__trace_hash_func() {}
-
- // Insert a new node at construct with object, callstack and initial size.
- void __insert(__object_t __obj, __stack_t __stack);
- // Call at destruction/clean to set container final size.
- void __destruct(const void* __obj, size_t __chain,
- size_t __accesses, size_t __hops);
-};
-
-inline __trace_hash_func::__trace_hash_func()
+ /** @brief A hash performance instrumentation line in the object table. */
+ class __hashfunc_info
+ : public __object_info_base
+ {
+ public:
+ __hashfunc_info()
+ : _M_longest_chain(0), _M_accesses(0), _M_hops(0) { }
+
+ __hashfunc_info(const __hashfunc_info& __o)
+ : __object_info_base(__o), _M_longest_chain(__o._M_longest_chain),
+ _M_accesses(__o._M_accesses), _M_hops(__o._M_hops) { }
+
+ __hashfunc_info(__stack_t __stack)
+ : __object_info_base(__stack), _M_longest_chain(0),
+ _M_accesses(0), _M_hops(0) { }
+
+ virtual ~__hashfunc_info() { }
+
+ void
+ __merge(const __hashfunc_info& __o)
+ {
+ _M_longest_chain = std::max(_M_longest_chain, __o._M_longest_chain);
+ _M_accesses += __o._M_accesses;
+ _M_hops += __o._M_hops;
+ }
+
+ void
+ __destruct(std::size_t __chain, std::size_t __accesses,
+ std::size_t __hops)
+ {
+ _M_longest_chain = std::max(_M_longest_chain, __chain);
+ _M_accesses += __accesses;
+ _M_hops += __hops;
+ }
+
+ void
+ __write(FILE* __f) const
+ { std::fprintf(__f, "%Zu %Zu %Zu\n", _M_hops,
+ _M_accesses, _M_longest_chain); }
+
+ float
+ __magnitude() const
+ { return static_cast<float>(_M_hops); }
+
+ std::string
+ __advice() const
+ { return "change hash function"; }
+
+ private:
+ std::size_t _M_longest_chain;
+ std::size_t _M_accesses;
+ std::size_t _M_hops;
+ };
+
+
+ /** @brief A hash performance instrumentation line in the stack table. */
+ class __hashfunc_stack_info
+ : public __hashfunc_info
+ {
+ public:
+ __hashfunc_stack_info(const __hashfunc_info& __o)
+ : __hashfunc_info(__o) { }
+ };
+
+
+ /** @brief Hash performance instrumentation producer. */
+ class __trace_hash_func
+ : public __trace_base<__hashfunc_info, __hashfunc_stack_info>
+ {
+ public:
+ __trace_hash_func()
: __trace_base<__hashfunc_info, __hashfunc_stack_info>()
-{
- __id = "hash-distr";
-}
-
-inline void __trace_hash_func::__insert(__object_t __obj, __stack_t __stack)
-{
- __add_object(__obj, __hashfunc_info(__stack));
-}
-
-inline void __hashfunc_info::__write(FILE* __f) const
-{
- fprintf(__f, "%Zu %Zu %Zu\n", _M_hops, _M_accesses, _M_longest_chain);
-}
-
-inline void __trace_hash_func::__destruct(const void* __obj, size_t __chain,
- size_t __accesses, size_t __hops)
-{
- if (!__is_on()) return;
-
- // First find the item from the live objects and update the informations.
- __hashfunc_info* __objs = __get_object_info(__obj);
- if (!__objs)
- return;
-
- __objs->__destruct(__chain, __accesses, __hops);
- __retire_object(__obj);
-}
-
-inline void __trace_hash_func_init()
-{
- _GLIBCXX_PROFILE_DATA(_S_hash_func) = new __trace_hash_func();
-}
-
-inline void __trace_hash_func_report(FILE* __f,
- __warning_vector_t& __warnings)
-{
- if (_GLIBCXX_PROFILE_DATA(_S_hash_func)) {
- _GLIBCXX_PROFILE_DATA(_S_hash_func)->__collect_warnings(__warnings);
- _GLIBCXX_PROFILE_DATA(_S_hash_func)->__write(__f);
+ { __id = "hash-distr"; }
+
+ ~__trace_hash_func() {}
+
+ // Insert a new node at construct with object, callstack and initial size.
+ void
+ __insert(__object_t __obj, __stack_t __stack)
+ { __add_object(__obj, __hashfunc_info(__stack)); }
+
+ // Call at destruction/clean to set container final size.
+ void
+ __destruct(const void* __obj, std::size_t __chain,
+ std::size_t __accesses, std::size_t __hops)
+ {
+ if (!__is_on())
+ return;
+
+ // First find the item from the live objects and update the informations.
+ __hashfunc_info* __objs = __get_object_info(__obj);
+ if (!__objs)
+ return;
+
+ __objs->__destruct(__chain, __accesses, __hops);
+ __retire_object(__obj);
+ }
+ };
+
+
+ inline void
+ __trace_hash_func_init()
+ { _GLIBCXX_PROFILE_DATA(_S_hash_func) = new __trace_hash_func(); }
+
+ inline void
+ __trace_hash_func_report(FILE* __f, __warning_vector_t& __warnings)
+ {
+ if (_GLIBCXX_PROFILE_DATA(_S_hash_func))
+ {
+ _GLIBCXX_PROFILE_DATA(_S_hash_func)->__collect_warnings(__warnings);
+ _GLIBCXX_PROFILE_DATA(_S_hash_func)->__write(__f);
+ }
}
-}
-inline void __trace_hash_func_construct(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_hash_func_construct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_hash_func)->__insert(__obj, __get_stack());
-}
+ _GLIBCXX_PROFILE_DATA(_S_hash_func)->__insert(__obj, __get_stack());
+ }
-inline void __trace_hash_func_destruct(const void* __obj, size_t __chain,
- size_t __accesses, size_t __hops)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_hash_func_destruct(const void* __obj, std::size_t __chain,
+ std::size_t __accesses, std::size_t __hops)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_hash_func)->__destruct(__obj, __chain, __accesses,
- __hops);
-}
+ _GLIBCXX_PROFILE_DATA(_S_hash_func)->__destruct(__obj, __chain,
+ __accesses, __hops);
+ }
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H */
diff --git a/libstdc++-v3/include/profile/impl/profiler_hashtable_size.h b/libstdc++-v3/include/profile/impl/profiler_hashtable_size.h
index 8248f47e75d..9d5cbc793ef 100644
--- a/libstdc++-v3/include/profile/impl/profiler_hashtable_size.h
+++ b/libstdc++-v3/include/profile/impl/profiler_hashtable_size.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,15 +37,6 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H
#define _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-#else
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
@@ -54,54 +45,60 @@
namespace __gnu_profile
{
-
-/** @brief Hashtable size instrumentation trace producer. */
-class __trace_hashtable_size : public __trace_container_size
-{
- public:
- __trace_hashtable_size() : __trace_container_size()
+ /** @brief Hashtable size instrumentation trace producer. */
+ class __trace_hashtable_size
+ : public __trace_container_size
{
- __id = "hashtable-size";
- }
-};
-
-inline void __trace_hashtable_size_init()
-{
- _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size();
-}
-
-inline void __trace_hashtable_size_report(FILE* __f,
- __warning_vector_t& __warnings)
-{
- if (_GLIBCXX_PROFILE_DATA(_S_hashtable_size)) {
- _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__collect_warnings(__warnings);
- _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__write(__f);
+ public:
+ __trace_hashtable_size()
+ : __trace_container_size()
+ { __id = "hashtable-size"; }
+ };
+
+ inline void
+ __trace_hashtable_size_init()
+ { _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size(); }
+
+ inline void
+ __trace_hashtable_size_report(FILE* __f, __warning_vector_t& __warnings)
+ {
+ if (_GLIBCXX_PROFILE_DATA(_S_hashtable_size))
+ {
+ _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
+ __collect_warnings(__warnings);
+ _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__write(__f);
+ }
}
-}
-inline void __trace_hashtable_size_construct(const void* __obj, size_t __num)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_hashtable_size_construct(const void* __obj, std::size_t __num)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__insert(__obj, __get_stack(),
- __num);
-}
+ _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__insert(__obj, __get_stack(),
+ __num);
+ }
-inline void __trace_hashtable_size_destruct(const void* __obj, size_t __num,
- size_t __inum)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_hashtable_size_destruct(const void* __obj, std::size_t __num,
+ std::size_t __inum)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__destruct(__obj, __num, __inum);
-}
+ _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__destruct(__obj, __num, __inum);
+ }
-inline void __trace_hashtable_size_resize(const void* __obj, size_t __from,
- size_t __to)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_hashtable_size_resize(const void* __obj, std::size_t __from,
+ std::size_t __to)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__resize(__obj, __from, __to);
-}
+ _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__resize(__obj, __from, __to);
+ }
} // namespace __gnu_profile
diff --git a/libstdc++-v3/include/profile/impl/profiler_list_to_slist.h b/libstdc++-v3/include/profile/impl/profiler_list_to_slist.h
index 073bdf27587..299a17d5af6 100644
--- a/libstdc++-v3/include/profile/impl/profiler_list_to_slist.h
+++ b/libstdc++-v3/include/profile/impl/profiler_list_to_slist.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,146 +37,179 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H
#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-#else
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
-
-class __list2slist_info: public __object_info_base
-{
- public:
- __list2slist_info() : _M_rewind(false), _M_operations(0) {}
- __list2slist_info(__stack_t __stack)
- : _M_rewind(false), _M_operations(0),__object_info_base(__stack) {}
- virtual ~__list2slist_info() {}
- __list2slist_info(const __list2slist_info& __o) : __object_info_base(__o)
- { _M_rewind = __o._M_rewind; _M_operations = __o._M_operations; }
- // XXX: the magnitude should be multiplied with a constant factor F,
- // where F is 1 when the malloc size class of list nodes is different
- // from the malloc size class of slist nodes. When they fall into the same
- // class, the only slist benefit is from having to set fewer links, so
- // the factor F should be much smaller, closer to 0 than to 1.
- // This could be implemented by passing the size classes in the config file.
- // For now, we always assume F to be 1.
- float __magnitude() const
- { if (!_M_rewind) return _M_operations; else return 0; }
- void __merge(const __list2slist_info& __o) {};
- void __write(FILE* __f) const;
- const char* __advice() const
- { return strdup("change std::list to std::forward_list"); }
- void __opr_rewind() { _M_rewind = true; _M_valid = false;}
- void __record_operation() { _M_operations++; }
- bool __has_rewind() { return _M_rewind; }
-
-private:
- bool _M_rewind;
- size_t _M_operations;
-};
-
-class __list2slist_stack_info: public __list2slist_info {
- public:
- __list2slist_stack_info(const __list2slist_info& __o)
- : __list2slist_info(__o) {}
-};
-
-class __trace_list_to_slist
- : public __trace_base<__list2slist_info, __list2slist_stack_info>
-{
- public:
- ~__trace_list_to_slist() {}
- __trace_list_to_slist()
- : __trace_base<__list2slist_info, __list2slist_stack_info>()
- { __id = "list-to-slist"; }
- void __opr_rewind(const void* __obj);
- void __record_operation(const void* __obj);
- void __insert(const __object_t __obj, __stack_t __stack)
- { __add_object(__obj, __list2slist_info(__stack)); }
- void __destruct(const void* __obj);
-};
-
-inline void __list2slist_info::__write(FILE* __f) const
-{
- fprintf(__f, "%s\n", _M_rewind ? "invalid" : "valid");
-}
-
-inline void __trace_list_to_slist::__destruct(const void* __obj)
-{
- if (!__is_on())
- return;
-
- __list2slist_info* __res = __get_object_info(__obj);
- if (!__res)
- return;
-
- __retire_object(__obj);
-}
-
-inline void __trace_list_to_slist_init()
-{
- _GLIBCXX_PROFILE_DATA(_S_list_to_slist) = new __trace_list_to_slist();
-}
-
-inline void __trace_list_to_slist_report(FILE* __f,
- __warning_vector_t& __warnings)
-{
- if (_GLIBCXX_PROFILE_DATA(_S_list_to_slist)) {
- _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__collect_warnings(__warnings);
- _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__write(__f);
+ class __list2slist_info
+ : public __object_info_base
+ {
+ public:
+ __list2slist_info()
+ : _M_rewind(false), _M_operations(0) { }
+
+ __list2slist_info(__stack_t __stack)
+ : __object_info_base(__stack), _M_rewind(false), _M_operations(0) { }
+
+ virtual ~__list2slist_info() { }
+
+ __list2slist_info(const __list2slist_info& __o)
+ : __object_info_base(__o), _M_rewind(__o._M_rewind),
+ _M_operations(__o._M_operations) { }
+
+ // XXX: the magnitude should be multiplied with a constant factor F,
+ // where F is 1 when the malloc size class of list nodes is different
+ // from the malloc size class of slist nodes. When they fall into the same
+ // class, the only slist benefit is from having to set fewer links, so
+ // the factor F should be much smaller, closer to 0 than to 1.
+ // This could be implemented by passing the size classes in the config
+ // file. For now, we always assume F to be 1.
+
+ float
+ __magnitude() const
+ {
+ if (!_M_rewind)
+ return _M_operations;
+ else
+ return 0;
+ }
+
+ void
+ __merge(const __list2slist_info&) { }
+
+ void
+ __write(FILE* __f) const
+ { std::fprintf(__f, "%s\n", _M_rewind ? "invalid" : "valid"); }
+
+ std::string
+ __advice() const
+ { return "change std::list to std::forward_list"; }
+
+ void
+ __opr_rewind()
+ {
+ _M_rewind = true;
+ _M_valid = false;
+ }
+
+ void
+ __record_operation()
+ { ++_M_operations; }
+
+ bool
+ __has_rewind()
+ { return _M_rewind; }
+
+ private:
+ bool _M_rewind;
+ std::size_t _M_operations;
+ };
+
+ class __list2slist_stack_info
+ : public __list2slist_info
+ {
+ public:
+ __list2slist_stack_info(const __list2slist_info& __o)
+ : __list2slist_info(__o) { }
+ };
+
+ class __trace_list_to_slist
+ : public __trace_base<__list2slist_info, __list2slist_stack_info>
+ {
+ public:
+ ~__trace_list_to_slist() { }
+
+ __trace_list_to_slist()
+ : __trace_base<__list2slist_info, __list2slist_stack_info>()
+ { __id = "list-to-slist"; }
+
+ void
+ __opr_rewind(const void* __obj)
+ {
+ __list2slist_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__opr_rewind();
+ }
+
+ void
+ __record_operation(const void* __obj)
+ {
+ __list2slist_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__record_operation();
+ }
+
+ void
+ __insert(const __object_t __obj, __stack_t __stack)
+ { __add_object(__obj, __list2slist_info(__stack)); }
+
+ void
+ __destruct(const void* __obj)
+ {
+ if (!__is_on())
+ return;
+
+ __list2slist_info* __res = __get_object_info(__obj);
+ if (!__res)
+ return;
+
+ __retire_object(__obj);
+ }
+ };
+
+
+ inline void
+ __trace_list_to_slist_init()
+ { _GLIBCXX_PROFILE_DATA(_S_list_to_slist) = new __trace_list_to_slist(); }
+
+ inline void
+ __trace_list_to_slist_report(FILE* __f, __warning_vector_t& __warnings)
+ {
+ if (_GLIBCXX_PROFILE_DATA(_S_list_to_slist))
+ {
+ _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->
+ __collect_warnings(__warnings);
+ _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__write(__f);
+ }
}
-}
-inline void __trace_list_to_slist::__opr_rewind(const void* __obj)
-{
- __list2slist_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__opr_rewind();
-}
-
-inline void __trace_list_to_slist::__record_operation(const void* __obj)
-{
- __list2slist_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__record_operation();
-}
+ inline void
+ __trace_list_to_slist_rewind(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_list_to_slist_rewind(const void* __obj)
-{
- if (!__profcxx_init()) return;
-
- _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__opr_rewind(__obj);
-}
+ _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__opr_rewind(__obj);
+ }
-inline void __trace_list_to_slist_operation(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_list_to_slist_operation(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__record_operation(__obj);
-}
+ _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__record_operation(__obj);
+ }
-inline void __trace_list_to_slist_construct(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_list_to_slist_construct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__insert(__obj, __get_stack());
-}
+ _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__insert(__obj, __get_stack());
+ }
-inline void __trace_list_to_slist_destruct(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_list_to_slist_destruct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__destruct(__obj);
-}
+ _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__destruct(__obj);
+ }
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H */
diff --git a/libstdc++-v3/include/profile/impl/profiler_list_to_vector.h b/libstdc++-v3/include/profile/impl/profiler_list_to_vector.h
index d3a3713954c..df03267bd44 100644
--- a/libstdc++-v3/include/profile/impl/profiler_list_to_vector.h
+++ b/libstdc++-v3/include/profile/impl/profiler_list_to_vector.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,277 +37,295 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H
#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#else
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#endif
-#include <string>
#include <sstream>
+
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
-
-/** @brief A list-to-vector instrumentation line in the object table. */
-class __list2vector_info: public __object_info_base
-{
- public:
- __list2vector_info()
- :_M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0),
- _M_vector_cost(0), _M_valid(true), _M_max_size(0) {}
- __list2vector_info(__stack_t __stack)
- : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
- _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true),
- _M_max_size(0) {}
- virtual ~__list2vector_info() {}
- __list2vector_info(const __list2vector_info& __o);
- void __merge(const __list2vector_info& __o);
- void __write(FILE* __f) const;
- float __magnitude() const { return _M_list_cost - _M_vector_cost; }
- const char* __advice() const;
- size_t __shift_count() { return _M_shift_count; }
- size_t __iterate() { return _M_iterate; }
- float __list_cost() { return _M_list_cost; }
- size_t __resize() { return _M_resize; }
- void __set_list_cost(float __lc) { _M_list_cost = __lc; }
- void __set_vector_cost(float __vc) { _M_vector_cost = __vc; }
- bool __is_valid() { return _M_valid; }
- void __set_invalid() { _M_valid = false; }
-
- void __opr_insert(size_t __shift, size_t __size);
- void __opr_iterate(size_t __num) { _M_iterate += __num;}
-
- void __resize(size_t __from, size_t __to);
-
-private:
- size_t _M_shift_count;
- size_t _M_iterate;
- size_t _M_resize;
- float _M_list_cost;
- float _M_vector_cost;
- bool _M_valid;
- size_t _M_max_size;
-};
-
-inline __list2vector_info::__list2vector_info(const __list2vector_info& __o)
- : __object_info_base(__o)
-{
- _M_shift_count = __o._M_shift_count;
- _M_iterate = __o._M_iterate;
- _M_vector_cost = __o._M_vector_cost;
- _M_list_cost = __o._M_list_cost;
- _M_valid = __o._M_valid;
- _M_resize = __o._M_resize;
- _M_max_size = __o._M_max_size;
-}
-
-inline const char* __list2vector_info::__advice() const {
- std::stringstream __sstream;
- __sstream
- << "change std::list to std::vector and its initial size from 0 to "
- << _M_max_size;
- return strdup(__sstream.str().c_str());
-}
-
-inline void __list2vector_info::__merge(const __list2vector_info& __o)
-{
- _M_shift_count += __o._M_shift_count;
- _M_iterate += __o._M_iterate;
- _M_vector_cost += __o._M_vector_cost;
- _M_list_cost += __o._M_list_cost;
- _M_valid &= __o._M_valid;
- _M_resize += __o._M_resize;
- _M_max_size = __max( _M_max_size, __o._M_max_size);
-}
-
-inline void __list2vector_info::__opr_insert(size_t __shift, size_t __size)
-{
- _M_shift_count += __shift;
- _M_max_size = __max(_M_max_size, __size);
-}
-
-inline void __list2vector_info::__resize(size_t __from, size_t __to)
-{
- _M_resize += __from;
-}
-
-class __list2vector_stack_info: public __list2vector_info {
- public:
- __list2vector_stack_info(const __list2vector_info& __o)
- : __list2vector_info(__o) {}
-};
-
-class __trace_list_to_vector
- : public __trace_base<__list2vector_info, __list2vector_stack_info>
-{
- public:
- __trace_list_to_vector();
- ~__trace_list_to_vector() {}
-
- // Insert a new node at construct with object, callstack and initial size.
- void __insert(__object_t __obj, __stack_t __stack);
- // Call at destruction/clean to set container final size.
- void __destruct(const void* __obj);
-
- // Find the node in the live map.
- __list2vector_info* __find(const void* __obj);
-
- // Collect cost of operations.
- void __opr_insert(const void* __obj, size_t __shift, size_t __size);
- void __opr_iterate(const void* __obj, size_t __num);
- void __invalid_operator(const void* __obj);
- void __resize(const void* __obj, size_t __from, size_t __to);
- float __vector_cost(size_t __shift, size_t __iterate);
- float __list_cost(size_t __shift, size_t __iterate);
-};
-
-inline __trace_list_to_vector::__trace_list_to_vector()
+ /** @brief A list-to-vector instrumentation line in the object table. */
+ class __list2vector_info
+ : public __object_info_base
+ {
+ public:
+ __list2vector_info()
+ : _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0),
+ _M_vector_cost(0), _M_valid(true), _M_max_size(0) { }
+
+ __list2vector_info(__stack_t __stack)
+ : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
+ _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true),
+ _M_max_size(0) { }
+
+ virtual ~__list2vector_info() { }
+
+ __list2vector_info(const __list2vector_info& __o)
+ : __object_info_base(__o), _M_shift_count(__o._M_shift_count),
+ _M_iterate(__o._M_iterate), _M_resize(__o._M_resize),
+ _M_list_cost(__o._M_list_cost), _M_vector_cost(__o._M_vector_cost),
+ _M_valid(__o._M_valid), _M_max_size(__o._M_max_size) { }
+
+ void
+ __merge(const __list2vector_info& __o)
+ {
+ _M_shift_count += __o._M_shift_count;
+ _M_iterate += __o._M_iterate;
+ _M_vector_cost += __o._M_vector_cost;
+ _M_list_cost += __o._M_list_cost;
+ _M_valid &= __o._M_valid;
+ _M_resize += __o._M_resize;
+ _M_max_size = std::max( _M_max_size, __o._M_max_size);
+ }
+
+ void
+ __write(FILE* __f) const
+ {
+ std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
+ _M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
+ }
+
+ float
+ __magnitude() const
+ { return _M_list_cost - _M_vector_cost; }
+
+ std::string
+ __advice() const
+ {
+ std::stringstream __sstream;
+ __sstream
+ << "change std::list to std::vector and its initial size from 0 to "
+ << _M_max_size;
+ return __sstream.str();
+ }
+
+ std::size_t
+ __shift_count()
+ { return _M_shift_count; }
+
+ std::size_t
+ __iterate()
+ { return _M_iterate; }
+
+ float
+ __list_cost()
+ { return _M_list_cost; }
+
+ std::size_t
+ __resize()
+ { return _M_resize; }
+
+ void
+ __set_list_cost(float __lc)
+ { _M_list_cost = __lc; }
+
+ void
+ __set_vector_cost(float __vc)
+ { _M_vector_cost = __vc; }
+
+ bool
+ __is_valid()
+ { return _M_valid; }
+
+ void
+ __set_invalid()
+ { _M_valid = false; }
+
+ void
+ __opr_insert(std::size_t __shift, std::size_t __size)
+ {
+ _M_shift_count += __shift;
+ _M_max_size = std::max(_M_max_size, __size);
+ }
+
+ void
+ __opr_iterate(std::size_t __num)
+ { _M_iterate += __num;}
+
+ void
+ __resize(std::size_t __from, std::size_t)
+ { _M_resize += __from; }
+
+ private:
+ std::size_t _M_shift_count;
+ std::size_t _M_iterate;
+ std::size_t _M_resize;
+ float _M_list_cost;
+ float _M_vector_cost;
+ bool _M_valid;
+ std::size_t _M_max_size;
+ };
+
+ class __list2vector_stack_info
+ : public __list2vector_info
+ {
+ public:
+ __list2vector_stack_info(const __list2vector_info& __o)
+ : __list2vector_info(__o) {}
+ };
+
+ class __trace_list_to_vector
+ : public __trace_base<__list2vector_info, __list2vector_stack_info>
+ {
+ public:
+ __trace_list_to_vector()
: __trace_base<__list2vector_info, __list2vector_stack_info>()
-{
- __id = "list-to-vector";
-}
-
-inline void __trace_list_to_vector::__insert(__object_t __obj,
- __stack_t __stack)
-{
- __add_object(__obj, __list2vector_info(__stack));
-}
-
-inline void __list2vector_info::__write(FILE* __f) const
-{
- fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n",
- _M_shift_count, _M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
-}
-
-inline float __trace_list_to_vector::__vector_cost(size_t __shift,
- size_t __iterate)
-{
- // The resulting vector will use a 'reserve' method.
- return __shift * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value +
- __iterate * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value;
-}
-
-inline float __trace_list_to_vector::__list_cost(size_t __shift,
- size_t __iterate)
-{
- return __shift * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value +
- __iterate * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value;
-}
-
-inline void __trace_list_to_vector::__destruct(const void* __obj)
-{
- if (!__is_on())
- return;
-
- __list2vector_info* __res = __get_object_info(__obj);
- if (!__res)
- return;
-
- float __vc = __vector_cost(__res->__shift_count(), __res->__iterate());
- float __lc = __list_cost(__res->__shift_count(), __res->__iterate());
- __res->__set_vector_cost(__vc);
- __res->__set_list_cost(__lc);
- __retire_object(__obj);
-}
-
-inline void __trace_list_to_vector::__opr_insert(const void* __obj,
- size_t __shift, size_t __size)
-{
- __list2vector_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__opr_insert(__shift, __size);
-}
-
-inline void __trace_list_to_vector::__opr_iterate(const void* __obj,
- size_t __num)
-{
- __list2vector_info* __res = __get_object_info(__obj);
- if (__res) {
- __res->__opr_iterate(__num);
+ { __id = "list-to-vector"; }
+
+ ~__trace_list_to_vector() { }
+
+ // Insert a new node at construct with object, callstack and initial size.
+ void
+ __insert(__object_t __obj, __stack_t __stack)
+ { __add_object(__obj, __list2vector_info(__stack)); }
+
+ // Call at destruction/clean to set container final size.
+ void
+ __destruct(const void* __obj)
+ {
+ if (!__is_on())
+ return;
+
+ __list2vector_info* __res = __get_object_info(__obj);
+ if (!__res)
+ return;
+
+ float __vc = __vector_cost(__res->__shift_count(), __res->__iterate());
+ float __lc = __list_cost(__res->__shift_count(), __res->__iterate());
+ __res->__set_vector_cost(__vc);
+ __res->__set_list_cost(__lc);
+ __retire_object(__obj);
+ }
+
+ // Find the node in the live map.
+ __list2vector_info* __find(const void* __obj);
+
+ // Collect cost of operations.
+ void
+ __opr_insert(const void* __obj, std::size_t __shift, std::size_t __size)
+ {
+ __list2vector_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__opr_insert(__shift, __size);
+ }
+
+ void
+ __opr_iterate(const void* __obj, std::size_t __num)
+ {
+ __list2vector_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__opr_iterate(__num);
+ }
+
+ void
+ __invalid_operator(const void* __obj)
+ {
+ __list2vector_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__set_invalid();
+ }
+
+ void
+ __resize(const void* __obj, std::size_t __from, std::size_t __to)
+ {
+ __list2vector_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__resize(__from, __to);
+ }
+
+ float
+ __vector_cost(std::size_t __shift, std::size_t __iterate)
+ {
+ // The resulting vector will use a 'reserve' method.
+ return (__shift
+ * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
+ + __iterate
+ * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value);
+ }
+
+ float
+ __list_cost(std::size_t __shift, std::size_t __iterate)
+ {
+ return (__shift
+ * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
+ + __iterate
+ * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value);
+ }
+ };
+
+
+ inline void
+ __trace_list_to_vector_init()
+ { _GLIBCXX_PROFILE_DATA(_S_list_to_vector) = new __trace_list_to_vector(); }
+
+ inline void
+ __trace_list_to_vector_report(FILE* __f, __warning_vector_t& __warnings)
+ {
+ if (_GLIBCXX_PROFILE_DATA(_S_list_to_vector))
+ {
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->
+ __collect_warnings(__warnings);
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__write(__f);
+ }
}
-}
-
-inline void __trace_list_to_vector::__invalid_operator(const void* __obj)
-{
- __list2vector_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__set_invalid();
-}
-inline void __trace_list_to_vector::__resize(const void* __obj, size_t __from,
- size_t __to)
-{
- __list2vector_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__resize(__from, __to);
-}
+ inline void
+ __trace_list_to_vector_construct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_list_to_vector_init()
-{
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector) = new __trace_list_to_vector();
-}
-
-inline void __trace_list_to_vector_report(FILE* __f,
- __warning_vector_t& __warnings)
-{
- if (_GLIBCXX_PROFILE_DATA(_S_list_to_vector)) {
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__collect_warnings(__warnings);
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__write(__f);
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__insert(__obj, __get_stack());
}
-}
-
-inline void __trace_list_to_vector_construct(const void* __obj)
-{
- if (!__profcxx_init()) return;
-
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__insert(__obj, __get_stack());
-}
-inline void __trace_list_to_vector_destruct(const void* __obj)
-{
- if (!__profcxx_init()) return;
-
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__destruct(__obj);
-}
+ inline void
+ __trace_list_to_vector_destruct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_list_to_vector_insert(const void* __obj,
- size_t __shift, size_t __size)
-{
- if (!__profcxx_init()) return;
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__destruct(__obj);
+ }
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_insert(__obj, __shift,
- __size);
-}
+ inline void
+ __trace_list_to_vector_insert(const void* __obj,
+ std::size_t __shift, std::size_t __size)
+ {
+ if (!__profcxx_init())
+ return;
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_insert(__obj, __shift,
+ __size);
+ }
-inline void __trace_list_to_vector_iterate(const void* __obj, size_t __num = 1)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_list_to_vector_iterate(const void* __obj, std::size_t __num = 1)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_iterate(__obj, __num);
-}
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_iterate(__obj, __num);
+ }
-inline void __trace_list_to_vector_invalid_operator(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_list_to_vector_invalid_operator(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__invalid_operator(__obj);
-}
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__invalid_operator(__obj);
+ }
-inline void __trace_list_to_vector_resize(const void* __obj,
- size_t __from, size_t __to)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_list_to_vector_resize(const void* __obj,
+ std::size_t __from, std::size_t __to)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__resize(__obj, __from, __to);
-}
+ _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__resize(__obj, __from, __to);
+ }
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H__ */
diff --git a/libstdc++-v3/include/profile/impl/profiler_map_to_unordered_map.h b/libstdc++-v3/include/profile/impl/profiler_map_to_unordered_map.h
index e715e4cd467..cc7c849a422 100644
--- a/libstdc++-v3/include/profile/impl/profiler_map_to_unordered_map.h
+++ b/libstdc++-v3/include/profile/impl/profiler_map_to_unordered_map.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,256 +37,261 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H
#define _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-#else
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
-
-inline int __log2(size_t __size)
-{
- for (int __bit_count = sizeof(size_t) - 1; __bit_count >= 0; -- __bit_count)
+ inline int
+ __log2(std::size_t __size)
{
- if ((2 << __bit_count) & __size) {
- return __bit_count;
- }
+ for (int __bit_count = sizeof(std::size_t) - 1; __bit_count >= 0;
+ -- __bit_count)
+ if ((2 << __bit_count) & __size)
+ return __bit_count;
+ return 0;
}
- return 0;
-}
-
-inline float __map_insert_cost(size_t __size)
-{
- return (_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor).__value
- * static_cast<float>(__log2(__size)));
-}
-
-inline float __map_erase_cost(size_t __size)
-{
- return (_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor).__value
- * static_cast<float>(__log2(__size)));
-}
-inline float __map_find_cost(size_t __size)
-{
- return (_GLIBCXX_PROFILE_DATA(__map_find_cost_factor).__value
- * static_cast<float>(__log2(__size)));
-}
-
-/** @brief A map-to-unordered_map instrumentation line in the object table. */
-class __map2umap_info: public __object_info_base
-{
- public:
- __map2umap_info()
- : _M_insert(0), _M_erase(0), _M_find(0), _M_iterate(0),
- _M_map_cost(0.0), _M_umap_cost(0.0), _M_valid(true) {}
- __map2umap_info(__stack_t __stack)
- : __object_info_base(__stack), _M_insert(0), _M_erase(0), _M_find(0),
- _M_iterate(0), _M_map_cost(0.0), _M_umap_cost(0.0), _M_valid(true) {}
- virtual ~__map2umap_info() {}
- __map2umap_info(const __map2umap_info& o);
- void __merge(const __map2umap_info& o);
- void __write(FILE* __f) const;
- float __magnitude() const { return _M_map_cost - _M_umap_cost; }
- const char* __advice() const;
-
- void __record_insert(size_t __size, size_t __count);
- void __record_erase(size_t __size, size_t __count);
- void __record_find(size_t __size);
- void __record_iterate(size_t __count);
- void __record_invalidate();
-
- private:
- size_t _M_insert;
- size_t _M_erase;
- size_t _M_find;
- size_t _M_iterate;
- float _M_umap_cost;
- float _M_map_cost;
- bool _M_valid;
-};
-
-inline const char* __map2umap_info::__advice() const
-{
- return strdup("change std::map to std::unordered_map");
-}
-
-inline __map2umap_info::__map2umap_info(const __map2umap_info& __o)
- : __object_info_base(__o),
- _M_insert(__o._M_insert),
- _M_erase(__o._M_erase),
- _M_find(__o._M_find),
- _M_iterate(__o._M_iterate),
- _M_map_cost(__o._M_map_cost),
- _M_umap_cost(__o._M_umap_cost),
- _M_valid(__o._M_valid)
-{}
-
-inline void __map2umap_info::__merge(const __map2umap_info& __o)
-{
- _M_insert += __o._M_insert;
- _M_erase += __o._M_erase;
- _M_find += __o._M_find;
- _M_map_cost += __o._M_map_cost;
- _M_umap_cost += __o._M_umap_cost;
- _M_valid &= __o._M_valid;
-}
-
-inline void __map2umap_info:: __record_insert(size_t __size, size_t __count)
-{
- _M_insert += __count;
- _M_map_cost += __count * __map_insert_cost(__size);
- _M_umap_cost += (__count
- * _GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor).__value);
-}
-
-inline void __map2umap_info:: __record_erase(size_t __size, size_t __count)
-{
- _M_erase += __count;
- _M_map_cost += __count * __map_erase_cost(__size);
- _M_umap_cost += (__count
- * _GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor).__value);
-}
+ inline float
+ __map_insert_cost(std::size_t __size)
+ { return (_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor).__value
+ * static_cast<float>(__log2(__size))); }
+
+ inline float
+ __map_erase_cost(std::size_t __size)
+ { return (_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor).__value
+ * static_cast<float>(__log2(__size))); }
+
+ inline float
+ __map_find_cost(std::size_t __size)
+ { return (_GLIBCXX_PROFILE_DATA(__map_find_cost_factor).__value
+ * static_cast<float>(__log2(__size))); }
+
+ /** @brief A map-to-unordered_map instrumentation line in the
+ object table. */
+ class __map2umap_info
+ : public __object_info_base
+ {
+ public:
+ __map2umap_info()
+ : _M_insert(0), _M_erase(0), _M_find(0), _M_iterate(0),
+ _M_umap_cost(0.0), _M_map_cost(0.0), _M_valid(true) { }
+
+ __map2umap_info(__stack_t __stack)
+ : __object_info_base(__stack), _M_insert(0), _M_erase(0), _M_find(0),
+ _M_iterate(0), _M_umap_cost(0.0), _M_map_cost(0.0), _M_valid(true) { }
+
+ virtual ~__map2umap_info() { }
+
+ __map2umap_info(const __map2umap_info& __o)
+ : __object_info_base(__o), _M_insert(__o._M_insert),
+ _M_erase(__o._M_erase), _M_find(__o._M_find),
+ _M_iterate(__o._M_iterate), _M_umap_cost(__o._M_umap_cost),
+ _M_map_cost(__o._M_map_cost), _M_valid(__o._M_valid) { }
+
+ void
+ __merge(const __map2umap_info& __o)
+ {
+ _M_insert += __o._M_insert;
+ _M_erase += __o._M_erase;
+ _M_find += __o._M_find;
+ _M_umap_cost += __o._M_umap_cost;
+ _M_map_cost += __o._M_map_cost;
+ _M_valid &= __o._M_valid;
+ }
-inline void __map2umap_info:: __record_find(size_t __size)
-{
- _M_find += 1;
- _M_map_cost += __map_find_cost(__size);
- _M_umap_cost += _GLIBCXX_PROFILE_DATA(__umap_find_cost_factor).__value;
-}
+ void
+ __write(FILE* __f) const
+ {
+ std::fprintf(__f, "%Zu %Zu %Zu %Zu %.0f %.0f %s\n",
+ _M_insert, _M_erase, _M_find, _M_iterate, _M_map_cost,
+ _M_umap_cost, _M_valid ? "valid" : "invalid");
+ }
-inline void __map2umap_info:: __record_iterate(size_t __count)
-{
- _M_iterate += __count;
- _M_map_cost += (__count
- * _GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor).__value);
- _M_umap_cost += (
- __count * _GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor).__value);
-}
-
-inline void __map2umap_info:: __record_invalidate()
-{
- _M_valid = false;
-}
+ float
+ __magnitude() const
+ { return _M_map_cost - _M_umap_cost; }
+
+ std::string
+ __advice() const
+ { return "change std::map to std::unordered_map"; }
+
+ void
+ __record_insert(std::size_t __size, std::size_t __count)
+ {
+ _M_insert += __count;
+ _M_map_cost += __count * __map_insert_cost(__size);
+ _M_umap_cost
+ += (__count
+ * _GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor).__value);
+ }
-inline void __map2umap_info::__write(FILE* __f) const
-{
- fprintf(__f, "%Zu %Zu %Zu %Zu %.0f %.0f %s\n",
- _M_insert, _M_erase, _M_find, _M_iterate, _M_map_cost, _M_umap_cost,
- _M_valid ? "valid" : "invalid");
-}
+ void
+ __record_erase(std::size_t __size, std::size_t __count)
+ {
+ _M_erase += __count;
+ _M_map_cost += __count * __map_erase_cost(__size);
+ _M_umap_cost
+ += (__count
+ * _GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor).__value);
+ }
-/** @brief A map-to-unordered_map instrumentation line in the stack table. */
-class __map2umap_stack_info: public __map2umap_info
-{
- public:
- __map2umap_stack_info(const __map2umap_info& o) : __map2umap_info(o) {}
-};
+ void
+ __record_find(std::size_t __size)
+ {
+ _M_find += 1;
+ _M_map_cost += __map_find_cost(__size);
+ _M_umap_cost += _GLIBCXX_PROFILE_DATA(__umap_find_cost_factor).__value;
+ }
-/** @brief Map-to-unordered_map instrumentation producer. */
-class __trace_map2umap
- : public __trace_base<__map2umap_info, __map2umap_stack_info>
-{
- public:
- __trace_map2umap();
-};
+ void
+ __record_iterate(std::size_t __count)
+ {
+ _M_iterate += __count;
+ _M_map_cost
+ += (__count
+ * _GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor).__value);
+ _M_umap_cost
+ += (__count
+ * _GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor).__value);
+ }
-inline __trace_map2umap::__trace_map2umap()
+ void
+ __record_invalidate()
+ { _M_valid = false; }
+
+ private:
+ std::size_t _M_insert;
+ std::size_t _M_erase;
+ std::size_t _M_find;
+ std::size_t _M_iterate;
+ float _M_umap_cost;
+ float _M_map_cost;
+ bool _M_valid;
+ };
+
+
+ /** @brief A map-to-unordered_map instrumentation line in the
+ stack table. */
+ class __map2umap_stack_info
+ : public __map2umap_info
+ {
+ public:
+ __map2umap_stack_info(const __map2umap_info& __o)
+ : __map2umap_info(__o) { }
+ };
+
+ /** @brief Map-to-unordered_map instrumentation producer. */
+ class __trace_map2umap
+ : public __trace_base<__map2umap_info, __map2umap_stack_info>
+ {
+ public:
+ __trace_map2umap()
: __trace_base<__map2umap_info, __map2umap_stack_info>()
-{
- __id = "map-to-unordered-map";
-}
+ { __id = "map-to-unordered-map"; }
+ };
-inline void __trace_map_to_unordered_map_init()
-{
- _GLIBCXX_PROFILE_DATA(_S_map2umap) = new __trace_map2umap();
-}
+ inline void
+ __trace_map_to_unordered_map_init()
+ { _GLIBCXX_PROFILE_DATA(_S_map2umap) = new __trace_map2umap(); }
-inline void __trace_map_to_unordered_map_report(
- FILE* __f, __warning_vector_t& __warnings)
-{
- if (_GLIBCXX_PROFILE_DATA(_S_map2umap)) {
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__collect_warnings(__warnings);
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__write(__f);
+ inline void
+ __trace_map_to_unordered_map_report(FILE* __f,
+ __warning_vector_t& __warnings)
+ {
+ if (_GLIBCXX_PROFILE_DATA(_S_map2umap))
+ {
+ _GLIBCXX_PROFILE_DATA(_S_map2umap)->__collect_warnings(__warnings);
+ _GLIBCXX_PROFILE_DATA(_S_map2umap)->__write(__f);
+ }
}
-}
-
-inline void __trace_map_to_unordered_map_construct(const void* __obj)
-{
- if (!__profcxx_init()) return;
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__add_object(
- __obj, __map2umap_info(__get_stack()));
-}
-
-inline void __trace_map_to_unordered_map_destruct(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_map_to_unordered_map_construct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__retire_object(__obj);
-}
+ _GLIBCXX_PROFILE_DATA(_S_map2umap)->
+ __add_object(__obj, __map2umap_info(__get_stack()));
+ }
-inline void __trace_map_to_unordered_map_insert(const void* __obj,
- size_t __size, size_t __count)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_map_to_unordered_map_destruct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- __map2umap_info* __info =
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+ _GLIBCXX_PROFILE_DATA(_S_map2umap)->__retire_object(__obj);
+ }
- if (__info) __info->__record_insert(__size, __count);
-}
+ inline void
+ __trace_map_to_unordered_map_insert(const void* __obj,
+ std::size_t __size, std::size_t __count)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_map_to_unordered_map_erase(const void* __obj,
- size_t __size, size_t __count)
-{
- if (!__profcxx_init()) return;
+ __map2umap_info* __info
+ = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
- __map2umap_info* __info =
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+ if (__info)
+ __info->__record_insert(__size, __count);
+ }
- if (__info) __info->__record_erase(__size, __count);
-}
+ inline void
+ __trace_map_to_unordered_map_erase(const void* __obj,
+ std::size_t __size, std::size_t __count)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_map_to_unordered_map_find(const void* __obj, size_t __size)
-{
- if (!__profcxx_init()) return;
+ __map2umap_info* __info
+ = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
- __map2umap_info* __info =
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+ if (__info)
+ __info->__record_erase(__size, __count);
+ }
- if (__info) __info->__record_find(__size);
-}
+ inline void
+ __trace_map_to_unordered_map_find(const void* __obj, std::size_t __size)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_map_to_unordered_map_iterate(const void* __obj,
- size_t __count)
-{
- if (!__profcxx_init()) return;
+ __map2umap_info* __info
+ = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
- __map2umap_info* __info =
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+ if (__info)
+ __info->__record_find(__size);
+ }
- if (__info) __info->__record_iterate(__count);
-}
+ inline void
+ __trace_map_to_unordered_map_iterate(const void* __obj, std::size_t __count)
+ {
+ if (!__profcxx_init())
+ return;
+
+ __map2umap_info* __info
+ = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+
+ if (__info)
+ __info->__record_iterate(__count);
+ }
-inline void __trace_map_to_unordered_map_invalidate(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_map_to_unordered_map_invalidate(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- __map2umap_info* __info =
- _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+ __map2umap_info* __info
+ = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
- if (__info) __info->__record_invalidate();
-}
+ if (__info)
+ __info->__record_invalidate();
+ }
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H */
diff --git a/libstdc++-v3/include/profile/impl/profiler_node.h b/libstdc++-v3/include/profile/impl/profiler_node.h
index 77654a8f813..d22a3e16b48 100644
--- a/libstdc++-v3/include/profile/impl/profiler_node.h
+++ b/libstdc++-v3/include/profile/impl/profiler_node.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,15 +37,8 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_NODE_H
#define _GLIBCXX_PROFILE_PROFILER_NODE_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdio>
-#include <cstdint>
-#include <cstring>
-#else
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#endif
+#include <cstdio> // FILE, fprintf
+
#include <vector>
#if defined _GLIBCXX_HAVE_EXECINFO_H
#include <execinfo.h>
@@ -53,120 +46,128 @@
namespace __gnu_profile
{
-typedef const void* __object_t;
-typedef void* __instruction_address_t;
-typedef std::_GLIBCXX_STD_PR::vector<__instruction_address_t> __stack_npt;
-typedef __stack_npt* __stack_t;
+ typedef const void* __object_t;
+ typedef void* __instruction_address_t;
+ typedef std::_GLIBCXX_STD_PR::vector<__instruction_address_t> __stack_npt;
+ typedef __stack_npt* __stack_t;
-size_t __stack_max_depth();
+ std::size_t __stack_max_depth();
-inline __stack_t __get_stack()
-{
+ inline __stack_t
+ __get_stack()
+ {
#if defined _GLIBCXX_HAVE_EXECINFO_H
- size_t __max_depth = __stack_max_depth();
- if (__max_depth == 0)
- return NULL;
- __stack_npt __buffer(__max_depth);
- int __depth = backtrace(&__buffer[0], __max_depth);
- __stack_t __stack = new __stack_npt(__depth);
- memcpy(&(*__stack)[0], &__buffer[0], __depth * sizeof(__object_t));
- return __stack;
+ std::size_t __max_depth = __stack_max_depth();
+ if (__max_depth == 0)
+ return 0;
+ __stack_npt __buffer(__max_depth);
+ int __depth = backtrace(&__buffer[0], __max_depth);
+ __stack_t __stack = new __stack_npt(__depth);
+ __builtin_memcpy(&(*__stack)[0], &__buffer[0],
+ __depth * sizeof(__object_t));
+ return __stack;
#else
- return NULL;
-#endif
-}
-
-inline __size(const __stack_t& __stack)
-{
- if (!__stack) {
return 0;
- } else {
- return __stack->size();
- }
-}
-
-inline void __write(FILE* __f, const __stack_t __stack)
-{
- if (!__stack) {
- return;
- }
-
- __stack_npt::const_iterator __it;
- for (__it = __stack->begin(); __it != __stack->end(); ++__it) {
- fprintf(__f, "%p ", *__it);
+#endif
}
-}
-/** @brief Hash function for summary trace using call stack as index. */
-class __stack_hash
-{
- public:
- size_t operator()(const __stack_t __s) const
+ inline std::size_t
+ __size(__stack_t __stack)
{
- if (!__s) {
+ if (!__stack)
return 0;
- }
+ else
+ return __stack->size();
+ }
- uintptr_t __index = 0;
+ // XXX
+ inline void
+ __write(FILE* __f, __stack_t __stack)
+ {
+ if (!__stack)
+ return;
+
__stack_npt::const_iterator __it;
- for (__it = __s->begin(); __it != __s->end(); ++__it) {
- __index += reinterpret_cast<uintptr_t>(*__it);
- }
- return __index;
+ for (__it = __stack->begin(); __it != __stack->end(); ++__it)
+ std::fprintf(__f, "%p ", *__it);
}
- bool operator() (const __stack_t __stack1, const __stack_t __stack2) const
+ /** @brief Hash function for summary trace using call stack as index. */
+ class __stack_hash
{
- if (!__stack1 && !__stack2) return true;
- if (!__stack1 || !__stack2) return false;
- if (__stack1->size() != __stack2->size()) return false;
-
- size_t __byte_size = __stack1->size() * sizeof(__stack_npt::value_type);
- return memcmp(&(*__stack1)[0], &(*__stack2)[0], __byte_size) == 0;
- }
-};
+ public:
+ std::size_t
+ operator()(__stack_t __s) const
+ {
+ if (!__s)
+ return 0;
+
+ __UINTPTR_TYPE__ __index = 0;
+ __stack_npt::const_iterator __it;
+ for (__it = __s->begin(); __it != __s->end(); ++__it)
+ __index += reinterpret_cast<__UINTPTR_TYPE__>(*__it);
+ return __index;
+ }
-/** @brief Base class for a line in the object table. */
-class __object_info_base
-{
- public:
- __object_info_base() {}
- __object_info_base(__stack_t __stack);
- __object_info_base(const __object_info_base& o);
- virtual ~__object_info_base() {}
- bool __is_valid() const { return _M_valid; }
- __stack_t __stack() const { return _M_stack; }
- virtual void __write(FILE* f) const = 0;
-
- protected:
- __stack_t _M_stack;
- bool _M_valid;
-};
-
-inline __object_info_base::__object_info_base(__stack_t __stack)
-{
- _M_stack = __stack;
- _M_valid = true;
-}
+ bool operator() (__stack_t __stack1, __stack_t __stack2) const
+ {
+ if (!__stack1 && !__stack2)
+ return true;
+ if (!__stack1 || !__stack2)
+ return false;
+ if (__stack1->size() != __stack2->size())
+ return false;
+
+ std::size_t __byte_size
+ = __stack1->size() * sizeof(__stack_npt::value_type);
+ return __builtin_memcmp(&(*__stack1)[0], &(*__stack2)[0],
+ __byte_size) == 0;
+ }
+ };
-inline __object_info_base::__object_info_base(const __object_info_base& __o)
-{
- _M_stack = __o._M_stack;
- _M_valid = __o._M_valid;
-}
-/** @brief Base class for a line in the stack table. */
-template<typename __object_info>
-class __stack_info_base
-{
- public:
- __stack_info_base() {}
- __stack_info_base(const __object_info& __info) = 0;
- virtual ~__stack_info_base() {}
- void __merge(const __object_info& __info) = 0;
- virtual float __magnitude() const = 0;
- virtual const char* __get_id() const = 0;
-};
+ /** @brief Base class for a line in the object table. */
+ class __object_info_base
+ {
+ public:
+ __object_info_base() { }
+
+ __object_info_base(__stack_t __stack)
+ : _M_stack(__stack), _M_valid(true) { }
+
+ __object_info_base(const __object_info_base& __o)
+ : _M_stack(__o._M_stack), _M_valid(__o._M_valid) { }
+
+ virtual ~__object_info_base() { }
+
+ bool
+ __is_valid() const
+ { return _M_valid; }
+
+ __stack_t
+ __stack() const
+ { return _M_stack; }
+
+ virtual void __write(FILE* f) const = 0;
+
+ protected:
+ __stack_t _M_stack;
+ bool _M_valid;
+ };
+
+
+ /** @brief Base class for a line in the stack table. */
+ template<typename __object_info>
+ class __stack_info_base
+ {
+ public:
+ __stack_info_base() { }
+ __stack_info_base(const __object_info& __info) = 0;
+ virtual ~__stack_info_base() {}
+ void __merge(const __object_info& __info) = 0;
+ virtual float __magnitude() const = 0;
+ virtual const char* __get_id() const = 0;
+ };
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_NODE_H */
diff --git a/libstdc++-v3/include/profile/impl/profiler_state.h b/libstdc++-v3/include/profile/impl/profiler_state.h
index 540c3e4bf0c..111b97e0eca 100644
--- a/libstdc++-v3/include/profile/impl/profiler_state.h
+++ b/libstdc++-v3/include/profile/impl/profiler_state.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -39,32 +39,35 @@
namespace __gnu_profile
{
+ enum __state_type { __ON, __OFF, __INVALID };
-enum __state_type { __ON, __OFF, __INVALID };
+ _GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID);
-_GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID);
+ inline bool
+ __turn(__state_type __s)
+ { return (_GLIBCXX_PROFILE_DATA(__state)
+ == __sync_val_compare_and_swap(&_GLIBCXX_PROFILE_DATA(__state),
+ __INVALID, __s)); }
-inline bool __turn(__state_type __s)
-{
- return (_GLIBCXX_PROFILE_DATA(__state)
- == __sync_val_compare_and_swap(&_GLIBCXX_PROFILE_DATA(__state),
- __INVALID, __s));
-}
-
-inline bool __turn_on()
-{ return __turn(__ON); }
+ inline bool
+ __turn_on()
+ { return __turn(__ON); }
-inline bool __turn_off()
-{ return __turn(__OFF); }
+ inline bool
+ __turn_off()
+ { return __turn(__OFF); }
-inline bool __is_on()
-{ return _GLIBCXX_PROFILE_DATA(__state) == __ON; }
+ inline bool
+ __is_on()
+ { return _GLIBCXX_PROFILE_DATA(__state) == __ON; }
-inline bool __is_off()
-{ return _GLIBCXX_PROFILE_DATA(__state) == __OFF; }
+ inline bool
+ __is_off()
+ { return _GLIBCXX_PROFILE_DATA(__state) == __OFF; }
-inline bool __is_invalid()
-{ return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; }
+ inline bool
+ __is_invalid()
+ { return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; }
} // end namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_STATE_H */
diff --git a/libstdc++-v3/include/profile/impl/profiler_trace.h b/libstdc++-v3/include/profile/impl/profiler_trace.h
index bfa8a6c3b21..1dfdd013b08 100644
--- a/libstdc++-v3/include/profile/impl/profiler_trace.h
+++ b/libstdc++-v3/include/profile/impl/profiler_trace.h
@@ -37,18 +37,14 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_TRACE_H
#define _GLIBCXX_PROFILE_PROFILER_TRACE_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <cstdio> // fopen, fclose, fprintf, FILE
#include <cerrno>
-#include <cstdint>
-#include <cstdio>
-#include <cstdlib>
+#include <cstdlib> // atof, atoi, strtol, getenv, atexit, abort
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
#define _GLIBCXX_IMPL_UNORDERED_MAP std::_GLIBCXX_STD_PR::unordered_map
#include <unordered_map>
#else
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <tr1/unordered_map>
#define _GLIBCXX_IMPL_UNORDERED_MAP std::tr1::unordered_map
#endif
@@ -65,575 +61,606 @@
namespace __gnu_profile
{
-/** @brief Internal environment. Values can be set one of two ways:
- 1. In config file "var = value". The default config file path is
- libstdcxx-profile.conf.
- 2. By setting process environment variables. For instance, in a Bash
- shell you can set the unit cost of iterating through a map like this:
- export __map_iterate_cost_factor=5.0.
- If a value is set both in the input file and through an environment
- variable, the environment value takes precedence. */
-typedef _GLIBCXX_IMPL_UNORDERED_MAP<std::string, std::string> __env_t;
-_GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__env_t, __env);
-
-/** @brief Master lock. */
-_GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__gnu_cxx::__mutex, __global_lock);
-
-/** @brief Representation of a warning. */
-struct __warning_data
-{
- float __magnitude;
- __stack_t __context;
- const char* __warning_id;
- const char* __warning_message;
- __warning_data()
- : __magnitude(0.0), __context(NULL), __warning_id(NULL),
- __warning_message(NULL) { }
- __warning_data(float __m, __stack_t __c, const char* __id,
- const char* __msg)
- : __magnitude(__m), __context(__c), __warning_id(__id),
- __warning_message(__msg) { }
- bool operator<(const struct __warning_data& __other) const
- { return __magnitude < __other.__magnitude; }
-};
-
-typedef std::_GLIBCXX_STD_PR::vector<__warning_data> __warning_vector_t;
-
-// Defined in profiler_<diagnostic name>.h.
-class __trace_hash_func;
-class __trace_hashtable_size;
-class __trace_map2umap;
-class __trace_vector_size;
-class __trace_vector_to_list;
-class __trace_list_to_slist;
-class __trace_list_to_vector;
-void __trace_vector_size_init();
-void __trace_hashtable_size_init();
-void __trace_hash_func_init();
-void __trace_vector_to_list_init();
-void __trace_list_to_slist_init();
-void __trace_list_to_vector_init();
-void __trace_map_to_unordered_map_init();
-void __trace_vector_size_report(FILE*, __warning_vector_t&);
-void __trace_hashtable_size_report(FILE*, __warning_vector_t&);
-void __trace_hash_func_report(FILE*, __warning_vector_t&);
-void __trace_vector_to_list_report(FILE*, __warning_vector_t&);
-void __trace_list_to_slist_report(FILE*, __warning_vector_t&);
-void __trace_list_to_vector_report(FILE*, __warning_vector_t&);
-void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&);
-
-// Utility functions.
-inline size_t __max(size_t __a, size_t __b)
-{
- return __a >= __b ? __a : __b;
-}
+ /** @brief Internal environment. Values can be set one of two ways:
+ 1. In config file "var = value". The default config file path is
+ libstdcxx-profile.conf.
+ 2. By setting process environment variables. For instance, in a Bash
+ shell you can set the unit cost of iterating through a map like this:
+ export __map_iterate_cost_factor=5.0.
+ If a value is set both in the input file and through an environment
+ variable, the environment value takes precedence. */
+ typedef _GLIBCXX_IMPL_UNORDERED_MAP<std::string, std::string> __env_t;
+
+ _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__env_t, __env);
+
+ /** @brief Master lock. */
+ _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__gnu_cxx::__mutex, __global_lock);
+
+ /** @brief Representation of a warning. */
+ struct __warning_data
+ {
+ float __magnitude;
+ __stack_t __context;
+ const char* __warning_id;
+ std::string __warning_message;
+
+ __warning_data()
+ : __magnitude(0.0), __context(0), __warning_id(0) { }
+
+ __warning_data(float __m, __stack_t __c, const char* __id,
+ const std::string& __msg)
+ : __magnitude(__m), __context(__c), __warning_id(__id),
+ __warning_message(__msg) { }
+
+ bool
+ operator<(const __warning_data& __other) const
+ { return __magnitude < __other.__magnitude; }
+ };
+
+ typedef std::_GLIBCXX_STD_PR::vector<__warning_data> __warning_vector_t;
+
+ // Defined in profiler_<diagnostic name>.h.
+ class __trace_hash_func;
+ class __trace_hashtable_size;
+ class __trace_map2umap;
+ class __trace_vector_size;
+ class __trace_vector_to_list;
+ class __trace_list_to_slist;
+ class __trace_list_to_vector;
+ void __trace_vector_size_init();
+ void __trace_hashtable_size_init();
+ void __trace_hash_func_init();
+ void __trace_vector_to_list_init();
+ void __trace_list_to_slist_init();
+ void __trace_list_to_vector_init();
+ void __trace_map_to_unordered_map_init();
+ void __trace_vector_size_report(FILE*, __warning_vector_t&);
+ void __trace_hashtable_size_report(FILE*, __warning_vector_t&);
+ void __trace_hash_func_report(FILE*, __warning_vector_t&);
+ void __trace_vector_to_list_report(FILE*, __warning_vector_t&);
+ void __trace_list_to_slist_report(FILE*, __warning_vector_t&);
+ void __trace_list_to_vector_report(FILE*, __warning_vector_t&);
+ void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&);
+
+ struct __cost_factor
+ {
+ const char* __env_var;
+ float __value;
+ };
+
+ typedef std::_GLIBCXX_STD_PR::vector<__cost_factor*> __cost_factor_vector;
+
+ _GLIBCXX_PROFILE_DEFINE_DATA(__trace_hash_func*, _S_hash_func, 0);
+ _GLIBCXX_PROFILE_DEFINE_DATA(__trace_hashtable_size*, _S_hashtable_size, 0);
+ _GLIBCXX_PROFILE_DEFINE_DATA(__trace_map2umap*, _S_map2umap, 0);
+ _GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_size*, _S_vector_size, 0);
+ _GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_to_list*, _S_vector_to_list, 0);
+ _GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_slist*, _S_list_to_slist, 0);
+ _GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_vector*, _S_list_to_vector, 0);
+
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_shift_cost_factor,
+ {"__vector_shift_cost_factor", 1.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_iterate_cost_factor,
+ {"__vector_iterate_cost_factor", 1.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_resize_cost_factor,
+ {"__vector_resize_cost_factor", 1.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_shift_cost_factor,
+ {"__list_shift_cost_factor", 0.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_iterate_cost_factor,
+ {"__list_iterate_cost_factor", 10.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_resize_cost_factor,
+ {"__list_resize_cost_factor", 0.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_insert_cost_factor,
+ {"__map_insert_cost_factor", 1.5});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_erase_cost_factor,
+ {"__map_erase_cost_factor", 1.5});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_find_cost_factor,
+ {"__map_find_cost_factor", 1});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_iterate_cost_factor,
+ {"__map_iterate_cost_factor", 2.3});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_insert_cost_factor,
+ {"__umap_insert_cost_factor", 12.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_erase_cost_factor,
+ {"__umap_erase_cost_factor", 12.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_find_cost_factor,
+ {"__umap_find_cost_factor", 10.0});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_iterate_cost_factor,
+ {"__umap_iterate_cost_factor", 1.7});
+ _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor_vector*, __cost_factors, 0);
+
+ _GLIBCXX_PROFILE_DEFINE_DATA(const char*, _S_trace_file_name,
+ _GLIBCXX_PROFILE_TRACE_PATH_ROOT);
+ _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_warn_count,
+ _GLIBCXX_PROFILE_MAX_WARN_COUNT);
+ _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_stack_depth,
+ _GLIBCXX_PROFILE_MAX_STACK_DEPTH);
+ _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_mem,
+ _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC);
+
+ inline std::size_t
+ __stack_max_depth()
+ { return _GLIBCXX_PROFILE_DATA(_S_max_stack_depth); }
+
+ inline std::size_t
+ __max_mem()
+ { return _GLIBCXX_PROFILE_DATA(_S_max_mem); }
+
+ /** @brief Base class for all trace producers. */
+ template<typename __object_info, typename __stack_info>
+ class __trace_base
+ {
+ public:
+ // Do not pick the initial size too large, as we don't know which
+ // diagnostics are more active.
+ __trace_base()
+ : __object_table(10000), __stack_table(10000),
+ __stack_table_byte_size(0), __id(0) { }
+
+ virtual ~__trace_base() { }
+
+ void __add_object(__object_t object, __object_info __info);
+ __object_info* __get_object_info(__object_t __object);
+ void __retire_object(__object_t __object);
+ void __write(FILE* __f);
+ void __collect_warnings(__warning_vector_t& __warnings);
+
+ private:
+ __gnu_cxx::__mutex __object_table_lock;
+ __gnu_cxx::__mutex __stack_table_lock;
+ typedef _GLIBCXX_IMPL_UNORDERED_MAP<__object_t,
+ __object_info> __object_table_t;
+ typedef _GLIBCXX_IMPL_UNORDERED_MAP<__stack_t, __stack_info,
+ __stack_hash,
+ __stack_hash> __stack_table_t;
+ __object_table_t __object_table;
+ __stack_table_t __stack_table;
+ std::size_t __stack_table_byte_size;
+
+ protected:
+ const char* __id;
+ };
+
+ template<typename __object_info, typename __stack_info>
+ void
+ __trace_base<__object_info, __stack_info>::
+ __collect_warnings(__warning_vector_t& __warnings)
+ {
+ for (typename __stack_table_t::iterator __it
+ = __stack_table.begin(); __it != __stack_table.end(); ++__it)
+ __warnings.push_back(__warning_data((*__it).second.__magnitude(),
+ (*__it).first, __id,
+ (*__it).second.__advice()));
+ }
-inline size_t __min(size_t __a, size_t __b)
-{
- return __a <= __b ? __a : __b;
-}
+ template<typename __object_info, typename __stack_info>
+ void
+ __trace_base<__object_info, __stack_info>::
+ __add_object(__object_t __object, __object_info __info)
+ {
+ if (__max_mem() == 0
+ || __object_table.size() * sizeof(__object_info) <= __max_mem())
+ {
+ this->__object_table_lock.lock();
+ __object_table.insert(typename __object_table_t::
+ value_type(__object, __info));
+ this->__object_table_lock.unlock();
+ }
+ }
-struct __cost_factor
-{
- const char* __env_var;
- float __value;
-};
-
-typedef std::_GLIBCXX_STD_PR::vector<__cost_factor*> __cost_factor_vector;
-
-_GLIBCXX_PROFILE_DEFINE_DATA(__trace_hash_func*, _S_hash_func, NULL);
-_GLIBCXX_PROFILE_DEFINE_DATA(__trace_hashtable_size*, _S_hashtable_size, NULL);
-_GLIBCXX_PROFILE_DEFINE_DATA(__trace_map2umap*, _S_map2umap, NULL);
-_GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_size*, _S_vector_size, NULL);
-_GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_to_list*, _S_vector_to_list, NULL);
-_GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_slist*, _S_list_to_slist, NULL);
-_GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_vector*, _S_list_to_vector, NULL);
-
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_shift_cost_factor,
- {"__vector_shift_cost_factor", 1.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_iterate_cost_factor,
- {"__vector_iterate_cost_factor", 1.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_resize_cost_factor,
- {"__vector_resize_cost_factor", 1.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_shift_cost_factor,
- {"__list_shift_cost_factor", 0.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_iterate_cost_factor,
- {"__list_iterate_cost_factor", 10.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_resize_cost_factor,
- {"__list_resize_cost_factor", 0.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_insert_cost_factor,
- {"__map_insert_cost_factor", 1.5});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_erase_cost_factor,
- {"__map_erase_cost_factor", 1.5});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_find_cost_factor,
- {"__map_find_cost_factor", 1});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_iterate_cost_factor,
- {"__map_iterate_cost_factor", 2.3});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_insert_cost_factor,
- {"__umap_insert_cost_factor", 12.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_erase_cost_factor,
- {"__umap_erase_cost_factor", 12.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_find_cost_factor,
- {"__umap_find_cost_factor", 10.0});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_iterate_cost_factor,
- {"__umap_iterate_cost_factor", 1.7});
-_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor_vector*, __cost_factors, NULL);
-
-_GLIBCXX_PROFILE_DEFINE_DATA(const char*, _S_trace_file_name,
- _GLIBCXX_PROFILE_TRACE_PATH_ROOT);
-_GLIBCXX_PROFILE_DEFINE_DATA(size_t, _S_max_warn_count,
- _GLIBCXX_PROFILE_MAX_WARN_COUNT);
-_GLIBCXX_PROFILE_DEFINE_DATA(size_t, _S_max_stack_depth,
- _GLIBCXX_PROFILE_MAX_STACK_DEPTH);
-_GLIBCXX_PROFILE_DEFINE_DATA(size_t, _S_max_mem,
- _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC);
-
-inline size_t __stack_max_depth()
-{
- return _GLIBCXX_PROFILE_DATA(_S_max_stack_depth);
-}
+ template<typename __object_info, typename __stack_info>
+ __object_info*
+ __trace_base<__object_info, __stack_info>::
+ __get_object_info(__object_t __object)
+ {
+ // XXX: Revisit this to see if we can decrease mutex spans.
+ // Without this mutex, the object table could be rehashed during an
+ // insertion on another thread, which could result in a segfault.
+ this->__object_table_lock.lock();
+ typename __object_table_t::iterator __object_it
+ = __object_table.find(__object);
+
+ if (__object_it == __object_table.end())
+ {
+ this->__object_table_lock.unlock();
+ return 0;
+ }
+ else
+ {
+ this->__object_table_lock.unlock();
+ return &__object_it->second;
+ }
+ }
-inline size_t __max_mem()
-{
- return _GLIBCXX_PROFILE_DATA(_S_max_mem);
-}
+ template<typename __object_info, typename __stack_info>
+ void
+ __trace_base<__object_info, __stack_info>::
+ __retire_object(__object_t __object)
+ {
+ this->__object_table_lock.lock();
+ this->__stack_table_lock.lock();
+ typename __object_table_t::iterator __object_it
+ = __object_table.find(__object);
+
+ if (__object_it != __object_table.end())
+ {
+ const __object_info& __info = __object_it->second;
+ const __stack_t& __stack = __info.__stack();
+ typename __stack_table_t::iterator __stack_it
+ = __stack_table.find(__stack);
+
+ if (__stack_it == __stack_table.end())
+ {
+ // First occurence of this call context.
+ if (__max_mem() == 0 || __stack_table_byte_size < __max_mem())
+ {
+ __stack_table_byte_size
+ += (sizeof(__instruction_address_t) * __size(__stack)
+ + sizeof(__stack) + sizeof(__stack_info));
+ __stack_table.insert(make_pair(__stack,
+ __stack_info(__info)));
+ }
+ }
+ else
+ {
+ // Merge object info into info summary for this call context.
+ __stack_it->second.__merge(__info);
+ delete __stack;
+ }
+ __object_table.erase(__object);
+ }
+
+ this->__object_table_lock.unlock();
+ this->__stack_table_lock.unlock();
+ }
-/** @brief Base class for all trace producers. */
-template <typename __object_info, typename __stack_info>
-class __trace_base
-{
- public:
- __trace_base();
- virtual ~__trace_base() {}
-
- void __add_object(__object_t object, __object_info __info);
- __object_info* __get_object_info(__object_t __object);
- void __retire_object(__object_t __object);
- void __write(FILE* f);
- void __collect_warnings(__warning_vector_t& __warnings);
-
- private:
- __gnu_cxx::__mutex __object_table_lock;
- __gnu_cxx::__mutex __stack_table_lock;
- typedef _GLIBCXX_IMPL_UNORDERED_MAP<__object_t,
- __object_info> __object_table_t;
- typedef _GLIBCXX_IMPL_UNORDERED_MAP<__stack_t, __stack_info, __stack_hash,
- __stack_hash> __stack_table_t;
- __object_table_t __object_table;
- __stack_table_t __stack_table;
- size_t __stack_table_byte_size;
-
- protected:
- const char* __id;
-};
-
-template <typename __object_info, typename __stack_info>
-void __trace_base<__object_info, __stack_info>::__collect_warnings(
- __warning_vector_t& __warnings)
-{
- typename __stack_table_t::iterator __i = __stack_table.begin();
- for (; __i != __stack_table.end(); ++__i)
+ template<typename __object_info, typename __stack_info>
+ void
+ __trace_base<__object_info, __stack_info>::
+ __write(FILE* __f)
+ {
+ for (typename __stack_table_t::iterator __it
+ = __stack_table.begin(); __it != __stack_table.end(); ++__it)
+ if (__it->second.__is_valid())
+ {
+ std::fprintf(__f, __id);
+ std::fprintf(__f, "|");
+ __gnu_profile::__write(__f, __it->first);
+ std::fprintf(__f, "|");
+ __it->second.__write(__f);
+ }
+ }
+
+ inline std::size_t
+ __env_to_size_t(const char* __env_var, std::size_t __default_value)
{
- __warnings.push_back(__warning_data((*__i).second.__magnitude(),
- (*__i).first,
- __id,
- (*__i).second.__advice()));
+ char* __env_value = std::getenv(__env_var);
+ if (__env_value)
+ {
+ errno = 0;
+ long __converted_value = std::strtol(__env_value, 0, 10);
+ if (errno || __converted_value < 0)
+ {
+ std::fprintf(stderr,
+ "Bad value for environment variable '%s'.\n",
+ __env_var);
+ std::abort();
+ }
+ else
+ return static_cast<std::size_t>(__converted_value);
+ }
+ else
+ return __default_value;
}
-}
-template <typename __object_info, typename __stack_info>
-__trace_base<__object_info, __stack_info>::__trace_base()
-{
- // Do not pick the initial size too large, as we don't know which diagnostics
- // are more active.
- __object_table.rehash(10000);
- __stack_table.rehash(10000);
- __stack_table_byte_size = 0;
- __id = NULL;
-}
-
-template <typename __object_info, typename __stack_info>
-void __trace_base<__object_info, __stack_info>::__add_object(
- __object_t __object, __object_info __info)
-{
- if (__max_mem() == 0
- || __object_table.size() * sizeof(__object_info) <= __max_mem()) {
- this->__object_table_lock.lock();
- __object_table.insert(
- typename __object_table_t::value_type(__object, __info));
- this->__object_table_lock.unlock();
+ inline void
+ __set_max_stack_trace_depth()
+ {
+ _GLIBCXX_PROFILE_DATA(_S_max_stack_depth)
+ = __env_to_size_t(_GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR,
+ _GLIBCXX_PROFILE_DATA(_S_max_stack_depth));
}
-}
-template <typename __object_info, typename __stack_info>
-__object_info* __trace_base<__object_info, __stack_info>::__get_object_info(
- __object_t __object)
-{
- // XXX: Revisit this to see if we can decrease mutex spans.
- // Without this mutex, the object table could be rehashed during an
- // insertion on another thread, which could result in a segfault.
- this->__object_table_lock.lock();
- typename __object_table_t::iterator __object_it =
- __object_table.find(__object);
- if (__object_it == __object_table.end()){
- this->__object_table_lock.unlock();
- return NULL;
- } else {
- this->__object_table_lock.unlock();
- return &__object_it->second;
+ inline void
+ __set_max_mem()
+ {
+ _GLIBCXX_PROFILE_DATA(_S_max_mem)
+ = __env_to_size_t(_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR,
+ _GLIBCXX_PROFILE_DATA(_S_max_mem));
}
-}
-template <typename __object_info, typename __stack_info>
-void __trace_base<__object_info, __stack_info>::__retire_object(
- __object_t __object)
-{
- this->__object_table_lock.lock();
- this->__stack_table_lock.lock();
- typename __object_table_t::iterator __object_it =
- __object_table.find(__object);
- if (__object_it != __object_table.end()){
- const __object_info& __info = __object_it->second;
- const __stack_t& __stack = __info.__stack();
- typename __stack_table_t::iterator __stack_it =
- __stack_table.find(__stack);
- if (__stack_it == __stack_table.end()) {
- // First occurence of this call context.
- if (__max_mem() == 0 || __stack_table_byte_size < __max_mem()) {
- __stack_table_byte_size +=
- (sizeof(__instruction_address_t) * __size(__stack)
- + sizeof(__stack) + sizeof(__stack_info));
- __stack_table.insert(make_pair(__stack, __stack_info(__info)));
+ inline int
+ __log_magnitude(float __f)
+ {
+ const float __log_base = 10.0;
+ int __result = 0;
+ int __sign = 1;
+
+ if (__f < 0)
+ {
+ __f = -__f;
+ __sign = -1;
}
- } else {
- // Merge object info into info summary for this call context.
- __stack_it->second.__merge(__info);
- delete __stack;
- }
- __object_table.erase(__object);
- }
- this->__object_table_lock.unlock();
- this->__stack_table_lock.unlock();
-}
-template <typename __object_info, typename __stack_info>
-void __trace_base<__object_info, __stack_info>::__write(FILE* __f)
-{
- typename __stack_table_t::iterator __it;
-
- for (__it = __stack_table.begin(); __it != __stack_table.end(); __it++) {
- if (__it->second.__is_valid()) {
- fprintf(__f, __id);
- fprintf(__f, "|");
- __gnu_profile::__write(__f, __it->first);
- fprintf(__f, "|");
- __it->second.__write(__f);
- }
- }
-}
-
-inline size_t __env_to_size_t(const char* __env_var, size_t __default_value)
-{
- char* __env_value = getenv(__env_var);
- if (__env_value) {
- long int __converted_value = strtol(__env_value, NULL, 10);
- if (errno || __converted_value < 0) {
- fprintf(stderr, "Bad value for environment variable '%s'.\n", __env_var);
- abort();
- } else {
- return static_cast<size_t>(__converted_value);
- }
- } else {
- return __default_value;
+ while (__f > __log_base)
+ {
+ ++__result;
+ __f /= 10.0;
+ }
+ return __sign * __result;
}
-}
-
-inline void __set_max_stack_trace_depth()
-{
- _GLIBCXX_PROFILE_DATA(_S_max_stack_depth) = __env_to_size_t(
- _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR,
- _GLIBCXX_PROFILE_DATA(_S_max_stack_depth));
-}
-inline void __set_max_mem()
-{
- _GLIBCXX_PROFILE_DATA(_S_max_mem) = __env_to_size_t(
- _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR,
- _GLIBCXX_PROFILE_DATA(_S_max_mem));
-}
-
-inline int __log_magnitude(float __f)
-{
- const float __log_base = 10.0;
- int __result = 0;
- int __sign = 1;
- if (__f < 0) {
- __f = -__f;
- __sign = -1;
- }
- while (__f > __log_base) {
- ++__result;
- __f /= 10.0;
- }
- return __sign * __result;
-}
+ inline FILE*
+ __open_output_file(const char* __extension)
+ {
+ // The path is made of _S_trace_file_name + "." + extension.
+ std::size_t __root_len
+ = __builtin_strlen(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
+ std::size_t __ext_len = __builtin_strlen(__extension);
+ char* __file_name = new char[__root_len + 1 + __ext_len + 1];
+ __builtin_memcpy(__file_name,
+ _GLIBCXX_PROFILE_DATA(_S_trace_file_name),
+ __root_len);
+ *(__file_name + __root_len) = '.';
+ __builtin_memcpy(__file_name + __root_len + 1,
+ __extension, __ext_len + 1);
+
+ FILE* __out_file = std::fopen(__file_name, "w");
+ if (!__out_file)
+ {
+ std::fprintf(stderr, "Could not open trace file '%s'.\n",
+ __file_name);
+ std::abort();
+ }
-inline FILE* __open_output_file(const char* __extension)
-{
- // The path is made of _S_trace_file_name + "." + extension.
- size_t __root_len = strlen(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
- size_t __ext_len = strlen(__extension);
- char* __file_name = new char[__root_len + 1 + __ext_len + 1];
- memcpy(__file_name, _GLIBCXX_PROFILE_DATA(_S_trace_file_name),
- __root_len);
- *(__file_name + __root_len) = '.';
- memcpy(__file_name + __root_len + 1, __extension, __ext_len + 1);
- FILE* __out_file = fopen(__file_name, "w");
- if (__out_file) {
+ delete[] __file_name;
return __out_file;
- } else {
- fprintf(stderr, "Could not open trace file '%s'.\n", __file_name);
- abort();
}
-}
-struct __warn
-{
- FILE* __file;
- __warn(FILE* __f) { __file = __f; }
+ struct __warn
+ {
+ FILE* __file;
- void operator() (const __warning_data& __info)
+ __warn(FILE* __f)
+ { __file = __f; }
+
+ void
+ operator()(const __warning_data& __info)
{
- fprintf(__file, __info.__warning_id);
- fprintf(__file, ": improvement = %d",
- __log_magnitude(__info.__magnitude));
- fprintf(__file, ": call stack = ");
+ std::fprintf(__file, __info.__warning_id);
+ std::fprintf(__file, ": improvement = %d",
+ __log_magnitude(__info.__magnitude));
+ std::fprintf(__file, ": call stack = ");
__gnu_profile::__write(__file, __info.__context);
- fprintf(__file, ": advice = %s\n", __info.__warning_message);
- free(const_cast<void*>
- (reinterpret_cast<const void*>(__info.__warning_message)));
+ std::fprintf(__file, ": advice = %s\n",
+ __info.__warning_message.c_str());
}
-};
-
-/** @brief Final report method, registered with @b atexit.
- *
- * This can also be called directly by user code, including signal handlers.
- * It is protected against deadlocks by the reentrance guard in profiler.h.
- * However, when called from a signal handler that triggers while within
- * __gnu_profile (under the guarded zone), no output will be produced.
- */
-inline void __report(void)
-{
- _GLIBCXX_PROFILE_DATA(__global_lock).lock();
-
- __warning_vector_t __warnings, __top_warnings;
-
- FILE* __raw_file = __open_output_file("raw");
- __trace_vector_size_report(__raw_file, __warnings);
- __trace_hashtable_size_report(__raw_file, __warnings);
- __trace_hash_func_report(__raw_file, __warnings);
- __trace_vector_to_list_report(__raw_file, __warnings);
- __trace_list_to_slist_report(__raw_file, __warnings);
- __trace_list_to_vector_report(__raw_file, __warnings);
- __trace_map_to_unordered_map_report(__raw_file, __warnings);
- fclose(__raw_file);
-
- // Sort data by magnitude, keeping just top N.
- size_t __cutoff = __min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count),
- __warnings.size());
- __top_n(__warnings, __top_warnings, __cutoff);
-
- FILE* __warn_file = __open_output_file("txt");
- __for_each(__top_warnings.begin(), __top_warnings.end(),
- __warn(__warn_file));
- fclose(__warn_file);
-
- _GLIBCXX_PROFILE_DATA(__global_lock).unlock();
-}
-
-inline void __set_trace_path()
-{
- char* __env_trace_file_name = getenv(_GLIBCXX_PROFILE_TRACE_ENV_VAR);
-
- if (__env_trace_file_name) {
- _GLIBCXX_PROFILE_DATA(_S_trace_file_name) = __env_trace_file_name;
+ };
+
+ /** @brief Final report method, registered with @b atexit.
+ *
+ * This can also be called directly by user code, including signal handlers.
+ * It is protected against deadlocks by the reentrance guard in profiler.h.
+ * However, when called from a signal handler that triggers while within
+ * __gnu_profile (under the guarded zone), no output will be produced.
+ */
+ inline void
+ __report(void)
+ {
+ _GLIBCXX_PROFILE_DATA(__global_lock).lock();
+
+ __warning_vector_t __warnings, __top_warnings;
+
+ FILE* __raw_file = __open_output_file("raw");
+ __trace_vector_size_report(__raw_file, __warnings);
+ __trace_hashtable_size_report(__raw_file, __warnings);
+ __trace_hash_func_report(__raw_file, __warnings);
+ __trace_vector_to_list_report(__raw_file, __warnings);
+ __trace_list_to_slist_report(__raw_file, __warnings);
+ __trace_list_to_vector_report(__raw_file, __warnings);
+ __trace_map_to_unordered_map_report(__raw_file, __warnings);
+ std::fclose(__raw_file);
+
+ // Sort data by magnitude, keeping just top N.
+ std::size_t __cutoff = std::min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count),
+ __warnings.size());
+ __top_n(__warnings, __top_warnings, __cutoff);
+
+ FILE* __warn_file = __open_output_file("txt");
+ __for_each(__top_warnings.begin(), __top_warnings.end(),
+ __warn(__warn_file));
+ std::fclose(__warn_file);
+
+ _GLIBCXX_PROFILE_DATA(__global_lock).unlock();
}
- // Make sure early that we can create the trace file.
- fclose(__open_output_file("txt"));
-}
+ inline void
+ __set_trace_path()
+ {
+ char* __env_trace_file_name = std::getenv(_GLIBCXX_PROFILE_TRACE_ENV_VAR);
-inline void __set_max_warn_count()
-{
- char* __env_max_warn_count_str = getenv(
- _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR);
+ if (__env_trace_file_name)
+ _GLIBCXX_PROFILE_DATA(_S_trace_file_name) = __env_trace_file_name;
- if (__env_max_warn_count_str) {
- _GLIBCXX_PROFILE_DATA(_S_max_warn_count) = static_cast<size_t>(
- atoi(__env_max_warn_count_str));
+ // Make sure early that we can create the trace file.
+ std::fclose(__open_output_file("txt"));
}
-}
-inline void
-__read_cost_factors()
-{
- std::string __conf_file_name(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
- __conf_file_name += ".conf";
+ inline void
+ __set_max_warn_count()
+ {
+ char* __env_max_warn_count_str
+ = std::getenv(_GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR);
- std::ifstream __conf_file(__conf_file_name.c_str());
+ if (__env_max_warn_count_str)
+ _GLIBCXX_PROFILE_DATA(_S_max_warn_count)
+ = static_cast<std::size_t>(std::atoi(__env_max_warn_count_str));
+ }
- if (__conf_file.is_open())
- {
- std::string __line;
+ inline void
+ __read_cost_factors()
+ {
+ std::string __conf_file_name(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
+ __conf_file_name += ".conf";
- while (std::getline(__conf_file, __line))
- {
- std::string::size_type __i = __line.find_first_not_of(" \t\n\v");
+ std::ifstream __conf_file(__conf_file_name.c_str());
- if (__line.length() <= 0 || __line[__i] == '#')
- // Skip empty lines or comments.
- continue;
- }
+ if (__conf_file.is_open())
+ {
+ std::string __line;
- // Trim.
- __line.erase(__remove(__line.begin(), __line.end(), ' '), __line.end());
- std::string::size_type __pos = __line.find("=");
- std::string __factor_name = __line.substr(0, __pos);
- std::string::size_type __end = __line.find_first_of(";\n");
- std::string __factor_value = __line.substr(__pos + 1, __end - __pos);
+ while (std::getline(__conf_file, __line))
+ {
+ std::string::size_type __i = __line.find_first_not_of(" \t\n\v");
- _GLIBCXX_PROFILE_DATA(__env)[__factor_name] = __factor_value;
- }
-}
+ if (__line.length() <= 0 || __line[__i] == '#')
+ // Skip empty lines or comments.
+ continue;
+ }
-struct __cost_factor_writer
-{
- FILE* __file;
- __cost_factor_writer(FILE* __f) : __file(__f) {}
- void
- operator() (const __cost_factor* __factor)
- { fprintf(__file, "%s = %f\n", __factor->__env_var, __factor->__value); }
-};
-
-inline void
-__write_cost_factors()
-{
- FILE* __file = __open_output_file("conf.out");
- __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
- _GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
- __cost_factor_writer(__file));
- fclose(__file);
-}
-
-struct __cost_factor_setter
-{
- void operator() (__cost_factor* __factor)
+ // Trim.
+ __line.erase(__remove(__line.begin(), __line.end(), ' '),
+ __line.end());
+ std::string::size_type __pos = __line.find("=");
+ std::string __factor_name = __line.substr(0, __pos);
+ std::string::size_type __end = __line.find_first_of(";\n");
+ std::string __factor_value = __line.substr(__pos + 1, __end - __pos);
+
+ _GLIBCXX_PROFILE_DATA(__env)[__factor_name] = __factor_value;
+ }
+ }
+
+ struct __cost_factor_writer
+ {
+ FILE* __file;
+
+ __cost_factor_writer(FILE* __f)
+ : __file(__f) { }
+
+ void
+ operator() (const __cost_factor* __factor)
+ { std::fprintf(__file, "%s = %f\n", __factor->__env_var,
+ __factor->__value); }
+ };
+
+ inline void
+ __write_cost_factors()
+ {
+ FILE* __file = __open_output_file("conf.out");
+ __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
+ __cost_factor_writer(__file));
+ std::fclose(__file);
+ }
+
+ struct __cost_factor_setter
+ {
+ void
+ operator()(__cost_factor* __factor)
{
// Look it up in the process environment first.
- const char* __env_value = getenv(__factor->__env_var);
+ const char* __env_value = std::getenv(__factor->__env_var);
if (!__env_value)
{
// Look it up in the config file.
- __env_t::iterator it = _GLIBCXX_PROFILE_DATA(__env).find(
- __factor->__env_var);
- if (it != _GLIBCXX_PROFILE_DATA(__env).end())
- __env_value = (*it).second.c_str();
+ __env_t::iterator __it
+ = _GLIBCXX_PROFILE_DATA(__env).find(__factor->__env_var);
+ if (__it != _GLIBCXX_PROFILE_DATA(__env).end())
+ __env_value = (*__it).second.c_str();
}
if (__env_value)
- __factor->__value = atof(__env_value);
+ __factor->__value = std::atof(__env_value);
}
-};
-
-inline void __set_cost_factors()
-{
- _GLIBCXX_PROFILE_DATA(__cost_factors) = new __cost_factor_vector;
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__list_shift_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__list_resize_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__map_find_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__umap_find_cost_factor));
- _GLIBCXX_PROFILE_DATA(__cost_factors)->push_back(
- &_GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor));
- __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
- _GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
- __cost_factor_setter());
-}
-
-inline void __profcxx_init_unconditional()
-{
- _GLIBCXX_PROFILE_DATA(__global_lock).lock();
-
- if (__is_invalid()) {
-
- __set_max_warn_count();
-
- if (_GLIBCXX_PROFILE_DATA(_S_max_warn_count) == 0) {
+ };
- __turn_off();
-
- } else {
-
- __set_max_stack_trace_depth();
- __set_max_mem();
- __set_trace_path();
- __read_cost_factors();
- __set_cost_factors();
- __write_cost_factors();
-
- __trace_vector_size_init();
- __trace_hashtable_size_init();
- __trace_hash_func_init();
- __trace_vector_to_list_init();
- __trace_list_to_slist_init();
- __trace_list_to_vector_init();
- __trace_map_to_unordered_map_init();
-
- atexit(__report);
+ inline void
+ __set_cost_factors()
+ {
+ _GLIBCXX_PROFILE_DATA(__cost_factors) = new __cost_factor_vector;
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__list_shift_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__list_resize_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__map_find_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__umap_find_cost_factor));
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->
+ push_back(&_GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor));
+ __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
+ _GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
+ __cost_factor_setter());
+ }
- __turn_on();
+ inline void
+ __profcxx_init_unconditional()
+ {
+ _GLIBCXX_PROFILE_DATA(__global_lock).lock();
+
+ if (__is_invalid())
+ {
+ __set_max_warn_count();
+
+ if (_GLIBCXX_PROFILE_DATA(_S_max_warn_count) == 0)
+ __turn_off();
+ else
+ {
+ __set_max_stack_trace_depth();
+ __set_max_mem();
+ __set_trace_path();
+ __read_cost_factors();
+ __set_cost_factors();
+ __write_cost_factors();
+
+ __trace_vector_size_init();
+ __trace_hashtable_size_init();
+ __trace_hash_func_init();
+ __trace_vector_to_list_init();
+ __trace_list_to_slist_init();
+ __trace_list_to_vector_init();
+ __trace_map_to_unordered_map_init();
+
+ std::atexit(__report);
+
+ __turn_on();
+ }
+ }
- }
+ _GLIBCXX_PROFILE_DATA(__global_lock).unlock();
}
- _GLIBCXX_PROFILE_DATA(__global_lock).unlock();
-}
+ /** @brief This function must be called by each instrumentation point.
+ *
+ * The common path is inlined fully.
+ */
+ inline bool
+ __profcxx_init()
+ {
+ if (__is_invalid())
+ __profcxx_init_unconditional();
-/** @brief This function must be called by each instrumentation point.
- *
- * The common path is inlined fully.
- */
-inline bool __profcxx_init(void)
-{
- if (__is_invalid()) {
- __profcxx_init_unconditional();
+ return __is_on();
}
- return __is_on();
-}
-
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_TRACE_H */
diff --git a/libstdc++-v3/include/profile/impl/profiler_vector_size.h b/libstdc++-v3/include/profile/impl/profiler_vector_size.h
index 8d630e4d90b..0af384f4ecb 100644
--- a/libstdc++-v3/include/profile/impl/profiler_vector_size.h
+++ b/libstdc++-v3/include/profile/impl/profiler_vector_size.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,15 +37,6 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H
#define _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-#else
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
@@ -54,50 +45,59 @@
namespace __gnu_profile
{
-
-/** @brief Hashtable size instrumentation trace producer. */
-class __trace_vector_size : public __trace_container_size
-{
- public:
- __trace_vector_size() : __trace_container_size() { __id = "vector-size"; }
-};
-
-inline void __trace_vector_size_init()
-{
- _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size();
-}
-
-inline void __trace_vector_size_report(FILE* __f,
- __warning_vector_t& __warnings)
-{
- if (_GLIBCXX_PROFILE_DATA(_S_vector_size)) {
- _GLIBCXX_PROFILE_DATA(_S_vector_size)->__collect_warnings(__warnings);
- _GLIBCXX_PROFILE_DATA(_S_vector_size)->__write(__f);
+ /** @brief Hashtable size instrumentation trace producer. */
+ class __trace_vector_size
+ : public __trace_container_size
+ {
+ public:
+ __trace_vector_size()
+ : __trace_container_size()
+ { __id = "vector-size"; }
+ };
+
+ inline void
+ __trace_vector_size_init()
+ { _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size(); }
+
+ inline void
+ __trace_vector_size_report(FILE* __f, __warning_vector_t& __warnings)
+ {
+ if (_GLIBCXX_PROFILE_DATA(_S_vector_size))
+ {
+ _GLIBCXX_PROFILE_DATA(_S_vector_size)->__collect_warnings(__warnings);
+ _GLIBCXX_PROFILE_DATA(_S_vector_size)->__write(__f);
+ }
}
-}
-inline void __trace_vector_size_construct(const void* __obj, size_t __num)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_vector_size_construct(const void* __obj, std::size_t __num)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_vector_size)->__insert(__obj, __get_stack(), __num);
-}
+ _GLIBCXX_PROFILE_DATA(_S_vector_size)->__insert(__obj, __get_stack(),
+ __num);
+ }
-inline void __trace_vector_size_destruct(const void* __obj, size_t __num,
- size_t __inum)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_vector_size_destruct(const void* __obj, std::size_t __num,
+ std::size_t __inum)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_vector_size)->__destruct(__obj, __num, __inum);
-}
+ _GLIBCXX_PROFILE_DATA(_S_vector_size)->__destruct(__obj, __num, __inum);
+ }
-inline void __trace_vector_size_resize(const void* __obj, size_t __from,
- size_t __to)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_vector_size_resize(const void* __obj, std::size_t __from,
+ std::size_t __to)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_vector_size)->__resize(__obj, __from, __to);
-}
+ _GLIBCXX_PROFILE_DATA(_S_vector_size)->__resize(__obj, __from, __to);
+ }
} // namespace __gnu_profile
diff --git a/libstdc++-v3/include/profile/impl/profiler_vector_to_list.h b/libstdc++-v3/include/profile/impl/profiler_vector_to_list.h
index d4113da8b4e..91963139bd8 100644
--- a/libstdc++-v3/include/profile/impl/profiler_vector_to_list.h
+++ b/libstdc++-v3/include/profile/impl/profiler_vector_to_list.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,300 +37,318 @@
#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H
#define _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H 1
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#else
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#endif
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
-
-/** @brief A vector-to-list instrumentation line in the object table. */
-class __vector2list_info: public __object_info_base
-{
- public:
- __vector2list_info()
- :_M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0),
- _M_vector_cost(0), _M_valid(true) {}
- __vector2list_info(__stack_t __stack)
- : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
- _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true) {}
- virtual ~__vector2list_info() {}
- __vector2list_info(const __vector2list_info& __o);
- void __merge(const __vector2list_info& __o);
- void __write(FILE* __f) const;
- float __magnitude() const { return _M_vector_cost - _M_list_cost; }
- const char* __advice() const
- { return strdup("change std::vector to std::list"); }
-
- size_t __shift_count() { return _M_shift_count; }
- size_t __iterate() { return _M_iterate; }
- float __list_cost() { return _M_list_cost; }
- size_t __resize() { return _M_resize; }
- void __set_list_cost(float __lc) { _M_list_cost = __lc; }
- void __set_vector_cost(float __vc) { _M_vector_cost = __vc; }
- bool __is_valid() { return _M_valid; }
- void __set_invalid() { _M_valid = false; }
-
- void __opr_insert(size_t __pos, size_t __num);
- void __opr_iterate(size_t __num);
- void __resize(size_t __from, size_t __to);
- void __opr_find(size_t __size);
-
-private:
- size_t _M_shift_count;
- size_t _M_iterate;
- size_t _M_resize;
- float _M_list_cost;
- float _M_vector_cost;
- bool _M_valid;
-};
-
-inline __vector2list_info::__vector2list_info(const __vector2list_info& __o)
- : __object_info_base(__o)
-{
- _M_shift_count = __o._M_shift_count;
- _M_iterate = __o._M_iterate;
- _M_vector_cost = __o._M_vector_cost;
- _M_list_cost = __o._M_list_cost;
- _M_valid = __o._M_valid;
- _M_resize = __o._M_resize;
-}
-
-inline void __vector2list_info::__merge(const __vector2list_info& __o)
-{
- _M_shift_count += __o._M_shift_count;
- _M_iterate += __o._M_iterate;
- _M_vector_cost += __o._M_vector_cost;
- _M_list_cost += __o._M_list_cost;
- _M_valid &= __o._M_valid;
- _M_resize += __o._M_resize;
-}
-
-inline void __vector2list_info::__opr_insert(size_t __pos, size_t __num)
-{
- _M_shift_count += __num - __pos;
-}
-
-inline void __vector2list_info::__resize(size_t __from, size_t __to)
-{
- _M_resize += __from;
-}
-
-inline void __vector2list_info::__opr_iterate(size_t __num)
-{
- _M_iterate += __num;
-}
-
-inline void __vector2list_info::__opr_find(size_t __size)
-{
- // Use average case complexity.
- _M_iterate += 3.0 / 4.0 * __size;
-}
-
-/** @brief A vector-to-list instrumentation line in the stack table. */
-class __vector2list_stack_info: public __vector2list_info {
- public:
- __vector2list_stack_info(const __vector2list_info& __o)
- : __vector2list_info(__o) {}
-};
-
-/** @brief Vector-to-list instrumentation producer. */
-class __trace_vector_to_list
- : public __trace_base<__vector2list_info, __vector2list_stack_info>
-{
- public:
- __trace_vector_to_list();
- ~__trace_vector_to_list() {}
-
- // Insert a new node at construct with object, callstack and initial size.
- void __insert(__object_t __obj, __stack_t __stack);
- // Call at destruction/clean to set container final size.
- void __destruct(const void* __obj);
-
- // Find the node in the live map.
- __vector2list_info* __find(const void* __obj);
-
- // Collect cost of operations.
- void __opr_insert(const void* __obj, size_t __pos, size_t __num);
- void __opr_iterate(const void* __obj, size_t __num);
- void __invalid_operator(const void* __obj);
- void __resize(const void* __obj, size_t __from, size_t __to);
- float __vector_cost(size_t __shift, size_t __iterate, size_t __resize);
- float __list_cost(size_t __shift, size_t __iterate, size_t __resize);
- void __opr_find(const void* __obj, size_t __size);
-};
-
-inline __trace_vector_to_list::__trace_vector_to_list()
+ /** @brief A vector-to-list instrumentation line in the object table. */
+ class __vector2list_info
+ : public __object_info_base
+ {
+ public:
+ __vector2list_info()
+ : _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0),
+ _M_vector_cost(0), _M_valid(true) { }
+
+ __vector2list_info(__stack_t __stack)
+ : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
+ _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true) { }
+
+ virtual ~__vector2list_info() { }
+
+ __vector2list_info(const __vector2list_info& __o)
+ : __object_info_base(__o), _M_shift_count(__o._M_shift_count),
+ _M_iterate(__o._M_iterate), _M_resize(__o._M_resize),
+ _M_list_cost(__o._M_list_cost), _M_vector_cost(__o._M_vector_cost),
+ _M_valid(__o._M_valid) { }
+
+ void
+ __merge(const __vector2list_info& __o)
+ {
+ _M_shift_count += __o._M_shift_count;
+ _M_iterate += __o._M_iterate;
+ _M_vector_cost += __o._M_vector_cost;
+ _M_list_cost += __o._M_list_cost;
+ _M_valid &= __o._M_valid;
+ _M_resize += __o._M_resize;
+ }
+
+ void
+ __write(FILE* __f) const
+ {
+ std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
+ _M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
+ }
+
+ float
+ __magnitude() const
+ { return _M_vector_cost - _M_list_cost; }
+
+ std::string
+ __advice() const
+ { return "change std::vector to std::list"; }
+
+ std::size_t
+ __shift_count()
+ { return _M_shift_count; }
+
+ std::size_t
+ __iterate()
+ { return _M_iterate; }
+
+ float
+ __list_cost()
+ { return _M_list_cost; }
+
+ std::size_t
+ __resize()
+ { return _M_resize; }
+
+ void
+ __set_list_cost(float __lc)
+ { _M_list_cost = __lc; }
+
+ void
+ __set_vector_cost(float __vc)
+ { _M_vector_cost = __vc; }
+
+ bool
+ __is_valid()
+ { return _M_valid; }
+
+ void
+ __set_invalid()
+ { _M_valid = false; }
+
+ void
+ __opr_insert(std::size_t __pos, std::size_t __num)
+ { _M_shift_count += __num - __pos; }
+
+ void
+ __opr_iterate(std::size_t __num)
+ { _M_iterate += __num; }
+
+ void
+ __resize(std::size_t __from, std::size_t)
+ { _M_resize += __from; }
+
+ void
+ __opr_find(std::size_t __size)
+ {
+ // Use average case complexity.
+ _M_iterate += 3.0 / 4.0 * __size;
+ }
+
+ private:
+ std::size_t _M_shift_count;
+ std::size_t _M_iterate;
+ std::size_t _M_resize;
+ float _M_list_cost;
+ float _M_vector_cost;
+ bool _M_valid;
+ };
+
+
+ /** @brief A vector-to-list instrumentation line in the stack table. */
+ class __vector2list_stack_info
+ : public __vector2list_info
+ {
+ public:
+ __vector2list_stack_info(const __vector2list_info& __o)
+ : __vector2list_info(__o) { }
+ };
+
+
+ /** @brief Vector-to-list instrumentation producer. */
+ class __trace_vector_to_list
+ : public __trace_base<__vector2list_info, __vector2list_stack_info>
+ {
+ public:
+ __trace_vector_to_list()
: __trace_base<__vector2list_info, __vector2list_stack_info>()
-{
- __id = "vector-to-list";
-}
-
-inline void __trace_vector_to_list::__insert(__object_t __obj,
- __stack_t __stack)
-{
- __add_object(__obj, __vector2list_info(__stack));
-}
-
-inline void __vector2list_info::__write(FILE* __f) const
-{
- fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n",
- _M_shift_count, _M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
-}
-
-inline float __trace_vector_to_list::__vector_cost(size_t __shift,
- size_t __iterate,
- size_t __resize)
-{
- return (
- __shift * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
- + __iterate * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value
- + __resize * _GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor).__value
- );
-}
-
-inline float __trace_vector_to_list::__list_cost(size_t __shift,
- size_t __iterate,
- size_t __resize)
-{
- return (
- __shift * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
- + __iterate * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value
- + __resize * _GLIBCXX_PROFILE_DATA(__list_resize_cost_factor).__value);
-}
-
-inline void __trace_vector_to_list::__destruct(const void* __obj)
-{
- if (!__is_on())
- return;
-
- __vector2list_info* __res = __get_object_info(__obj);
- if (!__res)
- return;
-
- float __vc = __vector_cost(__res->__shift_count(), __res->__iterate(),
- __res->__resize());
- float __lc = __list_cost(__res->__shift_count(), __res->__iterate(),
- __res->__resize());
- __res->__set_vector_cost(__vc);
- __res->__set_list_cost(__lc);
-
- __retire_object(__obj);
-}
-
-inline void __trace_vector_to_list::__opr_insert(const void* __obj,
- size_t __pos, size_t __num)
-{
- __vector2list_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__opr_insert(__pos, __num);
-}
-
-inline void __trace_vector_to_list::__opr_iterate(const void* __obj,
- size_t __num)
-{
- __vector2list_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__opr_iterate(__num);
-}
-
-inline void __trace_vector_to_list::__invalid_operator(const void* __obj)
-{
- __vector2list_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__set_invalid();
-}
-
-inline void __trace_vector_to_list::__resize(const void* __obj, size_t __from,
- size_t __to)
-{
- __vector2list_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__resize(__from, __to);
-}
-
-inline void __trace_vector_to_list::__opr_find(const void* __obj,
- size_t __size)
-{
- __vector2list_info* __res = __get_object_info(__obj);
- if (__res)
- __res->__opr_find(__size);
-}
-
-inline void __trace_vector_to_list_init()
-{
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list) = new __trace_vector_to_list();
-}
-
-inline void __trace_vector_to_list_report(FILE* __f,
- __warning_vector_t& __warnings)
-{
- if (_GLIBCXX_PROFILE_DATA(_S_vector_to_list)) {
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__collect_warnings(__warnings);
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__write(__f);
+ { __id = "vector-to-list"; }
+
+ ~__trace_vector_to_list() { }
+
+ // Insert a new node at construct with object, callstack and initial size.
+ void
+ __insert(__object_t __obj, __stack_t __stack)
+ { __add_object(__obj, __vector2list_info(__stack)); }
+
+ // Call at destruction/clean to set container final size.
+ void
+ __destruct(const void* __obj)
+ {
+ if (!__is_on())
+ return;
+
+ __vector2list_info* __res = __get_object_info(__obj);
+ if (!__res)
+ return;
+
+ float __vc = __vector_cost(__res->__shift_count(), __res->__iterate(),
+ __res->__resize());
+ float __lc = __list_cost(__res->__shift_count(), __res->__iterate(),
+ __res->__resize());
+ __res->__set_vector_cost(__vc);
+ __res->__set_list_cost(__lc);
+
+ __retire_object(__obj);
+ }
+
+ // Find the node in the live map.
+ // XXX Undefined?!?
+ __vector2list_info* __find(const void* __obj);
+
+ // Collect cost of operations.
+ void
+ __opr_insert(const void* __obj, std::size_t __pos, std::size_t __num)
+ {
+ __vector2list_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__opr_insert(__pos, __num);
+ }
+
+ void
+ __opr_iterate(const void* __obj, std::size_t __num)
+ {
+ __vector2list_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__opr_iterate(__num);
+ }
+
+ void
+ __invalid_operator(const void* __obj)
+ {
+ __vector2list_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__set_invalid();
+ }
+
+ void
+ __resize(const void* __obj, std::size_t __from, std::size_t __to)
+ {
+ __vector2list_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__resize(__from, __to);
+ }
+
+ float
+ __vector_cost(std::size_t __shift, std::size_t __iterate,
+ std::size_t __resize)
+ {
+ return (__shift
+ * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
+ + __iterate
+ * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value
+ + __resize
+ * _GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor).__value);
+ }
+
+ float
+ __list_cost(std::size_t __shift, std::size_t __iterate,
+ std::size_t __resize)
+ {
+ return (__shift
+ * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
+ + __iterate
+ * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value
+ + __resize
+ * _GLIBCXX_PROFILE_DATA(__list_resize_cost_factor).__value);
+ }
+
+ void
+ __opr_find(const void* __obj, std::size_t __size)
+ {
+ __vector2list_info* __res = __get_object_info(__obj);
+ if (__res)
+ __res->__opr_find(__size);
+ }
+ };
+
+
+ inline void
+ __trace_vector_to_list_init()
+ { _GLIBCXX_PROFILE_DATA(_S_vector_to_list) = new __trace_vector_to_list(); }
+
+ inline void
+ __trace_vector_to_list_report(FILE* __f, __warning_vector_t& __warnings)
+ {
+ if (_GLIBCXX_PROFILE_DATA(_S_vector_to_list))
+ {
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->
+ __collect_warnings(__warnings);
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__write(__f);
+ }
}
-}
-
-inline void __trace_vector_to_list_construct(const void* __obj)
-{
- if (!__profcxx_init()) return;
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__insert(__obj, __get_stack());
-}
+ inline void
+ __trace_vector_to_list_construct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_vector_to_list_destruct(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__insert(__obj, __get_stack());
+ }
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__destruct(__obj);
-}
+ inline void
+ __trace_vector_to_list_destruct(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
-inline void __trace_vector_to_list_insert(const void* __obj,
- size_t __pos, size_t __num)
-{
- if (!__profcxx_init()) return;
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__destruct(__obj);
+ }
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_insert(__obj, __pos, __num);
-}
+ inline void
+ __trace_vector_to_list_insert(const void* __obj, std::size_t __pos,
+ std::size_t __num)
+ {
+ if (!__profcxx_init())
+ return;
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_insert(__obj, __pos,
+ __num);
+ }
-inline void __trace_vector_to_list_iterate(const void* __obj, size_t __num = 1)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_vector_to_list_iterate(const void* __obj, std::size_t __num = 1)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_iterate(__obj, __num);
-}
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_iterate(__obj, __num);
+ }
-inline void __trace_vector_to_list_invalid_operator(const void* __obj)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_vector_to_list_invalid_operator(const void* __obj)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__invalid_operator(__obj);
-}
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__invalid_operator(__obj);
+ }
-inline void __trace_vector_to_list_resize(const void* __obj,
- size_t __from, size_t __to)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_vector_to_list_resize(const void* __obj, std::size_t __from,
+ std::size_t __to)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__resize(__obj, __from, __to);
-}
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__resize(__obj, __from, __to);
+ }
-inline void __trace_vector_to_list_find(const void* __obj, size_t __size)
-{
- if (!__profcxx_init()) return;
+ inline void
+ __trace_vector_to_list_find(const void* __obj, std::size_t __size)
+ {
+ if (!__profcxx_init())
+ return;
- _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_find(__obj, __size);
-}
+ _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_find(__obj, __size);
+ }
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H */
diff --git a/libstdc++-v3/include/profile/iterator_tracker.h b/libstdc++-v3/include/profile/iterator_tracker.h
index 0febb9babae..faad9e57279 100644
--- a/libstdc++-v3/include/profile/iterator_tracker.h
+++ b/libstdc++-v3/include/profile/iterator_tracker.h
@@ -36,266 +36,239 @@ namespace std
namespace __profile
{
-template<typename _Iterator, typename _Sequence>
-class __iterator_tracker
-{
- typedef __iterator_tracker _Self;
- // The underlying iterator
- _Iterator _M_current;
- // The underlying data structure
- const _Sequence* _M_ds;
- typedef std::iterator_traits<_Iterator> _Traits;
-
- public:
- typedef _Iterator _Base_iterator;
- typedef typename _Traits::iterator_category iterator_category;
- typedef typename _Traits::value_type value_type;
- typedef typename _Traits::difference_type difference_type;
- typedef typename _Traits::reference reference;
- typedef typename _Traits::pointer pointer;
-
- __iterator_tracker() : _M_current(), _M_ds(0) { }
- __iterator_tracker(const _Iterator& __i, const _Sequence* seq)
- : _M_current(__i), _M_ds(seq) { }
- __iterator_tracker(const __iterator_tracker& __x)
- : _M_current(__x._M_current), _M_ds(__x._M_ds) { }
- template<typename _MutableIterator>
- __iterator_tracker(const __iterator_tracker<_MutableIterator, typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator, typename _Sequence::iterator::_Base_iterator>::__value), _Sequence>::__type>& __x)
- : _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { }
-
- _Iterator
- base() const { return _M_current; }
- /**
- * @brief Conversion to underlying non-debug iterator to allow
- * better interaction with non-profile containers.
- */
- operator _Iterator() const { return _M_current; }
-
- pointer
- operator->() const { return &*_M_current; }
-
- __iterator_tracker&
- operator++()
- {
- _M_ds->_M_profile_iterate();
- ++_M_current;
- return *this;
- }
-
- __iterator_tracker&
- operator++(int)
- {
- _M_ds->_M_profile_iterate();
- __iterator_tracker __tmp(*this);
- ++_M_current;
- return __tmp;
- }
-
- __iterator_tracker&
- operator--()
- {
- _M_ds->_M_profile_iterate(1);
- --_M_current;
- return *this;
- }
-
- __iterator_tracker&
- operator--(int)
- {
- _M_ds->_M_profile_iterate(1);
- __iterator_tracker __tmp(*this);
- --_M_current;
- return __tmp;
- }
-
- __iterator_tracker&
- operator=(const __iterator_tracker& __x)
- {
- _M_current = __x._M_current;
- return *this;
- }
-
- reference
- operator*() const
- {
- return *_M_current;
- }
-
- // ------ Random access iterator requirements ------
- reference
- operator[](const difference_type& __n) const
- {
- return _M_current[__n];
- }
-
- __iterator_tracker&
- operator+=(const difference_type& __n)
- {
- _M_current += __n;
- return *this;
- }
-
- __iterator_tracker
- operator+(const difference_type& __n) const
- {
- __iterator_tracker __tmp(*this);
- __tmp += __n;
- return __tmp;
- }
-
- __iterator_tracker&
- operator-=(const difference_type& __n)
- {
- _M_current += -__n;
- return *this;
- }
-
- __iterator_tracker
- operator-(const difference_type& __n) const
- {
- __iterator_tracker __tmp(*this);
- __tmp -= __n;
- return __tmp;
- }
-
- void
- _M_find()
- {
- _M_ds->_M_profile_find();
- }
-
- const _Sequence*
- _M_get_sequence() const
- {
- return static_cast<const _Sequence*>(_M_ds);
- }
-};
-
-template<typename _IteratorL, typename _IteratorR, typename _Sequence>
-inline bool
-operator==(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
- const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
-{
- return __lhs.base() == __rhs.base();
-}
+ template<typename _Iterator, typename _Sequence>
+ class __iterator_tracker
+ {
+ typedef __iterator_tracker _Self;
-template<typename _Iterator, typename _Sequence>
-inline bool
-operator==(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
- const __iterator_tracker<_Iterator, _Sequence>& __rhs)
-{
- return __lhs.base() == __rhs.base();
-}
+ // The underlying iterator
+ _Iterator _M_current;
-template<typename _IteratorL, typename _IteratorR, typename _Sequence>
-inline bool
-operator!=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
- const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
-{
- return __lhs.base() != __rhs.base();
-}
+ // The underlying data structure
+ const _Sequence* _M_ds;
+ typedef std::iterator_traits<_Iterator> _Traits;
-template<typename _Iterator, typename _Sequence>
-inline bool
-operator!=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
- const __iterator_tracker<_Iterator, _Sequence>& __rhs)
-{
- return __lhs.base() != __rhs.base();
-}
+ public:
+ typedef _Iterator _Base_iterator;
+ typedef typename _Traits::iterator_category iterator_category;
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::difference_type difference_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
-template<typename _IteratorL, typename _IteratorR, typename _Sequence>
-inline bool
-operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
- const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
-{
- return __lhs.base() < __rhs.base();
-}
+ __iterator_tracker()
+ : _M_current(), _M_ds(0) { }
-template<typename _Iterator, typename _Sequence>
-inline bool
-operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
- const __iterator_tracker<_Iterator, _Sequence>& __rhs)
-{
- return __lhs.base() < __rhs.base();
-}
+ __iterator_tracker(const _Iterator& __i, const _Sequence* __seq)
+ : _M_current(__i), _M_ds(__seq) { }
-template<typename _IteratorL, typename _IteratorR, typename _Sequence>
-inline bool
-operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
- const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
-{
- return __lhs.base() <= __rhs.base();
-}
+ __iterator_tracker(const __iterator_tracker& __x)
+ : _M_current(__x._M_current), _M_ds(__x._M_ds) { }
-template<typename _Iterator, typename _Sequence>
-inline bool
-operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
- const __iterator_tracker<_Iterator, _Sequence>& __rhs)
-{
- return __lhs.base() <= __rhs.base();
-}
+ template<typename _MutableIterator>
+ __iterator_tracker(const __iterator_tracker<_MutableIterator,
+ typename __gnu_cxx::__enable_if
+ <(std::__are_same<_MutableIterator, typename
+ _Sequence::iterator::_Base_iterator>::__value),
+ _Sequence>::__type>& __x)
+ : _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { }
+
+ _Iterator
+ base() const { return _M_current; }
+
+ /**
+ * @brief Conversion to underlying non-debug iterator to allow
+ * better interaction with non-profile containers.
+ */
+ operator _Iterator() const { return _M_current; }
+
+ pointer
+ operator->() const { return &*_M_current; }
+
+ __iterator_tracker&
+ operator++()
+ {
+ _M_ds->_M_profile_iterate();
+ ++_M_current;
+ return *this;
+ }
+
+ __iterator_tracker&
+ operator++(int)
+ {
+ _M_ds->_M_profile_iterate();
+ __iterator_tracker __tmp(*this);
+ ++_M_current;
+ return __tmp;
+ }
+
+ __iterator_tracker&
+ operator--()
+ {
+ _M_ds->_M_profile_iterate(1);
+ --_M_current;
+ return *this;
+ }
+
+ __iterator_tracker&
+ operator--(int)
+ {
+ _M_ds->_M_profile_iterate(1);
+ __iterator_tracker __tmp(*this);
+ --_M_current;
+ return __tmp;
+ }
+
+ __iterator_tracker&
+ operator=(const __iterator_tracker& __x)
+ {
+ _M_current = __x._M_current;
+ return *this;
+ }
+
+ reference
+ operator*() const
+ { return *_M_current; }
+
+ // ------ Random access iterator requirements ------
+ reference
+ operator[](const difference_type& __n) const
+ { return _M_current[__n]; }
+
+ __iterator_tracker&
+ operator+=(const difference_type& __n)
+ {
+ _M_current += __n;
+ return *this;
+ }
+
+ __iterator_tracker
+ operator+(const difference_type& __n) const
+ {
+ __iterator_tracker __tmp(*this);
+ __tmp += __n;
+ return __tmp;
+ }
+
+ __iterator_tracker&
+ operator-=(const difference_type& __n)
+ {
+ _M_current += -__n;
+ return *this;
+ }
+
+ __iterator_tracker
+ operator-(const difference_type& __n) const
+ {
+ __iterator_tracker __tmp(*this);
+ __tmp -= __n;
+ return __tmp;
+ }
+
+ void
+ _M_find()
+ { _M_ds->_M_profile_find(); }
+
+ const _Sequence*
+ _M_get_sequence() const
+ { return static_cast<const _Sequence*>(_M_ds); }
+ };
-template<typename _IteratorL, typename _IteratorR, typename _Sequence>
-inline bool
-operator>(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
- const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
-{
- return __lhs.base() > __rhs.base();
-}
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator==(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+ const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ { return __lhs.base() == __rhs.base(); }
-template<typename _Iterator, typename _Sequence>
-inline bool
-operator>(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
- const __iterator_tracker<_Iterator, _Sequence>& __rhs)
-{
- return __lhs.base() > __rhs.base();
-}
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator==(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+ const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ { return __lhs.base() == __rhs.base(); }
-template<typename _IteratorL, typename _IteratorR, typename _Sequence>
-inline bool
-operator>=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
- const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
-{
- return __lhs.base() >= __rhs.base();
-}
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator!=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+ const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ { return __lhs.base() != __rhs.base(); }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator!=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+ const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ { return __lhs.base() != __rhs.base(); }
-template<typename _Iterator, typename _Sequence>
-inline bool
-operator>=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
- const __iterator_tracker<_Iterator, _Sequence>& __rhs)
-{
- return __lhs.base() >= __rhs.base();
-}
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+ const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ { return __lhs.base() < __rhs.base(); }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+ const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ { return __lhs.base() < __rhs.base(); }
-// _GLIBCXX_RESOLVE_LIB_DEFECTS
-// According to the resolution of DR179 not only the various comparison
-// operators but also operator- must accept mixed iterator/const_iterator
-// parameters.
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
- inline typename __iterator_tracker<_IteratorL, _Sequence>::difference_type
- operator-(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
- const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
-{
- return __lhs.base() - __rhs.base();
-}
+ inline bool
+ operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+ const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ { return __lhs.base() <= __rhs.base(); }
-template<typename _Iterator, typename _Sequence>
-inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type
-operator-(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
- const __iterator_tracker<_Iterator, _Sequence>& __rhs)
-{
- return __lhs.base() - __rhs.base();
-}
-
-template<typename _Iterator, typename _Sequence>
-inline __iterator_tracker<_Iterator, _Sequence>
-operator+(typename __iterator_tracker<_Iterator,_Sequence>::difference_type
- __n,
- const __iterator_tracker<_Iterator, _Sequence>& __i)
-{
- return __i + __n;
-}
-
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+ const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ { return __lhs.base() <= __rhs.base(); }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator>(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+ const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ { return __lhs.base() > __rhs.base(); }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator>(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+ const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ { return __lhs.base() > __rhs.base(); }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator>=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+ const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ { return __lhs.base() >= __rhs.base(); }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator>=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+ const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ { return __lhs.base() >= __rhs.base(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR179 not only the various comparison
+ // operators but also operator- must accept mixed iterator/const_iterator
+ // parameters.
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline typename __iterator_tracker<_IteratorL, _Sequence>::difference_type
+ operator-(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+ const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ { return __lhs.base() - __rhs.base(); }
+
+ template<typename _Iterator, typename _Sequence>
+ inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type
+ operator-(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+ const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ { return __lhs.base() - __rhs.base(); }
+
+ template<typename _Iterator, typename _Sequence>
+ inline __iterator_tracker<_Iterator, _Sequence>
+ operator+(typename __iterator_tracker<_Iterator,_Sequence>::difference_type
+ __n,
+ const __iterator_tracker<_Iterator, _Sequence>& __i)
+ { return __i + __n; }
+
} // namespace __profile
} // namespace std
#endif
diff --git a/libstdc++-v3/include/profile/list b/libstdc++-v3/include/profile/list
index 01edd2919f6..e5468c44071 100644
--- a/libstdc++-v3/include/profile/list
+++ b/libstdc++-v3/include/profile/list
@@ -64,20 +64,40 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.2.1 construct/copy/destroy:
- explicit list(const _Allocator& __a = _Allocator())
+ explicit
+ list(const _Allocator& __a = _Allocator())
: _Base(__a)
{
__profcxx_list_construct(this); // list2slist
__profcxx_list_construct2(this); // list2vector
}
- explicit list(size_type __n, const _Tp& __value = _Tp(),
- const _Allocator& __a = _Allocator())
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ list(size_type __n)
+ : _Base(__n)
+ {
+ __profcxx_list_construct(this);
+ __profcxx_list_construct2(this);
+ }
+
+ list(size_type __n, const _Tp& __value,
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a)
+ {
+ __profcxx_list_construct(this);
+ __profcxx_list_construct2(this);
+ }
+#else
+ explicit
+ list(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a)
{
__profcxx_list_construct(this);
__profcxx_list_construct2(this);
}
+#endif
template<class _InputIterator>
list(_InputIterator __first, _InputIterator __last,
@@ -229,9 +249,19 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
using _Base::size;
using _Base::max_size;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ resize(size_type __sz)
+ { _Base::resize(__sz); }
+
+ void
+ resize(size_type __sz, const _Tp& __c)
+ { _Base::resize(__sz, __c); }
+#else
void
resize(size_type __sz, _Tp __c = _Tp())
{ _Base::resize(__sz, __c); }
+#endif
// element access:
reference
diff --git a/libstdc++-v3/include/profile/map.h b/libstdc++-v3/include/profile/map.h
index fc698a9fa84..8a3a8e45c8f 100644
--- a/libstdc++-v3/include/profile/map.h
+++ b/libstdc++-v3/include/profile/map.h
@@ -71,29 +71,26 @@ namespace __profile
using _Base::value_compare;
// 23.3.1.1 construct/copy/destroy:
- explicit map(const _Compare& __comp = _Compare(),
- const _Allocator& __a = _Allocator())
- : _Base(__comp, __a) {
- __profcxx_map_to_unordered_map_construct(this);
- }
+ explicit
+ map(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a)
+ { __profcxx_map_to_unordered_map_construct(this); }
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
- : _Base(__first, __last, __comp, __a) {
- __profcxx_map_to_unordered_map_construct(this);
- }
+ : _Base(__first, __last, __comp, __a)
+ { __profcxx_map_to_unordered_map_construct(this); }
map(const map& __x)
- : _Base(__x) {
- __profcxx_map_to_unordered_map_construct(this);
- }
+ : _Base(__x)
+ { __profcxx_map_to_unordered_map_construct(this); }
map(const _Base& __x)
- : _Base(__x) {
- __profcxx_map_to_unordered_map_construct(this);
- }
+ : _Base(__x)
+ { __profcxx_map_to_unordered_map_construct(this); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
map(map&& __x)
@@ -106,9 +103,8 @@ namespace __profile
: _Base(__l, __c, __a) { }
#endif
- ~map() {
- __profcxx_map_to_unordered_map_destruct(this);
- }
+ ~map()
+ { __profcxx_map_to_unordered_map_destruct(this); }
map&
operator=(const map& __x)
diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector
index ad74137583c..e6c32a38aec 100644
--- a/libstdc++-v3/include/profile/vector
+++ b/libstdc++-v3/include/profile/vector
@@ -76,20 +76,40 @@ namespace __profile
_M_base() const { return *this; }
// 23.2.4.1 construct/copy/destroy:
- explicit vector(const _Allocator& __a = _Allocator())
+ explicit
+ vector(const _Allocator& __a = _Allocator())
: _Base(__a)
{
__profcxx_vector_construct(this, this->capacity());
__profcxx_vector_construct2(this);
}
- explicit vector(size_type __n, const _Tp& __value = _Tp(),
- const _Allocator& __a = _Allocator())
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ vector(size_type __n)
+ : _Base(__n)
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ __profcxx_vector_construct2(this);
+ }
+
+ vector(size_type __n, const _Tp& __value,
+ const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a)
{
__profcxx_vector_construct(this, this->capacity());
__profcxx_vector_construct2(this);
}
+#else
+ explicit
+ vector(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a)
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ __profcxx_vector_construct2(this);
+ }
+#endif
template<class _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
@@ -218,6 +238,23 @@ namespace __profile
using _Base::size;
using _Base::max_size;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ resize(size_type __sz)
+ {
+ __profcxx_vector_invalid_operator(this);
+ _M_profile_resize(this, this->capacity(), __sz);
+ _Base::resize(__sz);
+ }
+
+ void
+ resize(size_type __sz, const _Tp& __c)
+ {
+ __profcxx_vector_invalid_operator(this);
+ _M_profile_resize(this, this->capacity(), __sz);
+ _Base::resize(__sz, __c);
+ }
+#else
void
resize(size_type __sz, _Tp __c = _Tp())
{
@@ -225,6 +262,7 @@ namespace __profile
_M_profile_resize(this, this->capacity(), __sz);
_Base::resize(__sz, __c);
}
+#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
using _Base::shrink_to_fit;
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 5ef52f3763f..d4f685ced54 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -38,8 +38,8 @@
# include <bits/c++0x_warning.h>
#endif
+#include <bits/c++config.h>
#include <bits/atomic_base.h>
-#include <cstddef>
_GLIBCXX_BEGIN_NAMESPACE(std)
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index b23b51a78fe..32ca0917062 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -45,7 +45,6 @@
#pragma GCC system_header
-#include <cstddef> // For size_t
#include <string>
#include <bits/functexcept.h> // For invalid_argument, out_of_range,
// overflow_error
diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream
index 9aa4f1ab10f..00690bee938 100644
--- a/libstdc++-v3/include/std/fstream
+++ b/libstdc++-v3/include/std/fstream
@@ -397,7 +397,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (__testout && __off == 0 && _M_buf_size > 1 )
this->setp(_M_buf, _M_buf + _M_buf_size - 1);
else
- this->setp(NULL, NULL);
+ this->setp(0, 0);
}
};
@@ -795,7 +795,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
explicit
basic_fstream(const char* __s,
ios_base::openmode __mode = ios_base::in | ios_base::out)
- : __iostream_type(NULL), _M_filebuf()
+ : __iostream_type(0), _M_filebuf()
{
this->init(&_M_filebuf);
this->open(__s, __mode);
@@ -810,7 +810,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
explicit
basic_fstream(const std::string& __s,
ios_base::openmode __mode = ios_base::in | ios_base::out)
- : __iostream_type(NULL), _M_filebuf()
+ : __iostream_type(0), _M_filebuf()
{
this->init(&_M_filebuf);
this->open(__s, __mode);
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index b6cc6d5e072..752e78325a3 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1384,13 +1384,6 @@ namespace std
class bad_function_call : public std::exception { };
/**
- * The integral constant expression 0 can be converted into a
- * pointer to this type. It is used by the function template to
- * accept NULL pointers.
- */
- struct _M_clear_type;
-
- /**
* Trait identifying "location-invariant" types, meaning that the
* address of the object (or any of its members) will not escape.
* Also implies a trivial copy constructor and assignment operator.
@@ -1797,10 +1790,10 @@ namespace std
function() : _Function_base() { }
/**
- * @brief Default construct creates an empty function call wrapper.
+ * @brief Creates an empty function call wrapper.
* @post @c !(bool)*this
*/
- function(_M_clear_type*) : _Function_base() { }
+ function(nullptr_t) : _Function_base() { }
/**
* @brief %Function copy constructor.
@@ -1893,7 +1886,7 @@ namespace std
* The target of @c *this is deallocated, leaving it empty.
*/
function&
- operator=(_M_clear_type*)
+ operator=(nullptr_t)
{
if (_M_manager)
{
@@ -2139,13 +2132,13 @@ namespace std
*/
template<typename _Res, typename... _Args>
inline bool
- operator==(const function<_Res(_Args...)>& __f, _M_clear_type*)
+ operator==(const function<_Res(_Args...)>& __f, nullptr_t)
{ return !static_cast<bool>(__f); }
/// @overload
template<typename _Res, typename... _Args>
inline bool
- operator==(_M_clear_type*, const function<_Res(_Args...)>& __f)
+ operator==(nullptr_t, const function<_Res(_Args...)>& __f)
{ return !static_cast<bool>(__f); }
/**
@@ -2157,13 +2150,13 @@ namespace std
*/
template<typename _Res, typename... _Args>
inline bool
- operator!=(const function<_Res(_Args...)>& __f, _M_clear_type*)
+ operator!=(const function<_Res(_Args...)>& __f, nullptr_t)
{ return static_cast<bool>(__f); }
/// @overload
template<typename _Res, typename... _Args>
inline bool
- operator!=(_M_clear_type*, const function<_Res(_Args...)>& __f)
+ operator!=(nullptr_t, const function<_Res(_Args...)>& __f)
{ return static_cast<bool>(__f); }
// [20.7.15.2.7] specialized algorithms
diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator
index a15bdf9744c..5395106ae6a 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -1,6 +1,6 @@
// <iterator> -*- C++ -*-
-// Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -58,7 +58,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#include <bits/stl_iterator.h>
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index be435cd38e5..b236f0db91d 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -37,7 +37,6 @@
#else
#include <tuple>
-#include <cstddef>
#include <chrono>
#include <exception>
#include <type_traits>
diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex
index e8238299b22..95ad4239459 100644
--- a/libstdc++-v3/include/std/regex
+++ b/libstdc++-v3/include/std/regex
@@ -35,33 +35,30 @@
# include <bits/c++0x_warning.h>
#else
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-#endif
-
#include <algorithm>
#include <bitset>
+#include <functional>
+#ifdef _GLIBCXX_DEBUG
+# include <iosfwd>
+#endif
#include <iterator>
#include <locale>
+#include <memory>
+#include <set>
+#include <sstream>
+#include <stack>
#include <stdexcept>
#include <string>
-#include <vector>
#include <utility>
-#include <sstream>
+#include <vector>
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# include <tr1_impl/regex>
-#else
-# define _GLIBCXX_INCLUDE_AS_CXX0X
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-# define _GLIBCXX_TR1
-# include <tr1_impl/regex>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_END_NAMESPACE_TR1
-# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-# undef _GLIBCXX_INCLUDE_AS_CXX0X
-#endif
+#include <bits/regex_constants.h>
+#include <bits/regex_error.h>
+#include <bits/regex_cursor.h>
+#include <bits/regex_nfa.h>
+#include <bits/regex_compiler.h>
+#include <bits/regex_grep_matcher.h>
+#include <bits/regex.h>
#endif // __GXX_EXPERIMENTAL_CXX0X__
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 470f2c0f35c..c348c76bc40 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -40,7 +40,6 @@
#include <memory>
#include <mutex>
#include <condition_variable>
-#include <cstddef>
#include <bits/functexcept.h>
#include <bits/functional_hash.h>
#include <bits/gthr.h>
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index f9aa14f2057..8b2252e3686 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -238,8 +238,7 @@ namespace std
tuple(_UElements&&... __elements)
: _Inherited(std::forward<_UElements>(__elements)...) { }
- tuple(const tuple& __in)
- : _Inherited(static_cast<const _Inherited&>(__in)) { }
+ tuple(const tuple&) = default;
tuple(tuple&& __in)
: _Inherited(static_cast<_Inherited&&>(__in)) { }
@@ -321,8 +320,7 @@ namespace std
tuple(_U1&& __a1, _U2&& __a2)
: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
- tuple(const tuple& __in)
- : _Inherited(static_cast<const _Inherited&>(__in)) { }
+ tuple(const tuple&) = default;
tuple(tuple&& __in)
: _Inherited(static_cast<_Inherited&&>(__in)) { }
@@ -341,7 +339,8 @@ namespace std
template<typename _U1, typename _U2>
tuple(pair<_U1, _U2>&& __in)
- : _Inherited(std::move(__in.first), std::move(__in.second)) { }
+ : _Inherited(std::forward<_U1>(__in.first),
+ std::forward<_U2>(__in.second)) { }
tuple&
operator=(const tuple& __in)
@@ -690,16 +689,12 @@ namespace std
struct _Swallow_assign
{
template<class _Tp>
- _Swallow_assign&
- operator=(const _Tp&)
+ const _Swallow_assign&
+ operator=(const _Tp&) const
{ return *this; }
};
- // TODO: Put this in some kind of shared file.
- namespace
- {
- _Swallow_assign ignore;
- }; // anonymous namespace
+ const _Swallow_assign ignore{};
/**
* Stores a tuple of indices. Used by bind() to extract the elements
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 9831851c4a5..42a462e53a5 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -39,7 +39,7 @@
# error C++0x header cannot be included from TR1 header
#endif
-#include <cstddef>
+#include <bits/c++config.h>
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/type_traits>
@@ -193,7 +193,7 @@ namespace std
{ };
template<typename _Tp>
- typename add_rvalue_reference<_Tp>::type declval();
+ typename add_rvalue_reference<_Tp>::type declval() noexcept;
template<typename _Tp, typename... _Args>
class __is_constructible_helper
@@ -234,6 +234,28 @@ namespace std
_Args...>::__value>
{ };
+ template<bool, typename _Tp, typename... _Args>
+ struct __is_nt_constructible_helper
+ { static const bool __value = false; };
+
+ template<typename _Tp, typename... _Args>
+ struct __is_nt_constructible_helper<true, _Tp, _Args...>
+ { static const bool __value = noexcept(_Tp(declval<_Args>()...)); };
+
+ template<typename _Tp, typename _Arg>
+ struct __is_nt_constructible_helper<true, _Tp, _Arg>
+ {
+ static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>()));
+ };
+
+ /// is_nothrow_constructible
+ template<typename _Tp, typename... _Args>
+ struct is_nothrow_constructible
+ : public integral_constant<bool,
+ __is_nt_constructible_helper<is_constructible<_Tp, _Args...>::value,
+ _Tp, _Args...>::__value>
+ { };
+
/// has_trivial_default_constructor
template<typename _Tp>
struct has_trivial_default_constructor
@@ -246,9 +268,9 @@ namespace std
: public integral_constant<bool, __has_trivial_copy(_Tp)>
{ };
- /// has_trivial_assign
+ /// has_trivial_copy_assign
template<typename _Tp>
- struct has_trivial_assign
+ struct has_trivial_copy_assign
: public integral_constant<bool, __has_trivial_assign(_Tp)>
{ };
@@ -270,9 +292,9 @@ namespace std
: public integral_constant<bool, __has_nothrow_copy(_Tp)>
{ };
- /// has_nothrow_assign
+ /// has_nothrow_copy_assign
template<typename _Tp>
- struct has_nothrow_assign
+ struct has_nothrow_copy_assign
: public integral_constant<bool, __has_nothrow_assign(_Tp)>
{ };
@@ -649,7 +671,7 @@ namespace std
template<typename _Tp>
inline typename add_rvalue_reference<_Tp>::type
- declval()
+ declval() noexcept
{
static_assert(__declval_protector<_Tp>::__stop,
"declval() must not be used!");
diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray
index fa92751791d..f15ac92b0bf 100644
--- a/libstdc++-v3/include/std/valarray
+++ b/libstdc++-v3/include/std/valarray
@@ -1,7 +1,7 @@
// The template and inlines for the -*- C++ -*- valarray class.
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009
+// 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -36,7 +36,6 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <cstddef>
#include <cmath>
#include <algorithm>
#include <debug/debug.h>
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index fe28f84785a..33083ff9c73 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -1,6 +1,7 @@
// TR1 type_traits -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -35,7 +36,7 @@
# error TR1 header cannot be included from C++0x header
#endif
-#include <cstddef>
+#include <bits/c++config.h>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/type_traits>
diff --git a/libstdc++-v3/libsupc++/eh_arm.cc b/libstdc++-v3/libsupc++/eh_arm.cc
index 58997cc1768..e508ada9e09 100644
--- a/libstdc++-v3/libsupc++/eh_arm.cc
+++ b/libstdc++-v3/libsupc++/eh_arm.cc
@@ -157,22 +157,26 @@ __gnu_end_cleanup(void)
// Assembly wrapper to call __gnu_end_cleanup without clobbering r1-r3.
// Also push r4 to preserve stack alignment.
#ifdef __thumb__
-asm (".global __cxa_end_cleanup\n"
+asm (" .pushsection .text.__cxa_end_cleanup\n"
+" .global __cxa_end_cleanup\n"
" .type __cxa_end_cleanup, \"function\"\n"
" .thumb_func\n"
"__cxa_end_cleanup:\n"
" push\t{r1, r2, r3, r4}\n"
" bl\t__gnu_end_cleanup\n"
" pop\t{r1, r2, r3, r4}\n"
-" bl\t_Unwind_Resume @ Never returns\n");
+" bl\t_Unwind_Resume @ Never returns\n"
+" .popsection\n");
#else
-asm (".global __cxa_end_cleanup\n"
+asm (" .pushsection .text.__cxa_end_cleanup\n"
+" .global __cxa_end_cleanup\n"
" .type __cxa_end_cleanup, \"function\"\n"
"__cxa_end_cleanup:\n"
" stmfd\tsp!, {r1, r2, r3, r4}\n"
" bl\t__gnu_end_cleanup\n"
" ldmfd\tsp!, {r1, r2, r3, r4}\n"
-" bl\t_Unwind_Resume @ Never returns\n");
+" bl\t_Unwind_Resume @ Never returns\n"
+" .popsection\n");
#endif
#endif
diff --git a/libstdc++-v3/libsupc++/eh_ptr.cc b/libstdc++-v3/libsupc++/eh_ptr.cc
index 8a0167d7510..abe59a214be 100644
--- a/libstdc++-v3/libsupc++/eh_ptr.cc
+++ b/libstdc++-v3/libsupc++/eh_ptr.cc
@@ -102,10 +102,6 @@ std::__exception_ptr::exception_ptr::_M_get() const throw()
void
-std::__exception_ptr::exception_ptr::_M_safe_bool_dummy() throw () { }
-
-
-void
std::__exception_ptr::exception_ptr::swap(exception_ptr &other) throw()
{
void *tmp = _M_exception_object;
@@ -115,6 +111,11 @@ std::__exception_ptr::exception_ptr::swap(exception_ptr &other) throw()
// Retained for compatibility with CXXABI_1.3.
+void
+std::__exception_ptr::exception_ptr::_M_safe_bool_dummy() throw () { }
+
+
+// Retained for compatibility with CXXABI_1.3.
bool
std::__exception_ptr::exception_ptr::operator!() const throw()
{ return _M_exception_object == 0; }
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index f3f0819b1c6..4ccb4fb2d6e 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -81,25 +81,27 @@ namespace std
void *_M_get() const throw() __attribute__ ((__pure__));
- void _M_safe_bool_dummy() throw() __attribute__ ((__const__));
-
friend exception_ptr std::current_exception() throw();
friend void std::rethrow_exception(exception_ptr);
public:
exception_ptr() throw();
- typedef void (exception_ptr::*__safe_bool)();
-
- // For construction from nullptr or 0.
- exception_ptr(__safe_bool) throw();
-
exception_ptr(const exception_ptr&) throw();
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ exception_ptr(nullptr_t) throw()
+ : _M_exception_object(0)
+ { }
+
exception_ptr(exception_ptr&& __o) throw()
: _M_exception_object(__o._M_exception_object)
{ __o._M_exception_object = 0; }
+#else
+ typedef void (exception_ptr::*__safe_bool)();
+
+ // For construction from nullptr or 0.
+ exception_ptr(__safe_bool) throw();
#endif
exception_ptr&
@@ -121,10 +123,16 @@ namespace std
#ifdef _GLIBCXX_EH_PTR_COMPAT
// Retained for compatibility with CXXABI_1.3.
+ void _M_safe_bool_dummy() throw() __attribute__ ((__const__));
bool operator!() const throw() __attribute__ ((__pure__));
operator __safe_bool() const throw();
#endif
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit operator bool() const
+ { return _M_exception_object; }
+#endif
+
friend bool
operator==(const exception_ptr&, const exception_ptr&) throw()
__attribute__ ((__pure__));
@@ -140,6 +148,11 @@ namespace std
bool
operator!=(const exception_ptr&, const exception_ptr&) throw()
__attribute__ ((__pure__));
+
+ inline void
+ swap(exception_ptr& __lhs, exception_ptr& __rhs)
+ { __lhs.swap(__rhs); }
+
} // namespace __exception_ptr
diff --git a/libstdc++-v3/libsupc++/initializer_list b/libstdc++-v3/libsupc++/initializer_list
index 3810706d47e..f4a8f864259 100644
--- a/libstdc++-v3/libsupc++/initializer_list
+++ b/libstdc++-v3/libsupc++/initializer_list
@@ -36,7 +36,7 @@
#pragma GCC visibility push(default)
-#include <cstddef>
+#include <bits/c++config.h>
namespace std
{
@@ -61,7 +61,7 @@ namespace std
: _M_array(__a), _M_len(__l) { }
public:
- initializer_list() : _M_array(NULL), _M_len(0) { }
+ initializer_list() : _M_array(0), _M_len(0) { }
// Number of elements.
size_type
diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new
index 7b515311cab..80ee3ba0fd8 100644
--- a/libstdc++-v3/libsupc++/new
+++ b/libstdc++-v3/libsupc++/new
@@ -38,7 +38,7 @@
#pragma GCC system_header
-#include <cstddef>
+#include <bits/c++config.h>
#include <exception>
#pragma GCC visibility push(default)
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index baa0824856b..0533deaf158 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import gdb
+#import gdb
import itertools
import re
@@ -77,6 +77,7 @@ class StdListPrinter:
elif self.typename == "std::__debug::list":
nodetype = gdb.lookup_type('std::__norm::_List_node<%s>' % itype).pointer()
else:
+ #raise ValueError, "Cannot cast list node for list printer."
raise "Cannot cast list node for list printer."
return self._iterator(nodetype, self.val['_M_impl']['_M_node'])
@@ -101,7 +102,7 @@ class StdListIteratorPrinter:
elif self.typename == "std::__norm::_List_iterator" or self.typename == "std::__norm::_List_const_iterator":
nodetype = gdb.lookup_type('std::__norm::_List_node<%s>' % itype).pointer()
else:
- raise "Cannot cast list node for list iterator printer."
+ raise ValueError, "Cannot cast list node for list iterator printer."
return self.val['_M_node'].cast(nodetype).dereference()['_M_data']
class StdSlistPrinter:
@@ -208,7 +209,7 @@ class StdTuplePrinter:
# tuple.
nodes = self.head.type.fields ()
if len (nodes) != 1:
- raise "Top of tuple tree does not consist of a single node."
+ raise ValueError, "Top of tuple tree does not consist of a single node."
# Set the actual head to the first pair.
self.head = self.head.cast (nodes[0].type)
@@ -224,7 +225,7 @@ class StdTuplePrinter:
raise StopIteration
# Check that this iteration has an expected structure.
if len (nodes) != 2:
- raise "Cannot parse more than 2 nodes in a tuple tree."
+ raise ValueError, "Cannot parse more than 2 nodes in a tuple tree."
# - Left node is the next recursion parent.
# - Right node is the actual class contained in the tuple.
diff --git a/libstdc++-v3/src/chrono.cc b/libstdc++-v3/src/chrono.cc
index 422b97399ac..6d7a64d0080 100644
--- a/libstdc++-v3/src/chrono.cc
+++ b/libstdc++-v3/src/chrono.cc
@@ -1,6 +1,6 @@
// chrono -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -51,7 +51,7 @@ namespace std
#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
timeval tv;
// EINVAL, EFAULT
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, 0);
return time_point(duration(chrono::seconds(tv.tv_sec)
+ chrono::microseconds(tv.tv_usec)));
#else
diff --git a/libstdc++-v3/src/compatibility.cc b/libstdc++-v3/src/compatibility.cc
index dceebe1174c..ccbeaa1b2ba 100644
--- a/libstdc++-v3/src/compatibility.cc
+++ b/libstdc++-v3/src/compatibility.cc
@@ -410,7 +410,11 @@ GLIBCXX_3.4)
// gcc-4.1.0
// Long double versions of "C" math functions.
#if defined (_GLIBCXX_LONG_DOUBLE_COMPAT) \
- || (defined (__hppa__) && defined (__linux__))
+ || (defined (__arm__) && defined (__linux__) && defined (__ARM_EABI__)) \
+ || (defined (__hppa__) && defined (__linux__)) \
+ || (defined (__m68k__) && defined (__mcoldfire__) && defined (__linux__)) \
+ || (defined (__mips__) && defined (_ABIO32) && defined (__linux__)) \
+ || (defined (__sh__) && defined (__linux__) && __SIZEOF_SIZE_T__ == 4) \
#define _GLIBCXX_MATHL_WRAPPER(name, argdecl, args, ver) \
extern "C" double \
diff --git a/libstdc++-v3/src/condition_variable.cc b/libstdc++-v3/src/condition_variable.cc
index fdcb6a04b38..d3f29f657f4 100644
--- a/libstdc++-v3/src/condition_variable.cc
+++ b/libstdc++-v3/src/condition_variable.cc
@@ -1,6 +1,6 @@
// condition_variable -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,7 +34,7 @@ namespace std
__native_type __tmp = __GTHREAD_COND_INIT;
_M_cond = __tmp;
#else
- int __e = __gthread_cond_init(&_M_cond, NULL);
+ int __e = __gthread_cond_init(&_M_cond, 0);
if (__e)
__throw_system_error(__e);
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
index 5ee8258ccb8..1dc1d6891c6 100644
--- a/libstdc++-v3/src/localename.cc
+++ b/libstdc++-v3/src/localename.cc
@@ -137,7 +137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
}
else
- __throw_runtime_error(__N("locale::locale NULL not valid"));
+ __throw_runtime_error(__N("locale::locale null not valid"));
}
locale::locale(const locale& __base, const char* __s, category __cat)
diff --git a/libstdc++-v3/src/mt_allocator.cc b/libstdc++-v3/src/mt_allocator.cc
index 9c3af0e60d5..b04fe5b05e4 100644
--- a/libstdc++-v3/src/mt_allocator.cc
+++ b/libstdc++-v3/src/mt_allocator.cc
@@ -1,6 +1,6 @@
// Allocator details.
-// Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -150,7 +150,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__block->_M_next = reinterpret_cast<_Block_record*>(__c);
__block = __block->_M_next;
}
- __block->_M_next = NULL;
+ __block->_M_next = 0;
__block = __bin._M_first[__thread_id];
__bin._M_first[__thread_id] = __block->_M_next;
@@ -206,8 +206,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_Bin_record& __bin = _M_bin[__n];
__v = ::operator new(sizeof(_Block_record*));
__bin._M_first = static_cast<_Block_record**>(__v);
- __bin._M_first[0] = NULL;
- __bin._M_address = NULL;
+ __bin._M_first[0] = 0;
+ __bin._M_address = 0;
}
_M_init = true;
}
@@ -362,7 +362,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// blocks on global list (and if not add new ones) and
// get the first one.
_Bin_record& __bin = _M_bin[__which];
- _Block_record* __block = NULL;
+ _Block_record* __block = 0;
if (__gthread_active_p())
{
// Resync the _M_used counters.
@@ -374,7 +374,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__atomic_add(&__reclaimed_base[__thread_id], -__reclaimed);
__gthread_mutex_lock(__bin._M_mutex);
- if (__bin._M_first[0] == NULL)
+ if (__bin._M_first[0] == 0)
{
void* __v = ::operator new(__options._M_chunk_size);
_Block_address* __address = static_cast<_Block_address*>(__v);
@@ -395,7 +395,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__block->_M_next = reinterpret_cast<_Block_record*>(__c);
__block = __block->_M_next;
}
- __block->_M_next = NULL;
+ __block->_M_next = 0;
}
else
{
@@ -407,7 +407,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{
__bin._M_free[__thread_id] = __bin._M_free[0];
__bin._M_free[0] = 0;
- __bin._M_first[0] = NULL;
+ __bin._M_first[0] = 0;
}
else
{
@@ -417,7 +417,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
while (--__block_count > 0)
__block = __block->_M_next;
__bin._M_first[0] = __block->_M_next;
- __block->_M_next = NULL;
+ __block->_M_next = 0;
}
__gthread_mutex_unlock(__bin._M_mutex);
}
@@ -439,7 +439,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__block->_M_next = reinterpret_cast<_Block_record*>(__c);
__block = __block->_M_next;
}
- __block->_M_next = NULL;
+ __block->_M_next = 0;
}
__block = __bin._M_first[__thread_id];
@@ -527,7 +527,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
// Set last record.
- _M_thread_freelist[__i - 1]._M_next = NULL;
+ _M_thread_freelist[__i - 1]._M_next = 0;
_M_thread_freelist[__i - 1]._M_id = __i;
if (!freelist._M_thread_freelist_array)
@@ -572,7 +572,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
std::memset(__v, 0, sizeof(_Block_record*) * __max_threads);
__bin._M_first = static_cast<_Block_record**>(__v);
- __bin._M_address = NULL;
+ __bin._M_address = 0;
__v = ::operator new(sizeof(size_t) * __max_threads);
std::memset(__v, 0, sizeof(size_t) * __max_threads);
@@ -606,8 +606,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_Bin_record& __bin = _M_bin[__n];
__v = ::operator new(sizeof(_Block_record*));
__bin._M_first = static_cast<_Block_record**>(__v);
- __bin._M_first[0] = NULL;
- __bin._M_address = NULL;
+ __bin._M_first[0] = 0;
+ __bin._M_address = 0;
}
}
_M_init = true;
@@ -722,7 +722,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
// Set last record.
- _M_thread_freelist[__i - 1]._M_next = NULL;
+ _M_thread_freelist[__i - 1]._M_next = 0;
_M_thread_freelist[__i - 1]._M_id = __i;
if (!freelist._M_thread_freelist_array)
@@ -767,7 +767,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
std::memset(__v, 0, sizeof(_Block_record*) * __max_threads);
__bin._M_first = static_cast<_Block_record**>(__v);
- __bin._M_address = NULL;
+ __bin._M_address = 0;
__v = ::operator new(sizeof(size_t) * __max_threads);
std::memset(__v, 0, sizeof(size_t) * __max_threads);
@@ -800,8 +800,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_Bin_record& __bin = _M_bin[__n];
__v = ::operator new(sizeof(_Block_record*));
__bin._M_first = static_cast<_Block_record**>(__v);
- __bin._M_first[0] = NULL;
- __bin._M_address = NULL;
+ __bin._M_first[0] = 0;
+ __bin._M_address = 0;
}
}
_M_init = true;
diff --git a/libstdc++-v3/src/thread.cc b/libstdc++-v3/src/thread.cc
index 879e864edd4..2ea6a490735 100644
--- a/libstdc++-v3/src/thread.cc
+++ b/libstdc++-v3/src/thread.cc
@@ -1,6 +1,6 @@
// thread -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -58,7 +58,7 @@ namespace std
int __e = EINVAL;
if (_M_id != id())
- __e = __gthread_join(_M_id._M_thread, NULL);
+ __e = __gthread_join(_M_id._M_thread, 0);
if (__e)
__throw_system_error(__e);
diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c b/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c
index 9e621c3f786..f6c623043cd 100644
--- a/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c
+++ b/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c
@@ -1,7 +1,7 @@
// { dg-require-sharedlib "" }
// { dg-options "-g -O2 -pthread -ldl -x c" { target *-*-linux* } }
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,20 +32,20 @@ static void* run(void* arg)
void (*cb)();
lib = dlopen("./testsuite_shared.so", RTLD_NOW);
- if (lib == NULL)
+ if (!lib)
{
printf("dlopen failed: %s\n", strerror(errno));
- return NULL;
+ return 0;
}
cb = (function_type) dlsym(lib, "try_throw_exception");
- if (cb == NULL)
+ if (!cb)
{
printf("dlsym failed: %s\n", strerror(errno));
- return NULL;
+ return 0;
}
cb();
dlclose(lib);
- return NULL;
+ return 0;
}
// libstdc++/23591
@@ -53,9 +53,9 @@ int main(void)
{
pthread_t pt;
- if (pthread_create(&pt, NULL, &run, NULL) != 0)
+ if (pthread_create(&pt, 0, &run, 0) != 0)
return 1;
- if (pthread_join(pt, NULL) != 0)
+ if (pthread_join(pt, 0) != 0)
return 1;
return 0;
diff --git a/libstdc++-v3/testsuite/18_support/exception/38732.cc b/libstdc++-v3/testsuite/18_support/exception/38732.cc
index 43cf5b891ba..7c70f3a17b3 100644
--- a/libstdc++-v3/testsuite/18_support/exception/38732.cc
+++ b/libstdc++-v3/testsuite/18_support/exception/38732.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -17,7 +17,6 @@
#include <typeinfo>
#include <exception>
-#include <cstddef>
#include "unwind.h"
#include <testsuite_hooks.h>
@@ -67,21 +66,21 @@ void test01 ()
throw 0;
} catch(...) {
__cxa_exception *exc = __cxa_get_globals()->caughtExceptions;
- VERIFY ( exc != NULL );
+ VERIFY ( exc != 0 );
VERIFY ( typeid(int) == *exc->exceptionType );
}
try {
throw 0LL;
} catch(...) {
__cxa_exception *exc = __cxa_get_globals()->caughtExceptions;
- VERIFY ( exc != NULL );
+ VERIFY ( exc != 0 );
VERIFY ( typeid(long long int) == *exc->exceptionType );
}
try {
throw 0.0;
} catch(...) {
__cxa_exception *exc = __cxa_get_globals()->caughtExceptions;
- VERIFY ( exc != NULL );
+ VERIFY ( exc != 0 );
VERIFY ( typeid(double) == *exc->exceptionType );
}
}
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc
index bc16ccdfa1b..4a7283f67de 100644
--- a/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc
@@ -21,7 +21,7 @@
#include <exception>
#include <testsuite_hooks.h>
-bool test01()
+void test01()
{
bool test __attribute__((unused)) = true;
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/requirements.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements.cc
new file mode 100644
index 00000000000..36e6375d9a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements.cc
@@ -0,0 +1,60 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <exception>
+#include <testsuite_hooks.h>
+
+// test NullablePointer requirements
+void test01()
+{
+ std::exception_ptr p1; // DefaultConstructible
+ std::exception_ptr p2(p1); // CopyConstructible
+ p1 = p2; // CopyAssignable
+ VERIFY( p1 == p2 ); // EqualityComparable
+ VERIFY( !bool(p1) ); // contextually convertible to bool
+ swap(p1, p2); // Swappable
+
+ // Table 39 expressions
+ std::exception_ptr p3 = nullptr;
+ std::exception_ptr p4(nullptr);
+ VERIFY( std::exception_ptr() == nullptr );
+ p4 = nullptr;
+ VERIFY( p4 == nullptr );
+ VERIFY( nullptr == p4 );
+ VERIFY( (p4 != nullptr) == !(p4 == nullptr) );
+ VERIFY( (nullptr != p4) == !(p4 == nullptr) );
+
+ std::exception_ptr p5{}; // value initialized ...
+ VERIFY( p5 == nullptr ); // ... is equivalent to null
+}
+
+// additional exception_ptr requirements
+void test02()
+{
+ std::exception_ptr p1;
+ VERIFY( p1 == nullptr );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/requirements_neg.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements_neg.cc
new file mode 100644
index 00000000000..b897b506dfe
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements_neg.cc
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <exception>
+
+// test implicit conversions
+void test01()
+{
+ std::exception_ptr p;
+
+ int __attribute__((unused)) i = p; // { dg-error "cannot convert" }
+ bool __attribute__((unused)) b = p; // { dg-error "cannot convert" }
+ void* __attribute__((unused)) v = p; // { dg-error "cannot convert" }
+}
+
diff --git a/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc b/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc
index e764fbb4a99..264e1a3692b 100644
--- a/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdbool> // { dg-excess-errors "In file included from" }
+#include <cstdbool>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc b/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc
index 569dc678223..fdbb1dae515 100644
--- a/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdint> // { dg-excess-errors "In file included from" }
+#include <cstdint>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/18_support/new_delete_placement.cc b/libstdc++-v3/testsuite/18_support/new_delete_placement.cc
index ef845d3a391..866a89b79cb 100644
--- a/libstdc++-v3/testsuite/18_support/new_delete_placement.cc
+++ b/libstdc++-v3/testsuite/18_support/new_delete_placement.cc
@@ -1,6 +1,6 @@
// 2002-07-24 Benjamin Kosnik
-// Copyright (C) 2002, 2004, 2009 Free Software Foundation
+// Copyright (C) 2002, 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,7 +27,7 @@ void test01()
{
void* pc = new char;
void* pa = new char[10];
- void* tmp = NULL;
+ void* tmp = 0;
operator delete(pc, tmp);
operator delete[](pa, tmp);
}
diff --git a/libstdc++-v3/testsuite/18_support/pthread_guard.cc b/libstdc++-v3/testsuite/18_support/pthread_guard.cc
index 965328ebcba..5389316bab0 100644
--- a/libstdc++-v3/testsuite/18_support/pthread_guard.cc
+++ b/libstdc++-v3/testsuite/18_support/pthread_guard.cc
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -40,7 +40,7 @@ void*
do_something (void *arg)
{
static int bar __attribute__((unused)) = get_bar ();
- return NULL;
+ return 0;
}
int
@@ -48,10 +48,10 @@ get_foo (void)
{
pthread_t new_thread;
- if (pthread_create (&new_thread, NULL, do_something, NULL) != 0)
+ if (pthread_create (&new_thread, 0, do_something, 0) != 0)
std::abort ();
- if (pthread_join (new_thread, NULL) != 0)
+ if (pthread_join (new_thread, 0) != 0)
std::abort ();
return 1;
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
index e09ab757b54..12258cac0e4 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
@@ -27,12 +27,10 @@ int main()
bool test __attribute__((unused)) = true;
__gnu_test::test_category c1;
- __gnu_test::test_category c2(c1);
+ __gnu_test::test_category c2(c1); // { dg-error "deleted" }
return 0;
}
-// { dg-error "deleted function" "" { target *-*-* } 72 }
-// { dg-error "used here" "" { target *-*-* } 30 }
-// { dg-error "first required here" "" { target *-*-* } 30 }
-// { dg-excess-errors "copy constructor" }
+// { dg-prune-output "testsuite_error" }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc
index e9294bfd2b5..46f046d6570 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc
@@ -17,7 +17,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <system_error> // { dg-excess-errors "In file included from" }
+#include <system_error>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc
index 13438f0fbe6..0656d42f068 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2007, 2009
+// Copyright (C) 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,6 +32,9 @@ void allocate_on_stack(void)
__extension__ char array[num];
for (size_t i = 0; i < num; i++)
array[i]=0;
+ // Suppress unused warnings.
+ for (size_t i = 0; i < num; i++)
+ array[i]=array[i];
}
void test04()
diff --git a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc
index d28fc8ea95e..b252cea3647 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc
@@ -1,6 +1,6 @@
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,6 +34,9 @@ void allocate_on_stack(void)
__extension__ char array[num];
for (size_t i = 0; i < num; i++)
array[i]=0;
+ // Suppress unused warnings.
+ for (size_t i = 0; i < num; i++)
+ array[i]=array[i];
}
void test04()
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc
index 9dc7010988a..da4c80dfc1e 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2007, 2009
+// Copyright (C) 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,6 +32,9 @@ void allocate_on_stack(void)
__extension__ char array[num];
for (size_t i = 0; i < num; i++)
array[i]=0;
+ // Suppress unused warnings.
+ for (size_t i = 0; i < num; i++)
+ array[i]=array[i];
}
void test04()
diff --git a/libstdc++-v3/testsuite/20_util/clocks/1.cc b/libstdc++-v3/testsuite/20_util/clocks/1.cc
index e808f45f755..ead20873c7b 100644
--- a/libstdc++-v3/testsuite/20_util/clocks/1.cc
+++ b/libstdc++-v3/testsuite/20_util/clocks/1.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-require-cstdint "" }
-// Copyright (C) 2008, 2009 Free Software Foundation
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,6 +33,7 @@ main()
is_monotonic = is_monotonic; // suppress unused warning
std::time_t t2 = system_clock::to_time_t(t1);
system_clock::time_point t3 = system_clock::from_time_t(t2);
+ t3 = t3; // suppress unused warning
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index c3b5022f77a..115c3236839 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,13 +19,11 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 654 }
-// { dg-error "instantiated from here" "" { target *-*-* } 30 }
-// { dg-excess-errors "In function" }
+// { dg-error "static assertion failed" "" { target *-*-* } 676 }
#include <utility>
void test01()
{
- std::declval<int>();
+ std::declval<int>(); // { dg-error "instantiated from here" }
}
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
index 297b5cb690d..98a35f10539 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
@@ -33,4 +33,3 @@ void test01()
// { dg-error "rep cannot be a duration" "" { target *-*-* } 203 }
// { dg-error "instantiated from here" "" { target *-*-* } 31 }
-// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
index b4224401d47..86f349319f0 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
@@ -35,4 +35,3 @@ void test01()
// { dg-error "period must be positive" "" { target *-*-* } 206 }
// { dg-error "instantiated from here" "" { target *-*-* } 33 }
-// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/function/cmp/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/function/cmp/cmp_neg.cc
index a196ef64e2e..bb3c25d1cd9 100644
--- a/libstdc++-v3/testsuite/20_util/function/cmp/cmp_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/function/cmp/cmp_neg.cc
@@ -18,15 +18,16 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-prune-output "include" }
+
#include <functional>
void test01()
{
std::function<void()> f1;
std::function<void()> f2;
- f1 == f2; // { dg-error "here" }
- f1 != f2; // { dg-error "here" }
- // { dg-excess-errors "" }
+ f1 == f2; // { dg-error "deleted" }
+ f1 != f2; // { dg-error "deleted" }
}
int main()
diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..0a4a6224b8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/explicit_instantiation.cc
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+ typedef short test_type;
+ template struct has_nothrow_copy_assign<test_type>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/typedefs.cc
new file mode 100644
index 00000000000..3781d1f9bec
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+//
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::has_nothrow_copy_assign<int> test_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::type type;
+ typedef test_type::type::value_type type_value_type;
+ typedef test_type::type::type type_type;
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/value.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/value.cc
new file mode 100644
index 00000000000..0201c9cb91d
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_assign/value.cc
@@ -0,0 +1,57 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::has_nothrow_copy_assign;
+ using namespace __gnu_test;
+
+ VERIFY( (test_property<has_nothrow_copy_assign, int>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, float>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, EnumType>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, int*>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, int(*)(int)>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, int (ClassType::*)>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign,
+ int (ClassType::*) (int)>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, int[2]>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, float[][3]>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, EnumType[2][3][4]>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, int*[3]>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign, int(*[][2])(int)>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign,
+ int (ClassType::*[2][3])>(true)) );
+ VERIFY( (test_property<has_nothrow_copy_assign,
+ int (ClassType::*[][2][3]) (int)>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_property<has_nothrow_copy_assign, void>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..6ec5c5a427e
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/explicit_instantiation.cc
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+ typedef short test_type;
+ template struct has_trivial_copy_assign<test_type>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc
new file mode 100644
index 00000000000..1c5f0fe7ab0
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+//
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::has_trivial_copy_assign<int> test_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::type type;
+ typedef test_type::type::value_type type_value_type;
+ typedef test_type::type::type type_type;
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc
new file mode 100644
index 00000000000..7663a688a68
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc
@@ -0,0 +1,57 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::has_trivial_copy_assign;
+ using namespace __gnu_test;
+
+ VERIFY( (test_property<has_trivial_copy_assign, int>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, float>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, EnumType>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, int*>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, int(*)(int)>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, int (ClassType::*)>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign,
+ int (ClassType::*) (int)>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, int[2]>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, float[][3]>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, EnumType[2][3][4]>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, int*[3]>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign, int(*[][2])(int)>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign,
+ int (ClassType::*[2][3])>(true)) );
+ VERIFY( (test_property<has_trivial_copy_assign,
+ int (ClassType::*[][2][3]) (int)>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_property<has_trivial_copy_assign, void>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/headers/type_traits/std_c++0x_neg.cc b/libstdc++-v3/testsuite/20_util/headers/type_traits/std_c++0x_neg.cc
index 7d83fd9f994..e596b6ac6ee 100644
--- a/libstdc++-v3/testsuite/20_util/headers/type_traits/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/headers/type_traits/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <type_traits> // { dg-excess-errors "In file included from" }
+#include <type_traits>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..37ba9eb8bc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/explicit_instantiation.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+ typedef short test_type;
+ template struct is_nothrow_constructible<test_type, test_type>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/typedefs.cc
new file mode 100644
index 00000000000..53a64a78f3f
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+//
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::is_nothrow_constructible<int, int> test_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::type type;
+ typedef test_type::type::value_type type_value_type;
+ typedef test_type::type::type type_type;
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc
new file mode 100644
index 00000000000..b3246fad119
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc
@@ -0,0 +1,78 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::is_nothrow_constructible;
+ using namespace __gnu_test;
+
+ // Positive tests.
+ VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
+ double&>(true)) );
+ VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
+ int&>(true)) );
+ VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
+ double&, int&, double&>(true)) );
+ VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
+ double&>(true)) );
+ VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
+ int&>(true)) );
+ VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
+ double&, int&, double&>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
+ void*>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass>
+ (false)) );
+ VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
+ int, double>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
+ void*>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass>
+ (false)) );
+ VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
+ int, double>(false)) );
+
+ VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
+ double&>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
+ int&>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
+ double&, int&, double&>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
+ double&>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
+ int&>(false)) );
+ VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
+ double&, int&, double&>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 7a8ad661d85..8953dac16d4 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -48,8 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 617 }
-// { dg-error "declaration of" "" { target *-*-* } 581 }
-
-// { dg-excess-errors "At global scope" }
-// { dg-excess-errors "In instantiation of" }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 639 }
+// { dg-error "declaration of" "" { target *-*-* } 603 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index 23bca2bffa2..e06005dca6c 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -48,8 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 540 }
-// { dg-error "declaration of" "" { target *-*-* } 504 }
-
-// { dg-excess-errors "At global scope" }
-// { dg-excess-errors "In instantiation of" }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 562 }
+// { dg-error "declaration of" "" { target *-*-* } 526 }
diff --git a/libstdc++-v3/testsuite/20_util/pair/44487.cc b/libstdc++-v3/testsuite/20_util/pair/44487.cc
new file mode 100644
index 00000000000..833d9864534
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/pair/44487.cc
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <utility>
+
+int x, y;
+
+std::pair<int&, int&>
+foo1()
+{
+ std::pair<int&, int&> blah(x, y);
+ return blah;
+}
+
+std::pair<int&, int&>
+foo2()
+{
+ const std::pair<int&, int&> blah(x, y);
+ return blah;
+}
+
+std::pair<int&, int&>
+foo3()
+{
+ std::pair<int&, int&> blah(x, y);
+ return std::pair<int&, int&>(std::move(blah));
+}
+
+std::pair<int&, int&>
+foo4()
+{
+ const std::pair<int&, int&> blah(x, y);
+ return std::pair<int&, int&>(std::move(blah));
+}
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
index 03c2c1f582d..eee2644035c 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
@@ -51,4 +51,3 @@ test04()
// { dg-error "instantiated from here" "" { target *-*-* } 46 }
// { dg-error "denominator cannot be zero" "" { target *-*-* } 153 }
// { dg-error "out of range" "" { target *-*-* } 154 }
-// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc
index 4d9d1a66657..e0d09dee900 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc
@@ -20,7 +20,7 @@
// 20.6.6.2 Template class shared_ptr [util.smartptr.shared]
-#include <memory> // { dg-excess-errors "In file included from" }
+#include <memory>
#include <testsuite_hooks.h>
struct A { };
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc
index 63500799838..09be153d4c6 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc
@@ -32,11 +32,9 @@ void test01()
{
X* px = 0;
std::shared_ptr<X> p1(px); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 549 }
+ // { dg-error "incomplete" "" { target *-*-* } 566 }
std::shared_ptr<X> p9(ap()); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 630 }
+ // { dg-error "incomplete" "" { target *-*-* } 657 }
}
-
-// { dg-excess-errors "" }
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/nullptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/nullptr.cc
new file mode 100644
index 00000000000..82acaed3615
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/nullptr.cc
@@ -0,0 +1,93 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 20.9.11.2 Class template shared_ptr [util.smartptr.shared]
+
+#include <memory>
+#include <cstddef>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// 20.9.11.2.1 shared_ptr constructors [util.smartptr.shared.const]
+
+// Construction from nullptr
+
+struct deleter
+{
+ int count;
+ deleter() : count(0) { }
+ void operator()(std::nullptr_t) { ++count; }
+ void operator()(int*) const { throw "wrong type passed to deleter"; }
+};
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::shared_ptr<int> p = nullptr;
+ VERIFY( p.get() == nullptr );
+ VERIFY( p.use_count() == 0 );
+
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ deleter d;
+ std::shared_ptr<int> p(nullptr, std::ref(d));
+ VERIFY( p.get() == nullptr );
+ VERIFY( p.use_count() == 1 );
+
+ p = nullptr;
+ VERIFY( p.use_count() == 0 );
+ VERIFY( d.count == 1 );
+}
+
+
+void
+test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ deleter d;
+ __gnu_test::tracker_allocator<int> a;
+ std::shared_ptr<int> p(nullptr, std::ref(d), a);
+ VERIFY( p.get() == nullptr );
+ VERIFY( p.use_count() == 1 );
+
+ p = nullptr;
+ VERIFY( p.use_count() == 0 );
+ VERIFY( d.count == 1 );
+
+ typedef __gnu_test::tracker_allocator_counter c;
+ VERIFY( c::get_destruct_count() == c::get_construct_count() );
+ VERIFY( c::get_deallocation_count() == c::get_allocation_count() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/hash/1.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/hash/1.cc
new file mode 100644
index 00000000000..93f4739d782
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/hash/1.cc
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ struct T { };
+
+ std::shared_ptr<T> s0(new T);
+ std::hash<std::shared_ptr<T>> hs0;
+ std::hash<T*> hp0;
+
+ VERIFY( hs0(s0) == hp0(s0.get()) );
+
+ std::__shared_ptr<T> s1(new T);
+ std::hash<std::__shared_ptr<T>> hs1;
+ std::hash<T*> hp1;
+
+ VERIFY( hs1(s1) == hp1(s1.get()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/44487.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/44487.cc
new file mode 100644
index 00000000000..dade58de8bc
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/44487.cc
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tuple>
+
+int x, y;
+
+std::tuple<int&, int&>
+foo1()
+{
+ std::pair<int&, int&> blah(x, y);
+ return blah;
+}
+
+std::tuple<int&, int&>
+foo2()
+{
+ const std::pair<int&, int&> blah(x, y);
+ return blah;
+}
+
+std::tuple<int&, int&>
+foo3()
+{
+ std::pair<int&, int&> blah(x, y);
+ return std::tuple<int&, int&>(std::move(blah));
+}
+
+std::tuple<int&, int&>
+foo4()
+{
+ const std::pair<int&, int&> blah(x, y);
+ return std::tuple<int&, int&>(std::move(blah));
+}
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
index 4aa93b91d91..95c1d5dc5ba 100644
--- a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
@@ -39,24 +39,14 @@ void
test02()
{
std::unique_ptr<int[]> p1(new int(420));
- std::unique_ptr<int[]> p2 = p1;
+ std::unique_ptr<int[]> p2 = p1; // { dg-error "deleted" }
}
void
test03()
{
- std::unique_ptr<int[2]> p1(new int[3]);
- std::unique_ptr<int[2]> p2 = p1;
+ std::unique_ptr<int[2]> p1(new int[3]); // { dg-error "no match" }
+ std::unique_ptr<int[2]> p2 = p1; // { dg-error "deleted" }
}
-// { dg-error "deleted function" "" { target *-*-* } 357 }
-// { dg-error "used here" "" { target *-*-* } 42 }
-// { dg-error "no matching" "" { target *-*-* } 48 }
-// { dg-warning "note" "" { target *-*-* } 130 }
-// { dg-warning "note" "" { target *-*-* } 134 }
-// { dg-warning "note" "" { target *-*-* } 123 }
-// { dg-warning "note" "" { target *-*-* } 118 }
-// { dg-warning "note" "" { target *-*-* } 113 }
-// { dg-warning "note" "" { target *-*-* } 107 }
-// { dg-error "deleted function" "" { target *-*-* } 222 }
-// { dg-error "used here" "" { target *-*-* } 49 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/nullptr.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/nullptr.cc
new file mode 100644
index 00000000000..6f067ee4d6b
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/nullptr.cc
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 20.9.10 Class template unique_ptr [unique.ptr]
+
+#include <memory>
+#include <testsuite_hooks.h>
+
+struct A { };
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unique_ptr<A> p(new A);
+ p = nullptr;
+
+ VERIFY( p.get() == nullptr );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unique_ptr<A[]> p(new A[2]);
+ p = nullptr;
+
+ VERIFY( p.get() == nullptr );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/nullptr.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/nullptr.cc
new file mode 100644
index 00000000000..1f515ea53cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/nullptr.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 20.9.10 Class template unique_ptr [unique.ptr]
+
+#include <memory>
+#include <testsuite_hooks.h>
+
+struct A { };
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unique_ptr<A> p = nullptr;
+
+ VERIFY( p.get() == nullptr );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unique_ptr<A[]> p = nullptr;
+
+ VERIFY( p.get() == nullptr );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/pointer_array_convertible.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/pointer_array_convertible.cc
index 7e0f30741f9..2a4a89b4037 100644
--- a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/pointer_array_convertible.cc
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/pointer_array_convertible.cc
@@ -37,4 +37,5 @@ test01()
{
std::unique_ptr<B[]> B_from_A(new A[3]); //{ dg-error "invalid conversion from" }
}
-//{ dg-excess-errors "initialization" }
+
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/hash/1.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/hash/1.cc
new file mode 100644
index 00000000000..53ece26ecff
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/hash/1.cc
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ struct T { };
+
+ std::unique_ptr<T> u0(new T);
+ std::hash<std::unique_ptr<T>> hu0;
+ std::hash<typename std::unique_ptr<T>::pointer> hp0;
+
+ VERIFY( hu0(u0) == hp0(u0.get()) );
+
+ std::unique_ptr<T[]> u1(new T[10]);
+ std::hash<std::unique_ptr<T[]>> hu1;
+ std::hash<typename std::unique_ptr<T[]>::pointer> hp1;
+
+ VERIFY( hu1(u1) == hp1(u1.get()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc
index 3b389b9da68..29bb57d22b2 100644
--- a/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc
@@ -32,8 +32,7 @@ struct B : A
void test01()
{
std::unique_ptr<B[]> up;
- up.reset(new A[3]);
+ up.reset(new A[3]); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 35 }
-// { dg-error "deleted function" "" { target *-*-* } 347 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
index cbe5f9fdbe8..db7907607c3 100644
--- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
@@ -41,11 +41,11 @@ main()
return 0;
}
-// { dg-warning "note" "" { target *-*-* } 281 }
-// { dg-warning "note" "" { target *-*-* } 407 }
-// { dg-warning "note" "" { target *-*-* } 831 }
-// { dg-warning "note" "" { target *-*-* } 511 }
+// { dg-warning "note" "" { target *-*-* } 324 }
+// { dg-warning "note" "" { target *-*-* } 423 }
+// { dg-warning "note" "" { target *-*-* } 862 }
+// { dg-warning "note" "" { target *-*-* } 510 }
// { dg-warning "note" "" { target *-*-* } 1005 }
// { dg-warning "note" "" { target *-*-* } 340 }
// { dg-warning "note" "" { target *-*-* } 290 }
-// { dg-warning "note" "" { target *-*-* } 201 }
+// { dg-warning "note" "" { target *-*-* } 197 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc
index 73839d26c22..5652478f42b 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc
@@ -1,6 +1,6 @@
// 1999-06-04 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +33,7 @@ void test05()
std::string empty2(empty.begin(), empty.end());
// libstdc++/8716 (same underlying situation, same fix)
- char const * s = NULL;
+ char const * s = 0;
std::string zero_length_built_with_NULL(s,0);
}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc
index 4fe58b6aced..e72377de66a 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc
@@ -1,6 +1,6 @@
// 1999-06-04 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +33,7 @@ void test05()
std::wstring empty2(empty.begin(), empty.end());
// libstdc++/8716 (same underlying situation, same fix)
- wchar_t const * s = NULL;
+ wchar_t const * s = 0;
std::wstring zero_length_built_with_NULL(s,0);
}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/char/1.cc
index c39f6b416f7..de0fe168e98 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/operations/char/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/char/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,7 +29,7 @@ int test01(void)
// data() for size == 0 is non-NULL.
VERIFY( empty.size() == 0 );
const std::string::value_type* p = empty.data();
- VERIFY( p != NULL );
+ VERIFY( p );
return 0;
}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/wchar_t/1.cc
index 1ddde927227..a57464aa5b5 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/operations/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,7 +29,7 @@ int test01(void)
// data() for size == 0 is non-NULL.
VERIFY( empty.size() == 0 );
const std::wstring::value_type* p = empty.data();
- VERIFY( p != NULL );
+ VERIFY( p );
return 0;
}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc
index fb48898d696..b3dc9b20e7c 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc
@@ -2,7 +2,7 @@
// Adapted from http://gcc.gnu.org/ml/gcc-bugs/2002-01/msg00679.html
// which was adapted from pthread1.cc by Mike Lu <MLu@dynamicsoft.com>
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -95,12 +95,12 @@ main (void)
#endif
pthread_t prod;
- pthread_create (&prod, NULL, produce, NULL);
+ pthread_create (&prod, 0, produce, 0);
pthread_t cons;
- pthread_create (&cons, NULL, consume, NULL);
+ pthread_create (&cons, 0, consume, 0);
- pthread_join (prod, NULL);
- pthread_join (cons, NULL);
+ pthread_join (prod, 0);
+ pthread_join (cons, 0);
return 0;
}
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc b/libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc
index 67bcac39645..9142018d0de 100644
--- a/libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc
@@ -1,6 +1,6 @@
// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -60,6 +60,9 @@ void test01()
// void* memchr( void* s, int c, size_t n);
cv = std::memchr(cv, 'a', 3);
v = std::memchr(v, 'a', 3);
+
+ cc1 = cc1; // Suppress unused warnings.
+ c1 = c1;
}
int main()
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc
index 464713bed32..5d751900473 100644
--- a/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc
+++ b/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc
@@ -1,6 +1,6 @@
// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -40,6 +40,10 @@ void test02()
cc = strrchr(ccarray1, 'c');
cc = strpbrk(ccarray1, ccarray2);
c = strstr(carray, carray);
+
+ cv1 = cv1; // Suppress unused warnings.
+ cc = cc;
+ c = c;
}
int main()
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc
index 2e7a6c35d7c..4702581d90f 100644
--- a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -59,6 +59,9 @@ void test01()
// wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
cc1 = std::wmemchr(ccarray1, L'a', 3);
c1 = std::wmemchr(carray, L'a', 3);
+
+ cc1 = cc1; // Suppress unused warnings.
+ c1 = c1;
}
int main()
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc
index aea01b0f16b..7637ecddf26 100644
--- a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc
+++ b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc
@@ -1,6 +1,6 @@
// 2001-04-02 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,6 +39,9 @@ void test02()
cw = wcspbrk(ccarray1, ccarray2);
cw = wcsrchr(ccarray1, L'c');
w = wcsstr(carray, carray);
+
+ cw = cw; // Suppress unused warnings.
+ w = w;
}
int main()
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc
index 4a96797bf52..2df9553a35d 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/char/1.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -84,8 +85,8 @@ void test01()
std::ctype_base::mask m01[3];
std::ctype_base::mask m02[13];
const char_type* cc0 = strlit00;
- const char_type* cc1 = NULL;
- const char_type* cc2 = NULL;
+ const char_type* cc1 = 0;
+ const char_type* cc2 = 0;
cc0 = strlit00;
for (std::size_t i = 0; i < 3; ++i)
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc
index cf2f845ca3b..0b989cbe729 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/1.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -84,8 +85,8 @@ void test01()
std::ctype_base::mask m01[3];
std::ctype_base::mask m02[13];
const char_type* cc0 = strlit00;
- const char_type* cc1 = NULL;
- const char_type* cc2 = NULL;
+ const char_type* cc1 = 0;
+ const char_type* cc2 = 0;
cc0 = strlit00;
for (std::size_t i = 0; i < 3; ++i)
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_base/mask.cc b/libstdc++-v3/testsuite/22_locale/ctype_base/mask.cc
index aec9f31607b..f503ce7f41e 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_base/mask.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype_base/mask.cc
@@ -1,7 +1,7 @@
// { dg-do compile }
// 1999-08-24 bkoz
-// Copyright (C) 1999, 2000, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -43,6 +43,8 @@ test01()
res = m01 | m02;
res = m01 ^ m02;
res = ~m01;
+ res = res; // Suppress unused warning.
+
m01 &= m02;
m01 |= m02;
m01 ^= m02;
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc
index d7ad84137da..f36559ea27c 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc
@@ -3,7 +3,7 @@
// { dg-options "-pthreads" { target *-*-solaris* } }
// { dg-require-namedlocale "" }
-// Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2007, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -59,10 +59,10 @@ main()
pthread_t tid[max_thread_count];
for (int i = 0; i < max_thread_count; i++)
- pthread_create (&tid[i], NULL, thread_main, 0);
+ pthread_create (&tid[i], 0, thread_main, 0);
for (int i = 0; i < max_thread_count; i++)
- pthread_join (tid[i], NULL);
+ pthread_join (tid[i], 0);
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc
index 2d92afcad39..5b882cce683 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc
@@ -3,7 +3,7 @@
// { dg-options "-pthreads" { target *-*-solaris* } }
// { dg-require-namedlocale "" }
-// Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2007, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -55,10 +55,10 @@ main()
loc[j] = std::locale(j % 2 ? "en_US" : "fr_FR");
for (int i = 0; i < max_thread_count; i++)
- pthread_create(&tid[i], NULL, thread_main, 0);
+ pthread_create(&tid[i], 0, thread_main, 0);
for (int i = 0; i < max_thread_count; i++)
- pthread_join(tid[i], NULL);
+ pthread_join(tid[i], 0);
return 0;
}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc
index c5c70dcc9d7..c09b000130e 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/2.cc
@@ -2,7 +2,8 @@
// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -96,7 +97,7 @@ void test01()
VERIFY( loc07 != loc02 );
VERIFY( loc07.name() != "" );
try
- { locale loc08(static_cast<const char*>(NULL)); }
+ { locale loc08(static_cast<const char*>(0)); }
catch(runtime_error& obj)
{ VERIFY( true ); }
catch(...)
@@ -130,7 +131,7 @@ void test01()
VERIFY( loc11 == loc01 );
try
- { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); }
+ { locale loc12(loc01, static_cast<const char*>(0), locale::ctype); }
catch(runtime_error& obj)
{ VERIFY( true ); }
catch(...)
@@ -178,7 +179,7 @@ void test01()
VERIFY( loc11 == loc01 );
try
- { locale loc12(loc01, static_cast<const char*>(NULL), locale::ctype); }
+ { locale loc12(loc01, static_cast<const char*>(0), locale::ctype); }
catch(runtime_error& obj)
{ VERIFY( true ); }
catch(...)
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/29217.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/29217.cc
index 428efc952b6..6693f5d2d6d 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/cons/29217.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/29217.cc
@@ -1,6 +1,6 @@
// { dg-require-namedlocale "" }
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -36,7 +36,7 @@ void test01()
"LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;"
"LC_MEASUREMENT=C;LC_IDENTIFICATION=C" );
- VERIFY( locale().name() == setlocale(LC_ALL, NULL) );
+ VERIFY( locale().name() == setlocale(LC_ALL, 0) );
locale loc1 = locale(locale::classic(), "en_US.UTF-8", locale::time);
diff --git a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/14071.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/14071.cc
index 4927e5647a1..30e133fd49a 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/14071.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/14071.cc
@@ -2,7 +2,7 @@
// 2004-02-09 Petur Runolfsson <peturr02@ru.is>
-// Copyright (C) 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,7 +39,7 @@ void test01()
if (loc.name() != "*")
{
locale::global(loc);
- VERIFY( loc.name() == setlocale(LC_ALL, NULL) );
+ VERIFY( loc.name() == setlocale(LC_ALL, 0) );
}
}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc
index 21d52fd4b2e..3265f71a29c 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/global_locale_objects/2.cc
@@ -2,7 +2,7 @@
// 2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2000, 2002, 2003, 2005, 2009 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003, 2005, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,7 +33,7 @@ void test02()
const string ph("en_PH");
const string mx("es_MX");
- const char* orig = setlocale(LC_ALL, NULL);
+ const char* orig = setlocale(LC_ALL, 0);
const char* testph = setlocale(LC_ALL, ph.c_str());
const char* testmx = setlocale(LC_ALL, mx.c_str());
setlocale(LC_ALL, orig);
@@ -54,7 +54,7 @@ void test02()
// Change global locale.
locale global_orig = locale::global(loc_mx);
- const char* lc_all_mx = setlocale(LC_ALL, NULL);
+ const char* lc_all_mx = setlocale(LC_ALL, 0);
if (lc_all_mx)
{
VERIFY( mx == lc_all_mx );
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc
index 0a76d4334d0..0dad40accf5 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/1.cc
@@ -2,7 +2,8 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -52,12 +53,12 @@ void test01()
oss.imbue(loc_de);
const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
string result1 = oss.str();
VERIFY( result1 == "7.200.000.000,00 ");
oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
string result2 = oss.str();
VERIFY( result2 == "7.200.000.000,00 ");
@@ -68,12 +69,12 @@ void test01()
oss.setf(ios_base::showbase);
oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
string result3 = oss.str();
VERIFY( result3 == "7.200.000.000,00 EUR ");
oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
string result4 = oss.str();
VERIFY( result4 == "7.200.000.000,00 \244");
@@ -88,14 +89,14 @@ void test01()
// test various fill strategies
oss.str(empty);
oss.width(20);
- iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits2);
+ mon_put.put(oss.rdbuf(), true, oss, '*', digits2);
string result10 = oss.str();
VERIFY( result10 == "***************-,01*");
oss.str(empty);
oss.width(20);
oss.setf(ios_base::internal);
- iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits2);
+ mon_put.put(oss.rdbuf(), true, oss, '*', digits2);
string result11 = oss.str();
VERIFY( result11 == "-,01****************");
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/12971.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/12971.cc
index 15efd377e00..5ccb9ba4afc 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/12971.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/12971.cc
@@ -1,6 +1,6 @@
// 2003-11-09 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2003, 2009 Free Software Foundation
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -37,7 +37,7 @@ void test01()
ostringstream oss;
const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', amount);
+ mon_put.put(oss.rdbuf(), true, oss, ' ', amount);
string result = oss.str();
VERIFY( result == "11" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc
index b3defe8b279..7707c7e2a42 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/2.cc
@@ -2,7 +2,8 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -63,12 +64,12 @@ void test02()
// test sign of more than one digit, say hong kong.
oss.str(empty);
- iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
string result5 = oss.str();
VERIFY( result5 == "HK$7,200,000,000.00");
oss.str(empty);
- iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
+ mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
string result6 = oss.str();
VERIFY( result6 == "(HKD 100,000,000,000.00)");
@@ -76,7 +77,7 @@ void test02()
oss.imbue(loc_c);
oss.str(empty);
const money_put<char>& mon_put2 = use_facet<money_put<char> >(oss.getloc());
- iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, ' ', digits4);
+ mon_put2.put(oss.rdbuf(), true, oss, ' ', digits4);
string result7 = oss.str();
VERIFY( result7 == "1");
@@ -84,7 +85,7 @@ void test02()
oss.imbue(loc_hk);
oss.str(empty);
const money_put<char>& mon_put3 = use_facet<money_put<char> >(oss.getloc());
- iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, ' ', digits4);
+ mon_put3.put(oss.rdbuf(), true, oss, ' ', digits4);
string result8 = oss.str();
VERIFY( result8 == "(HKD .01)");
@@ -92,7 +93,7 @@ void test02()
// test bunk input
oss.str(empty);
- iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3);
+ mon_put.put(oss.rdbuf(), true, oss, ' ', digits3);
string result9 = oss.str();
VERIFY( result9 == "");
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc
index 6f571fda828..609bb7f6373 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/char/3.cc
@@ -2,7 +2,8 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,12 +50,12 @@ void test03()
oss.imbue(loc_de);
const money_put<char>& mon_put = use_facet<money_put<char> >(oss.getloc());
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
string result1 = oss.str();
VERIFY( result1 == "7.200.000.000,00 ");
oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
string result2 = oss.str();
VERIFY( result2 == "7.200.000.000,00 ");
@@ -65,12 +66,12 @@ void test03()
oss.setf(ios_base::showbase);
oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
string result3 = oss.str();
VERIFY( result3 == "7.200.000.000,00 EUR ");
oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
string result4 = oss.str();
VERIFY( result4 == "7.200.000.000,00 \244");
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc
index 1fceb279971..d48b8aa320c 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/1.cc
@@ -2,7 +2,8 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -53,12 +54,12 @@ void test01()
const money_put<wchar_t>& mon_put =
use_facet<money_put<wchar_t> >(oss.getloc());
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
wstring result1 = oss.str();
VERIFY( result1 == L"7.200.000.000,00 " );
oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
wstring result2 = oss.str();
VERIFY( result2 == L"7.200.000.000,00 " );
@@ -69,12 +70,12 @@ void test01()
oss.setf(ios_base::showbase);
oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
wstring result3 = oss.str();
VERIFY( result3 == L"7.200.000.000,00 EUR " );
oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
wstring result4 = oss.str();
VERIFY( result4 == L"7.200.000.000,00 \x20ac" );
@@ -89,14 +90,14 @@ void test01()
// test various fill strategies
oss.str(empty);
oss.width(20);
- iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, L'*', digits2);
+ mon_put.put(oss.rdbuf(), true, oss, L'*', digits2);
wstring result10 = oss.str();
VERIFY( result10 == L"***************-,01*" );
oss.str(empty);
oss.width(20);
oss.setf(ios_base::internal);
- iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, L'*', digits2);
+ mon_put.put(oss.rdbuf(), true, oss, L'*', digits2);
wstring result11 = oss.str();
VERIFY( result11 == L"-,01****************" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/12971.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/12971.cc
index fd8bcf517e1..cd430a9e1bd 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/12971.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/12971.cc
@@ -1,6 +1,6 @@
// 2003-11-09 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2003, 2004, 2009 Free Software Foundation
+// Copyright (C) 2003, 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -38,7 +38,7 @@ void test01()
const money_put<wchar_t>& mon_put =
use_facet<money_put<wchar_t> >(oss.getloc());
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, L' ', amount);
+ mon_put.put(oss.rdbuf(), true, oss, L' ', amount);
wstring result = oss.str();
VERIFY( result == L"11" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc
index 33f7727458b..592c913f084 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/2.cc
@@ -2,7 +2,8 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -64,12 +65,12 @@ void test02()
// test sign of more than one digit, say hong kong.
oss.str(empty);
- iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
wstring result5 = oss.str();
VERIFY( result5 == L"HK$7,200,000,000.00" );
oss.str(empty);
- iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits2);
+ mon_put.put(oss.rdbuf(), true, oss, L' ', digits2);
wstring result6 = oss.str();
VERIFY( result6 == L"(HKD 100,000,000,000.00)" );
@@ -78,7 +79,7 @@ void test02()
oss.str(empty);
const money_put<wchar_t>& mon_put2 =
use_facet<money_put<wchar_t> >(oss.getloc());
- iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, L' ', digits4);
+ mon_put2.put(oss.rdbuf(), true, oss, L' ', digits4);
wstring result7 = oss.str();
VERIFY( result7 == L"1" );
@@ -87,7 +88,7 @@ void test02()
oss.str(empty);
const money_put<wchar_t>& mon_put3 =
use_facet<money_put<wchar_t> >(oss.getloc());
- iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, L' ', digits4);
+ mon_put3.put(oss.rdbuf(), true, oss, L' ', digits4);
wstring result8 = oss.str();
VERIFY( result8 == L"(HKD .01)" );
@@ -95,7 +96,7 @@ void test02()
// test bunk input
oss.str(empty);
- iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits3);
+ mon_put.put(oss.rdbuf(), true, oss, L' ', digits3);
wstring result9 = oss.str();
VERIFY( result9 == L"" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc
index a0fbcda9e09..798745bac0e 100644
--- a/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/money_put/put/wchar_t/3.cc
@@ -2,7 +2,8 @@
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -50,12 +51,12 @@ void test03()
const money_put<wchar_t>& mon_put =
use_facet<money_put<wchar_t> >(oss.getloc());
- iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
wstring result1 = oss.str();
VERIFY( result1 == L"7.200.000.000,00 " );
oss.str(empty);
- iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
wstring result2 = oss.str();
VERIFY( result2 == L"7.200.000.000,00 " );
@@ -66,12 +67,12 @@ void test03()
oss.setf(ios_base::showbase);
oss.str(empty);
- iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
wstring result3 = oss.str();
VERIFY( result3 == L"7.200.000.000,00 EUR " );
oss.str(empty);
- iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
+ mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
wstring result4 = oss.str();
VERIFY( result4 == L"7.200.000.000,00 \x20ac" );
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc
index fac61ec3d58..fd28b63fbeb 100644
--- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc
@@ -1,6 +1,6 @@
// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -59,6 +59,8 @@ void test01()
pattern neg1 = monp_c_t.neg_format();
pattern pos2 = monp_c_f.pos_format();
pattern neg2 = monp_c_f.neg_format();
+ neg1 = neg1;
+ neg2 = neg2;
VERIFY( q1 == '.' );
VERIFY( q3 == '.' );
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc
index bb862deda25..eb5e50684be 100644
--- a/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -59,6 +59,8 @@ void test01()
pattern neg1 = monp_c_t.neg_format();
pattern pos2 = monp_c_f.pos_format();
pattern neg2 = monp_c_f.neg_format();
+ neg1 = neg1;
+ neg2 = neg2;
VERIFY( q1 == L'.' );
VERIFY( q3 == L'.' );
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc
index dd849c6fca8..c951c4c3e5e 100644
--- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc
@@ -2,7 +2,7 @@
// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -63,7 +63,7 @@ void test01()
// bool, simple
iss.str("1");
iterator_type os_it00 = iss.rdbuf();
- iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
+ ng.get(os_it00, 0, iss, err, b1);
VERIFY( b1 == true );
VERIFY( err & ios_base::eofbit );
diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc
index d36f5caf019..8b4884738a7 100644
--- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc
@@ -2,7 +2,7 @@
// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -63,7 +63,7 @@ void test01()
// bool, simple
iss.str(L"1");
iterator_type os_it00 = iss.rdbuf();
- iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
+ ng.get(os_it00, 0, iss, err, b1);
VERIFY( b1 == true );
VERIFY( err & ios_base::eofbit );
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc
index 1398aeeaa72..df1a86dca3f 100644
--- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/1.cc
@@ -2,7 +2,8 @@
// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -61,7 +62,7 @@ void test01()
// bool, simple
iterator_type os_it00 = oss.rdbuf();
- iterator_type os_it01 = np.put(os_it00, oss, '+', b1);
+ np.put(os_it00, oss, '+', b1);
result1 = oss.str();
VERIFY( result1 == "1" );
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc
index 83da0d2802e..01b06d6b552 100644
--- a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/1.cc
@@ -2,7 +2,7 @@
// 2001-11-19 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -62,7 +62,7 @@ void test01()
// bool, simple
iterator_type os_it00 = oss.rdbuf();
- iterator_type os_it01 = np.put(os_it00, oss, L'+', b1);
+ np.put(os_it00, oss, L'+', b1);
result1 = oss.str();
VERIFY( result1 == L"1" );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/5.cc
index 5a31f33565a..f08cd6f0761 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/char/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,7 +48,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const string str0 = "1";
- iter_type end0 = tg.get_date(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_date(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_year == 0 );
VERIFY( tm0.tm_mon == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/5.cc
index 194e1505901..9110884fae9 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,7 +48,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const wstring str0 = L"1";
- iter_type end0 = tg.get_date(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_date(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_year == 0 );
VERIFY( tm0.tm_mon == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/5.cc
index 64b0a2e6b21..c1966fe4b95 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,7 +48,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const string str0 = "S";
- iter_type end0 = tg.get_monthname(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_monthname(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_mon == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/5.cc
index 5b48a30f88a..192d19c945b 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,7 +48,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const wstring str0 = L"S";
- iter_type end0 = tg.get_monthname(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_monthname(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_mon == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/5.cc
index f0808bf8a88..b099b6e7ba4 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/char/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,7 +49,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const string str0 = "1";
- iter_type end0 = tg.get_time(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_time(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_sec == 0 );
VERIFY( tm0.tm_min == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/5.cc
index b06ccf6ffb8..ffce43218cd 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,7 +49,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const wstring str0 = L"1";
- iter_type end0 = tg.get_time(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_time(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_sec == 0 );
VERIFY( tm0.tm_min == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc
index 1583f107d6d..4157a08b560 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,7 +49,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const string str0 = "T";
- iter_type end0 = tg.get_weekday(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_weekday(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm1.tm_wday == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/5.cc
index 29de6a26d59..02664bf0b3d 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,7 +49,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const wstring str0 = L"T";
- iter_type end0 = tg.get_weekday(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_weekday(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm1.tm_wday == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/5.cc
index 0f6e5a92a04..f3a47bf87b5 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/char/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,7 +49,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const string str0 = "1";
- iter_type end0 = tg.get_year(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_year(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_year == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/5.cc
index 6c5cbf194ce..c932bebdb64 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_year/wchar_t/5.cc
@@ -1,6 +1,6 @@
// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,7 +49,7 @@ void test01()
const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
const wstring str0 = L"1";
- iter_type end0 = tg.get_year(str0.begin(), str0.end(), iss, err, &tm0);
+ tg.get_year(str0.begin(), str0.end(), iss, err, &tm0);
VERIFY( err == (failbit | eofbit) );
VERIFY( tm0.tm_year == 0 );
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc
index 8fed3437a57..32388cc6f0b 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc
@@ -1,6 +1,6 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -48,27 +48,27 @@ void test01()
// put(iter_type s, ios_base& str, char_type fill, const tm* t,
// char format, char modifier = 0) const;
oss.str(empty);
- iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
string result1 = oss.str();
VERIFY( result1 == "Sun" );
oss.str(empty);
- iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
string result21 = oss.str(); // "04/04/71"
VERIFY( result21 == "04/04/71" );
oss.str(empty);
- iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
string result22 = oss.str(); // "12:00:00"
VERIFY( result22 == "12:00:00" );
oss.str(empty);
- iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
string result31 = oss.str(); // "04/04/71"
VERIFY( result31 == "04/04/71" );
oss.str(empty);
- iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
string result32 = oss.str(); // "12:00:00"
VERIFY( result32 == "12:00:00" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc
index 7de5471495f..3c6ad92e483 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -47,7 +47,7 @@ void test01()
bool test __attribute__((unused)) = true;
ostringstream stream;
- time_t tt = time(NULL);
+ time_t tt = time(0);
const char* fmt = "%c";
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc
index 54d4cde7cef..3d19d36c20b 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -46,7 +46,7 @@ void test03()
bool test __attribute__((unused)) = true;
ostringstream stream;
- time_t tt = time(NULL);
+ time_t tt = time(0);
const char* fmt = "%c";
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc
index 318c05dc2d3..77f2972ca6e 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc
@@ -2,7 +2,7 @@
// 2004-08-25 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -47,7 +47,7 @@ void test01()
const time_put<char>& tim_put =
use_facet<time_put<char> >(oss.getloc());
- iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'c');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'c');
string result1 = oss.str();
char time_buffer[128];
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc
index 7c65ad9985b..255636cbd2c 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -47,27 +47,27 @@ void test02()
oss.imbue(loc_de);
const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
- iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
string result2 = oss.str();
VERIFY( result2 == "Son" || result2 == "So" );
oss.str(empty); // "%d.%m.%Y"
- iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
string result23 = oss.str(); // "04.04.1971"
VERIFY( result23 == "04.04.1971" );
oss.str(empty); // "%T"
- iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
string result24 = oss.str(); // "12:00:00"
VERIFY( result24 == "12:00:00" );
oss.str(empty);
- iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
string result33 = oss.str(); // "04.04.1971"
VERIFY( result33 == "04.04.1971" );
oss.str(empty);
- iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
string result34 = oss.str(); // "12:00:00"
VERIFY( result34 == "12:00:00" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc
index c71b5e46d26..6b9b330aef7 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -47,27 +47,27 @@ void test03()
oss.imbue(loc_hk);
const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
- iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
string result3 = oss.str();
VERIFY( result3 == "Sun" );
oss.str(empty); // "%A, %B %d, %Y"
- iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
string result25 = oss.str(); // "Sunday, April 04, 1971"
VERIFY( result25 == "Sunday, April 04, 1971" );
oss.str(empty); // "%I:%M:%S %Z"
- iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
string result26 = oss.str(); // "12:00:00 CET" or whatever timezone
VERIFY( result26.find("12:00:00") != string::npos );
oss.str(empty);
- iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
string result35 = oss.str(); // "Sunday, April 04, 1971"
VERIFY( result35 == "Sunday, April 04, 1971" );
oss.str(empty);
- iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
string result36 = oss.str(); // "12:00:00 CET"
VERIFY( result36.find("12:00:00") != string::npos );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc
index 196c1aa9088..21b9725c6b9 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc
@@ -2,7 +2,8 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -46,27 +47,27 @@ void test04()
ostringstream oss;
oss.imbue(loc_es);
const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
- iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
string result4 = oss.str();
VERIFY( result4 == "dom" );
oss.str(empty); // "%d/%m/%y"
- iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
string result27 = oss.str(); // "04/04/71"
VERIFY( result27 == "04/04/71" );
oss.str(empty); // "%T"
- iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
string result28 = oss.str(); // "12:00:00"
VERIFY( result28 == "12:00:00" );
oss.str(empty);
- iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
string result37 = oss.str(); // "04/04/71"
VERIFY( result37 == "04/04/71" );
oss.str(empty);
- iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
string result38 = oss.str(); // "12:00:00"
VERIFY( result38 == "12:00:00" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc
index 2f9c6a6bc64..96ce947c2af 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc
@@ -1,6 +1,6 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -48,13 +48,12 @@ void test05()
// 2
oss.str(empty);
- iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
string result5 = oss.str();
VERIFY( result5 == "Sunday, the second of April");
- iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex,
- date_ex + traits::length(date_ex));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
string result6 = oss.str();
VERIFY( result6 != result5 );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc
index ff3938cc9e4..9e144ffcb03 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -50,13 +50,12 @@ void test06()
oss.imbue(loc_de);
const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
- iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
string result7 = oss.str();
VERIFY( result7 == "Sonntag, the second of April");
- iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex,
- date_ex + traits::length(date_ex));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
string result8 = oss.str();
VERIFY( result8 != result7 );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc
index 93b139d95d1..67f1aa580f6 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -50,13 +50,12 @@ void test07()
oss.imbue(loc_hk);
const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
- iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
string result9 = oss.str();
VERIFY( result9 == "Sunday, the second of April");
- iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex,
- date_ex + traits::length(date_ex));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
string result10 = oss.str();
VERIFY( result10 != result9 );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc
index 2834954616a..c3fc4d83acd 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -49,13 +49,12 @@ void test08()
ostringstream oss;
oss.imbue(loc_fr);
const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
- iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date, date + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
string result11 = oss.str();
VERIFY( result11 == "dimanche, the second of avril");
- iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1,
- date_ex,
- date_ex + traits::length(date_ex));
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
string result12 = oss.str();
VERIFY( result12 != result11 );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc
index 2ed02a5daa9..23259753199 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -43,34 +43,35 @@ void test01()
const wstring empty;
wostringstream oss;
oss.imbue(loc_c);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
// 1
// iter_type
// put(iter_type s, ios_base& str, char_type fill, const tm* t,
// char format, char modifier = 0) const;
oss.str(empty);
- iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
wstring result1 = oss.str();
VERIFY( result1 == L"Sun" );
oss.str(empty);
- iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
wstring result21 = oss.str(); // "04/04/71"
VERIFY( result21 == L"04/04/71" );
oss.str(empty);
- iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
wstring result22 = oss.str(); // "12:00:00"
VERIFY( result22 == L"12:00:00" );
oss.str(empty);
- iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
wstring result31 = oss.str(); // "04/04/71"
VERIFY( result31 == L"04/04/71" );
oss.str(empty);
- iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
wstring result32 = oss.str(); // "12:00:00"
VERIFY( result32 == L"12:00:00" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
index 159b8f193bd..1298fa9e5e9 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -45,7 +45,7 @@ void test01()
bool test __attribute__((unused)) = true;
wostringstream stream;
- time_t tt = time(NULL);
+ time_t tt = time(0);
const wchar_t* fmt = L"%c";
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
index 515c998c2b1..c231354743e 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -42,7 +42,7 @@ void test02()
locale loc;
const tp_type& tp = use_facet<tp_type>(loc);
- time_t tt = time(NULL);
+ time_t tt = time(0);
wostringstream stream;
tp.put(tp_type::iter_type(stream), stream, stream.fill(),
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
index 8127c75ea47..2ec4225ba9c 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -44,7 +44,7 @@ void test03()
bool test __attribute__((unused)) = true;
wostringstream stream;
- time_t tt = time(NULL);
+ time_t tt = time(0);
const wchar_t* fmt = L"%c";
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc
index d4f90468869..088acf2f3f4 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc
@@ -2,7 +2,7 @@
// 2004-08-25 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -47,7 +47,7 @@ void test01()
const time_put<wchar_t>& tim_put =
use_facet<time_put<wchar_t> >(oss.getloc());
- iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'c');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'c');
wstring result1 = oss.str();
wchar_t time_buffer[128];
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc
index c8cc42c2cf7..7ead914b166 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -45,29 +45,30 @@ void test02()
const wstring empty;
wostringstream oss;
oss.imbue(loc_de);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
- iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
wstring result2 = oss.str();
VERIFY( result2 == L"Son" || result2 == L"So" );
oss.str(empty); // "%d.%m.%Y"
- iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
wstring result23 = oss.str(); // "04.04.1971"
VERIFY( result23 == L"04.04.1971" );
oss.str(empty); // "%T"
- iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
wstring result24 = oss.str(); // "12:00:00"
VERIFY( result24 == L"12:00:00" );
oss.str(empty);
- iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
wstring result33 = oss.str(); // "04.04.1971"
VERIFY( result33 == L"04.04.1971" );
oss.str(empty);
- iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
wstring result34 = oss.str(); // "12:00:00"
VERIFY( result34 == L"12:00:00" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc
index eec2fa7a358..6e099d64a76 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -45,32 +45,32 @@ void test03()
const wstring empty;
wostringstream oss;
oss.imbue(loc_hk);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
- iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
wstring result3 = oss.str();
VERIFY( result3 == L"Sun" );
oss.str(empty); // "%A, %B %d, %Y"
- iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
wstring result25 = oss.str(); // "Sunday, April 04, 1971"
VERIFY( result25 == L"Sunday, April 04, 1971" );
oss.str(empty); // "%I:%M:%S %Z"
- iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
wstring result26 = oss.str(); // "12:00:00 CET" or whatever timezone
VERIFY( result26.find(L"12:00:00") != wstring::npos );
oss.str(empty);
- iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
wstring result35 = oss.str(); // "Sunday, April 04, 1971"
VERIFY( result35 == L"Sunday, April 04, 1971" );
oss.str(empty);
- iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
wstring result36 = oss.str(); // "12:00:00 CET"
VERIFY( result36.find(L"12:00:00") != wstring::npos );
-
}
int main()
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc
index e56f14ebbd5..0ae2a1f8898 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc
@@ -2,7 +2,8 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -45,28 +46,30 @@ void test04()
const wstring empty;
wostringstream oss;
oss.imbue(loc_es);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
- iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
wstring result4 = oss.str();
VERIFY( result4 == L"dom" );
oss.str(empty); // "%d/%m/%y"
- iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
wstring result27 = oss.str(); // "04/04/71"
VERIFY( result27 == L"04/04/71" );
oss.str(empty); // "%T"
- iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
wstring result28 = oss.str(); // "12:00:00"
VERIFY( result28 == L"12:00:00" );
oss.str(empty);
- iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
wstring result37 = oss.str(); // "04/04/71"
VERIFY( result37 == L"04/04/71" );
oss.str(empty);
- iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
wstring result38 = oss.str(); // "12:00:00"
VERIFY( result38 == L"12:00:00" );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc
index 77f7798abe4..1a355e0a514 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc
@@ -1,6 +1,6 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -46,17 +46,17 @@ void test05()
const wstring empty;
wostringstream oss;
oss.imbue(loc_c);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
// 2
oss.str(empty);
- iterator_type os_it05 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date, date + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
wstring result5 = oss.str();
VERIFY( result5 == L"Sunday, the second of April");
- iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date_ex,
- date_ex + traits::length(date_ex));
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
wstring result6 = oss.str();
VERIFY( result6 != result5 );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc
index 91a68a05c03..dedac7b78fd 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -48,14 +48,15 @@ void test06()
const wstring empty;
wostringstream oss;
oss.imbue(loc_de);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
- iterator_type os_it07 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date, date + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
wstring result7 = oss.str();
VERIFY( result7 == L"Sonntag, the second of April");
- iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date_ex, date_ex + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date));
wstring result8 = oss.str();
VERIFY( result8 != result7 );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc
index 439d6086ca0..5f0926c88d0 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -48,14 +48,15 @@ void test07()
const wstring empty;
wostringstream oss;
oss.imbue(loc_hk);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
- iterator_type os_it09 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date, date + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
wstring result9 = oss.str();
VERIFY( result9 == L"Sunday, the second of April");
- iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date_ex, date_ex + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date));
wstring result10 = oss.str();
VERIFY( result10 != result9 );
}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc
index b073e8b9287..09311f4c2c8 100644
--- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc
@@ -2,7 +2,7 @@
// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -48,13 +48,15 @@ void test08()
const wstring empty;
wostringstream oss;
oss.imbue(loc_fr);
- const time_put<wchar_t>& tim_put = use_facet<time_put<wchar_t> >(oss.getloc());
- iterator_type os_it11 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date, date + traits::length(date));
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
wstring result11 = oss.str();
VERIFY( result11 == L"dimanche, the second of avril");
- iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, L'*', &time1,
- date_ex, date_ex + traits::length(date));
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date));
wstring result12 = oss.str();
VERIFY( result12 != result11 );
}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc
index 089b10b83a6..475880888cc 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -17,16 +17,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
#include <deque>
#include <testsuite_hooks.h>
#include <testsuite_rvalref.h>
using namespace __gnu_test;
-// According to n1771, there should be two resizes, with and without
-// parameter. We only have one at present, whose second parameter defaults
-// to a default-constructed object.
void
test01()
{
@@ -38,30 +34,17 @@ test01()
a.resize(98);
a.resize(99);
a.resize(100);
-#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE
- VERIFY( copycounter::copycount == 100 );
-#else
- VERIFY( copycounter::copycount == 100 + 4 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.resize(99);
a.resize(0);
-#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE
- VERIFY( copycounter::copycount == 100 );
-#else
- VERIFY( copycounter::copycount == 100 + 6 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.resize(100);
-#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE
- VERIFY( copycounter::copycount == 200 );
-#else
- VERIFY( copycounter::copycount == 200 + 7 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.clear();
-#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE
- VERIFY( copycounter::copycount == 200 );
-#else
- VERIFY( copycounter::copycount == 200 + 7 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/capacity/resize_size.cc b/libstdc++-v3/testsuite/23_containers/deque/capacity/resize_size.cc
new file mode 100644
index 00000000000..229a0eb60bc
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/capacity/resize_size.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <deque>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::deque<__gnu_test::NonCopyConstructible> d;
+ VERIFY( std::distance(d.begin(), d.end()) == 0 );
+
+ d.resize(1000);
+ VERIFY( std::distance(d.begin(), d.end()) == 1000 );
+ for(auto it = d.begin(); it != d.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/cons_size.cc
new file mode 100644
index 00000000000..0207fd7174c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/cons/cons_size.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <deque>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::deque<__gnu_test::NonCopyConstructible> d(1000);
+ VERIFY( std::distance(d.begin(), d.end()) == 1000 );
+ for(auto it = d.begin(); it != d.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 96be31cb62a..bd6ee636305 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1577 }
+// { dg-error "no matching" "" { target *-*-* } 1659 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index 59d4e2f4158..21c9d4e4f3c 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1516 }
+// { dg-error "no matching" "" { target *-*-* } 1592 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index 6208581b877..08f54d68018 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -1,6 +1,6 @@
// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1516 }
+// { dg-error "no matching" "" { target *-*-* } 1592 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index 7fb2479d02c..a5bd6065c1c 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1661 }
+// { dg-error "no matching" "" { target *-*-* } 1743 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc
index 4e599dab6bc..e22af3cbc19 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc
@@ -21,24 +21,17 @@
#include <forward_list>
#include <testsuite_hooks.h>
-
-struct NoCopyConstructor
-{
- NoCopyConstructor() : num(-1) { }
- NoCopyConstructor(const NoCopyConstructor&) = delete;
-
- operator int() { return num; }
-
-private:
- int num;
-};
+#include <testsuite_api.h>
void test01()
{
bool test __attribute__((unused)) = true;
- std::forward_list<NoCopyConstructor> fl(5);
- VERIFY( std::distance(fl.begin(), fl.end()) == 5 );
+ std::forward_list<__gnu_test::NonCopyConstructible> fl;
+ VERIFY( std::distance(fl.begin(), fl.end()) == 0 );
+
+ fl.resize(1000);
+ VERIFY( std::distance(fl.begin(), fl.end()) == 1000 );
for(auto it = fl.begin(); it != fl.end(); ++it)
VERIFY( *it == -1 );
}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc
index 985f592e602..3d07f672089 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc
@@ -21,27 +21,14 @@
#include <forward_list>
#include <testsuite_hooks.h>
-
-struct NoCopyConstructor
-{
- NoCopyConstructor() : num(-1) { }
- NoCopyConstructor(const NoCopyConstructor&) = delete;
-
- operator int() { return num; }
-
-private:
- int num;
-};
+#include <testsuite_api.h>
void test01()
{
bool test __attribute__((unused)) = true;
- std::forward_list<NoCopyConstructor> fl;
- VERIFY( std::distance(fl.begin(), fl.end()) == 0 );
-
- fl.resize(10);
- VERIFY( std::distance(fl.begin(), fl.end()) == 10 );
+ std::forward_list<__gnu_test::NonCopyConstructible> fl(1000);
+ VERIFY( std::distance(fl.begin(), fl.end()) == 1000 );
for(auto it = fl.begin(); it != fl.end(); ++it)
VERIFY( *it == -1 );
}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
index 1625e3bc76b..aa0f3e07def 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1198 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
index 5acfcd1f47f..3975b051611 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1198 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
index dcf69089b00..0b0471c8cc9 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1198 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
index 22574fd081a..849eb643e87 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1198 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc
index 3c47ae204c1..5d9bf7e0a3f 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <array> // { dg-excess-errors "In file included from" }
+#include <array>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc
index 89f850cc090..266874da23b 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <tuple> // { dg-excess-errors "In file included from" }
+#include <tuple>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc
index 65f05e1e693..dc85bc50e92 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <unordered_map> // { dg-excess-errors "In file included from" }
+#include <unordered_map>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc
index 3dabc3207be..ab22c39a6ba 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <unordered_set> // { dg-excess-errors "In file included from" }
+#include <unordered_set>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/23_containers/list/23781.cc b/libstdc++-v3/testsuite/23_containers/list/23781.cc
index ca275bda5ad..7b291df798a 100644
--- a/libstdc++-v3/testsuite/23_containers/list/23781.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/23781.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <list>
+#include <cstddef>
typedef std::list<int> list_type;
list_type::iterator it = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc
new file mode 100644
index 00000000000..06424c0a8c1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <list>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::list<__gnu_test::NonCopyConstructible> l;
+ VERIFY( std::distance(l.begin(), l.end()) == 0 );
+
+ l.resize(1000);
+ VERIFY( std::distance(l.begin(), l.end()) == 1000 );
+ for(auto it = l.begin(); it != l.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc
new file mode 100644
index 00000000000..f59f520f928
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <list>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::list<__gnu_test::NonCopyConstructible> l(1000);
+ VERIFY( std::distance(l.begin(), l.end()) == 1000 );
+ for(auto it = l.begin(); it != l.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
index fcbb039dce3..00dc817b152 100644
--- a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
@@ -1,6 +1,6 @@
// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -45,9 +45,9 @@ class task_queue
public:
task_queue ()
{
- pthread_mutex_init (&fooLock, NULL);
- pthread_cond_init (&fooCond1, NULL);
- pthread_cond_init (&fooCond2, NULL);
+ pthread_mutex_init (&fooLock, 0);
+ pthread_cond_init (&fooCond1, 0);
+ pthread_cond_init (&fooCond2, 0);
}
~task_queue ()
{
@@ -115,14 +115,14 @@ main()
for (int i = 0; i < thread_pairs; i++)
{
tq[i] = new task_queue;
- pthread_create (&prod[i], NULL, produce, static_cast<void*> (tq[i]));
- pthread_create (&cons[i], NULL, consume, static_cast<void*> (tq[i]));
+ pthread_create (&prod[i], 0, produce, static_cast<void*> (tq[i]));
+ pthread_create (&cons[i], 0, consume, static_cast<void*> (tq[i]));
}
for (int i = 0; i < thread_pairs; i++)
{
- pthread_join (prod[i], NULL);
- pthread_join (cons[i], NULL);
+ pthread_join (prod[i], 0);
+ pthread_join (cons[i], 0);
delete tq[i];
}
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
index 57411eef3f0..4f464372124 100644
--- a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
@@ -2,7 +2,7 @@
// Adpated from libstdc++/5464 submitted by jjessel@amadeus.net
// Jean-Francois JESSEL (Amadeus SAS Development)
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -99,7 +99,7 @@ main ()
#endif
pthread_attr_t tattr;
- int ret = pthread_attr_init (&tattr);
+ int ret __attribute__((unused)) = pthread_attr_init (&tattr);
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
ret = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM);
#endif
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index eb35a24c89d..2446157597f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1411 }
+// { dg-error "no matching" "" { target *-*-* } 1478 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index 937404b26a8..cbac8e80cbf 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1380 }
+// { dg-error "no matching" "" { target *-*-* } 1434 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index 74fc1b7a163..232bd042ddb 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1380 }
+// { dg-error "no matching" "" { target *-*-* } 1434 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index 3aebda5ddb2..aefb1f583fd 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1380 }
+// { dg-error "no matching" "" { target *-*-* } 1434 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/map/23781.cc b/libstdc++-v3/testsuite/23_containers/map/23781.cc
index f7967693f79..e282c754667 100644
--- a/libstdc++-v3/testsuite/23_containers/map/23781.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/23781.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <map>
+#include <cstddef>
std::map<int, int>::iterator it = NULL; // { dg-error "conversion" }
std::map<int, int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/map/dr130.cc b/libstdc++-v3/testsuite/23_containers/map/dr130.cc
index d7f3c2b0856..9186a621ea7 100644
--- a/libstdc++-v3/testsuite/23_containers/map/dr130.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/dr130.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,7 +34,7 @@ test01()
typedef map<int, int>::value_type value_type;
typedef pair<iterator, bool> insert_return_type;
- insert_return_type irt0 = m0.insert(value_type(1, 1));
+ m0.insert(value_type(1, 1));
insert_return_type irt1 = m0.insert(value_type(2, 2));
insert_return_type irt2 = m0.insert(value_type(3, 3));
@@ -58,7 +58,7 @@ test02()
typedef pair<iterator, bool> insert_return_type;
insert_return_type irt0 = m0.insert(value_type(1, 1));
- insert_return_type irt1 = m0.insert(value_type(2, 2));
+ m0.insert(value_type(2, 2));
insert_return_type irt2 = m0.insert(value_type(3, 3));
insert_return_type irt3 = m0.insert(value_type(4, 4));
diff --git a/libstdc++-v3/testsuite/23_containers/map/pthread6.cc b/libstdc++-v3/testsuite/23_containers/map/pthread6.cc
index 608527e8f08..38c20ed647f 100644
--- a/libstdc++-v3/testsuite/23_containers/map/pthread6.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/pthread6.cc
@@ -1,7 +1,7 @@
// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
// Adpated from libstdc++/5444 submitted by markus.breuer@materna.de
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -78,10 +78,10 @@ main (void)
#endif
for (int i = 0; i < max_thread_count; i++)
- pthread_create (&tid[i], NULL, thread_main, 0);
+ pthread_create (&tid[i], 0, thread_main, 0);
for (int i = 0; i < max_thread_count; i++)
- pthread_join (tid[i], NULL);
+ pthread_join (tid[i], 0);
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/23781.cc b/libstdc++-v3/testsuite/23_containers/multimap/23781.cc
index 912bb926b98..50ec929064e 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/23781.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/23781.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <map>
+#include <cstddef>
std::multimap<int, int>::iterator it = NULL; // { dg-error "conversion" }
std::multimap<int, int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/23781.cc b/libstdc++-v3/testsuite/23_containers/multiset/23781.cc
index 80d13370345..6b0bacf955b 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/23781.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/23781.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <set>
+#include <cstddef>
std::multiset<int>::iterator it = NULL; // { dg-error "conversion" }
std::multiset<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc
index 416468617f1..0c21b25f900 100644
--- a/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc
+++ b/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc
@@ -1,6 +1,6 @@
// 2002-06-28 pme
-// Copyright (C) 2002, 2004, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,12 +28,10 @@ test03()
{
int data[] = {1, 2, 3};
std::priority_queue<int> pq;
- std::size_t size = pq.size();
for (int i = 0; i < 3; ++i)
pq.push(data[i]);
- size = pq.size();
pq.top();
for (int i = 0; i < 2; ++i)
pq.pop();
diff --git a/libstdc++-v3/testsuite/23_containers/set/23781.cc b/libstdc++-v3/testsuite/23_containers/set/23781.cc
index 7a2a2bc7240..b47b748ec8d 100644
--- a/libstdc++-v3/testsuite/23_containers/set/23781.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/23781.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <set>
+#include <cstddef>
std::set<int>::iterator it = NULL; // { dg-error "conversion" }
std::set<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/set/dr130.cc b/libstdc++-v3/testsuite/23_containers/set/dr130.cc
index 1904dcdc0bd..1dac5628d37 100644
--- a/libstdc++-v3/testsuite/23_containers/set/dr130.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/dr130.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,7 +33,7 @@ test01()
typedef set<int>::const_iterator const_iterator;
typedef pair<iterator, bool> insert_return_type;
- insert_return_type irt0 = s0.insert(1);
+ s0.insert(1);
insert_return_type irt1 = s0.insert(2);
insert_return_type irt2 = s0.insert(3);
@@ -56,7 +56,7 @@ test02()
typedef pair<iterator, bool> insert_return_type;
insert_return_type irt0 = s0.insert(1);
- insert_return_type irt1 = s0.insert(2);
+ s0.insert(2);
insert_return_type irt2 = s0.insert(3);
insert_return_type irt3 = s0.insert(4);
diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/1.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc
index 168df7a4a97..168df7a4a97 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/resize/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc
diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc
index 47fdf8fcafa..5ba026dbeb5 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc
@@ -1,6 +1,7 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -17,19 +18,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
#include <vector>
#include <testsuite_hooks.h>
#include <testsuite_rvalref.h>
using namespace __gnu_test;
-// According to n1771, there should be two resizes, with and without
-// parameter. We only have one at present, whose second parameter defaults
-// to a default-constructed object.
-// Also, the values are one higher than might be expected because internally
-// resize calls fill, which copies its input value in case it is already in
-// the vector when the vector isn't moved.
void
test01()
{
@@ -41,30 +35,17 @@ test01()
a.resize(98);
a.resize(99);
a.resize(100);
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 100 + 1 );
-#else
- VERIFY( copycounter::copycount == 100 + 1 + 4 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.resize(99);
a.resize(0);
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 100 + 1 );
-#else
- VERIFY( copycounter::copycount == 100 + 1 + 6 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.resize(100);
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 200 + 2 );
-#else
- VERIFY( copycounter::copycount == 200 + 2 + 7 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.clear();
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 200 + 2 );
-#else
- VERIFY( copycounter::copycount == 200 + 2 + 7 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc
new file mode 100644
index 00000000000..d181168acf7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<__gnu_test::NonCopyConstructible> v;
+ VERIFY( std::distance(v.begin(), v.end()) == 0 );
+
+ v.resize(1000);
+ VERIFY( std::distance(v.begin(), v.end()) == 1000 );
+ for(auto it = v.begin(); it != v.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc
new file mode 100644
index 00000000000..a33ba1ad69e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<__gnu_test::NonCopyConstructible> v(1000);
+ VERIFY( std::distance(v.begin(), v.end()) == 1000 );
+ for(auto it = v.begin(); it != v.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index b96b5359963..6925c1776a4 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1063 }
+// { dg-error "no matching" "" { target *-*-* } 1148 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index 950643857c5..662bf169b23 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1003 }
+// { dg-error "no matching" "" { target *-*-* } 1078 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index f17b541a4e0..fe2a2b25475 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1003 }
+// { dg-error "no matching" "" { target *-*-* } 1078 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index 19d3fd08c4b..9869af131df 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1104 }
+// { dg-error "no matching" "" { target *-*-* } 1189 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc
index d69155893ac..2c967ac2778 100644
--- a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc
+++ b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc
@@ -1,6 +1,7 @@
// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2004, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2004, 2005, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,6 +28,7 @@ void test02()
typedef std::back_insert_iterator<std::list<int> > iterator_type;
std::list<int> li;
iterator_type it = std::back_inserter(li);
+ it = it; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc
index 69aefe869e3..e72723764cb 100644
--- a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc
+++ b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc
@@ -1,6 +1,6 @@
// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,6 +27,7 @@ void test02()
typedef std::front_insert_iterator<std::list<int> > iterator_type;
std::list<int> li;
iterator_type it = std::front_inserter(li);
+ it = it; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc
index a5961211a37..ac949307e09 100644
--- a/libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc
+++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc
@@ -1,6 +1,6 @@
// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,6 +30,8 @@ void test02()
std::list<int>::iterator liit = li.begin();
iterator_type it01(li, liit);
iterator_type it02 = std::inserter(li, liit);
+ it01 = it01; // Suppress unused warnings.
+ it02 = it02;
}
int main()
diff --git a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc
index 36d8adde348..0b86efacb92 100644
--- a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc
+++ b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc
@@ -1,6 +1,6 @@
// 2001-04-30 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -49,7 +49,7 @@ bool test02(void)
*ostrb_it01;
VERIFY( !ostrb_it01.failed() );
- costreambuf_iter ostrb_it02(NULL);
+ costreambuf_iter ostrb_it02(0);
VERIFY( ostrb_it02.failed() );
ostrb_it02++;
++ostrb_it02;
diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax/3.cc b/libstdc++-v3/testsuite/25_algorithms/minmax/3.cc
index f0944b0bfde..0e99d51d210 100644
--- a/libstdc++-v3/testsuite/25_algorithms/minmax/3.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/minmax/3.cc
@@ -2,7 +2,7 @@
// 2008-09-16 Chris Fairles <chris.fairles@gmail.com>
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,8 +41,7 @@ void test01()
{
bool test __attribute__((unused)) = true;
- std::pair<int, int> z = std::minmax({1, 2, 3, 4, 5, 6, 7, 8},
- compare_counter());
+ std::minmax({1, 2, 3, 4, 5, 6, 7, 8}, compare_counter());
// If N is the number of arguments in the minmax function call,
// 25.3.7 specifies that at most 3N/2 comparisons are allowed.
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/complex_value.cc b/libstdc++-v3/testsuite/26_numerics/complex/complex_value.cc
index 9dd25077c38..dc05a2b19b4 100644
--- a/libstdc++-v3/testsuite/26_numerics/complex/complex_value.cc
+++ b/libstdc++-v3/testsuite/26_numerics/complex/complex_value.cc
@@ -3,7 +3,7 @@
// 2000-11-20
// Benjamin Kosnik bkoz@redhat.com
-// Copyright (C) 2000, 2003, 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2003, 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,27 +34,27 @@ void test01()
complex_type a(cd1, cd2);
double d;
d = a.real();
- VERIFY( d == cd1);
+ VERIFY( d == cd1 );
d = a.imag();
- VERIFY(d == cd2);
+ VERIFY( d == cd2 );
complex_type c(cd1, cd2);
double d6 = abs(c);
- VERIFY( d6 >= 0);
+ VERIFY( d6 >= 0 );
double d7 = arg(c);
double d8 = atan2(c.imag(), c.real());
- VERIFY( d7 == d8);
+ VERIFY( d7 == d8 );
double d9 = norm(c);
double d10 = d6 * d6;
- VERIFY(d9 - d10 == 0);
+ VERIFY( d9 - d10 == 0 );
- complex_type e = conj(c);
+ complex_type e __attribute__((unused)) = conj(c);
complex_type f = polar(c.imag(), 0.0);
- VERIFY(f.real() != 0);
+ VERIFY( f.real() != 0 );
}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc
index f44757851e0..d81271ab07a 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <ccomplex> // { dg-excess-errors "In file included from" }
+#include <ccomplex>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc
index c4573758adc..a353da9e820 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cfenv> // { dg-excess-errors "In file included from" }
+#include <cfenv>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc
index e85ecab818a..3f4b8ba26e1 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc
@@ -70,6 +70,7 @@ template <typename _Tp>
res = std::islessequal(f1,f2);
res = std::islessgreater(f1, f2);
res = std::isunordered(f1, f2);
+ res = res; // Suppress unused warning.
}
#endif
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
index 142e1da38bd..716dda51b1e 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
@@ -20,8 +20,8 @@
// { dg-do compile }
// { dg-add-options no_pch }
-// { dg-xfail-if "" { { *-*-linux* *-*-darwin* hppa*-*-hpux* } || { uclibc || newlib } } { "*" } { "" } }
-// { dg-excess-errors "" { target { { *-*-linux* *-*-darwin* hppa*-*-hpux* } || { uclibc || newlib } } } }
+// { dg-xfail-if "" { { *-*-linux* *-*-darwin* *-*-solaris2.1[0-9]* hppa*-*-hpux* } || { uclibc || newlib } } { "*" } { "" } }
+// { dg-excess-errors "" { target { { *-*-linux* *-*-darwin* *-*-solaris2.1[0-9]* hppa*-*-hpux* } || { uclibc || newlib } } } }
#include <math.h>
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc
index 4418bc31b20..5819e1a18a7 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -43,4 +43,5 @@ int main()
ans = std::sinh(j);
ans = std::tan(i);
ans = std::tanh(i);
+ ans = ans; // Suppress unused warnings.
}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc
index f1f2a77224a..15175885cb4 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <ctgmath> // { dg-excess-errors "In file included from" }
+#include <ctgmath>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc
index 6463f520db5..41311965aff 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <random> // { dg-excess-errors "In file included from" }
+#include <random>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc
index d244c769162..6010c536cef 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc
@@ -33,6 +33,7 @@ test01()
const auto f(e);
auto g(f);
+ g = g; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc
index 1e88b89efe8..111af1964e4 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc
@@ -34,6 +34,7 @@ test01()
const auto f(e);
auto g(f);
+ g = g; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc
index 06360aa0678..6f5b8d29754 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc
@@ -28,7 +28,8 @@ test01()
std::linear_congruential_engine<unsigned long, 48271, 0, 2147483647> e(1);
const auto f(e);
- auto g(f);
+ auto g(f);
+ g = g; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc
index af0c4b1e356..2b48164fb83 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc
@@ -4,7 +4,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -31,6 +31,7 @@ void test01()
p = &lc.increment;
p = &lc.modulus;
p = &lc.default_seed;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc
index 3da72cbf5fd..98ea4fe0387 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc
@@ -36,6 +36,7 @@ test01()
const auto f(e);
auto g(f);
+ g = g; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc
index 2abc5ab9b64..ad38bec01c0 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc
@@ -4,7 +4,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,6 +41,7 @@ void test01()
p = &mt.tempering_l;
p = &mt.initialization_multiplier;
p = &mt.default_seed;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc
index c589a4edc8a..55e38e22f80 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc
@@ -33,6 +33,7 @@ test01()
const auto f(e);
auto g(f);
+ g = g; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc
index c1d5b3a2e45..2a96488cd3d 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc
@@ -4,7 +4,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,6 +29,7 @@ void test01()
const void* p = &so.table_size;
p = &so.table_size;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc
index 21df0a07e3c..2639e87dd4c 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc
@@ -29,6 +29,7 @@ test01()
const auto f(e);
auto g(f);
+ g = g; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc
index 2ab13a30309..8c033cd26e3 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc
@@ -4,7 +4,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -31,6 +31,7 @@ void test01()
p = &swc.short_lag;
p = &swc.long_lag;
p = &swc.default_seed;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc b/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc
index 59bf014a475..0357e5de71e 100644
--- a/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc
+++ b/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc
@@ -1,6 +1,6 @@
// 20010613 gdr
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -17,8 +17,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-
// This is DR-253. Test for accessible assignment-operators.
#include <valarray>
#include <testsuite_hooks.h>
@@ -36,7 +34,7 @@ int main()
VERIFY(v[3] == 1 && w[3] == 1);
VERIFY(v[6] == 1 && w[6] == 1);
- std::slice_array<int> t = v[slice(0, 10, 1)];
+ std::slice_array<int> t __attribute__((unused)) = v[slice(0, 10, 1)];
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
index 6dc56f9b154..0a12e722450 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -61,19 +61,19 @@ void test_01()
// filebuf_type* close()
std::filebuf* f;
f = fb_01.close();
- VERIFY( f != NULL );
+ VERIFY( f );
VERIFY( !fb_01.is_open() );
f = fb_02.close();
- VERIFY( f != NULL );
+ VERIFY( f );
VERIFY( !fb_02.is_open() );
f = fb_03.close();
- VERIFY( f != NULL );
+ VERIFY( f );
VERIFY( !fb_03.is_open() );
f = fb_03.close();
- VERIFY( f == NULL );
+ VERIFY( !f );
VERIFY( !fb_03.is_open() );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/12790-3.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/12790-3.cc
index 2074ee78a0b..fe0624d109e 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/12790-3.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/12790-3.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -71,7 +71,7 @@ void test01()
VERIFY( !cvt->unshift_called );
filebuf* ret = fb.close();
VERIFY( cvt->unshift_called );
- VERIFY( ret == NULL );
+ VERIFY( !ret );
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc
index 9d0cb0f7499..c1a0f79c8e2 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/2.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -48,7 +48,7 @@ void test_02()
// read (ext)
FILE* f2 = fopen(name_01, "r");
- VERIFY( f2 != NULL );
+ VERIFY( f2 );
if (f2)
{
__gnu_cxx::stdio_filebuf<char> fb(f2, std::ios_base::in, 512);
@@ -58,7 +58,7 @@ void test_02()
// read (standard)
FILE* f = fopen(name_01, "r");
- VERIFY( f != NULL );
+ VERIFY( f );
if (f)
{
std::ifstream ifstream1(name_01);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
index e520682b112..f2c5abc3eb3 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
@@ -1,7 +1,7 @@
// { dg-require-fork "" }
// { dg-require-mkfifo "" }
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -69,14 +69,14 @@ bool test_07()
filebuf fb;
filebuf* ret = fb.open(name, ios_base::in | ios_base::out);
- VERIFY( ret != NULL );
+ VERIFY( ret != 0 );
VERIFY( fb.is_open() );
s1.signal();
s2.wait();
fb.sputc('a');
ret = fb.close();
- VERIFY( ret != NULL );
+ VERIFY( ret != 0 );
VERIFY( !fb.is_open() );
return test;
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc
index baa4ed31eb8..417fbc2ce39 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -69,7 +69,7 @@ void test01()
VERIFY( !cvt->unshift_called );
wfilebuf* ret = fb.close();
VERIFY( cvt->unshift_called );
- VERIFY( ret == NULL );
+ VERIFY( !ret );
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc
index a3a78120e78..b233f65637e 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc
@@ -4,7 +4,8 @@
// 2004-04-16 Petur Runolfsson <peturr02@ru.is>
-// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -68,7 +69,7 @@ bool test01()
wfilebuf fb;
fb.pubimbue(loc_us);
wfilebuf* ret = fb.open(name, ios_base::out);
- VERIFY( ret != NULL );
+ VERIFY( ret != 0 );
VERIFY( fb.is_open() );
s1.wait();
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc
index e10bd9153f2..1a40da155cf 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -53,11 +53,11 @@ void test_01()
// Should keep the old file attached, and disregard attempt to overthrow.
std::filebuf* f = fb_02.open(name_02, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
- VERIFY( f != NULL );
+ VERIFY( f );
VERIFY( fb_02.is_open() );
f = fb_02.open(name_03, std::ios_base::in | std::ios_base::out);
- VERIFY( f == NULL );
+ VERIFY( !f );
VERIFY( fb_02.is_open() );
fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc
index 1bd81ee14d9..755784fb9ae 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/2.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test_03()
int first_fd = ::open(name_01, O_RDONLY);
VERIFY( first_fd != -1 );
FILE* first_file = ::fdopen(first_fd, "r");
- VERIFY( first_file != NULL );
+ VERIFY( first_file );
__gnu_cxx::stdio_filebuf<char> fb(first_file, std::ios_base::in);
int second_fd = fb.fd();
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
index cfec76b310b..5b404375e63 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
@@ -1,6 +1,7 @@
// { dg-require-mkfifo "" }
-// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2005, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -55,7 +56,7 @@ void test_06()
std::ios_base::in
| std::ios_base::out
| std::ios_base::ate);
- if (r == NULL)
+ if (!r)
VERIFY( !fbuf.is_open() );
else
VERIFY( fbuf.is_open() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-1.cc
index db02187dece..d762fb48c2c 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-1.cc
@@ -1,6 +1,6 @@
// { dg-require-namedlocale "" }
-// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -37,7 +37,7 @@ void test01()
wfilebuf* f = fb.close();
VERIFY( n1 != wfilebuf::traits_type::eof() );
- VERIFY( f != NULL );
+ VERIFY( f );
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-2.cc
index 9ea64cc3e93..f11916e6f77 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-2.cc
@@ -1,6 +1,6 @@
// { dg-require-namedlocale "" }
-// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,7 +39,7 @@ void test02()
VERIFY( n1 != wfilebuf::traits_type::eof() );
VERIFY( n2 != wfilebuf::traits_type::eof() );
- VERIFY( f != NULL );
+ VERIFY( f );
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-3.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-3.cc
index 2f10e0dec42..2be9b52cbd2 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-3.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-3.cc
@@ -1,6 +1,6 @@
// { dg-require-namedlocale "" }
-// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -36,7 +36,7 @@ void test03()
wfilebuf* f = fb.close();
VERIFY( n1 != wfilebuf::traits_type::eof() );
- VERIFY( f != NULL );
+ VERIFY( f );
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-4.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-4.cc
index a03d9e8d1ab..7b48bfe7bb9 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-4.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/overflow/wchar_t/11305-4.cc
@@ -1,6 +1,6 @@
// { dg-require-namedlocale "" }
-// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -38,7 +38,7 @@ void test04()
VERIFY( n1 != wfilebuf::traits_type::eof() );
VERIFY( n2 != wfilebuf::traits_type::eof() );
- VERIFY( f != NULL );
+ VERIFY( f );
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/12790-4.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/12790-4.cc
index 53ee751ed44..3bf4353d7e6 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/12790-4.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/12790-4.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -47,7 +47,7 @@ void test01()
fb.sputc(pod_uchar::from<char>(0xff));
// Check that seekoff sets the current state during output
- traits_type::pos_type pos = fb.pubseekoff(0, ios_base::cur);
+ fb.pubseekoff(0, ios_base::cur);
fb.sputc(pod_uchar::from<char>('a'));
fb.sputc(pod_uchar::from<char>(0xff));
fb.sputc(pod_uchar::from<char>(0));
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc
index 3d26c1cfc57..24887461719 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test05()
typedef filebuf::traits_type traits_type;
bool test __attribute__((unused)) = true;
- streamsize strmsz_1, strmsz_2;
+ streamsize strmsz_1;
int_type c1;
int_type c2;
@@ -65,7 +65,7 @@ void test05()
//beg
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
- strmsz_2 = fb.in_avail();
+ fb.in_avail();
off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
index bb175150556..4dc6d8648be 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test05()
typedef filebuf::off_type off_type;
bool test __attribute__((unused)) = true;
- streamsize strmsz_1, strmsz_2;
+ streamsize strmsz_1;
int_type c1;
int_type c2;
@@ -66,7 +66,7 @@ void test05()
//beg
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
- strmsz_2 = fb.in_avail();
+ fb.in_avail();
off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc
index f786504984d..8d7ab1dfc11 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test05()
typedef filebuf::traits_type traits_type;
bool test __attribute__((unused)) = true;
- streamsize strmsz_1, strmsz_2;
+ streamsize strmsz_1;
int_type c1;
int_type c2;
@@ -66,7 +66,7 @@ void test05()
//beg
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
- strmsz_2 = fb.in_avail();
+ fb.in_avail();
off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc
index f8385b25a8a..3a8809da2f6 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test05()
typedef filebuf::traits_type traits_type;
bool test __attribute__((unused)) = true;
- streamsize strmsz_1, strmsz_2;
+ streamsize strmsz_1;
int_type c1;
int_type c2;
@@ -66,7 +66,7 @@ void test05()
//beg
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
- strmsz_2 = fb.in_avail();
+ fb.in_avail();
off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
index 67a376e67c4..89fab2aed90 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test05()
typedef filebuf::off_type off_type;
bool test __attribute__((unused)) = true;
- streamsize strmsz_1, strmsz_2;
+ streamsize strmsz_1;
int_type c1;
int_type c2;
@@ -66,7 +66,7 @@ void test05()
//beg
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
- strmsz_2 = fb.in_avail();
+ fb.in_avail();
off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc
index e1e98261f22..b1ad66e8933 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test05()
typedef filebuf::traits_type traits_type;
bool test __attribute__((unused)) = true;
- streamsize strmsz_1, strmsz_2;
+ streamsize strmsz_1;
int_type c1;
int_type c2;
@@ -66,7 +66,7 @@ void test05()
//beg
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
- strmsz_2 = fb.in_avail();
+ fb.in_avail();
off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc
index 3b434ba7a52..42688e825e0 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -40,8 +40,8 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- test = (this->pbase() == NULL);
- test &= (this->pptr() == NULL);
+ test = (!this->pbase());
+ test &= (!this->pptr());
return test;
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/12875-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/12875-2.cc
index ff22967600e..b736b146070 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/12875-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/12875-2.cc
@@ -44,7 +44,7 @@ void test02()
FILE* in = fopen(name, "r");
char str[256];
- fgets(str, 256, in);
+ VERIFY( fgets(str, 256, in) );
VERIFY( !strcmp(str, "Hello, world") );
fclose(in);
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc
index e24941e06af..fd332b68365 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -40,7 +40,7 @@ void test05()
streamsize strmsz_1, strmsz_2;
char carray2[8192] = "";
- int_type c2, c4;
+ int_type c2;
// streamsize sgetn(char_type *s, streamsize n)
// streamsize xsgetn(char_type *s, streamsize n)
@@ -63,7 +63,7 @@ void test05()
strmsz_2 = fb_02.sgetn(carray2, strmsz_1 + 5);
VERIFY( strmsz_1 == -1 );
VERIFY( strmsz_2 == 0 );
- c4 = fb_02.sgetc();
+ fb_02.sgetc();
VERIFY( fb_02.unbuffered() );
VERIFY( !fb_02.read_position() );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc
index 4fd2d47130e..a2368f93203 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc
index 89ec0e53d1f..c84a079d298 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sputn/char/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc
index 07b971ec5c4..54a1372b467 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test01()
bool test __attribute__((unused)) = true;
streamsize strmsz_1, strmsz_2;
- int_type c1, c2, c3;
+ int_type c1, c2;
// int_type sungetc()
// if in_cur not avail, return pbackfail(), else decrement and
@@ -56,7 +56,7 @@ void test01()
fb_01.sputc('u');
fb_01.sputc('v');
fb_01.pubseekoff(-1, std::ios_base::end);
- c3 = fb_01.sbumpc();
+ fb_01.sbumpc();
strmsz_1 = fb_01.in_avail();
c2 = fb_01.sungetc();
strmsz_2 = fb_01.in_avail();
@@ -68,7 +68,7 @@ void test01()
c1 = fb_01.sgetc();
c2 = fb_01.sungetc();
strmsz_2 = fb_01.in_avail(); // 1
- c3 = fb_01.sgetc();
+ fb_01.sgetc();
VERIFY( c1 != c2 );
VERIFY( strmsz_2 != strmsz_1 );
VERIFY( strmsz_2 == 1 );
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/2-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/2-io.cc
index 753154ea0ae..782a83db91d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/2-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/sungetc/char/2-io.cc
@@ -1,6 +1,6 @@
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ void test01()
bool test __attribute__((unused)) = true;
streamsize strmsz_1, strmsz_2;
- int_type c1, c2, c3;
+ int_type c1, c2;
// int_type sungetc()
// if in_cur not avail, return pbackfail(), else decrement and
@@ -56,7 +56,7 @@ void test01()
fb_01.sputc('u');
fb_01.sputc('v');
fb_01.pubseekoff(-1, std::ios_base::end);
- c3 = fb_01.sbumpc();
+ fb_01.sbumpc();
strmsz_1 = fb_01.in_avail();
c2 = fb_01.sungetc();
strmsz_2 = fb_01.in_avail();
@@ -68,7 +68,7 @@ void test01()
c1 = fb_01.sgetc();
c2 = fb_01.sungetc();
strmsz_2 = fb_01.in_avail(); // 1
- c3 = fb_01.sgetc();
+ fb_01.sgetc();
VERIFY( c1 != c2 );
VERIFY( strmsz_2 != strmsz_1 );
VERIFY( strmsz_2 == 1 );
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-2.cc
index ff1cc405bd3..f6a2eaca94b 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-2.cc
@@ -161,7 +161,7 @@ void test02()
const char* name = "tmp_11544-2";
FILE* f = fopen(name, "w");
- fwrite("aaaab", 1, 5, f);
+ VERIFY( fwrite("aaaab", 1, 5, f) == 5 );
fclose(f);
wifstream in;
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc
index 5ac2cc08ccb..b65d0890064 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc
@@ -1,6 +1,6 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -35,7 +35,7 @@ void test01()
iostate iostate02, iostate03;
const iostate iostate01 = std::ios_base::badbit | std::ios_base::eofbit;
- std::ios ios_01(NULL);
+ std::ios ios_01(0);
// bool fail() const
VERIFY( ios_01.fail() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
index 9150d1126bd..0cf07f212b8 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
@@ -1,6 +1,6 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -35,8 +35,8 @@ void test02()
// basic_ios& copyfmt(const basic_ios& rhs)
{
- std::ios ios_01(NULL);
- std::ios ios_02(NULL);
+ std::ios ios_01(0);
+ std::ios ios_02(0);
ios_01.exceptions(std::ios_base::eofbit);
ios_02.exceptions(std::ios_base::eofbit);
@@ -49,8 +49,8 @@ void test02()
}
{
- std::ios ios_01(NULL);
- std::ios ios_02(NULL);
+ std::ios ios_01(0);
+ std::ios ios_02(0);
ios_01.clear(std::ios_base::eofbit);
ios_02.exceptions(std::ios_base::eofbit);
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
index 0a171a6fc54..79390eaca1c 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
@@ -2,7 +2,7 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -37,8 +37,8 @@ void test03()
typedef std::ios_base::iostate iostate;
locale loc_c = locale::classic();
locale loc_de = locale("de_DE");
- std::ios ios_01(NULL);
- std::ios ios_02(NULL);
+ std::ios ios_01(0);
+ std::ios ios_02(0);
ios_01.imbue(loc_c);
ios_02.imbue(loc_de);
ios_02.setstate(ios_base::badbit);
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
index 03f70c89458..f0494bd458d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
@@ -1,6 +1,6 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -35,13 +35,13 @@ void test01()
// iostate exceptions() const
iostate iostate02;
{
- std::ios ios_01(NULL);
+ std::ios ios_01(0);
VERIFY( ios_01.exceptions() == std::ios_base::goodbit );
}
// void exceptions(iostate except)
{
- std::ios ios_01(NULL);
+ std::ios ios_01(0);
try {
ios_01.exceptions(std::ios_base::eofbit);
}
@@ -53,7 +53,7 @@ void test01()
}
{
- std::ios ios_01(NULL);
+ std::ios ios_01(0);
ios_01.clear(std::ios_base::eofbit);
try {
ios_01.exceptions(std::ios_base::eofbit);
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc
index 3d5bf772434..20de8a95708 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc
@@ -1,6 +1,6 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,7 +29,7 @@ void test01()
bool test __attribute__((unused)) = true;
const std::locale c_loc = std::locale::classic();
- std::ios ios_01(NULL);
+ std::ios ios_01(0);
std::ios::char_type ct01;
std::ios::char_type ct02('x');;
diff --git a/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc b/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc
index 4aec0e3cad3..44fe41323c7 100644
--- a/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc
@@ -1,7 +1,7 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009
+// 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,7 +34,7 @@ void test07()
try
{
- gnu_iostr obj(NULL);
+ gnu_iostr obj(0);
}
catch(std::exception& obj)
{
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/cons/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/cons/3.cc
index 4162f9e68aa..3b2cb845e08 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/cons/3.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/cons/3.cc
@@ -1,6 +1,7 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+// 2005, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +34,7 @@ void test07()
typedef std::basic_istream<__gnu_test::pod_ushort> gnu_istr;
try
- { gnu_istr obj(NULL); }
+ { gnu_istr obj(0); }
catch(std::exception& obj)
{
test = false;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc
index 619751506ab..a8d91695b07 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc
@@ -1,6 +1,7 @@
// 1999-04-12 bkoz
-// Copyright (C) 1999, 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2002, 2003, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -35,7 +36,7 @@ std::stringbuf isbuf_02(str_02, std::ios_base::in);
std::stringbuf isbuf_03(str_03, std::ios_base::in);
std::stringbuf isbuf_04(str_04, std::ios_base::in);
-std::istream is_01(NULL);
+std::istream is_01(0);
std::istream is_02(&isbuf_02);
std::istream is_03(&isbuf_03);
std::istream is_04(&isbuf_04);
@@ -61,11 +62,8 @@ bool test01() {
long double ld1 = 0;
// process alphanumeric versions of bool values
- std::ios_base::fmtflags fmt = is_02.flags();
- bool testfmt = fmt & std::ios_base::boolalpha;
is_02.setf(std::ios_base::boolalpha);
- fmt = is_02.flags();
- testfmt = fmt & std::ios_base::boolalpha;
+ is_02.flags();
is_02 >> b1;
VERIFY( b1 == 1 );
is_02 >> b1;
@@ -73,8 +71,7 @@ bool test01() {
// process numeric versions of of bool values
is_02.unsetf(std::ios_base::boolalpha);
- fmt = is_02.flags();
- testfmt = fmt & std::ios_base::boolalpha;
+ is_02.flags();
is_02 >> b1;
VERIFY( b1 == 0 );
is_02 >> b1;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc
index f0d1635da1b..5d7ec97a59b 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,7 +33,7 @@ std::wstringbuf isbuf_02(str_02, std::ios_base::in);
std::wstringbuf isbuf_03(str_03, std::ios_base::in);
std::wstringbuf isbuf_04(str_04, std::ios_base::in);
-std::wistream is_01(NULL);
+std::wistream is_01(0);
std::wistream is_02(&isbuf_02);
std::wistream is_03(&isbuf_03);
std::wistream is_04(&isbuf_04);
@@ -59,11 +59,8 @@ bool test01() {
long double ld1 = 0;
// process alphanumeric versions of bool values
- std::ios_base::fmtflags fmt = is_02.flags();
- bool testfmt = fmt & std::ios_base::boolalpha;
is_02.setf(std::ios_base::boolalpha);
- fmt = is_02.flags();
- testfmt = fmt & std::ios_base::boolalpha;
+ is_02.flags();
is_02 >> b1;
VERIFY( b1 == 1 );
is_02 >> b1;
@@ -71,8 +68,7 @@ bool test01() {
// process numeric versions of of bool values
is_02.unsetf(std::ios_base::boolalpha);
- fmt = is_02.flags();
- testfmt = fmt & std::ios_base::boolalpha;
+ is_02.flags();
is_02 >> b1;
VERIFY( b1 == 0 );
is_02 >> b1;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc
index c6fba2f2001..7e4387d315d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/1.cc
@@ -1,6 +1,6 @@
// 1999-07-26 bkoz
-// Copyright (C) 1999, 2003, 2005, 2009 Free Software Foundation
+// Copyright (C) 1999, 2003, 2005, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,7 +32,7 @@ void test01()
std::stringbuf isbuf_01(std::ios_base::in);
std::stringbuf isbuf_02(str_02, std::ios_base::in);
- std::istream is_01(NULL);
+ std::istream is_01(0);
std::istream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc
index edff0307194..812d5413412 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/2.cc
@@ -1,6 +1,6 @@
// 1999-07-26 bkoz
-// Copyright (C) 1999, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,7 +34,7 @@ void test02()
std::stringbuf isbuf_01(std::ios_base::in);
std::stringbuf isbuf_02(str_02, std::ios_base::in);
- std::istream is_01(NULL);
+ std::istream is_01(0);
std::istream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
statefail = std::ios_base::failbit;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc
index cfaf5b11b61..551cb111a49 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/3.cc
@@ -1,6 +1,6 @@
// 1999-07-26 bkoz
-// Copyright (C) 1999, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,7 +32,7 @@ void test01()
std::stringbuf isbuf_01(std::ios_base::in);
std::stringbuf isbuf_02(str_02, std::ios_base::in);
- std::istream is_01(NULL);
+ std::istream is_01(0);
std::istream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc
index 224d0565f3a..a2e480ebce6 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc
@@ -1,6 +1,6 @@
// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,7 +39,7 @@ void test02()
sstr >> str;
// 2
- pod_char* chr = NULL;
+ pod_char* chr = 0;
sstr >> chr;
// 3
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc
index 2b428037f6b..f7b749a5df0 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2005, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,7 +30,7 @@ void test01()
std::wstringbuf isbuf_01(std::ios_base::in);
std::wstringbuf isbuf_02(str_02, std::ios_base::in);
- std::wistream is_01(NULL);
+ std::wistream is_01(0);
std::wistream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc
index a6841198d83..a697ef2b256 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,7 +30,7 @@ void test02()
std::wstringbuf isbuf_01(std::ios_base::in);
std::wstringbuf isbuf_02(str_02, std::ios_base::in);
- std::wistream is_01(NULL);
+ std::wistream is_01(0);
std::wistream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
statefail = std::ios_base::failbit;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc
index 3ba355d6452..6ea22e395de 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,7 +30,7 @@ void test01()
std::wstringbuf isbuf_01(std::ios_base::in);
std::wstringbuf isbuf_02(str_02, std::ios_base::in);
- std::wistream is_01(NULL);
+ std::wistream is_01(0);
std::wistream is_02(&isbuf_02);
std::ios_base::iostate state1, state2, statefail;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc
index ecc50826f9e..854dc7c8565 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/1.cc
@@ -1,6 +1,7 @@
// 1999-07-28 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -41,7 +42,7 @@ void test01()
std::stringbuf isbuf_04(str_02, std::ios_base::in);
std::stringbuf isbuf_05(str_02, std::ios_base::in | std::ios_base::out);
- std::istream is_00(NULL);
+ std::istream is_00(0);
std::istream is_01(&isbuf_01);
std::istream is_02(&isbuf_02);
std::istream is_03(&isbuf_03);
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
index beab22c0a21..96ba7193021 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,7 +28,7 @@ void test2()
{
bool test __attribute__((unused)) = true;
istringstream stream;
- stream >> static_cast<streambuf*>(NULL);
+ stream >> static_cast<streambuf*>(0);
VERIFY(stream.rdstate() & ios_base::failbit);
}
@@ -40,7 +40,7 @@ void test4()
try
{
- stream >> static_cast<streambuf*>(NULL);
+ stream >> static_cast<streambuf*>(0);
VERIFY(false);
}
catch (ios_base::failure&)
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc
index 809c0083502..eab6650b1ac 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -38,7 +38,7 @@ void test01()
std::wstringbuf isbuf_04(str_02, std::ios_base::in);
std::wstringbuf isbuf_05(str_02, std::ios_base::in | std::ios_base::out);
- std::wistream is_00(NULL);
+ std::wistream is_00(0);
std::wistream is_01(&isbuf_01);
std::wistream is_02(&isbuf_02);
std::wistream is_03(&isbuf_03);
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
index eddef0ae43e..bc04b7d9b22 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,7 +28,7 @@ void test2()
{
bool test __attribute__((unused)) = true;
wistringstream stream;
- stream >> static_cast<wstreambuf*>(NULL);
+ stream >> static_cast<wstreambuf*>(0);
VERIFY( stream.rdstate() & ios_base::failbit );
}
@@ -40,7 +40,7 @@ void test4()
try
{
- stream >> static_cast<wstreambuf*>(NULL);
+ stream >> static_cast<wstreambuf*>(0);
VERIFY( false );
}
catch (ios_base::failure&)
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc
index 19169d97934..f7957d8a51c 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/get/char/1.cc
@@ -1,6 +1,7 @@
// 1999-08-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +42,7 @@ test03()
std::stringbuf sbuf_04(str01, std::ios_base::in);
std::stringbuf sbuf_05(str01, std::ios_base::in);
- std::istream is_00(NULL);
+ std::istream is_00(0);
std::istream is_04(&sbuf_04);
std::istream is_05(&sbuf_05);
std::ios_base::iostate statefail, stateeof;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/1.cc
index 7168aefcdbb..b3027c3af95 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/get/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,7 +39,7 @@ test03()
std::wstringbuf sbuf_04(str01, std::ios_base::in);
std::wstringbuf sbuf_05(str01, std::ios_base::in);
- std::wistream is_00(NULL);
+ std::wistream is_00(0);
std::wistream is_04(&sbuf_04);
std::wistream is_05(&sbuf_05);
std::ios_base::iostate statefail, stateeof;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc
index 67b1955fcd6..48b245f9b96 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/getline/char/1.cc
@@ -1,6 +1,7 @@
// 1999-08-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +42,7 @@ test02()
std::stringbuf sbuf_04(str01, std::ios_base::in);
- std::istream is_00(NULL);
+ std::istream is_00(0);
std::istream is_04(&sbuf_04);
std::ios_base::iostate state1, state2, statefail, stateeof;
statefail = std::ios_base::failbit;
@@ -54,7 +55,7 @@ test02()
is_00.getline(carray1, 20, '*');
state2 = is_00.rdstate();
// make sure failbit was set, since we couldn't extract
- // from the NULL streambuf...
+ // from the null streambuf...
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/1.cc
index 49305a33171..2445dd4f749 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,7 +39,7 @@ test02()
std::wstringbuf sbuf_04(str01, std::ios_base::in);
- std::wistream is_00(NULL);
+ std::wistream is_00(0);
std::wistream is_04(&sbuf_04);
std::ios_base::iostate state1, state2, statefail, stateeof;
statefail = std::ios_base::failbit;
@@ -52,7 +52,7 @@ test02()
is_00.getline(carray1, 20, L'*');
state2 = is_00.rdstate();
// make sure failbit was set, since we couldn't extract
- // from the NULL streambuf...
+ // from the null streambuf...
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc
index e70c1ab5fb2..4e0ce25aa32 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/char/1.cc
@@ -1,6 +1,7 @@
// 1999-08-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -36,12 +37,10 @@ test01()
std::stringbuf isbuf_03(str_02, std::ios_base::in);
std::stringbuf isbuf_04(str_02, std::ios_base::in);
- std::istream is_00(NULL);
+ std::istream is_00(0);
std::istream is_03(&isbuf_03);
std::istream is_04(&isbuf_04);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
+ std::ios_base::iostate state1, state2;
// istream& read(char_type* s, streamsize n)
char carray[60] = "";
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/1.cc
index 6254428d368..c4a7a33d002 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,12 +34,10 @@ test01()
std::wstringbuf isbuf_03(str_02, std::ios_base::in);
std::wstringbuf isbuf_04(str_02, std::ios_base::in);
- std::wistream is_00(NULL);
+ std::wistream is_00(0);
std::wistream is_03(&isbuf_03);
std::wistream is_04(&isbuf_04);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
+ std::ios_base::iostate state1, state2;
// istream& read(char_type* s, streamsize n)
wchar_t carray[60] = L"";
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc
index 6d501646ad6..39a3fdff396 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/1.cc
@@ -1,6 +1,7 @@
// 1999-08-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -36,12 +37,10 @@ test01()
std::stringbuf isbuf_03(str_02, std::ios_base::in);
std::stringbuf isbuf_04(str_02, std::ios_base::in);
- std::istream is_00(NULL);
+ std::istream is_00(0);
std::istream is_03(&isbuf_03);
std::istream is_04(&isbuf_04);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
+ std::ios_base::iostate state1, state2;
char carray[60] = "";
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/1.cc
index b4c0e32c46f..612e60600ff 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,12 +34,10 @@ test01()
std::wstringbuf isbuf_03(str_02, std::ios_base::in);
std::wstringbuf isbuf_04(str_02, std::ios_base::in);
- std::wistream is_00(NULL);
+ std::wistream is_00(0);
std::wistream is_03(&isbuf_03);
std::wistream is_04(&isbuf_04);
- std::ios_base::iostate state1, state2, statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
+ std::ios_base::iostate state1, state2;
wchar_t carray[60] = L"";
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc
index b9ebe7dfe9a..3879f7b422d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/read/char/1.cc
@@ -1,6 +1,6 @@
// 1999-08-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,7 +34,7 @@ test01()
std::stringbuf isbuf_03(str_02, std::ios_base::in);
std::stringbuf isbuf_04(str_02, std::ios_base::in);
- std::istream is_00(NULL);
+ std::istream is_00(0);
std::istream is_03(&isbuf_03);
std::istream is_04(&isbuf_04);
std::ios_base::iostate state1, state2, statefail, stateeof;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/read/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/read/wchar_t/1.cc
index 1485aa1abf0..508e0c8cb4d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/read/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/read/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -31,7 +31,7 @@ test01()
std::wstringbuf isbuf_03(str_02, std::ios_base::in);
std::wstringbuf isbuf_04(str_02, std::ios_base::in);
- std::wistream is_00(NULL);
+ std::wistream is_00(0);
std::wistream is_03(&isbuf_03);
std::wistream is_04(&isbuf_04);
std::ios_base::iostate state1, state2, statefail, stateeof;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc
index 0fea44568d0..899a48d7842 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/8348-2.cc
@@ -1,6 +1,6 @@
// 2000-06-29 bkoz
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -35,7 +35,7 @@ void test06(void)
// seekg
{
istringstream iss(num1);
- istream::pos_type pos1 = iss.tellg();
+ iss.tellg();
int asNum = 0;
iss >> asNum;
VERIFY( test = iss.eof() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/8348-2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/8348-2.cc
index ec09e45c96d..d428a88ba41 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/8348-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/8348-2.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,7 +32,7 @@ void test06(void)
// seekg
{
wistringstream iss(num1);
- wistream::pos_type pos1 = iss.tellg();
+ iss.tellg();
int asNum = 0;
iss >> asNum;
VERIFY( test = iss.eof() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc
index 1b8f18d72b1..e4b4914ef48 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/char/8348.cc
@@ -1,6 +1,6 @@
// 2000-06-29 bkoz
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -35,7 +35,7 @@ void test06(void)
// tellg
{
istringstream iss(num1);
- istream::pos_type pos1 = iss.tellg();
+ iss.tellg();
int asNum = 0;
iss >> asNum;
VERIFY( test = iss.eof() );
@@ -47,7 +47,7 @@ void test06(void)
// seekg
{
istringstream iss(num1);
- istream::pos_type pos1 = iss.tellg();
+ iss.tellg();
int asNum = 0;
iss >> asNum;
VERIFY( test = iss.eof() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/8348.cc b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/8348.cc
index cdbbd0cc6d1..61613817b4d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/8348.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/8348.cc
@@ -32,7 +32,7 @@ void test06(void)
// tellg
{
wistringstream iss(num1);
- wistream::pos_type pos1 = iss.tellg();
+ iss.tellg();
int asNum = 0;
iss >> asNum;
VERIFY( test = iss.eof() );
@@ -44,7 +44,7 @@ void test06(void)
// seekg
{
wistringstream iss(num1);
- wistream::pos_type pos1 = iss.tellg();
+ iss.tellg();
int asNum = 0;
iss >> asNum;
VERIFY( test = iss.eof() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc
index 703ccedac6d..b59d08839db 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ws/char/1.cc
@@ -1,6 +1,7 @@
// 1999-07-22 bkoz
-// Copyright (C) 1994, 1999, 2001, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1994, 1999, 2001, 2003, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -33,7 +34,6 @@ void test01(void)
std::string str02(str_lit01);
std::string str04;
std::string str05;
- std::ios_base::iostate flag3, flag4, flag5;
// template<_CharT, _Traits>
// basic_istream<_CharT, _Traits>& ws(basic_istream<_Char, _Traits>& is)
@@ -60,9 +60,6 @@ void test01(void)
VERIFY( str05 == "barbara" );
VERIFY( str05 == str04 );
- flag3 = std::ios_base::eofbit;
- flag4 = std::ios_base::badbit;
- flag5 = std::ios_base::failbit;
VERIFY( !iss01.fail() );
VERIFY( !iss02.fail() );
VERIFY( !iss01.eof() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ws/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ws/wchar_t/1.cc
index d00dce70e3e..8e60163c148 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/ws/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ws/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -31,7 +31,6 @@ void test01(void)
std::wstring str02(str_lit01);
std::wstring str04;
std::wstring str05;
- std::ios_base::iostate flag3, flag4, flag5;
// template<_CharT, _Traits>
// basic_istream<_CharT, _Traits>& ws(basic_istream<_Char, _Traits>& is)
@@ -58,9 +57,6 @@ void test01(void)
VERIFY( str05 == L"barbara" );
VERIFY( str05 == str04 );
- flag3 = std::ios_base::eofbit;
- flag4 = std::ios_base::badbit;
- flag5 = std::ios_base::failbit;
VERIFY( !iss01.fail() );
VERIFY( !iss02.fail() );
VERIFY( !iss01.eof() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc
index 04df562ffda..cb683666ccc 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc
@@ -1,7 +1,7 @@
// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
// Adpated from libstdc++/5347 submitted by markus.breuer@materna.de
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -51,10 +51,10 @@ main()
#endif
for (int i = 0; i < max_thread_count; i++)
- pthread_create (&tid[i], NULL, thread_main, 0);
+ pthread_create (&tid[i], 0, thread_main, 0);
for (int i = 0; i < max_thread_count; i++)
- pthread_join (tid[i], NULL);
+ pthread_join (tid[i], 0);
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/cons/2020.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/2020.cc
index 125440b0b20..07fb7b82eb2 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/cons/2020.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/2020.cc
@@ -1,6 +1,7 @@
// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,7 +35,7 @@ void test07()
try
{
- gnu_ostr obj(NULL);
+ gnu_ostr obj(0);
}
catch(std::exception& obj)
{
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc
index 8b85ca21cea..5ec21367b08 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/4.cc
@@ -1,6 +1,7 @@
// 1999-08-16 bkoz
-// Copyright (C) 1999, 2000, 2002, 2003, 2005, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2002, 2003, 2005, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -35,9 +36,6 @@ test04()
std::ostringstream oss_02(str_01, std::ios_base::out);
- std::ios_base::iostate statefail;
- statefail = std::ios_base::failbit;
-
// template<_CharT, _Traits>
// basic_ostream& operator<<(ostream&, const char*)
for (int i = 0; i < i_max; ++i)
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc
index 85af3666a3b..f38e2e703db 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/8.cc
@@ -1,6 +1,6 @@
// 1999-08-16 bkoz
-// Copyright (C) 1999, 2000, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2002, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,7 +27,7 @@
void test08()
{
bool test __attribute__((unused)) = true;
- char* pt = NULL;
+ char* pt = 0;
// 1
std::ostringstream oss;
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc
index cdcb3545c43..902539e8c20 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/4.cc
@@ -1,6 +1,6 @@
// 1999-08-16 bkoz
-// Copyright (C) 1999, 2000, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2002, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -35,9 +35,6 @@ test04()
std::wostringstream oss_02(str_01, std::ios_base::out);
- std::ios_base::iostate statefail;
- statefail = std::ios_base::failbit;
-
// template<_CharT, _Traits>
// basic_ostream& operator<<(ostream&, const wchar_t*)
for (int i = 0; i < i_max; ++i)
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc
index a414076b20a..76490b3c590 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/8.cc
@@ -1,6 +1,6 @@
// 1999-08-16 bkoz
-// Copyright (C) 1999, 2000, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2002, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,7 +27,7 @@
void test08()
{
bool test __attribute__((unused)) = true;
- char* pt = NULL;
+ char* pt = 0;
// 2
std::wostringstream woss;
@@ -40,7 +40,7 @@ void test08()
VERIFY( woss.good() );
// 3
- wchar_t* wt = NULL;
+ wchar_t* wt = 0;
woss.clear();
woss << wt;
VERIFY( woss.bad() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc
index c53c160f736..0c94c68156f 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc
@@ -1,7 +1,8 @@
// 1999-08-16 bkoz
// 1999-11-01 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
+// Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -46,7 +47,7 @@ test02()
// filebuf-> NULL
std::ifstream f_in1(name_01);
std::ofstream f_out1(name_02);
- std::stringbuf* strbuf01 = NULL;
+ std::stringbuf* strbuf01 = 0;
iostate state01 = f_in1.rdstate();
f_in1 >> strbuf01;
iostate state02 = f_in1.rdstate();
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
index 3e5dddc16e4..6d28c5f0459 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,7 +28,7 @@ void test1()
bool test __attribute__((unused)) = true;
ostringstream stream;
- stream << static_cast<streambuf*>(NULL);
+ stream << static_cast<streambuf*>(0);
VERIFY( stream.rdstate() & ios_base::badbit );
}
@@ -42,7 +42,7 @@ void test3()
try
{
- stream << static_cast<streambuf*>(NULL);
+ stream << static_cast<streambuf*>(0);
VERIFY( false );
}
catch (ios_base::failure&)
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc
index bde6ba5985c..6e12a65bfbe 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2005, 2009 Free Software Foundation
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ test02()
// filebuf-> NULL
std::wifstream f_in1(name_01);
std::wofstream f_out1(name_02);
- std::wstringbuf* strbuf01 = NULL;
+ std::wstringbuf* strbuf01 = 0;
iostate state01 = f_in1.rdstate();
f_in1 >> strbuf01;
iostate state02 = f_in1.rdstate();
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
index 5df2990fc5a..16f9108a332 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-require-swprintf "" }
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,7 +22,7 @@
#include <sstream>
#include <system_error>
#include <algorithm>
-#include <wchar.h>
+#include <cwchar>
#include <testsuite_hooks.h>
// Effects: os << ec.category().name() << ':' << ec.value();
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
index 7e5cd6ddb65..076aece6475 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,7 +28,7 @@ void test1()
bool test __attribute__((unused)) = true;
wostringstream stream;
- stream << static_cast<wstreambuf*>(NULL);
+ stream << static_cast<wstreambuf*>(0);
VERIFY( stream.rdstate() & ios_base::badbit );
}
@@ -42,7 +42,7 @@ void test3()
try
{
- stream << static_cast<wstreambuf*>(NULL);
+ stream << static_cast<wstreambuf*>(0);
VERIFY( false );
}
catch (ios_base::failure&)
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/pod/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/pod/1.cc
index 8a4088c95ba..00becef2587 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/pod/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/sentry/pod/1.cc
@@ -1,6 +1,7 @@
// 1999-10-14 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,7 +41,7 @@ void test01()
const string_type str01;
- stringbuf_type* strbuf01 = NULL;
+ stringbuf_type* strbuf01 = 0;
stringbuf_type strbuf02(str01);
ostream_type ostr01(strbuf01);
ostream_type ostr02(&strbuf02);
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc
index 81a8c96652d..5b87d84c022 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc
@@ -1,7 +1,7 @@
// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
// Adpated from libstdc++/5347 submitted by markus.breuer@materna.de
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -48,10 +48,10 @@ main()
#endif
for (int i = 0; i < max_thread_count; i++)
- pthread_create (&tid[i], NULL, thread_main, 0);
+ pthread_create (&tid[i], 0, thread_main, 0);
for (int i = 0; i < max_thread_count; i++)
- pthread_join (tid[i], NULL);
+ pthread_join (tid[i], 0);
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc
index 08ff1d2b9a1..5fe71886897 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/1.cc
@@ -1,6 +1,6 @@
// 2001-05-23 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,10 +30,6 @@ void test01()
const std::string str01 = "123";
std::string str02;
- std::ios_base::iostate statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
-
// string str() const
str02 = os01.str();
VERIFY( str00 == str02 );
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc
index ca8a69a5e3d..b66d8fa2524 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/str/wchar_t/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,10 +28,6 @@ void test01()
const std::wstring str01 = L"123";
std::wstring str02;
- std::ios_base::iostate statefail, stateeof;
- statefail = std::ios_base::failbit;
- stateeof = std::ios_base::eofbit;
-
// string str() const
str02 = os01.str();
VERIFY( str00 == str02 );
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc
index 918726c8778..65aff09ec27 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc
@@ -1,6 +1,7 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,12 +41,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/wchar_t/1.cc
index 384ea29afb0..30b67e4e6d1 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,12 +40,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc
index 37d729c92ad..cbf17820f38 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc
@@ -1,6 +1,7 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,12 +41,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc
index 16df0994dde..0c5c63f337d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,12 +40,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc
index be6145c6e6a..d1530b18f3f 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc
@@ -1,6 +1,7 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,12 +41,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/wchar_t/1.cc
index 948865c5a64..66b4af5d3e6 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,12 +40,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc
index 11cda23da15..440d82b5abe 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/char/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/wchar_t/1057.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/wchar_t/1057.cc
index d04be240824..5e7166fdd3d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/wchar_t/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputc/wchar_t/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc
index 0fe945eec61..2874b0eea4e 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc
@@ -1,6 +1,7 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -40,12 +41,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc
index 227a1c7a54a..dda78bde457 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1.cc
index b03ab172927..09b263b6c7b 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1.cc
@@ -1,6 +1,7 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -41,12 +42,12 @@ public:
check_pointers()
{
bool test __attribute__((unused)) = true;
- VERIFY( this->eback() == NULL );
- VERIFY( this->gptr() == NULL );
- VERIFY( this->egptr() == NULL );
- VERIFY( this->pbase() == NULL );
- VERIFY( this->pptr() == NULL );
- VERIFY( this->epptr() == NULL );
+ VERIFY( !this->eback() );
+ VERIFY( !this->gptr() );
+ VERIFY( !this->egptr() );
+ VERIFY( !this->pbase() );
+ VERIFY( !this->pptr() );
+ VERIFY( !this->epptr() );
return test;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1057.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1057.cc
index b40e24ce8a3..9b148bab93f 100644
--- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/wchar_t/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc
index 2763a01c3fc..f60911bdc43 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc
@@ -1,7 +1,7 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009
+// 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,14 +33,13 @@ std::stringbuf strb_03(str_03, std::ios_base::out);
void test04()
{
bool test __attribute__((unused)) = true;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::stringbuf::int_type int_type;
typedef std::stringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
// int_type sbumpc()
// if read_cur not avail, return uflow(), else return *read_cur & increment
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc
index 5b0f9862bfd..3ec279a19ef 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,14 +32,13 @@ std::wstringbuf strb_03(str_03, std::ios_base::out);
void test04()
{
bool test __attribute__((unused)) = true;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::wstringbuf::int_type int_type;
typedef std::wstringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
// int_type sbumpc()
// if read_cur not avail, return uflow(), else return *read_cur & increment
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
index ee983c256cc..142cde9c7f2 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -36,7 +36,7 @@ void test04()
typedef std::stringbuf::off_type off_type;
int_type c1 = strb_01.sbumpc();
- int_type c2, c3;
+ int_type c2;
// BUFFER MANAGEMENT & POSITIONING
@@ -84,7 +84,7 @@ void test04()
c1 = strb_01.sgetc();
c2 = strb_01.sungetc();
strmsz_2 = strb_01.in_avail(); // 1
- c3 = strb_01.sgetc();
+ strb_01.sgetc();
VERIFY( c1 != c2 );
VERIFY( strmsz_2 != strmsz_1 );
VERIFY( strmsz_2 == 1 );
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc
index 288e76cae8a..1b0ee5fe58f 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -36,7 +36,7 @@ void test04()
typedef std::wstringbuf::off_type off_type;
int_type c1 = strb_01.sbumpc();
- int_type c2, c3;
+ int_type c2;
// BUFFER MANAGEMENT & POSITIONING
@@ -84,7 +84,7 @@ void test04()
c1 = strb_01.sgetc();
c2 = strb_01.sungetc();
strmsz_2 = strb_01.in_avail(); // 1
- c3 = strb_01.sgetc();
+ strb_01.sgetc();
VERIFY( c1 != c2 );
VERIFY( strmsz_2 != strmsz_1 );
VERIFY( strmsz_2 == 1 );
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
index 4cdca1afc6e..53f98bf98c3 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,7 +34,6 @@ void test04()
typedef std::stringbuf::off_type off_type;
int_type c1 = strb_01.sbumpc();
- int_type c2;
int_type c3 = strb_01.sbumpc();
pos_type pt_1(off_type(-1));
@@ -58,7 +57,7 @@ void test04()
off_1 = off_type(pt_1);
c1 = strb_01.snextc(); //current in pointer +1
VERIFY( c1 == 'o' );
- c2 = strb_01.sputc('x'); //test current out pointer
+ strb_01.sputc('x'); //test current out pointer
str_tmp = std::string("myxonos. . . or what?");
VERIFY( strb_01.str() == str_tmp );
strb_01.pubsync(); //resets pointers
@@ -67,7 +66,7 @@ void test04()
VERIFY( off_1 == off_2 );
c3 = strb_01.snextc(); //current in pointer +1
VERIFY( c1 == c3 );
- c2 = strb_01.sputc('x'); //test current out pointer
+ strb_01.sputc('x'); //test current out pointer
str_tmp = std::string("myxonos. . . or what?");
VERIFY( strb_01.str() == str_tmp );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc
index 47414b9d0fd..bc01ea64064 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,7 +34,6 @@ void test04()
typedef std::wstringbuf::off_type off_type;
int_type c1 = strb_01.sbumpc();
- int_type c2;
int_type c3 = strb_01.sbumpc();
pos_type pt_1(off_type(-1));
@@ -58,7 +57,7 @@ void test04()
off_1 = off_type(pt_1);
c1 = strb_01.snextc(); //current in pointer +1
VERIFY( c1 == L'o' );
- c2 = strb_01.sputc(L'x'); //test current out pointer
+ strb_01.sputc(L'x'); //test current out pointer
str_tmp = std::wstring(L"myxonos. . . or what?");
VERIFY( strb_01.str() == str_tmp );
strb_01.pubsync(); //resets pointers
@@ -67,7 +66,7 @@ void test04()
VERIFY( off_1 == off_2 );
c3 = strb_01.snextc(); //current in pointer +1
VERIFY( c1 == c3 );
- c2 = strb_01.sputc(L'x'); //test current out pointer
+ strb_01.sputc(L'x'); //test current out pointer
str_tmp = std::wstring(L"myxonos. . . or what?");
VERIFY( strb_01.str() == str_tmp );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc
index e686ba24960..f26ec85c565 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/char/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,14 +32,13 @@ std::stringbuf strb_03(str_03, std::ios_base::out);
void test04()
{
bool test __attribute__((unused)) = true;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::stringbuf::int_type int_type;
typedef std::stringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
int_type c3 = strb_01.sbumpc();
int_type c4 = strb_02.sbumpc();
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/wchar_t/1.cc
index 181dba9fe56..98ca73d75fa 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetc/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,14 +32,13 @@ std::wstringbuf strb_03(str_03, std::ios_base::out);
void test04()
{
bool test __attribute__((unused)) = true;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::wstringbuf::int_type int_type;
typedef std::wstringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
int_type c3 = strb_01.sbumpc();
int_type c4 = strb_02.sbumpc();
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc
index 4348f74692f..2f077a508a9 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc
@@ -1,7 +1,7 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-// 2006, 2007, 2009
+// 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,20 +34,19 @@ void test04()
{
bool test __attribute__((unused)) = true;
std::streamsize strmsz_1, strmsz_2;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::stringbuf::int_type int_type;
typedef std::stringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
int_type c1 = strb_01.sbumpc();
int_type c2 = strb_02.sbumpc();
strb_01.sbumpc();
int_type c4 = strb_02.sbumpc();
- int_type c5 = strb_03.sbumpc();
+ strb_03.sbumpc();
// int_type sgetc()
// if read_cur not avail, return uflow(), else return *read_cur
@@ -55,13 +54,13 @@ void test04()
int_type c7 = strb_02.sgetc();
strb_01.sgetc();
strb_02.sgetc();
- c5 = strb_03.sgetc();
+ strb_03.sgetc();
// int_type snextc()
// calls sbumpc and if sbumpc != eof, return sgetc
c6 = strb_01.snextc();
c7 = strb_02.snextc();
- c5 = strb_03.snextc();
+ strb_03.snextc();
// streamsize sgetn(char_type *s, streamsize n)
// streamsize xsgetn(char_type *s, streamsize n)
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc
index 01a149eda45..5c917e10950 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc
@@ -1,7 +1,7 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009
+// 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,20 +34,19 @@ void test04()
{
bool test __attribute__((unused)) = true;
std::streamsize strmsz_1, strmsz_2;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::wstringbuf::int_type int_type;
typedef std::wstringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
int_type c1 = strb_01.sbumpc();
int_type c2 = strb_02.sbumpc();
strb_01.sbumpc();
int_type c4 = strb_02.sbumpc();
- int_type c5 = strb_03.sbumpc();
+ strb_03.sbumpc();
// int_type sgetc()
// if read_cur not avail, return uflow(), else return *read_cur
@@ -55,13 +54,13 @@ void test04()
int_type c7 = strb_02.sgetc();
strb_01.sgetc();
strb_02.sgetc();
- c5 = strb_03.sgetc();
+ strb_03.sgetc();
// int_type snextc()
// calls sbumpc and if sbumpc != eof, return sgetc
c6 = strb_01.snextc();
c7 = strb_02.snextc();
- c5 = strb_03.snextc();
+ strb_03.snextc();
// streamsize sgetn(char_type *s, streamsize n)
// streamsize xsgetn(char_type *s, streamsize n)
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc
index 960e6e9b17f..afe1dfa5750 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc
@@ -1,7 +1,7 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009
+// 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,14 +33,13 @@ std::stringbuf strb_03(str_03, std::ios_base::out);
void test04()
{
bool test __attribute__((unused)) = true;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::stringbuf::int_type int_type;
typedef std::stringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
strb_01.sbumpc();
strb_02.sbumpc();
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc
index 62d21a7dc81..0154594b689 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc
@@ -1,7 +1,7 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-// 2006, 2007, 2009
+// 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,14 +33,13 @@ std::wstringbuf strb_03(str_03, std::ios_base::out);
void test04()
{
bool test __attribute__((unused)) = true;
- std::streamoff strmof_1(-1), strmof_2;
typedef std::wstringbuf::int_type int_type;
typedef std::wstringbuf::traits_type traits_type;
// GET
- strmof_1 = strb_01.in_avail();
- strmof_2 = strb_02.in_avail();
- strmof_1 = strb_03.in_avail();
+ strb_01.in_avail();
+ strb_02.in_avail();
+ strb_03.in_avail();
strb_01.sbumpc();
strb_02.sbumpc();
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc
index c99c2aa1283..67358a3b911 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/char/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +33,6 @@ void test04()
{
bool test __attribute__((unused)) = true;
std::string str_tmp, str_tmp2;
- std::streamsize strmsz_1, strmsz_2;
typedef std::stringbuf::int_type int_type;
typedef std::stringbuf::traits_type traits_type;
@@ -44,27 +43,27 @@ void test04()
// PUT
strb_03.str(str_01); //reset
- std::string::size_type sz1 = strb_03.str().length();
- std::string::size_type sz2 = strb_03.str().length();
+ strb_03.str().length();
+ strb_03.str().length();
// streamsize sputn(const char_typs* s, streamsize n)
// write up to n chars to out_cur from s, returning number assigned
// NB *sputn will happily put '\0' into your stream if you give it a chance*
str_tmp = strb_03.str();
- sz1 = str_tmp.length();
- strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
- sz2 = strb_03.str().length();
- strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
- sz2 = strb_03.str().length();
+ str_tmp.length();
+ strb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ strb_03.str().length();
+ strb_03.sputn(", i wanna reach out and", 10);
+ strb_03.str().length();
str_tmp = strb_02.str();
- strmsz_1 = strb_02.sputn("racadabra", 10);
+ strb_02.sputn("racadabra", 10);
// PUTBACK
// int_type sputbackc(char_type c)
// if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
// otherwise decrements in_cur and returns *gptr()
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
str_tmp = strb_01.str();
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
@@ -76,7 +75,7 @@ void test04()
VERIFY( str_tmp.size() == str_tmp2.size() );
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
@@ -88,7 +87,7 @@ void test04()
VERIFY( str_tmp.size() == strb_01.str().size() );
// test for replacing char with identical one
strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
strb_01.sbumpc();
strb_01.sbumpc();
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
@@ -100,7 +99,7 @@ void test04()
VERIFY( strb_01.str() == str_01 );
VERIFY( str_01.size() == strb_01.str().size() );
//test for ios_base::out
- strmsz_2 = strb_03.in_avail();
+ strb_03.in_avail();
c4 = strb_03.sputbackc('x');
VERIFY( c4 == traits_type::eof() );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/wchar_t/1.cc
index f95a695dd00..e0c91a3b2c0 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputbackc/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +33,6 @@ void test04()
{
bool test __attribute__((unused)) = true;
std::wstring str_tmp, str_tmp2;
- std::streamsize strmsz_1, strmsz_2;
typedef std::wstringbuf::int_type int_type;
typedef std::wstringbuf::traits_type traits_type;
@@ -44,27 +43,27 @@ void test04()
// PUT
strb_03.str(str_01); //reset
- std::wstring::size_type sz1 = strb_03.str().length();
- std::wstring::size_type sz2 = strb_03.str().length();
+ strb_03.str().length();
+ strb_03.str().length();
// streamsize sputn(const char_typs* s, streamsize n)
// write up to n chars to out_cur from s, returning number assigned
// NB *sputn will happily put '\0' into your stream if you give it a chance*
str_tmp = strb_03.str();
- sz1 = str_tmp.length();
- strmsz_1 = strb_03.sputn(L"racadabras", 10);//"abracadabras or what?"
- sz2 = strb_03.str().length();
- strmsz_2 = strb_03.sputn(L", i wanna reach out and", 10);
- sz2 = strb_03.str().length();
+ str_tmp.length();
+ strb_03.sputn(L"racadabras", 10);//"abracadabras or what?"
+ strb_03.str().length();
+ strb_03.sputn(L", i wanna reach out and", 10);
+ strb_03.str().length();
str_tmp = strb_02.str();
- strmsz_1 = strb_02.sputn(L"racadabra", 10);
+ strb_02.sputn(L"racadabra", 10);
// PUTBACK
// int_type sputbackc(char_type c)
// if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
// otherwise decrements in_cur and returns *gptr()
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
str_tmp = strb_01.str();
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sputbackc(L'z');//"mykonos. . .zor what?"
@@ -76,7 +75,7 @@ void test04()
VERIFY( str_tmp.size() == str_tmp2.size() );
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sputbackc(L'z');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
@@ -88,7 +87,7 @@ void test04()
VERIFY( str_tmp.size() == strb_01.str().size() );
// test for replacing char with identical one
strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
strb_01.sbumpc();
strb_01.sbumpc();
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
@@ -100,7 +99,7 @@ void test04()
VERIFY( strb_01.str() == str_01 );
VERIFY( str_01.size() == strb_01.str().size() );
//test for ios_base::out
- strmsz_2 = strb_03.in_avail();
+ strb_03.in_avail();
c4 = strb_03.sputbackc(L'x');
VERIFY( c4 == traits_type::eof() );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc
index 06957dd1926..f88f28e39a1 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/char/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/wchar_t/1057.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/wchar_t/1057.cc
index 4b4216b883d..ae07ebf30ed 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/wchar_t/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputc/wchar_t/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc
index c05d289846d..c51f47a8d34 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/char/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/wchar_t/1057.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/wchar_t/1057.cc
index 33d1ad79afe..99f7a550993 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/wchar_t/1057.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sputn/wchar_t/1057.cc
@@ -1,6 +1,6 @@
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,7 @@ public:
nullsetpbuf()
{
setp(foo, foo + 64);
- setp(NULL, NULL);
+ setp(0, 0);
}
};
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc
index 5b1fcfca1d1..ae038e518c3 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/char/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == char
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +33,6 @@ void test04()
{
bool test __attribute__((unused)) = true;
std::string str_tmp;
- std::streamsize strmsz_1, strmsz_2;
typedef std::stringbuf::int_type int_type;
typedef std::stringbuf::traits_type traits_type;
@@ -44,47 +43,47 @@ void test04()
// PUT
strb_03.str(str_01); //reset
- std::string::size_type sz1 = strb_03.str().length();
- std::string::size_type sz2 = strb_03.str().length();
+ strb_03.str().length();
+ strb_03.str().length();
// streamsize sputn(const char_typs* s, streamsize n)
// write up to n chars to out_cur from s, returning number assigned
// NB *sputn will happily put '\0' into your stream if you give it a chance*
str_tmp = strb_03.str();
- sz1 = str_tmp.length();
- strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
- sz2 = strb_03.str().length();
- strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
- sz2 = strb_03.str().length();
+ str_tmp.length();
+ strb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ strb_03.str().length();
+ strb_03.sputn(", i wanna reach out and", 10);
+ strb_03.str().length();
str_tmp = strb_02.str();
- strmsz_1 = strb_02.sputn("racadabra", 10);
+ strb_02.sputn("racadabra", 10);
// PUTBACK
// int_type sputbackc(char_type c)
// if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
// otherwise decrements in_cur and returns *gptr()
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
str_tmp = strb_01.str();
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
c3 = strb_01.sgetc();
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
// test for replacing char with identical one
strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
strb_01.sbumpc();
strb_01.sbumpc();
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
c2 = strb_01.sputbackc('y');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
//test for ios_base::out
- strmsz_2 = strb_03.in_avail();
+ strb_03.in_avail();
c4 = strb_03.sputbackc('x');
// int_type sungetc()
@@ -92,7 +91,7 @@ void test04()
// return to_int_type(*gptr())
for (int i = 0; i<12; ++i)
strb_01.sbumpc();
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
str_tmp = strb_01.str();
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sungetc();//"mykonos. . . or what?"
@@ -105,7 +104,7 @@ void test04()
VERIFY( str_01.size() == strb_01.str().size() );
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sungetc();//"mykonos. . . or what?"
c3 = strb_01.sgetc();
@@ -117,7 +116,7 @@ void test04()
VERIFY( str_01.size() == strb_01.str().size() );
// test for replacing char with identical one
strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
strb_01.sbumpc();
strb_01.sbumpc();
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
@@ -129,7 +128,7 @@ void test04()
VERIFY( strb_01.str() == str_01 );
VERIFY( str_01.size() == strb_01.str().size() );
//test for ios_base::out
- strmsz_2 = strb_03.in_avail();
+ strb_03.in_avail();
c4 = strb_03.sungetc();
VERIFY( c4 == traits_type::eof() );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/wchar_t/1.cc
index 360a1abb2d0..767b7eac50d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sungetc/wchar_t/1.cc
@@ -1,6 +1,6 @@
// 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,7 +33,6 @@ void test04()
{
bool test __attribute__((unused)) = true;
std::wstring str_tmp;
- std::streamsize strmsz_1, strmsz_2;
typedef std::wstringbuf::int_type int_type;
typedef std::wstringbuf::traits_type traits_type;
@@ -44,47 +43,47 @@ void test04()
// PUT
strb_03.str(str_01); //reset
- std::wstring::size_type sz1 = strb_03.str().length();
- std::wstring::size_type sz2 = strb_03.str().length();
+ strb_03.str().length();
+ strb_03.str().length();
// streamsize sputn(const char_typs* s, streamsize n)
// write up to n chars to out_cur from s, returning number assigned
// NB *sputn will happily put '\0' into your stream if you give it a chance*
str_tmp = strb_03.str();
- sz1 = str_tmp.length();
- strmsz_1 = strb_03.sputn(L"racadabras", 10);//"abracadabras or what?"
- sz2 = strb_03.str().length();
- strmsz_2 = strb_03.sputn(L", i wanna reach out and", 10);
- sz2 = strb_03.str().length();
+ str_tmp.length();
+ strb_03.sputn(L"racadabras", 10);//"abracadabras or what?"
+ strb_03.str().length();
+ strb_03.sputn(L", i wanna reach out and", 10);
+ strb_03.str().length();
str_tmp = strb_02.str();
- strmsz_1 = strb_02.sputn(L"racadabra", 10);
+ strb_02.sputn(L"racadabra", 10);
// PUTBACK
// int_type sputbackc(char_type c)
// if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
// otherwise decrements in_cur and returns *gptr()
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
str_tmp = strb_01.str();
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
c3 = strb_01.sgetc();
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sputbackc(L'z');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
// test for replacing char with identical one
strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
strb_01.sbumpc();
strb_01.sbumpc();
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
c2 = strb_01.sputbackc(L'y');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
//test for ios_base::out
- strmsz_2 = strb_03.in_avail();
+ strb_03.in_avail();
c4 = strb_03.sputbackc(L'x');
// int_type sungetc()
@@ -92,7 +91,7 @@ void test04()
// return to_int_type(*gptr())
for (int i = 0; i<12; ++i)
strb_01.sbumpc();
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
str_tmp = strb_01.str();
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sungetc();//"mykonos. . . or what?"
@@ -105,7 +104,7 @@ void test04()
VERIFY( str_01.size() == strb_01.str().size() );
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sungetc();//"mykonos. . . or what?"
c3 = strb_01.sgetc();
@@ -117,7 +116,7 @@ void test04()
VERIFY( str_01.size() == strb_01.str().size() );
// test for replacing char with identical one
strb_01.str(str_01); //reset
- strmsz_1 = strb_01.in_avail();
+ strb_01.in_avail();
strb_01.sbumpc();
strb_01.sbumpc();
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
@@ -129,7 +128,7 @@ void test04()
VERIFY( strb_01.str() == str_01 );
VERIFY( str_01.size() == strb_01.str().size() );
//test for ios_base::out
- strmsz_2 = strb_03.in_avail();
+ strb_03.in_avail();
c4 = strb_03.sungetc();
VERIFY( c4 == traits_type::eof() );
}
diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/2.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/2.cc
index 46f0d1276fe..accb5653503 100644
--- a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/2.cc
+++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/2.cc
@@ -1,6 +1,6 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2001, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2001, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -60,7 +60,6 @@ void test02()
pos04 += off02;
VERIFY( pos03 == pos04 );
std::streampos pos05 = pos03;
- std::streampos pos06 = pos03 + off02;
VERIFY ( pos05 == pos03 );
// q = p - o
@@ -69,7 +68,6 @@ void test02()
pos04 -= off02;
VERIFY( pos03 == pos04 );
std::streampos pos07 = pos03;
- std::streampos pos08 = pos03 - off02;
VERIFY ( pos07 == pos03 );
// o = p - q
diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc
index abef0074ac6..34c557bfb16 100644
--- a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc
+++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc
@@ -1,6 +1,6 @@
// 1999-09-20 bkoz
-// Copyright (C) 1999, 2001, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2001, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,6 +34,7 @@ void test03()
// casts to const streamoff
const std::streampos pos01 = 0;
off01 = std::streamoff(pos01);
+ off01 = off01; // Suppress unused warning.
// equality/inequality with const args
const std::streampos pos02(54);
diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc
index 5c89aa5a361..9e3cad5d59e 100644
--- a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc
+++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2009
+// Copyright (C) 2003, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,6 +32,8 @@ void test04()
// Explicit conversion
n = static_cast<long>(pos); // { dg-error "invalid static_cast" "" { xfail *-*-* } }
+
+ n = n; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/5.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/5.cc
index 831bfd453fc..a32e34adfac 100644
--- a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/5.cc
+++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/5.cc
@@ -2,7 +2,7 @@
// 2006-03-13 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,7 +32,9 @@ void test01()
test01 = pos01 == -1;
test01 = -1 == pos01;
+ test01 = test01; // Suppress unused warning.
test02 = pos02 != -1;
test02 = -1 != pos02;
+ test02 = test02; // Suppress unused warning.
}
diff --git a/libstdc++-v3/testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc b/libstdc++-v3/testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc
index 8ba12fb7ea6..b59638fc341 100644
--- a/libstdc++-v3/testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cinttypes> // { dg-excess-errors "In file included from" }
+#include <cinttypes>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
index 7b3ee83df91..ddb29c5efc7 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
@@ -1,6 +1,6 @@
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,6 +34,8 @@ void allocate_on_stack(void)
__extension__ char array[num];
for (size_t i = 0; i < num; i++)
array[i]=0;
+ for (size_t i = 0; i < num; i++)
+ array[i]=array[i]; // Suppress unused warning.
}
void test04()
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc
index 7ed97c2b81b..29ec9754870 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc
@@ -41,7 +41,7 @@ void
test01()
{
std::ios_base::sync_with_stdio();
- std::freopen("ios_base_members_static-1.txt", "w", stderr);
+ VERIFY( std::freopen("ios_base_members_static-1.txt", "w", stderr) );
for (int i = 0; i < 2; i++)
{
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/10.cc b/libstdc++-v3/testsuite/27_io/objects/char/10.cc
index a744e787ac6..eebebc20e30 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/10.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/10.cc
@@ -1,6 +1,6 @@
// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
-// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,7 +32,7 @@ void test10()
const char* name = "filebuf_virtuals-1.txt";
FILE* ret = freopen(name, "r", stdin);
- VERIFY( ret != NULL );
+ VERIFY( ret );
streampos p1 = cin.tellg();
VERIFY( p1 != streampos(-1) );
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc
index 2c6bbd60403..e4982c5e768 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc
@@ -28,7 +28,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
char c1;
char c2;
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc
index 23ab8eea888..f18e5d393c7 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc
@@ -24,7 +24,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
char c1;
int c2;
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc
index 5158003410e..3b83ef176cd 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc
@@ -25,7 +25,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
char buf[2];
VERIFY( std::cin.rdbuf()->sgetn(buf, 2) == 2 );
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc
index 02f73b6211c..0f8600dbb40 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc
@@ -24,7 +24,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
char buf[2];
VERIFY( std::cin.rdbuf()->sgetn(buf, 2) == 2 );
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc
index 0a0159f82c2..dd544b7370e 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc
@@ -33,7 +33,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
char c1;
int c2;
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5268.cc b/libstdc++-v3/testsuite/27_io/objects/char/5268.cc
index 44f569c85e6..b7c0ac1df3d 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/5268.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5268.cc
@@ -1,6 +1,6 @@
// 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,7 +27,7 @@ void test04()
std::stringbuf b1;
std::cout.rdbuf( &b1 );
std::cout << "hello\n";
- std::cout.rdbuf(NULL);
+ std::cout.rdbuf(0);
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9.cc b/libstdc++-v3/testsuite/27_io/objects/char/9.cc
index 1ba5bd12d53..e4905bb46f2 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/9.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/9.cc
@@ -34,7 +34,7 @@ void test09()
fputs("abc\n", fout);
fclose(fout);
- freopen(name, "r", stdin);
+ VERIFY( freopen(name, "r", stdin) );
// basic_streambuf::showmanyc returns 0.
VERIFY( 0 == std::cin.rdbuf()->in_avail() );
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
index 59b8f4d09c5..8ca77c76e75 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
@@ -3,7 +3,7 @@
// 2003-04-30 Petur Runolfsson <peturr02@ru.is>
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -58,7 +58,7 @@ bool test01()
if (child == 0)
{
FILE* file = fopen(name, "r+");
- VERIFY( file != NULL );
+ VERIFY( file != 0 );
fputs("Whatever\n", file);
fflush(file);
s1.signal();
@@ -68,7 +68,7 @@ bool test01()
exit(0);
}
- freopen(name, "r", stdin);
+ VERIFY( freopen(name, "r", stdin) );
s1.wait();
int c1 = fgetc(stdin);
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc
index 672f0c15439..c5a198a34ee 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc
@@ -95,7 +95,7 @@ void test10()
VERIFY( n == e_size );
fclose(file);
- freopen(name, "r", stdin);
+ VERIFY( freopen(name, "r", stdin) );
wchar_t* wbuf = new wchar_t[i_size + 10];
wcin.read(wbuf, i_size + 10);
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc
index c9c386f4707..566fdb6be17 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc
@@ -90,7 +90,7 @@ void test11()
};
size_t i_size = wcslen(i_lit);
- freopen(name, "w", stdout);
+ VERIFY( freopen(name, "w", stdout) );
wcout.write(i_lit, i_size);
wcout.flush();
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc
index 8489dbb47df..58a40ce91c0 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc
@@ -26,7 +26,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
wchar_t c1;
wchar_t c2;
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc
index 82c1ba2b3a3..7eaef212f07 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc
@@ -23,7 +23,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
wchar_t c1;
std::wint_t c2;
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc
index 67f3a5b8b5b..8e236ab30cf 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc
@@ -27,7 +27,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
wchar_t buf[2];
VERIFY( std::wcin.rdbuf()->sgetn(buf, 2) == 2 );
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc
index fc1191f9f2e..3649e7e2259 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc
@@ -23,7 +23,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
wchar_t buf[2];
VERIFY( std::wcin.rdbuf()->sgetn(buf, 2) == 2 );
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc
index 1672a0ee925..49486e3c450 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc
@@ -29,7 +29,7 @@
void
test01()
{
- std::freopen("cin_unget-1.txt", "r", stdin);
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
wchar_t c1;
std::wint_t c2;
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc
index 918d4c5d7d6..04571cc63ed 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc
@@ -1,6 +1,6 @@
// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
-// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,7 +27,7 @@ void test04()
std::wstringbuf b1;
std::wcout.rdbuf( &b1 );
std::wcout << L"hello\n";
- std::wcout.rdbuf(NULL);
+ std::wcout.rdbuf(0);
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc
index dcaf9bc2540..641d621ded5 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc
@@ -38,7 +38,7 @@ void test01()
locale loc (locale("de_DE.ISO-8859-15@euro"));
locale::global(loc); // Set locale for stdin
- freopen(name, "r", stdin);
+ VERIFY( freopen(name, "r", stdin) );
wcin.imbue(loc);
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
index 08d544ef6b3..ca470dac9eb 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
@@ -67,7 +67,7 @@ bool test01()
exit(0);
}
- freopen(name, "r", stdin);
+ VERIFY( freopen(name, "r", stdin) );
s1.wait();
wint_t c1 = fgetwc(stdin);
diff --git a/libstdc++-v3/testsuite/27_io/types/2.cc b/libstdc++-v3/testsuite/27_io/types/2.cc
index 009e6f6af8d..33db5fed156 100644
--- a/libstdc++-v3/testsuite/27_io/types/2.cc
+++ b/libstdc++-v3/testsuite/27_io/types/2.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2003, 2004, 2009 Free Software Foundation
+// Copyright (C) 2003, 2004, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,6 +30,7 @@ void test01()
// Wrapped in pos_type is EOF.
soff = -1;
+ soff = soff; // Suppress unused warning.
}
int main(void)
diff --git a/libstdc++-v3/testsuite/28_regex/03_requirements/typedefs.cc b/libstdc++-v3/testsuite/28_regex/03_requirements/typedefs.cc
new file mode 100644
index 00000000000..072d5d07f40
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/03_requirements/typedefs.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+
+#include <regex>
+
+void
+test01()
+{
+ typedef std::regex_traits<char> traits;
+
+ typedef traits::char_type char_type;
+ typedef traits::string_type string_type;
+ typedef traits::locale_type locale_type;
+ typedef traits::char_class_type char_class_type;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/04_header/regex/std_c++0x_neg.cc b/libstdc++-v3/testsuite/28_regex/04_header/regex/std_c++0x_neg.cc
new file mode 100644
index 00000000000..e8ddb77bbb3
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/04_header/regex/std_c++0x_neg.cc
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++98" }
+
+// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <regex> // { dg-excess-errors "In file included from" }
+
+
diff --git a/libstdc++-v3/testsuite/28_regex/05_constants/error_type.cc b/libstdc++-v3/testsuite/28_regex/05_constants/error_type.cc
new file mode 100644
index 00000000000..1841a462688
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/05_constants/error_type.cc
@@ -0,0 +1,54 @@
+// { dg-options "-std=c++0x" }
+// { dg-do compile }
+//
+// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.5.3
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex_constants::error_type err __attribute__((unused));
+
+ err = std::regex_constants::error_collate;
+ err = std::regex_constants::error_ctype;
+ err = std::regex_constants::error_escape;
+ err = std::regex_constants::error_backref;
+ err = std::regex_constants::error_brack;
+ err = std::regex_constants::error_paren;
+ err = std::regex_constants::error_brace;
+ err = std::regex_constants::error_badbrace;
+ err = std::regex_constants::error_range;
+ err = std::regex_constants::error_space;
+ err = std::regex_constants::error_badrepeat;
+ err = std::regex_constants::error_complexity;
+ err = std::regex_constants::error_stack;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/05_constants/match_flag_type.cc b/libstdc++-v3/testsuite/28_regex/05_constants/match_flag_type.cc
new file mode 100644
index 00000000000..10635ff5f7f
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/05_constants/match_flag_type.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=c++0x" }
+// { dg-do compile }
+//
+// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.5.1
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex_constants::match_flag_type flag = std::regex_constants::match_default;
+
+ flag |= std::regex_constants::match_not_bol;
+ flag |= std::regex_constants::match_not_eol;
+ flag |= std::regex_constants::match_not_bow;
+ flag |= std::regex_constants::match_not_eow;
+ flag |= std::regex_constants::match_any;
+ flag |= std::regex_constants::match_not_null;
+ flag |= std::regex_constants::match_continuous;
+ flag |= std::regex_constants::match_prev_avail;
+ flag |= std::regex_constants::format_default;
+ flag |= std::regex_constants::format_sed;
+ flag |= std::regex_constants::format_no_copy;
+ flag |= std::regex_constants::format_first_only;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc b/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc
new file mode 100644
index 00000000000..2aebf46d19e
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc
@@ -0,0 +1,51 @@
+// { dg-options "-std=c++0x" }
+// { dg-do compile }
+//
+// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.5.1
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex_constants::syntax_option_type option = 0;
+
+ option |= std::regex_constants::icase;
+ option |= std::regex_constants::nosubs;
+ option |= std::regex_constants::optimize;
+ option |= std::regex_constants::collate;
+ option |= std::regex_constants::ECMAScript;
+ option |= std::regex_constants::basic;
+ option |= std::regex_constants::extended;
+ option |= std::regex_constants::awk;
+ option |= std::regex_constants::grep;
+ option |= std::regex_constants::egrep;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/06_exception_type/regex_error.cc b/libstdc++-v3/testsuite/28_regex/06_exception_type/regex_error.cc
new file mode 100644
index 00000000000..04fd7124277
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/06_exception_type/regex_error.cc
@@ -0,0 +1,49 @@
+// { dg-options "-std=c++0x" }
+// { dg-do compile }
+//
+// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.6 [re.badexp]
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex_error error(std::regex_constants::error_collate);
+ VERIFY(error.code() == std::regex_constants::error_collate);
+
+ try
+ {
+ throw error;
+ }
+ catch (std::runtime_error& ex)
+ {
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/ctor.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/ctor.cc
new file mode 100644
index 00000000000..6f5a2f3ab8d
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/ctor.cc
@@ -0,0 +1,50 @@
+// { dg-do link }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.7] class template regex_traits
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests default constructor of the regex_traits class. There is only the
+// default constructor.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::regex_traits<char> test_type;
+
+ // required default constructor
+ test_type t;
+
+ // Check for required typedefs
+ typedef test_type::char_type char_type;
+ typedef test_type::string_type string_type;
+ typedef test_type::locale_type locale_type;
+ typedef test_type::char_class_type char_class_type;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/isctype.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/isctype.cc
new file mode 100644
index 00000000000..cb8664ca8bf
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/isctype.cc
@@ -0,0 +1,48 @@
+// { dg-do run { xfail *-*-* } }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2(4) Table 127 - Regular expression traits class requirements
+// 28.7(11) Class template regex_traits [re.traits]
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef char CharT;
+ typedef std::regex_traits<CharT> traits;
+
+ char name[] = "lower";
+ traits t;
+
+ VERIFY( t.isctype('e', t.lookup_classname(name, name+sizeof(name)-1)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/length.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/length.cc
new file mode 100644
index 00000000000..55406dd0ded
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/length.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 Class template regex_traits [re.traits]
+// 28.7 (3) static std::size_t length(const char_type* p);
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ typedef char CharT;
+ typedef std::regex_traits<CharT> traits;
+ bool test __attribute__((unused)) = true;
+ const CharT* p = "";
+
+ std::size_t i = traits::length(p);
+
+ VERIFY( i == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_classname.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_classname.cc
new file mode 100644
index 00000000000..49ffb511add
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_classname.cc
@@ -0,0 +1,54 @@
+// { dg-do run { xfail *-*-* } }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2(4) Table 127 - Regular expression traits class requirements
+// 28.7(9) Class template regex_traits [re.traits]
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef char CharT;
+ typedef std::regex_traits<CharT> traits;
+
+ char n1[] = "lower";
+ char n2[] = "alpha";
+ traits t;
+
+ traits::char_class_type c1 = t.lookup_classname(n1, n1+sizeof(n1)-1);
+ VERIFY( c1 != 0 );
+
+ traits::char_class_type c2 = t.lookup_classname(n1, n1+sizeof(n1)-1, true);
+ traits::char_class_type c3 = t.lookup_classname(n2, n2+sizeof(n2)-1, true);
+ VERIFY( c2 == c3 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_collatename.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_collatename.cc
new file mode 100644
index 00000000000..58eb5878de5
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/lookup_collatename.cc
@@ -0,0 +1,50 @@
+// { dg-do run { xfail *-*-* } }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 (8) Class template regex_traits [re.traits]
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef char CharT;
+ typedef std::regex_traits<CharT> traits;
+
+ char name[] = "ll";
+ traits t;
+
+ traits::string_type sname = t.lookup_collatename(name, name+sizeof(name)-1);
+
+ VERIFY( !sname.empty() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/transform.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/transform.cc
new file mode 100644
index 00000000000..1481dcfbb8c
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/transform.cc
@@ -0,0 +1,51 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 Class template regex_traits [re.traits]
+
+#include <regex>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef char CharT;
+ typedef std::regex_traits<CharT> traits;
+
+ traits t;
+ traits::string_type G = "abc";
+ traits::string_type H = "def";
+
+ VERIFY( G < H );
+ VERIFY( t.transform(G.begin(), G.end()) < t.transform(H.begin(), H.end()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/transform_primary.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/transform_primary.cc
new file mode 100644
index 00000000000..7de8904b49a
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/transform_primary.cc
@@ -0,0 +1,55 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run { xfail *-*-* } }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 Class template regex_traits [re.traits]
+
+#include <regex>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef char CharT;
+ typedef std::regex_traits<CharT> traits;
+
+ traits t;
+ traits::string_type G = "abc";
+ traits::string_type H = "def";
+ traits::string_type J = "ABC";
+
+ VERIFY( G < H );
+ VERIFY( t.transform_primary(G.begin(), G.end()) < t.transform_primary(H.begin(), H.end()) );
+
+ VERIFY( G == H );
+ VERIFY( t.transform_primary(G.begin(), G.end()) == t.transform_primary(J.begin(), J.end()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/translate.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/translate.cc
new file mode 100644
index 00000000000..2dbbba39637
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/translate.cc
@@ -0,0 +1,49 @@
+// { dg_do run }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 Class template regex_traits [re.traits]
+// 28.7 (3) static std::size_t length(const char_type* p);
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef char CharT;
+
+ std::regex_traits<CharT> t;
+ CharT c = 'a';
+ CharT d = 'a';
+
+ VERIFY( t.translate(c) == t.translate(d) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/translate_nocase.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/translate_nocase.cc
new file mode 100644
index 00000000000..4c963ddd3a5
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/translate_nocase.cc
@@ -0,0 +1,46 @@
+// { dg-do run }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.7] class template regex_traits (5) translate_nocase
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Verifies the workings of the regex_traits translate_nocase function.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef char CharT;
+
+ std::regex_traits<CharT> t;
+ CharT c = 'a';
+ CharT C = 'A';
+
+ VERIFY( t.translate_nocase(c) == t.translate_nocase(C) );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/char/value.cc b/libstdc++-v3/testsuite/28_regex/07_traits/char/value.cc
new file mode 100644
index 00000000000..f0535acb2cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/char/value.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+// { dg-options "-std=gnu++0x" }
+
+// 2008-08-11 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.7] class template regex_traits value() function
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests the value() function of the regex_traits<char> class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::regex_traits<char> t;
+ VERIFY( t.value('7', 8) == 7 );
+ VERIFY( t.value('7', 10) == 7 );
+ VERIFY( t.value('7', 16) == 7 );
+ VERIFY( t.value('9', 8) == -1 );
+ VERIFY( t.value('9', 10) == 9 );
+ VERIFY( t.value('9', 16) == 9 );
+ VERIFY( t.value('d', 8) == -1 );
+ VERIFY( t.value('d', 10) == -1 );
+ VERIFY( t.value('d', 16) == 13 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/ctor.cc b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/ctor.cc
new file mode 100644
index 00000000000..39caf432d32
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/ctor.cc
@@ -0,0 +1,49 @@
+// { dg-do link }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.7] class template regex_traits
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests default constructor of the regex_traits class. There is only the
+// default constructor.
+void test01()
+{
+ typedef std::regex_traits<wchar_t> test_type;
+
+ // required default constructor
+ test_type t;
+
+ // Check for required typedefs
+ typedef test_type::char_type char_type;
+ typedef test_type::string_type string_type;
+ typedef test_type::locale_type locale_type;
+ typedef test_type::char_class_type char_class_type;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/length.cc b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/length.cc
new file mode 100644
index 00000000000..c3cd7b60d0c
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/length.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 Class template regex_traits [re.traits]
+// 28.7 (3) static std::size_t length(const char_type* p);
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ typedef wchar_t CharT;
+ typedef std::regex_traits<CharT> traits;
+ bool test __attribute__((unused)) = true;
+ const CharT* p = L"";
+
+ std::size_t i = traits::length(p);
+
+ VERIFY( i == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/transform.cc b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/transform.cc
new file mode 100644
index 00000000000..c1f7af44d71
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/transform.cc
@@ -0,0 +1,51 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 Class template regex_traits [re.traits]
+
+#include <regex>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef wchar_t CharT;
+ typedef std::regex_traits<CharT> traits;
+
+ traits t;
+ traits::string_type G = L"abc";
+ traits::string_type H = L"def";
+
+ VERIFY( G < H );
+ VERIFY( t.transform(G.begin(), G.end()) < t.transform(H.begin(), H.end()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate.cc b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate.cc
new file mode 100644
index 00000000000..962c381520c
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.3 Requirements [re.req]
+// 28.2 (4) Table 127 - Regular expression traits class requirements
+// 28.7 Class template regex_traits [re.traits]
+// 28.7 (3) static std::size_t length(const char_type* p);
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef wchar_t CharT;
+
+ std::regex_traits<CharT> t;
+ CharT c = L'a';
+ CharT d = L'a';
+
+ VERIFY( t.translate(c) == t.translate(d) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate_nocase.cc b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate_nocase.cc
new file mode 100644
index 00000000000..5602cf00117
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/translate_nocase.cc
@@ -0,0 +1,46 @@
+// { dg-do run }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.7] class template regex_traits (5) translate_nocase
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Verifies the workings of the regex_traits translate_nocase function.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef wchar_t CharT;
+
+ std::regex_traits<CharT> t;
+ CharT c = L'a';
+ CharT C = L'A';
+
+ VERIFY( t.translate_nocase(c) == t.translate_nocase(C) );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/value.cc b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/value.cc
new file mode 100644
index 00000000000..f0535acb2cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/value.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+// { dg-options "-std=gnu++0x" }
+
+// 2008-08-11 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.7] class template regex_traits value() function
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests the value() function of the regex_traits<char> class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::regex_traits<char> t;
+ VERIFY( t.value('7', 8) == 7 );
+ VERIFY( t.value('7', 10) == 7 );
+ VERIFY( t.value('7', 16) == 7 );
+ VERIFY( t.value('9', 8) == -1 );
+ VERIFY( t.value('9', 10) == 9 );
+ VERIFY( t.value('9', 16) == 9 );
+ VERIFY( t.value('d', 8) == -1 );
+ VERIFY( t.value('d', 10) == -1 );
+ VERIFY( t.value('d', 16) == 13 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring.cc
new file mode 100644
index 00000000000..1552818e987
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2009-06-05 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// C++0X [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests assign operation from a C-style null-terminated-string.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::basic_regex<char> re;
+
+ const char* cs = "aab";
+ re.assign(cs);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring_op.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring_op.cc
new file mode 100644
index 00000000000..12353023b38
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/cstring_op.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests basic_regex assign operator from a C-style null-terminated-string.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ const char* cs = "aab";
+ test_type re;
+ re = cs;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/moveable.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/moveable.cc
new file mode 100644
index 00000000000..64f5bcac570
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/moveable.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-07-07 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3](9-11) class template basic_regex assign
+
+#include <regex>
+#include <testsuite_hooks.h>
+#include <utility>
+
+// Tests assign operator of the basic_regex class for moveable rvalues.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex src_re("aaba");
+ const unsigned mark_count = src_re.mark_count();
+ const std::regex::flag_type flags = src_re.flags();
+
+ std::regex target_re;
+
+ target_re.assign(std::move(src_re));
+
+ VERIFY( target_re.flags() == flags );
+ VERIFY( target_re.mark_count() == mark_count );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/pstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/pstring.cc
new file mode 100644
index 00000000000..398b66c6063
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/pstring.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests assign operation from a Pascal-style counted-string.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ const char cs[] = "aab";
+ test_type re;
+ re.assign(cs, sizeof(cs)-1, std::regex_constants::basic);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/range.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/range.cc
new file mode 100644
index 00000000000..cd741d5fff2
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/range.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests range assign of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ char s[] = "a+b|c";
+ test_type re;
+ re.assign(s, s + 5);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string.cc
new file mode 100644
index 00000000000..afa071eb312
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <string>
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests C++ string assignment of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ std::string s("a*b");
+ test_type re;
+ re.assign(s);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string_op.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string_op.cc
new file mode 100644
index 00000000000..724872decd5
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/char/string_op.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <string>
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests basic_regex assignment operator from a C++ string;
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ std::string s("a*b");
+ test_type re;
+ re = s;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring.cc
new file mode 100644
index 00000000000..20ccab01244
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests assign operation from a C-style null-terminated-string.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ const wchar_t* cs = L"aab";
+ test_type re;
+ re.assign(cs);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring_op.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring_op.cc
new file mode 100644
index 00000000000..8d8e9656d9e
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring_op.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests basic_regex assign operator from a C-style null-terminated-string.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ const wchar_t* cs = L"aab";
+ test_type re;
+ re = cs;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/pstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/pstring.cc
new file mode 100644
index 00000000000..9034a542c01
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/pstring.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests assign operation from a Pascal-style counted-string.
+void test01()
+{
+ typedef std::basic_regex<wchar_t> test_type;
+
+ const wchar_t cs[] = L"aab";
+ test_type re;
+ re.assign(cs, sizeof(cs)-1, std::regex_constants::basic);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/range.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/range.cc
new file mode 100644
index 00000000000..2e31a708417
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/range.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests range assign of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<wchar_t> test_type;
+ bool test __attribute__((unused)) = true;
+
+ wchar_t s[] = L"a+b|c";
+ test_type re;
+ re.assign(s, s + 5);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string.cc
new file mode 100644
index 00000000000..156374ac1a7
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string.cc
@@ -0,0 +1,45 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <string>
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests C++ string assignment of the basic_regex class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ std::wstring s(L"a*b");
+ test_type re;
+ re.assign(s);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string_op.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string_op.cc
new file mode 100644
index 00000000000..43704af2bd1
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/assign/wchar_t/string_op.cc
@@ -0,0 +1,45 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.3] class template basic_regex assign()
+
+#include <string>
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests basic_regex assignment operator from a C++ string;
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ std::wstring s(L"a*b");
+ test_type re;
+ re = s;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/cstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/cstring.cc
new file mode 100644
index 00000000000..b91453c0e77
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/cstring.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 7.8.2 basic_regex constructors
+
+#include <regex>
+
+void
+test01()
+{
+ std::regex re("(a|b)*abb", std::regex::basic);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_char.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_char.cc
new file mode 100644
index 00000000000..2f011fe52c4
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_char.cc
@@ -0,0 +1,42 @@
+// { dg-do run }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests Pascal-style counted-string constructor of the basic_regex class.
+void test01()
+{
+ const char* cs = "aab";
+ std::regex re(cs, 3, std::regex::basic);
+
+ VERIFY( re.flags() & std::regex_constants::basic );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_wchar_t.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_wchar_t.cc
new file mode 100644
index 00000000000..89deef6f19f
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/pstring_wchar_t.cc
@@ -0,0 +1,44 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests Pascal-style counted-string constructor of the basic_regex class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const wchar_t* cs = L"aab";
+ std::wregex re(cs, 3, std::wregex::basic);
+
+ VERIFY( re.flags() & std::regex_constants::basic );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/string_range_01_02_03.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/string_range_01_02_03.cc
new file mode 100644
index 00000000000..471c89c9024
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/basic/string_range_01_02_03.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run { xfail *-*-* } }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.8.2 basic_regex ctor
+// Tests for invalid range expression
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ try
+ {
+ std::regex re("a\\{1,2,3\\}", std::regex::basic);
+ }
+ catch (std::regex_error& ex)
+ {
+ VERIFY( ex.code() == std::regex_constants::error_badbrace );
+ }
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring.cc
new file mode 100644
index 00000000000..ac87e4d69a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring.cc
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests C-style null-terminated-string constructor of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ const char* cs = "aab";
+ test_type re(cs);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_awk.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_awk.cc
new file mode 100644
index 00000000000..8b93fe7a721
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_awk.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 7.8.2 basic_regex constructors
+
+#include <regex>
+
+void
+test01()
+{
+ std::regex re("(a|b)*abb", std::regex::awk);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_ecma.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_ecma.cc
new file mode 100644
index 00000000000..6c72736c5cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_ecma.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 7.8.2 basic_regex constructors
+
+#include <regex>
+
+void
+test01()
+{
+ std::regex re("(a|b)*abb");
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_egrep.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_egrep.cc
new file mode 100644
index 00000000000..f38a9b8704e
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_egrep.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 7.8.2 basic_regex constructors
+
+#include <regex>
+
+void
+test01()
+{
+ std::regex re("(a|b)*abb", std::regex::egrep);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_grep.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_grep.cc
new file mode 100644
index 00000000000..458f6d21cc5
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/cstring_grep.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 7.8.2 basic_regex constructors
+
+#include <regex>
+
+void
+test01()
+{
+ using std::regex;
+
+ regex re("(a|b)*abb", regex::grep);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/default.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/default.cc
new file mode 100644
index 00000000000..b7c6f410cde
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/default.cc
@@ -0,0 +1,47 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests default constructor of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ // default constructor
+ test_type re;
+
+ // Check for required typedefs
+ typedef test_type::value_type value_type;
+ typedef test_type::flag_type flag_type;
+ typedef test_type::locale_type locale_type;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/range.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/range.cc
new file mode 100644
index 00000000000..027a927849e
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/char/range.cc
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests range constructor of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ char s[] = "a+b|c";
+ test_type re(s, s + 5);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/copy_char.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/copy_char.cc
new file mode 100644
index 00000000000..4ed5f92c8b0
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/copy_char.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=c++0x" }
+
+// 2010-07-07 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2](11) class template basic_regex constructors
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests copy constructor of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ test_type src_re("aaba");
+
+ test_type target_re(src_re);
+
+ VERIFY( target_re.flags() == src_re.flags() );
+ VERIFY( target_re.mark_count() == src_re.mark_count() );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/cstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/cstring.cc
new file mode 100644
index 00000000000..691b8c7f5f1
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/cstring.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 7.8.2 basic_regex constructors
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("(wee|week)(knights|night)", std::regex::extended);
+
+ VERIFY( re.flags() == std::regex::extended );
+ VERIFY( re.mark_count() == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/string_range_01_02_03.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/string_range_01_02_03.cc
new file mode 100644
index 00000000000..036321face5
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/extended/string_range_01_02_03.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run { xfail *-*-* } }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.8.2 basic_regex ctor
+// Tests for invalid range expression
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ try
+ {
+ std::regex re("a{1,2,3}", std::regex::extended);
+ }
+ catch (std::regex_error& ex)
+ {
+ VERIFY( ex.code() == std::regex_constants::error_badbrace );
+ }
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/move_char.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/move_char.cc
new file mode 100644
index 00000000000..ba056969c5c
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/move_char.cc
@@ -0,0 +1,49 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-07-07 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2](12-14) class template basic_regex constructors
+
+#include <regex>
+#include <testsuite_hooks.h>
+#include <utility>
+
+// Tests move constructor of the basic_regex class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<char> test_type;
+
+ test_type src_re("aaba");
+ const unsigned mark_count = src_re.mark_count();
+ const test_type::flag_type flags = src_re.flags();
+
+ test_type target_re = std::move(src_re);
+
+ VERIFY( target_re.flags() == flags );
+ VERIFY( target_re.mark_count() == mark_count );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_char.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_char.cc
new file mode 100644
index 00000000000..f65d783a735
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_char.cc
@@ -0,0 +1,54 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <string>
+#include <regex>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// Tests C++ string constructor of the basic_regex class.
+void test01()
+{
+ typedef std::basic_regex<char> test_type;
+
+ std::string s("a*b");
+ test_type re(s);
+}
+
+void test02()
+{
+ typedef std::basic_regex<char> test_type;
+ typedef __gnu_test::tracker_allocator<char> alloc_type;
+
+ std::basic_string<char, std::char_traits<char>, alloc_type> s("a*b");
+ test_type re(s);
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_wchar_t.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_wchar_t.cc
new file mode 100644
index 00000000000..b715195c383
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/string_wchar_t.cc
@@ -0,0 +1,56 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <string>
+#include <regex>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// Tests C++ string constructor of the basic_regex class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ std::wstring s(L"a*b");
+ test_type re(s);
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+ typedef __gnu_test::tracker_allocator<wchar_t> alloc_type;
+
+ std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc_type> s(L"a*b");
+ test_type re(s);
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/cstring.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/cstring.cc
new file mode 100644
index 00000000000..4dabf399677
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/cstring.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests C-style null-terminated-string constructor of the basic_regex class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ const wchar_t* cs = L"aab";
+ test_type re(cs);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/default.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/default.cc
new file mode 100644
index 00000000000..a0f41740229
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/default.cc
@@ -0,0 +1,48 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests default constructor of the basic_regex class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ // default constructor
+ test_type re;
+
+ // Check for required typedefs
+ typedef test_type::value_type value_type;
+ typedef test_type::flag_type flag_type;
+ typedef test_type::locale_type locale_type;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/range.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/range.cc
new file mode 100644
index 00000000000..efc0597cc1d
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/ctors/wchar_t/range.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.2] class template basic_regex constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests range constructor of the basic_regex class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::basic_regex<wchar_t> test_type;
+
+ wchar_t s[] = L"a+b|c";
+ test_type re(s, s + 5);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/regex.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/regex.cc
new file mode 100644
index 00000000000..8a803ede81f
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/regex.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 7.4 typedef std::regex
+
+#include <regex>
+
+void
+test01()
+{
+ std::regex re;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/09_sub_match/cast_char.cc b/libstdc++-v3/testsuite/28_regex/09_sub_match/cast_char.cc
new file mode 100644
index 00000000000..6beb9c5cdb2
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/09_sub_match/cast_char.cc
@@ -0,0 +1,49 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-09 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.9.1 [re.submatch.members] sub_match members
+
+#include <regex>
+#include <string>
+#include <testsuite_hooks.h>
+
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef char value_type;
+ typedef std::basic_string<value_type> string_type;
+ typedef std::sub_match<value_type*> sub_match_type;
+ value_type test_data[] = "cabbage";
+
+ sub_match_type sm;
+ sm.first = test_data + 0;
+ sm.second = test_data + sizeof(test_data)/sizeof(value_type);
+ sm.matched = true;
+
+ string_type sm_string = sm;
+
+ VERIFY( sm_string == string_type(test_data) );
+}
diff --git a/libstdc++-v3/testsuite/28_regex/09_sub_match/cast_wchar_t.cc b/libstdc++-v3/testsuite/28_regex/09_sub_match/cast_wchar_t.cc
new file mode 100644
index 00000000000..6e29ac88c09
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/09_sub_match/cast_wchar_t.cc
@@ -0,0 +1,49 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-09 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.9.1 [re.submatch.members] sub_match members
+
+#include <regex>
+#include <string>
+#include <testsuite_hooks.h>
+
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef wchar_t value_type;
+ typedef std::basic_string<value_type> string_type;
+ typedef std::sub_match<value_type*> sub_match_type;
+ value_type test_data[] = L"cabbage";
+
+ sub_match_type sm;
+ sm.first = test_data + 0;
+ sm.second = test_data + sizeof(test_data)/sizeof(value_type);
+ sm.matched = true;
+
+ string_type sm_string = sm;
+
+ VERIFY( sm_string == string_type(test_data) );
+}
diff --git a/libstdc++-v3/testsuite/28_regex/09_sub_match/length.cc b/libstdc++-v3/testsuite/28_regex/09_sub_match/length.cc
new file mode 100644
index 00000000000..fc12b920ad9
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/09_sub_match/length.cc
@@ -0,0 +1,49 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-09 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.9.1 [re.submatch.members] sub_match members
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::sub_match<const char*> sm_t;
+ const char* test_data = "cabbage";
+ sm_t::difference_type test_len = 3;
+
+ sm_t sm1;
+ sm1.first = test_data + 0;
+ sm1.second = test_data + test_len;
+ sm1.matched = true;
+
+ sm_t sm2;
+ sm2.matched = false;
+
+ VERIFY( sm1.length() == test_len );
+ VERIFY( sm2.length() == 0 );
+}
diff --git a/libstdc++-v3/testsuite/28_regex/09_sub_match/typedefs.cc b/libstdc++-v3/testsuite/28_regex/09_sub_match/typedefs.cc
new file mode 100644
index 00000000000..c150da02dac
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/09_sub_match/typedefs.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-07 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.9 Class template sub_match
+
+#include <regex>
+
+
+void
+test01()
+{
+ typedef std::sub_match<char*> sm;
+
+ typedef sm::value_type value_type;
+ typedef sm::difference_type difference_type;
+ typedef sm::iterator iterator;
+ typedef sm::string_type string_type;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/10_match_results/ctors/char/default.cc b/libstdc++-v3/testsuite/28_regex/10_match_results/ctors/char/default.cc
new file mode 100644
index 00000000000..4c897d7a4a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/10_match_results/ctors/char/default.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=c++0x" }
+
+// 2009-06-10 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// C++0X [28.10.1] class template match_results constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests default constructor of the match_result class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::cmatch cm;
+ VERIFY( cm.size() == 0 );
+ VERIFY( cm.str() == std::cmatch::string_type() );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::smatch sm;
+ VERIFY( sm.size() == 0 );
+ VERIFY( sm.str() == std::smatch::string_type() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/10_match_results/ctors/wchar_t/default.cc b/libstdc++-v3/testsuite/28_regex/10_match_results/ctors/wchar_t/default.cc
new file mode 100644
index 00000000000..f8b3d45e867
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/10_match_results/ctors/wchar_t/default.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=c++0x" }
+
+// 2009-06-05 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// C++0X [28.10.1] class template match_results constructor
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+// Tests default constructor of the match_result class.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wcmatch cm;
+ VERIFY( cm.size() == 0 );
+ VERIFY( cm.str() == std::wcmatch::string_type() );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wsmatch sm;
+ VERIFY( sm.size() == 0 );
+ VERIFY( sm.str() == std::wsmatch::string_type() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+};
diff --git a/libstdc++-v3/testsuite/28_regex/10_match_results/typedefs.cc b/libstdc++-v3/testsuite/28_regex/10_match_results/typedefs.cc
new file mode 100644
index 00000000000..02bdcdadb71
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/10_match_results/typedefs.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.10 Class template sub_match
+
+#include <regex>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::match_results<char*> mr;
+
+ typedef mr::value_type value_type;
+ typedef mr::const_reference const_reference;
+ typedef mr::reference reference;
+ typedef mr::const_iterator const_iterator;
+ typedef mr::iterator iterator;
+ typedef mr::difference_type difference_type;
+ typedef mr::size_type size_type;
+ typedef mr::allocator_type allocator_type;
+ typedef mr::char_type char_type;
+ typedef mr::string_type string_type;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_01.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_01.cc
new file mode 100644
index 00000000000..4a7161a7967
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_01.cc
@@ -0,0 +1,63 @@
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-11 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests BRE against a std::string target.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("\\(a\\).*", std::regex::basic);
+ std::string target("aaba");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+ VERIFY( m[1].first == target.begin() );
+ VERIFY( m[1].second == target.begin()+1 );
+ VERIFY( m[1].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_00_03.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_00_03.cc
new file mode 100644
index 00000000000..6c0fdd76f2c
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_00_03.cc
@@ -0,0 +1,60 @@
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests BRE against a std::string target, exercising range {0,3}
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("a\\{0,3\\}", std::regex::basic);
+ std::string target("aa");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_01_03.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_01_03.cc
new file mode 100644
index 00000000000..3439b544b63
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_01_03.cc
@@ -0,0 +1,60 @@
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests BRE against a std::string target, exercising range {1,3}
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("a\\{1,3\\}", std::regex::basic);
+ std::string target("aa");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_02_03.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_02_03.cc
new file mode 100644
index 00000000000..dfd00a0f3d7
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/basic/string_range_02_03.cc
@@ -0,0 +1,61 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run { xfail *-*-* } }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests BRE against a std::string target, exercising range {2,3}
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("a\\{2,3\\}", std::regex::basic);
+ std::string target("aa");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_plus.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_plus.cc
new file mode 100644
index 00000000000..ad0f57e221d
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_plus.cc
@@ -0,0 +1,65 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run { xfail *-*-* } }
+
+//
+// 2010-06-21 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ERE against a C-string target, plus-sign match.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("(a+)", std::regex::extended);
+ const char target[] = "aa";
+ std::cmatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( re.mark_count() == 1 );
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target );
+ VERIFY( m.prefix().second == target );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target+sizeof(target) );
+ VERIFY( m.suffix().second == target+sizeof(target) );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target );
+ VERIFY( m[0].second == target+sizeof(target) );
+ VERIFY( m[0].matched == true );
+ VERIFY( m[1].first == target );
+ VERIFY( m[1].second == target+sizeof(target) );
+ VERIFY( m[1].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_questionmark.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_questionmark.cc
new file mode 100644
index 00000000000..21abea456a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/cstring_questionmark.cc
@@ -0,0 +1,65 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run { xfail *-*-* } }
+
+//
+// 2010-06-21 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ERE against a C-string target, question-mark match.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("(aa?)", std::regex::extended);
+ char target[] = "a";
+ std::cmatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( re.mark_count() == 1 );
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target );
+ VERIFY( m.prefix().second == target );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target+sizeof(target) );
+ VERIFY( m.suffix().second == target+sizeof(target) );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target );
+ VERIFY( m[0].second == target+sizeof(target) );
+ VERIFY( m[0].matched == true );
+ VERIFY( m[1].first == target );
+ VERIFY( m[1].second == target+sizeof(target) );
+ VERIFY( m[1].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_any.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_any.cc
new file mode 100644
index 00000000000..8d3716b1edf
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_any.cc
@@ -0,0 +1,60 @@
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-11 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ERE against a std::string target.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re(".*", std::regex::extended);
+ std::string target("aaba");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_00_03.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_00_03.cc
new file mode 100644
index 00000000000..a0a2e1fa9d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_00_03.cc
@@ -0,0 +1,60 @@
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ERE against a std::string target, exercising range {0,3}
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("a{0,3}", std::regex::extended);
+ std::string target("aa");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_01_03.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_01_03.cc
new file mode 100644
index 00000000000..b50e07645ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_01_03.cc
@@ -0,0 +1,60 @@
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ERE against a std::string target, exercising range {1,3}
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("a{1,3}", std::regex::extended);
+ std::string target("aa");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_02_03.cc b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_02_03.cc
new file mode 100644
index 00000000000..ca322a8d4cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/11_algorithms/02_match/extended/string_range_02_03.cc
@@ -0,0 +1,61 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run { xfail *-*-* } }
+
+//
+// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ERE against a std::string target, exercising range {2,3}
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("a{2,3}", std::regex::extended);
+ std::string target("aa");
+ std::smatch m;
+
+ VERIFY( std::regex_match(target, m, re) );
+
+ VERIFY( m.size() == re.mark_count()+1 );
+ VERIFY( m.empty() == false );
+ VERIFY( m.prefix().first == target.begin() );
+ VERIFY( m.prefix().second == target.begin() );
+ VERIFY( m.prefix().matched == false );
+ VERIFY( m.suffix().first == target.end() );
+ VERIFY( m.suffix().second == target.end() );
+ VERIFY( m.suffix().matched == false );
+ VERIFY( m[0].first == target.begin() );
+ VERIFY( m[0].second == target.end() );
+ VERIFY( m[0].matched == true );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/char/default.cc b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/char/default.cc
new file mode 100644
index 00000000000..2de4a0d09b8
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/char/default.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.12.1 Class template regex_iterator
+
+#include <regex>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::regex_iterator<char*> it;
+ std::cregex_iterator cit;
+ std::sregex_iterator sit;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t/default.cc b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t/default.cc
new file mode 100644
index 00000000000..33fb5baa808
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t/default.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.12.1 Class template regex_iterator
+
+#include <regex>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::regex_iterator<wchar_t*> it;
+ std::wcregex_iterator cit;
+ std::wsregex_iterator sit;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/typedefs.cc b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/typedefs.cc
new file mode 100644
index 00000000000..8ad88995078
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_iterator/typedefs.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.12.1 Class template regex_iterator
+
+#include <regex>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::regex_iterator<char*> it;
+
+ typedef it::regex_type regex_type;
+ typedef it::value_type value_type;
+ typedef it::difference_type difference_type;
+ typedef it::pointer pointer;
+ typedef it::reference reference;
+ typedef it::iterator_category iterator_category;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char/default.cc b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char/default.cc
new file mode 100644
index 00000000000..5105c7d8732
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char/default.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.12.2 Class template regex_token_iterator
+
+#include <regex>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::regex_token_iterator<char*> it;
+ std::cregex_token_iterator cit;
+ std::sregex_token_iterator sit;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t/default.cc b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t/default.cc
new file mode 100644
index 00000000000..fe918c80d71
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t/default.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+//
+// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.12.2 Class template regex_token_iterator
+
+#include <regex>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::regex_token_iterator<wchar_t*> it;
+ std::wcregex_token_iterator cit;
+ std::wsregex_token_iterator sit;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/typedefs.cc b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/typedefs.cc
new file mode 100644
index 00000000000..d765ab2f403
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/12_iterators/regex_token_iterator/typedefs.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+//
+// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.12.2 Class template regex_token_iterator
+
+#include <regex>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::regex_token_iterator<char*> it;
+
+ typedef it::regex_type regex_type;
+ typedef it::value_type value_type;
+ typedef it::difference_type difference_type;
+ typedef it::pointer pointer;
+ typedef it::reference reference;
+ typedef it::iterator_category iterator_category;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/headers/regex/std_c++0x_neg.cc b/libstdc++-v3/testsuite/28_regex/headers/regex/std_c++0x_neg.cc
index cf4e4d82db2..3afec89b710 100644
--- a/libstdc++-v3/testsuite/28_regex/headers/regex/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/28_regex/headers/regex/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <regex> // { dg-excess-errors "In file included from" }
+#include <regex>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
index 380540a20a7..66f5a81a5e5 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
@@ -28,20 +28,5 @@ int main()
return 0;
}
-// { dg-error "used here" "" { target *-*-* } 521 }
-// { dg-error "deleted function" "" { target *-*-* } 230 }
-// { dg-error "deleted function" "" { target *-*-* } 248 }
-// { dg-error "deleted function" "" { target *-*-* } 266 }
-// { dg-error "deleted function" "" { target *-*-* } 284 }
-// { dg-error "deleted function" "" { target *-*-* } 302 }
-// { dg-error "deleted function" "" { target *-*-* } 320 }
-// { dg-error "deleted function" "" { target *-*-* } 338 }
-// { dg-error "deleted function" "" { target *-*-* } 356 }
-// { dg-error "deleted function" "" { target *-*-* } 374 }
-// { dg-error "deleted function" "" { target *-*-* } 392 }
-// { dg-error "deleted function" "" { target *-*-* } 410 }
-// { dg-error "deleted function" "" { target *-*-* } 428 }
-// { dg-error "deleted function" "" { target *-*-* } 446 }
-// { dg-error "deleted function" "" { target *-*-* } 464 }
-// { dg-error "deleted function" "" { target *-*-* } 482 }
-// { dg-excess-errors "In member function" }
+// { dg-error "ambiguous" "" { target *-*-* } 522 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
index 21f77f4c21b..69b1eff1297 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
@@ -28,20 +28,5 @@ int main()
return 0;
}
-// { dg-error "used here" "" { target *-*-* } 560 }
-// { dg-error "deleted function" "" { target *-*-* } 229 }
-// { dg-error "deleted function" "" { target *-*-* } 247 }
-// { dg-error "deleted function" "" { target *-*-* } 265 }
-// { dg-error "deleted function" "" { target *-*-* } 283 }
-// { dg-error "deleted function" "" { target *-*-* } 301 }
-// { dg-error "deleted function" "" { target *-*-* } 319 }
-// { dg-error "deleted function" "" { target *-*-* } 337 }
-// { dg-error "deleted function" "" { target *-*-* } 355 }
-// { dg-error "deleted function" "" { target *-*-* } 373 }
-// { dg-error "deleted function" "" { target *-*-* } 391 }
-// { dg-error "deleted function" "" { target *-*-* } 409 }
-// { dg-error "deleted function" "" { target *-*-* } 427 }
-// { dg-error "deleted function" "" { target *-*-* } 445 }
-// { dg-error "deleted function" "" { target *-*-* } 463 }
-// { dg-error "deleted function" "" { target *-*-* } 481 }
-// { dg-excess-errors "In member function" }
+// { dg-error "deleted" "" { target *-*-* } 561 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
index fa35b9cb208..5cd2ef9fc4e 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -19,9 +19,10 @@
// <http://www.gnu.org/licenses/>.
#include <atomic>
+#include <cstddef>
int main()
{
- std::atomic_address a = { { NULL } };
+ std::atomic_address a __attribute__((unused)) = { { NULL } };
return 0;
}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
index 0ec1321e116..9405e459bf8 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
@@ -26,7 +26,6 @@ void test01()
typedef std::atomic_address test_type;
test_type t1;
test_type t2;
- t1 = t2;
+ t1 = t2; // { dg-error "ambiguous" }
}
-// { dg-error "used here" "" { target *-*-* } 29 }
-// { dg-excess-errors "deleted function" }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
index 4ede58ff8bd..69f78eed101 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
@@ -25,7 +25,7 @@ void test01()
// Copy.
typedef std::atomic_address test_type;
test_type t1;
- test_type t2(t1);
+ test_type t2(t1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 28 }
-// { dg-excess-errors "deleted function" }
+
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc
index 7a2e94977a7..b7e524a38f5 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,7 +22,7 @@
int main()
{
// Single value constructor.
- void* v = NULL;
+ void* v = 0;
std::atomic_address a(v);
return 0;
}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc
index cfb0c1bbb7a..b7724403412 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -23,5 +23,5 @@
void test01()
{
using namespace std;
- atomic_flag af = ATOMIC_FLAG_INIT;
+ atomic_flag af __attribute__((unused)) = ATOMIC_FLAG_INIT;
}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
index 924add880cf..27c60ca2dc1 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
@@ -26,7 +26,7 @@ void test01()
typedef std::atomic_flag test_type;
test_type t1;
test_type t2;
- t1 = t2;
+ t1 = t2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 29 }
-// { dg-excess-errors "deleted function" }
+
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
index 22cea6a3916..9244f683d1f 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
@@ -25,7 +25,7 @@ void test01()
// Copy.
typedef std::atomic_flag test_type;
test_type t1;
- test_type t2(t1);
+ test_type t2(t1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 28 }
-// { dg-excess-errors "deleted function" }
+
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
index d21e30c3310..751c6cdc696 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,12 +29,5 @@ int main()
return 0;
}
-// { dg-error "used here" "" { target *-*-* } 521 }
-// { dg-excess-errors "deleted function" }
-// { dg-excess-errors "deleted function" }
-// { dg-error "instantiated from" "" { target *-*-* } 28 }
-// { dg-error "instantiated from" "" { target *-*-* } 528 }
-// { dg-error "instantiated from" "" { target *-*-* } 170 }
-// { dg-error "instantiated from" "" { target *-*-* } 399 }
-// { dg-error "instantiated from" "" { target *-*-* } 168 }
-// { dg-excess-errors "In member function" }
+// { dg-error "ambiguous" "" { target *-*-* } 522 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
index be0580a46b2..976a6991d43 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,12 +29,5 @@ int main()
return 0;
}
-// { dg-error "used here" "" { target *-*-* } 560 }
-// { dg-excess-errors "deleted function" }
-// { dg-excess-errors "deleted function" }
-// { dg-error "instantiated from" "" { target *-*-* } 28 }
-// { dg-error "instantiated from" "" { target *-*-* } 566 }
-// { dg-error "instantiated from" "" { target *-*-* } 170 }
-// { dg-error "instantiated from" "" { target *-*-* } 399 }
-// { dg-error "instantiated from" "" { target *-*-* } 168 }
-// { dg-excess-errors "In member function" }
+// { dg-error "deleted" "" { target *-*-* } 561 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
index c7a5dc3098e..2a112c95838 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
@@ -2,7 +2,7 @@
// { dg-do compile }
// -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -27,7 +27,7 @@ int main()
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 404 }
// { dg-error "operator" "" { target *-*-* } 405 }
// { dg-error "operator" "" { target *-*-* } 406 }
+// { dg-error "operator" "" { target *-*-* } 407 }
// { dg-excess-errors "In file included from" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
index 59598283df1..974c947e664 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
@@ -2,7 +2,7 @@
// { dg-do compile }
// -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -28,7 +28,6 @@ int main()
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 375 }
// { dg-error "operator" "" { target *-*-* } 376 }
// { dg-error "operator" "" { target *-*-* } 377 }
-// { dg-excess-errors "In file included from" }
+// { dg-error "operator" "" { target *-*-* } 378 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
index 9cff37774ec..4927fcf1854 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
@@ -2,7 +2,7 @@
// { dg-do compile }
// -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -28,7 +28,6 @@ int main()
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 353 }
// { dg-error "operator" "" { target *-*-* } 354 }
// { dg-error "operator" "" { target *-*-* } 355 }
-// { dg-excess-errors "In file included from" }
+// { dg-error "operator" "" { target *-*-* } 356 }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc
index 9e9ad8a7b03..90648207e73 100644
--- a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc
@@ -28,8 +28,7 @@ void test01()
// assign
std::condition_variable c1;
std::condition_variable c2;
- c1 = c2;
+ c1 = c2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 70 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc
index 5765351554e..588e4f3c954 100644
--- a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc
@@ -27,8 +27,7 @@ void test01()
{
// copy
std::condition_variable c1;
- std::condition_variable c2(c1);
+ std::condition_variable c2(c1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 30 }
-// { dg-error "deleted function" "" { target *-*-* } 69 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc
index 8fa79a2cf1a..dac106c2ec4 100644
--- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc
@@ -28,8 +28,7 @@ void test01()
// assign
std::condition_variable_any c1;
std::condition_variable_any c2;
- c1 = c2;
+ c1 = c2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 179 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc
index 344f90c961c..157f60f0335 100644
--- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc
@@ -27,8 +27,7 @@ void test01()
{
// copy
std::condition_variable_any c1;
- std::condition_variable_any c2(c1);
+ std::condition_variable_any c2(c1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 30 }
-// { dg-error "deleted function" "" { target *-*-* } 178 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/future/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/future/cons/assign_neg.cc
index eef41497055..2aad5e9aa0f 100644
--- a/libstdc++-v3/testsuite/30_threads/future/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/future/cons/assign_neg.cc
@@ -31,8 +31,7 @@ void test01()
// assign
std::future<int>& p1 = get();
std::future<int>& p2 = get();
- p1 = p2;
+ p1 = p2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 34 }
-// { dg-error "deleted function" "" { target *-*-* } 581 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/future/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/future/cons/copy_neg.cc
index 14d7046bed5..5e6bccad82b 100644
--- a/libstdc++-v3/testsuite/30_threads/future/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/future/cons/copy_neg.cc
@@ -30,8 +30,7 @@ void test01()
{
// copy
std::future<int>& p1 = get();
- std::future<int> p2(p1);
+ std::future<int> p2(p1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 33 }
-// { dg-error "deleted function" "" { target *-*-* } 580 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc b/libstdc++-v3/testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc
index d1e72310901..e31e91fa214 100644
--- a/libstdc++-v3/testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <condition_variable> // { dg-excess-errors "In file included from" }
+#include <condition_variable>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/30_threads/headers/future/std_c++0x_neg.cc b/libstdc++-v3/testsuite/30_threads/headers/future/std_c++0x_neg.cc
index 5f021b8e5ac..b9fb18d9dad 100644
--- a/libstdc++-v3/testsuite/30_threads/headers/future/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/headers/future/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <future> // { dg-excess-errors "In file included from" }
+#include <future>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/30_threads/headers/mutex/std_c++0x_neg.cc b/libstdc++-v3/testsuite/30_threads/headers/mutex/std_c++0x_neg.cc
index 5d2a70b3add..ed993d5f83b 100644
--- a/libstdc++-v3/testsuite/30_threads/headers/mutex/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/headers/mutex/std_c++0x_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <mutex> // { dg-excess-errors "In file included from" }
+#include <mutex>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/30_threads/headers/thread/std_c++0x_neg.cc b/libstdc++-v3/testsuite/30_threads/headers/thread/std_c++0x_neg.cc
index 9d86cce2fcc..d056c023f0f 100644
--- a/libstdc++-v3/testsuite/30_threads/headers/thread/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/headers/thread/std_c++0x_neg.cc
@@ -20,6 +20,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <thread> // { dg-excess-errors "In file included from" }
+#include <thread>
// { dg-error "upcoming ISO" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
index 078cffceab8..20122348e6d 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,8 +29,7 @@ void test01()
typedef std::mutex mutex_type;
mutex_type m1;
mutex_type m2;
- m1 = m2;
+ m1 = m2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 83 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
index e13a0f6cfba..3fd1cd97784 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,8 +28,7 @@ void test01()
// assign
typedef std::mutex mutex_type;
mutex_type m1;
- mutex_type m2(m1);
+ mutex_type m2(m1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 82 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc
index 2b57a1c5b2f..414c861cc44 100644
--- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc
@@ -29,8 +29,7 @@ void test01()
// assign
std::packaged_task<int()> p1;
std::packaged_task<int()> p2;
- p1 = p2;
+ p1 = p2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 1228 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc
index baf718354e5..93b0821943c 100644
--- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc
@@ -28,8 +28,7 @@ void test01()
{
// copy
std::packaged_task<int()> p1;
- std::packaged_task<int()> p2(p1);
+ std::packaged_task<int()> p2(p1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 1227 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc
index 80b5e06e1d0..50b1c6e17bf 100644
--- a/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc
@@ -29,8 +29,7 @@ void test01()
// assign
std::promise<int> p1;
std::promise<int> p2;
- p1 = p2;
+ p1 = p2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 871 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc
index 27884b0bd1a..5e43d0b1fda 100644
--- a/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc
@@ -28,8 +28,7 @@ void test01()
{
// copy
std::promise<int> p1;
- std::promise<int> p2(p1);
+ std::promise<int> p2(p1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 855 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
index 6c6cefa177a..2eeefd32c32 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,8 +29,7 @@ void test01()
typedef std::recursive_mutex mutex_type;
mutex_type m1;
mutex_type m2;
- m1 = m2;
+ m1 = m2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 135 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
index b62011b8b56..232a70103a4 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,8 +28,7 @@ void test01()
// assign
typedef std::recursive_mutex mutex_type;
mutex_type m1;
- mutex_type m2(m1);
+ mutex_type m2(m1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 134 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc
index 2e092bedd11..1694423cb1f 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,8 +29,7 @@ void test01()
typedef std::recursive_timed_mutex mutex_type;
mutex_type m1;
mutex_type m2;
- m1 = m2;
+ m1 = m2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 298 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc
index 9d10a7dac55..c729d5b76a2 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,8 +28,7 @@ void test01()
// assign
typedef std::recursive_timed_mutex mutex_type;
mutex_type m1;
- mutex_type m2(m1);
+ mutex_type m2(m1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 297 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc
index f45b9f203ae..406d16085a3 100644
--- a/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc
@@ -28,8 +28,7 @@ void test01()
typedef std::thread test_type;
test_type t1;
test_type t2;
- t1 = t2;
+ t1 = t2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 149 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/copy_neg.cc
index ce5034bf502..db06e72b0f3 100644
--- a/libstdc++-v3/testsuite/30_threads/thread/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/thread/cons/copy_neg.cc
@@ -27,9 +27,13 @@ void test01()
// copy
typedef std::thread test_type;
test_type t1;
- test_type t2(t1); // XXX this is failing for the wrong reason
+ test_type t2(t1); // { dg-error "deleted" "" { xfail *-*-* } }
}
-// { dg-error "here" "" { target *-*-* } 30 }
-// { dg-error "deleted function" "" { target *-*-* } 127 }
-// { dg-excess-errors "In file included from" }
+// This is failing for the wrong reason; it should fail because we're
+// trying to call the deleted copy constructor, but instead it fails
+// because we try to call the thread(_Callable&&,_Args&&...) constructor
+// and fail because thread isn't callable. But that's OK for now.
+// { dg-error "" "" { target *-*-* } 30 }
+
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc
index 4648196966d..7c9199f321b 100644
--- a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,8 +29,7 @@ void test01()
typedef std::timed_mutex mutex_type;
mutex_type m1;
mutex_type m2;
- m1 = m2;
+ m1 = m2; // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 193 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc
index 716b0562a42..2c388962e45 100644
--- a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc
@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,8 +28,7 @@ void test01()
// assign
typedef std::timed_mutex mutex_type;
mutex_type m1;
- mutex_type m2(m1);
+ mutex_type m2(m1); // { dg-error "deleted" }
}
-// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 192 }
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc b/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc
index bab32fa0049..0ceb9a6597a 100644
--- a/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc
+++ b/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc
@@ -91,13 +91,4 @@ void test01(void) {
aptr5 = __const_pointer_cast<B_pointer>(cbptr); // ok
}
-// { dg-error "invalid conversion " "" { target *-*-* } 314 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 314 }
-// { dg-error "invalid conversion " "" { target *-*-* } 308 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 308 }
-// { dg-error "invalid conversion " "" { target *-*-* } 331 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 331 }
-// { dg-error "invalid conversion " "" { target *-*-* } 339 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 339 }
-// { dg-excess-errors "In constructor" }
-
+// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc b/libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc
index bd52fd34545..609f188aade 100644
--- a/libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc
+++ b/libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc
@@ -1,7 +1,7 @@
// { dg-require-sharedlib "" }
// { dg-options "-g -O2 -pthread -ldl" { target *-*-linux* } }
-// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -93,7 +93,7 @@ int
main (void)
{
pthread_t th;
- pthread_create(&th, NULL, tf, NULL);
- pthread_join(th, NULL);
+ pthread_create(&th, 0, tf, 0);
+ pthread_join(th, 0);
return 0;
}
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc
index 8d93029c87d..9577dfbc033 100644
--- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc
+++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc
@@ -61,4 +61,3 @@ int main()
}
// { dg-error "invalid" "" { target *-*-* } 187 }
-// { dg-excess-errors "member function" }
diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc b/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc
index 01c6714bb42..4b306619ff9 100644
--- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc
+++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc
@@ -23,4 +23,3 @@
#include <vector>
// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 167 }
-// { dg-excess-errors "In file included from" }
diff --git a/libstdc++-v3/testsuite/ext/rope/44708.cc b/libstdc++-v3/testsuite/ext/rope/44708.cc
new file mode 100644
index 00000000000..ac2fa95c742
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/rope/44708.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <ext/rope>
+
+using namespace std;
+
+// libstdc++/44708
+void test01()
+{
+ __gnu_cxx::crope line("test-test-test");
+ cout << line.c_str() << endl;
+}
diff --git a/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc b/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc
index b1520be4a57..fd1ed09c6c3 100644
--- a/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc
+++ b/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc
@@ -1,6 +1,6 @@
// 2003-05-03 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
//
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -90,10 +90,10 @@ main()
foo4 += foo3;
for (int i = 0; i < max_thread_count; i++)
- pthread_create (&tid[i], NULL, thread_main, 0);
+ pthread_create (&tid[i], 0, thread_main, 0);
for (int i = 0; i < max_thread_count; i++)
- pthread_join (tid[i], NULL);
+ pthread_join (tid[i], 0);
}
VERIFY( !std::strcmp (data, "barbazbongle") );
diff --git a/libstdc++-v3/testsuite/ext/slist/23781.cc b/libstdc++-v3/testsuite/ext/slist/23781.cc
index 9b0e0a53e82..e1493c67558 100644
--- a/libstdc++-v3/testsuite/ext/slist/23781.cc
+++ b/libstdc++-v3/testsuite/ext/slist/23781.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <ext/slist>
+#include <cstddef>
__gnu_cxx::slist<int>::iterator it = NULL; // { dg-error "conversion" }
__gnu_cxx::slist<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/10063-2.cc b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/10063-2.cc
index ce719e576f2..d0a1fcfc406 100644
--- a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/10063-2.cc
+++ b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/10063-2.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 2000, 2001, 2002, 2003, 2009, 2010 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -37,7 +37,7 @@ void test2()
fbuf.close();
FILE* file = fopen("tmp_10063-2", "r");
- setbuf(file, NULL);
+ setbuf(file, 0);
int c = getc(file);
VERIFY(c == '0');
c = getc(file);
diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/1.cc b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/1.cc
index 7eb4719a7c7..dab6c50b64d 100644
--- a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/1.cc
+++ b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/1.cc
@@ -33,7 +33,7 @@ void test01()
const char* name = "stdiobuf-1.txt";
FILE* fout = fopen(name, "w");
- fwrite(c_lit, 1, size, fout);
+ VERIFY( fwrite(c_lit, 1, size, fout) == size );
fclose(fout);
FILE* fin = fopen(name, "r");
diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc
index 6b0cee4db92..61e7a553482 100644
--- a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc
@@ -33,7 +33,7 @@ void test01()
const char* name = "stdiobuf-1.txt";
FILE* fout = fopen(name, "w");
- fwrite(c_lit, 1, size, fout);
+ VERIFY( fwrite(c_lit, 1, size, fout) == size );
fclose(fout);
FILE* fin = fopen(name, "r");
diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc
index aeb957618ae..fa754c459d0 100644
--- a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc
+++ b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc
@@ -64,7 +64,7 @@ void test01()
fputs(str, file);
fclose(file);
- freopen(name, "r", stdin);
+ VERIFY( freopen(name, "r", stdin) );
streamsize n = wcin.rdbuf()->in_avail();
while (n--)
diff --git a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc
index 36fb9729f00..de72e141c0c 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc
@@ -36,4 +36,3 @@ int main()
// { dg-error "instantiated from" "" { target *-*-* } 28 }
// { dg-error "no type" "" { target *-*-* } 67 }
-// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc
index 7c88b43c0df..847beda5bc7 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc
@@ -36,4 +36,3 @@ int main()
// { dg-error "instantiated from" "" { target *-*-* } 28 }
// { dg-error "no type" "" { target *-*-* } 110 }
-// { dg-excess-errors "In instantiation of" }
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 45a43dea5fd..33dc120a0b2 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -374,7 +374,6 @@ proc libstdc++-dg-test { prog do_what extra_tool_flags } {
# There is a libstdc++_compile made for us by default (via the tool-
# and-target file), but the defaults are lacking in goodness.
set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options];
- set comp_output [ prune_g++_output $comp_output ];
return [list $comp_output $output_file]
}
@@ -386,13 +385,16 @@ if { [info procs saved-dg-test] == [list] } {
rename dg-test saved-dg-test
proc dg-test { args } {
+ global additional_prunes
global errorInfo
if { [ catch { eval saved-dg-test $args } errmsg ] } {
set saved_info $errorInfo
+ set additional_prunes ""
unset_timeout_vars
error $errmsg $saved_info
}
+ set additional_prunes ""
unset_timeout_vars
}
}
@@ -1470,3 +1472,5 @@ proc check_v3_target_binary_io { } {
verbose "check_v3_target_binary_io: $et_binary_io" 2
return $et_binary_io
}
+
+set additional_prunes ""
diff --git a/libstdc++-v3/testsuite/lib/prune.exp b/libstdc++-v3/testsuite/lib/prune.exp
index 6c7368d10f9..a390878d76f 100644
--- a/libstdc++-v3/testsuite/lib/prune.exp
+++ b/libstdc++-v3/testsuite/lib/prune.exp
@@ -17,18 +17,45 @@
# Prune messages from g++ that aren't useful.
-proc prune_g++_output { text } {
+# Prune any messages matching ARGS[1] (a regexp) from test output.
+proc dg-prune-output { args } {
+ global additional_prunes
+
+ if { [llength $args] != 2 } {
+ error "[lindex $args 1]: need one argument"
+ return
+ }
+
+ lappend additional_prunes [lindex $args 1]
+}
+
+proc libstdc++-dg-prune { system text } {
+ global additional_prunes
# Cygwin warns about -ffunction-sections
regsub -all "(^|\n)\[^\n\]*: -ffunction-sections may affect debugging on some targets\[^\n\]*" $text "" text
# Remove parts of warnings that refer to location of previous
# definitions, etc as these confuse dejagnu
- regsub -all "(^|\n)\[^\n\]*: In function \[^\n\]*" $text "" text
+ regsub -all "(^|\n)(\[^\n\]*: )?In ((static member |lambda )?function|member|method|(copy )?constructor|destructor|instantiation|program|subroutine|block-data)\[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: (recursively )?instantiated from \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: . skipping \[0-9\]* instantiation contexts \[^\n\]*" $text "" text
+ regsub -all "(^|\n) inlined from \[^\n\]*" $text "" text
+ # Why doesn't GCC need these to strip header context?
+ regsub -all "(^|\n)In file included from \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[ \t\]*from \[^\n\]*" $text "" text
# Ignore errata warning from IA64 assembler.
regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text
regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text
+ foreach p $additional_prunes {
+ if { [string length $p] > 0 } {
+ # Following regexp matches a complete line containing $p.
+ regsub -all "(^|\n)\[^\n\]*$p\[^\n\]*" $text "" text
+ }
+ }
+
return $text
}
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/shared_ptr_neg.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/shared_ptr_neg.cc
index ec05d71e2ee..490cfc4cce6 100644
--- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/shared_ptr_neg.cc
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/shared_ptr_neg.cc
@@ -19,7 +19,7 @@
// TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared]
-#include <tr1/memory> // { dg-excess-errors "In file included from" }
+#include <tr1/memory>
#include <testsuite_hooks.h>
struct A { };
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc
index b5fe3567f9a..a80a2eec85f 100644
--- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc
@@ -36,5 +36,3 @@ void test01()
// { dg-error "incomplete" "" { target *-*-* } 409 }
}
-
-// { dg-excess-errors "" }
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc
index 2c43732041c..be04a2c9060 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc
@@ -2,7 +2,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -27,6 +27,7 @@ void test01()
const void* p = &db.block_size;
p = &db.used_block;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc
index c38254f13d4..bdc366ea725 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc
@@ -2,7 +2,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,6 +28,7 @@ void test01()
const void* p = &lc.multiplier;
p = &lc.increment;
p = &lc.modulus;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc
index 9ebddd8c6d0..52fd3a50ba2 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc
@@ -2,7 +2,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -36,6 +36,7 @@ void test01()
p = &mt.output_t;
p = &mt.output_c;
p = &mt.output_l;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc
index c68002d2766..a34938ee0e0 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc
@@ -2,7 +2,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,6 +28,7 @@ void test01()
const void* p = &swc.modulus;
p = &swc.long_lag;
p = &swc.short_lag;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc
index c1715264d3a..a0a360d730b 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc
@@ -2,7 +2,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,6 +28,7 @@ void test01()
const void* p = &swc_01.word_size;
p = &swc_01.long_lag;
p = &swc_01.short_lag;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc
index 0318b0d5e18..3fbd55247ac 100644
--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc
@@ -2,7 +2,7 @@
//
// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
//
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -28,6 +28,7 @@ void test01()
const void* p = &xor_c.shift1;
p = &xor_c.shift2;
+ p = p; // Suppress unused warning.
}
int main()
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc
index a8a06fdbcdc..1709816c306 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/iterator_null_neg.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <tr1/unordered_map>
+#include <cstddef>
std::tr1::unordered_multimap<int, int>::iterator it2 = NULL; // { dg-error "conversion" }
std::tr1::unordered_multimap<int, int>::const_iterator cit2 = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc
index d77676eb1a1..2201b2d29d1 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/iterator_null_neg.cc
@@ -1,6 +1,6 @@
// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -22,6 +22,7 @@
// libstdc++/23781
#include <tr1/unordered_set>
+#include <cstddef>
std::tr1::unordered_multiset<int>::iterator it3 = NULL; // { dg-error "conversion" }
std::tr1::unordered_multiset<int>::const_iterator cit3 = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc b/libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc
index 20e6bc06ea7..3189e7f81aa 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/utility/pair.cc
@@ -1,6 +1,6 @@
// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
-// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -36,8 +36,10 @@ main()
VERIFY(tuple_size<test_pair_type>::value == 2);
// Test if tuple_element::type returns the correct type
blank_class blank;
- tuple_element<0, pair<blank_class, int> >::type blank2 = blank;
- tuple_element<1, pair<int ,blank_class> >::type blank3 = blank;
+ tuple_element<0, pair<blank_class, int> >::type
+ blank2 __attribute__((unused)) = blank;
+ tuple_element<1, pair<int ,blank_class> >::type
+ blank3 __attribute__((unused)) = blank;
pair<int,int> test_pair(1, 2);
VERIFY(get<0>(test_pair) == 1);
VERIFY(get<1>(test_pair) == 2);
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc
index 4b6a7dfd332..862b0419f50 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc
@@ -2,7 +2,7 @@
// 2006-01-25 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -29,6 +29,7 @@ void test01()
int ch = 0, ret;
ret = std::tr1::isblank(ch);
+ ret = ret; // Suppress unused warning.
#endif
}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc
index 765df19388e..5bffa0ef332 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc
@@ -2,7 +2,7 @@
// 2006-01-26 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -46,6 +46,7 @@ void test01()
ret = std::tr1::feholdexcept(penv);
ret = std::tr1::fesetenv(penv);
ret = std::tr1::feupdateenv(penv);
+ ret = ret; // Suppress unused warning.
#endif
}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
index 7afe3b82b3a..30c7b789f4a 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
@@ -2,7 +2,7 @@
// 2006-01-30 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -53,5 +53,9 @@ void test01()
uret = std::tr1::wcstoumax(ws, wendptr, base);
#endif
+ ret = ret; // Suppress unused warnings.
+ dret = dret;
+ uret = uret;
+
#endif
}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc
index 020c273d55b..ae31a48ecf6 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc
@@ -2,7 +2,7 @@
// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -181,6 +181,13 @@ void test01()
ret = std::tr1::trunc(d0);
fret = std::tr1::truncf(f0);
ldret = std::tr1::truncl(ld0);
+
+ ret = ret; // Suppress unused warnings.
+ iret = iret;
+ lret = lret;
+ llret = llret;
+ fret = fret;
+ ldret = ldret;
#endif
}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc
index 35f8869c912..cbf8c9592eb 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc
@@ -2,7 +2,7 @@
// 2006-02-26 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -37,6 +37,7 @@ template<typename T>
ret = std::tr1::signbit(x);
iret = std::tr1::fpclassify(x);
+ iret = iret; // Suppress unused warning.
ret = std::tr1::isfinite(x);
ret = std::tr1::isinf(x);
@@ -49,6 +50,7 @@ template<typename T>
ret = std::tr1::islessequal(x, x);
ret = std::tr1::islessgreater(x, x);
ret = std::tr1::isunordered(x, x);
+ ret = ret; // Suppress unused warning.
}
void test01()
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc
index 426083ecb74..33890252201 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc
@@ -2,7 +2,7 @@
// 2006-02-05 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -46,6 +46,7 @@ void test01(int dummy, ...)
ret = std::tr1::vfscanf(stream, format, ap);
ret = std::tr1::vscanf(format, ap);
ret = std::tr1::vsscanf(cs, format, ap);
+ ret = ret; // Suppress unused warning.
#endif
}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
index 542f42990e3..f9b88dca9c7 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
@@ -2,7 +2,7 @@
// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -55,8 +55,16 @@ void test01()
ldret = std::tr1::strtold(s, endptr);
ret = std::tr1::abs(i);
+
+ ret = ret; // Suppress unused warning.
+ uret = uret;
+ fret = fret;
+ ldret = ldret;
+
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
dret = std::tr1::div(numer, denom);
+
+ dret = dret;
#endif
#endif
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc
index 2a572204529..0320c9a5a66 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc
@@ -2,7 +2,7 @@
// 2006-02-03 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -37,6 +37,8 @@ void test01(int dummy, ...)
wchar_t** endptr1 = 0;
float fret;
fret = std::tr1::wcstof(nptr1, endptr1);
+
+ fret = fret; // Suppress unused warning.
#endif
#if _GLIBCXX_HAVE_VFWSCANF
@@ -44,6 +46,8 @@ void test01(int dummy, ...)
const wchar_t* format1 = 0;
int ret1;
ret1 = std::tr1::vfwscanf(stream, format1, arg);
+
+ ret1 = ret1; // Suppress unused warning.
#endif
#if _GLIBCXX_HAVE_VSWSCANF
@@ -51,12 +55,16 @@ void test01(int dummy, ...)
const wchar_t* format2 = 0;
int ret2;
ret2 = std::tr1::vswscanf(s, format2, arg);
+
+ ret2 = ret2; // Suppress unused warning.
#endif
#if _GLIBCXX_HAVE_VWSCANF
const wchar_t* format3 = 0;
int ret3;
ret3 = std::tr1::vwscanf(format3, arg);
+
+ ret3 = ret3; // Suppress unused warning.
#endif
#if _GLIBCXX_USE_C99
@@ -72,6 +80,10 @@ void test01(int dummy, ...)
llret = std::tr1::wcstoll(nptr2, endptr2, base);
ullret = std::tr1::wcstoull(nptr2, endptr2, base);
+ ldret = ldret; // Suppress unused warnings.
+ llret = llret;
+ ullret = ullret;
+
#endif
}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc
index 9eff2088018..031b3ac160a 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc
@@ -2,7 +2,7 @@
// 2006-02-03 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,6 +32,7 @@ void test01()
std::wint_t ch = 0;
int ret;
ret = std::tr1::iswblank(ch);
+ ret = ret; // Suppress unused warning.
#endif
}
diff --git a/libstdc++-v3/testsuite/util/exception/safety.h b/libstdc++-v3/testsuite/util/exception/safety.h
index aef58b621c7..046eab9e513 100644
--- a/libstdc++-v3/testsuite/util/exception/safety.h
+++ b/libstdc++-v3/testsuite/util/exception/safety.h
@@ -1012,7 +1012,6 @@ namespace __gnu_test
_M_functions.push_back(function_type(base_type::_M_clear));
// Run tests.
- auto i = _M_functions.begin();
for (auto i = _M_functions.begin(); i != _M_functions.end(); ++i)
{
function_type& f = *i;
@@ -1163,7 +1162,6 @@ namespace __gnu_test
_M_functions.push_back(function_type(base_type::_M_rehash));
// Run tests.
- auto i = _M_functions.begin();
for (auto i = _M_functions.begin(); i != _M_functions.end(); ++i)
{
function_type& f = *i;
diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc
index 43cdb9f2b62..0f158664853 100644
--- a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc
+++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -45,7 +45,7 @@ container_rand_regression_test(unsigned long seed, size_t n, size_t m,
double mp, bool disp)
: m_seed((seed == 0) ? twister_rand_gen::get_time_determined_seed() : seed),
m_n(n), m_m(m), m_tp(tp), m_ip(ip), m_ep(ep), m_cp(cp), m_mp(mp),
- m_disp(disp), m_p_c(NULL)
+ m_disp(disp), m_p_c(0)
{ }
PB_DS_CLASS_T_DEC
@@ -71,7 +71,7 @@ default_constructor()
done = false;
}
- if (m_p_c != NULL)
+ if (m_p_c)
PB_DS_COND_COMPARE(*m_p_c, m_native_c);
return done;
}
@@ -98,7 +98,7 @@ copy_constructor()
{
PB_DS_TRACE("copy_constructor");
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typename alloc_t::group_adjustor adjust(m_p_c->size());
@@ -124,7 +124,7 @@ assignment_operator()
{
PB_DS_TRACE("assignment operator");
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typename alloc_t::group_adjustor adjust(m_p_c->size());
@@ -159,7 +159,7 @@ PB_DS_CLASS_C_DEC::
it_constructor_imp(__gnu_pbds::cc_hash_tag)
{
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typename alloc_t::group_adjustor adjust(m_p_c->size());
@@ -226,7 +226,7 @@ PB_DS_CLASS_C_DEC::
it_constructor_imp(__gnu_pbds::gp_hash_tag)
{
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typename alloc_t::group_adjustor adjust(m_p_c->size());
@@ -309,7 +309,7 @@ PB_DS_CLASS_C_DEC::
it_constructor_imp(__gnu_pbds::tree_tag)
{
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typename alloc_t::group_adjustor adjust(m_p_c->size());
@@ -345,7 +345,7 @@ PB_DS_CLASS_C_DEC::
it_constructor_imp(__gnu_pbds::list_update_tag)
{
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typename alloc_t::group_adjustor adjust(m_p_c->size());
@@ -370,7 +370,7 @@ PB_DS_CLASS_C_DEC::
it_constructor_imp(__gnu_pbds::pat_trie_tag)
{
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typename alloc_t::group_adjustor adjust(m_p_c->size());
@@ -869,7 +869,7 @@ PB_DS_CLASS_C_DEC::
operator()()
{
typedef xml_result_set_regression_formatter formatter_type;
- formatter_type* p_fmt = NULL;
+ formatter_type* p_fmt = 0;
if (m_disp)
p_fmt = new formatter_type(string_form<Cntnr>::name(),
@@ -1591,30 +1591,30 @@ policy_access(__gnu_pbds::basic_hash_tag)
{
{
typename Cntnr::hash_fn& r_t = m_p_c->get_hash_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::hash_fn& r_t =((const Cntnr& )*m_p_c).get_hash_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
typename Cntnr::eq_fn& r_t = m_p_c->get_eq_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::eq_fn& r_t =((const Cntnr& )*m_p_c).get_eq_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
typename Cntnr::resize_policy& r_t = m_p_c->get_resize_policy();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::resize_policy& r_t =((const Cntnr& )*m_p_c).get_resize_policy();
- assert(&r_t != NULL);
+ assert(&r_t);
}
}
@@ -1627,12 +1627,12 @@ policy_access(__gnu_pbds::cc_hash_tag)
{
typename Cntnr::comb_hash_fn& r_t = m_p_c->get_comb_hash_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::comb_hash_fn& r_t =((const Cntnr& )*m_p_c).get_comb_hash_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
}
@@ -1645,21 +1645,21 @@ policy_access(__gnu_pbds::gp_hash_tag)
{
typename Cntnr::comb_probe_fn& r_t = m_p_c->get_comb_probe_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::comb_probe_fn& r_t =((const Cntnr& )*m_p_c).get_comb_probe_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
typename Cntnr::probe_fn& r_t = m_p_c->get_probe_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::probe_fn& r_t =((const Cntnr& )*m_p_c).get_probe_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
}
@@ -1670,12 +1670,12 @@ policy_access(__gnu_pbds::tree_tag)
{
{
typename Cntnr::cmp_fn& r_t = m_p_c->get_cmp_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::cmp_fn& r_t =((const Cntnr& )*m_p_c).get_cmp_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
}
@@ -1691,7 +1691,7 @@ PB_DS_CLASS_C_DEC::
policy_access(__gnu_pbds::pat_trie_tag)
{
typename Cntnr::e_access_traits& r_t = m_p_c->get_e_access_traits();
- assert(&r_t != NULL);
+ assert(&r_t);
}
diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
index d4b395b126a..5f230495236 100644
--- a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
+++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -124,7 +124,7 @@ namespace detail
};
// XXX RAII, constructor takes bool for display
- xml_test_rand_regression_formatter* p_fmt = NULL;
+ xml_test_rand_regression_formatter* p_fmt = 0;
if (disp)
p_fmt = new xml_test_rand_regression_formatter(sd, n, m, tp, ip, ep, cp, mp);
diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc
index f964911facb..e929f3533fe 100644
--- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc
+++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -45,7 +45,7 @@ container_rand_regression_test(unsigned long seed, size_t n, size_t m,
double cp, double mp, bool disp)
: m_seed(seed == 0 ? twister_rand_gen::get_time_determined_seed(): seed),
m_n(n), m_m(m), m_tp(tp), m_ip(ip), m_dp(dp), m_ep(ep), m_cp(cp),
- m_mp(mp), m_disp(disp), m_p_c(NULL)
+ m_mp(mp), m_disp(disp), m_p_c(0)
{ }
PB_DS_CLASS_T_DEC
@@ -71,7 +71,7 @@ default_constructor()
done = false;
}
- if (m_p_c != NULL)
+ if (m_p_c)
PB_DS_COND_COMPARE(*m_p_c, m_native_c);
return done;
@@ -99,7 +99,7 @@ copy_constructor()
{
PB_DS_TRACE("copy_constructor");
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typedef typename allocator_type::group_adjustor adjustor;
@@ -127,7 +127,7 @@ assignment_operator()
{
PB_DS_TRACE("assignment operator");
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typedef typename allocator_type::group_adjustor adjustor;
@@ -155,7 +155,7 @@ PB_DS_CLASS_C_DEC::
it_constructor()
{
bool done = true;
- Cntnr* p_c = NULL;
+ Cntnr* p_c = 0;
m_alloc.set_probability(m_tp);
typedef typename allocator_type::group_adjustor adjustor;
adjustor adjust(m_p_c->size());
@@ -242,7 +242,7 @@ PB_DS_CLASS_C_DEC::
operator()()
{
typedef xml_result_set_regression_formatter formatter_type;
- formatter_type* p_fmt = NULL;
+ formatter_type* p_fmt = 0;
if (m_disp)
p_fmt = new formatter_type(string_form<Cntnr>::name(),
string_form<Cntnr>::desc());
@@ -668,12 +668,12 @@ policy_access()
{
typename Cntnr::cmp_fn& r_t = m_p_c->get_cmp_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
{
const typename Cntnr::cmp_fn& r_t =((const Cntnr& )*m_p_c).get_cmp_fn();
- assert(&r_t != NULL);
+ assert(&r_t);
}
}
diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp
index 1cf86020d45..37f8d51af74 100644
--- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp
+++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -123,7 +123,7 @@ namespace detail
return -2;
};
- xml_test_rand_regression_formatter* p_fmt = NULL;
+ xml_test_rand_regression_formatter* p_fmt = 0;
if (sd == 0)
sd = twister_rand_gen::get_time_determined_seed();
if (disp)
diff --git a/libstdc++-v3/testsuite/util/replacement_memory_operators.h b/libstdc++-v3/testsuite/util/replacement_memory_operators.h
index c7b19edc457..895ccfe3897 100644
--- a/libstdc++-v3/testsuite/util/replacement_memory_operators.h
+++ b/libstdc++-v3/testsuite/util/replacement_memory_operators.h
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -90,7 +90,7 @@ void* operator new(std::size_t size) throw(std::bad_alloc)
{
std::printf("operator new is called \n");
void* p = std::malloc(size);
- if (p == NULL)
+ if (!p)
throw std::bad_alloc();
__gnu_test::counter::increment();
return p;
@@ -99,7 +99,7 @@ void* operator new(std::size_t size) throw(std::bad_alloc)
void operator delete(void* p) throw()
{
std::printf("operator delete is called \n");
- if (p != NULL)
+ if (p)
{
std::free(p);
__gnu_test::counter::decrement();
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.h b/libstdc++-v3/testsuite/util/testsuite_abi.h
index ff413fdccf3..c9fe0a4d11c 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.h
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.h
@@ -1,6 +1,7 @@
// -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -16,7 +17,6 @@
// along with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
// Benjamin Kosnik <bkoz@redhat.com>
#include <string>
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index 96fe546b482..cb481b2a7f9 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// Testing allocator for the C++ library testsuite.
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -27,7 +27,6 @@
#ifndef _GLIBCXX_TESTSUITE_ALLOCATOR_H
#define _GLIBCXX_TESTSUITE_ALLOCATOR_H
-#include <cstddef>
#include <tr1/unordered_map>
#include <cassert>
#include <bits/move.h>
@@ -186,8 +185,8 @@ namespace __gnu_test
{
// Let's not core here...
Alloc a;
- a.deallocate(NULL, 1);
- a.deallocate(NULL, 10);
+ a.deallocate(0, 1);
+ a.deallocate(0, 10);
return true;
}
@@ -241,8 +240,8 @@ namespace __gnu_test
: private uneq_allocator_base
{
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef Tp* pointer;
typedef const Tp* const_pointer;
typedef Tp& reference;
diff --git a/libstdc++-v3/testsuite/util/testsuite_api.h b/libstdc++-v3/testsuite/util/testsuite_api.h
index fcb762eff66..11007904093 100644
--- a/libstdc++-v3/testsuite/util/testsuite_api.h
+++ b/libstdc++-v3/testsuite/util/testsuite_api.h
@@ -19,7 +19,6 @@
// <http://www.gnu.org/licenses/>.
//
-#include <cstddef>
#include <exception>
#include <testsuite_hooks.h>
@@ -107,7 +106,7 @@ namespace __gnu_test
// For 23 unordered_* requirements.
struct NonDefaultConstructible_hash
{
- size_t
+ std::size_t
operator()(NonDefaultConstructible) const
{ return 1; }
};
@@ -170,10 +169,29 @@ namespace __gnu_test
struct OverloadedAddress_hash
{
- size_t
+ std::size_t
operator()(const OverloadedAddress&) const
{ return 1; }
};
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ struct NonCopyConstructible
+ {
+ NonCopyConstructible() : num(-1) { }
+
+ NonCopyConstructible(NonCopyConstructible&& other)
+ : num(other.num)
+ { other.num = 0; }
+
+ NonCopyConstructible(const NonCopyConstructible&) = delete;
+
+ operator int() { return num; }
+
+ private:
+ int num;
+ };
+#endif
+
}
#endif
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
index fd60b79c897..1db0ca08c79 100644
--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
+++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
@@ -1,7 +1,8 @@
// -*- C++ -*-
// typelist for the C++ library testsuite.
//
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -622,7 +623,7 @@ namespace __gnu_test
struct _Concept
{
void __constraint()
- { _Ttype __v = {__a}; }
+ { _Ttype __v __attribute__((unused)) = {__a}; }
_Tvalue __a;
};
diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.cc b/libstdc++-v3/testsuite/util/testsuite_hooks.cc
index 6d77d57672f..1ead3485175 100644
--- a/libstdc++-v3/testsuite/util/testsuite_hooks.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_hooks.cc
@@ -2,7 +2,7 @@
// Utility subroutines for the C++ library testsuite.
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -32,7 +32,6 @@
#include <list>
#include <string>
#include <stdexcept>
-#include <cstddef>
#include <clocale>
#include <cstdlib>
#include <locale>
@@ -170,13 +169,13 @@ namespace __gnu_test
locale orig = locale::global(loc_name);
const char* res = setlocale(LC_ALL, name);
- if (res != NULL)
+ if (res)
{
string preLC_ALL = res;
const func_callback::test_type* tests = l.tests();
for (int i = 0; i < l.size(); ++i)
(*tests[i])();
- string postLC_ALL= setlocale(LC_ALL, NULL);
+ string postLC_ALL= setlocale(LC_ALL, 0);
VERIFY( preLC_ALL == postLC_ALL );
}
else
diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h
index da51d37ae62..fe41b1cb3e6 100644
--- a/libstdc++-v3/testsuite/util/testsuite_hooks.h
+++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h
@@ -1,7 +1,8 @@
// -*- C++ -*-
// Utility subroutines for the C++ library testsuite.
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -59,7 +60,7 @@
# include <cassert>
# define VERIFY(fn) assert(fn)
#else
-# define VERIFY(fn) test &= (fn)
+# define VERIFY(fn) test &= bool(fn)
#endif
#ifdef _GLIBCXX_HAVE_UNISTD_H
diff --git a/libstdc++-v3/testsuite/util/testsuite_io.h b/libstdc++-v3/testsuite/util/testsuite_io.h
index 50b1955ca11..681448aa51f 100644
--- a/libstdc++-v3/testsuite/util/testsuite_io.h
+++ b/libstdc++-v3/testsuite/util/testsuite_io.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// Testing streambuf/filebuf/stringbuf for the C++ library testsuite.
//
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -47,7 +47,7 @@ namespace __gnu_test
bool
write_position()
{
- bool one = this->pptr() != NULL;
+ bool one = this->pptr() != 0;
bool two = this->pptr() < this->epptr();
return one && two;
}
@@ -55,7 +55,7 @@ namespace __gnu_test
bool
read_position()
{
- bool one = this->gptr() != NULL;
+ bool one = this->gptr() != 0;
bool two = this->gptr() < this->egptr();
return one && two;
}
@@ -63,21 +63,21 @@ namespace __gnu_test
bool
unbuffered()
{
- bool one = this->pbase() == NULL;
- bool two = this->pptr() == NULL;
+ bool one = this->pbase() == 0;
+ bool two = this->pptr() == 0;
return one && two;
}
bool
check_pointers()
{
- bool one = this->eback() == NULL;
- bool two = this->gptr() == NULL;
- bool three = this->egptr() == NULL;
+ bool one = this->eback() == 0;
+ bool two = this->gptr() == 0;
+ bool three = this->egptr() == 0;
- bool four = this->pbase() == NULL;
- bool five = this->pptr() == NULL;
- bool six = this->epptr() == NULL;
+ bool four = this->pbase() == 0;
+ bool five = this->pptr() == 0;
+ bool six = this->epptr() == 0;
return one && two && three && four && five && six;
}
};
@@ -276,37 +276,37 @@ namespace __gnu_test
protected:
iter_type
do_put(iter_type, ios_base&, char_type, bool) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
virtual iter_type
do_put(iter_type, ios_base&, char_type, long) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
virtual iter_type
do_put(iter_type, ios_base&, char_type, unsigned long) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
#ifdef _GLIBCXX_USE_LONG_LONG
virtual iter_type
do_put(iter_type, ios_base&, char_type, long long) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
virtual iter_type
do_put(iter_type, ios_base&, char_type, unsigned long long) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
#endif
virtual iter_type
do_put(iter_type, ios_base&, char_type, double) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
virtual iter_type
do_put(iter_type, ios_base&, char_type, long double) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
virtual iter_type
do_put(iter_type, ios_base&, char_type, const void*) const
- { throw facet_error(); return iter_type(NULL); }
+ { throw facet_error(); return iter_type(0); }
};
typedef fail_num_put<char> fail_num_put_char;
diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h b/libstdc++-v3/testsuite/util/testsuite_iterators.h
index 14a725fcbec..e7a068d208d 100644
--- a/libstdc++-v3/testsuite/util/testsuite_iterators.h
+++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// Iterator Wrappers for the C++ library testsuite.
//
-// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -118,7 +118,7 @@ namespace __gnu_test
*/
template<class T>
struct output_iterator_wrapper
- : public std::iterator<std::output_iterator_tag, T, ptrdiff_t, T*, T&>
+ : public std::iterator<std::output_iterator_tag, T, std::ptrdiff_t, T*, T&>
{
typedef OutputContainer<T> ContainerType;
T* ptr;
@@ -179,7 +179,7 @@ namespace __gnu_test
*/
template<class T>
class input_iterator_wrapper
- : public std::iterator<std::input_iterator_tag, T, ptrdiff_t, T*, T&>
+ : public std::iterator<std::input_iterator_tag, T, std::ptrdiff_t, T*, T&>
{
protected:
input_iterator_wrapper()
@@ -201,7 +201,7 @@ namespace __gnu_test
bool
operator==(const input_iterator_wrapper& in) const
{
- ITERATOR_VERIFY(SharedInfo != NULL && SharedInfo == in.SharedInfo);
+ ITERATOR_VERIFY(SharedInfo && SharedInfo == in.SharedInfo);
ITERATOR_VERIFY(ptr>=SharedInfo->first && in.ptr>=SharedInfo->first);
return ptr == in.ptr;
}
@@ -274,8 +274,8 @@ namespace __gnu_test
forward_iterator_wrapper()
{
- this->ptr = NULL;
- this->SharedInfo = NULL;
+ this->ptr = 0;
+ this->SharedInfo = 0;
}
T&
@@ -435,7 +435,7 @@ namespace __gnu_test
}
random_access_iterator_wrapper&
- operator+=(ptrdiff_t n)
+ operator+=(std::ptrdiff_t n)
{
if(n > 0)
{
@@ -451,17 +451,17 @@ namespace __gnu_test
}
random_access_iterator_wrapper&
- operator-=(ptrdiff_t n)
+ operator-=(std::ptrdiff_t n)
{ return *this += -n; }
random_access_iterator_wrapper
- operator-(ptrdiff_t n) const
+ operator-(std::ptrdiff_t n) const
{
random_access_iterator_wrapper<T> tmp = *this;
return tmp -= n;
}
- ptrdiff_t
+ std::ptrdiff_t
operator-(const random_access_iterator_wrapper<T>& in) const
{
ITERATOR_VERIFY(this->SharedInfo == in.SharedInfo);
@@ -469,7 +469,7 @@ namespace __gnu_test
}
T&
- operator[](ptrdiff_t n) const
+ operator[](std::ptrdiff_t n) const
{ return *(*this + n); }
bool
@@ -500,12 +500,12 @@ namespace __gnu_test
template<typename T>
random_access_iterator_wrapper<T>
- operator+(random_access_iterator_wrapper<T> it, ptrdiff_t n)
+ operator+(random_access_iterator_wrapper<T> it, std::ptrdiff_t n)
{ return it += n; }
template<typename T>
random_access_iterator_wrapper<T>
- operator+(ptrdiff_t n, random_access_iterator_wrapper<T> it)
+ operator+(std::ptrdiff_t n, random_access_iterator_wrapper<T> it)
{ return it += n; }
diff --git a/libstdc++-v3/testsuite/util/testsuite_performance.h b/libstdc++-v3/testsuite/util/testsuite_performance.h
index 54cf8856701..61efd042db2 100644
--- a/libstdc++-v3/testsuite/util/testsuite_performance.h
+++ b/libstdc++-v3/testsuite/util/testsuite_performance.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// Testing performance utilities for the C++ library testsuite.
//
-// Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009
+// Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -50,7 +50,7 @@ extern "C"
struct mallinfo
mallinfo(void)
{
- struct mallinfo m = { (((size_t) sbrk (0) + 1023) / 1024), 0 };
+ struct mallinfo m = { (((std::size_t) sbrk (0) + 1023) / 1024), 0 };
return m;
}
}
@@ -114,15 +114,15 @@ namespace __gnu_test
std::__throw_runtime_error("time_counter::stop");
}
- size_t
+ std::size_t
real_time() const
{ return elapsed_end - elapsed_begin; }
- size_t
+ std::size_t
user_time() const
{ return tms_end.tms_utime - tms_begin.tms_utime; }
- size_t
+ std::size_t
system_time() const
{ return tms_end.tms_stime - tms_begin.tms_stime; }
};
@@ -383,7 +383,7 @@ template<typename Container, int Iter>
template<typename Container, int Iter>
void*
- do_thread(void* p = NULL)
+ do_thread(void* p = 0)
{
do_loop<Container, Iter>();
return p;
@@ -412,10 +412,10 @@ template<typename Container, int Iter, bool Thread>
pthread_create(&t3, 0, &do_thread<Container, Iter>, 0);
pthread_create(&t4, 0, &do_thread<Container, Iter>, 0);
- pthread_join(t1, NULL);
- pthread_join(t2, NULL);
- pthread_join(t3, NULL);
- pthread_join(t4, NULL);
+ pthread_join(t1, 0);
+ pthread_join(t2, 0);
+ pthread_join(t3, 0);
+ pthread_join(t4, 0);
#endif
}
stop_counters(time, resource);
diff --git a/libstdc++-v3/testsuite/util/testsuite_tr1.h b/libstdc++-v3/testsuite/util/testsuite_tr1.h
index 4f3e574ccc2..5aac18292bb 100644
--- a/libstdc++-v3/testsuite/util/testsuite_tr1.h
+++ b/libstdc++-v3/testsuite/util/testsuite_tr1.h
@@ -1,7 +1,8 @@
// -*- C++ -*-
// Testing utilities for the tr1 testsuite.
//
-// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -127,8 +128,39 @@ namespace __gnu_test
{
ExplicitClass(double&);
explicit ExplicitClass(int&);
+ ExplicitClass(double&, int&, double&);
};
+ struct NothrowExplicitClass
+ {
+ NothrowExplicitClass(double&) throw();
+ explicit NothrowExplicitClass(int&) throw();
+ NothrowExplicitClass(double&, int&, double&) throw();
+ };
+
+ struct ThrowExplicitClass
+ {
+ ThrowExplicitClass(double&) throw(int);
+ explicit ThrowExplicitClass(int&) throw(int);
+ ThrowExplicitClass(double&, int&, double&) throw(int);
+ };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ struct NoexceptExplicitClass
+ {
+ NoexceptExplicitClass(double&) noexcept(true);
+ explicit NoexceptExplicitClass(int&) noexcept(true);
+ NoexceptExplicitClass(double&, int&, double&) noexcept(true);
+ };
+
+ struct ExceptExplicitClass
+ {
+ ExceptExplicitClass(double&) noexcept(false);
+ explicit ExceptExplicitClass(int&) noexcept(false);
+ ExceptExplicitClass(double&, int&, double&) noexcept(false);
+ };
+#endif
+
struct NType // neither trivial nor standard-layout
{
int i;
diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog
index c790359f238..773bf6b21d2 100644
--- a/maintainer-scripts/ChangeLog
+++ b/maintainer-scripts/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-24 Joseph Myers <joseph@codesourcery.com>
+
+ * update_web_docs_svn: Also pass -I option pointing to ada/ source
+ directory for Ada manual.
+
2010-04-16 Joseph Myers <joseph@codesourcery.com>
* crontab: Enable 4.6 snapshots.
diff --git a/maintainer-scripts/update_web_docs_svn b/maintainer-scripts/update_web_docs_svn
index 8fb59fd90b5..a8fb3957dfe 100755
--- a/maintainer-scripts/update_web_docs_svn
+++ b/maintainer-scripts/update_web_docs_svn
@@ -153,10 +153,14 @@ fi
for file in $MANUALS; do
filename=`find . -name ${file}.texi`
if [ "${filename}" ]; then
- makeinfo --html -I ${includedir} -I `dirname ${filename}` -o ${file} ${filename}
+ includes="-I ${includedir} -I `dirname ${filename}`"
+ if [ "$file" = "gnat_ugn_unw" ]; then
+ includes="$includes -I gcc/gcc/ada"
+ fi
+ makeinfo --html $includes -o ${file} ${filename}
tar cf ${file}-html.tar ${file}/*.html
- texi2dvi -I ${includedir} -o ${file}.dvi ${filename} </dev/null >/dev/null && dvips -o ${file}.ps ${file}.dvi
- texi2pdf -I ${includedir} -o ${file}.pdf ${filename} </dev/null
+ texi2dvi $includes -o ${file}.dvi ${filename} </dev/null >/dev/null && dvips -o ${file}.ps ${file}.dvi
+ texi2pdf $includes -o ${file}.pdf ${filename} </dev/null
mkdir -p $DOCSDIR/$file
fi
done